diff --git a/agc_2-X/branches/agc_2.0.4/INSTALL b/agc_2-X/branches/agc_2.0.4/INSTALL new file mode 100644 index 00000000..33c96586 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/INSTALL @@ -0,0 +1,15 @@ +################ 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 + + +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 diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/active_list_refresh.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/active_list_refresh.php new file mode 100644 index 00000000..7ea0bff0 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/active_list_refresh.php @@ -0,0 +1,482 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid 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 "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='table') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "List Display: "; +if ($ADD==1) {echo "Live Extensions";} +if ($ADD==2) {echo "Busy Extensions";} +if ($ADD==3) {echo "Outside Lines";} +if ($ADD==4) {echo "Local Extensions";} +if ($ADD==5) {echo "Conferences";} +if ($ADD==99999) {echo "HELP";} +echo "\n"; +echo "\n"; +echo "\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 "\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + +###################### +# ADD=2 display all busy extensions on a server +###################### +if ($ADD==2) +{ + if (!$field_name) {$field_name = 'busyext';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\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 "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=4 display all busy Local lines on a server +###################### +if ($ADD==4) +{ + if (!$field_name) {$field_name = 'local';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\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 "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='table') {echo "\n";} +if ($format=='table') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/astguiclient.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/astguiclient.php new file mode 100644 index 00000000..c5fe5902 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/astguiclient.php @@ -0,0 +1,2905 @@ + LICENSE: GPLv2 +# +# make sure you have added a user to the vicidial_users MySQL table with at least +# user_level 1 or greater to access this page. Also you need to have the login +# and pass of a phone listed in the asterisk.phones table. The page grabs the +# server info and other details from this login and pass +# +# Other scripts that this application depends on: +# - active_list_refresh.php: displays active/live channels and phones +# - manager_send.php: sends Actions to be executed on Asterisk servers +# - live_exten_check.php: checks to see if user's phone is on a live call +# - call_log_display.php: retrieves log of inbound and outbound calls +# - voicemail_check.php: retrieves counts of new and old messages +# - inbound_popup.php: opens upon live_inbound call coming in +# - conf_exten_check.php: checks to see if and calls are in a specific conf +# - park_calls_display.php: retrieves list of parked calls +# - vdc_db_query.php: Changes values in the DB for non-calling records +# +# CHANGES +# 50215-1356 - Proof-of-concept test of XMLHttpRequest for astGUIclient web +# 50323-1411 - First build version display-only +# 50331-1040 - Second-build, added phone login and hangup/hijack display +# 50401-1006 - Trunk/Local Hangup functions enabled +# 50404-1056 - Trunk/Local Hijack functions enabled +# 50404-1459 - Simple live calls display and grabs updated time from server +# 50405-1221 - Reorganized the display and layers, added some images +# 50406-1005 - Added In/Out call log display to MAIN panel +# 50407-1254 - Start/Stop Recording on live calls enabled +# 50422-1101 - Activated Check Voicemail button and new/old messages count +# 50428-1449 - Added dial from log and basic live_inbound call popup +# 50429-1455 - Modified inbound popup code for IE and to add more functions +# 50502-1442 - Added basic method to transfer live calls somewhere else +# 50503-1205 - Added web_client_sessions entry for more security of subscripts +# 50503-1537 - Added basic conferences display +# 50509-1132 - Added conference connected list and hangup/xfer for them +# 50511-1129 - Added registration of conference rooms and added manual dial +# 50523-1342 - Added Conference recording and send DTMF +# 50523-1622 - Added Local Dial window frame for calling local extensions +# 50524-1456 - Added ability to park call and display number of parked calls +# 50524-1600 - Added ability to display and pickup/hangup/xfer parked calls +# 50525-1224 - Added ability to place outbound call from within conferene +# 50531-1225 - Added ability to do dual transfers to meetme rooms from Main +# 50711-1229 - removed HTTP authentication in favor of user/pass vars +# 50711-1610 - Added Zap monitoring to Trunk/Local Action screens +# 50804-1604 - Minor bug fix in inbound_popup functions +# 50818-1715 - Added pretty login section +# 50913-1137 - Added custom outbound_cid from phones table +# 51110-1430 - Fixed non-standard http port issue +# 60103-1421 - Added code for favorite extensions chooser +# 60104-1347 - Added basic layout for favorites editing frame +# 60105-1124 - Finished Favorites frame and added DB submission +# 60112-1622 - Several formatting changes +# 60421-1357 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1103 - Added variable filters to close security holes for login form +# 60829-1528 - Made compatible with WeBRooTWritablE setting in dbconnect.php +# + +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["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["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} + 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"];} + } + +$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++;} + +$version = '2.0.1'; +$build = '60829-1528'; + +### 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); + $user=ereg_replace("[^0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^0-9a-zA-Z]","",$pass); + + +if ($force_logout) +{ + if( (strlen($_SERVER['user'])>0) or (strlen($_SERVER['pass'])>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "You have now logged out. Thank you\n"; + exit; +} + +$StarTtime = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_TIME = date("Ymd-His"); + $month_old = mktime(0, 0, 0, date("m"), date("d")-7, date("Y")); + $past_month_date = date("Y-m-d H:i:s",$month_old); + + $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]; + +$US='_'; +$CL=':'; +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./astguiclient_auth_entries.txt", "a");} +$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 = $agcPAGE; +$agcDIR = eregi_replace('astguiclient.php','',$agcDIR); + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth) or ($relogin == 'YES') ) + { + header ("Content-type: text/html; charset=utf-8"); + + echo "astGUIclient web client: Login\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Login
 
User Login:
User Password:
Phone Login:
Phone Password:

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($user); + $password=strtoupper($pass); + $stmt="SELECT full_name,user_level from vicidial_users where user='$user' and pass='$pass'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + } + +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 +echo "\n"; +echo "\n"; +echo "\n"; + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "astGUIclient web client: Phone Login\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Phone Login
 
Phone Login:
Phone Password:

VERSION: $version       BUILD: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$authphone=$row[0]; +if (!$authphone) + { + echo "astGUIclient web client: Phone Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Phone Login
 
Sorry, your phone login and password are not active in this system, please try again:
 
Phone Login:
Phone Password:

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "astGUIclient web client\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $phone_login=$row[6]; + $phone_pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CaLLerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + $outbound_cid=$row[65]; + + $local_web_callerID_URL_enc = rawurlencode($local_web_callerID_URL); + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtime$US$session_ext$session_rand"; + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'agc';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','agc','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT count(*) from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_present=$row[0]; + if ($favorites_present > 0) + { + $stmt="SELECT extensions_list from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_list=$row[0]; + $h=0; + $favorites_listX = eregi_replace("'",'',$favorites_list); + $favorites = explode(',',$favorites_listX); + $favorites_count = count($favorites); + $favorites_listX=''; + + $o=0; + while ($favorites_count > $o) + { + $stmt="SELECT fullname,protocol from phones where extension = '$favorites[$o]' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $favorites_names[$o] = $rowx[0]; + $favorites_listX .= "$rowx[1]/$favorites[$o],"; + $o++; + } + + echo "\n"; + echo "\n"; + } + else + { + echo "\n"; + } + +### gather phone extensions and fullnames for favorites editor ### + $stmt="SELECT extension,fullname from phones where server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $exten_ct = mysql_num_rows($rslt); + $favlistCT=0; + $nofavlistCT=0; + while ($favlistCT < $exten_ct) + { + $row=mysql_fetch_row($rslt); + $favlist[$favlistCT]= "$row[0] - $row[1]"; + $favlistCT++; + } + + } +} + + +?> + + + + + + +\n"; + + +?> + +
+ + + + + + + + + +
+ + +LOGOUT
\n"; ?> +
Main PanelActive Lines PanelConferences PanelCheck VoicemailLive Call
+
+ + +

Logout
+
+ + +
TRUNK HANGUP

+ Active Trunks Menu
+ Hangup Trunk   |   + Hijack Trunk   |   + Listen Trunk   |   + Refresh   |   + Back to Main Window +
+
+ + +
LOCAL HANGUP

+ Active Local Menu
+ Hangup Local   |   + Hijack Local   |   + Listen Local   |   + Refresh   |   + Back to Main Window +
+
+ + + + + + + +
LIVE CALL TRANSFER
Channel to be transferred: Channel
Extensions:
Extensions Menu
+
+ Send to selected extension

+ Send to selected vmail box

+ Send to this number:


+ Refresh


+ Back to Main Window

+
Conferences:
(click on a number below to send to a conference)
Send my channel too
Conferences Menu
+
+ + + + + +
LOCAL Extensions Dial
Phone calling from: Channel
Extensions:
Extensions Menu
+
+ Call selected extension

+ Call selected vmail box

+ Refresh


+ Back to Main Window

+
+
+ + +
PARKED CALLS:
+ Back to Main Window

+
+
+ + + + + + + + + + + + + + + +
  +
VOICEMAIL     NEW:     OLD:             MANUAL DIAL       DIAL
PARKED CALLS: 0                LOCAL DIAL EXTENSIONS
OUTBOUND CALLS:
INBOUND CALLS:
astGUIclient web-client VERSION: BUILD:
+ + + + $h) + { + if (strlen($favorites[$h])>1) + { + echo "\n"; + } + $h++; + } +?> + +
FAVORITES       edit
$favorites[$h] - $favorites_names[$h]
 
+
+ + + + + + + +
FAVORITES

 
SUBMIT FAVORITES CHANGES - requires logout
BACK TO MAIN WINDOW - ignore changes made
+
+ +
+ + + + + + + + + + + + + +
+PAUSE | START     Refresh rate: 1000 ms Faster | Slower

+
Initializing..
+
Active Extensions
+REFRESH | +ORDER | +
Outside Lines
+REFRESH | +ORDER | +
Local Extensions
+REFRESH | +ORDER | +
+ Data Goes Here

+
+ Data Goes Here

Trunk Action +
+ Data Goes Here

Local Action +
+
+ + + + +
+ + +Conferences List + + + +
+Click on a conference room number on the left for info on that conference +
+ + + + + + + + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/call_log_display.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/call_log_display.php new file mode 100644 index 00000000..28d3ea87 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/call_log_display.php @@ -0,0 +1,196 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid 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 "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Call Log Display"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten is not valid or protocol $protocol is not valid\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";} + $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";} + $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"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/conf_exten_check.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/conf_exten_check.php new file mode 100644 index 00000000..ae3b84b5 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/conf_exten_check.php @@ -0,0 +1,297 @@ + LICENSE: GPLv2 +# +# 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 +# + +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"];} + +$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";} + +$version = '2.0.4-12'; +$build = '71122-0205'; +$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";} + $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 + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid 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 "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Conf Extension Check"; +echo "\n"; +echo "\n"; +echo "\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 not valid\n"; + exit; + } + else + { + + if ($client == 'vdc') + { + $Acount=0; + $AexternalDEAD=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); + $row=mysql_fetch_row($rslt); + $Acount=$row[0]; + + if ($Acount > 0) + { + $stmt="SELECT status from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Astatus=$row[0]; + } + # ### 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";} + $rslt=mysql_query($stmt, $link); + + if ($campagentstdisp == 'YES') + { + ### grab the status of this agent to display + $stmt="SELECT status,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Alogin=$row[0]; + $Acampaign=$row[1]; + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where server_ip='$server_ip' and status NOT IN('XFER') and campaign_id='$Acampaign';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $RingCalls=$row[0]; + } + else + { + $Alogin='N'; + $RingCalls='N'; + } + } + else + { + $Alogin='N'; + $RingCalls='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";} + $rslt=mysql_query($stmt, $link); + + } + + if ($Acount < 1) {$Alogin='DEAD_VLA';} + if ($AexternalDEAD > 0) {$Alogin='DEAD_EXTERNAL';} + + echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Status: ' . $Astatus . "|\n"; + + } + $total_conf=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + 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); + $ChannelA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $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++; $total_conf++; + $row=mysql_fetch_row($rslt); + $ChannelA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + } + $channels_list = ($channels_list + $sip_list); + echo "$channels_list|"; + + $counter=0; + $countecho=''; + while($total_conf > $counter) + { + $counter++; + $countecho = "$countecho$ChannelA[$counter] ~"; + # echo "$ChannelA[$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 not valid or Exten $exten is not valid\n"; + exit; + } + else + { + $stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + echo "Conference $conf_exten has been registered to $exten\n"; + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/dbconnect.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/dbconnect.php new file mode 100644 index 00000000..91e572a3 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/dbconnect.php @@ -0,0 +1,49 @@ + LICENSE: GPLv2 +# +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"); +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 + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/Thumbs.db b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/Thumbs.db new file mode 100644 index 00000000..d6ae4c59 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/Thumbs.db differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_check_voicemail_BLINK.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_check_voicemail_BLINK.gif new file mode 100644 index 00000000..30703a78 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_check_voicemail_BLINK.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_check_voicemail_BLINK_e.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_check_voicemail_BLINK_e.gif new file mode 100644 index 00000000..600cef89 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_check_voicemail_BLINK_e.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_check_voicemail_BLINK_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_check_voicemail_BLINK_es.gif new file mode 100644 index 00000000..600cef89 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_check_voicemail_BLINK_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_check_voicemail_BLINK_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_check_voicemail_BLINK_ptbr.gif new file mode 100644 index 00000000..3670af28 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_check_voicemail_BLINK_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_check_voicemail_OFF.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_check_voicemail_OFF.gif new file mode 100644 index 00000000..5b7e4c75 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_check_voicemail_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_check_voicemail_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_check_voicemail_OFF_es.gif new file mode 100644 index 00000000..ec9c1d55 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_check_voicemail_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_check_voicemail_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_check_voicemail_OFF_ptbr.gif new file mode 100644 index 00000000..3b1c4644 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_check_voicemail_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_check_voicemail_ON.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_check_voicemail_ON.gif new file mode 100644 index 00000000..ad55916d Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_check_voicemail_ON.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_check_voicemail_ON_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_check_voicemail_ON_es.gif new file mode 100644 index 00000000..442a8084 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_check_voicemail_ON_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_check_voicemail_ON_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_check_voicemail_ON_ptbr.gif new file mode 100644 index 00000000..ae53a393 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_check_voicemail_ON_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_live_call_OFF.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_live_call_OFF.gif new file mode 100644 index 00000000..3752fb5e Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_live_call_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_live_call_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_live_call_OFF_es.gif new file mode 100644 index 00000000..1ff376d8 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_live_call_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_live_call_OFF_pl.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_live_call_OFF_pl.gif new file mode 100644 index 00000000..3c42a377 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_live_call_OFF_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_live_call_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_live_call_OFF_ptbr.gif new file mode 100644 index 00000000..86a71723 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_live_call_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_live_call_ON.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_live_call_ON.gif new file mode 100644 index 00000000..ed8ba2dd Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_live_call_ON.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_live_call_ON_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_live_call_ON_es.gif new file mode 100644 index 00000000..041d398f Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_live_call_ON_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_live_call_ON_pl.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_live_call_ON_pl.gif new file mode 100644 index 00000000..330346eb Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_live_call_ON_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_live_call_ON_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_live_call_ON_ptbr.gif new file mode 100644 index 00000000..c0601666 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_live_call_ON_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_active_lines.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_active_lines.gif new file mode 100644 index 00000000..9f8eaf67 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_active_lines.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_active_lines_el.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_active_lines_el.gif new file mode 100644 index 00000000..1bea40dc Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_active_lines_el.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_active_lines_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_active_lines_es.gif new file mode 100644 index 00000000..bdefd015 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_active_lines_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_active_lines_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_active_lines_ptbr.gif new file mode 100644 index 00000000..1465ea6e Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_active_lines_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_astguiclient.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_astguiclient.gif new file mode 100644 index 00000000..30373576 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_astguiclient.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_astguiclient_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_astguiclient_ptbr.gif new file mode 100644 index 00000000..30373576 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_astguiclient_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_conferences.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_conferences.gif new file mode 100644 index 00000000..e3c80662 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_conferences.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_conferences_el.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_conferences_el.gif new file mode 100644 index 00000000..91282b42 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_conferences_el.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_conferences_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_conferences_es.gif new file mode 100644 index 00000000..14ab7171 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_conferences_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_conferences_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_conferences_ptbr.gif new file mode 100644 index 00000000..14ab7171 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_conferences_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_main.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_main.gif new file mode 100644 index 00000000..6e687e44 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_main.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_main_el.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_main_el.gif new file mode 100644 index 00000000..4eaf0aa3 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_main_el.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_main_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_main_es.gif new file mode 100644 index 00000000..b5fc2a5e Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_main_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_main_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_main_ptbr.gif new file mode 100644 index 00000000..b5fc2a5e Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/agc_tab_main_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/blank.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/blank.gif new file mode 100644 index 00000000..3a469695 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/blank.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/br.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/br.gif new file mode 100644 index 00000000..423b8a0c Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/br.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/de.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/de.gif new file mode 100644 index 00000000..4dd34f6a Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/de.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/down.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/down.gif new file mode 100644 index 00000000..32d0a007 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/down.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/el.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/el.gif new file mode 100644 index 00000000..9e79d8bf Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/el.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/en.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/en.gif new file mode 100644 index 00000000..cb45f5f4 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/en.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/es.gif new file mode 100644 index 00000000..308ea3cb Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/fr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/fr.gif new file mode 100644 index 00000000..21fb3d19 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/fr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/it.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/it.gif new file mode 100644 index 00000000..6c7b1792 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/it.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/pl.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/pl.gif new file mode 100644 index 00000000..cde07905 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/pt.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/pt.gif new file mode 100644 index 00000000..646b76ac Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/pt.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/remove.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/remove.gif new file mode 100644 index 00000000..89b0521c Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/remove.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/up.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/up.gif new file mode 100644 index 00000000..0d55544f Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/up.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_dialnextnumber.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_dialnextnumber.gif new file mode 100644 index 00000000..a5a080d6 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_dialnextnumber.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_dialnextnumber_OFF.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_dialnextnumber_OFF.gif new file mode 100644 index 00000000..75bc0e8f Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_dialnextnumber_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_dialnextnumber_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_dialnextnumber_OFF_es.gif new file mode 100644 index 00000000..405ff336 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_dialnextnumber_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_dialnextnumber_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_dialnextnumber_OFF_ptbr.gif new file mode 100644 index 00000000..0d297820 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_dialnextnumber_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_dialnextnumber_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_dialnextnumber_es.gif new file mode 100644 index 00000000..ca92716e Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_dialnextnumber_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_dialnextnumber_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_dialnextnumber_ptbr.gif new file mode 100644 index 00000000..8625b1c9 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_dialnextnumber_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_grabparkedcall.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_grabparkedcall.gif new file mode 100644 index 00000000..a6779255 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_grabparkedcall.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_grabparkedcall_OFF.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_grabparkedcall_OFF.gif new file mode 100644 index 00000000..74b1f5a1 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_grabparkedcall_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_grabparkedcall_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_grabparkedcall_OFF_es.gif new file mode 100644 index 00000000..21991dd5 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_grabparkedcall_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_grabparkedcall_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_grabparkedcall_OFF_ptbr.gif new file mode 100644 index 00000000..19932ad2 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_grabparkedcall_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_grabparkedcall_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_grabparkedcall_es.gif new file mode 100644 index 00000000..9acc363a Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_grabparkedcall_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_grabparkedcall_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_grabparkedcall_ptbr.gif new file mode 100644 index 00000000..e37d0fb4 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_grabparkedcall_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_hangupcustomer.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_hangupcustomer.gif new file mode 100644 index 00000000..b4fdfae8 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_hangupcustomer.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_hangupcustomer_OFF.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_hangupcustomer_OFF.gif new file mode 100644 index 00000000..e5736ae0 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_hangupcustomer_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_hangupcustomer_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_hangupcustomer_OFF_es.gif new file mode 100644 index 00000000..570a6e5a Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_hangupcustomer_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_hangupcustomer_OFF_pl.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_hangupcustomer_OFF_pl.gif new file mode 100644 index 00000000..50407590 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_hangupcustomer_OFF_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_hangupcustomer_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_hangupcustomer_OFF_ptbr.gif new file mode 100644 index 00000000..57918268 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_hangupcustomer_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_hangupcustomer_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_hangupcustomer_es.gif new file mode 100644 index 00000000..94d3e225 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_hangupcustomer_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_hangupcustomer_pl.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_hangupcustomer_pl.gif new file mode 100644 index 00000000..e07bc496 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_hangupcustomer_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_hangupcustomer_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_hangupcustomer_ptbr.gif new file mode 100644 index 00000000..5841050c Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_hangupcustomer_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_parkcall.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_parkcall.gif new file mode 100644 index 00000000..88fee283 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_parkcall.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_parkcall_OFF.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_parkcall_OFF.gif new file mode 100644 index 00000000..8ad55010 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_parkcall_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_parkcall_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_parkcall_OFF_es.gif new file mode 100644 index 00000000..110ce6b0 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_parkcall_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_parkcall_OFF_pl.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_parkcall_OFF_pl.gif new file mode 100644 index 00000000..c188f0fa Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_parkcall_OFF_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_parkcall_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_parkcall_OFF_ptbr.gif new file mode 100644 index 00000000..25a6a2f2 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_parkcall_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_parkcall_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_parkcall_es.gif new file mode 100644 index 00000000..2274a27c Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_parkcall_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_parkcall_pl.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_parkcall_pl.gif new file mode 100644 index 00000000..fc0d97eb Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_parkcall_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_parkcall_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_parkcall_ptbr.gif new file mode 100644 index 00000000..b37d8358 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_parkcall_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_pause.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_pause.gif new file mode 100644 index 00000000..3486a1c1 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_pause.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_pause_OFF.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_pause_OFF.gif new file mode 100644 index 00000000..fce03041 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_pause_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_pause_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_pause_OFF_es.gif new file mode 100644 index 00000000..494d68a5 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_pause_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_pause_OFF_pl.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_pause_OFF_pl.gif new file mode 100644 index 00000000..8619e9dd Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_pause_OFF_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_pause_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_pause_OFF_ptbr.gif new file mode 100644 index 00000000..3d8c8759 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_pause_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_pause_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_pause_es.gif new file mode 100644 index 00000000..544a3797 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_pause_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_pause_pl.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_pause_pl.gif new file mode 100644 index 00000000..c0e2066e Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_pause_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_pause_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_pause_ptbr.gif new file mode 100644 index 00000000..bea56d65 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_pause_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_resume.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_resume.gif new file mode 100644 index 00000000..a7d75dd8 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_resume.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_resume_OFF.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_resume_OFF.gif new file mode 100644 index 00000000..0ae4cb9a Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_resume_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_resume_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_resume_OFF_es.gif new file mode 100644 index 00000000..921d5d5e Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_resume_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_resume_OFF_pl.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_resume_OFF_pl.gif new file mode 100644 index 00000000..3cb532bc Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_resume_OFF_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_resume_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_resume_OFF_ptbr.gif new file mode 100644 index 00000000..43bb9235 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_resume_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_resume_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_resume_es.gif new file mode 100644 index 00000000..1b096144 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_resume_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_resume_pl.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_resume_pl.gif new file mode 100644 index 00000000..ec2103e7 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_resume_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_resume_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_resume_ptbr.gif new file mode 100644 index 00000000..415b22d1 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_resume_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_senddtmf.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_senddtmf.gif new file mode 100644 index 00000000..d19888ad Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_senddtmf.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_senddtmf_OFF.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_senddtmf_OFF.gif new file mode 100644 index 00000000..08a4b392 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_senddtmf_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_senddtmf_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_senddtmf_OFF_es.gif new file mode 100644 index 00000000..2d32c5e9 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_senddtmf_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_senddtmf_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_senddtmf_OFF_ptbr.gif new file mode 100644 index 00000000..2d32c5e9 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_senddtmf_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_senddtmf_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_senddtmf_es.gif new file mode 100644 index 00000000..43964df4 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_senddtmf_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_senddtmf_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_senddtmf_ptbr.gif new file mode 100644 index 00000000..43964df4 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_senddtmf_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_spacer.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_spacer.gif new file mode 100644 index 00000000..d0a4f6ed Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_spacer.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_startrecording.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_startrecording.gif new file mode 100644 index 00000000..022103d2 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_startrecording.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_startrecording_OFF.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_startrecording_OFF.gif new file mode 100644 index 00000000..3ee4ca62 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_startrecording_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_startrecording_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_startrecording_OFF_es.gif new file mode 100644 index 00000000..ff9a3447 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_startrecording_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_startrecording_OFF_p.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_startrecording_OFF_p.gif new file mode 100644 index 00000000..91098453 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_startrecording_OFF_p.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_startrecording_OFF_pl.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_startrecording_OFF_pl.gif new file mode 100644 index 00000000..a8d5cbc3 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_startrecording_OFF_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_startrecording_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_startrecording_OFF_ptbr.gif new file mode 100644 index 00000000..22105778 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_startrecording_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_startrecording_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_startrecording_es.gif new file mode 100644 index 00000000..26420f78 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_startrecording_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_startrecording_pl.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_startrecording_pl.gif new file mode 100644 index 00000000..ef031de9 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_startrecording_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_startrecording_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_startrecording_ptbr.gif new file mode 100644 index 00000000..15b25990 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_startrecording_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_stoprecording.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_stoprecording.gif new file mode 100644 index 00000000..6f3bfede Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_stoprecording.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_stoprecording_OFF.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_stoprecording_OFF.gif new file mode 100644 index 00000000..2e1efe4a Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_stoprecording_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_stoprecording_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_stoprecording_OFF_es.gif new file mode 100644 index 00000000..2806311f Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_stoprecording_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_stoprecording_OFF_pl.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_stoprecording_OFF_pl.gif new file mode 100644 index 00000000..0cf042fc Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_stoprecording_OFF_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_stoprecording_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_stoprecording_OFF_ptbr.gif new file mode 100644 index 00000000..c0259410 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_stoprecording_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_stoprecording_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_stoprecording_es.gif new file mode 100644 index 00000000..94f9de9d Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_stoprecording_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_stoprecording_pl.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_stoprecording_pl.gif new file mode 100644 index 00000000..562822d9 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_stoprecording_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_stoprecording_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_stoprecording_ptbr.gif new file mode 100644 index 00000000..8a76e860 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_stoprecording_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_transferconf.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_transferconf.gif new file mode 100644 index 00000000..c5738519 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_transferconf.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_transferconf_OFF.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_transferconf_OFF.gif new file mode 100644 index 00000000..dd0a579a Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_transferconf_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_transferconf_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_transferconf_OFF_es.gif new file mode 100644 index 00000000..d0a54bf6 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_transferconf_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_transferconf_OFF_pl.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_transferconf_OFF_pl.gif new file mode 100644 index 00000000..9e3ea08e Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_transferconf_OFF_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_transferconf_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_transferconf_OFF_ptbr.gif new file mode 100644 index 00000000..ebb69344 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_transferconf_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_transferconf_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_transferconf_es.gif new file mode 100644 index 00000000..10cfa495 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_transferconf_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_transferconf_pl.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_transferconf_pl.gif new file mode 100644 index 00000000..e30680b0 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_transferconf_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_transferconf_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_transferconf_ptbr.gif new file mode 100644 index 00000000..f008e92c Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_transferconf_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_webform.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_webform.gif new file mode 100644 index 00000000..4d5228f3 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_webform.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_webform_OFF.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_webform_OFF.gif new file mode 100644 index 00000000..64316ced Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_webform_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_webform_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_webform_OFF_es.gif new file mode 100644 index 00000000..75a56196 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_webform_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_webform_OFF_pl.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_webform_OFF_pl.gif new file mode 100644 index 00000000..cfbd2d92 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_webform_OFF_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_webform_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_webform_OFF_ptbr.gif new file mode 100644 index 00000000..75a56196 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_webform_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_webform_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_webform_es.gif new file mode 100644 index 00000000..d7590d66 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_webform_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_webform_pl.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_webform_pl.gif new file mode 100644 index 00000000..f2275e8f Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_webform_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_webform_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_webform_ptbr.gif new file mode 100644 index 00000000..d7590d66 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_LB_webform_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_ammessage.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_ammessage.gif new file mode 100644 index 00000000..484d01eb Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_ammessage.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_ammessage_OFF.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_ammessage_OFF.gif new file mode 100644 index 00000000..3aa94800 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_ammessage_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_blindtransfer.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_blindtransfer.gif new file mode 100644 index 00000000..77c03e0b Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_blindtransfer.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_blindtransfer_OFF.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_blindtransfer_OFF.gif new file mode 100644 index 00000000..7fb481ee Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_blindtransfer_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_blindtransfer_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_blindtransfer_OFF_es.gif new file mode 100644 index 00000000..05adaac5 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_blindtransfer_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_blindtransfer_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_blindtransfer_OFF_ptbr.gif new file mode 100644 index 00000000..3a069c2b Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_blindtransfer_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_blindtransfer_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_blindtransfer_es.gif new file mode 100644 index 00000000..fdad633a Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_blindtransfer_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_blindtransfer_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_blindtransfer_ptbr.gif new file mode 100644 index 00000000..c31c87fc Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_blindtransfer_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_channel.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_channel.gif new file mode 100644 index 00000000..9a9ce7ba Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_channel.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_channel_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_channel_es.gif new file mode 100644 index 00000000..a4fbf1f5 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_channel_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_channel_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_channel_ptbr.gif new file mode 100644 index 00000000..a4fbf1f5 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_channel_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_code.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_code.gif new file mode 100644 index 00000000..8fb2b8c5 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_code.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_dialwithcustomer.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_dialwithcustomer.gif new file mode 100644 index 00000000..68697edc Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_dialwithcustomer.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_dialwithcustomer_OFF.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_dialwithcustomer_OFF.gif new file mode 100644 index 00000000..8bf2e44b Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_dialwithcustomer_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_dialwithcustomer_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_dialwithcustomer_OFF_es.gif new file mode 100644 index 00000000..7ef98a94 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_dialwithcustomer_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_dialwithcustomer_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_dialwithcustomer_OFF_ptbr.gif new file mode 100644 index 00000000..1ac7dbbb Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_dialwithcustomer_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_dialwithcustomer_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_dialwithcustomer_es.gif new file mode 100644 index 00000000..d71bca15 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_dialwithcustomer_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_dialwithcustomer_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_dialwithcustomer_ptbr.gif new file mode 100644 index 00000000..90ec03f8 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_dialwithcustomer_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupbothlines.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupbothlines.gif new file mode 100644 index 00000000..4e6db07e Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupbothlines.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupbothlines_OFF.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupbothlines_OFF.gif new file mode 100644 index 00000000..f1ffdc12 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupbothlines_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupbothlines_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupbothlines_OFF_es.gif new file mode 100644 index 00000000..8f12accd Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupbothlines_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupbothlines_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupbothlines_OFF_ptbr.gif new file mode 100644 index 00000000..47b87225 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupbothlines_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupbothlines_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupbothlines_es.gif new file mode 100644 index 00000000..646c8769 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupbothlines_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupbothlines_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupbothlines_ptbr.gif new file mode 100644 index 00000000..fa0cf2fb Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupbothlines_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupxferline.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupxferline.gif new file mode 100644 index 00000000..d25a105a Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupxferline.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupxferline_OFF.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupxferline_OFF.gif new file mode 100644 index 00000000..a8fb4a3d Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupxferline_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupxferline_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupxferline_OFF_es.gif new file mode 100644 index 00000000..3c717d09 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupxferline_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupxferline_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupxferline_OFF_ptbr.gif new file mode 100644 index 00000000..f6d9080b Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupxferline_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupxferline_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupxferline_es.gif new file mode 100644 index 00000000..0d92a89c Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupxferline_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupxferline_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupxferline_ptbr.gif new file mode 100644 index 00000000..c7d26417 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hangupxferline_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_header.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_header.gif new file mode 100644 index 00000000..c813b9a3 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_header.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_header_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_header_es.gif new file mode 100644 index 00000000..a92c2df0 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_header_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_header_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_header_ptbr.gif new file mode 100644 index 00000000..a92c2df0 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_header_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hotkeysactive.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hotkeysactive.gif new file mode 100644 index 00000000..8382205e Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hotkeysactive.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hotkeysactive_OFF.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hotkeysactive_OFF.gif new file mode 100644 index 00000000..3357ed2b Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hotkeysactive_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hotkeysactive_OFF_es-orig.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hotkeysactive_OFF_es-orig.gif new file mode 100644 index 00000000..638ef859 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hotkeysactive_OFF_es-orig.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hotkeysactive_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hotkeysactive_OFF_es.gif new file mode 100644 index 00000000..5c9a3122 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hotkeysactive_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hotkeysactive_OFF_pl.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hotkeysactive_OFF_pl.gif new file mode 100644 index 00000000..5414a7d8 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hotkeysactive_OFF_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hotkeysactive_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hotkeysactive_OFF_ptbr.gif new file mode 100644 index 00000000..335e6356 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hotkeysactive_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hotkeysactive_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hotkeysactive_es.gif new file mode 100644 index 00000000..b064725c Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hotkeysactive_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hotkeysactive_pl.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hotkeysactive_pl.gif new file mode 100644 index 00000000..365d8b2f Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hotkeysactive_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hotkeysactive_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hotkeysactive_ptbr.gif new file mode 100644 index 00000000..a34409c2 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hotkeysactive_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hotkeysinactive_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hotkeysinactive_es.gif new file mode 100644 index 00000000..d0bf982c Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_hotkeysinactive_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_internalcloser.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_internalcloser.gif new file mode 100644 index 00000000..a1adca76 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_internalcloser.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_internalcloser_OFF.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_internalcloser_OFF.gif new file mode 100644 index 00000000..9d3489fa Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_internalcloser_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_internalcloser_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_internalcloser_OFF_es.gif new file mode 100644 index 00000000..45bc4290 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_internalcloser_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_internalcloser_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_internalcloser_OFF_ptbr.gif new file mode 100644 index 00000000..45bc4290 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_internalcloser_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_internalcloser_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_internalcloser_es.gif new file mode 100644 index 00000000..d5c05657 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_internalcloser_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_internalcloser_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_internalcloser_ptbr.gif new file mode 100644 index 00000000..d5c05657 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_internalcloser_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_leave3waycall.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_leave3waycall.gif new file mode 100644 index 00000000..7bca06f9 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_leave3waycall.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_leave3waycall_OFF.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_leave3waycall_OFF.gif new file mode 100644 index 00000000..63594d65 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_leave3waycall_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_leave3waycall_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_leave3waycall_OFF_es.gif new file mode 100644 index 00000000..9c41a291 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_leave3waycall_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_leave3waycall_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_leave3waycall_OFF_ptbr.gif new file mode 100644 index 00000000..63594d65 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_leave3waycall_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_leave3waycall_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_leave3waycall_es.gif new file mode 100644 index 00000000..9aa29708 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_leave3waycall_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_leave3waycall_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_leave3waycall_ptbr.gif new file mode 100644 index 00000000..7bca06f9 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_leave3waycall_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_localcloser.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_localcloser.gif new file mode 100644 index 00000000..0e10a2ad Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_localcloser.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_localcloser_OFF.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_localcloser_OFF.gif new file mode 100644 index 00000000..ed11b7ac Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_localcloser_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_localcloser_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_localcloser_OFF_es.gif new file mode 100644 index 00000000..fbad052d Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_localcloser_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_localcloser_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_localcloser_OFF_ptbr.gif new file mode 100644 index 00000000..fbad052d Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_localcloser_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_localcloser_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_localcloser_es.gif new file mode 100644 index 00000000..d36e1944 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_localcloser_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_localcloser_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_localcloser_ptbr.gif new file mode 100644 index 00000000..d36e1944 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_localcloser_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_number.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_number.gif new file mode 100644 index 00000000..33f30330 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_number.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_number_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_number_es.gif new file mode 100644 index 00000000..6d672acc Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_number_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_number_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_number_ptbr.gif new file mode 100644 index 00000000..22e82a58 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_number_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_parkcustomerdial.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_parkcustomerdial.gif new file mode 100644 index 00000000..195b1a90 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_parkcustomerdial.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_parkcustomerdial_OFF.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_parkcustomerdial_OFF.gif new file mode 100644 index 00000000..7c275732 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_parkcustomerdial_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_parkcustomerdial_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_parkcustomerdial_OFF_es.gif new file mode 100644 index 00000000..ef710c9c Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_parkcustomerdial_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_parkcustomerdial_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_parkcustomerdial_OFF_ptbr.gif new file mode 100644 index 00000000..72dee5c0 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_parkcustomerdial_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_parkcustomerdial_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_parkcustomerdial_es.gif new file mode 100644 index 00000000..accda01c Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_parkcustomerdial_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_parkcustomerdial_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_parkcustomerdial_ptbr.gif new file mode 100644 index 00000000..0101ea9e Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_parkcustomerdial_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_seconds.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_seconds.gif new file mode 100644 index 00000000..92fc7f2b Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_seconds.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_seconds_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_seconds_es.gif new file mode 100644 index 00000000..f4fe2b27 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_seconds_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_seconds_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_seconds_ptbr.gif new file mode 100644 index 00000000..f4fe2b27 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_XB_seconds_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_tab_script.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_tab_script.gif new file mode 100644 index 00000000..69e43b79 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_tab_script.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_tab_script_es.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_tab_script_es.gif new file mode 100644 index 00000000..ba4320d4 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_tab_script_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_tab_script_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_tab_script_ptbr.gif new file mode 100644 index 00000000..69e43b79 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_tab_script_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_tab_vicidial.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_tab_vicidial.gif new file mode 100644 index 00000000..1e862589 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_tab_vicidial.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_tab_vicidial_ptbr.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_tab_vicidial_ptbr.gif new file mode 100644 index 00000000..1e862589 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_tab_vicidial_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_volume_MUTE.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_volume_MUTE.gif new file mode 100644 index 00000000..1008b7e3 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_volume_MUTE.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_volume_UNMUTE.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_volume_UNMUTE.gif new file mode 100644 index 00000000..b3937d13 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_volume_UNMUTE.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_volume_down.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_volume_down.gif new file mode 100644 index 00000000..d1745c65 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_volume_down.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_volume_down_off.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_volume_down_off.gif new file mode 100644 index 00000000..9bd1b04f Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_volume_down_off.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_volume_up.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_volume_up.gif new file mode 100644 index 00000000..8aa17f19 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_volume_up.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_volume_up_off.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_volume_up_off.gif new file mode 100644 index 00000000..2e78579a Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/images/vdc_volume_up_off.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/inbound_popup.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/inbound_popup.php new file mode 100644 index 00000000..c92583de --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/inbound_popup.php @@ -0,0 +1,351 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid 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 "Invalid 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 "\n"; +echo "\n"; +echo "\n"; +?> + + +LIVE INBOUND CALL"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "

LIVE INBOUND CALL

\n"; +echo "$NOW_TIME

\n"; +} + + + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($uniqueid)<9) + { + $channel_live=0; + echo "Uniqueid $uniqueid is not valid\n"; + exit; + } + else + { + $stmt="SELECT * FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $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";} + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Channel: $row[1]
CallerID: $row[3]
\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 "GOOGLE - \n"; + echo "ANYWHO - \n"; + echo "SWITCHBOARD - \n"; + echo "VERIZON - \n"; + echo "WHITEPAGES - \n"; + echo "411.COM - \n"; + echo "411.COM - \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_Channel=$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 "CUSTOM - \n"; + + echo "
Number Dialed: $row[8]
Notes: $row[9]|$row[10]|$row[11]|$row[12]|$row[13]|
\n"; + echo "HANGUP - \n"; + echo "SEND TO MY VOICEMAIL\n"; + echo "
\n"; + + + $stmt="UPDATE live_inbound set acknowledged='Y' where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + + } + + + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/live_exten_check.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/live_exten_check.php new file mode 100644 index 00000000..3dadf572 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/live_exten_check.php @@ -0,0 +1,278 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid 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 "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Live Extension Check"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + +echo "DateTime: $NOW_TIME|"; +echo "UnixTime: $StarTtime|"; + +$stmt="SELECT count(*) FROM parked_channels where server_ip = '$server_ip';"; + if ($format=='debug') {echo "\n";} +$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 not valid or protocol $protocol is not valid\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";} + $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";} + } + } + + $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";} + $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 "ChannelA: $ChanneLA[$counter] ~"; + echo "ChannelB: $ChanneLB[$counter] ~"; + echo "ChannelBtrunk: $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";} + $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 "ChannelA: $ChanneLA[$counter] ~"; + echo "ChannelB: $ChanneLB[$counter] ~"; + echo "ChannelBtrunk: $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";} + $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 "ChannelA: $ChanneLA[$counter] ~"; + echo "ChannelB: $ChanneLB[$counter] ~"; + echo "ChannelBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel LIKE \"$ChanneLB[$counter]%\";"; + if ($format=='debug') {echo "\n";} + $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 "ChannelA: $ChanneLA[$counter] ~"; + echo "ChannelB: $ChanneLB[$counter] ~"; + echo "ChannelBtrunk: $row[0]|"; + } + else + { + echo "Conversation: $counter ~"; + echo "ChannelA: $ChanneLA[$counter] ~"; + echo "ChannelB: $ChanneLB[$counter] ~"; + echo "ChannelBtrunk: $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";} +$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";} + } + +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";} + $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";} + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/manager_send.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/manager_send.php new file mode 100644 index 00000000..94eff7b6 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/manager_send.php @@ -0,0 +1,1142 @@ + LICENSE: GPLv2 +# +# This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk 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: +# - $ACTION - ('Originate','Redirect','Hangup','Command','Monitor','StopMonitor','SysCIDOriginate','RedirectName','RedirectNameVmail','MonitorConf','StopMonitorConf','RedirectXtra','RedirectXtraCX','RedirectVD','HangupConfDial','VolumeControl','OriginateVDRelogin') +# - $queryCID - ('CN012345678901234567',...) +# - $format - ('text','debug') +# - $channel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +# - $exten - ('1234','913125551212',...) +# - $ext_context - ('default','demo',...) +# - $ext_priority - ('1','2',...) +# - $filename - ('20050406-125623_44444',...) +# - $extenName - ('phone100',...) +# - $parkedby - ('phone100',...) +# - $extrachannel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +# - $auto_dial_level - ('0','1','1.1',...) +# - $campaign - ('CLOSER','TESTCAMP',...) +# - $uniqueid - ('1120232758.2406800',...) +# - $lead_id - ('1234',...) +# - $seconds - ('32',...) +# - $outbound_cid - ('3125551212','0000000000',...) +# - $agent_log_id - ('123456',...) +# - $call_server_ip - ('10.10.10.15',...) +# - $CalLCID - ('VD01234567890123456',...) +# - $stage - ('UP','DOWN') +# + +# CHANGELOG: +# 50401-1002 - First build of script, Hangup function only +# 50404-1045 - Redirect basic function enabled +# 50406-1522 - Monitor basic function enabled +# 50407-1647 - Monitor and StopMonitor full functions enabled +# 50422-1120 - basic Originate function enabled +# 50428-1451 - basic SysCIDOriginate function enabled for checking voicemail +# 50502-1539 - basic RedirectName and RedirectNameVmail added +# 50503-1227 - added session_name checking for extra security +# 50523-1341 - added Conference call start/stop recording +# 50523-1421 - added OriginateName and OriginateNameVmail for local calls +# 50524-1602 - added RedirectToPark and RedirectFromPark +# 50531-1203 - added RedirecXtra for dual channel redirection +# 50630-1100 - script changed to not use HTTP login vars, user/pass instead +# 50804-1148 - Added RedirectVD for VICIDIAL blind redirection with logging +# 50815-1204 - Added NEXTAVAILABLE to RedirectXtra function +# 50903-2343 - Added HangupConfDial function to hangup in-dial channels in conf +# 50913-1057 - Added outbound_cid set if present to originate call +# 51020-1556 - Added agent_log_id framework for detailed agent activity logging +# 51118-1204 - Fixed Blind transfer bug from VICIDIAL when in manual dial mode +# 51129-1014 - Added ability to accept calls from other VICIDIAL servers +# 51129-1253 - Fixed Hangups of other agents channels in VICIDIAL AD +# 60310-2022 - Fixed NEXTAVAILABLE bug in leave-3way-call redirect function +# 60421-1413 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1158 - Added variable filters to close security holes for login form +# 60809-1544 - Added direct transfers to leave-3ways in consultative transfers +# 61004-1526 - Added parsing of volume control command and lookup or number +# 61130-1617 - Added lead_id to MonitorConf for recording_log +# 61201-1115 - Added user to MonitorConf for recording_log +# 70111-1600 - added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70226-1251 - Added Mute/UnMute to conference volume control +# 70320-1502 - Added option to allow retry of leave-3way-call and debug logging +# 70322-1636 - Added sipsak display ability +# + +require("dbconnect.php"); + +### These are variable assignments for PHP globals off +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["ACTION"])) {$ACTION=$_GET["ACTION"];} + elseif (isset($_POST["ACTION"])) {$ACTION=$_POST["ACTION"];} +if (isset($_GET["queryCID"])) {$queryCID=$_GET["queryCID"];} + elseif (isset($_POST["queryCID"])) {$queryCID=$_POST["queryCID"];} +if (isset($_GET["format"])) {$format=$_GET["format"];} + elseif (isset($_POST["format"])) {$format=$_POST["format"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["exten"])) {$exten=$_GET["exten"];} + elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];} +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["filename"])) {$filename=$_GET["filename"];} + elseif (isset($_POST["filename"])) {$filename=$_POST["filename"];} +if (isset($_GET["extenName"])) {$extenName=$_GET["extenName"];} + elseif (isset($_POST["extenName"])) {$extenName=$_POST["extenName"];} +if (isset($_GET["parkedby"])) {$parkedby=$_GET["parkedby"];} + elseif (isset($_POST["parkedby"])) {$parkedby=$_POST["parkedby"];} +if (isset($_GET["extrachannel"])) {$extrachannel=$_GET["extrachannel"];} + elseif (isset($_POST["extrachannel"])) {$extrachannel=$_POST["extrachannel"];} +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["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} + elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["secondS"])) {$secondS=$_GET["secondS"];} + elseif (isset($_POST["secondS"])) {$secondS=$_POST["secondS"];} +if (isset($_GET["outbound_cid"])) {$outbound_cid=$_GET["outbound_cid"];} + elseif (isset($_POST["outbound_cid"])) {$outbound_cid=$_POST["outbound_cid"];} +if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];} + elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];} +if (isset($_GET["call_server_ip"])) {$call_server_ip=$_GET["call_server_ip"];} + elseif (isset($_POST["call_server_ip"])) {$call_server_ip=$_POST["call_server_ip"];} +if (isset($_GET["CalLCID"])) {$CalLCID=$_GET["CalLCID"];} + elseif (isset($_POST["CalLCID"])) {$CalLCID=$_POST["CalLCID"];} +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["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} +if (isset($_GET["phone_ip"])) {$phone_ip=$_GET["phone_ip"];} + elseif (isset($_POST["phone_ip"])) {$phone_ip=$_POST["phone_ip"];} +if (isset($_GET["enable_sipsak_messages"])) {$enable_sipsak_messages=$_GET["enable_sipsak_messages"];} + elseif (isset($_POST["enable_sipsak_messages"])) {$enable_sipsak_messages=$_POST["enable_sipsak_messages"];} +if (isset($_GET["allow_sipsak_messages"])) {$allow_sipsak_messages=$_GET["allow_sipsak_messages"];} + elseif (isset($_POST["allow_sipsak_messages"])) {$allow_sipsak_messages=$_POST["allow_sipsak_messages"];} + +$user=ereg_replace("[^0-9a-zA-Z]","",$user); +$pass=ereg_replace("[^0-9a-zA-Z]","",$pass); +$secondS = ereg_replace("[^0-9]","",$secondS); + +# default optional vars if not set +if (!isset($ACTION)) {$ACTION="Originate";} +if (!isset($format)) {$format="alert";} +if (!isset($ext_priority)) {$ext_priority="1";} + +$version = '2.0.29'; +$build = '70320-1502'; +$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 "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid 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 "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Manager Send: "; +if ($ACTION=="Originate") {echo "Originate";} +if ($ACTION=="Redirect") {echo "Redirect";} +if ($ACTION=="RedirectName") {echo "RedirectName";} +if ($ACTION=="Hangup") {echo "Hangup";} +if ($ACTION=="Command") {echo "Command";} +if ($ACTION==99999) {echo "HELP";} +echo "\n"; +echo "\n"; +echo "\n"; +} + + + + + +###################### +# ACTION=SysCIDOriginate - insert Originate Manager statement allowing small CIDs for system calls +###################### +if ($ACTION=="SysCIDOriginate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<1) ) + { + echo "Exten $exten is not valid or queryCID $queryCID is not valid, Originate command not inserted\n"; + } + else + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate command sent for Exten $exten Channel $channel on $server_ip\n"; + } +} + + + +###################### +# ACTION=Originate, OriginateName, OriginateNameVmail - insert Originate Manager statement +###################### +if ($ACTION=="OriginateName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "extenName $extenName must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nOriginateName Action not sent\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="OriginateNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "extenName $extenName must be set\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nOriginateNameVmail Action not sent\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="OriginateVDRelogin") +{ + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $CIDdate = date("ymdHis"); + $DS='-'; + $SIPSAK_prefix = 'LIN-'; + print "\n"; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$campaign\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + $queryCID = "$SIPSAK_prefix$campaign$DS$CIDdate"; + + } + $ACTION="Originate"; +} + +if ($ACTION=="Originate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<10) ) + { + echo "Exten $exten is not valid or queryCID $queryCID is not valid, Originate command not inserted\n"; + } + else + { + if (strlen($outbound_cid)>1) + {$outCID = "\"$queryCID\" <$outbound_cid>";} + else + {$outCID = "$queryCID";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate command sent for Exten $exten Channel $channel on $server_ip\n"; + } +} + + + +###################### +# ACTION=HangupConfDial - find the Local channel that is in the conference and needs to be hung up +###################### +if ($ACTION=="HangupConfDial") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($queryCID)<15) or (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "conference $exten is not valid or ext_context $ext_context or queryCID $queryCID is not valid, Hangup command not inserted\n"; + } + else + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $hangup_channel_prefix = "$local_DEF$exten$local_AMP$ext_context"; + + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row > 0) + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $channel=$rowx[0]; + $ACTION="Hangup"; + $queryCID = eregi_replace("^.","G",$queryCID); + } + } +} + + + +###################### +# ACTION=Hangup - insert Hangup Manager statement +###################### +if ($ACTION=="Hangup") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) ) + { + $channel_live=0; + echo "Channel $channel is not valid or queryCID $queryCID is not valid, Hangup command not inserted\n"; + } + else + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + +# $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# if ($row[0]==0) +# { +# $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $rowx=mysql_fetch_row($rslt); +# if ($rowx[0]==0) +# { +# $channel_live=0; +# echo "Channel $channel is not live on $call_server_ip, Hangup command not inserted\n"; +# } +# } + if ( ($auto_dial_level > 0) and (strlen($CalLCID)>2) and (strlen($exten)>2) and ($secondS > 4)) + { + $stmt="SELECT count(*) FROM vicidial_auto_calls where channel='$channel' and callerid='$CalLCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + echo "Call $CalLCID $channel is not live on $call_server_ip, Checking Live Channel...\n"; + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel' and extension LIKE \"%$exten\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $channel_live=0; + echo "Channel $channel is not live on $call_server_ip, Hangup command not inserted $rowx[0]\n$stmt\n"; + } + else + { + echo "$stmt\n"; + } + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Hangup','$queryCID','Channel: $channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Hangup command sent for Channel $channel on $call_server_ip\n"; + } + } +} + + + +###################### +# ACTION=Redirect, RedirectName, RedirectNameVmail, RedirectToPark, RedirectFromPark, RedirectVD, RedirectXtra, RedirectXtraCX +# - insert Redirect Manager statement using extensions name +###################### +if ($ACTION=="RedirectVD") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($campaign)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($uniqueid)<2) or (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "auto_dial_level $auto_dial_level must be set\n"; + echo "campaign $campaign must be set\n"; + echo "uniqueid $uniqueid must be set\n"; + echo "lead_id $lead_id must be set\n"; + echo "\nRedirectVD Action not sent\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($auto_dial_level < 1) + { + $stmt = "UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectToPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($parkedby)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "extenName $extenName must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "parkedby $parkedby must be set\n"; + echo "\nRedirectToPark Action not sent\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "INSERT INTO parked_channels values('$channel','$server_ip','','$extenName','$parkedby','$NOW_TIME');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectFromPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirectFromPark Action not sent\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "DELETE FROM parked_channels where server_ip='$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "extenName $extenName must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirectName Action not sent\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "extenName $extenName must be set\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirectNameVmail Action not sent\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectXtraCX") +{ + $DBout=''; + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "ExtraChannel $extrachannel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirect Action not sent\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDCXC|$filename|$user|$campaign|$channel|$extrachannel|$queryCID|$exten|$ext_context|ext_priority|\n"); + fclose($fp); + } + } + } + else + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Channel $channel is not live on $call_server_ip, Redirect command not inserted\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel is not live on $call_server_ip";} + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Channel $channel is not live on $server_ip, Redirect command not inserted\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel is not live on $server_ip";} + } + } + if ( ($channel_liveX==1) && ($channel_liveY==1) ) + { + $stmt="SELECT count(*) FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0] < 1) + { + $channel_liveY=0; + echo "No Local agent to send call to, Redirect command not inserted\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "No Local agent to send call to";} + } + else + { + $stmt="SELECT server_ip,conf_exten,user FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $dest_server_ip = $rowx[0]; + $dest_session_id = $rowx[1]; + $dest_user = $rowx[2]; + $S='*'; + + $D_s_ip = explode('.', $dest_server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$dest_session_id$S$lead_id$S$dest_user$S$phone_code$S$phone_number$S$campaign$S"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','$queryCID','Channel: $extrachannel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtraCX command sent for Channel $channel on $call_server_ip and \nHungup $extrachannel on $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel on $call_server_ip, Hungup $extrachannel on $server_ip";} + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "Changed to Redirect: $channel on $server_ip";} + } + + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDCXC|$filename|$user|$campaign|$DBout|\n"); + fclose($fp); + } + } + + } +} + +if ($ACTION=="RedirectXtra") +{ + if ($channel=="$extrachannel") + {$ACTION="Redirect";} + else + { + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "ExtraChannel $extrachannel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirect Action not sent\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDX|$filename|$user|$campaign|$$channel|$extrachannel|$queryCID|$exten|$ext_context|ext_priority|\n"); + fclose($fp); + } + } + } + else + { + if ($exten == "NEXTAVAILABLE") + { + $stmt="SELECT conf_exten FROM conferences where server_ip='$server_ip' and ((extension='') or (extension is null)) limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if (strlen($row[0]) > 3) + { + $stmt="UPDATE conferences set extension='$user' where server_ip='$server_ip' and conf_exten='$row[0]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $exten = $row[0]; + } + else + { + $channel_liveX=0; + echo "Cannot find empty conference on $server_ip, Redirect command not inserted\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "Cannot find empty conference on $server_ip";} + } + } + + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Channel $channel is not live on $call_server_ip, Redirect command not inserted\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel is not live on $call_server_ip";} + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Channel $channel is not live on $server_ip, Redirect command not inserted\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel is not live on $server_ip";} + } + } + if ( ($channel_liveX==1) && ($channel_liveY==1) ) + { + if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','ExtraChannel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra command sent for Channel $channel and \nExtraChannel $extrachannel\n to $exten on $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel and $extrachannel to $exten on $server_ip";} + } + else + { + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$exten"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra command sent for Channel $channel on $call_server_ip and \nExtraChannel $extrachannel\n to $exten on $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel/$call_server_ip and $extrachannel/$server_ip to $exten";} + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + + } + + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDX|$filename|$user|$campaign|$DBout|\n"); + fclose($fp); + } + } + + } + } +} + + +if ($ACTION=="Redirect") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirect Action not sent\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Channel $channel is not live on $server_ip, Redirect command not inserted\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "Redirect command sent for Channel $channel on $server_ip\n"; + } + } +} + + + +###################### +# ACTION=Monitor or Stop Monitor - insert Monitor/StopMonitor Manager statement to start recording on a channel +###################### +if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) +{ + if ($ACTION=="StopMonitor") + {$SQLfile = "";} + else + {$SQLfile = "File: $filename";} + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Channel $channel is not valid or queryCID $queryCID is not valid or filename: $filename is not valid, $ACTION command not inserted\n"; + } + else + { + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Channel $channel is not live on $server_ip, $ACTION command not inserted\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','$ACTION','$queryCID','Channel: $channel','$SQLfile','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + if ($ACTION=="Monitor") + { + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + } + echo "$ACTION command sent for Channel $channel on $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n"; + } + } +} + + + + + + +###################### +# ACTION=MonitorConf or StopMonitorConf - insert Monitor/StopMonitor Manager statement to start recording on a conference +###################### +if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($channel)<4) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Channel $channel is not valid or exten $exten is not valid or filename: $filename is not valid, $ACTION command not inserted\n"; + } + else + { + + if ($ACTION=="MonitorConf") + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$filename','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $filename','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + # find and hang up all recordings going on in this conference # and extension = '$exten' + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$channel%\" and channel LIKE \"%,1\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + # $rec_count = intval(mysql_num_rows($rslt) / 2); + $rec_count = mysql_num_rows($rslt); + $h=0; + while ($rec_count>$h) + { + $rowx=mysql_fetch_row($rslt); + $HUchannel[$h] = $rowx[0]; + $h++; + } + $i=0; + while ($h>$i) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$i','Channel: $HUchannel[$i]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $i++; + } + + } + echo "$ACTION command sent for Channel $channel on $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n RECORDING WILL LAST UP TO 60 MINUTES\n"; + } +} + + + + + +###################### +# ACTION=VolumeControl - raise or lower the volume of a meetme participant +###################### +if ($ACTION=="VolumeControl") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($stage)<1) or (strlen($queryCID)<1) ) + { + echo "Conference $exten, Stage $stage is not valid or queryCID $queryCID is not valid, Originate command not inserted\n"; + } + else + { + $participant_number='XXYYXXYYXXYYXX'; + if (eregi('UP',$stage)) {$vol_prefix='4';} + if (eregi('DOWN',$stage)) {$vol_prefix='3';} + if (eregi('UNMUTE',$stage)) {$vol_prefix='2';} + if (eregi('MUTING',$stage)) {$vol_prefix='1';} + $local_DEF = 'Local/'; + $local_AMP = '@'; + $volume_local_channel = "$local_DEF$participant_number$vol_prefix$exten$local_AMP$ext_context"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $volume_local_channel','Context: $ext_context','Exten: 8300','Priority: 1','Callerid: $queryCID','','','','$channel','$exten');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Volume command sent for Conference $exten, Stage $stage Channel $channel on $server_ip\n"; + } +} + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='debug') {echo "\n";} +if ($format=='debug') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/park_calls_display.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/park_calls_display.php new file mode 100644 index 00000000..872f5780 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/park_calls_display.php @@ -0,0 +1,146 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) { + echo "Invalid server_ip: |$server_ip| or Invalid 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 "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Parked Calls Display"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten is not valid or protocol $protocol is not valid\n"; + exit; + } + else + { + ##### print parked calls from the parked_channels table + $stmt="SELECT * from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;"; + if ($format=='debug') {echo "\n";} + $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"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/vdc_db_query.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/vdc_db_query.php new file mode 100644 index 00000000..129af642 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/vdc_db_query.php @@ -0,0 +1,2535 @@ + LICENSE: GPLv2 +# +# 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 - ('regCLOSER','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCALL','manDiaLlogCALL','userLOGout','updateDISPO','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs','CalLBacKLisT','CalLBacKCounT','PauseCodeSubmit','LogiNCamPaigns') +# - $stage - ('start','finish','lookup','new') +# - $closer_choice - ('CL_TESTCAMP_L CL_OUT123_L -') +# - $conf_exten - ('8600011',...) +# - $exten - ('123test',...) +# - $ext_context - ('default','demo',...) +# - $ext_priority - ('1','2',...) +# - $campaign - ('testcamp',...) +# - $dial_timeout - ('60','26',...) +# - $dial_prefix - ('9','8',...) +# - $campaign_cid - ('3125551212','0000000000',...) +# - $MDnextCID - ('M06301413000000002',...) +# - $uniqueid - ('1120232758.2406800',...) +# - $lead_id - ('36524',...) +# - $list_id - ('101','123456',...) +# - $length_in_sec - ('12',...) +# - $phone_code - ('1',...) +# - $phone_number - ('3125551212',...) +# - $channel - ('Zap/12-1',...) +# - $start_epoch - ('1120236911',...) +# - $vendor_lead_code - ('1234test',...) +# - $title - ('Mr.',...) +# - $first_name - ('Bob',...) +# - $middle_initial - ('L',...) +# - $last_name - ('Wilson',...) +# - $address1 - ('1324 Main St.',...) +# - $address2 - ('Apt. 12',...) +# - $address3 - ('co Robert Wilson',...) +# - $city - ('Chicago',...) +# - $state - ('IL',...) +# - $province - ('NA',...) +# - $postal_code - ('60054',...) +# - $country_code - ('USA',...) +# - $gender - ('M',...) +# - $date_of_birth - ('1970-01-01',...) +# - $alt_phone - ('3125551213',...) +# - $email - ('bob@bob.com',...) +# - $security_phrase - ('Hello',...) +# - $comments - ('Good Customer',...) +# - $auto_dial_level - ('0','1','1.2',...) +# - $VDstop_rec_after_each_call - ('0','1') +# - $conf_silent_prefix - ('7','8','',...) +# - $extension - ('123','user123','25-1',...) +# - $protocol - ('Zap','SIP','IAX2',...) +# - $user_abb - ('1234','6666',...) +# - $preview - ('YES','NO',...) +# - $called_count - ('0','1','2',...) +# - $agent_log_id - ('123456',...) +# - $agent_log - ('NO',...) +# - $favorites_list - (",'cc160','cc100'",...) +# - $CallBackDatETimE - ('2006-04-21 14:30:00',...) +# - $recipient - ('ANYONE,'USERONLY') +# - $callback_id - ('12345','12346',...) +# - $use_internal_dnc - ('Y','N') +# - $omit_phone_code - ('Y','N') +# - $no_delete_sessions - ('0','1') + +# CHANGELOG: +# 50629-1044 - First build of script +# 50630-1422 - Added manual dial action and MD channel lookup +# 50701-1451 - Added dial log for start and end of vicidial calls +# 50705-1239 - Added call disposition update +# 50804-1627 - Fixed updateDispo to update vicidial_log entry +# 50816-1605 - Added VDADpause/ready for auto dialing +# 50816-1811 - Added basic autodial call pickup functions +# 50817-1005 - Altered logging functions to accomodate auto_dialing +# 50818-1305 - Added stop-all-recordings-after-each-vicidial-call option +# 50818-1411 - Added hangup of agent phone after Logout +# 50901-1315 - Fixed CLOSER IN-GROUP Web Form bug +# 50902-1507 - Fixed CLOSER log length_in_sec bug +# 50902-1730 - Added functions for manual preview dialing and revert +# 50913-1214 - Added agent random update to leadupdate +# 51020-1421 - Added agent_log_id framework for detailed agent activity logging +# 51021-1717 - Allows for multi-line comments (changes \n to !N in database) +# 51111-1046 - Added vicidial_agent_log lead_id earlier for manual dial +# 51121-1445 - Altered echo statements for several small PHP speed optimizations +# 51122-1328 - Fixed UserLogout issue not removing conference reservation +# 51129-1012 - Added ability to accept calls from other VICIDIAL servers +# 51129-1729 - Changed manual dial to use the '/n' flag for calls +# 51221-1154 - Added SCRIPT id lookup and sending to vicidial.php for display +# 60105-1059 - Added Updating of astguiclient favorites in the DB +# 60208-1617 - Added dtmf buttons output per call +# 60213-1521 - Added closer_campaigns update to vicidial_users +# 60215-1036 - Added Callback date-time entry into vicidial_callbacks table +# 60413-1541 - Added USERONLY Callback listings output - CalLBacKLisT +# - Added USERONLY Callback count output - CalLBacKCounT +# 60414-1140 - Added Callback lead lookup for manual dialing +# 60419-1517 - After CALLBK is sent to agent, update callback record to INACTIVE +# 60421-1419 - Check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60427-1236 - Fixed closer_choice error for CLOSER campaigns +# 60609-1148 - Added ability to check for manual dial numbers in DNC +# 60619-1117 - Added variable filters to close security holes for login form +# 60623-1414 - Fixed variable filter for phone_code and fixed manual dial logic +# 60821-1600 - Added ability to omit the phone code on vicidial lead dialing +# 60821-1647 - Added ability to not delete sessions at logout +# 60906-1124 - Added lookup and sending of callback data for CALLBK calls +# 61128-2229 - Added vicidial_live_agents and vicidial_auto_calls manual dial entries +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70115-1733 - Added alt_dial functionality in auto-dial modes +# 70118-1501 - Added user_group to vicidial_log,_agent_log,_closer_log,_callbacks +# 70123-1357 - Fixed bug that would not update vicidial_closer_log status to dispo +# 70202-1438 - Added pause code submit function +# 70203-0930 - Added dialed_number to lead info output +# 70203-1030 - Added dialed_label to lead info output +# 70206-1126 - Added INBOUND status for inbound/closer calls in vicidial_live_agents +# 70212-1253 - Fixed small issue with CXFER +# 70213-1431 - Added QueueMetrics PAUSE/UNPAUSE/AGENTLOGIN/AGENTLOGOFF actions +# 70214-1231 - Added queuemetrics_log_id field for server_id in queue_log +# 70215-1210 - Added queuemetrics COMPLETEAGENT action +# 70216-1051 - Fixed double call complete queuemetrics logging +# 70222-1616 - Changed queue_log PAUSE/UNPAUSE to PAUSEALL/UNPAUSEALL +# 70309-1034 - Allow amphersands and questions marks in comments to pass through +# 70313-1052 - Allow pound signs(hash) in comments to pass through +# 70319-1544 - Added agent disable update customer data function +# 70322-1545 - Added sipsak display ability +# 70413-1253 - Fixed bug for outbound call time in CLOSER-type blended campaigns +# 70424-1100 - Fixed bug for fronter/closer calls that would delete vdac records +# 70802-1729 - Fixed bugs with pause_sec and wait_sec under certain call handling +# 70828-1443 - Added source_id to output of SCRIPTtab-IFRAME and WEBFORM +# 71029-1855 - removed campaign_id naming restrictions for CLOSER-type campaigns +# 71030-2047 - added hopper priority for auto alt dial entries +# 71116-1011 - added calls_today count updating of the vicidial_live_agents upon INCALL +# 71120-1520 - added LogiNCamPaigns to show only allowed campaigns for agents upon login +# 71125-1751 - Added inbound-group default inbound group sending to vicidial.php +# 71129-2025 - restricted callbacks count and list to campaign only +# + +$version = '2.0.4-65'; +$build = '71129-2025'; + +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["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["closer_choice"])) {$closer_choice=$_GET["closer_choice"];} + elseif (isset($_POST["closer_choice"])) {$closer_choice=$_POST["closer_choice"];} +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["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["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["dial_timeout"])) {$dial_timeout=$_GET["dial_timeout"];} + elseif (isset($_POST["dial_timeout"])) {$dial_timeout=$_POST["dial_timeout"];} +if (isset($_GET["dial_prefix"])) {$dial_prefix=$_GET["dial_prefix"];} + elseif (isset($_POST["dial_prefix"])) {$dial_prefix=$_POST["dial_prefix"];} +if (isset($_GET["campaign_cid"])) {$campaign_cid=$_GET["campaign_cid"];} + elseif (isset($_POST["campaign_cid"])) {$campaign_cid=$_POST["campaign_cid"];} +if (isset($_GET["MDnextCID"])) {$MDnextCID=$_GET["MDnextCID"];} + elseif (isset($_POST["MDnextCID"])) {$MDnextCID=$_POST["MDnextCID"];} +if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} + elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["length_in_sec"])) {$length_in_sec=$_GET["length_in_sec"];} + elseif (isset($_POST["length_in_sec"])) {$length_in_sec=$_POST["length_in_sec"];} +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["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["start_epoch"])) {$start_epoch=$_GET["start_epoch"];} + elseif (isset($_POST["start_epoch"])) {$start_epoch=$_POST["start_epoch"];} +if (isset($_GET["dispo_choice"])) {$dispo_choice=$_GET["dispo_choice"];} + elseif (isset($_POST["dispo_choice"])) {$dispo_choice=$_POST["dispo_choice"];} +if (isset($_GET["vendor_lead_code"])) {$vendor_lead_code=$_GET["vendor_lead_code"];} + elseif (isset($_POST["vendor_lead_code"])) {$vendor_lead_code=$_POST["vendor_lead_code"];} +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["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["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_GET["VDstop_rec_after_each_call"];} + elseif (isset($_POST["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_POST["VDstop_rec_after_each_call"];} +if (isset($_GET["conf_silent_prefix"])) {$conf_silent_prefix=$_GET["conf_silent_prefix"];} + elseif (isset($_POST["conf_silent_prefix"])) {$conf_silent_prefix=$_POST["conf_silent_prefix"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} +if (isset($_GET["user_abb"])) {$user_abb=$_GET["user_abb"];} + elseif (isset($_POST["user_abb"])) {$user_abb=$_POST["user_abb"];} +if (isset($_GET["preview"])) {$preview=$_GET["preview"];} + elseif (isset($_POST["preview"])) {$preview=$_POST["preview"];} +if (isset($_GET["called_count"])) {$called_count=$_GET["called_count"];} + elseif (isset($_POST["called_count"])) {$called_count=$_POST["called_count"];} +if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];} + elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];} +if (isset($_GET["agent_log"])) {$agent_log=$_GET["agent_log"];} + elseif (isset($_POST["agent_log"])) {$agent_log=$_POST["agent_log"];} +if (isset($_GET["favorites_list"])) {$favorites_list=$_GET["favorites_list"];} + elseif (isset($_POST["favorites_list"])) {$favorites_list=$_POST["favorites_list"];} +if (isset($_GET["CallBackDatETimE"])) {$CallBackDatETimE=$_GET["CallBackDatETimE"];} + elseif (isset($_POST["CallBackDatETimE"])) {$CallBackDatETimE=$_POST["CallBackDatETimE"];} +if (isset($_GET["recipient"])) {$recipient=$_GET["recipient"];} + elseif (isset($_POST["recipient"])) {$recipient=$_POST["recipient"];} +if (isset($_GET["callback_id"])) {$callback_id=$_GET["callback_id"];} + elseif (isset($_POST["callback_id"])) {$callback_id=$_POST["callback_id"];} +if (isset($_GET["use_internal_dnc"])) {$use_internal_dnc=$_GET["use_internal_dnc"];} + elseif (isset($_POST["use_internal_dnc"])) {$use_internal_dnc=$_POST["use_internal_dnc"];} +if (isset($_GET["omit_phone_code"])) {$omit_phone_code=$_GET["omit_phone_code"];} + elseif (isset($_POST["omit_phone_code"])) {$omit_phone_code=$_POST["omit_phone_code"];} +if (isset($_GET["phone_ip"])) {$phone_ip=$_GET["phone_ip"];} + elseif (isset($_POST["phone_ip"])) {$phone_ip=$_POST["phone_ip"];} +if (isset($_GET["enable_sipsak_messages"])) {$enable_sipsak_messages=$_GET["enable_sipsak_messages"];} + elseif (isset($_POST["enable_sipsak_messages"])) {$enable_sipsak_messages=$_POST["enable_sipsak_messages"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} + + +$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); + + +# default optional vars if not set +if (!isset($format)) {$format="text";} + if ($format == 'debug') {$DB=1;} +if (!isset($ACTION)) {$ACTION="refresh";} + +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$CIDdate = date("mdHis"); +$ENTRYdate = date("YmdHis"); +if (!isset($query_date)) {$query_date = $NOW_DATE;} +$MT[0]=''; +$agents='@agents'; + +if ($ACTION == 'LogiNCamPaigns') + { + $skip_user_validation=1; + } +else + { + $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 "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid 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 "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } +} + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDiaL Database Query Script"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + +################################################################################ +### LogiNCamPaigns - generates an HTML SELECT list of allowed campaigns for a +### specific agent on the login screen +################################################################################ +if ($ACTION == 'LogiNCamPaigns') +{ + if ( (strlen($user)<1) ) + { + echo "\n"; + exit; + } + else + { + echo "\n"; + exit; + } +} + + + +################################################################################ +### regCLOSER - update the vicidial_live_agents table to reflect the closer +### inbound choices made upon login +################################################################################ +if ($ACTION == 'regCLOSER') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($closer_choice)<1) || (strlen($user)<1) ) + { + $channel_live=0; + echo "Group Choice $closer_choice is not valid\n"; + exit; + } + else + { + if ($closer_choice == "MGRLOCK-") + { + $stmt="SELECT closer_campaigns FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $closer_choice =$row[0]; + + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_users set closer_campaigns='$closer_choice' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $in_groups_pre = preg_replace('/-$/','',$closer_choice); + $in_groups = explode(" ",$in_groups_pre); + $in_groups_ct = count($in_groups); + $k=1; + while ($k < $in_groups_ct) + { + if (strlen($in_groups[$k])>1) + { + $stmt="SELECT group_weight,calls_today FROM vicidial_inbound_group_agents where user='$user' and group_id='$in_groups[$k]';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $viga_ct = mysql_num_rows($rslt); + if ($viga_ct > 0) + { + $row=mysql_fetch_row($rslt); + $group_weight = $row[0]; + $calls_today = $row[1]; + } + else + { + $group_weight = 0; + $calls_today = 0; + } + $stmt="INSERT INTO vicidial_live_inbound_agents set user='$user',group_id='$in_groups[$k]',group_weight='$group_weight',calls_today='$calls_today',last_call_time='$NOW_TIME',last_call_finish='$NOW_TIME';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + $k++; + } + + } + echo "Closer In Group Choice $closer_choice has been registered to user $user\n"; +} + + +################################################################################ +### manDiaLnextCALL - for manual VICIDiaL dialing this will grab the next lead +### in the campaign, reserve it, send data back to client and +### place the call by inserting into vicidial_manager +################################################################################ +if ($ACTION == 'manDiaLnextCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "HOPPER EMPTY\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context is not valid\n"; + exit; + } + else + { + + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### check if this is a callback, if it is, skip the grabbing of a new lead and mark the callback as INACTIVE + if ( (strlen($callback_id)>0) and (strlen($lead_id)>0) ) + { + $affected_rows=1; + $CBleadIDset=1; + + $stmt = "UPDATE vicidial_callbacks set status='INACTIVE' where callback_id='$callback_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + if (strlen($phone_number)>3) + { + if ($use_internal_dnc=='Y') + { + $stmt="SELECT count(*) FROM vicidial_dnc where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + echo "DNC NUMBER\n"; + exit; + } + } + if ($stage=='lookup') + { + $stmt="SELECT lead_id FROM vicidial_list where phone_number='$phone_number' order by modify_date desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $man_leadID_ct = mysql_num_rows($rslt); + if ($man_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $affected_rows=1; + $lead_id =$row[0]; + $CBleadIDset=1; + } + else + { + ### insert a new lead in the system with this phone number + $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $lead_id = mysql_insert_id($link); + $CBleadIDset=1; + } + } + else + { + ### insert a new lead in the system with this phone number + $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $lead_id = mysql_insert_id($link); + $CBleadIDset=1; + } + } + else + { + ### grab the next lead in the hopper for this campaign and reserve it for the user + $stmt = "UPDATE vicidial_hopper set status='QUEUE', user='$user' where campaign_id='$campaign' and status='READY' order by hopper_id LIMIT 1"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + } + } + + if ($affected_rows > 0) + { + if (!$CBleadIDset) + { + ##### grab the lead_id of the reserved user in vicidial_hopper + $stmt="SELECT lead_id FROM vicidial_hopper where campaign_id='$campaign' and status='QUEUE' and user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $hopper_leadID_ct = mysql_num_rows($rslt); + if ($hopper_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + } + } + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $source_id = trim("$row[6]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + $called_count++; + + ##### check if system is set to generate logfile for transfers + $stmt="SELECT enable_agc_xfer_log FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enable_agc_xfer_log_ct = mysql_num_rows($rslt); + if ($enable_agc_xfer_log_ct > 0) + { + $row=mysql_fetch_row($rslt); + $enable_agc_xfer_log =$row[0]; + } + + if ( ($WeBRooTWritablE > 0) and ($enable_agc_xfer_log > 0) ) + { + # DATETIME|campaign|lead_id|phone_number|user|type + # 2007-08-22 11:11:11|TESTCAMP|65432|3125551212|1234|M + $fp = fopen ("./xfer_log.txt", "a"); + fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$phone_number|$user|M\n"); + fclose($fp); + } + + ##### if lead is a callback, grab the callback comments + $CBentry_time = ''; + $CBcallback_time = ''; + $CBuser = ''; + $CBcomments = ''; + if (ereg("CALLBK",$dispo)) + { + $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBentry_time = trim("$row[0]"); + $CBcallback_time = trim("$row[1]"); + $CBuser = trim("$row[2]"); + $CBcomments = trim("$row[3]"); + } + } + + ### flag the lead as called and change it's status to INCALL + $stmt = "UPDATE vicidial_list set status='INCALL', called_since_last_reset='Y', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + if (!$CBleadIDset) + { + ### delete the lead from the hopper + $stmt = "DELETE FROM vicidial_hopper where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $stmt="UPDATE vicidial_agent_log set lead_id='$lead_id',comments='MANUAL' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + ### if preview dialing, do not send the call + if ( (strlen($preview)<1) || ($preview == 'NO') ) + { + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### whether to omit phone_code or not + if (eregi('Y',$omit_phone_code)) + {$Ndialstring = "$Local_out_prefix$phone_number";} + else + {$Ndialstring = "$Local_out_prefix$phone_code$phone_number";} + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$server_ip','$campaign','XFER','$lead_id','$MqueryCID','$phone_code','$phone_number','$NOW_TIME','OUT')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',callerid='$MqueryCID',lead_id='$lead_id',comments='MANUAL',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update calls_today count in vicidial_campaign_agents + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $MqueryCID . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + $LeaD_InfO .= $CBentry_time . "\n"; + $LeaD_InfO .= $CBcallback_time . "\n"; + $LeaD_InfO .= $CBuser . "\n"; + $LeaD_InfO .= $CBcomments . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= "MAIN\n"; + $LeaD_InfO .= $source_id . "\n"; + + echo $LeaD_InfO; + + } + else + { + echo "HOPPER EMPTY\n"; + } + } +} + + +################################################################################ +### manDiaLskip - for manual VICIDiaL dialing this skips the lead that was +### previewed in the step above and puts it back in orig status +################################################################################ +if ($ACTION == 'manDiaLskip') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($stage)<1) || (strlen($called_count)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "LEAD NOT REVERTED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context is not valid\n"; + exit; + } + else + { + $called_count = ($called_count - 1); + ### flag the lead as called and change it's status to INCALL + $stmt = "UPDATE vicidial_list set status='$stage', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + + echo "LEAD REVERTED\n"; + } +} + + +################################################################################ +### manDiaLonly - for manual VICIDiaL dialing this sends the call that was +### previewed in the step above +################################################################################ +if ($ACTION == 'manDiaLonly') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) || (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo " CALL NOT PLACED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context is not valid\n"; + exit; + } + else + { + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### whether to omit phone_code or not + if (eregi('Y',$omit_phone_code)) + {$Ndialstring = "$Local_out_prefix$phone_number";} + else + {$Ndialstring = "$Local_out_prefix$phone_code$phone_number";} + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$server_ip','$campaign','XFER','$lead_id','$MqueryCID','$phone_code','$phone_number','$NOW_TIME','OUT')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',callerid='$MqueryCID',lead_id='$lead_id',comments='MANUAL',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + echo "$MqueryCID\n"; + } +} + + +################################################################################ +### manDiaLlookCALL - for manual VICIDiaL dialing this will attempt to look up +### the trunk channel that the call was placed on +################################################################################ +if ($ACTION == 'manDiaLlookCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; +if (strlen($MDnextCID)<18) + { + echo "NO\n"; + echo "MDnextCID $MDnextCID is not valid\n"; + exit; + } +else + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT uniqueid,channel FROM vicidial_manager where callerid='$MDnextCID' and server_ip='$server_ip' and status='UPDATED' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $uniqueid =$row[0]; + $channel =$row[1]; + echo "$uniqueid\n$channel"; + + $wait_sec=0; + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',wait_epoch='$StarTtime',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + echo "NO\n"; + } + } +} + + + +################################################################################ +### manDiaLlogCALL - for manual VICIDiaL logging of calls places record in +### vicidial_log and then sends process to call_log entry +################################################################################ +if ($ACTION == 'manDiaLlogCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + +if ($stage == "start") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) || (strlen($list_id)<1) || (strlen($phone_number)<1) || (strlen($campaign)<1) ) + { + echo "LOG NOT ENTERED\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id or list_id: $list_id or phone_number: $phone_number or campaign: $campaign is not valid\n"; + exit; + } + else + { + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + ##### insert log into vicidial_log for manual VICIDiaL call + $stmt="INSERT INTO vicidial_log (uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,comments,processed,user_group) values('$uniqueid','$lead_id','$list_id','$campaign','$NOW_TIME','$StarTtime','INCALL','$phone_code','$phone_number','$user','MANUAL','N','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "VICIDiaL_LOG Inserted: $uniqueid|$channel|$NOW_TIME\n"; + echo "$StarTtime\n"; + } + else + { + echo "LOG NOT ENTERED\n"; + } + + $stmt = "UPDATE vicidial_auto_calls SET uniqueid='$uniqueid' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + # ##### insert log into call_log for manual VICIDiaL call + # $stmt = "INSERT INTO call_log (uniqueid,channel,server_ip,extension,number_dialed,caller_code,start_time,start_epoch) values('$uniqueid','$channel','$server_ip','$exten','$phone_code$phone_number','MD $user $lead_id','$NOW_TIME','$StarTtime')"; + # if ($DB) {echo "$stmt\n";} + # $rslt=mysql_query($stmt, $link); + # $affected_rows = mysql_affected_rows($link); + + # if ($affected_rows > 0) + # { + # echo "CALL_LOG Inserted: $uniqueid|$channel|$NOW_TIME"; + # } + # else + # { + # echo "LOG NOT ENTERED\n"; + # } + } + } + +if ($stage == "end") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) ) + { + echo "LOG NOT ENTERED\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id is not valid\n"; + exit; + } + else + { + if ($start_epoch < 1000) + { + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + ##### look for the start epoch in the vicidial_closer_log table + $stmt="SELECT start_epoch FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user' order by closecallid desc limit 1;"; + } + else + { + ##### look for the start epoch in the vicidial_log table + $stmt="SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + } + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch =$row[0]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($length_in_sec < 1) and ($row[0] > 0) ) + { + ##### start epoch in the vicidial_log table, couldn't find one in vicidial_closer_log + $stmt="SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch =$row[0]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + } + } + else {$length_in_sec = ($StarTtime - $start_epoch);} + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec',status='DONE' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + + if ($auto_dial_level > 0) + { + ### check to see if campaign has alt_dial enabled + $stmt="SELECT auto_alt_dial FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_alt_dial =$row[0]; + } + else {$auto_alt_dial = 'NONE';} + if (eregi("(ALT_ONLY|ADDR3_ONLY|ALT_AND_ADDR3)",$auto_alt_dial)) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT alt_dial FROM vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alt_dial =$row[0]; + } + else {$alt_dial = 'NONE';} + + if ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("(ALT_ONLY|ALT_AND_ADDR3)",$auto_alt_dial)) ) + { + $stmt="SELECT alt_phone,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alt_phone = $row[0]; + $alt_phone = eregi_replace("[^0-9]","",$alt_phone); + $gmt_offset_now = $row[1]; + $state = $row[2]; + } + else {$alt_phone = '';} + if (strlen($alt_phone)>5) + { + ### insert record into vicidial_hopper for alt_phone call attempt + $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ALT',user='',priority='25';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + } + if ( ( (eregi("(ALT)",$alt_dial)) and (eregi("ALT_AND_ADDR3",$auto_alt_dial)) ) or ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("ADDR3_ONLY",$auto_alt_dial)) ) ) + { + $stmt="SELECT address3,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $address3 = $row[0]; + $address3 = eregi_replace("[^0-9]","",$address3); + $gmt_offset_now = $row[1]; + $state = $row[2]; + } + else {$address3 = '';} + if (strlen($address3)>5) + { + ### insert record into vicidial_hopper for address3 call attempt + $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ADDR3',user='',priority='20';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + + if ($enable_queuemetrics_logging > 0) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_qm_ct = mysql_num_rows($rslt); + if ($VAC_qm_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_call_id = $row[0]; + $CLlead_id = $row[1]; + $CLphone_number = $row[2]; + $CLstatus = $row[3]; + $CLcampaign_id = $row[4]; + $CLphone_code = $row[5]; + $CLalt_dial = $row[6]; + $CLstage = $row[7]; + $CLcallerid = $row[8]; + $CLuniqueid = $row[9]; + } + + $CLstage = preg_replace("/.*-/",'',$CLstage); + if (strlen($CLstage) < 1) {$CLstage=0;} + + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt="SELECT count(*) from queue_log where call_id='$MDnextCID' and verb='COMPLETECALLER';"; + $rslt=mysql_query($stmt, $linkB); + if ($DB) {echo "$stmt\n";} + $VAC_cc_ct = mysql_num_rows($rslt); + if ($VAC_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $caller_complete = $row[0]; + } + + if ($caller_complete < 1) + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + } + mysql_close($linkB); + } + + ### delete call record from vicidial_auto_calls + $stmt = "DELETE from vicidial_auto_calls where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + + + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',lead_id='',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } + else + { + if ($enable_queuemetrics_logging > 0) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_qm_ct = mysql_num_rows($rslt); + if ($VAC_qm_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_call_id = $row[0]; + $CLlead_id = $row[1]; + $CLphone_number = $row[2]; + $CLstatus = $row[3]; + $CLcampaign_id = $row[4]; + $CLphone_code = $row[5]; + $CLalt_dial = $row[6]; + $CLstage = $row[7]; + $CLcallerid = $row[8]; + $CLuniqueid = $row[9]; + } + + $CLstage = preg_replace("/XFER|-/",'',$CLstage); + if ($CLstage < 0.25) {$CLstage=0;} + + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + + $stmt = "DELETE from vicidial_auto_calls lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',lead_id='',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } + + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' where uniqueid='$uniqueid' and lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "$uniqueid\n$channel\n"; + } + else + { + echo "LOG NOT ENTERED\n\n"; + } + } + + echo $VDstop_rec_after_each_call . '|' . $extension . '|' . $conf_silent_prefix . '|' . $conf_exten . '|' . $user_abb . "|\n"; + + ##### if VICIDiaL call and hangup_after_each_call activated, find all recording + ##### channels and hang them up while entering info into recording_log and + ##### returning filename/recordingID + if ($VDstop_rec_after_each_call == 1) + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $total_rec=0; + $loop_count=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten' order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$rec_list = mysql_num_rows($rslt);} + while ($rec_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + if (preg_match("/Local\/$conf_silent_prefix$conf_exten\@/i",$row[0])) + { + $rec_channels[$total_rec] = "$row[0]"; + $total_rec++; + } + if ($format=='debug') {echo "\n";} + $loop_count++; + } + + $total_recFN=0; + $loop_count=0; + $filename=$MT; # not necessary : and cmd_line_f LIKE \"%_$user_abb\" + $stmt="SELECT cmd_line_f FROM vicidial_manager where server_ip='$server_ip' and action='Originate' and cmd_line_b = 'Channel: $local_DEF$conf_silent_prefix$conf_exten$local_AMP$ext_context' order by entry_date desc limit $total_rec;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$recFN_list = mysql_num_rows($rslt);} + while ($recFN_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + $filename[$total_recFN] = preg_replace("/Callerid: /i","",$row[0]); + if ($format=='debug') {echo "\n";} + $total_recFN++; + $loop_count++; + } + + $loop_count=0; + while($loop_count < $total_rec) + { + if (strlen($rec_channels[$loop_count])>5) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$loop_count','Channel: $rec_channels[$loop_count]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "REC_STOP|$rec_channels[$loop_count]|$filename[$loop_count]|"; + if (strlen($filename)>2) + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename[$loop_count]'"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$fn_count = mysql_num_rows($rslt);} + if ($fn_count) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt="UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename[$loop_count]' and end_epoch is NULL;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "$recording_id|$length_in_min|"; + } + else {echo "||";} + } + else {echo "||";} + echo "\n"; + } + $loop_count++; + } + } + + + $talk_sec=0; + $StarTtime = date("U"); + $stmt = "select talk_epoch,talk_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $talk_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set talk_sec='$talk_sec',talk_epoch='$StarTtime',dispo_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } +} + + +################################################################################ +### VDADREcheckINCOMING - for auto-dial VICIDiaL dialing this will recheck for +### calls to see if the channel has updated +################################################################################ +if ($ACTION == 'VDADREcheckINCOMING') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "Campaign $campaign is not valid\n"; + echo "lead_id $lead_id is not valid\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + } + } +} + + +################################################################################ +### VDADcheckINCOMING - for auto-dial VICIDiaL dialing this will check for calls +### in the vicidial_live_agents table in QUEUE status, then +### lookup the lead info and pass it back to vicidial.php +################################################################################ +if ($ACTION == 'VDADcheckINCOMING') +{ + $Ctype = 'A'; + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "Campaign $campaign is not valid\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and status='QUEUE';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',comments='AUTO',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $source_id = trim("$row[6]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + ##### if lead is a callback, grab the callback comments + $CBentry_time = ''; + $CBcallback_time = ''; + $CBuser = ''; + $CBcomments = ''; + if (ereg("CALLBK",$dispo)) + { + $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBentry_time = trim("$row[0]"); + $CBcallback_time = trim("$row[1]"); + $CBuser = trim("$row[2]"); + $CBcomments = trim("$row[3]"); + } + } + + ### update the lead status to INCALL + $stmt = "UPDATE vicidial_list set status='INCALL', user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the log status to INCALL + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + $stmt = "UPDATE vicidial_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL', user_group='$user_group' where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + ### update the vicidial_closer_log user to INCALL + $stmt = "UPDATE vicidial_closer_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL', user_group='$user_group' where lead_id='$lead_id' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select campaign_id,phone_number,alt_dial from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($VDAC_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDADchannel_group =$row[0]; + $dialed_number =$row[1]; + $dialed_label =$row[2]; + } + else + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|INBND|$callerid|$user|$user_group|$list_id|$lead_id|$phone_number|$uniqueid|\n"); + fclose($fp); + } + } + + $stmt = "select count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDL_cid_ct = mysql_num_rows($rslt); + if ($VDL_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_front_VDlog =$row[0]; + } + + $stmt = "select * from vicidial_inbound_groups where group_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_group_name = $row[1]; + $VDCL_group_color = $row[2]; + $VDCL_group_web = $row[4]; + $VDCL_fronter_display = $row[7]; + $VDCL_ingroup_script = $row[8]; + $VDCL_get_call_launch = $row[9]; + $VDCL_xferconf_a_dtmf = $row[10]; + $VDCL_xferconf_a_number = $row[11]; + $VDCL_xferconf_b_dtmf = $row[12]; + $VDCL_xferconf_b_number = $row[13]; + $VDCL_default_xfer_group= $row[28]; + + ### update the comments in vicidial_live_agents record + $stmt = "UPDATE vicidial_live_agents set comments='INBOUND' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $Ctype = 'I'; + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_ingroup_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + } + + ### if web form is set then send on to vicidial.php for override of WEB_FORM address + if ( (strlen($VDCL_group_web)>5) or (strlen($VDCL_group_name)>0) ) {echo "$VDCL_group_web|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|\n";} + else {echo "|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|\n";} + + $stmt = "SELECT full_name from vicidial_users where user='$tsr';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDU_cid_ct = mysql_num_rows($rslt); + if ($VDU_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $fronter_full_name = $row[0]; + echo $fronter_full_name . '|' . $tsr . "\n"; + } + else {echo '|' . $tsr . "\n";} + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_campaign_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + echo "|||||$VDCL_campaign_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n|\n"; + + $stmt = "select phone_number,alt_dial from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($VDAC_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dialed_number =$row[0]; + $dialed_label =$row[1]; + } + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $callerid . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + $LeaD_InfO .= $CBentry_time . "\n"; + $LeaD_InfO .= $CBcallback_time . "\n"; + $LeaD_InfO .= $CBuser . "\n"; + $LeaD_InfO .= $CBcomments . "\n"; + $LeaD_InfO .= $dialed_number . "\n"; + $LeaD_InfO .= $dialed_label . "\n"; + $LeaD_InfO .= $source_id . "\n"; + + echo $LeaD_InfO; + + + + $wait_sec=0; + $StarTtime = date("U"); + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + ### If CALLBK, change vicidial_callback record to INACTIVE + if (eregi("CALLBK|CBHOLD", $dispo)) + { + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='$lead_id' and status NOT IN('INACTIVE','DEAD','ARCHIVE');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + ##### check if system is set to generate logfile for transfers + $stmt="SELECT enable_agc_xfer_log FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enable_agc_xfer_log_ct = mysql_num_rows($rslt); + if ($enable_agc_xfer_log_ct > 0) + { + $row=mysql_fetch_row($rslt); + $enable_agc_xfer_log =$row[0]; + } + + if ( ($WeBRooTWritablE > 0) and ($enable_agc_xfer_log > 0) ) + { + # DATETIME|campaign|lead_id|phone_number|user|type + # 2007-08-22 11:11:11|TESTCAMP|65432|3125551212|1234|A + $fp = fopen ("./xfer_log.txt", "a"); + fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$phone_number|$user|$Ctype\n"); + fclose($fp); + } + + } + else + { + echo "0\n"; + # echo "No calls in QUEUE for $user on $server_ip\n"; + exit; + } + } +} + + +################################################################################ +### userLOGout - Logs the user out of VICIDiaL client, deleting db records and +### inserting into vicidial_user_log +################################################################################ +if ($ACTION == 'userLOGout') +{ + $MT[0]=''; + $row=''; $rowx=''; +if ( (strlen($campaign)<1) || (strlen($conf_exten)<1) ) + { + echo "NO\n"; + echo "campaign $campaign or conf_exten $conf_exten is not valid\n"; + exit; + } +else + { + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + ##### Insert a LOGOUT record into the user log + $stmt="INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$user','LOGOUT','$campaign','$NOW_TIME','$StarTtime','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vul_insert = mysql_affected_rows($link); + + if ($no_delete_sessions < 1) + { + ##### Remove the reservation on the vicidial_conferences meetme room + $stmt="UPDATE vicidial_conferences set extension='' where server_ip='$server_ip' and conf_exten='$conf_exten';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vc_remove = mysql_affected_rows($link); + } + + ##### Delete the vicidial_live_agents record for this session + $stmt="DELETE from vicidial_live_agents where server_ip='$server_ip' and user ='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vla_delete = mysql_affected_rows($link); + + ##### Delete the vicidial_live_inbound_agents records for this session + $stmt="DELETE from vicidial_live_inbound_agents where user ='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vlia_delete = mysql_affected_rows($link); + + ##### Delete the web_client_sessions + $stmt="DELETE from web_client_sessions where server_ip='$server_ip' and session_name ='$session_name';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $wcs_delete = mysql_affected_rows($link); + + ##### Hangup the client phone + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$extension%\" order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) + { + $row=mysql_fetch_row($rslt); + $agent_channel = "$row[0]"; + if ($format=='debug') {echo "\n";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','ULGH3459$StarTtime','Channel: $agent_channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $pause_sec=0; + $stmt = "select pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ( ($VDpr_ct > 0) and (strlen($row[3]<5)) and (strlen($row[4]<5)) ) + { + $row=mysql_fetch_row($rslt); + $pause_sec = (($StarTtime - $row[0]) + $row[1]); + + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + if ($vla_delete > 0) + { + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $allow_sipsak_messages = $row[6]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_message = 'LOGGED OUT'; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_message\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + } + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + # $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='PAUSE',serverid='1';"; + # if ($DB) {echo "$stmt\n";} + # if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + # $rslt=mysql_query($stmt, $linkB); + # $affected_rows = mysql_affected_rows($linkB); + + $stmt = "SELECT time_id FROM queue_log where agent='Agent/$user' and verb='AGENTLOGIN' order by time_id desc limit 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + if ($DB) {echo "$stmt\n";} + echo "$stmt\n"; + $li_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $li_conf_ct) + { + $row=mysql_fetch_row($rslt); + $logintime = $row[0]; + $i++; + } + + $time_logged_in = ($StarTtime - $logintime); + if ($time_logged_in > 1000000) {$time_logged_in=1;} + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='AGENTLOGOFF',data1='$user$agents',data2='$time_logged_in',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + + echo "$vul_insert|$vc_remove|$vla_delete|$wcs_delete|$agent_channel|$vlia_delete\n"; + } +} + + +################################################################################ +### updateDISPO - update the vicidial_list table to reflect the agent choice of +### call disposition for that leand +################################################################################ +if ($ACTION == 'updateDISPO') +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($dispo_choice)<1) || (strlen($lead_id)<1) ) + { + echo "Dispo Choice $dispo or lead_id $lead_id is not valid\n"; + exit; + } + else + { + $stmt="UPDATE vicidial_list set status='$dispo_choice', user='$user' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by uniqueid desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + if ( ($use_internal_dnc=='Y') and ($dispo_choice=='DNC') ) + { + $stmt = "select phone_number from vicidial_list where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $stmt="INSERT INTO vicidial_dnc (phone_number) values('$row[0]');"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + } + } + + $dispo_sec=0; + $StarTtime = date("U"); + $stmt = "select dispo_epoch,dispo_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dispo_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set dispo_sec='$dispo_sec',dispo_epoch='$StarTtime',status='$dispo_choice' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id($link); + + ### CALLBACK ENTRY + if ( ($dispo_choice == 'CBHOLD') and (strlen($CallBackDatETimE)>10) ) + { + $stmt="INSERT INTO vicidial_callbacks (lead_id,list_id,campaign_id,status,entry_time,callback_time,user,recipient,comments,user_group) values('$lead_id','$list_id','$campaign','ACTIVE','$NOW_TIME','$CallBackDatETimE','$user','$recipient','$comments','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $stmt="SELECT auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ( ($auto_dial_level > 0) and (ereg(" $dispo_choice ",$row[0])) ) + { + $stmt = "select count(*) from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + $stmt="UPDATE vicidial_hopper set status='READY' where lead_id='$lead_id' and status='HOLD' limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + else + { + $stmt="DELETE from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='CALLSTATUS',data1='$dispo_choice',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + + echo 'Lead ' . $lead_id . ' has been changed to ' . $dispo_choice . " Status\nNext agent_log_id:\n" . $agent_log_id . "\n"; +} + +################################################################################ +### updateLEAD - update the vicidial_list table to reflect the values that are +### in the agents screen at time of call hangup +################################################################################ +if ($ACTION == 'updateLEAD') +{ + $MT[0]=''; + $row=''; $rowx=''; + $DO_NOT_UPDATE=0; + $DO_NOT_UPDATE_text=''; + if ( (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + echo "phone_number $phone_number or lead_id $lead_id is not valid\n"; + exit; + } + else + { + + $stmt = "SELECT disable_alter_custdata FROM vicidial_campaigns where campaign_id='$campaign'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $dac_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $dac_conf_ct) + { + $row=mysql_fetch_row($rslt); + $disable_alter_custdata = $row[0]; + $i++; + } + if (ereg('Y',$disable_alter_custdata)) + { + $DO_NOT_UPDATE=1; + $DO_NOT_UPDATE_text=' NOT'; + $stmt = "SELECT alter_custdata_override FROM vicidial_users where user='$user'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $aco_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $aco_conf_ct) + { + $row=mysql_fetch_row($rslt); + $alter_custdata_override = $row[0]; + $i++; + } + if (ereg('ALLOW_ALTER',$alter_custdata_override)) + { + $DO_NOT_UPDATE=0; + $DO_NOT_UPDATE_text=''; + } + } + + if ($DO_NOT_UPDATE < 1) + { + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + $comments = eregi_replace("--AMP--",'&',$comments); + $comments = eregi_replace("--QUES--",'?',$comments); + $comments = eregi_replace("--POUND--",'#',$comments); + + $stmt="UPDATE vicidial_list set vendor_lead_code='" . mysql_real_escape_string($vendor_lead_code) . "', title='" . mysql_real_escape_string($title) . "', first_name='" . mysql_real_escape_string($first_name) . "', middle_initial='" . mysql_real_escape_string($middle_initial) . "', last_name='" . mysql_real_escape_string($last_name) . "', address1='" . mysql_real_escape_string($address1) . "', address2='" . mysql_real_escape_string($address2) . "', address3='" . mysql_real_escape_string($address3) . "', city='" . mysql_real_escape_string($city) . "', state='" . mysql_real_escape_string($state) . "', province='" . mysql_real_escape_string($province) . "', postal_code='" . mysql_real_escape_string($postal_code) . "', country_code='" . mysql_real_escape_string($country_code) . "', gender='" . mysql_real_escape_string($gender) . "', date_of_birth='" . mysql_real_escape_string($date_of_birth) . "', alt_phone='" . mysql_real_escape_string($alt_phone) . "', email='" . mysql_real_escape_string($email) . "', security_phrase='" . mysql_real_escape_string($security_phrase) . "', comments='" . mysql_real_escape_string($comments) . "' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } + echo "Lead $lead_id information has$DO_NOT_UPDATE_text been updated\n"; +} + + +################################################################################ +### VDADpause - update the vicidial_live_agents table to show that the agent is +### or ready now active and ready to take calls +################################################################################ +if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($stage)<2) || (strlen($server_ip)<1) ) + { + echo "stage $stage is not valid\n"; + exit; + } + else + { + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set lead_id='',uniqueid=0,callerid='',channel='', random_id='$random',comments='' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_live_agents set status='$stage' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + if (ereg('READY',$stage)) {$QMstatus='UNPAUSEALL';} + if (ereg('PAUSE',$stage)) {$QMstatus='PAUSEALL';} + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='$QMstatus',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + + if ($agent_log == 'NO') + {$donothing=1;} + else + { + $pause_sec=0; + $stmt = "select pause_epoch,pause_sec,wait_epoch,wait_sec,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec=0; + if ($row[2] > 0) + { + $wait_sec = (($StarTtime - $row[2]) + $row[3]); + } + if ( (eregi("NULL",$row[4])) or ($row[4] < 1000) ) + {$pause_sec = (($StarTtime - $row[0]) + $row[1]);} + else + {$pause_sec = (($row[4] - $row[0]) + $row[1]);} + + } + if ($ACTION == 'VDADready') + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($ACTION == 'VDADpause') + { + $stmt="UPDATE vicidial_agent_log set pause_epoch='$StarTtime',wait_sec='$wait_sec' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + echo 'Agent ' . $user . ' is now in status ' . $stage . "\n"; +} + + +################################################################################ +### UpdatEFavoritEs - update the astguiclient favorites list for this extension +################################################################################ +if ($ACTION == 'UpdatEFavoritEs') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($favorites_list)<1) || (strlen($user)<1) || (strlen($exten)<1) ) + { + echo "favorites list $favorites_list is not valid\n"; + exit; + } + else + { + $stmt = "select count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + $stmt="UPDATE phone_favorites set extensions_list=\"$favorites_list\" where extension='$exten' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="INSERT INTO phone_favorites values('$exten','$server_ip',\"$favorites_list\");"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + echo "Favorites list has been updated to $favorites_list for $exten\n"; +} + + +################################################################################ +### PauseCodeSubmit - Update vicidial_agent_log with pause code +################################################################################ +if ($ACTION == 'PauseCodeSubmit') +{ + $row=''; $rowx=''; + if ( (strlen($status)<1) || (strlen($agent_log_id)<1) ) + { + echo "agent_log_id $agent_log_id or pause_code $status is not valid\n"; + exit; + } + else + { + $stmt="UPDATE vicidial_agent_log set sub_status=\"$status\" where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $allow_sipsak_messages = $row[6]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_prefix = 'BK-'; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$status\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + } + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='PAUSEREASON',serverid='$queuemetrics_log_id',data1='$status';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } +echo "Pause Code has been updated to $status for $agent_log_id\n"; +} + + +################################################################################ +### CalLBacKLisT - List the USERONLY callbacks for an agent +################################################################################ +if ($ACTION == 'CalLBacKLisT') +{ +$stmt = "select callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' and campaign_id='$campaign' and status NOT IN('INACTIVE','DEAD') order by callback_time;"; +if ($DB) {echo "$stmt\n";} +$rslt=mysql_query($stmt, $link); +if ($rslt) {$callbacks_count = mysql_num_rows($rslt);} +echo "$callbacks_count\n"; +$loop_count=0; + while ($callbacks_count>$loop_count) + { + $row=mysql_fetch_row($rslt); + $callback_id[$loop_count] = $row[0]; + $lead_id[$loop_count] = $row[1]; + $campaign_id[$loop_count] = $row[2]; + $status[$loop_count] = $row[3]; + $entry_time[$loop_count] = $row[4]; + $callback_time[$loop_count] = $row[5]; + $comments[$loop_count] = $row[6]; + $loop_count++; + } +$loop_count=0; + while ($callbacks_count>$loop_count) + { + $stmt = "select first_name,last_name,phone_number from vicidial_list where lead_id='$lead_id[$loop_count]';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count]\n"; + $loop_count++; + } + +} + + +################################################################################ +### CalLBacKCounT - send the count of the USERONLY callbacks for an agent +################################################################################ +if ($ACTION == 'CalLBacKCounT') +{ +$stmt = "select count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' and campaign_id='$campaign' and status NOT IN('INACTIVE','DEAD');"; +if ($DB) {echo "$stmt\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$cbcount=$row[0]; + +echo "$cbcount"; +} + + + + +if ($format=='debug') +{ +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +echo "\n"; +echo "\n\n\n"; +} + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/vicidial.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/vicidial.php new file mode 100644 index 00000000..ccd81ed1 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/vicidial.php @@ -0,0 +1,6797 @@ + LICENSE: GPLv2 +# +# make sure you have added a user to the vicidial_users MySQL table with at least +# user_level 1 or greater to access this page. Also, you need to have the login +# and pass of a phone listed in the asterisk.phones table. The page grabs the +# server info and other details from this login and pass. +# +# This script works best with Firefox or Mozilla, but will run for a couple +# hours on Internet Explorer before the memory leaks cause a crash. +# +# Other scripts that this application depends on: +# - vdc_db_query.php: Updates information in the database +# - manager_send.php: Sends manager actions to the DB for execution +# +# CHANGELOG +# 50607-1426 - First Build of VICIDIAL web client basic login process finished +# 50628-1620 - Added some basic formatting and worked on process flow +# 50628-1715 - Startup variables mapped to javascript variables +# 50629-1303 - Added Login Closer in-groups selection box and vla update +# 50629-1530 - Rough layout for customer info form section and button links +# 50630-1453 - Rough Manual Dial/Hangup with customer info displayed +# 50701-1450 - Added vicidial_log entries on dial and hangup +# 50701-1634 - Added Logout function +# 50705-1259 - Added call disposition functionality +# 50705-1432 - Added lead info DB update function +# 50705-1658 - Added web form functionality +# 50706-1043 - Added call park and pickup functions +# 50706-1234 - Added Start/Stop Recording functionality +# 50706-1614 - Added conference channels display option +# 50711-1333 - Removed call check redundancy and fixed a span bug +# 50727-1424 - Added customer channel and participant present sensing/alerts +# 50804-1057 - Added SendDTMF function and reconfigured the transfer span +# 50804-1224 - Added Local and Internal Closer transfer functions +# 50804-1628 - Added Blind transfer, activated LIVE CALL image and fixed bugs +# 50804-1808 - Added button images for left buttons +# 50815-1151 - Added 3Way calling functions to Transfer-conf frame +# 50815-1602 - Added images and buttons for xfer functions +# 50816-1813 - Added basic autodial outbound call pickup functions +# 50817-1113 - Fixes to auto_dialing call receipt +# 50817-1234 - Added inbound call receipt capability +# 50817-1541 - Added customer time display +# 50817-1541 - Added customer time display +# 50818-1327 - Added stop-all-recordings-after-each-vicidial-call option +# 50818-1703 - Added pretty login section +# 50825-1200 - Modified form field lengths, added double-click dispositions +# 50831-1603 - Fixed customer time bug and fronter display bug for CLOSER +# 50901-1314 - Fixed CLOSER IN-GROUP Web Form bug +# 50903-0904 - Added preview-lead code for manual dialing +# 50904-0016 - Added ability to hangup manual dials before pickup +# 50906-1319 - Added override for filters on xfer calls, fixed login display bug +# 50909-1243 - Added hotkeys functionality for quick dispoing in auto-dial mode +# 50912-0958 - Modified hotkeys function, agent must have user_level >= 5 to use +# 50913-1212 - Added campaign_cid to 3rd party calls +# 50923-1546 - Modified to work with language translation +# 50926-1656 - Added campaign pull-down at login of active campaigns +# 50928-1633 - Added manual dial alternate number dial option +# 50930-1538 - Added session_id empty login failure and fixed 2 minor bugs +# 51004-1656 - Fixed recording filename bug and new Spanish translation +# 51020-1103 - Added campaign-specific recording control abilities +# 51020-1352 - Added Basic vicidial_agent_log framework +# 51021-1050 - Fixed custtime display and disable Enter/Return keypresses +# 51021-1718 - Allows for multi-line comments (changes \n to !N in database) +# 51110-1432 - Fixed non-standard http port issue +# 51111-1047 - Added vicidial_agent_log lead_id earlier for manual dial +# 51118-1305 - Activate multi-line comments from $multi_line_comments var +# 51118-1313 - Move Transfer DIV to a floating span to preserve 800x600 view +# 51121-1506 - Small PHP optimizations in many scripts and disabled globalize +# 51129-1010 - Added ability to accept calls from other VICIDIAL servers +# 51129-1254 - Fixed Hangups of other agents channels when customer hangs up +# 51208-1732 - Created user-first login that looks for default phone info +# 51219-1526 - Added variable framework for campaign and in-group scripts +# 51221-1200 - Added SCRIPT tab, layout and functionality +# 51221-1714 - Added auto-switch-to-SCRIPT-tab and auto-webform-popup +# 51222-1605 - Added VMail message blind transfer button to xfer-conf frame +# 51229-1028 - Added checks on web_form_address to allow for var in the DB value +# 60117-1312 - Added Transfer-conf frame toggle on button press +# 60208-1152 - Added DTMF-xfernumber preset links to xfer-conf frame +# 60213-1129 - Added vicidial_users.hotkeys_active for any user hotkeys +# 60213-1210 - Added ability to sort routing of calls by user_level +# 60214-0932 - Initial Callback calendar display framework +# 60214-1407 - Added ability to minimize the dispo screen to see info below +# 60215-1104 - Added ANYONE scheduled callbacks functionality +# 60410-1116 - Added persistant pause after dispo option and change dispo text +# - Added web form submit that opens new window with dispo on submit +# - Added PREVIOUS CALLBACK in customer info to flag callbacks +# - Added link to try to hangup the call again in the dispo screen +# - Added link noone-in-session screen to call agent phone again +# - Added link customer-hungup screen to go straight to dispo screen +# 60410-1532 - Added agent status and campaign calls dialing display option +# 60411-1547 - Add ability to set callback as USERONLY and some basic formatting +# 60413-1752 - Add basic USERONLY callback frame and listings +# 60414-1039 - Changed manual dial preview and alt dial checkboxes to spans +# - Added beta-level USERONLY callback functionality +# - Added beta-level manual dialing with lead insertion functionality +# 60415-1534 - Fixed manual dial lead preview and fixed manuald dial override bug +# 60417-1108 - Added capability to do alt-number-dialing in auto-dial mode +# - Changed several permissions to database-defined +# 60419-1529 - Prevent manual dial or callbacks when alt-dial lead not finished +# 60420-1647 - Fixed DiaLDiaLAltPhonE error, Call Agent Again DialControl error +# 60421-1229 - Check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60424-1005 - Fixed Alt phone disabled bug for callbacks and manual dials +# 60426-1058 - Added vicidial_user setting for default blended check for CLOSER +# 60501-1008 - Added option to manual dial screen to manually lookup phone number +# 60503-1653 - Fixed agentonly_callback not-defined bug in scheduled callbacks screen +# 60504-1032 - Fixed manual dial display bug and transfer dispo alert bug +# - Fixed recording filename display to not overrun 25 characters +# 60510-1051 - Added Wrapup timer and wrapup message on wrapup screen after dispo +# 60608-1453 - Added CLOSER campaign allowable in-groups limitations +# 60609-1123 - Added add-number-to-DNC-list function and manual dial check DNC +# 60619-1047 - Added variable filters to close security holes for login form +# 60804-1710 - fixed scheduled CALLBK for other languages build +# 60808-1145 - Added consultative transfers with customer data +# 60808-2232 - Added campaign name to pulldown for login screen +# 60809-1603 - Added option to locally transfer consult xfers +# 60809-1732 - Added recheck of transferred channels before customer gone mesg +# 60810-1011 - Fixed CXFER leave 3way call bugs +# 60816-1602 - Added ALLCALLS recording delay option allcalls_delay +# 60816-1716 - Fixed customer time display bug and client DST setting +# 60821-1555 - Added option to omit phone_code on dialout of leads +# 60821-1628 - Added ALLFORCE recording option +# 60821-1643 - Added no_delete_sessions option to not delete sessions +# 60822-0512 - Changed phone number fields to be maxlength of 12 +# 60829-1531 - Made compatible with WeBRooTWritablE setting in dbconnect.php +# 60906-1152 - Added Previous CallBack info display span +# 60906-1715 - Allow for Local phone extension conferences +# 61004-1729 - Add ability to control volume per channel in "calls in this session" +# 61122-1341 - Added vicidial_user_groups allowed_campaigns restrictions +# 61122-1523 - Added more SCRIPT variables +# 61128-2229 - Added vicidial_live_agents and vicidial_auto_calls manual dial entries +# 61130-1617 - Added lead_id to MonitorConf for recording_log +# 61221-1212 - Changed width to 760 to better fit 800x600 screens, widened SCRIPT +# 70109-1128 - Fixed wrapup timer bug +# 70109-1635 - Added option for HotKeys automatically dialing next number in manual mode +# - Added option for alternate number dialing with hotkeys +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70118-1517 - Added vicidial_agent_log and vicidial_user_log logging of user_group +# 70201-1249 - Added FAST DIAL option for manually dialing, added UTF8 compatible code +# 70201-1703 - Fixed cursor bug for most text input fields +# 70202-1453 - Added first portions of Agent Pause Codes +# 70203-0108 - Finished Agent Pause Codes functionality +# 70203-0930 - Added dialed_number to webform output +# 70203-1010 - Added dialed_label to webform output +# 70206-1201 - Fixed allow_closers bug +# 70206-1332 - Added vicidial_recording_override users setting function +# 70212-1252 - Fixed small issue with CXFER +# 70213-1018 - Changed CXFER and AXFER to update customer information before transfer +# 70214-1233 - Added queuemetrics_log_id field for server_id in queue_log +# 70215-1240 - Added queuemetrics_log_id field for server_id in queue_log +# 70222-1617 - Changed queue_log PAUSE/UNPAUSE to PAUSEALL/UNPAUSEALL +# 70226-1252 - Added Mute/UnMute to agent screen +# 70309-1035 - Allow amphersands and questions marks in comments to pass through +# 70313-1052 - Allow pound signs(hash) in comments to pass through +# 70316-1406 - Moved the MUTE button to be accessible during a transfer/conf +# 70319-1446 - Added agent-deactive-display and disable customer info update functions +# 70319-1626 - Added option to allow agent logins to campaigns with no leads in the hopper +# 70320-1501 - Added option to allow retry of leave-3way-call from dispo screen +# 70322-1545 - Added sipsak display ability +# 70510-1319 - Added onUnload force Logout +# 70806-1530 - Added Presets Dial links above agent mute button +# 70823-2118 - Fixed XMLHTTPRequest, HotKeys and Scheduled Callbacks issues with MSIE +# 70828-1443 - Added source_id to output of SCRIPTtab-IFRAME and WEBFORM +# 71022-1427 - Added formatting of the customer phone number in the main status bar +# 71029-1848 - Changed CLOSER-type campaign to not use campaign_id restrictions +# 71101-1204 - Fixed bug in callback calendar with DST +# 71116-0957 - Added campaign_weight and calls_today to the vla table insertion +# 71120-1719 - Added XMLHTPRequest lookup of allowable campaigns for agents during login +# 71122-0256 - Added auto-pause notification +# 71125-1751 - Changed Transfer section to allow for selection of in-groups to send calls to +# 71127-0408 - Added height and width settings for easier modification of screen size +# 71129-2025 - restricted callbacks count and list to campaign only +# + +$version = '2.0.4-142'; +$build = '71129-2025'; + +require("dbconnect.php"); + +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["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} + 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"];} + } + if (isset($VD_campaign)) + { + $VD_campaign = strtoupper($VD_campaign); + $VD_campaign = eregi_replace(" ",'',$VD_campaign); + } + +### 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); + + +$forever_stop=0; + +if ($force_logout) +{ + echo "You have now logged out. Thank you\n"; + exit; +} + +$isdst = date("I"); +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$CIDdate = date("ymdHis"); + $month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); + $past_month_date = date("Y-m-d H:i:s",$month_old); + + +$random = (rand(1000000, 9999999) + 10000000); + +$conf_silent_prefix = '7'; # vicidial_conferences prefix to enter silently +$HKuser_level = '5'; # minimum vicidial user_level for HotKeys +$campaign_login_list = '1'; # show drop-down list of campaigns at login +$manual_dial_preview = '1'; # allow preview lead option when manual dial +$multi_line_comments = '1'; # set to 1 to allow multi-line comment box +$user_login_first = '0'; # set to 1 to have the vicidial_user login before the phone login +$view_scripts = '1'; # set to 1 to show the SCRIPTS tab +$dispo_check_all_pause = '0'; # set to 1 to allow for persistent pause after dispo +$agentcallsstatus = '0'; # set to 1 to show agent status and call count + $campagentstatctmax = '0'; # Number of seconds for campaign call and agent stats +$show_campname_pulldown = '1'; # set to 1 to show campaign name on login pulldown +$webform_sessionname = '1'; # set to 1 to include the session_name in webform URL +$local_consult_xfers = '1'; # set to 1 to send consultative transfers from original server +$clientDST = '1'; # set to 1 to check for DST on server for agent time +$no_delete_sessions = '0'; # set to 1 to not delete sessions at logout +$volumecontrol_active = '1'; # set to 1 to allow agents to alter volume of channels +$PreseT_DiaL_LinKs = '1'; # set to 1 to show a DIAL link for Dial Presets +$LogiNAJAX = '1'; # set to 1 to do lookups +$HidEMonitoRSessionS = '1'; # set to 1 to hide remote monitoring channels from "session calls" + +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen + +$BROWSER_HEIGHT = 500; # set to the minimum browser height, default=500 +$BROWSER_WIDTH = 770; # set to the minimum browser width, default=770 + + +# options now set in DB: +#$alt_phone_dialing = '1'; # allow agents to call alt phone numbers +#$scheduled_callbacks = '1'; # set to 1 to allow agent to choose scheduled callbacks +# $agentonly_callbacks = '1'; # set to 1 to allow agent to choose agent-only scheduled callbacks +#$agentcall_manual = '1'; # set to 1 to allow agent to make manual calls during autodial session + +### SCREEN WIDTH AND HEIGHT CALCULATIONS ### +### DO NOT EDIT! ### +$MASTERwidth=($BROWSER_WIDTH - 340); +$MASTERheight=($BROWSER_HEIGHT - 200); +if ($MASTERwidth < 430) {$MASTERwidth = '430';} +if ($MASTERheight < 300) {$MASTERheight = '300';} + +$CAwidth = ($MASTERwidth + 340); # 770 - cover all (none-in-session, customer hunngup, etc...) +$MNwidth = ($MASTERwidth + 330); # 760 - main frame +$XFwidth = ($MASTERwidth + 320); # 750 - transfer/conference +$HCwidth = ($MASTERwidth + 310); # 740 - hotkeys and callbacks +$AMwidth = ($MASTERwidth + 270); # 700 - agent mute and preset-dial links +$SSwidth = ($MASTERwidth + 176); # 606 - scroll script +$SDwidth = ($MASTERwidth + 170); # 600 - scroll script, customer data and calls-in-session +$HKwidth = ($MASTERwidth + 70); # 500 - Hotkeys button +$HSwidth = ($MASTERwidth + 1); # 431 - Header spacer + +$HKheight = ($MASTERheight + 105); # 405 - HotKey active Button +$AMheight = ($MASTERheight + 100); # 400 - Agent mute and preset dial links +$MBheight = ($MASTERheight + 65); # 365 - Manual Dial Buttons +$CBheight = ($MASTERheight + 50); # 350 - Agent Callback, pause code, volume control Buttons and agent status +$SSheight = ($MASTERheight + 31); # 331 - script content +$HTheight = ($MASTERheight + 10); # 310 - transfer frame, callback comments and hotkey +$BPheight = ($MASTERheight - 250); # 50 - bottom buffer + + +$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('vicidial.php','',$agcPAGE); + +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 +echo "\n"; +echo "\n"; +echo "\n"; + +if ($campaign_login_list > 0) +{ +$camp_form_code = "\n"; +} +else +{ +$camp_form_code = "\n"; +} + + +if ($LogiNAJAX > 0) +{ +?> + + + +VICIDIAL web client: Re-Login\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Re-Login
 
Phone Login:
Phone Password:
User Login:
User Password:
Campaign: $camp_form_code

VERSION: $version       BUILD: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} + +if ($user_login_first == 1) +{ + if ( (strlen($VD_login)<1) or (strlen($VD_pass)<1) or (strlen($VD_campaign)<1) ) + { + echo "VICIDIAL web client: Campaign Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + #echo "\n"; + #echo "\n"; + echo "

User Login

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Campaign Login
 
User Login:
User Password:
Campaign: $camp_form_code
  \n"; + echo "

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) + { + $stmt="SELECT phone_login,phone_pass from vicidial_users where user='$VD_login' and pass='$VD_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); + $phone_login=$row[0]; + $phone_pass=$row[1]; + + echo "VICIDIAL web client: Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Login
 
Phone Login:
Phone Password:
User Login:
User Password:
Campaign: $camp_form_code
  \n"; + echo "

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + + } + } +} + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "VICIDIAL web client: Phone Login\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Phone Login
 
Phone Login:
Phone Password:
  \n"; +echo "

VERSION: $version       BUILD: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./vicidial_auth_entries.txt", "a");} +$VDloginDISPLAY=0; + + if ( (strlen($VD_login)<2) or (strlen($VD_pass)<2) or (strlen($VD_campaign)<2) ) + { + $VDloginDISPLAY=1; + } + else + { + $stmt="SELECT count(*) from vicidial_users where user='$VD_login' and pass='$VD_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($auth>0) + { + $login=strtoupper($VD_login); + $password=strtoupper($VD_pass); + ##### grab the full name of the agent + $stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,closer_default_blended,user_group,vicidial_recording_override from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $user_level=$row[1]; + $VU_hotkeys_active=$row[2]; + $VU_agent_choose_ingroups=$row[3]; + $VU_scheduled_callbacks=$row[4]; + $agentonly_callbacks=$row[5]; + $agentcall_manual=$row[6]; + $VU_vicidial_recording=$row[7]; + $VU_vicidial_transfers=$row[8]; + $VU_closer_default_blended=$row[9]; + $VU_user_group=$row[10]; + $VU_vicidial_recording_override=$row[11]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|$VD_pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + $user_abb = "$VD_login$VD_login$VD_login$VD_login"; + while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + + $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$VU_user_group';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGallowed_campaigns =$row[0]; + + if ( (!eregi(" $VD_campaign ",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) + { + echo "VICIDIAL web client: VICIDIAL Campaign Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "Sorry, you are not allowed to login to this campaign: $VD_campaign\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Login: \n
"; + echo "Password:
\n"; + echo "Campaign: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + ##### check to see that the campaign is active + $stmt="SELECT count(*) FROM vicidial_campaigns where campaign_id='$VD_campaign' and active='Y';"; + 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); + $CAMPactive=$row[0]; + if($CAMPactive>0) + { + if ($TEST_all_statuses > 0) {$selectableSQL = '';} + else {$selectableSQL = "selectable='Y' and";} + $VARstatuses=''; + $VARstatusnames=''; + ##### grab the statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_statuses WHERE $selectableSQL status != 'NEW' order by status limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $VD_statuses_ct) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + } + + ##### grab the campaign-specific statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_campaign_statuses WHERE $selectableSQL status != 'NEW' and campaign_id='$VD_campaign' order by status limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_camp = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + $j++; + } + $VD_statuses_ct = ($VD_statuses_ct+$VD_statuses_camp); + $VARstatuses = substr("$VARstatuses", 0, -1); + $VARstatusnames = substr("$VARstatusnames", 0, -1); + + ##### grab the campaign-specific HotKey statuses that can be used for dispositioning by an agent + $stmt="SELECT hotkey,status,status_name FROM vicidial_campaign_hotkeys WHERE selectable='Y' and status != 'NEW' and campaign_id='$VD_campaign' order by hotkey limit 9;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $HK_statuses_camp = mysql_num_rows($rslt); + $w=0; + $HKboxA=''; + $HKboxB=''; + $HKboxC=''; + while ($w < $HK_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $HKhotkey[$w] =$row[0]; + $HKstatus[$w] =$row[1]; + $HKstatus_name[$w] =$row[2]; + $HKhotkeys = "$HKhotkeys'$HKhotkey[$w]',"; + $HKstatuses = "$HKstatuses'$HKstatus[$w]',"; + $HKstatusnames = "$HKstatusnames'$HKstatus_name[$w]',"; + if ($w < 3) + {$HKboxA = "$HKboxA $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ( ($w >= 3) and ($w < 6) ) + {$HKboxB = "$HKboxB $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ($w >= 6) + {$HKboxC = "$HKboxC $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + $w++; + } + $HKhotkeys = substr("$HKhotkeys", 0, -1); + $HKstatuses = substr("$HKstatuses", 0, -1); + $HKstatusnames = substr("$HKstatusnames", 0, -1); + + ##### grab the statuses to be dialed for your campaign as well as other campaign settings + $stmt="SELECT park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,agent_pause_codes_active,no_hopper_leads_logins,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,xfer_groups FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $park_ext = $row[0]; + $park_file_name = $row[1]; + $web_form_address = $row[2]; + $allow_closers = $row[3]; + $auto_dial_level = $row[4]; + $dial_timeout = $row[5]; + $dial_prefix = $row[6]; + $campaign_cid = $row[7]; + $campaign_vdad_exten = $row[8]; + $campaign_rec_exten = $row[9]; + $campaign_recording = $row[10]; + $campaign_rec_filename = $row[11]; + $campaign_script = $row[12]; + $get_call_launch = $row[13]; + $campaign_am_message_exten = $row[14]; + $xferconf_a_dtmf = $row[15]; + $xferconf_a_number = $row[16]; + $xferconf_b_dtmf = $row[17]; + $xferconf_b_number = $row[18]; + $alt_number_dialing = $row[19]; + $VC_scheduled_callbacks = $row[20]; + $wrapup_seconds = $row[21]; + $wrapup_message = $row[22]; + $closer_campaigns = $row[23]; + $use_internal_dnc = $row[24]; + $allcalls_delay = $row[25]; + $omit_phone_code = $row[26]; + $agent_pause_codes_active = $row[27]; + $no_hopper_leads_logins = $row[28]; + $campaign_allow_inbound = $row[29]; + $manual_dial_list_id = $row[30]; + $default_xfer_group = $row[31]; + $xfer_groups = $row[32]; + + if ( (!ereg('DISABLED',$VU_vicidial_recording_override)) and ($VU_vicidial_recording > 0) ) + { + $campaign_recording = $VU_vicidial_recording_override; + print "\n"; + } + if ( ($VC_scheduled_callbacks=='Y') and ($VU_scheduled_callbacks=='1') ) + {$scheduled_callbacks='1';} + if ($VU_vicidial_recording=='0') + {$campaign_recording='NEVER';} + if ($alt_number_dialing=='Y') + {$alt_phone_dialing='1';} + else + {$alt_phone_dialing='0';} + $closer_campaigns = preg_replace("/^ | -$/","",$closer_campaigns); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaigns = "'$closer_campaigns'"; + + if ($agent_pause_codes_active=='Y') + { + ##### grab the pause codes for this campaign + $stmt="SELECT pause_code,pause_code_name FROM vicidial_pause_codes WHERE campaign_id='$VD_campaign' order by pause_code limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_pause_codes = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_pause_codes) + { + $row=mysql_fetch_row($rslt); + $pause_codes[$i] =$row[0]; + $pause_code_names[$i] =$row[1]; + $VARpause_codes = "$VARpause_codes'$pause_codes[$i]',"; + $VARpause_code_names = "$VARpause_code_names'$pause_code_names[$i]',"; + $i++; + $j++; + } + $VD_pause_codes_ct = ($VD_pause_codes_ct+$VD_pause_codes); + $VARpause_codes = substr("$VARpause_codes", 0, -1); + $VARpause_code_names = substr("$VARpause_code_names", 0, -1); + } + + ##### grab the inbound groups to choose from if campaign contains CLOSER + $VARingroups="''"; + if ($campaign_allow_inbound == 'Y') + { + $VARingroups=''; + $stmt="select group_id from vicidial_inbound_groups where active = 'Y' and group_id IN($closer_campaigns) order by group_id limit 60;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $closer_ct = mysql_num_rows($rslt); + $INgrpCT=0; + while ($INgrpCT < $closer_ct) + { + $row=mysql_fetch_row($rslt); + $closer_groups[$INgrpCT] =$row[0]; + $VARingroups = "$VARingroups'$closer_groups[$INgrpCT]',"; + $INgrpCT++; + } + $VARingroups = substr("$VARingroups", 0, -1); + } + + ##### grab the allowable inbound groups to choose from for transfer options + $xfer_groups = preg_replace("/^ | -$/","",$xfer_groups); + $xfer_groups = preg_replace("/ /","','",$xfer_groups); + $xfer_groups = "'$xfer_groups'"; + $VARxfergroups="''"; + if ($allow_closers == 'Y') + { + $VARxfergroups=''; + $stmt="select group_id,group_name from vicidial_inbound_groups where active = 'Y' and group_id IN($xfer_groups) order by group_id limit 60;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $xfer_ct = mysql_num_rows($rslt); + $XFgrpCT=0; + while ($XFgrpCT < $xfer_ct) + { + $row=mysql_fetch_row($rslt); + $VARxfergroups = "$VARxfergroups'$row[0]',"; + $VARxfergroupsnames = "$VARxfergroupsnames'$row[1]',"; + if ($row[0] == "$default_xfer_group") {$default_xfer_group_name = $row[1];} + $XFgrpCT++; + } + $VARxfergroups = substr("$VARxfergroups", 0, -1); + $VARxfergroupsnames = substr("$VARxfergroupsnames", 0, -1); + } + + ##### grab the number of leads in the hopper for this campaign + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id = '$VD_campaign' and status='READY';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $campaign_leads_to_call = $row[0]; + print "\n"; + + } + else + { + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Campaign not active, please try again
"; + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|$VD_pass|$ip|$browser|\n"); + fclose($fp); + } + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Login incorrect, please try again
"; + } + } + if ($VDloginDISPLAY) + { + echo "VICIDIAL web client: Campaign Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "

$VDdisplayMESSAGE

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Campaign Login
 
User Login:
User Password:
Campaign: $camp_form_code
  \n"; + echo "

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +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); +$authphone=$row[0]; +if (!$authphone) + { + echo "VICIDIAL web client: Phone Login Error\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Login Error
 
Sorry, your phone login and password are not active in this system, please try again:
 
Phone Login:
Phone Password:

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "VICIDIAL web client\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + 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); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $login=$row[6]; + $pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CallerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + $enable_sipsak_messages=$row[66]; + + if ($clientDST) + { + $local_gmt = ($local_gmt + $isdst); + } + if ($protocol == 'EXTERNAL') + { + $protocol = 'Local'; + $extension = "$dialplan_number$AT$ext_context"; + } + $SIP_user = "$protocol/$extension"; + + $stmt="SELECT asterisk_version from servers where server_ip='$server_ip';"; + 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); + $asterisk_version=$row[0]; + + # If a park extension is not set, use the default one + if ( (strlen($park_ext)>0) && (strlen($park_file_name)>0) ) + { + $VICIDiaL_park_on_extension = "$park_ext"; + $VICIDiaL_park_on_filename = "$park_file_name"; + print "\n"; + } + print "\n"; + + # If a web form address is not set, use the default one + if (strlen($web_form_address)>0) + { + $VICIDiaL_web_form_address = "$web_form_address"; + print "\n"; + } + else + { + $VICIDiaL_web_form_address = "$VICIDiaL_web_URL"; + print "\n"; + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + } + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + # If closers are allowed on this campaign + if ($allow_closers=="Y") + { + $VICIDiaL_allow_closers = 1; + print "\n"; + } + else + { + $VICIDiaL_allow_closers = 0; + print "\n"; + } + + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtimE$US$session_ext$session_rand"; + + if ($webform_sessionname) + {$webform_sessionname = "&session_name=$session_name";} + else + {$webform_sessionname = '';} + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'vicidial';"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','vicidial','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + if ( ($campaign_allow_inbound == 'Y') || ($campaign_leads_to_call > 0) || (ereg('Y',$no_hopper_leads_logins)) ) + { + ### insert an entry into the user log for the login event + $stmt = "INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$VD_login','LOGIN','$VD_campaign','$NOW_TIME','$StarTtimE','$VU_user_group')"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + ##### check to see if the user has a conf extension already, this happens if they previously exited uncleanly + $stmt="SELECT conf_exten FROM vicidial_conferences where extension='$SIP_user' and server_ip = '$server_ip' LIMIT 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $prev_login_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $prev_login_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + if ($prev_login_ct > 0) + {print "\n";} + else + { + ##### grab the next available vicidial_conference room and reserve it + $stmt="SELECT conf_exten FROM vicidial_conferences where server_ip = '$server_ip' and ((extension='') or (extension is null)) LIMIT 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $free_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $free_conf_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + $stmt="UPDATE vicidial_conferences set extension='$SIP_user' where server_ip='$server_ip' and conf_exten='$session_id';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + print "\n"; + + } + + $stmt="UPDATE vicidial_list set status='N', user='' where status IN('QUEUE','INCALL') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_hopper where status IN('QUEUE','INCALL','DONE') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_live_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_live_inbound_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + # print "You have logged in as user: $VD_login on phone: $SIP_user to campaign: $VD_campaign
\n"; + $VICIDiaL_is_logged_in=1; + + ### set the callerID for manager middleware-app to connect the phone to the user + $SIqueryCID = "S$CIDdate$session_id"; + + ############################################# + ##### START SYSTEM_SETTINGS LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,vicidial_agent_disable,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $vicidial_agent_disable = $row[6]; + $allow_sipsak_messages = $row[7]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_prefix = 'LIN-'; + print "\n"; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$VD_campaign\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + $SIqueryCID = "$SIPSAK_prefix$VD_campaign$DS$CIDdate"; + } + + ### insert a NEW record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$SIqueryCID','Channel: $SIP_user','Context: $ext_context','Exten: $session_id','Priority: 1','Callerid: $SIqueryCID','','','','','');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($auto_dial_level > 0) + { + print "\n"; + + ##### grab the campaign_weight and number of calls today on that campaign for the agent + $stmt="SELECT campaign_weight,calls_today FROM vicidial_campaign_agents where user='$VD_login' and campaign_id = '$VD_campaign';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vca_ct = mysql_num_rows($rslt); + if ($vca_ct > 0) + { + $row=mysql_fetch_row($rslt); + $campaign_weight = $row[0]; + $calls_today = $row[1]; + $i++; + } + else + { + $campaign_weight = '0'; + $calls_today = '0'; + $stmt="INSERT INTO vicidial_campaign_agents (user,campaign_id,campaign_rank,campaign_weight,calls_today) values('$VD_login','$VD_campaign','0','0','$calls_today');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + } + $closer_chooser_string=''; + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,user_level,campaign_weight,calls_today) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$closer_chooser_string','$user_level','$campaign_weight','$calls_today');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='$VD_campaign',agent='Agent/$VD_login',verb='AGENTLOGIN',data1='$VD_login@agents',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + mysql_close($linkB); + mysql_select_db("$VARDB_database", $link); + } + + + if ($campaign_allow_inbound == 'Y') + { + print "\n"; + } + } + else + { + print "\n"; + + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,user_level) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$user_level');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='$VD_campaign',agent='Agent/$VD_login',verb='AGENTLOGIN',data1='$VD_login@agents',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + mysql_close($linkB); + mysql_select_db("$VARDB_database", $link); + } + } + } + else + { + echo "VICIDIAL web client: VICIDIAL Campaign Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "Sorry, there are no leads in the hopper for this campaign\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Login: \n
"; + echo "Password:
\n"; + echo "Campaign: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + if (strlen($session_id) < 1) + { + echo "VICIDIAL web client: VICIDIAL Campaign Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "Sorry, there are no available sessions\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Login: \n
"; + echo "Password:
\n"; + echo "Campaign: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + if (ereg('MSIE',$browser)) + { + $useIE=1; + print "\n"; + } + else + { + $useIE=0; + print "\n"; + } + + $StarTtimE = date("U"); + $NOW_TIME = date("Y-m-d H:i:s"); + ##### Agent is going to log in so insert the vicidial_agent_log entry now + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group,sub_status) values('$VD_login','$server_ip','$NOW_TIME','$VD_campaign','$StarTtimE','0','$StarTtimE','$VU_user_group','LOGIN');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id($link); + print "\n"; + + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $server_ip_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S"; + + ##### grab the datails of all active scripts in the system + $stmt="SELECT script_id,script_name,script_text FROM vicidial_scripts WHERE active='Y' order by script_id limit 100;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $MM_scripts = mysql_num_rows($rslt); + $e=0; + while ($e < $MM_scripts) + { + $row=mysql_fetch_row($rslt); + $MMscriptid[$e] =$row[0]; + $MMscriptname[$e] = rawurlencode($row[1]); + $MMscripttext[$e] = rawurlencode($row[2]); + $MMscriptids = "$MMscriptids'$MMscriptid[$e]',"; + $MMscriptnames = "$MMscriptnames'$MMscriptname[$e]',"; + $MMscripttexts = "$MMscripttexts'$MMscripttext[$e]',"; + $e++; + } + $MMscriptids = substr("$MMscriptids", 0, -1); + $MMscriptnames = substr("$MMscriptnames", 0, -1); + $MMscripttexts = substr("$MMscripttexts", 0, -1); + + } +} + +################################################################ +### BEGIN - build the callback calendar (12 months) ### +################################################################ +define ('ADAY', (60*60*24)); +$CdayARY = getdate(); +$Cmon = $CdayARY['mon']; +$Cyear = $CdayARY['year']; +$CTODAY = date("Y-m"); +$CTODAYmday = date("j"); +$CINC=0; + +$Cmonths = Array('January','February','March','April','May','June', + 'July','August','September','October','November','December'); +$Cdays = Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); + +$CCAL_OUT = ''; + +$CCAL_OUT .= ""; + +while ($CINC < 12) +{ +if ( ($CINC == 0) || ($CINC == 4) ||($CINC == 8) ) + {$CCAL_OUT .= "";} + +$CCAL_OUT .= ""; + +if ( ($CINC == 3) || ($CINC == 7) ||($CINC == 11) ) + {$CCAL_OUT .= "";} +$CINC++; +} + +$CCAL_OUT .= "
"; + +$CYyear = $Cyear; +$Cmonth= ($Cmon + $CINC); +if ($Cmonth > 12) + { + $Cmonth = ($Cmonth - 12); + $CYyear++; + } +$Cstart= mktime(11,0,0,$Cmonth,1,$CYyear); +$CfirstdayARY = getdate($Cstart); +#echo "|$Cmon|$Cmonth|$CINC|\n"; +$CPRNTDAY = date("Y-m", $Cstart); + +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; + +foreach($Cdays as $Cday) +{ + $CDCLR="#ffffff"; +$CCAL_OUT .= ""; +} + +for( $Ccount=0;$Ccount<(6*7);$Ccount++) +{ + $Cdayarray = getdate($Cstart); + if((($Ccount) % 7) == 0) + { + if($Cdayarray['mon'] != $CfirstdayARY['mon']) + break; + $CCAL_OUT .= ""; + } + if($Ccount < $CfirstdayARY['wday'] || $Cdayarray['mon'] != $Cmonth) + { + $CCAL_OUT .= ""; + } + else + { + if( ($Cdayarray['mday'] == $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + else + { + $CDCLR="#ffffff"; + if ( ($Cdayarray['mday'] < $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CDCLR="#CCCCCC"; + $CBL = ''; + $CEL = ''; + } + else + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + } + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + } +} +$CCAL_OUT .= ""; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$CfirstdayARY[month] $CfirstdayARY[year]"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$Cday"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
 "; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; + +#echo "$CCAL_OUT\n"; +################################################################ +### END - build the callback calendar (12 months) ### +################################################################ + + +?> + + + + +\n"; + + +?> + +
+ + MARGINWIDTH=0 MARGINHEIGHT=0 LEFTMARGIN=0 TOPMARGIN=0 VALIGN=TOP ALIGN=LEFT> +
+ + + +LOGOUT\n"; ?> +
+
+ + + height=30> + + + + + +
VICIDIALSCRIPT VALIGN=MIDDLE ALIGN=CENTER>   LIVE     session ID: Live Call
+
+ + + + + height=>

VICIDIAL
+
+ + +MANUAL DIAL       FAST DIAL
+
+ + +X ACTIVE CALLBACKS
+
+ + +
+
+ + + D1 - DIAL\n"; + echo "
\n"; + echo "D2 - DIAL\n"; + } + else {echo "
\n";} + ?> +

+
+
+ + + height=460>
CALLBACKS FOR AGENT :
Click on a callback below to call the customer back now. If you click on a record below to call it, it will be removed from the list. +
+
+
  + Refresh +                 + Go Back +
+
+ + + height=460>
NEW MANUAL DIAL LEAD FOR :

Enter information below for the new lead you wish to call. +
+ \n"; + } + ?> + Note: all new manual dial leads will go into list

+ + + + + + + + + + + + + + + +
Dial Code:   (This is usually a 1 in the USA-Canada)
Phone Number: +   (12 digits max - digits only) +
Search Existing Leads:   (This option if checked will attempt to find the phone number in the system before inserting it as a new lead)


If you want to dial a number and have it NOT be added as a new lead, enter in the exact dialstring that you want to call in the Dial Override field below. To hangup this call you will have to open the CALLS IN THIS SESSION link at the bottom of the screen and hang it up by clicking on its channel link there.
 
Dial Override:   (digits only please) +
+
+ Dial Now +                 + Go Back +
+
+ + + +
+
+ + + + +Your Status:
Calls Dialing: +
+ + + + + > + +
+
+ + Transfer - Conference
+ + + LOCAL CLOSER + Hangup Xfer Line + Hangup Both Lines + +
+ + Number to call   + + DIAL OVERRIDE   + LEAVE 3-WAY CALL + Dial Blind Transfer + D1 + D2 + +
+ + seconds   + channel + Dial With Customer + Park Customer Dial + Blind Transfer VMail Message +
+
+
+
+ + + + height=70> + +
Lead Dispositioned As:

+ -
+
+
+ + + height=70> + + + + +
Disposition Hot Keys: + When active, simply press the keyboard key for the desired disposition for this call. The call will then be hungup and dispositioned automatically:
+ + + + + +
+
+ + + height=70> + + + + + + +
Previous Callback Information: close
+
+
+
+
+ +
+
+ + + height=500>
Noone is in your session:
+ Go Back +

+ Call Agent Again +
+
+ + + height=500>
Customer has hung up:
+ Go Back +

+ Finish and Disposition Call + +
+
+ + + height=550>
Call Wrapup: seconds remaining in wrapup

+ +

+ Finish Wrapup and Move On + +
+
+ + + height=500>
Your session has been disabled
LOGOUT

Go Back +
+
+ + + height=500>

LOGOUT
+
+ + +
+
+ + +
 
+
+ + + height=47>
Any changes made to the customer information below at this time will not be comitted, You must change customer information before you Hangup the call.
+
+ + + height=460>
DISPOSITION CALL :       Hangup Again       minimize
+ End-of-call Disposition Selection +
+ PAUSE AGENT DIALING
+ CLEAR FORM | + SUBMIT +

+ WEB FORM SUBMIT +

  +
+
+ + + height=460>
SELECT A PAUSE CODE :
+ Pause Code Selection + +

  +
+
+ + + height=460>
Select a CallBack Date :
+ + + Select a Date Below   +     + Hour: +   + Minutes: +   + +  
+ MY CALLBACK ONLY
";} + ?> + CB Comments:

+ + SUBMIT

+ +

  +
+
+ + + height=460>
CLOSER INBOUND GROUP SELECTION
+ Closer Inbound Group Selection +
+ BLENDED CALLING(outbound activated)
+ RESET | + SUBMIT +



  +
+
+ + + + Channel + Channel + MY CALLBACK ONLY
";} + ?> +
+ + + + height=>
VICIDIAL SCRIPT
+
+ + + 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> +HOT KEYS INACTIVE + + + + +> + + + +
VICIDIAL web-client version:     BUILD:               Server:              
+Show conference call channel information

 
+
+ + + +
+
+ + + + + id="MainTable"> + + + + + + + + + + + + + + + +
STATUS:
+
+Dial Next Number
+ LEAD PREVIEW
+ ALT PHONE DIAL
+ + +RECORDING FILE:
+
+
+RECORD ID:
+
+ +Start Recording
+
+Web Form
+
+Park Call
+Transfer - Conference
+
+Hangup Customer
+
+
Send DTMF

+
+
+
align=left valign=top> + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
seconds:   Channel:   Cust Time:
Customer Information:
Title:   First:   MI:   Last:
Address1:
Address2:   Address3:
City:   State:   PostCode:
Province:   Vendor ID:
Phone:   DialCode:   Alt. Phone:
Show:   Email:
Comments: + +\n";} +else + {echo "\n";} +?> + +
+
+ +
+
> + 
+ + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc/voicemail_check.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/voicemail_check.php new file mode 100644 index 00000000..0aa152d7 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc/voicemail_check.php @@ -0,0 +1,140 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid 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 "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Voicemail Check"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + $MT[0]=''; + $row=''; $rowx=''; + if (strlen($vmail_box)<1) + { + $channel_live=0; + echo "voicemail box $vmail_box is not valid\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";} + $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";} + } + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/active_list_refresh.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/active_list_refresh.php new file mode 100644 index 00000000..61d75d5d --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/active_list_refresh.php @@ -0,0 +1,482 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "\n"; +echo "\n"; +echo "\n"; +echo "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 "\n"; +echo "\n"; +echo "\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 "\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + +###################### +# ADD=2 display all busy extensions on a server +###################### +if ($ADD==2) +{ + if (!$field_name) {$field_name = 'busyext';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\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 "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=4 display all busy Local lines on a server +###################### +if ($ADD==4) +{ + if (!$field_name) {$field_name = 'local';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\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 "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='table') {echo "\n";} +if ($format=='table') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/astguiclient.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/astguiclient.php new file mode 100644 index 00000000..1fe0f403 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/astguiclient.php @@ -0,0 +1,2905 @@ + LICENSE: GPLv2 +# +# make sure you have added a user to the vicidial_users MySQL table with at least +# user_level 1 or greater to access this page. Also you need to have the login +# and pass of a phone listed in the asterisk.phones table. The page grabs the +# server info and other details from this login and pass +# +# Other scripts that this application depends on: +# - active_list_refresh.php: displays active/live channels and phones +# - manager_send.php: sends Actions to be executed on Asterisk servers +# - live_exten_check.php: checks to see if user's phone is on a live call +# - call_log_display.php: retrieves log of inbound and outbound calls +# - voicemail_check.php: retrieves counts of new and old messages +# - inbound_popup.php: opens upon live_inbound call coming in +# - conf_exten_check.php: checks to see if and calls are in a specific conf +# - park_calls_display.php: retrieves list of parked calls +# - vdc_db_query.php: Changes values in the DB for non-calling records +# +# CHANGES +# 50215-1356 - Proof-of-concept test of XMLHttpRequest for astGUIclient web +# 50323-1411 - First build version display-only +# 50331-1040 - Second-build, added phone login and hangup/hijack display +# 50401-1006 - Trunk/Local Hangup functions enabled +# 50404-1056 - Trunk/Local Hijack functions enabled +# 50404-1459 - Simple live calls display and grabs updated time from server +# 50405-1221 - Reorganized the display and layers, added some images +# 50406-1005 - Added In/Out call log display to MAIN panel +# 50407-1254 - Start/Stop Recording on live calls enabled +# 50422-1101 - Activated Check Voicemail button and new/old messages count +# 50428-1449 - Added dial from log and basic live_inbound call popup +# 50429-1455 - Modified inbound popup code for IE and to add more functions +# 50502-1442 - Added basic method to transfer live calls somewhere else +# 50503-1205 - Added web_client_sessions entry for more security of subscripts +# 50503-1537 - Added basic conferences display +# 50509-1132 - Added conference connected list and hangup/xfer for them +# 50511-1129 - Added registration of conference rooms and added manual dial +# 50523-1342 - Added Conference recording and send DTMF +# 50523-1622 - Added Local Dial window frame for calling local extensions +# 50524-1456 - Added ability to park call and display number of parked calls +# 50524-1600 - Added ability to display and pickup/hangup/xfer parked calls +# 50525-1224 - Added ability to place outbound call from within conferene +# 50531-1225 - Added ability to do dual transfers to meetme rooms from Main +# 50711-1229 - removed HTTP authentication in favor of user/pass vars +# 50711-1610 - Added Zap monitoring to Trunk/Local Action screens +# 50804-1604 - Minor bug fix in inbound_popup functions +# 50818-1715 - Added pretty login section +# 50913-1137 - Added custom outbound_cid from phones table +# 51110-1430 - Fixed non-standard http port issue +# 60103-1421 - Added code for favorite extensions chooser +# 60104-1347 - Added basic layout for favorites editing frame +# 60105-1124 - Finished Favorites frame and added DB submission +# 60112-1622 - Several formatting changes +# 60421-1357 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1103 - Added variable filters to close security holes for login form +# 60829-1528 - Made compatible with WeBRooTWritablE setting in dbconnect.php +# + +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["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["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} + 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"];} + } + +$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++;} + +$version = '2.0.1'; +$build = '60829-1528'; + +### 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); + $user=ereg_replace("[^0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^0-9a-zA-Z]","",$pass); + + +if ($force_logout) +{ + if( (strlen($_SERVER['user'])>0) or (strlen($_SERVER['pass'])>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "Você fez o logoff. Obrigado\n"; + exit; +} + +$StarTtime = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_TIME = date("Ymd-His"); + $month_old = mktime(0, 0, 0, date("m"), date("d")-7, date("Y")); + $past_month_date = date("Y-m-d H:i:s",$month_old); + + $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]; + +$US='_'; +$CL=':'; +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./astguiclient_auth_entries.txt", "a");} +$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 = $agcPAGE; +$agcDIR = eregi_replace('astguiclient.php','',$agcDIR); + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth) or ($relogin == 'YES') ) + { + header ("Content-type: text/html; charset=utf-8"); + + echo "astGUIclient web client: Login\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Brazil
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Login
 
Login do Usuário:
Senha do Usuário:
Login do Telefone:
Senha do Telefone:

VERSÃO: $version       CONFIGURAÇÃO: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($user); + $password=strtoupper($pass); + $stmt="SELECT full_name,user_level from vicidial_users where user='$user' and pass='$pass'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDISCAR|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDISCAR|FAIL|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + } + +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 +echo "\n"; +echo "\n"; +echo "\n"; + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "astGUIclient web client: Login do Telefone\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "
English Brazil
\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Login do Telefone
 
Login do Telefone:
Senha do Telefone:

VERSÃO: $version       CONFIGURAÇÃO: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$authphone=$row[0]; +if (!$authphone) + { + echo "astGUIclient web client: Login do Telefone\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Brazil
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Login do Telefone
 
Desculpe seu login de telefone e senha não estão ativos nesta campanha, por favor tente novamente:
 
Login do Telefone:
Senha do Telefone:

VERSÃO: $version       CONFIGURAÇÃO: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "astGUIclient web client\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $phone_login=$row[6]; + $phone_pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CaLLerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + $outbound_cid=$row[65]; + + $local_web_callerID_URL_enc = rawurlencode($local_web_callerID_URL); + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtime$US$session_ext$session_rand"; + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'agc';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','agc','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT count(*) from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_present=$row[0]; + if ($favorites_present > 0) + { + $stmt="SELECT extensions_list from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_list=$row[0]; + $h=0; + $favorites_listX = eregi_replace("'",'',$favorites_list); + $favorites = explode(',',$favorites_listX); + $favorites_count = count($favorites); + $favorites_listX=''; + + $o=0; + while ($favorites_count > $o) + { + $stmt="SELECT fullname,protocol from phones where extension = '$favorites[$o]' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $favorites_names[$o] = $rowx[0]; + $favorites_listX .= "$rowx[1]/$favorites[$o],"; + $o++; + } + + echo "\n"; + echo "\n"; + } + else + { + echo "\n"; + } + +### gather phone extensions and fullnames for favorites editor ### + $stmt="SELECT extension,fullname from phones where server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $exten_ct = mysql_num_rows($rslt); + $favlistCT=0; + $nofavlistCT=0; + while ($favlistCT < $exten_ct) + { + $row=mysql_fetch_row($rslt); + $favlist[$favlistCT]= "$row[0] - $row[1]"; + $favlistCT++; + } + + } +} + + +?> + + + + + + +\n"; + + +?> + +
+ + + + + + + + + +
+ + +SAIR
\n"; ?> +
Painel PrincipalLinhas Ativas no PainelPainel de ConferênciasVerificar Caixa PostalChamadas Ativas
+
+ + +

Logout
+
+ + +
TRUNK DESLIGAR

+ Active Trunks Menu
+ Desligar o Canal   |   + Capturar o Canal   |   + Ouvir o Canal   |   + Atualizar   |   + Voltar a página principal +
+
+ + +
DESLIGAR LOCAL

+ Menu Local Ativo
+ Desligar Local   |   + Capturar Local   |   + Ouvir Local   |   + Atualizar   |   + Voltar a página principal +
+
+ + + + + + + +
TRANSFERIR CHAMADAS ATIVAS
Canal a ser transferido: Canal
Extensões:
Extensões do Menu
+
+ Enviar para a extensão selecionada

+ Enviar para a caixa postal selecionada

+ Envie para este número:


+ Atualizar


+ Voltar a página principal

+
Conferencias:
(Clique no número abaixo para enviar a conferência)
Enviar meu canal para
Menu das conferências
+
+ + + + + +
Discar a extensão local
Telefone ligando de: Canal
Extensões:
Extensões do Menu
+
+ Ligar para a extensão selecionada

+ Ligar para a caixa postal selecionada

+ Atualizar


+ Voltar a página principal

+
+
+ + +
CHAMADAS EM ESPERA:
+ Voltar a página principal

+
+
+ + + + + + + + + + + + + + + +
  +
CAIXA POSTAL     NOVO:     VELHO:             DISCAGEM MANUAL       DISCAR
CHAMADAS EM ESPERA: 0                DISCAR A EXTENSÃO LOCAL
CHAMADAS SAINTES:
CHAMADAS ENTRANTES:
Versão do cliente web do astGUIClient: CONFIGURAÇÃO:
+ + + + $h) + { + if (strlen($favorites[$h])>1) + { + echo "\n"; + } + $h++; + } +?> + +
FAVORITOS       editar
$favorites[$h] - $favorites_names[$h]
 
+
+ + + + + + + +
FAVORITOS

 
PARA ENVIAR MODIFICACOES FAVORITAS E NECESSARIO FAZER O SAIR
VOLTAR A TELA PRINCIPAL - as alterações serão ignoradas
+
+ +
+ + + + + + + + + + + + + +
+PAUSAR | INICIAR     Atualizar a taxa: 1000 ms Mais rápido | Mais devagar

+
Inicializando..
+
Extensões Ativas
+ATUALIZAR | +ORDEM | +
Linhas externas
+ATUALIZAR | +ORDEM | +
Extensões Locais
+ATUALIZAR | +ORDEM | +
+ Data vai aqui

+
+ Data vai aqui

Atividade do Tronco +
+ Data vai aqui

Atividade Local +
+
+ + + + +
+ + +Lista das conferências + + + +
+Clique no número da conferência, a esquerda, para entrar na conferência +
+ + + + + + + + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/call_log_display.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/call_log_display.php new file mode 100644 index 00000000..abbaabeb --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/call_log_display.php @@ -0,0 +1,196 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "\n"; +echo "\n"; +echo "\n"; +echo "Registro de Ligações"; +echo "\n"; +echo "\n"; +echo "\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";} + $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";} + $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"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/conf_exten_check.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/conf_exten_check.php new file mode 100644 index 00000000..eee0f698 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/conf_exten_check.php @@ -0,0 +1,297 @@ + LICENSE: GPLv2 +# +# 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 +# + +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"];} + +$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";} + +$version = '2.0.4-12'; +$build = '71122-0205'; +$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";} + $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 "\n"; +echo "\n"; +echo "\n"; +echo "Verificação da Extensão de Conferência"; +echo "\n"; +echo "\n"; +echo "\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; + + ### 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); + $row=mysql_fetch_row($rslt); + $Acount=$row[0]; + + if ($Acount > 0) + { + $stmt="SELECT status from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Astatus=$row[0]; + } + # ### 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";} + $rslt=mysql_query($stmt, $link); + + if ($campagentstdisp == 'YES') + { + ### grab the status of this agent to display + $stmt="SELECT status,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Alogin=$row[0]; + $Acampaign=$row[1]; + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where server_ip='$server_ip' and status NOT IN('XFER') and campaign_id='$Acampaign';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $RingCalls=$row[0]; + } + else + { + $Alogin='N'; + $RingCalls='N'; + } + } + else + { + $Alogin='N'; + $RingCalls='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";} + $rslt=mysql_query($stmt, $link); + + } + + if ($Acount < 1) {$Alogin='DEAD_VLA';} + if ($AexternalDEAD > 0) {$Alogin='DEAD_EXTERNAL';} + + echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Status: ' . $Astatus . "|\n"; + + } + $total_conf=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + 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";} + } + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $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++; $total_conf++; + $row=mysql_fetch_row($rslt); + $CanalA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + } + $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";} + $rslt=mysql_query($stmt, $link); + } + echo "Conferencia $conf_exten já foi registrado para $exten\n"; + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/dbconnect.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/dbconnect.php new file mode 100644 index 00000000..7221b35e --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/dbconnect.php @@ -0,0 +1,48 @@ + LICENSE: GPLv2 +# +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"); +mysql_select_db("$VARDB_database"); + +$local_DEF = 'Local/'; +$conf_silent_prefix = '7'; +$local_AMP = '@'; +$ext_context = 'demo'; +$recording_exten = '8309'; +$WeBRooTWritablE = '1'; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/inbound_popup.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/inbound_popup.php new file mode 100644 index 00000000..d75c9b5b --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/inbound_popup.php @@ -0,0 +1,351 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "\n"; +echo "\n"; +echo "\n"; +?> + + +CHAMADA ENTRANDO"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "

CHAMADA ENTRANDO

\n"; +echo "$NOW_TIME

\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 * FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $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";} + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Canal: $row[1]
CallerID: $row[3]
\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 "GOOGLE - \n"; + echo "ANYWHO - \n"; + echo "SWITCHBOARD - \n"; + echo "VERIZON - \n"; + echo "WHITEPAGES - \n"; + echo "411.COM - \n"; + echo "411.COM - \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 "CUSTOMIZADO - \n"; + + echo "
Número Discado: $row[8]
Notas: $row[9]|$row[10]|$row[11]|$row[12]|$row[13]|
\n"; + echo "DESLIGAR - \n"; + echo "ENVIAR PARA MINHA CAIXA POSTAL\n"; + echo "
\n"; + + + $stmt="UPDATE live_inbound set acknowledged='Y' where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + + } + + + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/live_exten_check.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/live_exten_check.php new file mode 100644 index 00000000..7e9fcba6 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/live_exten_check.php @@ -0,0 +1,278 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "\n"; +echo "\n"; +echo "\n"; +echo "Verificação de extensões ativas"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + +echo "DateTime: $NOW_TIME|"; +echo "UnixTime: $StarTtime|"; + +$stmt="SELECT count(*) FROM parked_channels where server_ip = '$server_ip';"; + if ($format=='debug') {echo "\n";} +$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";} + $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";} + } + } + + $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";} + $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";} + $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";} + $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";} + $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";} +$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";} + } + +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";} + $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";} + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/manager_send.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/manager_send.php new file mode 100644 index 00000000..de1bac2b --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/manager_send.php @@ -0,0 +1,1142 @@ + LICENSE: GPLv2 +# +# This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk 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: +# - $ACTION - ('Originate','Redirect','Hangup','Command','Monitor','StopMonitor','SysCIDOriginate','RedirectName','RedirectNameVmail','MonitorConf','StopMonitorConf','RedirectXtra','RedirectXtraCX','RedirectVD','HangupConfDial','VolumeControl','OriginateVDRelogin') +# - $queryCID - ('CN012345678901234567',...) +# - $format - ('text','debug') +# - $channel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +# - $exten - ('1234','913125551212',...) +# - $ext_context - ('default','demo',...) +# - $ext_priority - ('1','2',...) +# - $filename - ('20050406-125623_44444',...) +# - $extenName - ('phone100',...) +# - $parkedby - ('phone100',...) +# - $extrachannel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +# - $auto_dial_level - ('0','1','1.1',...) +# - $campaign - ('CLOSER','TESTCAMP',...) +# - $uniqueid - ('1120232758.2406800',...) +# - $lead_id - ('1234',...) +# - $seconds - ('32',...) +# - $outbound_cid - ('3125551212','0000000000',...) +# - $agent_log_id - ('123456',...) +# - $call_server_ip - ('10.10.10.15',...) +# - $CalLCID - ('VD01234567890123456',...) +# - $stage - ('UP','DOWN') +# + +# CHANGELOG: +# 50401-1002 - First build of script, Hangup function only +# 50404-1045 - Redirect basic function enabled +# 50406-1522 - Monitor basic function enabled +# 50407-1647 - Monitor and StopMonitor full functions enabled +# 50422-1120 - basic Originate function enabled +# 50428-1451 - basic SysCIDOriginate function enabled for checking voicemail +# 50502-1539 - basic RedirectName and RedirectNameVmail added +# 50503-1227 - added session_name checking for extra security +# 50523-1341 - added Conference call start/stop recording +# 50523-1421 - added OriginateName and OriginateNameVmail for local calls +# 50524-1602 - added RedirectToPark and RedirectFromPark +# 50531-1203 - added RedirecXtra for dual channel redirection +# 50630-1100 - script changed to not use HTTP login vars, user/pass instead +# 50804-1148 - Added RedirectVD for VICIDIAL blind redirection with logging +# 50815-1204 - Added NEXTAVAILABLE to RedirectXtra function +# 50903-2343 - Added HangupConfDial function to hangup in-dial channels in conf +# 50913-1057 - Added outbound_cid set if present to originate call +# 51020-1556 - Added agent_log_id framework for detailed agent activity logging +# 51118-1204 - Fixed Blind transfer bug from VICIDIAL when in manual dial mode +# 51129-1014 - Added ability to accept calls from other VICIDIAL servers +# 51129-1253 - Fixed Hangups of other agents channels in VICIDIAL AD +# 60310-2022 - Fixed NEXTAVAILABLE bug in leave-3way-call redirect function +# 60421-1413 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1158 - Added variable filters to close security holes for login form +# 60809-1544 - Added direct transfers to leave-3ways in consultative transfers +# 61004-1526 - Added parsing of volume control command and lookup or number +# 61130-1617 - Added lead_id to MonitorConf for recording_log +# 61201-1115 - Added user to MonitorConf for recording_log +# 70111-1600 - added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70226-1251 - Added Mute/UnMute to conference volume control +# 70320-1502 - Added option to allow retry of leave-3way-call and debug logging +# 70322-1636 - Added sipsak display ability +# + +require("dbconnect.php"); + +### These are variable assignments for PHP globals off +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["ACTION"])) {$ACTION=$_GET["ACTION"];} + elseif (isset($_POST["ACTION"])) {$ACTION=$_POST["ACTION"];} +if (isset($_GET["queryCID"])) {$queryCID=$_GET["queryCID"];} + elseif (isset($_POST["queryCID"])) {$queryCID=$_POST["queryCID"];} +if (isset($_GET["format"])) {$format=$_GET["format"];} + elseif (isset($_POST["format"])) {$format=$_POST["format"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["exten"])) {$exten=$_GET["exten"];} + elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];} +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["filename"])) {$filename=$_GET["filename"];} + elseif (isset($_POST["filename"])) {$filename=$_POST["filename"];} +if (isset($_GET["extenName"])) {$extenName=$_GET["extenName"];} + elseif (isset($_POST["extenName"])) {$extenName=$_POST["extenName"];} +if (isset($_GET["parkedby"])) {$parkedby=$_GET["parkedby"];} + elseif (isset($_POST["parkedby"])) {$parkedby=$_POST["parkedby"];} +if (isset($_GET["extrachannel"])) {$extrachannel=$_GET["extrachannel"];} + elseif (isset($_POST["extrachannel"])) {$extrachannel=$_POST["extrachannel"];} +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["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} + elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["secondS"])) {$secondS=$_GET["secondS"];} + elseif (isset($_POST["secondS"])) {$secondS=$_POST["secondS"];} +if (isset($_GET["outbound_cid"])) {$outbound_cid=$_GET["outbound_cid"];} + elseif (isset($_POST["outbound_cid"])) {$outbound_cid=$_POST["outbound_cid"];} +if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];} + elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];} +if (isset($_GET["call_server_ip"])) {$call_server_ip=$_GET["call_server_ip"];} + elseif (isset($_POST["call_server_ip"])) {$call_server_ip=$_POST["call_server_ip"];} +if (isset($_GET["CalLCID"])) {$CalLCID=$_GET["CalLCID"];} + elseif (isset($_POST["CalLCID"])) {$CalLCID=$_POST["CalLCID"];} +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["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} +if (isset($_GET["phone_ip"])) {$phone_ip=$_GET["phone_ip"];} + elseif (isset($_POST["phone_ip"])) {$phone_ip=$_POST["phone_ip"];} +if (isset($_GET["enable_sipsak_messages"])) {$enable_sipsak_messages=$_GET["enable_sipsak_messages"];} + elseif (isset($_POST["enable_sipsak_messages"])) {$enable_sipsak_messages=$_POST["enable_sipsak_messages"];} +if (isset($_GET["allow_sipsak_messages"])) {$allow_sipsak_messages=$_GET["allow_sipsak_messages"];} + elseif (isset($_POST["allow_sipsak_messages"])) {$allow_sipsak_messages=$_POST["allow_sipsak_messages"];} + +$user=ereg_replace("[^0-9a-zA-Z]","",$user); +$pass=ereg_replace("[^0-9a-zA-Z]","",$pass); +$secondS = ereg_replace("[^0-9]","",$secondS); + +# default optional vars if not set +if (!isset($ACTION)) {$ACTION="Originate";} +if (!isset($format)) {$format="alert";} +if (!isset($ext_priority)) {$ext_priority="1";} + +$version = '2.0.29'; +$build = '70320-1502'; +$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 "\n"; +echo "\n"; +echo "\n"; +echo "Gerente Envia: "; +if ($ACTION=="Originate") {echo "Originate";} +if ($ACTION=="Redirect") {echo "Redirect";} +if ($ACTION=="RedirectName") {echo "RedirectName";} +if ($ACTION=="Hangup") {echo "Hangup";} +if ($ACTION=="Command") {echo "Command";} +if ($ACTION==99999) {echo "AJUDA";} +echo "\n"; +echo "\n"; +echo "\n"; +} + + + + + +###################### +# ACTION=SysCIDOriginate - insert Originate Manager statement allowing small CIDs for system calls +###################### +if ($ACTION=="SysCIDOriginate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<1) ) + { + echo "Exten $exten não é válido or queryCID $queryCID não é válido, Originate comando não inserido\n"; + } + else + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate comando enviado para Exten $exten Canal $channelligado$server_ip\n"; + } +} + + + +###################### +# ACTION=Originate, OriginateName, OriginateNameVmail - insert Originate Manager statement +###################### +if ($ACTION=="OriginateName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Uma dessas variáveis não é válido:\n"; + echo "Canal $channel Deve ser maior que 2 caracteres\n"; + echo "queryCID $queryCID Deve ser maior que 14 caracateres\n"; + echo "extenName $extenName Deve ser definido\n"; + echo "ext_context $ext_context Deve ser definido\n"; + echo "ext_priority $ext_priority Deve ser definido\n"; + echo "\nOriginateName Action não enviado\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="OriginateNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Uma dessas variáveis não é válido:\n"; + echo "Canal $channel Deve ser maior que 2 caracteres\n"; + echo "queryCID $queryCID Deve ser maior que 14 caracateres\n"; + echo "extenName $extenName Deve ser definido\n"; + echo "exten $exten Deve ser definido\n"; + echo "ext_context $ext_context Deve ser definido\n"; + echo "ext_priority $ext_priority Deve ser definido\n"; + echo "\nOriginateNameVmail Action não enviado\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="OriginateVDRelogin") +{ + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $CIDdate = date("ymdHis"); + $DS='-'; + $SIPSAK_prefix = 'LIN-'; + print "\n"; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$campaign\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + $queryCID = "$SIPSAK_prefix$campaign$DS$CIDdate"; + + } + $ACTION="Originate"; +} + +if ($ACTION=="Originate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<10) ) + { + echo "Exten $exten não é válido or queryCID $queryCID não é válido, Originate comando não inserido\n"; + } + else + { + if (strlen($outbound_cid)>1) + {$outCID = "\"$queryCID\" <$outbound_cid>";} + else + {$outCID = "$queryCID";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate comando enviado para Exten $exten Canal $channelligado$server_ip\n"; + } +} + + + +###################### +# ACTION=HangupConfDial - find the Local channel that is in the conference and needs to be hung up +###################### +if ($ACTION=="HangupConfDial") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($queryCID)<15) or (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "conference $exten não é válido or ext_context $ext_context or queryCID $queryCID não é válido, Hangup comando não inserido\n"; + } + else + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $hangup_channel_prefix = "$local_DEF$exten$local_AMP$ext_context"; + + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row > 0) + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $channel=$rowx[0]; + $ACTION="Hangup"; + $queryCID = eregi_replace("^.","G",$queryCID); + } + } +} + + + +###################### +# ACTION=Hangup - insert Hangup Manager statement +###################### +if ($ACTION=="Hangup") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) ) + { + $channel_live=0; + echo "Canal $channel não é válido or queryCID $queryCID não é válido, Hangup comando não inserido\n"; + } + else + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + +# $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# if ($row[0]==0) +# { +# $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $rowx=mysql_fetch_row($rslt); +# if ($rowx[0]==0) +# { +# $channel_live=0; +# echo "Channel $channel is not live on $call_server_ip, Hangup command not inserted\n"; +# } +# } + if ( ($auto_dial_level > 0) and (strlen($CalLCID)>2) and (strlen($exten)>2) and ($secondS > 4)) + { + $stmt="SELECT count(*) FROM vicidial_auto_calls where channel='$channel' and callerid='$CalLCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + echo "Call $CalLCID $channel não está ativoligado$call_server_ip, Checking Live Canal...\n"; + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel' and extension LIKE \"%$exten\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $channel_live=0; + echo "Canal $channel não está ativoligado$call_server_ip, Hangup comando não inserido $rowx[0]\n$stmt\n"; + } + else + { + echo "$stmt\n"; + } + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Hangup','$queryCID','Channel: $channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Hangup comando enviado para Canal $channelligado$call_server_ip\n"; + } + } +} + + + +###################### +# ACTION=Redirect, RedirectName, RedirectNameVmail, RedirectToPark, RedirectFromPark, RedirectVD, RedirectXtra, RedirectXtraCX +# - insert Redirect Manager statement using extensions name +###################### +if ($ACTION=="RedirectVD") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($campaign)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($uniqueid)<2) or (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "Uma dessas variáveis não é válido:\n"; + echo "Canal $channel Deve ser maior que 2 caracteres\n"; + echo "queryCID $queryCID Deve ser maior que 14 caracateres\n"; + echo "exten $exten Deve ser definido\n"; + echo "ext_context $ext_context Deve ser definido\n"; + echo "ext_priority $ext_priority Deve ser definido\n"; + echo "auto_dial_level $auto_dial_level Deve ser definido\n"; + echo "campaign $campaign Deve ser definido\n"; + echo "uniqueid $uniqueid Deve ser definido\n"; + echo "lead_id $lead_id Deve ser definido\n"; + echo "\nRedirectVD Action não enviado\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($auto_dial_level < 1) + { + $stmt = "UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectToPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($parkedby)<1) ) + { + $channel_live=0; + echo "Uma dessas variáveis não é válido:\n"; + echo "Canal $channel Deve ser maior que 2 caracteres\n"; + echo "queryCID $queryCID Deve ser maior que 14 caracateres\n"; + echo "exten $exten Deve ser definido\n"; + echo "extenName $extenName Deve ser definido\n"; + echo "ext_context $ext_context Deve ser definido\n"; + echo "ext_priority $ext_priority Deve ser definido\n"; + echo "parkedby $parkedby Deve ser definido\n"; + echo "\nRedirectToPark Action não enviado\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "INSERT INTO parked_channels values('$channel','$server_ip','','$extenName','$parkedby','$NOW_TIME');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectFromPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Uma dessas variáveis não é válido:\n"; + echo "Canal $channel Deve ser maior que 2 caracteres\n"; + echo "queryCID $queryCID Deve ser maior que 14 caracateres\n"; + echo "exten $exten Deve ser definido\n"; + echo "ext_context $ext_context Deve ser definido\n"; + echo "ext_priority $ext_priority Deve ser definido\n"; + echo "\nRedirectFromPark Action não enviado\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "DELETE FROM parked_channels where server_ip='$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Uma dessas variáveis não é válido:\n"; + echo "Canal $channel Deve ser maior que 2 caracteres\n"; + echo "queryCID $queryCID Deve ser maior que 14 caracateres\n"; + echo "extenName $extenName Deve ser definido\n"; + echo "ext_context $ext_context Deve ser definido\n"; + echo "ext_priority $ext_priority Deve ser definido\n"; + echo "\nRedirectName Action não enviado\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Uma dessas variáveis não é válido:\n"; + echo "Canal $channel Deve ser maior que 2 caracteres\n"; + echo "queryCID $queryCID Deve ser maior que 14 caracateres\n"; + echo "extenName $extenName Deve ser definido\n"; + echo "exten $exten Deve ser definido\n"; + echo "ext_context $ext_context Deve ser definido\n"; + echo "ext_priority $ext_priority Deve ser definido\n"; + echo "\nRedirectNameVmail Action não enviado\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectXtraCX") +{ + $DBout=''; + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "Uma dessas variáveis não é válido:\n"; + echo "Canal $channel Deve ser maior que 2 caracteres\n"; + echo "ExtraCanal $extrachannel Deve ser maior que 2 caracteres\n"; + echo "queryCID $queryCID Deve ser maior que 14 caracateres\n"; + echo "exten $exten Deve ser definido\n"; + echo "ext_context $ext_context Deve ser definido\n"; + echo "ext_priority $ext_priority Deve ser definido\n"; + echo "\nRedirect Action não enviado\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDCXC|$filename|$user|$campaign|$channel|$extrachannel|$queryCID|$exten|$ext_context|ext_priority|\n"); + fclose($fp); + } + } + } + else + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Canal $channel não está ativoligado$call_server_ip, Redirect comando não inserido\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel não está ativoligado$call_server_ip";} + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Canal $channel não está ativoligado$server_ip, Redirect comando não inserido\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel não está ativoligado$server_ip";} + } + } + if ( ($channel_liveX==1) && ($channel_liveY==1) ) + { + $stmt="SELECT count(*) FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0] < 1) + { + $channel_liveY=0; + echo "No Local agent to send call to, Redirect comando não inserido\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "No Local agent to send call to";} + } + else + { + $stmt="SELECT server_ip,conf_exten,user FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $dest_server_ip = $rowx[0]; + $dest_session_id = $rowx[1]; + $dest_user = $rowx[2]; + $S='*'; + + $D_s_ip = explode('.', $dest_server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$dest_session_id$S$lead_id$S$dest_user$S$phone_code$S$phone_number$S$campaign$S"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','$queryCID','Channel: $extrachannel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtraCX comando enviado para Canal $channelligado$call_server_ip and \nHungup $extrachannelligado$server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channelligado$call_server_ip, Hungup $extrachannelligado$server_ip";} + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "Changed to Redirect: $channelligado$server_ip";} + } + + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDCXC|$filename|$user|$campaign|$DBout|\n"); + fclose($fp); + } + } + + } +} + +if ($ACTION=="RedirectXtra") +{ + if ($channel=="$extrachannel") + {$ACTION="Redirect";} + else + { + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "Uma dessas variáveis não é válido:\n"; + echo "Canal $channel Deve ser maior que 2 caracteres\n"; + echo "ExtraCanal $extrachannel Deve ser maior que 2 caracteres\n"; + echo "queryCID $queryCID Deve ser maior que 14 caracateres\n"; + echo "exten $exten Deve ser definido\n"; + echo "ext_context $ext_context Deve ser definido\n"; + echo "ext_priority $ext_priority Deve ser definido\n"; + echo "\nRedirect Action não enviado\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDX|$filename|$user|$campaign|$$channel|$extrachannel|$queryCID|$exten|$ext_context|ext_priority|\n"); + fclose($fp); + } + } + } + else + { + if ($exten == "NEXTAVAILABLE") + { + $stmt="SELECT conf_exten FROM conferences where server_ip='$server_ip' and ((extension='') or (extension is null)) limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if (strlen($row[0]) > 3) + { + $stmt="UPDATE conferences set extension='$user' where server_ip='$server_ip' and conf_exten='$row[0]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $exten = $row[0]; + } + else + { + $channel_liveX=0; + echo "Não foi possível achar uma conferência vazialigado$server_ip, Redirect comando não inserido\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "Não foi possível achar uma conferência vazialigado$server_ip";} + } + } + + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Canal $channel não está ativoligado$call_server_ip, Redirect comando não inserido\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel não está ativoligado$call_server_ip";} + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Canal $channel não está ativoligado$server_ip, Redirect comando não inserido\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel não está ativoligado$server_ip";} + } + } + if ( ($channel_liveX==1) && ($channel_liveY==1) ) + { + if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','ExtraChannel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra comando enviado para Canal $channel and \nExtraCanal $extrachannel\n to $extenligado$server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel and $extrachannel to $extenligado$server_ip";} + } + else + { + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$exten"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra comando enviado para Canal $channelligado$call_server_ip and \nExtraCanal $extrachannel\n to $extenligado$server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel/$call_server_ip and $extrachannel/$server_ip to $exten";} + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + + } + + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDX|$filename|$user|$campaign|$DBout|\n"); + fclose($fp); + } + } + + } + } +} + + +if ($ACTION=="Redirect") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Uma dessas variáveis não é válido:\n"; + echo "Canal $channel Deve ser maior que 2 caracteres\n"; + echo "queryCID $queryCID Deve ser maior que 14 caracateres\n"; + echo "exten $exten Deve ser definido\n"; + echo "ext_context $ext_context Deve ser definido\n"; + echo "ext_priority $ext_priority Deve ser definido\n"; + echo "\nRedirect Action não enviado\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Canal $channel não está ativoligado$server_ip, Redirect comando não inserido\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "Redirect comando enviado para Canal $channelligado$server_ip\n"; + } + } +} + + + +###################### +# ACTION=Monitor or Stop Monitor - insert Monitor/StopMonitor Manager statement to start recording on a channel +###################### +if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) +{ + if ($ACTION=="StopMonitor") + {$SQLfile = "";} + else + {$SQLfile = "File: $filename";} + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Canal $channel não é válido or queryCID $queryCID não é válido or filename: $filename não é válido, $ACTION comando não inserido\n"; + } + else + { + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Canal $channel não está ativoligado$server_ip, $ACTION comando não inserido\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','$ACTION','$queryCID','Channel: $channel','$SQLfile','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + if ($ACTION=="Monitor") + { + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + } + echo "$ACTION comando enviado para Canal $channelligado$server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n"; + } + } +} + + + + + + +###################### +# ACTION=MonitorConf or StopMonitorConf - insert Monitor/StopMonitor Manager statement to start recording on a conference +###################### +if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($channel)<4) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Canal $channel não é válido or exten $exten não é válido or filename: $filename não é válido, $ACTION comando não inserido\n"; + } + else + { + + if ($ACTION=="MonitorConf") + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$filename','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $filename','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + # find and hang up all recordings goingligadoin this conference # and extension = '$exten' + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$channel%\" and channel LIKE \"%,1\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + # $rec_count = intval(mysql_num_rows($rslt) / 2); + $rec_count = mysql_num_rows($rslt); + $h=0; + while ($rec_count>$h) + { + $rowx=mysql_fetch_row($rslt); + $HUchannel[$h] = $rowx[0]; + $h++; + } + $i=0; + while ($h>$i) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$i','Channel: $HUchannel[$i]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $i++; + } + + } + echo "$ACTION comando enviado para Canal $channelligado$server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n AS GRAVAÇÕES VÃO DURAR 60 MINUTOS\n"; + } +} + + + + + +###################### +# ACTION=VolumeControl - raise or lower the volume of a meetme participant +###################### +if ($ACTION=="VolumeControl") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($stage)<1) or (strlen($queryCID)<1) ) + { + echo "Conferencia $exten, Stage $stage não é válido or queryCID $queryCID não é válido, Originate comando não inserido\n"; + } + else + { + $participant_number='XXYYXXYYXXYYXX'; + if (eregi('UP',$stage)) {$vol_prefix='4';} + if (eregi('DOWN',$stage)) {$vol_prefix='3';} + if (eregi('UNMUTE',$stage)) {$vol_prefix='2';} + if (eregi('MUTING',$stage)) {$vol_prefix='1';} + $local_DEF = 'Local/'; + $local_AMP = '@'; + $volume_local_channel = "$local_DEF$participant_number$vol_prefix$exten$local_AMP$ext_context"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $volume_local_channel','Context: $ext_context','Exten: 8300','Priority: 1','Callerid: $queryCID','','','','$channel','$exten');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Volume comando enviado para Conferencia $exten, Stage $stage Canal $channelligado$server_ip\n"; + } +} + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='debug') {echo "\n";} +if ($format=='debug') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/park_calls_display.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/park_calls_display.php new file mode 100644 index 00000000..d9682d85 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/park_calls_display.php @@ -0,0 +1,146 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "\n"; +echo "\n"; +echo "\n"; +echo "Mostra as ligações em espera"; +echo "\n"; +echo "\n"; +echo "\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 * from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;"; + if ($format=='debug') {echo "\n";} + $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"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/vdc_db_query.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/vdc_db_query.php new file mode 100644 index 00000000..bea93986 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/vdc_db_query.php @@ -0,0 +1,2535 @@ + LICENSE: GPLv2 +# +# 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 - ('regCLOSER','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCALL','manDiaLlogCALL','userLOGout','updateDISPO','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs','CalLBacKLisT','CalLBacKCounT','PauseCodeSubmit','LogiNCamPaigns') +# - $stage - ('start','finish','lookup','new') +# - $closer_choice - ('CL_TESTCAMP_L CL_OUT123_L -') +# - $conf_exten - ('8600011',...) +# - $exten - ('123test',...) +# - $ext_context - ('default','demo',...) +# - $ext_priority - ('1','2',...) +# - $campaign - ('testcamp',...) +# - $dial_timeout - ('60','26',...) +# - $dial_prefix - ('9','8',...) +# - $campaign_cid - ('3125551212','0000000000',...) +# - $MDnextCID - ('M06301413000000002',...) +# - $uniqueid - ('1120232758.2406800',...) +# - $lead_id - ('36524',...) +# - $list_id - ('101','123456',...) +# - $length_in_sec - ('12',...) +# - $phone_code - ('1',...) +# - $phone_number - ('3125551212',...) +# - $channel - ('Zap/12-1',...) +# - $start_epoch - ('1120236911',...) +# - $vendor_lead_code - ('1234test',...) +# - $title - ('Mr.',...) +# - $first_name - ('Bob',...) +# - $middle_initial - ('L',...) +# - $last_name - ('Wilson',...) +# - $address1 - ('1324 Main St.',...) +# - $address2 - ('Apt. 12',...) +# - $address3 - ('co Robert Wilson',...) +# - $city - ('Chicago',...) +# - $state - ('IL',...) +# - $province - ('NA',...) +# - $postal_code - ('60054',...) +# - $country_code - ('USA',...) +# - $gender - ('M',...) +# - $date_of_birth - ('1970-01-01',...) +# - $alt_phone - ('3125551213',...) +# - $email - ('bob@bob.com',...) +# - $security_phrase - ('Hello',...) +# - $comments - ('Good Customer',...) +# - $auto_dial_level - ('0','1','1.2',...) +# - $VDstop_rec_after_each_call - ('0','1') +# - $conf_silent_prefix - ('7','8','',...) +# - $extension - ('123','user123','25-1',...) +# - $protocol - ('Zap','SIP','IAX2',...) +# - $user_abb - ('1234','6666',...) +# - $preview - ('YES','NO',...) +# - $called_count - ('0','1','2',...) +# - $agent_log_id - ('123456',...) +# - $agent_log - ('NO',...) +# - $favorites_list - (",'cc160','cc100'",...) +# - $CallBackDatETimE - ('2006-04-21 14:30:00',...) +# - $recipient - ('ANYONE,'USERONLY') +# - $callback_id - ('12345','12346',...) +# - $use_internal_dnc - ('Y','N') +# - $omit_phone_code - ('Y','N') +# - $no_delete_sessions - ('0','1') + +# CHANGELOG: +# 50629-1044 - First build of script +# 50630-1422 - Added manual dial action and MD channel lookup +# 50701-1451 - Added dial log for start and end of vicidial calls +# 50705-1239 - Added call disposition update +# 50804-1627 - Fixed updateDispo to update vicidial_log entry +# 50816-1605 - Added VDADpause/ready for auto dialing +# 50816-1811 - Added basic autodial call pickup functions +# 50817-1005 - Altered logging functions to accomodate auto_dialing +# 50818-1305 - Added stop-all-recordings-after-each-vicidial-call option +# 50818-1411 - Added hangup of agent phone after Logout +# 50901-1315 - Fixed CLOSER IN-GROUP Web Form bug +# 50902-1507 - Fixed CLOSER log length_in_sec bug +# 50902-1730 - Added functions for manual preview dialing and revert +# 50913-1214 - Added agent random update to leadupdate +# 51020-1421 - Added agent_log_id framework for detailed agent activity logging +# 51021-1717 - Allows for multi-line comments (changes \n to !N in database) +# 51111-1046 - Added vicidial_agent_log lead_id earlier for manual dial +# 51121-1445 - Altered echo statements for several small PHP speed optimizations +# 51122-1328 - Fixed UserLogout issue not removing conference reservation +# 51129-1012 - Added ability to accept calls from other VICIDIAL servers +# 51129-1729 - Changed manual dial to use the '/n' flag for calls +# 51221-1154 - Added SCRIPT id lookup and sending to vicidial.php for display +# 60105-1059 - Added Updating of astguiclient favorites in the DB +# 60208-1617 - Added dtmf buttons output per call +# 60213-1521 - Added closer_campaigns update to vicidial_users +# 60215-1036 - Added Callback date-time entry into vicidial_callbacks table +# 60413-1541 - Added USERONLY Callback listings output - CalLBacKLisT +# - Added USERONLY Callback count output - CalLBacKCounT +# 60414-1140 - Added Callback lead lookup for manual dialing +# 60419-1517 - After CALLBK is sent to agent, update callback record to INACTIVE +# 60421-1419 - Check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60427-1236 - Fixed closer_choice error for CLOSER campaigns +# 60609-1148 - Added ability to check for manual dial numbers in DNC +# 60619-1117 - Added variable filters to close security holes for login form +# 60623-1414 - Fixed variable filter for phone_code and fixed manual dial logic +# 60821-1600 - Added ability to omit the phone code on vicidial lead dialing +# 60821-1647 - Added ability to not delete sessions at logout +# 60906-1124 - Added lookup and sending of callback data for CALLBK calls +# 61128-2229 - Added vicidial_live_agents and vicidial_auto_calls manual dial entries +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70115-1733 - Added alt_dial functionality in auto-dial modes +# 70118-1501 - Added user_group to vicidial_log,_agent_log,_closer_log,_callbacks +# 70123-1357 - Fixed bug that would not update vicidial_closer_log status to dispo +# 70202-1438 - Added pause code submit function +# 70203-0930 - Added dialed_number to lead info output +# 70203-1030 - Added dialed_label to lead info output +# 70206-1126 - Added INBOUND status for inbound/closer calls in vicidial_live_agents +# 70212-1253 - Fixed small issue with CXFER +# 70213-1431 - Added QueueMetrics PAUSE/UNPAUSE/AGENTLOGIN/AGENTLOGOFF actions +# 70214-1231 - Added queuemetrics_log_id field for server_id in queue_log +# 70215-1210 - Added queuemetrics COMPLETEAGENT action +# 70216-1051 - Fixed double call complete queuemetrics logging +# 70222-1616 - Changed queue_log PAUSE/UNPAUSE to PAUSEALL/UNPAUSEALL +# 70309-1034 - Allow amphersands and questions marks in comments to pass through +# 70313-1052 - Allow pound signs(hash) in comments to pass through +# 70319-1544 - Added agent disable update customer data function +# 70322-1545 - Added sipsak display ability +# 70413-1253 - Fixed bug for outbound call time in CLOSER-type blended campaigns +# 70424-1100 - Fixed bug for fronter/closer calls that would delete vdac records +# 70802-1729 - Fixed bugs with pause_sec and wait_sec under certain call handling +# 70828-1443 - Added source_id to output of SCRIPTtab-IFRAME and WEBFORM +# 71029-1855 - removed campaign_id naming restrictions for CLOSER-type campaigns +# 71030-2047 - added hopper priority for auto alt dial entries +# 71116-1011 - added calls_today count updating of the vicidial_live_agents upon INCALL +# 71120-1520 - added LogiNCamPaigns to show only allowed campaigns for agents upon login +# 71125-1751 - Added inbound-group default inbound group sending to vicidial.php +# 71129-2025 - restricted callbacks count and list to campaign only +# + +$version = '2.0.4-65'; +$build = '71129-2025'; + +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["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["closer_choice"])) {$closer_choice=$_GET["closer_choice"];} + elseif (isset($_POST["closer_choice"])) {$closer_choice=$_POST["closer_choice"];} +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["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["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["dial_timeout"])) {$dial_timeout=$_GET["dial_timeout"];} + elseif (isset($_POST["dial_timeout"])) {$dial_timeout=$_POST["dial_timeout"];} +if (isset($_GET["dial_prefix"])) {$dial_prefix=$_GET["dial_prefix"];} + elseif (isset($_POST["dial_prefix"])) {$dial_prefix=$_POST["dial_prefix"];} +if (isset($_GET["campaign_cid"])) {$campaign_cid=$_GET["campaign_cid"];} + elseif (isset($_POST["campaign_cid"])) {$campaign_cid=$_POST["campaign_cid"];} +if (isset($_GET["MDnextCID"])) {$MDnextCID=$_GET["MDnextCID"];} + elseif (isset($_POST["MDnextCID"])) {$MDnextCID=$_POST["MDnextCID"];} +if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} + elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["length_in_sec"])) {$length_in_sec=$_GET["length_in_sec"];} + elseif (isset($_POST["length_in_sec"])) {$length_in_sec=$_POST["length_in_sec"];} +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["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["start_epoch"])) {$start_epoch=$_GET["start_epoch"];} + elseif (isset($_POST["start_epoch"])) {$start_epoch=$_POST["start_epoch"];} +if (isset($_GET["dispo_choice"])) {$dispo_choice=$_GET["dispo_choice"];} + elseif (isset($_POST["dispo_choice"])) {$dispo_choice=$_POST["dispo_choice"];} +if (isset($_GET["vendor_lead_code"])) {$vendor_lead_code=$_GET["vendor_lead_code"];} + elseif (isset($_POST["vendor_lead_code"])) {$vendor_lead_code=$_POST["vendor_lead_code"];} +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["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["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_GET["VDstop_rec_after_each_call"];} + elseif (isset($_POST["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_POST["VDstop_rec_after_each_call"];} +if (isset($_GET["conf_silent_prefix"])) {$conf_silent_prefix=$_GET["conf_silent_prefix"];} + elseif (isset($_POST["conf_silent_prefix"])) {$conf_silent_prefix=$_POST["conf_silent_prefix"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} +if (isset($_GET["user_abb"])) {$user_abb=$_GET["user_abb"];} + elseif (isset($_POST["user_abb"])) {$user_abb=$_POST["user_abb"];} +if (isset($_GET["preview"])) {$preview=$_GET["preview"];} + elseif (isset($_POST["preview"])) {$preview=$_POST["preview"];} +if (isset($_GET["called_count"])) {$called_count=$_GET["called_count"];} + elseif (isset($_POST["called_count"])) {$called_count=$_POST["called_count"];} +if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];} + elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];} +if (isset($_GET["agent_log"])) {$agent_log=$_GET["agent_log"];} + elseif (isset($_POST["agent_log"])) {$agent_log=$_POST["agent_log"];} +if (isset($_GET["favorites_list"])) {$favorites_list=$_GET["favorites_list"];} + elseif (isset($_POST["favorites_list"])) {$favorites_list=$_POST["favorites_list"];} +if (isset($_GET["CallBackDatETimE"])) {$CallBackDatETimE=$_GET["CallBackDatETimE"];} + elseif (isset($_POST["CallBackDatETimE"])) {$CallBackDatETimE=$_POST["CallBackDatETimE"];} +if (isset($_GET["recipient"])) {$recipient=$_GET["recipient"];} + elseif (isset($_POST["recipient"])) {$recipient=$_POST["recipient"];} +if (isset($_GET["callback_id"])) {$callback_id=$_GET["callback_id"];} + elseif (isset($_POST["callback_id"])) {$callback_id=$_POST["callback_id"];} +if (isset($_GET["use_internal_dnc"])) {$use_internal_dnc=$_GET["use_internal_dnc"];} + elseif (isset($_POST["use_internal_dnc"])) {$use_internal_dnc=$_POST["use_internal_dnc"];} +if (isset($_GET["omit_phone_code"])) {$omit_phone_code=$_GET["omit_phone_code"];} + elseif (isset($_POST["omit_phone_code"])) {$omit_phone_code=$_POST["omit_phone_code"];} +if (isset($_GET["phone_ip"])) {$phone_ip=$_GET["phone_ip"];} + elseif (isset($_POST["phone_ip"])) {$phone_ip=$_POST["phone_ip"];} +if (isset($_GET["enable_sipsak_messages"])) {$enable_sipsak_messages=$_GET["enable_sipsak_messages"];} + elseif (isset($_POST["enable_sipsak_messages"])) {$enable_sipsak_messages=$_POST["enable_sipsak_messages"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} + + +$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); + + +# default optional vars if not set +if (!isset($format)) {$format="text";} + if ($format == 'debug') {$DB=1;} +if (!isset($ACTION)) {$ACTION="refresh";} + +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$CIDdate = date("mdHis"); +$ENTRYdate = date("YmdHis"); +if (!isset($query_date)) {$query_date = $NOW_DATE;} +$MT[0]=''; +$agents='@agents'; + +if ($ACTION == 'LogiNCamPaigns') + { + $skip_user_validation=1; + } +else + { + $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 "\n"; +echo "\n"; +echo "\n"; +echo "VICIDiaL Script de consulta ao banco de dados"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + +################################################################################ +### LogiNCamPaigns - generates an HTML SELECT list of allowed campaigns for a +### specific agent on the login screen +################################################################################ +if ($ACTION == 'LogiNCamPaigns') +{ + if ( (strlen($user)<1) ) + { + echo "\n"; + exit; + } + else + { + echo "\n"; + exit; + } +} + + + +################################################################################ +### regCLOSER - update the vicidial_live_agents table to reflect the closer +### inbound choices made upon login +################################################################################ +if ($ACTION == 'regCLOSER') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($closer_choice)<1) || (strlen($user)<1) ) + { + $channel_live=0; + echo "Escolha do Grupo $closer_choice não é válido\n"; + exit; + } + else + { + if ($closer_choice == "MGRLOCK-") + { + $stmt="SELECT closer_campaigns FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $closer_choice =$row[0]; + + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_users set closer_campaigns='$closer_choice' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $in_groups_pre = preg_replace('/-$/','',$closer_choice); + $in_groups = explode(" ",$in_groups_pre); + $in_groups_ct = count($in_groups); + $k=1; + while ($k < $in_groups_ct) + { + if (strlen($in_groups[$k])>1) + { + $stmt="SELECT group_weight,calls_today FROM vicidial_inbound_group_agents where user='$user' and group_id='$in_groups[$k]';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $viga_ct = mysql_num_rows($rslt); + if ($viga_ct > 0) + { + $row=mysql_fetch_row($rslt); + $group_weight = $row[0]; + $calls_today = $row[1]; + } + else + { + $group_weight = 0; + $calls_today = 0; + } + $stmt="INSERT INTO vicidial_live_inbound_agents set user='$user',group_id='$in_groups[$k]',group_weight='$group_weight',calls_today='$calls_today',last_call_time='$NOW_TIME',last_call_finish='$NOW_TIME';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + $k++; + } + + } + echo "Closer In Escolha do Grupo $closer_choice foi registrado para o usuário $user\n"; +} + + +################################################################################ +### manDiaLnextCALL - for manual VICIDiaL dialing this will grab the next lead +### in the campaign, reserve it, send data back to client and +### place the call by inserting into vicidial_manager +################################################################################ +if ($ACTION == 'manDiaLnextCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "LISTA DE DISCAGEM VAZIA\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context não é válido\n"; + exit; + } + else + { + + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### check if this is a callback, if it is, skip the grabbing of a new lead and mark the callback as INACTIVE + if ( (strlen($callback_id)>0) and (strlen($lead_id)>0) ) + { + $affected_rows=1; + $CBleadIDset=1; + + $stmt = "UPDATE vicidial_callbacks set status='INACTIVE' where callback_id='$callback_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + if (strlen($phone_number)>3) + { + if ($use_internal_dnc=='Y') + { + $stmt="SELECT count(*) FROM vicidial_dnc where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + echo "DNC NUMERO\n"; + exit; + } + } + if ($stage=='lookup') + { + $stmt="SELECT lead_id FROM vicidial_list where phone_number='$phone_number' order by modify_date desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $man_leadID_ct = mysql_num_rows($rslt); + if ($man_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $affected_rows=1; + $lead_id =$row[0]; + $CBleadIDset=1; + } + else + { + ### insert a new lead in the system with this phone number + $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $lead_id = mysql_insert_id($link); + $CBleadIDset=1; + } + } + else + { + ### insert a new lead in the system with this phone number + $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $lead_id = mysql_insert_id($link); + $CBleadIDset=1; + } + } + else + { + ### grab the next lead in the hopper for this campaign and reserve it for the user + $stmt = "UPDATE vicidial_hopper set status='QUEUE', user='$user' where campaign_id='$campaign' and status='READY' order by hopper_id LIMIT 1"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + } + } + + if ($affected_rows > 0) + { + if (!$CBleadIDset) + { + ##### grab the lead_id of the reserved user in vicidial_hopper + $stmt="SELECT lead_id FROM vicidial_hopper where campaign_id='$campaign' and status='QUEUE' and user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $hopper_leadID_ct = mysql_num_rows($rslt); + if ($hopper_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + } + } + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $source_id = trim("$row[6]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + $called_count++; + + ##### check if system is set to generate logfile for transfers + $stmt="SELECT enable_agc_xfer_log FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enable_agc_xfer_log_ct = mysql_num_rows($rslt); + if ($enable_agc_xfer_log_ct > 0) + { + $row=mysql_fetch_row($rslt); + $enable_agc_xfer_log =$row[0]; + } + + if ( ($WeBRooTWritablE > 0) and ($enable_agc_xfer_log > 0) ) + { + # DATETIME|campaign|lead_id|phone_number|user|type + # 2007-08-22 11:11:11|TESTCAMP|65432|3125551212|1234|M + $fp = fopen ("./xfer_log.txt", "a"); + fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$phone_number|$user|M\n"); + fclose($fp); + } + + ##### if lead is a callback, grab the callback comments + $CBentry_time = ''; + $CBcallback_time = ''; + $CBuser = ''; + $CBcomments = ''; + if (ereg("CALLBK",$dispo)) + { + $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBentry_time = trim("$row[0]"); + $CBcallback_time = trim("$row[1]"); + $CBuser = trim("$row[2]"); + $CBcomments = trim("$row[3]"); + } + } + + ### flag the lead as called and change it's status to INCALL + $stmt = "UPDATE vicidial_list set status='INCALL', called_since_last_reset='Y', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + if (!$CBleadIDset) + { + ### delete the lead from the hopper + $stmt = "DELETE FROM vicidial_hopper where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $stmt="UPDATE vicidial_agent_log set lead_id='$lead_id',comments='MANUAL' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + ### if preview dialing, do not send the call + if ( (strlen($preview)<1) || ($preview == 'NO') ) + { + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### whether to omit phone_code or not + if (eregi('Y',$omit_phone_code)) + {$Ndialstring = "$Local_out_prefix$phone_number";} + else + {$Ndialstring = "$Local_out_prefix$phone_code$phone_number";} + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$server_ip','$campaign','XFER','$lead_id','$MqueryCID','$phone_code','$phone_number','$NOW_TIME','OUT')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',callerid='$MqueryCID',lead_id='$lead_id',comments='MANUAL',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update calls_today count in vicidial_campaign_agents + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $MqueryCID . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + $LeaD_InfO .= $CBentry_time . "\n"; + $LeaD_InfO .= $CBcallback_time . "\n"; + $LeaD_InfO .= $CBuser . "\n"; + $LeaD_InfO .= $CBcomments . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= "MAIN\n"; + $LeaD_InfO .= $source_id . "\n"; + + echo $LeaD_InfO; + + } + else + { + echo "LISTA DE DISCAGEM VAZIA\n"; + } + } +} + + +################################################################################ +### manDiaLskip - for manual VICIDiaL dialing this skips the lead that was +### previewed in the step above and puts it back in orig status +################################################################################ +if ($ACTION == 'manDiaLskip') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($stage)<1) || (strlen($called_count)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "LEAD NOT REVERTED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context não é válido\n"; + exit; + } + else + { + $called_count = ($called_count - 1); + ### flag the lead as called and change it's status to INCALL + $stmt = "UPDATE vicidial_list set status='$stage', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + + echo "LEAD REVERTED\n"; + } +} + + +################################################################################ +### manDiaLonly - for manual VICIDiaL dialing this sends the call that was +### previewed in the step above +################################################################################ +if ($ACTION == 'manDiaLonly') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) || (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo " CHAMADA NOT PLACED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context não é válido\n"; + exit; + } + else + { + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### whether to omit phone_code or not + if (eregi('Y',$omit_phone_code)) + {$Ndialstring = "$Local_out_prefix$phone_number";} + else + {$Ndialstring = "$Local_out_prefix$phone_code$phone_number";} + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$server_ip','$campaign','XFER','$lead_id','$MqueryCID','$phone_code','$phone_number','$NOW_TIME','OUT')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',callerid='$MqueryCID',lead_id='$lead_id',comments='MANUAL',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + echo "$MqueryCID\n"; + } +} + + +################################################################################ +### manDiaLlookCALL - for manual VICIDiaL dialing this will attempt to look up +### the trunk channel that the call was placed on +################################################################################ +if ($ACTION == 'manDiaLlookCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; +if (strlen($MDnextCID)<18) + { + echo "NO\n"; + echo "MDnextCID $MDnextCID não é válido\n"; + exit; + } +else + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT uniqueid,channel FROM vicidial_manager where callerid='$MDnextCID' and server_ip='$server_ip' and status='UPDATED' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $uniqueid =$row[0]; + $channel =$row[1]; + echo "$uniqueid\n$channel"; + + $wait_sec=0; + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',wait_epoch='$StarTtime',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + echo "NO\n"; + } + } +} + + + +################################################################################ +### manDiaLlogCALL - for manual VICIDiaL logging of calls places record in +### vicidial_log and then sends process to call_log entry +################################################################################ +if ($ACTION == 'manDiaLlogCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + +if ($stage == "start") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) || (strlen($list_id)<1) || (strlen($phone_number)<1) || (strlen($campaign)<1) ) + { + echo "REGISTRO NÃO DEFINIDO\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id or list_id: $list_id or phone_number: $phone_number or campaign: $campaign não é válido\n"; + exit; + } + else + { + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + ##### insert log into vicidial_log for manual VICIDiaL call + $stmt="INSERT INTO vicidial_log (uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,comments,processed,user_group) values('$uniqueid','$lead_id','$list_id','$campaign','$NOW_TIME','$StarTtime','INCALL','$phone_code','$phone_number','$user','MANUAL','N','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "VICIDiaL_LOG Inserido: $uniqueid|$channel|$NOW_TIME\n"; + echo "$StarTtime\n"; + } + else + { + echo "REGISTRO NÃO DEFINIDO\n"; + } + + $stmt = "UPDATE vicidial_auto_calls SET uniqueid='$uniqueid' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + # ##### insert log into call_log for manual VICIDiaL call + # $stmt = "INSERT INTO call_log (uniqueid,channel,server_ip,extension,number_dialed,caller_code,start_time,start_epoch) values('$uniqueid','$channel','$server_ip','$exten','$phone_code$phone_number','MD $user $lead_id','$NOW_TIME','$StarTtime')"; + # if ($DB) {echo "$stmt\n";} + # $rslt=mysql_query($stmt, $link); + # $affected_rows = mysql_affected_rows($link); + + # if ($affected_rows > 0) + # { + # echo "CALL_LOG Inserido: $uniqueid|$channel|$NOW_TIME"; + # } + # else + # { + # echo "REGISTRO NÃO DEFINIDO\n"; + # } + } + } + +if ($stage == "end") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) ) + { + echo "REGISTRO NÃO DEFINIDO\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id não é válido\n"; + exit; + } + else + { + if ($start_epoch < 1000) + { + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + ##### look for the start epoch in the vicidial_closer_log table + $stmt="SELECT start_epoch FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user' order by closecallid desc limit 1;"; + } + else + { + ##### look for the start epoch in the vicidial_log table + $stmt="SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + } + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch =$row[0]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($length_in_sec < 1) and ($row[0] > 0) ) + { + ##### start epoch in the vicidial_log table, couldn't find one in vicidial_closer_log + $stmt="SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch =$row[0]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + } + } + else {$length_in_sec = ($StarTtime - $start_epoch);} + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec',status='DONE' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + ############################################# + ##### INICIAR QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + + if ($auto_dial_level > 0) + { + ### check to see if campaign has alt_dial enabled + $stmt="SELECT auto_alt_dial FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_alt_dial =$row[0]; + } + else {$auto_alt_dial = 'NONE';} + if (eregi("(ALT_ONLY|ADDR3_ONLY|ALT_AND_ADDR3)",$auto_alt_dial)) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT alt_dial FROM vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alt_dial =$row[0]; + } + else {$alt_dial = 'NONE';} + + if ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("(ALT_ONLY|ALT_AND_ADDR3)",$auto_alt_dial)) ) + { + $stmt="SELECT alt_phone,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alt_phone = $row[0]; + $alt_phone = eregi_replace("[^0-9]","",$alt_phone); + $gmt_offset_now = $row[1]; + $state = $row[2]; + } + else {$alt_phone = '';} + if (strlen($alt_phone)>5) + { + ### insert record into vicidial_hopper for alt_phone call attempt + $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ALT',user='',priority='25';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + } + if ( ( (eregi("(ALT)",$alt_dial)) and (eregi("ALT_AND_ADDR3",$auto_alt_dial)) ) or ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("ADDR3_ONLY",$auto_alt_dial)) ) ) + { + $stmt="SELECT address3,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $address3 = $row[0]; + $address3 = eregi_replace("[^0-9]","",$address3); + $gmt_offset_now = $row[1]; + $state = $row[2]; + } + else {$address3 = '';} + if (strlen($address3)>5) + { + ### insert record into vicidial_hopper for address3 call attempt + $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ADDR3',user='',priority='20';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + + if ($enable_queuemetrics_logging > 0) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_qm_ct = mysql_num_rows($rslt); + if ($VAC_qm_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_call_id = $row[0]; + $CLlead_id = $row[1]; + $CLphone_number = $row[2]; + $CLstatus = $row[3]; + $CLcampaign_id = $row[4]; + $CLphone_code = $row[5]; + $CLalt_dial = $row[6]; + $CLstage = $row[7]; + $CLcallerid = $row[8]; + $CLuniqueid = $row[9]; + } + + $CLstage = preg_replace("/.*-/",'',$CLstage); + if (strlen($CLstage) < 1) {$CLstage=0;} + + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt="SELECT count(*) from queue_log where call_id='$MDnextCID' and verb='COMPLETECALLER';"; + $rslt=mysql_query($stmt, $linkB); + if ($DB) {echo "$stmt\n";} + $VAC_cc_ct = mysql_num_rows($rslt); + if ($VAC_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $caller_complete = $row[0]; + } + + if ($caller_complete < 1) + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + } + mysql_close($linkB); + } + + ### delete call record from vicidial_auto_calls + $stmt = "DELETE from vicidial_auto_calls where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + + + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',lead_id='',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSARALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } + else + { + if ($enable_queuemetrics_logging > 0) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_qm_ct = mysql_num_rows($rslt); + if ($VAC_qm_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_call_id = $row[0]; + $CLlead_id = $row[1]; + $CLphone_number = $row[2]; + $CLstatus = $row[3]; + $CLcampaign_id = $row[4]; + $CLphone_code = $row[5]; + $CLalt_dial = $row[6]; + $CLstage = $row[7]; + $CLcallerid = $row[8]; + $CLuniqueid = $row[9]; + } + + $CLstage = preg_replace("/XFER|-/",'',$CLstage); + if ($CLstage < 0.25) {$CLstage=0;} + + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + + $stmt = "DELETE from vicidial_auto_calls lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',lead_id='',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSARALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } + + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' where uniqueid='$uniqueid' and lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "$uniqueid\n$channel\n"; + } + else + { + echo "REGISTRO NÃO DEFINIDO\n\n"; + } + } + + echo $VDstop_rec_after_each_call . '|' . $extension . '|' . $conf_silent_prefix . '|' . $conf_exten . '|' . $user_abb . "|\n"; + + ##### if VICIDiaL call and hangup_after_each_call activated, find all recording + ##### channels and hang them up while entering info into recording_log and + ##### returning filename/recordingID + if ($VDstop_rec_after_each_call == 1) + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $total_rec=0; + $loop_count=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten' order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$rec_list = mysql_num_rows($rslt);} + while ($rec_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + if (preg_match("/Local\/$conf_silent_prefix$conf_exten\@/i",$row[0])) + { + $rec_channels[$total_rec] = "$row[0]"; + $total_rec++; + } + if ($format=='debug') {echo "\n";} + $loop_count++; + } + + $total_recFN=0; + $loop_count=0; + $filename=$MT; # not necessary : and cmd_line_f LIKE \"%_$user_abb\" + $stmt="SELECT cmd_line_f FROM vicidial_manager where server_ip='$server_ip' and action='Originate' and cmd_line_b = 'Channel: $local_DEF$conf_silent_prefix$conf_exten$local_AMP$ext_context' order by entry_date desc limit $total_rec;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$recFN_list = mysql_num_rows($rslt);} + while ($recFN_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + $filename[$total_recFN] = preg_replace("/Callerid: /i","",$row[0]); + if ($format=='debug') {echo "\n";} + $total_recFN++; + $loop_count++; + } + + $loop_count=0; + while($loop_count < $total_rec) + { + if (strlen($rec_channels[$loop_count])>5) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$loop_count','Channel: $rec_channels[$loop_count]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "REC_STOP|$rec_channels[$loop_count]|$filename[$loop_count]|"; + if (strlen($filename)>2) + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename[$loop_count]'"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$fn_count = mysql_num_rows($rslt);} + if ($fn_count) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt="UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename[$loop_count]' and end_epoch is NULL;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "$recording_id|$length_in_min|"; + } + else {echo "||";} + } + else {echo "||";} + echo "\n"; + } + $loop_count++; + } + } + + + $talk_sec=0; + $StarTtime = date("U"); + $stmt = "select talk_epoch,talk_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $talk_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set talk_sec='$talk_sec',talk_epoch='$StarTtime',dispo_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } +} + + +################################################################################ +### VDADREcheckINCOMING - for auto-dial VICIDiaL dialing this will recheck for +### calls to see if the channel has updated +################################################################################ +if ($ACTION == 'VDADREcheckINCOMING') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "Campanha $campaign não é válido\n"; + echo "lead_id $lead_id não é válido\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + } + } +} + + +################################################################################ +### VDADcheckINCOMING - for auto-dial VICIDiaL dialing this will check for calls +### in the vicidial_live_agents table in QUEUE status, then +### lookup the lead info and pass it back to vicidial.php +################################################################################ +if ($ACTION == 'VDADcheckINCOMING') +{ + $Ctype = 'A'; + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "Campanha $campaign não é válido\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and status='QUEUE';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',comments='AUTO',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $source_id = trim("$row[6]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + ##### if lead is a callback, grab the callback comments + $CBentry_time = ''; + $CBcallback_time = ''; + $CBuser = ''; + $CBcomments = ''; + if (ereg("CALLBK",$dispo)) + { + $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBentry_time = trim("$row[0]"); + $CBcallback_time = trim("$row[1]"); + $CBuser = trim("$row[2]"); + $CBcomments = trim("$row[3]"); + } + } + + ### update the lead status to INCALL + $stmt = "UPDATE vicidial_list set status='INCALL', user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the log status to INCALL + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + $stmt = "UPDATE vicidial_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL', user_group='$user_group' where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + ### update the vicidial_closer_log user to INCALL + $stmt = "UPDATE vicidial_closer_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL', user_group='$user_group' where lead_id='$lead_id' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select campaign_id,phone_number,alt_dial from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($VDAC_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDADchannel_group =$row[0]; + $dialed_number =$row[1]; + $dialed_label =$row[2]; + } + else + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|INBND|$callerid|$user|$user_group|$list_id|$lead_id|$phone_number|$uniqueid|\n"); + fclose($fp); + } + } + + $stmt = "select count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDL_cid_ct = mysql_num_rows($rslt); + if ($VDL_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_front_VDlog =$row[0]; + } + + $stmt = "select * from vicidial_inbound_groups where group_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_group_name = $row[1]; + $VDCL_group_color = $row[2]; + $VDCL_group_web = $row[4]; + $VDCL_fronter_display = $row[7]; + $VDCL_ingroup_script = $row[8]; + $VDCL_get_call_launch = $row[9]; + $VDCL_xferconf_a_dtmf = $row[10]; + $VDCL_xferconf_a_number = $row[11]; + $VDCL_xferconf_b_dtmf = $row[12]; + $VDCL_xferconf_b_number = $row[13]; + $VDCL_default_xfer_group= $row[28]; + + ### update the comments in vicidial_live_agents record + $stmt = "UPDATE vicidial_live_agents set comments='INBOUND' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $Ctype = 'I'; + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_ingroup_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + } + + ### if web form is set then sendligadoto vicidial.php for override of WEB_FORM address + if ( (strlen($VDCL_group_web)>5) or (strlen($VDCL_group_name)>0) ) {echo "$VDCL_group_web|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|\n";} + else {echo "|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|\n";} + + $stmt = "SELECT full_name from vicidial_users where user='$tsr';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDU_cid_ct = mysql_num_rows($rslt); + if ($VDU_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $fronter_full_name = $row[0]; + echo $fronter_full_name . '|' . $tsr . "\n"; + } + else {echo '|' . $tsr . "\n";} + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_campaign_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + echo "|||||$VDCL_campaign_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n|\n"; + + $stmt = "select phone_number,alt_dial from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($VDAC_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dialed_number =$row[0]; + $dialed_label =$row[1]; + } + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $callerid . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + $LeaD_InfO .= $CBentry_time . "\n"; + $LeaD_InfO .= $CBcallback_time . "\n"; + $LeaD_InfO .= $CBuser . "\n"; + $LeaD_InfO .= $CBcomments . "\n"; + $LeaD_InfO .= $dialed_number . "\n"; + $LeaD_InfO .= $dialed_label . "\n"; + $LeaD_InfO .= $source_id . "\n"; + + echo $LeaD_InfO; + + + + $wait_sec=0; + $StarTtime = date("U"); + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + ### If CHAMADABK, change vicidial_callback record to INACTIVE + if (eregi("CALLBK|CBHOLD", $dispo)) + { + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='$lead_id' and status NOT IN('INACTIVE','DEAD','ARCHIVE');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + ##### check if system is set to generate logfile for transfers + $stmt="SELECT enable_agc_xfer_log FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enable_agc_xfer_log_ct = mysql_num_rows($rslt); + if ($enable_agc_xfer_log_ct > 0) + { + $row=mysql_fetch_row($rslt); + $enable_agc_xfer_log =$row[0]; + } + + if ( ($WeBRooTWritablE > 0) and ($enable_agc_xfer_log > 0) ) + { + # DATETIME|campaign|lead_id|phone_number|user|type + # 2007-08-22 11:11:11|TESTCAMP|65432|3125551212|1234|A + $fp = fopen ("./xfer_log.txt", "a"); + fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$phone_number|$user|$Ctype\n"); + fclose($fp); + } + + } + else + { + echo "0\n"; + # echo "No calls in QUEUE for $userligado$server_ip\n"; + exit; + } + } +} + + +################################################################################ +### userLOGout - Logs the user out of VICIDiaL client, deleting db records and +### inserting into vicidial_user_log +################################################################################ +if ($ACTION == 'userLOGout') +{ + $MT[0]=''; + $row=''; $rowx=''; +if ( (strlen($campaign)<1) || (strlen($conf_exten)<1) ) + { + echo "NO\n"; + echo "campaign $campaign or conf_exten $conf_exten não é válido\n"; + exit; + } +else + { + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + ##### Insert a SAIR record into the user log + $stmt="INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$user','SAIR','$campaign','$NOW_TIME','$StarTtime','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vul_insert = mysql_affected_rows($link); + + if ($no_delete_sessions < 1) + { + ##### Remove the reservationligadothe vicidial_conferences meetme room + $stmt="UPDATE vicidial_conferences set extension='' where server_ip='$server_ip' and conf_exten='$conf_exten';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vc_remove = mysql_affected_rows($link); + } + + ##### Delete the vicidial_live_agents record for this session + $stmt="DELETE from vicidial_live_agents where server_ip='$server_ip' and user ='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vla_delete = mysql_affected_rows($link); + + ##### Delete the vicidial_live_inbound_agents records for this session + $stmt="DELETE from vicidial_live_inbound_agents where user ='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vlia_delete = mysql_affected_rows($link); + + ##### Delete the web_client_sessions + $stmt="DELETE from web_client_sessions where server_ip='$server_ip' and session_name ='$session_name';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $wcs_delete = mysql_affected_rows($link); + + ##### Hangup the client phone + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$extension%\" order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) + { + $row=mysql_fetch_row($rslt); + $agent_channel = "$row[0]"; + if ($format=='debug') {echo "\n";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','ULGH3459$StarTtime','Channel: $agent_channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $pause_sec=0; + $stmt = "select pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ( ($VDpr_ct > 0) and (strlen($row[3]<5)) and (strlen($row[4]<5)) ) + { + $row=mysql_fetch_row($rslt); + $pause_sec = (($StarTtime - $row[0]) + $row[1]); + + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + if ($vla_delete > 0) + { + ############################################# + ##### INICIAR QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $allow_sipsak_messages = $row[6]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_message = 'LOGGED OUT'; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_message\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + } + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + # $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='PAUSAR',serverid='1';"; + # if ($DB) {echo "$stmt\n";} + # if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + # $rslt=mysql_query($stmt, $linkB); + # $affected_rows = mysql_affected_rows($linkB); + + $stmt = "SELECT time_id FROM queue_log where agent='Agent/$user' and verb='AGENTLOGIN' order by time_id desc limit 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + if ($DB) {echo "$stmt\n";} + echo "$stmt\n"; + $li_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $li_conf_ct) + { + $row=mysql_fetch_row($rslt); + $logintime = $row[0]; + $i++; + } + + $time_logged_in = ($StarTtime - $logintime); + if ($time_logged_in > 1000000) {$time_logged_in=1;} + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='AGENTLOGOFF',data1='$user$agents',data2='$time_logged_in',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + + echo "$vul_insert|$vc_remove|$vla_delete|$wcs_delete|$agent_channel|$vlia_delete\n"; + } +} + + +################################################################################ +### updateDISPO - update the vicidial_list table to reflect the agent choice of +### call disposition for that leand +################################################################################ +if ($ACTION == 'updateDISPO') +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($dispo_choice)<1) || (strlen($lead_id)<1) ) + { + echo "Dispo Choice $dispo or lead_id $lead_id não é válido\n"; + exit; + } + else + { + $stmt="UPDATE vicidial_list set status='$dispo_choice', user='$user' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by uniqueid desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + if ( ($use_internal_dnc=='Y') and ($dispo_choice=='DNC') ) + { + $stmt = "select phone_number from vicidial_list where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $stmt="INSERT INTO vicidial_dnc (phone_number) values('$row[0]');"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + } + } + + $dispo_sec=0; + $StarTtime = date("U"); + $stmt = "select dispo_epoch,dispo_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dispo_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set dispo_sec='$dispo_sec',dispo_epoch='$StarTtime',status='$dispo_choice' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id($link); + + ### CHAMADABACK ENTRY + if ( ($dispo_choice == 'CBHOLD') and (strlen($CallBackDatETimE)>10) ) + { + $stmt="INSERT INTO vicidial_callbacks (lead_id,list_id,campaign_id,status,entry_time,callback_time,user,recipient,comments,user_group) values('$lead_id','$list_id','$campaign','ACTIVE','$NOW_TIME','$CallBackDatETimE','$user','$recipient','$comments','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $stmt="SELECT auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ( ($auto_dial_level > 0) and (ereg(" $dispo_choice ",$row[0])) ) + { + $stmt = "select count(*) from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + $stmt="UPDATE vicidial_hopper set status='READY' where lead_id='$lead_id' and status='HOLD' limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + else + { + $stmt="DELETE from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + ############################################# + ##### INICIAR QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='CALLSTATUS',data1='$dispo_choice',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + + echo 'Lead ' . $lead_id . ' foi modificado para ' . $dispo_choice . " Status\nNext agent_log_id:\n" . $agent_log_id . "\n"; +} + +################################################################################ +### updateLEAD - update the vicidial_list table to reflect the values that are +### in the agents screen at time of call hangup +################################################################################ +if ($ACTION == 'updateLEAD') +{ + $MT[0]=''; + $row=''; $rowx=''; + $DO_NOT_UPDATE=0; + $DO_NOT_UPDATE_text=''; + if ( (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + echo "phone_number $phone_number or lead_id $lead_id não é válido\n"; + exit; + } + else + { + + $stmt = "SELECT disable_alter_custdata FROM vicidial_campaigns where campaign_id='$campaign'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $dac_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $dac_conf_ct) + { + $row=mysql_fetch_row($rslt); + $disable_alter_custdata = $row[0]; + $i++; + } + if (ereg('Y',$disable_alter_custdata)) + { + $DO_NOT_UPDATE=1; + $DO_NOT_UPDATE_text=' NOT'; + $stmt = "SELECT alter_custdata_override FROM vicidial_users where user='$user'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $aco_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $aco_conf_ct) + { + $row=mysql_fetch_row($rslt); + $alter_custdata_override = $row[0]; + $i++; + } + if (ereg('ALLOW_ALTER',$alter_custdata_override)) + { + $DO_NOT_UPDATE=0; + $DO_NOT_UPDATE_text=''; + } + } + + if ($DO_NOT_UPDATE < 1) + { + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + $comments = eregi_replace("--AMP--",'&',$comments); + $comments = eregi_replace("--QUES--",'?',$comments); + $comments = eregi_replace("--POUND--",'#',$comments); + + $stmt="UPDATE vicidial_list set vendor_lead_code='" . mysql_real_escape_string($vendor_lead_code) . "', title='" . mysql_real_escape_string($title) . "', first_name='" . mysql_real_escape_string($first_name) . "', middle_initial='" . mysql_real_escape_string($middle_initial) . "', last_name='" . mysql_real_escape_string($last_name) . "', address1='" . mysql_real_escape_string($address1) . "', address2='" . mysql_real_escape_string($address2) . "', address3='" . mysql_real_escape_string($address3) . "', city='" . mysql_real_escape_string($city) . "', state='" . mysql_real_escape_string($state) . "', province='" . mysql_real_escape_string($province) . "', postal_code='" . mysql_real_escape_string($postal_code) . "', country_code='" . mysql_real_escape_string($country_code) . "', gender='" . mysql_real_escape_string($gender) . "', date_of_birth='" . mysql_real_escape_string($date_of_birth) . "', alt_phone='" . mysql_real_escape_string($alt_phone) . "', email='" . mysql_real_escape_string($email) . "', security_phrase='" . mysql_real_escape_string($security_phrase) . "', comments='" . mysql_real_escape_string($comments) . "' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } + echo "Lead $lead_id information has$DO_NOT_UPDATE_text been updated\n"; +} + + +################################################################################ +### VDADpause - update the vicidial_live_agents table to show that the agent is +### or ready now active and ready to take calls +################################################################################ +if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($stage)<2) || (strlen($server_ip)<1) ) + { + echo "stage $stage não é válido\n"; + exit; + } + else + { + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set lead_id='',uniqueid=0,callerid='',channel='', random_id='$random',comments='' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_live_agents set status='$stage' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + ############################################# + ##### INICIAR QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + if (ereg('READY',$stage)) {$QMstatus='UNPAUSEALL';} + if (ereg('PAUSAR',$stage)) {$QMstatus='PAUSARALL';} + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='$QMstatus',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + + if ($agent_log == 'NO') + {$donothing=1;} + else + { + $pause_sec=0; + $stmt = "select pause_epoch,pause_sec,wait_epoch,wait_sec,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec=0; + if ($row[2] > 0) + { + $wait_sec = (($StarTtime - $row[2]) + $row[3]); + } + if ( (eregi("NULL",$row[4])) or ($row[4] < 1000) ) + {$pause_sec = (($StarTtime - $row[0]) + $row[1]);} + else + {$pause_sec = (($row[4] - $row[0]) + $row[1]);} + + } + if ($ACTION == 'VDADready') + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($ACTION == 'VDADpause') + { + $stmt="UPDATE vicidial_agent_log set pause_epoch='$StarTtime',wait_sec='$wait_sec' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + echo 'Agent ' . $user . ' está agora com o status ' . $stage . "\n"; +} + + +################################################################################ +### UpdatEFavoritEs - update the astguiclient favorites list for this extension +################################################################################ +if ($ACTION == 'UpdatEFavoritEs') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($favorites_list)<1) || (strlen($user)<1) || (strlen($exten)<1) ) + { + echo "favorites list $favorites_list não é válido\n"; + exit; + } + else + { + $stmt = "select count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + $stmt="UPDATE phone_favorites set extensions_list=\"$favorites_list\" where extension='$exten' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="INSERT INTO phone_favorites values('$exten','$server_ip',\"$favorites_list\");"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + echo "Favorites list has been updated to $favorites_list for $exten\n"; +} + + +################################################################################ +### PauseCodeSubmit - Update vicidial_agent_log with pause code +################################################################################ +if ($ACTION == 'PausaCodeSubmit') +{ + $row=''; $rowx=''; + if ( (strlen($status)<1) || (strlen($agent_log_id)<1) ) + { + echo "agent_log_id $agent_log_id or pause_code $status não é válido\n"; + exit; + } + else + { + $stmt="UPDATE vicidial_agent_log set sub_status=\"$status\" where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + ############################################# + ##### INICIAR QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $allow_sipsak_messages = $row[6]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_prefix = 'BK-'; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$status\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + } + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='PAUSARREASON',serverid='$queuemetrics_log_id',data1='$status';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } +echo "Pausa Code has been updated to $status for $agent_log_id\n"; +} + + +################################################################################ +### CalLBacKLisT - List the USERONLY callbacks for an agent +################################################################################ +if ($ACTION == 'CalLBacKLisT') +{ +$stmt = "select callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' and campaign_id='$campaign' and status NOT IN('INACTIVE','DEAD') order by callback_time;"; +if ($DB) {echo "$stmt\n";} +$rslt=mysql_query($stmt, $link); +if ($rslt) {$callbacks_count = mysql_num_rows($rslt);} +echo "$callbacks_count\n"; +$loop_count=0; + while ($callbacks_count>$loop_count) + { + $row=mysql_fetch_row($rslt); + $callback_id[$loop_count] = $row[0]; + $lead_id[$loop_count] = $row[1]; + $campaign_id[$loop_count] = $row[2]; + $status[$loop_count] = $row[3]; + $entry_time[$loop_count] = $row[4]; + $callback_time[$loop_count] = $row[5]; + $comments[$loop_count] = $row[6]; + $loop_count++; + } +$loop_count=0; + while ($callbacks_count>$loop_count) + { + $stmt = "select first_name,last_name,phone_number from vicidial_list where lead_id='$lead_id[$loop_count]';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count]\n"; + $loop_count++; + } + +} + + +################################################################################ +### CalLBacKCounT - send the count of the USERONLY callbacks for an agent +################################################################################ +if ($ACTION == 'CalLBacKCounT') +{ +$stmt = "select count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' and campaign_id='$campaign' and status NOT IN('INACTIVE','DEAD');"; +if ($DB) {echo "$stmt\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$cbcount=$row[0]; + +echo "$cbcount"; +} + + + + +if ($format=='debug') +{ +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +echo "\n"; +echo "\n\n\n"; +} + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/vicidial.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/vicidial.php new file mode 100644 index 00000000..20997130 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/vicidial.php @@ -0,0 +1,6797 @@ + LICENSE: GPLv2 +# +# make sure you have added a user to the vicidial_users MySQL table with at least +# user_level 1 or greater to access this page. Also, you need to have the login +# and pass of a phone listed in the asterisk.phones table. The page grabs the +# server info and other details from this login and pass. +# +# This script works best with Firefox or Mozilla, but will run for a couple +# hours on Internet Explorer before the memory leaks cause a crash. +# +# Other scripts that this application depends on: +# - vdc_db_query.php: Updates information in the database +# - manager_send.php: Sends manager actions to the DB for execution +# +# CHANGELOG +# 50607-1426 - First Build of VICIDIAL web client basic login process finished +# 50628-1620 - Added some basic formatting and worked on process flow +# 50628-1715 - Startup variables mapped to javascript variables +# 50629-1303 - Added Login Closer in-groups selection box and vla update +# 50629-1530 - Rough layout for customer info form section and button links +# 50630-1453 - Rough Manual Dial/Hangup with customer info displayed +# 50701-1450 - Added vicidial_log entries on dial and hangup +# 50701-1634 - Added Logout function +# 50705-1259 - Added call disposition functionality +# 50705-1432 - Added lead info DB update function +# 50705-1658 - Added web form functionality +# 50706-1043 - Added call park and pickup functions +# 50706-1234 - Added Start/Stop Recording functionality +# 50706-1614 - Added conference channels display option +# 50711-1333 - Removed call check redundancy and fixed a span bug +# 50727-1424 - Added customer channel and participant present sensing/alerts +# 50804-1057 - Added SendDTMF function and reconfigured the transfer span +# 50804-1224 - Added Local and Internal Closer transfer functions +# 50804-1628 - Added Blind transfer, activated LIVE CALL image and fixed bugs +# 50804-1808 - Added button images for left buttons +# 50815-1151 - Added 3Way calling functions to Transfer-conf frame +# 50815-1602 - Added images and buttons for xfer functions +# 50816-1813 - Added basic autodial outbound call pickup functions +# 50817-1113 - Fixes to auto_dialing call receipt +# 50817-1234 - Added inbound call receipt capability +# 50817-1541 - Added customer time display +# 50817-1541 - Added customer time display +# 50818-1327 - Added stop-all-recordings-after-each-vicidial-call option +# 50818-1703 - Added pretty login section +# 50825-1200 - Modified form field lengths, added double-click dispositions +# 50831-1603 - Fixed customer time bug and fronter display bug for CLOSER +# 50901-1314 - Fixed CLOSER IN-GROUP Web Form bug +# 50903-0904 - Added preview-lead code for manual dialing +# 50904-0016 - Added ability to hangup manual dials before pickup +# 50906-1319 - Added override for filters on xfer calls, fixed login display bug +# 50909-1243 - Added hotkeys functionality for quick dispoing in auto-dial mode +# 50912-0958 - Modified hotkeys function, agent must have user_level >= 5 to use +# 50913-1212 - Added campaign_cid to 3rd party calls +# 50923-1546 - Modified to work with language translation +# 50926-1656 - Added campaign pull-down at login of active campaigns +# 50928-1633 - Added manual dial alternate number dial option +# 50930-1538 - Added session_id empty login failure and fixed 2 minor bugs +# 51004-1656 - Fixed recording filename bug and new Spanish translation +# 51020-1103 - Added campaign-specific recording control abilities +# 51020-1352 - Added Basic vicidial_agent_log framework +# 51021-1050 - Fixed custtime display and disable Enter/Return keypresses +# 51021-1718 - Allows for multi-line comments (changes \n to !N in database) +# 51110-1432 - Fixed non-standard http port issue +# 51111-1047 - Added vicidial_agent_log lead_id earlier for manual dial +# 51118-1305 - Activate multi-line comments from $multi_line_comments var +# 51118-1313 - Move Transfer DIV to a floating span to preserve 800x600 view +# 51121-1506 - Small PHP optimizations in many scripts and disabled globalize +# 51129-1010 - Added ability to accept calls from other VICIDIAL servers +# 51129-1254 - Fixed Hangups of other agents channels when customer hangs up +# 51208-1732 - Created user-first login that looks for default phone info +# 51219-1526 - Added variable framework for campaign and in-group scripts +# 51221-1200 - Added SCRIPT tab, layout and functionality +# 51221-1714 - Added auto-switch-to-SCRIPT-tab and auto-webform-popup +# 51222-1605 - Added VMail message blind transfer button to xfer-conf frame +# 51229-1028 - Added checks on web_form_address to allow for var in the DB value +# 60117-1312 - Added Transfer-conf frame toggle on button press +# 60208-1152 - Added DTMF-xfernumber preset links to xfer-conf frame +# 60213-1129 - Added vicidial_users.hotkeys_active for any user hotkeys +# 60213-1210 - Added ability to sort routing of calls by user_level +# 60214-0932 - Initial Callback calendar display framework +# 60214-1407 - Added ability to minimize the dispo screen to see info below +# 60215-1104 - Added ANYONE scheduled callbacks functionality +# 60410-1116 - Added persistant pause after dispo option and change dispo text +# - Added web form submit that opens new window with dispo on submit +# - Added PREVIOUS CALLBACK in customer info to flag callbacks +# - Added link to try to hangup the call again in the dispo screen +# - Added link noone-in-session screen to call agent phone again +# - Added link customer-hungup screen to go straight to dispo screen +# 60410-1532 - Added agent status and campaign calls dialing display option +# 60411-1547 - Add ability to set callback as USERONLY and some basic formatting +# 60413-1752 - Add basic USERONLY callback frame and listings +# 60414-1039 - Changed manual dial preview and alt dial checkboxes to spans +# - Added beta-level USERONLY callback functionality +# - Added beta-level manual dialing with lead insertion functionality +# 60415-1534 - Fixed manual dial lead preview and fixed manuald dial override bug +# 60417-1108 - Added capability to do alt-number-dialing in auto-dial mode +# - Changed several permissions to database-defined +# 60419-1529 - Prevent manual dial or callbacks when alt-dial lead not finished +# 60420-1647 - Fixed DiaLDiaLAltPhonE error, Call Agent Again DialControl error +# 60421-1229 - Check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60424-1005 - Fixed Alt phone disabled bug for callbacks and manual dials +# 60426-1058 - Added vicidial_user setting for default blended check for CLOSER +# 60501-1008 - Added option to manual dial screen to manually lookup phone number +# 60503-1653 - Fixed agentonly_callback not-defined bug in scheduled callbacks screen +# 60504-1032 - Fixed manual dial display bug and transfer dispo alert bug +# - Fixed recording filename display to not overrun 25 characters +# 60510-1051 - Added Wrapup timer and wrapup message on wrapup screen after dispo +# 60608-1453 - Added CLOSER campaign allowable in-groups limitations +# 60609-1123 - Added add-number-to-DNC-list function and manual dial check DNC +# 60619-1047 - Added variable filters to close security holes for login form +# 60804-1710 - fixed scheduled CALLBK for other languages build +# 60808-1145 - Added consultative transfers with customer data +# 60808-2232 - Added campaign name to pulldown for login screen +# 60809-1603 - Added option to locally transfer consult xfers +# 60809-1732 - Added recheck of transferred channels before customer gone mesg +# 60810-1011 - Fixed CXFER leave 3way call bugs +# 60816-1602 - Added ALLCALLS recording delay option allcalls_delay +# 60816-1716 - Fixed customer time display bug and client DST setting +# 60821-1555 - Added option to omit phone_code on dialout of leads +# 60821-1628 - Added ALLFORCE recording option +# 60821-1643 - Added no_delete_sessions option to not delete sessions +# 60822-0512 - Changed phone number fields to be maxlength of 12 +# 60829-1531 - Made compatible with WeBRooTWritablE setting in dbconnect.php +# 60906-1152 - Added Previous CallBack info display span +# 60906-1715 - Allow for Local phone extension conferences +# 61004-1729 - Add ability to control volume per channel in "calls in this session" +# 61122-1341 - Added vicidial_user_groups allowed_campaigns restrictions +# 61122-1523 - Added more SCRIPT variables +# 61128-2229 - Added vicidial_live_agents and vicidial_auto_calls manual dial entries +# 61130-1617 - Added lead_id to MonitorConf for recording_log +# 61221-1212 - Changed width to 760 to better fit 800x600 screens, widened SCRIPT +# 70109-1128 - Fixed wrapup timer bug +# 70109-1635 - Added option for HotKeys automatically dialing next number in manual mode +# - Added option for alternate number dialing with hotkeys +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70118-1517 - Added vicidial_agent_log and vicidial_user_log logging of user_group +# 70201-1249 - Added FAST DIAL option for manually dialing, added UTF8 compatible code +# 70201-1703 - Fixed cursor bug for most text input fields +# 70202-1453 - Added first portions of Agent Pause Codes +# 70203-0108 - Finished Agent Pause Codes functionality +# 70203-0930 - Added dialed_number to webform output +# 70203-1010 - Added dialed_label to webform output +# 70206-1201 - Fixed allow_closers bug +# 70206-1332 - Added vicidial_recording_override users setting function +# 70212-1252 - Fixed small issue with CXFER +# 70213-1018 - Changed CXFER and AXFER to update customer information before transfer +# 70214-1233 - Added queuemetrics_log_id field for server_id in queue_log +# 70215-1240 - Added queuemetrics_log_id field for server_id in queue_log +# 70222-1617 - Changed queue_log PAUSE/UNPAUSE to PAUSEALL/UNPAUSEALL +# 70226-1252 - Added Mute/UnMute to agent screen +# 70309-1035 - Allow amphersands and questions marks in comments to pass through +# 70313-1052 - Allow pound signs(hash) in comments to pass through +# 70316-1406 - Moved the MUTE button to be accessible during a transfer/conf +# 70319-1446 - Added agent-deactive-display and disable customer info update functions +# 70319-1626 - Added option to allow agent logins to campaigns with no leads in the hopper +# 70320-1501 - Added option to allow retry of leave-3way-call from dispo screen +# 70322-1545 - Added sipsak display ability +# 70510-1319 - Added onUnload force Logout +# 70806-1530 - Added Presets Dial links above agent mute button +# 70823-2118 - Fixed XMLHTTPRequest, HotKeys and Scheduled Callbacks issues with MSIE +# 70828-1443 - Added source_id to output of SCRIPTtab-IFRAME and WEBFORM +# 71022-1427 - Added formatting of the customer phone number in the main status bar +# 71029-1848 - Changed CLOSER-type campaign to not use campaign_id restrictions +# 71101-1204 - Fixed bug in callback calendar with DST +# 71116-0957 - Added campaign_weight and calls_today to the vla table insertion +# 71120-1719 - Added XMLHTPRequest lookup of allowable campaigns for agents during login +# 71122-0256 - Added auto-pause notification +# 71125-1751 - Changed Transfer section to allow for selection of in-groups to send calls to +# 71127-0408 - Added height and width settings for easier modification of screen size +# 71129-2025 - restricted callbacks count and list to campaign only +# + +$version = '2.0.4-142'; +$build = '71129-2025'; + +require("dbconnect.php"); + +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["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} + 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"];} + } + if (isset($VD_campaign)) + { + $VD_campaign = strtoupper($VD_campaign); + $VD_campaign = eregi_replace(" ",'',$VD_campaign); + } + +### 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); + + +$forever_stop=0; + +if ($force_logout) +{ + echo "Você fez o logoff. Obrigado\n"; + exit; +} + +$isdst = date("I"); +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$CIDdate = date("ymdHis"); + $month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); + $past_month_date = date("Y-m-d H:i:s",$month_old); + + +$random = (rand(1000000, 9999999) + 10000000); + +$conf_silent_prefix = '7'; # vicidial_conferences prefix to enter silently +$HKuser_level = '5'; # minimum vicidial user_level for HotKeys +$campaign_login_list = '1'; # show drop-down list of campaigns at login +$manual_dial_preview = '1'; # allow preview lead option when manual dial +$multi_line_comments = '1'; # set to 1 to allow multi-line comment box +$user_login_first = '0'; # set to 1 to have the vicidial_user login before the phone login +$view_scripts = '1'; # set to 1 to show the SCRIPTS tab +$dispo_check_all_pause = '0'; # set to 1 to allow for persistent pause after dispo +$agentcallsstatus = '0'; # set to 1 to show agent status and call count + $campagentstatctmax = '0'; # Number of segundos for campaign call and agent stats +$show_campname_pulldown = '1'; # set to 1 to show campaign nameligadologin pulldown +$webform_sessionname = '1'; # set to 1 to include the session_name in webform URL +$local_consult_xfers = '1'; # set to 1 to send consultative transfers from original server +$clientDST = '1'; # set to 1 to check for DSTligadoserver for agent time +$no_delete_sessions = '0'; # set to 1 to not delete sessions at logout +$volumecontrol_active = '1'; # set to 1 to allow agents to alter volume of channels +$PreseT_DiaL_LinKs = '1'; # set to 1 to show a DISCAR link for Dial Presets +$LogiNAJAX = '1'; # set to 1 to do lookups +$HidEMonitoRSessionS = '1'; # set to 1 to hide remote monitoring channels from "session calls" + +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen + +$BROWSER_HEIGHT = 500; # set to the minimum browser height, default=500 +$BROWSER_WIDTH = 770; # set to the minimum browser width, default=770 + + +# options now set in DB: +#$alt_phone_dialing = '1'; # allow agents to call alt phone numbers +#$scheduled_callbacks = '1'; # set to 1 to allow agent to choose scheduled callbacks +# $agentonly_callbacks = '1'; # set to 1 to allow agent to choose agent-only scheduled callbacks +#$agentcall_manual = '1'; # set to 1 to allow agent to make manual calls during autodial session + +### SCREEN WIDTH AND HEIGHT CALCULATIONS ### +### DO NOT EDIT! ### +$MASTERwidth=($BROWSER_WIDTH - 340); +$MASTERheight=($BROWSER_HEIGHT - 200); +if ($MASTERwidth < 430) {$MASTERwidth = '430';} +if ($MASTERheight < 300) {$MASTERheight = '300';} + +$CAwidth = ($MASTERwidth + 340); # 770 - cover all (none-in-session, customer hunngup, etc...) +$MNwidth = ($MASTERwidth + 330); # 760 - main frame +$XFwidth = ($MASTERwidth + 320); # 750 - transfer/conference +$HCwidth = ($MASTERwidth + 310); # 740 - hotkeys and callbacks +$AMwidth = ($MASTERwidth + 270); # 700 - agent mute and preset-dial links +$SSwidth = ($MASTERwidth + 176); # 606 - scroll script +$SDwidth = ($MASTERwidth + 170); # 600 - scroll script, customer data and calls-in-session +$HKwidth = ($MASTERwidth + 70); # 500 - Hotkeys button +$HSwidth = ($MASTERwidth + 1); # 431 - Header spacer + +$HKheight = ($MASTERheight + 105); # 405 - HotKey active Button +$AMheight = ($MASTERheight + 100); # 400 - Agent mute and preset dial links +$MBheight = ($MASTERheight + 65); # 365 - Manual Dial Buttons +$CBheight = ($MASTERheight + 50); # 350 - Agent Callback, pause code, volume control Buttons and agent status +$SSheight = ($MASTERheight + 31); # 331 - script content +$HTheight = ($MASTERheight + 10); # 310 - transfer frame, callback comments and hotkey +$BPheight = ($MASTERheight - 250); # 50 - bottom buffer + + +$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('vicidial.php','',$agcPAGE); + +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 +echo "\n"; +echo "\n"; +echo "\n"; + +if ($campaign_login_list > 0) +{ +$camp_form_code = "\n"; +} +else +{ +$camp_form_code = "\n"; +} + + +if ($LogiNAJAX > 0) +{ +?> + + + +VICIDISCAR web client: Re-Login\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "
English Brazil
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Re-Login
 
Login do Telefone:
Senha do Telefone:
Login do Usuário:
Senha do Usuário:
Campanha: $camp_form_code

VERSÃO: $version       CONFIGURAÇÃO: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} + +if ($user_login_first == 1) +{ + if ( (strlen($VD_login)<1) or (strlen($VD_pass)<1) or (strlen($VD_campaign)<1) ) + { + echo "VICIDISCAR web client: Login da Campanha\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Brazil
\n"; + echo "
\n"; + echo "\n"; + #echo "\n"; + #echo "\n"; + echo "

Login do Usuário

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Login da Campanha
 
Login do Usuário:
Senha do Usuário:
Campanha: $camp_form_code
  \n"; + echo "

VERSÃO: $version       CONFIGURAÇÃO: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) + { + $stmt="SELECT phone_login,phone_pass from vicidial_users where user='$VD_login' and pass='$VD_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); + $phone_login=$row[0]; + $phone_pass=$row[1]; + + echo "VICIDISCAR web client: Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Brazil
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Login
 
Login do Telefone:
Senha do Telefone:
Login do Usuário:
Senha do Usuário:
Campanha: $camp_form_code
  \n"; + echo "

VERSÃO: $version       CONFIGURAÇÃO: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + + } + } +} + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "VICIDISCAR web client: Login do Telefone\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "
English Brazil
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Login do Telefone
 
Login do Telefone:
Senha do Telefone:
  \n"; +echo "

VERSÃO: $version       CONFIGURAÇÃO: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./vicidial_auth_entries.txt", "a");} +$VDloginDISPLAY=0; + + if ( (strlen($VD_login)<2) or (strlen($VD_pass)<2) or (strlen($VD_campaign)<2) ) + { + $VDloginDISPLAY=1; + } + else + { + $stmt="SELECT count(*) from vicidial_users where user='$VD_login' and pass='$VD_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($auth>0) + { + $login=strtoupper($VD_login); + $password=strtoupper($VD_pass); + ##### grab the full name of the agent + $stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,closer_default_blended,user_group,vicidial_recording_override from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $user_level=$row[1]; + $VU_hotkeys_active=$row[2]; + $VU_agent_choose_ingroups=$row[3]; + $VU_scheduled_callbacks=$row[4]; + $agentonly_callbacks=$row[5]; + $agentcall_manual=$row[6]; + $VU_vicidial_recording=$row[7]; + $VU_vicidial_transfers=$row[8]; + $VU_closer_default_blended=$row[9]; + $VU_user_group=$row[10]; + $VU_vicidial_recording_override=$row[11]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|$VD_pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + $user_abb = "$VD_login$VD_login$VD_login$VD_login"; + while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + + $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$VU_user_group';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGallowed_campaigns =$row[0]; + + if ( (!eregi(" $VD_campaign ",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) + { + echo "VICIDISCAR web client: VICIDISCAR Login da Campanha\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Brazil
\n"; + echo "Sorry, you are not allowed to login to this campaign: $VD_campaign\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Login: \n
"; + echo "Senha:
\n"; + echo "Campanha: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + ##### check to see that the campaign is active + $stmt="SELECT count(*) FROM vicidial_campaigns where campaign_id='$VD_campaign' and active='Y';"; + 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); + $CAMPactive=$row[0]; + if($CAMPactive>0) + { + if ($TEST_all_statuses > 0) {$selectableSQL = '';} + else {$selectableSQL = "selectable='Y' and";} + $VARstatuses=''; + $VARstatusnames=''; + ##### grab the statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_statuses WHERE $selectableSQL status != 'NEW' order by status limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $VD_statuses_ct) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + } + + ##### grab the campaign-specific statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_campaign_statuses WHERE $selectableSQL status != 'NEW' and campaign_id='$VD_campaign' order by status limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_camp = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + $j++; + } + $VD_statuses_ct = ($VD_statuses_ct+$VD_statuses_camp); + $VARstatuses = substr("$VARstatuses", 0, -1); + $VARstatusnames = substr("$VARstatusnames", 0, -1); + + ##### grab the campaign-specific HotKey statuses that can be used for dispositioning by an agent + $stmt="SELECT hotkey,status,status_name FROM vicidial_campaign_hotkeys WHERE selectable='Y' and status != 'NEW' and campaign_id='$VD_campaign' order by hotkey limit 9;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $HK_statuses_camp = mysql_num_rows($rslt); + $w=0; + $HKboxA=''; + $HKboxB=''; + $HKboxC=''; + while ($w < $HK_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $HKhotkey[$w] =$row[0]; + $HKstatus[$w] =$row[1]; + $HKstatus_name[$w] =$row[2]; + $HKhotkeys = "$HKhotkeys'$HKhotkey[$w]',"; + $HKstatuses = "$HKstatuses'$HKstatus[$w]',"; + $HKstatusnames = "$HKstatusnames'$HKstatus_name[$w]',"; + if ($w < 3) + {$HKboxA = "$HKboxA $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ( ($w >= 3) and ($w < 6) ) + {$HKboxB = "$HKboxB $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ($w >= 6) + {$HKboxC = "$HKboxC $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + $w++; + } + $HKhotkeys = substr("$HKhotkeys", 0, -1); + $HKstatuses = substr("$HKstatuses", 0, -1); + $HKstatusnames = substr("$HKstatusnames", 0, -1); + + ##### grab the statuses to be dialed for your campaign as well as other campaign settings + $stmt="SELECT park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,agent_pause_codes_active,no_hopper_leads_logins,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,xfer_groups FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $park_ext = $row[0]; + $park_file_name = $row[1]; + $web_form_address = $row[2]; + $allow_closers = $row[3]; + $auto_dial_level = $row[4]; + $dial_timeout = $row[5]; + $dial_prefix = $row[6]; + $campaign_cid = $row[7]; + $campaign_vdad_exten = $row[8]; + $campaign_rec_exten = $row[9]; + $campaign_recording = $row[10]; + $campaign_rec_filename = $row[11]; + $campaign_script = $row[12]; + $get_call_launch = $row[13]; + $campaign_am_message_exten = $row[14]; + $xferconf_a_dtmf = $row[15]; + $xferconf_a_number = $row[16]; + $xferconf_b_dtmf = $row[17]; + $xferconf_b_number = $row[18]; + $alt_number_dialing = $row[19]; + $VC_scheduled_callbacks = $row[20]; + $wrapup_segundos = $row[21]; + $wrapup_message = $row[22]; + $closer_campaigns = $row[23]; + $use_internal_dnc = $row[24]; + $allcalls_delay = $row[25]; + $omit_phone_code = $row[26]; + $agent_pause_codes_active = $row[27]; + $no_hopper_leads_logins = $row[28]; + $campaign_allow_inbound = $row[29]; + $manual_dial_list_id = $row[30]; + $default_xfer_group = $row[31]; + $xfer_groups = $row[32]; + + if ( (!ereg('DISABLED',$VU_vicidial_recording_override)) and ($VU_vicidial_recording > 0) ) + { + $campaign_recording = $VU_vicidial_recording_override; + print "\n"; + } + if ( ($VC_scheduled_callbacks=='Y') and ($VU_scheduled_callbacks=='1') ) + {$scheduled_callbacks='1';} + if ($VU_vicidial_recording=='0') + {$campaign_recording='NEVER';} + if ($alt_number_dialing=='Y') + {$alt_phone_dialing='1';} + else + {$alt_phone_dialing='0';} + $closer_campaigns = preg_replace("/^ | -$/","",$closer_campaigns); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaigns = "'$closer_campaigns'"; + + if ($agent_pause_codes_active=='Y') + { + ##### grab the pause codes for this campaign + $stmt="SELECT pause_code,pause_code_name FROM vicidial_pause_codes WHERE campaign_id='$VD_campaign' order by pause_code limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_pause_codes = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_pause_codes) + { + $row=mysql_fetch_row($rslt); + $pause_codes[$i] =$row[0]; + $pause_code_names[$i] =$row[1]; + $VARpause_codes = "$VARpause_codes'$pause_codes[$i]',"; + $VARpause_code_names = "$VARpause_code_names'$pause_code_names[$i]',"; + $i++; + $j++; + } + $VD_pause_codes_ct = ($VD_pause_codes_ct+$VD_pause_codes); + $VARpause_codes = substr("$VARpause_codes", 0, -1); + $VARpause_code_names = substr("$VARpause_code_names", 0, -1); + } + + ##### grab the inbound groups to choose from if campaign contains CLOSER + $VARingroups="''"; + if ($campaign_allow_inbound == 'Y') + { + $VARingroups=''; + $stmt="select group_id from vicidial_inbound_groups where active = 'Y' and group_id IN($closer_campaigns) order by group_id limit 60;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $closer_ct = mysql_num_rows($rslt); + $INgrpCT=0; + while ($INgrpCT < $closer_ct) + { + $row=mysql_fetch_row($rslt); + $closer_groups[$INgrpCT] =$row[0]; + $VARingroups = "$VARingroups'$closer_groups[$INgrpCT]',"; + $INgrpCT++; + } + $VARingroups = substr("$VARingroups", 0, -1); + } + + ##### grab the allowable inbound groups to choose from for transfer options + $xfer_groups = preg_replace("/^ | -$/","",$xfer_groups); + $xfer_groups = preg_replace("/ /","','",$xfer_groups); + $xfer_groups = "'$xfer_groups'"; + $VARxfergroups="''"; + if ($allow_closers == 'Y') + { + $VARxfergroups=''; + $stmt="select group_id,group_name from vicidial_inbound_groups where active = 'Y' and group_id IN($xfer_groups) order by group_id limit 60;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $xfer_ct = mysql_num_rows($rslt); + $XFgrpCT=0; + while ($XFgrpCT < $xfer_ct) + { + $row=mysql_fetch_row($rslt); + $VARxfergroups = "$VARxfergroups'$row[0]',"; + $VARxfergroupsnames = "$VARxfergroupsnames'$row[1]',"; + if ($row[0] == "$default_xfer_group") {$default_xfer_group_name = $row[1];} + $XFgrpCT++; + } + $VARxfergroups = substr("$VARxfergroups", 0, -1); + $VARxfergroupsnames = substr("$VARxfergroupsnames", 0, -1); + } + + ##### grab the number of leads in the hopper for this campaign + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id = '$VD_campaign' and status='READY';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $campaign_leads_to_call = $row[0]; + print "\n"; + + } + else + { + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "A campanha não está ativa, por favor tente novamente
"; + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|$VD_pass|$ip|$browser|\n"); + fclose($fp); + } + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Usuário incorreto, por favor tente novamente
"; + } + } + if ($VDloginDISPLAY) + { + echo "VICIDISCAR web client: Login da Campanha\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Brazil
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "

$VDdisplayMESSAGE

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Login da Campanha
 
Login do Usuário:
Senha do Usuário:
Campanha: $camp_form_code
  \n"; + echo "

VERSÃO: $version       CONFIGURAÇÃO: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +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); +$authphone=$row[0]; +if (!$authphone) + { + echo "VICIDISCAR web client: Login do Telefone Error\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Brazil
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Login Error
 
Desculpe seu login de telefone e senha não estão ativos nesta campanha, por favor tente novamente:
 
Login do Telefone:
Senha do Telefone:

VERSÃO: $version       CONFIGURAÇÃO: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "VICIDISCAR web client\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + 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); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $login=$row[6]; + $pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CallerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + $enable_sipsak_messages=$row[66]; + + if ($clientDST) + { + $local_gmt = ($local_gmt + $isdst); + } + if ($protocol == 'EXTERNAL') + { + $protocol = 'Local'; + $extension = "$dialplan_number$AT$ext_context"; + } + $SIP_user = "$protocol/$extension"; + + $stmt="SELECT asterisk_version from servers where server_ip='$server_ip';"; + 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); + $asterisk_version=$row[0]; + + # If a park extension is not set, use the default one + if ( (strlen($park_ext)>0) && (strlen($park_file_name)>0) ) + { + $VICIDiaL_park_on_extension = "$park_ext"; + $VICIDiaL_park_on_filename = "$park_file_name"; + print "\n"; + } + print "\n"; + + # If a web form address is not set, use the default one + if (strlen($web_form_address)>0) + { + $VICIDiaL_web_form_address = "$web_form_address"; + print "\n"; + } + else + { + $VICIDiaL_web_form_address = "$VICIDiaL_web_URL"; + print "\n"; + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + } + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + # If closers are allowedligadothis campaign + if ($allow_closers=="Y") + { + $VICIDiaL_allow_closers = 1; + print "\n"; + } + else + { + $VICIDiaL_allow_closers = 0; + print "\n"; + } + + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtimE$US$session_ext$session_rand"; + + if ($webform_sessionname) + {$webform_sessionname = "&session_name=$session_name";} + else + {$webform_sessionname = '';} + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'vicidial';"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','vicidial','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + if ( ($campaign_allow_inbound == 'Y') || ($campaign_leads_to_call > 0) || (ereg('Y',$no_hopper_leads_logins)) ) + { + ### insert an entry into the user log for the login event + $stmt = "INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$VD_login','LOGIN','$VD_campaign','$NOW_TIME','$StarTtimE','$VU_user_group')"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + ##### check to see if the user has a conf extension already, this happens if they previously exited uncleanly + $stmt="SELECT conf_exten FROM vicidial_conferences where extension='$SIP_user' and server_ip = '$server_ip' LIMIT 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $prev_login_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $prev_login_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + if ($prev_login_ct > 0) + {print "\n";} + else + { + ##### grab the next available vicidial_conference room and reserve it + $stmt="SELECT conf_exten FROM vicidial_conferences where server_ip = '$server_ip' and ((extension='') or (extension is null)) LIMIT 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $free_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $free_conf_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + $stmt="UPDATE vicidial_conferences set extension='$SIP_user' where server_ip='$server_ip' and conf_exten='$session_id';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + print "\n"; + + } + + $stmt="UPDATE vicidial_list set status='N', user='' where status IN('QUEUE','INCALL') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_hopper where status IN('QUEUE','INCALL','DONE') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_live_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_live_inbound_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + # print "You have logged in as user: $VD_loginligadophone: $SIP_userpara a campanha: $VD_campaign
\n"; + $VICIDiaL_is_logged_in=1; + + ### set the callerID for manager middleware-app to connect the phone to the user + $SIqueryCID = "S$CIDdate$session_id"; + + ############################################# + ##### INICIAR SYSTEM_SETTINGS LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,vicidial_agent_disable,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $vicidial_agent_disable = $row[6]; + $allow_sipsak_messages = $row[7]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_prefix = 'LIN-'; + print "\n"; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$VD_campaign\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + $SIqueryCID = "$SIPSAK_prefix$VD_campaign$DS$CIDdate"; + } + + ### insert a NOVO record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$SIqueryCID','Channel: $SIP_user','Context: $ext_context','Exten: $session_id','Priority: 1','Callerid: $SIqueryCID','','','','','');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($auto_dial_level > 0) + { + print "\n"; + + ##### grab the campaign_weight and number of calls todayligadothat campaign for the agent + $stmt="SELECT campaign_weight,calls_today FROM vicidial_campaign_agents where user='$VD_login' and campaign_id = '$VD_campaign';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vca_ct = mysql_num_rows($rslt); + if ($vca_ct > 0) + { + $row=mysql_fetch_row($rslt); + $campaign_weight = $row[0]; + $calls_today = $row[1]; + $i++; + } + else + { + $campaign_weight = '0'; + $calls_today = '0'; + $stmt="INSERT INTO vicidial_campaign_agents (user,campaign_id,campaign_rank,campaign_weight,calls_today) values('$VD_login','$VD_campaign','0','0','$calls_today');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + } + $closer_chooser_string=''; + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,user_level,campaign_weight,calls_today) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$closer_chooser_string','$user_level','$campaign_weight','$calls_today');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='$VD_campaign',agent='Agent/$VD_login',verb='AGENTLOGIN',data1='$VD_login@agents',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSARALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + mysql_close($linkB); + mysql_select_db("$VARDB_database", $link); + } + + + if ($campaign_allow_inbound == 'Y') + { + print "\n"; + } + } + else + { + print "\n"; + + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,user_level) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$user_level');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='$VD_campaign',agent='Agent/$VD_login',verb='AGENTLOGIN',data1='$VD_login@agents',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSARALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + mysql_close($linkB); + mysql_select_db("$VARDB_database", $link); + } + } + } + else + { + echo "VICIDISCAR web client: VICIDISCAR Login da Campanha\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Brazil
\n"; + echo "Desculpe, não existem registros na fila de discagem\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Login: \n
"; + echo "Senha:
\n"; + echo "Campanha: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + if (strlen($session_id) < 1) + { + echo "VICIDISCAR web client: VICIDISCAR Login da Campanha\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Brazil
\n"; + echo "Sorry, there are no available sessions\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Login: \n
"; + echo "Senha:
\n"; + echo "Campanha: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + if (ereg('MSIE',$browser)) + { + $useIE=1; + print "\n"; + } + else + { + $useIE=0; + print "\n"; + } + + $StarTtimE = date("U"); + $NOW_TIME = date("Y-m-d H:i:s"); + ##### Agent is going to log in so insert the vicidial_agent_log entry now + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group,sub_status) values('$VD_login','$server_ip','$NOW_TIME','$VD_campaign','$StarTtimE','0','$StarTtimE','$VU_user_group','LOGIN');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id($link); + print "\n"; + + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $server_ip_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S"; + + ##### grab the datails of all active scripts in the system + $stmt="SELECT script_id,script_name,script_text FROM vicidial_scripts WHERE active='Y' order by script_id limit 100;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $MM_scripts = mysql_num_rows($rslt); + $e=0; + while ($e < $MM_scripts) + { + $row=mysql_fetch_row($rslt); + $MMscriptid[$e] =$row[0]; + $MMscriptname[$e] = rawurlencode($row[1]); + $MMscripttext[$e] = rawurlencode($row[2]); + $MMscriptids = "$MMscriptids'$MMscriptid[$e]',"; + $MMscriptnames = "$MMscriptnames'$MMscriptname[$e]',"; + $MMscripttexts = "$MMscripttexts'$MMscripttext[$e]',"; + $e++; + } + $MMscriptids = substr("$MMscriptids", 0, -1); + $MMscriptnames = substr("$MMscriptnames", 0, -1); + $MMscripttexts = substr("$MMscripttexts", 0, -1); + + } +} + +################################################################ +### BEGIN - build the callback calendar (12 months) ### +################################################################ +define ('ADAY', (60*60*24)); +$CdayARY = getdate(); +$Cmon = $CdayARY['mon']; +$Cyear = $CdayARY['year']; +$CTODAY = date("Y-m"); +$CTODAYmday = date("j"); +$CINC=0; + +$Cmonths = Array('Janeiro','February','Março','Abril','Pode','Junho', + 'Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'); +$Cdays = Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); + +$CCAL_OUT = ''; + +$CCAL_OUT .= ""; + +while ($CINC < 12) +{ +if ( ($CINC == 0) || ($CINC == 4) ||($CINC == 8) ) + {$CCAL_OUT .= "";} + +$CCAL_OUT .= ""; + +if ( ($CINC == 3) || ($CINC == 7) ||($CINC == 11) ) + {$CCAL_OUT .= "";} +$CINC++; +} + +$CCAL_OUT .= "
"; + +$CYyear = $Cyear; +$Cmonth= ($Cmon + $CINC); +if ($Cmonth > 12) + { + $Cmonth = ($Cmonth - 12); + $CYyear++; + } +$Cstart= mktime(11,0,0,$Cmonth,1,$CYyear); +$CfirstdayARY = getdate($Cstart); +#echo "|$Cmon|$Cmonth|$CINC|\n"; +$CPRNTDAY = date("Y-m", $Cstart); + +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; + +foreach($Cdays as $Cday) +{ + $CDCLR="#ffffff"; +$CCAL_OUT .= ""; +} + +for( $Ccount=0;$Ccount<(6*7);$Ccount++) +{ + $Cdayarray = getdate($Cstart); + if((($Ccount) % 7) == 0) + { + if($Cdayarray['mon'] != $CfirstdayARY['mon']) + break; + $CCAL_OUT .= ""; + } + if($Ccount < $CfirstdayARY['wday'] || $Cdayarray['mon'] != $Cmonth) + { + $CCAL_OUT .= ""; + } + else + { + if( ($Cdayarray['mday'] == $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + else + { + $CDCLR="#ffffff"; + if ( ($Cdayarray['mday'] < $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CDCLR="#CCCCCC"; + $CBL = ''; + $CEL = ''; + } + else + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + } + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + } +} +$CCAL_OUT .= ""; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$CfirstdayARY[month] $CfirstdayARY[year]"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$Cday"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
 "; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; + +#echo "$CCAL_OUT\n"; +################################################################ +### END - build the callback calendar (12 months) ### +################################################################ + + +?> + + + + +\n"; + + +?> + +
+ + MARGINWIDTH=0 MARGINHEIGHT=0 LEFTMARGIN=0 TOPMARGIN=0 VALIGN=TOP ALIGN=LEFT> +
+ + + +SAIR\n"; ?> +
+
+ + + height=30> + + + + + +
VICIDISCARSCRIPT VALIGN=MIDDLE ALIGN=CENTER>   LIVE    ID da sessão: Chamadas Ativas
+
+ + + + + height=>

VICIDISCAR
+
+ + +DISCAGEM MANUAL       SELETOR RÃPIDO
+
+ + +X AGENDAMENTOS ATIVOS
+
+ + +
+
+ + + D1 - DISCAR\n"; + echo "
\n"; + echo "D2 - DISCAR\n"; + } + else {echo "
\n";} + ?> +

+
+
+ + + height=460>
AGENDAMENTOS POR AGENTE :
Clique em um dos contatos abaixo para ligar. Se você clicar em um contatos abaixo o mesmo será removido da lista de Agendamentos. +
+
+
  + Atualizar +                 + Voltar +
+
+ + + height=460>
NOVA DISCAGEM MANUAL PARA :

Digite abaixo a informação do novo contato que você deseja ligar. +
+ \n"; + } + ?> + Note: all new manual dial leads will go into list

+ + + + + + + + + + + + + + + +
Codigo de Ãrea:   (Normalmente é 1 nos EUA-Canada)
Telefone Number: +   (12 digits max - digits only) +
Ligações Existentes Da Busca:   (Esta opção se verificado tentará encontrar o número de telefone no sistema antes de introduzi-lo como uma ligação nova)


Se você deseja ligar para um número que não está na lista de contatos, digite o número que voc6e deseja discar no campo Discagem Sobreposta abaixo. Para desligar essa ligação você deve abrir o link Ligações em sua sessão link no rodapé da página e desligar clicando no link do canal.
 
Discagem Sobreposta:   (digitos apenas por favor) +
+
+ Discar Agora +                 + Voltar +
+
+ + + +
+
+ + + + +Your Status:
Calls Dialing: +
+ + + + + > + +
+
+ + Transferir a conferência
+ + + CLOSER LOCAL + Desligar linha Xfer + Desligar ambas as linhas + +
+ + Número a ser discado   + + DISCAGEM SOBREPOSTA   + ABANDONAR CHAMADA A TRES + Transferência sem acompanhamento + D1 + D2 + +
+ + segundos   + channel + Discar com o cliente + Colocar chamada do cliente em espera + Blind Transfer VMail Message +
+
+
+
+ + + + height=70> + +
Status da ligação definida como:

+ -
+
+
+ + + height=70> + + + + +
Atalhos para os status: + Quanto ativo apenas pressione a tecla do teclado referente ao status desejado. A ligação será desligada e salva com o status definido automaticamemente:
+ + + + + +
+
+ + + height=70> + + + + + + +
Informação Precedente Da Rechamada: close
+
+
+
+
+ +
+
+ + + height=500>
Não existe ninguem na sua sessão:
+ Voltar +

+ Ligar novamente para o agente +
+
+ + + height=500>
O cliente desligou:
+ Voltar +

+ Finalize e coloque o status da ligação + +
+
+ + + height=550>
Chamada Wrapup: segundos restantes no wrapup

+ +

+ Revestimento Wrapup e movimento sobre + +
+
+ + + height=500>
Sua sessão foi incapacitada
SAIR

Voltar +
+
+ + + height=500>

SAIR
+
+ + +
+
+ + +
 
+
+ + + height=47>
Qualquer alteração feita nesta página não será salva. Você deve mudar as informações do cliente antes de desligar a ligação.
+
+ + + height=460>
SELEÇÃO DE STATUS :       Desligue novamente       minimizar
+ Fim da seleção de status +
+ PAUSAR DISCAGEM DO AGENTE
+ LIMPAR FORMULARIO | + ENVIAR +

+ WEB FORM ENVIAR +

  +
+
+ + + height=460>
SELECIONE Um CÓDIGO Da PAUSA :
+ Pausa Code Selection + +

  +
+
+ + + height=460>
Selecione uma data para o retorno :
+ + + Selecione uma data abaixo   +     + Hour: +   + Minutes: +   + +  
+ ESTE AGENDAMENTO SO APARECE PARA MIM
";} + ?> + Comentarios do CB:

+ + ENVIAR

+ +

  +
+
+ + + height=460>
SELECAO DO GRUPO DE ENTRADA DO CLOSER
+ Seleção do grupo de entrada do closer +
+ LIGACAO MISTURADA(ligações externas ativadas)
+ REINICIAR | + ENVIAR +



  +
+
+ + + + Canal + Canal + ESTE AGENDAMENTO SO APARECE PARA MIM
";} + ?> +
+ + + + height=>
VICIDISCAR SCRIPT
+
+ + + 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> +ATALHOS DE STATUS INATIVOS + + + + +> + + + +
VICIDISCAR web-client version:     CONFIGURAÇÃO:               Servidor:              
+Mostrar informações de discagem do canal

 
+
+ + + +
+
+ + + + + id="MainTable"> + + + + + + + + + + + + + + + +
STATUS:
+
+Discar proximo número
+ VISUALIZAR CONTATO
+ DISCAR TELEFONE ALTERNATIVO
+ + +GRAVANDO ARQUIVO:
+
+
+ID da gravação:
+
+ +Inicia Gravação
+
+Web Form
+
+Colocar em espera
+Transferir a conferência
+
+Desligar Cliente
+
+
Enviar DTMF

+
+
+
align=left valign=top> + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
segundos:   Canal:   Tempo de cliente:
Informações do cliente:
Título:   Primeiro:   MI:  Ultimo:
Endereço1:
Endereço2:   Endereço3:
Cidade:   Estado:   CEP:
Bairro:   ID do Vendedor:
Telefone:   Codigo de Area:   Telefone Alternativo:
Mostrar:   Email:
Comentários: + +\n";} +else + {echo "\n";} +?> + +
+
+ +
+
> + 
+ + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/voicemail_check.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/voicemail_check.php new file mode 100644 index 00000000..628f19b0 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_br/voicemail_check.php @@ -0,0 +1,140 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "\n"; +echo "\n"; +echo "\n"; +echo "Verificar caixa postal"; +echo "\n"; +echo "\n"; +echo "\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";} + $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";} + } + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/active_list_refresh.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/active_list_refresh.php new file mode 100644 index 00000000..3cd974e6 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/active_list_refresh.php @@ -0,0 +1,482 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "\n"; +echo "\n"; +echo "\n"; +echo "Liste Display: "; +if ($ADD==1) {echo "Live Erweiterungen";} +if ($ADD==2) {echo "Besetzte Erweiterungen";} +if ($ADD==3) {echo "Amtsleitungen";} +if ($ADD==4) {echo "Lokale Erweiterungen";} +if ($ADD==5) {echo "Konferenzen";} +if ($ADD==99999) {echo "HILFE";} +echo "\n"; +echo "\n"; +echo "\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 "\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + +###################### +# ADD=2 display all busy extensions on a server +###################### +if ($ADD==2) +{ + if (!$field_name) {$field_name = 'busyext';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\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 "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=4 display all busy Local lines on a server +###################### +if ($ADD==4) +{ + if (!$field_name) {$field_name = 'local';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\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 "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='table') {echo "\n";} +if ($format=='table') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/astguiclient.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/astguiclient.php new file mode 100644 index 00000000..7ac371a4 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/astguiclient.php @@ -0,0 +1,2905 @@ + LICENSE: GPLv2 +# +# make sure you have added a user to the vicidial_users MySQL table with at least +# user_level 1 or greater to access this page. Also you need to have the login +# and pass of a phone listed in the asterisk.phones table. The page grabs the +# server info and other details from this login and pass +# +# Other scripts that this application depends on: +# - active_list_refresh.php: displays active/live channels and phones +# - manager_send.php: sends Actions to be executed on Asterisk servers +# - live_exten_check.php: checks to see if user's phone is on a live call +# - call_log_display.php: retrieves log of inbound and outbound calls +# - voicemail_check.php: retrieves counts of new and old messages +# - inbound_popup.php: opens upon live_inbound call coming in +# - conf_exten_check.php: checks to see if and calls are in a specific conf +# - park_calls_display.php: retrieves list of parked calls +# - vdc_db_query.php: Changes values in the DB for non-calling records +# +# CHANGES +# 50215-1356 - Proof-of-concept test of XMLHttpRequest for astGUIclient web +# 50323-1411 - First build version display-only +# 50331-1040 - Second-build, added phone login and hangup/hijack display +# 50401-1006 - Trunk/Local Hangup functions enabled +# 50404-1056 - Trunk/Local Hijack functions enabled +# 50404-1459 - Simple live calls display and grabs updated time from server +# 50405-1221 - Reorganized the display and layers, added some images +# 50406-1005 - Added In/Out call log display to MAIN panel +# 50407-1254 - Start/Stop Recording on live calls enabled +# 50422-1101 - Activated Check Voicemail button and new/old messages count +# 50428-1449 - Added dial from log and basic live_inbound call popup +# 50429-1455 - Modified inbound popup code for IE and to add more functions +# 50502-1442 - Added basic method to transfer live calls somewhere else +# 50503-1205 - Added web_client_sessions entry for more security of subscripts +# 50503-1537 - Added basic conferences display +# 50509-1132 - Added conference connected list and hangup/xfer for them +# 50511-1129 - Added registration of conference rooms and added manual dial +# 50523-1342 - Added Conference recording and send DTMF +# 50523-1622 - Added Local Dial window frame for calling local extensions +# 50524-1456 - Added ability to park call and display number of parked calls +# 50524-1600 - Added ability to display and pickup/hangup/xfer parked calls +# 50525-1224 - Added ability to place outbound call from within conferene +# 50531-1225 - Added ability to do dual transfers to meetme rooms from Main +# 50711-1229 - removed HTTP authentication in favor of user/pass vars +# 50711-1610 - Added Zap monitoring to Trunk/Local Action screens +# 50804-1604 - Minor bug fix in inbound_popup functions +# 50818-1715 - Added pretty login section +# 50913-1137 - Added custom outbound_cid from phones table +# 51110-1430 - Fixed non-standard http port issue +# 60103-1421 - Added code for favorite extensions chooser +# 60104-1347 - Added basic layout for favorites editing frame +# 60105-1124 - Finished Favorites frame and added DB submission +# 60112-1622 - Several formatting changes +# 60421-1357 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1103 - Added variable filters to close security holes for login form +# 60829-1528 - Made compatible with WeBRooTWritablE setting in dbconnect.php +# + +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["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["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} + 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"];} + } + +$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++;} + +$version = '2.0.1'; +$build = '60829-1528'; + +### 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); + $user=ereg_replace("[^0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^0-9a-zA-Z]","",$pass); + + +if ($force_logout) +{ + if( (strlen($_SERVER['user'])>0) or (strlen($_SERVER['pass'])>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "Sie haben sich abgemeldet. Danke\n"; + exit; +} + +$StarTtime = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_TIME = date("Ymd-His"); + $month_old = mktime(0, 0, 0, date("m"), date("d")-7, date("Y")); + $past_month_date = date("Y-m-d H:i:s",$month_old); + + $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]; + +$US='_'; +$CL=':'; +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./astguiclient_auth_entries.txt", "a");} +$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 = $agcPAGE; +$agcDIR = eregi_replace('astguiclient.php','',$agcDIR); + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth) or ($relogin == 'YES') ) + { + header ("Content-type: text/html; charset=utf-8"); + + echo "astGUIclient web client: Login\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Deutsch
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Login
 
Benutzer Login:
Benutzer Passwort:
Telefon Login:
Telefon Passwort:

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($user); + $password=strtoupper($pass); + $stmt="SELECT full_name,user_level from vicidial_users where user='$user' and pass='$pass'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIWÄHLEN|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIWÄHLEN|FAIL|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + } + +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 +echo "\n"; +echo "\n"; +echo "\n"; + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "astGUIclient web client: Telefon Login\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "
English Deutsch
\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Telefon Login
 
Telefon Login:
Telefon Passwort:

VERSION: $version       BUILD: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$authphone=$row[0]; +if (!$authphone) + { + echo "astGUIclient web client: Telefon Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Deutsch
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Telefon Login
 
Ihr Telefon Login ist nicht aktiv, bitte versuchen sie es noch einmal:
 
Telefon Login:
Telefon Passwort:

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "astGUIclient web client\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $phone_login=$row[6]; + $phone_pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CaLLerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + $outbound_cid=$row[65]; + + $local_web_callerID_URL_enc = rawurlencode($local_web_callerID_URL); + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtime$US$session_ext$session_rand"; + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'agc';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','agc','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT count(*) from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_present=$row[0]; + if ($favorites_present > 0) + { + $stmt="SELECT extensions_list from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_list=$row[0]; + $h=0; + $favorites_listX = eregi_replace("'",'',$favorites_list); + $favorites = explode(',',$favorites_listX); + $favorites_count = count($favorites); + $favorites_listX=''; + + $o=0; + while ($favorites_count > $o) + { + $stmt="SELECT fullname,protocol from phones where extension = '$favorites[$o]' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $favorites_names[$o] = $rowx[0]; + $favorites_listX .= "$rowx[1]/$favorites[$o],"; + $o++; + } + + echo "\n"; + echo "\n"; + } + else + { + echo "\n"; + } + +### gather phone extensions and fullnames for favorites editor ### + $stmt="SELECT extension,fullname from phones where server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $exten_ct = mysql_num_rows($rslt); + $favlistCT=0; + $nofavlistCT=0; + while ($favlistCT < $exten_ct) + { + $row=mysql_fetch_row($rslt); + $favlist[$favlistCT]= "$row[0] - $row[1]"; + $favlistCT++; + } + + } +} + + +?> + + + + + + +\n"; + + +?> + +
+ + + + + + + + + +
+ + +LOGOUT
\n"; ?> +
Haupt BedienfeldAktive Leitungen BedienfeldKonferenz BedienfeldVoicemail checkenLive Anruf
+
+ + +

Logout
+
+ + +
TRUNK AUFLEGEN

+ Active Trunks Menu
+ Amtsleitung auflegen   |   + Amtsleitung übernehmen   |   + Amtsleitung hören   |   + Aktualisieren   |   + Zurück zu Hauptfenster +
+
+ + +
LOKALES AUFLEGEN

+ Aktives Lokales Menü
+ Lokale Leitung auflegen   |   + Lokale Leitung übernehmen   |   + Lokale Leitung hören   |   + Aktualisieren   |   + Zurück zu Hauptfenster +
+
+ + + + + + + +
LIVE ANRUF WEITERLEITEN
Leitung, die verbunden werden soll: Kanal
Erweiterungen:
Extension Menü
+
+ Senden Sie an ausgewählte Extension

+ Senden Sie an ausgewählte Voicemalbox

+ Verbinden mit dieser Nummer:


+ Aktualisieren


+ Zurück zu Hauptfenster

+
Konferenzen:
(Klicken Sie unten auf eine Nummer, um mit einer Konferenz zu verbinden)
Meinen Kanal auch senden
Konferenz Menü
+
+ + + + + +
LOKALER Anruf über Extension
Telefon ruft an von: Kanal
Erweiterungen:
Extension Menü
+
+ Rufe ausgewählte Extension an

+ Rufe ausgewählte Voicemalbox an

+ Aktualisieren


+ Zurück zu Hauptfenster

+
+
+ + +
GEPARKTE ANRUFE:
+ Zurück zu Hauptfenster

+
+
+ + + + + + + + + + + + + + + +
  +
VOICEMAIL     NEU:     ALT:             MANUELLER ANRUF       WÄHLEN
GEPARKTE ANRUFE: 0                LOKALE ANRUF EXTENSIONS
OUTBOUND ANRUFE:
INBOUND ANRUFE:
astGUIclient Web-Client VERSION: BUILD:
+ + + + $h) + { + if (strlen($favorites[$h])>1) + { + echo "\n"; + } + $h++; + } +?> + +
FAVORITEN       bearbeiten
$favorites[$h] - $favorites_names[$h]
 
+
+ + + + + + + +
FAVORITEN

 
FAVORITEN ÄNDERUNGEN ÜBERNEHMEN - erfordert Logout
ZURÜCK ZUM HAUPTFENSTER - Änderungen verwerfen
+
+ +
+ + + + + + + + + + + + + +
+PAUSE | START     Aktualisierungsfrequenz: 1000 ms Schneller | Langsamer

+
Initialisierung..
+
Aktive Erweiterung
+AKTUALISIEREN | +BESTELLEN | +
Amtsleitungen
+AKTUALISIEREN | +BESTELLEN | +
Lokale Erweiterungen
+AKTUALISIEREN | +BESTELLEN | +
+ Daten kommen hier rein

+
+ Daten kommen hier rein

Amtsleitungs Aktion +
+ Daten kommen hier rein

Lokale Aktion +
+
+ + + + +
+ + +Konferenzliste + + + +
+Klicken Sie auf die Konferenzraumnummer links, für Informationen über die Konferenz +
+ + + + + + + + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/call_log_display.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/call_log_display.php new file mode 100644 index 00000000..42b10ec2 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/call_log_display.php @@ -0,0 +1,196 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "\n"; +echo "\n"; +echo "\n"; +echo "Anruf Log Anzeige"; +echo "\n"; +echo "\n"; +echo "\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";} + $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";} + $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"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/conf_exten_check.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/conf_exten_check.php new file mode 100644 index 00000000..f6d2cb2b --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/conf_exten_check.php @@ -0,0 +1,297 @@ + LICENSE: GPLv2 +# +# 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 +# + +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"];} + +$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";} + +$version = '2.0.4-12'; +$build = '71122-0205'; +$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";} + $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 "\n"; +echo "\n"; +echo "\n"; +echo "Konferenz Erweiterung überprüfen"; +echo "\n"; +echo "\n"; +echo "\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; + + ### 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); + $row=mysql_fetch_row($rslt); + $Acount=$row[0]; + + if ($Acount > 0) + { + $stmt="SELECT status from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Astatus=$row[0]; + } + # ### 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";} + $rslt=mysql_query($stmt, $link); + + if ($campagentstdisp == 'YES') + { + ### grab the status of this agent to display + $stmt="SELECT status,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Alogin=$row[0]; + $Acampaign=$row[1]; + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where server_ip='$server_ip' and status NOT IN('XFER') and campaign_id='$Acampaign';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $RingCalls=$row[0]; + } + else + { + $Alogin='N'; + $RingCalls='N'; + } + } + else + { + $Alogin='N'; + $RingCalls='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";} + $rslt=mysql_query($stmt, $link); + + } + + if ($Acount < 1) {$Alogin='DEAD_VLA';} + if ($AexternalDEAD > 0) {$Alogin='DEAD_EXTERNAL';} + + echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Status: ' . $Astatus . "|\n"; + + } + $total_conf=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + 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";} + } + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $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++; $total_conf++; + $row=mysql_fetch_row($rslt); + $KanalA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + } + $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";} + $rslt=mysql_query($stmt, $link); + } + echo "Konferenz $conf_exten wurde registriert bei $exten\n"; + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/dbconnect.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/dbconnect.php new file mode 100644 index 00000000..7221b35e --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/dbconnect.php @@ -0,0 +1,48 @@ + LICENSE: GPLv2 +# +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"); +mysql_select_db("$VARDB_database"); + +$local_DEF = 'Local/'; +$conf_silent_prefix = '7'; +$local_AMP = '@'; +$ext_context = 'demo'; +$recording_exten = '8309'; +$WeBRooTWritablE = '1'; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/inbound_popup.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/inbound_popup.php new file mode 100644 index 00000000..1d84f761 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/inbound_popup.php @@ -0,0 +1,351 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "\n"; +echo "\n"; +echo "\n"; +?> + + +LIVE INBOUND ANRUF"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "

LIVE INBOUND ANRUF

\n"; +echo "$NOW_TIME

\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 * FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $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";} + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Kanal: $row[1]
AnruferID: $row[3]
\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 "GOOGLE - \n"; + echo "ANYWHO - \n"; + echo "SWITCHBOARD - \n"; + echo "VERIZON - \n"; + echo "WHITEPAGES - \n"; + echo "411.COM - \n"; + echo "411.COM - \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 "ANGEPASST - \n"; + + echo "
Nummer Gewählt: $row[8]
Anmerkungen: $row[9]|$row[10]|$row[11]|$row[12]|$row[13]|
\n"; + echo "AUFLEGEN - \n"; + echo "SENDE AN MEINE VOICEMAILBOX\n"; + echo "
\n"; + + + $stmt="UPDATE live_inbound set acknowledged='Y' where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + + } + + + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/live_exten_check.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/live_exten_check.php new file mode 100644 index 00000000..1fb73011 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/live_exten_check.php @@ -0,0 +1,278 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "\n"; +echo "\n"; +echo "\n"; +echo "LIVE Erweiterung überprüfen"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + +echo "DateTime: $NOW_TIME|"; +echo "UnixTime: $StarTtime|"; + +$stmt="SELECT count(*) FROM parked_channels where server_ip = '$server_ip';"; + if ($format=='debug') {echo "\n";} +$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";} + $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";} + } + } + + $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";} + $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";} + $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";} + $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";} + $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";} +$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";} + } + +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";} + $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";} + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/manager_send.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/manager_send.php new file mode 100644 index 00000000..fcb79355 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/manager_send.php @@ -0,0 +1,1142 @@ + LICENSE: GPLv2 +# +# This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk 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: +# - $ACTION - ('Originate','Redirect','Hangup','Command','Monitor','StopMonitor','SysCIDOriginate','RedirectName','RedirectNameVmail','MonitorConf','StopMonitorConf','RedirectXtra','RedirectXtraCX','RedirectVD','HangupConfDial','VolumeControl','OriginateVDRelogin') +# - $queryCID - ('CN012345678901234567',...) +# - $format - ('text','debug') +# - $channel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +# - $exten - ('1234','913125551212',...) +# - $ext_context - ('default','demo',...) +# - $ext_priority - ('1','2',...) +# - $filename - ('20050406-125623_44444',...) +# - $extenName - ('phone100',...) +# - $parkedby - ('phone100',...) +# - $extrachannel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +# - $auto_dial_level - ('0','1','1.1',...) +# - $campaign - ('CLOSER','TESTCAMP',...) +# - $uniqueid - ('1120232758.2406800',...) +# - $lead_id - ('1234',...) +# - $seconds - ('32',...) +# - $outbound_cid - ('3125551212','0000000000',...) +# - $agent_log_id - ('123456',...) +# - $call_server_ip - ('10.10.10.15',...) +# - $CalLCID - ('VD01234567890123456',...) +# - $stage - ('UP','DOWN') +# + +# CHANGELOG: +# 50401-1002 - First build of script, Hangup function only +# 50404-1045 - Redirect basic function enabled +# 50406-1522 - Monitor basic function enabled +# 50407-1647 - Monitor and StopMonitor full functions enabled +# 50422-1120 - basic Originate function enabled +# 50428-1451 - basic SysCIDOriginate function enabled for checking voicemail +# 50502-1539 - basic RedirectName and RedirectNameVmail added +# 50503-1227 - added session_name checking for extra security +# 50523-1341 - added Conference call start/stop recording +# 50523-1421 - added OriginateName and OriginateNameVmail for local calls +# 50524-1602 - added RedirectToPark and RedirectFromPark +# 50531-1203 - added RedirecXtra for dual channel redirection +# 50630-1100 - script changed to not use HTTP login vars, user/pass instead +# 50804-1148 - Added RedirectVD for VICIDIAL blind redirection with logging +# 50815-1204 - Added NEXTAVAILABLE to RedirectXtra function +# 50903-2343 - Added HangupConfDial function to hangup in-dial channels in conf +# 50913-1057 - Added outbound_cid set if present to originate call +# 51020-1556 - Added agent_log_id framework for detailed agent activity logging +# 51118-1204 - Fixed Blind transfer bug from VICIDIAL when in manual dial mode +# 51129-1014 - Added ability to accept calls from other VICIDIAL servers +# 51129-1253 - Fixed Hangups of other agents channels in VICIDIAL AD +# 60310-2022 - Fixed NEXTAVAILABLE bug in leave-3way-call redirect function +# 60421-1413 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1158 - Added variable filters to close security holes for login form +# 60809-1544 - Added direct transfers to leave-3ways in consultative transfers +# 61004-1526 - Added parsing of volume control command and lookup or number +# 61130-1617 - Added lead_id to MonitorConf for recording_log +# 61201-1115 - Added user to MonitorConf for recording_log +# 70111-1600 - added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70226-1251 - Added Mute/UnMute to conference volume control +# 70320-1502 - Added option to allow retry of leave-3way-call and debug logging +# 70322-1636 - Added sipsak display ability +# + +require("dbconnect.php"); + +### These are variable assignments for PHP globals off +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["ACTION"])) {$ACTION=$_GET["ACTION"];} + elseif (isset($_POST["ACTION"])) {$ACTION=$_POST["ACTION"];} +if (isset($_GET["queryCID"])) {$queryCID=$_GET["queryCID"];} + elseif (isset($_POST["queryCID"])) {$queryCID=$_POST["queryCID"];} +if (isset($_GET["format"])) {$format=$_GET["format"];} + elseif (isset($_POST["format"])) {$format=$_POST["format"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["exten"])) {$exten=$_GET["exten"];} + elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];} +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["filename"])) {$filename=$_GET["filename"];} + elseif (isset($_POST["filename"])) {$filename=$_POST["filename"];} +if (isset($_GET["extenName"])) {$extenName=$_GET["extenName"];} + elseif (isset($_POST["extenName"])) {$extenName=$_POST["extenName"];} +if (isset($_GET["parkedby"])) {$parkedby=$_GET["parkedby"];} + elseif (isset($_POST["parkedby"])) {$parkedby=$_POST["parkedby"];} +if (isset($_GET["extrachannel"])) {$extrachannel=$_GET["extrachannel"];} + elseif (isset($_POST["extrachannel"])) {$extrachannel=$_POST["extrachannel"];} +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["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} + elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["secondS"])) {$secondS=$_GET["secondS"];} + elseif (isset($_POST["secondS"])) {$secondS=$_POST["secondS"];} +if (isset($_GET["outbound_cid"])) {$outbound_cid=$_GET["outbound_cid"];} + elseif (isset($_POST["outbound_cid"])) {$outbound_cid=$_POST["outbound_cid"];} +if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];} + elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];} +if (isset($_GET["call_server_ip"])) {$call_server_ip=$_GET["call_server_ip"];} + elseif (isset($_POST["call_server_ip"])) {$call_server_ip=$_POST["call_server_ip"];} +if (isset($_GET["CalLCID"])) {$CalLCID=$_GET["CalLCID"];} + elseif (isset($_POST["CalLCID"])) {$CalLCID=$_POST["CalLCID"];} +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["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} +if (isset($_GET["phone_ip"])) {$phone_ip=$_GET["phone_ip"];} + elseif (isset($_POST["phone_ip"])) {$phone_ip=$_POST["phone_ip"];} +if (isset($_GET["enable_sipsak_messages"])) {$enable_sipsak_messages=$_GET["enable_sipsak_messages"];} + elseif (isset($_POST["enable_sipsak_messages"])) {$enable_sipsak_messages=$_POST["enable_sipsak_messages"];} +if (isset($_GET["allow_sipsak_messages"])) {$allow_sipsak_messages=$_GET["allow_sipsak_messages"];} + elseif (isset($_POST["allow_sipsak_messages"])) {$allow_sipsak_messages=$_POST["allow_sipsak_messages"];} + +$user=ereg_replace("[^0-9a-zA-Z]","",$user); +$pass=ereg_replace("[^0-9a-zA-Z]","",$pass); +$secondS = ereg_replace("[^0-9]","",$secondS); + +# default optional vars if not set +if (!isset($ACTION)) {$ACTION="Originate";} +if (!isset($format)) {$format="alert";} +if (!isset($ext_priority)) {$ext_priority="1";} + +$version = '2.0.29'; +$build = '70320-1502'; +$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 "\n"; +echo "\n"; +echo "\n"; +echo "Manager Senden: "; +if ($ACTION=="Originate") {echo "Originate";} +if ($ACTION=="Redirect") {echo "Redirect";} +if ($ACTION=="RedirectName") {echo "RedirectName";} +if ($ACTION=="Hangup") {echo "Hangup";} +if ($ACTION=="Command") {echo "Command";} +if ($ACTION==99999) {echo "HILFE";} +echo "\n"; +echo "\n"; +echo "\n"; +} + + + + + +###################### +# ACTION=SysCIDOriginate - insert Originate Manager statement allowing small CIDs for system calls +###################### +if ($ACTION=="SysCIDOriginate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<1) ) + { + echo "Exten $exten ist unzulässig or queryCID $queryCID ist unzulässig, Originate Befehl nicht eingesetzt\n"; + } + else + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate Befehl gesendet um Exten $exten Kanal $channel an $server_ip\n"; + } +} + + + +###################### +# ACTION=Originate, OriginateName, OriginateNameVmail - insert Originate Manager statement +###################### +if ($ACTION=="OriginateName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Eine dieser Variablen ist unzulässig:\n"; + echo "Kanal $channel muss länger als 2 Buchstaben sein\n"; + echo "queryCID $queryCID muss länger als 14 Buchstaben sein\n"; + echo "extenName $extenName muß eingestellt werden\n"; + echo "ext_context $ext_context muß eingestellt werden\n"; + echo "ext_priority $ext_priority muß eingestellt werden\n"; + echo "\nOriginateName Action nicht gesendet\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="OriginateNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Eine dieser Variablen ist unzulässig:\n"; + echo "Kanal $channel muss länger als 2 Buchstaben sein\n"; + echo "queryCID $queryCID muss länger als 14 Buchstaben sein\n"; + echo "extenName $extenName muß eingestellt werden\n"; + echo "exten $exten muß eingestellt werden\n"; + echo "ext_context $ext_context muß eingestellt werden\n"; + echo "ext_priority $ext_priority muß eingestellt werden\n"; + echo "\nOriginateNameVmail Action nicht gesendet\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="OriginateVDRelogin") +{ + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $CIDdate = date("ymdHis"); + $DS='-'; + $SIPSAK_prefix = 'LIN-'; + print "\n"; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$campaign\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + $queryCID = "$SIPSAK_prefix$campaign$DS$CIDdate"; + + } + $ACTION="Originate"; +} + +if ($ACTION=="Originate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<10) ) + { + echo "Exten $exten ist unzulässig or queryCID $queryCID ist unzulässig, Originate Befehl nicht eingesetzt\n"; + } + else + { + if (strlen($outbound_cid)>1) + {$outCID = "\"$queryCID\" <$outbound_cid>";} + else + {$outCID = "$queryCID";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate Befehl gesendet um Exten $exten Kanal $channel an $server_ip\n"; + } +} + + + +###################### +# ACTION=HangupConfDial - find the Local channel that is in the conference and needs to be hung up +###################### +if ($ACTION=="HangupConfDial") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($queryCID)<15) or (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "conference $exten ist unzulässig or ext_context $ext_context or queryCID $queryCID ist unzulässig, Hangup Befehl nicht eingesetzt\n"; + } + else + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $hangup_channel_prefix = "$local_DEF$exten$local_AMP$ext_context"; + + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row > 0) + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $channel=$rowx[0]; + $ACTION="Hangup"; + $queryCID = eregi_replace("^.","G",$queryCID); + } + } +} + + + +###################### +# ACTION=Hangup - insert Hangup Manager statement +###################### +if ($ACTION=="Hangup") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) ) + { + $channel_live=0; + echo "Kanal $channel ist unzulässig or queryCID $queryCID ist unzulässig, Hangup Befehl nicht eingesetzt\n"; + } + else + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + +# $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# if ($row[0]==0) +# { +# $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $rowx=mysql_fetch_row($rslt); +# if ($rowx[0]==0) +# { +# $channel_live=0; +# echo "Channel $channel is not live on $call_server_ip, Hangup command not inserted\n"; +# } +# } + if ( ($auto_dial_level > 0) and (strlen($CalLCID)>2) and (strlen($exten)>2) and ($secondS > 4)) + { + $stmt="SELECT count(*) FROM vicidial_auto_calls where channel='$channel' and callerid='$CalLCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + echo "Call $CalLCID $channel ist nicht Live an $call_server_ip, Checking Live Kanal...\n"; + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel' and extension LIKE \"%$exten\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $channel_live=0; + echo "Kanal $channel ist nicht Live an $call_server_ip, Hangup Befehl nicht eingesetzt $rowx[0]\n$stmt\n"; + } + else + { + echo "$stmt\n"; + } + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Hangup','$queryCID','Channel: $channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Hangup Befehl gesendet um Kanal $channel an $call_server_ip\n"; + } + } +} + + + +###################### +# ACTION=Redirect, RedirectName, RedirectNameVmail, RedirectToPark, RedirectFromPark, RedirectVD, RedirectXtra, RedirectXtraCX +# - insert Redirect Manager statement using extensions name +###################### +if ($ACTION=="RedirectVD") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($campaign)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($uniqueid)<2) or (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "Eine dieser Variablen ist unzulässig:\n"; + echo "Kanal $channel muss länger als 2 Buchstaben sein\n"; + echo "queryCID $queryCID muss länger als 14 Buchstaben sein\n"; + echo "exten $exten muß eingestellt werden\n"; + echo "ext_context $ext_context muß eingestellt werden\n"; + echo "ext_priority $ext_priority muß eingestellt werden\n"; + echo "auto_dial_level $auto_dial_level muß eingestellt werden\n"; + echo "campaign $campaign muß eingestellt werden\n"; + echo "uniqueid $uniqueid muß eingestellt werden\n"; + echo "lead_id $lead_id muß eingestellt werden\n"; + echo "\nRedirectVD Action nicht gesendet\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($auto_dial_level < 1) + { + $stmt = "UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectToPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($parkedby)<1) ) + { + $channel_live=0; + echo "Eine dieser Variablen ist unzulässig:\n"; + echo "Kanal $channel muss länger als 2 Buchstaben sein\n"; + echo "queryCID $queryCID muss länger als 14 Buchstaben sein\n"; + echo "exten $exten muß eingestellt werden\n"; + echo "extenName $extenName muß eingestellt werden\n"; + echo "ext_context $ext_context muß eingestellt werden\n"; + echo "ext_priority $ext_priority muß eingestellt werden\n"; + echo "parkedby $parkedby muß eingestellt werden\n"; + echo "\nRedirectToPark Action nicht gesendet\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "INSERT INTO parked_channels values('$channel','$server_ip','','$extenName','$parkedby','$NOW_TIME');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectFromPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Eine dieser Variablen ist unzulässig:\n"; + echo "Kanal $channel muss länger als 2 Buchstaben sein\n"; + echo "queryCID $queryCID muss länger als 14 Buchstaben sein\n"; + echo "exten $exten muß eingestellt werden\n"; + echo "ext_context $ext_context muß eingestellt werden\n"; + echo "ext_priority $ext_priority muß eingestellt werden\n"; + echo "\nRedirectFromPark Action nicht gesendet\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "DELETE FROM parked_channels where server_ip='$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Eine dieser Variablen ist unzulässig:\n"; + echo "Kanal $channel muss länger als 2 Buchstaben sein\n"; + echo "queryCID $queryCID muss länger als 14 Buchstaben sein\n"; + echo "extenName $extenName muß eingestellt werden\n"; + echo "ext_context $ext_context muß eingestellt werden\n"; + echo "ext_priority $ext_priority muß eingestellt werden\n"; + echo "\nRedirectName Action nicht gesendet\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Eine dieser Variablen ist unzulässig:\n"; + echo "Kanal $channel muss länger als 2 Buchstaben sein\n"; + echo "queryCID $queryCID muss länger als 14 Buchstaben sein\n"; + echo "extenName $extenName muß eingestellt werden\n"; + echo "exten $exten muß eingestellt werden\n"; + echo "ext_context $ext_context muß eingestellt werden\n"; + echo "ext_priority $ext_priority muß eingestellt werden\n"; + echo "\nRedirectNameVmail Action nicht gesendet\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectXtraCX") +{ + $DBout=''; + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "Eine dieser Variablen ist unzulässig:\n"; + echo "Kanal $channel muss länger als 2 Buchstaben sein\n"; + echo "ExtraKanal $extrachannel muss länger als 2 Buchstaben sein\n"; + echo "queryCID $queryCID muss länger als 14 Buchstaben sein\n"; + echo "exten $exten muß eingestellt werden\n"; + echo "ext_context $ext_context muß eingestellt werden\n"; + echo "ext_priority $ext_priority muß eingestellt werden\n"; + echo "\nRedirect Action nicht gesendet\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDCXC|$filename|$user|$campaign|$channel|$extrachannel|$queryCID|$exten|$ext_context|ext_priority|\n"); + fclose($fp); + } + } + } + else + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Kanal $channel ist nicht Live an $call_server_ip, Redirect Befehl nicht eingesetzt\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel ist nicht Live an $call_server_ip";} + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Kanal $channel ist nicht Live an $server_ip, Redirect Befehl nicht eingesetzt\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel ist nicht Live an $server_ip";} + } + } + if ( ($channel_liveX==1) && ($channel_liveY==1) ) + { + $stmt="SELECT count(*) FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0] < 1) + { + $channel_liveY=0; + echo "No Local agent to send call to, Redirect Befehl nicht eingesetzt\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "No Local agent to send call to";} + } + else + { + $stmt="SELECT server_ip,conf_exten,user FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $dest_server_ip = $rowx[0]; + $dest_session_id = $rowx[1]; + $dest_user = $rowx[2]; + $S='*'; + + $D_s_ip = explode('.', $dest_server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$dest_session_id$S$lead_id$S$dest_user$S$phone_code$S$phone_number$S$campaign$S"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','$queryCID','Channel: $extrachannel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtraCX Befehl gesendet um Kanal $channel an $call_server_ip and \nHungup $extrachannel an $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel an $call_server_ip, Hungup $extrachannel an $server_ip";} + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "Changed to Redirect: $channel an $server_ip";} + } + + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDCXC|$filename|$user|$campaign|$DBout|\n"); + fclose($fp); + } + } + + } +} + +if ($ACTION=="RedirectXtra") +{ + if ($channel=="$extrachannel") + {$ACTION="Redirect";} + else + { + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "Eine dieser Variablen ist unzulässig:\n"; + echo "Kanal $channel muss länger als 2 Buchstaben sein\n"; + echo "ExtraKanal $extrachannel muss länger als 2 Buchstaben sein\n"; + echo "queryCID $queryCID muss länger als 14 Buchstaben sein\n"; + echo "exten $exten muß eingestellt werden\n"; + echo "ext_context $ext_context muß eingestellt werden\n"; + echo "ext_priority $ext_priority muß eingestellt werden\n"; + echo "\nRedirect Action nicht gesendet\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDX|$filename|$user|$campaign|$$channel|$extrachannel|$queryCID|$exten|$ext_context|ext_priority|\n"); + fclose($fp); + } + } + } + else + { + if ($exten == "NEXTAVAILABLE") + { + $stmt="SELECT conf_exten FROM conferences where server_ip='$server_ip' and ((extension='') or (extension is null)) limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if (strlen($row[0]) > 3) + { + $stmt="UPDATE conferences set extension='$user' where server_ip='$server_ip' and conf_exten='$row[0]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $exten = $row[0]; + } + else + { + $channel_liveX=0; + echo "Kann keine leere Konferenz finden an $server_ip, Redirect Befehl nicht eingesetzt\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "Kann keine leere Konferenz finden an $server_ip";} + } + } + + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Kanal $channel ist nicht Live an $call_server_ip, Redirect Befehl nicht eingesetzt\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel ist nicht Live an $call_server_ip";} + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Kanal $channel ist nicht Live an $server_ip, Redirect Befehl nicht eingesetzt\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel ist nicht Live an $server_ip";} + } + } + if ( ($channel_liveX==1) && ($channel_liveY==1) ) + { + if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','ExtraChannel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra Befehl gesendet um Kanal $channel and \nExtraKanal $extrachannel\n to $exten an $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel and $extrachannel to $exten an $server_ip";} + } + else + { + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$exten"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra Befehl gesendet um Kanal $channel an $call_server_ip and \nExtraKanal $extrachannel\n to $exten an $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel/$call_server_ip and $extrachannel/$server_ip to $exten";} + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + + } + + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDX|$filename|$user|$campaign|$DBout|\n"); + fclose($fp); + } + } + + } + } +} + + +if ($ACTION=="Redirect") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Eine dieser Variablen ist unzulässig:\n"; + echo "Kanal $channel muss länger als 2 Buchstaben sein\n"; + echo "queryCID $queryCID muss länger als 14 Buchstaben sein\n"; + echo "exten $exten muß eingestellt werden\n"; + echo "ext_context $ext_context muß eingestellt werden\n"; + echo "ext_priority $ext_priority muß eingestellt werden\n"; + echo "\nRedirect Action nicht gesendet\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Kanal $channel ist nicht Live an $server_ip, Redirect Befehl nicht eingesetzt\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "Redirect Befehl gesendet um Kanal $channel an $server_ip\n"; + } + } +} + + + +###################### +# ACTION=Monitor or Stop Monitor - insert Monitor/StopMonitor Manager statement to start recording on a channel +###################### +if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) +{ + if ($ACTION=="StopMonitor") + {$SQLfile = "";} + else + {$SQLfile = "File: $filename";} + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Kanal $channel ist unzulässig or queryCID $queryCID ist unzulässig or filename: $filename ist unzulässig, $ACTION Befehl nicht eingesetzt\n"; + } + else + { + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Kanal $channel ist nicht Live an $server_ip, $ACTION Befehl nicht eingesetzt\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','$ACTION','$queryCID','Channel: $channel','$SQLfile','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + if ($ACTION=="Monitor") + { + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + } + echo "$ACTION Befehl gesendet um Kanal $channel an $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n"; + } + } +} + + + + + + +###################### +# ACTION=MonitorConf or StopMonitorConf - insert Monitor/StopMonitor Manager statement to start recording on a conference +###################### +if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($channel)<4) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Kanal $channel ist unzulässig or exten $exten ist unzulässig or filename: $filename ist unzulässig, $ACTION Befehl nicht eingesetzt\n"; + } + else + { + + if ($ACTION=="MonitorConf") + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$filename','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $filename','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + # find and hang up all recordings going an in this conference # and extension = '$exten' + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$channel%\" and channel LIKE \"%,1\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + # $rec_count = intval(mysql_num_rows($rslt) / 2); + $rec_count = mysql_num_rows($rslt); + $h=0; + while ($rec_count>$h) + { + $rowx=mysql_fetch_row($rslt); + $HUchannel[$h] = $rowx[0]; + $h++; + } + $i=0; + while ($h>$i) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$i','Channel: $HUchannel[$i]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $i++; + } + + } + echo "$ACTION Befehl gesendet um Kanal $channel an $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n AUFNAHME DAUERT BIS ZU 60 MINUTEN\n"; + } +} + + + + + +###################### +# ACTION=VolumeControl - raise or lower the volume of a meetme participant +###################### +if ($ACTION=="VolumeControl") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($stage)<1) or (strlen($queryCID)<1) ) + { + echo "Konferenz $exten, Stage $stage ist unzulässig or queryCID $queryCID ist unzulässig, Originate Befehl nicht eingesetzt\n"; + } + else + { + $participant_number='XXYYXXYYXXYYXX'; + if (eregi('UP',$stage)) {$vol_prefix='4';} + if (eregi('DOWN',$stage)) {$vol_prefix='3';} + if (eregi('UNMUTE',$stage)) {$vol_prefix='2';} + if (eregi('MUTING',$stage)) {$vol_prefix='1';} + $local_DEF = 'Local/'; + $local_AMP = '@'; + $volume_local_channel = "$local_DEF$participant_number$vol_prefix$exten$local_AMP$ext_context"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $volume_local_channel','Context: $ext_context','Exten: 8300','Priority: 1','Callerid: $queryCID','','','','$channel','$exten');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Volume Befehl gesendet um Konferenz $exten, Stage $stage Kanal $channel an $server_ip\n"; + } +} + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='debug') {echo "\n";} +if ($format=='debug') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/park_calls_display.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/park_calls_display.php new file mode 100644 index 00000000..044634c8 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/park_calls_display.php @@ -0,0 +1,146 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "\n"; +echo "\n"; +echo "\n"; +echo "Geparkte Anruf anzeigen"; +echo "\n"; +echo "\n"; +echo "\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 * from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;"; + if ($format=='debug') {echo "\n";} + $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"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/vdc_db_query.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/vdc_db_query.php new file mode 100644 index 00000000..f40fd378 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/vdc_db_query.php @@ -0,0 +1,2535 @@ + LICENSE: GPLv2 +# +# 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 - ('regCLOSER','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCALL','manDiaLlogCALL','userLOGout','updateDISPO','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs','CalLBacKLisT','CalLBacKCounT','PauseCodeSubmit','LogiNCamPaigns') +# - $stage - ('start','finish','lookup','new') +# - $closer_choice - ('CL_TESTCAMP_L CL_OUT123_L -') +# - $conf_exten - ('8600011',...) +# - $exten - ('123test',...) +# - $ext_context - ('default','demo',...) +# - $ext_priority - ('1','2',...) +# - $campaign - ('testcamp',...) +# - $dial_timeout - ('60','26',...) +# - $dial_prefix - ('9','8',...) +# - $campaign_cid - ('3125551212','0000000000',...) +# - $MDnextCID - ('M06301413000000002',...) +# - $uniqueid - ('1120232758.2406800',...) +# - $lead_id - ('36524',...) +# - $list_id - ('101','123456',...) +# - $length_in_sec - ('12',...) +# - $phone_code - ('1',...) +# - $phone_number - ('3125551212',...) +# - $channel - ('Zap/12-1',...) +# - $start_epoch - ('1120236911',...) +# - $vendor_lead_code - ('1234test',...) +# - $title - ('Mr.',...) +# - $first_name - ('Bob',...) +# - $middle_initial - ('L',...) +# - $last_name - ('Wilson',...) +# - $address1 - ('1324 Main St.',...) +# - $address2 - ('Apt. 12',...) +# - $address3 - ('co Robert Wilson',...) +# - $city - ('Chicago',...) +# - $state - ('IL',...) +# - $province - ('NA',...) +# - $postal_code - ('60054',...) +# - $country_code - ('USA',...) +# - $gender - ('M',...) +# - $date_of_birth - ('1970-01-01',...) +# - $alt_phone - ('3125551213',...) +# - $email - ('bob@bob.com',...) +# - $security_phrase - ('Hello',...) +# - $comments - ('Good Customer',...) +# - $auto_dial_level - ('0','1','1.2',...) +# - $VDstop_rec_after_each_call - ('0','1') +# - $conf_silent_prefix - ('7','8','',...) +# - $extension - ('123','user123','25-1',...) +# - $protocol - ('Zap','SIP','IAX2',...) +# - $user_abb - ('1234','6666',...) +# - $preview - ('YES','NO',...) +# - $called_count - ('0','1','2',...) +# - $agent_log_id - ('123456',...) +# - $agent_log - ('NO',...) +# - $favorites_list - (",'cc160','cc100'",...) +# - $CallBackDatETimE - ('2006-04-21 14:30:00',...) +# - $recipient - ('ANYONE,'USERONLY') +# - $callback_id - ('12345','12346',...) +# - $use_internal_dnc - ('Y','N') +# - $omit_phone_code - ('Y','N') +# - $no_delete_sessions - ('0','1') + +# CHANGELOG: +# 50629-1044 - First build of script +# 50630-1422 - Added manual dial action and MD channel lookup +# 50701-1451 - Added dial log for start and end of vicidial calls +# 50705-1239 - Added call disposition update +# 50804-1627 - Fixed updateDispo to update vicidial_log entry +# 50816-1605 - Added VDADpause/ready for auto dialing +# 50816-1811 - Added basic autodial call pickup functions +# 50817-1005 - Altered logging functions to accomodate auto_dialing +# 50818-1305 - Added stop-all-recordings-after-each-vicidial-call option +# 50818-1411 - Added hangup of agent phone after Logout +# 50901-1315 - Fixed CLOSER IN-GROUP Web Form bug +# 50902-1507 - Fixed CLOSER log length_in_sec bug +# 50902-1730 - Added functions for manual preview dialing and revert +# 50913-1214 - Added agent random update to leadupdate +# 51020-1421 - Added agent_log_id framework for detailed agent activity logging +# 51021-1717 - Allows for multi-line comments (changes \n to !N in database) +# 51111-1046 - Added vicidial_agent_log lead_id earlier for manual dial +# 51121-1445 - Altered echo statements for several small PHP speed optimizations +# 51122-1328 - Fixed UserLogout issue not removing conference reservation +# 51129-1012 - Added ability to accept calls from other VICIDIAL servers +# 51129-1729 - Changed manual dial to use the '/n' flag for calls +# 51221-1154 - Added SCRIPT id lookup and sending to vicidial.php for display +# 60105-1059 - Added Updating of astguiclient favorites in the DB +# 60208-1617 - Added dtmf buttons output per call +# 60213-1521 - Added closer_campaigns update to vicidial_users +# 60215-1036 - Added Callback date-time entry into vicidial_callbacks table +# 60413-1541 - Added USERONLY Callback listings output - CalLBacKLisT +# - Added USERONLY Callback count output - CalLBacKCounT +# 60414-1140 - Added Callback lead lookup for manual dialing +# 60419-1517 - After CALLBK is sent to agent, update callback record to INACTIVE +# 60421-1419 - Check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60427-1236 - Fixed closer_choice error for CLOSER campaigns +# 60609-1148 - Added ability to check for manual dial numbers in DNC +# 60619-1117 - Added variable filters to close security holes for login form +# 60623-1414 - Fixed variable filter for phone_code and fixed manual dial logic +# 60821-1600 - Added ability to omit the phone code on vicidial lead dialing +# 60821-1647 - Added ability to not delete sessions at logout +# 60906-1124 - Added lookup and sending of callback data for CALLBK calls +# 61128-2229 - Added vicidial_live_agents and vicidial_auto_calls manual dial entries +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70115-1733 - Added alt_dial functionality in auto-dial modes +# 70118-1501 - Added user_group to vicidial_log,_agent_log,_closer_log,_callbacks +# 70123-1357 - Fixed bug that would not update vicidial_closer_log status to dispo +# 70202-1438 - Added pause code submit function +# 70203-0930 - Added dialed_number to lead info output +# 70203-1030 - Added dialed_label to lead info output +# 70206-1126 - Added INBOUND status for inbound/closer calls in vicidial_live_agents +# 70212-1253 - Fixed small issue with CXFER +# 70213-1431 - Added QueueMetrics PAUSE/UNPAUSE/AGENTLOGIN/AGENTLOGOFF actions +# 70214-1231 - Added queuemetrics_log_id field for server_id in queue_log +# 70215-1210 - Added queuemetrics COMPLETEAGENT action +# 70216-1051 - Fixed double call complete queuemetrics logging +# 70222-1616 - Changed queue_log PAUSE/UNPAUSE to PAUSEALL/UNPAUSEALL +# 70309-1034 - Allow amphersands and questions marks in comments to pass through +# 70313-1052 - Allow pound signs(hash) in comments to pass through +# 70319-1544 - Added agent disable update customer data function +# 70322-1545 - Added sipsak display ability +# 70413-1253 - Fixed bug for outbound call time in CLOSER-type blended campaigns +# 70424-1100 - Fixed bug for fronter/closer calls that would delete vdac records +# 70802-1729 - Fixed bugs with pause_sec and wait_sec under certain call handling +# 70828-1443 - Added source_id to output of SCRIPTtab-IFRAME and WEBFORM +# 71029-1855 - removed campaign_id naming restrictions for CLOSER-type campaigns +# 71030-2047 - added hopper priority for auto alt dial entries +# 71116-1011 - added calls_today count updating of the vicidial_live_agents upon INCALL +# 71120-1520 - added LogiNCamPaigns to show only allowed campaigns for agents upon login +# 71125-1751 - Added inbound-group default inbound group sending to vicidial.php +# 71129-2025 - restricted callbacks count and list to campaign only +# + +$version = '2.0.4-65'; +$build = '71129-2025'; + +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["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["closer_choice"])) {$closer_choice=$_GET["closer_choice"];} + elseif (isset($_POST["closer_choice"])) {$closer_choice=$_POST["closer_choice"];} +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["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["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["dial_timeout"])) {$dial_timeout=$_GET["dial_timeout"];} + elseif (isset($_POST["dial_timeout"])) {$dial_timeout=$_POST["dial_timeout"];} +if (isset($_GET["dial_prefix"])) {$dial_prefix=$_GET["dial_prefix"];} + elseif (isset($_POST["dial_prefix"])) {$dial_prefix=$_POST["dial_prefix"];} +if (isset($_GET["campaign_cid"])) {$campaign_cid=$_GET["campaign_cid"];} + elseif (isset($_POST["campaign_cid"])) {$campaign_cid=$_POST["campaign_cid"];} +if (isset($_GET["MDnextCID"])) {$MDnextCID=$_GET["MDnextCID"];} + elseif (isset($_POST["MDnextCID"])) {$MDnextCID=$_POST["MDnextCID"];} +if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} + elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["length_in_sec"])) {$length_in_sec=$_GET["length_in_sec"];} + elseif (isset($_POST["length_in_sec"])) {$length_in_sec=$_POST["length_in_sec"];} +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["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["start_epoch"])) {$start_epoch=$_GET["start_epoch"];} + elseif (isset($_POST["start_epoch"])) {$start_epoch=$_POST["start_epoch"];} +if (isset($_GET["dispo_choice"])) {$dispo_choice=$_GET["dispo_choice"];} + elseif (isset($_POST["dispo_choice"])) {$dispo_choice=$_POST["dispo_choice"];} +if (isset($_GET["vendor_lead_code"])) {$vendor_lead_code=$_GET["vendor_lead_code"];} + elseif (isset($_POST["vendor_lead_code"])) {$vendor_lead_code=$_POST["vendor_lead_code"];} +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["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["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_GET["VDstop_rec_after_each_call"];} + elseif (isset($_POST["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_POST["VDstop_rec_after_each_call"];} +if (isset($_GET["conf_silent_prefix"])) {$conf_silent_prefix=$_GET["conf_silent_prefix"];} + elseif (isset($_POST["conf_silent_prefix"])) {$conf_silent_prefix=$_POST["conf_silent_prefix"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} +if (isset($_GET["user_abb"])) {$user_abb=$_GET["user_abb"];} + elseif (isset($_POST["user_abb"])) {$user_abb=$_POST["user_abb"];} +if (isset($_GET["preview"])) {$preview=$_GET["preview"];} + elseif (isset($_POST["preview"])) {$preview=$_POST["preview"];} +if (isset($_GET["called_count"])) {$called_count=$_GET["called_count"];} + elseif (isset($_POST["called_count"])) {$called_count=$_POST["called_count"];} +if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];} + elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];} +if (isset($_GET["agent_log"])) {$agent_log=$_GET["agent_log"];} + elseif (isset($_POST["agent_log"])) {$agent_log=$_POST["agent_log"];} +if (isset($_GET["favorites_list"])) {$favorites_list=$_GET["favorites_list"];} + elseif (isset($_POST["favorites_list"])) {$favorites_list=$_POST["favorites_list"];} +if (isset($_GET["CallBackDatETimE"])) {$CallBackDatETimE=$_GET["CallBackDatETimE"];} + elseif (isset($_POST["CallBackDatETimE"])) {$CallBackDatETimE=$_POST["CallBackDatETimE"];} +if (isset($_GET["recipient"])) {$recipient=$_GET["recipient"];} + elseif (isset($_POST["recipient"])) {$recipient=$_POST["recipient"];} +if (isset($_GET["callback_id"])) {$callback_id=$_GET["callback_id"];} + elseif (isset($_POST["callback_id"])) {$callback_id=$_POST["callback_id"];} +if (isset($_GET["use_internal_dnc"])) {$use_internal_dnc=$_GET["use_internal_dnc"];} + elseif (isset($_POST["use_internal_dnc"])) {$use_internal_dnc=$_POST["use_internal_dnc"];} +if (isset($_GET["omit_phone_code"])) {$omit_phone_code=$_GET["omit_phone_code"];} + elseif (isset($_POST["omit_phone_code"])) {$omit_phone_code=$_POST["omit_phone_code"];} +if (isset($_GET["phone_ip"])) {$phone_ip=$_GET["phone_ip"];} + elseif (isset($_POST["phone_ip"])) {$phone_ip=$_POST["phone_ip"];} +if (isset($_GET["enable_sipsak_messages"])) {$enable_sipsak_messages=$_GET["enable_sipsak_messages"];} + elseif (isset($_POST["enable_sipsak_messages"])) {$enable_sipsak_messages=$_POST["enable_sipsak_messages"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} + + +$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); + + +# default optional vars if not set +if (!isset($format)) {$format="text";} + if ($format == 'debug') {$DB=1;} +if (!isset($ACTION)) {$ACTION="refresh";} + +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$CIDdate = date("mdHis"); +$ENTRYdate = date("YmdHis"); +if (!isset($query_date)) {$query_date = $NOW_DATE;} +$MT[0]=''; +$agents='@agents'; + +if ($ACTION == 'LogiNCamPaigns') + { + $skip_user_validation=1; + } +else + { + $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 "\n"; +echo "\n"; +echo "\n"; +echo "VICIDiaL Datenbank-Abfrage Script"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + +################################################################################ +### LogiNCamPaigns - generates an HTML SELECT list of allowed campaigns for a +### specific agent on the login screen +################################################################################ +if ($ACTION == 'LogiNCamPaigns') +{ + if ( (strlen($user)<1) ) + { + echo "\n"; + exit; + } + else + { + echo "\n"; + exit; + } +} + + + +################################################################################ +### regCLOSER - update the vicidial_live_agents table to reflect the closer +### inbound choices made upon login +################################################################################ +if ($ACTION == 'regCLOSER') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($closer_choice)<1) || (strlen($user)<1) ) + { + $channel_live=0; + echo "Gruppe Wählen $closer_choice ist unzulässig\n"; + exit; + } + else + { + if ($closer_choice == "MGRLOCK-") + { + $stmt="SELECT closer_campaigns FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $closer_choice =$row[0]; + + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_users set closer_campaigns='$closer_choice' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $in_groups_pre = preg_replace('/-$/','',$closer_choice); + $in_groups = explode(" ",$in_groups_pre); + $in_groups_ct = count($in_groups); + $k=1; + while ($k < $in_groups_ct) + { + if (strlen($in_groups[$k])>1) + { + $stmt="SELECT group_weight,calls_today FROM vicidial_inbound_group_agents where user='$user' and group_id='$in_groups[$k]';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $viga_ct = mysql_num_rows($rslt); + if ($viga_ct > 0) + { + $row=mysql_fetch_row($rslt); + $group_weight = $row[0]; + $calls_today = $row[1]; + } + else + { + $group_weight = 0; + $calls_today = 0; + } + $stmt="INSERT INTO vicidial_live_inbound_agents set user='$user',group_id='$in_groups[$k]',group_weight='$group_weight',calls_today='$calls_today',last_call_time='$NOW_TIME',last_call_finish='$NOW_TIME';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + $k++; + } + + } + echo "Closer In Gruppe Wählen $closer_choice ist beim Benutzer registriert worden $user\n"; +} + + +################################################################################ +### manDiaLnextCALL - for manual VICIDiaL dialing this will grab the next lead +### in the campaign, reserve it, send data back to client and +### place the call by inserting into vicidial_manager +################################################################################ +if ($ACTION == 'manDiaLnextCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "HOPPER LEER\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context ist unzulässig\n"; + exit; + } + else + { + + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### check if this is a callback, if it is, skip the grabbing of a new lead and mark the callback as INACTIVE + if ( (strlen($callback_id)>0) and (strlen($lead_id)>0) ) + { + $affected_rows=1; + $CBleadIDset=1; + + $stmt = "UPDATE vicidial_callbacks set status='INACTIVE' where callback_id='$callback_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + if (strlen($phone_number)>3) + { + if ($use_internal_dnc=='Y') + { + $stmt="SELECT count(*) FROM vicidial_dnc where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + echo "DNC NUMMER\n"; + exit; + } + } + if ($stage=='lookup') + { + $stmt="SELECT lead_id FROM vicidial_list where phone_number='$phone_number' order by modify_date desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $man_leadID_ct = mysql_num_rows($rslt); + if ($man_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $affected_rows=1; + $lead_id =$row[0]; + $CBleadIDset=1; + } + else + { + ### insert a new lead in the system with this phone number + $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $lead_id = mysql_insert_id($link); + $CBleadIDset=1; + } + } + else + { + ### insert a new lead in the system with this phone number + $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $lead_id = mysql_insert_id($link); + $CBleadIDset=1; + } + } + else + { + ### grab the next lead in the hopper for this campaign and reserve it for the user + $stmt = "UPDATE vicidial_hopper set status='QUEUE', user='$user' where campaign_id='$campaign' and status='READY' order by hopper_id LIMIT 1"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + } + } + + if ($affected_rows > 0) + { + if (!$CBleadIDset) + { + ##### grab the lead_id of the reserved user in vicidial_hopper + $stmt="SELECT lead_id FROM vicidial_hopper where campaign_id='$campaign' and status='QUEUE' and user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $hopper_leadID_ct = mysql_num_rows($rslt); + if ($hopper_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + } + } + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $source_id = trim("$row[6]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + $called_count++; + + ##### check if system is set to generate logfile for transfers + $stmt="SELECT enable_agc_xfer_log FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enable_agc_xfer_log_ct = mysql_num_rows($rslt); + if ($enable_agc_xfer_log_ct > 0) + { + $row=mysql_fetch_row($rslt); + $enable_agc_xfer_log =$row[0]; + } + + if ( ($WeBRooTWritablE > 0) and ($enable_agc_xfer_log > 0) ) + { + # DATETIME|campaign|lead_id|phone_number|user|type + # 2007-08-22 11:11:11|TESTCAMP|65432|3125551212|1234|M + $fp = fopen ("./xfer_log.txt", "a"); + fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$phone_number|$user|M\n"); + fclose($fp); + } + + ##### if lead is a callback, grab the callback comments + $CBentry_time = ''; + $CBcallback_time = ''; + $CBuser = ''; + $CBcomments = ''; + if (ereg("CALLBK",$dispo)) + { + $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBentry_time = trim("$row[0]"); + $CBcallback_time = trim("$row[1]"); + $CBuser = trim("$row[2]"); + $CBcomments = trim("$row[3]"); + } + } + + ### flag the lead as called and change it's status to INCALL + $stmt = "UPDATE vicidial_list set status='INCALL', called_since_last_reset='Y', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + if (!$CBleadIDset) + { + ### delete the lead from the hopper + $stmt = "DELETE FROM vicidial_hopper where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $stmt="UPDATE vicidial_agent_log set lead_id='$lead_id',comments='MANUAL' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + ### if preview dialing, do not send the call + if ( (strlen($preview)<1) || ($preview == 'NO') ) + { + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### whether to omit phone_code or not + if (eregi('Y',$omit_phone_code)) + {$Ndialstring = "$Local_out_prefix$phone_number";} + else + {$Ndialstring = "$Local_out_prefix$phone_code$phone_number";} + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$server_ip','$campaign','XFER','$lead_id','$MqueryCID','$phone_code','$phone_number','$NOW_TIME','OUT')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',callerid='$MqueryCID',lead_id='$lead_id',comments='MANUAL',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update calls_today count in vicidial_campaign_agents + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $MqueryCID . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + $LeaD_InfO .= $CBentry_time . "\n"; + $LeaD_InfO .= $CBcallback_time . "\n"; + $LeaD_InfO .= $CBuser . "\n"; + $LeaD_InfO .= $CBcomments . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= "MAIN\n"; + $LeaD_InfO .= $source_id . "\n"; + + echo $LeaD_InfO; + + } + else + { + echo "HOPPER LEER\n"; + } + } +} + + +################################################################################ +### manDiaLskip - for manual VICIDiaL dialing this skips the lead that was +### previewed in the step above and puts it back in orig status +################################################################################ +if ($ACTION == 'manDiaLskip') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($stage)<1) || (strlen($called_count)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "LEAD NOT REVERTED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context ist unzulässig\n"; + exit; + } + else + { + $called_count = ($called_count - 1); + ### flag the lead as called and change it's status to INCALL + $stmt = "UPDATE vicidial_list set status='$stage', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + + echo "LEAD REVERTED\n"; + } +} + + +################################################################################ +### manDiaLonly - for manual VICIDiaL dialing this sends the call that was +### previewed in the step above +################################################################################ +if ($ACTION == 'manDiaLonly') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) || (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo " ANRUF NOT PLACED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context ist unzulässig\n"; + exit; + } + else + { + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### whether to omit phone_code or not + if (eregi('Y',$omit_phone_code)) + {$Ndialstring = "$Local_out_prefix$phone_number";} + else + {$Ndialstring = "$Local_out_prefix$phone_code$phone_number";} + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$server_ip','$campaign','XFER','$lead_id','$MqueryCID','$phone_code','$phone_number','$NOW_TIME','OUT')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',callerid='$MqueryCID',lead_id='$lead_id',comments='MANUAL',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + echo "$MqueryCID\n"; + } +} + + +################################################################################ +### manDiaLlookCALL - for manual VICIDiaL dialing this will attempt to look up +### the trunk channel that the call was placed on +################################################################################ +if ($ACTION == 'manDiaLlookCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; +if (strlen($MDnextCID)<18) + { + echo "NO\n"; + echo "MDnextCID $MDnextCID ist unzulässig\n"; + exit; + } +else + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT uniqueid,channel FROM vicidial_manager where callerid='$MDnextCID' and server_ip='$server_ip' and status='UPDATED' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $uniqueid =$row[0]; + $channel =$row[1]; + echo "$uniqueid\n$channel"; + + $wait_sec=0; + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',wait_epoch='$StarTtime',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + echo "NO\n"; + } + } +} + + + +################################################################################ +### manDiaLlogCALL - for manual VICIDiaL logging of calls places record in +### vicidial_log and then sends process to call_log entry +################################################################################ +if ($ACTION == 'manDiaLlogCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + +if ($stage == "start") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) || (strlen($list_id)<1) || (strlen($phone_number)<1) || (strlen($campaign)<1) ) + { + echo "LOG NICHT EINGEGEBEN\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id or list_id: $list_id or phone_number: $phone_number or campaign: $campaign ist unzulässig\n"; + exit; + } + else + { + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + ##### insert log into vicidial_log for manual VICIDiaL call + $stmt="INSERT INTO vicidial_log (uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,comments,processed,user_group) values('$uniqueid','$lead_id','$list_id','$campaign','$NOW_TIME','$StarTtime','INCALL','$phone_code','$phone_number','$user','MANUAL','N','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "VICIDiaL_LOG Eingesetzt: $uniqueid|$channel|$NOW_TIME\n"; + echo "$StarTtime\n"; + } + else + { + echo "LOG NICHT EINGEGEBEN\n"; + } + + $stmt = "UPDATE vicidial_auto_calls SET uniqueid='$uniqueid' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + # ##### insert log into call_log for manual VICIDiaL call + # $stmt = "INSERT INTO call_log (uniqueid,channel,server_ip,extension,number_dialed,caller_code,start_time,start_epoch) values('$uniqueid','$channel','$server_ip','$exten','$phone_code$phone_number','MD $user $lead_id','$NOW_TIME','$StarTtime')"; + # if ($DB) {echo "$stmt\n";} + # $rslt=mysql_query($stmt, $link); + # $affected_rows = mysql_affected_rows($link); + + # if ($affected_rows > 0) + # { + # echo "CALL_LOG Eingesetzt: $uniqueid|$channel|$NOW_TIME"; + # } + # else + # { + # echo "LOG NICHT EINGEGEBEN\n"; + # } + } + } + +if ($stage == "end") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) ) + { + echo "LOG NICHT EINGEGEBEN\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id ist unzulässig\n"; + exit; + } + else + { + if ($start_epoch < 1000) + { + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + ##### look for the start epoch in the vicidial_closer_log table + $stmt="SELECT start_epoch FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user' order by closecallid desc limit 1;"; + } + else + { + ##### look for the start epoch in the vicidial_log table + $stmt="SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + } + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch =$row[0]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($length_in_sec < 1) and ($row[0] > 0) ) + { + ##### start epoch in the vicidial_log table, couldn't find one in vicidial_closer_log + $stmt="SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch =$row[0]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + } + } + else {$length_in_sec = ($StarTtime - $start_epoch);} + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec',status='DONE' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + + if ($auto_dial_level > 0) + { + ### check to see if campaign has alt_dial enabled + $stmt="SELECT auto_alt_dial FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_alt_dial =$row[0]; + } + else {$auto_alt_dial = 'NONE';} + if (eregi("(ALT_ONLY|ADDR3_ONLY|ALT_AND_ADDR3)",$auto_alt_dial)) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT alt_dial FROM vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alt_dial =$row[0]; + } + else {$alt_dial = 'NONE';} + + if ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("(ALT_ONLY|ALT_AND_ADDR3)",$auto_alt_dial)) ) + { + $stmt="SELECT alt_phone,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alt_phone = $row[0]; + $alt_phone = eregi_replace("[^0-9]","",$alt_phone); + $gmt_offset_now = $row[1]; + $state = $row[2]; + } + else {$alt_phone = '';} + if (strlen($alt_phone)>5) + { + ### insert record into vicidial_hopper for alt_phone call attempt + $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ALT',user='',priority='25';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + } + if ( ( (eregi("(ALT)",$alt_dial)) and (eregi("ALT_AND_ADDR3",$auto_alt_dial)) ) or ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("ADDR3_ONLY",$auto_alt_dial)) ) ) + { + $stmt="SELECT address3,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $address3 = $row[0]; + $address3 = eregi_replace("[^0-9]","",$address3); + $gmt_offset_now = $row[1]; + $state = $row[2]; + } + else {$address3 = '';} + if (strlen($address3)>5) + { + ### insert record into vicidial_hopper for address3 call attempt + $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ADDR3',user='',priority='20';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + + if ($enable_queuemetrics_logging > 0) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_qm_ct = mysql_num_rows($rslt); + if ($VAC_qm_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_call_id = $row[0]; + $CLlead_id = $row[1]; + $CLphone_number = $row[2]; + $CLstatus = $row[3]; + $CLcampaign_id = $row[4]; + $CLphone_code = $row[5]; + $CLalt_dial = $row[6]; + $CLstage = $row[7]; + $CLcallerid = $row[8]; + $CLuniqueid = $row[9]; + } + + $CLstage = preg_replace("/.*-/",'',$CLstage); + if (strlen($CLstage) < 1) {$CLstage=0;} + + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt="SELECT count(*) from queue_log where call_id='$MDnextCID' and verb='COMPLETECALLER';"; + $rslt=mysql_query($stmt, $linkB); + if ($DB) {echo "$stmt\n";} + $VAC_cc_ct = mysql_num_rows($rslt); + if ($VAC_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $caller_complete = $row[0]; + } + + if ($caller_complete < 1) + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + } + mysql_close($linkB); + } + + ### delete call record from vicidial_auto_calls + $stmt = "DELETE from vicidial_auto_calls where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + + + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',lead_id='',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } + else + { + if ($enable_queuemetrics_logging > 0) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_qm_ct = mysql_num_rows($rslt); + if ($VAC_qm_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_call_id = $row[0]; + $CLlead_id = $row[1]; + $CLphone_number = $row[2]; + $CLstatus = $row[3]; + $CLcampaign_id = $row[4]; + $CLphone_code = $row[5]; + $CLalt_dial = $row[6]; + $CLstage = $row[7]; + $CLcallerid = $row[8]; + $CLuniqueid = $row[9]; + } + + $CLstage = preg_replace("/XFER|-/",'',$CLstage); + if ($CLstage < 0.25) {$CLstage=0;} + + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + + $stmt = "DELETE from vicidial_auto_calls lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',lead_id='',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } + + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' where uniqueid='$uniqueid' and lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "$uniqueid\n$channel\n"; + } + else + { + echo "LOG NICHT EINGEGEBEN\n\n"; + } + } + + echo $VDstop_rec_after_each_call . '|' . $extension . '|' . $conf_silent_prefix . '|' . $conf_exten . '|' . $user_abb . "|\n"; + + ##### if VICIDiaL call and hangup_after_each_call activated, find all recording + ##### channels and hang them up while entering info into recording_log and + ##### returning filename/recordingID + if ($VDstop_rec_after_each_call == 1) + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $total_rec=0; + $loop_count=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten' order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$rec_list = mysql_num_rows($rslt);} + while ($rec_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + if (preg_match("/Local\/$conf_silent_prefix$conf_exten\@/i",$row[0])) + { + $rec_channels[$total_rec] = "$row[0]"; + $total_rec++; + } + if ($format=='debug') {echo "\n";} + $loop_count++; + } + + $total_recFN=0; + $loop_count=0; + $filename=$MT; # not necessary : and cmd_line_f LIKE \"%_$user_abb\" + $stmt="SELECT cmd_line_f FROM vicidial_manager where server_ip='$server_ip' and action='Originate' and cmd_line_b = 'Channel: $local_DEF$conf_silent_prefix$conf_exten$local_AMP$ext_context' order by entry_date desc limit $total_rec;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$recFN_list = mysql_num_rows($rslt);} + while ($recFN_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + $filename[$total_recFN] = preg_replace("/Callerid: /i","",$row[0]); + if ($format=='debug') {echo "\n";} + $total_recFN++; + $loop_count++; + } + + $loop_count=0; + while($loop_count < $total_rec) + { + if (strlen($rec_channels[$loop_count])>5) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$loop_count','Channel: $rec_channels[$loop_count]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "REC_STOP|$rec_channels[$loop_count]|$filename[$loop_count]|"; + if (strlen($filename)>2) + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename[$loop_count]'"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$fn_count = mysql_num_rows($rslt);} + if ($fn_count) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt="UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename[$loop_count]' and end_epoch is NULL;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "$recording_id|$length_in_min|"; + } + else {echo "||";} + } + else {echo "||";} + echo "\n"; + } + $loop_count++; + } + } + + + $talk_sec=0; + $StarTtime = date("U"); + $stmt = "select talk_epoch,talk_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $talk_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set talk_sec='$talk_sec',talk_epoch='$StarTtime',dispo_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } +} + + +################################################################################ +### VDADREcheckINCOMING - for auto-dial VICIDiaL dialing this will recheck for +### calls to see if the channel has updated +################################################################################ +if ($ACTION == 'VDADREcheckINCOMING') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "Kampagne $campaign ist unzulässig\n"; + echo "lead_id $lead_id ist unzulässig\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + } + } +} + + +################################################################################ +### VDADcheckINCOMING - for auto-dial VICIDiaL dialing this will check for calls +### in the vicidial_live_agents table in QUEUE status, then +### lookup the lead info and pass it back to vicidial.php +################################################################################ +if ($ACTION == 'VDADcheckINCOMING') +{ + $Ctype = 'A'; + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "Kampagne $campaign ist unzulässig\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and status='QUEUE';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',comments='AUTO',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $source_id = trim("$row[6]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + ##### if lead is a callback, grab the callback comments + $CBentry_time = ''; + $CBcallback_time = ''; + $CBuser = ''; + $CBcomments = ''; + if (ereg("CALLBK",$dispo)) + { + $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBentry_time = trim("$row[0]"); + $CBcallback_time = trim("$row[1]"); + $CBuser = trim("$row[2]"); + $CBcomments = trim("$row[3]"); + } + } + + ### update the lead status to INCALL + $stmt = "UPDATE vicidial_list set status='INCALL', user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the log status to INCALL + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + $stmt = "UPDATE vicidial_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL', user_group='$user_group' where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + ### update the vicidial_closer_log user to INCALL + $stmt = "UPDATE vicidial_closer_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL', user_group='$user_group' where lead_id='$lead_id' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select campaign_id,phone_number,alt_dial from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($VDAC_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDADchannel_group =$row[0]; + $dialed_number =$row[1]; + $dialed_label =$row[2]; + } + else + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|INBND|$callerid|$user|$user_group|$list_id|$lead_id|$phone_number|$uniqueid|\n"); + fclose($fp); + } + } + + $stmt = "select count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDL_cid_ct = mysql_num_rows($rslt); + if ($VDL_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_front_VDlog =$row[0]; + } + + $stmt = "select * from vicidial_inbound_groups where group_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_group_name = $row[1]; + $VDCL_group_color = $row[2]; + $VDCL_group_web = $row[4]; + $VDCL_fronter_display = $row[7]; + $VDCL_ingroup_script = $row[8]; + $VDCL_get_call_launch = $row[9]; + $VDCL_xferconf_a_dtmf = $row[10]; + $VDCL_xferconf_a_number = $row[11]; + $VDCL_xferconf_b_dtmf = $row[12]; + $VDCL_xferconf_b_number = $row[13]; + $VDCL_default_xfer_group= $row[28]; + + ### update the comments in vicidial_live_agents record + $stmt = "UPDATE vicidial_live_agents set comments='INBOUND' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $Ctype = 'I'; + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_ingroup_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + } + + ### if web form is set then send an to vicidial.php for override of WEB_FORM address + if ( (strlen($VDCL_group_web)>5) or (strlen($VDCL_group_name)>0) ) {echo "$VDCL_group_web|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|\n";} + else {echo "|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|\n";} + + $stmt = "SELECT full_name from vicidial_users where user='$tsr';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDU_cid_ct = mysql_num_rows($rslt); + if ($VDU_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $fronter_full_name = $row[0]; + echo $fronter_full_name . '|' . $tsr . "\n"; + } + else {echo '|' . $tsr . "\n";} + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_campaign_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + echo "|||||$VDCL_campaign_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n|\n"; + + $stmt = "select phone_number,alt_dial from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($VDAC_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dialed_number =$row[0]; + $dialed_label =$row[1]; + } + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $callerid . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + $LeaD_InfO .= $CBentry_time . "\n"; + $LeaD_InfO .= $CBcallback_time . "\n"; + $LeaD_InfO .= $CBuser . "\n"; + $LeaD_InfO .= $CBcomments . "\n"; + $LeaD_InfO .= $dialed_number . "\n"; + $LeaD_InfO .= $dialed_label . "\n"; + $LeaD_InfO .= $source_id . "\n"; + + echo $LeaD_InfO; + + + + $wait_sec=0; + $StarTtime = date("U"); + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + ### If ANRUFBK, change vicidial_callback record to INACTIVE + if (eregi("CALLBK|CBHOLD", $dispo)) + { + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='$lead_id' and status NOT IN('INACTIVE','DEAD','ARCHIVE');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + ##### check if system is set to generate logfile for transfers + $stmt="SELECT enable_agc_xfer_log FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enable_agc_xfer_log_ct = mysql_num_rows($rslt); + if ($enable_agc_xfer_log_ct > 0) + { + $row=mysql_fetch_row($rslt); + $enable_agc_xfer_log =$row[0]; + } + + if ( ($WeBRooTWritablE > 0) and ($enable_agc_xfer_log > 0) ) + { + # DATETIME|campaign|lead_id|phone_number|user|type + # 2007-08-22 11:11:11|TESTCAMP|65432|3125551212|1234|A + $fp = fopen ("./xfer_log.txt", "a"); + fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$phone_number|$user|$Ctype\n"); + fclose($fp); + } + + } + else + { + echo "0\n"; + # echo "No calls in QUEUE for $user an $server_ip\n"; + exit; + } + } +} + + +################################################################################ +### userLOGout - Logs the user out of VICIDiaL client, deleting db records and +### inserting into vicidial_user_log +################################################################################ +if ($ACTION == 'userLOGout') +{ + $MT[0]=''; + $row=''; $rowx=''; +if ( (strlen($campaign)<1) || (strlen($conf_exten)<1) ) + { + echo "NO\n"; + echo "campaign $campaign or conf_exten $conf_exten ist unzulässig\n"; + exit; + } +else + { + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + ##### Insert a LOGOUT record into the user log + $stmt="INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$user','LOGOUT','$campaign','$NOW_TIME','$StarTtime','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vul_insert = mysql_affected_rows($link); + + if ($no_delete_sessions < 1) + { + ##### Remove the reservation an the vicidial_conferences meetme room + $stmt="UPDATE vicidial_conferences set extension='' where server_ip='$server_ip' and conf_exten='$conf_exten';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vc_remove = mysql_affected_rows($link); + } + + ##### Delete the vicidial_live_agents record for this session + $stmt="DELETE from vicidial_live_agents where server_ip='$server_ip' and user ='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vla_delete = mysql_affected_rows($link); + + ##### Delete the vicidial_live_inbound_agents records for this session + $stmt="DELETE from vicidial_live_inbound_agents where user ='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vlia_delete = mysql_affected_rows($link); + + ##### Delete the web_client_sessions + $stmt="DELETE from web_client_sessions where server_ip='$server_ip' and session_name ='$session_name';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $wcs_delete = mysql_affected_rows($link); + + ##### Hangup the client phone + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$extension%\" order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) + { + $row=mysql_fetch_row($rslt); + $agent_channel = "$row[0]"; + if ($format=='debug') {echo "\n";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','ULGH3459$StarTtime','Channel: $agent_channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $pause_sec=0; + $stmt = "select pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ( ($VDpr_ct > 0) and (strlen($row[3]<5)) and (strlen($row[4]<5)) ) + { + $row=mysql_fetch_row($rslt); + $pause_sec = (($StarTtime - $row[0]) + $row[1]); + + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + if ($vla_delete > 0) + { + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $allow_sipsak_messages = $row[6]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_message = 'LOGGED OUT'; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_message\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + } + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + # $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='PAUSE',serverid='1';"; + # if ($DB) {echo "$stmt\n";} + # if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + # $rslt=mysql_query($stmt, $linkB); + # $affected_rows = mysql_affected_rows($linkB); + + $stmt = "SELECT time_id FROM queue_log where agent='Agent/$user' and verb='AGENTLOGIN' order by time_id desc limit 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + if ($DB) {echo "$stmt\n";} + echo "$stmt\n"; + $li_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $li_conf_ct) + { + $row=mysql_fetch_row($rslt); + $logintime = $row[0]; + $i++; + } + + $time_logged_in = ($StarTtime - $logintime); + if ($time_logged_in > 1000000) {$time_logged_in=1;} + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='AGENTLOGOFF',data1='$user$agents',data2='$time_logged_in',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + + echo "$vul_insert|$vc_remove|$vla_delete|$wcs_delete|$agent_channel|$vlia_delete\n"; + } +} + + +################################################################################ +### updateDISPO - update the vicidial_list table to reflect the agent choice of +### call disposition for that leand +################################################################################ +if ($ACTION == 'updateDISPO') +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($dispo_choice)<1) || (strlen($lead_id)<1) ) + { + echo "Dispo Choice $dispo or lead_id $lead_id ist unzulässig\n"; + exit; + } + else + { + $stmt="UPDATE vicidial_list set status='$dispo_choice', user='$user' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by uniqueid desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + if ( ($use_internal_dnc=='Y') and ($dispo_choice=='DNC') ) + { + $stmt = "select phone_number from vicidial_list where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $stmt="INSERT INTO vicidial_dnc (phone_number) values('$row[0]');"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + } + } + + $dispo_sec=0; + $StarTtime = date("U"); + $stmt = "select dispo_epoch,dispo_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dispo_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set dispo_sec='$dispo_sec',dispo_epoch='$StarTtime',status='$dispo_choice' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id($link); + + ### ANRUFBACK ENTRY + if ( ($dispo_choice == 'CBHOLD') and (strlen($CallBackDatETimE)>10) ) + { + $stmt="INSERT INTO vicidial_callbacks (lead_id,list_id,campaign_id,status,entry_time,callback_time,user,recipient,comments,user_group) values('$lead_id','$list_id','$campaign','ACTIVE','$NOW_TIME','$CallBackDatETimE','$user','$recipient','$comments','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $stmt="SELECT auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ( ($auto_dial_level > 0) and (ereg(" $dispo_choice ",$row[0])) ) + { + $stmt = "select count(*) from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + $stmt="UPDATE vicidial_hopper set status='READY' where lead_id='$lead_id' and status='HOLD' limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + else + { + $stmt="DELETE from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='CALLSTATUS',data1='$dispo_choice',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + + echo 'Lead ' . $lead_id . ' wurde geändert zu ' . $dispo_choice . " Status\nNext agent_log_id:\n" . $agent_log_id . "\n"; +} + +################################################################################ +### updateLEAD - update the vicidial_list table to reflect the values that are +### in the agents screen at time of call hangup +################################################################################ +if ($ACTION == 'updateLEAD') +{ + $MT[0]=''; + $row=''; $rowx=''; + $DO_NOT_UPDATE=0; + $DO_NOT_UPDATE_text=''; + if ( (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + echo "phone_number $phone_number or lead_id $lead_id ist unzulässig\n"; + exit; + } + else + { + + $stmt = "SELECT disable_alter_custdata FROM vicidial_campaigns where campaign_id='$campaign'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $dac_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $dac_conf_ct) + { + $row=mysql_fetch_row($rslt); + $disable_alter_custdata = $row[0]; + $i++; + } + if (ereg('Y',$disable_alter_custdata)) + { + $DO_NOT_UPDATE=1; + $DO_NOT_UPDATE_text=' NOT'; + $stmt = "SELECT alter_custdata_override FROM vicidial_users where user='$user'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $aco_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $aco_conf_ct) + { + $row=mysql_fetch_row($rslt); + $alter_custdata_override = $row[0]; + $i++; + } + if (ereg('ALLOW_ALTER',$alter_custdata_override)) + { + $DO_NOT_UPDATE=0; + $DO_NOT_UPDATE_text=''; + } + } + + if ($DO_NOT_UPDATE < 1) + { + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + $comments = eregi_replace("--AMP--",'&',$comments); + $comments = eregi_replace("--QUES--",'?',$comments); + $comments = eregi_replace("--POUND--",'#',$comments); + + $stmt="UPDATE vicidial_list set vendor_lead_code='" . mysql_real_escape_string($vendor_lead_code) . "', title='" . mysql_real_escape_string($title) . "', first_name='" . mysql_real_escape_string($first_name) . "', middle_initial='" . mysql_real_escape_string($middle_initial) . "', last_name='" . mysql_real_escape_string($last_name) . "', address1='" . mysql_real_escape_string($address1) . "', address2='" . mysql_real_escape_string($address2) . "', address3='" . mysql_real_escape_string($address3) . "', city='" . mysql_real_escape_string($city) . "', state='" . mysql_real_escape_string($state) . "', province='" . mysql_real_escape_string($province) . "', postal_code='" . mysql_real_escape_string($postal_code) . "', country_code='" . mysql_real_escape_string($country_code) . "', gender='" . mysql_real_escape_string($gender) . "', date_of_birth='" . mysql_real_escape_string($date_of_birth) . "', alt_phone='" . mysql_real_escape_string($alt_phone) . "', email='" . mysql_real_escape_string($email) . "', security_phrase='" . mysql_real_escape_string($security_phrase) . "', comments='" . mysql_real_escape_string($comments) . "' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } + echo "Lead $lead_id information has$DO_NOT_UPDATE_text been updated\n"; +} + + +################################################################################ +### VDADpause - update the vicidial_live_agents table to show that the agent is +### or ready now active and ready to take calls +################################################################################ +if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($stage)<2) || (strlen($server_ip)<1) ) + { + echo "stage $stage ist unzulässig\n"; + exit; + } + else + { + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set lead_id='',uniqueid=0,callerid='',channel='', random_id='$random',comments='' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_live_agents set status='$stage' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + if (ereg('READY',$stage)) {$QMstatus='UNPAUSEALL';} + if (ereg('PAUSE',$stage)) {$QMstatus='PAUSEALL';} + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='$QMstatus',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + + if ($agent_log == 'NO') + {$donothing=1;} + else + { + $pause_sec=0; + $stmt = "select pause_epoch,pause_sec,wait_epoch,wait_sec,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec=0; + if ($row[2] > 0) + { + $wait_sec = (($StarTtime - $row[2]) + $row[3]); + } + if ( (eregi("NULL",$row[4])) or ($row[4] < 1000) ) + {$pause_sec = (($StarTtime - $row[0]) + $row[1]);} + else + {$pause_sec = (($row[4] - $row[0]) + $row[1]);} + + } + if ($ACTION == 'VDADready') + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($ACTION == 'VDADpause') + { + $stmt="UPDATE vicidial_agent_log set pause_epoch='$StarTtime',wait_sec='$wait_sec' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + echo 'Agent ' . $user . ' ist jetzt im Status ' . $stage . "\n"; +} + + +################################################################################ +### UpdatEFavoritEs - update the astguiclient favorites list for this extension +################################################################################ +if ($ACTION == 'UpdatEFavoritEs') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($favorites_list)<1) || (strlen($user)<1) || (strlen($exten)<1) ) + { + echo "favorites list $favorites_list ist unzulässig\n"; + exit; + } + else + { + $stmt = "select count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + $stmt="UPDATE phone_favorites set extensions_list=\"$favorites_list\" where extension='$exten' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="INSERT INTO phone_favorites values('$exten','$server_ip',\"$favorites_list\");"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + echo "Favorites list has been updated to $favorites_list for $exten\n"; +} + + +################################################################################ +### PauseCodeSubmit - Update vicidial_agent_log with pause code +################################################################################ +if ($ACTION == 'PauseCodeSubmit') +{ + $row=''; $rowx=''; + if ( (strlen($status)<1) || (strlen($agent_log_id)<1) ) + { + echo "agent_log_id $agent_log_id or pause_code $status ist unzulässig\n"; + exit; + } + else + { + $stmt="UPDATE vicidial_agent_log set sub_status=\"$status\" where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $allow_sipsak_messages = $row[6]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_prefix = 'BK-'; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$status\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + } + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='PAUSEREASON',serverid='$queuemetrics_log_id',data1='$status';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } +echo "Pause Code has been updated to $status for $agent_log_id\n"; +} + + +################################################################################ +### CalLBacKLisT - List the USERONLY callbacks for an agent +################################################################################ +if ($ACTION == 'CalLBacKLisT') +{ +$stmt = "select callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' and campaign_id='$campaign' and status NOT IN('INACTIVE','DEAD') order by callback_time;"; +if ($DB) {echo "$stmt\n";} +$rslt=mysql_query($stmt, $link); +if ($rslt) {$callbacks_count = mysql_num_rows($rslt);} +echo "$callbacks_count\n"; +$loop_count=0; + while ($callbacks_count>$loop_count) + { + $row=mysql_fetch_row($rslt); + $callback_id[$loop_count] = $row[0]; + $lead_id[$loop_count] = $row[1]; + $campaign_id[$loop_count] = $row[2]; + $status[$loop_count] = $row[3]; + $entry_time[$loop_count] = $row[4]; + $callback_time[$loop_count] = $row[5]; + $comments[$loop_count] = $row[6]; + $loop_count++; + } +$loop_count=0; + while ($callbacks_count>$loop_count) + { + $stmt = "select first_name,last_name,phone_number from vicidial_list where lead_id='$lead_id[$loop_count]';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count]\n"; + $loop_count++; + } + +} + + +################################################################################ +### CalLBacKCounT - send the count of the USERONLY callbacks for an agent +################################################################################ +if ($ACTION == 'CalLBacKCounT') +{ +$stmt = "select count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' and campaign_id='$campaign' and status NOT IN('INACTIVE','DEAD');"; +if ($DB) {echo "$stmt\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$cbcount=$row[0]; + +echo "$cbcount"; +} + + + + +if ($format=='debug') +{ +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +echo "\n"; +echo "\n\n\n"; +} + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/vicidial.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/vicidial.php new file mode 100644 index 00000000..b72ec677 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/vicidial.php @@ -0,0 +1,6797 @@ + LICENSE: GPLv2 +# +# make sure you have added a user to the vicidial_users MySQL table with at least +# user_level 1 or greater to access this page. Also, you need to have the login +# and pass of a phone listed in the asterisk.phones table. The page grabs the +# server info and other details from this login and pass. +# +# This script works best with Firefox or Mozilla, but will run for a couple +# hours on Internet Explorer before the memory leaks cause a crash. +# +# Other scripts that this application depends on: +# - vdc_db_query.php: Updates information in the database +# - manager_send.php: Sends manager actions to the DB for execution +# +# CHANGELOG +# 50607-1426 - First Build of VICIDIAL web client basic login process finished +# 50628-1620 - Added some basic formatting and worked on process flow +# 50628-1715 - Startup variables mapped to javascript variables +# 50629-1303 - Added Login Closer in-groups selection box and vla update +# 50629-1530 - Rough layout for customer info form section and button links +# 50630-1453 - Rough Manual Dial/Hangup with customer info displayed +# 50701-1450 - Added vicidial_log entries on dial and hangup +# 50701-1634 - Added Logout function +# 50705-1259 - Added call disposition functionality +# 50705-1432 - Added lead info DB update function +# 50705-1658 - Added web form functionality +# 50706-1043 - Added call park and pickup functions +# 50706-1234 - Added Start/Stop Recording functionality +# 50706-1614 - Added conference channels display option +# 50711-1333 - Removed call check redundancy and fixed a span bug +# 50727-1424 - Added customer channel and participant present sensing/alerts +# 50804-1057 - Added SendDTMF function and reconfigured the transfer span +# 50804-1224 - Added Local and Internal Closer transfer functions +# 50804-1628 - Added Blind transfer, activated LIVE CALL image and fixed bugs +# 50804-1808 - Added button images for left buttons +# 50815-1151 - Added 3Way calling functions to Transfer-conf frame +# 50815-1602 - Added images and buttons for xfer functions +# 50816-1813 - Added basic autodial outbound call pickup functions +# 50817-1113 - Fixes to auto_dialing call receipt +# 50817-1234 - Added inbound call receipt capability +# 50817-1541 - Added customer time display +# 50817-1541 - Added customer time display +# 50818-1327 - Added stop-all-recordings-after-each-vicidial-call option +# 50818-1703 - Added pretty login section +# 50825-1200 - Modified form field lengths, added double-click dispositions +# 50831-1603 - Fixed customer time bug and fronter display bug for CLOSER +# 50901-1314 - Fixed CLOSER IN-GROUP Web Form bug +# 50903-0904 - Added preview-lead code for manual dialing +# 50904-0016 - Added ability to hangup manual dials before pickup +# 50906-1319 - Added override for filters on xfer calls, fixed login display bug +# 50909-1243 - Added hotkeys functionality for quick dispoing in auto-dial mode +# 50912-0958 - Modified hotkeys function, agent must have user_level >= 5 to use +# 50913-1212 - Added campaign_cid to 3rd party calls +# 50923-1546 - Modified to work with language translation +# 50926-1656 - Added campaign pull-down at login of active campaigns +# 50928-1633 - Added manual dial alternate number dial option +# 50930-1538 - Added session_id empty login failure and fixed 2 minor bugs +# 51004-1656 - Fixed recording filename bug and new Spanish translation +# 51020-1103 - Added campaign-specific recording control abilities +# 51020-1352 - Added Basic vicidial_agent_log framework +# 51021-1050 - Fixed custtime display and disable Enter/Return keypresses +# 51021-1718 - Allows for multi-line comments (changes \n to !N in database) +# 51110-1432 - Fixed non-standard http port issue +# 51111-1047 - Added vicidial_agent_log lead_id earlier for manual dial +# 51118-1305 - Activate multi-line comments from $multi_line_comments var +# 51118-1313 - Move Transfer DIV to a floating span to preserve 800x600 view +# 51121-1506 - Small PHP optimizations in many scripts and disabled globalize +# 51129-1010 - Added ability to accept calls from other VICIDIAL servers +# 51129-1254 - Fixed Hangups of other agents channels when customer hangs up +# 51208-1732 - Created user-first login that looks for default phone info +# 51219-1526 - Added variable framework for campaign and in-group scripts +# 51221-1200 - Added SCRIPT tab, layout and functionality +# 51221-1714 - Added auto-switch-to-SCRIPT-tab and auto-webform-popup +# 51222-1605 - Added VMail message blind transfer button to xfer-conf frame +# 51229-1028 - Added checks on web_form_address to allow for var in the DB value +# 60117-1312 - Added Transfer-conf frame toggle on button press +# 60208-1152 - Added DTMF-xfernumber preset links to xfer-conf frame +# 60213-1129 - Added vicidial_users.hotkeys_active for any user hotkeys +# 60213-1210 - Added ability to sort routing of calls by user_level +# 60214-0932 - Initial Callback calendar display framework +# 60214-1407 - Added ability to minimize the dispo screen to see info below +# 60215-1104 - Added ANYONE scheduled callbacks functionality +# 60410-1116 - Added persistant pause after dispo option and change dispo text +# - Added web form submit that opens new window with dispo on submit +# - Added PREVIOUS CALLBACK in customer info to flag callbacks +# - Added link to try to hangup the call again in the dispo screen +# - Added link noone-in-session screen to call agent phone again +# - Added link customer-hungup screen to go straight to dispo screen +# 60410-1532 - Added agent status and campaign calls dialing display option +# 60411-1547 - Add ability to set callback as USERONLY and some basic formatting +# 60413-1752 - Add basic USERONLY callback frame and listings +# 60414-1039 - Changed manual dial preview and alt dial checkboxes to spans +# - Added beta-level USERONLY callback functionality +# - Added beta-level manual dialing with lead insertion functionality +# 60415-1534 - Fixed manual dial lead preview and fixed manuald dial override bug +# 60417-1108 - Added capability to do alt-number-dialing in auto-dial mode +# - Changed several permissions to database-defined +# 60419-1529 - Prevent manual dial or callbacks when alt-dial lead not finished +# 60420-1647 - Fixed DiaLDiaLAltPhonE error, Call Agent Again DialControl error +# 60421-1229 - Check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60424-1005 - Fixed Alt phone disabled bug for callbacks and manual dials +# 60426-1058 - Added vicidial_user setting for default blended check for CLOSER +# 60501-1008 - Added option to manual dial screen to manually lookup phone number +# 60503-1653 - Fixed agentonly_callback not-defined bug in scheduled callbacks screen +# 60504-1032 - Fixed manual dial display bug and transfer dispo alert bug +# - Fixed recording filename display to not overrun 25 characters +# 60510-1051 - Added Wrapup timer and wrapup message on wrapup screen after dispo +# 60608-1453 - Added CLOSER campaign allowable in-groups limitations +# 60609-1123 - Added add-number-to-DNC-list function and manual dial check DNC +# 60619-1047 - Added variable filters to close security holes for login form +# 60804-1710 - fixed scheduled CALLBK for other languages build +# 60808-1145 - Added consultative transfers with customer data +# 60808-2232 - Added campaign name to pulldown for login screen +# 60809-1603 - Added option to locally transfer consult xfers +# 60809-1732 - Added recheck of transferred channels before customer gone mesg +# 60810-1011 - Fixed CXFER leave 3way call bugs +# 60816-1602 - Added ALLCALLS recording delay option allcalls_delay +# 60816-1716 - Fixed customer time display bug and client DST setting +# 60821-1555 - Added option to omit phone_code on dialout of leads +# 60821-1628 - Added ALLFORCE recording option +# 60821-1643 - Added no_delete_sessions option to not delete sessions +# 60822-0512 - Changed phone number fields to be maxlength of 12 +# 60829-1531 - Made compatible with WeBRooTWritablE setting in dbconnect.php +# 60906-1152 - Added Previous CallBack info display span +# 60906-1715 - Allow for Local phone extension conferences +# 61004-1729 - Add ability to control volume per channel in "calls in this session" +# 61122-1341 - Added vicidial_user_groups allowed_campaigns restrictions +# 61122-1523 - Added more SCRIPT variables +# 61128-2229 - Added vicidial_live_agents and vicidial_auto_calls manual dial entries +# 61130-1617 - Added lead_id to MonitorConf for recording_log +# 61221-1212 - Changed width to 760 to better fit 800x600 screens, widened SCRIPT +# 70109-1128 - Fixed wrapup timer bug +# 70109-1635 - Added option for HotKeys automatically dialing next number in manual mode +# - Added option for alternate number dialing with hotkeys +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70118-1517 - Added vicidial_agent_log and vicidial_user_log logging of user_group +# 70201-1249 - Added FAST DIAL option for manually dialing, added UTF8 compatible code +# 70201-1703 - Fixed cursor bug for most text input fields +# 70202-1453 - Added first portions of Agent Pause Codes +# 70203-0108 - Finished Agent Pause Codes functionality +# 70203-0930 - Added dialed_number to webform output +# 70203-1010 - Added dialed_label to webform output +# 70206-1201 - Fixed allow_closers bug +# 70206-1332 - Added vicidial_recording_override users setting function +# 70212-1252 - Fixed small issue with CXFER +# 70213-1018 - Changed CXFER and AXFER to update customer information before transfer +# 70214-1233 - Added queuemetrics_log_id field for server_id in queue_log +# 70215-1240 - Added queuemetrics_log_id field for server_id in queue_log +# 70222-1617 - Changed queue_log PAUSE/UNPAUSE to PAUSEALL/UNPAUSEALL +# 70226-1252 - Added Mute/UnMute to agent screen +# 70309-1035 - Allow amphersands and questions marks in comments to pass through +# 70313-1052 - Allow pound signs(hash) in comments to pass through +# 70316-1406 - Moved the MUTE button to be accessible during a transfer/conf +# 70319-1446 - Added agent-deactive-display and disable customer info update functions +# 70319-1626 - Added option to allow agent logins to campaigns with no leads in the hopper +# 70320-1501 - Added option to allow retry of leave-3way-call from dispo screen +# 70322-1545 - Added sipsak display ability +# 70510-1319 - Added onUnload force Logout +# 70806-1530 - Added Presets Dial links above agent mute button +# 70823-2118 - Fixed XMLHTTPRequest, HotKeys and Scheduled Callbacks issues with MSIE +# 70828-1443 - Added source_id to output of SCRIPTtab-IFRAME and WEBFORM +# 71022-1427 - Added formatting of the customer phone number in the main status bar +# 71029-1848 - Changed CLOSER-type campaign to not use campaign_id restrictions +# 71101-1204 - Fixed bug in callback calendar with DST +# 71116-0957 - Added campaign_weight and calls_today to the vla table insertion +# 71120-1719 - Added XMLHTPRequest lookup of allowable campaigns for agents during login +# 71122-0256 - Added auto-pause notification +# 71125-1751 - Changed Transfer section to allow for selection of in-groups to send calls to +# 71127-0408 - Added height and width settings for easier modification of screen size +# 71129-2025 - restricted callbacks count and list to campaign only +# + +$version = '2.0.4-142'; +$build = '71129-2025'; + +require("dbconnect.php"); + +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["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} + 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"];} + } + if (isset($VD_campaign)) + { + $VD_campaign = strtoupper($VD_campaign); + $VD_campaign = eregi_replace(" ",'',$VD_campaign); + } + +### 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); + + +$forever_stop=0; + +if ($force_logout) +{ + echo "Sie haben sich abgemeldet. Danke\n"; + exit; +} + +$isdst = date("I"); +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$CIDdate = date("ymdHis"); + $month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); + $past_month_date = date("Y-m-d H:i:s",$month_old); + + +$random = (rand(1000000, 9999999) + 10000000); + +$conf_silent_prefix = '7'; # vicidial_conferences prefix to enter silently +$HKuser_level = '5'; # minimum vicidial user_level for HotKeys +$campaign_login_list = '1'; # show drop-down list of campaigns at login +$manual_dial_preview = '1'; # allow preview lead option when manual dial +$multi_line_comments = '1'; # set to 1 to allow multi-line comment box +$user_login_first = '0'; # set to 1 to have the vicidial_user login before the phone login +$view_scripts = '1'; # set to 1 to show the SCRIPTS tab +$dispo_check_all_pause = '0'; # set to 1 to allow for persistent pause after dispo +$agentcallsstatus = '0'; # set to 1 to show agent status and call count + $campagentstatctmax = '0'; # Number of Sekunden for campaign call and agent stats +$show_campname_pulldown = '1'; # set to 1 to show campaign name an login pulldown +$webform_sessionname = '1'; # set to 1 to include the session_name in webform URL +$local_consult_xfers = '1'; # set to 1 to send consultative transfers from original server +$clientDST = '1'; # set to 1 to check for DST an server for agent time +$no_delete_sessions = '0'; # set to 1 to not delete sessions at logout +$volumecontrol_active = '1'; # set to 1 to allow agents to alter volume of channels +$PreseT_DiaL_LinKs = '1'; # set to 1 to show a WÄHLEN link for Dial Presets +$LogiNAJAX = '1'; # set to 1 to do lookups +$HidEMonitoRSessionS = '1'; # set to 1 to hide remote monitoring channels from "session calls" + +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen + +$BROWSER_HEIGHT = 500; # set to the minimum browser height, default=500 +$BROWSER_WIDTH = 770; # set to the minimum browser width, default=770 + + +# options now set in DB: +#$alt_phone_dialing = '1'; # allow agents to call alt phone numbers +#$scheduled_callbacks = '1'; # set to 1 to allow agent to choose scheduled callbacks +# $agentonly_callbacks = '1'; # set to 1 to allow agent to choose agent-only scheduled callbacks +#$agentcall_manual = '1'; # set to 1 to allow agent to make manual calls during autodial session + +### SCREEN WIDTH AND HEIGHT CALCULATIONS ### +### DO NOT EDIT! ### +$MASTERwidth=($BROWSER_WIDTH - 340); +$MASTERheight=($BROWSER_HEIGHT - 200); +if ($MASTERwidth < 430) {$MASTERwidth = '430';} +if ($MASTERheight < 300) {$MASTERheight = '300';} + +$CAwidth = ($MASTERwidth + 340); # 770 - cover all (none-in-session, customer hunngup, etc...) +$MNwidth = ($MASTERwidth + 330); # 760 - main frame +$XFwidth = ($MASTERwidth + 320); # 750 - transfer/conference +$HCwidth = ($MASTERwidth + 310); # 740 - hotkeys and callbacks +$AMwidth = ($MASTERwidth + 270); # 700 - agent mute and preset-dial links +$SSwidth = ($MASTERwidth + 176); # 606 - scroll script +$SDwidth = ($MASTERwidth + 170); # 600 - scroll script, customer data and calls-in-session +$HKwidth = ($MASTERwidth + 70); # 500 - Hotkeys button +$HSwidth = ($MASTERwidth + 1); # 431 - Header spacer + +$HKheight = ($MASTERheight + 105); # 405 - HotKey active Button +$AMheight = ($MASTERheight + 100); # 400 - Agent mute and preset dial links +$MBheight = ($MASTERheight + 65); # 365 - Manual Dial Buttons +$CBheight = ($MASTERheight + 50); # 350 - Agent Callback, pause code, volume control Buttons and agent status +$SSheight = ($MASTERheight + 31); # 331 - script content +$HTheight = ($MASTERheight + 10); # 310 - transfer frame, callback comments and hotkey +$BPheight = ($MASTERheight - 250); # 50 - bottom buffer + + +$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('vicidial.php','',$agcPAGE); + +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 +echo "\n"; +echo "\n"; +echo "\n"; + +if ($campaign_login_list > 0) +{ +$camp_form_code = "\n"; +} +else +{ +$camp_form_code = "\n"; +} + + +if ($LogiNAJAX > 0) +{ +?> + + + +VICIWÄHLEN web client: Re-Login\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "
English Deutsch
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Re-Login
 
Telefon Login:
Telefon Passwort:
Benutzer Login:
Benutzer Passwort:
Kampagne: $camp_form_code

VERSION: $version       BUILD: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} + +if ($user_login_first == 1) +{ + if ( (strlen($VD_login)<1) or (strlen($VD_pass)<1) or (strlen($VD_campaign)<1) ) + { + echo "VICIWÄHLEN web client: Kampagne Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Deutsch
\n"; + echo "
\n"; + echo "\n"; + #echo "\n"; + #echo "\n"; + echo "

Benutzer Login

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Kampagne Login
 
Benutzer Login:
Benutzer Passwort:
Kampagne: $camp_form_code
  \n"; + echo "

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) + { + $stmt="SELECT phone_login,phone_pass from vicidial_users where user='$VD_login' and pass='$VD_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); + $phone_login=$row[0]; + $phone_pass=$row[1]; + + echo "VICIWÄHLEN web client: Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Deutsch
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Login
 
Telefon Login:
Telefon Passwort:
Benutzer Login:
Benutzer Passwort:
Kampagne: $camp_form_code
  \n"; + echo "

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + + } + } +} + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "VICIWÄHLEN web client: Telefon Login\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "
English Deutsch
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Telefon Login
 
Telefon Login:
Telefon Passwort:
  \n"; +echo "

VERSION: $version       BUILD: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./vicidial_auth_entries.txt", "a");} +$VDloginDISPLAY=0; + + if ( (strlen($VD_login)<2) or (strlen($VD_pass)<2) or (strlen($VD_campaign)<2) ) + { + $VDloginDISPLAY=1; + } + else + { + $stmt="SELECT count(*) from vicidial_users where user='$VD_login' and pass='$VD_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($auth>0) + { + $login=strtoupper($VD_login); + $password=strtoupper($VD_pass); + ##### grab the full name of the agent + $stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,closer_default_blended,user_group,vicidial_recording_override from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $user_level=$row[1]; + $VU_hotkeys_active=$row[2]; + $VU_agent_choose_ingroups=$row[3]; + $VU_scheduled_callbacks=$row[4]; + $agentonly_callbacks=$row[5]; + $agentcall_manual=$row[6]; + $VU_vicidial_recording=$row[7]; + $VU_vicidial_transfers=$row[8]; + $VU_closer_default_blended=$row[9]; + $VU_user_group=$row[10]; + $VU_vicidial_recording_override=$row[11]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|$VD_pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + $user_abb = "$VD_login$VD_login$VD_login$VD_login"; + while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + + $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$VU_user_group';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGallowed_campaigns =$row[0]; + + if ( (!eregi(" $VD_campaign ",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) + { + echo "VICIWÄHLEN web client: VICIWÄHLEN Kampagne Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Deutsch
\n"; + echo "Sorry, you are not allowed to login to this campaign: $VD_campaign\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Login: \n
"; + echo "Passwort:
\n"; + echo "Kampagne: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + ##### check to see that the campaign is active + $stmt="SELECT count(*) FROM vicidial_campaigns where campaign_id='$VD_campaign' and active='Y';"; + 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); + $CAMPactive=$row[0]; + if($CAMPactive>0) + { + if ($TEST_all_statuses > 0) {$selectableSQL = '';} + else {$selectableSQL = "selectable='Y' and";} + $VARstatuses=''; + $VARstatusnames=''; + ##### grab the statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_statuses WHERE $selectableSQL status != 'NEW' order by status limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $VD_statuses_ct) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + } + + ##### grab the campaign-specific statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_campaign_statuses WHERE $selectableSQL status != 'NEW' and campaign_id='$VD_campaign' order by status limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_camp = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + $j++; + } + $VD_statuses_ct = ($VD_statuses_ct+$VD_statuses_camp); + $VARstatuses = substr("$VARstatuses", 0, -1); + $VARstatusnames = substr("$VARstatusnames", 0, -1); + + ##### grab the campaign-specific HotKey statuses that can be used for dispositioning by an agent + $stmt="SELECT hotkey,status,status_name FROM vicidial_campaign_hotkeys WHERE selectable='Y' and status != 'NEW' and campaign_id='$VD_campaign' order by hotkey limit 9;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $HK_statuses_camp = mysql_num_rows($rslt); + $w=0; + $HKboxA=''; + $HKboxB=''; + $HKboxC=''; + while ($w < $HK_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $HKhotkey[$w] =$row[0]; + $HKstatus[$w] =$row[1]; + $HKstatus_name[$w] =$row[2]; + $HKhotkeys = "$HKhotkeys'$HKhotkey[$w]',"; + $HKstatuses = "$HKstatuses'$HKstatus[$w]',"; + $HKstatusnames = "$HKstatusnames'$HKstatus_name[$w]',"; + if ($w < 3) + {$HKboxA = "$HKboxA $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ( ($w >= 3) and ($w < 6) ) + {$HKboxB = "$HKboxB $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ($w >= 6) + {$HKboxC = "$HKboxC $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + $w++; + } + $HKhotkeys = substr("$HKhotkeys", 0, -1); + $HKstatuses = substr("$HKstatuses", 0, -1); + $HKstatusnames = substr("$HKstatusnames", 0, -1); + + ##### grab the statuses to be dialed for your campaign as well as other campaign settings + $stmt="SELECT park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,agent_pause_codes_active,no_hopper_leads_logins,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,xfer_groups FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $park_ext = $row[0]; + $park_file_name = $row[1]; + $web_form_address = $row[2]; + $allow_closers = $row[3]; + $auto_dial_level = $row[4]; + $dial_timeout = $row[5]; + $dial_prefix = $row[6]; + $campaign_cid = $row[7]; + $campaign_vdad_exten = $row[8]; + $campaign_rec_exten = $row[9]; + $campaign_recording = $row[10]; + $campaign_rec_filename = $row[11]; + $campaign_script = $row[12]; + $get_call_launch = $row[13]; + $campaign_am_message_exten = $row[14]; + $xferconf_a_dtmf = $row[15]; + $xferconf_a_number = $row[16]; + $xferconf_b_dtmf = $row[17]; + $xferconf_b_number = $row[18]; + $alt_number_dialing = $row[19]; + $VC_scheduled_callbacks = $row[20]; + $wrapup_Sekunden = $row[21]; + $wrapup_message = $row[22]; + $closer_campaigns = $row[23]; + $use_internal_dnc = $row[24]; + $allcalls_delay = $row[25]; + $omit_phone_code = $row[26]; + $agent_pause_codes_active = $row[27]; + $no_hopper_leads_logins = $row[28]; + $campaign_allow_inbound = $row[29]; + $manual_dial_list_id = $row[30]; + $default_xfer_group = $row[31]; + $xfer_groups = $row[32]; + + if ( (!ereg('DISABLED',$VU_vicidial_recording_override)) and ($VU_vicidial_recording > 0) ) + { + $campaign_recording = $VU_vicidial_recording_override; + print "\n"; + } + if ( ($VC_scheduled_callbacks=='Y') and ($VU_scheduled_callbacks=='1') ) + {$scheduled_callbacks='1';} + if ($VU_vicidial_recording=='0') + {$campaign_recording='NEVER';} + if ($alt_number_dialing=='Y') + {$alt_phone_dialing='1';} + else + {$alt_phone_dialing='0';} + $closer_campaigns = preg_replace("/^ | -$/","",$closer_campaigns); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaigns = "'$closer_campaigns'"; + + if ($agent_pause_codes_active=='Y') + { + ##### grab the pause codes for this campaign + $stmt="SELECT pause_code,pause_code_name FROM vicidial_pause_codes WHERE campaign_id='$VD_campaign' order by pause_code limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_pause_codes = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_pause_codes) + { + $row=mysql_fetch_row($rslt); + $pause_codes[$i] =$row[0]; + $pause_code_names[$i] =$row[1]; + $VARpause_codes = "$VARpause_codes'$pause_codes[$i]',"; + $VARpause_code_names = "$VARpause_code_names'$pause_code_names[$i]',"; + $i++; + $j++; + } + $VD_pause_codes_ct = ($VD_pause_codes_ct+$VD_pause_codes); + $VARpause_codes = substr("$VARpause_codes", 0, -1); + $VARpause_code_names = substr("$VARpause_code_names", 0, -1); + } + + ##### grab the inbound groups to choose from if campaign contains CLOSER + $VARingroups="''"; + if ($campaign_allow_inbound == 'Y') + { + $VARingroups=''; + $stmt="select group_id from vicidial_inbound_groups where active = 'Y' and group_id IN($closer_campaigns) order by group_id limit 60;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $closer_ct = mysql_num_rows($rslt); + $INgrpCT=0; + while ($INgrpCT < $closer_ct) + { + $row=mysql_fetch_row($rslt); + $closer_groups[$INgrpCT] =$row[0]; + $VARingroups = "$VARingroups'$closer_groups[$INgrpCT]',"; + $INgrpCT++; + } + $VARingroups = substr("$VARingroups", 0, -1); + } + + ##### grab the allowable inbound groups to choose from for transfer options + $xfer_groups = preg_replace("/^ | -$/","",$xfer_groups); + $xfer_groups = preg_replace("/ /","','",$xfer_groups); + $xfer_groups = "'$xfer_groups'"; + $VARxfergroups="''"; + if ($allow_closers == 'Y') + { + $VARxfergroups=''; + $stmt="select group_id,group_name from vicidial_inbound_groups where active = 'Y' and group_id IN($xfer_groups) order by group_id limit 60;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $xfer_ct = mysql_num_rows($rslt); + $XFgrpCT=0; + while ($XFgrpCT < $xfer_ct) + { + $row=mysql_fetch_row($rslt); + $VARxfergroups = "$VARxfergroups'$row[0]',"; + $VARxfergroupsnames = "$VARxfergroupsnames'$row[1]',"; + if ($row[0] == "$default_xfer_group") {$default_xfer_group_name = $row[1];} + $XFgrpCT++; + } + $VARxfergroups = substr("$VARxfergroups", 0, -1); + $VARxfergroupsnames = substr("$VARxfergroupsnames", 0, -1); + } + + ##### grab the number of leads in the hopper for this campaign + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id = '$VD_campaign' and status='READY';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $campaign_leads_to_call = $row[0]; + print "\n"; + + } + else + { + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Die Kampagne ist nicht aktiv, versuchen sie es bitte noch einmal
"; + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|$VD_pass|$ip|$browser|\n"); + fclose($fp); + } + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Falsches Passwort, versuchen sie es bitte noch einmal
"; + } + } + if ($VDloginDISPLAY) + { + echo "VICIWÄHLEN web client: Kampagne Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Deutsch
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "

$VDdisplayMESSAGE

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Kampagne Login
 
Benutzer Login:
Benutzer Passwort:
Kampagne: $camp_form_code
  \n"; + echo "

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +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); +$authphone=$row[0]; +if (!$authphone) + { + echo "VICIWÄHLEN web client: Telefon Login Error\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Deutsch
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Login Error
 
Ihr Telefon Login ist nicht aktiv, bitte versuchen sie es noch einmal:
 
Telefon Login:
Telefon Passwort:

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "VICIWÄHLEN web client\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + 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); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $login=$row[6]; + $pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $AnruferID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + $enable_sipsak_messages=$row[66]; + + if ($clientDST) + { + $local_gmt = ($local_gmt + $isdst); + } + if ($protocol == 'EXTERNAL') + { + $protocol = 'Local'; + $extension = "$dialplan_number$AT$ext_context"; + } + $SIP_user = "$protocol/$extension"; + + $stmt="SELECT asterisk_version from servers where server_ip='$server_ip';"; + 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); + $asterisk_version=$row[0]; + + # If a park extension is not set, use the default one + if ( (strlen($park_ext)>0) && (strlen($park_file_name)>0) ) + { + $VICIDiaL_park_on_extension = "$park_ext"; + $VICIDiaL_park_on_filename = "$park_file_name"; + print "\n"; + } + print "\n"; + + # If a web form address is not set, use the default one + if (strlen($web_form_address)>0) + { + $VICIDiaL_web_form_address = "$web_form_address"; + print "\n"; + } + else + { + $VICIDiaL_web_form_address = "$VICIDiaL_web_URL"; + print "\n"; + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + } + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + # If closers are allowed an this campaign + if ($allow_closers=="Y") + { + $VICIDiaL_allow_closers = 1; + print "\n"; + } + else + { + $VICIDiaL_allow_closers = 0; + print "\n"; + } + + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtimE$US$session_ext$session_rand"; + + if ($webform_sessionname) + {$webform_sessionname = "&session_name=$session_name";} + else + {$webform_sessionname = '';} + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'vicidial';"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','vicidial','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + if ( ($campaign_allow_inbound == 'Y') || ($campaign_leads_to_call > 0) || (ereg('Y',$no_hopper_leads_logins)) ) + { + ### insert an entry into the user log for the login event + $stmt = "INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$VD_login','LOGIN','$VD_campaign','$NOW_TIME','$StarTtimE','$VU_user_group')"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + ##### check to see if the user has a conf extension already, this happens if they previously exited uncleanly + $stmt="SELECT conf_exten FROM vicidial_conferences where extension='$SIP_user' and server_ip = '$server_ip' LIMIT 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $prev_login_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $prev_login_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + if ($prev_login_ct > 0) + {print "\n";} + else + { + ##### grab the next available vicidial_conference room and reserve it + $stmt="SELECT conf_exten FROM vicidial_conferences where server_ip = '$server_ip' and ((extension='') or (extension is null)) LIMIT 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $free_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $free_conf_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + $stmt="UPDATE vicidial_conferences set extension='$SIP_user' where server_ip='$server_ip' and conf_exten='$session_id';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + print "\n"; + + } + + $stmt="UPDATE vicidial_list set status='N', user='' where status IN('QUEUE','INCALL') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_hopper where status IN('QUEUE','INCALL','DONE') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_live_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_live_inbound_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + # print "You have logged in as user: $VD_login an phone: $SIP_user zur Kampagne: $VD_campaign
\n"; + $VICIDiaL_is_logged_in=1; + + ### set the callerID for manager middleware-app to connect the phone to the user + $SIqueryCID = "S$CIDdate$session_id"; + + ############################################# + ##### START SYSTEM_SETTINGS LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,vicidial_agent_disable,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $vicidial_agent_disable = $row[6]; + $allow_sipsak_messages = $row[7]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_prefix = 'LIN-'; + print "\n"; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$VD_campaign\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + $SIqueryCID = "$SIPSAK_prefix$VD_campaign$DS$CIDdate"; + } + + ### insert a NEU record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$SIqueryCID','Channel: $SIP_user','Context: $ext_context','Exten: $session_id','Priority: 1','Callerid: $SIqueryCID','','','','','');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($auto_dial_level > 0) + { + print "\n"; + + ##### grab the campaign_weight and number of calls today an that campaign for the agent + $stmt="SELECT campaign_weight,calls_today FROM vicidial_campaign_agents where user='$VD_login' and campaign_id = '$VD_campaign';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vca_ct = mysql_num_rows($rslt); + if ($vca_ct > 0) + { + $row=mysql_fetch_row($rslt); + $campaign_weight = $row[0]; + $calls_today = $row[1]; + $i++; + } + else + { + $campaign_weight = '0'; + $calls_today = '0'; + $stmt="INSERT INTO vicidial_campaign_agents (user,campaign_id,campaign_rank,campaign_weight,calls_today) values('$VD_login','$VD_campaign','0','0','$calls_today');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + } + $closer_chooser_string=''; + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,user_level,campaign_weight,calls_today) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$closer_chooser_string','$user_level','$campaign_weight','$calls_today');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='$VD_campaign',agent='Agent/$VD_login',verb='AGENTLOGIN',data1='$VD_login@agents',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + mysql_close($linkB); + mysql_select_db("$VARDB_database", $link); + } + + + if ($campaign_allow_inbound == 'Y') + { + print "\n"; + } + } + else + { + print "\n"; + + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,user_level) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$user_level');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='$VD_campaign',agent='Agent/$VD_login',verb='AGENTLOGIN',data1='$VD_login@agents',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + mysql_close($linkB); + mysql_select_db("$VARDB_database", $link); + } + } + } + else + { + echo "VICIWÄHLEN web client: VICIWÄHLEN Kampagne Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Deutsch
\n"; + echo "Es sind keine aktiven Adressen mehr im Hopper\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Login: \n
"; + echo "Passwort:
\n"; + echo "Kampagne: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + if (strlen($session_id) < 1) + { + echo "VICIWÄHLEN web client: VICIWÄHLEN Kampagne Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Deutsch
\n"; + echo "Sorry, there are no available sessions\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Login: \n
"; + echo "Passwort:
\n"; + echo "Kampagne: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + if (ereg('MSIE',$browser)) + { + $useIE=1; + print "\n"; + } + else + { + $useIE=0; + print "\n"; + } + + $StarTtimE = date("U"); + $NOW_TIME = date("Y-m-d H:i:s"); + ##### Agent is going to log in so insert the vicidial_agent_log entry now + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group,sub_status) values('$VD_login','$server_ip','$NOW_TIME','$VD_campaign','$StarTtimE','0','$StarTtimE','$VU_user_group','LOGIN');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id($link); + print "\n"; + + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $server_ip_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S"; + + ##### grab the datails of all active scripts in the system + $stmt="SELECT script_id,script_name,script_text FROM vicidial_scripts WHERE active='Y' order by script_id limit 100;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $MM_scripts = mysql_num_rows($rslt); + $e=0; + while ($e < $MM_scripts) + { + $row=mysql_fetch_row($rslt); + $MMscriptid[$e] =$row[0]; + $MMscriptname[$e] = rawurlencode($row[1]); + $MMscripttext[$e] = rawurlencode($row[2]); + $MMscriptids = "$MMscriptids'$MMscriptid[$e]',"; + $MMscriptnames = "$MMscriptnames'$MMscriptname[$e]',"; + $MMscripttexts = "$MMscripttexts'$MMscripttext[$e]',"; + $e++; + } + $MMscriptids = substr("$MMscriptids", 0, -1); + $MMscriptnames = substr("$MMscriptnames", 0, -1); + $MMscripttexts = substr("$MMscripttexts", 0, -1); + + } +} + +################################################################ +### BEGIN - build the callback calendar (12 months) ### +################################################################ +define ('ADAY', (60*60*24)); +$CdayARY = getdate(); +$Cmon = $CdayARY['mon']; +$Cyear = $CdayARY['year']; +$CTODAY = date("Y-m"); +$CTODAYmday = date("j"); +$CINC=0; + +$Cmonths = Array('Januar','February','März','April','Mai','Juni', + 'Juli','August','September','Oktober','November','Dezember'); +$Cdays = Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); + +$CCAL_OUT = ''; + +$CCAL_OUT .= ""; + +while ($CINC < 12) +{ +if ( ($CINC == 0) || ($CINC == 4) ||($CINC == 8) ) + {$CCAL_OUT .= "";} + +$CCAL_OUT .= ""; + +if ( ($CINC == 3) || ($CINC == 7) ||($CINC == 11) ) + {$CCAL_OUT .= "";} +$CINC++; +} + +$CCAL_OUT .= "
"; + +$CYyear = $Cyear; +$Cmonth= ($Cmon + $CINC); +if ($Cmonth > 12) + { + $Cmonth = ($Cmonth - 12); + $CYyear++; + } +$Cstart= mktime(11,0,0,$Cmonth,1,$CYyear); +$CfirstdayARY = getdate($Cstart); +#echo "|$Cmon|$Cmonth|$CINC|\n"; +$CPRNTDAY = date("Y-m", $Cstart); + +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; + +foreach($Cdays as $Cday) +{ + $CDCLR="#ffffff"; +$CCAL_OUT .= ""; +} + +for( $Ccount=0;$Ccount<(6*7);$Ccount++) +{ + $Cdayarray = getdate($Cstart); + if((($Ccount) % 7) == 0) + { + if($Cdayarray['mon'] != $CfirstdayARY['mon']) + break; + $CCAL_OUT .= ""; + } + if($Ccount < $CfirstdayARY['wday'] || $Cdayarray['mon'] != $Cmonth) + { + $CCAL_OUT .= ""; + } + else + { + if( ($Cdayarray['mday'] == $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + else + { + $CDCLR="#ffffff"; + if ( ($Cdayarray['mday'] < $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CDCLR="#CCCCCC"; + $CBL = ''; + $CEL = ''; + } + else + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + } + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + } +} +$CCAL_OUT .= ""; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$CfirstdayARY[month] $CfirstdayARY[year]"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$Cday"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
 "; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; + +#echo "$CCAL_OUT\n"; +################################################################ +### END - build the callback calendar (12 months) ### +################################################################ + + +?> + + + + +\n"; + + +?> + +
+ + MARGINWIDTH=0 MARGINHEIGHT=0 LEFTMARGIN=0 TOPMARGIN=0 VALIGN=TOP ALIGN=LEFT> +
+ + + +LOGOUT\n"; ?> +
+
+ + + height=30> + + + + + +
VICIWÄHLENSCRIPT VALIGN=MIDDLE ALIGN=CENTER>   LIVE     Session ID: Live Anruf
+
+ + + + + height=>

VICIWÄHLEN
+
+ + +MANUELLER ANRUF       SCHNELLER VORWAHLKNOPF
+
+ + +X AKTIVE WIEDERVORLAGEN
+
+ + +
+
+ + + D1 - WÄHLEN\n"; + echo "
\n"; + echo "D2 - WÄHLEN\n"; + } + else {echo "
\n";} + ?> +

+
+
+ + + height=460>
WIEDERVORLAGEN FÜR AGENT :
Klicken Sie jetzt unten auf eine Wiedervorlage, um den Kunden zurückzurufen. Danach wird die Wiedervorlage aus der Liste gelöscht.. +
+
+
  + Aktualisieren +                 + Zurück +
+
+ + + height=460>
NEUE MANUELLE ADRESSE FÜR :

Tragen Sie unten die Informationen zu der neuen Adresse ein, die SIE wählen möchten. +
+ \n"; + } + ?> + Note: all new manual dial leads will go into list

+ + + + + + + + + + + + + + + +
Wahl Code:   (Dieses ist normalerweise 49 in Deutschland)
Telefon Number: +   (12 digits max - digits only) +
Suche existierende Adresse:   (Wenn diese Option ausgewählt ist, wird versucht, die Telefonnummer im System zu finden, bevor eine neue Adresse eingefügt wird)


Wenn Sie eine Nummer wählen möchten, die nicht in der Adressliste aufgenommen werden soll, müssen die genaue Nummer in das WÄHLVORGANG OVERRIDE Feld eintragen. Um diesen Anruf aufzulegen, müssen Sie auf den ANRUFS IN THIS SESSION Link klicken, und dann mit dem Leitung Link den Anruf zu beenden..
 
Wahl Override:   (Bitte nur Zahlen) +
+
+ Jetzt wählen +                 + Zurück +
+
+ + + +
+
+ + + + +Ihr Status:
Calls Dialing: +
+ + + + + > + +
+
+ + Transfer - Konferenz
+ + + LOKALER SUPERVISOR + Transferleitung auflegen + Beide Leitungen auflegen + +
+ + Anzurufende Telefonnummer   + + WÄHLVORGANG OVERRIDE   + 3-WEGE ANRUF VERLASSEN + Wähle blinden Transfer + D1 + D2 + +
+ + Sekunden   + channel + Kunden anrufen + Kundenanruf parken + Blind Transfer VMail Message +
+
+
+
+ + + + height=70> + +
Adresse hat das Gesprächsergebnis:

+ -
+
+
+ + + height=70> + + + + +
Gesprächsergebniss Tastaturkürzel: + Wenn aktiviert, drücken sie einfach die entsprechende Taste, um das Gesprächsgebnis zu speichern. Der Anruf wird dann automatisch aufgelegt.:
+ + + + + +
+
+ + + height=70> + + + + + + +
Informationen zur letzten Wiedervorlage: close
+
+
+
+
+ +
+
+ + + height=500>
Niemand ist in ihrer Konferenz.:
+ Zurück +

+ Agent wieder anrufen +
+
+ + + height=500>
Kunde hat aufgelegt:
+ Zurück +

+ Ende und Gesprächsergebniss + +
+
+ + + height=550>
Anruf Nachbereitung Verbleibende Sekunden der Nachbereitung

+ +

+ Beende Nachbereitung und mache weiter + +
+
+ + + height=500>
Ihr Lernabschnitt ist gesperrt worden
LOGOUT

Zurück +
+
+ + + height=500>

LOGOUT
+
+ + +
+
+ + +
 
+
+ + + height=47>
Die Änderungen an den Kundendaten werden nicht übernommen. Sie müssen die Kundendaten ändern bevor Sie aufgelegt haben..
+
+ + + height=460>
ABSCHLUSS ANRUF :       Wieder Auflegen       minimieren
+ Gesprächsergebnis Auswahl +
+ WÄHLPAUSE
+ FORMULAR ZURÜCKSETZEN | + ÜBERNEHMEN +

+ WEB FORM ÜBERNEHMEN +

  +
+
+ + + height=460>
WÄHLEN Sie Einen PAUSE CODE Vor :
+ Pause Code Selection + +

  +
+
+ + + height=460>
Wählen Sie ein Rückrufadatum :
+ + + Wählen Sie unten ein Datum   +     + Hour: +   + Minutes: +   + +  
+ NUR MEINE WIEDERVORLAGE
";} + ?> + WV Anmerkungen:

+ + ÜBERNEHMEN

+ +

  +
+
+ + + height=460>
SUPERVISOR INBOUND GRUPPENWAHL
+ Supervisor Inbound Gruppenwahl +
+ GEMISCHTES ANRUFEN(Outbound aktiviert)
+ ZURÜCKSETZEN | + ÜBERNEHMEN +



  +
+
+ + + + Kanal + Kanal + NUR MEINE WIEDERVORLAGE
";} + ?> +
+ + + + height=>
VICIWÄHLEN SCRIPT
+
+ + + 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> +TASTATURKÜRZEL DEAKTIVIERT + + + + +> + + + +
VICIWÄHLEN Web-Client Version:     BUILD:               Server:              
+Konferenz Informationen zeigen

 
+
+ + + +
+
+ + + + + id="MainTable"> + + + + + + + + + + + + + + + +
STATUS:
+
+Nächste Nummer wählen
+ ADRESSEN VORSCHAU
+ ALTERNATIVE TELEFONNUMMER WÄHLEN
+ + +Aufzeichnungsdatei:
+
+
+Aufzeichnugs ID:
+
+ +Starte Aufnahme
+
+Web Formular
+
+Parke Anruf
+Transfer - Konferenz
+
+Kunden auflegen
+
+
Senden Sie DTMF

+
+
+
align=left valign=top> + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Sekunden:   Kanal:   Cust Zeit:
Kunden Information:
Titel:   Vorname:   MI:  Nachname:
Adresse1:
Adresse2:   Adresse3:
Stadt:   Bundesland:   Postleitzahl:
Region:   Anbieter ID:
Telefon:   Vorwahl:   Alternative Telefonnummer:
Zeigen:   Email:
Anmerkungen: + +\n";} +else + {echo "\n";} +?> + +
+
+ +
+
> + 
+ + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/voicemail_check.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/voicemail_check.php new file mode 100644 index 00000000..6ddcee43 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_de/voicemail_check.php @@ -0,0 +1,140 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "\n"; +echo "\n"; +echo "\n"; +echo "Voicemail Check"; +echo "\n"; +echo "\n"; +echo "\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";} + $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";} + } + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/active_list_refresh.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/active_list_refresh.php new file mode 100644 index 00000000..2de39cae --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/active_list_refresh.php @@ -0,0 +1,482 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "\n"; +echo "\n"; +echo "\n"; +echo "Κατάλογος Οθόνης: "; +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 "\n"; +echo "\n"; +echo "\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 "\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + +###################### +# ADD=2 display all busy extensions on a server +###################### +if ($ADD==2) +{ + if (!$field_name) {$field_name = 'busyext';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\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 "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=4 display all busy Local lines on a server +###################### +if ($ADD==4) +{ + if (!$field_name) {$field_name = 'local';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\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 "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='table') {echo "\n";} +if ($format=='table') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/astguiclient.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/astguiclient.php new file mode 100644 index 00000000..c54d4038 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/astguiclient.php @@ -0,0 +1,2905 @@ + LICENSE: GPLv2 +# +# make sure you have added a user to the vicidial_users MySQL table with at least +# user_level 1 or greater to access this page. Also you need to have the login +# and pass of a phone listed in the asterisk.phones table. The page grabs the +# server info and other details from this login and pass +# +# Other scripts that this application depends on: +# - active_list_refresh.php: displays active/live channels and phones +# - manager_send.php: sends Actions to be executed on Asterisk servers +# - live_exten_check.php: checks to see if user's phone is on a live call +# - call_log_display.php: retrieves log of inbound and outbound calls +# - voicemail_check.php: retrieves counts of new and old messages +# - inbound_popup.php: opens upon live_inbound call coming in +# - conf_exten_check.php: checks to see if and calls are in a specific conf +# - park_calls_display.php: retrieves list of parked calls +# - vdc_db_query.php: Changes values in the DB for non-calling records +# +# CHANGES +# 50215-1356 - Proof-of-concept test of XMLHttpRequest for astGUIclient web +# 50323-1411 - First build version display-only +# 50331-1040 - Second-build, added phone login and hangup/hijack display +# 50401-1006 - Trunk/Local Hangup functions enabled +# 50404-1056 - Trunk/Local Hijack functions enabled +# 50404-1459 - Simple live calls display and grabs updated time from server +# 50405-1221 - Reorganized the display and layers, added some images +# 50406-1005 - Added In/Out call log display to MAIN panel +# 50407-1254 - Start/Stop Recording on live calls enabled +# 50422-1101 - Activated Check Voicemail button and new/old messages count +# 50428-1449 - Added dial from log and basic live_inbound call popup +# 50429-1455 - Modified inbound popup code for IE and to add more functions +# 50502-1442 - Added basic method to transfer live calls somewhere else +# 50503-1205 - Added web_client_sessions entry for more security of subscripts +# 50503-1537 - Added basic conferences display +# 50509-1132 - Added conference connected list and hangup/xfer for them +# 50511-1129 - Added registration of conference rooms and added manual dial +# 50523-1342 - Added Conference recording and send DTMF +# 50523-1622 - Added Local Dial window frame for calling local extensions +# 50524-1456 - Added ability to park call and display number of parked calls +# 50524-1600 - Added ability to display and pickup/hangup/xfer parked calls +# 50525-1224 - Added ability to place outbound call from within conferene +# 50531-1225 - Added ability to do dual transfers to meetme rooms from Main +# 50711-1229 - removed HTTP authentication in favor of user/pass vars +# 50711-1610 - Added Zap monitoring to Trunk/Local Action screens +# 50804-1604 - Minor bug fix in inbound_popup functions +# 50818-1715 - Added pretty login section +# 50913-1137 - Added custom outbound_cid from phones table +# 51110-1430 - Fixed non-standard http port issue +# 60103-1421 - Added code for favorite extensions chooser +# 60104-1347 - Added basic layout for favorites editing frame +# 60105-1124 - Finished Favorites frame and added DB submission +# 60112-1622 - Several formatting changes +# 60421-1357 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1103 - Added variable filters to close security holes for login form +# 60829-1528 - Made compatible with WeBRooTWritablE setting in dbconnect.php +# + +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["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["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} + 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"];} + } + +$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++;} + +$version = '2.0.1'; +$build = '60829-1528'; + +### 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); + $user=ereg_replace("[^0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^0-9a-zA-Z]","",$pass); + + +if ($force_logout) +{ + if( (strlen($_SERVER['user'])>0) or (strlen($_SERVER['pass'])>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "Έχετε αποσυνδεθεί. Σας ευχαÏιστοÏμε\n"; + exit; +} + +$StarTtime = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_TIME = date("Ymd-His"); + $month_old = mktime(0, 0, 0, date("m"), date("d")-7, date("Y")); + $past_month_date = date("Y-m-d H:i:s",$month_old); + + $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]; + +$US='_'; +$CL=':'; +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./astguiclient_auth_entries.txt", "a");} +$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 = $agcPAGE; +$agcDIR = eregi_replace('astguiclient.php','',$agcDIR); + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth) or ($relogin == 'YES') ) + { + header ("Content-type: text/html; charset=utf-8"); + + echo "χειÏιστής astGUIclient: ΣÏνδεση\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
ΣÏνδεση
 
ΣÏνδεση χÏήστη:
Κωδικός Ï€Ïόσβασης χÏήστη:
ΣÏνδεση Τηλεφώνου:
Κωδικός Ï€Ïόσβασης Τηλεφώνου:

ΕΚΔΟΣΗ: $version       ΔΗΜΙΟΥΡΓΙΑ: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($user); + $password=strtoupper($pass); + $stmt="SELECT full_name,user_level from vicidial_users where user='$user' and pass='$pass'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIΚΛΗΣΗ|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIΚΛΗΣΗ|FAIL|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + } + +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 +echo "\n"; +echo "\n"; +echo "\n"; + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "χειÏιστής astGUIclient: ΣÏνδεση Τηλεφώνου\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "
English Ελληνικά
\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
ΣÏνδεση Τηλεφώνου
 
ΣÏνδεση Τηλεφώνου:
Κωδικός Ï€Ïόσβασης Τηλεφώνου:

ΕΚΔΟΣΗ: $version       ΔΗΜΙΟΥΡΓΙΑ: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$authphone=$row[0]; +if (!$authphone) + { + echo "χειÏιστής astGUIclient: ΣÏνδεση Τηλεφώνου\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
ΣÏνδεση Τηλεφώνου
 
Συγγνώμη, αλλά η τηλεφωνική σÏνδεση και ο κωδικός Ï€Ïόσβασής σας δεν είναι ενεÏγά σε αυτό το σÏστημα, παÏακαλώ Ï€Ïοσπαθήστε πάλι:
 
ΣÏνδεση Τηλεφώνου:
Κωδικός Ï€Ïόσβασης Τηλεφώνου:

ΕΚΔΟΣΗ: $version       ΔΗΜΙΟΥΡΓΙΑ: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "χειÏιστής astGUIclient\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $phone_login=$row[6]; + $phone_pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CaLLerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + $outbound_cid=$row[65]; + + $local_web_callerID_URL_enc = rawurlencode($local_web_callerID_URL); + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtime$US$session_ext$session_rand"; + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'agc';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','agc','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT count(*) from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_present=$row[0]; + if ($favorites_present > 0) + { + $stmt="SELECT extensions_list from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_list=$row[0]; + $h=0; + $favorites_listX = eregi_replace("'",'',$favorites_list); + $favorites = explode(',',$favorites_listX); + $favorites_count = count($favorites); + $favorites_listX=''; + + $o=0; + while ($favorites_count > $o) + { + $stmt="SELECT fullname,protocol from phones where extension = '$favorites[$o]' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $favorites_names[$o] = $rowx[0]; + $favorites_listX .= "$rowx[1]/$favorites[$o],"; + $o++; + } + + echo "\n"; + echo "\n"; + } + else + { + echo "\n"; + } + +### gather phone extensions and fullnames for favorites editor ### + $stmt="SELECT extension,fullname from phones where server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $exten_ct = mysql_num_rows($rslt); + $favlistCT=0; + $nofavlistCT=0; + while ($favlistCT < $exten_ct) + { + $row=mysql_fetch_row($rslt); + $favlist[$favlistCT]= "$row[0] - $row[1]"; + $favlistCT++; + } + + } +} + + +?> + + + + + + +\n"; + + +?> + +
+ + + + + + + + + +
+ + +ΑΠΟΣΥÎΔΕΣΗ
\n"; ?> +
ΚÏÏιος ΠίνακαςΠίνακας ΕνεÏγών ΓÏαμμώνΠίνακας διασκέψεωνΕλεγχος Î¦Ï‰Î½Î·Ï„Î¹ÎºÎ¿Ï Ï„Î±Ï‡Ï…Î´ÏομείουΕνεÏγή κλήση
+
+ + +

Logout
+
+ + +
TRUNK ΚΛΕΙΣΙΜΟ

+ Active Trunks Menu
+ Κλείσιμο ΚοÏÎ¼Î¿Ï   |   + Κλέψιμο ΚοÏÎ¼Î¿Ï   |   + ΑκοÏστε ΚοÏμό   |   + Ανανέωση   |   + ΕπιστÏοφή στο Βασικό ΠαÏάθυÏο +
+
+ + +
ΤΟΠΙΚΟ ΚΛΕΙΣΙΜΟ ΤΗΛΕΦΩÎΟΥ

+ ΕνεÏγές Τοπικές Επιλογές
+ Κλείσιμο Ï„Î¿Ï€Î¹ÎºÎ¿Ï   |   + Κλέψιμο Ï„Î¿Ï€Î¹ÎºÎ¿Ï   |   + ΑκοÏστε τοπικό   |   + Ανανέωση   |   + ΕπιστÏοφή στο Βασικό ΠαÏάθυÏο +
+
+ + + + + + + +
ΜΕΤΑΦΟΡΑ ΕÎΕΡΓΗΣ ΚΛΗΣΗΣ
Κανάλι Ï€Ïος μεταφοÏά: Κανάλι
Τηλ.συνδέσεις:
Επιλογές τηλ. συνδέσεων
+
+ Στείλε στην επιλεγμένη τηλ.σÏνδεση

+ Στείλε στο επιλεγμένο vmail

+ Στείλε σε αυτόν τον αÏιθμό:


+ Ανανέωση


+ ΕπιστÏοφή στο Βασικό ΠαÏάθυÏο

+
Διασκέψεις:
(επιλέξτε έναν αÏιθμό κατωτέÏω που θα σταλεί σε μια διάσκεψη)
Στείλε το κανάλι μου επίσης
Επιλογές διασκέψεων
+
+ + + + + +
ΤΟΠΙΚΕΣ τηλ. συνδέσεις Κλήσεως
Τηλέφωνο που καλεί από: Κανάλι
Τηλ.συνδέσεις:
Επιλογές τηλ. συνδέσεων
+
+ Επιλεγμένη κλήση τηλ. σÏνδεσης

+ Επιλεγμένη κλήση vmail

+ Ανανέωση


+ ΕπιστÏοφή στο Βασικό ΠαÏάθυÏο

+
+
+ + +
ΣΤΑΘΜ.ΚΛΗΣΕΙΣ:
+ ΕπιστÏοφή στο Βασικό ΠαÏάθυÏο

+
+
+ + + + + + + + + + + + + + + +
  +
ΦΩÎ.ΤΑΧ.     ÎΕΟ:     ΠΑΛΑΙΟ:             ΧΕΙΡ.ΚΛΗΣΗ       ΚΛΗΣΗ
ΣΤΑΘΜ.ΚΛΗΣΕΙΣ: 0                Î¤Î—Λ.ΣΥÎΔ. ΤΟΠΙΚΗΣ ΚΛΗΣΗΣ
ΕΞΕΡΧΟΜΕÎΕΣ ΚΛΗΣΕΙΣ:
ΕΙΣΕΡΧΟΜΕÎΕΣ ΚΛΗΣΕΙΣ:
ΈΚΔΟΣΗ astGUIclient: ΔΗΜΙΟΥΡΓΙΑ:
+ + + + $h) + { + if (strlen($favorites[$h])>1) + { + echo "\n"; + } + $h++; + } +?> + +
ΑΓΑΠΗΜΕÎΑ       διοÏθώστε
$favorites[$h] - $favorites_names[$h]
 
+
+ + + + + + + +
ΑΓΑΠΗΜΕÎΑ

 
ΥΠΟΒΑΛΤΕ τις ΑΛΛΑΓΕΣ ΣΥΜΠΑΘΕΙΩΠ- απαιτεί την αποσÏνδεση
ΠΙΣΩ στο ΚΥΡΙΟ ΠΑΡΑΘΥΡΟ - αγνοήστε τις αλλαγές που γίνονται
+
+ +
+ + + + + + + + + + + + + +
+ΠΑΥΣΗ | ΕÎΑΡΞΗ     Ρυθμός ανανέωσης: 1000 ms ΓÏηγοÏότεÏα | Πιό αÏγά

+
ΑÏχή..
+
ΕνεÏγές τηλ. συνδέσεις
+ΑÎΑÎΕΩΣΗ | +ΤΑΞΙΠ| +
ΕξωτεÏικές γÏαμμές
+ΑÎΑÎΕΩΣΗ | +ΤΑΞΙΠ| +
Τοπικές τηλ. συνδέσεις
+ΑÎΑÎΕΩΣΗ | +ΤΑΞΙΠ| +
+ Τα δεδομένα πηγαίνουν εδώ

+
+ Τα δεδομένα πηγαίνουν εδώ

Κίνηση ΚοÏÎ¼Î¿Ï +
+ Τα δεδομένα πηγαίνουν εδώ

Τοπική Κίνηση +
+
+ + + + +
+ + +Κατάλογος διασκέψεων + + + +
+Επιλέξτε έναν αÏιθμό δωματίου συνδιάσκεψης στα αÏιστεÏά για τις πληÏοφοÏίες σε εκείνη την συνδιάσκεψη +
+ + + + + + + + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/call_log_display.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/call_log_display.php new file mode 100644 index 00000000..d6f4ea88 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/call_log_display.php @@ -0,0 +1,196 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "\n"; +echo "\n"; +echo "\n"; +echo "Έμφάνιση ΚαταγÏαμμένων Κλήσεων"; +echo "\n"; +echo "\n"; +echo "\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";} + $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";} + $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"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/conf_exten_check.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/conf_exten_check.php new file mode 100644 index 00000000..9d5a9c1f --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/conf_exten_check.php @@ -0,0 +1,297 @@ + LICENSE: GPLv2 +# +# 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 +# + +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"];} + +$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";} + +$version = '2.0.4-12'; +$build = '71122-0205'; +$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";} + $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 "\n"; +echo "\n"; +echo "\n"; +echo "Ελεγχος τηλ.σÏνδεσης διάσκεψης"; +echo "\n"; +echo "\n"; +echo "\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; + + ### 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); + $row=mysql_fetch_row($rslt); + $Acount=$row[0]; + + if ($Acount > 0) + { + $stmt="SELECT status from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Astatus=$row[0]; + } + # ### 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";} + $rslt=mysql_query($stmt, $link); + + if ($campagentstdisp == 'YES') + { + ### grab the status of this agent to display + $stmt="SELECT status,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Alogin=$row[0]; + $Acampaign=$row[1]; + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where server_ip='$server_ip' and status NOT IN('XFER') and campaign_id='$Acampaign';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $RingCalls=$row[0]; + } + else + { + $Alogin='N'; + $RingCalls='N'; + } + } + else + { + $Alogin='N'; + $RingCalls='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";} + $rslt=mysql_query($stmt, $link); + + } + + if ($Acount < 1) {$Alogin='DEAD_VLA';} + if ($AexternalDEAD > 0) {$Alogin='DEAD_EXTERNAL';} + + echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Κατάσταση: ' . $Astatus . "|\n"; + + } + $total_conf=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + 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";} + } + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $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++; $total_conf++; + $row=mysql_fetch_row($rslt); + $ΚανάλιA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + } + $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";} + $rslt=mysql_query($stmt, $link); + } + echo "Διάσκεψη $conf_exten έχει καταχωÏηθεί $exten\n"; + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/dbconnect.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/dbconnect.php new file mode 100644 index 00000000..7221b35e --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/dbconnect.php @@ -0,0 +1,48 @@ + LICENSE: GPLv2 +# +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"); +mysql_select_db("$VARDB_database"); + +$local_DEF = 'Local/'; +$conf_silent_prefix = '7'; +$local_AMP = '@'; +$ext_context = 'demo'; +$recording_exten = '8309'; +$WeBRooTWritablE = '1'; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/inbound_popup.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/inbound_popup.php new file mode 100644 index 00000000..fd8c7ba5 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/inbound_popup.php @@ -0,0 +1,351 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "\n"; +echo "\n"; +echo "\n"; +?> + + +ΕÎΕΡΓΗ ΕΙΣΕΡΧΟΜΕÎΗ ΚΛΗΣΗ"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "

ΕÎΕΡΓΗ ΕΙΣΕΡΧΟΜΕÎΗ ΚΛΗΣΗ

\n"; +echo "$NOW_TIME

\n"; +} + + + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($uniqueid)<9) + { + $channel_live=0; + echo "Uniqueid $uniqueid δεν ισχÏει\n"; + exit; + } + else + { + $stmt="SELECT * FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $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";} + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Κανάλι: $row[1]
CallerID: $row[3]
\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 "GOOGLE - \n"; + echo "ANYWHO - \n"; + echo "SWITCHBOARD - \n"; + echo "VERIZON - \n"; + echo "WHITEPAGES - \n"; + echo "411.COM - \n"; + echo "411.COM - \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 "ΣΥÎΗΘΕΙΑ - \n"; + + echo "
ΑÏιθμός που καλέσατε: $row[8]
Σημειώσεις: $row[9]|$row[10]|$row[11]|$row[12]|$row[13]|
\n"; + echo "ΚΛΕΙΣΙΜΟ - \n"; + echo "ΣΤΕΙΛΕ ΣΤΟ ΦΩÎΗΤΙΚΟ ΤΑΧΥΔΡΟΜΕΙΟ ΜΟΥ\n"; + echo "
\n"; + + + $stmt="UPDATE live_inbound set acknowledged='Y' where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + + } + + + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/live_exten_check.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/live_exten_check.php new file mode 100644 index 00000000..ad511dc2 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/live_exten_check.php @@ -0,0 +1,278 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "\n"; +echo "\n"; +echo "\n"; +echo "Ελεγχος ενεÏγής τηλ.σÏνδεσης"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + +echo "DateTime: $NOW_TIME|"; +echo "UnixTime: $StarTtime|"; + +$stmt="SELECT count(*) FROM parked_channels where server_ip = '$server_ip';"; + if ($format=='debug') {echo "\n";} +$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";} + $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";} + } + } + + $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";} + $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";} + $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";} + $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";} + $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";} +$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";} + } + +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";} + $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";} + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/manager_send.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/manager_send.php new file mode 100644 index 00000000..a66018c8 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/manager_send.php @@ -0,0 +1,1142 @@ + LICENSE: GPLv2 +# +# This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk 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: +# - $ACTION - ('Originate','Redirect','Hangup','Command','Monitor','StopMonitor','SysCIDOriginate','RedirectName','RedirectNameVmail','MonitorConf','StopMonitorConf','RedirectXtra','RedirectXtraCX','RedirectVD','HangupConfDial','VolumeControl','OriginateVDRelogin') +# - $queryCID - ('CN012345678901234567',...) +# - $format - ('text','debug') +# - $channel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +# - $exten - ('1234','913125551212',...) +# - $ext_context - ('default','demo',...) +# - $ext_priority - ('1','2',...) +# - $filename - ('20050406-125623_44444',...) +# - $extenName - ('phone100',...) +# - $parkedby - ('phone100',...) +# - $extrachannel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +# - $auto_dial_level - ('0','1','1.1',...) +# - $campaign - ('CLOSER','TESTCAMP',...) +# - $uniqueid - ('1120232758.2406800',...) +# - $lead_id - ('1234',...) +# - $seconds - ('32',...) +# - $outbound_cid - ('3125551212','0000000000',...) +# - $agent_log_id - ('123456',...) +# - $call_server_ip - ('10.10.10.15',...) +# - $CalLCID - ('VD01234567890123456',...) +# - $stage - ('UP','DOWN') +# + +# CHANGELOG: +# 50401-1002 - First build of script, Hangup function only +# 50404-1045 - Redirect basic function enabled +# 50406-1522 - Monitor basic function enabled +# 50407-1647 - Monitor and StopMonitor full functions enabled +# 50422-1120 - basic Originate function enabled +# 50428-1451 - basic SysCIDOriginate function enabled for checking voicemail +# 50502-1539 - basic RedirectName and RedirectNameVmail added +# 50503-1227 - added session_name checking for extra security +# 50523-1341 - added Conference call start/stop recording +# 50523-1421 - added OriginateName and OriginateNameVmail for local calls +# 50524-1602 - added RedirectToPark and RedirectFromPark +# 50531-1203 - added RedirecXtra for dual channel redirection +# 50630-1100 - script changed to not use HTTP login vars, user/pass instead +# 50804-1148 - Added RedirectVD for VICIDIAL blind redirection with logging +# 50815-1204 - Added NEXTAVAILABLE to RedirectXtra function +# 50903-2343 - Added HangupConfDial function to hangup in-dial channels in conf +# 50913-1057 - Added outbound_cid set if present to originate call +# 51020-1556 - Added agent_log_id framework for detailed agent activity logging +# 51118-1204 - Fixed Blind transfer bug from VICIDIAL when in manual dial mode +# 51129-1014 - Added ability to accept calls from other VICIDIAL servers +# 51129-1253 - Fixed Hangups of other agents channels in VICIDIAL AD +# 60310-2022 - Fixed NEXTAVAILABLE bug in leave-3way-call redirect function +# 60421-1413 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1158 - Added variable filters to close security holes for login form +# 60809-1544 - Added direct transfers to leave-3ways in consultative transfers +# 61004-1526 - Added parsing of volume control command and lookup or number +# 61130-1617 - Added lead_id to MonitorConf for recording_log +# 61201-1115 - Added user to MonitorConf for recording_log +# 70111-1600 - added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70226-1251 - Added Mute/UnMute to conference volume control +# 70320-1502 - Added option to allow retry of leave-3way-call and debug logging +# 70322-1636 - Added sipsak display ability +# + +require("dbconnect.php"); + +### These are variable assignments for PHP globals off +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["ACTION"])) {$ACTION=$_GET["ACTION"];} + elseif (isset($_POST["ACTION"])) {$ACTION=$_POST["ACTION"];} +if (isset($_GET["queryCID"])) {$queryCID=$_GET["queryCID"];} + elseif (isset($_POST["queryCID"])) {$queryCID=$_POST["queryCID"];} +if (isset($_GET["format"])) {$format=$_GET["format"];} + elseif (isset($_POST["format"])) {$format=$_POST["format"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["exten"])) {$exten=$_GET["exten"];} + elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];} +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["filename"])) {$filename=$_GET["filename"];} + elseif (isset($_POST["filename"])) {$filename=$_POST["filename"];} +if (isset($_GET["extenName"])) {$extenName=$_GET["extenName"];} + elseif (isset($_POST["extenName"])) {$extenName=$_POST["extenName"];} +if (isset($_GET["parkedby"])) {$parkedby=$_GET["parkedby"];} + elseif (isset($_POST["parkedby"])) {$parkedby=$_POST["parkedby"];} +if (isset($_GET["extrachannel"])) {$extrachannel=$_GET["extrachannel"];} + elseif (isset($_POST["extrachannel"])) {$extrachannel=$_POST["extrachannel"];} +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["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} + elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["secondS"])) {$secondS=$_GET["secondS"];} + elseif (isset($_POST["secondS"])) {$secondS=$_POST["secondS"];} +if (isset($_GET["outbound_cid"])) {$outbound_cid=$_GET["outbound_cid"];} + elseif (isset($_POST["outbound_cid"])) {$outbound_cid=$_POST["outbound_cid"];} +if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];} + elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];} +if (isset($_GET["call_server_ip"])) {$call_server_ip=$_GET["call_server_ip"];} + elseif (isset($_POST["call_server_ip"])) {$call_server_ip=$_POST["call_server_ip"];} +if (isset($_GET["CalLCID"])) {$CalLCID=$_GET["CalLCID"];} + elseif (isset($_POST["CalLCID"])) {$CalLCID=$_POST["CalLCID"];} +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["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} +if (isset($_GET["phone_ip"])) {$phone_ip=$_GET["phone_ip"];} + elseif (isset($_POST["phone_ip"])) {$phone_ip=$_POST["phone_ip"];} +if (isset($_GET["enable_sipsak_messages"])) {$enable_sipsak_messages=$_GET["enable_sipsak_messages"];} + elseif (isset($_POST["enable_sipsak_messages"])) {$enable_sipsak_messages=$_POST["enable_sipsak_messages"];} +if (isset($_GET["allow_sipsak_messages"])) {$allow_sipsak_messages=$_GET["allow_sipsak_messages"];} + elseif (isset($_POST["allow_sipsak_messages"])) {$allow_sipsak_messages=$_POST["allow_sipsak_messages"];} + +$user=ereg_replace("[^0-9a-zA-Z]","",$user); +$pass=ereg_replace("[^0-9a-zA-Z]","",$pass); +$secondS = ereg_replace("[^0-9]","",$secondS); + +# default optional vars if not set +if (!isset($ACTION)) {$ACTION="Originate";} +if (!isset($format)) {$format="alert";} +if (!isset($ext_priority)) {$ext_priority="1";} + +$version = '2.0.29'; +$build = '70320-1502'; +$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 "\n"; +echo "\n"; +echo "\n"; +echo "Ο διαχτής στέλνει: "; +if ($ACTION=="Originate") {echo "Originate";} +if ($ACTION=="Redirect") {echo "Redirect";} +if ($ACTION=="RedirectName") {echo "RedirectName";} +if ($ACTION=="Hangup") {echo "Hangup";} +if ($ACTION=="Command") {echo "Command";} +if ($ACTION==99999) {echo "ΒΟΗΘΕΙΑ";} +echo "\n"; +echo "\n"; +echo "\n"; +} + + + + + +###################### +# ACTION=SysCIDOriginate - insert Originate Manager statement allowing small CIDs for system calls +###################### +if ($ACTION=="SysCIDOriginate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<1) ) + { + echo "Exten $exten δεν ισχÏει or queryCID $queryCID δεν ισχÏει, Originate εντολή που δεν έγινε εισαγωγή\n"; + } + else + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate εντολή που στέλνεται για Exten $exten Κανάλι $channel στο $server_ip\n"; + } +} + + + +###################### +# ACTION=Originate, OriginateName, OriginateNameVmail - insert Originate Manager statement +###################### +if ($ACTION=="OriginateName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Μία από αυτές τις μεταβλητές δεν ισχÏει:\n"; + echo "Κανάλι $channel Ï€Ïέπει να είναι μεγαλÏτεÏος από 2 χαÏακτήÏες\n"; + echo "queryCID $queryCID Ï€Ïέπει να είναι μεγαλÏτεÏος από 14 χαÏακτήÏες\n"; + echo "extenName $extenName Ï€Ïέπει να τεθεί\n"; + echo "ext_context $ext_context Ï€Ïέπει να τεθεί\n"; + echo "ext_priority $ext_priority Ï€Ïέπει να τεθεί\n"; + echo "\nOriginateName Action μην σταλμένος\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="OriginateNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Μία από αυτές τις μεταβλητές δεν ισχÏει:\n"; + echo "Κανάλι $channel Ï€Ïέπει να είναι μεγαλÏτεÏος από 2 χαÏακτήÏες\n"; + echo "queryCID $queryCID Ï€Ïέπει να είναι μεγαλÏτεÏος από 14 χαÏακτήÏες\n"; + echo "extenName $extenName Ï€Ïέπει να τεθεί\n"; + echo "exten $exten Ï€Ïέπει να τεθεί\n"; + echo "ext_context $ext_context Ï€Ïέπει να τεθεί\n"; + echo "ext_priority $ext_priority Ï€Ïέπει να τεθεί\n"; + echo "\nOriginateNameVmail Action μην σταλμένος\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="OriginateVDRelogin") +{ + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $CIDdate = date("ymdHis"); + $DS='-'; + $SIPSAK_prefix = 'LIN-'; + print "\n"; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$campaign\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + $queryCID = "$SIPSAK_prefix$campaign$DS$CIDdate"; + + } + $ACTION="Originate"; +} + +if ($ACTION=="Originate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<10) ) + { + echo "Exten $exten δεν ισχÏει or queryCID $queryCID δεν ισχÏει, Originate εντολή που δεν έγινε εισαγωγή\n"; + } + else + { + if (strlen($outbound_cid)>1) + {$outCID = "\"$queryCID\" <$outbound_cid>";} + else + {$outCID = "$queryCID";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate εντολή που στέλνεται για Exten $exten Κανάλι $channel στο $server_ip\n"; + } +} + + + +###################### +# ACTION=HangupConfDial - find the Local channel that is in the conference and needs to be hung up +###################### +if ($ACTION=="HangupConfDial") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($queryCID)<15) or (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "conference $exten δεν ισχÏει or ext_context $ext_context or queryCID $queryCID δεν ισχÏει, Hangup εντολή που δεν έγινε εισαγωγή\n"; + } + else + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $hangup_channel_prefix = "$local_DEF$exten$local_AMP$ext_context"; + + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row > 0) + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $channel=$rowx[0]; + $ACTION="Hangup"; + $queryCID = eregi_replace("^.","G",$queryCID); + } + } +} + + + +###################### +# ACTION=Hangup - insert Hangup Manager statement +###################### +if ($ACTION=="Hangup") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) ) + { + $channel_live=0; + echo "Κανάλι $channel δεν ισχÏει or queryCID $queryCID δεν ισχÏει, Hangup εντολή που δεν έγινε εισαγωγή\n"; + } + else + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + +# $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# if ($row[0]==0) +# { +# $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $rowx=mysql_fetch_row($rslt); +# if ($rowx[0]==0) +# { +# $channel_live=0; +# echo "Channel $channel is not live on $call_server_ip, Hangup command not inserted\n"; +# } +# } + if ( ($auto_dial_level > 0) and (strlen($CalLCID)>2) and (strlen($exten)>2) and ($secondS > 4)) + { + $stmt="SELECT count(*) FROM vicidial_auto_calls where channel='$channel' and callerid='$CalLCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + echo "Call $CalLCID $channel δεν είναι ενεÏγό στο $call_server_ip, Checking Live Κανάλι...\n"; + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel' and extension LIKE \"%$exten\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $channel_live=0; + echo "Κανάλι $channel δεν είναι ενεÏγό στο $call_server_ip, Hangup εντολή που δεν έγινε εισαγωγή $rowx[0]\n$stmt\n"; + } + else + { + echo "$stmt\n"; + } + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Hangup','$queryCID','Channel: $channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Hangup εντολή που στέλνεται για Κανάλι $channel στο $call_server_ip\n"; + } + } +} + + + +###################### +# ACTION=Redirect, RedirectName, RedirectNameVmail, RedirectToPark, RedirectFromPark, RedirectVD, RedirectXtra, RedirectXtraCX +# - insert Redirect Manager statement using extensions name +###################### +if ($ACTION=="RedirectVD") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($campaign)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($uniqueid)<2) or (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "Μία από αυτές τις μεταβλητές δεν ισχÏει:\n"; + echo "Κανάλι $channel Ï€Ïέπει να είναι μεγαλÏτεÏος από 2 χαÏακτήÏες\n"; + echo "queryCID $queryCID Ï€Ïέπει να είναι μεγαλÏτεÏος από 14 χαÏακτήÏες\n"; + echo "exten $exten Ï€Ïέπει να τεθεί\n"; + echo "ext_context $ext_context Ï€Ïέπει να τεθεί\n"; + echo "ext_priority $ext_priority Ï€Ïέπει να τεθεί\n"; + echo "auto_dial_level $auto_dial_level Ï€Ïέπει να τεθεί\n"; + echo "campaign $campaign Ï€Ïέπει να τεθεί\n"; + echo "uniqueid $uniqueid Ï€Ïέπει να τεθεί\n"; + echo "lead_id $lead_id Ï€Ïέπει να τεθεί\n"; + echo "\nRedirectVD Action μην σταλμένος\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($auto_dial_level < 1) + { + $stmt = "UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectToPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($parkedby)<1) ) + { + $channel_live=0; + echo "Μία από αυτές τις μεταβλητές δεν ισχÏει:\n"; + echo "Κανάλι $channel Ï€Ïέπει να είναι μεγαλÏτεÏος από 2 χαÏακτήÏες\n"; + echo "queryCID $queryCID Ï€Ïέπει να είναι μεγαλÏτεÏος από 14 χαÏακτήÏες\n"; + echo "exten $exten Ï€Ïέπει να τεθεί\n"; + echo "extenName $extenName Ï€Ïέπει να τεθεί\n"; + echo "ext_context $ext_context Ï€Ïέπει να τεθεί\n"; + echo "ext_priority $ext_priority Ï€Ïέπει να τεθεί\n"; + echo "parkedby $parkedby Ï€Ïέπει να τεθεί\n"; + echo "\nRedirectToPark Action μην σταλμένος\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "INSERT INTO parked_channels values('$channel','$server_ip','','$extenName','$parkedby','$NOW_TIME');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectFromPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Μία από αυτές τις μεταβλητές δεν ισχÏει:\n"; + echo "Κανάλι $channel Ï€Ïέπει να είναι μεγαλÏτεÏος από 2 χαÏακτήÏες\n"; + echo "queryCID $queryCID Ï€Ïέπει να είναι μεγαλÏτεÏος από 14 χαÏακτήÏες\n"; + echo "exten $exten Ï€Ïέπει να τεθεί\n"; + echo "ext_context $ext_context Ï€Ïέπει να τεθεί\n"; + echo "ext_priority $ext_priority Ï€Ïέπει να τεθεί\n"; + echo "\nRedirectFromPark Action μην σταλμένος\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "DELETE FROM parked_channels where server_ip='$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Μία από αυτές τις μεταβλητές δεν ισχÏει:\n"; + echo "Κανάλι $channel Ï€Ïέπει να είναι μεγαλÏτεÏος από 2 χαÏακτήÏες\n"; + echo "queryCID $queryCID Ï€Ïέπει να είναι μεγαλÏτεÏος από 14 χαÏακτήÏες\n"; + echo "extenName $extenName Ï€Ïέπει να τεθεί\n"; + echo "ext_context $ext_context Ï€Ïέπει να τεθεί\n"; + echo "ext_priority $ext_priority Ï€Ïέπει να τεθεί\n"; + echo "\nRedirectName Action μην σταλμένος\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Μία από αυτές τις μεταβλητές δεν ισχÏει:\n"; + echo "Κανάλι $channel Ï€Ïέπει να είναι μεγαλÏτεÏος από 2 χαÏακτήÏες\n"; + echo "queryCID $queryCID Ï€Ïέπει να είναι μεγαλÏτεÏος από 14 χαÏακτήÏες\n"; + echo "extenName $extenName Ï€Ïέπει να τεθεί\n"; + echo "exten $exten Ï€Ïέπει να τεθεί\n"; + echo "ext_context $ext_context Ï€Ïέπει να τεθεί\n"; + echo "ext_priority $ext_priority Ï€Ïέπει να τεθεί\n"; + echo "\nRedirectNameVmail Action μην σταλμένος\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectXtraCX") +{ + $DBout=''; + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "Μία από αυτές τις μεταβλητές δεν ισχÏει:\n"; + echo "Κανάλι $channel Ï€Ïέπει να είναι μεγαλÏτεÏος από 2 χαÏακτήÏες\n"; + echo "ExtraΚανάλι $extrachannel Ï€Ïέπει να είναι μεγαλÏτεÏος από 2 χαÏακτήÏες\n"; + echo "queryCID $queryCID Ï€Ïέπει να είναι μεγαλÏτεÏος από 14 χαÏακτήÏες\n"; + echo "exten $exten Ï€Ïέπει να τεθεί\n"; + echo "ext_context $ext_context Ï€Ïέπει να τεθεί\n"; + echo "ext_priority $ext_priority Ï€Ïέπει να τεθεί\n"; + echo "\nRedirect Action μην σταλμένος\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDCXC|$filename|$user|$campaign|$channel|$extrachannel|$queryCID|$exten|$ext_context|ext_priority|\n"); + fclose($fp); + } + } + } + else + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Κανάλι $channel δεν είναι ενεÏγό στο $call_server_ip, Redirect εντολή που δεν έγινε εισαγωγή\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel δεν είναι ενεÏγό στο $call_server_ip";} + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Κανάλι $channel δεν είναι ενεÏγό στο $server_ip, Redirect εντολή που δεν έγινε εισαγωγή\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel δεν είναι ενεÏγό στο $server_ip";} + } + } + if ( ($channel_liveX==1) && ($channel_liveY==1) ) + { + $stmt="SELECT count(*) FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0] < 1) + { + $channel_liveY=0; + echo "No Local agent to send call to, Redirect εντολή που δεν έγινε εισαγωγή\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "No Local agent to send call to";} + } + else + { + $stmt="SELECT server_ip,conf_exten,user FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $dest_server_ip = $rowx[0]; + $dest_session_id = $rowx[1]; + $dest_user = $rowx[2]; + $S='*'; + + $D_s_ip = explode('.', $dest_server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$dest_session_id$S$lead_id$S$dest_user$S$phone_code$S$phone_number$S$campaign$S"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','$queryCID','Channel: $extrachannel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtraCX εντολή που στέλνεται για Κανάλι $channel στο $call_server_ip and \nHungup $extrachannel στο $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel στο $call_server_ip, Hungup $extrachannel στο $server_ip";} + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "Changed to Redirect: $channel στο $server_ip";} + } + + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDCXC|$filename|$user|$campaign|$DBout|\n"); + fclose($fp); + } + } + + } +} + +if ($ACTION=="RedirectXtra") +{ + if ($channel=="$extrachannel") + {$ACTION="Redirect";} + else + { + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "Μία από αυτές τις μεταβλητές δεν ισχÏει:\n"; + echo "Κανάλι $channel Ï€Ïέπει να είναι μεγαλÏτεÏος από 2 χαÏακτήÏες\n"; + echo "ExtraΚανάλι $extrachannel Ï€Ïέπει να είναι μεγαλÏτεÏος από 2 χαÏακτήÏες\n"; + echo "queryCID $queryCID Ï€Ïέπει να είναι μεγαλÏτεÏος από 14 χαÏακτήÏες\n"; + echo "exten $exten Ï€Ïέπει να τεθεί\n"; + echo "ext_context $ext_context Ï€Ïέπει να τεθεί\n"; + echo "ext_priority $ext_priority Ï€Ïέπει να τεθεί\n"; + echo "\nRedirect Action μην σταλμένος\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDX|$filename|$user|$campaign|$$channel|$extrachannel|$queryCID|$exten|$ext_context|ext_priority|\n"); + fclose($fp); + } + } + } + else + { + if ($exten == "NEXTAVAILABLE") + { + $stmt="SELECT conf_exten FROM conferences where server_ip='$server_ip' and ((extension='') or (extension is null)) limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if (strlen($row[0]) > 3) + { + $stmt="UPDATE conferences set extension='$user' where server_ip='$server_ip' and conf_exten='$row[0]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $exten = $row[0]; + } + else + { + $channel_liveX=0; + echo "Δεν υπάÏχει κενή διάσκεψη στο $server_ip, Redirect εντολή που δεν έγινε εισαγωγή\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "Δεν υπάÏχει κενή διάσκεψη στο $server_ip";} + } + } + + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Κανάλι $channel δεν είναι ενεÏγό στο $call_server_ip, Redirect εντολή που δεν έγινε εισαγωγή\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel δεν είναι ενεÏγό στο $call_server_ip";} + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Κανάλι $channel δεν είναι ενεÏγό στο $server_ip, Redirect εντολή που δεν έγινε εισαγωγή\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel δεν είναι ενεÏγό στο $server_ip";} + } + } + if ( ($channel_liveX==1) && ($channel_liveY==1) ) + { + if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','ExtraChannel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra εντολή που στέλνεται για Κανάλι $channel and \nExtraΚανάλι $extrachannel\n to $exten στο $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel and $extrachannel to $exten στο $server_ip";} + } + else + { + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$exten"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra εντολή που στέλνεται για Κανάλι $channel στο $call_server_ip and \nExtraΚανάλι $extrachannel\n to $exten στο $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel/$call_server_ip and $extrachannel/$server_ip to $exten";} + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + + } + + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDX|$filename|$user|$campaign|$DBout|\n"); + fclose($fp); + } + } + + } + } +} + + +if ($ACTION=="Redirect") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Μία από αυτές τις μεταβλητές δεν ισχÏει:\n"; + echo "Κανάλι $channel Ï€Ïέπει να είναι μεγαλÏτεÏος από 2 χαÏακτήÏες\n"; + echo "queryCID $queryCID Ï€Ïέπει να είναι μεγαλÏτεÏος από 14 χαÏακτήÏες\n"; + echo "exten $exten Ï€Ïέπει να τεθεί\n"; + echo "ext_context $ext_context Ï€Ïέπει να τεθεί\n"; + echo "ext_priority $ext_priority Ï€Ïέπει να τεθεί\n"; + echo "\nRedirect Action μην σταλμένος\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Κανάλι $channel δεν είναι ενεÏγό στο $server_ip, Redirect εντολή που δεν έγινε εισαγωγή\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "Redirect εντολή που στέλνεται για Κανάλι $channel στο $server_ip\n"; + } + } +} + + + +###################### +# ACTION=Monitor or Stop Monitor - insert Monitor/StopMonitor Manager statement to start recording on a channel +###################### +if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) +{ + if ($ACTION=="StopMonitor") + {$SQLfile = "";} + else + {$SQLfile = "File: $filename";} + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Κανάλι $channel δεν ισχÏει or queryCID $queryCID δεν ισχÏει or filename: $filename δεν ισχÏει, $ACTION εντολή που δεν έγινε εισαγωγή\n"; + } + else + { + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Κανάλι $channel δεν είναι ενεÏγό στο $server_ip, $ACTION εντολή που δεν έγινε εισαγωγή\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','$ACTION','$queryCID','Channel: $channel','$SQLfile','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + if ($ACTION=="Monitor") + { + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + } + echo "$ACTION εντολή που στέλνεται για Κανάλι $channel στο $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n"; + } + } +} + + + + + + +###################### +# ACTION=MonitorConf or StopMonitorConf - insert Monitor/StopMonitor Manager statement to start recording on a conference +###################### +if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($channel)<4) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Κανάλι $channel δεν ισχÏει or exten $exten δεν ισχÏει or filename: $filename δεν ισχÏει, $ACTION εντολή που δεν έγινε εισαγωγή\n"; + } + else + { + + if ($ACTION=="MonitorConf") + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$filename','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $filename','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + # find and hang up all recordings going στο in this conference # and extension = '$exten' + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$channel%\" and channel LIKE \"%,1\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + # $rec_count = intval(mysql_num_rows($rslt) / 2); + $rec_count = mysql_num_rows($rslt); + $h=0; + while ($rec_count>$h) + { + $rowx=mysql_fetch_row($rslt); + $HUchannel[$h] = $rowx[0]; + $h++; + } + $i=0; + while ($h>$i) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$i','Channel: $HUchannel[$i]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $i++; + } + + } + echo "$ACTION εντολή που στέλνεται για Κανάλι $channel στο $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n Η ΚΑΤΑΓΡΑΦΗ ΘΑ ΔΙΑΡΚΕΣΕΙ ΜΕΧΡΙ 60 ΛΕΠΤΑ\n"; + } +} + + + + + +###################### +# ACTION=VolumeControl - raise or lower the volume of a meetme participant +###################### +if ($ACTION=="VolumeControl") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($stage)<1) or (strlen($queryCID)<1) ) + { + echo "Διάσκεψη $exten, Stage $stage δεν ισχÏει or queryCID $queryCID δεν ισχÏει, Originate εντολή που δεν έγινε εισαγωγή\n"; + } + else + { + $participant_number='XXYYXXYYXXYYXX'; + if (eregi('UP',$stage)) {$vol_prefix='4';} + if (eregi('DOWN',$stage)) {$vol_prefix='3';} + if (eregi('UNMUTE',$stage)) {$vol_prefix='2';} + if (eregi('MUTING',$stage)) {$vol_prefix='1';} + $local_DEF = 'Local/'; + $local_AMP = '@'; + $volume_local_channel = "$local_DEF$participant_number$vol_prefix$exten$local_AMP$ext_context"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $volume_local_channel','Context: $ext_context','Exten: 8300','Priority: 1','Callerid: $queryCID','','','','$channel','$exten');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Volume εντολή που στέλνεται για Διάσκεψη $exten, Stage $stage Κανάλι $channel στο $server_ip\n"; + } +} + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='debug') {echo "\n";} +if ($format=='debug') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/park_calls_display.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/park_calls_display.php new file mode 100644 index 00000000..4937023c --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/park_calls_display.php @@ -0,0 +1,146 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "\n"; +echo "\n"; +echo "\n"; +echo "Εμφάνιση Σταθμευμένων Κλήσεων"; +echo "\n"; +echo "\n"; +echo "\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 * from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;"; + if ($format=='debug') {echo "\n";} + $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"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/vdc_db_query.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/vdc_db_query.php new file mode 100644 index 00000000..d39f9fad --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/vdc_db_query.php @@ -0,0 +1,2535 @@ + LICENSE: GPLv2 +# +# 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 - ('regCLOSER','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCALL','manDiaLlogCALL','userLOGout','updateDISPO','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs','CalLBacKLisT','CalLBacKCounT','PauseCodeSubmit','LogiNCamPaigns') +# - $stage - ('start','finish','lookup','new') +# - $closer_choice - ('CL_TESTCAMP_L CL_OUT123_L -') +# - $conf_exten - ('8600011',...) +# - $exten - ('123test',...) +# - $ext_context - ('default','demo',...) +# - $ext_priority - ('1','2',...) +# - $campaign - ('testcamp',...) +# - $dial_timeout - ('60','26',...) +# - $dial_prefix - ('9','8',...) +# - $campaign_cid - ('3125551212','0000000000',...) +# - $MDnextCID - ('M06301413000000002',...) +# - $uniqueid - ('1120232758.2406800',...) +# - $lead_id - ('36524',...) +# - $list_id - ('101','123456',...) +# - $length_in_sec - ('12',...) +# - $phone_code - ('1',...) +# - $phone_number - ('3125551212',...) +# - $channel - ('Zap/12-1',...) +# - $start_epoch - ('1120236911',...) +# - $vendor_lead_code - ('1234test',...) +# - $title - ('Mr.',...) +# - $first_name - ('Bob',...) +# - $middle_initial - ('L',...) +# - $last_name - ('Wilson',...) +# - $address1 - ('1324 Main St.',...) +# - $address2 - ('Apt. 12',...) +# - $address3 - ('co Robert Wilson',...) +# - $city - ('Chicago',...) +# - $state - ('IL',...) +# - $province - ('NA',...) +# - $postal_code - ('60054',...) +# - $country_code - ('USA',...) +# - $gender - ('M',...) +# - $date_of_birth - ('1970-01-01',...) +# - $alt_phone - ('3125551213',...) +# - $email - ('bob@bob.com',...) +# - $security_phrase - ('Hello',...) +# - $comments - ('Good Customer',...) +# - $auto_dial_level - ('0','1','1.2',...) +# - $VDstop_rec_after_each_call - ('0','1') +# - $conf_silent_prefix - ('7','8','',...) +# - $extension - ('123','user123','25-1',...) +# - $protocol - ('Zap','SIP','IAX2',...) +# - $user_abb - ('1234','6666',...) +# - $preview - ('YES','NO',...) +# - $called_count - ('0','1','2',...) +# - $agent_log_id - ('123456',...) +# - $agent_log - ('NO',...) +# - $favorites_list - (",'cc160','cc100'",...) +# - $CallBackDatETimE - ('2006-04-21 14:30:00',...) +# - $recipient - ('ANYONE,'USERONLY') +# - $callback_id - ('12345','12346',...) +# - $use_internal_dnc - ('Y','N') +# - $omit_phone_code - ('Y','N') +# - $no_delete_sessions - ('0','1') + +# CHANGELOG: +# 50629-1044 - First build of script +# 50630-1422 - Added manual dial action and MD channel lookup +# 50701-1451 - Added dial log for start and end of vicidial calls +# 50705-1239 - Added call disposition update +# 50804-1627 - Fixed updateDispo to update vicidial_log entry +# 50816-1605 - Added VDADpause/ready for auto dialing +# 50816-1811 - Added basic autodial call pickup functions +# 50817-1005 - Altered logging functions to accomodate auto_dialing +# 50818-1305 - Added stop-all-recordings-after-each-vicidial-call option +# 50818-1411 - Added hangup of agent phone after Logout +# 50901-1315 - Fixed CLOSER IN-GROUP Web Form bug +# 50902-1507 - Fixed CLOSER log length_in_sec bug +# 50902-1730 - Added functions for manual preview dialing and revert +# 50913-1214 - Added agent random update to leadupdate +# 51020-1421 - Added agent_log_id framework for detailed agent activity logging +# 51021-1717 - Allows for multi-line comments (changes \n to !N in database) +# 51111-1046 - Added vicidial_agent_log lead_id earlier for manual dial +# 51121-1445 - Altered echo statements for several small PHP speed optimizations +# 51122-1328 - Fixed UserLogout issue not removing conference reservation +# 51129-1012 - Added ability to accept calls from other VICIDIAL servers +# 51129-1729 - Changed manual dial to use the '/n' flag for calls +# 51221-1154 - Added SCRIPT id lookup and sending to vicidial.php for display +# 60105-1059 - Added Updating of astguiclient favorites in the DB +# 60208-1617 - Added dtmf buttons output per call +# 60213-1521 - Added closer_campaigns update to vicidial_users +# 60215-1036 - Added Callback date-time entry into vicidial_callbacks table +# 60413-1541 - Added USERONLY Callback listings output - CalLBacKLisT +# - Added USERONLY Callback count output - CalLBacKCounT +# 60414-1140 - Added Callback lead lookup for manual dialing +# 60419-1517 - After CALLBK is sent to agent, update callback record to INACTIVE +# 60421-1419 - Check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60427-1236 - Fixed closer_choice error for CLOSER campaigns +# 60609-1148 - Added ability to check for manual dial numbers in DNC +# 60619-1117 - Added variable filters to close security holes for login form +# 60623-1414 - Fixed variable filter for phone_code and fixed manual dial logic +# 60821-1600 - Added ability to omit the phone code on vicidial lead dialing +# 60821-1647 - Added ability to not delete sessions at logout +# 60906-1124 - Added lookup and sending of callback data for CALLBK calls +# 61128-2229 - Added vicidial_live_agents and vicidial_auto_calls manual dial entries +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70115-1733 - Added alt_dial functionality in auto-dial modes +# 70118-1501 - Added user_group to vicidial_log,_agent_log,_closer_log,_callbacks +# 70123-1357 - Fixed bug that would not update vicidial_closer_log status to dispo +# 70202-1438 - Added pause code submit function +# 70203-0930 - Added dialed_number to lead info output +# 70203-1030 - Added dialed_label to lead info output +# 70206-1126 - Added INBOUND status for inbound/closer calls in vicidial_live_agents +# 70212-1253 - Fixed small issue with CXFER +# 70213-1431 - Added QueueMetrics PAUSE/UNPAUSE/AGENTLOGIN/AGENTLOGOFF actions +# 70214-1231 - Added queuemetrics_log_id field for server_id in queue_log +# 70215-1210 - Added queuemetrics COMPLETEAGENT action +# 70216-1051 - Fixed double call complete queuemetrics logging +# 70222-1616 - Changed queue_log PAUSE/UNPAUSE to PAUSEALL/UNPAUSEALL +# 70309-1034 - Allow amphersands and questions marks in comments to pass through +# 70313-1052 - Allow pound signs(hash) in comments to pass through +# 70319-1544 - Added agent disable update customer data function +# 70322-1545 - Added sipsak display ability +# 70413-1253 - Fixed bug for outbound call time in CLOSER-type blended campaigns +# 70424-1100 - Fixed bug for fronter/closer calls that would delete vdac records +# 70802-1729 - Fixed bugs with pause_sec and wait_sec under certain call handling +# 70828-1443 - Added source_id to output of SCRIPTtab-IFRAME and WEBFORM +# 71029-1855 - removed campaign_id naming restrictions for CLOSER-type campaigns +# 71030-2047 - added hopper priority for auto alt dial entries +# 71116-1011 - added calls_today count updating of the vicidial_live_agents upon INCALL +# 71120-1520 - added LogiNCamPaigns to show only allowed campaigns for agents upon login +# 71125-1751 - Added inbound-group default inbound group sending to vicidial.php +# 71129-2025 - restricted callbacks count and list to campaign only +# + +$version = '2.0.4-65'; +$build = '71129-2025'; + +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["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["closer_choice"])) {$closer_choice=$_GET["closer_choice"];} + elseif (isset($_POST["closer_choice"])) {$closer_choice=$_POST["closer_choice"];} +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["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["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["dial_timeout"])) {$dial_timeout=$_GET["dial_timeout"];} + elseif (isset($_POST["dial_timeout"])) {$dial_timeout=$_POST["dial_timeout"];} +if (isset($_GET["dial_prefix"])) {$dial_prefix=$_GET["dial_prefix"];} + elseif (isset($_POST["dial_prefix"])) {$dial_prefix=$_POST["dial_prefix"];} +if (isset($_GET["campaign_cid"])) {$campaign_cid=$_GET["campaign_cid"];} + elseif (isset($_POST["campaign_cid"])) {$campaign_cid=$_POST["campaign_cid"];} +if (isset($_GET["MDnextCID"])) {$MDnextCID=$_GET["MDnextCID"];} + elseif (isset($_POST["MDnextCID"])) {$MDnextCID=$_POST["MDnextCID"];} +if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} + elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["length_in_sec"])) {$length_in_sec=$_GET["length_in_sec"];} + elseif (isset($_POST["length_in_sec"])) {$length_in_sec=$_POST["length_in_sec"];} +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["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["start_epoch"])) {$start_epoch=$_GET["start_epoch"];} + elseif (isset($_POST["start_epoch"])) {$start_epoch=$_POST["start_epoch"];} +if (isset($_GET["dispo_choice"])) {$dispo_choice=$_GET["dispo_choice"];} + elseif (isset($_POST["dispo_choice"])) {$dispo_choice=$_POST["dispo_choice"];} +if (isset($_GET["vendor_lead_code"])) {$vendor_lead_code=$_GET["vendor_lead_code"];} + elseif (isset($_POST["vendor_lead_code"])) {$vendor_lead_code=$_POST["vendor_lead_code"];} +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["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["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_GET["VDstop_rec_after_each_call"];} + elseif (isset($_POST["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_POST["VDstop_rec_after_each_call"];} +if (isset($_GET["conf_silent_prefix"])) {$conf_silent_prefix=$_GET["conf_silent_prefix"];} + elseif (isset($_POST["conf_silent_prefix"])) {$conf_silent_prefix=$_POST["conf_silent_prefix"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} +if (isset($_GET["user_abb"])) {$user_abb=$_GET["user_abb"];} + elseif (isset($_POST["user_abb"])) {$user_abb=$_POST["user_abb"];} +if (isset($_GET["preview"])) {$preview=$_GET["preview"];} + elseif (isset($_POST["preview"])) {$preview=$_POST["preview"];} +if (isset($_GET["called_count"])) {$called_count=$_GET["called_count"];} + elseif (isset($_POST["called_count"])) {$called_count=$_POST["called_count"];} +if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];} + elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];} +if (isset($_GET["agent_log"])) {$agent_log=$_GET["agent_log"];} + elseif (isset($_POST["agent_log"])) {$agent_log=$_POST["agent_log"];} +if (isset($_GET["favorites_list"])) {$favorites_list=$_GET["favorites_list"];} + elseif (isset($_POST["favorites_list"])) {$favorites_list=$_POST["favorites_list"];} +if (isset($_GET["CallBackDatETimE"])) {$CallBackDatETimE=$_GET["CallBackDatETimE"];} + elseif (isset($_POST["CallBackDatETimE"])) {$CallBackDatETimE=$_POST["CallBackDatETimE"];} +if (isset($_GET["recipient"])) {$recipient=$_GET["recipient"];} + elseif (isset($_POST["recipient"])) {$recipient=$_POST["recipient"];} +if (isset($_GET["callback_id"])) {$callback_id=$_GET["callback_id"];} + elseif (isset($_POST["callback_id"])) {$callback_id=$_POST["callback_id"];} +if (isset($_GET["use_internal_dnc"])) {$use_internal_dnc=$_GET["use_internal_dnc"];} + elseif (isset($_POST["use_internal_dnc"])) {$use_internal_dnc=$_POST["use_internal_dnc"];} +if (isset($_GET["omit_phone_code"])) {$omit_phone_code=$_GET["omit_phone_code"];} + elseif (isset($_POST["omit_phone_code"])) {$omit_phone_code=$_POST["omit_phone_code"];} +if (isset($_GET["phone_ip"])) {$phone_ip=$_GET["phone_ip"];} + elseif (isset($_POST["phone_ip"])) {$phone_ip=$_POST["phone_ip"];} +if (isset($_GET["enable_sipsak_messages"])) {$enable_sipsak_messages=$_GET["enable_sipsak_messages"];} + elseif (isset($_POST["enable_sipsak_messages"])) {$enable_sipsak_messages=$_POST["enable_sipsak_messages"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} + + +$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); + + +# default optional vars if not set +if (!isset($format)) {$format="text";} + if ($format == 'debug') {$DB=1;} +if (!isset($ACTION)) {$ACTION="refresh";} + +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$CIDdate = date("mdHis"); +$ENTRYdate = date("YmdHis"); +if (!isset($query_date)) {$query_date = $NOW_DATE;} +$MT[0]=''; +$agents='@agents'; + +if ($ACTION == 'LogiNCamPaigns') + { + $skip_user_validation=1; + } +else + { + $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 "\n"; +echo "\n"; +echo "\n"; +echo "VICIDiaL Κώδικας εÏώτησης βάσεων δεδομένων"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + +################################################################################ +### LogiNCamPaigns - generates an HTML SELECT list of allowed campaigns for a +### specific agent on the login screen +################################################################################ +if ($ACTION == 'LogiNCamPaigns') +{ + if ( (strlen($user)<1) ) + { + echo "\n"; + exit; + } + else + { + echo "\n"; + exit; + } +} + + + +################################################################################ +### regCLOSER - update the vicidial_live_agents table to reflect the closer +### inbound choices made upon login +################################################################################ +if ($ACTION == 'regCLOSER') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($closer_choice)<1) || (strlen($user)<1) ) + { + $channel_live=0; + echo "Επιλογή ομάδας $closer_choice δεν ισχÏει\n"; + exit; + } + else + { + if ($closer_choice == "MGRLOCK-") + { + $stmt="SELECT closer_campaigns FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $closer_choice =$row[0]; + + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_users set closer_campaigns='$closer_choice' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $in_groups_pre = preg_replace('/-$/','',$closer_choice); + $in_groups = explode(" ",$in_groups_pre); + $in_groups_ct = count($in_groups); + $k=1; + while ($k < $in_groups_ct) + { + if (strlen($in_groups[$k])>1) + { + $stmt="SELECT group_weight,calls_today FROM vicidial_inbound_group_agents where user='$user' and group_id='$in_groups[$k]';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $viga_ct = mysql_num_rows($rslt); + if ($viga_ct > 0) + { + $row=mysql_fetch_row($rslt); + $group_weight = $row[0]; + $calls_today = $row[1]; + } + else + { + $group_weight = 0; + $calls_today = 0; + } + $stmt="INSERT INTO vicidial_live_inbound_agents set user='$user',group_id='$in_groups[$k]',group_weight='$group_weight',calls_today='$calls_today',last_call_time='$NOW_TIME',last_call_finish='$NOW_TIME';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + $k++; + } + + } + echo "Closer In Επιλογή ομάδας $closer_choice έχει καταχωÏηθεί στο χÏήστη $user\n"; +} + + +################################################################################ +### manDiaLnextCALL - for manual VICIDiaL dialing this will grab the next lead +### in the campaign, reserve it, send data back to client and +### place the call by inserting into vicidial_manager +################################################################################ +if ($ACTION == 'manDiaLnextCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "ΚΕÎΟΣ HOPPER\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context δεν ισχÏει\n"; + exit; + } + else + { + + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### check if this is a callback, if it is, skip the grabbing of a new lead and mark the callback as INACTIVE + if ( (strlen($callback_id)>0) and (strlen($lead_id)>0) ) + { + $affected_rows=1; + $CBleadIDset=1; + + $stmt = "UPDATE vicidial_callbacks set status='INACTIVE' where callback_id='$callback_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + if (strlen($phone_number)>3) + { + if ($use_internal_dnc=='Y') + { + $stmt="SELECT count(*) FROM vicidial_dnc where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + echo "DNC ΑΡΙΘΜΟΣ\n"; + exit; + } + } + if ($stage=='lookup') + { + $stmt="SELECT lead_id FROM vicidial_list where phone_number='$phone_number' order by modify_date desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $man_leadID_ct = mysql_num_rows($rslt); + if ($man_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $affected_rows=1; + $lead_id =$row[0]; + $CBleadIDset=1; + } + else + { + ### insert a new lead in the system with this phone number + $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $lead_id = mysql_insert_id($link); + $CBleadIDset=1; + } + } + else + { + ### insert a new lead in the system with this phone number + $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $lead_id = mysql_insert_id($link); + $CBleadIDset=1; + } + } + else + { + ### grab the next lead in the hopper for this campaign and reserve it for the user + $stmt = "UPDATE vicidial_hopper set status='QUEUE', user='$user' where campaign_id='$campaign' and status='READY' order by hopper_id LIMIT 1"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + } + } + + if ($affected_rows > 0) + { + if (!$CBleadIDset) + { + ##### grab the lead_id of the reserved user in vicidial_hopper + $stmt="SELECT lead_id FROM vicidial_hopper where campaign_id='$campaign' and status='QUEUE' and user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $hopper_leadID_ct = mysql_num_rows($rslt); + if ($hopper_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + } + } + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $source_id = trim("$row[6]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + $called_count++; + + ##### check if system is set to generate logfile for transfers + $stmt="SELECT enable_agc_xfer_log FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enable_agc_xfer_log_ct = mysql_num_rows($rslt); + if ($enable_agc_xfer_log_ct > 0) + { + $row=mysql_fetch_row($rslt); + $enable_agc_xfer_log =$row[0]; + } + + if ( ($WeBRooTWritablE > 0) and ($enable_agc_xfer_log > 0) ) + { + # DATETIME|campaign|lead_id|phone_number|user|type + # 2007-08-22 11:11:11|TESTCAMP|65432|3125551212|1234|M + $fp = fopen ("./xfer_log.txt", "a"); + fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$phone_number|$user|M\n"); + fclose($fp); + } + + ##### if lead is a callback, grab the callback comments + $CBentry_time = ''; + $CBcallback_time = ''; + $CBuser = ''; + $CBcomments = ''; + if (ereg("CALLBK",$dispo)) + { + $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBentry_time = trim("$row[0]"); + $CBcallback_time = trim("$row[1]"); + $CBuser = trim("$row[2]"); + $CBcomments = trim("$row[3]"); + } + } + + ### flag the lead as called and change it's status to INCALL + $stmt = "UPDATE vicidial_list set status='INCALL', called_since_last_reset='Y', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + if (!$CBleadIDset) + { + ### delete the lead from the hopper + $stmt = "DELETE FROM vicidial_hopper where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $stmt="UPDATE vicidial_agent_log set lead_id='$lead_id',comments='MANUAL' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + ### if preview dialing, do not send the call + if ( (strlen($preview)<1) || ($preview == 'NO') ) + { + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### whether to omit phone_code or not + if (eregi('Y',$omit_phone_code)) + {$Ndialstring = "$Local_out_prefix$phone_number";} + else + {$Ndialstring = "$Local_out_prefix$phone_code$phone_number";} + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$server_ip','$campaign','XFER','$lead_id','$MqueryCID','$phone_code','$phone_number','$NOW_TIME','OUT')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',callerid='$MqueryCID',lead_id='$lead_id',comments='MANUAL',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update calls_today count in vicidial_campaign_agents + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $MqueryCID . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + $LeaD_InfO .= $CBentry_time . "\n"; + $LeaD_InfO .= $CBcallback_time . "\n"; + $LeaD_InfO .= $CBuser . "\n"; + $LeaD_InfO .= $CBcomments . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= "MAIN\n"; + $LeaD_InfO .= $source_id . "\n"; + + echo $LeaD_InfO; + + } + else + { + echo "ΚΕÎΟΣ HOPPER\n"; + } + } +} + + +################################################################################ +### manDiaLskip - for manual VICIDiaL dialing this skips the lead that was +### previewed in the step above and puts it back in orig status +################################################################################ +if ($ACTION == 'manDiaLskip') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($stage)<1) || (strlen($called_count)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "LEAD NOT REVERTED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context δεν ισχÏει\n"; + exit; + } + else + { + $called_count = ($called_count - 1); + ### flag the lead as called and change it's status to INCALL + $stmt = "UPDATE vicidial_list set status='$stage', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + + echo "LEAD REVERTED\n"; + } +} + + +################################################################################ +### manDiaLonly - for manual VICIDiaL dialing this sends the call that was +### previewed in the step above +################################################################################ +if ($ACTION == 'manDiaLonly') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) || (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo " ΚΛΗΣΗ NOT PLACED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context δεν ισχÏει\n"; + exit; + } + else + { + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### whether to omit phone_code or not + if (eregi('Y',$omit_phone_code)) + {$Ndialstring = "$Local_out_prefix$phone_number";} + else + {$Ndialstring = "$Local_out_prefix$phone_code$phone_number";} + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$server_ip','$campaign','XFER','$lead_id','$MqueryCID','$phone_code','$phone_number','$NOW_TIME','OUT')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',callerid='$MqueryCID',lead_id='$lead_id',comments='MANUAL',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + echo "$MqueryCID\n"; + } +} + + +################################################################################ +### manDiaLlookCALL - for manual VICIDiaL dialing this will attempt to look up +### the trunk channel that the call was placed on +################################################################################ +if ($ACTION == 'manDiaLlookCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; +if (strlen($MDnextCID)<18) + { + echo "NO\n"; + echo "MDnextCID $MDnextCID δεν ισχÏει\n"; + exit; + } +else + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT uniqueid,channel FROM vicidial_manager where callerid='$MDnextCID' and server_ip='$server_ip' and status='UPDATED' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $uniqueid =$row[0]; + $channel =$row[1]; + echo "$uniqueid\n$channel"; + + $wait_sec=0; + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',wait_epoch='$StarTtime',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + echo "NO\n"; + } + } +} + + + +################################################################################ +### manDiaLlogCALL - for manual VICIDiaL logging of calls places record in +### vicidial_log and then sends process to call_log entry +################################################################################ +if ($ACTION == 'manDiaLlogCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + +if ($stage == "start") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) || (strlen($list_id)<1) || (strlen($phone_number)<1) || (strlen($campaign)<1) ) + { + echo "ΔΕΠΕΓΙÎΕ ΕΙΣΑΓΩΓΗ ΣΤΗΠΚΑΤΑΓΡΑΦΗ ΓΕΓΟÎΟΤΩÎ\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id or list_id: $list_id or phone_number: $phone_number or campaign: $campaign δεν ισχÏει\n"; + exit; + } + else + { + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + ##### insert log into vicidial_log for manual VICIDiaL call + $stmt="INSERT INTO vicidial_log (uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,comments,processed,user_group) values('$uniqueid','$lead_id','$list_id','$campaign','$NOW_TIME','$StarTtime','INCALL','$phone_code','$phone_number','$user','MANUAL','N','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "VICIDiaL_LOG Εισαγωγή : $uniqueid|$channel|$NOW_TIME\n"; + echo "$StarTtime\n"; + } + else + { + echo "ΔΕΠΕΓΙÎΕ ΕΙΣΑΓΩΓΗ ΣΤΗΠΚΑΤΑΓΡΑΦΗ ΓΕΓΟÎΟΤΩÎ\n"; + } + + $stmt = "UPDATE vicidial_auto_calls SET uniqueid='$uniqueid' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + # ##### insert log into call_log for manual VICIDiaL call + # $stmt = "INSERT INTO call_log (uniqueid,channel,server_ip,extension,number_dialed,caller_code,start_time,start_epoch) values('$uniqueid','$channel','$server_ip','$exten','$phone_code$phone_number','MD $user $lead_id','$NOW_TIME','$StarTtime')"; + # if ($DB) {echo "$stmt\n";} + # $rslt=mysql_query($stmt, $link); + # $affected_rows = mysql_affected_rows($link); + + # if ($affected_rows > 0) + # { + # echo "CALL_LOG Εισαγωγή : $uniqueid|$channel|$NOW_TIME"; + # } + # else + # { + # echo "ΔΕΠΕΓΙÎΕ ΕΙΣΑΓΩΓΗ ΣΤΗΠΚΑΤΑΓΡΑΦΗ ΓΕΓΟÎΟΤΩÎ\n"; + # } + } + } + +if ($stage == "end") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) ) + { + echo "ΔΕΠΕΓΙÎΕ ΕΙΣΑΓΩΓΗ ΣΤΗΠΚΑΤΑΓΡΑΦΗ ΓΕΓΟÎΟΤΩÎ\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id δεν ισχÏει\n"; + exit; + } + else + { + if ($start_epoch < 1000) + { + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + ##### look for the start epoch in the vicidial_closer_log table + $stmt="SELECT start_epoch FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user' order by closecallid desc limit 1;"; + } + else + { + ##### look for the start epoch in the vicidial_log table + $stmt="SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + } + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch =$row[0]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($length_in_sec < 1) and ($row[0] > 0) ) + { + ##### start epoch in the vicidial_log table, couldn't find one in vicidial_closer_log + $stmt="SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch =$row[0]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + } + } + else {$length_in_sec = ($StarTtime - $start_epoch);} + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec',status='DONE' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + ############################################# + ##### ΕÎΑΡΞΗ QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + + if ($auto_dial_level > 0) + { + ### check to see if campaign has alt_dial enabled + $stmt="SELECT auto_alt_dial FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_alt_dial =$row[0]; + } + else {$auto_alt_dial = 'NONE';} + if (eregi("(ALT_ONLY|ADDR3_ONLY|ALT_AND_ADDR3)",$auto_alt_dial)) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT alt_dial FROM vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alt_dial =$row[0]; + } + else {$alt_dial = 'NONE';} + + if ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("(ALT_ONLY|ALT_AND_ADDR3)",$auto_alt_dial)) ) + { + $stmt="SELECT alt_phone,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alt_phone = $row[0]; + $alt_phone = eregi_replace("[^0-9]","",$alt_phone); + $gmt_offset_now = $row[1]; + $state = $row[2]; + } + else {$alt_phone = '';} + if (strlen($alt_phone)>5) + { + ### insert record into vicidial_hopper for alt_phone call attempt + $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ALT',user='',priority='25';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + } + if ( ( (eregi("(ALT)",$alt_dial)) and (eregi("ALT_AND_ADDR3",$auto_alt_dial)) ) or ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("ADDR3_ONLY",$auto_alt_dial)) ) ) + { + $stmt="SELECT address3,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $address3 = $row[0]; + $address3 = eregi_replace("[^0-9]","",$address3); + $gmt_offset_now = $row[1]; + $state = $row[2]; + } + else {$address3 = '';} + if (strlen($address3)>5) + { + ### insert record into vicidial_hopper for address3 call attempt + $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ADDR3',user='',priority='20';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + + if ($enable_queuemetrics_logging > 0) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_qm_ct = mysql_num_rows($rslt); + if ($VAC_qm_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_call_id = $row[0]; + $CLlead_id = $row[1]; + $CLphone_number = $row[2]; + $CLstatus = $row[3]; + $CLcampaign_id = $row[4]; + $CLphone_code = $row[5]; + $CLalt_dial = $row[6]; + $CLstage = $row[7]; + $CLcallerid = $row[8]; + $CLuniqueid = $row[9]; + } + + $CLstage = preg_replace("/.*-/",'',$CLstage); + if (strlen($CLstage) < 1) {$CLstage=0;} + + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt="SELECT count(*) from queue_log where call_id='$MDnextCID' and verb='COMPLETECALLER';"; + $rslt=mysql_query($stmt, $linkB); + if ($DB) {echo "$stmt\n";} + $VAC_cc_ct = mysql_num_rows($rslt); + if ($VAC_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $caller_complete = $row[0]; + } + + if ($caller_complete < 1) + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + } + mysql_close($linkB); + } + + ### delete call record from vicidial_auto_calls + $stmt = "DELETE from vicidial_auto_calls where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + + + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',lead_id='',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='ΠΑΥΣΗALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } + else + { + if ($enable_queuemetrics_logging > 0) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_qm_ct = mysql_num_rows($rslt); + if ($VAC_qm_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_call_id = $row[0]; + $CLlead_id = $row[1]; + $CLphone_number = $row[2]; + $CLstatus = $row[3]; + $CLcampaign_id = $row[4]; + $CLphone_code = $row[5]; + $CLalt_dial = $row[6]; + $CLstage = $row[7]; + $CLcallerid = $row[8]; + $CLuniqueid = $row[9]; + } + + $CLstage = preg_replace("/XFER|-/",'',$CLstage); + if ($CLstage < 0.25) {$CLstage=0;} + + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + + $stmt = "DELETE from vicidial_auto_calls lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',lead_id='',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='ΠΑΥΣΗALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } + + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' where uniqueid='$uniqueid' and lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "$uniqueid\n$channel\n"; + } + else + { + echo "ΔΕΠΕΓΙÎΕ ΕΙΣΑΓΩΓΗ ΣΤΗΠΚΑΤΑΓΡΑΦΗ ΓΕΓΟÎΟΤΩÎ\n\n"; + } + } + + echo $VDstop_rec_after_each_call . '|' . $extension . '|' . $conf_silent_prefix . '|' . $conf_exten . '|' . $user_abb . "|\n"; + + ##### if VICIDiaL call and hangup_after_each_call activated, find all recording + ##### channels and hang them up while entering info into recording_log and + ##### returning filename/recordingID + if ($VDstop_rec_after_each_call == 1) + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $total_rec=0; + $loop_count=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten' order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$rec_list = mysql_num_rows($rslt);} + while ($rec_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + if (preg_match("/Local\/$conf_silent_prefix$conf_exten\@/i",$row[0])) + { + $rec_channels[$total_rec] = "$row[0]"; + $total_rec++; + } + if ($format=='debug') {echo "\n";} + $loop_count++; + } + + $total_recFN=0; + $loop_count=0; + $filename=$MT; # not necessary : and cmd_line_f LIKE \"%_$user_abb\" + $stmt="SELECT cmd_line_f FROM vicidial_manager where server_ip='$server_ip' and action='Originate' and cmd_line_b = 'Channel: $local_DEF$conf_silent_prefix$conf_exten$local_AMP$ext_context' order by entry_date desc limit $total_rec;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$recFN_list = mysql_num_rows($rslt);} + while ($recFN_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + $filename[$total_recFN] = preg_replace("/Callerid: /i","",$row[0]); + if ($format=='debug') {echo "\n";} + $total_recFN++; + $loop_count++; + } + + $loop_count=0; + while($loop_count < $total_rec) + { + if (strlen($rec_channels[$loop_count])>5) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$loop_count','Channel: $rec_channels[$loop_count]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "REC_STOP|$rec_channels[$loop_count]|$filename[$loop_count]|"; + if (strlen($filename)>2) + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename[$loop_count]'"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$fn_count = mysql_num_rows($rslt);} + if ($fn_count) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt="UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename[$loop_count]' and end_epoch is NULL;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "$recording_id|$length_in_min|"; + } + else {echo "||";} + } + else {echo "||";} + echo "\n"; + } + $loop_count++; + } + } + + + $talk_sec=0; + $StarTtime = date("U"); + $stmt = "select talk_epoch,talk_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $talk_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set talk_sec='$talk_sec',talk_epoch='$StarTtime',dispo_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } +} + + +################################################################################ +### VDADREcheckINCOMING - for auto-dial VICIDiaL dialing this will recheck for +### calls to see if the channel has updated +################################################################################ +if ($ACTION == 'VDADREcheckINCOMING') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "ΕκστÏατεία $campaign δεν ισχÏει\n"; + echo "lead_id $lead_id δεν ισχÏει\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + } + } +} + + +################################################################################ +### VDADcheckINCOMING - for auto-dial VICIDiaL dialing this will check for calls +### in the vicidial_live_agents table in QUEUE status, then +### lookup the lead info and pass it back to vicidial.php +################################################################################ +if ($ACTION == 'VDADcheckINCOMING') +{ + $Ctype = 'A'; + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "ΕκστÏατεία $campaign δεν ισχÏει\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and status='QUEUE';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',comments='AUTO',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $source_id = trim("$row[6]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + ##### if lead is a callback, grab the callback comments + $CBentry_time = ''; + $CBcallback_time = ''; + $CBuser = ''; + $CBcomments = ''; + if (ereg("CALLBK",$dispo)) + { + $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBentry_time = trim("$row[0]"); + $CBcallback_time = trim("$row[1]"); + $CBuser = trim("$row[2]"); + $CBcomments = trim("$row[3]"); + } + } + + ### update the lead status to INCALL + $stmt = "UPDATE vicidial_list set status='INCALL', user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the log status to INCALL + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + $stmt = "UPDATE vicidial_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL', user_group='$user_group' where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + ### update the vicidial_closer_log user to INCALL + $stmt = "UPDATE vicidial_closer_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL', user_group='$user_group' where lead_id='$lead_id' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select campaign_id,phone_number,alt_dial from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($VDAC_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDADchannel_group =$row[0]; + $dialed_number =$row[1]; + $dialed_label =$row[2]; + } + else + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|INBND|$callerid|$user|$user_group|$list_id|$lead_id|$phone_number|$uniqueid|\n"); + fclose($fp); + } + } + + $stmt = "select count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDL_cid_ct = mysql_num_rows($rslt); + if ($VDL_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_front_VDlog =$row[0]; + } + + $stmt = "select * from vicidial_inbound_groups where group_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_group_name = $row[1]; + $VDCL_group_color = $row[2]; + $VDCL_group_web = $row[4]; + $VDCL_fronter_display = $row[7]; + $VDCL_ingroup_script = $row[8]; + $VDCL_get_call_launch = $row[9]; + $VDCL_xferconf_a_dtmf = $row[10]; + $VDCL_xferconf_a_number = $row[11]; + $VDCL_xferconf_b_dtmf = $row[12]; + $VDCL_xferconf_b_number = $row[13]; + $VDCL_default_xfer_group= $row[28]; + + ### update the comments in vicidial_live_agents record + $stmt = "UPDATE vicidial_live_agents set comments='INBOUND' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $Ctype = 'I'; + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_ingroup_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + } + + ### if web form is set then send στο to vicidial.php for override of WEB_FORM address + if ( (strlen($VDCL_group_web)>5) or (strlen($VDCL_group_name)>0) ) {echo "$VDCL_group_web|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|\n";} + else {echo "|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|\n";} + + $stmt = "SELECT full_name from vicidial_users where user='$tsr';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDU_cid_ct = mysql_num_rows($rslt); + if ($VDU_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $fronter_full_name = $row[0]; + echo $fronter_full_name . '|' . $tsr . "\n"; + } + else {echo '|' . $tsr . "\n";} + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_campaign_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + echo "|||||$VDCL_campaign_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n|\n"; + + $stmt = "select phone_number,alt_dial from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($VDAC_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dialed_number =$row[0]; + $dialed_label =$row[1]; + } + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $callerid . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + $LeaD_InfO .= $CBentry_time . "\n"; + $LeaD_InfO .= $CBcallback_time . "\n"; + $LeaD_InfO .= $CBuser . "\n"; + $LeaD_InfO .= $CBcomments . "\n"; + $LeaD_InfO .= $dialed_number . "\n"; + $LeaD_InfO .= $dialed_label . "\n"; + $LeaD_InfO .= $source_id . "\n"; + + echo $LeaD_InfO; + + + + $wait_sec=0; + $StarTtime = date("U"); + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + ### If ΚΛΗΣΗBK, change vicidial_callback record to INACTIVE + if (eregi("CALLBK|CBHOLD", $dispo)) + { + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='$lead_id' and status NOT IN('INACTIVE','DEAD','ARCHIVE');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + ##### check if system is set to generate logfile for transfers + $stmt="SELECT enable_agc_xfer_log FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enable_agc_xfer_log_ct = mysql_num_rows($rslt); + if ($enable_agc_xfer_log_ct > 0) + { + $row=mysql_fetch_row($rslt); + $enable_agc_xfer_log =$row[0]; + } + + if ( ($WeBRooTWritablE > 0) and ($enable_agc_xfer_log > 0) ) + { + # DATETIME|campaign|lead_id|phone_number|user|type + # 2007-08-22 11:11:11|TESTCAMP|65432|3125551212|1234|A + $fp = fopen ("./xfer_log.txt", "a"); + fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$phone_number|$user|$Ctype\n"); + fclose($fp); + } + + } + else + { + echo "0\n"; + # echo "No calls in QUEUE for $user στο $server_ip\n"; + exit; + } + } +} + + +################################################################################ +### userLOGout - Logs the user out of VICIDiaL client, deleting db records and +### inserting into vicidial_user_log +################################################################################ +if ($ACTION == 'userLOGout') +{ + $MT[0]=''; + $row=''; $rowx=''; +if ( (strlen($campaign)<1) || (strlen($conf_exten)<1) ) + { + echo "NO\n"; + echo "campaign $campaign or conf_exten $conf_exten δεν ισχÏει\n"; + exit; + } +else + { + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + ##### Insert a ΑΠΟΣΥÎΔΕΣΗ record into the user log + $stmt="INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$user','ΑΠΟΣΥÎΔΕΣΗ','$campaign','$NOW_TIME','$StarTtime','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vul_insert = mysql_affected_rows($link); + + if ($no_delete_sessions < 1) + { + ##### Remove the reservation στο the vicidial_conferences meetme room + $stmt="UPDATE vicidial_conferences set extension='' where server_ip='$server_ip' and conf_exten='$conf_exten';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vc_remove = mysql_affected_rows($link); + } + + ##### Delete the vicidial_live_agents record for this session + $stmt="DELETE from vicidial_live_agents where server_ip='$server_ip' and user ='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vla_delete = mysql_affected_rows($link); + + ##### Delete the vicidial_live_inbound_agents records for this session + $stmt="DELETE from vicidial_live_inbound_agents where user ='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vlia_delete = mysql_affected_rows($link); + + ##### Delete the web_client_sessions + $stmt="DELETE from web_client_sessions where server_ip='$server_ip' and session_name ='$session_name';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $wcs_delete = mysql_affected_rows($link); + + ##### Hangup the client phone + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$extension%\" order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) + { + $row=mysql_fetch_row($rslt); + $agent_channel = "$row[0]"; + if ($format=='debug') {echo "\n";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','ULGH3459$StarTtime','Channel: $agent_channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $pause_sec=0; + $stmt = "select pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ( ($VDpr_ct > 0) and (strlen($row[3]<5)) and (strlen($row[4]<5)) ) + { + $row=mysql_fetch_row($rslt); + $pause_sec = (($StarTtime - $row[0]) + $row[1]); + + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + if ($vla_delete > 0) + { + ############################################# + ##### ΕÎΑΡΞΗ QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $allow_sipsak_messages = $row[6]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_message = 'LOGGED OUT'; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_message\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + } + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + # $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='ΠΑΥΣΗ',serverid='1';"; + # if ($DB) {echo "$stmt\n";} + # if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + # $rslt=mysql_query($stmt, $linkB); + # $affected_rows = mysql_affected_rows($linkB); + + $stmt = "SELECT time_id FROM queue_log where agent='Agent/$user' and verb='AGENTLOGIN' order by time_id desc limit 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + if ($DB) {echo "$stmt\n";} + echo "$stmt\n"; + $li_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $li_conf_ct) + { + $row=mysql_fetch_row($rslt); + $logintime = $row[0]; + $i++; + } + + $time_logged_in = ($StarTtime - $logintime); + if ($time_logged_in > 1000000) {$time_logged_in=1;} + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='AGENTLOGOFF',data1='$user$agents',data2='$time_logged_in',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + + echo "$vul_insert|$vc_remove|$vla_delete|$wcs_delete|$agent_channel|$vlia_delete\n"; + } +} + + +################################################################################ +### updateDISPO - update the vicidial_list table to reflect the agent choice of +### call disposition for that leand +################################################################################ +if ($ACTION == 'updateDISPO') +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($dispo_choice)<1) || (strlen($lead_id)<1) ) + { + echo "Dispo Choice $dispo or lead_id $lead_id δεν ισχÏει\n"; + exit; + } + else + { + $stmt="UPDATE vicidial_list set status='$dispo_choice', user='$user' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by uniqueid desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + if ( ($use_internal_dnc=='Y') and ($dispo_choice=='DNC') ) + { + $stmt = "select phone_number from vicidial_list where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $stmt="INSERT INTO vicidial_dnc (phone_number) values('$row[0]');"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + } + } + + $dispo_sec=0; + $StarTtime = date("U"); + $stmt = "select dispo_epoch,dispo_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dispo_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set dispo_sec='$dispo_sec',dispo_epoch='$StarTtime',status='$dispo_choice' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id($link); + + ### ΚΛΗΣΗBACK ENTRY + if ( ($dispo_choice == 'CBHOLD') and (strlen($CallBackDatETimE)>10) ) + { + $stmt="INSERT INTO vicidial_callbacks (lead_id,list_id,campaign_id,status,entry_time,callback_time,user,recipient,comments,user_group) values('$lead_id','$list_id','$campaign','ACTIVE','$NOW_TIME','$CallBackDatETimE','$user','$recipient','$comments','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $stmt="SELECT auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ( ($auto_dial_level > 0) and (ereg(" $dispo_choice ",$row[0])) ) + { + $stmt = "select count(*) from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + $stmt="UPDATE vicidial_hopper set status='READY' where lead_id='$lead_id' and status='HOLD' limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + else + { + $stmt="DELETE from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + ############################################# + ##### ΕÎΑΡΞΗ QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='CALLΚΑΤΑΣΤΑΣΗ',data1='$dispo_choice',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + + echo 'Lead ' . $lead_id . ' έχει αλλαχτεί ' . $dispo_choice . " Κατάσταση\nNext agent_log_id:\n" . $agent_log_id . "\n"; +} + +################################################################################ +### updateLEAD - update the vicidial_list table to reflect the values that are +### in the agents screen at time of call hangup +################################################################################ +if ($ACTION == 'updateLEAD') +{ + $MT[0]=''; + $row=''; $rowx=''; + $DO_NOT_UPDATE=0; + $DO_NOT_UPDATE_text=''; + if ( (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + echo "phone_number $phone_number or lead_id $lead_id δεν ισχÏει\n"; + exit; + } + else + { + + $stmt = "SELECT disable_alter_custdata FROM vicidial_campaigns where campaign_id='$campaign'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $dac_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $dac_conf_ct) + { + $row=mysql_fetch_row($rslt); + $disable_alter_custdata = $row[0]; + $i++; + } + if (ereg('Y',$disable_alter_custdata)) + { + $DO_NOT_UPDATE=1; + $DO_NOT_UPDATE_text=' NOT'; + $stmt = "SELECT alter_custdata_override FROM vicidial_users where user='$user'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $aco_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $aco_conf_ct) + { + $row=mysql_fetch_row($rslt); + $alter_custdata_override = $row[0]; + $i++; + } + if (ereg('ALLOW_ALTER',$alter_custdata_override)) + { + $DO_NOT_UPDATE=0; + $DO_NOT_UPDATE_text=''; + } + } + + if ($DO_NOT_UPDATE < 1) + { + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + $comments = eregi_replace("--AMP--",'&',$comments); + $comments = eregi_replace("--QUES--",'?',$comments); + $comments = eregi_replace("--POUND--",'#',$comments); + + $stmt="UPDATE vicidial_list set vendor_lead_code='" . mysql_real_escape_string($vendor_lead_code) . "', title='" . mysql_real_escape_string($title) . "', first_name='" . mysql_real_escape_string($first_name) . "', middle_initial='" . mysql_real_escape_string($middle_initial) . "', last_name='" . mysql_real_escape_string($last_name) . "', address1='" . mysql_real_escape_string($address1) . "', address2='" . mysql_real_escape_string($address2) . "', address3='" . mysql_real_escape_string($address3) . "', city='" . mysql_real_escape_string($city) . "', state='" . mysql_real_escape_string($state) . "', province='" . mysql_real_escape_string($province) . "', postal_code='" . mysql_real_escape_string($postal_code) . "', country_code='" . mysql_real_escape_string($country_code) . "', gender='" . mysql_real_escape_string($gender) . "', date_of_birth='" . mysql_real_escape_string($date_of_birth) . "', alt_phone='" . mysql_real_escape_string($alt_phone) . "', email='" . mysql_real_escape_string($email) . "', security_phrase='" . mysql_real_escape_string($security_phrase) . "', comments='" . mysql_real_escape_string($comments) . "' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } + echo "Lead $lead_id information has$DO_NOT_UPDATE_text been updated\n"; +} + + +################################################################################ +### VDADpause - update the vicidial_live_agents table to show that the agent is +### or ready now active and ready to take calls +################################################################################ +if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($stage)<2) || (strlen($server_ip)<1) ) + { + echo "stage $stage δεν ισχÏει\n"; + exit; + } + else + { + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set lead_id='',uniqueid=0,callerid='',channel='', random_id='$random',comments='' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_live_agents set status='$stage' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + ############################################# + ##### ΕÎΑΡΞΗ QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + if (ereg('READY',$stage)) {$QMstatus='UNPAUSEALL';} + if (ereg('ΠΑΥΣΗ',$stage)) {$QMstatus='ΠΑΥΣΗALL';} + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='$QMstatus',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + + if ($agent_log == 'NO') + {$donothing=1;} + else + { + $pause_sec=0; + $stmt = "select pause_epoch,pause_sec,wait_epoch,wait_sec,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec=0; + if ($row[2] > 0) + { + $wait_sec = (($StarTtime - $row[2]) + $row[3]); + } + if ( (eregi("NULL",$row[4])) or ($row[4] < 1000) ) + {$pause_sec = (($StarTtime - $row[0]) + $row[1]);} + else + {$pause_sec = (($row[4] - $row[0]) + $row[1]);} + + } + if ($ACTION == 'VDADready') + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($ACTION == 'VDADpause') + { + $stmt="UPDATE vicidial_agent_log set pause_epoch='$StarTtime',wait_sec='$wait_sec' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + echo 'Agent ' . $user . ' είναι τώÏα στη κατάσταση ' . $stage . "\n"; +} + + +################################################################################ +### UpdatEFavoritEs - update the astguiclient favorites list for this extension +################################################################################ +if ($ACTION == 'UpdatEFavoritEs') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($favorites_list)<1) || (strlen($user)<1) || (strlen($exten)<1) ) + { + echo "favorites list $favorites_list δεν ισχÏει\n"; + exit; + } + else + { + $stmt = "select count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + $stmt="UPDATE phone_favorites set extensions_list=\"$favorites_list\" where extension='$exten' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="INSERT INTO phone_favorites values('$exten','$server_ip',\"$favorites_list\");"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + echo "Favorites list has been updated to $favorites_list for $exten\n"; +} + + +################################################################################ +### PauseCodeSubmit - Update vicidial_agent_log with pause code +################################################################################ +if ($ACTION == 'ΠαÏσηCodeSubmit') +{ + $row=''; $rowx=''; + if ( (strlen($status)<1) || (strlen($agent_log_id)<1) ) + { + echo "agent_log_id $agent_log_id or pause_code $status δεν ισχÏει\n"; + exit; + } + else + { + $stmt="UPDATE vicidial_agent_log set sub_status=\"$status\" where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + ############################################# + ##### ΕÎΑΡΞΗ QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $allow_sipsak_messages = $row[6]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_prefix = 'BK-'; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$status\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + } + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='ΠΑΥΣΗREASON',serverid='$queuemetrics_log_id',data1='$status';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } +echo "ΠαÏση Code has been updated to $status for $agent_log_id\n"; +} + + +################################################################################ +### CalLBacKLisT - List the USERONLY callbacks for an agent +################################################################################ +if ($ACTION == 'CalLBacKLisT') +{ +$stmt = "select callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' and campaign_id='$campaign' and status NOT IN('INACTIVE','DEAD') order by callback_time;"; +if ($DB) {echo "$stmt\n";} +$rslt=mysql_query($stmt, $link); +if ($rslt) {$callbacks_count = mysql_num_rows($rslt);} +echo "$callbacks_count\n"; +$loop_count=0; + while ($callbacks_count>$loop_count) + { + $row=mysql_fetch_row($rslt); + $callback_id[$loop_count] = $row[0]; + $lead_id[$loop_count] = $row[1]; + $campaign_id[$loop_count] = $row[2]; + $status[$loop_count] = $row[3]; + $entry_time[$loop_count] = $row[4]; + $callback_time[$loop_count] = $row[5]; + $comments[$loop_count] = $row[6]; + $loop_count++; + } +$loop_count=0; + while ($callbacks_count>$loop_count) + { + $stmt = "select first_name,last_name,phone_number from vicidial_list where lead_id='$lead_id[$loop_count]';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count]\n"; + $loop_count++; + } + +} + + +################################################################################ +### CalLBacKCounT - send the count of the USERONLY callbacks for an agent +################################################################################ +if ($ACTION == 'CalLBacKCounT') +{ +$stmt = "select count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' and campaign_id='$campaign' and status NOT IN('INACTIVE','DEAD');"; +if ($DB) {echo "$stmt\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$cbcount=$row[0]; + +echo "$cbcount"; +} + + + + +if ($format=='debug') +{ +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +echo "\n"; +echo "\n\n\n"; +} + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/vicidial.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/vicidial.php new file mode 100644 index 00000000..4d71a6d7 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/vicidial.php @@ -0,0 +1,6797 @@ + LICENSE: GPLv2 +# +# make sure you have added a user to the vicidial_users MySQL table with at least +# user_level 1 or greater to access this page. Also, you need to have the login +# and pass of a phone listed in the asterisk.phones table. The page grabs the +# server info and other details from this login and pass. +# +# This script works best with Firefox or Mozilla, but will run for a couple +# hours on Internet Explorer before the memory leaks cause a crash. +# +# Other scripts that this application depends on: +# - vdc_db_query.php: Updates information in the database +# - manager_send.php: Sends manager actions to the DB for execution +# +# CHANGELOG +# 50607-1426 - First Build of VICIDIAL web client basic login process finished +# 50628-1620 - Added some basic formatting and worked on process flow +# 50628-1715 - Startup variables mapped to javascript variables +# 50629-1303 - Added Login Closer in-groups selection box and vla update +# 50629-1530 - Rough layout for customer info form section and button links +# 50630-1453 - Rough Manual Dial/Hangup with customer info displayed +# 50701-1450 - Added vicidial_log entries on dial and hangup +# 50701-1634 - Added Logout function +# 50705-1259 - Added call disposition functionality +# 50705-1432 - Added lead info DB update function +# 50705-1658 - Added web form functionality +# 50706-1043 - Added call park and pickup functions +# 50706-1234 - Added Start/Stop Recording functionality +# 50706-1614 - Added conference channels display option +# 50711-1333 - Removed call check redundancy and fixed a span bug +# 50727-1424 - Added customer channel and participant present sensing/alerts +# 50804-1057 - Added SendDTMF function and reconfigured the transfer span +# 50804-1224 - Added Local and Internal Closer transfer functions +# 50804-1628 - Added Blind transfer, activated LIVE CALL image and fixed bugs +# 50804-1808 - Added button images for left buttons +# 50815-1151 - Added 3Way calling functions to Transfer-conf frame +# 50815-1602 - Added images and buttons for xfer functions +# 50816-1813 - Added basic autodial outbound call pickup functions +# 50817-1113 - Fixes to auto_dialing call receipt +# 50817-1234 - Added inbound call receipt capability +# 50817-1541 - Added customer time display +# 50817-1541 - Added customer time display +# 50818-1327 - Added stop-all-recordings-after-each-vicidial-call option +# 50818-1703 - Added pretty login section +# 50825-1200 - Modified form field lengths, added double-click dispositions +# 50831-1603 - Fixed customer time bug and fronter display bug for CLOSER +# 50901-1314 - Fixed CLOSER IN-GROUP Web Form bug +# 50903-0904 - Added preview-lead code for manual dialing +# 50904-0016 - Added ability to hangup manual dials before pickup +# 50906-1319 - Added override for filters on xfer calls, fixed login display bug +# 50909-1243 - Added hotkeys functionality for quick dispoing in auto-dial mode +# 50912-0958 - Modified hotkeys function, agent must have user_level >= 5 to use +# 50913-1212 - Added campaign_cid to 3rd party calls +# 50923-1546 - Modified to work with language translation +# 50926-1656 - Added campaign pull-down at login of active campaigns +# 50928-1633 - Added manual dial alternate number dial option +# 50930-1538 - Added session_id empty login failure and fixed 2 minor bugs +# 51004-1656 - Fixed recording filename bug and new Spanish translation +# 51020-1103 - Added campaign-specific recording control abilities +# 51020-1352 - Added Basic vicidial_agent_log framework +# 51021-1050 - Fixed custtime display and disable Enter/Return keypresses +# 51021-1718 - Allows for multi-line comments (changes \n to !N in database) +# 51110-1432 - Fixed non-standard http port issue +# 51111-1047 - Added vicidial_agent_log lead_id earlier for manual dial +# 51118-1305 - Activate multi-line comments from $multi_line_comments var +# 51118-1313 - Move Transfer DIV to a floating span to preserve 800x600 view +# 51121-1506 - Small PHP optimizations in many scripts and disabled globalize +# 51129-1010 - Added ability to accept calls from other VICIDIAL servers +# 51129-1254 - Fixed Hangups of other agents channels when customer hangs up +# 51208-1732 - Created user-first login that looks for default phone info +# 51219-1526 - Added variable framework for campaign and in-group scripts +# 51221-1200 - Added SCRIPT tab, layout and functionality +# 51221-1714 - Added auto-switch-to-SCRIPT-tab and auto-webform-popup +# 51222-1605 - Added VMail message blind transfer button to xfer-conf frame +# 51229-1028 - Added checks on web_form_address to allow for var in the DB value +# 60117-1312 - Added Transfer-conf frame toggle on button press +# 60208-1152 - Added DTMF-xfernumber preset links to xfer-conf frame +# 60213-1129 - Added vicidial_users.hotkeys_active for any user hotkeys +# 60213-1210 - Added ability to sort routing of calls by user_level +# 60214-0932 - Initial Callback calendar display framework +# 60214-1407 - Added ability to minimize the dispo screen to see info below +# 60215-1104 - Added ANYONE scheduled callbacks functionality +# 60410-1116 - Added persistant pause after dispo option and change dispo text +# - Added web form submit that opens new window with dispo on submit +# - Added PREVIOUS CALLBACK in customer info to flag callbacks +# - Added link to try to hangup the call again in the dispo screen +# - Added link noone-in-session screen to call agent phone again +# - Added link customer-hungup screen to go straight to dispo screen +# 60410-1532 - Added agent status and campaign calls dialing display option +# 60411-1547 - Add ability to set callback as USERONLY and some basic formatting +# 60413-1752 - Add basic USERONLY callback frame and listings +# 60414-1039 - Changed manual dial preview and alt dial checkboxes to spans +# - Added beta-level USERONLY callback functionality +# - Added beta-level manual dialing with lead insertion functionality +# 60415-1534 - Fixed manual dial lead preview and fixed manuald dial override bug +# 60417-1108 - Added capability to do alt-number-dialing in auto-dial mode +# - Changed several permissions to database-defined +# 60419-1529 - Prevent manual dial or callbacks when alt-dial lead not finished +# 60420-1647 - Fixed DiaLDiaLAltPhonE error, Call Agent Again DialControl error +# 60421-1229 - Check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60424-1005 - Fixed Alt phone disabled bug for callbacks and manual dials +# 60426-1058 - Added vicidial_user setting for default blended check for CLOSER +# 60501-1008 - Added option to manual dial screen to manually lookup phone number +# 60503-1653 - Fixed agentonly_callback not-defined bug in scheduled callbacks screen +# 60504-1032 - Fixed manual dial display bug and transfer dispo alert bug +# - Fixed recording filename display to not overrun 25 characters +# 60510-1051 - Added Wrapup timer and wrapup message on wrapup screen after dispo +# 60608-1453 - Added CLOSER campaign allowable in-groups limitations +# 60609-1123 - Added add-number-to-DNC-list function and manual dial check DNC +# 60619-1047 - Added variable filters to close security holes for login form +# 60804-1710 - fixed scheduled CALLBK for other languages build +# 60808-1145 - Added consultative transfers with customer data +# 60808-2232 - Added campaign name to pulldown for login screen +# 60809-1603 - Added option to locally transfer consult xfers +# 60809-1732 - Added recheck of transferred channels before customer gone mesg +# 60810-1011 - Fixed CXFER leave 3way call bugs +# 60816-1602 - Added ALLCALLS recording delay option allcalls_delay +# 60816-1716 - Fixed customer time display bug and client DST setting +# 60821-1555 - Added option to omit phone_code on dialout of leads +# 60821-1628 - Added ALLFORCE recording option +# 60821-1643 - Added no_delete_sessions option to not delete sessions +# 60822-0512 - Changed phone number fields to be maxlength of 12 +# 60829-1531 - Made compatible with WeBRooTWritablE setting in dbconnect.php +# 60906-1152 - Added Previous CallBack info display span +# 60906-1715 - Allow for Local phone extension conferences +# 61004-1729 - Add ability to control volume per channel in "calls in this session" +# 61122-1341 - Added vicidial_user_groups allowed_campaigns restrictions +# 61122-1523 - Added more SCRIPT variables +# 61128-2229 - Added vicidial_live_agents and vicidial_auto_calls manual dial entries +# 61130-1617 - Added lead_id to MonitorConf for recording_log +# 61221-1212 - Changed width to 760 to better fit 800x600 screens, widened SCRIPT +# 70109-1128 - Fixed wrapup timer bug +# 70109-1635 - Added option for HotKeys automatically dialing next number in manual mode +# - Added option for alternate number dialing with hotkeys +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70118-1517 - Added vicidial_agent_log and vicidial_user_log logging of user_group +# 70201-1249 - Added FAST DIAL option for manually dialing, added UTF8 compatible code +# 70201-1703 - Fixed cursor bug for most text input fields +# 70202-1453 - Added first portions of Agent Pause Codes +# 70203-0108 - Finished Agent Pause Codes functionality +# 70203-0930 - Added dialed_number to webform output +# 70203-1010 - Added dialed_label to webform output +# 70206-1201 - Fixed allow_closers bug +# 70206-1332 - Added vicidial_recording_override users setting function +# 70212-1252 - Fixed small issue with CXFER +# 70213-1018 - Changed CXFER and AXFER to update customer information before transfer +# 70214-1233 - Added queuemetrics_log_id field for server_id in queue_log +# 70215-1240 - Added queuemetrics_log_id field for server_id in queue_log +# 70222-1617 - Changed queue_log PAUSE/UNPAUSE to PAUSEALL/UNPAUSEALL +# 70226-1252 - Added Mute/UnMute to agent screen +# 70309-1035 - Allow amphersands and questions marks in comments to pass through +# 70313-1052 - Allow pound signs(hash) in comments to pass through +# 70316-1406 - Moved the MUTE button to be accessible during a transfer/conf +# 70319-1446 - Added agent-deactive-display and disable customer info update functions +# 70319-1626 - Added option to allow agent logins to campaigns with no leads in the hopper +# 70320-1501 - Added option to allow retry of leave-3way-call from dispo screen +# 70322-1545 - Added sipsak display ability +# 70510-1319 - Added onUnload force Logout +# 70806-1530 - Added Presets Dial links above agent mute button +# 70823-2118 - Fixed XMLHTTPRequest, HotKeys and Scheduled Callbacks issues with MSIE +# 70828-1443 - Added source_id to output of SCRIPTtab-IFRAME and WEBFORM +# 71022-1427 - Added formatting of the customer phone number in the main status bar +# 71029-1848 - Changed CLOSER-type campaign to not use campaign_id restrictions +# 71101-1204 - Fixed bug in callback calendar with DST +# 71116-0957 - Added campaign_weight and calls_today to the vla table insertion +# 71120-1719 - Added XMLHTPRequest lookup of allowable campaigns for agents during login +# 71122-0256 - Added auto-pause notification +# 71125-1751 - Changed Transfer section to allow for selection of in-groups to send calls to +# 71127-0408 - Added height and width settings for easier modification of screen size +# 71129-2025 - restricted callbacks count and list to campaign only +# + +$version = '2.0.4-142'; +$build = '71129-2025'; + +require("dbconnect.php"); + +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["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} + 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"];} + } + if (isset($VD_campaign)) + { + $VD_campaign = strtoupper($VD_campaign); + $VD_campaign = eregi_replace(" ",'',$VD_campaign); + } + +### 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); + + +$forever_stop=0; + +if ($force_logout) +{ + echo "Έχετε αποσυνδεθεί. Σας ευχαÏιστοÏμε\n"; + exit; +} + +$isdst = date("I"); +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$CIDdate = date("ymdHis"); + $month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); + $past_month_date = date("Y-m-d H:i:s",$month_old); + + +$random = (rand(1000000, 9999999) + 10000000); + +$conf_silent_prefix = '7'; # vicidial_conferences prefix to enter silently +$HKuser_level = '5'; # minimum vicidial user_level for HotKeys +$campaign_login_list = '1'; # show drop-down list of campaigns at login +$manual_dial_preview = '1'; # allow preview lead option when manual dial +$multi_line_comments = '1'; # set to 1 to allow multi-line comment box +$user_login_first = '0'; # set to 1 to have the vicidial_user login before the phone login +$view_scripts = '1'; # set to 1 to show the SCRIPTS tab +$dispo_check_all_pause = '0'; # set to 1 to allow for persistent pause after dispo +$agentcallsstatus = '0'; # set to 1 to show agent status and call count + $campagentstatctmax = '0'; # Number of δευτεÏόλεπτα for campaign call and agent stats +$show_campname_pulldown = '1'; # set to 1 to show campaign name στο login pulldown +$webform_sessionname = '1'; # set to 1 to include the session_name in webform URL +$local_consult_xfers = '1'; # set to 1 to send consultative transfers from original server +$clientDST = '1'; # set to 1 to check for DST στο server for agent time +$no_delete_sessions = '0'; # set to 1 to not delete sessions at logout +$volumecontrol_active = '1'; # set to 1 to allow agents to alter volume of channels +$PreseT_DiaL_LinKs = '1'; # set to 1 to show a ΚΛΗΣΗ link for Dial Presets +$LogiNAJAX = '1'; # set to 1 to do lookups +$HidEMonitoRSessionS = '1'; # set to 1 to hide remote monitoring channels from "session calls" + +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen + +$BROWSER_HEIGHT = 500; # set to the minimum browser height, default=500 +$BROWSER_WIDTH = 770; # set to the minimum browser width, default=770 + + +# options now set in DB: +#$alt_phone_dialing = '1'; # allow agents to call alt phone numbers +#$scheduled_callbacks = '1'; # set to 1 to allow agent to choose scheduled callbacks +# $agentonly_callbacks = '1'; # set to 1 to allow agent to choose agent-only scheduled callbacks +#$agentcall_manual = '1'; # set to 1 to allow agent to make manual calls during autodial session + +### SCREEN WIDTH AND HEIGHT CALCULATIONS ### +### DO NOT EDIT! ### +$MASTERwidth=($BROWSER_WIDTH - 340); +$MASTERheight=($BROWSER_HEIGHT - 200); +if ($MASTERwidth < 430) {$MASTERwidth = '430';} +if ($MASTERheight < 300) {$MASTERheight = '300';} + +$CAwidth = ($MASTERwidth + 340); # 770 - cover all (none-in-session, customer hunngup, etc...) +$MNwidth = ($MASTERwidth + 330); # 760 - main frame +$XFwidth = ($MASTERwidth + 320); # 750 - transfer/conference +$HCwidth = ($MASTERwidth + 310); # 740 - hotkeys and callbacks +$AMwidth = ($MASTERwidth + 270); # 700 - agent mute and preset-dial links +$SSwidth = ($MASTERwidth + 176); # 606 - scroll script +$SDwidth = ($MASTERwidth + 170); # 600 - scroll script, customer data and calls-in-session +$HKwidth = ($MASTERwidth + 70); # 500 - Hotkeys button +$HSwidth = ($MASTERwidth + 1); # 431 - Header spacer + +$HKheight = ($MASTERheight + 105); # 405 - HotKey active Button +$AMheight = ($MASTERheight + 100); # 400 - Agent mute and preset dial links +$MBheight = ($MASTERheight + 65); # 365 - Manual Dial Buttons +$CBheight = ($MASTERheight + 50); # 350 - Agent Callback, pause code, volume control Buttons and agent status +$SSheight = ($MASTERheight + 31); # 331 - script content +$HTheight = ($MASTERheight + 10); # 310 - transfer frame, callback comments and hotkey +$BPheight = ($MASTERheight - 250); # 50 - bottom buffer + + +$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('vicidial.php','',$agcPAGE); + +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 +echo "\n"; +echo "\n"; +echo "\n"; + +if ($campaign_login_list > 0) +{ +$camp_form_code = "\n"; +} +else +{ +$camp_form_code = "\n"; +} + + +if ($LogiNAJAX > 0) +{ +?> + + + +χειÏιστής VICIΚΛΗΣΗ: ΕπανασÏνδεση\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "
English Ελληνικά
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
ΕπανασÏνδεση
 
ΣÏνδεση Τηλεφώνου:
Κωδικός Ï€Ïόσβασης Τηλεφώνου:
ΣÏνδεση χÏήστη:
Κωδικός Ï€Ïόσβασης χÏήστη:
ΕκστÏατεία: $camp_form_code

ΕΚΔΟΣΗ: $version       ΔΗΜΙΟΥΡΓΙΑ: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} + +if ($user_login_first == 1) +{ + if ( (strlen($VD_login)<1) or (strlen($VD_pass)<1) or (strlen($VD_campaign)<1) ) + { + echo "χειÏιστής VICIΚΛΗΣΗ: ΣÏνδεση εκστÏατείας\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + #echo "\n"; + #echo "\n"; + echo "

ΣÏνδεση χÏήστη

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
ΣÏνδεση εκστÏατείας
 
ΣÏνδεση χÏήστη:
Κωδικός Ï€Ïόσβασης χÏήστη:
ΕκστÏατεία: $camp_form_code
  \n"; + echo "

ΕΚΔΟΣΗ: $version       ΔΗΜΙΟΥΡΓΙΑ: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) + { + $stmt="SELECT phone_login,phone_pass from vicidial_users where user='$VD_login' and pass='$VD_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); + $phone_login=$row[0]; + $phone_pass=$row[1]; + + echo "χειÏιστής VICIΚΛΗΣΗ: ΣÏνδεση\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
ΣÏνδεση
 
ΣÏνδεση Τηλεφώνου:
Κωδικός Ï€Ïόσβασης Τηλεφώνου:
ΣÏνδεση χÏήστη:
Κωδικός Ï€Ïόσβασης χÏήστη:
ΕκστÏατεία: $camp_form_code
  \n"; + echo "

ΕΚΔΟΣΗ: $version       ΔΗΜΙΟΥΡΓΙΑ: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + + } + } +} + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "χειÏιστής VICIΚΛΗΣΗ: ΣÏνδεση Τηλεφώνου\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "
English Ελληνικά
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
ΣÏνδεση Τηλεφώνου
 
ΣÏνδεση Τηλεφώνου:
Κωδικός Ï€Ïόσβασης Τηλεφώνου:
  \n"; +echo "

ΕΚΔΟΣΗ: $version       ΔΗΜΙΟΥΡΓΙΑ: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./vicidial_auth_entries.txt", "a");} +$VDloginDISPLAY=0; + + if ( (strlen($VD_login)<2) or (strlen($VD_pass)<2) or (strlen($VD_campaign)<2) ) + { + $VDloginDISPLAY=1; + } + else + { + $stmt="SELECT count(*) from vicidial_users where user='$VD_login' and pass='$VD_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($auth>0) + { + $login=strtoupper($VD_login); + $password=strtoupper($VD_pass); + ##### grab the full name of the agent + $stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,closer_default_blended,user_group,vicidial_recording_override from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $user_level=$row[1]; + $VU_hotkeys_active=$row[2]; + $VU_agent_choose_ingroups=$row[3]; + $VU_scheduled_callbacks=$row[4]; + $agentonly_callbacks=$row[5]; + $agentcall_manual=$row[6]; + $VU_vicidial_recording=$row[7]; + $VU_vicidial_transfers=$row[8]; + $VU_closer_default_blended=$row[9]; + $VU_user_group=$row[10]; + $VU_vicidial_recording_override=$row[11]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|$VD_pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + $user_abb = "$VD_login$VD_login$VD_login$VD_login"; + while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + + $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$VU_user_group';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGallowed_campaigns =$row[0]; + + if ( (!eregi(" $VD_campaign ",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) + { + echo "χειÏιστής VICIΚΛΗΣΗ: VICIΚΛΗΣΗ ΣÏνδεση εκστÏατείας\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Ελληνικά
\n"; + echo "Sorry, you are not allowed to login to this campaign: $VD_campaign\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "ΣÏνδεση: \n
"; + echo "Κωδικός Ï€Ïόσβασης:
\n"; + echo "ΕκστÏατεία: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + ##### check to see that the campaign is active + $stmt="SELECT count(*) FROM vicidial_campaigns where campaign_id='$VD_campaign' and active='Y';"; + 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); + $CAMPactive=$row[0]; + if($CAMPactive>0) + { + if ($TEST_all_statuses > 0) {$selectableSQL = '';} + else {$selectableSQL = "selectable='Y' and";} + $VARstatuses=''; + $VARstatusnames=''; + ##### grab the statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_statuses WHERE $selectableSQL status != 'NEW' order by status limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $VD_statuses_ct) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + } + + ##### grab the campaign-specific statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_campaign_statuses WHERE $selectableSQL status != 'NEW' and campaign_id='$VD_campaign' order by status limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_camp = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + $j++; + } + $VD_statuses_ct = ($VD_statuses_ct+$VD_statuses_camp); + $VARstatuses = substr("$VARstatuses", 0, -1); + $VARstatusnames = substr("$VARstatusnames", 0, -1); + + ##### grab the campaign-specific HotKey statuses that can be used for dispositioning by an agent + $stmt="SELECT hotkey,status,status_name FROM vicidial_campaign_hotkeys WHERE selectable='Y' and status != 'NEW' and campaign_id='$VD_campaign' order by hotkey limit 9;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $HK_statuses_camp = mysql_num_rows($rslt); + $w=0; + $HKboxA=''; + $HKboxB=''; + $HKboxC=''; + while ($w < $HK_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $HKhotkey[$w] =$row[0]; + $HKstatus[$w] =$row[1]; + $HKstatus_name[$w] =$row[2]; + $HKhotkeys = "$HKhotkeys'$HKhotkey[$w]',"; + $HKstatuses = "$HKstatuses'$HKstatus[$w]',"; + $HKstatusnames = "$HKstatusnames'$HKstatus_name[$w]',"; + if ($w < 3) + {$HKboxA = "$HKboxA $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ( ($w >= 3) and ($w < 6) ) + {$HKboxB = "$HKboxB $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ($w >= 6) + {$HKboxC = "$HKboxC $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + $w++; + } + $HKhotkeys = substr("$HKhotkeys", 0, -1); + $HKstatuses = substr("$HKstatuses", 0, -1); + $HKstatusnames = substr("$HKstatusnames", 0, -1); + + ##### grab the statuses to be dialed for your campaign as well as other campaign settings + $stmt="SELECT park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,agent_pause_codes_active,no_hopper_leads_logins,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,xfer_groups FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $park_ext = $row[0]; + $park_file_name = $row[1]; + $web_form_address = $row[2]; + $allow_closers = $row[3]; + $auto_dial_level = $row[4]; + $dial_timeout = $row[5]; + $dial_prefix = $row[6]; + $campaign_cid = $row[7]; + $campaign_vdad_exten = $row[8]; + $campaign_rec_exten = $row[9]; + $campaign_recording = $row[10]; + $campaign_rec_filename = $row[11]; + $campaign_script = $row[12]; + $get_call_launch = $row[13]; + $campaign_am_message_exten = $row[14]; + $xferconf_a_dtmf = $row[15]; + $xferconf_a_number = $row[16]; + $xferconf_b_dtmf = $row[17]; + $xferconf_b_number = $row[18]; + $alt_number_dialing = $row[19]; + $VC_scheduled_callbacks = $row[20]; + $wrapup_δευτεÏόλεπτα = $row[21]; + $wrapup_message = $row[22]; + $closer_campaigns = $row[23]; + $use_internal_dnc = $row[24]; + $allcalls_delay = $row[25]; + $omit_phone_code = $row[26]; + $agent_pause_codes_active = $row[27]; + $no_hopper_leads_logins = $row[28]; + $campaign_allow_inbound = $row[29]; + $manual_dial_list_id = $row[30]; + $default_xfer_group = $row[31]; + $xfer_groups = $row[32]; + + if ( (!ereg('DISABLED',$VU_vicidial_recording_override)) and ($VU_vicidial_recording > 0) ) + { + $campaign_recording = $VU_vicidial_recording_override; + print "\n"; + } + if ( ($VC_scheduled_callbacks=='Y') and ($VU_scheduled_callbacks=='1') ) + {$scheduled_callbacks='1';} + if ($VU_vicidial_recording=='0') + {$campaign_recording='NEVER';} + if ($alt_number_dialing=='Y') + {$alt_phone_dialing='1';} + else + {$alt_phone_dialing='0';} + $closer_campaigns = preg_replace("/^ | -$/","",$closer_campaigns); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaigns = "'$closer_campaigns'"; + + if ($agent_pause_codes_active=='Y') + { + ##### grab the pause codes for this campaign + $stmt="SELECT pause_code,pause_code_name FROM vicidial_pause_codes WHERE campaign_id='$VD_campaign' order by pause_code limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_pause_codes = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_pause_codes) + { + $row=mysql_fetch_row($rslt); + $pause_codes[$i] =$row[0]; + $pause_code_names[$i] =$row[1]; + $VARpause_codes = "$VARpause_codes'$pause_codes[$i]',"; + $VARpause_code_names = "$VARpause_code_names'$pause_code_names[$i]',"; + $i++; + $j++; + } + $VD_pause_codes_ct = ($VD_pause_codes_ct+$VD_pause_codes); + $VARpause_codes = substr("$VARpause_codes", 0, -1); + $VARpause_code_names = substr("$VARpause_code_names", 0, -1); + } + + ##### grab the inbound groups to choose from if campaign contains CLOSER + $VARingroups="''"; + if ($campaign_allow_inbound == 'Y') + { + $VARingroups=''; + $stmt="select group_id from vicidial_inbound_groups where active = 'Y' and group_id IN($closer_campaigns) order by group_id limit 60;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $closer_ct = mysql_num_rows($rslt); + $INgrpCT=0; + while ($INgrpCT < $closer_ct) + { + $row=mysql_fetch_row($rslt); + $closer_groups[$INgrpCT] =$row[0]; + $VARingroups = "$VARingroups'$closer_groups[$INgrpCT]',"; + $INgrpCT++; + } + $VARingroups = substr("$VARingroups", 0, -1); + } + + ##### grab the allowable inbound groups to choose from for transfer options + $xfer_groups = preg_replace("/^ | -$/","",$xfer_groups); + $xfer_groups = preg_replace("/ /","','",$xfer_groups); + $xfer_groups = "'$xfer_groups'"; + $VARxfergroups="''"; + if ($allow_closers == 'Y') + { + $VARxfergroups=''; + $stmt="select group_id,group_name from vicidial_inbound_groups where active = 'Y' and group_id IN($xfer_groups) order by group_id limit 60;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $xfer_ct = mysql_num_rows($rslt); + $XFgrpCT=0; + while ($XFgrpCT < $xfer_ct) + { + $row=mysql_fetch_row($rslt); + $VARxfergroups = "$VARxfergroups'$row[0]',"; + $VARxfergroupsnames = "$VARxfergroupsnames'$row[1]',"; + if ($row[0] == "$default_xfer_group") {$default_xfer_group_name = $row[1];} + $XFgrpCT++; + } + $VARxfergroups = substr("$VARxfergroups", 0, -1); + $VARxfergroupsnames = substr("$VARxfergroupsnames", 0, -1); + } + + ##### grab the number of leads in the hopper for this campaign + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id = '$VD_campaign' and status='READY';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $campaign_leads_to_call = $row[0]; + print "\n"; + + } + else + { + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Η εκστÏατεία είναι μη ενεÏγή, παÏακαλώ Ï€Ïοσπαθήστε πάλι
"; + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|$VD_pass|$ip|$browser|\n"); + fclose($fp); + } + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Η σÏνδεση δεν είναι σωστή, παÏακαλώ Ï€Ïοσπαθήστε πάλι
"; + } + } + if ($VDloginDISPLAY) + { + echo "χειÏιστής VICIΚΛΗΣΗ: ΣÏνδεση εκστÏατείας\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "

$VDdisplayMESSAGE

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
ΣÏνδεση εκστÏατείας
 
ΣÏνδεση χÏήστη:
Κωδικός Ï€Ïόσβασης χÏήστη:
ΕκστÏατεία: $camp_form_code
  \n"; + echo "

ΕΚΔΟΣΗ: $version       ΔΗΜΙΟΥΡΓΙΑ: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +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); +$authphone=$row[0]; +if (!$authphone) + { + echo "χειÏιστής VICIΚΛΗΣΗ: ΣÏνδεση Τηλεφώνου Error\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
ΣÏνδεση Error
 
Συγγνώμη, αλλά η τηλεφωνική σÏνδεση και ο κωδικός Ï€Ïόσβασής σας δεν είναι ενεÏγά σε αυτό το σÏστημα, παÏακαλώ Ï€Ïοσπαθήστε πάλι:
 
ΣÏνδεση Τηλεφώνου:
Κωδικός Ï€Ïόσβασης Τηλεφώνου:

ΕΚΔΟΣΗ: $version       ΔΗΜΙΟΥΡΓΙΑ: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "χειÏιστής VICIΚΛΗΣΗ\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + 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); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $login=$row[6]; + $pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CallerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + $enable_sipsak_messages=$row[66]; + + if ($clientDST) + { + $local_gmt = ($local_gmt + $isdst); + } + if ($protocol == 'EXTERNAL') + { + $protocol = 'Local'; + $extension = "$dialplan_number$AT$ext_context"; + } + $SIP_user = "$protocol/$extension"; + + $stmt="SELECT asterisk_version from servers where server_ip='$server_ip';"; + 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); + $asterisk_version=$row[0]; + + # If a park extension is not set, use the default one + if ( (strlen($park_ext)>0) && (strlen($park_file_name)>0) ) + { + $VICIDiaL_park_on_extension = "$park_ext"; + $VICIDiaL_park_on_filename = "$park_file_name"; + print "\n"; + } + print "\n"; + + # If a web form address is not set, use the default one + if (strlen($web_form_address)>0) + { + $VICIDiaL_web_form_address = "$web_form_address"; + print "\n"; + } + else + { + $VICIDiaL_web_form_address = "$VICIDiaL_web_URL"; + print "\n"; + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + } + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + # If closers are allowed στο this campaign + if ($allow_closers=="Y") + { + $VICIDiaL_allow_closers = 1; + print "\n"; + } + else + { + $VICIDiaL_allow_closers = 0; + print "\n"; + } + + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtimE$US$session_ext$session_rand"; + + if ($webform_sessionname) + {$webform_sessionname = "&session_name=$session_name";} + else + {$webform_sessionname = '';} + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'vicidial';"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','vicidial','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + if ( ($campaign_allow_inbound == 'Y') || ($campaign_leads_to_call > 0) || (ereg('Y',$no_hopper_leads_logins)) ) + { + ### insert an entry into the user log for the login event + $stmt = "INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$VD_login','LOGIN','$VD_campaign','$NOW_TIME','$StarTtimE','$VU_user_group')"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + ##### check to see if the user has a conf extension already, this happens if they previously exited uncleanly + $stmt="SELECT conf_exten FROM vicidial_conferences where extension='$SIP_user' and server_ip = '$server_ip' LIMIT 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $prev_login_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $prev_login_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + if ($prev_login_ct > 0) + {print "\n";} + else + { + ##### grab the next available vicidial_conference room and reserve it + $stmt="SELECT conf_exten FROM vicidial_conferences where server_ip = '$server_ip' and ((extension='') or (extension is null)) LIMIT 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $free_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $free_conf_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + $stmt="UPDATE vicidial_conferences set extension='$SIP_user' where server_ip='$server_ip' and conf_exten='$session_id';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + print "\n"; + + } + + $stmt="UPDATE vicidial_list set status='N', user='' where status IN('QUEUE','INCALL') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_hopper where status IN('QUEUE','INCALL','DONE') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_live_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_live_inbound_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + # print "You have logged in as user: $VD_login στο phone: $SIP_user στην εκστÏατεία: $VD_campaign
\n"; + $VICIDiaL_is_logged_in=1; + + ### set the callerID for manager middleware-app to connect the phone to the user + $SIqueryCID = "S$CIDdate$session_id"; + + ############################################# + ##### ΕÎΑΡΞΗ SYSTEM_SETTINGS LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,vicidial_agent_disable,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $vicidial_agent_disable = $row[6]; + $allow_sipsak_messages = $row[7]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_prefix = 'LIN-'; + print "\n"; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$VD_campaign\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + $SIqueryCID = "$SIPSAK_prefix$VD_campaign$DS$CIDdate"; + } + + ### insert a ÎΕΟ record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$SIqueryCID','Channel: $SIP_user','Context: $ext_context','Exten: $session_id','Priority: 1','Callerid: $SIqueryCID','','','','','');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($auto_dial_level > 0) + { + print "\n"; + + ##### grab the campaign_weight and number of calls today στο that campaign for the agent + $stmt="SELECT campaign_weight,calls_today FROM vicidial_campaign_agents where user='$VD_login' and campaign_id = '$VD_campaign';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vca_ct = mysql_num_rows($rslt); + if ($vca_ct > 0) + { + $row=mysql_fetch_row($rslt); + $campaign_weight = $row[0]; + $calls_today = $row[1]; + $i++; + } + else + { + $campaign_weight = '0'; + $calls_today = '0'; + $stmt="INSERT INTO vicidial_campaign_agents (user,campaign_id,campaign_rank,campaign_weight,calls_today) values('$VD_login','$VD_campaign','0','0','$calls_today');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + } + $closer_chooser_string=''; + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,user_level,campaign_weight,calls_today) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$closer_chooser_string','$user_level','$campaign_weight','$calls_today');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='$VD_campaign',agent='Agent/$VD_login',verb='AGENTLOGIN',data1='$VD_login@agents',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='ΠΑΥΣΗALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + mysql_close($linkB); + mysql_select_db("$VARDB_database", $link); + } + + + if ($campaign_allow_inbound == 'Y') + { + print "\n"; + } + } + else + { + print "\n"; + + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,user_level) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$user_level');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='$VD_campaign',agent='Agent/$VD_login',verb='AGENTLOGIN',data1='$VD_login@agents',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='ΠΑΥΣΗALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + mysql_close($linkB); + mysql_select_db("$VARDB_database", $link); + } + } + } + else + { + echo "χειÏιστής VICIΚΛΗΣΗ: VICIΚΛΗΣΗ ΣÏνδεση εκστÏατείας\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Ελληνικά
\n"; + echo "Συγγνώμη, δεν υπάÏχουν οδηγοί στον hopper για αυτήν την εκστÏατεία\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "ΣÏνδεση: \n
"; + echo "Κωδικός Ï€Ïόσβασης:
\n"; + echo "ΕκστÏατεία: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + if (strlen($session_id) < 1) + { + echo "χειÏιστής VICIΚΛΗΣΗ: VICIΚΛΗΣΗ ΣÏνδεση εκστÏατείας\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Ελληνικά
\n"; + echo "Sorry, there are no available sessions\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "ΣÏνδεση: \n
"; + echo "Κωδικός Ï€Ïόσβασης:
\n"; + echo "ΕκστÏατεία: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + if (ereg('MSIE',$browser)) + { + $useIE=1; + print "\n"; + } + else + { + $useIE=0; + print "\n"; + } + + $StarTtimE = date("U"); + $NOW_TIME = date("Y-m-d H:i:s"); + ##### Agent is going to log in so insert the vicidial_agent_log entry now + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group,sub_status) values('$VD_login','$server_ip','$NOW_TIME','$VD_campaign','$StarTtimE','0','$StarTtimE','$VU_user_group','LOGIN');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id($link); + print "\n"; + + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $server_ip_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S"; + + ##### grab the datails of all active scripts in the system + $stmt="SELECT script_id,script_name,script_text FROM vicidial_scripts WHERE active='Y' order by script_id limit 100;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $MM_scripts = mysql_num_rows($rslt); + $e=0; + while ($e < $MM_scripts) + { + $row=mysql_fetch_row($rslt); + $MMscriptid[$e] =$row[0]; + $MMscriptname[$e] = rawurlencode($row[1]); + $MMscripttext[$e] = rawurlencode($row[2]); + $MMscriptids = "$MMscriptids'$MMscriptid[$e]',"; + $MMscriptnames = "$MMscriptnames'$MMscriptname[$e]',"; + $MMscripttexts = "$MMscripttexts'$MMscripttext[$e]',"; + $e++; + } + $MMscriptids = substr("$MMscriptids", 0, -1); + $MMscriptnames = substr("$MMscriptnames", 0, -1); + $MMscripttexts = substr("$MMscripttexts", 0, -1); + + } +} + +################################################################ +### BEGIN - build the callback calendar (12 months) ### +################################################################ +define ('ADAY', (60*60*24)); +$CdayARY = getdate(); +$Cmon = $CdayARY['mon']; +$Cyear = $CdayARY['year']; +$CTODAY = date("Y-m"); +$CTODAYmday = date("j"); +$CINC=0; + +$Cmonths = Array('ΦεβÏουάÏιος','February','ΜάÏτιος','ΑπÏίλιος','Μάιος','ΙοÏνιος', + 'ΙοÏλιος','ΑÏγουστος','ΣεπτέμβÏιος','ΟκτώβÏιος','ÎοέμβÏιος','ΔεκέμβÏιος'); +$Cdays = Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); + +$CCAL_OUT = ''; + +$CCAL_OUT .= ""; + +while ($CINC < 12) +{ +if ( ($CINC == 0) || ($CINC == 4) ||($CINC == 8) ) + {$CCAL_OUT .= "";} + +$CCAL_OUT .= ""; + +if ( ($CINC == 3) || ($CINC == 7) ||($CINC == 11) ) + {$CCAL_OUT .= "";} +$CINC++; +} + +$CCAL_OUT .= "
"; + +$CYyear = $Cyear; +$Cmonth= ($Cmon + $CINC); +if ($Cmonth > 12) + { + $Cmonth = ($Cmonth - 12); + $CYyear++; + } +$Cstart= mktime(11,0,0,$Cmonth,1,$CYyear); +$CfirstdayARY = getdate($Cstart); +#echo "|$Cmon|$Cmonth|$CINC|\n"; +$CPRNTDAY = date("Y-m", $Cstart); + +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; + +foreach($Cdays as $Cday) +{ + $CDCLR="#ffffff"; +$CCAL_OUT .= ""; +} + +for( $Ccount=0;$Ccount<(6*7);$Ccount++) +{ + $Cdayarray = getdate($Cstart); + if((($Ccount) % 7) == 0) + { + if($Cdayarray['mon'] != $CfirstdayARY['mon']) + break; + $CCAL_OUT .= ""; + } + if($Ccount < $CfirstdayARY['wday'] || $Cdayarray['mon'] != $Cmonth) + { + $CCAL_OUT .= ""; + } + else + { + if( ($Cdayarray['mday'] == $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + else + { + $CDCLR="#ffffff"; + if ( ($Cdayarray['mday'] < $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CDCLR="#CCCCCC"; + $CBL = ''; + $CEL = ''; + } + else + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + } + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + } +} +$CCAL_OUT .= ""; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$CfirstdayARY[month] $CfirstdayARY[year]"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$Cday"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
 "; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; + +#echo "$CCAL_OUT\n"; +################################################################ +### END - build the callback calendar (12 months) ### +################################################################ + + +?> + + + + +\n"; + + +?> + +
+ + MARGINWIDTH=0 MARGINHEIGHT=0 LEFTMARGIN=0 TOPMARGIN=0 VALIGN=TOP ALIGN=LEFT> +
+ + + +ΑΠΟΣΥÎΔΕΣΗ\n"; ?> +
+
+ + + height=30> + + + + + +
VICIΚΛΗΣΗSCRIPT VALIGN=MIDDLE ALIGN=CENTER>   LIVE     ID εÏγασίας: ΕνεÏγή κλήση
+
+ + + + + height=>

VICIΚΛΗΣΗ
+
+ + +ΧΕΙΡ.ΚΛΗΣΗ       ΓΡΗΓΟΡΟΣ ΠΙÎΑΚΑΣ
+
+ + +X ΕÎΕΡΓΕΣ ΕΠΑÎΑΚΛΗΣΕΙΣ
+
+ + +
+
+ + + D1 - ΚΛΗΣΗ\n"; + echo "
\n"; + echo "D2 - ΚΛΗΣΗ\n"; + } + else {echo "
\n";} + ?> +

+
+
+ + + height=460>
ΕΠΑÎΑΚΛΗΣΕΙΣ ΓΙΑ ΤΟΠΧΕΙΡΙΣΤΗ :
Επιλέξτε μία επανάκληση παÏακάτω για να καλέσετε τον πελάτη τώÏα. Εάν επιλέξετε μία εγγÏαφή παÏακάτω, θα διαγÏαφεί από την λίστα. +
+
+
  + Ανανέωση +                 + ΕπιστÏοφή +
+
+ + + height=460>
ÎΕΑ ΧΕΙΡΟΚΙÎΗΤΗ ΚΛΗΣΗ ΟΔΗΓΟΥ ΓΙΑ :

ΚαταχωÏήστε τις πληÏοφοÏίες παÏακάτω για τον νέο οδηγό που επιθυμήτε να καλέσετε. +
+ \n"; + } + ?> + Note: all new manual dial leads will go into list

+ + + + + + + + + + + + + + + +
Κωδικός Κλήσης:   (Αυτό είναι συνήθως ένα 1 στις ΗΠΑ)
Τηλ Number: +   (12 digits max - digits only) +
Αναζήτηση Οδηγών:   (Η επιλογή αυτή επιτÏέπει να βÏει τον αÏιθμό στο σÏστημα Ï€ÏÎ¿Ï„Î¿Ï Î³Î¯Î½ÎµÎ¹ εισαγωγή ως νέος οδηγός)


Εάν θέλετε να καλέσετε έναν αÏιθμό και να μην Ï€Ïοστεθεί ως νέος οδηγός, καταχωÏήστε τον με την σωστή μοÏφή στο πεδίο Αγνόησε Κλήση παÏακάτω. Για να κλείσετε αυτή την κλήση θα Ï€Ïέπει να ανοίξετε το ΚΛΗΣΕΙΣ ΣΕ ΑΥΤΗ ΤΗΠΔΙΑΙΔΚΑΣΙΑ στο κάτω μέÏος της οθόνης και να την κλείσετε επιλέγοντας το κανάλι.
 
Αγνόησε Κλήση:   (παÏακαλώ μόνο ψηφία) +
+
+ Κάλεσε ΤώÏα +                 + ΕπιστÏοφή +
+
+ + + +
+
+ + + + +Your Κατάσταση:
Calls Dialing: +
+ + + + + > + +
+
+ + ΜεταφοÏά - διάσκεψη
+ + + ΤΟΠΙΚΟΣ CLOSER + Κλείσιμο ΓÏαμμής Xfer + Κλείσιμο και τις δÏο γÏαμμές + +
+ + ΑÏιθμός για κλήση   + + ΥπέÏβαση Κλήσης   + ΑΠΟΧΩΡΗΣΗ 3μελής ΚΛΗΣΗΣ + Τυφλή μεταφοÏά κλήσης + D1 + D2 + +
+ + δευτεÏόλεπτα   + channel + Κλήση με τον πελάτη + Στάθμευση κλήσης πελάτη + Blind Transfer VMail Message +
+
+
+
+ + + + height=70> + +
ΤεÏματισμό Καθοδήγησης όπως:

+ -
+
+
+ + + height=70> + + + + +
ΠλήκτÏα κλειδιά ΤεÏματισμοÏ: + Όταν είναι ενεÏγό, πιέστε απλά το πλήκτÏο κλειδί για τον επιθυμητό τεÏματισμό της κλήσης. Η κλήση θα Ï„Ïεματίσει αυτόματα:
+ + + + + +
+
+ + + height=70> + + + + + + +
ΠÏοηγοÏμενες πληÏοφοÏίες επανάκλησης: close
+
+
+
+
+ +
+
+ + + height=500>
Κανένας δεν είναι στη σÏνοδό σας:
+ ΕπιστÏοφή +

+ Ξανακάλεσε τον ΧειÏιστή +
+
+ + + height=500>
Ο πελάτης έχει κλείσει το τηλέφωνο:
+ ΕπιστÏοφή +

+ Τελείωσε και ΤεÏμάτισε την Κλήση + +
+
+ + + height=550>
Αναδίπλωση Κλήσης: απομÏνοντα δευτεÏόλεπτα σε αναδίπλωση

+ +

+ Τελείωμα Αναδίπλωσης και Συνέχεια + +
+
+ + + height=500>
Η σÏνοδός σας έχει τεθεί εκτός λειτουÏγίας
ΑΠΟΣΥÎΔΕΣΗ

ΕπιστÏοφή +
+
+ + + height=500>

ΑΠΟΣΥÎΔΕΣΗ
+
+ + +
+
+ + +
 
+
+ + + height=47>
Οποιεσδήποτε αλλαγές που γίνονται στις πληÏοφοÏίες πελατών κατωτέÏω αυτή τη στιγμή δεν θα είναι, Ï€Ïέπει να αλλάξετε τις πληÏοφοÏίες πελατών ενώπιον σας Hangup η κλήση.
+
+ + + height=460>
ΤεÏματισμός Κλήσης :       Ξανακλήσε       ελαχιστοποιήστε
+ Επιλογή τεÏÎ¼Î±Ï„Î¹ÏƒÎ¼Î¿Ï Ï„Î·Ï‚ κλήσης +
+ ΤΕΡΜΑΤΙΣΜΟΣ ΚΛΗΣΗΣ
+ ΕΠΑÎΑΦΟΡΑ | + ΥΠΟΒΑΛΕΤΕ +

+ WEB FORM ΥΠΟΒΑΛΕΤΕ +

  +
+
+ + + height=460>
ΕΠΙΛΕΞΤΕ έναν ΚΩΔΙΚΑ ΜΙΚΡΗΣ ΔΙΑΚΟΠΉΣ :
+ ΠαÏση Code Selection + +

  +
+
+ + + height=460>
Επιλέξτε μια ημεÏομηνία CallBack :
+ + + Επιλέξτε μια ημεÏομηνία κατωτέÏω   +     + Hour: +   + Minutes: +   + +  
+ ΜΟÎΟ ΤΗΠΕΠΑÎΑΚΛΗΣΗ ΜΟΥ
";} + ?> + Σχόλια CB:

+ + ΥΠΟΒΑΛΕΤΕ

+ +

  +
+
+ + + height=460>
CLOSER ΕΙΣΕΡΧΟΜΕÎΗ ΕΠΙΛΟΓΗ ΟΜΑΔΑΣ
+ Επιλογή Closer εισεÏχόμενης ομάδας +
+ ΣΥÎΔΥΑΣΜΕÎΗ ΚΛΗΣΗ(εξεÏχόμενες ενεÏγοποιημένες)
+ ΕΠΑÎΑΦΟΡΑ | + ΥΠΟΒΑΛΕΤΕ +



  +
+
+ + + + Κανάλι + Κανάλι + ΜΟÎΟ ΤΗΠΕΠΑÎΑΚΛΗΣΗ ΜΟΥ
";} + ?> +
+ + + + height=>
VICIΚΛΗΣΗ SCRIPT
+
+ + + 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> +ΠΛΗΚΤΡΑ ΚΛΕΙΔΙΑ ΑÎΕÎΕΡΓΑ + + + + +> + + + +
Έκδοση VICIΚΛΗΣΗ:     ΔΗΜΙΟΥΡΓΙΑ:               ΚεντÏικός υπολογιστής:              
+ΠαÏουσίαση πληÏοφοÏιών κλήσης ÎºÎ±Î½Î±Î»Î¹Î¿Ï Î´Î¹Î±ÏƒÎºÎ­ÏˆÎ·Ï‚

 
+
+ + + +
+
+ + + + + id="MainTable"> + + + + + + + + + + + + + + + +
ΚΑΤΑΣΤΑΣΗ:
+
+Κλήση επόμενου αÏιθμοÏ
+ ΠΡΟΒΟΛΗ ΟΔΗΓΟΥ
+ ΚΛΗΣΗ ENAΛ/ΚΟΥ ΤΗΛΕΦΩÎΟΥ
+ + +ΑΡΧΕΙΟ ΗΧΟΓΡ:
+
+
+ΤΑΥΤΟΤΗΤΑ ΕΓΓΡΑΦΗΣ:
+
+ +ΕναÏξη ηχογÏάφισης
+
+Σελίδα ΔιαδικτÏου
+
+Στάθμευση Κλήσης
+ΜεταφοÏά - διάσκεψη
+
+Κλείσιμο Πελάτη
+
+
Στείλε DTMF

+
+
+
align=left valign=top> + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
δευτεÏόλεπτα:   Κανάλι:   ΧÏόνος Πελάτη:
ΠληÏοφοÏίες Πελάτη:
Τίτλος:   ΠÏώτο:   Μσ:  Επίθετο:
ΔιεÏθυνση1:
ΔιεÏθυνση2:   ΔιεÏθυνση3:
Πόλη:   ΚÏάτος:   Ταχ.Κωδ.:
ΕπαÏχία:   ID Ï€ÏομηθευτοÏ:
Τηλ:   Κωδικός Κλήσης:   Εναλ/κό Τηλ:
ΠαÏουσίαση:   ΗλεκτÏονικό ταχυδÏομείο:
Σχολιάζει: + +\n";} +else + {echo "\n";} +?> + +
+
+ +
+
> + 
+ + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/voicemail_check.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/voicemail_check.php new file mode 100644 index 00000000..fb64e8a9 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_el/voicemail_check.php @@ -0,0 +1,140 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "\n"; +echo "\n"; +echo "\n"; +echo "Έλεγχος Ï†Ï‰Î½Î·Ï„Î¹ÎºÎ¿Ï Ï„Î±Ï‡Ï…Î´Ïομείου"; +echo "\n"; +echo "\n"; +echo "\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";} + $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";} + } + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/active_list_refresh.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/active_list_refresh.php new file mode 100644 index 00000000..7ea0bff0 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/active_list_refresh.php @@ -0,0 +1,482 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid 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 "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='table') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "List Display: "; +if ($ADD==1) {echo "Live Extensions";} +if ($ADD==2) {echo "Busy Extensions";} +if ($ADD==3) {echo "Outside Lines";} +if ($ADD==4) {echo "Local Extensions";} +if ($ADD==5) {echo "Conferences";} +if ($ADD==99999) {echo "HELP";} +echo "\n"; +echo "\n"; +echo "\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 "\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + +###################### +# ADD=2 display all busy extensions on a server +###################### +if ($ADD==2) +{ + if (!$field_name) {$field_name = 'busyext';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\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 "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=4 display all busy Local lines on a server +###################### +if ($ADD==4) +{ + if (!$field_name) {$field_name = 'local';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\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 "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='table') {echo "\n";} +if ($format=='table') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/astguiclient.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/astguiclient.php new file mode 100644 index 00000000..ac01f994 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/astguiclient.php @@ -0,0 +1,2905 @@ + LICENSE: GPLv2 +# +# make sure you have added a user to the vicidial_users MySQL table with at least +# user_level 1 or greater to access this page. Also you need to have the login +# and pass of a phone listed in the asterisk.phones table. The page grabs the +# server info and other details from this login and pass +# +# Other scripts that this application depends on: +# - active_list_refresh.php: displays active/live channels and phones +# - manager_send.php: sends Actions to be executed on Asterisk servers +# - live_exten_check.php: checks to see if user's phone is on a live call +# - call_log_display.php: retrieves log of inbound and outbound calls +# - voicemail_check.php: retrieves counts of new and old messages +# - inbound_popup.php: opens upon live_inbound call coming in +# - conf_exten_check.php: checks to see if and calls are in a specific conf +# - park_calls_display.php: retrieves list of parked calls +# - vdc_db_query.php: Changes values in the DB for non-calling records +# +# CHANGES +# 50215-1356 - Proof-of-concept test of XMLHttpRequest for astGUIclient web +# 50323-1411 - First build version display-only +# 50331-1040 - Second-build, added phone login and hangup/hijack display +# 50401-1006 - Trunk/Local Hangup functions enabled +# 50404-1056 - Trunk/Local Hijack functions enabled +# 50404-1459 - Simple live calls display and grabs updated time from server +# 50405-1221 - Reorganized the display and layers, added some images +# 50406-1005 - Added In/Out call log display to MAIN panel +# 50407-1254 - Start/Stop Recording on live calls enabled +# 50422-1101 - Activated Check Voicemail button and new/old messages count +# 50428-1449 - Added dial from log and basic live_inbound call popup +# 50429-1455 - Modified inbound popup code for IE and to add more functions +# 50502-1442 - Added basic method to transfer live calls somewhere else +# 50503-1205 - Added web_client_sessions entry for more security of subscripts +# 50503-1537 - Added basic conferences display +# 50509-1132 - Added conference connected list and hangup/xfer for them +# 50511-1129 - Added registration of conference rooms and added manual dial +# 50523-1342 - Added Conference recording and send DTMF +# 50523-1622 - Added Local Dial window frame for calling local extensions +# 50524-1456 - Added ability to park call and display number of parked calls +# 50524-1600 - Added ability to display and pickup/hangup/xfer parked calls +# 50525-1224 - Added ability to place outbound call from within conferene +# 50531-1225 - Added ability to do dual transfers to meetme rooms from Main +# 50711-1229 - removed HTTP authentication in favor of user/pass vars +# 50711-1610 - Added Zap monitoring to Trunk/Local Action screens +# 50804-1604 - Minor bug fix in inbound_popup functions +# 50818-1715 - Added pretty login section +# 50913-1137 - Added custom outbound_cid from phones table +# 51110-1430 - Fixed non-standard http port issue +# 60103-1421 - Added code for favorite extensions chooser +# 60104-1347 - Added basic layout for favorites editing frame +# 60105-1124 - Finished Favorites frame and added DB submission +# 60112-1622 - Several formatting changes +# 60421-1357 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1103 - Added variable filters to close security holes for login form +# 60829-1528 - Made compatible with WeBRooTWritablE setting in dbconnect.php +# + +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["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["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} + 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"];} + } + +$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++;} + +$version = '2.0.1'; +$build = '60829-1528'; + +### 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); + $user=ereg_replace("[^0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^0-9a-zA-Z]","",$pass); + + +if ($force_logout) +{ + if( (strlen($_SERVER['user'])>0) or (strlen($_SERVER['pass'])>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "You have now logged out. Thank you\n"; + exit; +} + +$StarTtime = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_TIME = date("Ymd-His"); + $month_old = mktime(0, 0, 0, date("m"), date("d")-7, date("Y")); + $past_month_date = date("Y-m-d H:i:s",$month_old); + + $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]; + +$US='_'; +$CL=':'; +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./astguiclient_auth_entries.txt", "a");} +$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 = $agcPAGE; +$agcDIR = eregi_replace('astguiclient.php','',$agcDIR); + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth) or ($relogin == 'YES') ) + { + header ("Content-type: text/html; charset=utf-8"); + + echo "astGUIclient web client: Login\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Español
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Login
 
User Login:
User Password:
Phone Login:
Phone Password:

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($user); + $password=strtoupper($pass); + $stmt="SELECT full_name,user_level from vicidial_users where user='$user' and pass='$pass'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + } + +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 +echo "\n"; +echo "\n"; +echo "\n"; + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "astGUIclient web client: Phone Login\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "
English Español
\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Phone Login
 
Phone Login:
Phone Password:

VERSION: $version       BUILD: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$authphone=$row[0]; +if (!$authphone) + { + echo "astGUIclient web client: Phone Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Español
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Phone Login
 
Sorry, your phone login and password are not active in this system, please try again:
 
Phone Login:
Phone Password:

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "astGUIclient web client\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $phone_login=$row[6]; + $phone_pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CaLLerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + $outbound_cid=$row[65]; + + $local_web_callerID_URL_enc = rawurlencode($local_web_callerID_URL); + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtime$US$session_ext$session_rand"; + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'agc';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','agc','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT count(*) from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_present=$row[0]; + if ($favorites_present > 0) + { + $stmt="SELECT extensions_list from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_list=$row[0]; + $h=0; + $favorites_listX = eregi_replace("'",'',$favorites_list); + $favorites = explode(',',$favorites_listX); + $favorites_count = count($favorites); + $favorites_listX=''; + + $o=0; + while ($favorites_count > $o) + { + $stmt="SELECT fullname,protocol from phones where extension = '$favorites[$o]' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $favorites_names[$o] = $rowx[0]; + $favorites_listX .= "$rowx[1]/$favorites[$o],"; + $o++; + } + + echo "\n"; + echo "\n"; + } + else + { + echo "\n"; + } + +### gather phone extensions and fullnames for favorites editor ### + $stmt="SELECT extension,fullname from phones where server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $exten_ct = mysql_num_rows($rslt); + $favlistCT=0; + $nofavlistCT=0; + while ($favlistCT < $exten_ct) + { + $row=mysql_fetch_row($rslt); + $favlist[$favlistCT]= "$row[0] - $row[1]"; + $favlistCT++; + } + + } +} + + +?> + + + + + + +\n"; + + +?> + +
+ + + + + + + + + +
+ + +LOGOUT
\n"; ?> +
Main PanelActive Lines PanelConferences PanelCheck VoicemailLive Call
+
+ + +

Logout
+
+ + +
TRUNK HANGUP

+ Active Trunks Menu
+ Hangup Trunk   |   + Hijack Trunk   |   + Listen Trunk   |   + Refresh   |   + Back to Main Window +
+
+ + +
LOCAL HANGUP

+ Active Local Menu
+ Hangup Local   |   + Hijack Local   |   + Listen Local   |   + Refresh   |   + Back to Main Window +
+
+ + + + + + + +
LIVE CALL TRANSFER
Channel to be transferred: Channel
Extensions:
Extensions Menu
+
+ Send to selected extension

+ Send to selected vmail box

+ Send to this number:


+ Refresh


+ Back to Main Window

+
Conferences:
(click on a number below to send to a conference)
Send my channel too
Conferences Menu
+
+ + + + + +
LOCAL Extensions Dial
Phone calling from: Channel
Extensions:
Extensions Menu
+
+ Call selected extension

+ Call selected vmail box

+ Refresh


+ Back to Main Window

+
+
+ + +
PARKED CALLS:
+ Back to Main Window

+
+
+ + + + + + + + + + + + + + + +
  +
VOICEMAIL     NEW:     OLD:             MANUAL DIAL       DIAL
PARKED CALLS: 0                LOCAL DIAL EXTENSIONS
OUTBOUND CALLS:
INBOUND CALLS:
astGUIclient web-client VERSION: BUILD:
+ + + + $h) + { + if (strlen($favorites[$h])>1) + { + echo "\n"; + } + $h++; + } +?> + +
FAVORITES       edit
$favorites[$h] - $favorites_names[$h]
 
+
+ + + + + + + +
FAVORITES

 
SUBMIT FAVORITES CHANGES - requires logout
BACK TO MAIN WINDOW - ignore changes made
+
+ +
+ + + + + + + + + + + + + +
+PAUSE | START     Refresh rate: 1000 ms Faster | Slower

+
Initializing..
+
Active Extensions
+REFRESH | +ORDER | +
Outside Lines
+REFRESH | +ORDER | +
Local Extensions
+REFRESH | +ORDER | +
+ Data Goes Here

+
+ Data Goes Here

Trunk Action +
+ Data Goes Here

Local Action +
+
+ + + + +
+ + +Conferences List + + + +
+Click on a conference room number on the left for info on that conference +
+ + + + + + + + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/call_log_display.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/call_log_display.php new file mode 100644 index 00000000..28d3ea87 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/call_log_display.php @@ -0,0 +1,196 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid 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 "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Call Log Display"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten is not valid or protocol $protocol is not valid\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";} + $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";} + $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"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/conf_exten_check.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/conf_exten_check.php new file mode 100644 index 00000000..ae3b84b5 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/conf_exten_check.php @@ -0,0 +1,297 @@ + LICENSE: GPLv2 +# +# 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 +# + +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"];} + +$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";} + +$version = '2.0.4-12'; +$build = '71122-0205'; +$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";} + $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 + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid 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 "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Conf Extension Check"; +echo "\n"; +echo "\n"; +echo "\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 not valid\n"; + exit; + } + else + { + + if ($client == 'vdc') + { + $Acount=0; + $AexternalDEAD=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); + $row=mysql_fetch_row($rslt); + $Acount=$row[0]; + + if ($Acount > 0) + { + $stmt="SELECT status from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Astatus=$row[0]; + } + # ### 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";} + $rslt=mysql_query($stmt, $link); + + if ($campagentstdisp == 'YES') + { + ### grab the status of this agent to display + $stmt="SELECT status,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Alogin=$row[0]; + $Acampaign=$row[1]; + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where server_ip='$server_ip' and status NOT IN('XFER') and campaign_id='$Acampaign';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $RingCalls=$row[0]; + } + else + { + $Alogin='N'; + $RingCalls='N'; + } + } + else + { + $Alogin='N'; + $RingCalls='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";} + $rslt=mysql_query($stmt, $link); + + } + + if ($Acount < 1) {$Alogin='DEAD_VLA';} + if ($AexternalDEAD > 0) {$Alogin='DEAD_EXTERNAL';} + + echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Status: ' . $Astatus . "|\n"; + + } + $total_conf=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + 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); + $ChannelA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $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++; $total_conf++; + $row=mysql_fetch_row($rslt); + $ChannelA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + } + $channels_list = ($channels_list + $sip_list); + echo "$channels_list|"; + + $counter=0; + $countecho=''; + while($total_conf > $counter) + { + $counter++; + $countecho = "$countecho$ChannelA[$counter] ~"; + # echo "$ChannelA[$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 not valid or Exten $exten is not valid\n"; + exit; + } + else + { + $stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + echo "Conference $conf_exten has been registered to $exten\n"; + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/dbconnect.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/dbconnect.php new file mode 100644 index 00000000..7221b35e --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/dbconnect.php @@ -0,0 +1,48 @@ + LICENSE: GPLv2 +# +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"); +mysql_select_db("$VARDB_database"); + +$local_DEF = 'Local/'; +$conf_silent_prefix = '7'; +$local_AMP = '@'; +$ext_context = 'demo'; +$recording_exten = '8309'; +$WeBRooTWritablE = '1'; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/inbound_popup.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/inbound_popup.php new file mode 100644 index 00000000..c92583de --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/inbound_popup.php @@ -0,0 +1,351 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid 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 "Invalid 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 "\n"; +echo "\n"; +echo "\n"; +?> + + +LIVE INBOUND CALL"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "

LIVE INBOUND CALL

\n"; +echo "$NOW_TIME

\n"; +} + + + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($uniqueid)<9) + { + $channel_live=0; + echo "Uniqueid $uniqueid is not valid\n"; + exit; + } + else + { + $stmt="SELECT * FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $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";} + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Channel: $row[1]
CallerID: $row[3]
\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 "GOOGLE - \n"; + echo "ANYWHO - \n"; + echo "SWITCHBOARD - \n"; + echo "VERIZON - \n"; + echo "WHITEPAGES - \n"; + echo "411.COM - \n"; + echo "411.COM - \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_Channel=$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 "CUSTOM - \n"; + + echo "
Number Dialed: $row[8]
Notes: $row[9]|$row[10]|$row[11]|$row[12]|$row[13]|
\n"; + echo "HANGUP - \n"; + echo "SEND TO MY VOICEMAIL\n"; + echo "
\n"; + + + $stmt="UPDATE live_inbound set acknowledged='Y' where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + + } + + + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/live_exten_check.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/live_exten_check.php new file mode 100644 index 00000000..3dadf572 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/live_exten_check.php @@ -0,0 +1,278 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid 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 "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Live Extension Check"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + +echo "DateTime: $NOW_TIME|"; +echo "UnixTime: $StarTtime|"; + +$stmt="SELECT count(*) FROM parked_channels where server_ip = '$server_ip';"; + if ($format=='debug') {echo "\n";} +$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 not valid or protocol $protocol is not valid\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";} + $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";} + } + } + + $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";} + $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 "ChannelA: $ChanneLA[$counter] ~"; + echo "ChannelB: $ChanneLB[$counter] ~"; + echo "ChannelBtrunk: $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";} + $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 "ChannelA: $ChanneLA[$counter] ~"; + echo "ChannelB: $ChanneLB[$counter] ~"; + echo "ChannelBtrunk: $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";} + $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 "ChannelA: $ChanneLA[$counter] ~"; + echo "ChannelB: $ChanneLB[$counter] ~"; + echo "ChannelBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel LIKE \"$ChanneLB[$counter]%\";"; + if ($format=='debug') {echo "\n";} + $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 "ChannelA: $ChanneLA[$counter] ~"; + echo "ChannelB: $ChanneLB[$counter] ~"; + echo "ChannelBtrunk: $row[0]|"; + } + else + { + echo "Conversation: $counter ~"; + echo "ChannelA: $ChanneLA[$counter] ~"; + echo "ChannelB: $ChanneLB[$counter] ~"; + echo "ChannelBtrunk: $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";} +$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";} + } + +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";} + $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";} + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/manager_send.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/manager_send.php new file mode 100644 index 00000000..94eff7b6 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/manager_send.php @@ -0,0 +1,1142 @@ + LICENSE: GPLv2 +# +# This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk 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: +# - $ACTION - ('Originate','Redirect','Hangup','Command','Monitor','StopMonitor','SysCIDOriginate','RedirectName','RedirectNameVmail','MonitorConf','StopMonitorConf','RedirectXtra','RedirectXtraCX','RedirectVD','HangupConfDial','VolumeControl','OriginateVDRelogin') +# - $queryCID - ('CN012345678901234567',...) +# - $format - ('text','debug') +# - $channel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +# - $exten - ('1234','913125551212',...) +# - $ext_context - ('default','demo',...) +# - $ext_priority - ('1','2',...) +# - $filename - ('20050406-125623_44444',...) +# - $extenName - ('phone100',...) +# - $parkedby - ('phone100',...) +# - $extrachannel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +# - $auto_dial_level - ('0','1','1.1',...) +# - $campaign - ('CLOSER','TESTCAMP',...) +# - $uniqueid - ('1120232758.2406800',...) +# - $lead_id - ('1234',...) +# - $seconds - ('32',...) +# - $outbound_cid - ('3125551212','0000000000',...) +# - $agent_log_id - ('123456',...) +# - $call_server_ip - ('10.10.10.15',...) +# - $CalLCID - ('VD01234567890123456',...) +# - $stage - ('UP','DOWN') +# + +# CHANGELOG: +# 50401-1002 - First build of script, Hangup function only +# 50404-1045 - Redirect basic function enabled +# 50406-1522 - Monitor basic function enabled +# 50407-1647 - Monitor and StopMonitor full functions enabled +# 50422-1120 - basic Originate function enabled +# 50428-1451 - basic SysCIDOriginate function enabled for checking voicemail +# 50502-1539 - basic RedirectName and RedirectNameVmail added +# 50503-1227 - added session_name checking for extra security +# 50523-1341 - added Conference call start/stop recording +# 50523-1421 - added OriginateName and OriginateNameVmail for local calls +# 50524-1602 - added RedirectToPark and RedirectFromPark +# 50531-1203 - added RedirecXtra for dual channel redirection +# 50630-1100 - script changed to not use HTTP login vars, user/pass instead +# 50804-1148 - Added RedirectVD for VICIDIAL blind redirection with logging +# 50815-1204 - Added NEXTAVAILABLE to RedirectXtra function +# 50903-2343 - Added HangupConfDial function to hangup in-dial channels in conf +# 50913-1057 - Added outbound_cid set if present to originate call +# 51020-1556 - Added agent_log_id framework for detailed agent activity logging +# 51118-1204 - Fixed Blind transfer bug from VICIDIAL when in manual dial mode +# 51129-1014 - Added ability to accept calls from other VICIDIAL servers +# 51129-1253 - Fixed Hangups of other agents channels in VICIDIAL AD +# 60310-2022 - Fixed NEXTAVAILABLE bug in leave-3way-call redirect function +# 60421-1413 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1158 - Added variable filters to close security holes for login form +# 60809-1544 - Added direct transfers to leave-3ways in consultative transfers +# 61004-1526 - Added parsing of volume control command and lookup or number +# 61130-1617 - Added lead_id to MonitorConf for recording_log +# 61201-1115 - Added user to MonitorConf for recording_log +# 70111-1600 - added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70226-1251 - Added Mute/UnMute to conference volume control +# 70320-1502 - Added option to allow retry of leave-3way-call and debug logging +# 70322-1636 - Added sipsak display ability +# + +require("dbconnect.php"); + +### These are variable assignments for PHP globals off +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["ACTION"])) {$ACTION=$_GET["ACTION"];} + elseif (isset($_POST["ACTION"])) {$ACTION=$_POST["ACTION"];} +if (isset($_GET["queryCID"])) {$queryCID=$_GET["queryCID"];} + elseif (isset($_POST["queryCID"])) {$queryCID=$_POST["queryCID"];} +if (isset($_GET["format"])) {$format=$_GET["format"];} + elseif (isset($_POST["format"])) {$format=$_POST["format"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["exten"])) {$exten=$_GET["exten"];} + elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];} +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["filename"])) {$filename=$_GET["filename"];} + elseif (isset($_POST["filename"])) {$filename=$_POST["filename"];} +if (isset($_GET["extenName"])) {$extenName=$_GET["extenName"];} + elseif (isset($_POST["extenName"])) {$extenName=$_POST["extenName"];} +if (isset($_GET["parkedby"])) {$parkedby=$_GET["parkedby"];} + elseif (isset($_POST["parkedby"])) {$parkedby=$_POST["parkedby"];} +if (isset($_GET["extrachannel"])) {$extrachannel=$_GET["extrachannel"];} + elseif (isset($_POST["extrachannel"])) {$extrachannel=$_POST["extrachannel"];} +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["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} + elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["secondS"])) {$secondS=$_GET["secondS"];} + elseif (isset($_POST["secondS"])) {$secondS=$_POST["secondS"];} +if (isset($_GET["outbound_cid"])) {$outbound_cid=$_GET["outbound_cid"];} + elseif (isset($_POST["outbound_cid"])) {$outbound_cid=$_POST["outbound_cid"];} +if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];} + elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];} +if (isset($_GET["call_server_ip"])) {$call_server_ip=$_GET["call_server_ip"];} + elseif (isset($_POST["call_server_ip"])) {$call_server_ip=$_POST["call_server_ip"];} +if (isset($_GET["CalLCID"])) {$CalLCID=$_GET["CalLCID"];} + elseif (isset($_POST["CalLCID"])) {$CalLCID=$_POST["CalLCID"];} +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["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} +if (isset($_GET["phone_ip"])) {$phone_ip=$_GET["phone_ip"];} + elseif (isset($_POST["phone_ip"])) {$phone_ip=$_POST["phone_ip"];} +if (isset($_GET["enable_sipsak_messages"])) {$enable_sipsak_messages=$_GET["enable_sipsak_messages"];} + elseif (isset($_POST["enable_sipsak_messages"])) {$enable_sipsak_messages=$_POST["enable_sipsak_messages"];} +if (isset($_GET["allow_sipsak_messages"])) {$allow_sipsak_messages=$_GET["allow_sipsak_messages"];} + elseif (isset($_POST["allow_sipsak_messages"])) {$allow_sipsak_messages=$_POST["allow_sipsak_messages"];} + +$user=ereg_replace("[^0-9a-zA-Z]","",$user); +$pass=ereg_replace("[^0-9a-zA-Z]","",$pass); +$secondS = ereg_replace("[^0-9]","",$secondS); + +# default optional vars if not set +if (!isset($ACTION)) {$ACTION="Originate";} +if (!isset($format)) {$format="alert";} +if (!isset($ext_priority)) {$ext_priority="1";} + +$version = '2.0.29'; +$build = '70320-1502'; +$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 "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid 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 "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Manager Send: "; +if ($ACTION=="Originate") {echo "Originate";} +if ($ACTION=="Redirect") {echo "Redirect";} +if ($ACTION=="RedirectName") {echo "RedirectName";} +if ($ACTION=="Hangup") {echo "Hangup";} +if ($ACTION=="Command") {echo "Command";} +if ($ACTION==99999) {echo "HELP";} +echo "\n"; +echo "\n"; +echo "\n"; +} + + + + + +###################### +# ACTION=SysCIDOriginate - insert Originate Manager statement allowing small CIDs for system calls +###################### +if ($ACTION=="SysCIDOriginate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<1) ) + { + echo "Exten $exten is not valid or queryCID $queryCID is not valid, Originate command not inserted\n"; + } + else + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate command sent for Exten $exten Channel $channel on $server_ip\n"; + } +} + + + +###################### +# ACTION=Originate, OriginateName, OriginateNameVmail - insert Originate Manager statement +###################### +if ($ACTION=="OriginateName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "extenName $extenName must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nOriginateName Action not sent\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="OriginateNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "extenName $extenName must be set\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nOriginateNameVmail Action not sent\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="OriginateVDRelogin") +{ + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $CIDdate = date("ymdHis"); + $DS='-'; + $SIPSAK_prefix = 'LIN-'; + print "\n"; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$campaign\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + $queryCID = "$SIPSAK_prefix$campaign$DS$CIDdate"; + + } + $ACTION="Originate"; +} + +if ($ACTION=="Originate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<10) ) + { + echo "Exten $exten is not valid or queryCID $queryCID is not valid, Originate command not inserted\n"; + } + else + { + if (strlen($outbound_cid)>1) + {$outCID = "\"$queryCID\" <$outbound_cid>";} + else + {$outCID = "$queryCID";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate command sent for Exten $exten Channel $channel on $server_ip\n"; + } +} + + + +###################### +# ACTION=HangupConfDial - find the Local channel that is in the conference and needs to be hung up +###################### +if ($ACTION=="HangupConfDial") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($queryCID)<15) or (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "conference $exten is not valid or ext_context $ext_context or queryCID $queryCID is not valid, Hangup command not inserted\n"; + } + else + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $hangup_channel_prefix = "$local_DEF$exten$local_AMP$ext_context"; + + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row > 0) + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $channel=$rowx[0]; + $ACTION="Hangup"; + $queryCID = eregi_replace("^.","G",$queryCID); + } + } +} + + + +###################### +# ACTION=Hangup - insert Hangup Manager statement +###################### +if ($ACTION=="Hangup") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) ) + { + $channel_live=0; + echo "Channel $channel is not valid or queryCID $queryCID is not valid, Hangup command not inserted\n"; + } + else + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + +# $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# if ($row[0]==0) +# { +# $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $rowx=mysql_fetch_row($rslt); +# if ($rowx[0]==0) +# { +# $channel_live=0; +# echo "Channel $channel is not live on $call_server_ip, Hangup command not inserted\n"; +# } +# } + if ( ($auto_dial_level > 0) and (strlen($CalLCID)>2) and (strlen($exten)>2) and ($secondS > 4)) + { + $stmt="SELECT count(*) FROM vicidial_auto_calls where channel='$channel' and callerid='$CalLCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + echo "Call $CalLCID $channel is not live on $call_server_ip, Checking Live Channel...\n"; + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel' and extension LIKE \"%$exten\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $channel_live=0; + echo "Channel $channel is not live on $call_server_ip, Hangup command not inserted $rowx[0]\n$stmt\n"; + } + else + { + echo "$stmt\n"; + } + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Hangup','$queryCID','Channel: $channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Hangup command sent for Channel $channel on $call_server_ip\n"; + } + } +} + + + +###################### +# ACTION=Redirect, RedirectName, RedirectNameVmail, RedirectToPark, RedirectFromPark, RedirectVD, RedirectXtra, RedirectXtraCX +# - insert Redirect Manager statement using extensions name +###################### +if ($ACTION=="RedirectVD") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($campaign)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($uniqueid)<2) or (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "auto_dial_level $auto_dial_level must be set\n"; + echo "campaign $campaign must be set\n"; + echo "uniqueid $uniqueid must be set\n"; + echo "lead_id $lead_id must be set\n"; + echo "\nRedirectVD Action not sent\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($auto_dial_level < 1) + { + $stmt = "UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectToPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($parkedby)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "extenName $extenName must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "parkedby $parkedby must be set\n"; + echo "\nRedirectToPark Action not sent\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "INSERT INTO parked_channels values('$channel','$server_ip','','$extenName','$parkedby','$NOW_TIME');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectFromPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirectFromPark Action not sent\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "DELETE FROM parked_channels where server_ip='$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "extenName $extenName must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirectName Action not sent\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "extenName $extenName must be set\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirectNameVmail Action not sent\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectXtraCX") +{ + $DBout=''; + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "ExtraChannel $extrachannel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirect Action not sent\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDCXC|$filename|$user|$campaign|$channel|$extrachannel|$queryCID|$exten|$ext_context|ext_priority|\n"); + fclose($fp); + } + } + } + else + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Channel $channel is not live on $call_server_ip, Redirect command not inserted\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel is not live on $call_server_ip";} + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Channel $channel is not live on $server_ip, Redirect command not inserted\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel is not live on $server_ip";} + } + } + if ( ($channel_liveX==1) && ($channel_liveY==1) ) + { + $stmt="SELECT count(*) FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0] < 1) + { + $channel_liveY=0; + echo "No Local agent to send call to, Redirect command not inserted\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "No Local agent to send call to";} + } + else + { + $stmt="SELECT server_ip,conf_exten,user FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $dest_server_ip = $rowx[0]; + $dest_session_id = $rowx[1]; + $dest_user = $rowx[2]; + $S='*'; + + $D_s_ip = explode('.', $dest_server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$dest_session_id$S$lead_id$S$dest_user$S$phone_code$S$phone_number$S$campaign$S"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','$queryCID','Channel: $extrachannel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtraCX command sent for Channel $channel on $call_server_ip and \nHungup $extrachannel on $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel on $call_server_ip, Hungup $extrachannel on $server_ip";} + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "Changed to Redirect: $channel on $server_ip";} + } + + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDCXC|$filename|$user|$campaign|$DBout|\n"); + fclose($fp); + } + } + + } +} + +if ($ACTION=="RedirectXtra") +{ + if ($channel=="$extrachannel") + {$ACTION="Redirect";} + else + { + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "ExtraChannel $extrachannel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirect Action not sent\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDX|$filename|$user|$campaign|$$channel|$extrachannel|$queryCID|$exten|$ext_context|ext_priority|\n"); + fclose($fp); + } + } + } + else + { + if ($exten == "NEXTAVAILABLE") + { + $stmt="SELECT conf_exten FROM conferences where server_ip='$server_ip' and ((extension='') or (extension is null)) limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if (strlen($row[0]) > 3) + { + $stmt="UPDATE conferences set extension='$user' where server_ip='$server_ip' and conf_exten='$row[0]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $exten = $row[0]; + } + else + { + $channel_liveX=0; + echo "Cannot find empty conference on $server_ip, Redirect command not inserted\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "Cannot find empty conference on $server_ip";} + } + } + + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Channel $channel is not live on $call_server_ip, Redirect command not inserted\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel is not live on $call_server_ip";} + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Channel $channel is not live on $server_ip, Redirect command not inserted\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel is not live on $server_ip";} + } + } + if ( ($channel_liveX==1) && ($channel_liveY==1) ) + { + if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','ExtraChannel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra command sent for Channel $channel and \nExtraChannel $extrachannel\n to $exten on $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel and $extrachannel to $exten on $server_ip";} + } + else + { + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$exten"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra command sent for Channel $channel on $call_server_ip and \nExtraChannel $extrachannel\n to $exten on $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel/$call_server_ip and $extrachannel/$server_ip to $exten";} + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + + } + + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDX|$filename|$user|$campaign|$DBout|\n"); + fclose($fp); + } + } + + } + } +} + + +if ($ACTION=="Redirect") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirect Action not sent\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Channel $channel is not live on $server_ip, Redirect command not inserted\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "Redirect command sent for Channel $channel on $server_ip\n"; + } + } +} + + + +###################### +# ACTION=Monitor or Stop Monitor - insert Monitor/StopMonitor Manager statement to start recording on a channel +###################### +if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) +{ + if ($ACTION=="StopMonitor") + {$SQLfile = "";} + else + {$SQLfile = "File: $filename";} + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Channel $channel is not valid or queryCID $queryCID is not valid or filename: $filename is not valid, $ACTION command not inserted\n"; + } + else + { + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Channel $channel is not live on $server_ip, $ACTION command not inserted\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','$ACTION','$queryCID','Channel: $channel','$SQLfile','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + if ($ACTION=="Monitor") + { + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + } + echo "$ACTION command sent for Channel $channel on $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n"; + } + } +} + + + + + + +###################### +# ACTION=MonitorConf or StopMonitorConf - insert Monitor/StopMonitor Manager statement to start recording on a conference +###################### +if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($channel)<4) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Channel $channel is not valid or exten $exten is not valid or filename: $filename is not valid, $ACTION command not inserted\n"; + } + else + { + + if ($ACTION=="MonitorConf") + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$filename','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $filename','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + # find and hang up all recordings going on in this conference # and extension = '$exten' + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$channel%\" and channel LIKE \"%,1\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + # $rec_count = intval(mysql_num_rows($rslt) / 2); + $rec_count = mysql_num_rows($rslt); + $h=0; + while ($rec_count>$h) + { + $rowx=mysql_fetch_row($rslt); + $HUchannel[$h] = $rowx[0]; + $h++; + } + $i=0; + while ($h>$i) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$i','Channel: $HUchannel[$i]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $i++; + } + + } + echo "$ACTION command sent for Channel $channel on $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n RECORDING WILL LAST UP TO 60 MINUTES\n"; + } +} + + + + + +###################### +# ACTION=VolumeControl - raise or lower the volume of a meetme participant +###################### +if ($ACTION=="VolumeControl") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($stage)<1) or (strlen($queryCID)<1) ) + { + echo "Conference $exten, Stage $stage is not valid or queryCID $queryCID is not valid, Originate command not inserted\n"; + } + else + { + $participant_number='XXYYXXYYXXYYXX'; + if (eregi('UP',$stage)) {$vol_prefix='4';} + if (eregi('DOWN',$stage)) {$vol_prefix='3';} + if (eregi('UNMUTE',$stage)) {$vol_prefix='2';} + if (eregi('MUTING',$stage)) {$vol_prefix='1';} + $local_DEF = 'Local/'; + $local_AMP = '@'; + $volume_local_channel = "$local_DEF$participant_number$vol_prefix$exten$local_AMP$ext_context"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $volume_local_channel','Context: $ext_context','Exten: 8300','Priority: 1','Callerid: $queryCID','','','','$channel','$exten');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Volume command sent for Conference $exten, Stage $stage Channel $channel on $server_ip\n"; + } +} + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='debug') {echo "\n";} +if ($format=='debug') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/park_calls_display.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/park_calls_display.php new file mode 100644 index 00000000..872f5780 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/park_calls_display.php @@ -0,0 +1,146 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) { + echo "Invalid server_ip: |$server_ip| or Invalid 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 "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Parked Calls Display"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten is not valid or protocol $protocol is not valid\n"; + exit; + } + else + { + ##### print parked calls from the parked_channels table + $stmt="SELECT * from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;"; + if ($format=='debug') {echo "\n";} + $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"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/vdc_db_query.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/vdc_db_query.php new file mode 100644 index 00000000..129af642 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/vdc_db_query.php @@ -0,0 +1,2535 @@ + LICENSE: GPLv2 +# +# 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 - ('regCLOSER','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCALL','manDiaLlogCALL','userLOGout','updateDISPO','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs','CalLBacKLisT','CalLBacKCounT','PauseCodeSubmit','LogiNCamPaigns') +# - $stage - ('start','finish','lookup','new') +# - $closer_choice - ('CL_TESTCAMP_L CL_OUT123_L -') +# - $conf_exten - ('8600011',...) +# - $exten - ('123test',...) +# - $ext_context - ('default','demo',...) +# - $ext_priority - ('1','2',...) +# - $campaign - ('testcamp',...) +# - $dial_timeout - ('60','26',...) +# - $dial_prefix - ('9','8',...) +# - $campaign_cid - ('3125551212','0000000000',...) +# - $MDnextCID - ('M06301413000000002',...) +# - $uniqueid - ('1120232758.2406800',...) +# - $lead_id - ('36524',...) +# - $list_id - ('101','123456',...) +# - $length_in_sec - ('12',...) +# - $phone_code - ('1',...) +# - $phone_number - ('3125551212',...) +# - $channel - ('Zap/12-1',...) +# - $start_epoch - ('1120236911',...) +# - $vendor_lead_code - ('1234test',...) +# - $title - ('Mr.',...) +# - $first_name - ('Bob',...) +# - $middle_initial - ('L',...) +# - $last_name - ('Wilson',...) +# - $address1 - ('1324 Main St.',...) +# - $address2 - ('Apt. 12',...) +# - $address3 - ('co Robert Wilson',...) +# - $city - ('Chicago',...) +# - $state - ('IL',...) +# - $province - ('NA',...) +# - $postal_code - ('60054',...) +# - $country_code - ('USA',...) +# - $gender - ('M',...) +# - $date_of_birth - ('1970-01-01',...) +# - $alt_phone - ('3125551213',...) +# - $email - ('bob@bob.com',...) +# - $security_phrase - ('Hello',...) +# - $comments - ('Good Customer',...) +# - $auto_dial_level - ('0','1','1.2',...) +# - $VDstop_rec_after_each_call - ('0','1') +# - $conf_silent_prefix - ('7','8','',...) +# - $extension - ('123','user123','25-1',...) +# - $protocol - ('Zap','SIP','IAX2',...) +# - $user_abb - ('1234','6666',...) +# - $preview - ('YES','NO',...) +# - $called_count - ('0','1','2',...) +# - $agent_log_id - ('123456',...) +# - $agent_log - ('NO',...) +# - $favorites_list - (",'cc160','cc100'",...) +# - $CallBackDatETimE - ('2006-04-21 14:30:00',...) +# - $recipient - ('ANYONE,'USERONLY') +# - $callback_id - ('12345','12346',...) +# - $use_internal_dnc - ('Y','N') +# - $omit_phone_code - ('Y','N') +# - $no_delete_sessions - ('0','1') + +# CHANGELOG: +# 50629-1044 - First build of script +# 50630-1422 - Added manual dial action and MD channel lookup +# 50701-1451 - Added dial log for start and end of vicidial calls +# 50705-1239 - Added call disposition update +# 50804-1627 - Fixed updateDispo to update vicidial_log entry +# 50816-1605 - Added VDADpause/ready for auto dialing +# 50816-1811 - Added basic autodial call pickup functions +# 50817-1005 - Altered logging functions to accomodate auto_dialing +# 50818-1305 - Added stop-all-recordings-after-each-vicidial-call option +# 50818-1411 - Added hangup of agent phone after Logout +# 50901-1315 - Fixed CLOSER IN-GROUP Web Form bug +# 50902-1507 - Fixed CLOSER log length_in_sec bug +# 50902-1730 - Added functions for manual preview dialing and revert +# 50913-1214 - Added agent random update to leadupdate +# 51020-1421 - Added agent_log_id framework for detailed agent activity logging +# 51021-1717 - Allows for multi-line comments (changes \n to !N in database) +# 51111-1046 - Added vicidial_agent_log lead_id earlier for manual dial +# 51121-1445 - Altered echo statements for several small PHP speed optimizations +# 51122-1328 - Fixed UserLogout issue not removing conference reservation +# 51129-1012 - Added ability to accept calls from other VICIDIAL servers +# 51129-1729 - Changed manual dial to use the '/n' flag for calls +# 51221-1154 - Added SCRIPT id lookup and sending to vicidial.php for display +# 60105-1059 - Added Updating of astguiclient favorites in the DB +# 60208-1617 - Added dtmf buttons output per call +# 60213-1521 - Added closer_campaigns update to vicidial_users +# 60215-1036 - Added Callback date-time entry into vicidial_callbacks table +# 60413-1541 - Added USERONLY Callback listings output - CalLBacKLisT +# - Added USERONLY Callback count output - CalLBacKCounT +# 60414-1140 - Added Callback lead lookup for manual dialing +# 60419-1517 - After CALLBK is sent to agent, update callback record to INACTIVE +# 60421-1419 - Check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60427-1236 - Fixed closer_choice error for CLOSER campaigns +# 60609-1148 - Added ability to check for manual dial numbers in DNC +# 60619-1117 - Added variable filters to close security holes for login form +# 60623-1414 - Fixed variable filter for phone_code and fixed manual dial logic +# 60821-1600 - Added ability to omit the phone code on vicidial lead dialing +# 60821-1647 - Added ability to not delete sessions at logout +# 60906-1124 - Added lookup and sending of callback data for CALLBK calls +# 61128-2229 - Added vicidial_live_agents and vicidial_auto_calls manual dial entries +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70115-1733 - Added alt_dial functionality in auto-dial modes +# 70118-1501 - Added user_group to vicidial_log,_agent_log,_closer_log,_callbacks +# 70123-1357 - Fixed bug that would not update vicidial_closer_log status to dispo +# 70202-1438 - Added pause code submit function +# 70203-0930 - Added dialed_number to lead info output +# 70203-1030 - Added dialed_label to lead info output +# 70206-1126 - Added INBOUND status for inbound/closer calls in vicidial_live_agents +# 70212-1253 - Fixed small issue with CXFER +# 70213-1431 - Added QueueMetrics PAUSE/UNPAUSE/AGENTLOGIN/AGENTLOGOFF actions +# 70214-1231 - Added queuemetrics_log_id field for server_id in queue_log +# 70215-1210 - Added queuemetrics COMPLETEAGENT action +# 70216-1051 - Fixed double call complete queuemetrics logging +# 70222-1616 - Changed queue_log PAUSE/UNPAUSE to PAUSEALL/UNPAUSEALL +# 70309-1034 - Allow amphersands and questions marks in comments to pass through +# 70313-1052 - Allow pound signs(hash) in comments to pass through +# 70319-1544 - Added agent disable update customer data function +# 70322-1545 - Added sipsak display ability +# 70413-1253 - Fixed bug for outbound call time in CLOSER-type blended campaigns +# 70424-1100 - Fixed bug for fronter/closer calls that would delete vdac records +# 70802-1729 - Fixed bugs with pause_sec and wait_sec under certain call handling +# 70828-1443 - Added source_id to output of SCRIPTtab-IFRAME and WEBFORM +# 71029-1855 - removed campaign_id naming restrictions for CLOSER-type campaigns +# 71030-2047 - added hopper priority for auto alt dial entries +# 71116-1011 - added calls_today count updating of the vicidial_live_agents upon INCALL +# 71120-1520 - added LogiNCamPaigns to show only allowed campaigns for agents upon login +# 71125-1751 - Added inbound-group default inbound group sending to vicidial.php +# 71129-2025 - restricted callbacks count and list to campaign only +# + +$version = '2.0.4-65'; +$build = '71129-2025'; + +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["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["closer_choice"])) {$closer_choice=$_GET["closer_choice"];} + elseif (isset($_POST["closer_choice"])) {$closer_choice=$_POST["closer_choice"];} +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["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["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["dial_timeout"])) {$dial_timeout=$_GET["dial_timeout"];} + elseif (isset($_POST["dial_timeout"])) {$dial_timeout=$_POST["dial_timeout"];} +if (isset($_GET["dial_prefix"])) {$dial_prefix=$_GET["dial_prefix"];} + elseif (isset($_POST["dial_prefix"])) {$dial_prefix=$_POST["dial_prefix"];} +if (isset($_GET["campaign_cid"])) {$campaign_cid=$_GET["campaign_cid"];} + elseif (isset($_POST["campaign_cid"])) {$campaign_cid=$_POST["campaign_cid"];} +if (isset($_GET["MDnextCID"])) {$MDnextCID=$_GET["MDnextCID"];} + elseif (isset($_POST["MDnextCID"])) {$MDnextCID=$_POST["MDnextCID"];} +if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} + elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["length_in_sec"])) {$length_in_sec=$_GET["length_in_sec"];} + elseif (isset($_POST["length_in_sec"])) {$length_in_sec=$_POST["length_in_sec"];} +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["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["start_epoch"])) {$start_epoch=$_GET["start_epoch"];} + elseif (isset($_POST["start_epoch"])) {$start_epoch=$_POST["start_epoch"];} +if (isset($_GET["dispo_choice"])) {$dispo_choice=$_GET["dispo_choice"];} + elseif (isset($_POST["dispo_choice"])) {$dispo_choice=$_POST["dispo_choice"];} +if (isset($_GET["vendor_lead_code"])) {$vendor_lead_code=$_GET["vendor_lead_code"];} + elseif (isset($_POST["vendor_lead_code"])) {$vendor_lead_code=$_POST["vendor_lead_code"];} +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["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["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_GET["VDstop_rec_after_each_call"];} + elseif (isset($_POST["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_POST["VDstop_rec_after_each_call"];} +if (isset($_GET["conf_silent_prefix"])) {$conf_silent_prefix=$_GET["conf_silent_prefix"];} + elseif (isset($_POST["conf_silent_prefix"])) {$conf_silent_prefix=$_POST["conf_silent_prefix"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} +if (isset($_GET["user_abb"])) {$user_abb=$_GET["user_abb"];} + elseif (isset($_POST["user_abb"])) {$user_abb=$_POST["user_abb"];} +if (isset($_GET["preview"])) {$preview=$_GET["preview"];} + elseif (isset($_POST["preview"])) {$preview=$_POST["preview"];} +if (isset($_GET["called_count"])) {$called_count=$_GET["called_count"];} + elseif (isset($_POST["called_count"])) {$called_count=$_POST["called_count"];} +if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];} + elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];} +if (isset($_GET["agent_log"])) {$agent_log=$_GET["agent_log"];} + elseif (isset($_POST["agent_log"])) {$agent_log=$_POST["agent_log"];} +if (isset($_GET["favorites_list"])) {$favorites_list=$_GET["favorites_list"];} + elseif (isset($_POST["favorites_list"])) {$favorites_list=$_POST["favorites_list"];} +if (isset($_GET["CallBackDatETimE"])) {$CallBackDatETimE=$_GET["CallBackDatETimE"];} + elseif (isset($_POST["CallBackDatETimE"])) {$CallBackDatETimE=$_POST["CallBackDatETimE"];} +if (isset($_GET["recipient"])) {$recipient=$_GET["recipient"];} + elseif (isset($_POST["recipient"])) {$recipient=$_POST["recipient"];} +if (isset($_GET["callback_id"])) {$callback_id=$_GET["callback_id"];} + elseif (isset($_POST["callback_id"])) {$callback_id=$_POST["callback_id"];} +if (isset($_GET["use_internal_dnc"])) {$use_internal_dnc=$_GET["use_internal_dnc"];} + elseif (isset($_POST["use_internal_dnc"])) {$use_internal_dnc=$_POST["use_internal_dnc"];} +if (isset($_GET["omit_phone_code"])) {$omit_phone_code=$_GET["omit_phone_code"];} + elseif (isset($_POST["omit_phone_code"])) {$omit_phone_code=$_POST["omit_phone_code"];} +if (isset($_GET["phone_ip"])) {$phone_ip=$_GET["phone_ip"];} + elseif (isset($_POST["phone_ip"])) {$phone_ip=$_POST["phone_ip"];} +if (isset($_GET["enable_sipsak_messages"])) {$enable_sipsak_messages=$_GET["enable_sipsak_messages"];} + elseif (isset($_POST["enable_sipsak_messages"])) {$enable_sipsak_messages=$_POST["enable_sipsak_messages"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} + + +$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); + + +# default optional vars if not set +if (!isset($format)) {$format="text";} + if ($format == 'debug') {$DB=1;} +if (!isset($ACTION)) {$ACTION="refresh";} + +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$CIDdate = date("mdHis"); +$ENTRYdate = date("YmdHis"); +if (!isset($query_date)) {$query_date = $NOW_DATE;} +$MT[0]=''; +$agents='@agents'; + +if ($ACTION == 'LogiNCamPaigns') + { + $skip_user_validation=1; + } +else + { + $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 "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid 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 "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } +} + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDiaL Database Query Script"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + +################################################################################ +### LogiNCamPaigns - generates an HTML SELECT list of allowed campaigns for a +### specific agent on the login screen +################################################################################ +if ($ACTION == 'LogiNCamPaigns') +{ + if ( (strlen($user)<1) ) + { + echo "\n"; + exit; + } + else + { + echo "\n"; + exit; + } +} + + + +################################################################################ +### regCLOSER - update the vicidial_live_agents table to reflect the closer +### inbound choices made upon login +################################################################################ +if ($ACTION == 'regCLOSER') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($closer_choice)<1) || (strlen($user)<1) ) + { + $channel_live=0; + echo "Group Choice $closer_choice is not valid\n"; + exit; + } + else + { + if ($closer_choice == "MGRLOCK-") + { + $stmt="SELECT closer_campaigns FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $closer_choice =$row[0]; + + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_users set closer_campaigns='$closer_choice' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $in_groups_pre = preg_replace('/-$/','',$closer_choice); + $in_groups = explode(" ",$in_groups_pre); + $in_groups_ct = count($in_groups); + $k=1; + while ($k < $in_groups_ct) + { + if (strlen($in_groups[$k])>1) + { + $stmt="SELECT group_weight,calls_today FROM vicidial_inbound_group_agents where user='$user' and group_id='$in_groups[$k]';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $viga_ct = mysql_num_rows($rslt); + if ($viga_ct > 0) + { + $row=mysql_fetch_row($rslt); + $group_weight = $row[0]; + $calls_today = $row[1]; + } + else + { + $group_weight = 0; + $calls_today = 0; + } + $stmt="INSERT INTO vicidial_live_inbound_agents set user='$user',group_id='$in_groups[$k]',group_weight='$group_weight',calls_today='$calls_today',last_call_time='$NOW_TIME',last_call_finish='$NOW_TIME';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + $k++; + } + + } + echo "Closer In Group Choice $closer_choice has been registered to user $user\n"; +} + + +################################################################################ +### manDiaLnextCALL - for manual VICIDiaL dialing this will grab the next lead +### in the campaign, reserve it, send data back to client and +### place the call by inserting into vicidial_manager +################################################################################ +if ($ACTION == 'manDiaLnextCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "HOPPER EMPTY\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context is not valid\n"; + exit; + } + else + { + + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### check if this is a callback, if it is, skip the grabbing of a new lead and mark the callback as INACTIVE + if ( (strlen($callback_id)>0) and (strlen($lead_id)>0) ) + { + $affected_rows=1; + $CBleadIDset=1; + + $stmt = "UPDATE vicidial_callbacks set status='INACTIVE' where callback_id='$callback_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + if (strlen($phone_number)>3) + { + if ($use_internal_dnc=='Y') + { + $stmt="SELECT count(*) FROM vicidial_dnc where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + echo "DNC NUMBER\n"; + exit; + } + } + if ($stage=='lookup') + { + $stmt="SELECT lead_id FROM vicidial_list where phone_number='$phone_number' order by modify_date desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $man_leadID_ct = mysql_num_rows($rslt); + if ($man_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $affected_rows=1; + $lead_id =$row[0]; + $CBleadIDset=1; + } + else + { + ### insert a new lead in the system with this phone number + $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $lead_id = mysql_insert_id($link); + $CBleadIDset=1; + } + } + else + { + ### insert a new lead in the system with this phone number + $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $lead_id = mysql_insert_id($link); + $CBleadIDset=1; + } + } + else + { + ### grab the next lead in the hopper for this campaign and reserve it for the user + $stmt = "UPDATE vicidial_hopper set status='QUEUE', user='$user' where campaign_id='$campaign' and status='READY' order by hopper_id LIMIT 1"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + } + } + + if ($affected_rows > 0) + { + if (!$CBleadIDset) + { + ##### grab the lead_id of the reserved user in vicidial_hopper + $stmt="SELECT lead_id FROM vicidial_hopper where campaign_id='$campaign' and status='QUEUE' and user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $hopper_leadID_ct = mysql_num_rows($rslt); + if ($hopper_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + } + } + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $source_id = trim("$row[6]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + $called_count++; + + ##### check if system is set to generate logfile for transfers + $stmt="SELECT enable_agc_xfer_log FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enable_agc_xfer_log_ct = mysql_num_rows($rslt); + if ($enable_agc_xfer_log_ct > 0) + { + $row=mysql_fetch_row($rslt); + $enable_agc_xfer_log =$row[0]; + } + + if ( ($WeBRooTWritablE > 0) and ($enable_agc_xfer_log > 0) ) + { + # DATETIME|campaign|lead_id|phone_number|user|type + # 2007-08-22 11:11:11|TESTCAMP|65432|3125551212|1234|M + $fp = fopen ("./xfer_log.txt", "a"); + fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$phone_number|$user|M\n"); + fclose($fp); + } + + ##### if lead is a callback, grab the callback comments + $CBentry_time = ''; + $CBcallback_time = ''; + $CBuser = ''; + $CBcomments = ''; + if (ereg("CALLBK",$dispo)) + { + $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBentry_time = trim("$row[0]"); + $CBcallback_time = trim("$row[1]"); + $CBuser = trim("$row[2]"); + $CBcomments = trim("$row[3]"); + } + } + + ### flag the lead as called and change it's status to INCALL + $stmt = "UPDATE vicidial_list set status='INCALL', called_since_last_reset='Y', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + if (!$CBleadIDset) + { + ### delete the lead from the hopper + $stmt = "DELETE FROM vicidial_hopper where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $stmt="UPDATE vicidial_agent_log set lead_id='$lead_id',comments='MANUAL' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + ### if preview dialing, do not send the call + if ( (strlen($preview)<1) || ($preview == 'NO') ) + { + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### whether to omit phone_code or not + if (eregi('Y',$omit_phone_code)) + {$Ndialstring = "$Local_out_prefix$phone_number";} + else + {$Ndialstring = "$Local_out_prefix$phone_code$phone_number";} + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$server_ip','$campaign','XFER','$lead_id','$MqueryCID','$phone_code','$phone_number','$NOW_TIME','OUT')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',callerid='$MqueryCID',lead_id='$lead_id',comments='MANUAL',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update calls_today count in vicidial_campaign_agents + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $MqueryCID . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + $LeaD_InfO .= $CBentry_time . "\n"; + $LeaD_InfO .= $CBcallback_time . "\n"; + $LeaD_InfO .= $CBuser . "\n"; + $LeaD_InfO .= $CBcomments . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= "MAIN\n"; + $LeaD_InfO .= $source_id . "\n"; + + echo $LeaD_InfO; + + } + else + { + echo "HOPPER EMPTY\n"; + } + } +} + + +################################################################################ +### manDiaLskip - for manual VICIDiaL dialing this skips the lead that was +### previewed in the step above and puts it back in orig status +################################################################################ +if ($ACTION == 'manDiaLskip') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($stage)<1) || (strlen($called_count)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "LEAD NOT REVERTED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context is not valid\n"; + exit; + } + else + { + $called_count = ($called_count - 1); + ### flag the lead as called and change it's status to INCALL + $stmt = "UPDATE vicidial_list set status='$stage', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + + echo "LEAD REVERTED\n"; + } +} + + +################################################################################ +### manDiaLonly - for manual VICIDiaL dialing this sends the call that was +### previewed in the step above +################################################################################ +if ($ACTION == 'manDiaLonly') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) || (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo " CALL NOT PLACED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context is not valid\n"; + exit; + } + else + { + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### whether to omit phone_code or not + if (eregi('Y',$omit_phone_code)) + {$Ndialstring = "$Local_out_prefix$phone_number";} + else + {$Ndialstring = "$Local_out_prefix$phone_code$phone_number";} + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$server_ip','$campaign','XFER','$lead_id','$MqueryCID','$phone_code','$phone_number','$NOW_TIME','OUT')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',callerid='$MqueryCID',lead_id='$lead_id',comments='MANUAL',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + echo "$MqueryCID\n"; + } +} + + +################################################################################ +### manDiaLlookCALL - for manual VICIDiaL dialing this will attempt to look up +### the trunk channel that the call was placed on +################################################################################ +if ($ACTION == 'manDiaLlookCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; +if (strlen($MDnextCID)<18) + { + echo "NO\n"; + echo "MDnextCID $MDnextCID is not valid\n"; + exit; + } +else + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT uniqueid,channel FROM vicidial_manager where callerid='$MDnextCID' and server_ip='$server_ip' and status='UPDATED' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $uniqueid =$row[0]; + $channel =$row[1]; + echo "$uniqueid\n$channel"; + + $wait_sec=0; + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',wait_epoch='$StarTtime',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + echo "NO\n"; + } + } +} + + + +################################################################################ +### manDiaLlogCALL - for manual VICIDiaL logging of calls places record in +### vicidial_log and then sends process to call_log entry +################################################################################ +if ($ACTION == 'manDiaLlogCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + +if ($stage == "start") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) || (strlen($list_id)<1) || (strlen($phone_number)<1) || (strlen($campaign)<1) ) + { + echo "LOG NOT ENTERED\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id or list_id: $list_id or phone_number: $phone_number or campaign: $campaign is not valid\n"; + exit; + } + else + { + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + ##### insert log into vicidial_log for manual VICIDiaL call + $stmt="INSERT INTO vicidial_log (uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,comments,processed,user_group) values('$uniqueid','$lead_id','$list_id','$campaign','$NOW_TIME','$StarTtime','INCALL','$phone_code','$phone_number','$user','MANUAL','N','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "VICIDiaL_LOG Inserted: $uniqueid|$channel|$NOW_TIME\n"; + echo "$StarTtime\n"; + } + else + { + echo "LOG NOT ENTERED\n"; + } + + $stmt = "UPDATE vicidial_auto_calls SET uniqueid='$uniqueid' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + # ##### insert log into call_log for manual VICIDiaL call + # $stmt = "INSERT INTO call_log (uniqueid,channel,server_ip,extension,number_dialed,caller_code,start_time,start_epoch) values('$uniqueid','$channel','$server_ip','$exten','$phone_code$phone_number','MD $user $lead_id','$NOW_TIME','$StarTtime')"; + # if ($DB) {echo "$stmt\n";} + # $rslt=mysql_query($stmt, $link); + # $affected_rows = mysql_affected_rows($link); + + # if ($affected_rows > 0) + # { + # echo "CALL_LOG Inserted: $uniqueid|$channel|$NOW_TIME"; + # } + # else + # { + # echo "LOG NOT ENTERED\n"; + # } + } + } + +if ($stage == "end") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) ) + { + echo "LOG NOT ENTERED\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id is not valid\n"; + exit; + } + else + { + if ($start_epoch < 1000) + { + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + ##### look for the start epoch in the vicidial_closer_log table + $stmt="SELECT start_epoch FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user' order by closecallid desc limit 1;"; + } + else + { + ##### look for the start epoch in the vicidial_log table + $stmt="SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + } + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch =$row[0]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($length_in_sec < 1) and ($row[0] > 0) ) + { + ##### start epoch in the vicidial_log table, couldn't find one in vicidial_closer_log + $stmt="SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch =$row[0]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + } + } + else {$length_in_sec = ($StarTtime - $start_epoch);} + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec',status='DONE' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + + if ($auto_dial_level > 0) + { + ### check to see if campaign has alt_dial enabled + $stmt="SELECT auto_alt_dial FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_alt_dial =$row[0]; + } + else {$auto_alt_dial = 'NONE';} + if (eregi("(ALT_ONLY|ADDR3_ONLY|ALT_AND_ADDR3)",$auto_alt_dial)) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT alt_dial FROM vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alt_dial =$row[0]; + } + else {$alt_dial = 'NONE';} + + if ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("(ALT_ONLY|ALT_AND_ADDR3)",$auto_alt_dial)) ) + { + $stmt="SELECT alt_phone,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alt_phone = $row[0]; + $alt_phone = eregi_replace("[^0-9]","",$alt_phone); + $gmt_offset_now = $row[1]; + $state = $row[2]; + } + else {$alt_phone = '';} + if (strlen($alt_phone)>5) + { + ### insert record into vicidial_hopper for alt_phone call attempt + $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ALT',user='',priority='25';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + } + if ( ( (eregi("(ALT)",$alt_dial)) and (eregi("ALT_AND_ADDR3",$auto_alt_dial)) ) or ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("ADDR3_ONLY",$auto_alt_dial)) ) ) + { + $stmt="SELECT address3,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $address3 = $row[0]; + $address3 = eregi_replace("[^0-9]","",$address3); + $gmt_offset_now = $row[1]; + $state = $row[2]; + } + else {$address3 = '';} + if (strlen($address3)>5) + { + ### insert record into vicidial_hopper for address3 call attempt + $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ADDR3',user='',priority='20';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + + if ($enable_queuemetrics_logging > 0) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_qm_ct = mysql_num_rows($rslt); + if ($VAC_qm_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_call_id = $row[0]; + $CLlead_id = $row[1]; + $CLphone_number = $row[2]; + $CLstatus = $row[3]; + $CLcampaign_id = $row[4]; + $CLphone_code = $row[5]; + $CLalt_dial = $row[6]; + $CLstage = $row[7]; + $CLcallerid = $row[8]; + $CLuniqueid = $row[9]; + } + + $CLstage = preg_replace("/.*-/",'',$CLstage); + if (strlen($CLstage) < 1) {$CLstage=0;} + + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt="SELECT count(*) from queue_log where call_id='$MDnextCID' and verb='COMPLETECALLER';"; + $rslt=mysql_query($stmt, $linkB); + if ($DB) {echo "$stmt\n";} + $VAC_cc_ct = mysql_num_rows($rslt); + if ($VAC_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $caller_complete = $row[0]; + } + + if ($caller_complete < 1) + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + } + mysql_close($linkB); + } + + ### delete call record from vicidial_auto_calls + $stmt = "DELETE from vicidial_auto_calls where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + + + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',lead_id='',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } + else + { + if ($enable_queuemetrics_logging > 0) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_qm_ct = mysql_num_rows($rslt); + if ($VAC_qm_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_call_id = $row[0]; + $CLlead_id = $row[1]; + $CLphone_number = $row[2]; + $CLstatus = $row[3]; + $CLcampaign_id = $row[4]; + $CLphone_code = $row[5]; + $CLalt_dial = $row[6]; + $CLstage = $row[7]; + $CLcallerid = $row[8]; + $CLuniqueid = $row[9]; + } + + $CLstage = preg_replace("/XFER|-/",'',$CLstage); + if ($CLstage < 0.25) {$CLstage=0;} + + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + + $stmt = "DELETE from vicidial_auto_calls lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',lead_id='',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } + + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' where uniqueid='$uniqueid' and lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "$uniqueid\n$channel\n"; + } + else + { + echo "LOG NOT ENTERED\n\n"; + } + } + + echo $VDstop_rec_after_each_call . '|' . $extension . '|' . $conf_silent_prefix . '|' . $conf_exten . '|' . $user_abb . "|\n"; + + ##### if VICIDiaL call and hangup_after_each_call activated, find all recording + ##### channels and hang them up while entering info into recording_log and + ##### returning filename/recordingID + if ($VDstop_rec_after_each_call == 1) + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $total_rec=0; + $loop_count=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten' order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$rec_list = mysql_num_rows($rslt);} + while ($rec_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + if (preg_match("/Local\/$conf_silent_prefix$conf_exten\@/i",$row[0])) + { + $rec_channels[$total_rec] = "$row[0]"; + $total_rec++; + } + if ($format=='debug') {echo "\n";} + $loop_count++; + } + + $total_recFN=0; + $loop_count=0; + $filename=$MT; # not necessary : and cmd_line_f LIKE \"%_$user_abb\" + $stmt="SELECT cmd_line_f FROM vicidial_manager where server_ip='$server_ip' and action='Originate' and cmd_line_b = 'Channel: $local_DEF$conf_silent_prefix$conf_exten$local_AMP$ext_context' order by entry_date desc limit $total_rec;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$recFN_list = mysql_num_rows($rslt);} + while ($recFN_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + $filename[$total_recFN] = preg_replace("/Callerid: /i","",$row[0]); + if ($format=='debug') {echo "\n";} + $total_recFN++; + $loop_count++; + } + + $loop_count=0; + while($loop_count < $total_rec) + { + if (strlen($rec_channels[$loop_count])>5) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$loop_count','Channel: $rec_channels[$loop_count]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "REC_STOP|$rec_channels[$loop_count]|$filename[$loop_count]|"; + if (strlen($filename)>2) + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename[$loop_count]'"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$fn_count = mysql_num_rows($rslt);} + if ($fn_count) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt="UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename[$loop_count]' and end_epoch is NULL;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "$recording_id|$length_in_min|"; + } + else {echo "||";} + } + else {echo "||";} + echo "\n"; + } + $loop_count++; + } + } + + + $talk_sec=0; + $StarTtime = date("U"); + $stmt = "select talk_epoch,talk_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $talk_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set talk_sec='$talk_sec',talk_epoch='$StarTtime',dispo_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } +} + + +################################################################################ +### VDADREcheckINCOMING - for auto-dial VICIDiaL dialing this will recheck for +### calls to see if the channel has updated +################################################################################ +if ($ACTION == 'VDADREcheckINCOMING') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "Campaign $campaign is not valid\n"; + echo "lead_id $lead_id is not valid\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + } + } +} + + +################################################################################ +### VDADcheckINCOMING - for auto-dial VICIDiaL dialing this will check for calls +### in the vicidial_live_agents table in QUEUE status, then +### lookup the lead info and pass it back to vicidial.php +################################################################################ +if ($ACTION == 'VDADcheckINCOMING') +{ + $Ctype = 'A'; + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "Campaign $campaign is not valid\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and status='QUEUE';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',comments='AUTO',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $source_id = trim("$row[6]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + ##### if lead is a callback, grab the callback comments + $CBentry_time = ''; + $CBcallback_time = ''; + $CBuser = ''; + $CBcomments = ''; + if (ereg("CALLBK",$dispo)) + { + $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBentry_time = trim("$row[0]"); + $CBcallback_time = trim("$row[1]"); + $CBuser = trim("$row[2]"); + $CBcomments = trim("$row[3]"); + } + } + + ### update the lead status to INCALL + $stmt = "UPDATE vicidial_list set status='INCALL', user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the log status to INCALL + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + $stmt = "UPDATE vicidial_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL', user_group='$user_group' where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + ### update the vicidial_closer_log user to INCALL + $stmt = "UPDATE vicidial_closer_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL', user_group='$user_group' where lead_id='$lead_id' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select campaign_id,phone_number,alt_dial from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($VDAC_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDADchannel_group =$row[0]; + $dialed_number =$row[1]; + $dialed_label =$row[2]; + } + else + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|INBND|$callerid|$user|$user_group|$list_id|$lead_id|$phone_number|$uniqueid|\n"); + fclose($fp); + } + } + + $stmt = "select count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDL_cid_ct = mysql_num_rows($rslt); + if ($VDL_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_front_VDlog =$row[0]; + } + + $stmt = "select * from vicidial_inbound_groups where group_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_group_name = $row[1]; + $VDCL_group_color = $row[2]; + $VDCL_group_web = $row[4]; + $VDCL_fronter_display = $row[7]; + $VDCL_ingroup_script = $row[8]; + $VDCL_get_call_launch = $row[9]; + $VDCL_xferconf_a_dtmf = $row[10]; + $VDCL_xferconf_a_number = $row[11]; + $VDCL_xferconf_b_dtmf = $row[12]; + $VDCL_xferconf_b_number = $row[13]; + $VDCL_default_xfer_group= $row[28]; + + ### update the comments in vicidial_live_agents record + $stmt = "UPDATE vicidial_live_agents set comments='INBOUND' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $Ctype = 'I'; + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_ingroup_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + } + + ### if web form is set then send on to vicidial.php for override of WEB_FORM address + if ( (strlen($VDCL_group_web)>5) or (strlen($VDCL_group_name)>0) ) {echo "$VDCL_group_web|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|\n";} + else {echo "|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|\n";} + + $stmt = "SELECT full_name from vicidial_users where user='$tsr';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDU_cid_ct = mysql_num_rows($rslt); + if ($VDU_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $fronter_full_name = $row[0]; + echo $fronter_full_name . '|' . $tsr . "\n"; + } + else {echo '|' . $tsr . "\n";} + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_campaign_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + echo "|||||$VDCL_campaign_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n|\n"; + + $stmt = "select phone_number,alt_dial from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($VDAC_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dialed_number =$row[0]; + $dialed_label =$row[1]; + } + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $callerid . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + $LeaD_InfO .= $CBentry_time . "\n"; + $LeaD_InfO .= $CBcallback_time . "\n"; + $LeaD_InfO .= $CBuser . "\n"; + $LeaD_InfO .= $CBcomments . "\n"; + $LeaD_InfO .= $dialed_number . "\n"; + $LeaD_InfO .= $dialed_label . "\n"; + $LeaD_InfO .= $source_id . "\n"; + + echo $LeaD_InfO; + + + + $wait_sec=0; + $StarTtime = date("U"); + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + ### If CALLBK, change vicidial_callback record to INACTIVE + if (eregi("CALLBK|CBHOLD", $dispo)) + { + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='$lead_id' and status NOT IN('INACTIVE','DEAD','ARCHIVE');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + ##### check if system is set to generate logfile for transfers + $stmt="SELECT enable_agc_xfer_log FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enable_agc_xfer_log_ct = mysql_num_rows($rslt); + if ($enable_agc_xfer_log_ct > 0) + { + $row=mysql_fetch_row($rslt); + $enable_agc_xfer_log =$row[0]; + } + + if ( ($WeBRooTWritablE > 0) and ($enable_agc_xfer_log > 0) ) + { + # DATETIME|campaign|lead_id|phone_number|user|type + # 2007-08-22 11:11:11|TESTCAMP|65432|3125551212|1234|A + $fp = fopen ("./xfer_log.txt", "a"); + fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$phone_number|$user|$Ctype\n"); + fclose($fp); + } + + } + else + { + echo "0\n"; + # echo "No calls in QUEUE for $user on $server_ip\n"; + exit; + } + } +} + + +################################################################################ +### userLOGout - Logs the user out of VICIDiaL client, deleting db records and +### inserting into vicidial_user_log +################################################################################ +if ($ACTION == 'userLOGout') +{ + $MT[0]=''; + $row=''; $rowx=''; +if ( (strlen($campaign)<1) || (strlen($conf_exten)<1) ) + { + echo "NO\n"; + echo "campaign $campaign or conf_exten $conf_exten is not valid\n"; + exit; + } +else + { + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + ##### Insert a LOGOUT record into the user log + $stmt="INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$user','LOGOUT','$campaign','$NOW_TIME','$StarTtime','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vul_insert = mysql_affected_rows($link); + + if ($no_delete_sessions < 1) + { + ##### Remove the reservation on the vicidial_conferences meetme room + $stmt="UPDATE vicidial_conferences set extension='' where server_ip='$server_ip' and conf_exten='$conf_exten';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vc_remove = mysql_affected_rows($link); + } + + ##### Delete the vicidial_live_agents record for this session + $stmt="DELETE from vicidial_live_agents where server_ip='$server_ip' and user ='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vla_delete = mysql_affected_rows($link); + + ##### Delete the vicidial_live_inbound_agents records for this session + $stmt="DELETE from vicidial_live_inbound_agents where user ='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vlia_delete = mysql_affected_rows($link); + + ##### Delete the web_client_sessions + $stmt="DELETE from web_client_sessions where server_ip='$server_ip' and session_name ='$session_name';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $wcs_delete = mysql_affected_rows($link); + + ##### Hangup the client phone + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$extension%\" order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) + { + $row=mysql_fetch_row($rslt); + $agent_channel = "$row[0]"; + if ($format=='debug') {echo "\n";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','ULGH3459$StarTtime','Channel: $agent_channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $pause_sec=0; + $stmt = "select pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ( ($VDpr_ct > 0) and (strlen($row[3]<5)) and (strlen($row[4]<5)) ) + { + $row=mysql_fetch_row($rslt); + $pause_sec = (($StarTtime - $row[0]) + $row[1]); + + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + if ($vla_delete > 0) + { + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $allow_sipsak_messages = $row[6]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_message = 'LOGGED OUT'; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_message\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + } + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + # $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='PAUSE',serverid='1';"; + # if ($DB) {echo "$stmt\n";} + # if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + # $rslt=mysql_query($stmt, $linkB); + # $affected_rows = mysql_affected_rows($linkB); + + $stmt = "SELECT time_id FROM queue_log where agent='Agent/$user' and verb='AGENTLOGIN' order by time_id desc limit 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + if ($DB) {echo "$stmt\n";} + echo "$stmt\n"; + $li_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $li_conf_ct) + { + $row=mysql_fetch_row($rslt); + $logintime = $row[0]; + $i++; + } + + $time_logged_in = ($StarTtime - $logintime); + if ($time_logged_in > 1000000) {$time_logged_in=1;} + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='AGENTLOGOFF',data1='$user$agents',data2='$time_logged_in',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + + echo "$vul_insert|$vc_remove|$vla_delete|$wcs_delete|$agent_channel|$vlia_delete\n"; + } +} + + +################################################################################ +### updateDISPO - update the vicidial_list table to reflect the agent choice of +### call disposition for that leand +################################################################################ +if ($ACTION == 'updateDISPO') +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($dispo_choice)<1) || (strlen($lead_id)<1) ) + { + echo "Dispo Choice $dispo or lead_id $lead_id is not valid\n"; + exit; + } + else + { + $stmt="UPDATE vicidial_list set status='$dispo_choice', user='$user' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by uniqueid desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + if ( ($use_internal_dnc=='Y') and ($dispo_choice=='DNC') ) + { + $stmt = "select phone_number from vicidial_list where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $stmt="INSERT INTO vicidial_dnc (phone_number) values('$row[0]');"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + } + } + + $dispo_sec=0; + $StarTtime = date("U"); + $stmt = "select dispo_epoch,dispo_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dispo_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set dispo_sec='$dispo_sec',dispo_epoch='$StarTtime',status='$dispo_choice' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id($link); + + ### CALLBACK ENTRY + if ( ($dispo_choice == 'CBHOLD') and (strlen($CallBackDatETimE)>10) ) + { + $stmt="INSERT INTO vicidial_callbacks (lead_id,list_id,campaign_id,status,entry_time,callback_time,user,recipient,comments,user_group) values('$lead_id','$list_id','$campaign','ACTIVE','$NOW_TIME','$CallBackDatETimE','$user','$recipient','$comments','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $stmt="SELECT auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ( ($auto_dial_level > 0) and (ereg(" $dispo_choice ",$row[0])) ) + { + $stmt = "select count(*) from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + $stmt="UPDATE vicidial_hopper set status='READY' where lead_id='$lead_id' and status='HOLD' limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + else + { + $stmt="DELETE from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='CALLSTATUS',data1='$dispo_choice',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + + echo 'Lead ' . $lead_id . ' has been changed to ' . $dispo_choice . " Status\nNext agent_log_id:\n" . $agent_log_id . "\n"; +} + +################################################################################ +### updateLEAD - update the vicidial_list table to reflect the values that are +### in the agents screen at time of call hangup +################################################################################ +if ($ACTION == 'updateLEAD') +{ + $MT[0]=''; + $row=''; $rowx=''; + $DO_NOT_UPDATE=0; + $DO_NOT_UPDATE_text=''; + if ( (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + echo "phone_number $phone_number or lead_id $lead_id is not valid\n"; + exit; + } + else + { + + $stmt = "SELECT disable_alter_custdata FROM vicidial_campaigns where campaign_id='$campaign'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $dac_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $dac_conf_ct) + { + $row=mysql_fetch_row($rslt); + $disable_alter_custdata = $row[0]; + $i++; + } + if (ereg('Y',$disable_alter_custdata)) + { + $DO_NOT_UPDATE=1; + $DO_NOT_UPDATE_text=' NOT'; + $stmt = "SELECT alter_custdata_override FROM vicidial_users where user='$user'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $aco_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $aco_conf_ct) + { + $row=mysql_fetch_row($rslt); + $alter_custdata_override = $row[0]; + $i++; + } + if (ereg('ALLOW_ALTER',$alter_custdata_override)) + { + $DO_NOT_UPDATE=0; + $DO_NOT_UPDATE_text=''; + } + } + + if ($DO_NOT_UPDATE < 1) + { + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + $comments = eregi_replace("--AMP--",'&',$comments); + $comments = eregi_replace("--QUES--",'?',$comments); + $comments = eregi_replace("--POUND--",'#',$comments); + + $stmt="UPDATE vicidial_list set vendor_lead_code='" . mysql_real_escape_string($vendor_lead_code) . "', title='" . mysql_real_escape_string($title) . "', first_name='" . mysql_real_escape_string($first_name) . "', middle_initial='" . mysql_real_escape_string($middle_initial) . "', last_name='" . mysql_real_escape_string($last_name) . "', address1='" . mysql_real_escape_string($address1) . "', address2='" . mysql_real_escape_string($address2) . "', address3='" . mysql_real_escape_string($address3) . "', city='" . mysql_real_escape_string($city) . "', state='" . mysql_real_escape_string($state) . "', province='" . mysql_real_escape_string($province) . "', postal_code='" . mysql_real_escape_string($postal_code) . "', country_code='" . mysql_real_escape_string($country_code) . "', gender='" . mysql_real_escape_string($gender) . "', date_of_birth='" . mysql_real_escape_string($date_of_birth) . "', alt_phone='" . mysql_real_escape_string($alt_phone) . "', email='" . mysql_real_escape_string($email) . "', security_phrase='" . mysql_real_escape_string($security_phrase) . "', comments='" . mysql_real_escape_string($comments) . "' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } + echo "Lead $lead_id information has$DO_NOT_UPDATE_text been updated\n"; +} + + +################################################################################ +### VDADpause - update the vicidial_live_agents table to show that the agent is +### or ready now active and ready to take calls +################################################################################ +if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($stage)<2) || (strlen($server_ip)<1) ) + { + echo "stage $stage is not valid\n"; + exit; + } + else + { + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set lead_id='',uniqueid=0,callerid='',channel='', random_id='$random',comments='' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_live_agents set status='$stage' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + if (ereg('READY',$stage)) {$QMstatus='UNPAUSEALL';} + if (ereg('PAUSE',$stage)) {$QMstatus='PAUSEALL';} + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='$QMstatus',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + + if ($agent_log == 'NO') + {$donothing=1;} + else + { + $pause_sec=0; + $stmt = "select pause_epoch,pause_sec,wait_epoch,wait_sec,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec=0; + if ($row[2] > 0) + { + $wait_sec = (($StarTtime - $row[2]) + $row[3]); + } + if ( (eregi("NULL",$row[4])) or ($row[4] < 1000) ) + {$pause_sec = (($StarTtime - $row[0]) + $row[1]);} + else + {$pause_sec = (($row[4] - $row[0]) + $row[1]);} + + } + if ($ACTION == 'VDADready') + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($ACTION == 'VDADpause') + { + $stmt="UPDATE vicidial_agent_log set pause_epoch='$StarTtime',wait_sec='$wait_sec' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + echo 'Agent ' . $user . ' is now in status ' . $stage . "\n"; +} + + +################################################################################ +### UpdatEFavoritEs - update the astguiclient favorites list for this extension +################################################################################ +if ($ACTION == 'UpdatEFavoritEs') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($favorites_list)<1) || (strlen($user)<1) || (strlen($exten)<1) ) + { + echo "favorites list $favorites_list is not valid\n"; + exit; + } + else + { + $stmt = "select count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + $stmt="UPDATE phone_favorites set extensions_list=\"$favorites_list\" where extension='$exten' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="INSERT INTO phone_favorites values('$exten','$server_ip',\"$favorites_list\");"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + echo "Favorites list has been updated to $favorites_list for $exten\n"; +} + + +################################################################################ +### PauseCodeSubmit - Update vicidial_agent_log with pause code +################################################################################ +if ($ACTION == 'PauseCodeSubmit') +{ + $row=''; $rowx=''; + if ( (strlen($status)<1) || (strlen($agent_log_id)<1) ) + { + echo "agent_log_id $agent_log_id or pause_code $status is not valid\n"; + exit; + } + else + { + $stmt="UPDATE vicidial_agent_log set sub_status=\"$status\" where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $allow_sipsak_messages = $row[6]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_prefix = 'BK-'; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$status\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + } + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='PAUSEREASON',serverid='$queuemetrics_log_id',data1='$status';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } +echo "Pause Code has been updated to $status for $agent_log_id\n"; +} + + +################################################################################ +### CalLBacKLisT - List the USERONLY callbacks for an agent +################################################################################ +if ($ACTION == 'CalLBacKLisT') +{ +$stmt = "select callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' and campaign_id='$campaign' and status NOT IN('INACTIVE','DEAD') order by callback_time;"; +if ($DB) {echo "$stmt\n";} +$rslt=mysql_query($stmt, $link); +if ($rslt) {$callbacks_count = mysql_num_rows($rslt);} +echo "$callbacks_count\n"; +$loop_count=0; + while ($callbacks_count>$loop_count) + { + $row=mysql_fetch_row($rslt); + $callback_id[$loop_count] = $row[0]; + $lead_id[$loop_count] = $row[1]; + $campaign_id[$loop_count] = $row[2]; + $status[$loop_count] = $row[3]; + $entry_time[$loop_count] = $row[4]; + $callback_time[$loop_count] = $row[5]; + $comments[$loop_count] = $row[6]; + $loop_count++; + } +$loop_count=0; + while ($callbacks_count>$loop_count) + { + $stmt = "select first_name,last_name,phone_number from vicidial_list where lead_id='$lead_id[$loop_count]';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count]\n"; + $loop_count++; + } + +} + + +################################################################################ +### CalLBacKCounT - send the count of the USERONLY callbacks for an agent +################################################################################ +if ($ACTION == 'CalLBacKCounT') +{ +$stmt = "select count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' and campaign_id='$campaign' and status NOT IN('INACTIVE','DEAD');"; +if ($DB) {echo "$stmt\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$cbcount=$row[0]; + +echo "$cbcount"; +} + + + + +if ($format=='debug') +{ +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +echo "\n"; +echo "\n\n\n"; +} + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/vicidial.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/vicidial.php new file mode 100644 index 00000000..21a2c4e6 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/vicidial.php @@ -0,0 +1,6797 @@ + LICENSE: GPLv2 +# +# make sure you have added a user to the vicidial_users MySQL table with at least +# user_level 1 or greater to access this page. Also, you need to have the login +# and pass of a phone listed in the asterisk.phones table. The page grabs the +# server info and other details from this login and pass. +# +# This script works best with Firefox or Mozilla, but will run for a couple +# hours on Internet Explorer before the memory leaks cause a crash. +# +# Other scripts that this application depends on: +# - vdc_db_query.php: Updates information in the database +# - manager_send.php: Sends manager actions to the DB for execution +# +# CHANGELOG +# 50607-1426 - First Build of VICIDIAL web client basic login process finished +# 50628-1620 - Added some basic formatting and worked on process flow +# 50628-1715 - Startup variables mapped to javascript variables +# 50629-1303 - Added Login Closer in-groups selection box and vla update +# 50629-1530 - Rough layout for customer info form section and button links +# 50630-1453 - Rough Manual Dial/Hangup with customer info displayed +# 50701-1450 - Added vicidial_log entries on dial and hangup +# 50701-1634 - Added Logout function +# 50705-1259 - Added call disposition functionality +# 50705-1432 - Added lead info DB update function +# 50705-1658 - Added web form functionality +# 50706-1043 - Added call park and pickup functions +# 50706-1234 - Added Start/Stop Recording functionality +# 50706-1614 - Added conference channels display option +# 50711-1333 - Removed call check redundancy and fixed a span bug +# 50727-1424 - Added customer channel and participant present sensing/alerts +# 50804-1057 - Added SendDTMF function and reconfigured the transfer span +# 50804-1224 - Added Local and Internal Closer transfer functions +# 50804-1628 - Added Blind transfer, activated LIVE CALL image and fixed bugs +# 50804-1808 - Added button images for left buttons +# 50815-1151 - Added 3Way calling functions to Transfer-conf frame +# 50815-1602 - Added images and buttons for xfer functions +# 50816-1813 - Added basic autodial outbound call pickup functions +# 50817-1113 - Fixes to auto_dialing call receipt +# 50817-1234 - Added inbound call receipt capability +# 50817-1541 - Added customer time display +# 50817-1541 - Added customer time display +# 50818-1327 - Added stop-all-recordings-after-each-vicidial-call option +# 50818-1703 - Added pretty login section +# 50825-1200 - Modified form field lengths, added double-click dispositions +# 50831-1603 - Fixed customer time bug and fronter display bug for CLOSER +# 50901-1314 - Fixed CLOSER IN-GROUP Web Form bug +# 50903-0904 - Added preview-lead code for manual dialing +# 50904-0016 - Added ability to hangup manual dials before pickup +# 50906-1319 - Added override for filters on xfer calls, fixed login display bug +# 50909-1243 - Added hotkeys functionality for quick dispoing in auto-dial mode +# 50912-0958 - Modified hotkeys function, agent must have user_level >= 5 to use +# 50913-1212 - Added campaign_cid to 3rd party calls +# 50923-1546 - Modified to work with language translation +# 50926-1656 - Added campaign pull-down at login of active campaigns +# 50928-1633 - Added manual dial alternate number dial option +# 50930-1538 - Added session_id empty login failure and fixed 2 minor bugs +# 51004-1656 - Fixed recording filename bug and new Spanish translation +# 51020-1103 - Added campaign-specific recording control abilities +# 51020-1352 - Added Basic vicidial_agent_log framework +# 51021-1050 - Fixed custtime display and disable Enter/Return keypresses +# 51021-1718 - Allows for multi-line comments (changes \n to !N in database) +# 51110-1432 - Fixed non-standard http port issue +# 51111-1047 - Added vicidial_agent_log lead_id earlier for manual dial +# 51118-1305 - Activate multi-line comments from $multi_line_comments var +# 51118-1313 - Move Transfer DIV to a floating span to preserve 800x600 view +# 51121-1506 - Small PHP optimizations in many scripts and disabled globalize +# 51129-1010 - Added ability to accept calls from other VICIDIAL servers +# 51129-1254 - Fixed Hangups of other agents channels when customer hangs up +# 51208-1732 - Created user-first login that looks for default phone info +# 51219-1526 - Added variable framework for campaign and in-group scripts +# 51221-1200 - Added SCRIPT tab, layout and functionality +# 51221-1714 - Added auto-switch-to-SCRIPT-tab and auto-webform-popup +# 51222-1605 - Added VMail message blind transfer button to xfer-conf frame +# 51229-1028 - Added checks on web_form_address to allow for var in the DB value +# 60117-1312 - Added Transfer-conf frame toggle on button press +# 60208-1152 - Added DTMF-xfernumber preset links to xfer-conf frame +# 60213-1129 - Added vicidial_users.hotkeys_active for any user hotkeys +# 60213-1210 - Added ability to sort routing of calls by user_level +# 60214-0932 - Initial Callback calendar display framework +# 60214-1407 - Added ability to minimize the dispo screen to see info below +# 60215-1104 - Added ANYONE scheduled callbacks functionality +# 60410-1116 - Added persistant pause after dispo option and change dispo text +# - Added web form submit that opens new window with dispo on submit +# - Added PREVIOUS CALLBACK in customer info to flag callbacks +# - Added link to try to hangup the call again in the dispo screen +# - Added link noone-in-session screen to call agent phone again +# - Added link customer-hungup screen to go straight to dispo screen +# 60410-1532 - Added agent status and campaign calls dialing display option +# 60411-1547 - Add ability to set callback as USERONLY and some basic formatting +# 60413-1752 - Add basic USERONLY callback frame and listings +# 60414-1039 - Changed manual dial preview and alt dial checkboxes to spans +# - Added beta-level USERONLY callback functionality +# - Added beta-level manual dialing with lead insertion functionality +# 60415-1534 - Fixed manual dial lead preview and fixed manuald dial override bug +# 60417-1108 - Added capability to do alt-number-dialing in auto-dial mode +# - Changed several permissions to database-defined +# 60419-1529 - Prevent manual dial or callbacks when alt-dial lead not finished +# 60420-1647 - Fixed DiaLDiaLAltPhonE error, Call Agent Again DialControl error +# 60421-1229 - Check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60424-1005 - Fixed Alt phone disabled bug for callbacks and manual dials +# 60426-1058 - Added vicidial_user setting for default blended check for CLOSER +# 60501-1008 - Added option to manual dial screen to manually lookup phone number +# 60503-1653 - Fixed agentonly_callback not-defined bug in scheduled callbacks screen +# 60504-1032 - Fixed manual dial display bug and transfer dispo alert bug +# - Fixed recording filename display to not overrun 25 characters +# 60510-1051 - Added Wrapup timer and wrapup message on wrapup screen after dispo +# 60608-1453 - Added CLOSER campaign allowable in-groups limitations +# 60609-1123 - Added add-number-to-DNC-list function and manual dial check DNC +# 60619-1047 - Added variable filters to close security holes for login form +# 60804-1710 - fixed scheduled CALLBK for other languages build +# 60808-1145 - Added consultative transfers with customer data +# 60808-2232 - Added campaign name to pulldown for login screen +# 60809-1603 - Added option to locally transfer consult xfers +# 60809-1732 - Added recheck of transferred channels before customer gone mesg +# 60810-1011 - Fixed CXFER leave 3way call bugs +# 60816-1602 - Added ALLCALLS recording delay option allcalls_delay +# 60816-1716 - Fixed customer time display bug and client DST setting +# 60821-1555 - Added option to omit phone_code on dialout of leads +# 60821-1628 - Added ALLFORCE recording option +# 60821-1643 - Added no_delete_sessions option to not delete sessions +# 60822-0512 - Changed phone number fields to be maxlength of 12 +# 60829-1531 - Made compatible with WeBRooTWritablE setting in dbconnect.php +# 60906-1152 - Added Previous CallBack info display span +# 60906-1715 - Allow for Local phone extension conferences +# 61004-1729 - Add ability to control volume per channel in "calls in this session" +# 61122-1341 - Added vicidial_user_groups allowed_campaigns restrictions +# 61122-1523 - Added more SCRIPT variables +# 61128-2229 - Added vicidial_live_agents and vicidial_auto_calls manual dial entries +# 61130-1617 - Added lead_id to MonitorConf for recording_log +# 61221-1212 - Changed width to 760 to better fit 800x600 screens, widened SCRIPT +# 70109-1128 - Fixed wrapup timer bug +# 70109-1635 - Added option for HotKeys automatically dialing next number in manual mode +# - Added option for alternate number dialing with hotkeys +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70118-1517 - Added vicidial_agent_log and vicidial_user_log logging of user_group +# 70201-1249 - Added FAST DIAL option for manually dialing, added UTF8 compatible code +# 70201-1703 - Fixed cursor bug for most text input fields +# 70202-1453 - Added first portions of Agent Pause Codes +# 70203-0108 - Finished Agent Pause Codes functionality +# 70203-0930 - Added dialed_number to webform output +# 70203-1010 - Added dialed_label to webform output +# 70206-1201 - Fixed allow_closers bug +# 70206-1332 - Added vicidial_recording_override users setting function +# 70212-1252 - Fixed small issue with CXFER +# 70213-1018 - Changed CXFER and AXFER to update customer information before transfer +# 70214-1233 - Added queuemetrics_log_id field for server_id in queue_log +# 70215-1240 - Added queuemetrics_log_id field for server_id in queue_log +# 70222-1617 - Changed queue_log PAUSE/UNPAUSE to PAUSEALL/UNPAUSEALL +# 70226-1252 - Added Mute/UnMute to agent screen +# 70309-1035 - Allow amphersands and questions marks in comments to pass through +# 70313-1052 - Allow pound signs(hash) in comments to pass through +# 70316-1406 - Moved the MUTE button to be accessible during a transfer/conf +# 70319-1446 - Added agent-deactive-display and disable customer info update functions +# 70319-1626 - Added option to allow agent logins to campaigns with no leads in the hopper +# 70320-1501 - Added option to allow retry of leave-3way-call from dispo screen +# 70322-1545 - Added sipsak display ability +# 70510-1319 - Added onUnload force Logout +# 70806-1530 - Added Presets Dial links above agent mute button +# 70823-2118 - Fixed XMLHTTPRequest, HotKeys and Scheduled Callbacks issues with MSIE +# 70828-1443 - Added source_id to output of SCRIPTtab-IFRAME and WEBFORM +# 71022-1427 - Added formatting of the customer phone number in the main status bar +# 71029-1848 - Changed CLOSER-type campaign to not use campaign_id restrictions +# 71101-1204 - Fixed bug in callback calendar with DST +# 71116-0957 - Added campaign_weight and calls_today to the vla table insertion +# 71120-1719 - Added XMLHTPRequest lookup of allowable campaigns for agents during login +# 71122-0256 - Added auto-pause notification +# 71125-1751 - Changed Transfer section to allow for selection of in-groups to send calls to +# 71127-0408 - Added height and width settings for easier modification of screen size +# 71129-2025 - restricted callbacks count and list to campaign only +# + +$version = '2.0.4-142'; +$build = '71129-2025'; + +require("dbconnect.php"); + +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["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} + 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"];} + } + if (isset($VD_campaign)) + { + $VD_campaign = strtoupper($VD_campaign); + $VD_campaign = eregi_replace(" ",'',$VD_campaign); + } + +### 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); + + +$forever_stop=0; + +if ($force_logout) +{ + echo "You have now logged out. Thank you\n"; + exit; +} + +$isdst = date("I"); +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$CIDdate = date("ymdHis"); + $month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); + $past_month_date = date("Y-m-d H:i:s",$month_old); + + +$random = (rand(1000000, 9999999) + 10000000); + +$conf_silent_prefix = '7'; # vicidial_conferences prefix to enter silently +$HKuser_level = '5'; # minimum vicidial user_level for HotKeys +$campaign_login_list = '1'; # show drop-down list of campaigns at login +$manual_dial_preview = '1'; # allow preview lead option when manual dial +$multi_line_comments = '1'; # set to 1 to allow multi-line comment box +$user_login_first = '0'; # set to 1 to have the vicidial_user login before the phone login +$view_scripts = '1'; # set to 1 to show the SCRIPTS tab +$dispo_check_all_pause = '0'; # set to 1 to allow for persistent pause after dispo +$agentcallsstatus = '0'; # set to 1 to show agent status and call count + $campagentstatctmax = '0'; # Number of seconds for campaign call and agent stats +$show_campname_pulldown = '1'; # set to 1 to show campaign name on login pulldown +$webform_sessionname = '1'; # set to 1 to include the session_name in webform URL +$local_consult_xfers = '1'; # set to 1 to send consultative transfers from original server +$clientDST = '1'; # set to 1 to check for DST on server for agent time +$no_delete_sessions = '0'; # set to 1 to not delete sessions at logout +$volumecontrol_active = '1'; # set to 1 to allow agents to alter volume of channels +$PreseT_DiaL_LinKs = '1'; # set to 1 to show a DIAL link for Dial Presets +$LogiNAJAX = '1'; # set to 1 to do lookups +$HidEMonitoRSessionS = '1'; # set to 1 to hide remote monitoring channels from "session calls" + +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen + +$BROWSER_HEIGHT = 500; # set to the minimum browser height, default=500 +$BROWSER_WIDTH = 770; # set to the minimum browser width, default=770 + + +# options now set in DB: +#$alt_phone_dialing = '1'; # allow agents to call alt phone numbers +#$scheduled_callbacks = '1'; # set to 1 to allow agent to choose scheduled callbacks +# $agentonly_callbacks = '1'; # set to 1 to allow agent to choose agent-only scheduled callbacks +#$agentcall_manual = '1'; # set to 1 to allow agent to make manual calls during autodial session + +### SCREEN WIDTH AND HEIGHT CALCULATIONS ### +### DO NOT EDIT! ### +$MASTERwidth=($BROWSER_WIDTH - 340); +$MASTERheight=($BROWSER_HEIGHT - 200); +if ($MASTERwidth < 430) {$MASTERwidth = '430';} +if ($MASTERheight < 300) {$MASTERheight = '300';} + +$CAwidth = ($MASTERwidth + 340); # 770 - cover all (none-in-session, customer hunngup, etc...) +$MNwidth = ($MASTERwidth + 330); # 760 - main frame +$XFwidth = ($MASTERwidth + 320); # 750 - transfer/conference +$HCwidth = ($MASTERwidth + 310); # 740 - hotkeys and callbacks +$AMwidth = ($MASTERwidth + 270); # 700 - agent mute and preset-dial links +$SSwidth = ($MASTERwidth + 176); # 606 - scroll script +$SDwidth = ($MASTERwidth + 170); # 600 - scroll script, customer data and calls-in-session +$HKwidth = ($MASTERwidth + 70); # 500 - Hotkeys button +$HSwidth = ($MASTERwidth + 1); # 431 - Header spacer + +$HKheight = ($MASTERheight + 105); # 405 - HotKey active Button +$AMheight = ($MASTERheight + 100); # 400 - Agent mute and preset dial links +$MBheight = ($MASTERheight + 65); # 365 - Manual Dial Buttons +$CBheight = ($MASTERheight + 50); # 350 - Agent Callback, pause code, volume control Buttons and agent status +$SSheight = ($MASTERheight + 31); # 331 - script content +$HTheight = ($MASTERheight + 10); # 310 - transfer frame, callback comments and hotkey +$BPheight = ($MASTERheight - 250); # 50 - bottom buffer + + +$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('vicidial.php','',$agcPAGE); + +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 +echo "\n"; +echo "\n"; +echo "\n"; + +if ($campaign_login_list > 0) +{ +$camp_form_code = "\n"; +} +else +{ +$camp_form_code = "\n"; +} + + +if ($LogiNAJAX > 0) +{ +?> + + + +VICIDIAL web client: Re-Login\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "
English Español
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Re-Login
 
Phone Login:
Phone Password:
User Login:
User Password:
Campaign: $camp_form_code

VERSION: $version       BUILD: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} + +if ($user_login_first == 1) +{ + if ( (strlen($VD_login)<1) or (strlen($VD_pass)<1) or (strlen($VD_campaign)<1) ) + { + echo "VICIDIAL web client: Campaign Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Español
\n"; + echo "
\n"; + echo "\n"; + #echo "\n"; + #echo "\n"; + echo "

User Login

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Campaign Login
 
User Login:
User Password:
Campaign: $camp_form_code
  \n"; + echo "

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) + { + $stmt="SELECT phone_login,phone_pass from vicidial_users where user='$VD_login' and pass='$VD_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); + $phone_login=$row[0]; + $phone_pass=$row[1]; + + echo "VICIDIAL web client: Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Español
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Login
 
Phone Login:
Phone Password:
User Login:
User Password:
Campaign: $camp_form_code
  \n"; + echo "

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + + } + } +} + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "VICIDIAL web client: Phone Login\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "
English Español
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Phone Login
 
Phone Login:
Phone Password:
  \n"; +echo "

VERSION: $version       BUILD: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./vicidial_auth_entries.txt", "a");} +$VDloginDISPLAY=0; + + if ( (strlen($VD_login)<2) or (strlen($VD_pass)<2) or (strlen($VD_campaign)<2) ) + { + $VDloginDISPLAY=1; + } + else + { + $stmt="SELECT count(*) from vicidial_users where user='$VD_login' and pass='$VD_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($auth>0) + { + $login=strtoupper($VD_login); + $password=strtoupper($VD_pass); + ##### grab the full name of the agent + $stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,closer_default_blended,user_group,vicidial_recording_override from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $user_level=$row[1]; + $VU_hotkeys_active=$row[2]; + $VU_agent_choose_ingroups=$row[3]; + $VU_scheduled_callbacks=$row[4]; + $agentonly_callbacks=$row[5]; + $agentcall_manual=$row[6]; + $VU_vicidial_recording=$row[7]; + $VU_vicidial_transfers=$row[8]; + $VU_closer_default_blended=$row[9]; + $VU_user_group=$row[10]; + $VU_vicidial_recording_override=$row[11]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|$VD_pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + $user_abb = "$VD_login$VD_login$VD_login$VD_login"; + while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + + $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$VU_user_group';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGallowed_campaigns =$row[0]; + + if ( (!eregi(" $VD_campaign ",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) + { + echo "VICIDIAL web client: VICIDIAL Campaign Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Español
\n"; + echo "Sorry, you are not allowed to login to this campaign: $VD_campaign\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Login: \n
"; + echo "Password:
\n"; + echo "Campaign: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + ##### check to see that the campaign is active + $stmt="SELECT count(*) FROM vicidial_campaigns where campaign_id='$VD_campaign' and active='Y';"; + 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); + $CAMPactive=$row[0]; + if($CAMPactive>0) + { + if ($TEST_all_statuses > 0) {$selectableSQL = '';} + else {$selectableSQL = "selectable='Y' and";} + $VARstatuses=''; + $VARstatusnames=''; + ##### grab the statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_statuses WHERE $selectableSQL status != 'NEW' order by status limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $VD_statuses_ct) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + } + + ##### grab the campaign-specific statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_campaign_statuses WHERE $selectableSQL status != 'NEW' and campaign_id='$VD_campaign' order by status limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_camp = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + $j++; + } + $VD_statuses_ct = ($VD_statuses_ct+$VD_statuses_camp); + $VARstatuses = substr("$VARstatuses", 0, -1); + $VARstatusnames = substr("$VARstatusnames", 0, -1); + + ##### grab the campaign-specific HotKey statuses that can be used for dispositioning by an agent + $stmt="SELECT hotkey,status,status_name FROM vicidial_campaign_hotkeys WHERE selectable='Y' and status != 'NEW' and campaign_id='$VD_campaign' order by hotkey limit 9;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $HK_statuses_camp = mysql_num_rows($rslt); + $w=0; + $HKboxA=''; + $HKboxB=''; + $HKboxC=''; + while ($w < $HK_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $HKhotkey[$w] =$row[0]; + $HKstatus[$w] =$row[1]; + $HKstatus_name[$w] =$row[2]; + $HKhotkeys = "$HKhotkeys'$HKhotkey[$w]',"; + $HKstatuses = "$HKstatuses'$HKstatus[$w]',"; + $HKstatusnames = "$HKstatusnames'$HKstatus_name[$w]',"; + if ($w < 3) + {$HKboxA = "$HKboxA $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ( ($w >= 3) and ($w < 6) ) + {$HKboxB = "$HKboxB $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ($w >= 6) + {$HKboxC = "$HKboxC $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + $w++; + } + $HKhotkeys = substr("$HKhotkeys", 0, -1); + $HKstatuses = substr("$HKstatuses", 0, -1); + $HKstatusnames = substr("$HKstatusnames", 0, -1); + + ##### grab the statuses to be dialed for your campaign as well as other campaign settings + $stmt="SELECT park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,agent_pause_codes_active,no_hopper_leads_logins,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,xfer_groups FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $park_ext = $row[0]; + $park_file_name = $row[1]; + $web_form_address = $row[2]; + $allow_closers = $row[3]; + $auto_dial_level = $row[4]; + $dial_timeout = $row[5]; + $dial_prefix = $row[6]; + $campaign_cid = $row[7]; + $campaign_vdad_exten = $row[8]; + $campaign_rec_exten = $row[9]; + $campaign_recording = $row[10]; + $campaign_rec_filename = $row[11]; + $campaign_script = $row[12]; + $get_call_launch = $row[13]; + $campaign_am_message_exten = $row[14]; + $xferconf_a_dtmf = $row[15]; + $xferconf_a_number = $row[16]; + $xferconf_b_dtmf = $row[17]; + $xferconf_b_number = $row[18]; + $alt_number_dialing = $row[19]; + $VC_scheduled_callbacks = $row[20]; + $wrapup_seconds = $row[21]; + $wrapup_message = $row[22]; + $closer_campaigns = $row[23]; + $use_internal_dnc = $row[24]; + $allcalls_delay = $row[25]; + $omit_phone_code = $row[26]; + $agent_pause_codes_active = $row[27]; + $no_hopper_leads_logins = $row[28]; + $campaign_allow_inbound = $row[29]; + $manual_dial_list_id = $row[30]; + $default_xfer_group = $row[31]; + $xfer_groups = $row[32]; + + if ( (!ereg('DISABLED',$VU_vicidial_recording_override)) and ($VU_vicidial_recording > 0) ) + { + $campaign_recording = $VU_vicidial_recording_override; + print "\n"; + } + if ( ($VC_scheduled_callbacks=='Y') and ($VU_scheduled_callbacks=='1') ) + {$scheduled_callbacks='1';} + if ($VU_vicidial_recording=='0') + {$campaign_recording='NEVER';} + if ($alt_number_dialing=='Y') + {$alt_phone_dialing='1';} + else + {$alt_phone_dialing='0';} + $closer_campaigns = preg_replace("/^ | -$/","",$closer_campaigns); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaigns = "'$closer_campaigns'"; + + if ($agent_pause_codes_active=='Y') + { + ##### grab the pause codes for this campaign + $stmt="SELECT pause_code,pause_code_name FROM vicidial_pause_codes WHERE campaign_id='$VD_campaign' order by pause_code limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_pause_codes = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_pause_codes) + { + $row=mysql_fetch_row($rslt); + $pause_codes[$i] =$row[0]; + $pause_code_names[$i] =$row[1]; + $VARpause_codes = "$VARpause_codes'$pause_codes[$i]',"; + $VARpause_code_names = "$VARpause_code_names'$pause_code_names[$i]',"; + $i++; + $j++; + } + $VD_pause_codes_ct = ($VD_pause_codes_ct+$VD_pause_codes); + $VARpause_codes = substr("$VARpause_codes", 0, -1); + $VARpause_code_names = substr("$VARpause_code_names", 0, -1); + } + + ##### grab the inbound groups to choose from if campaign contains CLOSER + $VARingroups="''"; + if ($campaign_allow_inbound == 'Y') + { + $VARingroups=''; + $stmt="select group_id from vicidial_inbound_groups where active = 'Y' and group_id IN($closer_campaigns) order by group_id limit 60;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $closer_ct = mysql_num_rows($rslt); + $INgrpCT=0; + while ($INgrpCT < $closer_ct) + { + $row=mysql_fetch_row($rslt); + $closer_groups[$INgrpCT] =$row[0]; + $VARingroups = "$VARingroups'$closer_groups[$INgrpCT]',"; + $INgrpCT++; + } + $VARingroups = substr("$VARingroups", 0, -1); + } + + ##### grab the allowable inbound groups to choose from for transfer options + $xfer_groups = preg_replace("/^ | -$/","",$xfer_groups); + $xfer_groups = preg_replace("/ /","','",$xfer_groups); + $xfer_groups = "'$xfer_groups'"; + $VARxfergroups="''"; + if ($allow_closers == 'Y') + { + $VARxfergroups=''; + $stmt="select group_id,group_name from vicidial_inbound_groups where active = 'Y' and group_id IN($xfer_groups) order by group_id limit 60;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $xfer_ct = mysql_num_rows($rslt); + $XFgrpCT=0; + while ($XFgrpCT < $xfer_ct) + { + $row=mysql_fetch_row($rslt); + $VARxfergroups = "$VARxfergroups'$row[0]',"; + $VARxfergroupsnames = "$VARxfergroupsnames'$row[1]',"; + if ($row[0] == "$default_xfer_group") {$default_xfer_group_name = $row[1];} + $XFgrpCT++; + } + $VARxfergroups = substr("$VARxfergroups", 0, -1); + $VARxfergroupsnames = substr("$VARxfergroupsnames", 0, -1); + } + + ##### grab the number of leads in the hopper for this campaign + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id = '$VD_campaign' and status='READY';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $campaign_leads_to_call = $row[0]; + print "\n"; + + } + else + { + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Campaign not active, please try again
"; + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|$VD_pass|$ip|$browser|\n"); + fclose($fp); + } + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Login incorrect, please try again
"; + } + } + if ($VDloginDISPLAY) + { + echo "VICIDIAL web client: Campaign Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Español
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "

$VDdisplayMESSAGE

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Campaign Login
 
User Login:
User Password:
Campaign: $camp_form_code
  \n"; + echo "

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +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); +$authphone=$row[0]; +if (!$authphone) + { + echo "VICIDIAL web client: Phone Login Error\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Español
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Login Error
 
Sorry, your phone login and password are not active in this system, please try again:
 
Phone Login:
Phone Password:

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "VICIDIAL web client\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + 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); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $login=$row[6]; + $pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CallerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + $enable_sipsak_messages=$row[66]; + + if ($clientDST) + { + $local_gmt = ($local_gmt + $isdst); + } + if ($protocol == 'EXTERNAL') + { + $protocol = 'Local'; + $extension = "$dialplan_number$AT$ext_context"; + } + $SIP_user = "$protocol/$extension"; + + $stmt="SELECT asterisk_version from servers where server_ip='$server_ip';"; + 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); + $asterisk_version=$row[0]; + + # If a park extension is not set, use the default one + if ( (strlen($park_ext)>0) && (strlen($park_file_name)>0) ) + { + $VICIDiaL_park_on_extension = "$park_ext"; + $VICIDiaL_park_on_filename = "$park_file_name"; + print "\n"; + } + print "\n"; + + # If a web form address is not set, use the default one + if (strlen($web_form_address)>0) + { + $VICIDiaL_web_form_address = "$web_form_address"; + print "\n"; + } + else + { + $VICIDiaL_web_form_address = "$VICIDiaL_web_URL"; + print "\n"; + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + } + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + # If closers are allowed on this campaign + if ($allow_closers=="Y") + { + $VICIDiaL_allow_closers = 1; + print "\n"; + } + else + { + $VICIDiaL_allow_closers = 0; + print "\n"; + } + + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtimE$US$session_ext$session_rand"; + + if ($webform_sessionname) + {$webform_sessionname = "&session_name=$session_name";} + else + {$webform_sessionname = '';} + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'vicidial';"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','vicidial','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + if ( ($campaign_allow_inbound == 'Y') || ($campaign_leads_to_call > 0) || (ereg('Y',$no_hopper_leads_logins)) ) + { + ### insert an entry into the user log for the login event + $stmt = "INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$VD_login','LOGIN','$VD_campaign','$NOW_TIME','$StarTtimE','$VU_user_group')"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + ##### check to see if the user has a conf extension already, this happens if they previously exited uncleanly + $stmt="SELECT conf_exten FROM vicidial_conferences where extension='$SIP_user' and server_ip = '$server_ip' LIMIT 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $prev_login_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $prev_login_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + if ($prev_login_ct > 0) + {print "\n";} + else + { + ##### grab the next available vicidial_conference room and reserve it + $stmt="SELECT conf_exten FROM vicidial_conferences where server_ip = '$server_ip' and ((extension='') or (extension is null)) LIMIT 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $free_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $free_conf_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + $stmt="UPDATE vicidial_conferences set extension='$SIP_user' where server_ip='$server_ip' and conf_exten='$session_id';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + print "\n"; + + } + + $stmt="UPDATE vicidial_list set status='N', user='' where status IN('QUEUE','INCALL') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_hopper where status IN('QUEUE','INCALL','DONE') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_live_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_live_inbound_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + # print "You have logged in as user: $VD_login on phone: $SIP_user to campaign: $VD_campaign
\n"; + $VICIDiaL_is_logged_in=1; + + ### set the callerID for manager middleware-app to connect the phone to the user + $SIqueryCID = "S$CIDdate$session_id"; + + ############################################# + ##### START SYSTEM_SETTINGS LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,vicidial_agent_disable,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $vicidial_agent_disable = $row[6]; + $allow_sipsak_messages = $row[7]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_prefix = 'LIN-'; + print "\n"; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$VD_campaign\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + $SIqueryCID = "$SIPSAK_prefix$VD_campaign$DS$CIDdate"; + } + + ### insert a NEW record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$SIqueryCID','Channel: $SIP_user','Context: $ext_context','Exten: $session_id','Priority: 1','Callerid: $SIqueryCID','','','','','');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($auto_dial_level > 0) + { + print "\n"; + + ##### grab the campaign_weight and number of calls today on that campaign for the agent + $stmt="SELECT campaign_weight,calls_today FROM vicidial_campaign_agents where user='$VD_login' and campaign_id = '$VD_campaign';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vca_ct = mysql_num_rows($rslt); + if ($vca_ct > 0) + { + $row=mysql_fetch_row($rslt); + $campaign_weight = $row[0]; + $calls_today = $row[1]; + $i++; + } + else + { + $campaign_weight = '0'; + $calls_today = '0'; + $stmt="INSERT INTO vicidial_campaign_agents (user,campaign_id,campaign_rank,campaign_weight,calls_today) values('$VD_login','$VD_campaign','0','0','$calls_today');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + } + $closer_chooser_string=''; + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,user_level,campaign_weight,calls_today) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$closer_chooser_string','$user_level','$campaign_weight','$calls_today');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='$VD_campaign',agent='Agent/$VD_login',verb='AGENTLOGIN',data1='$VD_login@agents',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + mysql_close($linkB); + mysql_select_db("$VARDB_database", $link); + } + + + if ($campaign_allow_inbound == 'Y') + { + print "\n"; + } + } + else + { + print "\n"; + + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,user_level) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$user_level');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='$VD_campaign',agent='Agent/$VD_login',verb='AGENTLOGIN',data1='$VD_login@agents',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + mysql_close($linkB); + mysql_select_db("$VARDB_database", $link); + } + } + } + else + { + echo "VICIDIAL web client: VICIDIAL Campaign Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Español
\n"; + echo "Sorry, there are no leads in the hopper for this campaign\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Login: \n
"; + echo "Password:
\n"; + echo "Campaign: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + if (strlen($session_id) < 1) + { + echo "VICIDIAL web client: VICIDIAL Campaign Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Español
\n"; + echo "Sorry, there are no available sessions\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Login: \n
"; + echo "Password:
\n"; + echo "Campaign: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + if (ereg('MSIE',$browser)) + { + $useIE=1; + print "\n"; + } + else + { + $useIE=0; + print "\n"; + } + + $StarTtimE = date("U"); + $NOW_TIME = date("Y-m-d H:i:s"); + ##### Agent is going to log in so insert the vicidial_agent_log entry now + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group,sub_status) values('$VD_login','$server_ip','$NOW_TIME','$VD_campaign','$StarTtimE','0','$StarTtimE','$VU_user_group','LOGIN');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id($link); + print "\n"; + + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $server_ip_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S"; + + ##### grab the datails of all active scripts in the system + $stmt="SELECT script_id,script_name,script_text FROM vicidial_scripts WHERE active='Y' order by script_id limit 100;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $MM_scripts = mysql_num_rows($rslt); + $e=0; + while ($e < $MM_scripts) + { + $row=mysql_fetch_row($rslt); + $MMscriptid[$e] =$row[0]; + $MMscriptname[$e] = rawurlencode($row[1]); + $MMscripttext[$e] = rawurlencode($row[2]); + $MMscriptids = "$MMscriptids'$MMscriptid[$e]',"; + $MMscriptnames = "$MMscriptnames'$MMscriptname[$e]',"; + $MMscripttexts = "$MMscripttexts'$MMscripttext[$e]',"; + $e++; + } + $MMscriptids = substr("$MMscriptids", 0, -1); + $MMscriptnames = substr("$MMscriptnames", 0, -1); + $MMscripttexts = substr("$MMscripttexts", 0, -1); + + } +} + +################################################################ +### BEGIN - build the callback calendar (12 months) ### +################################################################ +define ('ADAY', (60*60*24)); +$CdayARY = getdate(); +$Cmon = $CdayARY['mon']; +$Cyear = $CdayARY['year']; +$CTODAY = date("Y-m"); +$CTODAYmday = date("j"); +$CINC=0; + +$Cmonths = Array('January','February','March','April','May','June', + 'July','August','September','October','November','December'); +$Cdays = Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); + +$CCAL_OUT = ''; + +$CCAL_OUT .= ""; + +while ($CINC < 12) +{ +if ( ($CINC == 0) || ($CINC == 4) ||($CINC == 8) ) + {$CCAL_OUT .= "";} + +$CCAL_OUT .= ""; + +if ( ($CINC == 3) || ($CINC == 7) ||($CINC == 11) ) + {$CCAL_OUT .= "";} +$CINC++; +} + +$CCAL_OUT .= "
"; + +$CYyear = $Cyear; +$Cmonth= ($Cmon + $CINC); +if ($Cmonth > 12) + { + $Cmonth = ($Cmonth - 12); + $CYyear++; + } +$Cstart= mktime(11,0,0,$Cmonth,1,$CYyear); +$CfirstdayARY = getdate($Cstart); +#echo "|$Cmon|$Cmonth|$CINC|\n"; +$CPRNTDAY = date("Y-m", $Cstart); + +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; + +foreach($Cdays as $Cday) +{ + $CDCLR="#ffffff"; +$CCAL_OUT .= ""; +} + +for( $Ccount=0;$Ccount<(6*7);$Ccount++) +{ + $Cdayarray = getdate($Cstart); + if((($Ccount) % 7) == 0) + { + if($Cdayarray['mon'] != $CfirstdayARY['mon']) + break; + $CCAL_OUT .= ""; + } + if($Ccount < $CfirstdayARY['wday'] || $Cdayarray['mon'] != $Cmonth) + { + $CCAL_OUT .= ""; + } + else + { + if( ($Cdayarray['mday'] == $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + else + { + $CDCLR="#ffffff"; + if ( ($Cdayarray['mday'] < $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CDCLR="#CCCCCC"; + $CBL = ''; + $CEL = ''; + } + else + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + } + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + } +} +$CCAL_OUT .= ""; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$CfirstdayARY[month] $CfirstdayARY[year]"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$Cday"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
 "; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; + +#echo "$CCAL_OUT\n"; +################################################################ +### END - build the callback calendar (12 months) ### +################################################################ + + +?> + + + + +\n"; + + +?> + +
+ + MARGINWIDTH=0 MARGINHEIGHT=0 LEFTMARGIN=0 TOPMARGIN=0 VALIGN=TOP ALIGN=LEFT> +
+ + + +LOGOUT\n"; ?> +
+
+ + + height=30> + + + + + +
VICIDIALSCRIPT VALIGN=MIDDLE ALIGN=CENTER>   LIVE     session ID: Live Call
+
+ + + + + height=>

VICIDIAL
+
+ + +MANUAL DIAL       FAST DIAL
+
+ + +X ACTIVE CALLBACKS
+
+ + +
+
+ + + D1 - DIAL\n"; + echo "
\n"; + echo "D2 - DIAL\n"; + } + else {echo "
\n";} + ?> +

+
+
+ + + height=460>
CALLBACKS FOR AGENT :
Click on a callback below to call the customer back now. If you click on a record below to call it, it will be removed from the list. +
+
+
  + Refresh +                 + Go Back +
+
+ + + height=460>
NEW MANUAL DIAL LEAD FOR :

Enter information below for the new lead you wish to call. +
+ \n"; + } + ?> + Note: all new manual dial leads will go into list

+ + + + + + + + + + + + + + + +
Dial Code:   (This is usually a 1 in the USA-Canada)
Phone Number: +   (12 digits max - digits only) +
Search Existing Leads:   (This option if checked will attempt to find the phone number in the system before inserting it as a new lead)


If you want to dial a number and have it NOT be added as a new lead, enter in the exact dialstring that you want to call in the Dial Override field below. To hangup this call you will have to open the CALLS IN THIS SESSION link at the bottom of the screen and hang it up by clicking on its channel link there.
 
Dial Override:   (digits only please) +
+
+ Dial Now +                 + Go Back +
+
+ + + +
+
+ + + + +Your Status:
Calls Dialing: +
+ + + + + > + +
+
+ + Transfer - Conference
+ + + LOCAL CLOSER + Hangup Xfer Line + Hangup Both Lines + +
+ + Number to call   + + DIAL OVERRIDE   + LEAVE 3-WAY CALL + Dial Blind Transfer + D1 + D2 + +
+ + seconds   + channel + Dial With Customer + Park Customer Dial + Blind Transfer VMail Message +
+
+
+
+ + + + height=70> + +
Lead Dispositioned As:

+ -
+
+
+ + + height=70> + + + + +
Disposition Hot Keys: + When active, simply press the keyboard key for the desired disposition for this call. The call will then be hungup and dispositioned automatically:
+ + + + + +
+
+ + + height=70> + + + + + + +
Previous Callback Information: close
+
+
+
+
+ +
+
+ + + height=500>
Noone is in your session:
+ Go Back +

+ Call Agent Again +
+
+ + + height=500>
Customer has hung up:
+ Go Back +

+ Finish and Disposition Call + +
+
+ + + height=550>
Call Wrapup: seconds remaining in wrapup

+ +

+ Finish Wrapup and Move On + +
+
+ + + height=500>
Your session has been disabled
LOGOUT

Go Back +
+
+ + + height=500>

LOGOUT
+
+ + +
+
+ + +
 
+
+ + + height=47>
Any changes made to the customer information below at this time will not be comitted, You must change customer information before you Hangup the call.
+
+ + + height=460>
DISPOSITION CALL :       Hangup Again       minimize
+ End-of-call Disposition Selection +
+ PAUSE AGENT DIALING
+ CLEAR FORM | + SUBMIT +

+ WEB FORM SUBMIT +

  +
+
+ + + height=460>
SELECT A PAUSE CODE :
+ Pause Code Selection + +

  +
+
+ + + height=460>
Select a CallBack Date :
+ + + Select a Date Below   +     + Hour: +   + Minutes: +   + +  
+ MY CALLBACK ONLY
";} + ?> + CB Comments:

+ + SUBMIT

+ +

  +
+
+ + + height=460>
CLOSER INBOUND GROUP SELECTION
+ Closer Inbound Group Selection +
+ BLENDED CALLING(outbound activated)
+ RESET | + SUBMIT +



  +
+
+ + + + Channel + Channel + MY CALLBACK ONLY
";} + ?> +
+ + + + height=>
VICIDIAL SCRIPT
+
+ + + 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> +HOT KEYS INACTIVE + + + + +> + + + +
VICIDIAL web-client version:     BUILD:               Server:              
+Show conference call channel information

 
+
+ + + +
+
+ + + + + id="MainTable"> + + + + + + + + + + + + + + + +
STATUS:
+
+Dial Next Number
+ LEAD PREVIEW
+ ALT PHONE DIAL
+ + +RECORDING FILE:
+
+
+RECORD ID:
+
+ +Start Recording
+
+Web Form
+
+Park Call
+Transfer - Conference
+
+Hangup Customer
+
+
Send DTMF

+
+
+
align=left valign=top> + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
seconds:   Channel:   Cust Time:
Customer Information:
Title:   First:   MI:   Last:
Address1:
Address2:   Address3:
City:   State:   PostCode:
Province:   Vendor ID:
Phone:   DialCode:   Alt. Phone:
Show:   Email:
Comments: + +\n";} +else + {echo "\n";} +?> + +
+
+ +
+
> + 
+ + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/voicemail_check.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/voicemail_check.php new file mode 100644 index 00000000..0aa152d7 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_en/voicemail_check.php @@ -0,0 +1,140 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid 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 "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Voicemail Check"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + $MT[0]=''; + $row=''; $rowx=''; + if (strlen($vmail_box)<1) + { + $channel_live=0; + echo "voicemail box $vmail_box is not valid\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";} + $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";} + } + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/active_list_refresh.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/active_list_refresh.php new file mode 100644 index 00000000..fb94a573 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/active_list_refresh.php @@ -0,0 +1,482 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "\n"; +echo "\n"; +echo "\n"; +echo "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 "\n"; +echo "\n"; +echo "\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 "\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + +###################### +# ADD=2 display all busy extensions on a server +###################### +if ($ADD==2) +{ + if (!$field_name) {$field_name = 'busyext';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\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 "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=4 display all busy Local lines on a server +###################### +if ($ADD==4) +{ + if (!$field_name) {$field_name = 'local';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\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 "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='table') {echo "\n";} +if ($format=='table') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/astguiclient.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/astguiclient.php new file mode 100644 index 00000000..667ad057 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/astguiclient.php @@ -0,0 +1,2905 @@ + LICENSE: GPLv2 +# +# make sure you have added a user to the vicidial_users MySQL table with at least +# user_level 1 or greater to access this page. Also you need to have the login +# and pass of a phone listed in the asterisk.phones table. The page grabs the +# server info and other details from this login and pass +# +# Other scripts that this application depends on: +# - active_list_refresh.php: displays active/live channels and phones +# - manager_send.php: sends Actions to be executed on Asterisk servers +# - live_exten_check.php: checks to see if user's phone is on a live call +# - call_log_display.php: retrieves log of inbound and outbound calls +# - voicemail_check.php: retrieves counts of new and old messages +# - inbound_popup.php: opens upon live_inbound call coming in +# - conf_exten_check.php: checks to see if and calls are in a specific conf +# - park_calls_display.php: retrieves list of parked calls +# - vdc_db_query.php: Changes values in the DB for non-calling records +# +# CHANGES +# 50215-1356 - Proof-of-concept test of XMLHttpRequest for astGUIclient web +# 50323-1411 - First build version display-only +# 50331-1040 - Second-build, added phone login and hangup/hijack display +# 50401-1006 - Trunk/Local Hangup functions enabled +# 50404-1056 - Trunk/Local Hijack functions enabled +# 50404-1459 - Simple live calls display and grabs updated time from server +# 50405-1221 - Reorganized the display and layers, added some images +# 50406-1005 - Added In/Out call log display to MAIN panel +# 50407-1254 - Start/Stop Recording on live calls enabled +# 50422-1101 - Activated Check Voicemail button and new/old messages count +# 50428-1449 - Added dial from log and basic live_inbound call popup +# 50429-1455 - Modified inbound popup code for IE and to add more functions +# 50502-1442 - Added basic method to transfer live calls somewhere else +# 50503-1205 - Added web_client_sessions entry for more security of subscripts +# 50503-1537 - Added basic conferences display +# 50509-1132 - Added conference connected list and hangup/xfer for them +# 50511-1129 - Added registration of conference rooms and added manual dial +# 50523-1342 - Added Conference recording and send DTMF +# 50523-1622 - Added Local Dial window frame for calling local extensions +# 50524-1456 - Added ability to park call and display number of parked calls +# 50524-1600 - Added ability to display and pickup/hangup/xfer parked calls +# 50525-1224 - Added ability to place outbound call from within conferene +# 50531-1225 - Added ability to do dual transfers to meetme rooms from Main +# 50711-1229 - removed HTTP authentication in favor of user/pass vars +# 50711-1610 - Added Zap monitoring to Trunk/Local Action screens +# 50804-1604 - Minor bug fix in inbound_popup functions +# 50818-1715 - Added pretty login section +# 50913-1137 - Added custom outbound_cid from phones table +# 51110-1430 - Fixed non-standard http port issue +# 60103-1421 - Added code for favorite extensions chooser +# 60104-1347 - Added basic layout for favorites editing frame +# 60105-1124 - Finished Favorites frame and added DB submission +# 60112-1622 - Several formatting changes +# 60421-1357 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1103 - Added variable filters to close security holes for login form +# 60829-1528 - Made compatible with WeBRooTWritablE setting in dbconnect.php +# + +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["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["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} + 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"];} + } + +$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++;} + +$version = '2.0.1'; +$build = '60829-1528'; + +### 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); + $user=ereg_replace("[^0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^0-9a-zA-Z]","",$pass); + + +if ($force_logout) +{ + if( (strlen($_SERVER['user'])>0) or (strlen($_SERVER['pass'])>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "Usted ahora ha registrado hacia fuera. Gracias\n"; + exit; +} + +$StarTtime = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_TIME = date("Ymd-His"); + $month_old = mktime(0, 0, 0, date("m"), date("d")-7, date("Y")); + $past_month_date = date("Y-m-d H:i:s",$month_old); + + $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]; + +$US='_'; +$CL=':'; +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./astguiclient_auth_entries.txt", "a");} +$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 = $agcPAGE; +$agcDIR = eregi_replace('astguiclient.php','',$agcDIR); + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth) or ($relogin == 'YES') ) + { + header ("Content-type: text/html; charset=utf-8"); + + echo "web client astGUIclient: Conexión\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Español
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Conexión
 
Conexión Del Usuario:
Contraseña Del Usuario:
Conexión Del Teléfono:
Contraseña Del Teléfono:

VERSIÓN: $version       CONSTRUCCION: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($user); + $password=strtoupper($pass); + $stmt="SELECT full_name,user_level from vicidial_users where user='$user' and pass='$pass'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + } + +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 +echo "\n"; +echo "\n"; +echo "\n"; + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "web client astGUIclient: Conexión Del Teléfono\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "
English Español
\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Conexión Del Teléfono
 
Conexión Del Teléfono:
Contraseña Del Teléfono:

VERSIÓN: $version       CONSTRUCCION: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$authphone=$row[0]; +if (!$authphone) + { + echo "web client astGUIclient: Conexión Del Teléfono\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Español
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Conexión Del Teléfono
 
Disculpe, la conexión del teléfono y contraseña no están activos en este sistema, intentelo otra vez por favor:
 
Conexión Del Teléfono:
Contraseña Del Teléfono:

VERSIÓN: $version       CONSTRUCCION: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "web client astGUIclient\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $phone_login=$row[6]; + $phone_pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CaLLerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + $outbound_cid=$row[65]; + + $local_web_callerID_URL_enc = rawurlencode($local_web_callerID_URL); + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtime$US$session_ext$session_rand"; + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'agc';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','agc','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT count(*) from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_present=$row[0]; + if ($favorites_present > 0) + { + $stmt="SELECT extensions_list from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_list=$row[0]; + $h=0; + $favorites_listX = eregi_replace("'",'',$favorites_list); + $favorites = explode(',',$favorites_listX); + $favorites_count = count($favorites); + $favorites_listX=''; + + $o=0; + while ($favorites_count > $o) + { + $stmt="SELECT fullname,protocol from phones where extension = '$favorites[$o]' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $favorites_names[$o] = $rowx[0]; + $favorites_listX .= "$rowx[1]/$favorites[$o],"; + $o++; + } + + echo "\n"; + echo "\n"; + } + else + { + echo "\n"; + } + +### gather phone extensions and fullnames for favorites editor ### + $stmt="SELECT extension,fullname from phones where server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $exten_ct = mysql_num_rows($rslt); + $favlistCT=0; + $nofavlistCT=0; + while ($favlistCT < $exten_ct) + { + $row=mysql_fetch_row($rslt); + $favlist[$favlistCT]= "$row[0] - $row[1]"; + $favlistCT++; + } + + } +} + + +?> + + + + + + +\n"; + + +?> + +
+ + + + + + + + + +
+ + +SALIR
\n"; ?> +
Pantalla PrincipalPantalla Lineas ActivasPantalla de ConferenciasComprobar buzón de vozLlamada Activa
+
+ + +

Logout
+
+ + +
TRUNK COLGAR

+ Active Trunks Menu
+ Colgar Trunk   |   + Capturar Trunk   |   + Escuchar Trunk   |   + Recarga   |   + Volver a la pantalla principal +
+
+ + +
Colgar Local

+ Menú Local Activa
+ Colgar Local   |   + Capturar Local   |   + Escuchar Local   |   + Recarga   |   + Volver a la pantalla principal +
+
+ + + + + + + +
TRANSFERIR LLAMADA ACTIVA
Canal que va a ser transferido: Canal
Extensiones:
Menú Extensiones
+
+ Envíe a la extensión seleccionada

+ Enviar al buzón de voz seleccionada

+ Envíe a este número:


+ Recarga


+ Volver a la pantalla principal

+
Conferencias:
(Pinchar en un número de abajo para enviar a una conferencia)
Enviar mi canal también
Menú de Conferencias
+
+ + + + + +
Marcar a Extensiones LOCALES
Teléfono llamando desde: Canal
Extensiones:
Menú Extensiones
+
+ Llamar extensión seleccionada

+ Llamar buzón de voz seleccionado

+ Recarga


+ Volver a la pantalla principal

+
+
+ + +
LLAMADAS APARCADAS:
+ Volver a la pantalla principal

+
+
+ + + + + + + + + + + + + + + +
  +
BUZÓN DE VOZ     NUEVO:     VIEJO:             MARCADO MANUAL       DIAL
LLAMADAS APARCADAS: 0                MARCAR EXTENSIONES LOCALES
LLAMADAS SALIENTES:
LLAMADAS ENTRANTES:
versión astGUIclient del tela-cliente: CONSTRUCCION:
+ + + + $h) + { + if (strlen($favorites[$h])>1) + { + echo "\n"; + } + $h++; + } +?> + +
FAVORITOS       corrija
$favorites[$h] - $favorites_names[$h]
 
+
+ + + + + + + +
FAVORITOS

 
SOMETA LOS CAMBIOS de los FAVORITOS - requiere registro de estado de la máquina
DE NUEVO A VENTANA PRINCIPAL - no haga caso de los cambios realizados
+
+ +
+ + + + + + + + + + + + + +
+PAUSA | COMIENZO     Actualizar la tarifa: 1000 ms Más rápido | Más lento

+
Inizializando..
+
Extensiones Activas
+ACTUALIZAR | +ORDEN | +
Líneas de salida
+ACTUALIZAR | +ORDEN | +
Extensiones Locales
+ACTUALIZAR | +ORDEN | +
+ Los Datos Van Aquí

+
+ Los Datos Van Aquí

Acciones en Trunk +
+ Los Datos Van Aquí

Acción Local +
+
+ + + + +
+ + +Lista De las Conferencias + + + +
+Pinchar a la izquierda del número de una sala de conferencias para obtener información +
+ + + + + + + + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/call_log_display.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/call_log_display.php new file mode 100644 index 00000000..cc48a77b --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/call_log_display.php @@ -0,0 +1,196 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "\n"; +echo "\n"; +echo "\n"; +echo "Motrar el registro de llamadas"; +echo "\n"; +echo "\n"; +echo "\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";} + $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";} + $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"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/conf_exten_check.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/conf_exten_check.php new file mode 100644 index 00000000..e7fdc4ad --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/conf_exten_check.php @@ -0,0 +1,297 @@ + LICENSE: GPLv2 +# +# 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 +# + +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"];} + +$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";} + +$version = '2.0.4-12'; +$build = '71122-0205'; +$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";} + $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 "\n"; +echo "\n"; +echo "\n"; +echo "Comprobar la Extensión de Conf"; +echo "\n"; +echo "\n"; +echo "\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; + + ### 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); + $row=mysql_fetch_row($rslt); + $Acount=$row[0]; + + if ($Acount > 0) + { + $stmt="SELECT status from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Astatus=$row[0]; + } + # ### 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";} + $rslt=mysql_query($stmt, $link); + + if ($campagentstdisp == 'YES') + { + ### grab the status of this agent to display + $stmt="SELECT status,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Alogin=$row[0]; + $Acampaign=$row[1]; + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where server_ip='$server_ip' and status NOT IN('XFER') and campaign_id='$Acampaign';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $RingCalls=$row[0]; + } + else + { + $Alogin='N'; + $RingCalls='N'; + } + } + else + { + $Alogin='N'; + $RingCalls='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";} + $rslt=mysql_query($stmt, $link); + + } + + if ($Acount < 1) {$Alogin='DEAD_VLA';} + if ($AexternalDEAD > 0) {$Alogin='DEAD_EXTERNAL';} + + echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Estado: ' . $Astatus . "|\n"; + + } + $total_conf=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + 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";} + } + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $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++; $total_conf++; + $row=mysql_fetch_row($rslt); + $CanalA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + } + $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";} + $rslt=mysql_query($stmt, $link); + } + echo "Conferencia $conf_exten Ha sido registrado para $exten\n"; + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/dbconnect.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/dbconnect.php new file mode 100644 index 00000000..7221b35e --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/dbconnect.php @@ -0,0 +1,48 @@ + LICENSE: GPLv2 +# +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"); +mysql_select_db("$VARDB_database"); + +$local_DEF = 'Local/'; +$conf_silent_prefix = '7'; +$local_AMP = '@'; +$ext_context = 'demo'; +$recording_exten = '8309'; +$WeBRooTWritablE = '1'; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/inbound_popup.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/inbound_popup.php new file mode 100644 index 00000000..58462f0d --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/inbound_popup.php @@ -0,0 +1,351 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "\n"; +echo "\n"; +echo "\n"; +?> + + +LLAMADA DE ENTRADA ACTIVA"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "

LLAMADA DE ENTRADA ACTIVA

\n"; +echo "$NOW_TIME

\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 * FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $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";} + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Canal: $row[1]
LlamadorID: $row[3]
\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 "GOOGLE - \n"; + echo "ANYWHO - \n"; + echo "SWITCHBOARD - \n"; + echo "VERIZON - \n"; + echo "WHITEPAGES - \n"; + echo "411.COM - \n"; + echo "411.COM - \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 MEDIDA - \n"; + + echo "
Número Marcado: $row[8]
Notas: $row[9]|$row[10]|$row[11]|$row[12]|$row[13]|
\n"; + echo "COLGAR - \n"; + echo "ENVIAR A MI BUZÓN DE VOZ\n"; + echo "
\n"; + + + $stmt="UPDATE live_inbound set acknowledged='Y' where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + + } + + + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/live_exten_check.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/live_exten_check.php new file mode 100644 index 00000000..817f49d1 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/live_exten_check.php @@ -0,0 +1,278 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "\n"; +echo "\n"; +echo "\n"; +echo "Comprobar Extensión Activa"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + +echo "DateTime: $NOW_TIME|"; +echo "UnixTime: $StarTtime|"; + +$stmt="SELECT count(*) FROM parked_channels where server_ip = '$server_ip';"; + if ($format=='debug') {echo "\n";} +$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";} + $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";} + } + } + + $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";} + $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";} + $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";} + $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";} + $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";} +$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";} + } + +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";} + $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";} + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/manager_send.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/manager_send.php new file mode 100644 index 00000000..e56b8680 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/manager_send.php @@ -0,0 +1,1142 @@ + LICENSE: GPLv2 +# +# This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk 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: +# - $ACTION - ('Originate','Redirect','Hangup','Command','Monitor','StopMonitor','SysCIDOriginate','RedirectName','RedirectNameVmail','MonitorConf','StopMonitorConf','RedirectXtra','RedirectXtraCX','RedirectVD','HangupConfDial','VolumeControl','OriginateVDRelogin') +# - $queryCID - ('CN012345678901234567',...) +# - $format - ('text','debug') +# - $channel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +# - $exten - ('1234','913125551212',...) +# - $ext_context - ('default','demo',...) +# - $ext_priority - ('1','2',...) +# - $filename - ('20050406-125623_44444',...) +# - $extenName - ('phone100',...) +# - $parkedby - ('phone100',...) +# - $extrachannel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +# - $auto_dial_level - ('0','1','1.1',...) +# - $campaign - ('CLOSER','TESTCAMP',...) +# - $uniqueid - ('1120232758.2406800',...) +# - $lead_id - ('1234',...) +# - $seconds - ('32',...) +# - $outbound_cid - ('3125551212','0000000000',...) +# - $agent_log_id - ('123456',...) +# - $call_server_ip - ('10.10.10.15',...) +# - $CalLCID - ('VD01234567890123456',...) +# - $stage - ('UP','DOWN') +# + +# CHANGELOG: +# 50401-1002 - First build of script, Hangup function only +# 50404-1045 - Redirect basic function enabled +# 50406-1522 - Monitor basic function enabled +# 50407-1647 - Monitor and StopMonitor full functions enabled +# 50422-1120 - basic Originate function enabled +# 50428-1451 - basic SysCIDOriginate function enabled for checking voicemail +# 50502-1539 - basic RedirectName and RedirectNameVmail added +# 50503-1227 - added session_name checking for extra security +# 50523-1341 - added Conference call start/stop recording +# 50523-1421 - added OriginateName and OriginateNameVmail for local calls +# 50524-1602 - added RedirectToPark and RedirectFromPark +# 50531-1203 - added RedirecXtra for dual channel redirection +# 50630-1100 - script changed to not use HTTP login vars, user/pass instead +# 50804-1148 - Added RedirectVD for VICIDIAL blind redirection with logging +# 50815-1204 - Added NEXTAVAILABLE to RedirectXtra function +# 50903-2343 - Added HangupConfDial function to hangup in-dial channels in conf +# 50913-1057 - Added outbound_cid set if present to originate call +# 51020-1556 - Added agent_log_id framework for detailed agent activity logging +# 51118-1204 - Fixed Blind transfer bug from VICIDIAL when in manual dial mode +# 51129-1014 - Added ability to accept calls from other VICIDIAL servers +# 51129-1253 - Fixed Hangups of other agents channels in VICIDIAL AD +# 60310-2022 - Fixed NEXTAVAILABLE bug in leave-3way-call redirect function +# 60421-1413 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1158 - Added variable filters to close security holes for login form +# 60809-1544 - Added direct transfers to leave-3ways in consultative transfers +# 61004-1526 - Added parsing of volume control command and lookup or number +# 61130-1617 - Added lead_id to MonitorConf for recording_log +# 61201-1115 - Added user to MonitorConf for recording_log +# 70111-1600 - added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70226-1251 - Added Mute/UnMute to conference volume control +# 70320-1502 - Added option to allow retry of leave-3way-call and debug logging +# 70322-1636 - Added sipsak display ability +# + +require("dbconnect.php"); + +### These are variable assignments for PHP globals off +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["ACTION"])) {$ACTION=$_GET["ACTION"];} + elseif (isset($_POST["ACTION"])) {$ACTION=$_POST["ACTION"];} +if (isset($_GET["queryCID"])) {$queryCID=$_GET["queryCID"];} + elseif (isset($_POST["queryCID"])) {$queryCID=$_POST["queryCID"];} +if (isset($_GET["format"])) {$format=$_GET["format"];} + elseif (isset($_POST["format"])) {$format=$_POST["format"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["exten"])) {$exten=$_GET["exten"];} + elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];} +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["filename"])) {$filename=$_GET["filename"];} + elseif (isset($_POST["filename"])) {$filename=$_POST["filename"];} +if (isset($_GET["extenName"])) {$extenName=$_GET["extenName"];} + elseif (isset($_POST["extenName"])) {$extenName=$_POST["extenName"];} +if (isset($_GET["parkedby"])) {$parkedby=$_GET["parkedby"];} + elseif (isset($_POST["parkedby"])) {$parkedby=$_POST["parkedby"];} +if (isset($_GET["extrachannel"])) {$extrachannel=$_GET["extrachannel"];} + elseif (isset($_POST["extrachannel"])) {$extrachannel=$_POST["extrachannel"];} +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["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} + elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["secondS"])) {$secondS=$_GET["secondS"];} + elseif (isset($_POST["secondS"])) {$secondS=$_POST["secondS"];} +if (isset($_GET["outbound_cid"])) {$outbound_cid=$_GET["outbound_cid"];} + elseif (isset($_POST["outbound_cid"])) {$outbound_cid=$_POST["outbound_cid"];} +if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];} + elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];} +if (isset($_GET["call_server_ip"])) {$call_server_ip=$_GET["call_server_ip"];} + elseif (isset($_POST["call_server_ip"])) {$call_server_ip=$_POST["call_server_ip"];} +if (isset($_GET["CalLCID"])) {$CalLCID=$_GET["CalLCID"];} + elseif (isset($_POST["CalLCID"])) {$CalLCID=$_POST["CalLCID"];} +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["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} +if (isset($_GET["phone_ip"])) {$phone_ip=$_GET["phone_ip"];} + elseif (isset($_POST["phone_ip"])) {$phone_ip=$_POST["phone_ip"];} +if (isset($_GET["enable_sipsak_messages"])) {$enable_sipsak_messages=$_GET["enable_sipsak_messages"];} + elseif (isset($_POST["enable_sipsak_messages"])) {$enable_sipsak_messages=$_POST["enable_sipsak_messages"];} +if (isset($_GET["allow_sipsak_messages"])) {$allow_sipsak_messages=$_GET["allow_sipsak_messages"];} + elseif (isset($_POST["allow_sipsak_messages"])) {$allow_sipsak_messages=$_POST["allow_sipsak_messages"];} + +$user=ereg_replace("[^0-9a-zA-Z]","",$user); +$pass=ereg_replace("[^0-9a-zA-Z]","",$pass); +$secondS = ereg_replace("[^0-9]","",$secondS); + +# default optional vars if not set +if (!isset($ACTION)) {$ACTION="Originate";} +if (!isset($format)) {$format="alert";} +if (!isset($ext_priority)) {$ext_priority="1";} + +$version = '2.0.29'; +$build = '70320-1502'; +$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 "\n"; +echo "\n"; +echo "\n"; +echo "Enviar al Manager: "; +if ($ACTION=="Originate") {echo "Originate";} +if ($ACTION=="Redirect") {echo "Redirect";} +if ($ACTION=="RedirectName") {echo "RedirectName";} +if ($ACTION=="Hangup") {echo "Hangup";} +if ($ACTION=="Command") {echo "Command";} +if ($ACTION==99999) {echo "AYUDA";} +echo "\n"; +echo "\n"; +echo "\n"; +} + + + + + +###################### +# ACTION=SysCIDOriginate - insert Originate Manager statement allowing small CIDs for system calls +###################### +if ($ACTION=="SysCIDOriginate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<1) ) + { + echo "Exten $exten No es válido or queryCID $queryCID No es válido, Originate comando no insertado\n"; + } + else + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate comando enviado a Exten $exten Canal $channel en $server_ip\n"; + } +} + + + +###################### +# ACTION=Originate, OriginateName, OriginateNameVmail - insert Originate Manager statement +###################### +if ($ACTION=="OriginateName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Una de estas variables No es válido:\n"; + echo "Canal $channel debe ser mayor de 2 caracteres\n"; + echo "queryCID $queryCID debe ser mayor de 14 caracteres\n"; + echo "extenName $extenName debe ser fijado\n"; + echo "ext_context $ext_context debe ser fijado\n"; + echo "ext_priority $ext_priority debe ser fijado\n"; + echo "\nOriginateName Action no enviado\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="OriginateNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Una de estas variables No es válido:\n"; + echo "Canal $channel debe ser mayor de 2 caracteres\n"; + echo "queryCID $queryCID debe ser mayor de 14 caracteres\n"; + echo "extenName $extenName debe ser fijado\n"; + echo "exten $exten debe ser fijado\n"; + echo "ext_context $ext_context debe ser fijado\n"; + echo "ext_priority $ext_priority debe ser fijado\n"; + echo "\nOriginateNameVmail Action no enviado\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="OriginateVDRelogin") +{ + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $CIDdate = date("ymdHis"); + $DS='-'; + $SIPSAK_prefix = 'LIN-'; + print "\n"; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$campaign\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + $queryCID = "$SIPSAK_prefix$campaign$DS$CIDdate"; + + } + $ACTION="Originate"; +} + +if ($ACTION=="Originate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<10) ) + { + echo "Exten $exten No es válido or queryCID $queryCID No es válido, Originate comando no insertado\n"; + } + else + { + if (strlen($outbound_cid)>1) + {$outCID = "\"$queryCID\" <$outbound_cid>";} + else + {$outCID = "$queryCID";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate comando enviado a Exten $exten Canal $channel en $server_ip\n"; + } +} + + + +###################### +# ACTION=HangupConfDial - find the Local channel that is in the conference and needs to be hung up +###################### +if ($ACTION=="HangupConfDial") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($queryCID)<15) or (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "conference $exten No es válido or ext_context $ext_context or queryCID $queryCID No es válido, Hangup comando no insertado\n"; + } + else + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $hangup_channel_prefix = "$local_DEF$exten$local_AMP$ext_context"; + + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row > 0) + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $channel=$rowx[0]; + $ACTION="Hangup"; + $queryCID = eregi_replace("^.","G",$queryCID); + } + } +} + + + +###################### +# ACTION=Hangup - insert Hangup Manager statement +###################### +if ($ACTION=="Hangup") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) ) + { + $channel_live=0; + echo "Canal $channel No es válido or queryCID $queryCID No es válido, Hangup comando no insertado\n"; + } + else + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + +# $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# if ($row[0]==0) +# { +# $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $rowx=mysql_fetch_row($rslt); +# if ($rowx[0]==0) +# { +# $channel_live=0; +# echo "Channel $channel is not live on $call_server_ip, Hangup command not inserted\n"; +# } +# } + if ( ($auto_dial_level > 0) and (strlen($CalLCID)>2) and (strlen($exten)>2) and ($secondS > 4)) + { + $stmt="SELECT count(*) FROM vicidial_auto_calls where channel='$channel' and callerid='$CalLCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + echo "Call $CalLCID $channel no está activo en $call_server_ip, Checking Live Canal...\n"; + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel' and extension LIKE \"%$exten\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $channel_live=0; + echo "Canal $channel no está activo en $call_server_ip, Hangup comando no insertado $rowx[0]\n$stmt\n"; + } + else + { + echo "$stmt\n"; + } + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Hangup','$queryCID','Channel: $channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Hangup comando enviado a Canal $channel en $call_server_ip\n"; + } + } +} + + + +###################### +# ACTION=Redirect, RedirectName, RedirectNameVmail, RedirectToPark, RedirectFromPark, RedirectVD, RedirectXtra, RedirectXtraCX +# - insert Redirect Manager statement using extensions name +###################### +if ($ACTION=="RedirectVD") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($campaign)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($uniqueid)<2) or (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "Una de estas variables No es válido:\n"; + echo "Canal $channel debe ser mayor de 2 caracteres\n"; + echo "queryCID $queryCID debe ser mayor de 14 caracteres\n"; + echo "exten $exten debe ser fijado\n"; + echo "ext_context $ext_context debe ser fijado\n"; + echo "ext_priority $ext_priority debe ser fijado\n"; + echo "auto_dial_level $auto_dial_level debe ser fijado\n"; + echo "campaign $campaign debe ser fijado\n"; + echo "uniqueid $uniqueid debe ser fijado\n"; + echo "lead_id $lead_id debe ser fijado\n"; + echo "\nRedirectVD Action no enviado\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($auto_dial_level < 1) + { + $stmt = "UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectToPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($parkedby)<1) ) + { + $channel_live=0; + echo "Una de estas variables No es válido:\n"; + echo "Canal $channel debe ser mayor de 2 caracteres\n"; + echo "queryCID $queryCID debe ser mayor de 14 caracteres\n"; + echo "exten $exten debe ser fijado\n"; + echo "extenName $extenName debe ser fijado\n"; + echo "ext_context $ext_context debe ser fijado\n"; + echo "ext_priority $ext_priority debe ser fijado\n"; + echo "parkedby $parkedby debe ser fijado\n"; + echo "\nRedirectToPark Action no enviado\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "INSERT INTO parked_channels values('$channel','$server_ip','','$extenName','$parkedby','$NOW_TIME');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectFromPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Una de estas variables No es válido:\n"; + echo "Canal $channel debe ser mayor de 2 caracteres\n"; + echo "queryCID $queryCID debe ser mayor de 14 caracteres\n"; + echo "exten $exten debe ser fijado\n"; + echo "ext_context $ext_context debe ser fijado\n"; + echo "ext_priority $ext_priority debe ser fijado\n"; + echo "\nRedirectFromPark Action no enviado\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "DELETE FROM parked_channels where server_ip='$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Una de estas variables No es válido:\n"; + echo "Canal $channel debe ser mayor de 2 caracteres\n"; + echo "queryCID $queryCID debe ser mayor de 14 caracteres\n"; + echo "extenName $extenName debe ser fijado\n"; + echo "ext_context $ext_context debe ser fijado\n"; + echo "ext_priority $ext_priority debe ser fijado\n"; + echo "\nRedirectName Action no enviado\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Una de estas variables No es válido:\n"; + echo "Canal $channel debe ser mayor de 2 caracteres\n"; + echo "queryCID $queryCID debe ser mayor de 14 caracteres\n"; + echo "extenName $extenName debe ser fijado\n"; + echo "exten $exten debe ser fijado\n"; + echo "ext_context $ext_context debe ser fijado\n"; + echo "ext_priority $ext_priority debe ser fijado\n"; + echo "\nRedirectNameVmail Action no enviado\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectXtraCX") +{ + $DBout=''; + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "Una de estas variables No es válido:\n"; + echo "Canal $channel debe ser mayor de 2 caracteres\n"; + echo "ExtraCanal $extrachannel debe ser mayor de 2 caracteres\n"; + echo "queryCID $queryCID debe ser mayor de 14 caracteres\n"; + echo "exten $exten debe ser fijado\n"; + echo "ext_context $ext_context debe ser fijado\n"; + echo "ext_priority $ext_priority debe ser fijado\n"; + echo "\nRedirect Action no enviado\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDCXC|$filename|$user|$campaign|$channel|$extrachannel|$queryCID|$exten|$ext_context|ext_priority|\n"); + fclose($fp); + } + } + } + else + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Canal $channel no está activo en $call_server_ip, Redirect comando no insertado\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel no está activo en $call_server_ip";} + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Canal $channel no está activo en $server_ip, Redirect comando no insertado\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel no está activo en $server_ip";} + } + } + if ( ($channel_liveX==1) && ($channel_liveY==1) ) + { + $stmt="SELECT count(*) FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0] < 1) + { + $channel_liveY=0; + echo "No Local agent to send call to, Redirect comando no insertado\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "No Local agent to send call to";} + } + else + { + $stmt="SELECT server_ip,conf_exten,user FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $dest_server_ip = $rowx[0]; + $dest_session_id = $rowx[1]; + $dest_user = $rowx[2]; + $S='*'; + + $D_s_ip = explode('.', $dest_server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$dest_session_id$S$lead_id$S$dest_user$S$phone_code$S$phone_number$S$campaign$S"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','$queryCID','Channel: $extrachannel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtraCX comando enviado a Canal $channel en $call_server_ip and \nHungup $extrachannel en $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel en $call_server_ip, Hungup $extrachannel en $server_ip";} + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "Changed to Redirect: $channel en $server_ip";} + } + + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDCXC|$filename|$user|$campaign|$DBout|\n"); + fclose($fp); + } + } + + } +} + +if ($ACTION=="RedirectXtra") +{ + if ($channel=="$extrachannel") + {$ACTION="Redirect";} + else + { + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "Una de estas variables No es válido:\n"; + echo "Canal $channel debe ser mayor de 2 caracteres\n"; + echo "ExtraCanal $extrachannel debe ser mayor de 2 caracteres\n"; + echo "queryCID $queryCID debe ser mayor de 14 caracteres\n"; + echo "exten $exten debe ser fijado\n"; + echo "ext_context $ext_context debe ser fijado\n"; + echo "ext_priority $ext_priority debe ser fijado\n"; + echo "\nRedirect Action no enviado\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDX|$filename|$user|$campaign|$$channel|$extrachannel|$queryCID|$exten|$ext_context|ext_priority|\n"); + fclose($fp); + } + } + } + else + { + if ($exten == "NEXTAVAILABLE") + { + $stmt="SELECT conf_exten FROM conferences where server_ip='$server_ip' and ((extension='') or (extension is null)) limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if (strlen($row[0]) > 3) + { + $stmt="UPDATE conferences set extension='$user' where server_ip='$server_ip' and conf_exten='$row[0]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $exten = $row[0]; + } + else + { + $channel_liveX=0; + echo "No puede encontrar conferencia vacía en $server_ip, Redirect comando no insertado\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "No puede encontrar conferencia vacía en $server_ip";} + } + } + + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Canal $channel no está activo en $call_server_ip, Redirect comando no insertado\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel no está activo en $call_server_ip";} + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Canal $channel no está activo en $server_ip, Redirect comando no insertado\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel no está activo en $server_ip";} + } + } + if ( ($channel_liveX==1) && ($channel_liveY==1) ) + { + if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','ExtraChannel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra comando enviado a Canal $channel and \nExtraCanal $extrachannel\n to $exten en $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel and $extrachannel to $exten en $server_ip";} + } + else + { + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$exten"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra comando enviado a Canal $channel en $call_server_ip and \nExtraCanal $extrachannel\n to $exten en $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel/$call_server_ip and $extrachannel/$server_ip to $exten";} + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + + } + + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDX|$filename|$user|$campaign|$DBout|\n"); + fclose($fp); + } + } + + } + } +} + + +if ($ACTION=="Redirect") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Una de estas variables No es válido:\n"; + echo "Canal $channel debe ser mayor de 2 caracteres\n"; + echo "queryCID $queryCID debe ser mayor de 14 caracteres\n"; + echo "exten $exten debe ser fijado\n"; + echo "ext_context $ext_context debe ser fijado\n"; + echo "ext_priority $ext_priority debe ser fijado\n"; + echo "\nRedirect Action no enviado\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Canal $channel no está activo en $server_ip, Redirect comando no insertado\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "Redirect comando enviado a Canal $channel en $server_ip\n"; + } + } +} + + + +###################### +# ACTION=Monitor or Stop Monitor - insert Monitor/StopMonitor Manager statement to start recording on a channel +###################### +if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) +{ + if ($ACTION=="StopMonitor") + {$SQLfile = "";} + else + {$SQLfile = "File: $filename";} + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Canal $channel No es válido or queryCID $queryCID No es válido or filename: $filename No es válido, $ACTION comando no insertado\n"; + } + else + { + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Canal $channel no está activo en $server_ip, $ACTION comando no insertado\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','$ACTION','$queryCID','Channel: $channel','$SQLfile','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + if ($ACTION=="Monitor") + { + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + } + echo "$ACTION comando enviado a Canal $channel en $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n"; + } + } +} + + + + + + +###################### +# ACTION=MonitorConf or StopMonitorConf - insert Monitor/StopMonitor Manager statement to start recording on a conference +###################### +if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($channel)<4) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Canal $channel No es válido or exten $exten No es válido or filename: $filename No es válido, $ACTION comando no insertado\n"; + } + else + { + + if ($ACTION=="MonitorConf") + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$filename','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $filename','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + # find and hang up all recordings going en in this conference # and extension = '$exten' + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$channel%\" and channel LIKE \"%,1\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + # $rec_count = intval(mysql_num_rows($rslt) / 2); + $rec_count = mysql_num_rows($rslt); + $h=0; + while ($rec_count>$h) + { + $rowx=mysql_fetch_row($rslt); + $HUchannel[$h] = $rowx[0]; + $h++; + } + $i=0; + while ($h>$i) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$i','Channel: $HUchannel[$i]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $i++; + } + + } + echo "$ACTION comando enviado a Canal $channel en $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n LA GRABACIÓN DURARà HASTA 60 MINUTOS\n"; + } +} + + + + + +###################### +# ACTION=VolumeControl - raise or lower the volume of a meetme participant +###################### +if ($ACTION=="VolumeControl") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($stage)<1) or (strlen($queryCID)<1) ) + { + echo "Conferencia $exten, Stage $stage No es válido or queryCID $queryCID No es válido, Originate comando no insertado\n"; + } + else + { + $participant_number='XXYYXXYYXXYYXX'; + if (eregi('UP',$stage)) {$vol_prefix='4';} + if (eregi('DOWN',$stage)) {$vol_prefix='3';} + if (eregi('UNMUTE',$stage)) {$vol_prefix='2';} + if (eregi('MUTING',$stage)) {$vol_prefix='1';} + $local_DEF = 'Local/'; + $local_AMP = '@'; + $volume_local_channel = "$local_DEF$participant_number$vol_prefix$exten$local_AMP$ext_context"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $volume_local_channel','Context: $ext_context','Exten: 8300','Priority: 1','Callerid: $queryCID','','','','$channel','$exten');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Volume comando enviado a Conferencia $exten, Stage $stage Canal $channel en $server_ip\n"; + } +} + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='debug') {echo "\n";} +if ($format=='debug') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/park_calls_display.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/park_calls_display.php new file mode 100644 index 00000000..20b4c114 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/park_calls_display.php @@ -0,0 +1,146 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "\n"; +echo "\n"; +echo "\n"; +echo "Mostrar Llamadas Aparcadas"; +echo "\n"; +echo "\n"; +echo "\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 * from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;"; + if ($format=='debug') {echo "\n";} + $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"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/vdc_db_query.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/vdc_db_query.php new file mode 100644 index 00000000..a0cba6aa --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/vdc_db_query.php @@ -0,0 +1,2535 @@ + LICENSE: GPLv2 +# +# 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 - ('regCLOSER','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCALL','manDiaLlogCALL','userLOGout','updateDISPO','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs','CalLBacKLisT','CalLBacKCounT','PauseCodeSubmit','LogiNCamPaigns') +# - $stage - ('start','finish','lookup','new') +# - $closer_choice - ('CL_TESTCAMP_L CL_OUT123_L -') +# - $conf_exten - ('8600011',...) +# - $exten - ('123test',...) +# - $ext_context - ('default','demo',...) +# - $ext_priority - ('1','2',...) +# - $campaign - ('testcamp',...) +# - $dial_timeout - ('60','26',...) +# - $dial_prefix - ('9','8',...) +# - $campaign_cid - ('3125551212','0000000000',...) +# - $MDnextCID - ('M06301413000000002',...) +# - $uniqueid - ('1120232758.2406800',...) +# - $lead_id - ('36524',...) +# - $list_id - ('101','123456',...) +# - $length_in_sec - ('12',...) +# - $phone_code - ('1',...) +# - $phone_number - ('3125551212',...) +# - $channel - ('Zap/12-1',...) +# - $start_epoch - ('1120236911',...) +# - $vendor_lead_code - ('1234test',...) +# - $title - ('Mr.',...) +# - $first_name - ('Bob',...) +# - $middle_initial - ('L',...) +# - $last_name - ('Wilson',...) +# - $address1 - ('1324 Main St.',...) +# - $address2 - ('Apt. 12',...) +# - $address3 - ('co Robert Wilson',...) +# - $city - ('Chicago',...) +# - $state - ('IL',...) +# - $province - ('NA',...) +# - $postal_code - ('60054',...) +# - $country_code - ('USA',...) +# - $gender - ('M',...) +# - $date_of_birth - ('1970-01-01',...) +# - $alt_phone - ('3125551213',...) +# - $email - ('bob@bob.com',...) +# - $security_phrase - ('Hello',...) +# - $comments - ('Good Customer',...) +# - $auto_dial_level - ('0','1','1.2',...) +# - $VDstop_rec_after_each_call - ('0','1') +# - $conf_silent_prefix - ('7','8','',...) +# - $extension - ('123','user123','25-1',...) +# - $protocol - ('Zap','SIP','IAX2',...) +# - $user_abb - ('1234','6666',...) +# - $preview - ('YES','NO',...) +# - $called_count - ('0','1','2',...) +# - $agent_log_id - ('123456',...) +# - $agent_log - ('NO',...) +# - $favorites_list - (",'cc160','cc100'",...) +# - $CallBackDatETimE - ('2006-04-21 14:30:00',...) +# - $recipient - ('ANYONE,'USERONLY') +# - $callback_id - ('12345','12346',...) +# - $use_internal_dnc - ('Y','N') +# - $omit_phone_code - ('Y','N') +# - $no_delete_sessions - ('0','1') + +# CHANGELOG: +# 50629-1044 - First build of script +# 50630-1422 - Added manual dial action and MD channel lookup +# 50701-1451 - Added dial log for start and end of vicidial calls +# 50705-1239 - Added call disposition update +# 50804-1627 - Fixed updateDispo to update vicidial_log entry +# 50816-1605 - Added VDADpause/ready for auto dialing +# 50816-1811 - Added basic autodial call pickup functions +# 50817-1005 - Altered logging functions to accomodate auto_dialing +# 50818-1305 - Added stop-all-recordings-after-each-vicidial-call option +# 50818-1411 - Added hangup of agent phone after Logout +# 50901-1315 - Fixed CLOSER IN-GROUP Web Form bug +# 50902-1507 - Fixed CLOSER log length_in_sec bug +# 50902-1730 - Added functions for manual preview dialing and revert +# 50913-1214 - Added agent random update to leadupdate +# 51020-1421 - Added agent_log_id framework for detailed agent activity logging +# 51021-1717 - Allows for multi-line comments (changes \n to !N in database) +# 51111-1046 - Added vicidial_agent_log lead_id earlier for manual dial +# 51121-1445 - Altered echo statements for several small PHP speed optimizations +# 51122-1328 - Fixed UserLogout issue not removing conference reservation +# 51129-1012 - Added ability to accept calls from other VICIDIAL servers +# 51129-1729 - Changed manual dial to use the '/n' flag for calls +# 51221-1154 - Added SCRIPT id lookup and sending to vicidial.php for display +# 60105-1059 - Added Updating of astguiclient favorites in the DB +# 60208-1617 - Added dtmf buttons output per call +# 60213-1521 - Added closer_campaigns update to vicidial_users +# 60215-1036 - Added Callback date-time entry into vicidial_callbacks table +# 60413-1541 - Added USERONLY Callback listings output - CalLBacKLisT +# - Added USERONLY Callback count output - CalLBacKCounT +# 60414-1140 - Added Callback lead lookup for manual dialing +# 60419-1517 - After CALLBK is sent to agent, update callback record to INACTIVE +# 60421-1419 - Check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60427-1236 - Fixed closer_choice error for CLOSER campaigns +# 60609-1148 - Added ability to check for manual dial numbers in DNC +# 60619-1117 - Added variable filters to close security holes for login form +# 60623-1414 - Fixed variable filter for phone_code and fixed manual dial logic +# 60821-1600 - Added ability to omit the phone code on vicidial lead dialing +# 60821-1647 - Added ability to not delete sessions at logout +# 60906-1124 - Added lookup and sending of callback data for CALLBK calls +# 61128-2229 - Added vicidial_live_agents and vicidial_auto_calls manual dial entries +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70115-1733 - Added alt_dial functionality in auto-dial modes +# 70118-1501 - Added user_group to vicidial_log,_agent_log,_closer_log,_callbacks +# 70123-1357 - Fixed bug that would not update vicidial_closer_log status to dispo +# 70202-1438 - Added pause code submit function +# 70203-0930 - Added dialed_number to lead info output +# 70203-1030 - Added dialed_label to lead info output +# 70206-1126 - Added INBOUND status for inbound/closer calls in vicidial_live_agents +# 70212-1253 - Fixed small issue with CXFER +# 70213-1431 - Added QueueMetrics PAUSE/UNPAUSE/AGENTLOGIN/AGENTLOGOFF actions +# 70214-1231 - Added queuemetrics_log_id field for server_id in queue_log +# 70215-1210 - Added queuemetrics COMPLETEAGENT action +# 70216-1051 - Fixed double call complete queuemetrics logging +# 70222-1616 - Changed queue_log PAUSE/UNPAUSE to PAUSEALL/UNPAUSEALL +# 70309-1034 - Allow amphersands and questions marks in comments to pass through +# 70313-1052 - Allow pound signs(hash) in comments to pass through +# 70319-1544 - Added agent disable update customer data function +# 70322-1545 - Added sipsak display ability +# 70413-1253 - Fixed bug for outbound call time in CLOSER-type blended campaigns +# 70424-1100 - Fixed bug for fronter/closer calls that would delete vdac records +# 70802-1729 - Fixed bugs with pause_sec and wait_sec under certain call handling +# 70828-1443 - Added source_id to output of SCRIPTtab-IFRAME and WEBFORM +# 71029-1855 - removed campaign_id naming restrictions for CLOSER-type campaigns +# 71030-2047 - added hopper priority for auto alt dial entries +# 71116-1011 - added calls_today count updating of the vicidial_live_agents upon INCALL +# 71120-1520 - added LogiNCamPaigns to show only allowed campaigns for agents upon login +# 71125-1751 - Added inbound-group default inbound group sending to vicidial.php +# 71129-2025 - restricted callbacks count and list to campaign only +# + +$version = '2.0.4-65'; +$build = '71129-2025'; + +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["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["closer_choice"])) {$closer_choice=$_GET["closer_choice"];} + elseif (isset($_POST["closer_choice"])) {$closer_choice=$_POST["closer_choice"];} +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["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["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["dial_timeout"])) {$dial_timeout=$_GET["dial_timeout"];} + elseif (isset($_POST["dial_timeout"])) {$dial_timeout=$_POST["dial_timeout"];} +if (isset($_GET["dial_prefix"])) {$dial_prefix=$_GET["dial_prefix"];} + elseif (isset($_POST["dial_prefix"])) {$dial_prefix=$_POST["dial_prefix"];} +if (isset($_GET["campaign_cid"])) {$campaign_cid=$_GET["campaign_cid"];} + elseif (isset($_POST["campaign_cid"])) {$campaign_cid=$_POST["campaign_cid"];} +if (isset($_GET["MDnextCID"])) {$MDnextCID=$_GET["MDnextCID"];} + elseif (isset($_POST["MDnextCID"])) {$MDnextCID=$_POST["MDnextCID"];} +if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} + elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["length_in_sec"])) {$length_in_sec=$_GET["length_in_sec"];} + elseif (isset($_POST["length_in_sec"])) {$length_in_sec=$_POST["length_in_sec"];} +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["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["start_epoch"])) {$start_epoch=$_GET["start_epoch"];} + elseif (isset($_POST["start_epoch"])) {$start_epoch=$_POST["start_epoch"];} +if (isset($_GET["dispo_choice"])) {$dispo_choice=$_GET["dispo_choice"];} + elseif (isset($_POST["dispo_choice"])) {$dispo_choice=$_POST["dispo_choice"];} +if (isset($_GET["vendor_lead_code"])) {$vendor_lead_code=$_GET["vendor_lead_code"];} + elseif (isset($_POST["vendor_lead_code"])) {$vendor_lead_code=$_POST["vendor_lead_code"];} +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["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["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_GET["VDstop_rec_after_each_call"];} + elseif (isset($_POST["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_POST["VDstop_rec_after_each_call"];} +if (isset($_GET["conf_silent_prefix"])) {$conf_silent_prefix=$_GET["conf_silent_prefix"];} + elseif (isset($_POST["conf_silent_prefix"])) {$conf_silent_prefix=$_POST["conf_silent_prefix"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} +if (isset($_GET["user_abb"])) {$user_abb=$_GET["user_abb"];} + elseif (isset($_POST["user_abb"])) {$user_abb=$_POST["user_abb"];} +if (isset($_GET["preview"])) {$preview=$_GET["preview"];} + elseif (isset($_POST["preview"])) {$preview=$_POST["preview"];} +if (isset($_GET["called_count"])) {$called_count=$_GET["called_count"];} + elseif (isset($_POST["called_count"])) {$called_count=$_POST["called_count"];} +if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];} + elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];} +if (isset($_GET["agent_log"])) {$agent_log=$_GET["agent_log"];} + elseif (isset($_POST["agent_log"])) {$agent_log=$_POST["agent_log"];} +if (isset($_GET["favorites_list"])) {$favorites_list=$_GET["favorites_list"];} + elseif (isset($_POST["favorites_list"])) {$favorites_list=$_POST["favorites_list"];} +if (isset($_GET["CallBackDatETimE"])) {$CallBackDatETimE=$_GET["CallBackDatETimE"];} + elseif (isset($_POST["CallBackDatETimE"])) {$CallBackDatETimE=$_POST["CallBackDatETimE"];} +if (isset($_GET["recipient"])) {$recipient=$_GET["recipient"];} + elseif (isset($_POST["recipient"])) {$recipient=$_POST["recipient"];} +if (isset($_GET["callback_id"])) {$callback_id=$_GET["callback_id"];} + elseif (isset($_POST["callback_id"])) {$callback_id=$_POST["callback_id"];} +if (isset($_GET["use_internal_dnc"])) {$use_internal_dnc=$_GET["use_internal_dnc"];} + elseif (isset($_POST["use_internal_dnc"])) {$use_internal_dnc=$_POST["use_internal_dnc"];} +if (isset($_GET["omit_phone_code"])) {$omit_phone_code=$_GET["omit_phone_code"];} + elseif (isset($_POST["omit_phone_code"])) {$omit_phone_code=$_POST["omit_phone_code"];} +if (isset($_GET["phone_ip"])) {$phone_ip=$_GET["phone_ip"];} + elseif (isset($_POST["phone_ip"])) {$phone_ip=$_POST["phone_ip"];} +if (isset($_GET["enable_sipsak_messages"])) {$enable_sipsak_messages=$_GET["enable_sipsak_messages"];} + elseif (isset($_POST["enable_sipsak_messages"])) {$enable_sipsak_messages=$_POST["enable_sipsak_messages"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} + + +$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); + + +# default optional vars if not set +if (!isset($format)) {$format="text";} + if ($format == 'debug') {$DB=1;} +if (!isset($ACTION)) {$ACTION="refresh";} + +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$CIDdate = date("mdHis"); +$ENTRYdate = date("YmdHis"); +if (!isset($query_date)) {$query_date = $NOW_DATE;} +$MT[0]=''; +$agents='@agents'; + +if ($ACTION == 'LogiNCamPaigns') + { + $skip_user_validation=1; + } +else + { + $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 "\n"; +echo "\n"; +echo "\n"; +echo "VICIDiaL Database Query Script"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + +################################################################################ +### LogiNCamPaigns - generates an HTML SELECT list of allowed campaigns for a +### specific agent on the login screen +################################################################################ +if ($ACTION == 'LogiNCamPaigns') +{ + if ( (strlen($user)<1) ) + { + echo "\n"; + exit; + } + else + { + echo "\n"; + exit; + } +} + + + +################################################################################ +### regCLOSER - update the vicidial_live_agents table to reflect the closer +### inbound choices made upon login +################################################################################ +if ($ACTION == 'regCLOSER') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($closer_choice)<1) || (strlen($user)<1) ) + { + $channel_live=0; + echo "Opción Del Grupo $closer_choice No es válido\n"; + exit; + } + else + { + if ($closer_choice == "MGRLOCK-") + { + $stmt="SELECT closer_campaigns FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $closer_choice =$row[0]; + + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_users set closer_campaigns='$closer_choice' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $in_groups_pre = preg_replace('/-$/','',$closer_choice); + $in_groups = explode(" ",$in_groups_pre); + $in_groups_ct = count($in_groups); + $k=1; + while ($k < $in_groups_ct) + { + if (strlen($in_groups[$k])>1) + { + $stmt="SELECT group_weight,calls_today FROM vicidial_inbound_group_agents where user='$user' and group_id='$in_groups[$k]';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $viga_ct = mysql_num_rows($rslt); + if ($viga_ct > 0) + { + $row=mysql_fetch_row($rslt); + $group_weight = $row[0]; + $calls_today = $row[1]; + } + else + { + $group_weight = 0; + $calls_today = 0; + } + $stmt="INSERT INTO vicidial_live_inbound_agents set user='$user',group_id='$in_groups[$k]',group_weight='$group_weight',calls_today='$calls_today',last_call_time='$NOW_TIME',last_call_finish='$NOW_TIME';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + $k++; + } + + } + echo "Closer In Opción Del Grupo $closer_choice se ha registrado al usuario $user\n"; +} + + +################################################################################ +### manDiaLnextCALL - for manual VICIDiaL dialing this will grab the next lead +### in the campaign, reserve it, send data back to client and +### place the call by inserting into vicidial_manager +################################################################################ +if ($ACTION == 'manDiaLnextCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "TOLVA VACÃA\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context No es válido\n"; + exit; + } + else + { + + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### check if this is a callback, if it is, skip the grabbing of a new lead and mark the callback as INACTIVE + if ( (strlen($callback_id)>0) and (strlen($lead_id)>0) ) + { + $affected_rows=1; + $CBleadIDset=1; + + $stmt = "UPDATE vicidial_callbacks set status='INACTIVE' where callback_id='$callback_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + if (strlen($phone_number)>3) + { + if ($use_internal_dnc=='Y') + { + $stmt="SELECT count(*) FROM vicidial_dnc where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + echo "DNC NÚMERO\n"; + exit; + } + } + if ($stage=='lookup') + { + $stmt="SELECT lead_id FROM vicidial_list where phone_number='$phone_number' order by modify_date desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $man_leadID_ct = mysql_num_rows($rslt); + if ($man_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $affected_rows=1; + $lead_id =$row[0]; + $CBleadIDset=1; + } + else + { + ### insert a new lead in the system with this phone number + $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $lead_id = mysql_insert_id($link); + $CBleadIDset=1; + } + } + else + { + ### insert a new lead in the system with this phone number + $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $lead_id = mysql_insert_id($link); + $CBleadIDset=1; + } + } + else + { + ### grab the next lead in the hopper for this campaign and reserve it for the user + $stmt = "UPDATE vicidial_hopper set status='QUEUE', user='$user' where campaign_id='$campaign' and status='READY' order by hopper_id LIMIT 1"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + } + } + + if ($affected_rows > 0) + { + if (!$CBleadIDset) + { + ##### grab the lead_id of the reserved user in vicidial_hopper + $stmt="SELECT lead_id FROM vicidial_hopper where campaign_id='$campaign' and status='QUEUE' and user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $hopper_leadID_ct = mysql_num_rows($rslt); + if ($hopper_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + } + } + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $source_id = trim("$row[6]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + $called_count++; + + ##### check if system is set to generate logfile for transfers + $stmt="SELECT enable_agc_xfer_log FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enable_agc_xfer_log_ct = mysql_num_rows($rslt); + if ($enable_agc_xfer_log_ct > 0) + { + $row=mysql_fetch_row($rslt); + $enable_agc_xfer_log =$row[0]; + } + + if ( ($WeBRooTWritablE > 0) and ($enable_agc_xfer_log > 0) ) + { + # DATETIME|campaign|lead_id|phone_number|user|type + # 2007-08-22 11:11:11|TESTCAMP|65432|3125551212|1234|M + $fp = fopen ("./xfer_log.txt", "a"); + fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$phone_number|$user|M\n"); + fclose($fp); + } + + ##### if lead is a callback, grab the callback comments + $CBentry_time = ''; + $CBcallback_time = ''; + $CBuser = ''; + $CBcomments = ''; + if (ereg("CALLBK",$dispo)) + { + $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBentry_time = trim("$row[0]"); + $CBcallback_time = trim("$row[1]"); + $CBuser = trim("$row[2]"); + $CBcomments = trim("$row[3]"); + } + } + + ### flag the lead as called and change it's status to INCALL + $stmt = "UPDATE vicidial_list set status='INCALL', called_since_last_reset='Y', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + if (!$CBleadIDset) + { + ### delete the lead from the hopper + $stmt = "DELETE FROM vicidial_hopper where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $stmt="UPDATE vicidial_agent_log set lead_id='$lead_id',comments='MANUAL' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + ### if preview dialing, do not send the call + if ( (strlen($preview)<1) || ($preview == 'NO') ) + { + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### whether to omit phone_code or not + if (eregi('Y',$omit_phone_code)) + {$Ndialstring = "$Local_out_prefix$phone_number";} + else + {$Ndialstring = "$Local_out_prefix$phone_code$phone_number";} + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$server_ip','$campaign','XFER','$lead_id','$MqueryCID','$phone_code','$phone_number','$NOW_TIME','OUT')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',callerid='$MqueryCID',lead_id='$lead_id',comments='MANUAL',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update calls_today count in vicidial_campaign_agents + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $MqueryCID . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + $LeaD_InfO .= $CBentry_time . "\n"; + $LeaD_InfO .= $CBcallback_time . "\n"; + $LeaD_InfO .= $CBuser . "\n"; + $LeaD_InfO .= $CBcomments . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= "MAIN\n"; + $LeaD_InfO .= $source_id . "\n"; + + echo $LeaD_InfO; + + } + else + { + echo "TOLVA VACÃA\n"; + } + } +} + + +################################################################################ +### manDiaLskip - for manual VICIDiaL dialing this skips the lead that was +### previewed in the step above and puts it back in orig status +################################################################################ +if ($ACTION == 'manDiaLskip') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($stage)<1) || (strlen($called_count)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "LEAD NOT REVERTED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context No es válido\n"; + exit; + } + else + { + $called_count = ($called_count - 1); + ### flag the lead as called and change it's status to INCALL + $stmt = "UPDATE vicidial_list set status='$stage', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + + echo "LEAD REVERTED\n"; + } +} + + +################################################################################ +### manDiaLonly - for manual VICIDiaL dialing this sends the call that was +### previewed in the step above +################################################################################ +if ($ACTION == 'manDiaLonly') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) || (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo " LLAMADA NOT PLACED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context No es válido\n"; + exit; + } + else + { + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### whether to omit phone_code or not + if (eregi('Y',$omit_phone_code)) + {$Ndialstring = "$Local_out_prefix$phone_number";} + else + {$Ndialstring = "$Local_out_prefix$phone_code$phone_number";} + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$server_ip','$campaign','XFER','$lead_id','$MqueryCID','$phone_code','$phone_number','$NOW_TIME','OUT')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',callerid='$MqueryCID',lead_id='$lead_id',comments='MANUAL',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + echo "$MqueryCID\n"; + } +} + + +################################################################################ +### manDiaLlookCALL - for manual VICIDiaL dialing this will attempt to look up +### the trunk channel that the call was placed on +################################################################################ +if ($ACTION == 'manDiaLlookCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; +if (strlen($MDnextCID)<18) + { + echo "NO\n"; + echo "MDnextCID $MDnextCID No es válido\n"; + exit; + } +else + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT uniqueid,channel FROM vicidial_manager where callerid='$MDnextCID' and server_ip='$server_ip' and status='UPDATED' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $uniqueid =$row[0]; + $channel =$row[1]; + echo "$uniqueid\n$channel"; + + $wait_sec=0; + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',wait_epoch='$StarTtime',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + echo "NO\n"; + } + } +} + + + +################################################################################ +### manDiaLlogCALL - for manual VICIDiaL logging of calls places record in +### vicidial_log and then sends process to call_log entry +################################################################################ +if ($ACTION == 'manDiaLlogCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + +if ($stage == "start") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) || (strlen($list_id)<1) || (strlen($phone_number)<1) || (strlen($campaign)<1) ) + { + echo "REGISTRO NO ENTRADO\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id or list_id: $list_id or phone_number: $phone_number or campaign: $campaign No es válido\n"; + exit; + } + else + { + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + ##### insert log into vicidial_log for manual VICIDiaL call + $stmt="INSERT INTO vicidial_log (uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,comments,processed,user_group) values('$uniqueid','$lead_id','$list_id','$campaign','$NOW_TIME','$StarTtime','INCALL','$phone_code','$phone_number','$user','MANUAL','N','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "VICIDiaL_LOG Insertado: $uniqueid|$channel|$NOW_TIME\n"; + echo "$StarTtime\n"; + } + else + { + echo "REGISTRO NO ENTRADO\n"; + } + + $stmt = "UPDATE vicidial_auto_calls SET uniqueid='$uniqueid' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + # ##### insert log into call_log for manual VICIDiaL call + # $stmt = "INSERT INTO call_log (uniqueid,channel,server_ip,extension,number_dialed,caller_code,start_time,start_epoch) values('$uniqueid','$channel','$server_ip','$exten','$phone_code$phone_number','MD $user $lead_id','$NOW_TIME','$StarTtime')"; + # if ($DB) {echo "$stmt\n";} + # $rslt=mysql_query($stmt, $link); + # $affected_rows = mysql_affected_rows($link); + + # if ($affected_rows > 0) + # { + # echo "CALL_LOG Insertado: $uniqueid|$channel|$NOW_TIME"; + # } + # else + # { + # echo "REGISTRO NO ENTRADO\n"; + # } + } + } + +if ($stage == "end") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) ) + { + echo "REGISTRO NO ENTRADO\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id No es válido\n"; + exit; + } + else + { + if ($start_epoch < 1000) + { + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + ##### look for the start epoch in the vicidial_closer_log table + $stmt="SELECT start_epoch FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user' order by closecallid desc limit 1;"; + } + else + { + ##### look for the start epoch in the vicidial_log table + $stmt="SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + } + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch =$row[0]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($length_in_sec < 1) and ($row[0] > 0) ) + { + ##### start epoch in the vicidial_log table, couldn't find one in vicidial_closer_log + $stmt="SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch =$row[0]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + } + } + else {$length_in_sec = ($StarTtime - $start_epoch);} + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec',status='DONE' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + ############################################# + ##### COMIENZO QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + + if ($auto_dial_level > 0) + { + ### check to see if campaign has alt_dial enabled + $stmt="SELECT auto_alt_dial FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_alt_dial =$row[0]; + } + else {$auto_alt_dial = 'NONE';} + if (eregi("(ALT_ONLY|ADDR3_ONLY|ALT_AND_ADDR3)",$auto_alt_dial)) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT alt_dial FROM vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alt_dial =$row[0]; + } + else {$alt_dial = 'NONE';} + + if ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("(ALT_ONLY|ALT_AND_ADDR3)",$auto_alt_dial)) ) + { + $stmt="SELECT alt_phone,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alt_phone = $row[0]; + $alt_phone = eregi_replace("[^0-9]","",$alt_phone); + $gmt_offset_now = $row[1]; + $state = $row[2]; + } + else {$alt_phone = '';} + if (strlen($alt_phone)>5) + { + ### insert record into vicidial_hopper for alt_phone call attempt + $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ALT',user='',priority='25';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + } + if ( ( (eregi("(ALT)",$alt_dial)) and (eregi("ALT_AND_ADDR3",$auto_alt_dial)) ) or ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("ADDR3_ONLY",$auto_alt_dial)) ) ) + { + $stmt="SELECT address3,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $address3 = $row[0]; + $address3 = eregi_replace("[^0-9]","",$address3); + $gmt_offset_now = $row[1]; + $state = $row[2]; + } + else {$address3 = '';} + if (strlen($address3)>5) + { + ### insert record into vicidial_hopper for address3 call attempt + $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ADDR3',user='',priority='20';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + + if ($enable_queuemetrics_logging > 0) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_qm_ct = mysql_num_rows($rslt); + if ($VAC_qm_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_call_id = $row[0]; + $CLlead_id = $row[1]; + $CLphone_number = $row[2]; + $CLstatus = $row[3]; + $CLcampaign_id = $row[4]; + $CLphone_code = $row[5]; + $CLalt_dial = $row[6]; + $CLstage = $row[7]; + $CLcallerid = $row[8]; + $CLuniqueid = $row[9]; + } + + $CLstage = preg_replace("/.*-/",'',$CLstage); + if (strlen($CLstage) < 1) {$CLstage=0;} + + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt="SELECT count(*) from queue_log where call_id='$MDnextCID' and verb='COMPLETECALLER';"; + $rslt=mysql_query($stmt, $linkB); + if ($DB) {echo "$stmt\n";} + $VAC_cc_ct = mysql_num_rows($rslt); + if ($VAC_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $caller_complete = $row[0]; + } + + if ($caller_complete < 1) + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + } + mysql_close($linkB); + } + + ### delete call record from vicidial_auto_calls + $stmt = "DELETE from vicidial_auto_calls where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + + + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',lead_id='',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSAALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } + else + { + if ($enable_queuemetrics_logging > 0) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_qm_ct = mysql_num_rows($rslt); + if ($VAC_qm_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_call_id = $row[0]; + $CLlead_id = $row[1]; + $CLphone_number = $row[2]; + $CLstatus = $row[3]; + $CLcampaign_id = $row[4]; + $CLphone_code = $row[5]; + $CLalt_dial = $row[6]; + $CLstage = $row[7]; + $CLcallerid = $row[8]; + $CLuniqueid = $row[9]; + } + + $CLstage = preg_replace("/XFER|-/",'',$CLstage); + if ($CLstage < 0.25) {$CLstage=0;} + + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + + $stmt = "DELETE from vicidial_auto_calls lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',lead_id='',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSAALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } + + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' where uniqueid='$uniqueid' and lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "$uniqueid\n$channel\n"; + } + else + { + echo "REGISTRO NO ENTRADO\n\n"; + } + } + + echo $VDstop_rec_after_each_call . '|' . $extension . '|' . $conf_silent_prefix . '|' . $conf_exten . '|' . $user_abb . "|\n"; + + ##### if VICIDiaL call and hangup_after_each_call activated, find all recording + ##### channels and hang them up while entering info into recording_log and + ##### returning filename/recordingID + if ($VDstop_rec_after_each_call == 1) + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $total_rec=0; + $loop_count=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten' order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$rec_list = mysql_num_rows($rslt);} + while ($rec_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + if (preg_match("/Local\/$conf_silent_prefix$conf_exten\@/i",$row[0])) + { + $rec_channels[$total_rec] = "$row[0]"; + $total_rec++; + } + if ($format=='debug') {echo "\n";} + $loop_count++; + } + + $total_recFN=0; + $loop_count=0; + $filename=$MT; # not necessary : and cmd_line_f LIKE \"%_$user_abb\" + $stmt="SELECT cmd_line_f FROM vicidial_manager where server_ip='$server_ip' and action='Originate' and cmd_line_b = 'Channel: $local_DEF$conf_silent_prefix$conf_exten$local_AMP$ext_context' order by entry_date desc limit $total_rec;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$recFN_list = mysql_num_rows($rslt);} + while ($recFN_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + $filename[$total_recFN] = preg_replace("/Callerid: /i","",$row[0]); + if ($format=='debug') {echo "\n";} + $total_recFN++; + $loop_count++; + } + + $loop_count=0; + while($loop_count < $total_rec) + { + if (strlen($rec_channels[$loop_count])>5) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$loop_count','Channel: $rec_channels[$loop_count]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "REC_STOP|$rec_channels[$loop_count]|$filename[$loop_count]|"; + if (strlen($filename)>2) + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename[$loop_count]'"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$fn_count = mysql_num_rows($rslt);} + if ($fn_count) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt="UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename[$loop_count]' and end_epoch is NULL;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "$recording_id|$length_in_min|"; + } + else {echo "||";} + } + else {echo "||";} + echo "\n"; + } + $loop_count++; + } + } + + + $talk_sec=0; + $StarTtime = date("U"); + $stmt = "select talk_epoch,talk_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $talk_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set talk_sec='$talk_sec',talk_epoch='$StarTtime',dispo_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } +} + + +################################################################################ +### VDADREcheckINCOMING - for auto-dial VICIDiaL dialing this will recheck for +### calls to see if the channel has updated +################################################################################ +if ($ACTION == 'VDADREcheckINCOMING') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "Campaña $campaign No es válido\n"; + echo "lead_id $lead_id No es válido\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + } + } +} + + +################################################################################ +### VDADcheckINCOMING - for auto-dial VICIDiaL dialing this will check for calls +### in the vicidial_live_agents table in QUEUE status, then +### lookup the lead info and pass it back to vicidial.php +################################################################################ +if ($ACTION == 'VDADcheckINCOMING') +{ + $Ctype = 'A'; + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "Campaña $campaign No es válido\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and status='QUEUE';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',comments='AUTO',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $source_id = trim("$row[6]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + ##### if lead is a callback, grab the callback comments + $CBentry_time = ''; + $CBcallback_time = ''; + $CBuser = ''; + $CBcomments = ''; + if (ereg("CALLBK",$dispo)) + { + $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBentry_time = trim("$row[0]"); + $CBcallback_time = trim("$row[1]"); + $CBuser = trim("$row[2]"); + $CBcomments = trim("$row[3]"); + } + } + + ### update the lead status to INCALL + $stmt = "UPDATE vicidial_list set status='INCALL', user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the log status to INCALL + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + $stmt = "UPDATE vicidial_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL', user_group='$user_group' where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + ### update the vicidial_closer_log user to INCALL + $stmt = "UPDATE vicidial_closer_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL', user_group='$user_group' where lead_id='$lead_id' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select campaign_id,phone_number,alt_dial from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($VDAC_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDADchannel_group =$row[0]; + $dialed_number =$row[1]; + $dialed_label =$row[2]; + } + else + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|INBND|$callerid|$user|$user_group|$list_id|$lead_id|$phone_number|$uniqueid|\n"); + fclose($fp); + } + } + + $stmt = "select count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDL_cid_ct = mysql_num_rows($rslt); + if ($VDL_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_front_VDlog =$row[0]; + } + + $stmt = "select * from vicidial_inbound_groups where group_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_group_name = $row[1]; + $VDCL_group_color = $row[2]; + $VDCL_group_web = $row[4]; + $VDCL_fronter_display = $row[7]; + $VDCL_ingroup_script = $row[8]; + $VDCL_get_call_launch = $row[9]; + $VDCL_xferconf_a_dtmf = $row[10]; + $VDCL_xferconf_a_number = $row[11]; + $VDCL_xferconf_b_dtmf = $row[12]; + $VDCL_xferconf_b_number = $row[13]; + $VDCL_default_xfer_group= $row[28]; + + ### update the comments in vicidial_live_agents record + $stmt = "UPDATE vicidial_live_agents set comments='INBOUND' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $Ctype = 'I'; + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_ingroup_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + } + + ### if web form is set then send en to vicidial.php for override of WEB_FORM address + if ( (strlen($VDCL_group_web)>5) or (strlen($VDCL_group_name)>0) ) {echo "$VDCL_group_web|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|\n";} + else {echo "|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|\n";} + + $stmt = "SELECT full_name from vicidial_users where user='$tsr';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDU_cid_ct = mysql_num_rows($rslt); + if ($VDU_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $fronter_full_name = $row[0]; + echo $fronter_full_name . '|' . $tsr . "\n"; + } + else {echo '|' . $tsr . "\n";} + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_campaign_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + echo "|||||$VDCL_campaign_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n|\n"; + + $stmt = "select phone_number,alt_dial from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($VDAC_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dialed_number =$row[0]; + $dialed_label =$row[1]; + } + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $callerid . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + $LeaD_InfO .= $CBentry_time . "\n"; + $LeaD_InfO .= $CBcallback_time . "\n"; + $LeaD_InfO .= $CBuser . "\n"; + $LeaD_InfO .= $CBcomments . "\n"; + $LeaD_InfO .= $dialed_number . "\n"; + $LeaD_InfO .= $dialed_label . "\n"; + $LeaD_InfO .= $source_id . "\n"; + + echo $LeaD_InfO; + + + + $wait_sec=0; + $StarTtime = date("U"); + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + ### If LLAMADABK, change vicidial_callback record to INACTIVE + if (eregi("CALLBK|CBHOLD", $dispo)) + { + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='$lead_id' and status NOT IN('INACTIVE','DEAD','ARCHIVE');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + ##### check if system is set to generate logfile for transfers + $stmt="SELECT enable_agc_xfer_log FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enable_agc_xfer_log_ct = mysql_num_rows($rslt); + if ($enable_agc_xfer_log_ct > 0) + { + $row=mysql_fetch_row($rslt); + $enable_agc_xfer_log =$row[0]; + } + + if ( ($WeBRooTWritablE > 0) and ($enable_agc_xfer_log > 0) ) + { + # DATETIME|campaign|lead_id|phone_number|user|type + # 2007-08-22 11:11:11|TESTCAMP|65432|3125551212|1234|A + $fp = fopen ("./xfer_log.txt", "a"); + fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$phone_number|$user|$Ctype\n"); + fclose($fp); + } + + } + else + { + echo "0\n"; + # echo "No calls in QUEUE for $user en $server_ip\n"; + exit; + } + } +} + + +################################################################################ +### userLOGout - Logs the user out of VICIDiaL client, deleting db records and +### inserting into vicidial_user_log +################################################################################ +if ($ACTION == 'userLOGout') +{ + $MT[0]=''; + $row=''; $rowx=''; +if ( (strlen($campaign)<1) || (strlen($conf_exten)<1) ) + { + echo "NO\n"; + echo "campaign $campaign or conf_exten $conf_exten No es válido\n"; + exit; + } +else + { + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + ##### Insert a SALIR record into the user log + $stmt="INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$user','SALIR','$campaign','$NOW_TIME','$StarTtime','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vul_insert = mysql_affected_rows($link); + + if ($no_delete_sessions < 1) + { + ##### Remove the reservation en the vicidial_conferences meetme room + $stmt="UPDATE vicidial_conferences set extension='' where server_ip='$server_ip' and conf_exten='$conf_exten';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vc_remove = mysql_affected_rows($link); + } + + ##### Delete the vicidial_live_agents record for this session + $stmt="DELETE from vicidial_live_agents where server_ip='$server_ip' and user ='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vla_delete = mysql_affected_rows($link); + + ##### Delete the vicidial_live_inbound_agents records for this session + $stmt="DELETE from vicidial_live_inbound_agents where user ='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vlia_delete = mysql_affected_rows($link); + + ##### Delete the web_client_sessions + $stmt="DELETE from web_client_sessions where server_ip='$server_ip' and session_name ='$session_name';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $wcs_delete = mysql_affected_rows($link); + + ##### Hangup the client phone + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$extension%\" order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) + { + $row=mysql_fetch_row($rslt); + $agent_channel = "$row[0]"; + if ($format=='debug') {echo "\n";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','ULGH3459$StarTtime','Channel: $agent_channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $pause_sec=0; + $stmt = "select pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ( ($VDpr_ct > 0) and (strlen($row[3]<5)) and (strlen($row[4]<5)) ) + { + $row=mysql_fetch_row($rslt); + $pause_sec = (($StarTtime - $row[0]) + $row[1]); + + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + if ($vla_delete > 0) + { + ############################################# + ##### COMIENZO QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $allow_sipsak_messages = $row[6]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_message = 'LOGGED OUT'; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_message\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + } + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + # $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='PAUSA',serverid='1';"; + # if ($DB) {echo "$stmt\n";} + # if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + # $rslt=mysql_query($stmt, $linkB); + # $affected_rows = mysql_affected_rows($linkB); + + $stmt = "SELECT time_id FROM queue_log where agent='Agent/$user' and verb='AGENTLOGIN' order by time_id desc limit 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + if ($DB) {echo "$stmt\n";} + echo "$stmt\n"; + $li_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $li_conf_ct) + { + $row=mysql_fetch_row($rslt); + $logintime = $row[0]; + $i++; + } + + $time_logged_in = ($StarTtime - $logintime); + if ($time_logged_in > 1000000) {$time_logged_in=1;} + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='AGENTLOGOFF',data1='$user$agents',data2='$time_logged_in',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + + echo "$vul_insert|$vc_remove|$vla_delete|$wcs_delete|$agent_channel|$vlia_delete\n"; + } +} + + +################################################################################ +### updateDISPO - update the vicidial_list table to reflect the agent choice of +### call disposition for that leand +################################################################################ +if ($ACTION == 'updateDISPO') +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($dispo_choice)<1) || (strlen($lead_id)<1) ) + { + echo "Dispo Choice $dispo or lead_id $lead_id No es válido\n"; + exit; + } + else + { + $stmt="UPDATE vicidial_list set status='$dispo_choice', user='$user' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by uniqueid desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + if ( ($use_internal_dnc=='Y') and ($dispo_choice=='DNC') ) + { + $stmt = "select phone_number from vicidial_list where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $stmt="INSERT INTO vicidial_dnc (phone_number) values('$row[0]');"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + } + } + + $dispo_sec=0; + $StarTtime = date("U"); + $stmt = "select dispo_epoch,dispo_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dispo_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set dispo_sec='$dispo_sec',dispo_epoch='$StarTtime',status='$dispo_choice' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id($link); + + ### LLAMADABACK ENTRY + if ( ($dispo_choice == 'CBHOLD') and (strlen($CallBackDatETimE)>10) ) + { + $stmt="INSERT INTO vicidial_callbacks (lead_id,list_id,campaign_id,status,entry_time,callback_time,user,recipient,comments,user_group) values('$lead_id','$list_id','$campaign','ACTIVE','$NOW_TIME','$CallBackDatETimE','$user','$recipient','$comments','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $stmt="SELECT auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ( ($auto_dial_level > 0) and (ereg(" $dispo_choice ",$row[0])) ) + { + $stmt = "select count(*) from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + $stmt="UPDATE vicidial_hopper set status='READY' where lead_id='$lead_id' and status='HOLD' limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + else + { + $stmt="DELETE from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + ############################################# + ##### COMIENZO QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='CALLESTADO',data1='$dispo_choice',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + + echo 'Lead ' . $lead_id . ' se ha cambiado a ' . $dispo_choice . " Estado\nNext agent_log_id:\n" . $agent_log_id . "\n"; +} + +################################################################################ +### updateLEAD - update the vicidial_list table to reflect the values that are +### in the agents screen at time of call hangup +################################################################################ +if ($ACTION == 'updateLEAD') +{ + $MT[0]=''; + $row=''; $rowx=''; + $DO_NOT_UPDATE=0; + $DO_NOT_UPDATE_text=''; + if ( (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + echo "phone_number $phone_number or lead_id $lead_id No es válido\n"; + exit; + } + else + { + + $stmt = "SELECT disable_alter_custdata FROM vicidial_campaigns where campaign_id='$campaign'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $dac_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $dac_conf_ct) + { + $row=mysql_fetch_row($rslt); + $disable_alter_custdata = $row[0]; + $i++; + } + if (ereg('Y',$disable_alter_custdata)) + { + $DO_NOT_UPDATE=1; + $DO_NOT_UPDATE_text=' NOT'; + $stmt = "SELECT alter_custdata_override FROM vicidial_users where user='$user'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $aco_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $aco_conf_ct) + { + $row=mysql_fetch_row($rslt); + $alter_custdata_override = $row[0]; + $i++; + } + if (ereg('ALLOW_ALTER',$alter_custdata_override)) + { + $DO_NOT_UPDATE=0; + $DO_NOT_UPDATE_text=''; + } + } + + if ($DO_NOT_UPDATE < 1) + { + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + $comments = eregi_replace("--AMP--",'&',$comments); + $comments = eregi_replace("--QUES--",'?',$comments); + $comments = eregi_replace("--POUND--",'#',$comments); + + $stmt="UPDATE vicidial_list set vendor_lead_code='" . mysql_real_escape_string($vendor_lead_code) . "', title='" . mysql_real_escape_string($title) . "', first_name='" . mysql_real_escape_string($first_name) . "', middle_initial='" . mysql_real_escape_string($middle_initial) . "', last_name='" . mysql_real_escape_string($last_name) . "', address1='" . mysql_real_escape_string($address1) . "', address2='" . mysql_real_escape_string($address2) . "', address3='" . mysql_real_escape_string($address3) . "', city='" . mysql_real_escape_string($city) . "', state='" . mysql_real_escape_string($state) . "', province='" . mysql_real_escape_string($province) . "', postal_code='" . mysql_real_escape_string($postal_code) . "', country_code='" . mysql_real_escape_string($country_code) . "', gender='" . mysql_real_escape_string($gender) . "', date_of_birth='" . mysql_real_escape_string($date_of_birth) . "', alt_phone='" . mysql_real_escape_string($alt_phone) . "', email='" . mysql_real_escape_string($email) . "', security_phrase='" . mysql_real_escape_string($security_phrase) . "', comments='" . mysql_real_escape_string($comments) . "' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } + echo "Lead $lead_id information has$DO_NOT_UPDATE_text been updated\n"; +} + + +################################################################################ +### VDADpause - update the vicidial_live_agents table to show that the agent is +### or ready now active and ready to take calls +################################################################################ +if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($stage)<2) || (strlen($server_ip)<1) ) + { + echo "stage $stage No es válido\n"; + exit; + } + else + { + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set lead_id='',uniqueid=0,callerid='',channel='', random_id='$random',comments='' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_live_agents set status='$stage' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + ############################################# + ##### COMIENZO QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + if (ereg('READY',$stage)) {$QMstatus='UNPAUSEALL';} + if (ereg('PAUSA',$stage)) {$QMstatus='PAUSAALL';} + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='$QMstatus',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + + if ($agent_log == 'NO') + {$donothing=1;} + else + { + $pause_sec=0; + $stmt = "select pause_epoch,pause_sec,wait_epoch,wait_sec,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec=0; + if ($row[2] > 0) + { + $wait_sec = (($StarTtime - $row[2]) + $row[3]); + } + if ( (eregi("NULL",$row[4])) or ($row[4] < 1000) ) + {$pause_sec = (($StarTtime - $row[0]) + $row[1]);} + else + {$pause_sec = (($row[4] - $row[0]) + $row[1]);} + + } + if ($ACTION == 'VDADready') + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($ACTION == 'VDADpause') + { + $stmt="UPDATE vicidial_agent_log set pause_epoch='$StarTtime',wait_sec='$wait_sec' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + echo 'Agent ' . $user . ' ahora está en estado ' . $stage . "\n"; +} + + +################################################################################ +### UpdatEFavoritEs - update the astguiclient favorites list for this extension +################################################################################ +if ($ACTION == 'UpdatEFavoritEs') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($favorites_list)<1) || (strlen($user)<1) || (strlen($exten)<1) ) + { + echo "favorites list $favorites_list No es válido\n"; + exit; + } + else + { + $stmt = "select count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + $stmt="UPDATE phone_favorites set extensions_list=\"$favorites_list\" where extension='$exten' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="INSERT INTO phone_favorites values('$exten','$server_ip',\"$favorites_list\");"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + echo "Favorites list has been updated to $favorites_list for $exten\n"; +} + + +################################################################################ +### PauseCodeSubmit - Update vicidial_agent_log with pause code +################################################################################ +if ($ACTION == 'PausaCodeSubmit') +{ + $row=''; $rowx=''; + if ( (strlen($status)<1) || (strlen($agent_log_id)<1) ) + { + echo "agent_log_id $agent_log_id or pause_code $status No es válido\n"; + exit; + } + else + { + $stmt="UPDATE vicidial_agent_log set sub_status=\"$status\" where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + ############################################# + ##### COMIENZO QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $allow_sipsak_messages = $row[6]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_prefix = 'BK-'; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$status\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + } + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='PAUSAREASON',serverid='$queuemetrics_log_id',data1='$status';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } +echo "Pausa Code has been updated to $status for $agent_log_id\n"; +} + + +################################################################################ +### CalLBacKLisT - List the USERONLY callbacks for an agent +################################################################################ +if ($ACTION == 'CalLBacKLisT') +{ +$stmt = "select callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' and campaign_id='$campaign' and status NOT IN('INACTIVE','DEAD') order by callback_time;"; +if ($DB) {echo "$stmt\n";} +$rslt=mysql_query($stmt, $link); +if ($rslt) {$callbacks_count = mysql_num_rows($rslt);} +echo "$callbacks_count\n"; +$loop_count=0; + while ($callbacks_count>$loop_count) + { + $row=mysql_fetch_row($rslt); + $callback_id[$loop_count] = $row[0]; + $lead_id[$loop_count] = $row[1]; + $campaign_id[$loop_count] = $row[2]; + $status[$loop_count] = $row[3]; + $entry_time[$loop_count] = $row[4]; + $callback_time[$loop_count] = $row[5]; + $comments[$loop_count] = $row[6]; + $loop_count++; + } +$loop_count=0; + while ($callbacks_count>$loop_count) + { + $stmt = "select first_name,last_name,phone_number from vicidial_list where lead_id='$lead_id[$loop_count]';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count]\n"; + $loop_count++; + } + +} + + +################################################################################ +### CalLBacKCounT - send the count of the USERONLY callbacks for an agent +################################################################################ +if ($ACTION == 'CalLBacKCounT') +{ +$stmt = "select count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' and campaign_id='$campaign' and status NOT IN('INACTIVE','DEAD');"; +if ($DB) {echo "$stmt\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$cbcount=$row[0]; + +echo "$cbcount"; +} + + + + +if ($format=='debug') +{ +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +echo "\n"; +echo "\n\n\n"; +} + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/vicidial.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/vicidial.php new file mode 100644 index 00000000..b7272b81 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/vicidial.php @@ -0,0 +1,6797 @@ + LICENSE: GPLv2 +# +# make sure you have added a user to the vicidial_users MySQL table with at least +# user_level 1 or greater to access this page. Also, you need to have the login +# and pass of a phone listed in the asterisk.phones table. The page grabs the +# server info and other details from this login and pass. +# +# This script works best with Firefox or Mozilla, but will run for a couple +# hours on Internet Explorer before the memory leaks cause a crash. +# +# Other scripts that this application depends on: +# - vdc_db_query.php: Updates information in the database +# - manager_send.php: Sends manager actions to the DB for execution +# +# CHANGELOG +# 50607-1426 - First Build of VICIDIAL web client basic login process finished +# 50628-1620 - Added some basic formatting and worked on process flow +# 50628-1715 - Startup variables mapped to javascript variables +# 50629-1303 - Added Login Closer in-groups selection box and vla update +# 50629-1530 - Rough layout for customer info form section and button links +# 50630-1453 - Rough Manual Dial/Hangup with customer info displayed +# 50701-1450 - Added vicidial_log entries on dial and hangup +# 50701-1634 - Added Logout function +# 50705-1259 - Added call disposition functionality +# 50705-1432 - Added lead info DB update function +# 50705-1658 - Added web form functionality +# 50706-1043 - Added call park and pickup functions +# 50706-1234 - Added Start/Stop Recording functionality +# 50706-1614 - Added conference channels display option +# 50711-1333 - Removed call check redundancy and fixed a span bug +# 50727-1424 - Added customer channel and participant present sensing/alerts +# 50804-1057 - Added SendDTMF function and reconfigured the transfer span +# 50804-1224 - Added Local and Internal Closer transfer functions +# 50804-1628 - Added Blind transfer, activated LIVE CALL image and fixed bugs +# 50804-1808 - Added button images for left buttons +# 50815-1151 - Added 3Way calling functions to Transfer-conf frame +# 50815-1602 - Added images and buttons for xfer functions +# 50816-1813 - Added basic autodial outbound call pickup functions +# 50817-1113 - Fixes to auto_dialing call receipt +# 50817-1234 - Added inbound call receipt capability +# 50817-1541 - Added customer time display +# 50817-1541 - Added customer time display +# 50818-1327 - Added stop-all-recordings-after-each-vicidial-call option +# 50818-1703 - Added pretty login section +# 50825-1200 - Modified form field lengths, added double-click dispositions +# 50831-1603 - Fixed customer time bug and fronter display bug for CLOSER +# 50901-1314 - Fixed CLOSER IN-GROUP Web Form bug +# 50903-0904 - Added preview-lead code for manual dialing +# 50904-0016 - Added ability to hangup manual dials before pickup +# 50906-1319 - Added override for filters on xfer calls, fixed login display bug +# 50909-1243 - Added hotkeys functionality for quick dispoing in auto-dial mode +# 50912-0958 - Modified hotkeys function, agent must have user_level >= 5 to use +# 50913-1212 - Added campaign_cid to 3rd party calls +# 50923-1546 - Modified to work with language translation +# 50926-1656 - Added campaign pull-down at login of active campaigns +# 50928-1633 - Added manual dial alternate number dial option +# 50930-1538 - Added session_id empty login failure and fixed 2 minor bugs +# 51004-1656 - Fixed recording filename bug and new Spanish translation +# 51020-1103 - Added campaign-specific recording control abilities +# 51020-1352 - Added Basic vicidial_agent_log framework +# 51021-1050 - Fixed custtime display and disable Enter/Return keypresses +# 51021-1718 - Allows for multi-line comments (changes \n to !N in database) +# 51110-1432 - Fixed non-standard http port issue +# 51111-1047 - Added vicidial_agent_log lead_id earlier for manual dial +# 51118-1305 - Activate multi-line comments from $multi_line_comments var +# 51118-1313 - Move Transfer DIV to a floating span to preserve 800x600 view +# 51121-1506 - Small PHP optimizations in many scripts and disabled globalize +# 51129-1010 - Added ability to accept calls from other VICIDIAL servers +# 51129-1254 - Fixed Hangups of other agents channels when customer hangs up +# 51208-1732 - Created user-first login that looks for default phone info +# 51219-1526 - Added variable framework for campaign and in-group scripts +# 51221-1200 - Added SCRIPT tab, layout and functionality +# 51221-1714 - Added auto-switch-to-SCRIPT-tab and auto-webform-popup +# 51222-1605 - Added VMail message blind transfer button to xfer-conf frame +# 51229-1028 - Added checks on web_form_address to allow for var in the DB value +# 60117-1312 - Added Transfer-conf frame toggle on button press +# 60208-1152 - Added DTMF-xfernumber preset links to xfer-conf frame +# 60213-1129 - Added vicidial_users.hotkeys_active for any user hotkeys +# 60213-1210 - Added ability to sort routing of calls by user_level +# 60214-0932 - Initial Callback calendar display framework +# 60214-1407 - Added ability to minimize the dispo screen to see info below +# 60215-1104 - Added ANYONE scheduled callbacks functionality +# 60410-1116 - Added persistant pause after dispo option and change dispo text +# - Added web form submit that opens new window with dispo on submit +# - Added PREVIOUS CALLBACK in customer info to flag callbacks +# - Added link to try to hangup the call again in the dispo screen +# - Added link noone-in-session screen to call agent phone again +# - Added link customer-hungup screen to go straight to dispo screen +# 60410-1532 - Added agent status and campaign calls dialing display option +# 60411-1547 - Add ability to set callback as USERONLY and some basic formatting +# 60413-1752 - Add basic USERONLY callback frame and listings +# 60414-1039 - Changed manual dial preview and alt dial checkboxes to spans +# - Added beta-level USERONLY callback functionality +# - Added beta-level manual dialing with lead insertion functionality +# 60415-1534 - Fixed manual dial lead preview and fixed manuald dial override bug +# 60417-1108 - Added capability to do alt-number-dialing in auto-dial mode +# - Changed several permissions to database-defined +# 60419-1529 - Prevent manual dial or callbacks when alt-dial lead not finished +# 60420-1647 - Fixed DiaLDiaLAltPhonE error, Call Agent Again DialControl error +# 60421-1229 - Check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60424-1005 - Fixed Alt phone disabled bug for callbacks and manual dials +# 60426-1058 - Added vicidial_user setting for default blended check for CLOSER +# 60501-1008 - Added option to manual dial screen to manually lookup phone number +# 60503-1653 - Fixed agentonly_callback not-defined bug in scheduled callbacks screen +# 60504-1032 - Fixed manual dial display bug and transfer dispo alert bug +# - Fixed recording filename display to not overrun 25 characters +# 60510-1051 - Added Wrapup timer and wrapup message on wrapup screen after dispo +# 60608-1453 - Added CLOSER campaign allowable in-groups limitations +# 60609-1123 - Added add-number-to-DNC-list function and manual dial check DNC +# 60619-1047 - Added variable filters to close security holes for login form +# 60804-1710 - fixed scheduled CALLBK for other languages build +# 60808-1145 - Added consultative transfers with customer data +# 60808-2232 - Added campaign name to pulldown for login screen +# 60809-1603 - Added option to locally transfer consult xfers +# 60809-1732 - Added recheck of transferred channels before customer gone mesg +# 60810-1011 - Fixed CXFER leave 3way call bugs +# 60816-1602 - Added ALLCALLS recording delay option allcalls_delay +# 60816-1716 - Fixed customer time display bug and client DST setting +# 60821-1555 - Added option to omit phone_code on dialout of leads +# 60821-1628 - Added ALLFORCE recording option +# 60821-1643 - Added no_delete_sessions option to not delete sessions +# 60822-0512 - Changed phone number fields to be maxlength of 12 +# 60829-1531 - Made compatible with WeBRooTWritablE setting in dbconnect.php +# 60906-1152 - Added Previous CallBack info display span +# 60906-1715 - Allow for Local phone extension conferences +# 61004-1729 - Add ability to control volume per channel in "calls in this session" +# 61122-1341 - Added vicidial_user_groups allowed_campaigns restrictions +# 61122-1523 - Added more SCRIPT variables +# 61128-2229 - Added vicidial_live_agents and vicidial_auto_calls manual dial entries +# 61130-1617 - Added lead_id to MonitorConf for recording_log +# 61221-1212 - Changed width to 760 to better fit 800x600 screens, widened SCRIPT +# 70109-1128 - Fixed wrapup timer bug +# 70109-1635 - Added option for HotKeys automatically dialing next number in manual mode +# - Added option for alternate number dialing with hotkeys +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70118-1517 - Added vicidial_agent_log and vicidial_user_log logging of user_group +# 70201-1249 - Added FAST DIAL option for manually dialing, added UTF8 compatible code +# 70201-1703 - Fixed cursor bug for most text input fields +# 70202-1453 - Added first portions of Agent Pause Codes +# 70203-0108 - Finished Agent Pause Codes functionality +# 70203-0930 - Added dialed_number to webform output +# 70203-1010 - Added dialed_label to webform output +# 70206-1201 - Fixed allow_closers bug +# 70206-1332 - Added vicidial_recording_override users setting function +# 70212-1252 - Fixed small issue with CXFER +# 70213-1018 - Changed CXFER and AXFER to update customer information before transfer +# 70214-1233 - Added queuemetrics_log_id field for server_id in queue_log +# 70215-1240 - Added queuemetrics_log_id field for server_id in queue_log +# 70222-1617 - Changed queue_log PAUSE/UNPAUSE to PAUSEALL/UNPAUSEALL +# 70226-1252 - Added Mute/UnMute to agent screen +# 70309-1035 - Allow amphersands and questions marks in comments to pass through +# 70313-1052 - Allow pound signs(hash) in comments to pass through +# 70316-1406 - Moved the MUTE button to be accessible during a transfer/conf +# 70319-1446 - Added agent-deactive-display and disable customer info update functions +# 70319-1626 - Added option to allow agent logins to campaigns with no leads in the hopper +# 70320-1501 - Added option to allow retry of leave-3way-call from dispo screen +# 70322-1545 - Added sipsak display ability +# 70510-1319 - Added onUnload force Logout +# 70806-1530 - Added Presets Dial links above agent mute button +# 70823-2118 - Fixed XMLHTTPRequest, HotKeys and Scheduled Callbacks issues with MSIE +# 70828-1443 - Added source_id to output of SCRIPTtab-IFRAME and WEBFORM +# 71022-1427 - Added formatting of the customer phone number in the main status bar +# 71029-1848 - Changed CLOSER-type campaign to not use campaign_id restrictions +# 71101-1204 - Fixed bug in callback calendar with DST +# 71116-0957 - Added campaign_weight and calls_today to the vla table insertion +# 71120-1719 - Added XMLHTPRequest lookup of allowable campaigns for agents during login +# 71122-0256 - Added auto-pause notification +# 71125-1751 - Changed Transfer section to allow for selection of in-groups to send calls to +# 71127-0408 - Added height and width settings for easier modification of screen size +# 71129-2025 - restricted callbacks count and list to campaign only +# + +$version = '2.0.4-142'; +$build = '71129-2025'; + +require("dbconnect.php"); + +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["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} + 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"];} + } + if (isset($VD_campaign)) + { + $VD_campaign = strtoupper($VD_campaign); + $VD_campaign = eregi_replace(" ",'',$VD_campaign); + } + +### 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); + + +$forever_stop=0; + +if ($force_logout) +{ + echo "Usted ahora ha registrado hacia fuera. Gracias\n"; + exit; +} + +$isdst = date("I"); +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$CIDdate = date("ymdHis"); + $month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); + $past_month_date = date("Y-m-d H:i:s",$month_old); + + +$random = (rand(1000000, 9999999) + 10000000); + +$conf_silent_prefix = '7'; # vicidial_conferences prefix to enter silently +$HKuser_level = '5'; # minimum vicidial user_level for HotKeys +$campaign_login_list = '1'; # show drop-down list of campaigns at login +$manual_dial_preview = '1'; # allow preview lead option when manual dial +$multi_line_comments = '1'; # set to 1 to allow multi-line comment box +$user_login_first = '0'; # set to 1 to have the vicidial_user login before the phone login +$view_scripts = '1'; # set to 1 to show the SCRIPTS tab +$dispo_check_all_pause = '0'; # set to 1 to allow for persistent pause after dispo +$agentcallsstatus = '0'; # set to 1 to show agent status and call count + $campagentstatctmax = '0'; # Number of segundos for campaign call and agent stats +$show_campname_pulldown = '1'; # set to 1 to show campaign name en login pulldown +$webform_sessionname = '1'; # set to 1 to include the session_name in webform URL +$local_consult_xfers = '1'; # set to 1 to send consultative transfers from original server +$clientDST = '1'; # set to 1 to check for DST en server for agent time +$no_delete_sessions = '0'; # set to 1 to not delete sessions at logout +$volumecontrol_active = '1'; # set to 1 to allow agents to alter volume of channels +$PreseT_DiaL_LinKs = '1'; # set to 1 to show a DIAL link for Dial Presets +$LogiNAJAX = '1'; # set to 1 to do lookups +$HidEMonitoRSessionS = '1'; # set to 1 to hide remote monitoring channels from "session calls" + +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen + +$BROWSER_HEIGHT = 500; # set to the minimum browser height, default=500 +$BROWSER_WIDTH = 770; # set to the minimum browser width, default=770 + + +# options now set in DB: +#$alt_phone_dialing = '1'; # allow agents to call alt phone numbers +#$scheduled_callbacks = '1'; # set to 1 to allow agent to choose scheduled callbacks +# $agentonly_callbacks = '1'; # set to 1 to allow agent to choose agent-only scheduled callbacks +#$agentcall_manual = '1'; # set to 1 to allow agent to make manual calls during autodial session + +### SCREEN WIDTH AND HEIGHT CALCULATIONS ### +### DO NOT EDIT! ### +$MASTERwidth=($BROWSER_WIDTH - 340); +$MASTERheight=($BROWSER_HEIGHT - 200); +if ($MASTERwidth < 430) {$MASTERwidth = '430';} +if ($MASTERheight < 300) {$MASTERheight = '300';} + +$CAwidth = ($MASTERwidth + 340); # 770 - cover all (none-in-session, customer hunngup, etc...) +$MNwidth = ($MASTERwidth + 330); # 760 - main frame +$XFwidth = ($MASTERwidth + 320); # 750 - transfer/conference +$HCwidth = ($MASTERwidth + 310); # 740 - hotkeys and callbacks +$AMwidth = ($MASTERwidth + 270); # 700 - agent mute and preset-dial links +$SSwidth = ($MASTERwidth + 176); # 606 - scroll script +$SDwidth = ($MASTERwidth + 170); # 600 - scroll script, customer data and calls-in-session +$HKwidth = ($MASTERwidth + 70); # 500 - Hotkeys button +$HSwidth = ($MASTERwidth + 1); # 431 - Header spacer + +$HKheight = ($MASTERheight + 105); # 405 - HotKey active Button +$AMheight = ($MASTERheight + 100); # 400 - Agent mute and preset dial links +$MBheight = ($MASTERheight + 65); # 365 - Manual Dial Buttons +$CBheight = ($MASTERheight + 50); # 350 - Agent Callback, pause code, volume control Buttons and agent status +$SSheight = ($MASTERheight + 31); # 331 - script content +$HTheight = ($MASTERheight + 10); # 310 - transfer frame, callback comments and hotkey +$BPheight = ($MASTERheight - 250); # 50 - bottom buffer + + +$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('vicidial.php','',$agcPAGE); + +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 +echo "\n"; +echo "\n"; +echo "\n"; + +if ($campaign_login_list > 0) +{ +$camp_form_code = "\n"; +} +else +{ +$camp_form_code = "\n"; +} + + +if ($LogiNAJAX > 0) +{ +?> + + + +web client VICIDIAL: Conexión Otra Vez\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "
English Español
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Conexión Otra Vez
 
Conexión Del Teléfono:
Contraseña Del Teléfono:
Conexión Del Usuario:
Contraseña Del Usuario:
Campaña: $camp_form_code

VERSIÓN: $version       CONSTRUCCION: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} + +if ($user_login_first == 1) +{ + if ( (strlen($VD_login)<1) or (strlen($VD_pass)<1) or (strlen($VD_campaign)<1) ) + { + echo "web client VICIDIAL: Conexión en la Campaña\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Español
\n"; + echo "
\n"; + echo "\n"; + #echo "\n"; + #echo "\n"; + echo "

Conexión Del Usuario

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Conexión en la Campaña
 
Conexión Del Usuario:
Contraseña Del Usuario:
Campaña: $camp_form_code
  \n"; + echo "

VERSIÓN: $version       CONSTRUCCION: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) + { + $stmt="SELECT phone_login,phone_pass from vicidial_users where user='$VD_login' and pass='$VD_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); + $phone_login=$row[0]; + $phone_pass=$row[1]; + + echo "web client VICIDIAL: Conexión\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Español
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Conexión
 
Conexión Del Teléfono:
Contraseña Del Teléfono:
Conexión Del Usuario:
Contraseña Del Usuario:
Campaña: $camp_form_code
  \n"; + echo "

VERSIÓN: $version       CONSTRUCCION: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + + } + } +} + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "web client VICIDIAL: Conexión Del Teléfono\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "
English Español
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Conexión Del Teléfono
 
Conexión Del Teléfono:
Contraseña Del Teléfono:
  \n"; +echo "

VERSIÓN: $version       CONSTRUCCION: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./vicidial_auth_entries.txt", "a");} +$VDloginDISPLAY=0; + + if ( (strlen($VD_login)<2) or (strlen($VD_pass)<2) or (strlen($VD_campaign)<2) ) + { + $VDloginDISPLAY=1; + } + else + { + $stmt="SELECT count(*) from vicidial_users where user='$VD_login' and pass='$VD_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($auth>0) + { + $login=strtoupper($VD_login); + $password=strtoupper($VD_pass); + ##### grab the full name of the agent + $stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,closer_default_blended,user_group,vicidial_recording_override from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $user_level=$row[1]; + $VU_hotkeys_active=$row[2]; + $VU_agent_choose_ingroups=$row[3]; + $VU_scheduled_callbacks=$row[4]; + $agentonly_callbacks=$row[5]; + $agentcall_manual=$row[6]; + $VU_vicidial_recording=$row[7]; + $VU_vicidial_transfers=$row[8]; + $VU_closer_default_blended=$row[9]; + $VU_user_group=$row[10]; + $VU_vicidial_recording_override=$row[11]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|$VD_pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + $user_abb = "$VD_login$VD_login$VD_login$VD_login"; + while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + + $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$VU_user_group';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGallowed_campaigns =$row[0]; + + if ( (!eregi(" $VD_campaign ",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) + { + echo "web client VICIDIAL: VICIDIAL Conexión en la Campaña\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Español
\n"; + echo "Sorry, you are not allowed to login to this campaign: $VD_campaign\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Conexión: \n
"; + echo "Contraseña:
\n"; + echo "Campaña: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + ##### check to see that the campaign is active + $stmt="SELECT count(*) FROM vicidial_campaigns where campaign_id='$VD_campaign' and active='Y';"; + 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); + $CAMPactive=$row[0]; + if($CAMPactive>0) + { + if ($TEST_all_statuses > 0) {$selectableSQL = '';} + else {$selectableSQL = "selectable='Y' and";} + $VARstatuses=''; + $VARstatusnames=''; + ##### grab the statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_statuses WHERE $selectableSQL status != 'NEW' order by status limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $VD_statuses_ct) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + } + + ##### grab the campaign-specific statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_campaign_statuses WHERE $selectableSQL status != 'NEW' and campaign_id='$VD_campaign' order by status limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_camp = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + $j++; + } + $VD_statuses_ct = ($VD_statuses_ct+$VD_statuses_camp); + $VARstatuses = substr("$VARstatuses", 0, -1); + $VARstatusnames = substr("$VARstatusnames", 0, -1); + + ##### grab the campaign-specific HotKey statuses that can be used for dispositioning by an agent + $stmt="SELECT hotkey,status,status_name FROM vicidial_campaign_hotkeys WHERE selectable='Y' and status != 'NEW' and campaign_id='$VD_campaign' order by hotkey limit 9;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $HK_statuses_camp = mysql_num_rows($rslt); + $w=0; + $HKboxA=''; + $HKboxB=''; + $HKboxC=''; + while ($w < $HK_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $HKhotkey[$w] =$row[0]; + $HKstatus[$w] =$row[1]; + $HKstatus_name[$w] =$row[2]; + $HKhotkeys = "$HKhotkeys'$HKhotkey[$w]',"; + $HKstatuses = "$HKstatuses'$HKstatus[$w]',"; + $HKstatusnames = "$HKstatusnames'$HKstatus_name[$w]',"; + if ($w < 3) + {$HKboxA = "$HKboxA $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ( ($w >= 3) and ($w < 6) ) + {$HKboxB = "$HKboxB $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ($w >= 6) + {$HKboxC = "$HKboxC $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + $w++; + } + $HKhotkeys = substr("$HKhotkeys", 0, -1); + $HKstatuses = substr("$HKstatuses", 0, -1); + $HKstatusnames = substr("$HKstatusnames", 0, -1); + + ##### grab the statuses to be dialed for your campaign as well as other campaign settings + $stmt="SELECT park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,agent_pause_codes_active,no_hopper_leads_logins,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,xfer_groups FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $park_ext = $row[0]; + $park_file_name = $row[1]; + $web_form_address = $row[2]; + $allow_closers = $row[3]; + $auto_dial_level = $row[4]; + $dial_timeout = $row[5]; + $dial_prefix = $row[6]; + $campaign_cid = $row[7]; + $campaign_vdad_exten = $row[8]; + $campaign_rec_exten = $row[9]; + $campaign_recording = $row[10]; + $campaign_rec_filename = $row[11]; + $campaign_script = $row[12]; + $get_call_launch = $row[13]; + $campaign_am_message_exten = $row[14]; + $xferconf_a_dtmf = $row[15]; + $xferconf_a_number = $row[16]; + $xferconf_b_dtmf = $row[17]; + $xferconf_b_number = $row[18]; + $alt_number_dialing = $row[19]; + $VC_scheduled_callbacks = $row[20]; + $wrapup_segundos = $row[21]; + $wrapup_message = $row[22]; + $closer_campaigns = $row[23]; + $use_internal_dnc = $row[24]; + $allcalls_delay = $row[25]; + $omit_phone_code = $row[26]; + $agent_pause_codes_active = $row[27]; + $no_hopper_leads_logins = $row[28]; + $campaign_allow_inbound = $row[29]; + $manual_dial_list_id = $row[30]; + $default_xfer_group = $row[31]; + $xfer_groups = $row[32]; + + if ( (!ereg('DISABLED',$VU_vicidial_recording_override)) and ($VU_vicidial_recording > 0) ) + { + $campaign_recording = $VU_vicidial_recording_override; + print "\n"; + } + if ( ($VC_scheduled_callbacks=='Y') and ($VU_scheduled_callbacks=='1') ) + {$scheduled_callbacks='1';} + if ($VU_vicidial_recording=='0') + {$campaign_recording='NEVER';} + if ($alt_number_dialing=='Y') + {$alt_phone_dialing='1';} + else + {$alt_phone_dialing='0';} + $closer_campaigns = preg_replace("/^ | -$/","",$closer_campaigns); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaigns = "'$closer_campaigns'"; + + if ($agent_pause_codes_active=='Y') + { + ##### grab the pause codes for this campaign + $stmt="SELECT pause_code,pause_code_name FROM vicidial_pause_codes WHERE campaign_id='$VD_campaign' order by pause_code limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_pause_codes = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_pause_codes) + { + $row=mysql_fetch_row($rslt); + $pause_codes[$i] =$row[0]; + $pause_code_names[$i] =$row[1]; + $VARpause_codes = "$VARpause_codes'$pause_codes[$i]',"; + $VARpause_code_names = "$VARpause_code_names'$pause_code_names[$i]',"; + $i++; + $j++; + } + $VD_pause_codes_ct = ($VD_pause_codes_ct+$VD_pause_codes); + $VARpause_codes = substr("$VARpause_codes", 0, -1); + $VARpause_code_names = substr("$VARpause_code_names", 0, -1); + } + + ##### grab the inbound groups to choose from if campaign contains CLOSER + $VARingroups="''"; + if ($campaign_allow_inbound == 'Y') + { + $VARingroups=''; + $stmt="select group_id from vicidial_inbound_groups where active = 'Y' and group_id IN($closer_campaigns) order by group_id limit 60;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $closer_ct = mysql_num_rows($rslt); + $INgrpCT=0; + while ($INgrpCT < $closer_ct) + { + $row=mysql_fetch_row($rslt); + $closer_groups[$INgrpCT] =$row[0]; + $VARingroups = "$VARingroups'$closer_groups[$INgrpCT]',"; + $INgrpCT++; + } + $VARingroups = substr("$VARingroups", 0, -1); + } + + ##### grab the allowable inbound groups to choose from for transfer options + $xfer_groups = preg_replace("/^ | -$/","",$xfer_groups); + $xfer_groups = preg_replace("/ /","','",$xfer_groups); + $xfer_groups = "'$xfer_groups'"; + $VARxfergroups="''"; + if ($allow_closers == 'Y') + { + $VARxfergroups=''; + $stmt="select group_id,group_name from vicidial_inbound_groups where active = 'Y' and group_id IN($xfer_groups) order by group_id limit 60;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $xfer_ct = mysql_num_rows($rslt); + $XFgrpCT=0; + while ($XFgrpCT < $xfer_ct) + { + $row=mysql_fetch_row($rslt); + $VARxfergroups = "$VARxfergroups'$row[0]',"; + $VARxfergroupsnames = "$VARxfergroupsnames'$row[1]',"; + if ($row[0] == "$default_xfer_group") {$default_xfer_group_name = $row[1];} + $XFgrpCT++; + } + $VARxfergroups = substr("$VARxfergroups", 0, -1); + $VARxfergroupsnames = substr("$VARxfergroupsnames", 0, -1); + } + + ##### grab the number of leads in the hopper for this campaign + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id = '$VD_campaign' and status='READY';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $campaign_leads_to_call = $row[0]; + print "\n"; + + } + else + { + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "La campaña no está activa, intentelo otra vez, por favor
"; + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|$VD_pass|$ip|$browser|\n"); + fclose($fp); + } + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "La conexión incorrecta, intentelo otra vez, por favor
"; + } + } + if ($VDloginDISPLAY) + { + echo "web client VICIDIAL: Conexión en la Campaña\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Español
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "

$VDdisplayMESSAGE

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Conexión en la Campaña
 
Conexión Del Usuario:
Contraseña Del Usuario:
Campaña: $camp_form_code
  \n"; + echo "

VERSIÓN: $version       CONSTRUCCION: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +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); +$authphone=$row[0]; +if (!$authphone) + { + echo "web client VICIDIAL: Conexión Del Teléfono Error\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Español
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Conexión Error
 
Disculpe, la conexión del teléfono y contraseña no están activos en este sistema, intentelo otra vez por favor:
 
Conexión Del Teléfono:
Contraseña Del Teléfono:

VERSIÓN: $version       CONSTRUCCION: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "web client VICIDIAL\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + 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); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $login=$row[6]; + $pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $LlamadorID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + $enable_sipsak_messages=$row[66]; + + if ($clientDST) + { + $local_gmt = ($local_gmt + $isdst); + } + if ($protocol == 'EXTERNAL') + { + $protocol = 'Local'; + $extension = "$dialplan_number$AT$ext_context"; + } + $SIP_user = "$protocol/$extension"; + + $stmt="SELECT asterisk_version from servers where server_ip='$server_ip';"; + 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); + $asterisk_version=$row[0]; + + # If a park extension is not set, use the default one + if ( (strlen($park_ext)>0) && (strlen($park_file_name)>0) ) + { + $VICIDiaL_park_on_extension = "$park_ext"; + $VICIDiaL_park_on_filename = "$park_file_name"; + print "\n"; + } + print "\n"; + + # If a web form address is not set, use the default one + if (strlen($web_form_address)>0) + { + $VICIDiaL_web_form_address = "$web_form_address"; + print "\n"; + } + else + { + $VICIDiaL_web_form_address = "$VICIDiaL_web_URL"; + print "\n"; + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + } + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + # If closers are allowed en this campaign + if ($allow_closers=="Y") + { + $VICIDiaL_allow_closers = 1; + print "\n"; + } + else + { + $VICIDiaL_allow_closers = 0; + print "\n"; + } + + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtimE$US$session_ext$session_rand"; + + if ($webform_sessionname) + {$webform_sessionname = "&session_name=$session_name";} + else + {$webform_sessionname = '';} + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'vicidial';"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','vicidial','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + if ( ($campaign_allow_inbound == 'Y') || ($campaign_leads_to_call > 0) || (ereg('Y',$no_hopper_leads_logins)) ) + { + ### insert an entry into the user log for the login event + $stmt = "INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$VD_login','LOGIN','$VD_campaign','$NOW_TIME','$StarTtimE','$VU_user_group')"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + ##### check to see if the user has a conf extension already, this happens if they previously exited uncleanly + $stmt="SELECT conf_exten FROM vicidial_conferences where extension='$SIP_user' and server_ip = '$server_ip' LIMIT 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $prev_login_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $prev_login_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + if ($prev_login_ct > 0) + {print "\n";} + else + { + ##### grab the next available vicidial_conference room and reserve it + $stmt="SELECT conf_exten FROM vicidial_conferences where server_ip = '$server_ip' and ((extension='') or (extension is null)) LIMIT 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $free_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $free_conf_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + $stmt="UPDATE vicidial_conferences set extension='$SIP_user' where server_ip='$server_ip' and conf_exten='$session_id';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + print "\n"; + + } + + $stmt="UPDATE vicidial_list set status='N', user='' where status IN('QUEUE','INCALL') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_hopper where status IN('QUEUE','INCALL','DONE') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_live_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_live_inbound_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + # print "You have logged in as user: $VD_login en phone: $SIP_user a la campaña: $VD_campaign
\n"; + $VICIDiaL_is_logged_in=1; + + ### set the callerID for manager middleware-app to connect the phone to the user + $SIqueryCID = "S$CIDdate$session_id"; + + ############################################# + ##### COMIENZO SYSTEM_SETTINGS LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,vicidial_agent_disable,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $vicidial_agent_disable = $row[6]; + $allow_sipsak_messages = $row[7]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_prefix = 'LIN-'; + print "\n"; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$VD_campaign\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + $SIqueryCID = "$SIPSAK_prefix$VD_campaign$DS$CIDdate"; + } + + ### insert a NUEVO record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$SIqueryCID','Channel: $SIP_user','Context: $ext_context','Exten: $session_id','Priority: 1','Callerid: $SIqueryCID','','','','','');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($auto_dial_level > 0) + { + print "\n"; + + ##### grab the campaign_weight and number of calls today en that campaign for the agent + $stmt="SELECT campaign_weight,calls_today FROM vicidial_campaign_agents where user='$VD_login' and campaign_id = '$VD_campaign';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vca_ct = mysql_num_rows($rslt); + if ($vca_ct > 0) + { + $row=mysql_fetch_row($rslt); + $campaign_weight = $row[0]; + $calls_today = $row[1]; + $i++; + } + else + { + $campaign_weight = '0'; + $calls_today = '0'; + $stmt="INSERT INTO vicidial_campaign_agents (user,campaign_id,campaign_rank,campaign_weight,calls_today) values('$VD_login','$VD_campaign','0','0','$calls_today');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + } + $closer_chooser_string=''; + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,user_level,campaign_weight,calls_today) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$closer_chooser_string','$user_level','$campaign_weight','$calls_today');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='$VD_campaign',agent='Agent/$VD_login',verb='AGENTLOGIN',data1='$VD_login@agents',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSAALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + mysql_close($linkB); + mysql_select_db("$VARDB_database", $link); + } + + + if ($campaign_allow_inbound == 'Y') + { + print "\n"; + } + } + else + { + print "\n"; + + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,user_level) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$user_level');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='$VD_campaign',agent='Agent/$VD_login',verb='AGENTLOGIN',data1='$VD_login@agents',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSAALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + mysql_close($linkB); + mysql_select_db("$VARDB_database", $link); + } + } + } + else + { + echo "web client VICIDIAL: VICIDIAL Conexión en la Campaña\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Español
\n"; + echo "Lo siento, no hay leads en el hopper de esta campaña\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Conexión: \n
"; + echo "Contraseña:
\n"; + echo "Campaña: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + if (strlen($session_id) < 1) + { + echo "web client VICIDIAL: VICIDIAL Conexión en la Campaña\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Español
\n"; + echo "Sorry, there are no available sessions\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Conexión: \n
"; + echo "Contraseña:
\n"; + echo "Campaña: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + if (ereg('MSIE',$browser)) + { + $useIE=1; + print "\n"; + } + else + { + $useIE=0; + print "\n"; + } + + $StarTtimE = date("U"); + $NOW_TIME = date("Y-m-d H:i:s"); + ##### Agent is going to log in so insert the vicidial_agent_log entry now + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group,sub_status) values('$VD_login','$server_ip','$NOW_TIME','$VD_campaign','$StarTtimE','0','$StarTtimE','$VU_user_group','LOGIN');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id($link); + print "\n"; + + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $server_ip_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S"; + + ##### grab the datails of all active scripts in the system + $stmt="SELECT script_id,script_name,script_text FROM vicidial_scripts WHERE active='Y' order by script_id limit 100;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $MM_scripts = mysql_num_rows($rslt); + $e=0; + while ($e < $MM_scripts) + { + $row=mysql_fetch_row($rslt); + $MMscriptid[$e] =$row[0]; + $MMscriptname[$e] = rawurlencode($row[1]); + $MMscripttext[$e] = rawurlencode($row[2]); + $MMscriptids = "$MMscriptids'$MMscriptid[$e]',"; + $MMscriptnames = "$MMscriptnames'$MMscriptname[$e]',"; + $MMscripttexts = "$MMscripttexts'$MMscripttext[$e]',"; + $e++; + } + $MMscriptids = substr("$MMscriptids", 0, -1); + $MMscriptnames = substr("$MMscriptnames", 0, -1); + $MMscripttexts = substr("$MMscripttexts", 0, -1); + + } +} + +################################################################ +### BEGIN - build the callback calendar (12 months) ### +################################################################ +define ('ADAY', (60*60*24)); +$CdayARY = getdate(); +$Cmon = $CdayARY['mon']; +$Cyear = $CdayARY['year']; +$CTODAY = date("Y-m"); +$CTODAYmday = date("j"); +$CINC=0; + +$Cmonths = Array('Enero','February','Marcha','Abril','Puede','Junio', + 'Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'); +$Cdays = Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); + +$CCAL_OUT = ''; + +$CCAL_OUT .= ""; + +while ($CINC < 12) +{ +if ( ($CINC == 0) || ($CINC == 4) ||($CINC == 8) ) + {$CCAL_OUT .= "";} + +$CCAL_OUT .= ""; + +if ( ($CINC == 3) || ($CINC == 7) ||($CINC == 11) ) + {$CCAL_OUT .= "";} +$CINC++; +} + +$CCAL_OUT .= "
"; + +$CYyear = $Cyear; +$Cmonth= ($Cmon + $CINC); +if ($Cmonth > 12) + { + $Cmonth = ($Cmonth - 12); + $CYyear++; + } +$Cstart= mktime(11,0,0,$Cmonth,1,$CYyear); +$CfirstdayARY = getdate($Cstart); +#echo "|$Cmon|$Cmonth|$CINC|\n"; +$CPRNTDAY = date("Y-m", $Cstart); + +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; + +foreach($Cdays as $Cday) +{ + $CDCLR="#ffffff"; +$CCAL_OUT .= ""; +} + +for( $Ccount=0;$Ccount<(6*7);$Ccount++) +{ + $Cdayarray = getdate($Cstart); + if((($Ccount) % 7) == 0) + { + if($Cdayarray['mon'] != $CfirstdayARY['mon']) + break; + $CCAL_OUT .= ""; + } + if($Ccount < $CfirstdayARY['wday'] || $Cdayarray['mon'] != $Cmonth) + { + $CCAL_OUT .= ""; + } + else + { + if( ($Cdayarray['mday'] == $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + else + { + $CDCLR="#ffffff"; + if ( ($Cdayarray['mday'] < $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CDCLR="#CCCCCC"; + $CBL = ''; + $CEL = ''; + } + else + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + } + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + } +} +$CCAL_OUT .= ""; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$CfirstdayARY[month] $CfirstdayARY[year]"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$Cday"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
 "; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; + +#echo "$CCAL_OUT\n"; +################################################################ +### END - build the callback calendar (12 months) ### +################################################################ + + +?> + + + + +\n"; + + +?> + +
+ + MARGINWIDTH=0 MARGINHEIGHT=0 LEFTMARGIN=0 TOPMARGIN=0 VALIGN=TOP ALIGN=LEFT> +
+ + + +SALIR\n"; ?> +
+
+ + + height=30> + + + + + +
VICIDIALSCRIPT VALIGN=MIDDLE ALIGN=CENTER>   LIVE     sesión ID: Llamada Activa
+
+ + + + + height=>

VICIDIAL
+
+ + +MARCADO MANUAL       DIAL RÃPIDO
+
+ + +X SERVICIOS REPETIDOS ACTIVOS
+
+ + +
+
+ + + D1 - DIAL\n"; + echo "
\n"; + echo "D2 - DIAL\n"; + } + else {echo "
\n";} + ?> +

+
+
+ + + height=460>
SERVICIOS REPETIDOS PARA EL AGENTE :
Chasque encendido un servicio repetido abajo ahora para llamar la parte posteriora del cliente. Si usted chasca encendido un expediente abajo para llamarlo, será quitado de la lista. +
+
+
  + Recarga +                 + Vaya Detrás +
+
+ + + height=460>
NUEVO PLOMO MANUAL DEL DIAL PARA :

Incorpore la información abajo para el nuevo plomo que usted desea llamar. +
+ \n"; + } + ?> + Note: all new manual dial leads will go into list

+ + + + + + + + + + + + + + + +
Dial Código:   (Éste es generalmente un 1 en los U.S.A. y el Canadá)
Teléfono Number: +   (12 digits max - digits only) +
Plomos Existentes De la Búsqueda:   (Esta opción si está comprobada procurará encontrar el número de teléfono en el sistema antes de insertarlo como nuevo plomo)


Si usted desea marcar un número y hacerlo no agregar como nuevo plomo, entre en dialstring exacto ese usted desean llamar en el campo de la invalidación del dial abajo. Al retraso esta llamada usted tendrá que abrir las LLAMADAS EN ESTE acoplamiento de la SESIÓN en el fondo de la pantalla y colgarlas para arriba chascando en su acoplamiento del canal allí.
 
Inválidoación Del Dial:   (los dígitos satisfacen solamente) +
+
+ Dial Ahora +                 + Vaya Detrás +
+
+ + + +
+
+ + + + +Su Estado:
Calls Dialing: +
+ + + + + > + +
+
+ + Transferencia - Conferencia
+ + + CLOSER LOCAL + Colgar Línea Xfer + Colgar Ambas Líneas + +
+ + Número a llamar   + + INVALIDACIÓN DEL MARCADO   + ABANDONAR LLAMADA 3-WAY + Marcar Blind Transfer + D1 + D2 + +
+ + segundos   + channel + Marcar Con El Cliente + Dial Del Cliente Del Parque + Blind Transfer VMail Message +
+
+
+
+ + + + height=70> + +
Lead Dispositioned Como:

+ -
+
+
+ + + height=70> + + + + +
Teclas de acceso rápido a la Disposición: + Cuando esté activo, presione simplemente la tecla para la disposición deseada para esta llamada. La llamada después será colgada y dispositioned automáticamente:
+ + + + + +
+
+ + + height=70> + + + + + + +
Información Anterior Del Servicio repetido: close
+
+
+
+
+ +
+
+ + + height=500>
Nadie está en su sesión:
+ Vaya Detrás +

+ Agente De la Llamada Otra vez +
+
+ + + height=500>
El cliente ha colgado:
+ Vaya Detrás +

+ Final y llamada de la disposición + +
+
+ + + height=550>
Llamada Wrapup: segundos restantes en wrapup

+ +

+ Final Wrapup y movimiento encendido + +
+
+ + + height=500>
Se ha inhabilitado su sesión
SALIR

Vaya Detrás +
+
+ + + height=500>

SALIR
+
+ + +
+
+ + +
 
+
+ + + height=47>
Cualquier cambio realizado al cliente que no será la información abajo en este tiempo comitted, usted debe cambiar la información del cliente antes de usted retraso la llamada.
+
+ + + height=460>
DISPOSITION LLAMADA :       Retraso Otra vez       reduzca al mínimo
+ selección de la disposición del End-of-call +
+ PARAR LA LLAMADA
+ REINICIAR | + ENVIAR +

+ WEB FORM ENVIAR +

  +
+
+ + + height=460>
SELECCIONE Un CÓDIGO De la PAUSA :
+ Pausa Code Selection + +

  +
+
+ + + height=460>
Seleccione una fecha del servicio repetido :
+ + + Seleccione una fecha abajo   +     + Hour: +   + Minutes: +   + +  
+ MI SERVICIO REPETIDO SOLAMENTE
";} + ?> + Comentarios de los CBES:

+ + ENVIAR

+ +

  +
+
+ + + height=460>
SELECCIÓN DEL GRUPO DE ENTRANTES CLOSER
+ SELECCIÓN DEL GRUPO DE ENTRANTES CLOSER +
+ BLENDED LLAMADAING(Salientes activdas)
+ REINICIAR | + ENVIAR +



  +
+
+ + + + Canal + Canal + MI SERVICIO REPETIDO SOLAMENTE
";} + ?> +
+ + + + height=>
VICIDIAL SCRIPT
+
+ + + 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> +TECLAS ACCESO RÃPIDO INACTIVAS + + + + +> + + + +
versión web client VICIDIAL:     CONSTRUCCION:               Servidor:              
+Mostrar la información del canal Conferencia

 
+
+ + + +
+
+ + + + + id="MainTable"> + + + + + + + + + + + + + + + +
ESTADO:
+
+Marcar el Siguiente Número
+ MOSTRAR LEAD
+ TELÉFONO DEL ALT
+ + +GRABANDO ARCHIVO:
+
+
+GRABACIÓN ID:
+
+ +Comenzar La Grabación
+
+Formulario Web
+
+Aparcar llamada
+Transferencia - Conferencia
+
+Colgar al Cliente
+
+
Enviar DTMF

+
+
+
align=left valign=top> + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
segundos:   Canal:   Tiempo:
Información Del Cliente:
Título:   Primero:   IM:   Último:
Dirección1:
Dirección2:   Dirección3:
Ciudad:   Estado:   Código Postal:
Provincia:   Vendedor ID:
Teléfono:   Código Del Dial:   Teléfono Alt:
Demostración:   Email:
Comentarios: + +\n";} +else + {echo "\n";} +?> + +
+
+ +
+
> + 
+ + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/voicemail_check.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/voicemail_check.php new file mode 100644 index 00000000..f153ee04 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_es/voicemail_check.php @@ -0,0 +1,140 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "\n"; +echo "\n"; +echo "\n"; +echo "Comprobar el buzón de voz"; +echo "\n"; +echo "\n"; +echo "\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";} + $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";} + } + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/active_list_refresh.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/active_list_refresh.php new file mode 100644 index 00000000..013bf635 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/active_list_refresh.php @@ -0,0 +1,482 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "\n"; +echo "\n"; +echo "\n"; +echo "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 "\n"; +echo "\n"; +echo "\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 "\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + +###################### +# ADD=2 display all busy extensions on a server +###################### +if ($ADD==2) +{ + if (!$field_name) {$field_name = 'busyext';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\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 "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=4 display all busy Local lines on a server +###################### +if ($ADD==4) +{ + if (!$field_name) {$field_name = 'local';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\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 "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='table') {echo "\n";} +if ($format=='table') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/astguiclient.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/astguiclient.php new file mode 100644 index 00000000..d1182304 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/astguiclient.php @@ -0,0 +1,2905 @@ + LICENSE: GPLv2 +# +# make sure you have added a user to the vicidial_users MySQL table with at least +# user_level 1 or greater to access this page. Also you need to have the login +# and pass of a phone listed in the asterisk.phones table. The page grabs the +# server info and other details from this login and pass +# +# Other scripts that this application depends on: +# - active_list_refresh.php: displays active/live channels and phones +# - manager_send.php: sends Actions to be executed on Asterisk servers +# - live_exten_check.php: checks to see if user's phone is on a live call +# - call_log_display.php: retrieves log of inbound and outbound calls +# - voicemail_check.php: retrieves counts of new and old messages +# - inbound_popup.php: opens upon live_inbound call coming in +# - conf_exten_check.php: checks to see if and calls are in a specific conf +# - park_calls_display.php: retrieves list of parked calls +# - vdc_db_query.php: Changes values in the DB for non-calling records +# +# CHANGES +# 50215-1356 - Proof-of-concept test of XMLHttpRequest for astGUIclient web +# 50323-1411 - First build version display-only +# 50331-1040 - Second-build, added phone login and hangup/hijack display +# 50401-1006 - Trunk/Local Hangup functions enabled +# 50404-1056 - Trunk/Local Hijack functions enabled +# 50404-1459 - Simple live calls display and grabs updated time from server +# 50405-1221 - Reorganized the display and layers, added some images +# 50406-1005 - Added In/Out call log display to MAIN panel +# 50407-1254 - Start/Stop Recording on live calls enabled +# 50422-1101 - Activated Check Voicemail button and new/old messages count +# 50428-1449 - Added dial from log and basic live_inbound call popup +# 50429-1455 - Modified inbound popup code for IE and to add more functions +# 50502-1442 - Added basic method to transfer live calls somewhere else +# 50503-1205 - Added web_client_sessions entry for more security of subscripts +# 50503-1537 - Added basic conferences display +# 50509-1132 - Added conference connected list and hangup/xfer for them +# 50511-1129 - Added registration of conference rooms and added manual dial +# 50523-1342 - Added Conference recording and send DTMF +# 50523-1622 - Added Local Dial window frame for calling local extensions +# 50524-1456 - Added ability to park call and display number of parked calls +# 50524-1600 - Added ability to display and pickup/hangup/xfer parked calls +# 50525-1224 - Added ability to place outbound call from within conferene +# 50531-1225 - Added ability to do dual transfers to meetme rooms from Main +# 50711-1229 - removed HTTP authentication in favor of user/pass vars +# 50711-1610 - Added Zap monitoring to Trunk/Local Action screens +# 50804-1604 - Minor bug fix in inbound_popup functions +# 50818-1715 - Added pretty login section +# 50913-1137 - Added custom outbound_cid from phones table +# 51110-1430 - Fixed non-standard http port issue +# 60103-1421 - Added code for favorite extensions chooser +# 60104-1347 - Added basic layout for favorites editing frame +# 60105-1124 - Finished Favorites frame and added DB submission +# 60112-1622 - Several formatting changes +# 60421-1357 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1103 - Added variable filters to close security holes for login form +# 60829-1528 - Made compatible with WeBRooTWritablE setting in dbconnect.php +# + +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["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["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} + 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"];} + } + +$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++;} + +$version = '2.0.1'; +$build = '60829-1528'; + +### 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); + $user=ereg_replace("[^0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^0-9a-zA-Z]","",$pass); + + +if ($force_logout) +{ + if( (strlen($_SERVER['user'])>0) or (strlen($_SERVER['pass'])>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "Vous êtes maintenant déconnecté.\n"; + exit; +} + +$StarTtime = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_TIME = date("Ymd-His"); + $month_old = mktime(0, 0, 0, date("m"), date("d")-7, date("Y")); + $past_month_date = date("Y-m-d H:i:s",$month_old); + + $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]; + +$US='_'; +$CL=':'; +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./astguiclient_auth_entries.txt", "a");} +$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 = $agcPAGE; +$agcDIR = eregi_replace('astguiclient.php','',$agcDIR); + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth) or ($relogin == 'YES') ) + { + header ("Content-type: text/html; charset=utf-8"); + + echo "astGUIclient Client Web: Ouverture de Session\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Français
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Ouverture de Session
 
Ouverture de Session:
Mot de passe Utilisateur:
Ouverture de Session téléphonique:
Mot de passe du Téléphone:

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($user); + $password=strtoupper($pass); + $stmt="SELECT full_name,user_level from vicidial_users where user='$user' and pass='$pass'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICICOMPOSER|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICICOMPOSER|FAIL|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + } + +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 +echo "\n"; +echo "\n"; +echo "\n"; + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "astGUIclient Client Web: Ouverture de Session téléphonique\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "
English Français
\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Ouverture de Session téléphonique
 
Ouverture de Session téléphonique:
Mot de passe du Téléphone:

VERSION: $version       BUILD: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$authphone=$row[0]; +if (!$authphone) + { + echo "astGUIclient Client Web: Ouverture de Session téléphonique\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Français
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Ouverture de Session téléphonique
 
L'ouverture de la session Téléphonique à échoué, réessayez:
 
Ouverture de Session téléphonique:
Mot de passe du Téléphone:

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "astGUIclient Client Web\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $phone_login=$row[6]; + $phone_pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CaLLerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + $outbound_cid=$row[65]; + + $local_web_callerID_URL_enc = rawurlencode($local_web_callerID_URL); + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtime$US$session_ext$session_rand"; + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'agc';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','agc','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT count(*) from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_present=$row[0]; + if ($favorites_present > 0) + { + $stmt="SELECT extensions_list from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_list=$row[0]; + $h=0; + $favorites_listX = eregi_replace("'",'',$favorites_list); + $favorites = explode(',',$favorites_listX); + $favorites_count = count($favorites); + $favorites_listX=''; + + $o=0; + while ($favorites_count > $o) + { + $stmt="SELECT fullname,protocol from phones where extension = '$favorites[$o]' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $favorites_names[$o] = $rowx[0]; + $favorites_listX .= "$rowx[1]/$favorites[$o],"; + $o++; + } + + echo "\n"; + echo "\n"; + } + else + { + echo "\n"; + } + +### gather phone extensions and fullnames for favorites editor ### + $stmt="SELECT extension,fullname from phones where server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $exten_ct = mysql_num_rows($rslt); + $favlistCT=0; + $nofavlistCT=0; + while ($favlistCT < $exten_ct) + { + $row=mysql_fetch_row($rslt); + $favlist[$favlistCT]= "$row[0] - $row[1]"; + $favlistCT++; + } + + } +} + + +?> + + + + + + +\n"; + + +?> + +
+ + + + + + + + + +
+ + +DÉCONNEXION
\n"; ?> +
Ecran PrincipalLignes ActivesConférencesConsulter Votre Boite VocaleAppel en cours
+
+ + +

Logout
+
+ + +
TRUNK RACCROCHER

+ Active Trunks Menu
+ Raccrocher le Faisceau   |   + Intercepter le Faisceau   |   + Ecoute du Faisceau   |   + Rafraichir   |   + Retour à la Fenêtre Principale +
+
+ + +
RACROCHAGE LOCAL

+ Menu Local Actif
+ Raccrochage Local   |   + Interception Locale   |   + Ecoute Locale   |   + Rafraichir   |   + Retour à la Fenêtre Principale +
+
+ + + + + + + +
TRANSFERT D'APPEL EN COURS
Canal à transférer: Canal
Extensions:
Extensions
+
+ Renvoyer l'Appel

+ Renvoyer vers la Boite Vocale

+ Renvoyer vers ce Numéro:


+ Rafraichir


+ Retour à la Fenêtre Principale

+
Conférences:
(Selectionnez un Numéro de Conférence)
Renvoyez également mon canal
Conférences
+
+ + + + + +
Composer une Extension LOCALE
Téléphone appelant de: Canal
Extensions:
Extensions
+
+ Appeler l'extension séléctionnée

+ Appeler la boite vocale séléctionnée

+ Rafraichir


+ Retour à la Fenêtre Principale

+
+
+ + +
APPELS EN ATTENTE:
+ Retour à la Fenêtre Principale

+
+
+ + + + + + + + + + + + + + + +
  +
Boite Vocale     NOUVEAU:     ANCIEN:             APPEL MANUEL       COMPOSER
APPELS EN ATTENTE: 0                EXTENSIONS LOCALES
APPELS SORTANTS:
APPELS ENTRANTS:
astGUIclient Client Web: BUILD:
+ + + + $h) + { + if (strlen($favorites[$h])>1) + { + echo "\n"; + } + $h++; + } +?> + +
FAVORIS       Modifier
$favorites[$h] - $favorites_names[$h]
 
+
+ + + + + + + +
FAVORIS

 
Modification de paramétrage - vous devrez vous fermer la session
RETOUR À LA FENÊTRE PRINCIPALE - annuler les modifications
+
+ +
+ + + + + + + + + + + + + +
+PAUSE | DEBUT     Vitesse de rafraichissement: 1000 ms Plus rapidement | Plus lentement

+
Initialisation..
+
Extensions Actives
+RAFRAICHIR | +ORDRE | +
Lignes Extérieures
+RAFRAICHIR | +ORDRE | +
Extensions Locales
+RAFRAICHIR | +ORDRE | +
+ Données Transférées vers

+
+ Données Transférées vers

Action sur Faisceau +
+ Données Transférées vers

Action Locale +
+
+ + + + +
+ + +Liste Des Conférences + + + +
+Cliquez à Gauche du numéro de salle de conférence pour obtenir des informations +
+ + + + + + + + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/call_log_display.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/call_log_display.php new file mode 100644 index 00000000..723cbca9 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/call_log_display.php @@ -0,0 +1,196 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "\n"; +echo "\n"; +echo "\n"; +echo "Affichage de l'historique d'Appel"; +echo "\n"; +echo "\n"; +echo "\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";} + $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";} + $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"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/conf_exten_check.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/conf_exten_check.php new file mode 100644 index 00000000..415c0e14 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/conf_exten_check.php @@ -0,0 +1,297 @@ + LICENSE: GPLv2 +# +# 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 +# + +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"];} + +$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";} + +$version = '2.0.4-12'; +$build = '71122-0205'; +$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";} + $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 "\n"; +echo "\n"; +echo "\n"; +echo "Vérification de l'extension de la Conférence"; +echo "\n"; +echo "\n"; +echo "\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; + + ### 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); + $row=mysql_fetch_row($rslt); + $Acount=$row[0]; + + if ($Acount > 0) + { + $stmt="SELECT status from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Astatus=$row[0]; + } + # ### 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";} + $rslt=mysql_query($stmt, $link); + + if ($campagentstdisp == 'YES') + { + ### grab the status of this agent to display + $stmt="SELECT status,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Alogin=$row[0]; + $Acampaign=$row[1]; + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where server_ip='$server_ip' and status NOT IN('XFER') and campaign_id='$Acampaign';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $RingCalls=$row[0]; + } + else + { + $Alogin='N'; + $RingCalls='N'; + } + } + else + { + $Alogin='N'; + $RingCalls='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";} + $rslt=mysql_query($stmt, $link); + + } + + if ($Acount < 1) {$Alogin='DEAD_VLA';} + if ($AexternalDEAD > 0) {$Alogin='DEAD_EXTERNAL';} + + echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Statut: ' . $Astatus . "|\n"; + + } + $total_conf=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + 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";} + } + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $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++; $total_conf++; + $row=mysql_fetch_row($rslt); + $CanalA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + } + $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";} + $rslt=mysql_query($stmt, $link); + } + echo "Conférence $conf_exten a été attribué à $exten\n"; + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/dbconnect.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/dbconnect.php new file mode 100644 index 00000000..7221b35e --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/dbconnect.php @@ -0,0 +1,48 @@ + LICENSE: GPLv2 +# +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"); +mysql_select_db("$VARDB_database"); + +$local_DEF = 'Local/'; +$conf_silent_prefix = '7'; +$local_AMP = '@'; +$ext_context = 'demo'; +$recording_exten = '8309'; +$WeBRooTWritablE = '1'; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/inbound_popup.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/inbound_popup.php new file mode 100644 index 00000000..12da02df --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/inbound_popup.php @@ -0,0 +1,351 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "\n"; +echo "\n"; +echo "\n"; +?> + + +APPEL ENTRANT EN COURS"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "

APPEL ENTRANT EN COURS

\n"; +echo "$NOW_TIME

\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 * FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $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";} + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Canal: $row[1]
Appelant: $row[3]
\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 "GOOGLE - \n"; + echo "ANYWHO - \n"; + echo "SWITCHBOARD - \n"; + echo "VERIZON - \n"; + echo "WHITEPAGES - \n"; + echo "411.COM - \n"; + echo "411.COM - \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 "COUTUME - \n"; + + echo "
Numéro Composé: $row[8]
Notes: $row[9]|$row[10]|$row[11]|$row[12]|$row[13]|
\n"; + echo "RACCROCHER - \n"; + echo "ENVOYEZ VERS MA BOITE VOCALE\n"; + echo "
\n"; + + + $stmt="UPDATE live_inbound set acknowledged='Y' where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + + } + + + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/live_exten_check.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/live_exten_check.php new file mode 100644 index 00000000..2a734ad9 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/live_exten_check.php @@ -0,0 +1,278 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "\n"; +echo "\n"; +echo "\n"; +echo "Vérification De l'extension"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + +echo "DateTime: $NOW_TIME|"; +echo "UnixTime: $StarTtime|"; + +$stmt="SELECT count(*) FROM parked_channels where server_ip = '$server_ip';"; + if ($format=='debug') {echo "\n";} +$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";} + $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";} + } + } + + $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";} + $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";} + $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";} + $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";} + $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";} +$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";} + } + +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";} + $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";} + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/manager_send.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/manager_send.php new file mode 100644 index 00000000..e0d38628 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/manager_send.php @@ -0,0 +1,1142 @@ + LICENSE: GPLv2 +# +# This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk 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: +# - $ACTION - ('Originate','Redirect','Hangup','Command','Monitor','StopMonitor','SysCIDOriginate','RedirectName','RedirectNameVmail','MonitorConf','StopMonitorConf','RedirectXtra','RedirectXtraCX','RedirectVD','HangupConfDial','VolumeControl','OriginateVDRelogin') +# - $queryCID - ('CN012345678901234567',...) +# - $format - ('text','debug') +# - $channel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +# - $exten - ('1234','913125551212',...) +# - $ext_context - ('default','demo',...) +# - $ext_priority - ('1','2',...) +# - $filename - ('20050406-125623_44444',...) +# - $extenName - ('phone100',...) +# - $parkedby - ('phone100',...) +# - $extrachannel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +# - $auto_dial_level - ('0','1','1.1',...) +# - $campaign - ('CLOSER','TESTCAMP',...) +# - $uniqueid - ('1120232758.2406800',...) +# - $lead_id - ('1234',...) +# - $seconds - ('32',...) +# - $outbound_cid - ('3125551212','0000000000',...) +# - $agent_log_id - ('123456',...) +# - $call_server_ip - ('10.10.10.15',...) +# - $CalLCID - ('VD01234567890123456',...) +# - $stage - ('UP','DOWN') +# + +# CHANGELOG: +# 50401-1002 - First build of script, Hangup function only +# 50404-1045 - Redirect basic function enabled +# 50406-1522 - Monitor basic function enabled +# 50407-1647 - Monitor and StopMonitor full functions enabled +# 50422-1120 - basic Originate function enabled +# 50428-1451 - basic SysCIDOriginate function enabled for checking voicemail +# 50502-1539 - basic RedirectName and RedirectNameVmail added +# 50503-1227 - added session_name checking for extra security +# 50523-1341 - added Conference call start/stop recording +# 50523-1421 - added OriginateName and OriginateNameVmail for local calls +# 50524-1602 - added RedirectToPark and RedirectFromPark +# 50531-1203 - added RedirecXtra for dual channel redirection +# 50630-1100 - script changed to not use HTTP login vars, user/pass instead +# 50804-1148 - Added RedirectVD for VICIDIAL blind redirection with logging +# 50815-1204 - Added NEXTAVAILABLE to RedirectXtra function +# 50903-2343 - Added HangupConfDial function to hangup in-dial channels in conf +# 50913-1057 - Added outbound_cid set if present to originate call +# 51020-1556 - Added agent_log_id framework for detailed agent activity logging +# 51118-1204 - Fixed Blind transfer bug from VICIDIAL when in manual dial mode +# 51129-1014 - Added ability to accept calls from other VICIDIAL servers +# 51129-1253 - Fixed Hangups of other agents channels in VICIDIAL AD +# 60310-2022 - Fixed NEXTAVAILABLE bug in leave-3way-call redirect function +# 60421-1413 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1158 - Added variable filters to close security holes for login form +# 60809-1544 - Added direct transfers to leave-3ways in consultative transfers +# 61004-1526 - Added parsing of volume control command and lookup or number +# 61130-1617 - Added lead_id to MonitorConf for recording_log +# 61201-1115 - Added user to MonitorConf for recording_log +# 70111-1600 - added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70226-1251 - Added Mute/UnMute to conference volume control +# 70320-1502 - Added option to allow retry of leave-3way-call and debug logging +# 70322-1636 - Added sipsak display ability +# + +require("dbconnect.php"); + +### These are variable assignments for PHP globals off +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["ACTION"])) {$ACTION=$_GET["ACTION"];} + elseif (isset($_POST["ACTION"])) {$ACTION=$_POST["ACTION"];} +if (isset($_GET["queryCID"])) {$queryCID=$_GET["queryCID"];} + elseif (isset($_POST["queryCID"])) {$queryCID=$_POST["queryCID"];} +if (isset($_GET["format"])) {$format=$_GET["format"];} + elseif (isset($_POST["format"])) {$format=$_POST["format"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["exten"])) {$exten=$_GET["exten"];} + elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];} +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["filename"])) {$filename=$_GET["filename"];} + elseif (isset($_POST["filename"])) {$filename=$_POST["filename"];} +if (isset($_GET["extenName"])) {$extenName=$_GET["extenName"];} + elseif (isset($_POST["extenName"])) {$extenName=$_POST["extenName"];} +if (isset($_GET["parkedby"])) {$parkedby=$_GET["parkedby"];} + elseif (isset($_POST["parkedby"])) {$parkedby=$_POST["parkedby"];} +if (isset($_GET["extrachannel"])) {$extrachannel=$_GET["extrachannel"];} + elseif (isset($_POST["extrachannel"])) {$extrachannel=$_POST["extrachannel"];} +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["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} + elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["secondS"])) {$secondS=$_GET["secondS"];} + elseif (isset($_POST["secondS"])) {$secondS=$_POST["secondS"];} +if (isset($_GET["outbound_cid"])) {$outbound_cid=$_GET["outbound_cid"];} + elseif (isset($_POST["outbound_cid"])) {$outbound_cid=$_POST["outbound_cid"];} +if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];} + elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];} +if (isset($_GET["call_server_ip"])) {$call_server_ip=$_GET["call_server_ip"];} + elseif (isset($_POST["call_server_ip"])) {$call_server_ip=$_POST["call_server_ip"];} +if (isset($_GET["CalLCID"])) {$CalLCID=$_GET["CalLCID"];} + elseif (isset($_POST["CalLCID"])) {$CalLCID=$_POST["CalLCID"];} +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["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} +if (isset($_GET["phone_ip"])) {$phone_ip=$_GET["phone_ip"];} + elseif (isset($_POST["phone_ip"])) {$phone_ip=$_POST["phone_ip"];} +if (isset($_GET["enable_sipsak_messages"])) {$enable_sipsak_messages=$_GET["enable_sipsak_messages"];} + elseif (isset($_POST["enable_sipsak_messages"])) {$enable_sipsak_messages=$_POST["enable_sipsak_messages"];} +if (isset($_GET["allow_sipsak_messages"])) {$allow_sipsak_messages=$_GET["allow_sipsak_messages"];} + elseif (isset($_POST["allow_sipsak_messages"])) {$allow_sipsak_messages=$_POST["allow_sipsak_messages"];} + +$user=ereg_replace("[^0-9a-zA-Z]","",$user); +$pass=ereg_replace("[^0-9a-zA-Z]","",$pass); +$secondS = ereg_replace("[^0-9]","",$secondS); + +# default optional vars if not set +if (!isset($ACTION)) {$ACTION="Originate";} +if (!isset($format)) {$format="alert";} +if (!isset($ext_priority)) {$ext_priority="1";} + +$version = '2.0.29'; +$build = '70320-1502'; +$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 "\n"; +echo "\n"; +echo "\n"; +echo "Envoi de l'Administrateur: "; +if ($ACTION=="Originate") {echo "Originate";} +if ($ACTION=="Redirect") {echo "Redirect";} +if ($ACTION=="RedirectName") {echo "RedirectName";} +if ($ACTION=="Hangup") {echo "Hangup";} +if ($ACTION=="Command") {echo "Command";} +if ($ACTION==99999) {echo "AIDE";} +echo "\n"; +echo "\n"; +echo "\n"; +} + + + + + +###################### +# ACTION=SysCIDOriginate - insert Originate Manager statement allowing small CIDs for system calls +###################### +if ($ACTION=="SysCIDOriginate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<1) ) + { + echo "Exten $exten est invalide or queryCID $queryCID est invalide, Originate commande non insérée\n"; + } + else + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate commande envoyée pour Exten $exten Canal $channel sur $server_ip\n"; + } +} + + + +###################### +# ACTION=Originate, OriginateName, OriginateNameVmail - insert Originate Manager statement +###################### +if ($ACTION=="OriginateName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Une de ces variables est invalide:\n"; + echo "Canal $channel doit avoir plus de 2 caractères \n"; + echo "queryCID $queryCID doit avoir plus de 14 caractères \n"; + echo "extenName $extenName est obligatoire\n"; + echo "ext_context $ext_context est obligatoire\n"; + echo "ext_priority $ext_priority est obligatoire\n"; + echo "\nOriginateName Action pas envoyé\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="OriginateNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Une de ces variables est invalide:\n"; + echo "Canal $channel doit avoir plus de 2 caractères \n"; + echo "queryCID $queryCID doit avoir plus de 14 caractères \n"; + echo "extenName $extenName est obligatoire\n"; + echo "exten $exten est obligatoire\n"; + echo "ext_context $ext_context est obligatoire\n"; + echo "ext_priority $ext_priority est obligatoire\n"; + echo "\nOriginateNameVmail Action pas envoyé\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="OriginateVDRelogin") +{ + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $CIDdate = date("ymdHis"); + $DS='-'; + $SIPSAK_prefix = 'LIN-'; + print "\n"; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$campaign\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + $queryCID = "$SIPSAK_prefix$campaign$DS$CIDdate"; + + } + $ACTION="Originate"; +} + +if ($ACTION=="Originate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<10) ) + { + echo "Exten $exten est invalide or queryCID $queryCID est invalide, Originate commande non insérée\n"; + } + else + { + if (strlen($outbound_cid)>1) + {$outCID = "\"$queryCID\" <$outbound_cid>";} + else + {$outCID = "$queryCID";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate commande envoyée pour Exten $exten Canal $channel sur $server_ip\n"; + } +} + + + +###################### +# ACTION=HangupConfDial - find the Local channel that is in the conference and needs to be hung up +###################### +if ($ACTION=="HangupConfDial") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($queryCID)<15) or (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "conference $exten est invalide or ext_context $ext_context or queryCID $queryCID est invalide, Hangup commande non insérée\n"; + } + else + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $hangup_channel_prefix = "$local_DEF$exten$local_AMP$ext_context"; + + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row > 0) + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $channel=$rowx[0]; + $ACTION="Hangup"; + $queryCID = eregi_replace("^.","G",$queryCID); + } + } +} + + + +###################### +# ACTION=Hangup - insert Hangup Manager statement +###################### +if ($ACTION=="Hangup") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) ) + { + $channel_live=0; + echo "Canal $channel est invalide or queryCID $queryCID est invalide, Hangup commande non insérée\n"; + } + else + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + +# $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# if ($row[0]==0) +# { +# $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $rowx=mysql_fetch_row($rslt); +# if ($rowx[0]==0) +# { +# $channel_live=0; +# echo "Channel $channel is not live on $call_server_ip, Hangup command not inserted\n"; +# } +# } + if ( ($auto_dial_level > 0) and (strlen($CalLCID)>2) and (strlen($exten)>2) and ($secondS > 4)) + { + $stmt="SELECT count(*) FROM vicidial_auto_calls where channel='$channel' and callerid='$CalLCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + echo "Call $CalLCID $channel n'est pas en ligne sur $call_server_ip, Checking Live Canal...\n"; + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel' and extension LIKE \"%$exten\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $channel_live=0; + echo "Canal $channel n'est pas en ligne sur $call_server_ip, Hangup commande non insérée $rowx[0]\n$stmt\n"; + } + else + { + echo "$stmt\n"; + } + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Hangup','$queryCID','Channel: $channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Hangup commande envoyée pour Canal $channel sur $call_server_ip\n"; + } + } +} + + + +###################### +# ACTION=Redirect, RedirectName, RedirectNameVmail, RedirectToPark, RedirectFromPark, RedirectVD, RedirectXtra, RedirectXtraCX +# - insert Redirect Manager statement using extensions name +###################### +if ($ACTION=="RedirectVD") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($campaign)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($uniqueid)<2) or (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "Une de ces variables est invalide:\n"; + echo "Canal $channel doit avoir plus de 2 caractères \n"; + echo "queryCID $queryCID doit avoir plus de 14 caractères \n"; + echo "exten $exten est obligatoire\n"; + echo "ext_context $ext_context est obligatoire\n"; + echo "ext_priority $ext_priority est obligatoire\n"; + echo "auto_dial_level $auto_dial_level est obligatoire\n"; + echo "campaign $campaign est obligatoire\n"; + echo "uniqueid $uniqueid est obligatoire\n"; + echo "lead_id $lead_id est obligatoire\n"; + echo "\nRedirectVD Action pas envoyé\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($auto_dial_level < 1) + { + $stmt = "UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectToPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($parkedby)<1) ) + { + $channel_live=0; + echo "Une de ces variables est invalide:\n"; + echo "Canal $channel doit avoir plus de 2 caractères \n"; + echo "queryCID $queryCID doit avoir plus de 14 caractères \n"; + echo "exten $exten est obligatoire\n"; + echo "extenName $extenName est obligatoire\n"; + echo "ext_context $ext_context est obligatoire\n"; + echo "ext_priority $ext_priority est obligatoire\n"; + echo "parkedby $parkedby est obligatoire\n"; + echo "\nRedirectToPark Action pas envoyé\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "INSERT INTO parked_channels values('$channel','$server_ip','','$extenName','$parkedby','$NOW_TIME');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectFromPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Une de ces variables est invalide:\n"; + echo "Canal $channel doit avoir plus de 2 caractères \n"; + echo "queryCID $queryCID doit avoir plus de 14 caractères \n"; + echo "exten $exten est obligatoire\n"; + echo "ext_context $ext_context est obligatoire\n"; + echo "ext_priority $ext_priority est obligatoire\n"; + echo "\nRedirectFromPark Action pas envoyé\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "DELETE FROM parked_channels where server_ip='$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Une de ces variables est invalide:\n"; + echo "Canal $channel doit avoir plus de 2 caractères \n"; + echo "queryCID $queryCID doit avoir plus de 14 caractères \n"; + echo "extenName $extenName est obligatoire\n"; + echo "ext_context $ext_context est obligatoire\n"; + echo "ext_priority $ext_priority est obligatoire\n"; + echo "\nRedirectName Action pas envoyé\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Une de ces variables est invalide:\n"; + echo "Canal $channel doit avoir plus de 2 caractères \n"; + echo "queryCID $queryCID doit avoir plus de 14 caractères \n"; + echo "extenName $extenName est obligatoire\n"; + echo "exten $exten est obligatoire\n"; + echo "ext_context $ext_context est obligatoire\n"; + echo "ext_priority $ext_priority est obligatoire\n"; + echo "\nRedirectNameVmail Action pas envoyé\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectXtraCX") +{ + $DBout=''; + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "Une de ces variables est invalide:\n"; + echo "Canal $channel doit avoir plus de 2 caractères \n"; + echo "ExtraCanal $extrachannel doit avoir plus de 2 caractères \n"; + echo "queryCID $queryCID doit avoir plus de 14 caractères \n"; + echo "exten $exten est obligatoire\n"; + echo "ext_context $ext_context est obligatoire\n"; + echo "ext_priority $ext_priority est obligatoire\n"; + echo "\nRedirect Action pas envoyé\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDCXC|$filename|$user|$campaign|$channel|$extrachannel|$queryCID|$exten|$ext_context|ext_priority|\n"); + fclose($fp); + } + } + } + else + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Canal $channel n'est pas en ligne sur $call_server_ip, Redirect commande non insérée\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel n'est pas en ligne sur $call_server_ip";} + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Canal $channel n'est pas en ligne sur $server_ip, Redirect commande non insérée\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel n'est pas en ligne sur $server_ip";} + } + } + if ( ($channel_liveX==1) && ($channel_liveY==1) ) + { + $stmt="SELECT count(*) FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0] < 1) + { + $channel_liveY=0; + echo "No Local agent to send call to, Redirect commande non insérée\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "No Local agent to send call to";} + } + else + { + $stmt="SELECT server_ip,conf_exten,user FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $dest_server_ip = $rowx[0]; + $dest_session_id = $rowx[1]; + $dest_user = $rowx[2]; + $S='*'; + + $D_s_ip = explode('.', $dest_server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$dest_session_id$S$lead_id$S$dest_user$S$phone_code$S$phone_number$S$campaign$S"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','$queryCID','Channel: $extrachannel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtraCX commande envoyée pour Canal $channel sur $call_server_ip and \nHungup $extrachannel sur $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel sur $call_server_ip, Hungup $extrachannel sur $server_ip";} + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "Changed to Redirect: $channel sur $server_ip";} + } + + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDCXC|$filename|$user|$campaign|$DBout|\n"); + fclose($fp); + } + } + + } +} + +if ($ACTION=="RedirectXtra") +{ + if ($channel=="$extrachannel") + {$ACTION="Redirect";} + else + { + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "Une de ces variables est invalide:\n"; + echo "Canal $channel doit avoir plus de 2 caractères \n"; + echo "ExtraCanal $extrachannel doit avoir plus de 2 caractères \n"; + echo "queryCID $queryCID doit avoir plus de 14 caractères \n"; + echo "exten $exten est obligatoire\n"; + echo "ext_context $ext_context est obligatoire\n"; + echo "ext_priority $ext_priority est obligatoire\n"; + echo "\nRedirect Action pas envoyé\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDX|$filename|$user|$campaign|$$channel|$extrachannel|$queryCID|$exten|$ext_context|ext_priority|\n"); + fclose($fp); + } + } + } + else + { + if ($exten == "NEXTAVAILABLE") + { + $stmt="SELECT conf_exten FROM conferences where server_ip='$server_ip' and ((extension='') or (extension is null)) limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if (strlen($row[0]) > 3) + { + $stmt="UPDATE conferences set extension='$user' where server_ip='$server_ip' and conf_exten='$row[0]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $exten = $row[0]; + } + else + { + $channel_liveX=0; + echo "Il n'y a pas de conférence disponible sur $server_ip, Redirect commande non insérée\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "Il n'y a pas de conférence disponible sur $server_ip";} + } + } + + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Canal $channel n'est pas en ligne sur $call_server_ip, Redirect commande non insérée\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel n'est pas en ligne sur $call_server_ip";} + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Canal $channel n'est pas en ligne sur $server_ip, Redirect commande non insérée\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel n'est pas en ligne sur $server_ip";} + } + } + if ( ($channel_liveX==1) && ($channel_liveY==1) ) + { + if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','ExtraChannel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra commande envoyée pour Canal $channel and \nExtraCanal $extrachannel\n to $exten sur $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel and $extrachannel to $exten sur $server_ip";} + } + else + { + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$exten"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra commande envoyée pour Canal $channel sur $call_server_ip and \nExtraCanal $extrachannel\n to $exten sur $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel/$call_server_ip and $extrachannel/$server_ip to $exten";} + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + + } + + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDX|$filename|$user|$campaign|$DBout|\n"); + fclose($fp); + } + } + + } + } +} + + +if ($ACTION=="Redirect") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Une de ces variables est invalide:\n"; + echo "Canal $channel doit avoir plus de 2 caractères \n"; + echo "queryCID $queryCID doit avoir plus de 14 caractères \n"; + echo "exten $exten est obligatoire\n"; + echo "ext_context $ext_context est obligatoire\n"; + echo "ext_priority $ext_priority est obligatoire\n"; + echo "\nRedirect Action pas envoyé\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Canal $channel n'est pas en ligne sur $server_ip, Redirect commande non insérée\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "Redirect commande envoyée pour Canal $channel sur $server_ip\n"; + } + } +} + + + +###################### +# ACTION=Monitor or Stop Monitor - insert Monitor/StopMonitor Manager statement to start recording on a channel +###################### +if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) +{ + if ($ACTION=="StopMonitor") + {$SQLfile = "";} + else + {$SQLfile = "File: $filename";} + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Canal $channel est invalide or queryCID $queryCID est invalide or filename: $filename est invalide, $ACTION commande non insérée\n"; + } + else + { + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Canal $channel n'est pas en ligne sur $server_ip, $ACTION commande non insérée\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','$ACTION','$queryCID','Channel: $channel','$SQLfile','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + if ($ACTION=="Monitor") + { + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + } + echo "$ACTION commande envoyée pour Canal $channel sur $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n"; + } + } +} + + + + + + +###################### +# ACTION=MonitorConf or StopMonitorConf - insert Monitor/StopMonitor Manager statement to start recording on a conference +###################### +if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($channel)<4) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Canal $channel est invalide or exten $exten est invalide or filename: $filename est invalide, $ACTION commande non insérée\n"; + } + else + { + + if ($ACTION=="MonitorConf") + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$filename','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $filename','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + # find and hang up all recordings going sur in this conference # and extension = '$exten' + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$channel%\" and channel LIKE \"%,1\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + # $rec_count = intval(mysql_num_rows($rslt) / 2); + $rec_count = mysql_num_rows($rslt); + $h=0; + while ($rec_count>$h) + { + $rowx=mysql_fetch_row($rslt); + $HUchannel[$h] = $rowx[0]; + $h++; + } + $i=0; + while ($h>$i) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$i','Channel: $HUchannel[$i]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $i++; + } + + } + echo "$ACTION commande envoyée pour Canal $channel sur $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n L'ENREGISTREMENT DURERA AU MAXIMUM 60 MINUTES\n"; + } +} + + + + + +###################### +# ACTION=VolumeControl - raise or lower the volume of a meetme participant +###################### +if ($ACTION=="VolumeControl") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($stage)<1) or (strlen($queryCID)<1) ) + { + echo "Conférence $exten, Stage $stage est invalide or queryCID $queryCID est invalide, Originate commande non insérée\n"; + } + else + { + $participant_number='XXYYXXYYXXYYXX'; + if (eregi('UP',$stage)) {$vol_prefix='4';} + if (eregi('DOWN',$stage)) {$vol_prefix='3';} + if (eregi('UNMUTE',$stage)) {$vol_prefix='2';} + if (eregi('MUTING',$stage)) {$vol_prefix='1';} + $local_DEF = 'Local/'; + $local_AMP = '@'; + $volume_local_channel = "$local_DEF$participant_number$vol_prefix$exten$local_AMP$ext_context"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $volume_local_channel','Context: $ext_context','Exten: 8300','Priority: 1','Callerid: $queryCID','','','','$channel','$exten');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Volume commande envoyée pour Conférence $exten, Stage $stage Canal $channel sur $server_ip\n"; + } +} + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='debug') {echo "\n";} +if ($format=='debug') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/park_calls_display.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/park_calls_display.php new file mode 100644 index 00000000..c50f7365 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/park_calls_display.php @@ -0,0 +1,146 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "\n"; +echo "\n"; +echo "\n"; +echo "Affichage des appels en Attente"; +echo "\n"; +echo "\n"; +echo "\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 * from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;"; + if ($format=='debug') {echo "\n";} + $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"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/vdc_db_query.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/vdc_db_query.php new file mode 100644 index 00000000..b9b7f19f --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/vdc_db_query.php @@ -0,0 +1,2535 @@ + LICENSE: GPLv2 +# +# 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 - ('regCLOSER','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCALL','manDiaLlogCALL','userLOGout','updateDISPO','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs','CalLBacKLisT','CalLBacKCounT','PauseCodeSubmit','LogiNCamPaigns') +# - $stage - ('start','finish','lookup','new') +# - $closer_choice - ('CL_TESTCAMP_L CL_OUT123_L -') +# - $conf_exten - ('8600011',...) +# - $exten - ('123test',...) +# - $ext_context - ('default','demo',...) +# - $ext_priority - ('1','2',...) +# - $campaign - ('testcamp',...) +# - $dial_timeout - ('60','26',...) +# - $dial_prefix - ('9','8',...) +# - $campaign_cid - ('3125551212','0000000000',...) +# - $MDnextCID - ('M06301413000000002',...) +# - $uniqueid - ('1120232758.2406800',...) +# - $lead_id - ('36524',...) +# - $list_id - ('101','123456',...) +# - $length_in_sec - ('12',...) +# - $phone_code - ('1',...) +# - $phone_number - ('3125551212',...) +# - $channel - ('Zap/12-1',...) +# - $start_epoch - ('1120236911',...) +# - $vendor_lead_code - ('1234test',...) +# - $title - ('Mr.',...) +# - $first_name - ('Bob',...) +# - $middle_initial - ('L',...) +# - $last_name - ('Wilson',...) +# - $address1 - ('1324 Main St.',...) +# - $address2 - ('Apt. 12',...) +# - $address3 - ('co Robert Wilson',...) +# - $city - ('Chicago',...) +# - $state - ('IL',...) +# - $province - ('NA',...) +# - $postal_code - ('60054',...) +# - $country_code - ('USA',...) +# - $gender - ('M',...) +# - $date_of_birth - ('1970-01-01',...) +# - $alt_phone - ('3125551213',...) +# - $email - ('bob@bob.com',...) +# - $security_phrase - ('Hello',...) +# - $comments - ('Good Customer',...) +# - $auto_dial_level - ('0','1','1.2',...) +# - $VDstop_rec_after_each_call - ('0','1') +# - $conf_silent_prefix - ('7','8','',...) +# - $extension - ('123','user123','25-1',...) +# - $protocol - ('Zap','SIP','IAX2',...) +# - $user_abb - ('1234','6666',...) +# - $preview - ('YES','NO',...) +# - $called_count - ('0','1','2',...) +# - $agent_log_id - ('123456',...) +# - $agent_log - ('NO',...) +# - $favorites_list - (",'cc160','cc100'",...) +# - $CallBackDatETimE - ('2006-04-21 14:30:00',...) +# - $recipient - ('ANYONE,'USERONLY') +# - $callback_id - ('12345','12346',...) +# - $use_internal_dnc - ('Y','N') +# - $omit_phone_code - ('Y','N') +# - $no_delete_sessions - ('0','1') + +# CHANGELOG: +# 50629-1044 - First build of script +# 50630-1422 - Added manual dial action and MD channel lookup +# 50701-1451 - Added dial log for start and end of vicidial calls +# 50705-1239 - Added call disposition update +# 50804-1627 - Fixed updateDispo to update vicidial_log entry +# 50816-1605 - Added VDADpause/ready for auto dialing +# 50816-1811 - Added basic autodial call pickup functions +# 50817-1005 - Altered logging functions to accomodate auto_dialing +# 50818-1305 - Added stop-all-recordings-after-each-vicidial-call option +# 50818-1411 - Added hangup of agent phone after Logout +# 50901-1315 - Fixed CLOSER IN-GROUP Web Form bug +# 50902-1507 - Fixed CLOSER log length_in_sec bug +# 50902-1730 - Added functions for manual preview dialing and revert +# 50913-1214 - Added agent random update to leadupdate +# 51020-1421 - Added agent_log_id framework for detailed agent activity logging +# 51021-1717 - Allows for multi-line comments (changes \n to !N in database) +# 51111-1046 - Added vicidial_agent_log lead_id earlier for manual dial +# 51121-1445 - Altered echo statements for several small PHP speed optimizations +# 51122-1328 - Fixed UserLogout issue not removing conference reservation +# 51129-1012 - Added ability to accept calls from other VICIDIAL servers +# 51129-1729 - Changed manual dial to use the '/n' flag for calls +# 51221-1154 - Added SCRIPT id lookup and sending to vicidial.php for display +# 60105-1059 - Added Updating of astguiclient favorites in the DB +# 60208-1617 - Added dtmf buttons output per call +# 60213-1521 - Added closer_campaigns update to vicidial_users +# 60215-1036 - Added Callback date-time entry into vicidial_callbacks table +# 60413-1541 - Added USERONLY Callback listings output - CalLBacKLisT +# - Added USERONLY Callback count output - CalLBacKCounT +# 60414-1140 - Added Callback lead lookup for manual dialing +# 60419-1517 - After CALLBK is sent to agent, update callback record to INACTIVE +# 60421-1419 - Check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60427-1236 - Fixed closer_choice error for CLOSER campaigns +# 60609-1148 - Added ability to check for manual dial numbers in DNC +# 60619-1117 - Added variable filters to close security holes for login form +# 60623-1414 - Fixed variable filter for phone_code and fixed manual dial logic +# 60821-1600 - Added ability to omit the phone code on vicidial lead dialing +# 60821-1647 - Added ability to not delete sessions at logout +# 60906-1124 - Added lookup and sending of callback data for CALLBK calls +# 61128-2229 - Added vicidial_live_agents and vicidial_auto_calls manual dial entries +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70115-1733 - Added alt_dial functionality in auto-dial modes +# 70118-1501 - Added user_group to vicidial_log,_agent_log,_closer_log,_callbacks +# 70123-1357 - Fixed bug that would not update vicidial_closer_log status to dispo +# 70202-1438 - Added pause code submit function +# 70203-0930 - Added dialed_number to lead info output +# 70203-1030 - Added dialed_label to lead info output +# 70206-1126 - Added INBOUND status for inbound/closer calls in vicidial_live_agents +# 70212-1253 - Fixed small issue with CXFER +# 70213-1431 - Added QueueMetrics PAUSE/UNPAUSE/AGENTLOGIN/AGENTLOGOFF actions +# 70214-1231 - Added queuemetrics_log_id field for server_id in queue_log +# 70215-1210 - Added queuemetrics COMPLETEAGENT action +# 70216-1051 - Fixed double call complete queuemetrics logging +# 70222-1616 - Changed queue_log PAUSE/UNPAUSE to PAUSEALL/UNPAUSEALL +# 70309-1034 - Allow amphersands and questions marks in comments to pass through +# 70313-1052 - Allow pound signs(hash) in comments to pass through +# 70319-1544 - Added agent disable update customer data function +# 70322-1545 - Added sipsak display ability +# 70413-1253 - Fixed bug for outbound call time in CLOSER-type blended campaigns +# 70424-1100 - Fixed bug for fronter/closer calls that would delete vdac records +# 70802-1729 - Fixed bugs with pause_sec and wait_sec under certain call handling +# 70828-1443 - Added source_id to output of SCRIPTtab-IFRAME and WEBFORM +# 71029-1855 - removed campaign_id naming restrictions for CLOSER-type campaigns +# 71030-2047 - added hopper priority for auto alt dial entries +# 71116-1011 - added calls_today count updating of the vicidial_live_agents upon INCALL +# 71120-1520 - added LogiNCamPaigns to show only allowed campaigns for agents upon login +# 71125-1751 - Added inbound-group default inbound group sending to vicidial.php +# 71129-2025 - restricted callbacks count and list to campaign only +# + +$version = '2.0.4-65'; +$build = '71129-2025'; + +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["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["closer_choice"])) {$closer_choice=$_GET["closer_choice"];} + elseif (isset($_POST["closer_choice"])) {$closer_choice=$_POST["closer_choice"];} +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["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["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["dial_timeout"])) {$dial_timeout=$_GET["dial_timeout"];} + elseif (isset($_POST["dial_timeout"])) {$dial_timeout=$_POST["dial_timeout"];} +if (isset($_GET["dial_prefix"])) {$dial_prefix=$_GET["dial_prefix"];} + elseif (isset($_POST["dial_prefix"])) {$dial_prefix=$_POST["dial_prefix"];} +if (isset($_GET["campaign_cid"])) {$campaign_cid=$_GET["campaign_cid"];} + elseif (isset($_POST["campaign_cid"])) {$campaign_cid=$_POST["campaign_cid"];} +if (isset($_GET["MDnextCID"])) {$MDnextCID=$_GET["MDnextCID"];} + elseif (isset($_POST["MDnextCID"])) {$MDnextCID=$_POST["MDnextCID"];} +if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} + elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["length_in_sec"])) {$length_in_sec=$_GET["length_in_sec"];} + elseif (isset($_POST["length_in_sec"])) {$length_in_sec=$_POST["length_in_sec"];} +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["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["start_epoch"])) {$start_epoch=$_GET["start_epoch"];} + elseif (isset($_POST["start_epoch"])) {$start_epoch=$_POST["start_epoch"];} +if (isset($_GET["dispo_choice"])) {$dispo_choice=$_GET["dispo_choice"];} + elseif (isset($_POST["dispo_choice"])) {$dispo_choice=$_POST["dispo_choice"];} +if (isset($_GET["vendor_lead_code"])) {$vendor_lead_code=$_GET["vendor_lead_code"];} + elseif (isset($_POST["vendor_lead_code"])) {$vendor_lead_code=$_POST["vendor_lead_code"];} +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["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["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_GET["VDstop_rec_after_each_call"];} + elseif (isset($_POST["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_POST["VDstop_rec_after_each_call"];} +if (isset($_GET["conf_silent_prefix"])) {$conf_silent_prefix=$_GET["conf_silent_prefix"];} + elseif (isset($_POST["conf_silent_prefix"])) {$conf_silent_prefix=$_POST["conf_silent_prefix"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} +if (isset($_GET["user_abb"])) {$user_abb=$_GET["user_abb"];} + elseif (isset($_POST["user_abb"])) {$user_abb=$_POST["user_abb"];} +if (isset($_GET["preview"])) {$preview=$_GET["preview"];} + elseif (isset($_POST["preview"])) {$preview=$_POST["preview"];} +if (isset($_GET["called_count"])) {$called_count=$_GET["called_count"];} + elseif (isset($_POST["called_count"])) {$called_count=$_POST["called_count"];} +if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];} + elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];} +if (isset($_GET["agent_log"])) {$agent_log=$_GET["agent_log"];} + elseif (isset($_POST["agent_log"])) {$agent_log=$_POST["agent_log"];} +if (isset($_GET["favorites_list"])) {$favorites_list=$_GET["favorites_list"];} + elseif (isset($_POST["favorites_list"])) {$favorites_list=$_POST["favorites_list"];} +if (isset($_GET["CallBackDatETimE"])) {$CallBackDatETimE=$_GET["CallBackDatETimE"];} + elseif (isset($_POST["CallBackDatETimE"])) {$CallBackDatETimE=$_POST["CallBackDatETimE"];} +if (isset($_GET["recipient"])) {$recipient=$_GET["recipient"];} + elseif (isset($_POST["recipient"])) {$recipient=$_POST["recipient"];} +if (isset($_GET["callback_id"])) {$callback_id=$_GET["callback_id"];} + elseif (isset($_POST["callback_id"])) {$callback_id=$_POST["callback_id"];} +if (isset($_GET["use_internal_dnc"])) {$use_internal_dnc=$_GET["use_internal_dnc"];} + elseif (isset($_POST["use_internal_dnc"])) {$use_internal_dnc=$_POST["use_internal_dnc"];} +if (isset($_GET["omit_phone_code"])) {$omit_phone_code=$_GET["omit_phone_code"];} + elseif (isset($_POST["omit_phone_code"])) {$omit_phone_code=$_POST["omit_phone_code"];} +if (isset($_GET["phone_ip"])) {$phone_ip=$_GET["phone_ip"];} + elseif (isset($_POST["phone_ip"])) {$phone_ip=$_POST["phone_ip"];} +if (isset($_GET["enable_sipsak_messages"])) {$enable_sipsak_messages=$_GET["enable_sipsak_messages"];} + elseif (isset($_POST["enable_sipsak_messages"])) {$enable_sipsak_messages=$_POST["enable_sipsak_messages"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} + + +$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); + + +# default optional vars if not set +if (!isset($format)) {$format="text";} + if ($format == 'debug') {$DB=1;} +if (!isset($ACTION)) {$ACTION="refresh";} + +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$CIDdate = date("mdHis"); +$ENTRYdate = date("YmdHis"); +if (!isset($query_date)) {$query_date = $NOW_DATE;} +$MT[0]=''; +$agents='@agents'; + +if ($ACTION == 'LogiNCamPaigns') + { + $skip_user_validation=1; + } +else + { + $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 "\n"; +echo "\n"; +echo "\n"; +echo "VICIDiaL Script De Requète à la Base de données"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + +################################################################################ +### LogiNCamPaigns - generates an HTML SELECT list of allowed campaigns for a +### specific agent on the login screen +################################################################################ +if ($ACTION == 'LogiNCamPaigns') +{ + if ( (strlen($user)<1) ) + { + echo "\n"; + exit; + } + else + { + echo "\n"; + exit; + } +} + + + +################################################################################ +### regCLOSER - update the vicidial_live_agents table to reflect the closer +### inbound choices made upon login +################################################################################ +if ($ACTION == 'regCLOSER') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($closer_choice)<1) || (strlen($user)<1) ) + { + $channel_live=0; + echo "Selection De Groupe $closer_choice est invalide\n"; + exit; + } + else + { + if ($closer_choice == "MGRLOCK-") + { + $stmt="SELECT closer_campaigns FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $closer_choice =$row[0]; + + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_users set closer_campaigns='$closer_choice' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $in_groups_pre = preg_replace('/-$/','',$closer_choice); + $in_groups = explode(" ",$in_groups_pre); + $in_groups_ct = count($in_groups); + $k=1; + while ($k < $in_groups_ct) + { + if (strlen($in_groups[$k])>1) + { + $stmt="SELECT group_weight,calls_today FROM vicidial_inbound_group_agents where user='$user' and group_id='$in_groups[$k]';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $viga_ct = mysql_num_rows($rslt); + if ($viga_ct > 0) + { + $row=mysql_fetch_row($rslt); + $group_weight = $row[0]; + $calls_today = $row[1]; + } + else + { + $group_weight = 0; + $calls_today = 0; + } + $stmt="INSERT INTO vicidial_live_inbound_agents set user='$user',group_id='$in_groups[$k]',group_weight='$group_weight',calls_today='$calls_today',last_call_time='$NOW_TIME',last_call_finish='$NOW_TIME';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + $k++; + } + + } + echo "Closer In Selection De Groupe $closer_choice a été attribué à l'utilisateur $user\n"; +} + + +################################################################################ +### manDiaLnextCALL - for manual VICIDiaL dialing this will grab the next lead +### in the campaign, reserve it, send data back to client and +### place the call by inserting into vicidial_manager +################################################################################ +if ($ACTION == 'manDiaLnextCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "LISTE D'APPEL VIDE\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context est invalide\n"; + exit; + } + else + { + + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### check if this is a callback, if it is, skip the grabbing of a new lead and mark the callback as INACTIVE + if ( (strlen($callback_id)>0) and (strlen($lead_id)>0) ) + { + $affected_rows=1; + $CBleadIDset=1; + + $stmt = "UPDATE vicidial_callbacks set status='INACTIVE' where callback_id='$callback_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + if (strlen($phone_number)>3) + { + if ($use_internal_dnc=='Y') + { + $stmt="SELECT count(*) FROM vicidial_dnc where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + echo "DNC NOMBRE\n"; + exit; + } + } + if ($stage=='lookup') + { + $stmt="SELECT lead_id FROM vicidial_list where phone_number='$phone_number' order by modify_date desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $man_leadID_ct = mysql_num_rows($rslt); + if ($man_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $affected_rows=1; + $lead_id =$row[0]; + $CBleadIDset=1; + } + else + { + ### insert a new lead in the system with this phone number + $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $lead_id = mysql_insert_id($link); + $CBleadIDset=1; + } + } + else + { + ### insert a new lead in the system with this phone number + $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $lead_id = mysql_insert_id($link); + $CBleadIDset=1; + } + } + else + { + ### grab the next lead in the hopper for this campaign and reserve it for the user + $stmt = "UPDATE vicidial_hopper set status='QUEUE', user='$user' where campaign_id='$campaign' and status='READY' order by hopper_id LIMIT 1"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + } + } + + if ($affected_rows > 0) + { + if (!$CBleadIDset) + { + ##### grab the lead_id of the reserved user in vicidial_hopper + $stmt="SELECT lead_id FROM vicidial_hopper where campaign_id='$campaign' and status='QUEUE' and user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $hopper_leadID_ct = mysql_num_rows($rslt); + if ($hopper_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + } + } + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $source_id = trim("$row[6]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + $called_count++; + + ##### check if system is set to generate logfile for transfers + $stmt="SELECT enable_agc_xfer_log FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enable_agc_xfer_log_ct = mysql_num_rows($rslt); + if ($enable_agc_xfer_log_ct > 0) + { + $row=mysql_fetch_row($rslt); + $enable_agc_xfer_log =$row[0]; + } + + if ( ($WeBRooTWritablE > 0) and ($enable_agc_xfer_log > 0) ) + { + # DATETIME|campaign|lead_id|phone_number|user|type + # 2007-08-22 11:11:11|TESTCAMP|65432|3125551212|1234|M + $fp = fopen ("./xfer_log.txt", "a"); + fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$phone_number|$user|M\n"); + fclose($fp); + } + + ##### if lead is a callback, grab the callback comments + $CBentry_time = ''; + $CBcallback_time = ''; + $CBuser = ''; + $CBcomments = ''; + if (ereg("CALLBK",$dispo)) + { + $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBentry_time = trim("$row[0]"); + $CBcallback_time = trim("$row[1]"); + $CBuser = trim("$row[2]"); + $CBcomments = trim("$row[3]"); + } + } + + ### flag the lead as called and change it's status to INCALL + $stmt = "UPDATE vicidial_list set status='INCALL', called_since_last_reset='Y', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + if (!$CBleadIDset) + { + ### delete the lead from the hopper + $stmt = "DELETE FROM vicidial_hopper where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $stmt="UPDATE vicidial_agent_log set lead_id='$lead_id',comments='MANUAL' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + ### if preview dialing, do not send the call + if ( (strlen($preview)<1) || ($preview == 'NO') ) + { + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### whether to omit phone_code or not + if (eregi('Y',$omit_phone_code)) + {$Ndialstring = "$Local_out_prefix$phone_number";} + else + {$Ndialstring = "$Local_out_prefix$phone_code$phone_number";} + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$server_ip','$campaign','XFER','$lead_id','$MqueryCID','$phone_code','$phone_number','$NOW_TIME','OUT')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',callerid='$MqueryCID',lead_id='$lead_id',comments='MANUAL',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update calls_today count in vicidial_campaign_agents + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $MqueryCID . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + $LeaD_InfO .= $CBentry_time . "\n"; + $LeaD_InfO .= $CBcallback_time . "\n"; + $LeaD_InfO .= $CBuser . "\n"; + $LeaD_InfO .= $CBcomments . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= "MAIN\n"; + $LeaD_InfO .= $source_id . "\n"; + + echo $LeaD_InfO; + + } + else + { + echo "LISTE D'APPEL VIDE\n"; + } + } +} + + +################################################################################ +### manDiaLskip - for manual VICIDiaL dialing this skips the lead that was +### previewed in the step above and puts it back in orig status +################################################################################ +if ($ACTION == 'manDiaLskip') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($stage)<1) || (strlen($called_count)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "LEAD NOT REVERTED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context est invalide\n"; + exit; + } + else + { + $called_count = ($called_count - 1); + ### flag the lead as called and change it's status to INCALL + $stmt = "UPDATE vicidial_list set status='$stage', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + + echo "LEAD REVERTED\n"; + } +} + + +################################################################################ +### manDiaLonly - for manual VICIDiaL dialing this sends the call that was +### previewed in the step above +################################################################################ +if ($ACTION == 'manDiaLonly') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) || (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo " APPEL NOT PLACED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context est invalide\n"; + exit; + } + else + { + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### whether to omit phone_code or not + if (eregi('Y',$omit_phone_code)) + {$Ndialstring = "$Local_out_prefix$phone_number";} + else + {$Ndialstring = "$Local_out_prefix$phone_code$phone_number";} + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$server_ip','$campaign','XFER','$lead_id','$MqueryCID','$phone_code','$phone_number','$NOW_TIME','OUT')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',callerid='$MqueryCID',lead_id='$lead_id',comments='MANUAL',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + echo "$MqueryCID\n"; + } +} + + +################################################################################ +### manDiaLlookCALL - for manual VICIDiaL dialing this will attempt to look up +### the trunk channel that the call was placed on +################################################################################ +if ($ACTION == 'manDiaLlookCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; +if (strlen($MDnextCID)<18) + { + echo "NO\n"; + echo "MDnextCID $MDnextCID est invalide\n"; + exit; + } +else + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT uniqueid,channel FROM vicidial_manager where callerid='$MDnextCID' and server_ip='$server_ip' and status='UPDATED' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $uniqueid =$row[0]; + $channel =$row[1]; + echo "$uniqueid\n$channel"; + + $wait_sec=0; + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',wait_epoch='$StarTtime',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + echo "NO\n"; + } + } +} + + + +################################################################################ +### manDiaLlogCALL - for manual VICIDiaL logging of calls places record in +### vicidial_log and then sends process to call_log entry +################################################################################ +if ($ACTION == 'manDiaLlogCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + +if ($stage == "start") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) || (strlen($list_id)<1) || (strlen($phone_number)<1) || (strlen($campaign)<1) ) + { + echo "NOTATION NON ENTRÉE\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id or list_id: $list_id or phone_number: $phone_number or campaign: $campaign est invalide\n"; + exit; + } + else + { + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + ##### insert log into vicidial_log for manual VICIDiaL call + $stmt="INSERT INTO vicidial_log (uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,comments,processed,user_group) values('$uniqueid','$lead_id','$list_id','$campaign','$NOW_TIME','$StarTtime','INCALL','$phone_code','$phone_number','$user','MANUAL','N','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "VICIDiaL_LOG Inséré: $uniqueid|$channel|$NOW_TIME\n"; + echo "$StarTtime\n"; + } + else + { + echo "NOTATION NON ENTRÉE\n"; + } + + $stmt = "UPDATE vicidial_auto_calls SET uniqueid='$uniqueid' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + # ##### insert log into call_log for manual VICIDiaL call + # $stmt = "INSERT INTO call_log (uniqueid,channel,server_ip,extension,number_dialed,caller_code,start_time,start_epoch) values('$uniqueid','$channel','$server_ip','$exten','$phone_code$phone_number','MD $user $lead_id','$NOW_TIME','$StarTtime')"; + # if ($DB) {echo "$stmt\n";} + # $rslt=mysql_query($stmt, $link); + # $affected_rows = mysql_affected_rows($link); + + # if ($affected_rows > 0) + # { + # echo "CALL_LOG Inséré: $uniqueid|$channel|$NOW_TIME"; + # } + # else + # { + # echo "NOTATION NON ENTRÉE\n"; + # } + } + } + +if ($stage == "end") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) ) + { + echo "NOTATION NON ENTRÉE\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id est invalide\n"; + exit; + } + else + { + if ($start_epoch < 1000) + { + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + ##### look for the start epoch in the vicidial_closer_log table + $stmt="SELECT start_epoch FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user' order by closecallid desc limit 1;"; + } + else + { + ##### look for the start epoch in the vicidial_log table + $stmt="SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + } + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch =$row[0]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($length_in_sec < 1) and ($row[0] > 0) ) + { + ##### start epoch in the vicidial_log table, couldn't find one in vicidial_closer_log + $stmt="SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch =$row[0]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + } + } + else {$length_in_sec = ($StarTtime - $start_epoch);} + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec',status='DONE' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + ############################################# + ##### DEBUT QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + + if ($auto_dial_level > 0) + { + ### check to see if campaign has alt_dial enabled + $stmt="SELECT auto_alt_dial FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_alt_dial =$row[0]; + } + else {$auto_alt_dial = 'NONE';} + if (eregi("(ALT_ONLY|ADDR3_ONLY|ALT_AND_ADDR3)",$auto_alt_dial)) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT alt_dial FROM vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alt_dial =$row[0]; + } + else {$alt_dial = 'NONE';} + + if ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("(ALT_ONLY|ALT_AND_ADDR3)",$auto_alt_dial)) ) + { + $stmt="SELECT alt_phone,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alt_phone = $row[0]; + $alt_phone = eregi_replace("[^0-9]","",$alt_phone); + $gmt_offset_now = $row[1]; + $state = $row[2]; + } + else {$alt_phone = '';} + if (strlen($alt_phone)>5) + { + ### insert record into vicidial_hopper for alt_phone call attempt + $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ALT',user='',priority='25';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + } + if ( ( (eregi("(ALT)",$alt_dial)) and (eregi("ALT_AND_ADDR3",$auto_alt_dial)) ) or ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("ADDR3_ONLY",$auto_alt_dial)) ) ) + { + $stmt="SELECT address3,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $address3 = $row[0]; + $address3 = eregi_replace("[^0-9]","",$address3); + $gmt_offset_now = $row[1]; + $state = $row[2]; + } + else {$address3 = '';} + if (strlen($address3)>5) + { + ### insert record into vicidial_hopper for address3 call attempt + $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ADDR3',user='',priority='20';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + + if ($enable_queuemetrics_logging > 0) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_qm_ct = mysql_num_rows($rslt); + if ($VAC_qm_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_call_id = $row[0]; + $CLlead_id = $row[1]; + $CLphone_number = $row[2]; + $CLstatus = $row[3]; + $CLcampaign_id = $row[4]; + $CLphone_code = $row[5]; + $CLalt_dial = $row[6]; + $CLstage = $row[7]; + $CLcallerid = $row[8]; + $CLuniqueid = $row[9]; + } + + $CLstage = preg_replace("/.*-/",'',$CLstage); + if (strlen($CLstage) < 1) {$CLstage=0;} + + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt="SELECT count(*) from queue_log where call_id='$MDnextCID' and verb='COMPLETECALLER';"; + $rslt=mysql_query($stmt, $linkB); + if ($DB) {echo "$stmt\n";} + $VAC_cc_ct = mysql_num_rows($rslt); + if ($VAC_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $caller_complete = $row[0]; + } + + if ($caller_complete < 1) + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + } + mysql_close($linkB); + } + + ### delete call record from vicidial_auto_calls + $stmt = "DELETE from vicidial_auto_calls where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + + + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',lead_id='',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } + else + { + if ($enable_queuemetrics_logging > 0) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_qm_ct = mysql_num_rows($rslt); + if ($VAC_qm_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_call_id = $row[0]; + $CLlead_id = $row[1]; + $CLphone_number = $row[2]; + $CLstatus = $row[3]; + $CLcampaign_id = $row[4]; + $CLphone_code = $row[5]; + $CLalt_dial = $row[6]; + $CLstage = $row[7]; + $CLcallerid = $row[8]; + $CLuniqueid = $row[9]; + } + + $CLstage = preg_replace("/XFER|-/",'',$CLstage); + if ($CLstage < 0.25) {$CLstage=0;} + + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + + $stmt = "DELETE from vicidial_auto_calls lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',lead_id='',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } + + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' where uniqueid='$uniqueid' and lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "$uniqueid\n$channel\n"; + } + else + { + echo "NOTATION NON ENTRÉE\n\n"; + } + } + + echo $VDstop_rec_after_each_call . '|' . $extension . '|' . $conf_silent_prefix . '|' . $conf_exten . '|' . $user_abb . "|\n"; + + ##### if VICIDiaL call and hangup_after_each_call activated, find all recording + ##### channels and hang them up while entering info into recording_log and + ##### returning filename/recordingID + if ($VDstop_rec_after_each_call == 1) + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $total_rec=0; + $loop_count=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten' order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$rec_list = mysql_num_rows($rslt);} + while ($rec_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + if (preg_match("/Local\/$conf_silent_prefix$conf_exten\@/i",$row[0])) + { + $rec_channels[$total_rec] = "$row[0]"; + $total_rec++; + } + if ($format=='debug') {echo "\n";} + $loop_count++; + } + + $total_recFN=0; + $loop_count=0; + $filename=$MT; # not necessary : and cmd_line_f LIKE \"%_$user_abb\" + $stmt="SELECT cmd_line_f FROM vicidial_manager where server_ip='$server_ip' and action='Originate' and cmd_line_b = 'Channel: $local_DEF$conf_silent_prefix$conf_exten$local_AMP$ext_context' order by entry_date desc limit $total_rec;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$recFN_list = mysql_num_rows($rslt);} + while ($recFN_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + $filename[$total_recFN] = preg_replace("/Callerid: /i","",$row[0]); + if ($format=='debug') {echo "\n";} + $total_recFN++; + $loop_count++; + } + + $loop_count=0; + while($loop_count < $total_rec) + { + if (strlen($rec_channels[$loop_count])>5) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$loop_count','Channel: $rec_channels[$loop_count]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "REC_STOP|$rec_channels[$loop_count]|$filename[$loop_count]|"; + if (strlen($filename)>2) + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename[$loop_count]'"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$fn_count = mysql_num_rows($rslt);} + if ($fn_count) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt="UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename[$loop_count]' and end_epoch is NULL;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "$recording_id|$length_in_min|"; + } + else {echo "||";} + } + else {echo "||";} + echo "\n"; + } + $loop_count++; + } + } + + + $talk_sec=0; + $StarTtime = date("U"); + $stmt = "select talk_epoch,talk_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $talk_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set talk_sec='$talk_sec',talk_epoch='$StarTtime',dispo_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } +} + + +################################################################################ +### VDADREcheckINCOMING - for auto-dial VICIDiaL dialing this will recheck for +### calls to see if the channel has updated +################################################################################ +if ($ACTION == 'VDADREcheckINCOMING') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "Campagne $campaign est invalide\n"; + echo "lead_id $lead_id est invalide\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + } + } +} + + +################################################################################ +### VDADcheckINCOMING - for auto-dial VICIDiaL dialing this will check for calls +### in the vicidial_live_agents table in QUEUE status, then +### lookup the lead info and pass it back to vicidial.php +################################################################################ +if ($ACTION == 'VDADcheckINCOMING') +{ + $Ctype = 'A'; + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "Campagne $campaign est invalide\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and status='QUEUE';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',comments='AUTO',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $source_id = trim("$row[6]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + ##### if lead is a callback, grab the callback comments + $CBentry_time = ''; + $CBcallback_time = ''; + $CBuser = ''; + $CBcomments = ''; + if (ereg("CALLBK",$dispo)) + { + $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBentry_time = trim("$row[0]"); + $CBcallback_time = trim("$row[1]"); + $CBuser = trim("$row[2]"); + $CBcomments = trim("$row[3]"); + } + } + + ### update the lead status to INCALL + $stmt = "UPDATE vicidial_list set status='INCALL', user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the log status to INCALL + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + $stmt = "UPDATE vicidial_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL', user_group='$user_group' where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + ### update the vicidial_closer_log user to INCALL + $stmt = "UPDATE vicidial_closer_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL', user_group='$user_group' where lead_id='$lead_id' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select campaign_id,phone_number,alt_dial from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($VDAC_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDADchannel_group =$row[0]; + $dialed_number =$row[1]; + $dialed_label =$row[2]; + } + else + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|INBND|$callerid|$user|$user_group|$list_id|$lead_id|$phone_number|$uniqueid|\n"); + fclose($fp); + } + } + + $stmt = "select count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDL_cid_ct = mysql_num_rows($rslt); + if ($VDL_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_front_VDlog =$row[0]; + } + + $stmt = "select * from vicidial_inbound_groups where group_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_group_name = $row[1]; + $VDCL_group_color = $row[2]; + $VDCL_group_web = $row[4]; + $VDCL_fronter_display = $row[7]; + $VDCL_ingroup_script = $row[8]; + $VDCL_get_call_launch = $row[9]; + $VDCL_xferconf_a_dtmf = $row[10]; + $VDCL_xferconf_a_number = $row[11]; + $VDCL_xferconf_b_dtmf = $row[12]; + $VDCL_xferconf_b_number = $row[13]; + $VDCL_default_xfer_group= $row[28]; + + ### update the comments in vicidial_live_agents record + $stmt = "UPDATE vicidial_live_agents set comments='INBOUND' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $Ctype = 'I'; + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_ingroup_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + } + + ### if web form is set then send sur to vicidial.php for override of WEB_FORM address + if ( (strlen($VDCL_group_web)>5) or (strlen($VDCL_group_name)>0) ) {echo "$VDCL_group_web|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|\n";} + else {echo "|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|\n";} + + $stmt = "SELECT full_name from vicidial_users where user='$tsr';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDU_cid_ct = mysql_num_rows($rslt); + if ($VDU_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $fronter_full_name = $row[0]; + echo $fronter_full_name . '|' . $tsr . "\n"; + } + else {echo '|' . $tsr . "\n";} + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_campaign_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + echo "|||||$VDCL_campaign_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n|\n"; + + $stmt = "select phone_number,alt_dial from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($VDAC_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dialed_number =$row[0]; + $dialed_label =$row[1]; + } + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $callerid . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + $LeaD_InfO .= $CBentry_time . "\n"; + $LeaD_InfO .= $CBcallback_time . "\n"; + $LeaD_InfO .= $CBuser . "\n"; + $LeaD_InfO .= $CBcomments . "\n"; + $LeaD_InfO .= $dialed_number . "\n"; + $LeaD_InfO .= $dialed_label . "\n"; + $LeaD_InfO .= $source_id . "\n"; + + echo $LeaD_InfO; + + + + $wait_sec=0; + $StarTtime = date("U"); + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + ### If APPELBK, change vicidial_callback record to INACTIVE + if (eregi("CALLBK|CBHOLD", $dispo)) + { + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='$lead_id' and status NOT IN('INACTIVE','DEAD','ARCHIVE');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + ##### check if system is set to generate logfile for transfers + $stmt="SELECT enable_agc_xfer_log FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enable_agc_xfer_log_ct = mysql_num_rows($rslt); + if ($enable_agc_xfer_log_ct > 0) + { + $row=mysql_fetch_row($rslt); + $enable_agc_xfer_log =$row[0]; + } + + if ( ($WeBRooTWritablE > 0) and ($enable_agc_xfer_log > 0) ) + { + # DATETIME|campaign|lead_id|phone_number|user|type + # 2007-08-22 11:11:11|TESTCAMP|65432|3125551212|1234|A + $fp = fopen ("./xfer_log.txt", "a"); + fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$phone_number|$user|$Ctype\n"); + fclose($fp); + } + + } + else + { + echo "0\n"; + # echo "No calls in QUEUE for $user sur $server_ip\n"; + exit; + } + } +} + + +################################################################################ +### userLOGout - Logs the user out of VICIDiaL client, deleting db records and +### inserting into vicidial_user_log +################################################################################ +if ($ACTION == 'userLOGout') +{ + $MT[0]=''; + $row=''; $rowx=''; +if ( (strlen($campaign)<1) || (strlen($conf_exten)<1) ) + { + echo "NO\n"; + echo "campaign $campaign or conf_exten $conf_exten est invalide\n"; + exit; + } +else + { + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + ##### Insert a DÉCONNEXION record into the user log + $stmt="INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$user','DÉCONNEXION','$campaign','$NOW_TIME','$StarTtime','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vul_insert = mysql_affected_rows($link); + + if ($no_delete_sessions < 1) + { + ##### Remove the reservation sur the vicidial_conferences meetme room + $stmt="UPDATE vicidial_conferences set extension='' where server_ip='$server_ip' and conf_exten='$conf_exten';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vc_remove = mysql_affected_rows($link); + } + + ##### Delete the vicidial_live_agents record for this session + $stmt="DELETE from vicidial_live_agents where server_ip='$server_ip' and user ='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vla_delete = mysql_affected_rows($link); + + ##### Delete the vicidial_live_inbound_agents records for this session + $stmt="DELETE from vicidial_live_inbound_agents where user ='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vlia_delete = mysql_affected_rows($link); + + ##### Delete the web_client_sessions + $stmt="DELETE from web_client_sessions where server_ip='$server_ip' and session_name ='$session_name';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $wcs_delete = mysql_affected_rows($link); + + ##### Hangup the client phone + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$extension%\" order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) + { + $row=mysql_fetch_row($rslt); + $agent_channel = "$row[0]"; + if ($format=='debug') {echo "\n";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','ULGH3459$StarTtime','Channel: $agent_channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $pause_sec=0; + $stmt = "select pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ( ($VDpr_ct > 0) and (strlen($row[3]<5)) and (strlen($row[4]<5)) ) + { + $row=mysql_fetch_row($rslt); + $pause_sec = (($StarTtime - $row[0]) + $row[1]); + + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + if ($vla_delete > 0) + { + ############################################# + ##### DEBUT QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $allow_sipsak_messages = $row[6]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_message = 'LOGGED OUT'; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_message\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + } + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + # $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='PAUSE',serverid='1';"; + # if ($DB) {echo "$stmt\n";} + # if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + # $rslt=mysql_query($stmt, $linkB); + # $affected_rows = mysql_affected_rows($linkB); + + $stmt = "SELECT time_id FROM queue_log where agent='Agent/$user' and verb='AGENTLOGIN' order by time_id desc limit 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + if ($DB) {echo "$stmt\n";} + echo "$stmt\n"; + $li_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $li_conf_ct) + { + $row=mysql_fetch_row($rslt); + $logintime = $row[0]; + $i++; + } + + $time_logged_in = ($StarTtime - $logintime); + if ($time_logged_in > 1000000) {$time_logged_in=1;} + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='AGENTLOGOFF',data1='$user$agents',data2='$time_logged_in',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + + echo "$vul_insert|$vc_remove|$vla_delete|$wcs_delete|$agent_channel|$vlia_delete\n"; + } +} + + +################################################################################ +### updateDISPO - update the vicidial_list table to reflect the agent choice of +### call disposition for that leand +################################################################################ +if ($ACTION == 'updateDISPO') +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($dispo_choice)<1) || (strlen($lead_id)<1) ) + { + echo "Dispo Choice $dispo or lead_id $lead_id est invalide\n"; + exit; + } + else + { + $stmt="UPDATE vicidial_list set status='$dispo_choice', user='$user' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by uniqueid desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + if ( ($use_internal_dnc=='Y') and ($dispo_choice=='DNC') ) + { + $stmt = "select phone_number from vicidial_list where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $stmt="INSERT INTO vicidial_dnc (phone_number) values('$row[0]');"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + } + } + + $dispo_sec=0; + $StarTtime = date("U"); + $stmt = "select dispo_epoch,dispo_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dispo_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set dispo_sec='$dispo_sec',dispo_epoch='$StarTtime',status='$dispo_choice' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id($link); + + ### APPELBACK ENTRY + if ( ($dispo_choice == 'CBHOLD') and (strlen($CallBackDatETimE)>10) ) + { + $stmt="INSERT INTO vicidial_callbacks (lead_id,list_id,campaign_id,status,entry_time,callback_time,user,recipient,comments,user_group) values('$lead_id','$list_id','$campaign','ACTIVE','$NOW_TIME','$CallBackDatETimE','$user','$recipient','$comments','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $stmt="SELECT auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ( ($auto_dial_level > 0) and (ereg(" $dispo_choice ",$row[0])) ) + { + $stmt = "select count(*) from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + $stmt="UPDATE vicidial_hopper set status='READY' where lead_id='$lead_id' and status='HOLD' limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + else + { + $stmt="DELETE from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + ############################################# + ##### DEBUT QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='CALLSTATUT',data1='$dispo_choice',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + + echo 'Lead ' . $lead_id . ' a été changé en ' . $dispo_choice . " Statut\nNext agent_log_id:\n" . $agent_log_id . "\n"; +} + +################################################################################ +### updateLEAD - update the vicidial_list table to reflect the values that are +### in the agents screen at time of call hangup +################################################################################ +if ($ACTION == 'updateLEAD') +{ + $MT[0]=''; + $row=''; $rowx=''; + $DO_NOT_UPDATE=0; + $DO_NOT_UPDATE_text=''; + if ( (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + echo "phone_number $phone_number or lead_id $lead_id est invalide\n"; + exit; + } + else + { + + $stmt = "SELECT disable_alter_custdata FROM vicidial_campaigns where campaign_id='$campaign'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $dac_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $dac_conf_ct) + { + $row=mysql_fetch_row($rslt); + $disable_alter_custdata = $row[0]; + $i++; + } + if (ereg('Y',$disable_alter_custdata)) + { + $DO_NOT_UPDATE=1; + $DO_NOT_UPDATE_text=' NOT'; + $stmt = "SELECT alter_custdata_override FROM vicidial_users where user='$user'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $aco_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $aco_conf_ct) + { + $row=mysql_fetch_row($rslt); + $alter_custdata_override = $row[0]; + $i++; + } + if (ereg('ALLOW_ALTER',$alter_custdata_override)) + { + $DO_NOT_UPDATE=0; + $DO_NOT_UPDATE_text=''; + } + } + + if ($DO_NOT_UPDATE < 1) + { + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + $comments = eregi_replace("--AMP--",'&',$comments); + $comments = eregi_replace("--QUES--",'?',$comments); + $comments = eregi_replace("--POUND--",'#',$comments); + + $stmt="UPDATE vicidial_list set vendor_lead_code='" . mysql_real_escape_string($vendor_lead_code) . "', title='" . mysql_real_escape_string($title) . "', first_name='" . mysql_real_escape_string($first_name) . "', middle_initial='" . mysql_real_escape_string($middle_initial) . "', last_name='" . mysql_real_escape_string($last_name) . "', address1='" . mysql_real_escape_string($address1) . "', address2='" . mysql_real_escape_string($address2) . "', address3='" . mysql_real_escape_string($address3) . "', city='" . mysql_real_escape_string($city) . "', state='" . mysql_real_escape_string($state) . "', province='" . mysql_real_escape_string($province) . "', postal_code='" . mysql_real_escape_string($postal_code) . "', country_code='" . mysql_real_escape_string($country_code) . "', gender='" . mysql_real_escape_string($gender) . "', date_of_birth='" . mysql_real_escape_string($date_of_birth) . "', alt_phone='" . mysql_real_escape_string($alt_phone) . "', email='" . mysql_real_escape_string($email) . "', security_phrase='" . mysql_real_escape_string($security_phrase) . "', comments='" . mysql_real_escape_string($comments) . "' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } + echo "Lead $lead_id information has$DO_NOT_UPDATE_text been updated\n"; +} + + +################################################################################ +### VDADpause - update the vicidial_live_agents table to show that the agent is +### or ready now active and ready to take calls +################################################################################ +if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($stage)<2) || (strlen($server_ip)<1) ) + { + echo "stage $stage est invalide\n"; + exit; + } + else + { + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set lead_id='',uniqueid=0,callerid='',channel='', random_id='$random',comments='' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_live_agents set status='$stage' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + ############################################# + ##### DEBUT QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + if (ereg('READY',$stage)) {$QMstatus='UNPAUSEALL';} + if (ereg('PAUSE',$stage)) {$QMstatus='PAUSEALL';} + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='$QMstatus',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + + if ($agent_log == 'NO') + {$donothing=1;} + else + { + $pause_sec=0; + $stmt = "select pause_epoch,pause_sec,wait_epoch,wait_sec,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec=0; + if ($row[2] > 0) + { + $wait_sec = (($StarTtime - $row[2]) + $row[3]); + } + if ( (eregi("NULL",$row[4])) or ($row[4] < 1000) ) + {$pause_sec = (($StarTtime - $row[0]) + $row[1]);} + else + {$pause_sec = (($row[4] - $row[0]) + $row[1]);} + + } + if ($ACTION == 'VDADready') + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($ACTION == 'VDADpause') + { + $stmt="UPDATE vicidial_agent_log set pause_epoch='$StarTtime',wait_sec='$wait_sec' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + echo 'Agent ' . $user . ' le statut actuel est ' . $stage . "\n"; +} + + +################################################################################ +### UpdatEFavoritEs - update the astguiclient favorites list for this extension +################################################################################ +if ($ACTION == 'UpdatEFavoritEs') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($favorites_list)<1) || (strlen($user)<1) || (strlen($exten)<1) ) + { + echo "favorites list $favorites_list est invalide\n"; + exit; + } + else + { + $stmt = "select count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + $stmt="UPDATE phone_favorites set extensions_list=\"$favorites_list\" where extension='$exten' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="INSERT INTO phone_favorites values('$exten','$server_ip',\"$favorites_list\");"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + echo "Favorites list has been updated to $favorites_list for $exten\n"; +} + + +################################################################################ +### PauseCodeSubmit - Update vicidial_agent_log with pause code +################################################################################ +if ($ACTION == 'PauseCodeSubmit') +{ + $row=''; $rowx=''; + if ( (strlen($status)<1) || (strlen($agent_log_id)<1) ) + { + echo "agent_log_id $agent_log_id or pause_code $status est invalide\n"; + exit; + } + else + { + $stmt="UPDATE vicidial_agent_log set sub_status=\"$status\" where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + ############################################# + ##### DEBUT QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $allow_sipsak_messages = $row[6]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_prefix = 'BK-'; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$status\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + } + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='PAUSEREASON',serverid='$queuemetrics_log_id',data1='$status';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } +echo "Pause Code has been updated to $status for $agent_log_id\n"; +} + + +################################################################################ +### CalLBacKLisT - List the USERONLY callbacks for an agent +################################################################################ +if ($ACTION == 'CalLBacKLisT') +{ +$stmt = "select callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' and campaign_id='$campaign' and status NOT IN('INACTIVE','DEAD') order by callback_time;"; +if ($DB) {echo "$stmt\n";} +$rslt=mysql_query($stmt, $link); +if ($rslt) {$callbacks_count = mysql_num_rows($rslt);} +echo "$callbacks_count\n"; +$loop_count=0; + while ($callbacks_count>$loop_count) + { + $row=mysql_fetch_row($rslt); + $callback_id[$loop_count] = $row[0]; + $lead_id[$loop_count] = $row[1]; + $campaign_id[$loop_count] = $row[2]; + $status[$loop_count] = $row[3]; + $entry_time[$loop_count] = $row[4]; + $callback_time[$loop_count] = $row[5]; + $comments[$loop_count] = $row[6]; + $loop_count++; + } +$loop_count=0; + while ($callbacks_count>$loop_count) + { + $stmt = "select first_name,last_name,phone_number from vicidial_list where lead_id='$lead_id[$loop_count]';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count]\n"; + $loop_count++; + } + +} + + +################################################################################ +### CalLBacKCounT - send the count of the USERONLY callbacks for an agent +################################################################################ +if ($ACTION == 'CalLBacKCounT') +{ +$stmt = "select count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' and campaign_id='$campaign' and status NOT IN('INACTIVE','DEAD');"; +if ($DB) {echo "$stmt\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$cbcount=$row[0]; + +echo "$cbcount"; +} + + + + +if ($format=='debug') +{ +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +echo "\n"; +echo "\n\n\n"; +} + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/vicidial.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/vicidial.php new file mode 100644 index 00000000..16774d12 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/vicidial.php @@ -0,0 +1,6797 @@ + LICENSE: GPLv2 +# +# make sure you have added a user to the vicidial_users MySQL table with at least +# user_level 1 or greater to access this page. Also, you need to have the login +# and pass of a phone listed in the asterisk.phones table. The page grabs the +# server info and other details from this login and pass. +# +# This script works best with Firefox or Mozilla, but will run for a couple +# hours on Internet Explorer before the memory leaks cause a crash. +# +# Other scripts that this application depends on: +# - vdc_db_query.php: Updates information in the database +# - manager_send.php: Sends manager actions to the DB for execution +# +# CHANGELOG +# 50607-1426 - First Build of VICIDIAL web client basic login process finished +# 50628-1620 - Added some basic formatting and worked on process flow +# 50628-1715 - Startup variables mapped to javascript variables +# 50629-1303 - Added Login Closer in-groups selection box and vla update +# 50629-1530 - Rough layout for customer info form section and button links +# 50630-1453 - Rough Manual Dial/Hangup with customer info displayed +# 50701-1450 - Added vicidial_log entries on dial and hangup +# 50701-1634 - Added Logout function +# 50705-1259 - Added call disposition functionality +# 50705-1432 - Added lead info DB update function +# 50705-1658 - Added web form functionality +# 50706-1043 - Added call park and pickup functions +# 50706-1234 - Added Start/Stop Recording functionality +# 50706-1614 - Added conference channels display option +# 50711-1333 - Removed call check redundancy and fixed a span bug +# 50727-1424 - Added customer channel and participant present sensing/alerts +# 50804-1057 - Added SendDTMF function and reconfigured the transfer span +# 50804-1224 - Added Local and Internal Closer transfer functions +# 50804-1628 - Added Blind transfer, activated LIVE CALL image and fixed bugs +# 50804-1808 - Added button images for left buttons +# 50815-1151 - Added 3Way calling functions to Transfer-conf frame +# 50815-1602 - Added images and buttons for xfer functions +# 50816-1813 - Added basic autodial outbound call pickup functions +# 50817-1113 - Fixes to auto_dialing call receipt +# 50817-1234 - Added inbound call receipt capability +# 50817-1541 - Added customer time display +# 50817-1541 - Added customer time display +# 50818-1327 - Added stop-all-recordings-after-each-vicidial-call option +# 50818-1703 - Added pretty login section +# 50825-1200 - Modified form field lengths, added double-click dispositions +# 50831-1603 - Fixed customer time bug and fronter display bug for CLOSER +# 50901-1314 - Fixed CLOSER IN-GROUP Web Form bug +# 50903-0904 - Added preview-lead code for manual dialing +# 50904-0016 - Added ability to hangup manual dials before pickup +# 50906-1319 - Added override for filters on xfer calls, fixed login display bug +# 50909-1243 - Added hotkeys functionality for quick dispoing in auto-dial mode +# 50912-0958 - Modified hotkeys function, agent must have user_level >= 5 to use +# 50913-1212 - Added campaign_cid to 3rd party calls +# 50923-1546 - Modified to work with language translation +# 50926-1656 - Added campaign pull-down at login of active campaigns +# 50928-1633 - Added manual dial alternate number dial option +# 50930-1538 - Added session_id empty login failure and fixed 2 minor bugs +# 51004-1656 - Fixed recording filename bug and new Spanish translation +# 51020-1103 - Added campaign-specific recording control abilities +# 51020-1352 - Added Basic vicidial_agent_log framework +# 51021-1050 - Fixed custtime display and disable Enter/Return keypresses +# 51021-1718 - Allows for multi-line comments (changes \n to !N in database) +# 51110-1432 - Fixed non-standard http port issue +# 51111-1047 - Added vicidial_agent_log lead_id earlier for manual dial +# 51118-1305 - Activate multi-line comments from $multi_line_comments var +# 51118-1313 - Move Transfer DIV to a floating span to preserve 800x600 view +# 51121-1506 - Small PHP optimizations in many scripts and disabled globalize +# 51129-1010 - Added ability to accept calls from other VICIDIAL servers +# 51129-1254 - Fixed Hangups of other agents channels when customer hangs up +# 51208-1732 - Created user-first login that looks for default phone info +# 51219-1526 - Added variable framework for campaign and in-group scripts +# 51221-1200 - Added SCRIPT tab, layout and functionality +# 51221-1714 - Added auto-switch-to-SCRIPT-tab and auto-webform-popup +# 51222-1605 - Added VMail message blind transfer button to xfer-conf frame +# 51229-1028 - Added checks on web_form_address to allow for var in the DB value +# 60117-1312 - Added Transfer-conf frame toggle on button press +# 60208-1152 - Added DTMF-xfernumber preset links to xfer-conf frame +# 60213-1129 - Added vicidial_users.hotkeys_active for any user hotkeys +# 60213-1210 - Added ability to sort routing of calls by user_level +# 60214-0932 - Initial Callback calendar display framework +# 60214-1407 - Added ability to minimize the dispo screen to see info below +# 60215-1104 - Added ANYONE scheduled callbacks functionality +# 60410-1116 - Added persistant pause after dispo option and change dispo text +# - Added web form submit that opens new window with dispo on submit +# - Added PREVIOUS CALLBACK in customer info to flag callbacks +# - Added link to try to hangup the call again in the dispo screen +# - Added link noone-in-session screen to call agent phone again +# - Added link customer-hungup screen to go straight to dispo screen +# 60410-1532 - Added agent status and campaign calls dialing display option +# 60411-1547 - Add ability to set callback as USERONLY and some basic formatting +# 60413-1752 - Add basic USERONLY callback frame and listings +# 60414-1039 - Changed manual dial preview and alt dial checkboxes to spans +# - Added beta-level USERONLY callback functionality +# - Added beta-level manual dialing with lead insertion functionality +# 60415-1534 - Fixed manual dial lead preview and fixed manuald dial override bug +# 60417-1108 - Added capability to do alt-number-dialing in auto-dial mode +# - Changed several permissions to database-defined +# 60419-1529 - Prevent manual dial or callbacks when alt-dial lead not finished +# 60420-1647 - Fixed DiaLDiaLAltPhonE error, Call Agent Again DialControl error +# 60421-1229 - Check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60424-1005 - Fixed Alt phone disabled bug for callbacks and manual dials +# 60426-1058 - Added vicidial_user setting for default blended check for CLOSER +# 60501-1008 - Added option to manual dial screen to manually lookup phone number +# 60503-1653 - Fixed agentonly_callback not-defined bug in scheduled callbacks screen +# 60504-1032 - Fixed manual dial display bug and transfer dispo alert bug +# - Fixed recording filename display to not overrun 25 characters +# 60510-1051 - Added Wrapup timer and wrapup message on wrapup screen after dispo +# 60608-1453 - Added CLOSER campaign allowable in-groups limitations +# 60609-1123 - Added add-number-to-DNC-list function and manual dial check DNC +# 60619-1047 - Added variable filters to close security holes for login form +# 60804-1710 - fixed scheduled CALLBK for other languages build +# 60808-1145 - Added consultative transfers with customer data +# 60808-2232 - Added campaign name to pulldown for login screen +# 60809-1603 - Added option to locally transfer consult xfers +# 60809-1732 - Added recheck of transferred channels before customer gone mesg +# 60810-1011 - Fixed CXFER leave 3way call bugs +# 60816-1602 - Added ALLCALLS recording delay option allcalls_delay +# 60816-1716 - Fixed customer time display bug and client DST setting +# 60821-1555 - Added option to omit phone_code on dialout of leads +# 60821-1628 - Added ALLFORCE recording option +# 60821-1643 - Added no_delete_sessions option to not delete sessions +# 60822-0512 - Changed phone number fields to be maxlength of 12 +# 60829-1531 - Made compatible with WeBRooTWritablE setting in dbconnect.php +# 60906-1152 - Added Previous CallBack info display span +# 60906-1715 - Allow for Local phone extension conferences +# 61004-1729 - Add ability to control volume per channel in "calls in this session" +# 61122-1341 - Added vicidial_user_groups allowed_campaigns restrictions +# 61122-1523 - Added more SCRIPT variables +# 61128-2229 - Added vicidial_live_agents and vicidial_auto_calls manual dial entries +# 61130-1617 - Added lead_id to MonitorConf for recording_log +# 61221-1212 - Changed width to 760 to better fit 800x600 screens, widened SCRIPT +# 70109-1128 - Fixed wrapup timer bug +# 70109-1635 - Added option for HotKeys automatically dialing next number in manual mode +# - Added option for alternate number dialing with hotkeys +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70118-1517 - Added vicidial_agent_log and vicidial_user_log logging of user_group +# 70201-1249 - Added FAST DIAL option for manually dialing, added UTF8 compatible code +# 70201-1703 - Fixed cursor bug for most text input fields +# 70202-1453 - Added first portions of Agent Pause Codes +# 70203-0108 - Finished Agent Pause Codes functionality +# 70203-0930 - Added dialed_number to webform output +# 70203-1010 - Added dialed_label to webform output +# 70206-1201 - Fixed allow_closers bug +# 70206-1332 - Added vicidial_recording_override users setting function +# 70212-1252 - Fixed small issue with CXFER +# 70213-1018 - Changed CXFER and AXFER to update customer information before transfer +# 70214-1233 - Added queuemetrics_log_id field for server_id in queue_log +# 70215-1240 - Added queuemetrics_log_id field for server_id in queue_log +# 70222-1617 - Changed queue_log PAUSE/UNPAUSE to PAUSEALL/UNPAUSEALL +# 70226-1252 - Added Mute/UnMute to agent screen +# 70309-1035 - Allow amphersands and questions marks in comments to pass through +# 70313-1052 - Allow pound signs(hash) in comments to pass through +# 70316-1406 - Moved the MUTE button to be accessible during a transfer/conf +# 70319-1446 - Added agent-deactive-display and disable customer info update functions +# 70319-1626 - Added option to allow agent logins to campaigns with no leads in the hopper +# 70320-1501 - Added option to allow retry of leave-3way-call from dispo screen +# 70322-1545 - Added sipsak display ability +# 70510-1319 - Added onUnload force Logout +# 70806-1530 - Added Presets Dial links above agent mute button +# 70823-2118 - Fixed XMLHTTPRequest, HotKeys and Scheduled Callbacks issues with MSIE +# 70828-1443 - Added source_id to output of SCRIPTtab-IFRAME and WEBFORM +# 71022-1427 - Added formatting of the customer phone number in the main status bar +# 71029-1848 - Changed CLOSER-type campaign to not use campaign_id restrictions +# 71101-1204 - Fixed bug in callback calendar with DST +# 71116-0957 - Added campaign_weight and calls_today to the vla table insertion +# 71120-1719 - Added XMLHTPRequest lookup of allowable campaigns for agents during login +# 71122-0256 - Added auto-pause notification +# 71125-1751 - Changed Transfer section to allow for selection of in-groups to send calls to +# 71127-0408 - Added height and width settings for easier modification of screen size +# 71129-2025 - restricted callbacks count and list to campaign only +# + +$version = '2.0.4-142'; +$build = '71129-2025'; + +require("dbconnect.php"); + +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["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} + 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"];} + } + if (isset($VD_campaign)) + { + $VD_campaign = strtoupper($VD_campaign); + $VD_campaign = eregi_replace(" ",'',$VD_campaign); + } + +### 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); + + +$forever_stop=0; + +if ($force_logout) +{ + echo "Vous êtes maintenant déconnecté.\n"; + exit; +} + +$isdst = date("I"); +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$CIDdate = date("ymdHis"); + $month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); + $past_month_date = date("Y-m-d H:i:s",$month_old); + + +$random = (rand(1000000, 9999999) + 10000000); + +$conf_silent_prefix = '7'; # vicidial_conferences prefix to enter silently +$HKuser_level = '5'; # minimum vicidial user_level for HotKeys +$campaign_login_list = '1'; # show drop-down list of campaigns at login +$manual_dial_preview = '1'; # allow preview lead option when manual dial +$multi_line_comments = '1'; # set to 1 to allow multi-line comment box +$user_login_first = '0'; # set to 1 to have the vicidial_user login before the phone login +$view_scripts = '1'; # set to 1 to show the SCRIPTS tab +$dispo_check_all_pause = '0'; # set to 1 to allow for persistent pause after dispo +$agentcallsstatus = '0'; # set to 1 to show agent status and call count + $campagentstatctmax = '0'; # Number of secondes for campaign call and agent stats +$show_campname_pulldown = '1'; # set to 1 to show campaign name sur login pulldown +$webform_sessionname = '1'; # set to 1 to include the session_name in webform URL +$local_consult_xfers = '1'; # set to 1 to send consultative transfers from original server +$clientDST = '1'; # set to 1 to check for DST sur server for agent time +$no_delete_sessions = '0'; # set to 1 to not delete sessions at logout +$volumecontrol_active = '1'; # set to 1 to allow agents to alter volume of channels +$PreseT_DiaL_LinKs = '1'; # set to 1 to show a COMPOSER link for Dial Presets +$LogiNAJAX = '1'; # set to 1 to do lookups +$HidEMonitoRSessionS = '1'; # set to 1 to hide remote monitoring channels from "session calls" + +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen + +$BROWSER_HEIGHT = 500; # set to the minimum browser height, default=500 +$BROWSER_WIDTH = 770; # set to the minimum browser width, default=770 + + +# options now set in DB: +#$alt_phone_dialing = '1'; # allow agents to call alt phone numbers +#$scheduled_callbacks = '1'; # set to 1 to allow agent to choose scheduled callbacks +# $agentonly_callbacks = '1'; # set to 1 to allow agent to choose agent-only scheduled callbacks +#$agentcall_manual = '1'; # set to 1 to allow agent to make manual calls during autodial session + +### SCREEN WIDTH AND HEIGHT CALCULATIONS ### +### DO NOT EDIT! ### +$MASTERwidth=($BROWSER_WIDTH - 340); +$MASTERheight=($BROWSER_HEIGHT - 200); +if ($MASTERwidth < 430) {$MASTERwidth = '430';} +if ($MASTERheight < 300) {$MASTERheight = '300';} + +$CAwidth = ($MASTERwidth + 340); # 770 - cover all (none-in-session, customer hunngup, etc...) +$MNwidth = ($MASTERwidth + 330); # 760 - main frame +$XFwidth = ($MASTERwidth + 320); # 750 - transfer/conference +$HCwidth = ($MASTERwidth + 310); # 740 - hotkeys and callbacks +$AMwidth = ($MASTERwidth + 270); # 700 - agent mute and preset-dial links +$SSwidth = ($MASTERwidth + 176); # 606 - scroll script +$SDwidth = ($MASTERwidth + 170); # 600 - scroll script, customer data and calls-in-session +$HKwidth = ($MASTERwidth + 70); # 500 - Hotkeys button +$HSwidth = ($MASTERwidth + 1); # 431 - Header spacer + +$HKheight = ($MASTERheight + 105); # 405 - HotKey active Button +$AMheight = ($MASTERheight + 100); # 400 - Agent mute and preset dial links +$MBheight = ($MASTERheight + 65); # 365 - Manual Dial Buttons +$CBheight = ($MASTERheight + 50); # 350 - Agent Callback, pause code, volume control Buttons and agent status +$SSheight = ($MASTERheight + 31); # 331 - script content +$HTheight = ($MASTERheight + 10); # 310 - transfer frame, callback comments and hotkey +$BPheight = ($MASTERheight - 250); # 50 - bottom buffer + + +$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('vicidial.php','',$agcPAGE); + +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 +echo "\n"; +echo "\n"; +echo "\n"; + +if ($campaign_login_list > 0) +{ +$camp_form_code = "\n"; +} +else +{ +$camp_form_code = "\n"; +} + + +if ($LogiNAJAX > 0) +{ +?> + + + +VICICOMPOSER Client Web: S'identifier à nouveau\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "
English Français
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
S'identifier à nouveau
 
Ouverture de Session téléphonique:
Mot de passe du Téléphone:
Ouverture de Session:
Mot de passe Utilisateur:
Campagne: $camp_form_code

VERSION: $version       BUILD: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} + +if ($user_login_first == 1) +{ + if ( (strlen($VD_login)<1) or (strlen($VD_pass)<1) or (strlen($VD_campaign)<1) ) + { + echo "VICICOMPOSER Client Web: Ouverture de Campagne\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Français
\n"; + echo "
\n"; + echo "\n"; + #echo "\n"; + #echo "\n"; + echo "

Ouverture de Session

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Ouverture de Campagne
 
Ouverture de Session:
Mot de passe Utilisateur:
Campagne: $camp_form_code
  \n"; + echo "

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) + { + $stmt="SELECT phone_login,phone_pass from vicidial_users where user='$VD_login' and pass='$VD_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); + $phone_login=$row[0]; + $phone_pass=$row[1]; + + echo "VICICOMPOSER Client Web: Ouverture de Session\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Français
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Ouverture de Session
 
Ouverture de Session téléphonique:
Mot de passe du Téléphone:
Ouverture de Session:
Mot de passe Utilisateur:
Campagne: $camp_form_code
  \n"; + echo "

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + + } + } +} + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "VICICOMPOSER Client Web: Ouverture de Session téléphonique\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "
English Français
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Ouverture de Session téléphonique
 
Ouverture de Session téléphonique:
Mot de passe du Téléphone:
  \n"; +echo "

VERSION: $version       BUILD: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./vicidial_auth_entries.txt", "a");} +$VDloginDISPLAY=0; + + if ( (strlen($VD_login)<2) or (strlen($VD_pass)<2) or (strlen($VD_campaign)<2) ) + { + $VDloginDISPLAY=1; + } + else + { + $stmt="SELECT count(*) from vicidial_users where user='$VD_login' and pass='$VD_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($auth>0) + { + $login=strtoupper($VD_login); + $password=strtoupper($VD_pass); + ##### grab the full name of the agent + $stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,closer_default_blended,user_group,vicidial_recording_override from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $user_level=$row[1]; + $VU_hotkeys_active=$row[2]; + $VU_agent_choose_ingroups=$row[3]; + $VU_scheduled_callbacks=$row[4]; + $agentonly_callbacks=$row[5]; + $agentcall_manual=$row[6]; + $VU_vicidial_recording=$row[7]; + $VU_vicidial_transfers=$row[8]; + $VU_closer_default_blended=$row[9]; + $VU_user_group=$row[10]; + $VU_vicidial_recording_override=$row[11]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|$VD_pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + $user_abb = "$VD_login$VD_login$VD_login$VD_login"; + while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + + $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$VU_user_group';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGallowed_campaigns =$row[0]; + + if ( (!eregi(" $VD_campaign ",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) + { + echo "VICICOMPOSER Client Web: VICICOMPOSER Ouverture de Campagne\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Français
\n"; + echo "Sorry, you are not allowed to login to this campaign: $VD_campaign\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Ouverture de Session: \n
"; + echo "Mot de passe:
\n"; + echo "Campagne: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + ##### check to see that the campaign is active + $stmt="SELECT count(*) FROM vicidial_campaigns where campaign_id='$VD_campaign' and active='Y';"; + 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); + $CAMPactive=$row[0]; + if($CAMPactive>0) + { + if ($TEST_all_statuses > 0) {$selectableSQL = '';} + else {$selectableSQL = "selectable='Y' and";} + $VARstatuses=''; + $VARstatusnames=''; + ##### grab the statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_statuses WHERE $selectableSQL status != 'NEW' order by status limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $VD_statuses_ct) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + } + + ##### grab the campaign-specific statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_campaign_statuses WHERE $selectableSQL status != 'NEW' and campaign_id='$VD_campaign' order by status limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_camp = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + $j++; + } + $VD_statuses_ct = ($VD_statuses_ct+$VD_statuses_camp); + $VARstatuses = substr("$VARstatuses", 0, -1); + $VARstatusnames = substr("$VARstatusnames", 0, -1); + + ##### grab the campaign-specific HotKey statuses that can be used for dispositioning by an agent + $stmt="SELECT hotkey,status,status_name FROM vicidial_campaign_hotkeys WHERE selectable='Y' and status != 'NEW' and campaign_id='$VD_campaign' order by hotkey limit 9;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $HK_statuses_camp = mysql_num_rows($rslt); + $w=0; + $HKboxA=''; + $HKboxB=''; + $HKboxC=''; + while ($w < $HK_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $HKhotkey[$w] =$row[0]; + $HKstatus[$w] =$row[1]; + $HKstatus_name[$w] =$row[2]; + $HKhotkeys = "$HKhotkeys'$HKhotkey[$w]',"; + $HKstatuses = "$HKstatuses'$HKstatus[$w]',"; + $HKstatusnames = "$HKstatusnames'$HKstatus_name[$w]',"; + if ($w < 3) + {$HKboxA = "$HKboxA $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ( ($w >= 3) and ($w < 6) ) + {$HKboxB = "$HKboxB $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ($w >= 6) + {$HKboxC = "$HKboxC $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + $w++; + } + $HKhotkeys = substr("$HKhotkeys", 0, -1); + $HKstatuses = substr("$HKstatuses", 0, -1); + $HKstatusnames = substr("$HKstatusnames", 0, -1); + + ##### grab the statuses to be dialed for your campaign as well as other campaign settings + $stmt="SELECT park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,agent_pause_codes_active,no_hopper_leads_logins,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,xfer_groups FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $park_ext = $row[0]; + $park_file_name = $row[1]; + $web_form_address = $row[2]; + $allow_closers = $row[3]; + $auto_dial_level = $row[4]; + $dial_timeout = $row[5]; + $dial_prefix = $row[6]; + $campaign_cid = $row[7]; + $campaign_vdad_exten = $row[8]; + $campaign_rec_exten = $row[9]; + $campaign_recording = $row[10]; + $campaign_rec_filename = $row[11]; + $campaign_script = $row[12]; + $get_call_launch = $row[13]; + $campaign_am_message_exten = $row[14]; + $xferconf_a_dtmf = $row[15]; + $xferconf_a_number = $row[16]; + $xferconf_b_dtmf = $row[17]; + $xferconf_b_number = $row[18]; + $alt_number_dialing = $row[19]; + $VC_scheduled_callbacks = $row[20]; + $wrapup_secondes = $row[21]; + $wrapup_message = $row[22]; + $closer_campaigns = $row[23]; + $use_internal_dnc = $row[24]; + $allcalls_delay = $row[25]; + $omit_phone_code = $row[26]; + $agent_pause_codes_active = $row[27]; + $no_hopper_leads_logins = $row[28]; + $campaign_allow_inbound = $row[29]; + $manual_dial_list_id = $row[30]; + $default_xfer_group = $row[31]; + $xfer_groups = $row[32]; + + if ( (!ereg('DISABLED',$VU_vicidial_recording_override)) and ($VU_vicidial_recording > 0) ) + { + $campaign_recording = $VU_vicidial_recording_override; + print "\n"; + } + if ( ($VC_scheduled_callbacks=='Y') and ($VU_scheduled_callbacks=='1') ) + {$scheduled_callbacks='1';} + if ($VU_vicidial_recording=='0') + {$campaign_recording='NEVER';} + if ($alt_number_dialing=='Y') + {$alt_phone_dialing='1';} + else + {$alt_phone_dialing='0';} + $closer_campaigns = preg_replace("/^ | -$/","",$closer_campaigns); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaigns = "'$closer_campaigns'"; + + if ($agent_pause_codes_active=='Y') + { + ##### grab the pause codes for this campaign + $stmt="SELECT pause_code,pause_code_name FROM vicidial_pause_codes WHERE campaign_id='$VD_campaign' order by pause_code limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_pause_codes = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_pause_codes) + { + $row=mysql_fetch_row($rslt); + $pause_codes[$i] =$row[0]; + $pause_code_names[$i] =$row[1]; + $VARpause_codes = "$VARpause_codes'$pause_codes[$i]',"; + $VARpause_code_names = "$VARpause_code_names'$pause_code_names[$i]',"; + $i++; + $j++; + } + $VD_pause_codes_ct = ($VD_pause_codes_ct+$VD_pause_codes); + $VARpause_codes = substr("$VARpause_codes", 0, -1); + $VARpause_code_names = substr("$VARpause_code_names", 0, -1); + } + + ##### grab the inbound groups to choose from if campaign contains CLOSER + $VARingroups="''"; + if ($campaign_allow_inbound == 'Y') + { + $VARingroups=''; + $stmt="select group_id from vicidial_inbound_groups where active = 'Y' and group_id IN($closer_campaigns) order by group_id limit 60;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $closer_ct = mysql_num_rows($rslt); + $INgrpCT=0; + while ($INgrpCT < $closer_ct) + { + $row=mysql_fetch_row($rslt); + $closer_groups[$INgrpCT] =$row[0]; + $VARingroups = "$VARingroups'$closer_groups[$INgrpCT]',"; + $INgrpCT++; + } + $VARingroups = substr("$VARingroups", 0, -1); + } + + ##### grab the allowable inbound groups to choose from for transfer options + $xfer_groups = preg_replace("/^ | -$/","",$xfer_groups); + $xfer_groups = preg_replace("/ /","','",$xfer_groups); + $xfer_groups = "'$xfer_groups'"; + $VARxfergroups="''"; + if ($allow_closers == 'Y') + { + $VARxfergroups=''; + $stmt="select group_id,group_name from vicidial_inbound_groups where active = 'Y' and group_id IN($xfer_groups) order by group_id limit 60;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $xfer_ct = mysql_num_rows($rslt); + $XFgrpCT=0; + while ($XFgrpCT < $xfer_ct) + { + $row=mysql_fetch_row($rslt); + $VARxfergroups = "$VARxfergroups'$row[0]',"; + $VARxfergroupsnames = "$VARxfergroupsnames'$row[1]',"; + if ($row[0] == "$default_xfer_group") {$default_xfer_group_name = $row[1];} + $XFgrpCT++; + } + $VARxfergroups = substr("$VARxfergroups", 0, -1); + $VARxfergroupsnames = substr("$VARxfergroupsnames", 0, -1); + } + + ##### grab the number of leads in the hopper for this campaign + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id = '$VD_campaign' and status='READY';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $campaign_leads_to_call = $row[0]; + print "\n"; + + } + else + { + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Campagne inactive, réessayez
"; + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|$VD_pass|$ip|$browser|\n"); + fclose($fp); + } + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "L'ouverture de session a èchoué, réessayez
"; + } + } + if ($VDloginDISPLAY) + { + echo "VICICOMPOSER Client Web: Ouverture de Campagne\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Français
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "

$VDdisplayMESSAGE

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Ouverture de Campagne
 
Ouverture de Session:
Mot de passe Utilisateur:
Campagne: $camp_form_code
  \n"; + echo "

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +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); +$authphone=$row[0]; +if (!$authphone) + { + echo "VICICOMPOSER Client Web: Ouverture de Session téléphonique Error\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Français
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Ouverture de Session Error
 
L'ouverture de la session Téléphonique à échoué, réessayez:
 
Ouverture de Session téléphonique:
Mot de passe du Téléphone:

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "VICICOMPOSER Client Web\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + 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); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $login=$row[6]; + $pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $Appelant_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + $enable_sipsak_messages=$row[66]; + + if ($clientDST) + { + $local_gmt = ($local_gmt + $isdst); + } + if ($protocol == 'EXTERNAL') + { + $protocol = 'Local'; + $extension = "$dialplan_number$AT$ext_context"; + } + $SIP_user = "$protocol/$extension"; + + $stmt="SELECT asterisk_version from servers where server_ip='$server_ip';"; + 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); + $asterisk_version=$row[0]; + + # If a park extension is not set, use the default one + if ( (strlen($park_ext)>0) && (strlen($park_file_name)>0) ) + { + $VICIDiaL_park_on_extension = "$park_ext"; + $VICIDiaL_park_on_filename = "$park_file_name"; + print "\n"; + } + print "\n"; + + # If a web form address is not set, use the default one + if (strlen($web_form_address)>0) + { + $VICIDiaL_web_form_address = "$web_form_address"; + print "\n"; + } + else + { + $VICIDiaL_web_form_address = "$VICIDiaL_web_URL"; + print "\n"; + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + } + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + # If closers are allowed sur this campaign + if ($allow_closers=="Y") + { + $VICIDiaL_allow_closers = 1; + print "\n"; + } + else + { + $VICIDiaL_allow_closers = 0; + print "\n"; + } + + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtimE$US$session_ext$session_rand"; + + if ($webform_sessionname) + {$webform_sessionname = "&session_name=$session_name";} + else + {$webform_sessionname = '';} + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'vicidial';"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','vicidial','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + if ( ($campaign_allow_inbound == 'Y') || ($campaign_leads_to_call > 0) || (ereg('Y',$no_hopper_leads_logins)) ) + { + ### insert an entry into the user log for the login event + $stmt = "INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$VD_login','LOGIN','$VD_campaign','$NOW_TIME','$StarTtimE','$VU_user_group')"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + ##### check to see if the user has a conf extension already, this happens if they previously exited uncleanly + $stmt="SELECT conf_exten FROM vicidial_conferences where extension='$SIP_user' and server_ip = '$server_ip' LIMIT 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $prev_login_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $prev_login_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + if ($prev_login_ct > 0) + {print "\n";} + else + { + ##### grab the next available vicidial_conference room and reserve it + $stmt="SELECT conf_exten FROM vicidial_conferences where server_ip = '$server_ip' and ((extension='') or (extension is null)) LIMIT 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $free_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $free_conf_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + $stmt="UPDATE vicidial_conferences set extension='$SIP_user' where server_ip='$server_ip' and conf_exten='$session_id';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + print "\n"; + + } + + $stmt="UPDATE vicidial_list set status='N', user='' where status IN('QUEUE','INCALL') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_hopper where status IN('QUEUE','INCALL','DONE') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_live_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_live_inbound_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + # print "You have logged in as user: $VD_login sur phone: $SIP_user Campagne:: $VD_campaign
\n"; + $VICIDiaL_is_logged_in=1; + + ### set the callerID for manager middleware-app to connect the phone to the user + $SIqueryCID = "S$CIDdate$session_id"; + + ############################################# + ##### DEBUT SYSTEM_SETTINGS LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,vicidial_agent_disable,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $vicidial_agent_disable = $row[6]; + $allow_sipsak_messages = $row[7]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_prefix = 'LIN-'; + print "\n"; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$VD_campaign\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + $SIqueryCID = "$SIPSAK_prefix$VD_campaign$DS$CIDdate"; + } + + ### insert a NOUVEAU record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$SIqueryCID','Channel: $SIP_user','Context: $ext_context','Exten: $session_id','Priority: 1','Callerid: $SIqueryCID','','','','','');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($auto_dial_level > 0) + { + print "\n"; + + ##### grab the campaign_weight and number of calls today sur that campaign for the agent + $stmt="SELECT campaign_weight,calls_today FROM vicidial_campaign_agents where user='$VD_login' and campaign_id = '$VD_campaign';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vca_ct = mysql_num_rows($rslt); + if ($vca_ct > 0) + { + $row=mysql_fetch_row($rslt); + $campaign_weight = $row[0]; + $calls_today = $row[1]; + $i++; + } + else + { + $campaign_weight = '0'; + $calls_today = '0'; + $stmt="INSERT INTO vicidial_campaign_agents (user,campaign_id,campaign_rank,campaign_weight,calls_today) values('$VD_login','$VD_campaign','0','0','$calls_today');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + } + $closer_chooser_string=''; + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,user_level,campaign_weight,calls_today) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$closer_chooser_string','$user_level','$campaign_weight','$calls_today');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='$VD_campaign',agent='Agent/$VD_login',verb='AGENTLOGIN',data1='$VD_login@agents',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + mysql_close($linkB); + mysql_select_db("$VARDB_database", $link); + } + + + if ($campaign_allow_inbound == 'Y') + { + print "\n"; + } + } + else + { + print "\n"; + + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,user_level) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$user_level');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='$VD_campaign',agent='Agent/$VD_login',verb='AGENTLOGIN',data1='$VD_login@agents',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + mysql_close($linkB); + mysql_select_db("$VARDB_database", $link); + } + } + } + else + { + echo "VICICOMPOSER Client Web: VICICOMPOSER Ouverture de Campagne\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Français
\n"; + echo "Aucune fiche client n'est éligible pour cette campagne\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Ouverture de Session: \n
"; + echo "Mot de passe:
\n"; + echo "Campagne: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + if (strlen($session_id) < 1) + { + echo "VICICOMPOSER Client Web: VICICOMPOSER Ouverture de Campagne\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Français
\n"; + echo "Sorry, there are no available sessions\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Ouverture de Session: \n
"; + echo "Mot de passe:
\n"; + echo "Campagne: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + if (ereg('MSIE',$browser)) + { + $useIE=1; + print "\n"; + } + else + { + $useIE=0; + print "\n"; + } + + $StarTtimE = date("U"); + $NOW_TIME = date("Y-m-d H:i:s"); + ##### Agent is going to log in so insert the vicidial_agent_log entry now + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group,sub_status) values('$VD_login','$server_ip','$NOW_TIME','$VD_campaign','$StarTtimE','0','$StarTtimE','$VU_user_group','LOGIN');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id($link); + print "\n"; + + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $server_ip_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S"; + + ##### grab the datails of all active scripts in the system + $stmt="SELECT script_id,script_name,script_text FROM vicidial_scripts WHERE active='Y' order by script_id limit 100;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $MM_scripts = mysql_num_rows($rslt); + $e=0; + while ($e < $MM_scripts) + { + $row=mysql_fetch_row($rslt); + $MMscriptid[$e] =$row[0]; + $MMscriptname[$e] = rawurlencode($row[1]); + $MMscripttext[$e] = rawurlencode($row[2]); + $MMscriptids = "$MMscriptids'$MMscriptid[$e]',"; + $MMscriptnames = "$MMscriptnames'$MMscriptname[$e]',"; + $MMscripttexts = "$MMscripttexts'$MMscripttext[$e]',"; + $e++; + } + $MMscriptids = substr("$MMscriptids", 0, -1); + $MMscriptnames = substr("$MMscriptnames", 0, -1); + $MMscripttexts = substr("$MMscripttexts", 0, -1); + + } +} + +################################################################ +### BEGIN - build the callback calendar (12 months) ### +################################################################ +define ('ADAY', (60*60*24)); +$CdayARY = getdate(); +$Cmon = $CdayARY['mon']; +$Cyear = $CdayARY['year']; +$CTODAY = date("Y-m"); +$CTODAYmday = date("j"); +$CINC=0; + +$Cmonths = Array('Janvier','February','Mars','Avril','Mai','Juin', + 'Juillet','Août','Septembre','Octobre','Novembre','Décembre'); +$Cdays = Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); + +$CCAL_OUT = ''; + +$CCAL_OUT .= ""; + +while ($CINC < 12) +{ +if ( ($CINC == 0) || ($CINC == 4) ||($CINC == 8) ) + {$CCAL_OUT .= "";} + +$CCAL_OUT .= ""; + +if ( ($CINC == 3) || ($CINC == 7) ||($CINC == 11) ) + {$CCAL_OUT .= "";} +$CINC++; +} + +$CCAL_OUT .= "
"; + +$CYyear = $Cyear; +$Cmonth= ($Cmon + $CINC); +if ($Cmonth > 12) + { + $Cmonth = ($Cmonth - 12); + $CYyear++; + } +$Cstart= mktime(11,0,0,$Cmonth,1,$CYyear); +$CfirstdayARY = getdate($Cstart); +#echo "|$Cmon|$Cmonth|$CINC|\n"; +$CPRNTDAY = date("Y-m", $Cstart); + +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; + +foreach($Cdays as $Cday) +{ + $CDCLR="#ffffff"; +$CCAL_OUT .= ""; +} + +for( $Ccount=0;$Ccount<(6*7);$Ccount++) +{ + $Cdayarray = getdate($Cstart); + if((($Ccount) % 7) == 0) + { + if($Cdayarray['mon'] != $CfirstdayARY['mon']) + break; + $CCAL_OUT .= ""; + } + if($Ccount < $CfirstdayARY['wday'] || $Cdayarray['mon'] != $Cmonth) + { + $CCAL_OUT .= ""; + } + else + { + if( ($Cdayarray['mday'] == $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + else + { + $CDCLR="#ffffff"; + if ( ($Cdayarray['mday'] < $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CDCLR="#CCCCCC"; + $CBL = ''; + $CEL = ''; + } + else + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + } + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + } +} +$CCAL_OUT .= ""; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$CfirstdayARY[month] $CfirstdayARY[year]"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$Cday"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
 "; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; + +#echo "$CCAL_OUT\n"; +################################################################ +### END - build the callback calendar (12 months) ### +################################################################ + + +?> + + + + +\n"; + + +?> + +
+ + MARGINWIDTH=0 MARGINHEIGHT=0 LEFTMARGIN=0 TOPMARGIN=0 VALIGN=TOP ALIGN=LEFT> +
+ + + +DÉCONNEXION\n"; ?> +
+
+ + + height=30> + + + + + +
VICICOMPOSERSCRIPT VALIGN=MIDDLE ALIGN=CENTER>   LIVE     Id de session: Appel en cours
+
+ + + + + height=>

VICICOMPOSER
+
+ + +APPEL MANUEL       CADRAN RAPIDE
+
+ + +X RAPPELS EN COURS
+
+ + +
+
+ + + D1 - COMPOSER\n"; + echo "
\n"; + echo "D2 - COMPOSER\n"; + } + else {echo "
\n";} + ?> +

+
+
+ + + height=460>
RAPPELS PERSONNELS :
Selectionnez un rappel a éffectuer immédiatement. Une fois éffectué, ce rappel diparaitra de la liste. +
+
+
  + Rafraichir +                 + Retour +
+
+ + + height=460>
NOUVEL APPEL MANUEL VERS :

Nouveau prospect: remplissez le formulaire ci dessous. +
+ \n"; + } + ?> + Note: all new manual dial leads will go into list

+ + + + + + + + + + + + + + + +
Code d'Appel:   (La valeur de ce champ est habituellement 1 aux Etats-Unis et au Canada)
Téléphone Number: +   (12 digits max - digits only) +
Rechercher dans les fiches client existantes:   (Si cette option est activée, le numéro de téléphone sera recherché dans la base avant d'être inséré)


Si vous désirez composer un numéro sans insérer de nouvelle fiche client, entrez le N° a appeler dans le champ Surnumerotation. Pour raccrocher cet appel, vous devrez ouvrir la page Appels en Cours et raccrocher manuellement le canal correspondant.
 
Surnumérotation:   (Ce champ n'accepte que des chiffres) +
+
+ Appel Manuel +                 + Retour +
+
+ + + +
+
+ + + + +Votre Statut:
Calls Dialing: +
+ + + + + > + +
+
+ + Transfert - Conférence
+ + + CLOSER LOCAL + Raccrocher la ligne transférée + Raccrocher les deux lignes + +
+ + Numéro à appeler   + + SURNUMEROTATION   + QUITTER LA CONF A 3 + Transfert immédiat + D1 + D2 + +
+ + secondes   + channel + Appel Client + Mettre en Attente + Blind Transfer VMail Message +
+
+
+
+ + + + height=70> + +
Fiche Prospect Statuée en:

+ -
+
+
+ + + height=70> + + + + +
Raccourcis clavier des Statut: + Si actif, utilisez le raccourci clavier pour statuer et raccrocher un appel:
+ + + + + +
+
+ + + height=70> + + + + + + +
Information De Rappels: close
+
+
+
+
+ +
+
+ + + height=500>
Votre session est vide:
+ Retour +

+ Rappeler l'agent +
+
+ + + height=500>
Le client a raccroché:
+ Retour +

+ Terminer et Statuer l'Appel + +
+
+ + + height=550>
Traitement Post Appel : secondes restant pour le traitement post appel

+ +

+ Terminer le traitement post appel et continuer + +
+
+ + + height=500>
Votre session a été neutralisée
DÉCONNEXION

Retour +
+
+ + + height=500>

DÉCONNEXION
+
+ + +
+
+ + +
 
+
+ + + height=47>
Aucune modification ne peut être prise en compte, les modifications doivent être validées avant de raccrocher.
+
+ + + height=460>
STATUER L'APPEL :       Décrochement Encore       réduire
+ Selection du status de fin d'appel +
+ PAUSE DE LA NUMEROTATION
+ EFFACER LE FORMULAIRE | + VALIDER +

+ WEB FORM VALIDER +

  +
+
+ + + height=460>
CHOISISSEZ Un CODE De PAUSE :
+ Pause Code Selection + +

  +
+
+ + + height=460>
Choisissez une date de Rappel :
+ + + Choisissez une date ci-dessous   +     + Hour: +   + Minutes: +   + +  
+ RAPPELS PERSONNELS
";} + ?> + Commentaires du Rappel:

+ + VALIDER

+ +

  +
+
+ + + height=460>
UN CHOIX DE GROUPE D'ARRIVÉE PLUS ÉTROIT
+ Un Choix De Groupe D'arrivée Plus étroit +
+ APPEL EN MODE BLENDED(Mode "Appels Sortants" Activé)
+ REINITIALISATION | + VALIDER +



  +
+
+ + + + Canal + Canal + RAPPELS PERSONNELS
";} + ?> +
+ + + + height=>
VICICOMPOSER SCRIPT
+
+ + + 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> +RACCOURCIS INACTIFS + + + + +> + + + +
VICICOMPOSER Client Web:     BUILD:               Serveur:              
+Montrez les informations sur la conférence

 
+
+ + + +
+
+ + + + + id="MainTable"> + + + + + + + + + + + + + + + +
STATUT:
+
+Appel Numéro Suivant
+ Prévisualisation
+ APPEL NUM. 2nd.
+ + +ENREGISTREMENT:
+
+
+IDENTIFIANT:
+
+ +Enregistrer
+
+Formulaire Web
+
+Mettre en Attente
+Transfert - Conférence
+
+Raccrocher
+
+
Envoyez DTMF

+
+
+
align=left valign=top> + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
secondes:   Canal:   Durée d'Appel:
Informations Client:
Titre:   Prenom:   Mi:  Nom:
Adresse1:
Adresse2:   Adresse3:
Ville:   État:   Code postal:
Province:   Code Vendeur:
Téléphone:   DialCode:   Tel. 2nd:
Visualiser:   Email:
Commentaires: + +\n";} +else + {echo "\n";} +?> + +
+
+ +
+
> + 
+ + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/voicemail_check.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/voicemail_check.php new file mode 100644 index 00000000..1d3f197c --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_fr/voicemail_check.php @@ -0,0 +1,140 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "\n"; +echo "\n"; +echo "\n"; +echo "Consultation de la Boite Vocale"; +echo "\n"; +echo "\n"; +echo "\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";} + $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";} + } + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/active_list_refresh.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/active_list_refresh.php new file mode 100644 index 00000000..ba71cd44 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/active_list_refresh.php @@ -0,0 +1,482 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "Non valido Utentename/Parola d`accesso: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Non valido server_ip: |$server_ip| or Non valido 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 "Non valido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='table') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Visualizza Lista: "; +if ($ADD==1) {echo "Interni Attivi";} +if ($ADD==2) {echo "Interni Occupati";} +if ($ADD==3) {echo "Linee Esterne";} +if ($ADD==4) {echo "Interni Locali";} +if ($ADD==5) {echo "Conferenze";} +if ($ADD==99999) {echo "AIUTO";} +echo "\n"; +echo "\n"; +echo "\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 "\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + +###################### +# ADD=2 display all busy extensions on a server +###################### +if ($ADD==2) +{ + if (!$field_name) {$field_name = 'busyext';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\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 "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=4 display all busy Local lines on a server +###################### +if ($ADD==4) +{ + if (!$field_name) {$field_name = 'local';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\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 "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='table') {echo "\n";} +if ($format=='table') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/astguiclient.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/astguiclient.php new file mode 100644 index 00000000..94d90a1e --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/astguiclient.php @@ -0,0 +1,2905 @@ + LICENSE: GPLv2 +# +# make sure you have added a user to the vicidial_users MySQL table with at least +# user_level 1 or greater to access this page. Also you need to have the login +# and pass of a phone listed in the asterisk.phones table. The page grabs the +# server info and other details from this login and pass +# +# Other scripts that this application depends on: +# - active_list_refresh.php: displays active/live channels and phones +# - manager_send.php: sends Actions to be executed on Asterisk servers +# - live_exten_check.php: checks to see if user's phone is on a live call +# - call_log_display.php: retrieves log of inbound and outbound calls +# - voicemail_check.php: retrieves counts of new and old messages +# - inbound_popup.php: opens upon live_inbound call coming in +# - conf_exten_check.php: checks to see if and calls are in a specific conf +# - park_calls_display.php: retrieves list of parked calls +# - vdc_db_query.php: Changes values in the DB for non-calling records +# +# CHANGES +# 50215-1356 - Proof-of-concept test of XMLHttpRequest for astGUIclient web +# 50323-1411 - First build version display-only +# 50331-1040 - Second-build, added phone login and hangup/hijack display +# 50401-1006 - Trunk/Local Hangup functions enabled +# 50404-1056 - Trunk/Local Hijack functions enabled +# 50404-1459 - Simple live calls display and grabs updated time from server +# 50405-1221 - Reorganized the display and layers, added some images +# 50406-1005 - Added In/Out call log display to MAIN panel +# 50407-1254 - Start/Stop Recording on live calls enabled +# 50422-1101 - Activated Check Voicemail button and new/old messages count +# 50428-1449 - Added dial from log and basic live_inbound call popup +# 50429-1455 - Modified inbound popup code for IE and to add more functions +# 50502-1442 - Added basic method to transfer live calls somewhere else +# 50503-1205 - Added web_client_sessions entry for more security of subscripts +# 50503-1537 - Added basic conferences display +# 50509-1132 - Added conference connected list and hangup/xfer for them +# 50511-1129 - Added registration of conference rooms and added manual dial +# 50523-1342 - Added Conference recording and send DTMF +# 50523-1622 - Added Local Dial window frame for calling local extensions +# 50524-1456 - Added ability to park call and display number of parked calls +# 50524-1600 - Added ability to display and pickup/hangup/xfer parked calls +# 50525-1224 - Added ability to place outbound call from within conferene +# 50531-1225 - Added ability to do dual transfers to meetme rooms from Main +# 50711-1229 - removed HTTP authentication in favor of user/pass vars +# 50711-1610 - Added Zap monitoring to Trunk/Local Action screens +# 50804-1604 - Minor bug fix in inbound_popup functions +# 50818-1715 - Added pretty login section +# 50913-1137 - Added custom outbound_cid from phones table +# 51110-1430 - Fixed non-standard http port issue +# 60103-1421 - Added code for favorite extensions chooser +# 60104-1347 - Added basic layout for favorites editing frame +# 60105-1124 - Finished Favorites frame and added DB submission +# 60112-1622 - Several formatting changes +# 60421-1357 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1103 - Added variable filters to close security holes for login form +# 60829-1528 - Made compatible with WeBRooTWritablE setting in dbconnect.php +# + +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["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["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} + 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"];} + } + +$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++;} + +$version = '2.0.1'; +$build = '60829-1528'; + +### 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); + $user=ereg_replace("[^0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^0-9a-zA-Z]","",$pass); + + +if ($force_logout) +{ + if( (strlen($_SERVER['user'])>0) or (strlen($_SERVER['pass'])>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "Ora siete non Loggati . Grazie\n"; + exit; +} + +$StarTtime = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_TIME = date("Ymd-His"); + $month_old = mktime(0, 0, 0, date("m"), date("d")-7, date("Y")); + $past_month_date = date("Y-m-d H:i:s",$month_old); + + $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]; + +$US='_'; +$CL=':'; +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./astguiclient_auth_entries.txt", "a");} +$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 = $agcPAGE; +$agcDIR = eregi_replace('astguiclient.php','',$agcDIR); + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth) or ($relogin == 'YES') ) + { + header ("Content-type: text/html; charset=utf-8"); + + echo "web client astGUIclient: Inizio attività\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Italiano
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Inizio attività
 
Inizio attività dell`Utente:
Parola d`accesso Dell`Utente:
Inizio attività Telefono:
Parola d`accesso del Telefono:

VERSIONE: $version       CONFIGURAZIONE: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($user); + $password=strtoupper($pass); + $stmt="SELECT full_name,user_level from vicidial_users where user='$user' and pass='$pass'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICICHIAMA|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICICHIAMA|FAIL|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + } + +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 +echo "\n"; +echo "\n"; +echo "\n"; + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "web client astGUIclient: Inizio attività Telefono\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "
English Italiano
\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Inizio attività Telefono
 
Inizio attività Telefono:
Parola d`accesso del Telefono:

VERSIONE: $version       CONFIGURAZIONE: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$authphone=$row[0]; +if (!$authphone) + { + echo "web client astGUIclient: Inizio attività Telefono\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Italiano
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Inizio attività Telefono
 
Spiacente, la vostra password e login non sono attivi in questo sistema, riprova di nuovo:
 
Inizio attività Telefono:
Parola d`accesso del Telefono:

VERSIONE: $version       CONFIGURAZIONE: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "web client astGUIclient\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $phone_login=$row[6]; + $phone_pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CaLLerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + $outbound_cid=$row[65]; + + $local_web_callerID_URL_enc = rawurlencode($local_web_callerID_URL); + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtime$US$session_ext$session_rand"; + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'agc';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','agc','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT count(*) from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_present=$row[0]; + if ($favorites_present > 0) + { + $stmt="SELECT extensions_list from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_list=$row[0]; + $h=0; + $favorites_listX = eregi_replace("'",'',$favorites_list); + $favorites = explode(',',$favorites_listX); + $favorites_count = count($favorites); + $favorites_listX=''; + + $o=0; + while ($favorites_count > $o) + { + $stmt="SELECT fullname,protocol from phones where extension = '$favorites[$o]' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $favorites_names[$o] = $rowx[0]; + $favorites_listX .= "$rowx[1]/$favorites[$o],"; + $o++; + } + + echo "\n"; + echo "\n"; + } + else + { + echo "\n"; + } + +### gather phone extensions and fullnames for favorites editor ### + $stmt="SELECT extension,fullname from phones where server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $exten_ct = mysql_num_rows($rslt); + $favlistCT=0; + $nofavlistCT=0; + while ($favlistCT < $exten_ct) + { + $row=mysql_fetch_row($rslt); + $favlist[$favlistCT]= "$row[0] - $row[1]"; + $favlistCT++; + } + + } +} + + +?> + + + + + + +\n"; + + +?> + +
+ + + + + + + + + +
+ + +LOGOUT
\n"; ?> +
Pannello PrincipalePannello Linee Attive Pannello ConferenzeControlla la VoicemailChimate Attive
+
+ + +

Logout
+
+ + +
TRUNK ATTACCA

+ Active Trunks Menu
+ Disconnetti il Trunk   |   + Dirotta il Trunk   |   + Ascolta il Trunk   |   + Aggiorna   |   + Tornate alla schermata principale +
+
+ + +
DISCONNETTI LOCALI

+ Menu Locale Attivo
+ Disconnetti locale   |   + Dirotta il Locale   |   + Ascolta il locale   |   + Aggiorna   |   + Tornate alla schermata principale +
+
+ + + + + + + +
TRASFERIMENTO CHIAMATA ATTIVA
Canale trasferito: Canale
Interni:
Menu degli Interni
+
+ Invia all` interno selezionato

+ Invia alla VoiceMail selezionata

+ Invia a questo numero :


+ Aggiorna


+ Tornate alla schermata principale

+
Conferenze:
(Seleziona il numero sopra per inviarlo ad una conferenza)
Invia anche il mio canale
Menu Conferenza
+
+ + + + + +
Chiamata Interni locali
Chiamata proveniente da: Canale
Interni:
Menu degli Interni
+
+ Chiama l` interno selezionato

+ Chiama la Voice Mail selezionata

+ Aggiorna


+ Tornate alla schermata principale

+
+
+ + +
CHIAMATE PARCHEGGIATE:
+ Tornate alla schermata principale

+
+
+ + + + + + + + + + + + + + + +
  +
VOICEMAIL     NUOVO:     VECCHIO:             Chiamata Manuale       CHIAMA
CHIAMATE PARCHEGGIATE: 0                INTERNI DI CHIAMATA LOCALE
CHIAMATE OUTBOUND:
CHIAMATE INBOUND:
VERSIONEE web del astGUIclient: CONFIGURAZIONE:
+ + + + $h) + { + if (strlen($favorites[$h])>1) + { + echo "\n"; + } + $h++; + } +?> + +
FAVORITI       modifica
$favorites[$h] - $favorites_names[$h]
 
+
+ + + + + + + +
FAVORITI

 
SALVA I CAMBIAMENTI - richiede Logout
TORNA SCHERMATA PRECEDENTE- ignora i cambiamenti fatti
+
+ +
+ + + + + + + + + + + + + +
+PAUSA | INIZIO     Aggiorna i tempi: 1000 ms Più velocemente | Più lento

+
Inizializzazione..
+
Interni Attivi
+AGGIORNA | +ORDINE | +
Linee Esterne
+AGGIORNA | +ORDINE | +
Interni Locali
+AGGIORNA | +ORDINE | +
+ I Dati vanno inseriti qui

+
+ I Dati vanno inseriti qui

Azione Del Trunk +
+ I Dati vanno inseriti qui

Azione Locale +
+
+ + + + +
+ + +Lista delle conferenze + + + +
+Seleziona una stanza sulla sinistra per informazioni sulla conferenza +
+ + + + + + + + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/call_log_display.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/call_log_display.php new file mode 100644 index 00000000..b05f0b42 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/call_log_display.php @@ -0,0 +1,196 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "Non valido Utentename/Parola d`accesso: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Non valido server_ip: |$server_ip| or Non valido 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 "Non valido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Visualizza il Call Log"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten non è valido o protocollo $protocol non è 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";} + $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";} + $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"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/conf_exten_check.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/conf_exten_check.php new file mode 100644 index 00000000..b6175b03 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/conf_exten_check.php @@ -0,0 +1,297 @@ + LICENSE: GPLv2 +# +# 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 +# + +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"];} + +$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";} + +$version = '2.0.4-12'; +$build = '71122-0205'; +$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";} + $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 "Non valido Utentename/Parola d`accesso: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Non valido server_ip: |$server_ip| or Non valido 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 "Non valido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Controllo interni della conferenza"; +echo "\n"; +echo "\n"; +echo "\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 è valido\n"; + exit; + } + else + { + + if ($client == 'vdc') + { + $Acount=0; + $AexternalDEAD=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); + $row=mysql_fetch_row($rslt); + $Acount=$row[0]; + + if ($Acount > 0) + { + $stmt="SELECT status from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Astatus=$row[0]; + } + # ### 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";} + $rslt=mysql_query($stmt, $link); + + if ($campagentstdisp == 'YES') + { + ### grab the status of this agent to display + $stmt="SELECT status,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Alogin=$row[0]; + $Acampaign=$row[1]; + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where server_ip='$server_ip' and status NOT IN('XFER') and campaign_id='$Acampaign';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $RingCalls=$row[0]; + } + else + { + $Alogin='N'; + $RingCalls='N'; + } + } + else + { + $Alogin='N'; + $RingCalls='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";} + $rslt=mysql_query($stmt, $link); + + } + + if ($Acount < 1) {$Alogin='DEAD_VLA';} + if ($AexternalDEAD > 0) {$Alogin='DEAD_EXTERNAL';} + + echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Status: ' . $Astatus . "|\n"; + + } + $total_conf=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + 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";} + } + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $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++; $total_conf++; + $row=mysql_fetch_row($rslt); + $CanaleA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + } + $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 è valido or Exten $exten non è 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";} + $rslt=mysql_query($stmt, $link); + } + echo "Conferenza $conf_exten è stato registrato $exten\n"; + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/dbconnect.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/dbconnect.php new file mode 100644 index 00000000..7221b35e --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/dbconnect.php @@ -0,0 +1,48 @@ + LICENSE: GPLv2 +# +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"); +mysql_select_db("$VARDB_database"); + +$local_DEF = 'Local/'; +$conf_silent_prefix = '7'; +$local_AMP = '@'; +$ext_context = 'demo'; +$recording_exten = '8309'; +$WeBRooTWritablE = '1'; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/inbound_popup.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/inbound_popup.php new file mode 100644 index 00000000..c80ce26b --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/inbound_popup.php @@ -0,0 +1,351 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "Non valido Utentename/Parola d`accesso: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Non valido server_ip: |$server_ip| or Non valido 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 "Non valido 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 "\n"; +echo "\n"; +echo "\n"; +?> + + +CHIAMATA INBOUND ATTIVA"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "

CHIAMATA INBOUND ATTIVA

\n"; +echo "$NOW_TIME

\n"; +} + + + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($uniqueid)<9) + { + $channel_live=0; + echo "Uniqueid $uniqueid non è valido\n"; + exit; + } + else + { + $stmt="SELECT * FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $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";} + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Canale: $row[1]
CallerID: $row[3]
\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 "GOOGLE - \n"; + echo "ANYWHO - \n"; + echo "SWITCHBOARD - \n"; + echo "VERIZON - \n"; + echo "WHITEPAGES - \n"; + echo "411.COM - \n"; + echo "411.COM - \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 "CLIENTE - \n"; + + echo "
Numero chiamato: $row[8]
Note: $row[9]|$row[10]|$row[11]|$row[12]|$row[13]|
\n"; + echo "ATTACCA - \n"; + echo "INVIA AL MIO VOICEMAIL\n"; + echo "
\n"; + + + $stmt="UPDATE live_inbound set acknowledged='Y' where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + + } + + + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/live_exten_check.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/live_exten_check.php new file mode 100644 index 00000000..7c71701d --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/live_exten_check.php @@ -0,0 +1,278 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "Non valido Utentename/Parola d`accesso: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Non valido server_ip: |$server_ip| or Non valido 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 "Non valido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Controllo Interni Attivi "; +echo "\n"; +echo "\n"; +echo "\n"; +} + + +echo "DateTime: $NOW_TIME|"; +echo "UnixTime: $StarTtime|"; + +$stmt="SELECT count(*) FROM parked_channels where server_ip = '$server_ip';"; + if ($format=='debug') {echo "\n";} +$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 è valido o protocollo $protocol non è 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";} + $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";} + } + } + + $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";} + $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";} + $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";} + $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";} + $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";} +$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";} + } + +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";} + $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";} + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/manager_send.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/manager_send.php new file mode 100644 index 00000000..9644e5dd --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/manager_send.php @@ -0,0 +1,1142 @@ + LICENSE: GPLv2 +# +# This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk 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: +# - $ACTION - ('Originate','Redirect','Hangup','Command','Monitor','StopMonitor','SysCIDOriginate','RedirectName','RedirectNameVmail','MonitorConf','StopMonitorConf','RedirectXtra','RedirectXtraCX','RedirectVD','HangupConfDial','VolumeControl','OriginateVDRelogin') +# - $queryCID - ('CN012345678901234567',...) +# - $format - ('text','debug') +# - $channel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +# - $exten - ('1234','913125551212',...) +# - $ext_context - ('default','demo',...) +# - $ext_priority - ('1','2',...) +# - $filename - ('20050406-125623_44444',...) +# - $extenName - ('phone100',...) +# - $parkedby - ('phone100',...) +# - $extrachannel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +# - $auto_dial_level - ('0','1','1.1',...) +# - $campaign - ('CLOSER','TESTCAMP',...) +# - $uniqueid - ('1120232758.2406800',...) +# - $lead_id - ('1234',...) +# - $seconds - ('32',...) +# - $outbound_cid - ('3125551212','0000000000',...) +# - $agent_log_id - ('123456',...) +# - $call_server_ip - ('10.10.10.15',...) +# - $CalLCID - ('VD01234567890123456',...) +# - $stage - ('UP','DOWN') +# + +# CHANGELOG: +# 50401-1002 - First build of script, Hangup function only +# 50404-1045 - Redirect basic function enabled +# 50406-1522 - Monitor basic function enabled +# 50407-1647 - Monitor and StopMonitor full functions enabled +# 50422-1120 - basic Originate function enabled +# 50428-1451 - basic SysCIDOriginate function enabled for checking voicemail +# 50502-1539 - basic RedirectName and RedirectNameVmail added +# 50503-1227 - added session_name checking for extra security +# 50523-1341 - added Conference call start/stop recording +# 50523-1421 - added OriginateName and OriginateNameVmail for local calls +# 50524-1602 - added RedirectToPark and RedirectFromPark +# 50531-1203 - added RedirecXtra for dual channel redirection +# 50630-1100 - script changed to not use HTTP login vars, user/pass instead +# 50804-1148 - Added RedirectVD for VICIDIAL blind redirection with logging +# 50815-1204 - Added NEXTAVAILABLE to RedirectXtra function +# 50903-2343 - Added HangupConfDial function to hangup in-dial channels in conf +# 50913-1057 - Added outbound_cid set if present to originate call +# 51020-1556 - Added agent_log_id framework for detailed agent activity logging +# 51118-1204 - Fixed Blind transfer bug from VICIDIAL when in manual dial mode +# 51129-1014 - Added ability to accept calls from other VICIDIAL servers +# 51129-1253 - Fixed Hangups of other agents channels in VICIDIAL AD +# 60310-2022 - Fixed NEXTAVAILABLE bug in leave-3way-call redirect function +# 60421-1413 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1158 - Added variable filters to close security holes for login form +# 60809-1544 - Added direct transfers to leave-3ways in consultative transfers +# 61004-1526 - Added parsing of volume control command and lookup or number +# 61130-1617 - Added lead_id to MonitorConf for recording_log +# 61201-1115 - Added user to MonitorConf for recording_log +# 70111-1600 - added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70226-1251 - Added Mute/UnMute to conference volume control +# 70320-1502 - Added option to allow retry of leave-3way-call and debug logging +# 70322-1636 - Added sipsak display ability +# + +require("dbconnect.php"); + +### These are variable assignments for PHP globals off +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["ACTION"])) {$ACTION=$_GET["ACTION"];} + elseif (isset($_POST["ACTION"])) {$ACTION=$_POST["ACTION"];} +if (isset($_GET["queryCID"])) {$queryCID=$_GET["queryCID"];} + elseif (isset($_POST["queryCID"])) {$queryCID=$_POST["queryCID"];} +if (isset($_GET["format"])) {$format=$_GET["format"];} + elseif (isset($_POST["format"])) {$format=$_POST["format"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["exten"])) {$exten=$_GET["exten"];} + elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];} +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["filename"])) {$filename=$_GET["filename"];} + elseif (isset($_POST["filename"])) {$filename=$_POST["filename"];} +if (isset($_GET["extenName"])) {$extenName=$_GET["extenName"];} + elseif (isset($_POST["extenName"])) {$extenName=$_POST["extenName"];} +if (isset($_GET["parkedby"])) {$parkedby=$_GET["parkedby"];} + elseif (isset($_POST["parkedby"])) {$parkedby=$_POST["parkedby"];} +if (isset($_GET["extrachannel"])) {$extrachannel=$_GET["extrachannel"];} + elseif (isset($_POST["extrachannel"])) {$extrachannel=$_POST["extrachannel"];} +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["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} + elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["secondS"])) {$secondS=$_GET["secondS"];} + elseif (isset($_POST["secondS"])) {$secondS=$_POST["secondS"];} +if (isset($_GET["outbound_cid"])) {$outbound_cid=$_GET["outbound_cid"];} + elseif (isset($_POST["outbound_cid"])) {$outbound_cid=$_POST["outbound_cid"];} +if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];} + elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];} +if (isset($_GET["call_server_ip"])) {$call_server_ip=$_GET["call_server_ip"];} + elseif (isset($_POST["call_server_ip"])) {$call_server_ip=$_POST["call_server_ip"];} +if (isset($_GET["CalLCID"])) {$CalLCID=$_GET["CalLCID"];} + elseif (isset($_POST["CalLCID"])) {$CalLCID=$_POST["CalLCID"];} +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["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} +if (isset($_GET["phone_ip"])) {$phone_ip=$_GET["phone_ip"];} + elseif (isset($_POST["phone_ip"])) {$phone_ip=$_POST["phone_ip"];} +if (isset($_GET["enable_sipsak_messages"])) {$enable_sipsak_messages=$_GET["enable_sipsak_messages"];} + elseif (isset($_POST["enable_sipsak_messages"])) {$enable_sipsak_messages=$_POST["enable_sipsak_messages"];} +if (isset($_GET["allow_sipsak_messages"])) {$allow_sipsak_messages=$_GET["allow_sipsak_messages"];} + elseif (isset($_POST["allow_sipsak_messages"])) {$allow_sipsak_messages=$_POST["allow_sipsak_messages"];} + +$user=ereg_replace("[^0-9a-zA-Z]","",$user); +$pass=ereg_replace("[^0-9a-zA-Z]","",$pass); +$secondS = ereg_replace("[^0-9]","",$secondS); + +# default optional vars if not set +if (!isset($ACTION)) {$ACTION="Originate";} +if (!isset($format)) {$format="alert";} +if (!isset($ext_priority)) {$ext_priority="1";} + +$version = '2.0.29'; +$build = '70320-1502'; +$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 "Non valido Utentename/Parola d`accesso: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Non valido server_ip: |$server_ip| or Non valido 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 "Non valido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Il Responsabile invia a: "; +if ($ACTION=="Originate") {echo "Originate";} +if ($ACTION=="Redirect") {echo "Redirect";} +if ($ACTION=="RedirectName") {echo "RedirectName";} +if ($ACTION=="Hangup") {echo "Hangup";} +if ($ACTION=="Command") {echo "Command";} +if ($ACTION==99999) {echo "AIUTO";} +echo "\n"; +echo "\n"; +echo "\n"; +} + + + + + +###################### +# ACTION=SysCIDOriginate - insert Originate Manager statement allowing small CIDs for system calls +###################### +if ($ACTION=="SysCIDOriginate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<1) ) + { + echo "Exten $exten non è valido or queryCID $queryCID non è valido, Originate comando non inserito\n"; + } + else + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate comando inviato a Exten $exten Canale $channel su $server_ip\n"; + } +} + + + +###################### +# ACTION=Originate, OriginateName, OriginateNameVmail - insert Originate Manager statement +###################### +if ($ACTION=="OriginateName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Una di queste variabili non è valido:\n"; + echo "Canale $channel deve essere più grande di 2 caratteri\n"; + echo "queryCID $queryCID deve essere più grande di 14 caratteri\n"; + echo "extenName $extenName deve essere regolato\n"; + echo "ext_context $ext_context deve essere regolato\n"; + echo "ext_priority $ext_priority deve essere regolato\n"; + echo "\nOriginateName Action non trasmesso\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="OriginateNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Una di queste variabili non è valido:\n"; + echo "Canale $channel deve essere più grande di 2 caratteri\n"; + echo "queryCID $queryCID deve essere più grande di 14 caratteri\n"; + echo "extenName $extenName deve essere regolato\n"; + echo "exten $exten deve essere regolato\n"; + echo "ext_context $ext_context deve essere regolato\n"; + echo "ext_priority $ext_priority deve essere regolato\n"; + echo "\nOriginateNameVmail Action non trasmesso\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="OriginateVDRelogin") +{ + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $CIDdate = date("ymdHis"); + $DS='-'; + $SIPSAK_prefix = 'LIN-'; + print "\n"; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$campaign\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + $queryCID = "$SIPSAK_prefix$campaign$DS$CIDdate"; + + } + $ACTION="Originate"; +} + +if ($ACTION=="Originate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<10) ) + { + echo "Exten $exten non è valido or queryCID $queryCID non è valido, Originate comando non inserito\n"; + } + else + { + if (strlen($outbound_cid)>1) + {$outCID = "\"$queryCID\" <$outbound_cid>";} + else + {$outCID = "$queryCID";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate comando inviato a Exten $exten Canale $channel su $server_ip\n"; + } +} + + + +###################### +# ACTION=HangupConfDial - find the Local channel that is in the conference and needs to be hung up +###################### +if ($ACTION=="HangupConfDial") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($queryCID)<15) or (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "conference $exten non è valido or ext_context $ext_context or queryCID $queryCID non è valido, Hangup comando non inserito\n"; + } + else + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $hangup_channel_prefix = "$local_DEF$exten$local_AMP$ext_context"; + + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row > 0) + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $channel=$rowx[0]; + $ACTION="Hangup"; + $queryCID = eregi_replace("^.","G",$queryCID); + } + } +} + + + +###################### +# ACTION=Hangup - insert Hangup Manager statement +###################### +if ($ACTION=="Hangup") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) ) + { + $channel_live=0; + echo "Canale $channel non è valido or queryCID $queryCID non è valido, Hangup comando non inserito\n"; + } + else + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + +# $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# if ($row[0]==0) +# { +# $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $rowx=mysql_fetch_row($rslt); +# if ($rowx[0]==0) +# { +# $channel_live=0; +# echo "Channel $channel is not live on $call_server_ip, Hangup command not inserted\n"; +# } +# } + if ( ($auto_dial_level > 0) and (strlen($CalLCID)>2) and (strlen($exten)>2) and ($secondS > 4)) + { + $stmt="SELECT count(*) FROM vicidial_auto_calls where channel='$channel' and callerid='$CalLCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + echo "Call $CalLCID $channel non è attivo su $call_server_ip, Checking Live Canale...\n"; + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel' and extension LIKE \"%$exten\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $channel_live=0; + echo "Canale $channel non è attivo su $call_server_ip, Hangup comando non inserito $rowx[0]\n$stmt\n"; + } + else + { + echo "$stmt\n"; + } + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Hangup','$queryCID','Channel: $channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Hangup comando inviato a Canale $channel su $call_server_ip\n"; + } + } +} + + + +###################### +# ACTION=Redirect, RedirectName, RedirectNameVmail, RedirectToPark, RedirectFromPark, RedirectVD, RedirectXtra, RedirectXtraCX +# - insert Redirect Manager statement using extensions name +###################### +if ($ACTION=="RedirectVD") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($campaign)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($uniqueid)<2) or (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "Una di queste variabili non è valido:\n"; + echo "Canale $channel deve essere più grande di 2 caratteri\n"; + echo "queryCID $queryCID deve essere più grande di 14 caratteri\n"; + echo "exten $exten deve essere regolato\n"; + echo "ext_context $ext_context deve essere regolato\n"; + echo "ext_priority $ext_priority deve essere regolato\n"; + echo "auto_dial_level $auto_dial_level deve essere regolato\n"; + echo "campaign $campaign deve essere regolato\n"; + echo "uniqueid $uniqueid deve essere regolato\n"; + echo "lead_id $lead_id deve essere regolato\n"; + echo "\nRedirectVD Action non trasmesso\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($auto_dial_level < 1) + { + $stmt = "UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectToPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($parkedby)<1) ) + { + $channel_live=0; + echo "Una di queste variabili non è valido:\n"; + echo "Canale $channel deve essere più grande di 2 caratteri\n"; + echo "queryCID $queryCID deve essere più grande di 14 caratteri\n"; + echo "exten $exten deve essere regolato\n"; + echo "extenName $extenName deve essere regolato\n"; + echo "ext_context $ext_context deve essere regolato\n"; + echo "ext_priority $ext_priority deve essere regolato\n"; + echo "parkedby $parkedby deve essere regolato\n"; + echo "\nRedirectToPark Action non trasmesso\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "INSERT INTO parked_channels values('$channel','$server_ip','','$extenName','$parkedby','$NOW_TIME');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectFromPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Una di queste variabili non è valido:\n"; + echo "Canale $channel deve essere più grande di 2 caratteri\n"; + echo "queryCID $queryCID deve essere più grande di 14 caratteri\n"; + echo "exten $exten deve essere regolato\n"; + echo "ext_context $ext_context deve essere regolato\n"; + echo "ext_priority $ext_priority deve essere regolato\n"; + echo "\nRedirectFromPark Action non trasmesso\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "DELETE FROM parked_channels where server_ip='$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Una di queste variabili non è valido:\n"; + echo "Canale $channel deve essere più grande di 2 caratteri\n"; + echo "queryCID $queryCID deve essere più grande di 14 caratteri\n"; + echo "extenName $extenName deve essere regolato\n"; + echo "ext_context $ext_context deve essere regolato\n"; + echo "ext_priority $ext_priority deve essere regolato\n"; + echo "\nRedirectName Action non trasmesso\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Una di queste variabili non è valido:\n"; + echo "Canale $channel deve essere più grande di 2 caratteri\n"; + echo "queryCID $queryCID deve essere più grande di 14 caratteri\n"; + echo "extenName $extenName deve essere regolato\n"; + echo "exten $exten deve essere regolato\n"; + echo "ext_context $ext_context deve essere regolato\n"; + echo "ext_priority $ext_priority deve essere regolato\n"; + echo "\nRedirectNameVmail Action non trasmesso\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectXtraCX") +{ + $DBout=''; + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "Una di queste variabili non è valido:\n"; + echo "Canale $channel deve essere più grande di 2 caratteri\n"; + echo "ExtraCanale $extrachannel deve essere più grande di 2 caratteri\n"; + echo "queryCID $queryCID deve essere più grande di 14 caratteri\n"; + echo "exten $exten deve essere regolato\n"; + echo "ext_context $ext_context deve essere regolato\n"; + echo "ext_priority $ext_priority deve essere regolato\n"; + echo "\nRedirect Action non trasmesso\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDCXC|$filename|$user|$campaign|$channel|$extrachannel|$queryCID|$exten|$ext_context|ext_priority|\n"); + fclose($fp); + } + } + } + else + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Canale $channel non è attivo su $call_server_ip, Redirect comando non inserito\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel non è attivo su $call_server_ip";} + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Canale $channel non è attivo su $server_ip, Redirect comando non inserito\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel non è attivo su $server_ip";} + } + } + if ( ($channel_liveX==1) && ($channel_liveY==1) ) + { + $stmt="SELECT count(*) FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0] < 1) + { + $channel_liveY=0; + echo "No Local agent to send call to, Redirect comando non inserito\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "No Local agent to send call to";} + } + else + { + $stmt="SELECT server_ip,conf_exten,user FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $dest_server_ip = $rowx[0]; + $dest_session_id = $rowx[1]; + $dest_user = $rowx[2]; + $S='*'; + + $D_s_ip = explode('.', $dest_server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$dest_session_id$S$lead_id$S$dest_user$S$phone_code$S$phone_number$S$campaign$S"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','$queryCID','Channel: $extrachannel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtraCX comando inviato a Canale $channel su $call_server_ip and \nHungup $extrachannel su $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel su $call_server_ip, Hungup $extrachannel su $server_ip";} + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "Changed to Redirect: $channel su $server_ip";} + } + + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDCXC|$filename|$user|$campaign|$DBout|\n"); + fclose($fp); + } + } + + } +} + +if ($ACTION=="RedirectXtra") +{ + if ($channel=="$extrachannel") + {$ACTION="Redirect";} + else + { + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "Una di queste variabili non è valido:\n"; + echo "Canale $channel deve essere più grande di 2 caratteri\n"; + echo "ExtraCanale $extrachannel deve essere più grande di 2 caratteri\n"; + echo "queryCID $queryCID deve essere più grande di 14 caratteri\n"; + echo "exten $exten deve essere regolato\n"; + echo "ext_context $ext_context deve essere regolato\n"; + echo "ext_priority $ext_priority deve essere regolato\n"; + echo "\nRedirect Action non trasmesso\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDX|$filename|$user|$campaign|$$channel|$extrachannel|$queryCID|$exten|$ext_context|ext_priority|\n"); + fclose($fp); + } + } + } + else + { + if ($exten == "NEXTAVAILABLE") + { + $stmt="SELECT conf_exten FROM conferences where server_ip='$server_ip' and ((extension='') or (extension is null)) limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if (strlen($row[0]) > 3) + { + $stmt="UPDATE conferences set extension='$user' where server_ip='$server_ip' and conf_exten='$row[0]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $exten = $row[0]; + } + else + { + $channel_liveX=0; + echo "Non puoi trovare conferenze vuote su $server_ip, Redirect comando non inserito\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "Non puoi trovare conferenze vuote su $server_ip";} + } + } + + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Canale $channel non è attivo su $call_server_ip, Redirect comando non inserito\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel non è attivo su $call_server_ip";} + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Canale $channel non è attivo su $server_ip, Redirect comando non inserito\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel non è attivo su $server_ip";} + } + } + if ( ($channel_liveX==1) && ($channel_liveY==1) ) + { + if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','ExtraChannel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra comando inviato a Canale $channel and \nExtraCanale $extrachannel\n to $exten su $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel and $extrachannel to $exten su $server_ip";} + } + else + { + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$exten"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra comando inviato a Canale $channel su $call_server_ip and \nExtraCanale $extrachannel\n to $exten su $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel/$call_server_ip and $extrachannel/$server_ip to $exten";} + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + + } + + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDX|$filename|$user|$campaign|$DBout|\n"); + fclose($fp); + } + } + + } + } +} + + +if ($ACTION=="Redirect") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Una di queste variabili non è valido:\n"; + echo "Canale $channel deve essere più grande di 2 caratteri\n"; + echo "queryCID $queryCID deve essere più grande di 14 caratteri\n"; + echo "exten $exten deve essere regolato\n"; + echo "ext_context $ext_context deve essere regolato\n"; + echo "ext_priority $ext_priority deve essere regolato\n"; + echo "\nRedirect Action non trasmesso\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Canale $channel non è attivo su $server_ip, Redirect comando non inserito\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "Redirect comando inviato a Canale $channel su $server_ip\n"; + } + } +} + + + +###################### +# ACTION=Monitor or Stop Monitor - insert Monitor/StopMonitor Manager statement to start recording on a channel +###################### +if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) +{ + if ($ACTION=="StopMonitor") + {$SQLfile = "";} + else + {$SQLfile = "File: $filename";} + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Canale $channel non è valido or queryCID $queryCID non è valido or filename: $filename non è valido, $ACTION comando non inserito\n"; + } + else + { + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Canale $channel non è attivo su $server_ip, $ACTION comando non inserito\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','$ACTION','$queryCID','Channel: $channel','$SQLfile','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + if ($ACTION=="Monitor") + { + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + } + echo "$ACTION comando inviato a Canale $channel su $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n"; + } + } +} + + + + + + +###################### +# ACTION=MonitorConf or StopMonitorConf - insert Monitor/StopMonitor Manager statement to start recording on a conference +###################### +if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($channel)<4) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Canale $channel non è valido or exten $exten non è valido or filename: $filename non è valido, $ACTION comando non inserito\n"; + } + else + { + + if ($ACTION=="MonitorConf") + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$filename','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $filename','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + # find and hang up all recordings going su in this conference # and extension = '$exten' + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$channel%\" and channel LIKE \"%,1\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + # $rec_count = intval(mysql_num_rows($rslt) / 2); + $rec_count = mysql_num_rows($rslt); + $h=0; + while ($rec_count>$h) + { + $rowx=mysql_fetch_row($rslt); + $HUchannel[$h] = $rowx[0]; + $h++; + } + $i=0; + while ($h>$i) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$i','Channel: $HUchannel[$i]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $i++; + } + + } + echo "$ACTION comando inviato a Canale $channel su $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n LA REGISTRAZIONE DURERÀ FINO A 60 MINUTI\n"; + } +} + + + + + +###################### +# ACTION=VolumeControl - raise or lower the volume of a meetme participant +###################### +if ($ACTION=="VolumeControl") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($stage)<1) or (strlen($queryCID)<1) ) + { + echo "Conferenza $exten, Stage $stage non è valido or queryCID $queryCID non è valido, Originate comando non inserito\n"; + } + else + { + $participant_number='XXYYXXYYXXYYXX'; + if (eregi('UP',$stage)) {$vol_prefix='4';} + if (eregi('DOWN',$stage)) {$vol_prefix='3';} + if (eregi('UNMUTE',$stage)) {$vol_prefix='2';} + if (eregi('MUTING',$stage)) {$vol_prefix='1';} + $local_DEF = 'Local/'; + $local_AMP = '@'; + $volume_local_channel = "$local_DEF$participant_number$vol_prefix$exten$local_AMP$ext_context"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $volume_local_channel','Context: $ext_context','Exten: 8300','Priority: 1','Callerid: $queryCID','','','','$channel','$exten');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Volume comando inviato a Conferenza $exten, Stage $stage Canale $channel su $server_ip\n"; + } +} + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='debug') {echo "\n";} +if ($format=='debug') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/park_calls_display.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/park_calls_display.php new file mode 100644 index 00000000..5d246559 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/park_calls_display.php @@ -0,0 +1,146 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "Non valido Utentename/Parola d`accesso: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) { + echo "Non valido server_ip: |$server_ip| or Non valido 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 "Non valido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Display Chiamate Parcheggiate"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten non è valido o protocollo $protocol non è valido\n"; + exit; + } + else + { + ##### print parked calls from the parked_channels table + $stmt="SELECT * from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;"; + if ($format=='debug') {echo "\n";} + $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"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/vdc_db_query.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/vdc_db_query.php new file mode 100644 index 00000000..91f09062 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/vdc_db_query.php @@ -0,0 +1,2535 @@ + LICENSE: GPLv2 +# +# 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 - ('regCLOSER','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCALL','manDiaLlogCALL','userLOGout','updateDISPO','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs','CalLBacKLisT','CalLBacKCounT','PauseCodeSubmit','LogiNCamPaigns') +# - $stage - ('start','finish','lookup','new') +# - $closer_choice - ('CL_TESTCAMP_L CL_OUT123_L -') +# - $conf_exten - ('8600011',...) +# - $exten - ('123test',...) +# - $ext_context - ('default','demo',...) +# - $ext_priority - ('1','2',...) +# - $campaign - ('testcamp',...) +# - $dial_timeout - ('60','26',...) +# - $dial_prefix - ('9','8',...) +# - $campaign_cid - ('3125551212','0000000000',...) +# - $MDnextCID - ('M06301413000000002',...) +# - $uniqueid - ('1120232758.2406800',...) +# - $lead_id - ('36524',...) +# - $list_id - ('101','123456',...) +# - $length_in_sec - ('12',...) +# - $phone_code - ('1',...) +# - $phone_number - ('3125551212',...) +# - $channel - ('Zap/12-1',...) +# - $start_epoch - ('1120236911',...) +# - $vendor_lead_code - ('1234test',...) +# - $title - ('Mr.',...) +# - $first_name - ('Bob',...) +# - $middle_initial - ('L',...) +# - $last_name - ('Wilson',...) +# - $address1 - ('1324 Main St.',...) +# - $address2 - ('Apt. 12',...) +# - $address3 - ('co Robert Wilson',...) +# - $city - ('Chicago',...) +# - $state - ('IL',...) +# - $province - ('NA',...) +# - $postal_code - ('60054',...) +# - $country_code - ('USA',...) +# - $gender - ('M',...) +# - $date_of_birth - ('1970-01-01',...) +# - $alt_phone - ('3125551213',...) +# - $email - ('bob@bob.com',...) +# - $security_phrase - ('Hello',...) +# - $comments - ('Good Customer',...) +# - $auto_dial_level - ('0','1','1.2',...) +# - $VDstop_rec_after_each_call - ('0','1') +# - $conf_silent_prefix - ('7','8','',...) +# - $extension - ('123','user123','25-1',...) +# - $protocol - ('Zap','SIP','IAX2',...) +# - $user_abb - ('1234','6666',...) +# - $preview - ('YES','NO',...) +# - $called_count - ('0','1','2',...) +# - $agent_log_id - ('123456',...) +# - $agent_log - ('NO',...) +# - $favorites_list - (",'cc160','cc100'",...) +# - $CallBackDatETimE - ('2006-04-21 14:30:00',...) +# - $recipient - ('ANYONE,'USERONLY') +# - $callback_id - ('12345','12346',...) +# - $use_internal_dnc - ('Y','N') +# - $omit_phone_code - ('Y','N') +# - $no_delete_sessions - ('0','1') + +# CHANGELOG: +# 50629-1044 - First build of script +# 50630-1422 - Added manual dial action and MD channel lookup +# 50701-1451 - Added dial log for start and end of vicidial calls +# 50705-1239 - Added call disposition update +# 50804-1627 - Fixed updateDispo to update vicidial_log entry +# 50816-1605 - Added VDADpause/ready for auto dialing +# 50816-1811 - Added basic autodial call pickup functions +# 50817-1005 - Altered logging functions to accomodate auto_dialing +# 50818-1305 - Added stop-all-recordings-after-each-vicidial-call option +# 50818-1411 - Added hangup of agent phone after Logout +# 50901-1315 - Fixed CLOSER IN-GROUP Web Form bug +# 50902-1507 - Fixed CLOSER log length_in_sec bug +# 50902-1730 - Added functions for manual preview dialing and revert +# 50913-1214 - Added agent random update to leadupdate +# 51020-1421 - Added agent_log_id framework for detailed agent activity logging +# 51021-1717 - Allows for multi-line comments (changes \n to !N in database) +# 51111-1046 - Added vicidial_agent_log lead_id earlier for manual dial +# 51121-1445 - Altered echo statements for several small PHP speed optimizations +# 51122-1328 - Fixed UserLogout issue not removing conference reservation +# 51129-1012 - Added ability to accept calls from other VICIDIAL servers +# 51129-1729 - Changed manual dial to use the '/n' flag for calls +# 51221-1154 - Added SCRIPT id lookup and sending to vicidial.php for display +# 60105-1059 - Added Updating of astguiclient favorites in the DB +# 60208-1617 - Added dtmf buttons output per call +# 60213-1521 - Added closer_campaigns update to vicidial_users +# 60215-1036 - Added Callback date-time entry into vicidial_callbacks table +# 60413-1541 - Added USERONLY Callback listings output - CalLBacKLisT +# - Added USERONLY Callback count output - CalLBacKCounT +# 60414-1140 - Added Callback lead lookup for manual dialing +# 60419-1517 - After CALLBK is sent to agent, update callback record to INACTIVE +# 60421-1419 - Check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60427-1236 - Fixed closer_choice error for CLOSER campaigns +# 60609-1148 - Added ability to check for manual dial numbers in DNC +# 60619-1117 - Added variable filters to close security holes for login form +# 60623-1414 - Fixed variable filter for phone_code and fixed manual dial logic +# 60821-1600 - Added ability to omit the phone code on vicidial lead dialing +# 60821-1647 - Added ability to not delete sessions at logout +# 60906-1124 - Added lookup and sending of callback data for CALLBK calls +# 61128-2229 - Added vicidial_live_agents and vicidial_auto_calls manual dial entries +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70115-1733 - Added alt_dial functionality in auto-dial modes +# 70118-1501 - Added user_group to vicidial_log,_agent_log,_closer_log,_callbacks +# 70123-1357 - Fixed bug that would not update vicidial_closer_log status to dispo +# 70202-1438 - Added pause code submit function +# 70203-0930 - Added dialed_number to lead info output +# 70203-1030 - Added dialed_label to lead info output +# 70206-1126 - Added INBOUND status for inbound/closer calls in vicidial_live_agents +# 70212-1253 - Fixed small issue with CXFER +# 70213-1431 - Added QueueMetrics PAUSE/UNPAUSE/AGENTLOGIN/AGENTLOGOFF actions +# 70214-1231 - Added queuemetrics_log_id field for server_id in queue_log +# 70215-1210 - Added queuemetrics COMPLETEAGENT action +# 70216-1051 - Fixed double call complete queuemetrics logging +# 70222-1616 - Changed queue_log PAUSE/UNPAUSE to PAUSEALL/UNPAUSEALL +# 70309-1034 - Allow amphersands and questions marks in comments to pass through +# 70313-1052 - Allow pound signs(hash) in comments to pass through +# 70319-1544 - Added agent disable update customer data function +# 70322-1545 - Added sipsak display ability +# 70413-1253 - Fixed bug for outbound call time in CLOSER-type blended campaigns +# 70424-1100 - Fixed bug for fronter/closer calls that would delete vdac records +# 70802-1729 - Fixed bugs with pause_sec and wait_sec under certain call handling +# 70828-1443 - Added source_id to output of SCRIPTtab-IFRAME and WEBFORM +# 71029-1855 - removed campaign_id naming restrictions for CLOSER-type campaigns +# 71030-2047 - added hopper priority for auto alt dial entries +# 71116-1011 - added calls_today count updating of the vicidial_live_agents upon INCALL +# 71120-1520 - added LogiNCamPaigns to show only allowed campaigns for agents upon login +# 71125-1751 - Added inbound-group default inbound group sending to vicidial.php +# 71129-2025 - restricted callbacks count and list to campaign only +# + +$version = '2.0.4-65'; +$build = '71129-2025'; + +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["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["closer_choice"])) {$closer_choice=$_GET["closer_choice"];} + elseif (isset($_POST["closer_choice"])) {$closer_choice=$_POST["closer_choice"];} +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["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["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["dial_timeout"])) {$dial_timeout=$_GET["dial_timeout"];} + elseif (isset($_POST["dial_timeout"])) {$dial_timeout=$_POST["dial_timeout"];} +if (isset($_GET["dial_prefix"])) {$dial_prefix=$_GET["dial_prefix"];} + elseif (isset($_POST["dial_prefix"])) {$dial_prefix=$_POST["dial_prefix"];} +if (isset($_GET["campaign_cid"])) {$campaign_cid=$_GET["campaign_cid"];} + elseif (isset($_POST["campaign_cid"])) {$campaign_cid=$_POST["campaign_cid"];} +if (isset($_GET["MDnextCID"])) {$MDnextCID=$_GET["MDnextCID"];} + elseif (isset($_POST["MDnextCID"])) {$MDnextCID=$_POST["MDnextCID"];} +if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} + elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["length_in_sec"])) {$length_in_sec=$_GET["length_in_sec"];} + elseif (isset($_POST["length_in_sec"])) {$length_in_sec=$_POST["length_in_sec"];} +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["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["start_epoch"])) {$start_epoch=$_GET["start_epoch"];} + elseif (isset($_POST["start_epoch"])) {$start_epoch=$_POST["start_epoch"];} +if (isset($_GET["dispo_choice"])) {$dispo_choice=$_GET["dispo_choice"];} + elseif (isset($_POST["dispo_choice"])) {$dispo_choice=$_POST["dispo_choice"];} +if (isset($_GET["vendor_lead_code"])) {$vendor_lead_code=$_GET["vendor_lead_code"];} + elseif (isset($_POST["vendor_lead_code"])) {$vendor_lead_code=$_POST["vendor_lead_code"];} +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["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["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_GET["VDstop_rec_after_each_call"];} + elseif (isset($_POST["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_POST["VDstop_rec_after_each_call"];} +if (isset($_GET["conf_silent_prefix"])) {$conf_silent_prefix=$_GET["conf_silent_prefix"];} + elseif (isset($_POST["conf_silent_prefix"])) {$conf_silent_prefix=$_POST["conf_silent_prefix"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} +if (isset($_GET["user_abb"])) {$user_abb=$_GET["user_abb"];} + elseif (isset($_POST["user_abb"])) {$user_abb=$_POST["user_abb"];} +if (isset($_GET["preview"])) {$preview=$_GET["preview"];} + elseif (isset($_POST["preview"])) {$preview=$_POST["preview"];} +if (isset($_GET["called_count"])) {$called_count=$_GET["called_count"];} + elseif (isset($_POST["called_count"])) {$called_count=$_POST["called_count"];} +if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];} + elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];} +if (isset($_GET["agent_log"])) {$agent_log=$_GET["agent_log"];} + elseif (isset($_POST["agent_log"])) {$agent_log=$_POST["agent_log"];} +if (isset($_GET["favorites_list"])) {$favorites_list=$_GET["favorites_list"];} + elseif (isset($_POST["favorites_list"])) {$favorites_list=$_POST["favorites_list"];} +if (isset($_GET["CallBackDatETimE"])) {$CallBackDatETimE=$_GET["CallBackDatETimE"];} + elseif (isset($_POST["CallBackDatETimE"])) {$CallBackDatETimE=$_POST["CallBackDatETimE"];} +if (isset($_GET["recipient"])) {$recipient=$_GET["recipient"];} + elseif (isset($_POST["recipient"])) {$recipient=$_POST["recipient"];} +if (isset($_GET["callback_id"])) {$callback_id=$_GET["callback_id"];} + elseif (isset($_POST["callback_id"])) {$callback_id=$_POST["callback_id"];} +if (isset($_GET["use_internal_dnc"])) {$use_internal_dnc=$_GET["use_internal_dnc"];} + elseif (isset($_POST["use_internal_dnc"])) {$use_internal_dnc=$_POST["use_internal_dnc"];} +if (isset($_GET["omit_phone_code"])) {$omit_phone_code=$_GET["omit_phone_code"];} + elseif (isset($_POST["omit_phone_code"])) {$omit_phone_code=$_POST["omit_phone_code"];} +if (isset($_GET["phone_ip"])) {$phone_ip=$_GET["phone_ip"];} + elseif (isset($_POST["phone_ip"])) {$phone_ip=$_POST["phone_ip"];} +if (isset($_GET["enable_sipsak_messages"])) {$enable_sipsak_messages=$_GET["enable_sipsak_messages"];} + elseif (isset($_POST["enable_sipsak_messages"])) {$enable_sipsak_messages=$_POST["enable_sipsak_messages"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} + + +$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); + + +# default optional vars if not set +if (!isset($format)) {$format="text";} + if ($format == 'debug') {$DB=1;} +if (!isset($ACTION)) {$ACTION="refresh";} + +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$CIDdate = date("mdHis"); +$ENTRYdate = date("YmdHis"); +if (!isset($query_date)) {$query_date = $NOW_DATE;} +$MT[0]=''; +$agents='@agents'; + +if ($ACTION == 'LogiNCamPaigns') + { + $skip_user_validation=1; + } +else + { + $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 "Non valido Utentename/Parola d`accesso: |$user|$pass|\n"; + exit; + } + else + { + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Non valido server_ip: |$server_ip| or Non valido 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 "Non valido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } +} + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDiaL Script per query su Database"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + +################################################################################ +### LogiNCamPaigns - generates an HTML SELECT list of allowed campaigns for a +### specific agent on the login screen +################################################################################ +if ($ACTION == 'LogiNCamPaigns') +{ + if ( (strlen($user)<1) ) + { + echo "\n"; + exit; + } + else + { + echo "\n"; + exit; + } +} + + + +################################################################################ +### regCLOSER - update the vicidial_live_agents table to reflect the closer +### inbound choices made upon login +################################################################################ +if ($ACTION == 'regCLOSER') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($closer_choice)<1) || (strlen($user)<1) ) + { + $channel_live=0; + echo "Scelta del Gruppo $closer_choice non è valido\n"; + exit; + } + else + { + if ($closer_choice == "MGRLOCK-") + { + $stmt="SELECT closer_campaigns FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $closer_choice =$row[0]; + + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_users set closer_campaigns='$closer_choice' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $in_groups_pre = preg_replace('/-$/','',$closer_choice); + $in_groups = explode(" ",$in_groups_pre); + $in_groups_ct = count($in_groups); + $k=1; + while ($k < $in_groups_ct) + { + if (strlen($in_groups[$k])>1) + { + $stmt="SELECT group_weight,calls_today FROM vicidial_inbound_group_agents where user='$user' and group_id='$in_groups[$k]';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $viga_ct = mysql_num_rows($rslt); + if ($viga_ct > 0) + { + $row=mysql_fetch_row($rslt); + $group_weight = $row[0]; + $calls_today = $row[1]; + } + else + { + $group_weight = 0; + $calls_today = 0; + } + $stmt="INSERT INTO vicidial_live_inbound_agents set user='$user',group_id='$in_groups[$k]',group_weight='$group_weight',calls_today='$calls_today',last_call_time='$NOW_TIME',last_call_finish='$NOW_TIME';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + $k++; + } + + } + echo "Closer In Scelta del Gruppo $closer_choice è stato registrato dall` utente $user\n"; +} + + +################################################################################ +### manDiaLnextCALL - for manual VICIDiaL dialing this will grab the next lead +### in the campaign, reserve it, send data back to client and +### place the call by inserting into vicidial_manager +################################################################################ +if ($ACTION == 'manDiaLnextCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "LISTA DI CHIAMATA VUOTA\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context non è valido\n"; + exit; + } + else + { + + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### check if this is a callback, if it is, skip the grabbing of a new lead and mark the callback as INACTIVE + if ( (strlen($callback_id)>0) and (strlen($lead_id)>0) ) + { + $affected_rows=1; + $CBleadIDset=1; + + $stmt = "UPDATE vicidial_callbacks set status='INACTIVE' where callback_id='$callback_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + if (strlen($phone_number)>3) + { + if ($use_internal_dnc=='Y') + { + $stmt="SELECT count(*) FROM vicidial_dnc where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + echo "DNC NUMERO\n"; + exit; + } + } + if ($stage=='lookup') + { + $stmt="SELECT lead_id FROM vicidial_list where phone_number='$phone_number' order by modify_date desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $man_leadID_ct = mysql_num_rows($rslt); + if ($man_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $affected_rows=1; + $lead_id =$row[0]; + $CBleadIDset=1; + } + else + { + ### insert a new lead in the system with this phone number + $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $lead_id = mysql_insert_id($link); + $CBleadIDset=1; + } + } + else + { + ### insert a new lead in the system with this phone number + $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $lead_id = mysql_insert_id($link); + $CBleadIDset=1; + } + } + else + { + ### grab the next lead in the hopper for this campaign and reserve it for the user + $stmt = "UPDATE vicidial_hopper set status='QUEUE', user='$user' where campaign_id='$campaign' and status='READY' order by hopper_id LIMIT 1"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + } + } + + if ($affected_rows > 0) + { + if (!$CBleadIDset) + { + ##### grab the lead_id of the reserved user in vicidial_hopper + $stmt="SELECT lead_id FROM vicidial_hopper where campaign_id='$campaign' and status='QUEUE' and user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $hopper_leadID_ct = mysql_num_rows($rslt); + if ($hopper_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + } + } + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $source_id = trim("$row[6]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + $called_count++; + + ##### check if system is set to generate logfile for transfers + $stmt="SELECT enable_agc_xfer_log FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enable_agc_xfer_log_ct = mysql_num_rows($rslt); + if ($enable_agc_xfer_log_ct > 0) + { + $row=mysql_fetch_row($rslt); + $enable_agc_xfer_log =$row[0]; + } + + if ( ($WeBRooTWritablE > 0) and ($enable_agc_xfer_log > 0) ) + { + # DATETIME|campaign|lead_id|phone_number|user|type + # 2007-08-22 11:11:11|TESTCAMP|65432|3125551212|1234|M + $fp = fopen ("./xfer_log.txt", "a"); + fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$phone_number|$user|M\n"); + fclose($fp); + } + + ##### if lead is a callback, grab the callback comments + $CBentry_time = ''; + $CBcallback_time = ''; + $CBuser = ''; + $CBcomments = ''; + if (ereg("CALLBK",$dispo)) + { + $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBentry_time = trim("$row[0]"); + $CBcallback_time = trim("$row[1]"); + $CBuser = trim("$row[2]"); + $CBcomments = trim("$row[3]"); + } + } + + ### flag the lead as called and change it's status to INCALL + $stmt = "UPDATE vicidial_list set status='INCALL', called_since_last_reset='Y', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + if (!$CBleadIDset) + { + ### delete the lead from the hopper + $stmt = "DELETE FROM vicidial_hopper where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $stmt="UPDATE vicidial_agent_log set lead_id='$lead_id',comments='MANUAL' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + ### if preview dialing, do not send the call + if ( (strlen($preview)<1) || ($preview == 'NO') ) + { + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### whether to omit phone_code or not + if (eregi('Y',$omit_phone_code)) + {$Ndialstring = "$Local_out_prefix$phone_number";} + else + {$Ndialstring = "$Local_out_prefix$phone_code$phone_number";} + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$server_ip','$campaign','XFER','$lead_id','$MqueryCID','$phone_code','$phone_number','$NOW_TIME','OUT')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',callerid='$MqueryCID',lead_id='$lead_id',comments='MANUAL',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update calls_today count in vicidial_campaign_agents + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $MqueryCID . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + $LeaD_InfO .= $CBentry_time . "\n"; + $LeaD_InfO .= $CBcallback_time . "\n"; + $LeaD_InfO .= $CBuser . "\n"; + $LeaD_InfO .= $CBcomments . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= "MAIN\n"; + $LeaD_InfO .= $source_id . "\n"; + + echo $LeaD_InfO; + + } + else + { + echo "LISTA DI CHIAMATA VUOTA\n"; + } + } +} + + +################################################################################ +### manDiaLskip - for manual VICIDiaL dialing this skips the lead that was +### previewed in the step above and puts it back in orig status +################################################################################ +if ($ACTION == 'manDiaLskip') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($stage)<1) || (strlen($called_count)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "LEAD NOT REVERTED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context non è valido\n"; + exit; + } + else + { + $called_count = ($called_count - 1); + ### flag the lead as called and change it's status to INCALL + $stmt = "UPDATE vicidial_list set status='$stage', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + + echo "LEAD REVERTED\n"; + } +} + + +################################################################################ +### manDiaLonly - for manual VICIDiaL dialing this sends the call that was +### previewed in the step above +################################################################################ +if ($ACTION == 'manDiaLonly') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) || (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo " CHIAMATA NOT PLACED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context non è valido\n"; + exit; + } + else + { + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### whether to omit phone_code or not + if (eregi('Y',$omit_phone_code)) + {$Ndialstring = "$Local_out_prefix$phone_number";} + else + {$Ndialstring = "$Local_out_prefix$phone_code$phone_number";} + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$server_ip','$campaign','XFER','$lead_id','$MqueryCID','$phone_code','$phone_number','$NOW_TIME','OUT')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',callerid='$MqueryCID',lead_id='$lead_id',comments='MANUAL',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + echo "$MqueryCID\n"; + } +} + + +################################################################################ +### manDiaLlookCALL - for manual VICIDiaL dialing this will attempt to look up +### the trunk channel that the call was placed on +################################################################################ +if ($ACTION == 'manDiaLlookCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; +if (strlen($MDnextCID)<18) + { + echo "NO\n"; + echo "MDnextCID $MDnextCID non è valido\n"; + exit; + } +else + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT uniqueid,channel FROM vicidial_manager where callerid='$MDnextCID' and server_ip='$server_ip' and status='UPDATED' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $uniqueid =$row[0]; + $channel =$row[1]; + echo "$uniqueid\n$channel"; + + $wait_sec=0; + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',wait_epoch='$StarTtime',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + echo "NO\n"; + } + } +} + + + +################################################################################ +### manDiaLlogCALL - for manual VICIDiaL logging of calls places record in +### vicidial_log and then sends process to call_log entry +################################################################################ +if ($ACTION == 'manDiaLlogCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + +if ($stage == "start") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) || (strlen($list_id)<1) || (strlen($phone_number)<1) || (strlen($campaign)<1) ) + { + echo "LOG NON INSERITO\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id or list_id: $list_id or phone_number: $phone_number or campaign: $campaign non è valido\n"; + exit; + } + else + { + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + ##### insert log into vicidial_log for manual VICIDiaL call + $stmt="INSERT INTO vicidial_log (uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,comments,processed,user_group) values('$uniqueid','$lead_id','$list_id','$campaign','$NOW_TIME','$StarTtime','INCALL','$phone_code','$phone_number','$user','MANUAL','N','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "VICIDiaL_LOG Inserito: $uniqueid|$channel|$NOW_TIME\n"; + echo "$StarTtime\n"; + } + else + { + echo "LOG NON INSERITO\n"; + } + + $stmt = "UPDATE vicidial_auto_calls SET uniqueid='$uniqueid' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + # ##### insert log into call_log for manual VICIDiaL call + # $stmt = "INSERT INTO call_log (uniqueid,channel,server_ip,extension,number_dialed,caller_code,start_time,start_epoch) values('$uniqueid','$channel','$server_ip','$exten','$phone_code$phone_number','MD $user $lead_id','$NOW_TIME','$StarTtime')"; + # if ($DB) {echo "$stmt\n";} + # $rslt=mysql_query($stmt, $link); + # $affected_rows = mysql_affected_rows($link); + + # if ($affected_rows > 0) + # { + # echo "CALL_LOG Inserito: $uniqueid|$channel|$NOW_TIME"; + # } + # else + # { + # echo "LOG NON INSERITO\n"; + # } + } + } + +if ($stage == "end") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) ) + { + echo "LOG NON INSERITO\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id non è valido\n"; + exit; + } + else + { + if ($start_epoch < 1000) + { + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + ##### look for the start epoch in the vicidial_closer_log table + $stmt="SELECT start_epoch FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user' order by closecallid desc limit 1;"; + } + else + { + ##### look for the start epoch in the vicidial_log table + $stmt="SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + } + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch =$row[0]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($length_in_sec < 1) and ($row[0] > 0) ) + { + ##### start epoch in the vicidial_log table, couldn't find one in vicidial_closer_log + $stmt="SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch =$row[0]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + } + } + else {$length_in_sec = ($StarTtime - $start_epoch);} + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec',status='DONE' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + ############################################# + ##### INIZIO QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + + if ($auto_dial_level > 0) + { + ### check to see if campaign has alt_dial enabled + $stmt="SELECT auto_alt_dial FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_alt_dial =$row[0]; + } + else {$auto_alt_dial = 'NONE';} + if (eregi("(ALT_ONLY|ADDR3_ONLY|ALT_AND_ADDR3)",$auto_alt_dial)) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT alt_dial FROM vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alt_dial =$row[0]; + } + else {$alt_dial = 'NONE';} + + if ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("(ALT_ONLY|ALT_AND_ADDR3)",$auto_alt_dial)) ) + { + $stmt="SELECT alt_phone,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alt_phone = $row[0]; + $alt_phone = eregi_replace("[^0-9]","",$alt_phone); + $gmt_offset_now = $row[1]; + $state = $row[2]; + } + else {$alt_phone = '';} + if (strlen($alt_phone)>5) + { + ### insert record into vicidial_hopper for alt_phone call attempt + $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ALT',user='',priority='25';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + } + if ( ( (eregi("(ALT)",$alt_dial)) and (eregi("ALT_AND_ADDR3",$auto_alt_dial)) ) or ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("ADDR3_ONLY",$auto_alt_dial)) ) ) + { + $stmt="SELECT address3,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $address3 = $row[0]; + $address3 = eregi_replace("[^0-9]","",$address3); + $gmt_offset_now = $row[1]; + $state = $row[2]; + } + else {$address3 = '';} + if (strlen($address3)>5) + { + ### insert record into vicidial_hopper for address3 call attempt + $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ADDR3',user='',priority='20';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + + if ($enable_queuemetrics_logging > 0) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_qm_ct = mysql_num_rows($rslt); + if ($VAC_qm_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_call_id = $row[0]; + $CLlead_id = $row[1]; + $CLphone_number = $row[2]; + $CLstatus = $row[3]; + $CLcampaign_id = $row[4]; + $CLphone_code = $row[5]; + $CLalt_dial = $row[6]; + $CLstage = $row[7]; + $CLcallerid = $row[8]; + $CLuniqueid = $row[9]; + } + + $CLstage = preg_replace("/.*-/",'',$CLstage); + if (strlen($CLstage) < 1) {$CLstage=0;} + + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt="SELECT count(*) from queue_log where call_id='$MDnextCID' and verb='COMPLETECALLER';"; + $rslt=mysql_query($stmt, $linkB); + if ($DB) {echo "$stmt\n";} + $VAC_cc_ct = mysql_num_rows($rslt); + if ($VAC_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $caller_complete = $row[0]; + } + + if ($caller_complete < 1) + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + } + mysql_close($linkB); + } + + ### delete call record from vicidial_auto_calls + $stmt = "DELETE from vicidial_auto_calls where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + + + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',lead_id='',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSAALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } + else + { + if ($enable_queuemetrics_logging > 0) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_qm_ct = mysql_num_rows($rslt); + if ($VAC_qm_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_call_id = $row[0]; + $CLlead_id = $row[1]; + $CLphone_number = $row[2]; + $CLstatus = $row[3]; + $CLcampaign_id = $row[4]; + $CLphone_code = $row[5]; + $CLalt_dial = $row[6]; + $CLstage = $row[7]; + $CLcallerid = $row[8]; + $CLuniqueid = $row[9]; + } + + $CLstage = preg_replace("/XFER|-/",'',$CLstage); + if ($CLstage < 0.25) {$CLstage=0;} + + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + + $stmt = "DELETE from vicidial_auto_calls lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',lead_id='',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSAALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } + + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' where uniqueid='$uniqueid' and lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "$uniqueid\n$channel\n"; + } + else + { + echo "LOG NON INSERITO\n\n"; + } + } + + echo $VDstop_rec_after_each_call . '|' . $extension . '|' . $conf_silent_prefix . '|' . $conf_exten . '|' . $user_abb . "|\n"; + + ##### if VICIDiaL call and hangup_after_each_call activated, find all recording + ##### channels and hang them up while entering info into recording_log and + ##### returning filename/recordingID + if ($VDstop_rec_after_each_call == 1) + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $total_rec=0; + $loop_count=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten' order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$rec_list = mysql_num_rows($rslt);} + while ($rec_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + if (preg_match("/Local\/$conf_silent_prefix$conf_exten\@/i",$row[0])) + { + $rec_channels[$total_rec] = "$row[0]"; + $total_rec++; + } + if ($format=='debug') {echo "\n";} + $loop_count++; + } + + $total_recFN=0; + $loop_count=0; + $filename=$MT; # not necessary : and cmd_line_f LIKE \"%_$user_abb\" + $stmt="SELECT cmd_line_f FROM vicidial_manager where server_ip='$server_ip' and action='Originate' and cmd_line_b = 'Channel: $local_DEF$conf_silent_prefix$conf_exten$local_AMP$ext_context' order by entry_date desc limit $total_rec;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$recFN_list = mysql_num_rows($rslt);} + while ($recFN_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + $filename[$total_recFN] = preg_replace("/Callerid: /i","",$row[0]); + if ($format=='debug') {echo "\n";} + $total_recFN++; + $loop_count++; + } + + $loop_count=0; + while($loop_count < $total_rec) + { + if (strlen($rec_channels[$loop_count])>5) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$loop_count','Channel: $rec_channels[$loop_count]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "REC_STOP|$rec_channels[$loop_count]|$filename[$loop_count]|"; + if (strlen($filename)>2) + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename[$loop_count]'"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$fn_count = mysql_num_rows($rslt);} + if ($fn_count) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt="UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename[$loop_count]' and end_epoch is NULL;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "$recording_id|$length_in_min|"; + } + else {echo "||";} + } + else {echo "||";} + echo "\n"; + } + $loop_count++; + } + } + + + $talk_sec=0; + $StarTtime = date("U"); + $stmt = "select talk_epoch,talk_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $talk_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set talk_sec='$talk_sec',talk_epoch='$StarTtime',dispo_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } +} + + +################################################################################ +### VDADREcheckINCOMING - for auto-dial VICIDiaL dialing this will recheck for +### calls to see if the channel has updated +################################################################################ +if ($ACTION == 'VDADREcheckINCOMING') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "Campagna $campaign non è valido\n"; + echo "lead_id $lead_id non è valido\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + } + } +} + + +################################################################################ +### VDADcheckINCOMING - for auto-dial VICIDiaL dialing this will check for calls +### in the vicidial_live_agents table in QUEUE status, then +### lookup the lead info and pass it back to vicidial.php +################################################################################ +if ($ACTION == 'VDADcheckINCOMING') +{ + $Ctype = 'A'; + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "Campagna $campaign non è valido\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and status='QUEUE';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',comments='AUTO',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $source_id = trim("$row[6]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + ##### if lead is a callback, grab the callback comments + $CBentry_time = ''; + $CBcallback_time = ''; + $CBuser = ''; + $CBcomments = ''; + if (ereg("CALLBK",$dispo)) + { + $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBentry_time = trim("$row[0]"); + $CBcallback_time = trim("$row[1]"); + $CBuser = trim("$row[2]"); + $CBcomments = trim("$row[3]"); + } + } + + ### update the lead status to INCALL + $stmt = "UPDATE vicidial_list set status='INCALL', user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the log status to INCALL + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + $stmt = "UPDATE vicidial_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL', user_group='$user_group' where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + ### update the vicidial_closer_log user to INCALL + $stmt = "UPDATE vicidial_closer_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL', user_group='$user_group' where lead_id='$lead_id' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select campaign_id,phone_number,alt_dial from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($VDAC_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDADchannel_group =$row[0]; + $dialed_number =$row[1]; + $dialed_label =$row[2]; + } + else + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|INBND|$callerid|$user|$user_group|$list_id|$lead_id|$phone_number|$uniqueid|\n"); + fclose($fp); + } + } + + $stmt = "select count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDL_cid_ct = mysql_num_rows($rslt); + if ($VDL_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_front_VDlog =$row[0]; + } + + $stmt = "select * from vicidial_inbound_groups where group_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_group_name = $row[1]; + $VDCL_group_color = $row[2]; + $VDCL_group_web = $row[4]; + $VDCL_fronter_display = $row[7]; + $VDCL_ingroup_script = $row[8]; + $VDCL_get_call_launch = $row[9]; + $VDCL_xferconf_a_dtmf = $row[10]; + $VDCL_xferconf_a_number = $row[11]; + $VDCL_xferconf_b_dtmf = $row[12]; + $VDCL_xferconf_b_number = $row[13]; + $VDCL_default_xfer_group= $row[28]; + + ### update the comments in vicidial_live_agents record + $stmt = "UPDATE vicidial_live_agents set comments='INBOUND' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $Ctype = 'I'; + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_ingroup_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + } + + ### if web form is set then send su to vicidial.php for override of WEB_FORM address + if ( (strlen($VDCL_group_web)>5) or (strlen($VDCL_group_name)>0) ) {echo "$VDCL_group_web|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|\n";} + else {echo "|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|\n";} + + $stmt = "SELECT full_name from vicidial_users where user='$tsr';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDU_cid_ct = mysql_num_rows($rslt); + if ($VDU_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $fronter_full_name = $row[0]; + echo $fronter_full_name . '|' . $tsr . "\n"; + } + else {echo '|' . $tsr . "\n";} + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_campaign_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + echo "|||||$VDCL_campaign_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n|\n"; + + $stmt = "select phone_number,alt_dial from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($VDAC_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dialed_number =$row[0]; + $dialed_label =$row[1]; + } + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $callerid . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + $LeaD_InfO .= $CBentry_time . "\n"; + $LeaD_InfO .= $CBcallback_time . "\n"; + $LeaD_InfO .= $CBuser . "\n"; + $LeaD_InfO .= $CBcomments . "\n"; + $LeaD_InfO .= $dialed_number . "\n"; + $LeaD_InfO .= $dialed_label . "\n"; + $LeaD_InfO .= $source_id . "\n"; + + echo $LeaD_InfO; + + + + $wait_sec=0; + $StarTtime = date("U"); + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + ### If CHIAMATABK, change vicidial_callback record to INACTIVE + if (eregi("CALLBK|CBHOLD", $dispo)) + { + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='$lead_id' and status NOT IN('INACTIVE','DEAD','ARCHIVE');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + ##### check if system is set to generate logfile for transfers + $stmt="SELECT enable_agc_xfer_log FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enable_agc_xfer_log_ct = mysql_num_rows($rslt); + if ($enable_agc_xfer_log_ct > 0) + { + $row=mysql_fetch_row($rslt); + $enable_agc_xfer_log =$row[0]; + } + + if ( ($WeBRooTWritablE > 0) and ($enable_agc_xfer_log > 0) ) + { + # DATETIME|campaign|lead_id|phone_number|user|type + # 2007-08-22 11:11:11|TESTCAMP|65432|3125551212|1234|A + $fp = fopen ("./xfer_log.txt", "a"); + fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$phone_number|$user|$Ctype\n"); + fclose($fp); + } + + } + else + { + echo "0\n"; + # echo "No calls in QUEUE for $user su $server_ip\n"; + exit; + } + } +} + + +################################################################################ +### userLOGout - Logs the user out of VICIDiaL client, deleting db records and +### inserting into vicidial_user_log +################################################################################ +if ($ACTION == 'userLOGout') +{ + $MT[0]=''; + $row=''; $rowx=''; +if ( (strlen($campaign)<1) || (strlen($conf_exten)<1) ) + { + echo "NO\n"; + echo "campaign $campaign or conf_exten $conf_exten non è valido\n"; + exit; + } +else + { + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + ##### Insert a LOGOUT record into the user log + $stmt="INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$user','LOGOUT','$campaign','$NOW_TIME','$StarTtime','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vul_insert = mysql_affected_rows($link); + + if ($no_delete_sessions < 1) + { + ##### Remove the reservation su the vicidial_conferences meetme room + $stmt="UPDATE vicidial_conferences set extension='' where server_ip='$server_ip' and conf_exten='$conf_exten';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vc_remove = mysql_affected_rows($link); + } + + ##### Delete the vicidial_live_agents record for this session + $stmt="DELETE from vicidial_live_agents where server_ip='$server_ip' and user ='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vla_delete = mysql_affected_rows($link); + + ##### Delete the vicidial_live_inbound_agents records for this session + $stmt="DELETE from vicidial_live_inbound_agents where user ='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vlia_delete = mysql_affected_rows($link); + + ##### Delete the web_client_sessions + $stmt="DELETE from web_client_sessions where server_ip='$server_ip' and session_name ='$session_name';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $wcs_delete = mysql_affected_rows($link); + + ##### Hangup the client phone + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$extension%\" order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) + { + $row=mysql_fetch_row($rslt); + $agent_channel = "$row[0]"; + if ($format=='debug') {echo "\n";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','ULGH3459$StarTtime','Channel: $agent_channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $pause_sec=0; + $stmt = "select pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ( ($VDpr_ct > 0) and (strlen($row[3]<5)) and (strlen($row[4]<5)) ) + { + $row=mysql_fetch_row($rslt); + $pause_sec = (($StarTtime - $row[0]) + $row[1]); + + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + if ($vla_delete > 0) + { + ############################################# + ##### INIZIO QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $allow_sipsak_messages = $row[6]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_message = 'LOGGED OUT'; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_message\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + } + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + # $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='PAUSA',serverid='1';"; + # if ($DB) {echo "$stmt\n";} + # if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + # $rslt=mysql_query($stmt, $linkB); + # $affected_rows = mysql_affected_rows($linkB); + + $stmt = "SELECT time_id FROM queue_log where agent='Agent/$user' and verb='AGENTLOGIN' order by time_id desc limit 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + if ($DB) {echo "$stmt\n";} + echo "$stmt\n"; + $li_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $li_conf_ct) + { + $row=mysql_fetch_row($rslt); + $logintime = $row[0]; + $i++; + } + + $time_logged_in = ($StarTtime - $logintime); + if ($time_logged_in > 1000000) {$time_logged_in=1;} + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='AGENTLOGOFF',data1='$user$agents',data2='$time_logged_in',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + + echo "$vul_insert|$vc_remove|$vla_delete|$wcs_delete|$agent_channel|$vlia_delete\n"; + } +} + + +################################################################################ +### updateDISPO - update the vicidial_list table to reflect the agent choice of +### call disposition for that leand +################################################################################ +if ($ACTION == 'updateDISPO') +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($dispo_choice)<1) || (strlen($lead_id)<1) ) + { + echo "Dispo Choice $dispo or lead_id $lead_id non è valido\n"; + exit; + } + else + { + $stmt="UPDATE vicidial_list set status='$dispo_choice', user='$user' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by uniqueid desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + if ( ($use_internal_dnc=='Y') and ($dispo_choice=='DNC') ) + { + $stmt = "select phone_number from vicidial_list where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $stmt="INSERT INTO vicidial_dnc (phone_number) values('$row[0]');"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + } + } + + $dispo_sec=0; + $StarTtime = date("U"); + $stmt = "select dispo_epoch,dispo_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dispo_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set dispo_sec='$dispo_sec',dispo_epoch='$StarTtime',status='$dispo_choice' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id($link); + + ### CHIAMATABACK ENTRY + if ( ($dispo_choice == 'CBHOLD') and (strlen($CallBackDatETimE)>10) ) + { + $stmt="INSERT INTO vicidial_callbacks (lead_id,list_id,campaign_id,status,entry_time,callback_time,user,recipient,comments,user_group) values('$lead_id','$list_id','$campaign','ACTIVE','$NOW_TIME','$CallBackDatETimE','$user','$recipient','$comments','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $stmt="SELECT auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ( ($auto_dial_level > 0) and (ereg(" $dispo_choice ",$row[0])) ) + { + $stmt = "select count(*) from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + $stmt="UPDATE vicidial_hopper set status='READY' where lead_id='$lead_id' and status='HOLD' limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + else + { + $stmt="DELETE from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + ############################################# + ##### INIZIO QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='CALLSTATUS',data1='$dispo_choice',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + + echo 'Lead ' . $lead_id . ' è stato cambiato ' . $dispo_choice . " Status\nNext agent_log_id:\n" . $agent_log_id . "\n"; +} + +################################################################################ +### updateLEAD - update the vicidial_list table to reflect the values that are +### in the agents screen at time of call hangup +################################################################################ +if ($ACTION == 'updateLEAD') +{ + $MT[0]=''; + $row=''; $rowx=''; + $DO_NOT_UPDATE=0; + $DO_NOT_UPDATE_text=''; + if ( (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + echo "phone_number $phone_number or lead_id $lead_id non è valido\n"; + exit; + } + else + { + + $stmt = "SELECT disable_alter_custdata FROM vicidial_campaigns where campaign_id='$campaign'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $dac_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $dac_conf_ct) + { + $row=mysql_fetch_row($rslt); + $disable_alter_custdata = $row[0]; + $i++; + } + if (ereg('Y',$disable_alter_custdata)) + { + $DO_NOT_UPDATE=1; + $DO_NOT_UPDATE_text=' NOT'; + $stmt = "SELECT alter_custdata_override FROM vicidial_users where user='$user'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $aco_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $aco_conf_ct) + { + $row=mysql_fetch_row($rslt); + $alter_custdata_override = $row[0]; + $i++; + } + if (ereg('ALLOW_ALTER',$alter_custdata_override)) + { + $DO_NOT_UPDATE=0; + $DO_NOT_UPDATE_text=''; + } + } + + if ($DO_NOT_UPDATE < 1) + { + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + $comments = eregi_replace("--AMP--",'&',$comments); + $comments = eregi_replace("--QUES--",'?',$comments); + $comments = eregi_replace("--POUND--",'#',$comments); + + $stmt="UPDATE vicidial_list set vendor_lead_code='" . mysql_real_escape_string($vendor_lead_code) . "', title='" . mysql_real_escape_string($title) . "', first_name='" . mysql_real_escape_string($first_name) . "', middle_initial='" . mysql_real_escape_string($middle_initial) . "', last_name='" . mysql_real_escape_string($last_name) . "', address1='" . mysql_real_escape_string($address1) . "', address2='" . mysql_real_escape_string($address2) . "', address3='" . mysql_real_escape_string($address3) . "', city='" . mysql_real_escape_string($city) . "', state='" . mysql_real_escape_string($state) . "', province='" . mysql_real_escape_string($province) . "', postal_code='" . mysql_real_escape_string($postal_code) . "', country_code='" . mysql_real_escape_string($country_code) . "', gender='" . mysql_real_escape_string($gender) . "', date_of_birth='" . mysql_real_escape_string($date_of_birth) . "', alt_phone='" . mysql_real_escape_string($alt_phone) . "', email='" . mysql_real_escape_string($email) . "', security_phrase='" . mysql_real_escape_string($security_phrase) . "', comments='" . mysql_real_escape_string($comments) . "' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } + echo "Lead $lead_id information has$DO_NOT_UPDATE_text been updated\n"; +} + + +################################################################################ +### VDADpause - update the vicidial_live_agents table to show that the agent is +### or ready now active and ready to take calls +################################################################################ +if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($stage)<2) || (strlen($server_ip)<1) ) + { + echo "stage $stage non è valido\n"; + exit; + } + else + { + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set lead_id='',uniqueid=0,callerid='',channel='', random_id='$random',comments='' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_live_agents set status='$stage' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + ############################################# + ##### INIZIO QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + if (ereg('READY',$stage)) {$QMstatus='UNPAUSEALL';} + if (ereg('PAUSA',$stage)) {$QMstatus='PAUSAALL';} + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='$QMstatus',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + + if ($agent_log == 'NO') + {$donothing=1;} + else + { + $pause_sec=0; + $stmt = "select pause_epoch,pause_sec,wait_epoch,wait_sec,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec=0; + if ($row[2] > 0) + { + $wait_sec = (($StarTtime - $row[2]) + $row[3]); + } + if ( (eregi("NULL",$row[4])) or ($row[4] < 1000) ) + {$pause_sec = (($StarTtime - $row[0]) + $row[1]);} + else + {$pause_sec = (($row[4] - $row[0]) + $row[1]);} + + } + if ($ACTION == 'VDADready') + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($ACTION == 'VDADpause') + { + $stmt="UPDATE vicidial_agent_log set pause_epoch='$StarTtime',wait_sec='$wait_sec' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + echo 'Agent ' . $user . ' è ora nello Status ' . $stage . "\n"; +} + + +################################################################################ +### UpdatEFavoritEs - update the astguiclient favorites list for this extension +################################################################################ +if ($ACTION == 'UpdatEFavoritEs') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($favorites_list)<1) || (strlen($user)<1) || (strlen($exten)<1) ) + { + echo "favorites list $favorites_list non è valido\n"; + exit; + } + else + { + $stmt = "select count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + $stmt="UPDATE phone_favorites set extensions_list=\"$favorites_list\" where extension='$exten' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="INSERT INTO phone_favorites values('$exten','$server_ip',\"$favorites_list\");"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + echo "Favorites list has been updated to $favorites_list for $exten\n"; +} + + +################################################################################ +### PauseCodeSubmit - Update vicidial_agent_log with pause code +################################################################################ +if ($ACTION == 'PausaCodeSubmit') +{ + $row=''; $rowx=''; + if ( (strlen($status)<1) || (strlen($agent_log_id)<1) ) + { + echo "agent_log_id $agent_log_id or pause_code $status non è valido\n"; + exit; + } + else + { + $stmt="UPDATE vicidial_agent_log set sub_status=\"$status\" where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + ############################################# + ##### INIZIO QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $allow_sipsak_messages = $row[6]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_prefix = 'BK-'; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$status\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + } + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='PAUSAREASON',serverid='$queuemetrics_log_id',data1='$status';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } +echo "Pausa Code has been updated to $status for $agent_log_id\n"; +} + + +################################################################################ +### CalLBacKLisT - List the USERONLY callbacks for an agent +################################################################################ +if ($ACTION == 'CalLBacKLisT') +{ +$stmt = "select callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' and campaign_id='$campaign' and status NOT IN('INACTIVE','DEAD') order by callback_time;"; +if ($DB) {echo "$stmt\n";} +$rslt=mysql_query($stmt, $link); +if ($rslt) {$callbacks_count = mysql_num_rows($rslt);} +echo "$callbacks_count\n"; +$loop_count=0; + while ($callbacks_count>$loop_count) + { + $row=mysql_fetch_row($rslt); + $callback_id[$loop_count] = $row[0]; + $lead_id[$loop_count] = $row[1]; + $campaign_id[$loop_count] = $row[2]; + $status[$loop_count] = $row[3]; + $entry_time[$loop_count] = $row[4]; + $callback_time[$loop_count] = $row[5]; + $comments[$loop_count] = $row[6]; + $loop_count++; + } +$loop_count=0; + while ($callbacks_count>$loop_count) + { + $stmt = "select first_name,last_name,phone_number from vicidial_list where lead_id='$lead_id[$loop_count]';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count]\n"; + $loop_count++; + } + +} + + +################################################################################ +### CalLBacKCounT - send the count of the USERONLY callbacks for an agent +################################################################################ +if ($ACTION == 'CalLBacKCounT') +{ +$stmt = "select count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' and campaign_id='$campaign' and status NOT IN('INACTIVE','DEAD');"; +if ($DB) {echo "$stmt\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$cbcount=$row[0]; + +echo "$cbcount"; +} + + + + +if ($format=='debug') +{ +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +echo "\n"; +echo "\n\n\n"; +} + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/vicidial.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/vicidial.php new file mode 100644 index 00000000..beba7617 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/vicidial.php @@ -0,0 +1,6797 @@ + LICENSE: GPLv2 +# +# make sure you have added a user to the vicidial_users MySQL table with at least +# user_level 1 or greater to access this page. Also, you need to have the login +# and pass of a phone listed in the asterisk.phones table. The page grabs the +# server info and other details from this login and pass. +# +# This script works best with Firefox or Mozilla, but will run for a couple +# hours on Internet Explorer before the memory leaks cause a crash. +# +# Other scripts that this application depends on: +# - vdc_db_query.php: Updates information in the database +# - manager_send.php: Sends manager actions to the DB for execution +# +# CHANGELOG +# 50607-1426 - First Build of VICIDIAL web client basic login process finished +# 50628-1620 - Added some basic formatting and worked on process flow +# 50628-1715 - Startup variables mapped to javascript variables +# 50629-1303 - Added Login Closer in-groups selection box and vla update +# 50629-1530 - Rough layout for customer info form section and button links +# 50630-1453 - Rough Manual Dial/Hangup with customer info displayed +# 50701-1450 - Added vicidial_log entries on dial and hangup +# 50701-1634 - Added Logout function +# 50705-1259 - Added call disposition functionality +# 50705-1432 - Added lead info DB update function +# 50705-1658 - Added web form functionality +# 50706-1043 - Added call park and pickup functions +# 50706-1234 - Added Start/Stop Recording functionality +# 50706-1614 - Added conference channels display option +# 50711-1333 - Removed call check redundancy and fixed a span bug +# 50727-1424 - Added customer channel and participant present sensing/alerts +# 50804-1057 - Added SendDTMF function and reconfigured the transfer span +# 50804-1224 - Added Local and Internal Closer transfer functions +# 50804-1628 - Added Blind transfer, activated LIVE CALL image and fixed bugs +# 50804-1808 - Added button images for left buttons +# 50815-1151 - Added 3Way calling functions to Transfer-conf frame +# 50815-1602 - Added images and buttons for xfer functions +# 50816-1813 - Added basic autodial outbound call pickup functions +# 50817-1113 - Fixes to auto_dialing call receipt +# 50817-1234 - Added inbound call receipt capability +# 50817-1541 - Added customer time display +# 50817-1541 - Added customer time display +# 50818-1327 - Added stop-all-recordings-after-each-vicidial-call option +# 50818-1703 - Added pretty login section +# 50825-1200 - Modified form field lengths, added double-click dispositions +# 50831-1603 - Fixed customer time bug and fronter display bug for CLOSER +# 50901-1314 - Fixed CLOSER IN-GROUP Web Form bug +# 50903-0904 - Added preview-lead code for manual dialing +# 50904-0016 - Added ability to hangup manual dials before pickup +# 50906-1319 - Added override for filters on xfer calls, fixed login display bug +# 50909-1243 - Added hotkeys functionality for quick dispoing in auto-dial mode +# 50912-0958 - Modified hotkeys function, agent must have user_level >= 5 to use +# 50913-1212 - Added campaign_cid to 3rd party calls +# 50923-1546 - Modified to work with language translation +# 50926-1656 - Added campaign pull-down at login of active campaigns +# 50928-1633 - Added manual dial alternate number dial option +# 50930-1538 - Added session_id empty login failure and fixed 2 minor bugs +# 51004-1656 - Fixed recording filename bug and new Spanish translation +# 51020-1103 - Added campaign-specific recording control abilities +# 51020-1352 - Added Basic vicidial_agent_log framework +# 51021-1050 - Fixed custtime display and disable Enter/Return keypresses +# 51021-1718 - Allows for multi-line comments (changes \n to !N in database) +# 51110-1432 - Fixed non-standard http port issue +# 51111-1047 - Added vicidial_agent_log lead_id earlier for manual dial +# 51118-1305 - Activate multi-line comments from $multi_line_comments var +# 51118-1313 - Move Transfer DIV to a floating span to preserve 800x600 view +# 51121-1506 - Small PHP optimizations in many scripts and disabled globalize +# 51129-1010 - Added ability to accept calls from other VICIDIAL servers +# 51129-1254 - Fixed Hangups of other agents channels when customer hangs up +# 51208-1732 - Created user-first login that looks for default phone info +# 51219-1526 - Added variable framework for campaign and in-group scripts +# 51221-1200 - Added SCRIPT tab, layout and functionality +# 51221-1714 - Added auto-switch-to-SCRIPT-tab and auto-webform-popup +# 51222-1605 - Added VMail message blind transfer button to xfer-conf frame +# 51229-1028 - Added checks on web_form_address to allow for var in the DB value +# 60117-1312 - Added Transfer-conf frame toggle on button press +# 60208-1152 - Added DTMF-xfernumber preset links to xfer-conf frame +# 60213-1129 - Added vicidial_users.hotkeys_active for any user hotkeys +# 60213-1210 - Added ability to sort routing of calls by user_level +# 60214-0932 - Initial Callback calendar display framework +# 60214-1407 - Added ability to minimize the dispo screen to see info below +# 60215-1104 - Added ANYONE scheduled callbacks functionality +# 60410-1116 - Added persistant pause after dispo option and change dispo text +# - Added web form submit that opens new window with dispo on submit +# - Added PREVIOUS CALLBACK in customer info to flag callbacks +# - Added link to try to hangup the call again in the dispo screen +# - Added link noone-in-session screen to call agent phone again +# - Added link customer-hungup screen to go straight to dispo screen +# 60410-1532 - Added agent status and campaign calls dialing display option +# 60411-1547 - Add ability to set callback as USERONLY and some basic formatting +# 60413-1752 - Add basic USERONLY callback frame and listings +# 60414-1039 - Changed manual dial preview and alt dial checkboxes to spans +# - Added beta-level USERONLY callback functionality +# - Added beta-level manual dialing with lead insertion functionality +# 60415-1534 - Fixed manual dial lead preview and fixed manuald dial override bug +# 60417-1108 - Added capability to do alt-number-dialing in auto-dial mode +# - Changed several permissions to database-defined +# 60419-1529 - Prevent manual dial or callbacks when alt-dial lead not finished +# 60420-1647 - Fixed DiaLDiaLAltPhonE error, Call Agent Again DialControl error +# 60421-1229 - Check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60424-1005 - Fixed Alt phone disabled bug for callbacks and manual dials +# 60426-1058 - Added vicidial_user setting for default blended check for CLOSER +# 60501-1008 - Added option to manual dial screen to manually lookup phone number +# 60503-1653 - Fixed agentonly_callback not-defined bug in scheduled callbacks screen +# 60504-1032 - Fixed manual dial display bug and transfer dispo alert bug +# - Fixed recording filename display to not overrun 25 characters +# 60510-1051 - Added Wrapup timer and wrapup message on wrapup screen after dispo +# 60608-1453 - Added CLOSER campaign allowable in-groups limitations +# 60609-1123 - Added add-number-to-DNC-list function and manual dial check DNC +# 60619-1047 - Added variable filters to close security holes for login form +# 60804-1710 - fixed scheduled CALLBK for other languages build +# 60808-1145 - Added consultative transfers with customer data +# 60808-2232 - Added campaign name to pulldown for login screen +# 60809-1603 - Added option to locally transfer consult xfers +# 60809-1732 - Added recheck of transferred channels before customer gone mesg +# 60810-1011 - Fixed CXFER leave 3way call bugs +# 60816-1602 - Added ALLCALLS recording delay option allcalls_delay +# 60816-1716 - Fixed customer time display bug and client DST setting +# 60821-1555 - Added option to omit phone_code on dialout of leads +# 60821-1628 - Added ALLFORCE recording option +# 60821-1643 - Added no_delete_sessions option to not delete sessions +# 60822-0512 - Changed phone number fields to be maxlength of 12 +# 60829-1531 - Made compatible with WeBRooTWritablE setting in dbconnect.php +# 60906-1152 - Added Previous CallBack info display span +# 60906-1715 - Allow for Local phone extension conferences +# 61004-1729 - Add ability to control volume per channel in "calls in this session" +# 61122-1341 - Added vicidial_user_groups allowed_campaigns restrictions +# 61122-1523 - Added more SCRIPT variables +# 61128-2229 - Added vicidial_live_agents and vicidial_auto_calls manual dial entries +# 61130-1617 - Added lead_id to MonitorConf for recording_log +# 61221-1212 - Changed width to 760 to better fit 800x600 screens, widened SCRIPT +# 70109-1128 - Fixed wrapup timer bug +# 70109-1635 - Added option for HotKeys automatically dialing next number in manual mode +# - Added option for alternate number dialing with hotkeys +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70118-1517 - Added vicidial_agent_log and vicidial_user_log logging of user_group +# 70201-1249 - Added FAST DIAL option for manually dialing, added UTF8 compatible code +# 70201-1703 - Fixed cursor bug for most text input fields +# 70202-1453 - Added first portions of Agent Pause Codes +# 70203-0108 - Finished Agent Pause Codes functionality +# 70203-0930 - Added dialed_number to webform output +# 70203-1010 - Added dialed_label to webform output +# 70206-1201 - Fixed allow_closers bug +# 70206-1332 - Added vicidial_recording_override users setting function +# 70212-1252 - Fixed small issue with CXFER +# 70213-1018 - Changed CXFER and AXFER to update customer information before transfer +# 70214-1233 - Added queuemetrics_log_id field for server_id in queue_log +# 70215-1240 - Added queuemetrics_log_id field for server_id in queue_log +# 70222-1617 - Changed queue_log PAUSE/UNPAUSE to PAUSEALL/UNPAUSEALL +# 70226-1252 - Added Mute/UnMute to agent screen +# 70309-1035 - Allow amphersands and questions marks in comments to pass through +# 70313-1052 - Allow pound signs(hash) in comments to pass through +# 70316-1406 - Moved the MUTE button to be accessible during a transfer/conf +# 70319-1446 - Added agent-deactive-display and disable customer info update functions +# 70319-1626 - Added option to allow agent logins to campaigns with no leads in the hopper +# 70320-1501 - Added option to allow retry of leave-3way-call from dispo screen +# 70322-1545 - Added sipsak display ability +# 70510-1319 - Added onUnload force Logout +# 70806-1530 - Added Presets Dial links above agent mute button +# 70823-2118 - Fixed XMLHTTPRequest, HotKeys and Scheduled Callbacks issues with MSIE +# 70828-1443 - Added source_id to output of SCRIPTtab-IFRAME and WEBFORM +# 71022-1427 - Added formatting of the customer phone number in the main status bar +# 71029-1848 - Changed CLOSER-type campaign to not use campaign_id restrictions +# 71101-1204 - Fixed bug in callback calendar with DST +# 71116-0957 - Added campaign_weight and calls_today to the vla table insertion +# 71120-1719 - Added XMLHTPRequest lookup of allowable campaigns for agents during login +# 71122-0256 - Added auto-pause notification +# 71125-1751 - Changed Transfer section to allow for selection of in-groups to send calls to +# 71127-0408 - Added height and width settings for easier modification of screen size +# 71129-2025 - restricted callbacks count and list to campaign only +# + +$version = '2.0.4-142'; +$build = '71129-2025'; + +require("dbconnect.php"); + +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["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} + 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"];} + } + if (isset($VD_campaign)) + { + $VD_campaign = strtoupper($VD_campaign); + $VD_campaign = eregi_replace(" ",'',$VD_campaign); + } + +### 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); + + +$forever_stop=0; + +if ($force_logout) +{ + echo "Ora siete non Loggati . Grazie\n"; + exit; +} + +$isdst = date("I"); +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$CIDdate = date("ymdHis"); + $month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); + $past_month_date = date("Y-m-d H:i:s",$month_old); + + +$random = (rand(1000000, 9999999) + 10000000); + +$conf_silent_prefix = '7'; # vicidial_conferences prefix to enter silently +$HKuser_level = '5'; # minimum vicidial user_level for HotKeys +$campaign_login_list = '1'; # show drop-down list of campaigns at login +$manual_dial_preview = '1'; # allow preview lead option when manual dial +$multi_line_comments = '1'; # set to 1 to allow multi-line comment box +$user_login_first = '0'; # set to 1 to have the vicidial_user login before the phone login +$view_scripts = '1'; # set to 1 to show the SCRIPTS tab +$dispo_check_all_pause = '0'; # set to 1 to allow for persistent pause after dispo +$agentcallsstatus = '0'; # set to 1 to show agent status and call count + $campagentstatctmax = '0'; # Number of secondi for campaign call and agent stats +$show_campname_pulldown = '1'; # set to 1 to show campaign name su login pulldown +$webform_sessionname = '1'; # set to 1 to include the session_name in webform URL +$local_consult_xfers = '1'; # set to 1 to send consultative transfers from original server +$clientDST = '1'; # set to 1 to check for DST su server for agent time +$no_delete_sessions = '0'; # set to 1 to not delete sessions at logout +$volumecontrol_active = '1'; # set to 1 to allow agents to alter volume of channels +$PreseT_DiaL_LinKs = '1'; # set to 1 to show a CHIAMA link for Dial Presets +$LogiNAJAX = '1'; # set to 1 to do lookups +$HidEMonitoRSessionS = '1'; # set to 1 to hide remote monitoring channels from "session calls" + +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen + +$BROWSER_HEIGHT = 500; # set to the minimum browser height, default=500 +$BROWSER_WIDTH = 770; # set to the minimum browser width, default=770 + + +# options now set in DB: +#$alt_phone_dialing = '1'; # allow agents to call alt phone numbers +#$scheduled_callbacks = '1'; # set to 1 to allow agent to choose scheduled callbacks +# $agentonly_callbacks = '1'; # set to 1 to allow agent to choose agent-only scheduled callbacks +#$agentcall_manual = '1'; # set to 1 to allow agent to make manual calls during autodial session + +### SCREEN WIDTH AND HEIGHT CALCULATIONS ### +### DO NOT EDIT! ### +$MASTERwidth=($BROWSER_WIDTH - 340); +$MASTERheight=($BROWSER_HEIGHT - 200); +if ($MASTERwidth < 430) {$MASTERwidth = '430';} +if ($MASTERheight < 300) {$MASTERheight = '300';} + +$CAwidth = ($MASTERwidth + 340); # 770 - cover all (none-in-session, customer hunngup, etc...) +$MNwidth = ($MASTERwidth + 330); # 760 - main frame +$XFwidth = ($MASTERwidth + 320); # 750 - transfer/conference +$HCwidth = ($MASTERwidth + 310); # 740 - hotkeys and callbacks +$AMwidth = ($MASTERwidth + 270); # 700 - agent mute and preset-dial links +$SSwidth = ($MASTERwidth + 176); # 606 - scroll script +$SDwidth = ($MASTERwidth + 170); # 600 - scroll script, customer data and calls-in-session +$HKwidth = ($MASTERwidth + 70); # 500 - Hotkeys button +$HSwidth = ($MASTERwidth + 1); # 431 - Header spacer + +$HKheight = ($MASTERheight + 105); # 405 - HotKey active Button +$AMheight = ($MASTERheight + 100); # 400 - Agent mute and preset dial links +$MBheight = ($MASTERheight + 65); # 365 - Manual Dial Buttons +$CBheight = ($MASTERheight + 50); # 350 - Agent Callback, pause code, volume control Buttons and agent status +$SSheight = ($MASTERheight + 31); # 331 - script content +$HTheight = ($MASTERheight + 10); # 310 - transfer frame, callback comments and hotkey +$BPheight = ($MASTERheight - 250); # 50 - bottom buffer + + +$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('vicidial.php','',$agcPAGE); + +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 +echo "\n"; +echo "\n"; +echo "\n"; + +if ($campaign_login_list > 0) +{ +$camp_form_code = "\n"; +} +else +{ +$camp_form_code = "\n"; +} + + +if ($LogiNAJAX > 0) +{ +?> + + + +Web client di VICICHIAMA: Re-login attività\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "
English Italiano
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Re-login attività
 
Inizio attività Telefono:
Parola d`accesso del Telefono:
Inizio attività dell`Utente:
Parola d`accesso Dell`Utente:
Campagna: $camp_form_code

VERSIONE: $version       CONFIGURAZIONE: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} + +if ($user_login_first == 1) +{ + if ( (strlen($VD_login)<1) or (strlen($VD_pass)<1) or (strlen($VD_campaign)<1) ) + { + echo "Web client di VICICHIAMA: Inizio attività della Campagna\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Italiano
\n"; + echo "
\n"; + echo "\n"; + #echo "\n"; + #echo "\n"; + echo "

Inizio attività dell`Utente

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Inizio attività della Campagna
 
Inizio attività dell`Utente:
Parola d`accesso Dell`Utente:
Campagna: $camp_form_code
  \n"; + echo "

VERSIONE: $version       CONFIGURAZIONE: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) + { + $stmt="SELECT phone_login,phone_pass from vicidial_users where user='$VD_login' and pass='$VD_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); + $phone_login=$row[0]; + $phone_pass=$row[1]; + + echo "Web client di VICICHIAMA: Inizio attività\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Italiano
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Inizio attività
 
Inizio attività Telefono:
Parola d`accesso del Telefono:
Inizio attività dell`Utente:
Parola d`accesso Dell`Utente:
Campagna: $camp_form_code
  \n"; + echo "

VERSIONE: $version       CONFIGURAZIONE: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + + } + } +} + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "Web client di VICICHIAMA: Inizio attività Telefono\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "
English Italiano
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Inizio attività Telefono
 
Inizio attività Telefono:
Parola d`accesso del Telefono:
  \n"; +echo "

VERSIONE: $version       CONFIGURAZIONE: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./vicidial_auth_entries.txt", "a");} +$VDloginDISPLAY=0; + + if ( (strlen($VD_login)<2) or (strlen($VD_pass)<2) or (strlen($VD_campaign)<2) ) + { + $VDloginDISPLAY=1; + } + else + { + $stmt="SELECT count(*) from vicidial_users where user='$VD_login' and pass='$VD_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($auth>0) + { + $login=strtoupper($VD_login); + $password=strtoupper($VD_pass); + ##### grab the full name of the agent + $stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,closer_default_blended,user_group,vicidial_recording_override from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $user_level=$row[1]; + $VU_hotkeys_active=$row[2]; + $VU_agent_choose_ingroups=$row[3]; + $VU_scheduled_callbacks=$row[4]; + $agentonly_callbacks=$row[5]; + $agentcall_manual=$row[6]; + $VU_vicidial_recording=$row[7]; + $VU_vicidial_transfers=$row[8]; + $VU_closer_default_blended=$row[9]; + $VU_user_group=$row[10]; + $VU_vicidial_recording_override=$row[11]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|$VD_pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + $user_abb = "$VD_login$VD_login$VD_login$VD_login"; + while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + + $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$VU_user_group';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGallowed_campaigns =$row[0]; + + if ( (!eregi(" $VD_campaign ",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) + { + echo "Web client di VICICHIAMA: VICICHIAMA Inizio attività della Campagna\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Italiano
\n"; + echo "Sorry, you are not allowed to login to this campaign: $VD_campaign\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Inizio attività: \n
"; + echo "Parola d`accesso:
\n"; + echo "Campagna: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + ##### check to see that the campaign is active + $stmt="SELECT count(*) FROM vicidial_campaigns where campaign_id='$VD_campaign' and active='Y';"; + 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); + $CAMPactive=$row[0]; + if($CAMPactive>0) + { + if ($TEST_all_statuses > 0) {$selectableSQL = '';} + else {$selectableSQL = "selectable='Y' and";} + $VARstatuses=''; + $VARstatusnames=''; + ##### grab the statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_statuses WHERE $selectableSQL status != 'NEW' order by status limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $VD_statuses_ct) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + } + + ##### grab the campaign-specific statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_campaign_statuses WHERE $selectableSQL status != 'NEW' and campaign_id='$VD_campaign' order by status limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_camp = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + $j++; + } + $VD_statuses_ct = ($VD_statuses_ct+$VD_statuses_camp); + $VARstatuses = substr("$VARstatuses", 0, -1); + $VARstatusnames = substr("$VARstatusnames", 0, -1); + + ##### grab the campaign-specific HotKey statuses that can be used for dispositioning by an agent + $stmt="SELECT hotkey,status,status_name FROM vicidial_campaign_hotkeys WHERE selectable='Y' and status != 'NEW' and campaign_id='$VD_campaign' order by hotkey limit 9;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $HK_statuses_camp = mysql_num_rows($rslt); + $w=0; + $HKboxA=''; + $HKboxB=''; + $HKboxC=''; + while ($w < $HK_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $HKhotkey[$w] =$row[0]; + $HKstatus[$w] =$row[1]; + $HKstatus_name[$w] =$row[2]; + $HKhotkeys = "$HKhotkeys'$HKhotkey[$w]',"; + $HKstatuses = "$HKstatuses'$HKstatus[$w]',"; + $HKstatusnames = "$HKstatusnames'$HKstatus_name[$w]',"; + if ($w < 3) + {$HKboxA = "$HKboxA $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ( ($w >= 3) and ($w < 6) ) + {$HKboxB = "$HKboxB $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ($w >= 6) + {$HKboxC = "$HKboxC $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + $w++; + } + $HKhotkeys = substr("$HKhotkeys", 0, -1); + $HKstatuses = substr("$HKstatuses", 0, -1); + $HKstatusnames = substr("$HKstatusnames", 0, -1); + + ##### grab the statuses to be dialed for your campaign as well as other campaign settings + $stmt="SELECT park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,agent_pause_codes_active,no_hopper_leads_logins,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,xfer_groups FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $park_ext = $row[0]; + $park_file_name = $row[1]; + $web_form_address = $row[2]; + $allow_closers = $row[3]; + $auto_dial_level = $row[4]; + $dial_timeout = $row[5]; + $dial_prefix = $row[6]; + $campaign_cid = $row[7]; + $campaign_vdad_exten = $row[8]; + $campaign_rec_exten = $row[9]; + $campaign_recording = $row[10]; + $campaign_rec_filename = $row[11]; + $campaign_script = $row[12]; + $get_call_launch = $row[13]; + $campaign_am_message_exten = $row[14]; + $xferconf_a_dtmf = $row[15]; + $xferconf_a_number = $row[16]; + $xferconf_b_dtmf = $row[17]; + $xferconf_b_number = $row[18]; + $alt_number_dialing = $row[19]; + $VC_scheduled_callbacks = $row[20]; + $wrapup_secondi = $row[21]; + $wrapup_message = $row[22]; + $closer_campaigns = $row[23]; + $use_internal_dnc = $row[24]; + $allcalls_delay = $row[25]; + $omit_phone_code = $row[26]; + $agent_pause_codes_active = $row[27]; + $no_hopper_leads_logins = $row[28]; + $campaign_allow_inbound = $row[29]; + $manual_dial_list_id = $row[30]; + $default_xfer_group = $row[31]; + $xfer_groups = $row[32]; + + if ( (!ereg('DISABLED',$VU_vicidial_recording_override)) and ($VU_vicidial_recording > 0) ) + { + $campaign_recording = $VU_vicidial_recording_override; + print "\n"; + } + if ( ($VC_scheduled_callbacks=='Y') and ($VU_scheduled_callbacks=='1') ) + {$scheduled_callbacks='1';} + if ($VU_vicidial_recording=='0') + {$campaign_recording='NEVER';} + if ($alt_number_dialing=='Y') + {$alt_phone_dialing='1';} + else + {$alt_phone_dialing='0';} + $closer_campaigns = preg_replace("/^ | -$/","",$closer_campaigns); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaigns = "'$closer_campaigns'"; + + if ($agent_pause_codes_active=='Y') + { + ##### grab the pause codes for this campaign + $stmt="SELECT pause_code,pause_code_name FROM vicidial_pause_codes WHERE campaign_id='$VD_campaign' order by pause_code limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_pause_codes = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_pause_codes) + { + $row=mysql_fetch_row($rslt); + $pause_codes[$i] =$row[0]; + $pause_code_names[$i] =$row[1]; + $VARpause_codes = "$VARpause_codes'$pause_codes[$i]',"; + $VARpause_code_names = "$VARpause_code_names'$pause_code_names[$i]',"; + $i++; + $j++; + } + $VD_pause_codes_ct = ($VD_pause_codes_ct+$VD_pause_codes); + $VARpause_codes = substr("$VARpause_codes", 0, -1); + $VARpause_code_names = substr("$VARpause_code_names", 0, -1); + } + + ##### grab the inbound groups to choose from if campaign contains CLOSER + $VARingroups="''"; + if ($campaign_allow_inbound == 'Y') + { + $VARingroups=''; + $stmt="select group_id from vicidial_inbound_groups where active = 'Y' and group_id IN($closer_campaigns) order by group_id limit 60;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $closer_ct = mysql_num_rows($rslt); + $INgrpCT=0; + while ($INgrpCT < $closer_ct) + { + $row=mysql_fetch_row($rslt); + $closer_groups[$INgrpCT] =$row[0]; + $VARingroups = "$VARingroups'$closer_groups[$INgrpCT]',"; + $INgrpCT++; + } + $VARingroups = substr("$VARingroups", 0, -1); + } + + ##### grab the allowable inbound groups to choose from for transfer options + $xfer_groups = preg_replace("/^ | -$/","",$xfer_groups); + $xfer_groups = preg_replace("/ /","','",$xfer_groups); + $xfer_groups = "'$xfer_groups'"; + $VARxfergroups="''"; + if ($allow_closers == 'Y') + { + $VARxfergroups=''; + $stmt="select group_id,group_name from vicidial_inbound_groups where active = 'Y' and group_id IN($xfer_groups) order by group_id limit 60;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $xfer_ct = mysql_num_rows($rslt); + $XFgrpCT=0; + while ($XFgrpCT < $xfer_ct) + { + $row=mysql_fetch_row($rslt); + $VARxfergroups = "$VARxfergroups'$row[0]',"; + $VARxfergroupsnames = "$VARxfergroupsnames'$row[1]',"; + if ($row[0] == "$default_xfer_group") {$default_xfer_group_name = $row[1];} + $XFgrpCT++; + } + $VARxfergroups = substr("$VARxfergroups", 0, -1); + $VARxfergroupsnames = substr("$VARxfergroupsnames", 0, -1); + } + + ##### grab the number of leads in the hopper for this campaign + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id = '$VD_campaign' and status='READY';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $campaign_leads_to_call = $row[0]; + print "\n"; + + } + else + { + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "La campagna non attiva, prova di nuovo
"; + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|$VD_pass|$ip|$browser|\n"); + fclose($fp); + } + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Inizio attività errato, prova di nuovo
"; + } + } + if ($VDloginDISPLAY) + { + echo "Web client di VICICHIAMA: Inizio attività della Campagna\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Italiano
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "

$VDdisplayMESSAGE

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Inizio attività della Campagna
 
Inizio attività dell`Utente:
Parola d`accesso Dell`Utente:
Campagna: $camp_form_code
  \n"; + echo "

VERSIONE: $version       CONFIGURAZIONE: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +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); +$authphone=$row[0]; +if (!$authphone) + { + echo "Web client di VICICHIAMA: Inizio attività Telefono Error\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Italiano
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Inizio attività Error
 
Spiacente, la vostra password e login non sono attivi in questo sistema, riprova di nuovo:
 
Inizio attività Telefono:
Parola d`accesso del Telefono:

VERSIONE: $version       CONFIGURAZIONE: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "Web client di VICICHIAMA\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + 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); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $login=$row[6]; + $pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CallerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + $enable_sipsak_messages=$row[66]; + + if ($clientDST) + { + $local_gmt = ($local_gmt + $isdst); + } + if ($protocol == 'EXTERNAL') + { + $protocol = 'Local'; + $extension = "$dialplan_number$AT$ext_context"; + } + $SIP_user = "$protocol/$extension"; + + $stmt="SELECT asterisk_version from servers where server_ip='$server_ip';"; + 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); + $asterisk_version=$row[0]; + + # If a park extension is not set, use the default one + if ( (strlen($park_ext)>0) && (strlen($park_file_name)>0) ) + { + $VICIDiaL_park_on_extension = "$park_ext"; + $VICIDiaL_park_on_filename = "$park_file_name"; + print "\n"; + } + print "\n"; + + # If a web form address is not set, use the default one + if (strlen($web_form_address)>0) + { + $VICIDiaL_web_form_address = "$web_form_address"; + print "\n"; + } + else + { + $VICIDiaL_web_form_address = "$VICIDiaL_web_URL"; + print "\n"; + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + } + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + # If closers are allowed su this campaign + if ($allow_closers=="Y") + { + $VICIDiaL_allow_closers = 1; + print "\n"; + } + else + { + $VICIDiaL_allow_closers = 0; + print "\n"; + } + + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtimE$US$session_ext$session_rand"; + + if ($webform_sessionname) + {$webform_sessionname = "&session_name=$session_name";} + else + {$webform_sessionname = '';} + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'vicidial';"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','vicidial','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + if ( ($campaign_allow_inbound == 'Y') || ($campaign_leads_to_call > 0) || (ereg('Y',$no_hopper_leads_logins)) ) + { + ### insert an entry into the user log for the login event + $stmt = "INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$VD_login','LOGIN','$VD_campaign','$NOW_TIME','$StarTtimE','$VU_user_group')"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + ##### check to see if the user has a conf extension already, this happens if they previously exited uncleanly + $stmt="SELECT conf_exten FROM vicidial_conferences where extension='$SIP_user' and server_ip = '$server_ip' LIMIT 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $prev_login_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $prev_login_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + if ($prev_login_ct > 0) + {print "\n";} + else + { + ##### grab the next available vicidial_conference room and reserve it + $stmt="SELECT conf_exten FROM vicidial_conferences where server_ip = '$server_ip' and ((extension='') or (extension is null)) LIMIT 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $free_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $free_conf_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + $stmt="UPDATE vicidial_conferences set extension='$SIP_user' where server_ip='$server_ip' and conf_exten='$session_id';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + print "\n"; + + } + + $stmt="UPDATE vicidial_list set status='N', user='' where status IN('QUEUE','INCALL') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_hopper where status IN('QUEUE','INCALL','DONE') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_live_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_live_inbound_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + # print "You have logged in as user: $VD_login su phone: $SIP_user vai alla campagna: $VD_campaign
\n"; + $VICIDiaL_is_logged_in=1; + + ### set the callerID for manager middleware-app to connect the phone to the user + $SIqueryCID = "S$CIDdate$session_id"; + + ############################################# + ##### INIZIO SYSTEM_SETTINGS LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,vicidial_agent_disable,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $vicidial_agent_disable = $row[6]; + $allow_sipsak_messages = $row[7]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_prefix = 'LIN-'; + print "\n"; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$VD_campaign\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + $SIqueryCID = "$SIPSAK_prefix$VD_campaign$DS$CIDdate"; + } + + ### insert a NUOVO record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$SIqueryCID','Channel: $SIP_user','Context: $ext_context','Exten: $session_id','Priority: 1','Callerid: $SIqueryCID','','','','','');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($auto_dial_level > 0) + { + print "\n"; + + ##### grab the campaign_weight and number of calls today su that campaign for the agent + $stmt="SELECT campaign_weight,calls_today FROM vicidial_campaign_agents where user='$VD_login' and campaign_id = '$VD_campaign';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vca_ct = mysql_num_rows($rslt); + if ($vca_ct > 0) + { + $row=mysql_fetch_row($rslt); + $campaign_weight = $row[0]; + $calls_today = $row[1]; + $i++; + } + else + { + $campaign_weight = '0'; + $calls_today = '0'; + $stmt="INSERT INTO vicidial_campaign_agents (user,campaign_id,campaign_rank,campaign_weight,calls_today) values('$VD_login','$VD_campaign','0','0','$calls_today');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + } + $closer_chooser_string=''; + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,user_level,campaign_weight,calls_today) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$closer_chooser_string','$user_level','$campaign_weight','$calls_today');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='$VD_campaign',agent='Agent/$VD_login',verb='AGENTLOGIN',data1='$VD_login@agents',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSAALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + mysql_close($linkB); + mysql_select_db("$VARDB_database", $link); + } + + + if ($campaign_allow_inbound == 'Y') + { + print "\n"; + } + } + else + { + print "\n"; + + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,user_level) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$user_level');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='$VD_campaign',agent='Agent/$VD_login',verb='AGENTLOGIN',data1='$VD_login@agents',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSAALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + mysql_close($linkB); + mysql_select_db("$VARDB_database", $link); + } + } + } + else + { + echo "Web client di VICICHIAMA: VICICHIAMA Inizio attività della Campagna\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Italiano
\n"; + echo "Spiacenti, non contatti da richiamare per questa campagna\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Inizio attività: \n
"; + echo "Parola d`accesso:
\n"; + echo "Campagna: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + if (strlen($session_id) < 1) + { + echo "Web client di VICICHIAMA: VICICHIAMA Inizio attività della Campagna\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Italiano
\n"; + echo "Sorry, there are no available sessions\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Inizio attività: \n
"; + echo "Parola d`accesso:
\n"; + echo "Campagna: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + if (ereg('MSIE',$browser)) + { + $useIE=1; + print "\n"; + } + else + { + $useIE=0; + print "\n"; + } + + $StarTtimE = date("U"); + $NOW_TIME = date("Y-m-d H:i:s"); + ##### Agent is going to log in so insert the vicidial_agent_log entry now + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group,sub_status) values('$VD_login','$server_ip','$NOW_TIME','$VD_campaign','$StarTtimE','0','$StarTtimE','$VU_user_group','LOGIN');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id($link); + print "\n"; + + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $server_ip_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S"; + + ##### grab the datails of all active scripts in the system + $stmt="SELECT script_id,script_name,script_text FROM vicidial_scripts WHERE active='Y' order by script_id limit 100;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $MM_scripts = mysql_num_rows($rslt); + $e=0; + while ($e < $MM_scripts) + { + $row=mysql_fetch_row($rslt); + $MMscriptid[$e] =$row[0]; + $MMscriptname[$e] = rawurlencode($row[1]); + $MMscripttext[$e] = rawurlencode($row[2]); + $MMscriptids = "$MMscriptids'$MMscriptid[$e]',"; + $MMscriptnames = "$MMscriptnames'$MMscriptname[$e]',"; + $MMscripttexts = "$MMscripttexts'$MMscripttext[$e]',"; + $e++; + } + $MMscriptids = substr("$MMscriptids", 0, -1); + $MMscriptnames = substr("$MMscriptnames", 0, -1); + $MMscripttexts = substr("$MMscripttexts", 0, -1); + + } +} + +################################################################ +### BEGIN - build the callback calendar (12 months) ### +################################################################ +define ('ADAY', (60*60*24)); +$CdayARY = getdate(); +$Cmon = $CdayARY['mon']; +$Cyear = $CdayARY['year']; +$CTODAY = date("Y-m"); +$CTODAYmday = date("j"); +$CINC=0; + +$Cmonths = Array('Gennaio','February','Marzo','Aprile','Può','Giugno', + 'Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'); +$Cdays = Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); + +$CCAL_OUT = ''; + +$CCAL_OUT .= ""; + +while ($CINC < 12) +{ +if ( ($CINC == 0) || ($CINC == 4) ||($CINC == 8) ) + {$CCAL_OUT .= "";} + +$CCAL_OUT .= ""; + +if ( ($CINC == 3) || ($CINC == 7) ||($CINC == 11) ) + {$CCAL_OUT .= "";} +$CINC++; +} + +$CCAL_OUT .= "
"; + +$CYyear = $Cyear; +$Cmonth= ($Cmon + $CINC); +if ($Cmonth > 12) + { + $Cmonth = ($Cmonth - 12); + $CYyear++; + } +$Cstart= mktime(11,0,0,$Cmonth,1,$CYyear); +$CfirstdayARY = getdate($Cstart); +#echo "|$Cmon|$Cmonth|$CINC|\n"; +$CPRNTDAY = date("Y-m", $Cstart); + +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; + +foreach($Cdays as $Cday) +{ + $CDCLR="#ffffff"; +$CCAL_OUT .= ""; +} + +for( $Ccount=0;$Ccount<(6*7);$Ccount++) +{ + $Cdayarray = getdate($Cstart); + if((($Ccount) % 7) == 0) + { + if($Cdayarray['mon'] != $CfirstdayARY['mon']) + break; + $CCAL_OUT .= ""; + } + if($Ccount < $CfirstdayARY['wday'] || $Cdayarray['mon'] != $Cmonth) + { + $CCAL_OUT .= ""; + } + else + { + if( ($Cdayarray['mday'] == $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + else + { + $CDCLR="#ffffff"; + if ( ($Cdayarray['mday'] < $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CDCLR="#CCCCCC"; + $CBL = ''; + $CEL = ''; + } + else + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + } + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + } +} +$CCAL_OUT .= ""; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$CfirstdayARY[month] $CfirstdayARY[year]"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$Cday"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
 "; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; + +#echo "$CCAL_OUT\n"; +################################################################ +### END - build the callback calendar (12 months) ### +################################################################ + + +?> + + + + +\n"; + + +?> + +
+ + MARGINWIDTH=0 MARGINHEIGHT=0 LEFTMARGIN=0 TOPMARGIN=0 VALIGN=TOP ALIGN=LEFT> +
+ + + +LOGOUT\n"; ?> +
+
+ + + height=30> + + + + + +
VICICHIAMASCRIPT VALIGN=MIDDLE ALIGN=CENTER>   LIVE     ID di sessione: Chimate Attive
+
+ + + + + height=>

VICICHIAMA
+
+ + +Chiamata Manuale       MANOPOLA VELOCE
+
+ + +X RICHIAMATE ATTIVE
+
+ + +
+
+ + + D1 - CHIAMA\n"; + echo "
\n"; + echo "D2 - CHIAMA\n"; + } + else {echo "
\n";} + ?> +

+
+
+ + + height=460>
RICHIAMATE PER OPERATORE :
Click su a callback below to call the customer back now. If you click su a record below to call it, it will be removed from the list. +
+
+
  + Aggiorna +                 + Torna Indietro +
+
+ + + height=460>
NUOVA CHIAMATA MANUALE PER IL CONTATTO :

Inserisci le informazioni sotto per il nuovo contatto da chiamare. +
+ \n"; + } + ?> + Note: all new manual dial leads will go into list

+ + + + + + + + + + + + + + + +
Codice di Chiamata:   (E solitamente un 1 negli USA e Canada)
Telefono Number: +   (12 digits max - digits only) +
Cerca Contatti esistenti:   (Questa opzione tenterà di trovare il numero di telefono nel sistema prima di inserire un nuovo contatto)


If you want to dial a number and have it NOT be added as a new lead, enter in the exact dialstring that you want to call in the Chiamata automatica field below. To hangup this call you will have to open the CHIAMATAS IN THIS SESSION link at the bottom of the screen and hang it up by clicking su its channel link there.
 
Chiamata automatica:   (solo cifre grazie) +
+
+ Chiama Ora +                 + Torna Indietro +
+
+ + + +
+
+ + + + +Vostro Status:
Calls Dialing: +
+ + + + + > + +
+
+ + Trasferimento - Conferenza
+ + + LOCALE PIÙ VICINO + Attacca la linea trasferita + Attacca ciascun linea + +
+ + Numero da chiamare   + + CHIAMATA AUTOMATICA   + LASCIA LA CONFERENZA + Effettua il trasferimento cieco + D1 + D2 + +
+ + secondi   + channel + Chiama il Cliente + Parcheggia il cliente in chiamata + Blind Transfer VMail Message +
+
+
+
+ + + + height=70> + +
Contatto disposto come:

+ -
+
+
+ + + height=70> + + + + +
tasti funzione per la disposizione: + Una volta attiva, premi sulla tastiera per la disposizione sulla chiamata sarà attaccata e disposta automaticamente:
+ + + + + +
+
+ + + height=70> + + + + + + +
Le Informazioni Precedenti Di Chiamata ripetuta: close
+
+
+
+
+ +
+
+ + + height=500>
Nessuno è nella vostra sessione:
+ Torna Indietro +

+ Ancora Operatore di chiamata +
+
+ + + height=500>
Il cliente ha attaccato:
+ Torna Indietro +

+ Termina e disponi la chiamata + +
+
+ + + height=550>
Chiamata tempo di pausa: secondi restanti prima di nuova chiamata

+ +

+ Tempo scaduto, sbrigarsi + +
+
+ + + height=500>
La vostra sessione è stata inabilitata
LOGOUT

Torna Indietro +
+
+ + + height=500>

LOGOUT
+
+ + +
+
+ + +
 
+
+ + + height=47>
Tutti i cambiamenti fatti sulle informazioni del cliente sotto non saranno effettuate, cambiare le informazioni prima di attaccare.
+
+ + + height=460>
DISPOSIZIONE CHIAMATA :       Attacca ancora       minimizza
+ Selezione di fine chiamata +
+ PAUSA OPERATORE
+ PULISCI SCHERMATA | + INVIA +

+ WEB FORM INVIA +

  +
+
+ + + height=460>
SELEZIONI Un CODICE Di PAUSA :
+ Pausa Code Selection + +

  +
+
+ + + height=460>
Selezionate una richiamata :
+ + + Selezioni una data sotto   +     + Hour: +   + Minutes: +   + +  
+ SOLTANTO LE MIE RICHIAMATE
";} + ?> + Commenti del CB :

+ + INVIA

+ +

  +
+
+ + + height=460>
SELEZIONE DI GRUPPO INBOUND PIÙ VICINO
+ Selezione di Gruppo Inbound più vicino +
+ CHIAMATA MESCOLATA(outbound attivato)
+ RESET | + INVIA +



  +
+
+ + + + Canale + Canale + SOLTANTO LE MIE RICHIAMATE
";} + ?> +
+ + + + height=>
VICICHIAMA SCRIPT
+
+ + + 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> +TASTI FUNZIONE INATTIVI + + + + +> + + + +
Versione del webclient di VICICHIAMA:     CONFIGURAZIONE:               Server:              
+Mostrate le informazioni sul canale della conferenza

 
+
+ + + +
+
+ + + + + id="MainTable"> + + + + + + + + + + + + + + + +
STATUS:
+
+Chiama il numero seguente
+ ANTEPRIMA CONTATTO
+ ALT CHIAMATE
+ + +REGISTRAZIONE DOCUMENTO:
+
+
+IDENTIFICAZIONE Registrazione:
+
+ +Inizia la Registrazione
+
+Interfacccia Web
+
+Parcheggia la chiamata
+Trasferimento - Conferenza
+
+Disconnetti il cliente
+
+
Trasmetta DTMF

+
+
+
align=left valign=top> + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
secondi:   Canale:   Tempo Di Cust:
Informazioni Cliente:
Titolo:   Primo:   Mi:  Ultimo:
Indirizzo1:
Indirizzo2:   Indirizzo3:
Città:   Stato:   Codice postale:
Provincia:   ID Fornitore:
Telefono:   Prefisso:   Alt. Telefono:
Mostra:   Email:
Osservazioni: + +\n";} +else + {echo "\n";} +?> + +
+
+ +
+
> + 
+ + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/voicemail_check.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/voicemail_check.php new file mode 100644 index 00000000..1e0023d4 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_it/voicemail_check.php @@ -0,0 +1,140 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "Non valido Utentename/Parola d`accesso: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Non valido server_ip: |$server_ip| or Non valido 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 "Non valido session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Controllo Voicemail"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + $MT[0]=''; + $row=''; $rowx=''; + if (strlen($vmail_box)<1) + { + $channel_live=0; + echo "Casella del voicemail $vmail_box non è 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";} + $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";} + } + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/active_list_refresh.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/active_list_refresh.php new file mode 100644 index 00000000..542f49d5 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/active_list_refresh.php @@ -0,0 +1,482 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "Nieprawidłowy NazwaUżytkownika/Hasło: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Nieprawidłowy server_ip: |$server_ip| or Nieprawidłowy 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 "Nieprawidłowy session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='table') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Listy: "; +if ($ADD==1) {echo "Aktywne numery wewnętrzne";} +if ($ADD==2) {echo "Zajęte numery wewnętrzne";} +if ($ADD==3) {echo "Linie zewnętrzne";} +if ($ADD==4) {echo "Numery wewnętrzne";} +if ($ADD==5) {echo "Konferencje";} +if ($ADD==99999) {echo "POMOC";} +echo "\n"; +echo "\n"; +echo "\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 "\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + +###################### +# ADD=2 display all busy extensions on a server +###################### +if ($ADD==2) +{ + if (!$field_name) {$field_name = 'busyext';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\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 "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=4 display all busy Local lines on a server +###################### +if ($ADD==4) +{ + if (!$field_name) {$field_name = 'local';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\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 "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='table') {echo "\n";} +if ($format=='table') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/astguiclient.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/astguiclient.php new file mode 100644 index 00000000..f3634f2c --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/astguiclient.php @@ -0,0 +1,2905 @@ + LICENSE: GPLv2 +# +# make sure you have added a user to the vicidial_users MySQL table with at least +# user_level 1 or greater to access this page. Also you need to have the login +# and pass of a phone listed in the asterisk.phones table. The page grabs the +# server info and other details from this login and pass +# +# Other scripts that this application depends on: +# - active_list_refresh.php: displays active/live channels and phones +# - manager_send.php: sends Actions to be executed on Asterisk servers +# - live_exten_check.php: checks to see if user's phone is on a live call +# - call_log_display.php: retrieves log of inbound and outbound calls +# - voicemail_check.php: retrieves counts of new and old messages +# - inbound_popup.php: opens upon live_inbound call coming in +# - conf_exten_check.php: checks to see if and calls are in a specific conf +# - park_calls_display.php: retrieves list of parked calls +# - vdc_db_query.php: Changes values in the DB for non-calling records +# +# CHANGES +# 50215-1356 - Proof-of-concept test of XMLHttpRequest for astGUIclient web +# 50323-1411 - First build version display-only +# 50331-1040 - Second-build, added phone login and hangup/hijack display +# 50401-1006 - Trunk/Local Hangup functions enabled +# 50404-1056 - Trunk/Local Hijack functions enabled +# 50404-1459 - Simple live calls display and grabs updated time from server +# 50405-1221 - Reorganized the display and layers, added some images +# 50406-1005 - Added In/Out call log display to MAIN panel +# 50407-1254 - Start/Stop Recording on live calls enabled +# 50422-1101 - Activated Check Voicemail button and new/old messages count +# 50428-1449 - Added dial from log and basic live_inbound call popup +# 50429-1455 - Modified inbound popup code for IE and to add more functions +# 50502-1442 - Added basic method to transfer live calls somewhere else +# 50503-1205 - Added web_client_sessions entry for more security of subscripts +# 50503-1537 - Added basic conferences display +# 50509-1132 - Added conference connected list and hangup/xfer for them +# 50511-1129 - Added registration of conference rooms and added manual dial +# 50523-1342 - Added Conference recording and send DTMF +# 50523-1622 - Added Local Dial window frame for calling local extensions +# 50524-1456 - Added ability to park call and display number of parked calls +# 50524-1600 - Added ability to display and pickup/hangup/xfer parked calls +# 50525-1224 - Added ability to place outbound call from within conferene +# 50531-1225 - Added ability to do dual transfers to meetme rooms from Main +# 50711-1229 - removed HTTP authentication in favor of user/pass vars +# 50711-1610 - Added Zap monitoring to Trunk/Local Action screens +# 50804-1604 - Minor bug fix in inbound_popup functions +# 50818-1715 - Added pretty login section +# 50913-1137 - Added custom outbound_cid from phones table +# 51110-1430 - Fixed non-standard http port issue +# 60103-1421 - Added code for favorite extensions chooser +# 60104-1347 - Added basic layout for favorites editing frame +# 60105-1124 - Finished Favorites frame and added DB submission +# 60112-1622 - Several formatting changes +# 60421-1357 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1103 - Added variable filters to close security holes for login form +# 60829-1528 - Made compatible with WeBRooTWritablE setting in dbconnect.php +# + +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["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["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} + 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"];} + } + +$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++;} + +$version = '2.0.1'; +$build = '60829-1528'; + +### 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); + $user=ereg_replace("[^0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^0-9a-zA-Z]","",$pass); + + +if ($force_logout) +{ + if( (strlen($_SERVER['user'])>0) or (strlen($_SERVER['pass'])>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "Wylogowałeś się. Do zobaczenia\n"; + exit; +} + +$StarTtime = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_TIME = date("Ymd-His"); + $month_old = mktime(0, 0, 0, date("m"), date("d")-7, date("Y")); + $past_month_date = date("Y-m-d H:i:s",$month_old); + + $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]; + +$US='_'; +$CL=':'; +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./astguiclient_auth_entries.txt", "a");} +$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 = $agcPAGE; +$agcDIR = eregi_replace('astguiclient.php','',$agcDIR); + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth) or ($relogin == 'YES') ) + { + header ("Content-type: text/html; charset=utf-8"); + + echo "klient astGUIclient: Login\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Polski
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Login
 
Login użytkownika:
Hasło użytkownika:
Login telefonu:
Hasło telefonu:

WERSJA: $version       KOMPILACJA: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($user); + $password=strtoupper($pass); + $stmt="SELECT full_name,user_level from vicidial_users where user='$user' and pass='$pass'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIWYBIERZ|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIWYBIERZ|FAIL|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + } + +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 +echo "\n"; +echo "\n"; +echo "\n"; + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "klient astGUIclient: Login telefonu\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "
English Polski
\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Login telefonu
 
Login telefonu:
Hasło telefonu:

WERSJA: $version       KOMPILACJA: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$authphone=$row[0]; +if (!$authphone) + { + echo "klient astGUIclient: Login telefonu\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Polski
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Login telefonu
 
Login Twojego telefonu lub hasło są nieaktywne w tym systememie, spróbuj jeszcze raz:
 
Login telefonu:
Hasło telefonu:

WERSJA: $version       KOMPILACJA: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "klient astGUIclient\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $phone_login=$row[6]; + $phone_pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CaLLerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + $outbound_cid=$row[65]; + + $local_web_callerID_URL_enc = rawurlencode($local_web_callerID_URL); + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtime$US$session_ext$session_rand"; + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'agc';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','agc','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT count(*) from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_present=$row[0]; + if ($favorites_present > 0) + { + $stmt="SELECT extensions_list from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_list=$row[0]; + $h=0; + $favorites_listX = eregi_replace("'",'',$favorites_list); + $favorites = explode(',',$favorites_listX); + $favorites_count = count($favorites); + $favorites_listX=''; + + $o=0; + while ($favorites_count > $o) + { + $stmt="SELECT fullname,protocol from phones where extension = '$favorites[$o]' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $favorites_names[$o] = $rowx[0]; + $favorites_listX .= "$rowx[1]/$favorites[$o],"; + $o++; + } + + echo "\n"; + echo "\n"; + } + else + { + echo "\n"; + } + +### gather phone extensions and fullnames for favorites editor ### + $stmt="SELECT extension,fullname from phones where server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $exten_ct = mysql_num_rows($rslt); + $favlistCT=0; + $nofavlistCT=0; + while ($favlistCT < $exten_ct) + { + $row=mysql_fetch_row($rslt); + $favlist[$favlistCT]= "$row[0] - $row[1]"; + $favlistCT++; + } + + } +} + + +?> + + + + + + +\n"; + + +?> + +
+ + + + + + + + + +
+ + +WYLOGUJ
\n"; ?> +
Główny panelPanel aktywnych liniPanel konferencyjnySprawdź pocztę głosowąAktywna rozmowa
+
+ + +

Logout
+
+ + +
TRUNK ROZÅÄ„CZ

+ Active Trunks Menu
+ Rozłącz miÄ™dzymiastowÄ…   |   + Przejmij miÄ™dzymiastowÄ…   |   + OdsÅ‚uchaj miÄ™dzymiastowÄ…   |   + Odswież   |   + Wróć do Głównego okna +
+
+ + +
ROZÅÄ„CZ

+ Manu aktywnych lokalnych
+ Rozłącz lokalnÄ…   |   + Przejmij lokalnÄ…   |   + PodsÅ‚uchaj lokalnÄ…   |   + Odswież   |   + Wróć do Głównego okna +
+
+ + + + + + + +
AKTYWNA ROZMOWA PRZENIESIONA
Kanały do przeniesienia: Kanał
NumerWenętrzny:
Menu rozszerzeń
+
+ Przełącz do wybranego numeru wewnętrznego

+ Przełącz do poczty głosowej

+ Przełącz do numeru:


+ Odswież


+ Wróć do Głównego okna

+
Konferencje:
(wybierz poniższy numer w celu przełączenia do konferencji)
Przełącz również mój kanał
Menu konferencji
+
+ + + + + +
Wybieranie numerów wewnętrznych
Połączenie przychodzące z: Kanał
NumerWenętrzny:
Menu rozszerzeń
+
+ Połącz z wybranym numerem wewnętrznym

+ Połącz z wybraną skrzynką głosową

+ Odswież


+ Wróć do Głównego okna

+
+
+ + +
ZAWIESZONE ROZMOWY:
+ Wróć do Głównego okna

+
+
+ + + + + + + + + + + + + + + +
  +
POCZTAGÅOSOWA     NOWY:     STARY:             WYBIERANIE RĘCZNE       WYBIERZ
ZAWIESZONE ROZMOWY: 0                NUMERY WEWNĘTRZNE
ROZMOWY WYCHODZĄCE:
ROZMOWY PRZYCHODZĄCE:
astGUIclient WERSJA: KOMPILACJA:
+ + + + $h) + { + if (strlen($favorites[$h])>1) + { + echo "\n"; + } + $h++; + } +?> + +
ULUBIONE       edytuj
$favorites[$h] - $favorites_names[$h]
 
+
+ + + + + + + +
ULUBIONE

 
ZATWIERDŹ ZMIANY W ULUBIONYCH- wymaga wylogowania
Powrót do głónego okna - anulowanie wprowadzonych zmian
+
+ +
+ + + + + + + + + + + + + +
+PRZERWA | START     Szybkość odswieżania: 1000 ms Szybciej | Wolniej

+
Inicjalizuje..
+
Aktywne numery wewnętrzne
+ODSWIEŻ | +PORZĄDEK | +
Linie zewnętrzne
+ODSWIEŻ | +PORZĄDEK | +
Numery wewnętrzne
+ODSWIEŻ | +PORZĄDEK | +
+ Data tutaj

+
+ Data tutaj

Operacje na międzymiastowych +
+ Data tutaj

Operacje na lokalnych +
+
+ + + + +
+ + +Lista konferencji + + + +
+Wybierz numer konferencji w celu uzyskania o niej informacji +
+ + + + + + + + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/call_log_display.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/call_log_display.php new file mode 100644 index 00000000..7b4f7786 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/call_log_display.php @@ -0,0 +1,196 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "Nieprawidłowy NazwaUżytkownika/Hasło: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Nieprawidłowy server_ip: |$server_ip| or Nieprawidłowy 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 "Nieprawidłowy session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Rejestr rozmów"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten nie jest prawidłowy lub protokół $protocol nie jest prawidłowy\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";} + $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";} + $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"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/conf_exten_check.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/conf_exten_check.php new file mode 100644 index 00000000..a27ec4cf --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/conf_exten_check.php @@ -0,0 +1,297 @@ + LICENSE: GPLv2 +# +# 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 +# + +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"];} + +$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";} + +$version = '2.0.4-12'; +$build = '71122-0205'; +$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";} + $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 "Nieprawidłowy NazwaUżytkownika/Hasło: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Nieprawidłowy server_ip: |$server_ip| or Nieprawidłowy 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 "Nieprawidłowy session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Sprawdzanie numeru wewnętrznego konferencji"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + if ($ACTION == 'refresh') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($conf_exten)<1) + { + $channel_live=0; + echo "Conf Exten $conf_exten nie jest prawidłowy\n"; + exit; + } + else + { + + if ($client == 'vdc') + { + $Acount=0; + $AexternalDEAD=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); + $row=mysql_fetch_row($rslt); + $Acount=$row[0]; + + if ($Acount > 0) + { + $stmt="SELECT status from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Astatus=$row[0]; + } + # ### 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";} + $rslt=mysql_query($stmt, $link); + + if ($campagentstdisp == 'YES') + { + ### grab the status of this agent to display + $stmt="SELECT status,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Alogin=$row[0]; + $Acampaign=$row[1]; + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where server_ip='$server_ip' and status NOT IN('XFER') and campaign_id='$Acampaign';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $RingCalls=$row[0]; + } + else + { + $Alogin='N'; + $RingCalls='N'; + } + } + else + { + $Alogin='N'; + $RingCalls='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";} + $rslt=mysql_query($stmt, $link); + + } + + if ($Acount < 1) {$Alogin='DEAD_VLA';} + if ($AexternalDEAD > 0) {$Alogin='DEAD_EXTERNAL';} + + echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Status: ' . $Astatus . "|\n"; + + } + $total_conf=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + 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); + $KanałA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $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++; $total_conf++; + $row=mysql_fetch_row($rslt); + $KanałA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + } + $channels_list = ($channels_list + $sip_list); + echo "$channels_list|"; + + $counter=0; + $countecho=''; + while($total_conf > $counter) + { + $counter++; + $countecho = "$countecho$KanałA[$counter] ~"; + # echo "$Kanał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 nie jest prawidłowy or Exten $exten nie jest prawidłowy\n"; + exit; + } + else + { + $stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + echo "Konferencja $conf_exten został zarejestrowany $exten\n"; + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/dbconnect.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/dbconnect.php new file mode 100644 index 00000000..7221b35e --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/dbconnect.php @@ -0,0 +1,48 @@ + LICENSE: GPLv2 +# +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"); +mysql_select_db("$VARDB_database"); + +$local_DEF = 'Local/'; +$conf_silent_prefix = '7'; +$local_AMP = '@'; +$ext_context = 'demo'; +$recording_exten = '8309'; +$WeBRooTWritablE = '1'; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/inbound_popup.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/inbound_popup.php new file mode 100644 index 00000000..f94639af --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/inbound_popup.php @@ -0,0 +1,351 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "Nieprawidłowy NazwaUżytkownika/Hasło: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Nieprawidłowy server_ip: |$server_ip| or Nieprawidłowy 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 "Nieprawidłowy 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 "\n"; +echo "\n"; +echo "\n"; +?> + + +AKTYWNA PRZYHODZĄCA ROZMOWA"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "

AKTYWNA PRZYHODZĄCA ROZMOWA

\n"; +echo "$NOW_TIME

\n"; +} + + + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($uniqueid)<9) + { + $channel_live=0; + echo "Uniqueid $uniqueid nie jest prawidłowy\n"; + exit; + } + else + { + $stmt="SELECT * FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $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";} + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Kanał: $row[1]
IDRozmówcy: $row[3]
\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 "GOOGLE - \n"; + echo "ANYWHO - \n"; + echo "SWITCHBOARD - \n"; + echo "VERIZON - \n"; + echo "WHITEPAGES - \n"; + echo "411.COM - \n"; + echo "411.COM - \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_Kanał=$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 "UŻYTKOWNIKA - \n"; + + echo "
Wybierany numer: $row[8]
Notatki: $row[9]|$row[10]|$row[11]|$row[12]|$row[13]|
\n"; + echo "ROZÅÄ„CZ - \n"; + echo "PRZEÅšLIJ DO MOJEJ POCZTY GÅOSOWEJ\n"; + echo "
\n"; + + + $stmt="UPDATE live_inbound set acknowledged='Y' where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + + } + + + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/live_exten_check.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/live_exten_check.php new file mode 100644 index 00000000..441f8eca --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/live_exten_check.php @@ -0,0 +1,278 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "Nieprawidłowy NazwaUżytkownika/Hasło: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Nieprawidłowy server_ip: |$server_ip| or Nieprawidłowy 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 "Nieprawidłowy session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Sprawdzanie aktywnych numerów wewnętrznych"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + +echo "DateTime: $NOW_TIME|"; +echo "UnixTime: $StarTtime|"; + +$stmt="SELECT count(*) FROM parked_channels where server_ip = '$server_ip';"; + if ($format=='debug') {echo "\n";} +$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 nie jest prawidłowy lub protokół $protocol nie jest prawidłowy\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";} + $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";} + } + } + + $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";} + $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 "KanałA: $ChanneLA[$counter] ~"; + echo "KanałB: $ChanneLB[$counter] ~"; + echo "Kanał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";} + $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 "KanałA: $ChanneLA[$counter] ~"; + echo "KanałB: $ChanneLB[$counter] ~"; + echo "Kanał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";} + $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 "KanałA: $ChanneLA[$counter] ~"; + echo "KanałB: $ChanneLB[$counter] ~"; + echo "Kanał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";} + $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 "KanałA: $ChanneLA[$counter] ~"; + echo "KanałB: $ChanneLB[$counter] ~"; + echo "KanałBtrunk: $row[0]|"; + } + else + { + echo "Conversation: $counter ~"; + echo "KanałA: $ChanneLA[$counter] ~"; + echo "KanałB: $ChanneLB[$counter] ~"; + echo "Kanał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";} +$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";} + } + +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";} + $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";} + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/manager_send.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/manager_send.php new file mode 100644 index 00000000..8932ad9b --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/manager_send.php @@ -0,0 +1,1142 @@ + LICENSE: GPLv2 +# +# This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk 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: +# - $ACTION - ('Originate','Redirect','Hangup','Command','Monitor','StopMonitor','SysCIDOriginate','RedirectName','RedirectNameVmail','MonitorConf','StopMonitorConf','RedirectXtra','RedirectXtraCX','RedirectVD','HangupConfDial','VolumeControl','OriginateVDRelogin') +# - $queryCID - ('CN012345678901234567',...) +# - $format - ('text','debug') +# - $channel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +# - $exten - ('1234','913125551212',...) +# - $ext_context - ('default','demo',...) +# - $ext_priority - ('1','2',...) +# - $filename - ('20050406-125623_44444',...) +# - $extenName - ('phone100',...) +# - $parkedby - ('phone100',...) +# - $extrachannel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +# - $auto_dial_level - ('0','1','1.1',...) +# - $campaign - ('CLOSER','TESTCAMP',...) +# - $uniqueid - ('1120232758.2406800',...) +# - $lead_id - ('1234',...) +# - $seconds - ('32',...) +# - $outbound_cid - ('3125551212','0000000000',...) +# - $agent_log_id - ('123456',...) +# - $call_server_ip - ('10.10.10.15',...) +# - $CalLCID - ('VD01234567890123456',...) +# - $stage - ('UP','DOWN') +# + +# CHANGELOG: +# 50401-1002 - First build of script, Hangup function only +# 50404-1045 - Redirect basic function enabled +# 50406-1522 - Monitor basic function enabled +# 50407-1647 - Monitor and StopMonitor full functions enabled +# 50422-1120 - basic Originate function enabled +# 50428-1451 - basic SysCIDOriginate function enabled for checking voicemail +# 50502-1539 - basic RedirectName and RedirectNameVmail added +# 50503-1227 - added session_name checking for extra security +# 50523-1341 - added Conference call start/stop recording +# 50523-1421 - added OriginateName and OriginateNameVmail for local calls +# 50524-1602 - added RedirectToPark and RedirectFromPark +# 50531-1203 - added RedirecXtra for dual channel redirection +# 50630-1100 - script changed to not use HTTP login vars, user/pass instead +# 50804-1148 - Added RedirectVD for VICIDIAL blind redirection with logging +# 50815-1204 - Added NEXTAVAILABLE to RedirectXtra function +# 50903-2343 - Added HangupConfDial function to hangup in-dial channels in conf +# 50913-1057 - Added outbound_cid set if present to originate call +# 51020-1556 - Added agent_log_id framework for detailed agent activity logging +# 51118-1204 - Fixed Blind transfer bug from VICIDIAL when in manual dial mode +# 51129-1014 - Added ability to accept calls from other VICIDIAL servers +# 51129-1253 - Fixed Hangups of other agents channels in VICIDIAL AD +# 60310-2022 - Fixed NEXTAVAILABLE bug in leave-3way-call redirect function +# 60421-1413 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1158 - Added variable filters to close security holes for login form +# 60809-1544 - Added direct transfers to leave-3ways in consultative transfers +# 61004-1526 - Added parsing of volume control command and lookup or number +# 61130-1617 - Added lead_id to MonitorConf for recording_log +# 61201-1115 - Added user to MonitorConf for recording_log +# 70111-1600 - added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70226-1251 - Added Mute/UnMute to conference volume control +# 70320-1502 - Added option to allow retry of leave-3way-call and debug logging +# 70322-1636 - Added sipsak display ability +# + +require("dbconnect.php"); + +### These are variable assignments for PHP globals off +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["ACTION"])) {$ACTION=$_GET["ACTION"];} + elseif (isset($_POST["ACTION"])) {$ACTION=$_POST["ACTION"];} +if (isset($_GET["queryCID"])) {$queryCID=$_GET["queryCID"];} + elseif (isset($_POST["queryCID"])) {$queryCID=$_POST["queryCID"];} +if (isset($_GET["format"])) {$format=$_GET["format"];} + elseif (isset($_POST["format"])) {$format=$_POST["format"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["exten"])) {$exten=$_GET["exten"];} + elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];} +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["filename"])) {$filename=$_GET["filename"];} + elseif (isset($_POST["filename"])) {$filename=$_POST["filename"];} +if (isset($_GET["extenName"])) {$extenName=$_GET["extenName"];} + elseif (isset($_POST["extenName"])) {$extenName=$_POST["extenName"];} +if (isset($_GET["parkedby"])) {$parkedby=$_GET["parkedby"];} + elseif (isset($_POST["parkedby"])) {$parkedby=$_POST["parkedby"];} +if (isset($_GET["extrachannel"])) {$extrachannel=$_GET["extrachannel"];} + elseif (isset($_POST["extrachannel"])) {$extrachannel=$_POST["extrachannel"];} +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["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} + elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["secondS"])) {$secondS=$_GET["secondS"];} + elseif (isset($_POST["secondS"])) {$secondS=$_POST["secondS"];} +if (isset($_GET["outbound_cid"])) {$outbound_cid=$_GET["outbound_cid"];} + elseif (isset($_POST["outbound_cid"])) {$outbound_cid=$_POST["outbound_cid"];} +if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];} + elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];} +if (isset($_GET["call_server_ip"])) {$call_server_ip=$_GET["call_server_ip"];} + elseif (isset($_POST["call_server_ip"])) {$call_server_ip=$_POST["call_server_ip"];} +if (isset($_GET["CalLCID"])) {$CalLCID=$_GET["CalLCID"];} + elseif (isset($_POST["CalLCID"])) {$CalLCID=$_POST["CalLCID"];} +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["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} +if (isset($_GET["phone_ip"])) {$phone_ip=$_GET["phone_ip"];} + elseif (isset($_POST["phone_ip"])) {$phone_ip=$_POST["phone_ip"];} +if (isset($_GET["enable_sipsak_messages"])) {$enable_sipsak_messages=$_GET["enable_sipsak_messages"];} + elseif (isset($_POST["enable_sipsak_messages"])) {$enable_sipsak_messages=$_POST["enable_sipsak_messages"];} +if (isset($_GET["allow_sipsak_messages"])) {$allow_sipsak_messages=$_GET["allow_sipsak_messages"];} + elseif (isset($_POST["allow_sipsak_messages"])) {$allow_sipsak_messages=$_POST["allow_sipsak_messages"];} + +$user=ereg_replace("[^0-9a-zA-Z]","",$user); +$pass=ereg_replace("[^0-9a-zA-Z]","",$pass); +$secondS = ereg_replace("[^0-9]","",$secondS); + +# default optional vars if not set +if (!isset($ACTION)) {$ACTION="Originate";} +if (!isset($format)) {$format="alert";} +if (!isset($ext_priority)) {$ext_priority="1";} + +$version = '2.0.29'; +$build = '70320-1502'; +$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 "Nieprawidłowy NazwaUżytkownika/Hasło: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Nieprawidłowy server_ip: |$server_ip| or Nieprawidłowy 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 "Nieprawidłowy session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Wyślij do zarządzania: "; +if ($ACTION=="Originate") {echo "Originate";} +if ($ACTION=="Redirect") {echo "Redirect";} +if ($ACTION=="RedirectName") {echo "RedirectName";} +if ($ACTION=="Hangup") {echo "Hangup";} +if ($ACTION=="Command") {echo "Command";} +if ($ACTION==99999) {echo "POMOC";} +echo "\n"; +echo "\n"; +echo "\n"; +} + + + + + +###################### +# ACTION=SysCIDOriginate - insert Originate Manager statement allowing small CIDs for system calls +###################### +if ($ACTION=="SysCIDOriginate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<1) ) + { + echo "Exten $exten nie jest prawidłowy or queryCID $queryCID nie jest prawidłowy, Originate komenda nie wstawiona\n"; + } + else + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate komenda wysłana do Exten $exten Kanał $channel na $server_ip\n"; + } +} + + + +###################### +# ACTION=Originate, OriginateName, OriginateNameVmail - insert Originate Manager statement +###################### +if ($ACTION=="OriginateName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Jedna z tych zmiennych nie jest prawidłowy:\n"; + echo "Kanał $channel musi mieć więcej niż 2 znaki\n"; + echo "queryCID $queryCID musi mieć więcje niż 14 znaków\n"; + echo "extenName $extenName musi być ustawiony\n"; + echo "ext_context $ext_context musi być ustawiony\n"; + echo "ext_priority $ext_priority musi być ustawiony\n"; + echo "\nOriginateName Action nie wysłano\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="OriginateNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Jedna z tych zmiennych nie jest prawidłowy:\n"; + echo "Kanał $channel musi mieć więcej niż 2 znaki\n"; + echo "queryCID $queryCID musi mieć więcje niż 14 znaków\n"; + echo "extenName $extenName musi być ustawiony\n"; + echo "exten $exten musi być ustawiony\n"; + echo "ext_context $ext_context musi być ustawiony\n"; + echo "ext_priority $ext_priority musi być ustawiony\n"; + echo "\nOriginateNameVmail Action nie wysłano\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="OriginateVDRelogin") +{ + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $CIDdate = date("ymdHis"); + $DS='-'; + $SIPSAK_prefix = 'LIN-'; + print "\n"; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$campaign\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + $queryCID = "$SIPSAK_prefix$campaign$DS$CIDdate"; + + } + $ACTION="Originate"; +} + +if ($ACTION=="Originate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<10) ) + { + echo "Exten $exten nie jest prawidłowy or queryCID $queryCID nie jest prawidłowy, Originate komenda nie wstawiona\n"; + } + else + { + if (strlen($outbound_cid)>1) + {$outCID = "\"$queryCID\" <$outbound_cid>";} + else + {$outCID = "$queryCID";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate komenda wysłana do Exten $exten Kanał $channel na $server_ip\n"; + } +} + + + +###################### +# ACTION=HangupConfDial - find the Local channel that is in the conference and needs to be hung up +###################### +if ($ACTION=="HangupConfDial") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($queryCID)<15) or (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "conference $exten nie jest prawidłowy or ext_context $ext_context or queryCID $queryCID nie jest prawidłowy, Hangup komenda nie wstawiona\n"; + } + else + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $hangup_channel_prefix = "$local_DEF$exten$local_AMP$ext_context"; + + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row > 0) + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $channel=$rowx[0]; + $ACTION="Hangup"; + $queryCID = eregi_replace("^.","G",$queryCID); + } + } +} + + + +###################### +# ACTION=Hangup - insert Hangup Manager statement +###################### +if ($ACTION=="Hangup") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) ) + { + $channel_live=0; + echo "Kanał $channel nie jest prawidłowy or queryCID $queryCID nie jest prawidłowy, Hangup komenda nie wstawiona\n"; + } + else + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + +# $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# if ($row[0]==0) +# { +# $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $rowx=mysql_fetch_row($rslt); +# if ($rowx[0]==0) +# { +# $channel_live=0; +# echo "Channel $channel is not live on $call_server_ip, Hangup command not inserted\n"; +# } +# } + if ( ($auto_dial_level > 0) and (strlen($CalLCID)>2) and (strlen($exten)>2) and ($secondS > 4)) + { + $stmt="SELECT count(*) FROM vicidial_auto_calls where channel='$channel' and callerid='$CalLCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + echo "Call $CalLCID $channel nie jest aktywna na $call_server_ip, Checking Live Kanał...\n"; + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel' and extension LIKE \"%$exten\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $channel_live=0; + echo "Kanał $channel nie jest aktywna na $call_server_ip, Hangup komenda nie wstawiona $rowx[0]\n$stmt\n"; + } + else + { + echo "$stmt\n"; + } + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Hangup','$queryCID','Channel: $channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Hangup komenda wysłana do Kanał $channel na $call_server_ip\n"; + } + } +} + + + +###################### +# ACTION=Redirect, RedirectName, RedirectNameVmail, RedirectToPark, RedirectFromPark, RedirectVD, RedirectXtra, RedirectXtraCX +# - insert Redirect Manager statement using extensions name +###################### +if ($ACTION=="RedirectVD") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($campaign)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($uniqueid)<2) or (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "Jedna z tych zmiennych nie jest prawidłowy:\n"; + echo "Kanał $channel musi mieć więcej niż 2 znaki\n"; + echo "queryCID $queryCID musi mieć więcje niż 14 znaków\n"; + echo "exten $exten musi być ustawiony\n"; + echo "ext_context $ext_context musi być ustawiony\n"; + echo "ext_priority $ext_priority musi być ustawiony\n"; + echo "auto_dial_level $auto_dial_level musi być ustawiony\n"; + echo "campaign $campaign musi być ustawiony\n"; + echo "uniqueid $uniqueid musi być ustawiony\n"; + echo "lead_id $lead_id musi być ustawiony\n"; + echo "\nRedirectVD Action nie wysłano\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($auto_dial_level < 1) + { + $stmt = "UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectToPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($parkedby)<1) ) + { + $channel_live=0; + echo "Jedna z tych zmiennych nie jest prawidłowy:\n"; + echo "Kanał $channel musi mieć więcej niż 2 znaki\n"; + echo "queryCID $queryCID musi mieć więcje niż 14 znaków\n"; + echo "exten $exten musi być ustawiony\n"; + echo "extenName $extenName musi być ustawiony\n"; + echo "ext_context $ext_context musi być ustawiony\n"; + echo "ext_priority $ext_priority musi być ustawiony\n"; + echo "parkedby $parkedby musi być ustawiony\n"; + echo "\nRedirectToPark Action nie wysłano\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "INSERT INTO parked_channels values('$channel','$server_ip','','$extenName','$parkedby','$NOW_TIME');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectFromPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Jedna z tych zmiennych nie jest prawidłowy:\n"; + echo "Kanał $channel musi mieć więcej niż 2 znaki\n"; + echo "queryCID $queryCID musi mieć więcje niż 14 znaków\n"; + echo "exten $exten musi być ustawiony\n"; + echo "ext_context $ext_context musi być ustawiony\n"; + echo "ext_priority $ext_priority musi być ustawiony\n"; + echo "\nRedirectFromPark Action nie wysłano\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "DELETE FROM parked_channels where server_ip='$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Jedna z tych zmiennych nie jest prawidłowy:\n"; + echo "Kanał $channel musi mieć więcej niż 2 znaki\n"; + echo "queryCID $queryCID musi mieć więcje niż 14 znaków\n"; + echo "extenName $extenName musi być ustawiony\n"; + echo "ext_context $ext_context musi być ustawiony\n"; + echo "ext_priority $ext_priority musi być ustawiony\n"; + echo "\nRedirectName Action nie wysłano\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Jedna z tych zmiennych nie jest prawidłowy:\n"; + echo "Kanał $channel musi mieć więcej niż 2 znaki\n"; + echo "queryCID $queryCID musi mieć więcje niż 14 znaków\n"; + echo "extenName $extenName musi być ustawiony\n"; + echo "exten $exten musi być ustawiony\n"; + echo "ext_context $ext_context musi być ustawiony\n"; + echo "ext_priority $ext_priority musi być ustawiony\n"; + echo "\nRedirectNameVmail Action nie wysłano\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectXtraCX") +{ + $DBout=''; + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "Jedna z tych zmiennych nie jest prawidłowy:\n"; + echo "Kanał $channel musi mieć więcej niż 2 znaki\n"; + echo "ExtraKanał $extrachannel musi mieć więcej niż 2 znaki\n"; + echo "queryCID $queryCID musi mieć więcje niż 14 znaków\n"; + echo "exten $exten musi być ustawiony\n"; + echo "ext_context $ext_context musi być ustawiony\n"; + echo "ext_priority $ext_priority musi być ustawiony\n"; + echo "\nRedirect Action nie wysłano\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDCXC|$filename|$user|$campaign|$channel|$extrachannel|$queryCID|$exten|$ext_context|ext_priority|\n"); + fclose($fp); + } + } + } + else + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Kanał $channel nie jest aktywna na $call_server_ip, Redirect komenda nie wstawiona\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel nie jest aktywna na $call_server_ip";} + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Kanał $channel nie jest aktywna na $server_ip, Redirect komenda nie wstawiona\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel nie jest aktywna na $server_ip";} + } + } + if ( ($channel_liveX==1) && ($channel_liveY==1) ) + { + $stmt="SELECT count(*) FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0] < 1) + { + $channel_liveY=0; + echo "No Local agent to send call to, Redirect komenda nie wstawiona\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "No Local agent to send call to";} + } + else + { + $stmt="SELECT server_ip,conf_exten,user FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $dest_server_ip = $rowx[0]; + $dest_session_id = $rowx[1]; + $dest_user = $rowx[2]; + $S='*'; + + $D_s_ip = explode('.', $dest_server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$dest_session_id$S$lead_id$S$dest_user$S$phone_code$S$phone_number$S$campaign$S"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','$queryCID','Channel: $extrachannel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtraCX komenda wysłana do Kanał $channel na $call_server_ip and \nHungup $extrachannel na $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel na $call_server_ip, Hungup $extrachannel na $server_ip";} + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "Changed to Redirect: $channel na $server_ip";} + } + + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDCXC|$filename|$user|$campaign|$DBout|\n"); + fclose($fp); + } + } + + } +} + +if ($ACTION=="RedirectXtra") +{ + if ($channel=="$extrachannel") + {$ACTION="Redirect";} + else + { + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "Jedna z tych zmiennych nie jest prawidłowy:\n"; + echo "Kanał $channel musi mieć więcej niż 2 znaki\n"; + echo "ExtraKanał $extrachannel musi mieć więcej niż 2 znaki\n"; + echo "queryCID $queryCID musi mieć więcje niż 14 znaków\n"; + echo "exten $exten musi być ustawiony\n"; + echo "ext_context $ext_context musi być ustawiony\n"; + echo "ext_priority $ext_priority musi być ustawiony\n"; + echo "\nRedirect Action nie wysłano\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDX|$filename|$user|$campaign|$$channel|$extrachannel|$queryCID|$exten|$ext_context|ext_priority|\n"); + fclose($fp); + } + } + } + else + { + if ($exten == "NEXTAVAILABLE") + { + $stmt="SELECT conf_exten FROM conferences where server_ip='$server_ip' and ((extension='') or (extension is null)) limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if (strlen($row[0]) > 3) + { + $stmt="UPDATE conferences set extension='$user' where server_ip='$server_ip' and conf_exten='$row[0]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $exten = $row[0]; + } + else + { + $channel_liveX=0; + echo "Nie mogę znaleźć wolnej konferencji na $server_ip, Redirect komenda nie wstawiona\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "Nie mogę znaleźć wolnej konferencji na $server_ip";} + } + } + + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Kanał $channel nie jest aktywna na $call_server_ip, Redirect komenda nie wstawiona\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel nie jest aktywna na $call_server_ip";} + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Kanał $channel nie jest aktywna na $server_ip, Redirect komenda nie wstawiona\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel nie jest aktywna na $server_ip";} + } + } + if ( ($channel_liveX==1) && ($channel_liveY==1) ) + { + if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','ExtraChannel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra komenda wysłana do Kanał $channel and \nExtraKanał $extrachannel\n to $exten na $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel and $extrachannel to $exten na $server_ip";} + } + else + { + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$exten"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra komenda wysłana do Kanał $channel na $call_server_ip and \nExtraKanał $extrachannel\n to $exten na $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel/$call_server_ip and $extrachannel/$server_ip to $exten";} + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + + } + + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDX|$filename|$user|$campaign|$DBout|\n"); + fclose($fp); + } + } + + } + } +} + + +if ($ACTION=="Redirect") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Jedna z tych zmiennych nie jest prawidłowy:\n"; + echo "Kanał $channel musi mieć więcej niż 2 znaki\n"; + echo "queryCID $queryCID musi mieć więcje niż 14 znaków\n"; + echo "exten $exten musi być ustawiony\n"; + echo "ext_context $ext_context musi być ustawiony\n"; + echo "ext_priority $ext_priority musi być ustawiony\n"; + echo "\nRedirect Action nie wysłano\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Kanał $channel nie jest aktywna na $server_ip, Redirect komenda nie wstawiona\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "Redirect komenda wysłana do Kanał $channel na $server_ip\n"; + } + } +} + + + +###################### +# ACTION=Monitor or Stop Monitor - insert Monitor/StopMonitor Manager statement to start recording on a channel +###################### +if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) +{ + if ($ACTION=="StopMonitor") + {$SQLfile = "";} + else + {$SQLfile = "File: $filename";} + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Kanał $channel nie jest prawidłowy or queryCID $queryCID nie jest prawidłowy or filename: $filename nie jest prawidłowy, $ACTION komenda nie wstawiona\n"; + } + else + { + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Kanał $channel nie jest aktywna na $server_ip, $ACTION komenda nie wstawiona\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','$ACTION','$queryCID','Channel: $channel','$SQLfile','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + if ($ACTION=="Monitor") + { + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + } + echo "$ACTION komenda wysłana do Kanał $channel na $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n"; + } + } +} + + + + + + +###################### +# ACTION=MonitorConf or StopMonitorConf - insert Monitor/StopMonitor Manager statement to start recording on a conference +###################### +if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($channel)<4) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Kanał $channel nie jest prawidłowy or exten $exten nie jest prawidłowy or filename: $filename nie jest prawidłowy, $ACTION komenda nie wstawiona\n"; + } + else + { + + if ($ACTION=="MonitorConf") + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$filename','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $filename','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + # find and hang up all recordings going na in this conference # and extension = '$exten' + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$channel%\" and channel LIKE \"%,1\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + # $rec_count = intval(mysql_num_rows($rslt) / 2); + $rec_count = mysql_num_rows($rslt); + $h=0; + while ($rec_count>$h) + { + $rowx=mysql_fetch_row($rslt); + $HUchannel[$h] = $rowx[0]; + $h++; + } + $i=0; + while ($h>$i) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$i','Channel: $HUchannel[$i]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $i++; + } + + } + echo "$ACTION komenda wysłana do Kanał $channel na $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n NAGRYWANIE BĘDZIE TRWAĆ MAKSYMALNIE 60 MINUT\n"; + } +} + + + + + +###################### +# ACTION=VolumeControl - raise or lower the volume of a meetme participant +###################### +if ($ACTION=="VolumeControl") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($stage)<1) or (strlen($queryCID)<1) ) + { + echo "Konferencja $exten, Stage $stage nie jest prawidłowy or queryCID $queryCID nie jest prawidłowy, Originate komenda nie wstawiona\n"; + } + else + { + $participant_number='XXYYXXYYXXYYXX'; + if (eregi('UP',$stage)) {$vol_prefix='4';} + if (eregi('DOWN',$stage)) {$vol_prefix='3';} + if (eregi('UNMUTE',$stage)) {$vol_prefix='2';} + if (eregi('MUTING',$stage)) {$vol_prefix='1';} + $local_DEF = 'Local/'; + $local_AMP = '@'; + $volume_local_channel = "$local_DEF$participant_number$vol_prefix$exten$local_AMP$ext_context"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $volume_local_channel','Context: $ext_context','Exten: 8300','Priority: 1','Callerid: $queryCID','','','','$channel','$exten');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Volume komenda wysłana do Konferencja $exten, Stage $stage Kanał $channel na $server_ip\n"; + } +} + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='debug') {echo "\n";} +if ($format=='debug') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/park_calls_display.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/park_calls_display.php new file mode 100644 index 00000000..ff697873 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/park_calls_display.php @@ -0,0 +1,146 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "Nieprawidłowy NazwaUżytkownika/Hasło: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) { + echo "Nieprawidłowy server_ip: |$server_ip| or Nieprawidłowy 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 "Nieprawidłowy session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Zawieszone rozmowy"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten nie jest prawidłowy lub protokół $protocol nie jest prawidłowy\n"; + exit; + } + else + { + ##### print parked calls from the parked_channels table + $stmt="SELECT * from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;"; + if ($format=='debug') {echo "\n";} + $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"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/vdc_db_query.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/vdc_db_query.php new file mode 100644 index 00000000..5c66d12a --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/vdc_db_query.php @@ -0,0 +1,2535 @@ + LICENSE: GPLv2 +# +# 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 - ('regCLOSER','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCALL','manDiaLlogCALL','userLOGout','updateDISPO','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs','CalLBacKLisT','CalLBacKCounT','PauseCodeSubmit','LogiNCamPaigns') +# - $stage - ('start','finish','lookup','new') +# - $closer_choice - ('CL_TESTCAMP_L CL_OUT123_L -') +# - $conf_exten - ('8600011',...) +# - $exten - ('123test',...) +# - $ext_context - ('default','demo',...) +# - $ext_priority - ('1','2',...) +# - $campaign - ('testcamp',...) +# - $dial_timeout - ('60','26',...) +# - $dial_prefix - ('9','8',...) +# - $campaign_cid - ('3125551212','0000000000',...) +# - $MDnextCID - ('M06301413000000002',...) +# - $uniqueid - ('1120232758.2406800',...) +# - $lead_id - ('36524',...) +# - $list_id - ('101','123456',...) +# - $length_in_sec - ('12',...) +# - $phone_code - ('1',...) +# - $phone_number - ('3125551212',...) +# - $channel - ('Zap/12-1',...) +# - $start_epoch - ('1120236911',...) +# - $vendor_lead_code - ('1234test',...) +# - $title - ('Mr.',...) +# - $first_name - ('Bob',...) +# - $middle_initial - ('L',...) +# - $last_name - ('Wilson',...) +# - $address1 - ('1324 Main St.',...) +# - $address2 - ('Apt. 12',...) +# - $address3 - ('co Robert Wilson',...) +# - $city - ('Chicago',...) +# - $state - ('IL',...) +# - $province - ('NA',...) +# - $postal_code - ('60054',...) +# - $country_code - ('USA',...) +# - $gender - ('M',...) +# - $date_of_birth - ('1970-01-01',...) +# - $alt_phone - ('3125551213',...) +# - $email - ('bob@bob.com',...) +# - $security_phrase - ('Hello',...) +# - $comments - ('Good Customer',...) +# - $auto_dial_level - ('0','1','1.2',...) +# - $VDstop_rec_after_each_call - ('0','1') +# - $conf_silent_prefix - ('7','8','',...) +# - $extension - ('123','user123','25-1',...) +# - $protocol - ('Zap','SIP','IAX2',...) +# - $user_abb - ('1234','6666',...) +# - $preview - ('YES','NO',...) +# - $called_count - ('0','1','2',...) +# - $agent_log_id - ('123456',...) +# - $agent_log - ('NO',...) +# - $favorites_list - (",'cc160','cc100'",...) +# - $CallBackDatETimE - ('2006-04-21 14:30:00',...) +# - $recipient - ('ANYONE,'USERONLY') +# - $callback_id - ('12345','12346',...) +# - $use_internal_dnc - ('Y','N') +# - $omit_phone_code - ('Y','N') +# - $no_delete_sessions - ('0','1') + +# CHANGELOG: +# 50629-1044 - First build of script +# 50630-1422 - Added manual dial action and MD channel lookup +# 50701-1451 - Added dial log for start and end of vicidial calls +# 50705-1239 - Added call disposition update +# 50804-1627 - Fixed updateDispo to update vicidial_log entry +# 50816-1605 - Added VDADpause/ready for auto dialing +# 50816-1811 - Added basic autodial call pickup functions +# 50817-1005 - Altered logging functions to accomodate auto_dialing +# 50818-1305 - Added stop-all-recordings-after-each-vicidial-call option +# 50818-1411 - Added hangup of agent phone after Logout +# 50901-1315 - Fixed CLOSER IN-GROUP Web Form bug +# 50902-1507 - Fixed CLOSER log length_in_sec bug +# 50902-1730 - Added functions for manual preview dialing and revert +# 50913-1214 - Added agent random update to leadupdate +# 51020-1421 - Added agent_log_id framework for detailed agent activity logging +# 51021-1717 - Allows for multi-line comments (changes \n to !N in database) +# 51111-1046 - Added vicidial_agent_log lead_id earlier for manual dial +# 51121-1445 - Altered echo statements for several small PHP speed optimizations +# 51122-1328 - Fixed UserLogout issue not removing conference reservation +# 51129-1012 - Added ability to accept calls from other VICIDIAL servers +# 51129-1729 - Changed manual dial to use the '/n' flag for calls +# 51221-1154 - Added SCRIPT id lookup and sending to vicidial.php for display +# 60105-1059 - Added Updating of astguiclient favorites in the DB +# 60208-1617 - Added dtmf buttons output per call +# 60213-1521 - Added closer_campaigns update to vicidial_users +# 60215-1036 - Added Callback date-time entry into vicidial_callbacks table +# 60413-1541 - Added USERONLY Callback listings output - CalLBacKLisT +# - Added USERONLY Callback count output - CalLBacKCounT +# 60414-1140 - Added Callback lead lookup for manual dialing +# 60419-1517 - After CALLBK is sent to agent, update callback record to INACTIVE +# 60421-1419 - Check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60427-1236 - Fixed closer_choice error for CLOSER campaigns +# 60609-1148 - Added ability to check for manual dial numbers in DNC +# 60619-1117 - Added variable filters to close security holes for login form +# 60623-1414 - Fixed variable filter for phone_code and fixed manual dial logic +# 60821-1600 - Added ability to omit the phone code on vicidial lead dialing +# 60821-1647 - Added ability to not delete sessions at logout +# 60906-1124 - Added lookup and sending of callback data for CALLBK calls +# 61128-2229 - Added vicidial_live_agents and vicidial_auto_calls manual dial entries +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70115-1733 - Added alt_dial functionality in auto-dial modes +# 70118-1501 - Added user_group to vicidial_log,_agent_log,_closer_log,_callbacks +# 70123-1357 - Fixed bug that would not update vicidial_closer_log status to dispo +# 70202-1438 - Added pause code submit function +# 70203-0930 - Added dialed_number to lead info output +# 70203-1030 - Added dialed_label to lead info output +# 70206-1126 - Added INBOUND status for inbound/closer calls in vicidial_live_agents +# 70212-1253 - Fixed small issue with CXFER +# 70213-1431 - Added QueueMetrics PAUSE/UNPAUSE/AGENTLOGIN/AGENTLOGOFF actions +# 70214-1231 - Added queuemetrics_log_id field for server_id in queue_log +# 70215-1210 - Added queuemetrics COMPLETEAGENT action +# 70216-1051 - Fixed double call complete queuemetrics logging +# 70222-1616 - Changed queue_log PAUSE/UNPAUSE to PAUSEALL/UNPAUSEALL +# 70309-1034 - Allow amphersands and questions marks in comments to pass through +# 70313-1052 - Allow pound signs(hash) in comments to pass through +# 70319-1544 - Added agent disable update customer data function +# 70322-1545 - Added sipsak display ability +# 70413-1253 - Fixed bug for outbound call time in CLOSER-type blended campaigns +# 70424-1100 - Fixed bug for fronter/closer calls that would delete vdac records +# 70802-1729 - Fixed bugs with pause_sec and wait_sec under certain call handling +# 70828-1443 - Added source_id to output of SCRIPTtab-IFRAME and WEBFORM +# 71029-1855 - removed campaign_id naming restrictions for CLOSER-type campaigns +# 71030-2047 - added hopper priority for auto alt dial entries +# 71116-1011 - added calls_today count updating of the vicidial_live_agents upon INCALL +# 71120-1520 - added LogiNCamPaigns to show only allowed campaigns for agents upon login +# 71125-1751 - Added inbound-group default inbound group sending to vicidial.php +# 71129-2025 - restricted callbacks count and list to campaign only +# + +$version = '2.0.4-65'; +$build = '71129-2025'; + +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["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["closer_choice"])) {$closer_choice=$_GET["closer_choice"];} + elseif (isset($_POST["closer_choice"])) {$closer_choice=$_POST["closer_choice"];} +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["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["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["dial_timeout"])) {$dial_timeout=$_GET["dial_timeout"];} + elseif (isset($_POST["dial_timeout"])) {$dial_timeout=$_POST["dial_timeout"];} +if (isset($_GET["dial_prefix"])) {$dial_prefix=$_GET["dial_prefix"];} + elseif (isset($_POST["dial_prefix"])) {$dial_prefix=$_POST["dial_prefix"];} +if (isset($_GET["campaign_cid"])) {$campaign_cid=$_GET["campaign_cid"];} + elseif (isset($_POST["campaign_cid"])) {$campaign_cid=$_POST["campaign_cid"];} +if (isset($_GET["MDnextCID"])) {$MDnextCID=$_GET["MDnextCID"];} + elseif (isset($_POST["MDnextCID"])) {$MDnextCID=$_POST["MDnextCID"];} +if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} + elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["length_in_sec"])) {$length_in_sec=$_GET["length_in_sec"];} + elseif (isset($_POST["length_in_sec"])) {$length_in_sec=$_POST["length_in_sec"];} +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["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["start_epoch"])) {$start_epoch=$_GET["start_epoch"];} + elseif (isset($_POST["start_epoch"])) {$start_epoch=$_POST["start_epoch"];} +if (isset($_GET["dispo_choice"])) {$dispo_choice=$_GET["dispo_choice"];} + elseif (isset($_POST["dispo_choice"])) {$dispo_choice=$_POST["dispo_choice"];} +if (isset($_GET["vendor_lead_code"])) {$vendor_lead_code=$_GET["vendor_lead_code"];} + elseif (isset($_POST["vendor_lead_code"])) {$vendor_lead_code=$_POST["vendor_lead_code"];} +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["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["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_GET["VDstop_rec_after_each_call"];} + elseif (isset($_POST["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_POST["VDstop_rec_after_each_call"];} +if (isset($_GET["conf_silent_prefix"])) {$conf_silent_prefix=$_GET["conf_silent_prefix"];} + elseif (isset($_POST["conf_silent_prefix"])) {$conf_silent_prefix=$_POST["conf_silent_prefix"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} +if (isset($_GET["user_abb"])) {$user_abb=$_GET["user_abb"];} + elseif (isset($_POST["user_abb"])) {$user_abb=$_POST["user_abb"];} +if (isset($_GET["preview"])) {$preview=$_GET["preview"];} + elseif (isset($_POST["preview"])) {$preview=$_POST["preview"];} +if (isset($_GET["called_count"])) {$called_count=$_GET["called_count"];} + elseif (isset($_POST["called_count"])) {$called_count=$_POST["called_count"];} +if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];} + elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];} +if (isset($_GET["agent_log"])) {$agent_log=$_GET["agent_log"];} + elseif (isset($_POST["agent_log"])) {$agent_log=$_POST["agent_log"];} +if (isset($_GET["favorites_list"])) {$favorites_list=$_GET["favorites_list"];} + elseif (isset($_POST["favorites_list"])) {$favorites_list=$_POST["favorites_list"];} +if (isset($_GET["CallBackDatETimE"])) {$CallBackDatETimE=$_GET["CallBackDatETimE"];} + elseif (isset($_POST["CallBackDatETimE"])) {$CallBackDatETimE=$_POST["CallBackDatETimE"];} +if (isset($_GET["recipient"])) {$recipient=$_GET["recipient"];} + elseif (isset($_POST["recipient"])) {$recipient=$_POST["recipient"];} +if (isset($_GET["callback_id"])) {$callback_id=$_GET["callback_id"];} + elseif (isset($_POST["callback_id"])) {$callback_id=$_POST["callback_id"];} +if (isset($_GET["use_internal_dnc"])) {$use_internal_dnc=$_GET["use_internal_dnc"];} + elseif (isset($_POST["use_internal_dnc"])) {$use_internal_dnc=$_POST["use_internal_dnc"];} +if (isset($_GET["omit_phone_code"])) {$omit_phone_code=$_GET["omit_phone_code"];} + elseif (isset($_POST["omit_phone_code"])) {$omit_phone_code=$_POST["omit_phone_code"];} +if (isset($_GET["phone_ip"])) {$phone_ip=$_GET["phone_ip"];} + elseif (isset($_POST["phone_ip"])) {$phone_ip=$_POST["phone_ip"];} +if (isset($_GET["enable_sipsak_messages"])) {$enable_sipsak_messages=$_GET["enable_sipsak_messages"];} + elseif (isset($_POST["enable_sipsak_messages"])) {$enable_sipsak_messages=$_POST["enable_sipsak_messages"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} + + +$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); + + +# default optional vars if not set +if (!isset($format)) {$format="text";} + if ($format == 'debug') {$DB=1;} +if (!isset($ACTION)) {$ACTION="refresh";} + +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$CIDdate = date("mdHis"); +$ENTRYdate = date("YmdHis"); +if (!isset($query_date)) {$query_date = $NOW_DATE;} +$MT[0]=''; +$agents='@agents'; + +if ($ACTION == 'LogiNCamPaigns') + { + $skip_user_validation=1; + } +else + { + $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 "Nieprawidłowy NazwaUżytkownika/Hasło: |$user|$pass|\n"; + exit; + } + else + { + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Nieprawidłowy server_ip: |$server_ip| or Nieprawidłowy 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 "Nieprawidłowy session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } +} + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDiaL Skrypt zapytań do bazy danych"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + +################################################################################ +### LogiNCamPaigns - generates an HTML SELECT list of allowed campaigns for a +### specific agent on the login screen +################################################################################ +if ($ACTION == 'LogiNCamPaigns') +{ + if ( (strlen($user)<1) ) + { + echo "\n"; + exit; + } + else + { + echo "\n"; + exit; + } +} + + + +################################################################################ +### regCLOSER - update the vicidial_live_agents table to reflect the closer +### inbound choices made upon login +################################################################################ +if ($ACTION == 'regCLOSER') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($closer_choice)<1) || (strlen($user)<1) ) + { + $channel_live=0; + echo "Wybór grupowy $closer_choice nie jest prawidłowy\n"; + exit; + } + else + { + if ($closer_choice == "MGRLOCK-") + { + $stmt="SELECT closer_campaigns FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $closer_choice =$row[0]; + + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_users set closer_campaigns='$closer_choice' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $in_groups_pre = preg_replace('/-$/','',$closer_choice); + $in_groups = explode(" ",$in_groups_pre); + $in_groups_ct = count($in_groups); + $k=1; + while ($k < $in_groups_ct) + { + if (strlen($in_groups[$k])>1) + { + $stmt="SELECT group_weight,calls_today FROM vicidial_inbound_group_agents where user='$user' and group_id='$in_groups[$k]';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $viga_ct = mysql_num_rows($rslt); + if ($viga_ct > 0) + { + $row=mysql_fetch_row($rslt); + $group_weight = $row[0]; + $calls_today = $row[1]; + } + else + { + $group_weight = 0; + $calls_today = 0; + } + $stmt="INSERT INTO vicidial_live_inbound_agents set user='$user',group_id='$in_groups[$k]',group_weight='$group_weight',calls_today='$calls_today',last_call_time='$NOW_TIME',last_call_finish='$NOW_TIME';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + $k++; + } + + } + echo "Closer In Wybór grupowy $closer_choice został zarejestrowny dla użytkownika $user\n"; +} + + +################################################################################ +### manDiaLnextCALL - for manual VICIDiaL dialing this will grab the next lead +### in the campaign, reserve it, send data back to client and +### place the call by inserting into vicidial_manager +################################################################################ +if ($ACTION == 'manDiaLnextCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "Zasobnik pusty\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context nie jest prawidłowy\n"; + exit; + } + else + { + + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### check if this is a callback, if it is, skip the grabbing of a new lead and mark the callback as INACTIVE + if ( (strlen($callback_id)>0) and (strlen($lead_id)>0) ) + { + $affected_rows=1; + $CBleadIDset=1; + + $stmt = "UPDATE vicidial_callbacks set status='INACTIVE' where callback_id='$callback_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + if (strlen($phone_number)>3) + { + if ($use_internal_dnc=='Y') + { + $stmt="SELECT count(*) FROM vicidial_dnc where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + echo "DNC NUMER\n"; + exit; + } + } + if ($stage=='lookup') + { + $stmt="SELECT lead_id FROM vicidial_list where phone_number='$phone_number' order by modify_date desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $man_leadID_ct = mysql_num_rows($rslt); + if ($man_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $affected_rows=1; + $lead_id =$row[0]; + $CBleadIDset=1; + } + else + { + ### insert a new lead in the system with this phone number + $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $lead_id = mysql_insert_id($link); + $CBleadIDset=1; + } + } + else + { + ### insert a new lead in the system with this phone number + $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $lead_id = mysql_insert_id($link); + $CBleadIDset=1; + } + } + else + { + ### grab the next lead in the hopper for this campaign and reserve it for the user + $stmt = "UPDATE vicidial_hopper set status='QUEUE', user='$user' where campaign_id='$campaign' and status='READY' order by hopper_id LIMIT 1"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + } + } + + if ($affected_rows > 0) + { + if (!$CBleadIDset) + { + ##### grab the lead_id of the reserved user in vicidial_hopper + $stmt="SELECT lead_id FROM vicidial_hopper where campaign_id='$campaign' and status='QUEUE' and user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $hopper_leadID_ct = mysql_num_rows($rslt); + if ($hopper_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + } + } + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $source_id = trim("$row[6]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + $called_count++; + + ##### check if system is set to generate logfile for transfers + $stmt="SELECT enable_agc_xfer_log FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enable_agc_xfer_log_ct = mysql_num_rows($rslt); + if ($enable_agc_xfer_log_ct > 0) + { + $row=mysql_fetch_row($rslt); + $enable_agc_xfer_log =$row[0]; + } + + if ( ($WeBRooTWritablE > 0) and ($enable_agc_xfer_log > 0) ) + { + # DATETIME|campaign|lead_id|phone_number|user|type + # 2007-08-22 11:11:11|TESTCAMP|65432|3125551212|1234|M + $fp = fopen ("./xfer_log.txt", "a"); + fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$phone_number|$user|M\n"); + fclose($fp); + } + + ##### if lead is a callback, grab the callback comments + $CBentry_time = ''; + $CBcallback_time = ''; + $CBuser = ''; + $CBcomments = ''; + if (ereg("CALLBK",$dispo)) + { + $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBentry_time = trim("$row[0]"); + $CBcallback_time = trim("$row[1]"); + $CBuser = trim("$row[2]"); + $CBcomments = trim("$row[3]"); + } + } + + ### flag the lead as called and change it's status to INCALL + $stmt = "UPDATE vicidial_list set status='INCALL', called_since_last_reset='Y', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + if (!$CBleadIDset) + { + ### delete the lead from the hopper + $stmt = "DELETE FROM vicidial_hopper where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $stmt="UPDATE vicidial_agent_log set lead_id='$lead_id',comments='MANUAL' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + ### if preview dialing, do not send the call + if ( (strlen($preview)<1) || ($preview == 'NO') ) + { + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### whether to omit phone_code or not + if (eregi('Y',$omit_phone_code)) + {$Ndialstring = "$Local_out_prefix$phone_number";} + else + {$Ndialstring = "$Local_out_prefix$phone_code$phone_number";} + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$server_ip','$campaign','XFER','$lead_id','$MqueryCID','$phone_code','$phone_number','$NOW_TIME','OUT')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',callerid='$MqueryCID',lead_id='$lead_id',comments='MANUAL',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update calls_today count in vicidial_campaign_agents + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $MqueryCID . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + $LeaD_InfO .= $CBentry_time . "\n"; + $LeaD_InfO .= $CBcallback_time . "\n"; + $LeaD_InfO .= $CBuser . "\n"; + $LeaD_InfO .= $CBcomments . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= "MAIN\n"; + $LeaD_InfO .= $source_id . "\n"; + + echo $LeaD_InfO; + + } + else + { + echo "Zasobnik pusty\n"; + } + } +} + + +################################################################################ +### manDiaLskip - for manual VICIDiaL dialing this skips the lead that was +### previewed in the step above and puts it back in orig status +################################################################################ +if ($ACTION == 'manDiaLskip') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($stage)<1) || (strlen($called_count)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "LEAD NOT REVERTED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context nie jest prawidłowy\n"; + exit; + } + else + { + $called_count = ($called_count - 1); + ### flag the lead as called and change it's status to INCALL + $stmt = "UPDATE vicidial_list set status='$stage', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + + echo "LEAD REVERTED\n"; + } +} + + +################################################################################ +### manDiaLonly - for manual VICIDiaL dialing this sends the call that was +### previewed in the step above +################################################################################ +if ($ACTION == 'manDiaLonly') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) || (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo " Rozmowa NOT PLACED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context nie jest prawidłowy\n"; + exit; + } + else + { + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### whether to omit phone_code or not + if (eregi('Y',$omit_phone_code)) + {$Ndialstring = "$Local_out_prefix$phone_number";} + else + {$Ndialstring = "$Local_out_prefix$phone_code$phone_number";} + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$server_ip','$campaign','XFER','$lead_id','$MqueryCID','$phone_code','$phone_number','$NOW_TIME','OUT')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',callerid='$MqueryCID',lead_id='$lead_id',comments='MANUAL',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + echo "$MqueryCID\n"; + } +} + + +################################################################################ +### manDiaLlookCALL - for manual VICIDiaL dialing this will attempt to look up +### the trunk channel that the call was placed on +################################################################################ +if ($ACTION == 'manDiaLlookCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; +if (strlen($MDnextCID)<18) + { + echo "NO\n"; + echo "MDnextCID $MDnextCID nie jest prawidłowy\n"; + exit; + } +else + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT uniqueid,channel FROM vicidial_manager where callerid='$MDnextCID' and server_ip='$server_ip' and status='UPDATED' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $uniqueid =$row[0]; + $channel =$row[1]; + echo "$uniqueid\n$channel"; + + $wait_sec=0; + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',wait_epoch='$StarTtime',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + echo "NO\n"; + } + } +} + + + +################################################################################ +### manDiaLlogCALL - for manual VICIDiaL logging of calls places record in +### vicidial_log and then sends process to call_log entry +################################################################################ +if ($ACTION == 'manDiaLlogCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + +if ($stage == "start") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) || (strlen($list_id)<1) || (strlen($phone_number)<1) || (strlen($campaign)<1) ) + { + echo "Dziennik nie zapisany\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id or list_id: $list_id or phone_number: $phone_number or campaign: $campaign nie jest prawidłowy\n"; + exit; + } + else + { + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + ##### insert log into vicidial_log for manual VICIDiaL call + $stmt="INSERT INTO vicidial_log (uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,comments,processed,user_group) values('$uniqueid','$lead_id','$list_id','$campaign','$NOW_TIME','$StarTtime','INCALL','$phone_code','$phone_number','$user','MANUAL','N','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "VICIDiaL_LOG Wstawiony: $uniqueid|$channel|$NOW_TIME\n"; + echo "$StarTtime\n"; + } + else + { + echo "Dziennik nie zapisany\n"; + } + + $stmt = "UPDATE vicidial_auto_calls SET uniqueid='$uniqueid' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + # ##### insert log into call_log for manual VICIDiaL call + # $stmt = "INSERT INTO call_log (uniqueid,channel,server_ip,extension,number_dialed,caller_code,start_time,start_epoch) values('$uniqueid','$channel','$server_ip','$exten','$phone_code$phone_number','MD $user $lead_id','$NOW_TIME','$StarTtime')"; + # if ($DB) {echo "$stmt\n";} + # $rslt=mysql_query($stmt, $link); + # $affected_rows = mysql_affected_rows($link); + + # if ($affected_rows > 0) + # { + # echo "CALL_LOG Wstawiony: $uniqueid|$channel|$NOW_TIME"; + # } + # else + # { + # echo "Dziennik nie zapisany\n"; + # } + } + } + +if ($stage == "end") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) ) + { + echo "Dziennik nie zapisany\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id nie jest prawidłowy\n"; + exit; + } + else + { + if ($start_epoch < 1000) + { + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + ##### look for the start epoch in the vicidial_closer_log table + $stmt="SELECT start_epoch FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user' order by closecallid desc limit 1;"; + } + else + { + ##### look for the start epoch in the vicidial_log table + $stmt="SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + } + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch =$row[0]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($length_in_sec < 1) and ($row[0] > 0) ) + { + ##### start epoch in the vicidial_log table, couldn't find one in vicidial_closer_log + $stmt="SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch =$row[0]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + } + } + else {$length_in_sec = ($StarTtime - $start_epoch);} + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec',status='DONE' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + + if ($auto_dial_level > 0) + { + ### check to see if campaign has alt_dial enabled + $stmt="SELECT auto_alt_dial FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_alt_dial =$row[0]; + } + else {$auto_alt_dial = 'NONE';} + if (eregi("(ALT_ONLY|ADDR3_ONLY|ALT_AND_ADDR3)",$auto_alt_dial)) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT alt_dial FROM vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alt_dial =$row[0]; + } + else {$alt_dial = 'NONE';} + + if ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("(ALT_ONLY|ALT_AND_ADDR3)",$auto_alt_dial)) ) + { + $stmt="SELECT alt_phone,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alt_phone = $row[0]; + $alt_phone = eregi_replace("[^0-9]","",$alt_phone); + $gmt_offset_now = $row[1]; + $state = $row[2]; + } + else {$alt_phone = '';} + if (strlen($alt_phone)>5) + { + ### insert record into vicidial_hopper for alt_phone call attempt + $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ALT',user='',priority='25';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + } + if ( ( (eregi("(ALT)",$alt_dial)) and (eregi("ALT_AND_ADDR3",$auto_alt_dial)) ) or ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("ADDR3_ONLY",$auto_alt_dial)) ) ) + { + $stmt="SELECT address3,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $address3 = $row[0]; + $address3 = eregi_replace("[^0-9]","",$address3); + $gmt_offset_now = $row[1]; + $state = $row[2]; + } + else {$address3 = '';} + if (strlen($address3)>5) + { + ### insert record into vicidial_hopper for address3 call attempt + $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ADDR3',user='',priority='20';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + + if ($enable_queuemetrics_logging > 0) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_qm_ct = mysql_num_rows($rslt); + if ($VAC_qm_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_call_id = $row[0]; + $CLlead_id = $row[1]; + $CLphone_number = $row[2]; + $CLstatus = $row[3]; + $CLcampaign_id = $row[4]; + $CLphone_code = $row[5]; + $CLalt_dial = $row[6]; + $CLstage = $row[7]; + $CLcallerid = $row[8]; + $CLuniqueid = $row[9]; + } + + $CLstage = preg_replace("/.*-/",'',$CLstage); + if (strlen($CLstage) < 1) {$CLstage=0;} + + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt="SELECT count(*) from queue_log where call_id='$MDnextCID' and verb='COMPLETECALLER';"; + $rslt=mysql_query($stmt, $linkB); + if ($DB) {echo "$stmt\n";} + $VAC_cc_ct = mysql_num_rows($rslt); + if ($VAC_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $caller_complete = $row[0]; + } + + if ($caller_complete < 1) + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + } + mysql_close($linkB); + } + + ### delete call record from vicidial_auto_calls + $stmt = "DELETE from vicidial_auto_calls where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + + + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',lead_id='',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PRZERWAALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } + else + { + if ($enable_queuemetrics_logging > 0) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_qm_ct = mysql_num_rows($rslt); + if ($VAC_qm_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_call_id = $row[0]; + $CLlead_id = $row[1]; + $CLphone_number = $row[2]; + $CLstatus = $row[3]; + $CLcampaign_id = $row[4]; + $CLphone_code = $row[5]; + $CLalt_dial = $row[6]; + $CLstage = $row[7]; + $CLcallerid = $row[8]; + $CLuniqueid = $row[9]; + } + + $CLstage = preg_replace("/XFER|-/",'',$CLstage); + if ($CLstage < 0.25) {$CLstage=0;} + + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + + $stmt = "DELETE from vicidial_auto_calls lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',lead_id='',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PRZERWAALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } + + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' where uniqueid='$uniqueid' and lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "$uniqueid\n$channel\n"; + } + else + { + echo "Dziennik nie zapisany\n\n"; + } + } + + echo $VDstop_rec_after_each_call . '|' . $extension . '|' . $conf_silent_prefix . '|' . $conf_exten . '|' . $user_abb . "|\n"; + + ##### if VICIDiaL call and hangup_after_each_call activated, find all recording + ##### channels and hang them up while entering info into recording_log and + ##### returning filename/recordingID + if ($VDstop_rec_after_each_call == 1) + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $total_rec=0; + $loop_count=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten' order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$rec_list = mysql_num_rows($rslt);} + while ($rec_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + if (preg_match("/Local\/$conf_silent_prefix$conf_exten\@/i",$row[0])) + { + $rec_channels[$total_rec] = "$row[0]"; + $total_rec++; + } + if ($format=='debug') {echo "\n";} + $loop_count++; + } + + $total_recFN=0; + $loop_count=0; + $filename=$MT; # not necessary : and cmd_line_f LIKE \"%_$user_abb\" + $stmt="SELECT cmd_line_f FROM vicidial_manager where server_ip='$server_ip' and action='Originate' and cmd_line_b = 'Channel: $local_DEF$conf_silent_prefix$conf_exten$local_AMP$ext_context' order by entry_date desc limit $total_rec;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$recFN_list = mysql_num_rows($rslt);} + while ($recFN_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + $filename[$total_recFN] = preg_replace("/Callerid: /i","",$row[0]); + if ($format=='debug') {echo "\n";} + $total_recFN++; + $loop_count++; + } + + $loop_count=0; + while($loop_count < $total_rec) + { + if (strlen($rec_channels[$loop_count])>5) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$loop_count','Channel: $rec_channels[$loop_count]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "REC_STOP|$rec_channels[$loop_count]|$filename[$loop_count]|"; + if (strlen($filename)>2) + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename[$loop_count]'"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$fn_count = mysql_num_rows($rslt);} + if ($fn_count) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt="UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename[$loop_count]' and end_epoch is NULL;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "$recording_id|$length_in_min|"; + } + else {echo "||";} + } + else {echo "||";} + echo "\n"; + } + $loop_count++; + } + } + + + $talk_sec=0; + $StarTtime = date("U"); + $stmt = "select talk_epoch,talk_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $talk_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set talk_sec='$talk_sec',talk_epoch='$StarTtime',dispo_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } +} + + +################################################################################ +### VDADREcheckINCOMING - for auto-dial VICIDiaL dialing this will recheck for +### calls to see if the channel has updated +################################################################################ +if ($ACTION == 'VDADREcheckINCOMING') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "Kampania $campaign nie jest prawidłowy\n"; + echo "lead_id $lead_id nie jest prawidłowy\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + } + } +} + + +################################################################################ +### VDADcheckINCOMING - for auto-dial VICIDiaL dialing this will check for calls +### in the vicidial_live_agents table in QUEUE status, then +### lookup the lead info and pass it back to vicidial.php +################################################################################ +if ($ACTION == 'VDADcheckINCOMING') +{ + $Ctype = 'A'; + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "Kampania $campaign nie jest prawidłowy\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and status='QUEUE';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',comments='AUTO',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $source_id = trim("$row[6]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + ##### if lead is a callback, grab the callback comments + $CBentry_time = ''; + $CBcallback_time = ''; + $CBuser = ''; + $CBcomments = ''; + if (ereg("CALLBK",$dispo)) + { + $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBentry_time = trim("$row[0]"); + $CBcallback_time = trim("$row[1]"); + $CBuser = trim("$row[2]"); + $CBcomments = trim("$row[3]"); + } + } + + ### update the lead status to INCALL + $stmt = "UPDATE vicidial_list set status='INCALL', user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the log status to INCALL + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + $stmt = "UPDATE vicidial_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL', user_group='$user_group' where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + ### update the vicidial_closer_log user to INCALL + $stmt = "UPDATE vicidial_closer_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL', user_group='$user_group' where lead_id='$lead_id' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select campaign_id,phone_number,alt_dial from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($VDAC_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDADchannel_group =$row[0]; + $dialed_number =$row[1]; + $dialed_label =$row[2]; + } + else + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|INBND|$callerid|$user|$user_group|$list_id|$lead_id|$phone_number|$uniqueid|\n"); + fclose($fp); + } + } + + $stmt = "select count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDL_cid_ct = mysql_num_rows($rslt); + if ($VDL_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_front_VDlog =$row[0]; + } + + $stmt = "select * from vicidial_inbound_groups where group_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_group_name = $row[1]; + $VDCL_group_color = $row[2]; + $VDCL_group_web = $row[4]; + $VDCL_fronter_display = $row[7]; + $VDCL_ingroup_script = $row[8]; + $VDCL_get_call_launch = $row[9]; + $VDCL_xferconf_a_dtmf = $row[10]; + $VDCL_xferconf_a_number = $row[11]; + $VDCL_xferconf_b_dtmf = $row[12]; + $VDCL_xferconf_b_number = $row[13]; + $VDCL_default_xfer_group= $row[28]; + + ### update the comments in vicidial_live_agents record + $stmt = "UPDATE vicidial_live_agents set comments='INBOUND' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $Ctype = 'I'; + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_ingroup_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + } + + ### if web form is set then send na to vicidial.php for override of WEB_FORM address + if ( (strlen($VDCL_group_web)>5) or (strlen($VDCL_group_name)>0) ) {echo "$VDCL_group_web|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|\n";} + else {echo "|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|\n";} + + $stmt = "SELECT full_name from vicidial_users where user='$tsr';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDU_cid_ct = mysql_num_rows($rslt); + if ($VDU_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $fronter_full_name = $row[0]; + echo $fronter_full_name . '|' . $tsr . "\n"; + } + else {echo '|' . $tsr . "\n";} + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_campaign_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + echo "|||||$VDCL_campaign_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n|\n"; + + $stmt = "select phone_number,alt_dial from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($VDAC_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dialed_number =$row[0]; + $dialed_label =$row[1]; + } + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $callerid . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + $LeaD_InfO .= $CBentry_time . "\n"; + $LeaD_InfO .= $CBcallback_time . "\n"; + $LeaD_InfO .= $CBuser . "\n"; + $LeaD_InfO .= $CBcomments . "\n"; + $LeaD_InfO .= $dialed_number . "\n"; + $LeaD_InfO .= $dialed_label . "\n"; + $LeaD_InfO .= $source_id . "\n"; + + echo $LeaD_InfO; + + + + $wait_sec=0; + $StarTtime = date("U"); + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + ### If RozmowaBK, change vicidial_callback record to INACTIVE + if (eregi("CALLBK|CBHOLD", $dispo)) + { + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='$lead_id' and status NOT IN('INACTIVE','DEAD','ARCHIVE');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + ##### check if system is set to generate logfile for transfers + $stmt="SELECT enable_agc_xfer_log FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enable_agc_xfer_log_ct = mysql_num_rows($rslt); + if ($enable_agc_xfer_log_ct > 0) + { + $row=mysql_fetch_row($rslt); + $enable_agc_xfer_log =$row[0]; + } + + if ( ($WeBRooTWritablE > 0) and ($enable_agc_xfer_log > 0) ) + { + # DATETIME|campaign|lead_id|phone_number|user|type + # 2007-08-22 11:11:11|TESTCAMP|65432|3125551212|1234|A + $fp = fopen ("./xfer_log.txt", "a"); + fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$phone_number|$user|$Ctype\n"); + fclose($fp); + } + + } + else + { + echo "0\n"; + # echo "No calls in QUEUE for $user na $server_ip\n"; + exit; + } + } +} + + +################################################################################ +### userLOGout - Logs the user out of VICIDiaL client, deleting db records and +### inserting into vicidial_user_log +################################################################################ +if ($ACTION == 'userLOGout') +{ + $MT[0]=''; + $row=''; $rowx=''; +if ( (strlen($campaign)<1) || (strlen($conf_exten)<1) ) + { + echo "NO\n"; + echo "campaign $campaign or conf_exten $conf_exten nie jest prawidłowy\n"; + exit; + } +else + { + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + ##### Insert a WYLOGUJ record into the user log + $stmt="INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$user','WYLOGUJ','$campaign','$NOW_TIME','$StarTtime','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vul_insert = mysql_affected_rows($link); + + if ($no_delete_sessions < 1) + { + ##### Remove the reservation na the vicidial_conferences meetme room + $stmt="UPDATE vicidial_conferences set extension='' where server_ip='$server_ip' and conf_exten='$conf_exten';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vc_remove = mysql_affected_rows($link); + } + + ##### Delete the vicidial_live_agents record for this session + $stmt="DELETE from vicidial_live_agents where server_ip='$server_ip' and user ='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vla_delete = mysql_affected_rows($link); + + ##### Delete the vicidial_live_inbound_agents records for this session + $stmt="DELETE from vicidial_live_inbound_agents where user ='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vlia_delete = mysql_affected_rows($link); + + ##### Delete the web_client_sessions + $stmt="DELETE from web_client_sessions where server_ip='$server_ip' and session_name ='$session_name';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $wcs_delete = mysql_affected_rows($link); + + ##### Hangup the client phone + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$extension%\" order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) + { + $row=mysql_fetch_row($rslt); + $agent_channel = "$row[0]"; + if ($format=='debug') {echo "\n";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','ULGH3459$StarTtime','Channel: $agent_channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $pause_sec=0; + $stmt = "select pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ( ($VDpr_ct > 0) and (strlen($row[3]<5)) and (strlen($row[4]<5)) ) + { + $row=mysql_fetch_row($rslt); + $pause_sec = (($StarTtime - $row[0]) + $row[1]); + + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + if ($vla_delete > 0) + { + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $allow_sipsak_messages = $row[6]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_message = 'LOGGED OUT'; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_message\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + } + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + # $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='PRZERWA',serverid='1';"; + # if ($DB) {echo "$stmt\n";} + # if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + # $rslt=mysql_query($stmt, $linkB); + # $affected_rows = mysql_affected_rows($linkB); + + $stmt = "SELECT time_id FROM queue_log where agent='Agent/$user' and verb='AGENTLOGIN' order by time_id desc limit 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + if ($DB) {echo "$stmt\n";} + echo "$stmt\n"; + $li_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $li_conf_ct) + { + $row=mysql_fetch_row($rslt); + $logintime = $row[0]; + $i++; + } + + $time_logged_in = ($StarTtime - $logintime); + if ($time_logged_in > 1000000) {$time_logged_in=1;} + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='AGENTLOGOFF',data1='$user$agents',data2='$time_logged_in',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + + echo "$vul_insert|$vc_remove|$vla_delete|$wcs_delete|$agent_channel|$vlia_delete\n"; + } +} + + +################################################################################ +### updateDISPO - update the vicidial_list table to reflect the agent choice of +### call disposition for that leand +################################################################################ +if ($ACTION == 'updateDISPO') +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($dispo_choice)<1) || (strlen($lead_id)<1) ) + { + echo "Dispo Choice $dispo or lead_id $lead_id nie jest prawidłowy\n"; + exit; + } + else + { + $stmt="UPDATE vicidial_list set status='$dispo_choice', user='$user' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by uniqueid desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + if ( ($use_internal_dnc=='Y') and ($dispo_choice=='DNC') ) + { + $stmt = "select phone_number from vicidial_list where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $stmt="INSERT INTO vicidial_dnc (phone_number) values('$row[0]');"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + } + } + + $dispo_sec=0; + $StarTtime = date("U"); + $stmt = "select dispo_epoch,dispo_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dispo_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set dispo_sec='$dispo_sec',dispo_epoch='$StarTtime',status='$dispo_choice' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id($link); + + ### RozmowaBACK ENTRY + if ( ($dispo_choice == 'CBHOLD') and (strlen($CallBackDatETimE)>10) ) + { + $stmt="INSERT INTO vicidial_callbacks (lead_id,list_id,campaign_id,status,entry_time,callback_time,user,recipient,comments,user_group) values('$lead_id','$list_id','$campaign','ACTIVE','$NOW_TIME','$CallBackDatETimE','$user','$recipient','$comments','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $stmt="SELECT auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ( ($auto_dial_level > 0) and (ereg(" $dispo_choice ",$row[0])) ) + { + $stmt = "select count(*) from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + $stmt="UPDATE vicidial_hopper set status='READY' where lead_id='$lead_id' and status='HOLD' limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + else + { + $stmt="DELETE from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='CALLSTATUS',data1='$dispo_choice',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + + echo 'Lead ' . $lead_id . ' zmieniono na ' . $dispo_choice . " Status\nNext agent_log_id:\n" . $agent_log_id . "\n"; +} + +################################################################################ +### updateLEAD - update the vicidial_list table to reflect the values that are +### in the agents screen at time of call hangup +################################################################################ +if ($ACTION == 'updateLEAD') +{ + $MT[0]=''; + $row=''; $rowx=''; + $DO_NOT_UPDATE=0; + $DO_NOT_UPDATE_text=''; + if ( (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + echo "phone_number $phone_number or lead_id $lead_id nie jest prawidłowy\n"; + exit; + } + else + { + + $stmt = "SELECT disable_alter_custdata FROM vicidial_campaigns where campaign_id='$campaign'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $dac_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $dac_conf_ct) + { + $row=mysql_fetch_row($rslt); + $disable_alter_custdata = $row[0]; + $i++; + } + if (ereg('Y',$disable_alter_custdata)) + { + $DO_NOT_UPDATE=1; + $DO_NOT_UPDATE_text=' NOT'; + $stmt = "SELECT alter_custdata_override FROM vicidial_users where user='$user'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $aco_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $aco_conf_ct) + { + $row=mysql_fetch_row($rslt); + $alter_custdata_override = $row[0]; + $i++; + } + if (ereg('ALLOW_ALTER',$alter_custdata_override)) + { + $DO_NOT_UPDATE=0; + $DO_NOT_UPDATE_text=''; + } + } + + if ($DO_NOT_UPDATE < 1) + { + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + $comments = eregi_replace("--AMP--",'&',$comments); + $comments = eregi_replace("--QUES--",'?',$comments); + $comments = eregi_replace("--POUND--",'#',$comments); + + $stmt="UPDATE vicidial_list set vendor_lead_code='" . mysql_real_escape_string($vendor_lead_code) . "', title='" . mysql_real_escape_string($title) . "', first_name='" . mysql_real_escape_string($first_name) . "', middle_initial='" . mysql_real_escape_string($middle_initial) . "', last_name='" . mysql_real_escape_string($last_name) . "', address1='" . mysql_real_escape_string($address1) . "', address2='" . mysql_real_escape_string($address2) . "', address3='" . mysql_real_escape_string($address3) . "', city='" . mysql_real_escape_string($city) . "', state='" . mysql_real_escape_string($state) . "', province='" . mysql_real_escape_string($province) . "', postal_code='" . mysql_real_escape_string($postal_code) . "', country_code='" . mysql_real_escape_string($country_code) . "', gender='" . mysql_real_escape_string($gender) . "', date_of_birth='" . mysql_real_escape_string($date_of_birth) . "', alt_phone='" . mysql_real_escape_string($alt_phone) . "', email='" . mysql_real_escape_string($email) . "', security_phrase='" . mysql_real_escape_string($security_phrase) . "', comments='" . mysql_real_escape_string($comments) . "' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } + echo "Lead $lead_id information has$DO_NOT_UPDATE_text been updated\n"; +} + + +################################################################################ +### VDADpause - update the vicidial_live_agents table to show that the agent is +### or ready now active and ready to take calls +################################################################################ +if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($stage)<2) || (strlen($server_ip)<1) ) + { + echo "stage $stage nie jest prawidłowy\n"; + exit; + } + else + { + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set lead_id='',uniqueid=0,callerid='',channel='', random_id='$random',comments='' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_live_agents set status='$stage' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + if (ereg('READY',$stage)) {$QMstatus='UNPAUSEALL';} + if (ereg('PRZERWA',$stage)) {$QMstatus='PRZERWAALL';} + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='$QMstatus',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + + if ($agent_log == 'NO') + {$donothing=1;} + else + { + $pause_sec=0; + $stmt = "select pause_epoch,pause_sec,wait_epoch,wait_sec,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec=0; + if ($row[2] > 0) + { + $wait_sec = (($StarTtime - $row[2]) + $row[3]); + } + if ( (eregi("NULL",$row[4])) or ($row[4] < 1000) ) + {$pause_sec = (($StarTtime - $row[0]) + $row[1]);} + else + {$pause_sec = (($row[4] - $row[0]) + $row[1]);} + + } + if ($ACTION == 'VDADready') + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($ACTION == 'VDADpause') + { + $stmt="UPDATE vicidial_agent_log set pause_epoch='$StarTtime',wait_sec='$wait_sec' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + echo 'Agent ' . $user . ' ma statusie ' . $stage . "\n"; +} + + +################################################################################ +### UpdatEFavoritEs - update the astguiclient favorites list for this extension +################################################################################ +if ($ACTION == 'UpdatEFavoritEs') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($favorites_list)<1) || (strlen($user)<1) || (strlen($exten)<1) ) + { + echo "favorites list $favorites_list nie jest prawidłowy\n"; + exit; + } + else + { + $stmt = "select count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + $stmt="UPDATE phone_favorites set extensions_list=\"$favorites_list\" where extension='$exten' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="INSERT INTO phone_favorites values('$exten','$server_ip',\"$favorites_list\");"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + echo "Favorites list has been updated to $favorites_list for $exten\n"; +} + + +################################################################################ +### PauseCodeSubmit - Update vicidial_agent_log with pause code +################################################################################ +if ($ACTION == 'PrzerwaCodeSubmit') +{ + $row=''; $rowx=''; + if ( (strlen($status)<1) || (strlen($agent_log_id)<1) ) + { + echo "agent_log_id $agent_log_id or pause_code $status nie jest prawidłowy\n"; + exit; + } + else + { + $stmt="UPDATE vicidial_agent_log set sub_status=\"$status\" where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $allow_sipsak_messages = $row[6]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_prefix = 'BK-'; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$status\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + } + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='PRZERWAREASON',serverid='$queuemetrics_log_id',data1='$status';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } +echo "Przerwa Code has been updated to $status for $agent_log_id\n"; +} + + +################################################################################ +### CalLBacKLisT - List the USERONLY callbacks for an agent +################################################################################ +if ($ACTION == 'CalLBacKLisT') +{ +$stmt = "select callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' and campaign_id='$campaign' and status NOT IN('INACTIVE','DEAD') order by callback_time;"; +if ($DB) {echo "$stmt\n";} +$rslt=mysql_query($stmt, $link); +if ($rslt) {$callbacks_count = mysql_num_rows($rslt);} +echo "$callbacks_count\n"; +$loop_count=0; + while ($callbacks_count>$loop_count) + { + $row=mysql_fetch_row($rslt); + $callback_id[$loop_count] = $row[0]; + $lead_id[$loop_count] = $row[1]; + $campaign_id[$loop_count] = $row[2]; + $status[$loop_count] = $row[3]; + $entry_time[$loop_count] = $row[4]; + $callback_time[$loop_count] = $row[5]; + $comments[$loop_count] = $row[6]; + $loop_count++; + } +$loop_count=0; + while ($callbacks_count>$loop_count) + { + $stmt = "select first_name,last_name,phone_number from vicidial_list where lead_id='$lead_id[$loop_count]';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count]\n"; + $loop_count++; + } + +} + + +################################################################################ +### CalLBacKCounT - send the count of the USERONLY callbacks for an agent +################################################################################ +if ($ACTION == 'CalLBacKCounT') +{ +$stmt = "select count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' and campaign_id='$campaign' and status NOT IN('INACTIVE','DEAD');"; +if ($DB) {echo "$stmt\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$cbcount=$row[0]; + +echo "$cbcount"; +} + + + + +if ($format=='debug') +{ +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +echo "\n"; +echo "\n\n\n"; +} + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/vicidial.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/vicidial.php new file mode 100644 index 00000000..82d9ef8d --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/vicidial.php @@ -0,0 +1,6797 @@ + LICENSE: GPLv2 +# +# make sure you have added a user to the vicidial_users MySQL table with at least +# user_level 1 or greater to access this page. Also, you need to have the login +# and pass of a phone listed in the asterisk.phones table. The page grabs the +# server info and other details from this login and pass. +# +# This script works best with Firefox or Mozilla, but will run for a couple +# hours on Internet Explorer before the memory leaks cause a crash. +# +# Other scripts that this application depends on: +# - vdc_db_query.php: Updates information in the database +# - manager_send.php: Sends manager actions to the DB for execution +# +# CHANGELOG +# 50607-1426 - First Build of VICIDIAL web client basic login process finished +# 50628-1620 - Added some basic formatting and worked on process flow +# 50628-1715 - Startup variables mapped to javascript variables +# 50629-1303 - Added Login Closer in-groups selection box and vla update +# 50629-1530 - Rough layout for customer info form section and button links +# 50630-1453 - Rough Manual Dial/Hangup with customer info displayed +# 50701-1450 - Added vicidial_log entries on dial and hangup +# 50701-1634 - Added Logout function +# 50705-1259 - Added call disposition functionality +# 50705-1432 - Added lead info DB update function +# 50705-1658 - Added web form functionality +# 50706-1043 - Added call park and pickup functions +# 50706-1234 - Added Start/Stop Recording functionality +# 50706-1614 - Added conference channels display option +# 50711-1333 - Removed call check redundancy and fixed a span bug +# 50727-1424 - Added customer channel and participant present sensing/alerts +# 50804-1057 - Added SendDTMF function and reconfigured the transfer span +# 50804-1224 - Added Local and Internal Closer transfer functions +# 50804-1628 - Added Blind transfer, activated LIVE CALL image and fixed bugs +# 50804-1808 - Added button images for left buttons +# 50815-1151 - Added 3Way calling functions to Transfer-conf frame +# 50815-1602 - Added images and buttons for xfer functions +# 50816-1813 - Added basic autodial outbound call pickup functions +# 50817-1113 - Fixes to auto_dialing call receipt +# 50817-1234 - Added inbound call receipt capability +# 50817-1541 - Added customer time display +# 50817-1541 - Added customer time display +# 50818-1327 - Added stop-all-recordings-after-each-vicidial-call option +# 50818-1703 - Added pretty login section +# 50825-1200 - Modified form field lengths, added double-click dispositions +# 50831-1603 - Fixed customer time bug and fronter display bug for CLOSER +# 50901-1314 - Fixed CLOSER IN-GROUP Web Form bug +# 50903-0904 - Added preview-lead code for manual dialing +# 50904-0016 - Added ability to hangup manual dials before pickup +# 50906-1319 - Added override for filters on xfer calls, fixed login display bug +# 50909-1243 - Added hotkeys functionality for quick dispoing in auto-dial mode +# 50912-0958 - Modified hotkeys function, agent must have user_level >= 5 to use +# 50913-1212 - Added campaign_cid to 3rd party calls +# 50923-1546 - Modified to work with language translation +# 50926-1656 - Added campaign pull-down at login of active campaigns +# 50928-1633 - Added manual dial alternate number dial option +# 50930-1538 - Added session_id empty login failure and fixed 2 minor bugs +# 51004-1656 - Fixed recording filename bug and new Spanish translation +# 51020-1103 - Added campaign-specific recording control abilities +# 51020-1352 - Added Basic vicidial_agent_log framework +# 51021-1050 - Fixed custtime display and disable Enter/Return keypresses +# 51021-1718 - Allows for multi-line comments (changes \n to !N in database) +# 51110-1432 - Fixed non-standard http port issue +# 51111-1047 - Added vicidial_agent_log lead_id earlier for manual dial +# 51118-1305 - Activate multi-line comments from $multi_line_comments var +# 51118-1313 - Move Transfer DIV to a floating span to preserve 800x600 view +# 51121-1506 - Small PHP optimizations in many scripts and disabled globalize +# 51129-1010 - Added ability to accept calls from other VICIDIAL servers +# 51129-1254 - Fixed Hangups of other agents channels when customer hangs up +# 51208-1732 - Created user-first login that looks for default phone info +# 51219-1526 - Added variable framework for campaign and in-group scripts +# 51221-1200 - Added SCRIPT tab, layout and functionality +# 51221-1714 - Added auto-switch-to-SCRIPT-tab and auto-webform-popup +# 51222-1605 - Added VMail message blind transfer button to xfer-conf frame +# 51229-1028 - Added checks on web_form_address to allow for var in the DB value +# 60117-1312 - Added Transfer-conf frame toggle on button press +# 60208-1152 - Added DTMF-xfernumber preset links to xfer-conf frame +# 60213-1129 - Added vicidial_users.hotkeys_active for any user hotkeys +# 60213-1210 - Added ability to sort routing of calls by user_level +# 60214-0932 - Initial Callback calendar display framework +# 60214-1407 - Added ability to minimize the dispo screen to see info below +# 60215-1104 - Added ANYONE scheduled callbacks functionality +# 60410-1116 - Added persistant pause after dispo option and change dispo text +# - Added web form submit that opens new window with dispo on submit +# - Added PREVIOUS CALLBACK in customer info to flag callbacks +# - Added link to try to hangup the call again in the dispo screen +# - Added link noone-in-session screen to call agent phone again +# - Added link customer-hungup screen to go straight to dispo screen +# 60410-1532 - Added agent status and campaign calls dialing display option +# 60411-1547 - Add ability to set callback as USERONLY and some basic formatting +# 60413-1752 - Add basic USERONLY callback frame and listings +# 60414-1039 - Changed manual dial preview and alt dial checkboxes to spans +# - Added beta-level USERONLY callback functionality +# - Added beta-level manual dialing with lead insertion functionality +# 60415-1534 - Fixed manual dial lead preview and fixed manuald dial override bug +# 60417-1108 - Added capability to do alt-number-dialing in auto-dial mode +# - Changed several permissions to database-defined +# 60419-1529 - Prevent manual dial or callbacks when alt-dial lead not finished +# 60420-1647 - Fixed DiaLDiaLAltPhonE error, Call Agent Again DialControl error +# 60421-1229 - Check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60424-1005 - Fixed Alt phone disabled bug for callbacks and manual dials +# 60426-1058 - Added vicidial_user setting for default blended check for CLOSER +# 60501-1008 - Added option to manual dial screen to manually lookup phone number +# 60503-1653 - Fixed agentonly_callback not-defined bug in scheduled callbacks screen +# 60504-1032 - Fixed manual dial display bug and transfer dispo alert bug +# - Fixed recording filename display to not overrun 25 characters +# 60510-1051 - Added Wrapup timer and wrapup message on wrapup screen after dispo +# 60608-1453 - Added CLOSER campaign allowable in-groups limitations +# 60609-1123 - Added add-number-to-DNC-list function and manual dial check DNC +# 60619-1047 - Added variable filters to close security holes for login form +# 60804-1710 - fixed scheduled CALLBK for other languages build +# 60808-1145 - Added consultative transfers with customer data +# 60808-2232 - Added campaign name to pulldown for login screen +# 60809-1603 - Added option to locally transfer consult xfers +# 60809-1732 - Added recheck of transferred channels before customer gone mesg +# 60810-1011 - Fixed CXFER leave 3way call bugs +# 60816-1602 - Added ALLCALLS recording delay option allcalls_delay +# 60816-1716 - Fixed customer time display bug and client DST setting +# 60821-1555 - Added option to omit phone_code on dialout of leads +# 60821-1628 - Added ALLFORCE recording option +# 60821-1643 - Added no_delete_sessions option to not delete sessions +# 60822-0512 - Changed phone number fields to be maxlength of 12 +# 60829-1531 - Made compatible with WeBRooTWritablE setting in dbconnect.php +# 60906-1152 - Added Previous CallBack info display span +# 60906-1715 - Allow for Local phone extension conferences +# 61004-1729 - Add ability to control volume per channel in "calls in this session" +# 61122-1341 - Added vicidial_user_groups allowed_campaigns restrictions +# 61122-1523 - Added more SCRIPT variables +# 61128-2229 - Added vicidial_live_agents and vicidial_auto_calls manual dial entries +# 61130-1617 - Added lead_id to MonitorConf for recording_log +# 61221-1212 - Changed width to 760 to better fit 800x600 screens, widened SCRIPT +# 70109-1128 - Fixed wrapup timer bug +# 70109-1635 - Added option for HotKeys automatically dialing next number in manual mode +# - Added option for alternate number dialing with hotkeys +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70118-1517 - Added vicidial_agent_log and vicidial_user_log logging of user_group +# 70201-1249 - Added FAST DIAL option for manually dialing, added UTF8 compatible code +# 70201-1703 - Fixed cursor bug for most text input fields +# 70202-1453 - Added first portions of Agent Pause Codes +# 70203-0108 - Finished Agent Pause Codes functionality +# 70203-0930 - Added dialed_number to webform output +# 70203-1010 - Added dialed_label to webform output +# 70206-1201 - Fixed allow_closers bug +# 70206-1332 - Added vicidial_recording_override users setting function +# 70212-1252 - Fixed small issue with CXFER +# 70213-1018 - Changed CXFER and AXFER to update customer information before transfer +# 70214-1233 - Added queuemetrics_log_id field for server_id in queue_log +# 70215-1240 - Added queuemetrics_log_id field for server_id in queue_log +# 70222-1617 - Changed queue_log PAUSE/UNPAUSE to PAUSEALL/UNPAUSEALL +# 70226-1252 - Added Mute/UnMute to agent screen +# 70309-1035 - Allow amphersands and questions marks in comments to pass through +# 70313-1052 - Allow pound signs(hash) in comments to pass through +# 70316-1406 - Moved the MUTE button to be accessible during a transfer/conf +# 70319-1446 - Added agent-deactive-display and disable customer info update functions +# 70319-1626 - Added option to allow agent logins to campaigns with no leads in the hopper +# 70320-1501 - Added option to allow retry of leave-3way-call from dispo screen +# 70322-1545 - Added sipsak display ability +# 70510-1319 - Added onUnload force Logout +# 70806-1530 - Added Presets Dial links above agent mute button +# 70823-2118 - Fixed XMLHTTPRequest, HotKeys and Scheduled Callbacks issues with MSIE +# 70828-1443 - Added source_id to output of SCRIPTtab-IFRAME and WEBFORM +# 71022-1427 - Added formatting of the customer phone number in the main status bar +# 71029-1848 - Changed CLOSER-type campaign to not use campaign_id restrictions +# 71101-1204 - Fixed bug in callback calendar with DST +# 71116-0957 - Added campaign_weight and calls_today to the vla table insertion +# 71120-1719 - Added XMLHTPRequest lookup of allowable campaigns for agents during login +# 71122-0256 - Added auto-pause notification +# 71125-1751 - Changed Transfer section to allow for selection of in-groups to send calls to +# 71127-0408 - Added height and width settings for easier modification of screen size +# 71129-2025 - restricted callbacks count and list to campaign only +# + +$version = '2.0.4-142'; +$build = '71129-2025'; + +require("dbconnect.php"); + +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["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} + 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"];} + } + if (isset($VD_campaign)) + { + $VD_campaign = strtoupper($VD_campaign); + $VD_campaign = eregi_replace(" ",'',$VD_campaign); + } + +### 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); + + +$forever_stop=0; + +if ($force_logout) +{ + echo "Wylogowałeś się. Do zobaczenia\n"; + exit; +} + +$isdst = date("I"); +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$CIDdate = date("ymdHis"); + $month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); + $past_month_date = date("Y-m-d H:i:s",$month_old); + + +$random = (rand(1000000, 9999999) + 10000000); + +$conf_silent_prefix = '7'; # vicidial_conferences prefix to enter silently +$HKuser_level = '5'; # minimum vicidial user_level for HotKeys +$campaign_login_list = '1'; # show drop-down list of campaigns at login +$manual_dial_preview = '1'; # allow preview lead option when manual dial +$multi_line_comments = '1'; # set to 1 to allow multi-line comment box +$user_login_first = '0'; # set to 1 to have the vicidial_user login before the phone login +$view_scripts = '1'; # set to 1 to show the SCRIPTS tab +$dispo_check_all_pause = '0'; # set to 1 to allow for persistent pause after dispo +$agentcallsstatus = '0'; # set to 1 to show agent status and call count + $campagentstatctmax = '0'; # Number of sekundy for campaign call and agent stats +$show_campname_pulldown = '1'; # set to 1 to show campaign name na login pulldown +$webform_sessionname = '1'; # set to 1 to include the session_name in webform URL +$local_consult_xfers = '1'; # set to 1 to send consultative transfers from original server +$clientDST = '1'; # set to 1 to check for DST na server for agent time +$no_delete_sessions = '0'; # set to 1 to not delete sessions at logout +$volumecontrol_active = '1'; # set to 1 to allow agents to alter volume of channels +$PreseT_DiaL_LinKs = '1'; # set to 1 to show a WYBIERZ link for Dial Presets +$LogiNAJAX = '1'; # set to 1 to do lookups +$HidEMonitoRSessionS = '1'; # set to 1 to hide remote monitoring channels from "session calls" + +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen + +$BROWSER_HEIGHT = 500; # set to the minimum browser height, default=500 +$BROWSER_WIDTH = 770; # set to the minimum browser width, default=770 + + +# options now set in DB: +#$alt_phone_dialing = '1'; # allow agents to call alt phone numbers +#$scheduled_callbacks = '1'; # set to 1 to allow agent to choose scheduled callbacks +# $agentonly_callbacks = '1'; # set to 1 to allow agent to choose agent-only scheduled callbacks +#$agentcall_manual = '1'; # set to 1 to allow agent to make manual calls during autodial session + +### SCREEN WIDTH AND HEIGHT CALCULATIONS ### +### DO NOT EDIT! ### +$MASTERwidth=($BROWSER_WIDTH - 340); +$MASTERheight=($BROWSER_HEIGHT - 200); +if ($MASTERwidth < 430) {$MASTERwidth = '430';} +if ($MASTERheight < 300) {$MASTERheight = '300';} + +$CAwidth = ($MASTERwidth + 340); # 770 - cover all (none-in-session, customer hunngup, etc...) +$MNwidth = ($MASTERwidth + 330); # 760 - main frame +$XFwidth = ($MASTERwidth + 320); # 750 - transfer/conference +$HCwidth = ($MASTERwidth + 310); # 740 - hotkeys and callbacks +$AMwidth = ($MASTERwidth + 270); # 700 - agent mute and preset-dial links +$SSwidth = ($MASTERwidth + 176); # 606 - scroll script +$SDwidth = ($MASTERwidth + 170); # 600 - scroll script, customer data and calls-in-session +$HKwidth = ($MASTERwidth + 70); # 500 - Hotkeys button +$HSwidth = ($MASTERwidth + 1); # 431 - Header spacer + +$HKheight = ($MASTERheight + 105); # 405 - HotKey active Button +$AMheight = ($MASTERheight + 100); # 400 - Agent mute and preset dial links +$MBheight = ($MASTERheight + 65); # 365 - Manual Dial Buttons +$CBheight = ($MASTERheight + 50); # 350 - Agent Callback, pause code, volume control Buttons and agent status +$SSheight = ($MASTERheight + 31); # 331 - script content +$HTheight = ($MASTERheight + 10); # 310 - transfer frame, callback comments and hotkey +$BPheight = ($MASTERheight - 250); # 50 - bottom buffer + + +$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('vicidial.php','',$agcPAGE); + +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 +echo "\n"; +echo "\n"; +echo "\n"; + +if ($campaign_login_list > 0) +{ +$camp_form_code = "\n"; +} +else +{ +$camp_form_code = "\n"; +} + + +if ($LogiNAJAX > 0) +{ +?> + + + +klient VICIWYBIERZ: Powtórne zalogowanie\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "
English Polski
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Powtórne zalogowanie
 
Login telefonu:
Hasło telefonu:
Login użytkownika:
Hasło użytkownika:
Kampania: $camp_form_code

WERSJA: $version       KOMPILACJA: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} + +if ($user_login_first == 1) +{ + if ( (strlen($VD_login)<1) or (strlen($VD_pass)<1) or (strlen($VD_campaign)<1) ) + { + echo "klient VICIWYBIERZ: Logowanie do kampani\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Polski
\n"; + echo "
\n"; + echo "\n"; + #echo "\n"; + #echo "\n"; + echo "

Login użytkownika

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Logowanie do kampani
 
Login użytkownika:
Hasło użytkownika:
Kampania: $camp_form_code
  \n"; + echo "

WERSJA: $version       KOMPILACJA: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) + { + $stmt="SELECT phone_login,phone_pass from vicidial_users where user='$VD_login' and pass='$VD_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); + $phone_login=$row[0]; + $phone_pass=$row[1]; + + echo "klient VICIWYBIERZ: Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Polski
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Login
 
Login telefonu:
Hasło telefonu:
Login użytkownika:
Hasło użytkownika:
Kampania: $camp_form_code
  \n"; + echo "

WERSJA: $version       KOMPILACJA: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + + } + } +} + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "klient VICIWYBIERZ: Login telefonu\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "
English Polski
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Login telefonu
 
Login telefonu:
Hasło telefonu:
  \n"; +echo "

WERSJA: $version       KOMPILACJA: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./vicidial_auth_entries.txt", "a");} +$VDloginDISPLAY=0; + + if ( (strlen($VD_login)<2) or (strlen($VD_pass)<2) or (strlen($VD_campaign)<2) ) + { + $VDloginDISPLAY=1; + } + else + { + $stmt="SELECT count(*) from vicidial_users where user='$VD_login' and pass='$VD_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($auth>0) + { + $login=strtoupper($VD_login); + $password=strtoupper($VD_pass); + ##### grab the full name of the agent + $stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,closer_default_blended,user_group,vicidial_recording_override from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $user_level=$row[1]; + $VU_hotkeys_active=$row[2]; + $VU_agent_choose_ingroups=$row[3]; + $VU_scheduled_callbacks=$row[4]; + $agentonly_callbacks=$row[5]; + $agentcall_manual=$row[6]; + $VU_vicidial_recording=$row[7]; + $VU_vicidial_transfers=$row[8]; + $VU_closer_default_blended=$row[9]; + $VU_user_group=$row[10]; + $VU_vicidial_recording_override=$row[11]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|$VD_pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + $user_abb = "$VD_login$VD_login$VD_login$VD_login"; + while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + + $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$VU_user_group';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGallowed_campaigns =$row[0]; + + if ( (!eregi(" $VD_campaign ",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) + { + echo "klient VICIWYBIERZ: VICIWYBIERZ Logowanie do kampani\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Polski
\n"; + echo "Sorry, you are not allowed to login to this campaign: $VD_campaign\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Login: \n
"; + echo "Hasło:
\n"; + echo "Kampania: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + ##### check to see that the campaign is active + $stmt="SELECT count(*) FROM vicidial_campaigns where campaign_id='$VD_campaign' and active='Y';"; + 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); + $CAMPactive=$row[0]; + if($CAMPactive>0) + { + if ($TEST_all_statuses > 0) {$selectableSQL = '';} + else {$selectableSQL = "selectable='Y' and";} + $VARstatuses=''; + $VARstatusnames=''; + ##### grab the statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_statuses WHERE $selectableSQL status != 'NEW' order by status limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $VD_statuses_ct) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + } + + ##### grab the campaign-specific statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_campaign_statuses WHERE $selectableSQL status != 'NEW' and campaign_id='$VD_campaign' order by status limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_camp = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + $j++; + } + $VD_statuses_ct = ($VD_statuses_ct+$VD_statuses_camp); + $VARstatuses = substr("$VARstatuses", 0, -1); + $VARstatusnames = substr("$VARstatusnames", 0, -1); + + ##### grab the campaign-specific HotKey statuses that can be used for dispositioning by an agent + $stmt="SELECT hotkey,status,status_name FROM vicidial_campaign_hotkeys WHERE selectable='Y' and status != 'NEW' and campaign_id='$VD_campaign' order by hotkey limit 9;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $HK_statuses_camp = mysql_num_rows($rslt); + $w=0; + $HKboxA=''; + $HKboxB=''; + $HKboxC=''; + while ($w < $HK_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $HKhotkey[$w] =$row[0]; + $HKstatus[$w] =$row[1]; + $HKstatus_name[$w] =$row[2]; + $HKhotkeys = "$HKhotkeys'$HKhotkey[$w]',"; + $HKstatuses = "$HKstatuses'$HKstatus[$w]',"; + $HKstatusnames = "$HKstatusnames'$HKstatus_name[$w]',"; + if ($w < 3) + {$HKboxA = "$HKboxA $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ( ($w >= 3) and ($w < 6) ) + {$HKboxB = "$HKboxB $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ($w >= 6) + {$HKboxC = "$HKboxC $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + $w++; + } + $HKhotkeys = substr("$HKhotkeys", 0, -1); + $HKstatuses = substr("$HKstatuses", 0, -1); + $HKstatusnames = substr("$HKstatusnames", 0, -1); + + ##### grab the statuses to be dialed for your campaign as well as other campaign settings + $stmt="SELECT park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,agent_pause_codes_active,no_hopper_leads_logins,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,xfer_groups FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $park_ext = $row[0]; + $park_file_name = $row[1]; + $web_form_address = $row[2]; + $allow_closers = $row[3]; + $auto_dial_level = $row[4]; + $dial_timeout = $row[5]; + $dial_prefix = $row[6]; + $campaign_cid = $row[7]; + $campaign_vdad_exten = $row[8]; + $campaign_rec_exten = $row[9]; + $campaign_recording = $row[10]; + $campaign_rec_filename = $row[11]; + $campaign_script = $row[12]; + $get_call_launch = $row[13]; + $campaign_am_message_exten = $row[14]; + $xferconf_a_dtmf = $row[15]; + $xferconf_a_number = $row[16]; + $xferconf_b_dtmf = $row[17]; + $xferconf_b_number = $row[18]; + $alt_number_dialing = $row[19]; + $VC_scheduled_callbacks = $row[20]; + $wrapup_sekundy = $row[21]; + $wrapup_message = $row[22]; + $closer_campaigns = $row[23]; + $use_internal_dnc = $row[24]; + $allcalls_delay = $row[25]; + $omit_phone_code = $row[26]; + $agent_pause_codes_active = $row[27]; + $no_hopper_leads_logins = $row[28]; + $campaign_allow_inbound = $row[29]; + $manual_dial_list_id = $row[30]; + $default_xfer_group = $row[31]; + $xfer_groups = $row[32]; + + if ( (!ereg('DISABLED',$VU_vicidial_recording_override)) and ($VU_vicidial_recording > 0) ) + { + $campaign_recording = $VU_vicidial_recording_override; + print "\n"; + } + if ( ($VC_scheduled_callbacks=='Y') and ($VU_scheduled_callbacks=='1') ) + {$scheduled_callbacks='1';} + if ($VU_vicidial_recording=='0') + {$campaign_recording='NEVER';} + if ($alt_number_dialing=='Y') + {$alt_phone_dialing='1';} + else + {$alt_phone_dialing='0';} + $closer_campaigns = preg_replace("/^ | -$/","",$closer_campaigns); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaigns = "'$closer_campaigns'"; + + if ($agent_pause_codes_active=='Y') + { + ##### grab the pause codes for this campaign + $stmt="SELECT pause_code,pause_code_name FROM vicidial_pause_codes WHERE campaign_id='$VD_campaign' order by pause_code limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_pause_codes = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_pause_codes) + { + $row=mysql_fetch_row($rslt); + $pause_codes[$i] =$row[0]; + $pause_code_names[$i] =$row[1]; + $VARpause_codes = "$VARpause_codes'$pause_codes[$i]',"; + $VARpause_code_names = "$VARpause_code_names'$pause_code_names[$i]',"; + $i++; + $j++; + } + $VD_pause_codes_ct = ($VD_pause_codes_ct+$VD_pause_codes); + $VARpause_codes = substr("$VARpause_codes", 0, -1); + $VARpause_code_names = substr("$VARpause_code_names", 0, -1); + } + + ##### grab the inbound groups to choose from if campaign contains CLOSER + $VARingroups="''"; + if ($campaign_allow_inbound == 'Y') + { + $VARingroups=''; + $stmt="select group_id from vicidial_inbound_groups where active = 'Y' and group_id IN($closer_campaigns) order by group_id limit 60;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $closer_ct = mysql_num_rows($rslt); + $INgrpCT=0; + while ($INgrpCT < $closer_ct) + { + $row=mysql_fetch_row($rslt); + $closer_groups[$INgrpCT] =$row[0]; + $VARingroups = "$VARingroups'$closer_groups[$INgrpCT]',"; + $INgrpCT++; + } + $VARingroups = substr("$VARingroups", 0, -1); + } + + ##### grab the allowable inbound groups to choose from for transfer options + $xfer_groups = preg_replace("/^ | -$/","",$xfer_groups); + $xfer_groups = preg_replace("/ /","','",$xfer_groups); + $xfer_groups = "'$xfer_groups'"; + $VARxfergroups="''"; + if ($allow_closers == 'Y') + { + $VARxfergroups=''; + $stmt="select group_id,group_name from vicidial_inbound_groups where active = 'Y' and group_id IN($xfer_groups) order by group_id limit 60;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $xfer_ct = mysql_num_rows($rslt); + $XFgrpCT=0; + while ($XFgrpCT < $xfer_ct) + { + $row=mysql_fetch_row($rslt); + $VARxfergroups = "$VARxfergroups'$row[0]',"; + $VARxfergroupsnames = "$VARxfergroupsnames'$row[1]',"; + if ($row[0] == "$default_xfer_group") {$default_xfer_group_name = $row[1];} + $XFgrpCT++; + } + $VARxfergroups = substr("$VARxfergroups", 0, -1); + $VARxfergroupsnames = substr("$VARxfergroupsnames", 0, -1); + } + + ##### grab the number of leads in the hopper for this campaign + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id = '$VD_campaign' and status='READY';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $campaign_leads_to_call = $row[0]; + print "\n"; + + } + else + { + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Kampania nie aktywna, spróbuj jeszcze raz
"; + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|$VD_pass|$ip|$browser|\n"); + fclose($fp); + } + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Login nie aktywny, spróbuj jeszcze raz
"; + } + } + if ($VDloginDISPLAY) + { + echo "klient VICIWYBIERZ: Logowanie do kampani\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Polski
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "

$VDdisplayMESSAGE

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Logowanie do kampani
 
Login użytkownika:
Hasło użytkownika:
Kampania: $camp_form_code
  \n"; + echo "

WERSJA: $version       KOMPILACJA: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +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); +$authphone=$row[0]; +if (!$authphone) + { + echo "klient VICIWYBIERZ: Login telefonu Error\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Polski
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Login Error
 
Login Twojego telefonu lub hasło są nieaktywne w tym systememie, spróbuj jeszcze raz:
 
Login telefonu:
Hasło telefonu:

WERSJA: $version       KOMPILACJA: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "klient VICIWYBIERZ\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + 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); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $login=$row[6]; + $pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $IDRozmówcy_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + $enable_sipsak_messages=$row[66]; + + if ($clientDST) + { + $local_gmt = ($local_gmt + $isdst); + } + if ($protocol == 'EXTERNAL') + { + $protocol = 'Local'; + $extension = "$dialplan_number$AT$ext_context"; + } + $SIP_user = "$protocol/$extension"; + + $stmt="SELECT asterisk_version from servers where server_ip='$server_ip';"; + 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); + $asterisk_version=$row[0]; + + # If a park extension is not set, use the default one + if ( (strlen($park_ext)>0) && (strlen($park_file_name)>0) ) + { + $VICIDiaL_park_on_extension = "$park_ext"; + $VICIDiaL_park_on_filename = "$park_file_name"; + print "\n"; + } + print "\n"; + + # If a web form address is not set, use the default one + if (strlen($web_form_address)>0) + { + $VICIDiaL_web_form_address = "$web_form_address"; + print "\n"; + } + else + { + $VICIDiaL_web_form_address = "$VICIDiaL_web_URL"; + print "\n"; + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + } + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + # If closers are allowed na this campaign + if ($allow_closers=="Y") + { + $VICIDiaL_allow_closers = 1; + print "\n"; + } + else + { + $VICIDiaL_allow_closers = 0; + print "\n"; + } + + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtimE$US$session_ext$session_rand"; + + if ($webform_sessionname) + {$webform_sessionname = "&session_name=$session_name";} + else + {$webform_sessionname = '';} + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'vicidial';"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','vicidial','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + if ( ($campaign_allow_inbound == 'Y') || ($campaign_leads_to_call > 0) || (ereg('Y',$no_hopper_leads_logins)) ) + { + ### insert an entry into the user log for the login event + $stmt = "INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$VD_login','LOGIN','$VD_campaign','$NOW_TIME','$StarTtimE','$VU_user_group')"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + ##### check to see if the user has a conf extension already, this happens if they previously exited uncleanly + $stmt="SELECT conf_exten FROM vicidial_conferences where extension='$SIP_user' and server_ip = '$server_ip' LIMIT 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $prev_login_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $prev_login_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + if ($prev_login_ct > 0) + {print "\n";} + else + { + ##### grab the next available vicidial_conference room and reserve it + $stmt="SELECT conf_exten FROM vicidial_conferences where server_ip = '$server_ip' and ((extension='') or (extension is null)) LIMIT 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $free_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $free_conf_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + $stmt="UPDATE vicidial_conferences set extension='$SIP_user' where server_ip='$server_ip' and conf_exten='$session_id';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + print "\n"; + + } + + $stmt="UPDATE vicidial_list set status='N', user='' where status IN('QUEUE','INCALL') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_hopper where status IN('QUEUE','INCALL','DONE') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_live_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_live_inbound_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + # print "You have logged in as user: $VD_login na phone: $SIP_user do kampani: $VD_campaign
\n"; + $VICIDiaL_is_logged_in=1; + + ### set the callerID for manager middleware-app to connect the phone to the user + $SIqueryCID = "S$CIDdate$session_id"; + + ############################################# + ##### START SYSTEM_SETTINGS LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,vicidial_agent_disable,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $vicidial_agent_disable = $row[6]; + $allow_sipsak_messages = $row[7]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_prefix = 'LIN-'; + print "\n"; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$VD_campaign\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + $SIqueryCID = "$SIPSAK_prefix$VD_campaign$DS$CIDdate"; + } + + ### insert a NOWY record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$SIqueryCID','Channel: $SIP_user','Context: $ext_context','Exten: $session_id','Priority: 1','Callerid: $SIqueryCID','','','','','');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($auto_dial_level > 0) + { + print "\n"; + + ##### grab the campaign_weight and number of calls today na that campaign for the agent + $stmt="SELECT campaign_weight,calls_today FROM vicidial_campaign_agents where user='$VD_login' and campaign_id = '$VD_campaign';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vca_ct = mysql_num_rows($rslt); + if ($vca_ct > 0) + { + $row=mysql_fetch_row($rslt); + $campaign_weight = $row[0]; + $calls_today = $row[1]; + $i++; + } + else + { + $campaign_weight = '0'; + $calls_today = '0'; + $stmt="INSERT INTO vicidial_campaign_agents (user,campaign_id,campaign_rank,campaign_weight,calls_today) values('$VD_login','$VD_campaign','0','0','$calls_today');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + } + $closer_chooser_string=''; + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,user_level,campaign_weight,calls_today) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$closer_chooser_string','$user_level','$campaign_weight','$calls_today');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='$VD_campaign',agent='Agent/$VD_login',verb='AGENTLOGIN',data1='$VD_login@agents',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PRZERWAALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + mysql_close($linkB); + mysql_select_db("$VARDB_database", $link); + } + + + if ($campaign_allow_inbound == 'Y') + { + print "\n"; + } + } + else + { + print "\n"; + + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,user_level) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$user_level');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='$VD_campaign',agent='Agent/$VD_login',verb='AGENTLOGIN',data1='$VD_login@agents',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PRZERWAALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + mysql_close($linkB); + mysql_select_db("$VARDB_database", $link); + } + } + } + else + { + echo "klient VICIWYBIERZ: VICIWYBIERZ Logowanie do kampani\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Polski
\n"; + echo "Niestety, w zasobniku nie ma kontaktów oczekujących wykonania połączeń dla tej kampanii\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Login: \n
"; + echo "Hasło:
\n"; + echo "Kampania: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + if (strlen($session_id) < 1) + { + echo "klient VICIWYBIERZ: VICIWYBIERZ Logowanie do kampani\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Polski
\n"; + echo "Sorry, there are no available sessions\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Login: \n
"; + echo "Hasło:
\n"; + echo "Kampania: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + if (ereg('MSIE',$browser)) + { + $useIE=1; + print "\n"; + } + else + { + $useIE=0; + print "\n"; + } + + $StarTtimE = date("U"); + $NOW_TIME = date("Y-m-d H:i:s"); + ##### Agent is going to log in so insert the vicidial_agent_log entry now + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group,sub_status) values('$VD_login','$server_ip','$NOW_TIME','$VD_campaign','$StarTtimE','0','$StarTtimE','$VU_user_group','LOGIN');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id($link); + print "\n"; + + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $server_ip_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S"; + + ##### grab the datails of all active scripts in the system + $stmt="SELECT script_id,script_name,script_text FROM vicidial_scripts WHERE active='Y' order by script_id limit 100;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $MM_scripts = mysql_num_rows($rslt); + $e=0; + while ($e < $MM_scripts) + { + $row=mysql_fetch_row($rslt); + $MMscriptid[$e] =$row[0]; + $MMscriptname[$e] = rawurlencode($row[1]); + $MMscripttext[$e] = rawurlencode($row[2]); + $MMscriptids = "$MMscriptids'$MMscriptid[$e]',"; + $MMscriptnames = "$MMscriptnames'$MMscriptname[$e]',"; + $MMscripttexts = "$MMscripttexts'$MMscripttext[$e]',"; + $e++; + } + $MMscriptids = substr("$MMscriptids", 0, -1); + $MMscriptnames = substr("$MMscriptnames", 0, -1); + $MMscripttexts = substr("$MMscripttexts", 0, -1); + + } +} + +################################################################ +### BEGIN - build the callback calendar (12 months) ### +################################################################ +define ('ADAY', (60*60*24)); +$CdayARY = getdate(); +$Cmon = $CdayARY['mon']; +$Cyear = $CdayARY['year']; +$CTODAY = date("Y-m"); +$CTODAYmday = date("j"); +$CINC=0; + +$Cmonths = Array('Styczeń','February','Marzec','Kwiecień','Maj','Czerwiec', + 'Lipiec','Sierpień','Wrzesień','Październik','Listopad','Grudzień'); +$Cdays = Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); + +$CCAL_OUT = ''; + +$CCAL_OUT .= ""; + +while ($CINC < 12) +{ +if ( ($CINC == 0) || ($CINC == 4) ||($CINC == 8) ) + {$CCAL_OUT .= "";} + +$CCAL_OUT .= ""; + +if ( ($CINC == 3) || ($CINC == 7) ||($CINC == 11) ) + {$CCAL_OUT .= "";} +$CINC++; +} + +$CCAL_OUT .= "
"; + +$CYyear = $Cyear; +$Cmonth= ($Cmon + $CINC); +if ($Cmonth > 12) + { + $Cmonth = ($Cmonth - 12); + $CYyear++; + } +$Cstart= mktime(11,0,0,$Cmonth,1,$CYyear); +$CfirstdayARY = getdate($Cstart); +#echo "|$Cmon|$Cmonth|$CINC|\n"; +$CPRNTDAY = date("Y-m", $Cstart); + +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; + +foreach($Cdays as $Cday) +{ + $CDCLR="#ffffff"; +$CCAL_OUT .= ""; +} + +for( $Ccount=0;$Ccount<(6*7);$Ccount++) +{ + $Cdayarray = getdate($Cstart); + if((($Ccount) % 7) == 0) + { + if($Cdayarray['mon'] != $CfirstdayARY['mon']) + break; + $CCAL_OUT .= ""; + } + if($Ccount < $CfirstdayARY['wday'] || $Cdayarray['mon'] != $Cmonth) + { + $CCAL_OUT .= ""; + } + else + { + if( ($Cdayarray['mday'] == $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + else + { + $CDCLR="#ffffff"; + if ( ($Cdayarray['mday'] < $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CDCLR="#CCCCCC"; + $CBL = ''; + $CEL = ''; + } + else + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + } + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + } +} +$CCAL_OUT .= ""; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$CfirstdayARY[month] $CfirstdayARY[year]"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$Cday"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
 "; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; + +#echo "$CCAL_OUT\n"; +################################################################ +### END - build the callback calendar (12 months) ### +################################################################ + + +?> + + + + +\n"; + + +?> + +
+ + MARGINWIDTH=0 MARGINHEIGHT=0 LEFTMARGIN=0 TOPMARGIN=0 VALIGN=TOP ALIGN=LEFT> +
+ + + +WYLOGUJ\n"; ?> +
+
+ + + height=30> + + + + + +
VICIWYBIERZSCRIPT VALIGN=MIDDLE ALIGN=CENTER>   LIVE     ID sesji: Aktywna rozmowa
+
+ + + + + height=>

VICIWYBIERZ
+
+ + +WYBIERANIE RĘCZNE       SZYBKA TARCZA
+
+ + +X AKTYWNE INNE TERMINY
+
+ + +
+
+ + + D1 - WYBIERZ\n"; + echo "
\n"; + echo "D2 - WYBIERZ\n"; + } + else {echo "
\n";} + ?> +

+
+
+ + + height=460>
INNE TERMINY DLA AGENTA :
Kliknij poniżej na Inne terminy żeby teraz zadzwonić do klienta. Jeżeli klikniesz na rekordzie by zadzwonić, rekord zostanie usunięty z listy. +
+
+
  + Odswież +                 + Wróć +
+
+ + + height=460>
NOWE RĘCZNE WYBIERANIE NUMERU DLA :

Wpisz poniżej informacje o kontakcie do którego chcesz wykonać połączenie. +
+ \n"; + } + ?> + Note: all new manual dial leads will go into list

+ + + + + + + + + + + + + + + +
Kod wybierania:   (dla polski bÄ™dzie to 48)
Telefon Number: +   (12 digits max - digits only) +
Przeszukuj rekordy:   (This option if checked will attempt to find the phone number in the system before inserting it as a new lead)


Jeżeli chcesz wybrać numer tak aby NIE został dodany jako nowy kontakt, wpisz dokładny numer telefonu w polu Wybierz ten numer poniżej. By zakończyć połączenie musisz otworzyć ROZMOWY W TEJ SESJI (w dole ekranu), i zakończyć połączenie klinając na link jego kanału..
 
Wybierz ten numer:   (tylko cyfry) +
+
+ Wybierz teraz +                 + Wróć +
+
+ + + +
+
+ + + + +Twój Status:
Calls Dialing: +
+ + + + + > + +
+
+ + Transfer - Konferencja
+ + + LOKALNY FINALIZUJĄCYCH + Rozłącz linię transferu + Rozłącz obie linie + +
+ + Numer do wybrania   + + WYBIERZ TEN NUMER   + WYJDŹ Z ROZMOWY 3-STRONNEJ + Wybierz numer do nieweryfikowanego transferu + D1 + D2 + +
+ + sekundy   + channel + Połącz z klientem + ZawieÅ› połączenie z klientem + Blind Transfer VMail Message +
+
+
+
+ + + + height=70> + +
Połączenie rozdysponowane jako:

+ -
+
+
+ + + height=70> + + + + +
Klawisze skrótu dyspozycji: + Kiedy aktywne, naciśnij guzik na klawiaturze w celu wybrania opcji dla tej rozmowy. Rozmowa zostanie automatycznie rozłączona a opcja ustawiona:
+ + + + + +
+
+ + + height=70> + + + + + + +
Previous Callback Information: close
+
+
+
+
+ +
+
+ + + height=500>
Nikt nie uczestniczy w Twojej sesji:
+ Wróć +

+ Ponownie połącz się z telefonem +
+
+ + + height=500>
Klient sie rozłączył:
+ Wróć +

+ Zakończ i wprowadź rezultat rozmowy + +
+
+ + + height=550>
Call Wrapup sekundy remaining in wrapup

+ +

+ Finish Wrapup and Move On + +
+
+ + + height=500>
Wasza sesja była uszkadzana
WYLOGUJ

Wróć +
+
+ + + height=500>

WYLOGUJ
+
+ + +
+
+ + +
 
+
+ + + height=47>
Zmiany wprowadzone w informacjach o kliencie będą zapisane tylko podczas trwania połączenia. Nie po rozłączaniu!.
+
+ + + height=460>
REZULTAT ROZMOWY :       Rozłącz siÄ™ ponownie       minimalizuj
+ Koniec rozmowy, wybierz rezultat +
+ ZATRZYMAJ DZWONIENIE
+ WYCZYŚĆ FORMULARZ | + ZATWIERDŹ +

+ WEB FORM ZATWIERDŹ +

  +
+
+ + + height=460>
WYBÓR SZYFR PRZERWY :
+ Przerwa Code Selection + +

  +
+
+ + + height=460>
Wybierz datÄ™ oddzwonienia :
+ + + Wybierz datÄ™ poniżej   +     + Hour: +   + Minutes: +   + +  
+ TYLKO MOJE INNE TERMINY
";} + ?> + Notatki:

+ + ZATWIERDŹ

+ +

  +
+
+ + + height=460>
SELEKCJA GRUPY ZAWNĘTRZNYCH FINALIZUJĄCYCH
+ Selekcja grupy zawnętrznych finalizujących +
+ KOMBINOWANE POÅÄ„CZENIA(wychodzÄ…ce aktywowane)
+ RESET | + ZATWIERDŹ +



  +
+
+ + + + Kanał + Kanał + TYLKO MOJE INNE TERMINY
";} + ?> +
+ + + + height=>
VICIWYBIERZ SCRIPT
+
+ + + 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> +KLAWISZE SKRÓTU NIEAKTYWNE + + + + +> + + + +
wersja klienta VICIWYBIERZ:     KOMPILACJA:               Serwer:              
+Pokaż informacje o kanałach konferencyjnych

 
+
+ + + +
+
+ + + + + id="MainTable"> + + + + + + + + + + + + + + + +
STATUS:
+
+Wybierz kolejny numer
+ PODGLÄ„D POÅÄ„CZEŃ
+ WYBIERANIE DRUGIEGO NUMERU
+ + +PLIK NAGRANIA:
+
+
+NUMER NAGRANIA:
+
+ +Rozpocznij nagrywanie
+
+Web Formularz
+
+ZawieÅ› rozmowÄ™
+Transfer - Konferencja
+
+Odłącz kilenta
+
+
Wyślij tonowo

+
+
+
align=left valign=top> + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
sekundy:   KanaÅ‚:   Ustawiony Czas:
Informacje o kliencie:
TytuÅ‚:   ImiÄ™:   2 ImiÄ™:   Nazwisko:
Adres1:
Adres2:   Adres3:
Miasto:   Stan:   KodPocztowy:
Powiat:   Vendedor ID:
Telefon:   Prefiks:   Drugi telefon:
Pokaż:   Email:
Komentarz: + +\n";} +else + {echo "\n";} +?> + +
+
+ +
+
> + 
+ + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/voicemail_check.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/voicemail_check.php new file mode 100644 index 00000000..ffdc3ed9 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pl/voicemail_check.php @@ -0,0 +1,140 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "Nieprawidłowy NazwaUżytkownika/Hasło: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Nieprawidłowy server_ip: |$server_ip| or Nieprawidłowy 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 "Nieprawidłowy session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Sprawdzanie poczty głosowej"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + $MT[0]=''; + $row=''; $rowx=''; + if (strlen($vmail_box)<1) + { + $channel_live=0; + echo "skrzynka poczty głosowej $vmail_box nie jest prawidłowy\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";} + $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";} + } + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/active_list_refresh.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/active_list_refresh.php new file mode 100644 index 00000000..0b915374 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/active_list_refresh.php @@ -0,0 +1,482 @@ + LICENSE: GPLv2 +### +### 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 +# + +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árioname/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 "\n"; +echo "\n"; +echo "\n"; +echo "Exposição Da Lista: "; +if ($ADD==1) {echo "Extensões Vivas";} +if ($ADD==2) {echo "Extensões Ocupadas";} +if ($ADD==3) {echo "Linhas Exteriores";} +if ($ADD==4) {echo "Extensões Locais";} +if ($ADD==5) {echo "Conferências";} +if ($ADD==99999) {echo "AJUDA";} +echo "\n"; +echo "\n"; +echo "\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 "\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + +###################### +# ADD=2 display all busy extensions on a server +###################### +if ($ADD==2) +{ + if (!$field_name) {$field_name = 'busyext';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\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 "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=4 display all busy Local lines on a server +###################### +if ($ADD==4) +{ + if (!$field_name) {$field_name = 'local';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\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 "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='table') {echo "\n";} +if ($format=='table') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/astguiclient.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/astguiclient.php new file mode 100644 index 00000000..1c6a291f --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/astguiclient.php @@ -0,0 +1,2905 @@ + LICENSE: GPLv2 +# +# make sure you have added a user to the vicidial_users MySQL table with at least +# user_level 1 or greater to access this page. Also you need to have the login +# and pass of a phone listed in the asterisk.phones table. The page grabs the +# server info and other details from this login and pass +# +# Other scripts that this application depends on: +# - active_list_refresh.php: displays active/live channels and phones +# - manager_send.php: sends Actions to be executed on Asterisk servers +# - live_exten_check.php: checks to see if user's phone is on a live call +# - call_log_display.php: retrieves log of inbound and outbound calls +# - voicemail_check.php: retrieves counts of new and old messages +# - inbound_popup.php: opens upon live_inbound call coming in +# - conf_exten_check.php: checks to see if and calls are in a specific conf +# - park_calls_display.php: retrieves list of parked calls +# - vdc_db_query.php: Changes values in the DB for non-calling records +# +# CHANGES +# 50215-1356 - Proof-of-concept test of XMLHttpRequest for astGUIclient web +# 50323-1411 - First build version display-only +# 50331-1040 - Second-build, added phone login and hangup/hijack display +# 50401-1006 - Trunk/Local Hangup functions enabled +# 50404-1056 - Trunk/Local Hijack functions enabled +# 50404-1459 - Simple live calls display and grabs updated time from server +# 50405-1221 - Reorganized the display and layers, added some images +# 50406-1005 - Added In/Out call log display to MAIN panel +# 50407-1254 - Start/Stop Recording on live calls enabled +# 50422-1101 - Activated Check Voicemail button and new/old messages count +# 50428-1449 - Added dial from log and basic live_inbound call popup +# 50429-1455 - Modified inbound popup code for IE and to add more functions +# 50502-1442 - Added basic method to transfer live calls somewhere else +# 50503-1205 - Added web_client_sessions entry for more security of subscripts +# 50503-1537 - Added basic conferences display +# 50509-1132 - Added conference connected list and hangup/xfer for them +# 50511-1129 - Added registration of conference rooms and added manual dial +# 50523-1342 - Added Conference recording and send DTMF +# 50523-1622 - Added Local Dial window frame for calling local extensions +# 50524-1456 - Added ability to park call and display number of parked calls +# 50524-1600 - Added ability to display and pickup/hangup/xfer parked calls +# 50525-1224 - Added ability to place outbound call from within conferene +# 50531-1225 - Added ability to do dual transfers to meetme rooms from Main +# 50711-1229 - removed HTTP authentication in favor of user/pass vars +# 50711-1610 - Added Zap monitoring to Trunk/Local Action screens +# 50804-1604 - Minor bug fix in inbound_popup functions +# 50818-1715 - Added pretty login section +# 50913-1137 - Added custom outbound_cid from phones table +# 51110-1430 - Fixed non-standard http port issue +# 60103-1421 - Added code for favorite extensions chooser +# 60104-1347 - Added basic layout for favorites editing frame +# 60105-1124 - Finished Favorites frame and added DB submission +# 60112-1622 - Several formatting changes +# 60421-1357 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1103 - Added variable filters to close security holes for login form +# 60829-1528 - Made compatible with WeBRooTWritablE setting in dbconnect.php +# + +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["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["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} + 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"];} + } + +$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++;} + +$version = '2.0.1'; +$build = '60829-1528'; + +### 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); + $user=ereg_replace("[^0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^0-9a-zA-Z]","",$pass); + + +if ($force_logout) +{ + if( (strlen($_SERVER['user'])>0) or (strlen($_SERVER['pass'])>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "Você tem registrado agora para fora. Obrigado\n"; + exit; +} + +$StarTtime = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_TIME = date("Ymd-His"); + $month_old = mktime(0, 0, 0, date("m"), date("d")-7, date("Y")); + $past_month_date = date("Y-m-d H:i:s",$month_old); + + $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]; + +$US='_'; +$CL=':'; +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./astguiclient_auth_entries.txt", "a");} +$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 = $agcPAGE; +$agcDIR = eregi_replace('astguiclient.php','',$agcDIR); + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth) or ($relogin == 'YES') ) + { + header ("Content-type: text/html; charset=utf-8"); + + echo "web client astGUIclient: Início de uma sessão\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Português
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Início de uma sessão
 
Início de uma sessão Do Usuário:
Senha Do Usuário:
Início de uma sessão Do Telefone:
Senha Do Telefone:

VERSÃO: $version       CONFIGURAÇÃO: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($user); + $password=strtoupper($pass); + $stmt="SELECT full_name,user_level from vicidial_users where user='$user' and pass='$pass'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICISELETOR|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICISELETOR|FAIL|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + } + +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 +echo "\n"; +echo "\n"; +echo "\n"; + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "web client astGUIclient: Início de uma sessão Do Telefone\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "
English Português
\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Início de uma sessão Do Telefone
 
Início de uma sessão Do Telefone:
Senha Do Telefone:

VERSÃO: $version       CONFIGURAÇÃO: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$authphone=$row[0]; +if (!$authphone) + { + echo "web client astGUIclient: Início de uma sessão Do Telefone\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Português
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Início de uma sessão Do Telefone
 
Pesaroso, seus início de uma sessão do telefone e senha não seja:
 
Início de uma sessão Do Telefone:
Senha Do Telefone:

VERSÃO: $version       CONFIGURAÇÃO: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "web client astGUIclient\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $phone_login=$row[6]; + $phone_pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CaLLerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + $outbound_cid=$row[65]; + + $local_web_callerID_URL_enc = rawurlencode($local_web_callerID_URL); + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtime$US$session_ext$session_rand"; + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'agc';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','agc','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT count(*) from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_present=$row[0]; + if ($favorites_present > 0) + { + $stmt="SELECT extensions_list from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_list=$row[0]; + $h=0; + $favorites_listX = eregi_replace("'",'',$favorites_list); + $favorites = explode(',',$favorites_listX); + $favorites_count = count($favorites); + $favorites_listX=''; + + $o=0; + while ($favorites_count > $o) + { + $stmt="SELECT fullname,protocol from phones where extension = '$favorites[$o]' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $favorites_names[$o] = $rowx[0]; + $favorites_listX .= "$rowx[1]/$favorites[$o],"; + $o++; + } + + echo "\n"; + echo "\n"; + } + else + { + echo "\n"; + } + +### gather phone extensions and fullnames for favorites editor ### + $stmt="SELECT extension,fullname from phones where server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $exten_ct = mysql_num_rows($rslt); + $favlistCT=0; + $nofavlistCT=0; + while ($favlistCT < $exten_ct) + { + $row=mysql_fetch_row($rslt); + $favlist[$favlistCT]= "$row[0] - $row[1]"; + $favlistCT++; + } + + } +} + + +?> + + + + + + +\n"; + + +?> + +
+ + + + + + + + + +
+ + +LOGOUT
\n"; ?> +
Painel PrincipalLinhas Ativas PainelPainel Das ConferênciasVerifique VoicemailVive A Chamada
+
+ + +

Logout
+
+ + +
TRUNK HANGUP

+ Active Trunks Menu
+ Tronco Do Hangup   |   + Tronco Do Hijack   |   + Escuta O Tronco   |   + Refresque   |   + Para trás à janela principal +
+
+ + +
HANGUP LOCAL

+ Menu Local Ativo
+ Local Do Hangup   |   + Local Do Hijack   |   + Escuta O Local   |   + Refresque   |   + Para trás à janela principal +
+
+ + + + + + + +
TRANSFERÊNCIA VIVA DA CHAMADA
Canaleta a ser transferida: Canaleta
Extensões:
Menu Das Extensões
+
+ Emita à extensão selecionada

+ Emita à caixa selecionada do vmail

+ Emita a este número:


+ Refresque


+ Para trás à janela principal

+
Conferências:
(estale sobre um número abaixo para emitir a uma conferência)
Emita minha canaleta demasiado
Menu Das Conferências
+
+ + + + + +
Seletor LOCAL Das Extensões
Telefone que chama-se de: Canaleta
Extensões:
Menu Das Extensões
+
+ Extensão selecionada chamada

+ Caixa selecionada chamada do vmail

+ Refresque


+ Para trás à janela principal

+
+
+ + +
CHAMADAS ESTACIONADAS:
+ Para trás à janela principal

+
+
+ + + + + + + + + + + + + + + +
  +
VOICEMAIL     NOVO:     VELHO:             SELETOR MANUAL       SELETOR
CHAMADAS ESTACIONADAS: 0                EXTENSÕES LOCAIS DO SELETOR
CHAMADAS OUTBOUND :
CHAMADAS INBOUND:
VERSÃO astGUIclient do correia-cliente: CONFIGURAÇÃO:
+ + + + $h) + { + if (strlen($favorites[$h])>1) + { + echo "\n"; + } + $h++; + } +?> + +
FAVORITOS       edite
$favorites[$h] - $favorites_names[$h]
 
+
+ + + + + + + +
FAVORITOS

 
SUBMETA MUDANÇAS dos FAVORITOS - requer o logout
PARA TRÃS À JANELA PRINCIPAL - ignore as mudanças feitas
+
+ +
+ + + + + + + + + + + + + +
+PAUSA | COMEÇO     Refresque a taxa: 1000 ms Mais rapidamente | Mais lento

+
Inicializar..
+
Extensões Ativas
+REFRESQUE | +ORDEM | +
Linhas Exteriores
+REFRESQUE | +ORDEM | +
Extensões Locais
+REFRESQUE | +ORDEM | +
+ Os Dados Vão Aqui

+
+ Os Dados Vão Aqui

Ação Do Tronco +
+ Os Dados Vão Aqui

Ação Local +
+
+ + + + +
+ + +Lista Das Conferências + + + +
+Estale sobre um número de quarto da conferência na esquerda para o +
+ + + + + + + + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/call_log_display.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/call_log_display.php new file mode 100644 index 00000000..dc59b56f --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/call_log_display.php @@ -0,0 +1,196 @@ + LICENSE: GPLv2 +### +### 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 +# + +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árioname/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 "\n"; +echo "\n"; +echo "\n"; +echo "Exposição Do Registro Da Chamada"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten é inválido ou protocolo $protocol é invá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";} + $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";} + $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"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/conf_exten_check.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/conf_exten_check.php new file mode 100644 index 00000000..ed42c28f --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/conf_exten_check.php @@ -0,0 +1,297 @@ + LICENSE: GPLv2 +# +# 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 +# + +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"];} + +$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";} + +$version = '2.0.4-12'; +$build = '71122-0205'; +$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";} + $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árioname/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 "\n"; +echo "\n"; +echo "\n"; +echo "Verificação Da Extensão De Conf"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + if ($ACTION == 'refresh') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($conf_exten)<1) + { + $channel_live=0; + echo "Conf Exten $conf_exten é inválido\n"; + exit; + } + else + { + + if ($client == 'vdc') + { + $Acount=0; + $AexternalDEAD=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); + $row=mysql_fetch_row($rslt); + $Acount=$row[0]; + + if ($Acount > 0) + { + $stmt="SELECT status from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Astatus=$row[0]; + } + # ### 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";} + $rslt=mysql_query($stmt, $link); + + if ($campagentstdisp == 'YES') + { + ### grab the status of this agent to display + $stmt="SELECT status,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Alogin=$row[0]; + $Acampaign=$row[1]; + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where server_ip='$server_ip' and status NOT IN('XFER') and campaign_id='$Acampaign';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $RingCalls=$row[0]; + } + else + { + $Alogin='N'; + $RingCalls='N'; + } + } + else + { + $Alogin='N'; + $RingCalls='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";} + $rslt=mysql_query($stmt, $link); + + } + + if ($Acount < 1) {$Alogin='DEAD_VLA';} + if ($AexternalDEAD > 0) {$Alogin='DEAD_EXTERNAL';} + + echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Status: ' . $Astatus . "|\n"; + + } + $total_conf=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + 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); + $CanaletaA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $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++; $total_conf++; + $row=mysql_fetch_row($rslt); + $CanaletaA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + } + $channels_list = ($channels_list + $sip_list); + echo "$channels_list|"; + + $counter=0; + $countecho=''; + while($total_conf > $counter) + { + $counter++; + $countecho = "$countecho$CanaletaA[$counter] ~"; + # echo "$CanaletaA[$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 é inválido or Exten $exten é invá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";} + $rslt=mysql_query($stmt, $link); + } + echo "Conferência $conf_exten foi registado a $exten\n"; + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/dbconnect.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/dbconnect.php new file mode 100644 index 00000000..7221b35e --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/dbconnect.php @@ -0,0 +1,48 @@ + LICENSE: GPLv2 +# +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"); +mysql_select_db("$VARDB_database"); + +$local_DEF = 'Local/'; +$conf_silent_prefix = '7'; +$local_AMP = '@'; +$ext_context = 'demo'; +$recording_exten = '8309'; +$WeBRooTWritablE = '1'; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/inbound_popup.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/inbound_popup.php new file mode 100644 index 00000000..b9ed7470 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/inbound_popup.php @@ -0,0 +1,351 @@ + LICENSE: GPLv2 +### +### 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 +# + +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árioname/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 "\n"; +echo "\n"; +echo "\n"; +?> + + +CHAMADA INBOUND VIVA"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "

CHAMADA INBOUND VIVA

\n"; +echo "$NOW_TIME

\n"; +} + + + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($uniqueid)<9) + { + $channel_live=0; + echo "Uniqueid $uniqueid é inválido\n"; + exit; + } + else + { + $stmt="SELECT * FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $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";} + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Canaleta: $row[1]
CallerID: $row[3]
\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 "GOOGLE - \n"; + echo "ANYWHO - \n"; + echo "SWITCHBOARD - \n"; + echo "VERIZON - \n"; + echo "WHITEPAGES - \n"; + echo "411.COM - \n"; + echo "411.COM - \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_Canaleta=$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 "COSTUME - \n"; + + echo "
O Número Marcou: $row[8]
Notas: $row[9]|$row[10]|$row[11]|$row[12]|$row[13]|
\n"; + echo "HANGUP - \n"; + echo "EMITA A MEU VOICEMAIL\n"; + echo "
\n"; + + + $stmt="UPDATE live_inbound set acknowledged='Y' where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + + } + + + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/live_exten_check.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/live_exten_check.php new file mode 100644 index 00000000..5a7a69d6 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/live_exten_check.php @@ -0,0 +1,278 @@ + LICENSE: GPLv2 +### +### 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 +# + +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árioname/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 "\n"; +echo "\n"; +echo "\n"; +echo "Verificação Viva Da Extensão"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + +echo "DateTime: $NOW_TIME|"; +echo "UnixTime: $StarTtime|"; + +$stmt="SELECT count(*) FROM parked_channels where server_ip = '$server_ip';"; + if ($format=='debug') {echo "\n";} +$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 é inválido ou protocolo $protocol é invá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";} + $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";} + } + } + + $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";} + $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 "CanaletaA: $ChanneLA[$counter] ~"; + echo "CanaletaB: $ChanneLB[$counter] ~"; + echo "CanaletaBtrunk: $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";} + $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 "CanaletaA: $ChanneLA[$counter] ~"; + echo "CanaletaB: $ChanneLB[$counter] ~"; + echo "CanaletaBtrunk: $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";} + $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 "CanaletaA: $ChanneLA[$counter] ~"; + echo "CanaletaB: $ChanneLB[$counter] ~"; + echo "CanaletaBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel LIKE \"$ChanneLB[$counter]%\";"; + if ($format=='debug') {echo "\n";} + $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 "CanaletaA: $ChanneLA[$counter] ~"; + echo "CanaletaB: $ChanneLB[$counter] ~"; + echo "CanaletaBtrunk: $row[0]|"; + } + else + { + echo "Conversation: $counter ~"; + echo "CanaletaA: $ChanneLA[$counter] ~"; + echo "CanaletaB: $ChanneLB[$counter] ~"; + echo "CanaletaBtrunk: $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";} +$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";} + } + +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";} + $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";} + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/manager_send.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/manager_send.php new file mode 100644 index 00000000..0823f931 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/manager_send.php @@ -0,0 +1,1142 @@ + LICENSE: GPLv2 +# +# This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk 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: +# - $ACTION - ('Originate','Redirect','Hangup','Command','Monitor','StopMonitor','SysCIDOriginate','RedirectName','RedirectNameVmail','MonitorConf','StopMonitorConf','RedirectXtra','RedirectXtraCX','RedirectVD','HangupConfDial','VolumeControl','OriginateVDRelogin') +# - $queryCID - ('CN012345678901234567',...) +# - $format - ('text','debug') +# - $channel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +# - $exten - ('1234','913125551212',...) +# - $ext_context - ('default','demo',...) +# - $ext_priority - ('1','2',...) +# - $filename - ('20050406-125623_44444',...) +# - $extenName - ('phone100',...) +# - $parkedby - ('phone100',...) +# - $extrachannel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +# - $auto_dial_level - ('0','1','1.1',...) +# - $campaign - ('CLOSER','TESTCAMP',...) +# - $uniqueid - ('1120232758.2406800',...) +# - $lead_id - ('1234',...) +# - $seconds - ('32',...) +# - $outbound_cid - ('3125551212','0000000000',...) +# - $agent_log_id - ('123456',...) +# - $call_server_ip - ('10.10.10.15',...) +# - $CalLCID - ('VD01234567890123456',...) +# - $stage - ('UP','DOWN') +# + +# CHANGELOG: +# 50401-1002 - First build of script, Hangup function only +# 50404-1045 - Redirect basic function enabled +# 50406-1522 - Monitor basic function enabled +# 50407-1647 - Monitor and StopMonitor full functions enabled +# 50422-1120 - basic Originate function enabled +# 50428-1451 - basic SysCIDOriginate function enabled for checking voicemail +# 50502-1539 - basic RedirectName and RedirectNameVmail added +# 50503-1227 - added session_name checking for extra security +# 50523-1341 - added Conference call start/stop recording +# 50523-1421 - added OriginateName and OriginateNameVmail for local calls +# 50524-1602 - added RedirectToPark and RedirectFromPark +# 50531-1203 - added RedirecXtra for dual channel redirection +# 50630-1100 - script changed to not use HTTP login vars, user/pass instead +# 50804-1148 - Added RedirectVD for VICIDIAL blind redirection with logging +# 50815-1204 - Added NEXTAVAILABLE to RedirectXtra function +# 50903-2343 - Added HangupConfDial function to hangup in-dial channels in conf +# 50913-1057 - Added outbound_cid set if present to originate call +# 51020-1556 - Added agent_log_id framework for detailed agent activity logging +# 51118-1204 - Fixed Blind transfer bug from VICIDIAL when in manual dial mode +# 51129-1014 - Added ability to accept calls from other VICIDIAL servers +# 51129-1253 - Fixed Hangups of other agents channels in VICIDIAL AD +# 60310-2022 - Fixed NEXTAVAILABLE bug in leave-3way-call redirect function +# 60421-1413 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1158 - Added variable filters to close security holes for login form +# 60809-1544 - Added direct transfers to leave-3ways in consultative transfers +# 61004-1526 - Added parsing of volume control command and lookup or number +# 61130-1617 - Added lead_id to MonitorConf for recording_log +# 61201-1115 - Added user to MonitorConf for recording_log +# 70111-1600 - added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70226-1251 - Added Mute/UnMute to conference volume control +# 70320-1502 - Added option to allow retry of leave-3way-call and debug logging +# 70322-1636 - Added sipsak display ability +# + +require("dbconnect.php"); + +### These are variable assignments for PHP globals off +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["ACTION"])) {$ACTION=$_GET["ACTION"];} + elseif (isset($_POST["ACTION"])) {$ACTION=$_POST["ACTION"];} +if (isset($_GET["queryCID"])) {$queryCID=$_GET["queryCID"];} + elseif (isset($_POST["queryCID"])) {$queryCID=$_POST["queryCID"];} +if (isset($_GET["format"])) {$format=$_GET["format"];} + elseif (isset($_POST["format"])) {$format=$_POST["format"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["exten"])) {$exten=$_GET["exten"];} + elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];} +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["filename"])) {$filename=$_GET["filename"];} + elseif (isset($_POST["filename"])) {$filename=$_POST["filename"];} +if (isset($_GET["extenName"])) {$extenName=$_GET["extenName"];} + elseif (isset($_POST["extenName"])) {$extenName=$_POST["extenName"];} +if (isset($_GET["parkedby"])) {$parkedby=$_GET["parkedby"];} + elseif (isset($_POST["parkedby"])) {$parkedby=$_POST["parkedby"];} +if (isset($_GET["extrachannel"])) {$extrachannel=$_GET["extrachannel"];} + elseif (isset($_POST["extrachannel"])) {$extrachannel=$_POST["extrachannel"];} +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["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} + elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["secondS"])) {$secondS=$_GET["secondS"];} + elseif (isset($_POST["secondS"])) {$secondS=$_POST["secondS"];} +if (isset($_GET["outbound_cid"])) {$outbound_cid=$_GET["outbound_cid"];} + elseif (isset($_POST["outbound_cid"])) {$outbound_cid=$_POST["outbound_cid"];} +if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];} + elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];} +if (isset($_GET["call_server_ip"])) {$call_server_ip=$_GET["call_server_ip"];} + elseif (isset($_POST["call_server_ip"])) {$call_server_ip=$_POST["call_server_ip"];} +if (isset($_GET["CalLCID"])) {$CalLCID=$_GET["CalLCID"];} + elseif (isset($_POST["CalLCID"])) {$CalLCID=$_POST["CalLCID"];} +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["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} +if (isset($_GET["phone_ip"])) {$phone_ip=$_GET["phone_ip"];} + elseif (isset($_POST["phone_ip"])) {$phone_ip=$_POST["phone_ip"];} +if (isset($_GET["enable_sipsak_messages"])) {$enable_sipsak_messages=$_GET["enable_sipsak_messages"];} + elseif (isset($_POST["enable_sipsak_messages"])) {$enable_sipsak_messages=$_POST["enable_sipsak_messages"];} +if (isset($_GET["allow_sipsak_messages"])) {$allow_sipsak_messages=$_GET["allow_sipsak_messages"];} + elseif (isset($_POST["allow_sipsak_messages"])) {$allow_sipsak_messages=$_POST["allow_sipsak_messages"];} + +$user=ereg_replace("[^0-9a-zA-Z]","",$user); +$pass=ereg_replace("[^0-9a-zA-Z]","",$pass); +$secondS = ereg_replace("[^0-9]","",$secondS); + +# default optional vars if not set +if (!isset($ACTION)) {$ACTION="Originate";} +if (!isset($format)) {$format="alert";} +if (!isset($ext_priority)) {$ext_priority="1";} + +$version = '2.0.29'; +$build = '70320-1502'; +$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árioname/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 "\n"; +echo "\n"; +echo "\n"; +echo "O Gerente Emite: "; +if ($ACTION=="Originate") {echo "Originate";} +if ($ACTION=="Redirect") {echo "Redirect";} +if ($ACTION=="RedirectName") {echo "RedirectName";} +if ($ACTION=="Hangup") {echo "Hangup";} +if ($ACTION=="Command") {echo "Command";} +if ($ACTION==99999) {echo "AJUDA";} +echo "\n"; +echo "\n"; +echo "\n"; +} + + + + + +###################### +# ACTION=SysCIDOriginate - insert Originate Manager statement allowing small CIDs for system calls +###################### +if ($ACTION=="SysCIDOriginate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<1) ) + { + echo "Exten $exten é inválido or queryCID $queryCID é inválido, Originate comando não introduzido\n"; + } + else + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate comando emitido para Exten $exten Canaleta $channel em $server_ip\n"; + } +} + + + +###################### +# ACTION=Originate, OriginateName, OriginateNameVmail - insert Originate Manager statement +###################### +if ($ACTION=="OriginateName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Uma destas variáveis é inválido:\n"; + echo "Canaleta $channel deve ser mais grande de 2 caráteres\n"; + echo "queryCID $queryCID deve ser mais grande de 14 caráteres\n"; + echo "extenName $extenName deve ser ajustado\n"; + echo "ext_context $ext_context deve ser ajustado\n"; + echo "ext_priority $ext_priority deve ser ajustado\n"; + echo "\nOriginateName Action não emitido\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="OriginateNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Uma destas variáveis é inválido:\n"; + echo "Canaleta $channel deve ser mais grande de 2 caráteres\n"; + echo "queryCID $queryCID deve ser mais grande de 14 caráteres\n"; + echo "extenName $extenName deve ser ajustado\n"; + echo "exten $exten deve ser ajustado\n"; + echo "ext_context $ext_context deve ser ajustado\n"; + echo "ext_priority $ext_priority deve ser ajustado\n"; + echo "\nOriginateNameVmail Action não emitido\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="OriginateVDRelogin") +{ + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $CIDdate = date("ymdHis"); + $DS='-'; + $SIPSAK_prefix = 'LIN-'; + print "\n"; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$campaign\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + $queryCID = "$SIPSAK_prefix$campaign$DS$CIDdate"; + + } + $ACTION="Originate"; +} + +if ($ACTION=="Originate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<10) ) + { + echo "Exten $exten é inválido or queryCID $queryCID é inválido, Originate comando não introduzido\n"; + } + else + { + if (strlen($outbound_cid)>1) + {$outCID = "\"$queryCID\" <$outbound_cid>";} + else + {$outCID = "$queryCID";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate comando emitido para Exten $exten Canaleta $channel em $server_ip\n"; + } +} + + + +###################### +# ACTION=HangupConfDial - find the Local channel that is in the conference and needs to be hung up +###################### +if ($ACTION=="HangupConfDial") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($queryCID)<15) or (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "conference $exten é inválido or ext_context $ext_context or queryCID $queryCID é inválido, Hangup comando não introduzido\n"; + } + else + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $hangup_channel_prefix = "$local_DEF$exten$local_AMP$ext_context"; + + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row > 0) + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $channel=$rowx[0]; + $ACTION="Hangup"; + $queryCID = eregi_replace("^.","G",$queryCID); + } + } +} + + + +###################### +# ACTION=Hangup - insert Hangup Manager statement +###################### +if ($ACTION=="Hangup") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) ) + { + $channel_live=0; + echo "Canaleta $channel é inválido or queryCID $queryCID é inválido, Hangup comando não introduzido\n"; + } + else + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + +# $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# if ($row[0]==0) +# { +# $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $rowx=mysql_fetch_row($rslt); +# if ($rowx[0]==0) +# { +# $channel_live=0; +# echo "Channel $channel is not live on $call_server_ip, Hangup command not inserted\n"; +# } +# } + if ( ($auto_dial_level > 0) and (strlen($CalLCID)>2) and (strlen($exten)>2) and ($secondS > 4)) + { + $stmt="SELECT count(*) FROM vicidial_auto_calls where channel='$channel' and callerid='$CalLCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + echo "Call $CalLCID $channel não está vivo em $call_server_ip, Checking Live Canaleta...\n"; + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel' and extension LIKE \"%$exten\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $channel_live=0; + echo "Canaleta $channel não está vivo em $call_server_ip, Hangup comando não introduzido $rowx[0]\n$stmt\n"; + } + else + { + echo "$stmt\n"; + } + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Hangup','$queryCID','Channel: $channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Hangup comando emitido para Canaleta $channel em $call_server_ip\n"; + } + } +} + + + +###################### +# ACTION=Redirect, RedirectName, RedirectNameVmail, RedirectToPark, RedirectFromPark, RedirectVD, RedirectXtra, RedirectXtraCX +# - insert Redirect Manager statement using extensions name +###################### +if ($ACTION=="RedirectVD") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($campaign)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($uniqueid)<2) or (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "Uma destas variáveis é inválido:\n"; + echo "Canaleta $channel deve ser mais grande de 2 caráteres\n"; + echo "queryCID $queryCID deve ser mais grande de 14 caráteres\n"; + echo "exten $exten deve ser ajustado\n"; + echo "ext_context $ext_context deve ser ajustado\n"; + echo "ext_priority $ext_priority deve ser ajustado\n"; + echo "auto_dial_level $auto_dial_level deve ser ajustado\n"; + echo "campaign $campaign deve ser ajustado\n"; + echo "uniqueid $uniqueid deve ser ajustado\n"; + echo "lead_id $lead_id deve ser ajustado\n"; + echo "\nRedirectVD Action não emitido\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($auto_dial_level < 1) + { + $stmt = "UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectToPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($parkedby)<1) ) + { + $channel_live=0; + echo "Uma destas variáveis é inválido:\n"; + echo "Canaleta $channel deve ser mais grande de 2 caráteres\n"; + echo "queryCID $queryCID deve ser mais grande de 14 caráteres\n"; + echo "exten $exten deve ser ajustado\n"; + echo "extenName $extenName deve ser ajustado\n"; + echo "ext_context $ext_context deve ser ajustado\n"; + echo "ext_priority $ext_priority deve ser ajustado\n"; + echo "parkedby $parkedby deve ser ajustado\n"; + echo "\nRedirectToPark Action não emitido\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "INSERT INTO parked_channels values('$channel','$server_ip','','$extenName','$parkedby','$NOW_TIME');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectFromPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Uma destas variáveis é inválido:\n"; + echo "Canaleta $channel deve ser mais grande de 2 caráteres\n"; + echo "queryCID $queryCID deve ser mais grande de 14 caráteres\n"; + echo "exten $exten deve ser ajustado\n"; + echo "ext_context $ext_context deve ser ajustado\n"; + echo "ext_priority $ext_priority deve ser ajustado\n"; + echo "\nRedirectFromPark Action não emitido\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "DELETE FROM parked_channels where server_ip='$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Uma destas variáveis é inválido:\n"; + echo "Canaleta $channel deve ser mais grande de 2 caráteres\n"; + echo "queryCID $queryCID deve ser mais grande de 14 caráteres\n"; + echo "extenName $extenName deve ser ajustado\n"; + echo "ext_context $ext_context deve ser ajustado\n"; + echo "ext_priority $ext_priority deve ser ajustado\n"; + echo "\nRedirectName Action não emitido\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Uma destas variáveis é inválido:\n"; + echo "Canaleta $channel deve ser mais grande de 2 caráteres\n"; + echo "queryCID $queryCID deve ser mais grande de 14 caráteres\n"; + echo "extenName $extenName deve ser ajustado\n"; + echo "exten $exten deve ser ajustado\n"; + echo "ext_context $ext_context deve ser ajustado\n"; + echo "ext_priority $ext_priority deve ser ajustado\n"; + echo "\nRedirectNameVmail Action não emitido\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectXtraCX") +{ + $DBout=''; + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "Uma destas variáveis é inválido:\n"; + echo "Canaleta $channel deve ser mais grande de 2 caráteres\n"; + echo "ExtraCanaleta $extrachannel deve ser mais grande de 2 caráteres\n"; + echo "queryCID $queryCID deve ser mais grande de 14 caráteres\n"; + echo "exten $exten deve ser ajustado\n"; + echo "ext_context $ext_context deve ser ajustado\n"; + echo "ext_priority $ext_priority deve ser ajustado\n"; + echo "\nRedirect Action não emitido\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDCXC|$filename|$user|$campaign|$channel|$extrachannel|$queryCID|$exten|$ext_context|ext_priority|\n"); + fclose($fp); + } + } + } + else + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Canaleta $channel não está vivo em $call_server_ip, Redirect comando não introduzido\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel não está vivo em $call_server_ip";} + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Canaleta $channel não está vivo em $server_ip, Redirect comando não introduzido\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel não está vivo em $server_ip";} + } + } + if ( ($channel_liveX==1) && ($channel_liveY==1) ) + { + $stmt="SELECT count(*) FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0] < 1) + { + $channel_liveY=0; + echo "No Local agent to send call to, Redirect comando não introduzido\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "No Local agent to send call to";} + } + else + { + $stmt="SELECT server_ip,conf_exten,user FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $dest_server_ip = $rowx[0]; + $dest_session_id = $rowx[1]; + $dest_user = $rowx[2]; + $S='*'; + + $D_s_ip = explode('.', $dest_server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$dest_session_id$S$lead_id$S$dest_user$S$phone_code$S$phone_number$S$campaign$S"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','$queryCID','Channel: $extrachannel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtraCX comando emitido para Canaleta $channel em $call_server_ip and \nHungup $extrachannel em $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel em $call_server_ip, Hungup $extrachannel em $server_ip";} + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "Changed to Redirect: $channel em $server_ip";} + } + + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDCXC|$filename|$user|$campaign|$DBout|\n"); + fclose($fp); + } + } + + } +} + +if ($ACTION=="RedirectXtra") +{ + if ($channel=="$extrachannel") + {$ACTION="Redirect";} + else + { + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "Uma destas variáveis é inválido:\n"; + echo "Canaleta $channel deve ser mais grande de 2 caráteres\n"; + echo "ExtraCanaleta $extrachannel deve ser mais grande de 2 caráteres\n"; + echo "queryCID $queryCID deve ser mais grande de 14 caráteres\n"; + echo "exten $exten deve ser ajustado\n"; + echo "ext_context $ext_context deve ser ajustado\n"; + echo "ext_priority $ext_priority deve ser ajustado\n"; + echo "\nRedirect Action não emitido\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDX|$filename|$user|$campaign|$$channel|$extrachannel|$queryCID|$exten|$ext_context|ext_priority|\n"); + fclose($fp); + } + } + } + else + { + if ($exten == "NEXTAVAILABLE") + { + $stmt="SELECT conf_exten FROM conferences where server_ip='$server_ip' and ((extension='') or (extension is null)) limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if (strlen($row[0]) > 3) + { + $stmt="UPDATE conferences set extension='$user' where server_ip='$server_ip' and conf_exten='$row[0]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $exten = $row[0]; + } + else + { + $channel_liveX=0; + echo "Não pode encontrar a conferência vazia em $server_ip, Redirect comando não introduzido\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "Não pode encontrar a conferência vazia em $server_ip";} + } + } + + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Canaleta $channel não está vivo em $call_server_ip, Redirect comando não introduzido\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel não está vivo em $call_server_ip";} + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Canaleta $channel não está vivo em $server_ip, Redirect comando não introduzido\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel não está vivo em $server_ip";} + } + } + if ( ($channel_liveX==1) && ($channel_liveY==1) ) + { + if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','ExtraChannel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra comando emitido para Canaleta $channel and \nExtraCanaleta $extrachannel\n to $exten em $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel and $extrachannel to $exten em $server_ip";} + } + else + { + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$exten"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra comando emitido para Canaleta $channel em $call_server_ip and \nExtraCanaleta $extrachannel\n to $exten em $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel/$call_server_ip and $extrachannel/$server_ip to $exten";} + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + + } + + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDX|$filename|$user|$campaign|$DBout|\n"); + fclose($fp); + } + } + + } + } +} + + +if ($ACTION=="Redirect") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Uma destas variáveis é inválido:\n"; + echo "Canaleta $channel deve ser mais grande de 2 caráteres\n"; + echo "queryCID $queryCID deve ser mais grande de 14 caráteres\n"; + echo "exten $exten deve ser ajustado\n"; + echo "ext_context $ext_context deve ser ajustado\n"; + echo "ext_priority $ext_priority deve ser ajustado\n"; + echo "\nRedirect Action não emitido\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Canaleta $channel não está vivo em $server_ip, Redirect comando não introduzido\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "Redirect comando emitido para Canaleta $channel em $server_ip\n"; + } + } +} + + + +###################### +# ACTION=Monitor or Stop Monitor - insert Monitor/StopMonitor Manager statement to start recording on a channel +###################### +if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) +{ + if ($ACTION=="StopMonitor") + {$SQLfile = "";} + else + {$SQLfile = "File: $filename";} + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Canaleta $channel é inválido or queryCID $queryCID é inválido or filename: $filename é inválido, $ACTION comando não introduzido\n"; + } + else + { + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Canaleta $channel não está vivo em $server_ip, $ACTION comando não introduzido\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','$ACTION','$queryCID','Channel: $channel','$SQLfile','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + if ($ACTION=="Monitor") + { + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + } + echo "$ACTION comando emitido para Canaleta $channel em $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n"; + } + } +} + + + + + + +###################### +# ACTION=MonitorConf or StopMonitorConf - insert Monitor/StopMonitor Manager statement to start recording on a conference +###################### +if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($channel)<4) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Canaleta $channel é inválido or exten $exten é inválido or filename: $filename é inválido, $ACTION comando não introduzido\n"; + } + else + { + + if ($ACTION=="MonitorConf") + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$filename','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $filename','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + # find and hang up all recordings going em in this conference # and extension = '$exten' + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$channel%\" and channel LIKE \"%,1\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + # $rec_count = intval(mysql_num_rows($rslt) / 2); + $rec_count = mysql_num_rows($rslt); + $h=0; + while ($rec_count>$h) + { + $rowx=mysql_fetch_row($rslt); + $HUchannel[$h] = $rowx[0]; + $h++; + } + $i=0; + while ($h>$i) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$i','Channel: $HUchannel[$i]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $i++; + } + + } + echo "$ACTION comando emitido para Canaleta $channel em $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n A GRAVAÇÃO DURARà ATÉ 60 MINUTOS\n"; + } +} + + + + + +###################### +# ACTION=VolumeControl - raise or lower the volume of a meetme participant +###################### +if ($ACTION=="VolumeControl") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($stage)<1) or (strlen($queryCID)<1) ) + { + echo "Conferência $exten, Stage $stage é inválido or queryCID $queryCID é inválido, Originate comando não introduzido\n"; + } + else + { + $participant_number='XXYYXXYYXXYYXX'; + if (eregi('UP',$stage)) {$vol_prefix='4';} + if (eregi('DOWN',$stage)) {$vol_prefix='3';} + if (eregi('UNMUTE',$stage)) {$vol_prefix='2';} + if (eregi('MUTING',$stage)) {$vol_prefix='1';} + $local_DEF = 'Local/'; + $local_AMP = '@'; + $volume_local_channel = "$local_DEF$participant_number$vol_prefix$exten$local_AMP$ext_context"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $volume_local_channel','Context: $ext_context','Exten: 8300','Priority: 1','Callerid: $queryCID','','','','$channel','$exten');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Volume comando emitido para Conferência $exten, Stage $stage Canaleta $channel em $server_ip\n"; + } +} + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='debug') {echo "\n";} +if ($format=='debug') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/park_calls_display.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/park_calls_display.php new file mode 100644 index 00000000..40317dfd --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/park_calls_display.php @@ -0,0 +1,146 @@ + LICENSE: GPLv2 +### +### 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 +# + +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árioname/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 "\n"; +echo "\n"; +echo "\n"; +echo "Exposição Estacionada Das Chamadas"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten é inválido ou protocolo $protocol é inválido\n"; + exit; + } + else + { + ##### print parked calls from the parked_channels table + $stmt="SELECT * from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;"; + if ($format=='debug') {echo "\n";} + $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"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/vdc_db_query.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/vdc_db_query.php new file mode 100644 index 00000000..26896576 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/vdc_db_query.php @@ -0,0 +1,2535 @@ + LICENSE: GPLv2 +# +# 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 - ('regCLOSER','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCALL','manDiaLlogCALL','userLOGout','updateDISPO','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs','CalLBacKLisT','CalLBacKCounT','PauseCodeSubmit','LogiNCamPaigns') +# - $stage - ('start','finish','lookup','new') +# - $closer_choice - ('CL_TESTCAMP_L CL_OUT123_L -') +# - $conf_exten - ('8600011',...) +# - $exten - ('123test',...) +# - $ext_context - ('default','demo',...) +# - $ext_priority - ('1','2',...) +# - $campaign - ('testcamp',...) +# - $dial_timeout - ('60','26',...) +# - $dial_prefix - ('9','8',...) +# - $campaign_cid - ('3125551212','0000000000',...) +# - $MDnextCID - ('M06301413000000002',...) +# - $uniqueid - ('1120232758.2406800',...) +# - $lead_id - ('36524',...) +# - $list_id - ('101','123456',...) +# - $length_in_sec - ('12',...) +# - $phone_code - ('1',...) +# - $phone_number - ('3125551212',...) +# - $channel - ('Zap/12-1',...) +# - $start_epoch - ('1120236911',...) +# - $vendor_lead_code - ('1234test',...) +# - $title - ('Mr.',...) +# - $first_name - ('Bob',...) +# - $middle_initial - ('L',...) +# - $last_name - ('Wilson',...) +# - $address1 - ('1324 Main St.',...) +# - $address2 - ('Apt. 12',...) +# - $address3 - ('co Robert Wilson',...) +# - $city - ('Chicago',...) +# - $state - ('IL',...) +# - $province - ('NA',...) +# - $postal_code - ('60054',...) +# - $country_code - ('USA',...) +# - $gender - ('M',...) +# - $date_of_birth - ('1970-01-01',...) +# - $alt_phone - ('3125551213',...) +# - $email - ('bob@bob.com',...) +# - $security_phrase - ('Hello',...) +# - $comments - ('Good Customer',...) +# - $auto_dial_level - ('0','1','1.2',...) +# - $VDstop_rec_after_each_call - ('0','1') +# - $conf_silent_prefix - ('7','8','',...) +# - $extension - ('123','user123','25-1',...) +# - $protocol - ('Zap','SIP','IAX2',...) +# - $user_abb - ('1234','6666',...) +# - $preview - ('YES','NO',...) +# - $called_count - ('0','1','2',...) +# - $agent_log_id - ('123456',...) +# - $agent_log - ('NO',...) +# - $favorites_list - (",'cc160','cc100'",...) +# - $CallBackDatETimE - ('2006-04-21 14:30:00',...) +# - $recipient - ('ANYONE,'USERONLY') +# - $callback_id - ('12345','12346',...) +# - $use_internal_dnc - ('Y','N') +# - $omit_phone_code - ('Y','N') +# - $no_delete_sessions - ('0','1') + +# CHANGELOG: +# 50629-1044 - First build of script +# 50630-1422 - Added manual dial action and MD channel lookup +# 50701-1451 - Added dial log for start and end of vicidial calls +# 50705-1239 - Added call disposition update +# 50804-1627 - Fixed updateDispo to update vicidial_log entry +# 50816-1605 - Added VDADpause/ready for auto dialing +# 50816-1811 - Added basic autodial call pickup functions +# 50817-1005 - Altered logging functions to accomodate auto_dialing +# 50818-1305 - Added stop-all-recordings-after-each-vicidial-call option +# 50818-1411 - Added hangup of agent phone after Logout +# 50901-1315 - Fixed CLOSER IN-GROUP Web Form bug +# 50902-1507 - Fixed CLOSER log length_in_sec bug +# 50902-1730 - Added functions for manual preview dialing and revert +# 50913-1214 - Added agent random update to leadupdate +# 51020-1421 - Added agent_log_id framework for detailed agent activity logging +# 51021-1717 - Allows for multi-line comments (changes \n to !N in database) +# 51111-1046 - Added vicidial_agent_log lead_id earlier for manual dial +# 51121-1445 - Altered echo statements for several small PHP speed optimizations +# 51122-1328 - Fixed UserLogout issue not removing conference reservation +# 51129-1012 - Added ability to accept calls from other VICIDIAL servers +# 51129-1729 - Changed manual dial to use the '/n' flag for calls +# 51221-1154 - Added SCRIPT id lookup and sending to vicidial.php for display +# 60105-1059 - Added Updating of astguiclient favorites in the DB +# 60208-1617 - Added dtmf buttons output per call +# 60213-1521 - Added closer_campaigns update to vicidial_users +# 60215-1036 - Added Callback date-time entry into vicidial_callbacks table +# 60413-1541 - Added USERONLY Callback listings output - CalLBacKLisT +# - Added USERONLY Callback count output - CalLBacKCounT +# 60414-1140 - Added Callback lead lookup for manual dialing +# 60419-1517 - After CALLBK is sent to agent, update callback record to INACTIVE +# 60421-1419 - Check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60427-1236 - Fixed closer_choice error for CLOSER campaigns +# 60609-1148 - Added ability to check for manual dial numbers in DNC +# 60619-1117 - Added variable filters to close security holes for login form +# 60623-1414 - Fixed variable filter for phone_code and fixed manual dial logic +# 60821-1600 - Added ability to omit the phone code on vicidial lead dialing +# 60821-1647 - Added ability to not delete sessions at logout +# 60906-1124 - Added lookup and sending of callback data for CALLBK calls +# 61128-2229 - Added vicidial_live_agents and vicidial_auto_calls manual dial entries +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70115-1733 - Added alt_dial functionality in auto-dial modes +# 70118-1501 - Added user_group to vicidial_log,_agent_log,_closer_log,_callbacks +# 70123-1357 - Fixed bug that would not update vicidial_closer_log status to dispo +# 70202-1438 - Added pause code submit function +# 70203-0930 - Added dialed_number to lead info output +# 70203-1030 - Added dialed_label to lead info output +# 70206-1126 - Added INBOUND status for inbound/closer calls in vicidial_live_agents +# 70212-1253 - Fixed small issue with CXFER +# 70213-1431 - Added QueueMetrics PAUSE/UNPAUSE/AGENTLOGIN/AGENTLOGOFF actions +# 70214-1231 - Added queuemetrics_log_id field for server_id in queue_log +# 70215-1210 - Added queuemetrics COMPLETEAGENT action +# 70216-1051 - Fixed double call complete queuemetrics logging +# 70222-1616 - Changed queue_log PAUSE/UNPAUSE to PAUSEALL/UNPAUSEALL +# 70309-1034 - Allow amphersands and questions marks in comments to pass through +# 70313-1052 - Allow pound signs(hash) in comments to pass through +# 70319-1544 - Added agent disable update customer data function +# 70322-1545 - Added sipsak display ability +# 70413-1253 - Fixed bug for outbound call time in CLOSER-type blended campaigns +# 70424-1100 - Fixed bug for fronter/closer calls that would delete vdac records +# 70802-1729 - Fixed bugs with pause_sec and wait_sec under certain call handling +# 70828-1443 - Added source_id to output of SCRIPTtab-IFRAME and WEBFORM +# 71029-1855 - removed campaign_id naming restrictions for CLOSER-type campaigns +# 71030-2047 - added hopper priority for auto alt dial entries +# 71116-1011 - added calls_today count updating of the vicidial_live_agents upon INCALL +# 71120-1520 - added LogiNCamPaigns to show only allowed campaigns for agents upon login +# 71125-1751 - Added inbound-group default inbound group sending to vicidial.php +# 71129-2025 - restricted callbacks count and list to campaign only +# + +$version = '2.0.4-65'; +$build = '71129-2025'; + +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["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["closer_choice"])) {$closer_choice=$_GET["closer_choice"];} + elseif (isset($_POST["closer_choice"])) {$closer_choice=$_POST["closer_choice"];} +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["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["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["dial_timeout"])) {$dial_timeout=$_GET["dial_timeout"];} + elseif (isset($_POST["dial_timeout"])) {$dial_timeout=$_POST["dial_timeout"];} +if (isset($_GET["dial_prefix"])) {$dial_prefix=$_GET["dial_prefix"];} + elseif (isset($_POST["dial_prefix"])) {$dial_prefix=$_POST["dial_prefix"];} +if (isset($_GET["campaign_cid"])) {$campaign_cid=$_GET["campaign_cid"];} + elseif (isset($_POST["campaign_cid"])) {$campaign_cid=$_POST["campaign_cid"];} +if (isset($_GET["MDnextCID"])) {$MDnextCID=$_GET["MDnextCID"];} + elseif (isset($_POST["MDnextCID"])) {$MDnextCID=$_POST["MDnextCID"];} +if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} + elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["length_in_sec"])) {$length_in_sec=$_GET["length_in_sec"];} + elseif (isset($_POST["length_in_sec"])) {$length_in_sec=$_POST["length_in_sec"];} +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["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["start_epoch"])) {$start_epoch=$_GET["start_epoch"];} + elseif (isset($_POST["start_epoch"])) {$start_epoch=$_POST["start_epoch"];} +if (isset($_GET["dispo_choice"])) {$dispo_choice=$_GET["dispo_choice"];} + elseif (isset($_POST["dispo_choice"])) {$dispo_choice=$_POST["dispo_choice"];} +if (isset($_GET["vendor_lead_code"])) {$vendor_lead_code=$_GET["vendor_lead_code"];} + elseif (isset($_POST["vendor_lead_code"])) {$vendor_lead_code=$_POST["vendor_lead_code"];} +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["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["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_GET["VDstop_rec_after_each_call"];} + elseif (isset($_POST["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_POST["VDstop_rec_after_each_call"];} +if (isset($_GET["conf_silent_prefix"])) {$conf_silent_prefix=$_GET["conf_silent_prefix"];} + elseif (isset($_POST["conf_silent_prefix"])) {$conf_silent_prefix=$_POST["conf_silent_prefix"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} +if (isset($_GET["user_abb"])) {$user_abb=$_GET["user_abb"];} + elseif (isset($_POST["user_abb"])) {$user_abb=$_POST["user_abb"];} +if (isset($_GET["preview"])) {$preview=$_GET["preview"];} + elseif (isset($_POST["preview"])) {$preview=$_POST["preview"];} +if (isset($_GET["called_count"])) {$called_count=$_GET["called_count"];} + elseif (isset($_POST["called_count"])) {$called_count=$_POST["called_count"];} +if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];} + elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];} +if (isset($_GET["agent_log"])) {$agent_log=$_GET["agent_log"];} + elseif (isset($_POST["agent_log"])) {$agent_log=$_POST["agent_log"];} +if (isset($_GET["favorites_list"])) {$favorites_list=$_GET["favorites_list"];} + elseif (isset($_POST["favorites_list"])) {$favorites_list=$_POST["favorites_list"];} +if (isset($_GET["CallBackDatETimE"])) {$CallBackDatETimE=$_GET["CallBackDatETimE"];} + elseif (isset($_POST["CallBackDatETimE"])) {$CallBackDatETimE=$_POST["CallBackDatETimE"];} +if (isset($_GET["recipient"])) {$recipient=$_GET["recipient"];} + elseif (isset($_POST["recipient"])) {$recipient=$_POST["recipient"];} +if (isset($_GET["callback_id"])) {$callback_id=$_GET["callback_id"];} + elseif (isset($_POST["callback_id"])) {$callback_id=$_POST["callback_id"];} +if (isset($_GET["use_internal_dnc"])) {$use_internal_dnc=$_GET["use_internal_dnc"];} + elseif (isset($_POST["use_internal_dnc"])) {$use_internal_dnc=$_POST["use_internal_dnc"];} +if (isset($_GET["omit_phone_code"])) {$omit_phone_code=$_GET["omit_phone_code"];} + elseif (isset($_POST["omit_phone_code"])) {$omit_phone_code=$_POST["omit_phone_code"];} +if (isset($_GET["phone_ip"])) {$phone_ip=$_GET["phone_ip"];} + elseif (isset($_POST["phone_ip"])) {$phone_ip=$_POST["phone_ip"];} +if (isset($_GET["enable_sipsak_messages"])) {$enable_sipsak_messages=$_GET["enable_sipsak_messages"];} + elseif (isset($_POST["enable_sipsak_messages"])) {$enable_sipsak_messages=$_POST["enable_sipsak_messages"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} + + +$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); + + +# default optional vars if not set +if (!isset($format)) {$format="text";} + if ($format == 'debug') {$DB=1;} +if (!isset($ACTION)) {$ACTION="refresh";} + +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$CIDdate = date("mdHis"); +$ENTRYdate = date("YmdHis"); +if (!isset($query_date)) {$query_date = $NOW_DATE;} +$MT[0]=''; +$agents='@agents'; + +if ($ACTION == 'LogiNCamPaigns') + { + $skip_user_validation=1; + } +else + { + $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árioname/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 "\n"; +echo "\n"; +echo "\n"; +echo "VICIDiaL Certificado Da Pergunta Da Base de dados"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + +################################################################################ +### LogiNCamPaigns - generates an HTML SELECT list of allowed campaigns for a +### specific agent on the login screen +################################################################################ +if ($ACTION == 'LogiNCamPaigns') +{ + if ( (strlen($user)<1) ) + { + echo "\n"; + exit; + } + else + { + echo "\n"; + exit; + } +} + + + +################################################################################ +### regCLOSER - update the vicidial_live_agents table to reflect the closer +### inbound choices made upon login +################################################################################ +if ($ACTION == 'regCLOSER') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($closer_choice)<1) || (strlen($user)<1) ) + { + $channel_live=0; + echo "Escolha Do Grupo $closer_choice é inválido\n"; + exit; + } + else + { + if ($closer_choice == "MGRLOCK-") + { + $stmt="SELECT closer_campaigns FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $closer_choice =$row[0]; + + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_users set closer_campaigns='$closer_choice' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $in_groups_pre = preg_replace('/-$/','',$closer_choice); + $in_groups = explode(" ",$in_groups_pre); + $in_groups_ct = count($in_groups); + $k=1; + while ($k < $in_groups_ct) + { + if (strlen($in_groups[$k])>1) + { + $stmt="SELECT group_weight,calls_today FROM vicidial_inbound_group_agents where user='$user' and group_id='$in_groups[$k]';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $viga_ct = mysql_num_rows($rslt); + if ($viga_ct > 0) + { + $row=mysql_fetch_row($rslt); + $group_weight = $row[0]; + $calls_today = $row[1]; + } + else + { + $group_weight = 0; + $calls_today = 0; + } + $stmt="INSERT INTO vicidial_live_inbound_agents set user='$user',group_id='$in_groups[$k]',group_weight='$group_weight',calls_today='$calls_today',last_call_time='$NOW_TIME',last_call_finish='$NOW_TIME';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + $k++; + } + + } + echo "Closer In Escolha Do Grupo $closer_choice foi registado ao usuário $user\n"; +} + + +################################################################################ +### manDiaLnextCALL - for manual VICIDiaL dialing this will grab the next lead +### in the campaign, reserve it, send data back to client and +### place the call by inserting into vicidial_manager +################################################################################ +if ($ACTION == 'manDiaLnextCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "FUNIL VAZIO\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context é inválido\n"; + exit; + } + else + { + + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### check if this is a callback, if it is, skip the grabbing of a new lead and mark the callback as INACTIVE + if ( (strlen($callback_id)>0) and (strlen($lead_id)>0) ) + { + $affected_rows=1; + $CBleadIDset=1; + + $stmt = "UPDATE vicidial_callbacks set status='INACTIVE' where callback_id='$callback_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + if (strlen($phone_number)>3) + { + if ($use_internal_dnc=='Y') + { + $stmt="SELECT count(*) FROM vicidial_dnc where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + echo "DNC NÚMERO\n"; + exit; + } + } + if ($stage=='lookup') + { + $stmt="SELECT lead_id FROM vicidial_list where phone_number='$phone_number' order by modify_date desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $man_leadID_ct = mysql_num_rows($rslt); + if ($man_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $affected_rows=1; + $lead_id =$row[0]; + $CBleadIDset=1; + } + else + { + ### insert a new lead in the system with this phone number + $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $lead_id = mysql_insert_id($link); + $CBleadIDset=1; + } + } + else + { + ### insert a new lead in the system with this phone number + $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $lead_id = mysql_insert_id($link); + $CBleadIDset=1; + } + } + else + { + ### grab the next lead in the hopper for this campaign and reserve it for the user + $stmt = "UPDATE vicidial_hopper set status='QUEUE', user='$user' where campaign_id='$campaign' and status='READY' order by hopper_id LIMIT 1"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + } + } + + if ($affected_rows > 0) + { + if (!$CBleadIDset) + { + ##### grab the lead_id of the reserved user in vicidial_hopper + $stmt="SELECT lead_id FROM vicidial_hopper where campaign_id='$campaign' and status='QUEUE' and user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $hopper_leadID_ct = mysql_num_rows($rslt); + if ($hopper_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + } + } + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $source_id = trim("$row[6]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + $called_count++; + + ##### check if system is set to generate logfile for transfers + $stmt="SELECT enable_agc_xfer_log FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enable_agc_xfer_log_ct = mysql_num_rows($rslt); + if ($enable_agc_xfer_log_ct > 0) + { + $row=mysql_fetch_row($rslt); + $enable_agc_xfer_log =$row[0]; + } + + if ( ($WeBRooTWritablE > 0) and ($enable_agc_xfer_log > 0) ) + { + # DATETIME|campaign|lead_id|phone_number|user|type + # 2007-08-22 11:11:11|TESTCAMP|65432|3125551212|1234|M + $fp = fopen ("./xfer_log.txt", "a"); + fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$phone_number|$user|M\n"); + fclose($fp); + } + + ##### if lead is a callback, grab the callback comments + $CBentry_time = ''; + $CBcallback_time = ''; + $CBuser = ''; + $CBcomments = ''; + if (ereg("CALLBK",$dispo)) + { + $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBentry_time = trim("$row[0]"); + $CBcallback_time = trim("$row[1]"); + $CBuser = trim("$row[2]"); + $CBcomments = trim("$row[3]"); + } + } + + ### flag the lead as called and change it's status to INCALL + $stmt = "UPDATE vicidial_list set status='INCALL', called_since_last_reset='Y', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + if (!$CBleadIDset) + { + ### delete the lead from the hopper + $stmt = "DELETE FROM vicidial_hopper where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $stmt="UPDATE vicidial_agent_log set lead_id='$lead_id',comments='MANUAL' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + ### if preview dialing, do not send the call + if ( (strlen($preview)<1) || ($preview == 'NO') ) + { + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### whether to omit phone_code or not + if (eregi('Y',$omit_phone_code)) + {$Ndialstring = "$Local_out_prefix$phone_number";} + else + {$Ndialstring = "$Local_out_prefix$phone_code$phone_number";} + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$server_ip','$campaign','XFER','$lead_id','$MqueryCID','$phone_code','$phone_number','$NOW_TIME','OUT')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',callerid='$MqueryCID',lead_id='$lead_id',comments='MANUAL',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update calls_today count in vicidial_campaign_agents + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $MqueryCID . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + $LeaD_InfO .= $CBentry_time . "\n"; + $LeaD_InfO .= $CBcallback_time . "\n"; + $LeaD_InfO .= $CBuser . "\n"; + $LeaD_InfO .= $CBcomments . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= "MAIN\n"; + $LeaD_InfO .= $source_id . "\n"; + + echo $LeaD_InfO; + + } + else + { + echo "FUNIL VAZIO\n"; + } + } +} + + +################################################################################ +### manDiaLskip - for manual VICIDiaL dialing this skips the lead that was +### previewed in the step above and puts it back in orig status +################################################################################ +if ($ACTION == 'manDiaLskip') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($stage)<1) || (strlen($called_count)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "LEAD NOT REVERTED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context é inválido\n"; + exit; + } + else + { + $called_count = ($called_count - 1); + ### flag the lead as called and change it's status to INCALL + $stmt = "UPDATE vicidial_list set status='$stage', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + + echo "LEAD REVERTED\n"; + } +} + + +################################################################################ +### manDiaLonly - for manual VICIDiaL dialing this sends the call that was +### previewed in the step above +################################################################################ +if ($ACTION == 'manDiaLonly') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) || (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo " CHAMADA NOT PLACED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context é inválido\n"; + exit; + } + else + { + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### whether to omit phone_code or not + if (eregi('Y',$omit_phone_code)) + {$Ndialstring = "$Local_out_prefix$phone_number";} + else + {$Ndialstring = "$Local_out_prefix$phone_code$phone_number";} + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$server_ip','$campaign','XFER','$lead_id','$MqueryCID','$phone_code','$phone_number','$NOW_TIME','OUT')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',callerid='$MqueryCID',lead_id='$lead_id',comments='MANUAL',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + echo "$MqueryCID\n"; + } +} + + +################################################################################ +### manDiaLlookCALL - for manual VICIDiaL dialing this will attempt to look up +### the trunk channel that the call was placed on +################################################################################ +if ($ACTION == 'manDiaLlookCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; +if (strlen($MDnextCID)<18) + { + echo "NO\n"; + echo "MDnextCID $MDnextCID é inválido\n"; + exit; + } +else + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT uniqueid,channel FROM vicidial_manager where callerid='$MDnextCID' and server_ip='$server_ip' and status='UPDATED' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $uniqueid =$row[0]; + $channel =$row[1]; + echo "$uniqueid\n$channel"; + + $wait_sec=0; + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',wait_epoch='$StarTtime',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + echo "NO\n"; + } + } +} + + + +################################################################################ +### manDiaLlogCALL - for manual VICIDiaL logging of calls places record in +### vicidial_log and then sends process to call_log entry +################################################################################ +if ($ACTION == 'manDiaLlogCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + +if ($stage == "start") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) || (strlen($list_id)<1) || (strlen($phone_number)<1) || (strlen($campaign)<1) ) + { + echo "REGISTRO NÃO ENTRADO\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id or list_id: $list_id or phone_number: $phone_number or campaign: $campaign é inválido\n"; + exit; + } + else + { + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + ##### insert log into vicidial_log for manual VICIDiaL call + $stmt="INSERT INTO vicidial_log (uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,comments,processed,user_group) values('$uniqueid','$lead_id','$list_id','$campaign','$NOW_TIME','$StarTtime','INCALL','$phone_code','$phone_number','$user','MANUAL','N','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "VICIDiaL_LOG Introduzido: $uniqueid|$channel|$NOW_TIME\n"; + echo "$StarTtime\n"; + } + else + { + echo "REGISTRO NÃO ENTRADO\n"; + } + + $stmt = "UPDATE vicidial_auto_calls SET uniqueid='$uniqueid' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + # ##### insert log into call_log for manual VICIDiaL call + # $stmt = "INSERT INTO call_log (uniqueid,channel,server_ip,extension,number_dialed,caller_code,start_time,start_epoch) values('$uniqueid','$channel','$server_ip','$exten','$phone_code$phone_number','MD $user $lead_id','$NOW_TIME','$StarTtime')"; + # if ($DB) {echo "$stmt\n";} + # $rslt=mysql_query($stmt, $link); + # $affected_rows = mysql_affected_rows($link); + + # if ($affected_rows > 0) + # { + # echo "CALL_LOG Introduzido: $uniqueid|$channel|$NOW_TIME"; + # } + # else + # { + # echo "REGISTRO NÃO ENTRADO\n"; + # } + } + } + +if ($stage == "end") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) ) + { + echo "REGISTRO NÃO ENTRADO\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id é inválido\n"; + exit; + } + else + { + if ($start_epoch < 1000) + { + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + ##### look for the start epoch in the vicidial_closer_log table + $stmt="SELECT start_epoch FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user' order by closecallid desc limit 1;"; + } + else + { + ##### look for the start epoch in the vicidial_log table + $stmt="SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + } + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch =$row[0]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($length_in_sec < 1) and ($row[0] > 0) ) + { + ##### start epoch in the vicidial_log table, couldn't find one in vicidial_closer_log + $stmt="SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch =$row[0]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + } + } + else {$length_in_sec = ($StarTtime - $start_epoch);} + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec',status='DONE' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + ############################################# + ##### COMEÇO QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + + if ($auto_dial_level > 0) + { + ### check to see if campaign has alt_dial enabled + $stmt="SELECT auto_alt_dial FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_alt_dial =$row[0]; + } + else {$auto_alt_dial = 'NONE';} + if (eregi("(ALT_ONLY|ADDR3_ONLY|ALT_AND_ADDR3)",$auto_alt_dial)) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT alt_dial FROM vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alt_dial =$row[0]; + } + else {$alt_dial = 'NONE';} + + if ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("(ALT_ONLY|ALT_AND_ADDR3)",$auto_alt_dial)) ) + { + $stmt="SELECT alt_phone,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alt_phone = $row[0]; + $alt_phone = eregi_replace("[^0-9]","",$alt_phone); + $gmt_offset_now = $row[1]; + $state = $row[2]; + } + else {$alt_phone = '';} + if (strlen($alt_phone)>5) + { + ### insert record into vicidial_hopper for alt_phone call attempt + $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ALT',user='',priority='25';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + } + if ( ( (eregi("(ALT)",$alt_dial)) and (eregi("ALT_AND_ADDR3",$auto_alt_dial)) ) or ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("ADDR3_ONLY",$auto_alt_dial)) ) ) + { + $stmt="SELECT address3,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $address3 = $row[0]; + $address3 = eregi_replace("[^0-9]","",$address3); + $gmt_offset_now = $row[1]; + $state = $row[2]; + } + else {$address3 = '';} + if (strlen($address3)>5) + { + ### insert record into vicidial_hopper for address3 call attempt + $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ADDR3',user='',priority='20';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + + if ($enable_queuemetrics_logging > 0) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_qm_ct = mysql_num_rows($rslt); + if ($VAC_qm_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_call_id = $row[0]; + $CLlead_id = $row[1]; + $CLphone_number = $row[2]; + $CLstatus = $row[3]; + $CLcampaign_id = $row[4]; + $CLphone_code = $row[5]; + $CLalt_dial = $row[6]; + $CLstage = $row[7]; + $CLcallerid = $row[8]; + $CLuniqueid = $row[9]; + } + + $CLstage = preg_replace("/.*-/",'',$CLstage); + if (strlen($CLstage) < 1) {$CLstage=0;} + + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt="SELECT count(*) from queue_log where call_id='$MDnextCID' and verb='COMPLETECALLER';"; + $rslt=mysql_query($stmt, $linkB); + if ($DB) {echo "$stmt\n";} + $VAC_cc_ct = mysql_num_rows($rslt); + if ($VAC_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $caller_complete = $row[0]; + } + + if ($caller_complete < 1) + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + } + mysql_close($linkB); + } + + ### delete call record from vicidial_auto_calls + $stmt = "DELETE from vicidial_auto_calls where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + + + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',lead_id='',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSAALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } + else + { + if ($enable_queuemetrics_logging > 0) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_qm_ct = mysql_num_rows($rslt); + if ($VAC_qm_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_call_id = $row[0]; + $CLlead_id = $row[1]; + $CLphone_number = $row[2]; + $CLstatus = $row[3]; + $CLcampaign_id = $row[4]; + $CLphone_code = $row[5]; + $CLalt_dial = $row[6]; + $CLstage = $row[7]; + $CLcallerid = $row[8]; + $CLuniqueid = $row[9]; + } + + $CLstage = preg_replace("/XFER|-/",'',$CLstage); + if ($CLstage < 0.25) {$CLstage=0;} + + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + + $stmt = "DELETE from vicidial_auto_calls lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',lead_id='',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSAALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } + + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' where uniqueid='$uniqueid' and lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "$uniqueid\n$channel\n"; + } + else + { + echo "REGISTRO NÃO ENTRADO\n\n"; + } + } + + echo $VDstop_rec_after_each_call . '|' . $extension . '|' . $conf_silent_prefix . '|' . $conf_exten . '|' . $user_abb . "|\n"; + + ##### if VICIDiaL call and hangup_after_each_call activated, find all recording + ##### channels and hang them up while entering info into recording_log and + ##### returning filename/recordingID + if ($VDstop_rec_after_each_call == 1) + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $total_rec=0; + $loop_count=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten' order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$rec_list = mysql_num_rows($rslt);} + while ($rec_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + if (preg_match("/Local\/$conf_silent_prefix$conf_exten\@/i",$row[0])) + { + $rec_channels[$total_rec] = "$row[0]"; + $total_rec++; + } + if ($format=='debug') {echo "\n";} + $loop_count++; + } + + $total_recFN=0; + $loop_count=0; + $filename=$MT; # not necessary : and cmd_line_f LIKE \"%_$user_abb\" + $stmt="SELECT cmd_line_f FROM vicidial_manager where server_ip='$server_ip' and action='Originate' and cmd_line_b = 'Channel: $local_DEF$conf_silent_prefix$conf_exten$local_AMP$ext_context' order by entry_date desc limit $total_rec;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$recFN_list = mysql_num_rows($rslt);} + while ($recFN_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + $filename[$total_recFN] = preg_replace("/Callerid: /i","",$row[0]); + if ($format=='debug') {echo "\n";} + $total_recFN++; + $loop_count++; + } + + $loop_count=0; + while($loop_count < $total_rec) + { + if (strlen($rec_channels[$loop_count])>5) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$loop_count','Channel: $rec_channels[$loop_count]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "REC_STOP|$rec_channels[$loop_count]|$filename[$loop_count]|"; + if (strlen($filename)>2) + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename[$loop_count]'"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$fn_count = mysql_num_rows($rslt);} + if ($fn_count) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt="UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename[$loop_count]' and end_epoch is NULL;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "$recording_id|$length_in_min|"; + } + else {echo "||";} + } + else {echo "||";} + echo "\n"; + } + $loop_count++; + } + } + + + $talk_sec=0; + $StarTtime = date("U"); + $stmt = "select talk_epoch,talk_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $talk_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set talk_sec='$talk_sec',talk_epoch='$StarTtime',dispo_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } +} + + +################################################################################ +### VDADREcheckINCOMING - for auto-dial VICIDiaL dialing this will recheck for +### calls to see if the channel has updated +################################################################################ +if ($ACTION == 'VDADREcheckINCOMING') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "Campanha $campaign é inválido\n"; + echo "lead_id $lead_id é inválido\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + } + } +} + + +################################################################################ +### VDADcheckINCOMING - for auto-dial VICIDiaL dialing this will check for calls +### in the vicidial_live_agents table in QUEUE status, then +### lookup the lead info and pass it back to vicidial.php +################################################################################ +if ($ACTION == 'VDADcheckINCOMING') +{ + $Ctype = 'A'; + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "Campanha $campaign é inválido\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and status='QUEUE';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',comments='AUTO',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $source_id = trim("$row[6]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + ##### if lead is a callback, grab the callback comments + $CBentry_time = ''; + $CBcallback_time = ''; + $CBuser = ''; + $CBcomments = ''; + if (ereg("CALLBK",$dispo)) + { + $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBentry_time = trim("$row[0]"); + $CBcallback_time = trim("$row[1]"); + $CBuser = trim("$row[2]"); + $CBcomments = trim("$row[3]"); + } + } + + ### update the lead status to INCALL + $stmt = "UPDATE vicidial_list set status='INCALL', user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the log status to INCALL + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + $stmt = "UPDATE vicidial_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL', user_group='$user_group' where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + ### update the vicidial_closer_log user to INCALL + $stmt = "UPDATE vicidial_closer_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL', user_group='$user_group' where lead_id='$lead_id' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select campaign_id,phone_number,alt_dial from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($VDAC_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDADchannel_group =$row[0]; + $dialed_number =$row[1]; + $dialed_label =$row[2]; + } + else + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|INBND|$callerid|$user|$user_group|$list_id|$lead_id|$phone_number|$uniqueid|\n"); + fclose($fp); + } + } + + $stmt = "select count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDL_cid_ct = mysql_num_rows($rslt); + if ($VDL_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_front_VDlog =$row[0]; + } + + $stmt = "select * from vicidial_inbound_groups where group_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_group_name = $row[1]; + $VDCL_group_color = $row[2]; + $VDCL_group_web = $row[4]; + $VDCL_fronter_display = $row[7]; + $VDCL_ingroup_script = $row[8]; + $VDCL_get_call_launch = $row[9]; + $VDCL_xferconf_a_dtmf = $row[10]; + $VDCL_xferconf_a_number = $row[11]; + $VDCL_xferconf_b_dtmf = $row[12]; + $VDCL_xferconf_b_number = $row[13]; + $VDCL_default_xfer_group= $row[28]; + + ### update the comments in vicidial_live_agents record + $stmt = "UPDATE vicidial_live_agents set comments='INBOUND' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $Ctype = 'I'; + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_ingroup_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + } + + ### if web form is set then send em to vicidial.php for override of WEB_FORM address + if ( (strlen($VDCL_group_web)>5) or (strlen($VDCL_group_name)>0) ) {echo "$VDCL_group_web|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|\n";} + else {echo "|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|\n";} + + $stmt = "SELECT full_name from vicidial_users where user='$tsr';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDU_cid_ct = mysql_num_rows($rslt); + if ($VDU_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $fronter_full_name = $row[0]; + echo $fronter_full_name . '|' . $tsr . "\n"; + } + else {echo '|' . $tsr . "\n";} + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_campaign_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + echo "|||||$VDCL_campaign_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n|\n"; + + $stmt = "select phone_number,alt_dial from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($VDAC_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dialed_number =$row[0]; + $dialed_label =$row[1]; + } + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $callerid . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + $LeaD_InfO .= $CBentry_time . "\n"; + $LeaD_InfO .= $CBcallback_time . "\n"; + $LeaD_InfO .= $CBuser . "\n"; + $LeaD_InfO .= $CBcomments . "\n"; + $LeaD_InfO .= $dialed_number . "\n"; + $LeaD_InfO .= $dialed_label . "\n"; + $LeaD_InfO .= $source_id . "\n"; + + echo $LeaD_InfO; + + + + $wait_sec=0; + $StarTtime = date("U"); + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + ### If CHAMADABK, change vicidial_callback record to INACTIVE + if (eregi("CALLBK|CBHOLD", $dispo)) + { + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='$lead_id' and status NOT IN('INACTIVE','DEAD','ARCHIVE');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + ##### check if system is set to generate logfile for transfers + $stmt="SELECT enable_agc_xfer_log FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enable_agc_xfer_log_ct = mysql_num_rows($rslt); + if ($enable_agc_xfer_log_ct > 0) + { + $row=mysql_fetch_row($rslt); + $enable_agc_xfer_log =$row[0]; + } + + if ( ($WeBRooTWritablE > 0) and ($enable_agc_xfer_log > 0) ) + { + # DATETIME|campaign|lead_id|phone_number|user|type + # 2007-08-22 11:11:11|TESTCAMP|65432|3125551212|1234|A + $fp = fopen ("./xfer_log.txt", "a"); + fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$phone_number|$user|$Ctype\n"); + fclose($fp); + } + + } + else + { + echo "0\n"; + # echo "No calls in QUEUE for $user em $server_ip\n"; + exit; + } + } +} + + +################################################################################ +### userLOGout - Logs the user out of VICIDiaL client, deleting db records and +### inserting into vicidial_user_log +################################################################################ +if ($ACTION == 'userLOGout') +{ + $MT[0]=''; + $row=''; $rowx=''; +if ( (strlen($campaign)<1) || (strlen($conf_exten)<1) ) + { + echo "NO\n"; + echo "campaign $campaign or conf_exten $conf_exten é inválido\n"; + exit; + } +else + { + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + ##### Insert a LOGOUT record into the user log + $stmt="INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$user','LOGOUT','$campaign','$NOW_TIME','$StarTtime','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vul_insert = mysql_affected_rows($link); + + if ($no_delete_sessions < 1) + { + ##### Remove the reservation em the vicidial_conferences meetme room + $stmt="UPDATE vicidial_conferences set extension='' where server_ip='$server_ip' and conf_exten='$conf_exten';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vc_remove = mysql_affected_rows($link); + } + + ##### Delete the vicidial_live_agents record for this session + $stmt="DELETE from vicidial_live_agents where server_ip='$server_ip' and user ='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vla_delete = mysql_affected_rows($link); + + ##### Delete the vicidial_live_inbound_agents records for this session + $stmt="DELETE from vicidial_live_inbound_agents where user ='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vlia_delete = mysql_affected_rows($link); + + ##### Delete the web_client_sessions + $stmt="DELETE from web_client_sessions where server_ip='$server_ip' and session_name ='$session_name';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $wcs_delete = mysql_affected_rows($link); + + ##### Hangup the client phone + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$extension%\" order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) + { + $row=mysql_fetch_row($rslt); + $agent_channel = "$row[0]"; + if ($format=='debug') {echo "\n";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','ULGH3459$StarTtime','Channel: $agent_channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $pause_sec=0; + $stmt = "select pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ( ($VDpr_ct > 0) and (strlen($row[3]<5)) and (strlen($row[4]<5)) ) + { + $row=mysql_fetch_row($rslt); + $pause_sec = (($StarTtime - $row[0]) + $row[1]); + + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + if ($vla_delete > 0) + { + ############################################# + ##### COMEÇO QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $allow_sipsak_messages = $row[6]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_message = 'LOGGED OUT'; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_message\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + } + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + # $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='PAUSA',serverid='1';"; + # if ($DB) {echo "$stmt\n";} + # if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + # $rslt=mysql_query($stmt, $linkB); + # $affected_rows = mysql_affected_rows($linkB); + + $stmt = "SELECT time_id FROM queue_log where agent='Agent/$user' and verb='AGENTLOGIN' order by time_id desc limit 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + if ($DB) {echo "$stmt\n";} + echo "$stmt\n"; + $li_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $li_conf_ct) + { + $row=mysql_fetch_row($rslt); + $logintime = $row[0]; + $i++; + } + + $time_logged_in = ($StarTtime - $logintime); + if ($time_logged_in > 1000000) {$time_logged_in=1;} + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='AGENTLOGOFF',data1='$user$agents',data2='$time_logged_in',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + + echo "$vul_insert|$vc_remove|$vla_delete|$wcs_delete|$agent_channel|$vlia_delete\n"; + } +} + + +################################################################################ +### updateDISPO - update the vicidial_list table to reflect the agent choice of +### call disposition for that leand +################################################################################ +if ($ACTION == 'updateDISPO') +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($dispo_choice)<1) || (strlen($lead_id)<1) ) + { + echo "Dispo Choice $dispo or lead_id $lead_id é inválido\n"; + exit; + } + else + { + $stmt="UPDATE vicidial_list set status='$dispo_choice', user='$user' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by uniqueid desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + if ( ($use_internal_dnc=='Y') and ($dispo_choice=='DNC') ) + { + $stmt = "select phone_number from vicidial_list where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $stmt="INSERT INTO vicidial_dnc (phone_number) values('$row[0]');"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + } + } + + $dispo_sec=0; + $StarTtime = date("U"); + $stmt = "select dispo_epoch,dispo_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dispo_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set dispo_sec='$dispo_sec',dispo_epoch='$StarTtime',status='$dispo_choice' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id($link); + + ### CHAMADABACK ENTRY + if ( ($dispo_choice == 'CBHOLD') and (strlen($CallBackDatETimE)>10) ) + { + $stmt="INSERT INTO vicidial_callbacks (lead_id,list_id,campaign_id,status,entry_time,callback_time,user,recipient,comments,user_group) values('$lead_id','$list_id','$campaign','ACTIVE','$NOW_TIME','$CallBackDatETimE','$user','$recipient','$comments','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $stmt="SELECT auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ( ($auto_dial_level > 0) and (ereg(" $dispo_choice ",$row[0])) ) + { + $stmt = "select count(*) from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + $stmt="UPDATE vicidial_hopper set status='READY' where lead_id='$lead_id' and status='HOLD' limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + else + { + $stmt="DELETE from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + ############################################# + ##### COMEÇO QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='CALLSTATUS',data1='$dispo_choice',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + + echo 'Lead ' . $lead_id . ' foi mudado a ' . $dispo_choice . " Status\nNext agent_log_id:\n" . $agent_log_id . "\n"; +} + +################################################################################ +### updateLEAD - update the vicidial_list table to reflect the values that are +### in the agents screen at time of call hangup +################################################################################ +if ($ACTION == 'updateLEAD') +{ + $MT[0]=''; + $row=''; $rowx=''; + $DO_NOT_UPDATE=0; + $DO_NOT_UPDATE_text=''; + if ( (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + echo "phone_number $phone_number or lead_id $lead_id é inválido\n"; + exit; + } + else + { + + $stmt = "SELECT disable_alter_custdata FROM vicidial_campaigns where campaign_id='$campaign'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $dac_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $dac_conf_ct) + { + $row=mysql_fetch_row($rslt); + $disable_alter_custdata = $row[0]; + $i++; + } + if (ereg('Y',$disable_alter_custdata)) + { + $DO_NOT_UPDATE=1; + $DO_NOT_UPDATE_text=' NOT'; + $stmt = "SELECT alter_custdata_override FROM vicidial_users where user='$user'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $aco_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $aco_conf_ct) + { + $row=mysql_fetch_row($rslt); + $alter_custdata_override = $row[0]; + $i++; + } + if (ereg('ALLOW_ALTER',$alter_custdata_override)) + { + $DO_NOT_UPDATE=0; + $DO_NOT_UPDATE_text=''; + } + } + + if ($DO_NOT_UPDATE < 1) + { + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + $comments = eregi_replace("--AMP--",'&',$comments); + $comments = eregi_replace("--QUES--",'?',$comments); + $comments = eregi_replace("--POUND--",'#',$comments); + + $stmt="UPDATE vicidial_list set vendor_lead_code='" . mysql_real_escape_string($vendor_lead_code) . "', title='" . mysql_real_escape_string($title) . "', first_name='" . mysql_real_escape_string($first_name) . "', middle_initial='" . mysql_real_escape_string($middle_initial) . "', last_name='" . mysql_real_escape_string($last_name) . "', address1='" . mysql_real_escape_string($address1) . "', address2='" . mysql_real_escape_string($address2) . "', address3='" . mysql_real_escape_string($address3) . "', city='" . mysql_real_escape_string($city) . "', state='" . mysql_real_escape_string($state) . "', province='" . mysql_real_escape_string($province) . "', postal_code='" . mysql_real_escape_string($postal_code) . "', country_code='" . mysql_real_escape_string($country_code) . "', gender='" . mysql_real_escape_string($gender) . "', date_of_birth='" . mysql_real_escape_string($date_of_birth) . "', alt_phone='" . mysql_real_escape_string($alt_phone) . "', email='" . mysql_real_escape_string($email) . "', security_phrase='" . mysql_real_escape_string($security_phrase) . "', comments='" . mysql_real_escape_string($comments) . "' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } + echo "Lead $lead_id information has$DO_NOT_UPDATE_text been updated\n"; +} + + +################################################################################ +### VDADpause - update the vicidial_live_agents table to show that the agent is +### or ready now active and ready to take calls +################################################################################ +if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($stage)<2) || (strlen($server_ip)<1) ) + { + echo "stage $stage é inválido\n"; + exit; + } + else + { + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set lead_id='',uniqueid=0,callerid='',channel='', random_id='$random',comments='' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_live_agents set status='$stage' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + ############################################# + ##### COMEÇO QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + if (ereg('READY',$stage)) {$QMstatus='UNPAUSEALL';} + if (ereg('PAUSA',$stage)) {$QMstatus='PAUSAALL';} + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='$QMstatus',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + + if ($agent_log == 'NO') + {$donothing=1;} + else + { + $pause_sec=0; + $stmt = "select pause_epoch,pause_sec,wait_epoch,wait_sec,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec=0; + if ($row[2] > 0) + { + $wait_sec = (($StarTtime - $row[2]) + $row[3]); + } + if ( (eregi("NULL",$row[4])) or ($row[4] < 1000) ) + {$pause_sec = (($StarTtime - $row[0]) + $row[1]);} + else + {$pause_sec = (($row[4] - $row[0]) + $row[1]);} + + } + if ($ACTION == 'VDADready') + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($ACTION == 'VDADpause') + { + $stmt="UPDATE vicidial_agent_log set pause_epoch='$StarTtime',wait_sec='$wait_sec' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + echo 'Agent ' . $user . ' está agora no status ' . $stage . "\n"; +} + + +################################################################################ +### UpdatEFavoritEs - update the astguiclient favorites list for this extension +################################################################################ +if ($ACTION == 'UpdatEFavoritEs') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($favorites_list)<1) || (strlen($user)<1) || (strlen($exten)<1) ) + { + echo "favorites list $favorites_list é inválido\n"; + exit; + } + else + { + $stmt = "select count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + $stmt="UPDATE phone_favorites set extensions_list=\"$favorites_list\" where extension='$exten' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="INSERT INTO phone_favorites values('$exten','$server_ip',\"$favorites_list\");"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + echo "Favorites list has been updated to $favorites_list for $exten\n"; +} + + +################################################################################ +### PauseCodeSubmit - Update vicidial_agent_log with pause code +################################################################################ +if ($ACTION == 'PausaCodeSubmit') +{ + $row=''; $rowx=''; + if ( (strlen($status)<1) || (strlen($agent_log_id)<1) ) + { + echo "agent_log_id $agent_log_id or pause_code $status é inválido\n"; + exit; + } + else + { + $stmt="UPDATE vicidial_agent_log set sub_status=\"$status\" where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + ############################################# + ##### COMEÇO QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $allow_sipsak_messages = $row[6]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_prefix = 'BK-'; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$status\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + } + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='PAUSAREASON',serverid='$queuemetrics_log_id',data1='$status';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } +echo "Pausa Code has been updated to $status for $agent_log_id\n"; +} + + +################################################################################ +### CalLBacKLisT - List the USERONLY callbacks for an agent +################################################################################ +if ($ACTION == 'CalLBacKLisT') +{ +$stmt = "select callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' and campaign_id='$campaign' and status NOT IN('INACTIVE','DEAD') order by callback_time;"; +if ($DB) {echo "$stmt\n";} +$rslt=mysql_query($stmt, $link); +if ($rslt) {$callbacks_count = mysql_num_rows($rslt);} +echo "$callbacks_count\n"; +$loop_count=0; + while ($callbacks_count>$loop_count) + { + $row=mysql_fetch_row($rslt); + $callback_id[$loop_count] = $row[0]; + $lead_id[$loop_count] = $row[1]; + $campaign_id[$loop_count] = $row[2]; + $status[$loop_count] = $row[3]; + $entry_time[$loop_count] = $row[4]; + $callback_time[$loop_count] = $row[5]; + $comments[$loop_count] = $row[6]; + $loop_count++; + } +$loop_count=0; + while ($callbacks_count>$loop_count) + { + $stmt = "select first_name,last_name,phone_number from vicidial_list where lead_id='$lead_id[$loop_count]';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count]\n"; + $loop_count++; + } + +} + + +################################################################################ +### CalLBacKCounT - send the count of the USERONLY callbacks for an agent +################################################################################ +if ($ACTION == 'CalLBacKCounT') +{ +$stmt = "select count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' and campaign_id='$campaign' and status NOT IN('INACTIVE','DEAD');"; +if ($DB) {echo "$stmt\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$cbcount=$row[0]; + +echo "$cbcount"; +} + + + + +if ($format=='debug') +{ +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +echo "\n"; +echo "\n\n\n"; +} + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/vicidial.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/vicidial.php new file mode 100644 index 00000000..fea99d54 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/vicidial.php @@ -0,0 +1,6797 @@ + LICENSE: GPLv2 +# +# make sure you have added a user to the vicidial_users MySQL table with at least +# user_level 1 or greater to access this page. Also, you need to have the login +# and pass of a phone listed in the asterisk.phones table. The page grabs the +# server info and other details from this login and pass. +# +# This script works best with Firefox or Mozilla, but will run for a couple +# hours on Internet Explorer before the memory leaks cause a crash. +# +# Other scripts that this application depends on: +# - vdc_db_query.php: Updates information in the database +# - manager_send.php: Sends manager actions to the DB for execution +# +# CHANGELOG +# 50607-1426 - First Build of VICIDIAL web client basic login process finished +# 50628-1620 - Added some basic formatting and worked on process flow +# 50628-1715 - Startup variables mapped to javascript variables +# 50629-1303 - Added Login Closer in-groups selection box and vla update +# 50629-1530 - Rough layout for customer info form section and button links +# 50630-1453 - Rough Manual Dial/Hangup with customer info displayed +# 50701-1450 - Added vicidial_log entries on dial and hangup +# 50701-1634 - Added Logout function +# 50705-1259 - Added call disposition functionality +# 50705-1432 - Added lead info DB update function +# 50705-1658 - Added web form functionality +# 50706-1043 - Added call park and pickup functions +# 50706-1234 - Added Start/Stop Recording functionality +# 50706-1614 - Added conference channels display option +# 50711-1333 - Removed call check redundancy and fixed a span bug +# 50727-1424 - Added customer channel and participant present sensing/alerts +# 50804-1057 - Added SendDTMF function and reconfigured the transfer span +# 50804-1224 - Added Local and Internal Closer transfer functions +# 50804-1628 - Added Blind transfer, activated LIVE CALL image and fixed bugs +# 50804-1808 - Added button images for left buttons +# 50815-1151 - Added 3Way calling functions to Transfer-conf frame +# 50815-1602 - Added images and buttons for xfer functions +# 50816-1813 - Added basic autodial outbound call pickup functions +# 50817-1113 - Fixes to auto_dialing call receipt +# 50817-1234 - Added inbound call receipt capability +# 50817-1541 - Added customer time display +# 50817-1541 - Added customer time display +# 50818-1327 - Added stop-all-recordings-after-each-vicidial-call option +# 50818-1703 - Added pretty login section +# 50825-1200 - Modified form field lengths, added double-click dispositions +# 50831-1603 - Fixed customer time bug and fronter display bug for CLOSER +# 50901-1314 - Fixed CLOSER IN-GROUP Web Form bug +# 50903-0904 - Added preview-lead code for manual dialing +# 50904-0016 - Added ability to hangup manual dials before pickup +# 50906-1319 - Added override for filters on xfer calls, fixed login display bug +# 50909-1243 - Added hotkeys functionality for quick dispoing in auto-dial mode +# 50912-0958 - Modified hotkeys function, agent must have user_level >= 5 to use +# 50913-1212 - Added campaign_cid to 3rd party calls +# 50923-1546 - Modified to work with language translation +# 50926-1656 - Added campaign pull-down at login of active campaigns +# 50928-1633 - Added manual dial alternate number dial option +# 50930-1538 - Added session_id empty login failure and fixed 2 minor bugs +# 51004-1656 - Fixed recording filename bug and new Spanish translation +# 51020-1103 - Added campaign-specific recording control abilities +# 51020-1352 - Added Basic vicidial_agent_log framework +# 51021-1050 - Fixed custtime display and disable Enter/Return keypresses +# 51021-1718 - Allows for multi-line comments (changes \n to !N in database) +# 51110-1432 - Fixed non-standard http port issue +# 51111-1047 - Added vicidial_agent_log lead_id earlier for manual dial +# 51118-1305 - Activate multi-line comments from $multi_line_comments var +# 51118-1313 - Move Transfer DIV to a floating span to preserve 800x600 view +# 51121-1506 - Small PHP optimizations in many scripts and disabled globalize +# 51129-1010 - Added ability to accept calls from other VICIDIAL servers +# 51129-1254 - Fixed Hangups of other agents channels when customer hangs up +# 51208-1732 - Created user-first login that looks for default phone info +# 51219-1526 - Added variable framework for campaign and in-group scripts +# 51221-1200 - Added SCRIPT tab, layout and functionality +# 51221-1714 - Added auto-switch-to-SCRIPT-tab and auto-webform-popup +# 51222-1605 - Added VMail message blind transfer button to xfer-conf frame +# 51229-1028 - Added checks on web_form_address to allow for var in the DB value +# 60117-1312 - Added Transfer-conf frame toggle on button press +# 60208-1152 - Added DTMF-xfernumber preset links to xfer-conf frame +# 60213-1129 - Added vicidial_users.hotkeys_active for any user hotkeys +# 60213-1210 - Added ability to sort routing of calls by user_level +# 60214-0932 - Initial Callback calendar display framework +# 60214-1407 - Added ability to minimize the dispo screen to see info below +# 60215-1104 - Added ANYONE scheduled callbacks functionality +# 60410-1116 - Added persistant pause after dispo option and change dispo text +# - Added web form submit that opens new window with dispo on submit +# - Added PREVIOUS CALLBACK in customer info to flag callbacks +# - Added link to try to hangup the call again in the dispo screen +# - Added link noone-in-session screen to call agent phone again +# - Added link customer-hungup screen to go straight to dispo screen +# 60410-1532 - Added agent status and campaign calls dialing display option +# 60411-1547 - Add ability to set callback as USERONLY and some basic formatting +# 60413-1752 - Add basic USERONLY callback frame and listings +# 60414-1039 - Changed manual dial preview and alt dial checkboxes to spans +# - Added beta-level USERONLY callback functionality +# - Added beta-level manual dialing with lead insertion functionality +# 60415-1534 - Fixed manual dial lead preview and fixed manuald dial override bug +# 60417-1108 - Added capability to do alt-number-dialing in auto-dial mode +# - Changed several permissions to database-defined +# 60419-1529 - Prevent manual dial or callbacks when alt-dial lead not finished +# 60420-1647 - Fixed DiaLDiaLAltPhonE error, Call Agent Again DialControl error +# 60421-1229 - Check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60424-1005 - Fixed Alt phone disabled bug for callbacks and manual dials +# 60426-1058 - Added vicidial_user setting for default blended check for CLOSER +# 60501-1008 - Added option to manual dial screen to manually lookup phone number +# 60503-1653 - Fixed agentonly_callback not-defined bug in scheduled callbacks screen +# 60504-1032 - Fixed manual dial display bug and transfer dispo alert bug +# - Fixed recording filename display to not overrun 25 characters +# 60510-1051 - Added Wrapup timer and wrapup message on wrapup screen after dispo +# 60608-1453 - Added CLOSER campaign allowable in-groups limitations +# 60609-1123 - Added add-number-to-DNC-list function and manual dial check DNC +# 60619-1047 - Added variable filters to close security holes for login form +# 60804-1710 - fixed scheduled CALLBK for other languages build +# 60808-1145 - Added consultative transfers with customer data +# 60808-2232 - Added campaign name to pulldown for login screen +# 60809-1603 - Added option to locally transfer consult xfers +# 60809-1732 - Added recheck of transferred channels before customer gone mesg +# 60810-1011 - Fixed CXFER leave 3way call bugs +# 60816-1602 - Added ALLCALLS recording delay option allcalls_delay +# 60816-1716 - Fixed customer time display bug and client DST setting +# 60821-1555 - Added option to omit phone_code on dialout of leads +# 60821-1628 - Added ALLFORCE recording option +# 60821-1643 - Added no_delete_sessions option to not delete sessions +# 60822-0512 - Changed phone number fields to be maxlength of 12 +# 60829-1531 - Made compatible with WeBRooTWritablE setting in dbconnect.php +# 60906-1152 - Added Previous CallBack info display span +# 60906-1715 - Allow for Local phone extension conferences +# 61004-1729 - Add ability to control volume per channel in "calls in this session" +# 61122-1341 - Added vicidial_user_groups allowed_campaigns restrictions +# 61122-1523 - Added more SCRIPT variables +# 61128-2229 - Added vicidial_live_agents and vicidial_auto_calls manual dial entries +# 61130-1617 - Added lead_id to MonitorConf for recording_log +# 61221-1212 - Changed width to 760 to better fit 800x600 screens, widened SCRIPT +# 70109-1128 - Fixed wrapup timer bug +# 70109-1635 - Added option for HotKeys automatically dialing next number in manual mode +# - Added option for alternate number dialing with hotkeys +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70118-1517 - Added vicidial_agent_log and vicidial_user_log logging of user_group +# 70201-1249 - Added FAST DIAL option for manually dialing, added UTF8 compatible code +# 70201-1703 - Fixed cursor bug for most text input fields +# 70202-1453 - Added first portions of Agent Pause Codes +# 70203-0108 - Finished Agent Pause Codes functionality +# 70203-0930 - Added dialed_number to webform output +# 70203-1010 - Added dialed_label to webform output +# 70206-1201 - Fixed allow_closers bug +# 70206-1332 - Added vicidial_recording_override users setting function +# 70212-1252 - Fixed small issue with CXFER +# 70213-1018 - Changed CXFER and AXFER to update customer information before transfer +# 70214-1233 - Added queuemetrics_log_id field for server_id in queue_log +# 70215-1240 - Added queuemetrics_log_id field for server_id in queue_log +# 70222-1617 - Changed queue_log PAUSE/UNPAUSE to PAUSEALL/UNPAUSEALL +# 70226-1252 - Added Mute/UnMute to agent screen +# 70309-1035 - Allow amphersands and questions marks in comments to pass through +# 70313-1052 - Allow pound signs(hash) in comments to pass through +# 70316-1406 - Moved the MUTE button to be accessible during a transfer/conf +# 70319-1446 - Added agent-deactive-display and disable customer info update functions +# 70319-1626 - Added option to allow agent logins to campaigns with no leads in the hopper +# 70320-1501 - Added option to allow retry of leave-3way-call from dispo screen +# 70322-1545 - Added sipsak display ability +# 70510-1319 - Added onUnload force Logout +# 70806-1530 - Added Presets Dial links above agent mute button +# 70823-2118 - Fixed XMLHTTPRequest, HotKeys and Scheduled Callbacks issues with MSIE +# 70828-1443 - Added source_id to output of SCRIPTtab-IFRAME and WEBFORM +# 71022-1427 - Added formatting of the customer phone number in the main status bar +# 71029-1848 - Changed CLOSER-type campaign to not use campaign_id restrictions +# 71101-1204 - Fixed bug in callback calendar with DST +# 71116-0957 - Added campaign_weight and calls_today to the vla table insertion +# 71120-1719 - Added XMLHTPRequest lookup of allowable campaigns for agents during login +# 71122-0256 - Added auto-pause notification +# 71125-1751 - Changed Transfer section to allow for selection of in-groups to send calls to +# 71127-0408 - Added height and width settings for easier modification of screen size +# 71129-2025 - restricted callbacks count and list to campaign only +# + +$version = '2.0.4-142'; +$build = '71129-2025'; + +require("dbconnect.php"); + +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["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} + 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"];} + } + if (isset($VD_campaign)) + { + $VD_campaign = strtoupper($VD_campaign); + $VD_campaign = eregi_replace(" ",'',$VD_campaign); + } + +### 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); + + +$forever_stop=0; + +if ($force_logout) +{ + echo "Você tem registrado agora para fora. Obrigado\n"; + exit; +} + +$isdst = date("I"); +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$CIDdate = date("ymdHis"); + $month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); + $past_month_date = date("Y-m-d H:i:s",$month_old); + + +$random = (rand(1000000, 9999999) + 10000000); + +$conf_silent_prefix = '7'; # vicidial_conferences prefix to enter silently +$HKuser_level = '5'; # minimum vicidial user_level for HotKeys +$campaign_login_list = '1'; # show drop-down list of campaigns at login +$manual_dial_preview = '1'; # allow preview lead option when manual dial +$multi_line_comments = '1'; # set to 1 to allow multi-line comment box +$user_login_first = '0'; # set to 1 to have the vicidial_user login before the phone login +$view_scripts = '1'; # set to 1 to show the SCRIPTS tab +$dispo_check_all_pause = '0'; # set to 1 to allow for persistent pause after dispo +$agentcallsstatus = '0'; # set to 1 to show agent status and call count + $campagentstatctmax = '0'; # Number of segundos for campaign call and agent stats +$show_campname_pulldown = '1'; # set to 1 to show campaign name em login pulldown +$webform_sessionname = '1'; # set to 1 to include the session_name in webform URL +$local_consult_xfers = '1'; # set to 1 to send consultative transfers from original server +$clientDST = '1'; # set to 1 to check for DST em server for agent time +$no_delete_sessions = '0'; # set to 1 to not delete sessions at logout +$volumecontrol_active = '1'; # set to 1 to allow agents to alter volume of channels +$PreseT_DiaL_LinKs = '1'; # set to 1 to show a SELETOR link for Dial Presets +$LogiNAJAX = '1'; # set to 1 to do lookups +$HidEMonitoRSessionS = '1'; # set to 1 to hide remote monitoring channels from "session calls" + +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen + +$BROWSER_HEIGHT = 500; # set to the minimum browser height, default=500 +$BROWSER_WIDTH = 770; # set to the minimum browser width, default=770 + + +# options now set in DB: +#$alt_phone_dialing = '1'; # allow agents to call alt phone numbers +#$scheduled_callbacks = '1'; # set to 1 to allow agent to choose scheduled callbacks +# $agentonly_callbacks = '1'; # set to 1 to allow agent to choose agent-only scheduled callbacks +#$agentcall_manual = '1'; # set to 1 to allow agent to make manual calls during autodial session + +### SCREEN WIDTH AND HEIGHT CALCULATIONS ### +### DO NOT EDIT! ### +$MASTERwidth=($BROWSER_WIDTH - 340); +$MASTERheight=($BROWSER_HEIGHT - 200); +if ($MASTERwidth < 430) {$MASTERwidth = '430';} +if ($MASTERheight < 300) {$MASTERheight = '300';} + +$CAwidth = ($MASTERwidth + 340); # 770 - cover all (none-in-session, customer hunngup, etc...) +$MNwidth = ($MASTERwidth + 330); # 760 - main frame +$XFwidth = ($MASTERwidth + 320); # 750 - transfer/conference +$HCwidth = ($MASTERwidth + 310); # 740 - hotkeys and callbacks +$AMwidth = ($MASTERwidth + 270); # 700 - agent mute and preset-dial links +$SSwidth = ($MASTERwidth + 176); # 606 - scroll script +$SDwidth = ($MASTERwidth + 170); # 600 - scroll script, customer data and calls-in-session +$HKwidth = ($MASTERwidth + 70); # 500 - Hotkeys button +$HSwidth = ($MASTERwidth + 1); # 431 - Header spacer + +$HKheight = ($MASTERheight + 105); # 405 - HotKey active Button +$AMheight = ($MASTERheight + 100); # 400 - Agent mute and preset dial links +$MBheight = ($MASTERheight + 65); # 365 - Manual Dial Buttons +$CBheight = ($MASTERheight + 50); # 350 - Agent Callback, pause code, volume control Buttons and agent status +$SSheight = ($MASTERheight + 31); # 331 - script content +$HTheight = ($MASTERheight + 10); # 310 - transfer frame, callback comments and hotkey +$BPheight = ($MASTERheight - 250); # 50 - bottom buffer + + +$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('vicidial.php','',$agcPAGE); + +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 +echo "\n"; +echo "\n"; +echo "\n"; + +if ($campaign_login_list > 0) +{ +$camp_form_code = "\n"; +} +else +{ +$camp_form_code = "\n"; +} + + +if ($LogiNAJAX > 0) +{ +?> + + + +Web client de VICISELETOR: Re-Início de uma sessão\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "
English Português
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Re-Início de uma sessão
 
Início de uma sessão Do Telefone:
Senha Do Telefone:
Início de uma sessão Do Usuário:
Senha Do Usuário:
Campanha: $camp_form_code

VERSÃO: $version       CONFIGURAÇÃO: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} + +if ($user_login_first == 1) +{ + if ( (strlen($VD_login)<1) or (strlen($VD_pass)<1) or (strlen($VD_campaign)<1) ) + { + echo "Web client de VICISELETOR: Início de uma sessão Da Campanha\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Português
\n"; + echo "
\n"; + echo "\n"; + #echo "\n"; + #echo "\n"; + echo "

Início de uma sessão Do Usuário

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Início de uma sessão Da Campanha
 
Início de uma sessão Do Usuário:
Senha Do Usuário:
Campanha: $camp_form_code
  \n"; + echo "

VERSÃO: $version       CONFIGURAÇÃO: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) + { + $stmt="SELECT phone_login,phone_pass from vicidial_users where user='$VD_login' and pass='$VD_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); + $phone_login=$row[0]; + $phone_pass=$row[1]; + + echo "Web client de VICISELETOR: Início de uma sessão\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Português
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Início de uma sessão
 
Início de uma sessão Do Telefone:
Senha Do Telefone:
Início de uma sessão Do Usuário:
Senha Do Usuário:
Campanha: $camp_form_code
  \n"; + echo "

VERSÃO: $version       CONFIGURAÇÃO: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + + } + } +} + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "Web client de VICISELETOR: Início de uma sessão Do Telefone\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "
English Português
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Início de uma sessão Do Telefone
 
Início de uma sessão Do Telefone:
Senha Do Telefone:
  \n"; +echo "

VERSÃO: $version       CONFIGURAÇÃO: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./vicidial_auth_entries.txt", "a");} +$VDloginDISPLAY=0; + + if ( (strlen($VD_login)<2) or (strlen($VD_pass)<2) or (strlen($VD_campaign)<2) ) + { + $VDloginDISPLAY=1; + } + else + { + $stmt="SELECT count(*) from vicidial_users where user='$VD_login' and pass='$VD_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($auth>0) + { + $login=strtoupper($VD_login); + $password=strtoupper($VD_pass); + ##### grab the full name of the agent + $stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,closer_default_blended,user_group,vicidial_recording_override from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $user_level=$row[1]; + $VU_hotkeys_active=$row[2]; + $VU_agent_choose_ingroups=$row[3]; + $VU_scheduled_callbacks=$row[4]; + $agentonly_callbacks=$row[5]; + $agentcall_manual=$row[6]; + $VU_vicidial_recording=$row[7]; + $VU_vicidial_transfers=$row[8]; + $VU_closer_default_blended=$row[9]; + $VU_user_group=$row[10]; + $VU_vicidial_recording_override=$row[11]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|$VD_pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + $user_abb = "$VD_login$VD_login$VD_login$VD_login"; + while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + + $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$VU_user_group';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGallowed_campaigns =$row[0]; + + if ( (!eregi(" $VD_campaign ",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) + { + echo "Web client de VICISELETOR: VICISELETOR Início de uma sessão Da Campanha\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Português
\n"; + echo "Sorry, you are not allowed to login to this campaign: $VD_campaign\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Início de uma sessão: \n
"; + echo "Senha:
\n"; + echo "Campanha: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + ##### check to see that the campaign is active + $stmt="SELECT count(*) FROM vicidial_campaigns where campaign_id='$VD_campaign' and active='Y';"; + 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); + $CAMPactive=$row[0]; + if($CAMPactive>0) + { + if ($TEST_all_statuses > 0) {$selectableSQL = '';} + else {$selectableSQL = "selectable='Y' and";} + $VARstatuses=''; + $VARstatusnames=''; + ##### grab the statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_statuses WHERE $selectableSQL status != 'NEW' order by status limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $VD_statuses_ct) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + } + + ##### grab the campaign-specific statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_campaign_statuses WHERE $selectableSQL status != 'NEW' and campaign_id='$VD_campaign' order by status limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_camp = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + $j++; + } + $VD_statuses_ct = ($VD_statuses_ct+$VD_statuses_camp); + $VARstatuses = substr("$VARstatuses", 0, -1); + $VARstatusnames = substr("$VARstatusnames", 0, -1); + + ##### grab the campaign-specific HotKey statuses that can be used for dispositioning by an agent + $stmt="SELECT hotkey,status,status_name FROM vicidial_campaign_hotkeys WHERE selectable='Y' and status != 'NEW' and campaign_id='$VD_campaign' order by hotkey limit 9;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $HK_statuses_camp = mysql_num_rows($rslt); + $w=0; + $HKboxA=''; + $HKboxB=''; + $HKboxC=''; + while ($w < $HK_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $HKhotkey[$w] =$row[0]; + $HKstatus[$w] =$row[1]; + $HKstatus_name[$w] =$row[2]; + $HKhotkeys = "$HKhotkeys'$HKhotkey[$w]',"; + $HKstatuses = "$HKstatuses'$HKstatus[$w]',"; + $HKstatusnames = "$HKstatusnames'$HKstatus_name[$w]',"; + if ($w < 3) + {$HKboxA = "$HKboxA $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ( ($w >= 3) and ($w < 6) ) + {$HKboxB = "$HKboxB $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ($w >= 6) + {$HKboxC = "$HKboxC $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + $w++; + } + $HKhotkeys = substr("$HKhotkeys", 0, -1); + $HKstatuses = substr("$HKstatuses", 0, -1); + $HKstatusnames = substr("$HKstatusnames", 0, -1); + + ##### grab the statuses to be dialed for your campaign as well as other campaign settings + $stmt="SELECT park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,agent_pause_codes_active,no_hopper_leads_logins,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,xfer_groups FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $park_ext = $row[0]; + $park_file_name = $row[1]; + $web_form_address = $row[2]; + $allow_closers = $row[3]; + $auto_dial_level = $row[4]; + $dial_timeout = $row[5]; + $dial_prefix = $row[6]; + $campaign_cid = $row[7]; + $campaign_vdad_exten = $row[8]; + $campaign_rec_exten = $row[9]; + $campaign_recording = $row[10]; + $campaign_rec_filename = $row[11]; + $campaign_script = $row[12]; + $get_call_launch = $row[13]; + $campaign_am_message_exten = $row[14]; + $xferconf_a_dtmf = $row[15]; + $xferconf_a_number = $row[16]; + $xferconf_b_dtmf = $row[17]; + $xferconf_b_number = $row[18]; + $alt_number_dialing = $row[19]; + $VC_scheduled_callbacks = $row[20]; + $wrapup_segundos = $row[21]; + $wrapup_message = $row[22]; + $closer_campaigns = $row[23]; + $use_internal_dnc = $row[24]; + $allcalls_delay = $row[25]; + $omit_phone_code = $row[26]; + $agent_pause_codes_active = $row[27]; + $no_hopper_leads_logins = $row[28]; + $campaign_allow_inbound = $row[29]; + $manual_dial_list_id = $row[30]; + $default_xfer_group = $row[31]; + $xfer_groups = $row[32]; + + if ( (!ereg('DISABLED',$VU_vicidial_recording_override)) and ($VU_vicidial_recording > 0) ) + { + $campaign_recording = $VU_vicidial_recording_override; + print "\n"; + } + if ( ($VC_scheduled_callbacks=='Y') and ($VU_scheduled_callbacks=='1') ) + {$scheduled_callbacks='1';} + if ($VU_vicidial_recording=='0') + {$campaign_recording='NEVER';} + if ($alt_number_dialing=='Y') + {$alt_phone_dialing='1';} + else + {$alt_phone_dialing='0';} + $closer_campaigns = preg_replace("/^ | -$/","",$closer_campaigns); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaigns = "'$closer_campaigns'"; + + if ($agent_pause_codes_active=='Y') + { + ##### grab the pause codes for this campaign + $stmt="SELECT pause_code,pause_code_name FROM vicidial_pause_codes WHERE campaign_id='$VD_campaign' order by pause_code limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_pause_codes = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_pause_codes) + { + $row=mysql_fetch_row($rslt); + $pause_codes[$i] =$row[0]; + $pause_code_names[$i] =$row[1]; + $VARpause_codes = "$VARpause_codes'$pause_codes[$i]',"; + $VARpause_code_names = "$VARpause_code_names'$pause_code_names[$i]',"; + $i++; + $j++; + } + $VD_pause_codes_ct = ($VD_pause_codes_ct+$VD_pause_codes); + $VARpause_codes = substr("$VARpause_codes", 0, -1); + $VARpause_code_names = substr("$VARpause_code_names", 0, -1); + } + + ##### grab the inbound groups to choose from if campaign contains CLOSER + $VARingroups="''"; + if ($campaign_allow_inbound == 'Y') + { + $VARingroups=''; + $stmt="select group_id from vicidial_inbound_groups where active = 'Y' and group_id IN($closer_campaigns) order by group_id limit 60;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $closer_ct = mysql_num_rows($rslt); + $INgrpCT=0; + while ($INgrpCT < $closer_ct) + { + $row=mysql_fetch_row($rslt); + $closer_groups[$INgrpCT] =$row[0]; + $VARingroups = "$VARingroups'$closer_groups[$INgrpCT]',"; + $INgrpCT++; + } + $VARingroups = substr("$VARingroups", 0, -1); + } + + ##### grab the allowable inbound groups to choose from for transfer options + $xfer_groups = preg_replace("/^ | -$/","",$xfer_groups); + $xfer_groups = preg_replace("/ /","','",$xfer_groups); + $xfer_groups = "'$xfer_groups'"; + $VARxfergroups="''"; + if ($allow_closers == 'Y') + { + $VARxfergroups=''; + $stmt="select group_id,group_name from vicidial_inbound_groups where active = 'Y' and group_id IN($xfer_groups) order by group_id limit 60;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $xfer_ct = mysql_num_rows($rslt); + $XFgrpCT=0; + while ($XFgrpCT < $xfer_ct) + { + $row=mysql_fetch_row($rslt); + $VARxfergroups = "$VARxfergroups'$row[0]',"; + $VARxfergroupsnames = "$VARxfergroupsnames'$row[1]',"; + if ($row[0] == "$default_xfer_group") {$default_xfer_group_name = $row[1];} + $XFgrpCT++; + } + $VARxfergroups = substr("$VARxfergroups", 0, -1); + $VARxfergroupsnames = substr("$VARxfergroupsnames", 0, -1); + } + + ##### grab the number of leads in the hopper for this campaign + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id = '$VD_campaign' and status='READY';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $campaign_leads_to_call = $row[0]; + print "\n"; + + } + else + { + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "A campanha nao ativa, tenta por favor outra vez
"; + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|$VD_pass|$ip|$browser|\n"); + fclose($fp); + } + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "O início de uma sessão incorreto, tenta por favor outra vez
"; + } + } + if ($VDloginDISPLAY) + { + echo "Web client de VICISELETOR: Início de uma sessão Da Campanha\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Português
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "

$VDdisplayMESSAGE

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Início de uma sessão Da Campanha
 
Início de uma sessão Do Usuário:
Senha Do Usuário:
Campanha: $camp_form_code
  \n"; + echo "

VERSÃO: $version       CONFIGURAÇÃO: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +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); +$authphone=$row[0]; +if (!$authphone) + { + echo "Web client de VICISELETOR: Início de uma sessão Do Telefone Error\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Português
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Início de uma sessão Error
 
Pesaroso, seus início de uma sessão do telefone e senha não seja:
 
Início de uma sessão Do Telefone:
Senha Do Telefone:

VERSÃO: $version       CONFIGURAÇÃO: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "Web client de VICISELETOR\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + 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); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $login=$row[6]; + $pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CallerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + $enable_sipsak_messages=$row[66]; + + if ($clientDST) + { + $local_gmt = ($local_gmt + $isdst); + } + if ($protocol == 'EXTERNAL') + { + $protocol = 'Local'; + $extension = "$dialplan_number$AT$ext_context"; + } + $SIP_user = "$protocol/$extension"; + + $stmt="SELECT asterisk_version from servers where server_ip='$server_ip';"; + 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); + $asterisk_version=$row[0]; + + # If a park extension is not set, use the default one + if ( (strlen($park_ext)>0) && (strlen($park_file_name)>0) ) + { + $VICIDiaL_park_on_extension = "$park_ext"; + $VICIDiaL_park_on_filename = "$park_file_name"; + print "\n"; + } + print "\n"; + + # If a web form address is not set, use the default one + if (strlen($web_form_address)>0) + { + $VICIDiaL_web_form_address = "$web_form_address"; + print "\n"; + } + else + { + $VICIDiaL_web_form_address = "$VICIDiaL_web_URL"; + print "\n"; + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + } + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + # If closers are allowed em this campaign + if ($allow_closers=="Y") + { + $VICIDiaL_allow_closers = 1; + print "\n"; + } + else + { + $VICIDiaL_allow_closers = 0; + print "\n"; + } + + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtimE$US$session_ext$session_rand"; + + if ($webform_sessionname) + {$webform_sessionname = "&session_name=$session_name";} + else + {$webform_sessionname = '';} + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'vicidial';"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','vicidial','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + if ( ($campaign_allow_inbound == 'Y') || ($campaign_leads_to_call > 0) || (ereg('Y',$no_hopper_leads_logins)) ) + { + ### insert an entry into the user log for the login event + $stmt = "INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$VD_login','LOGIN','$VD_campaign','$NOW_TIME','$StarTtimE','$VU_user_group')"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + ##### check to see if the user has a conf extension already, this happens if they previously exited uncleanly + $stmt="SELECT conf_exten FROM vicidial_conferences where extension='$SIP_user' and server_ip = '$server_ip' LIMIT 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $prev_login_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $prev_login_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + if ($prev_login_ct > 0) + {print "\n";} + else + { + ##### grab the next available vicidial_conference room and reserve it + $stmt="SELECT conf_exten FROM vicidial_conferences where server_ip = '$server_ip' and ((extension='') or (extension is null)) LIMIT 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $free_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $free_conf_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + $stmt="UPDATE vicidial_conferences set extension='$SIP_user' where server_ip='$server_ip' and conf_exten='$session_id';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + print "\n"; + + } + + $stmt="UPDATE vicidial_list set status='N', user='' where status IN('QUEUE','INCALL') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_hopper where status IN('QUEUE','INCALL','DONE') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_live_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_live_inbound_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + # print "You have logged in as user: $VD_login em phone: $SIP_user à campanha: $VD_campaign
\n"; + $VICIDiaL_is_logged_in=1; + + ### set the callerID for manager middleware-app to connect the phone to the user + $SIqueryCID = "S$CIDdate$session_id"; + + ############################################# + ##### COMEÇO SYSTEM_SETTINGS LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,vicidial_agent_disable,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $vicidial_agent_disable = $row[6]; + $allow_sipsak_messages = $row[7]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_prefix = 'LIN-'; + print "\n"; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$VD_campaign\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + $SIqueryCID = "$SIPSAK_prefix$VD_campaign$DS$CIDdate"; + } + + ### insert a NOVO record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$SIqueryCID','Channel: $SIP_user','Context: $ext_context','Exten: $session_id','Priority: 1','Callerid: $SIqueryCID','','','','','');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($auto_dial_level > 0) + { + print "\n"; + + ##### grab the campaign_weight and number of calls today em that campaign for the agent + $stmt="SELECT campaign_weight,calls_today FROM vicidial_campaign_agents where user='$VD_login' and campaign_id = '$VD_campaign';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vca_ct = mysql_num_rows($rslt); + if ($vca_ct > 0) + { + $row=mysql_fetch_row($rslt); + $campaign_weight = $row[0]; + $calls_today = $row[1]; + $i++; + } + else + { + $campaign_weight = '0'; + $calls_today = '0'; + $stmt="INSERT INTO vicidial_campaign_agents (user,campaign_id,campaign_rank,campaign_weight,calls_today) values('$VD_login','$VD_campaign','0','0','$calls_today');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + } + $closer_chooser_string=''; + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,user_level,campaign_weight,calls_today) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$closer_chooser_string','$user_level','$campaign_weight','$calls_today');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='$VD_campaign',agent='Agent/$VD_login',verb='AGENTLOGIN',data1='$VD_login@agents',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSAALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + mysql_close($linkB); + mysql_select_db("$VARDB_database", $link); + } + + + if ($campaign_allow_inbound == 'Y') + { + print "\n"; + } + } + else + { + print "\n"; + + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,user_level) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$user_level');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='$VD_campaign',agent='Agent/$VD_login',verb='AGENTLOGIN',data1='$VD_login@agents',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSAALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + mysql_close($linkB); + mysql_select_db("$VARDB_database", $link); + } + } + } + else + { + echo "Web client de VICISELETOR: VICISELETOR Início de uma sessão Da Campanha\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Português
\n"; + echo "Pesaroso, não há nenhuma ligação no funil para esta campanha\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Início de uma sessão: \n
"; + echo "Senha:
\n"; + echo "Campanha: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + if (strlen($session_id) < 1) + { + echo "Web client de VICISELETOR: VICISELETOR Início de uma sessão Da Campanha\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Português
\n"; + echo "Sorry, there are no available sessions\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Início de uma sessão: \n
"; + echo "Senha:
\n"; + echo "Campanha: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + if (ereg('MSIE',$browser)) + { + $useIE=1; + print "\n"; + } + else + { + $useIE=0; + print "\n"; + } + + $StarTtimE = date("U"); + $NOW_TIME = date("Y-m-d H:i:s"); + ##### Agent is going to log in so insert the vicidial_agent_log entry now + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group,sub_status) values('$VD_login','$server_ip','$NOW_TIME','$VD_campaign','$StarTtimE','0','$StarTtimE','$VU_user_group','LOGIN');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id($link); + print "\n"; + + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $server_ip_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S"; + + ##### grab the datails of all active scripts in the system + $stmt="SELECT script_id,script_name,script_text FROM vicidial_scripts WHERE active='Y' order by script_id limit 100;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $MM_scripts = mysql_num_rows($rslt); + $e=0; + while ($e < $MM_scripts) + { + $row=mysql_fetch_row($rslt); + $MMscriptid[$e] =$row[0]; + $MMscriptname[$e] = rawurlencode($row[1]); + $MMscripttext[$e] = rawurlencode($row[2]); + $MMscriptids = "$MMscriptids'$MMscriptid[$e]',"; + $MMscriptnames = "$MMscriptnames'$MMscriptname[$e]',"; + $MMscripttexts = "$MMscripttexts'$MMscripttext[$e]',"; + $e++; + } + $MMscriptids = substr("$MMscriptids", 0, -1); + $MMscriptnames = substr("$MMscriptnames", 0, -1); + $MMscripttexts = substr("$MMscripttexts", 0, -1); + + } +} + +################################################################ +### BEGIN - build the callback calendar (12 months) ### +################################################################ +define ('ADAY', (60*60*24)); +$CdayARY = getdate(); +$Cmon = $CdayARY['mon']; +$Cyear = $CdayARY['year']; +$CTODAY = date("Y-m"); +$CTODAYmday = date("j"); +$CINC=0; + +$Cmonths = Array('Janeiro','February','Março','Abril','Pode','Junho', + 'Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'); +$Cdays = Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); + +$CCAL_OUT = ''; + +$CCAL_OUT .= ""; + +while ($CINC < 12) +{ +if ( ($CINC == 0) || ($CINC == 4) ||($CINC == 8) ) + {$CCAL_OUT .= "";} + +$CCAL_OUT .= ""; + +if ( ($CINC == 3) || ($CINC == 7) ||($CINC == 11) ) + {$CCAL_OUT .= "";} +$CINC++; +} + +$CCAL_OUT .= "
"; + +$CYyear = $Cyear; +$Cmonth= ($Cmon + $CINC); +if ($Cmonth > 12) + { + $Cmonth = ($Cmonth - 12); + $CYyear++; + } +$Cstart= mktime(11,0,0,$Cmonth,1,$CYyear); +$CfirstdayARY = getdate($Cstart); +#echo "|$Cmon|$Cmonth|$CINC|\n"; +$CPRNTDAY = date("Y-m", $Cstart); + +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; + +foreach($Cdays as $Cday) +{ + $CDCLR="#ffffff"; +$CCAL_OUT .= ""; +} + +for( $Ccount=0;$Ccount<(6*7);$Ccount++) +{ + $Cdayarray = getdate($Cstart); + if((($Ccount) % 7) == 0) + { + if($Cdayarray['mon'] != $CfirstdayARY['mon']) + break; + $CCAL_OUT .= ""; + } + if($Ccount < $CfirstdayARY['wday'] || $Cdayarray['mon'] != $Cmonth) + { + $CCAL_OUT .= ""; + } + else + { + if( ($Cdayarray['mday'] == $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + else + { + $CDCLR="#ffffff"; + if ( ($Cdayarray['mday'] < $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CDCLR="#CCCCCC"; + $CBL = ''; + $CEL = ''; + } + else + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + } + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + } +} +$CCAL_OUT .= ""; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$CfirstdayARY[month] $CfirstdayARY[year]"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$Cday"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
 "; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; + +#echo "$CCAL_OUT\n"; +################################################################ +### END - build the callback calendar (12 months) ### +################################################################ + + +?> + + + + +\n"; + + +?> + +
+ + MARGINWIDTH=0 MARGINHEIGHT=0 LEFTMARGIN=0 TOPMARGIN=0 VALIGN=TOP ALIGN=LEFT> +
+ + + +LOGOUT\n"; ?> +
+
+ + + height=30> + + + + + +
VICISELETORSCRIPT VALIGN=MIDDLE ALIGN=CENTER>   LIVE     sessão ID: Vive A Chamada
+
+ + + + + height=>

VICISELETOR
+
+ + +SELETOR MANUAL       SELETOR RÃPIDO
+
+ + +X RECHAMADAS ATIVAS
+
+ + +
+
+ + + D1 - SELETOR\n"; + echo "
\n"; + echo "D2 - SELETOR\n"; + } + else {echo "
\n";} + ?> +

+
+
+ + + height=460>
RECHAMADAS PARA O AGENTE :
Estale sobre uma rechamada abaixo para chamar agora a parte traseira do cliente. Se você estalar sobre um registro abaixo para o chamar, estará removido da lista. +
+
+
  + Refresque +                 + Vá Para trás +
+
+ + + height=460>
LIGAÇÃO MANUAL NOVA DO SELETOR PARA :

Incorpore a informação abaixo para a ligação que nova você deseja se chamar. +
+ \n"; + } + ?> + Note: all new manual dial leads will go into list

+ + + + + + + + + + + + + + + +
Código Do Seletor:   (Este é geralmente um 1 nos EUA e no Canadá)
Telefone Number: +   (12 digits max - digits only) +
Ligações Existentes Da Busca:   (Esta opção se verificado tentará encontrar o número de telefone no sistema antes de introduzi-lo como uma ligação nova)


Se você quiser marcar um número e o ter não adicionado como uma ligação nova, entre no dialstring exato esse você querem chamar-se abaixo no campo da ultrapassagem do seletor. Ao hangup esta chamada você terá que abrir as CHAMADAS ncEsta ligação da SESSÃO no fundo da tela e pendurá-las acima estalando em sua ligação da canaleta lá.
 
Ultrapassagem Do Seletor:   (os dígitos satisfazem somente) +
+
+ Seletor Agora +                 + Vá Para trás +
+
+ + + +
+
+ + + + +Seu Status:
Calls Dialing: +
+ + + + + > + +
+
+ + Transferência - Conferência
+ + + LOCAL MAIS PRÓXIMO + Linha De Xfer Do Hangup + Hangup Ambas as Linhas + +
+ + Número a chamar-se   + + ULTRAPASSAGEM DO SELETOR   + CHAMADA DA LICENÇA 3-WAY + Transferência Da Cortina Do Seletor + D1 + D2 + +
+ + segundos   + channel + Seletor Com Cliente + Seletor Do Cliente Do Parque + Blind Transfer VMail Message +
+
+
+
+ + + + height=70> + +
Ligação Dispositioned Como:

+ -
+
+
+ + + height=70> + + + + +
Chaves Quentes Da Disposição: + Quando ativo, pressione simplesmente a chave de teclado para a:
+ + + + + +
+
+ + + height=70> + + + + + + +
Informação Precedente Da Rechamada: close
+
+
+
+
+ +
+
+ + + height=500>
Noone está em sua sessão:
+ Vá Para trás +

+ Agente Da Chamada Outra vez +
+
+ + + height=500>
O cliente pendurou acima:
+ Vá Para trás +

+ Revestimento e chamada da disposição + +
+
+ + + height=550>
Chamada Wrapup: segundos restantes no wrapup

+ +

+ Revestimento Wrapup e movimento sobre + +
+
+ + + height=500>
Sua sessão foi incapacitada
LOGOUT

Vá Para trás +
+
+ + + height=500>

LOGOUT
+
+ + +
+
+ + +
 
+
+ + + height=47>
Todas as mudanças feitas ao cliente que a informação abaixo neste tempo não será comitted, você devem mudar a informação do cliente antes de você hangup a chamada.
+
+ + + height=460>
CHAMADA DA DISPOSIÇÃO :       Hangup Outra vez       minimize
+ Extremidade-$$$-CHAME A Seleção Da Disposição +
+ PARE DE CHAMAR-SE
+ RESTAURAÇÃO | + SUBMETA +

+ WEB FORM SUBMETA +

  +
+
+ + + height=460>
SELECIONE Um CÓDIGO Da PAUSA :
+ Pausa Code Selection + +

  +
+
+ + + height=460>
Selecione uma data da rechamada :
+ + + Selecione uma data abaixo   +     + Hour: +   + Minutes: +   + +  
+ MINHA RECHAMADA SOMENTE
";} + ?> + Comentários dos CB:

+ + SUBMETA

+ +

  +
+
+ + + height=460>
SELEÇÃO DE GRUPO INBOUND MAIS PRÓXIMA
+ Seleção De Grupo Inbound Mais próxima +
+ CHAMADA MISTURADA(outbound ativado)
+ RESTAURAÇÃO | + SUBMETA +



  +
+
+ + + + Canaleta + Canaleta + MINHA RECHAMADA SOMENTE
";} + ?> +
+ + + + height=>
VICISELETOR SCRIPT
+
+ + + 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> +CHAVES QUENTES INATIVAS + + + + +> + + + +
Versão do correia-cliente de VICISELETOR:     CONFIGURAÇÃO:               Usuário:              
+Mostre a informação da canaleta da chamada de conferência

 
+
+ + + +
+
+ + + + + id="MainTable"> + + + + + + + + + + + + + + + +
STATUS:
+
+Número Seguinte Do Seletor
+ INSPECÇÃO PRÉVIA DA LIGAÇÃO
+ ALT DO TELEFONE
+ + +LIMA DE GRAVAÇÃO:
+
+
+ID REGISTRO:
+
+ +Comece Gravar
+
+Formulário Da Correia fotorreceptora
+
+Chamada Do Parque
+Transferência - Conferência
+
+Cliente Do Hangup
+
+
Emita DTMF

+
+
+
align=left valign=top> + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
segundos:   Canaleta:   Tempo De Cust:
Informação Do Cliente:
Título:   Primeiramente:   Mi:  Último:
Endereço1:
Endereço2:   Endereço3:
Cidade:   Estado:   PostCode:
Província:   Vendedor Id:
Telefone:   DialCode:   Alt. Telefone:
Mostra:   Email:
Comentários: + +\n";} +else + {echo "\n";} +?> + +
+
+ +
+
> + 
+ + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/voicemail_check.php b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/voicemail_check.php new file mode 100644 index 00000000..5a03e14a --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/agc_pt/voicemail_check.php @@ -0,0 +1,140 @@ + LICENSE: GPLv2 +### +### 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 +# + +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árioname/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 "\n"; +echo "\n"; +echo "\n"; +echo "Verificação De Voicemail"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + $MT[0]=''; + $row=''; $rowx=''; + if (strlen($vmail_box)<1) + { + $channel_live=0; + echo "caixa do voicemail $vmail_box é invá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";} + $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";} + } + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_CLOSERstats.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_CLOSERstats.php new file mode 100644 index 00000000..ec53f93f --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_CLOSERstats.php @@ -0,0 +1,617 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1714 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 60905-1326 - Added queue time stats +# 71008-1436 - Added shift to be defined in dbconnect.php +# 71025-0021 - Added status breakdown +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["shift"])) {$shift=$_GET["shift"];} + elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +if (strlen($shift)<2) {$shift='ALL';} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = '';} +if (!isset($query_date)) {$query_date = $NOW_DATE;} + +$stmt="select group_id from vicidial_inbound_groups;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: VDAD Closer Stats\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "           MODIFY | REPORTS \n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "PLEASE SELECT A CAMPAIGN AND DATE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$time_BEGIN=$AM_shift_BEGIN;
+	$time_END=$AM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "03:45:00";}   
+	if (strlen($time_END) < 6) {$time_END = "15:15:00";}
+	}
+if ($shift == 'PM') 
+	{
+	$time_BEGIN=$PM_shift_BEGIN;
+	$time_END=$PM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "15:15:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:15:00";}
+	}
+if ($shift == 'ALL') 
+	{
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "00:00:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:59:59";}
+	}
+$query_date_BEGIN = "$query_date $time_BEGIN";   
+$query_date_END = "$query_date $time_END";
+
+
+
+echo "VICIDIAL: Auto-dial Closer Stats                      $NOW_TIME\n";
+
+echo "\n";
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{$average_hold_seconds = '         0';}
+else
+	{
+	$average_hold_seconds = ($row[1] / $row[0]);
+	$average_hold_seconds = round($average_hold_seconds, 0);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+
+echo "Total Calls placed from this Campaign:        $TOTALcalls\n";
+echo "Average Call Length for all Calls:            $average_hold_seconds seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP' and (length_in_sec <= 999 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$DROPcalls =	sprintf("%10s", $row[0]);
+if ( ($DROPcalls < 1) or ($TOTALcalls < 1) )
+	{$DROPpercent = '0';}
+else
+	{
+	$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
+	$DROPpercent = round($DROPpercent, 0);
+	}
+
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{$average_hold_seconds = '         0';}
+else
+	{
+	$average_hold_seconds = ($row[1] / $row[0]);
+	$average_hold_seconds = round($average_hold_seconds, 0);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+
+echo "Total DROP Calls:                             $DROPcalls  $DROPpercent%\n";
+echo "Average hold time for DROP Calls:             $average_hold_seconds seconds\n";
+
+
+
+##############################
+#########  CALL STATUS STATS
+
+$TOTALcalls = 0;
+
+echo "\n";
+echo "---------- CALL STATUS STATS\n";
+echo "+--------+----------------------+------------+\n";
+echo "| STATUS | DESCRIPTION          | CALLS      |\n";
+echo "+--------+----------------------+------------+\n";
+
+$stmt="SELECT * from vicidial_statuses order by status";
+$rslt=mysql_query($stmt, $link);
+$statuses_to_print = mysql_num_rows($rslt);
+$statuses_list='';
+
+$o=0;
+while ($statuses_to_print > $o) 
+	{
+	$rowx=mysql_fetch_row($rslt);
+	$statname_list["$rowx[0]"] = "$rowx[1]";
+	$o++;
+	}
+
+$stmt="SELECT * from vicidial_campaign_statuses order by status";
+$rslt=mysql_query($stmt, $link);
+$Cstatuses_to_print = mysql_num_rows($rslt);
+
+$o=0;
+while ($Cstatuses_to_print > $o) 
+	{
+	$rowx=mysql_fetch_row($rslt);
+	$statname_list["$rowx[0]"] = "$rowx[1]";
+	$o++;
+	}
+
+$stmt="select count(*),status from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysql_real_escape_string($group) . "' group by status;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$statuses_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $statuses_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$TOTALcalls = ($TOTALcalls + $row[0]);
+
+	$STATUScount =	sprintf("%10s", $row[0]);while(strlen($STATUScount)>10) {$STATUScount = substr("$STATUScount", 0, -1);}
+	$RAWstatus = $row[1];
+	$status =	sprintf("%-6s", $row[1]);while(strlen($status)>6) {$status = substr("$status", 0, -1);}
+
+	if ($non_latin < 1)
+		{
+		 $status_name =	sprintf("%-20s", $statname_list[$RAWstatus]); 
+		 while(strlen($status_name)>20) {$status_name = substr("$status_name", 0, -1);}	
+		}
+	else
+		{
+		 $status_name =	sprintf("%-60s", $statname_list[$RAWstatus]); 
+		 while(mb_strlen($status_name,'utf-8')>20) {$status_name = mb_substr("$status_name", 0, -1,'utf-8');}	
+		}
+
+
+	echo "| $status | $status_name | $STATUScount |\n";
+
+	$i++;
+	}
+
+$TOTALcalls =		sprintf("%10s", $TOTALcalls);
+
+echo "+--------+----------------------+------------+\n";
+echo "| TOTAL:                        | $TOTALcalls |\n";
+echo "+-------------------------------+------------+\n";
+
+
+
+
+echo "\n";
+echo "---------- QUEUE STATS\n";
+
+$stmt="select count(*),sum(queue_seconds) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and (queue_seconds > 0);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$QUEUEcalls =	sprintf("%10s", $row[0]);
+if ( ($QUEUEcalls < 1) or ($TOTALcalls < 1) )
+	{$QUEUEpercent = '0';}
+else
+	{
+	$QUEUEpercent = (($QUEUEcalls / $TOTALcalls) * 100);
+	$QUEUEpercent = round($QUEUEpercent, 0);
+	}
+
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{$average_queue_seconds = '         0';}
+else
+	{
+	$average_queue_seconds = ($row[1] / $row[0]);
+	$average_queue_seconds = round($average_queue_seconds, 2);
+	$average_queue_seconds = sprintf("%10.2f", $average_queue_seconds);
+	}
+
+if ( ($TOTALcalls < 1) or ($row[1] < 1) )
+	{$average_total_queue_seconds = '         0';}
+else
+	{
+	$average_total_queue_seconds = ($row[1] / $TOTALcalls);
+	$average_total_queue_seconds = round($average_total_queue_seconds, 2);
+	$average_total_queue_seconds = sprintf("%10.2f", $average_total_queue_seconds);
+	}
+
+echo "Total Calls That entered Queue:               $QUEUEcalls  $QUEUEpercent%\n";
+echo "Average QUEUE Length for queue calls:         $average_queue_seconds seconds\n";
+echo "Average QUEUE Length across all calls:        $average_total_queue_seconds seconds\n";
+
+
+##############################
+#########  USER STATS
+
+$TOTagents=0;
+$TOTcalls=0;
+$TOTtime=0;
+$TOTavg=0;
+
+echo "\n";
+echo "---------- AGENT STATS\n";
+echo "+--------------------------+------------+----------+--------+\n";
+echo "| AGENT                    | CALLS      | TIME M   | AVRG M |\n";
+echo "+--------------------------+------------+----------+--------+\n";
+
+$stmt="select vicidial_closer_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_closer_log,vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysql_real_escape_string($group) . "' and vicidial_closer_log.user is not null and length_in_sec is not null and length_in_sec > 4 and vicidial_closer_log.user=vicidial_users.user group by vicidial_closer_log.user;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$TOTcalls = ($TOTcalls + $row[2]);
+	$TOTtime = ($TOTtime + $row[3]);
+
+	$user =			sprintf("%-6s", $row[0]);
+	$full_name =	sprintf("%-15s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
+	$USERcalls =	sprintf("%10s", $row[2]);
+	$USERtotTALK =	$row[3];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$USERtotTALK_MS =		sprintf("%8s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $user - $full_name | $USERcalls | $USERtotTALK_MS | $USERavgTALK_MS |\n";
+
+	$i++;
+	}
+
+if (!$TOTcalls) {$TOTcalls = 1;}
+$TOTavg = ($TOTtime / $TOTcalls);
+$TOTavg = round($TOTavg, 0);
+$TOTavg_M = ($TOTavg / 60);
+$TOTavg_M = round($TOTavg_M, 2);
+$TOTavg_M_int = intval("$TOTavg_M");
+$TOTavg_S = ($TOTavg_M - $TOTavg_M_int);
+$TOTavg_S = ($TOTavg_S * 60);
+$TOTavg_S = round($TOTavg_S, 0);
+if ($TOTavg_S < 10) {$TOTavg_S = "0$TOTavg_S";}
+$TOTavg_MS = "$TOTavg_M_int:$TOTavg_S";
+$TOTavg =		sprintf("%6s", $TOTavg_MS);
+
+$TOTtime_M = ($TOTtime / 60);
+$TOTtime_M = 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 ($TOTtime_S < 10) {$TOTtime_S = "0$TOTtime_S";}
+$TOTtime_MS = "$TOTtime_M_int:$TOTtime_S";
+$TOTtime =		sprintf("%6s", $TOTtime_MS);
+
+$TOTagents =		sprintf("%10s", $i);
+$TOTcalls =			sprintf("%10s", $TOTcalls);
+$TOTtime =			sprintf("%8s", $TOTtime);
+$TOTavg =			sprintf("%6s", $TOTavg);
+
+echo "+--------------------------+------------+----------+--------+\n";
+echo "| TOTAL Agents: $TOTagents | $TOTcalls | $TOTtime | $TOTavg |\n";
+echo "+--------------------------+------------+----------+--------+\n";
+
+
+##############################
+#########  TIME STATS
+
+echo "\n";
+echo "---------- TIME STATS\n";
+
+echo "\n";
+
+$hi_hour_count=0;
+$last_full_record=0;
+$i=0;
+$h=0;
+while ($i <= 96)
+	{
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+	$h++;
+	}
+
+if ($hi_hour_count < 1)
+	{$hour_multiplier = 0;}
+else
+	{
+	$hour_multiplier = (100 / $hi_hour_count);
+	#$hour_multiplier = round($hour_multiplier, 0);
+	}
+
+echo "\n";
+echo "GRAPH IN 15 MINUTE INCREMENTS OF TOTAL CALLS PLACED FROM THIS CAMPAIGN\n";
+
+$k=1;
+$Mk=0;
+$call_scale = '0';
+while ($k <= 102) 
+	{
+	if ($Mk >= 5) 
+		{
+		$Mk=0;
+		if ( ($k < 1) or ($hour_multiplier <= 0) )
+			{$scale_num = 100;}
+		else
+			{
+			$scale_num=($k / $hour_multiplier);
+			$scale_num = round($scale_num, 0);
+			}
+		$LENscale_num = (strlen($scale_num));
+		$k = ($k + $LENscale_num);
+		$call_scale .= "$scale_num";
+		}
+	else
+		{
+		$call_scale .= " ";
+		$k++;   $Mk++;
+		}
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+$ZZ = '00';
+$i=0;
+$h=4;
+$hour= -1;
+$no_lines_yet=1;
+
+while ($i <= 96)
+	{
+	$char_counter=0;
+	$time = '      ';
+	if ($h >= 4) 
+		{
+		$hour++;
+		$h=0;
+		if ($hour < 10) {$hour = "0$hour";}
+		$time = "+$hour$ZZ+";
+		}
+	if ($h == 1) {$time = "   15 ";}
+	if ($h == 2) {$time = "   30 ";}
+	if ($h == 3) {$time = "   45 ";}
+	$Ghour_count = $hour_count[$i];
+	if ($Ghour_count < 1) 
+		{
+		if ( ($no_lines_yet) or ($i > $last_full_record) )
+			{
+			$do_nothing=1;
+			}
+		else
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			echo "|$time|";
+			$k=0;   while ($k <= 102) {echo " ";   $k++;}
+			echo "| $hour_count[$i] |\n";
+			}
+		}
+	else
+		{
+		$no_lines_yet=0;
+		$Xhour_count = ($Ghour_count * $hour_multiplier);
+		$Yhour_count = (99 - $Xhour_count);
+
+		$Gdrop_count = $drop_count[$i];
+		if ($Gdrop_count < 1) 
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "*X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 101) {echo " ";   $char_counter++;}
+			echo "| 0     | $hour_count[$i] |\n";
+
+			}
+		else
+			{
+			$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+		#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+			$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+			echo "D";   $char_counter++;
+			$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 102) {echo " ";   $char_counter++;}
+			echo "| $drop_count[$i] | $hour_count[$i] |\n";
+			}
+		}
+	
+	
+	$i++;
+	$h++;
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n\n";
+
+
+
+
+
+$ENDtime = date("U");
+$RUNtime = ($ENDtime - $STARTtime);
+echo "\nRun Time: $RUNtime seconds\n";
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_VDADstats.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_VDADstats.php new file mode 100644 index 00000000..d8afbdd6 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_VDADstats.php @@ -0,0 +1,647 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1718 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 61215-1139 - Added drop percentage of answered and round-2 decimal +# 71008-1436 - Added shift to be defined in dbconnect.php +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["shift"])) {$shift=$_GET["shift"];} + elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +if (strlen($shift)<2) {$shift='ALL';} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = '';} +if (!isset($query_date)) {$query_date = $NOW_DATE;} + +$stmt="select campaign_id from vicidial_campaigns;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: VDAD Stats\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "           MODIFY | REPORTS \n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "PLEASE SELECT A CAMPAIGN AND DATE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$time_BEGIN=$AM_shift_BEGIN;
+	$time_END=$AM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "03:45:00";}   
+	if (strlen($time_END) < 6) {$time_END = "15:15:00";}
+	}
+if ($shift == 'PM') 
+	{
+	$time_BEGIN=$PM_shift_BEGIN;
+	$time_END=$PM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "15:15:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:15:00";}
+	}
+if ($shift == 'ALL') 
+	{
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "00:00:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:59:59";}
+	}
+$query_date_BEGIN = "$query_date $time_BEGIN";   
+$query_date_END = "$query_date $time_END";
+
+
+
+echo "VICIDIAL: Auto-dial Stats                             $NOW_TIME\n";
+
+echo "\n";
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{$average_hold_seconds = '         0';}
+else
+	{
+	$average_hold_seconds = ($row[1] / $row[0]);
+	$average_hold_seconds = round($average_hold_seconds, 2);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+echo "Total Calls placed from this Campaign:        $TOTALcalls\n";
+echo "Average Call Length for all Calls in seconds: $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP' and (length_in_sec <= 60 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$DROPcalls =	sprintf("%10s", $row[0]);
+$DROPcallsRAW =	$row[0];
+$DROPseconds =	$row[1];
+
+$stmt="select count(*) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and status NOT IN('NA','B');";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$ANSWERcalls =	$row[0];
+
+if ( ($DROPcalls < 1) or ($TOTALcalls < 1) )
+	{$DROPpercent = '0';}
+else
+	{
+	$DROPpercent = (($DROPcallsRAW / $TOTALcalls) * 100);
+	$DROPpercent = round($DROPpercent, 2);
+	}
+
+if ( ($DROPcalls < 1) or ($ANSWERcalls < 1) )
+	{$DROPANSWERpercent = '0';}
+else
+	{
+	$DROPANSWERpercent = (($DROPcallsRAW / $ANSWERcalls) * 100);
+	$DROPANSWERpercent = round($DROPANSWERpercent, 2);
+	}
+
+if ( ($DROPseconds < 1) or ($DROPcallsRAW < 1) )
+	{$average_hold_seconds = '         0';}
+else
+	{
+	$average_hold_seconds = ($DROPseconds / $DROPcallsRAW);
+	$average_hold_seconds = round($average_hold_seconds, 2);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+
+echo "Total DROP Calls:                             $DROPcalls  $DROPpercent%\n";
+echo "Percent of DROP Calls taken out of Answers:   $DROPcalls / $ANSWERcalls  $DROPANSWERpercent%\n";
+echo "Average Length for DROP Calls in seconds:     $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- AUTO-DIAL NO ANSWERS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and status IN('NA','B') and (length_in_sec <= 60 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$NAcalls =	sprintf("%10s", $row[0]);
+if ( ($NAcalls < 1) or ($TOTALcalls < 1) )
+	{$NApercent = '0';}
+else
+	{
+	$NApercent = (($NAcalls / $TOTALcalls) * 100);
+	$NApercent = round($NApercent, 2);
+	}
+
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{$average_na_seconds = '         0';}
+else
+	{
+	$average_na_seconds = ($row[1] / $row[0]);
+	$average_na_seconds = round($average_na_seconds, 2);
+	$average_na_seconds =	sprintf("%10s", $average_na_seconds);
+	}
+
+echo "Total NA calls -Busy,Disconnect,RingNoAnswer: $NAcalls  $NApercent%\n";
+echo "Average Call Length for NA Calls in seconds:  $average_na_seconds\n";
+
+
+##############################
+#########  CALL STATUS STATS
+
+$TOTALcalls = 0;
+
+echo "\n";
+echo "---------- CALL STATUS STATS\n";
+echo "+--------+----------------------+------------+\n";
+echo "| STATUS | DESCRIPTION          | CALLS      |\n";
+echo "+--------+----------------------+------------+\n";
+
+$stmt="SELECT * from vicidial_statuses order by status";
+$rslt=mysql_query($stmt, $link);
+$statuses_to_print = mysql_num_rows($rslt);
+$statuses_list='';
+
+$o=0;
+while ($statuses_to_print > $o) 
+	{
+	$rowx=mysql_fetch_row($rslt);
+	$statname_list["$rowx[0]"] = "$rowx[1]";
+	$o++;
+	}
+
+$stmt="SELECT * from vicidial_campaign_statuses where campaign_id='" . mysql_real_escape_string($group) . "' order by status";
+$rslt=mysql_query($stmt, $link);
+$Cstatuses_to_print = mysql_num_rows($rslt);
+
+$o=0;
+while ($Cstatuses_to_print > $o) 
+	{
+	$rowx=mysql_fetch_row($rslt);
+	$statname_list["$rowx[0]"] = "$rowx[1]";
+	$o++;
+	}
+
+$stmt="select count(*),status from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysql_real_escape_string($group) . "' group by status;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$statuses_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $statuses_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$TOTALcalls = ($TOTALcalls + $row[0]);
+
+	$STATUScount =	sprintf("%10s", $row[0]);while(strlen($STATUScount)>10) {$STATUScount = substr("$STATUScount", 0, -1);}
+	$RAWstatus = $row[1];
+	$status =	sprintf("%-6s", $row[1]);while(strlen($status)>6) {$status = substr("$status", 0, -1);}
+
+	if ($non_latin < 1)
+		{
+		 $status_name =	sprintf("%-20s", $statname_list[$RAWstatus]); 
+		 while(strlen($status_name)>20) {$status_name = substr("$status_name", 0, -1);}	
+		}
+	else
+		{
+		 $status_name =	sprintf("%-60s", $statname_list[$RAWstatus]); 
+		 while(mb_strlen($status_name,'utf-8')>20) {$status_name = mb_substr("$status_name", 0, -1,'utf-8');}	
+		}
+
+
+	echo "| $status | $status_name | $STATUScount |\n";
+
+	$i++;
+	}
+
+$TOTALcalls =		sprintf("%10s", $TOTALcalls);
+
+echo "+--------+----------------------+------------+\n";
+echo "| TOTAL:                        | $TOTALcalls |\n";
+echo "+-------------------------------+------------+\n";
+
+
+##############################
+#########  USER STATS
+
+$TOTagents=0;
+$TOTcalls=0;
+$TOTtime=0;
+$TOTavg=0;
+
+echo "\n";
+echo "---------- AGENT STATS\n";
+echo "+--------------------------+------------+----------+--------+\n";
+echo "| AGENT                    | CALLS      | TIME M   | AVRG M |\n";
+echo "+--------------------------+------------+----------+--------+\n";
+
+$stmt="select vicidial_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_log,vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysql_real_escape_string($group) . "' and vicidial_log.user is not null and length_in_sec is not null and length_in_sec > 4 and vicidial_log.user=vicidial_users.user group by vicidial_log.user;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$TOTcalls = ($TOTcalls + $row[2]);
+	$TOTtime = ($TOTtime + $row[3]);
+
+	$user =	sprintf("%-6s", $row[0]);while(strlen($user)>6) {$user = substr("$user", 0, -1);}
+	if ($non_latin < 1)
+	{
+ 	 $full_name =	sprintf("%-15s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}	
+	}
+	else
+	{
+	 $full_name =	sprintf("%-45s", $row[1]); while(mb_strlen($full_name,'utf-8')>15) {$full_name = mb_substr("$full_name", 0, -1,'utf-8');}	
+	}
+	$USERcalls =	sprintf("%10s", $row[2]);
+	$USERtotTALK =	$row[3];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$USERtotTALK_MS =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $user - $full_name | $USERcalls |   $USERtotTALK_MS | $USERavgTALK_MS |\n";
+
+	$i++;
+	}
+
+if (!$TOTcalls) {$TOTcalls = 1;}
+$TOTavg = ($TOTtime / $TOTcalls);
+$TOTavg = round($TOTavg, 0);
+$TOTavg_M = ($TOTavg / 60);
+$TOTavg_M = round($TOTavg_M, 2);
+$TOTavg_M_int = intval("$TOTavg_M");
+$TOTavg_S = ($TOTavg_M - $TOTavg_M_int);
+$TOTavg_S = ($TOTavg_S * 60);
+$TOTavg_S = round($TOTavg_S, 0);
+if ($TOTavg_S < 10) {$TOTavg_S = "0$TOTavg_S";}
+$TOTavg_MS = "$TOTavg_M_int:$TOTavg_S";
+$TOTavg =		sprintf("%6s", $TOTavg_MS);
+
+$TOTtime_M = ($TOTtime / 60);
+$TOTtime_M = 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 ($TOTtime_S < 10) {$TOTtime_S = "0$TOTtime_S";}
+$TOTtime_MS = "$TOTtime_M_int:$TOTtime_S";
+$TOTtime =		sprintf("%6s", $TOTtime_MS);
+
+$TOTagents =		sprintf("%10s", $i);
+$TOTcalls =			sprintf("%10s", $TOTcalls);
+$TOTtime =			sprintf("%8s", $TOTtime);
+$TOTavg =			sprintf("%6s", $TOTavg);
+
+$stmt="select avg(wait_sec) from vicidial_agent_log where event_time >= '$query_date_BEGIN' and event_time <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$AVGwait = $row[0];
+$AVGwait_M = ($AVGwait / 60);
+$AVGwait_M = round($AVGwait_M, 2);
+$AVGwait_M_int = intval("$AVGwait_M");
+$AVGwait_S = ($AVGwait_M - $AVGwait_M_int);
+$AVGwait_S = ($AVGwait_S * 60);
+$AVGwait_S = round($AVGwait_S, 0);
+if ($AVGwait_S < 10) {$AVGwait_S = "0$AVGwait_S";}
+$AVGwait_MS = "$AVGwait_M_int:$AVGwait_S";
+$AVGwait =		sprintf("%6s", $AVGwait_MS);
+
+echo "+--------------------------+------------+----------+--------+\n";
+echo "| TOTAL Agents: $TOTagents | $TOTcalls | $TOTtime | $TOTavg |\n";
+echo "+--------------------------+------------+----------+--------+\n";
+echo "| Average Wait time between calls                    $AVGwait |\n";
+echo "+-----------------------------------------------------------+\n";
+
+##############################
+#########  TIME STATS
+
+echo "\n";
+echo "---------- TIME STATS\n";
+
+echo "\n";
+
+$hi_hour_count=0;
+$last_full_record=0;
+$i=0;
+$h=0;
+while ($i <= 96)
+	{
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+	$h++;
+	}
+
+if ($hi_hour_count < 1)
+	{$hour_multiplier = 0;}
+else
+	{
+	$hour_multiplier = (100 / $hi_hour_count);
+	#$hour_multiplier = round($hour_multiplier, 0);
+	}
+
+echo "\n";
+echo "GRAPH IN 15 MINUTE INCREMENTS OF TOTAL CALLS PLACED FROM THIS CAMPAIGN\n";
+
+$k=1;
+$Mk=0;
+$call_scale = '0';
+while ($k <= 102) 
+	{
+	if ($Mk >= 5) 
+		{
+		$Mk=0;
+		if ( ($k < 1) or ($hour_multiplier <= 0) )
+			{$scale_num = 100;}
+		else
+			{
+			$scale_num=($k / $hour_multiplier);
+			$scale_num = round($scale_num, 0);
+			}
+		$LENscale_num = (strlen($scale_num));
+		$k = ($k + $LENscale_num);
+		$call_scale .= "$scale_num";
+		}
+	else
+		{
+		$call_scale .= " ";
+		$k++;   $Mk++;
+		}
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+$ZZ = '00';
+$i=0;
+$h=4;
+$hour= -1;
+$no_lines_yet=1;
+
+while ($i <= 96)
+	{
+	$char_counter=0;
+	$time = '      ';
+	if ($h >= 4) 
+		{
+		$hour++;
+		$h=0;
+		if ($hour < 10) {$hour = "0$hour";}
+		$time = "+$hour$ZZ+";
+		}
+	if ($h == 1) {$time = "   15 ";}
+	if ($h == 2) {$time = "   30 ";}
+	if ($h == 3) {$time = "   45 ";}
+	$Ghour_count = $hour_count[$i];
+	if ($Ghour_count < 1) 
+		{
+		if ( ($no_lines_yet) or ($i > $last_full_record) )
+			{
+			$do_nothing=1;
+			}
+		else
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			echo "|$time|";
+			$k=0;   while ($k <= 102) {echo " ";   $k++;}
+			echo "| $hour_count[$i] |\n";
+			}
+		}
+	else
+		{
+		$no_lines_yet=0;
+		$Xhour_count = ($Ghour_count * $hour_multiplier);
+		$Yhour_count = (99 - $Xhour_count);
+
+		$Gdrop_count = $drop_count[$i];
+		if ($Gdrop_count < 1) 
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "*X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 101) {echo " ";   $char_counter++;}
+			echo "| 0     | $hour_count[$i] |\n";
+
+			}
+		else
+			{
+			$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+		#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+			$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+			echo "D";   $char_counter++;
+			$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 102) {echo " ";   $char_counter++;}
+			echo "| $drop_count[$i] | $hour_count[$i] |\n";
+			}
+		}
+	
+	
+	$i++;
+	$h++;
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+
+
+
+
+
+$ENDtime = date("U");
+$RUNtime = ($ENDtime - $STARTtime);
+echo "\nRun Time: $RUNtime seconds\n";
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_VICIDIAL_hopperlist.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_VICIDIAL_hopperlist.php new file mode 100644 index 00000000..a30832be --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_VICIDIAL_hopperlist.php @@ -0,0 +1,169 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1654 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 70115-1614 - Added ALT field for vicidial_hopper alt_dial column +# 71029-0852 - Added list_id to the output +# 71030-2118 - Added priority to display +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and modify_campaigns='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = '';} +if (!isset($query_date)) {$query_date = $NOW_DATE;} +if (!isset($server_ip)) {$server_ip = '10.10.10.15';} + +$stmt="select campaign_id,campaign_name from vicidial_campaigns order by campaign_id;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$campaigns_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $campaigns_to_print) + { + $row=mysql_fetch_row($rslt); + $campaign_id[$i] =$row[0]; + $campaign_name[$i] =$row[1]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: Hopper List\n"; +echo "
\n"; +#echo "\n"; +#echo "\n"; +echo "\n"; +echo "\n"; +echo "           MODIFY \n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "PLEASE SELECT A CAMPAIGN ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+
+
+echo "VICIDIAL: Live Current Hopper List                      $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+
+echo "Total leads in hopper right now:       $TOTALcalls\n";
+
+
+##############################
+#########  LEAD STATS
+
+echo "\n";
+echo "---------- LEADS IN HOPPER\n";
+echo "+------+--------+-----------+------------+------------+-------+--------+-------+--------+-------+\n";
+echo "|ORDER |PRIORITY| LEAD ID   | LIST ID    | PHONE NUM  | STATE | STATUS | COUNT | GMT    | ALT   |\n";
+echo "+------+--------+-----------+------------+------------+-------+--------+-------+--------+-------+\n";
+
+$stmt="select vicidial_hopper.lead_id,phone_number,vicidial_hopper.state,vicidial_list.status,called_count,vicidial_hopper.gmt_offset_now,hopper_id,alt_dial,vicidial_hopper.list_id,vicidial_hopper.priority from vicidial_hopper,vicidial_list where vicidial_hopper.campaign_id='" . mysql_real_escape_string($group) . "' and vicidial_hopper.lead_id=vicidial_list.lead_id order by priority desc,hopper_id limit 2000;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$FMT_i =		sprintf("%-4s", $i);
+	$lead_id =		sprintf("%-9s", $row[0]);
+	$phone_number =	sprintf("%-10s", $row[1]);
+	$state =		sprintf("%-5s", $row[2]);
+	$status =		sprintf("%-6s", $row[3]);
+	$count =		sprintf("%-5s", $row[4]);
+	$gmt =			sprintf("%-6s", $row[5]);
+	$hopper_id =	sprintf("%-6s", $row[6]);
+	$alt_dial =		sprintf("%-5s", $row[7]);
+	$list_id =		sprintf("%-10s", $row[8]);
+	$priority =		sprintf("%-6s", $row[9]);
+
+if ($DB) {echo "| $FMT_i | $priority | $lead_id | $list_id | $phone_number | $state | $status | $count | $gmt | $hopper_id |\n";}
+else {echo "| $FMT_i | $priority | $lead_id | $list_id | $phone_number | $state | $status | $count | $gmt | $alt_dial |\n";}
+
+	$i++;
+	}
+
+echo "+------+--------+-----------+------------+------------+-------+--------+-------+--------+-------+\n";
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_admin_log_display.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_admin_log_display.php new file mode 100644 index 00000000..9c5c4af6 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_admin_log_display.php @@ -0,0 +1,118 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); +$query_date = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$query_date); + +# AST GUI database administration +# AST_admin_log_display.php +# +# CHANGES +# 50325-0932 - First build +# 51123-1443 - removed globals=on requirement +# 60421-1229 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60620-1044 - Added variable filtering to eliminate SQL injection attack threat +# + +$version = '0.0.4'; +$build = '60620-1044'; + +$STARTtime = date("U"); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 8 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDIAL ADMIN LOG DISPLAY"; +echo "\n"; + +# Fri, 25 Mar 2005 + +$DAY_DATE = date("j"); +if ($DAY_DATE < 10) +# {$GREP_DATE = date("D, j M Y");} + {$GREP_DATE = date("D, 0j M Y");} +else + {$GREP_DATE = date("D, j M Y");} + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!$query_date) {$query_date = $GREP_DATE;} + +$Gquery_date = eregi_replace(" ",'\ ',$query_date); +echo "\n"; + +echo "
\n"; +echo "\n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+echo "VICIDIAL ADMIN CHANGE LOG                             $NOW_TIME\n";
+
+#passthru("grep $Gquery_date /home/www/htdocs/vicidial/admin_changes_log.txt");
+passthru("grep $Gquery_date $WeBServeRRooT/vicidial/admin_changes_log.txt");
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_agent_disposition.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_agent_disposition.php new file mode 100644 index 00000000..b0b0a461 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_agent_disposition.php @@ -0,0 +1,237 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 70201-1213 - First build - from Marin Blu +# +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["shift"])) {$shift=$_GET["shift"];} + elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = '';} +if (!isset($begin_date)) {$begin_date = $NOW_DATE;} +if (!isset($end_date)) {$end_date = $NOW_DATE;} + +$stmt="select campaign_id from vicidial_campaigns;"; +if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$campaigns_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $campaigns_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: Agent Disposition\n"; +echo "
\n"; +echo "Date - From: to \n"; +echo "  \n"; +echo "\n"; +echo "\n"; +echo "           MODIFY | REPORTS \n"; +echo "\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A SERVER AND DATE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+
+echo "VICIDIAL: Agent Disposition                             $NOW_TIME\n";
+
+echo "Time range: $begin_date to $end_date \n\n";
+echo "---------- Disposition Details -------------\n\n";
+
+echo "+-----------------+------------+--------+--------+--------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+\n";
+echo "| USER NAME       | ID         | CALLS  | TALK   | TALKAVG| A    | B    |CALLBK|CBHOLD| DEC  | DC   | DNC  | DROP |INCALL| LB   | N    | NA   | NI   | NP   | NQ   |QUEUE | SALE | XFER |\n";
+echo "+-----------------+------------+--------+--------+--------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+\n";
+
+$stmt="select count(*) as calls,sum(length_in_sec) as talk,full_name,vicidial_users.user,avg(length_in_sec) from vicidial_users,vicidial_log where call_date >= '$begin_date 00:00:01' and call_date <= '$end_date 23:59:59'  and vicidial_users.user=vicidial_log.user and campaign_id='" . mysql_real_escape_string($group) . "' group by full_name order by calls desc limit 1000;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$TOTcalls=($TOTcalls + $row[0]);
+	$TOTtotTALK=($TOTtotTALK + $row[1]);
+	$calls[$i] =	sprintf("%-6s", $row[0]);
+	$full_name[$i]=	sprintf("%-15s", $row[2]); while(strlen($full_name[$i])>15) {$full_name[$i] = substr("$full_name[$i]", 0, -1);}
+	$user[$i] =		sprintf("%-10s", $row[3]); while(strlen($user[$i])>10) {$user[$i] = substr("$user[$i]", 0, -1);}
+	$USERtotTALK =	$row[1];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$pfUSERtotTALK_MS[$i] =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$pfUSERavgTALK_MS[$i] =		sprintf("%6s", $USERavgTALK_MS);
+	$i++;
+	}
+	
+$k=0;
+
+while($k < $i)
+	
+	{
+	$ctA[$k]="0   "; $ctB[$k]="0   "; $ctDC[$k]="0   "; $ctDNC[$k]="0   "; $ctN[$k]="0   "; $ctNI[$k]="0   "; $ctSALE[$k]="0   ";  $ctINCALL[$k]="0   ";  $ctDROP[$k]="0   ";  $ctQUEUE[$k]="0   ";  $ctNP[$k]="0   ";   $ctDEC[$k]="0   ";  $ctNQ[$k]="0   ";  $ctNA[$k]="0   ";   $ctXFER[$k]="0   "; $ctLB[$k]="0   ";  $ctCALLBK[$k]="0   "; $ctCBHOLD[$k]="0   ";
+	$stmt="select count(*),status from vicidial_log where call_date >= '$begin_date 00:00:01' and call_date <= '$end_date 23:59:59'  and user='$user[$k]' and campaign_id='" . mysql_real_escape_string($group) . "' group by status;";
+	if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$rows_to_print = mysql_num_rows($rslt);
+	$m=0;
+	while ($m < $rows_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if ($row[1] == 'A') {$ctA[$k]=sprintf("%-4s", $row[0]);		$TOT_A = ($TOT_A + $row[0]);}
+		if ($row[1] == 'B') {$ctB[$k]=sprintf("%-4s", $row[0]);		$TOT_B = ($TOT_B + $row[0]);}
+		if ($row[1] == 'DC') {$ctDC[$k]=sprintf("%-4s", $row[0]);	$TOT_DC = ($TOT_DC + $row[0]);}
+		if ($row[1] == 'DNC') {$ctDNC[$k]=sprintf("%-4s", $row[0]);	$TOT_DNC = ($TOT_DNC + $row[0]);}
+		if ($row[1] == 'N') {$ctN[$k]=sprintf("%-4s", $row[0]);		$TOT_N = ($TOT_N + $row[0]);}
+		if ($row[1] == 'NI') {$ctNI[$k]=sprintf("%-4s", $row[0]);	$TOT_NI = ($TOT_NI + $row[0]);}
+		if ($row[1] == 'SALE') {$ctSALE[$k]=sprintf("%-4s", $row[0]);	$TOT_SALE = ($TOT_SALE + $row[0]);}
+		if ($row[1] == 'INCALL') {$ctINCALL[$k]=sprintf("%-4s", $row[0]);	$TOT_INCALL = ($TOT_INCALL + $row[0]);}
+		if ($row[1] == 'DROP') {$ctDROP[$k]=sprintf("%-4s", $row[0]);	$TOT_DROP = ($TOT_DROP + $row[0]);}
+		if ($row[1] == 'QUEUE') {$ctQUEUE[$k]=sprintf("%-4s", $row[0]);	$TOT_QUEUE = ($TOT_QUEUE + $row[0]);}
+		if ($row[1] == 'NP') {$ctNP[$k]=sprintf("%-4s", $row[0]);	$TOT_NP = ($TOT_NP + $row[0]);}
+		if ($row[1] == 'DEC') {$ctDEC[$k]=sprintf("%-4s", $row[0]);	$TOT_DEC = ($TOT_DEC + $row[0]);}
+		if ($row[1] == 'NQ') {$ctNQ[$k]=sprintf("%-4s", $row[0]);	$TOT_NQ = ($TOT_NQ + $row[0]);}
+		if ($row[1] == 'NA') {$ctNA[$k]=sprintf("%-4s", $row[0]);	$TOT_NA = ($TOT_NA + $row[0]);}
+		if ($row[1] == 'XFER') {$ctXFER[$k]=sprintf("%-4s", $row[0]);	$TOT_XFER = ($TOT_XFER + $row[0]);}
+		if ($row[1] == 'LB') {$ctLB[$k]=sprintf("%-4s", $row[0]);	$TOT_LB = ($TOT_LB + $row[0]);}
+		if ($row[1] == 'CALLBK') {$ctCALLBK[$k]=sprintf("%-4s", $row[0]);	$TOT_CALLBK = ($TOT_CALLBK + $row[0]);}
+		if ($row[1] == 'CBHOLD') {$ctCBHOLD[$k]=sprintf("%-4s", $row[0]);	$TOT_CBHOLD = ($TOT_CBHOLD + $row[0]);}
+		$m++;
+		}
+	echo "| $full_name[$k] | $user[$k] | $calls[$k] | $pfUSERtotTALK_MS[$k] | $pfUSERavgTALK_MS[$k] | $ctA[$k] | $ctB[$k] | $ctCALLBK[$k] | $ctCBHOLD[$k] | $ctDEC[$k] | $ctDC[$k] | $ctDNC[$k] | $ctDROP[$k] | $ctINCALL[$k] | $ctLB[$k] | $ctN[$k] | $ctNA[$k] | $ctNI[$k] | $ctNP[$k] | $ctNQ[$k] | $ctQUEUE[$k] | $ctSALE[$k] | $ctXFER[$k] | \n";
+
+	$k++;
+	}
+
+	$TOTcalls =	sprintf("%-7s", $TOTcalls);
+
+	$TOTtotTALK_M = ($TOTtotTALK / 60);
+	$TOTtotTALK_M = round($TOTtotTALK_M, 2);
+	$TOTtotTALK_M_int = intval("$TOTtotTALK_M");
+	$TOTtotTALK_S = ($TOTtotTALK_M - $TOTtotTALK_M_int);
+	$TOTtotTALK_S = ($TOTtotTALK_S * 60);
+	$TOTtotTALK_S = round($TOTtotTALK_S, 0);
+	if ($TOTtotTALK_S < 10) {$TOTtotTALK_S = "0$TOTtotTALK_S";}
+	$TOTtotTALK_MS = "$TOTtotTALK_M_int:$TOTtotTALK_S";
+	$TOTtotTALK_MS =		sprintf("%7s", $TOTtotTALK_MS);
+		while(strlen($TOTtotTALK_MS)>7) {$TOTtotTALK_MS = substr("$TOTtotTALK_MS", 0, -1);}
+
+	$TOT_A = sprintf("%-5s", $TOT_A);
+	$TOT_B = sprintf("%-5s", $TOT_B);
+	$TOT_DC = sprintf("%-5s", $TOT_DC);
+	$TOT_DNC = sprintf("%-5s", $TOT_DNC);
+	$TOT_N = sprintf("%-5s", $TOT_N);
+	$TOT_NI = sprintf("%-5s", $TOT_NI);
+	$TOT_SALE = sprintf("%-5s", $TOT_SALE);
+	$TOT_INCALL = sprintf("%-5s", $TOT_INCALL);
+	$TOT_DROP = sprintf("%-5s", $TOT_DROP); 
+	$TOT_QUEUE = sprintf("%-5s", $TOT_QUEUE);
+	$TOT_NP = sprintf("%-5s", $TOT_NP);
+	$TOT_DEC = sprintf("%-5s", $TOT_DEC);
+	$TOT_NQ = sprintf("%-5s", $TOT_NQ);
+	$TOT_NA = sprintf("%-5s", $TOT_NA);
+	$TOT_XFER = sprintf("%-5s", $TOT_XFER);
+	$TOT_LB= sprintf("%-5s", $TOT_LB);
+	$TOT_CALLBK = sprintf("%-5s", $TOT_CALLBK);
+	$TOT_CBHOLD = sprintf("%-5s", $TOT_CBHOLD);
+
+echo "+-----------------+------------+--------+--------+--------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+\n";
+echo "|  TOTALS                      | $TOTcalls| $TOTtotTALK_MS|        | $TOT_A| $TOT_B| $TOT_CALLBK| $TOT_CBHOLD| $TOT_DEC| $TOT_DC| $TOT_DNC| $TOT_DROP| $TOT_INCALL| $TOT_LB| $TOT_N| $TOT_NA| $TOT_NI| $TOT_NP| $TOT_NQ| $TOT_QUEUE| $TOT_SALE| $TOT_XFER|\n";
+echo "+-----------------+------------+--------+--------+--------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+\n";
+echo "\n";
+
+}
+?>
+
\ No newline at end of file
diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_agent_performance.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_agent_performance.php
new file mode 100644
index 00000000..eb2ceac4
--- /dev/null
+++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_agent_performance.php
@@ -0,0 +1,257 @@
+    LICENSE: GPLv2
+###
+# CHANGES
+#
+# 60619-1711 - Added variable filtering to eliminate SQL injection attack threat
+#            - Added required user/pass to gain access to this page
+# 70201-1203 - Added non_latin UTF8 output code, widened USER ID to 8 chars
+#
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+if (isset($_GET["group"]))				{$group=$_GET["group"];}
+	elseif (isset($_POST["group"]))		{$group=$_POST["group"];}
+if (isset($_GET["query_date"]))				{$query_date=$_GET["query_date"];}
+	elseif (isset($_POST["query_date"]))		{$query_date=$_POST["query_date"];}
+if (isset($_GET["shift"]))				{$shift=$_GET["shift"];}
+	elseif (isset($_POST["shift"]))		{$shift=$_POST["shift"];}
+if (isset($_GET["submit"]))				{$submit=$_GET["submit"];}
+	elseif (isset($_POST["submit"]))		{$submit=$_POST["submit"];}
+if (isset($_GET["SUBMIT"]))				{$SUBMIT=$_GET["SUBMIT"];}
+	elseif (isset($_POST["SUBMIT"]))		{$SUBMIT=$_POST["SUBMIT"];}
+
+$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
+$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
+
+	$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
+	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($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
+	{
+    Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
+    Header("HTTP/1.0 401 Unauthorized");
+    echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
+    exit;
+	}
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!isset($group)) {$group = '';}
+if (!isset($query_date)) {$query_date = $NOW_DATE;}
+
+$stmt="select campaign_id from vicidial_campaigns;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$campaigns_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $campaigns_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$groups[$i] =$row[0];
+	$i++;
+	}
+?>
+
+
+
+
+
+\n";
+echo "VICIDIAL: Agent Performance\n";
+echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "           MODIFY | REPORTS \n"; +echo "
\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A SERVER AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
+echo " NOTE: stats taken from 6 hour shift specified\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$query_date_BEGIN = "$query_date 08:45:00";   
+	$query_date_END = "$query_date 15:33:00";
+	$time_BEGIN = "08:45:00";   
+	$time_END = "15:33:00";
+	}
+if ($shift == 'PM') 
+	{
+	$query_date_BEGIN = "$query_date 15:33:00";   
+	$query_date_END = "$query_date 23:15:00";
+	$time_BEGIN = "15:33:00";   
+	$time_END = "23:15:00";
+	}
+
+echo "VICIDIAL: Agent Performance                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENTS Details -------------\n\n";
+
+echo "+-----------------+----------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+echo "| USER NAME       | ID       | CALLS  | TALK   | TALKAVG| A    | B    | DC   | DNC  | N    | NI   | SALE |\n";
+echo "+-----------------+----------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+
+$stmt="select count(*) as calls,sum(length_in_sec) as talk,full_name,vicidial_users.user,avg(length_in_sec) from vicidial_users,vicidial_log where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN' and vicidial_users.user=vicidial_log.user and campaign_id='" . mysql_real_escape_string($group) . "' group by full_name order by calls desc limit 1000;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$TOTcalls=($TOTcalls + $row[0]);
+	$TOTtotTALK=($TOTtotTALK + $row[1]);
+	$calls[$i] =	sprintf("%-6s", $row[0]);
+
+	if ($non_latin < 1)
+	{
+   	 $full_name[$i]=	sprintf("%-15s", $row[2]); 
+	 while(strlen($full_name[$i])>15) {$full_name[$i] = substr("$full_name[$i]", 0, -1);}
+
+	 $user[$i] =		sprintf("%-6s", $row[3]);
+        while(strlen($user[$i])>6) {$user[$i] = substr("$user[$i]", 0, -1);}
+       }
+	else
+	{	
+        $full_name[$i]=	sprintf("%-45s", $row[2]); 
+	 while(mb_strlen($full_name[$i],'utf-8')>15) {$full_name[$i] = mb_substr("$full_name[$i]", 0, -1,'utf-8');}
+
+ 	 $user[$i] =		sprintf("%-18s", $row[3]);
+	 while(mb_strlen($user[$i],'utf-8')>6) {$user[$i] = mb_substr("$user[$i]", 0, -1,'utf-8');}
+	}
+
+	$user[$i] =		sprintf("%-8s", $row[3]);
+	$USERtotTALK =	$row[1];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$pfUSERtotTALK_MS[$i] =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$pfUSERavgTALK_MS[$i] =		sprintf("%6s", $USERavgTALK_MS);
+	$i++;
+	}
+
+$k=0;
+while($k < $i)
+	{
+	$ctA[$k]="0   "; $ctB[$k]="0   "; $ctDC[$k]="0   "; $ctDNC[$k]="0   "; $ctN[$k]="0   "; $ctNI[$k]="0   "; $ctSALE[$k]="0   "; 
+	$stmt="select count(*),status from vicidial_log where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN' and user='$user[$k]' and campaign_id='" . mysql_real_escape_string($group) . "' group by status;";
+	if ($non_latin > 0)
+	{
+	$rslt=mysql_query("SET NAMES 'UTF8'");
+	}
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$rows_to_print = mysql_num_rows($rslt);
+	$m=0;
+	while ($m < $rows_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if ($row[1] == 'A') {$ctA[$k]=sprintf("%-4s", $row[0]);		$TOT_A = ($TOT_A + $row[0]);}
+		if ($row[1] == 'B') {$ctB[$k]=sprintf("%-4s", $row[0]);		$TOT_B = ($TOT_B + $row[0]);}
+		if ($row[1] == 'DC') {$ctDC[$k]=sprintf("%-4s", $row[0]);	$TOT_DC = ($TOT_DC + $row[0]);}
+		if ($row[1] == 'DNC') {$ctDNC[$k]=sprintf("%-4s", $row[0]);	$TOT_DNC = ($TOT_DNC + $row[0]);}
+		if ($row[1] == 'N') {$ctN[$k]=sprintf("%-4s", $row[0]);		$TOT_N = ($TOT_N + $row[0]);}
+		if ($row[1] == 'NI') {$ctNI[$k]=sprintf("%-4s", $row[0]);	$TOT_NI = ($TOT_NI + $row[0]);}
+		if (($row[1] == 'SALE') || ($row[1] == 'XFER') ) {$ctSALE[$k]=sprintf("%-4s", $row[0]);	$TOT_SALE = ($TOT_SALE + $row[0]);}
+		$m++;
+		}
+	echo "| $full_name[$k] | $user[$k] | $calls[$k] | $pfUSERtotTALK_MS[$k] | $pfUSERavgTALK_MS[$k] | $ctA[$k] | $ctB[$k] | $ctDC[$k] | $ctDNC[$k] | $ctN[$k] | $ctNI[$k] | $ctSALE[$k] |\n";
+
+
+
+	$k++;
+	}
+
+	$TOTcalls =	sprintf("%-7s", $TOTcalls);
+
+	$TOTtotTALK_M = ($TOTtotTALK / 60);
+	$TOTtotTALK_M = round($TOTtotTALK_M, 2);
+	$TOTtotTALK_M_int = intval("$TOTtotTALK_M");
+	$TOTtotTALK_S = ($TOTtotTALK_M - $TOTtotTALK_M_int);
+	$TOTtotTALK_S = ($TOTtotTALK_S * 60);
+	$TOTtotTALK_S = round($TOTtotTALK_S, 0);
+	if ($TOTtotTALK_S < 10) {$TOTtotTALK_S = "0$TOTtotTALK_S";}
+	$TOTtotTALK_MS = "$TOTtotTALK_M_int:$TOTtotTALK_S";
+	$TOTtotTALK_MS =		sprintf("%7s", $TOTtotTALK_MS);
+		while(strlen($TOTtotTALK_MS)>7) {$TOTtotTALK_MS = substr("$TOTtotTALK_MS", 0, -1);}
+
+	$TOT_A = sprintf("%-5s", $TOT_A);
+	$TOT_B = sprintf("%-5s", $TOT_B);
+	$TOT_DC = sprintf("%-5s", $TOT_DC);
+	$TOT_DNC = sprintf("%-5s", $TOT_DNC);
+	$TOT_N = sprintf("%-5s", $TOT_N);
+	$TOT_NI = sprintf("%-5s", $TOT_NI);
+	$TOT_SALE = sprintf("%-5s", $TOT_SALE);
+
+echo "+-----------------+----------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+echo "|  TOTALS                    | $TOTcalls| $TOTtotTALK_MS|        | $TOT_A| $TOT_B| $TOT_DC| $TOT_DNC| $TOT_N| $TOT_NI| $TOT_SALE|\n";
+echo "+-----------------+----------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+
+echo "\n";
+
+}
+
+
+
+?>
+
+
\ No newline at end of file
diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_agent_performance_detail.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_agent_performance_detail.php
new file mode 100644
index 00000000..5557d4dd
--- /dev/null
+++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_agent_performance_detail.php
@@ -0,0 +1,557 @@
+    LICENSE: GPLv2
+###
+# CHANGES
+#
+# 71119-2359 - First build
+# 71121-0144 - Replace existing AST_agent_performance_detail.php script with this one
+#            - Fixed zero division bug
+#
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+if (isset($_GET["query_date"]))				{$query_date=$_GET["query_date"];}
+	elseif (isset($_POST["query_date"]))	{$query_date=$_POST["query_date"];}
+if (isset($_GET["group"]))				{$group=$_GET["group"];}
+	elseif (isset($_POST["group"]))		{$group=$_POST["group"];}
+if (isset($_GET["user_group"]))				{$user_group=$_GET["user_group"];}
+	elseif (isset($_POST["user_group"]))	{$user_group=$_POST["user_group"];}
+if (isset($_GET["shift"]))				{$shift=$_GET["shift"];}
+	elseif (isset($_POST["shift"]))		{$shift=$_POST["shift"];}
+if (isset($_GET["submit"]))				{$submit=$_GET["submit"];}
+	elseif (isset($_POST["submit"]))	{$submit=$_POST["submit"];}
+if (isset($_GET["SUBMIT"]))				{$SUBMIT=$_GET["SUBMIT"];}
+	elseif (isset($_POST["SUBMIT"]))	{$SUBMIT=$_POST["SUBMIT"];}
+
+if (strlen($shift)<2) {$shift='ALL';}
+
+$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
+$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
+
+	$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
+	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($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
+	{
+    Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
+    Header("HTTP/1.0 401 Unauthorized");
+    echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
+    exit;
+	}
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!isset($group)) {$group = '';}
+if (!isset($query_date)) {$query_date = $NOW_DATE;}
+
+$stmt="select campaign_id from vicidial_campaigns;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$campaigns_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $campaigns_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$groups[$i] =$row[0];
+	$i++;
+	}
+$stmt="select user_group from vicidial_user_groups;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$user_groups_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $user_groups_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$user_groups[$i] =$row[0];
+	$i++;
+	}
+?>
+
+
+
+
+
+\n";
+echo "VICIDIAL: Agent Performance\n";
+echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "           MODIFY | REPORTS \n"; +echo "
\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A CAMPAIGN AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
+echo " NOTE: stats taken from shift specified\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$time_BEGIN=$AM_shift_BEGIN;
+	$time_END=$AM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "03:45:00";}   
+	if (strlen($time_END) < 6) {$time_END = "15:15:00";}
+	}
+if ($shift == 'PM') 
+	{
+	$time_BEGIN=$PM_shift_BEGIN;
+	$time_END=$PM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "15:15:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:15:00";}
+	}
+if ($shift == 'ALL') 
+	{
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "00:00:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:59:59";}
+	}
+$query_date_BEGIN = "$query_date $time_BEGIN";   
+$query_date_END = "$query_date $time_END";
+
+if (strlen($user_group)>0) {$ugSQL="and vicidial_agent_log.user_group='$user_group'";}
+else {$ugSQL='';}
+
+echo "VICIDIAL: Agent Performance Detail                        $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENTS Details -------------\n\n";
+
+
+
+
+
+$statuses='-';
+$statusesTXT='';
+$statusesHEAD='';
+$statusesHTML='';
+$statusesARY[0]='';
+$j=0;
+$users='-';
+$usersARY[0]='';
+$user_namesARY[0]='';
+$k=0;
+
+$stmt="select count(*) as calls,sum(talk_sec) as talk,full_name,vicidial_users.user,sum(pause_sec),sum(wait_sec),sum(dispo_sec),status from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user and campaign_id='" . mysql_real_escape_string($group) . "' and pause_sec<36000 and wait_sec<36000 and talk_sec<36000 and dispo_sec<36000 $ugSQL group by full_name,status order by status desc,full_name limit 100000;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$row[0] = ($row[0] - 1);	# subtract 1 for login/logout event compensation
+	
+	$calls[$i] =		$row[0];
+	$talk_sec[$i] =		$row[1];
+	$full_name[$i] =	$row[2];
+	$user[$i] =			$row[3];
+	$pause_sec[$i] =	$row[4];
+	$wait_sec[$i] =		$row[5];
+	$dispo_sec[$i] =	$row[6];
+	$status[$i] =		$row[7];
+	if ( (!eregi("-$status[$i]-", $statuses)) and (strlen($status[$i])>0) )
+		{
+		$statusesTXT = sprintf("%8s", $status[$i]);
+		$statusesHEAD .= "----------+";
+		$statusesHTML .= " $statusesTXT |";
+		$statuses .= "$status[$i]-";
+		$statusesARY[$j] = $status[$i];
+		$j++;
+		}
+	if (!eregi("-$user[$i]-", $users))
+		{
+		$users .= "$user[$i]-";
+		$usersARY[$k] = $user[$i];
+		$user_namesARY[$k] = $full_name[$i];
+		$k++;
+		}
+
+	$i++;
+	}
+
+
+echo "+-----------------+----------+--------+---------+--------+--------+--------+--------+--------+--------+--------+--------+$statusesHEAD\n";
+echo "| USER NAME       | ID       | CALLS  | TIME    | PAUSE  | PAUSAVG| WAIT   | WAITAVG| TALK   | TALKAVG| DISPO  | DISPAVG|$statusesHTML\n";
+echo "+-----------------+----------+--------+---------+--------+--------+--------+--------+--------+--------+--------+--------+$statusesHEAD\n";
+
+
+### BEGIN loop through each user ###
+$m=0;
+while ($m < $k)
+	{
+	$Suser=$usersARY[$m];
+	$Sfull_name=$user_namesARY[$m];
+	$Stime=0;
+	$Scalls=0;
+	$Stalk_sec=0;
+	$Spause_sec=0;
+	$Swait_sec=0;
+	$Sdispo_sec=0;
+	$SstatusesHTML='';
+
+	### BEGIN loop through each status ###
+	$n=0;
+	while ($n < $j)
+		{
+		$Sstatus=$statusesARY[$n];
+		$SstatusTXT='';
+		### BEGIN loop through each stat line ###
+		$i=0; $status_found=0;
+		while ($i < $rows_to_print)
+			{
+			if ( ($Suser=="$user[$i]") and ($Sstatus=="$status[$i]") )
+				{
+				$Scalls =		($Scalls + $calls[$i]);
+				$Stalk_sec =	($Stalk_sec + $talk_sec[$i]);
+				$Spause_sec =	($Spause_sec + $pause_sec[$i]);
+				$Swait_sec =	($Swait_sec + $wait_sec[$i]);
+				$Sdispo_sec =	($Sdispo_sec + $dispo_sec[$i]);
+				$SstatusTXT = sprintf("%8s", $calls[$i]);
+				$SstatusesHTML .= " $SstatusTXT |";
+				$status_found++;
+				}
+			$i++;
+			}
+		if ($status_found < 1)
+			{
+			$SstatusesHTML .= "        0 |";
+			}
+		### END loop through each stat line ###
+		$n++;
+		}
+	### END loop through each status ###
+	$Stime = ($Stalk_sec + $Spause_sec + $Swait_sec + $Sdispo_sec);
+	$TOTcalls=($TOTcalls + $Scalls);
+	$TOTtime=($TOTtime + $Stime);
+	$TOTtotTALK=($TOTtotTALK + $Stalk_sec);
+	$TOTtotWAIT=($TOTtotWAIT + $Swait_sec);
+	$TOTtotPAUSE=($TOTtotPAUSE + $Spause_sec);
+	$TOTtotDISPO=($TOTtotDISPO + $Sdispo_sec);
+	$Stime = ($Stalk_sec + $Spause_sec + $Swait_sec + $Sdispo_sec);
+	if ( ($Scalls > 0) and ($Stalk_sec > 0) ) {$Stalk_avg = ($Stalk_sec/$Scalls);}
+		else {$Stalk_avg=0;}
+	if ( ($Scalls > 0) and ($Spause_sec > 0) ) {$Spause_avg = ($Spause_sec/$Scalls);}
+		else {$Spause_avg=0;}
+	if ( ($Scalls > 0) and ($Swait_sec > 0) ) {$Swait_avg = ($Swait_sec/$Scalls);}
+		else {$Swait_avg=0;}
+	if ( ($Scalls > 0) and ($Sdispo_sec > 0) ) {$Sdispo_avg = ($Sdispo_sec/$Scalls);}
+		else {$Sdispo_avg=0;}
+
+	$Scalls =	sprintf("%6s", $Scalls);
+
+	if ($non_latin < 1)
+	{
+   	 $Sfull_name=	sprintf("%-15s", $Sfull_name); 
+		while(strlen($Sfull_name)>15) {$Sfull_name = substr("$Sfull_name", 0, -1);}
+	 $Suser =		sprintf("%-8s", $Suser);
+        while(strlen($Suser)>8) {$Suser = substr("$Suser", 0, -1);}
+       }
+	else
+	{	
+        $Sfull_name=	sprintf("%-45s", $Sfull_name); 
+	 while(mb_strlen($Sfull_name,'utf-8')>15) {$Sfull_name = mb_substr("$Sfull_name", 0, -1,'utf-8');}
+
+ 		$Suser =	sprintf("%-24s", $Suser);
+	 while(mb_strlen($Suser,'utf-8')>8) {$Suser = mb_substr("$Suser", 0, -1,'utf-8');}
+	}
+
+	$USERtime_M = ($Stime / 60);
+	$USERtime_M = round($USERtime_M, 2);
+	$USERtime_M_int = intval("$USERtime_M");
+	$USERtime_S = ($USERtime_M - $USERtime_M_int);
+	$USERtime_S = ($USERtime_S * 60);
+	$USERtime_S = round($USERtime_S, 0);
+	if ($USERtime_S < 10) {$USERtime_S = "0$USERtime_S";}
+	$USERtime_MS = "$USERtime_M_int:$USERtime_S";
+	$pfUSERtime_MS =		sprintf("%7s", $USERtime_MS);
+
+	$USERtotTALK_M = ($Stalk_sec / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$pfUSERtotTALK_MS =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($Stalk_avg / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$pfUSERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	$USERtotPAUSE_M = ($Spause_sec / 60);
+	$USERtotPAUSE_M = round($USERtotPAUSE_M, 2);
+	$USERtotPAUSE_M_int = intval("$USERtotPAUSE_M");
+	$USERtotPAUSE_S = ($USERtotPAUSE_M - $USERtotPAUSE_M_int);
+	$USERtotPAUSE_S = ($USERtotPAUSE_S * 60);
+	$USERtotPAUSE_S = round($USERtotPAUSE_S, 0);
+	if ($USERtotPAUSE_S < 10) {$USERtotPAUSE_S = "0$USERtotPAUSE_S";}
+	$USERtotPAUSE_MS = "$USERtotPAUSE_M_int:$USERtotPAUSE_S";
+	$pfUSERtotPAUSE_MS =		sprintf("%6s", $USERtotPAUSE_MS);
+
+	$USERavgPAUSE_M = ($Spause_avg / 60);
+	$USERavgPAUSE_M = round($USERavgPAUSE_M, 2);
+	$USERavgPAUSE_M_int = intval("$USERavgPAUSE_M");
+	$USERavgPAUSE_S = ($USERavgPAUSE_M - $USERavgPAUSE_M_int);
+	$USERavgPAUSE_S = ($USERavgPAUSE_S * 60);
+	$USERavgPAUSE_S = round($USERavgPAUSE_S, 0);
+	if ($USERavgPAUSE_S < 10) {$USERavgPAUSE_S = "0$USERavgPAUSE_S";}
+	$USERavgPAUSE_MS = "$USERavgPAUSE_M_int:$USERavgPAUSE_S";
+	$pfUSERavgPAUSE_MS =		sprintf("%6s", $USERavgPAUSE_MS);
+
+	$USERtotWAIT_M = ($Swait_sec / 60);
+	$USERtotWAIT_M = round($USERtotWAIT_M, 2);
+	$USERtotWAIT_M_int = intval("$USERtotWAIT_M");
+	$USERtotWAIT_S = ($USERtotWAIT_M - $USERtotWAIT_M_int);
+	$USERtotWAIT_S = ($USERtotWAIT_S * 60);
+	$USERtotWAIT_S = round($USERtotWAIT_S, 0);
+	if ($USERtotWAIT_S < 10) {$USERtotWAIT_S = "0$USERtotWAIT_S";}
+	$USERtotWAIT_MS = "$USERtotWAIT_M_int:$USERtotWAIT_S";
+	$pfUSERtotWAIT_MS =		sprintf("%6s", $USERtotWAIT_MS);
+
+	$USERavgWAIT_M = ($Swait_avg / 60);
+	$USERavgWAIT_M = round($USERavgWAIT_M, 2);
+	$USERavgWAIT_M_int = intval("$USERavgWAIT_M");
+	$USERavgWAIT_S = ($USERavgWAIT_M - $USERavgWAIT_M_int);
+	$USERavgWAIT_S = ($USERavgWAIT_S * 60);
+	$USERavgWAIT_S = round($USERavgWAIT_S, 0);
+	if ($USERavgWAIT_S < 10) {$USERavgWAIT_S = "0$USERavgWAIT_S";}
+	$USERavgWAIT_MS = "$USERavgWAIT_M_int:$USERavgWAIT_S";
+	$pfUSERavgWAIT_MS =		sprintf("%6s", $USERavgWAIT_MS);
+	
+	$USERtotDISPO_M = ($Sdispo_sec / 60);
+	$USERtotDISPO_M = round($USERtotDISPO_M, 2);
+	$USERtotDISPO_M_int = intval("$USERtotDISPO_M");
+	$USERtotDISPO_S = ($USERtotDISPO_M - $USERtotDISPO_M_int);
+	$USERtotDISPO_S = ($USERtotDISPO_S * 60);
+	$USERtotDISPO_S = round($USERtotDISPO_S, 0);
+	if ($USERtotDISPO_S < 10) {$USERtotDISPO_S = "0$USERtotDISPO_S";}
+	$USERtotDISPO_MS = "$USERtotDISPO_M_int:$USERtotDISPO_S";
+	$pfUSERtotDISPO_MS =		sprintf("%6s", $USERtotDISPO_MS);
+
+	$USERavgDISPO_M = ($Sdispo_avg / 60);
+	$USERavgDISPO_M = round($USERavgDISPO_M, 2);
+	$USERavgDISPO_M_int = intval("$USERavgDISPO_M");
+	$USERavgDISPO_S = ($USERavgDISPO_M - $USERavgDISPO_M_int);
+	$USERavgDISPO_S = ($USERavgDISPO_S * 60);
+	$USERavgDISPO_S = round($USERavgDISPO_S, 0);
+	if ($USERavgDISPO_S < 10) {$USERavgDISPO_S = "0$USERavgDISPO_S";}
+	$USERavgDISPO_MS = "$USERavgDISPO_M_int:$USERavgDISPO_S";
+	$pfUSERavgDISPO_MS =		sprintf("%6s", $USERavgDISPO_MS);
+
+	echo "| $Sfull_name | $Suser | $Scalls | $pfUSERtime_MS | $pfUSERtotPAUSE_MS | $pfUSERavgPAUSE_MS | $pfUSERtotWAIT_MS | $pfUSERavgWAIT_MS | $pfUSERtotTALK_MS | $pfUSERavgTALK_MS | $pfUSERtotDISPO_MS | $pfUSERavgDISPO_MS |$SstatusesHTML\n";
+	$m++;
+	}
+### END loop through each user ###
+
+
+###### LAST LINE FORMATTING ##########
+### BEGIN loop through each status ###
+$SUMstatusesHTML='';
+$n=0;
+while ($n < $j)
+	{
+	$Scalls=0;
+	$Sstatus=$statusesARY[$n];
+	$SUMstatusTXT='';
+	### BEGIN loop through each stat line ###
+	$i=0; $status_found=0;
+	while ($i < $rows_to_print)
+		{
+		if ($Sstatus=="$status[$i]")
+			{
+			$Scalls =		($Scalls + $calls[$i]);
+			$status_found++;
+			}
+		$i++;
+		}
+	### END loop through each stat line ###
+	if ($status_found < 1)
+		{
+		$SUMstatusesHTML .= "        0 |";
+		}
+	else
+		{
+		$SUMstatusTXT = sprintf("%8s", $Scalls);
+		$SUMstatusesHTML .= " $SUMstatusTXT |";
+		}
+	$n++;
+	}
+### END loop through each status ###
+
+
+	$TOTcalls =	sprintf("%7s", $TOTcalls);
+	$TOT_AGENTS = sprintf("%-4s", $m);
+
+	$TOTtime_M = ($TOTtime / 60);
+	$TOTtime_M = 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 ($TOTtime_S < 10) {$TOTtime_S = "0$TOTtime_S";}
+	$TOTtime_MS = "$TOTtime_M_int:$TOTtime_S";
+	$TOTtime_MS =		sprintf("%8s", $TOTtime_MS);
+		while(strlen($TOTtime_MS)>8) {$TOTtime_MS = substr("$TOTtime_MS", 0, -1);}
+
+	$TOTtotTALK_M = ($TOTtotTALK / 60);
+	$TOTtotTALK_M = round($TOTtotTALK_M, 2);
+	$TOTtotTALK_M_int = intval("$TOTtotTALK_M");
+	$TOTtotTALK_S = ($TOTtotTALK_M - $TOTtotTALK_M_int);
+	$TOTtotTALK_S = ($TOTtotTALK_S * 60);
+	$TOTtotTALK_S = round($TOTtotTALK_S, 0);
+	if ($TOTtotTALK_S < 10) {$TOTtotTALK_S = "0$TOTtotTALK_S";}
+	$TOTtotTALK_MS = "$TOTtotTALK_M_int:$TOTtotTALK_S";
+	$TOTtotTALK_MS =		sprintf("%8s", $TOTtotTALK_MS);
+		while(strlen($TOTtotTALK_MS)>8) {$TOTtotTALK_MS = substr("$TOTtotTALK_MS", 0, -1);}
+
+	$TOTtotDISPO_M = ($TOTtotDISPO / 60);
+	$TOTtotDISPO_M = round($TOTtotDISPO_M, 2);
+	$TOTtotDISPO_M_int = intval("$TOTtotDISPO_M");
+	$TOTtotDISPO_S = ($TOTtotDISPO_M - $TOTtotDISPO_M_int);
+	$TOTtotDISPO_S = ($TOTtotDISPO_S * 60);
+	$TOTtotDISPO_S = round($TOTtotDISPO_S, 0);
+	if ($TOTtotDISPO_S < 10) {$TOTtotDISPO_S = "0$TOTtotDISPO_S";}
+	$TOTtotDISPO_MS = "$TOTtotDISPO_M_int:$TOTtotDISPO_S";
+	$TOTtotDISPO_MS =		sprintf("%8s", $TOTtotDISPO_MS);
+		while(strlen($TOTtotDISPO_MS)>8) {$TOTtotDISPO_MS = substr("$TOTtotDISPO_MS", 0, -1);}
+
+	$TOTtotPAUSE_M = ($TOTtotPAUSE / 60);
+	$TOTtotPAUSE_M = round($TOTtotPAUSE_M, 2);
+	$TOTtotPAUSE_M_int = intval("$TOTtotPAUSE_M");
+	$TOTtotPAUSE_S = ($TOTtotPAUSE_M - $TOTtotPAUSE_M_int);
+	$TOTtotPAUSE_S = ($TOTtotPAUSE_S * 60);
+	$TOTtotPAUSE_S = round($TOTtotPAUSE_S, 0);
+	if ($TOTtotPAUSE_S < 10) {$TOTtotPAUSE_S = "0$TOTtotPAUSE_S";}
+	$TOTtotPAUSE_MS = "$TOTtotPAUSE_M_int:$TOTtotPAUSE_S";
+	$TOTtotPAUSE_MS =		sprintf("%8s", $TOTtotPAUSE_MS);
+		while(strlen($TOTtotPAUSE_MS)>8) {$TOTtotPAUSE_MS = substr("$TOTtotPAUSE_MS", 0, -1);}
+
+	$TOTtotWAIT_M = ($TOTtotWAIT / 60);
+	$TOTtotWAIT_M = round($TOTtotWAIT_M, 2);
+	$TOTtotWAIT_M_int = intval("$TOTtotWAIT_M");
+	$TOTtotWAIT_S = ($TOTtotWAIT_M - $TOTtotWAIT_M_int);
+	$TOTtotWAIT_S = ($TOTtotWAIT_S * 60);
+	$TOTtotWAIT_S = round($TOTtotWAIT_S, 0);
+	if ($TOTtotWAIT_S < 10) {$TOTtotWAIT_S = "0$TOTtotWAIT_S";}
+	$TOTtotWAIT_MS = "$TOTtotWAIT_M_int:$TOTtotWAIT_S";
+	$TOTtotWAIT_MS =		sprintf("%8s", $TOTtotWAIT_MS);
+		while(strlen($TOTtotWAIT_MS)>8) {$TOTtotWAIT_MS = substr("$TOTtotWAIT_MS", 0, -1);}
+
+
+	$TOTavgTALK_M = ( ($TOTtotTALK / $TOTcalls) / 60);
+	$TOTavgTALK_M = round($TOTavgTALK_M, 2);
+	$TOTavgTALK_M_int = intval("$TOTavgTALK_M");
+	$TOTavgTALK_S = ($TOTavgTALK_M - $TOTavgTALK_M_int);
+	$TOTavgTALK_S = ($TOTavgTALK_S * 60);
+	$TOTavgTALK_S = round($TOTavgTALK_S, 0);
+	if ($TOTavgTALK_S < 10) {$TOTavgTALK_S = "0$TOTavgTALK_S";}
+	$TOTavgTALK_MS = "$TOTavgTALK_M_int:$TOTavgTALK_S";
+	$TOTavgTALK_MS =		sprintf("%6s", $TOTavgTALK_MS);
+		while(strlen($TOTavgTALK_MS)>6) {$TOTavgTALK_MS = substr("$TOTavgTALK_MS", 0, -1);}
+
+	$TOTavgDISPO_M = ( ($TOTtotDISPO / $TOTcalls) / 60);
+	$TOTavgDISPO_M = round($TOTavgDISPO_M, 2);
+	$TOTavgDISPO_M_int = intval("$TOTavgDISPO_M");
+	$TOTavgDISPO_S = ($TOTavgDISPO_M - $TOTavgDISPO_M_int);
+	$TOTavgDISPO_S = ($TOTavgDISPO_S * 60);
+	$TOTavgDISPO_S = round($TOTavgDISPO_S, 0);
+	if ($TOTavgDISPO_S < 10) {$TOTavgDISPO_S = "0$TOTavgDISPO_S";}
+	$TOTavgDISPO_MS = "$TOTavgDISPO_M_int:$TOTavgDISPO_S";
+	$TOTavgDISPO_MS =		sprintf("%6s", $TOTavgDISPO_MS);
+		while(strlen($TOTavgDISPO_MS)>6) {$TOTavgDISPO_MS = substr("$TOTavgDISPO_MS", 0, -1);}
+
+	$TOTavgPAUSE_M = ( ($TOTtotPAUSE / $TOTcalls) / 60);
+	$TOTavgPAUSE_M = round($TOTavgPAUSE_M, 2);
+	$TOTavgPAUSE_M_int = intval("$TOTavgPAUSE_M");
+	$TOTavgPAUSE_S = ($TOTavgPAUSE_M - $TOTavgPAUSE_M_int);
+	$TOTavgPAUSE_S = ($TOTavgPAUSE_S * 60);
+	$TOTavgPAUSE_S = round($TOTavgPAUSE_S, 0);
+	if ($TOTavgPAUSE_S < 10) {$TOTavgPAUSE_S = "0$TOTavgPAUSE_S";}
+	$TOTavgPAUSE_MS = "$TOTavgPAUSE_M_int:$TOTavgPAUSE_S";
+	$TOTavgPAUSE_MS =		sprintf("%6s", $TOTavgPAUSE_MS);
+		while(strlen($TOTavgPAUSE_MS)>6) {$TOTavgPAUSE_MS = substr("$TOTavgPAUSE_MS", 0, -1);}
+
+	$TOTavgWAIT_M = ( ($TOTtotWAIT / $TOTcalls) / 60);
+	$TOTavgWAIT_M = round($TOTavgWAIT_M, 2);
+	$TOTavgWAIT_M_int = intval("$TOTavgWAIT_M");
+	$TOTavgWAIT_S = ($TOTavgWAIT_M - $TOTavgWAIT_M_int);
+	$TOTavgWAIT_S = ($TOTavgWAIT_S * 60);
+	$TOTavgWAIT_S = round($TOTavgWAIT_S, 0);
+	if ($TOTavgWAIT_S < 10) {$TOTavgWAIT_S = "0$TOTavgWAIT_S";}
+	$TOTavgWAIT_MS = "$TOTavgWAIT_M_int:$TOTavgWAIT_S";
+	$TOTavgWAIT_MS =		sprintf("%6s", $TOTavgWAIT_MS);
+		while(strlen($TOTavgWAIT_MS)>6) {$TOTavgWAIT_MS = substr("$TOTavgWAIT_MS", 0, -1);}
+
+
+echo "+-----------------+----------+--------+---------+--------+--------+--------+--------+--------+--------+--------+--------+$statusesHEAD\n";
+echo "|  TOTALS        AGENTS:$TOT_AGENTS | $TOTcalls| $TOTtime_MS|$TOTtotPAUSE_MS| $TOTavgPAUSE_MS |$TOTtotWAIT_MS| $TOTavgWAIT_MS |$TOTtotTALK_MS| $TOTavgTALK_MS |$TOTtotDISPO_MS| $TOTavgDISPO_MS |$SUMstatusesHTML\n";
+echo "+----------------------------+--------+---------+--------+--------+--------+--------+--------+--------+--------+--------+$statusesHEAD\n";
+
+echo "\n";
+
+}
+
+
+?>
+
+
\ No newline at end of file
diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_agent_time_sheet.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_agent_time_sheet.php
new file mode 100644
index 00000000..bd562a7b
--- /dev/null
+++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_agent_time_sheet.php
@@ -0,0 +1,286 @@
+    LICENSE: GPLv2
+###
+# CHANGES
+#
+# 60619-1729 - Added variable filtering to eliminate SQL injection attack threat
+#            - Added required user/pass to gain access to this page
+#
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+if (isset($_GET["agent"]))				{$agent=$_GET["agent"];}
+	elseif (isset($_POST["agent"]))		{$agent=$_POST["agent"];}
+if (isset($_GET["query_date"]))				{$query_date=$_GET["query_date"];}
+	elseif (isset($_POST["query_date"]))		{$query_date=$_POST["query_date"];}
+if (isset($_GET["calls_summary"]))				{$calls_summary=$_GET["calls_summary"];}
+	elseif (isset($_POST["calls_summary"]))		{$calls_summary=$_POST["calls_summary"];}
+if (isset($_GET["submit"]))				{$submit=$_GET["submit"];}
+	elseif (isset($_POST["submit"]))		{$submit=$_POST["submit"];}
+if (isset($_GET["SUBMIT"]))				{$SUBMIT=$_GET["SUBMIT"];}
+	elseif (isset($_POST["SUBMIT"]))		{$SUBMIT=$_POST["SUBMIT"];}
+
+$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
+$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
+
+	$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
+	if ($DB) {echo "|$stmt|\n";}
+	$rslt=mysql_query($stmt, $link);
+	$row=mysql_fetch_row($rslt);
+	$auth=$row[0];
+
+  if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
+	{
+    Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
+    Header("HTTP/1.0 401 Unauthorized");
+    echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
+    exit;
+	}
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!isset($query_date)) {$query_date = $NOW_DATE;}
+
+?>
+
+
+
+
+
+\n";
+echo "VICIDIAL: Agent Time Sheet\n";
+echo "VICIDIAL ADMIN: Agent Time Sheet\n";
+echo " - User Stats\n";
+echo " - User Status\n";
+echo " - Modify User\n";
+echo "
\n"; +echo "
  \n"; +echo "Date: \n"; +echo "User ID: \n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n";
+
+
+if (!$agent)
+{
+echo "\n";
+echo "PLEASE SELECT AN AGENT ID AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
+echo " NOTE: stats taken from available agent log data\n";
+}
+
+else
+{
+$query_date_BEGIN = "$query_date 00:00:00";   
+$query_date_END = "$query_date 23:59:59";
+$time_BEGIN = "00:00:00";   
+$time_END = "23:59:59";
+
+$stmt="select full_name from vicidial_users where user='$agent';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$full_name = $row[0];
+
+echo "VICIDIAL: Agent Time Sheet                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENT TIME SHEET: $agent - $full_name -------------\n\n";
+
+if ($calls_summary)
+	{
+	$stmt="select count(*) as calls,sum(talk_sec) as talk,avg(talk_sec),sum(pause_sec),avg(pause_sec),sum(wait_sec),avg(wait_sec),sum(dispo_sec),avg(dispo_sec) from vicidial_agent_log where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' and pause_sec<48800 and wait_sec<48800 and talk_sec<48800 and dispo_sec<48800 limit 1;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+
+	$TOTAL_TIME = ($row[1] + $row[3] + $row[5] + $row[7]);
+
+		$TOTAL_TIME_H = ($TOTAL_TIME / 3600);
+		$TOTAL_TIME_H = round($TOTAL_TIME_H, 2);
+		$TOTAL_TIME_H_int = intval("$TOTAL_TIME_H");
+		$TOTAL_TIME_M = ($TOTAL_TIME_H - $TOTAL_TIME_H_int);
+		$TOTAL_TIME_M = ($TOTAL_TIME_M * 60);
+		$TOTAL_TIME_M = round($TOTAL_TIME_M, 2);
+		$TOTAL_TIME_M_int = intval("$TOTAL_TIME_M");
+		$TOTAL_TIME_S = ($TOTAL_TIME_M - $TOTAL_TIME_M_int);
+		$TOTAL_TIME_S = ($TOTAL_TIME_S * 60);
+		$TOTAL_TIME_S = round($TOTAL_TIME_S, 0);
+		if ($TOTAL_TIME_S < 10) {$TOTAL_TIME_S = "0$TOTAL_TIME_S";}
+		if ($TOTAL_TIME_M_int < 10) {$TOTAL_TIME_M_int = "0$TOTAL_TIME_M_int";}
+		$TOTAL_TIME_HMS = "$TOTAL_TIME_H_int:$TOTAL_TIME_M_int:$TOTAL_TIME_S";
+		$pfTOTAL_TIME_HMS =		sprintf("%8s", $TOTAL_TIME_HMS);
+
+		$TALK_TIME_H = ($row[1] / 3600);
+		$TALK_TIME_H = round($TALK_TIME_H, 2);
+		$TALK_TIME_H_int = intval("$TALK_TIME_H");
+		$TALK_TIME_M = ($TALK_TIME_H - $TALK_TIME_H_int);
+		$TALK_TIME_M = ($TALK_TIME_M * 60);
+		$TALK_TIME_M = round($TALK_TIME_M, 2);
+		$TALK_TIME_M_int = intval("$TALK_TIME_M");
+		$TALK_TIME_S = ($TALK_TIME_M - $TALK_TIME_M_int);
+		$TALK_TIME_S = ($TALK_TIME_S * 60);
+		$TALK_TIME_S = round($TALK_TIME_S, 0);
+		if ($TALK_TIME_S < 10) {$TALK_TIME_S = "0$TALK_TIME_S";}
+		if ($TALK_TIME_M_int < 10) {$TALK_TIME_M_int = "0$TALK_TIME_M_int";}
+		$TALK_TIME_HMS = "$TALK_TIME_H_int:$TALK_TIME_M_int:$TALK_TIME_S";
+		$pfTALK_TIME_HMS =		sprintf("%8s", $TALK_TIME_HMS);
+
+		$PAUSE_TIME_H = ($row[3] / 3600);
+		$PAUSE_TIME_H = round($PAUSE_TIME_H, 2);
+		$PAUSE_TIME_H_int = intval("$PAUSE_TIME_H");
+		$PAUSE_TIME_M = ($PAUSE_TIME_H - $PAUSE_TIME_H_int);
+		$PAUSE_TIME_M = ($PAUSE_TIME_M * 60);
+		$PAUSE_TIME_M = round($PAUSE_TIME_M, 2);
+		$PAUSE_TIME_M_int = intval("$PAUSE_TIME_M");
+		$PAUSE_TIME_S = ($PAUSE_TIME_M - $PAUSE_TIME_M_int);
+		$PAUSE_TIME_S = ($PAUSE_TIME_S * 60);
+		$PAUSE_TIME_S = round($PAUSE_TIME_S, 0);
+		if ($PAUSE_TIME_S < 10) {$PAUSE_TIME_S = "0$PAUSE_TIME_S";}
+		if ($PAUSE_TIME_M_int < 10) {$PAUSE_TIME_M_int = "0$PAUSE_TIME_M_int";}
+		$PAUSE_TIME_HMS = "$PAUSE_TIME_H_int:$PAUSE_TIME_M_int:$PAUSE_TIME_S";
+		$pfPAUSE_TIME_HMS =		sprintf("%8s", $PAUSE_TIME_HMS);
+
+		$WAIT_TIME_H = ($row[5] / 3600);
+		$WAIT_TIME_H = round($WAIT_TIME_H, 2);
+		$WAIT_TIME_H_int = intval("$WAIT_TIME_H");
+		$WAIT_TIME_M = ($WAIT_TIME_H - $WAIT_TIME_H_int);
+		$WAIT_TIME_M = ($WAIT_TIME_M * 60);
+		$WAIT_TIME_M = round($WAIT_TIME_M, 2);
+		$WAIT_TIME_M_int = intval("$WAIT_TIME_M");
+		$WAIT_TIME_S = ($WAIT_TIME_M - $WAIT_TIME_M_int);
+		$WAIT_TIME_S = ($WAIT_TIME_S * 60);
+		$WAIT_TIME_S = round($WAIT_TIME_S, 0);
+		if ($WAIT_TIME_S < 10) {$WAIT_TIME_S = "0$WAIT_TIME_S";}
+		if ($WAIT_TIME_M_int < 10) {$WAIT_TIME_M_int = "0$WAIT_TIME_M_int";}
+		$WAIT_TIME_HMS = "$WAIT_TIME_H_int:$WAIT_TIME_M_int:$WAIT_TIME_S";
+		$pfWAIT_TIME_HMS =		sprintf("%8s", $WAIT_TIME_HMS);
+
+		$WRAPUP_TIME_H = ($row[7] / 3600);
+		$WRAPUP_TIME_H = round($WRAPUP_TIME_H, 2);
+		$WRAPUP_TIME_H_int = intval("$WRAPUP_TIME_H");
+		$WRAPUP_TIME_M = ($WRAPUP_TIME_H - $WRAPUP_TIME_H_int);
+		$WRAPUP_TIME_M = ($WRAPUP_TIME_M * 60);
+		$WRAPUP_TIME_M = round($WRAPUP_TIME_M, 2);
+		$WRAPUP_TIME_M_int = intval("$WRAPUP_TIME_M");
+		$WRAPUP_TIME_S = ($WRAPUP_TIME_M - $WRAPUP_TIME_M_int);
+		$WRAPUP_TIME_S = ($WRAPUP_TIME_S * 60);
+		$WRAPUP_TIME_S = round($WRAPUP_TIME_S, 0);
+		if ($WRAPUP_TIME_S < 10) {$WRAPUP_TIME_S = "0$WRAPUP_TIME_S";}
+		if ($WRAPUP_TIME_M_int < 10) {$WRAPUP_TIME_M_int = "0$WRAPUP_TIME_M_int";}
+		$WRAPUP_TIME_HMS = "$WRAPUP_TIME_H_int:$WRAPUP_TIME_M_int:$WRAPUP_TIME_S";
+		$pfWRAPUP_TIME_HMS =		sprintf("%8s", $WRAPUP_TIME_HMS);
+
+		$TALK_AVG_M = ($row[2] / 60);
+		$TALK_AVG_M = round($TALK_AVG_M, 2);
+		$TALK_AVG_M_int = intval("$TALK_AVG_M");
+		$TALK_AVG_S = ($TALK_AVG_M - $TALK_AVG_M_int);
+		$TALK_AVG_S = ($TALK_AVG_S * 60);
+		$TALK_AVG_S = round($TALK_AVG_S, 0);
+		if ($TALK_AVG_S < 10) {$TALK_AVG_S = "0$TALK_AVG_S";}
+		$TALK_AVG_MS = "$TALK_AVG_M_int:$TALK_AVG_S";
+		$pfTALK_AVG_MS =		sprintf("%6s", $TALK_AVG_MS);
+
+		$PAUSE_AVG_M = ($row[4] / 60);
+		$PAUSE_AVG_M = round($PAUSE_AVG_M, 2);
+		$PAUSE_AVG_M_int = intval("$PAUSE_AVG_M");
+		$PAUSE_AVG_S = ($PAUSE_AVG_M - $PAUSE_AVG_M_int);
+		$PAUSE_AVG_S = ($PAUSE_AVG_S * 60);
+		$PAUSE_AVG_S = round($PAUSE_AVG_S, 0);
+		if ($PAUSE_AVG_S < 10) {$PAUSE_AVG_S = "0$PAUSE_AVG_S";}
+		$PAUSE_AVG_MS = "$PAUSE_AVG_M_int:$PAUSE_AVG_S";
+		$pfPAUSE_AVG_MS =		sprintf("%6s", $PAUSE_AVG_MS);
+
+		$WAIT_AVG_M = ($row[6] / 60);
+		$WAIT_AVG_M = round($WAIT_AVG_M, 2);
+		$WAIT_AVG_M_int = intval("$WAIT_AVG_M");
+		$WAIT_AVG_S = ($WAIT_AVG_M - $WAIT_AVG_M_int);
+		$WAIT_AVG_S = ($WAIT_AVG_S * 60);
+		$WAIT_AVG_S = round($WAIT_AVG_S, 0);
+		if ($WAIT_AVG_S < 10) {$WAIT_AVG_S = "0$WAIT_AVG_S";}
+		$WAIT_AVG_MS = "$WAIT_AVG_M_int:$WAIT_AVG_S";
+		$pfWAIT_AVG_MS =		sprintf("%6s", $WAIT_AVG_MS);
+
+		$WRAPUP_AVG_M = ($row[8] / 60);
+		$WRAPUP_AVG_M = round($WRAPUP_AVG_M, 2);
+		$WRAPUP_AVG_M_int = intval("$WRAPUP_AVG_M");
+		$WRAPUP_AVG_S = ($WRAPUP_AVG_M - $WRAPUP_AVG_M_int);
+		$WRAPUP_AVG_S = ($WRAPUP_AVG_S * 60);
+		$WRAPUP_AVG_S = round($WRAPUP_AVG_S, 0);
+		if ($WRAPUP_AVG_S < 10) {$WRAPUP_AVG_S = "0$WRAPUP_AVG_S";}
+		$WRAPUP_AVG_MS = "$WRAPUP_AVG_M_int:$WRAPUP_AVG_S";
+		$pfWRAPUP_AVG_MS =		sprintf("%6s", $WRAPUP_AVG_MS);
+
+	echo "TOTAL CALLS TAKEN: $row[0]\n";
+	echo "TALK TIME:               $pfTALK_TIME_HMS     AVERAGE: $pfTALK_AVG_MS\n";
+	echo "PAUSE TIME:              $pfPAUSE_TIME_HMS     AVERAGE: $pfPAUSE_AVG_MS\n";
+	echo "WAIT TIME:               $pfWAIT_TIME_HMS     AVERAGE: $pfWAIT_AVG_MS\n";
+	echo "WRAPUP TIME:             $pfWRAPUP_TIME_HMS     AVERAGE: $pfWRAPUP_AVG_MS\n";
+	echo "----------------------------------------------------------------\n";
+	echo "TOTAL ACTIVE AGENT TIME: $pfTOTAL_TIME_HMS\n";
+
+	echo "\n";
+	}
+else
+	{
+	echo "Call Activity Summary\n\n";
+
+	}
+
+$stmt="select event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' order by event_time limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+echo "FIRST LOGIN:          $row[0]\n";
+$start = $row[1];
+
+$stmt="select event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' order by event_time desc limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+echo "LAST LOG ACTIVITY:    $row[0]\n";
+$end = $row[1];
+
+$login_time = ($end - $start);
+	$LOGIN_TIME_H = ($login_time / 3600);
+	$LOGIN_TIME_H = round($LOGIN_TIME_H, 2);
+	$LOGIN_TIME_H_int = intval("$LOGIN_TIME_H");
+	$LOGIN_TIME_M = ($LOGIN_TIME_H - $LOGIN_TIME_H_int);
+	$LOGIN_TIME_M = ($LOGIN_TIME_M * 60);
+	$LOGIN_TIME_M = round($LOGIN_TIME_M, 2);
+	$LOGIN_TIME_M_int = intval("$LOGIN_TIME_M");
+	$LOGIN_TIME_S = ($LOGIN_TIME_M - $LOGIN_TIME_M_int);
+	$LOGIN_TIME_S = ($LOGIN_TIME_S * 60);
+	$LOGIN_TIME_S = round($LOGIN_TIME_S, 0);
+	if ($LOGIN_TIME_S < 10) {$LOGIN_TIME_S = "0$LOGIN_TIME_S";}
+	if ($LOGIN_TIME_M_int < 10) {$LOGIN_TIME_M_int = "0$LOGIN_TIME_M_int";}
+	$LOGIN_TIME_HMS = "$LOGIN_TIME_H_int:$LOGIN_TIME_M_int:$LOGIN_TIME_S";
+	$pfLOGIN_TIME_HMS =		sprintf("%8s", $LOGIN_TIME_HMS);
+
+echo "-----------------------------------------\n";
+echo "TOTAL LOGGED-IN TIME:    $pfLOGIN_TIME_HMS\n";
+
+}
+
+
+
+?>
+
+
\ No newline at end of file
diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_agent_time_sheet_archive.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_agent_time_sheet_archive.php
new file mode 100644
index 00000000..fb71d1d6
--- /dev/null
+++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_agent_time_sheet_archive.php
@@ -0,0 +1,286 @@
+    LICENSE: GPLv2
+###
+# CHANGES
+#
+# 60619-1721 - Added variable filtering to eliminate SQL injection attack threat
+#            - Added required user/pass to gain access to this page
+#
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+if (isset($_GET["agent"]))				{$agent=$_GET["agent"];}
+	elseif (isset($_POST["agent"]))		{$agent=$_POST["agent"];}
+if (isset($_GET["query_date"]))				{$query_date=$_GET["query_date"];}
+	elseif (isset($_POST["query_date"]))		{$query_date=$_POST["query_date"];}
+if (isset($_GET["calls_summary"]))				{$calls_summary=$_GET["calls_summary"];}
+	elseif (isset($_POST["calls_summary"]))		{$calls_summary=$_POST["calls_summary"];}
+if (isset($_GET["submit"]))				{$submit=$_GET["submit"];}
+	elseif (isset($_POST["submit"]))		{$submit=$_POST["submit"];}
+if (isset($_GET["SUBMIT"]))				{$SUBMIT=$_GET["SUBMIT"];}
+	elseif (isset($_POST["SUBMIT"]))		{$SUBMIT=$_POST["SUBMIT"];}
+
+$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
+$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
+
+	$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
+	if ($DB) {echo "|$stmt|\n";}
+	$rslt=mysql_query($stmt, $link);
+	$row=mysql_fetch_row($rslt);
+	$auth=$row[0];
+
+  if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
+	{
+    Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
+    Header("HTTP/1.0 401 Unauthorized");
+    echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
+    exit;
+	}
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!isset($query_date)) {$query_date = $NOW_DATE;}
+
+?>
+
+
+
+
+
+\n";
+echo "VICIDIAL: Agent Time Sheet\n";
+echo "VICIDIAL ADMIN: Agent Time Sheet\n";
+echo " - User Stats\n";
+echo " - User Status\n";
+echo " - Modify User\n";
+echo "
\n"; +echo "
  \n"; +echo "Date: \n"; +echo "User ID: \n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n";
+
+
+if (!$agent)
+{
+echo "\n";
+echo "PLEASE SELECT AN AGENT ID AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
+echo " NOTE: stats taken from available agent log data\n";
+}
+
+else
+{
+$query_date_BEGIN = "$query_date 00:00:00";   
+$query_date_END = "$query_date 23:59:59";
+$time_BEGIN = "00:00:00";   
+$time_END = "23:59:59";
+
+$stmt="select full_name from vicidial_users where user='$agent';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$full_name = $row[0];
+
+echo "VICIDIAL: Agent Time Sheet                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENT TIME SHEET: $agent - $full_name -------------\n\n";
+
+if ($calls_summary)
+	{
+	$stmt="select count(*) as calls,sum(talk_sec) as talk,avg(talk_sec),sum(pause_sec),avg(pause_sec),sum(wait_sec),avg(wait_sec),sum(dispo_sec),avg(dispo_sec) from vicidial_agent_log_archive where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' and pause_sec<48800 and wait_sec<48800 and talk_sec<48800 and dispo_sec<48800 limit 1;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+
+	$TOTAL_TIME = ($row[1] + $row[3] + $row[5] + $row[7]);
+
+		$TOTAL_TIME_H = ($TOTAL_TIME / 3600);
+		$TOTAL_TIME_H = round($TOTAL_TIME_H, 2);
+		$TOTAL_TIME_H_int = intval("$TOTAL_TIME_H");
+		$TOTAL_TIME_M = ($TOTAL_TIME_H - $TOTAL_TIME_H_int);
+		$TOTAL_TIME_M = ($TOTAL_TIME_M * 60);
+		$TOTAL_TIME_M = round($TOTAL_TIME_M, 2);
+		$TOTAL_TIME_M_int = intval("$TOTAL_TIME_M");
+		$TOTAL_TIME_S = ($TOTAL_TIME_M - $TOTAL_TIME_M_int);
+		$TOTAL_TIME_S = ($TOTAL_TIME_S * 60);
+		$TOTAL_TIME_S = round($TOTAL_TIME_S, 0);
+		if ($TOTAL_TIME_S < 10) {$TOTAL_TIME_S = "0$TOTAL_TIME_S";}
+		if ($TOTAL_TIME_M_int < 10) {$TOTAL_TIME_M_int = "0$TOTAL_TIME_M_int";}
+		$TOTAL_TIME_HMS = "$TOTAL_TIME_H_int:$TOTAL_TIME_M_int:$TOTAL_TIME_S";
+		$pfTOTAL_TIME_HMS =		sprintf("%8s", $TOTAL_TIME_HMS);
+
+		$TALK_TIME_H = ($row[1] / 3600);
+		$TALK_TIME_H = round($TALK_TIME_H, 2);
+		$TALK_TIME_H_int = intval("$TALK_TIME_H");
+		$TALK_TIME_M = ($TALK_TIME_H - $TALK_TIME_H_int);
+		$TALK_TIME_M = ($TALK_TIME_M * 60);
+		$TALK_TIME_M = round($TALK_TIME_M, 2);
+		$TALK_TIME_M_int = intval("$TALK_TIME_M");
+		$TALK_TIME_S = ($TALK_TIME_M - $TALK_TIME_M_int);
+		$TALK_TIME_S = ($TALK_TIME_S * 60);
+		$TALK_TIME_S = round($TALK_TIME_S, 0);
+		if ($TALK_TIME_S < 10) {$TALK_TIME_S = "0$TALK_TIME_S";}
+		if ($TALK_TIME_M_int < 10) {$TALK_TIME_M_int = "0$TALK_TIME_M_int";}
+		$TALK_TIME_HMS = "$TALK_TIME_H_int:$TALK_TIME_M_int:$TALK_TIME_S";
+		$pfTALK_TIME_HMS =		sprintf("%8s", $TALK_TIME_HMS);
+
+		$PAUSE_TIME_H = ($row[3] / 3600);
+		$PAUSE_TIME_H = round($PAUSE_TIME_H, 2);
+		$PAUSE_TIME_H_int = intval("$PAUSE_TIME_H");
+		$PAUSE_TIME_M = ($PAUSE_TIME_H - $PAUSE_TIME_H_int);
+		$PAUSE_TIME_M = ($PAUSE_TIME_M * 60);
+		$PAUSE_TIME_M = round($PAUSE_TIME_M, 2);
+		$PAUSE_TIME_M_int = intval("$PAUSE_TIME_M");
+		$PAUSE_TIME_S = ($PAUSE_TIME_M - $PAUSE_TIME_M_int);
+		$PAUSE_TIME_S = ($PAUSE_TIME_S * 60);
+		$PAUSE_TIME_S = round($PAUSE_TIME_S, 0);
+		if ($PAUSE_TIME_S < 10) {$PAUSE_TIME_S = "0$PAUSE_TIME_S";}
+		if ($PAUSE_TIME_M_int < 10) {$PAUSE_TIME_M_int = "0$PAUSE_TIME_M_int";}
+		$PAUSE_TIME_HMS = "$PAUSE_TIME_H_int:$PAUSE_TIME_M_int:$PAUSE_TIME_S";
+		$pfPAUSE_TIME_HMS =		sprintf("%8s", $PAUSE_TIME_HMS);
+
+		$WAIT_TIME_H = ($row[5] / 3600);
+		$WAIT_TIME_H = round($WAIT_TIME_H, 2);
+		$WAIT_TIME_H_int = intval("$WAIT_TIME_H");
+		$WAIT_TIME_M = ($WAIT_TIME_H - $WAIT_TIME_H_int);
+		$WAIT_TIME_M = ($WAIT_TIME_M * 60);
+		$WAIT_TIME_M = round($WAIT_TIME_M, 2);
+		$WAIT_TIME_M_int = intval("$WAIT_TIME_M");
+		$WAIT_TIME_S = ($WAIT_TIME_M - $WAIT_TIME_M_int);
+		$WAIT_TIME_S = ($WAIT_TIME_S * 60);
+		$WAIT_TIME_S = round($WAIT_TIME_S, 0);
+		if ($WAIT_TIME_S < 10) {$WAIT_TIME_S = "0$WAIT_TIME_S";}
+		if ($WAIT_TIME_M_int < 10) {$WAIT_TIME_M_int = "0$WAIT_TIME_M_int";}
+		$WAIT_TIME_HMS = "$WAIT_TIME_H_int:$WAIT_TIME_M_int:$WAIT_TIME_S";
+		$pfWAIT_TIME_HMS =		sprintf("%8s", $WAIT_TIME_HMS);
+
+		$WRAPUP_TIME_H = ($row[7] / 3600);
+		$WRAPUP_TIME_H = round($WRAPUP_TIME_H, 2);
+		$WRAPUP_TIME_H_int = intval("$WRAPUP_TIME_H");
+		$WRAPUP_TIME_M = ($WRAPUP_TIME_H - $WRAPUP_TIME_H_int);
+		$WRAPUP_TIME_M = ($WRAPUP_TIME_M * 60);
+		$WRAPUP_TIME_M = round($WRAPUP_TIME_M, 2);
+		$WRAPUP_TIME_M_int = intval("$WRAPUP_TIME_M");
+		$WRAPUP_TIME_S = ($WRAPUP_TIME_M - $WRAPUP_TIME_M_int);
+		$WRAPUP_TIME_S = ($WRAPUP_TIME_S * 60);
+		$WRAPUP_TIME_S = round($WRAPUP_TIME_S, 0);
+		if ($WRAPUP_TIME_S < 10) {$WRAPUP_TIME_S = "0$WRAPUP_TIME_S";}
+		if ($WRAPUP_TIME_M_int < 10) {$WRAPUP_TIME_M_int = "0$WRAPUP_TIME_M_int";}
+		$WRAPUP_TIME_HMS = "$WRAPUP_TIME_H_int:$WRAPUP_TIME_M_int:$WRAPUP_TIME_S";
+		$pfWRAPUP_TIME_HMS =		sprintf("%8s", $WRAPUP_TIME_HMS);
+
+		$TALK_AVG_M = ($row[2] / 60);
+		$TALK_AVG_M = round($TALK_AVG_M, 2);
+		$TALK_AVG_M_int = intval("$TALK_AVG_M");
+		$TALK_AVG_S = ($TALK_AVG_M - $TALK_AVG_M_int);
+		$TALK_AVG_S = ($TALK_AVG_S * 60);
+		$TALK_AVG_S = round($TALK_AVG_S, 0);
+		if ($TALK_AVG_S < 10) {$TALK_AVG_S = "0$TALK_AVG_S";}
+		$TALK_AVG_MS = "$TALK_AVG_M_int:$TALK_AVG_S";
+		$pfTALK_AVG_MS =		sprintf("%6s", $TALK_AVG_MS);
+
+		$PAUSE_AVG_M = ($row[4] / 60);
+		$PAUSE_AVG_M = round($PAUSE_AVG_M, 2);
+		$PAUSE_AVG_M_int = intval("$PAUSE_AVG_M");
+		$PAUSE_AVG_S = ($PAUSE_AVG_M - $PAUSE_AVG_M_int);
+		$PAUSE_AVG_S = ($PAUSE_AVG_S * 60);
+		$PAUSE_AVG_S = round($PAUSE_AVG_S, 0);
+		if ($PAUSE_AVG_S < 10) {$PAUSE_AVG_S = "0$PAUSE_AVG_S";}
+		$PAUSE_AVG_MS = "$PAUSE_AVG_M_int:$PAUSE_AVG_S";
+		$pfPAUSE_AVG_MS =		sprintf("%6s", $PAUSE_AVG_MS);
+
+		$WAIT_AVG_M = ($row[6] / 60);
+		$WAIT_AVG_M = round($WAIT_AVG_M, 2);
+		$WAIT_AVG_M_int = intval("$WAIT_AVG_M");
+		$WAIT_AVG_S = ($WAIT_AVG_M - $WAIT_AVG_M_int);
+		$WAIT_AVG_S = ($WAIT_AVG_S * 60);
+		$WAIT_AVG_S = round($WAIT_AVG_S, 0);
+		if ($WAIT_AVG_S < 10) {$WAIT_AVG_S = "0$WAIT_AVG_S";}
+		$WAIT_AVG_MS = "$WAIT_AVG_M_int:$WAIT_AVG_S";
+		$pfWAIT_AVG_MS =		sprintf("%6s", $WAIT_AVG_MS);
+
+		$WRAPUP_AVG_M = ($row[8] / 60);
+		$WRAPUP_AVG_M = round($WRAPUP_AVG_M, 2);
+		$WRAPUP_AVG_M_int = intval("$WRAPUP_AVG_M");
+		$WRAPUP_AVG_S = ($WRAPUP_AVG_M - $WRAPUP_AVG_M_int);
+		$WRAPUP_AVG_S = ($WRAPUP_AVG_S * 60);
+		$WRAPUP_AVG_S = round($WRAPUP_AVG_S, 0);
+		if ($WRAPUP_AVG_S < 10) {$WRAPUP_AVG_S = "0$WRAPUP_AVG_S";}
+		$WRAPUP_AVG_MS = "$WRAPUP_AVG_M_int:$WRAPUP_AVG_S";
+		$pfWRAPUP_AVG_MS =		sprintf("%6s", $WRAPUP_AVG_MS);
+
+	echo "TOTAL CALLS TAKEN: $row[0]\n";
+	echo "TALK TIME:               $pfTALK_TIME_HMS     AVERAGE: $pfTALK_AVG_MS\n";
+	echo "PAUSE TIME:              $pfPAUSE_TIME_HMS     AVERAGE: $pfPAUSE_AVG_MS\n";
+	echo "WAIT TIME:               $pfWAIT_TIME_HMS     AVERAGE: $pfWAIT_AVG_MS\n";
+	echo "WRAPUP TIME:             $pfWRAPUP_TIME_HMS     AVERAGE: $pfWRAPUP_AVG_MS\n";
+	echo "----------------------------------------------------------------\n";
+	echo "TOTAL ACTIVE AGENT TIME: $pfTOTAL_TIME_HMS\n";
+
+	echo "\n";
+	}
+else
+	{
+	echo "Call Activity Summary\n\n";
+
+	}
+
+$stmt="select event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log_archive where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' order by event_time limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+echo "FIRST LOGIN:          $row[0]\n";
+$start = $row[1];
+
+$stmt="select event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log_archive where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' order by event_time desc limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+echo "LAST LOG ACTIVITY:    $row[0]\n";
+$end = $row[1];
+
+$login_time = ($end - $start);
+	$LOGIN_TIME_H = ($login_time / 3600);
+	$LOGIN_TIME_H = round($LOGIN_TIME_H, 2);
+	$LOGIN_TIME_H_int = intval("$LOGIN_TIME_H");
+	$LOGIN_TIME_M = ($LOGIN_TIME_H - $LOGIN_TIME_H_int);
+	$LOGIN_TIME_M = ($LOGIN_TIME_M * 60);
+	$LOGIN_TIME_M = round($LOGIN_TIME_M, 2);
+	$LOGIN_TIME_M_int = intval("$LOGIN_TIME_M");
+	$LOGIN_TIME_S = ($LOGIN_TIME_M - $LOGIN_TIME_M_int);
+	$LOGIN_TIME_S = ($LOGIN_TIME_S * 60);
+	$LOGIN_TIME_S = round($LOGIN_TIME_S, 0);
+	if ($LOGIN_TIME_S < 10) {$LOGIN_TIME_S = "0$LOGIN_TIME_S";}
+	if ($LOGIN_TIME_M_int < 10) {$LOGIN_TIME_M_int = "0$LOGIN_TIME_M_int";}
+	$LOGIN_TIME_HMS = "$LOGIN_TIME_H_int:$LOGIN_TIME_M_int:$LOGIN_TIME_S";
+	$pfLOGIN_TIME_HMS =		sprintf("%8s", $LOGIN_TIME_HMS);
+
+echo "-----------------------------------------\n";
+echo "TOTAL LOGGED-IN TIME:    $pfLOGIN_TIME_HMS\n";
+
+}
+
+
+
+?>
+
+
\ No newline at end of file
diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_inboundEXTstats.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_inboundEXTstats.php
new file mode 100644
index 00000000..5bc24935
--- /dev/null
+++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_inboundEXTstats.php
@@ -0,0 +1,400 @@
+    LICENSE: GPLv2
+#
+# CHANGES
+# 60421-1450 - check GET/POST vars lines with isset to not trigger PHP NOTICES
+# 60620-1322 - Added variable filtering to eliminate SQL injection attack threat
+#            - Added required user/pass to gain access to this page
+#
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+if (isset($_GET["group"]))					{$group=$_GET["group"];}
+	elseif (isset($_POST["group"]))			{$group=$_POST["group"];}
+if (isset($_GET["query_date"]))				{$query_date=$_GET["query_date"];}
+	elseif (isset($_POST["query_date"]))	{$query_date=$_POST["query_date"];}
+if (isset($_GET["server_ip"]))				{$server_ip=$_GET["server_ip"];}
+	elseif (isset($_POST["server_ip"]))		{$server_ip=$_POST["server_ip"];}
+if (isset($_GET["submit"]))					{$submit=$_GET["submit"];}
+	elseif (isset($_POST["submit"]))		{$submit=$_POST["submit"];}
+if (isset($_GET["SUBMIT"]))					{$SUBMIT=$_GET["SUBMIT"];}
+	elseif (isset($_POST["SUBMIT"]))		{$SUBMIT=$_POST["SUBMIT"];}
+
+$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
+$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
+
+	$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
+	if ($DB) {echo "|$stmt|\n";}
+	$rslt=mysql_query($stmt, $link);
+	$row=mysql_fetch_row($rslt);
+	$auth=$row[0];
+
+  if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
+	{
+    Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
+    Header("HTTP/1.0 401 Unauthorized");
+    echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
+    exit;
+	}
+
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!isset($query_date)) {$query_date = $NOW_DATE;}
+if (!isset($server_ip)) {$server_ip = '10.10.11.20';}
+
+$stmt="select extension,full_number,inbound_name from inbound_numbers where server_ip='" . mysql_real_escape_string($server_ip) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$inbound_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $inbound_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$inbound[$i] =$row[0];
+	$fullnum[$i] =$row[1];
+	$inbname[$i] =$row[2];
+	$i++;
+	}
+?>
+
+
+
+
+
+\n";
+#echo"\n";
+echo "ASTERISK: Inbound Calls Stats\n";
+echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "PLEASE SELECT A NUMBER AND DATE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+
+
+echo "ASTERISK: Inbound Calls Stats                      $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$extenSQL = "and extension='" . mysql_real_escape_string($group) . "'";
+if (eregi("\*",$group))
+	{$extenSQL = "and extension LIKE \"%$group\"";}
+$stmt="select count(*),sum(length_in_sec) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " 00:00:01' and start_time <= '" . mysql_real_escape_string($query_date) . " 23:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Total Calls That came into this number:       $TOTALcalls\n";
+echo "Average Call Length(seconds) for all Calls:   $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(length_in_sec) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " 00:00:01' and start_time <= '" . mysql_real_escape_string($query_date) . " 23:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$DROPcalls =	sprintf("%10s", $row[0]);
+$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
+$DROPpercent = round($DROPpercent, 0);
+
+if ($row[0])
+	{
+	$average_hold_seconds = ($row[1] / $row[0]);
+	$average_hold_seconds = round($average_hold_seconds, 0);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+else {$DROPpercent=0;   $average_hold_seconds=0;}
+echo "Total DROP Calls:   (less than 10 seconds)    $DROPcalls  $DROPpercent%\n";
+echo "Average Call Length(seconds) for DROP Calls:  $average_hold_seconds\n";
+
+
+##############################
+#########  CALLS STATS
+
+echo "\n";
+echo "---------- CALL LISTINGS\n";
+echo "+----------------------+----------------------+--------+---------------------+\n";
+echo "| CALLERID             | CALLERIDNAME         | LENGTH | DATE TIME           |\n";
+echo "+----------------------+----------------------+--------+---------------------+\n";
+
+$stmt="select number_dialed,caller_code,length_in_sec,start_time from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " 00:00:01' and start_time <= '" . mysql_real_escape_string($query_date) . " 23:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$CID =			sprintf("%-20s", $row[0]);
+	$CIDname =		sprintf("%-20s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
+	$datetime =		sprintf("%-19s", $row[3]);
+	$USERavgTALK =	$row[2];
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $CID | $CIDname | $USERavgTALK_MS | $datetime |\n";
+
+	$i++;
+	}
+
+echo "+----------------------+----------------------+--------+---------------------+\n";
+
+##############################
+#########  TIME STATS
+
+if ($output == 'FULL')
+	{
+
+	echo "\n";
+	echo "---------- TIME STATS\n";
+
+	echo "\n";
+
+	$hi_hour_count=0;
+	$last_full_record=0;
+	$i=0;
+	$h=0;
+	while ($i <= 96)
+		{
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:00:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:14:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:00:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:14:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:15:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:29:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:15:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:29:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:30:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:44:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:30:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:44:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:45:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:45:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+		$h++;
+		}
+
+	$hour_multiplier = (100 / $hi_hour_count);
+	#$hour_multiplier = round($hour_multiplier, 0);
+
+	echo "\n";
+	echo "GRAPH IN 15 MINUTE INCREMENTS OF TOTAL CALLS\n";
+
+	$k=1;
+	$Mk=0;
+	$call_scale = '0';
+	while ($k <= 102) 
+		{
+		if ($Mk >= 5) 
+			{
+			$Mk=0;
+			$scale_num=($k / $hour_multiplier);
+			$scale_num = round($scale_num, 0);
+			$LENscale_num = (strlen($scale_num));
+			$k = ($k + $LENscale_num);
+			$call_scale .= "$scale_num";
+			}
+		else
+			{
+			$call_scale .= " ";
+			$k++;   $Mk++;
+			}
+		}
+
+
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+	#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+	echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+	$ZZ = '00';
+	$i=0;
+	$h=4;
+	$hour= -1;
+	$no_lines_yet=1;
+
+	while ($i <= 96)
+		{
+		$char_counter=0;
+		$time = '      ';
+		if ($h >= 4) 
+			{
+			$hour++;
+			$h=0;
+			if ($hour < 10) {$hour = "0$hour";}
+			$time = "+$hour$ZZ+";
+			}
+		if ($h == 1) {$time = "   15 ";}
+		if ($h == 2) {$time = "   30 ";}
+		if ($h == 3) {$time = "   45 ";}
+		$Ghour_count = $hour_count[$i];
+		if ($Ghour_count < 1) 
+			{
+			if ( ($no_lines_yet) or ($i > $last_full_record) )
+				{
+				$do_nothing=1;
+				}
+			else
+				{
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+				echo "|$time|";
+				$k=0;   while ($k <= 102) {echo " ";   $k++;}
+				echo "| $hour_count[$i] |\n";
+				}
+			}
+		else
+			{
+			$no_lines_yet=0;
+			$Xhour_count = ($Ghour_count * $hour_multiplier);
+			$Yhour_count = (99 - $Xhour_count);
+
+			$Gdrop_count = $drop_count[$i];
+			if ($Gdrop_count < 1) 
+				{
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+				echo "|$time|";
+				$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+				echo "*X";   $char_counter++;
+				$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+					while ($char_counter <= 101) {echo " ";   $char_counter++;}
+				echo "| 0     | $hour_count[$i] |\n";
+
+				}
+			else
+				{
+				$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+			#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+				$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+				$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+				echo "|$time|";
+				$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+				echo "D";   $char_counter++;
+				$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+				echo "X";   $char_counter++;
+				$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+					while ($char_counter <= 102) {echo " ";   $char_counter++;}
+				echo "| $drop_count[$i] | $hour_count[$i] |\n";
+				}
+			}
+		
+		
+		$i++;
+		$h++;
+		}
+
+
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+
+	}
+
+
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_inboundEXTstats_department.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_inboundEXTstats_department.php new file mode 100644 index 00000000..015f6820 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_inboundEXTstats_department.php @@ -0,0 +1,178 @@ + LICENSE: GPLv2 +# +# CHANGES +# 70201-1710 - First Build +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["end_query_date"])) {$end_query_date=$_GET["end_query_date"];} + elseif (isset($_POST["end_query_date"])) {$end_query_date=$_POST["end_query_date"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($query_date)) {$query_date = $NOW_DATE;} +if (!isset($end_query_date)) {$end_query_date = $NOW_DATE;} +if (!isset($server_ip)) {$server_ip = '10.10.11.20';} + +$stmt="select distinct department from inbound_numbers;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$dept_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $dept_to_print) + { + $row=mysql_fetch_row($rslt); + $dept[$i] =$row[0]; + $i++; + } + +?> + + + + + +\n"; +#echo"\n"; +echo "ASTERISK: Inbound Calls Stats - By Department\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "PLEASE SELECT A DEPARTMENT AND DATE RANGE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+$extSQL='';
+$stmt="select extension from inbound_numbers where department='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$inbound_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $inbound_to_print)
+	{
+	if (strlen($extSQL)> 1) {$extSQL .= ",";}
+	$row=mysql_fetch_row($rslt);
+	$extensions[$i] =$row[0];
+	$extSQL .= "'$extensions[$i]'";
+	$i++;
+	}
+
+echo "ASTERISK: Inbound Calls Stats For $group   from $query_date to $end_query_date\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+echo "\n";
+
+echo "+----------------------+------------+------------+\n";
+echo "| NUMBER               | CALLS      | AVG TIME   |\n";
+echo "+----------------------+------------+------------+\n";
+
+$k=0;
+while ($k < $inbound_to_print)
+	{
+	$stmt="select count(*),sum(length_in_sec) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " 00:00:01' and start_time <= '" . mysql_real_escape_string($end_query_date) . " 23:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' and extension='$extensions[$k]' ;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+
+	$extensions[$k] = sprintf("%20s", $extensions[$k]);
+	$TOTALcalls =	sprintf("%10s", $row[0]);
+	if ( ($row[0]<1) or ($row[1]<1) )
+		{
+		$average_hold_seconds = "         0";
+		}
+	else
+		{
+		$average_hold_seconds = ($row[1] / $row[0]);
+		$average_hold_seconds = round($average_hold_seconds, 0);
+		$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+		}
+
+	$calls = ($TOTALcalls + $calls);
+	$seconds = ($row[1] + $seconds);
+
+	echo "| $extensions[$k] | $TOTALcalls | $average_hold_seconds |\n";
+	$k++;
+	}
+
+$calls =	sprintf("%10s", $calls);
+$seconds = ($seconds / $calls);
+$seconds = round($seconds, 0);
+$seconds =	sprintf("%5s", $seconds);
+echo "+----------------------+------------+------------+\n";
+echo "| TOTALS               | $calls | AVG: $seconds |\n";
+echo "+----------------------+------------+------------+\n";
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_parkstats.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_parkstats.php new file mode 100644 index 00000000..13552c30 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_parkstats.php @@ -0,0 +1,396 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1717 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = '';} +if (!isset($query_date)) {$query_date = $NOW_DATE;} + +$stmt="select distinct channel_group from park_log;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: Park Stats\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "           MODIFY | REPORTS \n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "PLEASE SELECT A GROUP AND DATE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+
+
+echo "VICIDIAL: Park Stats                             $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*),sum(parked_sec) from park_log where parked_time >= '$query_date 00:00:01' and parked_time <= '$query_date 23:59:59' and status ='HUNGUP' and channel_group='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Total Calls taken in this Group:              $TOTALcalls\n";
+echo "Average Hold Time(seconds) for all Calls:     $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(parked_sec) from park_log where parked_time >= '$query_date 00:00:01' and parked_time <= '$query_date 23:59:59' and status ='HUNGUP' and channel_group='" . mysql_real_escape_string($group) . "' and (talked_sec < 5 or talked_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$DROPcalls =	sprintf("%10s", $row[0]);
+$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
+$DROPpercent = round($DROPpercent, 0);
+
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Total Dropped Calls:                          $DROPcalls  $DROPpercent%\n";
+echo "Average Hold Time(seconds) for Dropped Calls: $average_hold_seconds\n";
+
+
+##############################
+#########  USER STATS
+
+echo "\n";
+echo "---------- USER STATS\n";
+echo "+--------------------------+------------+--------+--------+\n";
+echo "| USER                     | CALLS      | TIME M | AVRG M |\n";
+echo "+--------------------------+------------+--------+--------+\n";
+
+$stmt="select park_log.user,full_name,count(*),sum(talked_sec),avg(talked_sec) from park_log,vicidial_users where parked_time >= '$query_date 00:00:01' and parked_time <= '$query_date 23:59:59' and status ='HUNGUP' and channel_group='" . mysql_real_escape_string($group) . "' and park_log.user is not null and talked_sec is not null and talked_sec > 4 and park_log.user=vicidial_users.user group by park_log.user;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$user =			sprintf("%-6s", $row[0]);
+	$full_name =	sprintf("%-15s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
+	$USERcalls =	sprintf("%10s", $row[2]);
+	$USERtotTALK =	$row[3];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$USERtotTALK_MS =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $user - $full_name | $USERcalls | $USERtotTALK_MS | $USERavgTALK_MS |\n";
+
+	$i++;
+	}
+
+echo "+--------------------------+------------+--------+--------+\n";
+
+##############################
+#########  TIME STATS
+
+echo "\n";
+echo "---------- TIME STATS\n";
+
+echo "\n";
+
+$hi_hour_count=0;
+$last_full_record=0;
+$i=0;
+$h=0;
+while ($i <= 96)
+	{
+	$stmt="select count(*) from park_log where parked_time >= '$query_date $h:00:00' and parked_time <= '$query_date $h:14:59' and status ='HUNGUP' and channel_group='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from park_log where parked_time >= '$query_date $h:00:00' and parked_time <= '$query_date $h:14:59' and status ='HUNGUP' and channel_group='" . mysql_real_escape_string($group) . "' and (talked_sec < 5 or talked_sec is null);";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+
+	$stmt="select count(*) from park_log where parked_time >= '$query_date $h:15:00' and parked_time <= '$query_date $h:29:59' and status ='HUNGUP' and channel_group='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from park_log where parked_time >= '$query_date $h:15:00' and parked_time <= '$query_date $h:29:59' and status ='HUNGUP' and channel_group='" . mysql_real_escape_string($group) . "' and (talked_sec < 5 or talked_sec is null);";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from park_log where parked_time >= '$query_date $h:30:00' and parked_time <= '$query_date $h:44:59' and status ='HUNGUP' and channel_group='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from park_log where parked_time >= '$query_date $h:30:00' and parked_time <= '$query_date $h:44:59' and status ='HUNGUP' and channel_group='" . mysql_real_escape_string($group) . "' and (talked_sec < 5 or talked_sec is null);";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from park_log where parked_time >= '$query_date $h:45:00' and parked_time <= '$query_date $h:59:59' and status ='HUNGUP' and channel_group='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from park_log where parked_time >= '$query_date $h:45:00' and parked_time <= '$query_date $h:59:59' and status ='HUNGUP' and channel_group='" . mysql_real_escape_string($group) . "' and (talked_sec < 5 or talked_sec is null);";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+	$h++;
+	}
+
+$hour_multiplier = (100 / $hi_hour_count);
+#$hour_multiplier = round($hour_multiplier, 0);
+
+echo "\n";
+echo "GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP\n";
+
+$k=1;
+$Mk=0;
+$call_scale = '0';
+while ($k <= 102) 
+	{
+	if ($Mk >= 5) 
+		{
+		$Mk=0;
+		$scale_num=($k / $hour_multiplier);
+		$scale_num = round($scale_num, 0);
+		$LENscale_num = (strlen($scale_num));
+		$k = ($k + $LENscale_num);
+		$call_scale .= "$scale_num";
+		}
+	else
+		{
+		$call_scale .= " ";
+		$k++;   $Mk++;
+		}
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+$ZZ = '00';
+$i=0;
+$h=4;
+$hour= -1;
+$no_lines_yet=1;
+
+while ($i <= 96)
+	{
+	$char_counter=0;
+	$time = '      ';
+	if ($h >= 4) 
+		{
+		$hour++;
+		$h=0;
+		if ($hour < 10) {$hour = "0$hour";}
+		$time = "+$hour$ZZ+";
+		}
+	if ($h == 1) {$time = "   15 ";}
+	if ($h == 2) {$time = "   30 ";}
+	if ($h == 3) {$time = "   45 ";}
+	$Ghour_count = $hour_count[$i];
+	if ($Ghour_count < 1) 
+		{
+		if ( ($no_lines_yet) or ($i > $last_full_record) )
+			{
+			$do_nothing=1;
+			}
+		else
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			echo "|$time|";
+			$k=0;   while ($k <= 102) {echo " ";   $k++;}
+			echo "| $hour_count[$i] |\n";
+			}
+		}
+	else
+		{
+		$no_lines_yet=0;
+		$Xhour_count = ($Ghour_count * $hour_multiplier);
+		$Yhour_count = (99 - $Xhour_count);
+
+		$Gdrop_count = $drop_count[$i];
+		if ($Gdrop_count < 1) 
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "*X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 101) {echo " ";   $char_counter++;}
+			echo "| 0     | $hour_count[$i] |\n";
+
+			}
+		else
+			{
+			$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+		#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+			$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+			echo "D";   $char_counter++;
+			$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 102) {echo " ";   $char_counter++;}
+			echo "| $drop_count[$i] | $hour_count[$i] |\n";
+			}
+		}
+	
+	
+	$i++;
+	$h++;
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+
+
+
+
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_server_performance.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_server_performance.php new file mode 100644 index 00000000..afa75bd3 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_server_performance.php @@ -0,0 +1,306 @@ + LICENSE: GPLv2 +# +# CHANGES +# +# 60619-1732 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 70417-1106 - Changed time frame to be definable per time range on a single day +# - Fixed vertical scaling issues +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["begin_query_time"])) {$begin_query_time=$_GET["begin_query_time"];} + elseif (isset($_POST["begin_query_time"])) {$begin_query_time=$_POST["begin_query_time"];} +if (isset($_GET["end_query_time"])) {$end_query_time=$_GET["end_query_time"];} + elseif (isset($_POST["end_query_time"])) {$end_query_time=$_POST["end_query_time"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and modify_servers='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +# path from root to where ploticus files will be stored +$PLOTroot = "vicidial/ploticus"; +$DOCroot = "$WeBServeRRooT/$PLOTroot/"; + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); + +if (!isset($query_date)) {$query_date = $NOW_DATE;} +if (!isset($begin_query_time)) {$begin_query_time = '09:00:00';} +if (!isset($end_query_time)) {$end_query_time = '15:30:00';} +if (!isset($group)) {$group = '';} + +$stmt="select server_ip from servers;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$servers_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $servers_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: Server Performance\n"; +echo "
\n"; +echo "Date:   \n"; +echo "Time: \n"; +echo "to \n"; +echo "Server: \n"; +echo "\n"; +echo "             REPORTS \n"; +echo "
\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A SERVER, DATE AND TIME RANGE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+
+$query_date_BEGIN = "$query_date $begin_query_time";   
+$query_date_END = "$query_date $end_query_time";
+$time_BEGIN = "$begin_query_time";   
+$time_END = "$end_query_time";
+
+echo "VICIDIAL: Server Performance                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- TOTALS, PEAKS and AVERAGES\n";
+
+$stmt="select AVG(sysload),AVG(channels_total),MAX(sysload),MAX(channels_total),MAX(processes) from server_performance where start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and server_ip='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$AVGload =	sprintf("%10s", $row[0]);
+$AVGchannels =	sprintf("%10s", $row[1]);
+$HIGHload =	$row[2];
+	$HIGHmulti = intval($HIGHload / 100);
+$HIGHchannels =	$row[3];
+$HIGHprocesses =$row[4];
+if ($row[2] > $row[3]) {$HIGHlimit = $row[2];}
+else {$HIGHlimit = $row[3];}
+if ($HIGHlimit < $row[4]) {$HIGHlimit = $row[4];}
+
+$stmt="select AVG(cpu_user_percent),AVG(cpu_system_percent),AVG(cpu_idle_percent) from server_performance where start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and server_ip='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$AVGcpuUSER =	sprintf("%10s", $row[0]);
+$AVGcpuSYSTEM =	sprintf("%10s", $row[1]);
+$AVGcpuIDLE =	sprintf("%10s", $row[2]);
+
+$stmt="select count(*),SUM(length_in_min) from call_log where extension NOT IN('8365','8366','8367') and  start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and server_ip='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$OFFHOOKtime =	sprintf("%10s", $row[1]);
+
+
+echo "Total Calls in/out on this server:        $TOTALcalls\n";
+echo "Total Off-Hook time on this server (min): $OFFHOOKtime\n";
+echo "Average/Peak channels in use for server:  $AVGchannels / $HIGHchannels\n";
+echo "Average/Peak load for server:             $AVGload / $HIGHload\n";
+echo "Average USER process cpu percentage:      $AVGcpuUSER %\n";
+echo "Average SYSTEM process cpu percentage:    $AVGcpuSYSTEM %\n";
+echo "Average IDLE process cpu percentage:      $AVGcpuIDLE %\n";
+
+echo "\n";
+echo "---------- LINE GRAPH:\n";
+
+
+
+##############################
+#########  Graph stats
+
+$DAT = '.dat';
+$HTM = '.htm';
+$PNG = '.png';
+$filedate = date("Y-m-d_His");
+$DATfile = "$group$query_date$shift$filedate$DAT";
+$HTMfile = "$group$query_date$shift$filedate$HTM";
+$PNGfile = "$group$query_date$shift$filedate$PNG";
+
+$HTMfp = fopen ("$DOCroot/$HTMfile", "a");
+$DATfp = fopen ("$DOCroot/$DATfile", "a");
+
+$stmt="select DATE_FORMAT(start_time,'%H:%i:%s') as timex,sysload,processes,channels_total,live_recordings,cpu_user_percent,cpu_system_percent from server_performance where server_ip='" . mysql_real_escape_string($group) . "' and start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' order by timex;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$row[5] = intval(($row[5] + $row[6]) * $HIGHmulti);
+	$row[6] = intval($row[6] * $HIGHmulti);
+	fwrite ($DATfp, "$row[5]\t$row[6]\t$row[0]\t$row[1]\t$row[2]\t$row[3]\n");
+	$i++;
+	}
+fclose($DATfp);
+
+$rows_to_max = ($rows_to_print + 100);
+
+#print "rows: $i\n";
+
+$time_scale_abb = '5 minutes';
+$time_scale_tick = '1 minute';
+if ($i > 1000) {$time_scale_abb = '10 minutes';   $time_scale_tick = '2 minutes';}
+if ($i > 2000) {$time_scale_abb = '20 minutes';   $time_scale_tick = '4 minutes';}
+if ($i > 3000) {$time_scale_abb = '30 minutes';   $time_scale_tick = '5 minutes';}
+if ($i > 4000) {$time_scale_abb = '40 minutes';   $time_scale_tick = '10 minutes';}
+if ($i > 5000) {$time_scale_abb = '60 minutes';   $time_scale_tick = '15 minutes';}
+if ($i > 6000) {$time_scale_abb = '90 minutes';   $time_scale_tick = '15 minutes';}
+if ($i > 7000) {$time_scale_abb = '120 minutes';   $time_scale_tick = '30 minutes';}
+
+$HTMcontent  = '';
+$HTMcontent .= "#proc page\n";
+$HTMcontent .= "#if @DEVICE in png,gif\n";
+$HTMcontent .= "   scale: 0.6\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#endif\n";
+$HTMcontent .= "#proc getdata\n";
+$HTMcontent .= "file: $DOCroot/$DATfile\n";
+$HTMcontent .= "fieldnames: userproc sysproc time load processes channels\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc areadef\n";
+$HTMcontent .= "title: Server $group   $query_date_BEGIN to $query_date_END\n";
+$HTMcontent .= "titledetails: size=14  align=C\n";
+$HTMcontent .= "rectangle: 1 1 14 7\n";
+$HTMcontent .= "xscaletype: time hh:mm:ss\n";
+$HTMcontent .= "xrange: $time_BEGIN $time_END\n";
+$HTMcontent .= "yrange: 0 $HIGHlimit\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc xaxis\n";
+$HTMcontent .= "stubs: inc $time_scale_abb\n";
+$HTMcontent .= "minorticinc: $time_scale_tick\n";
+$HTMcontent .= "stubformat: hh:mm:ssa\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc yaxis\n";
+$HTMcontent .= "stubs: inc 50\n";
+$HTMcontent .= "grid: color=yellow\n";
+$HTMcontent .= "gridskip: min\n";
+$HTMcontent .= "ticincrement: 100 1000\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc lineplot\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: userproc\n";
+$HTMcontent .= "linedetails: color=purple width=.5\n";
+$HTMcontent .= "fill: lavender\n";
+$HTMcontent .= "legendlabel: user proc%\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc lineplot\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: sysproc\n";
+$HTMcontent .= "linedetails: color=yelloworange width=.5\n";
+$HTMcontent .= "fill: dullyellow\n";
+$HTMcontent .= "legendlabel: system proc%\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: load\n";
+$HTMcontent .= "linedetails: color=blue width=.5\n";
+$HTMcontent .= "legendlabel: load\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: processes\n";
+$HTMcontent .= "linedetails: color=red width=.5\n";
+$HTMcontent .= "legendlabel: processes\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: channels\n";
+$HTMcontent .= "linedetails: color=green width=.5\n";
+$HTMcontent .= "legendlabel: channels\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc legend\n";
+$HTMcontent .= "location: max-2 max\n";
+$HTMcontent .= "seglen: 0.2\n";
+$HTMcontent .= "\n";
+
+fwrite ($HTMfp, "$HTMcontent");
+fclose($HTMfp);
+
+
+passthru("/usr/local/bin/pl -png $DOCroot/$HTMfile -o $DOCroot/$PNGfile");
+
+sleep(1);
+
+echo "
\n"; +echo "\n"; +echo "\n"; + + +echo ""; + +} + + + +?> + + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_timeonVDAD.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_timeonVDAD.php new file mode 100644 index 00000000..e9c8f52e --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_timeonVDAD.php @@ -0,0 +1,374 @@ + LICENSE: GPLv2 +### +# live real-time stats for the VICIDIAL Auto-Dialer +# +# CHANGES +# +# 60620-1037 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 61114-2004 - Changed to display CLOSER and DEFAULT, added trunk shortage +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["reset_counter"])) {$reset_counter=$_GET["reset_counter"];} + elseif (isset($_POST["reset_counter"])) {$reset_counter=$_POST["reset_counter"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["closer_display"])) {$closer_display=$_GET["closer_display"];} + elseif (isset($_POST["closer_display"])) {$closer_display=$_POST["closer_display"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +$epochSIXhoursAGO = ($STARTtime - 21600); +$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO); + +$reset_counter++; + +if ($reset_counter > 7) + { + $reset_counter=0; + + $stmt="update park_log set status='HUNGUP' where hangup_time is not null;"; +# $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + + if ($DB) + { + $stmt="delete from park_log where grab_time < '$timeSIXhoursAGO' and (hangup_time is null or hangup_time='');"; +# $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + } + } + +?> + + + +\n"; +echo " + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On VDAD\n"; +echo "
";
+
+###################################################################################
+###### SERVER INFORMATION
+###################################################################################
+
+$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where server_ip='" . mysql_real_escape_string($server_ip) . "';";
+$rslt=mysql_query($stmt, $link);
+$row=mysql_fetch_row($rslt);
+$balanceSHORT = $row[0];
+
+echo "SERVER: $server_ip\n";
+
+
+
+###################################################################################
+###### TIME ON SYSTEM
+###################################################################################
+
+if ($closer_display>0) {$closer_display_reverse=0;   $closer_reverse_link='DEFAULT';}
+else {$closer_display_reverse=1;   $closer_reverse_link='CLOSER';}
+
+echo "VICIDIAL: Agents Time On Calls           $NOW_TIME    $closer_reverse_link | REPORTS\n\n";
+
+if ($closer_display>0)
+{
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+echo "| STATION    | USER   | SESSIONID | CHANNEL             | STATUS | CALLTIME | MINUTES | CAMPAIGN     | FRONT  |\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+}
+else
+{
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+\n";
+echo "| STATION    | USER   | SESSIONID | CHANNEL             | STATUS | CALLTIME | MINUTES |\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+\n";
+}
+
+$stmt="select extension,user,conf_exten,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),uniqueid,lead_id from vicidial_live_agents where status NOT IN('PAUSED') and server_ip='" . mysql_real_escape_string($server_ip) . "' order by extension;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$talking_to_print = mysql_num_rows($rslt);
+	if ($talking_to_print > 0)
+	{
+	$i=0;
+	while ($i < $talking_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+			if (eregi("READY|PAUSED|CLOSER",$row[4]))
+			{
+			$row[3]='';
+			$row[5]='- WAIT -';
+			$row[6]=$row[7];
+			}
+		$extension[$i] = eregi_replace('Local/',"",$row[0]);
+		$extension[$i] =		sprintf("%-10s", $extension[$i]);
+			while(strlen($extension[$i])>10) {$extension[$i] = substr("$extension[$i]", 0, -1);}
+		$user[$i] =				sprintf("%-6s", $row[1]);
+		$sessionid[$i] =		sprintf("%-9s", $row[2]);
+		$channel[$i] =			sprintf("%-19s", $row[3]);
+			$cc[$i]=0;
+		while ( (strlen($channel[$i]) > 19) and ($cc[$i] < 100) )
+			{
+			$channel[$i] = eregi_replace(".$","",$channel[$i]);   
+			$cc[$i]++;
+			if (strlen($channel[$i]) <= 19) {$cc[$i]=101;}
+			}
+		$status[$i] =			sprintf("%-6s", $row[4]);
+		$start_time[$i] =		sprintf("%-8s", $row[5]);
+			$cd[$i]=0;
+		while ( (strlen($start_time[$i]) > 8) and ($cd[$i] < 100) )
+			{
+			$start_time[$i] = eregi_replace("^.","",$start_time[$i]);   
+			$cd[$i]++;
+			if (strlen($start_time[$i]) <= 8) {$cd[$i]=101;}
+			}
+		$uniqueid[$i] =			$row[8];
+		$lead_id[$i] =			$row[9];
+		$closer[$i] =			$row[1];
+		$call_time_S[$i] = ($STARTtime - $row[6]);
+
+		$call_time_M[$i] = ($call_time_S[$i] / 60);
+		$call_time_M[$i] = round($call_time_M[$i], 2);
+		$call_time_M_int[$i] = intval("$call_time_M[$i]");
+		$call_time_SEC[$i] = ($call_time_M[$i] - $call_time_M_int[$i]);
+		$call_time_SEC[$i] = ($call_time_SEC[$i] * 60);
+		$call_time_SEC[$i] = round($call_time_SEC[$i], 0);
+		if ($call_time_SEC[$i] < 10) {$call_time_SEC[$i] = "0$call_time_SEC[$i]";}
+		$call_time_MS[$i] = "$call_time_M_int[$i]:$call_time_SEC[$i]";
+		$call_time_MS[$i] =		sprintf("%7s", $call_time_MS[$i]);
+
+		if ($closer_display<1)
+			{
+			$G = '';		$EG = '';
+			if ($call_time_M_int[$i] >= 5) {$G=''; $EG='';}
+			if ($call_time_M_int[$i] >= 10) {$G=''; $EG='';}
+			if (eregi("PAUSED",$row[4])) 
+				{
+				if ($call_time_M_int >= 1) 
+					{$i++; continue;} 
+				else
+					{$G=''; $EG='';}
+				}
+			$agentcount++;
+			echo "| $G$extension[$i]$EG | $G$user[$i]$EG | $G$sessionid[$i]$EG | $G$channel[$i]$EG | $G$status[$i]$EG | $G$start_time[$i]$EG | $G$call_time_MS[$i]$EG |\n";
+			}
+		$i++;
+		}
+
+		if ($closer_display>0)
+		{
+
+			$ext_count = $i;
+			$i=0;
+		while ($i < $ext_count)
+			{
+
+			$stmt="select campaign_id from vicidial_auto_calls where lead_id='$lead_id[$i]' and server_ip='" . mysql_real_escape_string($server_ip) . "';";
+			$rslt=mysql_query($stmt, $link);
+			if ($DB) {echo "$stmt\n";}
+			$camp_to_print = mysql_num_rows($rslt);
+			if ($camp_to_print > 0)
+				{
+				$row=mysql_fetch_row($rslt);
+				$campaign = sprintf("%-12s", $row[0]);
+				$camp_color = $row[0];
+				}
+			else
+				{$campaign = 'DEAD        ';   	$camp_color = 'DEAD';}
+			if (eregi("READY|PAUSED|CLOSER",$status[$i]))
+				{$campaign = '            ';   	$camp_color = '';}
+
+			$stmt="select user from vicidial_xfer_log where lead_id='$lead_id[$i]' and closer='$closer[$i]' order by call_date desc limit 1;";
+			$rslt=mysql_query($stmt, $link);
+			if ($DB) {echo "$stmt\n";}
+			$xfer_to_print = mysql_num_rows($rslt);
+			if ($xfer_to_print > 0)
+				{
+				$row=mysql_fetch_row($rslt);
+				$fronter = sprintf("%-6s", $row[0]);
+				}
+			else
+				{$fronter = '      ';}
+
+			$G = '';		$EG = '';
+			$G=""; $EG='';
+		#	if ($call_time_M_int[$i] >= 5) {$G=''; $EG='';}
+		#	if ($call_time_M_int[$i] >= 10) {$G=''; $EG='';}
+
+			echo "| $G$extension[$i]$EG | $G$user[$i]$EG | $G$sessionid[$i]$EG | $G$channel[$i]$EG | $G$status[$i]$EG | $G$start_time[$i]$EG | $G$call_time_MS[$i]$EG | $G$campaign$EG | $G$fronter$EG |\n";
+
+			$i++;
+			}
+		echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+		echo "  $i agents logged in on server $server_ip\n\n";
+	#	echo "             - 5 minutes or more on call\n";
+	#	echo "             - Over 10 minutes on call\n";
+		}
+	else
+		{
+		echo "+------------|--------+-----------+---------------------+--------+----------+---------+\n";
+		echo "  $agentcount agents logged in on server $server_ip\n\n";
+
+		echo "             - Paused agents\n";
+		echo "             - 5 minutes or more on call\n";
+		echo "             - Over 10 minutes on call\n";
+		}
+
+	}
+	else
+	{
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	echo "********************************* NO AGENTS ON CALLS *********************************\n";
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	}
+
+
+###################################################################################
+###### OUTBOUND CALLS
+###################################################################################
+#echo "\n\n";
+echo "----------------------------------------------------------------------------------------";
+echo "\n\n";
+echo "VICIDIAL: Time On VDAD            TRUNK SHORT: $balanceSHORT              $NOW_TIME\n\n";
+echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+echo "| CHANNEL             | STATUS | CAMPAIGN     | PHONE NUMBER       | CALLTIME | MINUTES |\n";
+echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+
+$stmt="select channel,status,campaign_id,phone_code,phone_number,call_time,UNIX_TIMESTAMP(call_time) from vicidial_auto_calls where status NOT IN('XFER') and server_ip='" . mysql_real_escape_string($server_ip) . "' order by auto_call_id desc;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$parked_to_print = mysql_num_rows($rslt);
+	if ($parked_to_print > 0)
+	{
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$channel =			sprintf("%-19s", $row[0]);
+			$cc=0;
+		while ( (strlen($channel) > 19) and ($cc < 100) )
+			{
+			$channel = eregi_replace(".$","",$channel);   
+			$cc++;
+			if (strlen($channel) <= 19) {$cc=101;}
+			}
+		$start_time =		sprintf("%-8s", $row[5]);
+			$cd=0;
+		while ( (strlen($start_time) > 8) and ($cd < 100) )
+			{
+			$start_time = eregi_replace("^.","",$start_time);   
+			$cd++;
+			if (strlen($start_time) <= 8) {$cd=101;}
+			}
+		$status =			sprintf("%-6s", $row[1]);
+		$campaign =			sprintf("%-12s", $row[2]);
+			$all_phone = "$row[3]$row[4]";
+		$number_dialed =	sprintf("%-18s", $all_phone);
+		$call_time_S = ($STARTtime - $row[6]);
+
+		$call_time_M = ($call_time_S / 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";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if (eregi("LIVE",$status)) {$G=''; $EG='';}
+	#	if ($call_time_M_int >= 6) {$G=''; $EG='';}
+
+		echo "| $G$channel$EG | $G$status$EG | $G$campaign$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+		echo "  $i calls being placed on server $server_ip\n\n";
+
+		echo "             - LIVE CALL WAITING\n";
+	#	echo "             - Over 5 minutes on hold\n";
+
+		}
+	else
+	{
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	echo "******************************* NO LIVE CALLS WAITING *********************************\n";
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	}
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_timeonVDAD_closer.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_timeonVDAD_closer.php new file mode 100644 index 00000000..23eb851e --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_timeonVDAD_closer.php @@ -0,0 +1,318 @@ + LICENSE: GPLv2 +### +# live real-time stats for the VICIDIAL Auto-Dialer +# +# CHANGES +# +# 60620-1037 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["reset_counter"])) {$reset_counter=$_GET["reset_counter"];} + elseif (isset($_POST["reset_counter"])) {$reset_counter=$_POST["reset_counter"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +$epochSIXhoursAGO = ($STARTtime - 21600); +$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO); + +$reset_counter++; + +if ($reset_counter > 7) + { + $reset_counter=0; + + $stmt="update park_log set status='HUNGUP' where hangup_time is not null;"; +# $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + + if ($DB) + { + $stmt="delete from park_log where grab_time < '$timeSIXhoursAGO' and (hangup_time is null or hangup_time='');"; +# $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + } + } + +?> + + + +\n"; +echo " + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On VDAD\n"; +echo "
";
+
+###################################################################################
+###### TIME ON SYSTEM
+###################################################################################
+
+echo "VICIDIAL: Agents Time On Calls                         $NOW_TIME    REPORTS\n\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+echo "| STATION    | USER   | SESSIONID | CHANNEL             | STATUS | CALLTIME | MINUTES | CAMPAIGN     | FRONT  |\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+
+
+$stmt="select extension,user,conf_exten,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),uniqueid,lead_id from vicidial_live_agents where status NOT IN('PAUSED') and server_ip='" . mysql_real_escape_string($server_ip) . "' order by extension;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$talking_to_print = mysql_num_rows($rslt);
+	if ($talking_to_print > 0)
+	{
+	$i=0;
+	while ($i < $talking_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+			if (eregi("READY|PAUSED|CLOSER",$row[4]))
+			{
+			$row[3]='';
+			$row[5]='- WAIT -';
+			$row[6]=$row[7];
+			}
+		$extension[$i] = eregi_replace('Local/',"",$row[0]);
+		$extension[$i] =		sprintf("%-10s", $extension[$i]);
+			while(strlen($extension[$i])>10) {$extension[$i] = substr("$extension[$i]", 0, -1);}
+		$user[$i] =				sprintf("%-6s", $row[1]);
+		$sessionid[$i] =		sprintf("%-9s", $row[2]);
+		$channel[$i] =			sprintf("%-19s", $row[3]);
+			$cc[$i]=0;
+		while ( (strlen($channel[$i]) > 19) and ($cc[$i] < 100) )
+			{
+			$channel[$i] = eregi_replace(".$","",$channel[$i]);   
+			$cc[$i]++;
+			if (strlen($channel[$i]) <= 19) {$cc[$i]=101;}
+			}
+		$status[$i] =			sprintf("%-6s", $row[4]);
+		$start_time[$i] =		sprintf("%-8s", $row[5]);
+			$cd[$i]=0;
+		while ( (strlen($start_time[$i]) > 8) and ($cd[$i] < 100) )
+			{
+			$start_time[$i] = eregi_replace("^.","",$start_time[$i]);   
+			$cd[$i]++;
+			if (strlen($start_time[$i]) <= 8) {$cd[$i]=101;}
+			}
+		$uniqueid[$i] =			$row[8];
+		$lead_id[$i] =			$row[9];
+		$closer[$i] =			$row[1];
+		$call_time_S[$i] = ($STARTtime - $row[6]);
+
+		$call_time_M[$i] = ($call_time_S[$i] / 60);
+		$call_time_M[$i] = round($call_time_M[$i], 2);
+		$call_time_M_int[$i] = intval("$call_time_M[$i]");
+		$call_time_SEC[$i] = ($call_time_M[$i] - $call_time_M_int[$i]);
+		$call_time_SEC[$i] = ($call_time_SEC[$i] * 60);
+		$call_time_SEC[$i] = round($call_time_SEC[$i], 0);
+		if ($call_time_SEC[$i] < 10) {$call_time_SEC[$i] = "0$call_time_SEC[$i]";}
+		$call_time_MS[$i] = "$call_time_M_int[$i]:$call_time_SEC[$i]";
+		$call_time_MS[$i] =		sprintf("%7s", $call_time_MS[$i]);
+		$i++;
+		}
+		$ext_count = $i;
+		$i=0;
+	while ($i < $ext_count)
+		{
+
+		$stmt="select campaign_id from vicidial_auto_calls where lead_id='$lead_id[$i]' and server_ip='" . mysql_real_escape_string($server_ip) . "';";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$camp_to_print = mysql_num_rows($rslt);
+		if ($camp_to_print > 0)
+			{
+			$row=mysql_fetch_row($rslt);
+			$campaign = sprintf("%-12s", $row[0]);
+			$camp_color = $row[0];
+			}
+		else
+			{$campaign = 'DEAD        ';   	$camp_color = 'DEAD';}
+		if (eregi("READY|PAUSED|CLOSER",$status[$i]))
+			{$campaign = '            ';   	$camp_color = '';}
+
+		$stmt="select user from vicidial_xfer_log where lead_id='$lead_id[$i]' and closer='$closer[$i]' order by call_date desc limit 1;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$xfer_to_print = mysql_num_rows($rslt);
+		if ($xfer_to_print > 0)
+			{
+			$row=mysql_fetch_row($rslt);
+			$fronter = sprintf("%-6s", $row[0]);
+			}
+		else
+			{$fronter = '      ';}
+
+		$G = '';		$EG = '';
+		$G=""; $EG='';
+	#	if ($call_time_M_int[$i] >= 5) {$G=''; $EG='';}
+	#	if ($call_time_M_int[$i] >= 10) {$G=''; $EG='';}
+
+		echo "| $G$extension[$i]$EG | $G$user[$i]$EG | $G$sessionid[$i]$EG | $G$channel[$i]$EG | $G$status[$i]$EG | $G$start_time[$i]$EG | $G$call_time_MS[$i]$EG | $G$campaign$EG | $G$fronter$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+		echo "  $i agents logged in on server $server_ip\n\n";
+
+	#	echo "             - 5 minutes or more on call\n";
+	#	echo "             - Over 10 minutes on call\n";
+
+	}
+	else
+	{
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	echo "********************************* NO AGENTS ON CALLS *********************************\n";
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	}
+
+
+###################################################################################
+###### OUTBOUND CALLS
+###################################################################################
+#echo "\n\n";
+echo "----------------------------------------------------------------------------------------";
+echo "\n\n";
+echo "VICIDIAL: Time On VDAD                                              $NOW_TIME\n\n";
+echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+echo "| CHANNEL             | STATUS | CAMPAIGN     | PHONE NUMBER       | CALLTIME | MINUTES |\n";
+echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+
+#$link=mysql_connect("localhost", "cron", "1234");
+# $linkX=mysql_connect("localhost", "cron", "1234");
+#mysql_select_db("asterisk");
+
+$stmt="select channel,status,campaign_id,phone_code,phone_number,call_time,UNIX_TIMESTAMP(call_time) from vicidial_auto_calls where status NOT IN('XFER') and server_ip='" . mysql_real_escape_string($server_ip) . "' order by auto_call_id desc;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$parked_to_print = mysql_num_rows($rslt);
+	if ($parked_to_print > 0)
+	{
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$channel =			sprintf("%-19s", $row[0]);
+			$cc=0;
+		while ( (strlen($channel) > 19) and ($cc < 100) )
+			{
+			$channel = eregi_replace(".$","",$channel);   
+			$cc++;
+			if (strlen($channel) <= 19) {$cc=101;}
+			}
+		$start_time =		sprintf("%-8s", $row[5]);
+			$cd=0;
+		while ( (strlen($start_time) > 8) and ($cd < 100) )
+			{
+			$start_time = eregi_replace("^.","",$start_time);   
+			$cd++;
+			if (strlen($start_time) <= 8) {$cd=101;}
+			}
+		$status =			sprintf("%-6s", $row[1]);
+		$campaign =			sprintf("%-12s", $row[2]);
+			$all_phone = "$row[3]$row[4]";
+		$number_dialed =	sprintf("%-18s", $all_phone);
+		$call_time_S = ($STARTtime - $row[6]);
+
+		$call_time_M = ($call_time_S / 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";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if (eregi("LIVE",$status)) {$G=''; $EG='';}
+	#	if ($call_time_M_int >= 6) {$G=''; $EG='';}
+
+		echo "| $G$channel$EG | $G$status$EG | $G$campaign$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+		echo "  $i calls being placed on server $server_ip\n\n";
+
+		echo "             - LIVE CALL WAITING\n";
+	#	echo "             - Over 5 minutes on hold\n";
+
+		}
+	else
+	{
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	echo "******************************* NO LIVE CALLS WAITING *********************************\n";
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	}
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_timeonVDADall.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_timeonVDADall.php new file mode 100644 index 00000000..ec8eb52a --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_timeonVDADall.php @@ -0,0 +1,826 @@ + LICENSE: GPLv2 +# +# live real-time stats for the VICIDIAL Auto-Dialer all servers +# +# STOP=4000, SLOW=40, GO=4 seconds refresh interval +# +# CHANGELOG: +# 50406-0920 - Added Paused agents < 1 min (Chris Doyle) +# 51130-1218 - Modified layout and info to show all servers in a vicidial system +# 60421-1043 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60511-1343 - Added leads and drop info at the top of the screen +# 60608-1539 - Fixed CLOSER tallies for active calls +# 60619-1658 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 60626-1453 - Added display of system load to bottom (Angelito Manansala) +# 60901-1123 - Changed display elements at the top of the screen +# 60905-1342 - Fixed non INCALL|QUEUE timer column +# 61002-1642 - Added TRUNK SHORT/FILL stats +# 61101-1318 - Added SIP and IAX Listen and Barge links option +# 61101-1647 - Added Usergroup column and user name option as well as sorting +# 61102-1155 - Made display of columns more modular, added ability to hide server info +# 61215-1131 - Added answered calls and drop percent taken from answered calls +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70123-1151 - Added non_latin options for substr in display variables, thanks Marin Blu +# 70206-1140 - Added call-type statuses to display(A-Auto, M-Manual, I-Inbound/Closer) +# 70619-1339 - Added Status Category tally display +# 71029-1900 - Changed CLOSER-type to not require campaign_id restriction +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["RR"])) {$RR=$_GET["RR"];} + elseif (isset($_POST["RR"])) {$RR=$_POST["RR"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["usergroup"])) {$usergroup=$_GET["usergroup"];} + elseif (isset($_POST["usergroup"])) {$usergroup=$_POST["usergroup"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["adastats"])) {$adastats=$_GET["adastats"];} + elseif (isset($_POST["adastats"])) {$adastats=$_POST["adastats"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["SIPmonitorLINK"])) {$SIPmonitorLINK=$_GET["SIPmonitorLINK"];} + elseif (isset($_POST["SIPmonitorLINK"])) {$SIPmonitorLINK=$_POST["SIPmonitorLINK"];} +if (isset($_GET["IAXmonitorLINK"])) {$IAXmonitorLINK=$_GET["IAXmonitorLINK"];} + elseif (isset($_POST["IAXmonitorLINK"])) {$IAXmonitorLINK=$_POST["IAXmonitorLINK"];} +if (isset($_GET["UGdisplay"])) {$UGdisplay=$_GET["UGdisplay"];} + elseif (isset($_POST["UGdisplay"])) {$UGdisplay=$_POST["UGdisplay"];} +if (isset($_GET["UidORname"])) {$UidORname=$_GET["UidORname"];} + elseif (isset($_POST["UidORname"])) {$UidORname=$_POST["UidORname"];} +if (isset($_GET["orderby"])) {$orderby=$_GET["orderby"];} + elseif (isset($_POST["orderby"])) {$orderby=$_POST["orderby"];} +if (isset($_GET["SERVdisplay"])) {$SERVdisplay=$_GET["SERVdisplay"];} + elseif (isset($_POST["SERVdisplay"])) {$SERVdisplay=$_POST["SERVdisplay"];} + + + +if (!isset($RR)) {$gRRroup=4;} +if (!isset($group)) {$group='';} +if (!isset($usergroup)) {$usergroup='';} +if (!isset($UGdisplay)) {$UGdisplay=0;} # 0=no, 1=yes +if (!isset($UidORname)) {$UidORname=0;} # 0=id, 1=name +if (!isset($orderby)) {$orderby='timeup';} +if (!isset($SERVdisplay)) {$SERVdisplay=1;} # 0=no, 1=yes + +function get_server_load($windows = false) { +$os = strtolower(PHP_OS); +if(strpos($os, "win") === false) { +if(file_exists("/proc/loadavg")) { +$load = file_get_contents("/proc/loadavg"); +$load = explode(' ', $load); +return $load[0]; +} +elseif(function_exists("shell_exec")) { +$load = explode(' ', `uptime`); +return $load[count($load)-1]; +} +else { +return false; +} +} +elseif($windows) { +if(class_exists("COM")) { +$wmi = new COM("WinMgmts:\\\\."); +$cpus = $wmi->InstancesOf("Win32_Processor"); + +$cpuload = 0; +$i = 0; +while ($cpu = $cpus->Next()) { +$cpuload += $cpu->LoadPercentage; +$i++; +} + +$cpuload = round($cpuload / $i, 2); +return "$cpuload%"; +} +else { +return false; +} +} +} + +$load_ave = get_server_load(true); + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + 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($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_TIME = date("Y-m-d H:i:s"); +$NOW_DAY = date("Y-m-d"); +$NOW_HOUR = date("H:i:s"); +$STARTtime = date("U"); +$epochSIXhoursAGO = ($STARTtime - 21600); +$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO); + +$stmt="select campaign_id from vicidial_campaigns where active='Y';"; +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +if (!isset($DB)) {$DB=0;} +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + +$stmt="select * from vicidial_user_groups;"; +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +if (!isset($DB)) {$DB=0;} +if ($DB) {echo "$stmt\n";} +$usergroups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $usergroups_to_print) + { + $row=mysql_fetch_row($rslt); + $usergroups[$i] =$row[0]; + $i++; + } + +if (!isset($RR)) {$RR=4;} + +$NFB = ''; +$NFE = ''; +$F=''; $FG=''; $B=''; $BG=''; + +?> + + + + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On VDAD Campaign: $group\n"; +echo "
\n"; +echo "VICIDIAL Campaign: \n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +if ($UGdisplay > 0) + { + echo "\n"; + } +echo "         \n"; +echo "STOP | "; +echo "SLOW | "; +echo "GO"; +echo "       MODIFY | \n"; +echo "SUMMARY | \n"; +echo "REPORTS \n"; +echo "\n\n"; + + +if (!$group) {echo "

please select a campaign from the pulldown above
\n"; exit;} +else +{ +$stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select avg(auto_dial_level),min(dial_status_a),min(dial_status_b),min(dial_status_c),min(dial_status_d),min(dial_status_e),min(lead_order),min(lead_filter_id),sum(hopper_level),min(dial_method),avg(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),min(available_only_ratio_tally),min(adaptive_latest_server_time),min(local_call_time),avg(dial_timeout),min(dial_statuses) from vicidial_campaigns;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$DIALlev = $row[0]; +$DIALstatusA = $row[1]; +$DIALstatusB = $row[2]; +$DIALstatusC = $row[3]; +$DIALstatusD = $row[4]; +$DIALstatusE = $row[5]; +$DIALorder = $row[6]; +$DIALfilter = $row[7]; +$HOPlev = $row[8]; +$DIALmethod = $row[9]; +$maxDIALlev = $row[10]; +$DROPmax = $row[11]; +$targetDIFF = $row[12]; +$ADAintense = $row[13]; +$ADAavailonly = $row[14]; +$TAPERtime = $row[15]; +$CALLtime = $row[16]; +$DIALtimeout = $row[17]; +$DIALstatuses = $row[18]; + $DIALstatuses = (preg_replace("/ -$|^ /","",$DIALstatuses)); + $DIALstatuses = (ereg_replace(' ',', ',$DIALstatuses)); + +$stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select count(*) from vicidial_hopper;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$VDhop = $row[0]; + +$stmt="select dialable_leads,calls_today,drops_today,drops_answers_today_pct,differential_onemin,agents_average_onemin,balance_trunk_fill,answers_today,status_category_1,status_category_count_1,status_category_2,status_category_count_2,status_category_3,status_category_count_3,status_category_4,status_category_count_4 from vicidial_campaign_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),min(status_category_1),sum(status_category_count_1),min(status_category_2),sum(status_category_count_2),min(status_category_3),sum(status_category_count_3),min(status_category_4),sum(status_category_count_4) from vicidial_campaign_stats;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$DAleads = $row[0]; +$callsTODAY = $row[1]; +$dropsTODAY = $row[2]; +$drpctTODAY = $row[3]; +$diffONEMIN = $row[4]; +$agentsONEMIN = $row[5]; +$balanceFILL = $row[6]; +$answersTODAY = $row[7]; +$VSCcat1 = $row[8]; +$VSCcat1tally = $row[9]; +$VSCcat2 = $row[10]; +$VSCcat2tally = $row[11]; +$VSCcat3 = $row[12]; +$VSCcat3tally = $row[13]; +$VSCcat4 = $row[14]; +$VSCcat4tally = $row[15]; + +if ( ($diffONEMIN != 0) and ($agentsONEMIN > 0) ) + { + $diffpctONEMIN = ( ($diffONEMIN / $agentsONEMIN) * 100); + $diffpctONEMIN = sprintf("%01.2f", $diffpctONEMIN); + } +else {$diffpctONEMIN = '0.00';} + +$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$balanceSHORT = $row[0]; + +echo "
"; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +if ($adastats>1) + { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; + + + + +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo "
DIAL LEVEL:  $DIALlev    TRUNK SHORT/FILL:  $balanceSHORT / $balanceFILL     FILTER:  $DIALfilter   TIME:   $NOW_TIME
- min   MAX LEVEL:  $maxDIALlev   DROPPED MAX:  $DROPmax%    TARGET DIFF:  $targetDIFF     INTENSITY:  $ADAintense    
DIAL TIMEOUT:  $DIALtimeout  TAPER TIME:  $TAPERtime  LOCAL TIME:  $CALLtime  AVAIL ONLY:  $ADAavailonly  
DIALABLE LEADS:  $DAleads     CALLS TODAY:  $callsTODAY     AVG AGENTS:  $agentsONEMIN     DIAL METHOD:  $DIALmethod    
HOPPER LEVEL:  $HOPlev     DROPPED / ANSWERED:  $dropsTODAY / $answersTODAY   DL DIFF:  $diffONEMIN     STATUSES:  $DIALstatuses    
LEADS IN HOPPER:  $VDhop     DROPPED PERCENT:  "; +if ($drpctTODAY >= $DROPmax) + {echo "$drpctTODAY%";} +else + {echo "$drpctTODAY%";} +echo "    DIFF:  $diffpctONEMIN%     ORDER:  $DIALorder    
"; +if ( (!eregi('NULL',$VSCcat1)) and (strlen($VSCcat1)>0) ) + {echo "$VSCcat1:   $VSCcat1tally       \n";} +if ( (!eregi('NULL',$VSCcat2)) and (strlen($VSCcat2)>0) ) + {echo "$VSCcat2:   $VSCcat2tally       \n";} +if ( (!eregi('NULL',$VSCcat3)) and (strlen($VSCcat3)>0) ) + {echo "$VSCcat3:   $VSCcat3tally       \n";} +if ( (!eregi('NULL',$VSCcat4)) and (strlen($VSCcat4)>0) ) + {echo "$VSCcat4:   $VSCcat4tally       \n";} +echo "
"; + +if ($adastats<2) + { + echo "+ VIEW MORE SETTINGS"; + } +if ($UGdisplay>0) + { + echo "       HIDE USER GROUP"; + } +else + { + echo "       VIEW USER GROUP"; + } +if ($UidORname>0) + { + echo "       SHOW AGENT ID"; + } +else + { + echo "       SHOW AGENT NAME"; + } +if ($SERVdisplay>0) + { + echo "       HIDE SERVER INFO"; + } +else + { + echo "       SHOW SERVER INFO"; + } +echo "
"; + +echo "\n\n"; +} +################################################################################### +###### OUTBOUND CALLS +################################################################################### +if ($campaign_allow_inbound > 0) + { + $stmt="select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = preg_replace("/^ | -$/","",$row[0]); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaigns = "'$closer_campaigns'"; + + $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') and ( (call_type='IN' and campaign_id IN($closer_campaigns)) or (campaign_id='" . mysql_real_escape_string($group) . "' and call_type='OUT') );"; + } +else + { + if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';} + else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";} + + $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') $groupSQL;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$parked_to_print = mysql_num_rows($rslt); + if ($parked_to_print > 0) + { + $i=0; + $out_total=0; + $out_ring=0; + $out_live=0; + while ($i < $parked_to_print) + { + $row=mysql_fetch_row($rslt); + + if (eregi("LIVE",$row[0])) + {$out_live++;} + else + { + if (eregi("CLOSER",$row[0])) + {$nothing=1;} + else + {$out_ring++;} + } + $out_total++; + $i++; + } + + if ($out_live > 0) {$F=''; $FG='';} + if ($out_live > 4) {$F=''; $FG='';} + if ($out_live > 9) {$F=''; $FG='';} + if ($out_live > 14) {$F=''; $FG='';} + + if ($campaign_allow_inbound > 0) + {echo "$NFB$out_total$NFE current active calls      \n";} + else + {echo "$NFB$out_total$NFE calls being placed       \n";} + + echo "$NFB$out_ring$NFE calls ringing         \n"; + echo "$NFB$F  $out_live $FG$NFE calls waiting for agents       \n"; + } + else + { + echo " NO LIVE CALLS WAITING \n"; + } + + +################################################################################### +###### TIME ON SYSTEM +################################################################################### + +$agent_incall=0; +$agent_ready=0; +$agent_paused=0; +$agent_total=0; + +$Aecho = ''; +$Aecho .= "VICIDIAL: Agents Time On Calls Campaign: $group $NOW_TIME\n\n"; + + +$HDbegin = "+"; +$HTbegin = "|"; +$HDstation = "------------+"; +$HTstation = " STATION |"; +$HDuser = "--------------------+"; +$HTuser = " USER |"; +$HDusergroup = "--------------+"; +$HTusergroup = " USER GROUP |"; +$HDsessionid = "------------------+"; +$HTsessionid = " SESSIONID |"; +$HDbarge = "-------+"; +$HTbarge = " BARGE |"; +$HDstatus = "----------+"; +$HTstatus = " STATUS |"; +$HDserver_ip = "-----------------+"; +$HTserver_ip = " SERVER IP |"; +$HDcall_server_ip = "-----------------+"; +$HTcall_server_ip = " CALL SERVER IP |"; +$HDtime = "---------+"; +$HTtime = " MM:SS |"; +$HDcampaign = "------------+"; +$HTcampaign = " CAMPAIGN |"; + +if ($UGdisplay < 1) + { + $HDusergroup = ''; + $HTusergroup = ''; + } +if ( ($SIPmonitorLINK<1) && ($IAXmonitorLINK<1) ) + { + $HDsessionid = "-----------+"; + $HTsessionid = " SESSIONID |"; + } +if ( ($SIPmonitorLINK<2) && ($IAXmonitorLINK<2) ) + { + $HDbarge = ''; + $HTbarge = ''; + } +if ($SERVdisplay < 1) + { + $HDserver_ip = ''; + $HTserver_ip = ''; + $HDcall_server_ip = ''; + $HTcall_server_ip = ''; + } + + + +$Aline = "$HDbegin$HDstation$HDuser$HDusergroup$HDsessionid$HDbarge$HDstatus$HDserver_ip$HDcall_server_ip$HDtime$HDcampaign\n"; +$Bline = "$HTbegin$HTstation$HTuser$HTusergroup$HTsessionid$HTbarge$HTstatus$HTserver_ip$HTcall_server_ip$HTtime$HTcampaign\n"; +$Aecho .= "$Aline"; +$Aecho .= "$Bline"; +$Aecho .= "$Aline"; + +if ($orderby=='timeup') {$orderSQL='status,last_call_time';} +if ($orderby=='timedown') {$orderSQL='status desc,last_call_time desc';} +if ($orderby=='campaignup') {$orderSQL='campaign_id,status,last_call_time';} +if ($orderby=='campaigndown') {$orderSQL='campaign_id desc,status desc,last_call_time desc';} +if ($orderby=='groupup') {$orderSQL='user_group,status,last_call_time';} +if ($orderby=='groupdown') {$orderSQL='user_group desc,status desc,last_call_time desc';} +if ($UidORname > 0) + { + if ($orderby=='userup') {$orderSQL='full_name,status,last_call_time';} + if ($orderby=='userdown') {$orderSQL='full_name desc,status desc,last_call_time desc';} + } +else + { + if ($orderby=='userup') {$orderSQL='vicidial_live_agents.user';} + if ($orderby=='userdown') {$orderSQL='vicidial_live_agents.user desc';} + } + +if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';} +else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";} +if (strlen($usergroup)<1) {$usergroupSQL = '';} +else {$usergroupSQL = " and user_group='" . mysql_real_escape_string($usergroup) . "'";} + +$stmt="select extension,vicidial_live_agents.user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id,vicidial_users.user_group,vicidial_users.full_name,vicidial_live_agents.comments from vicidial_live_agents,vicidial_users where vicidial_live_agents.user=vicidial_users.user $groupSQL $usergroupSQL order by $orderSQL;"; + +#$stmt="select extension,vicidial_live_agents.user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id,vicidial_users.user_group,vicidial_users.full_name from vicidial_live_agents,vicidial_users where vicidial_live_agents.user=vicidial_users.user and campaign_id='" . mysql_real_escape_string($group) . "' order by $orderSQL;"; + +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + $agentcount=0; + while ($i < $talking_to_print) + { + $row=mysql_fetch_row($rslt); + if (eregi("READY|PAUSED",$row[3])) + { + $row[5]=$row[6]; + } + if ($non_latin < 1) + { + $extension = eregi_replace('Local/',"",$row[0]); + $extension = sprintf("%-10s", $extension); + while(strlen($extension)>10) {$extension = substr("$extension", 0, -1);} + } + else + { + $extension = eregi_replace('Local/',"",$row[0]); + $extension = sprintf("%-40s", $extension); + while(mb_strlen($extension, 'utf-8')>10) {$extension = mb_substr("$extension", 0, -1,'utf8');} + } + $Luser = $row[1]; + $user = sprintf("%-18s", $row[1]); + $Lsessionid = $row[2]; + $sessionid = sprintf("%-9s", $row[2]); + $Lstatus = $row[3]; + $status = sprintf("%-6s", $row[3]); + $server_ip = sprintf("%-15s", $row[4]); + $call_server_ip = sprintf("%-15s", $row[7]); + $campaign_id = sprintf("%-10s", $row[8]); + $comments= $row[11]; + + if (eregi("INCALL",$Lstatus)) + { + if ( (eregi("AUTO",$comments)) or (strlen($comments)<1) ) + {$CM='A';} + else + { + if (eregi("INBOUND",$comments)) + {$CM='I';} + else + {$CM='M';} + } + } + else {$CM=' ';} + + if ($UGdisplay > 0) + { + if ($non_latin < 1) + { + $user_group = sprintf("%-12s", $row[9]); + while(strlen($user_group)>12) {$user_group = substr("$user_group", 0, -1);} + } + else + { + $user_group = sprintf("%-40s", $row[9]); + while(mb_strlen($user_group, 'utf-8')>12) {$user_group = mb_substr("$user_group", 0, -1,'utf8');} + } + } + if ($UidORname > 0) + { + if ($non_latin < 1) + { + $user = sprintf("%-18s", $row[10]); + while(strlen($user)>18) {$user = substr("$user", 0, -1);} + } + else + { + $user = sprintf("%-40s", $row[10]); + while(mb_strlen($user, 'utf-8')>18) {$user = mb_substr("$user", 0, -1,'utf8');} + } + } + if (!eregi("INCALL|QUEUE",$row[3])) + {$call_time_S = ($STARTtime - $row[6]);} + else + {$call_time_S = ($STARTtime - $row[5]);} + + $call_time_M = ($call_time_S / 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"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + if ($Lstatus=='INCALL') + { + if ($call_time_S >= 10) {$G=''; $EG='';} + if ($call_time_M_int >= 1) {$G=''; $EG='';} + if ($call_time_M_int >= 5) {$G=''; $EG='';} + # if ($call_time_M_int >= 10) {$G=''; $EG='';} + } + if (eregi("PAUSED",$row[3])) + { + if ($call_time_M_int >= 30) + {$i++; continue;} + else + { + $agent_paused++; $agent_total++; + $G=''; $EG=''; + if ($call_time_S >= 10) {$G=''; $EG='';} + if ($call_time_M_int >= 1) {$G=''; $EG='';} + if ($call_time_M_int >= 5) {$G=''; $EG='';} + } + } +# if ( (strlen($row[7])> 4) and ($row[7] != "$row[4]") ) +# {$G=''; $EG='';} + + if ( (eregi("INCALL",$status)) or (eregi("QUEUE",$status)) ) {$agent_incall++; $agent_total++;} + if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) {$agent_ready++; $agent_total++;} + if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) + { + $G=''; $EG=''; + if ($call_time_M_int >= 1) {$G=''; $EG='';} + if ($call_time_M_int >= 5) {$G=''; $EG='';} + } + + $L=''; + $R=''; + if ($SIPmonitorLINK>0) {$L=" LISTEN"; $R='';} + if ($IAXmonitorLINK>0) {$L=" LISTEN"; $R='';} + if ($SIPmonitorLINK>1) {$R=" | BARGE";} + if ($IAXmonitorLINK>1) {$R=" | BARGE";} + + if ($UGdisplay > 0) {$UGD = " $G$user_group$EG |";} + else {$UGD = "";} + + if ($SERVdisplay > 0) {$SVD = "$G$server_ip$EG | $G$call_server_ip$EG | ";} + else {$SVD = "";} + + $agentcount++; + + $Aecho .= "| $G$extension$EG | $G$user$EG |$UGD $G$sessionid$EG$L$R | $G$status$EG $CM | $SVD$G$call_time_MS$EG | $G$campaign_id$EG |\n"; + + $i++; + } + + $Aecho .= "$Aline"; + $Aecho .= " $agentcount agents logged in on all servers\n"; + $Aecho .= " System Load Average: $load_ave\n\n"; + + # $Aecho .= " - Balanced call\n"; + $Aecho .= " - Agent waiting for call\n"; + $Aecho .= " - Agent waiting for call > 1 minute\n"; + $Aecho .= " - Agent waiting for call > 5 minutes\n"; + $Aecho .= " - Agent on call > 10 seconds\n"; + $Aecho .= " - Agent on call > 1 minute\n"; + $Aecho .= " - Agent on call > 5 minutes\n"; + $Aecho .= " - Agent Paused > 10 seconds\n"; + $Aecho .= " - Agent Paused > 1 minute\n"; + $Aecho .= " - Agent Paused > 5 minutes\n"; + + if ($agent_ready > 0) {$B=''; $BG='';} + if ($agent_ready > 4) {$B=''; $BG='';} + if ($agent_ready > 9) {$B=''; $BG='';} + if ($agent_ready > 14) {$B=''; $BG='';} + + + echo "\n
\n"; + + echo "$NFB$agent_total$NFE agents logged in         \n"; + echo "$NFB$agent_incall$NFE agents in calls       \n"; + echo "$NFB$B  $agent_ready $BG$NFE agents waiting       \n"; + echo "$NFB$agent_paused$NFE paused agents       \n"; + + echo "
";
+		echo "";
+		echo "$Aecho";
+	}
+	else
+	{
+	echo " NO AGENTS ON CALLS \n";
+	}
+
+?>
+
+ + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_timeonVDADallREC.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_timeonVDADallREC.php new file mode 100644 index 00000000..2abf27b2 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_timeonVDADallREC.php @@ -0,0 +1,943 @@ + LICENSE: GPLv2 +# +# live real-time stats for the VICIDIAL Auto-Dialer all servers +# +# STOP=4000, SLOW=40, GO=4 seconds refresh interval +# +# CHANGELOG: +# 50406-0920 - Added Paused agents < 1 min (Chris Doyle) +# 51130-1218 - Modified layout and info to show all servers in a vicidial system +# 60421-1043 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60511-1343 - Added leads and drop info at the top of the screen +# 60608-1539 - Fixed CLOSER tallies for active calls +# 60619-1658 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 60626-1453 - Added display of system load to bottom (Angelito Manansala) +# 60901-1123 - Changed display elements at the top of the screen +# 60905-1342 - Fixed non INCALL|QUEUE timer column +# 61002-1642 - Added TRUNK SHORT/FILL stats +# 61101-1318 - Added SIP and IAX Listen and Barge links option +# 61101-1647 - Added Usergroup column and user name option as well as sorting +# 61102-1155 - Made display of columns more modular, added ability to hide server info +# 61215-1131 - Added answered calls and drop percent taken from answered calls +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70123-1151 - Added non_latin options for substr in display variables, thanks Marin Blu +# 70206-1140 - Added call-type statuses to display(A-Auto, M-Manual, I-Inbound/Closer) +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["RR"])) {$RR=$_GET["RR"];} + elseif (isset($_POST["RR"])) {$RR=$_POST["RR"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["usergroup"])) {$usergroup=$_GET["usergroup"];} + elseif (isset($_POST["usergroup"])) {$usergroup=$_POST["usergroup"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["adastats"])) {$adastats=$_GET["adastats"];} + elseif (isset($_POST["adastats"])) {$adastats=$_POST["adastats"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["SIPmonitorLINK"])) {$SIPmonitorLINK=$_GET["SIPmonitorLINK"];} + elseif (isset($_POST["SIPmonitorLINK"])) {$SIPmonitorLINK=$_POST["SIPmonitorLINK"];} +if (isset($_GET["IAXmonitorLINK"])) {$IAXmonitorLINK=$_GET["IAXmonitorLINK"];} + elseif (isset($_POST["IAXmonitorLINK"])) {$IAXmonitorLINK=$_POST["IAXmonitorLINK"];} +if (isset($_GET["UGdisplay"])) {$UGdisplay=$_GET["UGdisplay"];} + elseif (isset($_POST["UGdisplay"])) {$UGdisplay=$_POST["UGdisplay"];} +if (isset($_GET["UidORname"])) {$UidORname=$_GET["UidORname"];} + elseif (isset($_POST["UidORname"])) {$UidORname=$_POST["UidORname"];} +if (isset($_GET["orderby"])) {$orderby=$_GET["orderby"];} + elseif (isset($_POST["orderby"])) {$orderby=$_POST["orderby"];} +if (isset($_GET["SERVdisplay"])) {$SERVdisplay=$_GET["SERVdisplay"];} + elseif (isset($_POST["SERVdisplay"])) {$SERVdisplay=$_POST["SERVdisplay"];} + +if (isset($_GET["RECmonitorLINK"])) {$RECmonitorLINK=$_GET["RECmonitorLINK"];} + elseif (isset($_POST["RECmonitorLINK"])) {$RECmonitorLINK=$_POST["RECmonitorLINK"];} + +if (!isset($RR)) {$gRRroup=4;} +if (!isset($group)) {$group='';} +if (!isset($usergroup)) {$usergroup='';} +if (!isset($UGdisplay)) {$UGdisplay=0;} # 0=no, 1=yes +if (!isset($UidORname)) {$UidORname=0;} # 0=id, 1=name +if (!isset($orderby)) {$orderby='timeup';} +if (!isset($SERVdisplay)) {$SERVdisplay=1;} # 0=no, 1=yes + +function get_server_load($windows = false) { +$os = strtolower(PHP_OS); +if(strpos($os, "win") === false) { +if(file_exists("/proc/loadavg")) { +$load = file_get_contents("/proc/loadavg"); +$load = explode(' ', $load); +return $load[0]; +} +elseif(function_exists("shell_exec")) { +$load = explode(' ', `uptime`); +return $load[count($load)-1]; +} +else { +return false; +} +} +elseif($windows) { +if(class_exists("COM")) { +$wmi = new COM("WinMgmts:\\\\."); +$cpus = $wmi->InstancesOf("Win32_Processor"); + +$cpuload = 0; +$i = 0; +while ($cpu = $cpus->Next()) { +$cpuload += $cpu->LoadPercentage; +$i++; +} + +$cpuload = round($cpuload / $i, 2); +return "$cpuload%"; +} +else { +return false; +} +} +} + +$load_ave = get_server_load(true); + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + + $stmt="SELECT vicidial_recording from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $authrec=$row[0]; + if ($authrec=='1') {$RECmonitorLINK = 1;} else {$RECmonitorLINK = 0;} + + +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_TIME = date("Ymd-His"); +$NOW_DAY = date("Y-m-d"); +$NOW_HOUR = date("H:i:s"); +$STARTtime = date("U"); +$epochSIXhoursAGO = ($STARTtime - 21600); +$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO); + +$stmt="select campaign_id from vicidial_campaigns where active='Y';"; +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); +if (!isset($DB)) {$DB=0;} +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + +$stmt="select * from vicidial_user_groups;"; +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); +if (!isset($DB)) {$DB=0;} +if ($DB) {echo "$stmt\n";} +$usergroups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $usergroups_to_print) + { + $row=mysql_fetch_row($rslt); + $usergroups[$i] =$row[0]; + $i++; + } + +if (!isset($RR)) {$RR=4;} + +$NFB = ''; +$NFE = ''; +$F=''; $FG=''; $B=''; $BG=''; + +?> + + + + + + + + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On VDAD Campaign: $group\n"; +echo "
\n"; +echo "VICIDIAL Campaign: \n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +if ($UGdisplay > 0) + { + echo "\n"; + } +echo "         \n"; +echo "STOP | "; +echo "SLOW | "; +echo "GO"; +echo "       MODIFY | \n"; +echo "SUMMARY | \n"; +echo "REPORTS \n"; +echo "\n\n"; + + +if (!$group) {echo "

please select a campaign from the pulldown above
\n"; exit;} +else +{ +$stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; + +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select avg(auto_dial_level),min(dial_status_a),min(dial_status_b),min(dial_status_c),min(dial_status_d),min(dial_status_e),min(lead_order),min(lead_filter_id),sum(hopper_level),min(dial_method),avg(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),min(available_only_ratio_tally),min(adaptive_latest_server_time),min(local_call_time),avg(dial_timeout),min(dial_statuses) from vicidial_campaigns;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$DIALlev = $row[0]; +$DIALstatusA = $row[1]; +$DIALstatusB = $row[2]; +$DIALstatusC = $row[3]; +$DIALstatusD = $row[4]; +$DIALstatusE = $row[5]; +$DIALorder = $row[6]; +$DIALfilter = $row[7]; +$HOPlev = $row[8]; +$DIALmethod = $row[9]; +$maxDIALlev = $row[10]; +$DROPmax = $row[11]; +$targetDIFF = $row[12]; +$ADAintense = $row[13]; +$ADAavailonly = $row[14]; +$TAPERtime = $row[15]; +$CALLtime = $row[16]; +$DIALtimeout = $row[17]; +$DIALstatuses = $row[18]; + $DIALstatuses = (preg_replace("/ -$|^ /","",$DIALstatuses)); + $DIALstatuses = (ereg_replace(' ',', ',$DIALstatuses)); + +$stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select count(*) from vicidial_hopper;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$VDhop = $row[0]; + +$stmt="select dialable_leads,calls_today,drops_today,drops_answers_today_pct,differential_onemin,agents_average_onemin,balance_trunk_fill,answers_today from vicidial_campaign_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today) from vicidial_campaign_stats;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$DAleads = $row[0]; +$callsTODAY = $row[1]; +$dropsTODAY = $row[2]; +$drpctTODAY = $row[3]; +$diffONEMIN = $row[4]; +$agentsONEMIN = $row[5]; +$balanceFILL = $row[6]; +$answersTODAY = $row[7]; +if ( ($diffONEMIN != 0) and ($agentsONEMIN > 0) ) + { + $diffpctONEMIN = ( ($diffONEMIN / $agentsONEMIN) * 100); + $diffpctONEMIN = sprintf("%01.2f", $diffpctONEMIN); + } +else {$diffpctONEMIN = '0.00';} + +$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$balanceSHORT = $row[0]; + +echo "
"; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +if ($adastats>1) + { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo "
DIAL LEVEL:  $DIALlev    TRUNK SHORT/FILL:  $balanceSHORT / $balanceFILL     FILTER:  $DIALfilter   TIME:   $NOW_TIME
- min   MAX LEVEL:  $maxDIALlev   DROPPED MAX:  $DROPmax%    TARGET DIFF:  $targetDIFF     INTENSITY:  $ADAintense    
DIAL TIMEOUT:  $DIALtimeout  TAPER TIME:  $TAPERtime  LOCAL TIME:  $CALLtime  AVAIL ONLY:  $ADAavailonly  
DIALABLE LEADS:  $DAleads     CALLS TODAY:  $callsTODAY     AVG AGENTS:  $agentsONEMIN     DIAL METHOD:  $DIALmethod    
HOPPER LEVEL:  $HOPlev     DROPPED / ANSWERED:  $dropsTODAY / $answersTODAY   DL DIFF:  $diffONEMIN     STATUSES:  $DIALstatuses    
LEADS IN HOPPER:  $VDhop     DROPPED PERCENT:  $drpctTODAY%    DIFF:  $diffpctONEMIN%     ORDER:  $DIALorder    
"; + +if ($adastats<2) + { + echo "+ VIEW MORE SETTINGS"; + } +if ($UGdisplay>0) + { + echo "       HIDE USER GROUP"; + } +else + { + echo "       VIEW USER GROUP"; + } +if ($UidORname>0) + { + echo "       SHOW AGENT ID"; + } +else + { + echo "       SHOW AGENT NAME"; + } +if ($SERVdisplay>0) + { + echo "       HIDE SERVER INFO"; + } +else + { + echo "       SHOW SERVER INFO"; + } +echo "
"; + +echo "\n\n"; +} +################################################################################### +###### OUTBOUND CALLS +################################################################################### +if (eregi("(CLOSER|BLEND|INBND|_C$|_B$|_I$)",$group)) + { + $stmt="select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} + if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = preg_replace("/^ | -$/","",$row[0]); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaigns = "'$closer_campaigns'"; + + $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') and ( (call_type='IN' and campaign_id IN($closer_campaigns)) or (campaign_id='" . mysql_real_escape_string($group) . "' and call_type='OUT') );"; + } +else + { + if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';} + else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";} + + $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') $groupSQL;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$parked_to_print = mysql_num_rows($rslt); + if ($parked_to_print > 0) + { + $i=0; + $out_total=0; + $out_ring=0; + $out_live=0; + while ($i < $parked_to_print) + { + $row=mysql_fetch_row($rslt); + + if (eregi("LIVE",$row[0])) + {$out_live++;} + else + { + if (eregi("CLOSER",$row[0])) + {$nothing=1;} + else + {$out_ring++;} + } + $out_total++; + $i++; + } + + if ($out_live > 0) {$F=''; $FG='';} + if ($out_live > 4) {$F=''; $FG='';} + if ($out_live > 9) {$F=''; $FG='';} + if ($out_live > 14) {$F=''; $FG='';} + + if (eregi("(CLOSER|BLEND|INBND|_C$|_B$|_I$)",$group)) + {echo "$NFB$out_total$NFE current active calls      \n";} + else + {echo "$NFB$out_total$NFE calls being placed       \n";} + + echo "$NFB$out_ring$NFE calls ringing         \n"; + echo "$NFB$F  $out_live $FG$NFE calls waiting for agents       \n"; + } + else + { + echo " NO LIVE CALLS WAITING \n"; + } + + +################################################################################### +###### TIME ON SYSTEM +################################################################################### + +$agent_incall=0; +$agent_ready=0; +$agent_paused=0; +$agent_total=0; + +$Aecho = ''; +$Aecho .= "VICIDIAL: Agents Time On Calls Campaign: $group $NOW_TIME\n\n"; + + +$HDbegin = "+"; +$HTbegin = "|"; +$HDstation = "------------+"; +$HTstation = " STATION |"; +$HDuser = "--------------------+"; +$HTuser = " USER |"; +$HDusergroup = "--------------+"; +$HTusergroup = " USER GROUP |"; +$HDsessionid = "------------------+"; +$HTsessionid = " SESSIONID |"; +$HDbarge = "-------+"; +$HTbarge = " BARGE |"; +$HDrec = "---------+"; +$HTrec = " MONITOR |"; +$HDstatus = "----------+"; +$HTstatus = " STATUS |"; +$HDserver_ip = "-----------------+"; +$HTserver_ip = " SERVER IP |"; +$HDcall_server_ip = "-----------------+"; +$HTcall_server_ip = " CALL SERVER IP |"; +$HDtime = "---------+"; +$HTtime = " MM:SS |"; +$HDcampaign = "------------+"; +$HTcampaign = " CAMPAIGN |"; + +if ($UGdisplay < 1) + { + $HDusergroup = ''; + $HTusergroup = ''; + } +if ( ($SIPmonitorLINK<1) && ($IAXmonitorLINK<1) ) + { + $HDsessionid = "-----------+"; + $HTsessionid = " SESSIONID |"; + } +if ( ($SIPmonitorLINK<2) && ($IAXmonitorLINK<2) ) + { + $HDbarge = ''; + $HTbarge = ''; + } +if ($SERVdisplay < 1) + { + $HDserver_ip = ''; + $HTserver_ip = ''; + $HDcall_server_ip = ''; + $HTcall_server_ip = ''; + } + +if ( ($RECmonitorLINK<1) ) +{ + $HDrec = ''; + $HTrec = ''; +} + +$Aline = "$HDbegin$HDstation$HDuser$HDusergroup$HDsessionid$HDbarge$HDstatus$HDrec$HDserver_ip$HDcall_server_ip$HDtime$HDcampaign\n"; +$Bline = "$HTbegin$HTstation$HTuser$HTusergroup$HTsessionid$HTbarge$HTstatus$HTrec$HTserver_ip$HTcall_server_ip$HTtime$HTcampaign\n"; + +$Aecho .= "$Aline"; +$Aecho .= "$Bline"; +$Aecho .= "$Aline"; + +if ($orderby=='timeup') {$orderSQL='status,last_call_time';} +if ($orderby=='timedown') {$orderSQL='status desc,last_call_time desc';} +if ($orderby=='campaignup') {$orderSQL='campaign_id,status,last_call_time';} +if ($orderby=='campaigndown') {$orderSQL='campaign_id desc,status desc,last_call_time desc';} +if ($orderby=='groupup') {$orderSQL='user_group,status,last_call_time';} +if ($orderby=='groupdown') {$orderSQL='user_group desc,status desc,last_call_time desc';} +if ($UidORname > 0) + { + if ($orderby=='userup') {$orderSQL='full_name,status,last_call_time';} + if ($orderby=='userdown') {$orderSQL='full_name desc,status desc,last_call_time desc';} + } +else + { + if ($orderby=='userup') {$orderSQL='vicidial_live_agents.user';} + if ($orderby=='userdown') {$orderSQL='vicidial_live_agents.user desc';} + } + +if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';} +else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";} +if (strlen($usergroup)<1) {$usergroupSQL = '';} +else {$usergroupSQL = " and user_group='" . mysql_real_escape_string($usergroup) . "'";} + +$stmt="select extension,vicidial_live_agents.user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id,vicidial_users.user_group,vicidial_users.full_name,vicidial_live_agents.comments,lead_id,vicidial_users.pass from vicidial_live_agents,vicidial_users where vicidial_live_agents.user=vicidial_users.user $groupSQL $usergroupSQL order by $orderSQL;"; + +#$stmt="select extension,vicidial_live_agents.user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id,vicidial_users.user_group,vicidial_users.full_name from vicidial_live_agents,vicidial_users where vicidial_live_agents.user=vicidial_users.user and campaign_id='" . mysql_real_escape_string($group) . "' order by $orderSQL;"; + +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + $agentcount=0; + while ($i < $talking_to_print) + { + $row=mysql_fetch_row($rslt); + if (eregi("READY|PAUSED",$row[3])) + { + $row[5]=$row[6]; + } + if ($non_latin < 1) + { + $extension = eregi_replace('Local/',"",$row[0]); + $extension = eregi_replace('IAX2/',"",$row[0]); + $extension = sprintf("%-10s", $extension); + while(strlen($extension)>10) {$extension = substr("$extension", 0, -1);} + } + else + { + $extension = eregi_replace('Local/',"",$row[0]); + $extension = eregi_replace('IAX2/',"",$row[0]); + $extension = sprintf("%-40s", $extension); + while(mb_strlen($extension, 'utf-8')>10) {$extension = mb_substr("$extension", 0, -1,'utf8');} + } + + $Luser = $row[1]; + $user = sprintf("%-18s", $row[1]); + $Lsessionid = $row[2]; + $sessionid = sprintf("%-9s", $row[2]); + $Lstatus = $row[3]; + $status = sprintf("%-6s", $row[3]); + $Lserver_ip = $row[4]; + $server_ip = sprintf("%-15s", $row[4]); + $call_server_ip = sprintf("%-15s", $row[7]); + $campaign_id = sprintf("%-10s", $row[8]); + $comments= $row[11]; + + $lead_id = $row[12]; + $user_pass = $row[13]; + + + if (eregi("INCALL",$Lstatus)) + { + if ( (eregi("AUTO",$comments)) or (strlen($comments)<1) ) + {$CM='A';} + else + { + if (eregi("INBOUND",$comments)) + {$CM='I';} + else + {$CM='M';} + } + } + else {$CM=' ';} + + if ($UGdisplay > 0) + { + if ($non_latin < 1) + { + $user_group = sprintf("%-12s", $row[9]); + while(strlen($user_group)>12) {$user_group = substr("$user_group", 0, -1);} + } + else + { + $user_group = sprintf("%-40s", $row[9]); + while(mb_strlen($user_group, 'utf-8')>12) {$user_group = mb_substr("$user_group", 0, -1,'utf8');} + } + } + if ($UidORname > 0) + { + if ($non_latin < 1) + { + $user = sprintf("%-18s", $row[10]); + while(strlen($user)>18) {$user = substr("$user", 0, -1);} + } + else + { + $user = sprintf("%-40s", $row[10]); + while(mb_strlen($user, 'utf-8')>18) {$user = mb_substr("$user", 0, -1,'utf8');} + } + } + if (!eregi("INCALL|QUEUE",$row[3])) + {$call_time_S = ($STARTtime - $row[6]);} + else + {$call_time_S = ($STARTtime - $row[5]);} + + $call_time_M = ($call_time_S / 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"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + if ($Lstatus=='INCALL') + { + if ($call_time_S >= 10) {$G=''; $EG='';} + if ($call_time_M_int >= 1) {$G=''; $EG='';} + if ($call_time_M_int >= 5) {$G=''; $EG='';} + # if ($call_time_M_int >= 10) {$G=''; $EG='';} + } + if (eregi("PAUSED",$row[3])) + { + if ($call_time_M_int >= 30) + {$i++; continue;} + else + { + $agent_paused++; $agent_total++; + $G=''; $EG=''; + if ($call_time_S >= 10) {$G=''; $EG='';} + if ($call_time_M_int >= 1) {$G=''; $EG='';} + if ($call_time_M_int >= 5) {$G=''; $EG='';} + } + } +# if ( (strlen($row[7])> 4) and ($row[7] != "$row[4]") ) +# {$G=''; $EG='';} + + if ( (eregi("INCALL",$status)) or (eregi("QUEUE",$status)) ) {$agent_incall++; $agent_total++;} + if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) {$agent_ready++; $agent_total++;} + if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) + { + $G=''; $EG=''; + if ($call_time_M_int >= 1) {$G=''; $EG='';} + if ($call_time_M_int >= 5) {$G=''; $EG='';} + } + + $L=''; + $R=''; + $LL=''; + $EXTF='6'; + $servip= str_replace('.','',$Lserver_ip); + if ($SIPmonitorLINK>0) {$L=" LISTEN"; $R='';} + if ($IAXmonitorLINK>0) {$L=" LISTEN"; $R='';} + if ($SIPmonitorLINK>1) {$R=" | BARGE";} + if ($IAXmonitorLINK>1) {$R=" | BARGE";} + + + if ($RECmonitorLINK>0) + { + + $stmt="select session_name from web_client_sessions where server_ip ='$server_ip' and extension ='$extension' limit 1;"; + if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} + $rslta=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $sess = mysql_num_rows($rslta); + + if ($sess > 0) + { + $row=mysql_fetch_row($rslta); + $sessionname = $row[0]; + } else + { + $sessionname = ""; + } + + + $stmt="select end_time,channel,extension,lead_id,user,server_ip,filename from recording_log where server_ip ='$server_ip' and user ='$Luser';"; + if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} + $rslta=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_channels = mysql_num_rows($rslta); + + if ($rec_channels > 0) + { + $ii=0; + while ($ii < $rec_channels) + { + $row=mysql_fetch_row($rslta); + $pos=strpos($row[1], $Lsessionid); + + if ($pos===false) + { + $LL=" Rec "; + } + else + { + if(is_null($row[0])) { + $LL=" Stop"; + } + else + { + $LL=" Rec "; + } + } + + $ii++; + } + } + else + { + $LL=" Rec "; + + } + } + + + if ($UGdisplay > 0) {$UGD = " $G$user_group$EG |";} + else {$UGD = "";} + + if ($SERVdisplay > 0) {$SVD = "$G$server_ip$EG | $G$call_server_ip$EG | ";} + else {$SVD = "";} + + $agentcount++; + + $Aecho .= "| $G$extension$EG | $G$user$EG |$UGD $G$sessionid$EG$L$R | $G$status$EG $CM | $LL | $SVD$G$call_time_MS$EG | $G$campaign_id$EG |\n"; + + $i++; + } + + $Aecho .= "$Aline"; + $Aecho .= " $agentcount agents logged in on all servers\n"; + $Aecho .= " System Load Average: $load_ave\n\n"; + + # $Aecho .= " - Balanced call\n"; + $Aecho .= " - Agent waiting for call\n"; + $Aecho .= " - Agent waiting for call > 1 minute\n"; + $Aecho .= " - Agent waiting for call > 5 minutes\n"; + $Aecho .= " - Agent on call > 10 seconds\n"; + $Aecho .= " - Agent on call > 1 minute\n"; + $Aecho .= " - Agent on call > 5 minutes\n"; + $Aecho .= " - Agent Paused > 10 seconds\n"; + $Aecho .= " - Agent Paused > 1 minute\n"; + $Aecho .= " - Agent Paused > 5 minutes\n"; + + if ($agent_ready > 0) {$B=''; $BG='';} + if ($agent_ready > 4) {$B=''; $BG='';} + if ($agent_ready > 9) {$B=''; $BG='';} + if ($agent_ready > 14) {$B=''; $BG='';} + + + echo "\n
\n"; + + echo "$NFB$agent_total$NFE agents logged in         \n"; + echo "$NFB$agent_incall$NFE agents in calls       \n"; + echo "$NFB$B  $agent_ready $BG$NFE agents waiting       \n"; + echo "$NFB$agent_paused$NFE paused agents       \n"; + + echo "
";
+		echo "";
+		echo "$Aecho";
+	}
+	else
+	{
+	echo " NO AGENTS ON CALLS \n";
+	}
+
+?>
+
+ + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_timeonVDADallSUMMARY.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_timeonVDADallSUMMARY.php new file mode 100644 index 00000000..242b27a0 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_timeonVDADallSUMMARY.php @@ -0,0 +1,442 @@ + LICENSE: GPLv2 +# +# Summary for all campaigns live real-time stats for the VICIDIAL Auto-Dialer all servers +# +# STOP=4000, SLOW=40, GO=4 seconds refresh interval +# +# changes: +# 61102-1616 - first build +# 61215-1131 - added answered calls and drop percent taken from answered calls +# 70111-1600 - added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70619-1339 - Added Status Category tally display +# 71029-1900 - Changed CLOSER-type to not require campaign_id restriction +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["RR"])) {$RR=$_GET["RR"];} + elseif (isset($_POST["RR"])) {$RR=$_POST["RR"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["adastats"])) {$adastats=$_GET["adastats"];} + elseif (isset($_POST["adastats"])) {$adastats=$_POST["adastats"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +if (!isset($RR)) {$gRRroup=4;} + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); + +$stmt="select campaign_id from vicidial_campaigns where active='Y';"; +$rslt=mysql_query($stmt, $link); +if (!isset($DB)) {$DB=0;} +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + +if (!isset($RR)) {$RR=4;} + +?> + + + + + +\n"; +echo "VICIDIAL: Realtime All Campaigns Summary\n"; +echo "VICIDIAL: Realtime All Campaigns Summary           \n"; +echo "STOP | "; +echo "SLOW | "; +echo "GO "; +echo "       \n"; +if ($adastats<2) + { + echo "+ VIEW MORE SETTINGS"; + } +else + { + echo "- VIEW LESS SETTINGS"; + } +echo "       REPORTS"; +echo "

\n\n"; + +$k=0; +while($k<$groups_to_print) +{ +$NFB = ''; +$NFE = ''; +$F=''; $FG=''; $B=''; $BG=''; + +$group = $groups[$k]; +echo "$group   -   "; +echo "Modify\n"; + + +$stmt = "select count(*) from vicidial_campaigns where campaign_id='$group' and campaign_allow_inbound='Y';"; +$rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $campaign_allow_inbound = $row[0]; + +$stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$DIALlev = $row[0]; +$DIALstatusA = $row[1]; +$DIALstatusB = $row[2]; +$DIALstatusC = $row[3]; +$DIALstatusD = $row[4]; +$DIALstatusE = $row[5]; +$DIALorder = $row[6]; +$DIALfilter = $row[7]; +$HOPlev = $row[8]; +$DIALmethod = $row[9]; +$maxDIALlev = $row[10]; +$DROPmax = $row[11]; +$targetDIFF = $row[12]; +$ADAintense = $row[13]; +$ADAavailonly = $row[14]; +$TAPERtime = $row[15]; +$CALLtime = $row[16]; +$DIALtimeout = $row[17]; +$DIALstatuses = $row[18]; + $DIALstatuses = (preg_replace("/ -$|^ /","",$DIALstatuses)); + $DIALstatuses = (ereg_replace(' ',', ',$DIALstatuses)); + +$stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$VDhop = $row[0]; + +$stmt="select dialable_leads,calls_today,drops_today,drops_answers_today_pct,differential_onemin,agents_average_onemin,balance_trunk_fill,answers_today,status_category_1,status_category_count_1,status_category_2,status_category_count_2,status_category_3,status_category_count_3,status_category_4,status_category_count_4 from vicidial_campaign_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$DAleads = $row[0]; +$callsTODAY = $row[1]; +$dropsTODAY = $row[2]; +$drpctTODAY = $row[3]; +$diffONEMIN = $row[4]; +$agentsONEMIN = $row[5]; +$balanceFILL = $row[6]; +$answersTODAY = $row[7]; +$VSCcat1 = $row[8]; +$VSCcat1tally = $row[9]; +$VSCcat2 = $row[10]; +$VSCcat2tally = $row[11]; +$VSCcat3 = $row[12]; +$VSCcat3tally = $row[13]; +$VSCcat4 = $row[14]; +$VSCcat4tally = $row[15]; + +if ( ($diffONEMIN != 0) and ($agentsONEMIN > 0) ) + { + $diffpctONEMIN = ( ($diffONEMIN / $agentsONEMIN) * 100); + $diffpctONEMIN = sprintf("%01.2f", $diffpctONEMIN); + } +else {$diffpctONEMIN = '0.00';} + +$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$balanceSHORT = $row[0]; + +echo "
"; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +if ($adastats>1) + { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo "
DIAL LEVEL:  $DIALlev    TRUNK SHORT/FILL:  $balanceSHORT / $balanceFILL     FILTER:  $DIALfilter   TIME:   $NOW_TIME
  MAX LEVEL:  $maxDIALlev   DROPPED MAX:  $DROPmax%    TARGET DIFF:  $targetDIFF     INTENSITY:  $ADAintense    
DIAL TIMEOUT:  $DIALtimeout  TAPER TIME:  $TAPERtime  LOCAL TIME:  $CALLtime  AVAIL ONLY:  $ADAavailonly  
DIALABLE LEADS:  $DAleads     CALLS TODAY:  $callsTODAY     AVG AGENTS:  $agentsONEMIN     DIAL METHOD:  $DIALmethod    
HOPPER LEVEL:  $HOPlev     DROPPED / ANSWERED:  $dropsTODAY / $answersTODAY   DL DIFF:  $diffONEMIN     STATUSES:  $DIALstatuses    
LEADS IN HOPPER:  $VDhop     DROPPED PERCENT:  "; +if ($drpctTODAY >= $DROPmax) + {echo "$drpctTODAY%";} +else + {echo "$drpctTODAY%";} +echo "    DIFF:  $diffpctONEMIN%     ORDER:  $DIALorder    
"; +if ( (!eregi('NULL',$VSCcat1)) and (strlen($VSCcat1)>0) ) + {echo "$VSCcat1:   $VSCcat1tally       \n";} +if ( (!eregi('NULL',$VSCcat2)) and (strlen($VSCcat2)>0) ) + {echo "$VSCcat2:   $VSCcat2tally       \n";} +if ( (!eregi('NULL',$VSCcat3)) and (strlen($VSCcat3)>0) ) + {echo "$VSCcat3:   $VSCcat3tally       \n";} +if ( (!eregi('NULL',$VSCcat4)) and (strlen($VSCcat4)>0) ) + {echo "$VSCcat4:   $VSCcat4tally       \n";} +echo "
"; + +### Header finish + + + + + +################################################################################ +### START calculating calls/agents +################################################################################ + +################################################################################ +###### OUTBOUND CALLS +################################################################################ +if ($campaign_allow_inbound > 0) + { + $stmt="select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = preg_replace("/^ | -$/","",$row[0]); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaigns = "'$closer_campaigns'"; + + $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') and ( (call_type='IN' and campaign_id IN($closer_campaigns)) or (campaign_id='" . mysql_real_escape_string($group) . "' and call_type='OUT') );"; + } +else + { + if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';} + else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";} + + $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') $groupSQL;"; + } +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$parked_to_print = mysql_num_rows($rslt); + if ($parked_to_print > 0) + { + $i=0; + $out_total=0; + $out_ring=0; + $out_live=0; + while ($i < $parked_to_print) + { + $row=mysql_fetch_row($rslt); + + if (eregi("LIVE",$row[0])) + {$out_live++;} + else + { + if (eregi("CLOSER",$row[0])) + {$nothing=1;} + else + {$out_ring++;} + } + $out_total++; + $i++; + } + + if ($out_live > 0) {$F=''; $FG='';} + if ($out_live > 4) {$F=''; $FG='';} + if ($out_live > 9) {$F=''; $FG='';} + if ($out_live > 14) {$F=''; $FG='';} + + if ($campaign_allow_inbound > 0) + {echo "$NFB$out_total$NFE current active calls      \n";} + else + {echo "$NFB$out_total$NFE calls being placed       \n";} + + echo "$NFB$out_ring$NFE calls ringing         \n"; + echo "$NFB$F  $out_live $FG$NFE calls waiting for agents       \n"; + } + else + { + echo " NO LIVE CALLS WAITING \n"; + } + + +################################################################################### +###### TIME ON SYSTEM +################################################################################### + +$agent_incall=0; +$agent_ready=0; +$agent_paused=0; +$agent_total=0; + +$stmt="select extension,user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id from vicidial_live_agents where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + $agentcount=0; + while ($i < $talking_to_print) + { + $row=mysql_fetch_row($rslt); + if (eregi("READY|PAUSED",$row[3])) + { + $row[5]=$row[6]; + } + $Lstatus = $row[3]; + $status = sprintf("%-6s", $row[3]); + if (!eregi("INCALL|QUEUE",$row[3])) + {$call_time_S = ($STARTtime - $row[6]);} + else + {$call_time_S = ($STARTtime - $row[5]);} + + $call_time_M = ($call_time_S / 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"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + if (eregi("PAUSED",$row[3])) + { + if ($call_time_M_int >= 30) + {$i++; continue;} + else + { + $agent_paused++; $agent_total++; + } + } + + if ( (eregi("INCALL",$status)) or (eregi("QUEUE",$status)) ) {$agent_incall++; $agent_total++;} + if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) {$agent_ready++; $agent_total++;} + $agentcount++; + + + $i++; + } + + if ($agent_ready > 0) {$B=''; $BG='';} + if ($agent_ready > 4) {$B=''; $BG='';} + if ($agent_ready > 9) {$B=''; $BG='';} + if ($agent_ready > 14) {$B=''; $BG='';} + + echo "\n
\n"; + + echo "$NFB$agent_total$NFE agents logged in         \n"; + echo "$NFB$agent_incall$NFE agents in calls       \n"; + echo "$NFB$B  $agent_ready $BG$NFE agents waiting       \n"; + echo "$NFB$agent_paused$NFE paused agents       \n"; + + echo "
";
+		echo "";
+	}
+	else
+	{
+	echo " NO AGENTS ON CALLS
\n"; + } + +################################################################################ +### END calculating calls/agents +################################################################################ + + + + + +echo "
"; + +echo "\n\n"; +$k++; +} + +?> +
+ + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_timeoncall.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_timeoncall.php new file mode 100644 index 00000000..fc8eeced --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_timeoncall.php @@ -0,0 +1,180 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["reset_counter"])) {$reset_counter=$_GET["reset_counter"];} + elseif (isset($_POST["reset_counter"])) {$reset_counter=$_POST["reset_counter"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); + +?> + + + + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On Call\n"; +echo "
\n\n";
+
+echo "VICIDIAL: Time On Call                                          $NOW_TIME\n\n";
+echo "+------------+-----------+-----------+------------------+---------------------+---------+\n";
+echo "| STATION    | SESSIONID | CHANNEL   | NUMBER DIALED    | START TIME          | MINUTES |\n";
+echo "+------------+-----------+-----------+------------------+---------------------+---------+\n";
+
+$stmt="SELECT count(*) from live_sip_channels where server_ip='$server_ip';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$parked_count = $row[0];
+	if ($parked_count > 0)
+	{
+	$stmt="select extension from live_channels where server_ip='$server_ip';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$ext_to_print = mysql_num_rows($rslt);
+	$i=0;
+	$live_zap_counter=0;
+	$sessions = '';
+	while ($i < $ext_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if (preg_match("/^8600/i",$row[0]))
+			{
+			$sessions .= "$row[0]|";
+			}
+		$i++;
+		}
+	$sessions = preg_replace("/\|$/",'',$sessions);
+
+	if ($DB) {echo "SESSIONS: -$sessions-\n";}
+
+	$stmt="select * from live_sip_channels where server_ip='$server_ip' order by channel;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$parked_to_print = mysql_num_rows($rslt);
+	$i=0;
+	$live_calls_counter=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if ( (preg_match("/Zap\/|internal|ring/i",$row[3])) or (preg_match("/Local\//i",$row[0])) )
+			{
+			if ($DB) {echo "NOT STATION |$row[0]|$row[3]|\n";}
+			$session_id = '';
+			}
+		else 
+			{
+			if (preg_match("/$row[3]/i",$sessions))
+				{
+				if ($DB) {echo "LIVE STATION|$row[0]|$row[3]|\n";}
+				$session_id = $row[3];
+				$station = preg_replace("/SIP\//",'',$row[0]);
+				$station = preg_replace("/-.*/",'',$station);
+			
+				$LIVE_sessions[$live_calls_counter] =			"$session_id";
+				$LIVE_sessions_FORMAT[$live_calls_counter] =	sprintf("%-9s", $session_id);
+				$LIVE_stations[$live_calls_counter] =			"$station";
+				$LIVE_stations_FORMAT[$live_calls_counter] =	sprintf("%-10s", $station);
+
+		#		echo "| $station | $session_id | \n";
+
+				$live_calls_counter++;
+				}
+			else
+				{
+				if ($DB) {echo "NOT STATIONZ|$row[0]|$row[3]|\n";}
+				$session_id = '';
+				}
+			}
+
+		$i++;
+		}
+
+		if ($live_calls_counter > 0)
+		{
+		$i=0;
+		$LC_counter = $live_calls_counter;
+
+		while ($i < $live_calls_counter)
+			{
+			$stmt="select channel,extension,number_dialed,start_time,start_epoch from call_log where extension='$LIVE_stations[$i]' and server_ip='$server_ip' order by uniqueid desc LIMIT 1;";
+			$rslt=mysql_query($stmt, $link);
+			if ($DB) {echo "$stmt\n";}
+			$parked_to_print = mysql_num_rows($rslt);
+			$row=mysql_fetch_row($rslt);
+
+			$channel =			sprintf("%-9s", $row[0]);
+			$number_dialed =	sprintf("%-16s", $row[2]);
+			$start_time =		sprintf("%-19s", $row[3]);
+			$call_time_S = ($STARTtime - $row[4]);
+
+			$call_time_M = ($call_time_S / 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";
+			$call_time_MS =		sprintf("%7s", $call_time_MS);
+			$G = '';		$EG = '';
+			if ($call_time_M_int >= 12) {$G=''; $EG='';}
+			if ($call_time_M_int >= 31) {$G=''; $EG='';}
+
+			echo "| $G$LIVE_stations_FORMAT[$i]$EG | $G$LIVE_sessions_FORMAT[$i]$EG | $G$channel$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+			$i++;
+			}
+
+		echo "+------------+-----------+-----------+------------------+---------------------+---------+\n";
+		echo "  $i stations on live calls on server $server_ip\n\n";
+
+		echo "             - 12 minutes or more on live call\n";
+		echo "             - Over 30 minutes on live call\n";
+
+		}
+		else
+		{
+		echo "*****************************************************************************************\n";
+		echo "*****************************************************************************************\n";
+		echo "*************************************** NO LIVE STATIONS ********************************\n";
+		echo "*****************************************************************************************\n";
+		echo "*****************************************************************************************\n";
+		}
+
+	}
+	else
+	{
+	echo "*****************************************************************************************\n";
+	echo "*****************************************************************************************\n";
+	echo "*************************************** NO LIVE STATIONS ********************************\n";
+	echo "*****************************************************************************************\n";
+	echo "*****************************************************************************************\n";
+	}
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_timeonpark.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_timeonpark.php new file mode 100644 index 00000000..fd54a333 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/AST_timeonpark.php @@ -0,0 +1,219 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60620-1042 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["reset_counter"])) {$reset_counter=$_GET["reset_counter"];} + elseif (isset($_POST["reset_counter"])) {$reset_counter=$_POST["reset_counter"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +$timeONEhoursAGO = ($STARTtime - 3600); +$epochHALFhoursAGO = ($STARTtime - 1860); +$timeONEhoursAGO = date("Y-m-d H:i:s",$timeONEhoursAGO); +$timeHALFhoursAGO = date("Y-m-d H:i:s",$epochHALFhoursAGO); + +$reset_counter++; + +if ($reset_counter > 7) + { + $reset_counter=0; + + $stmt="update park_log set status='HUNGUP' where hangup_time is not null;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + + if ($DB) + { + $stmt="delete from park_log where status='TALKING' and grab_time < '$timeONEhoursAGO' and (hangup_time is null or hangup_time='');"; + $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + + $stmt="delete from park_log where status='PARKED' and parked_time < '$timeHALFhoursAGO' and (hangup_time is null or hangup_time='');"; + $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + + } + } + +?> + + + + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On Park\n"; +echo "
\n\n";
+
+echo "VICIDIAL: Time On Park         $NOW_TIME    REPORTS\n\n";
+echo "+------------+-----------------+---------------------+---------+\n";
+echo "| CHANNEL    | GROUP           | START TIME          | MINUTES |\n";
+echo "+------------+-----------------+---------------------+---------+\n";
+
+#$link=mysql_connect("localhost", "cron", "1234");
+# $linkX=mysql_connect("localhost", "cron", "1234");
+#mysql_select_db("asterisk");
+
+$stmt="select extension,user,channel,channel_group,parked_time,UNIX_TIMESTAMP(parked_time) from park_log where status ='PARKED' and server_ip='" . mysql_real_escape_string($server_ip) . "' order by uniqueid;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$parked_to_print = mysql_num_rows($rslt);
+	if ($parked_to_print > 0)
+	{
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$channel =			sprintf("%-10s", $row[2]);
+		$number_dialed =	sprintf("%-15s", $row[3]);
+		$start_time =		sprintf("%-19s", $row[4]);
+		$call_time_S = ($STARTtime - $row[5]);
+
+		$call_time_M = ($call_time_S / 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";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if ($call_time_M_int >= 1) {$G=''; $EG='';}
+		if ($call_time_M_int >= 6) {$G=''; $EG='';}
+
+		echo "| $G$channel$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------+-----------------+---------------------+---------+\n";
+		echo "  $i callers waiting on server $server_ip\n\n";
+
+		echo "             - 1 minute or more on hold\n";
+		echo "             - Over 5 minutes on hold\n";
+
+		}
+	else
+	{
+	echo "****************************************************************\n";
+	echo "****************************************************************\n";
+	echo "******************** NO LIVE CALLS WAITING *********************\n";
+	echo "****************************************************************\n";
+	echo "****************************************************************\n";
+	}
+
+###################################################################################
+###### TIME ON INBOUND CALLS
+###################################################################################
+echo "\n\n";
+echo "----------------------------------------------------------------------------------------";
+echo "\n\n";
+echo "VICIDIAL: Agents Time On Inbound Calls                             $NOW_TIME\n\n";
+echo "+------------|--------+------------+-----------------+---------------------+---------+\n";
+echo "| STATION    | USER   | CHANNEL    | GROUP           | START TIME          | MINUTES |\n";
+echo "+------------|--------+------------+-----------------+---------------------+---------+\n";
+
+
+$stmt="select extension,user,channel,channel_group,grab_time,UNIX_TIMESTAMP(grab_time) from park_log where status ='TALKING' and server_ip='" . mysql_real_escape_string($server_ip) . "' order by uniqueid;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$talking_to_print = mysql_num_rows($rslt);
+	if ($talking_to_print > 0)
+	{
+	$i=0;
+	while ($i < $talking_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$extension =		sprintf("%-10s", $row[0]);
+		$user =				sprintf("%-6s", $row[1]);
+		$channel =			sprintf("%-10s", $row[2]);
+		$number_dialed =	sprintf("%-15s", $row[3]);
+		$start_time =		sprintf("%-19s", $row[4]);
+		$call_time_S = ($STARTtime - $row[5]);
+
+		$call_time_M = ($call_time_S / 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";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if ($call_time_M_int >= 12) {$G=''; $EG='';}
+		if ($call_time_M_int >= 31) {$G=''; $EG='';}
+
+		echo "| $G$extension$EG | $G$user$EG | $G$channel$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------|--------+------------+-----------------+---------------------+---------+\n";
+		echo "  $i agents on calls on server $server_ip\n\n";
+
+		echo "             - 12 minutes or more on call\n";
+		echo "             - Over 30 minutes on call\n";
+
+	}
+	else
+	{
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	echo "********************************* NO AGENTS ON CALLS *********************************\n";
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	}
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/admin.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/admin.php new file mode 100644 index 00000000..7fc0228a --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/admin.php @@ -0,0 +1,13575 @@ + LICENSE: GPLv2 +# + + +require("dbconnect.php"); + + +###################################################################################################### +###################################################################################################### +####### static variable settings for display options +###################################################################################################### +###################################################################################################### + +$page_width='770'; +$section_width='720'; +$header_font_size='3'; +$subheader_font_size='2'; +$subcamp_font_size='2'; +$header_selected_bold=''; +$header_nonselected_bold=''; +$users_color = '#FFFF99'; +$campaigns_color = '#FFCC99'; +$lists_color = '#FFCCCC'; +$ingroups_color = '#CC99FF'; +$remoteagent_color ='#CCFFCC'; +$usergroups_color = '#CCFFFF'; +$scripts_color = '#99FFCC'; +$filters_color = '#CCCCCC'; +$admin_color = '#FF99FF'; +$reports_color = '#99FF33'; +#$users_color = '#FFFF99'; +#$campaigns_color = '#FFFF99'; +#$lists_color = '#FFFF99'; +#$ingroups_color = '#FFFF99'; +#$remoteagent_color ='#FFFF99'; +#$usergroups_color = '#FFFF99'; +#$scripts_color = '#FFFF99'; +#$filters_color = '#FFFF99'; +#$admin_color = '#FFFF99'; +#$reports_color = '#FFFF99'; + $times_color = '#FF33FF'; + $phones_color = '#FF33FF'; + $conference_color = '#FF33FF'; + $server_color = '#FF33FF'; + $settings_color = '#FF33FF'; + $status_color = '#FF33FF'; +$users_font = 'BLACK'; +$campaigns_font = 'BLACK'; +$lists_font = 'BLACK'; +$ingroups_font = 'BLACK'; +$remoteagent_font = 'BLACK'; +$usergroups_font = 'BLACK'; +$scripts_font = 'BLACK'; +$filters_font = 'BLACK'; +$admin_font = 'BLACK'; +$reports_font = 'BLACK'; + $times_font = 'BLACK'; + $phones_font = 'BLACK'; + $conference_font = 'BLACK'; + $server_font = 'BLACK'; + $settings_font = 'BLACK'; + $status_font = 'BLACK'; +$subcamp_color = '#FF9933'; +$subcamp_font = 'BLACK'; + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; + +###################################################################################################### +###################################################################################################### +####### Form variable declaration +###################################################################################################### +###################################################################################################### + + +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["active"])) {$active=$_GET["active"];} + elseif (isset($_POST["active"])) {$active=$_POST["active"];} +if (isset($_GET["adaptive_dl_diff_target"])) {$adaptive_dl_diff_target=$_GET["adaptive_dl_diff_target"];} + elseif (isset($_POST["adaptive_dl_diff_target"])) {$adaptive_dl_diff_target=$_POST["adaptive_dl_diff_target"];} +if (isset($_GET["adaptive_dropped_percentage"])) {$adaptive_dropped_percentage=$_GET["adaptive_dropped_percentage"];} + elseif (isset($_POST["adaptive_dropped_percentage"])){$adaptive_dropped_percentage=$_POST["adaptive_dropped_percentage"];} +if (isset($_GET["adaptive_intensity"])) {$adaptive_intensity=$_GET["adaptive_intensity"];} + elseif (isset($_POST["adaptive_intensity"])) {$adaptive_intensity=$_POST["adaptive_intensity"];} +if (isset($_GET["adaptive_latest_server_time"])) {$adaptive_latest_server_time=$_GET["adaptive_latest_server_time"];} + elseif (isset($_POST["adaptive_latest_server_time"])){$adaptive_latest_server_time=$_POST["adaptive_latest_server_time"];} +if (isset($_GET["adaptive_maximum_level"])) {$adaptive_maximum_level=$_GET["adaptive_maximum_level"];} + elseif (isset($_POST["adaptive_maximum_level"])) {$adaptive_maximum_level=$_POST["adaptive_maximum_level"];} +if (isset($_GET["SUB"])) {$SUB=$_GET["SUB"];} + elseif (isset($_POST["SUB"])) {$SUB=$_POST["SUB"];} +if (isset($_GET["ADD"])) {$ADD=$_GET["ADD"];} + elseif (isset($_POST["ADD"])) {$ADD=$_POST["ADD"];} +if (isset($_GET["admin_hangup_enabled"])) {$admin_hangup_enabled=$_GET["admin_hangup_enabled"];} + elseif (isset($_POST["admin_hangup_enabled"])) {$admin_hangup_enabled=$_POST["admin_hangup_enabled"];} +if (isset($_GET["admin_hijack_enabled"])) {$admin_hijack_enabled=$_GET["admin_hijack_enabled"];} + elseif (isset($_POST["admin_hijack_enabled"])) {$admin_hijack_enabled=$_POST["admin_hijack_enabled"];} +if (isset($_GET["admin_monitor_enabled"])) {$admin_monitor_enabled=$_GET["admin_monitor_enabled"];} + elseif (isset($_POST["admin_monitor_enabled"])) {$admin_monitor_enabled=$_POST["admin_monitor_enabled"];} +if (isset($_GET["AFLogging_enabled"])) {$AFLogging_enabled=$_GET["AFLogging_enabled"];} + elseif (isset($_POST["AFLogging_enabled"])) {$AFLogging_enabled=$_POST["AFLogging_enabled"];} +if (isset($_GET["agent_choose_ingroups"])) {$agent_choose_ingroups=$_GET["agent_choose_ingroups"];} + elseif (isset($_POST["agent_choose_ingroups"])) {$agent_choose_ingroups=$_POST["agent_choose_ingroups"];} +if (isset($_GET["agentcall_manual"])) {$agentcall_manual=$_GET["agentcall_manual"];} + elseif (isset($_POST["agentcall_manual"])) {$agentcall_manual=$_POST["agentcall_manual"];} +if (isset($_GET["agentonly_callbacks"])) {$agentonly_callbacks=$_GET["agentonly_callbacks"];} + elseif (isset($_POST["agentonly_callbacks"])) {$agentonly_callbacks=$_POST["agentonly_callbacks"];} +if (isset($_GET["AGI_call_logging_enabled"])) {$AGI_call_logging_enabled=$_GET["AGI_call_logging_enabled"];} + elseif (isset($_POST["AGI_call_logging_enabled"])) {$AGI_call_logging_enabled=$_POST["AGI_call_logging_enabled"];} +if (isset($_GET["agi_output"])) {$agi_output=$_GET["agi_output"];} + elseif (isset($_POST["agi_output"])) {$agi_output=$_POST["agi_output"];} +if (isset($_GET["allcalls_delay"])) {$allcalls_delay=$_GET["allcalls_delay"];} + elseif (isset($_POST["allcalls_delay"])) {$allcalls_delay=$_POST["allcalls_delay"];} +if (isset($_GET["allow_closers"])) {$allow_closers=$_GET["allow_closers"];} + elseif (isset($_POST["allow_closers"])) {$allow_closers=$_POST["allow_closers"];} +if (isset($_GET["alt_number_dialing"])) {$alt_number_dialing=$_GET["alt_number_dialing"];} + elseif (isset($_POST["alt_number_dialing"])) {$alt_number_dialing=$_POST["alt_number_dialing"];} +if (isset($_GET["alter_agent_interface_options"])) {$alter_agent_interface_options=$_GET["alter_agent_interface_options"];} + elseif (isset($_POST["alter_agent_interface_options"])) {$alter_agent_interface_options=$_POST["alter_agent_interface_options"];} +if (isset($_GET["am_message_exten"])) {$am_message_exten=$_GET["am_message_exten"];} + elseif (isset($_POST["am_message_exten"])) {$am_message_exten=$_POST["am_message_exten"];} +if (isset($_GET["amd_send_to_vmx"])) {$amd_send_to_vmx=$_GET["amd_send_to_vmx"];} + elseif (isset($_POST["amd_send_to_vmx"])) {$amd_send_to_vmx=$_POST["amd_send_to_vmx"];} +if (isset($_GET["answer_transfer_agent"])) {$answer_transfer_agent=$_GET["answer_transfer_agent"];} + elseif (isset($_POST["answer_transfer_agent"])) {$answer_transfer_agent=$_POST["answer_transfer_agent"];} +if (isset($_GET["ast_admin_access"])) {$ast_admin_access=$_GET["ast_admin_access"];} + elseif (isset($_POST["ast_admin_access"])) {$ast_admin_access=$_POST["ast_admin_access"];} +if (isset($_GET["ast_delete_phones"])) {$ast_delete_phones=$_GET["ast_delete_phones"];} + elseif (isset($_POST["ast_delete_phones"])) {$ast_delete_phones=$_POST["ast_delete_phones"];} +if (isset($_GET["asterisk_version"])) {$asterisk_version=$_GET["asterisk_version"];} + elseif (isset($_POST["asterisk_version"])) {$asterisk_version=$_POST["asterisk_version"];} +if (isset($_GET["ASTmgrSECRET"])) {$ASTmgrSECRET=$_GET["ASTmgrSECRET"];} + elseif (isset($_POST["ASTmgrSECRET"])) {$ASTmgrSECRET=$_POST["ASTmgrSECRET"];} +if (isset($_GET["ASTmgrUSERNAME"])) {$ASTmgrUSERNAME=$_GET["ASTmgrUSERNAME"];} + elseif (isset($_POST["ASTmgrUSERNAME"])) {$ASTmgrUSERNAME=$_POST["ASTmgrUSERNAME"];} +if (isset($_GET["ASTmgrUSERNAMElisten"])) {$ASTmgrUSERNAMElisten=$_GET["ASTmgrUSERNAMElisten"];} + elseif (isset($_POST["ASTmgrUSERNAMElisten"])) {$ASTmgrUSERNAMElisten=$_POST["ASTmgrUSERNAMElisten"];} +if (isset($_GET["ASTmgrUSERNAMEsend"])) {$ASTmgrUSERNAMEsend=$_GET["ASTmgrUSERNAMEsend"];} + elseif (isset($_POST["ASTmgrUSERNAMEsend"])) {$ASTmgrUSERNAMEsend=$_POST["ASTmgrUSERNAMEsend"];} +if (isset($_GET["ASTmgrUSERNAMEupdate"])) {$ASTmgrUSERNAMEupdate=$_GET["ASTmgrUSERNAMEupdate"];} + elseif (isset($_POST["ASTmgrUSERNAMEupdate"])) {$ASTmgrUSERNAMEupdate=$_POST["ASTmgrUSERNAMEupdate"];} +if (isset($_GET["attempt_delay"])) {$attempt_delay=$_GET["attempt_delay"];} + elseif (isset($_POST["attempt_delay"])) {$attempt_delay=$_POST["attempt_delay"];} +if (isset($_GET["attempt_maximum"])) {$attempt_maximum=$_GET["attempt_maximum"];} + elseif (isset($_POST["attempt_maximum"])) {$attempt_maximum=$_POST["attempt_maximum"];} +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["auto_dial_next_number"])) {$auto_dial_next_number=$_GET["auto_dial_next_number"];} + elseif (isset($_POST["auto_dial_next_number"])) {$auto_dial_next_number=$_POST["auto_dial_next_number"];} +if (isset($_GET["available_only_ratio_tally"])) {$available_only_ratio_tally=$_GET["available_only_ratio_tally"];} + elseif (isset($_POST["available_only_ratio_tally"])){$available_only_ratio_tally=$_POST["available_only_ratio_tally"];} +if (isset($_GET["call_out_number_group"])) {$call_out_number_group=$_GET["call_out_number_group"];} + elseif (isset($_POST["call_out_number_group"])) {$call_out_number_group=$_POST["call_out_number_group"];} +if (isset($_GET["call_parking_enabled"])) {$call_parking_enabled=$_GET["call_parking_enabled"];} + elseif (isset($_POST["call_parking_enabled"])) {$call_parking_enabled=$_POST["call_parking_enabled"];} +if (isset($_GET["call_time_comments"])) {$call_time_comments=$_GET["call_time_comments"];} + elseif (isset($_POST["call_time_comments"])) {$call_time_comments=$_POST["call_time_comments"];} +if (isset($_GET["call_time_id"])) {$call_time_id=$_GET["call_time_id"];} + elseif (isset($_POST["call_time_id"])) {$call_time_id=$_POST["call_time_id"];} +if (isset($_GET["call_time_name"])) {$call_time_name=$_GET["call_time_name"];} + elseif (isset($_POST["call_time_name"])) {$call_time_name=$_POST["call_time_name"];} +if (isset($_GET["CallerID_popup_enabled"])) {$CallerID_popup_enabled=$_GET["CallerID_popup_enabled"];} + elseif (isset($_POST["CallerID_popup_enabled"])) {$CallerID_popup_enabled=$_POST["CallerID_popup_enabled"];} +if (isset($_GET["campaign_cid"])) {$campaign_cid=$_GET["campaign_cid"];} + elseif (isset($_POST["campaign_cid"])) {$campaign_cid=$_POST["campaign_cid"];} +if (isset($_GET["campaign_detail"])) {$campaign_detail=$_GET["campaign_detail"];} + elseif (isset($_POST["campaign_detail"])) {$campaign_detail=$_POST["campaign_detail"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["campaign_name"])) {$campaign_name=$_GET["campaign_name"];} + elseif (isset($_POST["campaign_name"])) {$campaign_name=$_POST["campaign_name"];} +if (isset($_GET["campaign_rec_exten"])) {$campaign_rec_exten=$_GET["campaign_rec_exten"];} + elseif (isset($_POST["campaign_rec_exten"])) {$campaign_rec_exten=$_POST["campaign_rec_exten"];} +if (isset($_GET["campaign_rec_filename"])) {$campaign_rec_filename=$_GET["campaign_rec_filename"];} + elseif (isset($_POST["campaign_rec_filename"])) {$campaign_rec_filename=$_POST["campaign_rec_filename"];} +if (isset($_GET["campaign_recording"])) {$campaign_recording=$_GET["campaign_recording"];} + elseif (isset($_POST["campaign_recording"])) {$campaign_recording=$_POST["campaign_recording"];} +if (isset($_GET["campaign_vdad_exten"])) {$campaign_vdad_exten=$_GET["campaign_vdad_exten"];} + elseif (isset($_POST["campaign_vdad_exten"])) {$campaign_vdad_exten=$_POST["campaign_vdad_exten"];} +if (isset($_GET["change_agent_campaign"])) {$change_agent_campaign=$_GET["change_agent_campaign"];} + elseif (isset($_POST["change_agent_campaign"])) {$change_agent_campaign=$_POST["change_agent_campaign"];} +if (isset($_GET["client_browser"])) {$client_browser=$_GET["client_browser"];} + elseif (isset($_POST["client_browser"])) {$client_browser=$_POST["client_browser"];} +if (isset($_GET["closer_default_blended"])) {$closer_default_blended=$_GET["closer_default_blended"];} + elseif (isset($_POST["closer_default_blended"])) {$closer_default_blended=$_POST["closer_default_blended"];} +if (isset($_GET["company"])) {$company=$_GET["company"];} + elseif (isset($_POST["company"])) {$company=$_POST["company"];} +if (isset($_GET["computer_ip"])) {$computer_ip=$_GET["computer_ip"];} + elseif (isset($_POST["computer_ip"])) {$computer_ip=$_POST["computer_ip"];} +if (isset($_GET["conf_exten"])) {$conf_exten=$_GET["conf_exten"];} + elseif (isset($_POST["conf_exten"])) {$conf_exten=$_POST["conf_exten"];} +if (isset($_GET["conf_on_extension"])) {$conf_on_extension=$_GET["conf_on_extension"];} + elseif (isset($_POST["conf_on_extension"])) {$conf_on_extension=$_POST["conf_on_extension"];} +if (isset($_GET["conferencing_enabled"])) {$conferencing_enabled=$_GET["conferencing_enabled"];} + elseif (isset($_POST["conferencing_enabled"])) {$conferencing_enabled=$_POST["conferencing_enabled"];} +if (isset($_GET["CoNfIrM"])) {$CoNfIrM=$_GET["CoNfIrM"];} + elseif (isset($_POST["CoNfIrM"])) {$CoNfIrM=$_POST["CoNfIrM"];} +if (isset($_GET["ct_default_start"])) {$ct_default_start=$_GET["ct_default_start"];} + elseif (isset($_POST["ct_default_start"])) {$ct_default_start=$_POST["ct_default_start"];} +if (isset($_GET["ct_default_stop"])) {$ct_default_stop=$_GET["ct_default_stop"];} + elseif (isset($_POST["ct_default_stop"])) {$ct_default_stop=$_POST["ct_default_stop"];} +if (isset($_GET["ct_friday_start"])) {$ct_friday_start=$_GET["ct_friday_start"];} + elseif (isset($_POST["ct_friday_start"])) {$ct_friday_start=$_POST["ct_friday_start"];} +if (isset($_GET["ct_friday_stop"])) {$ct_friday_stop=$_GET["ct_friday_stop"];} + elseif (isset($_POST["ct_friday_stop"])) {$ct_friday_stop=$_POST["ct_friday_stop"];} +if (isset($_GET["ct_monday_start"])) {$ct_monday_start=$_GET["ct_monday_start"];} + elseif (isset($_POST["ct_monday_start"])) {$ct_monday_start=$_POST["ct_monday_start"];} +if (isset($_GET["ct_monday_stop"])) {$ct_monday_stop=$_GET["ct_monday_stop"];} + elseif (isset($_POST["ct_monday_stop"])) {$ct_monday_stop=$_POST["ct_monday_stop"];} +if (isset($_GET["ct_saturday_start"])) {$ct_saturday_start=$_GET["ct_saturday_start"];} + elseif (isset($_POST["ct_saturday_start"])) {$ct_saturday_start=$_POST["ct_saturday_start"];} +if (isset($_GET["ct_saturday_stop"])) {$ct_saturday_stop=$_GET["ct_saturday_stop"];} + elseif (isset($_POST["ct_saturday_stop"])) {$ct_saturday_stop=$_POST["ct_saturday_stop"];} +if (isset($_GET["ct_sunday_start"])) {$ct_sunday_start=$_GET["ct_sunday_start"];} + elseif (isset($_POST["ct_sunday_start"])) {$ct_sunday_start=$_POST["ct_sunday_start"];} +if (isset($_GET["ct_sunday_stop"])) {$ct_sunday_stop=$_GET["ct_sunday_stop"];} + elseif (isset($_POST["ct_sunday_stop"])) {$ct_sunday_stop=$_POST["ct_sunday_stop"];} +if (isset($_GET["ct_thursday_start"])) {$ct_thursday_start=$_GET["ct_thursday_start"];} + elseif (isset($_POST["ct_thursday_start"])) {$ct_thursday_start=$_POST["ct_thursday_start"];} +if (isset($_GET["ct_thursday_stop"])) {$ct_thursday_stop=$_GET["ct_thursday_stop"];} + elseif (isset($_POST["ct_thursday_stop"])) {$ct_thursday_stop=$_POST["ct_thursday_stop"];} +if (isset($_GET["ct_tuesday_start"])) {$ct_tuesday_start=$_GET["ct_tuesday_start"];} + elseif (isset($_POST["ct_tuesday_start"])) {$ct_tuesday_start=$_POST["ct_tuesday_start"];} +if (isset($_GET["ct_tuesday_stop"])) {$ct_tuesday_stop=$_GET["ct_tuesday_stop"];} + elseif (isset($_POST["ct_tuesday_stop"])) {$ct_tuesday_stop=$_POST["ct_tuesday_stop"];} +if (isset($_GET["ct_wednesday_start"])) {$ct_wednesday_start=$_GET["ct_wednesday_start"];} + elseif (isset($_POST["ct_wednesday_start"])) {$ct_wednesday_start=$_POST["ct_wednesday_start"];} +if (isset($_GET["ct_wednesday_stop"])) {$ct_wednesday_stop=$_GET["ct_wednesday_stop"];} + elseif (isset($_POST["ct_wednesday_stop"])) {$ct_wednesday_stop=$_POST["ct_wednesday_stop"];} +if (isset($_GET["DBX_database"])) {$DBX_database=$_GET["DBX_database"];} + elseif (isset($_POST["DBX_database"])) {$DBX_database=$_POST["DBX_database"];} +if (isset($_GET["DBX_pass"])) {$DBX_pass=$_GET["DBX_pass"];} + elseif (isset($_POST["DBX_pass"])) {$DBX_pass=$_POST["DBX_pass"];} +if (isset($_GET["DBX_port"])) {$DBX_port=$_GET["DBX_port"];} + elseif (isset($_POST["DBX_port"])) {$DBX_port=$_POST["DBX_port"];} +if (isset($_GET["DBX_server"])) {$DBX_server=$_GET["DBX_server"];} + elseif (isset($_POST["DBX_server"])) {$DBX_server=$_POST["DBX_server"];} +if (isset($_GET["DBX_user"])) {$DBX_user=$_GET["DBX_user"];} + elseif (isset($_POST["DBX_user"])) {$DBX_user=$_POST["DBX_user"];} +if (isset($_GET["DBY_database"])) {$DBY_database=$_GET["DBY_database"];} + elseif (isset($_POST["DBY_database"])) {$DBY_database=$_POST["DBY_database"];} +if (isset($_GET["DBY_pass"])) {$DBY_pass=$_GET["DBY_pass"];} + elseif (isset($_POST["DBY_pass"])) {$DBY_pass=$_POST["DBY_pass"];} +if (isset($_GET["DBY_port"])) {$DBY_port=$_GET["DBY_port"];} + elseif (isset($_POST["DBY_port"])) {$DBY_port=$_POST["DBY_port"];} +if (isset($_GET["DBY_server"])) {$DBY_server=$_GET["DBY_server"];} + elseif (isset($_POST["DBY_server"])) {$DBY_server=$_POST["DBY_server"];} +if (isset($_GET["DBY_user"])) {$DBY_user=$_GET["DBY_user"];} + elseif (isset($_POST["DBY_user"])) {$DBY_user=$_POST["DBY_user"];} +if (isset($_GET["delete_call_times"])) {$delete_call_times=$_GET["delete_call_times"];} + elseif (isset($_POST["delete_call_times"])) {$delete_call_times=$_POST["delete_call_times"];} +if (isset($_GET["delete_campaigns"])) {$delete_campaigns=$_GET["delete_campaigns"];} + elseif (isset($_POST["delete_campaigns"])) {$delete_campaigns=$_POST["delete_campaigns"];} +if (isset($_GET["delete_filters"])) {$delete_filters=$_GET["delete_filters"];} + elseif (isset($_POST["delete_filters"])) {$delete_filters=$_POST["delete_filters"];} +if (isset($_GET["delete_ingroups"])) {$delete_ingroups=$_GET["delete_ingroups"];} + elseif (isset($_POST["delete_ingroups"])) {$delete_ingroups=$_POST["delete_ingroups"];} +if (isset($_GET["delete_lists"])) {$delete_lists=$_GET["delete_lists"];} + elseif (isset($_POST["delete_lists"])) {$delete_lists=$_POST["delete_lists"];} +if (isset($_GET["delete_remote_agents"])) {$delete_remote_agents=$_GET["delete_remote_agents"];} + elseif (isset($_POST["delete_remote_agents"])) {$delete_remote_agents=$_POST["delete_remote_agents"];} +if (isset($_GET["delete_scripts"])) {$delete_scripts=$_GET["delete_scripts"];} + elseif (isset($_POST["delete_scripts"])) {$delete_scripts=$_POST["delete_scripts"];} +if (isset($_GET["delete_user_groups"])) {$delete_user_groups=$_GET["delete_user_groups"];} + elseif (isset($_POST["delete_user_groups"])) {$delete_user_groups=$_POST["delete_user_groups"];} +if (isset($_GET["delete_users"])) {$delete_users=$_GET["delete_users"];} + elseif (isset($_POST["delete_users"])) {$delete_users=$_POST["delete_users"];} +if (isset($_GET["dial_method"])) {$dial_method=$_GET["dial_method"];} + elseif (isset($_POST["dial_method"])) {$dial_method=$_POST["dial_method"];} +if (isset($_GET["dial_prefix"])) {$dial_prefix=$_GET["dial_prefix"];} + elseif (isset($_POST["dial_prefix"])) {$dial_prefix=$_POST["dial_prefix"];} +if (isset($_GET["dial_status_a"])) {$dial_status_a=$_GET["dial_status_a"];} + elseif (isset($_POST["dial_status_a"])) {$dial_status_a=$_POST["dial_status_a"];} +if (isset($_GET["dial_status_b"])) {$dial_status_b=$_GET["dial_status_b"];} + elseif (isset($_POST["dial_status_b"])) {$dial_status_b=$_POST["dial_status_b"];} +if (isset($_GET["dial_status_c"])) {$dial_status_c=$_GET["dial_status_c"];} + elseif (isset($_POST["dial_status_c"])) {$dial_status_c=$_POST["dial_status_c"];} +if (isset($_GET["dial_status_d"])) {$dial_status_d=$_GET["dial_status_d"];} + elseif (isset($_POST["dial_status_d"])) {$dial_status_d=$_POST["dial_status_d"];} +if (isset($_GET["dial_status_e"])) {$dial_status_e=$_GET["dial_status_e"];} + elseif (isset($_POST["dial_status_e"])) {$dial_status_e=$_POST["dial_status_e"];} +if (isset($_GET["dial_timeout"])) {$dial_timeout=$_GET["dial_timeout"];} + elseif (isset($_POST["dial_timeout"])) {$dial_timeout=$_POST["dial_timeout"];} +if (isset($_GET["dialplan_number"])) {$dialplan_number=$_GET["dialplan_number"];} + elseif (isset($_POST["dialplan_number"])) {$dialplan_number=$_POST["dialplan_number"];} +if (isset($_GET["drop_call_seconds"])) {$drop_call_seconds=$_GET["drop_call_seconds"];} + elseif (isset($_POST["drop_call_seconds"])) {$drop_call_seconds=$_POST["drop_call_seconds"];} +if (isset($_GET["drop_exten"])) {$drop_exten=$_GET["drop_exten"];} + elseif (isset($_POST["drop_exten"])) {$drop_exten=$_POST["drop_exten"];} +if (isset($_GET["drop_message"])) {$drop_message=$_GET["drop_message"];} + elseif (isset($_POST["drop_message"])) {$drop_message=$_POST["drop_message"];} +if (isset($_GET["dtmf_send_extension"])) {$dtmf_send_extension=$_GET["dtmf_send_extension"];} + elseif (isset($_POST["dtmf_send_extension"])) {$dtmf_send_extension=$_POST["dtmf_send_extension"];} +if (isset($_GET["enable_fast_refresh"])) {$enable_fast_refresh=$_GET["enable_fast_refresh"];} + elseif (isset($_POST["enable_fast_refresh"])) {$enable_fast_refresh=$_POST["enable_fast_refresh"];} +if (isset($_GET["enable_persistant_mysql"])) {$enable_persistant_mysql=$_GET["enable_persistant_mysql"];} + elseif (isset($_POST["enable_persistant_mysql"])) {$enable_persistant_mysql=$_POST["enable_persistant_mysql"];} +if (isset($_GET["ext_context"])) {$ext_context=$_GET["ext_context"];} + elseif (isset($_POST["ext_context"])) {$ext_context=$_POST["ext_context"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["fast_refresh_rate"])) {$fast_refresh_rate=$_GET["fast_refresh_rate"];} + elseif (isset($_POST["fast_refresh_rate"])) {$fast_refresh_rate=$_POST["fast_refresh_rate"];} +if (isset($_GET["force_logout"])) {$force_logout=$_GET["force_logout"];} + elseif (isset($_POST["force_logout"])) {$force_logout=$_POST["force_logout"];} +if (isset($_GET["fronter_display"])) {$fronter_display=$_GET["fronter_display"];} + elseif (isset($_POST["fronter_display"])) {$fronter_display=$_POST["fronter_display"];} +if (isset($_GET["full_name"])) {$full_name=$_GET["full_name"];} + elseif (isset($_POST["full_name"])) {$full_name=$_POST["full_name"];} +if (isset($_GET["fullname"])) {$fullname=$_GET["fullname"];} + elseif (isset($_POST["fullname"])) {$fullname=$_POST["fullname"];} +if (isset($_GET["get_call_launch"])) {$get_call_launch=$_GET["get_call_launch"];} + elseif (isset($_POST["get_call_launch"])) {$get_call_launch=$_POST["get_call_launch"];} +if (isset($_GET["group_color"])) {$group_color=$_GET["group_color"];} + elseif (isset($_POST["group_color"])) {$group_color=$_POST["group_color"];} +if (isset($_GET["group_id"])) {$group_id=$_GET["group_id"];} + elseif (isset($_POST["group_id"])) {$group_id=$_POST["group_id"];} +if (isset($_GET["group_name"])) {$group_name=$_GET["group_name"];} + elseif (isset($_POST["group_name"])) {$group_name=$_POST["group_name"];} +if (isset($_GET["groups"])) {$groups=$_GET["groups"];} + elseif (isset($_POST["groups"])) {$groups=$_POST["groups"];} +if (isset($_GET["XFERgroups"])) {$XFERgroups=$_GET["XFERgroups"];} + elseif (isset($_POST["XFERgroups"])) {$XFERgroups=$_POST["XFERgroups"];} +if (isset($_GET["HKstatus"])) {$HKstatus=$_GET["HKstatus"];} + elseif (isset($_POST["HKstatus"])) {$HKstatus=$_POST["HKstatus"];} +if (isset($_GET["hopper_level"])) {$hopper_level=$_GET["hopper_level"];} + elseif (isset($_POST["hopper_level"])) {$hopper_level=$_POST["hopper_level"];} +if (isset($_GET["hotkey"])) {$hotkey=$_GET["hotkey"];} + elseif (isset($_POST["hotkey"])) {$hotkey=$_POST["hotkey"];} +if (isset($_GET["hotkeys_active"])) {$hotkeys_active=$_GET["hotkeys_active"];} + elseif (isset($_POST["hotkeys_active"])) {$hotkeys_active=$_POST["hotkeys_active"];} +if (isset($_GET["install_directory"])) {$install_directory=$_GET["install_directory"];} + elseif (isset($_POST["install_directory"])) {$install_directory=$_POST["install_directory"];} +if (isset($_GET["lead_filter_comments"])) {$lead_filter_comments=$_GET["lead_filter_comments"];} + elseif (isset($_POST["lead_filter_comments"])) {$lead_filter_comments=$_POST["lead_filter_comments"];} +if (isset($_GET["lead_filter_id"])) {$lead_filter_id=$_GET["lead_filter_id"];} + elseif (isset($_POST["lead_filter_id"])) {$lead_filter_id=$_POST["lead_filter_id"];} +if (isset($_GET["lead_filter_name"])) {$lead_filter_name=$_GET["lead_filter_name"];} + elseif (isset($_POST["lead_filter_name"])) {$lead_filter_name=$_POST["lead_filter_name"];} +if (isset($_GET["lead_filter_sql"])) {$lead_filter_sql=$_GET["lead_filter_sql"];} + elseif (isset($_POST["lead_filter_sql"])) {$lead_filter_sql=$_POST["lead_filter_sql"];} +if (isset($_GET["lead_order"])) {$lead_order=$_GET["lead_order"];} + elseif (isset($_POST["lead_order"])) {$lead_order=$_POST["lead_order"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["list_name"])) {$list_name=$_GET["list_name"];} + elseif (isset($_POST["list_name"])) {$list_name=$_POST["list_name"];} +if (isset($_GET["load_leads"])) {$load_leads=$_GET["load_leads"];} + elseif (isset($_POST["load_leads"])) {$load_leads=$_POST["load_leads"];} +if (isset($_GET["local_call_time"])) {$local_call_time=$_GET["local_call_time"];} + elseif (isset($_POST["local_call_time"])) {$local_call_time=$_POST["local_call_time"];} +if (isset($_GET["local_gmt"])) {$local_gmt=$_GET["local_gmt"];} + elseif (isset($_POST["local_gmt"])) {$local_gmt=$_POST["local_gmt"];} +if (isset($_GET["local_web_callerID_URL"])) {$local_web_callerID_URL=$_GET["local_web_callerID_URL"];} + elseif (isset($_POST["local_web_callerID_URL"])) {$local_web_callerID_URL=$_POST["local_web_callerID_URL"];} +if (isset($_GET["login"])) {$login=$_GET["login"];} + elseif (isset($_POST["login"])) {$login=$_POST["login"];} +if (isset($_GET["login_campaign"])) {$login_campaign=$_GET["login_campaign"];} + elseif (isset($_POST["login_campaign"])) {$login_campaign=$_POST["login_campaign"];} +if (isset($_GET["login_pass"])) {$login_pass=$_GET["login_pass"];} + elseif (isset($_POST["login_pass"])) {$login_pass=$_POST["login_pass"];} +if (isset($_GET["login_user"])) {$login_user=$_GET["login_user"];} + elseif (isset($_POST["login_user"])) {$login_user=$_POST["login_user"];} +if (isset($_GET["max_vicidial_trunks"])) {$max_vicidial_trunks=$_GET["max_vicidial_trunks"];} + elseif (isset($_POST["max_vicidial_trunks"])) {$max_vicidial_trunks=$_POST["max_vicidial_trunks"];} +if (isset($_GET["modify_call_times"])) {$modify_call_times=$_GET["modify_call_times"];} + elseif (isset($_POST["modify_call_times"])) {$modify_call_times=$_POST["modify_call_times"];} +if (isset($_GET["modify_leads"])) {$modify_leads=$_GET["modify_leads"];} + elseif (isset($_POST["modify_leads"])) {$modify_leads=$_POST["modify_leads"];} +if (isset($_GET["monitor_prefix"])) {$monitor_prefix=$_GET["monitor_prefix"];} + elseif (isset($_POST["monitor_prefix"])) {$monitor_prefix=$_POST["monitor_prefix"];} +if (isset($_GET["next_agent_call"])) {$next_agent_call=$_GET["next_agent_call"];} + elseif (isset($_POST["next_agent_call"])) {$next_agent_call=$_POST["next_agent_call"];} +if (isset($_GET["number_of_lines"])) {$number_of_lines=$_GET["number_of_lines"];} + elseif (isset($_POST["number_of_lines"])) {$number_of_lines=$_POST["number_of_lines"];} +if (isset($_GET["old_campaign_id"])) {$old_campaign_id=$_GET["old_campaign_id"];} + elseif (isset($_POST["old_campaign_id"])) {$old_campaign_id=$_POST["old_campaign_id"];} +if (isset($_GET["old_conf_exten"])) {$old_conf_exten=$_GET["old_conf_exten"];} + elseif (isset($_POST["old_conf_exten"])) {$old_conf_exten=$_POST["old_conf_exten"];} +if (isset($_GET["old_extension"])) {$old_extension=$_GET["old_extension"];} + elseif (isset($_POST["old_extension"])) {$old_extension=$_POST["old_extension"];} +if (isset($_GET["old_server_id"])) {$old_server_id=$_GET["old_server_id"];} + elseif (isset($_POST["old_server_id"])) {$old_server_id=$_POST["old_server_id"];} +if (isset($_GET["old_server_ip"])) {$old_server_ip=$_GET["old_server_ip"];} + elseif (isset($_POST["old_server_ip"])) {$old_server_ip=$_POST["old_server_ip"];} +if (isset($_GET["OLDuser_group"])) {$OLDuser_group=$_GET["OLDuser_group"];} + elseif (isset($_POST["OLDuser_group"])) {$OLDuser_group=$_POST["OLDuser_group"];} +if (isset($_GET["omit_phone_code"])) {$omit_phone_code=$_GET["omit_phone_code"];} + elseif (isset($_POST["omit_phone_code"])) {$omit_phone_code=$_POST["omit_phone_code"];} +if (isset($_GET["outbound_cid"])) {$outbound_cid=$_GET["outbound_cid"];} + elseif (isset($_POST["outbound_cid"])) {$outbound_cid=$_POST["outbound_cid"];} +if (isset($_GET["park_ext"])) {$park_ext=$_GET["park_ext"];} + elseif (isset($_POST["park_ext"])) {$park_ext=$_POST["park_ext"];} +if (isset($_GET["park_file_name"])) {$park_file_name=$_GET["park_file_name"];} + elseif (isset($_POST["park_file_name"])) {$park_file_name=$_POST["park_file_name"];} +if (isset($_GET["park_on_extension"])) {$park_on_extension=$_GET["park_on_extension"];} + elseif (isset($_POST["park_on_extension"])) {$park_on_extension=$_POST["park_on_extension"];} +if (isset($_GET["pass"])) {$pass=$_GET["pass"];} + elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];} +if (isset($_GET["phone_ip"])) {$phone_ip=$_GET["phone_ip"];} + elseif (isset($_POST["phone_ip"])) {$phone_ip=$_POST["phone_ip"];} +if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];} + elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];} +if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];} + elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];} +if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];} + elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];} +if (isset($_GET["phone_type"])) {$phone_type=$_GET["phone_type"];} + elseif (isset($_POST["phone_type"])) {$phone_type=$_POST["phone_type"];} +if (isset($_GET["picture"])) {$picture=$_GET["picture"];} + elseif (isset($_POST["picture"])) {$picture=$_POST["picture"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} +if (isset($_GET["QUEUE_ACTION_enabled"])) {$QUEUE_ACTION_enabled=$_GET["QUEUE_ACTION_enabled"];} + elseif (isset($_POST["QUEUE_ACTION_enabled"])) {$QUEUE_ACTION_enabled=$_POST["QUEUE_ACTION_enabled"];} +if (isset($_GET["recording_exten"])) {$recording_exten=$_GET["recording_exten"];} + elseif (isset($_POST["recording_exten"])) {$recording_exten=$_POST["recording_exten"];} +if (isset($_GET["remote_agent_id"])) {$remote_agent_id=$_GET["remote_agent_id"];} + elseif (isset($_POST["remote_agent_id"])) {$remote_agent_id=$_POST["remote_agent_id"];} +if (isset($_GET["reset_hopper"])) {$reset_hopper=$_GET["reset_hopper"];} + elseif (isset($_POST["reset_hopper"])) {$reset_hopper=$_POST["reset_hopper"];} +if (isset($_GET["reset_list"])) {$reset_list=$_GET["reset_list"];} + elseif (isset($_POST["reset_list"])) {$reset_list=$_POST["reset_list"];} +if (isset($_GET["safe_harbor_exten"])) {$safe_harbor_exten=$_GET["safe_harbor_exten"];} + elseif (isset($_POST["safe_harbor_exten"])) {$safe_harbor_exten=$_POST["safe_harbor_exten"];} +if (isset($_GET["safe_harbor_message"])) {$safe_harbor_message=$_GET["safe_harbor_message"];} + elseif (isset($_POST["safe_harbor_message"])) {$safe_harbor_message=$_POST["safe_harbor_message"];} +if (isset($_GET["scheduled_callbacks"])) {$scheduled_callbacks=$_GET["scheduled_callbacks"];} + elseif (isset($_POST["scheduled_callbacks"])) {$scheduled_callbacks=$_POST["scheduled_callbacks"];} +if (isset($_GET["script_comments"])) {$script_comments=$_GET["script_comments"];} + elseif (isset($_POST["script_comments"])) {$script_comments=$_POST["script_comments"];} +if (isset($_GET["script_id"])) {$script_id=$_GET["script_id"];} + elseif (isset($_POST["script_id"])) {$script_id=$_POST["script_id"];} +if (isset($_GET["script_name"])) {$script_name=$_GET["script_name"];} + elseif (isset($_POST["script_name"])) {$script_name=$_POST["script_name"];} +if (isset($_GET["script_text"])) {$script_text=$_GET["script_text"];} + elseif (isset($_POST["script_text"])) {$script_text=$_POST["script_text"];} +if (isset($_GET["selectable"])) {$selectable=$_GET["selectable"];} + elseif (isset($_POST["selectable"])) {$selectable=$_POST["selectable"];} +if (isset($_GET["server_description"])) {$server_description=$_GET["server_description"];} + elseif (isset($_POST["server_description"])) {$server_description=$_POST["server_description"];} +if (isset($_GET["server_id"])) {$server_id=$_GET["server_id"];} + elseif (isset($_POST["server_id"])) {$server_id=$_POST["server_id"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["state_call_time_state"])) {$state_call_time_state=$_GET["state_call_time_state"];} + elseif (isset($_POST["state_call_time_state"])) {$state_call_time_state=$_POST["state_call_time_state"];} +if (isset($_GET["state_rule"])) {$state_rule=$_GET["state_rule"];} + elseif (isset($_POST["state_rule"])) {$state_rule=$_POST["state_rule"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["status_name"])) {$status_name=$_GET["status_name"];} + elseif (isset($_POST["status_name"])) {$status_name=$_POST["status_name"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["sys_perf_log"])) {$sys_perf_log=$_GET["sys_perf_log"];} + elseif (isset($_POST["sys_perf_log"])) {$sys_perf_log=$_POST["sys_perf_log"];} +if (isset($_GET["telnet_host"])) {$telnet_host=$_GET["telnet_host"];} + elseif (isset($_POST["telnet_host"])) {$telnet_host=$_POST["telnet_host"];} +if (isset($_GET["telnet_port"])) {$telnet_port=$_GET["telnet_port"];} + elseif (isset($_POST["telnet_port"])) {$telnet_port=$_POST["telnet_port"];} +if (isset($_GET["updater_check_enabled"])) {$updater_check_enabled=$_GET["updater_check_enabled"];} + elseif (isset($_POST["updater_check_enabled"])) {$updater_check_enabled=$_POST["updater_check_enabled"];} +if (isset($_GET["use_internal_dnc"])) {$use_internal_dnc=$_GET["use_internal_dnc"];} + elseif (isset($_POST["use_internal_dnc"])) {$use_internal_dnc=$_POST["use_internal_dnc"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["user_group"])) {$user_group=$_GET["user_group"];} + elseif (isset($_POST["user_group"])) {$user_group=$_POST["user_group"];} +if (isset($_GET["user_level"])) {$user_level=$_GET["user_level"];} + elseif (isset($_POST["user_level"])) {$user_level=$_POST["user_level"];} +if (isset($_GET["user_start"])) {$user_start=$_GET["user_start"];} + elseif (isset($_POST["user_start"])) {$user_start=$_POST["user_start"];} +if (isset($_GET["user_switching_enabled"])) {$user_switching_enabled=$_GET["user_switching_enabled"];} + elseif (isset($_POST["user_switching_enabled"])) {$user_switching_enabled=$_POST["user_switching_enabled"];} +if (isset($_GET["vd_server_logs"])) {$vd_server_logs=$_GET["vd_server_logs"];} + elseif (isset($_POST["vd_server_logs"])) {$vd_server_logs=$_POST["vd_server_logs"];} +if (isset($_GET["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_GET["VDstop_rec_after_each_call"];} + elseif (isset($_POST["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_POST["VDstop_rec_after_each_call"];} +if (isset($_GET["VICIDIAL_park_on_extension"])) {$VICIDIAL_park_on_extension=$_GET["VICIDIAL_park_on_extension"];} + elseif (isset($_POST["VICIDIAL_park_on_extension"])) {$VICIDIAL_park_on_extension=$_POST["VICIDIAL_park_on_extension"];} +if (isset($_GET["VICIDIAL_park_on_filename"])) {$VICIDIAL_park_on_filename=$_GET["VICIDIAL_park_on_filename"];} + elseif (isset($_POST["VICIDIAL_park_on_filename"])) {$VICIDIAL_park_on_filename=$_POST["VICIDIAL_park_on_filename"];} +if (isset($_GET["vicidial_recording"])) {$vicidial_recording=$_GET["vicidial_recording"];} + elseif (isset($_POST["vicidial_recording"])) {$vicidial_recording=$_POST["vicidial_recording"];} +if (isset($_GET["vicidial_transfers"])) {$vicidial_transfers=$_GET["vicidial_transfers"];} + elseif (isset($_POST["vicidial_transfers"])) {$vicidial_transfers=$_POST["vicidial_transfers"];} +if (isset($_GET["VICIDIAL_web_URL"])) {$VICIDIAL_web_URL=$_GET["VICIDIAL_web_URL"];} + elseif (isset($_POST["VICIDIAL_web_URL"])) {$VICIDIAL_web_URL=$_POST["VICIDIAL_web_URL"];} +if (isset($_GET["voicemail_button_enabled"])) {$voicemail_button_enabled=$_GET["voicemail_button_enabled"];} + elseif (isset($_POST["voicemail_button_enabled"])) {$voicemail_button_enabled=$_POST["voicemail_button_enabled"];} +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["voicemail_ext"])) {$voicemail_ext=$_GET["voicemail_ext"];} + elseif (isset($_POST["voicemail_ext"])) {$voicemail_ext=$_POST["voicemail_ext"];} +if (isset($_GET["voicemail_exten"])) {$voicemail_exten=$_GET["voicemail_exten"];} + elseif (isset($_POST["voicemail_exten"])) {$voicemail_exten=$_POST["voicemail_exten"];} +if (isset($_GET["voicemail_id"])) {$voicemail_id=$_GET["voicemail_id"];} + elseif (isset($_POST["voicemail_id"])) {$voicemail_id=$_POST["voicemail_id"];} +if (isset($_GET["web_form_address"])) {$web_form_address=$_GET["web_form_address"];} + elseif (isset($_POST["web_form_address"])) {$web_form_address=$_POST["web_form_address"];} +if (isset($_GET["wrapup_message"])) {$wrapup_message=$_GET["wrapup_message"];} + elseif (isset($_POST["wrapup_message"])) {$wrapup_message=$_POST["wrapup_message"];} +if (isset($_GET["wrapup_seconds"])) {$wrapup_seconds=$_GET["wrapup_seconds"];} + elseif (isset($_POST["wrapup_seconds"])) {$wrapup_seconds=$_POST["wrapup_seconds"];} +if (isset($_GET["xferconf_a_dtmf"])) {$xferconf_a_dtmf=$_GET["xferconf_a_dtmf"];} + elseif (isset($_POST["xferconf_a_dtmf"])) {$xferconf_a_dtmf=$_POST["xferconf_a_dtmf"];} +if (isset($_GET["xferconf_a_number"])) {$xferconf_a_number=$_GET["xferconf_a_number"];} + elseif (isset($_POST["xferconf_a_number"])) {$xferconf_a_number=$_POST["xferconf_a_number"];} +if (isset($_GET["xferconf_b_dtmf"])) {$xferconf_b_dtmf=$_GET["xferconf_b_dtmf"];} + elseif (isset($_POST["xferconf_b_dtmf"])) {$xferconf_b_dtmf=$_POST["xferconf_b_dtmf"];} +if (isset($_GET["xferconf_b_number"])) {$xferconf_b_number=$_GET["xferconf_b_number"];} + elseif (isset($_POST["xferconf_b_number"])) {$xferconf_b_number=$_POST["xferconf_b_number"];} +if (isset($_GET["vicidial_balance_active"])) {$vicidial_balance_active=$_GET["vicidial_balance_active"];} + elseif (isset($_POST["vicidial_balance_active"])) {$vicidial_balance_active=$_POST["vicidial_balance_active"];} +if (isset($_GET["balance_trunks_offlimits"])) {$balance_trunks_offlimits=$_GET["balance_trunks_offlimits"];} + elseif (isset($_POST["balance_trunks_offlimits"])) {$balance_trunks_offlimits=$_POST["balance_trunks_offlimits"];} +if (isset($_GET["dedicated_trunks"])) {$dedicated_trunks=$_GET["dedicated_trunks"];} + elseif (isset($_POST["dedicated_trunks"])) {$dedicated_trunks=$_POST["dedicated_trunks"];} +if (isset($_GET["trunk_restriction"])) {$trunk_restriction=$_GET["trunk_restriction"];} + elseif (isset($_POST["trunk_restriction"])) {$trunk_restriction=$_POST["trunk_restriction"];} +if (isset($_GET["campaigns"])) {$campaigns=$_GET["campaigns"];} + elseif (isset($_POST["campaigns"])) {$campaigns=$_POST["campaigns"];} +if (isset($_GET["dial_level_override"])) {$dial_level_override=$_GET["dial_level_override"];} + elseif (isset($_POST["dial_level_override"])) {$dial_level_override=$_POST["dial_level_override"];} +if (isset($_GET["concurrent_transfers"])) {$concurrent_transfers=$_GET["concurrent_transfers"];} + elseif (isset($_POST["concurrent_transfers"])) {$concurrent_transfers=$_POST["concurrent_transfers"];} +if (isset($_GET["auto_alt_dial"])) {$auto_alt_dial=$_GET["auto_alt_dial"];} + elseif (isset($_POST["auto_alt_dial"])) {$auto_alt_dial=$_POST["auto_alt_dial"];} +if (isset($_GET["modify_users"])) {$modify_users=$_GET["modify_users"];} + elseif (isset($_POST["modify_users"])) {$modify_users=$_POST["modify_users"];} +if (isset($_GET["modify_campaigns"])) {$modify_campaigns=$_GET["modify_campaigns"];} + elseif (isset($_POST["modify_campaigns"])) {$modify_campaigns=$_POST["modify_campaigns"];} +if (isset($_GET["modify_lists"])) {$modify_lists=$_GET["modify_lists"];} + elseif (isset($_POST["modify_lists"])) {$modify_lists=$_POST["modify_lists"];} +if (isset($_GET["modify_scripts"])) {$modify_scripts=$_GET["modify_scripts"];} + elseif (isset($_POST["modify_scripts"])) {$modify_scripts=$_POST["modify_scripts"];} +if (isset($_GET["modify_filters"])) {$modify_filters=$_GET["modify_filters"];} + elseif (isset($_POST["modify_filters"])) {$modify_filters=$_POST["modify_filters"];} +if (isset($_GET["modify_ingroups"])) {$modify_ingroups=$_GET["modify_ingroups"];} + elseif (isset($_POST["modify_ingroups"])) {$modify_ingroups=$_POST["modify_ingroups"];} +if (isset($_GET["modify_usergroups"])) {$modify_usergroups=$_GET["modify_usergroups"];} + elseif (isset($_POST["modify_usergroups"])) {$modify_usergroups=$_POST["modify_usergroups"];} +if (isset($_GET["modify_remoteagents"])) {$modify_remoteagents=$_GET["modify_remoteagents"];} + elseif (isset($_POST["modify_remoteagents"])) {$modify_remoteagents=$_POST["modify_remoteagents"];} +if (isset($_GET["modify_servers"])) {$modify_servers=$_GET["modify_servers"];} + elseif (isset($_POST["modify_servers"])) {$modify_servers=$_POST["modify_servers"];} +if (isset($_GET["view_reports"])) {$view_reports=$_GET["view_reports"];} + elseif (isset($_POST["view_reports"])) {$view_reports=$_POST["view_reports"];} +if (isset($_GET["agent_pause_codes_active"])) {$agent_pause_codes_active=$_GET["agent_pause_codes_active"];} + elseif (isset($_POST["agent_pause_codes_active"])) {$agent_pause_codes_active=$_POST["agent_pause_codes_active"];} +if (isset($_GET["pause_code"])) {$pause_code=$_GET["pause_code"];} + elseif (isset($_POST["pause_code"])) {$pause_code=$_POST["pause_code"];} +if (isset($_GET["pause_code_name"])) {$pause_code_name=$_GET["pause_code_name"];} + elseif (isset($_POST["pause_code_name"])) {$pause_code_name=$_POST["pause_code_name"];} +if (isset($_GET["billable"])) {$billable=$_GET["billable"];} + elseif (isset($_POST["billable"])) {$billable=$_POST["billable"];} +if (isset($_GET["campaign_description"])) {$campaign_description=$_GET["campaign_description"];} + elseif (isset($_POST["campaign_description"])) {$campaign_description=$_POST["campaign_description"];} +if (isset($_GET["campaign_stats_refresh"])) {$campaign_stats_refresh=$_GET["campaign_stats_refresh"];} + elseif (isset($_POST["campaign_stats_refresh"])){$campaign_stats_refresh=$_POST["campaign_stats_refresh"];} +if (isset($_GET["list_description"])) {$list_description=$_GET["list_description"];} + elseif (isset($_POST["list_description"])) {$list_description=$_POST["list_description"];} +if (isset($_GET["vicidial_recording_override"])) {$vicidial_recording_override=$_GET["vicidial_recording_override"];} elseif (isset($_POST["vicidial_recording_override"])) {$vicidial_recording_override=$_POST["vicidial_recording_override"];} +if (isset($_GET["use_non_latin"])) {$use_non_latin=$_GET["use_non_latin"];} + elseif (isset($_POST["use_non_latin"])) {$use_non_latin=$_POST["use_non_latin"];} +if (isset($_GET["webroot_writable"])) {$webroot_writable=$_GET["webroot_writable"];} + elseif (isset($_POST["webroot_writable"])) {$webroot_writable=$_POST["webroot_writable"];} +if (isset($_GET["enable_queuemetrics_logging"])) {$enable_queuemetrics_logging=$_GET["enable_queuemetrics_logging"];} + elseif (isset($_POST["enable_queuemetrics_logging"])) {$enable_queuemetrics_logging=$_POST["enable_queuemetrics_logging"];} +if (isset($_GET["queuemetrics_server_ip"])) {$queuemetrics_server_ip=$_GET["queuemetrics_server_ip"];} + elseif (isset($_POST["queuemetrics_server_ip"])) {$queuemetrics_server_ip=$_POST["queuemetrics_server_ip"];} +if (isset($_GET["queuemetrics_dbname"])) {$queuemetrics_dbname=$_GET["queuemetrics_dbname"];} + elseif (isset($_POST["queuemetrics_dbname"])) {$queuemetrics_dbname=$_POST["queuemetrics_dbname"];} +if (isset($_GET["queuemetrics_login"])) {$queuemetrics_login=$_GET["queuemetrics_login"];} + elseif (isset($_POST["queuemetrics_login"])) {$queuemetrics_login=$_POST["queuemetrics_login"];} +if (isset($_GET["queuemetrics_pass"])) {$queuemetrics_pass=$_GET["queuemetrics_pass"];} + elseif (isset($_POST["queuemetrics_pass"])) {$queuemetrics_pass=$_POST["queuemetrics_pass"];} +if (isset($_GET["queuemetrics_url"])) {$queuemetrics_url=$_GET["queuemetrics_url"];} + elseif (isset($_POST["queuemetrics_url"])) {$queuemetrics_url=$_POST["queuemetrics_url"];} +if (isset($_GET["queuemetrics_log_id"])) {$queuemetrics_log_id=$_GET["queuemetrics_log_id"];} + elseif (isset($_POST["queuemetrics_log_id"])) {$queuemetrics_log_id=$_POST["queuemetrics_log_id"];} +if (isset($_GET["dial_status"])) {$dial_status=$_GET["dial_status"];} + elseif (isset($_POST["dial_status"])) {$dial_status=$_POST["dial_status"];} +if (isset($_GET["queuemetrics_eq_prepend"])) {$queuemetrics_eq_prepend=$_GET["queuemetrics_eq_prepend"];} + elseif (isset($_POST["queuemetrics_eq_prepend"])) {$queuemetrics_eq_prepend=$_POST["queuemetrics_eq_prepend"];} +if (isset($_GET["vicidial_agent_disable"])) {$vicidial_agent_disable=$_GET["vicidial_agent_disable"];} + elseif (isset($_POST["vicidial_agent_disable"])) {$vicidial_agent_disable=$_POST["vicidial_agent_disable"];} +if (isset($_GET["disable_alter_custdata"])) {$disable_alter_custdata=$_GET["disable_alter_custdata"];} + elseif (isset($_POST["disable_alter_custdata"])) {$disable_alter_custdata=$_POST["disable_alter_custdata"];} +if (isset($_GET["alter_custdata_override"])) {$alter_custdata_override=$_GET["alter_custdata_override"];} + elseif (isset($_POST["alter_custdata_override"])) {$alter_custdata_override=$_POST["alter_custdata_override"];} +if (isset($_GET["no_hopper_leads_logins"])) {$no_hopper_leads_logins=$_GET["no_hopper_leads_logins"];} + elseif (isset($_POST["no_hopper_leads_logins"])) {$no_hopper_leads_logins=$_POST["no_hopper_leads_logins"];} +if (isset($_GET["enable_sipsak_messages"])) {$enable_sipsak_messages=$_GET["enable_sipsak_messages"];} + elseif (isset($_POST["enable_sipsak_messages"])) {$enable_sipsak_messages=$_POST["enable_sipsak_messages"];} +if (isset($_GET["allow_sipsak_messages"])) {$allow_sipsak_messages=$_GET["allow_sipsak_messages"];} + elseif (isset($_POST["allow_sipsak_messages"])) {$allow_sipsak_messages=$_POST["allow_sipsak_messages"];} +if (isset($_GET["admin_home_url"])) {$admin_home_url=$_GET["admin_home_url"];} + elseif (isset($_POST["admin_home_url"])) {$admin_home_url=$_POST["admin_home_url"];} +if (isset($_GET["list_order_mix"])) {$list_order_mix=$_GET["list_order_mix"];} + elseif (isset($_POST["list_order_mix"])) {$list_order_mix=$_POST["list_order_mix"];} +if (isset($_GET["vcl_id"])) {$vcl_id=$_GET["vcl_id"];} + elseif (isset($_POST["vcl_id"])) {$vcl_id=$_POST["vcl_id"];} +if (isset($_GET["vcl_name"])) {$vcl_name=$_GET["vcl_name"];} + elseif (isset($_POST["vcl_name"])) {$vcl_name=$_POST["vcl_name"];} +if (isset($_GET["list_mix_container"])) {$list_mix_container=$_GET["list_mix_container"];} + elseif (isset($_POST["list_mix_container"])) {$list_mix_container=$_POST["list_mix_container"];} +if (isset($_GET["mix_method"])) {$mix_method=$_GET["mix_method"];} + elseif (isset($_POST["mix_method"])) {$mix_method=$_POST["mix_method"];} +if (isset($_GET["human_answered"])) {$human_answered=$_GET["human_answered"];} + elseif (isset($_POST["human_answered"])) {$human_answered=$_POST["human_answered"];} +if (isset($_GET["category"])) {$category=$_GET["category"];} + elseif (isset($_POST["category"])) {$category=$_POST["category"];} +if (isset($_GET["vsc_id"])) {$vsc_id=$_GET["vsc_id"];} + elseif (isset($_POST["vsc_id"])) {$vsc_id=$_POST["vsc_id"];} +if (isset($_GET["vsc_name"])) {$vsc_name=$_GET["vsc_name"];} + elseif (isset($_POST["vsc_name"])) {$vsc_name=$_POST["vsc_name"];} +if (isset($_GET["vsc_description"])) {$vsc_description=$_GET["vsc_description"];} + elseif (isset($_POST["vsc_description"])) {$vsc_description=$_POST["vsc_description"];} +if (isset($_GET["tovdad_display"])) {$tovdad_display=$_GET["tovdad_display"];} + elseif (isset($_POST["tovdad_display"])) {$tovdad_display=$_POST["tovdad_display"];} +if (isset($_GET["mix_container_item"])) {$mix_container_item=$_GET["mix_container_item"];} + elseif (isset($_POST["mix_container_item"])) {$mix_container_item=$_POST["mix_container_item"];} +if (isset($_GET["enable_agc_xfer_log"])) {$enable_agc_xfer_log=$_GET["enable_agc_xfer_log"];} + elseif (isset($_POST["enable_agc_xfer_log"])) {$enable_agc_xfer_log=$_POST["enable_agc_xfer_log"];} +if (isset($_GET["after_hours_action"])) {$after_hours_action=$_GET["after_hours_action"];} + elseif (isset($_POST["after_hours_action"])) {$after_hours_action=$_POST["after_hours_action"];} +if (isset($_GET["after_hours_message_filename"])) {$after_hours_message_filename=$_GET["after_hours_message_filename"];} + elseif (isset($_POST["after_hours_message_filename"])) {$after_hours_message_filename=$_POST["after_hours_message_filename"];} +if (isset($_GET["after_hours_exten"])) {$after_hours_exten=$_GET["after_hours_exten"];} + elseif (isset($_POST["after_hours_exten"])) {$after_hours_exten=$_POST["after_hours_exten"];} +if (isset($_GET["after_hours_voicemail"])) {$after_hours_voicemail=$_GET["after_hours_voicemail"];} + elseif (isset($_POST["after_hours_voicemail"])) {$after_hours_voicemail=$_POST["after_hours_voicemail"];} +if (isset($_GET["welcome_message_filename"])) {$welcome_message_filename=$_GET["welcome_message_filename"];} + elseif (isset($_POST["welcome_message_filename"])) {$welcome_message_filename=$_POST["welcome_message_filename"];} +if (isset($_GET["moh_context"])) {$moh_context=$_GET["moh_context"];} + elseif (isset($_POST["moh_context"])) {$moh_context=$_POST["moh_context"];} +if (isset($_GET["onhold_prompt_filename"])) {$onhold_prompt_filename=$_GET["onhold_prompt_filename"];} + elseif (isset($_POST["onhold_prompt_filename"])) {$onhold_prompt_filename=$_POST["onhold_prompt_filename"];} +if (isset($_GET["prompt_interval"])) {$prompt_interval=$_GET["prompt_interval"];} + elseif (isset($_POST["prompt_interval"])) {$prompt_interval=$_POST["prompt_interval"];} +if (isset($_GET["agent_alert_exten"])) {$agent_alert_exten=$_GET["agent_alert_exten"];} + elseif (isset($_POST["agent_alert_exten"])) {$agent_alert_exten=$_POST["agent_alert_exten"];} +if (isset($_GET["agent_alert_delay"])) {$agent_alert_delay=$_GET["agent_alert_delay"];} + elseif (isset($_POST["agent_alert_delay"])) {$agent_alert_delay=$_POST["agent_alert_delay"];} +if (isset($_GET["group_rank"])) {$group_rank=$_GET["group_rank"];} + elseif (isset($_POST["group_rank"])) {$group_rank=$_POST["group_rank"];} +if (isset($_GET["campaign_allow_inbound"])) {$campaign_allow_inbound=$_GET["campaign_allow_inbound"];} + elseif (isset($_POST["campaign_allow_inbound"])) {$campaign_allow_inbound=$_POST["campaign_allow_inbound"];} +if (isset($_GET["manual_dial_list_id"])) {$manual_dial_list_id=$_GET["manual_dial_list_id"];} + elseif (isset($_POST["manual_dial_list_id"])) {$manual_dial_list_id=$_POST["manual_dial_list_id"];} +if (isset($_GET["campaign_rank"])) {$campaign_rank=$_GET["campaign_rank"];} + elseif (isset($_POST["campaign_rank"])) {$campaign_rank=$_POST["campaign_rank"];} +if (isset($_GET["source_campaign_id"])) {$source_campaign_id=$_GET["source_campaign_id"];} + elseif (isset($_POST["source_campaign_id"])) {$source_campaign_id=$_POST["source_campaign_id"];} +if (isset($_GET["source_user_id"])) {$source_user_id=$_GET["source_user_id"];} + elseif (isset($_POST["source_user_id"])) {$source_user_id=$_POST["source_user_id"];} +if (isset($_GET["source_group_id"])) {$source_group_id=$_GET["source_group_id"];} + elseif (isset($_POST["source_group_id"])) {$source_group_id=$_POST["source_group_id"];} +if (isset($_GET["default_xfer_group"])) {$default_xfer_group=$_GET["default_xfer_group"];} + elseif (isset($_POST["default_xfer_group"])) {$default_xfer_group=$_POST["default_xfer_group"];} + + + if (isset($script_id)) {$script_id= strtoupper($script_id);} + if (isset($lead_filter_id)) {$lead_filter_id = strtoupper($lead_filter_id);} + +if (strlen($dial_status) > 0) + { + $ADD='28'; + $status = $dial_status; + } + +###################################################################################################### +###################################################################################################### +####### Form variable filtering for security and data integrity +###################################################################################################### +###################################################################################################### + +if ($non_latin < 1) +{ +### DIGITS ONLY ### +$adaptive_dropped_percentage = ereg_replace("[^0-9]","",$adaptive_dropped_percentage); +$adaptive_latest_server_time = ereg_replace("[^0-9]","",$adaptive_latest_server_time); +$admin_hangup_enabled = ereg_replace("[^0-9]","",$admin_hangup_enabled); +$admin_hijack_enabled = ereg_replace("[^0-9]","",$admin_hijack_enabled); +$admin_monitor_enabled = ereg_replace("[^0-9]","",$admin_monitor_enabled); +$AFLogging_enabled = ereg_replace("[^0-9]","",$AFLogging_enabled); +$agent_choose_ingroups = ereg_replace("[^0-9]","",$agent_choose_ingroups); +$agentcall_manual = ereg_replace("[^0-9]","",$agentcall_manual); +$agentonly_callbacks = ereg_replace("[^0-9]","",$agentonly_callbacks); +$AGI_call_logging_enabled = ereg_replace("[^0-9]","",$AGI_call_logging_enabled); +$allcalls_delay = ereg_replace("[^0-9]","",$allcalls_delay); +$alter_agent_interface_options = ereg_replace("[^0-9]","",$alter_agent_interface_options); +$am_message_exten = ereg_replace("[^0-9]","",$am_message_exten); +$answer_transfer_agent = ereg_replace("[^0-9]","",$answer_transfer_agent); +$ast_admin_access = ereg_replace("[^0-9]","",$ast_admin_access); +$ast_delete_phones = ereg_replace("[^0-9]","",$ast_delete_phones); +$attempt_delay = ereg_replace("[^0-9]","",$attempt_delay); +$attempt_maximum = ereg_replace("[^0-9]","",$attempt_maximum); +$auto_dial_next_number = ereg_replace("[^0-9]","",$auto_dial_next_number); +$balance_trunks_offlimits = ereg_replace("[^0-9]","",$balance_trunks_offlimits); +$call_parking_enabled = ereg_replace("[^0-9]","",$call_parking_enabled); +$CallerID_popup_enabled = ereg_replace("[^0-9]","",$CallerID_popup_enabled); +$campaign_detail = ereg_replace("[^0-9]","",$campaign_detail); +$campaign_rec_exten = ereg_replace("[^0-9]","",$campaign_rec_exten); +$campaign_vdad_exten = ereg_replace("[^0-9]","",$campaign_vdad_exten); +$change_agent_campaign = ereg_replace("[^0-9]","",$change_agent_campaign); +$closer_default_blended = ereg_replace("[^0-9]","",$closer_default_blended); +$conf_exten = ereg_replace("[^0-9]","",$conf_exten); +$conf_on_extension = ereg_replace("[^0-9]","",$conf_on_extension); +$conferencing_enabled = ereg_replace("[^0-9]","",$conferencing_enabled); +$ct_default_start = ereg_replace("[^0-9]","",$ct_default_start); +$ct_default_stop = ereg_replace("[^0-9]","",$ct_default_stop); +$ct_friday_start = ereg_replace("[^0-9]","",$ct_friday_start); +$ct_friday_stop = ereg_replace("[^0-9]","",$ct_friday_stop); +$ct_monday_start = ereg_replace("[^0-9]","",$ct_monday_start); +$ct_monday_stop = ereg_replace("[^0-9]","",$ct_monday_stop); +$ct_saturday_start = ereg_replace("[^0-9]","",$ct_saturday_start); +$ct_saturday_stop = ereg_replace("[^0-9]","",$ct_saturday_stop); +$ct_sunday_start = ereg_replace("[^0-9]","",$ct_sunday_start); +$ct_sunday_stop = ereg_replace("[^0-9]","",$ct_sunday_stop); +$ct_thursday_start = ereg_replace("[^0-9]","",$ct_thursday_start); +$ct_thursday_stop = ereg_replace("[^0-9]","",$ct_thursday_stop); +$ct_tuesday_start = ereg_replace("[^0-9]","",$ct_tuesday_start); +$ct_tuesday_stop = ereg_replace("[^0-9]","",$ct_tuesday_stop); +$ct_wednesday_start = ereg_replace("[^0-9]","",$ct_wednesday_start); +$ct_wednesday_stop = ereg_replace("[^0-9]","",$ct_wednesday_stop); +$DBX_port = ereg_replace("[^0-9]","",$DBX_port); +$DBY_port = ereg_replace("[^0-9]","",$DBY_port); +$dedicated_trunks = ereg_replace("[^0-9]","",$dedicated_trunks); +$delete_call_times = ereg_replace("[^0-9]","",$delete_call_times); +$delete_campaigns = ereg_replace("[^0-9]","",$delete_campaigns); +$delete_filters = ereg_replace("[^0-9]","",$delete_filters); +$delete_ingroups = ereg_replace("[^0-9]","",$delete_ingroups); +$delete_lists = ereg_replace("[^0-9]","",$delete_lists); +$delete_remote_agents = ereg_replace("[^0-9]","",$delete_remote_agents); +$delete_scripts = ereg_replace("[^0-9]","",$delete_scripts); +$delete_user_groups = ereg_replace("[^0-9]","",$delete_user_groups); +$delete_users = ereg_replace("[^0-9]","",$delete_users); +$dial_timeout = ereg_replace("[^0-9]","",$dial_timeout); +$dialplan_number = ereg_replace("[^0-9]","",$dialplan_number); +$drop_call_seconds = ereg_replace("[^0-9]","",$drop_call_seconds); +$drop_exten = ereg_replace("[^0-9]","",$drop_exten); +$enable_fast_refresh = ereg_replace("[^0-9]","",$enable_fast_refresh); +$enable_persistant_mysql = ereg_replace("[^0-9]","",$enable_persistant_mysql); +$fast_refresh_rate = ereg_replace("[^0-9]","",$fast_refresh_rate); +$hopper_level = ereg_replace("[^0-9]","",$hopper_level); +$hotkey = ereg_replace("[^0-9]","",$hotkey); +$hotkeys_active = ereg_replace("[^0-9]","",$hotkeys_active); +$list_id = ereg_replace("[^0-9]","",$list_id); +$load_leads = ereg_replace("[^0-9]","",$load_leads); +$max_vicidial_trunks = ereg_replace("[^0-9]","",$max_vicidial_trunks); +$modify_call_times = ereg_replace("[^0-9]","",$modify_call_times); +$modify_users = ereg_replace("[^0-9]","",$modify_users); +$modify_campaigns = ereg_replace("[^0-9]","",$modify_campaigns); +$modify_lists = ereg_replace("[^0-9]","",$modify_lists); +$modify_scripts = ereg_replace("[^0-9]","",$modify_scripts); +$modify_filters = ereg_replace("[^0-9]","",$modify_filters); +$modify_ingroups = ereg_replace("[^0-9]","",$modify_ingroups); +$modify_usergroups = ereg_replace("[^0-9]","",$modify_usergroups); +$modify_remoteagents = ereg_replace("[^0-9]","",$modify_remoteagents); +$modify_servers = ereg_replace("[^0-9]","",$modify_servers); +$view_reports = ereg_replace("[^0-9]","",$view_reports); +$modify_leads = ereg_replace("[^0-9]","",$modify_leads); +$monitor_prefix = ereg_replace("[^0-9]","",$monitor_prefix); +$number_of_lines = ereg_replace("[^0-9]","",$number_of_lines); +$old_conf_exten = ereg_replace("[^0-9]","",$old_conf_exten); +$outbound_cid = ereg_replace("[^0-9]","",$outbound_cid); +$park_ext = ereg_replace("[^0-9]","",$park_ext); +$park_on_extension = ereg_replace("[^0-9]","",$park_on_extension); +$phone_number = ereg_replace("[^0-9]","",$phone_number); +$QUEUE_ACTION_enabled = ereg_replace("[^0-9]","",$QUEUE_ACTION_enabled); +$recording_exten = ereg_replace("[^0-9]","",$recording_exten); +$remote_agent_id = ereg_replace("[^0-9]","",$remote_agent_id); +$safe_harbor_exten = ereg_replace("[^0-9]","",$safe_harbor_exten); +$telnet_port = ereg_replace("[^0-9]","",$telnet_port); +$updater_check_enabled = ereg_replace("[^0-9]","",$updater_check_enabled); +$user_level = ereg_replace("[^0-9]","",$user_level); +$user_start = ereg_replace("[^0-9]","",$user_start); +$user_switching_enabled = ereg_replace("[^0-9]","",$user_switching_enabled); +$VDstop_rec_after_each_call = ereg_replace("[^0-9]","",$VDstop_rec_after_each_call); +$VICIDIAL_park_on_extension = ereg_replace("[^0-9]","",$VICIDIAL_park_on_extension); +$vicidial_recording = ereg_replace("[^0-9]","",$vicidial_recording); +$vicidial_transfers = ereg_replace("[^0-9]","",$vicidial_transfers); +$voicemail_button_enabled = ereg_replace("[^0-9]","",$voicemail_button_enabled); +$voicemail_dump_exten = ereg_replace("[^0-9]","",$voicemail_dump_exten); +$voicemail_ext = ereg_replace("[^0-9]","",$voicemail_ext); +$voicemail_exten = ereg_replace("[^0-9]","",$voicemail_exten); +$voicemail_id = ereg_replace("[^0-9]","",$voicemail_id); +$wrapup_seconds = ereg_replace("[^0-9]","",$wrapup_seconds); +$use_non_latin = ereg_replace("[^0-9]","",$use_non_latin); +$webroot_writable = ereg_replace("[^0-9]","",$webroot_writable); +$enable_queuemetrics_logging = ereg_replace("[^0-9]","",$enable_queuemetrics_logging); +$enable_sipsak_messages = ereg_replace("[^0-9]","",$enable_sipsak_messages); +$allow_sipsak_messages = ereg_replace("[^0-9]","",$allow_sipsak_messages); +$mix_container_item = ereg_replace("[^0-9]","",$mix_container_item); +$prompt_interval = ereg_replace("[^0-9]","",$prompt_interval); +$agent_alert_delay = ereg_replace("[^0-9]","",$agent_alert_delay); +$manual_dial_list_id = ereg_replace("[^0-9]","",$manual_dial_list_id); + +### DIGITS and DASHES +$group_rank = ereg_replace("[^-0-9]","",$group_rank); +$campaign_rank = ereg_replace("[^-0-9]","",$campaign_rank); + +### Y or N ONLY ### +$active = ereg_replace("[^NY]","",$active); +$allow_closers = ereg_replace("[^NY]","",$allow_closers); +$reset_hopper = ereg_replace("[^NY]","",$reset_hopper); +$amd_send_to_vmx = ereg_replace("[^NY]","",$amd_send_to_vmx); +$alt_number_dialing = ereg_replace("[^NY]","",$alt_number_dialing); +$safe_harbor_message = ereg_replace("[^NY]","",$safe_harbor_message); +$selectable = ereg_replace("[^NY]","",$selectable); +$reset_list = ereg_replace("[^NY]","",$reset_list); +$fronter_display = ereg_replace("[^NY]","",$fronter_display); +$drop_message = ereg_replace("[^NY]","",$drop_message); +$use_internal_dnc = ereg_replace("[^NY]","",$use_internal_dnc); +$omit_phone_code = ereg_replace("[^NY]","",$omit_phone_code); +$available_only_ratio_tally = ereg_replace("[^NY]","",$available_only_ratio_tally); +$sys_perf_log = ereg_replace("[^NY]","",$sys_perf_log); +$vicidial_balance_active = ereg_replace("[^NY]","",$vicidial_balance_active); +$vd_server_logs = ereg_replace("[^NY]","",$vd_server_logs); +$agent_pause_codes_active = ereg_replace("[^NY]","",$agent_pause_codes_active); +$campaign_stats_refresh = ereg_replace("[^NY]","",$campaign_stats_refresh); +$disable_alter_custdata = ereg_replace("[^NY]","",$disable_alter_custdata); +$no_hopper_leads_logins = ereg_replace("[^NY]","",$no_hopper_leads_logins); +$human_answered = ereg_replace("[^NY]","",$human_answered); +$tovdad_display = ereg_replace("[^NY]","",$tovdad_display); +$campaign_allow_inbound = ereg_replace("[^NY]","",$campaign_allow_inbound); + +### ALPHA-NUMERIC ONLY ### +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); +$script_id = ereg_replace("[^0-9a-zA-Z]","",$script_id); +$submit = ereg_replace("[^0-9a-zA-Z]","",$submit); +$campaign_cid = ereg_replace("[^0-9a-zA-Z]","",$campaign_cid); +$get_call_launch = ereg_replace("[^0-9a-zA-Z]","",$get_call_launch); +$campaign_recording = ereg_replace("[^0-9a-zA-Z]","",$campaign_recording); +$ADD = ereg_replace("[^0-9a-zA-Z]","",$ADD); +$dial_prefix = ereg_replace("[^0-9a-zA-Z]","",$dial_prefix); +$state_call_time_state = ereg_replace("[^0-9a-zA-Z]","",$state_call_time_state); +$scheduled_callbacks = ereg_replace("[^0-9a-zA-Z]","",$scheduled_callbacks); +$concurrent_transfers = ereg_replace("[^0-9a-zA-Z]","",$concurrent_transfers); +$billable = ereg_replace("[^0-9a-zA-Z]","",$billable); +$pause_code = ereg_replace("[^0-9a-zA-Z]","",$pause_code); +$vicidial_recording_override = ereg_replace("[^0-9a-zA-Z]","",$vicidial_recording_override); +$queuemetrics_log_id = ereg_replace("[^0-9a-zA-Z]","",$queuemetrics_log_id); +$after_hours_action = ereg_replace("[^0-9a-zA-Z]","",$after_hours_action); +$after_hours_exten = ereg_replace("[^0-9a-zA-Z]","",$after_hours_exten); +$after_hours_voicemail = ereg_replace("[^0-9a-zA-Z]","",$after_hours_voicemail); + +### DIGITS and Dots +$server_ip = ereg_replace("[^\.0-9]","",$server_ip); +$auto_dial_level = ereg_replace("[^\.0-9]","",$auto_dial_level); +$adaptive_maximum_level = ereg_replace("[^\.0-9]","",$adaptive_maximum_level); +$phone_ip = ereg_replace("[^\.0-9]","",$phone_ip); +$old_server_ip = ereg_replace("[^\.0-9]","",$old_server_ip); +$computer_ip = ereg_replace("[^\.0-9]","",$computer_ip); +$queuemetrics_server_ip = ereg_replace("[^\.0-9]","",$queuemetrics_server_ip); + +### ALPHA-NUMERIC and spaces and hash and star and comma +$xferconf_a_dtmf = ereg_replace("[^ \,\*\#0-9a-zA-Z]","",$xferconf_a_dtmf); +$xferconf_b_dtmf = ereg_replace("[^ \,\*\#0-9a-zA-Z]","",$xferconf_b_dtmf); + +### ALPHACAPS-NUMERIC +$xferconf_a_number = ereg_replace("[^0-9A-Z]","",$xferconf_a_number); +$xferconf_b_number = ereg_replace("[^0-9A-Z]","",$xferconf_b_number); + +### ALPHA-NUMERIC and underscore and dash +$agi_output = ereg_replace("[^-\_0-9a-zA-Z]","",$agi_output); +$ASTmgrSECRET = ereg_replace("[^-\_0-9a-zA-Z]","",$ASTmgrSECRET); +$ASTmgrUSERNAME = ereg_replace("[^-\_0-9a-zA-Z]","",$ASTmgrUSERNAME); +$ASTmgrUSERNAMElisten = ereg_replace("[^-\_0-9a-zA-Z]","",$ASTmgrUSERNAMElisten); +$ASTmgrUSERNAMEsend = ereg_replace("[^-\_0-9a-zA-Z]","",$ASTmgrUSERNAMEsend); +$ASTmgrUSERNAMEupdate = ereg_replace("[^-\_0-9a-zA-Z]","",$ASTmgrUSERNAMEupdate); +$call_time_id = ereg_replace("[^-\_0-9a-zA-Z]","",$call_time_id); +$campaign_id = ereg_replace("[^-\_0-9a-zA-Z]","",$campaign_id); +$CoNfIrM = ereg_replace("[^-\_0-9a-zA-Z]","",$CoNfIrM); +$DBX_database = ereg_replace("[^-\_0-9a-zA-Z]","",$DBX_database); +$DBX_pass = ereg_replace("[^-\_0-9a-zA-Z]","",$DBX_pass); +$DBX_user = ereg_replace("[^-\_0-9a-zA-Z]","",$DBX_user); +$DBY_database = ereg_replace("[^-\_0-9a-zA-Z]","",$DBY_database); +$DBY_pass = ereg_replace("[^-\_0-9a-zA-Z]","",$DBY_pass); +$DBY_user = ereg_replace("[^-\_0-9a-zA-Z]","",$DBY_user); +$dial_method = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_method); +$dial_status_a = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status_a); +$dial_status_b = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status_b); +$dial_status_c = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status_c); +$dial_status_d = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status_d); +$dial_status_e = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status_e); +$ext_context = ereg_replace("[^-\_0-9a-zA-Z]","",$ext_context); +$group_id = ereg_replace("[^-\_0-9a-zA-Z]","",$group_id); +$lead_filter_id = ereg_replace("[^-\_0-9a-zA-Z]","",$lead_filter_id); +$local_call_time = ereg_replace("[^-\_0-9a-zA-Z]","",$local_call_time); +$login = ereg_replace("[^-\_0-9a-zA-Z]","",$login); +$login_campaign = ereg_replace("[^-\_0-9a-zA-Z]","",$login_campaign); +$login_pass = ereg_replace("[^-\_0-9a-zA-Z]","",$login_pass); +$login_user = ereg_replace("[^-\_0-9a-zA-Z]","",$login_user); +$next_agent_call = ereg_replace("[^-\_0-9a-zA-Z]","",$next_agent_call); +$old_campaign_id = ereg_replace("[^-\_0-9a-zA-Z]","",$old_campaign_id); +$old_server_id = ereg_replace("[^-\_0-9a-zA-Z]","",$old_server_id); +$OLDuser_group = ereg_replace("[^-\_0-9a-zA-Z]","",$OLDuser_group); +$park_file_name = ereg_replace("[^-\_0-9a-zA-Z]","",$park_file_name); +$pass = ereg_replace("[^-\_0-9a-zA-Z]","",$pass); +$phone_login = ereg_replace("[^-\_0-9a-zA-Z]","",$phone_login); +$phone_pass = ereg_replace("[^-\_0-9a-zA-Z]","",$phone_pass); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$protocol = ereg_replace("[^-\_0-9a-zA-Z]","",$protocol); +$server_id = ereg_replace("[^-\_0-9a-zA-Z]","",$server_id); +$stage = ereg_replace("[^-\_0-9a-zA-Z]","",$stage); +$state_rule = ereg_replace("[^-\_0-9a-zA-Z]","",$state_rule); +$status = ereg_replace("[^-\_0-9a-zA-Z]","",$status); +$trunk_restriction = ereg_replace("[^-\_0-9a-zA-Z]","",$trunk_restriction); +$user = ereg_replace("[^-\_0-9a-zA-Z]","",$user); +$user_group = ereg_replace("[^-\_0-9a-zA-Z]","",$user_group); +$VICIDIAL_park_on_filename = ereg_replace("[^-\_0-9a-zA-Z]","",$VICIDIAL_park_on_filename); +$auto_alt_dial = ereg_replace("[^-\_0-9a-zA-Z]","",$auto_alt_dial); +$dial_status = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status); +$queuemetrics_eq_prepend = ereg_replace("[^-\_0-9a-zA-Z]","",$queuemetrics_eq_prepend); +$vicidial_agent_disable = ereg_replace("[^-\_0-9a-zA-Z]","",$vicidial_agent_disable); +$alter_custdata_override = ereg_replace("[^-\_0-9a-zA-Z]","",$alter_custdata_override); +$list_order_mix = ereg_replace("[^-\_0-9a-zA-Z]","",$list_order_mix); +$vcl_id = ereg_replace("[^-\_0-9a-zA-Z]","",$vcl_id); +$mix_method = ereg_replace("[^-\_0-9a-zA-Z]","",$mix_method); +$category = ereg_replace("[^-\_0-9a-zA-Z]","",$category); +$vsc_id = ereg_replace("[^-\_0-9a-zA-Z]","",$vsc_id); +$moh_context = ereg_replace("[^-\_0-9a-zA-Z]","",$moh_context); +$agent_alert_exten = ereg_replace("[^-\_0-9a-zA-Z]","",$agent_alert_exten); +$source_campaign_id = ereg_replace("[^-\_0-9a-zA-Z]","",$source_campaign_id); +$source_user_id = ereg_replace("[^-\_0-9a-zA-Z]","",$source_user_id); +$source_group_id = ereg_replace("[^-\_0-9a-zA-Z]","",$source_group_id); +$default_xfer_group = ereg_replace("[^-\_0-9a-zA-Z]","",$default_xfer_group); + +### ALPHA-NUMERIC and spaces +$lead_order = ereg_replace("[^ 0-9a-zA-Z]","",$lead_order); +### ALPHA-NUMERIC and hash +$group_color = ereg_replace("[^\#0-9a-zA-Z]","",$group_color); + +### ALPHA-NUMERIC and spaces dots, commas, dashes, underscores +$adaptive_dl_diff_target = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$adaptive_dl_diff_target); +$adaptive_intensity = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$adaptive_intensity); +$asterisk_version = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$asterisk_version); +$call_time_comments = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$call_time_comments); +$call_time_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$call_time_name); +$campaign_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$campaign_name); +$campaign_rec_filename = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$campaign_rec_filename); +$company = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$company); +$full_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$full_name); +$fullname = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$fullname); +$group_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$group_name); +$HKstatus = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$HKstatus); +$lead_filter_comments = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$lead_filter_comments); +$lead_filter_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$lead_filter_name); +$list_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$list_name); +$local_gmt = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$local_gmt); +$phone_type = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$phone_type); +$picture = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$picture); +$script_comments = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$script_comments); +$script_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$script_name); +$server_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$server_description); +$status = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$status); +$status_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$status_name); +$wrapup_message = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$wrapup_message); +$pause_code_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$pause_code_name); +$campaign_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$campaign_description); +$list_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$list_description); +$vcl_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$vcl_name); +$vsc_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$vsc_name); +$vsc_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$vsc_description); + +### ALPHA-NUMERIC and underscore and dash and slash and at and dot +$call_out_number_group = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$call_out_number_group); +$client_browser = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$client_browser); +$DBX_server = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$DBX_server); +$DBY_server = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$DBY_server); +$dtmf_send_extension = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$dtmf_send_extension); +$extension = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$extension); +$install_directory = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$install_directory); +$old_extension = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$old_extension); +$telnet_host = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$telnet_host); +$queuemetrics_dbname = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$queuemetrics_dbname); +$queuemetrics_login = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$queuemetrics_login); +$queuemetrics_pass = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$queuemetrics_pass); +$after_hours_message_filename = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$after_hours_message_filename); +$welcome_message_filename = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$welcome_message_filename); +$onhold_prompt_filename = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$onhold_prompt_filename); + +### remove semi-colons ### +$lead_filter_sql = ereg_replace(";","",$lead_filter_sql); +$list_mix_container = ereg_replace(";","",$list_mix_container); + +### VARIABLES TO BE mysql_real_escape_string ### +# $web_form_address +# $queuemetrics_url +# $admin_home_url + +### VARIABLES not filtered at all ### +# $script_text + +} # end of non_latin + + +##### END VARIABLE FILTERING FOR SECURITY ##### + + +# AST GUI database administration +# admin.php +# +# CHANGELOG: +# 50315-1110 - Added Custom Campaign Statuses +# 50317-1438 - Added Fronter Display var to inbound groups +# 50322-1355 - Added custom callerID per campaign +# 50517-1356 - Added user_groups sections and user_group to vicidial_users +# 50517-1440 - Added ability to logout (must click OK with empty user/pass) +# 50602-1622 - Added lead loader pages to load new files into vicidial_list +# 50620-1351 - Added custom vdad transfer AGI extension per campaign +# 50810-1414 - modified in groups to kick out spaces and dashes +# 50908-2136 - Added Custom Campaign HotKeys +# 50914-0950 - Fixed user search by user_group +# 50926-1358 - Modified to allow for language translation +# 50926-1615 - Added WeBRooTWritablE write controls +# 51020-1008 - Added editable web address and park ext - NEW dial campaigns +# 51020-1056 - Added fields and help for campaign recording control +# 51123-1335 - Altered code to function in php globals=off +# 51208-1038 - Added user_level changes, function controls and default user phones +# 51208-1556 - Added deletion of users/lists/campaigns/in groups/remote agents +# 51213-1706 - Added add/delete/modify vicidial scripts +# 51214-1737 - Added preview of vicidial script in popup window +# 51219-1225 - Added campaign and ingroups script selector and get_call_launch field +# 51222-1055 - Added am_message_exten to campaigns to allow for AM Message button +# 51222-1125 - Fixed new vicidial_campaigns default values not being assigned bug +# 51222-1156 - Added LOG OUT ALL AGENTS ON THIS CAMPAIGN button to campaign screen +# 60204-0659 - Fixed hopper reset bug +# 60207-1413 - Added AMD send to voicemail extension and xfer-conf dtmf presets +# 60213-1100 - Added several vicidial_users permissions fields +# 60215-1319 - Added On-hold CallBacks display and links +# 60227-1226 - Fixed vicidial_inbound_groups insert bug +# 60413-1308 - Fixed list display to have 1 row/status: count and time zone tables +# - Added status name in selected dial statuses in campaign screen +# 60417-1416 - Added vicidial_lead_filters sections +# - Changed the header links to color-coded sectional with sublinks below +# - Added filter name and script name to campaign and in-group modify sections +# - Added callback and alt dial options to campaigns section +# - Added callback, alt dial and other options to users section +# 60419-1628 - Alter Callbacks display to include status and LIVE listings, reordered +# 60421-1441 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60425-2355 - Added agent options to vicidial_users, reformatted user page +# 60502-1627 - Added drop_call_seconds and safe_harbor_ fields to campaign screen +# 60503-1228 - Added drop_call_seconds and drop_ fields to inbound groups screen +# 60505-1117 - Added initial framework for new local_call_times tables and definitions +# 60506-1033 - More revisions to the local_call_time section +# 60508-1354 - Finished call_times and state_call_times sections +# - Added modify/delete options for call_times +# 60509-1311 - Functionalize campaign dialable leads calculation +# - Change state_call_times selection from call_times to only allow one per state +# - Added dialable leads count popup to campaign screen if auto-calc is disabled +# - Added test dialable leads count popup to filter screen +# 60510-1050 - Added Wrapup seconds and Wrapup message to campaigns screen +# 60608-1401 - Added allowable inbound_groups checkboxes to CLOSER campaign detail screen +# 60609-1051 - Added add-to-dnc in LISTS section +# 60613-1415 - Added lead recycling options to campaign detail screen +# 60619-1523 - Added variable filtering to eliminate SQL injection attack threat +# 60622-1216 - Fixed HotKey addition form issues and variable filtering +# 60623-1159 - Fixed Scheduled Callbacks over-filtering bug and filter_sql bug +# 60808-1147 - Changed filtering for and added instructions for consutative transfers +# 60816-1552 - Added allcalls_delay start delay for recordings in vicidial.php +# 60817-2226 - Fixed bug that would not allow lead recycling of non-selectable statuses +# 60821-1543 - Added option to Omit Phone Code while dialing in vicidial +# 60821-1625 - Added ALLFORCE recording option for campaign_recording +# 60823-1154 - Added fields for adaptive dialing +# 60824-1326 - Added adaptive_latest_target_gmt for ADAPT_TAPERED dial method +# 60825-1205 - Added adaptive_intensity for ADAPT_ dial methods +# 60828-1019 - Changed adaptive_latest_target_gmt to adaptive_latest_server_time +# 60828-1115 - Added adaptive_dl_diff_target and changed intensity dropdown +# 60927-1246 - Added astguiclient/admin.php functions under SERVERS tab +# 61002-1402 - Added fields for vicidial balance trunk controls +# 61003-1123 - Added functions for vicidial_server_trunks records +# 61109-1022 - Added Emergency VDAC Jam Clear function to Campaign Detail screen +# 61110-1502 - Add ability to select NONE in dial statuses, new list_id must not be < 100 +# 61122-1228 - Added user group campaign restrictions +# 61122-1535 - Changed script_text to unfiltered and added more variables to SCRIPTS +# 61129-1028 - Added headers to Users and Phones with clickable order-by titles +# 70108-1405 - Added ADAPT OVERRIDE to allow for forced dial_level changes in ADAPT dial methods +# - Screen width definable at top of script, merged server_stats into this script +# 70109-1638 - Added ALTPH2 and ADDR3 hotkey options for alt number dialing with HotKeys +# 70109-1716 - Added concurrent_transfers option to vicidial_campaigns +# 70115-1152 - Aded (CLOSER|BLEND|INBND|_C$|_B$|_I$) options for CLOSER-type campaigns +# 70115-1532 - Added auto_alt_dial field to campaign screen for auto-dialing of alt numbers +# 70116-1200 - Added auto_alt_dial_status functionality to campaign screen +# 70117-1235 - Added header formatting variables at top of script +# - Moved Call Times and Phones/Server functions to Admin section +# 70118-1706 - Added new user group displays and links +# 70123-1519 - Added user permission settings for all sections +# 70124-1346 - Fixed spelling errors and formatting consistency +# 70202-1120 - Added agent_pause_codes section to campaigns +# 70205-1204 - Added memo, last dialed, timestamp and stats-refresh fields to vicidial_campaigns/lists +# 70206-1323 - Added user setting for vicidial_recording_override +# 70212-1412 - Added system settings section +# 70214-1226 - Added QueueMetrics Log ID field to system settings section +# 70219-1102 - Changed campaign dial statuses to be one string allowing for high limit +# 70223-0957 - Added queuemetrics_eq_prepend for custom ENTERQUEUE prepending of a field +# 70302-1111 - Fixed small bug in dialable leads calculation +# 70314-1133 - Added insert selection on script forms +# 70319-1423 - Added Alter Customer Data and agent disable display functions +# 70319-1625 - Added option to allow agents to login to outbound campaigns with no leads in the hopper +# 70322-1455 - Added sipsak messages parameters +# 70402-1157 - Added HOME link and entry to system_settings table, added QM link on reports section +# 70516-1628 - Started reformatting campaigns to use submenus to break up options +# 70529-1653 - Added help for list mix +# 70530-1354 - Added human_answered field to statuses, added system status modification +# 70530-1714 - Added lists for all campaign subsections +# 70531-1631 - Development on List mix admin interface +# 70601-1629 - More development on List mix admin interface, formatting, and added some javascript +# 70602-1300 - More development on List mix admin interface, more javascript +# 70608-1459 - Added option to set LIVE Callbacks to INACTIVE after one month +# 70612-1451 - Added Callback INACTIVE link for after one week, sort by user/group/entrydate +# 70614-0231 - Added Status Categories, ability to Modify Statuses, moved system statuses to sub-section +# 70623-1008 - List Mix section now allows modification of list mix entries +# 70629-1721 - List Mix section adding and removing of list entries active +# 70706-1636 - List Mix section cleanup and more error-checking +# 70908-0941 - Added agc logile enable system_settings +# 71020-1934 - Added inbound groups options: on-hold music, messages, call_times +# 71022-1343 - Added inbound group ranks for users +# 71029-1710 - Added option for campaign to be inbound and/or blended with no restrictions on the campaign_id name +# - Added 5th NEW and 6th NEW to the dial order options +# 71030-2010 - Added Manual Dial List ID field to campaigns table +# 71103-2207 - Added inbound_group_rank and fewest_calls to the inbound groups call order options +# 71113-1521 - Added campaign_rank to agent options +# - Added ability to Copy a campaign's setting to a new campaign +# 71113-2225 - Added ability to copy user and in-group settings to new users and in-groups +# 71116-0942 - Added campaign_rank and fewest_calls as methods for agent call routing +# 71122-1135 - Added default transfer group for campaigns and inbound groups +# 71125-1751 - Added allowable transfer groups to campaign detail screen +# +# +# make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time + +$admin_version = '2.0.4-119'; +$build = '71125-1751'; + +$STARTtime = date("U"); +$SQLdate = date("Y-m-d H:i:s"); +$MT[0]=''; +$US='_'; + +$month_old = mktime(0, 0, 0, date("m")-1, date("d"), date("Y")); +$past_month_date = date("Y-m-d H:i:s",$month_old); +$week_old = mktime(0, 0, 0, date("m"), date("d")-7, date("Y")); +$past_week_date = date("Y-m-d H:i:s",$week_old); + +if ($force_logout) +{ + if( (strlen($PHP_AUTH_USER)>0) or (strlen($PHP_AUTH_PW)>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "You have now logged out. Thank you\n"; + exit; +} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or ($auth<1)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT * from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[3]; + $LOGuser_level =$row[4]; + $LOGuser_group =$row[5]; + $LOGdelete_users =$row[8]; + $LOGdelete_user_groups =$row[9]; + $LOGdelete_lists =$row[10]; + $LOGdelete_campaigns =$row[11]; + $LOGdelete_ingroups =$row[12]; + $LOGdelete_remote_agents =$row[13]; + $LOGload_leads =$row[14]; + $LOGcampaign_detail =$row[15]; + $LOGast_admin_access =$row[16]; + $LOGast_delete_phones =$row[17]; + $LOGdelete_scripts =$row[18]; + $LOGdelete_filters =$row[29]; + $LOGalter_agent_interface =$row[30]; + $LOGdelete_call_times =$row[32]; + $LOGmodify_call_times =$row[33]; + $LOGmodify_users =$row[34]; + $LOGmodify_campaigns =$row[35]; + $LOGmodify_lists =$row[36]; + $LOGmodify_scripts =$row[37]; + $LOGmodify_filters =$row[38]; + $LOGmodify_ingroups =$row[39]; + $LOGmodify_usergroups =$row[40]; + $LOGmodify_remoteagents =$row[41]; + $LOGmodify_servers =$row[42]; + $LOGview_reports =$row[43]; + + $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$LOGuser_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGallowed_campaigns =$row[0]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +###################################################################################################### +###################################################################################################### +####### Header settings +###################################################################################################### +###################################################################################################### + + +header ("Content-type: text/html; charset=utf-8"); +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDIAL ADMIN: "; + +if (!isset($ADD)) {$ADD=0;} + +if ($ADD=="1") {$hh='users'; echo "Add New User";} +if ($ADD=="1A") {$hh='users'; echo "Copy User";} +if ($ADD==11) {$hh='campaigns'; $sh='basic'; echo "Add New Campaign";} +if ($ADD==12) {$hh='campaigns'; $sh='basic'; echo "Copy Campaign";} +if ($ADD==111) {$hh='lists'; echo "Add New List";} +if ($ADD==121) {$hh='lists'; echo "Add New DNC";} +if ($ADD==1111) {$hh='ingroups'; echo "Add New In-Group";} +if ($ADD==1211) {$hh='ingroups'; echo "Copy In-Group";} +if ($ADD==11111) {$hh='remoteagent'; echo "Add New Remote Agents";} +if ($ADD==111111) {$hh='usergroups'; echo "Add New Users Group";} +if ($ADD==1111111) {$hh='scripts'; echo "Add New Script";} +if ($ADD==11111111) {$hh='filters'; echo "Add New Filter";} +if ($ADD==111111111) {$hh='admin'; $sh='times'; echo "Add New Call Time";} +if ($ADD==1111111111) {$hh='admin'; $sh='times'; echo "Add New State Call Time";} +if ($ADD==11111111111) {$hh='admin'; $sh='phones'; echo "ADD NEW PHONE";} +if ($ADD==111111111111) {$hh='admin'; $sh='server'; echo "ADD NEW SERVER";} +if ($ADD==1111111111111) {$hh='admin'; $sh='conference'; echo "ADD NEW CONFERENCE";} +if ($ADD==11111111111111) {$hh='admin'; $sh='conference'; echo "ADD NEW VICIDIAL CONFERENCE";} +if ($ADD=="2") {$hh='users'; echo "New User Addition";} +if ($ADD=="2A") {$hh='users'; echo "New Copied User Addition";} +if ($ADD==20) {$hh='campaigns'; $sh='basic'; echo "New Copied Campaign Addition";} +if ($ADD==21) {$hh='campaigns'; $sh='basic'; echo "New Campaign Addition";} +if ($ADD==22) {$hh='campaigns'; $sh='status'; echo "New Campaign Status Addition";} +if ($ADD==23) {$hh='campaigns'; $sh='hotkey'; echo "New Campaign HotKey Addition";} +if ($ADD==25) {$hh='campaigns'; $sh='recycle'; echo "New Campaign Lead Recycle Addition";} +if ($ADD==26) {$hh='campaigns'; $sh='autoalt'; echo "New Auto Alt Dial Status";} +if ($ADD==27) {$hh='campaigns'; $sh='pause'; echo "New Agent Pause Code";} +if ($ADD==28) {$hh='campaigns'; $sh='dialstat'; echo "Campaign Dial Status Added";} +if ($ADD==29) {$hh='campaigns'; $sh='listmix'; echo "Campaign List Mix Added";} +if ($ADD==211) {$hh='lists'; echo "New List Addition";} +if ($ADD==2111) {$hh='ingroups'; echo "New In-Group Addition";} +if ($ADD==2011) {$hh='ingroups'; echo "New Copied In-Group Addition";} +if ($ADD==21111) {$hh='remoteagent'; echo "New Remote Agents Addition";} +if ($ADD==211111) {$hh='usergroups'; echo "New Users Group Addition";} +if ($ADD==2111111) {$hh='scripts'; echo "New Script Addition";} +if ($ADD==21111111) {$hh='filters'; echo "New Filter Addition";} +if ($ADD==211111111) {$hh='admin'; $sh='times'; echo "New Call Time Addition";} +if ($ADD==2111111111) {$hh='admin'; $sh='times'; echo "New State Call Time Addition";} +if ($ADD==21111111111) {$hh='admin'; $sh='phones'; echo "ADDING NEW PHONE";} +if ($ADD==211111111111) {$hh='admin'; $sh='server'; echo "ADDING NEW SERVER";} +if ($ADD==221111111111) {$hh='admin'; $sh='server'; echo "ADDING NEW SERVER VICIDIAL TRUNK RECORD";} +if ($ADD==2111111111111) {$hh='admin'; $sh='conference'; echo "ADDING NEW CONFERENCE";} +if ($ADD==21111111111111) {$hh='admin'; $sh='conference'; echo "ADDING NEW VICIDIAL CONFERENCE";} +if ($ADD==221111111111111) {$hh='admin'; $sh='status'; echo "ADDING VICIDIAL SYSTEM STATUSES";} +if ($ADD==231111111111111) {$hh='admin'; $sh='status'; echo "ADDING VICIDIAL STATUS CATEGORY";} +if ($ADD==3) {$hh='users'; echo "Modify User";} +if ($ADD==30) {$hh='campaigns'; echo "Campaign Not Allowed";} +if ($ADD==31) + { + $hh='campaigns'; $sh='detail'; echo "Modify Campaign - Detail - $campaign_id"; + if ($SUB==22) {echo " - Statuses";} + if ($SUB==23) {echo " - HotKeys";} + if ($SUB==25) {echo " - Lead Recycle Entries";} + if ($SUB==26) {echo " - Auto Alt Dial Statuses";} + if ($SUB==27) {echo " - Agent Pause Codes";} + if ($SUB==29) {echo " - List Mixes";} + } +if ($ADD==32) {$hh='campaigns'; $sh='status'; echo "Campaign Statuses";} +if ($ADD==33) {$hh='campaigns'; $sh='hotkey'; echo "Campaign HotKeys";} +if ($ADD==34) {$hh='campaigns'; $sh='basic'; echo "Modify Campaign - Basic View";} +if ($ADD==35) {$hh='campaigns'; $sh='recycle'; echo "Campaign Lead Recycle Entries";} +if ($ADD==36) {$hh='campaigns'; $sh='autoalt'; echo "Campaign Auto Alt Dial Statuses";} +if ($ADD==37) {$hh='campaigns'; $sh='pause'; echo "Campaign Agent Pause Codes";} +if ($ADD==38) {$hh='campaigns'; $sh='dialstat'; echo "Campaign Dial Statuses";} +if ($ADD==39) {$hh='campaigns'; $sh='listmix'; echo "Campaign List Mixes";} +if ($ADD==311) {$hh='lists'; echo "Modify List";} +if ($ADD==3111) {$hh='ingroups'; echo "Modify In-Group";} +if ($ADD==31111) {$hh='remoteagent'; echo "Modify Remote Agents";} +if ($ADD==311111) {$hh='usergroups'; echo "Modify Users Groups";} +if ($ADD==3111111) {$hh='scripts'; echo "Modify Script";} +if ($ADD==31111111) {$hh='filters'; echo "Modify Filter";} +if ($ADD==311111111) {$hh='admin'; $sh='times'; echo "Modify Call Time";} +if ($ADD==321111111) {$hh='admin'; $sh='times'; echo "Modify Call Time State Definitions List";} +if ($ADD==3111111111) {$hh='admin'; $sh='times'; echo "Modify State Call Time";} +if ($ADD==31111111111) {$hh='admin'; $sh='phones'; echo "MODIFY PHONE";} +if ($ADD==311111111111) {$hh='admin'; $sh='server'; echo "MODIFY SERVER";} +if ($ADD==3111111111111) {$hh='admin'; $sh='conference'; echo "MODIFY CONFERENCE";} +if ($ADD==31111111111111) {$hh='admin'; $sh='conference'; echo "MODIFY VICIDIAL CONFERENCE";} +if ($ADD==311111111111111) {$hh='admin'; $sh='settings'; echo "MODIFY VICIDIAL SYSTEM SETTINGS";} +if ($ADD==321111111111111) {$hh='admin'; $sh='status'; echo "MODIFY VICIDIAL SYSTEM STATUSES";} +if ($ADD==331111111111111) {$hh='admin'; $sh='status'; echo "MODIFY VICIDIAL STATUS CATEGORY";} +if ($ADD=="4A") {$hh='users'; echo "Modify User - Admin";} +if ($ADD=="4B") {$hh='users'; echo "Modify User - Admin";} +if ($ADD==4) {$hh='users'; echo "Modify User";} +if ($ADD==41) {$hh='campaigns'; $sh='detail'; echo "Modify Campaign";} +if ($ADD==42) {$hh='campaigns'; $sh='status'; echo "Modify Campaign Status";} +if ($ADD==43) {$hh='campaigns'; $sh='hotkey'; echo "Modify Campaign HotKey";} +if ($ADD==44) {$hh='campaigns'; $sh='basic'; echo "Modify Campaign - Basic View";} +if ($ADD==45) {$hh='campaigns'; $sh='recycle'; echo "Modify Campaign Lead Recycle";} +if ($ADD==47) {$hh='campaigns'; $sh='pause'; echo "Modify Agent Pause Code";} +if ($ADD==49) {$hh='campaigns'; $sh='listmix'; echo "Modify Campaign List Mix";} +if ($ADD==411) {$hh='lists'; echo "Modify List";} +if ($ADD==4111) {$hh='ingroups'; echo "Modify In-Group";} +if ($ADD==41111) {$hh='remoteagent'; echo "Modify Remote Agents";} +if ($ADD==411111) {$hh='usergroups'; echo "Modify Users Groups";} +if ($ADD==4111111) {$hh='scripts'; echo "Modify Script";} +if ($ADD==41111111) {$hh='filters'; echo "Modify Filter";} +if ($ADD==411111111) {$hh='admin'; $sh='times'; echo "Modify Call Time";} +if ($ADD==4111111111) {$hh='admin'; $sh='times'; echo "Modify State Call Time";} +if ($ADD==41111111111) {$hh='admin'; $sh='phones'; echo "MODIFY PHONE";} +if ($ADD==411111111111) {$hh='admin'; $sh='server'; echo "MODIFY SERVER";} +if ($ADD==421111111111) {$hh='admin'; $sh='server'; echo "MODIFY SERVER VICIDIAL TRUNK RECORD";} +if ($ADD==4111111111111) {$hh='admin'; $sh='conference'; echo "MODIFY CONFERENCE";} +if ($ADD==41111111111111) {$hh='admin'; $sh='conference'; echo "MODIFY VICIDIAL CONFERENCE";} +if ($ADD==411111111111111) {$hh='admin'; $sh='settings'; echo "MODIFY VICIDIAL SYSTEM SETTINGS";} +if ($ADD==421111111111111) {$hh='admin'; $sh='status'; echo "MODIFY VICIDIAL SYSTEM STATUSES";} +if ($ADD==431111111111111) {$hh='admin'; $sh='status'; echo "MODIFY VICIDIAL STATUS CATEGORIES";} +if ($ADD==5) {$hh='users'; echo "Delete User";} +if ($ADD==51) {$hh='campaigns'; $sh='detail'; echo "Delete Campaign";} +if ($ADD==52) {$hh='campaigns'; $sh='detail'; echo "Logout Agents";} +if ($ADD==53) {$hh='campaigns'; $sh='detail'; echo "Emergency VDAC Jam Clear";} +if ($ADD==511) {$hh='lists'; echo "Delete List";} +if ($ADD==5111) {$hh='ingroups'; echo "Delete In-Group";} +if ($ADD==51111) {$hh='remoteagent'; echo "Delete Remote Agents";} +if ($ADD==511111) {$hh='usergroups'; echo "Delete Users Group";} +if ($ADD==5111111) {$hh='scripts'; echo "Delete Script";} +if ($ADD==51111111) {$hh='filters'; echo "Delete Filter";} +if ($ADD==511111111) {$hh='admin'; $sh='times'; echo "Delete Call Time";} +if ($ADD==5111111111) {$hh='admin'; $sh='times'; echo "Delete State Call Time";} +if ($ADD==51111111111) {$hh='admin'; $sh='phones'; echo "DELETE PHONE";} +if ($ADD==511111111111) {$hh='admin'; $sh='server'; echo "DELETE SERVER";} +if ($ADD==5111111111111) {$hh='admin'; $sh='conference'; echo "DELETE CONFERENCE";} +if ($ADD==51111111111111) {$hh='admin'; $sh='conference'; echo "DELETE VICIDIAL CONFERENCE";} +if ($ADD==6) {$hh='users'; echo "Delete User";} +if ($ADD==61) {$hh='campaigns'; $sh='detail'; echo "Delete Campaign";} +if ($ADD==62) {$hh='campaigns'; $sh='detail'; echo "Logout Agents";} +if ($ADD==63) {$hh='campaigns'; $sh='detail'; echo "Emergency VDAC Jam Clear";} +if ($ADD==65) {$hh='campaigns'; $sh='recycle'; echo "Delete Lead Recycle";} +if ($ADD==66) {$hh='campaigns'; $sh='autoalt'; echo "Delete Auto Alt Dial Status";} +if ($ADD==67) {$hh='campaigns'; $sh='pause'; echo "Delete Agent Pause Code";} +if ($ADD==68) {$hh='campaigns'; $sh='dialstat'; echo "Campaign Dial Status Removed";} +if ($ADD==69) {$hh='campaigns'; $sh='listmix'; echo "Campaign List Mix Removed";} +if ($ADD==611) {$hh='lists'; echo "Delete List";} +if ($ADD==6111) {$hh='ingroups'; echo "Delete In-Group";} +if ($ADD==61111) {$hh='remoteagent'; echo "Delete Remote Agents";} +if ($ADD==611111) {$hh='usergroups'; echo "Delete Users Group";} +if ($ADD==6111111) {$hh='scripts'; echo "Delete Script";} +if ($ADD==61111111) {$hh='filters'; echo "Delete Filter";} +if ($ADD==611111111) {$hh='admin'; $sh='times'; echo "Delete Call Time";} +if ($ADD==6111111111) {$hh='admin'; $sh='times'; echo "Delete State Call Time";} +if ($ADD==61111111111) {$hh='admin'; $sh='phones'; echo "DELETE PHONE";} +if ($ADD==611111111111) {$hh='admin'; $sh='server'; echo "DELETE SERVER";} +if ($ADD==621111111111) {$hh='admin'; $sh='server'; echo "DELETE SERVER VICIDIAL TRUNK RECORD";} +if ($ADD==6111111111111) {$hh='admin'; $sh='conference'; echo "DELETE CONFERENCE";} +if ($ADD==61111111111111) {$hh='admin'; $sh='conference'; echo "DELETE VICIDIAL CONFERENCE";} +if ($ADD==73) {$hh='campaigns'; echo "Dialable Lead Count";} +if ($ADD==7111111) {$hh='scripts'; echo "Preview Script";} +if ($ADD==0) {$hh='users'; echo "Users List";} +if ($ADD==8) {$hh='users'; echo "CallBacks Within Agent";} +if ($ADD==81) {$hh='campaigns'; $sh='list'; echo "CallBacks Within Campaign";} +if ($ADD==811) {$hh='lists'; echo "CallBacks Within List";} +if ($ADD==8111) {$hh='usergroups'; echo "CallBacks Within User Group";} +if ($ADD==10) {$hh='campaigns'; $sh='list'; echo "Campaigns";} +if ($ADD==100) {$hh='lists'; echo "Lists";} +if ($ADD==1000) {$hh='ingroups'; echo "In-Groups";} +if ($ADD==10000) {$hh='remoteagent'; echo "Remote Agents";} +if ($ADD==100000) {$hh='usergroups'; echo "User Groups";} +if ($ADD==1000000) {$hh='scripts'; echo "Scripts";} +if ($ADD==10000000) {$hh='filters'; echo "Filters";} +if ($ADD==100000000) {$hh='admin'; $sh='times'; echo "Call Times";} +if ($ADD==1000000000) {$hh='admin'; $sh='times'; echo "State Call Times";} +if ($ADD==10000000000) {$hh='admin'; $sh='phones'; echo "PHONE LIST";} +if ($ADD==100000000000) {$hh='admin'; $sh='server'; echo "SERVER LIST";} +if ($ADD==1000000000000) {$hh='admin'; $sh='conference'; echo "CONFERENCE LIST";} +if ($ADD==10000000000000) {$hh='admin'; $sh='conference'; echo "VICIDIAL CONFERENCE LIST";} +if ($ADD==550) {$hh='users'; echo "Search Form";} +if ($ADD==551) {$hh='users'; echo "SEARCH PHONES";} +if ($ADD==660) {$hh='users'; echo "Search Results";} +if ($ADD==661) {$hh='users'; echo "SEARCH PHONES RESULTS";} +if ($ADD==99999) {$hh='users'; echo "HELP";} +if ($ADD==999999) {$hh='reports'; echo "REPORTS";} + +if ( ($ADD>9) && ($ADD < 99998) ) + { + ##### get scripts listing for dynamic pulldown + $stmt="SELECT script_id,script_name from vicidial_scripts order by script_id"; + $rslt=mysql_query($stmt, $link); + $scripts_to_print = mysql_num_rows($rslt); + $scripts_list="<option value=\"\">NONE</option>\n"; + + $o=0; + while ($scripts_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $scripts_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $scriptname_list["$rowx[0]"] = "$rowx[1]"; + $o++; + } + + ##### get filters listing for dynamic pulldown + $stmt="SELECT lead_filter_id,lead_filter_name,lead_filter_sql from vicidial_lead_filters order by lead_filter_id"; + $rslt=mysql_query($stmt, $link); + $filters_to_print = mysql_num_rows($rslt); + $filters_list="<option value=\"\">NONE</option>\n"; + + $o=0; + while ($filters_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $filters_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $filtername_list["$rowx[0]"] = "$rowx[1]"; + $filtersql_list["$rowx[0]"] = "$rowx[2]"; + $o++; + } + + ##### get call_times listing for dynamic pulldown + $stmt="SELECT call_time_id,call_time_name from vicidial_call_times order by call_time_id"; + $rslt=mysql_query($stmt, $link); + $times_to_print = mysql_num_rows($rslt); + + $o=0; + while ($times_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $call_times_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $call_timename_list["$rowx[0]"] = "$rowx[1]"; + $o++; + } + } + +if ( ( (strlen($ADD)>4) && ($ADD < 99998) ) or ($ADD==3) or (($ADD>20) and ($ADD<70)) or ($ADD=="4A") or ($ADD=="4B") or (strlen($ADD)==12) ) + { + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rslt=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rslt); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $servers_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $o++; + } + + ##### BEGIN get campaigns listing for rankings ##### + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + $campaigns_list=''; + $campaigns_value=''; + $RANKcampaigns_list="<tr><td>CAMPAIGN</td><td>     RANK</td><td>     CALLS</td></tr>\n"; + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $campaigns_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $campaign_id_values[$o] = $rowx[0]; + $campaign_name_values[$o] = $rowx[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + $stmt="SELECT campaign_rank,calls_today from vicidial_campaign_agents where user='$user' and campaign_id='$campaign_id_values[$o]'"; + $rslt=mysql_query($stmt, $link); + $ranks_to_print = mysql_num_rows($rslt); + if ($ranks_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $SELECT_campaign_rank = $row[0]; + $calls_today = $row[1]; + } + else + {$calls_today=0; $SELECT_campaign_rank=0;} + if ( ($ADD=="4A") or ($ADD=="4B") ) + { + if (isset($_GET["RANK_$campaign_id_values[$o]"])) {$campaign_rank=$_GET["RANK_$campaign_id_values[$o]"];} + elseif (isset($_POST["RANK_$campaign_id_values[$o]"])) {$campaign_rank=$_POST["RANK_$campaign_id_values[$o]"];} + + if ($ranks_to_print > 0) + { + $stmt="UPDATE vicidial_campaign_agents set campaign_rank='$campaign_rank', campaign_weight='$campaign_rank' where campaign_id='$campaign_id_values[$o]' and user='$user';"; + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="INSERT INTO vicidial_campaign_agents set campaign_rank='$campaign_rank', campaign_weight='$campaign_rank', campaign_id='$campaign_id_values[$o]', user='$user';"; + $rslt=mysql_query($stmt, $link); + } + + $stmt="UPDATE vicidial_live_agents set campaign_weight='$campaign_rank' where campaign_id='$campaign_id_values[$o]' and user='$user';"; + $rslt=mysql_query($stmt, $link); + } + else {$campaign_rank = $SELECT_campaign_rank;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + # disable non user-group allowable campaign ranks + $stmt="SELECT user_group from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Ruser_group = $row[0]; + + $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$Ruser_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $allowed_campaigns = $row[0]; + $allowed_campaigns = preg_replace("/ -$/","",$allowed_campaigns); + $UGcampaigns = explode(" ", $allowed_campaigns); + + $p=0; $RANK_camp_active=0; $CR_disabled = ''; + if (eregi('-ALL-CAMPAIGNS-',$allowed_campaigns)) + {$RANK_camp_active++;} + else + { + $UGcampaign_ct = count($UGcampaigns); + while ($p < $UGcampaign_ct) + { + if ($campaign_id_values[$o] == $UGcampaigns[$p]) + {$RANK_camp_active++;} + $p++; + } + } + if ($RANK_camp_active < 1) {$CR_disabled = 'DISABLED';} + + $RANKcampaigns_list .= "<tr $bgcolor><td>"; + $campaigns_list .= "<a href=\"$PHP_SELF?ADD=31&campaign_id=$campaign_id_values[$o]\">$campaign_id_values[$o]</a> - $campaign_name_values[$o] <BR>\n"; + $RANKcampaigns_list .= "<a href=\"$PHP_SELF?ADD=31&campaign_id=$campaign_id_values[$o]\">$campaign_id_values[$o]</a> - $campaign_name_values[$o] </td>"; + $RANKcampaigns_list .= "<td>     <select size=1 name=RANK_$campaign_id_values[$o] $CR_disabled>\n"; + $h="9"; + while ($h>=-9) + { + $RANKcampaigns_list .= "<option value=\"$h\""; + if ($h==$campaign_rank) + {$RANKcampaigns_list .= " SELECTED";} + $RANKcampaigns_list .= ">$h</option>"; + $h--; + } + $RANKcampaigns_list .= "</select></td>\n"; + $RANKcampaigns_list .= "<td align=right>     $calls_today</td></tr>\n"; + $o++; + } + ##### END get campaigns listing for rankings ##### + + + ##### BEGIN get inbound groups listing for checkboxes ##### + $xfer_groupsSQL=''; + if ( (($ADD>20) and ($ADD<70)) and ($ADD!=41) ) + { + $stmt="SELECT closer_campaigns,xfer_groups from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + $xfer_groups = $row[1]; + $xfer_groups = preg_replace("/ -$/","",$xfer_groups); + $XFERgroups = explode(" ", $xfer_groups); + $xfer_groupsSQL = preg_replace("/^ | -$/","",$xfer_groups); + $xfer_groupsSQL = preg_replace("/ /","','",$xfer_groupsSQL); + $xfer_groupsSQL = "WHERE group_id IN('$xfer_groupsSQL')"; + } + if ($ADD==41) + { + $p=0; + $XFERgroup_ct = count($XFERgroups); + while ($p < $XFERgroup_ct) + { + $xfer_groups .= " $XFERgroups[$p]"; + $p++; + } + $xfer_groupsSQL = preg_replace("/^ | -$/","",$xfer_groups); + $xfer_groupsSQL = preg_replace("/ /","','",$xfer_groupsSQL); + $xfer_groupsSQL = "WHERE group_id IN('$xfer_groupsSQL')"; + } + + if ( (($ADD==31111) or ($ADD==31111)) and (count($groups)<1) ) + { + $stmt="SELECT closer_campaigns from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + if ($ADD==3) + { + $stmt="SELECT closer_campaigns from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + $stmt="SELECT group_id,group_name from vicidial_inbound_groups order by group_id"; + $rslt=mysql_query($stmt, $link); + $groups_to_print = mysql_num_rows($rslt); + $groups_list=''; + $groups_value=''; + $XFERgroups_list=''; + $RANKgroups_list="<tr><td>INBOUND GROUP</td><td>     RANK</td><td>     CALLS</td></tr>\n"; + + $o=0; + while ($groups_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $group_id_values[$o] = $rowx[0]; + $group_name_values[$o] = $rowx[1]; + $o++; + } + + $o=0; + while ($groups_to_print > $o) + { + $stmt="SELECT group_rank,calls_today from vicidial_inbound_group_agents where user='$user' and group_id='$group_id_values[$o]'"; + $rslt=mysql_query($stmt, $link); + $ranks_to_print = mysql_num_rows($rslt); + if ($ranks_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $SELECT_group_rank = $row[0]; + $calls_today = $row[1]; + } + else + {$calls_today=0; $SELECT_group_rank=0;} + if ( ($ADD=="4A") or ($ADD=="4B") ) + { + if (isset($_GET["RANK_$group_id_values[$o]"])) {$group_rank=$_GET["RANK_$group_id_values[$o]"];} + elseif (isset($_POST["RANK_$group_id_values[$o]"])) {$group_rank=$_POST["RANK_$group_id_values[$o]"];} + + if ($ranks_to_print > 0) + { + $stmt="UPDATE vicidial_inbound_group_agents set group_rank='$group_rank', group_weight='$group_rank' where group_id='$group_id_values[$o]' and user='$user';"; + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="INSERT INTO vicidial_inbound_group_agents set group_rank='$group_rank', group_weight='$group_rank', group_id='$group_id_values[$o]', user='$user';"; + $rslt=mysql_query($stmt, $link); + } + + $stmt="UPDATE vicidial_live_inbound_agents set group_weight='$group_rank' where group_id='$group_id_values[$o]' and user='$user';"; + $rslt=mysql_query($stmt, $link); + } + else {$group_rank = $SELECT_group_rank;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $groups_list .= "<input type=\"checkbox\" name=\"groups[]\" value=\"$group_id_values[$o]\""; + $XFERgroups_list .= "<input type=\"checkbox\" name=\"XFERgroups[]\" value=\"$group_id_values[$o]\""; + $RANKgroups_list .= "<tr $bgcolor><td><input type=\"checkbox\" name=\"groups[]\" value=\"$group_id_values[$o]\""; + $p=0; + $group_ct = count($groups); + while ($p < $group_ct) + { + if ($group_id_values[$o] == $groups[$p]) + { + $groups_list .= " CHECKED"; + $RANKgroups_list .= " CHECKED"; + $groups_value .= " $group_id_values[$o]"; + } + $p++; + } + $p=0; + $XFERgroup_ct = count($XFERgroups); + while ($p < $XFERgroup_ct) + { + if ($group_id_values[$o] == $XFERgroups[$p]) + { + $XFERgroups_list .= " CHECKED"; + $XFERgroups_value .= " $group_id_values[$o]"; + } + $p++; + } + $groups_list .= "> <a href=\"$PHP_SELF?ADD=3111&group_id=$group_id_values[$o]\">$group_id_values[$o]</a> - $group_name_values[$o] <BR>\n"; + $XFERgroups_list .= "> <a href=\"$PHP_SELF?ADD=3111&group_id=$group_id_values[$o]\">$group_id_values[$o]</a> - $group_name_values[$o] <BR>\n"; + $RANKgroups_list .= "> <a href=\"$PHP_SELF?ADD=3111&group_id=$group_id_values[$o]\">$group_id_values[$o]</a> - $group_name_values[$o] </td>"; + $RANKgroups_list .= "<td>     <select size=1 name=RANK_$group_id_values[$o]>\n"; + $h="9"; + while ($h>=-9) + { + $RANKgroups_list .= "<option value=\"$h\""; + if ($h==$group_rank) + {$RANKgroups_list .= " SELECTED";} + $RANKgroups_list .= ">$h</option>"; + $h--; + } + $RANKgroups_list .= "</select></td>\n"; + $RANKgroups_list .= "<td align=right>     $calls_today</td></tr>\n"; + $o++; + } + if (strlen($groups_value)>2) {$groups_value .= " -";} + if (strlen($XFERgroups_value)>2) {$XFERgroups_value .= " -";} + } + ##### END get inbound groups listing for checkboxes ##### + + + ##### BEGIN get campaigns listing for checkboxes ##### + if ( ($ADD==211111) or ($ADD==311111) or ($ADD==411111) or ($ADD==511111) or ($ADD==611111) ) + { + if ( ($ADD==211111) or ($ADD==311111) or ($ADD==511111) or ($ADD==611111) ) + { + $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$user_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $allowed_campaigns = $row[0]; + $allowed_campaigns = preg_replace("/ -$/","",$allowed_campaigns); + $campaigns = explode(" ", $allowed_campaigns); + } + + $campaigns_value=''; + $campaigns_list='<B><input type="checkbox" name="campaigns[]" value="-ALL-CAMPAIGNS-"'; + $p=0; + while ($p<100) + { + if (eregi('ALL-CAMPAIGNS',$campaigns[$p])) + { + $campaigns_list.=" CHECKED"; + $campaigns_value .= " -ALL-CAMPAIGNS- -"; + } + $p++; + } + $campaigns_list.="> ALL-CAMPAIGNS - USERS CAN VIEW ANY CAMPAIGN</B><BR>\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $campaign_id_value = $rowx[0]; + $campaign_name_value = $rowx[1]; + $campaigns_list .= "<input type=\"checkbox\" name=\"campaigns[]\" value=\"$campaign_id_value\""; + $p=0; + while ($p<100) + { + if ($campaign_id_value == $campaigns[$p]) + { + # echo "<!-- X $p|$campaign_id_value|$campaigns[$p]| -->"; + $campaigns_list .= " CHECKED"; + $campaigns_value .= " $campaign_id_value"; + } + # echo "<!-- O $p|$campaign_id_value|$campaigns[$p]| -->"; + $p++; + } + $campaigns_list .= "> $campaign_id_value - $campaign_name_value<BR>\n"; + $o++; + } + if (strlen($campaigns_value)>2) {$campaigns_value .= " -";} + } + ##### END get campaigns listing for checkboxes ##### + + + if ( (strlen($ADD)==11) or (strlen($ADD)>12) ) + { + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rsltx=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rsltx); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $servers_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $o++; + } + } + + + +$NWB = "   <a href=\"javascript:openNewWindow('$PHP_SELF?ADD=99999"; +$NWE = "')\"><IMG SRC=\"help.gif\" WIDTH=20 HEIGHT=20 BORDER=0 ALT=\"HELP\" ALIGN=TOP></A>"; + + +###################################################################################################### +###################################################################################################### +####### 9 series, HELP screen +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=99999 display the HELP SCREENS +###################### + +if ($ADD==99999) +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "
VICIDIAL ADMIN: HELP


\n"; + +?> +VICIDIAL_USERS TABLE

+ +
+User ID - This field is where you put the VICIDIAL users ID number, can be up to 8 digits in length, Must be at least 2 characters in length. + +
+
+
+Password - This field is where you put the VICIDIAL users password. Must be at least 2 characters in length. + +
+
+
+Full Name - This field is where you put the VICIDIAL users full name. Must be at least 2 characters in length. + +
+
+
+User Level - This menu is where you select the VICIDIAL users user level. Must be a level of 1 to log into VICIDIAL, Must be level greater than 2 to log in as a closer, Must be user level 8 or greater to get into admin web section. + +
+
+
+User Group - This menu is where you select the VICIDIAL users group that this user will belong to. This does not have any restrictions at this time, this is just to subdivide users and allow for future features based upon it. + +
+
+
+Phone Login - Here is where you can set a default phone login value for when the user logs into vicidial.php. This value will populate the phone_login automatically when the user logs in with their user-pass-campaign in the vicidial.php login screen. + +
+
+
+Phone Pass - Here is where you can set a default phone pass value for when the user logs into vicidial.php. This value will populate the phone_pass automatically when the user logs in with their user-pass-campaign in the vicidial.php login screen. + +
+
+
+Hot Keys Active - This option if set to 1 allows the user to use the Hot Keys quick-dispositioning function in vicidial.php. + +
+
+
+Agent Choose Ingroups - This option if set to 1 allows the user to choose the ingroups that they will receive calls from when they login to a CLOSER or INBOUND campaign. Otherwise the Manager will need to set this in their user detail screen of the admin page. + +
+
+
+Scheduled Callbacks - This option allows an agent to disposition a call as CALLBK and choose the data and time at which the lead will be re-activated. + +
+
+
+Agent-Only Callbacks - This option allows an agent to set a callback so that they are the only Agent that can call the customer back. This also allows the agent to see their callback listings and call them back any time they want to. + +
+
+
+Agent Call Manual - This option allows an agent to manually enter a new lead into the system and call them. This also allows the calling of any phone number from their vicidial screen and puts that call into their session. Use this option with caution. + +
+
+
+Vicidial Recording - This option can prevent an agent from doing any recordings after they log in to vicidial. This option must be on for vicidial to follow the campaign recording session. + +
+
+
+Vicidial Transfers - This option can prevent an agent from opening the transfer - conference session of vicidial. If this is disabled, the agent cannot third party call or blind transfer any calls. + +
+
+
+Closer Default Blended - This option simply defaults the Blended checkbox on a CLOSER login screen. + +
+
+
+VICIDIAL Recording Override - This option will override whatever the option is in the campaign for recording. DISABLED will not override the campaign recording setting. NEVER will disable recording on the client. ONDEMAND is the default and allows the agent to start and stop recording as needed. ALLCALLS will start recording on the client whenever a call is sent to an agent. ALLFORCE will start recording on the client whenever a call is sent to an agent giving the agent no option to stop recording. For ALLCALLS and ALLFORCE there is an option to use the Recording Delay to cut down on very short recordings and recude system load. + +
+
+
+Campaign Ranks - In this section you can define the rank an agent will have for each campaign. These ranks can be used to allow for preferred call routing when Next Agent Call is set to campaign_rank. + +
+
+
+Inbound Groups - Here is where you select the inbound groups you want to receive calls from if you have selected the CLOSER campaign. You will also be able to set the rank, or skill level, in this section for each of the inbound groups as well as being able to see the number of calls received from each inbound group for this specific agent. Also in this section is the ability to give the agent a rank for each inbound group. These ranks can be used for preferred call routing when that option is selected in the in-group screen. + +
+
+
+Agent Alter Customer Data Override - This option will override whatever the option is in the campaign for altering of customer data. NOT_ACTIVE will use whatever setting is present for the campaign. ALLOW_ALTER will always allow for the agent to alter the customer data, no matter what the campaign setting is. Default is NOT_ACTIVE. + +
+
+
+Alter Agent Interface Options - This option if set to 1 allows the administrative user to modify the Agents interface options in admin.php. + +
+
+
+Delete Users - This option if set to 1 allows the user to delete other users of equal or lesser user level from the system. + +
+
+
+Delete User Groups - This option if set to 1 allows the user to delete user groups from the system. + +
+
+
+Delete Lists - This option if set to 1 allows the user to delete vicidial lists from the system. + +
+
+
+Delete Campaigns - This option if set to 1 allows the user to delete vicidial campaigns from the system. + +
+
+
+Delete In-Groups - This option if set to 1 allows the user to delete vicidial In-Groups from the system. + +
+
+
+Delete Remote Agents - This option if set to 1 allows the user to delete vicidial remote agents from the system. + +
+
+
+Load Leads - This option if set to 1 allows the user to load vicidial leads into the vicidial_list table by way of the web based lead loader. + +
+
+
+Campaign Detail - This option if set to 1 allows the user to view and modify the campaign detail screen elements. + +
+
+
+AGC Admin Access - This option if set to 1 allows the user to login to the astGUIclient admin pages. + +
+
+
+AGC Delete Phones - This option if set to 1 allows the user to delete phone entries in the astGUIclient admin pages. + +
+
+
+Delete Scripts - This option if set to 1 allows the user to delete Campaign scripts in the script modification screen. + +
+
+
+Modify Leads - This option if set to 1 allows the user to modify leads in the admin section lead search results page. + +
+
+
+Change Agent Campaign - This option if set to 1 allows the user to alter the campaign that an agent is logged into while they are logged into it. + +
+
+
+Delete Filters - This option allows the user to be able to delete vicidial lead filters from the system. + +
+
+
+Delete Call Times - This option allows the user to be able to delete vicidial call times records and vicidial state call times records from the system. + +
+
+
+Modify Call Times - This option allows the user to view and modify the call times and state call times records. A user doesn't need this option enabled if they only need to change the call times option on the campaigns screen. + +
+
+
+Modify Sections - These options allow the user to view and modify each sections records. If set to 0, the user will be able to see the section list, but not the detail or modification screen of a record in that section. + +
+
+
+View Reports - This option allows the user to view the VICIDIAL reports. + + + + +



+ +VICIDIAL_CAMPAIGNS TABLE

+
+
+Campaign ID - This is the short name of the campaign, it is not editable after initial submission, cannot contain spaces and must be between 2 and 8 characters in length. + +
+
+
+Campaign Name - This is the description of the campaign, it must be between 6 and 40 characters in length. + +
+
+
+Campaign Description - This is a memo field for the campaign, it is optional and can be a maximum of 255 characters in length. + +
+
+
+Campaign Change Date - This is the last time that the settings for this campaign were modified in any way. + +
+
+
+Last Campaign Login Date - This is the last time that an agent was logged into this campaign. + +
+
+
+Campaign Stats Refresh - This checkbox will allow you to force a vicidial stats refresh, even if the campaign is not active. + +
+
+
+Active - This is where you set the campaign to Active or Inactive. If Inactive, noone can log into it. + +
+
+
+Park Extension - This is where you can customize the on-hold music for VICIDIAL. Make sure the extension is in place in the extensions.conf and that it points to the filename below. + +
+
+
+Park File Name - This is where you can customize the on-hold music for VICIDIAL. Make sure the filename is 10 characters in length or less and that the file is in place in the /var/lib/asterisk/sounds directory. + +
+
+
+Web Form - This is where you can set the custom web page that will be opened when the user clicks on the WEB FORM button. + +
+
+
+Allow Closers - This is where you can set whether the users of this campaign will have the option to send the call to a closer. + +
+
+
+Default Transfer Group - This field is the default In-Group that will be automatically selected when the agent goes to the transfer-conference frame in their agent interface. + +
+
+
+Allowed Transfer Groups - With these checkbox listings you can select the groups that agents in this campaign can transfer calls to. Allow Closers must be enabled for this option to show up. + +
+
+
+Allow Inbound and Blended - This is where you can set whether the users of this campaign will have the option to take inbound calls with this campaign. If you want to do blended inbound and outbound then this must be set to Y. If you only want to do outbound dialing on this campaign set this to N. Default is N. + +
+
+
+Dial Status - This is where you set the statuses that you are wanting to dial on within the lists that are active for the campaign below. To add another status to dial, select it from the drop-down list and click ADD. To remove one of the dial statuses, click on the REMOVE link next to the status you want to remove. + +
+
+
+List Order - This menu is where you select how the leads that match the statuses selected above will be put in the lead hopper: +
  - DOWN: select the first leads loaded into the vicidial_list table +
  - UP: select the last leads loaded into the vicidial_list table +
  - UP PHONE: select the highest phone number and works its way down +
  - DOWN PHONE: select the lowest phone number and works its way up +
  - UP LAST NAME: starts with last names starting with Z and works its way down +
  - DOWN LAST NAME: starts with last names starting with A and works its way up +
  - UP COUNT: starts with most called leads and works its way down +
  - DOWN COUNT: starts with least called leads and works its way up +
  - DOWN COUNT 2nd NEW: starts with least called leads and works its way up inserting a NEW lead in every other lead - Must NOT have NEW selected in the dial statuses +
  - DOWN COUNT 3nd NEW: starts with least called leads and works its way up inserting a NEW lead in every third lead - Must NOT have NEW selected in the dial statuses +
  - DOWN COUNT 4th NEW: starts with least called leads and works its way up inserting a NEW lead in every forth lead - Must NOT have NEW selected in the dial statuses + +
+
+
+Hopper Level - This is how many leads the VDhopper script tries to keep in the vicidial_hopper table for this campaign. If running VDhopper script every minute, make this slightly greater than the number of leads you go through in a minute. + +
+
+
+Lead Filter - This is a method of filtering your leads using a fragment of a SQL query. Use this feature with caution, it is easy to stop dialing accidentally with the slightest alteration to the SQL statement. Default is NONE. + +
+
+
+Force Reset of Hopper - This allows you to wipe out the hopper contents upon form submission. It should be filled again when the VDhopper script runs. + +
+
+
+Dial Method - This field is the way to define how dialing is to take place. If MANUAL then the auto_dial_level will be locked at 0 unless Dial Method is changed. If RATIO then the normal dialing a number of lines for Active agents. ADAPT_HARD_LIMIT will dial predictively up to the dropped percentage and then not allow aggressive dialing once the drop limit is reached until the percentage goes down again. ADAPT_TAPERED allows for running over the dropped percentage in the first half of the shift -as defined by call_time selected for campaign- and gets more strict as the shift goes on. ADAPT_AVERAGE tries to maintain an average or the dropped percentage not imposing hard limits as aggressively as the other two methods. You cannot change the Auto Dial Level if you are in any of the ADAPT dial methods. Only the Dialer can change the dial level when in predictive dialing mode. + +
+
+
+Auto Dial Level - This is where you set how many lines VICIDIAL should use per active agent. zero 0 means auto dialing is off and the agents will click to dial each number. Otherwise VICIDIAL will keep dialing lines equal to active agents multiplied by the dial level to arrive at how many lines this campaign on each server should allow. The ADAPT OVERRIDE checkbox allows you to force a new dial level even though the dial method is in an ADAPT mode. This is useful if there is a dramatic shift in the quality of leads and you want to drastically change the dial_level manually. + +
+
+
+Available Only Tally - This field if set to Y will leave out INCALL and QUEUE status agents when calculating the number of calls to dial when not in MANUAL dial mode. Default is N. + +
+
+
+Drop Percentage Limit - This field is where you set the limit of the percentage of dropped calls you would like while using an adaptive-predictive dial method, not MANUAL or RATIO. + +
+
+
+Maximum Adapt Dial Level - This field is where you set the limit of the limit to the numbr of lines you would like dialed per agent while using an adaptive-predictive dial method, not MANUAL or RATIO. This number can be higher than the Auto Dial Level if your hardware will support it. Value must be a positive number greater than one and can have decimal places Default 3.0. + +
+
+
+Latest Server Time - This field is only used by the ADAPT_TAPERED dial method. You should enter in the hour and minute that you will stop calling on this campaign, 2100 would mean that you will stop dialing this campaign at 9PM server time. This allows the Tapered algorithm to decide how aggressively to dial by how long you have until you will be finished calling. + +
+
+
+Adapt Intensity Modifier - This field is used to adjust the predictive intensity either higher or lower. The higher a positive number you select, the greater the dialer will increase the call pacing when it goes up and the slower the dialer will decrease the call pacing when it goes down. The lower the negative number you select here, the slower the dialer will increase the call pacing and the faster the dialer will lower the call pacing when it goes down. Default is 0. This field is not used by the MANUAL or RATIO dial methods. + +
+
+
+Dial Level Difference Target - This field is used to define whether you want to target having a specific number of agents waiting for calls or calls waiting for agents. For example if you would always like to have on average one agent free to take calls immediately you would set this to -1, if you would like to target always having one call on hold waiting for an agent you would set this to 1. Default is 0. This field is not used by the MANUAL or RATIO dial methods. + +
+
+
+Concurrent Transfers - This setting is used to define the number of calls that can be sent to agents at the same time. It is recommended that this setting is left at AUTO. This field is not used by the MANUAL dial method. + +
+
+
+Auto Alt-Number Dialing - This setting is used to automatically dial alternate number fields while dialing in the RATIO and ADAPT dial methods when there is no contact at the main phone number for a lead, the NA, B, DC and N statuses. This setting is not used by the MANUAL dial method. + +
+
+
+Next Agent Call - This determines which agent receives the next call that is available: +
  - random: orders by the random update value in the vicidial_live_agents table +
  - oldest_call_start: orders by the last time an agent was sent a call. Results in agents receiving about the same number of calls overall. +
  - oldest_call_finish: orders by the last time an agent finished a call. AKA agent waiting longest receives first call. +
  - overall_user_level: orders by the user_level of the agent as defined in the vicidial_users table a higher user_level will receive more calls. +
  - campaign_rank: orders by the rank given to the agent for the campaign. Highest to Lowest. +
  - fewest_calls: orders by the number of calls received by an agent for that specific inbound group. Least calls first. + +
+
+
+Local Call Time - This is where you set during which hours you would like to dial, as determined by the local time in the are in which you are calling. This is controlled by area code and is adjusted for Daylight Savings time if applicable. General Guidelines in the USA for Business to Business is 9am to 5pm and Business to Consumer calls is 9am to 9pm. + +
+
+
+Dial Timeout - If defined, calls that would normally hang up after the timeout defined in extensions.conf would instead timeout at this amount of seconds if it is less than the extensions.conf timeout. This allows for quickly changing dial timeouts from server to server and limiting the effects to a single campaign. If you are having a lot of Answering Machine or Voicemail calls you may want to try changing this value to between 21-26 and see if results improve. + +
+
+
+Dial Prefix - This field allows for more easily changing a path of dialing to go out through a different method without doing a reload in Asterisk. Default is 9 based upon a 91NXXNXXXXXX in the dial plan - extensions.conf. + +
+
+
+Omit Phone Code - This field allows you to leave out the phone_code field while dialing within VICIDIAL. For instance if you are dialing in the UK from the UK you would have 44 in as your phone_code field for all leads, but you just want to dial 10 digits in your dial plan extensions.conf to place calls instead of 44 then 10 digits. Default is N. + +
+
+
+Campaign CallerID - This field allows for the sending of a custom callerid number on the outbound calls. This is the number that would show up on the callerid of the person you are calling. The default is UNKNOWN. If you are using T1 or E1s to dial out this option is only available if you are using PRIs - ISDN T1s or E1s - that have the custom callerid feature turned on, this will not work with Robbed-bit service -RBS- circuits. This will also work through most VOIP -SIP or IAX trunks- providers that allow dynamic outbound callerID. The custom callerID only applies to calls placed for the VICIDIAL campaign directly, any 3rd party calls or transfers will not send the custom callerID. NOTE: Sometimes putting UNKNOWN or PRIVATE in the field will yield the sending of your default callerID number by your carrier with the calls. You may want to test this and put 0000000000 in the callerid field instead if you do not want to send you CallerID. + +
+
+
+Campaign VDAD extension - This field allows for a custom VDAD transfer extension. This allows you to use different VDADtransfer...agi scripts depending upon your campaign. The default transfer AGI - exten 8365 agi-VDADtransfer.agi - just immediately sends the calls on to agents as soon as they are picked up. An additional sample political survey AGI is also now included - 8366 agi-VDADtransferSURVEY.agi - that plays a message to the called person and allows them to make a choice by pressing buttons - effectively pre-screening the lead - . Please note that except for surveys, political calls and charities this form of calling is illegal in the United States. + +
+
+
+Campaign Rec extension - This field allows for a custom recording extension to be used with VICIDIAL. This allows you to use different extensions depending upon how long you want to allow a maximum recording and what type of codec you want to record in. The default exten is 8309 which if you follow the SCRATCH_INSTALL examples will record in the WAV format for upto one hour. Another option included in the examples is 8310 which will record in GSM format for upto one hour. + +
+
+
+Campaign Recording - This menu allows you to choose what level of recording is allowed on this campaign. NEVER will disable recording on the client. ONDEMAND is the default and allows the agent to start and stop recording as needed. ALLCALLS will start recording on the client whenever a call is sent to an agent. ALLFORCE will start recording on the client whenever a call is sent to an agent giving the agent no option to stop recording. For ALLCALLS and ALLFORCE there is an option to use the Recording Delay to cut down on very short recordings and recude system load. + +
+
+
+Campaign Rec Filename - This field allows you to customize the name of the recording when Campaign recording is ONDEMAND or ALLCALLS. The allowed variables are CAMPAIGN CUSTPHONE FULLDATE TINYDATE EPOCH AGENT. The default is FULLDATE_AGENT and would look like this 20051020-103108_6666. Another example is CAMPAIGN_TINYDATE_CUSTPHONE which would look like this TESTCAMP_51020103108_3125551212. 50 char max. + +
+
+
+Recording Delay - For ALLCALLS and ALLFORCE recording only. This setting will delay the starting of the recording on all calls for the number of seconds specified in this field. Default is 0. + +
+
+
+Campaign Script - This menu allows you to choose the script that will appear on the agents screen for this campaign. Select NONE to show no script for this campaign. + +
+
+
+Get Call Launch - This menu allows you to choose whether you want to auto-launch the web-form page in a separate window, auto-switch to the SCRIPT tab or do nothing when a call is sent to the agent for this campaign. + +
+
+
+Answering Machine Message - This field is for entering in an extension to blind transfer calls to when the agent gets an answering machine and clicks on the Answering Machine Message button in the transfer conference frame. You must set this exten up in the dial plan - extensions.conf - and make sure it plays an audio file then hangs up. + +
+
+
+AMD send to vm exten - This menu allows you to define whether a message is left on an answering machine when it is detected. the call will be immediately forwarded to the Answering-Machine-Message extension if AMD is active and it is determined that the call is an answering machine. + +
+
+
+Xfer-Conf DTMF - These four fields allow for you to have two sets of Transfer Conference and DTMF presets. When the call or campaign is loaded, the vicidial.php script will show two buttons on the transfer-conference frame and auto-populate the number-to-dial and the send-dtmf fields when pressed. If you want to allow Consultative Transfers, a fronter to a closer, you can place CXFER as one of the number-to-dial presets and the proper dial string will be sent to do a Local Consultative Transfer, then the agent can just LEAVE-3WAY-CALL and move on to their next call. If you want to allow Blind transfers of customers to a VICIDIAL AGI script for logging or an IVR, then place AXFER in the number-to-dial field. You can also specify an custom extension after the AXFER or CXFER, for instance if you want to do Internal Consultative transfers instead of Local you would put CXFER90009 in the number-to-dial field. + +
+
+
+Agent Alt Num Dialing - This option allows an agent to manually dial the alternate phone number or address3 field after the main number has been called. + +
+
+
+Scheduled Callbacks - This option allows an agent to disposition a call as CALLBK and choose the data and time at which the lead will be re-activated. + +
+
+
+Drop Call Seconds - The number of seconds from the time the customer line is picked up until the call is considered a DROP, only applies to outbound calls. + +
+
+
+Voicemail - If defined, calls that would normally DROP would instead be directed to this voicemail box to hear and leave a message. + +
+
+
+Safe Harbor Message - If set to Y will play a message to customer after the Drop Call Seconds timeout is reached without being transferred to an agent. This setting will override sending to a voicemail box if this is set to Y. + +
+
+
+Safe Harbor Exten - This is the dial plan extension that the desired Safe Harbor audio file is located at on your server. + +
+
+
+Wrap Up Seconds - The number of seconds to force an agent to wait before allowing them to receive or dial another call. The timer begins as soon as an agent hangs up on their customer - or in the case of alternate number dialing when the agent finishes the lead - Default is 0 seconds. If the timer runs out before the agent has dispositioned the call, the agent still will NOT move on to the next call until they select a disposition. + +
+
+
+Wrap Up Message - This is a campaign-specific message to be displayed on the wrap up screen if wrap up seconds is set. + +
+
+
+Use Internal DNC List - This defines whether this campaign is to filter leads against the Internal DNC list. If it is set to Y, the hopper will look for each phone number in the DNC list before placing it in the hopper. If it is in the DNC list then it will change that lead status to DNCL so it cannot be dialed. Default is N. + +
+
+
+Allowed Inbound Groups - For CLOSER campaigns only. Here is where you select the inbound groups you want agents in this CLOSER campaign to be able to take calls from. It is important for BLENDED inbound-outbound campaigns only to select the inbound groups that are used for agents in this campaign. The calls coming into the inbound groups selected here will be counted as active calls for a blended campaign even if all agents in the campaign are not logged in to receive calls from all of those selected inbound groups. + +
+
+
+Agent Pause Codes Active - Allows agents to select a pause code when they click on the PAUSE button in vicidial.php. Pause codes are definable per campaign at the bottom of the campaign view detail screen and they are stored in the vicidial_agent_log table. Default is N. + +
+
+
+Disable Alter Customer Data - If set to Y, does not change any of the customer data record when an agent dispositions the call. Default is N. + +
+
+
+Allow No-Hopper-Leads Logins - If set to Y, allows agents to login to the campaign even if there are no leads loaded into the hopper for that campaign. This function is not needed in CLOSER-type campaigns. Default is N. + +
+
+
+List Order Mix - Overrides the Lead Order and Dial Status fields. Will use the List and status parameters for the selected List Mix entry in the List Mix sub section instead. Default is DISABLED. + +
+
+
+List Mix ID - ID of the list mix. Must be from 2-20 characters in length with no spaces or other special punctuation. + +
+
+
+List Mix Name - Descriptive name of the list mix. Must be from 2-50 characters in length. + +
+
+
+List Mix Detail - The composition of the List Mix entry. Contains the List ID, mix order, percentages and statuses that make up this List Mix. The percentages always have to add up to 100, and the lists all have to be active and set to the campaign for the order mix entry to be Activated. + +
+
+
+List Mix Method - The method of mixing all of the parts of the List Mix Detail together. EVEN_MIX will mix leads from each part interleaved with the other parts, like this 1,2,3,1,2,3,1,2,3. IN_ORDER will put the leads in the order in which they are listed in the List Mix Detail screen 1,1,1,2,2,2,3,3,3. RANDOM will put them in RANDOM order 1,3,2,1,1,3,2,1,3. Default is IN_ORDER. + +
+
+
+Manual Dial List ID - The default list_id to be used when an agent placces a manual call and a new lead record is created in vicidial_list. Default is 999. This field can contain digits only. + + + + +



+ +VICIDIAL_LISTS TABLE

+
+
+List ID - This is the numerical name of the list, it is not editable after initial submission, must contain only numbers and must be between 2 and 8 characters in length. Must be a number greater than 100. + +
+
+
+List Name - This is the description of the list, it must be between 2 and 20 characters in length. + +
+
+
+List Description - This is the memo field for the list, it is optional. + +
+
+
+List Change Date - This is the last time that the settings for this list were modified in any way. + +
+
+
+List Last Call Date - This is the last time that lead was dialed from this list. + +
+
+
+Campaign - This is the campaign that this list belongs to. A list can only be dialed on a single campaign at one time. + +
+
+
+Active - This defines whether the list is to be dialed on or not. + +
+
+
+Reset Lead-Called-Status for this list - This resets all leads in this list to N for "not called since last reset" and means that any lead can now be called if it is the right status as defined in the campaign screen. + +
+
+
+VICIDIAL DNC List - This Do Not Call list contains every lead that has been set to a status of DNC in the system. Through the LISTS - ADD NUMBER TO DNC page you are able to manually add a number to this list so that it will not be called by campaigns that use the internal DNC list. + + + +



+ +VICIDIAL_INBOUND_GROUPS TABLE

+
+
+Group ID - This is the short name of the inbound group, it is not editable after initial submission, must not contain any spaces and must be between 2 and 20 characters in length. + +
+
+
+Group Name - This is the description of the group, it must be between 2 and 30 characters in length. Cannot include dashes, plusses or spaces . + +
+
+
+Group Color - This is the color that displays in the VICIDIAL client app when a call comes in on this group. It must be between 2 and 7 characters long. If this is a hex color definition you must remember to put a # at the beginning of the string or VICIDIAL will not work properly. + +
+
+
+Active - This determines whether this group show up in the selection box when a VICIDIAL agent logs in. + +
+
+
+Web Form - This is the custom address that clicking on the WEB FORM button in VICIDIAL will take you to for calls that come in on this group. + +
+
+
+Next Agent Call - This determines which agent receives the next call that is available: +
  - random: orders by the random update value in the vicidial_live_agents table +
  - oldest_call_start: orders by the last time an agent was sent a call. Results in agents receiving about the same number of calls overall. +
  - oldest_call_finish: orders by the last time an agent finished a call. AKA agent waiting longest receives first call. +
  - overall_user_level: orders by the user_level of the agent as defined in the vicidial_users table a higher user_level will receive more calls. +
  - inbound_group_rank: orders by the rank given to the agent for the specific inbound group. Highest to Lowest. +
  - fewest_calls: orders by the number of calls received by an agent for that specific inbound group. Least calls first. +
  - campaign_rank: orders by the rank given to the agent for the campaign. Highest to Lowest. +
  - fewest_calls_campaign: orders by the number of calls received by an agent for the campaign. Least calls first. +
+
+
+Fronter Display - This field determines whether the inbound VICIDIAL agent would have the fronter name - if there is one - displayed in the Status field when the call comes to the agent. + +
+
+
+Campaign Script - This menu allows you to choose the script that will appear on the agents screen for this campaign. Select NONE to show no script for this campaign. + +
+
+
+Get Call Launch - This menu allows you to choose whether you want to auto-launch the web-form page in a separate window, auto-switch to the SCRIPT tab or do nothing when a call is sent to the agent for this campaign. + +
+
+
+Xfer-Conf DTMF - These four fields allow for you to have two sets of Transfer Conference and DTMF presets. When the call or campaign is loaded, the vicidial.php script will show two buttons on the transfer-conference frame and auto-populate the number-to-dial and the send-dtmf fields when pressed. If you want to allow Consultative Transfers, a fronter to a closer, you can place CXFER as one of the number-to-dial presets and the proper dial string will be sent to do a Local Consultative Transfer, then the agent can just LEAVE-3WAY-CALL and move on to their next call. If you want to allow Blind transfers of customers to a VICIDIAL AGI script for logging or an IVR, then place AXFER in the number-to-dial field. You can also specify an custom extension after the AXFER or CXFER, for instance if you want to do Internal Consultative transfers instead of Local you would put CXFER90009 in the number-to-dial field. + +
+
+
+Drop Call Seconds - The number of seconds from the time the customer line is picked up until the call is considered a DROP, only applies to outbound calls. + +
+
+
+Voicemail - If defined, calls that would normally DROP would instead be directed to this voicemail box to hear and leave a message. + +
+
+
+Drop Message - If set to Y will play a message to customer after the Drop Call Seconds timeout is reached without being transferred to an agent. This setting will override sending to a voicemail box if this is set to Y. + +
+
+
+Drop Exten - This is the dial plan extension that the desired Dropped call audio file is located at on your server. + +
+
+
+Call Time - This is the call time scheme to use for this inbound group. Keep in mind that the time is based on the server time. Default is 24hours. + +
+
+
+After Hours Action - The action to perform if it is after hours as defined in the call time for this inbound group. HANGUP will immediately hangup the call, MESSASGE will play the file in the After Hours Message Filenam field, EXTENSION will send the call to the After Hours Extension in the dialplan and VOICEMAIL will send the call to the voicemail box listed in the After Hours Voicemail field. Default is MESSAGE. + +
+
+
+After Hours Message Filename - The audio file located on the server to be played if the Action is set to MESSAGE. Default is vm-goodbye + +
+
+
+After Hours Extension - The dialplan extension to send the call to if the Action is set to EXTENSION. Default is 8300. + +
+
+
+After Hours Voicemail - The voicemail box to send the call to if the Action is set to VOICEMAIL. + +
+
+
+Welcome Message Filename - The audio file located on the server to be played when the call comes in. If set to ---NONE--- then no message will be played. Default is ---NONE--- + +
+
+
+Music On Hold Context - The music on hold context to use when the customer is placed on hold. Default is default. + +
+
+
+On Hold Prompt Filename - The audio file located on the server to be played at a regular interval when the customer is on hold. Default is generic_hold. This audio file MUST be 9 seconds or less in length. + +
+
+
+On Hold Prompt Interval - The length of time in seconds to wait before playing the on hold prompt. Default is 60. + +
+
+
+Agent Alert Extension - The extension to send into the agent session to announce that a call is coming to the agent. This extension should have a Playback of an audio file. To not use this function set this to X. Default is X. + +
+
+
+Agent Alert Delay - The length of time in milliseconds to wait before sending the call to the agent after playing the on Agent Alert Extension. Default is 1000. + +
+
+
+Default Transfer Group - This field is the default In-Group that will be automatically selected when the agent goes to the transfer-conference frame in their agent interface. + + + +



+ +VICIDIAL_REMOTE_AGENTS TABLE

+
+
+User ID Start - This is the starting User ID that is used when the remote agent entries are inserted into the system. If the Number of Lines is set higher than 1, this number is incremented by one until each line has an entry. Make sure you create a new VICIDIAL user account with a user level of 4 or great if you want them to be able to use the vdremote.php page for remote web access of this account. + +
+
+
+Number of Lines - This defines how many remote agent entries the system creates, and determines how many lines it thinks it can safely send to the number below. + +
+
+
+Server IP - A remote agent entry is only good for one specific server, here is where you select which server you want. + +
+
+
+External Extension - This is the number that you want the calls forwarded to. Make sure that it is a full dial plan number and that if you need a 9 at the beginning you put it in here. Test by dialing this number from a phone on the system. + +
+
+
+Status - Here is where you turn the remote agent on and off. As soon as the agent is Active the system assumes that it can send calls to it. It may take up to 30 seconds once you change the status to Inactive to stop receiving calls. + +
+
+
+Campaign - Here is where you select the campaign that these remote agents will be logged into. Inbound needs to use the CLOSER campaign and select the inbound campaigns below that you want to receive calls from. + +
+
+
+Inbound Groups - Here is where you select the inbound groups you want to receive calls from if you have selected the CLOSER campaign. + + +



+ +VICIDIAL_CAMPAIGN_LISTS

+
+
+The lists within this campaign are listed here, whether they are active is denoted by the Y or N and you can go to the list screen by clicking on the list ID in the first column. + + +



+ +VICIDIAL_CAMPAIGN_STATUSES TABLE

+
+
+Through the use of custom campaign statuses, you can have statuses that only exist for a specific campaign. The Status must be 1-8 characters in length, the description must be 2-30 characters in length and Selectable defines whether it shows up in VICIDIAL as a disposition. The human_answered field is used when calculating the drop percentage, or abandon rate. Setting human_answered to Y will use this status when counting the human-answered calls. The Category option allows you to group several statuses into a catogy that can be used for statistical analysis. + + + +



+ +VICIDIAL_CAMPAIGN_HOTKEYS TABLE

+
+
+Through the use of custom campaign hot keys, agents that use the vicidial web-client can hang up and disposition calls just by pressing a single key on their keyboard. There are two special HotKey options that you can use in conjunction with Alternate Phone number dialing, ALTPH2 - Alternate Phone Hot Dial and ADDR3-----Address3 Hot Dial allow an agent to use a hotkey to hang up their call, stay on the same lead, and dial another contact number from that lead. + + + + + +



+ +VICIDIAL_LEAD_RECYCLE TABLE

+
+
+Through the use of lead recycling, you can call specific statuses of leads again at a specified interval without resetting the entire list. Lead recycling is campaign-specific and does not have to be a selected dialable status in your campaign. The attempt delay field is the number of seconds until the lead can be placed back in the hopper, this number must be at least 120 seconds. The attempt maximum field is the maximum number of times that a lead of this status can be attempted before the list needs to be reset, this number can be from 1 to 10. You can activate and deactivate a lead recycle entry with the provided links. + + + + + +



+ +VICIDIAL AUTO ALT DIAL STATUSES

+
+
+If the Auto Alt-Number Dialing field is set, then the leads that are dispositioned under these auto alt dial statuses will have their alt_phone and-or address3 fields dialed after any of these no-answer statuses are set. + + + + + +



+ +VICIDIAL AGENT PAUSE CODES

+
+
+If the Agent Pause Codes Active field is set to active then the agents will be able to select from these pause codes when they click on the PAUSE button on their screens. This data is then stored in the vicidial agent log. The Pause code must contain only letters and numbers and be less than 7 characters long. The pause code name can be no longer than 30 characters. + + + + + +



+ +VICIDIAL_USER_GROUPS TABLE

+
+
+User Group - This is the short name of a Vicidial User group, try not to use any spaces or punctuation for this field. max 20 characters, minimum of 2 characters. + +
+
+
+Group Name - This is the description of the vicidial user group max of 40 characters. + +
+
+
+Allowed Campaigns - This is a selectable list of Campaigns to which members of this user group can log in to. The ALL-CAMPAIGNS option allows the users in this group to see and log in to any campaign on the system. + + + + + +



+ +VICIDIAL_SCRIPTS TABLE

+
+
+Script ID - This is the short name of a Vicidial Script. This needs to be a unique identifier. Try not to use any spaces or punctuation for this field. max 10 characters, minimum of 2 characters. + +
+
+Script Name - This is the title of a Vicidial Script. This is a short summary of the script. max 50 characters, minimum of 2 characters. There should be no spaces or punctuation of any kind in theis field. + +
+
+Script Comments - This is where you can place comments for a Vicidial Script such as -changed to free upgrade on Sept 23-. max 255 characters, minimum of 2 characters. + +
+
+Script Text - This is where you place the content of a Vicidial Script. Minimum of 2 characters. You can have customer information be auto-populated in this script using "--A--field--B--" where field is one of the following fieldnames: vendor_lead_code, source_id, list_id, gmt_offset_now, called_since_last_reset, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments, lead_id, campaign, phone_login, group, channel_group, SQLdate, epoch, uniqueid, customer_zap_channel, server_ip, SIPexten, session_id. For example, this sentence would print the persons name in it----

Hello, can I speak with --A--first_name--B-- --A--last_name--B-- please? Well hello --A--title--B-- --A--last_name--B-- how are you today?

This would read----

Hello, can I speak with John Doe please? Well hello Mr. Doe how are you today?

You can also use an iframe to load a separate window within the SCRIPT tab, here is an example with prepopulated variables: + +
+<iframe src="http://astguiclient.sf.net/test_VICIDIAL_output.php?lead_id=--A--lead_id--B--&vendor_id=--A--vendor_lead_code--B--&list_id=--A--list_id--B--&gmt_offset_now=--A--gmt_offset_now--B--&phone_code=--A--phone_code--B--&phone_number=--A--phone_number--B--&title=--A--title--B--&first_name=--A--first_name--B--&middle_initial=--A--middle_initial--B--&last_name=--A--last_name--B--&address1=--A--address1--B--&address2=--A--address2--B--&address3=--A--address3--B--&city=--A--city--B--&state=--A--state--B--&province=--A--province--B--&postal_code=--A--postal_code--B--&country_code=--A--country_code--B--&gender=--A--gender--B--&date_of_birth=--A--date_of_birth--B--&alt_phone=--A--alt_phone--B--&email=--A--email--B--&security_phrase=--A--security_phrase--B--&comments=--A--comments--B--&user=--A--user--B--&campaign=--A--campaign--B--&phone_login=--A--phone_login--B--&fronter=--A--fronter--B--&closer=--A--user--B--&group=--A--group--B--&channel_group=--A--group--B--&SQLdate=--A--SQLdate--B--&epoch=--A--epoch--B--&uniqueid=--A--uniqueid--B--&customer_zap_channel=--A--customer_zap_channel--B--&server_ip=--A--server_ip--B--&SIPexten=--A--SIPexten--B--&session_id=--A--session_id--B--&phone=--A--phone--B--" style="width:580;height:290;background-color:transparent;" scrolling="auto" frameborder="0" allowtransparency="true" id="popupFrame" name="popupFrame" width="460" height="290" STYLE="z-index:17"> +</iframe> +
+ +
+
+
+Active - This determines whether this script can be selected to be used by a campaign. + + + + + +



+ +VICIDIAL_LEAD_FILTERS TABLE

+
+
+Filter ID - This is the short name of a Vicidial Lead Filter. This needs to be a unique identifier. Do not use any spaces or punctuation for this field. max 10 characters, minimum of 2 characters. + +
+
+Filter Name - This is a more descriptive name of the Filter. This is a short summary of the filter. max 30 characters, minimum of 2 characters. + +
+
+Filter Comments - This is where you can place comments for a Vicidial Filter such as -calls all California leads-. max 255 characters, minimum of 2 characters. + +
+
+Filter SQL - This is where you place the SQL query fragment that you want to filter by. do not begin or end with an AND, that will be added by the hopper cron script automatically. an example SQL query that would work here is- called_count > 4 and called_count < 8 -. + + + + + +



+ +VICIDIAL_CALL TIMES TABLE

+
+
+Call Time ID - This is the short name of a Vicidial Call Time Definition. This needs to be a unique identifier. Do not use any spaces or punctuation for this field. max 10 characters, minimum of 2 characters. + +
+
+Call Time Name - This is a more descriptive name of the Call Time Definition. This is a short summary of the Call Time definition. max 30 characters, minimum of 2 characters. + +
+
+Call Time Comments - This is where you can place comments for a Vicidial Call Time Definition such as -10am to 4pm with extra call state restrictions-. max 255 characters. + +
+
+Default Start and Stop Times - This is the default time that calling will be allowed to be started or stopped within this call time definition if the day-of-the-week start time is not defined. 0 is midnight. To prevent calling completely set this field to 2400 and set the Default Stop time to 2400. To allow calling 24 hours a day set the start time to 0 and the stop time to 2400. + +
+
+Weekday Start and Stop Times - These are the custom times per day that can be set for the call time definition. same rules apply as with the Default start and stop times. + +
+
+State Call Time Definitions - This is the list of State specific call time definitions that are followed in this Call Time Definition. + +
+
+State Call Time State - This is the two letter code for the state that this calling time definition is for. For this to be in effect the local call time that is set in the campaign must have this state call time record in it as well as all of the leads having two letter state codes in them. + + + + +



+ +VICIDIAL LIST LOADER FUNCTIONALITY

+
+
+The VICIDIAL basic web-based lead loader is designed simply to take a lead file - up to 8MB in size - that is either tab or pipe delimited and load it into the vicidial_list table. The lead loader allows for field choosing and TXT- Plain Text, CSV- Comma Separated Values and XLS- Excel file formats. The lead loader does not do data validation, but it does allow you to check for duplicates in itself, within the campaign or within the entire system. Also, make sure that you have created the list that these leads are to be under so that you can use them. Here is a list of the fields in their proper order for the lead files: +
    +
  1. Vendor Lead Code - shows up in the Vendor ID field of the GUI +
  2. Source Code - internal use only for admins and DBAs +
  3. List ID - the list number that these leads will show up under +
  4. Phone Code - the prefix for the phone number - 1 for US, 01144 for UK, 01161 for AUS, etc +
  5. Phone Number - must be at least 8 digits long +
  6. Title - title of the customer - Mr. Ms. Mrs, etc... +
  7. First Name +
  8. Middle Initial +
  9. Last Name +
  10. Address Line 1 +
  11. Address Line 2 +
  12. Address Line 3 +
  13. City +
  14. State - limited to 2 characters +
  15. Province +
  16. Postal Code +
  17. Country +
  18. Gender +
  19. Date of Birth +
  20. Alternate Phone Number +
  21. Email Address +
  22. Security Phrase +
  23. Comments +
+ +
NOTES: The Excel Lead loader functionality is enabled by a series of perl scripts and needs to have a properly configured /etc/astguiclient.conf file in place on the web server. Also, a couple perl modules must be loaded for it to work as well - OLE-Storage_Lite and Spreadsheet-ParseExcel. You can check for runtime errors in these by looking at your apache error_log file. Also, for duplication checks against gampaign lists, the list that has new leads going into it does need to be created in the system before you start to load the leads. + + + + +



+ + + + + + +PHONES TABLE

+
+
+Phone extension - This field is where you put the phones name as it appears to Asterisk not including the protocol or slash at the beginning. For Example: for the SIP phone SIP/test101 the Phone extension would be test101. Also, for IAX2 phones make sure you use the full phones name: IAX2/IAXphone1@IAXphone1 would be IAXphone1@IAXphone1. For Zap phones make sure you put the full channel: Zap/25-1 would be 25-1. Another note, make sure you set the Protocol below correctly for your type of phone. + +
+
+
+Dial Plan Number - This field is for the number you dial to have the phone ring. This number is defined in the extensions.conf file of your Asterisk server + +
+
+
+Voicemail Box - This field is for the voicemail box that the messages go to for the user of this phone. We use this to check for voicemail messages and for the user to be able to use the VOICEMAIL button on astGUIclient app. + +
+
+
+Outbound CallerID - This field is where you would enter the callerID number that you would like to appear on outbound calls placed form the astguiclient web-client. This does not work on RBS, non-PRI, T1/E1s. + +
+
+
+Phone IP address - This field is for the phone's IP address if it is a VOIP phone. This is an optional field + +
+
+
+Computer IP address - This field is for the user's computer IP address. This is an optional field + +
+
+
+Server IP - This menu is where you select which server the phone is active on. + +
+
+
+Login - The login used for the phone user to login to the client applications. + +
+
+
+Password - The password used for the phone user to login to the client applications. + +
+
+
+Status - The status of the phone in the system, ACTIVE and ADMIN allow for GUI clients to work. ADMIN allows access to this administrative web site. All other statuses do not allow GUI or Admin web access. + +
+
+
+Active Account - Whether the phone is active to put it in the list in the GUI client. + +
+
+
+Phone Type - Purely for administrative notes. + +
+
+
+Full Name - Used by the GUIclient in the list of active phones. + +
+
+
+Company - Purely for administrative notes. + +
+
+
+Picture - Not yet Implemented. + +
+
+
+New Messages - Number of new voicemail messages for this phone on the Asterisk server. + +
+
+
+Old Messages - Number of old voicemail messages for this phone on the Asterisk server. + +
+
+
+Client Protocol - The protocol that the phone uses to connect to the Asterisk server: SIP, IAX2, Zap . Also, there is EXTERNAL for remote dial numbers or speed dial numbers that you want to list as phones. + +
+
+
+Local GMT - The difference from Greenwich Mean time, or ZULU time where the phone is located. DO NOT ADJUST FOR DAYLIGHT SAVINGS TIME. This is used by the VICIDIAL campaign to accurately display the time and customer time. + +
+
+
+Manager Login - This is the login that the GUI clients for this phone will use to access the Database where the server data resides. + +
+
+
+Manager Secret - This is the password that the GUI clients for this phone will use to access the Database where the server data resides. + +
+
+
+VICIDIAL Default User - This is to place a default value in the VICIDIAL user field whenever this phone user opens the astVICIDIAL client app. Leave blank for no user. + +
+
+
+VICIDIAL Default Pass - This is to place a default value in the VICIDIAL password field whenever this phone user opens the astVICIDIAL client app. Leave blank for no pass. + +
+
+
+VICIDIAL Default Campaign - This is to place a default value in the VICIDIAL campaign field whenever this phone user opens the astVICIDIAL client app. Leave blank for no campaign. + +
+
+
+Park Exten - This is the default Parking extension for the client apps. Verify that a different one works before you change this. + +
+
+
+Conf Exten - This is the default Conference park extension for the client apps. Verify that a different one works before you change this. + +
+
+
+VICIDIAL Park Exten - This is the default Parking extension for VICIDIAL client app. Verify that a different one works before you change this. + +
+
+
+VICIDIAL Park File - This is the default VICIDIAL park extension file name for the client apps. Verify that a different one works before you change this. limited to 10 characters. + +
+
+
+Monitor Prefix - This is the dial plan prefix for monitoring of Zap channels automatically within the astGUIclient app. Only change according to the extensions.conf ZapBarge extensions records. + +
+
+
+Recording Exten - This is the dial plan extension for the recording extension that is used to drop into meetme conferences to record them. It usually lasts upto one hour if not stopped. verify with extensions.conf file before changing. + +
+
+
+VMAIL Main Exten - This is the dial plan extension going to check your voicemail. verify with extensions.conf file before changing. + +
+
+
+VMAIL Dump Exten - This is the dial plan prefix used to send calls directly to a user's voicemail from a live call in the astGUIclient app. verify with extensions.conf file before changing. + +
+
+
+Exten Context - This is the dial plan context that this phone primarily uses. It is assumed that all numbers dialed by the client apps are using this context so it is a good idea to make sure this is the most wide context possible. verify with extensions.conf file before changing. + +
+
+
+DTMF send Channel - This is the channel string used to send DTMF sounds into meetme conferences from the client apps. Verify the exten and context with the extensions.conf file. + +
+
+
+Outbound Call Group - This is the channel group that outbound calls from this phone are placed out of. There are a couple routines in the client apps that use this. For Zap channels you want to use something like Zap/g2 , for IAX2 trunks you would want to use the full IAX prefix like IAX2/VICItest1:secret@10.10.10.15:4569. Verify the trunks with the extensions.conf file, it is usually what you have defined as the TRUNK global variable at the top of the file. + +
+
+
+Browser Location - This is applicable to only UNIX/LINUX clients, the absolute path to Mozilla or Firefox browser on the machine. verify this by launching it manually. + +
+
+
+Install Directory - This is the place where the astGUIclient and astVICIDIAL scripts are located on your machine. For Win32 it should be something like C:\AST_VICI and for UNIX it should be something like /usr/local/perl_TK. verify this manually. + +
+
+
+CallerID URL - This is the web address of the page used to do custom callerID lookups. default testing address is: http://astguiclient.sf.net/test_callerid_output.php + +
+
+
+VICIDIAL Default URL - This is the web address of the page used to do custom VICIDIAL Web Form queries. default testing address is: http://astguiclient.sf.net/test_VICIDIAL_output.php + +
+
+
+Call Logging - This is set to true if the call_log.agi file is in place in the extensions.conf file for all outbound and hang up 'h' extensions to log all calls. This should always be 1 because it is manditory for many astGUIclient and VICIDIAL features to work properly. + +
+
+
+User Switching - Set to true to allow user to switch to another user account. NOTE: If user switches they can initiate recording on the new user's phone conversation + +
+
+
+Conferencing - Set to true to allow user to start conference calls with upto six external lines. + +
+
+
+Admin Hang Up - Set to true to allow user to be able to hang up any line at will through astGUIclient. Good idea only to enable this for Admin users. + +
+
+
+Admin Hijack - Set to true to allow user to be able to grab and redirect to their extension any line at will through astGUIclient. Good idea only to enable this for Admin users. But is very useful for Managers. + +
+
+
+Admin Monitor - Set to true to allow user to be able to grab and redirect to their extension any line at will through astGUIclient. Good idea only to enable this for Admin users. But is very useful for Managers and as a training tool. + +
+
+
+Call Park - Set to true to allow user to be able to park calls on astGUIclient hold to be picked up by any other astGUIclient user on the system. Calls stay on hold for upto a half hour then hang up. Usually enabled for all. + +
+
+
+Updater Check - Set to true to display a popup warning that the updater time has not changed in 20 seconds. Useful for Admin users. + +
+
+
+AF Logging - Set to true to log many actions of astGUIclient usage to a text file on the user's computer. + +
+
+
+Queue Enabled - Set to true to have client apps use the Asterisk Central Queue system. Required for VICIDIAL and recommended for all users. + +
+
+
+CallerID Popup - Set to true to allow for numbers defined in the extensions.conf file to send CallerID popup screens to astGUIclient users. + +
+
+
+VMail Button - Set to true to display the VOICEMAIL button and the messages count display on astGUIclient. + +
+
+
+Fast Refresh - Set to true to enable a new rate of refresh of call information for the astGUIclient. Default disabled rate is 1000 ms ,1 second. Can increase system load if you lower this number. + +
+
+
+Fast Refresh Rate - in milliseconds. Only used if Fast Refresh is enabled. Default disabled rate is 1000 ms ,1 second. Can increase system load if you lower this number. + +
+
+
+Persistant MySQL - If enabled the astGUIclient connection will remain connected instead of connecting every second. Useful if you have a fast refresh rate set. It will increase the number of connections on your MySQL machine. + +
+
+
+Auto Dial Next Number - If enabled the VICIDIAL client will dial the next number on the list automatically upon disposition of a call unless they selected to "Stop Dialing" on the disposition screen. + +
+
+
+Stop Rec after each call - If enabled the VICIDIAL client will stop whatever recording is going on after each call has been dispositioned. Useful if you are doing a lot of recording or you are using a web form to trigger recording. + +
+
+
+Enable SIPSAK Messages - If enabled the server will send messages to the SIP phone to display on the phone LCD display when logged into VICIDIAL. Feature only works with SIP phones and requires sipsak application to be installed on the web server. Default is 0. + +
+
+
+DBX Server - The MySQL database server that this user should be connecting to. + +
+
+
+DBX Database - The MySQL database that this user should be connecting to. Default is asterisk. + +
+
+
+DBX User - The MySQL user login that this user should be using when connecting. Default is cron. + +
+
+
+DBX Pass - The MySQL user password that this user should be using when connecting. Default is 1234. + +
+
+
+DBX Port - The MySQL TCP port that this user should be using when connecting. Default is 3306. + +
+
+
+DBY Server - The MySQL database server that this user should be connecting to. Secondary server, not used currently. + +
+
+
+DBY Database - The MySQL database that this user should be connecting to. Default is asterisk. Secondary server, not used currently. + +
+
+
+DBY User - The MySQL user login that this user should be using when connecting. Default is cron. Secondary server, not used currently. + +
+
+
+DBY Pass - The MySQL user password that this user should be using when connecting. Default is 1234. Secondary server, not used currently. + +
+
+
+DBY Port - The MySQL TCP port that this user should be using when connecting. Default is 3306. Secondary server, not used currently. + + +



+ +SERVERS TABLE

+
+
+Server ID - This field is where you put the Asterisk servers name, doesnt have to be an official domain sub, just a nickname to identify the server to Admin users. + +
+
+
+Server Description - The field where you use a small phrase to describe the Asterisk server. + +
+
+
+Server IP Address - The field where you put the Network IP address of the Asterisk server. + +
+
+
+Active - Set whether the Asterisk server is active or inactive. + +
+
+
+Asterisk Version - Set the version of Asterisk that you have installed on this server. Examples: '1.2', '1.0.8', '1.0.7', 'CVS_HEAD', 'REALLY OLD', etc... This is used because versions 1.0.8 and 1.0.9 have a different method of dealing with Local/ channels, a bug that has been fixed in CVS v1.0, and need to be treated differently when handling their Local/ channels. Also, current CVS_HEAD and the 1.2 release tree uses different manager and command output so it must be treated differently as well. + +
+
+
+Max VICIDIAL Trunks - This field will determine the maximum number of lines that the VICIDIAL auto-dialer will attempt to call on this server. If you want to dedicate two full PRI T1s to VICIDIALing on a server then you would set this to 46. Default is 96. + +
+
+
+Telnet Host - This is the address or name of the Asterisk server and is how the manager applications connect to it from where they are running. If they are running on the Asterisk server, then the default of 'localhost' is fine. + +
+
+
+Telnet Port - This is the port of the Asterisk server Manager connection and is how the manager applications connect to it from where they are running. The default of '5038' is fine for a standard install. + +
+
+
+Manager User - The username or login used to connect genericly to the Asterisk server manager. Default is 'cron' + +
+
+
+Manager Secret - The secret or password used to connect genericly to the Asterisk server manager. Default is '1234' + +
+
+
+Manager Update User - The username or login used to connect to the Asterisk server manager optimized for the Update scripts. Default is 'updatecron' and assumes the same secret as the generic user. + +
+
+
+Manager Listen User - The username or login used to connect to the Asterisk server manager optimized for scripts that only listen for output. Default is 'listencron' and assumes the same secret as the generic user. + +
+
+
+Manager Send User - The username or login used to connect to the Asterisk server manager optimized for scripts that only send Actions to the manager. Default is 'sendcron' and assumes the same secret as the generic user. + +
+
+
+Server GMT offset - The difference in hours from GMT time not adjusted for Daylight-Savings-Time of the server. Default is '-5' + +
+
+
+VMail Dump Exten - The extension prefix used on this server to send calls directly through agc to a specific voicemail box. Default is '85026666666666' + +
+
+
+VICIDIAL AD extension - The default extension if none is present in the campaign to send calls to for VICIDIAL auto dialing. Default is '8365' + +
+
+
+Default Context - The default dial plan context used for scripts that operate for this server. Default is 'default' + +
+
+
+System Performance - Setting this option to Y will enable logging of system performance stats for the server machine including system load, system processes and Asterisk channels in use. Default is N. + +
+
+
+Server Logs - Setting this option to Y will enable logging of all VICIDIAL related scripts to their text log files. Setting this to N will stop writing logs to files for these processes, also the screen logging of asterisk will be disabled if this is set to N when Asterisk is started. Default is Y. + +
+
+
+AGI Output - Setting this option to NONE will disable output from all VICIDIAL related AGI scripts. Setting this to STDERR will send the AGI output to the Asterisk CLI. Setting this to FILE will send the output to a file in the logs directory. Setting this to BOTH will send output to both the Asterisk CLI and a log file. Default is FILE. + +
+
+
+VICIDIAL Balance Dialing - Setting this field to Y will allow the server to place balance calls for campaigns in VICIDIAL so that the defined dial level can be met even if there are no agents logged into that campaign on this server. Default is N. + +
+
+
+VICIDIAL Balance Offlimits - This setting defines the number of trunks to not allow VICIDIAL balance dialing to use. For example if you have 40 max vicidial trunks and balance offlimits is set to 10 you will only be able to use 30 trunk lines for VICIDIAL balance dialing. Default is 0. + + +



+ +CONFERENCES TABLE

+
+
+Conference Number - This field is where you put the meetme conference dialpna number. It is also recommended that the meetme number in meetme.conf matches this number for each entry. This is for the conferences in astGUIclient and is used for leave-3way-call functionality in VICIDIAL. + +
+
+
+Server IP - The menu where you select the Asterisk server that this conference will be on. + + + + +



+ +VICIDIAL_SERVER_TRUNKS TABLE

+
+
+VICIDIAL Server Trunks allows you to restrict the outgoing lines that are used on this server for campaign dialing on a per-campaign basis. You have the option to reserve a specific number of lines to be used by only one campaign as well as allowing that campaign to run over its reserved lines into whatever lines remain open, as long at the total lines used by vicidial on this server is less than the Max VICIDIAL Trunks setting. Not having any of these records will allow the campaign that dials the line first to have as many lines as it can get under the Max VICIDIAL Trunks setting. + + + + + +



+ +SYSTEM_SETTINGS TABLE

+
+
+Use Non-Latin - This option allows you to default the web display script to use UTF8 characters and not do any latin-character-family regular expression filtering or display formatting. Default is 0. + +
+
+
+Webroot Writable - This setting allows you to define whether temp files and authentication files should be placed in the webroot on your web server. Default is 1. + +
+
+
+Enable QueueMetrics Logging - This setting allows you to define whether VICIDIAL will insert log entries into the queue_log database table as Asterisk Queues activity does. QueueMetrics is a standalone, closed-source statistical analysis program. You must have QueueMetrics already installed and configured before enabling this feature. Default is 0. + +
+
+
+QueueMetrics Server IP - This is the IP address of the database for your QueueMetrics installation. + +
+
+
+QueueMetrics Database Name - This is the database name for your QueueMetrics database. + +
+
+
+QueueMetrics Database Login - This is the user name used to log in to your QueueMetrics database. + +
+
+
+QueueMetrics Database Password - This is the password used to log in to your QueueMetrics database. + +
+
+
+QueueMetrics URL - This is the URL or web site address used to get to your QueueMetrics installation. + +
+
+
+QueueMetrics Log ID - This is the server ID that all VICIDIAL logs going into the QueueMetrics database will use as an identifier for each record. + +
+
+
+QueueMetrics EnterQueue Prepend - This field is used to allow for prepending of one of the vicidial_list data fields in front of the phone number of the customer for customized QueueMetrics reports. Default is NONE to not populate anything. + +
+
+
+VICIDIAL Agent Disable Display - This field is used to select when to show an agent when their session has been disabled by the system, a manager action or by an external measure. The NOT_ACTIVE setting will disable the message on the agents screen. The LIVE_AGENT setting will only display the disabled message when the agents vicidial_auto_calls record has been removed, such as during a force logout or emergency logout. + +
+
+
+Allow SIPSAK Messages - If set to 1, this will allow the phones table setting to work properly, the server will send messages to the SIP phone to display on the phone LCD display when logged into VICIDIAL. This feature only works with SIP phones and requires sipsak application to be installed on the web server. Default is 0. + +
+
+
+Admin Home URL - This is the URL or web site address that you will go to if you click on the HOME link at the top of the admin.php page. + +
+
+
+Enable Agent Transfer Logfile - This option will log to a text logfile on the webserver every time a call is transferred to an agent. Default is 0, disabled. + + + + + +



+ +VICIDIAL_STATUSES TABLE

+
+
+Through the use of system statuses, you can have statuses that exist for campaign and in-group. The Status must be 1-6 characters in length, the description must be 2-30 characters in length and Selectable defines whether it shows up in VICIDIAL as an agent disposition. The human_answered field is used when calculating the drop percentage, or abandon rate. Setting human_answered to Y will use this status when counting the human-answered calls. The Category option allows you to group several statuses into a catogy that can be used for statistical analysis. + + +



+ +VICIDIAL_STATUS_CATEGORIES TABLE

+
+
+Through the use of system status categories, you can group together statuses to allow for statistical analysis on a group of statuses. The Category ID must be 2-20 characters in length with no spaces, the name must be 2-50 characters in length, the description is optional and TimeonVDAD Display defines whether that status will be one of the upto 4 statuses that can be calculated and displayed on the Time On VDAD Real-Time report. + + + + +







+







+THE END +
+\n"; + echo "\n"; + echo "\n"; + echo ""; + + $stmt="SELECT dial_statuses,local_call_time,lead_filter_id from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $dial_statuses = $row[0]; + $local_call_time = $row[1]; + if ($lead_filter_id=='') + { + $lead_filter_id = $row[2]; + if ($lead_filter_id=='') + { + $lead_filter_id='NONE'; + } + } + + $stmt="SELECT list_id,active,list_name from vicidial_lists where campaign_id='$campaign_id'"; + $rslt=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rslt); + $camp_lists=''; + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + if (ereg("Y", $rowx[1])) {$camp_lists .= "'$rowx[0]',";} + } + $camp_lists = eregi_replace(".$","",$camp_lists); + + $filterSQL = $filtersql_list[$lead_filter_id]; + $filterSQL = eregi_replace("^and|and$|^or|or$","",$filterSQL); + if (strlen($filterSQL)>4) + {$fSQL = "and $filterSQL";} + else + {$fSQL = '';} + + + echo "

\n"; + echo "Show Dialable Leads Count -

\n"; + echo "CAMPAIGN: $campaign_id
\n"; + echo "LISTS: $camp_lists
\n"; + echo "STATUSES: $dial_statuses
\n"; + echo "FILTER: $lead_filter_id
\n"; + echo "CALL TIME: $local_call_time

\n"; + + ### call function to calculate and print dialable leads + dialable_leads($DB,$link,$local_call_time,$dial_statuses,$camp_lists,$fSQL); + + echo "

\n"; + echo "\n"; + + exit; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=7111111 view sample script with test variables +###################### + +if ($ADD==7111111) +{ + ##### TEST VARIABLES ##### + $vendor_lead_code = 'VENDOR:LEAD;CODE'; + $list_id = 'LISTID'; + $gmt_offset_now = 'GMTOFFSET'; + $phone_code = '1'; + $phone_number = '7275551212'; + $title = 'Mr.'; + $first_name = 'JOHN'; + $middle_initial = 'Q'; + $last_name = 'PUBLIC'; + $address1 = '1234 Main St.'; + $address2 = 'Apt. 3'; + $address3 = 'ADDRESS3'; + $city = 'CHICAGO'; + $state = 'IL'; + $province = 'PROVINCE'; + $postal_code = '33760'; + $country_code = 'USA'; + $gender = 'M'; + $date_of_birth = '1970-01-01'; + $alt_phone = '3125551212'; + $email = 'test@test.com'; + $security_phrase = 'SECUTIRY'; + $comments = 'COMMENTS FIELD'; + $RGfullname = 'JOE AGENT'; + $RGuser = '6666'; + $RGlead_id = '1234'; + $RGcampaign = 'TESTCAMP'; + $RGphone_login = 'gs102'; + $RGgroup = 'TESTCAMP'; + $RGchannel_group = 'TESTCAMP'; + $RGSQLdate = date("Y-m-d H:i:s"); + $RGepoch = date("U"); + $RGuniqueid = '1163095830.4136'; + $RGcustomer_zap_channel = 'Zap/1-1'; + $RGserver_ip = '10.10.10.15'; + $RGSIPexten = 'SIP/gs102'; + $RGsession_id = '8600051'; + +echo "\n"; +echo "\n"; +echo "\n"; +echo ""; + +$stmt="SELECT * from vicidial_scripts where script_id='$script_id';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$script_name = $row[1]; +$script_text = $row[3]; + +if (eregi("iframe src",$script_text)) + { + $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(' ','+',$address2); + $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); + $RGfullname = eregi_replace(' ','+',$RGfullname); + $RGuser = eregi_replace(' ','+',$RGuser); + $RGlead_id = eregi_replace(' ','+',$RGlead_id); + $RGcampaign = eregi_replace(' ','+',$RGcampaign); + $RGphone_login = eregi_replace(' ','+',$RGphone_login); + $RGgroup = eregi_replace(' ','+',$RGgroup); + $RGchannel_group = eregi_replace(' ','+',$RGchannel_group); + $RGSQLdate = eregi_replace(' ','+',$RGSQLdate); + $RGepoch = eregi_replace(' ','+',$RGepoch); + $RGuniqueid = eregi_replace(' ','+',$RGuniqueid); + $RGcustomer_zap_channel = eregi_replace(' ','+',$RGcustomer_zap_channel); + $RGserver_ip = eregi_replace(' ','+',$RGserver_ip); + $RGSIPexten = eregi_replace(' ','+',$RGSIPexten); + $RGsession_id = eregi_replace(' ','+',$RGsession_id); + } + +$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--fullname--B--',"$RGfullname",$script_text); +$script_text = eregi_replace('--A--fronter--B--',"$RGuser",$script_text); +$script_text = eregi_replace('--A--user--B--',"$RGuser",$script_text); +$script_text = eregi_replace('--A--lead_id--B--',"$RGlead_id",$script_text); +$script_text = eregi_replace('--A--campaign--B--',"$RGcampaign",$script_text); +$script_text = eregi_replace('--A--phone_login--B--',"$RGphone_login",$script_text); +$script_text = eregi_replace('--A--group--B--',"$RGgroup",$script_text); +$script_text = eregi_replace('--A--channel_group--B--',"$RGchannel_group",$script_text); +$script_text = eregi_replace('--A--SQLdate--B--',"$RGSQLdate",$script_text); +$script_text = eregi_replace('--A--epoch--B--',"$RGepoch",$script_text); +$script_text = eregi_replace('--A--uniqueid--B--',"$RGuniqueid",$script_text); +$script_text = eregi_replace('--A--customer_zap_channel--B--',"$RGcustomer_zap_channel",$script_text); +$script_text = eregi_replace('--A--server_ip--B--',"$RGserver_ip",$script_text); +$script_text = eregi_replace('--A--SIPexten--B--',"$RGSIPexten",$script_text); +$script_text = eregi_replace('--A--session_id--B--',"$RGsession_id",$script_text); +$script_text = eregi_replace("\n","
",$script_text); + + +echo ""; + +echo "Preview Script: $script_id
\n"; +echo "
\n"; +echo "
$script_name
\n"; +echo "$script_text\n"; +echo "
\n"; + +echo "\n"; + +exit; +} + + + + +######################### HTML HEADER BEGIN ####################################### +if ($hh=='users') + {$users_hh="bgcolor =\"$users_color\""; $users_fc="$users_font"; $users_bold="$header_selected_bold";} + else {$users_hh=''; $users_fc='WHITE'; $users_bold="$header_nonselected_bold";} +if ($hh=='campaigns') + {$campaigns_hh="bgcolor=\"$campaigns_color\""; $campaigns_fc="$campaigns_font"; $campaigns_bold="$header_selected_bold";} + else {$campaigns_hh=''; $campaigns_fc='WHITE'; $campaigns_bold="$header_nonselected_bold";} +if ($hh=='lists') + {$lists_hh="bgcolor=\"$lists_color\""; $lists_fc="$lists_font"; $lists_bold="$header_selected_bold";} + else {$lists_hh=''; $lists_fc='WHITE'; $lists_bold="$header_nonselected_bold";} +if ($hh=='ingroups') + {$ingroups_hh="bgcolor=\"$ingroups_color\""; $ingroups_fc="$ingroups_font"; $ingroups_bold="$header_selected_bold";} + else {$ingroups_hh=''; $ingroups_fc='WHITE'; $ingroups_bold="$header_nonselected_bold";} +if ($hh=='remoteagent') + {$remoteagent_hh="bgcolor=\"$remoteagent_color\""; $remoteagent_fc="$remoteagent_font"; $remoteagent_bold="$header_selected_bold";} + else {$remoteagent_hh=''; $remoteagent_fc='WHITE'; $remoteagent_bold="$header_nonselected_bold";} +if ($hh=='usergroups') + {$usergroups_hh="bgcolor=\"$usergroups_color\""; $usergroups_fc="$usergroups_font"; $usergroups_bold="$header_selected_bold";} + else {$usergroups_hh=''; $usergroups_fc='WHITE'; $usergroups_bold="$header_nonselected_bold";} +if ($hh=='scripts') + {$scripts_hh="bgcolor=\"$scripts_color\""; $scripts_fc="$scripts_font"; $scripts_bold="$header_selected_bold";} + else {$scripts_hh=''; $scripts_fc='WHITE'; $scripts_bold="$header_nonselected_bold";} +if ($hh=='filters') + {$filters_hh="bgcolor=\"$filters_color\""; $filters_fc="$filters_font"; $filters_bold="$header_selected_bold";} + else {$filters_hh=''; $filters_fc='WHITE'; $filters_bold="$header_nonselected_bold";} +if ($hh=='admin') + {$admin_hh="bgcolor=\"$admin_color\""; $admin_fc="$admin_font"; $admin_bold="$header_selected_bold";} + else {$admin_hh=''; $admin_fc='WHITE'; $admin_bold="$header_nonselected_bold";} +if ($hh=='reports') + {$reports_hh="bgcolor=\"$reports_color\""; $reports_fc="$reports_font"; $reports_bold="$header_selected_bold";} + else {$reports_hh=''; $reports_fc='WHITE'; $reports_bold="$header_nonselected_bold";} + +echo "\n"; +echo " + + +\n"; + +$stmt="SELECT admin_home_url from system_settings;"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$admin_home_url_LU = $row[0]; + +?> +
+ BGCOLOR=#D9E6FE cellpadding=2 cellspacing=0> + + + + + + + + + + + + + + + 1) { + ?> +> + 1) + { + +# if ($sh=='basic') {$basic_sh="bgcolor=\"$subcamp_color\""; $basic_fc="$subcamp_font";} +# else {$basic_sh=''; $basic_fc='BLACK';} +# if ($sh=='detail') {$detail_sh="bgcolor=\"$subcamp_color\""; $detail_fc="$subcamp_font";} +# else {$detail_sh=''; $detail_fc='BLACK';} +# if ($sh=='dialstat') {$dialstat_sh="bgcolor=\"$subcamp_color\""; $dialstat_fc="$subcamp_font";} +# else {$dialstat_sh=''; $dialstat_fc='BLACK';} + + if ($sh=='basic') {$sh='list';} + if ($sh=='detail') {$sh='list';} + if ($sh=='dialstat') {$sh='list';} + + if ($sh=='list') {$list_sh="bgcolor=\"$subcamp_color\""; $list_fc="$subcamp_font";} + else {$list_sh=''; $list_fc='BLACK';} + if ($sh=='status') {$status_sh="bgcolor=\"$subcamp_color\""; $status_fc="$subcamp_font";} + else {$status_sh=''; $status_fc='BLACK';} + if ($sh=='hotkey') {$hotkey_sh="bgcolor=\"$subcamp_color\""; $hotkey_fc="$subcamp_font";} + else {$hotkey_sh=''; $hotkey_fc='BLACK';} + if ($sh=='recycle') {$recycle_sh="bgcolor=\"$subcamp_color\""; $recycle_fc="$subcamp_font";} + else {$recycle_sh=''; $recycle_fc='BLACK';} + if ($sh=='autoalt') {$autoalt_sh="bgcolor=\"$subcamp_color\""; $autoalt_fc="$subcamp_font";} + else {$autoalt_sh=''; $autoalt_fc='BLACK';} + if ($sh=='pause') {$pause_sh="bgcolor=\"$subcamp_color\""; $pause_fc="$subcamp_font";} + else {$pause_sh=''; $pause_fc='BLACK';} + if ($sh=='listmix') {$listmix_sh="bgcolor=\"$subcamp_color\""; $listmix_fc="$subcamp_font";} + else {$listmix_sh=''; $listmix_fc='BLACK';} + + ?> +> + + + + + + + + + 1) { + ?> + > + 1) { + ?> +> + 1) { + ?> +> + 1) { + ?> +> + 1) { + ?> +> + 1) { + ?> +> + 1) { + ?> +> + 1) { + if ($sh=='times') {$times_sh="bgcolor=\"$times_color\""; $times_fc="$times_font";} # hard teal + else {$times_sh=''; $times_fc='BLACK';} + if ($sh=='phones') {$phones_sh="bgcolor=\"$server_color\""; $phones_fc="$phones_font";} # pink + else {$phones_sh=''; $phones_fc='BLACK';} + if ($sh=='server') {$server_sh="bgcolor=\"$server_color\""; $server_fc="$server_font";} # pink + else {$server_sh=''; $server_fc='BLACK';} + if ($sh=='conference') {$conference_sh="bgcolor=\"$server_color\""; $conference_fc="$server_font";} # pink + else {$conference_sh=''; $conference_fc='BLACK';} + if ($sh=='settings') {$settings_sh="bgcolor=\"$settings_color\""; $settings_fc="$settings_font";} # pink + else {$settings_sh=''; $settings_fc='BLACK';} + if ($sh=='status') {$status_sh="bgcolor=\"$status_color\""; $status_fc="$status_font";} # pink + else {$status_sh=''; $status_fc='BLACK';} + + ?> +> + + + + + + + + 1) { + ?> + > + 1) { + ?> + > + 1) { + ?> + > + 1) { + ?> + > + 1) { + ?> + > + 1) { + ?> + > + \n"; + echo "You are not authorized to view this page. Please go back.\n"; + } + +} +if (strlen($reports_hh) > 1) { + ?> +> + + + + +
  VICIDIAL ADMIN - HOME | Logout  
> SIZE=> Users > SIZE=> Campaigns > SIZE=> Lists > SIZE=> Scripts > SIZE=> Filters > SIZE=> In-Groups > SIZE=> User Groups > SIZE=> Remote Agents > SIZE=> Admin > SIZE=> Reports
>   > Show Users     |     > Add A New User     |     > Copy User     |     > Search For A User
COLSPAN=2> SIZE=> Campaigns Main COLSPAN=1> SIZE=> Statuses COLSPAN=1> SIZE=> HotKeys COLSPAN=2> SIZE=> Lead Recycle COLSPAN=1> SIZE=> Auto-Alt Dial COLSPAN=1> SIZE=> Pause Codes COLSPAN=2> SIZE=> List Mix
>   > Show Campaigns     |     > Add A New Campaign     |     > Copy Campaign     |     > Real-Time Campaigns Summary
>   > Show Lists     |     > Add A New List     |     > Search For A Lead     |     > Add Number To DNC     |     > Load New Leads
>   > Show Scripts     |     > Add A New Script
>   > Show Filters     |     > Add A New Filter
>   > Show In-Groups     |     > Add A New In-Group     |     > Copy In-Group
>   > Show User Groups     |     > Add A New User Group     |     > Group Hourly Report
>   > Show Remote Agents     |     > Add New Remote Agents
COLSPAN=2> SIZE=> Call Times COLSPAN=2> SIZE=> Phones COLSPAN=2> SIZE=> Conferences COLSPAN=1> SIZE=> Servers COLSPAN=1> SIZE=> System Settings COLSPAN=2> SIZE=> System Statuses
>   > Show Call Times     |     > Add A New Call Time     |     > Show State Call Times     |     > Add A New State Call Time  
>   > Show Phones   |   > Add A New Phone
> Show Conferences   |   > Add A New Conference   |   > Show VICIDIAL Conferences   |   > Add A New VICIDIAL Conference
> Show Servers   |   > Add A New Server
> System Settings
> System Statuses   |   > Status Categories
>  
+
\n"; + echo ""; + + echo "
ADD A NEW USER
\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "$NWB#vicidial_users-user_group$NWE\n"; + echo "\n"; + echo "
User Number: $NWB#vicidial_users-user$NWE
Password: $NWB#vicidial_users-pass$NWE
Full Name: $NWB#vicidial_users-full_name$NWE
User Level: $NWB#vicidial_users-user_level$NWE
User Group:
Phone Login: $NWB#vicidial_users-phone_login$NWE
Phone Pass: $NWB#vicidial_users-phone_pass$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=1 display the COPY USER FORM SCREEN +###################### + +if ($ADD=="1A") +{ + if ($LOGmodify_users==1) + { + echo "
\n"; + echo ""; + + echo "
COPY USER\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + if ($LOGuser_level==9) {$levelMAX=10;} + else {$levelMAX=$LOGuser_level;} + + echo "\n"; + echo "\n"; + echo "
User Number: $NWB#vicidial_users-user$NWE
Password: $NWB#vicidial_users-pass$NWE
Full Name: $NWB#vicidial_users-full_name$NWE
Source User: $NWB#vicidial_users-user$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=11 display the ADD NEW CAMPAIGN FORM SCREEN +###################### + +if ($ADD==11) +{ + if ($LOGmodify_campaigns==1) + { + echo "
\n"; + echo ""; + + echo "
ADD A NEW CAMPAIGN\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Campaign ID: $NWB#vicidial_campaigns-campaign_id$NWE
Campaign Name: $NWB#vicidial_campaigns-campaign_name$NWE
Campaign Description: $NWB#vicidial_campaigns-campaign_description$NWE
Active: $NWB#vicidial_campaigns-active$NWE
Park Extension: $NWB#vicidial_campaigns-park_ext$NWE
Park Filename: $NWB#vicidial_campaigns-park_file_name$NWE
Web Form: $NWB#vicidial_campaigns-web_form_address$NWE
Allow Closers: $NWB#vicidial_campaigns-allow_closers$NWE
Hopper Level: $NWB#vicidial_campaigns-hopper_level$NWE
Auto Dial Level: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE
Next Agent Call: $NWB#vicidial_campaigns-next_agent_call$NWE
Local Call Time: $NWB#vicidial_campaigns-local_call_time$NWE
Voicemail: $NWB#vicidial_campaigns-voicemail_ext$NWE
Script: $NWB#vicidial_campaigns-campaign_script$NWE
Get Call Launch: $NWB#vicidial_campaigns-get_call_launch$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=12 display the COPY CAMPAIGN FORM SCREEN +###################### + +if ($ADD==12) +{ + if ($LOGmodify_campaigns==1) + { + echo "
\n"; + echo ""; + + echo "
COPY A CAMPAIGN\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + + echo "\n"; + echo "
Campaign ID: $NWB#vicidial_campaigns-campaign_id$NWE
Campaign Name: $NWB#vicidial_campaigns-campaign_name$NWE
Source Campaign: $NWB#vicidial_campaigns-campaign_id$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=111 display the ADD NEW LIST FORM SCREEN +###################### + +if ($ADD==111) +{ + if ($LOGmodify_lists==1) + { + echo "
\n"; + echo ""; + + echo "
ADD A NEW LIST\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
List ID: (digits only)$NWB#vicidial_lists-list_id$NWE
List Name: $NWB#vicidial_lists-list_name$NWE
List Description: $NWB#vicidial_lists-list_description$NWE
Campaign: $NWB#vicidial_lists-campaign_id$NWE
Active: $NWB#vicidial_lists-active$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=121 display the ADD NUMBER TO DNC FORM SCREEN and add a new number +###################### + +if ($ADD==121) +{ +echo "
\n"; +echo ""; + +if (strlen($phone_number) > 2) + { + $stmt="SELECT count(*) from vicidial_dnc where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
DNC NOT ADDED - This phone number is already in the Do Not Call List: $phone_number

\n";} + else + { + $stmt="INSERT INTO vicidial_dnc (phone_number) values('$phone_number');"; + $rslt=mysql_query($stmt, $link); + + echo "
DNC ADDED: $phone_number

\n"; + + ### LOG INSERTION TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW DNC NUMBER|$PHP_AUTH_USER|$ip|'$phone_number'|\n"); + fclose($fp); + } + } + } + +echo "
ADD A NUMBER TO THE DNC LIST\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "
Phone Number: (digits only)$NWB#vicidial_list-dnc$NWE
\n"; + +} + + +###################### +# ADD=1111 display the ADD NEW INBOUND GROUP SCREEN +###################### + +if ($ADD==1111) +{ + if ($LOGmodify_ingroups==1) + { + echo "
\n"; + echo ""; + + echo "
ADD A NEW INBOUND GROUP\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Group ID: (no spaces)$NWB#vicidial_inbound_groups-group_id$NWE
Group Name: $NWB#vicidial_inbound_groups-group_name$NWE
Group Color: $NWB#vicidial_inbound_groups-group_color$NWE
Active: $NWB#vicidial_inbound_groups-active$NWE
Web Form: $NWB#vicidial_inbound_groups-web_form_address$NWE
Voicemail: $NWB#vicidial_inbound_groups-voicemail_ext$NWE
Next Agent Call: $NWB#vicidial_inbound_groups-next_agent_call$NWE
Fronter Display: $NWB#vicidial_inbound_groups-fronter_display$NWE
Script: $NWB#vicidial_inbound_groups-ingroup_script$NWE
Get Call Launch: $NWB#vicidial_inbound_groups-get_call_launch$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=1211 display the COPY INBOUND GROUP SCREEN +###################### + +if ($ADD==1211) +{ + if ($LOGmodify_ingroups==1) + { + echo "
\n"; + echo ""; + + echo "
COPY INBOUND GROUP\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + + echo "\n"; + echo "
Group ID: (no spaces)$NWB#vicidial_inbound_groups-group_id$NWE
Group Name: $NWB#vicidial_inbound_groups-group_name$NWE
Source Group ID: $NWB#vicidial_inbound_groups-group_id$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=11111 display the ADD NEW REMOTE AGENTS SCREEN +###################### + +if ($ADD==11111) +{ + if ($LOGmodify_remoteagents==1) + { + echo "
\n"; + echo ""; + + echo "
ADD NEW REMOTE AGENTS\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
User ID Start: (numbers only, incremented)$NWB#vicidial_remote_agents-user_start$NWE
Number of Lines: (numbers only)$NWB#vicidial_remote_agents-number_of_lines$NWE
Server IP: $NWB#vicidial_remote_agents-server_ip$NWE
External Extension: (dial plan number dialed to reach agents)$NWB#vicidial_remote_agents-conf_exten$NWE
Status: $NWB#vicidial_remote_agents-status$NWE
Campaign: $NWB#vicidial_remote_agents-campaign_id$NWE
Inbound Groups: \n"; + echo "$groups_list"; + echo "$NWB#vicidial_remote_agents-closer_campaigns$NWE
\n"; + echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=111111 display the ADD NEW USERS GROUP SCREEN +###################### + +if ($ADD==111111) +{ + if ($LOGmodify_usergroups==1) + { + echo "
\n"; + echo ""; + + echo "
ADD NEW USERS GROUP\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Group: (no spaces or punctuation)$NWB#vicidial_user_groups-user_group$NWE
Description: (description of group)$NWB#vicidial_user_groups-group_name$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=1111111 display the ADD NEW SCRIPT SCREEN +###################### + +if ($ADD==1111111) +{ + if ($LOGmodify_scripts==1) + { + echo "
\n"; + echo ""; + + echo "
ADD NEW SCRIPT\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Script ID: (no spaces or punctuation)$NWB#vicidial_scripts-script_id$NWE
Script Name: (title of the script)$NWB#vicidial_scripts-script_name$NWE
Script Comments: $NWB#vicidial_scripts-script_comments$NWE
Active: $NWB#vicidial_scripts-active$NWE
Script Text: "; + # BEGIN Insert Field + echo ""; + echo "
"; + # END Insert Field + echo " $NWB#vicidial_scripts-script_text$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=11111111 display the ADD NEW FILTER SCREEN +###################### + +if ($ADD==11111111) +{ + if ($LOGmodify_filters==1) + { + echo "
\n"; + echo ""; + + echo "
ADD NEW FILTER\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Filter ID: (no spaces or punctuation)$NWB#vicidial_lead_filters-lead_filter_id$NWE
Filter Name: (short description of the filter)$NWB#vicidial_lead_filters-lead_filter_name$NWE
Filter Comments: $NWB#vicidial_lead_filters-lead_filter_comments$NWE
Filter SQL: $NWB#vicidial_lead_filters-lead_filter_sql$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=111111111 display the ADD NEW CALL TIME SCREEN +###################### + +if ($ADD==111111111) +{ + if ($LOGmodify_call_times==1) + { + echo "
\n"; + echo ""; + + echo "
ADD NEW CALL TIME\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "
Call Time ID: (no spaces or punctuation)$NWB#vicidial_call_times-call_time_id$NWE
Call Time Name: (short description of the call time)$NWB#vicidial_call_times-call_time_name$NWE
Call Time Comments: $NWB#vicidial_call_times-call_time_comments$NWE
Day and time options will appear once you have created the Call Time Definition
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=1111111111 display the ADD NEW STATE CALL TIME SCREEN +###################### + +if ($ADD==1111111111) +{ + if ($LOGmodify_call_times==1) + { + echo "
\n"; + echo ""; + + echo "
ADD NEW STATE CALL TIME\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "
State Call Time ID: (no spaces or punctuation)$NWB#vicidial_call_times-call_time_id$NWE
State Call Time State: (no spaces or punctuation)$NWB#vicidial_call_times-state_call_time_state$NWE
State Call Time Name: (short description of the call time)$NWB#vicidial_call_times-call_time_name$NWE
State Call Time Comments: $NWB#vicidial_call_times-call_time_comments$NWE
Day and time options will appear once you have created the Call Time Definition
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=11111111111 display the ADD NEW PHONE SCREEN +###################### + +if ($ADD==11111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + echo "
ADD A NEW PHONE\n"; + echo "\n"; + echo "
\n"; + + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Phone extension: $NWB#phones-extension$NWE
Dial Plan Number: (digits only)$NWB#phones-dialplan_number$NWE
Voicemail Box: (digits only)$NWB#phones-voicemail_id$NWE
Outbound CallerID: (digits only)$NWB#phones-outbound_cid$NWE
Phone IP address: (optional)$NWB#phones-phone_ip$NWE
Computer IP address: (optional)$NWB#phones-computer_ip$NWE
Server IP: $NWB#phones-server_ip$NWE
Login: $NWB#phones-login$NWE
Password: $NWB#phones-pass$NWE
Status: $NWB#phones-status$NWE
Active Account: $NWB#phones-active$NWE
Phone Type: $NWB#phones-phone_type$NWE
Full Name: $NWB#phones-fullname$NWE
Company: $NWB#phones-company$NWE
Picture: $NWB#phones-picture$NWE
Client Protocol: $NWB#phones-protocol$NWE
Local GMT: (Do NOT Adjust for DST)$NWB#phones-local_gmt$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=111111111111 display the ADD NEW SERVER SCREEN +###################### + +if ($ADD==111111111111) +{ + if ($LOGmodify_servers==1) + { + echo "
\n"; + echo ""; + + echo "
ADD A NEW SERVER\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Server ID: $NWB#servers-server_id$NWE
Server Description: $NWB#servers-server_description$NWE
Server IP Address: $NWB#servers-server_ip$NWE
Active: $NWB#servers-active$NWE
Asterisk Version: $NWB#servers-asterisk_version$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=1111111111111 display the ADD NEW CONFERENCE SCREEN +###################### + +if ($ADD==1111111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + echo "
ADD A NEW CONFERENCE\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Conference Number: (digits only)$NWB#conferences-conf_exten$NWE
Server IP: $NWB#conferences-server_ip$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=11111111111111 display the ADD NEW VICIDIAL CONFERENCE SCREEN +###################### + +if ($ADD==11111111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + echo "
ADD A NEW VICIDIAL CONFERENCE\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Conference Number: (digits only)$NWB#conferences-conf_exten$NWE
Server IP: $NWB#conferences-server_ip$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + + +###################################################################################################### +###################################################################################################### +####### 2 series, validates form data and inserts the new record into the database +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=2 adds the new user to the system +###################### + +if ($ADD=="2") +{ + echo ""; + $stmt="SELECT count(*) from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
USER NOT ADDED - there is already a user in the system with this user number\n";} + else + { + if ( (strlen($user) < 2) or (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user) > 8) ) + { + echo "
USER NOT ADDED - Please go back and look at the data you entered\n"; + echo "
user id must be between 2 and 8 characters long\n"; + echo "
full name and password must be at least 2 characters long\n"; + } + else + { + echo "
USER ADDED: $user\n"; + + $stmt="INSERT INTO vicidial_users (user,pass,full_name,user_level,user_group,phone_login,phone_pass) values('$user','$pass','$full_name','$user_level','$user_group','$phone_login','$phone_pass');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A USER |$PHP_AUTH_USER|$ip|'$user','$pass','$full_name','$user_level','$user_group','$phone_login','$phone_pass'|\n"); + fclose($fp); + } + } + } + +$ADD=3; +} + +###################### +# ADD=2A adds the copied new user to the system +###################### + +if ($ADD=="2A") +{ + echo ""; + $stmt="SELECT count(*) from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
USER NOT ADDED - there is already a user in the system with this user number\n";} + else + { + if ( (strlen($user) < 2) or (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user) > 8) ) + { + echo "
USER NOT ADDED - Please go back and look at the data you entered\n"; + echo "
user id must be between 2 and 8 characters long\n"; + echo "
full name and password must be at least 2 characters long\n"; + } + else + { + $stmt="INSERT INTO vicidial_users (user,pass,full_name,user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override) SELECT \"$user\",\"$pass\",\"$full_name\",user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override from vicidial_users where user=\"$source_user_id\";"; + $rslt=mysql_query($stmt, $link); + + $stmtA="INSERT INTO vicidial_inbound_group_agents (user,group_id,group_rank,group_weight,calls_today) SELECT \"$user\",group_id,group_rank,group_weight,\"0\" from vicidial_inbound_group_agents where user=\"$source_user_id\";"; + $rslt=mysql_query($stmtA, $link); + + $stmtA="INSERT INTO vicidial_campaign_agents (user,campaign_id,campaign_rank,campaign_weight,calls_today) SELECT \"$user\",campaign_id,campaign_rank,campaign_weight,\"0\" from vicidial_campaign_agents where user=\"$source_user_id\";"; + $rslt=mysql_query($stmtA, $link); + + echo "
USER COPIED: $user copied from $source_user_id\n"; + echo "

\n"; + echo "Click here to go to the user record\n"; + echo "

\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A COPIED USER |$PHP_AUTH_USER|$ip|$user|$source_user_id|$stmt|\n"); + fclose($fp); + } + } + } +exit; +} + +###################### +# ADD=21 adds the new campaign to the system +###################### + +if ($ADD==21) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN NOT ADDED - there is already a campaign in the system with this ID\n";} + else + { + $stmt="SELECT count(*) from vicidial_inbound_groups where group_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN NOT ADDED - there is already an inbound group in the system with this ID\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($campaign_id) > 8) or (strlen($campaign_name) < 6) or (strlen($campaign_name) > 40) ) + { + echo "
CAMPAIGN NOT ADDED - Please go back and look at the data you entered\n"; + echo "
campaign ID must be between 2 and 8 characters in length\n"; + echo "
campaign name must be between 6 and 40 characters in length\n"; + } + else + { + echo "
CAMPAIGN ADDED: $campaign_id\n"; + + $stmt="INSERT INTO vicidial_campaigns (campaign_id,campaign_name,campaign_description,active,dial_status_a,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,campaign_script,get_call_launch,campaign_changedate,campaign_stats_refresh,list_order_mix) values('$campaign_id','$campaign_name','$campaign_description','$active','NEW','DOWN','$park_ext','$park_file_name','" . mysql_real_escape_string($web_form_address) . "','$allow_closers','$hopper_level','$auto_dial_level','$next_agent_call','$local_call_time','$voicemail_ext','$script_id','$get_call_launch','$SQLdate','Y','DISABLED');"; + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_campaign_stats (campaign_id) values('$campaign_id');"; + $rslt=mysql_query($stmt, $link); + + echo ""; + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW CAMPAIGN |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + } + } + } +$ADD=31; +} + +###################### +# ADD=20 adds copied new campaign to the system +###################### + +if ($ADD==20) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN NOT ADDED - there is already a campaign in the system with this ID\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($campaign_id) > 8) or (strlen($campaign_name) < 2) or (strlen($source_campaign_id) < 2) or (strlen($source_campaign_id) > 8) ) + { + echo "
CAMPAIGN NOT ADDED - Please go back and look at the data you entered\n"; + echo "
campaign ID must be between 2 and 8 characters in length\n"; + echo "
source campaign ID must be between 2 and 8 characters in length\n"; + } + else + { + echo "
CAMPAIGN COPIED: $campaign_id copied from $source_campaign_id\n"; + + $stmt="INSERT INTO vicidial_campaigns (campaign_name,campaign_id,active,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,safe_harbor_message,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,list_order_mix,campaign_allow_inbound,manual_dial_list_id,default_xfer_group) SELECT \"$campaign_name\",\"$campaign_id\",\"N\",dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,safe_harbor_message,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,\"DISABLED\",campaign_allow_inbound,manual_dial_list_id,default_xfer_group from vicidial_campaigns where campaign_id='$source_campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmtA="INSERT INTO vicidial_campaign_stats (campaign_id) values('$campaign_id');"; + $rslt=mysql_query($stmtA, $link); + + $stmtA="INSERT INTO vicidial_campaign_statuses (status,status_name,selectable,campaign_id,human_answered,category) SELECT status,status_name,selectable,\"$campaign_id\",human_answered,category from vicidial_campaign_statuses where campaign_id='$source_campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + $stmtA="INSERT INTO vicidial_campaign_hotkeys (status,hotkey,status_name,selectable,campaign_id) SELECT status,hotkey,status_name,selectable,\"$campaign_id\" from vicidial_campaign_hotkeys where campaign_id='$source_campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + $stmtA="INSERT INTO vicidial_lead_recycle (status,attempt_delay,attempt_maximum,active,campaign_id) SELECT status,attempt_delay,attempt_maximum,active,\"$campaign_id\" from vicidial_lead_recycle where campaign_id='$source_campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + $stmtA="INSERT INTO vicidial_pause_codes (pause_code,pause_code_name,billable,campaign_id) SELECT pause_code,pause_code_name,billable,\"$campaign_id\" from vicidial_pause_codes where campaign_id='$source_campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + echo ""; + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|COPY TO NEW CAMPAIGN|$PHP_AUTH_USER|$ip|$campaign_id|$source_campaign_id|$stmt|$stmtA|\n"); + fclose($fp); + } + + } + } +$ADD=31; +} + +###################### +# ADD=22 adds the new campaign status to the system +###################### + +if ($ADD==22) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN STATUS NOT ADDED - there is already a campaign-status in the system with this name\n";} + else + { + $stmt="SELECT count(*) from vicidial_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN STATUS NOT ADDED - there is already a global-status in the system with this name\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($status_name) < 2) ) + { + echo "
CAMPAIGN STATUS NOT ADDED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 8 characters in length\n"; + echo "
status name must be between 2 and 30 characters in length\n"; + } + else + { + echo "
CAMPAIGN STATUS ADDED: $campaign_id - $status\n"; + + $stmt="INSERT INTO vicidial_campaign_statuses (status,status_name,selectable,campaign_id,human_answered,category) values('$status','$status_name','$selectable','$campaign_id','$human_answered','$category');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW CAMPAIGN STATUS |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } +$SUB=22; +$ADD=31; +} + + +###################### +# ADD=23 adds the new campaign hotkey to the system +###################### + +if ($ADD==23) +{ + $HKstatus_data = explode('-----',$HKstatus); + $status = $HKstatus_data[0]; + $status_name = $HKstatus_data[1]; + + echo ""; + $stmt="SELECT count(*) from vicidial_campaign_hotkeys where campaign_id='$campaign_id' and hotkey='$hotkey' and hotkey='$hotkey';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN HOT KEY NOT ADDED - there is already a campaign-hotkey in the system with this hotkey\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($hotkey) < 1) ) + { + echo "
CAMPAIGN HOT KEY NOT ADDED - Please go back and look at the data you entered\n"; + echo "
hotkey must be a single character between 1 and 9 \n"; + echo "
status must be between 1 and 8 characters in length\n"; + } + else + { + echo "
CAMPAIGN HOT KEY ADDED: $campaign_id - $status - $hotkey\n"; + + $stmt="INSERT INTO vicidial_campaign_hotkeys values('$status','$hotkey','$status_name','$selectable','$campaign_id');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW CAMPAIGN HOT KEY |$PHP_AUTH_USER|$ip|'$status','$hotkey','$status_name','$selectable','$campaign_id'|\n"); + fclose($fp); + } + } + } +$SUB=23; +$ADD=31; +} + + +###################### +# ADD=25 adds the new campaign lead recycle entry to the system +###################### + +if ($ADD==25) +{ + $status = eregi_replace("-----.*",'',$status); + echo ""; + $stmt="SELECT count(*) from vicidial_lead_recycle where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN LEAD RECYCLE NOT ADDED - there is already a lead-recycle for this campaign with this status\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or ($attempt_delay < 120) or ($attempt_maximum < 1) or ($attempt_maximum > 10) ) + { + echo "
CAMPAIGN LEAD RECYCLE NOT ADDED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 6 characters in length\n"; + echo "
attempt delay must be at least 120 seconds\n"; + echo "
maximum attempts must be from 1 to 10\n"; + } + else + { + echo "
CAMPAIGN LEAD RECYCLE ADDED: $campaign_id - $status - $attempt_delay\n"; + + $stmt="INSERT INTO vicidial_lead_recycle(campaign_id,status,attempt_delay,attempt_maximum,active) values('$campaign_id','$status','$attempt_delay','$attempt_maximum','$active');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW LEAD RECYCLE |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$SUB=25; +$ADD=31; +} + + +###################### +# ADD=26 adds the new auto alt dial status to the campaign +###################### + +if ($ADD==26) +{ + $status = eregi_replace("-----.*",'',$status); + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and auto_alt_dial_statuses LIKE \"% $status %\";"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
AUTO ALT DIAL STATUS NOT ADDED - there is already an entry for this campaign with this status\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
AUTO ALT DIAL STATUS NOT ADDED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 6 characters in length\n"; + } + else + { + echo "
AUTO ALT DIAL STATUS ADDED: $campaign_id - $status\n"; + + $stmt="SELECT auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if (strlen($row[0])<2) {$row[0] = ' -';} + $auto_alt_dial_statuses = " $status$row[0]"; + $stmt="UPDATE vicidial_campaigns set auto_alt_dial_statuses='$auto_alt_dial_statuses' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A AUTO-ALT-DIAL STATUS|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$SUB=26; +$ADD=31; +} + + +###################### +# ADD=27 adds the new campaign agent pause code entry to the system +###################### + +if ($ADD==27) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_pause_codes where campaign_id='$campaign_id' and pause_code='$pause_code';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
AGENT PAUSE CODE NOT ADDED - there is already an entry for this campaign with this pause code\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($pause_code) < 1) or (strlen($pause_code) > 6) or (strlen($pause_code_name) < 2) ) + { + echo "
AGENT PAUSE CODE NOT ADDED - Please go back and look at the data you entered\n"; + echo "
pause code must be between 1 and 6 characters in length\n"; + echo "
pause code name must be between 2 and 30 characters in length\n"; + } + else + { + echo "
AGENT PAUSE CODE ADDED: $campaign_id - $pause_code - $pause_code_name\n"; + + $stmt="INSERT INTO vicidial_pause_codes(campaign_id,pause_code,pause_code_name,billable) values('$campaign_id','$pause_code','$pause_code_name','$billable');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW AGENT PAUSE CODE|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$SUB=27; +$ADD=31; +} + + +###################### +# ADD=28 adds new status to the campaign dial statuses +###################### + +if ($ADD==28) +{ + $status = eregi_replace("-----.*",'',$status); + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and dial_statuses LIKE \"% $status %\";"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN DIAL STATUS NOT ADDED - there is already an entry for this campaign with this status\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
CAMPAIGN DIAL STATUS NOT ADDED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 6 characters in length\n"; + } + else + { + echo "
CAMPAIGN DIAL STATUS ADDED: $campaign_id - $status\n"; + + $stmt="SELECT dial_statuses from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if (strlen($row[0])<2) {$row[0] = ' -';} + $dial_statuses = " $status$row[0]"; + $stmt="UPDATE vicidial_campaigns set dial_statuses='$dial_statuses' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD CAMPAIGN DIAL STATUS |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +#$SUB=28; +$ADD=31; +} + + +###################### +# ADD=211 adds the new list to the system +###################### + +if ($ADD==211) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
LIST NOT ADDED - there is already a list in the system with this ID\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($list_name) < 2) or ($list_id < 100) or (strlen($list_id) > 8) ) + { + echo "
LIST NOT ADDED - Please go back and look at the data you entered\n"; + echo "
List ID must be between 2 and 8 characters in length\n"; + echo "
List name must be at least 2 characters in length\n"; + echo "
List ID must be greater than 100\n"; + } + else + { + echo "
LIST ADDED: $list_id\n"; + + $stmt="INSERT INTO vicidial_lists (list_id,list_name,campaign_id,active,list_description,list_changedate) values('$list_id','$list_name','$campaign_id','$active','$list_description','$SQLdate');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW LIST |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=311; +} + + + +###################### +# ADD=2111 adds the new inbound group to the system +###################### + +if ($ADD==2111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_inbound_groups where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
GROUP NOT ADDED - there is already a group in the system with this ID\n";} + else + { + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
GROUP NOT ADDED - there is already a campaign in the system with this ID\n";} + else + { + if ( (strlen($group_id) < 2) or (strlen($group_name) < 2) or (strlen($group_color) < 2) or (strlen($group_id) > 20) or (eregi(' ',$group_id)) or (eregi("\-",$group_id)) or (eregi("\+",$group_id)) ) + { + echo "
GROUP NOT ADDED - Please go back and look at the data you entered\n"; + echo "
Group ID must be between 2 and 20 characters in length and contain no ' -+'.\n"; + echo "
Group name and group color must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_inbound_groups (group_id,group_name,group_color,active,web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch) values('$group_id','$group_name','$group_color','$active','" . mysql_real_escape_string($web_form_address) . "','$voicemail_ext','$next_agent_call','$fronter_display','$script_id','$get_call_launch');"; + $rslt=mysql_query($stmt, $link); + + echo "
GROUP ADDED: $group_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW GROUP |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } +$ADD=3111; +} + + +###################### +# ADD=2011 adds copied inbound group to the system +###################### + +if ($ADD==2011) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_inbound_groups where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
GROUP NOT ADDED - there is already a group in the system with this ID\n";} + else + { + if ( (strlen($group_id) < 2) or (strlen($group_name) < 2) or (strlen($group_id) > 20) or (eregi(' ',$group_id)) or (eregi("\-",$group_id)) or (eregi("\+",$group_id)) ) + { + echo "
GROUP NOT ADDED - Please go back and look at the data you entered\n"; + echo "
Group ID must be between 2 and 20 characters in length and contain no ' -+'.\n"; + echo "
Group name and group color must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_inbound_groups (group_id,group_name,group_color,active,web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_message,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group) SELECT \"$group_id\",\"$group_name\",group_color,\"N\",web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_message,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group from vicidial_inbound_groups where group_id=\"$source_group_id\";"; + $rslt=mysql_query($stmt, $link); + + echo "
GROUP ADDED: $group_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|COPIED TO NEW GROUP |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=3111; +} + + +###################### +# ADD=21111 adds new remote agents to the system +###################### + +if ($ADD==21111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_remote_agents where server_ip='$server_ip' and user_start='$user_start';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
REMOTE AGENTS NOT ADDED - there is already a remote agents entry starting with this userID\n";} + else + { + if ( (strlen($server_ip) < 2) or (strlen($user_start) < 2) or (strlen($campaign_id) < 2) or (strlen($conf_exten) < 2) ) + { + echo "
REMOTE AGENTS NOT ADDED - Please go back and look at the data you entered\n"; + echo "
User ID start and external extension must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_remote_agents values('','$user_start','$number_of_lines','$server_ip','$conf_exten','$status','$campaign_id','$groups_value');"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOTE AGENTS ADDED: $user_start\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW REMOTE AGENTS ENTRY |$PHP_AUTH_USER|$ip|'$user_start','$number_of_lines','$server_ip','$conf_exten','$status','$campaign_id','$groups_value'|\n"); + fclose($fp); + } + } + } +$ADD=10000; +} + +###################### +# ADD=211111 adds new user group to the system +###################### + +if ($ADD==211111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_user_groups where user_group='$user_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
USER GROUP NOT ADDED - there is already a user group entry with this name\n";} + else + { + if ( (strlen($user_group) < 2) or (strlen($group_name) < 2) ) + { + echo "
USER GROUP NOT ADDED - Please go back and look at the data you entered\n"; + echo "
Group name and description must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_user_groups(user_group,group_name,allowed_campaigns) values('$user_group','$group_name','-ALL-CAMPAIGNS-');"; + $rslt=mysql_query($stmt, $link); + + echo "
USER GROUP ADDED: $user_group\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW USER GROUP ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=100000; +} + +###################### +# ADD=2111111 adds new script to the system +###################### + +if ($ADD==2111111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_scripts where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
SCRIPT NOT ADDED - there is already a script entry with this name\n";} + else + { + if ( (strlen($script_id) < 2) or (strlen($script_name) < 2) or (strlen($script_text) < 2) ) + { + echo "
SCRIPT NOT ADDED - Please go back and look at the data you entered\n"; + echo "
Script name, description and text must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_scripts values('$script_id','$script_name','$script_comments','$script_text','$active');"; + $rslt=mysql_query($stmt, $link); + + echo "
SCRIPT ADDED: $script_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW SCRIPT ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=1000000; +} + + +###################### +# ADD=21111111 adds new filter to the system +###################### + +if ($ADD==21111111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_lead_filters where lead_filter_id='$lead_filter_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
FILTER NOT ADDED - there is already a filter entry with this ID\n";} + else + { + if ( (strlen($lead_filter_id) < 2) or (strlen($lead_filter_name) < 2) or (strlen($lead_filter_sql) < 2) ) + { + echo "
FILTER NOT ADDED - Please go back and look at the data you entered\n"; + echo "
Filter ID, name and SQL must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_lead_filters SET lead_filter_id='$lead_filter_id',lead_filter_name='$lead_filter_name',lead_filter_comments='$lead_filter_comments',lead_filter_sql='$lead_filter_sql';"; + $rslt=mysql_query($stmt, $link); + + echo "
FILTER ADDED: $lead_filter_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW FILTER ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=10000000; +} + + +###################### +# ADD=211111111 adds new call time definition to the system +###################### + +if ($ADD==211111111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_call_times where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CALL TIME DEFINITION NOT ADDED - there is already a call time entry with this ID\n";} + else + { + if ( (strlen($call_time_id) < 2) or (strlen($call_time_name) < 2) ) + { + echo "
CALL TIME DEFINITION NOT ADDED - Please go back and look at the data you entered\n"; + echo "
Call Time ID and name must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_call_times SET call_time_id='$call_time_id',call_time_name='$call_time_name',call_time_comments='$call_time_comments';"; + $rslt=mysql_query($stmt, $link); + + echo "
CALL TIME ADDED: $call_time_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW CALL TIME ENTRY |$stmt|\n"); + fclose($fp); + } + } + } +$ADD=311111111; +} + + +###################### +# ADD=2111111111 adds new state call time definition to the system +###################### + +if ($ADD==2111111111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_state_call_times where state_call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
STATE CALL TIME DEFINITION NOT ADDED - there is already a call time entry with this ID\n";} + else + { + if ( (strlen($call_time_id) < 2) or (strlen($call_time_name) < 2) or (strlen($state_call_time_state) < 2) ) + { + echo "
STATE CALL TIME DEFINITION NOT ADDED - Please go back and look at the data you entered\n"; + echo "
State Call Time ID, name and state must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_state_call_times SET state_call_time_id='$call_time_id',state_call_time_name='$call_time_name',state_call_time_comments='$call_time_comments',state_call_time_state='$state_call_time_state';"; + $rslt=mysql_query($stmt, $link); + + echo "
STATE CALL TIME ADDED: $call_time_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW STATE CALL TIME ENTRY|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=3111111111; +} + + +###################### +# ADD=21111111111 adds new phone to the system +###################### + +if ($ADD==21111111111) +{ +echo "
\n"; + echo ""; + $stmt="SELECT count(*) from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
PHONE NOT ADDED - there is already a Phone in the system with this extension/server\n";} + else + { + if ( (strlen($extension) < 1) or (strlen($server_ip) < 7) or (strlen($dialplan_number) < 1) or (strlen($voicemail_id) < 1) or (strlen($login) < 1) or (strlen($pass) < 1)) + {echo "
PHONE NOT ADDED - Please go back and look at the data you entered\n";} + else + { + echo "
PHONE ADDED\n"; + + $stmt="INSERT INTO phones (extension,dialplan_number,voicemail_id,phone_ip,computer_ip,server_ip,login,pass,status,active,phone_type,fullname,company,picture,protocol,local_gmt,outbound_cid) values('$extension','$dialplan_number','$voicemail_id','$phone_ip','$computer_ip','$server_ip','$login','$pass','$status','$active','$phone_type','$fullname','$company','$picture','$protocol','$local_gmt','$outbound_cid');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=31111111111; +} + + +###################### +# ADD=211111111111 adds new server to the system +###################### + +if ($ADD==211111111111) +{ +echo "
\n"; + echo ""; + $stmt="SELECT count(*) from servers where server_id='$server_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
SERVER NOT ADDED - there is already a server in the system with this ID\n";} + else + { + if ( (strlen($server_id) < 1) or (strlen($server_ip) < 7) ) + {echo "
SERVER NOT ADDED - Please go back and look at the data you entered\n";} + else + { + echo "
SERVER ADDED\n"; + + $stmt="INSERT INTO servers (server_id,server_description,server_ip,active,asterisk_version) values('$server_id','$server_description','$server_ip','$active','$asterisk_version');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=311111111111; +} + + +###################### +# ADD=221111111111 adds the new vicidial server trunk record to the system +###################### + +if ($ADD==221111111111) +{ + echo ""; + $stmt="SELECT max_vicidial_trunks from servers where server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $MAXvicidial_trunks = $rowx[0]; + + $stmt="SELECT sum(dedicated_trunks) from vicidial_server_trunks where server_ip='$server_ip' and campaign_id !='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $SUMvicidial_trunks = ($rowx[0] + $dedicated_trunks); + + if ($SUMvicidial_trunks > $MAXvicidial_trunks) + { + echo "
VICIDIAL SERVER TRUNK RECORD NOT ADDED - the number of vicidial trunks is too high: $SUMvicidial_trunks / $MAXvicidial_trunks\n"; + } + else + { + $stmt="SELECT count(*) from vicidial_server_trunks where campaign_id='$campaign_id' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
VICIDIAL SERVER TRUNK RECORD NOT ADDED - there is already a server-trunk record for this campaign\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($server_ip) < 7) or (strlen($dedicated_trunks) < 1) or (strlen($trunk_restriction) < 1) ) + { + echo "
VICIDIAL SERVER TRUNK RECORD NOT ADDED - Please go back and look at the data you entered\n"; + echo "
campaign must be between 3 and 8 characters in length\n"; + echo "
server_ip delay must be at least 7 characters\n"; + echo "
trunks must be a digit from 0 to 9999\n"; + } + else + { + echo "
VICIDIAL SERVER TRUNK RECORD ADDED: $campaign_id - $server_ip - $dedicated_trunks - $trunk_restriction\n"; + + $stmt="INSERT INTO vicidial_server_trunks(server_ip,campaign_id,dedicated_trunks,trunk_restriction) values('$server_ip','$campaign_id','$dedicated_trunks','$trunk_restriction');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW VICIDIAL TRUNK |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } +$ADD=311111111111; +} + + +###################### +# ADD=2111111111111 adds new conference to the system +###################### + +if ($ADD==2111111111111) +{ +echo "
\n"; + echo ""; + $stmt="SELECT count(*) from conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CONFERENCE NOT ADDED - there is already a conference in the system with this ID and server\n";} + else + { + if ( (strlen($conf_exten) < 1) or (strlen($server_ip) < 7) ) + {echo "
CONFERENCE NOT ADDED - Please go back and look at the data you entered\n";} + else + { + echo "
CONFERENCE ADDED\n"; + + $stmt="INSERT INTO conferences (conf_exten,server_ip) values('$conf_exten','$server_ip');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=3111111111111; +} + + +###################### +# ADD=21111111111111 adds new vicidial conference to the system +###################### + +if ($ADD==21111111111111) +{ +echo "
\n"; + echo ""; + $stmt="SELECT count(*) from vicidial_conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
VICIDIAL CONFERENCE NOT ADDED - there is already a vicidial conference in the system with this ID and server\n";} + else + { + if ( (strlen($conf_exten) < 1) or (strlen($server_ip) < 7) ) + {echo "
VICIDIAL CONFERENCE NOT ADDED - Please go back and look at the data you entered\n";} + else + { + echo "
VICIDIAL CONFERENCE ADDED\n"; + + $stmt="INSERT INTO vicidial_conferences (conf_exten,server_ip) values('$conf_exten','$server_ip');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=31111111111111; +} + + +###################### +# ADD=221111111111111 adds the new system status to the system +###################### + +if ($ADD==221111111111111) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaign_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
SYSTEM STATUS NOT ADDED - there is already a campaign-status in the system with this name: $row[0]\n";} + else + { + $stmt="SELECT count(*) from vicidial_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
SYSTEM STATUS NOT ADDED - there is already a global-status in the system with this name\n";} + else + { + if ( (strlen($status) < 1) or (strlen($status_name) < 2) ) + { + echo "
SYSTEM STATUS NOT ADDED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 8 characters in length\n"; + echo "
status name must be between 2 and 30 characters in length\n"; + } + else + { + echo "
SYSTEM STATUS ADDED: $status_name - $status\n"; + + $stmt="INSERT INTO vicidial_statuses (status,status_name,selectable,human_answered,category) values('$status','$status_name','$selectable','$human_answered','$category');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW SYSTEM STATUS |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } +$ADD=321111111111111; +} + + +###################### +# ADD=231111111111111 adds the new status category to the system +###################### + +if ($ADD==231111111111111) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_status_categories where vsc_id='$vsc_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
STATUS CATEGORY NOT ADDED - there is already a status category in the system with this ID: $row[0]\n";} + else + { + if ( (strlen($vsc_id) < 2) or (strlen($vsc_id) > 20) or (strlen($vsc_name) < 2) ) + { + echo "
STATUS CATEGORY NOT ADDED - Please go back and look at the data you entered\n"; + echo "
ID must be between 2 and 20 characters in length\n"; + echo "
name name must be between 2 and 50 characters in length\n"; + } + else + { + echo "
STATUS CATEGORY ADDED: $vsc_id - $vsc_name\n"; + + $stmt="SELECT count(*) from vicidial_status_categories where tovdad_display='Y' and vsc_id NOT IN('$vsc_id');"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 3) and (ereg('Y',$tovdad_display)) ) + { + $tovdad_display = 'N'; + echo "
ERROR: There are already 4 Status Categories set to TimeOnVDAD Display\n"; + } + + $stmt="INSERT INTO vicidial_status_categories (vsc_id,vsc_name,vsc_description,tovdad_display) values('$vsc_id','$vsc_name','$vsc_description','$tovdad_display');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW STATUS CATEGORY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=331111111111111; +} + + + +###################################################################################################### +###################################################################################################### +####### 4 series, record modifications submitted and DB is modified, then on to 3 series forms below +###################################################################################################### +###################################################################################################### + + + +###################### +# ADD=4A submit user modifications to the system - ADMIN +###################### + +if ($ADD=="4A") +{ + if ($LOGmodify_users==1) + { + echo ""; + + if ( (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) + { + echo "
USER NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Password and Full Name each need ot be at least 2 characters in length\n"; + } + else + { + echo "
USER MODIFIED - ADMIN: $user\n"; + + $stmt="UPDATE vicidial_users set pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass',delete_users='$delete_users',delete_user_groups='$delete_user_groups',delete_lists='$delete_lists',delete_campaigns='$delete_campaigns',delete_ingroups='$delete_ingroups',delete_remote_agents='$delete_remote_agents',load_leads='$load_leads',campaign_detail='$campaign_detail',ast_admin_access='$ast_admin_access',ast_delete_phones='$ast_delete_phones',delete_scripts='$delete_scripts',modify_leads='$modify_leads',hotkeys_active='$hotkeys_active',change_agent_campaign='$change_agent_campaign',agent_choose_ingroups='$agent_choose_ingroups',closer_campaigns='$groups_value',scheduled_callbacks='$scheduled_callbacks',agentonly_callbacks='$agentonly_callbacks',agentcall_manual='$agentcall_manual',vicidial_recording='$vicidial_recording',vicidial_transfers='$vicidial_transfers',delete_filters='$delete_filters',alter_agent_interface_options='$alter_agent_interface_options',closer_default_blended='$closer_default_blended',delete_call_times='$delete_call_times',modify_call_times='$modify_call_times',modify_users='$modify_users',modify_campaigns='$modify_campaigns',modify_lists='$modify_lists',modify_scripts='$modify_scripts',modify_filters='$modify_filters',modify_ingroups='$modify_ingroups',modify_usergroups='$modify_usergroups',modify_remoteagents='$modify_remoteagents',modify_servers='$modify_servers',view_reports='$view_reports',vicidial_recording_override='$vicidial_recording_override',alter_custdata_override='$alter_custdata_override' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER INFO |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=3; # go to user modification below +} + + +###################### +# ADD=4B submit user modifications to the system - ADMIN +###################### + +if ($ADD=="4B") +{ + if ($LOGmodify_users==1) + { + echo ""; + + if ( (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) + { + echo "
USER NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Password and Full Name each need ot be at least 2 characters in length\n"; + } + else + { + echo "
USER MODIFIED - ADMIN: $user\n"; + + $stmt="UPDATE vicidial_users set pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass',hotkeys_active='$hotkeys_active',agent_choose_ingroups='$agent_choose_ingroups',closer_campaigns='$groups_value',scheduled_callbacks='$scheduled_callbacks',agentonly_callbacks='$agentonly_callbacks',agentcall_manual='$agentcall_manual',vicidial_recording='$vicidial_recording',vicidial_transfers='$vicidial_transfers',closer_default_blended='$closer_default_blended',vicidial_recording_override='$vicidial_recording_override',alter_custdata_override='$alter_custdata_override' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER INFO |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=3; # go to user modification below +} + + + +###################### +# ADD=4 submit user modifications to the system +###################### + +if ($ADD==4) +{ + if ($LOGmodify_users==1) + { + echo ""; + + if ( (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) + { + echo "
USER NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Password and Full Name each need ot be at least 2 characters in length\n"; + } + else + { + echo "
USER MODIFIED: $user\n"; + + $stmt="UPDATE vicidial_users set pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER INFO |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=3; # go to user modification below +} + +###################### +# ADD=41 submit campaign modifications to the system +###################### + +if ($ADD==41) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_name) < 6) or (strlen($active) < 1) ) + { + echo "
CAMPAIGN NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the campaign name needs to be at least 6 characters in length\n"; + echo "
|$campaign_name|$active|\n"; + } + else + { + echo "
CAMPAIGN MODIFIED: $campaign_id\n"; + + if ($dial_method == 'MANUAL') + { + $auto_dial_level='0'; + $adlSQL = "auto_dial_level='0',"; + } + else + { + if ($dial_level_override > 0) + { + $adlSQL = "auto_dial_level='$auto_dial_level',"; + } + else + { + if ($dial_method == 'RATIO') + { + if ($auto_dial_level < 1) {$auto_dial_level = "1.0";} + $adlSQL = "auto_dial_level='$auto_dial_level',"; + } + else + { + $adlSQL = ""; + if ($auto_dial_level < 1) + { + $auto_dial_level = "1.0"; + $adlSQL = "auto_dial_level='$auto_dial_level',"; + } + } + } + } + if ( (!ereg("DISABLED",$list_order_mix)) and ($hopper_level < 100) ) + {$hopper_level='100';} + + $stmtA="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',allow_closers='$allow_closers',hopper_level='$hopper_level', $adlSQL next_agent_call='$next_agent_call', local_call_time='$local_call_time', voicemail_ext='$voicemail_ext', dial_timeout='$dial_timeout', dial_prefix='$dial_prefix', campaign_cid='$campaign_cid', campaign_vdad_exten='$campaign_vdad_exten', web_form_address='" . mysql_real_escape_string($web_form_address) . "', park_ext='$park_ext', park_file_name='$park_file_name', campaign_rec_exten='$campaign_rec_exten', campaign_recording='$campaign_recording', campaign_rec_filename='$campaign_rec_filename', campaign_script='$script_id', get_call_launch='$get_call_launch', am_message_exten='$am_message_exten', amd_send_to_vmx='$amd_send_to_vmx', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number',lead_filter_id='$lead_filter_id',alt_number_dialing='$alt_number_dialing',scheduled_callbacks='$scheduled_callbacks',safe_harbor_message='$safe_harbor_message',drop_call_seconds='$drop_call_seconds',safe_harbor_exten='$safe_harbor_exten',wrapup_seconds='$wrapup_seconds',wrapup_message='$wrapup_message',closer_campaigns='$groups_value',use_internal_dnc='$use_internal_dnc',allcalls_delay='$allcalls_delay',omit_phone_code='$omit_phone_code',dial_method='$dial_method',available_only_ratio_tally='$available_only_ratio_tally',adaptive_dropped_percentage='$adaptive_dropped_percentage',adaptive_maximum_level='$adaptive_maximum_level',adaptive_latest_server_time='$adaptive_latest_server_time',adaptive_intensity='$adaptive_intensity',adaptive_dl_diff_target='$adaptive_dl_diff_target',concurrent_transfers='$concurrent_transfers',auto_alt_dial='$auto_alt_dial',agent_pause_codes_active='$agent_pause_codes_active',campaign_description='$campaign_description',campaign_changedate='$SQLdate',campaign_stats_refresh='$campaign_stats_refresh',disable_alter_custdata='$disable_alter_custdata',no_hopper_leads_logins='$no_hopper_leads_logins',list_order_mix='$list_order_mix',campaign_allow_inbound='$campaign_allow_inbound',manual_dial_list_id='$manual_dial_list_id',default_xfer_group='$default_xfer_group',xfer_groups='$XFERgroups_value' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + if ($reset_hopper == 'Y') + { + echo "
RESETTING CAMPAIGN LEAD HOPPER\n"; + echo "
- Wait 1 minute before dialing next number\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id' and status IN('READY','QUEUE','DONE');"; + $rslt=mysql_query($stmt, $link); + + ### LOG RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|CAMPAIGN HOPPERRESET|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CAMPAIGN INFO|$PHP_AUTH_USER|$ip|$stmtA|$reset_hopper|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=42 modify/delete campaign status in the system +###################### + +if ($ADD==42) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
CAMPAIGN STATUS NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the campaign id needs to be at least 2 characters in length\n"; + echo "
the campaign status needs to be at least 1 characters in length\n"; + } + else + { + if (ereg('delete',$stage)) + { + echo "
CUSTOM CAMPAIGN STATUS DELETED: $campaign_id - $status\n"; + + $stmt="DELETE FROM vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + + $stmtA="DELETE FROM vicidial_campaign_hotkeys where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmtA, $link); + + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE CAMPAIGN STATUS|$PHP_AUTH_USER|$ip|$stmt|$stmtA|\n"); + fclose($fp); + } + } + if (ereg('modify',$stage)) + { + echo "
CUSTOM CAMPAIGN STATUS MODIFIED: $campaign_id - $status\n"; + + $stmt="UPDATE vicidial_campaign_statuses SET status_name='$status_name',selectable='$selectable',human_answered='$human_answered',category='$category' where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CAMPAIGN STATUS|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$SUB=22; +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=43 delete campaign hotkey in the system +###################### + +if ($ADD==43) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($hotkey) < 1) ) + { + echo "
CAMPAIGN HOT KEY NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the campaign id needs to be at least 2 characters in length\n"; + echo "
the campaign status needs to be at least 1 characters in length\n"; + echo "
the campaign hotkey needs to be at least 1 characters in length\n"; + } + else + { + echo "
CUSTOM CAMPAIGN HOT KEY DELETED: $campaign_id - $status - $hotkey\n"; + + $stmt="DELETE FROM vicidial_campaign_hotkeys where campaign_id='$campaign_id' and status='$status' and hotkey='$hotkey';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE CAMPAIGN STATUS|$PHP_AUTH_USER|$ip|DELETE FROM vicidial_campaign_hotkeys where campaign_id='$campaign_id' and status='$status' and hotkey='$hotkey'|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$SUB=23; +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=44 submit campaign modifications to the system - Basic View +###################### + +if ($ADD==44) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_name) < 6) or (strlen($active) < 1) ) + { + echo "
CAMPAIGN NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the campaign name needs to be at least 6 characters in length\n"; + } + else + { + echo "
CAMPAIGN MODIFIED: $campaign_id\n"; + + if ($dial_method == 'RATIO') + { + if ($auto_dial_level < 1) {$auto_dial_level = "1.0";} + $adlSQL = "auto_dial_level='$auto_dial_level',"; + } + else + { + if ($dial_method == 'MANUAL') + { + $auto_dial_level='0'; + $adlSQL = "auto_dial_level='0',"; + } + else + { + $adlSQL = ""; + if ($auto_dial_level < 1) + { + $auto_dial_level = "1.0"; + $adlSQL = "auto_dial_level='$auto_dial_level',"; + } + } + } + if ( (!ereg("DISABLED",$list_order_mix)) and ($hopper_level < 100) ) + {$hopper_level='100';} + + $stmtA="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',hopper_level='$hopper_level', $adlSQL lead_filter_id='$lead_filter_id',dial_method='$dial_method',adaptive_intensity='$adaptive_intensity',campaign_changedate='$SQLdate',list_order_mix='$list_order_mix' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + if ($reset_hopper == 'Y') + { + echo "
RESETTING CAMPAIGN LEAD HOPPER\n"; + echo "
- Wait 1 minute before dialing next number\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id' and status IN('READY','QUEUE','DONE');;"; + $rslt=mysql_query($stmt, $link); + + ### LOG HOPPER RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|CAMPAIGN HOPPERRESET|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CAMPAIGN INFO|$PHP_AUTH_USER|$ip|$stmtA|$reset_hopper|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=34; # go to campaign modification form below +} + +###################### +# ADD=45 modify campaign lead recycle in the system +###################### + +if ($ADD==45) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or ($attempt_delay < 120) or ($attempt_maximum < 1) or ($attempt_maximum > 10) ) + { + echo "
CAMPAIGN LEAD RECYCLE NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 6 characters in length\n"; + echo "
attempt delay must be at least 120 seconds\n"; + echo "
maximum attempts must be from 1 to 10\n"; + } + else + { + echo "
CAMPAIGN LEAD MODIFIED: $campaign_id - $status - $attempt_delay\n"; + + $stmt="UPDATE vicidial_lead_recycle SET attempt_delay='$attempt_delay',attempt_maximum='$attempt_maximum',active='$active' where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LEAD RECYCLE |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$SUB=25; +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=47 modify agent pause code in the system +###################### + +if ($ADD==47) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($pause_code) < 1) or (strlen($pause_code) > 6) or (strlen($pause_code_name) < 2) ) + { + echo "
AGENT PAUSE CODE NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
pause_code must be between 1 and 6 characters in length\n"; + echo "
pause_code name must be between 2 and 30 characters in length\n"; + } + else + { + echo "
AGENT PAUSE CODE MODIFIED: $campaign_id - $pause_code - $pause_code_name\n"; + + $stmt="UPDATE vicidial_pause_codes SET pause_code_name='$pause_code_name',billable='$billable' where campaign_id='$campaign_id' and pause_code='$pause_code';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY AGENT PAUSECODE|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$SUB=27; +$ADD=31; # go to campaign modification form below +} + + +###################### +# ADD=49 modify campaign list mix in the system +###################### + +if ($ADD==49) +{ + if ($LOGmodify_campaigns==1) + { + ##### MODIFY a list mix container entry ##### + if ($stage=='MODIFY') + { + echo ""; + + $Flist_mix_container = "list_mix_container_$vcl_id"; + $Fmix_method = "mix_method_$vcl_id"; + $Fstatus = "status_$vcl_id"; + $Fvcl_name = "vcl_name_$vcl_id"; + + if (isset($_GET[$Flist_mix_container])) {$list_mix_container=$_GET[$Flist_mix_container];} + elseif (isset($_POST[$Flist_mix_container])) {$list_mix_container=$_POST[$Flist_mix_container];} + if (isset($_GET[$Fmix_method])) {$mix_method=$_GET[$Fmix_method];} + elseif (isset($_POST[$Fmix_method])) {$mix_method=$_POST[$Fmix_method];} + if (isset($_GET[$Fstatus])) {$status=$_GET[$Fstatus];} + elseif (isset($_POST[$Fstatus])) {$status=$_POST[$Fstatus];} + if (isset($_GET[$Fvcl_name])) {$vcl_name=$_GET[$Fvcl_name];} + elseif (isset($_POST[$Fvcl_name])) {$vcl_name=$_POST[$Fvcl_name];} + $list_mix_container = preg_replace("/:$/","",$list_mix_container); + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) or (strlen($list_mix_container) < 6) or (strlen($vcl_name) < 2) ) + { + echo "
LIST MIX NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + echo "
vcl_name name must be between 2 and 30 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_campaigns_list_mix SET vcl_name='$vcl_name',mix_method='$mix_method',list_mix_container='$list_mix_container' where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
LIST MIX MODIFIED: $campaign_id - $vcl_id - $vcl_name\n"; + } + } + + ##### ADD a list mix container entry ##### + if ($stage=='ADD') + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) or (strlen($list_id) < 1) ) + { + echo "
LIST MIX NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + echo "
list_id must be at least 2 characters in length\n"; + } + else + { + $stmt="SELECT list_mix_container from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $OLDlist_mix_container = $row[0]; + $NEWlist_mix_container = "$OLDlist_mix_container:$list_id|10|0| -|"; + + $stmt="UPDATE vicidial_campaigns_list_mix SET list_mix_container='$NEWlist_mix_container' where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
LIST MIX MODIFIED: $campaign_id - $vcl_id - $list_id\n"; + } + } + + ##### REMOVE a list mix container entry ##### + if ($stage=='REMOVE') + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) or (strlen($list_id) < 1) ) + { + echo "
LIST MIX NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + echo "
list_id must be at least 2 characters in length\n"; + } + else + { + $stmt="SELECT list_mix_container from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $MIXentries = $MT; + $MIXentries = explode(":", $row[0]); + $Ms_to_print = (count($MIXentries) - 0); + + if ($Ms_to_print < 2) + { + echo "
LIST MIX NOT MODIFIED: You cannot delete the last list_id entry from a list mix\n"; + } + else + { + $MIXdetailsPCT = explode('|', $MIXentries[$mix_container_item]); + $MIXpercentPCT = $MIXdetailsPCT[2]; + + $q=0; + while ($Ms_to_print > $q) + { + if ( ($mix_container_item > $q) or ($mix_container_item < $q) ) + { + if ( ($q==0) and ($mix_container_item > 0) ) + { + $MIXdetailsONE = explode('|', $MIXentries[$q]); + $MIXpercentONE = ($MIXdetailsONE[2] + $MIXpercentPCT); + $NEWlist_mix_container .= "$MIXdetailsONE[0]|$MIXdetailsONE[1]|$MIXpercentONE|$MIXdetailsONE[3]|:"; + } + else + { + if ( ($q==1) and ($mix_container_item < 1) ) + { + $MIXdetailsONE = explode('|', $MIXentries[$q]); + $MIXpercentONE = ($MIXdetailsONE[2] + $MIXpercentPCT); + $NEWlist_mix_container .= "$MIXdetailsONE[0]|$MIXdetailsONE[1]|$MIXpercentONE|$MIXdetailsONE[3]|:"; + } + else + { + $NEWlist_mix_container .= "$MIXentries[$q]:"; + } + } + } + $q++; + } + $NEWlist_mix_container = preg_replace("/.$/",'',$NEWlist_mix_container); + + $stmt="UPDATE vicidial_campaigns_list_mix SET list_mix_container='$NEWlist_mix_container' where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
LIST MIX MODIFIED: $campaign_id - $vcl_id - $list_id - $mix_container_item\n"; + } + } + } + + ##### ADD a NEW list mix ##### + if ($stage=='NEWMIX') + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) or (strlen($vcl_name) < 2) ) + { + echo "
LIST MIX NOT ADDED - Please go back and look at the data you entered\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + echo "
vcl_name must be at least 2 characters in length\n"; + } + else + { + $stmt="SELECT count(*) from vicidial_campaigns_list_mix where vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + echo "
LIST MIX NOT ADDED - There is already a list mix with this ID in the system\n"; + } + else + { + $stmt="INSERT INTO vicidial_campaigns_list_mix SET list_mix_container='$list_id|1|100| $status -|',campaign_id='$campaign_id',vcl_id='$vcl_id',vcl_name='$vcl_name',mix_method='$mix_method',status='INACTIVE';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
LIST MIX ADDED: $campaign_id - $vcl_id - $vcl_name\n"; + } + } + } + + ##### DELETE an existing list mix ##### + if ($stage=='DELMIX') + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) ) + { + echo "
LIST MIX NOT DELETED - Please go back and look at the data you entered\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_campaigns_list_mix where vcl_id='$vcl_id' and campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
LIST MIX DELETED: $campaign_id - $vcl_id - $vcl_name\n"; + } + } + + ##### Set list mix entry to active ##### + if ($stage=='SETACTIVE') + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) ) + { + echo "
LIST MIX NOT ACTIVATED - Please go back and look at the data you entered\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_campaigns_list_mix SET status='INACTIVE' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_campaigns_list_mix SET status='ACTIVE' where vcl_id='$vcl_id' and campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
LIST MIX ACTIVATED: $campaign_id - $vcl_id - $vcl_name\n"; + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$SUB=29; +$ADD=31; # go to campaign modification form below +} + + +###################### +# ADD=411 submit list modifications to the system +###################### + +if ($ADD==411) +{ + if ($LOGmodify_lists==1) + { + echo ""; + + if ( (strlen($list_name) < 2) or (strlen($campaign_id) < 2) ) + { + echo "
LIST NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
list name must be at least 2 characters in length\n"; + } + else + { + echo "
LIST MODIFIED: $list_id\n"; + + $stmt="UPDATE vicidial_lists set list_name='$list_name',campaign_id='$campaign_id',active='$active',list_description='$list_description',list_changedate='$SQLdate' where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + if ($reset_list == 'Y') + { + echo "
RESETTING LIST-CALLED-STATUS\n"; + $stmt="UPDATE vicidial_list set called_since_last_reset='N' where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|RESET LIST CALLED |$PHP_AUTH_USER|$ip|list_name='$list_name'|\n"); + fclose($fp); + } + } + if ($campaign_id != "$old_campaign_id") + { + echo "
REMOVING LIST HOPPER LEADS FROM OLD CAMPAIGN HOPPER ($old_campaign_id)\n"; + $stmt="DELETE from vicidial_hopper where list_id='$list_id' and campaign_id='$old_campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST INFO |$PHP_AUTH_USER|$ip|list_name='$list_name',campaign_id='$campaign_id',active='$active',list_description='$list_description' where list_id='$list_id'|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=311; # go to list modification form below +} + + +###################### +# ADD=4111 modify in-group info in the system +###################### + +if ($ADD==4111) +{ + if ($LOGmodify_ingroups==1) + { + echo ""; + + if ( (strlen($group_name) < 2) or (strlen($group_color) < 2) ) + { + echo "
GROUP NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
group name and group color must be at least 2 characters in length\n"; + } + else + { + echo "
GROUP MODIFIED: $group_id\n"; + + $stmt="UPDATE vicidial_inbound_groups set group_name='$group_name', group_color='$group_color', active='$active', web_form_address='" . mysql_real_escape_string($web_form_address) . "', voicemail_ext='$voicemail_ext', next_agent_call='$next_agent_call', fronter_display='$fronter_display', ingroup_script='$script_id', get_call_launch='$get_call_launch', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number',drop_message='$drop_message',drop_call_seconds='$drop_call_seconds',drop_exten='$drop_exten',call_time_id='$call_time_id',after_hours_action='$after_hours_action',after_hours_message_filename='$after_hours_message_filename',after_hours_exten='$after_hours_exten',after_hours_voicemail='$after_hours_voicemail',welcome_message_filename='$welcome_message_filename',moh_context='$moh_context',onhold_prompt_filename='$onhold_prompt_filename',prompt_interval='$prompt_interval',agent_alert_exten='$agent_alert_exten',agent_alert_delay='$agent_alert_delay',default_xfer_group='$default_xfer_group' where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY GROUP INFO |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=3111; # go to in-group modification form below +} + + + +###################### +# ADD=41111 modify remote agents info in the system +###################### + +if ($ADD==41111) +{ + if ($LOGmodify_remoteagents==1) + { + echo ""; + + if ( (strlen($server_ip) < 2) or (strlen($user_start) < 2) or (strlen($campaign_id) < 2) or (strlen($conf_exten) < 2) ) + { + echo "
REMOTE AGENTS NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
User ID Start and External Extension must be at least 2 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_remote_agents set user_start='$user_start', number_of_lines='$number_of_lines', server_ip='$server_ip', conf_exten='$conf_exten', status='$status', campaign_id='$campaign_id', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOTE AGENTS MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY REMOTE AGENTS ENTRY |$PHP_AUTH_USER|$ip|set user_start='$user_start', number_of_lines='$number_of_lines', server_ip='$server_ip', conf_exten='$conf_exten', status='$status', campaign_id='$campaign_id', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id'|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=31111; # go to remote agents modification form below +} + + + +###################### +# ADD=411111 modify user group info in the system +###################### + +if ($ADD==411111) +{ + if ($LOGmodify_usergroups==1) + { + echo ""; + + if ( (strlen($user_group) < 2) or (strlen($group_name) < 2) ) + { + echo "
USER GROUP NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Group name and description must be at least 2 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_user_groups set user_group='$user_group', group_name='$group_name',allowed_campaigns='$campaigns_value' where user_group='$OLDuser_group';"; + $rslt=mysql_query($stmt, $link); + + echo "
USER GROUP MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER GROUP ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=311111; # go to user group modification form below +} + +###################### +# ADD=4111111 modify script in the system +###################### + +if ($ADD==4111111) +{ + if ($LOGmodify_scripts==1) + { + echo "\n"; + echo "\n"; + echo ""; + + if ( (strlen($script_id) < 2) or (strlen($script_name) < 2) or (strlen($script_text) < 2) ) + { + echo "
SCRIPT NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Script name, description and text must be at least 2 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_scripts set script_name='$script_name', script_comments='$script_comments', script_text='$script_text', active='$active' where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
SCRIPT MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY SCRIPT ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=3111111; # go to script modification form below +} + + +###################### +# ADD=41111111 modify filter in the system +###################### + +if ($ADD==41111111) +{ + if ($LOGmodify_filters==1) + { + echo ""; + + if ( (strlen($lead_filter_id) < 2) or (strlen($lead_filter_name) < 2) or (strlen($lead_filter_sql) < 2) ) + { + echo "
FILTER NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Filter ID, name and SQL must be at least 2 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_lead_filters set lead_filter_name='$lead_filter_name', lead_filter_comments='$lead_filter_comments', lead_filter_sql='$lead_filter_sql' where lead_filter_id='$lead_filter_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
FILTER MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY FILTER ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=31111111; # go to filter modification form below +} + + +###################### +# ADD=411111111 modify call time in the system +###################### + +if ($ADD==411111111) +{ + if ($LOGmodify_call_times==1) + { + echo ""; + + if ( (strlen($call_time_id) < 2) or (strlen($call_time_name) < 2) ) + { + echo "
CALL TIME NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Call Time ID and name must be at least 2 characters in length\n"; + } + else + { + $ct_default_start = preg_replace('/\D/', '', $ct_default_start); + $ct_default_stop = preg_replace('/\D/', '', $ct_default_stop); + $ct_sunday_start = preg_replace('/\D/', '', $ct_sunday_start); + $ct_sunday_stop = preg_replace('/\D/', '', $ct_sunday_stop); + $ct_monday_start = preg_replace('/\D/', '', $ct_monday_start); + $ct_monday_stop = preg_replace('/\D/', '', $ct_monday_stop); + $ct_tuesday_start = preg_replace('/\D/', '', $ct_tuesday_start); + $ct_tuesday_stop = preg_replace('/\D/', '', $ct_tuesday_stop); + $ct_wednesday_start = preg_replace('/\D/', '', $ct_wednesday_start); + $ct_wednesday_stop = preg_replace('/\D/', '', $ct_wednesday_stop); + $ct_thursday_start = preg_replace('/\D/', '', $ct_thursday_start); + $ct_thursday_stop = preg_replace('/\D/', '', $ct_thursday_stop); + $ct_friday_start = preg_replace('/\D/', '', $ct_friday_start); + $ct_friday_stop = preg_replace('/\D/', '', $ct_friday_stop); + $ct_saturday_start = preg_replace('/\D/', '', $ct_saturday_start); + $ct_saturday_stop = preg_replace('/\D/', '', $ct_saturday_stop); + $stmt="UPDATE vicidial_call_times set call_time_name='$call_time_name', call_time_comments='$call_time_comments', ct_default_start='$ct_default_start', ct_default_stop='$ct_default_stop', ct_sunday_start='$ct_sunday_start', ct_sunday_stop='$ct_sunday_stop', ct_monday_start='$ct_monday_start', ct_monday_stop='$ct_monday_stop', ct_tuesday_start='$ct_tuesday_start', ct_tuesday_stop='$ct_tuesday_stop', ct_wednesday_start='$ct_wednesday_start', ct_wednesday_stop='$ct_wednesday_stop', ct_thursday_start='$ct_thursday_start', ct_thursday_stop='$ct_thursday_stop', ct_friday_start='$ct_friday_start', ct_friday_stop='$ct_friday_stop', ct_saturday_start='$ct_saturday_start', ct_saturday_stop='$ct_saturday_stop' where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
CALL TIME MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CALL TIME ENTRY |$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=311111111; # go to call time modification form below +} + + +###################### +# ADD=4111111111 modify state call time in the system +###################### + +if ($ADD==4111111111) +{ + if ($LOGmodify_call_times==1) + { + echo ""; + + if ( (strlen($call_time_id) < 2) or (strlen($call_time_name) < 2) or (strlen($state_call_time_state) < 2) ) + { + echo "
STATE CALL TIME NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
State Call Time ID, name and state must be at least 2 characters in length\n"; + } + else + { + $ct_default_start = preg_replace('/\D/', '', $ct_default_start); + $ct_default_stop = preg_replace('/\D/', '', $ct_default_stop); + $ct_sunday_start = preg_replace('/\D/', '', $ct_sunday_start); + $ct_sunday_stop = preg_replace('/\D/', '', $ct_sunday_stop); + $ct_monday_start = preg_replace('/\D/', '', $ct_monday_start); + $ct_monday_stop = preg_replace('/\D/', '', $ct_monday_stop); + $ct_tuesday_start = preg_replace('/\D/', '', $ct_tuesday_start); + $ct_tuesday_stop = preg_replace('/\D/', '', $ct_tuesday_stop); + $ct_wednesday_start = preg_replace('/\D/', '', $ct_wednesday_start); + $ct_wednesday_stop = preg_replace('/\D/', '', $ct_wednesday_stop); + $ct_thursday_start = preg_replace('/\D/', '', $ct_thursday_start); + $ct_thursday_stop = preg_replace('/\D/', '', $ct_thursday_stop); + $ct_friday_start = preg_replace('/\D/', '', $ct_friday_start); + $ct_friday_stop = preg_replace('/\D/', '', $ct_friday_stop); + $ct_saturday_start = preg_replace('/\D/', '', $ct_saturday_start); + $ct_saturday_stop = preg_replace('/\D/', '', $ct_saturday_stop); + $stmt="UPDATE vicidial_state_call_times set state_call_time_name='$call_time_name', state_call_time_comments='$call_time_comments', sct_default_start='$ct_default_start', sct_default_stop='$ct_default_stop', sct_sunday_start='$ct_sunday_start', sct_sunday_stop='$ct_sunday_stop', sct_monday_start='$ct_monday_start', sct_monday_stop='$ct_monday_stop', sct_tuesday_start='$ct_tuesday_start', sct_tuesday_stop='$ct_tuesday_stop', sct_wednesday_start='$ct_wednesday_start', sct_wednesday_stop='$ct_wednesday_stop', sct_thursday_start='$ct_thursday_start', sct_thursday_stop='$ct_thursday_stop', sct_friday_start='$ct_friday_start', sct_friday_stop='$ct_friday_stop', sct_saturday_start='$ct_saturday_start', sct_saturday_stop='$ct_saturday_stop', state_call_time_state='$state_call_time_state' where state_call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
STATE CALL TIME MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY STATE CALL TIME ENTRY|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=3111111111; # go to state call time modification form below +} + + +###################### +# ADD=41111111111 modify phone record in the system +###################### + +if ($ADD==41111111111) +{ + if ($LOGast_admin_access==1) + { + echo ""; + + $stmt="SELECT count(*) from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ( ($extension != $old_extension) or ($server_ip != $old_server_ip) ) ) + {echo "
PHONE NOT MODIFIED - there is already a Phone in the system with this extension/server\n";} + else + { + if ( (strlen($extension) < 1) or (strlen($server_ip) < 7) or (strlen($dialplan_number) < 1) or (strlen($voicemail_id) < 1) or (strlen($login) < 1) or (strlen($pass) < 1)) + {echo "
PHONE NOT MODIFIED - Please go back and look at the data you entered\n";} + else + { + echo "
PHONE MODIFIED: $extension\n"; + + $stmt="UPDATE phones set extension='$extension', dialplan_number='$dialplan_number', voicemail_id='$voicemail_id', phone_ip='$phone_ip', computer_ip='$computer_ip', server_ip='$server_ip', login='$login', pass='$pass', status='$status', active='$active', phone_type='$phone_type', fullname='$fullname', company='$company', picture='$picture', protocol='$protocol', local_gmt='$local_gmt', ASTmgrUSERNAME='$ASTmgrUSERNAME', ASTmgrSECRET='$ASTmgrSECRET', login_user='$login_user', login_pass='$login_pass', login_campaign='$login_campaign', park_on_extension='$park_on_extension', conf_on_extension='$conf_on_extension', VICIDIAL_park_on_extension='$VICIDIAL_park_on_extension', VICIDIAL_park_on_filename='$VICIDIAL_park_on_filename', monitor_prefix='$monitor_prefix', recording_exten='$recording_exten', voicemail_exten='$voicemail_exten', voicemail_dump_exten='$voicemail_dump_exten', ext_context='$ext_context', dtmf_send_extension='$dtmf_send_extension', call_out_number_group='$call_out_number_group', client_browser='$client_browser', install_directory='$install_directory', local_web_callerID_URL='" . mysql_real_escape_string($local_web_callerID_URL) . "', VICIDIAL_web_URL='" . mysql_real_escape_string($VICIDIAL_web_URL) . "', AGI_call_logging_enabled='$AGI_call_logging_enabled', user_switching_enabled='$user_switching_enabled', conferencing_enabled='$conferencing_enabled', admin_hangup_enabled='$admin_hangup_enabled', admin_hijack_enabled='$admin_hijack_enabled', admin_monitor_enabled='$admin_monitor_enabled', call_parking_enabled='$call_parking_enabled', updater_check_enabled='$updater_check_enabled', AFLogging_enabled='$AFLogging_enabled', QUEUE_ACTION_enabled='$QUEUE_ACTION_enabled', CallerID_popup_enabled='$CallerID_popup_enabled', voicemail_button_enabled='$voicemail_button_enabled', enable_fast_refresh='$enable_fast_refresh', fast_refresh_rate='$fast_refresh_rate', enable_persistant_mysql='$enable_persistant_mysql', auto_dial_next_number='$auto_dial_next_number', VDstop_rec_after_each_call='$VDstop_rec_after_each_call', DBX_server='$DBX_server', DBX_database='$DBX_database', DBX_user='$DBX_user', DBX_pass='$DBX_pass', DBX_port='$DBX_port', DBY_server='$DBY_server', DBY_database='$DBY_database', DBY_user='$DBY_user', DBY_pass='$DBY_pass', DBY_port='$DBY_port', outbound_cid='$outbound_cid', enable_sipsak_messages='$enable_sipsak_messages' where extension='$old_extension' and server_ip='$old_server_ip';"; + $rslt=mysql_query($stmt, $link); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=31111111111; # go to phone modification form below +} + + +###################### +# ADD=411111111111 modify server record in the system +###################### + +if ($ADD==411111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + + $stmt="SELECT count(*) from servers where server_id='$server_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ($server_id != $old_server_id) ) + {echo "
SERVER NOT MODIFIED - there is already a server in the system with this server_id\n";} + else + { + $stmt="SELECT count(*) from servers where server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ($server_ip != $old_server_ip) ) + {echo "
SERVER NOT MODIFIED - there is already a server in the system with this server_ip\n";} + else + { + if ( (strlen($server_id) < 1) or (strlen($server_ip) < 7) ) + {echo "
SERVER NOT MODIFIED - Please go back and look at the data you entered\n";} + else + { + echo "
SERVER MODIFIED: $server_ip\n"; + + $stmt="UPDATE servers set server_id='$server_id',server_description='$server_description',server_ip='$server_ip',active='$active',asterisk_version='$asterisk_version', max_vicidial_trunks='$max_vicidial_trunks', telnet_host='$telnet_host', telnet_port='$telnet_port', ASTmgrUSERNAME='$ASTmgrUSERNAME', ASTmgrSECRET='$ASTmgrSECRET', ASTmgrUSERNAMEupdate='$ASTmgrUSERNAMEupdate', ASTmgrUSERNAMElisten='$ASTmgrUSERNAMElisten', ASTmgrUSERNAMEsend='$ASTmgrUSERNAMEsend', local_gmt='$local_gmt', voicemail_dump_exten='$voicemail_dump_exten', answer_transfer_agent='$answer_transfer_agent', ext_context='$ext_context', sys_perf_log='$sys_perf_log', vd_server_logs='$vd_server_logs', agi_output='$agi_output', vicidial_balance_active='$vicidial_balance_active', balance_trunks_offlimits='$balance_trunks_offlimits' where server_id='$old_server_id';"; + $rslt=mysql_query($stmt, $link); + } + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=311111111111; # go to server modification form below +} + + +###################### +# ADD=421111111111 modify vicidial server trunks record in the system +###################### + +if ($ADD==421111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + $stmt="SELECT max_vicidial_trunks from servers where server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $MAXvicidial_trunks = $rowx[0]; + + $stmt="SELECT sum(dedicated_trunks) from vicidial_server_trunks where server_ip='$server_ip' and campaign_id !='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $SUMvicidial_trunks = ($rowx[0] + $dedicated_trunks); + + if ($SUMvicidial_trunks > $MAXvicidial_trunks) + { + echo "
VICIDIAL SERVER TRUNK RECORD NOT ADDED - the number of vicidial trunks is too high: $SUMvicidial_trunks / $MAXvicidial_trunks\n"; + } + else + { + if ( (strlen($campaign_id) < 2) or (strlen($server_ip) < 7) or (strlen($dedicated_trunks) < 1) or (strlen($trunk_restriction) < 1) ) + { + echo "
VICIDIAL SERVER TRUNK RECORD NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
campaign must be between 3 and 8 characters in length\n"; + echo "
server_ip delay must be at least 7 characters\n"; + echo "
trunks must be a digit from 0 to 9999\n"; + } + else + { + echo "
VICIDIAL SERVER TRUNK RECORD MODIFIED: $campaign_id - $server_ip - $dedicated_trunks - $trunk_restriction\n"; + + $stmt="UPDATE vicidial_server_trunks SET dedicated_trunks='$dedicated_trunks',trunk_restriction='$trunk_restriction' where campaign_id='$campaign_id' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY SERVER TRUNK |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=311111111111; # go to server modification form below +} + + +###################### +# ADD=4111111111111 modify conference record in the system +###################### + +if ($ADD==4111111111111) +{ + if ($LOGast_admin_access==1) + { + echo ""; + + $stmt="SELECT count(*) from conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ( ($conf_exten != $old_conf_exten) or ($server_ip != $old_server_ip) ) ) + {echo "
CONFERENCE NOT MODIFIED - there is already a Conference in the system with this extension-server\n";} + else + { + if ( (strlen($conf_exten) < 1) or (strlen($server_ip) < 7) ) + {echo "
CONFERENCE NOT MODIFIED - Please go back and look at the data you entered\n";} + else + { + echo "
CONFERENCE MODIFIED: $conf_exten\n"; + + $stmt="UPDATE conferences set conf_exten='$conf_exten',server_ip='$server_ip',extension='$extension' where conf_exten='$old_conf_exten';"; + $rslt=mysql_query($stmt, $link); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=3111111111111; # go to conference modification form below +} + + +###################### +# ADD=41111111111111 modify vicidial conference record in the system +###################### + +if ($ADD==41111111111111) +{ + if ($LOGast_admin_access==1) + { + echo ""; + + $stmt="SELECT count(*) from vicidial_conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ( ($conf_exten != $old_conf_exten) or ($server_ip != $old_server_ip) ) ) + {echo "
VICIDIAL CONFERENCE NOT MODIFIED - there is already a Conference in the system with this extension-server\n";} + else + { + if ( (strlen($conf_exten) < 1) or (strlen($server_ip) < 7) ) + {echo "
VICIDIAL CONFERENCE NOT MODIFIED - Please go back and look at the data you entered\n";} + else + { + echo "
VICIDIAL CONFERENCE MODIFIED: $conf_exten\n"; + + $stmt="UPDATE vicidial_conferences set conf_exten='$conf_exten',server_ip='$server_ip',extension='$extension' where conf_exten='$old_conf_exten';"; + $rslt=mysql_query($stmt, $link); + + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=31111111111111; # go to vicidial conference modification form below +} + + + +###################### +# ADD=411111111111111 modify vicidial system settings +###################### + +if ($ADD==411111111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + + echo "
VICIDIAL SYSTEM SETTINGS MODIFIED\n"; + + $stmt="UPDATE system_settings set use_non_latin='$use_non_latin',webroot_writable='$webroot_writable',enable_queuemetrics_logging='$enable_queuemetrics_logging',queuemetrics_server_ip='$queuemetrics_server_ip',queuemetrics_dbname='$queuemetrics_dbname',queuemetrics_login='$queuemetrics_login',queuemetrics_pass='$queuemetrics_pass',queuemetrics_url='$queuemetrics_url',queuemetrics_log_id='$queuemetrics_log_id',queuemetrics_eq_prepend='$queuemetrics_eq_prepend',vicidial_agent_disable='$vicidial_agent_disable',allow_sipsak_messages='$allow_sipsak_messages',admin_home_url='$admin_home_url',enable_agc_xfer_log='$enable_agc_xfer_log';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY SYSTEM SETTINGS|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=311111111111111; # go to vicidial system settings form below +} + + +###################### +# ADD=421111111111111 modify/delete system status in the system +###################### + +if ($ADD==421111111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + + if (ereg('delete',$stage)) + { + if ( (strlen($status) < 1) or (preg_match("/^B$|^NA$|^DNC$|^NA$|^DROP$|^INCALL$|^QUEUE$|^NEW$/i",$status)) ) + { + echo "
SYSTEM STATUS NOT DELETED - Please go back and look at the data you entered\n"; + echo "
the system status cannot be a reserved status: B,NA,DNC,NA,DROP,INCALL,QUEUE,NEW\n"; + echo "
the system status needs to be at least 1 characters in length\n"; + } + else + { + echo "
SYSTEM STATUS DELETED: $status\n"; + + $stmt="DELETE FROM vicidial_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + + $stmtA="DELETE FROM vicidial_campaign_hotkeys where status='$status';"; + $rslt=mysql_query($stmtA, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE SYSTEM STATUS |$PHP_AUTH_USER|$ip|$stmt|$stmtA|\n"); + fclose($fp); + } + } + } + if (ereg('modify',$stage)) + { + if ( (strlen($status) < 1) or (strlen($status_name) < 2) ) + { + echo "
SYSTEM STATUS NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the system status needs to be at least 1 characters in length\n"; + echo "
the system status name needs to be at least 1 characters in length\n"; + } + else + { + echo "
SYSTEM STATUS MODIFIED: $status\n"; + + $stmt="UPDATE vicidial_statuses SET status_name='$status_name',selectable='$selectable',human_answered='$human_answered',category='$category' where status='$status';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY SYSTEM STATUS |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=321111111111111; # go to system settings modification form below +} + + +###################### +# ADD=431111111111111 modify/delete status category in the system +###################### + +if ($ADD==431111111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + + if ( (strlen($vsc_id) < 2) or (preg_match("/^UNDEFINED$/i",$vsc_id)) ) + { + echo "
STATUS CATEGORY NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the status category cannot be a reserved category: UNDEFINED\n"; + echo "
the status category needs to be at least 2 characters in length\n"; + } + else + { + if (ereg('delete',$stage)) + { + echo "
STATUS CATEGORY DELETED: $vsc_id\n"; + + $stmt="DELETE FROM vicidial_status_categories where vsc_id='$vsc_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE STATUS CATEGORY|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + if (ereg('modify',$stage)) + { + echo "
STATUS CATEGORY MODIFIED: $vsc_id\n"; + + $stmt="SELECT count(*) from vicidial_status_categories where tovdad_display='Y' and vsc_id NOT IN('$vsc_id');"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 3) and (ereg('Y',$tovdad_display)) ) + { + $tovdad_display = 'N'; + echo "
ERROR: There are already 4 Status Categories set to TimeOnVDAD Display\n"; + } + + $stmt="UPDATE vicidial_status_categories SET vsc_name='$vsc_name',vsc_description='$vsc_description',tovdad_display='$tovdad_display' where vsc_id='$vsc_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY STATUS CATEGORY|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=331111111111111; # go to system settings modification form below +} + + + + +###################################################################################################### +###################################################################################################### +####### 5 series, delete records confirmation +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=5 confirmation before deletion of user +###################### + +if ($ADD==5) +{ + echo ""; + + if ( (strlen($user) < 2) or ($LOGdelete_users < 1) ) + { + echo "
USER NOT DELETED - Please go back and look at the data you entered\n"; + echo "
User be at least 2 characters in length\n"; + } + else + { + echo "
USER DELETION CONFIRMATION: $user\n"; + echo "

Click here to delete user $user


\n"; + } + +$ADD='3'; # go to user modification below +} + +###################### +# ADD=51 confirmation before deletion of campaign +###################### + +if ($ADD==51) +{ + echo ""; + + if ( (strlen($campaign_id) < 2) or ($LOGdelete_campaigns < 1) ) + { + echo "
CAMPAIGN NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + echo "
CAMPAIGN DELETION CONFIRMATION: $campaign_id\n"; + echo "

Click here to delete campaign $campaign_id


\n"; + } + +$ADD='31'; # go to campaign modification below +} + +###################### +# ADD=52 confirmation before logging all agents out of campaign of campaign +###################### + +if ($ADD==52) +{ + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
AGENTS NOT LOGGED OUT OF CAMPAIGN - Please go back and look at the data you entered\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + echo "
AGENT LOGOUT CONFIRMATION: $campaign_id\n"; + echo "

Click here to log all agents out of $campaign_id


\n"; + } + +$ADD='31'; # go to campaign modification below +} + +###################### +# ADD=53 confirmation before Emergency VDAC Jam Clear - deletes oldest LIVE vicidial_auto_call record +###################### + +if ($ADD==53) +{ + if (eregi('IN',$stage)) + {$group_id=$campaign_id;} + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
VDAC NOT CLEARED FOR CAMPAIGN - Please go back and look at the data you entered\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + echo "
VDAC CLEAR CONFIRMATION: $campaign_id\n"; + echo "

Click here to delete the oldest LIVE record in VDAC for $campaign_id


\n"; + } + +# go to campaign modification below +if (eregi('IN',$stage)) + {$ADD='3111';} +else + {$ADD='31';} +} + +###################### +# ADD=511 confirmation before deletion of list +###################### + +if ($ADD==511) +{ + echo ""; + + if ( (strlen($list_id) < 2) or ($LOGdelete_lists < 1) ) + { + echo "
LIST NOT DELETED - Please go back and look at the data you entered\n"; + echo "
List_id be at least 2 characters in length\n"; + } + else + { + echo "
LIST DELETION CONFIRMATION: $list_id\n"; + echo "

Click here to delete list and all of its leads $list_id


\n"; + } + +$ADD='311'; # go to campaign modification below +} + +###################### +# ADD=5111 confirmation before deletion of in-group +###################### + +if ($ADD==5111) +{ + echo ""; + + if ( (strlen($group_id) < 2) or ($LOGdelete_ingroups < 1) ) + { + echo "
IN-GROUP NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Group_id be at least 2 characters in length\n"; + } + else + { + echo "
IN-GROUP DELETION CONFIRMATION: $group_id\n"; + echo "

Click here to delete in-group $group_id


\n"; + } + +$ADD='3111'; # go to in-group modification below +} + +###################### +# ADD=51111 confirmation before deletion of remote agent record +###################### + +if ($ADD==51111) +{ + echo ""; + + if ( (strlen($remote_agent_id) < 1) or ($LOGdelete_remote_agents < 1) ) + { + echo "
REMOTE AGENT NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Remote_agent_id be at least 2 characters in length\n"; + } + else + { + echo "
REMOTE AGENT DELETION CONFIRMATION: $remote_agent_id\n"; + echo "

Click here to delete remote agent $remote_agent_id


\n"; + } + +$ADD='31111'; # go to remote agent modification below +} + +###################### +# ADD=511111 confirmation before deletion of user group record +###################### + +if ($ADD==511111) +{ + echo ""; + + if ( (strlen($user_group) < 2) or ($LOGdelete_user_groups < 1) ) + { + echo "
USER GROUP NOT DELETED - Please go back and look at the data you entered\n"; + echo "
User_group be at least 2 characters in length\n"; + } + else + { + echo "
USER GROUP DELETION CONFIRMATION: $user_group\n"; + echo "

Click here to delete user group $user_group


\n"; + } + +$ADD='311111'; # go to user group modification below +} + +###################### +# ADD=5111111 confirmation before deletion of script record +###################### + +if ($ADD==5111111) +{ + echo ""; + + if ( (strlen($script_id) < 2) or ($LOGdelete_scripts < 1) ) + { + echo "
SCRIPT NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Script_id must be at least 2 characters in length\n"; + } + else + { + echo "
SCRIPT DELETION CONFIRMATION: $script_id\n"; + echo "

Click here to delete script $script_id


\n"; + } + +$ADD='3111111'; # go to script modification below +} + +###################### +# ADD=51111111 confirmation before deletion of filter record +###################### + +if ($ADD==51111111) +{ + echo ""; + + if ( (strlen($lead_filter_id) < 2) or ($LOGdelete_filters < 1) ) + { + echo "
FILTER NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Filter ID must be at least 2 characters in length\n"; + } + else + { + echo "
FILTER DELETION CONFIRMATION: $lead_filter_id\n"; + echo "

Click here to delete filter $lead_filter_id


\n"; + } + +$ADD='31111111'; # go to filter modification below +} + +###################### +# ADD=511111111 confirmation before deletion of call time record +###################### + +if ($ADD==511111111) +{ + echo ""; + + if ( (strlen($call_time_id) < 2) or ($LOGdelete_call_times < 1) ) + { + echo "
CALL TIME NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Call Time ID must be at least 2 characters in length\n"; + } + else + { + echo "
CALL TIME DELETION CONFIRMATION: $call_time_id\n"; + echo "

Click here to delete call time $call_time_id


\n"; + } + +$ADD='311111111'; # go to call time modification below +} + +###################### +# ADD=5111111111 confirmation before deletion of state call time record +###################### + +if ($ADD==5111111111) +{ + echo ""; + + if ( (strlen($call_time_id) < 2) or ($LOGdelete_call_times < 1) ) + { + echo "
STATE CALL TIME NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Call Time ID must be at least 2 characters in length\n"; + } + else + { + echo "
STATE CALL TIME DELETION CONFIRMATION: $call_time_id\n"; + echo "

Click here to delete state call time $call_time_id


\n"; + } + +$ADD='3111111111'; # go to state call time modification below +} + + +###################### +# ADD=51111111111 confirmation before deletion of phone record +###################### + +if ($ADD==51111111111) +{ + echo ""; + + if ( (strlen($extension) < 2) or (strlen($server_ip) < 7) or ($LOGast_delete_phones < 1) ) + { + echo "
PHONE NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Extension be at least 2 characters in length\n"; + echo "
Server IP be at least 7 characters in length\n"; + } + else + { + echo "
PHONE DELETION CONFIRMATION: $extension - $server_ip\n"; + echo "

Click here to delete phone $extension - $server_ip


\n"; + } +$ADD='31111111111'; # go to phone modification below +} + + +###################### +# ADD=511111111111 confirmation before deletion of server record +###################### + +if ($ADD==511111111111) +{ + echo ""; + + if ( (strlen($server_id) < 2) or (strlen($server_ip) < 7) or ($LOGast_delete_phones < 1) ) + { + echo "
SERVER NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Server ID be at least 2 characters in length\n"; + echo "
Server IP be at least 7 characters in length\n"; + } + else + { + echo "
SERVER DELETION CONFIRMATION: $server_id - $server_ip\n"; + echo "

Click here to delete phone $server_id - $server_ip


\n"; + } +$ADD='311111111111'; # go to server modification below +} + + +###################### +# ADD=5111111111111 confirmation before deletion of conference record +###################### + +if ($ADD==5111111111111) +{ + echo ""; + + if ( (strlen($conf_exten) < 2) or (strlen($server_ip) < 7) or ($LOGast_delete_phones < 1) ) + { + echo "
CONFERENCE NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Conference must be at least 2 characters in length\n"; + echo "
Server IP be at least 7 characters in length\n"; + } + else + { + echo "
CONFERENCE DELETION CONFIRMATION: $conf_exten - $server_ip\n"; + echo "

Click here to delete phone $conf_exten - $server_ip


\n"; + } +$ADD='3111111111111'; # go to conference modification below +} + + +###################### +# ADD=51111111111111 confirmation before deletion of vicidial conference record +###################### + +if ($ADD==51111111111111) +{ + echo ""; + + if ( (strlen($conf_exten) < 2) or (strlen($server_ip) < 7) or ($LOGast_delete_phones < 1) ) + { + echo "
VICIDIAL CONFERENCE NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Conference must be at least 2 characters in length\n"; + echo "
Server IP be at least 7 characters in length\n"; + } + else + { + echo "
VICIDIAL CONFERENCE DELETION CONFIRMATION: $conf_exten - $server_ip\n"; + echo "

Click here to delete phone $conf_exten - $server_ip


\n"; + } +$ADD='31111111111111'; # go to vicidial conference modification below +} + + + +###################################################################################################### +###################################################################################################### +####### 6 series, delete records +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=6 delete user record +###################### + +if ($ADD==6) +{ + echo ""; + + if ( ( strlen($user) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_users < 1) ) + { + echo "
USER NOT DELETED - Please go back and look at the data you entered\n"; + echo "
User be at least 2 characters in length\n"; + } + else + { + $stmtA="DELETE from vicidial_users where user='$user' limit 1;"; + $rslt=mysql_query($stmtA, $link); + + $stmt="DELETE from vicidial_campaign_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_inbound_group_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING USER!!!!|$PHP_AUTH_USER|$ip|$user|$stmtA|$stmt|\n"); + fclose($fp); + } + echo "
USER DELETION COMPLETED: $user\n"; + echo "

\n"; + } + +$ADD='0'; # go to user list +} + +###################### +# ADD=61 delete campaign record +###################### + +if ($ADD==61) +{ + echo ""; + + if ( ( strlen($campaign_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_campaigns < 1) ) + { + echo "
CAMPAIGN NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_campaigns where campaign_id='$campaign_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaign_agents where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_live_agents where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaign_statuses where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaign_hotkeys where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_callbacks where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaign_stats where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_lead_recycle where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaign_server_stats where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_server_trunks where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_pause_codes where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaigns_list_mix where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOVING LIST HOPPER LEADS FROM OLD CAMPAIGN HOPPER ($campaign_id)\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!DELETING CAMPAIGN!|$PHP_AUTH_USER|$ip|campaign_id='$campaign_id'|\n"); + fclose($fp); + } + echo "
CAMPAIGN DELETION COMPLETED: $campaign_id\n"; + echo "

\n"; + } + +$ADD='10'; # go to campaigns list +} + +###################### +# ADD=62 Logout all agents from a campaign +###################### + +if ($ADD==62) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
AGENTS NOT LOGGED OUT OF CAMPAIGN - Please go back and look at the data you entered\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_live_agents where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!AGENT LOGOUT!!!!!!|$PHP_AUTH_USER|$ip|campaign_id='$campaign_id'|\n"); + fclose($fp); + } + echo "
AGENT LOGOUT COMPLETED: $campaign_id\n"; + echo "

\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD='31'; # go to campaign modification below +} + + +###################### +# ADD=63 Emergency VDAC Jam Clear +###################### + +if ($ADD==63) +{ + if ($LOGmodify_campaigns==1) + { + if (eregi('IN',$stage)) + {$group_id=$campaign_id;} + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
VDAC NOT CLEARED FOR CAMPAIGN - Please go back and look at the data you entered\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_auto_calls where status='LIVE' and campaign_id='$campaign_id' order by call_time limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|EMERGENCY VDAC CLEAR|$PHP_AUTH_USER|$ip|campaign_id='$campaign_id'|\n"); + fclose($fp); + } + echo "
LAST VDAC RECORD CLEARED FOR CAMPAIGN: $campaign_id\n"; + echo "

\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +# go to campaign modification below +if (eregi('IN',$stage)) + {$ADD='3111';} +else + {$ADD='31';} +} + + +###################### +# ADD=65 delete campaign lead recycle in the system +###################### + +if ($ADD==65) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
CAMPAIGN LEAD RECYCLE NOT DELETED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 6 characters in length\n"; + echo "
attempt delay must be at least 120 seconds\n"; + echo "
maximum attempts must be from 1 to 10\n"; + } + else + { + echo "
CAMPAIGN LEAD RECYCLE DELETED: $campaign_id - $status - $attempt_delay\n"; + + $stmt="DELETE FROM vicidial_lead_recycle where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE LEAD RECYCLE |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$SUB=25; +$ADD=31; # go to campaign modification form below +} + + +###################### +# ADD=66 delete auto alt dial status from the campaign +###################### + +if ($ADD==66) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and auto_alt_dial_statuses LIKE \"% $status %\";"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] < 1) + {echo "
AUTO ALT DIAL STATUS NOT DELETED - this auto alt dial status is not in this campaign\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
AUTO ALT DIAL STATUS NOT DELETED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 6 characters in length\n"; + } + else + { + echo "
AUTO ALT DIAL STATUS DELETED: $campaign_id - $status\n"; + + $stmt="SELECT auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + $auto_alt_dial_statuses = eregi_replace(" $status "," ",$row[0]); + $stmt="UPDATE vicidial_campaigns set auto_alt_dial_statuses='$auto_alt_dial_statuses' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE AUTALTDIALSTTUS|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$SUB=26; +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=67 delete agent pause code in the system +###################### + +if ($ADD==67) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($pause_code) < 1) ) + { + echo "
CAMPAIGN PAUSE CODE NOT DELETED - Please go back and look at the data you entered\n"; + echo "
pause code must be between 1 and 6 characters in length\n"; + } + else + { + echo "
CAMPAIGN PAUSE CODE DELETED: $campaign_id - $pause_code\n"; + + $stmt="DELETE FROM vicidial_pause_codes where campaign_id='$campaign_id' and pause_code='$pause_code';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE AGENT PAUSECODE|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$SUB=27; +$ADD=31; # go to campaign modification form below +} + + +###################### +# ADD=68 remove campaign dial status +###################### + +if ($ADD==68) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and dial_statuses LIKE \"% $status %\";"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] < 1) + {echo "
CAMPAIGN DIAL STATUS NOT REMOVED - this dial status is not selected for this campaign\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
CAMPAIGN DIAL STATUS NOT REMOVED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 6 characters in length\n"; + } + else + { + echo "
CAMPAIGN DIAL STATUS REMOVED: $campaign_id - $status\n"; + + $stmt="SELECT dial_statuses from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + $dial_statuses = eregi_replace(" $status "," ",$row[0]); + $stmt="UPDATE vicidial_campaigns set dial_statuses='$dial_statuses' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DIAL STATUS REMOVED |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +#$SUB=28; +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=611 delete list record and all leads within it +###################### + +if ($ADD==611) +{ + echo ""; + + if ( ( strlen($list_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_lists < 1) ) + { + echo "
LIST NOT DELETED - Please go back and look at the data you entered\n"; + echo "
List_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_lists where list_id='$list_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOVING LIST HOPPER LEADS FROM OLD CAMPAIGN HOPPER ($list_id)\n"; + $stmt="DELETE from vicidial_hopper where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOVING LIST LEADS FROM VICIDIAL_LIST TABLE\n"; + $stmt="DELETE from vicidial_list where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING LIST!!!!|$PHP_AUTH_USER|$ip|list_id='$list_id'|\n"); + fclose($fp); + } + echo "
LIST DELETION COMPLETED: $list_id\n"; + echo "

\n"; + } + +$ADD='100'; # go to lists list +} + +###################### +# ADD=6111 delete in-group record +###################### + +if ($ADD==6111) +{ + echo ""; + + if ( (strlen($group_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_ingroups < 1) ) + { + echo "
IN-GROUP NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Group_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_inbound_groups where group_id='$group_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_inbound_group_agents where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_live_inbound_agents where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING IN-GROUP!!|$PHP_AUTH_USER|$ip|group_id='$group_id'|\n"); + fclose($fp); + } + echo "
IN-GROUP DELETION COMPLETED: $group_id\n"; + echo "

\n"; + } + +$ADD='1000'; # go to in-group list +} + +###################### +# ADD=61111 delete remote agent record +###################### + +if ($ADD==61111) +{ + echo ""; + + if ( (strlen($remote_agent_id) < 1) or ($CoNfIrM != 'YES') or ($LOGdelete_remote_agents < 1) ) + { + echo "
REMOTE AGENT NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Remote_agent_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_remote_agents where remote_agent_id='$remote_agent_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING RMTAGENT!!|$PHP_AUTH_USER|$ip|remote_agent_id='$remote_agent_id'|\n"); + fclose($fp); + } + echo "
REMOTE AGENT DELETION COMPLETED: $remote_agent_id\n"; + echo "

\n"; + } + +$ADD='10000'; # go to remote agents list +} + +###################### +# ADD=611111 delete user group record +###################### + +if ($ADD==611111) +{ + echo ""; + + if ( (strlen($user_group) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_user_groups < 1) ) + { + echo "
USER GROUP NOT DELETED - Please go back and look at the data you entered\n"; + echo "
User_group be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_user_groups where user_group='$user_group' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING USRGROUP!!|$PHP_AUTH_USER|$ip|user_group='$user_group'|\n"); + fclose($fp); + } + echo "
USER GROUP DELETION COMPLETED: $user_group\n"; + echo "

\n"; + } + +$ADD='100000'; # go to user group list +} + +###################### +# ADD=6111111 delete script record +###################### + +if ($ADD==6111111) +{ + echo ""; + + if ( (strlen($script_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_scripts < 1) ) + { + echo "
SCRIPT NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Script_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_scripts where script_id='$script_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING SCRIPT!!!!|$PHP_AUTH_USER|$ip|script_id='$script_id'|\n"); + fclose($fp); + } + echo "
SCRIPT DELETION COMPLETED: $script_id\n"; + echo "

\n"; + } + +$ADD='1000000'; # go to script list +} + + +###################### +# ADD=61111111 delete filter record +###################### + +if ($ADD==61111111) +{ + echo ""; + + if ( (strlen($lead_filter_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_filters < 1) ) + { + echo "
FILTER NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Filter ID must be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_lead_filters where lead_filter_id='$lead_filter_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING FILTER!!!!|$PHP_AUTH_USER|$ip|lead_filter_id='$lead_filter_id'|\n"); + fclose($fp); + } + echo "
FILTER DELETION COMPLETED: $lead_filter_id\n"; + echo "

\n"; + } + +$ADD='10000000'; # go to filter list +} + + +###################### +# ADD=611111111 delete call times record +###################### + +if ($ADD==611111111) +{ + echo ""; + + if ( (strlen($call_time_id) < 2) or ($LOGdelete_call_times < 1) ) + { + echo "
CALL TIME NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Call Time ID must be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_call_times where call_time_id='$call_time_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING CALL TIME!|$PHP_AUTH_USER|$ip|call_time_id='$call_time_id'|\n"); + fclose($fp); + } + echo "
CALL TIME DELETION COMPLETED: $call_time_id\n"; + echo "

\n"; + } + +$ADD='100000000'; # go to call times list +} + + +###################### +# ADD=6111111111 delete state call times record +###################### + +if ($ADD==6111111111) +{ + echo ""; + + if ( (strlen($call_time_id) < 2) or ($LOGdelete_call_times < 1) ) + { + echo "
STATE CALL TIME NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Call Time ID must be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_state_call_times where state_call_time_id='$call_time_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT call_time_id,ct_state_call_times from vicidial_call_times where ct_state_call_times LIKE \"%|$call_time_id|%\" order by call_time_id;"; + $rslt=mysql_query($stmt, $link); + $sct_to_print = mysql_num_rows($rslt); + $sct_list=''; + + $o=0; + while ($sct_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $sct_ids[$o] = "$rowx[0]"; + $sct_states[$o] = "$rowx[1]"; + $o++; + } + $o=0; + + while ($sct_to_print > $o) { + $sct_states[$o] = eregi_replace("\|$call_time_id\|",'|',$sct_states[$o]); + $stmt="UPDATE vicidial_call_times set ct_state_call_times='$sct_states[$o]' where call_time_id='$sct_ids[$o]';"; + $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + echo "State Rule Removed: $sct_ids[$o]
\n"; + $o++; + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING CALL TIME!|$PHP_AUTH_USER|$ip|state_call_time_id='$call_time_id'|\n"); + fclose($fp); + } + echo "
STATE CALL TIME DELETION COMPLETED: $call_time_id\n"; + echo "

\n"; + } + +$ADD='1000000000'; # go to call times list +} + + +###################### +# ADD=61111111111 delete phone record +###################### + +if ($ADD==61111111111) +{ + echo ""; + + if ( (strlen($extension) < 2) or (strlen($server_ip) < 7) or ($CoNfIrM != 'YES') or ($LOGast_delete_phones < 1) ) + { + echo "
PHONE NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Extension be at least 2 characters in length\n"; + echo "
Server IP be at least 7 characters in length\n"; + } + else + { + $stmt="DELETE from phones where extension='$extension' and server_ip='$server_ip' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING PHONE!!!|$PHP_AUTH_USER|$ip|extension='$extension'|server_ip='$server_ip'|\n"); + fclose($fp); + } + echo "
PHONE DELETION COMPLETED: $extension - $server_ip\n"; + echo "

\n"; + } +$ADD='10000000000'; # go to phone list +} + + +###################### +# ADD=611111111111 delete server record +###################### + +if ($ADD==611111111111) +{ + echo ""; + + if ( (strlen($server_id) < 2) or (strlen($server_ip) < 7) or ($CoNfIrM != 'YES') or ($LOGast_delete_phones < 1) ) + { + echo "
SERVER NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Server ID be at least 2 characters in length\n"; + echo "
Server IP be at least 7 characters in length\n"; + } + else + { + $stmt="DELETE from servers where server_id='$server_id' and server_ip='$server_ip' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING SERVER!!|$PHP_AUTH_USER|$ip|server_id='$server_id'|server_ip='$server_ip'|\n"); + fclose($fp); + } + echo "
SERVER DELETION COMPLETED: $server_id - $server_ip\n"; + echo "

\n"; + } +$ADD='100000000000'; # go to server list +} + + +###################### +# ADD=621111111111 delete vicidial server trunk record in the system +###################### + +if ($ADD==621111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($server_ip) < 7) ) + { + echo "
VICIDIAL SERVER TRUNK RECORD NOT DELETED - Please go back and look at the data you entered\n"; + echo "
campaign must be between 3 and 8 characters in length\n"; + echo "
server_ip delay must be at least 7 characters\n"; + } + else + { + echo "
VICIDIAL SERVER TRUNK RECORD DELETED: $campaign_id - $server_ip\n"; + + $stmt="DELETE FROM vicidial_server_trunks where campaign_id='$campaign_id' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE SERVER TRUNK |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=311111111111; # go to server modification form below +} + + +###################### +# ADD=6111111111111 delete conference record +###################### + +if ($ADD==6111111111111) +{ + echo ""; + + if ( (strlen($conf_exten) < 2) or (strlen($server_ip) < 7) or ($CoNfIrM != 'YES') or ($LOGast_delete_phones < 1) ) + { + echo "
CONFERENCE NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Conference be at least 2 characters in length\n"; + echo "
Server IP be at least 7 characters in length\n"; + } + else + { + $stmt="DELETE from conferences where conf_exten='$conf_exten' and server_ip='$server_ip' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING CONF!!!!|$PHP_AUTH_USER|$ip|conf_exten='$conf_exten'|server_ip='$server_ip'|\n"); + fclose($fp); + } + echo "
CONFERENCE DELETION COMPLETED: $conf_exten - $server_ip\n"; + echo "

\n"; + } +$ADD='1000000000000'; # go to conference list +} + + +###################### +# ADD=61111111111111 delete vicidial conference record +###################### + +if ($ADD==61111111111111) +{ + echo ""; + + if ( (strlen($conf_exten) < 2) or (strlen($server_ip) < 7) or ($CoNfIrM != 'YES') or ($LOGast_delete_phones < 1) ) + { + echo "
VICIDIAL CONFERENCE NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Conference be at least 2 characters in length\n"; + echo "
Server IP be at least 7 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_conferences where conf_exten='$conf_exten' and server_ip='$server_ip' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING CONF!!!!|$PHP_AUTH_USER|$ip|conf_exten='$conf_exten'|server_ip='$server_ip'|\n"); + fclose($fp); + } + echo "
VICIDIAL CONFERENCE DELETION COMPLETED: $conf_exten - $server_ip\n"; + echo "

\n"; + } +$ADD='10000000000000'; # go to vicidial conference list +} + + + + + +###################################################################################################### +###################################################################################################### +####### 3 series, record modification forms +###################################################################################################### +###################################################################################################### + + + + +###################### +# ADD=3 modify user info in the system +###################### + +if ($ADD==3) +{ + if ($LOGmodify_users==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $user_level = $row[4]; + $user_group = $row[5]; + $phone_login = $row[6]; + $phone_pass = $row[7]; + $delete_users = $row[8]; + $delete_user_groups = $row[9]; + $delete_lists = $row[10]; + $delete_campaigns = $row[11]; + $delete_ingroups = $row[12]; + $delete_remote_agents = $row[13]; + $load_leads = $row[14]; + $campaign_detail = $row[15]; + $ast_admin_access = $row[16]; + $ast_delete_phones = $row[17]; + $delete_scripts = $row[18]; + $modify_leads = $row[19]; + $hotkeys_active = $row[20]; + $change_agent_campaign =$row[21]; + $agent_choose_ingroups =$row[22]; + $scheduled_callbacks = $row[24]; + $agentonly_callbacks = $row[25]; + $agentcall_manual = $row[26]; + $vicidial_recording = $row[27]; + $vicidial_transfers = $row[28]; + $delete_filters = $row[29]; + $alter_agent_interface_options =$row[30]; + $closer_default_blended = $row[31]; + $delete_call_times = $row[32]; + $modify_call_times = $row[33]; + $modify_users = $row[34]; + $modify_campaigns = $row[35]; + $modify_lists = $row[36]; + $modify_scripts = $row[37]; + $modify_filters = $row[38]; + $modify_ingroups = $row[39]; + $modify_usergroups = $row[40]; + $modify_remoteagents = $row[41]; + $modify_servers = $row[42]; + $view_reports = $row[43]; + $vicidial_recording_override = $row[44]; + $alter_custdata_override = $row[45]; + + if ( ($user_level >= $LOGuser_level) and ($LOGuser_level < 9) ) + { + echo "
You do not have permissions to modify this user: $row[1]\n"; + } + else + { + echo "
MODIFY A USERS RECORD: $row[1]\n"; + if ($LOGuser_level > 8) + {echo "\n";} + else + { + if ($LOGalter_agent_interface == "1") + {echo "\n";} + else + {echo "\n";} + } + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + if ( ($LOGuser_level > 8) or ($LOGalter_agent_interface == "1") ) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + if ($LOGuser_level > 8) + { + echo "\n"; + +#9BB9FB +#B9CBFD + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + echo "\n"; + echo "
User Number: $row[1]$NWB#vicidial_users-user$NWE
Password: $NWB#vicidial_users-pass$NWE
Full Name: $NWB#vicidial_users-full_name$NWE
User Level: $NWB#vicidial_users-user_level$NWE
User Group: $NWB#vicidial_users-user_group$NWE
Phone Login: $NWB#vicidial_users-phone_login$NWE
Phone Pass: $NWB#vicidial_users-phone_pass$NWE
AGENT INTERFACE OPTIONS:
Agent Choose Ingroups: $NWB#vicidial_users-agent_choose_ingroups$NWE
Hot Keys Active: $NWB#vicidial_users-hotkeys_active$NWE
Scheduled Callbacks: $NWB#vicidial_users-scheduled_callbacks$NWE
Agent-Only Callbacks: $NWB#vicidial_users-agentonly_callbacks$NWE
Agent Call Manual: $NWB#vicidial_users-agentcall_manual$NWE
Vicidial Recording: $NWB#vicidial_users-vicidial_recording$NWE
Vicidial Transfers: $NWB#vicidial_users-vicidial_transfers$NWE
Closer Default Blended: $NWB#vicidial_users-closer_default_blended$NWE
VICIDIAL Recording Override: $NWB#vicidial_users-vicidial_recording_override$NWE
Agent Alter Customer Data Override: $NWB#vicidial_users-alter_custdata_override$NWE
Campaign Ranks: $NWB#vicidial_users-campaign_ranks$NWE
\n"; + echo "\n"; + echo "$RANKcampaigns_list"; + echo "
\n"; + echo "
Inbound Groups: $NWB#vicidial_users-closer_campaigns$NWE
\n"; + echo "\n"; + echo "$RANKgroups_list"; + echo "
\n"; + echo "
ADMIN INTERFACE OPTIONS:
View Reports: $NWB#vicidial_users-view_reports$NWE
Alter Agent Interface Options: $NWB#vicidial_users-alter_agent_interface_options$NWE
Modify Users: $NWB#vicidial_users-modify_sections$NWE
Change Agent Campaign: $NWB#vicidial_users-change_agent_campaign$NWE
Delete Users: $NWB#vicidial_users-delete_users$NWE
Modify User Groups: $NWB#vicidial_users-modify_sections$NWE
Delete User Groups: $NWB#vicidial_users-delete_user_groups$NWE
Modify Lists: $NWB#vicidial_users-modify_sections$NWE
Delete Lists: $NWB#vicidial_users-delete_lists$NWE
Load Leads: $NWB#vicidial_users-load_leads$NWE
Modify Leads: $NWB#vicidial_users-modify_leads$NWE
Modify Campaigns: $NWB#vicidial_users-modify_sections$NWE
Campaign Detail: $NWB#vicidial_users-campaign_detail$NWE
Delete Campaigns: $NWB#vicidial_users-delete_campaigns$NWE
Modify In-Groups: $NWB#vicidial_users-modify_sections$NWE
Delete In-Groups: $NWB#vicidial_users-delete_ingroups$NWE
Modify Remote Agents: $NWB#vicidial_users-modify_sections$NWE
Delete Remote Agents: $NWB#vicidial_users-delete_remote_agents$NWE
Modify Scripts: $NWB#vicidial_users-modify_sections$NWE
Delete Scripts: $NWB#vicidial_users-delete_scripts$NWE
Modify Filters: $NWB#vicidial_users-modify_sections$NWE
Delete Filters: $NWB#vicidial_users-delete_filters$NWE
AGC Admin Access: $NWB#vicidial_users-ast_admin_access$NWE
AGC Delete Phones: $NWB#vicidial_users-ast_delete_phones$NWE
Modify Call Times: $NWB#vicidial_users-modify_call_times$NWE
Delete Call Times: $NWB#vicidial_users-delete_call_times$NWE
Modify Servers: $NWB#vicidial_users-modify_sections$NWE
\n"; + + if ($LOGdelete_users > 0) + { + echo "

DELETE THIS USER\n"; + } + echo "

Click here for user time sheet\n"; + echo "

Click here for user status\n"; + echo "

Click here for user stats\n"; + echo "

Click here for user CallBack Holds\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=31 modify campaign info in the system - Detail view +###################### + +if ( ($LOGcampaign_detail < 1) and ($ADD==31) ) {$ADD=34;} # send to Basic if not allowed + +if ( ($ADD==31) and ( (!eregi("$campaign_id",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) ) + {$ADD=30;} # send to not allowed screen if not in vicidial_user_groups allowed_campaigns list + +if ($ADD==31) +{ + if ($LOGmodify_campaigns==1) + { + if ($stage=='show_dialable') + { + $stmt="UPDATE vicidial_campaigns set display_dialable_count='Y' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + if ($stage=='hide_dialable') + { + $stmt="UPDATE vicidial_campaigns set display_dialable_count='N' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + + $stmt="SELECT * from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $campaign_name = $row[1]; + $dial_status_a = $row[3]; + $dial_status_b = $row[4]; + $dial_status_c = $row[5]; + $dial_status_d = $row[6]; + $dial_status_e = $row[7]; + $lead_order = $row[8]; + $allow_closers = $row[12]; + $hopper_level = $row[13]; + $auto_dial_level = $row[14]; + $next_agent_call = $row[15]; + $local_call_time = $row[16]; + $voicemail_ext = $row[17]; + $dial_timeout = $row[18]; + $dial_prefix = $row[19]; + $campaign_cid = $row[20]; + $campaign_vdad_exten = $row[21]; + $campaign_rec_exten = $row[22]; + $campaign_recording = $row[23]; + $campaign_rec_filename = $row[24]; + $script_id = $row[25]; + $get_call_launch = $row[26]; + $am_message_exten = $row[27]; + $amd_send_to_vmx = $row[28]; + $xferconf_a_dtmf = $row[29]; + $xferconf_a_number = $row[30]; + $xferconf_b_dtmf = $row[31]; + $xferconf_b_number = $row[32]; + $alt_number_dialing = $row[33]; + $scheduled_callbacks = $row[34]; + $lead_filter_id = $row[35]; + if ($lead_filter_id=='') {$lead_filter_id='NONE';} + $drop_call_seconds = $row[36]; + $safe_harbor_message = $row[37]; + $safe_harbor_exten = $row[38]; + $display_dialable_count = $row[39]; + $wrapup_seconds = $row[40]; + $wrapup_message = $row[41]; + # $closer_campaigns = $row[42]; + $use_internal_dnc = $row[43]; + $allcalls_delay = $row[44]; + $omit_phone_code = $row[45]; + $dial_method = $row[46]; + $available_only_ratio_tally = $row[47]; + $adaptive_dropped_percentage = $row[48]; + $adaptive_maximum_level = $row[49]; + $adaptive_latest_server_time = $row[50]; + $adaptive_intensity = $row[51]; + $adaptive_dl_diff_target = $row[52]; + $concurrent_transfers = $row[53]; + $auto_alt_dial = $row[54]; + $auto_alt_dial_statuses = $row[55]; + $agent_pause_codes_active = $row[56]; + $campaign_description = $row[57]; + $campaign_changedate = $row[58]; + $campaign_stats_refresh = $row[59]; + $campaign_logindate = $row[60]; + $dial_statuses = $row[61]; + $disable_alter_custdata = $row[62]; + $no_hopper_leads_logins = $row[63]; + $list_order_mix = $row[64]; + $campaign_allow_inbound = $row[65]; + $manual_dial_list_id = $row[66]; + $default_xfer_group = $row[67]; + + if (ereg("DISABLED",$list_order_mix)) + {$DEFlistDISABLE = ''; $DEFstatusDISABLED=0;} + else + {$DEFlistDISABLE = 'disabled'; $DEFstatusDISABLED=1;} + + $stmt="SELECT count(*) from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and status='ACTIVE'"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0] < 1) + { + $mixes_list="\n"; + $mixname_list["DISABLED"] = "DISABLED"; + } + else + { + ##### get list_mix listings for dynamic pulldown + $stmt="SELECT vcl_id,vcl_name from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and status='ACTIVE' limit 1"; + $rslt=mysql_query($stmt, $link); + $mixes_to_print = mysql_num_rows($rslt); + $mixes_list="\n"; + + $o=0; + while ($mixes_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $mixes_list .= "\n"; + $mixname_list["ACTIVE"] = "$rowx[0] - $rowx[1]"; + $o++; + } + } + + ##### get status listings for dynamic pulldown + $stmt="SELECT * from vicidial_statuses order by status"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $statuses_list=''; + + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $statuses_list .= "\n"; + $statname_list["$rowx[0]"] = "$rowx[1]"; + $LRstatuses_list .= "\n"; + if (eregi("Y",$rowx[2])) + {$HKstatuses_list .= "\n";} + $o++; + } + + $stmt="SELECT * from vicidial_campaign_statuses where campaign_id='$campaign_id' order by status"; + $rslt=mysql_query($stmt, $link); + $Cstatuses_to_print = mysql_num_rows($rslt); + + $o=0; + while ($Cstatuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $statuses_list .= "\n"; + $statname_list["$rowx[0]"] = "$rowx[1]"; + $LRstatuses_list .= "\n"; + if (eregi("Y",$rowx[2])) + {$HKstatuses_list .= "\n";} + $o++; + } + + $dial_statuses = preg_replace("/ -$/","",$dial_statuses); + $Dstatuses = explode(" ", $dial_statuses); + $Ds_to_print = (count($Dstatuses) -1); + + ##### get in-groups listings for dynamic pulldown list menu + $stmt="SELECT group_id,group_name from vicidial_inbound_groups $xfer_groupsSQL order by group_id"; + $rslt=mysql_query($stmt, $link); + $Xgroups_to_print = mysql_num_rows($rslt); + $Xgroups_menu=''; + $Xgroups_selected=0; + $o=0; + while ($Xgroups_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $Xgroups_menu .= "\n"; + $o++; + } + if ($Xgroups_selected < 1) + {$Xgroups_menu .= "\n";} + else + {$Xgroups_menu .= "\n";} + + + if ($SUB<1) {$camp_detail_color=$subcamp_color;} + else {$camp_detail_color=$campaigns_color;} + if ($SUB==22) {$camp_statuses_color=$subcamp_color;} + else {$camp_statuses_color=$campaigns_color;} + if ($SUB==23) {$camp_hotkeys_color=$subcamp_color;} + else {$camp_hotkeys_color=$campaigns_color;} + if ($SUB==25) {$camp_recycle_color=$subcamp_color;} + else {$camp_recycle_color=$campaigns_color;} + if ($SUB==26) {$camp_autoalt_color=$subcamp_color;} + else {$camp_autoalt_color=$campaigns_color;} + if ($SUB==27) {$camp_pause_color=$subcamp_color;} + else {$camp_pause_color=$campaigns_color;} + if ($SUB==29) {$camp_listmix_color=$subcamp_color;} + else {$camp_listmix_color=$campaigns_color;} + echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "
$row[0]: Basic Detail StatusesHotKeysLead RecyclingAuto Alt DialPause CodesList Mix Real-Time
\n"; + + echo "
\n"; + echo ""; + + echo "
\n"; + + if ($SUB < 1) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + $o=0; + while ($Ds_to_print > $o) + { + $o++; + $Dstatus = $Dstatuses[$o]; + + echo "\n"; + } + else + { + echo "$Dstatus - $statname_list[$Dstatus]         \n"; + echo "REMOVE\n"; + } + } + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + + + echo "\n"; + + echo "\n"; + + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + if ($campaign_allow_inbound == 'Y') + { + echo "\n"; + } + + echo "\n"; + + if ($allow_closers == 'Y') + { + echo "\n"; + } + + echo "\n"; + echo "
Campaign ID: $row[0]$NWB#vicidial_campaigns-campaign_id$NWE
Campaign Name: $NWB#vicidial_campaigns-campaign_name$NWE
Campaign Description: $NWB#vicidial_campaigns-campaign_description$NWE
Campaign Change Date: $campaign_changedate   $NWB#vicidial_campaigns-campaign_changedate$NWE
Campaign Login Date: $campaign_logindate   $NWB#vicidial_campaigns-campaign_logindate$NWE
Active: $NWB#vicidial_campaigns-active$NWE
Park Extension: - Filename: $NWB#vicidial_campaigns-park_ext$NWE
Web Form: $NWB#vicidial_campaigns-web_form_address$NWE
Allow Closers: $NWB#vicidial_campaigns-allow_closers$NWE
Allow Inbound and Blended: $NWB#vicidial_campaigns-campaign_allow_inbound$NWE
Dial Status $o: \n"; + + if ($DEFstatusDISABLED > 0) + { + echo "$Dstatus - $statname_list[$Dstatus]         \n"; + echo "REMOVE
Add A Dial Status:   \n"; + echo "     $NWB#vicidial_campaigns-dial_status$NWE
List Order: $NWB#vicidial_campaigns-lead_order$NWE
List Mix: $NWB#vicidial_campaigns-list_order_mix$NWE
Lead Filter: $NWB#vicidial_campaigns-lead_filter_id$NWE
Hopper Level: $NWB#vicidial_campaigns-hopper_level$NWE
Force Reset of Hopper: $NWB#vicidial_campaigns-force_reset_hopper$NWE
Dial Method: $NWB#vicidial_campaigns-dial_method$NWE
Auto Dial Level: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE       ADAPT OVERRIDE
Available Only Tally: $NWB#vicidial_campaigns-available_only_ratio_tally$NWE
Drop Percentage Limit: % $NWB#vicidial_campaigns-adaptive_dropped_percentage$NWE
Maximum Adapt Dial Level: number only $NWB#vicidial_campaigns-adaptive_maximum_level$NWE
Latest Server Time: 4 digits only $NWB#vicidial_campaigns-adaptive_latest_server_time$NWE
Adapt Intensity Modifier: $NWB#vicidial_campaigns-adaptive_intensity$NWE
Dial Level Difference Target: $NWB#vicidial_campaigns-adaptive_dl_diff_target$NWE
Concurrent Transfers: $NWB#vicidial_campaigns-concurrent_transfers$NWE
Auto Alt-Number Dialing: $NWB#vicidial_campaigns-auto_alt_dial$NWE
Next Agent Call: $NWB#vicidial_campaigns-next_agent_call$NWE
Local Call Time: $NWB#vicidial_campaigns-local_call_time$NWE
Dial Timeout: in seconds$NWB#vicidial_campaigns-dial_timeout$NWE
Dial Prefix: for 91NXXNXXXXXX value would be 9, for no dial prefix use X$NWB#vicidial_campaigns-dial_prefix$NWE
Omit Phone Code: $NWB#vicidial_campaigns-omit_phone_code$NWE
Campaign CallerID: $NWB#vicidial_campaigns-campaign_cid$NWE
Campaign VDAD exten: $NWB#vicidial_campaigns-campaign_vdad_exten$NWE
Campaign Rec exten: $NWB#vicidial_campaigns-campaign_rec_exten$NWE
Campaign Recording: $NWB#vicidial_campaigns-campaign_recording$NWE
Campaign Rec Filename: $NWB#vicidial_campaigns-campaign_rec_filename$NWE
Recording Delay: in seconds$NWB#vicidial_campaigns-allcalls_delay$NWE
Script: $NWB#vicidial_campaigns-campaign_script$NWE
Get Call Launch: $NWB#vicidial_campaigns-get_call_launch$NWE
Answering Machine Message: $NWB#vicidial_campaigns-am_message_exten$NWE
AMD Send to VM exten: $NWB#vicidial_campaigns-amd_send_to_vmx$NWE
Transfer-Conf DTMF 1: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
Transfer-Conf Number 1: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
Transfer-Conf DTMF 2: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
Transfer-Conf Number 2: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
Alt Number Dialing: $NWB#vicidial_campaigns-alt_number_dialing$NWE
Scheduled Callbacks: $NWB#vicidial_campaigns-scheduled_callbacks$NWE
Drop Call Seconds: $NWB#vicidial_campaigns-drop_call_seconds$NWE
Voicemail: $NWB#vicidial_campaigns-voicemail_ext$NWE
Use Safe Harbor Message: $NWB#vicidial_campaigns-safe_harbor_message$NWE
Safe Harbor Exten: $NWB#vicidial_campaigns-safe_harbor_exten$NWE
Wrap Up Seconds: $NWB#vicidial_campaigns-wrapup_seconds$NWE
Wrap Up Message: $NWB#vicidial_campaigns-wrapup_message$NWE
Use Internal DNC List: $NWB#vicidial_campaigns-use_internal_dnc$NWE
Agent Pause Codes Active: $NWB#vicidial_campaigns-agent_pause_codes_active$NWE
Campaign Stats Refresh: $NWB#vicidial_campaigns-campaign_stats_refresh$NWE
Disable Alter Customer Data: $NWB#vicidial_campaigns-disable_alter_custdata$NWE
Allow No-Hopper-Leads Logins: $NWB#vicidial_campaigns-no_hopper_leads_logins$NWE
Manual Dial List ID: $NWB#vicidial_campaigns-manual_dial_list_id$NWE
Allowed Inbound Groups:
"; + echo " $NWB#vicidial_campaigns-closer_campaigns$NWE
\n"; + echo "$groups_list"; + echo "
Default Transfer Group: $NWB#vicidial_campaigns-default_xfer_group$NWE
Allowed Transfer Groups:
"; + echo " $NWB#vicidial_campaigns-xfer_groups$NWE
\n"; + echo "$XFERgroups_list"; + echo "
\n"; + + echo "
\n"; + echo "
LISTS WITHIN THIS CAMPAIGN:   $NWB#vicidial_campaign_lists$NWE
\n"; + echo "\n"; + echo "\n"; + + $active_lists = 0; + $inactive_lists = 0; + $stmt="SELECT list_id,active,list_name from vicidial_lists where campaign_id='$campaign_id'"; + $rslt=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rslt); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $o++; + if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_lists++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + echo "
LIST IDLIST NAMEACTIVE
$rowx[0]$rowx[2]$rowx[1]

\n"; + echo "
\n"; + + $filterSQL = $filtersql_list[$lead_filter_id]; + $filterSQL = eregi_replace("^and|and$|^or|or$","",$filterSQL); + if (strlen($filterSQL)>4) + {$fSQL = "and $filterSQL";} + else + {$fSQL = '';} + + $camp_lists = eregi_replace(".$","",$camp_lists); + echo "This campaign has $active_lists active lists and $inactive_lists inactive lists

\n"; + + if ($display_dialable_count == 'Y') + { + ### call function to calculate and print dialable leads + dialable_leads($DB,$link,$local_call_time,$dial_statuses,$camp_lists,$fSQL); + echo " - HIDE

"; + } + else + { + echo "Popup Dialable Leads Count"; + echo " - SHOW

"; + } + + + + + + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id='$campaign_id' and status IN('READY')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $hopper_leads = "$rowx[0]"; + + echo "This campaign has $hopper_leads leads in the dial hopper

\n"; + echo "Click here to see what leads are in the hopper right now

\n"; + echo "Click here to see all CallBack Holds in this campaign

\n"; + echo "Click here to see a VDAD report for this campaign

\n"; + echo "
\n"; + } + + + + if ($SUB==22) + { + + ##### get status category listings for dynamic pulldown + $stmt="SELECT vsc_id,vsc_name from vicidial_status_categories order by vsc_id desc"; + $rslt=mysql_query($stmt, $link); + $cats_to_print = mysql_num_rows($rslt); + $cats_list=""; + + $o=0; + while ($cats_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $cats_list .= "\n"; + $catsname_list["$rowx[0]"] = substr($rowx[1],0,20); + $o++; + } + + + echo "
\n"; + echo "
CUSTOM STATUSES WITHIN THIS CAMPAIGN:   $NWB#vicidial_campaign_statuses$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_campaign_statuses where campaign_id='$campaign_id'"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $AScategory = $rowx[5]; + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
STATUSDESCRIPTIONSELECTABLEHUMAN ANSWERDELETE
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "$rowx[0]
\n"; + echo "\n"; + echo "         \n"; + echo "   \n"; + echo "DELETE\n"; + echo "
\n"; + + echo "
ADD NEW CUSTOM CAMPAIGN STATUS
\n"; + echo "\n"; + echo "\n"; + echo "Status:   \n"; + echo "Description:   \n"; + echo "Selectable:   \n"; + echo "Human Answer:   \n"; + echo "Category: \n"; + echo "  
\n"; + echo "
\n"; + + echo "

\n"; + } + + + if ($SUB==23) + { + echo "
CUSTOM HOT KEYS WITHIN THIS CAMPAIGN:   $NWB#vicidial_campaign_hotkeys$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_campaign_hotkeys where campaign_id='$campaign_id' order by hotkey"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $o=0; + while ($statuses_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + + echo "
HOT KEYSTATUSDESCRIPTIONDELETE
$rowx[1]$rowx[0]$rowx[2]DELETE
\n"; + + echo "
ADD NEW CUSTOM CAMPAIGN HOT KEY
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Hotkey:   \n"; + echo "Status:   \n"; + echo "
\n"; + echo "

\n"; + } + + + if ($SUB==25) + { + echo "

LEAD RECYCLING WITHIN THIS CAMPAIGN:   $NWB#vicidial_lead_recycle$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_lead_recycle where campaign_id='$campaign_id' order by status"; + $rslt=mysql_query($stmt, $link); + $recycle_to_print = mysql_num_rows($rslt); + $o=0; + while ($recycle_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
STATUSATTEMPT DELAYATTEMPT MAXIMUMACTIVE DELETE
$rowx[2]
\n"; + echo "\n"; + echo "\n"; + echo "
DELETE
\n"; + + echo "
ADD NEW CAMPAIGN LEAD RECYCLE
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Status:   \n"; + echo "Attempt Delay: \n"; + echo "Attempt Maximum: \n"; + echo "
\n"; + + echo "

\n"; + } + + + if ($SUB==26) + { + echo "

AUTO ALT NUMBER DIALING FOR THIS CAMPAIGN:   $NWB#vicidial_auto_alt_dial_statuses$NWE
\n"; + echo "\n"; + echo "\n"; + + $auto_alt_dial_statuses = preg_replace("/ -$/","",$auto_alt_dial_statuses); + $AADstatuses = explode(" ", $auto_alt_dial_statuses); + $AADs_to_print = (count($AADstatuses) -1); + + $o=0; + while ($AADs_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + $o++; + + echo "\n"; + echo "\n"; + } + + echo "
STATUSESDELETE
$AADstatuses[$o]DELETE
\n"; + + echo "
ADD NEW AUTO ALT NUMBER DIALING STATUS
\n"; + echo "\n"; + echo "\n"; + echo "Status:   \n"; + echo "
\n"; + + echo "

\n"; + } + + + if ($SUB==27) + { + echo "

AGENT PAUSE CODES FOR THIS CAMPAIGN:   $NWB#vicidial_pause_codes$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_pause_codes where campaign_id='$campaign_id' order by pause_code"; + $rslt=mysql_query($stmt, $link); + $pause_codes_to_print = mysql_num_rows($rslt); + $o=0; + while ($pause_codes_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
PAUSE CODESBILLABLEMODIFYDELETE
$rowx[0]\n"; + echo "\n"; + echo "\n"; + echo "  \n"; + echo "
DELETE
\n"; + + echo "
ADD NEW AGENT PAUSE CODE
\n"; + echo "\n"; + echo "\n"; + echo "Pause Code: \n"; + echo "Pause Code Name: \n"; + echo "   Billable: \n"; + echo "
\n"; + + echo "

\n"; + } + + + if ($SUB < 1) + { + echo "

\n"; + echo "LOG ALL AGENTS OUT OF THIS CAMPAIGN

\n"; + echo "EMERGENCY VDAC CLEAR FOR THIS CAMPAIGN

\n"; + + if ($LOGdelete_campaigns > 0) + { + echo "

DELETE THIS CAMPAIGN\n"; + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=34 modify campaign info in the system - Basic View +###################### + +if ( ($ADD==34) and ( (!eregi("$campaign_id",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) ) + {$ADD=30;} # send to not allowed screen if not in vicidial_user_groups allowed_campaigns list + +if ($ADD==34) +{ + if ($LOGmodify_campaigns==1) + { + if ($stage=='show_dialable') + { + $stmt="UPDATE vicidial_campaigns set display_dialable_count='Y' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + if ($stage=='hide_dialable') + { + $stmt="UPDATE vicidial_campaigns set display_dialable_count='N' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + + $stmt="SELECT * from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $dial_status_a = $row[3]; + $dial_status_b = $row[4]; + $dial_status_c = $row[5]; + $dial_status_d = $row[6]; + $dial_status_e = $row[7]; + $lead_order = $row[8]; + $hopper_level = $row[13]; + $auto_dial_level = $row[14]; + $next_agent_call = $row[15]; + $local_call_time = $row[16]; + $voicemail_ext = $row[17]; + $dial_timeout = $row[18]; + $dial_prefix = $row[19]; + $campaign_cid = $row[20]; + $campaign_vdad_exten = $row[21]; + $script_id = $row[25]; + $get_call_launch = $row[26]; + $lead_filter_id = $row[35]; + if ($lead_filter_id=='') {$lead_filter_id='NONE';} + $display_dialable_count = $row[39]; + $dial_method = $row[46]; + $adaptive_intensity = $row[51]; + $campaign_description = $row[57]; + $campaign_changedate = $row[58]; + $campaign_stats_refresh = $row[59]; + $campaign_logindate = $row[60]; + $dial_statuses = $row[61]; + $list_order_mix = $row[64]; + $default_xfer_group = $row[67]; + $campaign_allow_inbound = $row[65]; + $default_xfer_group = $row[67]; + + if (ereg("DISABLED",$list_order_mix)) + {$DEFlistDISABLE = ''; $DEFstatusDISABLED=0;} + else + {$DEFlistDISABLE = 'disabled'; $DEFstatusDISABLED=1;} + + $stmt="SELECT * from vicidial_statuses order by status"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $statuses_list=''; + + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $statuses_list .= "\n"; + $statname_list["$rowx[0]"] = "$rowx[1]"; + $LRstatuses_list .= "\n"; + if (eregi("Y",$rowx[2])) + {$HKstatuses_list .= "\n";} + $o++; + } + + $stmt="SELECT * from vicidial_campaign_statuses where campaign_id='$campaign_id' order by status"; + $rslt=mysql_query($stmt, $link); + $Cstatuses_to_print = mysql_num_rows($rslt); + + $o=0; + while ($Cstatuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $statuses_list .= "\n"; + $statname_list["$rowx[0]"] = "$rowx[1]"; + $LRstatuses_list .= "\n"; + if (eregi("Y",$rowx[2])) + {$HKstatuses_list .= "\n";} + $o++; + } + + $dial_statuses = preg_replace("/ -$/","",$dial_statuses); + $Dstatuses = explode(" ", $dial_statuses); + $Ds_to_print = (count($Dstatuses) -1); + + $stmt="SELECT count(*) from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and status='ACTIVE'"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0] < 1) + { + $mixes_list="\n"; + $mixname_list["DISABLED"] = "DISABLED"; + } + else + { + ##### get list_mix listings for dynamic pulldown + $stmt="SELECT vcl_id,vcl_name from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and status='ACTIVE' limit 1"; + $rslt=mysql_query($stmt, $link); + $mixes_to_print = mysql_num_rows($rslt); + $mixes_list="\n"; + + $o=0; + while ($mixes_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $mixes_list .= "\n"; + $mixname_list["ACTIVE"] = "$rowx[0] - $rowx[1]"; + $o++; + } + } + + if ($SUB<1) {$camp_detail_color=$subcamp_color;} + else {$camp_detail_color=$campaigns_color;} + if ($SUB==22) {$camp_statuses_color=$subcamp_color;} + else {$camp_statuses_color=$campaigns_color;} + if ($SUB==23) {$camp_hotkeys_color=$subcamp_color;} + else {$camp_hotkeys_color=$campaigns_color;} + if ($SUB==25) {$camp_recycle_color=$subcamp_color;} + else {$camp_recycle_color=$campaigns_color;} + if ($SUB==26) {$camp_autoalt_color=$subcamp_color;} + else {$camp_autoalt_color=$campaigns_color;} + if ($SUB==27) {$camp_pause_color=$subcamp_color;} + else {$camp_pause_color=$campaigns_color;} + if ($SUB==29) {$camp_listmix_color=$subcamp_color;} + else {$camp_listmix_color=$campaigns_color;} + echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "
$row[0]: Basic View Detail View List Mix Real-Time Screen  
\n"; + + if ($SUB < 1) + { + echo "
\n"; + echo ""; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + $o=0; + while ($Ds_to_print > $o) + { + $o++; + $Dstatus = $Dstatuses[$o]; + + echo "\n"; + } + else + { + echo "$Dstatus - $statname_list[$Dstatus]         \n"; + echo "REMOVE\n"; + } + } + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + echo "
Campaign ID: $row[0]$NWB#vicidial_campaigns-campaign_id$NWE
Campaign Name: $NWB#vicidial_campaigns-campaign_name$NWE
Campaign Description: $row[57]$NWB#vicidial_campaigns-campaign_description$NWE
Campaign Change Date: $campaign_changedate   $NWB#vicidial_campaigns-campaign_changedate$NWE
Campaign Login Date: $campaign_logindate   $NWB#vicidial_campaigns-campaign_logindate$NWE
Active: $NWB#vicidial_campaigns-active$NWE
Park Extension: $row[9] - $row[10]$NWB#vicidial_campaigns-park_ext$NWE
Web Form: $row[11]$NWB#vicidial_campaigns-web_form_address$NWE
Allow Closers: $row[12] $NWB#vicidial_campaigns-allow_closers$NWE
Default Transfer Group: $default_xfer_group $NWB#vicidial_campaigns-default_xfer_group$NWE
Allow Inbound and Blended: $campaign_allow_inbound $NWB#vicidial_campaigns-campaign_allow_inbound$NWE
Dial Status $o: \n"; + if ($DEFstatusDISABLED > 0) + { + echo "$Dstatus - $statname_list[$Dstatus]         \n"; + echo "REMOVE
Add A Dial Status:   \n"; + echo "     $NWB#vicidial_campaigns-dial_status$NWE
List Order: $NWB#vicidial_campaigns-lead_order$NWE
List Mix: $NWB#vicidial_campaigns-list_order_mix$NWE
Lead Filter: $NWB#vicidial_campaigns-lead_filter_id$NWE
Hopper Level: $NWB#vicidial_campaigns-hopper_level$NWE
Force Reset of Hopper: $NWB#vicidial_campaigns-force_reset_hopper$NWE
Dial Method: $NWB#vicidial_campaigns-dial_method$NWE
Auto Dial Level: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE
Adapt Intensity Modifier: $NWB#vicidial_campaigns-adaptive_intensity$NWE
Script: $script_id
Get Call Launch: $get_call_launch
\n"; + + echo "
\n"; + echo "
LISTS WITHIN THIS CAMPAIGN:   $NWB#vicidial_campaign_lists$NWE
\n"; + echo "\n"; + echo "\n"; + + $active_lists = 0; + $inactive_lists = 0; + $stmt="SELECT list_id,active,list_name from vicidial_lists where campaign_id='$campaign_id'"; + $rslt=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rslt); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_lists++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + + echo "
LIST IDLIST NAMEACTIVE
$rowx[0]$rowx[2]$rowx[1]

\n"; + echo "
\n"; + + $filterSQL = $filtersql_list[$lead_filter_id]; + $filterSQL = eregi_replace("^and|and$|^or|or$","",$filterSQL); + if (strlen($filterSQL)>4) + {$fSQL = "and $filterSQL";} + else + {$fSQL = '';} + + $camp_lists = eregi_replace(".$","",$camp_lists); + echo "This campaign has $active_lists active lists and $inactive_lists inactive lists

\n"; + + + if ($display_dialable_count == 'Y') + { + ### call function to calculate and print dialable leads + dialable_leads($DB,$link,$local_call_time,$dial_statuses,$camp_lists,$fSQL); + echo " - HIDE

"; + } + else + { + echo "Popup Dialable Leads Count"; + echo " - SHOW

"; + } + + + + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id='$campaign_id' and status IN('READY')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $hopper_leads = "$rowx[0]"; + + echo "This campaign has $hopper_leads leads in the dial hopper

\n"; + echo "Click here to see what leads are in the hopper right now

\n"; + echo "Click here to see all CallBack Holds in this campaign

\n"; + echo "Click here to see a VDAD report for this campaign

\n"; + echo "
\n"; + + echo "
\n"; + + ### list of agent rank or skill-level for this campaign + echo "
\n"; + echo "
AGENT RANKS FOR THIS CAMPAIGN:
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT user,campaign_rank,calls_today from vicidial_campaign_agents where campaign_id='$campaign_id'"; + $rsltx=mysql_query($stmt, $link); + $users_to_print = mysql_num_rows($rsltx); + + $o=0; + while ($users_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + + echo "
USER     RANK     CALLS TODAY
$rowx[0]$rowx[1]$rowx[2]

\n"; + + + echo "LOG ALL AGENTS OUT OF THIS CAMPAIGN

\n"; + + + if ($LOGdelete_campaigns > 0) + { + echo "

DELETE THIS CAMPAIGN\n"; + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=31 or 34 and SUB=29 for list mixes +###################### +if ( ( ($ADD==34) or ($ADD==31) ) and ( (!eregi("$campaign_id",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) ) + {$ADD=30;} # send to not allowed screen if not in vicidial_user_groups allowed_campaigns list + +if ( ($ADD==34) or ($ADD==31) ) +{ + if ($LOGmodify_campaigns==1) + { + if ($SUB==29) + { + ##### get list_id listings for dynamic pulldown + $stmt="SELECT list_id,list_name from vicidial_lists where campaign_id='$campaign_id' order by list_id"; + $rslt=mysql_query($stmt, $link); + $mixlists_to_print = mysql_num_rows($rslt); + $mixlists_list=""; + + $o=0; + while ($mixlists_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $mixlists_list .= "\n"; + $mixlistsname_list["$rowx[0]"] = "$rowx[1]"; + $o++; + } + + + echo "

LIST MIXES FOR THIS CAMPAIGN:   $NWB#vicidial_campaigns-list_order_mix$NWE
\n"; + + echo "

Experimental Feature in development!!! NON-FUNCTIONAL
\n"; + + + $stmt="SELECT * from vicidial_campaigns_list_mix where campaign_id='$campaign_id' order by status, vcl_id"; + $rslt=mysql_query($stmt, $link); + $listmixes = mysql_num_rows($rslt); + $o=0; + while ($listmixes > $o) + { + $rowx=mysql_fetch_row($rslt); + $vcl_id=$rowx[0]; + $o++; + + if ($o < 2) + {$tablecolor='bgcolor="#99FF99"'; $bgcolor='bgcolor="#CCFFCC"';} + else + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$tablecolor='bgcolor="#B9CBFD"'; $bgcolor='bgcolor="#9BB9FB"';} + else + {$tablecolor='bgcolor="#9BB9FB"'; $bgcolor='bgcolor="#B9CBFD"';} + } + echo "
\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + } + else + {echo "$rowx[5]\n";} + echo "\n"; + echo "\n"; + +# list_id|order|percent|statuses|:list_id|order|percent|statuses|:... +# 101|1|40| A B NA -|:102|2|25| NEW -|:103|3|30| DROP CALLBK -|:101|4|5| DROP -| +# INSERT INTO vicidial_campaigns_list_mix values('TESTMIX','TESTCAMP List Mix','TESTCAMP','101|1|40| A B NA -|:102|2|25| NEW -|:103|3|30| DROP CALLBK -|:101|4|5| DROP -|','IN_ORDER','ACTIVE'); +# INSERT INTO vicidial_campaigns_list_mix values('TESTMIX2','TESTCAMP List Mix2','TESTCAMP','101|1|20| A B -|:102|2|45| NEW -|:103|3|30| DROP CALLBK -|:101|4|5| DROP -|','IN_ORDER','ACTIVE'); +# INSERT INTO vicidial_campaigns_list_mix values('TESTMIX3','TESTCAMP List Mix3','TESTCAMP','101|1|30| A NA -|:102|2|35| NEW -|:103|3|30| DROP CALLBK -|:101|4|5| DROP -|','IN_ORDER','ACTIVE'); + + $MIXentries = $MT; + $MIXentries = explode(":", $rowx[3]); + $Ms_to_print = (count($MIXentries) - 0); + $q=0; + while ($Ms_to_print > $q) + { + $MIXdetails = explode('|', $MIXentries[$q]); + $MIXdetailsLIST = $MIXdetails[0]; + + $dial_statuses = preg_replace("/ -$/","",$dial_statuses); + $Dstatuses = explode(" ", $dial_statuses); + $Ds_to_print = (count($Dstatuses) - 0); + $Dsql = ''; + $r=0; + while ($Ds_to_print > $r) + { + $r++; + $Dsql .= "'$Dstatuses[$r]',"; + } + $Dsql = preg_replace("/,$/","",$Dsql); + + echo "\n"; + + echo "\n"; + + echo "\n"; + + + echo "\n"; + echo "\n"; + + + echo "\n"; + + + $q++; + + } + + + + + echo "\n"; + + echo "\n"; + + + echo "\n"; + + if ($q > 9) {$AE_disabled = 'DISABLED';} + else {$AE_disabled = '';} + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "$vcl_id:\n"; + echo "\n"; + echo "     DELETE LIST MIX
Status: \n"; + if ($rowx[5]=='INACTIVE') + { + echo "$rowx[5]\n"; + echo "SET TO ACTIVEMethod:\n"; + echo "
LIST IDPRIORITY% MIXSTATUSES
\n"; + echo "\n"; + echo "List: $MIXdetailsLIST   REMOVE\n"; + + + + echo " \n"; + echo "ADD   \n"; + echo "REMOVE\n"; + echo "
\n"; + echo "Difference %: \n"; + echo "   \n"; + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "List:
\n"; + echo "
\n"; + } + + + echo "

ADD NEW LIST MIX
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Mix ID: Mix Name: Mix Method: "; + echo "
List: Dial Status:  
\n"; + + echo "
\n"; + + } + } +} + + +###################### +# ADD=30 campaign not allowed +###################### + +if ($ADD==30) +{ +echo "
\n"; + echo ""; +echo "You do not have permission to view campaign $campaign_id\n"; +} + + +###################### +# ADD=32 display all campaign statuses +###################### +if ($ADD==32) +{ +echo "
\n"; + echo ""; + +echo "
CUSTOM CAMPAIGN STATUSES LISTINGS:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNNAMESTATUSESMODIFY
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT status from vicidial_campaign_statuses where campaign_id='$campaigns_id_list[$o]' order by status"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if ($p<1) + {echo "NONE";} + echo "MODIFY STATUSES
\n"; +} + + +###################### +# ADD=33 display all campaign hotkeys +###################### +if ($ADD==33) +{ +echo "
\n"; + echo ""; + +echo "
CAMPAIGN HOTKEYS LISTINGS:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNNAMEHOTKEYSMODIFY
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT status from vicidial_campaign_hotkeys where campaign_id='$campaigns_id_list[$o]' order by status"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if ($p<1) + {echo "NONE";} + echo "MODIFY HOTKEYS
\n"; +} + + +###################### +# ADD=35 display all campaign lead recycle entries +###################### +if ($ADD==35) +{ +echo "
\n"; + echo ""; + +echo "
CAMPAIGN LEAD RECYCLE LISTINGS:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNNAMELEAD RECYCLESMODIFY
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT status from vicidial_lead_recycle where campaign_id='$campaigns_id_list[$o]' order by status"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if ($p<1) + {echo "NONE";} + echo "MODIFY LEAD RECYCLES
\n"; +} + + +###################### +# ADD=36 display all campaign auto-alt dial entries +###################### +if ($ADD==36) +{ +echo "
\n"; + echo ""; + +echo "
CAMPAIGN LEAD AUTO-ALT DIAL LISTINGS:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNNAMEAUTO-ALT DIALMODIFY
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$campaigns_id_list[$o]';"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if (strlen($row[0])<3) + {echo "NONE";} + echo "MODIFY AUTO-ALT DIAL
\n"; +} + + +###################### +# ADD=37 display all campaign agent pause codes +###################### +if ($ADD==37) +{ +echo "
\n"; + echo ""; + +echo "
CAMPAIGN AGENT PAUSE CODE LISTINGS:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNNAMEPAUSE CODESMODIFY
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT pause_code from vicidial_pause_codes where campaign_id='$campaigns_id_list[$o]' order by pause_code;"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if ($p<1) + {echo "NONE";} + echo "MODIFY PAUSE CODES
\n"; +} + + +###################### +# ADD=39 display all campaign list mixes +###################### +if ($ADD==39) +{ +echo "
\n"; + echo ""; + +echo "
CAMPAIGN LIST MIX LISTINGS:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNNAMELIST MIXMODIFY
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT vcl_id from vicidial_campaigns_list_mix where campaign_id='$campaigns_id_list[$o]' order by status,vcl_id;"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if ($p<1) + {echo "NONE";} + echo "MODIFY LIST MIX
\n"; +} + + + + + +###################### +# ADD=311 modify list info in the system +###################### + +if ($ADD==311) +{ + if ($LOGmodify_lists==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $campaign_id = $row[2]; + $active = $row[3]; + $list_description = $row[4]; + $list_changedate = $row[5]; + $list_lastcalldate = $row[6]; + + # grab names of global statuses and statuses in the selected campaign + $stmt="SELECT * from vicidial_statuses order by status"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + + $o=0; + while ($statuses_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $statuses_list["$rowx[0]"] = "$rowx[1]"; + $o++; + } + + $stmt="SELECT * from vicidial_campaign_statuses where campaign_id='$campaign_id' order by status"; + $rslt=mysql_query($stmt, $link); + $Cstatuses_to_print = mysql_num_rows($rslt); + + $o=0; + while ($Cstatuses_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $statuses_list["$rowx[0]"] = "$rowx[1]"; + $o++; + } + # end grab status names + + + echo "
MODIFY A LISTS RECORD: $row[0]
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
List ID: $row[0]$NWB#vicidial_lists-list_id$NWE
List Name: $NWB#vicidial_lists-list_name$NWE
List Description: $NWB#vicidial_lists-list_description$NWE
Campaign: $NWB#vicidial_lists-campaign_id$NWE
Active: $NWB#vicidial_lists-active$NWE
Reset Lead-Called-Status for this list: $NWB#vicidial_lists-reset_list$NWE
List Change Date: $list_changedate   $NWB#vicidial_lists-list_changedate$NWE
List Last Call Date: $list_lastcalldate   $NWB#vicidial_lists-list_lastcalldate$NWE
\n"; + + echo "
\n"; + echo "
STATUSES WITHIN THIS LIST:
\n"; + echo "\n"; + echo "\n"; + + $leads_in_list = 0; + $leads_in_list_N = 0; + $leads_in_list_Y = 0; + $stmt="SELECT status,called_since_last_reset,count(*) from vicidial_list where list_id='$list_id' group by status,called_since_last_reset order by status,called_since_last_reset"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + + $o=0; + $lead_list['count'] = 0; + $lead_list['Y_count'] = 0; + $lead_list['N_count'] = 0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + + $lead_list['count'] = ($lead_list['count'] + $rowx[2]); + if ($rowx[1] == 'N') + { + $since_reset = 'N'; + $since_resetX = 'Y'; + } + else + { + $since_reset = 'Y'; + $since_resetX = 'N'; + } + $lead_list[$since_reset][$rowx[0]] = ($lead_list[$since_reset][$rowx[0]] + $rowx[2]); + $lead_list[$since_reset.'_count'] = ($lead_list[$since_reset.'_count'] + $rowx[2]); + #If opposite side is not set, it may not in the future so give it a value of zero + if (!isset($lead_list[$since_resetX][$rowx[0]])) + { + $lead_list[$since_resetX][$rowx[0]]=0; + } + $o++; + } + + $o=0; + if ($lead_list['count'] > 0) + { + while (list($dispo,) = each($lead_list[$since_reset])) + { + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + if ($dispo == 'CBHOLD') + { + $CLB=""; + $CLE=""; + } + else + { + $CLB=''; + $CLE=''; + } + + echo "\n"; + $o++; + } + } + + echo "\n"; + echo "\n"; + + echo "
STATUSSTATUS NAMECALLEDNOT CALLED
$CLB$dispo$CLE$statuses_list[$dispo]".$lead_list['Y'][$dispo]."".$lead_list['N'][$dispo]."
SUBTOTALS$lead_list[Y_count]$lead_list[N_count]
TOTAL$lead_list[count]

\n"; + unset($lead_list); + + + echo "
\n"; + echo "
TIME ZONES WITHIN THIS LIST:
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT gmt_offset_now,called_since_last_reset,count(*) from vicidial_list where list_id='$list_id' group by gmt_offset_now,called_since_last_reset order by gmt_offset_now,called_since_last_reset"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + + $o=0; + $plus='+'; + $lead_list['count'] = 0; + $lead_list['Y_count'] = 0; + $lead_list['N_count'] = 0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + + $lead_list['count'] = ($lead_list['count'] + $rowx[2]); + if ($rowx[1] == 'N') + { + $since_reset = 'N'; + $since_resetX = 'Y'; + } + else + { + $since_reset = 'Y'; + $since_resetX = 'N'; + } + $lead_list[$since_reset][$rowx[0]] = ($lead_list[$since_reset][$rowx[0]] + $rowx[2]); + $lead_list[$since_reset.'_count'] = ($lead_list[$since_reset.'_count'] + $rowx[2]); + #If opposite side is not set, it may not in the future so give it a value of zero + if (!isset($lead_list[$since_resetX][$rowx[0]])) + { + $lead_list[$since_resetX][$rowx[0]]=0; + } + $o++; + } + + if ($lead_list['count'] > 0) + { + while (list($tzone,) = each($lead_list[$since_reset])) + { + $LOCALzone=3600 * $tzone; + $LOCALdate=gmdate("D M Y H:i", time() + $LOCALzone); + + if ($tzone >= 0) {$DISPtzone = "$plus$tzone";} + else {$DISPtzone = "$tzone";} + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + } + + echo "\n"; + echo "\n"; + + echo "
GMT OFFSET NOW (local time)CALLEDNOT CALLED
".$DISPtzone."     ($LOCALdate)".$lead_list['Y'][$tzone]."".$lead_list['N'][$tzone]."
SUBTOTALS$lead_list[Y_count]$lead_list[N_count]
TOTAL$lead_list[count]

\n"; + unset($lead_list); + + + + $leads_in_list = 0; + $leads_in_list_N = 0; + $leads_in_list_Y = 0; + $stmt="SELECT status,called_count,count(*) from vicidial_list where list_id='$list_id' group by status,called_count order by status,called_count"; + $rslt=mysql_query($stmt, $link); + $status_called_to_print = mysql_num_rows($rslt); + + $o=0; + $sts=0; + $first_row=1; + $all_called_first=1000; + $all_called_last=0; + while ($status_called_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $leads_in_list = ($leads_in_list + $rowx[2]); + $count_statuses[$o] = "$rowx[0]"; + $count_called[$o] = "$rowx[1]"; + $count_count[$o] = "$rowx[2]"; + $all_called_count[$rowx[1]] = ($all_called_count[$rowx[1]] + $rowx[2]); + + if ( (strlen($status[$sts]) < 1) or ($status[$sts] != "$rowx[0]") ) + { + if ($first_row) {$first_row=0;} + else {$sts++;} + $status[$sts] = "$rowx[0]"; + $status_called_first[$sts] = "$rowx[1]"; + if ($status_called_first[$sts] < $all_called_first) {$all_called_first = $status_called_first[$sts];} + } + $leads_in_sts[$sts] = ($leads_in_sts[$sts] + $rowx[2]); + $status_called_last[$sts] = "$rowx[1]"; + if ($status_called_last[$sts] > $all_called_last) {$all_called_last = $status_called_last[$sts];} + + $o++; + } + + + + + echo "
\n"; + echo "
CALLED COUNTS WITHIN THIS LIST:
\n"; + echo "\n"; + echo ""; + $first = $all_called_first; + while ($first <= $all_called_last) + { + if (eregi("1$|3$|5$|7$|9$", $first)) {$AB='bgcolor="#AFEEEE"';} + else{$AB='bgcolor="#E0FFFF"';} + echo ""; + $first++; + } + echo "\n"; + + $sts=0; + $statuses_called_to_print = count($status); + while ($statuses_called_to_print > $sts) + { + $Pstatus = $status[$sts]; + if (eregi("1$|3$|5$|7$|9$", $sts)) + {$bgcolor='bgcolor="#B9CBFD"'; $AB='bgcolor="#9BB9FB"';} + else + {$bgcolor='bgcolor="#9BB9FB"'; $AB='bgcolor="#B9CBFD"';} + # echo "$status[$sts]|$status_called_first[$sts]|$status_called_last[$sts]|$leads_in_sts[$sts]|\n"; + # echo "$status[$sts]|"; + echo ""; + + $first = $all_called_first; + while ($first <= $all_called_last) + { + if (eregi("1$|3$|5$|7$|9$", $sts)) + { + if (eregi("1$|3$|5$|7$|9$", $first)) {$AB='bgcolor="#9BB9FB"';} + else{$AB='bgcolor="#B9CBFD"';} + } + else + { + if (eregi("0$|2$|4$|6$|8$", $first)) {$AB='bgcolor="#9BB9FB"';} + else{$AB='bgcolor="#B9CBFD"';} + } + + $called_printed=0; + $o=0; + while ($status_called_to_print > $o) + { + if ( ($count_statuses[$o] == "$Pstatus") and ($count_called[$o] == "$first") ) + { + $called_printed++; + echo ""; + } + + + $o++; + } + if (!$called_printed) + {echo "";} + $first++; + } + echo "\n\n"; + + $sts++; + } + + echo ""; + $first = $all_called_first; + while ($first <= $all_called_last) + { + if (eregi("1$|3$|5$|7$|9$", $first)) {$AB='bgcolor="#AFEEEE"';} + else{$AB='bgcolor="#E0FFFF"';} + echo ""; + $first++; + } + echo "\n"; + + echo "
STATUSSTATUS NAME$firstSUBTOTAL
$Pstatus$statuses_list[$Pstatus] $count_count[$o]  $leads_in_sts[$sts]
TOTAL$all_called_count[$first]$leads_in_list

\n"; + + + + + + echo "
\n"; + + echo "

Click here to see all CallBack Holds in this list

\n"; + + if ($LOGdelete_lists > 0) + { + echo "

DELETE THIS LIST\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + + +###################### +# ADD=3111 modify in-group info in the system +###################### + +if ($ADD==3111) +{ + if ($LOGmodify_ingroups==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_inbound_groups where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $group_name = $row[1]; + $group_color = $row[2]; + $active = $row[3]; + $web_form_address = $row[4]; + $voicemail_ext = $row[5]; + $next_agent_call = $row[6]; + $fronter_display = $row[7]; + $script_id = $row[8]; + $get_call_launch = $row[9]; + $xferconf_a_dtmf = $row[10]; + $xferconf_a_number = $row[11]; + $xferconf_b_dtmf = $row[12]; + $xferconf_b_number = $row[13]; + $drop_call_seconds = $row[14]; + $drop_message = $row[15]; + $drop_exten = $row[16]; + $call_time_id = $row[17]; + $after_hours_action = $row[18]; + $after_hours_message_filename = $row[19]; + $after_hours_exten = $row[20]; + $after_hours_voicemail = $row[21]; + $welcome_message_filename = $row[22]; + $moh_context = $row[23]; + $onhold_prompt_filename = $row[24]; + $prompt_interval = $row[25]; + $agent_alert_exten = $row[26]; + $agent_alert_delay = $row[27]; + $default_xfer_group = $row[28]; + + ##### get in-groups listings for dynamic pulldown + $stmt="SELECT group_id,group_name from vicidial_inbound_groups order by group_id"; + $rslt=mysql_query($stmt, $link); + $Xgroups_to_print = mysql_num_rows($rslt); + $Xgroups_menu=''; + $Xgroups_selected=0; + $o=0; + while ($Xgroups_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $Xgroups_menu .= "\n"; + $o++; + } + if ($Xgroups_selected < 1) + {$Xgroups_menu .= "\n";} + else + {$Xgroups_menu .= "\n";} + + + echo "
MODIFY A GROUPS RECORD: $row[0]\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + echo "
Group ID: $row[0]$NWB#vicidial_inbound_groups-group_id$NWE
Group Name: $NWB#vicidial_inbound_groups-group_name$NWE
Group Color: $NWB#vicidial_inbound_groups-group_color$NWE
Active: $NWB#vicidial_inbound_groups-active$NWE
Web Form: $NWB#vicidial_inbound_groups-web_form_address$NWE
Next Agent Call: $NWB#vicidial_inbound_groups-next_agent_call$NWE
Fronter Display: $NWB#vicidial_inbound_groups-fronter_display$NWE
Script: $NWB#vicidial_inbound_groups-ingroup_script$NWE
Get Call Launch: $NWB#vicidial_inbound_groups-get_call_launch$NWE
Transfer-Conf DTMF 1: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
Transfer-Conf Number 1: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
Transfer-Conf DTMF 2: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
Transfer-Conf Number 2: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
Drop Call Seconds: $NWB#vicidial_inbound_groups-drop_call_seconds$NWE
Voicemail: $NWB#vicidial_inbound_groups-voicemail_ext$NWE
Use Drop Message: $NWB#vicidial_inbound_groups-drop_message$NWE
Drop Exten: $NWB#vicidial_inbound_groups-drop_exten$NWE
Call Time: $NWB#vicidial_inbound_groups-call_time_id$NWE
After Hours Action: $NWB#vicidial_inbound_groups-after_hours_action$NWE
After Hours Message Filename: $NWB#vicidial_inbound_groups-after_hours_message_filename$NWE
After Hours Extension: $NWB#vicidial_inbound_groups-after_hours_exten$NWE
After Hours Voicemail: $NWB#vicidial_inbound_groups-after_hours_voicemail$NWE
Welcome Message Filename: $NWB#vicidial_inbound_groups-welcome_message_filename$NWE
Music On Hold Context: $NWB#vicidial_inbound_groups-moh_context$NWE
On Hold Prompt Filename: $NWB#vicidial_inbound_groups-onhold_prompt_filename$NWE
On Hold Prompt Interval: $NWB#vicidial_inbound_groups-prompt_interval$NWE
Agent Alert Extension: $NWB#vicidial_inbound_groups-agent_alert_exten$NWE
Agent Alert Delay: $NWB#vicidial_inbound_groups-agent_alert_delay$NWE
Default Transfer Group: $NWB#vicidial_inbound_groups-default_xfer_group$NWE
\n"; + + ### list of agent rank or skill-level for this inbound group + echo "
\n"; + echo "
AGENT RANKS FOR THIS INBOUND GROUP:
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT user,group_rank,calls_today from vicidial_inbound_group_agents where group_id='$group_id'"; + $rsltx=mysql_query($stmt, $link); + $users_to_print = mysql_num_rows($rsltx); + + $o=0; + while ($users_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + + echo "
USER     RANK     CALLS TODAY
$rowx[0]$rowx[1]$rowx[2]

\n"; + + echo "

\n"; + + echo "Click here to see a report for this inbound group

\n"; + + echo "
\n"; + + if ($LOGdelete_ingroups > 0) + { + echo "

EMERGENCY VDAC CLEAR FOR THIS IN-GROUP

\n"; + echo "

DELETE THIS IN-GROUP\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + + +###################### +# ADD=31111 modify remote agents info in the system +###################### + +if ($ADD==31111) +{ + if ($LOGmodify_remoteagents==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + + echo "
MODIFY A REMOTE AGENTS ENTRY: $row[0]\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
User ID Start: (numbers only, incremented)$NWB#vicidial_remote_agents-user_start$NWE
Number of Lines: (numbers only)$NWB#vicidial_remote_agents-number_of_lines$NWE
Server IP: $NWB#vicidial_remote_agents-server_ip$NWE
External Extension: (dial plan number dialed to reach agents)$NWB#vicidial_remote_agents-conf_exten$NWE
Status: $NWB#vicidial_remote_agents-status$NWE
Campaign: $NWB#vicidial_remote_agents-campaign_id$NWE
Inbound Groups: \n"; + echo "$groups_list"; + echo "$NWB#vicidial_remote_agents-closer_campaigns$NWE
\n"; + echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n"; + + + if ($LOGdelete_remote_agents > 0) + { + echo "

DELETE THIS REMOTE AGENT\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=311111 modify user group info in the system +###################### + +if ($ADD==311111) +{ + if ($LOGmodify_usergroups==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_user_groups where user_group='$user_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $user_group = $row[0]; + $group_name = $row[1]; + echo ""; + + echo "
MODIFY A USERS GROUP ENTRY\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Group: (no spaces or punctuation)$NWB#vicidial_user_groups-user_group$NWE
Description: (description of group)$NWB#vicidial_user_groups-group_name$NWE
Allowed Campaigns: \n"; + echo "$campaigns_list"; + echo "$NWB#vicidial_user_groups-allowed_campaigns$NWE
\n"; + + + ### list of users in this user group + + $active_confs = 0; + $stmt="SELECT user,full_name,user_level from vicidial_users where user_group='$user_group'"; + $rsltx=mysql_query($stmt, $link); + $users_to_print = mysql_num_rows($rsltx); + + echo "
\n"; + echo "
USERS WITHIN THIS USER GROUP: $users_to_print
\n"; + echo "\n"; + echo "\n"; + + $o=0; + while ($users_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
USERFULL NAMELEVEL
$rowx[0]$rowx[1]$rowx[2]

\n"; + + + + echo "

Click here to see all CallBack Holds in this user group

\n"; + + if ($LOGdelete_user_groups > 0) + { + echo "

DELETE THIS USER GROUP\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=3111111 modify script info in the system +###################### + +if ($ADD==3111111) +{ + if ($LOGmodify_scripts==1) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_scripts where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $script_name = $row[1]; + $script_comments = $row[2]; + $script_text = $row[3]; + $active = $row[4]; + echo ""; + + echo "
MODIFY A SCRIPT\n"; + echo "\n"; + echo "\n"; + echo "
Script ID: $script_id$NWB#vicidial_scripts-script_name$NWE
Script Name: (title of the script)$NWB#vicidial_scripts-script_name$NWE
Script Comments: $NWB#vicidial_scripts-script_comments$NWE
Active: $NWB#vicidial_scripts-active$NWE
Script Text:

Preview Script
"; + # BEGIN Insert Field + echo ""; + echo "
"; + # END Insert Field + echo " $NWB#vicidial_scripts-script_text$NWE
\n"; + + if ($LOGdelete_scripts > 0) + { + echo "

DELETE THIS SCRIPT\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=31111111 modify filter info in the system +###################### + +if ($ADD==31111111) +{ + if ($LOGmodify_filters==1) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_lead_filters where lead_filter_id='$lead_filter_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $lead_filter_name = $row[1]; + $lead_filter_comments = $row[2]; + $lead_filter_sql = $row[3]; + echo ""; + + echo "
MODIFY A FILTER\n"; + echo "\n"; + echo "\n"; + echo "
Filter ID: $lead_filter_id$NWB#vicidial_lead_filters-lead_filter_id$NWE
Filter Name: (short description of the filter)$NWB#vicidial_lead_filters-lead_filter_name$NWE
Filter Comments: $NWB#vicidial_lead_filters-lead_filter_comments$NWE
Filter SQL: $NWB#vicidial_lead_filters-lead_filter_sql$NWE
\n"; + + ##### get campaigns listing for dynamic pulldown + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + $campaigns_list=''; + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $campaigns_list .= "\n"; + $o++; + } + + echo "

"; + echo "
TEST ON CAMPAIGN:
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + if ($LOGdelete_filters > 0) + { + echo "

DELETE THIS FILTER\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=321111111 modify call time definition info in the system +###################### + +if ($ADD==321111111) +{ +if ($LOGmodify_call_times==1) +{ + +if ( ($stage=="ADD") and (strlen($state_rule)>0) ) + { + $stmt="SELECT ct_state_call_times from vicidial_call_times where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $ct_state_call_times = $row[0]; + + if (eregi("\|$",$ct_state_call_times)) + {$ct_state_call_times = "$ct_state_call_times$state_rule\|";} + else + {$ct_state_call_times = "$ct_state_call_times\|$state_rule\|";} + $stmt="UPDATE vicidial_call_times set ct_state_call_times='$ct_state_call_times' where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + echo "State Rule Added: $state_rule
\n"; + } +if ( ($stage=="REMOVE") and (strlen($state_rule)>0) ) + { + $stmt="SELECT ct_state_call_times from vicidial_call_times where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $ct_state_call_times = $row[0]; + + $ct_state_call_times = eregi_replace("\|$state_rule\|",'|',$ct_state_call_times); + $stmt="UPDATE vicidial_call_times set ct_state_call_times='$ct_state_call_times' where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + echo "State Rule Removed: $state_rule
\n"; + } + +$ADD=311111111; +} +else +{ +echo "You are not authorized to view this page. Please go back."; +} + +} + + +###################### +# ADD=311111111 modify call time definition info in the system +###################### + +if ($ADD==311111111) +{ + +if ($LOGmodify_call_times==1) +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +$ct_srs=1; +$b=0; +$srs_SQL =''; +if (strlen($ct_state_call_times)>2) + { + $state_rules = explode('|',$ct_state_call_times); + $ct_srs = ((count($state_rules)) - 1); + } +echo "\n"; +echo "\n"; +while($ct_srs >= $b) + { + if (strlen($state_rules[$b])>0) + { + $stmt="SELECT state_call_time_state,state_call_time_name from vicidial_state_call_times where state_call_time_id='$state_rules[$b]';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + echo "\n"; + $srs_SQL .= "'$state_rules[$b]',"; + $srs_state_SQL .= "'$row[0]',"; + } + $b++; + } +if (strlen($srs_SQL)>2) + { + $srs_SQL = "$srs_SQL''"; + $srs_state_SQL = "$srs_state_SQL''"; + $srs_SQL = "where state_call_time_id NOT IN($srs_SQL) and state_call_time_state NOT IN($srs_state_SQL)"; + } +else + {$srs_SQL='';} +$stmt="SELECT state_call_time_id,state_call_time_name from vicidial_state_call_times $srs_SQL order by state_call_time_id;"; +$rslt=mysql_query($stmt, $link); +$sct_to_print = mysql_num_rows($rslt); +$sct_list=''; + +$o=0; +while ($sct_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $sct_list .= "\n"; + $o++; +} +echo "\n"; +echo "\n"; + +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_call_times where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $call_time_name = $row[1]; + $call_time_comments = $row[2]; + $ct_default_start = $row[3]; + $ct_default_stop = $row[4]; + $ct_sunday_start = $row[5]; + $ct_sunday_stop = $row[6]; + $ct_monday_start = $row[7]; + $ct_monday_stop = $row[8]; + $ct_tuesday_start = $row[9]; + $ct_tuesday_stop = $row[10]; + $ct_wednesday_start = $row[11]; + $ct_wednesday_stop = $row[12]; + $ct_thursday_start = $row[13]; + $ct_thursday_stop = $row[14]; + $ct_friday_start = $row[15]; + $ct_friday_stop = $row[16]; + $ct_saturday_start = $row[17]; + $ct_saturday_stop = $row[18]; + $ct_state_call_times = $row[19]; + +echo ""; + +echo "
MODIFY A CALL TIME\n"; +echo "\n"; +echo "\n"; +echo "
Call Time ID: $call_time_id$NWB#vicidial_call_times-call_time_id$NWE
Call Time Name: (short description of the call time)$NWB#vicidial_call_times-call_time_name$NWE
Call Time Comments: $NWB#vicidial_call_times-call_time_comments$NWE
Default Start: Default Stop: $NWB#vicidial_call_times-ct_default_start$NWE
Sunday Start: Sunday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Monday Start: Monday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Tuesday Start: Tuesday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Wednesday Start: Wednesday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Thursday Start: Thursday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Friday Start: Friday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Saturday Start: Saturday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Active State Call Time Definitions for this Record:  
$state_rules[$b] - REMOVE $row[0] - $row[1]
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "Add state call time rule:


\n"; +echo "CAMPAIGNS USING THIS CALL TIME:
\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns where local_call_time='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + $o=0; + while ($camps_to_print > $o) { + $row=mysql_fetch_row($rslt); + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]
\n"; +echo "INBOUND GROUPS USING THIS CALL TIME:
\n"; +echo "\n"; + + $stmt="SELECT group_id,group_name from vicidial_inbound_groups where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + $o=0; + while ($camps_to_print > $o) { + $row=mysql_fetch_row($rslt); + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]
\n"; +echo "

\n"; + +if ($LOGdelete_call_times > 0) + { + echo "

DELETE THIS CALL TIME DEFINITION\n"; + } +} +else +{ +echo "You are not authorized to view this page. Please go back."; +} + +} + + +###################### +# ADD=3111111111 modify state call time definition info in the system +###################### + +if ($ADD==3111111111) +{ + +if ($LOGmodify_call_times==1) +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_state_call_times where state_call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $state_call_time_state =$row[1]; + $call_time_name = $row[2]; + $call_time_comments = $row[3]; + $ct_default_start = $row[4]; + $ct_default_stop = $row[5]; + $ct_sunday_start = $row[6]; + $ct_sunday_stop = $row[7]; + $ct_monday_start = $row[8]; + $ct_monday_stop = $row[9]; + $ct_tuesday_start = $row[10]; + $ct_tuesday_stop = $row[11]; + $ct_wednesday_start = $row[12]; + $ct_wednesday_stop = $row[13]; + $ct_thursday_start = $row[14]; + $ct_thursday_stop = $row[15]; + $ct_friday_start = $row[16]; + $ct_friday_stop = $row[17]; + $ct_saturday_start = $row[18]; + $ct_saturday_stop = $row[19]; + +echo ""; + +echo "
MODIFY A STATE CALL TIME
\n"; +echo "\n"; +echo "\n"; +echo "
Call Time ID: $call_time_id$NWB#vicidial_call_times-call_time_id$NWE
State Call Time State: $NWB#vicidial_call_times-state_call_time_state$NWE
State Call Time Name: (short description of the call time)$NWB#vicidial_call_times-call_time_name$NWE
State Call Time Comments: $NWB#vicidial_call_times-call_time_comments$NWE
Default Start: Default Stop: $NWB#vicidial_call_times-ct_default_start$NWE
Sunday Start: Sunday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Monday Start: Monday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Tuesday Start: Tuesday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Wednesday Start: Wednesday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Thursday Start: Thursday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Friday Start: Friday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Saturday Start: Saturday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE


\n"; +echo "CALL TIMES USING THIS STATE CALL TIME:
\n"; +echo "\n"; + + $stmt="SELECT call_time_id,call_time_name from vicidial_call_times where ct_state_call_times LIKE \"%|$call_time_id|%\";"; + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + $o=0; + while ($camps_to_print > $o) { + $row=mysql_fetch_row($rslt); + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]
\n"; +echo "

\n"; + +if ($LOGdelete_call_times > 0) + { + echo "

DELETE THIS STATE CALL TIME DEFINITION\n"; + } + +} +else +{ +echo "You are not authorized to view this page. Please go back."; +} + +} + + +###################### +# ADD=31111111111 modify phone record in the system +###################### + +if ($ADD==31111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + echo "
MODIFY A PHONE RECORD: $row[1]\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Phone extension: $NWB#phones-extension$NWE
Dial Plan Number: (digits only)$NWB#phones-dialplan_number$NWE
Voicemail Box: (digits only)$NWB#phones-voicemail_id$NWE
Outbound CallerID: (digits only)$NWB#phones-outbound_cid$NWE
Phone IP address: (optional)$NWB#phones-phone_ip$NWE
Computer IP address: (optional)$NWB#phones-computer_ip$NWE
Server IP: $NWB#phones-server_ip$NWE
Login: $NWB#phones-login$NWE
Password: $NWB#phones-pass$NWE
Status: $NWB#phones-status$NWE
Active Account: $NWB#phones-active$NWE
Phone Type: $NWB#phones-phone_type$NWE
Full Name: $NWB#phones-fullname$NWE
Company: $NWB#phones-company$NWE
Picture: $NWB#phones-picture$NWE
New Messages: $row[14]$NWB#phones-messages$NWE
Old Messages: $row[15]$NWB#phones-old_messages$NWE
Client Protocol: $NWB#phones-protocol$NWE
Local GMT: (Do NOT Adjust for DST)$NWB#phones-local_gmt$NWE
Manager Login: $NWB#phones-ASTmgrUSERNAME$NWE
Manager Secret: $NWB#phones-ASTmgrSECRET$NWE
VICIDIAL Default User: $NWB#phones-login_user$NWE
VICIDIAL Default Pass: $NWB#phones-login_pass$NWE
VICIDIAL Default Campaign: $NWB#phones-login_campaign$NWE
Park Exten: $NWB#phones-park_on_extension$NWE
Conf Exten: $NWB#phones-conf_on_extension$NWE
VICIDIAL Park Exten: $NWB#phones-VICIDIAL_park_on_extension$NWE
VICIDIAL Park File: $NWB#phones-VICIDIAL_park_on_filename$NWE
Monitor Prefix: $NWB#phones-monitor_prefix$NWE
Recording Exten: $NWB#phones-recording_exten$NWE
VMailMain Exten: $NWB#phones-voicemail_exten$NWE
VMailDump Exten: $NWB#phones-voicemail_dump_exten$NWE
Exten Context: $NWB#phones-ext_context$NWE
DTMFSend Channel: $NWB#phones-dtmf_send_extension$NWE
Outbound Call Group: $NWB#phones-call_out_number_group$NWE
Browser Location: $NWB#phones-client_browser$NWE
Install Directory: $NWB#phones-install_directory$NWE
CallerID URL: $NWB#phones-local_web_callerID_URL$NWE
VICIDIAL Default URL: $NWB#phones-VICIDIAL_web_URL$NWE
Call Logging: $NWB#phones-AGI_call_logging_enabled$NWE
User Switching: $NWB#phones-user_switching_enabled$NWE
Conferencing: $NWB#phones-conferencing_enabled$NWE
Admin Hang Up: $NWB#phones-admin_hangup_enabled$NWE
Admin Hijack: $NWB#phones-admin_hijack_enabled$NWE
Admin Monitor: $NWB#phones-admin_monitor_enabled$NWE
Call Park: $NWB#phones-call_parking_enabled$NWE
Updater Check: $NWB#phones-updater_check_enabled$NWE
AF Logging: $NWB#phones-AFLogging_enabled$NWE
Queue Enabled: $NWB#phones-QUEUE_ACTION_enabled$NWE
CallerID Popup: $NWB#phones-CallerID_popup_enabled$NWE
VMail Button: $NWB#phones-voicemail_button_enabled$NWE
Fast Refresh: $NWB#phones-enable_fast_refresh$NWE
Fast Refresh Rate: (in ms)$NWB#phones-fast_refresh_rate$NWE
Persistant MySQL: $NWB#phones-enable_persistant_mysql$NWE
Auto Dial Next Number: $NWB#phones-auto_dial_next_number$NWE
Stop Rec after each call: $NWB#phones-VDstop_rec_after_each_call$NWE
Enable SIPSAK Messages: $NWB#phones-enable_sipsak_messages$NWE
DBX Server: (Primary DB Server)$NWB#phones-DBX_server$NWE
DBX Database: (Primary Server Database)$NWB#phones-DBX_database$NWE
DBX User: (Primary DB Login)$NWB#phones-DBX_user$NWE
DBX Pass: (Primary DB Secret)$NWB#phones-DBX_pass$NWE
DBX Port: (Primary DB Port)$NWB#phones-DBX_port$NWE
DBY Server: (Secondary DB Server)$NWB#phones-DBY_server$NWE
DBY Database: (Secondary Server Database)$NWB#phones-DBY_database$NWE
DBY User: (Secondary DB Login)$NWB#phones-DBY_user$NWE
DBY Pass: (Secondary DB Secret)$NWB#phones-DBY_pass$NWE
DBY Port: (Secondary DB Port)$NWB#phones-DBY_port$NWE
\n"; + + echo "

Click here for phone stats\n"; + + if ($LOGast_delete_phones > 0) + { + echo "

DELETE THIS PHONE\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=311111111111 modify server record in the system +###################### + +if ($ADD==311111111111) +{ + if ($LOGmodify_servers==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from servers where server_id='$server_id' or server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $server_id = $row[0]; + $server_ip = $row[2]; + + echo "
MODIFY A SERVER RECORD: $row[0]\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Server ID: $NWB#servers-server_id$NWE
Server Description: $NWB#servers-server_description$NWE
Server IP Address: $NWB#servers-server_ip$NWE
Active: $NWB#servers-active$NWE
Asterisk Version: $NWB#servers-asterisk_version$NWE
Max VICIDIAL Trunks: $NWB#servers-max_vicidial_trunks$NWE
VICIDIAL Balance Dialing: $NWB#servers-vicidial_balance_active$NWE
VICIDIAL Balance Offlimits: $NWB#servers-balance_trunks_offlimits$NWE
Telnet Host: $NWB#servers-telnet_host$NWE
Telnet Port: $NWB#servers-telnet_port$NWE
Manager User: $NWB#servers-ASTmgrUSERNAME$NWE
Manager Secret: $NWB#servers-ASTmgrSECRET$NWE
Manager Update User: $NWB#servers-ASTmgrUSERNAMEupdate$NWE
Manager Listen User: $NWB#servers-ASTmgrUSERNAMElisten$NWE
Manager Send User: $NWB#servers-ASTmgrUSERNAMEsend$NWE
Local GMT: (Do NOT Adjust for DST)$NWB#servers-local_gmt$NWE
VMail Dump Exten: $NWB#servers-voicemail_dump_exten$NWE
VICIDIAL AD extension: $NWB#servers-answer_transfer_agent$NWE
Default Context: $NWB#servers-ext_context$NWE
System Performance: $NWB#servers-sys_perf_log$NWE
Server Logs: $NWB#servers-vd_server_logs$NWE
AGI Output: $NWB#servers-agi_output$NWE
\n"; + + + ### vicidial server trunk records for this server + echo "

VICIDIAL TRUNKS FOR THIS SERVER:   $NWB#vicidial_server_trunks$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_server_trunks where server_ip='$server_ip' order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $recycle_to_print = mysql_num_rows($rslt); + $o=0; + while ($recycle_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
CAMPAIGN TRUNKS RESTRICTION DELETE
$rowx[1]
\n"; + echo "\n"; + echo "\n"; + echo "
DELETE
\n"; + + echo "
ADD NEW SERVER VICIDIAL TRUNK RECORD
\n"; + echo "\n"; + echo "\n"; + echo "TRUNKS:
\n"; + echo "CAMPAIGN:
\n"; + echo "RESTRICTION:
\n"; + echo "
\n"; + + echo "

\n"; + + + ### list of phones on this server + echo "
\n"; + echo "
PHONES WITHIN THIS SERVER:
\n"; + echo "\n"; + echo "\n"; + + $active_phones = 0; + $inactive_phones = 0; + $stmt="SELECT extension,active,fullname from phones where server_ip='$row[2]'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + if (ereg("Y", $rowx[1])) {$active_phones++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_phones++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + + echo "
EXTENSIONNAMEACTIVE
$rowx[0]$rowx[2]$rowx[1]

\n"; + + + ### list of conferences on this server + echo "
\n"; + echo "
CONFERENCES WITHIN THIS SERVER:
\n"; + echo "\n"; + echo "\n"; + + $active_confs = 0; + $stmt="SELECT conf_exten,extension from conferences where server_ip='$row[2]'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + $active_confs++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + + echo "
CONFERENCEEXTENSION
$rowx[0]$rowx[2]

\n"; + + + ### list of vicidial conferences on this server + echo "
\n"; + echo "
VICIDIAL CONFERENCES WITHIN THIS SERVER:
\n"; + echo "\n"; + echo "\n"; + + $active_vdconfs = 0; + $stmt="SELECT conf_exten,extension from vicidial_conferences where server_ip='$row[2]'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + $active_vdconfs++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + + echo "
VD CONFERENCEEXTENSION
$rowx[0]$rowx[2]

\n"; + + + echo "
\n"; + + $camp_lists = eregi_replace(".$","",$camp_lists); + echo "This server has $active_phones active phones and $inactive_phones inactive phones

\n"; + echo "This server has $active_confs active conferences

\n"; + echo "This server has $active_vdconfs active vicidial conferences

\n"; + echo "
\n"; + if ($LOGast_delete_phones > 0) + { + echo "

DELETE THIS SERVER\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=3111111111111 modify conference record in the system +###################### + +if ($ADD==3111111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $conf_exten = $row[0]; + $server_ip = $row[1]; + + echo "
MODIFY A CONFERENCE RECORD: $row[0]
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Conference: $NWB#conferences-conf_exten$NWE
Server IP: $NWB#conferences-server_ip$NWE
Current Extension:
\n"; + + echo "
\n"; + if ($LOGast_delete_phones > 0) + { + echo "

DELETE THIS CONFERENCE\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=31111111111111 modify vicidial conference record in the system +###################### + +if ($ADD==31111111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $conf_exten = $row[0]; + $server_ip = $row[1]; + + echo "
MODIFY A VICIDIAL CONFERENCE RECORD: $row[0]\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Conference: $NWB#conferences-conf_exten$NWE
Server IP: $NWB#conferences-server_ip$NWE
Current Extension:
\n"; + + echo "
\n"; + if ($LOGast_delete_phones > 0) + { + echo "

DELETE THIS VICIDIAL CONFERENCE\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + + +###################### +# ADD=311111111111111 modify vicidial system settings +###################### + +if ($ADD==311111111111111) +{ + if ($LOGmodify_servers==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT version,install_date,use_non_latin,webroot_writable,enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_url,queuemetrics_log_id,queuemetrics_eq_prepend,vicidial_agent_disable,allow_sipsak_messages,admin_home_url,enable_agc_xfer_log from system_settings;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $version = $row[0]; + $install_date = $row[1]; + $use_non_latin = $row[2]; + $webroot_writable = $row[3]; + $enable_queuemetrics_logging = $row[4]; + $queuemetrics_server_ip = $row[5]; + $queuemetrics_dbname = $row[6]; + $queuemetrics_login = $row[7]; + $queuemetrics_pass = $row[8]; + $queuemetrics_url = $row[9]; + $queuemetrics_log_id = $row[10]; + $queuemetrics_eq_prepend = $row[11]; + $vicidial_agent_disable = $row[12]; + $allow_sipsak_messages = $row[13]; + $admin_home_url = $row[14]; + $enable_agc_xfer_log = $row[15]; + + echo "
MODIFY VICIDIAL SYSTEM SETTINGS\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + echo "\n"; + echo "
Version: $version
Install Date: $install_date
Use Non-Latin: $NWB#settings-use_non_latin$NWE
Webroot Writable: $NWB#settings-webroot_writable$NWE
Enable QueueMetrics Logging: $NWB#settings-enable_queuemetrics_logging$NWE
QueueMetrics Server IP: $NWB#settings-queuemetrics_server_ip$NWE
QueueMetrics DB Name: $NWB#settings-queuemetrics_dbname$NWE
QueueMetrics DB Login: $NWB#settings-queuemetrics_login$NWE
QueueMetrics DB Password: $NWB#settings-queuemetrics_pass$NWE
QueueMetrics URL: $NWB#settings-queuemetrics_url$NWE
QueueMetrics Log ID: $NWB#settings-queuemetrics_log_id$NWE
QueueMetrics EnterQueue Prepend: $NWB#settings-queuemetrics_eq_prepend$NWE
VICIDIAL Agent Disable Display: $NWB#settings-vicidial_agent_disable$NWE
Allow SIPSAK Messages: $NWB#settings-allow_sipsak_messages$NWE
Admin Home URL: $NWB#settings-admin_home_url$NWE
Enable Agent Transfer Logfile: $NWB#settings-enable_agc_xfer_log$NWE
\n"; + echo "\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + + + + + +###################### +# ADD=321111111111111 modify vicidial system statuses +###################### + +if ($ADD==321111111111111) +{ + if ($LOGmodify_servers==1) + { + echo "
\n"; + echo ""; + + echo "
\n"; + echo "VICIDIAL STATUSES WITHIN THIS SYSTEM:   $NWB#vicidial_statuses$NWE
\n"; + echo "\n"; + echo "\n"; + + ##### get status category listings for dynamic pulldown + $stmt="SELECT vsc_id,vsc_name from vicidial_status_categories order by vsc_id desc"; + $rslt=mysql_query($stmt, $link); + $cats_to_print = mysql_num_rows($rslt); + $cats_list=""; + + $o=0; + while ($cats_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $cats_list .= "\n"; + $catsname_list["$rowx[0]"] = substr($rowx[1],0,20); + $o++; + } + + + $stmt="SELECT * from vicidial_statuses order by status;"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $AScategory = $rowx[4]; + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
STATUSDESCRIPTIONSELECT-
ABLE
HUMAN
ANSWER
CATEGORYMODIFY/DELETE
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "$rowx[0]
\n"; + echo "\n"; + echo "         \n"; + echo "   \n"; + + if (preg_match("/^B$|^NA$|^DNC$|^NA$|^DROP$|^INCALL$|^QUEUE$|^NEW$/i",$rowx[0])) + { + echo "DELETE\n"; + } + else + { + echo "DELETE\n"; + } + echo "
\n"; + + echo "
ADD NEW SYSTEM STATUS
\n"; + echo "\n"; + echo "Status:   \n"; + echo "Description:
\n"; + echo "Selectable:   \n"; + echo "Human Answer:   \n"; + echo "Category: \n"; + echo "  
\n"; + echo "
\n"; + + echo "

\n"; + + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + + + + +###################### +# ADD=331111111111111 modify vicidial status categories +###################### + +if ($ADD==331111111111111) +{ + if ($LOGmodify_servers==1) + { + echo "
\n"; + echo ""; + + echo "
\n"; + echo "VICIDIAL STATUS CATEGORIES:   $NWB#vicidial_status_categories$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_status_categories order by vsc_id;"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + + $Avsc_id[$o] = $rowx[0]; + $Avsc_name[$o] = $rowx[1]; + $Avsc_description[$o] = $rowx[2]; + $Atovdad_display[$o] = $rowx[3]; + + $o++; + } + $p=0; + while ($o > $p) + { + if (eregi("1$|3$|5$|7$|9$", $p)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $CATstatuses=''; + $stmt="SELECT status from vicidial_statuses where category='$Avsc_id[$p]' order by status;"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $q=0; + while ($statuses_to_print > $q) + { + $rowx=mysql_fetch_row($rslt); + $CATstatuses.=" $rowx[0]"; + $q++; + } + $stmt="SELECT status from vicidial_campaign_statuses where category='$Avsc_id[$p]' order by status;"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $q=0; + while ($statuses_to_print > $q) + { + $rowx=mysql_fetch_row($rslt); + $CATstatuses.=" $rowx[0]"; + $q++; + } + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + $p++; + } + + echo "
CATEGORYNAMETOVDADSTATUSES IN THIS CATEGORY
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "$Avsc_id[$p]
\n"; + echo "$CATstatuses"; + echo "
Description:
        \n"; + echo "   DELETE
 
\n"; + + echo "
ADD NEW STATUS CATEGORY
\n"; + echo "\n"; + echo "Category ID:   \n"; + echo "Name:   \n"; + echo "TimeOnVDAD Display:  
\n"; + echo "Description:   \n"; + echo "
\n"; + + echo "

\n"; + + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + + + + + +###################### +# ADD=550 search form +###################### + +if ($ADD==550) +{ +echo "
\n"; +echo ""; + +echo "
SEARCH FOR A USER
\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "
User Number:
Full Name:
User Level:
User Group:
\n"; + +} + +###################### +# ADD=660 user search results +###################### + +if ($ADD==660) +{ +echo "
\n"; + echo ""; + + $SQL = ''; + if ($user) {$SQL .= " user LIKE \"%$user%\" and";} + if ($full_name) {$SQL .= " full_name LIKE \"%$full_name%\" and";} + if ($user_level > 0) {$SQL .= " user_level LIKE \"%$user_level%\" and";} + if ($user_group) {$SQL .= " user_group = '$user_group' and";} + $SQL = eregi_replace(" and$", "", $SQL); + if (strlen($SQL)>5) {$SQL = "where $SQL";} + + $stmt="SELECT * from vicidial_users $SQL order by full_name desc;"; +# echo "\n|$stmt|\n"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
SEARCH RESULTS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[1]$row[3]$row[4]$row[5]MODIFY | STATS | STATUS | TIME
\n"; + +} + + +###################################################################################################### +###################################################################################################### +####### 8 series, Callback lists +###################################################################################################### +###################################################################################################### + +###################### +# ADD=8 find all callbacks on hold by a User +###################### +if ($ADD==8) +{ + if ($LOGmodify_users==1) + { + if ($SUB==89) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where user='$user' and status='LIVE' and callback_time < '$past_month_date';"; + $rslt=mysql_query($stmt, $link); + echo "
User($user) callback listings LIVE for more than one month have been made INACTIVE\n"; + } + if ($SUB==899) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where user='$user' and status='LIVE' and callback_time < '$past_week_date';"; + $rslt=mysql_query($stmt, $link); + echo "
User($user) callback listings LIVE for more than one week have been made INACTIVE\n"; + } + } +$CBinactiveLINK = "
Remove LIVE Callbacks older than one month for this user
Remove LIVE Callbacks older than one week for this user
"; + +echo ""; + + $CBquerySQLwhere = "and user='$user'"; + +echo "
USER CALLBACK HOLD LISTINGS: $user\n"; +$oldADD = "ADD=8&user=$user"; +$ADD='82'; +} + +###################### +# ADD=81 find all callbacks on hold within a Campaign +###################### +if ($ADD==81) +{ + if ($LOGmodify_campaigns==1) + { + if ($SUB==89) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where campaign_id='$campaign_id' and status='LIVE' and callback_time < '$past_month_date';"; + $rslt=mysql_query($stmt, $link); + echo "
campaign($campaign_id) callback listings LIVE for more than one month have been made INACTIVE\n"; + } + if ($SUB==899) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where campaign_id='$campaign_id' and status='LIVE' and callback_time < '$past_week_date';"; + $rslt=mysql_query($stmt, $link); + echo "
campaign($campaign_id) callback listings LIVE for more than one week have been made INACTIVE\n"; + } + } +$CBinactiveLINK = "
Remove LIVE Callbacks older than one month for this campaign
Remove LIVE Callbacks older than one week for this campaign
"; + +echo ""; + + $CBquerySQLwhere = "and campaign_id='$campaign_id'"; + +echo "
CAMPAIGN CALLBACK HOLD LISTINGS: $campaign_id\n"; +$oldADD = "ADD=81&campaign_id=$campaign_id"; +$ADD='82'; +} + +###################### +# ADD=811 find all callbacks on hold within a List +###################### +if ($ADD==811) +{ + if ($LOGmodify_lists==1) + { + if ($SUB==89) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where list_id='$list_id' and status='LIVE' and callback_time < '$past_month_date';"; + $rslt=mysql_query($stmt, $link); + echo "
list($list_id) callback listings LIVE for more than one month have been made INACTIVE\n"; + } + if ($SUB==899) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where list_id='$list_id' and status='LIVE' and callback_time < '$past_week_date';"; + $rslt=mysql_query($stmt, $link); + echo "
list($list_id) callback listings LIVE for more than one week have been made INACTIVE\n"; + } + } +$CBinactiveLINK = "
Remove LIVE Callbacks older than one month for this list
Remove LIVE Callbacks older than one week for this list
"; + +echo ""; + + $CBquerySQLwhere = "and list_id='$list_id'"; + +echo "
LIST CALLBACK HOLD LISTINGS: $list_id\n"; +$oldADD = "ADD=811&list_id=$list_id"; +$ADD='82'; +} + +###################### +# ADD=8111 find all callbacks on hold within a user group +###################### +if ($ADD==8111) +{ + if ($LOGmodify_usergroups==1) + { + if ($SUB==89) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where user_group='$user_group' and status='LIVE' and callback_time < '$past_month_date';"; + $rslt=mysql_query($stmt, $link); + echo "
user group($user_group) callback listings LIVE for more than one month have been made INACTIVE\n"; + } + if ($SUB==899) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where user_group='$user_group' and status='LIVE' and callback_time < '$past_week_date';"; + $rslt=mysql_query($stmt, $link); + echo "
user group($user_group) callback listings LIVE for more than one week have been made INACTIVE\n"; + } + } + $CBinactiveLINK = "
Remove LIVE Callbacks older than one month for this user group
Remove LIVE Callbacks older than one week for this user group
"; + + echo ""; + + $CBquerySQLwhere = "and user_group='$user_group'"; + +echo "
USER GROUP CALLBACK HOLD LISTINGS: $list_id\n"; +$oldADD = "ADD=8111&user_group=$user_group"; +$ADD='82'; +} + +###################### +# ADD=82 display all callbacks on hold +###################### +if ($ADD==82) +{ + +$USERlink='stage=USERIDDOWN'; +$GROUPlink='stage=GROUPDOWN'; +$ENDATElink='stage=ENDATEDOWN'; +$SQLorder='order by '; +if (eregi("USERIDDOWN",$stage)) {$SQLorder='order by user desc,'; $USERlink='stage=USERIDUP';} +if (eregi("GROUPDOWN",$stage)) {$SQLorder='order by user_group desc,'; $NAMElink='stage=NAMEUP';} +if (eregi("ENDATEDOWN",$stage)) {$SQLorder='order by entry_time desc,'; $LEVELlink='stage=LEVELUP';} + + $stmt="SELECT * from vicidial_callbacks where status IN('ACTIVE','LIVE') $CBquerySQLwhere $SQLorder recipient,status desc,callback_time"; + $rslt=mysql_query($stmt, $link); + $cb_to_print = mysql_num_rows($rslt); + +echo "
\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $o=0; + while ($cb_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
LEADLIST CAMPAIGNENTRY DATECALLBACK DATEUSERRECIPIENTSTATUSGROUP
$row[1]$row[2]$row[3]$row[5]$row[6]$row[8]$row[9]$row[4]$row[11]
\n"; + +echo "$CBinactiveLINK"; +} + + + +###################################################################################################### +###################################################################################################### +####### 0 series, displays and searches +###################################################################################################### +###################################################################################################### + +###################### +# ADD=0 display all active users +###################### +if ($ADD==0) +{ +echo "
\n"; +echo ""; + +$USERlink='stage=USERIDDOWN'; +$NAMElink='stage=NAMEDOWN'; +$LEVELlink='stage=LEVELDOWN'; +$GROUPlink='stage=GROUPDOWN'; +$SQLorder='order by full_name'; +if (eregi("USERIDUP",$stage)) {$SQLorder='order by user asc'; $USERlink='stage=USERIDDOWN';} +if (eregi("USERIDDOWN",$stage)) {$SQLorder='order by user desc'; $USERlink='stage=USERIDUP';} +if (eregi("NAMEUP",$stage)) {$SQLorder='order by full_name asc'; $NAMElink='stage=NAMEDOWN';} +if (eregi("NAMEDOWN",$stage)) {$SQLorder='order by full_name desc'; $NAMElink='stage=NAMEUP';} +if (eregi("LEVELUP",$stage)) {$SQLorder='order by user_level asc'; $LEVELlink='stage=LEVELDOWN';} +if (eregi("LEVELDOWN",$stage)) {$SQLorder='order by user_level desc'; $LEVELlink='stage=LEVELUP';} +if (eregi("GROUPUP",$stage)) {$SQLorder='order by user_group asc'; $GROUPlink='stage=GROUPDOWN';} +if (eregi("GROUPDOWN",$stage)) {$SQLorder='order by user_group desc'; $GROUPlink='stage=GROUPUP';} + $stmt="SELECT * from vicidial_users $SQLorder"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
USER LISTINGS:\n"; +echo "
\n"; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo "\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
USER IDFULL NAMELEVELGROUPLINKS
$row[1]$row[3]$row[4]$row[5]MODIFY | STATS | STATUS | TIME
\n"; +} + +###################### +# ADD=10 display all campaigns +###################### +if ($ADD==10) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
CAMPAIGN LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2] $row[3]$row[4]$row[5] $row[6]$row[7]  MODIFY
\n"; +} + + +###################### +# ADD=100 display all lists +###################### +if ($ADD==100) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_lists order by list_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
LIST LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2]$row[4]$row[5] $row[3]$row[7]  MODIFY
\n"; +} + + + +###################### +# ADD=1000 display all inbound groups +###################### +if ($ADD==1000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_inbound_groups order by group_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
INBOUND GROUP LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[3] $row[5]  MODIFY
\n"; +} + + +###################### +# ADD=10000 display all remote agents +###################### +if ($ADD==10000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_remote_agents order by server_ip,campaign_id,user_start"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
REMOTE AGENTS LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[1] $row[2] $row[3] $row[4] $row[5] $row[6]MODIFY
\n"; +} + + +###################### +# ADD=100000 display all user groups +###################### +if ($ADD==100000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_user_groups order by user_group"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
USER GROUPS LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]MODIFY
\n"; +} + + +###################### +# ADD=1000000 display all scripts +###################### +if ($ADD==1000000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_scripts order by script_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
SCRIPTS LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]MODIFY
\n"; +} + + +###################### +# ADD=10000000 display all filters +###################### +if ($ADD==10000000) +{ +echo "
\n"; + + echo ""; + + $stmt="SELECT * from vicidial_lead_filters order by lead_filter_id"; + $rslt=mysql_query($stmt, $link); + $filters_to_print = mysql_num_rows($rslt); + +echo "
LEAD FILTER LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($filters_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]MODIFY
\n"; +} + + +###################### +# ADD=100000000 display all call times +###################### +if ($ADD==100000000) +{ +echo "
\n"; + + echo ""; + + $stmt="SELECT * from vicidial_call_times order by call_time_id"; + $rslt=mysql_query($stmt, $link); + $filters_to_print = mysql_num_rows($rslt); + +echo "
CALL TIME LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($filters_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[3] $row[4] MODIFY
\n"; +} + +###################### +# ADD=1000000000 display all state call times +###################### +if ($ADD==1000000000) +{ +echo "
\n"; + + echo ""; + + $stmt="SELECT * from vicidial_state_call_times order by state_call_time_id"; + $rslt=mysql_query($stmt, $link); + $filters_to_print = mysql_num_rows($rslt); + +echo "
STATE CALL TIME LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($filters_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2] $row[3] $row[4] MODIFY
\n"; +} + +###################### +# ADD=10000000000 display all phones +###################### +if ($ADD==10000000000) +{ +echo "
\n"; +echo ""; + +$EXTENlink='stage=EXTENDOWN'; +$PROTOlink='stage=PROTODOWN'; +$SERVERlink='stage=SERVERDOWN'; +$STATUSlink='stage=STATUSDOWN'; +$SQLorder='order by extension,server_ip'; +if (eregi("EXTENUP",$stage)) {$SQLorder='order by extension asc'; $EXTENlink='stage=EXTENDOWN';} +if (eregi("EXTENDOWN",$stage)) {$SQLorder='order by extension desc'; $EXTENlink='stage=EXTENUP';} +if (eregi("PROTOUP",$stage)) {$SQLorder='order by protocol asc'; $PROTOlink='stage=PROTODOWN';} +if (eregi("PROTODOWN",$stage)) {$SQLorder='order by protocol desc'; $PROTOlink='stage=PROTOUP';} +if (eregi("SERVERUP",$stage)) {$SQLorder='order by server_ip asc'; $SERVERlink='stage=SERVERDOWN';} +if (eregi("SERVERDOWN",$stage)) {$SQLorder='order by server_ip desc'; $SERVERlink='stage=SERVERUP';} +if (eregi("STATUSUP",$stage)) {$SQLorder='order by status asc'; $STATUSlink='stage=STATUSDOWN';} +if (eregi("STATUSDOWN",$stage)) {$SQLorder='order by status desc'; $STATUSlink='stage=STATUSUP';} + $stmt="SELECT * from phones $SQLorder"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
PHONE LISTINGS:\n"; +echo "
\n"; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo "\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
EXTENPROTOSERVERDIAL PLANSTATUSNAMEVMAILLINKS
$row[0]$row[16]$row[5]$row[1]$row[2]$row[8]$row[11]$row[14]$row[15]MODIFY | STATS
\n"; +} + +###################### +# ADD=100000000000 display all servers +###################### +if ($ADD==100000000000) +{ +echo "\n";echo "\n"; +$stmt="SELECT admin_home_url from system_settings;"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$admin_home_url_LU = $row[0]; + +?> +
+
\n"; + echo ""; + + $stmt="SELECT * from servers order by server_id"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
SERVER LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0]$row[1] $row[2] $row[4] $row[3]  MODIFY
\n"; +} + +###################### +# ADD=1000000000000 display all conferences +###################### +if ($ADD==1000000000000) +{ +echo "\r\n"; + print " \r\n"; + } + $rec_count++; + } +$sthA->finish(); + +exit; diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/listloader_super.pl b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/listloader_super.pl new file mode 100644 index 00000000..167fff5e --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/listloader_super.pl @@ -0,0 +1,1086 @@ +#!/usr/bin/perl + +### listloader_super.pl version 0.4 *DBI-version* +### +### Copyright (C) 2007 Matt Florell,Joe Johnson LICENSE: GPLv2 +### +# +# +# CHANGES +# 60616-1548 - Added listID override feature to force all leads into same list +# - Added gmt_offset_now lookup for each lead +# 60811-1232 - Changed to DBI +# 60811-1329 - changed to use /etc/astguiclient.conf for configs +# 60906-1056 - added filter of non-digits in alt_phone field +# 61110-1229 - added new USA-Canada DST scheme and Brazil DST scheme +# 61128-1207 - added postal code GMT lookup and duplicate check options +# 70205-1703 - Defaulted phone_code to 1 if not populated +# 70417-1059 - Fixed default phone_code bug +# 70510-1518 - Added campaign and system duplicate check and phonecode override +# + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help|-h/i) + { + print "allowed run time options:\n [-forcelistid=1234] = overrides the listID given in the file with the 1234\n [-h] = this help screen\n\n"; + + exit; + } + else + { + if ($args =~ /-duplicate-check/i) + {$dupcheck=1;} + if ($args =~ /-duplicate-campaign-check/i) + {$dupcheckcamp=1;} + if ($args =~ /-duplicate-system-check/i) + {$dupchecksys=1;} + if ($args =~ /-postal-code-gmt/i) + {$postalgmt=1;} + if ($args =~ /--forcelistid=/i) + { + @data_in = split(/--forcelistid=/,$args); + $forcelistid = $data_in[1]; + $forcelistid =~ s/ .*//gi; + print "\n----- FORCE LISTID OVERRIDE: $forcelistid -----\n\n"; + } + else + {$forcelistid = '';} + + if ($args =~ /--forcephonecode=/i) + { + @data_in = split(/--forcephonecode=/,$args); + $forcephonecode = $data_in[1]; + $forcephonecode =~ s/ .*//gi; + print "\n----- FORCE PHONECODE OVERRIDE: $forcephonecode -----\n\n"; + } + else + {$forcephonecode = '';} + + if ($args =~ /--lead-file=/i) + { + @data_in = split(/--lead-file=/,$args); + $lead_file = $data_in[1]; + $lead_file =~ s/ .*//gi; + # print "\n----- LEAD FILE: $lead_file -----\n\n"; + } + else + {$lead_file = './vicidial_temp_file.xls';} + } +} +### end parsing run-time options ### + +use Spreadsheet::ParseExcel; +use Time::Local; +use DBI; + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + +$vars=$ARGV[0]; +@xls_fields=split(/\,/, $vars); + +$|=0; +$secX = time(); + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($hour < 10) {$hour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +$pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; +$pulldate="$year-$mon-$mday $hour:$min:$sec"; +$inSD = $pulldate0; +$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + + ### Grab Server values from the database + $stmtA = "SELECT local_gmt FROM servers where server_ip = '$server_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBSERVER_GMT = "$aryA[0]"; + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + $rec_count++; + } + $sthA->finish(); + + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + +if ($isdst) {$LOCAL_GMT_OFF++;} +if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";} + + + +$total=0; $good=0; $bad=0; +open(STMT_FILE, "> $PATHlogs/listloader_stmts.txt"); + +$oBook = Spreadsheet::ParseExcel::Workbook->Parse("$lead_file"); +my($iR, $iC, $oWkS, $oWkC); + +foreach $oWkS (@{$oBook->{Worksheet}}) { + for($iR = 0 ; defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow} ; $iR++) { + + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user = ""; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[0]]; + if ($oWkC) {$vendor_lead_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[1]]; + if ($oWkC) {$source_code=$oWkC->Value; } + $source_id=$source_code; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[2]]; + if ($oWkC) {$list_id=$oWkC->Value; } + $gmt_offset = '0'; + $called_since_last_reset='N'; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[3]]; + if ($oWkC) {$phone_code=$oWkC->Value; } + $phone_code=~s/[^0-9]//g; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[4]]; + if ($oWkC) {$phone_number=$oWkC->Value; } + $phone_number=~s/[^0-9]//g; + $USarea = substr($phone_number, 0, 3); + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[5]]; + if ($oWkC) {$title=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[6]]; + if ($oWkC) {$first_name=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[7]]; + if ($oWkC) {$middle_initial=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[8]]; + if ($oWkC) {$last_name=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[9]]; + if ($oWkC) {$address1=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[10]]; + if ($oWkC) {$address2=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[11]]; + if ($oWkC) {$address3=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[12]]; + if ($oWkC) {$city=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[13]]; + if ($oWkC) {$state=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[14]]; + if ($oWkC) {$province=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[15]]; + if ($oWkC) {$postal_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[16]]; + if ($oWkC) {$country_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[17]]; + if ($oWkC) {$gender=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[18]]; + if ($oWkC) {$date_of_birth=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[19]]; + if ($oWkC) {$alt_phone=$oWkC->Value; } + $alt_phone=~s/[^0-9]//g; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[20]]; + if ($oWkC) {$email=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[21]]; + if ($oWkC) {$security_phrase=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[22]]; + if ($oWkC) {$comments=$oWkC->Value; } + $comments=~s/^\s*(.*?)\s*$/$1/; + + + + if (length($forcelistid) > 0) + { + $list_id = $forcelistid; # set list_id to override value + } + if (length($forcephonecode) > 0) + { + $phone_code = $forcephonecode; # set phone_code to override value + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if ($dupchecksys > 0) + { + $dup_lead=0; + $stmtA = "select count(*) from vicidial_list where phone_number='$phone_number';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $dup_lead = $aryA[0]; + $dup_lead_list=$list_id; + } + $sthA->finish(); + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if ($dupcheck > 0) + { + $dup_lead=0; + $stmtA = "select list_id from vicidial_list where phone_number='$phone_number' and list_id='$list_id' limit 1;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $dup_lead_list = $aryA[0]; + $dup_lead++; + } + $sthA->finish(); + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if ($dupcheckcamp > 0) + { + $dup_lead=0; + $dup_lists=''; + + $stmtA = "select count(*) from vicidial_lists where list_id='$list_id';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + @aryA = $sthA->fetchrow_array; + $ci_recs = $aryA[0]; + $sthA->finish(); + if ($ci_recs > 0) + { + $stmtA = "select campaign_id from vicidial_lists where list_id='$list_id';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + @aryA = $sthA->fetchrow_array; + $dup_camp = $aryA[0]; + $sthA->finish(); + + $stmtA = "select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $dup_lists .= "'$aryA[0]',"; + $rec_count++; + } + $sthA->finish(); + + chop($dup_lists); + $stmtA = "select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $dup_lead_list = "'$aryA[0]',"; + $rec_count++; + $dup_lead=1; + } + $sthA->finish(); + } + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + + if ( (length($phone_number)>6) && ($dup_lead < 1) ) + { + $phone_list .= "$phone_number$US$list_id|"; + $postalgmt_found=0; + if (length($phone_code)<1) {$phone_code = '1';} + + if ( ($postalgmt > 0) && (length($postal_code)>4) ) + { + if ($phone_code =~ /^1$/) + { + $stmtA = "select * from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[2]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[3]; + $dst_range = $aryA[4]; + $PC_processed++; + $rec_count++; + $postalgmt_found++; + if ($DBX) {print " Postal GMT record found for $postal_code: |$gmt_offset|$dst|$dst_range|\n";} + } + $sthA->finish(); + } + } + if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =~ /^1$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### MEXICO ### + if ($phone_code =~ /^52$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### AUSTRALIA ### + if ($phone_code =~ /^61$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + } + + ### Find out if DST to raise the gmt offset ### + $AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); + $AC_localtime = ($secX + (3600 * $AC_GMT_diff)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($AC_localtime); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + + if ( (!$AC_processed) && ($dst_range =~ /SSM-FSN/) ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + &USACAN_dstcalc; + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSA-LSO/) ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + &NA_dstcalc; + if ($DBX) {print " DST: $NA_DST\n";} + if ($NA_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /LSM-LSO/) ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + &GBR_dstcalc; + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /LSO-LSM/) ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + &AUS_dstcalc; + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSO-LSM/) ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + &AUST_dstcalc; + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSO-TSM/) ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + &NZL_dstcalc; + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /TSO-LSF/) ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + &BZL_dstcalc; + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$area_GMT++;} + $AC_processed++; + } + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $affected_rows = $dbhA->do($stmtZ); + print STMT_FILE $stmtZ."\r\n"; + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| $dup_lead_list\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + sleep(1); +# flush(); + } + } +} + +if ($multi_insert_counter > 0) { + $stmtZ = "INSERT INTO vicidial_list values ".substr($multistmt, 0, -1).";"; + $affected_rows = $dbhA->do($stmtZ); + print STMT_FILE $stmtZ."\r\n"; +} + +print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total"; + +exit; + + + + + + +sub USACAN_dstcalc { +#********************************************************************** +# SSM-FSN +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on Second Sunday March to First Sunday November at 2 am. +# INPUTS: +# mm INTEGER Month. +# dd INTEGER Day of the month. +# ns INTEGER Seconds into the day. +# dow INTEGER Day of week (0=Sunday, to 6=Saturday) +# OPTIONAL INPUT: +# timezone INTEGER hour difference UTC - local standard time +# (DEFAULT is blank) +# make calculations based on UTC time, +# which means shift at 10:00 UTC in April +# and 9:00 UTC in October +# OUTPUT: +# INTEGER 1 = DST, 0 = not DST +# +# S M T W T F S +# 1 2 3 4 5 6 7 +# 8 9 10 11 12 13 14 +#15 16 17 18 19 20 21 +#22 23 24 25 26 27 28 +#29 30 31 +# +# S M T W T F S +# 1 2 3 4 5 6 +# 7 8 9 10 11 12 13 +#14 15 16 17 18 19 20 +#21 22 23 24 25 26 27 +#28 29 30 31 +# +#********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; return 0; + } elsif ($mm >= 4 && $mm <= 10) { + $USACAN_DST=1; return 1; + } elsif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; return 1; + } elsif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; return 0; + } else { + $USACAN_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $USACAN_DST=0; return 0; + } else { + $USACAN_DST=1; return 1; + } + } + } else { + $USACAN_DST=0; return 0; + } + } elsif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; return 0; + } elsif ($dd < ($dow+1)) { + $USACAN_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; return 1; + } else { + $USACAN_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; return 1; + } else { + $USACAN_DST=0; return 0; + } + } + } else { + $USACAN_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub NA_dstcalc { +#********************************************************************** +# FSA-LSO +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in April and last Sunday in October at 2 am. +#********************************************************************** + + $NA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $NA_DST=0; return 0; + } elsif ($mm >= 5 && $mm <= 9) { + $NA_DST=1; return 1; + } elsif ($mm == 4) { + if ($dd > 7) { + $NA_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $NA_DST=0; return 0; + } else { + $NA_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $NA_DST=0; return 0; + } else { + $NA_DST=1; return 1; + } + } + } else { + $NA_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $NA_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $NA_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $NA_DST=1; return 1; + } else { + $NA_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 7200) { + $NA_DST=1; return 1; + } else { + $NA_DST=0; return 0; + } + } + } else { + $NA_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub GBR_dstcalc { +#********************************************************************** +# LSM-LSO +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in March and last Sunday in October at 1 am. +#********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; return 0; + } elsif ($mm >= 4 && $mm <= 9) { + $GBR_DST=1; return 1; + } elsif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $GBR_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; return 0; + } else { + $GBR_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; return 0; + } else { + $GBR_DST=1; return 1; + } + } + } else { + $GBR_DST=1; return 1; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $GBR_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; return 1; + } else { + $GBR_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; return 1; + } else { + $GBR_DST=0; return 0; + } + } + } else { + $GBR_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub AUS_dstcalc { +#********************************************************************** +# LSO-LSM +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in October and last Sunday in March at 1 am. +#********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $AUS_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $AUS_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; return 1; + } else { + $AUS_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; return 1; + } else { + $AUS_DST=0; return 0; + } + } + } else { + $AUS_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $AUS_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; return 0; + } else { + $AUS_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; return 0; + } else { + $AUS_DST=1; return 1; + } + } + } else { + $AUS_DST=1; return 1; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub AUST_dstcalc { +#********************************************************************** +# FSO-LSM +# TASMANIA ONLY +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and last Sunday in March at 1 am. +#********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $AUST_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $AUST_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; return 1; + } else { + $AUST_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; return 1; + } else { + $AUST_DST=0; return 0; + } + } + } else { + $AUST_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd >= 8) { + $AUST_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $AUST_DST=0; return 0; + } else { + $AUST_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $AUST_DST=0; return 0; + } else { + $AUST_DST=1; return 1; + } + } + } else { + $AUST_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub NZL_dstcalc { +#********************************************************************** +# FSO-TSM +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and third Sunday in March at 1 am. +#********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $NZL_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; return 1; + } elsif ($dd < ($dow+14)) { + $NZL_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; return 1; + } else { + $NZL_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; return 1; + } else { + $NZL_DST=0; return 0; + } + } + } else { + $NZL_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd >= 8) { + $NZL_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $NZL_DST=0; return 0; + } else { + $NZL_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $NZL_DST=0; return 0; + } else { + $NZL_DST=1; return 1; + } + } + } else { + $NZL_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub BZL_dstcalc { +#********************************************************************** +# TSO-LSF +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. Brazil +# Based on Third Sunday October to Last Sunday February at 1 am. +#********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; return 1; + } elsif ($mm >= 3 && $mm <= 9) { + $BZL_DST=0; return 0; + } elsif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; return 1; + } elsif ($dd < ($dow+22)) { + $BZL_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; return 1; + } else { + $BZL_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; return 1; + } else { + $BZL_DST=0; return 0; + } + } + } else { + $BZL_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; return 0; + } elsif ($dd < ($dow+22)) { + $BZL_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; return 0; + } else { + $BZL_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; return 0; + } else { + $BZL_DST=1; return 1; + } + } + } else { + $BZL_DST=1; return 1; + } + } # end of month checks +} # end of subroutine dstcalc diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/log_test.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/log_test.php new file mode 100644 index 00000000..cd7a86b7 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/log_test.php @@ -0,0 +1,37 @@ + LICENSE: GPLv2 +# + + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_datetime = $STARTtime; + +$ext_context = 'demo'; +if (!isset($begin_date)) {$begin_date = $TODAY;} +if (!isset($end_date)) {$end_date = $TODAY;} + + +$fp = fopen ("./closer_SQL_updates.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + fwrite ($fp, "CLOSER SQL UPDATE|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + + +exit; + + + +?> + + +Hello + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/new_listloader_superL.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/new_listloader_superL.php new file mode 100644 index 00000000..629321ed --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/new_listloader_superL.php @@ -0,0 +1,2069 @@ + LICENSE: GPLv2 +# +# AST GUI lead loader from formatted file +# +# CHANGES +# 50602-1640 - First version created by Joe Johnson +# 51128-1108 - Removed PHP global vars requirement +# 60113-1603 - Fixed a few bugs in Excel import +# 60421-1624 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60616-1240 - added listID override +# 60616-1604 - added gmt lookup for each lead +# 60619-1651 - Added variable filtering to eliminate SQL injection attack threat +# 60822-1121 - fixed for nonwritable directories +# 60906-1100 - added filter of non-digits in alt_phone field +# 61110-1222 - added new USA-Canada DST scheme and Brazil DST scheme +# 61128-1149 - added postal code GMT lookup and duplicate check options +# 70417-1059 - Fixed default phone_code bug +# 70510-1518 - Added campaign and system duplicate check and phonecode override +# +# make sure vicidial_list exists and that your file follows the formatting correctly. This page does not dedupe or do any other lead filtering actions yet at this time. + +$version = '2.0.4'; +$build = '70510-1518'; + + +require("dbconnect.php"); + +### links used for testing +#$link=mysql_connect("10.10.10.15", "cron", "1234"); +#mysql_select_db("asterisk"); +#$WeBServeRRooT = '/home/www/htdocs'; + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$leadfile=$_FILES["leadfile"]; + $LF_orig = $_FILES['leadfile']['name']; + $LF_path = $_FILES['leadfile']['tmp_name']; +if (isset($_GET["submit_file"])) {$submit_file=$_GET["submit_file"];} + elseif (isset($_POST["submit_file"])) {$submit_file=$_POST["submit_file"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["leadfile_name"])) {$leadfile_name=$_GET["leadfile_name"];} + elseif (isset($_POST["leadfile_name"])) {$leadfile_name=$_POST["leadfile_name"];} +if (isset($_GET["file_layout"])) {$file_layout=$_GET["file_layout"];} + elseif (isset($_POST["file_layout"])) {$file_layout=$_POST["file_layout"];} +if (isset($_GET["OK_to_process"])) {$OK_to_process=$_GET["OK_to_process"];} + elseif (isset($_POST["OK_to_process"])) {$OK_to_process=$_POST["OK_to_process"];} +if (isset($_GET["vendor_lead_code_field"])) {$vendor_lead_code_field=$_GET["vendor_lead_code_field"];} + elseif (isset($_POST["vendor_lead_code_field"])) {$vendor_lead_code_field=$_POST["vendor_lead_code_field"];} +if (isset($_GET["source_id_field"])) {$source_id_field=$_GET["source_id_field"];} + elseif (isset($_POST["source_id_field"])) {$source_id_field=$_POST["source_id_field"];} +if (isset($_GET["list_id_field"])) {$list_id_field=$_GET["list_id_field"];} + elseif (isset($_POST["list_id_field"])) {$list_id_field=$_POST["list_id_field"];} +if (isset($_GET["phone_code_field"])) {$phone_code_field=$_GET["phone_code_field"];} + elseif (isset($_POST["phone_code_field"])) {$phone_code_field=$_POST["phone_code_field"];} +if (isset($_GET["phone_number_field"])) {$phone_number_field=$_GET["phone_number_field"];} + elseif (isset($_POST["phone_number_field"])) {$phone_number_field=$_POST["phone_number_field"];} +if (isset($_GET["title_field"])) {$title_field=$_GET["title_field"];} + elseif (isset($_POST["title_field"])) {$title_field=$_POST["title_field"];} +if (isset($_GET["first_name_field"])) {$first_name_field=$_GET["first_name_field"];} + elseif (isset($_POST["first_name_field"])) {$first_name_field=$_POST["first_name_field"];} +if (isset($_GET["middle_initial_field"])) {$middle_initial_field=$_GET["middle_initial_field"];} + elseif (isset($_POST["middle_initial_field"])) {$middle_initial_field=$_POST["middle_initial_field"];} +if (isset($_GET["last_name_field"])) {$last_name_field=$_GET["last_name_field"];} + elseif (isset($_POST["last_name_field"])) {$last_name_field=$_POST["last_name_field"];} +if (isset($_GET["address1_field"])) {$address1_field=$_GET["address1_field"];} + elseif (isset($_POST["address1_field"])) {$address1_field=$_POST["address1_field"];} +if (isset($_GET["address2_field"])) {$address2_field=$_GET["address2_field"];} + elseif (isset($_POST["address2_field"])) {$address2_field=$_POST["address2_field"];} +if (isset($_GET["address3_field"])) {$address3_field=$_GET["address3_field"];} + elseif (isset($_POST["address3_field"])) {$address3_field=$_POST["address3_field"];} +if (isset($_GET["city_field"])) {$city_field=$_GET["city_field"];} + elseif (isset($_POST["city_field"])) {$city_field=$_POST["city_field"];} +if (isset($_GET["state_field"])) {$state_field=$_GET["state_field"];} + elseif (isset($_POST["state_field"])) {$state_field=$_POST["state_field"];} +if (isset($_GET["province_field"])) {$province_field=$_GET["province_field"];} + elseif (isset($_POST["province_field"])) {$province_field=$_POST["province_field"];} +if (isset($_GET["postal_code_field"])) {$postal_code_field=$_GET["postal_code_field"];} + elseif (isset($_POST["postal_code_field"])) {$postal_code_field=$_POST["postal_code_field"];} +if (isset($_GET["country_code_field"])) {$country_code_field=$_GET["country_code_field"];} + elseif (isset($_POST["country_code_field"])) {$country_code_field=$_POST["country_code_field"];} +if (isset($_GET["gender_field"])) {$gender_field=$_GET["gender_field"];} + elseif (isset($_POST["gender_field"])) {$gender_field=$_POST["gender_field"];} +if (isset($_GET["date_of_birth_field"])) {$date_of_birth_field=$_GET["date_of_birth_field"];} + elseif (isset($_POST["date_of_birth_field"])) {$date_of_birth_field=$_POST["date_of_birth_field"];} +if (isset($_GET["alt_phone_field"])) {$alt_phone_field=$_GET["alt_phone_field"];} + elseif (isset($_POST["alt_phone_field"])) {$alt_phone_field=$_POST["alt_phone_field"];} +if (isset($_GET["email_field"])) {$email_field=$_GET["email_field"];} + elseif (isset($_POST["email_field"])) {$email_field=$_POST["email_field"];} +if (isset($_GET["security_phrase_field"])) {$security_phrase_field=$_GET["security_phrase_field"];} + elseif (isset($_POST["security_phrase_field"])) {$security_phrase_field=$_POST["security_phrase_field"];} +if (isset($_GET["comments_field"])) {$comments_field=$_GET["comments_field"];} + elseif (isset($_POST["comments_field"])) {$comments_field=$_POST["comments_field"];} +if (isset($_GET["list_id_override"])) {$list_id_override=$_GET["list_id_override"];} + elseif (isset($_POST["list_id_override"])) {$list_id_override=$_POST["list_id_override"];} + $list_id_override = (preg_replace("/\D/","",$list_id_override)); +if (isset($_GET["lead_file"])) {$lead_file=$_GET["lead_file"];} + elseif (isset($_POST["lead_file"])) {$lead_file=$_POST["lead_file"];} +if (isset($_GET["dupcheck"])) {$dupcheck=$_GET["dupcheck"];} + elseif (isset($_POST["dupcheck"])) {$dupcheck=$_POST["dupcheck"];} +if (isset($_GET["postalgmt"])) {$postalgmt=$_GET["postalgmt"];} + elseif (isset($_POST["postalgmt"])) {$postalgmt=$_POST["postalgmt"];} +if (isset($_GET["phone_code_override"])) {$phone_code_override=$_GET["phone_code_override"];} + elseif (isset($_POST["phone_code_override"])) {$phone_code_override=$_POST["phone_code_override"];} + $phone_code_override = (preg_replace("/\D/","",$phone_code_override)); + +# $country_field=$_GET["country_field"]; if (!$country_field) {$country_field=$_POST["country_field"];} + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); +$list_id_override = ereg_replace("[^0-9]","",$list_id_override); + + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_datetime = $STARTtime; + +$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +if ($WeBRooTWritablE > 0) {$fp = fopen ("./project_auth_entries.txt", "a");} +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-LEAD-LOADER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT load_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGload_leads =$row[0]; + + if ($LOGload_leads < 1) + { + echo "You do not have permissions to load leads\n"; + exit; + } + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "LIST_LOAD|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "LIST_LOAD|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + + +$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://';} +$admDIR = "$HTTPprotocol$server_name$script_name"; +$admDIR = eregi_replace('new_listloader_superL.php','',$admDIR); +$admSCR = 'admin.php'; +$NWB = "   \"HELP\""; + +$secX = date("U"); +$hour = date("H"); +$min = date("i"); +$sec = date("s"); +$mon = date("m"); +$mday = date("d"); +$year = date("Y"); +$isdst = date("I"); +$Shour = date("H"); +$Smin = date("i"); +$Ssec = date("s"); +$Smon = date("m"); +$Smday = date("d"); +$Syear = date("Y"); +$pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; +$inSD = $pulldate0; +$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + ### Grab Server GMT value from the database + $stmt="SELECT local_gmt FROM servers where server_ip = '$server_ip';"; + $rslt=mysql_query($stmt, $link); + $gmt_recs = mysql_num_rows($rslt); + if ($gmt_recs > 0) + { + $row=mysql_fetch_row($rslt); + $DBSERVER_GMT = "$row[0]"; + if (strlen($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;} + if ($isdst) {$SERVER_GMT++;} + } + else + { + $SERVER_GMT = date("O"); + $SERVER_GMT = eregi_replace("\+","",$SERVER_GMT); + $SERVER_GMT = ($SERVER_GMT + 0); + $SERVER_GMT = ($SERVER_GMT / 100); + } + + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + +#if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";} + + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +function macfontfix($fontsize) { + + $browser = getenv("HTTP_USER_AGENT"); + $pctype = explode("(", $browser); + if (ereg("Mac",$pctype[1])) { + /* Browser is a Mac. If not Netscape 6, raise fonts */ + + $blownbrowser = explode('/', $browser); + $ver = explode(' ', $blownbrowser[1]); + $ver = $ver[0]; + if ($ver >= 5.0) return $fontsize; else return ($fontsize+2); + + } else return $fontsize; /* Browser is not a Mac - don't touch fonts */ +} + +echo "\n"; + +?> + + + +VICIDIAL ADMIN: Lead Loader + + +
method=post onSubmit="ParseFileName()" enctype="multipart/form-data"> + + +
\n"; + echo ""; + + $stmt="SELECT * from conferences order by conf_exten"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
CONFERENCE LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2]$row[4]  MODIFY
\n"; +} + +###################### +# ADD=10000000000000 display all vicidial conferences +###################### +if ($ADD==10000000000000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_conferences order by conf_exten"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
CONFERENCE LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2]$row[4]  MODIFY
\n"; +} + +###################### +# ADD=999999 display reports section +###################### +if ($ADD==999999) +{ + if ($LOGview_reports==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_conferences order by conf_exten"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + + $stmt="select * from servers;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $servers_to_print = mysql_num_rows($rslt); + $i=0; + while ($i < $servers_to_print) + { + $row=mysql_fetch_row($rslt); + $server_id[$i] = $row[0]; + $server_description[$i] = $row[1]; + $server_ip[$i] = $row[2]; + $active[$i] = $row[3]; + $i++; + } + + $stmt="SELECT enable_queuemetrics_logging,queuemetrics_url from system_settings;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $enable_queuemetrics_logging_LU = $row[0]; + $queuemetrics_url_LU = $row[1]; + + ?> + + + + + + VICIDIAL: Server Stats and Reports + VICIDIAL: Server Stats and Reports

+ +

+	
+	 $o)
+		{
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		$o++;
+		}
+
+	echo "
SERVERDESCRIPTIONIP ADDRESSACTIVEVDAD timePARK timeCLOSER/INBOUND time
$server_id[$o]$server_description[$o]$server_ip[$o]$active[$o]LINKLINKLINK
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + + + + +echo "
\n"; + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n
\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds"; +echo "                   VERSION: $admin_version"; +echo "                   BUILD: $build
\n"; + + +?> + + +
+ + + +1) + { + if (strlen($dial_statuses)>2) + { + $g=0; + $p='13'; + $GMT_gmt[0] = ''; + $GMT_hour[0] = ''; + $GMT_day[0] = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $pmin=(gmdate("i", time() + $pzone)); + $phour=( (gmdate("G", time() + $pzone)) * 100); + $pday=gmdate("w", time() + $pzone); + $tz = sprintf("%.2f", $p); + $GMT_gmt[$g] = "$tz"; + $GMT_day[$g] = "$pday"; + $GMT_hour[$g] = ($phour + $pmin); + $p = ($p - 0.25); + $g++; + } + + $stmt="SELECT * FROM vicidial_call_times where call_time_id='$local_call_time';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $Gct_default_start = "$rowx[3]"; + $Gct_default_stop = "$rowx[4]"; + $Gct_sunday_start = "$rowx[5]"; + $Gct_sunday_stop = "$rowx[6]"; + $Gct_monday_start = "$rowx[7]"; + $Gct_monday_stop = "$rowx[8]"; + $Gct_tuesday_start = "$rowx[9]"; + $Gct_tuesday_stop = "$rowx[10]"; + $Gct_wednesday_start = "$rowx[11]"; + $Gct_wednesday_stop = "$rowx[12]"; + $Gct_thursday_start = "$rowx[13]"; + $Gct_thursday_stop = "$rowx[14]"; + $Gct_friday_start = "$rowx[15]"; + $Gct_friday_stop = "$rowx[16]"; + $Gct_saturday_start = "$rowx[17]"; + $Gct_saturday_stop = "$rowx[18]"; + $Gct_state_call_times = "$rowx[19]"; + + $ct_states = ''; + $ct_state_gmt_SQL = ''; + $ct_srs=0; + $b=0; + if (strlen($Gct_state_call_times)>2) + { + $state_rules = explode('|',$Gct_state_call_times); + $ct_srs = ((count($state_rules)) - 2); + } + while($ct_srs >= $b) + { + if (strlen($state_rules[$b])>1) + { + $stmt="SELECT * from vicidial_state_call_times where state_call_time_id='$state_rules[$b]';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Gstate_call_time_id = "$row[0]"; + $Gstate_call_time_state = "$row[1]"; + $Gsct_default_start = "$row[4]"; + $Gsct_default_stop = "$row[5]"; + $Gsct_sunday_start = "$row[6]"; + $Gsct_sunday_stop = "$row[7]"; + $Gsct_monday_start = "$row[8]"; + $Gsct_monday_stop = "$row[9]"; + $Gsct_tuesday_start = "$row[10]"; + $Gsct_tuesday_stop = "$row[11]"; + $Gsct_wednesday_start = "$row[12]"; + $Gsct_wednesday_stop = "$row[13]"; + $Gsct_thursday_start = "$row[14]"; + $Gsct_thursday_stop = "$row[15]"; + $Gsct_friday_start = "$row[16]"; + $Gsct_friday_stop = "$row[17]"; + $Gsct_saturday_start = "$row[18]"; + $Gsct_saturday_stop = "$row[19]"; + + $ct_states .="'$Gstate_call_time_state',"; + + $r=0; + $state_gmt=''; + while($r < $g) + { + if ($GMT_day[$r]==0) #### Sunday local time + { + if (($Gsct_sunday_start==0) and ($Gsct_sunday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_sunday_start) and ($GMT_hour[$r]<$Gsct_sunday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==1) #### Monday local time + { + if (($Gsct_monday_start==0) and ($Gsct_monday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_monday_start) and ($GMT_hour[$r]<$Gsct_monday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==2) #### Tuesday local time + { + if (($Gsct_tuesday_start==0) and ($Gsct_tuesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_tuesday_start) and ($GMT_hour[$r]<$Gsct_tuesday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==3) #### Wednesday local time + { + if (($Gsct_wednesday_start==0) and ($Gsct_wednesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_wednesday_start) and ($GMT_hour[$r]<$Gsct_wednesday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==4) #### Thursday local time + { + if (($Gsct_thursday_start==0) and ($Gsct_thursday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_thursday_start) and ($GMT_hour[$r]<$Gsct_thursday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==5) #### Friday local time + { + if (($Gsct_friday_start==0) and ($Gsct_friday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_friday_start) and ($GMT_hour[$r]<$Gsct_friday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==6) #### Saturday local time + { + if (($Gsct_saturday_start==0) and ($Gsct_saturday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_saturday_start) and ($GMT_hour[$r]<$Gsct_saturday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + $r++; + } + $state_gmt = "$state_gmt'99'"; + $ct_state_gmt_SQL .= "or (state='$Gstate_call_time_state' and gmt_offset_now IN($state_gmt)) "; + } + + $b++; + } + if (strlen($ct_states)>2) + { + $ct_states = eregi_replace(",$",'',$ct_states); + $ct_statesSQL = "and state NOT IN($ct_states)"; + } + else + { + $ct_statesSQL = ""; + } + + $r=0; + $default_gmt=''; + while($r < $g) + { + if ($GMT_day[$r]==0) #### Sunday local time + { + if (($Gct_sunday_start==0) and ($Gct_sunday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_sunday_start) and ($GMT_hour[$r]<$Gct_sunday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==1) #### Monday local time + { + if (($Gct_monday_start==0) and ($Gct_monday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_monday_start) and ($GMT_hour[$r]<$Gct_monday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==2) #### Tuesday local time + { + if (($Gct_tuesday_start==0) and ($Gct_tuesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_tuesday_start) and ($GMT_hour[$r]<$Gct_tuesday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==3) #### Wednesday local time + { + if (($Gct_wednesday_start==0) and ($Gct_wednesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_wednesday_start) and ($GMT_hour[$r]<$Gct_wednesday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==4) #### Thursday local time + { + if (($Gct_thursday_start==0) and ($Gct_thursday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_thursday_start) and ($GMT_hour[$r]<$Gct_thursday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==5) #### Friday local time + { + if (($Gct_friday_start==0) and ($Gct_friday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_friday_start) and ($GMT_hour[$r]<$Gct_friday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==6) #### Saturday local time + { + if (($Gct_saturday_start==0) and ($Gct_saturday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_saturday_start) and ($GMT_hour[$r]<$Gct_saturday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + $r++; + } + + $default_gmt = "$default_gmt'99'"; + $all_gmtSQL = "(gmt_offset_now IN($default_gmt) $ct_statesSQL) $ct_state_gmt_SQL"; + + + $dial_statuses = preg_replace("/ -$/","",$dial_statuses); + $Dstatuses = explode(" ", $dial_statuses); + $Ds_to_print = (count($Dstatuses) - 0); + $Dsql = ''; + $o=0; + while ($Ds_to_print > $o) + { + $o++; + $Dsql .= "'$Dstatuses[$o]',"; + } + $Dsql = preg_replace("/,$/","",$Dsql); + + $stmt="SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN($Dsql) and list_id IN($camp_lists) and ($all_gmtSQL) $fSQL"; + #$DB=1; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rslt_rows = mysql_num_rows($rslt); + if ($rslt_rows) + { + $rowx=mysql_fetch_row($rslt); + $active_leads = "$rowx[0]"; + } + else {$active_leads = '0';} + + echo "|$DB|\n"; + echo "This campaign has $active_leads leads to be dialed in those lists\n"; + } + else + { + echo "no dial statuses selected for this campaign\n"; + } + } + else + { + echo "no active lists selected for this campaign\n"; + } + } +else + { + echo "no active lists selected for this campaign\n"; + } +##### END calculate what gmt_offset_now values are within the allowed local_call_time setting ### +} +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/admin_modify_lead.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/admin_modify_lead.php new file mode 100644 index 00000000..f8a285ec --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/admin_modify_lead.php @@ -0,0 +1,610 @@ + LICENSE: GPLv2 +# + +# CHANGES +# +# 70702-1259 - Added recording location link and truncation +# 70906-2132 - Added closer_log records display +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} +if (isset($_GET["phone"])) {$phone=$_GET["phone"];} + elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];} + elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];} +if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];} + elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];} +if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];} + elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];} +if (isset($_GET["end_call"])) {$end_call=$_GET["end_call"];} + elseif (isset($_POST["end_call"])) {$end_call=$_POST["end_call"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];} + elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];} + elseif (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["call_began"])) {$call_began=$_GET["call_began"];} + elseif (isset($_POST["call_began"])) {$call_began=$_POST["call_began"];} +if (isset($_GET["parked_time"])) {$parked_time=$_GET["parked_time"];} + elseif (isset($_POST["parked_time"])) {$parked_time=$_POST["parked_time"];} +if (isset($_GET["tsr"])) {$tsr=$_GET["tsr"];} + elseif (isset($_POST["tsr"])) {$tsr=$_POST["tsr"];} +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["postal_code"])) {$postal_code=$_GET["postal_code"];} + elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];} +if (isset($_GET["province"])) {$province=$_GET["province"];} + elseif (isset($_POST["province"])) {$province=$_POST["province"];} +if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];} + elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];} +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"])) {$security=$_GET["security"];} + elseif (isset($_POST["security"])) {$security=$_POST["security"];} +if (isset($_GET["comments"])) {$comments=$_GET["comments"];} + elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["CBchangeUSERtoANY"])) {$CBchangeUSERtoANY=$_GET["CBchangeUSERtoANY"];} + elseif (isset($_POST["CBchangeUSERtoANY"])) {$CBchangeUSERtoANY=$_POST["CBchangeUSERtoANY"];} +if (isset($_GET["CBchangeUSERtoUSER"])) {$CBchangeUSERtoUSER=$_GET["CBchangeUSERtoUSER"];} + elseif (isset($_POST["CBchangeUSERtoUSER"])) {$CBchangeUSERtoUSER=$_POST["CBchangeUSERtoUSER"];} +if (isset($_GET["CBchangeANYtoUSER"])) {$CBchangeANYtoUSER=$_GET["CBchangeANYtoUSER"];} + elseif (isset($_POST["CBchangeANYtoUSER"])) {$CBchangeANYtoUSER=$_POST["CBchangeANYtoUSER"];} +if (isset($_GET["callback_id"])) {$callback_id=$_GET["callback_id"];} + elseif (isset($_POST["callback_id"])) {$callback_id=$_POST["callback_id"];} +if (isset($_GET["CBuser"])) {$CBuser=$_GET["CBuser"];} + elseif (isset($_POST["CBuser"])) {$CBuser=$_POST["CBuser"];} +if (isset($_GET["modify_logs"])) {$modify_logs=$_GET["modify_logs"];} + elseif (isset($_POST["modify_logs"])) {$modify_logs=$_POST["modify_logs"];} + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + + +### AST GUI database administration modify lead in vicidial_list +### admin_modify_lead.php + +# this is the administration lead information modifier screen, the administrator just needs to enter the leadID and then they can view and modify the information in the record for that lead + +# CHANGES +# +# 60419-1705 - Added ability to change lead callback record from USERONLY to ANYONE or USERONLY-user +# 60421-1459 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60609-1112 - Added DNC list addition if status changed to DNC +# 60619-1539 - Added variable filtering to eliminate SQL injection attack threat +# 61130-1639 - Added recording_log lookup and list for this lead_id +# 61201-1136 - Added recording_log user(TSR) display and link +# 70305-1133 - Changed to default CHECKED modify logs upon status change +# 70424-1128 - Added campaign-specific statuses, reformatted recordings list +# + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); + + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and modify_leads='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $stmt="SELECT full_name,modify_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[0]; + $LOGmodify_leads =$row[1]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +?> + + + +VICIDIAL ADMIN: Lead record modification + + +
+VICIDIAL ADMIN: Lead record modification
\n"; + +if ($end_call > 0) +{ + +$call_length = ($STARTtime - $call_began); + + ### insert a NEW record to the vicidial_closer_log table + $stmt="INSERT INTO vicidial_closer_log (lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed) values('" . mysql_real_escape_string($lead_id) . "','" . mysql_real_escape_string($list_id) . "','" . mysql_real_escape_string($campaign_id) . "','" . mysql_real_escape_string($parked_time) . "','" . mysql_real_escape_string($call_began) . "','$STARTtime','" . mysql_real_escape_string($call_length) . "','" . mysql_real_escape_string($status) . "','" . mysql_real_escape_string($phone_code) . "','" . mysql_real_escape_string($phone_number) . "','$PHP_AUTH_USER','" . mysql_real_escape_string($comments) . "','Y')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ### update the lead record in the vicidial_list table + $stmt="UPDATE vicidial_list set status='" . mysql_real_escape_string($status) . "',first_name='" . mysql_real_escape_string($first_name) . "',last_name='" . mysql_real_escape_string($last_name) . "',address1='" . mysql_real_escape_string($address1) . "',address2='" . mysql_real_escape_string($address2) . "',address3='" . mysql_real_escape_string($address3) . "',city='" . mysql_real_escape_string($city) . "',state='" . mysql_real_escape_string($state) . "',province='" . mysql_real_escape_string($province) . "',postal_code='" . mysql_real_escape_string($postal_code) . "',country_code='" . mysql_real_escape_string($country_code) . "',alt_phone='" . mysql_real_escape_string($alt_phone) . "',email='" . mysql_real_escape_string($email) . "',security_phrase='" . mysql_real_escape_string($security) . "',comments='" . mysql_real_escape_string($comments) . "' where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "information modified

\n"; + echo "\n"; + + if ( ($dispo != $status) and ($dispo == 'CBHOLD') ) + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='" . mysql_real_escape_string($lead_id) . "' and status='ACTIVE';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record inactivated: $lead_id
\n"; + } + if ( ($dispo != $status) and ($dispo == 'CALLBK') ) + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='" . mysql_real_escape_string($lead_id) . "' and status IN('ACTIVE','LIVE');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record inactivated: $lead_id
\n"; + } + + if ( ($dispo != $status) and ($status == 'DNC') ) + { + ### add lead to the internal DNC list + $stmt="INSERT INTO vicidial_dnc (phone_number) values('" . mysql_real_escape_string($phone_number) . "');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
Lead added to DNC List: $lead_id - $phone_number
\n"; + } + ### update last record in vicidial_agent_log and vicidial_log tables + if (($dispo != $status) and ($modify_logs > 0)) + { + $stmt="UPDATE vicidial_log set status='" . mysql_real_escape_string($status) . "' where lead_id='" . mysql_real_escape_string($lead_id) . "' order by call_date desc limit 1"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_agent_log set status='" . mysql_real_escape_string($status) . "' where lead_id='" . mysql_real_escape_string($lead_id) . "' order by agent_log_id desc limit 1"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + } + +} +else +{ + + if ($CBchangeUSERtoANY == 'YES') + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set recipient='ANYONE' where callback_id='" . mysql_real_escape_string($callback_id) . "';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record changed to ANYONE
\n"; + } + if ($CBchangeUSERtoUSER == 'YES') + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set user='" . mysql_real_escape_string($CBuser) . "' where callback_id='" . mysql_real_escape_string($callback_id) . "';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record user changed to $CBuser
\n"; + } + if ($CBchangeANYtoUSER == 'YES') + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set user='" . mysql_real_escape_string($CBuser) . "',recipient='USERONLY' where callback_id='" . mysql_real_escape_string($callback_id) . "';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record changed to USERONLY, user: $CBuser
\n"; + } + + + + $stmt="SELECT count(*) from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_count = $row[0]; + + if ($lead_count > 0) + { + + $stmt="select * from vicidial_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by uniqueid desc limit 500;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + $call_log = ''; + $log_campaign = ''; + while ($logs_to_print > $u) + { + $row=mysql_fetch_row($rslt); + if (strlen($log_campaign)<1) {$log_campaign = $row[3];} + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $u++; + $call_log .= "
"; + $call_log .= ""; + $call_log .= ""; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + + } + + $stmt="select * from vicidial_closer_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by closecallid desc limit 500;"; + $rslt=mysql_query($stmt, $link); + $Clogs_to_print = mysql_num_rows($rslt); + + $y=0; + $closer_log = ''; + $Clog_campaign = ''; + while ($Clogs_to_print > $y) + { + $row=mysql_fetch_row($rslt); + if (strlen($Clog_campaign)<1) {$Clog_campaign = $row[3];} + if (eregi("1$|3$|5$|7$|9$", $y)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $y++; + $closer_log .= ""; + $closer_log .= ""; + $closer_log .= ""; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + + } + + $stmt="SELECT * from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_id = "$row[0]"; + $dispo = "$row[3]"; + $tsr = "$row[4]"; + $vendor_id = "$row[5]"; + $list_id = "$row[7]"; + $campaign_id = "$row[8]"; + $phone_code = "$row[10]"; + $phone_number = "$row[11]"; + $title = "$row[12]"; + $first_name = "$row[13]"; # + $middle_initial = "$row[14]"; + $last_name = "$row[15]"; # + $address1 = "$row[16]"; # + $address2 = "$row[17]"; # + $address3 = "$row[18]"; # + $city = "$row[19]"; # + $state = "$row[20]"; # + $province = "$row[21]"; # + $postal_code = "$row[22]"; # + $country_code = "$row[23]"; # + $gender = "$row[24]"; + $date_of_birth = "$row[25]"; + $alt_phone = "$row[26]"; # + $email = "$row[27]"; # + $security = "$row[28]"; # + $comments = "$row[29]"; # + + echo "
Call information: $first_name $last_name - $phone_number

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
$u$row[4] $row[7] $row[8] $row[11] $row[3] $row[2] $row[1]
$y$row[4] $row[7] $row[8] $row[11] $row[3] $row[2] $row[1]   $row[14]
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + echo "\n"; + + echo "\n"; + echo "
Vendor ID: $vendor_id     Lead ID: $lead_id
Fronter: $tsr     List ID: $list_id
First Name:   \n"; + echo " Last Name:
Address 1 :
Address 2 :
Address 3 :
City :
State:   \n"; + echo " Postal Code:
Province :
Country :
Alt Phone :
Email :
Security :
Comments :
Disposition: (with $log_campaign statuses)
Modify agent and vicidial logs
\n"; + echo "


\n"; + + if ( ($dispo == 'CALLBK') or ($dispo == 'CBHOLD') ) + { + ### find any vicidial_callback records for this lead + $stmt="select * from vicidial_callbacks where lead_id='" . mysql_real_escape_string($lead_id) . "' and status IN('ACTIVE','LIVE') order by callback_id desc LIMIT 1;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $CB_to_print = mysql_num_rows($rslt); + $rowx=mysql_fetch_row($rslt); + + if ($CB_to_print>0) + { + if ($rowx[9] == 'USERONLY') + { + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "

\n"; + + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "New Callback Owner UserID: \n"; + echo "

\n"; + } + else + { + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "New Callback Owner UserID: \n"; + echo "

\n"; + } + } + else + { + echo "
No Callback records found
\n"; + } + } + + + + + + + } + else + { + echo "lead lookup FAILED for lead_id $lead_id       $NOW_TIME\n

\n"; +# echo "Close this window\n

\n"; + } + + + +echo "

\n"; + +echo "
\n"; + +echo "CALLS TO THIS LEAD:\n"; +echo "\n"; +echo "\n"; + + echo "$call_log\n"; + +echo "
# DATE/TIME LENGTH STATUS TSR CAMPAIGN LIST LEAD
\n"; +echo "

\n"; + +echo "CLOSER RECORDS FOR THIS LEAD:\n"; +echo "\n"; +echo "\n"; + + echo "$closer_log\n"; + +echo "
# DATE/TIME LENGTH STATUS TSR CAMPAIGN LIST LEAD WAIT
\n"; +echo "

\n"; + + +echo "RECORDINGS FOR THIS LEAD:\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from recording_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by recording_id desc limit 500;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) + { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $location = $row[11]; + if (strlen($location)>30) + {$locat = substr($location,0,27); $locat = "$locat...";} + else + {$locat = $location;} + if (eregi("http",$location)) + {$location = "$locat";} + else + {$location = $locat;} + $u++; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + + } + + +echo "
# LEADDATE/TIME SECONDS   RECIDFILENAMELOCATIONTSR
$u $row[12] $row[4] $row[8] $row[0]   $row[10] $location $row[13]
\n"; + + + + +} + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/admin_search_lead.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/admin_search_lead.php new file mode 100644 index 00000000..ff814159 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/admin_search_lead.php @@ -0,0 +1,225 @@ + LICENSE: GPLv2 +### +### AST GUI database administration search for lead info +### admin_modify_lead.php +# +# this is the administration lead information modifier screen, the administrator just needs to enter the leadID and then they can view and modify the information in the record for that lead +# +# changes: +# 60620-1055 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# - Changed results to multi-record +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} +if (isset($_GET["phone"])) {$phone=$_GET["phone"];} + elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); + + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and modify_leads='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name,modify_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[0]; + $LOGmodify_leads =$row[1]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +?> + + + +VICIDIAL ADMIN: Lead Search + +Lead Lookup + + +VICIDIAL ADMIN: Lead search
\n"; + + +if ( (!$vendor_id) and (!$phone) and (!$lead_id) ) + { + echo date("l F j, Y G:i:s A"); + echo "\n

\n"; + echo "
\n"; + echo "\n"; + echo "Please enter a:
Vendor ID(vendor lead code): or \n"; + echo "
a Home Phone Number: or\n"; + echo "
a lead ID:

\n"; + echo "
\n"; + echo "\n
\n"; + echo "\n"; + exit; + } + +else + { + + if ($vendor_id) + { + $stmt="SELECT * from vicidial_list where vendor_lead_code='" . mysql_real_escape_string($vendor_id) . "' order by modify_date desc limit 1000"; + } + else + { + if ($phone) + { + $stmt="SELECT * from vicidial_list where phone_number='" . mysql_real_escape_string($phone) . "' order by modify_date desc limit 1000"; + } + else + { + if ($lead_id) + { + $stmt="SELECT * from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "' order by modify_date desc limit 1000"; + } + else + { + print "ERROR: you must search for something! Go back and search for something"; + exit; + } + } + } + if ($DB) + { + echo "\n\n$stmt\n\n"; + } + + $rslt=mysql_query($stmt, $link); + $results_to_print = mysql_num_rows($rslt); + if ($results_to_print < 1) + { + echo date("l F j, Y G:i:s A"); + echo "\n

\n"; + echo "The search variables you entered are not active in the system

\n"; + echo "Please go back and double check the information you entered and submit again\n"; + echo "
\n"; + echo "\n"; + exit; + } + else + { + echo "RESULTS: $results_to_print

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + $o=0; + while ($results_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $o++; + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + echo "
#LEAD IDSTATUSVENDOR IDLAST AGENTLIST IDPHONENAMECITYSECURITYLAST CALL
$o$row[0]$row[3]$row[5]$row[4]$row[7]$row[11]$row[13] $row[15]$row[19]$row[28]$row[2]
\n"; + } + } + + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\nNEW SEARCH"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds"; + + +?> + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/closer-fronter_popup.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/closer-fronter_popup.php new file mode 100644 index 00000000..98a58eca --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/closer-fronter_popup.php @@ -0,0 +1,516 @@ + LICENSE: GPLv2 +### +# this is the closer popup of a specific call that starts recording the call and allows you to go and fetch info on that caller in the local CRM system. +# CHANGES +# +# 60620-1020 - Added variable filtering to eliminate SQL injection attack threat +# 61201-1114 - Added lead_id and user to recording_log entry +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +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["alt_phone"])) {$alt_phone=$_GET["alt_phone"];} + elseif (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];} +if (isset($_GET["call_began"])) {$call_began=$_GET["call_began"];} + elseif (isset($_POST["call_began"])) {$call_began=$_POST["call_began"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];} + elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];} +if (isset($_GET["city"])) {$city=$_GET["city"];} + elseif (isset($_POST["city"])) {$city=$_POST["city"];} +if (isset($_GET["comments"])) {$comments=$_GET["comments"];} + elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];} +if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];} + elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];} +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["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];} + elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];} +if (isset($_GET["email"])) {$email=$_GET["email"];} + elseif (isset($_POST["email"])) {$email=$_POST["email"];} +if (isset($_GET["end_call"])) {$end_call=$_GET["end_call"];} + elseif (isset($_POST["end_call"])) {$end_call=$_POST["end_call"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];} + elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];} + elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["parked_time"])) {$parked_time=$_GET["parked_time"];} + elseif (isset($_POST["parked_time"])) {$parked_time=$_POST["parked_time"];} +if (isset($_GET["pass"])) {$pass=$_GET["pass"];} + elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];} +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["phone"])) {$phone=$_GET["phone"];} + elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];} +if (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];} + elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];} +if (isset($_GET["province"])) {$province=$_GET["province"];} + elseif (isset($_POST["province"])) {$province=$_POST["province"];} +if (isset($_GET["security"])) {$security=$_GET["security"];} + elseif (isset($_POST["security"])) {$security=$_POST["security"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["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["session_id"])) {$session_id=$_GET["session_id"];} + elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];} +if (isset($_GET["state"])) {$state=$_GET["state"];} + elseif (isset($_POST["state"])) {$state=$_POST["state"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["tsr"])) {$tsr=$_GET["tsr"];} + elseif (isset($_POST["tsr"])) {$tsr=$_POST["tsr"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +#$DB = '1'; # DEBUG override +$US = '_'; +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$REC_TIME = date("Ymd-His"); +$FILE_datetime = $STARTtime; +$parked_time = $STARTtime; + +# $ext_context = 'default'; defined in dbconnect file + + $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]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($user); + $password=strtoupper($pass); + $stmt="SELECT full_name from vicidial_users where user='$user' and pass='$pass'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + if ( (strlen($customer_zap_channel)>2) and (eregi('zap',$customer_zap_channel)) ) + { + echo "\n\n"; + echo "\n\n"; + + } + else + { + echo "Bad channel: $customer_zap_channel\n"; + echo "Make sure the Zap channel is live and try again\n"; + exit; + } + + } + else + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$user|$pass|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +echo "VICIDIAL FRONTER-CLOSER: Popup\n"; +echo "\n"; + +if (eregi('CL_UNIV',$channel_group)) + { + ?> + + \n"; + echo "function WaitFirefix() {setTimeout(document.forms[0].search_phone.focus(), 1000)}\n"; + echo "\n"; + } +?> + + +
+ + 0) +{ + +# $stmt="DELETE from parked_channels where server_ip='$server_ip' and parked_time='$parked_time' and channel='$channel' LIMIT 1"; +# if ($DB) {echo "|$stmt|\n";} +# $rslt=mysql_query($stmt, $link); + + $DTqueryCID = "RZ$FILE_datetime$user"; + + ### insert a NEW record to the vicidial_manager table to be processed + + $channel = $customer_zap_channel; + $channel = eregi_replace('Zap/', "", $channel); + $SIPexten = eregi_replace('SIP/', "", $SIPexten); + $filename = "$REC_TIME$US$SIPexten"; + +# $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Monitor','$DTqueryCID','Channel: Zap/$channel','File: $filename','Callerid: $DTqueryCID','','','','','','','')"; +# if ($DB) {echo "|$stmt|\n";} +# $rslt=mysql_query($stmt, $link); + + # Local/78600098@demo-6617,2 + + $stmt = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','" . mysql_real_escape_string($server_ip) . "','','Originate','$DTqueryCID','Channel: $local_DEF$conf_silent_prefix" . mysql_real_escape_string($session_id) . "$local_AMP$ext_context','Context: $ext_context','Exten: $recording_exten','Priority: 1','Callerid: " . mysql_real_escape_string($filename) . "','','','','','')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('Zap/" . mysql_real_escape_string($channel) . "','" . mysql_real_escape_string($server_ip) . "','SIP/" . mysql_real_escape_string($SIPexten) . "','$NOW_TIME','$STARTtime','" . mysql_real_escape_string($filename) . "','$lead_id','$user')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='" . mysql_real_escape_string($filename) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + + echo "Recording command sent for channel $channel - $filename - $recording_id       $NOW_TIME\n

\n"; + + $stmt="SELECT full_name from vicidial_users where user='" . mysql_real_escape_string($user) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + echo "Call Referred by: $user - $full_name\n

\n"; + + $url = "http://10.10.99.2/vicidial/closer_dispo.php?lead_id=$lead_id&channel=$channel&server_ip=$server_ip&extension=$SIPexten&call_began=$STARTtime&parked_time=$parked_time&DB=$DB"; + + echo "View Customer Info and Disposition Call\n

\n"; + + + +# $stmt="UPDATE park_log set grab_time='$NOW_TIME',status='TALKING',extension='$extension',user='$user' where parked_time='$parked_time' and server_ip='$server_ip' and channel='$channel'"; +# if ($DB) {echo "|$stmt|\n";} +# $fp = fopen ("./closer_SQL_updates.txt", "a"); +# fwrite ($fp, "$date|$user|$stmt|\n"); +# fclose($fp); +# $rslt=mysql_query($stmt, $link); + +########################################################################################### +####### HERE IS WHERE YOU DEFINE DIFFERENT CONTENTS DEPENDING UPON THE CHANNEL_GROUP PREFIX +########################################################################################### +if (eregi('CL_TEST',$channel_group)) + { + echo "GALLERIA TEST CLOSER GROUP: $channel_group\n"; + + $stmt="SELECT user,phone_number from vicidial_list where lead_id='" . mysql_real_escape_string($parked_by) . "';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $fronter=$row[0]; + $search_phone=$row[1]; + + + ?> +
+ + + + + + + + + + + + + + + +
COF MW Customer Search
Phone number
+
+

+ +
+ + + + + + + + + + + + + + + +
COF MW Customer Search
Phone number
+
+

+ -- INTERNAL CALL GALLERIA FRONT --
\n"; + $group_color='#99FF99'; + } + if (eregi('CL_GALLER2',$channel_group)) + { + echo "
-- TouchAsia CALL Simple Escapes FRONT --
\n"; + $group_color='#FF9999'; + } + if (eregi('CL_GALLER3',$channel_group)) + { + echo "
-- DebitSupplies CALL Simple Escapes FRONT --
\n"; + $group_color='#FF9999'; + } + if (eregi('CL_GALLER4',$channel_group)) + { + echo "
-- Vishnu CALL Simple Escapes FRONT --
\n"; + $group_color='#FF9999'; + } + + + ?> +
+ + + + + + + + + + + + + + + +
COF MW Customer Search
Phone number
+
+

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
New Search
Reservation Number:
Confirmation #:
Phone #:


Back
+ +
+ + + Close this window\n

\n"; +} +else +{ + echo "Record command FAILED for channel $channel       $NOW_TIME\n

\n"; + echo "Please go back and try again\n

\n"; +# echo "
\n"; +} + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/closer-fronter_popup2.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/closer-fronter_popup2.php new file mode 100644 index 00000000..1c98063d --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/closer-fronter_popup2.php @@ -0,0 +1,431 @@ + LICENSE: GPLv2 +### +# this is the closer popup of a specific call that starts recording the call and allows you to go and fetch info on that caller in the local CRM system. +# CHANGES +# +# 60620-1025 - Added variable filtering to eliminate SQL injection attack threat +# 61201-1114 - Added lead_id and user to recording_log entry +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +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["alt_phone"])) {$alt_phone=$_GET["alt_phone"];} + elseif (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];} +if (isset($_GET["call_began"])) {$call_began=$_GET["call_began"];} + elseif (isset($_POST["call_began"])) {$call_began=$_POST["call_began"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];} + elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];} +if (isset($_GET["city"])) {$city=$_GET["city"];} + elseif (isset($_POST["city"])) {$city=$_POST["city"];} +if (isset($_GET["comments"])) {$comments=$_GET["comments"];} + elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];} +if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];} + elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];} +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["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];} + elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];} +if (isset($_GET["email"])) {$email=$_GET["email"];} + elseif (isset($_POST["email"])) {$email=$_POST["email"];} +if (isset($_GET["end_call"])) {$end_call=$_GET["end_call"];} + elseif (isset($_POST["end_call"])) {$end_call=$_POST["end_call"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];} + elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];} + elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["parked_time"])) {$parked_time=$_GET["parked_time"];} + elseif (isset($_POST["parked_time"])) {$parked_time=$_POST["parked_time"];} +if (isset($_GET["pass"])) {$pass=$_GET["pass"];} + elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];} +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["phone"])) {$phone=$_GET["phone"];} + elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];} +if (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];} + elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];} +if (isset($_GET["province"])) {$province=$_GET["province"];} + elseif (isset($_POST["province"])) {$province=$_POST["province"];} +if (isset($_GET["security"])) {$security=$_GET["security"];} + elseif (isset($_POST["security"])) {$security=$_POST["security"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["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["session_id"])) {$session_id=$_GET["session_id"];} + elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];} +if (isset($_GET["state"])) {$state=$_GET["state"];} + elseif (isset($_POST["state"])) {$state=$_POST["state"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["tsr"])) {$tsr=$_GET["tsr"];} + elseif (isset($_POST["tsr"])) {$tsr=$_POST["tsr"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +#$DB = '1'; # DEBUG override +$US = '_'; +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$REC_TIME = date("Ymd-His"); +$FILE_datetime = $STARTtime; +$parked_time = $STARTtime; + +# $ext_context = 'default'; defined in dbconnect file +if (!isset($begin_date)) {$begin_date = $TODAY;} +if (!isset($end_date)) {$end_date = $TODAY;} + + $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 (!$auth) + { + if ( (strlen($PHP_AUTH_USER)>1) and ( (eregi("tsr",$PHP_AUTH_PW)) or (eregi("sales",$PHP_AUTH_PW)) ) ) + { + $auth=1; + $user = $PHP_AUTH_USER; + $pass = $PHP_AUTH_PW; + } + } + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER - $user - $PHP_AUTH_USER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($user); + $password=strtoupper($pass); + $stmt="SELECT full_name from vicidial_users where user='$user' and pass='$pass'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + if ( (strlen($customer_zap_channel)>2) and ( (eregi('zap',$customer_zap_channel)) or (eregi('iax',$customer_zap_channel)) ) ) + { + echo "\n\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + } + else + { + echo "Bad channel: $customer_zap_channel\n"; + echo "Make sure the Zap channel is live and try again\n"; + exit; + } + + } + else + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$user|$pass|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +echo "VICIDIAL FRONTER-CLOSER: Popup\n"; +echo "\n"; + +if (eregi('CL_UNIV',$channel_group)) + { + ?> + + \n"; + echo "function WaitFirefix() {setTimeout(document.forms[0].search_phone.focus(), 1000)}\n"; + echo "\n"; + } +?> + + +
+ + 0) +{ + +# $stmt="DELETE from parked_channels where server_ip='$server_ip' and parked_time='$parked_time' and channel='$channel' LIMIT 1"; +# if ($DB) {echo "|$stmt|\n";} +# $rslt=mysql_query($stmt, $link); + + $DTqueryCID = "RZ$FILE_datetime$user"; + + ### insert a NEW record to the vicidial_manager table to be processed + + $channel = $customer_zap_channel; +# $channel = eregi_replace('Zap/', "", $channel); + $SIPexten = eregi_replace('SIP/', "", $SIPexten); + $filename = "$REC_TIME$US$SIPexten"; + +# $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Monitor','$DTqueryCID','Channel: Zap/$channel','File: $filename','Callerid: $DTqueryCID','','','','','','','')"; +# if ($DB) {echo "|$stmt|\n";} +# $rslt=mysql_query($stmt, $link); + + # Local/78600098@demo-6617,2 + + $stmt = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','" . mysql_real_escape_string($server_ip) . "','','Originate','$DTqueryCID','Channel: $local_DEF$conf_silent_prefix" . mysql_real_escape_string($session_id) . "$local_AMP$ext_context','Context: $ext_context','Exten: $recording_exten','Priority: 1','Callerid: " . mysql_real_escape_string($filename) . "','','','','','')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','" . mysql_real_escape_string($server_ip) . "','SIP/" . mysql_real_escape_string($SIPexten) . "','$NOW_TIME','$STARTtime','" . mysql_real_escape_string($filename) . "','$lead_id','$user')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='" . mysql_real_escape_string($filename) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + + echo "Recording command sent for channel $channel - $filename - $recording_id       $NOW_TIME\n

\n"; + + $stmt="SELECT full_name from vicidial_users where user='" . mysql_real_escape_string($fronter) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + echo "Call Referred by: $fronter - $full_name\n

\n"; + + $url = "http://10.10.10.196/vicidial/closer_dispo.php?lead_id=$lead_id&channel=$channel&server_ip=$server_ip&extension=$SIPexten&call_began=$STARTtime&parked_time=$parked_time&DB=$DB"; + + echo "View Customer Info and Disposition Call\n

\n"; + + + $stmt="SELECT group_name,group_color from vicidial_inbound_groups where group_id='" . mysql_real_escape_string($channel_group) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $group_name = $row[0]; + $group_color = $row[1]; + + echo "
\n"; + echo "
$channel_group - $group_name

\n\n"; + +########################################################################################### +####### HERE IS WHERE YOU DEFINE DIFFERENT CONTENTS DEPENDING UPON THE CHANNEL_GROUP PREFIX +########################################################################################### + +if (eregi('CL',$channel_group)) + { + if (strlen($phone) > 9) {$search_phone = $phone;} + if ( (strlen($search_phone) < 10) or (strlen($fronter) < 1) ) + { + echo "\n"; + $stmt="SELECT user,phone_number from vicidial_list where lead_id='$parked_by';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if (strlen($fronter) < 1) {$fronter=$row[0];} + if (strlen($search_phone) < 10) {$search_phone=$row[1];} + } + + ?> +
+ + + + + + + + + + + + + + + +
COF MW Customer Search
Phone number
+
+

+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
New Search
Reservation Number:
Confirmation #:
Phone #:


Back
+ +
+ + + Close this window\n

\n"; +} +else +{ + echo "Record command FAILED for channel $channel       $NOW_TIME\n

\n"; + echo "Please go back and try again\n

\n"; +# echo "
\n"; +} + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/closer.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/closer.php new file mode 100644 index 00000000..59599edb --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/closer.php @@ -0,0 +1,353 @@ + LICENSE: GPLv2 +### +# the purpose of this script and webpage is to allow for remote or local users of the system to log in and grab phone calls that are coming inbound into the Asterisk server and being put in the parked_channels table while they hear a soundfile for a limited amount of time before being forwarded on to either a set extension or a voicemail box. This gives remote or local agents a way to grab calls without tying up their phone lines all day. The agent sees the refreshing screen of calls on park and when they want to take one they just click on it, and a small window opens that will allow them to grab the call and/or look up more information on the caller through the callerID that is given(if available) +# CHANGES +# +# 60620-1032 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["group_selected"])) {$group_selected=$_GET["group_selected"];} + elseif (isset($_POST["group_selected"])) {$group_selected=$_POST["group_selected"];} +if (isset($_GET["dialplan_number"])) {$dialplan_number=$_GET["dialplan_number"];} + elseif (isset($_POST["dialplan_number"])) {$dialplan_number=$_POST["dialplan_number"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["groupselect"])) {$groupselect=$_GET["groupselect"];} + elseif (isset($_POST["groupselect"])) {$groupselect=$_POST["groupselect"];} +if (isset($_GET["PHONE_LOGIN"])) {$PHONE_LOGIN=$_GET["PHONE_LOGIN"];} + elseif (isset($_POST["PHONE_LOGIN"])) {$PHONE_LOGIN=$_POST["PHONE_LOGIN"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["parked_time"])) {$parked_time=$_GET["parked_time"];} + elseif (isset($_POST["parked_time"])) {$parked_time=$_POST["parked_time"];} +if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];} + elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];} +if (isset($_GET["debugvars"])) {$debugvars=$_GET["debugvars"];} + elseif (isset($_POST["debugvars"])) {$debugvars=$_POST["debugvars"];} +if (isset($_GET["parked_by"])) {$parked_by=$_GET["parked_by"];} + elseif (isset($_POST["parked_by"])) {$parked_by=$_POST["parked_by"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$popup_page = './closer_popup.php'; + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 2;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + } + else + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + + +$color_class[0] = 'green'; +$color_class[1] = 'red'; +$color_class[2] = 'blue'; +$color_class[3] = 'purple'; +$color_class[4] = 'orange'; +$color_class[5] = 'green'; +$color_class[6] = 'red'; +$color_class[7] = 'blue'; +$color_class[8] = 'purple'; +$color_class[9] = 'orange'; +?> + + + + + +VICIDIAL CLOSER: Main + + +
+ + 0) + { + $stmt="SELECT dialplan_number,server_ip from phones where extension='" . mysql_real_escape_string($extension) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $dialplan_number=$row[0]; + $server_ip=$row[1]; + + if (!$group_selected) + { + $stmt="select distinct channel_group from park_log;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $groups_to_print = mysql_num_rows($rslt); + $i=0; + while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + echo "
Please select the groups you want to pick calls up from:
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Inbound Call Groups:
\n"; + $o=0; + while ($groups_to_print > $o) + { + $group_form_print = sprintf("%-20s", $groups[$o]); + echo "$group_form_print
\n"; + $o++; + } + echo "
\n"; + echo "\n"; + echo "


\n"; + } + else + { + $o=0; + while($o < $group_selected) + { + $form_groups = "$form_groups&groupselect[$o]=$groupselect[$o]"; + $o++; + } + + $stmt="INSERT INTO vicidial_user_log values('','" . mysql_real_escape_string($user) . "','LOGIN','CLOSER','$NOW_TIME','$STARTtime');"; + $rslt=mysql_query($stmt, $link); + + echo "\n"; + echo"\n"; + + echo "extension found, forwarding you to closer page, please wait 3 seconds...
\n"; + } + + } + else + { + echo "The extension you entered does not exist, please try again
\n"; + echo "
Please enter your phone_ID: \n"; + echo "\n"; + echo "phone station ID:   \n"; + echo "\n"; + echo "


\n"; + } + + } + else + { + echo "
Please enter your phone_ID: \n"; + echo "\n"; + echo "phone station ID:   \n"; + echo "\n"; + echo "


\n"; + } + +exit; + +} + +$o=0; +while($o < $group_selected) +{ + $listen_groups = "$listen_groups     $groupselect[$o]"; + $form_groups = "$form_groups&groupselect[$o]=$groupselect[$o]"; + $o++; +} + + +echo "\n"; +echo"\n"; + +#CHANNEL SERVER CHANNEL_GROUP EXTENSION PARKED_BY PARKED_TIME +#---------------------------------------------------------------------------------------------- +#Zap/73-1 10.10.11.11 IN_800_TPP_CS TPPpark 7275338730 2004-04-22 12:41:00 + + + +echo "$NOW_TIME           $PHP_AUTH_USER - $fullname - CALLS SENT TO: $dialplan_number

\n"; + +echo "Click on the channel below that you would like to have directed to your phone
\n"; + +echo "
\n";
+echo "CHANNEL    SERVER        CHANNEL_GROUP   EXTENSION    PARKED_BY            PARKED_TIME         \n";
+echo "---------------------------------------------------------------------------------------------- \n";
+
+
+
+
+
+$stmt="SELECT count(*) from parked_channels where server_ip='" . mysql_real_escape_string($server_ip) . "'";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$parked_count = $row[0];
+	if ($parked_count > 0)
+	{
+	$stmt="SELECT * from parked_channels where server_ip='" . mysql_real_escape_string($server_ip) . "' and channel_group LIKE \"CL_%\" order by channel_group,parked_time";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$parked_to_print = mysql_num_rows($rslt);
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		$channel =			sprintf("%-11s", $row[0]);
+		$server =			sprintf("%-14s", $row[1]);
+		$channel_group =	sprintf("%-16s", $row[2]);
+		$park_extension =	sprintf("%-13s", $row[3]);
+		$parked_by =		sprintf("%-21s", $row[4]);
+		$parked_time =		sprintf("%-19s", $row[5]);
+
+		$G='';   $EG='';
+		$o=0;
+		$with_color=0;
+		while($o < $group_selected)
+			{
+				if (eregi("$groupselect[$o]",$channel_group))
+					{
+					$G=""; $EG='';
+					$with_color++;
+					}
+				$o++;
+			}
+		if ($with_color)
+			{
+			if (eregi('CL_GAL',$row[2]))
+				{
+				echo "$G$channel$server$channel_group$park_extension                     $parked_time $EG\n";
+				}
+			else
+				{
+				echo "$G$channel$server$channel_group$park_extension$parked_by$parked_time $EG\n";
+				}
+			}
+#	
+		$i++;
+		}
+
+	}
+	else
+	{
+	echo "********************************************************************************************** \n";
+	echo "********************************************************************************************** \n";
+	echo "*************************************** NO PARKED CALLS ************************************** \n";
+	echo "********************************************************************************************** \n";
+	echo "********************************************************************************************** \n";
+	}
+
+echo "  \n\n";
+echo "looking for calls on these groups:\n";
+$o=0;
+while($o < $group_selected)
+{
+	$group_print =		sprintf("%-20s", $groupselect[$o]);
+	echo "             - $group_print\n";
+	$o++;
+}
+
+
+$ENDtime = date("U");
+
+$RUNtime = ($ENDtime - $STARTtime);
+
+echo "
\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/closer_dispo.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/closer_dispo.php new file mode 100644 index 00000000..54e61219 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/closer_dispo.php @@ -0,0 +1,329 @@ + LICENSE: GPLv2 +### +# this is the closer disposition screen of a call that has been grabbed. This allows the closer to modify customer information and disposition the call +# CHANGES +# +# 60619-1641 - Added variable filtering to eliminate SQL injection attack threat +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} +if (isset($_GET["phone"])) {$phone=$_GET["phone"];} + elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];} + elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];} +if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];} + elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];} +if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];} + elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];} +if (isset($_GET["end_call"])) {$end_call=$_GET["end_call"];} + elseif (isset($_POST["end_call"])) {$end_call=$_POST["end_call"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];} + elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];} + elseif (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["call_began"])) {$call_began=$_GET["call_began"];} + elseif (isset($_POST["call_began"])) {$call_began=$_POST["call_began"];} +if (isset($_GET["parked_time"])) {$parked_time=$_GET["parked_time"];} + elseif (isset($_POST["parked_time"])) {$parked_time=$_POST["parked_time"];} +if (isset($_GET["tsr"])) {$tsr=$_GET["tsr"];} + elseif (isset($_POST["tsr"])) {$tsr=$_POST["tsr"];} +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["postal_code"])) {$postal_code=$_GET["postal_code"];} + elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];} +if (isset($_GET["province"])) {$province=$_GET["province"];} + elseif (isset($_POST["province"])) {$province=$_POST["province"];} +if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];} + elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];} +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"])) {$security=$_GET["security"];} + elseif (isset($_POST["security"])) {$security=$_POST["security"];} +if (isset($_GET["comments"])) {$comments=$_GET["comments"];} + elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_datetime = $STARTtime; + +$ext_context = 'demo'; +if (!isset($begin_date)) {$begin_date = $TODAY;} +if (!isset($end_date)) {$end_date = $TODAY;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 2;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + } + else + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +?> + + +VICIDIAL CLOSER: Call Disposition +\n"; +?> + + +
+ + 0) +{ + +$call_length = ($STARTtime - $call_began); + + ### insert a NEW record to the vicidial_closer_log table + $stmt="INSERT INTO vicidial_closer_log (lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed) values('" . mysql_real_escape_string($lead_id) . "','" . mysql_real_escape_string($list_id) . "','" . mysql_real_escape_string($campaign_id) . "','" . mysql_real_escape_string($parked_time) . "','" . mysql_real_escape_string($call_began) . "','$STARTtime','" . mysql_real_escape_string($call_length) . "','" . mysql_real_escape_string($status) . "','" . mysql_real_escape_string($phone_code) . "','" . mysql_real_escape_string($phone_number) . "','$PHP_AUTH_USER','" . mysql_real_escape_string($comments) . "','Y')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ### update the lead record in the vicidial_list table + $stmt="UPDATE vicidial_list set status='" . mysql_real_escape_string($status) . "',first_name='" . mysql_real_escape_string($first_name) . "',last_name='" . mysql_real_escape_string($last_name) . "',address1='" . mysql_real_escape_string($address1) . "',address2='" . mysql_real_escape_string($address2) . "',address3='" . mysql_real_escape_string($address3) . "',city='" . mysql_real_escape_string($city) . "',state='" . mysql_real_escape_string($state) . "',province='" . mysql_real_escape_string($province) . "',postal_code='" . mysql_real_escape_string($postal_code) . "',country_code='" . mysql_real_escape_string($country_code) . "',alt_phone='" . mysql_real_escape_string($alt_phone) . "',email='" . mysql_real_escape_string($email) . "',security_phrase='" . mysql_real_escape_string($security) . "',comments='" . mysql_real_escape_string($comments) . "' where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT count(*) from live_channels where server_ip='$server_ip' and channel='" . mysql_real_escape_string($channel) . "' and extension like \"%" . mysql_real_escape_string($extension) . "%\""; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $parked_count = $row[0]; + + if ($parked_count > 0) + { + + $DTqueryCID = "RR$FILE_datetime$PHP_AUTH_USER"; + + ### insert a NEW record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','" . mysql_real_escape_string($server_ip) . "','','Hangup','$DTqueryCID','Channel: " . mysql_real_escape_string($channel) . "','','','','','','','','','')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "Hangup command sent for channel $channel       $NOW_TIME\n

\n"; + + echo "\n"; + } + else + { + echo "Hangup command FAILED for channel $channel       $NOW_TIME\n

\n"; + echo "
\n"; + } +} +else +{ + $stmt="SELECT count(*) from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_count = $row[0]; + + if ($lead_count > 0) + { + + $stmt="SELECT * from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_id = "$row[0]"; + $tsr = "$row[4]"; + $vendor_id = "$row[5]"; + $list_id = "$row[7]"; + $campaign_id = "$row[8]"; + $phone_code = "$row[10]"; + $phone_number = "$row[11]"; + $title = "$row[12]"; + $first_name = "$row[13]"; # + $middle_initial = "$row[14]"; + $last_name = "$row[15]"; # + $address1 = "$row[16]"; # + $address2 = "$row[17]"; # + $address3 = "$row[18]"; # + $city = "$row[19]"; # + $state = "$row[20]"; # + $province = "$row[21]"; # + $postal_code = "$row[22]"; # + $country_code = "$row[23]"; # + $gender = "$row[24]"; + $date_of_birth = "$row[25]"; + $alt_phone = "$row[26]"; # + $email = "$row[27]"; # + $security = "$row[28]"; # + $comments = "$row[29]"; # + + echo "
Call information: $first_name $last_name - $phone_number

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + echo "\n"; + echo "
Vendor ID: $vendor_id     Campaign ID: $campaign_id
Fronter: $tsr     List ID: $list_id
First Name:   \n"; + echo " Last Name:
Address 1 :
Address 2 :
Address 3 :
City :
State:   \n"; + echo " Postal Code:
Province :
Country :
Alt Phone :
Email :
Security :
Comments :
Disposition:
\n"; + echo "


\n"; + + } + else + { + echo "lead lookup FAILED for lead_id $lead_id       $NOW_TIME\n

\n"; +# echo "Close this window\n

\n"; + } + + + + + + +} + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/closer_popup.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/closer_popup.php new file mode 100644 index 00000000..e12f02c3 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/closer_popup.php @@ -0,0 +1,453 @@ + LICENSE: GPLv2 +### +# this is the closer popup of a specific call that grabs the call and allows you to go and fetch info on that caller in the local CRM system. +# CHANGES +# +# 60620-1029 - Added variable filtering to eliminate SQL injection attack threat +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["group_selected"])) {$group_selected=$_GET["group_selected"];} + elseif (isset($_POST["group_selected"])) {$group_selected=$_POST["group_selected"];} +if (isset($_GET["dialplan_number"])) {$dialplan_number=$_GET["dialplan_number"];} + elseif (isset($_POST["dialplan_number"])) {$dialplan_number=$_POST["dialplan_number"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["groupselect"])) {$groupselect=$_GET["groupselect"];} + elseif (isset($_POST["groupselect"])) {$groupselect=$_POST["groupselect"];} +if (isset($_GET["PHONE_LOGIN"])) {$PHONE_LOGIN=$_GET["PHONE_LOGIN"];} + elseif (isset($_POST["PHONE_LOGIN"])) {$PHONE_LOGIN=$_POST["PHONE_LOGIN"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["parked_time"])) {$parked_time=$_GET["parked_time"];} + elseif (isset($_POST["parked_time"])) {$parked_time=$_POST["parked_time"];} +if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];} + elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];} +if (isset($_GET["debugvars"])) {$debugvars=$_GET["debugvars"];} + elseif (isset($_POST["debugvars"])) {$debugvars=$_POST["debugvars"];} +if (isset($_GET["parked_by"])) {$parked_by=$_GET["parked_by"];} + elseif (isset($_POST["parked_by"])) {$parked_by=$_POST["parked_by"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + +#$DB=1; +$US = '_'; +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$REC_TIME = date("Ymd-His"); +$FILE_datetime = $STARTtime; + +$ext_context = 'demo'; + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 2;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + } + else + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +echo "VICIDIAL CLOSER: Popup\n"; +echo "\n"; + +if (eregi('CL_UNIV',$channel_group)) + { + ?> + + \n"; + echo "function WaitFirefix() {setTimeout(document.forms[0].search_phone.focus(), 1000)}\n"; + echo "\n"; + } +?> + + +
+ + 0) +{ + $stmt="DELETE from parked_channels where server_ip='" . mysql_real_escape_string($server_ip) . "' and parked_time='" . mysql_real_escape_string($parked_time) . "' and channel='" . mysql_real_escape_string($channel) . "' LIMIT 1"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + + #$monitor_channel = eregi_replace('Zap/', "", $channel); + $monitor_channel = eregi_replace('-1', "", $channel); + $SIPexten = $extension; + $filename = "$REC_TIME$US$SIPexten"; + $DTqueryCID = "RR$FILE_datetime$PHP_AUTH_USER"; + +# $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Monitor','$DTqueryCID','Channel: $monitor_channel','File: $filename','Callerid: $DTqueryCID','','','','','','','')"; +# if ($DB) {echo "|$stmt|\n";} +# $rslt=mysql_query($stmt, $link); + +# $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('$monitor_channel','$server_ip','SIP/$SIPexten','$NOW_TIME','$STARTtime','$filename')"; +# if ($DB) {echo "|$stmt|\n";} +# $rslt=mysql_query($stmt, $link); + +# $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; +# $rslt=mysql_query($stmt, $link); +# if ($DB) {echo "$stmt\n";} +# $row=mysql_fetch_row($rslt); +# $recording_id = $row[0]; + +# echo "Recording command sent for channel $channel - $filename - $recording_id
\n"; + + ### insert a NEW record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','" . mysql_real_escape_string($server_ip) . "','','Redirect','$DTqueryCID','Exten: $dialplan_number','Channel: " . mysql_real_escape_string($channel) . "','Context: $ext_context','Priority: 1','Callerid: $DTqueryCID','','','','','')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "Redirect command sent for channel $channel       $NOW_TIME\n

\n"; + + $stmt="SELECT full_name from vicidial_users where user='" . mysql_real_escape_string($parked_by) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + echo "Call Referred by: $parked_by - $full_name\n

\n"; + + $url = "http://10.10.10.196/vicidial/closer_dispo.php?lead_id=$parked_by&channel=$channel&server_ip=$server_ip&extension=$extension&call_began=$STARTtime&parked_time=$parked_time&DB=$DB"; + + echo "View Customer Info and Disposition Call\n

\n"; + + + + $stmt="UPDATE park_log set grab_time='$NOW_TIME',status='TALKING',extension='" . mysql_real_escape_string($extension) . "',user='$PHP_AUTH_USER' where parked_time='" . mysql_real_escape_string($parked_time) . "' and server_ip='" . mysql_real_escape_string($server_ip) . "' and channel='" . mysql_real_escape_string($channel) . "'"; + if ($DB) {echo "|$stmt|\n";} + $fp = fopen ("./closer_SQL_updates.txt", "a"); + fwrite ($fp, "$date|$PHP_AUTH_USER|$stmt|\n"); + fclose($fp); + + + $rslt=mysql_query($stmt, $link); + +########################################################################################### +####### HERE IS WHERE YOU DEFINE DIFFERENT CONTENTS DEPENDING UPON THE CHANNEL_GROUP PREFIX +########################################################################################### +if (eregi('CL_TEST',$channel_group)) + { + echo "GALLERIA TEST CLOSER GROUP: $channel_group\n"; + + $stmt="SELECT user,phone_number from vicidial_list where lead_id='" . mysql_real_escape_string($parked_by) . "';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $fronter=$row[0]; + $search_phone=$row[1]; + + + ?> +
+ + + + + + + + + + + + + + + +
COF MW Customer Search
Phone number
+
+

+ +
+ + + + + + + + + + + + + + + +
COF MW Customer Search
Phone number
+
+

+ -- INTERNAL CALL GALLERIA FRONT --
\n"; + $group_color='#99FF99'; + } + if (eregi('CL_GALLER2',$channel_group)) + { + echo "
-- TouchAsia CALL Simple Escapes FRONT --
\n"; + $group_color='#FF9999'; + } + if (eregi('CL_GALLER3',$channel_group)) + { + echo "
-- DebitSupplies CALL Simple Escapes FRONT --
\n"; + $group_color='#FF9999'; + } + if (eregi('CL_GALLER4',$channel_group)) + { + echo "
-- Vishnu CALL Simple Escapes FRONT --
\n"; + $group_color='#FF9999'; + } + + + ?> +
+ + + + + + + + + + + + + + + +
COF MW Customer Search
Phone number
+
+

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
New Search
Reservation Number:
Confirmation #:
Phone #:


Back
+ +
+ + + Close this window\n

\n"; +} +else +{ + echo "Redirect command FAILED for channel $channel       $NOW_TIME\n

\n"; + echo "
\n"; +} + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/count.htm b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/count.htm new file mode 100644 index 00000000..51f8a361 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/count.htm @@ -0,0 +1 @@ + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/dbconnect.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/dbconnect.php new file mode 100644 index 00000000..5247e166 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/dbconnect.php @@ -0,0 +1,49 @@ + LICENSE: GPLv2 +# +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"); +mysql_select_db("$VARDB_database"); + +$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 + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/group_hourly_stats.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/group_hourly_stats.php new file mode 100644 index 00000000..607f2fd7 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/group_hourly_stats.php @@ -0,0 +1,252 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60620-1014 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["date_with_hour"])) {$date_with_hour=$_GET["date_with_hour"];} + elseif (isset($_POST["date_with_hour"])) {$date_with_hour=$_POST["date_with_hour"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$date_with_hour_default = date("Y-m-d H"); +$date_no_hour_default = $TODAY; + +if (!isset($date_with_hour)) {$date_with_hour = $date_with_hour_default;} + $date_no_hour = $date_with_hour; + $date_no_hour = eregi_replace(" ([0-9]{2})",'',$date_no_hour); +if (!isset($begin_date)) {$begin_date = $TODAY;} +if (!isset($end_date)) {$end_date = $TODAY;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + +# $stmt="SELECT full_name from vicidial_users where user='$user';"; +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# $full_name = $row[0]; + + } + + + + +?> + + +VICIDIAL ADMIN: Group Hourly Stats +\n"; +?> + + +
+ + + + + += '" . mysql_real_escape_string($date_with_hour) . ":00:00' and call_date <= '" . mysql_real_escape_string($date_with_hour) . ":59:59' and user='$VDuser[$o]';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDtotal[$o] = "$row[0]"; + + $stmt="select count(*) from vicidial_log where call_date >= '" . mysql_real_escape_string($date_no_hour) . " 00:00:00' and call_date <= '" . mysql_real_escape_string($date_no_hour) . " 23:59:59' and user='$VDuser[$o]' and status='" . mysql_real_escape_string($status) . "';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDday[$o] = "$row[0]"; + + $stmt="select count(*) from vicidial_log where call_date >= '" . mysql_real_escape_string($date_with_hour) . ":00:00' and call_date <= '" . mysql_real_escape_string($date_with_hour) . ":59:59' and user='$VDuser[$o]' and status='" . mysql_real_escape_string($status) . "';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDcount[$o] = "$row[0]"; + $o++; + } + +echo "
" ?>   VICIDIAL ADMIN: Group Hourly Stats  
\n"; + +echo "
\n"; + +echo "TSR HOUR COUNTS: $group | $status | $date_with_hour | $date_no_hour\n"; + +echo "
\n"; +echo "\n"; + + $day_calls=0; + $hour_calls=0; + $total_calls=0; + $o=0; + while($o < $tsrs_to_print) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + $total_calls = ($total_calls + $VDtotal[$o]); + $hour_calls = ($hour_calls + $VDcount[$o]); + $day_calls = ($day_calls + $VDday[$o]); + + $o++; + } + +echo "\n"; + + +} + +echo "
TSR ID   $status   TOTAL CALLS   $status DAY    
$VDuser[$o] $VDname[$o] $VDcount[$o] $VDtotal[$o] $VDday[$o]MODIFY | STATS
TOTAL $status $hour_calls $total_calls $day_calls
\n"; +echo "

\n"; + + + echo "
Please enter the group you want to get hourly stats for:
\n"; + echo "\n"; + echo "group:
\n"; + echo "status:   (example: XFER)
\n"; + echo "date with hour:   (example: 2004-06-25 14)
\n"; + echo "\n"; + echo "


\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/help.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/help.gif new file mode 100644 index 00000000..5575d7c8 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/help.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/listloader.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/listloader.php new file mode 100644 index 00000000..b6e8ae5e --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/listloader.php @@ -0,0 +1,926 @@ + LICENSE: GPLv2 +# +# AST Web GUI lead loader from formatted file +# +# CHANGES +# 50602-1640 - First version created by Joe Johnson +# 51128-1108 - Removed PHP global vars requirement +# 60421-1043 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60616-1006 - added listID override and gmt_offset lookup while loading +# 60619-1652 - Added variable filtering to eliminate SQL injection attack threat +# 60822-1105 - fixed for nonwritable directories +# 60906-1059 - added filter of non-digits in alt_phone field +# 61110-1222 - added new USA-Canada DST scheme and Brazil DST scheme +# 61128-1046 - added postal code GMT lookup and duplicate check options +# 70205-1703 - Defaulted phone_code to 1 if not populated +# 70417-1059 - Fixed default phone_code bug +# +# make sure vicidial_list exists and that your file follows the formatting correctly. This page does not dedupe or do any other lead filtering actions yet at this time. +# + +$version = '2.0.3'; +$build = '770417-1059'; + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$leadfile=$_FILES["leadfile"]; + $LF_orig = $_FILES['leadfile']['name']; + $LF_path = $_FILES['leadfile']['tmp_name']; +$submit_file=$_GET["submit_file"]; if (!$submit_file) {$submit_file=$_POST["submit_file"];} +$list_id_override=$_GET["list_id_override"]; if (!$list_id_override) {$list_id_override=$_POST["list_id_override"];} + $list_id_override = (preg_replace("/\D/","",$list_id_override)); +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["dupcheck"])) {$dupcheck=$_GET["dupcheck"];} + elseif (isset($_POST["dupcheck"])) {$dupcheck=$_POST["dupcheck"];} +if (isset($_GET["postalgmt"])) {$postalgmt=$_GET["postalgmt"];} + elseif (isset($_POST["postalgmt"])) {$postalgmt=$_POST["postalgmt"];} + + +#$DB=1; +#$DBX=1; + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); +$list_id_override = ereg_replace("[^0-9]","",$list_id_override); + + +$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://';} +$admDIR = "$HTTPprotocol$server_name$script_name"; +$admDIR = eregi_replace('listloader.php','',$admDIR); +$admSCR = 'admin.php'; +$NWB = "   \"HELP\""; + + +$secX = date("U"); +$hour = date("H"); +$min = date("i"); +$sec = date("s"); +$mon = date("m"); +$mday = date("d"); +$year = date("Y"); +$isdst = date("I"); +$Shour = date("H"); +$Smin = date("i"); +$Ssec = date("s"); +$Smon = date("m"); +$Smday = date("d"); +$Syear = date("Y"); +$pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; +$inSD = $pulldate0; +$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + ### Grab Server GMT value from the database + $stmt="SELECT local_gmt FROM servers where server_ip = '$server_ip';"; + $rslt=mysql_query($stmt, $link); + $gmt_recs = mysql_num_rows($rslt); + if ($gmt_recs > 0) + { + $row=mysql_fetch_row($rslt); + $DBSERVER_GMT = "$row[0]"; + if (strlen($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;} + if ($isdst) {$SERVER_GMT++;} + } + else + { + $SERVER_GMT = date("O"); + $SERVER_GMT = eregi_replace("\+","",$SERVER_GMT); + $SERVER_GMT = ($SERVER_GMT + 0); + $SERVER_GMT = ($SERVER_GMT / 100); + } + + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + +#if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";} + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + +?> + + + + + + method=post enctype="multipart/form-data"> +
+ + + + + + + + + + + + + + + + + + + + + +
Load leads from this file:
List ID Override: (numbers only or leave blank for values in the file)
Lead Duplicate Check:
Lead Time Zone Lookup:
CLICK HERE TO GO TO THE SUPER LEAD LOADER (BETA VERSION)     BACK TO ADMIN
+ +document.forms[0].leadfile.disabled=true; document.forms[0].submit_file.disabled=true; document.forms[0].reload_page.disabled=true;"; + flush(); + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"); + $lead_file = "./vicidial_temp_file.txt"; + } + else + { + $lead_file = "$LF_path"; + } + $file=fopen("$lead_file", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + $pulldate=date("Y-m-d H:i:s"); + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + + if (count($field_check)>=5) { + flush(); + $file=fopen("$lead_file", "r"); + $total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list=''; + print "
Processing $delim_name-delimited file... ($tab_count|$pipe_count)\n"; + + if (strlen($list_id_override)>0) + { + print "

LIST ID OVERRIDE FOR THIS FILE: $list_id_override

"; + } + + while (!feof($file)) { + $record++; + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + + if (strlen($buffer)>0) { + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + $vendor_lead_code = $row[0]; + $source_code = $row[1]; + $source_id=$source_code; + $list_id = $row[2]; + $phone_code = eregi_replace("[^0-9]", "", $row[3]); + $phone_number = eregi_replace("[^0-9]", "", $row[4]); + $USarea = substr($phone_number, 0, 3); + $title = $row[5]; + $first_name = $row[6]; + $middle_initial = $row[7]; + $last_name = $row[8]; + $address1 = $row[9]; + $address2 = $row[10]; + $address3 = $row[11]; + $city = $row[12]; + $state = $row[13]; + $province = $row[14]; + $postal_code = $row[15]; + $country = $row[16]; + $gender = $row[17]; + $date_of_birth = $row[18]; + $alt_phone = eregi_replace("[^0-9]", "", $row[19]); + $email = $row[20]; + $security_phrase = $row[21]; + $comments = trim($row[22]); + + if (strlen($list_id_override)>0) + { + # print "

LIST ID OVERRIDE FOR THIS FILE: $list_id_override

"; + $list_id = $list_id_override; + } + + ##### Check for duplicate phone numbers in vicidial_list table ##### + if (eregi("DUP",$dupcheck)) + { + $dup_lead=0; + $stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_lead = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + if ( (strlen($phone_number)>6) and ($dup_lead<1) ) + { + $US='_'; + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user = ""; + $gmt_offset = '0'; + $called_since_last_reset='N'; + $phone_list .= "$phone_number$US$list_id|"; + + if (strlen($phone_code)<1) {$phone_code = '1';} + + $postalgmt_found=0; + if ( (eregi("POSTAL",$postalgmt)) && (strlen($postal_code)>4) ) + { + if (preg_match('/^1$/', $phone_code)) + { + $stmt="select * from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[2]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[3]; + $dst_range = $row[4]; + $PC_processed++; + $postalgmt_found++; + $post++; + } + } + } + if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =='1') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### MEXICO ### + if ($phone_code =='52') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### AUSTRALIA ### + if ($phone_code =='61') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $PC_processed++; + $stmt="select * from vicidial_phone_codes where country_code='$phone_code';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + } + + ### Find out if DST to raise the gmt offset ### + $AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); + $AC_localtime = mktime(($Shour + $AC_GMT_diff), $Smin, $Ssec, $Smon, $Smday, $Syear); + $hour = date("H",$AC_localtime); + $min = date("i",$AC_localtime); + $sec = date("s",$AC_localtime); + $mon = date("m",$AC_localtime); + $mday = date("d",$AC_localtime); + $wday = date("w",$AC_localtime); + $year = date("Y",$AC_localtime); + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + if ( (!$AC_processed) and ($dst_range == 'SSM-FSN') ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + #********************************************************************** + # SSM-FSN + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on Second Sunday March to First Sunday November at 2 am. + # INPUTS: + # mm INTEGER Month. + # dd INTEGER Day of the month. + # ns INTEGER Seconds into the day. + # dow INTEGER Day of week (0=Sunday, to 6=Saturday) + # OPTIONAL INPUT: + # timezone INTEGER hour difference UTC - local standard time + # (DEFAULT is blank) + # make calculations based on UTC time, + # which means shift at 10:00 UTC in April + # and 9:00 UTC in October + # OUTPUT: + # INTEGER 1 = DST, 0 = not DST + # + # S M T W T F S + # 1 2 3 4 5 6 7 + # 8 9 10 11 12 13 14 + #15 16 17 18 19 20 21 + #22 23 24 25 26 27 28 + #29 30 31 + # + # S M T W T F S + # 1 2 3 4 5 6 + # 7 8 9 10 11 12 13 + #14 15 16 17 18 19 20 + #21 22 23 24 25 26 27 + #28 29 30 31 + # + #********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; + } elseif ($mm >= 4 and $mm <= 10) { + $USACAN_DST=1; + } elseif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; + } elseif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } + } else { + $USACAN_DST=0; + } + } elseif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; + } elseif ($dd < ($dow+1)) { + $USACAN_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } + } else { + $USACAN_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + #********************************************************************** + # FSA-LSO + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in April and last Sunday in October at 2 am. + #********************************************************************** + + $NA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $NA_DST=0; + } elseif ($mm >= 5 and $mm <= 9) { + $NA_DST=1; + } elseif ($mm == 4) { + if ($dd > 7) { + $NA_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $NA_DST=0; + } else { + $NA_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $NA_DST=0; + } else { + $NA_DST=1; + } + } + } else { + $NA_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $NA_DST=1; + } elseif ($dd < ($dow+25)) { + $NA_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $NA_DST=1; + } else { + $NA_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $NA_DST=1; + } else { + $NA_DST=0; + } + } + } else { + $NA_DST=0; + } + } # end of month checks + + if ($DBX) {print " DST: $NA_DST\n";} + if ($NA_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'LSM-LSO') ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in March and last Sunday in October at 1 am. + #********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; + } elseif ($mm >= 4 and $mm <= 9) { + $GBR_DST=1; + } elseif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; + } elseif ($dd < ($dow+25)) { + $GBR_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } + } else { + $GBR_DST=1; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; + } elseif ($dd < ($dow+25)) { + $GBR_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } + } else { + $GBR_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) and ($dst_range == 'LSO-LSM') ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUS_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; + } elseif ($dd < ($dow+25)) { + $AUS_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } + } else { + $AUS_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; + } elseif ($dd < ($dow+25)) { + $AUS_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } + } else { + $AUS_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-LSM') ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + #********************************************************************** + # TASMANIA ONLY + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUST_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; + } elseif ($dd < ($dow+25)) { + $AUST_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } + } else { + $AUST_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $AUST_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } + } else { + $AUST_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and third Sunday in March at 1 am. + #********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $NZL_DST=0; + } elseif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; + } elseif ($dd < ($dow+14)) { + $NZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } + } else { + $NZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $NZL_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } + } else { + $NZL_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + #********************************************************************** + # TSO-LSF + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. Brazil + # Based on Third Sunday October to Last Sunday February at 1 am. + #********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; + } elseif ($mm >= 3 and $mm <= 9) { + $BZL_DST=0; + } elseif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; + } elseif ($dd < ($dow+22)) { + $BZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } + } else { + $BZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; + } elseif ($dd < ($dow+22)) { + $BZL_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } + } else { + $BZL_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } + else + { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead\n";} + $bad++; + } + $total++; + if ($total%100==0) + { + print ""; + usleep(1000); + flush(); + } + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
DUPLICATE: $dup       POSTAL MATCH: $post
"; + + } else { + print "
ERROR: The file does not have the required number of fields to process it.
"; + } + print ""; +} else if (filesize($leadfile)>8388608) { + print "
ERROR: File exceeds the 8MB limit.
"; +} +?> + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/listloader.pl b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/listloader.pl new file mode 100644 index 00000000..d926368b --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/listloader.pl @@ -0,0 +1,1084 @@ +#!/usr/bin/perl + +### listloader.pl version 0.4 *DBI-version* +### +### Copyright (C) 2007 Matt Florell,Joe Johnson LICENSE: GPLv2 +### +# +# +# CHANGES +# 60616-1548 - Added listID override feature to force all leads into same list +# - Added gmt_offset_now lookup for each lead +# 60811-1232 - Changed to DBI +# 60811-1329 - changed to use /etc/astguiclient.conf for configs +# 60822-1121 - fixed for nonwritable directories +# 60906-1058 - added filter of non-digits in alt_phone field +# 61110-1229 - added new USA-Canada DST scheme and Brazil DST scheme +# 61128-1215 - added postal code GMT lookup and duplicate check options +# 70205-1703 - Defaulted phone_code to 1 if not populated +# 70417-1059 - Fixed default phone_code bug +# 70510-1518 - Added campaign and system duplicate check and phonecode override +# + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help|-h/i) + { + print "allowed run time options:\n [-forcelistid=1234] = overrides the listID given in the file with the 1234\n [-h] = this help screen\n\n"; + + exit; + } + else + { + if ($args =~ /-duplicate-check/i) + {$dupcheck=1;} + if ($args =~ /-duplicate-campaign-check/i) + {$dupcheckcamp=1;} + if ($args =~ /-duplicate-system-check/i) + {$dupchecksys=1;} + if ($args =~ /-postal-code-gmt/i) + {$postalgmt=1;} + if ($args =~ /--forcelistid=/i) + { + @data_in = split(/--forcelistid=/,$args); + $forcelistid = $data_in[1]; + $forcelistid =~ s/ .*//gi; + print "\n----- FORCE LISTID OVERRIDE: $forcelistid -----\n\n"; + } + else + {$forcelistid = '';} + + if ($args =~ /--forcephonecode=/i) + { + @data_in = split(/--forcephonecode=/,$args); + $forcephonecode = $data_in[1]; + $forcephonecode =~ s/ .*//gi; + print "\n----- FORCE PHONECODE OVERRIDE: $forcephonecode -----\n\n"; + } + else + {$forcephonecode = '';} + + if ($args =~ /--lead-file=/i) + { + @data_in = split(/--lead-file=/,$args); + $lead_file = $data_in[1]; + $lead_file =~ s/ .*//gi; + # print "\n----- LEAD FILE: $lead_file -----\n\n"; + } + else + {$lead_file = './vicidial_temp_file.xls';} + } +} +### end parsing run-time options ### + + +use Spreadsheet::ParseExcel; +use Time::Local; +use DBI; + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + +$|=0; +$secX = time(); + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($hour < 10) {$hour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +$pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; +$pulldate="$year-$mon-$mday $hour:$min:$sec"; +$inSD = $pulldate0; +$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + + ### Grab Server values from the database + $stmtA = "SELECT local_gmt FROM servers where server_ip = '$server_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBSERVER_GMT = "$aryA[0]"; + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + $rec_count++; + } + $sthA->finish(); + + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + +if ($isdst) {$LOCAL_GMT_OFF++;} +if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";} + + + +$total=0; $good=0; $bad=0; +print "
Processing Excel file...\n"; +open(STMT_FILE, "> $PATHlogs/listloader_stmts.txt"); + +$oBook = Spreadsheet::ParseExcel::Workbook->Parse("$lead_file"); +my($iR, $iC, $oWkS, $oWkC); + +foreach $oWkS (@{$oBook->{Worksheet}}) { + for($iR = 0 ; defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow} ; $iR++) { + + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user = ""; + $oWkC = $oWkS->{Cells}[$iR][0]; + if ($oWkC) {$vendor_lead_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][1]; + if ($oWkC) {$source_code=$oWkC->Value; } + $source_id=$source_code; + $oWkC = $oWkS->{Cells}[$iR][2]; + if ($oWkC) {$list_id=$oWkC->Value; } + $gmt_offset = '0'; + $called_since_last_reset='N'; + $oWkC = $oWkS->{Cells}[$iR][3]; + if ($oWkC) {$phone_code=$oWkC->Value; } + $phone_code=~s/[^0-9]//g; + $oWkC = $oWkS->{Cells}[$iR][4]; + if ($oWkC) {$phone_number=$oWkC->Value; } + $phone_number=~s/[^0-9]//g; + $USarea = substr($phone_number, 0, 3); + $oWkC = $oWkS->{Cells}[$iR][5]; + if ($oWkC) {$title=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][6]; + if ($oWkC) {$first_name=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][7]; + if ($oWkC) {$middle_initial=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][8]; + if ($oWkC) {$last_name=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][9]; + if ($oWkC) {$address1=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][10]; + if ($oWkC) {$address2=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][11]; + if ($oWkC) {$address3=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][12]; + if ($oWkC) {$city=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][13]; + if ($oWkC) {$state=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][14]; + if ($oWkC) {$province=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][15]; + if ($oWkC) {$postal_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][16]; + if ($oWkC) {$country=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][17]; + if ($oWkC) {$gender=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][18]; + if ($oWkC) {$date_of_birth=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][19]; + if ($oWkC) {$alt_phone=$oWkC->Value; } + $alt_phone=~s/[^0-9]//g; + $oWkC = $oWkS->{Cells}[$iR][20]; + if ($oWkC) {$email=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][21]; + if ($oWkC) {$security_phrase=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][22]; + if ($oWkC) {$comments=$oWkC->Value; } + $comments=~s/^\s*(.*?)\s*$/$1/; + + if (length($forcelistid) > 0) + { + $list_id = $forcelistid; # set list_id to override value + } + if (length($forcephonecode) > 0) + { + $phone_code = $forcephonecode; # set phone_code to override value + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if ($dupchecksys > 0) + { + $dup_lead=0; + $stmtA = "select count(*) from vicidial_list where phone_number='$phone_number';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $dup_lead = $aryA[0]; + $dup_lead_list=$list_id; + } + $sthA->finish(); + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if ($dupcheck > 0) + { + $dup_lead=0; + $stmtA = "select list_id from vicidial_list where phone_number='$phone_number' and list_id='$list_id' limit 1;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $dup_lead_list = $aryA[0]; + $dup_lead++; + } + $sthA->finish(); + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if ($dupcheckcamp > 0) + { + $dup_lead=0; + $dup_lists=''; + + $stmtA = "select count(*) from vicidial_lists where list_id='$list_id';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + @aryA = $sthA->fetchrow_array; + $ci_recs = $aryA[0]; + $sthA->finish(); + if ($ci_recs > 0) + { + $stmtA = "select campaign_id from vicidial_lists where list_id='$list_id';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + @aryA = $sthA->fetchrow_array; + $dup_camp = $aryA[0]; + $sthA->finish(); + + $stmtA = "select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $dup_lists .= "'$aryA[0]',"; + $rec_count++; + } + $sthA->finish(); + + chop($dup_lists); + $stmtA = "select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $dup_lead_list = "'$aryA[0]',"; + $rec_count++; + $dup_lead=1; + } + $sthA->finish(); + } + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + + if ( (length($phone_number)>6) && ($dup_lead < 1) ) + { + $phone_list .= "$phone_number$US$list_id|"; + $postalgmt_found=0; + if (length($phone_code)<1) {$phone_code = '1';} + + if ( ($postalgmt > 0) && (length($postal_code)>4) ) + { + if ($phone_code =~ /^1$/) + { + $stmtA = "select * from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[2]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[3]; + $dst_range = $aryA[4]; + $PC_processed++; + $rec_count++; + $postalgmt_found++; + if ($DBX) {print " Postal GMT record found for $postal_code: |$gmt_offset|$dst|$dst_range|\n";} + } + $sthA->finish(); + } + } + if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =~ /^1$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### MEXICO ### + if ($phone_code =~ /^52$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### AUSTRALIA ### + if ($phone_code =~ /^61$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + } + + ### Find out if DST to raise the gmt offset ### + $AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); + $AC_localtime = ($secX + (3600 * $AC_GMT_diff)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($AC_localtime); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + + if ( (!$AC_processed) && ($dst_range =~ /SSM-FSN/) ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + &USACAN_dstcalc; + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSA-LSO/) ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + &NA_dstcalc; + if ($DBX) {print " DST: $NA_DST\n";} + if ($NA_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /LSM-LSO/) ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + &GBR_dstcalc; + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /LSO-LSM/) ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + &AUS_dstcalc; + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSO-LSM/) ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + &AUST_dstcalc; + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSO-TSM/) ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + &NZL_dstcalc; + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /TSO-LSF/) ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + &BZL_dstcalc; + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$area_GMT++;} + $AC_processed++; + } + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $affected_rows = $dbhA->do($stmtZ); + print STMT_FILE $stmtZ."\r\n"; + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| $dup_lead_list\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + sleep(1); +# flush(); + } + } +} + +if ($multi_insert_counter > 0) { + $stmtZ = "INSERT INTO vicidial_list values ".substr($multistmt, 0, -1).";"; + $affected_rows = $dbhA->do($stmtZ); + print STMT_FILE $stmtZ."\r\n"; +} + +print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + +exit; + + + + + + +sub USACAN_dstcalc { +#********************************************************************** +# SSM-FSN +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on Second Sunday March to First Sunday November at 2 am. +# INPUTS: +# mm INTEGER Month. +# dd INTEGER Day of the month. +# ns INTEGER Seconds into the day. +# dow INTEGER Day of week (0=Sunday, to 6=Saturday) +# OPTIONAL INPUT: +# timezone INTEGER hour difference UTC - local standard time +# (DEFAULT is blank) +# make calculations based on UTC time, +# which means shift at 10:00 UTC in April +# and 9:00 UTC in October +# OUTPUT: +# INTEGER 1 = DST, 0 = not DST +# +# S M T W T F S +# 1 2 3 4 5 6 7 +# 8 9 10 11 12 13 14 +#15 16 17 18 19 20 21 +#22 23 24 25 26 27 28 +#29 30 31 +# +# S M T W T F S +# 1 2 3 4 5 6 +# 7 8 9 10 11 12 13 +#14 15 16 17 18 19 20 +#21 22 23 24 25 26 27 +#28 29 30 31 +# +#********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; return 0; + } elsif ($mm >= 4 && $mm <= 10) { + $USACAN_DST=1; return 1; + } elsif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; return 1; + } elsif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; return 0; + } else { + $USACAN_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $USACAN_DST=0; return 0; + } else { + $USACAN_DST=1; return 1; + } + } + } else { + $USACAN_DST=0; return 0; + } + } elsif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; return 0; + } elsif ($dd < ($dow+1)) { + $USACAN_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; return 1; + } else { + $USACAN_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; return 1; + } else { + $USACAN_DST=0; return 0; + } + } + } else { + $USACAN_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub NA_dstcalc { +#********************************************************************** +# FSA-LSO +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in April and last Sunday in October at 2 am. +#********************************************************************** + + $NA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $NA_DST=0; return 0; + } elsif ($mm >= 5 && $mm <= 9) { + $NA_DST=1; return 1; + } elsif ($mm == 4) { + if ($dd > 7) { + $NA_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $NA_DST=0; return 0; + } else { + $NA_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $NA_DST=0; return 0; + } else { + $NA_DST=1; return 1; + } + } + } else { + $NA_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $NA_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $NA_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $NA_DST=1; return 1; + } else { + $NA_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 7200) { + $NA_DST=1; return 1; + } else { + $NA_DST=0; return 0; + } + } + } else { + $NA_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub GBR_dstcalc { +#********************************************************************** +# LSM-LSO +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in March and last Sunday in October at 1 am. +#********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; return 0; + } elsif ($mm >= 4 && $mm <= 9) { + $GBR_DST=1; return 1; + } elsif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $GBR_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; return 0; + } else { + $GBR_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; return 0; + } else { + $GBR_DST=1; return 1; + } + } + } else { + $GBR_DST=1; return 1; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $GBR_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; return 1; + } else { + $GBR_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; return 1; + } else { + $GBR_DST=0; return 0; + } + } + } else { + $GBR_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub AUS_dstcalc { +#********************************************************************** +# LSO-LSM +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in October and last Sunday in March at 1 am. +#********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $AUS_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $AUS_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; return 1; + } else { + $AUS_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; return 1; + } else { + $AUS_DST=0; return 0; + } + } + } else { + $AUS_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $AUS_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; return 0; + } else { + $AUS_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; return 0; + } else { + $AUS_DST=1; return 1; + } + } + } else { + $AUS_DST=1; return 1; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub AUST_dstcalc { +#********************************************************************** +# FSO-LSM +# TASMANIA ONLY +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and last Sunday in March at 1 am. +#********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $AUST_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $AUST_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; return 1; + } else { + $AUST_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; return 1; + } else { + $AUST_DST=0; return 0; + } + } + } else { + $AUST_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd >= 8) { + $AUST_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $AUST_DST=0; return 0; + } else { + $AUST_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $AUST_DST=0; return 0; + } else { + $AUST_DST=1; return 1; + } + } + } else { + $AUST_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub NZL_dstcalc { +#********************************************************************** +# FSO-TSM +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and third Sunday in March at 1 am. +#********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $NZL_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; return 1; + } elsif ($dd < ($dow+14)) { + $NZL_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; return 1; + } else { + $NZL_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; return 1; + } else { + $NZL_DST=0; return 0; + } + } + } else { + $NZL_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd >= 8) { + $NZL_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $NZL_DST=0; return 0; + } else { + $NZL_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $NZL_DST=0; return 0; + } else { + $NZL_DST=1; return 1; + } + } + } else { + $NZL_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub BZL_dstcalc { +#********************************************************************** +# TSO-LSF +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. Brazil +# Based on Third Sunday October to Last Sunday February at 1 am. +#********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; return 1; + } elsif ($mm >= 3 && $mm <= 9) { + $BZL_DST=0; return 0; + } elsif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; return 1; + } elsif ($dd < ($dow+22)) { + $BZL_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; return 1; + } else { + $BZL_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; return 1; + } else { + $BZL_DST=0; return 0; + } + } + } else { + $BZL_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; return 0; + } elsif ($dd < ($dow+22)) { + $BZL_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; return 0; + } else { + $BZL_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; return 0; + } else { + $BZL_DST=1; return 1; + } + } + } else { + $BZL_DST=1; return 1; + } + } # end of month checks +} # end of subroutine dstcalc diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/listloaderMAIN.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/listloaderMAIN.php new file mode 100644 index 00000000..bb292c36 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/listloaderMAIN.php @@ -0,0 +1,86 @@ + LICENSE: GPLv2 +# +# this is the main frame page for the lead loading section. This is where you +# would upload a file and have it inserted into vicidial_list +# +# changes: +# 60620-1149 - Added variable filtering to eliminate SQL injection attack threat +# 60822-1105 - fixed for nonwritable directories +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_datetime = $STARTtime; + +$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +if ($WeBRooTWritablE > 0) {$fp = fopen ("./project_auth_entries.txt", "a");} +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-LEAD-LOADER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT load_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGload_leads =$row[0]; + + if ($LOGload_leads < 1) + { + echo "You do not have permissions to load leads\n"; + exit; + } + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "LIST_LOAD|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "LIST_LOAD|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +?> + +VICIDIAL: Lead Loader Module + + + + + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/listloader_rowdisplay.pl b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/listloader_rowdisplay.pl new file mode 100644 index 00000000..3f8695c0 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/listloader_rowdisplay.pl @@ -0,0 +1,153 @@ +#!/usr/bin/perl + +### listloader_rowdisplay.pl version 0.2 *DBI-version* +### +### Copyright (C) 2006 Matt Florell,Joe Johnson LICENSE: GPLv2 +### +# +# CHANGES +# +# 60811-1232 - Changed to DBI +# 60811-1329 - changed to use /etc/astguiclient.conf for configs +# + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help|-h/i) + { + print "allowed run time options:\n [-forcelistid=1234] = overrides the listID given in the file with the 1234\n [-h] = this help screen\n\n"; + + exit; + } + else + { + if ($args =~ /-duplicate-check/i) + {$dupcheck=1;} + if ($args =~ /-postal-code-gmt/i) + {$postalgmt=1;} + if ($args =~ /--lead-file=/i) + { + @data_in = split(/--lead-file=/,$args); + $lead_file = $data_in[1]; + $lead_file =~ s/ .*//gi; + # print "\n----- LEAD FILE: $lead_file -----\n\n"; + } + else + {$lead_file = './vicidial_temp_file.xls';} + } +} +### end parsing run-time options ### + +use Spreadsheet::ParseExcel; +use Time::Local; +use DBI; + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + +$oBook = Spreadsheet::ParseExcel::Workbook->Parse("$lead_file"); +my($iR, $iC, $oWkS, $oWkC); +$var_str=""; + +foreach $oWkS (@{$oBook->{Worksheet}}) { + for(my $iC = $oWkS->{MinCol} ; defined $oWkS->{MaxCol} && $iC <= $oWkS->{MaxCol} ; $iC++) { + $oWkC = $oWkS->{Cells}[0][$iC]; + if ($oWkC) { + $var_str.=$oWkC->Value."|"; + } else { + $var_str.="|"; + } + } +} + +@xls_row=split(/\|/, $var_str); + + +$stmtA = "select vendor_lead_code, source_id, list_id, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments from vicidial_list limit 1;"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + my $names = $sthA->{'NAME'}; + my $numFields = $sthA->{'NUM_OF_FIELDS'}; + for (my $i = 0; $i < $numFields; $i++) + { + # printf("%s%s", $i ? "," : "", $$names[$i]); + # printf("%s%s", $i ? "," : "", $$ref[$i]); + + $field_name=uc($$names[$i]); + $field_name=~s/\_/ /g; + print "
".$field_name.": \r\n"; + print " \r\n"; + print "
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Load leads from this file:
List ID Override: (numbers only or leave blank for values in the file)
Phone Code Override: (numbers only or leave blank for values in the file)
File layout to use:Standard VICIDIAL    Custom layout
Lead Duplicate Check:
Lead Time Zone Lookup:
        
        BACK TO ADMINLIST LOADER-     VERSION:     BUILD:    
+ + +document.forms[0].leadfile.disabled=true;document.forms[0].list_id_override.disabled=true;document.forms[0].phone_code_override.disabled=true; document.forms[0].submit_file.disabled=true; document.forms[0].reload_page.disabled=true;"; + flush(); + $total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list=''; + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) { + # copy($leadfile, "./vicidial_temp_file.txt"); + $file=fopen("$lead_file", "r"); + if ($WeBRooTWritablE > 0) + { + $stmt_file=fopen("listloader_stmts.txt", "w"); + } + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + + if (count($field_check)>=5) { + flush(); + $file=fopen("$lead_file", "r"); + print "
Processing $delim_name-delimited file...\n"; + + if (strlen($list_id_override)>0) + { + print "

LIST ID OVERRIDE FOR THIS FILE: $list_id_override

"; + } + + if (strlen($phone_code_override)>0) + { + print "

PHONE CODE OVERRIDE FOR THIS FILE: $phone_code_override

"; + } + + while (!feof($file)) { + $record++; + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + + if (strlen($buffer)>0) { + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[$vendor_lead_code_field]; + $source_code = $row[$source_id_field]; + $source_id=$source_code; + $list_id = $row[$list_id_field]; + $gmt_offset = '0'; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[$phone_code_field]); + $phone_number = eregi_replace("[^0-9]", "", $row[$phone_number_field]); + $USarea = substr($phone_number, 0, 3); + $title = $row[$title_field]; + $first_name = $row[$first_name_field]; + $middle_initial = $row[$middle_initial_field]; + $last_name = $row[$last_name_field]; + $address1 = $row[$address1_field]; + $address2 = $row[$address2_field]; + $address3 = $row[$address3_field]; + $city =$row[$city_field]; + $state = $row[$state_field]; + $province = $row[$province_field]; + $postal_code = $row[$postal_code_field]; + $country_code = $row[$country_code_field]; + $gender = $row[$gender_field]; + $date_of_birth = $row[$date_of_birth_field]; + $alt_phone = eregi_replace("[^0-9]", "", $row[$alt_phone_field]); + $email = $row[$email_field]; + $security_phrase = $row[$security_phrase_field]; + $comments = trim($row[$comments_field]); + + if (strlen($list_id_override)>0) + { + # print "

LIST ID OVERRIDE FOR THIS FILE: $list_id_override

"; + $list_id = $list_id_override; + } + if (strlen($phone_code_override)>0) + { + $phone_code = $phone_code_override; + } + + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if (eregi("DUPCAMP",$dupcheck)) + { + $dup_lead=0; + $dup_lists=''; + $stmt="select campaign_id from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $ci_recs = mysql_num_rows($rslt); + if ($ci_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_camp = $row[0]; + + $stmt="select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $rslt=mysql_query($stmt, $link); + $li_recs = mysql_num_rows($rslt); + if ($li_recs > 0) + { + $L=0; + while ($li_recs > $L) + { + $row=mysql_fetch_row($rslt); + $dup_lists .= "'$row[0]',"; + $L++; + } + $dup_lists = eregi_replace(",$",'',$dup_lists); + + $stmt="select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + } + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if (eregi("DUPSYS",$dupcheck)) + { + $dup_lead=0; + $stmt="select list_id from vicidial_list where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if (eregi("DUPLIST",$dupcheck)) + { + $dup_lead=0; + $stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_lead = $row[0]; + $dup_lead_list = $list_id; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + if ( (strlen($phone_number)>6) and ($dup_lead<1) ) + { + if (strlen($phone_code)<1) {$phone_code = '1';} + + $US='_'; + $phone_list .= "$phone_number$US$list_id|"; + + $gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code); + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead $dup_lead_list\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } else { + print "
ERROR: The file does not have the required number of fields to process it.
"; + } + } else if (!eregi(".csv", $leadfile_name)) { + # copy($leadfile, "./vicidial_temp_file.xls"); + $file=fopen("$lead_file", "r"); + + print "
Processing Excel file... \n"; + if (strlen($list_id_override)>0) + { + print "

LIST ID OVERRIDE FOR THIS FILE: $list_id_override

\n"; + } + if (strlen($phone_code_override)>0) + { + print "

PHONE CODE OVERRIDE FOR THIS FILE: $phone_code_override

\n"; + } + # print "|$WeBServeRRooT/vicidial/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field, --forcelistid=$list_id_override --lead_file=$lead_file|"; + $dupcheckCLI=''; $postalgmtCLI=''; + if (eregi("DUPLIST",$dupcheck)) {$dupcheckCLI='--duplicate-check';} + if (eregi("DUPCAMP",$dupcheck)) {$dupcheckCLI='--duplicate-campaign-check';} + if (eregi("DUPSYS",$dupcheck)) {$dupcheckCLI='--duplicate-system-check';} + if (eregi("POSTAL",$postalgmt)) {$postalgmtCLI='--postal-code-gmt';} + passthru("$WeBServeRRooT/vicidial/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field, --forcelistid=$list_id_override --forcephonecode=$phone_code_override --lead-file=$lead_file $postalgmtCLI $dupcheckCLI"); + } else { + # copy($leadfile, "./vicidial_temp_file.csv"); + $file=fopen("$lead_file", "r"); + + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + print "
Processing CSV file... \n"; + if (strlen($list_id_override)>0) + { + print "

LIST ID OVERRIDE FOR THIS FILE: $list_id_override

"; + } + + if (strlen($phone_code_override)>0) + { + print "

PHONE CODE OVERRIDE FOR THIS FILE: $phone_code_override

"; + } + + while($row=fgetcsv($file, 1000, ",")) { + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[$vendor_lead_code_field]; + $source_code = $row[$source_id_field]; + $source_id=$source_code; + $list_id = $row[$list_id_field]; + $gmt_offset = '0'; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[$phone_code_field]); + $phone_number = eregi_replace("[^0-9]", "", $row[$phone_number_field]); + $USarea = substr($phone_number, 0, 3); + $title = $row[$title_field]; + $first_name = $row[$first_name_field]; + $middle_initial = $row[$middle_initial_field]; + $last_name = $row[$last_name_field]; + $address1 = $row[$address1_field]; + $address2 = $row[$address2_field]; + $address3 = $row[$address3_field]; + $city =$row[$city_field]; + $state = $row[$state_field]; + $province = $row[$province_field]; + $postal_code = $row[$postal_code_field]; + $country_code = $row[$country_code_field]; + $gender = $row[$gender_field]; + $date_of_birth = $row[$date_of_birth_field]; + $alt_phone = eregi_replace("[^0-9]", "", $row[$alt_phone_field]); + $email = $row[$email_field]; + $security_phrase = $row[$security_phrase_field]; + $comments = trim($row[$comments_field]); + + if (strlen($list_id_override)>0) + { + $list_id = $list_id_override; + } + if (strlen($phone_code_override)>0) + { + $phone_code = $phone_code_override; + } + + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if (eregi("DUPCAMP",$dupcheck)) + { + $dup_lead=0; + $dup_lists=''; + $stmt="select campaign_id from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $ci_recs = mysql_num_rows($rslt); + if ($ci_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_camp = $row[0]; + + $stmt="select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $rslt=mysql_query($stmt, $link); + $li_recs = mysql_num_rows($rslt); + if ($li_recs > 0) + { + $L=0; + while ($li_recs > $L) + { + $row=mysql_fetch_row($rslt); + $dup_lists .= "'$row[0]',"; + $L++; + } + $dup_lists = eregi_replace(",$",'',$dup_lists); + + $stmt="select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + } + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if (eregi("DUPSYS",$dupcheck)) + { + $dup_lead=0; + $stmt="select list_id from vicidial_list where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if (eregi("DUPLIST",$dupcheck)) + { + $dup_lead=0; + $stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_lead = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + if ( (strlen($phone_number)>6) and ($dup_lead<1) ) + { + if (strlen($phone_code)<1) {$phone_code = '1';} + + $US='_'; + $phone_list .= "$phone_number$US$list_id|"; + + $gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code); + + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + } + print ""; + } + +if ($leadfile && filesize($LF_path)<=8388608) { + $total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list=''; + if ($file_layout=="standard") { + + print ""; + flush(); + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) { + + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"); + $lead_file = "./vicidial_temp_file.txt"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.txt"); + $lead_file = "/tmp/vicidial_temp_file.txt"; + } + $file=fopen("$lead_file", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + + if (count($field_check)>=5) { + flush(); + $file=fopen("$lead_file", "r"); + $total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list=''; + print "
Processing $delim_name-delimited file... ($tab_count|$pipe_count)\n"; + if (strlen($list_id_override)>0) + { + print "

LIST ID OVERRIDE FOR THIS FILE: $list_id_override

"; + } + if (strlen($phone_code_override)>0) + { + print "

PHONE CODE OVERRIDE FOR THIS FILE: $phone_code_override

\n"; + } + while (!feof($file)) { + $record++; + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + + if (strlen($buffer)>0) { + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[0]; + $source_code = $row[1]; + $source_id=$source_code; + $list_id = $row[2]; + $gmt_offset = '0'; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[3]); + $phone_number = eregi_replace("[^0-9]", "", $row[4]); + $USarea = substr($phone_number, 0, 3); + $title = $row[5]; + $first_name = $row[6]; + $middle_initial = $row[7]; + $last_name = $row[8]; + $address1 = $row[9]; + $address2 = $row[10]; + $address3 = $row[11]; + $city =$row[12]; + $state = $row[13]; + $province = $row[14]; + $postal_code = $row[15]; + $country_code = $row[16]; + $gender = $row[17]; + $date_of_birth = $row[18]; + $alt_phone = eregi_replace("[^0-9]", "", $row[19]); + $email = $row[20]; + $security_phrase = $row[21]; + $comments = trim($row[22]); + + if (strlen($list_id_override)>0) + { + $list_id = $list_id_override; + } + if (strlen($phone_code_override)>0) + { + $phone_code = $phone_code_override; + } + + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if (eregi("DUPCAMP",$dupcheck)) + { + $dup_lead=0; + $dup_lists=''; + $stmt="select campaign_id from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $ci_recs = mysql_num_rows($rslt); + if ($ci_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_camp = $row[0]; + + $stmt="select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $rslt=mysql_query($stmt, $link); + $li_recs = mysql_num_rows($rslt); + if ($li_recs > 0) + { + $L=0; + while ($li_recs > $L) + { + $row=mysql_fetch_row($rslt); + $dup_lists .= "'$row[0]',"; + $L++; + } + $dup_lists = eregi_replace(",$",'',$dup_lists); + + $stmt="select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + } + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if (eregi("DUPSYS",$dupcheck)) + { + $dup_lead=0; + $stmt="select list_id from vicidial_list where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if (eregi("DUPLIST",$dupcheck)) + { + $dup_lead=0; + $stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_lead = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + if ( (strlen($phone_number)>6) and ($dup_lead<1) ) + { + if (strlen($phone_code)<1) {$phone_code = '1';} + + $US='_'; + $phone_list .= "$phone_number$US$list_id|"; + + $gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code); + + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } else { + print "
ERROR: The file does not have the required number of fields to process it.
"; + } + } else if (!eregi(".csv", $leadfile_name)) + { + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"); + $lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.xls"); + $lead_file = "/tmp/vicidial_temp_file.xls"; + } + $file=fopen("$lead_file", "r"); + + # echo "|$WeBServeRRooT/vicidial/listloader.pl --forcelistid=$list_id_override --lead-file=$lead_file|"; + $dupcheckCLI=''; $postalgmtCLI=''; + if (eregi("DUPLIST",$dupcheck)) {$dupcheckCLI='--duplicate-check';} + if (eregi("DUPCAMP",$dupcheck)) {$dupcheckCLI='--duplicate-campaign-check';} + if (eregi("DUPSYS",$dupcheck)) {$dupcheckCLI='--duplicate-system-check';} + if (eregi("POSTAL",$postalgmt)) {$postalgmtCLI='--postal-code-gmt';} + passthru("$WeBServeRRooT/vicidial/listloader.pl --forcelistid=$list_id_override --forcephonecode=$phone_code_override --lead-file=$lead_file $postalgmtCLI $dupcheckCLI"); + + } + else + { + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"); + $lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.csv"); + $lead_file = "/tmp/vicidial_temp_file.csv"; + } + $file=fopen("$lead_file", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + print "
Processing CSV file... \n"; + + if (strlen($list_id_override)>0) + { + print "

LIST ID OVERRIDE FOR THIS FILE: $list_id_override

"; + } + if (strlen($phone_code_override)>0) + { + print "

PHONE CODE OVERRIDE FOR THIS FILE: $phone_code_override

"; + } + + while($row=fgetcsv($file, 1000, ",")) { + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[0]; + $source_code = $row[1]; + $source_id=$source_code; + $list_id = $row[2]; + $gmt_offset = '0'; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[3]); + $phone_number = eregi_replace("[^0-9]", "", $row[4]); + $USarea = substr($phone_number, 0, 3); + $title = $row[5]; + $first_name = $row[6]; + $middle_initial = $row[7]; + $last_name = $row[8]; + $address1 = $row[9]; + $address2 = $row[10]; + $address3 = $row[11]; + $city =$row[12]; + $state = $row[13]; + $province = $row[14]; + $postal_code = $row[15]; + $country_code = $row[16]; + $gender = $row[17]; + $date_of_birth = $row[18]; + $alt_phone = eregi_replace("[^0-9]", "", $row[19]); + $email = $row[20]; + $security_phrase = $row[21]; + $comments = trim($row[22]); + + if (strlen($list_id_override)>0) + { + $list_id = $list_id_override; + } + if (strlen($phone_code_override)>0) + { + $phone_code = $phone_code_override; + } + + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if (eregi("DUPCAMP",$dupcheck)) + { + $dup_lead=0; + $dup_lists=''; + $stmt="select campaign_id from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $ci_recs = mysql_num_rows($rslt); + if ($ci_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_camp = $row[0]; + + $stmt="select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $rslt=mysql_query($stmt, $link); + $li_recs = mysql_num_rows($rslt); + if ($li_recs > 0) + { + $L=0; + while ($li_recs > $L) + { + $row=mysql_fetch_row($rslt); + $dup_lists .= "'$row[0]',"; + $L++; + } + $dup_lists = eregi_replace(",$",'',$dup_lists); + + $stmt="select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + } + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if (eregi("DUPSYS",$dupcheck)) + { + $dup_lead=0; + $stmt="select list_id from vicidial_list where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if (eregi("DUPLIST",$dupcheck)) + { + $dup_lead=0; + $stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_lead = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + if ( (strlen($phone_number)>6) and ($dup_lead<1) ) + { + if (strlen($phone_code)<1) {$phone_code = '1';} + + $US='_'; + $phone_list .= "$phone_number$US$list_id|"; + + $gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code); + + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } + print ""; + + } else { + print "
"; + flush(); + print "\r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + + $rslt=mysql_query("select vendor_lead_code, source_id, list_id, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments from vicidial_list limit 1", $link); + + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) + { + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"); + $lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.txt"); + $lead_file = "/tmp/vicidial_temp_file.txt"; + } + $file=fopen("$lead_file", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + flush(); + $file=fopen("$lead_file", "r"); + print "
Processing $delim_name-delimited file...\n"; + + if (strlen($list_id_override)>0) + { + print "

LIST ID OVERRIDE FOR THIS FILE: $list_id_override

"; + } + if (strlen($phone_code_override)>0) + { + print "

PHONE CODE OVERRIDE FOR THIS FILE: $phone_code_override

"; + } + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + for ($i=0; $i\r\n"; + print "
\r\n"; + print " \r\n"; + print " \r\n"; + + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + } + } + else if (!eregi(".csv", $leadfile_name)) + { + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"); + $lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.xls"); + $lead_file = "/tmp/vicidial_temp_file.xls"; + } + + # echo "|$WeBServeRRooT/vicidial/listloader_rowdisplay.pl --lead-file=$lead_file|"; + $dupcheckCLI=''; $postalgmtCLI=''; + if (eregi("DUPLIST",$dupcheck)) {$dupcheckCLI='--duplicate-check';} + if (eregi("DUPCAMP",$dupcheck)) {$dupcheckCLI='--duplicate-campaign-check';} + if (eregi("DUPSYS",$dupcheck)) {$dupcheckCLI='--duplicate-system-check';} + if (eregi("POSTAL",$postalgmt)) {$postalgmtCLI='--postal-code-gmt';} + passthru("$WeBServeRRooT/vicidial/listloader_rowdisplay.pl --lead-file=$lead_file $postalgmtCLI $dupcheckCLI"); + } + else + { + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"); + $lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.csv"); + $lead_file = "/tmp/vicidial_temp_file.csv"; + } + $file=fopen("$lead_file", "r"); + + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + print "
Processing CSV file... \n"; + + if (strlen($list_id_override)>0) + { + print "

LIST ID OVERRIDE FOR THIS FILE: $list_id_override

"; + } + if (strlen($phone_code_override)>0) + { + print "

PHONE CODE OVERRIDE FOR THIS FILE: $phone_code_override

"; + } + + $total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list=''; + $row=fgetcsv($file, 1000, ","); + for ($i=0; $i\r\n"; + print "
\r\n"; + print " \r\n"; + print " \r\n"; + + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + } + } + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print "
VICIDIAL ColumnFile data
".strtoupper(eregi_replace("_", " ", mysql_field_name($rslt, $i))).":
$row[$i]
".strtoupper(eregi_replace("_", " ", mysql_field_name($rslt, $i))).":
$row[$i]
        
\r\n"; + # } + print ""; + } +} else if (filesize($leadfile)>8388608) { + print "
ERROR: File exceeds the 8MB limit.
"; +} +?> + + + + + + + + +4) ) + { + if (preg_match('/^1$/', $phone_code)) + { + $stmt="select * from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[2]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[3]; + $dst_range = $row[4]; + $PC_processed++; + $postalgmt_found++; + $post++; + } + } + } +if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =='1') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### MEXICO ### + if ($phone_code =='52') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### AUSTRALIA ### + if ($phone_code =='61') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $PC_processed++; + $stmt="select * from vicidial_phone_codes where country_code='$phone_code';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + } + +### Find out if DST to raise the gmt offset ### +$AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); +$AC_localtime = mktime(($Shour + $AC_GMT_diff), $Smin, $Ssec, $Smon, $Smday, $Syear); + $hour = date("H",$AC_localtime); + $min = date("i",$AC_localtime); + $sec = date("s",$AC_localtime); + $mon = date("m",$AC_localtime); + $mday = date("d",$AC_localtime); + $wday = date("w",$AC_localtime); + $year = date("Y",$AC_localtime); +$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + +$AC_processed=0; +if ( (!$AC_processed) and ($dst_range == 'SSM-FSN') ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + #********************************************************************** + # SSM-FSN + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on Second Sunday March to First Sunday November at 2 am. + # INPUTS: + # mm INTEGER Month. + # dd INTEGER Day of the month. + # ns INTEGER Seconds into the day. + # dow INTEGER Day of week (0=Sunday, to 6=Saturday) + # OPTIONAL INPUT: + # timezone INTEGER hour difference UTC - local standard time + # (DEFAULT is blank) + # make calculations based on UTC time, + # which means shift at 10:00 UTC in April + # and 9:00 UTC in October + # OUTPUT: + # INTEGER 1 = DST, 0 = not DST + # + # S M T W T F S + # 1 2 3 4 5 6 7 + # 8 9 10 11 12 13 14 + #15 16 17 18 19 20 21 + #22 23 24 25 26 27 28 + #29 30 31 + # + # S M T W T F S + # 1 2 3 4 5 6 + # 7 8 9 10 11 12 13 + #14 15 16 17 18 19 20 + #21 22 23 24 25 26 27 + #28 29 30 31 + # + #********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; + } elseif ($mm >= 4 and $mm <= 10) { + $USACAN_DST=1; + } elseif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; + } elseif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } + } else { + $USACAN_DST=0; + } + } elseif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; + } elseif ($dd < ($dow+1)) { + $USACAN_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } + } else { + $USACAN_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$gmt_offset++;} + $AC_processed++; + } + +if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + #********************************************************************** + # FSA-LSO + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in April and last Sunday in October at 2 am. + #********************************************************************** + + $USA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $USA_DST=0; + } elseif ($mm >= 5 and $mm <= 9) { + $USA_DST=1; + } elseif ($mm == 4) { + if ($dd > 7) { + $USA_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } + } else { + $USA_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $USA_DST=1; + } elseif ($dd < ($dow+25)) { + $USA_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } + } else { + $USA_DST=0; + } + } # end of month checks + + if ($DBX) {print " DST: $USA_DST\n";} + if ($USA_DST) {$gmt_offset++;} + $AC_processed++; + } + +if ( (!$AC_processed) and ($dst_range == 'LSM-LSO') ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in March and last Sunday in October at 1 am. + #********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; + } elseif ($mm >= 4 and $mm <= 9) { + $GBR_DST=1; + } elseif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; + } elseif ($dd < ($dow+25)) { + $GBR_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } + } else { + $GBR_DST=1; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; + } elseif ($dd < ($dow+25)) { + $GBR_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } + } else { + $GBR_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } +if ( (!$AC_processed) and ($dst_range == 'LSO-LSM') ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUS_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; + } elseif ($dd < ($dow+25)) { + $AUS_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } + } else { + $AUS_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; + } elseif ($dd < ($dow+25)) { + $AUS_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } + } else { + $AUS_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + +if ( (!$AC_processed) and ($dst_range == 'FSO-LSM') ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + #********************************************************************** + # TASMANIA ONLY + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUST_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; + } elseif ($dd < ($dow+25)) { + $AUST_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } + } else { + $AUST_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $AUST_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } + } else { + $AUST_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } +if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and third Sunday in March at 1 am. + #********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $NZL_DST=0; + } elseif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; + } elseif ($dd < ($dow+14)) { + $NZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } + } else { + $NZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $NZL_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } + } else { + $NZL_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + +if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + #********************************************************************** + # TSO-LSF + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. Brazil + # Based on Third Sunday October to Last Sunday February at 1 am. + #********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; + } elseif ($mm >= 3 and $mm <= 9) { + $BZL_DST=0; + } elseif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; + } elseif ($dd < ($dow+22)) { + $BZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } + } else { + $BZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; + } elseif ($dd < ($dow+22)) { + $BZL_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } + } else { + $BZL_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$gmt_offset++;} + $AC_processed++; + } + +if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + +return $gmt_offset; +} \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/phone_stats.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/phone_stats.php new file mode 100644 index 00000000..0daaf2fd --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/phone_stats.php @@ -0,0 +1,245 @@ + LICENSE: GPLv2 +# +# +# changes: +# 60620-1333 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 60927-1548 - Changed to vicidial_users for authentication +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["begin_date"])) {$begin_date=$_GET["begin_date"];} + elseif (isset($_POST["begin_date"])) {$begin_date=$_POST["begin_date"];} +if (isset($_GET["end_date"])) {$end_date=$_GET["end_date"];} + elseif (isset($_POST["end_date"])) {$end_date=$_POST["end_date"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["full_name"])) {$full_name=$_GET["full_name"];} + elseif (isset($_POST["full_name"])) {$full_name=$_POST["full_name"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$admin_page = './admin.php'; + +if (!isset($begin_date)) {$begin_date = $TODAY;} +if (!isset($end_date)) {$end_date = $TODAY;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and view_reports='1';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-ASTERISK\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "ASTERISK|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + ##### get server listing for dynamic pulldown + $stmt="SELECT fullname from phones where server_ip='$server_ip' and extension='$extension'"; + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $fullname = $row[0]; + } + else + { + fwrite ($fp, "ASTERISK|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +?> + + +VICIDIAL ADMIN: Phone Stats + + +
+ + + + + + + +\n"; +echo "
  VICIDIAL ADMIN: Administration  
  LIST ALL PHONES | ADD A NEW PHONE | SEARCH FOR A PHONE | ADD A SERVER | LIST ALL SERVERS
  SHOW ALL CONFERENCES | ADD A NEW CONFERENCE
  \n"; + +echo "
\n"; +echo "\n"; +echo "\n"; +echo " to \n"; +echo "  \n"; +echo "\n"; + + +echo "           $user - $full_name\n"; + +echo "
\n"; + + + $stmt="SELECT count(*),channel_group, sum(length_in_sec) from call_log where extension='" . mysql_real_escape_string($extension) . "' and server_ip='" . mysql_real_escape_string($server_ip) . "' and start_time >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and start_time <= '" . mysql_real_escape_string($end_date) . " 23:59:59' group by channel_group order by channel_group"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); +# echo "|$stmt|\n"; + +echo "
\n"; + +echo "CALL TIME AND CHANNELS:\n"; + +echo "
\n"; +echo "\n"; + + $total_calls=0; + $o=0; + while ($statuses_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $call_seconds = $row[2]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} + + echo ""; + echo "\n"; + echo "\n"; + $total_calls = ($total_calls + $row[0]); + + $call_seconds=0; + $o++; + } + + $stmt="SELECT sum(length_in_sec) from call_log where extension='" . mysql_real_escape_string($extension) . "' and server_ip='" . mysql_real_escape_string($server_ip) . "' and start_time >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and start_time <= '" . mysql_real_escape_string($end_date) . " 23:59:59'"; + $rslt=mysql_query($stmt, $link); + $counts_to_print = mysql_num_rows($rslt); + $row=mysql_fetch_row($rslt); + $call_seconds = $row[0]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} +# echo "|$stmt|\n"; + +echo "\n"; +echo "
CHANNEL GROUP COUNT HOURS:MINUTES
$row[1] $row[0] $call_hours_int:$call_minutes_int
TOTAL CALLS $total_calls $call_hours_int:$call_minutes_int
\n"; +echo "

\n"; + +echo "
\n"; + +echo "LAST 1000 CALLS FOR DATE RANGE:\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT number_dialed,channel_group,start_time,length_in_min from call_log where extension='" . mysql_real_escape_string($extension) . "' and server_ip='" . mysql_real_escape_string($server_ip) . "' and start_time >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and start_time <= '" . mysql_real_escape_string($end_date) . " 23:59:59' LIMIT 1000"; + $rslt=mysql_query($stmt, $link); + $events_to_print = mysql_num_rows($rslt); +# echo "|$stmt|\n"; + + $total_calls=0; + $o=0; + $event_start_seconds=''; + $event_stop_seconds=''; + while ($events_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + + + $call_seconds=0; + $o++; + } + + +echo "
NUMBER CHANNEL GROUP DATE LENGTH(MIN.)
$row[0] $row[1] $row[2] $row[3]
\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/record_conf_1_hour.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/record_conf_1_hour.php new file mode 100644 index 00000000..d184e457 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/record_conf_1_hour.php @@ -0,0 +1,156 @@ + LICENSE: GPLv2 +### +# grab: $server_ip $station $session_id +# +# CHANGES +# +# 60620-1011 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["station"])) {$station=$_GET["station"];} + elseif (isset($_POST["station"])) {$station=$_POST["station"];} +if (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];} + elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];} +if (isset($_GET["NEW_RECORDING"])) {$NEW_RECORDING=$_GET["NEW_RECORDING"];} + elseif (isset($_POST["NEW_RECORDING"])) {$NEW_RECORDING=$_POST["NEW_RECORDING"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$MYSQL_datetime = date("Y-m-d H:i:s"); +$FILE_datetime = date("Ymd-His_"); +$secX = $STARTtime; + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + + $stmt="SELECT full_name from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + } + + + + +?> + + +VICIDIAL RECORD CONFERENCE: 1 hour +\n"; +?> + + +
+ + 8) && (strlen($session_id) > 3) && (strlen($station) > 3) ) + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $conf_silent_prefix = '7'; + $ext_context = 'demo'; + + $stmt="INSERT INTO vicidial_manager values('','','$MYSQL_datetime','NEW','N','" . mysql_real_escape_string($server_ip) . "','','Originate','RB$FILE_datetime" . mysql_real_escape_string($station) . "','Channel: $local_DEF$conf_silent_prefix" . mysql_real_escape_string($session_id) . "$local_AMP$ext_context','Context: $ext_context','Exten: 8309','Priority: 1','Callerid: $FILE_datetime" . mysql_real_escape_string($station) . "','','','','','')"; + echo "|$stmt|\n

\n"; + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('" . mysql_real_escape_string($session_id) . "','" . mysql_real_escape_string($server_ip) . "','" . mysql_real_escape_string($station) . "','$MYSQL_datetime','$secX','$FILE_datetime" . mysql_real_escape_string($station) . "')"; + echo "|$stmt|\n

\n"; + $rslt=mysql_query($stmt, $link); + + echo "Recording started\n

\n"; + echo "Back to main recording screen\n

\n"; + } + else + { + echo "ERROR!!!! Not all info entered properly\n

\n"; + echo "|$server_ip| |$session_id| |$station|\n

\n"; + echo "Back to main recording screen\n

\n"; + } +} +else +{ +echo "
Start recording a conference for 1 hour: \n"; +echo "\n"; +echo "server_ip: | \n"; +echo "session_id: | \n"; +echo "station: | \n"; +echo "\n"; +echo "


\n"; + + + +} +?> + + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/remote_dispo.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/remote_dispo.php new file mode 100644 index 00000000..da249fba --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/remote_dispo.php @@ -0,0 +1,327 @@ + LICENSE: GPLv2 +### +# this is the remote agent disposition screen for calls sent to remote agents. This allows the remote agent to modify customer information and disposition the call + +# CHANGES +# +# 60619-1626 - Added variable filtering to eliminate SQL injection attack threat +# + + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +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["alt_phone"])) {$alt_phone=$_GET["alt_phone"];} + elseif (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];} +if (isset($_GET["call_began"])) {$call_began=$_GET["call_began"];} + elseif (isset($_POST["call_began"])) {$call_began=$_POST["call_began"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];} + elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];} +if (isset($_GET["city"])) {$city=$_GET["city"];} + elseif (isset($_POST["city"])) {$city=$_POST["city"];} +if (isset($_GET["comments"])) {$comments=$_GET["comments"];} + elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];} +if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];} + elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];} +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["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];} + elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];} +if (isset($_GET["email"])) {$email=$_GET["email"];} + elseif (isset($_POST["email"])) {$email=$_POST["email"];} +if (isset($_GET["end_call"])) {$end_call=$_GET["end_call"];} + elseif (isset($_POST["end_call"])) {$end_call=$_POST["end_call"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];} + elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];} + elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["parked_time"])) {$parked_time=$_GET["parked_time"];} + elseif (isset($_POST["parked_time"])) {$parked_time=$_POST["parked_time"];} +if (isset($_GET["pass"])) {$pass=$_GET["pass"];} + elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];} +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["phone"])) {$phone=$_GET["phone"];} + elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];} +if (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];} + elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];} +if (isset($_GET["province"])) {$province=$_GET["province"];} + elseif (isset($_POST["province"])) {$province=$_POST["province"];} +if (isset($_GET["security"])) {$security=$_GET["security"];} + elseif (isset($_POST["security"])) {$security=$_POST["security"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["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["session_id"])) {$session_id=$_GET["session_id"];} + elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];} +if (isset($_GET["state"])) {$state=$_GET["state"];} + elseif (isset($_POST["state"])) {$state=$_POST["state"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["tsr"])) {$tsr=$_GET["tsr"];} + elseif (isset($_POST["tsr"])) {$tsr=$_POST["tsr"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_datetime = $STARTtime; + +$ext_context = 'demo'; +if (!isset($begin_date)) {$begin_date = $TODAY;} +if (!isset($end_date)) {$end_date = $TODAY;} + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 2;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + } + else + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +?> + + +VICIDIAL REMOTE: Call Disposition +\n"; +?> + + +
+ +"; + +if ($end_call > 0) +{ + +$call_length = ($STARTtime - $call_began); + + ### insert a NEW record to the vicidial_closer_log table + $stmt="UPDATE vicidial_closer_log set end_epoch='$STARTtime', length_in_sec='" . mysql_real_escape_string($call_length) . "', status='" . mysql_real_escape_string($status) . "', user='$PHP_AUTH_USER' where lead_id='" . mysql_real_escape_string($lead_id) . "' order by start_epoch desc limit 1;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ### update the lead record in the vicidial_list table + $stmt="UPDATE vicidial_list set status='" . mysql_real_escape_string($status) . "',first_name='" . mysql_real_escape_string($first_name) . "',last_name='" . mysql_real_escape_string($last_name) . "',address1='" . mysql_real_escape_string($address1) . "',address2='" . mysql_real_escape_string($address2) . "',address3='" . mysql_real_escape_string($address3) . "',city='" . mysql_real_escape_string($city) . "',state='" . mysql_real_escape_string($state) . "',province='" . mysql_real_escape_string($province) . "',postal_code='" . mysql_real_escape_string($postal_code) . "',country_code='" . mysql_real_escape_string($country_code) . "',alt_phone='" . mysql_real_escape_string($alt_phone) . "',email='" . mysql_real_escape_string($email) . "',security_phrase='" . mysql_real_escape_string($security) . "',comments='" . mysql_real_escape_string($comments) . "',user='$PHP_AUTH_USER' where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "Call has been dispositioned       $NOW_TIME\n

\n"; + + echo "\n"; + +} +else +{ + $stmt="SELECT count(*) from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_count = $row[0]; + + if ($lead_count > 0) + { + + $stmt="SELECT * from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_id = "$row[0]"; + $tsr = "$row[4]"; + $vendor_id = "$row[5]"; + $list_id = "$row[7]"; + $campaign_id = "$row[8]"; + $phone_code = "$row[10]"; + $phone_number = "$row[11]"; + $title = "$row[12]"; + $first_name = "$row[13]"; # + $middle_initial = "$row[14]"; + $last_name = "$row[15]"; # + $address1 = "$row[16]"; # + $address2 = "$row[17]"; # + $address3 = "$row[18]"; # + $city = "$row[19]"; # + $state = "$row[20]"; # + $province = "$row[21]"; # + $postal_code = "$row[22]"; # + $country_code = "$row[23]"; # + $gender = "$row[24]"; + $date_of_birth = "$row[25]"; + $alt_phone = "$row[26]"; # + $email = "$row[27]"; # + $security = "$row[28]"; # + $comments = "$row[29]"; # + + echo "
Call information: $first_name $last_name - $phone_number

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + echo "\n"; + echo "
Vendor ID: $vendor_id     Campaign ID: $campaign_id
Fronter: $tsr     List ID: $list_id
First Name:   \n"; + echo " Last Name:
Address 1 :
Address 2 :
Address 3 :
City :
State:   \n"; + echo " Postal Code:
Province :
Country :
Alt Phone :
Email :
Security :
Comments :
Disposition:
\n"; + echo "


\n"; + + } + else + { + echo "lead lookup FAILED for lead_id $lead_id       $NOW_TIME\n

\n"; +# echo "Close this window\n

\n"; + } + + + + + + +} + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/server_stats.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/server_stats.php new file mode 100644 index 00000000..8e509383 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/server_stats.php @@ -0,0 +1,97 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60620-1037 - Added Link back to Admin section +# - Added required user/pass to gain access to this page +# 61101-1331 - Added SIP/IAX listen/barge links +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($query_date)) {$query_date = $NOW_DATE;} + +$stmt="select * from servers;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$servers_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $servers_to_print) + { + $row=mysql_fetch_row($rslt); + $server_id[$i] = $row[0]; + $server_description[$i] = $row[1]; + $server_ip[$i] = $row[2]; + $active[$i] = $row[3]; + $i++; + } +?> + + + + + +VICIDIAL: Server Stats and Reports +VICIDIAL: Server Stats and Reports                           +BACK TO ADMIN

+ + +

+
+ $o)
+	{
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	$o++;
+	}
+
+?>
+
SERVERDESCRIPTIONIP ADDRESSACTIVEVDAD timeVDcall timePARK timeCLOSER/INBOUND time
$server_id[$o]$server_description[$o]$server_ip[$o]$active[$o]LINKLINKLINKLINK
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/user_stats.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/user_stats.php new file mode 100644 index 00000000..ecd457f8 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/user_stats.php @@ -0,0 +1,408 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1743 - Added variable filtering to eliminate SQL injection attack threat +# 61201-1136 - Added recordings display and changed calls to time range with 10000 limit +# 70118-1605 - Added user group column to login/out and calls lists +# 70702-1231 - Added recording location link and truncation +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["begin_date"])) {$begin_date=$_GET["begin_date"];} + elseif (isset($_POST["begin_date"])) {$begin_date=$_POST["begin_date"];} +if (isset($_GET["end_date"])) {$end_date=$_GET["end_date"];} + elseif (isset($_POST["end_date"])) {$end_date=$_POST["end_date"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); + +if (!isset($begin_date)) {$begin_date = $TODAY;} +if (!isset($end_date)) {$end_date = $TODAY;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and view_reports='1';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + + $stmt="SELECT full_name from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + } + + + + +?> + + +VICIDIAL ADMIN: User Stats +\n"; +?> + + +
+ + + + + +\n"; +echo "
" ?>   VICIDIAL ADMIN: User Stats for  
  \n"; + +echo "
\n"; +echo "\n"; +echo " to \n"; +echo "  \n"; +echo "\n"; + + +echo "           $user - $full_name\n"; + +echo " - VICIDIAL Time Sheet\n"; +echo " - User Status\n"; +echo " - Modify User\n"; + + +echo "
\n"; + + + $stmt="SELECT count(*),status, sum(length_in_sec) from vicidial_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' group by status order by status"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + +echo "
\n"; + +echo "TALK TIME AND STATUS:\n"; + +echo "
\n"; +echo "\n"; + + $total_calls=0; + $o=0; + while ($statuses_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $call_seconds = $row[2]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} + + echo ""; + echo "\n"; + echo "\n"; + $total_calls = ($total_calls + $row[0]); + + $call_seconds=0; + $o++; + } + + $stmt="SELECT sum(length_in_sec) from vicidial_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59'"; + $rslt=mysql_query($stmt, $link); + $counts_to_print = mysql_num_rows($rslt); + $row=mysql_fetch_row($rslt); + $call_seconds = $row[0]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} + +echo "\n"; +echo "
STATUSCOUNTHOURS:MINUTES
$row[1] $row[0] $call_hours_int:$call_minutes_int
TOTAL CALLS $total_calls $call_hours_int:$call_minutes_int
\n"; +echo "

\n"; + +echo "
\n"; + +echo "LOGIN/LOGOUT TIME:\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT event,event_epoch,event_date,campaign_id,user_group from vicidial_user_log where user='" . mysql_real_escape_string($user) . "' and event_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and event_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59'"; + $rslt=mysql_query($stmt, $link); + $events_to_print = mysql_num_rows($rslt); + + $total_calls=0; + $o=0; + $event_start_seconds=''; + $event_stop_seconds=''; + while ($events_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("LOGIN", $row[0])) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + if (ereg("LOGIN", $row[0])) + { + $event_start_seconds = $row[1]; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + if (ereg("LOGOUT", $row[0])) + { + if ($event_start_seconds) + { + $event_stop_seconds = $row[1]; + $event_seconds = ($event_stop_seconds - $event_start_seconds); + $total_login_time = ($total_login_time + $event_seconds); + $event_hours = ($event_seconds / 3600); + $event_hours = round($event_hours, 2); + $event_hours_int = intval("$event_hours"); + $event_minutes = ($event_hours - $event_hours_int); + $event_minutes = ($event_minutes * 60); + $event_minutes_int = round($event_minutes, 0); + if ($event_minutes_int < 10) {$event_minutes_int = "0$event_minutes_int";} + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + $event_start_seconds=''; + $event_stop_seconds=''; + } + else + { + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + } + } + + $total_calls = ($total_calls + $row[0]); + + $call_seconds=0; + $o++; + } + +$total_login_hours = ($total_login_time / 3600); +$total_login_hours = round($total_login_hours, 2); +$total_login_hours_int = intval("$total_login_hours"); +$total_login_minutes = ($total_login_hours - $total_login_hours_int); +$total_login_minutes = ($total_login_minutes * 60); +$total_login_minutes_int = round($total_login_minutes, 0); +if ($total_login_minutes_int < 10) {$total_login_minutes_int = "0$total_login_minutes_int";} + +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "
EVENT DATE CAMPAIGN GROUPHOURS:MINUTES
$row[0] $row[2] $row[3] $row[4]
$row[0] $row[2] $row[3] $row[4] $event_hours_int:$event_minutes_int
$row[0] $row[2] $row[3]
TOTAL $total_login_hours_int:$total_login_minutes_int
\n"; + + +echo "

\n"; + +echo "
\n"; + +echo "OUTBOUND CALLS FOR THIS TIME PERIOD: (10000 record limit)\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from vicidial_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $u++; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + } + + +echo "
# DATE/TIME LENGTH STATUS PHONE CAMPAIGN GROUP LIST LEAD
$u$row[4] $row[7] $row[8] $row[10] $row[3] $row[14] $row[2] $row[1]


\n"; + + + +echo "CLOSER CALLS FOR THIS TIME PERIOD: (10000 record limit)\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from vicidial_closer_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $u++; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + } + + +echo "
# DATE/TIME LENGTH STATUS PHONE CAMPAIGN WAIT (S) LIST LEAD
$u$row[4] $row[7] $row[8] $row[10] $row[3] $row[14] $row[2] $row[1]


\n"; + + + + +echo "RECORDINGS FOR THIS TIME PERIOD: (10000 record limit)\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from recording_log where user='" . mysql_real_escape_string($user) . "' and start_time >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and start_time <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by recording_id desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) + { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $location = $row[11]; + if (strlen($location)>30) + {$locat = substr($location,0,27); $locat = "$locat...";} + else + {$locat = $location;} + if (eregi("http",$location)) + {$location = "$locat";} + else + {$location = $locat;} + $u++; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + } + + +echo "
# LEADDATE/TIME SECONDS   RECIDFILENAMELOCATION  
$u $row[12] $row[4] $row[8] $row[0] $row[10] $location  
\n"; + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/user_status.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/user_status.php new file mode 100644 index 00000000..ecffbc5c --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/user_status.php @@ -0,0 +1,242 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1738 - Added variable filtering to eliminate SQL injection attack threat +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["begin_date"])) {$begin_date=$_GET["begin_date"];} + elseif (isset($_POST["begin_date"])) {$begin_date=$_POST["begin_date"];} +if (isset($_GET["end_date"])) {$end_date=$_GET["end_date"];} + elseif (isset($_POST["end_date"])) {$end_date=$_POST["end_date"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); + +if (!isset($begin_date)) {$begin_date = $TODAY;} +if (!isset($end_date)) {$end_date = $TODAY;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and view_reports='1';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $stmt="SELECT full_name,change_agent_campaign from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $change_agent_campaign=$row[1]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + + $stmt="SELECT full_name,user_group from vicidial_users where user='" . mysql_real_escape_string($user) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + $user_group = $row[1]; + + $stmt="SELECT * from vicidial_live_agents where user='" . mysql_real_escape_string($user) . "';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $agents_to_print = mysql_num_rows($rslt); + $i=0; + while ($i < $agents_to_print) + { + $row=mysql_fetch_row($rslt); + $Aserver_ip = $row[2]; + $Asession_id = $row[3]; + $Aextension = $row[4]; + $Astatus = $row[5]; + $Acampaign = $row[7]; + $Alast_call = $row[14]; + $Acl_campaigns = $row[15]; + $i++; + } + + } + +$stmt="select * from vicidial_campaigns;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + + + +?> + + +VICIDIAL ADMIN: User Status +\n"; +?> + + +
+
+ + + + +\n"; +echo "
" ?>   VICIDIAL ADMIN: User Status for  
  \n"; + +if ($stage == "live_campaign_change") +{ + $stmt="UPDATE vicidial_live_agents set campaign_id='" . mysql_real_escape_string($group) . "' where user='" . mysql_real_escape_string($user) . "';"; + $rslt=mysql_query($stmt, $link); + + echo "Agent $user - $full_name changed to $group campaign
\n"; + + exit; +} + +if ($stage == "log_agent_out") +{ + $stmt="DELETE from vicidial_live_agents where user='" . mysql_real_escape_string($user) . "';"; + $rslt=mysql_query($stmt, $link); + + echo "Agent $user - $full_name has been emergency logged out, make sure they close their web browser
\n"; + + exit; +} + +if ($agents_to_print > 0) +{ + echo "
";
+	echo "Agent Logged in at server:  $Aserver_ip\n";
+	echo "               in session:  $Asession_id\n";
+	echo "               from phone:  $Aextension\n";
+	echo "Agent is in campaign:       $Acampaign\n";
+	echo "              status:       $Astatus\n";
+	echo " hungup last call at:       $Alast_call\n";
+	echo "       Closer groups:       $Acl_campaigns\n\n";
+
+	echo "
"; + + + if ($change_agent_campaign > 0) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "Current Campaign: \n"; + echo "
\n"; + + + echo "
\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + } +} + +else +{ + echo "Agent is not logged in\n
"; + +} + + +echo "           $user - $full_name \n"; +echo "       GROUP: $user_group

\n"; + +echo "VICIDIAL Time Sheet\n"; +echo " - User Stats\n"; +echo " - Modify User\n"; + +echo "
\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + +echo "|$stage|$group|"; + +?> + + +
+ + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/vdremote.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/vdremote.php new file mode 100644 index 00000000..dfe11fa3 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/vdremote.php @@ -0,0 +1,602 @@ + LICENSE: GPLv2 +# +# Changes +# 50307-1721 - First version +# 51123-1502 - removed requirement of PHP Globals=on +# 60421-1229 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1603 - Added variable filtering to eliminate SQL injection attack threat +# +# make sure you have added a user to the vicidial_users MySQL table with at least user_level 4 to access this page the first time + +$version = '1.1.12'; +$build = '60619-1603'; + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["ADD"])) {$ADD=$_GET["ADD"];} + elseif (isset($_POST["ADD"])) {$ADD=$_POST["ADD"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["force_logout"])) {$force_logout=$_GET["force_logout"];} + elseif (isset($_POST["force_logout"])) {$force_logout=$_POST["force_logout"];} +if (isset($_GET["groups"])) {$groups=$_GET["groups"];} + elseif (isset($_POST["groups"])) {$groups=$_POST["groups"];} +if (isset($_GET["remote_agent_id"])) {$remote_agent_id=$_GET["remote_agent_id"];} + elseif (isset($_POST["remote_agent_id"])) {$remote_agent_id=$_POST["remote_agent_id"];} +if (isset($_GET["user_start"])) {$user_start=$_GET["user_start"];} + elseif (isset($_POST["user_start"])) {$user_start=$_POST["user_start"];} +if (isset($_GET["number_of_lines"])) {$number_of_lines=$_GET["number_of_lines"];} + elseif (isset($_POST["number_of_lines"])) {$number_of_lines=$_POST["number_of_lines"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["conf_exten"])) {$conf_exten=$_GET["conf_exten"];} + elseif (isset($_POST["conf_exten"])) {$conf_exten=$_POST["conf_exten"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["groups"])) {$groups=$_GET["groups"];} + elseif (isset($_POST["groups"])) {$groups=$_POST["groups"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +if (!isset($force_logout)) {$force_logout = 0;} + +if ($force_logout) +{ + if( (strlen($PHP_AUTH_USER)>0) or (strlen($PHP_AUTH_PW)>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "You have now logged out. Thank you\n"; + exit; +} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + +$popup_page = './closer_popup.php'; +$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='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 3;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + + $stmt="SELECT count(*) from vicidial_remote_agents where user_start='$PHP_AUTH_USER';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $authx=$row[0]; + + if($authx>0) + { + $stmt="SELECT remote_agent_id,server_ip,number_of_lines from vicidial_remote_agents where user_start='$PHP_AUTH_USER';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id=$row[0]; + $server_ip=$row[1]; + if (!$number_of_lines) {$number_of_lines=$row[2];} + + fwrite ($fp, "VDremote|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VDremote|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + echo "This remote agent does not exist: |$PHP_AUTH_USER|\n"; + exit; + } + } + else + { + fwrite ($fp, "VDremote|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +echo "\n"; +if ($ADD==61111) + { + echo"\n"; + } +echo "\n"; +?> + +VICIDIAL REMOTE AGENTS: $LOGfullname - $PHP_AUTH_USER "; + +if (!$ADD) {$ADD="31111";} +if ($ADD==31111) {echo "Modify Remote Agents";} +if ($ADD==41111) {echo "Modify Remote Agents";} +if ($ADD==61111) {echo "Remote Agent Status";} +if ($ADD==71111) {echo "Remote Agent Closer Stats";} + + +if (strlen($ADD)>4) + { + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rslt=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rslt); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $servers_list .= "\n"; + $o++; + } + + ##### get campaigns listing for dynamic pulldown + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + $campaigns_list=''; + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $campaigns_list .= "\n"; + $o++; + } + + ##### get inbound groups listing for checkboxes + if ( (($ADD==31111) or ($ADD==31111)) and (count($groups)<1) ) + { + $stmt="SELECT closer_campaigns from vicidial_remote_agents where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + $stmt="SELECT group_id,group_name from vicidial_inbound_groups order by group_id"; + $rslt=mysql_query($stmt, $link); + $groups_to_print = mysql_num_rows($rslt); + $groups_list=''; + $groups_value=''; + + $o=0; + while ($groups_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $group_id_value = $rowx[0]; + $group_name_value = $rowx[1]; + $groups_list .= "2) {$groups_value .= " -";} + } + +?> + + + +
+
+ + + +
  VICIDIAL REMOTE AGENTS:   Logout  
  MODIFY | ">STATUS | ">INBOUND STATS
+"; + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + +echo "
MODIFY A REMOTE AGENTS ENTRY: $row[0]
\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
User ID Start: $user_start
Number of Lines: (numbers only)
Server IP: $row[3]
External Extension: (number dialed to reach agents [i.e. 913125551212])
Status:
Campaign: $campaign_id
Inbound Groups: \n"; +echo "$groups_list"; +echo "
\n"; +echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n"; + +} + + + + +###################### +# ADD=41111 modify remote agents info in the system +###################### + +if ($ADD==41111) +{ + echo ""; + + if ( (strlen($number_of_lines) < 1) or (strlen($conf_exten) < 2) ) + {echo "
REMOTE AGENTS NOT MODIFIED - Please go back and look at the data you entered\n";} + else + { + $stmt="UPDATE vicidial_remote_agents set number_of_lines='" . mysql_real_escape_string($number_of_lines) . "', conf_exten='" . mysql_real_escape_string($conf_exten) . "', status='" . mysql_real_escape_string($status) . "', closer_campaigns='" . mysql_real_escape_string($groups_value) . "' where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';"; + $rslt=mysql_query($stmt, $link); + +# echo "$stmt\n"; + echo "
REMOTE AGENTS MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY REMOTE AGENTS ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + + } + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + +echo "
MODIFY A REMOTE AGENTS ENTRY: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
User ID Start: $user_start
Number of Lines: (numbers only)
Server IP: $row[3]
External Extension: (number dialed to reach agents [i.e. 913125551212])
Status:
Campaign: $campaign_id
Inbound Groups: \n"; +echo "$groups_list"; +echo "
\n"; +echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n"; + +} + + + + +###################### +# ADD=61111 status of remote agent in the system and active calls and queue +###################### + +if ($ADD==61111) +{ + echo "
";
+
+	 if ( (strlen($server_ip) < 2) or (strlen($user) < 2) )
+		{echo "
REMOTE AGENTS ERROR - Please go back and look at the data you entered\n";} + else + { + + $users_list = ''; + $k=0; + while($k < $number_of_lines) + { + $nextuser=($user + $k); + $users_list .= "'" . mysql_real_escape_string($nextuser) . "',"; + $k++; + } + $users_list = preg_replace("/.$/","",$users_list); + + echo "VICIDIAL: Remote Agent Time On Calls $NOW_TIME\n\n"; + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + echo "| STATION | USER | LEADID | CHANNEL | STATUS | START TIME | MINUTES |\n"; + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + + + $stmt="select extension,user,lead_id,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish) from vicidial_live_agents where status NOT IN('PAUSED') and server_ip='" . mysql_real_escape_string($server_ip) . "' and user IN($users_list) order by extension;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + while ($i < $talking_to_print) + { + $leadlink=0; + $row=mysql_fetch_row($rslt); + if (eregi("READY|PAUSED",$row[4])) + { + $row[3]=''; + $row[5]=' - WAITING - '; + $row[6]=$row[7]; + } + $extension = sprintf("%-10s", $row[0]); + $user = sprintf("%-6s", $row[1]); + $leadid = sprintf("%-12s", $row[2]); + if ($row[2] > 0) + { + $leadidLINK=$row[2]; + $leadlink++; + if ( eregi("QUEUE",$row[4]) ) {$row[6]=$STARTtime;} + $leadid = "$leadid"; + } + $channel = sprintf("%-10s", $row[3]); + $cc=0; + while ( (strlen($channel) > 10) and ($cc < 100) ) + { + $channel = eregi_replace(".$","",$channel); + $cc++; + if (strlen($channel) <= 10) {$cc=101;} + } + $status = sprintf("%-6s", $row[4]); + $start_time = sprintf("%-19s", $row[5]); + $call_time_S = ($STARTtime - $row[6]); + + $call_time_M = ($call_time_S / 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"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + if ($call_time_M_int >= 5) {$G=''; $EG='';} + if ($call_time_M_int >= 10) {$G=''; $EG='';} + + echo "| $G$extension$EG | $G$user$EG | $G$leadid$EG | $G$channel$EG | $G$status$EG | $G$start_time$EG | $G$call_time_MS$EG |\n"; + + $i++; + } + + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + echo " $i agents logged in on server $server_ip\n\n"; + + echo " - 5 minutes or more on call\n"; + echo " - Over 10 minutes on call\n"; + + } + else + { + echo "**************************************************************************************\n"; + echo "********************************* NO AGENTS ON CALLS *********************************\n"; + echo "**************************************************************************************\n"; + } + } + +echo "
\n\n"; + +} + + +###################### +# ADD=71111 stats for remote agents from closer logs(vicidial_closer_log) +###################### + +if ($ADD==71111) +{ + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n\n"; + echo "
";
+
+	 if ( (strlen($server_ip) < 2) or (strlen($user) < 2) )
+		{echo "
REMOTE AGENTS ERROR - Please go back and look at the data you entered\n";} + else + { + + $users_list = ''; + $k=0; + while($k < $number_of_lines) + { + $nextuser=($user + $k); + $users_list .= "'$nextuser',"; + $k++; + } + $users_list = preg_replace("/.$/","",$users_list); + + $stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and user IN($users_list);"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $in_calls = $row[0]; + $in_time = $row[1]; + $in_time_M = ($in_time / 60); + $in_time_M = round($in_time_M, 2); + $in_time_M_int = intval("$in_time_M"); + $in_time_SEC = ($in_time_M - $in_time_M_int); + $in_time_SEC = ($in_time_SEC * 60); + $in_time_SEC = round($in_time_SEC, 0); + if ($in_time_SEC < 10) {$in_time_SEC = "0$in_time_SEC";} + $in_time_MS = "$in_time_M_int:$in_time_SEC"; + $in_time_MS = sprintf("%7s", $in_time_MS); + + echo "VICIDIAL: Remote Agent inbound stats $NOW_TIME\n\n"; + echo "\n"; + echo "Total calls taken $query_date: $in_calls\n"; + echo "Total talk time on $query_date: $in_time_MS (minutes:seconds)\n"; + echo "\n"; + echo "\n"; + echo "Call list for $query_date:\n"; + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + echo "| USER | LEADID | GROUP | PHONE NUM | STATUS | CALL TIME | MINUTES |\n"; + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + + + $stmt="select user,lead_id,campaign_id,phone_number,status,call_date,length_in_sec from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and user IN($users_list) order by call_date;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + while ($i < $talking_to_print) + { + $row=mysql_fetch_row($rslt); + $user = sprintf("%-8s", $row[0]); + $leadid = sprintf("%-10s", $row[1]); + $group = sprintf("%-14s", $row[2]); + $phone = sprintf("%-10s", $row[3]); + $status = sprintf("%-6s", $row[4]); + $start_time = sprintf("%-19s", $row[5]); + $call_time_S = $row[6]; + + $call_time_M = ($call_time_S / 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"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + # if ($call_time_M_int >= 5) {$G=''; $EG='';} + # if ($call_time_M_int >= 10) {$G=''; $EG='';} + + echo "| $G$user$EG | $G$leadid$EG | $G$group$EG | $G$phone$EG | $G$status$EG | $G$start_time$EG | $G$call_time_MS$EG |\n"; + + $i++; + } + + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + # echo " $i agents logged in on server $server_ip\n\n"; + + # echo " - 5 minutes or more on call\n"; + # echo " - Over 10 minutes on call\n"; + + } + else + { + echo "**************************************************************************************\n"; + echo "********************************* NO CALLS ON THIS DAY *******************************\n"; + echo "**************************************************************************************\n"; + } + } + +echo "
\n\n"; + +} + + + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/voice_lab.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/voice_lab.php new file mode 100644 index 00000000..2ce3a2a9 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/voice_lab.php @@ -0,0 +1,312 @@ + LICENSE: GPLv2 +### +# +# CHANGES +# +# 61220-1050 - First Build +# 70115-1246 - Added ability to define an exten to play +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["message"])) {$message=$_GET["message"];} + elseif (isset($_POST["message"])) {$message=$_POST["message"];} +if (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];} + elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["NEW_VOICE_LAB"])) {$NEW_VOICE_LAB=$_GET["NEW_VOICE_LAB"];} + elseif (isset($_POST["NEW_VOICE_LAB"])) {$NEW_VOICE_LAB=$_POST["NEW_VOICE_LAB"];} +if (isset($_GET["KILL_VOICE_LAB"])) {$KILL_VOICE_LAB=$_GET["KILL_VOICE_LAB"];} + elseif (isset($_POST["KILL_VOICE_LAB"])) {$KILL_VOICE_LAB=$_POST["KILL_VOICE_LAB"];} +if (isset($_GET["PLAY_MESSAGE"])) {$PLAY_MESSAGE=$_GET["PLAY_MESSAGE"];} + elseif (isset($_POST["PLAY_MESSAGE"])) {$PLAY_MESSAGE=$_POST["PLAY_MESSAGE"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$MYSQL_datetime = date("Y-m-d H:i:s"); +$FILE_datetime = date("Ymd-His_"); +$secX = $STARTtime; + +$local_DEF = 'Local/'; +$local_AMP = '@'; +$ext_context = 'demo'; + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + + $stmt="SELECT full_name from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + } + + +##### get server listing for dynamic pulldown +$stmt="SELECT server_ip,server_description from servers order by server_ip"; +$rslt=mysql_query($stmt, $link); +$servers_to_print = mysql_num_rows($rslt); +$servers_list=''; + +$o=0; +while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $servers_list .= "\n"; + $o++; + } + +##### get campaigns listing for dynamic pulldown +$stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; +$rslt=mysql_query($stmt, $link); +$campaigns_to_print = mysql_num_rows($rslt); +$campaigns_list=''; + +$o=0; +while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $campaigns_list .= "\n"; + $o++; + } + + + + +?> + + +VICIDIAL VOICE LAB: Admin +\n"; +?> + + +
+ + 0) +{ + if ( (strlen($server_ip) > 6) && (strlen($session_id) > 6) && (strlen($campaign_id) > 2) ) + { + echo "


TO START YOUR VOICE LAB, DIAL 9$session_id ON YOUR PHONE NOW
\n"; + + echo "
or, you can enter an extension that you want played below
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Message Extension\n"; + echo "\n"; + echo "


\n"; + + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $remote_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$session_id"; + + $thirty_minutes_old = mktime(date("H"), date("i"), date("s")-30, date("m"), date("d"), date("Y")); + $past_thirty = date("Y-m-d H:i:s",$thirty_minutes_old); + + $stmt="SELECT conf_exten,server_ip,user from vicidial_live_agents where last_update_time > '$past_thirty' and campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $agents_to_loop = mysql_num_rows($rslt); + $agents_sessions[0]=''; + $agents_servers[0]=''; + $agents_users[0]=''; + + $o=0; + while ($agents_to_loop > $o) + { + $rowx=mysql_fetch_row($rslt); + $agents_sessions[$o] = "$rowx[0]"; + $agents_servers[$o] = "$rowx[1]"; + $agents_users[$o] = "$rowx[2]"; + $o++; + } + + $o=0; + while ($agents_to_loop > $o) + { + if ($agents_servers[$o] == "$server_ip") + {$dial_string = $session_id;} + else + {$dial_string = $remote_dialstring;} + + $stmt="INSERT INTO vicidial_manager values('','','$MYSQL_datetime','NEW','N','$agents_servers[$o]','','Originate','VL$FILE_datetime$o','Channel: $local_DEF$dial_string$local_AMP$ext_context','Context: $ext_context','Exten: $agents_sessions[$o]','Priority: 1','Callerid: VL$FILE_datetime$o','','','','','')"; + echo "|$stmt|\n

\n"; + $rslt=mysql_query($stmt, $link); + + echo "LOGGED IN USER $agents_users[$o] at session $agents_sessions[$o] on server $agents_servers[$o]\n"; + + $o++; + } + + + + echo "
Kill a Voice Lab Session: 8600900
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


\n"; + } + else + { + echo "ERROR!!!! Not all info entered properly\n

\n"; + echo "|$server_ip| |$session_id| |$campaign_id|\n

\n"; + echo "Back to main voicelab screen\n

\n"; + } +} +else +{ + if ($PLAY_MESSAGE > 0) + { + if ( (strlen($server_ip) > 6) && (strlen($session_id) > 6) && (strlen($campaign_id) > 2) && (strlen($message) > 0) ) + { + echo "


TO START YOUR VOICE LAB, DIAL 9$session_id ON YOUR PHONE NOW
\n"; + + echo "
or, you can enter an extension that you want played below
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Message Extension\n"; + echo "\n"; + echo "


\n"; + + $nn='99'; + $n='9'; + + $stmt="INSERT INTO vicidial_manager values('','','$MYSQL_datetime','NEW','N','$server_ip','','Originate','VL$FILE_datetime$nn','Channel: $local_DEF$n$session_id$local_AMP$ext_context','Context: $ext_context','Exten: $message','Priority: 1','Callerid: VL$FILE_datetime$nn','','','','','')"; + echo "|$stmt|\n

\n"; + $rslt=mysql_query($stmt, $link); + + echo "MESSAGE $message played at session $session_id on server $server_ip\n"; + + echo "
Kill a Voice Lab Session: 8600900
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


\n"; + } + else + { + echo "ERROR!!!! Not all info entered properly\n

\n"; + echo "|$server_ip| |$session_id| |$campaign_id|\n

\n"; + echo "Back to main voicelab screen\n

\n"; + } + } +else + { + echo "
Start a Voice Lab Session: 8600900
\n"; + echo "\n"; + echo "\n"; + echo "Your Server: \n"; + echo "
\n"; + echo "Campaign: "; + echo "
\n"; + echo "\n"; + echo "


\n"; + + + echo "
Kill a Voice Lab Session: 8600900
\n"; + echo "\n"; + echo "\n"; + echo "Your Server: \n"; + echo "
\n"; + echo "Campaign: "; + echo "
\n"; + echo "\n"; + echo "


\n"; + } +} + + +if ($KILL_VOICE_LAB > 1) +{ + if ( (strlen($server_ip) > 6) && (strlen($session_id) > 6) && (strlen($campaign_id) > 2) ) + { + $kill_dial_string = "5555$session_id"; + $hangup_exten='8300'; + $stmt="INSERT INTO vicidial_manager values('','','$MYSQL_datetime','NEW','N','$server_ip','','Originate','VLK$FILE_datetime','Channel: $local_DEF$kill_dial_string$local_AMP$ext_context','Context: $ext_context','Exten: $hangup_exten','Priority: 1','Callerid: VLK$FILE_datetime','','','','','')"; + echo "|$stmt|\n

\n"; + $rslt=mysql_query($stmt, $link); + + echo "VOICELAB SESSION KILLED: $session_id at $server_ip | $KILL_VOICE_LAB\n"; + } + else + { + echo "ERROR!!!! Not all info entered properly\n

\n"; + echo "|$server_ip| |$session_id| |$campaign_id|\n

\n"; + echo "Back to main voicelab screen\n

\n"; + } + +} + +?> + + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/vtiger_search.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/vtiger_search.php new file mode 100644 index 00000000..6eaaf1bf --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/vtiger_search.php @@ -0,0 +1,313 @@ + LICENSE: GPLv2 +### +# This page does a search against a standard vtiger CRM system. If the record +# is not present, it will create a new one and send the agent's screen to that new page. +# +# This code is tested against vtiger 4.2 +# +# CHANGES +# 60719-1615 - First version +# 60801-2304 - added mysql debug and auto-forward +# 60802-1111 - added insertion of not-found record into vtiger system +# + +#Asterisk/VICIDIAL Server (ASTERISK) +#Internal : 10.10.10.15 +#External : 55.55.55.55 + +#vtiger Server(TEST1) +#Internal : 10.10.10.16 +#External : 55.55.55.56 + + +### alter to connect to your vtiger database +$link=mysql_connect("10.10.10.16", "cron",'1234'); +if (!$link) {die('Could not connect: ' . mysql_error());} +echo 'Connected successfully'; +mysql_select_db("vtigercrm4_2"); + + +$PHP_SELF=$_SERVER['PHP_SELF']; +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["alt_phone"])) {$alt_phone=$_GET["alt_phone"];} + elseif (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];} +if (isset($_GET["call_began"])) {$call_began=$_GET["call_began"];} + elseif (isset($_POST["call_began"])) {$call_began=$_POST["call_began"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];} + elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];} +if (isset($_GET["city"])) {$city=$_GET["city"];} + elseif (isset($_POST["city"])) {$city=$_POST["city"];} +if (isset($_GET["comments"])) {$comments=$_GET["comments"];} + elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];} +if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];} + elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];} +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["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];} + elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];} +if (isset($_GET["email"])) {$email=$_GET["email"];} + elseif (isset($_POST["email"])) {$email=$_POST["email"];} +if (isset($_GET["end_call"])) {$end_call=$_GET["end_call"];} + elseif (isset($_POST["end_call"])) {$end_call=$_POST["end_call"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];} + elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];} + elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["parked_time"])) {$parked_time=$_GET["parked_time"];} + elseif (isset($_POST["parked_time"])) {$parked_time=$_POST["parked_time"];} +if (isset($_GET["pass"])) {$pass=$_GET["pass"];} + elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];} +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["phone"])) {$phone=$_GET["phone"];} + elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];} +if (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];} + elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];} +if (isset($_GET["province"])) {$province=$_GET["province"];} + elseif (isset($_POST["province"])) {$province=$_POST["province"];} +if (isset($_GET["security"])) {$security=$_GET["security"];} + elseif (isset($_POST["security"])) {$security=$_POST["security"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["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["session_id"])) {$session_id=$_GET["session_id"];} + elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];} +if (isset($_GET["state"])) {$state=$_GET["state"];} + elseif (isset($_POST["state"])) {$state=$_POST["state"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["tsr"])) {$tsr=$_GET["tsr"];} + elseif (isset($_POST["tsr"])) {$tsr=$_POST["tsr"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +#$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +#$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +#$DB = '1'; # DEBUG override +$US = '_'; +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$REC_TIME = date("Ymd-His"); +$FILE_datetime = $STARTtime; +$parked_time = $STARTtime; + +# $ext_context = 'default'; defined in dbconnect file + +# $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]; + +#$fp = fopen ("./project_auth_entries.txt", "a"); +#$date = date("r"); +#$ip = getenv("REMOTE_ADDR"); +#$browser = getenv("HTTP_USER_AGENT"); + +# if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) +# { +# Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); +# Header("HTTP/1.0 401 Unauthorized"); +# echo "Invalid Username/Password: |$user|$pass|\n"; +# exit; +# } +# else +# { +# +# if($auth>0) +# { +# $office_no=strtoupper($user); +# $password=strtoupper($pass); +# $stmt="SELECT full_name from vicidial_users where user='$user' and pass='$pass'"; +# if ($DB) {echo "$stmt\n";} +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# $LOGfullname=$row[0]; +# $fullname = $row[0]; +# fwrite ($fp, "VD_CLOSER|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); +# fclose($fp); +# +# if ( (strlen($customer_zap_channel)>2) and (eregi('zap',$customer_zap_channel)) ) +# { +# echo "\n\n"; +# echo "\n\n"; +# +# } +# else +# { +# echo "Bad channel: $customer_zap_channel\n"; +# echo "Make sure the Zap channel is live and try again\n"; +# exit; +# } +# +# } +# else +# { +# fwrite ($fp, "VD_CLOSER|FAIL|$date|$user|$pass|$ip|$browser|\n"); +# fclose($fp); +# } +# } + +echo "\n"; +echo "\n"; +echo "VICIDIAL Vtiger Lookup\n"; +echo "\n"; + + +$stmt="SELECT count(*) from account where phone='$phone' or otherphone='$phone' or fax='$phone';"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +if (!$rslt) { + die('Could not execute: ' . mysql_error()); +} +$row=mysql_fetch_row($rslt); +$found_count = $row[0]; + +#echo "
\n|$phone|$found_count|\n"; + +if ($found_count < 1) +{ + echo "\n"; + echo "\n"; + echo "
\n"; + echo "$phone not found, creating account...\n"; + + if ($DB) {echo "
";}
+	$stmt="SELECT id from users where user_name='$user';";
+	if ($DB) {echo "$stmt\n";}
+	$rslt=mysql_query($stmt, $link);
+	$row=mysql_fetch_row($rslt);
+	$user_id = $row[0];
+	if (!$rslt) {die('Could not execute: ' . mysql_error());}
+
+	$stmt = "INSERT INTO crmentity (smcreatorid, smownerid, modifiedby, setype, description, createdtime, modifiedtime, viewedtime, status, version, presence, deleted) VALUES ('$user_id', '$user_id', 0, 'Accounts', NULL, '$NOW_TIME', '$NOW_TIME', '$NOW_TIME', NULL, 0, 1, 1);";
+	if ($DB) {echo "|$stmt|\n";}
+	$rslt=mysql_query($stmt, $link);
+	$recordID = mysql_insert_id($link);
+	if ($DB) {echo "|$recordID|\n";}
+	if (!$rslt) {die('Could not execute: ' . mysql_error());}
+
+#	$stmt = "INSERT INTO accountscf (accountid, cf_393, cf_397, cf_403, cf_405, cf_407, cf_409, cf_411) VALUES ('$recordID', NULL, NULL, NULL, NULL, NULL, NULL, NULL);";
+#	if ($DB) {echo "|$stmt|\n";}
+#	$rslt=mysql_query($stmt, $link);
+#	if (!$rslt) {die('Could not execute: ' . mysql_error());}
+
+	$stmt = "INSERT INTO account (accountid,accountname,contactname,phone,otherphone,email1) values('$recordID','$last_name, $first_name','$first_name $last_name','$phone','$alt_phone','$email');";
+	if ($DB) {echo "|$stmt|\n";}
+	$rslt=mysql_query($stmt, $link);
+	if (!$rslt) {die('Could not execute: ' . mysql_error());}
+
+	$stmt = "INSERT INTO accountbillads (accountaddressid,city,code,country,state,street) values('$recordID','$city','$postal_code','US','$state','$address1');";
+	if ($DB) {echo "|$stmt|\n";}
+	$rslt=mysql_query($stmt, $link);
+	if (!$rslt) {die('Could not execute: ' . mysql_error());}
+
+	$stmt = "INSERT INTO accountshipads (accountaddressid,city,code,country,state,street) values('$recordID','$city','$postal_code','US','$state','$address1');";
+	if ($DB) {echo "|$stmt|\n";}
+	$rslt=mysql_query($stmt, $link);
+	if (!$rslt) {die('Could not execute: ' . mysql_error());}
+
+	if ($DB) {echo "DONE\n";}
+
+	$account_URL = "http://55.55.55.56/index.php?module=Accounts&action=DetailView&record=$recordID";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "
\n"; + + echo "
";
+	echo "account created!\n";
+	echo "accountid:   $recordID\n";
+	echo "phone:       $phone\n";
+	echo "

"; + +} +else +{ + $stmt="SELECT accountid,accountname,contactname from account where phone='$phone' or otherphone='$phone' or fax='$phone';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $accountid = $row[0]; + $accountname = $row[1]; + $contactname = $row[2]; + + $account_URL = "http://55.55.55.56/index.php?module=Accounts&action=DetailView&record=$accountid"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + + echo "
";
+	echo "account found!\n";
+	echo "accountid:   $accountid\n";
+	echo "phone:       $phone\n";
+	echo "accountname: $accountname\n";
+	echo "contactname: $contactname\n";
+	echo "

"; + +} + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/welcome.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/welcome.php new file mode 100644 index 00000000..f0bad6d9 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial/welcome.php @@ -0,0 +1,25 @@ + LICENSE: GPLv2 +# + +echo "VICIDIAL Welcome\n"; +echo "\n"; +echo "\n"; +echo "




"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Welcome
 
Agent Login
 
Administration
 
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; + +?> \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_CLOSERstats.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_CLOSERstats.php new file mode 100644 index 00000000..35c1298b --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_CLOSERstats.php @@ -0,0 +1,617 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1714 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 60905-1326 - Added queue time stats +# 71008-1436 - Added shift to be defined in dbconnect.php +# 71025-0021 - Added status breakdown +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["shift"])) {$shift=$_GET["shift"];} + elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +if (strlen($shift)<2) {$shift='ALL';} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Unzulässiges Username/Kennwort:|$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = '';} +if (!isset($query_date)) {$query_date = $NOW_DATE;} + +$stmt="select group_id from vicidial_inbound_groups;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: VDAD Genauerer Notfall\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "           ÄNDERN Sie | REPORTS \n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "WÄHLEN Sie BITTE Eine KAMPAGNE Vor UND DATUM OBEN UND KLICKEN REICHTEin\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$time_BEGIN=$AM_shift_BEGIN;
+	$time_END=$AM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "03:45:00";}   
+	if (strlen($time_END) < 6) {$time_END = "15:15:00";}
+	}
+if ($shift == 'PM') 
+	{
+	$time_BEGIN=$PM_shift_BEGIN;
+	$time_END=$PM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "15:15:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:15:00";}
+	}
+if ($shift == 'ALL') 
+	{
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "00:00:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:59:59";}
+	}
+$query_date_BEGIN = "$query_date $time_BEGIN";   
+$query_date_END = "$query_date $time_END";
+
+
+
+echo "VICIDIAL: Automobil-Vorwahlknopf Genauerer Notfall                      $NOW_TIME\n";
+
+echo "\n";
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{$average_hold_seconds = '         0';}
+else
+	{
+	$average_hold_seconds = ($row[1] / $row[0]);
+	$average_hold_seconds = round($average_hold_seconds, 0);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+
+echo "Gesamtanrufe gesetzt von dieser Kampagne:                       $TOTALcalls\n";
+echo "Average Call Length for all Calls:            $average_hold_seconds seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP' and (length_in_sec <= 999 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$DROPcalls =	sprintf("%10s", $row[0]);
+if ( ($DROPcalls < 1) or ($TOTALcalls < 1) )
+	{$DROPpercent = '0';}
+else
+	{
+	$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
+	$DROPpercent = round($DROPpercent, 0);
+	}
+
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{$average_hold_seconds = '         0';}
+else
+	{
+	$average_hold_seconds = ($row[1] / $row[0]);
+	$average_hold_seconds = round($average_hold_seconds, 0);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+
+echo "Gesamt-TROPFEN Anrufe:                                          $DROPcalls  $DROPpercent%\n";
+echo "Average hold time for DROP Calls:             $average_hold_seconds seconds\n";
+
+
+
+##############################
+#########  CALL STATUS STATS
+
+$TOTALcalls = 0;
+
+echo "\n";
+echo "---------- CALL STATUS STATS\n";
+echo "+--------+----------------------+------------+\n";
+echo "| STATUS | DESCRIPTION          | CALLS      |\n";
+echo "+--------+----------------------+------------+\n";
+
+$stmt="SELECT * from vicidial_statuses order by status";
+$rslt=mysql_query($stmt, $link);
+$statuses_to_print = mysql_num_rows($rslt);
+$statuses_list='';
+
+$o=0;
+while ($statuses_to_print > $o) 
+	{
+	$rowx=mysql_fetch_row($rslt);
+	$statname_list["$rowx[0]"] = "$rowx[1]";
+	$o++;
+	}
+
+$stmt="SELECT * from vicidial_campaign_statuses order by status";
+$rslt=mysql_query($stmt, $link);
+$Cstatuses_to_print = mysql_num_rows($rslt);
+
+$o=0;
+while ($Cstatuses_to_print > $o) 
+	{
+	$rowx=mysql_fetch_row($rslt);
+	$statname_list["$rowx[0]"] = "$rowx[1]";
+	$o++;
+	}
+
+$stmt="select count(*),status from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysql_real_escape_string($group) . "' group by status;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$statuses_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $statuses_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$TOTALcalls = ($TOTALcalls + $row[0]);
+
+	$STATUScount =	sprintf("%10s", $row[0]);while(strlen($STATUScount)>10) {$STATUScount = substr("$STATUScount", 0, -1);}
+	$RAWstatus = $row[1];
+	$status =	sprintf("%-6s", $row[1]);while(strlen($status)>6) {$status = substr("$status", 0, -1);}
+
+	if ($non_latin < 1)
+		{
+		 $status_name =	sprintf("%-20s", $statname_list[$RAWstatus]); 
+		 while(strlen($status_name)>20) {$status_name = substr("$status_name", 0, -1);}	
+		}
+	else
+		{
+		 $status_name =	sprintf("%-60s", $statname_list[$RAWstatus]); 
+		 while(mb_strlen($status_name,'utf-8')>20) {$status_name = mb_substr("$status_name", 0, -1,'utf-8');}	
+		}
+
+
+	echo "| $status | $status_name | $STATUScount |\n";
+
+	$i++;
+	}
+
+$TOTALcalls =		sprintf("%10s", $TOTALcalls);
+
+echo "+--------+----------------------+------------+\n";
+echo "| TOTAL:                        | $TOTALcalls |\n";
+echo "+-------------------------------+------------+\n";
+
+
+
+
+echo "\n";
+echo "---------- QUEUE STATS\n";
+
+$stmt="select count(*),sum(queue_seconds) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and (queue_seconds > 0);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$QUEUEcalls =	sprintf("%10s", $row[0]);
+if ( ($QUEUEcalls < 1) or ($TOTALcalls < 1) )
+	{$QUEUEpercent = '0';}
+else
+	{
+	$QUEUEpercent = (($QUEUEcalls / $TOTALcalls) * 100);
+	$QUEUEpercent = round($QUEUEpercent, 0);
+	}
+
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{$average_queue_seconds = '         0';}
+else
+	{
+	$average_queue_seconds = ($row[1] / $row[0]);
+	$average_queue_seconds = round($average_queue_seconds, 2);
+	$average_queue_seconds = sprintf("%10.2f", $average_queue_seconds);
+	}
+
+if ( ($TOTALcalls < 1) or ($row[1] < 1) )
+	{$average_total_queue_seconds = '         0';}
+else
+	{
+	$average_total_queue_seconds = ($row[1] / $TOTALcalls);
+	$average_total_queue_seconds = round($average_total_queue_seconds, 2);
+	$average_total_queue_seconds = sprintf("%10.2f", $average_total_queue_seconds);
+	}
+
+echo "Total Calls That entered Queue:               $QUEUEcalls  $QUEUEpercent%\n";
+echo "Average QUEUE Length for queue calls:         $average_queue_seconds seconds\n";
+echo "Average QUEUE Length across all calls:        $average_total_queue_seconds seconds\n";
+
+
+##############################
+#########  USER STATS
+
+$TOTagents=0;
+$TOTcalls=0;
+$TOTtime=0;
+$TOTavg=0;
+
+echo "\n";
+echo "---------- MITTELSTATS\n";
+echo "+--------------------------+------------+----------+--------+\n";
+echo "| MITTEL                   | CALLS      | TIME M   | AVRG M |\n";
+echo "+--------------------------+------------+----------+--------+\n";
+
+$stmt="select vicidial_closer_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_closer_log,vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysql_real_escape_string($group) . "' and vicidial_closer_log.user is not null and length_in_sec is not null and length_in_sec > 4 and vicidial_closer_log.user=vicidial_users.user group by vicidial_closer_log.user;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$TOTcalls = ($TOTcalls + $row[2]);
+	$TOTtime = ($TOTtime + $row[3]);
+
+	$user =			sprintf("%-6s", $row[0]);
+	$full_name =	sprintf("%-15s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
+	$USERcalls =	sprintf("%10s", $row[2]);
+	$USERtotTALK =	$row[3];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$USERtotTALK_MS =		sprintf("%8s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $user - $full_name | $USERcalls | $USERtotTALK_MS | $USERavgTALK_MS |\n";
+
+	$i++;
+	}
+
+if (!$TOTcalls) {$TOTcalls = 1;}
+$TOTavg = ($TOTtime / $TOTcalls);
+$TOTavg = round($TOTavg, 0);
+$TOTavg_M = ($TOTavg / 60);
+$TOTavg_M = round($TOTavg_M, 2);
+$TOTavg_M_int = intval("$TOTavg_M");
+$TOTavg_S = ($TOTavg_M - $TOTavg_M_int);
+$TOTavg_S = ($TOTavg_S * 60);
+$TOTavg_S = round($TOTavg_S, 0);
+if ($TOTavg_S < 10) {$TOTavg_S = "0$TOTavg_S";}
+$TOTavg_MS = "$TOTavg_M_int:$TOTavg_S";
+$TOTavg =		sprintf("%6s", $TOTavg_MS);
+
+$TOTtime_M = ($TOTtime / 60);
+$TOTtime_M = 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 ($TOTtime_S < 10) {$TOTtime_S = "0$TOTtime_S";}
+$TOTtime_MS = "$TOTtime_M_int:$TOTtime_S";
+$TOTtime =		sprintf("%6s", $TOTtime_MS);
+
+$TOTagents =		sprintf("%10s", $i);
+$TOTcalls =			sprintf("%10s", $TOTcalls);
+$TOTtime =			sprintf("%8s", $TOTtime);
+$TOTavg =			sprintf("%6s", $TOTavg);
+
+echo "+--------------------------+------------+----------+--------+\n";
+echo "| TOTAL Agents: $TOTagents | $TOTcalls | $TOTtime | $TOTavg |\n";
+echo "+--------------------------+------------+----------+--------+\n";
+
+
+##############################
+#########  TIME STATS
+
+echo "\n";
+echo "---------- TIME STATS\n";
+
+echo "\n";
+
+$hi_hour_count=0;
+$last_full_record=0;
+$i=0;
+$h=0;
+while ($i <= 96)
+	{
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+	$h++;
+	}
+
+if ($hi_hour_count < 1)
+	{$hour_multiplier = 0;}
+else
+	{
+	$hour_multiplier = (100 / $hi_hour_count);
+	#$hour_multiplier = round($hour_multiplier, 0);
+	}
+
+echo "\n";
+echo "DIAGRAMM IN 15 MINUZIÖSEN STUFENSPRÜNGEN DER GESAMTANRUFE GESETZTVON DIESER KAMPAGNE\n";
+
+$k=1;
+$Mk=0;
+$call_scale = '0';
+while ($k <= 102) 
+	{
+	if ($Mk >= 5) 
+		{
+		$Mk=0;
+		if ( ($k < 1) or ($hour_multiplier <= 0) )
+			{$scale_num = 100;}
+		else
+			{
+			$scale_num=($k / $hour_multiplier);
+			$scale_num = round($scale_num, 0);
+			}
+		$LENscale_num = (strlen($scale_num));
+		$k = ($k + $LENscale_num);
+		$call_scale .= "$scale_num";
+		}
+	else
+		{
+		$call_scale .= " ";
+		$k++;   $Mk++;
+		}
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+$ZZ = '00';
+$i=0;
+$h=4;
+$hour= -1;
+$no_lines_yet=1;
+
+while ($i <= 96)
+	{
+	$char_counter=0;
+	$time = '      ';
+	if ($h >= 4) 
+		{
+		$hour++;
+		$h=0;
+		if ($hour < 10) {$hour = "0$hour";}
+		$time = "+$hour$ZZ+";
+		}
+	if ($h == 1) {$time = "   15 ";}
+	if ($h == 2) {$time = "   30 ";}
+	if ($h == 3) {$time = "   45 ";}
+	$Ghour_count = $hour_count[$i];
+	if ($Ghour_count < 1) 
+		{
+		if ( ($no_lines_yet) or ($i > $last_full_record) )
+			{
+			$do_nothing=1;
+			}
+		else
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			echo "|$time|";
+			$k=0;   while ($k <= 102) {echo " ";   $k++;}
+			echo "| $hour_count[$i] |\n";
+			}
+		}
+	else
+		{
+		$no_lines_yet=0;
+		$Xhour_count = ($Ghour_count * $hour_multiplier);
+		$Yhour_count = (99 - $Xhour_count);
+
+		$Gdrop_count = $drop_count[$i];
+		if ($Gdrop_count < 1) 
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "*X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 101) {echo " ";   $char_counter++;}
+			echo "| 0     | $hour_count[$i] |\n";
+
+			}
+		else
+			{
+			$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+		#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+			$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+			echo "D";   $char_counter++;
+			$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 102) {echo " ";   $char_counter++;}
+			echo "| $drop_count[$i] | $hour_count[$i] |\n";
+			}
+		}
+	
+	
+	$i++;
+	$h++;
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n\n";
+
+
+
+
+
+$ENDtime = date("U");
+$RUNtime = ($ENDtime - $STARTtime);
+echo "\nRun Time: $RUNtime seconds\n";
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_VDADstats.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_VDADstats.php new file mode 100644 index 00000000..323c167b --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_VDADstats.php @@ -0,0 +1,647 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1718 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 61215-1139 - Added drop percentage of answered and round-2 decimal +# 71008-1436 - Added shift to be defined in dbconnect.php +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["shift"])) {$shift=$_GET["shift"];} + elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +if (strlen($shift)<2) {$shift='ALL';} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Unzulässiges Username/Kennwort:|$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = '';} +if (!isset($query_date)) {$query_date = $NOW_DATE;} + +$stmt="select campaign_id from vicidial_campaigns;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: VDAD Stats\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "           ÄNDERN Sie | REPORTS \n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "WÄHLEN Sie BITTE Eine KAMPAGNE Vor UND DATUM OBEN UND KLICKEN REICHTEin\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$time_BEGIN=$AM_shift_BEGIN;
+	$time_END=$AM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "03:45:00";}   
+	if (strlen($time_END) < 6) {$time_END = "15:15:00";}
+	}
+if ($shift == 'PM') 
+	{
+	$time_BEGIN=$PM_shift_BEGIN;
+	$time_END=$PM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "15:15:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:15:00";}
+	}
+if ($shift == 'ALL') 
+	{
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "00:00:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:59:59";}
+	}
+$query_date_BEGIN = "$query_date $time_BEGIN";   
+$query_date_END = "$query_date $time_END";
+
+
+
+echo "VICIDIAL: Auto-dial Stats                             $NOW_TIME\n";
+
+echo "\n";
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{$average_hold_seconds = '         0';}
+else
+	{
+	$average_hold_seconds = ($row[1] / $row[0]);
+	$average_hold_seconds = round($average_hold_seconds, 2);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+echo "Gesamtanrufe gesetzt von dieser Kampagne:                       $TOTALcalls\n";
+echo "Durchschnittliche Anruf-Länge für alle benennt in den Sekunden: $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP' and (length_in_sec <= 60 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$DROPcalls =	sprintf("%10s", $row[0]);
+$DROPcallsRAW =	$row[0];
+$DROPseconds =	$row[1];
+
+$stmt="select count(*) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and status NOT IN('NA','B');";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$ANSWERcalls =	$row[0];
+
+if ( ($DROPcalls < 1) or ($TOTALcalls < 1) )
+	{$DROPpercent = '0';}
+else
+	{
+	$DROPpercent = (($DROPcallsRAW / $TOTALcalls) * 100);
+	$DROPpercent = round($DROPpercent, 2);
+	}
+
+if ( ($DROPcalls < 1) or ($ANSWERcalls < 1) )
+	{$DROPANSWERpercent = '0';}
+else
+	{
+	$DROPANSWERpercent = (($DROPcallsRAW / $ANSWERcalls) * 100);
+	$DROPANSWERpercent = round($DROPANSWERpercent, 2);
+	}
+
+if ( ($DROPseconds < 1) or ($DROPcallsRAW < 1) )
+	{$average_hold_seconds = '         0';}
+else
+	{
+	$average_hold_seconds = ($DROPseconds / $DROPcallsRAW);
+	$average_hold_seconds = round($average_hold_seconds, 2);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+
+echo "Gesamt-TROPFEN Anrufe:                                          $DROPcalls  $DROPpercent%\n";
+echo "Percent of DROP Calls taken out of Answers:   $DROPcalls / $ANSWERcalls  $DROPANSWERpercent%\n";
+echo "Durchschnittliche Länge für TROPFEN Anrufe in den Sekunden:     $average_hold_seconds\n";
+
+echo "\n";
+echo "----------AUTO-DIAL KEINE ANTWORTEN\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and status IN('NA','B') and (length_in_sec <= 60 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$NAcalls =	sprintf("%10s", $row[0]);
+if ( ($NAcalls < 1) or ($TOTALcalls < 1) )
+	{$NApercent = '0';}
+else
+	{
+	$NApercent = (($NAcalls / $TOTALcalls) * 100);
+	$NApercent = round($NApercent, 2);
+	}
+
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{$average_na_seconds = '         0';}
+else
+	{
+	$average_na_seconds = ($row[1] / $row[0]);
+	$average_na_seconds = round($average_na_seconds, 2);
+	$average_na_seconds =	sprintf("%10s", $average_na_seconds);
+	}
+
+echo "Total NA calls -Busy,Disconnect,RingNoAnswer: $NAcalls  $NApercent%\n";
+echo "Durchschnittliche Anruf-Länge für Na benennt in den Sekunden:   $average_na_seconds\n";
+
+
+##############################
+#########  CALL STATUS STATS
+
+$TOTALcalls = 0;
+
+echo "\n";
+echo "---------- CALL STATUS STATS\n";
+echo "+--------+----------------------+------------+\n";
+echo "| STATUS | DESCRIPTION          | CALLS      |\n";
+echo "+--------+----------------------+------------+\n";
+
+$stmt="SELECT * from vicidial_statuses order by status";
+$rslt=mysql_query($stmt, $link);
+$statuses_to_print = mysql_num_rows($rslt);
+$statuses_list='';
+
+$o=0;
+while ($statuses_to_print > $o) 
+	{
+	$rowx=mysql_fetch_row($rslt);
+	$statname_list["$rowx[0]"] = "$rowx[1]";
+	$o++;
+	}
+
+$stmt="SELECT * from vicidial_campaign_statuses where campaign_id='" . mysql_real_escape_string($group) . "' order by status";
+$rslt=mysql_query($stmt, $link);
+$Cstatuses_to_print = mysql_num_rows($rslt);
+
+$o=0;
+while ($Cstatuses_to_print > $o) 
+	{
+	$rowx=mysql_fetch_row($rslt);
+	$statname_list["$rowx[0]"] = "$rowx[1]";
+	$o++;
+	}
+
+$stmt="select count(*),status from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysql_real_escape_string($group) . "' group by status;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$statuses_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $statuses_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$TOTALcalls = ($TOTALcalls + $row[0]);
+
+	$STATUScount =	sprintf("%10s", $row[0]);while(strlen($STATUScount)>10) {$STATUScount = substr("$STATUScount", 0, -1);}
+	$RAWstatus = $row[1];
+	$status =	sprintf("%-6s", $row[1]);while(strlen($status)>6) {$status = substr("$status", 0, -1);}
+
+	if ($non_latin < 1)
+		{
+		 $status_name =	sprintf("%-20s", $statname_list[$RAWstatus]); 
+		 while(strlen($status_name)>20) {$status_name = substr("$status_name", 0, -1);}	
+		}
+	else
+		{
+		 $status_name =	sprintf("%-60s", $statname_list[$RAWstatus]); 
+		 while(mb_strlen($status_name,'utf-8')>20) {$status_name = mb_substr("$status_name", 0, -1,'utf-8');}	
+		}
+
+
+	echo "| $status | $status_name | $STATUScount |\n";
+
+	$i++;
+	}
+
+$TOTALcalls =		sprintf("%10s", $TOTALcalls);
+
+echo "+--------+----------------------+------------+\n";
+echo "| TOTAL:                        | $TOTALcalls |\n";
+echo "+-------------------------------+------------+\n";
+
+
+##############################
+#########  USER STATS
+
+$TOTagents=0;
+$TOTcalls=0;
+$TOTtime=0;
+$TOTavg=0;
+
+echo "\n";
+echo "---------- MITTELSTATS\n";
+echo "+--------------------------+------------+----------+--------+\n";
+echo "| MITTEL                   | CALLS      | TIME M   | AVRG M |\n";
+echo "+--------------------------+------------+----------+--------+\n";
+
+$stmt="select vicidial_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_log,vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysql_real_escape_string($group) . "' and vicidial_log.user is not null and length_in_sec is not null and length_in_sec > 4 and vicidial_log.user=vicidial_users.user group by vicidial_log.user;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$TOTcalls = ($TOTcalls + $row[2]);
+	$TOTtime = ($TOTtime + $row[3]);
+
+	$user =	sprintf("%-6s", $row[0]);while(strlen($user)>6) {$user = substr("$user", 0, -1);}
+	if ($non_latin < 1)
+	{
+ 	 $full_name =	sprintf("%-15s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}	
+	}
+	else
+	{
+	 $full_name =	sprintf("%-45s", $row[1]); while(mb_strlen($full_name,'utf-8')>15) {$full_name = mb_substr("$full_name", 0, -1,'utf-8');}	
+	}
+	$USERcalls =	sprintf("%10s", $row[2]);
+	$USERtotTALK =	$row[3];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$USERtotTALK_MS =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $user - $full_name | $USERcalls |   $USERtotTALK_MS | $USERavgTALK_MS |\n";
+
+	$i++;
+	}
+
+if (!$TOTcalls) {$TOTcalls = 1;}
+$TOTavg = ($TOTtime / $TOTcalls);
+$TOTavg = round($TOTavg, 0);
+$TOTavg_M = ($TOTavg / 60);
+$TOTavg_M = round($TOTavg_M, 2);
+$TOTavg_M_int = intval("$TOTavg_M");
+$TOTavg_S = ($TOTavg_M - $TOTavg_M_int);
+$TOTavg_S = ($TOTavg_S * 60);
+$TOTavg_S = round($TOTavg_S, 0);
+if ($TOTavg_S < 10) {$TOTavg_S = "0$TOTavg_S";}
+$TOTavg_MS = "$TOTavg_M_int:$TOTavg_S";
+$TOTavg =		sprintf("%6s", $TOTavg_MS);
+
+$TOTtime_M = ($TOTtime / 60);
+$TOTtime_M = 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 ($TOTtime_S < 10) {$TOTtime_S = "0$TOTtime_S";}
+$TOTtime_MS = "$TOTtime_M_int:$TOTtime_S";
+$TOTtime =		sprintf("%6s", $TOTtime_MS);
+
+$TOTagents =		sprintf("%10s", $i);
+$TOTcalls =			sprintf("%10s", $TOTcalls);
+$TOTtime =			sprintf("%8s", $TOTtime);
+$TOTavg =			sprintf("%6s", $TOTavg);
+
+$stmt="select avg(wait_sec) from vicidial_agent_log where event_time >= '$query_date_BEGIN' and event_time <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$AVGwait = $row[0];
+$AVGwait_M = ($AVGwait / 60);
+$AVGwait_M = round($AVGwait_M, 2);
+$AVGwait_M_int = intval("$AVGwait_M");
+$AVGwait_S = ($AVGwait_M - $AVGwait_M_int);
+$AVGwait_S = ($AVGwait_S * 60);
+$AVGwait_S = round($AVGwait_S, 0);
+if ($AVGwait_S < 10) {$AVGwait_S = "0$AVGwait_S";}
+$AVGwait_MS = "$AVGwait_M_int:$AVGwait_S";
+$AVGwait =		sprintf("%6s", $AVGwait_MS);
+
+echo "+--------------------------+------------+----------+--------+\n";
+echo "| TOTAL Agents: $TOTagents | $TOTcalls | $TOTtime | $TOTavg |\n";
+echo "+--------------------------+------------+----------+--------+\n";
+echo "| Average Wait time between calls                    $AVGwait |\n";
+echo "+-----------------------------------------------------------+\n";
+
+##############################
+#########  TIME STATS
+
+echo "\n";
+echo "---------- TIME STATS\n";
+
+echo "\n";
+
+$hi_hour_count=0;
+$last_full_record=0;
+$i=0;
+$h=0;
+while ($i <= 96)
+	{
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+	$h++;
+	}
+
+if ($hi_hour_count < 1)
+	{$hour_multiplier = 0;}
+else
+	{
+	$hour_multiplier = (100 / $hi_hour_count);
+	#$hour_multiplier = round($hour_multiplier, 0);
+	}
+
+echo "\n";
+echo "DIAGRAMM IN 15 MINUZIÖSEN STUFENSPRÜNGEN DER GESAMTANRUFE GESETZTVON DIESER KAMPAGNE\n";
+
+$k=1;
+$Mk=0;
+$call_scale = '0';
+while ($k <= 102) 
+	{
+	if ($Mk >= 5) 
+		{
+		$Mk=0;
+		if ( ($k < 1) or ($hour_multiplier <= 0) )
+			{$scale_num = 100;}
+		else
+			{
+			$scale_num=($k / $hour_multiplier);
+			$scale_num = round($scale_num, 0);
+			}
+		$LENscale_num = (strlen($scale_num));
+		$k = ($k + $LENscale_num);
+		$call_scale .= "$scale_num";
+		}
+	else
+		{
+		$call_scale .= " ";
+		$k++;   $Mk++;
+		}
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+$ZZ = '00';
+$i=0;
+$h=4;
+$hour= -1;
+$no_lines_yet=1;
+
+while ($i <= 96)
+	{
+	$char_counter=0;
+	$time = '      ';
+	if ($h >= 4) 
+		{
+		$hour++;
+		$h=0;
+		if ($hour < 10) {$hour = "0$hour";}
+		$time = "+$hour$ZZ+";
+		}
+	if ($h == 1) {$time = "   15 ";}
+	if ($h == 2) {$time = "   30 ";}
+	if ($h == 3) {$time = "   45 ";}
+	$Ghour_count = $hour_count[$i];
+	if ($Ghour_count < 1) 
+		{
+		if ( ($no_lines_yet) or ($i > $last_full_record) )
+			{
+			$do_nothing=1;
+			}
+		else
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			echo "|$time|";
+			$k=0;   while ($k <= 102) {echo " ";   $k++;}
+			echo "| $hour_count[$i] |\n";
+			}
+		}
+	else
+		{
+		$no_lines_yet=0;
+		$Xhour_count = ($Ghour_count * $hour_multiplier);
+		$Yhour_count = (99 - $Xhour_count);
+
+		$Gdrop_count = $drop_count[$i];
+		if ($Gdrop_count < 1) 
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "*X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 101) {echo " ";   $char_counter++;}
+			echo "| 0     | $hour_count[$i] |\n";
+
+			}
+		else
+			{
+			$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+		#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+			$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+			echo "D";   $char_counter++;
+			$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 102) {echo " ";   $char_counter++;}
+			echo "| $drop_count[$i] | $hour_count[$i] |\n";
+			}
+		}
+	
+	
+	$i++;
+	$h++;
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+
+
+
+
+
+$ENDtime = date("U");
+$RUNtime = ($ENDtime - $STARTtime);
+echo "\nRun Time: $RUNtime seconds\n";
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_VICIDIAL_hopperlist.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_VICIDIAL_hopperlist.php new file mode 100644 index 00000000..0e9147e8 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_VICIDIAL_hopperlist.php @@ -0,0 +1,169 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1654 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 70115-1614 - Added ALT field for vicidial_hopper alt_dial column +# 71029-0852 - Added list_id to the output +# 71030-2118 - Added priority to display +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and modify_campaigns='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Unzulässiges Username/Kennwort:|$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = '';} +if (!isset($query_date)) {$query_date = $NOW_DATE;} +if (!isset($server_ip)) {$server_ip = '10.10.10.15';} + +$stmt="select campaign_id,campaign_name from vicidial_campaigns order by campaign_id;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$campaigns_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $campaigns_to_print) + { + $row=mysql_fetch_row($rslt); + $campaign_id[$i] =$row[0]; + $campaign_name[$i] =$row[1]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: Zufuhrbehälter-Liste\n"; +echo "
\n"; +#echo "\n"; +#echo "\n"; +echo "\n"; +echo "\n"; +echo "           ÄNDERN Sie \n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "WÄHLEN Sie BITTE Eine KAMPAGNE OBEN Vor UND KLICKEN REICHT Ein\n";
+}
+
+else
+{
+
+
+echo "VICIDIAL: Gegenwärtige Zufuhrbehälter-Lebhaftliste                      $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+
+echo "Gesamtleitungen im Zufuhrbehälter im Augenblick:       $TOTALcalls\n";
+
+
+##############################
+#########  LEAD STATS
+
+echo "\n";
+echo "---------- LEADS IN HOPPER\n";
+echo "+------+--------+-----------+------------+------------+-------+--------+-------+--------+-------+\n";
+echo "|ORDER |PRIORITY| LEAD ID   | LISTE IDENTIFIKATION    | PHONE NUM  | STATE | STATUS | COUNT | GMT    | ALT   |\n";
+echo "+------+--------+-----------+------------+------------+-------+--------+-------+--------+-------+\n";
+
+$stmt="select vicidial_hopper.lead_id,phone_number,vicidial_hopper.state,vicidial_list.status,called_count,vicidial_hopper.gmt_offset_now,hopper_id,alt_dial,vicidial_hopper.list_id,vicidial_hopper.priority from vicidial_hopper,vicidial_list where vicidial_hopper.campaign_id='" . mysql_real_escape_string($group) . "' and vicidial_hopper.lead_id=vicidial_list.lead_id order by priority desc,hopper_id limit 2000;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$FMT_i =		sprintf("%-4s", $i);
+	$lead_id =		sprintf("%-9s", $row[0]);
+	$phone_number =	sprintf("%-10s", $row[1]);
+	$state =		sprintf("%-5s", $row[2]);
+	$status =		sprintf("%-6s", $row[3]);
+	$count =		sprintf("%-5s", $row[4]);
+	$gmt =			sprintf("%-6s", $row[5]);
+	$hopper_id =	sprintf("%-6s", $row[6]);
+	$alt_dial =		sprintf("%-5s", $row[7]);
+	$list_id =		sprintf("%-10s", $row[8]);
+	$priority =		sprintf("%-6s", $row[9]);
+
+if ($DB) {echo "| $FMT_i | $priority | $lead_id | $list_id | $phone_number | $state | $status | $count | $gmt | $hopper_id |\n";}
+else {echo "| $FMT_i | $priority | $lead_id | $list_id | $phone_number | $state | $status | $count | $gmt | $alt_dial |\n";}
+
+	$i++;
+	}
+
+echo "+------+--------+-----------+------------+------------+-------+--------+-------+--------+-------+\n";
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_admin_log_display.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_admin_log_display.php new file mode 100644 index 00000000..77371200 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_admin_log_display.php @@ -0,0 +1,118 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); +$query_date = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$query_date); + +# AST GUI database administration +# AST_admin_log_display.php +# +# CHANGES +# 50325-0932 - First build +# 51123-1443 - removed globals=on requirement +# 60421-1229 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60620-1044 - Added variable filtering to eliminate SQL injection attack threat +# + +$version = '0.0.4'; +$build = '60620-1044'; + +$STARTtime = date("U"); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 8 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Unzulässiges Username/Kennwort:|$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDIAL ADMIN LOG DISPLAY"; +echo "\n"; + +# Fri, 25 Mar 2005 + +$DAY_DATE = date("j"); +if ($DAY_DATE < 10) +# {$GREP_DATE = date("D, j M Y");} + {$GREP_DATE = date("D, 0j M Y");} +else + {$GREP_DATE = date("D, j M Y");} + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!$query_date) {$query_date = $GREP_DATE;} + +$Gquery_date = eregi_replace(" ",'\ ',$query_date); +echo "\n"; + +echo "
\n"; +echo "\n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+echo "VICIDIAL ADMIN CHANGE LOG                             $NOW_TIME\n";
+
+#passthru("grep $Gquery_date /home/www/htdocs/vicidial/admin_changes_log.txt");
+passthru("grep $Gquery_date $WeBServeRRooT/vicidial/admin_changes_log.txt");
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_agent_performance.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_agent_performance.php new file mode 100644 index 00000000..3915fd31 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_agent_performance.php @@ -0,0 +1,257 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1711 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 70201-1203 - Added non_latin UTF8 output code, widened USER ID to 8 chars +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["shift"])) {$shift=$_GET["shift"];} + elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + 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($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Unzulässiges Username/Kennwort:|$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = '';} +if (!isset($query_date)) {$query_date = $NOW_DATE;} + +$stmt="select campaign_id from vicidial_campaigns;"; +if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$campaigns_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $campaigns_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: Agent Performance\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "           ÄNDERN Sie | REPORTS \n"; +echo "
\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A BEDIENERAND DATE-TIME ABOVE AND CLICK SUBMIT\n";
+echo " NOTE: stats taken from 6 hour shift specified\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$query_date_BEGIN = "$query_date 08:45:00";   
+	$query_date_END = "$query_date 15:33:00";
+	$time_BEGIN = "08:45:00";   
+	$time_END = "15:33:00";
+	}
+if ($shift == 'PM') 
+	{
+	$query_date_BEGIN = "$query_date 15:33:00";   
+	$query_date_END = "$query_date 23:15:00";
+	$time_BEGIN = "15:33:00";   
+	$time_END = "23:15:00";
+	}
+
+echo "VICIDIAL: Agent Performance                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENTS Details -------------\n\n";
+
+echo "+-----------------+----------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+echo "| USER NAME       | ID       | CALLS  | TALK   | TALKAVG| A    | B    | DC   | DNC  | N    | NI   | SALE |\n";
+echo "+-----------------+----------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+
+$stmt="select count(*) as calls,sum(length_in_sec) as talk,full_name,vicidial_users.user,avg(length_in_sec) from vicidial_users,vicidial_log where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN' and vicidial_users.user=vicidial_log.user and campaign_id='" . mysql_real_escape_string($group) . "' group by full_name order by calls desc limit 1000;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$TOTcalls=($TOTcalls + $row[0]);
+	$TOTtotTALK=($TOTtotTALK + $row[1]);
+	$calls[$i] =	sprintf("%-6s", $row[0]);
+
+	if ($non_latin < 1)
+	{
+   	 $full_name[$i]=	sprintf("%-15s", $row[2]); 
+	 while(strlen($full_name[$i])>15) {$full_name[$i] = substr("$full_name[$i]", 0, -1);}
+
+	 $user[$i] =		sprintf("%-6s", $row[3]);
+        while(strlen($user[$i])>6) {$user[$i] = substr("$user[$i]", 0, -1);}
+       }
+	else
+	{	
+        $full_name[$i]=	sprintf("%-45s", $row[2]); 
+	 while(mb_strlen($full_name[$i],'utf-8')>15) {$full_name[$i] = mb_substr("$full_name[$i]", 0, -1,'utf-8');}
+
+ 	 $user[$i] =		sprintf("%-18s", $row[3]);
+	 while(mb_strlen($user[$i],'utf-8')>6) {$user[$i] = mb_substr("$user[$i]", 0, -1,'utf-8');}
+	}
+
+	$user[$i] =		sprintf("%-8s", $row[3]);
+	$USERtotTALK =	$row[1];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$pfUSERtotTALK_MS[$i] =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$pfUSERavgTALK_MS[$i] =		sprintf("%6s", $USERavgTALK_MS);
+	$i++;
+	}
+
+$k=0;
+while($k < $i)
+	{
+	$ctA[$k]="0   "; $ctB[$k]="0   "; $ctDC[$k]="0   "; $ctDNC[$k]="0   "; $ctN[$k]="0   "; $ctNI[$k]="0   "; $ctSALE[$k]="0   "; 
+	$stmt="select count(*),status from vicidial_log where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN' and user='$user[$k]' and campaign_id='" . mysql_real_escape_string($group) . "' group by status;";
+	if ($non_latin > 0)
+	{
+	$rslt=mysql_query("SET NAMES 'UTF8'");
+	}
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$rows_to_print = mysql_num_rows($rslt);
+	$m=0;
+	while ($m < $rows_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if ($row[1] == 'A') {$ctA[$k]=sprintf("%-4s", $row[0]);		$TOT_A = ($TOT_A + $row[0]);}
+		if ($row[1] == 'B') {$ctB[$k]=sprintf("%-4s", $row[0]);		$TOT_B = ($TOT_B + $row[0]);}
+		if ($row[1] == 'DC') {$ctDC[$k]=sprintf("%-4s", $row[0]);	$TOT_DC = ($TOT_DC + $row[0]);}
+		if ($row[1] == 'DNC') {$ctDNC[$k]=sprintf("%-4s", $row[0]);	$TOT_DNC = ($TOT_DNC + $row[0]);}
+		if ($row[1] == 'N') {$ctN[$k]=sprintf("%-4s", $row[0]);		$TOT_N = ($TOT_N + $row[0]);}
+		if ($row[1] == 'NI') {$ctNI[$k]=sprintf("%-4s", $row[0]);	$TOT_NI = ($TOT_NI + $row[0]);}
+		if (($row[1] == 'SALE') || ($row[1] == 'XFER') ) {$ctSALE[$k]=sprintf("%-4s", $row[0]);	$TOT_SALE = ($TOT_SALE + $row[0]);}
+		$m++;
+		}
+	echo "| $full_name[$k] | $user[$k] | $calls[$k] | $pfUSERtotTALK_MS[$k] | $pfUSERavgTALK_MS[$k] | $ctA[$k] | $ctB[$k] | $ctDC[$k] | $ctDNC[$k] | $ctN[$k] | $ctNI[$k] | $ctSALE[$k] |\n";
+
+
+
+	$k++;
+	}
+
+	$TOTcalls =	sprintf("%-7s", $TOTcalls);
+
+	$TOTtotTALK_M = ($TOTtotTALK / 60);
+	$TOTtotTALK_M = round($TOTtotTALK_M, 2);
+	$TOTtotTALK_M_int = intval("$TOTtotTALK_M");
+	$TOTtotTALK_S = ($TOTtotTALK_M - $TOTtotTALK_M_int);
+	$TOTtotTALK_S = ($TOTtotTALK_S * 60);
+	$TOTtotTALK_S = round($TOTtotTALK_S, 0);
+	if ($TOTtotTALK_S < 10) {$TOTtotTALK_S = "0$TOTtotTALK_S";}
+	$TOTtotTALK_MS = "$TOTtotTALK_M_int:$TOTtotTALK_S";
+	$TOTtotTALK_MS =		sprintf("%7s", $TOTtotTALK_MS);
+		while(strlen($TOTtotTALK_MS)>7) {$TOTtotTALK_MS = substr("$TOTtotTALK_MS", 0, -1);}
+
+	$TOT_A = sprintf("%-5s", $TOT_A);
+	$TOT_B = sprintf("%-5s", $TOT_B);
+	$TOT_DC = sprintf("%-5s", $TOT_DC);
+	$TOT_DNC = sprintf("%-5s", $TOT_DNC);
+	$TOT_N = sprintf("%-5s", $TOT_N);
+	$TOT_NI = sprintf("%-5s", $TOT_NI);
+	$TOT_SALE = sprintf("%-5s", $TOT_SALE);
+
+echo "+-----------------+----------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+echo "|  TOTALS                    | $TOTcalls| $TOTtotTALK_MS|        | $TOT_A| $TOT_B| $TOT_DC| $TOT_DNC| $TOT_N| $TOT_NI| $TOT_SALE|\n";
+echo "+-----------------+----------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+
+echo "\n";
+
+}
+
+
+
+?>
+
+
\ No newline at end of file
diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_agent_performance_detail.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_agent_performance_detail.php
new file mode 100644
index 00000000..d860d02c
--- /dev/null
+++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_agent_performance_detail.php
@@ -0,0 +1,557 @@
+    LICENSE: GPLv2
+###
+# CHANGES
+#
+# 71119-2359 - First build
+# 71121-0144 - Replace existing AST_agent_performance_detail.php script with this one
+#            - Fixed zero division bug
+#
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+if (isset($_GET["query_date"]))				{$query_date=$_GET["query_date"];}
+	elseif (isset($_POST["query_date"]))	{$query_date=$_POST["query_date"];}
+if (isset($_GET["group"]))				{$group=$_GET["group"];}
+	elseif (isset($_POST["group"]))		{$group=$_POST["group"];}
+if (isset($_GET["user_group"]))				{$user_group=$_GET["user_group"];}
+	elseif (isset($_POST["user_group"]))	{$user_group=$_POST["user_group"];}
+if (isset($_GET["shift"]))				{$shift=$_GET["shift"];}
+	elseif (isset($_POST["shift"]))		{$shift=$_POST["shift"];}
+if (isset($_GET["submit"]))				{$submit=$_GET["submit"];}
+	elseif (isset($_POST["submit"]))	{$submit=$_POST["submit"];}
+if (isset($_GET["SUBMIT"]))				{$SUBMIT=$_GET["SUBMIT"];}
+	elseif (isset($_POST["SUBMIT"]))	{$SUBMIT=$_POST["SUBMIT"];}
+
+if (strlen($shift)<2) {$shift='ALL';}
+
+$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
+$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
+
+	$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
+	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($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
+	{
+    Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
+    Header("HTTP/1.0 401 Unauthorized");
+    echo "Unzulässiges Username/Kennwort:|$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
+    exit;
+	}
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!isset($group)) {$group = '';}
+if (!isset($query_date)) {$query_date = $NOW_DATE;}
+
+$stmt="select campaign_id from vicidial_campaigns;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$campaigns_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $campaigns_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$groups[$i] =$row[0];
+	$i++;
+	}
+$stmt="select user_group from vicidial_user_groups;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$user_groups_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $user_groups_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$user_groups[$i] =$row[0];
+	$i++;
+	}
+?>
+
+
+
+
+
+\n";
+echo "VICIDIAL: Agent Performance\n";
+echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "           ÄNDERN Sie | REPORTS \n"; +echo "
\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A CAMPAIGN AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
+echo " NOTE: stats taken from shift specified\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$time_BEGIN=$AM_shift_BEGIN;
+	$time_END=$AM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "03:45:00";}   
+	if (strlen($time_END) < 6) {$time_END = "15:15:00";}
+	}
+if ($shift == 'PM') 
+	{
+	$time_BEGIN=$PM_shift_BEGIN;
+	$time_END=$PM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "15:15:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:15:00";}
+	}
+if ($shift == 'ALL') 
+	{
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "00:00:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:59:59";}
+	}
+$query_date_BEGIN = "$query_date $time_BEGIN";   
+$query_date_END = "$query_date $time_END";
+
+if (strlen($user_group)>0) {$ugSQL="and vicidial_agent_log.user_group='$user_group'";}
+else {$ugSQL='';}
+
+echo "VICIDIAL: Agent Performance Detail                        $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENTS Details -------------\n\n";
+
+
+
+
+
+$statuses='-';
+$statusesTXT='';
+$statusesHEAD='';
+$statusesHTML='';
+$statusesARY[0]='';
+$j=0;
+$users='-';
+$usersARY[0]='';
+$user_namesARY[0]='';
+$k=0;
+
+$stmt="select count(*) as calls,sum(talk_sec) as talk,full_name,vicidial_users.user,sum(pause_sec),sum(wait_sec),sum(dispo_sec),status from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user and campaign_id='" . mysql_real_escape_string($group) . "' and pause_sec<36000 and wait_sec<36000 and talk_sec<36000 and dispo_sec<36000 $ugSQL group by full_name,status order by status desc,full_name limit 100000;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$row[0] = ($row[0] - 1);	# subtract 1 for login/logout event compensation
+	
+	$calls[$i] =		$row[0];
+	$talk_sec[$i] =		$row[1];
+	$full_name[$i] =	$row[2];
+	$user[$i] =			$row[3];
+	$pause_sec[$i] =	$row[4];
+	$wait_sec[$i] =		$row[5];
+	$dispo_sec[$i] =	$row[6];
+	$status[$i] =		$row[7];
+	if ( (!eregi("-$status[$i]-", $statuses)) and (strlen($status[$i])>0) )
+		{
+		$statusesTXT = sprintf("%8s", $status[$i]);
+		$statusesHEAD .= "----------+";
+		$statusesHTML .= " $statusesTXT |";
+		$statuses .= "$status[$i]-";
+		$statusesARY[$j] = $status[$i];
+		$j++;
+		}
+	if (!eregi("-$user[$i]-", $users))
+		{
+		$users .= "$user[$i]-";
+		$usersARY[$k] = $user[$i];
+		$user_namesARY[$k] = $full_name[$i];
+		$k++;
+		}
+
+	$i++;
+	}
+
+
+echo "+-----------------+----------+--------+---------+--------+--------+--------+--------+--------+--------+--------+--------+$statusesHEAD\n";
+echo "| USER NAME       | ID       | CALLS  | TIME    | PAUSE  | PAUSAVG| WAIT   | WAITAVG| TALK   | TALKAVG| DISPO  | DISPAVG|$statusesHTML\n";
+echo "+-----------------+----------+--------+---------+--------+--------+--------+--------+--------+--------+--------+--------+$statusesHEAD\n";
+
+
+### BEGIN loop through each user ###
+$m=0;
+while ($m < $k)
+	{
+	$Suser=$usersARY[$m];
+	$Sfull_name=$user_namesARY[$m];
+	$Stime=0;
+	$Scalls=0;
+	$Stalk_sec=0;
+	$Spause_sec=0;
+	$Swait_sec=0;
+	$Sdispo_sec=0;
+	$SstatusesHTML='';
+
+	### BEGIN loop through each status ###
+	$n=0;
+	while ($n < $j)
+		{
+		$Sstatus=$statusesARY[$n];
+		$SstatusTXT='';
+		### BEGIN loop through each stat line ###
+		$i=0; $status_found=0;
+		while ($i < $rows_to_print)
+			{
+			if ( ($Suser=="$user[$i]") and ($Sstatus=="$status[$i]") )
+				{
+				$Scalls =		($Scalls + $calls[$i]);
+				$Stalk_sec =	($Stalk_sec + $talk_sec[$i]);
+				$Spause_sec =	($Spause_sec + $pause_sec[$i]);
+				$Swait_sec =	($Swait_sec + $wait_sec[$i]);
+				$Sdispo_sec =	($Sdispo_sec + $dispo_sec[$i]);
+				$SstatusTXT = sprintf("%8s", $calls[$i]);
+				$SstatusesHTML .= " $SstatusTXT |";
+				$status_found++;
+				}
+			$i++;
+			}
+		if ($status_found < 1)
+			{
+			$SstatusesHTML .= "        0 |";
+			}
+		### END loop through each stat line ###
+		$n++;
+		}
+	### END loop through each status ###
+	$Stime = ($Stalk_sec + $Spause_sec + $Swait_sec + $Sdispo_sec);
+	$TOTcalls=($TOTcalls + $Scalls);
+	$TOTtime=($TOTtime + $Stime);
+	$TOTtotTALK=($TOTtotTALK + $Stalk_sec);
+	$TOTtotWAIT=($TOTtotWAIT + $Swait_sec);
+	$TOTtotPAUSE=($TOTtotPAUSE + $Spause_sec);
+	$TOTtotDISPO=($TOTtotDISPO + $Sdispo_sec);
+	$Stime = ($Stalk_sec + $Spause_sec + $Swait_sec + $Sdispo_sec);
+	if ( ($Scalls > 0) and ($Stalk_sec > 0) ) {$Stalk_avg = ($Stalk_sec/$Scalls);}
+		else {$Stalk_avg=0;}
+	if ( ($Scalls > 0) and ($Spause_sec > 0) ) {$Spause_avg = ($Spause_sec/$Scalls);}
+		else {$Spause_avg=0;}
+	if ( ($Scalls > 0) and ($Swait_sec > 0) ) {$Swait_avg = ($Swait_sec/$Scalls);}
+		else {$Swait_avg=0;}
+	if ( ($Scalls > 0) and ($Sdispo_sec > 0) ) {$Sdispo_avg = ($Sdispo_sec/$Scalls);}
+		else {$Sdispo_avg=0;}
+
+	$Scalls =	sprintf("%6s", $Scalls);
+
+	if ($non_latin < 1)
+	{
+   	 $Sfull_name=	sprintf("%-15s", $Sfull_name); 
+		while(strlen($Sfull_name)>15) {$Sfull_name = substr("$Sfull_name", 0, -1);}
+	 $Suser =		sprintf("%-8s", $Suser);
+        while(strlen($Suser)>8) {$Suser = substr("$Suser", 0, -1);}
+       }
+	else
+	{	
+        $Sfull_name=	sprintf("%-45s", $Sfull_name); 
+	 while(mb_strlen($Sfull_name,'utf-8')>15) {$Sfull_name = mb_substr("$Sfull_name", 0, -1,'utf-8');}
+
+ 		$Suser =	sprintf("%-24s", $Suser);
+	 while(mb_strlen($Suser,'utf-8')>8) {$Suser = mb_substr("$Suser", 0, -1,'utf-8');}
+	}
+
+	$USERtime_M = ($Stime / 60);
+	$USERtime_M = round($USERtime_M, 2);
+	$USERtime_M_int = intval("$USERtime_M");
+	$USERtime_S = ($USERtime_M - $USERtime_M_int);
+	$USERtime_S = ($USERtime_S * 60);
+	$USERtime_S = round($USERtime_S, 0);
+	if ($USERtime_S < 10) {$USERtime_S = "0$USERtime_S";}
+	$USERtime_MS = "$USERtime_M_int:$USERtime_S";
+	$pfUSERtime_MS =		sprintf("%7s", $USERtime_MS);
+
+	$USERtotTALK_M = ($Stalk_sec / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$pfUSERtotTALK_MS =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($Stalk_avg / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$pfUSERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	$USERtotPAUSE_M = ($Spause_sec / 60);
+	$USERtotPAUSE_M = round($USERtotPAUSE_M, 2);
+	$USERtotPAUSE_M_int = intval("$USERtotPAUSE_M");
+	$USERtotPAUSE_S = ($USERtotPAUSE_M - $USERtotPAUSE_M_int);
+	$USERtotPAUSE_S = ($USERtotPAUSE_S * 60);
+	$USERtotPAUSE_S = round($USERtotPAUSE_S, 0);
+	if ($USERtotPAUSE_S < 10) {$USERtotPAUSE_S = "0$USERtotPAUSE_S";}
+	$USERtotPAUSE_MS = "$USERtotPAUSE_M_int:$USERtotPAUSE_S";
+	$pfUSERtotPAUSE_MS =		sprintf("%6s", $USERtotPAUSE_MS);
+
+	$USERavgPAUSE_M = ($Spause_avg / 60);
+	$USERavgPAUSE_M = round($USERavgPAUSE_M, 2);
+	$USERavgPAUSE_M_int = intval("$USERavgPAUSE_M");
+	$USERavgPAUSE_S = ($USERavgPAUSE_M - $USERavgPAUSE_M_int);
+	$USERavgPAUSE_S = ($USERavgPAUSE_S * 60);
+	$USERavgPAUSE_S = round($USERavgPAUSE_S, 0);
+	if ($USERavgPAUSE_S < 10) {$USERavgPAUSE_S = "0$USERavgPAUSE_S";}
+	$USERavgPAUSE_MS = "$USERavgPAUSE_M_int:$USERavgPAUSE_S";
+	$pfUSERavgPAUSE_MS =		sprintf("%6s", $USERavgPAUSE_MS);
+
+	$USERtotWAIT_M = ($Swait_sec / 60);
+	$USERtotWAIT_M = round($USERtotWAIT_M, 2);
+	$USERtotWAIT_M_int = intval("$USERtotWAIT_M");
+	$USERtotWAIT_S = ($USERtotWAIT_M - $USERtotWAIT_M_int);
+	$USERtotWAIT_S = ($USERtotWAIT_S * 60);
+	$USERtotWAIT_S = round($USERtotWAIT_S, 0);
+	if ($USERtotWAIT_S < 10) {$USERtotWAIT_S = "0$USERtotWAIT_S";}
+	$USERtotWAIT_MS = "$USERtotWAIT_M_int:$USERtotWAIT_S";
+	$pfUSERtotWAIT_MS =		sprintf("%6s", $USERtotWAIT_MS);
+
+	$USERavgWAIT_M = ($Swait_avg / 60);
+	$USERavgWAIT_M = round($USERavgWAIT_M, 2);
+	$USERavgWAIT_M_int = intval("$USERavgWAIT_M");
+	$USERavgWAIT_S = ($USERavgWAIT_M - $USERavgWAIT_M_int);
+	$USERavgWAIT_S = ($USERavgWAIT_S * 60);
+	$USERavgWAIT_S = round($USERavgWAIT_S, 0);
+	if ($USERavgWAIT_S < 10) {$USERavgWAIT_S = "0$USERavgWAIT_S";}
+	$USERavgWAIT_MS = "$USERavgWAIT_M_int:$USERavgWAIT_S";
+	$pfUSERavgWAIT_MS =		sprintf("%6s", $USERavgWAIT_MS);
+	
+	$USERtotDISPO_M = ($Sdispo_sec / 60);
+	$USERtotDISPO_M = round($USERtotDISPO_M, 2);
+	$USERtotDISPO_M_int = intval("$USERtotDISPO_M");
+	$USERtotDISPO_S = ($USERtotDISPO_M - $USERtotDISPO_M_int);
+	$USERtotDISPO_S = ($USERtotDISPO_S * 60);
+	$USERtotDISPO_S = round($USERtotDISPO_S, 0);
+	if ($USERtotDISPO_S < 10) {$USERtotDISPO_S = "0$USERtotDISPO_S";}
+	$USERtotDISPO_MS = "$USERtotDISPO_M_int:$USERtotDISPO_S";
+	$pfUSERtotDISPO_MS =		sprintf("%6s", $USERtotDISPO_MS);
+
+	$USERavgDISPO_M = ($Sdispo_avg / 60);
+	$USERavgDISPO_M = round($USERavgDISPO_M, 2);
+	$USERavgDISPO_M_int = intval("$USERavgDISPO_M");
+	$USERavgDISPO_S = ($USERavgDISPO_M - $USERavgDISPO_M_int);
+	$USERavgDISPO_S = ($USERavgDISPO_S * 60);
+	$USERavgDISPO_S = round($USERavgDISPO_S, 0);
+	if ($USERavgDISPO_S < 10) {$USERavgDISPO_S = "0$USERavgDISPO_S";}
+	$USERavgDISPO_MS = "$USERavgDISPO_M_int:$USERavgDISPO_S";
+	$pfUSERavgDISPO_MS =		sprintf("%6s", $USERavgDISPO_MS);
+
+	echo "| $Sfull_name | $Suser | $Scalls | $pfUSERtime_MS | $pfUSERtotPAUSE_MS | $pfUSERavgPAUSE_MS | $pfUSERtotWAIT_MS | $pfUSERavgWAIT_MS | $pfUSERtotTALK_MS | $pfUSERavgTALK_MS | $pfUSERtotDISPO_MS | $pfUSERavgDISPO_MS |$SstatusesHTML\n";
+	$m++;
+	}
+### END loop through each user ###
+
+
+###### LAST LINE FORMATTING ##########
+### BEGIN loop through each status ###
+$SUMstatusesHTML='';
+$n=0;
+while ($n < $j)
+	{
+	$Scalls=0;
+	$Sstatus=$statusesARY[$n];
+	$SUMstatusTXT='';
+	### BEGIN loop through each stat line ###
+	$i=0; $status_found=0;
+	while ($i < $rows_to_print)
+		{
+		if ($Sstatus=="$status[$i]")
+			{
+			$Scalls =		($Scalls + $calls[$i]);
+			$status_found++;
+			}
+		$i++;
+		}
+	### END loop through each stat line ###
+	if ($status_found < 1)
+		{
+		$SUMstatusesHTML .= "        0 |";
+		}
+	else
+		{
+		$SUMstatusTXT = sprintf("%8s", $Scalls);
+		$SUMstatusesHTML .= " $SUMstatusTXT |";
+		}
+	$n++;
+	}
+### END loop through each status ###
+
+
+	$TOTcalls =	sprintf("%7s", $TOTcalls);
+	$TOT_AGENTS = sprintf("%-4s", $m);
+
+	$TOTtime_M = ($TOTtime / 60);
+	$TOTtime_M = 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 ($TOTtime_S < 10) {$TOTtime_S = "0$TOTtime_S";}
+	$TOTtime_MS = "$TOTtime_M_int:$TOTtime_S";
+	$TOTtime_MS =		sprintf("%8s", $TOTtime_MS);
+		while(strlen($TOTtime_MS)>8) {$TOTtime_MS = substr("$TOTtime_MS", 0, -1);}
+
+	$TOTtotTALK_M = ($TOTtotTALK / 60);
+	$TOTtotTALK_M = round($TOTtotTALK_M, 2);
+	$TOTtotTALK_M_int = intval("$TOTtotTALK_M");
+	$TOTtotTALK_S = ($TOTtotTALK_M - $TOTtotTALK_M_int);
+	$TOTtotTALK_S = ($TOTtotTALK_S * 60);
+	$TOTtotTALK_S = round($TOTtotTALK_S, 0);
+	if ($TOTtotTALK_S < 10) {$TOTtotTALK_S = "0$TOTtotTALK_S";}
+	$TOTtotTALK_MS = "$TOTtotTALK_M_int:$TOTtotTALK_S";
+	$TOTtotTALK_MS =		sprintf("%8s", $TOTtotTALK_MS);
+		while(strlen($TOTtotTALK_MS)>8) {$TOTtotTALK_MS = substr("$TOTtotTALK_MS", 0, -1);}
+
+	$TOTtotDISPO_M = ($TOTtotDISPO / 60);
+	$TOTtotDISPO_M = round($TOTtotDISPO_M, 2);
+	$TOTtotDISPO_M_int = intval("$TOTtotDISPO_M");
+	$TOTtotDISPO_S = ($TOTtotDISPO_M - $TOTtotDISPO_M_int);
+	$TOTtotDISPO_S = ($TOTtotDISPO_S * 60);
+	$TOTtotDISPO_S = round($TOTtotDISPO_S, 0);
+	if ($TOTtotDISPO_S < 10) {$TOTtotDISPO_S = "0$TOTtotDISPO_S";}
+	$TOTtotDISPO_MS = "$TOTtotDISPO_M_int:$TOTtotDISPO_S";
+	$TOTtotDISPO_MS =		sprintf("%8s", $TOTtotDISPO_MS);
+		while(strlen($TOTtotDISPO_MS)>8) {$TOTtotDISPO_MS = substr("$TOTtotDISPO_MS", 0, -1);}
+
+	$TOTtotPAUSE_M = ($TOTtotPAUSE / 60);
+	$TOTtotPAUSE_M = round($TOTtotPAUSE_M, 2);
+	$TOTtotPAUSE_M_int = intval("$TOTtotPAUSE_M");
+	$TOTtotPAUSE_S = ($TOTtotPAUSE_M - $TOTtotPAUSE_M_int);
+	$TOTtotPAUSE_S = ($TOTtotPAUSE_S * 60);
+	$TOTtotPAUSE_S = round($TOTtotPAUSE_S, 0);
+	if ($TOTtotPAUSE_S < 10) {$TOTtotPAUSE_S = "0$TOTtotPAUSE_S";}
+	$TOTtotPAUSE_MS = "$TOTtotPAUSE_M_int:$TOTtotPAUSE_S";
+	$TOTtotPAUSE_MS =		sprintf("%8s", $TOTtotPAUSE_MS);
+		while(strlen($TOTtotPAUSE_MS)>8) {$TOTtotPAUSE_MS = substr("$TOTtotPAUSE_MS", 0, -1);}
+
+	$TOTtotWAIT_M = ($TOTtotWAIT / 60);
+	$TOTtotWAIT_M = round($TOTtotWAIT_M, 2);
+	$TOTtotWAIT_M_int = intval("$TOTtotWAIT_M");
+	$TOTtotWAIT_S = ($TOTtotWAIT_M - $TOTtotWAIT_M_int);
+	$TOTtotWAIT_S = ($TOTtotWAIT_S * 60);
+	$TOTtotWAIT_S = round($TOTtotWAIT_S, 0);
+	if ($TOTtotWAIT_S < 10) {$TOTtotWAIT_S = "0$TOTtotWAIT_S";}
+	$TOTtotWAIT_MS = "$TOTtotWAIT_M_int:$TOTtotWAIT_S";
+	$TOTtotWAIT_MS =		sprintf("%8s", $TOTtotWAIT_MS);
+		while(strlen($TOTtotWAIT_MS)>8) {$TOTtotWAIT_MS = substr("$TOTtotWAIT_MS", 0, -1);}
+
+
+	$TOTavgTALK_M = ( ($TOTtotTALK / $TOTcalls) / 60);
+	$TOTavgTALK_M = round($TOTavgTALK_M, 2);
+	$TOTavgTALK_M_int = intval("$TOTavgTALK_M");
+	$TOTavgTALK_S = ($TOTavgTALK_M - $TOTavgTALK_M_int);
+	$TOTavgTALK_S = ($TOTavgTALK_S * 60);
+	$TOTavgTALK_S = round($TOTavgTALK_S, 0);
+	if ($TOTavgTALK_S < 10) {$TOTavgTALK_S = "0$TOTavgTALK_S";}
+	$TOTavgTALK_MS = "$TOTavgTALK_M_int:$TOTavgTALK_S";
+	$TOTavgTALK_MS =		sprintf("%6s", $TOTavgTALK_MS);
+		while(strlen($TOTavgTALK_MS)>6) {$TOTavgTALK_MS = substr("$TOTavgTALK_MS", 0, -1);}
+
+	$TOTavgDISPO_M = ( ($TOTtotDISPO / $TOTcalls) / 60);
+	$TOTavgDISPO_M = round($TOTavgDISPO_M, 2);
+	$TOTavgDISPO_M_int = intval("$TOTavgDISPO_M");
+	$TOTavgDISPO_S = ($TOTavgDISPO_M - $TOTavgDISPO_M_int);
+	$TOTavgDISPO_S = ($TOTavgDISPO_S * 60);
+	$TOTavgDISPO_S = round($TOTavgDISPO_S, 0);
+	if ($TOTavgDISPO_S < 10) {$TOTavgDISPO_S = "0$TOTavgDISPO_S";}
+	$TOTavgDISPO_MS = "$TOTavgDISPO_M_int:$TOTavgDISPO_S";
+	$TOTavgDISPO_MS =		sprintf("%6s", $TOTavgDISPO_MS);
+		while(strlen($TOTavgDISPO_MS)>6) {$TOTavgDISPO_MS = substr("$TOTavgDISPO_MS", 0, -1);}
+
+	$TOTavgPAUSE_M = ( ($TOTtotPAUSE / $TOTcalls) / 60);
+	$TOTavgPAUSE_M = round($TOTavgPAUSE_M, 2);
+	$TOTavgPAUSE_M_int = intval("$TOTavgPAUSE_M");
+	$TOTavgPAUSE_S = ($TOTavgPAUSE_M - $TOTavgPAUSE_M_int);
+	$TOTavgPAUSE_S = ($TOTavgPAUSE_S * 60);
+	$TOTavgPAUSE_S = round($TOTavgPAUSE_S, 0);
+	if ($TOTavgPAUSE_S < 10) {$TOTavgPAUSE_S = "0$TOTavgPAUSE_S";}
+	$TOTavgPAUSE_MS = "$TOTavgPAUSE_M_int:$TOTavgPAUSE_S";
+	$TOTavgPAUSE_MS =		sprintf("%6s", $TOTavgPAUSE_MS);
+		while(strlen($TOTavgPAUSE_MS)>6) {$TOTavgPAUSE_MS = substr("$TOTavgPAUSE_MS", 0, -1);}
+
+	$TOTavgWAIT_M = ( ($TOTtotWAIT / $TOTcalls) / 60);
+	$TOTavgWAIT_M = round($TOTavgWAIT_M, 2);
+	$TOTavgWAIT_M_int = intval("$TOTavgWAIT_M");
+	$TOTavgWAIT_S = ($TOTavgWAIT_M - $TOTavgWAIT_M_int);
+	$TOTavgWAIT_S = ($TOTavgWAIT_S * 60);
+	$TOTavgWAIT_S = round($TOTavgWAIT_S, 0);
+	if ($TOTavgWAIT_S < 10) {$TOTavgWAIT_S = "0$TOTavgWAIT_S";}
+	$TOTavgWAIT_MS = "$TOTavgWAIT_M_int:$TOTavgWAIT_S";
+	$TOTavgWAIT_MS =		sprintf("%6s", $TOTavgWAIT_MS);
+		while(strlen($TOTavgWAIT_MS)>6) {$TOTavgWAIT_MS = substr("$TOTavgWAIT_MS", 0, -1);}
+
+
+echo "+-----------------+----------+--------+---------+--------+--------+--------+--------+--------+--------+--------+--------+$statusesHEAD\n";
+echo "|  TOTALS        AGENTS:$TOT_AGENTS | $TOTcalls| $TOTtime_MS|$TOTtotPAUSE_MS| $TOTavgPAUSE_MS |$TOTtotWAIT_MS| $TOTavgWAIT_MS |$TOTtotTALK_MS| $TOTavgTALK_MS |$TOTtotDISPO_MS| $TOTavgDISPO_MS |$SUMstatusesHTML\n";
+echo "+----------------------------+--------+---------+--------+--------+--------+--------+--------+--------+--------+--------+$statusesHEAD\n";
+
+echo "\n";
+
+}
+
+
+?>
+
+
\ No newline at end of file
diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_agent_time_sheet.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_agent_time_sheet.php
new file mode 100644
index 00000000..5bf7c948
--- /dev/null
+++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_agent_time_sheet.php
@@ -0,0 +1,286 @@
+    LICENSE: GPLv2
+###
+# CHANGES
+#
+# 60619-1729 - Added variable filtering to eliminate SQL injection attack threat
+#            - Added required user/pass to gain access to this page
+#
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+if (isset($_GET["agent"]))				{$agent=$_GET["agent"];}
+	elseif (isset($_POST["agent"]))		{$agent=$_POST["agent"];}
+if (isset($_GET["query_date"]))				{$query_date=$_GET["query_date"];}
+	elseif (isset($_POST["query_date"]))		{$query_date=$_POST["query_date"];}
+if (isset($_GET["calls_summary"]))				{$calls_summary=$_GET["calls_summary"];}
+	elseif (isset($_POST["calls_summary"]))		{$calls_summary=$_POST["calls_summary"];}
+if (isset($_GET["submit"]))				{$submit=$_GET["submit"];}
+	elseif (isset($_POST["submit"]))		{$submit=$_POST["submit"];}
+if (isset($_GET["SUBMIT"]))				{$SUBMIT=$_GET["SUBMIT"];}
+	elseif (isset($_POST["SUBMIT"]))		{$SUBMIT=$_POST["SUBMIT"];}
+
+$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
+$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
+
+	$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
+	if ($DB) {echo "|$stmt|\n";}
+	$rslt=mysql_query($stmt, $link);
+	$row=mysql_fetch_row($rslt);
+	$auth=$row[0];
+
+  if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
+	{
+    Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
+    Header("HTTP/1.0 401 Unauthorized");
+    echo "Unzulässiges Username/Kennwort:|$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
+    exit;
+	}
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!isset($query_date)) {$query_date = $NOW_DATE;}
+
+?>
+
+
+
+
+
+\n";
+echo "VICIDIAL: Agent Time Sheet\n";
+echo "VICIDIAL ADMIN: Agent Time Sheet\n";
+echo " - User Stats\n";
+echo " - User Status\n";
+echo " - Ändern Sie Benutzer\n";
+echo "
\n"; +echo "
  \n"; +echo "Date: \n"; +echo "User ID: \n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n";
+
+
+if (!$agent)
+{
+echo "\n";
+echo "PLEASE SELECT AN MITTELID AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
+echo " NOTE: stats taken from available agent log data\n";
+}
+
+else
+{
+$query_date_BEGIN = "$query_date 00:00:00";   
+$query_date_END = "$query_date 23:59:59";
+$time_BEGIN = "00:00:00";   
+$time_END = "23:59:59";
+
+$stmt="select full_name from vicidial_users where user='$agent';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$full_name = $row[0];
+
+echo "VICIDIAL: Agent Time Sheet                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- MITTELTIME SHEET: $agent - $full_name -------------\n\n";
+
+if ($calls_summary)
+	{
+	$stmt="select count(*) as calls,sum(talk_sec) as talk,avg(talk_sec),sum(pause_sec),avg(pause_sec),sum(wait_sec),avg(wait_sec),sum(dispo_sec),avg(dispo_sec) from vicidial_agent_log where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' and pause_sec<48800 and wait_sec<48800 and talk_sec<48800 and dispo_sec<48800 limit 1;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+
+	$TOTAL_TIME = ($row[1] + $row[3] + $row[5] + $row[7]);
+
+		$TOTAL_TIME_H = ($TOTAL_TIME / 3600);
+		$TOTAL_TIME_H = round($TOTAL_TIME_H, 2);
+		$TOTAL_TIME_H_int = intval("$TOTAL_TIME_H");
+		$TOTAL_TIME_M = ($TOTAL_TIME_H - $TOTAL_TIME_H_int);
+		$TOTAL_TIME_M = ($TOTAL_TIME_M * 60);
+		$TOTAL_TIME_M = round($TOTAL_TIME_M, 2);
+		$TOTAL_TIME_M_int = intval("$TOTAL_TIME_M");
+		$TOTAL_TIME_S = ($TOTAL_TIME_M - $TOTAL_TIME_M_int);
+		$TOTAL_TIME_S = ($TOTAL_TIME_S * 60);
+		$TOTAL_TIME_S = round($TOTAL_TIME_S, 0);
+		if ($TOTAL_TIME_S < 10) {$TOTAL_TIME_S = "0$TOTAL_TIME_S";}
+		if ($TOTAL_TIME_M_int < 10) {$TOTAL_TIME_M_int = "0$TOTAL_TIME_M_int";}
+		$TOTAL_TIME_HMS = "$TOTAL_TIME_H_int:$TOTAL_TIME_M_int:$TOTAL_TIME_S";
+		$pfTOTAL_TIME_HMS =		sprintf("%8s", $TOTAL_TIME_HMS);
+
+		$TALK_TIME_H = ($row[1] / 3600);
+		$TALK_TIME_H = round($TALK_TIME_H, 2);
+		$TALK_TIME_H_int = intval("$TALK_TIME_H");
+		$TALK_TIME_M = ($TALK_TIME_H - $TALK_TIME_H_int);
+		$TALK_TIME_M = ($TALK_TIME_M * 60);
+		$TALK_TIME_M = round($TALK_TIME_M, 2);
+		$TALK_TIME_M_int = intval("$TALK_TIME_M");
+		$TALK_TIME_S = ($TALK_TIME_M - $TALK_TIME_M_int);
+		$TALK_TIME_S = ($TALK_TIME_S * 60);
+		$TALK_TIME_S = round($TALK_TIME_S, 0);
+		if ($TALK_TIME_S < 10) {$TALK_TIME_S = "0$TALK_TIME_S";}
+		if ($TALK_TIME_M_int < 10) {$TALK_TIME_M_int = "0$TALK_TIME_M_int";}
+		$TALK_TIME_HMS = "$TALK_TIME_H_int:$TALK_TIME_M_int:$TALK_TIME_S";
+		$pfTALK_TIME_HMS =		sprintf("%8s", $TALK_TIME_HMS);
+
+		$PAUSE_TIME_H = ($row[3] / 3600);
+		$PAUSE_TIME_H = round($PAUSE_TIME_H, 2);
+		$PAUSE_TIME_H_int = intval("$PAUSE_TIME_H");
+		$PAUSE_TIME_M = ($PAUSE_TIME_H - $PAUSE_TIME_H_int);
+		$PAUSE_TIME_M = ($PAUSE_TIME_M * 60);
+		$PAUSE_TIME_M = round($PAUSE_TIME_M, 2);
+		$PAUSE_TIME_M_int = intval("$PAUSE_TIME_M");
+		$PAUSE_TIME_S = ($PAUSE_TIME_M - $PAUSE_TIME_M_int);
+		$PAUSE_TIME_S = ($PAUSE_TIME_S * 60);
+		$PAUSE_TIME_S = round($PAUSE_TIME_S, 0);
+		if ($PAUSE_TIME_S < 10) {$PAUSE_TIME_S = "0$PAUSE_TIME_S";}
+		if ($PAUSE_TIME_M_int < 10) {$PAUSE_TIME_M_int = "0$PAUSE_TIME_M_int";}
+		$PAUSE_TIME_HMS = "$PAUSE_TIME_H_int:$PAUSE_TIME_M_int:$PAUSE_TIME_S";
+		$pfPAUSE_TIME_HMS =		sprintf("%8s", $PAUSE_TIME_HMS);
+
+		$WAIT_TIME_H = ($row[5] / 3600);
+		$WAIT_TIME_H = round($WAIT_TIME_H, 2);
+		$WAIT_TIME_H_int = intval("$WAIT_TIME_H");
+		$WAIT_TIME_M = ($WAIT_TIME_H - $WAIT_TIME_H_int);
+		$WAIT_TIME_M = ($WAIT_TIME_M * 60);
+		$WAIT_TIME_M = round($WAIT_TIME_M, 2);
+		$WAIT_TIME_M_int = intval("$WAIT_TIME_M");
+		$WAIT_TIME_S = ($WAIT_TIME_M - $WAIT_TIME_M_int);
+		$WAIT_TIME_S = ($WAIT_TIME_S * 60);
+		$WAIT_TIME_S = round($WAIT_TIME_S, 0);
+		if ($WAIT_TIME_S < 10) {$WAIT_TIME_S = "0$WAIT_TIME_S";}
+		if ($WAIT_TIME_M_int < 10) {$WAIT_TIME_M_int = "0$WAIT_TIME_M_int";}
+		$WAIT_TIME_HMS = "$WAIT_TIME_H_int:$WAIT_TIME_M_int:$WAIT_TIME_S";
+		$pfWAIT_TIME_HMS =		sprintf("%8s", $WAIT_TIME_HMS);
+
+		$WRAPUP_TIME_H = ($row[7] / 3600);
+		$WRAPUP_TIME_H = round($WRAPUP_TIME_H, 2);
+		$WRAPUP_TIME_H_int = intval("$WRAPUP_TIME_H");
+		$WRAPUP_TIME_M = ($WRAPUP_TIME_H - $WRAPUP_TIME_H_int);
+		$WRAPUP_TIME_M = ($WRAPUP_TIME_M * 60);
+		$WRAPUP_TIME_M = round($WRAPUP_TIME_M, 2);
+		$WRAPUP_TIME_M_int = intval("$WRAPUP_TIME_M");
+		$WRAPUP_TIME_S = ($WRAPUP_TIME_M - $WRAPUP_TIME_M_int);
+		$WRAPUP_TIME_S = ($WRAPUP_TIME_S * 60);
+		$WRAPUP_TIME_S = round($WRAPUP_TIME_S, 0);
+		if ($WRAPUP_TIME_S < 10) {$WRAPUP_TIME_S = "0$WRAPUP_TIME_S";}
+		if ($WRAPUP_TIME_M_int < 10) {$WRAPUP_TIME_M_int = "0$WRAPUP_TIME_M_int";}
+		$WRAPUP_TIME_HMS = "$WRAPUP_TIME_H_int:$WRAPUP_TIME_M_int:$WRAPUP_TIME_S";
+		$pfWRAPUP_TIME_HMS =		sprintf("%8s", $WRAPUP_TIME_HMS);
+
+		$TALK_AVG_M = ($row[2] / 60);
+		$TALK_AVG_M = round($TALK_AVG_M, 2);
+		$TALK_AVG_M_int = intval("$TALK_AVG_M");
+		$TALK_AVG_S = ($TALK_AVG_M - $TALK_AVG_M_int);
+		$TALK_AVG_S = ($TALK_AVG_S * 60);
+		$TALK_AVG_S = round($TALK_AVG_S, 0);
+		if ($TALK_AVG_S < 10) {$TALK_AVG_S = "0$TALK_AVG_S";}
+		$TALK_AVG_MS = "$TALK_AVG_M_int:$TALK_AVG_S";
+		$pfTALK_AVG_MS =		sprintf("%6s", $TALK_AVG_MS);
+
+		$PAUSE_AVG_M = ($row[4] / 60);
+		$PAUSE_AVG_M = round($PAUSE_AVG_M, 2);
+		$PAUSE_AVG_M_int = intval("$PAUSE_AVG_M");
+		$PAUSE_AVG_S = ($PAUSE_AVG_M - $PAUSE_AVG_M_int);
+		$PAUSE_AVG_S = ($PAUSE_AVG_S * 60);
+		$PAUSE_AVG_S = round($PAUSE_AVG_S, 0);
+		if ($PAUSE_AVG_S < 10) {$PAUSE_AVG_S = "0$PAUSE_AVG_S";}
+		$PAUSE_AVG_MS = "$PAUSE_AVG_M_int:$PAUSE_AVG_S";
+		$pfPAUSE_AVG_MS =		sprintf("%6s", $PAUSE_AVG_MS);
+
+		$WAIT_AVG_M = ($row[6] / 60);
+		$WAIT_AVG_M = round($WAIT_AVG_M, 2);
+		$WAIT_AVG_M_int = intval("$WAIT_AVG_M");
+		$WAIT_AVG_S = ($WAIT_AVG_M - $WAIT_AVG_M_int);
+		$WAIT_AVG_S = ($WAIT_AVG_S * 60);
+		$WAIT_AVG_S = round($WAIT_AVG_S, 0);
+		if ($WAIT_AVG_S < 10) {$WAIT_AVG_S = "0$WAIT_AVG_S";}
+		$WAIT_AVG_MS = "$WAIT_AVG_M_int:$WAIT_AVG_S";
+		$pfWAIT_AVG_MS =		sprintf("%6s", $WAIT_AVG_MS);
+
+		$WRAPUP_AVG_M = ($row[8] / 60);
+		$WRAPUP_AVG_M = round($WRAPUP_AVG_M, 2);
+		$WRAPUP_AVG_M_int = intval("$WRAPUP_AVG_M");
+		$WRAPUP_AVG_S = ($WRAPUP_AVG_M - $WRAPUP_AVG_M_int);
+		$WRAPUP_AVG_S = ($WRAPUP_AVG_S * 60);
+		$WRAPUP_AVG_S = round($WRAPUP_AVG_S, 0);
+		if ($WRAPUP_AVG_S < 10) {$WRAPUP_AVG_S = "0$WRAPUP_AVG_S";}
+		$WRAPUP_AVG_MS = "$WRAPUP_AVG_M_int:$WRAPUP_AVG_S";
+		$pfWRAPUP_AVG_MS =		sprintf("%6s", $WRAPUP_AVG_MS);
+
+	echo "GESAMTANRUFETAKEN: $row[0]\n";
+	echo "TALK TIME:               $pfTALK_TIME_HMS     AVERAGE: $pfTALK_AVG_MS\n";
+	echo "PAUSE TIME:              $pfPAUSE_TIME_HMS     AVERAGE: $pfPAUSE_AVG_MS\n";
+	echo "WAIT TIME:               $pfWAIT_TIME_HMS     AVERAGE: $pfWAIT_AVG_MS\n";
+	echo "WRAPUP TIME:             $pfWRAPUP_TIME_HMS     AVERAGE: $pfWRAPUP_AVG_MS\n";
+	echo "----------------------------------------------------------------\n";
+	echo "TOTAL ACTIVE MITTELTIME: $pfTOTAL_TIME_HMS\n";
+
+	echo "\n";
+	}
+else
+	{
+	echo "Call Activity Summary\n\n";
+
+	}
+
+$stmt="select event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' order by event_time limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+echo "FIRST LOGIN:          $row[0]\n";
+$start = $row[1];
+
+$stmt="select event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' order by event_time desc limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+echo "LAST LOG ACTIVITY:    $row[0]\n";
+$end = $row[1];
+
+$login_time = ($end - $start);
+	$LOGIN_TIME_H = ($login_time / 3600);
+	$LOGIN_TIME_H = round($LOGIN_TIME_H, 2);
+	$LOGIN_TIME_H_int = intval("$LOGIN_TIME_H");
+	$LOGIN_TIME_M = ($LOGIN_TIME_H - $LOGIN_TIME_H_int);
+	$LOGIN_TIME_M = ($LOGIN_TIME_M * 60);
+	$LOGIN_TIME_M = round($LOGIN_TIME_M, 2);
+	$LOGIN_TIME_M_int = intval("$LOGIN_TIME_M");
+	$LOGIN_TIME_S = ($LOGIN_TIME_M - $LOGIN_TIME_M_int);
+	$LOGIN_TIME_S = ($LOGIN_TIME_S * 60);
+	$LOGIN_TIME_S = round($LOGIN_TIME_S, 0);
+	if ($LOGIN_TIME_S < 10) {$LOGIN_TIME_S = "0$LOGIN_TIME_S";}
+	if ($LOGIN_TIME_M_int < 10) {$LOGIN_TIME_M_int = "0$LOGIN_TIME_M_int";}
+	$LOGIN_TIME_HMS = "$LOGIN_TIME_H_int:$LOGIN_TIME_M_int:$LOGIN_TIME_S";
+	$pfLOGIN_TIME_HMS =		sprintf("%8s", $LOGIN_TIME_HMS);
+
+echo "-----------------------------------------\n";
+echo "TOTAL LOGGED-IN TIME:    $pfLOGIN_TIME_HMS\n";
+
+}
+
+
+
+?>
+
+
\ No newline at end of file
diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_inboundEXTstats.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_inboundEXTstats.php
new file mode 100644
index 00000000..bf046253
--- /dev/null
+++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_inboundEXTstats.php
@@ -0,0 +1,400 @@
+    LICENSE: GPLv2
+#
+# CHANGES
+# 60421-1450 - check GET/POST vars lines with isset to not trigger PHP NOTICES
+# 60620-1322 - Added variable filtering to eliminate SQL injection attack threat
+#            - Added required user/pass to gain access to this page
+#
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+if (isset($_GET["group"]))					{$group=$_GET["group"];}
+	elseif (isset($_POST["group"]))			{$group=$_POST["group"];}
+if (isset($_GET["query_date"]))				{$query_date=$_GET["query_date"];}
+	elseif (isset($_POST["query_date"]))	{$query_date=$_POST["query_date"];}
+if (isset($_GET["server_ip"]))				{$server_ip=$_GET["server_ip"];}
+	elseif (isset($_POST["server_ip"]))		{$server_ip=$_POST["server_ip"];}
+if (isset($_GET["submit"]))					{$submit=$_GET["submit"];}
+	elseif (isset($_POST["submit"]))		{$submit=$_POST["submit"];}
+if (isset($_GET["SUBMIT"]))					{$SUBMIT=$_GET["SUBMIT"];}
+	elseif (isset($_POST["SUBMIT"]))		{$SUBMIT=$_POST["SUBMIT"];}
+
+$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
+$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
+
+	$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
+	if ($DB) {echo "|$stmt|\n";}
+	$rslt=mysql_query($stmt, $link);
+	$row=mysql_fetch_row($rslt);
+	$auth=$row[0];
+
+  if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
+	{
+    Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
+    Header("HTTP/1.0 401 Unauthorized");
+    echo "Unzulässiges Username/Kennwort:|$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
+    exit;
+	}
+
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!isset($query_date)) {$query_date = $NOW_DATE;}
+if (!isset($server_ip)) {$server_ip = '10.10.11.20';}
+
+$stmt="select extension,full_number,inbound_name from inbound_numbers where server_ip='" . mysql_real_escape_string($server_ip) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$inbound_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $inbound_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$inbound[$i] =$row[0];
+	$fullnum[$i] =$row[1];
+	$inbname[$i] =$row[2];
+	$i++;
+	}
+?>
+
+
+
+
+
+\n";
+#echo"\n";
+echo "ASTERISK: Inbound Anruf-Notfall\n";
+echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "WÄHLEN Sie BITTE Eine ZAHL Vor UND DATUM OBEN UND KLICKEN REICHT Ein\n";
+}
+
+else
+{
+
+
+echo "ASTERISK: Inbound Anruf-Notfall                      $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$extenSQL = "and extension='" . mysql_real_escape_string($group) . "'";
+if (eregi("\*",$group))
+	{$extenSQL = "and extension LIKE \"%$group\"";}
+$stmt="select count(*),sum(length_in_sec) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " 00:00:01' and start_time <= '" . mysql_real_escape_string($query_date) . " 23:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Gesamtanrufe, die in diese Zahl kamen:       $TOTALcalls\n";
+echo "Average Call Length(seconds) for all Calls:   $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(length_in_sec) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " 00:00:01' and start_time <= '" . mysql_real_escape_string($query_date) . " 23:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$DROPcalls =	sprintf("%10s", $row[0]);
+$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
+$DROPpercent = round($DROPpercent, 0);
+
+if ($row[0])
+	{
+	$average_hold_seconds = ($row[1] / $row[0]);
+	$average_hold_seconds = round($average_hold_seconds, 0);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+else {$DROPpercent=0;   $average_hold_seconds=0;}
+echo "Total DROP Calls:   (less than 10 seconds)    $DROPcalls  $DROPpercent%\n";
+echo "Average Call Length(seconds) for DROP Calls:  $average_hold_seconds\n";
+
+
+##############################
+#########  CALLS STATS
+
+echo "\n";
+echo "---------- CALL LISTINGS\n";
+echo "+----------------------+----------------------+--------+---------------------+\n";
+echo "| CALLERID             | CALLERIDNAME         | LENGTH | DATE TIME           |\n";
+echo "+----------------------+----------------------+--------+---------------------+\n";
+
+$stmt="select number_dialed,caller_code,length_in_sec,start_time from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " 00:00:01' and start_time <= '" . mysql_real_escape_string($query_date) . " 23:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$CID =			sprintf("%-20s", $row[0]);
+	$CIDname =		sprintf("%-20s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
+	$datetime =		sprintf("%-19s", $row[3]);
+	$USERavgTALK =	$row[2];
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $CID | $CIDname | $USERavgTALK_MS | $datetime |\n";
+
+	$i++;
+	}
+
+echo "+----------------------+----------------------+--------+---------------------+\n";
+
+##############################
+#########  TIME STATS
+
+if ($output == 'FULL')
+	{
+
+	echo "\n";
+	echo "---------- TIME STATS\n";
+
+	echo "\n";
+
+	$hi_hour_count=0;
+	$last_full_record=0;
+	$i=0;
+	$h=0;
+	while ($i <= 96)
+		{
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:00:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:14:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:00:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:14:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:15:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:29:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:15:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:29:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:30:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:44:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:30:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:44:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:45:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:45:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+		$h++;
+		}
+
+	$hour_multiplier = (100 / $hi_hour_count);
+	#$hour_multiplier = round($hour_multiplier, 0);
+
+	echo "\n";
+	echo "DIAGRAMM IN 15 MINUZIÖSEN STUFENSPRÜNGEN VON GESAMTANRUFEN\n";
+
+	$k=1;
+	$Mk=0;
+	$call_scale = '0';
+	while ($k <= 102) 
+		{
+		if ($Mk >= 5) 
+			{
+			$Mk=0;
+			$scale_num=($k / $hour_multiplier);
+			$scale_num = round($scale_num, 0);
+			$LENscale_num = (strlen($scale_num));
+			$k = ($k + $LENscale_num);
+			$call_scale .= "$scale_num";
+			}
+		else
+			{
+			$call_scale .= " ";
+			$k++;   $Mk++;
+			}
+		}
+
+
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+	#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+	echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+	$ZZ = '00';
+	$i=0;
+	$h=4;
+	$hour= -1;
+	$no_lines_yet=1;
+
+	while ($i <= 96)
+		{
+		$char_counter=0;
+		$time = '      ';
+		if ($h >= 4) 
+			{
+			$hour++;
+			$h=0;
+			if ($hour < 10) {$hour = "0$hour";}
+			$time = "+$hour$ZZ+";
+			}
+		if ($h == 1) {$time = "   15 ";}
+		if ($h == 2) {$time = "   30 ";}
+		if ($h == 3) {$time = "   45 ";}
+		$Ghour_count = $hour_count[$i];
+		if ($Ghour_count < 1) 
+			{
+			if ( ($no_lines_yet) or ($i > $last_full_record) )
+				{
+				$do_nothing=1;
+				}
+			else
+				{
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+				echo "|$time|";
+				$k=0;   while ($k <= 102) {echo " ";   $k++;}
+				echo "| $hour_count[$i] |\n";
+				}
+			}
+		else
+			{
+			$no_lines_yet=0;
+			$Xhour_count = ($Ghour_count * $hour_multiplier);
+			$Yhour_count = (99 - $Xhour_count);
+
+			$Gdrop_count = $drop_count[$i];
+			if ($Gdrop_count < 1) 
+				{
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+				echo "|$time|";
+				$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+				echo "*X";   $char_counter++;
+				$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+					while ($char_counter <= 101) {echo " ";   $char_counter++;}
+				echo "| 0     | $hour_count[$i] |\n";
+
+				}
+			else
+				{
+				$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+			#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+				$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+				$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+				echo "|$time|";
+				$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+				echo "D";   $char_counter++;
+				$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+				echo "X";   $char_counter++;
+				$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+					while ($char_counter <= 102) {echo " ";   $char_counter++;}
+				echo "| $drop_count[$i] | $hour_count[$i] |\n";
+				}
+			}
+		
+		
+		$i++;
+		$h++;
+		}
+
+
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+
+	}
+
+
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_server_performance.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_server_performance.php new file mode 100644 index 00000000..d727c21a --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_server_performance.php @@ -0,0 +1,306 @@ + LICENSE: GPLv2 +# +# CHANGES +# +# 60619-1732 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 70417-1106 - Changed time frame to be definable per time range on a single day +# - Fixed vertical scaling issues +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["begin_query_time"])) {$begin_query_time=$_GET["begin_query_time"];} + elseif (isset($_POST["begin_query_time"])) {$begin_query_time=$_POST["begin_query_time"];} +if (isset($_GET["end_query_time"])) {$end_query_time=$_GET["end_query_time"];} + elseif (isset($_POST["end_query_time"])) {$end_query_time=$_POST["end_query_time"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and modify_servers='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Unzulässiges Username/Kennwort:|$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +# path from root to where ploticus files will be stored +$PLOTroot = "vicidial/ploticus"; +$DOCroot = "$WeBServeRRooT/$PLOTroot/"; + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); + +if (!isset($query_date)) {$query_date = $NOW_DATE;} +if (!isset($begin_query_time)) {$begin_query_time = '09:00:00';} +if (!isset($end_query_time)) {$end_query_time = '15:30:00';} +if (!isset($group)) {$group = '';} + +$stmt="select server_ip from servers;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$servers_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $servers_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: Server Performance\n"; +echo "
\n"; +echo "Date:   \n"; +echo "Time: \n"; +echo "to \n"; +echo "Server: \n"; +echo "\n"; +echo "             REPORTS \n"; +echo "
\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A SERVER, DATE AND TIME RANGE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+
+$query_date_BEGIN = "$query_date $begin_query_time";   
+$query_date_END = "$query_date $end_query_time";
+$time_BEGIN = "$begin_query_time";   
+$time_END = "$end_query_time";
+
+echo "VICIDIAL: Server Performance                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- TOTALS, PEAKS and AVERAGES\n";
+
+$stmt="select AVG(sysload),AVG(channels_total),MAX(sysload),MAX(channels_total),MAX(processes) from server_performance where start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and server_ip='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$AVGload =	sprintf("%10s", $row[0]);
+$AVGchannels =	sprintf("%10s", $row[1]);
+$HIGHload =	$row[2];
+	$HIGHmulti = intval($HIGHload / 100);
+$HIGHchannels =	$row[3];
+$HIGHprocesses =$row[4];
+if ($row[2] > $row[3]) {$HIGHlimit = $row[2];}
+else {$HIGHlimit = $row[3];}
+if ($HIGHlimit < $row[4]) {$HIGHlimit = $row[4];}
+
+$stmt="select AVG(cpu_user_percent),AVG(cpu_system_percent),AVG(cpu_idle_percent) from server_performance where start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and server_ip='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$AVGcpuUSER =	sprintf("%10s", $row[0]);
+$AVGcpuSYSTEM =	sprintf("%10s", $row[1]);
+$AVGcpuIDLE =	sprintf("%10s", $row[2]);
+
+$stmt="select count(*),SUM(length_in_min) from call_log where extension NOT IN('8365','8366','8367') and  start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and server_ip='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$OFFHOOKtime =	sprintf("%10s", $row[1]);
+
+
+echo "Total Calls in/out on this server:        $TOTALcalls\n";
+echo "Total Off-Hook time on this server (min): $OFFHOOKtime\n";
+echo "Average/Peak channels in use for server:  $AVGchannels / $HIGHchannels\n";
+echo "Average/Peak load for server:             $AVGload / $HIGHload\n";
+echo "Average USER process cpu percentage:      $AVGcpuUSER %\n";
+echo "Average SYSTEM process cpu percentage:    $AVGcpuSYSTEM %\n";
+echo "Average IDLE process cpu percentage:      $AVGcpuIDLE %\n";
+
+echo "\n";
+echo "---------- LINE GRAPH:\n";
+
+
+
+##############################
+#########  Graph stats
+
+$DAT = '.dat';
+$HTM = '.htm';
+$PNG = '.png';
+$filedate = date("Y-m-d_His");
+$DATfile = "$group$query_date$shift$filedate$DAT";
+$HTMfile = "$group$query_date$shift$filedate$HTM";
+$PNGfile = "$group$query_date$shift$filedate$PNG";
+
+$HTMfp = fopen ("$DOCroot/$HTMfile", "a");
+$DATfp = fopen ("$DOCroot/$DATfile", "a");
+
+$stmt="select DATE_FORMAT(start_time,'%H:%i:%s') as timex,sysload,processes,channels_total,live_recordings,cpu_user_percent,cpu_system_percent from server_performance where server_ip='" . mysql_real_escape_string($group) . "' and start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' order by timex;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$row[5] = intval(($row[5] + $row[6]) * $HIGHmulti);
+	$row[6] = intval($row[6] * $HIGHmulti);
+	fwrite ($DATfp, "$row[5]\t$row[6]\t$row[0]\t$row[1]\t$row[2]\t$row[3]\n");
+	$i++;
+	}
+fclose($DATfp);
+
+$rows_to_max = ($rows_to_print + 100);
+
+#print "rows: $i\n";
+
+$time_scale_abb = '5 minutes';
+$time_scale_tick = '1 minute';
+if ($i > 1000) {$time_scale_abb = '10 minutes';   $time_scale_tick = '2 minutes';}
+if ($i > 2000) {$time_scale_abb = '20 minutes';   $time_scale_tick = '4 minutes';}
+if ($i > 3000) {$time_scale_abb = '30 minutes';   $time_scale_tick = '5 minutes';}
+if ($i > 4000) {$time_scale_abb = '40 minutes';   $time_scale_tick = '10 minutes';}
+if ($i > 5000) {$time_scale_abb = '60 minutes';   $time_scale_tick = '15 minutes';}
+if ($i > 6000) {$time_scale_abb = '90 minutes';   $time_scale_tick = '15 minutes';}
+if ($i > 7000) {$time_scale_abb = '120 minutes';   $time_scale_tick = '30 minutes';}
+
+$HTMcontent  = '';
+$HTMcontent .= "#proc page\n";
+$HTMcontent .= "#if @DEVICE in png,gif\n";
+$HTMcontent .= "   scale: 0.6\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#endif\n";
+$HTMcontent .= "#proc getdata\n";
+$HTMcontent .= "file: $DOCroot/$DATfile\n";
+$HTMcontent .= "fieldnames: userproc sysproc time load processes channels\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc areadef\n";
+$HTMcontent .= "title: Server $group   $query_date_BEGIN to $query_date_END\n";
+$HTMcontent .= "titledetails: size=14  align=C\n";
+$HTMcontent .= "rectangle: 1 1 14 7\n";
+$HTMcontent .= "xscaletype: time hh:mm:ss\n";
+$HTMcontent .= "xrange: $time_BEGIN $time_END\n";
+$HTMcontent .= "yrange: 0 $HIGHlimit\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc xaxis\n";
+$HTMcontent .= "stubs: inc $time_scale_abb\n";
+$HTMcontent .= "minorticinc: $time_scale_tick\n";
+$HTMcontent .= "stubformat: hh:mm:ssa\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc yaxis\n";
+$HTMcontent .= "stubs: inc 50\n";
+$HTMcontent .= "grid: color=yellow\n";
+$HTMcontent .= "gridskip: min\n";
+$HTMcontent .= "ticincrement: 100 1000\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc lineplot\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: userproc\n";
+$HTMcontent .= "linedetails: color=purple width=.5\n";
+$HTMcontent .= "fill: lavender\n";
+$HTMcontent .= "legendlabel: user proc%\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc lineplot\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: sysproc\n";
+$HTMcontent .= "linedetails: color=yelloworange width=.5\n";
+$HTMcontent .= "fill: dullyellow\n";
+$HTMcontent .= "legendlabel: system proc%\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: load\n";
+$HTMcontent .= "linedetails: color=blue width=.5\n";
+$HTMcontent .= "legendlabel: load\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: processes\n";
+$HTMcontent .= "linedetails: color=red width=.5\n";
+$HTMcontent .= "legendlabel: processes\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: channels\n";
+$HTMcontent .= "linedetails: color=green width=.5\n";
+$HTMcontent .= "legendlabel: channels\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc legend\n";
+$HTMcontent .= "location: max-2 max\n";
+$HTMcontent .= "seglen: 0.2\n";
+$HTMcontent .= "\n";
+
+fwrite ($HTMfp, "$HTMcontent");
+fclose($HTMfp);
+
+
+passthru("/usr/local/bin/pl -png $DOCroot/$HTMfile -o $DOCroot/$PNGfile");
+
+sleep(1);
+
+echo "
\n"; +echo "\n"; +echo "\n"; + + +echo ""; + +} + + + +?> + + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_timeonVDAD.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_timeonVDAD.php new file mode 100644 index 00000000..5c3948f6 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_timeonVDAD.php @@ -0,0 +1,374 @@ + LICENSE: GPLv2 +### +# live real-time stats for the VICIDIAL Auto-Dialer +# +# CHANGES +# +# 60620-1037 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 61114-2004 - Changed to display CLOSER and DEFAULT, added trunk shortage +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["reset_counter"])) {$reset_counter=$_GET["reset_counter"];} + elseif (isset($_POST["reset_counter"])) {$reset_counter=$_POST["reset_counter"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["closer_display"])) {$closer_display=$_GET["closer_display"];} + elseif (isset($_POST["closer_display"])) {$closer_display=$_POST["closer_display"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Unzulässiges Username/Kennwort:|$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +$epochSIXhoursAGO = ($STARTtime - 21600); +$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO); + +$reset_counter++; + +if ($reset_counter > 7) + { + $reset_counter=0; + + $stmt="update park_log set status='HUNGUP' where hangup_time is not null;"; +# $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + + if ($DB) + { + $stmt="delete from park_log where grab_time < '$timeSIXhoursAGO' and (hangup_time is null or hangup_time='');"; +# $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + } + } + +?> + + + +\n"; +echo " + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On VDAD\n"; +echo "
";
+
+###################################################################################
+###### SERVER INFORMATION
+###################################################################################
+
+$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where server_ip='" . mysql_real_escape_string($server_ip) . "';";
+$rslt=mysql_query($stmt, $link);
+$row=mysql_fetch_row($rslt);
+$balanceSHORT = $row[0];
+
+echo "SERVER: $server_ip\n";
+
+
+
+###################################################################################
+###### TIME ON SYSTEM
+###################################################################################
+
+if ($closer_display>0) {$closer_display_reverse=0;   $closer_reverse_link='DEFAULT';}
+else {$closer_display_reverse=1;   $closer_reverse_link='CLOSER';}
+
+echo "VICIDIAL: Agents Time On Calls           $NOW_TIME    $closer_reverse_link | REPORTS\n\n";
+
+if ($closer_display>0)
+{
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+echo "| STATION    | USER   | SESSIONID | CHANNEL             | STATUS | CALLTIME | MINUTES | CAMPAIGN     | FRONT  |\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+}
+else
+{
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+\n";
+echo "| STATION    | USER   | SESSIONID | CHANNEL             | STATUS | CALLTIME | MINUTES |\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+\n";
+}
+
+$stmt="select extension,user,conf_exten,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),uniqueid,lead_id from vicidial_live_agents where status NOT IN('PAUSED') and server_ip='" . mysql_real_escape_string($server_ip) . "' order by extension;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$talking_to_print = mysql_num_rows($rslt);
+	if ($talking_to_print > 0)
+	{
+	$i=0;
+	while ($i < $talking_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+			if (eregi("READY|PAUSED|CLOSER",$row[4]))
+			{
+			$row[3]='';
+			$row[5]='- WAIT -';
+			$row[6]=$row[7];
+			}
+		$extension[$i] = eregi_replace('Local/',"",$row[0]);
+		$extension[$i] =		sprintf("%-10s", $extension[$i]);
+			while(strlen($extension[$i])>10) {$extension[$i] = substr("$extension[$i]", 0, -1);}
+		$user[$i] =				sprintf("%-6s", $row[1]);
+		$sessionid[$i] =		sprintf("%-9s", $row[2]);
+		$channel[$i] =			sprintf("%-19s", $row[3]);
+			$cc[$i]=0;
+		while ( (strlen($channel[$i]) > 19) and ($cc[$i] < 100) )
+			{
+			$channel[$i] = eregi_replace(".$","",$channel[$i]);   
+			$cc[$i]++;
+			if (strlen($channel[$i]) <= 19) {$cc[$i]=101;}
+			}
+		$status[$i] =			sprintf("%-6s", $row[4]);
+		$start_time[$i] =		sprintf("%-8s", $row[5]);
+			$cd[$i]=0;
+		while ( (strlen($start_time[$i]) > 8) and ($cd[$i] < 100) )
+			{
+			$start_time[$i] = eregi_replace("^.","",$start_time[$i]);   
+			$cd[$i]++;
+			if (strlen($start_time[$i]) <= 8) {$cd[$i]=101;}
+			}
+		$uniqueid[$i] =			$row[8];
+		$lead_id[$i] =			$row[9];
+		$closer[$i] =			$row[1];
+		$call_time_S[$i] = ($STARTtime - $row[6]);
+
+		$call_time_M[$i] = ($call_time_S[$i] / 60);
+		$call_time_M[$i] = round($call_time_M[$i], 2);
+		$call_time_M_int[$i] = intval("$call_time_M[$i]");
+		$call_time_SEC[$i] = ($call_time_M[$i] - $call_time_M_int[$i]);
+		$call_time_SEC[$i] = ($call_time_SEC[$i] * 60);
+		$call_time_SEC[$i] = round($call_time_SEC[$i], 0);
+		if ($call_time_SEC[$i] < 10) {$call_time_SEC[$i] = "0$call_time_SEC[$i]";}
+		$call_time_MS[$i] = "$call_time_M_int[$i]:$call_time_SEC[$i]";
+		$call_time_MS[$i] =		sprintf("%7s", $call_time_MS[$i]);
+
+		if ($closer_display<1)
+			{
+			$G = '';		$EG = '';
+			if ($call_time_M_int[$i] >= 5) {$G=''; $EG='';}
+			if ($call_time_M_int[$i] >= 10) {$G=''; $EG='';}
+			if (eregi("PAUSED",$row[4])) 
+				{
+				if ($call_time_M_int >= 1) 
+					{$i++; continue;} 
+				else
+					{$G=''; $EG='';}
+				}
+			$agentcount++;
+			echo "| $G$extension[$i]$EG | $G$user[$i]$EG | $G$sessionid[$i]$EG | $G$channel[$i]$EG | $G$status[$i]$EG | $G$start_time[$i]$EG | $G$call_time_MS[$i]$EG |\n";
+			}
+		$i++;
+		}
+
+		if ($closer_display>0)
+		{
+
+			$ext_count = $i;
+			$i=0;
+		while ($i < $ext_count)
+			{
+
+			$stmt="select campaign_id from vicidial_auto_calls where lead_id='$lead_id[$i]' and server_ip='" . mysql_real_escape_string($server_ip) . "';";
+			$rslt=mysql_query($stmt, $link);
+			if ($DB) {echo "$stmt\n";}
+			$camp_to_print = mysql_num_rows($rslt);
+			if ($camp_to_print > 0)
+				{
+				$row=mysql_fetch_row($rslt);
+				$campaign = sprintf("%-12s", $row[0]);
+				$camp_color = $row[0];
+				}
+			else
+				{$campaign = 'DEAD        ';   	$camp_color = 'DEAD';}
+			if (eregi("READY|PAUSED|CLOSER",$status[$i]))
+				{$campaign = '            ';   	$camp_color = '';}
+
+			$stmt="select user from vicidial_xfer_log where lead_id='$lead_id[$i]' and closer='$closer[$i]' order by call_date desc limit 1;";
+			$rslt=mysql_query($stmt, $link);
+			if ($DB) {echo "$stmt\n";}
+			$xfer_to_print = mysql_num_rows($rslt);
+			if ($xfer_to_print > 0)
+				{
+				$row=mysql_fetch_row($rslt);
+				$fronter = sprintf("%-6s", $row[0]);
+				}
+			else
+				{$fronter = '      ';}
+
+			$G = '';		$EG = '';
+			$G=""; $EG='';
+		#	if ($call_time_M_int[$i] >= 5) {$G=''; $EG='';}
+		#	if ($call_time_M_int[$i] >= 10) {$G=''; $EG='';}
+
+			echo "| $G$extension[$i]$EG | $G$user[$i]$EG | $G$sessionid[$i]$EG | $G$channel[$i]$EG | $G$status[$i]$EG | $G$start_time[$i]$EG | $G$call_time_MS[$i]$EG | $G$campaign$EG | $G$fronter$EG |\n";
+
+			$i++;
+			}
+		echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+		echo "  $i Mittel geloggt innen auf Bediener $server_ip\n\n";
+	#	echo "             - 5 Minuten oder mehr beim Anruf\n";
+	#	echo "             - Über 10 Minuten beim Anruf\n";
+		}
+	else
+		{
+		echo "+------------|--------+-----------+---------------------+--------+----------+---------+\n";
+		echo "  $agentcount Mittel geloggt innen auf Bediener $server_ip\n\n";
+
+		echo "             - Pausierte Mittel\n";
+		echo "             - 5 Minuten oder mehr beim Anruf\n";
+		echo "             - Über 10 Minuten beim Anruf\n";
+		}
+
+	}
+	else
+	{
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	echo "*********************************KEINE MITTEL BEI DEN ANRUFEN*********************************\n";
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	}
+
+
+###################################################################################
+###### OUTBOUND CALLS
+###################################################################################
+#echo "\n\n";
+echo "----------------------------------------------------------------------------------------";
+echo "\n\n";
+echo "VICIDIAL: Time On VDAD            TRUNK SHORT: $balanceSHORT              $NOW_TIME\n\n";
+echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+echo "| CHANNEL             | STATUS | CAMPAIGN     | PHONE NUMBER       | CALLTIME | MINUTES |\n";
+echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+
+$stmt="select channel,status,campaign_id,phone_code,phone_number,call_time,UNIX_TIMESTAMP(call_time) from vicidial_auto_calls where status NOT IN('XFER') and server_ip='" . mysql_real_escape_string($server_ip) . "' order by auto_call_id desc;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$parked_to_print = mysql_num_rows($rslt);
+	if ($parked_to_print > 0)
+	{
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$channel =			sprintf("%-19s", $row[0]);
+			$cc=0;
+		while ( (strlen($channel) > 19) and ($cc < 100) )
+			{
+			$channel = eregi_replace(".$","",$channel);   
+			$cc++;
+			if (strlen($channel) <= 19) {$cc=101;}
+			}
+		$start_time =		sprintf("%-8s", $row[5]);
+			$cd=0;
+		while ( (strlen($start_time) > 8) and ($cd < 100) )
+			{
+			$start_time = eregi_replace("^.","",$start_time);   
+			$cd++;
+			if (strlen($start_time) <= 8) {$cd=101;}
+			}
+		$status =			sprintf("%-6s", $row[1]);
+		$campaign =			sprintf("%-12s", $row[2]);
+			$all_phone = "$row[3]$row[4]";
+		$number_dialed =	sprintf("%-18s", $all_phone);
+		$call_time_S = ($STARTtime - $row[6]);
+
+		$call_time_M = ($call_time_S / 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";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if (eregi("LIVE",$status)) {$G=''; $EG='';}
+	#	if ($call_time_M_int >= 6) {$G=''; $EG='';}
+
+		echo "| $G$channel$EG | $G$status$EG | $G$campaign$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+		echo "  $i Anrufe, die auf Bediener gesetzt werden $server_ip\n\n";
+
+		echo "             - PHASENCANKLOPFEN\n";
+	#	echo "             - Over 5 minutes on hold\n";
+
+		}
+	else
+	{
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	echo "*******************************KEIN PHASENCANKLOPFEN*********************************\n";
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	}
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_timeonVDAD_closer.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_timeonVDAD_closer.php new file mode 100644 index 00000000..cd820afc --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_timeonVDAD_closer.php @@ -0,0 +1,318 @@ + LICENSE: GPLv2 +### +# live real-time stats for the VICIDIAL Auto-Dialer +# +# CHANGES +# +# 60620-1037 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["reset_counter"])) {$reset_counter=$_GET["reset_counter"];} + elseif (isset($_POST["reset_counter"])) {$reset_counter=$_POST["reset_counter"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Unzulässiges Username/Kennwort:|$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +$epochSIXhoursAGO = ($STARTtime - 21600); +$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO); + +$reset_counter++; + +if ($reset_counter > 7) + { + $reset_counter=0; + + $stmt="update park_log set status='HUNGUP' where hangup_time is not null;"; +# $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + + if ($DB) + { + $stmt="delete from park_log where grab_time < '$timeSIXhoursAGO' and (hangup_time is null or hangup_time='');"; +# $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + } + } + +?> + + + +\n"; +echo " + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On VDAD\n"; +echo "
";
+
+###################################################################################
+###### TIME ON SYSTEM
+###################################################################################
+
+echo "VICIDIAL: Mittel Setzen Bei den Anrufen Zeit fest        $NOW_TIME    REPORTS\n\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+echo "| STATION    | USER   | SESSIONID | CHANNEL             | STATUS | CALLTIME | MINUTES | CAMPAIGN     | FRONT  |\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+
+
+$stmt="select extension,user,conf_exten,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),uniqueid,lead_id from vicidial_live_agents where status NOT IN('PAUSED') and server_ip='" . mysql_real_escape_string($server_ip) . "' order by extension;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$talking_to_print = mysql_num_rows($rslt);
+	if ($talking_to_print > 0)
+	{
+	$i=0;
+	while ($i < $talking_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+			if (eregi("READY|PAUSED|CLOSER",$row[4]))
+			{
+			$row[3]='';
+			$row[5]='- WAIT -';
+			$row[6]=$row[7];
+			}
+		$extension[$i] = eregi_replace('Local/',"",$row[0]);
+		$extension[$i] =		sprintf("%-10s", $extension[$i]);
+			while(strlen($extension[$i])>10) {$extension[$i] = substr("$extension[$i]", 0, -1);}
+		$user[$i] =				sprintf("%-6s", $row[1]);
+		$sessionid[$i] =		sprintf("%-9s", $row[2]);
+		$channel[$i] =			sprintf("%-19s", $row[3]);
+			$cc[$i]=0;
+		while ( (strlen($channel[$i]) > 19) and ($cc[$i] < 100) )
+			{
+			$channel[$i] = eregi_replace(".$","",$channel[$i]);   
+			$cc[$i]++;
+			if (strlen($channel[$i]) <= 19) {$cc[$i]=101;}
+			}
+		$status[$i] =			sprintf("%-6s", $row[4]);
+		$start_time[$i] =		sprintf("%-8s", $row[5]);
+			$cd[$i]=0;
+		while ( (strlen($start_time[$i]) > 8) and ($cd[$i] < 100) )
+			{
+			$start_time[$i] = eregi_replace("^.","",$start_time[$i]);   
+			$cd[$i]++;
+			if (strlen($start_time[$i]) <= 8) {$cd[$i]=101;}
+			}
+		$uniqueid[$i] =			$row[8];
+		$lead_id[$i] =			$row[9];
+		$closer[$i] =			$row[1];
+		$call_time_S[$i] = ($STARTtime - $row[6]);
+
+		$call_time_M[$i] = ($call_time_S[$i] / 60);
+		$call_time_M[$i] = round($call_time_M[$i], 2);
+		$call_time_M_int[$i] = intval("$call_time_M[$i]");
+		$call_time_SEC[$i] = ($call_time_M[$i] - $call_time_M_int[$i]);
+		$call_time_SEC[$i] = ($call_time_SEC[$i] * 60);
+		$call_time_SEC[$i] = round($call_time_SEC[$i], 0);
+		if ($call_time_SEC[$i] < 10) {$call_time_SEC[$i] = "0$call_time_SEC[$i]";}
+		$call_time_MS[$i] = "$call_time_M_int[$i]:$call_time_SEC[$i]";
+		$call_time_MS[$i] =		sprintf("%7s", $call_time_MS[$i]);
+		$i++;
+		}
+		$ext_count = $i;
+		$i=0;
+	while ($i < $ext_count)
+		{
+
+		$stmt="select campaign_id from vicidial_auto_calls where lead_id='$lead_id[$i]' and server_ip='" . mysql_real_escape_string($server_ip) . "';";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$camp_to_print = mysql_num_rows($rslt);
+		if ($camp_to_print > 0)
+			{
+			$row=mysql_fetch_row($rslt);
+			$campaign = sprintf("%-12s", $row[0]);
+			$camp_color = $row[0];
+			}
+		else
+			{$campaign = 'DEAD        ';   	$camp_color = 'DEAD';}
+		if (eregi("READY|PAUSED|CLOSER",$status[$i]))
+			{$campaign = '            ';   	$camp_color = '';}
+
+		$stmt="select user from vicidial_xfer_log where lead_id='$lead_id[$i]' and closer='$closer[$i]' order by call_date desc limit 1;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$xfer_to_print = mysql_num_rows($rslt);
+		if ($xfer_to_print > 0)
+			{
+			$row=mysql_fetch_row($rslt);
+			$fronter = sprintf("%-6s", $row[0]);
+			}
+		else
+			{$fronter = '      ';}
+
+		$G = '';		$EG = '';
+		$G=""; $EG='';
+	#	if ($call_time_M_int[$i] >= 5) {$G=''; $EG='';}
+	#	if ($call_time_M_int[$i] >= 10) {$G=''; $EG='';}
+
+		echo "| $G$extension[$i]$EG | $G$user[$i]$EG | $G$sessionid[$i]$EG | $G$channel[$i]$EG | $G$status[$i]$EG | $G$start_time[$i]$EG | $G$call_time_MS[$i]$EG | $G$campaign$EG | $G$fronter$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+		echo "  $i Mittel geloggt innen auf Bediener $server_ip\n\n";
+
+	#	echo "             - 5 Minuten oder mehr beim Anruf\n";
+	#	echo "             - Über 10 Minuten beim Anruf\n";
+
+	}
+	else
+	{
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	echo "*********************************KEINE MITTEL BEI DEN ANRUFEN*********************************\n";
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	}
+
+
+###################################################################################
+###### OUTBOUND CALLS
+###################################################################################
+#echo "\n\n";
+echo "----------------------------------------------------------------------------------------";
+echo "\n\n";
+echo "VICIDIAL: Time On VDAD                                              $NOW_TIME\n\n";
+echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+echo "| CHANNEL             | STATUS | CAMPAIGN     | PHONE NUMBER       | CALLTIME | MINUTES |\n";
+echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+
+#$link=mysql_connect("localhost", "cron", "1234");
+# $linkX=mysql_connect("localhost", "cron", "1234");
+#mysql_select_db("asterisk");
+
+$stmt="select channel,status,campaign_id,phone_code,phone_number,call_time,UNIX_TIMESTAMP(call_time) from vicidial_auto_calls where status NOT IN('XFER') and server_ip='" . mysql_real_escape_string($server_ip) . "' order by auto_call_id desc;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$parked_to_print = mysql_num_rows($rslt);
+	if ($parked_to_print > 0)
+	{
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$channel =			sprintf("%-19s", $row[0]);
+			$cc=0;
+		while ( (strlen($channel) > 19) and ($cc < 100) )
+			{
+			$channel = eregi_replace(".$","",$channel);   
+			$cc++;
+			if (strlen($channel) <= 19) {$cc=101;}
+			}
+		$start_time =		sprintf("%-8s", $row[5]);
+			$cd=0;
+		while ( (strlen($start_time) > 8) and ($cd < 100) )
+			{
+			$start_time = eregi_replace("^.","",$start_time);   
+			$cd++;
+			if (strlen($start_time) <= 8) {$cd=101;}
+			}
+		$status =			sprintf("%-6s", $row[1]);
+		$campaign =			sprintf("%-12s", $row[2]);
+			$all_phone = "$row[3]$row[4]";
+		$number_dialed =	sprintf("%-18s", $all_phone);
+		$call_time_S = ($STARTtime - $row[6]);
+
+		$call_time_M = ($call_time_S / 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";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if (eregi("LIVE",$status)) {$G=''; $EG='';}
+	#	if ($call_time_M_int >= 6) {$G=''; $EG='';}
+
+		echo "| $G$channel$EG | $G$status$EG | $G$campaign$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+		echo "  $i Anrufe, die auf Bediener gesetzt werden $server_ip\n\n";
+
+		echo "             - PHASENCANKLOPFEN\n";
+	#	echo "             - Over 5 minutes on hold\n";
+
+		}
+	else
+	{
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	echo "*******************************KEIN PHASENCANKLOPFEN*********************************\n";
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	}
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_timeonVDADall.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_timeonVDADall.php new file mode 100644 index 00000000..f74eda63 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_timeonVDADall.php @@ -0,0 +1,826 @@ + LICENSE: GPLv2 +# +# live real-time stats for the VICIDIAL Auto-Dialer all servers +# +# STOP=4000, SLOW=40, GO=4 seconds refresh interval +# +# CHANGELOG: +# 50406-0920 - Added Paused agents < 1 min (Chris Doyle) +# 51130-1218 - Modified layout and info to show all servers in a vicidial system +# 60421-1043 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60511-1343 - Added leads and drop info at the top of the screen +# 60608-1539 - Fixed CLOSER tallies for active calls +# 60619-1658 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 60626-1453 - Added display of system load to bottom (Angelito Manansala) +# 60901-1123 - Changed display elements at the top of the screen +# 60905-1342 - Fixed non INCALL|QUEUE timer column +# 61002-1642 - Added TRUNK SHORT/FILL stats +# 61101-1318 - Added SIP and IAX Listen and Barge links option +# 61101-1647 - Added Usergroup column and user name option as well as sorting +# 61102-1155 - Made display of columns more modular, added ability to hide server info +# 61215-1131 - Added answered calls and drop percent taken from answered calls +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70123-1151 - Added non_latin options for substr in display variables, thanks Marin Blu +# 70206-1140 - Added call-type statuses to display(A-Auto, M-Manual, I-Inbound/Closer) +# 70619-1339 - Added Status Category tally display +# 71029-1900 - Changed CLOSER-type to not require campaign_id restriction +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["RR"])) {$RR=$_GET["RR"];} + elseif (isset($_POST["RR"])) {$RR=$_POST["RR"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["usergroup"])) {$usergroup=$_GET["usergroup"];} + elseif (isset($_POST["usergroup"])) {$usergroup=$_POST["usergroup"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["adastats"])) {$adastats=$_GET["adastats"];} + elseif (isset($_POST["adastats"])) {$adastats=$_POST["adastats"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["SIPmonitorLINK"])) {$SIPmonitorLINK=$_GET["SIPmonitorLINK"];} + elseif (isset($_POST["SIPmonitorLINK"])) {$SIPmonitorLINK=$_POST["SIPmonitorLINK"];} +if (isset($_GET["IAXmonitorLINK"])) {$IAXmonitorLINK=$_GET["IAXmonitorLINK"];} + elseif (isset($_POST["IAXmonitorLINK"])) {$IAXmonitorLINK=$_POST["IAXmonitorLINK"];} +if (isset($_GET["UGdisplay"])) {$UGdisplay=$_GET["UGdisplay"];} + elseif (isset($_POST["UGdisplay"])) {$UGdisplay=$_POST["UGdisplay"];} +if (isset($_GET["UidORname"])) {$UidORname=$_GET["UidORname"];} + elseif (isset($_POST["UidORname"])) {$UidORname=$_POST["UidORname"];} +if (isset($_GET["orderby"])) {$orderby=$_GET["orderby"];} + elseif (isset($_POST["orderby"])) {$orderby=$_POST["orderby"];} +if (isset($_GET["SERVdisplay"])) {$SERVdisplay=$_GET["SERVdisplay"];} + elseif (isset($_POST["SERVdisplay"])) {$SERVdisplay=$_POST["SERVdisplay"];} + + + +if (!isset($RR)) {$gRRroup=4;} +if (!isset($group)) {$group='';} +if (!isset($usergroup)) {$usergroup='';} +if (!isset($UGdisplay)) {$UGdisplay=0;} # 0=no, 1=yes +if (!isset($UidORname)) {$UidORname=0;} # 0=id, 1=name +if (!isset($orderby)) {$orderby='timeup';} +if (!isset($SERVdisplay)) {$SERVdisplay=1;} # 0=no, 1=yes + +function get_server_load($windows = false) { +$os = strtolower(PHP_OS); +if(strpos($os, "win") === false) { +if(file_exists("/proc/loadavg")) { +$load = file_get_contents("/proc/loadavg"); +$load = explode(' ', $load); +return $load[0]; +} +elseif(function_exists("shell_exec")) { +$load = explode(' ', `uptime`); +return $load[count($load)-1]; +} +else { +return false; +} +} +elseif($windows) { +if(class_exists("COM")) { +$wmi = new COM("WinMgmts:\\\\."); +$cpus = $wmi->InstancesOf("Win32_Processor"); + +$cpuload = 0; +$i = 0; +while ($cpu = $cpus->Next()) { +$cpuload += $cpu->LoadPercentage; +$i++; +} + +$cpuload = round($cpuload / $i, 2); +return "$cpuload%"; +} +else { +return false; +} +} +} + +$load_ave = get_server_load(true); + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + 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($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Unzulässiges Username/Kennwort:|$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_TIME = date("Y-m-d H:i:s"); +$NOW_DAY = date("Y-m-d"); +$NOW_HOUR = date("H:i:s"); +$STARTtime = date("U"); +$epochSIXhoursAGO = ($STARTtime - 21600); +$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO); + +$stmt="select campaign_id from vicidial_campaigns where active='Y';"; +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +if (!isset($DB)) {$DB=0;} +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + +$stmt="select * from vicidial_user_groups;"; +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +if (!isset($DB)) {$DB=0;} +if ($DB) {echo "$stmt\n";} +$usergroups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $usergroups_to_print) + { + $row=mysql_fetch_row($rslt); + $usergroups[$i] =$row[0]; + $i++; + } + +if (!isset($RR)) {$RR=4;} + +$NFB = ''; +$NFE = ''; +$F=''; $FG=''; $B=''; $BG=''; + +?> + + + + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On VDAD Kampagne: $group\n"; +echo "
\n"; +echo "VICIDIAL Kampagne: \n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +if ($UGdisplay > 0) + { + echo "\n"; + } +echo "         \n"; +echo "STOP | "; +echo "SLOW | "; +echo "GO"; +echo "       ÄNDERN Sie | \n"; +echo "SUMMARY | \n"; +echo "REPORTS \n"; +echo "\n\n"; + + +if (!$group) {echo "

please select a campaign from the pulldown above
\n"; exit;} +else +{ +$stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select avg(auto_dial_level),min(dial_status_a),min(dial_status_b),min(dial_status_c),min(dial_status_d),min(dial_status_e),min(lead_order),min(lead_filter_id),sum(hopper_level),min(dial_method),avg(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),min(available_only_ratio_tally),min(adaptive_latest_server_time),min(local_call_time),avg(dial_timeout),min(dial_statuses) from vicidial_campaigns;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$DIALlev = $row[0]; +$DIALstatusA = $row[1]; +$DIALstatusB = $row[2]; +$DIALstatusC = $row[3]; +$DIALstatusD = $row[4]; +$DIALstatusE = $row[5]; +$DIALorder = $row[6]; +$DIALfilter = $row[7]; +$HOPlev = $row[8]; +$DIALmethod = $row[9]; +$maxDIALlev = $row[10]; +$DROPmax = $row[11]; +$targetDIFF = $row[12]; +$ADAintense = $row[13]; +$ADAavailonly = $row[14]; +$TAPERtime = $row[15]; +$CALLtime = $row[16]; +$DIALtimeout = $row[17]; +$DIALstatuses = $row[18]; + $DIALstatuses = (preg_replace("/ -$|^ /","",$DIALstatuses)); + $DIALstatuses = (ereg_replace(' ',', ',$DIALstatuses)); + +$stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select count(*) from vicidial_hopper;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$VDhop = $row[0]; + +$stmt="select dialable_leads,calls_today,drops_today,drops_answers_today_pct,differential_onemin,agents_average_onemin,balance_trunk_fill,answers_today,status_category_1,status_category_count_1,status_category_2,status_category_count_2,status_category_3,status_category_count_3,status_category_4,status_category_count_4 from vicidial_campaign_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),min(status_category_1),sum(status_category_count_1),min(status_category_2),sum(status_category_count_2),min(status_category_3),sum(status_category_count_3),min(status_category_4),sum(status_category_count_4) from vicidial_campaign_stats;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$DAleads = $row[0]; +$callsTODAY = $row[1]; +$dropsTODAY = $row[2]; +$drpctTODAY = $row[3]; +$diffONEMIN = $row[4]; +$agentsONEMIN = $row[5]; +$balanceFILL = $row[6]; +$answersTODAY = $row[7]; +$VSCcat1 = $row[8]; +$VSCcat1tally = $row[9]; +$VSCcat2 = $row[10]; +$VSCcat2tally = $row[11]; +$VSCcat3 = $row[12]; +$VSCcat3tally = $row[13]; +$VSCcat4 = $row[14]; +$VSCcat4tally = $row[15]; + +if ( ($diffONEMIN != 0) and ($agentsONEMIN > 0) ) + { + $diffpctONEMIN = ( ($diffONEMIN / $agentsONEMIN) * 100); + $diffpctONEMIN = sprintf("%01.2f", $diffpctONEMIN); + } +else {$diffpctONEMIN = '0.00';} + +$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$balanceSHORT = $row[0]; + +echo "
"; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +if ($adastats>1) + { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; + + + + +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo "
DIAL LEVEL:  $DIALlev    TRUNK SHORT/FILL:  $balanceSHORT / $balanceFILL     FILTER:  $DIALfilter   TIME:   $NOW_TIME
- min   MAX LEVEL:  $maxDIALlev   DROPPED MAX:  $DROPmax%    TARGET DIFF:  $targetDIFF     INTENSITY:  $ADAintense    
DIAL TIMEOUT:  $DIALtimeout  TAPER TIME:  $TAPERtime  LOCAL TIME:  $CALLtime  AVAIL ONLY:  $ADAavailonly  
DIALABLE LEADS:  $DAleads     CALLS TODAY:  $callsTODAY     AVG AGENTS:  $agentsONEMIN     DIAL METHOD:  $DIALmethod    
HOPPER LEVEL:  $HOPlev     DROPPED / ANSWERED:  $dropsTODAY / $answersTODAY   DL DIFF:  $diffONEMIN     STATUSES:  $DIALstatuses    
LEADS IN HOPPER:  $VDhop     DROPPED PERCENT:  "; +if ($drpctTODAY >= $DROPmax) + {echo "$drpctTODAY%";} +else + {echo "$drpctTODAY%";} +echo "    DIFF:  $diffpctONEMIN%     ORDER:  $DIALorder    
"; +if ( (!eregi('NULL',$VSCcat1)) and (strlen($VSCcat1)>0) ) + {echo "$VSCcat1:   $VSCcat1tally       \n";} +if ( (!eregi('NULL',$VSCcat2)) and (strlen($VSCcat2)>0) ) + {echo "$VSCcat2:   $VSCcat2tally       \n";} +if ( (!eregi('NULL',$VSCcat3)) and (strlen($VSCcat3)>0) ) + {echo "$VSCcat3:   $VSCcat3tally       \n";} +if ( (!eregi('NULL',$VSCcat4)) and (strlen($VSCcat4)>0) ) + {echo "$VSCcat4:   $VSCcat4tally       \n";} +echo "
"; + +if ($adastats<2) + { + echo "+ VIEW MORE SETTINGS"; + } +if ($UGdisplay>0) + { + echo "       Verberge USER GROUP"; + } +else + { + echo "       VIEW USER GROUP"; + } +if ($UidORname>0) + { + echo "       Zeige MITTELID"; + } +else + { + echo "       Zeige MITTELNAME"; + } +if ($SERVdisplay>0) + { + echo "       Verberge BEDIENERINFO"; + } +else + { + echo "       Zeige BEDIENERINFO"; + } +echo "
"; + +echo "\n\n"; +} +################################################################################### +###### OUTBOUND CALLS +################################################################################### +if ($campaign_allow_inbound > 0) + { + $stmt="select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = preg_replace("/^ | -$/","",$row[0]); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaigns = "'$closer_campaigns'"; + + $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') and ( (call_type='IN' and campaign_id IN($closer_campaigns)) or (campaign_id='" . mysql_real_escape_string($group) . "' and call_type='OUT') );"; + } +else + { + if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';} + else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";} + + $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') $groupSQL;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$parked_to_print = mysql_num_rows($rslt); + if ($parked_to_print > 0) + { + $i=0; + $out_total=0; + $out_ring=0; + $out_live=0; + while ($i < $parked_to_print) + { + $row=mysql_fetch_row($rslt); + + if (eregi("LIVE",$row[0])) + {$out_live++;} + else + { + if (eregi("CLOSER",$row[0])) + {$nothing=1;} + else + {$out_ring++;} + } + $out_total++; + $i++; + } + + if ($out_live > 0) {$F=''; $FG='';} + if ($out_live > 4) {$F=''; $FG='';} + if ($out_live > 9) {$F=''; $FG='';} + if ($out_live > 14) {$F=''; $FG='';} + + if ($campaign_allow_inbound > 0) + {echo "$NFB$out_total$NFE current active calls      \n";} + else + {echo "$NFB$out_total$NFE calls being placed       \n";} + + echo "$NFB$out_ring$NFE calls ringing         \n"; + echo "$NFB$F  $out_live $FG$NFE calls waiting for agents       \n"; + } + else + { + echo "KEIN PHASENCANKLOPFEN\n"; + } + + +################################################################################### +###### TIME ON SYSTEM +################################################################################### + +$agent_incall=0; +$agent_ready=0; +$agent_paused=0; +$agent_total=0; + +$Aecho = ''; +$Aecho .= "VICIDIAL: Agents Time On Calls Kampagne: $group $NOW_TIME\n\n"; + + +$HDbegin = "+"; +$HTbegin = "|"; +$HDstation = "------------+"; +$HTstation = " STATION |"; +$HDuser = "--------------------+"; +$HTuser = " USER |"; +$HDusergroup = "--------------+"; +$HTusergroup = " USER GROUP |"; +$HDsessionid = "------------------+"; +$HTsessionid = " SESSIONID |"; +$HDbarge = "-------+"; +$HTbarge = " BARGE |"; +$HDstatus = "----------+"; +$HTstatus = " STATUS |"; +$HDserver_ip = "-----------------+"; +$HTserver_ip = " BEDIENERIP |"; +$HDcall_server_ip = "-----------------+"; +$HTcall_server_ip = " CALL BEDIENERIP |"; +$HDtime = "---------+"; +$HTtime = " MM:SS |"; +$HDcampaign = "------------+"; +$HTcampaign = " CAMPAIGN |"; + +if ($UGdisplay < 1) + { + $HDusergroup = ''; + $HTusergroup = ''; + } +if ( ($SIPmonitorLINK<1) && ($IAXmonitorLINK<1) ) + { + $HDsessionid = "-----------+"; + $HTsessionid = " SESSIONID |"; + } +if ( ($SIPmonitorLINK<2) && ($IAXmonitorLINK<2) ) + { + $HDbarge = ''; + $HTbarge = ''; + } +if ($SERVdisplay < 1) + { + $HDserver_ip = ''; + $HTserver_ip = ''; + $HDcall_server_ip = ''; + $HTcall_server_ip = ''; + } + + + +$Aline = "$HDbegin$HDstation$HDuser$HDusergroup$HDsessionid$HDbarge$HDstatus$HDserver_ip$HDcall_server_ip$HDtime$HDcampaign\n"; +$Bline = "$HTbegin$HTstation$HTuser$HTusergroup$HTsessionid$HTbarge$HTstatus$HTserver_ip$HTcall_server_ip$HTtime$HTcampaign\n"; +$Aecho .= "$Aline"; +$Aecho .= "$Bline"; +$Aecho .= "$Aline"; + +if ($orderby=='timeup') {$orderSQL='status,last_call_time';} +if ($orderby=='timedown') {$orderSQL='status desc,last_call_time desc';} +if ($orderby=='campaignup') {$orderSQL='campaign_id,status,last_call_time';} +if ($orderby=='campaigndown') {$orderSQL='campaign_id desc,status desc,last_call_time desc';} +if ($orderby=='groupup') {$orderSQL='user_group,status,last_call_time';} +if ($orderby=='groupdown') {$orderSQL='user_group desc,status desc,last_call_time desc';} +if ($UidORname > 0) + { + if ($orderby=='userup') {$orderSQL='full_name,status,last_call_time';} + if ($orderby=='userdown') {$orderSQL='full_name desc,status desc,last_call_time desc';} + } +else + { + if ($orderby=='userup') {$orderSQL='vicidial_live_agents.user';} + if ($orderby=='userdown') {$orderSQL='vicidial_live_agents.user desc';} + } + +if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';} +else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";} +if (strlen($usergroup)<1) {$usergroupSQL = '';} +else {$usergroupSQL = " and user_group='" . mysql_real_escape_string($usergroup) . "'";} + +$stmt="select extension,vicidial_live_agents.user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id,vicidial_users.user_group,vicidial_users.full_name,vicidial_live_agents.comments from vicidial_live_agents,vicidial_users where vicidial_live_agents.user=vicidial_users.user $groupSQL $usergroupSQL order by $orderSQL;"; + +#$stmt="select extension,vicidial_live_agents.user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id,vicidial_users.user_group,vicidial_users.full_name from vicidial_live_agents,vicidial_users where vicidial_live_agents.user=vicidial_users.user and campaign_id='" . mysql_real_escape_string($group) . "' order by $orderSQL;"; + +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + $agentcount=0; + while ($i < $talking_to_print) + { + $row=mysql_fetch_row($rslt); + if (eregi("READY|PAUSED",$row[3])) + { + $row[5]=$row[6]; + } + if ($non_latin < 1) + { + $extension = eregi_replace('Local/',"",$row[0]); + $extension = sprintf("%-10s", $extension); + while(strlen($extension)>10) {$extension = substr("$extension", 0, -1);} + } + else + { + $extension = eregi_replace('Local/',"",$row[0]); + $extension = sprintf("%-40s", $extension); + while(mb_strlen($extension, 'utf-8')>10) {$extension = mb_substr("$extension", 0, -1,'utf8');} + } + $Luser = $row[1]; + $user = sprintf("%-18s", $row[1]); + $Lsessionid = $row[2]; + $sessionid = sprintf("%-9s", $row[2]); + $Lstatus = $row[3]; + $status = sprintf("%-6s", $row[3]); + $server_ip = sprintf("%-15s", $row[4]); + $call_server_ip = sprintf("%-15s", $row[7]); + $campaign_id = sprintf("%-10s", $row[8]); + $comments= $row[11]; + + if (eregi("INCALL",$Lstatus)) + { + if ( (eregi("AUTO",$comments)) or (strlen($comments)<1) ) + {$CM='A';} + else + { + if (eregi("INBOUND",$comments)) + {$CM='I';} + else + {$CM='M';} + } + } + else {$CM=' ';} + + if ($UGdisplay > 0) + { + if ($non_latin < 1) + { + $user_group = sprintf("%-12s", $row[9]); + while(strlen($user_group)>12) {$user_group = substr("$user_group", 0, -1);} + } + else + { + $user_group = sprintf("%-40s", $row[9]); + while(mb_strlen($user_group, 'utf-8')>12) {$user_group = mb_substr("$user_group", 0, -1,'utf8');} + } + } + if ($UidORname > 0) + { + if ($non_latin < 1) + { + $user = sprintf("%-18s", $row[10]); + while(strlen($user)>18) {$user = substr("$user", 0, -1);} + } + else + { + $user = sprintf("%-40s", $row[10]); + while(mb_strlen($user, 'utf-8')>18) {$user = mb_substr("$user", 0, -1,'utf8');} + } + } + if (!eregi("INCALL|QUEUE",$row[3])) + {$call_time_S = ($STARTtime - $row[6]);} + else + {$call_time_S = ($STARTtime - $row[5]);} + + $call_time_M = ($call_time_S / 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"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + if ($Lstatus=='INCALL') + { + if ($call_time_S >= 10) {$G=''; $EG='';} + if ($call_time_M_int >= 1) {$G=''; $EG='';} + if ($call_time_M_int >= 5) {$G=''; $EG='';} + # if ($call_time_M_int >= 10) {$G=''; $EG='';} + } + if (eregi("PAUSED",$row[3])) + { + if ($call_time_M_int >= 30) + {$i++; continue;} + else + { + $agent_paused++; $agent_total++; + $G=''; $EG=''; + if ($call_time_S >= 10) {$G=''; $EG='';} + if ($call_time_M_int >= 1) {$G=''; $EG='';} + if ($call_time_M_int >= 5) {$G=''; $EG='';} + } + } +# if ( (strlen($row[7])> 4) and ($row[7] != "$row[4]") ) +# {$G=''; $EG='';} + + if ( (eregi("INCALL",$status)) or (eregi("QUEUE",$status)) ) {$agent_incall++; $agent_total++;} + if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) {$agent_ready++; $agent_total++;} + if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) + { + $G=''; $EG=''; + if ($call_time_M_int >= 1) {$G=''; $EG='';} + if ($call_time_M_int >= 5) {$G=''; $EG='';} + } + + $L=''; + $R=''; + if ($SIPmonitorLINK>0) {$L=" LISTEN"; $R='';} + if ($IAXmonitorLINK>0) {$L=" LISTEN"; $R='';} + if ($SIPmonitorLINK>1) {$R=" | BARGE";} + if ($IAXmonitorLINK>1) {$R=" | BARGE";} + + if ($UGdisplay > 0) {$UGD = " $G$user_group$EG |";} + else {$UGD = "";} + + if ($SERVdisplay > 0) {$SVD = "$G$server_ip$EG | $G$call_server_ip$EG | ";} + else {$SVD = "";} + + $agentcount++; + + $Aecho .= "| $G$extension$EG | $G$user$EG |$UGD $G$sessionid$EG$L$R | $G$status$EG $CM | $SVD$G$call_time_MS$EG | $G$campaign_id$EG |\n"; + + $i++; + } + + $Aecho .= "$Aline"; + $Aecho .= " $agentcount agents logged in on all servers\n"; + $Aecho .= " System Load Average: $load_ave\n\n"; + + # $Aecho .= " - Balanced call\n"; + $Aecho .= " - Agent waiting for call\n"; + $Aecho .= " - Agent waiting for call > 1 minute\n"; + $Aecho .= " - Agent waiting for call > 5 minutes\n"; + $Aecho .= " - Agent on call > 10 seconds\n"; + $Aecho .= " - Agent on call > 1 minute\n"; + $Aecho .= " - Agent on call > 5 minutes\n"; + $Aecho .= " - Agent Paused > 10 seconds\n"; + $Aecho .= " - Agent Paused > 1 minute\n"; + $Aecho .= " - Agent Paused > 5 minutes\n"; + + if ($agent_ready > 0) {$B=''; $BG='';} + if ($agent_ready > 4) {$B=''; $BG='';} + if ($agent_ready > 9) {$B=''; $BG='';} + if ($agent_ready > 14) {$B=''; $BG='';} + + + echo "\n
\n"; + + echo "$NFB$agent_total$NFE agents logged in         \n"; + echo "$NFB$agent_incall$NFE agents in calls       \n"; + echo "$NFB$B  $agent_ready $BG$NFE agents waiting       \n"; + echo "$NFB$agent_paused$NFE paused agents       \n"; + + echo "
";
+		echo "";
+		echo "$Aecho";
+	}
+	else
+	{
+	echo "KEINE MITTEL BEI DEN ANRUFEN\n";
+	}
+
+?>
+
+ + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_timeonVDADallSUMMARY.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_timeonVDADallSUMMARY.php new file mode 100644 index 00000000..44368875 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_timeonVDADallSUMMARY.php @@ -0,0 +1,442 @@ + LICENSE: GPLv2 +# +# Summary for all campaigns live real-time stats for the VICIDIAL Auto-Dialer all servers +# +# STOP=4000, SLOW=40, GO=4 seconds refresh interval +# +# changes: +# 61102-1616 - first build +# 61215-1131 - added answered calls and drop percent taken from answered calls +# 70111-1600 - added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70619-1339 - Added Status Category tally display +# 71029-1900 - Changed CLOSER-type to not require campaign_id restriction +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["RR"])) {$RR=$_GET["RR"];} + elseif (isset($_POST["RR"])) {$RR=$_POST["RR"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["adastats"])) {$adastats=$_GET["adastats"];} + elseif (isset($_POST["adastats"])) {$adastats=$_POST["adastats"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +if (!isset($RR)) {$gRRroup=4;} + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Unzulässiges Username/Kennwort:|$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); + +$stmt="select campaign_id from vicidial_campaigns where active='Y';"; +$rslt=mysql_query($stmt, $link); +if (!isset($DB)) {$DB=0;} +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + +if (!isset($RR)) {$RR=4;} + +?> + + + + + +\n"; +echo "VICIDIAL: Realtime All Kampagnen Summary\n"; +echo "VICIDIAL: Realtime All Kampagnen Summary           \n"; +echo "STOP | "; +echo "SLOW | "; +echo "GO "; +echo "       \n"; +if ($adastats<2) + { + echo "+ VIEW MORE SETTINGS"; + } +else + { + echo "- VIEW LESS SETTINGS"; + } +echo "       REPORTS"; +echo "

\n\n"; + +$k=0; +while($k<$groups_to_print) +{ +$NFB = ''; +$NFE = ''; +$F=''; $FG=''; $B=''; $BG=''; + +$group = $groups[$k]; +echo "$group   -   "; +echo "Modify\n"; + + +$stmt = "select count(*) from vicidial_campaigns where campaign_id='$group' and campaign_allow_inbound='Y';"; +$rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $campaign_allow_inbound = $row[0]; + +$stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$DIALlev = $row[0]; +$DIALstatusA = $row[1]; +$DIALstatusB = $row[2]; +$DIALstatusC = $row[3]; +$DIALstatusD = $row[4]; +$DIALstatusE = $row[5]; +$DIALorder = $row[6]; +$DIALfilter = $row[7]; +$HOPlev = $row[8]; +$DIALmethod = $row[9]; +$maxDIALlev = $row[10]; +$DROPmax = $row[11]; +$targetDIFF = $row[12]; +$ADAintense = $row[13]; +$ADAavailonly = $row[14]; +$TAPERtime = $row[15]; +$CALLtime = $row[16]; +$DIALtimeout = $row[17]; +$DIALstatuses = $row[18]; + $DIALstatuses = (preg_replace("/ -$|^ /","",$DIALstatuses)); + $DIALstatuses = (ereg_replace(' ',', ',$DIALstatuses)); + +$stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$VDhop = $row[0]; + +$stmt="select dialable_leads,calls_today,drops_today,drops_answers_today_pct,differential_onemin,agents_average_onemin,balance_trunk_fill,answers_today,status_category_1,status_category_count_1,status_category_2,status_category_count_2,status_category_3,status_category_count_3,status_category_4,status_category_count_4 from vicidial_campaign_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$DAleads = $row[0]; +$callsTODAY = $row[1]; +$dropsTODAY = $row[2]; +$drpctTODAY = $row[3]; +$diffONEMIN = $row[4]; +$agentsONEMIN = $row[5]; +$balanceFILL = $row[6]; +$answersTODAY = $row[7]; +$VSCcat1 = $row[8]; +$VSCcat1tally = $row[9]; +$VSCcat2 = $row[10]; +$VSCcat2tally = $row[11]; +$VSCcat3 = $row[12]; +$VSCcat3tally = $row[13]; +$VSCcat4 = $row[14]; +$VSCcat4tally = $row[15]; + +if ( ($diffONEMIN != 0) and ($agentsONEMIN > 0) ) + { + $diffpctONEMIN = ( ($diffONEMIN / $agentsONEMIN) * 100); + $diffpctONEMIN = sprintf("%01.2f", $diffpctONEMIN); + } +else {$diffpctONEMIN = '0.00';} + +$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$balanceSHORT = $row[0]; + +echo "
"; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +if ($adastats>1) + { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo "
DIAL LEVEL:  $DIALlev    TRUNK SHORT/FILL:  $balanceSHORT / $balanceFILL     FILTER:  $DIALfilter   TIME:   $NOW_TIME
  MAX LEVEL:  $maxDIALlev   DROPPED MAX:  $DROPmax%    TARGET DIFF:  $targetDIFF     INTENSITY:  $ADAintense    
DIAL TIMEOUT:  $DIALtimeout  TAPER TIME:  $TAPERtime  LOCAL TIME:  $CALLtime  AVAIL ONLY:  $ADAavailonly  
DIALABLE LEADS:  $DAleads     CALLS TODAY:  $callsTODAY     AVG AGENTS:  $agentsONEMIN     DIAL METHOD:  $DIALmethod    
HOPPER LEVEL:  $HOPlev     DROPPED / ANSWERED:  $dropsTODAY / $answersTODAY   DL DIFF:  $diffONEMIN     STATUSES:  $DIALstatuses    
LEADS IN HOPPER:  $VDhop     DROPPED PERCENT:  "; +if ($drpctTODAY >= $DROPmax) + {echo "$drpctTODAY%";} +else + {echo "$drpctTODAY%";} +echo "    DIFF:  $diffpctONEMIN%     ORDER:  $DIALorder    
"; +if ( (!eregi('NULL',$VSCcat1)) and (strlen($VSCcat1)>0) ) + {echo "$VSCcat1:   $VSCcat1tally       \n";} +if ( (!eregi('NULL',$VSCcat2)) and (strlen($VSCcat2)>0) ) + {echo "$VSCcat2:   $VSCcat2tally       \n";} +if ( (!eregi('NULL',$VSCcat3)) and (strlen($VSCcat3)>0) ) + {echo "$VSCcat3:   $VSCcat3tally       \n";} +if ( (!eregi('NULL',$VSCcat4)) and (strlen($VSCcat4)>0) ) + {echo "$VSCcat4:   $VSCcat4tally       \n";} +echo "
"; + +### Header finish + + + + + +################################################################################ +### START calculating calls/agents +################################################################################ + +################################################################################ +###### OUTBOUND CALLS +################################################################################ +if ($campaign_allow_inbound > 0) + { + $stmt="select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = preg_replace("/^ | -$/","",$row[0]); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaigns = "'$closer_campaigns'"; + + $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') and ( (call_type='IN' and campaign_id IN($closer_campaigns)) or (campaign_id='" . mysql_real_escape_string($group) . "' and call_type='OUT') );"; + } +else + { + if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';} + else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";} + + $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') $groupSQL;"; + } +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$parked_to_print = mysql_num_rows($rslt); + if ($parked_to_print > 0) + { + $i=0; + $out_total=0; + $out_ring=0; + $out_live=0; + while ($i < $parked_to_print) + { + $row=mysql_fetch_row($rslt); + + if (eregi("LIVE",$row[0])) + {$out_live++;} + else + { + if (eregi("CLOSER",$row[0])) + {$nothing=1;} + else + {$out_ring++;} + } + $out_total++; + $i++; + } + + if ($out_live > 0) {$F=''; $FG='';} + if ($out_live > 4) {$F=''; $FG='';} + if ($out_live > 9) {$F=''; $FG='';} + if ($out_live > 14) {$F=''; $FG='';} + + if ($campaign_allow_inbound > 0) + {echo "$NFB$out_total$NFE current active calls      \n";} + else + {echo "$NFB$out_total$NFE calls being placed       \n";} + + echo "$NFB$out_ring$NFE calls ringing         \n"; + echo "$NFB$F  $out_live $FG$NFE calls waiting for agents       \n"; + } + else + { + echo "KEIN PHASENCANKLOPFEN\n"; + } + + +################################################################################### +###### TIME ON SYSTEM +################################################################################### + +$agent_incall=0; +$agent_ready=0; +$agent_paused=0; +$agent_total=0; + +$stmt="select extension,user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id from vicidial_live_agents where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + $agentcount=0; + while ($i < $talking_to_print) + { + $row=mysql_fetch_row($rslt); + if (eregi("READY|PAUSED",$row[3])) + { + $row[5]=$row[6]; + } + $Lstatus = $row[3]; + $status = sprintf("%-6s", $row[3]); + if (!eregi("INCALL|QUEUE",$row[3])) + {$call_time_S = ($STARTtime - $row[6]);} + else + {$call_time_S = ($STARTtime - $row[5]);} + + $call_time_M = ($call_time_S / 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"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + if (eregi("PAUSED",$row[3])) + { + if ($call_time_M_int >= 30) + {$i++; continue;} + else + { + $agent_paused++; $agent_total++; + } + } + + if ( (eregi("INCALL",$status)) or (eregi("QUEUE",$status)) ) {$agent_incall++; $agent_total++;} + if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) {$agent_ready++; $agent_total++;} + $agentcount++; + + + $i++; + } + + if ($agent_ready > 0) {$B=''; $BG='';} + if ($agent_ready > 4) {$B=''; $BG='';} + if ($agent_ready > 9) {$B=''; $BG='';} + if ($agent_ready > 14) {$B=''; $BG='';} + + echo "\n
\n"; + + echo "$NFB$agent_total$NFE agents logged in         \n"; + echo "$NFB$agent_incall$NFE agents in calls       \n"; + echo "$NFB$B  $agent_ready $BG$NFE agents waiting       \n"; + echo "$NFB$agent_paused$NFE paused agents       \n"; + + echo "
";
+		echo "";
+	}
+	else
+	{
+	echo " NO AGENTS ON CALLS
\n"; + } + +################################################################################ +### END calculating calls/agents +################################################################################ + + + + + +echo "
"; + +echo "\n\n"; +$k++; +} + +?> +
+ + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_timeoncall.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_timeoncall.php new file mode 100644 index 00000000..4227f836 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_timeoncall.php @@ -0,0 +1,180 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["reset_counter"])) {$reset_counter=$_GET["reset_counter"];} + elseif (isset($_POST["reset_counter"])) {$reset_counter=$_POST["reset_counter"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); + +?> + + + + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On Call\n"; +echo "
\n\n";
+
+echo "VICIDIAL: Time On Call                                          $NOW_TIME\n\n";
+echo "+------------+-----------+-----------+------------------+---------------------+---------+\n";
+echo "| STATION    | SESSIONID | CHANNEL   | NUMBER DIALED    | START TIME          | MINUTES |\n";
+echo "+------------+-----------+-----------+------------------+---------------------+---------+\n";
+
+$stmt="SELECT count(*) from live_sip_channels where server_ip='$server_ip';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$parked_count = $row[0];
+	if ($parked_count > 0)
+	{
+	$stmt="select extension from live_channels where server_ip='$server_ip';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$ext_to_print = mysql_num_rows($rslt);
+	$i=0;
+	$live_zap_counter=0;
+	$sessions = '';
+	while ($i < $ext_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if (preg_match("/^8600/i",$row[0]))
+			{
+			$sessions .= "$row[0]|";
+			}
+		$i++;
+		}
+	$sessions = preg_replace("/\|$/",'',$sessions);
+
+	if ($DB) {echo "SESSIONS: -$sessions-\n";}
+
+	$stmt="select * from live_sip_channels where server_ip='$server_ip' order by channel;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$parked_to_print = mysql_num_rows($rslt);
+	$i=0;
+	$live_calls_counter=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if ( (preg_match("/Zap\/|internal|ring/i",$row[3])) or (preg_match("/Local\//i",$row[0])) )
+			{
+			if ($DB) {echo "NOT STATION |$row[0]|$row[3]|\n";}
+			$session_id = '';
+			}
+		else 
+			{
+			if (preg_match("/$row[3]/i",$sessions))
+				{
+				if ($DB) {echo "LIVE STATION|$row[0]|$row[3]|\n";}
+				$session_id = $row[3];
+				$station = preg_replace("/SIP\//",'',$row[0]);
+				$station = preg_replace("/-.*/",'',$station);
+			
+				$LIVE_sessions[$live_calls_counter] =			"$session_id";
+				$LIVE_sessions_FORMAT[$live_calls_counter] =	sprintf("%-9s", $session_id);
+				$LIVE_stations[$live_calls_counter] =			"$station";
+				$LIVE_stations_FORMAT[$live_calls_counter] =	sprintf("%-10s", $station);
+
+		#		echo "| $station | $session_id | \n";
+
+				$live_calls_counter++;
+				}
+			else
+				{
+				if ($DB) {echo "NOT STATIONZ|$row[0]|$row[3]|\n";}
+				$session_id = '';
+				}
+			}
+
+		$i++;
+		}
+
+		if ($live_calls_counter > 0)
+		{
+		$i=0;
+		$LC_counter = $live_calls_counter;
+
+		while ($i < $live_calls_counter)
+			{
+			$stmt="select channel,extension,number_dialed,start_time,start_epoch from call_log where extension='$LIVE_stations[$i]' and server_ip='$server_ip' order by uniqueid desc LIMIT 1;";
+			$rslt=mysql_query($stmt, $link);
+			if ($DB) {echo "$stmt\n";}
+			$parked_to_print = mysql_num_rows($rslt);
+			$row=mysql_fetch_row($rslt);
+
+			$channel =			sprintf("%-9s", $row[0]);
+			$number_dialed =	sprintf("%-16s", $row[2]);
+			$start_time =		sprintf("%-19s", $row[3]);
+			$call_time_S = ($STARTtime - $row[4]);
+
+			$call_time_M = ($call_time_S / 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";
+			$call_time_MS =		sprintf("%7s", $call_time_MS);
+			$G = '';		$EG = '';
+			if ($call_time_M_int >= 12) {$G=''; $EG='';}
+			if ($call_time_M_int >= 31) {$G=''; $EG='';}
+
+			echo "| $G$LIVE_stations_FORMAT[$i]$EG | $G$LIVE_sessions_FORMAT[$i]$EG | $G$channel$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+			$i++;
+			}
+
+		echo "+------------+-----------+-----------+------------------+---------------------+---------+\n";
+		echo "  $i stations on live calls on server $server_ip\n\n";
+
+		echo "             - 12 minutes or more on live call\n";
+		echo "             - Over 30 minutes on live call\n";
+
+		}
+		else
+		{
+		echo "*****************************************************************************************\n";
+		echo "*****************************************************************************************\n";
+		echo "*************************************** NO LIVE STATIONS ********************************\n";
+		echo "*****************************************************************************************\n";
+		echo "*****************************************************************************************\n";
+		}
+
+	}
+	else
+	{
+	echo "*****************************************************************************************\n";
+	echo "*****************************************************************************************\n";
+	echo "*************************************** NO LIVE STATIONS ********************************\n";
+	echo "*****************************************************************************************\n";
+	echo "*****************************************************************************************\n";
+	}
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_timeonpark.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_timeonpark.php new file mode 100644 index 00000000..91ba6e0f --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/AST_timeonpark.php @@ -0,0 +1,219 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60620-1042 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["reset_counter"])) {$reset_counter=$_GET["reset_counter"];} + elseif (isset($_POST["reset_counter"])) {$reset_counter=$_POST["reset_counter"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Unzulässiges Username/Kennwort:|$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +$timeONEhoursAGO = ($STARTtime - 3600); +$epochHALFhoursAGO = ($STARTtime - 1860); +$timeONEhoursAGO = date("Y-m-d H:i:s",$timeONEhoursAGO); +$timeHALFhoursAGO = date("Y-m-d H:i:s",$epochHALFhoursAGO); + +$reset_counter++; + +if ($reset_counter > 7) + { + $reset_counter=0; + + $stmt="update park_log set status='HUNGUP' where hangup_time is not null;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + + if ($DB) + { + $stmt="delete from park_log where status='TALKING' and grab_time < '$timeONEhoursAGO' and (hangup_time is null or hangup_time='');"; + $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + + $stmt="delete from park_log where status='PARKED' and parked_time < '$timeHALFhoursAGO' and (hangup_time is null or hangup_time='');"; + $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + + } + } + +?> + + + + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On Park\n"; +echo "
\n\n";
+
+echo "VICIDIAL: Time On Park         $NOW_TIME    REPORTS\n\n";
+echo "+------------+-----------------+---------------------+---------+\n";
+echo "| CHANNEL    | GROUP           | START TIME          | MINUTES |\n";
+echo "+------------+-----------------+---------------------+---------+\n";
+
+#$link=mysql_connect("localhost", "cron", "1234");
+# $linkX=mysql_connect("localhost", "cron", "1234");
+#mysql_select_db("asterisk");
+
+$stmt="select extension,user,channel,channel_group,parked_time,UNIX_TIMESTAMP(parked_time) from park_log where status ='PARKED' and server_ip='" . mysql_real_escape_string($server_ip) . "' order by uniqueid;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$parked_to_print = mysql_num_rows($rslt);
+	if ($parked_to_print > 0)
+	{
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$channel =			sprintf("%-10s", $row[2]);
+		$number_dialed =	sprintf("%-15s", $row[3]);
+		$start_time =		sprintf("%-19s", $row[4]);
+		$call_time_S = ($STARTtime - $row[5]);
+
+		$call_time_M = ($call_time_S / 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";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if ($call_time_M_int >= 1) {$G=''; $EG='';}
+		if ($call_time_M_int >= 6) {$G=''; $EG='';}
+
+		echo "| $G$channel$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------+-----------------+---------------------+---------+\n";
+		echo "  $i callers waiting on server $server_ip\n\n";
+
+		echo "             - 1 minute or more on hold\n";
+		echo "             - Over 5 minutes on hold\n";
+
+		}
+	else
+	{
+	echo "****************************************************************\n";
+	echo "****************************************************************\n";
+	echo "********************KEIN PHASENCANKLOPFEN*********************\n";
+	echo "****************************************************************\n";
+	echo "****************************************************************\n";
+	}
+
+###################################################################################
+###### TIME ON INBOUND CALLS
+###################################################################################
+echo "\n\n";
+echo "----------------------------------------------------------------------------------------";
+echo "\n\n";
+echo "VICIDIAL: Agents Time On Inbound Calls                             $NOW_TIME\n\n";
+echo "+------------|--------+------------+-----------------+---------------------+---------+\n";
+echo "| STATION    | USER   | CHANNEL    | GROUP           | START TIME          | MINUTES |\n";
+echo "+------------|--------+------------+-----------------+---------------------+---------+\n";
+
+
+$stmt="select extension,user,channel,channel_group,grab_time,UNIX_TIMESTAMP(grab_time) from park_log where status ='TALKING' and server_ip='" . mysql_real_escape_string($server_ip) . "' order by uniqueid;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$talking_to_print = mysql_num_rows($rslt);
+	if ($talking_to_print > 0)
+	{
+	$i=0;
+	while ($i < $talking_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$extension =		sprintf("%-10s", $row[0]);
+		$user =				sprintf("%-6s", $row[1]);
+		$channel =			sprintf("%-10s", $row[2]);
+		$number_dialed =	sprintf("%-15s", $row[3]);
+		$start_time =		sprintf("%-19s", $row[4]);
+		$call_time_S = ($STARTtime - $row[5]);
+
+		$call_time_M = ($call_time_S / 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";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if ($call_time_M_int >= 12) {$G=''; $EG='';}
+		if ($call_time_M_int >= 31) {$G=''; $EG='';}
+
+		echo "| $G$extension$EG | $G$user$EG | $G$channel$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------|--------+------------+-----------------+---------------------+---------+\n";
+		echo "  $i agents on calls on server $server_ip\n\n";
+
+		echo "             - 12 minutes or more on call\n";
+		echo "             - Over 30 minutes on call\n";
+
+	}
+	else
+	{
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	echo "*********************************KEINE MITTEL BEI DEN ANRUFEN*********************************\n";
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	}
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/admin.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/admin.php new file mode 100644 index 00000000..b4f3166a --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/admin.php @@ -0,0 +1,13575 @@ + LICENSE: GPLv2 +# + + +require("dbconnect.php"); + + +###################################################################################################### +###################################################################################################### +####### static variable settings for display options +###################################################################################################### +###################################################################################################### + +$page_width='770'; +$section_width='720'; +$header_font_size='3'; +$subheader_font_size='2'; +$subcamp_font_size='2'; +$header_selected_bold=''; +$header_nonselected_bold=''; +$users_color = '#FFFF99'; +$campaigns_color = '#FFCC99'; +$lists_color = '#FFCCCC'; +$ingroups_color = '#CC99FF'; +$remoteagent_color ='#CCFFCC'; +$usergroups_color = '#CCFFFF'; +$scripts_color = '#99FFCC'; +$filters_color = '#CCCCCC'; +$admin_color = '#FF99FF'; +$reports_color = '#99FF33'; +#$users_color = '#FFFF99'; +#$campaigns_color = '#FFFF99'; +#$lists_color = '#FFFF99'; +#$ingroups_color = '#FFFF99'; +#$remoteagent_color ='#FFFF99'; +#$usergroups_color = '#FFFF99'; +#$scripts_color = '#FFFF99'; +#$filters_color = '#FFFF99'; +#$admin_color = '#FFFF99'; +#$reports_color = '#FFFF99'; + $times_color = '#FF33FF'; + $phones_color = '#FF33FF'; + $conference_color = '#FF33FF'; + $server_color = '#FF33FF'; + $settings_color = '#FF33FF'; + $status_color = '#FF33FF'; +$users_font = 'BLACK'; +$campaigns_font = 'BLACK'; +$lists_font = 'BLACK'; +$ingroups_font = 'BLACK'; +$remoteagent_font = 'BLACK'; +$usergroups_font = 'BLACK'; +$scripts_font = 'BLACK'; +$filters_font = 'BLACK'; +$admin_font = 'BLACK'; +$reports_font = 'BLACK'; + $times_font = 'BLACK'; + $phones_font = 'BLACK'; + $conference_font = 'BLACK'; + $server_font = 'BLACK'; + $settings_font = 'BLACK'; + $status_font = 'BLACK'; +$subcamp_color = '#FF9933'; +$subcamp_font = 'BLACK'; + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; + +###################################################################################################### +###################################################################################################### +####### Form variable declaration +###################################################################################################### +###################################################################################################### + + +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["active"])) {$active=$_GET["active"];} + elseif (isset($_POST["active"])) {$active=$_POST["active"];} +if (isset($_GET["adaptive_dl_diff_target"])) {$adaptive_dl_diff_target=$_GET["adaptive_dl_diff_target"];} + elseif (isset($_POST["adaptive_dl_diff_target"])) {$adaptive_dl_diff_target=$_POST["adaptive_dl_diff_target"];} +if (isset($_GET["adaptive_dropped_percentage"])) {$adaptive_dropped_percentage=$_GET["adaptive_dropped_percentage"];} + elseif (isset($_POST["adaptive_dropped_percentage"])){$adaptive_dropped_percentage=$_POST["adaptive_dropped_percentage"];} +if (isset($_GET["adaptive_intensity"])) {$adaptive_intensity=$_GET["adaptive_intensity"];} + elseif (isset($_POST["adaptive_intensity"])) {$adaptive_intensity=$_POST["adaptive_intensity"];} +if (isset($_GET["adaptive_latest_server_time"])) {$adaptive_latest_server_time=$_GET["adaptive_latest_server_time"];} + elseif (isset($_POST["adaptive_latest_server_time"])){$adaptive_latest_server_time=$_POST["adaptive_latest_server_time"];} +if (isset($_GET["adaptive_maximum_level"])) {$adaptive_maximum_level=$_GET["adaptive_maximum_level"];} + elseif (isset($_POST["adaptive_maximum_level"])) {$adaptive_maximum_level=$_POST["adaptive_maximum_level"];} +if (isset($_GET["SUB"])) {$SUB=$_GET["SUB"];} + elseif (isset($_POST["SUB"])) {$SUB=$_POST["SUB"];} +if (isset($_GET["ADD"])) {$ADD=$_GET["ADD"];} + elseif (isset($_POST["ADD"])) {$ADD=$_POST["ADD"];} +if (isset($_GET["admin_hangup_enabled"])) {$admin_hangup_enabled=$_GET["admin_hangup_enabled"];} + elseif (isset($_POST["admin_hangup_enabled"])) {$admin_hangup_enabled=$_POST["admin_hangup_enabled"];} +if (isset($_GET["admin_hijack_enabled"])) {$admin_hijack_enabled=$_GET["admin_hijack_enabled"];} + elseif (isset($_POST["admin_hijack_enabled"])) {$admin_hijack_enabled=$_POST["admin_hijack_enabled"];} +if (isset($_GET["admin_monitor_enabled"])) {$admin_monitor_enabled=$_GET["admin_monitor_enabled"];} + elseif (isset($_POST["admin_monitor_enabled"])) {$admin_monitor_enabled=$_POST["admin_monitor_enabled"];} +if (isset($_GET["AFLogging_enabled"])) {$AFLogging_enabled=$_GET["AFLogging_enabled"];} + elseif (isset($_POST["AFLogging_enabled"])) {$AFLogging_enabled=$_POST["AFLogging_enabled"];} +if (isset($_GET["agent_choose_ingroups"])) {$agent_choose_ingroups=$_GET["agent_choose_ingroups"];} + elseif (isset($_POST["agent_choose_ingroups"])) {$agent_choose_ingroups=$_POST["agent_choose_ingroups"];} +if (isset($_GET["agentcall_manual"])) {$agentcall_manual=$_GET["agentcall_manual"];} + elseif (isset($_POST["agentcall_manual"])) {$agentcall_manual=$_POST["agentcall_manual"];} +if (isset($_GET["agentonly_callbacks"])) {$agentonly_callbacks=$_GET["agentonly_callbacks"];} + elseif (isset($_POST["agentonly_callbacks"])) {$agentonly_callbacks=$_POST["agentonly_callbacks"];} +if (isset($_GET["AGI_call_logging_enabled"])) {$AGI_call_logging_enabled=$_GET["AGI_call_logging_enabled"];} + elseif (isset($_POST["AGI_call_logging_enabled"])) {$AGI_call_logging_enabled=$_POST["AGI_call_logging_enabled"];} +if (isset($_GET["agi_output"])) {$agi_output=$_GET["agi_output"];} + elseif (isset($_POST["agi_output"])) {$agi_output=$_POST["agi_output"];} +if (isset($_GET["allcalls_delay"])) {$allcalls_delay=$_GET["allcalls_delay"];} + elseif (isset($_POST["allcalls_delay"])) {$allcalls_delay=$_POST["allcalls_delay"];} +if (isset($_GET["allow_closers"])) {$allow_closers=$_GET["allow_closers"];} + elseif (isset($_POST["allow_closers"])) {$allow_closers=$_POST["allow_closers"];} +if (isset($_GET["alt_number_dialing"])) {$alt_number_dialing=$_GET["alt_number_dialing"];} + elseif (isset($_POST["alt_number_dialing"])) {$alt_number_dialing=$_POST["alt_number_dialing"];} +if (isset($_GET["alter_agent_interface_options"])) {$alter_agent_interface_options=$_GET["alter_agent_interface_options"];} + elseif (isset($_POST["alter_agent_interface_options"])) {$alter_agent_interface_options=$_POST["alter_agent_interface_options"];} +if (isset($_GET["am_message_exten"])) {$am_message_exten=$_GET["am_message_exten"];} + elseif (isset($_POST["am_message_exten"])) {$am_message_exten=$_POST["am_message_exten"];} +if (isset($_GET["amd_send_to_vmx"])) {$amd_send_to_vmx=$_GET["amd_send_to_vmx"];} + elseif (isset($_POST["amd_send_to_vmx"])) {$amd_send_to_vmx=$_POST["amd_send_to_vmx"];} +if (isset($_GET["answer_transfer_agent"])) {$answer_transfer_agent=$_GET["answer_transfer_agent"];} + elseif (isset($_POST["answer_transfer_agent"])) {$answer_transfer_agent=$_POST["answer_transfer_agent"];} +if (isset($_GET["ast_admin_access"])) {$ast_admin_access=$_GET["ast_admin_access"];} + elseif (isset($_POST["ast_admin_access"])) {$ast_admin_access=$_POST["ast_admin_access"];} +if (isset($_GET["ast_delete_phones"])) {$ast_delete_phones=$_GET["ast_delete_phones"];} + elseif (isset($_POST["ast_delete_phones"])) {$ast_delete_phones=$_POST["ast_delete_phones"];} +if (isset($_GET["asterisk_version"])) {$asterisk_version=$_GET["asterisk_version"];} + elseif (isset($_POST["asterisk_version"])) {$asterisk_version=$_POST["asterisk_version"];} +if (isset($_GET["ASTmgrSECRET"])) {$ASTmgrSECRET=$_GET["ASTmgrSECRET"];} + elseif (isset($_POST["ASTmgrSECRET"])) {$ASTmgrSECRET=$_POST["ASTmgrSECRET"];} +if (isset($_GET["ASTmgrUSERNAME"])) {$ASTmgrUSERNAME=$_GET["ASTmgrUSERNAME"];} + elseif (isset($_POST["ASTmgrUSERNAME"])) {$ASTmgrUSERNAME=$_POST["ASTmgrUSERNAME"];} +if (isset($_GET["ASTmgrUSERNAMElisten"])) {$ASTmgrUSERNAMElisten=$_GET["ASTmgrUSERNAMElisten"];} + elseif (isset($_POST["ASTmgrUSERNAMElisten"])) {$ASTmgrUSERNAMElisten=$_POST["ASTmgrUSERNAMElisten"];} +if (isset($_GET["ASTmgrUSERNAMEsend"])) {$ASTmgrUSERNAMEsend=$_GET["ASTmgrUSERNAMEsend"];} + elseif (isset($_POST["ASTmgrUSERNAMEsend"])) {$ASTmgrUSERNAMEsend=$_POST["ASTmgrUSERNAMEsend"];} +if (isset($_GET["ASTmgrUSERNAMEupdate"])) {$ASTmgrUSERNAMEupdate=$_GET["ASTmgrUSERNAMEupdate"];} + elseif (isset($_POST["ASTmgrUSERNAMEupdate"])) {$ASTmgrUSERNAMEupdate=$_POST["ASTmgrUSERNAMEupdate"];} +if (isset($_GET["attempt_delay"])) {$attempt_delay=$_GET["attempt_delay"];} + elseif (isset($_POST["attempt_delay"])) {$attempt_delay=$_POST["attempt_delay"];} +if (isset($_GET["attempt_maximum"])) {$attempt_maximum=$_GET["attempt_maximum"];} + elseif (isset($_POST["attempt_maximum"])) {$attempt_maximum=$_POST["attempt_maximum"];} +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["auto_dial_next_number"])) {$auto_dial_next_number=$_GET["auto_dial_next_number"];} + elseif (isset($_POST["auto_dial_next_number"])) {$auto_dial_next_number=$_POST["auto_dial_next_number"];} +if (isset($_GET["available_only_ratio_tally"])) {$available_only_ratio_tally=$_GET["available_only_ratio_tally"];} + elseif (isset($_POST["available_only_ratio_tally"])){$available_only_ratio_tally=$_POST["available_only_ratio_tally"];} +if (isset($_GET["call_out_number_group"])) {$call_out_number_group=$_GET["call_out_number_group"];} + elseif (isset($_POST["call_out_number_group"])) {$call_out_number_group=$_POST["call_out_number_group"];} +if (isset($_GET["call_parking_enabled"])) {$call_parking_enabled=$_GET["call_parking_enabled"];} + elseif (isset($_POST["call_parking_enabled"])) {$call_parking_enabled=$_POST["call_parking_enabled"];} +if (isset($_GET["call_time_comments"])) {$call_time_comments=$_GET["call_time_comments"];} + elseif (isset($_POST["call_time_comments"])) {$call_time_comments=$_POST["call_time_comments"];} +if (isset($_GET["call_time_id"])) {$call_time_id=$_GET["call_time_id"];} + elseif (isset($_POST["call_time_id"])) {$call_time_id=$_POST["call_time_id"];} +if (isset($_GET["call_time_name"])) {$call_time_name=$_GET["call_time_name"];} + elseif (isset($_POST["call_time_name"])) {$call_time_name=$_POST["call_time_name"];} +if (isset($_GET["CallerID_popup_enabled"])) {$CallerID_popup_enabled=$_GET["CallerID_popup_enabled"];} + elseif (isset($_POST["CallerID_popup_enabled"])) {$CallerID_popup_enabled=$_POST["CallerID_popup_enabled"];} +if (isset($_GET["campaign_cid"])) {$campaign_cid=$_GET["campaign_cid"];} + elseif (isset($_POST["campaign_cid"])) {$campaign_cid=$_POST["campaign_cid"];} +if (isset($_GET["campaign_detail"])) {$campaign_detail=$_GET["campaign_detail"];} + elseif (isset($_POST["campaign_detail"])) {$campaign_detail=$_POST["campaign_detail"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["campaign_name"])) {$campaign_name=$_GET["campaign_name"];} + elseif (isset($_POST["campaign_name"])) {$campaign_name=$_POST["campaign_name"];} +if (isset($_GET["campaign_rec_exten"])) {$campaign_rec_exten=$_GET["campaign_rec_exten"];} + elseif (isset($_POST["campaign_rec_exten"])) {$campaign_rec_exten=$_POST["campaign_rec_exten"];} +if (isset($_GET["campaign_rec_filename"])) {$campaign_rec_filename=$_GET["campaign_rec_filename"];} + elseif (isset($_POST["campaign_rec_filename"])) {$campaign_rec_filename=$_POST["campaign_rec_filename"];} +if (isset($_GET["campaign_recording"])) {$campaign_recording=$_GET["campaign_recording"];} + elseif (isset($_POST["campaign_recording"])) {$campaign_recording=$_POST["campaign_recording"];} +if (isset($_GET["campaign_vdad_exten"])) {$campaign_vdad_exten=$_GET["campaign_vdad_exten"];} + elseif (isset($_POST["campaign_vdad_exten"])) {$campaign_vdad_exten=$_POST["campaign_vdad_exten"];} +if (isset($_GET["change_agent_campaign"])) {$change_agent_campaign=$_GET["change_agent_campaign"];} + elseif (isset($_POST["change_agent_campaign"])) {$change_agent_campaign=$_POST["change_agent_campaign"];} +if (isset($_GET["client_browser"])) {$client_browser=$_GET["client_browser"];} + elseif (isset($_POST["client_browser"])) {$client_browser=$_POST["client_browser"];} +if (isset($_GET["closer_default_blended"])) {$closer_default_blended=$_GET["closer_default_blended"];} + elseif (isset($_POST["closer_default_blended"])) {$closer_default_blended=$_POST["closer_default_blended"];} +if (isset($_GET["company"])) {$company=$_GET["company"];} + elseif (isset($_POST["company"])) {$company=$_POST["company"];} +if (isset($_GET["computer_ip"])) {$computer_ip=$_GET["computer_ip"];} + elseif (isset($_POST["computer_ip"])) {$computer_ip=$_POST["computer_ip"];} +if (isset($_GET["conf_exten"])) {$conf_exten=$_GET["conf_exten"];} + elseif (isset($_POST["conf_exten"])) {$conf_exten=$_POST["conf_exten"];} +if (isset($_GET["conf_on_extension"])) {$conf_on_extension=$_GET["conf_on_extension"];} + elseif (isset($_POST["conf_on_extension"])) {$conf_on_extension=$_POST["conf_on_extension"];} +if (isset($_GET["conferencing_enabled"])) {$conferencing_enabled=$_GET["conferencing_enabled"];} + elseif (isset($_POST["conferencing_enabled"])) {$conferencing_enabled=$_POST["conferencing_enabled"];} +if (isset($_GET["CoNfIrM"])) {$CoNfIrM=$_GET["CoNfIrM"];} + elseif (isset($_POST["CoNfIrM"])) {$CoNfIrM=$_POST["CoNfIrM"];} +if (isset($_GET["ct_default_start"])) {$ct_default_start=$_GET["ct_default_start"];} + elseif (isset($_POST["ct_default_start"])) {$ct_default_start=$_POST["ct_default_start"];} +if (isset($_GET["ct_default_stop"])) {$ct_default_stop=$_GET["ct_default_stop"];} + elseif (isset($_POST["ct_default_stop"])) {$ct_default_stop=$_POST["ct_default_stop"];} +if (isset($_GET["ct_friday_start"])) {$ct_friday_start=$_GET["ct_friday_start"];} + elseif (isset($_POST["ct_friday_start"])) {$ct_friday_start=$_POST["ct_friday_start"];} +if (isset($_GET["ct_friday_stop"])) {$ct_friday_stop=$_GET["ct_friday_stop"];} + elseif (isset($_POST["ct_friday_stop"])) {$ct_friday_stop=$_POST["ct_friday_stop"];} +if (isset($_GET["ct_monday_start"])) {$ct_monday_start=$_GET["ct_monday_start"];} + elseif (isset($_POST["ct_monday_start"])) {$ct_monday_start=$_POST["ct_monday_start"];} +if (isset($_GET["ct_monday_stop"])) {$ct_monday_stop=$_GET["ct_monday_stop"];} + elseif (isset($_POST["ct_monday_stop"])) {$ct_monday_stop=$_POST["ct_monday_stop"];} +if (isset($_GET["ct_saturday_start"])) {$ct_saturday_start=$_GET["ct_saturday_start"];} + elseif (isset($_POST["ct_saturday_start"])) {$ct_saturday_start=$_POST["ct_saturday_start"];} +if (isset($_GET["ct_saturday_stop"])) {$ct_saturday_stop=$_GET["ct_saturday_stop"];} + elseif (isset($_POST["ct_saturday_stop"])) {$ct_saturday_stop=$_POST["ct_saturday_stop"];} +if (isset($_GET["ct_sunday_start"])) {$ct_sunday_start=$_GET["ct_sunday_start"];} + elseif (isset($_POST["ct_sunday_start"])) {$ct_sunday_start=$_POST["ct_sunday_start"];} +if (isset($_GET["ct_sunday_stop"])) {$ct_sunday_stop=$_GET["ct_sunday_stop"];} + elseif (isset($_POST["ct_sunday_stop"])) {$ct_sunday_stop=$_POST["ct_sunday_stop"];} +if (isset($_GET["ct_thursday_start"])) {$ct_thursday_start=$_GET["ct_thursday_start"];} + elseif (isset($_POST["ct_thursday_start"])) {$ct_thursday_start=$_POST["ct_thursday_start"];} +if (isset($_GET["ct_thursday_stop"])) {$ct_thursday_stop=$_GET["ct_thursday_stop"];} + elseif (isset($_POST["ct_thursday_stop"])) {$ct_thursday_stop=$_POST["ct_thursday_stop"];} +if (isset($_GET["ct_tuesday_start"])) {$ct_tuesday_start=$_GET["ct_tuesday_start"];} + elseif (isset($_POST["ct_tuesday_start"])) {$ct_tuesday_start=$_POST["ct_tuesday_start"];} +if (isset($_GET["ct_tuesday_stop"])) {$ct_tuesday_stop=$_GET["ct_tuesday_stop"];} + elseif (isset($_POST["ct_tuesday_stop"])) {$ct_tuesday_stop=$_POST["ct_tuesday_stop"];} +if (isset($_GET["ct_wednesday_start"])) {$ct_wednesday_start=$_GET["ct_wednesday_start"];} + elseif (isset($_POST["ct_wednesday_start"])) {$ct_wednesday_start=$_POST["ct_wednesday_start"];} +if (isset($_GET["ct_wednesday_stop"])) {$ct_wednesday_stop=$_GET["ct_wednesday_stop"];} + elseif (isset($_POST["ct_wednesday_stop"])) {$ct_wednesday_stop=$_POST["ct_wednesday_stop"];} +if (isset($_GET["DBX_database"])) {$DBX_database=$_GET["DBX_database"];} + elseif (isset($_POST["DBX_database"])) {$DBX_database=$_POST["DBX_database"];} +if (isset($_GET["DBX_pass"])) {$DBX_pass=$_GET["DBX_pass"];} + elseif (isset($_POST["DBX_pass"])) {$DBX_pass=$_POST["DBX_pass"];} +if (isset($_GET["DBX_port"])) {$DBX_port=$_GET["DBX_port"];} + elseif (isset($_POST["DBX_port"])) {$DBX_port=$_POST["DBX_port"];} +if (isset($_GET["DBX_server"])) {$DBX_server=$_GET["DBX_server"];} + elseif (isset($_POST["DBX_server"])) {$DBX_server=$_POST["DBX_server"];} +if (isset($_GET["DBX_user"])) {$DBX_user=$_GET["DBX_user"];} + elseif (isset($_POST["DBX_user"])) {$DBX_user=$_POST["DBX_user"];} +if (isset($_GET["DBY_database"])) {$DBY_database=$_GET["DBY_database"];} + elseif (isset($_POST["DBY_database"])) {$DBY_database=$_POST["DBY_database"];} +if (isset($_GET["DBY_pass"])) {$DBY_pass=$_GET["DBY_pass"];} + elseif (isset($_POST["DBY_pass"])) {$DBY_pass=$_POST["DBY_pass"];} +if (isset($_GET["DBY_port"])) {$DBY_port=$_GET["DBY_port"];} + elseif (isset($_POST["DBY_port"])) {$DBY_port=$_POST["DBY_port"];} +if (isset($_GET["DBY_server"])) {$DBY_server=$_GET["DBY_server"];} + elseif (isset($_POST["DBY_server"])) {$DBY_server=$_POST["DBY_server"];} +if (isset($_GET["DBY_user"])) {$DBY_user=$_GET["DBY_user"];} + elseif (isset($_POST["DBY_user"])) {$DBY_user=$_POST["DBY_user"];} +if (isset($_GET["delete_call_times"])) {$delete_call_times=$_GET["delete_call_times"];} + elseif (isset($_POST["delete_call_times"])) {$delete_call_times=$_POST["delete_call_times"];} +if (isset($_GET["delete_campaigns"])) {$delete_campaigns=$_GET["delete_campaigns"];} + elseif (isset($_POST["delete_campaigns"])) {$delete_campaigns=$_POST["delete_campaigns"];} +if (isset($_GET["delete_filters"])) {$delete_filters=$_GET["delete_filters"];} + elseif (isset($_POST["delete_filters"])) {$delete_filters=$_POST["delete_filters"];} +if (isset($_GET["delete_ingroups"])) {$delete_ingroups=$_GET["delete_ingroups"];} + elseif (isset($_POST["delete_ingroups"])) {$delete_ingroups=$_POST["delete_ingroups"];} +if (isset($_GET["delete_lists"])) {$delete_lists=$_GET["delete_lists"];} + elseif (isset($_POST["delete_lists"])) {$delete_lists=$_POST["delete_lists"];} +if (isset($_GET["delete_remote_agents"])) {$delete_remote_agents=$_GET["delete_remote_agents"];} + elseif (isset($_POST["delete_remote_agents"])) {$delete_remote_agents=$_POST["delete_remote_agents"];} +if (isset($_GET["delete_scripts"])) {$delete_scripts=$_GET["delete_scripts"];} + elseif (isset($_POST["delete_scripts"])) {$delete_scripts=$_POST["delete_scripts"];} +if (isset($_GET["delete_user_groups"])) {$delete_user_groups=$_GET["delete_user_groups"];} + elseif (isset($_POST["delete_user_groups"])) {$delete_user_groups=$_POST["delete_user_groups"];} +if (isset($_GET["delete_users"])) {$delete_users=$_GET["delete_users"];} + elseif (isset($_POST["delete_users"])) {$delete_users=$_POST["delete_users"];} +if (isset($_GET["dial_method"])) {$dial_method=$_GET["dial_method"];} + elseif (isset($_POST["dial_method"])) {$dial_method=$_POST["dial_method"];} +if (isset($_GET["dial_prefix"])) {$dial_prefix=$_GET["dial_prefix"];} + elseif (isset($_POST["dial_prefix"])) {$dial_prefix=$_POST["dial_prefix"];} +if (isset($_GET["dial_status_a"])) {$dial_status_a=$_GET["dial_status_a"];} + elseif (isset($_POST["dial_status_a"])) {$dial_status_a=$_POST["dial_status_a"];} +if (isset($_GET["dial_status_b"])) {$dial_status_b=$_GET["dial_status_b"];} + elseif (isset($_POST["dial_status_b"])) {$dial_status_b=$_POST["dial_status_b"];} +if (isset($_GET["dial_status_c"])) {$dial_status_c=$_GET["dial_status_c"];} + elseif (isset($_POST["dial_status_c"])) {$dial_status_c=$_POST["dial_status_c"];} +if (isset($_GET["dial_status_d"])) {$dial_status_d=$_GET["dial_status_d"];} + elseif (isset($_POST["dial_status_d"])) {$dial_status_d=$_POST["dial_status_d"];} +if (isset($_GET["dial_status_e"])) {$dial_status_e=$_GET["dial_status_e"];} + elseif (isset($_POST["dial_status_e"])) {$dial_status_e=$_POST["dial_status_e"];} +if (isset($_GET["dial_timeout"])) {$dial_timeout=$_GET["dial_timeout"];} + elseif (isset($_POST["dial_timeout"])) {$dial_timeout=$_POST["dial_timeout"];} +if (isset($_GET["dialplan_number"])) {$dialplan_number=$_GET["dialplan_number"];} + elseif (isset($_POST["dialplan_number"])) {$dialplan_number=$_POST["dialplan_number"];} +if (isset($_GET["drop_call_seconds"])) {$drop_call_seconds=$_GET["drop_call_seconds"];} + elseif (isset($_POST["drop_call_seconds"])) {$drop_call_seconds=$_POST["drop_call_seconds"];} +if (isset($_GET["drop_exten"])) {$drop_exten=$_GET["drop_exten"];} + elseif (isset($_POST["drop_exten"])) {$drop_exten=$_POST["drop_exten"];} +if (isset($_GET["drop_message"])) {$drop_message=$_GET["drop_message"];} + elseif (isset($_POST["drop_message"])) {$drop_message=$_POST["drop_message"];} +if (isset($_GET["dtmf_send_extension"])) {$dtmf_send_extension=$_GET["dtmf_send_extension"];} + elseif (isset($_POST["dtmf_send_extension"])) {$dtmf_send_extension=$_POST["dtmf_send_extension"];} +if (isset($_GET["enable_fast_refresh"])) {$enable_fast_refresh=$_GET["enable_fast_refresh"];} + elseif (isset($_POST["enable_fast_refresh"])) {$enable_fast_refresh=$_POST["enable_fast_refresh"];} +if (isset($_GET["enable_persistant_mysql"])) {$enable_persistant_mysql=$_GET["enable_persistant_mysql"];} + elseif (isset($_POST["enable_persistant_mysql"])) {$enable_persistant_mysql=$_POST["enable_persistant_mysql"];} +if (isset($_GET["ext_context"])) {$ext_context=$_GET["ext_context"];} + elseif (isset($_POST["ext_context"])) {$ext_context=$_POST["ext_context"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["fast_refresh_rate"])) {$fast_refresh_rate=$_GET["fast_refresh_rate"];} + elseif (isset($_POST["fast_refresh_rate"])) {$fast_refresh_rate=$_POST["fast_refresh_rate"];} +if (isset($_GET["force_logout"])) {$force_logout=$_GET["force_logout"];} + elseif (isset($_POST["force_logout"])) {$force_logout=$_POST["force_logout"];} +if (isset($_GET["fronter_display"])) {$fronter_display=$_GET["fronter_display"];} + elseif (isset($_POST["fronter_display"])) {$fronter_display=$_POST["fronter_display"];} +if (isset($_GET["full_name"])) {$full_name=$_GET["full_name"];} + elseif (isset($_POST["full_name"])) {$full_name=$_POST["full_name"];} +if (isset($_GET["fullname"])) {$fullname=$_GET["fullname"];} + elseif (isset($_POST["fullname"])) {$fullname=$_POST["fullname"];} +if (isset($_GET["get_call_launch"])) {$get_call_launch=$_GET["get_call_launch"];} + elseif (isset($_POST["get_call_launch"])) {$get_call_launch=$_POST["get_call_launch"];} +if (isset($_GET["group_color"])) {$group_color=$_GET["group_color"];} + elseif (isset($_POST["group_color"])) {$group_color=$_POST["group_color"];} +if (isset($_GET["group_id"])) {$group_id=$_GET["group_id"];} + elseif (isset($_POST["group_id"])) {$group_id=$_POST["group_id"];} +if (isset($_GET["group_name"])) {$group_name=$_GET["group_name"];} + elseif (isset($_POST["group_name"])) {$group_name=$_POST["group_name"];} +if (isset($_GET["groups"])) {$groups=$_GET["groups"];} + elseif (isset($_POST["groups"])) {$groups=$_POST["groups"];} +if (isset($_GET["XFERgroups"])) {$XFERgroups=$_GET["XFERgroups"];} + elseif (isset($_POST["XFERgroups"])) {$XFERgroups=$_POST["XFERgroups"];} +if (isset($_GET["HKstatus"])) {$HKstatus=$_GET["HKstatus"];} + elseif (isset($_POST["HKstatus"])) {$HKstatus=$_POST["HKstatus"];} +if (isset($_GET["hopper_level"])) {$hopper_level=$_GET["hopper_level"];} + elseif (isset($_POST["hopper_level"])) {$hopper_level=$_POST["hopper_level"];} +if (isset($_GET["hotkey"])) {$hotkey=$_GET["hotkey"];} + elseif (isset($_POST["hotkey"])) {$hotkey=$_POST["hotkey"];} +if (isset($_GET["hotkeys_active"])) {$hotkeys_active=$_GET["hotkeys_active"];} + elseif (isset($_POST["hotkeys_active"])) {$hotkeys_active=$_POST["hotkeys_active"];} +if (isset($_GET["install_directory"])) {$install_directory=$_GET["install_directory"];} + elseif (isset($_POST["install_directory"])) {$install_directory=$_POST["install_directory"];} +if (isset($_GET["lead_filter_comments"])) {$lead_filter_comments=$_GET["lead_filter_comments"];} + elseif (isset($_POST["lead_filter_comments"])) {$lead_filter_comments=$_POST["lead_filter_comments"];} +if (isset($_GET["lead_filter_id"])) {$lead_filter_id=$_GET["lead_filter_id"];} + elseif (isset($_POST["lead_filter_id"])) {$lead_filter_id=$_POST["lead_filter_id"];} +if (isset($_GET["lead_filter_name"])) {$lead_filter_name=$_GET["lead_filter_name"];} + elseif (isset($_POST["lead_filter_name"])) {$lead_filter_name=$_POST["lead_filter_name"];} +if (isset($_GET["lead_filter_sql"])) {$lead_filter_sql=$_GET["lead_filter_sql"];} + elseif (isset($_POST["lead_filter_sql"])) {$lead_filter_sql=$_POST["lead_filter_sql"];} +if (isset($_GET["lead_order"])) {$lead_order=$_GET["lead_order"];} + elseif (isset($_POST["lead_order"])) {$lead_order=$_POST["lead_order"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["list_name"])) {$list_name=$_GET["list_name"];} + elseif (isset($_POST["list_name"])) {$list_name=$_POST["list_name"];} +if (isset($_GET["load_leads"])) {$load_leads=$_GET["load_leads"];} + elseif (isset($_POST["load_leads"])) {$load_leads=$_POST["load_leads"];} +if (isset($_GET["local_call_time"])) {$local_call_time=$_GET["local_call_time"];} + elseif (isset($_POST["local_call_time"])) {$local_call_time=$_POST["local_call_time"];} +if (isset($_GET["local_gmt"])) {$local_gmt=$_GET["local_gmt"];} + elseif (isset($_POST["local_gmt"])) {$local_gmt=$_POST["local_gmt"];} +if (isset($_GET["local_web_callerID_URL"])) {$local_web_callerID_URL=$_GET["local_web_callerID_URL"];} + elseif (isset($_POST["local_web_callerID_URL"])) {$local_web_callerID_URL=$_POST["local_web_callerID_URL"];} +if (isset($_GET["login"])) {$login=$_GET["login"];} + elseif (isset($_POST["login"])) {$login=$_POST["login"];} +if (isset($_GET["login_campaign"])) {$login_campaign=$_GET["login_campaign"];} + elseif (isset($_POST["login_campaign"])) {$login_campaign=$_POST["login_campaign"];} +if (isset($_GET["login_pass"])) {$login_pass=$_GET["login_pass"];} + elseif (isset($_POST["login_pass"])) {$login_pass=$_POST["login_pass"];} +if (isset($_GET["login_user"])) {$login_user=$_GET["login_user"];} + elseif (isset($_POST["login_user"])) {$login_user=$_POST["login_user"];} +if (isset($_GET["max_vicidial_trunks"])) {$max_vicidial_trunks=$_GET["max_vicidial_trunks"];} + elseif (isset($_POST["max_vicidial_trunks"])) {$max_vicidial_trunks=$_POST["max_vicidial_trunks"];} +if (isset($_GET["modify_call_times"])) {$modify_call_times=$_GET["modify_call_times"];} + elseif (isset($_POST["modify_call_times"])) {$modify_call_times=$_POST["modify_call_times"];} +if (isset($_GET["modify_leads"])) {$modify_leads=$_GET["modify_leads"];} + elseif (isset($_POST["modify_leads"])) {$modify_leads=$_POST["modify_leads"];} +if (isset($_GET["monitor_prefix"])) {$monitor_prefix=$_GET["monitor_prefix"];} + elseif (isset($_POST["monitor_prefix"])) {$monitor_prefix=$_POST["monitor_prefix"];} +if (isset($_GET["next_agent_call"])) {$next_agent_call=$_GET["next_agent_call"];} + elseif (isset($_POST["next_agent_call"])) {$next_agent_call=$_POST["next_agent_call"];} +if (isset($_GET["number_of_lines"])) {$number_of_lines=$_GET["number_of_lines"];} + elseif (isset($_POST["number_of_lines"])) {$number_of_lines=$_POST["number_of_lines"];} +if (isset($_GET["old_campaign_id"])) {$old_campaign_id=$_GET["old_campaign_id"];} + elseif (isset($_POST["old_campaign_id"])) {$old_campaign_id=$_POST["old_campaign_id"];} +if (isset($_GET["old_conf_exten"])) {$old_conf_exten=$_GET["old_conf_exten"];} + elseif (isset($_POST["old_conf_exten"])) {$old_conf_exten=$_POST["old_conf_exten"];} +if (isset($_GET["old_extension"])) {$old_extension=$_GET["old_extension"];} + elseif (isset($_POST["old_extension"])) {$old_extension=$_POST["old_extension"];} +if (isset($_GET["old_server_id"])) {$old_server_id=$_GET["old_server_id"];} + elseif (isset($_POST["old_server_id"])) {$old_server_id=$_POST["old_server_id"];} +if (isset($_GET["old_server_ip"])) {$old_server_ip=$_GET["old_server_ip"];} + elseif (isset($_POST["old_server_ip"])) {$old_server_ip=$_POST["old_server_ip"];} +if (isset($_GET["OLDuser_group"])) {$OLDuser_group=$_GET["OLDuser_group"];} + elseif (isset($_POST["OLDuser_group"])) {$OLDuser_group=$_POST["OLDuser_group"];} +if (isset($_GET["omit_phone_code"])) {$omit_phone_code=$_GET["omit_phone_code"];} + elseif (isset($_POST["omit_phone_code"])) {$omit_phone_code=$_POST["omit_phone_code"];} +if (isset($_GET["outbound_cid"])) {$outbound_cid=$_GET["outbound_cid"];} + elseif (isset($_POST["outbound_cid"])) {$outbound_cid=$_POST["outbound_cid"];} +if (isset($_GET["park_ext"])) {$park_ext=$_GET["park_ext"];} + elseif (isset($_POST["park_ext"])) {$park_ext=$_POST["park_ext"];} +if (isset($_GET["park_file_name"])) {$park_file_name=$_GET["park_file_name"];} + elseif (isset($_POST["park_file_name"])) {$park_file_name=$_POST["park_file_name"];} +if (isset($_GET["park_on_extension"])) {$park_on_extension=$_GET["park_on_extension"];} + elseif (isset($_POST["park_on_extension"])) {$park_on_extension=$_POST["park_on_extension"];} +if (isset($_GET["pass"])) {$pass=$_GET["pass"];} + elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];} +if (isset($_GET["phone_ip"])) {$phone_ip=$_GET["phone_ip"];} + elseif (isset($_POST["phone_ip"])) {$phone_ip=$_POST["phone_ip"];} +if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];} + elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];} +if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];} + elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];} +if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];} + elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];} +if (isset($_GET["phone_type"])) {$phone_type=$_GET["phone_type"];} + elseif (isset($_POST["phone_type"])) {$phone_type=$_POST["phone_type"];} +if (isset($_GET["picture"])) {$picture=$_GET["picture"];} + elseif (isset($_POST["picture"])) {$picture=$_POST["picture"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} +if (isset($_GET["QUEUE_ACTION_enabled"])) {$QUEUE_ACTION_enabled=$_GET["QUEUE_ACTION_enabled"];} + elseif (isset($_POST["QUEUE_ACTION_enabled"])) {$QUEUE_ACTION_enabled=$_POST["QUEUE_ACTION_enabled"];} +if (isset($_GET["recording_exten"])) {$recording_exten=$_GET["recording_exten"];} + elseif (isset($_POST["recording_exten"])) {$recording_exten=$_POST["recording_exten"];} +if (isset($_GET["remote_agent_id"])) {$remote_agent_id=$_GET["remote_agent_id"];} + elseif (isset($_POST["remote_agent_id"])) {$remote_agent_id=$_POST["remote_agent_id"];} +if (isset($_GET["reset_hopper"])) {$reset_hopper=$_GET["reset_hopper"];} + elseif (isset($_POST["reset_hopper"])) {$reset_hopper=$_POST["reset_hopper"];} +if (isset($_GET["reset_list"])) {$reset_list=$_GET["reset_list"];} + elseif (isset($_POST["reset_list"])) {$reset_list=$_POST["reset_list"];} +if (isset($_GET["safe_harbor_exten"])) {$safe_harbor_exten=$_GET["safe_harbor_exten"];} + elseif (isset($_POST["safe_harbor_exten"])) {$safe_harbor_exten=$_POST["safe_harbor_exten"];} +if (isset($_GET["safe_harbor_message"])) {$safe_harbor_message=$_GET["safe_harbor_message"];} + elseif (isset($_POST["safe_harbor_message"])) {$safe_harbor_message=$_POST["safe_harbor_message"];} +if (isset($_GET["scheduled_callbacks"])) {$scheduled_callbacks=$_GET["scheduled_callbacks"];} + elseif (isset($_POST["scheduled_callbacks"])) {$scheduled_callbacks=$_POST["scheduled_callbacks"];} +if (isset($_GET["script_comments"])) {$script_comments=$_GET["script_comments"];} + elseif (isset($_POST["script_comments"])) {$script_comments=$_POST["script_comments"];} +if (isset($_GET["script_id"])) {$script_id=$_GET["script_id"];} + elseif (isset($_POST["script_id"])) {$script_id=$_POST["script_id"];} +if (isset($_GET["script_name"])) {$script_name=$_GET["script_name"];} + elseif (isset($_POST["script_name"])) {$script_name=$_POST["script_name"];} +if (isset($_GET["script_text"])) {$script_text=$_GET["script_text"];} + elseif (isset($_POST["script_text"])) {$script_text=$_POST["script_text"];} +if (isset($_GET["selectable"])) {$selectable=$_GET["selectable"];} + elseif (isset($_POST["selectable"])) {$selectable=$_POST["selectable"];} +if (isset($_GET["server_description"])) {$server_description=$_GET["server_description"];} + elseif (isset($_POST["server_description"])) {$server_description=$_POST["server_description"];} +if (isset($_GET["server_id"])) {$server_id=$_GET["server_id"];} + elseif (isset($_POST["server_id"])) {$server_id=$_POST["server_id"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["state_call_time_state"])) {$state_call_time_state=$_GET["state_call_time_state"];} + elseif (isset($_POST["state_call_time_state"])) {$state_call_time_state=$_POST["state_call_time_state"];} +if (isset($_GET["state_rule"])) {$state_rule=$_GET["state_rule"];} + elseif (isset($_POST["state_rule"])) {$state_rule=$_POST["state_rule"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["status_name"])) {$status_name=$_GET["status_name"];} + elseif (isset($_POST["status_name"])) {$status_name=$_POST["status_name"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["sys_perf_log"])) {$sys_perf_log=$_GET["sys_perf_log"];} + elseif (isset($_POST["sys_perf_log"])) {$sys_perf_log=$_POST["sys_perf_log"];} +if (isset($_GET["telnet_host"])) {$telnet_host=$_GET["telnet_host"];} + elseif (isset($_POST["telnet_host"])) {$telnet_host=$_POST["telnet_host"];} +if (isset($_GET["telnet_port"])) {$telnet_port=$_GET["telnet_port"];} + elseif (isset($_POST["telnet_port"])) {$telnet_port=$_POST["telnet_port"];} +if (isset($_GET["updater_check_enabled"])) {$updater_check_enabled=$_GET["updater_check_enabled"];} + elseif (isset($_POST["updater_check_enabled"])) {$updater_check_enabled=$_POST["updater_check_enabled"];} +if (isset($_GET["use_internal_dnc"])) {$use_internal_dnc=$_GET["use_internal_dnc"];} + elseif (isset($_POST["use_internal_dnc"])) {$use_internal_dnc=$_POST["use_internal_dnc"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["user_group"])) {$user_group=$_GET["user_group"];} + elseif (isset($_POST["user_group"])) {$user_group=$_POST["user_group"];} +if (isset($_GET["user_level"])) {$user_level=$_GET["user_level"];} + elseif (isset($_POST["user_level"])) {$user_level=$_POST["user_level"];} +if (isset($_GET["user_start"])) {$user_start=$_GET["user_start"];} + elseif (isset($_POST["user_start"])) {$user_start=$_POST["user_start"];} +if (isset($_GET["user_switching_enabled"])) {$user_switching_enabled=$_GET["user_switching_enabled"];} + elseif (isset($_POST["user_switching_enabled"])) {$user_switching_enabled=$_POST["user_switching_enabled"];} +if (isset($_GET["vd_server_logs"])) {$vd_server_logs=$_GET["vd_server_logs"];} + elseif (isset($_POST["vd_server_logs"])) {$vd_server_logs=$_POST["vd_server_logs"];} +if (isset($_GET["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_GET["VDstop_rec_after_each_call"];} + elseif (isset($_POST["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_POST["VDstop_rec_after_each_call"];} +if (isset($_GET["VICIDIAL_park_on_extension"])) {$VICIDIAL_park_on_extension=$_GET["VICIDIAL_park_on_extension"];} + elseif (isset($_POST["VICIDIAL_park_on_extension"])) {$VICIDIAL_park_on_extension=$_POST["VICIDIAL_park_on_extension"];} +if (isset($_GET["VICIDIAL_park_on_filename"])) {$VICIDIAL_park_on_filename=$_GET["VICIDIAL_park_on_filename"];} + elseif (isset($_POST["VICIDIAL_park_on_filename"])) {$VICIDIAL_park_on_filename=$_POST["VICIDIAL_park_on_filename"];} +if (isset($_GET["vicidial_recording"])) {$vicidial_recording=$_GET["vicidial_recording"];} + elseif (isset($_POST["vicidial_recording"])) {$vicidial_recording=$_POST["vicidial_recording"];} +if (isset($_GET["vicidial_transfers"])) {$vicidial_transfers=$_GET["vicidial_transfers"];} + elseif (isset($_POST["vicidial_transfers"])) {$vicidial_transfers=$_POST["vicidial_transfers"];} +if (isset($_GET["VICIDIAL_web_URL"])) {$VICIDIAL_web_URL=$_GET["VICIDIAL_web_URL"];} + elseif (isset($_POST["VICIDIAL_web_URL"])) {$VICIDIAL_web_URL=$_POST["VICIDIAL_web_URL"];} +if (isset($_GET["voicemail_button_enabled"])) {$voicemail_button_enabled=$_GET["voicemail_button_enabled"];} + elseif (isset($_POST["voicemail_button_enabled"])) {$voicemail_button_enabled=$_POST["voicemail_button_enabled"];} +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["voicemail_ext"])) {$voicemail_ext=$_GET["voicemail_ext"];} + elseif (isset($_POST["voicemail_ext"])) {$voicemail_ext=$_POST["voicemail_ext"];} +if (isset($_GET["voicemail_exten"])) {$voicemail_exten=$_GET["voicemail_exten"];} + elseif (isset($_POST["voicemail_exten"])) {$voicemail_exten=$_POST["voicemail_exten"];} +if (isset($_GET["voicemail_id"])) {$voicemail_id=$_GET["voicemail_id"];} + elseif (isset($_POST["voicemail_id"])) {$voicemail_id=$_POST["voicemail_id"];} +if (isset($_GET["web_form_address"])) {$web_form_address=$_GET["web_form_address"];} + elseif (isset($_POST["web_form_address"])) {$web_form_address=$_POST["web_form_address"];} +if (isset($_GET["wrapup_message"])) {$wrapup_message=$_GET["wrapup_message"];} + elseif (isset($_POST["wrapup_message"])) {$wrapup_message=$_POST["wrapup_message"];} +if (isset($_GET["wrapup_seconds"])) {$wrapup_seconds=$_GET["wrapup_seconds"];} + elseif (isset($_POST["wrapup_seconds"])) {$wrapup_seconds=$_POST["wrapup_seconds"];} +if (isset($_GET["xferconf_a_dtmf"])) {$xferconf_a_dtmf=$_GET["xferconf_a_dtmf"];} + elseif (isset($_POST["xferconf_a_dtmf"])) {$xferconf_a_dtmf=$_POST["xferconf_a_dtmf"];} +if (isset($_GET["xferconf_a_number"])) {$xferconf_a_number=$_GET["xferconf_a_number"];} + elseif (isset($_POST["xferconf_a_number"])) {$xferconf_a_number=$_POST["xferconf_a_number"];} +if (isset($_GET["xferconf_b_dtmf"])) {$xferconf_b_dtmf=$_GET["xferconf_b_dtmf"];} + elseif (isset($_POST["xferconf_b_dtmf"])) {$xferconf_b_dtmf=$_POST["xferconf_b_dtmf"];} +if (isset($_GET["xferconf_b_number"])) {$xferconf_b_number=$_GET["xferconf_b_number"];} + elseif (isset($_POST["xferconf_b_number"])) {$xferconf_b_number=$_POST["xferconf_b_number"];} +if (isset($_GET["vicidial_balance_active"])) {$vicidial_balance_active=$_GET["vicidial_balance_active"];} + elseif (isset($_POST["vicidial_balance_active"])) {$vicidial_balance_active=$_POST["vicidial_balance_active"];} +if (isset($_GET["balance_trunks_offlimits"])) {$balance_trunks_offlimits=$_GET["balance_trunks_offlimits"];} + elseif (isset($_POST["balance_trunks_offlimits"])) {$balance_trunks_offlimits=$_POST["balance_trunks_offlimits"];} +if (isset($_GET["dedicated_trunks"])) {$dedicated_trunks=$_GET["dedicated_trunks"];} + elseif (isset($_POST["dedicated_trunks"])) {$dedicated_trunks=$_POST["dedicated_trunks"];} +if (isset($_GET["trunk_restriction"])) {$trunk_restriction=$_GET["trunk_restriction"];} + elseif (isset($_POST["trunk_restriction"])) {$trunk_restriction=$_POST["trunk_restriction"];} +if (isset($_GET["campaigns"])) {$campaigns=$_GET["campaigns"];} + elseif (isset($_POST["campaigns"])) {$campaigns=$_POST["campaigns"];} +if (isset($_GET["dial_level_override"])) {$dial_level_override=$_GET["dial_level_override"];} + elseif (isset($_POST["dial_level_override"])) {$dial_level_override=$_POST["dial_level_override"];} +if (isset($_GET["concurrent_transfers"])) {$concurrent_transfers=$_GET["concurrent_transfers"];} + elseif (isset($_POST["concurrent_transfers"])) {$concurrent_transfers=$_POST["concurrent_transfers"];} +if (isset($_GET["auto_alt_dial"])) {$auto_alt_dial=$_GET["auto_alt_dial"];} + elseif (isset($_POST["auto_alt_dial"])) {$auto_alt_dial=$_POST["auto_alt_dial"];} +if (isset($_GET["modify_users"])) {$modify_users=$_GET["modify_users"];} + elseif (isset($_POST["modify_users"])) {$modify_users=$_POST["modify_users"];} +if (isset($_GET["modify_campaigns"])) {$modify_campaigns=$_GET["modify_campaigns"];} + elseif (isset($_POST["modify_campaigns"])) {$modify_campaigns=$_POST["modify_campaigns"];} +if (isset($_GET["modify_lists"])) {$modify_lists=$_GET["modify_lists"];} + elseif (isset($_POST["modify_lists"])) {$modify_lists=$_POST["modify_lists"];} +if (isset($_GET["modify_scripts"])) {$modify_scripts=$_GET["modify_scripts"];} + elseif (isset($_POST["modify_scripts"])) {$modify_scripts=$_POST["modify_scripts"];} +if (isset($_GET["modify_filters"])) {$modify_filters=$_GET["modify_filters"];} + elseif (isset($_POST["modify_filters"])) {$modify_filters=$_POST["modify_filters"];} +if (isset($_GET["modify_ingroups"])) {$modify_ingroups=$_GET["modify_ingroups"];} + elseif (isset($_POST["modify_ingroups"])) {$modify_ingroups=$_POST["modify_ingroups"];} +if (isset($_GET["modify_usergroups"])) {$modify_usergroups=$_GET["modify_usergroups"];} + elseif (isset($_POST["modify_usergroups"])) {$modify_usergroups=$_POST["modify_usergroups"];} +if (isset($_GET["modify_remoteagents"])) {$modify_remoteagents=$_GET["modify_remoteagents"];} + elseif (isset($_POST["modify_remoteagents"])) {$modify_remoteagents=$_POST["modify_remoteagents"];} +if (isset($_GET["modify_servers"])) {$modify_servers=$_GET["modify_servers"];} + elseif (isset($_POST["modify_servers"])) {$modify_servers=$_POST["modify_servers"];} +if (isset($_GET["view_reports"])) {$view_reports=$_GET["view_reports"];} + elseif (isset($_POST["view_reports"])) {$view_reports=$_POST["view_reports"];} +if (isset($_GET["agent_pause_codes_active"])) {$agent_pause_codes_active=$_GET["agent_pause_codes_active"];} + elseif (isset($_POST["agent_pause_codes_active"])) {$agent_pause_codes_active=$_POST["agent_pause_codes_active"];} +if (isset($_GET["pause_code"])) {$pause_code=$_GET["pause_code"];} + elseif (isset($_POST["pause_code"])) {$pause_code=$_POST["pause_code"];} +if (isset($_GET["pause_code_name"])) {$pause_code_name=$_GET["pause_code_name"];} + elseif (isset($_POST["pause_code_name"])) {$pause_code_name=$_POST["pause_code_name"];} +if (isset($_GET["billable"])) {$billable=$_GET["billable"];} + elseif (isset($_POST["billable"])) {$billable=$_POST["billable"];} +if (isset($_GET["campaign_description"])) {$campaign_description=$_GET["campaign_description"];} + elseif (isset($_POST["campaign_description"])) {$campaign_description=$_POST["campaign_description"];} +if (isset($_GET["campaign_stats_refresh"])) {$campaign_stats_refresh=$_GET["campaign_stats_refresh"];} + elseif (isset($_POST["campaign_stats_refresh"])){$campaign_stats_refresh=$_POST["campaign_stats_refresh"];} +if (isset($_GET["list_description"])) {$list_description=$_GET["list_description"];} + elseif (isset($_POST["list_description"])) {$list_description=$_POST["list_description"];} +if (isset($_GET["vicidial_recording_override"])) {$vicidial_recording_override=$_GET["vicidial_recording_override"];} elseif (isset($_POST["vicidial_recording_override"])) {$vicidial_recording_override=$_POST["vicidial_recording_override"];} +if (isset($_GET["use_non_latin"])) {$use_non_latin=$_GET["use_non_latin"];} + elseif (isset($_POST["use_non_latin"])) {$use_non_latin=$_POST["use_non_latin"];} +if (isset($_GET["webroot_writable"])) {$webroot_writable=$_GET["webroot_writable"];} + elseif (isset($_POST["webroot_writable"])) {$webroot_writable=$_POST["webroot_writable"];} +if (isset($_GET["enable_queuemetrics_logging"])) {$enable_queuemetrics_logging=$_GET["enable_queuemetrics_logging"];} + elseif (isset($_POST["enable_queuemetrics_logging"])) {$enable_queuemetrics_logging=$_POST["enable_queuemetrics_logging"];} +if (isset($_GET["queuemetrics_server_ip"])) {$queuemetrics_server_ip=$_GET["queuemetrics_server_ip"];} + elseif (isset($_POST["queuemetrics_server_ip"])) {$queuemetrics_server_ip=$_POST["queuemetrics_server_ip"];} +if (isset($_GET["queuemetrics_dbname"])) {$queuemetrics_dbname=$_GET["queuemetrics_dbname"];} + elseif (isset($_POST["queuemetrics_dbname"])) {$queuemetrics_dbname=$_POST["queuemetrics_dbname"];} +if (isset($_GET["queuemetrics_login"])) {$queuemetrics_login=$_GET["queuemetrics_login"];} + elseif (isset($_POST["queuemetrics_login"])) {$queuemetrics_login=$_POST["queuemetrics_login"];} +if (isset($_GET["queuemetrics_pass"])) {$queuemetrics_pass=$_GET["queuemetrics_pass"];} + elseif (isset($_POST["queuemetrics_pass"])) {$queuemetrics_pass=$_POST["queuemetrics_pass"];} +if (isset($_GET["queuemetrics_url"])) {$queuemetrics_url=$_GET["queuemetrics_url"];} + elseif (isset($_POST["queuemetrics_url"])) {$queuemetrics_url=$_POST["queuemetrics_url"];} +if (isset($_GET["queuemetrics_log_id"])) {$queuemetrics_log_id=$_GET["queuemetrics_log_id"];} + elseif (isset($_POST["queuemetrics_log_id"])) {$queuemetrics_log_id=$_POST["queuemetrics_log_id"];} +if (isset($_GET["dial_status"])) {$dial_status=$_GET["dial_status"];} + elseif (isset($_POST["dial_status"])) {$dial_status=$_POST["dial_status"];} +if (isset($_GET["queuemetrics_eq_prepend"])) {$queuemetrics_eq_prepend=$_GET["queuemetrics_eq_prepend"];} + elseif (isset($_POST["queuemetrics_eq_prepend"])) {$queuemetrics_eq_prepend=$_POST["queuemetrics_eq_prepend"];} +if (isset($_GET["vicidial_agent_disable"])) {$vicidial_agent_disable=$_GET["vicidial_agent_disable"];} + elseif (isset($_POST["vicidial_agent_disable"])) {$vicidial_agent_disable=$_POST["vicidial_agent_disable"];} +if (isset($_GET["disable_alter_custdata"])) {$disable_alter_custdata=$_GET["disable_alter_custdata"];} + elseif (isset($_POST["disable_alter_custdata"])) {$disable_alter_custdata=$_POST["disable_alter_custdata"];} +if (isset($_GET["alter_custdata_override"])) {$alter_custdata_override=$_GET["alter_custdata_override"];} + elseif (isset($_POST["alter_custdata_override"])) {$alter_custdata_override=$_POST["alter_custdata_override"];} +if (isset($_GET["no_hopper_leads_logins"])) {$no_hopper_leads_logins=$_GET["no_hopper_leads_logins"];} + elseif (isset($_POST["no_hopper_leads_logins"])) {$no_hopper_leads_logins=$_POST["no_hopper_leads_logins"];} +if (isset($_GET["enable_sipsak_messages"])) {$enable_sipsak_messages=$_GET["enable_sipsak_messages"];} + elseif (isset($_POST["enable_sipsak_messages"])) {$enable_sipsak_messages=$_POST["enable_sipsak_messages"];} +if (isset($_GET["allow_sipsak_messages"])) {$allow_sipsak_messages=$_GET["allow_sipsak_messages"];} + elseif (isset($_POST["allow_sipsak_messages"])) {$allow_sipsak_messages=$_POST["allow_sipsak_messages"];} +if (isset($_GET["admin_home_url"])) {$admin_home_url=$_GET["admin_home_url"];} + elseif (isset($_POST["admin_home_url"])) {$admin_home_url=$_POST["admin_home_url"];} +if (isset($_GET["list_order_mix"])) {$list_order_mix=$_GET["list_order_mix"];} + elseif (isset($_POST["list_order_mix"])) {$list_order_mix=$_POST["list_order_mix"];} +if (isset($_GET["vcl_id"])) {$vcl_id=$_GET["vcl_id"];} + elseif (isset($_POST["vcl_id"])) {$vcl_id=$_POST["vcl_id"];} +if (isset($_GET["vcl_name"])) {$vcl_name=$_GET["vcl_name"];} + elseif (isset($_POST["vcl_name"])) {$vcl_name=$_POST["vcl_name"];} +if (isset($_GET["list_mix_container"])) {$list_mix_container=$_GET["list_mix_container"];} + elseif (isset($_POST["list_mix_container"])) {$list_mix_container=$_POST["list_mix_container"];} +if (isset($_GET["mix_method"])) {$mix_method=$_GET["mix_method"];} + elseif (isset($_POST["mix_method"])) {$mix_method=$_POST["mix_method"];} +if (isset($_GET["human_answered"])) {$human_answered=$_GET["human_answered"];} + elseif (isset($_POST["human_answered"])) {$human_answered=$_POST["human_answered"];} +if (isset($_GET["category"])) {$category=$_GET["category"];} + elseif (isset($_POST["category"])) {$category=$_POST["category"];} +if (isset($_GET["vsc_id"])) {$vsc_id=$_GET["vsc_id"];} + elseif (isset($_POST["vsc_id"])) {$vsc_id=$_POST["vsc_id"];} +if (isset($_GET["vsc_name"])) {$vsc_name=$_GET["vsc_name"];} + elseif (isset($_POST["vsc_name"])) {$vsc_name=$_POST["vsc_name"];} +if (isset($_GET["vsc_description"])) {$vsc_description=$_GET["vsc_description"];} + elseif (isset($_POST["vsc_description"])) {$vsc_description=$_POST["vsc_description"];} +if (isset($_GET["tovdad_display"])) {$tovdad_display=$_GET["tovdad_display"];} + elseif (isset($_POST["tovdad_display"])) {$tovdad_display=$_POST["tovdad_display"];} +if (isset($_GET["mix_container_item"])) {$mix_container_item=$_GET["mix_container_item"];} + elseif (isset($_POST["mix_container_item"])) {$mix_container_item=$_POST["mix_container_item"];} +if (isset($_GET["enable_agc_xfer_log"])) {$enable_agc_xfer_log=$_GET["enable_agc_xfer_log"];} + elseif (isset($_POST["enable_agc_xfer_log"])) {$enable_agc_xfer_log=$_POST["enable_agc_xfer_log"];} +if (isset($_GET["after_hours_action"])) {$after_hours_action=$_GET["after_hours_action"];} + elseif (isset($_POST["after_hours_action"])) {$after_hours_action=$_POST["after_hours_action"];} +if (isset($_GET["after_hours_message_filename"])) {$after_hours_message_filename=$_GET["after_hours_message_filename"];} + elseif (isset($_POST["after_hours_message_filename"])) {$after_hours_message_filename=$_POST["after_hours_message_filename"];} +if (isset($_GET["after_hours_exten"])) {$after_hours_exten=$_GET["after_hours_exten"];} + elseif (isset($_POST["after_hours_exten"])) {$after_hours_exten=$_POST["after_hours_exten"];} +if (isset($_GET["after_hours_voicemail"])) {$after_hours_voicemail=$_GET["after_hours_voicemail"];} + elseif (isset($_POST["after_hours_voicemail"])) {$after_hours_voicemail=$_POST["after_hours_voicemail"];} +if (isset($_GET["welcome_message_filename"])) {$welcome_message_filename=$_GET["welcome_message_filename"];} + elseif (isset($_POST["welcome_message_filename"])) {$welcome_message_filename=$_POST["welcome_message_filename"];} +if (isset($_GET["moh_context"])) {$moh_context=$_GET["moh_context"];} + elseif (isset($_POST["moh_context"])) {$moh_context=$_POST["moh_context"];} +if (isset($_GET["onhold_prompt_filename"])) {$onhold_prompt_filename=$_GET["onhold_prompt_filename"];} + elseif (isset($_POST["onhold_prompt_filename"])) {$onhold_prompt_filename=$_POST["onhold_prompt_filename"];} +if (isset($_GET["prompt_interval"])) {$prompt_interval=$_GET["prompt_interval"];} + elseif (isset($_POST["prompt_interval"])) {$prompt_interval=$_POST["prompt_interval"];} +if (isset($_GET["agent_alert_exten"])) {$agent_alert_exten=$_GET["agent_alert_exten"];} + elseif (isset($_POST["agent_alert_exten"])) {$agent_alert_exten=$_POST["agent_alert_exten"];} +if (isset($_GET["agent_alert_delay"])) {$agent_alert_delay=$_GET["agent_alert_delay"];} + elseif (isset($_POST["agent_alert_delay"])) {$agent_alert_delay=$_POST["agent_alert_delay"];} +if (isset($_GET["group_rank"])) {$group_rank=$_GET["group_rank"];} + elseif (isset($_POST["group_rank"])) {$group_rank=$_POST["group_rank"];} +if (isset($_GET["campaign_allow_inbound"])) {$campaign_allow_inbound=$_GET["campaign_allow_inbound"];} + elseif (isset($_POST["campaign_allow_inbound"])) {$campaign_allow_inbound=$_POST["campaign_allow_inbound"];} +if (isset($_GET["manual_dial_list_id"])) {$manual_dial_list_id=$_GET["manual_dial_list_id"];} + elseif (isset($_POST["manual_dial_list_id"])) {$manual_dial_list_id=$_POST["manual_dial_list_id"];} +if (isset($_GET["campaign_rank"])) {$campaign_rank=$_GET["campaign_rank"];} + elseif (isset($_POST["campaign_rank"])) {$campaign_rank=$_POST["campaign_rank"];} +if (isset($_GET["source_campaign_id"])) {$source_campaign_id=$_GET["source_campaign_id"];} + elseif (isset($_POST["source_campaign_id"])) {$source_campaign_id=$_POST["source_campaign_id"];} +if (isset($_GET["source_user_id"])) {$source_user_id=$_GET["source_user_id"];} + elseif (isset($_POST["source_user_id"])) {$source_user_id=$_POST["source_user_id"];} +if (isset($_GET["source_group_id"])) {$source_group_id=$_GET["source_group_id"];} + elseif (isset($_POST["source_group_id"])) {$source_group_id=$_POST["source_group_id"];} +if (isset($_GET["default_xfer_group"])) {$default_xfer_group=$_GET["default_xfer_group"];} + elseif (isset($_POST["default_xfer_group"])) {$default_xfer_group=$_POST["default_xfer_group"];} + + + if (isset($script_id)) {$script_id= strtoupper($script_id);} + if (isset($lead_filter_id)) {$lead_filter_id = strtoupper($lead_filter_id);} + +if (strlen($dial_status) > 0) + { + $ADD='28'; + $status = $dial_status; + } + +###################################################################################################### +###################################################################################################### +####### Form variable filtering for security and data integrity +###################################################################################################### +###################################################################################################### + +if ($non_latin < 1) +{ +### DIGITS ONLY ### +$adaptive_dropped_percentage = ereg_replace("[^0-9]","",$adaptive_dropped_percentage); +$adaptive_latest_server_time = ereg_replace("[^0-9]","",$adaptive_latest_server_time); +$admin_hangup_enabled = ereg_replace("[^0-9]","",$admin_hangup_enabled); +$admin_hijack_enabled = ereg_replace("[^0-9]","",$admin_hijack_enabled); +$admin_monitor_enabled = ereg_replace("[^0-9]","",$admin_monitor_enabled); +$AFLogging_enabled = ereg_replace("[^0-9]","",$AFLogging_enabled); +$agent_choose_ingroups = ereg_replace("[^0-9]","",$agent_choose_ingroups); +$agentcall_manual = ereg_replace("[^0-9]","",$agentcall_manual); +$agentonly_callbacks = ereg_replace("[^0-9]","",$agentonly_callbacks); +$AGI_call_logging_enabled = ereg_replace("[^0-9]","",$AGI_call_logging_enabled); +$allcalls_delay = ereg_replace("[^0-9]","",$allcalls_delay); +$alter_agent_interface_options = ereg_replace("[^0-9]","",$alter_agent_interface_options); +$am_message_exten = ereg_replace("[^0-9]","",$am_message_exten); +$answer_transfer_agent = ereg_replace("[^0-9]","",$answer_transfer_agent); +$ast_admin_access = ereg_replace("[^0-9]","",$ast_admin_access); +$ast_delete_phones = ereg_replace("[^0-9]","",$ast_delete_phones); +$attempt_delay = ereg_replace("[^0-9]","",$attempt_delay); +$attempt_maximum = ereg_replace("[^0-9]","",$attempt_maximum); +$auto_dial_next_number = ereg_replace("[^0-9]","",$auto_dial_next_number); +$balance_trunks_offlimits = ereg_replace("[^0-9]","",$balance_trunks_offlimits); +$call_parking_enabled = ereg_replace("[^0-9]","",$call_parking_enabled); +$CallerID_popup_enabled = ereg_replace("[^0-9]","",$CallerID_popup_enabled); +$campaign_detail = ereg_replace("[^0-9]","",$campaign_detail); +$campaign_rec_exten = ereg_replace("[^0-9]","",$campaign_rec_exten); +$campaign_vdad_exten = ereg_replace("[^0-9]","",$campaign_vdad_exten); +$change_agent_campaign = ereg_replace("[^0-9]","",$change_agent_campaign); +$closer_default_blended = ereg_replace("[^0-9]","",$closer_default_blended); +$conf_exten = ereg_replace("[^0-9]","",$conf_exten); +$conf_on_extension = ereg_replace("[^0-9]","",$conf_on_extension); +$conferencing_enabled = ereg_replace("[^0-9]","",$conferencing_enabled); +$ct_default_start = ereg_replace("[^0-9]","",$ct_default_start); +$ct_default_stop = ereg_replace("[^0-9]","",$ct_default_stop); +$ct_friday_start = ereg_replace("[^0-9]","",$ct_friday_start); +$ct_friday_stop = ereg_replace("[^0-9]","",$ct_friday_stop); +$ct_monday_start = ereg_replace("[^0-9]","",$ct_monday_start); +$ct_monday_stop = ereg_replace("[^0-9]","",$ct_monday_stop); +$ct_saturday_start = ereg_replace("[^0-9]","",$ct_saturday_start); +$ct_saturday_stop = ereg_replace("[^0-9]","",$ct_saturday_stop); +$ct_sunday_start = ereg_replace("[^0-9]","",$ct_sunday_start); +$ct_sunday_stop = ereg_replace("[^0-9]","",$ct_sunday_stop); +$ct_thursday_start = ereg_replace("[^0-9]","",$ct_thursday_start); +$ct_thursday_stop = ereg_replace("[^0-9]","",$ct_thursday_stop); +$ct_tuesday_start = ereg_replace("[^0-9]","",$ct_tuesday_start); +$ct_tuesday_stop = ereg_replace("[^0-9]","",$ct_tuesday_stop); +$ct_wednesday_start = ereg_replace("[^0-9]","",$ct_wednesday_start); +$ct_wednesday_stop = ereg_replace("[^0-9]","",$ct_wednesday_stop); +$DBX_port = ereg_replace("[^0-9]","",$DBX_port); +$DBY_port = ereg_replace("[^0-9]","",$DBY_port); +$dedicated_trunks = ereg_replace("[^0-9]","",$dedicated_trunks); +$delete_call_times = ereg_replace("[^0-9]","",$delete_call_times); +$delete_campaigns = ereg_replace("[^0-9]","",$delete_campaigns); +$delete_filters = ereg_replace("[^0-9]","",$delete_filters); +$delete_ingroups = ereg_replace("[^0-9]","",$delete_ingroups); +$delete_lists = ereg_replace("[^0-9]","",$delete_lists); +$delete_remote_agents = ereg_replace("[^0-9]","",$delete_remote_agents); +$delete_scripts = ereg_replace("[^0-9]","",$delete_scripts); +$delete_user_groups = ereg_replace("[^0-9]","",$delete_user_groups); +$delete_users = ereg_replace("[^0-9]","",$delete_users); +$dial_timeout = ereg_replace("[^0-9]","",$dial_timeout); +$dialplan_number = ereg_replace("[^0-9]","",$dialplan_number); +$drop_call_seconds = ereg_replace("[^0-9]","",$drop_call_seconds); +$drop_exten = ereg_replace("[^0-9]","",$drop_exten); +$enable_fast_refresh = ereg_replace("[^0-9]","",$enable_fast_refresh); +$enable_persistant_mysql = ereg_replace("[^0-9]","",$enable_persistant_mysql); +$fast_refresh_rate = ereg_replace("[^0-9]","",$fast_refresh_rate); +$hopper_level = ereg_replace("[^0-9]","",$hopper_level); +$hotkey = ereg_replace("[^0-9]","",$hotkey); +$hotkeys_active = ereg_replace("[^0-9]","",$hotkeys_active); +$list_id = ereg_replace("[^0-9]","",$list_id); +$load_leads = ereg_replace("[^0-9]","",$load_leads); +$max_vicidial_trunks = ereg_replace("[^0-9]","",$max_vicidial_trunks); +$modify_call_times = ereg_replace("[^0-9]","",$modify_call_times); +$modify_users = ereg_replace("[^0-9]","",$modify_users); +$modify_campaigns = ereg_replace("[^0-9]","",$modify_campaigns); +$modify_lists = ereg_replace("[^0-9]","",$modify_lists); +$modify_scripts = ereg_replace("[^0-9]","",$modify_scripts); +$modify_filters = ereg_replace("[^0-9]","",$modify_filters); +$modify_ingroups = ereg_replace("[^0-9]","",$modify_ingroups); +$modify_usergroups = ereg_replace("[^0-9]","",$modify_usergroups); +$modify_remoteagents = ereg_replace("[^0-9]","",$modify_remoteagents); +$modify_servers = ereg_replace("[^0-9]","",$modify_servers); +$view_reports = ereg_replace("[^0-9]","",$view_reports); +$modify_leads = ereg_replace("[^0-9]","",$modify_leads); +$monitor_prefix = ereg_replace("[^0-9]","",$monitor_prefix); +$number_of_lines = ereg_replace("[^0-9]","",$number_of_lines); +$old_conf_exten = ereg_replace("[^0-9]","",$old_conf_exten); +$outbound_cid = ereg_replace("[^0-9]","",$outbound_cid); +$park_ext = ereg_replace("[^0-9]","",$park_ext); +$park_on_extension = ereg_replace("[^0-9]","",$park_on_extension); +$phone_number = ereg_replace("[^0-9]","",$phone_number); +$QUEUE_ACTION_enabled = ereg_replace("[^0-9]","",$QUEUE_ACTION_enabled); +$recording_exten = ereg_replace("[^0-9]","",$recording_exten); +$remote_agent_id = ereg_replace("[^0-9]","",$remote_agent_id); +$safe_harbor_exten = ereg_replace("[^0-9]","",$safe_harbor_exten); +$telnet_port = ereg_replace("[^0-9]","",$telnet_port); +$updater_check_enabled = ereg_replace("[^0-9]","",$updater_check_enabled); +$user_level = ereg_replace("[^0-9]","",$user_level); +$user_start = ereg_replace("[^0-9]","",$user_start); +$user_switching_enabled = ereg_replace("[^0-9]","",$user_switching_enabled); +$VDstop_rec_after_each_call = ereg_replace("[^0-9]","",$VDstop_rec_after_each_call); +$VICIDIAL_park_on_extension = ereg_replace("[^0-9]","",$VICIDIAL_park_on_extension); +$vicidial_recording = ereg_replace("[^0-9]","",$vicidial_recording); +$vicidial_transfers = ereg_replace("[^0-9]","",$vicidial_transfers); +$voicemail_button_enabled = ereg_replace("[^0-9]","",$voicemail_button_enabled); +$voicemail_dump_exten = ereg_replace("[^0-9]","",$voicemail_dump_exten); +$voicemail_ext = ereg_replace("[^0-9]","",$voicemail_ext); +$voicemail_exten = ereg_replace("[^0-9]","",$voicemail_exten); +$voicemail_id = ereg_replace("[^0-9]","",$voicemail_id); +$wrapup_seconds = ereg_replace("[^0-9]","",$wrapup_seconds); +$use_non_latin = ereg_replace("[^0-9]","",$use_non_latin); +$webroot_writable = ereg_replace("[^0-9]","",$webroot_writable); +$enable_queuemetrics_logging = ereg_replace("[^0-9]","",$enable_queuemetrics_logging); +$enable_sipsak_messages = ereg_replace("[^0-9]","",$enable_sipsak_messages); +$allow_sipsak_messages = ereg_replace("[^0-9]","",$allow_sipsak_messages); +$mix_container_item = ereg_replace("[^0-9]","",$mix_container_item); +$prompt_interval = ereg_replace("[^0-9]","",$prompt_interval); +$agent_alert_delay = ereg_replace("[^0-9]","",$agent_alert_delay); +$manual_dial_list_id = ereg_replace("[^0-9]","",$manual_dial_list_id); + +### DIGITS and DASHES +$group_rank = ereg_replace("[^-0-9]","",$group_rank); +$campaign_rank = ereg_replace("[^-0-9]","",$campaign_rank); + +### Y or N ONLY ### +$active = ereg_replace("[^NY]","",$active); +$allow_closers = ereg_replace("[^NY]","",$allow_closers); +$reset_hopper = ereg_replace("[^NY]","",$reset_hopper); +$amd_send_to_vmx = ereg_replace("[^NY]","",$amd_send_to_vmx); +$alt_number_dialing = ereg_replace("[^NY]","",$alt_number_dialing); +$safe_harbor_message = ereg_replace("[^NY]","",$safe_harbor_message); +$selectable = ereg_replace("[^NY]","",$selectable); +$reset_list = ereg_replace("[^NY]","",$reset_list); +$fronter_display = ereg_replace("[^NY]","",$fronter_display); +$drop_message = ereg_replace("[^NY]","",$drop_message); +$use_internal_dnc = ereg_replace("[^NY]","",$use_internal_dnc); +$omit_phone_code = ereg_replace("[^NY]","",$omit_phone_code); +$available_only_ratio_tally = ereg_replace("[^NY]","",$available_only_ratio_tally); +$sys_perf_log = ereg_replace("[^NY]","",$sys_perf_log); +$vicidial_balance_active = ereg_replace("[^NY]","",$vicidial_balance_active); +$vd_server_logs = ereg_replace("[^NY]","",$vd_server_logs); +$agent_pause_codes_active = ereg_replace("[^NY]","",$agent_pause_codes_active); +$campaign_stats_refresh = ereg_replace("[^NY]","",$campaign_stats_refresh); +$disable_alter_custdata = ereg_replace("[^NY]","",$disable_alter_custdata); +$no_hopper_leads_logins = ereg_replace("[^NY]","",$no_hopper_leads_logins); +$human_answered = ereg_replace("[^NY]","",$human_answered); +$tovdad_display = ereg_replace("[^NY]","",$tovdad_display); +$campaign_allow_inbound = ereg_replace("[^NY]","",$campaign_allow_inbound); + +### ALPHA-NUMERIC ONLY ### +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); +$script_id = ereg_replace("[^0-9a-zA-Z]","",$script_id); +$submit = ereg_replace("[^0-9a-zA-Z]","",$submit); +$campaign_cid = ereg_replace("[^0-9a-zA-Z]","",$campaign_cid); +$get_call_launch = ereg_replace("[^0-9a-zA-Z]","",$get_call_launch); +$campaign_recording = ereg_replace("[^0-9a-zA-Z]","",$campaign_recording); +$ADD = ereg_replace("[^0-9a-zA-Z]","",$ADD); +$dial_prefix = ereg_replace("[^0-9a-zA-Z]","",$dial_prefix); +$state_call_time_state = ereg_replace("[^0-9a-zA-Z]","",$state_call_time_state); +$scheduled_callbacks = ereg_replace("[^0-9a-zA-Z]","",$scheduled_callbacks); +$concurrent_transfers = ereg_replace("[^0-9a-zA-Z]","",$concurrent_transfers); +$billable = ereg_replace("[^0-9a-zA-Z]","",$billable); +$pause_code = ereg_replace("[^0-9a-zA-Z]","",$pause_code); +$vicidial_recording_override = ereg_replace("[^0-9a-zA-Z]","",$vicidial_recording_override); +$queuemetrics_log_id = ereg_replace("[^0-9a-zA-Z]","",$queuemetrics_log_id); +$after_hours_action = ereg_replace("[^0-9a-zA-Z]","",$after_hours_action); +$after_hours_exten = ereg_replace("[^0-9a-zA-Z]","",$after_hours_exten); +$after_hours_voicemail = ereg_replace("[^0-9a-zA-Z]","",$after_hours_voicemail); + +### DIGITS and Dots +$server_ip = ereg_replace("[^\.0-9]","",$server_ip); +$auto_dial_level = ereg_replace("[^\.0-9]","",$auto_dial_level); +$adaptive_maximum_level = ereg_replace("[^\.0-9]","",$adaptive_maximum_level); +$phone_ip = ereg_replace("[^\.0-9]","",$phone_ip); +$old_server_ip = ereg_replace("[^\.0-9]","",$old_server_ip); +$computer_ip = ereg_replace("[^\.0-9]","",$computer_ip); +$queuemetrics_server_ip = ereg_replace("[^\.0-9]","",$queuemetrics_server_ip); + +### ALPHA-NUMERIC and spaces and hash and star and comma +$xferconf_a_dtmf = ereg_replace("[^ \,\*\#0-9a-zA-Z]","",$xferconf_a_dtmf); +$xferconf_b_dtmf = ereg_replace("[^ \,\*\#0-9a-zA-Z]","",$xferconf_b_dtmf); + +### ALPHACAPS-NUMERIC +$xferconf_a_number = ereg_replace("[^0-9A-Z]","",$xferconf_a_number); +$xferconf_b_number = ereg_replace("[^0-9A-Z]","",$xferconf_b_number); + +### ALPHA-NUMERIC and underscore and dash +$agi_output = ereg_replace("[^-\_0-9a-zA-Z]","",$agi_output); +$ASTmgrSECRET = ereg_replace("[^-\_0-9a-zA-Z]","",$ASTmgrSECRET); +$ASTmgrUSERNAME = ereg_replace("[^-\_0-9a-zA-Z]","",$ASTmgrUSERNAME); +$ASTmgrUSERNAMElisten = ereg_replace("[^-\_0-9a-zA-Z]","",$ASTmgrUSERNAMElisten); +$ASTmgrUSERNAMEsend = ereg_replace("[^-\_0-9a-zA-Z]","",$ASTmgrUSERNAMEsend); +$ASTmgrUSERNAMEupdate = ereg_replace("[^-\_0-9a-zA-Z]","",$ASTmgrUSERNAMEupdate); +$call_time_id = ereg_replace("[^-\_0-9a-zA-Z]","",$call_time_id); +$campaign_id = ereg_replace("[^-\_0-9a-zA-Z]","",$campaign_id); +$CoNfIrM = ereg_replace("[^-\_0-9a-zA-Z]","",$CoNfIrM); +$DBX_database = ereg_replace("[^-\_0-9a-zA-Z]","",$DBX_database); +$DBX_pass = ereg_replace("[^-\_0-9a-zA-Z]","",$DBX_pass); +$DBX_user = ereg_replace("[^-\_0-9a-zA-Z]","",$DBX_user); +$DBY_database = ereg_replace("[^-\_0-9a-zA-Z]","",$DBY_database); +$DBY_pass = ereg_replace("[^-\_0-9a-zA-Z]","",$DBY_pass); +$DBY_user = ereg_replace("[^-\_0-9a-zA-Z]","",$DBY_user); +$dial_method = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_method); +$dial_status_a = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status_a); +$dial_status_b = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status_b); +$dial_status_c = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status_c); +$dial_status_d = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status_d); +$dial_status_e = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status_e); +$ext_context = ereg_replace("[^-\_0-9a-zA-Z]","",$ext_context); +$group_id = ereg_replace("[^-\_0-9a-zA-Z]","",$group_id); +$lead_filter_id = ereg_replace("[^-\_0-9a-zA-Z]","",$lead_filter_id); +$local_call_time = ereg_replace("[^-\_0-9a-zA-Z]","",$local_call_time); +$login = ereg_replace("[^-\_0-9a-zA-Z]","",$login); +$login_campaign = ereg_replace("[^-\_0-9a-zA-Z]","",$login_campaign); +$login_pass = ereg_replace("[^-\_0-9a-zA-Z]","",$login_pass); +$login_user = ereg_replace("[^-\_0-9a-zA-Z]","",$login_user); +$next_agent_call = ereg_replace("[^-\_0-9a-zA-Z]","",$next_agent_call); +$old_campaign_id = ereg_replace("[^-\_0-9a-zA-Z]","",$old_campaign_id); +$old_server_id = ereg_replace("[^-\_0-9a-zA-Z]","",$old_server_id); +$OLDuser_group = ereg_replace("[^-\_0-9a-zA-Z]","",$OLDuser_group); +$park_file_name = ereg_replace("[^-\_0-9a-zA-Z]","",$park_file_name); +$pass = ereg_replace("[^-\_0-9a-zA-Z]","",$pass); +$phone_login = ereg_replace("[^-\_0-9a-zA-Z]","",$phone_login); +$phone_pass = ereg_replace("[^-\_0-9a-zA-Z]","",$phone_pass); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$protocol = ereg_replace("[^-\_0-9a-zA-Z]","",$protocol); +$server_id = ereg_replace("[^-\_0-9a-zA-Z]","",$server_id); +$stage = ereg_replace("[^-\_0-9a-zA-Z]","",$stage); +$state_rule = ereg_replace("[^-\_0-9a-zA-Z]","",$state_rule); +$status = ereg_replace("[^-\_0-9a-zA-Z]","",$status); +$trunk_restriction = ereg_replace("[^-\_0-9a-zA-Z]","",$trunk_restriction); +$user = ereg_replace("[^-\_0-9a-zA-Z]","",$user); +$user_group = ereg_replace("[^-\_0-9a-zA-Z]","",$user_group); +$VICIDIAL_park_on_filename = ereg_replace("[^-\_0-9a-zA-Z]","",$VICIDIAL_park_on_filename); +$auto_alt_dial = ereg_replace("[^-\_0-9a-zA-Z]","",$auto_alt_dial); +$dial_status = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status); +$queuemetrics_eq_prepend = ereg_replace("[^-\_0-9a-zA-Z]","",$queuemetrics_eq_prepend); +$vicidial_agent_disable = ereg_replace("[^-\_0-9a-zA-Z]","",$vicidial_agent_disable); +$alter_custdata_override = ereg_replace("[^-\_0-9a-zA-Z]","",$alter_custdata_override); +$list_order_mix = ereg_replace("[^-\_0-9a-zA-Z]","",$list_order_mix); +$vcl_id = ereg_replace("[^-\_0-9a-zA-Z]","",$vcl_id); +$mix_method = ereg_replace("[^-\_0-9a-zA-Z]","",$mix_method); +$category = ereg_replace("[^-\_0-9a-zA-Z]","",$category); +$vsc_id = ereg_replace("[^-\_0-9a-zA-Z]","",$vsc_id); +$moh_context = ereg_replace("[^-\_0-9a-zA-Z]","",$moh_context); +$agent_alert_exten = ereg_replace("[^-\_0-9a-zA-Z]","",$agent_alert_exten); +$source_campaign_id = ereg_replace("[^-\_0-9a-zA-Z]","",$source_campaign_id); +$source_user_id = ereg_replace("[^-\_0-9a-zA-Z]","",$source_user_id); +$source_group_id = ereg_replace("[^-\_0-9a-zA-Z]","",$source_group_id); +$default_xfer_group = ereg_replace("[^-\_0-9a-zA-Z]","",$default_xfer_group); + +### ALPHA-NUMERIC and spaces +$lead_order = ereg_replace("[^ 0-9a-zA-Z]","",$lead_order); +### ALPHA-NUMERIC and hash +$group_color = ereg_replace("[^\#0-9a-zA-Z]","",$group_color); + +### ALPHA-NUMERIC and spaces dots, commas, dashes, underscores +$adaptive_dl_diff_target = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$adaptive_dl_diff_target); +$adaptive_intensity = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$adaptive_intensity); +$asterisk_version = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$asterisk_version); +$call_time_comments = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$call_time_comments); +$call_time_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$call_time_name); +$campaign_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$campaign_name); +$campaign_rec_filename = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$campaign_rec_filename); +$company = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$company); +$full_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$full_name); +$fullname = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$fullname); +$group_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$group_name); +$HKstatus = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$HKstatus); +$lead_filter_comments = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$lead_filter_comments); +$lead_filter_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$lead_filter_name); +$list_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$list_name); +$local_gmt = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$local_gmt); +$phone_type = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$phone_type); +$picture = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$picture); +$script_comments = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$script_comments); +$script_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$script_name); +$server_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$server_description); +$status = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$status); +$status_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$status_name); +$wrapup_message = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$wrapup_message); +$pause_code_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$pause_code_name); +$campaign_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$campaign_description); +$list_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$list_description); +$vcl_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$vcl_name); +$vsc_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$vsc_name); +$vsc_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$vsc_description); + +### ALPHA-NUMERIC and underscore and dash and slash and at and dot +$call_out_number_group = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$call_out_number_group); +$client_browser = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$client_browser); +$DBX_server = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$DBX_server); +$DBY_server = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$DBY_server); +$dtmf_send_extension = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$dtmf_send_extension); +$extension = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$extension); +$install_directory = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$install_directory); +$old_extension = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$old_extension); +$telnet_host = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$telnet_host); +$queuemetrics_dbname = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$queuemetrics_dbname); +$queuemetrics_login = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$queuemetrics_login); +$queuemetrics_pass = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$queuemetrics_pass); +$after_hours_message_filename = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$after_hours_message_filename); +$welcome_message_filename = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$welcome_message_filename); +$onhold_prompt_filename = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$onhold_prompt_filename); + +### remove semi-colons ### +$lead_filter_sql = ereg_replace(";","",$lead_filter_sql); +$list_mix_container = ereg_replace(";","",$list_mix_container); + +### VARIABLES TO BE mysql_real_escape_string ### +# $web_form_address +# $queuemetrics_url +# $admin_home_url + +### VARIABLES not filtered at all ### +# $script_text + +} # end of non_latin + + +##### END VARIABLE FILTERING FOR SECURITY ##### + + +# AST GUI database administration +# admin.php +# +# CHANGELOG: +# 50315-1110 - Added Custom Campaign Statuses +# 50317-1438 - Added Fronter Display var to inbound groups +# 50322-1355 - Added custom callerID per campaign +# 50517-1356 - Added user_groups sections and user_group to vicidial_users +# 50517-1440 - Added ability to logout (must click OK with empty user/pass) +# 50602-1622 - Added lead loader pages to load new files into vicidial_list +# 50620-1351 - Added custom vdad transfer AGI extension per campaign +# 50810-1414 - modified in groups to kick out spaces and dashes +# 50908-2136 - Added Custom Campaign HotKeys +# 50914-0950 - Fixed user search by user_group +# 50926-1358 - Modified to allow for language translation +# 50926-1615 - Added WeBRooTWritablE write controls +# 51020-1008 - Added editable web address and park ext - NEW dial campaigns +# 51020-1056 - Added fields and help for campaign recording control +# 51123-1335 - Altered code to function in php globals=off +# 51208-1038 - Added user_level changes, function controls and default user phones +# 51208-1556 - Added deletion of users/lists/campaigns/in groups/remote agents +# 51213-1706 - Added add/delete/modify vicidial scripts +# 51214-1737 - Added preview of vicidial script in popup window +# 51219-1225 - Added campaign and ingroups script selector and get_call_launch field +# 51222-1055 - Added am_message_exten to campaigns to allow for AM Message button +# 51222-1125 - Fixed new vicidial_campaigns default values not being assigned bug +# 51222-1156 - Added LOG OUT ALL AGENTS ON THIS CAMPAIGN button to campaign screen +# 60204-0659 - Fixed hopper reset bug +# 60207-1413 - Added AMD send to voicemail extension and xfer-conf dtmf presets +# 60213-1100 - Added several vicidial_users permissions fields +# 60215-1319 - Added On-hold CallBacks display and links +# 60227-1226 - Fixed vicidial_inbound_groups insert bug +# 60413-1308 - Fixed list display to have 1 row/status: count and time zone tables +# - Added status name in selected dial statuses in campaign screen +# 60417-1416 - Added vicidial_lead_filters sections +# - Changed the header links to color-coded sectional with sublinks below +# - Added filter name and script name to campaign and in-group modify sections +# - Added callback and alt dial options to campaigns section +# - Added callback, alt dial and other options to users section +# 60419-1628 - Alter Callbacks display to include status and LIVE listings, reordered +# 60421-1441 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60425-2355 - Added agent options to vicidial_users, reformatted user page +# 60502-1627 - Added drop_call_seconds and safe_harbor_ fields to campaign screen +# 60503-1228 - Added drop_call_seconds and drop_ fields to inbound groups screen +# 60505-1117 - Added initial framework for new local_call_times tables and definitions +# 60506-1033 - More revisions to the local_call_time section +# 60508-1354 - Finished call_times and state_call_times sections +# - Added modify/delete options for call_times +# 60509-1311 - Functionalize campaign dialable leads calculation +# - Change state_call_times selection from call_times to only allow one per state +# - Added dialable leads count popup to campaign screen if auto-calc is disabled +# - Added test dialable leads count popup to filter screen +# 60510-1050 - Added Wrapup seconds and Wrapup message to campaigns screen +# 60608-1401 - Added allowable inbound_groups checkboxes to CLOSER campaign detail screen +# 60609-1051 - Added add-to-dnc in LISTS section +# 60613-1415 - Added lead recycling options to campaign detail screen +# 60619-1523 - Added variable filtering to eliminate SQL injection attack threat +# 60622-1216 - Fixed HotKey addition form issues and variable filtering +# 60623-1159 - Fixed Scheduled Callbacks over-filtering bug and filter_sql bug +# 60808-1147 - Changed filtering for and added instructions for consutative transfers +# 60816-1552 - Added allcalls_delay start delay for recordings in vicidial.php +# 60817-2226 - Fixed bug that would not allow lead recycling of non-selectable statuses +# 60821-1543 - Added option to Omit Phone Code while dialing in vicidial +# 60821-1625 - Added ALLFORCE recording option for campaign_recording +# 60823-1154 - Added fields for adaptive dialing +# 60824-1326 - Added adaptive_latest_target_gmt for ADAPT_TAPERED dial method +# 60825-1205 - Added adaptive_intensity for ADAPT_ dial methods +# 60828-1019 - Changed adaptive_latest_target_gmt to adaptive_latest_server_time +# 60828-1115 - Added adaptive_dl_diff_target and changed intensity dropdown +# 60927-1246 - Added astguiclient/admin.php functions under SERVERS tab +# 61002-1402 - Added fields for vicidial balance trunk controls +# 61003-1123 - Added functions for vicidial_server_trunks records +# 61109-1022 - Added Emergency VDAC Jam Clear function to Campaign Detail screen +# 61110-1502 - Add ability to select NONE in dial statuses, new list_id must not be < 100 +# 61122-1228 - Added user group campaign restrictions +# 61122-1535 - Changed script_text to unfiltered and added more variables to SCRIPTS +# 61129-1028 - Added headers to Users and Phones with clickable order-by titles +# 70108-1405 - Added ADAPT OVERRIDE to allow for forced dial_level changes in ADAPT dial methods +# - Screen width definable at top of script, merged server_stats into this script +# 70109-1638 - Added ALTPH2 and ADDR3 hotkey options for alt number dialing with HotKeys +# 70109-1716 - Added concurrent_transfers option to vicidial_campaigns +# 70115-1152 - Aded (CLOSER|BLEND|INBND|_C$|_B$|_I$) options for CLOSER-type campaigns +# 70115-1532 - Added auto_alt_dial field to campaign screen for auto-dialing of alt numbers +# 70116-1200 - Added auto_alt_dial_status functionality to campaign screen +# 70117-1235 - Added header formatting variables at top of script +# - Moved Call Times and Phones/Server functions to Admin section +# 70118-1706 - Added new user group displays and links +# 70123-1519 - Added user permission settings for all sections +# 70124-1346 - Fixed spelling errors and formatting consistency +# 70202-1120 - Added agent_pause_codes section to campaigns +# 70205-1204 - Added memo, last dialed, timestamp and stats-refresh fields to vicidial_campaigns/lists +# 70206-1323 - Added user setting for vicidial_recording_override +# 70212-1412 - Added system settings section +# 70214-1226 - Added QueueMetrics Log ID field to system settings section +# 70219-1102 - Changed campaign dial statuses to be one string allowing for high limit +# 70223-0957 - Added queuemetrics_eq_prepend for custom ENTERQUEUE prepending of a field +# 70302-1111 - Fixed small bug in dialable leads calculation +# 70314-1133 - Added insert selection on script forms +# 70319-1423 - Added Alter Customer Data and agent disable display functions +# 70319-1625 - Added option to allow agents to login to outbound campaigns with no leads in the hopper +# 70322-1455 - Added sipsak messages parameters +# 70402-1157 - Added HOME link and entry to system_settings table, added QM link on reports section +# 70516-1628 - Started reformatting campaigns to use submenus to break up options +# 70529-1653 - Added help for list mix +# 70530-1354 - Added human_answered field to statuses, added system status modification +# 70530-1714 - Added lists for all campaign subsections +# 70531-1631 - Development on List mix admin interface +# 70601-1629 - More development on List mix admin interface, formatting, and added some javascript +# 70602-1300 - More development on List mix admin interface, more javascript +# 70608-1459 - Added option to set LIVE Callbacks to INACTIVE after one month +# 70612-1451 - Added Callback INACTIVE link for after one week, sort by user/group/entrydate +# 70614-0231 - Added Status Categories, ability to Modify Statuses, moved system statuses to sub-section +# 70623-1008 - List Mix section now allows modification of list mix entries +# 70629-1721 - List Mix section adding and removing of list entries active +# 70706-1636 - List Mix section cleanup and more error-checking +# 70908-0941 - Added agc logile enable system_settings +# 71020-1934 - Added inbound groups options: on-hold music, messages, call_times +# 71022-1343 - Added inbound group ranks for users +# 71029-1710 - Added option for campaign to be inbound and/or blended with no restrictions on the campaign_id name +# - Added 5th NEW and 6th NEW to the dial order options +# 71030-2010 - Added Manual Dial List ID field to campaigns table +# 71103-2207 - Added inbound_group_rank and fewest_calls to the inbound groups call order options +# 71113-1521 - Added campaign_rank to agent options +# - Added ability to Copy a campaign's setting to a new campaign +# 71113-2225 - Added ability to copy user and in-group settings to new users and in-groups +# 71116-0942 - Added campaign_rank and fewest_calls as methods for agent call routing +# 71122-1135 - Added default transfer group for campaigns and inbound groups +# 71125-1751 - Added allowable transfer groups to campaign detail screen +# +# +# make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time + +$admin_version = '2.0.4-119'; +$build = '71125-1751'; + +$STARTtime = date("U"); +$SQLdate = date("Y-m-d H:i:s"); +$MT[0]=''; +$US='_'; + +$month_old = mktime(0, 0, 0, date("m")-1, date("d"), date("Y")); +$past_month_date = date("Y-m-d H:i:s",$month_old); +$week_old = mktime(0, 0, 0, date("m"), date("d")-7, date("Y")); +$past_week_date = date("Y-m-d H:i:s",$week_old); + +if ($force_logout) +{ + if( (strlen($PHP_AUTH_USER)>0) or (strlen($PHP_AUTH_PW)>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "Sie haben jetzt heraus geloggt. Danke\n"; + exit; +} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or ($auth<1)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Unzulässiges Username/Kennwort:|$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT * from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[3]; + $LOGuser_level =$row[4]; + $LOGuser_group =$row[5]; + $LOGdelete_users =$row[8]; + $LOGdelete_user_groups =$row[9]; + $LOGdelete_lists =$row[10]; + $LOGdelete_campaigns =$row[11]; + $LOGdelete_ingroups =$row[12]; + $LOGdelete_remote_agents =$row[13]; + $LOGload_leads =$row[14]; + $LOGcampaign_detail =$row[15]; + $LOGast_admin_access =$row[16]; + $LOGast_delete_phones =$row[17]; + $LOGdelete_scripts =$row[18]; + $LOGdelete_filters =$row[29]; + $LOGalter_agent_interface =$row[30]; + $LOGdelete_call_times =$row[32]; + $LOGmodify_call_times =$row[33]; + $LOGmodify_users =$row[34]; + $LOGmodify_campaigns =$row[35]; + $LOGmodify_lists =$row[36]; + $LOGmodify_scripts =$row[37]; + $LOGmodify_filters =$row[38]; + $LOGmodify_ingroups =$row[39]; + $LOGmodify_usergroups =$row[40]; + $LOGmodify_remoteagents =$row[41]; + $LOGmodify_servers =$row[42]; + $LOGview_reports =$row[43]; + + $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$LOGuser_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGallowed_campaigns =$row[0]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +###################################################################################################### +###################################################################################################### +####### Header settings +###################################################################################################### +###################################################################################################### + + +header ("Content-type: text/html; charset=utf-8"); +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDIAL ADMIN: "; + +if (!isset($ADD)) {$ADD=0;} + +if ($ADD=="1") {$hh='users'; echo "Addieren Sie Neuen Benutzer";} +if ($ADD=="1A") {$hh='users'; echo "Copy Benutzer";} +if ($ADD==11) {$hh='campaigns'; $sh='basic'; echo "Addieren Sie Neue Kampagne";} +if ($ADD==12) {$hh='campaigns'; $sh='basic'; echo "Copy Kampagne";} +if ($ADD==111) {$hh='lists'; echo "Addieren Sie Neue Liste";} +if ($ADD==121) {$hh='lists'; echo "Addieren Sie Neues DNC";} +if ($ADD==1111) {$hh='ingroups'; echo "Addieren Sie Neue In-Gruppe";} +if ($ADD==1211) {$hh='ingroups'; echo "Copy In-Gruppe";} +if ($ADD==11111) {$hh='remoteagent'; echo "Addieren Sie Neue Remotemittel";} +if ($ADD==111111) {$hh='usergroups'; echo "Addieren Sie Neue Benutzer-Gruppe";} +if ($ADD==1111111) {$hh='scripts'; echo "Addieren Sie Neuen Index";} +if ($ADD==11111111) {$hh='filters'; echo "Addieren Sie Neuen Filter";} +if ($ADD==111111111) {$hh='admin'; $sh='times'; echo "Füge neue Anrufzeit hinzu";} +if ($ADD==1111111111) {$hh='admin'; $sh='times'; echo "Füge neue landesspezifische Anrufzeit hinzu";} +if ($ADD==11111111111) {$hh='admin'; $sh='phones'; echo "ADDIEREN SIE NEUES TELEFON";} +if ($ADD==111111111111) {$hh='admin'; $sh='server'; echo "ADDIEREN SIE NEUEN BEDIENER";} +if ($ADD==1111111111111) {$hh='admin'; $sh='conference'; echo "ADDIEREN SIE NEUE KONFERENZ";} +if ($ADD==11111111111111) {$hh='admin'; $sh='conference'; echo "ADD NEW VICIDIAL CONFERENCE";} +if ($ADD=="2") {$hh='users'; echo "Neue Benutzer-Hinzufügung";} +if ($ADD=="2A") {$hh='users'; echo "Neue Kopierte Benutzer-Hinzufügung";} +if ($ADD==20) {$hh='campaigns'; $sh='basic'; echo "Neue Kopierte Kampagne Hinzufügung";} +if ($ADD==21) {$hh='campaigns'; $sh='basic'; echo "Neue Kampagne Hinzufügung";} +if ($ADD==22) {$hh='campaigns'; $sh='status'; echo "Neue Kampagne Status-Hinzufügung";} +if ($ADD==23) {$hh='campaigns'; $sh='hotkey'; echo "New Kampagne HotKey Addition";} +if ($ADD==25) {$hh='campaigns'; $sh='recycle'; echo "Neue Kampagne Leitung Bereiten Hinzufügung Auf";} +if ($ADD==26) {$hh='campaigns'; $sh='autoalt'; echo "Neuer Vorwahlknopf-Status Des Automobil-Alt";} +if ($ADD==27) {$hh='campaigns'; $sh='pause'; echo "Neuer Mittel-Pause Code";} +if ($ADD==28) {$hh='campaigns'; $sh='dialstat'; echo "Kampagne Vorwahlknopf-Status Addiert";} +if ($ADD==29) {$hh='campaigns'; $sh='listmix'; echo "Kampagne Liste Mischung Fügte Hinzu";} +if ($ADD==211) {$hh='lists'; echo "Neue Liste Hinzufügung";} +if ($ADD==2111) {$hh='ingroups'; echo "Neue In-Gruppe Hinzufügung";} +if ($ADD==2011) {$hh='ingroups'; echo "Neue Kopierte In-Gruppe Hinzufügung";} +if ($ADD==21111) {$hh='remoteagent'; echo "Neue Remotemittel-Hinzufügung";} +if ($ADD==211111) {$hh='usergroups'; echo "Neue Benutzer-Gruppe Hinzufügung";} +if ($ADD==2111111) {$hh='scripts'; echo "Neue Index-Hinzufügung";} +if ($ADD==21111111) {$hh='filters'; echo "Neue Filter-Hinzufügung";} +if ($ADD==211111111) {$hh='admin'; $sh='times'; echo "Neue Anrufzeit hinzufügen";} +if ($ADD==2111111111) {$hh='admin'; $sh='times'; echo "Neue landesspezifische Anrufzeit hinzufügen";} +if ($ADD==21111111111) {$hh='admin'; $sh='phones'; echo "ADDIEREN DES NEUEN TELEFONS";} +if ($ADD==211111111111) {$hh='admin'; $sh='server'; echo "ADDIEREN DES NEUEN BEDIENERS";} +if ($ADD==221111111111) {$hh='admin'; $sh='server'; echo "ADDIEREN DES NEUEN STAMM-SATZES DES BEDIENER-VICIDIAL";} +if ($ADD==2111111111111) {$hh='admin'; $sh='conference'; echo "ADDIEREN DER NEUEN KONFERENZ";} +if ($ADD==21111111111111) {$hh='admin'; $sh='conference'; echo "ADDING NEW VICIDIAL CONFERENCE";} +if ($ADD==221111111111111) {$hh='admin'; $sh='status'; echo "ADDIEREN VON VON VICIDIAL SYSTEMSTATUS";} +if ($ADD==231111111111111) {$hh='admin'; $sh='status'; echo "ADDIEREN VON VON VICIDIAL STATUS-KATEGORIE";} +if ($ADD==3) {$hh='users'; echo "Ändern Sie Benutzer";} +if ($ADD==30) {$hh='campaigns'; echo "Kampagne Nicht Erlaubt";} +if ($ADD==31) + { + $hh='campaigns'; $sh='detail'; echo "Ändern Sie Kampagne - Detail - $campaign_id"; + if ($SUB==22) {echo " - Statuses";} + if ($SUB==23) {echo " - HotKeys";} + if ($SUB==25) {echo " -Leitung Bereiten AufEntries";} + if ($SUB==26) {echo " - Auto Alt Dial Statuses";} + if ($SUB==27) {echo " - Agent Pause Codes";} + if ($SUB==29) {echo " - List Mixes";} + } +if ($ADD==32) {$hh='campaigns'; $sh='status'; echo "Kampagne Status";} +if ($ADD==33) {$hh='campaigns'; $sh='hotkey'; echo "Kampagne HotKeys";} +if ($ADD==34) {$hh='campaigns'; $sh='basic'; echo "Ändern Sie Kampagne - Grundlegende Ansicht";} +if ($ADD==35) {$hh='campaigns'; $sh='recycle'; echo "Kampagne Leitung Bereiten Eintragungen Auf";} +if ($ADD==36) {$hh='campaigns'; $sh='autoalt'; echo "Kampagne Selbstalt Vorwahlknopf-Status";} +if ($ADD==37) {$hh='campaigns'; $sh='pause'; echo "Kampagne Mittel-Pause Codes";} +if ($ADD==38) {$hh='campaigns'; $sh='dialstat'; echo "Kampagne Vorwahlknopf-Status";} +if ($ADD==39) {$hh='campaigns'; $sh='listmix'; echo "Kampagne Liste Mischungen";} +if ($ADD==311) {$hh='lists'; echo "Ändern Sie Liste";} +if ($ADD==3111) {$hh='ingroups'; echo "Ändern Sie In-Gruppe";} +if ($ADD==31111) {$hh='remoteagent'; echo "Ändern Sie Remotemittel";} +if ($ADD==311111) {$hh='usergroups'; echo "Ändern Sie Benutzer-Gruppen";} +if ($ADD==3111111) {$hh='scripts'; echo "Ändern Sie Index";} +if ($ADD==31111111) {$hh='filters'; echo "Ändern Sie Filter";} +if ($ADD==311111111) {$hh='admin'; $sh='times'; echo "Bearbeite Anrufzeit";} +if ($ADD==321111111) {$hh='admin'; $sh='times'; echo "Bearbeite Anrufzeit Landdefinitions-Liste";} +if ($ADD==3111111111) {$hh='admin'; $sh='times'; echo "Bearbeite landesspezifische Anrufzeit";} +if ($ADD==31111111111) {$hh='admin'; $sh='phones'; echo "ÄNDERN SIE TELEFON";} +if ($ADD==311111111111) {$hh='admin'; $sh='server'; echo "ÄNDERN SIE BEDIENER";} +if ($ADD==3111111111111) {$hh='admin'; $sh='conference'; echo "ÄNDERN SIE KONFERENZ";} +if ($ADD==31111111111111) {$hh='admin'; $sh='conference'; echo "MODIFY VICIDIAL CONFERENCE";} +if ($ADD==311111111111111) {$hh='admin'; $sh='settings'; echo "ÄNDERN SIE VICIDIAL SYSTEM EINSTELLUNGEN";} +if ($ADD==321111111111111) {$hh='admin'; $sh='status'; echo "ÄNDERN SIE VICIDIAL SYSTEMSTATUS";} +if ($ADD==331111111111111) {$hh='admin'; $sh='status'; echo "ÄNDERN SIE VICIDIAL STATUS-KATEGORIE";} +if ($ADD=="4A") {$hh='users'; echo "Ändern Sie Benutzer - Admin";} +if ($ADD=="4B") {$hh='users'; echo "Ändern Sie Benutzer - Admin";} +if ($ADD==4) {$hh='users'; echo "Ändern Sie Benutzer";} +if ($ADD==41) {$hh='campaigns'; $sh='detail'; echo "Ändern Sie Kampagne";} +if ($ADD==42) {$hh='campaigns'; $sh='status'; echo "Ändern Sie Kampagne Status";} +if ($ADD==43) {$hh='campaigns'; $sh='hotkey'; echo "Ändern Sie Kampagne HotKey";} +if ($ADD==44) {$hh='campaigns'; $sh='basic'; echo "Ändern Sie Kampagne - Grundlegende Ansicht";} +if ($ADD==45) {$hh='campaigns'; $sh='recycle'; echo "Ändern Sie Kampagne Leitung Aufbereiten";} +if ($ADD==47) {$hh='campaigns'; $sh='pause'; echo "Ändern Sie Mittel-Pause Code";} +if ($ADD==49) {$hh='campaigns'; $sh='listmix'; echo "Ändern Sie Kampagne Liste Mischung";} +if ($ADD==411) {$hh='lists'; echo "Ändern Sie Liste";} +if ($ADD==4111) {$hh='ingroups'; echo "Ändern Sie In-Gruppe";} +if ($ADD==41111) {$hh='remoteagent'; echo "Ändern Sie Remotemittel";} +if ($ADD==411111) {$hh='usergroups'; echo "Ändern Sie Benutzer-Gruppen";} +if ($ADD==4111111) {$hh='scripts'; echo "Ändern Sie Index";} +if ($ADD==41111111) {$hh='filters'; echo "Ändern Sie Filter";} +if ($ADD==411111111) {$hh='admin'; $sh='times'; echo "Bearbeite Anrufzeit";} +if ($ADD==4111111111) {$hh='admin'; $sh='times'; echo "Bearbeite landesspezifische Anrufzeit";} +if ($ADD==41111111111) {$hh='admin'; $sh='phones'; echo "ÄNDERN SIE TELEFON";} +if ($ADD==411111111111) {$hh='admin'; $sh='server'; echo "ÄNDERN SIE BEDIENER";} +if ($ADD==421111111111) {$hh='admin'; $sh='server'; echo "ÄNDERN SIE STAMM-SATZ DES BEDIENER-VICIDIAL";} +if ($ADD==4111111111111) {$hh='admin'; $sh='conference'; echo "ÄNDERN SIE KONFERENZ";} +if ($ADD==41111111111111) {$hh='admin'; $sh='conference'; echo "MODIFY VICIDIAL CONFERENCE";} +if ($ADD==411111111111111) {$hh='admin'; $sh='settings'; echo "ÄNDERN SIE VICIDIAL SYSTEM EINSTELLUNGEN";} +if ($ADD==421111111111111) {$hh='admin'; $sh='status'; echo "ÄNDERN SIE VICIDIAL SYSTEMSTATUS";} +if ($ADD==431111111111111) {$hh='admin'; $sh='status'; echo "ÄNDERN SIE VICIDIAL STATUS-KATEGORIEN";} +if ($ADD==5) {$hh='users'; echo "Delete User";} +if ($ADD==51) {$hh='campaigns'; $sh='detail'; echo "Delete Kampagne";} +if ($ADD==52) {$hh='campaigns'; $sh='detail'; echo "Logout-Mittel";} +if ($ADD==53) {$hh='campaigns'; $sh='detail'; echo "Dringlichkeits-VDAC Stau-Freier Raum";} +if ($ADD==511) {$hh='lists'; echo "Delete List";} +if ($ADD==5111) {$hh='ingroups'; echo "Delete In-Group";} +if ($ADD==51111) {$hh='remoteagent'; echo "Löschung-Direktübertragung Mittel";} +if ($ADD==511111) {$hh='usergroups'; echo "Löschung-Benutzer Group";} +if ($ADD==5111111) {$hh='scripts'; echo "Löschung-Index";} +if ($ADD==51111111) {$hh='filters'; echo "Löschung-Filter";} +if ($ADD==511111111) {$hh='admin'; $sh='times'; echo "Lösche Anrufzeit";} +if ($ADD==5111111111) {$hh='admin'; $sh='times'; echo "Lösche landesspezifische Anrufzeit";} +if ($ADD==51111111111) {$hh='admin'; $sh='phones'; echo "DELETE PHONE";} +if ($ADD==511111111111) {$hh='admin'; $sh='server'; echo "DELETE SERVER";} +if ($ADD==5111111111111) {$hh='admin'; $sh='conference'; echo "DELETE CONFERENCE";} +if ($ADD==51111111111111) {$hh='admin'; $sh='conference'; echo "DELETE VICIDIAL CONFERENCE";} +if ($ADD==6) {$hh='users'; echo "Delete User";} +if ($ADD==61) {$hh='campaigns'; $sh='detail'; echo "Delete Kampagne";} +if ($ADD==62) {$hh='campaigns'; $sh='detail'; echo "Logout-Mittel";} +if ($ADD==63) {$hh='campaigns'; $sh='detail'; echo "Dringlichkeits-VDAC Stau-Freier Raum";} +if ($ADD==65) {$hh='campaigns'; $sh='recycle'; echo "Löschung-Leitung Bereiten Auf";} +if ($ADD==66) {$hh='campaigns'; $sh='autoalt'; echo "Selbstalt Vorwahlknopf-Status Der Löschung-";} +if ($ADD==67) {$hh='campaigns'; $sh='pause'; echo "Löschung-Mittel-Pause Code";} +if ($ADD==68) {$hh='campaigns'; $sh='dialstat'; echo "Kampagne Vorwahlknopf-Status Entfernt";} +if ($ADD==69) {$hh='campaigns'; $sh='listmix'; echo "Kampagne Liste Mischung Entfernte";} +if ($ADD==611) {$hh='lists'; echo "Delete List";} +if ($ADD==6111) {$hh='ingroups'; echo "Delete In-Group";} +if ($ADD==61111) {$hh='remoteagent'; echo "Löschung-Direktübertragung Mittel";} +if ($ADD==611111) {$hh='usergroups'; echo "Löschung-Benutzer Group";} +if ($ADD==6111111) {$hh='scripts'; echo "Löschung-Index";} +if ($ADD==61111111) {$hh='filters'; echo "Löschung-Filter";} +if ($ADD==611111111) {$hh='admin'; $sh='times'; echo "Lösche Anrufzeit";} +if ($ADD==6111111111) {$hh='admin'; $sh='times'; echo "Lösche landesspezifische Anrufzeit";} +if ($ADD==61111111111) {$hh='admin'; $sh='phones'; echo "DELETE PHONE";} +if ($ADD==611111111111) {$hh='admin'; $sh='server'; echo "DELETE SERVER";} +if ($ADD==621111111111) {$hh='admin'; $sh='server'; echo "STAMM-SATZ DES LÖSCHUNG-BEDIENER-VICIDIAL";} +if ($ADD==6111111111111) {$hh='admin'; $sh='conference'; echo "DELETE CONFERENCE";} +if ($ADD==61111111111111) {$hh='admin'; $sh='conference'; echo "DELETE VICIDIAL CONFERENCE";} +if ($ADD==73) {$hh='campaigns'; echo "Anzahl anrufbarer Anschlüsse";} +if ($ADD==7111111) {$hh='scripts'; echo "Vorbetrachtung-Index";} +if ($ADD==0) {$hh='users'; echo "Benutzer-Liste";} +if ($ADD==8) {$hh='users'; echo "Wiederholungsbesuche Innerhalb Des Mittels";} +if ($ADD==81) {$hh='campaigns'; $sh='list'; echo "Wiederholungsbesuche Innerhalb Der Kampagne";} +if ($ADD==811) {$hh='lists'; echo "Wiederholungsbesuche Innerhalb Der Liste";} +if ($ADD==8111) {$hh='usergroups'; echo "Wiederholungsbesuche Innerhalb Der Benutzer-Gruppe";} +if ($ADD==10) {$hh='campaigns'; $sh='list'; echo "Kampagnen";} +if ($ADD==100) {$hh='lists'; echo "Listen";} +if ($ADD==1000) {$hh='ingroups'; echo "In-Gruppen";} +if ($ADD==10000) {$hh='remoteagent'; echo "Remotemittel";} +if ($ADD==100000) {$hh='usergroups'; echo "Benutzer-Gruppen";} +if ($ADD==1000000) {$hh='scripts'; echo "Indexe";} +if ($ADD==10000000) {$hh='filters'; echo "Filter";} +if ($ADD==100000000) {$hh='admin'; $sh='times'; echo "Anrufzeiten";} +if ($ADD==1000000000) {$hh='admin'; $sh='times'; echo "Landesspezische Anrufzeiten";} +if ($ADD==10000000000) {$hh='admin'; $sh='phones'; echo "TELEFON-LISTE";} +if ($ADD==100000000000) {$hh='admin'; $sh='server'; echo "BEDIENER-LISTE";} +if ($ADD==1000000000000) {$hh='admin'; $sh='conference'; echo "KONFERENZ-LISTE";} +if ($ADD==10000000000000) {$hh='admin'; $sh='conference'; echo "VICIDIAL KONFERENZ-LISTE";} +if ($ADD==550) {$hh='users'; echo "Suchform";} +if ($ADD==551) {$hh='users'; echo "SUCHTELEFONE";} +if ($ADD==660) {$hh='users'; echo "Suchresultate";} +if ($ADD==661) {$hh='users'; echo "SUCHE RUFT RESULTATE AN";} +if ($ADD==99999) {$hh='users'; echo "HILFE";} +if ($ADD==999999) {$hh='reports'; echo "REPORTS";} + +if ( ($ADD>9) && ($ADD < 99998) ) + { + ##### get scripts listing for dynamic pulldown + $stmt="SELECT script_id,script_name from vicidial_scripts order by script_id"; + $rslt=mysql_query($stmt, $link); + $scripts_to_print = mysql_num_rows($rslt); + $scripts_list="<option value=\"\">NONE</option>\n"; + + $o=0; + while ($scripts_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $scripts_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $scriptname_list["$rowx[0]"] = "$rowx[1]"; + $o++; + } + + ##### get filters listing for dynamic pulldown + $stmt="SELECT lead_filter_id,lead_filter_name,lead_filter_sql from vicidial_lead_filters order by lead_filter_id"; + $rslt=mysql_query($stmt, $link); + $filters_to_print = mysql_num_rows($rslt); + $filters_list="<option value=\"\">NONE</option>\n"; + + $o=0; + while ($filters_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $filters_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $filtername_list["$rowx[0]"] = "$rowx[1]"; + $filtersql_list["$rowx[0]"] = "$rowx[2]"; + $o++; + } + + ##### get call_times listing for dynamic pulldown + $stmt="SELECT call_time_id,call_time_name from vicidial_call_times order by call_time_id"; + $rslt=mysql_query($stmt, $link); + $times_to_print = mysql_num_rows($rslt); + + $o=0; + while ($times_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $call_times_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $call_timename_list["$rowx[0]"] = "$rowx[1]"; + $o++; + } + } + +if ( ( (strlen($ADD)>4) && ($ADD < 99998) ) or ($ADD==3) or (($ADD>20) and ($ADD<70)) or ($ADD=="4A") or ($ADD=="4B") or (strlen($ADD)==12) ) + { + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rslt=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rslt); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $servers_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $o++; + } + + ##### BEGIN get campaigns listing for rankings ##### + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + $campaigns_list=''; + $campaigns_value=''; + $RANKcampaigns_list="<tr><td>CAMPAIGN</td><td>     RANK</td><td>     CALLS</td></tr>\n"; + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $campaigns_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $campaign_id_values[$o] = $rowx[0]; + $campaign_name_values[$o] = $rowx[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + $stmt="SELECT campaign_rank,calls_today from vicidial_campaign_agents where user='$user' and campaign_id='$campaign_id_values[$o]'"; + $rslt=mysql_query($stmt, $link); + $ranks_to_print = mysql_num_rows($rslt); + if ($ranks_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $SELECT_campaign_rank = $row[0]; + $calls_today = $row[1]; + } + else + {$calls_today=0; $SELECT_campaign_rank=0;} + if ( ($ADD=="4A") or ($ADD=="4B") ) + { + if (isset($_GET["RANK_$campaign_id_values[$o]"])) {$campaign_rank=$_GET["RANK_$campaign_id_values[$o]"];} + elseif (isset($_POST["RANK_$campaign_id_values[$o]"])) {$campaign_rank=$_POST["RANK_$campaign_id_values[$o]"];} + + if ($ranks_to_print > 0) + { + $stmt="UPDATE vicidial_campaign_agents set campaign_rank='$campaign_rank', campaign_weight='$campaign_rank' where campaign_id='$campaign_id_values[$o]' and user='$user';"; + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="INSERT INTO vicidial_campaign_agents set campaign_rank='$campaign_rank', campaign_weight='$campaign_rank', campaign_id='$campaign_id_values[$o]', user='$user';"; + $rslt=mysql_query($stmt, $link); + } + + $stmt="UPDATE vicidial_live_agents set campaign_weight='$campaign_rank' where campaign_id='$campaign_id_values[$o]' and user='$user';"; + $rslt=mysql_query($stmt, $link); + } + else {$campaign_rank = $SELECT_campaign_rank;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + # disable non user-group allowable campaign ranks + $stmt="SELECT user_group from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Ruser_group = $row[0]; + + $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$Ruser_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $allowed_campaigns = $row[0]; + $allowed_campaigns = preg_replace("/ -$/","",$allowed_campaigns); + $UGcampaigns = explode(" ", $allowed_campaigns); + + $p=0; $RANK_camp_active=0; $CR_disabled = ''; + if (eregi('-ALL-CAMPAIGNS-',$allowed_campaigns)) + {$RANK_camp_active++;} + else + { + $UGcampaign_ct = count($UGcampaigns); + while ($p < $UGcampaign_ct) + { + if ($campaign_id_values[$o] == $UGcampaigns[$p]) + {$RANK_camp_active++;} + $p++; + } + } + if ($RANK_camp_active < 1) {$CR_disabled = 'DISABLED';} + + $RANKcampaigns_list .= "<tr $bgcolor><td>"; + $campaigns_list .= "<a href=\"$PHP_SELF?ADD=31&campaign_id=$campaign_id_values[$o]\">$campaign_id_values[$o]</a> - $campaign_name_values[$o] <BR>\n"; + $RANKcampaigns_list .= "<a href=\"$PHP_SELF?ADD=31&campaign_id=$campaign_id_values[$o]\">$campaign_id_values[$o]</a> - $campaign_name_values[$o] </td>"; + $RANKcampaigns_list .= "<td>     <select size=1 name=RANK_$campaign_id_values[$o] $CR_disabled>\n"; + $h="9"; + while ($h>=-9) + { + $RANKcampaigns_list .= "<option value=\"$h\""; + if ($h==$campaign_rank) + {$RANKcampaigns_list .= " SELECTED";} + $RANKcampaigns_list .= ">$h</option>"; + $h--; + } + $RANKcampaigns_list .= "</select></td>\n"; + $RANKcampaigns_list .= "<td align=right>     $calls_today</td></tr>\n"; + $o++; + } + ##### END get campaigns listing for rankings ##### + + + ##### BEGIN get inbound groups listing for checkboxes ##### + $xfer_groupsSQL=''; + if ( (($ADD>20) and ($ADD<70)) and ($ADD!=41) ) + { + $stmt="SELECT closer_campaigns,xfer_groups from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + $xfer_groups = $row[1]; + $xfer_groups = preg_replace("/ -$/","",$xfer_groups); + $XFERgroups = explode(" ", $xfer_groups); + $xfer_groupsSQL = preg_replace("/^ | -$/","",$xfer_groups); + $xfer_groupsSQL = preg_replace("/ /","','",$xfer_groupsSQL); + $xfer_groupsSQL = "WHERE group_id IN('$xfer_groupsSQL')"; + } + if ($ADD==41) + { + $p=0; + $XFERgroup_ct = count($XFERgroups); + while ($p < $XFERgroup_ct) + { + $xfer_groups .= " $XFERgroups[$p]"; + $p++; + } + $xfer_groupsSQL = preg_replace("/^ | -$/","",$xfer_groups); + $xfer_groupsSQL = preg_replace("/ /","','",$xfer_groupsSQL); + $xfer_groupsSQL = "WHERE group_id IN('$xfer_groupsSQL')"; + } + + if ( (($ADD==31111) or ($ADD==31111)) and (count($groups)<1) ) + { + $stmt="SELECT closer_campaigns from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + if ($ADD==3) + { + $stmt="SELECT closer_campaigns from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + $stmt="SELECT group_id,group_name from vicidial_inbound_groups order by group_id"; + $rslt=mysql_query($stmt, $link); + $groups_to_print = mysql_num_rows($rslt); + $groups_list=''; + $groups_value=''; + $XFERgroups_list=''; + $RANKgroups_list="<tr><td>INBOUND GROUP</td><td>     RANK</td><td>     CALLS</td></tr>\n"; + + $o=0; + while ($groups_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $group_id_values[$o] = $rowx[0]; + $group_name_values[$o] = $rowx[1]; + $o++; + } + + $o=0; + while ($groups_to_print > $o) + { + $stmt="SELECT group_rank,calls_today from vicidial_inbound_group_agents where user='$user' and group_id='$group_id_values[$o]'"; + $rslt=mysql_query($stmt, $link); + $ranks_to_print = mysql_num_rows($rslt); + if ($ranks_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $SELECT_group_rank = $row[0]; + $calls_today = $row[1]; + } + else + {$calls_today=0; $SELECT_group_rank=0;} + if ( ($ADD=="4A") or ($ADD=="4B") ) + { + if (isset($_GET["RANK_$group_id_values[$o]"])) {$group_rank=$_GET["RANK_$group_id_values[$o]"];} + elseif (isset($_POST["RANK_$group_id_values[$o]"])) {$group_rank=$_POST["RANK_$group_id_values[$o]"];} + + if ($ranks_to_print > 0) + { + $stmt="UPDATE vicidial_inbound_group_agents set group_rank='$group_rank', group_weight='$group_rank' where group_id='$group_id_values[$o]' and user='$user';"; + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="INSERT INTO vicidial_inbound_group_agents set group_rank='$group_rank', group_weight='$group_rank', group_id='$group_id_values[$o]', user='$user';"; + $rslt=mysql_query($stmt, $link); + } + + $stmt="UPDATE vicidial_live_inbound_agents set group_weight='$group_rank' where group_id='$group_id_values[$o]' and user='$user';"; + $rslt=mysql_query($stmt, $link); + } + else {$group_rank = $SELECT_group_rank;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $groups_list .= "<input type=\"checkbox\" name=\"groups[]\" value=\"$group_id_values[$o]\""; + $XFERgroups_list .= "<input type=\"checkbox\" name=\"XFERgroups[]\" value=\"$group_id_values[$o]\""; + $RANKgroups_list .= "<tr $bgcolor><td><input type=\"checkbox\" name=\"groups[]\" value=\"$group_id_values[$o]\""; + $p=0; + $group_ct = count($groups); + while ($p < $group_ct) + { + if ($group_id_values[$o] == $groups[$p]) + { + $groups_list .= " CHECKED"; + $RANKgroups_list .= " CHECKED"; + $groups_value .= " $group_id_values[$o]"; + } + $p++; + } + $p=0; + $XFERgroup_ct = count($XFERgroups); + while ($p < $XFERgroup_ct) + { + if ($group_id_values[$o] == $XFERgroups[$p]) + { + $XFERgroups_list .= " CHECKED"; + $XFERgroups_value .= " $group_id_values[$o]"; + } + $p++; + } + $groups_list .= "> <a href=\"$PHP_SELF?ADD=3111&group_id=$group_id_values[$o]\">$group_id_values[$o]</a> - $group_name_values[$o] <BR>\n"; + $XFERgroups_list .= "> <a href=\"$PHP_SELF?ADD=3111&group_id=$group_id_values[$o]\">$group_id_values[$o]</a> - $group_name_values[$o] <BR>\n"; + $RANKgroups_list .= "> <a href=\"$PHP_SELF?ADD=3111&group_id=$group_id_values[$o]\">$group_id_values[$o]</a> - $group_name_values[$o] </td>"; + $RANKgroups_list .= "<td>     <select size=1 name=RANK_$group_id_values[$o]>\n"; + $h="9"; + while ($h>=-9) + { + $RANKgroups_list .= "<option value=\"$h\""; + if ($h==$group_rank) + {$RANKgroups_list .= " SELECTED";} + $RANKgroups_list .= ">$h</option>"; + $h--; + } + $RANKgroups_list .= "</select></td>\n"; + $RANKgroups_list .= "<td align=right>     $calls_today</td></tr>\n"; + $o++; + } + if (strlen($groups_value)>2) {$groups_value .= " -";} + if (strlen($XFERgroups_value)>2) {$XFERgroups_value .= " -";} + } + ##### END get inbound groups listing for checkboxes ##### + + + ##### BEGIN get campaigns listing for checkboxes ##### + if ( ($ADD==211111) or ($ADD==311111) or ($ADD==411111) or ($ADD==511111) or ($ADD==611111) ) + { + if ( ($ADD==211111) or ($ADD==311111) or ($ADD==511111) or ($ADD==611111) ) + { + $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$user_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $allowed_campaigns = $row[0]; + $allowed_campaigns = preg_replace("/ -$/","",$allowed_campaigns); + $campaigns = explode(" ", $allowed_campaigns); + } + + $campaigns_value=''; + $campaigns_list='<B><input type="checkbox" name="campaigns[]" value="-ALL-CAMPAIGNS-"'; + $p=0; + while ($p<100) + { + if (eregi('ALL-CAMPAIGNS',$campaigns[$p])) + { + $campaigns_list.=" CHECKED"; + $campaigns_value .= " -ALL-CAMPAIGNS- -"; + } + $p++; + } + $campaigns_list.="> ALL-CAMPAIGNS - BENUTZER KÖNNEN JEDE MÖGLICHE KAMPAGNE ANSEHEN</B><BR>\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $campaign_id_value = $rowx[0]; + $campaign_name_value = $rowx[1]; + $campaigns_list .= "<input type=\"checkbox\" name=\"campaigns[]\" value=\"$campaign_id_value\""; + $p=0; + while ($p<100) + { + if ($campaign_id_value == $campaigns[$p]) + { + # echo "<!-- X $p|$campaign_id_value|$campaigns[$p]| -->"; + $campaigns_list .= " CHECKED"; + $campaigns_value .= " $campaign_id_value"; + } + # echo "<!-- O $p|$campaign_id_value|$campaigns[$p]| -->"; + $p++; + } + $campaigns_list .= "> $campaign_id_value - $campaign_name_value<BR>\n"; + $o++; + } + if (strlen($campaigns_value)>2) {$campaigns_value .= " -";} + } + ##### END get campaigns listing for checkboxes ##### + + + if ( (strlen($ADD)==11) or (strlen($ADD)>12) ) + { + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rsltx=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rsltx); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $servers_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $o++; + } + } + + + +$NWB = "   <a href=\"javascript:openNewWindow('$PHP_SELF?ADD=99999"; +$NWE = "')\"><IMG SRC=\"help.gif\" WIDTH=20 HEIGHT=20 Border=0 ALT=\"HILFE\" ALIGN=TOP></A>"; + + +###################################################################################################### +###################################################################################################### +####### 9 series, HELP screen +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=99999 display the HELP SCREENS +###################### + +if ($ADD==99999) +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "
VICIDIAL ADMIN: HILFE


\n"; + +?> +VICIDIAL_BENUTZERTABELLE

+ +
+Benutzernummer - Dieses fangen ist, wohin Sie dieVICIDIAL Benutzernummer Zahl setzen, kann bis 8 Stellen in der Längesein, muß mindestens 2 Buchstaben lang sein auf. + +
+
+
+Kennwort - Dieses fangen ist auf, wohin Sie das VICIDIALBenutzerkennwort setzen. Sein mindestens müssen 2 Buchstaben lang. + +
+
+
+Voller Name - Dieses fangen ist auf, wohin Sie den vollenNamen der VICIDIAL Benutzer setzen. Sein mindestens müssen 2Buchstaben lang. + +
+
+
+Benutzer-Niveau - Dieses Menü ist, wo Sie das VICIDIALBenutzer-Benutzerniveau vorwählen. Sein muß ein Niveau von inVICIDIAL zu loggen 1,, muß waagerecht ausgerichtet grösser sein, alsals genaueres innen zu loggen 2, Benutzerniveau 8 oder grösser seinmüssen, in admin Netzabschnitt zu erhalten. + +
+
+
+Benutzer-Gruppe - Dieses Menü ist, wo Sie die VICIDIALBenutzergruppe vorwählen, daß dieser Benutzer gehört. Dieses hatkeine Beschränkungen diesmal, ist dieses gerecht, Benutzer zuunterteilen und die zukünftigen Eigenschaften zuzulassen, die nachihm gegründet werden. + +
+
+
+Telefon-LOGON - Für hier ist, wo Sie einen RückstellungTelefon-LOGON-Wert wenn die Benutzermaschinenbordbücher invicidial.php einstellen können. Dieser Wert bevölkert dasphone_login automatisch wenn die Benutzermaschinenbordbücher innenmit ihrer Benutzer-überschreiten-Kampagne auf dem vicidial.phpLOGON-Schirm. + +
+
+
+Telefon-Durchlauf - Für hier ist, wo Sie einen RückstellungTelefon-Durchlaufwert wenn die Benutzermaschinenbordbücher invicidial.php einstellen können. Dieser Wert bevölkert die phone_passautomatisch wenn die Benutzermaschinenbordbücher innen mit ihrerBenutzer-überschreiten-Kampagne auf dem vicidial.php LOGON-Schirm. + +
+
+
+Hot Keys aktiv - Diese Wahl, wenn Satz bis 1 dem Benutzer erlaubt,die Hot Keys schnelle-dispositioning Funktion innen zu verwenden vicidial.php. + +
+
+
+Mittel wählen Ingroups - Diese Wahl, wenn Satz bis 1 dem Benutzererlaubt, die ingroups zu wählen, denen sie Anrufe von wenn sie LOGONzu einer GENAUEREN oder INBOUND Kampagne empfangen. Andernfalls mußder Manager dieses auf ihrem Benutzersonderkommandoschirm der adminSeite einstellen. + +
+
+
+Zeitlich geplante Wiederholungsbesuche - Diese Wahl erlaubt einemMittel zur Einteilung einen Anruf als CALLBK und wählt die Daten unddie Zeit, an denen die Leitung reaktiviert wird. + +
+
+
+Mittel-Nur Wiederholungsbesuche - Diese Wahl erlaubt einemVertreter, einen Wiederholungsbesuch einzustellen, damit sie daseinzige Mittel sind, das die Kunde Rückseite benennen kann. Dieseserlaubt auch dem Vertreter, ihre Wiederholungsbesuch Auflistungen zusehen und sie zurück zu benennen, immer wenn sie zu wünschen. + +
+
+
+Vertreter-Anruf-Handbuch - Diese Wahl erlaubt einem Vertreter,eine neue Leitung in das System manuell einzutragen und sie zubenennen. Dieses auch erlaubt das Benennen jeder möglicherTelefonnummer von ihrem vicidial Schirm und setzt diesen Anruf inihren Lernabschnitt. Verwenden Sie diese Wahl mit Vorsicht. + +
+
+
+Vicidial Aufnahme - Diese Wahl kann verhindern, daß ein Mittelalle mögliche Aufnahmen tut, nachdem sie innen in vicidialprotokollieren. Diese Wahl muß eingeschaltet sein, damit vicidial demKampagne Aufnahmelernabschnitt folgt. + +
+
+
+Vicidial Übertragungen - Diese Wahl kann verhindern, daß einMittel die Übertragung - Konferenzlernabschnitt von vicidial öffnet.Wenn dieses untauglich ist, kann das Mittel nicht dritterParteianruf, oder blinde Übertragung irgendeine benennt. + +
+
+
+Genauere Rückstellung gemischt - Diese Wahl fällt einfach dasgemischte checkbox auf einem GENAUEREN LOGON-Schirm zurück. + +
+
+
+VICIDIAL Aufnahme-Übersteuerung - diese Wahl läuft über, was auchimmer die Wahl in der Kampagne für Aufnahme ist. UNTAUGLICH läuftnicht die Kampagne Aufnahmeeinstellung über. NIE sperrt Aufnahme aufdem Klienten. ONDEMAND ist die Rückstellung und erlaubt dem Vertreterzu notieren zu beginnen und, zu stoppen, wie gebraucht. ALLCALLSbeginnt Aufnahme auf dem Klienten, wann immer ein Anruf zu einemMittel geschickt wird. ALLFORCE beginnt Aufnahme auf dem Klienten,wann immer ein Anruf zu einem Mittel geschickt wird, das dem Mittelkeine Wahl gibt, um zu notieren zu stoppen. Für ALLCALLS und ALLFORCEgibt es eine Wahl, zum der Aufnahme zu benutzen verzögert, um untenauf sehr kurze Aufnahmen und recude Anlagen-Belastung zu schneiden. + +
+
+
+Kampagne ordnet - in diesem Abschnitt können Sie den Rank definieren,den ein Mittel für jede Kampagne hat. Diese Rank können gewohntSEIN,bevorzugte Anrufwegewahl zuzulassen, wenn folgender Vertreter-Anrufauf campaign_rank eingestellt wird. + +
+
+
+Inbound Gruppen - Ist hier, wo Sie die inbound Gruppen vorwählen,die Sie Anrufe von empfangen möchten, wenn Sie die GENAUERE Kampagnevorgewählt haben. SieSIND auch in der Lage, den Rank oder Fähigkeit Niveaueinzustellen, in diesem Abschnitt für jede der inbound Gruppen sowieIn der LageSEIN, die Zahl den Anrufen zu sehen, die von jeder inboundGruppe für dieses spezifische Mittel empfangen werden. Auch in diesem Abschnitt ist die Fähigkeit, dem Mittel einen Rankfür jede inbound Gruppe zu geben. Diese Rank können für bevorzugteAnrufwegewahl verwendet werden, wenn diese Wahl auf dem IngruppeSchirm vorgewählt wird. + +
+
+
+Mittel ändern Kunde Daten-Übersteuerung - diese Wahl läuft über,was auch immer die Wahl in der Kampagne für das Ändern von KundeDaten ist. NOT_ACTIVE verwendet, was auch immer Einstellung für dieKampagne anwesend ist. ALLOW_ALTER darf immer, damit das Mittel dieKunde Daten ändert, egal was die Kampagne Einstellung ist.Rückstellung ist NOT_ACTIVE. + +
+
+
+Ändern Sie Mittel-Schnittstelle Wahlen - diese Wahl, wenn Satzbis 1 dem administrativen Benutzer erlaubt, die MittelschnittstelleWahlen in admin.php zu ändern. + +
+
+
+Löschung-Benutzer - Diese Wahl, wenn Satz bis 1 dem Benutzererlaubt, andere Benutzer des Gleichgestellten oder wenigenBenutzerniveaus aus dem System zu löschen. + +
+
+
+Löschung-Benutzer-Gruppen - Diese Wahl, wenn Satz bis 1 demBenutzer erlaubt, Benutzergruppen aus dem System zu löschen. + +
+
+
+Löschung verzeichnet - Diese Wahl, wenn Satz bis 1 dem Benutzererlaubt, vicidial Listen aus dem System zu löschen. + +
+
+
+Löschung wirbt - Diese Wahl, wenn Satz bis 1 dem Benutzererlaubt, vicidial Kampagnen aus dem System zu löschen. + +
+
+
+Löschung In-Gruppen - Diese Wahl, wenn Satz bis 1 dem Benutzererlaubt, vicidial In-Gruppen aus dem System zu löschen. + +
+
+
+Löschung-Remotemittel - Diese Wahl, wenn Satz bis 1 dem Benutzererlaubt, vicidial Remotemittel aus dem System zu löschen. + +
+
+
+Last führt - Diese Wahl, wenn Satz bis 1 dem Benutzer erlaubt,vicidial Leitungen in die vicidial_list Tabelle über die Netzgegründete Leitung Ladevorrichtung zu laden. + +
+
+
+Kampagne Detail - Diese Wahl, wenn Satz bis 1 dem Benutzererlaubt, die Kampagne Detail-Schirmelemente anzusehen und zu ändern. + +
+
+
+AGC Admin Zugang - Diese Wahl, wenn Satz bis 1 den Benutzer zumLOGON zu den astGUIclient admin Seiten erlaubt. + +
+
+
+AGC Löschung-Telefone - Diese Wahl, wenn Satz bis 1 dem Benutzererlaubt, Telefoneintragungen in den astGUIclient admin Seiten zulöschen. + +
+
+
+Löschung-Indexe - Diese Wahl, wenn Satz bis 1 dem Benutzererlaubt, Kampagne Indexe auf dem Indexänderung Schirm zu löschen. + +
+
+
+Ändern Sie Leitungen - Diese Wahl, wenn Satz bis 1 dem Benutzererlaubt, Leitungen in der admin Abschnittleitung Suchresultate Seitezu ändern. + +
+
+
+Ändern Sie Vertreter-Kampagne - Diese Wahl, wenn Satz bis 1 demBenutzer erlaubt, die Kampagne zu ändern, daß ein Mittel in geloggtwird, während sie in es geloggt werden. + +
+
+
+Löschung filtert - Diese Wahl erlaubt dem Benutzer, in der LagezuSEIN, vicidial Leitung Filter aus dem System zu löschen. + +
+
+
+Löschen Anrufzeiten - Diese Option erlaubt dem Nutzer die Vicidial Anrufzeiten Aufzeichnungen und Vicidial Status Anrufzeiten Aufzeichnungen vom System zu löschen. + +
+
+
+Ändere Anrufzeiten - Diese Option erlaubt dem Nutzer das Ansehen und Ändern der Anrufzeiten und Status Anrufzeiten Aufzeichnungen. Ein Nutzer braucht diese Option nicht aktiviert, wenn er nur die Anrufzeit Option auf der Kampagnen-Sicht ändern können muss. + +
+
+
+Ändern Sie Abschnitte - diese Wahlen erlauben dem Benutzer, jedesanzusehen und zu ändern Abschnittaufzeichnungen. Wenn Satz bis 0, derBenutzer in der LageIST, die Abschnittliste, aber nicht das Detailoder den Änderung Schirm einer Aufzeichnung in diesem Abschnitt zusehen. + +
+
+
+Ansicht berichtet - diese Wahl erlaubt dem Benutzer, die VICIDIALReports anzusehen. + + + + +



+ +VICIDIAL_CAMPAIGNSTABELLE

+
+
+Kampagne Identifikation - Dieses ist der kurze Name der Kampagne,es ist nicht editable nach Ausgangsunterordnung, kann nicht Räumeenthalten und muß zwischen 2 und 8 Buchstaben im lengt seinh. + +
+
+
+Kampagne Name - Dieses ist die Beschreibung der Kampagne, muß eszwischen 6 und 40 Buchstaben lang sein. + +
+
+
+Kampagne Beschreibung - dieses ist ein Protokoll auffangenfür die Kampagne, ist es wahlweise freigestellt und kann ein Maximumvon 255 Buchstaben lang sein. + +
+
+
+Kampagne Änderung Datum - dieses ist das letzte Mal, daß dieEinstellungen für diese Kampagne in jeder Hinsicht geändert wurden. + +
+
+
+Letztes Kampagne LOGON-Datum - dieses ist das letzte Mal, daß einMittel in diese Kampagne geloggt wurde. + +
+
+
+Kampagne Notfall erneuern - dieses checkbox erlaubt Ihnen, einenvicidial Notfall zu zwingen erneuern, selbst wenn die Kampagne nichtaktiv ist. + +
+
+
+Aktiv - Dieses ist, wohin Sie die Kampagne auf aktives oderunaktiviertes einstellen. Wenn unaktiviert, kann noone in es loggen. + +
+
+
+Park-Verlängerung - Dieses ist, wo Sie besonders anfertigenkönnen auf-halten Musik für VICIDIAL. Stellen Sie sicher, daß dieVerlängerung im Platz im extensions.conf ist und das, das es auf denDateinamen unten zeigt. + +
+
+
+Park-Dateiname - Dieses ist, wo Sie besonders anfertigen könnenauf-halten Musik für VICIDIAL. Stellen Sie sicher, daß der Dateiname10 Buchstaben lang oder kleiner ist und daß die Akte im Platz im/var/lib/asterisk/sounds Verzeichnis ist. + +
+
+
+Netz-Form - Dieses ist, wo Sie die kundenspezifische Webseiteeinstellen können, die geöffnet ist, wenn der Benutzer an dieNETZ-FORM-Taste klickt. + +
+
+
+Erlauben Sie Closers - Dieses ist, wo Sie einstellen können, obdie Benutzer dieser Kampagne die Wahl haben, zum des Anrufs zu einemgenauerem zu schicken. + +
+
+
+Rückstellung Übergangsgruppe - dieses fangen ist dieRückstellung In-Gruppe auf, die automatisch vorgewählt wird, wenndas Mittel zum Bringenkonferenz Rahmen in ihrer Mittelschnittstellegeht. + +
+
+
+Gewährte Übergangsgruppen - mit diesen checkbox Auflistungen könnenSie die Gruppen vorwählen, denen Mittel in dieser Kampagne bringenkönnen Anrufe zu. Erlauben Sie Closers muß ermöglicht werden, damitdiese Wahl oben darstellt. + +
+
+
+Erlauben Sie Inbound und gemischt - dieses ist, wo Sie einstellenkönnen, ob die Benutzer dieser Kampagne die Wahl haben, zum von voninbound Anrufen mit dieser Kampagne zu nehmen. Wenn Sie gemischtesinbound und outbound tun möchten dann, muß dieses auf Y eingestelltwerden. Wenn Sie nur das outbound Wählen auf dieser Kampagne tunmöchten einstellten dieses auf N. Default sind N. + +
+
+
+Vorwahlknopf-Status - Dieses ist, wohin Sie die Status einstellen,die Sie an innerhalb der Listen wählen wünschen, die für dieKampagne unten aktiv sind. Um einen anderen Status Vorwahlknopf hinzuzufügen, wählen Sie ihnvon der Drop-Down-Liste vor und Klicken FÜGT hinzu. Um einen derVorwahlknopfstatus zu entfernen, klicken Sie an dieENTFERNENVERBINDUNG nahe bei dem Status, den Sie entfernen möchten. + +
+
+
+Liste Auftrag - Dieses Menü ist, wo Sie vorwählen, wie dieLeitungen, die die Status zusammenbringen, die oben vorgewähltwerden, in den Leitung Zufuhrbehälter eingesetzt werden: +
  - DOWN: wählen Sie die ersten Leitungen vor, die in die vicidial_list Tabellegeladen werden +
  - UP: wählen Sie die letzten Leitungen vor, die in die vicidial_listTabelle geladen werden +
  - UP PHONE: wählen Sie die höchste Telefonnummer und die Arbeiten seine Weiseunten vor +
  - DOWN PHONE: wählen Sie die niedrigste Telefonnummer und die Arbeiten seine Weiseoben vor +
  - UP LAST NAME: Anfänge mit letzten Namen beginnend mit Z und Arbeiten seine Weiseunten +
  - DOWN LAST NAME: Anfänge mit letzten Namen beginnend mit A und Arbeiten seine Weiseoben +
  - UP COUNT: Anfänge mit benannten Leitungen und Arbeiten seine Weise unten +
  - DOWN COUNT: Anfänge mit wenigen benannten Leitungen und Arbeiten seine Weiseoben +
  - DOWN COUNT 2nd NEW: Anfänge mit wenigen benannten Leitungen und Arbeiten seine Weise, dieoben eine NEUE Leitung in jeder anderen Leitung einsetzt - dürfenNICHT NEUES haben vorgewählt in den Vorwahlknopfstatus +
  - DOWN COUNT 3nd NEW: Anfänge mit wenigen benannten Leitungen und Arbeiten seine Weise, dieoben eine NEUE Leitung in jeder dritten Leitung einsetzt - dürfenNICHT NEUES haben vorgewählt in den Vorwahlknopfstatus +
  - DOWN COUNT 4th NEW: Anfänge mit wenigen benannten Leitungen und Arbeiten seine Weise, dieoben eine NEUE Leitung in jedem einsetzt weiter, führen Sie - darfNICHT NEUES haben vorgewählt in den Vorwahlknopfstatus + +
+
+
+Zufuhrbehälter waagerecht ausgerichtet - Dieses ist, wieviele dieVDhopper Indexversuche führt, um in der vicidial_hopper Tabelle fürdiese Kampagne zu halten. Wenn Sie VDhopper Index jede Minute laufenlassen, bilden Sie dieses etwas grösser als die Zahl Leitungen, dieSie in eine Minute durchmachen. + +
+
+
+Leitung Filter - Dieses ist eine Methode der Entstörung IhrerLeitungen mit einem Fragment einer SQL Frage. Benutzen Sie dieseFunktion mit Vorsicht, es ist einfach mit, der geringfügigstenÄnderung zur SQL Aussage versehentlich zu wählen zu stoppen.Rückstellung ist KEINE. + +
+
+
+Kraft-Zurückstellen des Zufuhrbehälters - erlaubt dieses Ihnen,aus dem Zufuhrbehälterinhalt nach Formunterordnung abzuwischen. Essollte wieder gefüllt werden, wenn der VDhopper Index läuft. + +
+
+
+Vorwahlknopf-Methode - Dieses fangen ist die Weise, wie auf das Wählen zu definieren, stattfinden soll. Wenn HANDBUCH dann das auto_dial_level bei 0 verschlossen ist, es sei denn Vorwahlknopf-Methode geändert wird. Wenn VERHÄLTNIS dann der Normal, der eine Zeilenzahl für aktive Mittel wählt. ADAPT_HARD_LIMIT wählt predictively bis zum fallengelassenen Prozentsatz und dann erlaubt nicht das konkurrenzfähige Wählen, sobald die Tropfenbegrenzung erreicht wird, bis der Prozentsatz unten wieder geht. ADAPT_TAPERED läßt laufenden Überschuß den fallengelassenen Prozentsatz zur Hälfte erste der Verschiebung zu - wie durch das call_time definiert, das für Kampagne vorgewählt wird und erhält strenger, während die Verschiebung weitergeht. ADAPT_AVERAGE versucht, einen Durchschnitt oder den fallengelassenen Prozentsatz beizubehalten so, die konkurrenzfähig harte Begrenzungen nicht wie die anderen zwei Methoden auferlegen. Sie können nicht das Selbstvorwahlknopf-Niveau ändern, wenn Sie in irgendwelchen der ANPASSENVORWAHLKNOPFMETHODEN sind. Nur der Dialer kann das Vorwahlknopfniveau ändern wenn im vorbestimmten wählenden Modus. + +
+
+
+Selbstvorwahlknopf-Niveau - Dieses ist, wohin Sie einstellen,wieviele VICIDIAL sollte pro Mittel 0 verwenden des aktiven Mittelsnull zeichnet, Automobil, daswählen aus ist und die Mittel klicken,um jede Nummer zu wählen. Andernfalls hält VICIDIALWählverbindungen gleich den aktiven Mitteln, die mit demVorwahlknopfniveau multipliziert werden, um zu, wievielen Linien zukommen diese Kampagne auf jedem Bediener erlauben sollte. Das ANPASSENÜBERSTEUERUNG checkbox erlaubt Ihnen, ein neuesVorwahlknopfniveau zu zwingen, obwohl die Vorwahlknopfmethode in einemANPASSENMODUS ist. Dieses ist nützlich, wenn es eine drastischeVerschiebung in der Qualität der Leitungen gibt und Sie dasdial_level drastisch manuell ändern möchten. + +
+
+
+Vorhandenes nur Tally - dieses fangen auf, wenn Satz zu YINCALL und WARTESCHLANGE Statusmittel ausläßt, wenn er die ZahlAnrufen zum Vorwahlknopf wenn nicht in MANUELLEN Vorwahlknopfmoduserrechnet. Rückstellung ist N. + +
+
+
+Tropfen-Prozentsatz-Begrenzung - dieses fangen ist auf, wohinSie die Begrenzung auf den Prozentsatz der fallengelassenen Anrufe,die einstellten Sie beim Verwenden eineranpassungsfähig-vorbestimmten Vorwahlknopfmethode möchten, nichtMANUELL oder des VERHÄLTNISSES. + +
+
+
+Maximum paßt den waagerecht ausgerichteten Vorwahlknopf an - diesesfangen ist auf, wohin Sie die Begrenzung auf die Begrenzungauf das numbr der Linien, die einstellten Sie gewählt pro Mittel beimVerwenden einer anpassungsfähig-vorbestimmten Vorwahlknopfmethodemöchten, nicht MANUELL oder des VERHÄLTNISSES. Diese Zahl kann alsdas Selbstvorwahlknopf-Niveau höher sein, wenn Ihre Kleinteile esstützen. Wert muß eine positive Nr. grösser als eine sein und kannDezimalstellen Rückstellung 3.0 haben. + +
+
+
+Neueste Bediener-Zeit - dieses fangen wird verwendet nurdurch die ADAPT_TAPERED Vorwahlknopfmethode auf. Sie sollten in dieStunde hereinkommen und Minute, um der Sie stoppen, diese Kampagne zuersuchen, 2100 würde bedeuten, daß Sie stoppen, diese Kampagne bei9PM Bedienerzeit zu wählen. Dieses läßt den sich verjüngendenAlgorithmus entscheiden wie konkurrenzfähig zum Vorwahlknopf durch,wie lang Sie haben, bis Sie fertiges Benennen sind. + +
+
+
+Passen Sie Intensität Modifizierfaktor an - dieses fangenwird verwendet, die vorbestimmte höhere oder niedrigere Intensitätzu justieren entweder auf. Das höhere eine positive Zahl, die Sievorwählen, grösser der Dialer den schreitenen Anruf erhöht, wenn esgeht oben und langsam der Dialer den schreitenen Anruf verringert,wenn es geht unten. Das niedriger die negative Zahl, Sie vorwählenhier, langsam erhöht der Dialer den schreitenen Anruf und schnellersenkt der Dialer den schreitenen Anruf, wenn es geht unten.Rückstellung ist 0. Dieses fangen wird verwendet nicht durchden HANDBUCH- oder VERHÄLTNIS-Vorwahlknopf Methoden auf. + +
+
+
+Vorwahlknopf-waagerecht ausgerichtetes Unterschied-Ziel - diesesfangen wird verwendet zu definieren auf, ob Sie Haben einerspezifischen Anzahl von den Mitteln zielen möchten, die Anruf- oderAnklopfenmittel warten. Z.B. wenn Sie immer auf Durchschnitt einerMittel haben möchten frei, Anrufe sofort zu nehmen, würden Siedieses bis -1 einstellen, wenn Sie ein immer haben zielen möchtenersuchen um den Einfluß, der ein Mittel wartet, das Sie dieses bis 1einstellen würden. Rückstellung ist 0. Dieses fangen wirdverwendet nicht durch den HANDBUCH- oder VERHÄLTNIS-VorwahlknopfMethoden auf. + +
+
+
+Gleichzeitige Übertragungen - diese Einstellung wird benutzt, um dieZahl Anrufen zu definieren, die zu den Mitteln gleichzeitig geschicktwerden können. Es wird empfohlen, daß diese Einstellung am AUTOMOBILgelassen wird. Dieses fangen wird verwendet nicht durch dieMANUELLE Vorwahlknopfmethode auf. + +
+
+
+Wählende SelbstAlt-zahl - diese Einstellung wird benutzt, umwechselnde Nummer automatisch zu wählen auffängt, beimWählen im VERHÄLTNIS und ANPASST Vorwahlknopfmethoden, wenn eskeinen Kontakt an der Haupttelefonnummer für eine Leitung, die Na, B,DC und N Status gibt. Diese Einstellung wird nicht durch die MANUELLEVorwahlknopfmethode benutzt. + +
+
+
+Folgender Vertreter-Anruf - Dieses stellt fest, welches Mittel denfolgenden Anruf empfängt, der vorhanden ist: +
  - random: Aufträge durch den gelegentlichen Updatewert in dervicidial_live_agents Tabelle +
  - oldest_call_start: Aufträge bis zum dem letzten Mal ein Mittel wurden einem Anrufgeschickt. Resultate in den Mitteln, die insgesamt ungefähr gleicheZahl von Anrufen empfangen. +
  - oldest_call_finish: Aufträge bis zum dem letzten Mal ein Mittel beendeten einen Anruf.Das AKA Mittel, das am längsten wartet, empfängt ersten Anruf. +
  - overall_user_level: Aufträge durch das user_level des Mittels, wie inden vicidial_users definiert legen ein höheres user_level empfangenmehr Anrufe ver. +
  - campaign_rank: Aufträge durch den Rank gegeben zum Mittel für dieKampagne. Stark zu am niedrigsten. +
  - fewest_calls: Aufträge durch die Zahl den Anrufen empfangen durch einMittel für diese spezifische inbound Gruppe. Wenige Anrufe zuerst. + +
+
+
+Ortsgespräch-Zeit - Dieses ist, wohin Sie während welcherStunden Sie wählen möchten, wie bis zum der lokalen Zeit infestgestellt sind einstellten in, welchem Sie benennen. Dieses wirddurch Ortsnetzkennzahl gesteuert und wird auf Tageslicht-SparungenZeit eingestellt, wenn anwendbar. Allgemeine Richtlinien in den USAfür Geschäft zum Geschäft ist 9am bis 5pm und Geschäft zu denVerbraucheranrufen ist 9am bis 9pm. + +
+
+
+Vorwahlknopf-Abschaltung - Wenn Sie, Anrufe, die normalerweiseHängezustand wurden, nachdem die Abschaltung, die in extensions.confanstatt Abschaltung an dieser Menge Sekunden definiert wurde wurde,wenn sie kleiner ist, als die extensions.conf Abschaltung definiertwerden. Dieses läßt schnell ändernde Vorwahlknopfabschaltungen vomBediener zum Bediener und zum Begrenzen der Effekte zu einer einzelnenKampagne zu. Wenn Sie eine Menge antwortende Maschine oder VoicemailAnrufe haben, können Sie diesen Wert, bis zwischen 21-26 zu ändernversuchen und sehen wünschen, wenn Resultate verbessern. + +
+
+
+Vorwahlknopf-Präfix - Dieses fangen zuläßt einen Wegdes Wählens leicht ändern auf, zum durch eine andere Methode zuerlöschen, ohne ein Umladen im Sternchen zu tun. Rückstellung ist 9gegründet nach einem 91NXXNXXXXXX im dial plan - extensions.conf. + +
+
+
+Lassen Sie Telefon-Code aus - dieses fangen erlaubt Ihnen,das phone_code auszulassen auffangen beim Wählen innerhalbVICIDIAL auf. Zum Beispiel wenn Sie in Großbritannien vonGroßbritannien wählen, würden Sie 44 innen haben, wie Ihrphone_code für alle Leitungen auffangen, aber Sie gerade 10Stellen in Ihrem dial plan extensions.conf wählen möchten, um Anrufeanstelle von 44 dann 10 Stellen zu setzen. Rückstellung ist N. + +
+
+
+Kampagne CallerID - Dieses fangen zuläßt das Senden einer kundenspezifischen callerid Zahl bei den outbound Anrufen auf. Dieses ist die Zahl, die oben auf dem callerid der Person darstellen würde, die, Sie anrufen. Die Rückstellung ist UNBEKANNT. Wenn Sie T1 benutzen, oder Eß, zum dieser Wahl heraus zu wählen nur vorhanden ist, wenn Sie PRIs verwenden - ISDN Tß oder Eß - die die kundenspezifische callerid Eigenschaft haben, die eingeschaltet wird, arbeitet dieses nicht mit Berauben-Spitze Service - RBS- Stromkreise. Dieses arbeitet auch durch das meiste VOIP - SIP oder IAX Stammversorger, die dynamisches outbound callerID erlauben. Das kundenspezifische callerID trifft nur auf die Anrufe zu, die direkt für die VICIDIAL Kampagne gesetzt werden, benennt jede mögliche 3. Partei, oder Übertragungen senden nicht das kundenspezifische callerID. ANMERKUNG: UNBEKANNT oder PRIVAT in auffangen manchmal sich setzen erbringt das Senden Ihrer Rückstellung callerID Zahl durch Ihre Fördermaschine mit den Anrufen. Sie können dieses prüfen wünschen und fangen 0000000000 in das callerid sich zu setzen anstatt auf, wenn Sie nicht Ihnen CallerID schicken möchten. + +
+
+
+Kampagne VDAD Verlängerung - Dieses fangen zuläßt eineGewohnheit VDAD Übergangsverlängerung auf. Dieses erlaubt Ihnen,unterschiedliche VDADtransfer... agi Indexe zu benutzen, abhängendnach Ihrer Kampagne. Die Rückstellung Übertragung AGI - exten 8365agi-VDADtransfer.agi - gerade sendet sofort ersucht zu den Mitteln,sobald sie aufgehoben werden. Eine zusätzliches BeispielpolitischeÜbersicht AGI ist auch jetzt eingeschlossenes - 8366agi-VDADtransferSURVEY.agi - dieses Spiele eine Anzeige zurangerufenen Person und läßt sie eine Wahl treffen, indem sie Tastenbetätigt - effektiv Vorsiebung die Leitung -. Merken Sie bitte dasaußer Übersichten, politische Anrufe und Nächstenliebe diese Formdes Benennens ist in den Vereinigten Staaten ungültig. + +
+
+
+Kampagne Rec Verlängerung - Dieses fangen darf auf,damit eine kundenspezifische Aufnahmeverlängerung mit VICIDIALverwendet werden kann. Dieses erlaubt Ihnen, unterschiedlicheVerlängerungen zu verwenden, abhängend nach, wie lang Sie einemaximale Aufnahme erlauben möchten und welcher Art von Codec Sieinnen notieren möchten. Die Rückstellung exten ist 8309, die, wennSie folgen die SCRATCH_INSTALL Beispiele im WAV Format bis zu einerStunde lang notieren. Eine andere Wahl, die in den Beispieleneingeschlossen ist, ist 8310, die im G/M Format bis zu einer Stundelang notieren. + +
+
+
+Kampagne Aufnahme - dieses Menü erlaubt Ihnen, zu wählen, welchesNiveau der Aufnahme auf dieser Kampagne erlaubt wird. NIE sperrtAufnahme auf dem Klienten. ONDEMAND ist die Rückstellung und erlaubtdem Vertreter zu notieren zu beginnen und, zu stoppen, wie gebraucht.ALLCALLS beginnt Aufnahme auf dem Klienten, wann immer ein Anruf zueinem Mittel geschickt wird. ALLFORCE beginnt Aufnahme auf demKlienten, wann immer ein Anruf zu einem Mittel geschickt wird, das demMittel keine Wahl gibt, um zu notieren zu stoppen. Für ALLCALLS undALLFORCE gibt es eine Wahl, zum der Aufnahme zu benutzen verzögert,um unten auf sehr kurze Aufnahmen und recude Anlagen-Belastung zuschneiden. + +
+
+
+Kampagne Rec Dateiname - Dieses fangen erlaubt Ihnen, denNamen der Aufnahme besonders anzufertigen auf, wenn Kampagne AufnahmeONDEMAND oder ALLCALLS ist. Die erlaubten Variablen sind KAMPAGNECUSTPHONE FULLDATE TINYDATE EPOCHE-MITTEL. Die Rückstellung istFULLDATE_MITTELund würde wie dieses 20051020-103108_6666 aussehen.Ein anderes Beispiel ist CAMPAIGN_TINYDATE_CUSTPHONE, das wie diesesTESTCAMP_51020103108_3125551212 aussehen würde. 50 char max. + +
+
+
+Das Notieren verzögert - für ALLCALLS und ALLFORCE nur Aufnahme.Dieser Einstellung Wille verzögert das Beginnen der Aufnahme beiallen Anrufen für die Zahl den Sekunden, die diesbezüglichspezifiziert werden, auffangen. Rückstellung ist 0. + +
+
+
+Kampagne Index - Dieses Menü erlaubt Ihnen, den Index zu wählen,der auf dem Mittelschirm für diese Kampagne erscheint. Wählen SieKEINE vor, keinen Index für diese Kampagne zu zeigen. + +
+
+
+Erhalten Sie Anruf-Produkteinführung - Dieses Menü erlaubt Ihnenzu wählen, ob Sie Automobil-ausstoßen die Netz-Form Seite in einemunterschiedlichen Fenster, Auto-switch zum INDEX-Vorsprung oder tunnichts wünschen, wenn ein Anruf zum Mittel für diese Kampagnegeschickt wird. + +
+
+
+Antwortende Maschine Anzeige - Dieses fangen ist für dasHereinkommen auf, in eine Verlängerung, zum von von Übergangsanrufenzu blind zu machen, wenn das Mittel eine antwortende Maschine erhältund an die antwortende Maschine Anzeige Taste imÜbergangskonferenzrahmen klickt. Sie müssen dieses einstellen extenoben im dial plan - extensions.conf - und sicherstellen, daß esspielt, eine Audioakte dann oben hängt. + +
+
+
+AMD senden zu VM exten - erlaubt dieses Menü Ihnen zu definieren,ob eine Anzeige auf einer antwortenden Maschine gelassen wird, wennihr der Anruf wird sofort nachgeschickt zur Antworten-Maschine-AnzeigeVerlängerung ermittelt wird, wenn AMD aktiv ist und es festgestelltwird, daß der Anruf eine antwortende Maschine ist. + +
+
+
+Xfer-Conf DTMF - Diese vier fängt dürfen auf, damit Siezwei Sätze Übergangskonferenz und DTMF Voreinstellungen haben. Wennder Anruf oder die Kampagne geladen wird, stellt der vicidial.phpIndex dar, daß zwei Tasten auf dem Bringenkonferenz Rahmen und denZahl-zu-Vorwahlknopf und senden-dtmf Automobil-zu bevölkernauffängt, wenn sie betätigt werden. Wenn Sie beratende Übertragungen erlauben möchten, ein fronter zueinem genauerem, können Sie CXFER setzen, da eins derZahl-zu-Vorwahlknopf Voreinstellungen und des korrekten dial stringsgesendet wird, um eine lokale beratende Übertragung, dann dieMitteldose gerechtes LEAVE-3WAY-CALL und Bewegung an zu tun zu ihremfolgenden Anruf. Wenn Sie blinde Übertragungen der Kunden auf einenVICIDIAL AGI Index für die Protokollierung oder ein IVR erlaubenmöchten, legen Sie dann AXFER in den Zahl-zu-Vorwahlknopfauffangen. Sie können eine kundenspezifische Verlängerungnach dem AXFER oder dem CXFER auch spezifizieren, zum Beispiel wennSie interne beratende Übertragungen anstelle vom Einheimischen tunmöchten, würden Sie CXFER90009 in den Zahl-zu-Vorwahlknopfauffangen einsetzen. + +
+
+
+Numerisches Wählen des Mittel-Alt - erlaubt diese Wahl einemVertreter, die wechselnde Telefonnummer manuell zu wählen, oderaddress3 fangen auf, nachdem die Hauptzahl benannt wordenist. + +
+
+
+Zeitlich geplante Wiederholungsbesuche - Diese Wahl erlaubt einemMittel zur Einteilung einen Anruf als CALLBK und wählt die Daten unddie Zeit, an denen die Leitung reaktiviert wird. + +
+
+
+Sekunden zur Verbindung - Anzahl der Sekunden vom Abnehmen des Kunden bis zur Erkennung als Verbindung, betrifft nur abgehende Verbindungen. + +
+
+
+Voicemail - Wenn sie definiert werden, würden Anrufe, dienormalerweise FALLEN würden, anstatt auf diesen voicemail Kastenverwiesen, um eine Anzeige zu hören und zu lassen. + +
+
+
+Sicherheitsnachricht - Wenn auf Y gesetzt wird dem Kunden nach Ablauf der Sekunden zur Verbindung, ohne zu einem Agenten verbunden worden zu sein, eine Nachricht abgespielt. Diese Einstellung setzt die Option Senden zu einer Voicemail Kasten ausser Kraft, wenn diese auf Y steht. + +
+
+
+Sicherheitsnebenstelle - Dies ist die Wählplan Nebenstelle, wo sich die gewünschte Sicherheits-Audiodatei auf Ihrem Server befindet. + +
+
+
+Sekunden Nachbereitung - Anzahl der Sekunden, die ein Agent bis zum nächsten erhaltenen Anruf oder Wählen eines anderen Anrufs warten muss. Die Zeit beginnt, sobald ein Agent bei seinem Kunden aufgelegt hat - oder im Fall der alternativen Nummernwahl, wenn ein Agent das Telefonat beendet - Standard ist 0 Sekunden. Wenn die Zeit abgelaufen ist bevor der Agent den Anruf eingeordnet hat, wird der Agent dennoch nicht zum nächsten Anruf kommen, bevor er eine Einteilung gewählt hat. + +
+
+
+Nachbereitungsnachricht - Dies ist eine Kampagnen-spezifische Nachricht, die bei gesetzten Sekunden Nachbereitung auf dem Nachbereitungsbildschirm angezeigt wird. + +
+
+
+Interne DNC Liste des Gebrauch-- definiert dieses, ob dieseKampagne Leitungen gegen die interne DNC Liste filtern soll. Wenn esauf Y eingestellt wird, sucht der Zufuhrbehälter nach jederTelefonnummer in der DNC Liste, bevor er sie in den Zufuhrbehälterlegt. Wenn er in der DNC Liste ist, dann, das sie dieses führt Statuszu DNCL also ändert, kann sie nicht gewählt werden. Rückstellungist N. + +
+
+
+Gewährte Inbound Gruppen - For CLOSER campaigns only. Here is where you select the inbound groups you want agents in this CLOSER campaign to be able to take calls from. It is important for BLENDED inbound-outbound campaigns only to select the inbound groups that are used for agents in this campaign. The calls coming into the inbound groups selected here will be counted as active calls for a blended campaign even if all agents in the campaign are not logged in to receive calls from all of those selected inbound groups. + +
+
+
+Mittel-Pause kodiert aktives - läßt Mittel einen Pause Codevorwählen, wenn sie an die PAUSE Taste in vicidial.php klicken. PauseCodes sind pro Kampagne am unteren Bildschirmrand KampagneAnsichtdetail definierbar und sie werden in der vicidial_agent_logTabelle gespeichert. Rückstellung ist N. + +
+
+
+Sperren Sie ändern Kunde Daten - wenn Satz zu Y, nicht irgendwelchedes Kunde Datensatzes wenn Einteilungen eines Mittels der Anrufändert. Rückstellung ist N. + +
+
+
+Gewähren Sie Kein-Zufuhrbehälter-Führt LOGON - wenn Satz zu Y,Mittel zum LOGON zur Kampagne erlaubt, selbst wenn es keine Leitungengibt, die in den Zufuhrbehälter für diese Kampagne geladen werden.Diese Funktion wird nicht in den CLOSER-type Kampagnen benötigt.Rückstellung ist N. + +
+
+
+Liste Auftrag Mischung - läuft den Leitung Auftrag über undVorwahlknopf-Status fängt auf. Verwendet die Liste undStatusparameter für die vorgewählte Liste Mischung Eintragung imListe Mischung Unterseebootabschnitt anstatt. Rückstellung istUNTAUGLICH. + +
+
+
+Liste Mischung Identifikation - Identifikation der Liste Mischung.Muß von 2-20 Buchstaben lang ohne Räume oder andere spezielleInterpunktion sein. + +
+
+
+Liste Mischung Name - beschreibender Name der Liste Mischung. Muß von2-50 Buchstaben lang sein. + +
+
+
+Liste Mischung Detail - der Aufbau der Liste Mischung Eintragung.Enthält die Liste Identifikation, Mischung Auftrag, Prozentsätze undStatus, die diese Liste Mischung bilden. Die Prozentsätze müssen bis100 immer addieren, und alle Listen müssen aktiv und eingestellt aufdie Kampagne sein, damit die Auftrag Mischung Eintragung aktiviertwerden kann. + +
+
+
+Liste Mischung Methode - die Methode von alle Teile des Liste MischungDetails zusammen mischen. EVEN_MIX mischt Leitungen von jedem Teil,das mit den anderen Teilen, wie diese 1.2.3.1.2.3.1.2.3 durchgeschobenwird. IN_ORDER setzt die Leitungen in den Auftrag ein, in dem sie aufdem Liste Mischung Detailschirm 1.1.1.2.2.2.3.3.3 verzeichnet werden.GELEGENTLICHER Wille setzte sie in GELEGENTLICHEN Auftrag1.3.2.1.1.3.2.1.3 ein. Rückstellung ist IN_ORDER. + +
+
+
+Manuelle Vorwahlknopf-Liste Identifikation - das verwendet zu werdenRückstellung list_id, wenn ein Mittel placces ein manueller Anruf undeine neue Leitung Aufzeichnung im vicidial_list verursacht wird.Rückstellung ist 999. Dieses fangen kann nur Stellenenthalten auf. + + + + +



+ +VICIDIAL_LISTENTABELLE

+
+
+Liste Identifikation - Dieses ist der numerische Name der Liste,es ist nicht editable nach Ausgangsunterordnung, muß nur Zahlenenthalten und muß zwischen 2 und 8 Buchstaben lang sein. Must be a number greater than 100. + +
+
+
+Liste Name - This is the description of the list, it must be between 2 and 20 characters in length. + +
+
+
+Liste Beschreibung - dieses ist das Protokoll auffangen fürdie Liste, es ist wahlweise freigestellt. + +
+
+
+Liste Änderung Datum - dieses ist das letzte Mal, daß dieEinstellungen für diese Liste in jeder Hinsicht geändert wurden. + +
+
+
+Liste Letzt-Anruf-Datum - dieses ist das letzte Mal, das wurdegewählt von dieser Liste führen. + +
+
+
+Kampagne - This is the campaign that this list belongs to. A list can only be dialed on a single campaign at one time. + +
+
+
+Aktiv - Dieses definiert, ob die Liste an oder nicht gewähltwerden soll. + +
+
+
+Stellen Sie Führen-Benennen-Status für diese Liste - zurückstellt dieses alle Leitungen in dieser Liste zu N für das benannte\"not da letztes Zurückstellen \" zurück und bedeutet, daß jedemögliche Leitung jetzt benannt werden kann, wenn es der rechte Statusist, wie auf dem Kampagne Schirm definiert. + +
+
+
+VICIDIAL DNC Liste - Dieses benennen nicht Liste enthält jedeLeitung, die auf einen Status von DNC im System eingestellt wordenist. Durch die LISTEN - FÜGEN Sie ZAHL DNC Seite hinzu, die Sie inder LageSIND, eine Zahl dieser Liste manuell hinzuzufügen, damit sienicht durch Kampagnen benannt wird, die die interne DNC Listebenutzen. + + + +



+ +VICIDIAL_INBOUND_GROUPSTABELLE

+
+
+Gruppe Identifikation - Dieses ist der kurze Name der inboundGruppe, es ist nicht editable nach Ausgangsunterordnung, darf keineRäume enthalten und muß zwischen 2 und 20 Buchstaben lang sein. + +
+
+
+Gruppe Name - Dieses ist die Beschreibung der Gruppe, muß eszwischen 2 und 30 Buchstaben lang sein. Kann nicht Schläge, plussesoder Räume einschließen . + +
+
+
+Gruppe Farbe - Dieses ist die Farbe, die in der VICIDIAL KlientAPP anzeigt, wenn ein Anruf auf diese Gruppe hereinkommt. Es mußzwischen 2 und 7 Buchstaben lang sein. Wenn dieses eine HexagonfarbeDefinition ist, müssen Sie sich erinnern, sich a # am Anfang derZeichenkette zu setzen, oder VICIDIAL arbeitet nicht richtig. + +
+
+
+Aktiv - Dieses stellt fest, ob diese Gruppe oben imVorwählerkasten wenn Maschinenbordbücher eines VICIDIAL Mittelsinnen zeigen. + +
+
+
+Netz-Form - Dieses ist die kundenspezifische Adresse, die dasKlicken auf der NETZ-FORM-Taste in VICIDIAL Ihnen für zu den Anrufennimmt, die auf diese Gruppe hereinkommen. + +
+
+
+Folgender Vertreter-Anruf - Dieses stellt fest, welches Mittel denfolgenden Anruf empfängt, der vorhanden ist: +
  - random: Aufträge durch den gelegentlichen Updatewert in dervicidial_live_agents Tabelle +
  - oldest_call_start: Aufträge bis zum dem letzten Mal ein Mittel wurden einem Anrufgeschickt. Resultate in den Mitteln, die insgesamt ungefähr gleicheZahl von Anrufen empfangen. +
  - oldest_call_finish: Aufträge bis zum dem letzten Mal ein Mittel beendeten einen Anruf.Das AKA Mittel, das am längsten wartet, empfängt ersten Anruf. +
  - overall_user_level: Aufträge durch das user_level des Mittels, wie inden vicidial_users definiert legen ein höheres user_level empfangenmehr Anrufe ver. +
  - inbound_group_rank: Aufträge durch den Rank gegeben zum Mittel fürdie spezifische inbound Gruppe. Stark zu am niedrigsten. +
  - fewest_calls: Aufträge durch die Zahl den Anrufen empfangen durch einMittel für diese spezifische inbound Gruppe. Wenige Anrufe zuerst. +
  - campaign_rank: Aufträge durch den Rank gegeben zum Mittel für dieKampagne. Stark zu am niedrigsten. +
  - fewest_calls_campaign: orders by the number of calls received by an agent for the campaign. Least calls first. +
+
+
+Fronter Anzeige - Dieses fangen feststellt auf, ob dasinbound VICIDIAL Mittel den fronter Namen - wenn es einen gibt -angezeigt im Status auffangen haben würde, wann der Anrufzum Mittel kommt. + +
+
+
+Kampagne Index - Dieses Menü erlaubt Ihnen, den Index zu wählen,der auf dem Mittelschirm für diese Kampagne erscheint. Wählen SieKEINE vor, keinen Index für diese Kampagne zu zeigen. + +
+
+
+Erhalten Sie Anruf-Produkteinführung - Dieses Menü erlaubt Ihnenzu wählen, ob Sie Automobil-ausstoßen die Netz-Form Seite in einemunterschiedlichen Fenster, Auto-switch zum INDEX-Vorsprung oder tunnichts wünschen, wenn ein Anruf zum Mittel für diese Kampagnegeschickt wird. + +
+
+
+Xfer-Conf DTMF - Diese vier fängt dürfen auf, damit Siezwei Sätze Übergangskonferenz und DTMF Voreinstellungen haben. Wennder Anruf oder die Kampagne geladen wird, stellt der vicidial.phpIndex dar, daß zwei Tasten auf dem Bringenkonferenz Rahmen und denZahl-zu-Vorwahlknopf und senden-dtmf Automobil-zu bevölkernauffängt, wenn sie betätigt werden. Wenn Sie beratende Übertragungen erlauben möchten, ein fronter zueinem genauerem, können Sie CXFER setzen, da eins derZahl-zu-Vorwahlknopf Voreinstellungen und des korrekten dial stringsgesendet wird, um eine lokale beratende Übertragung, dann dieMitteldose gerechtes LEAVE-3WAY-CALL und Bewegung an zu tun zu ihremfolgenden Anruf. Wenn Sie blinde Übertragungen der Kunden auf einenVICIDIAL AGI Index für die Protokollierung oder ein IVR erlaubenmöchten, legen Sie dann AXFER in den Zahl-zu-Vorwahlknopfauffangen. Sie können eine kundenspezifische Verlängerungnach dem AXFER oder dem CXFER auch spezifizieren, zum Beispiel wennSie interne beratende Übertragungen anstelle vom Einheimischen tunmöchten, würden Sie CXFER90009 in den Zahl-zu-Vorwahlknopfauffangen einsetzen. + +
+
+
+Sekunden zur Verbindung - Anzahl der Sekunden vom Abnehmen des Kunden bis zur Erkennung als Verbindung, betrifft nur abgehende Verbindungen. + +
+
+
+Voicemail - Wenn sie definiert werden, würden Anrufe, dienormalerweise FALLEN würden, anstatt auf diesen voicemail Kastenverwiesen, um eine Anzeige zu hören und zu lassen. + +
+
+
+Verbindungs-Nachricht- Wenn auf Y gesetzt wird dem Kunden nach Ablauf der Sekunden zur Verbindung, ohne zu einem Agenten verbunden worden zu sein, eine Nachricht abgespielt. Diese Einstellung setzt die Option Senden zu einer Voicemail Kasten ausser Kraft, wenn diese auf Y steht. + +
+
+
+Verbindungs-Nebenstelle - Dies ist die Wählplan-Nebenstelle, wo sich die gewünschte Audiodatei für die aufgebaute Verbindung auf Ihrem Server befindet. + +
+
+
+Anruf-Zeit - dieses ist der für diese inbound Gruppe zu verwendenAnrufzeitentwurf. Halten Sie im Verstand, daß die Zeit auf derBedienerzeit basiert. Rückstellung ist 24hours. + +
+
+
+Nach Stunden Tätigkeit - die Tätigkeit zum durchzuführen, wenn sienach Stunden ist, wie in der Anrufzeit für diese inbound Gruppedefiniert. HÄNGEZUSTAND-Willenssofort Hängezustand der Anruf,MESSASGE spielt die Akte in nach Stunden Anzeige Filenamauffangen, schickt VERLÄNGERUNG den Anruf zu nach StundenVerlängerung im dialplan und VOICEMAIL schickt den Anruf zumvoicemail Kasten, der in nach Stunden Voicemail verzeichnet wird,auffangen. Rückstellung ist ANZEIGE. + +
+
+
+Nach Stunden Anzeige Dateinamen - die Audioakte gelegen auf demgespielt zu werden Bediener, wenn die Tätigkeit auf ANZEIGEeingestellt wird. Rückstellung ist VM-Auf Wiedersehen + +
+
+
+Nach Stunden Verlängerung - die dialplan Verlängerung, zum desAnrufs zu senden, wenn die Tätigkeit auf VERLÄNGERUNG eingestelltwird. Rückstellung ist 8300. + +
+
+
+Nach Stunden Voicemail - der voicemail Kasten, zum des Anrufs zusenden, wenn die Tätigkeit auf VOICEMAIL eingestellt wird. + +
+
+
+Willkommener Anzeige Dateiname - die Audioakte gelegen auf demgespielt zu werden Bediener, wenn der Anruf hereinkommt. Wenn Satz zu---NONE --- dann wird keine Anzeige gespielt. Rückstellung ist---NONE --- + +
+
+
+Musik auf Einfluß-Kontext - die Musik auf dem Einflußkontext, zum zuverwenden, wann der Kunde auf Einfluß gesetzt wird. Rückstellung istRückstellung. + +
+
+
+Auf Einfluß-Aufforderung Dateinamen - die Audioakte gelegen auf demin einem regelmäßigen Abstand gespielt zu werden Bediener, wenn derKunde auf Einfluß ist. Rückstellung ist generic_hold. DieseAudioakte MUSS 9 Sekunden oder kleiner in der Länge sein. + +
+
+
+Auf Einfluß-Aufforderung Abstand - die Zeitspanne in den Sekunden, zuwarten, bevor an die haltenaufforderung gespielt wird. Rückstellungist 60. + +
+
+
+Mittel-Alarmverlängerung - die, um zu verkünden, daß in denVertreterlernabschnitt zu senden Verlängerung, ein Anruf zum Mittelkommt. Diese Verlängerung sollte ein Playback einer Audioakte haben.Diese Funktion nicht zu verwenden stellte dieses auf X. Default ist Xein. + +
+
+
+Mittel-Alarm verzögert - die Zeitspanne in den Millisekunden, zuwarten, bevor er den Anruf zum Mittel schickt, nachdem er an dieMittel-Alarmverlängerung gespielt hat. Rückstellung ist 1000. + +
+
+
+Rückstellung Übergangsgruppe - dieses fangen ist dieRückstellung In-Gruppe auf, die automatisch vorgewählt wird, wenndas Mittel zum Bringenkonferenz Rahmen in ihrer Mittelschnittstellegeht. + + + +



+ +VICIDIAL_REMOTE_AGENTSTABELLE

+
+
+Benutzernummer Anfang - Dieses ist die beginnende Benutzernummer,die verwendet wird, wenn die Remotemitteleintragungen in das Systemeingesetzt werden. Wenn die Zeilenzahl in hohem Grade als 1eingestellt wird, wird diese Zahl durch eine erhöht, bis jede Linieeine Eintragung hat. Stellen Sie, ein neues VICIDIAL Benutzerkonto miteinem Benutzerniveau von 4 zu verursachen oder groß sicher, wenn Siesie in der LageSEIN wünschen, die vdremote.php Seite fürRemotenetzzugang dieses Kontos zu benutzen. + +
+
+
+Zeilenzahl - Dieses definiert, wievieles Remotemittel Eintragungendas System verursacht, und stellt fest, wieviele Linien es denkt, daßes zur Zahl unter sicher senden kann. + +
+
+
+Bediener IP - Eine Remotemitteleintragung ist für einenspezifischen Bediener, ist hier nur gut, wo Sie vorwählen, dasBediener Sie wünschen. + +
+
+
+Externe Verlängerung - Dieses ist die Zahl, daß Sie die Anrufewünschen, die zu nachgeschickt werden. Überprüfen Sie, ob es einevolle dial plan Zahl ist und daß, wenn Sie 9 am Anfang benötigen, Sieihn innen hier setzen. Prüfen Sie, indem Sie diese Nummer von einemTelefon auf dem System wählen. + +
+
+
+Status - Ist hier, wo Sie das Remotemittel an und abstellen.Sobald das Mittel aktiv ist, nimmt das System an, daß es Anrufe zuihm schicken kann. Es kann bis 30 Sekunden dauern, sobald Sie denStatus zu unaktiviertem ändern, um Anrufe, zu empfangen zu stoppen. + +
+
+
+Kampagne - Ist hier, wo Sie die Kampagne vorwählen, daß dieseRemotemittel in geloggt werden. Inbound Notwendigkeiten, die GENAUEREKampagne zu verwenden und die inbound Kampagnen unter dervorzuwählen, die Sie Anrufe von empfangen möchten. + +
+
+
+Inbound Gruppen - Ist hier, wo Sie die inbound Gruppen vorwählen,die Sie Anrufe von empfangen möchten, wenn Sie die GENAUERE Kampagnevorgewählt haben. + + +



+ +VICIDIAL_CAMPAIGN_LISTEN

+
+
+Die Listen innerhalb dieser Kampagne werden hier verzeichnet, ob siewerden bezeichnet durch das Y aktiv sind, oder N und Sie zum ListeSchirm gehen können, indem sie auf der Liste Identifikation in derersten Spalte klicken. + + +



+ +VICIDIAL_CAMPAIGN_STATUSESTABELLE

+
+
+Durch den Gebrauch von kundenspezifischen Kampagne Status, können SieStatus haben, die nur für eine spezifische Kampagne bestehen. DerStatus muß 1-8 Buchstaben lang sein, muß die Beschreibung 2-30Buchstaben lang sein und auswählbar definiert, ob es oben in VICIDIALals Einteilung zeigt. Human_answered auffangen wird verwendet, als, denTropfenprozentsatz oder Ungezwungenheit Rate errechnend. Einstellunghuman_answered zu Y verwendet diesen Status, als, diemenschlich-geantworteten Anrufe zählend. Die Kategorie Wahl erlaubt Ihnen, einige Status in ein catogy zugruppieren, das für statistische Analyse verwendet werden kann. + + + +



+ +VICIDIAL_CAMPAIGN_HOTKEYSTABELLE

+
+
+Durch den Gebrauch von kundenspezifischen Kampagne hot keys, benenntVertreter, die verwenden, der vicidial Netz-Klient Dose Hängezustandund Einteilung, gerade indem sie einen einzelnen Schlüssel auf ihrerTastatur betätigen. There are two special HotKey options that you can use in conjunction with Alternate Phone number dialing, ALTPH2 - Alternate Phone Hot Dial and ADDR3-----Address3 Hot Dial allow an agent to use a hotkey to hang up their call, stay on the same lead, and dial another contact number from that lead. + + + + + +



+ +VICIDIAL_LEAD_RECYCLETABELLE

+
+
+Through the use of lead recycling, you can call specific statuses of leads again at a specified interval without resetting the entire list. Lead recycling is campaign-specific and does not have to be a selected dialable status in your campaign. The attempt delay field is the number of seconds until the lead can be placed back in the hopper, this number must be at least 120 seconds. The attempt maximum field is the maximum number of times that a lead of this status can be attempted before the list needs to be reset, this number can be from 1 to 10. You can activate and deactivate a lead recycle entry with the provided links. + + + + + +



+ +VICIDIAL SELBSTALT VORWAHLKNOPF-STATUS

+
+
+Wenn das SelbstAlt-zahl Wählen wird eingestellt auffangen,dann die Leitungen, die sind, unter diesen Vorwahlknopfstatus desAutomobils Alt haben ihr alt_phone dispositioned, und-oder address3gewählt, nachdem irgendwelche von diesen Status kein-antworten,werden eingestellt auffängt. + + + + + +



+ +VICIDIAL MITTEL-PAUSE CODES

+
+
+Wenn die Mittel-Pause aktives kodiert, fangen Sie wirdeingestellt auf aktives dann die Mittel in der LageIST, von diesenPause Codes vorzuwählen auf, wenn sie an die PAUSE Taste auf ihrenSchirmen klicken. Diese Daten werden dann im vicidialMittelmaschinenbordbuch gespeichert. Der Pause Code muß nurBuchstaben und Zahlen lang enthalten und kleiner als 7 Buchstabensein. Der Pause Codename kann nicht mehr als 30 Buchstaben sein. + + + + + +



+ +VICIDIAL_USER_GROUPSTABELLE

+
+
+Benutzer-Gruppe - Dieses ist der kurze Name einer VicidialBenutzergruppe, der Versuch, zum keiner Räume zu benutzen, oderInterpunktion für dieses fangen Maximum 20 Buchstaben,Minimum von 2 Buchstaben auf. + +
+
+
+Gruppe Name - Dieses ist die Beschreibung des vicidialBenutzergruppe Maximums von 40 Buchstaben. + +
+
+
+Erlaubte Kampagnen - dieses ist eine auswählbare Liste der Kampagnen,zu denen Mitglieder dieser Benutzergruppe innen protokollieren könnenin. Die ALL-CAMPAIGNS Wahl erlaubt den Benutzern in dieser Gruppe, injeder möglicher Kampagne auf dem System innen zu sehen und zuprotokollieren. + + + + + +



+ +VICIDIAL_INDEXETABELLE

+
+
+Index Identifikation - Dieses ist der kurze Name eines VicidialIndexes. Dieser muß ein einzigartiger Bezeichner sein. Der Versuch,zum keiner Räume oder die Interpunktion für dieses zu benutzenfangen Maximum 10 Buchstaben, Minimum von 2 Buchstaben auf. + +
+
+Index-Name - Dieses ist der Titel einem Vicidial Index. Dieses isteine kurze Zusammenfassung der Indexmaximum 50 Buchstaben, Minimum von2 Buchstaben. Es sollte keine Räume geben, oder Interpunktionirgendwie der Art in den theis fangen auf. + +
+
+Index kommentiert - Dieses ist, wo Sie Anmerkungen für einenVicidial Index wie - geändert, um Aufsteigen an Sept. 23 freizugeben-. Maximum 255 Buchstaben setzen können, Minimum von 2 Buchstaben. + +
+
+Index-Text - This is where you place the content of a Vicidial Script. Minimum of 2 characters. You can have customer information be auto-populated in this script using "--A--field--B--" where field is one of the following fieldnames: vendor_lead_code, source_id, list_id, gmt_offset_now, called_since_last_reset, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments, lead_id, campaign, phone_login, group, channel_group, SQLdate, epoch, uniqueid, customer_zap_channel, server_ip, SIPexten, session_id. For example, this sentence would print the persons name in it----

Hello, can I speak with --A--first_name--B-- --A--last_name--B-- please? Well hello --A--title--B-- --A--last_name--B-- how are you today?

This would read----

Hello, can I speak with John Doe please? Well hello Mr. Doe how are you today?

You can also use an iframe to load a separate window within the SCRIPT tab, here is an example with prepopulated variables: + +
+<iframe src="http://astguiclient.sf.net/test_VICIDIAL_output.php?lead_id=--A--lead_id--B--&vendor_id=--A--vendor_lead_code--B--&list_id=--A--list_id--B--&gmt_offset_now=--A--gmt_offset_now--B--&phone_code=--A--phone_code--B--&phone_number=--A--phone_number--B--&title=--A--title--B--&first_name=--A--first_name--B--&middle_initial=--A--middle_initial--B--&last_name=--A--last_name--B--&address1=--A--address1--B--&address2=--A--address2--B--&address3=--A--address3--B--&city=--A--city--B--&state=--A--state--B--&province=--A--province--B--&postal_code=--A--postal_code--B--&country_code=--A--country_code--B--&gender=--A--gender--B--&date_of_birth=--A--date_of_birth--B--&alt_phone=--A--alt_phone--B--&email=--A--email--B--&security_phrase=--A--security_phrase--B--&comments=--A--comments--B--&user=--A--user--B--&campaign=--A--campaign--B--&phone_login=--A--phone_login--B--&fronter=--A--fronter--B--&closer=--A--user--B--&group=--A--group--B--&channel_group=--A--group--B--&SQLdate=--A--SQLdate--B--&epoch=--A--epoch--B--&uniqueid=--A--uniqueid--B--&customer_zap_channel=--A--customer_zap_channel--B--&server_ip=--A--server_ip--B--&SIPexten=--A--SIPexten--B--&session_id=--A--session_id--B--&phone=--A--phone--B--" style="width:580;height:290;background-color:transparent;" scrolling="auto" frameborder="0" allowtransparency="true" id="popupFrame" name="popupFrame" width="460" height="290" STYLE="z-index:17"> +</iframe> +
+ +
+
+
+Aktiv - Dieses stellt fest, ob dieser Index vorgewählt werdenkann, durch eine Kampagne verwendet zu werden. + + + + + +



+ +VICIDIAL_LEAD_FILTERTABELLE

+
+
+Filter Identifikation - Dieses ist der kurze Name eines VicidialLeitung Filter. Dieser muß ein einzigartiger Bezeichner sein.Benutzen Sie keine Räume, oder Interpunktion für diesesfangen Maximum 10 Buchstaben, Minimum von 2 Buchstaben auf. + +
+
+Filter-Name - Dieses ist ein beschreibenderer Name des Filter.Dieses ist eine kurze Zusammenfassung der Filtermaximum 30 Buchstaben,Minimum von 2 Buchstaben. + +
+
+Filter kommentiert - Dieses ist, wo Sie Anmerkungen für einenVicidial Filter wie - Anrufe alle Kalifornien Leitungen -. Maximum 255Buchstaben setzen können, Minimum von 2 Buchstaben. + +
+
+Filter SQL - Dieses ist, wohin Sie das SQL Frage Fragment setzen,das Sie vorbei filtern möchten anfangen nicht, oder Ende mit UND, dasdurch den Zufuhrbehälter cron Index automatisch hinzugefügt wird.eine Beispiel SQL Frage, die hier arbeiten würde, ist called_count \4 und called_count \. + + + + + +



+ +VICIDIAL_AnrufzeitenTABELLE

+
+
+Anrufzeit ID - Dies ist der kurze Name von einer Vicidial Anrufzeit Definition. Es muss ein eindeutiger Bezeichner sein. Leerzeichen und Punkte sind in diesem Feld nicht erlaubt. Maximal 10 Zeichen, mindestens 2. + +
+
+Anrufzeit Name - Dies ist ein besser beschreibender Name für die Anrufzeit Definition. Es ist eine kurze Zusammenfassung der Anrufzeit Definition. Maximal 30 Zeichen, mindestens 2. + +
+
+Anrufzeit Kommentare - Hier können Sie Kommentare für eine Vicidial Anrufzeit Definition wie -10 bis 14 Uhr mit eigenen Beschränkungen für das angerufene Land- machen. Maximal 255 Zeichen. + +
+
+Standard Start and Stop Zeiten - Dies ist die Standardzeit, zu der Anrufe innerhalb der Anrufzeitdefinition gestartet oder gestoppt werden dürfen, wenn die Wochentag Startzeit nicht definiert ist. 0 ist Mitternacht. Um Anrufe komplett zu verhindern den Wert auf 2400 und die Standard Stopzeit ebenfalls auf 2400 setzen. Um Anrufe für 24 Stunden am Tag zu erlauben die Startzeit auf 0 und die Stopzeit auf 2400 setzen. + +
+
+Wochentag Start and Stop Zeit - Dies sind die speziellen Zeiten pro Tag, welche für die Anrufzeit Definition gesetzt werden können. Es gelten die selben Regeln wie für Start und Stop Zeiten. + +
+
+Land Anrufzeit Definition - Dies ist die Liste der landspezifischen Anrufzeit Definitionen, die von dieser Anrufzeit Definition beachtet werden. + +
+
+Landesspezifische Anrufzeit Definition - Dies ist der zwei Buchstaben Code für das Land, für das die Anrufzeit Definition gilt. Damit diese ausgeführt wird muss die in der Kampagne gesetzte lokale Anrufzeit diese landesspezifische Anrufzeit Aufzeichnung enthalten, genauso wie alle anzurufenden Anschlüsse den landesspezifischen zwei Buchstaben Code enthalten müssen . + + + + +



+ +VICIDIAL LISTE LADEVORRICHTUNG FUNKTIONALITÄT

+
+
+Die VICIDIAL grundlegende Netz-gegründete Leitung Ladevorrichtung isteinfach entworfen, um eine Leitung Akte zu nehmen - bis zu 8MB in derGröße - die entweder Vorsprung oder das abgegrenzte Rohr und es indie vicidial_list Tabelle zu laden ist. Die Leitung Ladevorrichtungläßt auffangen das Wählen zu und TXT- deutlich Text, CSV-Komma getrennte Werte und XLS- übertreffen Akte Formate. Die LeitungLadevorrichtung tut nicht Datenprüfung, aber sie erlaubt Ihnen, aufDuplikate in sich, innerhalb der Kampagne oder innerhalb des gesamtenSystems zu überprüfen. Auch überprüfen Sie, ob Sie die Listeerstellt haben, daß diese Leitungen darunter sein sollen, damit Siesie benutzen können. Ist hier eine Liste von auffängt inihrem korrekten Auftrag für die Leitung Akten: +
    +
  1. Verkäufer-Leitung Code - zeigt oben im Verkäufer, den Identifikationvom GUI auffangen +
  2. Quellenprogramm - interner Gebrauch nur für admins und DBAs +
  3. Liste Identifikation - die Liste Zahl, die diese Leitungen obendarunter zeigen +
  4. Telefon-Code - das Präfix für die Telefonnummer - 1 für US, 01144für Großbritannien, 01161 für AUS, usw. +
  5. Telefonnummer - muß mindestens 8 Stellen lang sein +
  6. Titel - Titel dem Kunden - Herr Ms Mrs, usw.... +
  7. Vorname +
  8. Mittlere Initiale +
  9. Letzter Name +
  10. Adresse Linie 1 +
  11. Adresse Linie 2 +
  12. Adresse Linie 3 +
  13. Stadt +
  14. Zustand - begrenzt auf 2 Buchstaben +
  15. Provinz +
  16. Postcode +
  17. Land +
  18. Geschlecht +
  19. Geburtsdatum +
  20. Wechselnde Telefonnummer + Sicherheit Phrase +
  21. Anmerkungen +
+ +
ANMERKUNGEN: Die übertreffenleitung Ladevorrichtung Funktionalitätwird durch eine Reihe Perl Indexe ermöglicht und muß eine richtigzusammengebaute /etc/astguiclient.conf Akte im Platz auf dem webserver haben. Auch ein Paarperl Module müssen für sie, um außerdemzu arbeiten - OLE-Storage_Lite-Storage_Lite undVerteilungsbogen-ParseExcel geladen werden. Sie können aufLaufzeitfehler in diesen überprüfen, indem Sie Ihre Apache error_logAkte betrachten. Auch für Doppelprüfungen gegen gampaignverzeichnet, die Liste, die neue Leitungen hat, in es einzusteigenmuß im System verursacht werden, bevor Sie beginnen, die Leitungen zuladen. + + + + +



+ + + + + + +TELEFON-TABELLE

+
+
+Telefonverlängerung - Dieses fangen ist auf, wohin Sieden Telefonnamen setzen, während er scheint, nicht einschließlichdas Protokoll oder den Schrägstrich am Anfang mit einem Sternchenzuversehen. Z.B.: für das SIP Telefon SIP\/test101 würde dieTelefonverlängerung test101 sein. Auch denn Telefone IAX2 stellen Siesicher, daß Sie den vollen Telefonnamen verwenden:IAX2\/IAXphone1@IAXphone1 würde IAXphone1@IAXphone1 sein. Für ZapTelefone sicherstellen, daß Sie die volle Führung setzen: Zap/25-1würde 25-1 sein. Eine andere Anmerkung, stellen sicher, daß Sie dasProtokoll unten richtig für Ihre Art des Telefons einstellen. + +
+
+
+Dial Plan Zahl - This field is for the number you dial to have the phone ring. This number is defined in the extensions.conf file of your Asterisk server + +
+
+
+Voicemail Kasten - Dieses fangen ist für den voicemailKasten auf, daß die Anzeigen für zum Benutzer dieses Telefons gehen.Wir verwenden dieses, um auf voicemail Anzeigen und auf den Benutzerzu überprüfen, zum in der Lage zuSEIN, die VOICEMAIL Taste aufastGUIclient APP zu benutzen. + +
+
+
+Outbound CallerID - Dieses fangen ist auf, wo Sie diecallerID Zahl eintragen würden, die Sie möchten, daß auf outboundAnrufe gesetzter Form der astguiclient Netz-Klient aussieht. Diesesarbeitet nicht auf RBS, non-PRI, T1/Eß. + +
+
+
+Telefon-IP address - Dieses fangen ist für IP addressdes Telefons auf, wenn es ein VOIP Telefon ist. Dieses istauffangen ein wahlweise freigestelltes + +
+
+
+Computer-IP address - Dieses fangen ist für IP addressComputer des Benutzers auf. Dieses ist auffangen einwahlweise freigestelltes + +
+
+
+Bediener IP - Dieses Menü ist, wo Sie vorwählen, dem Bedienerdas Telefon auf aktiv ist. + +
+
+
+LOGON - Der LOGON gewöhnt ge$$$WESEN für den Telefonbenutzer anLOGON zu den Klient Anwendungen. + +
+
+
+Kennwort - Das Kennwort gewöhnt ge$$$WESEN für denTelefonbenutzer an LOGON zu den Klient Anwendungen. + +
+
+
+Status - Der Status des Telefons im System, die AKTIVEN und ADMINdürfen, damit GUI Klienten arbeiten. Admin erlaubt Zugang zu dieseradministrativen Web site. Alle weiteren Status erlauben nicht GUI oderAdmin Netzzugang. + +
+
+
+Aktives Konto - Ob das Telefon aktiv ist, es in die Liste im GUIKlienten einzusetzen. + +
+
+
+Telefon-Art - Lediglich für administrative Anmerkungen. + +
+
+
+Voller Name - Verwendet durch das GUIclient in der Liste deraktiven Telefone. + +
+
+
+Firma - Lediglich für administrative Anmerkungen. + +
+
+
+Abbildung - Nicht schon eingeführt. + +
+
+
+Neue Anzeigen - Zahl der neuen voicemail Anzeigen für diesesTelefon auf dem Sternchenbediener. + +
+
+
+Alte Anzeigen - Zahl der alten voicemail Anzeigen für diesesTelefon auf dem Sternchenbediener. + +
+
+
+Klient Protokoll - Das Protokoll, das das Telefon verwendet, anden Sternchenbediener anzuschließen: Sip, IAX2, Zap. Auch, es gibtexternal für Remotevorwahlknopfzahlen oder GeschwindigkeitVorwahlknopfzahlen, die Sie als Telefone verzeichnen möchten. + +
+
+
+Lokales GMT - Der Unterschied Greenwich-Zeit von oder VON DERZULU-Zeit, in der das Telefon lokalisiert wird. STELLEN SIE NICHT AUFTAGESLICHT-SPARUNGEN ZEIT EIN. Dieses wird durch die VICIDIAL Kampagneverwendet, um die Zeit und Kunde Zeit genau anzuzeigen. + +
+
+
+Manager-LOGON - Dieses ist der LOGON, dem die GUI Klienten fürdieses Telefon pflegen, die Datenbank zugänglich zu machen, in derdie Bedienerdaten liegen. + +
+
+
+Manager-Geheimnis - Dieses ist das Kennwort, dem die GUI Klientenfür dieses Telefon pflegen, die Datenbank zugänglich zu machen, inder die Bedienerdaten liegen. + +
+
+
+VICIDIAL Rückstellung Benutzer - Dieses soll einen Default-Wertin den VICIDIAL Benutzer legen auffangen, wann immer dieserTelefonbenutzer die astVICIDIAL Klient APP öffnet. Lassen Sie freienRaum für keinen Benutzer. + +
+
+
+VICIDIAL Rückstellung Durchlauf - Dieses soll einen Default-Wertin das VICIDIAL Kennwort legen auffangen, wann immer dieserTelefonbenutzer die astVICIDIAL Klient APP öffnet. Lassen Sie freienRaum für keinen Durchlauf. + +
+
+
+VICIDIAL Rückstellung Kampagne - Dieses soll einen Default-Wertin die VICIDIAL Kampagne legen auffangen, wann immer dieserTelefonbenutzer die astVICIDIAL Klient APP öffnet. Lassen Sie freienRaum für keine Kampagne. + +
+
+
+Park Exten - Dieses ist die Rückstellung Parkenverlängerung fürdie Klient apps. Überprüfen Sie, daß ein unterschiedliches manarbeitet, bevor Sie dieses ändern. + +
+
+
+Conf Exten - This is the default Conference park extension for the client apps. Verify that a different one works before you change this. + +
+
+
+VICIDIAL Park Exten - Dieses ist die RückstellungParkenverlängerung für VICIDIAL Klient APP. Überprüfen Sie, daßein unterschiedliches man arbeitet, bevor Sie dieses ändern. + +
+
+
+VICIDIAL Park-Akte - Dieses ist der Rückstellung VICIDIALPark-Verlängerung Dateiname für die Klient apps. Überprüfen Sie,daß ein unterschiedliches man arbeitet, bevor Sie dieses ändern, daszu 10 Buchstaben begrenzt wird. + +
+
+
+Überwachen Sie Präfix - This is the dial plan prefix for monitoring of Zap channels automatically within the astGUIclient app. Only change according to the extensions.conf ZapBarge extensions records. + +
+
+
+Aufnahme Exten - Dieses ist die dial plan Verlängerung für dieAufnahmeverlängerung, die verwendet wird, um in meetme Konferenzen zufallen, um sie zu notieren. Es dauert normalerweise bis zu einerStunde, wenn es nicht gestoppt wird, überprüft mit extensions.confAkte, bevor es ändert. + +
+
+
+VMAIL Hauptexten - Dieses ist die dial plan Verlängerung, diegeht, Ihr voicemail. zu überprüfen, überprüfen mit extensions.confAkte, bevor es ändert. + +
+
+
+VMAIL Dump Exten - Dieses ist das dial plan Präfix, das verwendetwird, um Anrufe direkt zum voicemail eines Benutzers von einemPhasenanruf in der astGUIclient APP zu schicken, überprüfen mitextensions.conf Akte, bevor es ändert. + +
+
+
+Exten Kontext - Dieses ist der dial plan Kontext, den diesesTelefon hauptsächlich verwendet. Es wird angenommen, daß alleNummern, die durch die Klient apps gewählt werden, diesen Kontextverwenden, also es eine gute Idee ist sicherzustellen, daß dieses derbreiteste Kontext ist, der möglich ist, überprüfen mitextensions.conf Akte, bevor es ändert. + +
+
+
+DTMF senden Führung - Dieses ist die Führung Zeichenkette, diebenutzt wird, um DTMF Töne in meetme Konferenzen von den Klient appszu senden. Überprüfen Sie, daß und Kontext mit der extensions.confAkte exten. + +
+
+
+Outbound Anruf-Gruppe - Dieses ist die Kanalgruppe, daß outboundAnrufe von diesem Telefon aus gesetzt werden. Es gibt Programme einesPaares in den Klient apps, die dieses verwenden. Für Zap Führungen,die Sie etwas wie Zap/g2 verwenden möchten, denn Stämme IAX2 Siedas volle IAX Präfix wie IAX2/VICItest1:secret@10.10.10.15:4569würden verwenden wollen. Überprüfen Sie die Stämme mit derextensions.conf Akte, es ist normalerweise, was Sie als die globaleVariable des STAMMES an der Oberseite der Akte definiert haben. + +
+
+
+Datenbanksuchroutine-Position - Dieses ist auf nur UNIX/LINUXKlienten, der absolute Weg zu Mozilla anwendbar, oder FirefoxDatenbanksuchroutine auf der Maschine überprüfen dieses, indem siemanuell es ausstößt. + +
+
+
+Anbringen Sie Verzeichnis - Dieses ist der Platz, in dem dieastGUIclient und astVICIDIAL Indexe auf Ihrer Maschine sind. FürWin32 sollte es etwas wie C:\\AST_VICI sein und für UNIX sollte esetwas wie /usr/local/perl_TK. sein überprüft dieses manuell. + +
+
+
+CallerID URL - Dieses ist die Netzadresse der Seite, die benutztwird, um kundenspezifische callerID Nachschlagen zu tun, Rückstellungprüfen, dieadresse ist:http://astguiclient.sf.net/test_callerid_output.php + +
+
+
+VICIDIAL Rückstellung URL - Dieses ist die Netzadresse der Seite,die benutzt wird, um kundenspezifische VICIDIAL Netz-Formfragen zutun, Rückstellung prüfen, dieadresse ist:http://astguiclient.sf.net/test_VICIDIAL_output.php + +
+
+
+Anruf-Protokollierung - Dieses wird eingestellt, um auszurichten,wenn die call_log.agi Akte im Platz in der extensions.conf Akte füralles outbound ist und die Verlängerungen des Hängezustands ' h ',zum alle zu loggen benennt. Diese sollte 1, weil es für vieleastGUIclient und DIE VICIDIAL manditory ist Eigenschaften immer sein,zum richtig zu arbeiten. + +
+
+
+Benutzer-Schaltung - Set to true to allow user to switch to another user account. NOTE: If user switches they can initiate recording on the new user's phone conversation + +
+
+
+Conferencing - Stellen Sie ein, um auszurichten, um Benutzer zuerlauben, Konferenzanrufe mit bis zu sechs externen Linien zubeginnen. + +
+
+
+Admin Hängezustand - um Benutzer zu erlauben auszurichten Satz,zum Hängezustand irgendeine Linie am Willen durch astGUIclient in derLage zuSEIN. Gute Idee, diesem für Admin Benutzer nur zuermöglichen. + +
+
+
+Admin Straßenräuber - Stellen Sie ein, um auszurichten, umBenutzer zu erlauben, in der Lage zuSEIN, zu ihrer Verlängerung jedemögliche Linie zu ergreifen und umzuadressieren am Willen durchastGUIclient. Gute Idee, diesem für Admin Benutzer nur zuermöglichen. Aber ist für Manager sehr nützlich. + +
+
+
+Admin Monitor - Stellen Sie ein, um auszurichten, um Benutzer zuerlauben, in der Lage zuSEIN, zu ihrer Verlängerung jede möglicheLinie zu ergreifen und umzuadressieren am Willen durch astGUIclient.Gute Idee, diesem für Admin Benutzer nur zu ermöglichen. Aber istfür Manager und als Training Werkzeug sehr nützlich. + +
+
+
+Parkschaltung - um Benutzer zu erlauben auszurichten der Satz, inder Lage zuSEIN zu parken ersucht um astGUIclient Einfluß, von jedemanderen astGUIclient Benutzer auf dem System aufgehoben zu werden.Anrufe bleiben auf Einfluß für bis zu einen halbe Stunde dannHängezustand. Normalerweise ermöglicht für alle. + +
+
+
+Updater Überprüfung - Stellen Sie ein, um auszurichten, um einepopup Warnung anzuzeigen, die die updater Zeit nicht in 20 Sekundengeändert hat. Nützlich für Admin Benutzer. + +
+
+
+Af Protokollierung - Stellen Sie ein, um auszurichten, um vieleTätigkeiten des astGUIclient Verbrauches in einer Textakte auf demComputer des Benutzers zu protokollieren. + +
+
+
+Warteschlange ermöglichte - um Klient apps auszurichten Satz dasSternchen-zentrale Warteschlange System benutzen zu lassen. Erfordertfür VICIDIAL und für alle Benutzer empfohlen. + +
+
+
+CallerID Popup - Stellen Sie ein, um auszurichten, um die Zahlenzuzulassen, die in der extensions.conf Akte definiert werden, umCallerID popup Schirme zu schicken den astGUIclient Benutzern. + +
+
+
+VMail Taste - Stellen Sie ein, um auszurichten, um die VOICEMAILTaste anzuzeigen und die Anzeigen zählen Anzeige auf astGUIclient. + +
+
+
+Schnell erneuern Sie - Stellen Sie ein, um auszurichten, um einerneuen Rate von zu ermöglichen erneuern von den Anrufinformationenfür das astGUIclient. Rückstellung arbeitsunfähige Rate ist 1000zweite des Ms.1. Kann Anlagen-Belastung erhöhen, wenn Sie diese Zahlsenken. + +
+
+
+Schnell erneuern Sie Rate - in den Millisekunden. Nur verwendet,wenn schnell, erneuern Sie wird ermöglicht. Rückstellungarbeitsunfähige Rate ist 1000 zweite des Ms.1. Kann Anlagen-Belastungerhöhen, wenn Sie diese Zahl senken. + +
+
+
+Persistant MySQL - Wenn er ermöglicht wird, bleibt derastGUIclient Anschluß angeschlossen, anstatt, jede Sekundeanzuschließen. Nützlich, wenn Sie ein schnelles die eingestellteRate erneuern lassen. Sie erhöht die Zahl Anschlüssen auf IhrerMySQL Maschine. + +
+
+
+Selbstvorwahlknopf-folgende Zahl - wenn er ermöglicht wird,wählt der VICIDIAL Klient die folgende Nummer auf der Listeautomatisch nach Einteilung eines Anrufs, es sei denn sie vorwählten"auf, dem Einteilung Schirm zu wählen zu stoppen". + +
+
+
+Stoppen Sie Rec nach jedem Anruf - wenn er ermöglicht wird,stoppt der VICIDIAL Klient, was Aufnahme weitergeht, nachdem jederAnruf dispositioned gewesen ist. Nützlich, wenn Sie eine MengeAufnahme tun oder Sie benutzen eine Netzform, um Aufnahme auszulösen. + +
+
+
+Ermöglichen Sie SIPSAK Anzeigen - wenn er ermöglicht wird, schicktder Bediener Anzeigen zum SIP Telefon zur Anzeige auf der Telefon LCDAnzeige, wenn er in VICIDIAL geloggt wird. Eigenschaft arbeitet nurmit SIP Telefonen und erfordert sipsak Anwendung, auf das web serverangebracht zu werden. Rückstellung ist 0. + +
+
+
+DBX Bediener - Der MySQL Datenbankbediener, den dieser Benutzeranschließen sollte an. + +
+
+
+DBX Datenbank - Die MySQL Datenbank, die dieser Benutzeranschließen sollte an. Rückstellung ist Sternchen. + +
+
+
+DBX Benutzer - Der MySQL Benutzer-LOGON, den dieser Benutzer beimAnschließen verwenden sollte. Rückstellung ist cron. + +
+
+
+DBX Durchlauf - Das MySQL Benutzerkennwort, das dieser Benutzerbeim Anschließen verwenden sollte. Rückstellung ist 1234. + +
+
+
+DBX Tor - Das MySQL TCP Tor, das dieser Benutzer beim Anschließenbenutzen sollte. Rückstellung ist 3306. + +
+
+
+DBY Bediener - Der MySQL Datenbankbediener, den dieser Benutzeranschließen sollte an. Zweitensserver, nicht z.Z. verwendet. + +
+
+
+DBY Datenbank - Die MySQL Datenbank, die dieser Benutzeranschließen sollte an. Rückstellung ist Sternchen. Zweitensserver, nicht z.Z. verwendet. + +
+
+
+DBY Benutzer - Der MySQL Benutzer-LOGON, den dieser Benutzer beimAnschließen verwenden sollte. Rückstellung ist cron. Zweitensserver, nicht z.Z. verwendet. + +
+
+
+DBY Durchlauf - Das MySQL Benutzerkennwort, das dieser Benutzerbeim Anschließen verwenden sollte. Rückstellung ist 1234. Zweitensserver, nicht z.Z. verwendet. + +
+
+
+DBY Tor - Das MySQL TCP Tor, das dieser Benutzer beim Anschließenbenutzen sollte. Rückstellung ist 3306. Zweitensserver, nicht z.Z. verwendet. + + +



+ +BEDIENER-TABELLE

+
+
+Bediener Identifikation - Dieses fangen ist, wohin Sieden Sternchenbedienernamen setzen, doesnt müssen ein amtliches GebietUnterseeboot, gerade ein Spitzname sein auf, um den Bediener zu denAdmin Benutzern zu kennzeichnen. + +
+
+
+Bediener-Beschreibung - auffangen, wo Sie eine kleine Phraseverwenden, um den Sternchenbediener zu beschreiben. + +
+
+
+Bediener-IP address - auffangen, wo Sie das Netz-IP addressdes Sternchenbedieners setzten. + +
+
+
+Aktiv - Stellen Sie ein, ob der Sternchenbediener aktiv oderunaktiviert ist. + +
+
+
+Sternchen-Version - Stellen Sie die Version des Sternchens ein,die Sie auf diesen Bediener angebracht haben. Beispiele: ' 1.2 ', '1.0.8 ', ' 1.0.7 ', ' CVS_HEAD ', ' WIRKLICH ALTES ', usw.... Dieseswird verwendet, weil Versionen 1.0.8 und 1.0.9 eine andere Methode desBeschäftigens Local/ Führungen, eine Wanze, die in CVS v1.0geregelt worden ist, und Notwendigkeit, anders als behandelt zu werdenhaben, wenn die Behandlung ihres Local/ lenkt. Auch gegenwärtigesCVS_HEAD und der 1.2 Freigabebaumgebrauch unterschiedlicher Managerund Befehl gaben aus, also muß es anders als außerdem behandeltwerden. + +
+
+
+Maximale VICIDIAL Stämme - Dieses fangen feststellt diemaximale Zeilenzahl auf, um denen der VICIDIAL Auto-dialer versucht,diesen Bediener zu ersuchen. Wenn Sie zwei volle PRI Tß VICIDIALingauf einem Bediener einweihen möchten dann, würden Sie dieses bis 46einstellen. Rückstellung ist 96. + +
+
+
+Telnet Wirt - Dieses ist die Adresse oder der Name desSternchenbedieners und ist, wie die Manageranwendungen an ihnanschließen von, wo sie laufen. Wenn sie auf den Sternchenbedienerlaufen, dann ist die Rückstellung von ' localhost ' fein. + +
+
+
+Telnet Tor - Dieses ist das Tor des SternchenbedienerManageranschlußes und ist, wie die Manageranwendungen an ihnanschließen von, wo sie laufen. Die Rückstellung von ' 5038 ' istfein für einen Standard anbringen. + +
+
+
+Manager-Benutzer - Das username oder der LOGON verwendeten, an denSternchenbedienermanager genericly anzuschließen. Rückstellung ist 'cron ' + +
+
+
+Manager-Geheimnis - Das Geheimnis oder das Kennwort verwendeten,an den Sternchenbedienermanager genericly anzuschließen.Rückstellung ist ' 1234 ' + +
+
+
+Manager-Update-Benutzer - Das username oder der LOGON verwendeten,an den Sternchenbedienermanager anzuschließen, der für dieUpdateindexe optimiert wurde. Fallen Sie ist ' updatecron ' undannimmt das gleiche Geheimnis wie der generische Benutzer zurück. + +
+
+
+Manager hören Benutzer - Das username oder der LOGON verwendeten,an den Sternchenbedienermanager anzuschließen, der für Indexeoptimiert wurde, die nur auf Ausgang hören. Fallen Sie ist 'listencron ' und annimmt das gleiche Geheimnis wie der generischeBenutzer zurück. + +
+
+
+Manager senden Benutzer - Das username oder der LOGON verwendeten,an den Sternchenbedienermanager anzuschließen, der für Indexeoptimiert wurde, die dem Manager nur Tätigkeiten schicken. Fallen Sieist ' sendcron ' und annimmt das gleiche Geheimnis wie der generischeBenutzer zurück. + +
+
+
+Bediener GMT versetzt - Der Unterschied bezüglich der Stunden vonder GMT Zeit eingestellt nicht auf Tageslicht-Sparung-Zeit desBedieners. Rückstellung ist ' - 5 ' + +
+
+
+VMail Dump Exten - Das Verlängerung Präfix verwendet auf diesemBediener, um Anrufe direkt durch agc zu einem spezifischen voicemailKasten zu schicken. Rückstellung ist ' 85026666666666 ' + +
+
+
+VICIDIAL ANZEIGE Verlängerung - Die Rückstellung Verlängerung,wenn keines in der Kampagne anwesend ist, Anrufe für VICIDIAL zumSelbstwählen zu schicken. Rückstellung ist ' 8365 ' + +
+
+
+Rückstellung Kontext - Der Rückstellung dial plan Kontextverwendet für Indexe, die für diesen Bediener funktionieren.Rückstellung ist ' Rückstellung ' + +
+
+
+System Leistung - die Einstellung dieser Wahl auf Y ermöglicht derProtokollierung von System Leistung Notfall für die Bedienermaschineeinschließlich Anlagen-Belastung, System Prozesse undSternchenführungen im Gebrauch. Rückstellung ist N. + +
+
+
+Bediener-Maschinenbordbücher - die Einstellung dieser Wahl auf Yermöglicht der Protokollierung aller VICIDIAL bezogenen Indexe zuihren Textmaschinenbordbuchakten. Die Einstellung dieses auf N stopptSchreiben Maschinenbordbücher zu den Akten für diese Prozesse, auchdie Schirmprotokollierung des Sternchens ist untauglich, wenn diesesauf N eingestellt wird, wenn Sternchen begonnen wird. Rückstellungist Y. + +
+
+
+AGI ausgegeben - die Einstellung dieser Wahl auf KEINE sperrt Ausgangvon allen VICIDIAL bezogenen AGI Indexen. Die Einstellung dieses aufSTDERR schickt das AGI, das zum Sternchen CLI ausgegeben wird. DieEinstellung dieses auf AKTE schickt den Ausgang zu einer Akte imMaschinenbordbuchverzeichnis. Die Einstellung dieses auf BEIDE schicktAusgang zum Sternchen CLI und zu einer Maschinenbordbuchakte.Rückstellung ist AKTE. + +
+
+
+VICIDIAL Balance Wählen - dieses einstellend, fangen Sie zuY läßt den Bediener Balance Anrufe für Kampagnen in VICIDIAL legenauf, damit das definierte Vorwahlknopfniveau getroffen werden kann,selbst wenn es keine Mittel gibt, die in diese Kampagne auf diesemBediener geloggt werden. Rückstellung ist N. + +
+
+
+VICIDIAL Balance Offlimits - diese Einstellung definiert die ZahlStämmen, um die VICIDIAL Balance nicht zu erlauben, die wählt, um zuverwenden. Z.B. wenn Sie haben, wird 40 maximale vicidial Stämme undBalance offlimits bis 10 eingestellt, die Sie nur in der LageSIND, 30Hauptluftlinien für VICIDIAL Balance das Wählen zu benutzen.Rückstellung ist 0. + + +



+ +KONFERENZTISCH

+
+
+Konferenz-Zahl - Dieses fangen ist auf, wohin Sie diemeetme Konferenz dialpna Zahl setzen. Es wird auch empfohlen, daß diemeetme Zahl in meetme.conf diese Zahl für jede Eintragungzusammenbringt. Dieses ist für die Konferenzen in astGUIclient undwird für leave-3way-call Funktionalität in VICIDIAL verwendet. + +
+
+
+Bediener IP - Das Menü, wo Sie den Sternchenbediener vorwählen,daß diese Konferenz eingeschaltet ist. + + + + +



+ +VICIDIAL_SERVER_TRUNKSTABELLE

+
+
+VICIDIAL Bediener-Stämme erlaubt Ihnen, die gehenden Leitungeneinzuschränken, die auf diesem Bediener für die Kampagne benutztwerden, die auf einer Prokampagne Grundlage wählt. Sie haben dieWahl, zum einer spezifischen Zeilenzahl durch nur eine Kampagneverwendet zu werden aufzuheben,, sowie das Lassen dieser Kampagneüber seine reservierten Linien laufen in was Linien geöffnetbleiben, wie, lang an den Gruppenzeilen, die durch vicidial auf diesemBediener benutzt werden, sind kleiner als die Maximum VICIDIALStammeinstellung. Erlaubt Haben nicht irgendwelche dieserAufzeichnungen die Kampagne, die die Linie zuerst wählt, um da vieleLinien zu haben, während sie unter der Maximum VICIDIAL erhalten kannStammeinstellung. + + + + + +



+ +SYSTEM_SETTINGSTABELLE

+
+
+Gebrauch Nicht-Lateinisch - diese Wahl erlaubt Ihnen, den NetzanzeigeIndex auf Buchstaben des Gebrauches UTF8 zurückzufallen und keinenfilternden Lateinisch-Buchstabefamilie regelmäßigen Ausdruck zu tunoder Formatierung anzuzeigen. Rückstellung ist 0. + +
+
+
+Webroot schreibbar - diese Einstellung erlaubt Ihnen zu definieren, obTemperatur Akten und Authentisierung Akten in das webroot auf Ihr webserver gelegt werden sollten. Rückstellung ist 1. + +
+
+
+Ermöglichen Sie der QueueMetrics Protokollierung - diese Einstellungerlaubt Ihnen zu definieren, ob VICIDIAL Maschinenbordbucheintragungenin die queue_log Datenbanktabelle einsetzt, wieSternchen-Warteschlangen Tätigkeit. QueueMetrics ist,Geschlossenquellenstatistische Analyse Programm ein alleinstehendes.Sie müssen QueueMetrics haben bereits angebracht und zusammengebaut,bevor Sie dieser Eigenschaft ermöglichen. Rückstellung ist 0. + +
+
+
+QueueMetrics Bediener IP - dieses ist das IP address der Datenbankfür Ihre QueueMetrics Installation. + +
+
+
+QueueMetrics Datenbank-Name - dieses ist der Datenbankname für IhreQueueMetrics Datenbank. + +
+
+
+QueueMetrics Datenbank-LOGON - dieses ist der Benutzername, derverwendet wird, um in Ihrer QueueMetrics Datenbank innen zuprotokollieren. + +
+
+
+QueueMetrics Datenbank-Kennwort - dieses ist das Kennwort, dasverwendet wird, um in Ihrer QueueMetrics Datenbank innen zuprotokollieren. + +
+
+
+QueueMetrics URL - Dieses ist die URL oder Web site Adresse, dieverwendet wird, um zu Ihrer QueueMetrics Installation zu kommen. + +
+
+
+QueueMetrics Maschinenbordbuch Identifikation - dieses ist derBediener Identifikation, den alle VICIDIAL Maschinenbordbücher, diein die QueueMetrics Datenbank einsteigen, als Bezeichner für jedeAufzeichnung benutzen. + +
+
+
+QueueMetrics EnterQueue stellen voran - dieses fangen wirdverwendet, das Voranstellen von einer der vicidial_list Datenzuzulassen auffängt vor der Telefonnummer des Kunden fürkundengebundene QueueMetrics Reports auf. Rückstellung ist KEINE,alles nicht zu bevölkern. + +
+
+
+VICIDIAL Mittel sperren Anzeige - diese fangen wirdverwendet, vorzuwählen auf, wann man einem Mittel zeigt, wann ihrLernabschnitt durch das System, eine Managertätigkeit oder durch einexternes Maß gesperrt worden ist. Die NOT_ACTIVE Einstellung sperrtdie Anzeige auf dem Mittelschirm. Die LIVE_MITTELEinstellung zeigt nurdie untaugliche Anzeige, wenn die Mittel vicidial_auto_callsAufzeichnung entfernt worden ist, wie während ein Kraft Logout oderDringlichkeitslogout an. + +
+
+
+Erlauben Sie SIPSAK Anzeigen - wenn Satz bis 1, dieses dieTelefontabelle Einstellung richtig arbeiten läßt, schickt derBediener Anzeigen zum SIP Telefon zur Anzeige auf der Telefon LCDAnzeige, wenn er in VICIDIAL geloggt wird. Diese Eigenschaft arbeitetnur mit SIP Telefonen und erfordert sipsak Anwendung, auf das webserver angebracht zu werden. Rückstellung ist 0. + +
+
+
+Admin Haupt-URL - dieses ist die URL oder Web site Adresse, daß Siegehen, wenn Sie an die HAUPTVERBINDUNG an der Oberseite der admin.phpSeite klicken. + +
+
+
+Ermöglichen Sie Vertreter-Übergangsprotokolldatei - diese Wahlprotokolliert in einer Textprotokolldatei auf dem webserver, jedesmalwenn ein Anruf auf ein Mittel gebracht wird. Rückstellung ist 0,gesperrt. + + + + + +



+ +VICIDIAL_STATUSESTABELLE

+
+
+Durch den Gebrauch von Systemstatus, können Sie Status haben, diefür Kampagne und Ingruppe bestehen. Der Status muß 1-6 Buchstabenlang sein, muß die Beschreibung 2-30 Buchstaben lang sein undauswählbar definiert, ob es oben in VICIDIAL als Mitteleinteilungzeigt. Human_answered auffangen wird verwendet, als, denTropfenprozentsatz oder Ungezwungenheit Rate errechnend. Einstellunghuman_answered zu Y verwendet diesen Status, als, diemenschlich-geantworteten Anrufe zählend. Die Kategorie Wahl erlaubtIhnen, einige Status in ein catogy zu gruppieren, das fürstatistische Analyse verwendet werden kann. + + +



+ +VICIDIAL_STATUS_CATEGORIESTABELLE

+
+
+Durch den Gebrauch von Systemstatuskategorien, können Sie diezusammen gruppieren Status, um statistische Analyse auf einer GruppeStatus zuzulassen. Die Kategorie Identifikation muß 2-20 Buchstabenlang ohne Räume sein, muß der Name 2-50 Buchstaben lang sein, istdie Beschreibung wahlweise freigestellt und TimeonVDAD Anzeigedefiniert, ob dieser Status einer von bis zu 4 Status ist, die auf derZeit auf VDAD Realzeitreport errechnet werden und angezeigt werdenkönnen. + + + + +







+







+DAS ENDE +
+\n"; + echo "\n"; + echo "\n"; + echo ""; + + $stmt="SELECT dial_statuses,local_call_time,lead_filter_id from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $dial_statuses = $row[0]; + $local_call_time = $row[1]; + if ($lead_filter_id=='') + { + $lead_filter_id = $row[2]; + if ($lead_filter_id=='') + { + $lead_filter_id='NONE'; + } + } + + $stmt="SELECT list_id,active,list_name from vicidial_lists where campaign_id='$campaign_id'"; + $rslt=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rslt); + $camp_lists=''; + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + if (ereg("Y", $rowx[1])) {$camp_lists .= "'$rowx[0]',";} + } + $camp_lists = eregi_replace(".$","",$camp_lists); + + $filterSQL = $filtersql_list[$lead_filter_id]; + $filterSQL = eregi_replace("^and|and$|^or|or$","",$filterSQL); + if (strlen($filterSQL)>4) + {$fSQL = "and $filterSQL";} + else + {$fSQL = '';} + + + echo "

\n"; + echo "Zeige Anzahl anrufbarer Anschlüsse -

\n"; + echo "CAMPAIGN: $campaign_id
\n"; + echo "LISTEN: $camp_lists
\n"; + echo "STATUSES: $dial_statuses
\n"; + echo "FILTER: $lead_filter_id
\n"; + echo "CALL TIME: $local_call_time

\n"; + + ### call function to calculate and print dialable leads + dialable_leads($DB,$link,$local_call_time,$dial_statuses,$camp_lists,$fSQL); + + echo "

\n"; + echo "\n"; + + exit; + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + +###################### +# ADD=7111111 view sample script with test variables +###################### + +if ($ADD==7111111) +{ + ##### TEST VARIABLES ##### + $vendor_lead_code = 'VENDOR:LEAD;CODE'; + $list_id = 'LISTID'; + $gmt_offset_now = 'GMTOFFSET'; + $phone_code = '1'; + $phone_number = '7275551212'; + $title = 'Mr.'; + $first_name = 'JOHN'; + $middle_initial = 'Q'; + $last_name = 'PUBLIC'; + $address1 = '1234 Main St.'; + $address2 = 'Apt. 3'; + $address3 = 'ADDRESS3'; + $city = 'CHICAGO'; + $state = 'IL'; + $province = 'PROVINCE'; + $postal_code = '33760'; + $country_code = 'USA'; + $gender = 'M'; + $date_of_birth = '1970-01-01'; + $alt_phone = '3125551212'; + $email = 'test@test.com'; + $security_phrase = 'SECUTIRY'; + $comments = 'COMMENTS FIELD'; + $RGfullname = 'JOE AGENT'; + $RGuser = '6666'; + $RGlead_id = '1234'; + $RGcampaign = 'TESTCAMP'; + $RGphone_login = 'gs102'; + $RGgroup = 'TESTCAMP'; + $RGchannel_group = 'TESTCAMP'; + $RGSQLdate = date("Y-m-d H:i:s"); + $RGepoch = date("U"); + $RGuniqueid = '1163095830.4136'; + $RGcustomer_zap_channel = 'Zap/1-1'; + $RGserver_ip = '10.10.10.15'; + $RGSIPexten = 'SIP/gs102'; + $RGsession_id = '8600051'; + +echo "\n"; +echo "\n"; +echo "\n"; +echo ""; + +$stmt="SELECT * from vicidial_scripts where script_id='$script_id';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$script_name = $row[1]; +$script_text = $row[3]; + +if (eregi("iframe src",$script_text)) + { + $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(' ','+',$address2); + $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); + $RGfullname = eregi_replace(' ','+',$RGfullname); + $RGuser = eregi_replace(' ','+',$RGuser); + $RGlead_id = eregi_replace(' ','+',$RGlead_id); + $RGcampaign = eregi_replace(' ','+',$RGcampaign); + $RGphone_login = eregi_replace(' ','+',$RGphone_login); + $RGgroup = eregi_replace(' ','+',$RGgroup); + $RGchannel_group = eregi_replace(' ','+',$RGchannel_group); + $RGSQLdate = eregi_replace(' ','+',$RGSQLdate); + $RGepoch = eregi_replace(' ','+',$RGepoch); + $RGuniqueid = eregi_replace(' ','+',$RGuniqueid); + $RGcustomer_zap_channel = eregi_replace(' ','+',$RGcustomer_zap_channel); + $RGserver_ip = eregi_replace(' ','+',$RGserver_ip); + $RGSIPexten = eregi_replace(' ','+',$RGSIPexten); + $RGsession_id = eregi_replace(' ','+',$RGsession_id); + } + +$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--fullname--B--',"$RGfullname",$script_text); +$script_text = eregi_replace('--A--fronter--B--',"$RGuser",$script_text); +$script_text = eregi_replace('--A--user--B--',"$RGuser",$script_text); +$script_text = eregi_replace('--A--lead_id--B--',"$RGlead_id",$script_text); +$script_text = eregi_replace('--A--campaign--B--',"$RGcampaign",$script_text); +$script_text = eregi_replace('--A--phone_login--B--',"$RGphone_login",$script_text); +$script_text = eregi_replace('--A--group--B--',"$RGgroup",$script_text); +$script_text = eregi_replace('--A--channel_group--B--',"$RGchannel_group",$script_text); +$script_text = eregi_replace('--A--SQLdate--B--',"$RGSQLdate",$script_text); +$script_text = eregi_replace('--A--epoch--B--',"$RGepoch",$script_text); +$script_text = eregi_replace('--A--uniqueid--B--',"$RGuniqueid",$script_text); +$script_text = eregi_replace('--A--customer_zap_channel--B--',"$RGcustomer_zap_channel",$script_text); +$script_text = eregi_replace('--A--server_ip--B--',"$RGserver_ip",$script_text); +$script_text = eregi_replace('--A--SIPexten--B--',"$RGSIPexten",$script_text); +$script_text = eregi_replace('--A--session_id--B--',"$RGsession_id",$script_text); +$script_text = eregi_replace("\n","
",$script_text); + + +echo ""; + +echo "Vorbetrachtung-Index: $script_id
\n"; +echo "
\n"; +echo "
$script_name
\n"; +echo "$script_text\n"; +echo "
\n"; + +echo "\n"; + +exit; +} + + + + +######################### HTML HEADER BEGIN ####################################### +if ($hh=='users') + {$users_hh="bgcolor =\"$users_color\""; $users_fc="$users_font"; $users_bold="$header_selected_bold";} + else {$users_hh=''; $users_fc='WHITE'; $users_bold="$header_nonselected_bold";} +if ($hh=='campaigns') + {$campaigns_hh="bgcolor=\"$campaigns_color\""; $campaigns_fc="$campaigns_font"; $campaigns_bold="$header_selected_bold";} + else {$campaigns_hh=''; $campaigns_fc='WHITE'; $campaigns_bold="$header_nonselected_bold";} +if ($hh=='lists') + {$lists_hh="bgcolor=\"$lists_color\""; $lists_fc="$lists_font"; $lists_bold="$header_selected_bold";} + else {$lists_hh=''; $lists_fc='WHITE'; $lists_bold="$header_nonselected_bold";} +if ($hh=='ingroups') + {$ingroups_hh="bgcolor=\"$ingroups_color\""; $ingroups_fc="$ingroups_font"; $ingroups_bold="$header_selected_bold";} + else {$ingroups_hh=''; $ingroups_fc='WHITE'; $ingroups_bold="$header_nonselected_bold";} +if ($hh=='remoteagent') + {$remoteagent_hh="bgcolor=\"$remoteagent_color\""; $remoteagent_fc="$remoteagent_font"; $remoteagent_bold="$header_selected_bold";} + else {$remoteagent_hh=''; $remoteagent_fc='WHITE'; $remoteagent_bold="$header_nonselected_bold";} +if ($hh=='usergroups') + {$usergroups_hh="bgcolor=\"$usergroups_color\""; $usergroups_fc="$usergroups_font"; $usergroups_bold="$header_selected_bold";} + else {$usergroups_hh=''; $usergroups_fc='WHITE'; $usergroups_bold="$header_nonselected_bold";} +if ($hh=='scripts') + {$scripts_hh="bgcolor=\"$scripts_color\""; $scripts_fc="$scripts_font"; $scripts_bold="$header_selected_bold";} + else {$scripts_hh=''; $scripts_fc='WHITE'; $scripts_bold="$header_nonselected_bold";} +if ($hh=='filters') + {$filters_hh="bgcolor=\"$filters_color\""; $filters_fc="$filters_font"; $filters_bold="$header_selected_bold";} + else {$filters_hh=''; $filters_fc='WHITE'; $filters_bold="$header_nonselected_bold";} +if ($hh=='admin') + {$admin_hh="bgcolor=\"$admin_color\""; $admin_fc="$admin_font"; $admin_bold="$header_selected_bold";} + else {$admin_hh=''; $admin_fc='WHITE'; $admin_bold="$header_nonselected_bold";} +if ($hh=='reports') + {$reports_hh="bgcolor=\"$reports_color\""; $reports_fc="$reports_font"; $reports_bold="$header_selected_bold";} + else {$reports_hh=''; $reports_fc='WHITE'; $reports_bold="$header_nonselected_bold";} + +echo "\n"; +echo " + + +\n"; +echo "
English Deutsch
BGCOLOR=#D9E6FE cellpadding=2 cellspacing=0> + + + + + + + + + + + + + + + 1) { + ?> +> + 1) + { + +# if ($sh=='basic') {$basic_sh="bgcolor=\"$subcamp_color\""; $basic_fc="$subcamp_font";} +# else {$basic_sh=''; $basic_fc='BLACK';} +# if ($sh=='detail') {$detail_sh="bgcolor=\"$subcamp_color\""; $detail_fc="$subcamp_font";} +# else {$detail_sh=''; $detail_fc='BLACK';} +# if ($sh=='dialstat') {$dialstat_sh="bgcolor=\"$subcamp_color\""; $dialstat_fc="$subcamp_font";} +# else {$dialstat_sh=''; $dialstat_fc='BLACK';} + + if ($sh=='basic') {$sh='list';} + if ($sh=='detail') {$sh='list';} + if ($sh=='dialstat') {$sh='list';} + + if ($sh=='list') {$list_sh="bgcolor=\"$subcamp_color\""; $list_fc="$subcamp_font";} + else {$list_sh=''; $list_fc='BLACK';} + if ($sh=='status') {$status_sh="bgcolor=\"$subcamp_color\""; $status_fc="$subcamp_font";} + else {$status_sh=''; $status_fc='BLACK';} + if ($sh=='hotkey') {$hotkey_sh="bgcolor=\"$subcamp_color\""; $hotkey_fc="$subcamp_font";} + else {$hotkey_sh=''; $hotkey_fc='BLACK';} + if ($sh=='recycle') {$recycle_sh="bgcolor=\"$subcamp_color\""; $recycle_fc="$subcamp_font";} + else {$recycle_sh=''; $recycle_fc='BLACK';} + if ($sh=='autoalt') {$autoalt_sh="bgcolor=\"$subcamp_color\""; $autoalt_fc="$subcamp_font";} + else {$autoalt_sh=''; $autoalt_fc='BLACK';} + if ($sh=='pause') {$pause_sh="bgcolor=\"$subcamp_color\""; $pause_fc="$subcamp_font";} + else {$pause_sh=''; $pause_fc='BLACK';} + if ($sh=='listmix') {$listmix_sh="bgcolor=\"$subcamp_color\""; $listmix_fc="$subcamp_font";} + else {$listmix_sh=''; $listmix_fc='BLACK';} + + ?> +> + + + + + + + + + 1) { + ?> + > + 1) { + ?> +> + 1) { + ?> +> + 1) { + ?> +> + 1) { + ?> +> + 1) { + ?> +> + 1) { + ?> +> + 1) { + if ($sh=='times') {$times_sh="bgcolor=\"$times_color\""; $times_fc="$times_font";} # hard teal + else {$times_sh=''; $times_fc='BLACK';} + if ($sh=='phones') {$phones_sh="bgcolor=\"$server_color\""; $phones_fc="$phones_font";} # pink + else {$phones_sh=''; $phones_fc='BLACK';} + if ($sh=='server') {$server_sh="bgcolor=\"$server_color\""; $server_fc="$server_font";} # pink + else {$server_sh=''; $server_fc='BLACK';} + if ($sh=='conference') {$conference_sh="bgcolor=\"$server_color\""; $conference_fc="$server_font";} # pink + else {$conference_sh=''; $conference_fc='BLACK';} + if ($sh=='settings') {$settings_sh="bgcolor=\"$settings_color\""; $settings_fc="$settings_font";} # pink + else {$settings_sh=''; $settings_fc='BLACK';} + if ($sh=='status') {$status_sh="bgcolor=\"$status_color\""; $status_fc="$status_font";} # pink + else {$status_sh=''; $status_fc='BLACK';} + + ?> +> + + + + + + + + 1) { + ?> + > + 1) { + ?> + > + 1) { + ?> + > + 1) { + ?> + > + 1) { + ?> + > + 1) { + ?> + > + \n"; + echo "Sie haben nicht die Rechte, um diese Seite anzusehen. Bitte zurück gehen.\n"; + } + +} +if (strlen($reports_hh) > 1) { + ?> +> + + + + +
  VICIDIAL ADMIN - HAUPT | Logout  
> SIZE=> Benutzer > SIZE=> Kampagnen > SIZE=> Listen > SIZE=> Indexe > SIZE=> Filter > SIZE=> In-Gruppen > SIZE=> Benutzer-Gruppen > SIZE=> Remotemittel > SIZE=> Admin > SIZE=> Reports
>   > Zeigen Sie Benutzer     |     > Addieren Sie Einen Neuen Benutzer     |     > Copy Benutzer     |     > Suche Nach Einem Benutzer
COLSPAN=2> SIZE=>Kampagnen Hauptsächlich COLSPAN=1> SIZE=> Statuses COLSPAN=1> SIZE=> HotKeys COLSPAN=2> SIZE=>Leitung Bereiten Auf COLSPAN=1> SIZE=>Vorwahlknopf Automobil-Alt COLSPAN=1> SIZE=>Pause Codes COLSPAN=2> SIZE=>Liste Mischung
>   > Zeigen Sie Kampagnen     |     > Addieren Sie Eine Neue Kampagne     |     > Copy Kampagne     |     > Realzeitkampagnen Zusammenfassend
>   > Zeigen Sie Listen     |     > Addieren Sie Eine Neue Liste     |     > Suche Nach Einer Leitung     |     > Fügen Sie Zahl DNC Hinzu     |     > Last Neue Leitungen
>   > Zeigen Sie Indexe     |     > Addieren Sie Einen Neuen Index
>   > Zeigen Sie Filter     |     > Addieren Sie Einen Neuen Filter
>   > Zeigen Sie In-Gruppen     |     > Addieren Sie Eine Neue In-Gruppe     |     > Copy In-Gruppe
>   > Zeigen Sie Benutzer-Gruppen     |     > Addieren Sie Eine Neue Benutzer-Gruppe     |     > Gruppe Stündlicher Report
>   > Zeigen Sie Remotemittel     |     > Addieren Sie Neue Remotemittel
COLSPAN=2> SIZE=> Anruf-Zeiten COLSPAN=2> SIZE=> Telefone COLSPAN=2> SIZE=> Konferenzen COLSPAN=1> SIZE=> Bediener COLSPAN=1> SIZE=> System Einstellungen COLSPAN=2> SIZE=>Systemstatus
>   > Zeigen Sie Anruf-Zeiten     |     > Addieren Sie Eine Neue Anruf-Zeit     |     > Zeigen Sie Zustand-Anruf-Zeiten     |     > Addieren Sie Eine Neue Zustand-Anruf-Zeit  
>   > Zeigen Sie Telefone   |   > Addieren Sie Ein Neues Telefon
> Zeigen Sie Konferenzen   |   > Addieren Sie Eine Neue Konferenz   |   > Zeigen Sie VICIDIAL Konferenzen   |   > Addieren Sie Eine Neue VICIDIAL Konferenz
> Zeigen Sie Bediener   |   > Addieren Sie Einen Neuen Bediener
> System Einstellungen
>Systemstatus   |   >Status-Kategorien
>  
+
\n"; + echo ""; + + echo "
ADDIEREN Sie Einen NEUEN BENUTZER
\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "$NWB#vicidial_users-user_group$NWE\n"; + echo "\n"; + echo "
Benutzer-Zahl: $NWB#vicidial_users-user$NWE
Kennwort:$NWB#vicidial_users-pass$NWE
Voller Name: $NWB#vicidial_users-full_name$NWE
Benutzer-Niveau: $NWB#vicidial_users-user_level$NWE
Benutzer-Gruppe:
Telefon-LOGON: $NWB#vicidial_users-phone_login$NWE
Telefon-Durchlauf: $NWB#vicidial_users-phone_pass$NWE
\n"; + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + +###################### +# ADD=1 display the COPY USER FORM SCREEN +###################### + +if ($ADD=="1A") +{ + if ($LOGmodify_users==1) + { + echo "
\n"; + echo ""; + + echo "
COPY BENUTZER\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + if ($LOGuser_level==9) {$levelMAX=10;} + else {$levelMAX=$LOGuser_level;} + + echo "\n"; + echo "\n"; + echo "
Benutzer-Zahl: $NWB#vicidial_users-user$NWE
Kennwort:$NWB#vicidial_users-pass$NWE
Voller Name: $NWB#vicidial_users-full_name$NWE
Source User: $NWB#vicidial_users-user$NWE
\n"; + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + +###################### +# ADD=11 display the ADD NEW CAMPAIGN FORM SCREEN +###################### + +if ($ADD==11) +{ + if ($LOGmodify_campaigns==1) + { + echo "
\n"; + echo ""; + + echo "
ADDIEREN Sie Eine NEUE KAMPAGNE\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Kampagne Identifikation: $NWB#vicidial_campaigns-campaign_id$NWE
Kampagne Name: $NWB#vicidial_campaigns-campaign_name$NWE
Kampagne Beschreibung: $NWB#vicidial_campaigns-campaign_description$NWE
Aktiv:$NWB#vicidial_campaigns-active$NWE
Park-Verlängerung: $NWB#vicidial_campaigns-park_ext$NWE
Park-Dateiname: $NWB#vicidial_campaigns-park_file_name$NWE
Netz-Form: $NWB#vicidial_campaigns-web_form_address$NWE
Erlauben Sie Closers: $NWB#vicidial_campaigns-allow_closers$NWE
Zufuhrbehälter-Niveau: $NWB#vicidial_campaigns-hopper_level$NWE
Selbstvorwahlknopf-Niveau: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE
Folgender Vertreter-Anruf: $NWB#vicidial_campaigns-next_agent_call$NWE
Ortsgespräch-Zeit: $NWB#vicidial_campaigns-local_call_time$NWE
Voicemail: $NWB#vicidial_campaigns-voicemail_ext$NWE
Index: $NWB#vicidial_campaigns-campaign_script$NWE
Erhalten Sie Anruf-Produkteinführung: $NWB#vicidial_campaigns-get_call_launch$NWE
\n"; + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + +###################### +# ADD=12 display the COPY CAMPAIGN FORM SCREEN +###################### + +if ($ADD==12) +{ + if ($LOGmodify_campaigns==1) + { + echo "
\n"; + echo ""; + + echo "
Copy Eine KAMPAGNE\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + + echo "\n"; + echo "
Kampagne Identifikation: $NWB#vicidial_campaigns-campaign_id$NWE
Kampagne Name: $NWB#vicidial_campaigns-campaign_name$NWE
Quellkampagne:$NWB#vicidial_campaigns-campaign_id$NWE
\n"; + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + +###################### +# ADD=111 display the ADD NEW LIST FORM SCREEN +###################### + +if ($ADD==111) +{ + if ($LOGmodify_lists==1) + { + echo "
\n"; + echo ""; + + echo "
ADD A NEW LIST\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Liste Identifikation: (nur Stellen)$NWB#vicidial_lists-list_id$NWE
Liste Name: $NWB#vicidial_lists-list_name$NWE
Liste Beschreibung: $NWB#vicidial_lists-list_description$NWE
Kampagne: $NWB#vicidial_lists-campaign_id$NWE
Aktiv:$NWB#vicidial_lists-active$NWE
\n"; + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + +###################### +# ADD=121 display the ADD NUMBER TO DNC FORM SCREEN and add a new number +###################### + +if ($ADD==121) +{ +echo "
\n"; +echo ""; + +if (strlen($phone_number) > 2) + { + $stmt="SELECT count(*) from vicidial_dnc where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
DNC NICHT ADDIERT - diese Telefonnummer ist bereits in benennen nichtListe: $phone_number

\n";} + else + { + $stmt="INSERT INTO vicidial_dnc (phone_number) values('$phone_number');"; + $rslt=mysql_query($stmt, $link); + + echo "
DNC FÜGTE HINZU: $phone_number

\n"; + + ### LOG INSERTION TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW DNC NUMBER|$PHP_AUTH_USER|$ip|'$phone_number'|\n"); + fclose($fp); + } + } + } + +echo "
FÜGEN Sie Eine ZAHL Der DNC LISTE Hinzu\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "
Telefonnummer: (nur Stellen)$NWB#vicidial_list-dnc$NWE
\n"; + +} + + +###################### +# ADD=1111 display the ADD NEW INBOUND GROUP SCREEN +###################### + +if ($ADD==1111) +{ + if ($LOGmodify_ingroups==1) + { + echo "
\n"; + echo ""; + + echo "
ADDIEREN Sie Eine NEUE INBOUND GRUPPE\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Gruppe Identifikation: (no spaces)$NWB#vicidial_inbound_groups-group_id$NWE
Gruppe Name: $NWB#vicidial_inbound_groups-group_name$NWE
Gruppe Farbe: $NWB#vicidial_inbound_groups-group_color$NWE
Aktiv:$NWB#vicidial_inbound_groups-active$NWE
Netz-Form: $NWB#vicidial_inbound_groups-web_form_address$NWE
Voicemail: $NWB#vicidial_inbound_groups-voicemail_ext$NWE
Folgender Vertreter-Anruf: $NWB#vicidial_inbound_groups-next_agent_call$NWE
Fronter Anzeige: $NWB#vicidial_inbound_groups-fronter_display$NWE
Index: $NWB#vicidial_inbound_groups-ingroup_script$NWE
Erhalten Sie Anruf-Produkteinführung: $NWB#vicidial_inbound_groups-get_call_launch$NWE
\n"; + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + +###################### +# ADD=1211 display the COPY INBOUND GROUP SCREEN +###################### + +if ($ADD==1211) +{ + if ($LOGmodify_ingroups==1) + { + echo "
\n"; + echo ""; + + echo "
COPY INBOUND GRUPPE\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + + echo "\n"; + echo "
Gruppe Identifikation: (no spaces)$NWB#vicidial_inbound_groups-group_id$NWE
Gruppe Name: $NWB#vicidial_inbound_groups-group_name$NWE
Source Gruppe Identifikation: $NWB#vicidial_inbound_groups-group_id$NWE
\n"; + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + +###################### +# ADD=11111 display the ADD NEW REMOTE AGENTS SCREEN +###################### + +if ($ADD==11111) +{ + if ($LOGmodify_remoteagents==1) + { + echo "
\n"; + echo ""; + + echo "
ADDIEREN SIE NEUE REMOTEMITTEL\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Benutzernummer Anfang: (nur Zahlen, incremented)$NWB#vicidial_remote_agents-user_start$NWE
Zeilenzahl: (nur Zahlen)$NWB#vicidial_remote_agents-number_of_lines$NWE
Bediener IP: $NWB#vicidial_remote_agents-server_ip$NWE
Externe Verlängerung: (dial plan Zahl wählte, um Mittel zu erreichen)$NWB#vicidial_remote_agents-conf_exten$NWE
Status:$NWB#vicidial_remote_agents-status$NWE
Kampagne: $NWB#vicidial_remote_agents-campaign_id$NWE
Inbound Gruppen: \n"; + echo "$groups_list"; + echo "$NWB#vicidial_remote_agents-closer_campaigns$NWE
\n"; + echo "ANMERKUNG: Sie kann bis 30 Sekunden für die Änderungen dauern, dieauf diesem Schirm eingereicht werden, um Phasen zu gehen\n"; + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + +###################### +# ADD=111111 display the ADD NEW USERS GROUP SCREEN +###################### + +if ($ADD==111111) +{ + if ($LOGmodify_usergroups==1) + { + echo "
\n"; + echo ""; + + echo "
ADDIEREN SIE NEUE BENUTZER-GRUPPE\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Gruppe: (keine Räume oder Interpunktion)$NWB#vicidial_user_groups-user_group$NWE
Beschreibung: (Beschreibung der Gruppe)$NWB#vicidial_user_groups-group_name$NWE
\n"; + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + +###################### +# ADD=1111111 display the ADD NEW SCRIPT SCREEN +###################### + +if ($ADD==1111111) +{ + if ($LOGmodify_scripts==1) + { + echo "
\n"; + echo ""; + + echo "
ADD NEW SCRIPT\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Index Identifikation: (keine Räume oder Interpunktion)$NWB#vicidial_scripts-script_id$NWE
Index-Name: (Titel dem Index)$NWB#vicidial_scripts-script_name$NWE
Index-Anmerkungen: $NWB#vicidial_scripts-script_comments$NWE
Aktiv:$NWB#vicidial_scripts-active$NWE
Index-Text: "; + # BEGIN Insert Field + echo ""; + echo "
"; + # END Insert Field + echo " $NWB#vicidial_scripts-script_text$NWE
\n"; + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + +###################### +# ADD=11111111 display the ADD NEW FILTER SCREEN +###################### + +if ($ADD==11111111) +{ + if ($LOGmodify_filters==1) + { + echo "
\n"; + echo ""; + + echo "
ADDIEREN SIE NEUEN FILTER\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Filter Identifikation: (keine Räume oder Interpunktion)$NWB#vicidial_lead_filters-lead_filter_id$NWE
Filter-Name: (kurze Beschreibung des Filter)$NWB#vicidial_lead_filters-lead_filter_name$NWE
Filter-Anmerkungen: $NWB#vicidial_lead_filters-lead_filter_comments$NWE
Filter Sql: $NWB#vicidial_lead_filters-lead_filter_sql$NWE
\n"; + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + +###################### +# ADD=111111111 display the ADD NEW CALL TIME SCREEN +###################### + +if ($ADD==111111111) +{ + if ($LOGmodify_call_times==1) + { + echo "
\n"; + echo ""; + + echo "
Hinzufügen neuer Anrufzeiten\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "
Anrufzeit ID: (keine Räume oder Interpunktion)$NWB#vicidial_call_times-call_time_id$NWE
Anrufzeit Name: (Kurze Beschreibung der Anrufzeit)$NWB#vicidial_call_times-call_time_name$NWE
Anrufzeit Kommentare: $NWB#vicidial_call_times-call_time_comments$NWE
Datums und Zeitoptionen erscheinen, wenn die Anrufzeitdefinition angelegt wurde
\n"; + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + +###################### +# ADD=1111111111 display the ADD NEW STATE CALL TIME SCREEN +###################### + +if ($ADD==1111111111) +{ + if ($LOGmodify_call_times==1) + { + echo "
\n"; + echo ""; + + echo "
Hinzufügen neuer landesspezifischer Anrufzeiten\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "
Landesspezifische Anrufzeiten ID: (keine Räume oder Interpunktion)$NWB#vicidial_call_times-call_time_id$NWE
State Call Time State: (keine Räume oder Interpunktion)$NWB#vicidial_call_times-state_call_time_state$NWE
Landesspezifischer Anrufzeiten Name: (Kurze Beschreibung der Anrufzeit)$NWB#vicidial_call_times-call_time_name$NWE
Landesspezifischer Anrufzeiten Kommentar: $NWB#vicidial_call_times-call_time_comments$NWE
Datums und Zeitoptionen erscheinen, wenn die Anrufzeitdefinition angelegt wurde
\n"; + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + +###################### +# ADD=11111111111 display the ADD NEW PHONE SCREEN +###################### + +if ($ADD==11111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + echo "
ADDIEREN Sie Ein NEUES TELEFON\n"; + echo "\n"; + echo "
\n"; + + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Telefonverlängerung: $NWB#phones-extension$NWE
Dial Plan Zahl: (nur Stellen)$NWB#phones-dialplan_number$NWE
Voicemail Kasten: (nur Stellen)$NWB#phones-voicemail_id$NWE
Outbound CallerID: (nur Stellen)$NWB#phones-outbound_cid$NWE
Telefon-IP address: (optional)$NWB#phones-phone_ip$NWE
Computer-IP address: (optional)$NWB#phones-computer_ip$NWE
Bediener IP: $NWB#phones-server_ip$NWE
Login: $NWB#phones-login$NWE
Kennwort:$NWB#phones-pass$NWE
Status:$NWB#phones-status$NWE
Aktives Konto: $NWB#phones-active$NWE
Telefon-Art: $NWB#phones-phone_type$NWE
Voller Name: $NWB#phones-fullname$NWE
Firma:$NWB#phones-company$NWE
Abbildung:$NWB#phones-picture$NWE
Klient Protokoll: $NWB#phones-protocol$NWE
Lokales GMT: (Stellen Sie NICHT auf DST ein)$NWB#phones-local_gmt$NWE
\n"; + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + +###################### +# ADD=111111111111 display the ADD NEW SERVER SCREEN +###################### + +if ($ADD==111111111111) +{ + if ($LOGmodify_servers==1) + { + echo "
\n"; + echo ""; + + echo "
ADDIEREN Sie Einen NEUEN BEDIENER\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Bediener Identifikation: $NWB#servers-server_id$NWE
Bediener-Beschreibung: $NWB#servers-server_description$NWE
Bediener-IP address: $NWB#servers-server_ip$NWE
Aktiv:$NWB#servers-active$NWE
Sternchen-Version: $NWB#servers-asterisk_version$NWE
\n"; + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + +###################### +# ADD=1111111111111 display the ADD NEW CONFERENCE SCREEN +###################### + +if ($ADD==1111111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + echo "
ADDIEREN Sie Eine NEUE KONFERENZ\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Konferenz-Zahl: (nur Stellen)$NWB#conferences-conf_exten$NWE
Bediener IP: $NWB#conferences-server_ip$NWE
\n"; + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + +###################### +# ADD=11111111111111 display the ADD NEW VICIDIAL CONFERENCE SCREEN +###################### + +if ($ADD==11111111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + echo "
ADD A NEW VICIDIAL CONFERENCE\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Konferenz-Zahl: (nur Stellen)$NWB#conferences-conf_exten$NWE
Bediener IP: $NWB#conferences-server_ip$NWE
\n"; + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + + +###################################################################################################### +###################################################################################################### +####### 2 series, validates form data and inserts the new record into the database +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=2 adds the new user to the system +###################### + +if ($ADD=="2") +{ + echo ""; + $stmt="SELECT count(*) from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
BENUTZER NICHT ADDIERT - es gibt bereits einen Benutzer im System mitdieser Benutzerzahl\n";} + else + { + if ( (strlen($user) < 2) or (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user) > 8) ) + { + echo "
BENUTZER NICHT ADDIERT - gehen Sie bitte zurück und betrachten Siedie Daten, die Sie eingaben\n"; + echo "
Teilnehmerbezeichnung muß zwischen 2 und 8 Buchstaben lang sein\n"; + echo "
voller Name und Kennwort müssen mindestens 2 Buchstaben lang sein\n"; + } + else + { + echo "
BENUTZER FÜGTE HINZU: $user\n"; + + $stmt="INSERT INTO vicidial_users (user,pass,full_name,user_level,user_group,phone_login,phone_pass) values('$user','$pass','$full_name','$user_level','$user_group','$phone_login','$phone_pass');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A USER |$PHP_AUTH_USER|$ip|'$user','$pass','$full_name','$user_level','$user_group','$phone_login','$phone_pass'|\n"); + fclose($fp); + } + } + } + +$ADD=3; +} + +###################### +# ADD=2A adds the copied new user to the system +###################### + +if ($ADD=="2A") +{ + echo ""; + $stmt="SELECT count(*) from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
BENUTZER NICHT ADDIERT - es gibt bereits einen Benutzer im System mitdieser Benutzerzahl\n";} + else + { + if ( (strlen($user) < 2) or (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user) > 8) ) + { + echo "
BENUTZER NICHT ADDIERT - gehen Sie bitte zurück und betrachten Siedie Daten, die Sie eingaben\n"; + echo "
Teilnehmerbezeichnung muß zwischen 2 und 8 Buchstaben lang sein\n"; + echo "
voller Name und Kennwort müssen mindestens 2 Buchstaben lang sein\n"; + } + else + { + $stmt="INSERT INTO vicidial_users (user,pass,full_name,user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override) SELECT \"$user\",\"$pass\",\"$full_name\",user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override from vicidial_users where user=\"$source_user_id\";"; + $rslt=mysql_query($stmt, $link); + + $stmtA="INSERT INTO vicidial_inbound_group_agents (user,group_id,group_rank,group_weight,calls_today) SELECT \"$user\",group_id,group_rank,group_weight,\"0\" from vicidial_inbound_group_agents where user=\"$source_user_id\";"; + $rslt=mysql_query($stmtA, $link); + + $stmtA="INSERT INTO vicidial_campaign_agents (user,campaign_id,campaign_rank,campaign_weight,calls_today) SELECT \"$user\",campaign_id,campaign_rank,campaign_weight,\"0\" from vicidial_campaign_agents where user=\"$source_user_id\";"; + $rslt=mysql_query($stmtA, $link); + + echo "
USER COPIED: $user copied from $source_user_id\n"; + echo "

\n"; + echo "Click here to go to the user record\n"; + echo "

\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A COPIED USER |$PHP_AUTH_USER|$ip|$user|$source_user_id|$stmt|\n"); + fclose($fp); + } + } + } +exit; +} + +###################### +# ADD=21 adds the new campaign to the system +###################### + +if ($ADD==21) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
KAMPAGNE NICHT ADDIERT - es gibt bereits eine Kampagne im System mitdieser Identifikation\n";} + else + { + $stmt="SELECT count(*) from vicidial_inbound_groups where group_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN NOT ADDED - there is already an inbound group in the system with this ID\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($campaign_id) > 8) or (strlen($campaign_name) < 6) or (strlen($campaign_name) > 40) ) + { + echo "
KAMPAGNE NICHT ADDIERT - gehen Sie bitte zurück und betrachten Siedie Daten, die Sie eingaben\n"; + echo "
Kampagne Identifikation muß zwischen 2 und 8 Buchstaben lang sein\n"; + echo "
Kampagne Name muß zwischen 6 und 40 Buchstaben lang sein\n"; + } + else + { + echo "
KAMPAGNE ADDIERT: $campaign_id\n"; + + $stmt="INSERT INTO vicidial_campaigns (campaign_id,campaign_name,campaign_description,active,dial_status_a,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,campaign_script,get_call_launch,campaign_changedate,campaign_stats_refresh,list_order_mix) values('$campaign_id','$campaign_name','$campaign_description','$active','NEW','DOWN','$park_ext','$park_file_name','" . mysql_real_escape_string($web_form_address) . "','$allow_closers','$hopper_level','$auto_dial_level','$next_agent_call','$local_call_time','$voicemail_ext','$script_id','$get_call_launch','$SQLdate','Y','DISABLED');"; + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_campaign_stats (campaign_id) values('$campaign_id');"; + $rslt=mysql_query($stmt, $link); + + echo ""; + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADDIEREN Sie Eine NEUE KAMPAGNE |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + } + } + } +$ADD=31; +} + +###################### +# ADD=20 adds copied new campaign to the system +###################### + +if ($ADD==20) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
KAMPAGNE NICHT ADDIERT - es gibt bereits eine Kampagne im System mitdieser Identifikation\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($campaign_id) > 8) or (strlen($campaign_name) < 2) or (strlen($source_campaign_id) < 2) or (strlen($source_campaign_id) > 8) ) + { + echo "
KAMPAGNE NICHT ADDIERT - gehen Sie bitte zurück und betrachten Siedie Daten, die Sie eingaben\n"; + echo "
Kampagne Identifikation muß zwischen 2 und 8 Buchstaben lang sein\n"; + echo "
source Kampagne Identifikation muß zwischen 2 und 8 Buchstaben lang sein\n"; + } + else + { + echo "
CAMPAIGN COPIED: $campaign_id copied from $source_campaign_id\n"; + + $stmt="INSERT INTO vicidial_campaigns (campaign_name,campaign_id,active,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,safe_harbor_message,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,list_order_mix,campaign_allow_inbound,manual_dial_list_id,default_xfer_group) SELECT \"$campaign_name\",\"$campaign_id\",\"N\",dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,safe_harbor_message,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,\"DISABLED\",campaign_allow_inbound,manual_dial_list_id,default_xfer_group from vicidial_campaigns where campaign_id='$source_campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmtA="INSERT INTO vicidial_campaign_stats (campaign_id) values('$campaign_id');"; + $rslt=mysql_query($stmtA, $link); + + $stmtA="INSERT INTO vicidial_campaign_statuses (status,status_name,selectable,campaign_id,human_answered,category) SELECT status,status_name,selectable,\"$campaign_id\",human_answered,category from vicidial_campaign_statuses where campaign_id='$source_campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + $stmtA="INSERT INTO vicidial_campaign_hotkeys (status,hotkey,status_name,selectable,campaign_id) SELECT status,hotkey,status_name,selectable,\"$campaign_id\" from vicidial_campaign_hotkeys where campaign_id='$source_campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + $stmtA="INSERT INTO vicidial_lead_recycle (status,attempt_delay,attempt_maximum,active,campaign_id) SELECT status,attempt_delay,attempt_maximum,active,\"$campaign_id\" from vicidial_lead_recycle where campaign_id='$source_campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + $stmtA="INSERT INTO vicidial_pause_codes (pause_code,pause_code_name,billable,campaign_id) SELECT pause_code,pause_code_name,billable,\"$campaign_id\" from vicidial_pause_codes where campaign_id='$source_campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + echo ""; + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|COPY TO NEW CAMPAIGN|$PHP_AUTH_USER|$ip|$campaign_id|$source_campaign_id|$stmt|$stmtA|\n"); + fclose($fp); + } + + } + } +$ADD=31; +} + +###################### +# ADD=22 adds the new campaign status to the system +###################### + +if ($ADD==22) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
KAMPAGNE STATUS NICHT ADDIERT - es gibt bereits einen Kampagne-Statusim System mit diesem Namen\n";} + else + { + $stmt="SELECT count(*) from vicidial_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
KAMPAGNE STATUS NICHT ADDIERT - es gibt bereits einen Globalstatus imSystem mit diesem Namen\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($status_name) < 2) ) + { + echo "
KAMPAGNE STATUS NICHT ADDIERT - gehen Sie bitte zurück und betrachtenSie die Daten, die Sie eingaben\n"; + echo "
Status muß zwischen 1 und 8 Buchstaben lang sein\n"; + echo "
Statusname muß zwischen 2 und 30 Buchstaben lang sein\n"; + } + else + { + echo "
KAMPAGNE STATUS ADDIERT: $campaign_id - $status\n"; + + $stmt="INSERT INTO vicidial_campaign_statuses (status,status_name,selectable,campaign_id,human_answered,category) values('$status','$status_name','$selectable','$campaign_id','$human_answered','$category');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADDIEREN Sie Eine NEUE KAMPAGNE STATUS |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } +$SUB=22; +$ADD=31; +} + + +###################### +# ADD=23 adds the new campaign hotkey to the system +###################### + +if ($ADD==23) +{ + $HKstatus_data = explode('-----',$HKstatus); + $status = $HKstatus_data[0]; + $status_name = $HKstatus_data[1]; + + echo ""; + $stmt="SELECT count(*) from vicidial_campaign_hotkeys where campaign_id='$campaign_id' and hotkey='$hotkey' and hotkey='$hotkey';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN HOT KEY NOT ADDED - there is already a campaign-hotkey in the system with this hotkey\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($hotkey) < 1) ) + { + echo "
KAMPAGNE HOT KEY NICHT ADDIERT - gehen Sie bitte zurück und betrachtenSie die Daten, die Sie eingaben\n"; + echo "
hotkey must be a single character between 1 and 9 \n"; + echo "
Status muß zwischen 1 und 8 Buchstaben lang sein\n"; + } + else + { + echo "
KAMPAGNE HOT KEY FÜGTE HINZU: $campaign_id - $status - $hotkey\n"; + + $stmt="INSERT INTO vicidial_campaign_hotkeys values('$status','$hotkey','$status_name','$selectable','$campaign_id');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADDIEREN Sie Eine NEUE KAMPAGNE HOT KEY |$PHP_AUTH_USER|$ip|'$status','$hotkey','$status_name','$selectable','$campaign_id'|\n"); + fclose($fp); + } + } + } +$SUB=23; +$ADD=31; +} + + +###################### +# ADD=25 adds the new campaign lead recycle entry to the system +###################### + +if ($ADD==25) +{ + $status = eregi_replace("-----.*",'',$status); + echo ""; + $stmt="SELECT count(*) from vicidial_lead_recycle where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
KAMPAGNE LEITUNG BEREITEN NICHT HINZUGEFÜGT auf - es gibt bereitseine Führenwiederverwertung für diese Kampagne mit diesem Status\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or ($attempt_delay < 120) or ($attempt_maximum < 1) or ($attempt_maximum > 10) ) + { + echo "
KAMPAGNE LEITUNG BEREITEN NICHT HINZUGEFÜGT auf - gehen Sie bittezurück und betrachten Sie die Daten, die Sie eingaben\n"; + echo "
Status muß zwischen 1 und 6 Buchstaben lang sein\n"; + echo "
Versuch verzögert muß mindestens 120 Sekunden sein\n"; + echo "
maximale Versuche müssen von 1 bis 10 sein\n"; + } + else + { + echo "
KAMPAGNE LEITUNG BEREITEN HINZUGEFÜGT AUF: $campaign_id - $status - $attempt_delay\n"; + + $stmt="INSERT INTO vicidial_lead_recycle(campaign_id,status,attempt_delay,attempt_maximum,active) values('$campaign_id','$status','$attempt_delay','$attempt_maximum','$active');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW LEAD RECYCLE |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$SUB=25; +$ADD=31; +} + + +###################### +# ADD=26 adds the new auto alt dial status to the campaign +###################### + +if ($ADD==26) +{ + $status = eregi_replace("-----.*",'',$status); + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and auto_alt_dial_statuses LIKE \"% $status %\";"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
SELBSTALT VORWAHLKNOPF-STATUS NICHT ADDIERT - es gibt bereits eine Eintragung für diese Kampagne mit diesem Status\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
SELBSTALT VORWAHLKNOPF-STATUS NICHT ADDIERT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Status muß zwischen 1 und 6 Buchstaben lang sein\n"; + } + else + { + echo "
SELBSTALT VORWAHLKNOPF-STATUS FÜGTE HINZU: $campaign_id - $status\n"; + + $stmt="SELECT auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if (strlen($row[0])<2) {$row[0] = ' -';} + $auto_alt_dial_statuses = " $status$row[0]"; + $stmt="UPDATE vicidial_campaigns set auto_alt_dial_statuses='$auto_alt_dial_statuses' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A AUTO-ALT-DIAL STATUS|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$SUB=26; +$ADD=31; +} + + +###################### +# ADD=27 adds the new campaign agent pause code entry to the system +###################### + +if ($ADD==27) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_pause_codes where campaign_id='$campaign_id' and pause_code='$pause_code';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
MITTEL-PAUSE CODE NICHT ADDIERT - es gibt bereits eine Eintragung für diese Kampagne mit diesem PauseCode\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($pause_code) < 1) or (strlen($pause_code) > 6) or (strlen($pause_code_name) < 2) ) + { + echo "
MITTEL-PAUSE CODE NICHT ADDIERT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
pause code must be between 1 and 6 characters in length\n"; + echo "
pause code name must be between 2 and 30 characters in length\n"; + } + else + { + echo "
MITTEL-PAUSE CODE FÜGTE HINZU: $campaign_id - $pause_code - $pause_code_name\n"; + + $stmt="INSERT INTO vicidial_pause_codes(campaign_id,pause_code,pause_code_name,billable) values('$campaign_id','$pause_code','$pause_code_name','$billable');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW MITTELPAUSE CODE|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$SUB=27; +$ADD=31; +} + + +###################### +# ADD=28 adds new status to the campaign dial statuses +###################### + +if ($ADD==28) +{ + $status = eregi_replace("-----.*",'',$status); + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and dial_statuses LIKE \"% $status %\";"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
KAMPAGNE VORWAHLKNOPF-STATUS NICHT ADDIERT - es gibt bereits eine Eintragung für diese Kampagne mit diesem Status\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
KAMPAGNE VORWAHLKNOPF-STATUS NICHT ADDIERT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Status muß zwischen 1 und 6 Buchstaben lang sein\n"; + } + else + { + echo "
KAMPAGNE VORWAHLKNOPF-STATUS ADDIERT: $campaign_id - $status\n"; + + $stmt="SELECT dial_statuses from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if (strlen($row[0])<2) {$row[0] = ' -';} + $dial_statuses = " $status$row[0]"; + $stmt="UPDATE vicidial_campaigns set dial_statuses='$dial_statuses' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADDIEREN SIE KAMPAGNE DIAL STATUS |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +#$SUB=28; +$ADD=31; +} + + +###################### +# ADD=211 adds the new list to the system +###################### + +if ($ADD==211) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
LISTE NICHT ADDIERT - es gibt bereits eine Liste im System mit dieserIdentifikation\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($list_name) < 2) or ($list_id < 100) or (strlen($list_id) > 8) ) + { + echo "
LISTE NICHT ADDIERT - gehen Sie bitte zurück und betrachten Sie dieDaten, die Sie eingaben\n"; + echo "
Liste Identifikation muß zwischen 2 und 8 Buchstaben lang sein\n"; + echo "
Liste Name muß mindestens 2 Buchstaben lang sein\n"; + echo "
Liste Identifikation must be greater than 100\n"; + } + else + { + echo "
LISTE ADDIERT: $list_id\n"; + + $stmt="INSERT INTO vicidial_lists (list_id,list_name,campaign_id,active,list_description,list_changedate) values('$list_id','$list_name','$campaign_id','$active','$list_description','$SQLdate');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW LIST |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=311; +} + + + +###################### +# ADD=2111 adds the new inbound group to the system +###################### + +if ($ADD==2111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_inbound_groups where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
GRUPPE NICHT ADDIERT - es gibt bereits eine Gruppe im System mitdieser Identifikation\n";} + else + { + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
GROUP NOT ADDED - there is already a campaign in the system with this ID\n";} + else + { + if ( (strlen($group_id) < 2) or (strlen($group_name) < 2) or (strlen($group_color) < 2) or (strlen($group_id) > 20) or (eregi(' ',$group_id)) or (eregi("\-",$group_id)) or (eregi("\+",$group_id)) ) + { + echo "
GRUPPE NICHT ADDIERT - gehen Sie bitte zurück und betrachten Sie dieDaten, die Sie eingaben\n"; + echo "
Gruppe Identifikation muß zwischen 2 und 20 Buchstaben lang sein undNr. enthalten ' -+'.\n"; + echo "
Gruppe Name und Gruppe Farbe muß mindestens 2 Buchstaben lang sein\n"; + } + else + { + $stmt="INSERT INTO vicidial_inbound_groups (group_id,group_name,group_color,active,web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch) values('$group_id','$group_name','$group_color','$active','" . mysql_real_escape_string($web_form_address) . "','$voicemail_ext','$next_agent_call','$fronter_display','$script_id','$get_call_launch');"; + $rslt=mysql_query($stmt, $link); + + echo "
GRUPPE FÜGTE HINZU: $group_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW GROUP |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } +$ADD=3111; +} + + +###################### +# ADD=2011 adds copied inbound group to the system +###################### + +if ($ADD==2011) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_inbound_groups where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
GRUPPE NICHT ADDIERT - es gibt bereits eine Gruppe im System mitdieser Identifikation\n";} + else + { + if ( (strlen($group_id) < 2) or (strlen($group_name) < 2) or (strlen($group_id) > 20) or (eregi(' ',$group_id)) or (eregi("\-",$group_id)) or (eregi("\+",$group_id)) ) + { + echo "
GRUPPE NICHT ADDIERT - gehen Sie bitte zurück und betrachten Sie dieDaten, die Sie eingaben\n"; + echo "
Gruppe Identifikation muß zwischen 2 und 20 Buchstaben lang sein undNr. enthalten ' -+'.\n"; + echo "
Gruppe Name und Gruppe Farbe muß mindestens 2 Buchstaben lang sein\n"; + } + else + { + $stmt="INSERT INTO vicidial_inbound_groups (group_id,group_name,group_color,active,web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_message,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group) SELECT \"$group_id\",\"$group_name\",group_color,\"N\",web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_message,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group from vicidial_inbound_groups where group_id=\"$source_group_id\";"; + $rslt=mysql_query($stmt, $link); + + echo "
GRUPPE FÜGTE HINZU: $group_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|COPIED TO NEW GROUP |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=3111; +} + + +###################### +# ADD=21111 adds new remote agents to the system +###################### + +if ($ADD==21111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_remote_agents where server_ip='$server_ip' and user_start='$user_start';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
REMOTEMITTEL NICHT ADDIERT - es gibt bereits eineRemotemitteleintragung beginnend mit diesem userID\n";} + else + { + if ( (strlen($server_ip) < 2) or (strlen($user_start) < 2) or (strlen($campaign_id) < 2) or (strlen($conf_exten) < 2) ) + { + echo "
REMOTEMITTEL NICHT ADDIERT - gehen Sie bitte zurück und betrachtenSie die Daten, die Sie eingaben\n"; + echo "
Benutzernummer Anfang und externe Verlängerung müssen mindestens 2Buchstaben lang sein\n"; + } + else + { + $stmt="INSERT INTO vicidial_remote_agents values('','$user_start','$number_of_lines','$server_ip','$conf_exten','$status','$campaign_id','$groups_value');"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOTEMITTEL FÜGTEN HINZU: $user_start\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW REMOTEMITTEL ENTRY |$PHP_AUTH_USER|$ip|'$user_start','$number_of_lines','$server_ip','$conf_exten','$status','$campaign_id','$groups_value'|\n"); + fclose($fp); + } + } + } +$ADD=10000; +} + +###################### +# ADD=211111 adds new user group to the system +###################### + +if ($ADD==211111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_user_groups where user_group='$user_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
BENUTZER-GRUPPE NICHT ADDIERT - es gibt bereits eine BenutzergruppeEintragung mit diesem Namen\n";} + else + { + if ( (strlen($user_group) < 2) or (strlen($group_name) < 2) ) + { + echo "
BENUTZER-GRUPPE NICHT ADDIERT - gehen Sie bitte zurück und betrachtenSie die Daten, die Sie eingaben\n"; + echo "
Gruppe Name und Beschreibung müssen mindestens 2 Buchstaben langsein\n"; + } + else + { + $stmt="INSERT INTO vicidial_user_groups(user_group,group_name,allowed_campaigns) values('$user_group','$group_name','-ALL-CAMPAIGNS-');"; + $rslt=mysql_query($stmt, $link); + + echo "
BENUTZER-GRUPPE ADDIERT: $user_group\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADDIEREN Sie Einen NEUEN BENUTZER GROUP ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=100000; +} + +###################### +# ADD=2111111 adds new script to the system +###################### + +if ($ADD==2111111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_scripts where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
INDEX NICHT ADDIERT - es gibt bereits eine Indexeintragung mit diesem Namen\n";} + else + { + if ( (strlen($script_id) < 2) or (strlen($script_name) < 2) or (strlen($script_text) < 2) ) + { + echo "
INDEX NICHT ADDIERT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Indexname, -beschreibung und -text müssen mindestens 2 Buchstabenlang sein\n"; + } + else + { + $stmt="INSERT INTO vicidial_scripts values('$script_id','$script_name','$script_comments','$script_text','$active');"; + $rslt=mysql_query($stmt, $link); + + echo "
INDEX FÜGTE HINZU: $script_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW SCRIPT ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=1000000; +} + + +###################### +# ADD=21111111 adds new filter to the system +###################### + +if ($ADD==21111111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_lead_filters where lead_filter_id='$lead_filter_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
FILTER NICHT ADDIERT - es gibt bereits eine Filtereintragung mitdieser Identifikation\n";} + else + { + if ( (strlen($lead_filter_id) < 2) or (strlen($lead_filter_name) < 2) or (strlen($lead_filter_sql) < 2) ) + { + echo "
FILTER NICHT ADDIERT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Filtern Sie Identifikation, Namen und SQL muß mindestens 2 Buchstabenlang sein\n"; + } + else + { + $stmt="INSERT INTO vicidial_lead_filters SET lead_filter_id='$lead_filter_id',lead_filter_name='$lead_filter_name',lead_filter_comments='$lead_filter_comments',lead_filter_sql='$lead_filter_sql';"; + $rslt=mysql_query($stmt, $link); + + echo "
FILTER ADDIERT: $lead_filter_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW FILTER ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=10000000; +} + + +###################### +# ADD=211111111 adds new call time definition to the system +###################### + +if ($ADD==211111111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_call_times where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
Anrufzeit Definition nicht hinzugefügt - Es existiert bereits ein Anrufzeiteintrag mit dieser ID\n";} + else + { + if ( (strlen($call_time_id) < 2) or (strlen($call_time_name) < 2) ) + { + echo "
Anrufzeit Definition nicht hinzugefügt - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Anrufzeit ID und Name müssen mindestens 2 Zeichen Länge haben\n"; + } + else + { + $stmt="INSERT INTO vicidial_call_times SET call_time_id='$call_time_id',call_time_name='$call_time_name',call_time_comments='$call_time_comments';"; + $rslt=mysql_query($stmt, $link); + + echo "
Anrufzeit hinzugefügt: $call_time_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW CALL TIME ENTRY |$stmt|\n"); + fclose($fp); + } + } + } +$ADD=311111111; +} + + +###################### +# ADD=2111111111 adds new state call time definition to the system +###################### + +if ($ADD==2111111111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_state_call_times where state_call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
Landesspezifische Anrufzeitdefinition nicht hinzugefügt - Es existiert bereits ein Anrufzeiteintrag mit dieser ID\n";} + else + { + if ( (strlen($call_time_id) < 2) or (strlen($call_time_name) < 2) or (strlen($state_call_time_state) < 2) ) + { + echo "
Landesspezifische Anrufzeitdefinition nicht hinzugefügt - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Landesspezifische Anrufzeit ID, Name und Land müssen mindestens 2 Zeichen Länge haben\n"; + } + else + { + $stmt="INSERT INTO vicidial_state_call_times SET state_call_time_id='$call_time_id',state_call_time_name='$call_time_name',state_call_time_comments='$call_time_comments',state_call_time_state='$state_call_time_state';"; + $rslt=mysql_query($stmt, $link); + + echo "
landesspezifische Anrufzeiten hinzugefügt: $call_time_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW STATE CALL TIME ENTRY|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=3111111111; +} + + +###################### +# ADD=21111111111 adds new phone to the system +###################### + +if ($ADD==21111111111) +{ +echo "
\n"; + echo ""; + $stmt="SELECT count(*) from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
TELEFON NICHT ADDIERT - es gibt bereits ein Telefon im System mitdiesem extension/server\n";} + else + { + if ( (strlen($extension) < 1) or (strlen($server_ip) < 7) or (strlen($dialplan_number) < 1) or (strlen($voicemail_id) < 1) or (strlen($login) < 1) or (strlen($pass) < 1)) + {echo "
TELEFON NICHT ADDIERT - gehen Sie bitte zurück und betrachten Sie dieDaten, die Sie eingaben\n";} + else + { + echo "
TELEFON FÜGTE HINZU\n"; + + $stmt="INSERT INTO phones (extension,dialplan_number,voicemail_id,phone_ip,computer_ip,server_ip,login,pass,status,active,phone_type,fullname,company,picture,protocol,local_gmt,outbound_cid) values('$extension','$dialplan_number','$voicemail_id','$phone_ip','$computer_ip','$server_ip','$login','$pass','$status','$active','$phone_type','$fullname','$company','$picture','$protocol','$local_gmt','$outbound_cid');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=31111111111; +} + + +###################### +# ADD=211111111111 adds new server to the system +###################### + +if ($ADD==211111111111) +{ +echo "
\n"; + echo ""; + $stmt="SELECT count(*) from servers where server_id='$server_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
BEDIENERNOT ADDED - there is already a server in the system with this ID\n";} + else + { + if ( (strlen($server_id) < 1) or (strlen($server_ip) < 7) ) + {echo "
BEDIENERNOT ADDED - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n";} + else + { + echo "
BEDIENERADDED\n"; + + $stmt="INSERT INTO servers (server_id,server_description,server_ip,active,asterisk_version) values('$server_id','$server_description','$server_ip','$active','$asterisk_version');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=311111111111; +} + + +###################### +# ADD=221111111111 adds the new vicidial server trunk record to the system +###################### + +if ($ADD==221111111111) +{ + echo ""; + $stmt="SELECT max_vicidial_trunks from servers where server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $MAXvicidial_trunks = $rowx[0]; + + $stmt="SELECT sum(dedicated_trunks) from vicidial_server_trunks where server_ip='$server_ip' and campaign_id !='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $SUMvicidial_trunks = ($rowx[0] + $dedicated_trunks); + + if ($SUMvicidial_trunks > $MAXvicidial_trunks) + { + echo "
VICIDIAL BEDIENER-STAMM-SATZ NICHT ADDIERT - die Zahl vicidial Stämmen ist zu hoch: $SUMvicidial_trunks / $MAXvicidial_trunks\n"; + } + else + { + $stmt="SELECT count(*) from vicidial_server_trunks where campaign_id='$campaign_id' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
VICIDIAL BEDIENER-STAMM-SATZ NICHT ADDIERT - es gibt bereits eine Bediener-Stamm Aufzeichnung für diese Kampagne\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($server_ip) < 7) or (strlen($dedicated_trunks) < 1) or (strlen($trunk_restriction) < 1) ) + { + echo "
VICIDIAL BEDIENER-STAMM-SATZ NICHT ADDIERT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Kampagne muß zwischen 3 und 8 Buchstaben lang sein\n"; + echo "
server_ip verzögert muß mindestens 7 Buchstaben sein\n"; + echo "
Stämme müssen eine Stelle von 0 bis 9999 sein\n"; + } + else + { + echo "
VICIDIAL BEDIENER-STAMM-SATZ ADDIERT: $campaign_id - $server_ip - $dedicated_trunks - $trunk_restriction\n"; + + $stmt="INSERT INTO vicidial_server_trunks(server_ip,campaign_id,dedicated_trunks,trunk_restriction) values('$server_ip','$campaign_id','$dedicated_trunks','$trunk_restriction');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW VICIDIAL TRUNK |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } +$ADD=311111111111; +} + + +###################### +# ADD=2111111111111 adds new conference to the system +###################### + +if ($ADD==2111111111111) +{ +echo "
\n"; + echo ""; + $stmt="SELECT count(*) from conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
KONFERENZ NICHT ADDIERT - es gibt bereits eine Konferenz im System mitdieser Identifikation und Bediener\n";} + else + { + if ( (strlen($conf_exten) < 1) or (strlen($server_ip) < 7) ) + {echo "
KONFERENZ NICHT ADDIERT - gehen Sie bitte zurück und betrachten Siedie Daten, die Sie eingaben\n";} + else + { + echo "
KONFERENZ FÜGTE HINZU\n"; + + $stmt="INSERT INTO conferences (conf_exten,server_ip) values('$conf_exten','$server_ip');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=3111111111111; +} + + +###################### +# ADD=21111111111111 adds new vicidial conference to the system +###################### + +if ($ADD==21111111111111) +{ +echo "
\n"; + echo ""; + $stmt="SELECT count(*) from vicidial_conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
VICIDIAL CONFERENCE NOT ADDED - there is already a vicidial conference in the system with this ID and server\n";} + else + { + if ( (strlen($conf_exten) < 1) or (strlen($server_ip) < 7) ) + {echo "
VICIDIAL KONFERENZ NICHT ADDIERT - gehen Sie bitte zurück und betrachten Siedie Daten, die Sie eingaben\n";} + else + { + echo "
VICIDIAL KONFERENZ FÜGTE HINZU\n"; + + $stmt="INSERT INTO vicidial_conferences (conf_exten,server_ip) values('$conf_exten','$server_ip');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=31111111111111; +} + + +###################### +# ADD=221111111111111 adds the new system status to the system +###################### + +if ($ADD==221111111111111) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaign_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
SYSTEMSTATUS NICHT ADDIERT - there is already a campaign-status in the system with this name: $row[0]\n";} + else + { + $stmt="SELECT count(*) from vicidial_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
SYSTEMSTATUS NICHT ADDIERT - there is already a global-status in the system with this name\n";} + else + { + if ( (strlen($status) < 1) or (strlen($status_name) < 2) ) + { + echo "
SYSTEMSTATUS NICHT ADDIERT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Status muß zwischen 1 und 8 Buchstaben lang sein\n"; + echo "
Statusname muß zwischen 2 und 30 Buchstaben lang sein\n"; + } + else + { + echo "
SYSTEMSTATUS ADDIERT: $status_name - $status\n"; + + $stmt="INSERT INTO vicidial_statuses (status,status_name,selectable,human_answered,category) values('$status','$status_name','$selectable','$human_answered','$category');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW SYSTEM STATUS |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } +$ADD=321111111111111; +} + + +###################### +# ADD=231111111111111 adds the new status category to the system +###################### + +if ($ADD==231111111111111) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_status_categories where vsc_id='$vsc_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
STATUS-KATEGORIE NICHT ADDIERT - es gibt bereits eine Statuskategorie im System mit dieserIdentifikation: $row[0]\n";} + else + { + if ( (strlen($vsc_id) < 2) or (strlen($vsc_id) > 20) or (strlen($vsc_name) < 2) ) + { + echo "
STATUS-KATEGORIE NICHT ADDIERT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Identifikation muß zwischen 2 und 20 Buchstaben lang sein\n"; + echo "
Namensname muß zwischen 2 und 50 Buchstaben lang sein\n"; + } + else + { + echo "
STATUS CATEGORY ADDED: $vsc_id - $vsc_name\n"; + + $stmt="SELECT count(*) from vicidial_status_categories where tovdad_display='Y' and vsc_id NOT IN('$vsc_id');"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 3) and (ereg('Y',$tovdad_display)) ) + { + $tovdad_display = 'N'; + echo "
STÖRUNG: Es gibt bereits 4 den Status-Kategorienkatalog zurTimeOnVDAD Anzeige\n"; + } + + $stmt="INSERT INTO vicidial_status_categories (vsc_id,vsc_name,vsc_description,tovdad_display) values('$vsc_id','$vsc_name','$vsc_description','$tovdad_display');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW STATUS CATEGORY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=331111111111111; +} + + + +###################################################################################################### +###################################################################################################### +####### 4 series, record modifications submitted and DB is modified, then on to 3 series forms below +###################################################################################################### +###################################################################################################### + + + +###################### +# ADD=4A submit user modifications to the system - ADMIN +###################### + +if ($ADD=="4A") +{ + if ($LOGmodify_users==1) + { + echo ""; + + if ( (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) + { + echo "
BENUTZER NICHT GEÄNDERT - gehen Sie bitte zurück und betrachten Siedie Daten, die Sie eingaben\n"; + echo "
Kennwort und voller Name jedes Notwendigkeit ot sind mindestens 2Buchstaben lang\n"; + } + else + { + echo "
BENUTZER ÄNDERTE - ADMIN: $user\n"; + + $stmt="UPDATE vicidial_users set pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass',delete_users='$delete_users',delete_user_groups='$delete_user_groups',delete_lists='$delete_lists',delete_campaigns='$delete_campaigns',delete_ingroups='$delete_ingroups',delete_remote_agents='$delete_remote_agents',load_leads='$load_leads',campaign_detail='$campaign_detail',ast_admin_access='$ast_admin_access',ast_delete_phones='$ast_delete_phones',delete_scripts='$delete_scripts',modify_leads='$modify_leads',hotkeys_active='$hotkeys_active',change_agent_campaign='$change_agent_campaign',agent_choose_ingroups='$agent_choose_ingroups',closer_campaigns='$groups_value',scheduled_callbacks='$scheduled_callbacks',agentonly_callbacks='$agentonly_callbacks',agentcall_manual='$agentcall_manual',vicidial_recording='$vicidial_recording',vicidial_transfers='$vicidial_transfers',delete_filters='$delete_filters',alter_agent_interface_options='$alter_agent_interface_options',closer_default_blended='$closer_default_blended',delete_call_times='$delete_call_times',modify_call_times='$modify_call_times',modify_users='$modify_users',modify_campaigns='$modify_campaigns',modify_lists='$modify_lists',modify_scripts='$modify_scripts',modify_filters='$modify_filters',modify_ingroups='$modify_ingroups',modify_usergroups='$modify_usergroups',modify_remoteagents='$modify_remoteagents',modify_servers='$modify_servers',view_reports='$view_reports',vicidial_recording_override='$vicidial_recording_override',alter_custdata_override='$alter_custdata_override' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER INFO |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +$ADD=3; # go to user modification below +} + + +###################### +# ADD=4B submit user modifications to the system - ADMIN +###################### + +if ($ADD=="4B") +{ + if ($LOGmodify_users==1) + { + echo ""; + + if ( (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) + { + echo "
BENUTZER NICHT GEÄNDERT - gehen Sie bitte zurück und betrachten Siedie Daten, die Sie eingaben\n"; + echo "
Kennwort und voller Name jedes Notwendigkeit ot sind mindestens 2Buchstaben lang\n"; + } + else + { + echo "
BENUTZER ÄNDERTE - ADMIN: $user\n"; + + $stmt="UPDATE vicidial_users set pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass',hotkeys_active='$hotkeys_active',agent_choose_ingroups='$agent_choose_ingroups',closer_campaigns='$groups_value',scheduled_callbacks='$scheduled_callbacks',agentonly_callbacks='$agentonly_callbacks',agentcall_manual='$agentcall_manual',vicidial_recording='$vicidial_recording',vicidial_transfers='$vicidial_transfers',closer_default_blended='$closer_default_blended',vicidial_recording_override='$vicidial_recording_override',alter_custdata_override='$alter_custdata_override' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER INFO |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +$ADD=3; # go to user modification below +} + + + +###################### +# ADD=4 submit user modifications to the system +###################### + +if ($ADD==4) +{ + if ($LOGmodify_users==1) + { + echo ""; + + if ( (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) + { + echo "
BENUTZER NICHT GEÄNDERT - gehen Sie bitte zurück und betrachten Siedie Daten, die Sie eingaben\n"; + echo "
Kennwort und voller Name jedes Notwendigkeit ot sind mindestens 2Buchstaben lang\n"; + } + else + { + echo "
BENUTZER ÄNDERTE: $user\n"; + + $stmt="UPDATE vicidial_users set pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER INFO |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +$ADD=3; # go to user modification below +} + +###################### +# ADD=41 submit campaign modifications to the system +###################### + +if ($ADD==41) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_name) < 6) or (strlen($active) < 1) ) + { + echo "
KAMPAGNE NICHT GEÄNDERT - gehen Sie bitte zurück und betrachten Siedie Daten, die Sie eingaben\n"; + echo "
der Kampagne Name muß mindestens 6 Buchstaben lang sein\n"; + echo "
|$campaign_name|$active|\n"; + } + else + { + echo "
KAMPAGNE ÄNDERTE: $campaign_id\n"; + + if ($dial_method == 'MANUAL') + { + $auto_dial_level='0'; + $adlSQL = "auto_dial_level='0',"; + } + else + { + if ($dial_level_override > 0) + { + $adlSQL = "auto_dial_level='$auto_dial_level',"; + } + else + { + if ($dial_method == 'RATIO') + { + if ($auto_dial_level < 1) {$auto_dial_level = "1.0";} + $adlSQL = "auto_dial_level='$auto_dial_level',"; + } + else + { + $adlSQL = ""; + if ($auto_dial_level < 1) + { + $auto_dial_level = "1.0"; + $adlSQL = "auto_dial_level='$auto_dial_level',"; + } + } + } + } + if ( (!ereg("DISABLED",$list_order_mix)) and ($hopper_level < 100) ) + {$hopper_level='100';} + + $stmtA="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',allow_closers='$allow_closers',hopper_level='$hopper_level', $adlSQL next_agent_call='$next_agent_call', local_call_time='$local_call_time', voicemail_ext='$voicemail_ext', dial_timeout='$dial_timeout', dial_prefix='$dial_prefix', campaign_cid='$campaign_cid', campaign_vdad_exten='$campaign_vdad_exten', web_form_address='" . mysql_real_escape_string($web_form_address) . "', park_ext='$park_ext', park_file_name='$park_file_name', campaign_rec_exten='$campaign_rec_exten', campaign_recording='$campaign_recording', campaign_rec_filename='$campaign_rec_filename', campaign_script='$script_id', get_call_launch='$get_call_launch', am_message_exten='$am_message_exten', amd_send_to_vmx='$amd_send_to_vmx', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number',lead_filter_id='$lead_filter_id',alt_number_dialing='$alt_number_dialing',scheduled_callbacks='$scheduled_callbacks',safe_harbor_message='$safe_harbor_message',drop_call_seconds='$drop_call_seconds',safe_harbor_exten='$safe_harbor_exten',wrapup_seconds='$wrapup_seconds',wrapup_message='$wrapup_message',closer_campaigns='$groups_value',use_internal_dnc='$use_internal_dnc',allcalls_delay='$allcalls_delay',omit_phone_code='$omit_phone_code',dial_method='$dial_method',available_only_ratio_tally='$available_only_ratio_tally',adaptive_dropped_percentage='$adaptive_dropped_percentage',adaptive_maximum_level='$adaptive_maximum_level',adaptive_latest_server_time='$adaptive_latest_server_time',adaptive_intensity='$adaptive_intensity',adaptive_dl_diff_target='$adaptive_dl_diff_target',concurrent_transfers='$concurrent_transfers',auto_alt_dial='$auto_alt_dial',agent_pause_codes_active='$agent_pause_codes_active',campaign_description='$campaign_description',campaign_changedate='$SQLdate',campaign_stats_refresh='$campaign_stats_refresh',disable_alter_custdata='$disable_alter_custdata',no_hopper_leads_logins='$no_hopper_leads_logins',list_order_mix='$list_order_mix',campaign_allow_inbound='$campaign_allow_inbound',manual_dial_list_id='$manual_dial_list_id',default_xfer_group='$default_xfer_group',xfer_groups='$XFERgroups_value' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + if ($reset_hopper == 'Y') + { + echo "
ZURÜCKSTELLEN DES KAMPAGNE LEITUNG ZUFUHRBEHÄLTERS\n"; + echo "
- Wartezeit 1 Minute, bevor folgende Nummer gewählt wird\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id' and status IN('READY','QUEUE','DONE');"; + $rslt=mysql_query($stmt, $link); + + ### LOG RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|CAMPAIGN HOPPERRESET|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CAMPAIGN INFO|$PHP_AUTH_USER|$ip|$stmtA|$reset_hopper|\n"); + fclose($fp); + } + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=42 modify/delete campaign status in the system +###################### + +if ($ADD==42) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
KAMPAGNE STATUS NICHT GEÄNDERT - gehen Sie bitte zurück undbetrachten Sie die Daten, die Sie eingaben\n"; + echo "
die Kampagne Kennzeichnung muß mindestens 2 Buchstaben lang sein\n"; + echo "
der Kampagne Status muß mindestens Buchstaben 1 lang sein\n"; + } + else + { + if (ereg('delete',$stage)) + { + echo "
KUNDENSPEZIFISCHER KAMPAGNE STATUS GELÖSCHT: $campaign_id - $status\n"; + + $stmt="DELETE FROM vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + + $stmtA="DELETE FROM vicidial_campaign_hotkeys where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmtA, $link); + + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE CAMPAIGN STATUS|$PHP_AUTH_USER|$ip|$stmt|$stmtA|\n"); + fclose($fp); + } + } + if (ereg('modify',$stage)) + { + echo "
KUNDENSPEZIFISCHER KAMPAGNE STATUS GEÄNDERT: $campaign_id - $status\n"; + + $stmt="UPDATE vicidial_campaign_statuses SET status_name='$status_name',selectable='$selectable',human_answered='$human_answered',category='$category' where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CAMPAIGN STATUS|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +$SUB=22; +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=43 delete campaign hotkey in the system +###################### + +if ($ADD==43) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($hotkey) < 1) ) + { + echo "
KAMPAGNE HOT KEY NICHT GEÄNDERT - gehen Sie bitte zurück undbetrachten Sie die Daten, die Sie eingaben\n"; + echo "
die Kampagne Kennzeichnung muß mindestens 2 Buchstaben lang sein\n"; + echo "
der Kampagne Status muß mindestens Buchstaben 1 lang sein\n"; + echo "
the campaign hotkey needs to be at least 1 characters in length\n"; + } + else + { + echo "
KUNDENSPEZIFISCHE KAMPAGNE HOT KEY LÖSCHTE: $campaign_id - $status - $hotkey\n"; + + $stmt="DELETE FROM vicidial_campaign_hotkeys where campaign_id='$campaign_id' and status='$status' and hotkey='$hotkey';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE CAMPAIGN STATUS|$PHP_AUTH_USER|$ip|DELETE FROM vicidial_campaign_hotkeys where campaign_id='$campaign_id' and status='$status' and hotkey='$hotkey'|\n"); + fclose($fp); + } + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +$SUB=23; +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=44 submit campaign modifications to the system - Basic View +###################### + +if ($ADD==44) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_name) < 6) or (strlen($active) < 1) ) + { + echo "
KAMPAGNE NICHT GEÄNDERT - gehen Sie bitte zurück und betrachten Siedie Daten, die Sie eingaben\n"; + echo "
der Kampagne Name muß mindestens 6 Buchstaben lang sein\n"; + } + else + { + echo "
KAMPAGNE ÄNDERTE: $campaign_id\n"; + + if ($dial_method == 'RATIO') + { + if ($auto_dial_level < 1) {$auto_dial_level = "1.0";} + $adlSQL = "auto_dial_level='$auto_dial_level',"; + } + else + { + if ($dial_method == 'MANUAL') + { + $auto_dial_level='0'; + $adlSQL = "auto_dial_level='0',"; + } + else + { + $adlSQL = ""; + if ($auto_dial_level < 1) + { + $auto_dial_level = "1.0"; + $adlSQL = "auto_dial_level='$auto_dial_level',"; + } + } + } + if ( (!ereg("DISABLED",$list_order_mix)) and ($hopper_level < 100) ) + {$hopper_level='100';} + + $stmtA="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',hopper_level='$hopper_level', $adlSQL lead_filter_id='$lead_filter_id',dial_method='$dial_method',adaptive_intensity='$adaptive_intensity',campaign_changedate='$SQLdate',list_order_mix='$list_order_mix' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + if ($reset_hopper == 'Y') + { + echo "
ZURÜCKSTELLEN DES KAMPAGNE LEITUNG ZUFUHRBEHÄLTERS\n"; + echo "
- Wartezeit 1 Minute, bevor folgende Nummer gewählt wird\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id' and status IN('READY','QUEUE','DONE');;"; + $rslt=mysql_query($stmt, $link); + + ### LOG HOPPER RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|CAMPAIGN HOPPERRESET|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CAMPAIGN INFO|$PHP_AUTH_USER|$ip|$stmtA|$reset_hopper|\n"); + fclose($fp); + } + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +$ADD=34; # go to campaign modification form below +} + +###################### +# ADD=45 modify campaign lead recycle in the system +###################### + +if ($ADD==45) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or ($attempt_delay < 120) or ($attempt_maximum < 1) or ($attempt_maximum > 10) ) + { + echo "
CAMPAIGN LEAD RECYCLE NOT MODIFIED - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Status muß zwischen 1 und 6 Buchstaben lang sein\n"; + echo "
Versuch verzögert muß mindestens 120 Sekunden sein\n"; + echo "
maximale Versuche müssen von 1 bis 10 sein\n"; + } + else + { + echo "
CAMPAIGN LEAD MODIFIED: $campaign_id - $status - $attempt_delay\n"; + + $stmt="UPDATE vicidial_lead_recycle SET attempt_delay='$attempt_delay',attempt_maximum='$attempt_maximum',active='$active' where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LEAD RECYCLE |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +$SUB=25; +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=47 modify agent pause code in the system +###################### + +if ($ADD==47) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($pause_code) < 1) or (strlen($pause_code) > 6) or (strlen($pause_code_name) < 2) ) + { + echo "
MITTEL-PAUSE CODE NICHT GEÄNDERT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
pause_code must be between 1 and 6 characters in length\n"; + echo "
pause_code name must be between 2 and 30 characters in length\n"; + } + else + { + echo "
MITTELPAUSE CODE MODIFIED: $campaign_id - $pause_code - $pause_code_name\n"; + + $stmt="UPDATE vicidial_pause_codes SET pause_code_name='$pause_code_name',billable='$billable' where campaign_id='$campaign_id' and pause_code='$pause_code';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY MITTELPAUSECODE|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +$SUB=27; +$ADD=31; # go to campaign modification form below +} + + +###################### +# ADD=49 modify campaign list mix in the system +###################### + +if ($ADD==49) +{ + if ($LOGmodify_campaigns==1) + { + ##### MODIFY a list mix container entry ##### + if ($stage=='MODIFY') + { + echo ""; + + $Flist_mix_container = "list_mix_container_$vcl_id"; + $Fmix_method = "mix_method_$vcl_id"; + $Fstatus = "status_$vcl_id"; + $Fvcl_name = "vcl_name_$vcl_id"; + + if (isset($_GET[$Flist_mix_container])) {$list_mix_container=$_GET[$Flist_mix_container];} + elseif (isset($_POST[$Flist_mix_container])) {$list_mix_container=$_POST[$Flist_mix_container];} + if (isset($_GET[$Fmix_method])) {$mix_method=$_GET[$Fmix_method];} + elseif (isset($_POST[$Fmix_method])) {$mix_method=$_POST[$Fmix_method];} + if (isset($_GET[$Fstatus])) {$status=$_GET[$Fstatus];} + elseif (isset($_POST[$Fstatus])) {$status=$_POST[$Fstatus];} + if (isset($_GET[$Fvcl_name])) {$vcl_name=$_GET[$Fvcl_name];} + elseif (isset($_POST[$Fvcl_name])) {$vcl_name=$_POST[$Fvcl_name];} + $list_mix_container = preg_replace("/:$/","",$list_mix_container); + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) or (strlen($list_mix_container) < 6) or (strlen($vcl_name) < 2) ) + { + echo "
LISTE MISCHUNG NICHT GEÄNDERT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + echo "
vcl_name name must be between 2 and 30 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_campaigns_list_mix SET vcl_name='$vcl_name',mix_method='$mix_method',list_mix_container='$list_mix_container' where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
LISTE MISCHUNG ÄNDERTE: $campaign_id - $vcl_id - $vcl_name\n"; + } + } + + ##### ADD a list mix container entry ##### + if ($stage=='ADD') + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) or (strlen($list_id) < 1) ) + { + echo "
LISTE MISCHUNG NICHT GEÄNDERT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + echo "
list_id must be at least 2 characters in length\n"; + } + else + { + $stmt="SELECT list_mix_container from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $OLDlist_mix_container = $row[0]; + $NEWlist_mix_container = "$OLDlist_mix_container:$list_id|10|0| -|"; + + $stmt="UPDATE vicidial_campaigns_list_mix SET list_mix_container='$NEWlist_mix_container' where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
LISTE MISCHUNG ÄNDERTE: $campaign_id - $vcl_id - $list_id\n"; + } + } + + ##### REMOVE a list mix container entry ##### + if ($stage=='REMOVE') + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) or (strlen($list_id) < 1) ) + { + echo "
LISTE MISCHUNG NICHT GEÄNDERT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + echo "
list_id must be at least 2 characters in length\n"; + } + else + { + $stmt="SELECT list_mix_container from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $MIXentries = $MT; + $MIXentries = explode(":", $row[0]); + $Ms_to_print = (count($MIXentries) - 0); + + if ($Ms_to_print < 2) + { + echo "
LISTE MISCHUNG NICHT GEÄNDERT: Sie können nicht die letzte list_id Eintragung aus einer ListeMischung löschen\n"; + } + else + { + $MIXdetailsPCT = explode('|', $MIXentries[$mix_container_item]); + $MIXpercentPCT = $MIXdetailsPCT[2]; + + $q=0; + while ($Ms_to_print > $q) + { + if ( ($mix_container_item > $q) or ($mix_container_item < $q) ) + { + if ( ($q==0) and ($mix_container_item > 0) ) + { + $MIXdetailsONE = explode('|', $MIXentries[$q]); + $MIXpercentONE = ($MIXdetailsONE[2] + $MIXpercentPCT); + $NEWlist_mix_container .= "$MIXdetailsONE[0]|$MIXdetailsONE[1]|$MIXpercentONE|$MIXdetailsONE[3]|:"; + } + else + { + if ( ($q==1) and ($mix_container_item < 1) ) + { + $MIXdetailsONE = explode('|', $MIXentries[$q]); + $MIXpercentONE = ($MIXdetailsONE[2] + $MIXpercentPCT); + $NEWlist_mix_container .= "$MIXdetailsONE[0]|$MIXdetailsONE[1]|$MIXpercentONE|$MIXdetailsONE[3]|:"; + } + else + { + $NEWlist_mix_container .= "$MIXentries[$q]:"; + } + } + } + $q++; + } + $NEWlist_mix_container = preg_replace("/.$/",'',$NEWlist_mix_container); + + $stmt="UPDATE vicidial_campaigns_list_mix SET list_mix_container='$NEWlist_mix_container' where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
LISTE MISCHUNG ÄNDERTE: $campaign_id - $vcl_id - $list_id - $mix_container_item\n"; + } + } + } + + ##### ADD a NEW list mix ##### + if ($stage=='NEWMIX') + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) or (strlen($vcl_name) < 2) ) + { + echo "
LISTE MISCHUNG NICHT ADDIERT- Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + echo "
vcl_name must be at least 2 characters in length\n"; + } + else + { + $stmt="SELECT count(*) from vicidial_campaigns_list_mix where vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + echo "
LISTE MISCHUNG NICHT ADDIERT- Es gibt bereits eine Liste Mischung mit dieser Identifikation imSystem\n"; + } + else + { + $stmt="INSERT INTO vicidial_campaigns_list_mix SET list_mix_container='$list_id|1|100| $status -|',campaign_id='$campaign_id',vcl_id='$vcl_id',vcl_name='$vcl_name',mix_method='$mix_method',status='INACTIVE';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
LISTE MISCHUNG ADDIERT:$campaign_id - $vcl_id - $vcl_name\n"; + } + } + } + + ##### DELETE an existing list mix ##### + if ($stage=='DELMIX') + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) ) + { + echo "
LISTE MISCHUNG NICHT GELÖSCHT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_campaigns_list_mix where vcl_id='$vcl_id' and campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
LISTE MISCHUNG LÖSCHTE:$campaign_id - $vcl_id - $vcl_name\n"; + } + } + + ##### Set list mix entry to active ##### + if ($stage=='SETACTIVE') + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) ) + { + echo "
LISTE MISCHUNG NICHT AKTIVIERT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_campaigns_list_mix SET status='INACTIVE' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_campaigns_list_mix SET status='ACTIVE' where vcl_id='$vcl_id' and campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
LISTE MISCHUNG AKTIVIERTE: $campaign_id - $vcl_id - $vcl_name\n"; + } + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +$SUB=29; +$ADD=31; # go to campaign modification form below +} + + +###################### +# ADD=411 submit list modifications to the system +###################### + +if ($ADD==411) +{ + if ($LOGmodify_lists==1) + { + echo ""; + + if ( (strlen($list_name) < 2) or (strlen($campaign_id) < 2) ) + { + echo "
LISTE NICHT GEÄNDERT - gehen Sie bitte zurück und betrachten Sie dieDaten, die Sie eingaben\n"; + echo "
Liste Name muß mindestens 2 Buchstaben lang sein\n"; + } + else + { + echo "
LISTE ÄNDERTE: $list_id\n"; + + $stmt="UPDATE vicidial_lists set list_name='$list_name',campaign_id='$campaign_id',active='$active',list_description='$list_description',list_changedate='$SQLdate' where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + if ($reset_list == 'Y') + { + echo "
ZURÜCKSTELLEN VON VON LIST-CALLED-STATUS\n"; + $stmt="UPDATE vicidial_list set called_since_last_reset='N' where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|RESET LIST CALLED |$PHP_AUTH_USER|$ip|list_name='$list_name'|\n"); + fclose($fp); + } + } + if ($campaign_id != "$old_campaign_id") + { + echo "
ENTFERNEN DER LISTE ZUFUHRBEHÄLTER-LEITUNGEN VOM ALTEN KAMPAGNEZUFUHRBEHÄLTER ($old_campaign_id)\n"; + $stmt="DELETE from vicidial_hopper where list_id='$list_id' and campaign_id='$old_campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST INFO |$PHP_AUTH_USER|$ip|list_name='$list_name',campaign_id='$campaign_id',active='$active',list_description='$list_description' where list_id='$list_id'|\n"); + fclose($fp); + } + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +$ADD=311; # go to list modification form below +} + + +###################### +# ADD=4111 modify in-group info in the system +###################### + +if ($ADD==4111) +{ + if ($LOGmodify_ingroups==1) + { + echo ""; + + if ( (strlen($group_name) < 2) or (strlen($group_color) < 2) ) + { + echo "
GRUPPE NICHT GEÄNDERT - gehen Sie bitte zurück und betrachten Siedie Daten, die Sie eingaben\n"; + echo "
Gruppe Name und Gruppe Farbe muß mindestens 2 Buchstaben lang sein\n"; + } + else + { + echo "
GRUPPE GEÄNDERT: $group_id\n"; + + $stmt="UPDATE vicidial_inbound_groups set group_name='$group_name', group_color='$group_color', active='$active', web_form_address='" . mysql_real_escape_string($web_form_address) . "', voicemail_ext='$voicemail_ext', next_agent_call='$next_agent_call', fronter_display='$fronter_display', ingroup_script='$script_id', get_call_launch='$get_call_launch', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number',drop_message='$drop_message',drop_call_seconds='$drop_call_seconds',drop_exten='$drop_exten',call_time_id='$call_time_id',after_hours_action='$after_hours_action',after_hours_message_filename='$after_hours_message_filename',after_hours_exten='$after_hours_exten',after_hours_voicemail='$after_hours_voicemail',welcome_message_filename='$welcome_message_filename',moh_context='$moh_context',onhold_prompt_filename='$onhold_prompt_filename',prompt_interval='$prompt_interval',agent_alert_exten='$agent_alert_exten',agent_alert_delay='$agent_alert_delay',default_xfer_group='$default_xfer_group' where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY GROUP INFO |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +$ADD=3111; # go to in-group modification form below +} + + + +###################### +# ADD=41111 modify remote agents info in the system +###################### + +if ($ADD==41111) +{ + if ($LOGmodify_remoteagents==1) + { + echo ""; + + if ( (strlen($server_ip) < 2) or (strlen($user_start) < 2) or (strlen($campaign_id) < 2) or (strlen($conf_exten) < 2) ) + { + echo "
REMOTEMITTEL NICHT GEÄNDERT - gehen Sie bitte zurück und betrachtenSie die Daten, die Sie eingaben\n"; + echo "
Benutzernummer Anfang und externe Verlängerung müssen mindestens 2Buchstaben lang sein\n"; + } + else + { + $stmt="UPDATE vicidial_remote_agents set user_start='$user_start', number_of_lines='$number_of_lines', server_ip='$server_ip', conf_exten='$conf_exten', status='$status', campaign_id='$campaign_id', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOTEMITTEL GEÄNDERT\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY REMOTEMITTEL ENTRY |$PHP_AUTH_USER|$ip|set user_start='$user_start', number_of_lines='$number_of_lines', server_ip='$server_ip', conf_exten='$conf_exten', status='$status', campaign_id='$campaign_id', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id'|\n"); + fclose($fp); + } + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +$ADD=31111; # go to remote agents modification form below +} + + + +###################### +# ADD=411111 modify user group info in the system +###################### + +if ($ADD==411111) +{ + if ($LOGmodify_usergroups==1) + { + echo ""; + + if ( (strlen($user_group) < 2) or (strlen($group_name) < 2) ) + { + echo "
BENUTZER-GRUPPE NICHT GEÄNDERT - gehen Sie bitte zurück undbetrachten Sie die Daten, die Sie eingaben\n"; + echo "
Gruppe Name und Beschreibung müssen mindestens 2 Buchstaben langsein\n"; + } + else + { + $stmt="UPDATE vicidial_user_groups set user_group='$user_group', group_name='$group_name',allowed_campaigns='$campaigns_value' where user_group='$OLDuser_group';"; + $rslt=mysql_query($stmt, $link); + + echo "
BENUTZER-GRUPPE GEÄNDERT\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER GROUP ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +$ADD=311111; # go to user group modification form below +} + +###################### +# ADD=4111111 modify script in the system +###################### + +if ($ADD==4111111) +{ + if ($LOGmodify_scripts==1) + { + echo "\n"; + echo "\n"; + echo ""; + + if ( (strlen($script_id) < 2) or (strlen($script_name) < 2) or (strlen($script_text) < 2) ) + { + echo "
INDEX NICHT GEÄNDERT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Indexname, -beschreibung und -text müssen mindestens 2 Buchstabenlang sein\n"; + } + else + { + $stmt="UPDATE vicidial_scripts set script_name='$script_name', script_comments='$script_comments', script_text='$script_text', active='$active' where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
INDEX ÄNDERTE\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY SCRIPT ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +$ADD=3111111; # go to script modification form below +} + + +###################### +# ADD=41111111 modify filter in the system +###################### + +if ($ADD==41111111) +{ + if ($LOGmodify_filters==1) + { + echo ""; + + if ( (strlen($lead_filter_id) < 2) or (strlen($lead_filter_name) < 2) or (strlen($lead_filter_sql) < 2) ) + { + echo "
FILTER NICHT GEÄNDERT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Filtern Sie Identifikation, Namen und SQL muß mindestens 2 Buchstabenlang sein\n"; + } + else + { + $stmt="UPDATE vicidial_lead_filters set lead_filter_name='$lead_filter_name', lead_filter_comments='$lead_filter_comments', lead_filter_sql='$lead_filter_sql' where lead_filter_id='$lead_filter_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
FILTER GEÄNDERT\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY FILTER ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +$ADD=31111111; # go to filter modification form below +} + + +###################### +# ADD=411111111 modify call time in the system +###################### + +if ($ADD==411111111) +{ + if ($LOGmodify_call_times==1) + { + echo ""; + + if ( (strlen($call_time_id) < 2) or (strlen($call_time_name) < 2) ) + { + echo "
Anrufzeit nicht geändert - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Anrufzeit ID und Name müssen mindestens 2 Zeichen Länge haben\n"; + } + else + { + $ct_default_start = preg_replace('/\D/', '', $ct_default_start); + $ct_default_stop = preg_replace('/\D/', '', $ct_default_stop); + $ct_sunday_start = preg_replace('/\D/', '', $ct_sunday_start); + $ct_sunday_stop = preg_replace('/\D/', '', $ct_sunday_stop); + $ct_monday_start = preg_replace('/\D/', '', $ct_monday_start); + $ct_monday_stop = preg_replace('/\D/', '', $ct_monday_stop); + $ct_tuesday_start = preg_replace('/\D/', '', $ct_tuesday_start); + $ct_tuesday_stop = preg_replace('/\D/', '', $ct_tuesday_stop); + $ct_wednesday_start = preg_replace('/\D/', '', $ct_wednesday_start); + $ct_wednesday_stop = preg_replace('/\D/', '', $ct_wednesday_stop); + $ct_thursday_start = preg_replace('/\D/', '', $ct_thursday_start); + $ct_thursday_stop = preg_replace('/\D/', '', $ct_thursday_stop); + $ct_friday_start = preg_replace('/\D/', '', $ct_friday_start); + $ct_friday_stop = preg_replace('/\D/', '', $ct_friday_stop); + $ct_saturday_start = preg_replace('/\D/', '', $ct_saturday_start); + $ct_saturday_stop = preg_replace('/\D/', '', $ct_saturday_stop); + $stmt="UPDATE vicidial_call_times set call_time_name='$call_time_name', call_time_comments='$call_time_comments', ct_default_start='$ct_default_start', ct_default_stop='$ct_default_stop', ct_sunday_start='$ct_sunday_start', ct_sunday_stop='$ct_sunday_stop', ct_monday_start='$ct_monday_start', ct_monday_stop='$ct_monday_stop', ct_tuesday_start='$ct_tuesday_start', ct_tuesday_stop='$ct_tuesday_stop', ct_wednesday_start='$ct_wednesday_start', ct_wednesday_stop='$ct_wednesday_stop', ct_thursday_start='$ct_thursday_start', ct_thursday_stop='$ct_thursday_stop', ct_friday_start='$ct_friday_start', ct_friday_stop='$ct_friday_stop', ct_saturday_start='$ct_saturday_start', ct_saturday_stop='$ct_saturday_stop' where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
Anrufzeit geändert\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CALL TIME ENTRY |$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +$ADD=311111111; # go to call time modification form below +} + + +###################### +# ADD=4111111111 modify state call time in the system +###################### + +if ($ADD==4111111111) +{ + if ($LOGmodify_call_times==1) + { + echo ""; + + if ( (strlen($call_time_id) < 2) or (strlen($call_time_name) < 2) or (strlen($state_call_time_state) < 2) ) + { + echo "
Landesspezifische Anrufzeit nicht geändert - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Landesspezifische Anrufzeit ID, Name und Land müssen mindestens 2 Zeichen Länge haben\n"; + } + else + { + $ct_default_start = preg_replace('/\D/', '', $ct_default_start); + $ct_default_stop = preg_replace('/\D/', '', $ct_default_stop); + $ct_sunday_start = preg_replace('/\D/', '', $ct_sunday_start); + $ct_sunday_stop = preg_replace('/\D/', '', $ct_sunday_stop); + $ct_monday_start = preg_replace('/\D/', '', $ct_monday_start); + $ct_monday_stop = preg_replace('/\D/', '', $ct_monday_stop); + $ct_tuesday_start = preg_replace('/\D/', '', $ct_tuesday_start); + $ct_tuesday_stop = preg_replace('/\D/', '', $ct_tuesday_stop); + $ct_wednesday_start = preg_replace('/\D/', '', $ct_wednesday_start); + $ct_wednesday_stop = preg_replace('/\D/', '', $ct_wednesday_stop); + $ct_thursday_start = preg_replace('/\D/', '', $ct_thursday_start); + $ct_thursday_stop = preg_replace('/\D/', '', $ct_thursday_stop); + $ct_friday_start = preg_replace('/\D/', '', $ct_friday_start); + $ct_friday_stop = preg_replace('/\D/', '', $ct_friday_stop); + $ct_saturday_start = preg_replace('/\D/', '', $ct_saturday_start); + $ct_saturday_stop = preg_replace('/\D/', '', $ct_saturday_stop); + $stmt="UPDATE vicidial_state_call_times set state_call_time_name='$call_time_name', state_call_time_comments='$call_time_comments', sct_default_start='$ct_default_start', sct_default_stop='$ct_default_stop', sct_sunday_start='$ct_sunday_start', sct_sunday_stop='$ct_sunday_stop', sct_monday_start='$ct_monday_start', sct_monday_stop='$ct_monday_stop', sct_tuesday_start='$ct_tuesday_start', sct_tuesday_stop='$ct_tuesday_stop', sct_wednesday_start='$ct_wednesday_start', sct_wednesday_stop='$ct_wednesday_stop', sct_thursday_start='$ct_thursday_start', sct_thursday_stop='$ct_thursday_stop', sct_friday_start='$ct_friday_start', sct_friday_stop='$ct_friday_stop', sct_saturday_start='$ct_saturday_start', sct_saturday_stop='$ct_saturday_stop', state_call_time_state='$state_call_time_state' where state_call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
Landesspezifische Anrufzeit geändert\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY STATE CALL TIME ENTRY|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +$ADD=3111111111; # go to state call time modification form below +} + + +###################### +# ADD=41111111111 modify phone record in the system +###################### + +if ($ADD==41111111111) +{ + if ($LOGast_admin_access==1) + { + echo ""; + + $stmt="SELECT count(*) from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ( ($extension != $old_extension) or ($server_ip != $old_server_ip) ) ) + {echo "
TELEFON NICHT GEÄNDERT - es gibt bereits ein Telefon im System mitdiesem extension/server\n";} + else + { + if ( (strlen($extension) < 1) or (strlen($server_ip) < 7) or (strlen($dialplan_number) < 1) or (strlen($voicemail_id) < 1) or (strlen($login) < 1) or (strlen($pass) < 1)) + {echo "
TELEFON NICHT GEÄNDERT - gehen Sie bitte zurück und betrachten Siedie Daten, die Sie eingaben\n";} + else + { + echo "
TELEFON GEÄNDERT: $extension\n"; + + $stmt="UPDATE phones set extension='$extension', dialplan_number='$dialplan_number', voicemail_id='$voicemail_id', phone_ip='$phone_ip', computer_ip='$computer_ip', server_ip='$server_ip', login='$login', pass='$pass', status='$status', active='$active', phone_type='$phone_type', fullname='$fullname', company='$company', picture='$picture', protocol='$protocol', local_gmt='$local_gmt', ASTmgrUSERNAME='$ASTmgrUSERNAME', ASTmgrSECRET='$ASTmgrSECRET', login_user='$login_user', login_pass='$login_pass', login_campaign='$login_campaign', park_on_extension='$park_on_extension', conf_on_extension='$conf_on_extension', VICIDIAL_park_on_extension='$VICIDIAL_park_on_extension', VICIDIAL_park_on_filename='$VICIDIAL_park_on_filename', monitor_prefix='$monitor_prefix', recording_exten='$recording_exten', voicemail_exten='$voicemail_exten', voicemail_dump_exten='$voicemail_dump_exten', ext_context='$ext_context', dtmf_send_extension='$dtmf_send_extension', call_out_number_group='$call_out_number_group', client_browser='$client_browser', install_directory='$install_directory', local_web_callerID_URL='" . mysql_real_escape_string($local_web_callerID_URL) . "', VICIDIAL_web_URL='" . mysql_real_escape_string($VICIDIAL_web_URL) . "', AGI_call_logging_enabled='$AGI_call_logging_enabled', user_switching_enabled='$user_switching_enabled', conferencing_enabled='$conferencing_enabled', admin_hangup_enabled='$admin_hangup_enabled', admin_hijack_enabled='$admin_hijack_enabled', admin_monitor_enabled='$admin_monitor_enabled', call_parking_enabled='$call_parking_enabled', updater_check_enabled='$updater_check_enabled', AFLogging_enabled='$AFLogging_enabled', QUEUE_ACTION_enabled='$QUEUE_ACTION_enabled', CallerID_popup_enabled='$CallerID_popup_enabled', voicemail_button_enabled='$voicemail_button_enabled', enable_fast_refresh='$enable_fast_refresh', fast_refresh_rate='$fast_refresh_rate', enable_persistant_mysql='$enable_persistant_mysql', auto_dial_next_number='$auto_dial_next_number', VDstop_rec_after_each_call='$VDstop_rec_after_each_call', DBX_server='$DBX_server', DBX_database='$DBX_database', DBX_user='$DBX_user', DBX_pass='$DBX_pass', DBX_port='$DBX_port', DBY_server='$DBY_server', DBY_database='$DBY_database', DBY_user='$DBY_user', DBY_pass='$DBY_pass', DBY_port='$DBY_port', outbound_cid='$outbound_cid', enable_sipsak_messages='$enable_sipsak_messages' where extension='$old_extension' and server_ip='$old_server_ip';"; + $rslt=mysql_query($stmt, $link); + } + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +$ADD=31111111111; # go to phone modification form below +} + + +###################### +# ADD=411111111111 modify server record in the system +###################### + +if ($ADD==411111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + + $stmt="SELECT count(*) from servers where server_id='$server_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ($server_id != $old_server_id) ) + {echo "
BEDIENERNOT MODIFIED - there is already a server in the system with this server_id\n";} + else + { + $stmt="SELECT count(*) from servers where server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ($server_ip != $old_server_ip) ) + {echo "
BEDIENER NICHT GEÄNDERT - es gibt bereits einen Bediener im Systemmit diesem server_ip\n";} + else + { + if ( (strlen($server_id) < 1) or (strlen($server_ip) < 7) ) + {echo "
BEDIENER NICHT GEÄNDERT - gehen Sie bitte zurück und betrachten Siedie Daten, die Sie eingaben\n";} + else + { + echo "
BEDIENER GEÄNDERT: $server_ip\n"; + + $stmt="UPDATE servers set server_id='$server_id',server_description='$server_description',server_ip='$server_ip',active='$active',asterisk_version='$asterisk_version', max_vicidial_trunks='$max_vicidial_trunks', telnet_host='$telnet_host', telnet_port='$telnet_port', ASTmgrUSERNAME='$ASTmgrUSERNAME', ASTmgrSECRET='$ASTmgrSECRET', ASTmgrUSERNAMEupdate='$ASTmgrUSERNAMEupdate', ASTmgrUSERNAMElisten='$ASTmgrUSERNAMElisten', ASTmgrUSERNAMEsend='$ASTmgrUSERNAMEsend', local_gmt='$local_gmt', voicemail_dump_exten='$voicemail_dump_exten', answer_transfer_agent='$answer_transfer_agent', ext_context='$ext_context', sys_perf_log='$sys_perf_log', vd_server_logs='$vd_server_logs', agi_output='$agi_output', vicidial_balance_active='$vicidial_balance_active', balance_trunks_offlimits='$balance_trunks_offlimits' where server_id='$old_server_id';"; + $rslt=mysql_query($stmt, $link); + } + } + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +$ADD=311111111111; # go to server modification form below +} + + +###################### +# ADD=421111111111 modify vicidial server trunks record in the system +###################### + +if ($ADD==421111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + $stmt="SELECT max_vicidial_trunks from servers where server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $MAXvicidial_trunks = $rowx[0]; + + $stmt="SELECT sum(dedicated_trunks) from vicidial_server_trunks where server_ip='$server_ip' and campaign_id !='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $SUMvicidial_trunks = ($rowx[0] + $dedicated_trunks); + + if ($SUMvicidial_trunks > $MAXvicidial_trunks) + { + echo "
VICIDIAL BEDIENER-STAMM-SATZ NICHT ADDIERT - die Zahl vicidial Stämmen ist zu hoch: $SUMvicidial_trunks / $MAXvicidial_trunks\n"; + } + else + { + if ( (strlen($campaign_id) < 2) or (strlen($server_ip) < 7) or (strlen($dedicated_trunks) < 1) or (strlen($trunk_restriction) < 1) ) + { + echo "
VICIDIAL BEDIENER-STAMM-SATZ NICHT GEÄNDERT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Kampagne muß zwischen 3 und 8 Buchstaben lang sein\n"; + echo "
server_ip verzögert muß mindestens 7 Buchstaben sein\n"; + echo "
Stämme müssen eine Stelle von 0 bis 9999 sein\n"; + } + else + { + echo "
VICIDIAL BEDIENER-STAMM-SATZ ÄNDERTE: $campaign_id - $server_ip - $dedicated_trunks - $trunk_restriction\n"; + + $stmt="UPDATE vicidial_server_trunks SET dedicated_trunks='$dedicated_trunks',trunk_restriction='$trunk_restriction' where campaign_id='$campaign_id' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ÄNDERN SIE BEDIENER TRUNK |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +$ADD=311111111111; # go to server modification form below +} + + +###################### +# ADD=4111111111111 modify conference record in the system +###################### + +if ($ADD==4111111111111) +{ + if ($LOGast_admin_access==1) + { + echo ""; + + $stmt="SELECT count(*) from conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ( ($conf_exten != $old_conf_exten) or ($server_ip != $old_server_ip) ) ) + {echo "
KONFERENZ NICHT GEÄNDERT - es gibt bereits eine Konferenz im Systemmit diesem Verlängerung-Bediener\n";} + else + { + if ( (strlen($conf_exten) < 1) or (strlen($server_ip) < 7) ) + {echo "
KONFERENZ NICHT GEÄNDERT - gehen Sie bitte zurück und betrachten Siedie Daten, die Sie eingaben\n";} + else + { + echo "
KONFERENZ ÄNDERTE: $conf_exten\n"; + + $stmt="UPDATE conferences set conf_exten='$conf_exten',server_ip='$server_ip',extension='$extension' where conf_exten='$old_conf_exten';"; + $rslt=mysql_query($stmt, $link); + } + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +$ADD=3111111111111; # go to conference modification form below +} + + +###################### +# ADD=41111111111111 modify vicidial conference record in the system +###################### + +if ($ADD==41111111111111) +{ + if ($LOGast_admin_access==1) + { + echo ""; + + $stmt="SELECT count(*) from vicidial_conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ( ($conf_exten != $old_conf_exten) or ($server_ip != $old_server_ip) ) ) + {echo "
VICIDIAL KONFERENZ NICHT GEÄNDERT - es gibt bereits eine Konferenz im Systemmit diesem Verlängerung-Bediener\n";} + else + { + if ( (strlen($conf_exten) < 1) or (strlen($server_ip) < 7) ) + {echo "
VICIDIAL KONFERENZ NICHT GEÄNDERT - gehen Sie bitte zurück und betrachten Siedie Daten, die Sie eingaben\n";} + else + { + echo "
VICIDIAL KONFERENZ ÄNDERTE: $conf_exten\n"; + + $stmt="UPDATE vicidial_conferences set conf_exten='$conf_exten',server_ip='$server_ip',extension='$extension' where conf_exten='$old_conf_exten';"; + $rslt=mysql_query($stmt, $link); + + } + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +$ADD=31111111111111; # go to vicidial conference modification form below +} + + + +###################### +# ADD=411111111111111 modify vicidial system settings +###################### + +if ($ADD==411111111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + + echo "
VICIDIAL SYSTEM EINSTELLUNGEN GEÄNDERT WORDEN\n"; + + $stmt="UPDATE system_settings set use_non_latin='$use_non_latin',webroot_writable='$webroot_writable',enable_queuemetrics_logging='$enable_queuemetrics_logging',queuemetrics_server_ip='$queuemetrics_server_ip',queuemetrics_dbname='$queuemetrics_dbname',queuemetrics_login='$queuemetrics_login',queuemetrics_pass='$queuemetrics_pass',queuemetrics_url='$queuemetrics_url',queuemetrics_log_id='$queuemetrics_log_id',queuemetrics_eq_prepend='$queuemetrics_eq_prepend',vicidial_agent_disable='$vicidial_agent_disable',allow_sipsak_messages='$allow_sipsak_messages',admin_home_url='$admin_home_url',enable_agc_xfer_log='$enable_agc_xfer_log';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY SYSTEM SETTINGS|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +$ADD=311111111111111; # go to vicidial system settings form below +} + + +###################### +# ADD=421111111111111 modify/delete system status in the system +###################### + +if ($ADD==421111111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + + if (ereg('delete',$stage)) + { + if ( (strlen($status) < 1) or (preg_match("/^B$|^NA$|^DNC$|^NA$|^DROP$|^INCALL$|^QUEUE$|^NEW$/i",$status)) ) + { + echo "
SYSTEMSTATUS NICHT GELÖSCHT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
der Systemstatus kann nicht ein reservierter Status sein:B,NA,DNC,NA,DROP,INCALL,QUEUE,NEW\n"; + echo "
der Systemstatus muß mindestens Buchstaben 1 lang sein\n"; + } + else + { + echo "
SYSTEM STATUS DELETED: $status\n"; + + $stmt="DELETE FROM vicidial_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + + $stmtA="DELETE FROM vicidial_campaign_hotkeys where status='$status';"; + $rslt=mysql_query($stmtA, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE SYSTEM STATUS |$PHP_AUTH_USER|$ip|$stmt|$stmtA|\n"); + fclose($fp); + } + } + } + if (ereg('modify',$stage)) + { + if ( (strlen($status) < 1) or (strlen($status_name) < 2) ) + { + echo "
SYSTEMSTATUS NICHT GEÄNDERT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
der Systemstatus muß mindestens Buchstaben 1 lang sein\n"; + echo "
der Systemstatusname muß mindestens Buchstaben 1 lang sein\n"; + } + else + { + echo "
SYSTEMSTATUS GEÄNDERT: $status\n"; + + $stmt="UPDATE vicidial_statuses SET status_name='$status_name',selectable='$selectable',human_answered='$human_answered',category='$category' where status='$status';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY SYSTEM STATUS |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +$ADD=321111111111111; # go to system settings modification form below +} + + +###################### +# ADD=431111111111111 modify/delete status category in the system +###################### + +if ($ADD==431111111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + + if ( (strlen($vsc_id) < 2) or (preg_match("/^UNDEFINED$/i",$vsc_id)) ) + { + echo "
STATUS-KATEGORIE NICHT GEÄNDERT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
die Statuskategorie kann nicht eine reservierte Kategorie sein:UNDEFINED\n"; + echo "
die Statuskategorie muß mindestens 2 Buchstaben lang sein\n"; + } + else + { + if (ereg('delete',$stage)) + { + echo "
STATUS-KATEGORIE LÖSCHTE: $vsc_id\n"; + + $stmt="DELETE FROM vicidial_status_categories where vsc_id='$vsc_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE STATUS CATEGORY|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + if (ereg('modify',$stage)) + { + echo "
STATUS-KATEGORIE GEÄNDERT: $vsc_id\n"; + + $stmt="SELECT count(*) from vicidial_status_categories where tovdad_display='Y' and vsc_id NOT IN('$vsc_id');"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 3) and (ereg('Y',$tovdad_display)) ) + { + $tovdad_display = 'N'; + echo "
STÖRUNG: Es gibt bereits 4 den Status-Kategorienkatalog zurTimeOnVDAD Anzeige\n"; + } + + $stmt="UPDATE vicidial_status_categories SET vsc_name='$vsc_name',vsc_description='$vsc_description',tovdad_display='$tovdad_display' where vsc_id='$vsc_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY STATUS CATEGORY|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +$ADD=331111111111111; # go to system settings modification form below +} + + + + +###################################################################################################### +###################################################################################################### +####### 5 series, delete records confirmation +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=5 confirmation before deletion of user +###################### + +if ($ADD==5) +{ + echo ""; + + if ( (strlen($user) < 2) or ($LOGdelete_users < 1) ) + { + echo "
BENUTZER NICHT GELÖSCHT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
User be at least 2 characters in length\n"; + } + else + { + echo "
BENUTZER-AUSLASSUNG BESTÄTIGUNG: $user\n"; + echo "

Klicken Sie hier, um Benutzer zu löschen $user


\n"; + } + +$ADD='3'; # go to user modification below +} + +###################### +# ADD=51 confirmation before deletion of campaign +###################### + +if ($ADD==51) +{ + echo ""; + + if ( (strlen($campaign_id) < 2) or ($LOGdelete_campaigns < 1) ) + { + echo "
KAMPAGNE NICHT GELÖSCHT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Kampagne_id be at least 2 characters in length\n"; + } + else + { + echo "
KAMPAGNE AUSLASSUNG BESTÄTIGUNG: $campaign_id\n"; + echo "

Klicken Sie hier, um Kampagne zu löschen $campaign_id


\n"; + } + +$ADD='31'; # go to campaign modification below +} + +###################### +# ADD=52 confirmation before logging all agents out of campaign of campaign +###################### + +if ($ADD==52) +{ + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
MITTEL GELOGGT NICHT AUS KAMPAGNE HERAUS - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Kampagne_id be at least 2 characters in length\n"; + } + else + { + echo "
MITTELLOGOUT-BESTÄTIGUNG: $campaign_id\n"; + echo "

Klicken Sie hier, um alle Mittel aus zu loggen $campaign_id


\n"; + } + +$ADD='31'; # go to campaign modification below +} + +###################### +# ADD=53 confirmation before Emergency VDAC Jam Clear - deletes oldest LIVE vicidial_auto_call record +###################### + +if ($ADD==53) +{ + if (eregi('IN',$stage)) + {$group_id=$campaign_id;} + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
VDAC NICHT LÖSCHTE FÜR KAMPAGNE - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Kampagne_id be at least 2 characters in length\n"; + } + else + { + echo "
VDAC AUSLÖSEBESTÄTIGUNG: $campaign_id\n"; + echo "

Klicken Sie hier, um das älteste zu löschen LEBEN Aufzeichnung inVDAC für $campaign_id


\n"; + } + +# go to campaign modification below +if (eregi('IN',$stage)) + {$ADD='3111';} +else + {$ADD='31';} +} + +###################### +# ADD=511 confirmation before deletion of list +###################### + +if ($ADD==511) +{ + echo ""; + + if ( (strlen($list_id) < 2) or ($LOGdelete_lists < 1) ) + { + echo "
LISTE NICHT GELÖSCHT WORDEN - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
List_id be at least 2 characters in length\n"; + } + else + { + echo "
LISTE AUSLASSUNG BESTÄTIGUNG: $list_id\n"; + echo "

Klicken Sie hier, um Liste und alle seine Leitungen zu löschen $list_id


\n"; + } + +$ADD='311'; # go to campaign modification below +} + +###################### +# ADD=5111 confirmation before deletion of in-group +###################### + +if ($ADD==5111) +{ + echo ""; + + if ( (strlen($group_id) < 2) or ($LOGdelete_ingroups < 1) ) + { + echo "
IN-GROUP NICHT GELÖSCHT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Group_id be at least 2 characters in length\n"; + } + else + { + echo "
IN-GROUP AUSLASSUNG BESTÄTIGUNG: $group_id\n"; + echo "

Klicken Sie hier, um Ingruppe zu löschen $group_id


\n"; + } + +$ADD='3111'; # go to in-group modification below +} + +###################### +# ADD=51111 confirmation before deletion of remote agent record +###################### + +if ($ADD==51111) +{ + echo ""; + + if ( (strlen($remote_agent_id) < 1) or ($LOGdelete_remote_agents < 1) ) + { + echo "
REMOTEMITTEL NICHT GELÖSCHT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Remote_agent_id be at least 2 characters in length\n"; + } + else + { + echo "
REMOTEMITTEL-AUSLASSUNG BESTÄTIGUNG: $remote_agent_id\n"; + echo "

Klicken Sie hier, um Remotemittel zu löschen $remote_agent_id


\n"; + } + +$ADD='31111'; # go to remote agent modification below +} + +###################### +# ADD=511111 confirmation before deletion of user group record +###################### + +if ($ADD==511111) +{ + echo ""; + + if ( (strlen($user_group) < 2) or ($LOGdelete_user_groups < 1) ) + { + echo "
BENUTZER-GRUPPE NICHT GELÖSCHT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
User_group be at least 2 characters in length\n"; + } + else + { + echo "
BENUTZER-GRUPPE AUSLASSUNG BESTÄTIGUNG: $user_group\n"; + echo "

Klicken Sie hier, um Benutzergruppe zu löschen $user_group


\n"; + } + +$ADD='311111'; # go to user group modification below +} + +###################### +# ADD=5111111 confirmation before deletion of script record +###################### + +if ($ADD==5111111) +{ + echo ""; + + if ( (strlen($script_id) < 2) or ($LOGdelete_scripts < 1) ) + { + echo "
INDEX NICHT GELÖSCHT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Script_id must be at least 2 characters in length\n"; + } + else + { + echo "
INDEX-AUSLASSUNG BESTÄTIGUNG: $script_id\n"; + echo "

Klicken Sie hier, um Index zu löschen $script_id


\n"; + } + +$ADD='3111111'; # go to script modification below +} + +###################### +# ADD=51111111 confirmation before deletion of filter record +###################### + +if ($ADD==51111111) +{ + echo ""; + + if ( (strlen($lead_filter_id) < 2) or ($LOGdelete_filters < 1) ) + { + echo "
FILTER NICHT GELÖSCHT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Filter Identifikation muß mindestens 2 Buchstaben lang sein\n"; + } + else + { + echo "
FILTER DELETION CONFIRMATION: $lead_filter_id\n"; + echo "

Klicken Sie hier, um Filter zu löschen$lead_filter_id


\n"; + } + +$ADD='31111111'; # go to filter modification below +} + +###################### +# ADD=511111111 confirmation before deletion of call time record +###################### + +if ($ADD==511111111) +{ + echo ""; + + if ( (strlen($call_time_id) < 2) or ($LOGdelete_call_times < 1) ) + { + echo "
Anrufzeit nicht gelöscht - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Anrufzeit ID muss mindestens 2 Zeichen lang sein\n"; + } + else + { + echo "
Löschen der Anrufzeit bestätigen: $call_time_id\n"; + echo "

Click here to delete call time $call_time_id


\n"; + } + +$ADD='311111111'; # go to call time modification below +} + +###################### +# ADD=5111111111 confirmation before deletion of state call time record +###################### + +if ($ADD==5111111111) +{ + echo ""; + + if ( (strlen($call_time_id) < 2) or ($LOGdelete_call_times < 1) ) + { + echo "
Landesspezifische Anrufzeit nicht gelöscht - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Anrufzeit ID muss mindestens 2 Zeichen lang sein\n"; + } + else + { + echo "
Löschen der landesspezifischen Anrufzeit bestätigen: $call_time_id\n"; + echo "

Click here to delete state call time $call_time_id


\n"; + } + +$ADD='3111111111'; # go to state call time modification below +} + + +###################### +# ADD=51111111111 confirmation before deletion of phone record +###################### + +if ($ADD==51111111111) +{ + echo ""; + + if ( (strlen($extension) < 2) or (strlen($server_ip) < 7) or ($LOGast_delete_phones < 1) ) + { + echo "
TELEFON NICHT GELÖSCHT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Extension be at least 2 characters in length\n"; + echo "
Bediener IP be at least 7 characters in length\n"; + } + else + { + echo "
TELEFON-AUSLASSUNG BESTÄTIGUNG: $extension - $server_ip\n"; + echo "

Klicken Sie hier, um Telefon zu löschen $extension - $server_ip


\n"; + } +$ADD='31111111111'; # go to phone modification below +} + + +###################### +# ADD=511111111111 confirmation before deletion of server record +###################### + +if ($ADD==511111111111) +{ + echo ""; + + if ( (strlen($server_id) < 2) or (strlen($server_ip) < 7) or ($LOGast_delete_phones < 1) ) + { + echo "
BEDIENERNOT DELETED - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Bediener Identifikation be at least 2 characters in length\n"; + echo "
Bediener IP be at least 7 characters in length\n"; + } + else + { + echo "
BEDIENERDELETION CONFIRMATION: $server_id - $server_ip\n"; + echo "

Klicken Sie hier, um Telefon zu löschen $server_id - $server_ip


\n"; + } +$ADD='311111111111'; # go to server modification below +} + + +###################### +# ADD=5111111111111 confirmation before deletion of conference record +###################### + +if ($ADD==5111111111111) +{ + echo ""; + + if ( (strlen($conf_exten) < 2) or (strlen($server_ip) < 7) or ($LOGast_delete_phones < 1) ) + { + echo "
CONFERENCE NOT DELETED - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Conference must be at least 2 characters in length\n"; + echo "
Bediener IP be at least 7 characters in length\n"; + } + else + { + echo "
CONFERENCE DELETION CONFIRMATION: $conf_exten - $server_ip\n"; + echo "

Klicken Sie hier, um Telefon zu löschen $conf_exten - $server_ip


\n"; + } +$ADD='3111111111111'; # go to conference modification below +} + + +###################### +# ADD=51111111111111 confirmation before deletion of vicidial conference record +###################### + +if ($ADD==51111111111111) +{ + echo ""; + + if ( (strlen($conf_exten) < 2) or (strlen($server_ip) < 7) or ($LOGast_delete_phones < 1) ) + { + echo "
VICIDIAL CONFERENCE NOT DELETED - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Conference must be at least 2 characters in length\n"; + echo "
Bediener IP be at least 7 characters in length\n"; + } + else + { + echo "
VICIDIAL CONFERENCE DELETION CONFIRMATION: $conf_exten - $server_ip\n"; + echo "

Klicken Sie hier, um Telefon zu löschen $conf_exten - $server_ip


\n"; + } +$ADD='31111111111111'; # go to vicidial conference modification below +} + + + +###################################################################################################### +###################################################################################################### +####### 6 series, delete records +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=6 delete user record +###################### + +if ($ADD==6) +{ + echo ""; + + if ( ( strlen($user) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_users < 1) ) + { + echo "
BENUTZER NICHT GELÖSCHT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
User be at least 2 characters in length\n"; + } + else + { + $stmtA="DELETE from vicidial_users where user='$user' limit 1;"; + $rslt=mysql_query($stmtA, $link); + + $stmt="DELETE from vicidial_campaign_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_inbound_group_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING USER!!!!|$PHP_AUTH_USER|$ip|$user|$stmtA|$stmt|\n"); + fclose($fp); + } + echo "
BENUTZER-AUSLASSUNG FÜHRTE DURCH: $user\n"; + echo "

\n"; + } + +$ADD='0'; # go to user list +} + +###################### +# ADD=61 delete campaign record +###################### + +if ($ADD==61) +{ + echo ""; + + if ( ( strlen($campaign_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_campaigns < 1) ) + { + echo "
KAMPAGNE NICHT GELÖSCHT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Kampagne_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_campaigns where campaign_id='$campaign_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaign_agents where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_live_agents where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaign_statuses where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaign_hotkeys where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_callbacks where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaign_stats where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_lead_recycle where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaign_server_stats where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_server_trunks where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_pause_codes where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaigns_list_mix where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
ENTFERNEN DER LISTE ZUFUHRBEHÄLTER-LEITUNGEN VOM ALTEN KAMPAGNEZUFUHRBEHÄLTER ($campaign_id)\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!DELETING CAMPAIGN!|$PHP_AUTH_USER|$ip|campaign_id='$campaign_id'|\n"); + fclose($fp); + } + echo "
KAMPAGNE AUSLASSUNG FÜHRTE DURCH: $campaign_id\n"; + echo "

\n"; + } + +$ADD='10'; # go to campaigns list +} + +###################### +# ADD=62 Logout all agents from a campaign +###################### + +if ($ADD==62) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
MITTEL GELOGGT NICHT AUS KAMPAGNE HERAUS - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Kampagne_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_live_agents where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!MITTELLOGOUT!!!!!!|$PHP_AUTH_USER|$ip|campaign_id='$campaign_id'|\n"); + fclose($fp); + } + echo "
MITTELLOGOUT FÜHRTE DURCH: $campaign_id\n"; + echo "

\n"; + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +$ADD='31'; # go to campaign modification below +} + + +###################### +# ADD=63 Emergency VDAC Jam Clear +###################### + +if ($ADD==63) +{ + if ($LOGmodify_campaigns==1) + { + if (eregi('IN',$stage)) + {$group_id=$campaign_id;} + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
VDAC NICHT LÖSCHTE FÜR KAMPAGNE - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Kampagne_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_auto_calls where status='LIVE' and campaign_id='$campaign_id' order by call_time limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|EMERGENCY VDAC CLEAR|$PHP_AUTH_USER|$ip|campaign_id='$campaign_id'|\n"); + fclose($fp); + } + echo "
LETZTES VDAC SATZ GELÖSCHT FÜR KAMPAGNE: $campaign_id\n"; + echo "

\n"; + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +# go to campaign modification below +if (eregi('IN',$stage)) + {$ADD='3111';} +else + {$ADD='31';} +} + + +###################### +# ADD=65 delete campaign lead recycle in the system +###################### + +if ($ADD==65) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
KAMPAGNE LEITUNG BEREITEN NICHT GELÖSCHT AUF - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Status muß zwischen 1 und 6 Buchstaben lang sein\n"; + echo "
Versuch verzögert muß mindestens 120 Sekunden sein\n"; + echo "
maximale Versuche müssen von 1 bis 10 sein\n"; + } + else + { + echo "
KAMPAGNE LEITUNG BEREITEN GELÖSCHT AUF: $campaign_id - $status - $attempt_delay\n"; + + $stmt="DELETE FROM vicidial_lead_recycle where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE LEAD RECYCLE |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +$SUB=25; +$ADD=31; # go to campaign modification form below +} + + +###################### +# ADD=66 delete auto alt dial status from the campaign +###################### + +if ($ADD==66) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and auto_alt_dial_statuses LIKE \"% $status %\";"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] < 1) + {echo "
SELBSTALT VORWAHLKNOPF-STATUS NICHT GELÖSCHT - dieser Vorwahlknopfstatus des Automobils Alt ist nicht in dieserKampagne\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
SELBSTALT VORWAHLKNOPF-STATUS NICHT GELÖSCHT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Status muß zwischen 1 und 6 Buchstaben lang sein\n"; + } + else + { + echo "
SELBSTALT VORWAHLKNOPF-STATUS GELÖSCHT: $campaign_id - $status\n"; + + $stmt="SELECT auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + $auto_alt_dial_statuses = eregi_replace(" $status "," ",$row[0]); + $stmt="UPDATE vicidial_campaigns set auto_alt_dial_statuses='$auto_alt_dial_statuses' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE AUTALTDIALSTTUS|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +$SUB=26; +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=67 delete agent pause code in the system +###################### + +if ($ADD==67) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($pause_code) < 1) ) + { + echo "
KAMPAGNE PAUSE CODE NICHT GELÖSCHT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
pause code must be between 1 and 6 characters in length\n"; + } + else + { + echo "
CAMPAIGN PAUSE CODE DELETED: $campaign_id - $pause_code\n"; + + $stmt="DELETE FROM vicidial_pause_codes where campaign_id='$campaign_id' and pause_code='$pause_code';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE MITTELPAUSECODE|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +$SUB=27; +$ADD=31; # go to campaign modification form below +} + + +###################### +# ADD=68 remove campaign dial status +###################### + +if ($ADD==68) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and dial_statuses LIKE \"% $status %\";"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] < 1) + {echo "
KAMPAGNE VORWAHLKNOPF-STATUS NICHT ENTFERNT - dieser Vorwahlknopfstatus wird nicht für diese Kampagne vorgewählt\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
KAMPAGNE VORWAHLKNOPF-STATUS NICHT ENTFERNT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Status muß zwischen 1 und 6 Buchstaben lang sein\n"; + } + else + { + echo "
KAMPAGNE VORWAHLKNOPF-STATUS ENTFERNT: $campaign_id - $status\n"; + + $stmt="SELECT dial_statuses from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + $dial_statuses = eregi_replace(" $status "," ",$row[0]); + $stmt="UPDATE vicidial_campaigns set dial_statuses='$dial_statuses' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DIAL STATUS REMOVED |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +#$SUB=28; +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=611 delete list record and all leads within it +###################### + +if ($ADD==611) +{ + echo ""; + + if ( ( strlen($list_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_lists < 1) ) + { + echo "
LISTE NICHT GELÖSCHT WORDEN - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
List_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_lists where list_id='$list_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + echo "
ENTFERNEN DER LISTE ZUFUHRBEHÄLTER-LEITUNGEN VOM ALTEN KAMPAGNEZUFUHRBEHÄLTER ($list_id)\n"; + $stmt="DELETE from vicidial_hopper where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
ENTFERNEN DER LISTE LEITUNGEN VON DER VICIDIAL_LIST TABELLE\n"; + $stmt="DELETE from vicidial_list where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING LIST!!!!|$PHP_AUTH_USER|$ip|list_id='$list_id'|\n"); + fclose($fp); + } + echo "
LISTE AUSLASSUNG DURCHGEFÜHRT: $list_id\n"; + echo "

\n"; + } + +$ADD='100'; # go to lists list +} + +###################### +# ADD=6111 delete in-group record +###################### + +if ($ADD==6111) +{ + echo ""; + + if ( (strlen($group_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_ingroups < 1) ) + { + echo "
IN-GROUP NICHT GELÖSCHT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Group_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_inbound_groups where group_id='$group_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_inbound_group_agents where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_live_inbound_agents where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING IN-GROUP!!|$PHP_AUTH_USER|$ip|group_id='$group_id'|\n"); + fclose($fp); + } + echo "
IN-GROUP AUSLASSUNG FÜHRTE DURCH: $group_id\n"; + echo "

\n"; + } + +$ADD='1000'; # go to in-group list +} + +###################### +# ADD=61111 delete remote agent record +###################### + +if ($ADD==61111) +{ + echo ""; + + if ( (strlen($remote_agent_id) < 1) or ($CoNfIrM != 'YES') or ($LOGdelete_remote_agents < 1) ) + { + echo "
REMOTEMITTEL NICHT GELÖSCHT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Remote_agent_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_remote_agents where remote_agent_id='$remote_agent_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING RMTAGENT!!|$PHP_AUTH_USER|$ip|remote_agent_id='$remote_agent_id'|\n"); + fclose($fp); + } + echo "
REMOTEMITTEL-AUSLASSUNG FÜHRTE DURCH: $remote_agent_id\n"; + echo "

\n"; + } + +$ADD='10000'; # go to remote agents list +} + +###################### +# ADD=611111 delete user group record +###################### + +if ($ADD==611111) +{ + echo ""; + + if ( (strlen($user_group) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_user_groups < 1) ) + { + echo "
BENUTZER-GRUPPE NICHT GELÖSCHT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
User_group be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_user_groups where user_group='$user_group' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING USRGROUP!!|$PHP_AUTH_USER|$ip|user_group='$user_group'|\n"); + fclose($fp); + } + echo "
BENUTZER-GRUPPE AUSLASSUNG DURCHGEFÜHRT: $user_group\n"; + echo "

\n"; + } + +$ADD='100000'; # go to user group list +} + +###################### +# ADD=6111111 delete script record +###################### + +if ($ADD==6111111) +{ + echo ""; + + if ( (strlen($script_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_scripts < 1) ) + { + echo "
INDEX NICHT GELÖSCHT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Script_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_scripts where script_id='$script_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING SCRIPT!!!!|$PHP_AUTH_USER|$ip|script_id='$script_id'|\n"); + fclose($fp); + } + echo "
INDEX-AUSLASSUNG FÜHRTE DURCH: $script_id\n"; + echo "

\n"; + } + +$ADD='1000000'; # go to script list +} + + +###################### +# ADD=61111111 delete filter record +###################### + +if ($ADD==61111111) +{ + echo ""; + + if ( (strlen($lead_filter_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_filters < 1) ) + { + echo "
FILTER NICHT GELÖSCHT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Filter Identifikation muß mindestens 2 Buchstaben lang sein\n"; + } + else + { + $stmt="DELETE from vicidial_lead_filters where lead_filter_id='$lead_filter_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING FILTER!!!!|$PHP_AUTH_USER|$ip|lead_filter_id='$lead_filter_id'|\n"); + fclose($fp); + } + echo "
FILTER-AUSLASSUNG DURCHGEFÜHRT: $lead_filter_id\n"; + echo "

\n"; + } + +$ADD='10000000'; # go to filter list +} + + +###################### +# ADD=611111111 delete call times record +###################### + +if ($ADD==611111111) +{ + echo ""; + + if ( (strlen($call_time_id) < 2) or ($LOGdelete_call_times < 1) ) + { + echo "
Anrufzeit nicht gelöscht - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Anrufzeit ID muss mindestens 2 Zeichen lang sein\n"; + } + else + { + $stmt="DELETE from vicidial_call_times where call_time_id='$call_time_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING CALL TIME!|$PHP_AUTH_USER|$ip|call_time_id='$call_time_id'|\n"); + fclose($fp); + } + echo "
Löschen der Anrufzeiten beendet: $call_time_id\n"; + echo "

\n"; + } + +$ADD='100000000'; # go to call times list +} + + +###################### +# ADD=6111111111 delete state call times record +###################### + +if ($ADD==6111111111) +{ + echo ""; + + if ( (strlen($call_time_id) < 2) or ($LOGdelete_call_times < 1) ) + { + echo "
Landesspezifische Anrufzeit nicht gelöscht - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Anrufzeit ID muss mindestens 2 Zeichen lang sein\n"; + } + else + { + $stmt="DELETE from vicidial_state_call_times where state_call_time_id='$call_time_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT call_time_id,ct_state_call_times from vicidial_call_times where ct_state_call_times LIKE \"%|$call_time_id|%\" order by call_time_id;"; + $rslt=mysql_query($stmt, $link); + $sct_to_print = mysql_num_rows($rslt); + $sct_list=''; + + $o=0; + while ($sct_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $sct_ids[$o] = "$rowx[0]"; + $sct_states[$o] = "$rowx[1]"; + $o++; + } + $o=0; + + while ($sct_to_print > $o) { + $sct_states[$o] = eregi_replace("\|$call_time_id\|",'|',$sct_states[$o]); + $stmt="UPDATE vicidial_call_times set ct_state_call_times='$sct_states[$o]' where call_time_id='$sct_ids[$o]';"; + $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + echo "Landesrichlinie gelöscht: $sct_ids[$o]
\n"; + $o++; + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING CALL TIME!|$PHP_AUTH_USER|$ip|state_call_time_id='$call_time_id'|\n"); + fclose($fp); + } + echo "
Löschen der landesspezifischen Anrufzeit beendet: $call_time_id\n"; + echo "

\n"; + } + +$ADD='1000000000'; # go to call times list +} + + +###################### +# ADD=61111111111 delete phone record +###################### + +if ($ADD==61111111111) +{ + echo ""; + + if ( (strlen($extension) < 2) or (strlen($server_ip) < 7) or ($CoNfIrM != 'YES') or ($LOGast_delete_phones < 1) ) + { + echo "
TELEFON NICHT GELÖSCHT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Extension be at least 2 characters in length\n"; + echo "
Bediener IP be at least 7 characters in length\n"; + } + else + { + $stmt="DELETE from phones where extension='$extension' and server_ip='$server_ip' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING PHONE!!!|$PHP_AUTH_USER|$ip|extension='$extension'|server_ip='$server_ip'|\n"); + fclose($fp); + } + echo "
TELEFON-AUSLASSUNG DURCHGEFÜHRT: $extension - $server_ip\n"; + echo "

\n"; + } +$ADD='10000000000'; # go to phone list +} + + +###################### +# ADD=611111111111 delete server record +###################### + +if ($ADD==611111111111) +{ + echo ""; + + if ( (strlen($server_id) < 2) or (strlen($server_ip) < 7) or ($CoNfIrM != 'YES') or ($LOGast_delete_phones < 1) ) + { + echo "
BEDIENERNOT DELETED - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Bediener Identifikation be at least 2 characters in length\n"; + echo "
Bediener IP be at least 7 characters in length\n"; + } + else + { + $stmt="DELETE from servers where server_id='$server_id' and server_ip='$server_ip' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING SERVER!!|$PHP_AUTH_USER|$ip|server_id='$server_id'|server_ip='$server_ip'|\n"); + fclose($fp); + } + echo "
BEDIENERDELETION COMPLETED: $server_id - $server_ip\n"; + echo "

\n"; + } +$ADD='100000000000'; # go to server list +} + + +###################### +# ADD=621111111111 delete vicidial server trunk record in the system +###################### + +if ($ADD==621111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($server_ip) < 7) ) + { + echo "
VICIDIAL BEDIENER-STAMM-SATZ NICHT GELÖSCHT - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Kampagne muß zwischen 3 und 8 Buchstaben lang sein\n"; + echo "
server_ip verzögert muß mindestens 7 Buchstaben sein\n"; + } + else + { + echo "
VICIDIAL BEDIENER-STAMM-SATZ GELÖSCHT: $campaign_id - $server_ip\n"; + + $stmt="DELETE FROM vicidial_server_trunks where campaign_id='$campaign_id' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE BEDIENERTRUNK |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +$ADD=311111111111; # go to server modification form below +} + + +###################### +# ADD=6111111111111 delete conference record +###################### + +if ($ADD==6111111111111) +{ + echo ""; + + if ( (strlen($conf_exten) < 2) or (strlen($server_ip) < 7) or ($CoNfIrM != 'YES') or ($LOGast_delete_phones < 1) ) + { + echo "
CONFERENCE NOT DELETED - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Conference be at least 2 characters in length\n"; + echo "
Bediener IP be at least 7 characters in length\n"; + } + else + { + $stmt="DELETE from conferences where conf_exten='$conf_exten' and server_ip='$server_ip' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING CONF!!!!|$PHP_AUTH_USER|$ip|conf_exten='$conf_exten'|server_ip='$server_ip'|\n"); + fclose($fp); + } + echo "
CONFERENCE DELETION COMPLETED: $conf_exten - $server_ip\n"; + echo "

\n"; + } +$ADD='1000000000000'; # go to conference list +} + + +###################### +# ADD=61111111111111 delete vicidial conference record +###################### + +if ($ADD==61111111111111) +{ + echo ""; + + if ( (strlen($conf_exten) < 2) or (strlen($server_ip) < 7) or ($CoNfIrM != 'YES') or ($LOGast_delete_phones < 1) ) + { + echo "
VICIDIAL CONFERENCE NOT DELETED - Gehen Sie bitte zurück und betrachten Sie die Daten, die Sieeingaben\n"; + echo "
Conference be at least 2 characters in length\n"; + echo "
Bediener IP be at least 7 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_conferences where conf_exten='$conf_exten' and server_ip='$server_ip' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING CONF!!!!|$PHP_AUTH_USER|$ip|conf_exten='$conf_exten'|server_ip='$server_ip'|\n"); + fclose($fp); + } + echo "
VICIDIAL CONFERENCE DELETION COMPLETED: $conf_exten - $server_ip\n"; + echo "

\n"; + } +$ADD='10000000000000'; # go to vicidial conference list +} + + + + + +###################################################################################################### +###################################################################################################### +####### 3 series, record modification forms +###################################################################################################### +###################################################################################################### + + + + +###################### +# ADD=3 modify user info in the system +###################### + +if ($ADD==3) +{ + if ($LOGmodify_users==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $user_level = $row[4]; + $user_group = $row[5]; + $phone_login = $row[6]; + $phone_pass = $row[7]; + $delete_users = $row[8]; + $delete_user_groups = $row[9]; + $delete_lists = $row[10]; + $delete_campaigns = $row[11]; + $delete_ingroups = $row[12]; + $delete_remote_agents = $row[13]; + $load_leads = $row[14]; + $campaign_detail = $row[15]; + $ast_admin_access = $row[16]; + $ast_delete_phones = $row[17]; + $delete_scripts = $row[18]; + $modify_leads = $row[19]; + $hotkeys_active = $row[20]; + $change_agent_campaign =$row[21]; + $agent_choose_ingroups =$row[22]; + $scheduled_callbacks = $row[24]; + $agentonly_callbacks = $row[25]; + $agentcall_manual = $row[26]; + $vicidial_recording = $row[27]; + $vicidial_transfers = $row[28]; + $delete_filters = $row[29]; + $alter_agent_interface_options =$row[30]; + $closer_default_blended = $row[31]; + $delete_call_times = $row[32]; + $modify_call_times = $row[33]; + $modify_users = $row[34]; + $modify_campaigns = $row[35]; + $modify_lists = $row[36]; + $modify_scripts = $row[37]; + $modify_filters = $row[38]; + $modify_ingroups = $row[39]; + $modify_usergroups = $row[40]; + $modify_remoteagents = $row[41]; + $modify_servers = $row[42]; + $view_reports = $row[43]; + $vicidial_recording_override = $row[44]; + $alter_custdata_override = $row[45]; + + if ( ($user_level >= $LOGuser_level) and ($LOGuser_level < 9) ) + { + echo "
Sie haben nicht Erlaubnis, diesen Benutzer zu ändern: $row[1]\n"; + } + else + { + echo "
ÄNDERN Sie Einen BENUTZER-SATZ: $row[1]\n"; + if ($LOGuser_level > 8) + {echo "\n";} + else + { + if ($LOGalter_agent_interface == "1") + {echo "\n";} + else + {echo "\n";} + } + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + if ( ($LOGuser_level > 8) or ($LOGalter_agent_interface == "1") ) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + if ($LOGuser_level > 8) + { + echo "\n"; + +#9BB9FB +#B9CBFD + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + echo "\n"; + echo "
Benutzer-Zahl: $row[1]$NWB#vicidial_users-user$NWE
Kennwort:$NWB#vicidial_users-pass$NWE
Voller Name: $NWB#vicidial_users-full_name$NWE
Benutzer-Niveau: $NWB#vicidial_users-user_level$NWE
Benutzer-Gruppe: $NWB#vicidial_users-user_group$NWE
Telefon-LOGON: $NWB#vicidial_users-phone_login$NWE
Telefon-Durchlauf: $NWB#vicidial_users-phone_pass$NWE
MITTEL-SCHNITTSTELLE WAHLEN:
Mittel Wählen Ingroups: $NWB#vicidial_users-agent_choose_ingroups$NWE
Hot Keys Aktiv: $NWB#vicidial_users-hotkeys_active$NWE
Zeitlich geplante Wiederholungsbesuche: $NWB#vicidial_users-scheduled_callbacks$NWE
Mittel-Nur Wiederholungsbesuche: $NWB#vicidial_users-agentonly_callbacks$NWE
Vertreter-Anruf-Handbuch: $NWB#vicidial_users-agentcall_manual$NWE
Vicidial Aufnahme: $NWB#vicidial_users-vicidial_recording$NWE
Vicidial Übertragungen: $NWB#vicidial_users-vicidial_transfers$NWE
Genauere Rückstellung Gemischt: $NWB#vicidial_users-closer_default_blended$NWE
VICIDIAL Aufnahme-Übersteuerung: $NWB#vicidial_users-vicidial_recording_override$NWE
Mittel Ändern Kunde Daten-Übersteuerung: $NWB#vicidial_users-alter_custdata_override$NWE
Kampagne Rank:$NWB#vicidial_users-campaign_ranks$NWE
\n"; + echo "\n"; + echo "$RANKcampaigns_list"; + echo "
\n"; + echo "
Inbound Gruppen: $NWB#vicidial_users-closer_campaigns$NWE
\n"; + echo "\n"; + echo "$RANKgroups_list"; + echo "
\n"; + echo "
ADMIN SCHNITTSTELLE WAHLEN:
Ansicht-Reports: $NWB#vicidial_users-view_reports$NWE
Ändern Sie Mittel-Schnittstelle Wahlen:$NWB#vicidial_users-alter_agent_interface_options$NWE
Ändern Sie Benutzer: $NWB#vicidial_users-modify_sections$NWE
Ändern Sie Vertreter-Kampagne: $NWB#vicidial_users-change_agent_campaign$NWE
Löschung-Benutzer: $NWB#vicidial_users-delete_users$NWE
Ändern Sie Benutzer-Gruppen: $NWB#vicidial_users-modify_sections$NWE
Löschung-Benutzer-Gruppen: $NWB#vicidial_users-delete_user_groups$NWE
Ändern Sie Listen: $NWB#vicidial_users-modify_sections$NWE
Löschung-Listen: $NWB#vicidial_users-delete_lists$NWE
Last Leitungen: $NWB#vicidial_users-load_leads$NWE
Ändern Sie Leitungen: $NWB#vicidial_users-modify_leads$NWE
Ändern Sie Kampagnen: $NWB#vicidial_users-modify_sections$NWE
Kampagne Detail: $NWB#vicidial_users-campaign_detail$NWE
Löschung-Kampagnen: $NWB#vicidial_users-delete_campaigns$NWE
Ändern Sie In-Gruppen: $NWB#vicidial_users-modify_sections$NWE
Löschung In-Gruppen: $NWB#vicidial_users-delete_ingroups$NWE
Ändern Sie Remotemittel: $NWB#vicidial_users-modify_sections$NWE
Löschung-Direktübertragung Mittel: $NWB#vicidial_users-delete_remote_agents$NWE
Ändern Sie Indexe: $NWB#vicidial_users-modify_sections$NWE
Löschung-Indexs: $NWB#vicidial_users-delete_scripts$NWE
Ändern Sie Filter: $NWB#vicidial_users-modify_sections$NWE
Löschung-Filter: $NWB#vicidial_users-delete_filters$NWE
AGC Admin Zugang: $NWB#vicidial_users-ast_admin_access$NWE
AGC Löschung-Telefone: $NWB#vicidial_users-ast_delete_phones$NWE
Bearbeite Anrufzeits: $NWB#vicidial_users-modify_call_times$NWE
Lösche Anrufzeits: $NWB#vicidial_users-delete_call_times$NWE
Ändern Sie Bediener: $NWB#vicidial_users-modify_sections$NWE
\n"; + + if ($LOGdelete_users > 0) + { + echo "

LÖSCHEN SIE DIESEN BENUTZER\n"; + } + echo "

Klicken Sie hier für Benutzerzeitblatt\n"; + echo "

Klicken Sie hier für Benutzerstatus\n"; + echo "

Klicken Sie hier für Benutzernotfall\n"; + echo "

Klicken Sie hier für Benutzer Wiederholungsbesuch Einflüsse\n"; + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + +###################### +# ADD=31 modify campaign info in the system - Detail view +###################### + +if ( ($LOGcampaign_detail < 1) and ($ADD==31) ) {$ADD=34;} # send to Basic if not allowed + +if ( ($ADD==31) and ( (!eregi("$campaign_id",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) ) + {$ADD=30;} # send to not allowed screen if not in vicidial_user_groups allowed_campaigns list + +if ($ADD==31) +{ + if ($LOGmodify_campaigns==1) + { + if ($stage=='show_dialable') + { + $stmt="UPDATE vicidial_campaigns set display_dialable_count='Y' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + if ($stage=='hide_dialable') + { + $stmt="UPDATE vicidial_campaigns set display_dialable_count='N' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + + $stmt="SELECT * from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $campaign_name = $row[1]; + $dial_status_a = $row[3]; + $dial_status_b = $row[4]; + $dial_status_c = $row[5]; + $dial_status_d = $row[6]; + $dial_status_e = $row[7]; + $lead_order = $row[8]; + $allow_closers = $row[12]; + $hopper_level = $row[13]; + $auto_dial_level = $row[14]; + $next_agent_call = $row[15]; + $local_call_time = $row[16]; + $voicemail_ext = $row[17]; + $dial_timeout = $row[18]; + $dial_prefix = $row[19]; + $campaign_cid = $row[20]; + $campaign_vdad_exten = $row[21]; + $campaign_rec_exten = $row[22]; + $campaign_recording = $row[23]; + $campaign_rec_filename = $row[24]; + $script_id = $row[25]; + $get_call_launch = $row[26]; + $am_message_exten = $row[27]; + $amd_send_to_vmx = $row[28]; + $xferconf_a_dtmf = $row[29]; + $xferconf_a_number = $row[30]; + $xferconf_b_dtmf = $row[31]; + $xferconf_b_number = $row[32]; + $alt_number_dialing = $row[33]; + $scheduled_callbacks = $row[34]; + $lead_filter_id = $row[35]; + if ($lead_filter_id=='') {$lead_filter_id='NONE';} + $drop_call_seconds = $row[36]; + $safe_harbor_message = $row[37]; + $safe_harbor_exten = $row[38]; + $display_dialable_count = $row[39]; + $wrapup_seconds = $row[40]; + $wrapup_message = $row[41]; + # $closer_campaigns = $row[42]; + $use_internal_dnc = $row[43]; + $allcalls_delay = $row[44]; + $omit_phone_code = $row[45]; + $dial_method = $row[46]; + $available_only_ratio_tally = $row[47]; + $adaptive_dropped_percentage = $row[48]; + $adaptive_maximum_level = $row[49]; + $adaptive_latest_server_time = $row[50]; + $adaptive_intensity = $row[51]; + $adaptive_dl_diff_target = $row[52]; + $concurrent_transfers = $row[53]; + $auto_alt_dial = $row[54]; + $auto_alt_dial_statuses = $row[55]; + $agent_pause_codes_active = $row[56]; + $campaign_description = $row[57]; + $campaign_changedate = $row[58]; + $campaign_stats_refresh = $row[59]; + $campaign_logindate = $row[60]; + $dial_statuses = $row[61]; + $disable_alter_custdata = $row[62]; + $no_hopper_leads_logins = $row[63]; + $list_order_mix = $row[64]; + $campaign_allow_inbound = $row[65]; + $manual_dial_list_id = $row[66]; + $default_xfer_group = $row[67]; + + if (ereg("DISABLED",$list_order_mix)) + {$DEFlistDISABLE = ''; $DEFstatusDISABLED=0;} + else + {$DEFlistDISABLE = 'disabled'; $DEFstatusDISABLED=1;} + + $stmt="SELECT count(*) from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and status='ACTIVE'"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0] < 1) + { + $mixes_list="\n"; + $mixname_list["DISABLED"] = "DISABLED"; + } + else + { + ##### get list_mix listings for dynamic pulldown + $stmt="SELECT vcl_id,vcl_name from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and status='ACTIVE' limit 1"; + $rslt=mysql_query($stmt, $link); + $mixes_to_print = mysql_num_rows($rslt); + $mixes_list="\n"; + + $o=0; + while ($mixes_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $mixes_list .= "\n"; + $mixname_list["ACTIVE"] = "$rowx[0] - $rowx[1]"; + $o++; + } + } + + ##### get status listings for dynamic pulldown + $stmt="SELECT * from vicidial_statuses order by status"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $statuses_list=''; + + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $statuses_list .= "\n"; + $statname_list["$rowx[0]"] = "$rowx[1]"; + $LRstatuses_list .= "\n"; + if (eregi("Y",$rowx[2])) + {$HKstatuses_list .= "\n";} + $o++; + } + + $stmt="SELECT * from vicidial_campaign_statuses where campaign_id='$campaign_id' order by status"; + $rslt=mysql_query($stmt, $link); + $Cstatuses_to_print = mysql_num_rows($rslt); + + $o=0; + while ($Cstatuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $statuses_list .= "\n"; + $statname_list["$rowx[0]"] = "$rowx[1]"; + $LRstatuses_list .= "\n"; + if (eregi("Y",$rowx[2])) + {$HKstatuses_list .= "\n";} + $o++; + } + + $dial_statuses = preg_replace("/ -$/","",$dial_statuses); + $Dstatuses = explode(" ", $dial_statuses); + $Ds_to_print = (count($Dstatuses) -1); + + ##### get in-groups listings for dynamic pulldown list menu + $stmt="SELECT group_id,group_name from vicidial_inbound_groups $xfer_groupsSQL order by group_id"; + $rslt=mysql_query($stmt, $link); + $Xgroups_to_print = mysql_num_rows($rslt); + $Xgroups_menu=''; + $Xgroups_selected=0; + $o=0; + while ($Xgroups_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $Xgroups_menu .= "\n"; + $o++; + } + if ($Xgroups_selected < 1) + {$Xgroups_menu .= "\n";} + else + {$Xgroups_menu .= "\n";} + + + if ($SUB<1) {$camp_detail_color=$subcamp_color;} + else {$camp_detail_color=$campaigns_color;} + if ($SUB==22) {$camp_statuses_color=$subcamp_color;} + else {$camp_statuses_color=$campaigns_color;} + if ($SUB==23) {$camp_hotkeys_color=$subcamp_color;} + else {$camp_hotkeys_color=$campaigns_color;} + if ($SUB==25) {$camp_recycle_color=$subcamp_color;} + else {$camp_recycle_color=$campaigns_color;} + if ($SUB==26) {$camp_autoalt_color=$subcamp_color;} + else {$camp_autoalt_color=$campaigns_color;} + if ($SUB==27) {$camp_pause_color=$subcamp_color;} + else {$camp_pause_color=$campaigns_color;} + if ($SUB==29) {$camp_listmix_color=$subcamp_color;} + else {$camp_listmix_color=$campaigns_color;} + echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "
$row[0]: Basic Detail StatusesHotKeysLead RecyclingAuto Alt DialPause CodesList Mix Real-Time
\n"; + + echo "
\n"; + echo ""; + + echo "
\n"; + + if ($SUB < 1) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + $o=0; + while ($Ds_to_print > $o) + { + $o++; + $Dstatus = $Dstatuses[$o]; + + echo "\n"; + } + else + { + echo "$Dstatus - $statname_list[$Dstatus]         \n"; + echo "ENTFERNEN Sie\n"; + } + } + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + + + echo "\n"; + + echo "\n"; + + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + if ($campaign_allow_inbound == 'Y') + { + echo "\n"; + } + + echo "\n"; + + if ($allow_closers == 'Y') + { + echo "\n"; + } + + echo "\n"; + echo "
Kampagne Identifikation: $row[0]$NWB#vicidial_campaigns-campaign_id$NWE
Kampagne Name: $NWB#vicidial_campaigns-campaign_name$NWE
Kampagne Beschreibung: $NWB#vicidial_campaigns-campaign_description$NWE
Kampagne Change Date: $campaign_changedate   $NWB#vicidial_campaigns-campaign_changedate$NWE
Kampagne Login Date: $campaign_logindate   $NWB#vicidial_campaigns-campaign_logindate$NWE
Aktiv:$NWB#vicidial_campaigns-active$NWE
Park-Verlängerung: - Filename: $NWB#vicidial_campaigns-park_ext$NWE
Netz-Form: $NWB#vicidial_campaigns-web_form_address$NWE
Erlauben Sie Closers: $NWB#vicidial_campaigns-allow_closers$NWE
Erlauben Sie Inbound und gemischt:$NWB#vicidial_campaigns-campaign_allow_inbound$NWE
Vorwahlknopf-Status$o: \n"; + + if ($DEFstatusDISABLED > 0) + { + echo "$Dstatus - $statname_list[$Dstatus]         \n"; + echo "REMOVE
Add A Dial Status:   \n"; + echo "     $NWB#vicidial_campaigns-dial_status$NWE
Liste Auftrag: $NWB#vicidial_campaigns-lead_order$NWE
List Mix: $NWB#vicidial_campaigns-list_order_mix$NWE
Leitung Filter: $NWB#vicidial_campaigns-lead_filter_id$NWE
Zufuhrbehälter-Niveau: $NWB#vicidial_campaigns-hopper_level$NWE
Kraft-Zurückstellen des Zufuhrbehälters: $NWB#vicidial_campaigns-force_reset_hopper$NWE
Vorwahlknopf-Methode: $NWB#vicidial_campaigns-dial_method$NWE
Selbstvorwahlknopf-Niveau: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE       PASSEN SIE ÜBERSTEUERUNG AN
Vorhandenes Nur Tally: $NWB#vicidial_campaigns-available_only_ratio_tally$NWE
Tropfen-Prozentsatz-Begrenzung: % $NWB#vicidial_campaigns-adaptive_dropped_percentage$NWE
Maximum Paßt Vorwahlknopf-Niveau An: number only $NWB#vicidial_campaigns-adaptive_maximum_level$NWE
Neueste Bediener-Zeit: 4 nur Stellen $NWB#vicidial_campaigns-adaptive_latest_server_time$NWE
Passen Sie Intensität Modifizierfaktor An: $NWB#vicidial_campaigns-adaptive_intensity$NWE
Vorwahlknopf-Waagerecht ausgerichtetes Unterschied-Ziel: $NWB#vicidial_campaigns-adaptive_dl_diff_target$NWE
Gleichzeitige Übertragungen: $NWB#vicidial_campaigns-concurrent_transfers$NWE
SelbstAlt-zahl Wählen: $NWB#vicidial_campaigns-auto_alt_dial$NWE
Folgender Vertreter-Anruf: $NWB#vicidial_campaigns-next_agent_call$NWE
Ortsgespräch-Zeit: $NWB#vicidial_campaigns-local_call_time$NWE
Vorwahlknopf-Abschaltung: in seconds$NWB#vicidial_campaigns-dial_timeout$NWE
Vorwahlknopf-Präfix: for 91NXXNXXXXXX value would be 9, for no dial prefix use X$NWB#vicidial_campaigns-dial_prefix$NWE
Lassen Sie Telefon-Code Aus: $NWB#vicidial_campaigns-omit_phone_code$NWE
Kampagne CallerID: $NWB#vicidial_campaigns-campaign_cid$NWE
Kampagne VDAD exten: $NWB#vicidial_campaigns-campaign_vdad_exten$NWE
Kampagne Rec exten: $NWB#vicidial_campaigns-campaign_rec_exten$NWE
Kampagne Aufnahme: $NWB#vicidial_campaigns-campaign_recording$NWE
Kampagne Rec Dateiname: $NWB#vicidial_campaigns-campaign_rec_filename$NWE
Das Notieren Verzögert: in seconds$NWB#vicidial_campaigns-allcalls_delay$NWE
Script: $NWB#vicidial_campaigns-campaign_script$NWE
Erhalten Sie Anruf-Produkteinführung: $NWB#vicidial_campaigns-get_call_launch$NWE
Antwortende Maschine Anzeige: $NWB#vicidial_campaigns-am_message_exten$NWE
AMD senden zu VM exten: $NWB#vicidial_campaigns-amd_send_to_vmx$NWE
BringenSie DTMF 1: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
BringenSie Zahl 1: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
BringenSie DTMF 2: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
BringenSie Zahl 2: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
Alternative Nummer wählen: $NWB#vicidial_campaigns-alt_number_dialing$NWE
Zeitlich geplante Wiederholungsbesuche: $NWB#vicidial_campaigns-scheduled_callbacks$NWE
Verbindungsaufbau Sekunden: $NWB#vicidial_campaigns-drop_call_seconds$NWE
Voicemail: $NWB#vicidial_campaigns-voicemail_ext$NWE
Benutze Sicherheitsnachricht: $NWB#vicidial_campaigns-safe_harbor_message$NWE
Sicherheitsnebenstelle: $NWB#vicidial_campaigns-safe_harbor_exten$NWE
Nachbereitung Sekunden $NWB#vicidial_campaigns-wrapup_seconds$NWE
Nachbereitung Nachricht $NWB#vicidial_campaigns-wrapup_message$NWE
Benutzen Sie Interne DNC Liste: $NWB#vicidial_campaigns-use_internal_dnc$NWE
AgentPause CodesAktiv:$NWB#vicidial_campaigns-agent_pause_codes_active$NWE
Kampagne Stats Refresh: $NWB#vicidial_campaigns-campaign_stats_refresh$NWE
Sperren Sie Ändern Kunde Daten: $NWB#vicidial_campaigns-disable_alter_custdata$NWE
Gewähren Sie Kein-Zufuhrbehälter-Führt LOGON: $NWB#vicidial_campaigns-no_hopper_leads_logins$NWE
Manuelle Vorwahlknopf-Liste Identifikation:$NWB#vicidial_campaigns-manual_dial_list_id$NWE
Gewährte Inbound Gruppen:
"; + echo " $NWB#vicidial_campaigns-closer_campaigns$NWE
\n"; + echo "$groups_list"; + echo "
Rückstellung Übergangsgruppe:$NWB#vicidial_campaigns-default_xfer_group$NWE
Gewährte Übergangsgruppen:
"; + echo " $NWB#vicidial_campaigns-xfer_groups$NWE
\n"; + echo "$XFERgroups_list"; + echo "
\n"; + + echo "
\n"; + echo "
LISTEN INNERHALB DIESER KAMPAGNE:   $NWB#vicidial_campaign_lists$NWE
\n"; + echo "\n"; + echo "\n"; + + $active_lists = 0; + $inactive_lists = 0; + $stmt="SELECT list_id,active,list_name from vicidial_lists where campaign_id='$campaign_id'"; + $rslt=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rslt); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $o++; + if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_lists++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + echo "
LISTE IDENTIFIKATIONLISTE NAMEAKTIV
$rowx[0]$rowx[2]$rowx[1]

\n"; + echo "
\n"; + + $filterSQL = $filtersql_list[$lead_filter_id]; + $filterSQL = eregi_replace("^and|and$|^or|or$","",$filterSQL); + if (strlen($filterSQL)>4) + {$fSQL = "and $filterSQL";} + else + {$fSQL = '';} + + $camp_lists = eregi_replace(".$","",$camp_lists); + echo "Diese Kampagne hat$active_lists aktive Listen und$inactive_lists unaktivierte Listen

\n"; + + if ($display_dialable_count == 'Y') + { + ### call function to calculate and print dialable leads + dialable_leads($DB,$link,$local_call_time,$dial_statuses,$camp_lists,$fSQL); + echo " - Verberge

"; + } + else + { + echo "Popup Dialable Leads Count"; + echo " - Zeige

"; + } + + + + + + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id='$campaign_id' and status IN('READY')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $hopper_leads = "$rowx[0]"; + + echo "Diese Kampagne hat$hopper_leads Leitungen im Vorwahlknopfzufuhrbehälter

\n"; + echo "Klicken Sie hier, um zu sehen, welche Leitungen im Zufuhrbehälter imAugenblick sind

\n"; + echo "Klicken Sie hier, um alle Wiederholungsbesuch Einflüsse in dieserKampagne zu sehen

\n"; + echo "Click here to see a VDAD report for this campaign

\n"; + echo "
\n"; + } + + + + if ($SUB==22) + { + + ##### get status category listings for dynamic pulldown + $stmt="SELECT vsc_id,vsc_name from vicidial_status_categories order by vsc_id desc"; + $rslt=mysql_query($stmt, $link); + $cats_to_print = mysql_num_rows($rslt); + $cats_list=""; + + $o=0; + while ($cats_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $cats_list .= "\n"; + $catsname_list["$rowx[0]"] = substr($rowx[1],0,20); + $o++; + } + + + echo "
\n"; + echo "
KUNDENSPEZIFISCHE STATUS INNERHALB DIESER KAMPAGNE:   $NWB#vicidial_campaign_statuses$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_campaign_statuses where campaign_id='$campaign_id'"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $AScategory = $rowx[5]; + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
STATUSBESCHREIBUNGAUSWÄHLBARMENSCHLICHE ANTWORTLÖSCHUNG
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "$rowx[0]
\n"; + echo "\n"; + echo "         \n"; + echo "   \n"; + echo "LÖSCHUNG\n"; + echo "
\n"; + + echo "
ADDIEREN SIE NEUEN KUNDENSPEZIFISCHEN KAMPAGNE STATUS
\n"; + echo "\n"; + echo "\n"; + echo "Status:   \n"; + echo "Beschreibung:   \n"; + echo "Auswählbar:   \n"; + echo "Human Answer:   \n"; + echo "Kategorie:\n"; + echo "  
\n"; + echo "
\n"; + + echo "

\n"; + } + + + if ($SUB==23) + { + echo "
GEWOHNHEIT HOT KEYS INNERHALB DIESER KAMPAGNE:   $NWB#vicidial_campaign_hotkeys$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_campaign_hotkeys where campaign_id='$campaign_id' order by hotkey"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $o=0; + while ($statuses_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + + echo "
HOT KEYSTATUSBESCHREIBUNGLÖSCHUNG
$rowx[1]$rowx[0]$rowx[2]LÖSCHUNG
\n"; + + echo "
ADDIEREN SIE NEUE KUNDENSPEZIFISCHE KAMPAGNE HOT KEY
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Hotkey:   \n"; + echo "Status:   \n"; + echo "
\n"; + echo "

\n"; + } + + + if ($SUB==25) + { + echo "

LEITUNG, DIE INNERHALB DIESER KAMPAGNE AUFBEREITET:   $NWB#vicidial_lead_recycle$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_lead_recycle where campaign_id='$campaign_id' order by status"; + $rslt=mysql_query($stmt, $link); + $recycle_to_print = mysql_num_rows($rslt); + $o=0; + while ($recycle_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
STATUSVERSUCH VERZÖGERTVERSUCH MAXIMUMAKTIV LÖSCHUNG
$rowx[2]
\n"; + echo "\n"; + echo "\n"; + echo "
LÖSCHUNG
\n"; + + echo "
ADDIEREN SIE NEUE KAMPAGNE LEITUNG AUFBEREITEN
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Status:   \n"; + echo "Versuch Verzögert: \n"; + echo "Versuch Maximum: \n"; + echo "
\n"; + + echo "

\n"; + } + + + if ($SUB==26) + { + echo "

SELBSTALT ZAHL, DIE FÜR DIESE KAMPAGNE WÄHLT:   $NWB#vicidial_auto_alt_dial_statuses$NWE
\n"; + echo "\n"; + echo "\n"; + + $auto_alt_dial_statuses = preg_replace("/ -$/","",$auto_alt_dial_statuses); + $AADstatuses = explode(" ", $auto_alt_dial_statuses); + $AADs_to_print = (count($AADstatuses) -1); + + $o=0; + while ($AADs_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + $o++; + + echo "\n"; + echo "\n"; + } + + echo "
STATUSESLÖSCHUNG
$AADstatuses[$o]LÖSCHUNG
\n"; + + echo "
ADDIEREN SIE NEUE ZAHL-WÄHLENDEN STATUS DES AUTOMOBIL-ALT
\n"; + echo "\n"; + echo "\n"; + echo "Status:   \n"; + echo "
\n"; + + echo "

\n"; + } + + + if ($SUB==27) + { + echo "

MITTEL-PAUSE CODES FÜR DIESE KAMPAGNE:   $NWB#vicidial_pause_codes$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_pause_codes where campaign_id='$campaign_id' order by pause_code"; + $rslt=mysql_query($stmt, $link); + $pause_codes_to_print = mysql_num_rows($rslt); + $o=0; + while ($pause_codes_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
PAUSE CODESVERRECHENBARÄNDERN SieLÖSCHUNG
$rowx[0]\n"; + echo "\n"; + echo "\n"; + echo "  \n"; + echo "
LÖSCHUNG
\n"; + + echo "
ADDIEREN SIE NEUEN MITTEL-PAUSE CODE
\n"; + echo "\n"; + echo "\n"; + echo "Pause Code: \n"; + echo "Pause Code-Name: \n"; + echo "   Verrechenbar: \n"; + echo "
\n"; + + echo "

\n"; + } + + + if ($SUB < 1) + { + echo "

\n"; + echo "LOGGEN SIE ALLE MITTEL AUS DIESER KAMPAGNE HERAUS

\n"; + echo "EMERGENCY VDAC CLEAR FOR THIS CAMPAIGN

\n"; + + if ($LOGdelete_campaigns > 0) + { + echo "

LÖSCHEN SIE DIESE KAMPAGNE\n"; + } + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + +###################### +# ADD=34 modify campaign info in the system - Basic View +###################### + +if ( ($ADD==34) and ( (!eregi("$campaign_id",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) ) + {$ADD=30;} # send to not allowed screen if not in vicidial_user_groups allowed_campaigns list + +if ($ADD==34) +{ + if ($LOGmodify_campaigns==1) + { + if ($stage=='show_dialable') + { + $stmt="UPDATE vicidial_campaigns set display_dialable_count='Y' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + if ($stage=='hide_dialable') + { + $stmt="UPDATE vicidial_campaigns set display_dialable_count='N' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + + $stmt="SELECT * from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $dial_status_a = $row[3]; + $dial_status_b = $row[4]; + $dial_status_c = $row[5]; + $dial_status_d = $row[6]; + $dial_status_e = $row[7]; + $lead_order = $row[8]; + $hopper_level = $row[13]; + $auto_dial_level = $row[14]; + $next_agent_call = $row[15]; + $local_call_time = $row[16]; + $voicemail_ext = $row[17]; + $dial_timeout = $row[18]; + $dial_prefix = $row[19]; + $campaign_cid = $row[20]; + $campaign_vdad_exten = $row[21]; + $script_id = $row[25]; + $get_call_launch = $row[26]; + $lead_filter_id = $row[35]; + if ($lead_filter_id=='') {$lead_filter_id='NONE';} + $display_dialable_count = $row[39]; + $dial_method = $row[46]; + $adaptive_intensity = $row[51]; + $campaign_description = $row[57]; + $campaign_changedate = $row[58]; + $campaign_stats_refresh = $row[59]; + $campaign_logindate = $row[60]; + $dial_statuses = $row[61]; + $list_order_mix = $row[64]; + $default_xfer_group = $row[67]; + $campaign_allow_inbound = $row[65]; + $default_xfer_group = $row[67]; + + if (ereg("DISABLED",$list_order_mix)) + {$DEFlistDISABLE = ''; $DEFstatusDISABLED=0;} + else + {$DEFlistDISABLE = 'disabled'; $DEFstatusDISABLED=1;} + + $stmt="SELECT * from vicidial_statuses order by status"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $statuses_list=''; + + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $statuses_list .= "\n"; + $statname_list["$rowx[0]"] = "$rowx[1]"; + $LRstatuses_list .= "\n"; + if (eregi("Y",$rowx[2])) + {$HKstatuses_list .= "\n";} + $o++; + } + + $stmt="SELECT * from vicidial_campaign_statuses where campaign_id='$campaign_id' order by status"; + $rslt=mysql_query($stmt, $link); + $Cstatuses_to_print = mysql_num_rows($rslt); + + $o=0; + while ($Cstatuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $statuses_list .= "\n"; + $statname_list["$rowx[0]"] = "$rowx[1]"; + $LRstatuses_list .= "\n"; + if (eregi("Y",$rowx[2])) + {$HKstatuses_list .= "\n";} + $o++; + } + + $dial_statuses = preg_replace("/ -$/","",$dial_statuses); + $Dstatuses = explode(" ", $dial_statuses); + $Ds_to_print = (count($Dstatuses) -1); + + $stmt="SELECT count(*) from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and status='ACTIVE'"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0] < 1) + { + $mixes_list="\n"; + $mixname_list["DISABLED"] = "DISABLED"; + } + else + { + ##### get list_mix listings for dynamic pulldown + $stmt="SELECT vcl_id,vcl_name from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and status='ACTIVE' limit 1"; + $rslt=mysql_query($stmt, $link); + $mixes_to_print = mysql_num_rows($rslt); + $mixes_list="\n"; + + $o=0; + while ($mixes_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $mixes_list .= "\n"; + $mixname_list["ACTIVE"] = "$rowx[0] - $rowx[1]"; + $o++; + } + } + + if ($SUB<1) {$camp_detail_color=$subcamp_color;} + else {$camp_detail_color=$campaigns_color;} + if ($SUB==22) {$camp_statuses_color=$subcamp_color;} + else {$camp_statuses_color=$campaigns_color;} + if ($SUB==23) {$camp_hotkeys_color=$subcamp_color;} + else {$camp_hotkeys_color=$campaigns_color;} + if ($SUB==25) {$camp_recycle_color=$subcamp_color;} + else {$camp_recycle_color=$campaigns_color;} + if ($SUB==26) {$camp_autoalt_color=$subcamp_color;} + else {$camp_autoalt_color=$campaigns_color;} + if ($SUB==27) {$camp_pause_color=$subcamp_color;} + else {$camp_pause_color=$campaigns_color;} + if ($SUB==29) {$camp_listmix_color=$subcamp_color;} + else {$camp_listmix_color=$campaigns_color;} + echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "
$row[0]: Grundlegende Ansicht Detail-Ansicht List Mix Echtzeit Bildschirm  
\n"; + + if ($SUB < 1) + { + echo "
\n"; + echo ""; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + $o=0; + while ($Ds_to_print > $o) + { + $o++; + $Dstatus = $Dstatuses[$o]; + + echo "\n"; + } + else + { + echo "$Dstatus - $statname_list[$Dstatus]         \n"; + echo "ENTFERNEN Sie\n"; + } + } + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + echo "
Kampagne Identifikation: $row[0]$NWB#vicidial_campaigns-campaign_id$NWE
Kampagne Name: $NWB#vicidial_campaigns-campaign_name$NWE
Kampagne Beschreibung: $row[57]$NWB#vicidial_campaigns-campaign_description$NWE
Kampagne Change Date: $campaign_changedate   $NWB#vicidial_campaigns-campaign_changedate$NWE
Kampagne Login Date: $campaign_logindate   $NWB#vicidial_campaigns-campaign_logindate$NWE
Aktiv:$NWB#vicidial_campaigns-active$NWE
Park-Verlängerung: $row[9] - $row[10]$NWB#vicidial_campaigns-park_ext$NWE
Netz-Form: $row[11]$NWB#vicidial_campaigns-web_form_address$NWE
Erlauben Sie Closers: $row[12] $NWB#vicidial_campaigns-allow_closers$NWE
Rückstellung Übergangsgruppe:$default_xfer_group $NWB#vicidial_campaigns-default_xfer_group$NWE
Erlauben Sie Inbound und gemischt:$campaign_allow_inbound $NWB#vicidial_campaigns-campaign_allow_inbound$NWE
Vorwahlknopf-Status$o: \n"; + if ($DEFstatusDISABLED > 0) + { + echo "$Dstatus - $statname_list[$Dstatus]         \n"; + echo "REMOVE
Add A Dial Status:   \n"; + echo "     $NWB#vicidial_campaigns-dial_status$NWE
Liste Auftrag: $NWB#vicidial_campaigns-lead_order$NWE
List Mix: $NWB#vicidial_campaigns-list_order_mix$NWE
Leitung Filter: $NWB#vicidial_campaigns-lead_filter_id$NWE
Zufuhrbehälter-Niveau: $NWB#vicidial_campaigns-hopper_level$NWE
Kraft-Zurückstellen des Zufuhrbehälters: $NWB#vicidial_campaigns-force_reset_hopper$NWE
Vorwahlknopf-Methode: $NWB#vicidial_campaigns-dial_method$NWE
Selbstvorwahlknopf-Niveau: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE
Passen Sie Intensität Modifizierfaktor An: $NWB#vicidial_campaigns-adaptive_intensity$NWE
Script: $script_id
Erhalten Sie Anruf-Produkteinführung: $get_call_launch
\n"; + + echo "
\n"; + echo "
LISTEN INNERHALB DIESER KAMPAGNE:   $NWB#vicidial_campaign_lists$NWE
\n"; + echo "\n"; + echo "\n"; + + $active_lists = 0; + $inactive_lists = 0; + $stmt="SELECT list_id,active,list_name from vicidial_lists where campaign_id='$campaign_id'"; + $rslt=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rslt); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_lists++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + + echo "
LISTE IDENTIFIKATIONLISTE NAMEAKTIV
$rowx[0]$rowx[2]$rowx[1]

\n"; + echo "
\n"; + + $filterSQL = $filtersql_list[$lead_filter_id]; + $filterSQL = eregi_replace("^and|and$|^or|or$","",$filterSQL); + if (strlen($filterSQL)>4) + {$fSQL = "and $filterSQL";} + else + {$fSQL = '';} + + $camp_lists = eregi_replace(".$","",$camp_lists); + echo "Diese Kampagne hat$active_lists aktive Listen und$inactive_lists unaktivierte Listen

\n"; + + + if ($display_dialable_count == 'Y') + { + ### call function to calculate and print dialable leads + dialable_leads($DB,$link,$local_call_time,$dial_statuses,$camp_lists,$fSQL); + echo " - Verberge

"; + } + else + { + echo "Popup Dialable Leads Count"; + echo " - Zeige

"; + } + + + + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id='$campaign_id' and status IN('READY')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $hopper_leads = "$rowx[0]"; + + echo "Diese Kampagne hat$hopper_leads Leitungen im Vorwahlknopfzufuhrbehälter

\n"; + echo "Klicken Sie hier, um zu sehen, welche Leitungen im Zufuhrbehälter imAugenblick sind

\n"; + echo "Klicken Sie hier, um alle Wiederholungsbesuch Einflüsse in dieserKampagne zu sehen

\n"; + echo "Click here to see a VDAD report for this campaign

\n"; + echo "
\n"; + + echo "
\n"; + + ### list of agent rank or skill-level for this campaign + echo "
\n"; + echo "
MITTEL-RANK FÜR DIESE KAMPAGNE:
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT user,campaign_rank,calls_today from vicidial_campaign_agents where campaign_id='$campaign_id'"; + $rsltx=mysql_query($stmt, $link); + $users_to_print = mysql_num_rows($rsltx); + + $o=0; + while ($users_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + + echo "
USER     RANK     CALLS TODAY
$rowx[0]$rowx[1]$rowx[2]

\n"; + + + echo "LOGGEN SIE ALLE MITTEL AUS DIESER KAMPAGNE HERAUS

\n"; + + + if ($LOGdelete_campaigns > 0) + { + echo "

LÖSCHEN SIE DIESE KAMPAGNE\n"; + } + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + +###################### +# ADD=31 or 34 and SUB=29 for list mixes +###################### +if ( ( ($ADD==34) or ($ADD==31) ) and ( (!eregi("$campaign_id",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) ) + {$ADD=30;} # send to not allowed screen if not in vicidial_user_groups allowed_campaigns list + +if ( ($ADD==34) or ($ADD==31) ) +{ + if ($LOGmodify_campaigns==1) + { + if ($SUB==29) + { + ##### get list_id listings for dynamic pulldown + $stmt="SELECT list_id,list_name from vicidial_lists where campaign_id='$campaign_id' order by list_id"; + $rslt=mysql_query($stmt, $link); + $mixlists_to_print = mysql_num_rows($rslt); + $mixlists_list=""; + + $o=0; + while ($mixlists_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $mixlists_list .= "\n"; + $mixlistsname_list["$rowx[0]"] = "$rowx[1]"; + $o++; + } + + + echo "

LISTE MISCHUNGEN FÜR DIESE KAMPAGNE:  $NWB#vicidial_campaigns-list_order_mix$NWE
\n"; + + echo "

Experimental Feature in development!!! NON-FUNCTIONAL
\n"; + + + $stmt="SELECT * from vicidial_campaigns_list_mix where campaign_id='$campaign_id' order by status, vcl_id"; + $rslt=mysql_query($stmt, $link); + $listmixes = mysql_num_rows($rslt); + $o=0; + while ($listmixes > $o) + { + $rowx=mysql_fetch_row($rslt); + $vcl_id=$rowx[0]; + $o++; + + if ($o < 2) + {$tablecolor='bgcolor="#99FF99"'; $bgcolor='bgcolor="#CCFFCC"';} + else + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$tablecolor='bgcolor="#B9CBFD"'; $bgcolor='bgcolor="#9BB9FB"';} + else + {$tablecolor='bgcolor="#9BB9FB"'; $bgcolor='bgcolor="#B9CBFD"';} + } + echo "
\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + } + else + {echo "$rowx[5]\n";} + echo "\n"; + echo "\n"; + +# list_id|order|percent|statuses|:list_id|order|percent|statuses|:... +# 101|1|40| A B NA -|:102|2|25| NEW -|:103|3|30| DROP CALLBK -|:101|4|5| DROP -| +# INSERT INTO vicidial_campaigns_list_mix values('TESTMIX','TESTCAMP List Mix','TESTCAMP','101|1|40| A B NA -|:102|2|25| NEW -|:103|3|30| DROP CALLBK -|:101|4|5| DROP -|','IN_ORDER','ACTIVE'); +# INSERT INTO vicidial_campaigns_list_mix values('TESTMIX2','TESTCAMP List Mix2','TESTCAMP','101|1|20| A B -|:102|2|45| NEW -|:103|3|30| DROP CALLBK -|:101|4|5| DROP -|','IN_ORDER','ACTIVE'); +# INSERT INTO vicidial_campaigns_list_mix values('TESTMIX3','TESTCAMP List Mix3','TESTCAMP','101|1|30| A NA -|:102|2|35| NEW -|:103|3|30| DROP CALLBK -|:101|4|5| DROP -|','IN_ORDER','ACTIVE'); + + $MIXentries = $MT; + $MIXentries = explode(":", $rowx[3]); + $Ms_to_print = (count($MIXentries) - 0); + $q=0; + while ($Ms_to_print > $q) + { + $MIXdetails = explode('|', $MIXentries[$q]); + $MIXdetailsLIST = $MIXdetails[0]; + + $dial_statuses = preg_replace("/ -$/","",$dial_statuses); + $Dstatuses = explode(" ", $dial_statuses); + $Ds_to_print = (count($Dstatuses) - 0); + $Dsql = ''; + $r=0; + while ($Ds_to_print > $r) + { + $r++; + $Dsql .= "'$Dstatuses[$r]',"; + } + $Dsql = preg_replace("/,$/","",$Dsql); + + echo "\n"; + + echo "\n"; + + echo "\n"; + + + echo "\n"; + echo "\n"; + + + echo "\n"; + + + $q++; + + } + + + + + echo "\n"; + + echo "\n"; + + + echo "\n"; + + if ($q > 9) {$AE_disabled = 'DISABLED';} + else {$AE_disabled = '';} + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "$vcl_id:\n"; + echo "\n"; + echo "     DELETE LIST MIX
Status:\n"; + if ($rowx[5]=='INACTIVE') + { + echo "$rowx[5]\n"; + echo "STELLEN SIE AUF AKTIVES EINMethod:\n"; + echo "
LISTE IDENTIFIKATIONPRIORITY% MIXSTATUSES
\n"; + echo "\n"; + echo "List: $MIXdetailsLIST   ENTFERNEN Sie\n"; + + + + echo " \n"; + echo "ADD   \n"; + echo "ENTFERNEN Sie\n"; + echo "
\n"; + echo "Difference %: \n"; + echo "   \n"; + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "List:
\n"; + echo "
\n"; + } + + + echo "

ADDIEREN SIE NEUE LISTE MIX
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Mix ID: Mix Name: Mix Method: "; + echo "
List: Dial Status:  
\n"; + + echo "
\n"; + + } + } +} + + +###################### +# ADD=30 campaign not allowed +###################### + +if ($ADD==30) +{ +echo "
\n"; + echo ""; +echo "You do not have permission to view campaign $campaign_id\n"; +} + + +###################### +# ADD=32 display all campaign statuses +###################### +if ($ADD==32) +{ +echo "
\n"; + echo ""; + +echo "
KUNDENSPEZIFISCHE KAMPAGNE STATUS-AUFLISTUNGEN:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNNAMESTATUSESÄNDERN Sie
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT status from vicidial_campaign_statuses where campaign_id='$campaigns_id_list[$o]' order by status"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if ($p<1) + {echo "NONE";} + echo "MODIFY STATUSES
\n"; +} + + +###################### +# ADD=33 display all campaign hotkeys +###################### +if ($ADD==33) +{ +echo "
\n"; + echo ""; + +echo "
KAMPAGNE HOTKEYS AUFLISTUNGEN:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNNAMEHOTKEYSÄNDERN Sie
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT status from vicidial_campaign_hotkeys where campaign_id='$campaigns_id_list[$o]' order by status"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if ($p<1) + {echo "NONE";} + echo "MODIFY HOTKEYS
\n"; +} + + +###################### +# ADD=35 display all campaign lead recycle entries +###################### +if ($ADD==35) +{ +echo "
\n"; + echo ""; + +echo "
KAMPAGNE LEITUNG BEREITEN AUFLISTUNGEN AUF:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNNAMELEITUNG BEREITET AUFÄNDERN Sie
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT status from vicidial_lead_recycle where campaign_id='$campaigns_id_list[$o]' order by status"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if ($p<1) + {echo "NONE";} + echo "MODIFY LEITUNG BEREITET AUF
\n"; +} + + +###################### +# ADD=36 display all campaign auto-alt dial entries +###################### +if ($ADD==36) +{ +echo "
\n"; + echo ""; + +echo "
KAMPAGNE LEITUNG AUTO-ALT VORWAHLKNOPF-AUFLISTUNGEN:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNNAMEAUTO-ALT DIALÄNDERN Sie
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$campaigns_id_list[$o]';"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if (strlen($row[0])<3) + {echo "NONE";} + echo "MODIFY AUTO-ALT DIAL
\n"; +} + + +###################### +# ADD=37 display all campaign agent pause codes +###################### +if ($ADD==37) +{ +echo "
\n"; + echo ""; + +echo "
KAMPAGNE MITTEL-PAUSE CODE-AUFLISTUNGEN:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNNAMEPAUSE CODESÄNDERN Sie
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT pause_code from vicidial_pause_codes where campaign_id='$campaigns_id_list[$o]' order by pause_code;"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if ($p<1) + {echo "NONE";} + echo "MODIFY PAUSE CODES
\n"; +} + + +###################### +# ADD=39 display all campaign list mixes +###################### +if ($ADD==39) +{ +echo "
\n"; + echo ""; + +echo "
KAMPAGNE LISTE MISCHUNG AUFLISTUNGEN:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNNAMELIST MIXÄNDERN Sie
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT vcl_id from vicidial_campaigns_list_mix where campaign_id='$campaigns_id_list[$o]' order by status,vcl_id;"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if ($p<1) + {echo "NONE";} + echo "MODIFY LIST MIX
\n"; +} + + + + + +###################### +# ADD=311 modify list info in the system +###################### + +if ($ADD==311) +{ + if ($LOGmodify_lists==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $campaign_id = $row[2]; + $active = $row[3]; + $list_description = $row[4]; + $list_changedate = $row[5]; + $list_lastcalldate = $row[6]; + + # grab names of global statuses and statuses in the selected campaign + $stmt="SELECT * from vicidial_statuses order by status"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + + $o=0; + while ($statuses_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $statuses_list["$rowx[0]"] = "$rowx[1]"; + $o++; + } + + $stmt="SELECT * from vicidial_campaign_statuses where campaign_id='$campaign_id' order by status"; + $rslt=mysql_query($stmt, $link); + $Cstatuses_to_print = mysql_num_rows($rslt); + + $o=0; + while ($Cstatuses_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $statuses_list["$rowx[0]"] = "$rowx[1]"; + $o++; + } + # end grab status names + + + echo "
ÄNDERN Sie Einen LISTEN SATZ: $row[0]
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Liste Identifikation: $row[0]$NWB#vicidial_lists-list_id$NWE
Liste Name: $NWB#vicidial_lists-list_name$NWE
Liste Beschreibung: $NWB#vicidial_lists-list_description$NWE
Kampagne: $NWB#vicidial_lists-campaign_id$NWE
Aktiv:$NWB#vicidial_lists-active$NWE
Stellen Sie Führen-Benennen-Status für diese Liste zurück: $NWB#vicidial_lists-reset_list$NWE
Liste Änderung Datum: $list_changedate   $NWB#vicidial_lists-list_changedate$NWE
List Last Call Date: $list_lastcalldate   $NWB#vicidial_lists-list_lastcalldate$NWE
\n"; + + echo "
\n"; + echo "
STATUS INNERHALB DIESER LISTE:
\n"; + echo "\n"; + echo "\n"; + + $leads_in_list = 0; + $leads_in_list_N = 0; + $leads_in_list_Y = 0; + $stmt="SELECT status,called_since_last_reset,count(*) from vicidial_list where list_id='$list_id' group by status,called_since_last_reset order by status,called_since_last_reset"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + + $o=0; + $lead_list['count'] = 0; + $lead_list['Y_count'] = 0; + $lead_list['N_count'] = 0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + + $lead_list['count'] = ($lead_list['count'] + $rowx[2]); + if ($rowx[1] == 'N') + { + $since_reset = 'N'; + $since_resetX = 'Y'; + } + else + { + $since_reset = 'Y'; + $since_resetX = 'N'; + } + $lead_list[$since_reset][$rowx[0]] = ($lead_list[$since_reset][$rowx[0]] + $rowx[2]); + $lead_list[$since_reset.'_count'] = ($lead_list[$since_reset.'_count'] + $rowx[2]); + #If opposite side is not set, it may not in the future so give it a value of zero + if (!isset($lead_list[$since_resetX][$rowx[0]])) + { + $lead_list[$since_resetX][$rowx[0]]=0; + } + $o++; + } + + $o=0; + if ($lead_list['count'] > 0) + { + while (list($dispo,) = each($lead_list[$since_reset])) + { + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + if ($dispo == 'CBHOLD') + { + $CLB=""; + $CLE=""; + } + else + { + $CLB=''; + $CLE=''; + } + + echo "\n"; + $o++; + } + } + + echo "\n"; + echo "\n"; + + echo "
STATUSSTATUS-NAMEBENANNTNICHT BENANNT
$CLB$dispo$CLE$statuses_list[$dispo]".$lead_list['Y'][$dispo]."".$lead_list['N'][$dispo]."
TEILSUMMEN$lead_list[Y_count]$lead_list[N_count]
GESAMTMENGE$lead_list[count]

\n"; + unset($lead_list); + + + echo "
\n"; + echo "
ZEIT-ZONEN INNERHALB DIESER LISTE:
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT gmt_offset_now,called_since_last_reset,count(*) from vicidial_list where list_id='$list_id' group by gmt_offset_now,called_since_last_reset order by gmt_offset_now,called_since_last_reset"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + + $o=0; + $plus='+'; + $lead_list['count'] = 0; + $lead_list['Y_count'] = 0; + $lead_list['N_count'] = 0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + + $lead_list['count'] = ($lead_list['count'] + $rowx[2]); + if ($rowx[1] == 'N') + { + $since_reset = 'N'; + $since_resetX = 'Y'; + } + else + { + $since_reset = 'Y'; + $since_resetX = 'N'; + } + $lead_list[$since_reset][$rowx[0]] = ($lead_list[$since_reset][$rowx[0]] + $rowx[2]); + $lead_list[$since_reset.'_count'] = ($lead_list[$since_reset.'_count'] + $rowx[2]); + #If opposite side is not set, it may not in the future so give it a value of zero + if (!isset($lead_list[$since_resetX][$rowx[0]])) + { + $lead_list[$since_resetX][$rowx[0]]=0; + } + $o++; + } + + if ($lead_list['count'] > 0) + { + while (list($tzone,) = each($lead_list[$since_reset])) + { + $LOCALzone=3600 * $tzone; + $LOCALdate=gmdate("D M Y H:i", time() + $LOCALzone); + + if ($tzone >= 0) {$DISPtzone = "$plus$tzone";} + else {$DISPtzone = "$tzone";} + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + } + + echo "\n"; + echo "\n"; + + echo "
GMT VERSETZTE JETZT (lokale Zeit)BENANNTNICHT BENANNT
".$DISPtzone."     ($LOCALdate)".$lead_list['Y'][$tzone]."".$lead_list['N'][$tzone]."
TEILSUMMEN$lead_list[Y_count]$lead_list[N_count]
GESAMTMENGE$lead_list[count]

\n"; + unset($lead_list); + + + + $leads_in_list = 0; + $leads_in_list_N = 0; + $leads_in_list_Y = 0; + $stmt="SELECT status,called_count,count(*) from vicidial_list where list_id='$list_id' group by status,called_count order by status,called_count"; + $rslt=mysql_query($stmt, $link); + $status_called_to_print = mysql_num_rows($rslt); + + $o=0; + $sts=0; + $first_row=1; + $all_called_first=1000; + $all_called_last=0; + while ($status_called_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $leads_in_list = ($leads_in_list + $rowx[2]); + $count_statuses[$o] = "$rowx[0]"; + $count_called[$o] = "$rowx[1]"; + $count_count[$o] = "$rowx[2]"; + $all_called_count[$rowx[1]] = ($all_called_count[$rowx[1]] + $rowx[2]); + + if ( (strlen($status[$sts]) < 1) or ($status[$sts] != "$rowx[0]") ) + { + if ($first_row) {$first_row=0;} + else {$sts++;} + $status[$sts] = "$rowx[0]"; + $status_called_first[$sts] = "$rowx[1]"; + if ($status_called_first[$sts] < $all_called_first) {$all_called_first = $status_called_first[$sts];} + } + $leads_in_sts[$sts] = ($leads_in_sts[$sts] + $rowx[2]); + $status_called_last[$sts] = "$rowx[1]"; + if ($status_called_last[$sts] > $all_called_last) {$all_called_last = $status_called_last[$sts];} + + $o++; + } + + + + + echo "
\n"; + echo "
BENANNTE ZÄHLIMPULSE INNERHALB DIESER LISTE:
\n"; + echo "\n"; + echo ""; + $first = $all_called_first; + while ($first <= $all_called_last) + { + if (eregi("1$|3$|5$|7$|9$", $first)) {$AB='bgcolor="#AFEEEE"';} + else{$AB='bgcolor="#E0FFFF"';} + echo ""; + $first++; + } + echo "\n"; + + $sts=0; + $statuses_called_to_print = count($status); + while ($statuses_called_to_print > $sts) + { + $Pstatus = $status[$sts]; + if (eregi("1$|3$|5$|7$|9$", $sts)) + {$bgcolor='bgcolor="#B9CBFD"'; $AB='bgcolor="#9BB9FB"';} + else + {$bgcolor='bgcolor="#9BB9FB"'; $AB='bgcolor="#B9CBFD"';} + # echo "$status[$sts]|$status_called_first[$sts]|$status_called_last[$sts]|$leads_in_sts[$sts]|\n"; + # echo "$status[$sts]|"; + echo ""; + + $first = $all_called_first; + while ($first <= $all_called_last) + { + if (eregi("1$|3$|5$|7$|9$", $sts)) + { + if (eregi("1$|3$|5$|7$|9$", $first)) {$AB='bgcolor="#9BB9FB"';} + else{$AB='bgcolor="#B9CBFD"';} + } + else + { + if (eregi("0$|2$|4$|6$|8$", $first)) {$AB='bgcolor="#9BB9FB"';} + else{$AB='bgcolor="#B9CBFD"';} + } + + $called_printed=0; + $o=0; + while ($status_called_to_print > $o) + { + if ( ($count_statuses[$o] == "$Pstatus") and ($count_called[$o] == "$first") ) + { + $called_printed++; + echo ""; + } + + + $o++; + } + if (!$called_printed) + {echo "";} + $first++; + } + echo "\n\n"; + + $sts++; + } + + echo ""; + $first = $all_called_first; + while ($first <= $all_called_last) + { + if (eregi("1$|3$|5$|7$|9$", $first)) {$AB='bgcolor="#AFEEEE"';} + else{$AB='bgcolor="#E0FFFF"';} + echo ""; + $first++; + } + echo "\n"; + + echo "
STATUSSTATUS-NAME$firstTEILSUMME
$Pstatus$statuses_list[$Pstatus] $count_count[$o]  $leads_in_sts[$sts]
GESAMTMENGE$all_called_count[$first]$leads_in_list

\n"; + + + + + + echo "
\n"; + + echo "

Click here to see all CallBack Holds in this list

\n"; + + if ($LOGdelete_lists > 0) + { + echo "

LÖSCHEN SIE DIESE LISTE\n"; + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + + +###################### +# ADD=3111 modify in-group info in the system +###################### + +if ($ADD==3111) +{ + if ($LOGmodify_ingroups==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_inbound_groups where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $group_name = $row[1]; + $group_color = $row[2]; + $active = $row[3]; + $web_form_address = $row[4]; + $voicemail_ext = $row[5]; + $next_agent_call = $row[6]; + $fronter_display = $row[7]; + $script_id = $row[8]; + $get_call_launch = $row[9]; + $xferconf_a_dtmf = $row[10]; + $xferconf_a_number = $row[11]; + $xferconf_b_dtmf = $row[12]; + $xferconf_b_number = $row[13]; + $drop_call_seconds = $row[14]; + $drop_message = $row[15]; + $drop_exten = $row[16]; + $call_time_id = $row[17]; + $after_hours_action = $row[18]; + $after_hours_message_filename = $row[19]; + $after_hours_exten = $row[20]; + $after_hours_voicemail = $row[21]; + $welcome_message_filename = $row[22]; + $moh_context = $row[23]; + $onhold_prompt_filename = $row[24]; + $prompt_interval = $row[25]; + $agent_alert_exten = $row[26]; + $agent_alert_delay = $row[27]; + $default_xfer_group = $row[28]; + + ##### get in-groups listings for dynamic pulldown + $stmt="SELECT group_id,group_name from vicidial_inbound_groups order by group_id"; + $rslt=mysql_query($stmt, $link); + $Xgroups_to_print = mysql_num_rows($rslt); + $Xgroups_menu=''; + $Xgroups_selected=0; + $o=0; + while ($Xgroups_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $Xgroups_menu .= "\n"; + $o++; + } + if ($Xgroups_selected < 1) + {$Xgroups_menu .= "\n";} + else + {$Xgroups_menu .= "\n";} + + + echo "
ÄNDERN Sie Einen GRUPPEN SATZ: $row[0]\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + echo "
Gruppe Identifikation: $row[0]$NWB#vicidial_inbound_groups-group_id$NWE
Gruppe Name: $NWB#vicidial_inbound_groups-group_name$NWE
Gruppe Farbe: $NWB#vicidial_inbound_groups-group_color$NWE
Aktiv:$NWB#vicidial_inbound_groups-active$NWE
Netz-Form: $NWB#vicidial_inbound_groups-web_form_address$NWE
Folgender Vertreter-Anruf: $NWB#vicidial_inbound_groups-next_agent_call$NWE
Fronter Anzeige: $NWB#vicidial_inbound_groups-fronter_display$NWE
Script: $NWB#vicidial_inbound_groups-ingroup_script$NWE
Erhalten Sie Anruf-Produkteinführung: $NWB#vicidial_inbound_groups-get_call_launch$NWE
BringenSie DTMF 1: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
BringenSie Zahl 1: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
BringenSie DTMF 2: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
BringenSie Zahl 2: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
Verbindungsaufbau Sekunden: $NWB#vicidial_inbound_groups-drop_call_seconds$NWE
Voicemail: $NWB#vicidial_inbound_groups-voicemail_ext$NWE
Benutze Verbindungsaufbaunachricht: $NWB#vicidial_inbound_groups-drop_message$NWE
Verbindungsaufbaunebenstelle: $NWB#vicidial_inbound_groups-drop_exten$NWE
Anruf-Zeit:$NWB#vicidial_inbound_groups-call_time_id$NWE
Nach Stunden Tätigkeit:$NWB#vicidial_inbound_groups-after_hours_action$NWE
Nach Stunden Anzeige Dateinamen:$NWB#vicidial_inbound_groups-after_hours_message_filename$NWE
Nach Stunden Verlängerung:$NWB#vicidial_inbound_groups-after_hours_exten$NWE
Nach Stunden Voicemail:$NWB#vicidial_inbound_groups-after_hours_voicemail$NWE
Willkommener Anzeige Dateiname:$NWB#vicidial_inbound_groups-welcome_message_filename$NWE
Musik Auf Einfluß-Kontext:$NWB#vicidial_inbound_groups-moh_context$NWE
Auf Einfluß-Aufforderung Dateinamen:$NWB#vicidial_inbound_groups-onhold_prompt_filename$NWE
Auf Einfluß-Aufforderung Abstand:$NWB#vicidial_inbound_groups-prompt_interval$NWE
Mittel-Alarmverlängerung:$NWB#vicidial_inbound_groups-agent_alert_exten$NWE
Mittel-Alarm Verzögert:$NWB#vicidial_inbound_groups-agent_alert_delay$NWE
Rückstellung Übergangsgruppe:$NWB#vicidial_inbound_groups-default_xfer_group$NWE
\n"; + + ### list of agent rank or skill-level for this inbound group + echo "
\n"; + echo "
MITTELRANKS FOR THIS INBOUND GROUP:
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT user,group_rank,calls_today from vicidial_inbound_group_agents where group_id='$group_id'"; + $rsltx=mysql_query($stmt, $link); + $users_to_print = mysql_num_rows($rsltx); + + $o=0; + while ($users_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + + echo "
USER     RANK     CALLS TODAY
$rowx[0]$rowx[1]$rowx[2]

\n"; + + echo "

\n"; + + echo "Click here to see a report for this inbound group

\n"; + + echo "
\n"; + + if ($LOGdelete_ingroups > 0) + { + echo "

EMERGENCY VDAC CLEAR FOR THIS IN-GROUP

\n"; + echo "

LÖSCHEN SIE DIESES IN-GROUP\n"; + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + + +###################### +# ADD=31111 modify remote agents info in the system +###################### + +if ($ADD==31111) +{ + if ($LOGmodify_remoteagents==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + + echo "
ÄNDERN Sie Eine REMOTEMITTEL-EINTRAGUNG: $row[0]\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Benutzernummer Anfang: (nur Zahlen, incremented)$NWB#vicidial_remote_agents-user_start$NWE
Zeilenzahl: (nur Zahlen)$NWB#vicidial_remote_agents-number_of_lines$NWE
Bediener IP: $NWB#vicidial_remote_agents-server_ip$NWE
Externe Verlängerung: (dial plan Zahl wählte, um Mittel zu erreichen)$NWB#vicidial_remote_agents-conf_exten$NWE
Status:$NWB#vicidial_remote_agents-status$NWE
Kampagne: $NWB#vicidial_remote_agents-campaign_id$NWE
Inbound Gruppen: \n"; + echo "$groups_list"; + echo "$NWB#vicidial_remote_agents-closer_campaigns$NWE
\n"; + echo "ANMERKUNG: Sie kann bis 30 Sekunden für die Änderungen dauern, dieauf diesem Schirm eingereicht werden, um Phasen zu gehen\n"; + + + if ($LOGdelete_remote_agents > 0) + { + echo "

LÖSCHEN SIE DIESES REMOTEMITTEL\n"; + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + +###################### +# ADD=311111 modify user group info in the system +###################### + +if ($ADD==311111) +{ + if ($LOGmodify_usergroups==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_user_groups where user_group='$user_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $user_group = $row[0]; + $group_name = $row[1]; + echo ""; + + echo "
ÄNDERN Sie Eine BENUTZER-GRUPPE EINTRAGUNG\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Gruppe: (keine Räume oder Interpunktion)$NWB#vicidial_user_groups-user_group$NWE
Beschreibung: (Beschreibung der Gruppe)$NWB#vicidial_user_groups-group_name$NWE
Erlaubte Kampagnen: \n"; + echo "$campaigns_list"; + echo "$NWB#vicidial_user_groups-allowed_campaigns$NWE
\n"; + + + ### list of users in this user group + + $active_confs = 0; + $stmt="SELECT user,full_name,user_level from vicidial_users where user_group='$user_group'"; + $rsltx=mysql_query($stmt, $link); + $users_to_print = mysql_num_rows($rsltx); + + echo "
\n"; + echo "
BENUTZER INNERHALB DIESER BENUTZER-GRUPPE: $users_to_print
\n"; + echo "\n"; + echo "\n"; + + $o=0; + while ($users_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
USERFULL NAMELEVEL
$rowx[0]$rowx[1]$rowx[2]

\n"; + + + + echo "

Click here to see all CallBack Holds in this user group

\n"; + + if ($LOGdelete_user_groups > 0) + { + echo "

LÖSCHEN SIE DIESE BENUTZER-GRUPPE\n"; + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + +###################### +# ADD=3111111 modify script info in the system +###################### + +if ($ADD==3111111) +{ + if ($LOGmodify_scripts==1) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_scripts where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $script_name = $row[1]; + $script_comments = $row[2]; + $script_text = $row[3]; + $active = $row[4]; + echo ""; + + echo "
ÄNDERN Sie Einen INDEX\n"; + echo "\n"; + echo "\n"; + echo "
Index Identifikation: $script_id$NWB#vicidial_scripts-script_name$NWE
Index-Name: (Titel dem Index)$NWB#vicidial_scripts-script_name$NWE
Index-Anmerkungen: $NWB#vicidial_scripts-script_comments$NWE
Aktiv:$NWB#vicidial_scripts-active$NWE
Index-Text:

Vorbetrachtung-Index
"; + # BEGIN Insert Field + echo ""; + echo "
"; + # END Insert Field + echo " $NWB#vicidial_scripts-script_text$NWE
\n"; + + if ($LOGdelete_scripts > 0) + { + echo "

LÖSCHEN SIE DIESEN INDEX\n"; + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + +###################### +# ADD=31111111 modify filter info in the system +###################### + +if ($ADD==31111111) +{ + if ($LOGmodify_filters==1) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_lead_filters where lead_filter_id='$lead_filter_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $lead_filter_name = $row[1]; + $lead_filter_comments = $row[2]; + $lead_filter_sql = $row[3]; + echo ""; + + echo "
ÄNDERN Sie Einen FILTER\n"; + echo "\n"; + echo "\n"; + echo "
Filter Identifikation:$lead_filter_id$NWB#vicidial_lead_filters-lead_filter_id$NWE
Filter-Name: (kurze Beschreibung des Filter)$NWB#vicidial_lead_filters-lead_filter_name$NWE
Filter-Anmerkungen: $NWB#vicidial_lead_filters-lead_filter_comments$NWE
Filter Sql: $NWB#vicidial_lead_filters-lead_filter_sql$NWE
\n"; + + ##### get campaigns listing for dynamic pulldown + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + $campaigns_list=''; + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $campaigns_list .= "\n"; + $o++; + } + + echo "

"; + echo "
Testen der Kampagne:
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + if ($LOGdelete_filters > 0) + { + echo "

LÖSCHEN SIE DIESEN FILTER\n"; + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + +###################### +# ADD=321111111 modify call time definition info in the system +###################### + +if ($ADD==321111111) +{ +if ($LOGmodify_call_times==1) +{ + +if ( ($stage=="ADD") and (strlen($state_rule)>0) ) + { + $stmt="SELECT ct_state_call_times from vicidial_call_times where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $ct_state_call_times = $row[0]; + + if (eregi("\|$",$ct_state_call_times)) + {$ct_state_call_times = "$ct_state_call_times$state_rule\|";} + else + {$ct_state_call_times = "$ct_state_call_times\|$state_rule\|";} + $stmt="UPDATE vicidial_call_times set ct_state_call_times='$ct_state_call_times' where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + echo "Landesrichtlinie hinzugefügt: $state_rule
\n"; + } +if ( ($stage=="REMOVE") and (strlen($state_rule)>0) ) + { + $stmt="SELECT ct_state_call_times from vicidial_call_times where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $ct_state_call_times = $row[0]; + + $ct_state_call_times = eregi_replace("\|$state_rule\|",'|',$ct_state_call_times); + $stmt="UPDATE vicidial_call_times set ct_state_call_times='$ct_state_call_times' where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + echo "Landesrichlinie gelöscht: $state_rule
\n"; + } + +$ADD=311111111; +} +else +{ +echo "Sie haben nicht die Rechte, um diese Seite anzusehen. Bitte zurück gehen."; +} + +} + + +###################### +# ADD=311111111 modify call time definition info in the system +###################### + +if ($ADD==311111111) +{ + +if ($LOGmodify_call_times==1) +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +$ct_srs=1; +$b=0; +$srs_SQL =''; +if (strlen($ct_state_call_times)>2) + { + $state_rules = explode('|',$ct_state_call_times); + $ct_srs = ((count($state_rules)) - 1); + } +echo "\n"; +echo "\n"; +while($ct_srs >= $b) + { + if (strlen($state_rules[$b])>0) + { + $stmt="SELECT state_call_time_state,state_call_time_name from vicidial_state_call_times where state_call_time_id='$state_rules[$b]';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + echo "\n"; + $srs_SQL .= "'$state_rules[$b]',"; + $srs_state_SQL .= "'$row[0]',"; + } + $b++; + } +if (strlen($srs_SQL)>2) + { + $srs_SQL = "$srs_SQL''"; + $srs_state_SQL = "$srs_state_SQL''"; + $srs_SQL = "where state_call_time_id NOT IN($srs_SQL) and state_call_time_state NOT IN($srs_state_SQL)"; + } +else + {$srs_SQL='';} +$stmt="SELECT state_call_time_id,state_call_time_name from vicidial_state_call_times $srs_SQL order by state_call_time_id;"; +$rslt=mysql_query($stmt, $link); +$sct_to_print = mysql_num_rows($rslt); +$sct_list=''; + +$o=0; +while ($sct_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $sct_list .= "\n"; + $o++; +} +echo "\n"; +echo "\n"; + +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_call_times where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $call_time_name = $row[1]; + $call_time_comments = $row[2]; + $ct_default_start = $row[3]; + $ct_default_stop = $row[4]; + $ct_sunday_start = $row[5]; + $ct_sunday_stop = $row[6]; + $ct_monday_start = $row[7]; + $ct_monday_stop = $row[8]; + $ct_tuesday_start = $row[9]; + $ct_tuesday_stop = $row[10]; + $ct_wednesday_start = $row[11]; + $ct_wednesday_stop = $row[12]; + $ct_thursday_start = $row[13]; + $ct_thursday_stop = $row[14]; + $ct_friday_start = $row[15]; + $ct_friday_stop = $row[16]; + $ct_saturday_start = $row[17]; + $ct_saturday_stop = $row[18]; + $ct_state_call_times = $row[19]; + +echo ""; + +echo "
Bearbeite eine Anrufzeit\n"; +echo "\n"; +echo "\n"; +echo "
Anrufzeit ID: $call_time_id$NWB#vicidial_call_times-call_time_id$NWE
Anrufzeit Name: (Kurze Beschreibung der Anrufzeit)$NWB#vicidial_call_times-call_time_name$NWE
Anrufzeit Kommentare: $NWB#vicidial_call_times-call_time_comments$NWE
Standard Start Standard Stop $NWB#vicidial_call_times-ct_default_start$NWE
Sonntag Start Sonntag Stop $NWB#vicidial_call_times-ct_sunday_start$NWE
Montag Start Montag Stop $NWB#vicidial_call_times-ct_sunday_start$NWE
Dienstag Start Dienstag Stop $NWB#vicidial_call_times-ct_sunday_start$NWE
Mittwoch Start Mittwoch Stop $NWB#vicidial_call_times-ct_sunday_start$NWE
Donnerstag Start Donnerstag Stop $NWB#vicidial_call_times-ct_sunday_start$NWE
Freitag Start Freitag Stop $NWB#vicidial_call_times-ct_sunday_start$NWE
Sonnabend Start Sonnabend Stop $NWB#vicidial_call_times-ct_sunday_start$NWE
Aktive landesspezifische Anrufzeit Definitionen für diese Aufnahme:  
$state_rules[$b] - REMOVE $row[0] - $row[1]
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "Add state call time rule:


\n"; +echo "Kampagnen, die diese Anrufzeit nutzen:
\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns where local_call_time='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + $o=0; + while ($camps_to_print > $o) { + $row=mysql_fetch_row($rslt); + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]
\n"; +echo "INBOUND GROUPS USING THIS CALL TIME:
\n"; +echo "\n"; + + $stmt="SELECT group_id,group_name from vicidial_inbound_groups where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + $o=0; + while ($camps_to_print > $o) { + $row=mysql_fetch_row($rslt); + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]
\n"; +echo "

\n"; + +if ($LOGdelete_call_times > 0) + { + echo "

Lösche diese Anrufzeit Definition\n"; + } +} +else +{ +echo "Sie haben nicht die Rechte, um diese Seite anzusehen. Bitte zurück gehen."; +} + +} + + +###################### +# ADD=3111111111 modify state call time definition info in the system +###################### + +if ($ADD==3111111111) +{ + +if ($LOGmodify_call_times==1) +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_state_call_times where state_call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $state_call_time_state =$row[1]; + $call_time_name = $row[2]; + $call_time_comments = $row[3]; + $ct_default_start = $row[4]; + $ct_default_stop = $row[5]; + $ct_sunday_start = $row[6]; + $ct_sunday_stop = $row[7]; + $ct_monday_start = $row[8]; + $ct_monday_stop = $row[9]; + $ct_tuesday_start = $row[10]; + $ct_tuesday_stop = $row[11]; + $ct_wednesday_start = $row[12]; + $ct_wednesday_stop = $row[13]; + $ct_thursday_start = $row[14]; + $ct_thursday_stop = $row[15]; + $ct_friday_start = $row[16]; + $ct_friday_stop = $row[17]; + $ct_saturday_start = $row[18]; + $ct_saturday_stop = $row[19]; + +echo ""; + +echo "
Bearbeite eine landesspezifische Anrufzeit
\n"; +echo "\n"; +echo "\n"; +echo "
Anrufzeit ID: $call_time_id$NWB#vicidial_call_times-call_time_id$NWE
State Call Time State: $NWB#vicidial_call_times-state_call_time_state$NWE
Landesspezifischer Anrufzeiten Name: (Kurze Beschreibung der Anrufzeit)$NWB#vicidial_call_times-call_time_name$NWE
Landesspezifischer Anrufzeiten Kommentar: $NWB#vicidial_call_times-call_time_comments$NWE
Standard Start Standard Stop $NWB#vicidial_call_times-ct_default_start$NWE
Sonntag Start Sonntag Stop $NWB#vicidial_call_times-ct_sunday_start$NWE
Montag Start Montag Stop $NWB#vicidial_call_times-ct_sunday_start$NWE
Dienstag Start Dienstag Stop $NWB#vicidial_call_times-ct_sunday_start$NWE
Mittwoch Start Mittwoch Stop $NWB#vicidial_call_times-ct_sunday_start$NWE
Donnerstag Start Donnerstag Stop $NWB#vicidial_call_times-ct_sunday_start$NWE
Freitag Start Freitag Stop $NWB#vicidial_call_times-ct_sunday_start$NWE
Sonnabend Start Sonnabend Stop $NWB#vicidial_call_times-ct_sunday_start$NWE


\n"; +echo "Anrufzeiten, die diese landesspezifische Anrufzeit benutzen:
\n"; +echo "\n"; + + $stmt="SELECT call_time_id,call_time_name from vicidial_call_times where ct_state_call_times LIKE \"%|$call_time_id|%\";"; + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + $o=0; + while ($camps_to_print > $o) { + $row=mysql_fetch_row($rslt); + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]
\n"; +echo "

\n"; + +if ($LOGdelete_call_times > 0) + { + echo "

Diese landesspezifische Anrufzeitdefinition löschen\n"; + } + +} +else +{ +echo "Sie haben nicht die Rechte, um diese Seite anzusehen. Bitte zurück gehen."; +} + +} + + +###################### +# ADD=31111111111 modify phone record in the system +###################### + +if ($ADD==31111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + echo "
ÄNDERN Sie Einen TELEFON-SATZ: $row[1]\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Telefonverlängerung: $NWB#phones-extension$NWE
Dial Plan Zahl: (nur Stellen)$NWB#phones-dialplan_number$NWE
Voicemail Kasten: (nur Stellen)$NWB#phones-voicemail_id$NWE
Outbound CallerID: (nur Stellen)$NWB#phones-outbound_cid$NWE
Telefon-IP address: (optional)$NWB#phones-phone_ip$NWE
Computer-IP address: (optional)$NWB#phones-computer_ip$NWE
Bediener IP: $NWB#phones-server_ip$NWE
Login: $NWB#phones-login$NWE
Kennwort:$NWB#phones-pass$NWE
Status:$NWB#phones-status$NWE
Aktives Konto: $NWB#phones-active$NWE
Telefon-Art: $NWB#phones-phone_type$NWE
Voller Name: $NWB#phones-fullname$NWE
Firma:$NWB#phones-company$NWE
Abbildung:$NWB#phones-picture$NWE
Neue Anzeigen: $row[14]$NWB#phones-messages$NWE
Alte Anzeigen: $row[15]$NWB#phones-old_messages$NWE
Klient Protokoll: $NWB#phones-protocol$NWE
Lokales GMT: (Stellen Sie NICHT auf DST ein)$NWB#phones-local_gmt$NWE
Manager-LOGON: $NWB#phones-ASTmgrUSERNAME$NWE
Manager-Geheimnis: $NWB#phones-ASTmgrSECRET$NWE
VICIDIAL Rückstellung Benutzer: $NWB#phones-login_user$NWE
VICIDIAL Rückstellung Durchlauf: $NWB#phones-login_pass$NWE
VICIDIAL Rückstellung Kampagne: $NWB#phones-login_campaign$NWE
Park Exten: $NWB#phones-park_on_extension$NWE
Conf Exten: $NWB#phones-conf_on_extension$NWE
VICIDIAL Park Exten: $NWB#phones-VICIDIAL_park_on_extension$NWE
VICIDIAL Park-Akte: $NWB#phones-VICIDIAL_park_on_filename$NWE
Überwachen Sie Präfix: $NWB#phones-monitor_prefix$NWE
Aufnahme Exten: $NWB#phones-recording_exten$NWE
VMailMain Exten: $NWB#phones-voicemail_exten$NWE
VMailDump Exten: $NWB#phones-voicemail_dump_exten$NWE
Exten Kontext: $NWB#phones-ext_context$NWE
DTMFSend Führung: $NWB#phones-dtmf_send_extension$NWE
Outbound Anruf-Gruppe: $NWB#phones-call_out_number_group$NWE
Datenbanksuchroutine-Position: $NWB#phones-client_browser$NWE
Bringen Sie Verzeichnis An: $NWB#phones-install_directory$NWE
CallerID URL: $NWB#phones-local_web_callerID_URL$NWE
VICIDIAL Rückstellung URL: $NWB#phones-VICIDIAL_web_URL$NWE
Anruf-Protokollierung: $NWB#phones-AGI_call_logging_enabled$NWE
Benutzer-Schaltung: $NWB#phones-user_switching_enabled$NWE
Conferencing: $NWB#phones-conferencing_enabled$NWE
Admin Hängezustand: $NWB#phones-admin_hangup_enabled$NWE
Admin Straßenräuber: $NWB#phones-admin_hijack_enabled$NWE
Admin Monitor: $NWB#phones-admin_monitor_enabled$NWE
Parkschaltung: $NWB#phones-call_parking_enabled$NWE
Updater Überprüfung: $NWB#phones-updater_check_enabled$NWE
Af Protokollierung: $NWB#phones-AFLogging_enabled$NWE
Warteschlange Ermöglicht: $NWB#phones-QUEUE_ACTION_enabled$NWE
CallerID Popup: $NWB#phones-CallerID_popup_enabled$NWE
VMail Taste: $NWB#phones-voicemail_button_enabled$NWE
Schnell Erneuern Sie: $NWB#phones-enable_fast_refresh$NWE
Schnell Erneuern Sie Rate: (in ms)$NWB#phones-fast_refresh_rate$NWE
Persistant MySQL: $NWB#phones-enable_persistant_mysql$NWE
Selbstvorwahlknopf-Folgende Zahl: $NWB#phones-auto_dial_next_number$NWE
Stoppen Sie Rec nach jedem Anruf: $NWB#phones-VDstop_rec_after_each_call$NWE
Ermöglichen Sie SIPSAK Anzeigen: $NWB#phones-enable_sipsak_messages$NWE
DBX Bediener: (HauptsächlichDB Server)$NWB#phones-DBX_server$NWE
DBX Datenbank: (HauptsächlichServer Database)$NWB#phones-DBX_database$NWE
DBX Benutzer: (HauptsächlichDB Login)$NWB#phones-DBX_user$NWE
DBX Durchlauf: (HauptsächlichDB Secret)$NWB#phones-DBX_pass$NWE
DBX Tor: (HauptsächlichDB Port)$NWB#phones-DBX_port$NWE
DBY Bediener: (ZweitensDB Server)$NWB#phones-DBY_server$NWE
DBY Datenbank: (ZweitensServer Database)$NWB#phones-DBY_database$NWE
DBY Benutzer: (ZweitensDB Login)$NWB#phones-DBY_user$NWE
DBY Durchlauf: (ZweitensDB Secret)$NWB#phones-DBY_pass$NWE
DBY Tor: (ZweitensDB Port)$NWB#phones-DBY_port$NWE
\n"; + + echo "

Klicken Sie hier für Telefonnotfall\n"; + + if ($LOGast_delete_phones > 0) + { + echo "

LÖSCHEN SIE DIESES TELEFON\n"; + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + +###################### +# ADD=311111111111 modify server record in the system +###################### + +if ($ADD==311111111111) +{ + if ($LOGmodify_servers==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from servers where server_id='$server_id' or server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $server_id = $row[0]; + $server_ip = $row[2]; + + echo "
ÄNDERN Sie Einen BEDIENER-SATZ: $row[0]\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Bediener Identifikation: $NWB#servers-server_id$NWE
Bediener-Beschreibung: $NWB#servers-server_description$NWE
Bediener-IP address: $NWB#servers-server_ip$NWE
Aktiv:$NWB#servers-active$NWE
Sternchen-Version: $NWB#servers-asterisk_version$NWE
Maximale VICIDIAL Stämme: $NWB#servers-max_vicidial_trunks$NWE
VICIDIAL Balance Wählen: $NWB#servers-vicidial_balance_active$NWE
VICIDIAL Balance Offlimits: $NWB#servers-balance_trunks_offlimits$NWE
Telnet Wirt: $NWB#servers-telnet_host$NWE
Telnet Tor: $NWB#servers-telnet_port$NWE
Manager-Benutzer: $NWB#servers-ASTmgrUSERNAME$NWE
Manager-Geheimnis: $NWB#servers-ASTmgrSECRET$NWE
Manager-Update-Benutzer: $NWB#servers-ASTmgrUSERNAMEupdate$NWE
Manager Hören Benutzer: $NWB#servers-ASTmgrUSERNAMElisten$NWE
Manager Senden Benutzer: $NWB#servers-ASTmgrUSERNAMEsend$NWE
Lokales GMT: (Stellen Sie NICHT auf DST ein)$NWB#servers-local_gmt$NWE
VMail Dump Exten: $NWB#servers-voicemail_dump_exten$NWE
VICIDIAL ANZEIGE Verlängerung: $NWB#servers-answer_transfer_agent$NWE
Rückstellung Kontext: $NWB#servers-ext_context$NWE
System Leistung: $NWB#servers-sys_perf_log$NWE
Bediener-Maschinenbordbücher: $NWB#servers-vd_server_logs$NWE
AGI Ausgang: $NWB#servers-agi_output$NWE
\n"; + + + ### vicidial server trunk records for this server + echo "

VICIDIAL STÄMME FÜR DIESEN BEDIENER:   $NWB#vicidial_server_trunks$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_server_trunks where server_ip='$server_ip' order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $recycle_to_print = mysql_num_rows($rslt); + $o=0; + while ($recycle_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
KAMPAGNE STÄMME BESCHRÄNKUNG DELETE
$rowx[1]
\n"; + echo "\n"; + echo "\n"; + echo "
LÖSCHUNG
\n"; + + echo "
ADDIEREN SIE NEUEN STAMM-SATZ DES BEDIENER-VICIDIAL
\n"; + echo "\n"; + echo "\n"; + echo "TRUNKS:
\n"; + echo "KAMPAGNE:
\n"; + echo "RESTRICTION:
\n"; + echo "
\n"; + + echo "

\n"; + + + ### list of phones on this server + echo "
\n"; + echo "
TELEFONE INNERHALB DIESES BEDIENERS:
\n"; + echo "\n"; + echo "\n"; + + $active_phones = 0; + $inactive_phones = 0; + $stmt="SELECT extension,active,fullname from phones where server_ip='$row[2]'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + if (ereg("Y", $rowx[1])) {$active_phones++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_phones++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + + echo "
VERLÄNGERUNGNAMEAKTIV
$rowx[0]$rowx[2]$rowx[1]

\n"; + + + ### list of conferences on this server + echo "
\n"; + echo "
CONFERENCES WITHIN THIS SERVER:
\n"; + echo "\n"; + echo "\n"; + + $active_confs = 0; + $stmt="SELECT conf_exten,extension from conferences where server_ip='$row[2]'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + $active_confs++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + + echo "
CONFERENCEVERLÄNGERUNG
$rowx[0]$rowx[2]

\n"; + + + ### list of vicidial conferences on this server + echo "
\n"; + echo "
VICIDIAL CONFERENCES WITHIN THIS SERVER:
\n"; + echo "\n"; + echo "\n"; + + $active_vdconfs = 0; + $stmt="SELECT conf_exten,extension from vicidial_conferences where server_ip='$row[2]'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + $active_vdconfs++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + + echo "
VD CONFERENCEVERLÄNGERUNG
$rowx[0]$rowx[2]

\n"; + + + echo "
\n"; + + $camp_lists = eregi_replace(".$","",$camp_lists); + echo "Dieser Bediener hat $active_phones aktive Telefone und $inactive_phones unaktivierte Telefone

\n"; + echo "Dieser Bediener hat $active_confs active conferences

\n"; + echo "Dieser Bediener hat $active_vdconfs active vicidial conferences

\n"; + echo "
\n"; + if ($LOGast_delete_phones > 0) + { + echo "

DELETE THIS SERVER\n"; + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + +###################### +# ADD=3111111111111 modify conference record in the system +###################### + +if ($ADD==3111111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $conf_exten = $row[0]; + $server_ip = $row[1]; + + echo "
ÄNDERN Sie Einen KONFERENZ-SATZ: $row[0]
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Konferenz:$NWB#conferences-conf_exten$NWE
Bediener IP: $NWB#conferences-server_ip$NWE
Gegenwärtige Verlängerung:
\n"; + + echo "
\n"; + if ($LOGast_delete_phones > 0) + { + echo "

DELETE THIS CONFERENCE\n"; + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + +###################### +# ADD=31111111111111 modify vicidial conference record in the system +###################### + +if ($ADD==31111111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $conf_exten = $row[0]; + $server_ip = $row[1]; + + echo "
MODIFY A VICIDIAL CONFERENCE RECORD: $row[0]\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Konferenz:$NWB#conferences-conf_exten$NWE
Bediener IP: $NWB#conferences-server_ip$NWE
Gegenwärtige Verlängerung:
\n"; + + echo "
\n"; + if ($LOGast_delete_phones > 0) + { + echo "

DELETE THIS VICIDIAL CONFERENCE\n"; + } + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + + +###################### +# ADD=311111111111111 modify vicidial system settings +###################### + +if ($ADD==311111111111111) +{ + if ($LOGmodify_servers==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT version,install_date,use_non_latin,webroot_writable,enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_url,queuemetrics_log_id,queuemetrics_eq_prepend,vicidial_agent_disable,allow_sipsak_messages,admin_home_url,enable_agc_xfer_log from system_settings;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $version = $row[0]; + $install_date = $row[1]; + $use_non_latin = $row[2]; + $webroot_writable = $row[3]; + $enable_queuemetrics_logging = $row[4]; + $queuemetrics_server_ip = $row[5]; + $queuemetrics_dbname = $row[6]; + $queuemetrics_login = $row[7]; + $queuemetrics_pass = $row[8]; + $queuemetrics_url = $row[9]; + $queuemetrics_log_id = $row[10]; + $queuemetrics_eq_prepend = $row[11]; + $vicidial_agent_disable = $row[12]; + $allow_sipsak_messages = $row[13]; + $admin_home_url = $row[14]; + $enable_agc_xfer_log = $row[15]; + + echo "
ÄNDERN SIE VICIDIAL SYSTEM EINSTELLUNGEN\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + echo "\n"; + echo "
Version: $version
Install Date: $install_date
Gebrauch Nicht-Lateinisch: $NWB#settings-use_non_latin$NWE
Webroot Schreibbar: $NWB#settings-webroot_writable$NWE
Ermöglichen Sie Der QueueMetrics Protokollierung: $NWB#settings-enable_queuemetrics_logging$NWE
QueueMetrics Bediener IP: $NWB#settings-queuemetrics_server_ip$NWE
QueueMetrics DB Name: $NWB#settings-queuemetrics_dbname$NWE
QueueMetrics DB LOGON: $NWB#settings-queuemetrics_login$NWE
QueueMetrics DB Kennwort: $NWB#settings-queuemetrics_pass$NWE
QueueMetrics URL: $NWB#settings-queuemetrics_url$NWE
QueueMetrics Maschinenbordbuch Identifikation:$NWB#settings-queuemetrics_log_id$NWE
QueueMetrics EnterQueue Stellen Voran: $NWB#settings-queuemetrics_eq_prepend$NWE
VICIDIAL Mittel Sperren Anzeige: $NWB#settings-vicidial_agent_disable$NWE
Erlauben Sie SIPSAK Anzeigen: $NWB#settings-allow_sipsak_messages$NWE
Admin Haupt-URL: $NWB#settings-admin_home_url$NWE
Ermöglichen Sie Vertreter-Übergangsprotokolldatei: $NWB#settings-enable_agc_xfer_log$NWE
\n"; + echo "\n"; + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + + + + + +###################### +# ADD=321111111111111 modify vicidial system statuses +###################### + +if ($ADD==321111111111111) +{ + if ($LOGmodify_servers==1) + { + echo "
\n"; + echo ""; + + echo "
\n"; + echo "VICIDIAL STATUS INNERHALB DIESES SYSTEMS:  $NWB#vicidial_statuses$NWE
\n"; + echo "\n"; + echo "\n"; + + ##### get status category listings for dynamic pulldown + $stmt="SELECT vsc_id,vsc_name from vicidial_status_categories order by vsc_id desc"; + $rslt=mysql_query($stmt, $link); + $cats_to_print = mysql_num_rows($rslt); + $cats_list=""; + + $o=0; + while ($cats_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $cats_list .= "\n"; + $catsname_list["$rowx[0]"] = substr($rowx[1],0,20); + $o++; + } + + + $stmt="SELECT * from vicidial_statuses order by status;"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $AScategory = $rowx[4]; + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
STATUSBESCHREIBUNGSELECT-
ABLE
HUMAN
ANSWER
CATEGORYMODIFY/DELETE
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "$rowx[0]
\n"; + echo "\n"; + echo "         \n"; + echo "   \n"; + + if (preg_match("/^B$|^NA$|^DNC$|^NA$|^DROP$|^INCALL$|^QUEUE$|^NEW$/i",$rowx[0])) + { + echo "LÖSCHUNG\n"; + } + else + { + echo "LÖSCHUNG\n"; + } + echo "
\n"; + + echo "
ADDIEREN SIE NEUEN SYSTEMSTATUS
\n"; + echo "\n"; + echo "Status:   \n"; + echo "Beschreibung:
\n"; + echo "Auswählbar:   \n"; + echo "Human Answer:   \n"; + echo "Kategorie:\n"; + echo "  
\n"; + echo "
\n"; + + echo "

\n"; + + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + + + + +###################### +# ADD=331111111111111 modify vicidial status categories +###################### + +if ($ADD==331111111111111) +{ + if ($LOGmodify_servers==1) + { + echo "
\n"; + echo ""; + + echo "
\n"; + echo "VICIDIAL STATUS CATEGORIES:   $NWB#vicidial_status_categories$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_status_categories order by vsc_id;"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + + $Avsc_id[$o] = $rowx[0]; + $Avsc_name[$o] = $rowx[1]; + $Avsc_description[$o] = $rowx[2]; + $Atovdad_display[$o] = $rowx[3]; + + $o++; + } + $p=0; + while ($o > $p) + { + if (eregi("1$|3$|5$|7$|9$", $p)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $CATstatuses=''; + $stmt="SELECT status from vicidial_statuses where category='$Avsc_id[$p]' order by status;"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $q=0; + while ($statuses_to_print > $q) + { + $rowx=mysql_fetch_row($rslt); + $CATstatuses.=" $rowx[0]"; + $q++; + } + $stmt="SELECT status from vicidial_campaign_statuses where category='$Avsc_id[$p]' order by status;"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $q=0; + while ($statuses_to_print > $q) + { + $rowx=mysql_fetch_row($rslt); + $CATstatuses.=" $rowx[0]"; + $q++; + } + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + $p++; + } + + echo "
CATEGORYNAMETOVDADSTATUSES IN THIS CATEGORY
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "$Avsc_id[$p]
\n"; + echo "$CATstatuses"; + echo "
Beschreibung:
        \n"; + echo "   LÖSCHUNG
 
\n"; + + echo "
ADDIEREN SIE NEUE STATUS-KATEGORIE
\n"; + echo "\n"; + echo "Category ID:   \n"; + echo "Name:   \n"; + echo "TimeOnVDAD Display:  
\n"; + echo "Beschreibung:   \n"; + echo "
\n"; + + echo "

\n"; + + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + + + + + +###################### +# ADD=550 search form +###################### + +if ($ADD==550) +{ +echo "
\n"; +echo ""; + +echo "
SUCHE NACH Einem BENUTZER
\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "
Benutzer-Zahl:
Voller Name:
Benutzer-Niveau:
Benutzer-Gruppe:
\n"; + +} + +###################### +# ADD=660 user search results +###################### + +if ($ADD==660) +{ +echo "
\n"; + echo ""; + + $SQL = ''; + if ($user) {$SQL .= " user LIKE \"%$user%\" and";} + if ($full_name) {$SQL .= " full_name LIKE \"%$full_name%\" and";} + if ($user_level > 0) {$SQL .= " user_level LIKE \"%$user_level%\" and";} + if ($user_group) {$SQL .= " user_group = '$user_group' and";} + $SQL = eregi_replace(" and$", "", $SQL); + if (strlen($SQL)>5) {$SQL = "where $SQL";} + + $stmt="SELECT * from vicidial_users $SQL order by full_name desc;"; +# echo "\n|$stmt|\n"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
SUCHRESULTATE:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[1]$row[3]$row[4]$row[5]ÄNDERN Sie | Notfall | STATUS | TIME
\n"; + +} + + +###################################################################################################### +###################################################################################################### +####### 8 series, Callback lists +###################################################################################################### +###################################################################################################### + +###################### +# ADD=8 find all callbacks on hold by a User +###################### +if ($ADD==8) +{ + if ($LOGmodify_users==1) + { + if ($SUB==89) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where user='$user' and status='LIVE' and callback_time < '$past_month_date';"; + $rslt=mysql_query($stmt, $link); + echo "
User($user) callback listings LIVE for more than one month have been made INACTIVE\n"; + } + if ($SUB==899) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where user='$user' and status='LIVE' and callback_time < '$past_week_date';"; + $rslt=mysql_query($stmt, $link); + echo "
User($user) callback listings LIVE for more than one week have been made INACTIVE\n"; + } + } +$CBinactiveLINK = "
Remove LIVE Callbacks older than one month for this user
Remove LIVE Callbacks older than one week for this user
"; + +echo ""; + + $CBquerySQLwhere = "and user='$user'"; + +echo "
USER CALLBACK HOLD LISTINGS: $user\n"; +$oldADD = "ADD=8&user=$user"; +$ADD='82'; +} + +###################### +# ADD=81 find all callbacks on hold within a Campaign +###################### +if ($ADD==81) +{ + if ($LOGmodify_campaigns==1) + { + if ($SUB==89) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where campaign_id='$campaign_id' and status='LIVE' and callback_time < '$past_month_date';"; + $rslt=mysql_query($stmt, $link); + echo "
campaign($campaign_id) callback listings LIVE for more than one month have been made INACTIVE\n"; + } + if ($SUB==899) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where campaign_id='$campaign_id' and status='LIVE' and callback_time < '$past_week_date';"; + $rslt=mysql_query($stmt, $link); + echo "
campaign($campaign_id) callback listings LIVE for more than one week have been made INACTIVE\n"; + } + } +$CBinactiveLINK = "
Remove LIVE Callbacks older than one month for this campaign
Remove LIVE Callbacks older than one week for this campaign
"; + +echo ""; + + $CBquerySQLwhere = "and campaign_id='$campaign_id'"; + +echo "
CAMPAIGN CALLBACK HOLD LISTINGS: $campaign_id\n"; +$oldADD = "ADD=81&campaign_id=$campaign_id"; +$ADD='82'; +} + +###################### +# ADD=811 find all callbacks on hold within a List +###################### +if ($ADD==811) +{ + if ($LOGmodify_lists==1) + { + if ($SUB==89) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where list_id='$list_id' and status='LIVE' and callback_time < '$past_month_date';"; + $rslt=mysql_query($stmt, $link); + echo "
list($list_id) callback listings LIVE for more than one month have been made INACTIVE\n"; + } + if ($SUB==899) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where list_id='$list_id' and status='LIVE' and callback_time < '$past_week_date';"; + $rslt=mysql_query($stmt, $link); + echo "
list($list_id) callback listings LIVE for more than one week have been made INACTIVE\n"; + } + } +$CBinactiveLINK = "
Remove LIVE Callbacks older than one month for this list
Remove LIVE Callbacks older than one week for this list
"; + +echo ""; + + $CBquerySQLwhere = "and list_id='$list_id'"; + +echo "
LIST CALLBACK HOLD LISTINGS: $list_id\n"; +$oldADD = "ADD=811&list_id=$list_id"; +$ADD='82'; +} + +###################### +# ADD=8111 find all callbacks on hold within a user group +###################### +if ($ADD==8111) +{ + if ($LOGmodify_usergroups==1) + { + if ($SUB==89) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where user_group='$user_group' and status='LIVE' and callback_time < '$past_month_date';"; + $rslt=mysql_query($stmt, $link); + echo "
user group($user_group) callback listings LIVE for more than one month have been made INACTIVE\n"; + } + if ($SUB==899) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where user_group='$user_group' and status='LIVE' and callback_time < '$past_week_date';"; + $rslt=mysql_query($stmt, $link); + echo "
user group($user_group) callback listings LIVE for more than one week have been made INACTIVE\n"; + } + } + $CBinactiveLINK = "
Remove LIVE Callbacks older than one month for this user group
Remove LIVE Callbacks older than one week for this user group
"; + + echo ""; + + $CBquerySQLwhere = "and user_group='$user_group'"; + +echo "
USER GROUP CALLBACK HOLD LISTINGS: $list_id\n"; +$oldADD = "ADD=8111&user_group=$user_group"; +$ADD='82'; +} + +###################### +# ADD=82 display all callbacks on hold +###################### +if ($ADD==82) +{ + +$USERlink='stage=USERIDDOWN'; +$GROUPlink='stage=GROUPDOWN'; +$ENDATElink='stage=ENDATEDOWN'; +$SQLorder='order by '; +if (eregi("USERIDDOWN",$stage)) {$SQLorder='order by user desc,'; $USERlink='stage=USERIDUP';} +if (eregi("GROUPDOWN",$stage)) {$SQLorder='order by user_group desc,'; $NAMElink='stage=NAMEUP';} +if (eregi("ENDATEDOWN",$stage)) {$SQLorder='order by entry_time desc,'; $LEVELlink='stage=LEVELUP';} + + $stmt="SELECT * from vicidial_callbacks where status IN('ACTIVE','LIVE') $CBquerySQLwhere $SQLorder recipient,status desc,callback_time"; + $rslt=mysql_query($stmt, $link); + $cb_to_print = mysql_num_rows($rslt); + +echo "
\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $o=0; + while ($cb_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
LEADLIST KAMPAGNEENTRYDATUMCALLBACKDATUMUSERRECIPIENTSTATUSGROUP
$row[1]$row[2]$row[3]$row[5]$row[6]$row[8]$row[9]$row[4]$row[11]
\n"; + +echo "$CBinactiveLINK"; +} + + + +###################################################################################################### +###################################################################################################### +####### 0 series, displays and searches +###################################################################################################### +###################################################################################################### + +###################### +# ADD=0 display all active users +###################### +if ($ADD==0) +{ +echo "
\n"; +echo ""; + +$USERlink='stage=USERIDDOWN'; +$NAMElink='stage=NAMEDOWN'; +$LEVELlink='stage=LEVELDOWN'; +$GROUPlink='stage=GROUPDOWN'; +$SQLorder='order by full_name'; +if (eregi("USERIDUP",$stage)) {$SQLorder='order by user asc'; $USERlink='stage=USERIDDOWN';} +if (eregi("USERIDDOWN",$stage)) {$SQLorder='order by user desc'; $USERlink='stage=USERIDUP';} +if (eregi("NAMEUP",$stage)) {$SQLorder='order by full_name asc'; $NAMElink='stage=NAMEDOWN';} +if (eregi("NAMEDOWN",$stage)) {$SQLorder='order by full_name desc'; $NAMElink='stage=NAMEUP';} +if (eregi("LEVELUP",$stage)) {$SQLorder='order by user_level asc'; $LEVELlink='stage=LEVELDOWN';} +if (eregi("LEVELDOWN",$stage)) {$SQLorder='order by user_level desc'; $LEVELlink='stage=LEVELUP';} +if (eregi("GROUPUP",$stage)) {$SQLorder='order by user_group asc'; $GROUPlink='stage=GROUPDOWN';} +if (eregi("GROUPDOWN",$stage)) {$SQLorder='order by user_group desc'; $GROUPlink='stage=GROUPUP';} + $stmt="SELECT * from vicidial_users $SQLorder"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
BENUTZER-AUFLISTUNGEN:\n"; +echo "
\n"; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo "\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
USER IDFULL NAMELEVELGROUPLINKS
$row[1]$row[3]$row[4]$row[5]ÄNDERN Sie | Notfall | STATUS | TIME
\n"; +} + +###################### +# ADD=10 display all campaigns +###################### +if ($ADD==10) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
KAMPAGNE AUFLISTUNGEN:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2] $row[3]$row[4]$row[5] $row[6]$row[7]  Ã„NDERN Sie
\n"; +} + + +###################### +# ADD=100 display all lists +###################### +if ($ADD==100) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_lists order by list_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
LISTE AUFLISTUNGEN:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2]$row[4]$row[5] $row[3]$row[7]  Ã„NDERN Sie
\n"; +} + + + +###################### +# ADD=1000 display all inbound groups +###################### +if ($ADD==1000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_inbound_groups order by group_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
INBOUND GRUPPE AUFLISTUNGEN:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[3] $row[5]  Ã„NDERN Sie
\n"; +} + + +###################### +# ADD=10000 display all remote agents +###################### +if ($ADD==10000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_remote_agents order by server_ip,campaign_id,user_start"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
REMOTEMITTEL-AUFLISTUNGEN:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[1] $row[2] $row[3] $row[4] $row[5] $row[6]ÄNDERN Sie
\n"; +} + + +###################### +# ADD=100000 display all user groups +###################### +if ($ADD==100000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_user_groups order by user_group"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
BENUTZER-GRUPPEN AUFLISTUNGEN:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]ÄNDERN Sie
\n"; +} + + +###################### +# ADD=1000000 display all scripts +###################### +if ($ADD==1000000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_scripts order by script_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
INDEX-AUFLISTUNGEN:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]ÄNDERN Sie
\n"; +} + + +###################### +# ADD=10000000 display all filters +###################### +if ($ADD==10000000) +{ +echo "
\n"; + + echo ""; + + $stmt="SELECT * from vicidial_lead_filters order by lead_filter_id"; + $rslt=mysql_query($stmt, $link); + $filters_to_print = mysql_num_rows($rslt); + +echo "
LEITUNG FILTER-AUFLISTUNGEN:\n"; +echo "
\n"; + + $o=0; + while ($filters_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]ÄNDERN Sie
\n"; +} + + +###################### +# ADD=100000000 display all call times +###################### +if ($ADD==100000000) +{ +echo "
\n"; + + echo ""; + + $stmt="SELECT * from vicidial_call_times order by call_time_id"; + $rslt=mysql_query($stmt, $link); + $filters_to_print = mysql_num_rows($rslt); + +echo "
Anrufzeiten Liste:\n"; +echo "
\n"; + + $o=0; + while ($filters_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[3] $row[4] ÄNDERN Sie
\n"; +} + +###################### +# ADD=1000000000 display all state call times +###################### +if ($ADD==1000000000) +{ +echo "
\n"; + + echo ""; + + $stmt="SELECT * from vicidial_state_call_times order by state_call_time_id"; + $rslt=mysql_query($stmt, $link); + $filters_to_print = mysql_num_rows($rslt); + +echo "
Liste der landesspezifische Anrufzeiten:\n"; +echo "
\n"; + + $o=0; + while ($filters_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2] $row[3] $row[4] ÄNDERN Sie
\n"; +} + +###################### +# ADD=10000000000 display all phones +###################### +if ($ADD==10000000000) +{ +echo "
\n"; +echo ""; + +$EXTENlink='stage=EXTENDOWN'; +$PROTOlink='stage=PROTODOWN'; +$SERVERlink='stage=SERVERDOWN'; +$STATUSlink='stage=STATUSDOWN'; +$SQLorder='order by extension,server_ip'; +if (eregi("EXTENUP",$stage)) {$SQLorder='order by extension asc'; $EXTENlink='stage=EXTENDOWN';} +if (eregi("EXTENDOWN",$stage)) {$SQLorder='order by extension desc'; $EXTENlink='stage=EXTENUP';} +if (eregi("PROTOUP",$stage)) {$SQLorder='order by protocol asc'; $PROTOlink='stage=PROTODOWN';} +if (eregi("PROTODOWN",$stage)) {$SQLorder='order by protocol desc'; $PROTOlink='stage=PROTOUP';} +if (eregi("SERVERUP",$stage)) {$SQLorder='order by server_ip asc'; $SERVERlink='stage=SERVERDOWN';} +if (eregi("SERVERDOWN",$stage)) {$SQLorder='order by server_ip desc'; $SERVERlink='stage=SERVERUP';} +if (eregi("STATUSUP",$stage)) {$SQLorder='order by status asc'; $STATUSlink='stage=STATUSDOWN';} +if (eregi("STATUSDOWN",$stage)) {$SQLorder='order by status desc'; $STATUSlink='stage=STATUSUP';} + $stmt="SELECT * from phones $SQLorder"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
TELEFON-AUFLISTUNGEN:\n"; +echo "
\n"; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo "\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
EXTENPROTOSERVERDIAL PLANSTATUSNAMEVMAILLINKS
$row[0]$row[16]$row[5]$row[1]$row[2]$row[8]$row[11]$row[14]$row[15]ÄNDERN Sie | Notfall
\n"; +} + +###################### +# ADD=100000000000 display all servers +###################### +if ($ADD==100000000000) +{ +echo "\n";echo "\n"; +$stmt="SELECT admin_home_url from system_settings;"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$admin_home_url_LU = $row[0]; + +?> +
+
\n"; + echo ""; + + $stmt="SELECT * from servers order by server_id"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
BEDIENER-AUFLISTUNGEN:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0]$row[1] $row[2] $row[4] $row[3]  Ã„NDERN Sie
\n"; +} + +###################### +# ADD=1000000000000 display all conferences +###################### +if ($ADD==1000000000000) +{ +echo "\r\n"; + print " \r\n"; + } + $rec_count++; + } +$sthA->finish(); + +exit; diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/listloader_super.pl b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/listloader_super.pl new file mode 100644 index 00000000..167fff5e --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/listloader_super.pl @@ -0,0 +1,1086 @@ +#!/usr/bin/perl + +### listloader_super.pl version 0.4 *DBI-version* +### +### Copyright (C) 2007 Matt Florell,Joe Johnson LICENSE: GPLv2 +### +# +# +# CHANGES +# 60616-1548 - Added listID override feature to force all leads into same list +# - Added gmt_offset_now lookup for each lead +# 60811-1232 - Changed to DBI +# 60811-1329 - changed to use /etc/astguiclient.conf for configs +# 60906-1056 - added filter of non-digits in alt_phone field +# 61110-1229 - added new USA-Canada DST scheme and Brazil DST scheme +# 61128-1207 - added postal code GMT lookup and duplicate check options +# 70205-1703 - Defaulted phone_code to 1 if not populated +# 70417-1059 - Fixed default phone_code bug +# 70510-1518 - Added campaign and system duplicate check and phonecode override +# + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help|-h/i) + { + print "allowed run time options:\n [-forcelistid=1234] = overrides the listID given in the file with the 1234\n [-h] = this help screen\n\n"; + + exit; + } + else + { + if ($args =~ /-duplicate-check/i) + {$dupcheck=1;} + if ($args =~ /-duplicate-campaign-check/i) + {$dupcheckcamp=1;} + if ($args =~ /-duplicate-system-check/i) + {$dupchecksys=1;} + if ($args =~ /-postal-code-gmt/i) + {$postalgmt=1;} + if ($args =~ /--forcelistid=/i) + { + @data_in = split(/--forcelistid=/,$args); + $forcelistid = $data_in[1]; + $forcelistid =~ s/ .*//gi; + print "\n----- FORCE LISTID OVERRIDE: $forcelistid -----\n\n"; + } + else + {$forcelistid = '';} + + if ($args =~ /--forcephonecode=/i) + { + @data_in = split(/--forcephonecode=/,$args); + $forcephonecode = $data_in[1]; + $forcephonecode =~ s/ .*//gi; + print "\n----- FORCE PHONECODE OVERRIDE: $forcephonecode -----\n\n"; + } + else + {$forcephonecode = '';} + + if ($args =~ /--lead-file=/i) + { + @data_in = split(/--lead-file=/,$args); + $lead_file = $data_in[1]; + $lead_file =~ s/ .*//gi; + # print "\n----- LEAD FILE: $lead_file -----\n\n"; + } + else + {$lead_file = './vicidial_temp_file.xls';} + } +} +### end parsing run-time options ### + +use Spreadsheet::ParseExcel; +use Time::Local; +use DBI; + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + +$vars=$ARGV[0]; +@xls_fields=split(/\,/, $vars); + +$|=0; +$secX = time(); + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($hour < 10) {$hour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +$pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; +$pulldate="$year-$mon-$mday $hour:$min:$sec"; +$inSD = $pulldate0; +$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + + ### Grab Server values from the database + $stmtA = "SELECT local_gmt FROM servers where server_ip = '$server_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBSERVER_GMT = "$aryA[0]"; + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + $rec_count++; + } + $sthA->finish(); + + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + +if ($isdst) {$LOCAL_GMT_OFF++;} +if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";} + + + +$total=0; $good=0; $bad=0; +open(STMT_FILE, "> $PATHlogs/listloader_stmts.txt"); + +$oBook = Spreadsheet::ParseExcel::Workbook->Parse("$lead_file"); +my($iR, $iC, $oWkS, $oWkC); + +foreach $oWkS (@{$oBook->{Worksheet}}) { + for($iR = 0 ; defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow} ; $iR++) { + + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user = ""; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[0]]; + if ($oWkC) {$vendor_lead_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[1]]; + if ($oWkC) {$source_code=$oWkC->Value; } + $source_id=$source_code; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[2]]; + if ($oWkC) {$list_id=$oWkC->Value; } + $gmt_offset = '0'; + $called_since_last_reset='N'; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[3]]; + if ($oWkC) {$phone_code=$oWkC->Value; } + $phone_code=~s/[^0-9]//g; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[4]]; + if ($oWkC) {$phone_number=$oWkC->Value; } + $phone_number=~s/[^0-9]//g; + $USarea = substr($phone_number, 0, 3); + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[5]]; + if ($oWkC) {$title=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[6]]; + if ($oWkC) {$first_name=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[7]]; + if ($oWkC) {$middle_initial=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[8]]; + if ($oWkC) {$last_name=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[9]]; + if ($oWkC) {$address1=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[10]]; + if ($oWkC) {$address2=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[11]]; + if ($oWkC) {$address3=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[12]]; + if ($oWkC) {$city=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[13]]; + if ($oWkC) {$state=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[14]]; + if ($oWkC) {$province=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[15]]; + if ($oWkC) {$postal_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[16]]; + if ($oWkC) {$country_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[17]]; + if ($oWkC) {$gender=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[18]]; + if ($oWkC) {$date_of_birth=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[19]]; + if ($oWkC) {$alt_phone=$oWkC->Value; } + $alt_phone=~s/[^0-9]//g; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[20]]; + if ($oWkC) {$email=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[21]]; + if ($oWkC) {$security_phrase=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[22]]; + if ($oWkC) {$comments=$oWkC->Value; } + $comments=~s/^\s*(.*?)\s*$/$1/; + + + + if (length($forcelistid) > 0) + { + $list_id = $forcelistid; # set list_id to override value + } + if (length($forcephonecode) > 0) + { + $phone_code = $forcephonecode; # set phone_code to override value + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if ($dupchecksys > 0) + { + $dup_lead=0; + $stmtA = "select count(*) from vicidial_list where phone_number='$phone_number';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $dup_lead = $aryA[0]; + $dup_lead_list=$list_id; + } + $sthA->finish(); + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if ($dupcheck > 0) + { + $dup_lead=0; + $stmtA = "select list_id from vicidial_list where phone_number='$phone_number' and list_id='$list_id' limit 1;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $dup_lead_list = $aryA[0]; + $dup_lead++; + } + $sthA->finish(); + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if ($dupcheckcamp > 0) + { + $dup_lead=0; + $dup_lists=''; + + $stmtA = "select count(*) from vicidial_lists where list_id='$list_id';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + @aryA = $sthA->fetchrow_array; + $ci_recs = $aryA[0]; + $sthA->finish(); + if ($ci_recs > 0) + { + $stmtA = "select campaign_id from vicidial_lists where list_id='$list_id';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + @aryA = $sthA->fetchrow_array; + $dup_camp = $aryA[0]; + $sthA->finish(); + + $stmtA = "select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $dup_lists .= "'$aryA[0]',"; + $rec_count++; + } + $sthA->finish(); + + chop($dup_lists); + $stmtA = "select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $dup_lead_list = "'$aryA[0]',"; + $rec_count++; + $dup_lead=1; + } + $sthA->finish(); + } + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + + if ( (length($phone_number)>6) && ($dup_lead < 1) ) + { + $phone_list .= "$phone_number$US$list_id|"; + $postalgmt_found=0; + if (length($phone_code)<1) {$phone_code = '1';} + + if ( ($postalgmt > 0) && (length($postal_code)>4) ) + { + if ($phone_code =~ /^1$/) + { + $stmtA = "select * from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[2]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[3]; + $dst_range = $aryA[4]; + $PC_processed++; + $rec_count++; + $postalgmt_found++; + if ($DBX) {print " Postal GMT record found for $postal_code: |$gmt_offset|$dst|$dst_range|\n";} + } + $sthA->finish(); + } + } + if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =~ /^1$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### MEXICO ### + if ($phone_code =~ /^52$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### AUSTRALIA ### + if ($phone_code =~ /^61$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + } + + ### Find out if DST to raise the gmt offset ### + $AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); + $AC_localtime = ($secX + (3600 * $AC_GMT_diff)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($AC_localtime); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + + if ( (!$AC_processed) && ($dst_range =~ /SSM-FSN/) ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + &USACAN_dstcalc; + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSA-LSO/) ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + &NA_dstcalc; + if ($DBX) {print " DST: $NA_DST\n";} + if ($NA_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /LSM-LSO/) ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + &GBR_dstcalc; + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /LSO-LSM/) ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + &AUS_dstcalc; + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSO-LSM/) ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + &AUST_dstcalc; + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSO-TSM/) ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + &NZL_dstcalc; + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /TSO-LSF/) ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + &BZL_dstcalc; + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$area_GMT++;} + $AC_processed++; + } + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $affected_rows = $dbhA->do($stmtZ); + print STMT_FILE $stmtZ."\r\n"; + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| $dup_lead_list\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + sleep(1); +# flush(); + } + } +} + +if ($multi_insert_counter > 0) { + $stmtZ = "INSERT INTO vicidial_list values ".substr($multistmt, 0, -1).";"; + $affected_rows = $dbhA->do($stmtZ); + print STMT_FILE $stmtZ."\r\n"; +} + +print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total"; + +exit; + + + + + + +sub USACAN_dstcalc { +#********************************************************************** +# SSM-FSN +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on Second Sunday March to First Sunday November at 2 am. +# INPUTS: +# mm INTEGER Month. +# dd INTEGER Day of the month. +# ns INTEGER Seconds into the day. +# dow INTEGER Day of week (0=Sunday, to 6=Saturday) +# OPTIONAL INPUT: +# timezone INTEGER hour difference UTC - local standard time +# (DEFAULT is blank) +# make calculations based on UTC time, +# which means shift at 10:00 UTC in April +# and 9:00 UTC in October +# OUTPUT: +# INTEGER 1 = DST, 0 = not DST +# +# S M T W T F S +# 1 2 3 4 5 6 7 +# 8 9 10 11 12 13 14 +#15 16 17 18 19 20 21 +#22 23 24 25 26 27 28 +#29 30 31 +# +# S M T W T F S +# 1 2 3 4 5 6 +# 7 8 9 10 11 12 13 +#14 15 16 17 18 19 20 +#21 22 23 24 25 26 27 +#28 29 30 31 +# +#********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; return 0; + } elsif ($mm >= 4 && $mm <= 10) { + $USACAN_DST=1; return 1; + } elsif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; return 1; + } elsif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; return 0; + } else { + $USACAN_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $USACAN_DST=0; return 0; + } else { + $USACAN_DST=1; return 1; + } + } + } else { + $USACAN_DST=0; return 0; + } + } elsif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; return 0; + } elsif ($dd < ($dow+1)) { + $USACAN_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; return 1; + } else { + $USACAN_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; return 1; + } else { + $USACAN_DST=0; return 0; + } + } + } else { + $USACAN_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub NA_dstcalc { +#********************************************************************** +# FSA-LSO +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in April and last Sunday in October at 2 am. +#********************************************************************** + + $NA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $NA_DST=0; return 0; + } elsif ($mm >= 5 && $mm <= 9) { + $NA_DST=1; return 1; + } elsif ($mm == 4) { + if ($dd > 7) { + $NA_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $NA_DST=0; return 0; + } else { + $NA_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $NA_DST=0; return 0; + } else { + $NA_DST=1; return 1; + } + } + } else { + $NA_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $NA_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $NA_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $NA_DST=1; return 1; + } else { + $NA_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 7200) { + $NA_DST=1; return 1; + } else { + $NA_DST=0; return 0; + } + } + } else { + $NA_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub GBR_dstcalc { +#********************************************************************** +# LSM-LSO +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in March and last Sunday in October at 1 am. +#********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; return 0; + } elsif ($mm >= 4 && $mm <= 9) { + $GBR_DST=1; return 1; + } elsif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $GBR_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; return 0; + } else { + $GBR_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; return 0; + } else { + $GBR_DST=1; return 1; + } + } + } else { + $GBR_DST=1; return 1; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $GBR_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; return 1; + } else { + $GBR_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; return 1; + } else { + $GBR_DST=0; return 0; + } + } + } else { + $GBR_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub AUS_dstcalc { +#********************************************************************** +# LSO-LSM +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in October and last Sunday in March at 1 am. +#********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $AUS_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $AUS_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; return 1; + } else { + $AUS_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; return 1; + } else { + $AUS_DST=0; return 0; + } + } + } else { + $AUS_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $AUS_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; return 0; + } else { + $AUS_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; return 0; + } else { + $AUS_DST=1; return 1; + } + } + } else { + $AUS_DST=1; return 1; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub AUST_dstcalc { +#********************************************************************** +# FSO-LSM +# TASMANIA ONLY +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and last Sunday in March at 1 am. +#********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $AUST_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $AUST_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; return 1; + } else { + $AUST_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; return 1; + } else { + $AUST_DST=0; return 0; + } + } + } else { + $AUST_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd >= 8) { + $AUST_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $AUST_DST=0; return 0; + } else { + $AUST_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $AUST_DST=0; return 0; + } else { + $AUST_DST=1; return 1; + } + } + } else { + $AUST_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub NZL_dstcalc { +#********************************************************************** +# FSO-TSM +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and third Sunday in March at 1 am. +#********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $NZL_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; return 1; + } elsif ($dd < ($dow+14)) { + $NZL_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; return 1; + } else { + $NZL_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; return 1; + } else { + $NZL_DST=0; return 0; + } + } + } else { + $NZL_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd >= 8) { + $NZL_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $NZL_DST=0; return 0; + } else { + $NZL_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $NZL_DST=0; return 0; + } else { + $NZL_DST=1; return 1; + } + } + } else { + $NZL_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub BZL_dstcalc { +#********************************************************************** +# TSO-LSF +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. Brazil +# Based on Third Sunday October to Last Sunday February at 1 am. +#********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; return 1; + } elsif ($mm >= 3 && $mm <= 9) { + $BZL_DST=0; return 0; + } elsif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; return 1; + } elsif ($dd < ($dow+22)) { + $BZL_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; return 1; + } else { + $BZL_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; return 1; + } else { + $BZL_DST=0; return 0; + } + } + } else { + $BZL_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; return 0; + } elsif ($dd < ($dow+22)) { + $BZL_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; return 0; + } else { + $BZL_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; return 0; + } else { + $BZL_DST=1; return 1; + } + } + } else { + $BZL_DST=1; return 1; + } + } # end of month checks +} # end of subroutine dstcalc diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/new_listloader_superL.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/new_listloader_superL.php new file mode 100644 index 00000000..bdd3feb9 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/new_listloader_superL.php @@ -0,0 +1,2069 @@ + LICENSE: GPLv2 +# +# AST GUI lead loader from formatted file +# +# CHANGES +# 50602-1640 - First version created by Joe Johnson +# 51128-1108 - Removed PHP global vars requirement +# 60113-1603 - Fixed a few bugs in Excel import +# 60421-1624 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60616-1240 - added listID override +# 60616-1604 - added gmt lookup for each lead +# 60619-1651 - Added variable filtering to eliminate SQL injection attack threat +# 60822-1121 - fixed for nonwritable directories +# 60906-1100 - added filter of non-digits in alt_phone field +# 61110-1222 - added new USA-Canada DST scheme and Brazil DST scheme +# 61128-1149 - added postal code GMT lookup and duplicate check options +# 70417-1059 - Fixed default phone_code bug +# 70510-1518 - Added campaign and system duplicate check and phonecode override +# +# make sure vicidial_list exists and that your file follows the formatting correctly. This page does not dedupe or do any other lead filtering actions yet at this time. + +$version = '2.0.4'; +$build = '70510-1518'; + + +require("dbconnect.php"); + +### links used for testing +#$link=mysql_connect("10.10.10.15", "cron", "1234"); +#mysql_select_db("asterisk"); +#$WeBServeRRooT = '/home/www/htdocs'; + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$leadfile=$_FILES["leadfile"]; + $LF_orig = $_FILES['leadfile']['name']; + $LF_path = $_FILES['leadfile']['tmp_name']; +if (isset($_GET["submit_file"])) {$submit_file=$_GET["submit_file"];} + elseif (isset($_POST["submit_file"])) {$submit_file=$_POST["submit_file"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["leadfile_name"])) {$leadfile_name=$_GET["leadfile_name"];} + elseif (isset($_POST["leadfile_name"])) {$leadfile_name=$_POST["leadfile_name"];} +if (isset($_GET["file_layout"])) {$file_layout=$_GET["file_layout"];} + elseif (isset($_POST["file_layout"])) {$file_layout=$_POST["file_layout"];} +if (isset($_GET["OK_to_process"])) {$OK_to_process=$_GET["OK_to_process"];} + elseif (isset($_POST["OK_to_process"])) {$OK_to_process=$_POST["OK_to_process"];} +if (isset($_GET["vendor_lead_code_field"])) {$vendor_lead_code_field=$_GET["vendor_lead_code_field"];} + elseif (isset($_POST["vendor_lead_code_field"])) {$vendor_lead_code_field=$_POST["vendor_lead_code_field"];} +if (isset($_GET["source_id_field"])) {$source_id_field=$_GET["source_id_field"];} + elseif (isset($_POST["source_id_field"])) {$source_id_field=$_POST["source_id_field"];} +if (isset($_GET["list_id_field"])) {$list_id_field=$_GET["list_id_field"];} + elseif (isset($_POST["list_id_field"])) {$list_id_field=$_POST["list_id_field"];} +if (isset($_GET["phone_code_field"])) {$phone_code_field=$_GET["phone_code_field"];} + elseif (isset($_POST["phone_code_field"])) {$phone_code_field=$_POST["phone_code_field"];} +if (isset($_GET["phone_number_field"])) {$phone_number_field=$_GET["phone_number_field"];} + elseif (isset($_POST["phone_number_field"])) {$phone_number_field=$_POST["phone_number_field"];} +if (isset($_GET["title_field"])) {$title_field=$_GET["title_field"];} + elseif (isset($_POST["title_field"])) {$title_field=$_POST["title_field"];} +if (isset($_GET["first_name_field"])) {$first_name_field=$_GET["first_name_field"];} + elseif (isset($_POST["first_name_field"])) {$first_name_field=$_POST["first_name_field"];} +if (isset($_GET["middle_initial_field"])) {$middle_initial_field=$_GET["middle_initial_field"];} + elseif (isset($_POST["middle_initial_field"])) {$middle_initial_field=$_POST["middle_initial_field"];} +if (isset($_GET["last_name_field"])) {$last_name_field=$_GET["last_name_field"];} + elseif (isset($_POST["last_name_field"])) {$last_name_field=$_POST["last_name_field"];} +if (isset($_GET["address1_field"])) {$address1_field=$_GET["address1_field"];} + elseif (isset($_POST["address1_field"])) {$address1_field=$_POST["address1_field"];} +if (isset($_GET["address2_field"])) {$address2_field=$_GET["address2_field"];} + elseif (isset($_POST["address2_field"])) {$address2_field=$_POST["address2_field"];} +if (isset($_GET["address3_field"])) {$address3_field=$_GET["address3_field"];} + elseif (isset($_POST["address3_field"])) {$address3_field=$_POST["address3_field"];} +if (isset($_GET["city_field"])) {$city_field=$_GET["city_field"];} + elseif (isset($_POST["city_field"])) {$city_field=$_POST["city_field"];} +if (isset($_GET["state_field"])) {$state_field=$_GET["state_field"];} + elseif (isset($_POST["state_field"])) {$state_field=$_POST["state_field"];} +if (isset($_GET["province_field"])) {$province_field=$_GET["province_field"];} + elseif (isset($_POST["province_field"])) {$province_field=$_POST["province_field"];} +if (isset($_GET["postal_code_field"])) {$postal_code_field=$_GET["postal_code_field"];} + elseif (isset($_POST["postal_code_field"])) {$postal_code_field=$_POST["postal_code_field"];} +if (isset($_GET["country_code_field"])) {$country_code_field=$_GET["country_code_field"];} + elseif (isset($_POST["country_code_field"])) {$country_code_field=$_POST["country_code_field"];} +if (isset($_GET["gender_field"])) {$gender_field=$_GET["gender_field"];} + elseif (isset($_POST["gender_field"])) {$gender_field=$_POST["gender_field"];} +if (isset($_GET["date_of_birth_field"])) {$date_of_birth_field=$_GET["date_of_birth_field"];} + elseif (isset($_POST["date_of_birth_field"])) {$date_of_birth_field=$_POST["date_of_birth_field"];} +if (isset($_GET["alt_phone_field"])) {$alt_phone_field=$_GET["alt_phone_field"];} + elseif (isset($_POST["alt_phone_field"])) {$alt_phone_field=$_POST["alt_phone_field"];} +if (isset($_GET["email_field"])) {$email_field=$_GET["email_field"];} + elseif (isset($_POST["email_field"])) {$email_field=$_POST["email_field"];} +if (isset($_GET["security_phrase_field"])) {$security_phrase_field=$_GET["security_phrase_field"];} + elseif (isset($_POST["security_phrase_field"])) {$security_phrase_field=$_POST["security_phrase_field"];} +if (isset($_GET["comments_field"])) {$comments_field=$_GET["comments_field"];} + elseif (isset($_POST["comments_field"])) {$comments_field=$_POST["comments_field"];} +if (isset($_GET["list_id_override"])) {$list_id_override=$_GET["list_id_override"];} + elseif (isset($_POST["list_id_override"])) {$list_id_override=$_POST["list_id_override"];} + $list_id_override = (preg_replace("/\D/","",$list_id_override)); +if (isset($_GET["lead_file"])) {$lead_file=$_GET["lead_file"];} + elseif (isset($_POST["lead_file"])) {$lead_file=$_POST["lead_file"];} +if (isset($_GET["dupcheck"])) {$dupcheck=$_GET["dupcheck"];} + elseif (isset($_POST["dupcheck"])) {$dupcheck=$_POST["dupcheck"];} +if (isset($_GET["postalgmt"])) {$postalgmt=$_GET["postalgmt"];} + elseif (isset($_POST["postalgmt"])) {$postalgmt=$_POST["postalgmt"];} +if (isset($_GET["phone_code_override"])) {$phone_code_override=$_GET["phone_code_override"];} + elseif (isset($_POST["phone_code_override"])) {$phone_code_override=$_POST["phone_code_override"];} + $phone_code_override = (preg_replace("/\D/","",$phone_code_override)); + +# $country_field=$_GET["country_field"]; if (!$country_field) {$country_field=$_POST["country_field"];} + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); +$list_id_override = ereg_replace("[^0-9]","",$list_id_override); + + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_datetime = $STARTtime; + +$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +if ($WeBRooTWritablE > 0) {$fp = fopen ("./project_auth_entries.txt", "a");} +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-LEAD-LOADER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Unzulässiges Username/Kennwort:|$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT load_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGload_leads =$row[0]; + + if ($LOGload_leads < 1) + { + echo "You do not have permissions to load leads\n"; + exit; + } + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "LIST_LOAD|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "LIST_LOAD|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + + +$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://';} +$admDIR = "$HTTPprotocol$server_name$script_name"; +$admDIR = eregi_replace('new_listloader_superL.php','',$admDIR); +$admSCR = 'admin.php'; +$NWB = "   \"HILFE\""; + +$secX = date("U"); +$hour = date("H"); +$min = date("i"); +$sec = date("s"); +$mon = date("m"); +$mday = date("d"); +$year = date("Y"); +$isdst = date("I"); +$Shour = date("H"); +$Smin = date("i"); +$Ssec = date("s"); +$Smon = date("m"); +$Smday = date("d"); +$Syear = date("Y"); +$pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; +$inSD = $pulldate0; +$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + ### Grab Server GMT value from the database + $stmt="SELECT local_gmt FROM servers where server_ip = '$server_ip';"; + $rslt=mysql_query($stmt, $link); + $gmt_recs = mysql_num_rows($rslt); + if ($gmt_recs > 0) + { + $row=mysql_fetch_row($rslt); + $DBSERVER_GMT = "$row[0]"; + if (strlen($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;} + if ($isdst) {$SERVER_GMT++;} + } + else + { + $SERVER_GMT = date("O"); + $SERVER_GMT = eregi_replace("\+","",$SERVER_GMT); + $SERVER_GMT = ($SERVER_GMT + 0); + $SERVER_GMT = ($SERVER_GMT / 100); + } + + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + +#if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";} + + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +function macfontfix($fontsize) { + + $browser = getenv("HTTP_USER_AGENT"); + $pctype = explode("(", $browser); + if (ereg("Mac",$pctype[1])) { + /* Browser is a Mac. If not Netscape 6, raise fonts */ + + $blownbrowser = explode('/', $browser); + $ver = explode(' ', $blownbrowser[1]); + $ver = $ver[0]; + if ($ver >= 5.0) return $fontsize; else return ($fontsize+2); + + } else return $fontsize; /* Browser is not a Mac - don't touch fonts */ +} + +echo "\n"; + +?> + + + +VICIDIAL ADMIN: Lead Loader + + +
method=post onSubmit="ParseFileName()" enctype="multipart/form-data"> + + +
\n"; + echo ""; + + $stmt="SELECT * from conferences order by conf_exten"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
KONFERENZ-AUFLISTUNGEN:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2]$row[4]  Ã„NDERN Sie
\n"; +} + +###################### +# ADD=10000000000000 display all vicidial conferences +###################### +if ($ADD==10000000000000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_conferences order by conf_exten"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
KONFERENZ-AUFLISTUNGEN:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2]$row[4]  Ã„NDERN Sie
\n"; +} + +###################### +# ADD=999999 display reports section +###################### +if ($ADD==999999) +{ + if ($LOGview_reports==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_conferences order by conf_exten"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + + $stmt="select * from servers;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $servers_to_print = mysql_num_rows($rslt); + $i=0; + while ($i < $servers_to_print) + { + $row=mysql_fetch_row($rslt); + $server_id[$i] = $row[0]; + $server_description[$i] = $row[1]; + $server_ip[$i] = $row[2]; + $active[$i] = $row[3]; + $i++; + } + + $stmt="SELECT enable_queuemetrics_logging,queuemetrics_url from system_settings;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $enable_queuemetrics_logging_LU = $row[0]; + $queuemetrics_url_LU = $row[1]; + + ?> + + + + + + VICIDIAL: Bediener-Notfall and Reports + VICIDIAL: Bediener-Notfall and Reports

+ +

+	
+	 $o)
+		{
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		$o++;
+		}
+
+	echo "
SERVERBESCHREIBUNGIP ADDRESSAKTIVVDAD timePARK timeCLOSER/INBOUND time
$server_id[$o]$server_description[$o]$server_ip[$o]$active[$o]LINKLINKLINK
\n"; + } + else + { + echo "Sie haben nicht Erlaubnis, diese Seite anzusehen\n"; + exit; + } +} + + + + + +echo "
\n"; + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n
\n"; + + +echo "\n\n\n


\nIndexlaufzeit: $RUNtime seconds"; +echo "                   VERSION: $admin_version"; +echo "                   BAU: $build
\n"; + + +?> + + +
+ + + +1) + { + if (strlen($dial_statuses)>2) + { + $g=0; + $p='13'; + $GMT_gmt[0] = ''; + $GMT_hour[0] = ''; + $GMT_day[0] = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $pmin=(gmdate("i", time() + $pzone)); + $phour=( (gmdate("G", time() + $pzone)) * 100); + $pday=gmdate("w", time() + $pzone); + $tz = sprintf("%.2f", $p); + $GMT_gmt[$g] = "$tz"; + $GMT_day[$g] = "$pday"; + $GMT_hour[$g] = ($phour + $pmin); + $p = ($p - 0.25); + $g++; + } + + $stmt="SELECT * FROM vicidial_call_times where call_time_id='$local_call_time';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $Gct_default_start = "$rowx[3]"; + $Gct_default_stop = "$rowx[4]"; + $Gct_sunday_start = "$rowx[5]"; + $Gct_sunday_stop = "$rowx[6]"; + $Gct_monday_start = "$rowx[7]"; + $Gct_monday_stop = "$rowx[8]"; + $Gct_tuesday_start = "$rowx[9]"; + $Gct_tuesday_stop = "$rowx[10]"; + $Gct_wednesday_start = "$rowx[11]"; + $Gct_wednesday_stop = "$rowx[12]"; + $Gct_thursday_start = "$rowx[13]"; + $Gct_thursday_stop = "$rowx[14]"; + $Gct_friday_start = "$rowx[15]"; + $Gct_friday_stop = "$rowx[16]"; + $Gct_saturday_start = "$rowx[17]"; + $Gct_saturday_stop = "$rowx[18]"; + $Gct_state_call_times = "$rowx[19]"; + + $ct_states = ''; + $ct_state_gmt_SQL = ''; + $ct_srs=0; + $b=0; + if (strlen($Gct_state_call_times)>2) + { + $state_rules = explode('|',$Gct_state_call_times); + $ct_srs = ((count($state_rules)) - 2); + } + while($ct_srs >= $b) + { + if (strlen($state_rules[$b])>1) + { + $stmt="SELECT * from vicidial_state_call_times where state_call_time_id='$state_rules[$b]';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Gstate_call_time_id = "$row[0]"; + $Gstate_call_time_state = "$row[1]"; + $Gsct_default_start = "$row[4]"; + $Gsct_default_stop = "$row[5]"; + $Gsct_sunday_start = "$row[6]"; + $Gsct_sunday_stop = "$row[7]"; + $Gsct_monday_start = "$row[8]"; + $Gsct_monday_stop = "$row[9]"; + $Gsct_tuesday_start = "$row[10]"; + $Gsct_tuesday_stop = "$row[11]"; + $Gsct_wednesday_start = "$row[12]"; + $Gsct_wednesday_stop = "$row[13]"; + $Gsct_thursday_start = "$row[14]"; + $Gsct_thursday_stop = "$row[15]"; + $Gsct_friday_start = "$row[16]"; + $Gsct_friday_stop = "$row[17]"; + $Gsct_saturday_start = "$row[18]"; + $Gsct_saturday_stop = "$row[19]"; + + $ct_states .="'$Gstate_call_time_state',"; + + $r=0; + $state_gmt=''; + while($r < $g) + { + if ($GMT_day[$r]==0) #### Sunday lokale Zeit + { + if (($Gsct_sunday_start==0) and ($Gsct_sunday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_sunday_start) and ($GMT_hour[$r]<$Gsct_sunday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==1) #### Monday lokale Zeit + { + if (($Gsct_monday_start==0) and ($Gsct_monday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_monday_start) and ($GMT_hour[$r]<$Gsct_monday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==2) #### Tuesday lokale Zeit + { + if (($Gsct_tuesday_start==0) and ($Gsct_tuesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_tuesday_start) and ($GMT_hour[$r]<$Gsct_tuesday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==3) #### Wednesday lokale Zeit + { + if (($Gsct_wednesday_start==0) and ($Gsct_wednesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_wednesday_start) and ($GMT_hour[$r]<$Gsct_wednesday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==4) #### Thursday lokale Zeit + { + if (($Gsct_thursday_start==0) and ($Gsct_thursday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_thursday_start) and ($GMT_hour[$r]<$Gsct_thursday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==5) #### Friday lokale Zeit + { + if (($Gsct_friday_start==0) and ($Gsct_friday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_friday_start) and ($GMT_hour[$r]<$Gsct_friday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==6) #### Saturday lokale Zeit + { + if (($Gsct_saturday_start==0) and ($Gsct_saturday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_saturday_start) and ($GMT_hour[$r]<$Gsct_saturday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + $r++; + } + $state_gmt = "$state_gmt'99'"; + $ct_state_gmt_SQL .= "or (state='$Gstate_call_time_state' and gmt_offset_now IN($state_gmt)) "; + } + + $b++; + } + if (strlen($ct_states)>2) + { + $ct_states = eregi_replace(",$",'',$ct_states); + $ct_statesSQL = "and state NOT IN($ct_states)"; + } + else + { + $ct_statesSQL = ""; + } + + $r=0; + $default_gmt=''; + while($r < $g) + { + if ($GMT_day[$r]==0) #### Sunday lokale Zeit + { + if (($Gct_sunday_start==0) and ($Gct_sunday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_sunday_start) and ($GMT_hour[$r]<$Gct_sunday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==1) #### Monday lokale Zeit + { + if (($Gct_monday_start==0) and ($Gct_monday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_monday_start) and ($GMT_hour[$r]<$Gct_monday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==2) #### Tuesday lokale Zeit + { + if (($Gct_tuesday_start==0) and ($Gct_tuesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_tuesday_start) and ($GMT_hour[$r]<$Gct_tuesday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==3) #### Wednesday lokale Zeit + { + if (($Gct_wednesday_start==0) and ($Gct_wednesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_wednesday_start) and ($GMT_hour[$r]<$Gct_wednesday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==4) #### Thursday lokale Zeit + { + if (($Gct_thursday_start==0) and ($Gct_thursday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_thursday_start) and ($GMT_hour[$r]<$Gct_thursday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==5) #### Friday lokale Zeit + { + if (($Gct_friday_start==0) and ($Gct_friday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_friday_start) and ($GMT_hour[$r]<$Gct_friday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==6) #### Saturday lokale Zeit + { + if (($Gct_saturday_start==0) and ($Gct_saturday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_saturday_start) and ($GMT_hour[$r]<$Gct_saturday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + $r++; + } + + $default_gmt = "$default_gmt'99'"; + $all_gmtSQL = "(gmt_offset_now IN($default_gmt) $ct_statesSQL) $ct_state_gmt_SQL"; + + + $dial_statuses = preg_replace("/ -$/","",$dial_statuses); + $Dstatuses = explode(" ", $dial_statuses); + $Ds_to_print = (count($Dstatuses) - 0); + $Dsql = ''; + $o=0; + while ($Ds_to_print > $o) + { + $o++; + $Dsql .= "'$Dstatuses[$o]',"; + } + $Dsql = preg_replace("/,$/","",$Dsql); + + $stmt="SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN($Dsql) and list_id IN($camp_lists) and ($all_gmtSQL) $fSQL"; + #$DB=1; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rslt_rows = mysql_num_rows($rslt); + if ($rslt_rows) + { + $rowx=mysql_fetch_row($rslt); + $active_leads = "$rowx[0]"; + } + else {$active_leads = '0';} + + echo "|$DB|\n"; + echo "Diese Kampagne hat$active_leads führt, in jenen Listen gewählt zu werden\n"; + } + else + { + echo "keine Vorwahlknopfstatus vorgewählt für diese Kampagne\n"; + } + } + else + { + echo "Keine aktiven Listen für diese Kampagne gewählt\n"; + } + } +else + { + echo "Keine aktiven Listen für diese Kampagne gewählt\n"; + } +##### END calculate what gmt_offset_now values are within the allowed local_call_time setting ### +} +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/admin_modify_lead.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/admin_modify_lead.php new file mode 100644 index 00000000..4ad70e26 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/admin_modify_lead.php @@ -0,0 +1,610 @@ + LICENSE: GPLv2 +# + +# CHANGES +# +# 70702-1259 - Added recording location link and truncation +# 70906-2132 - Added closer_log records display +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} +if (isset($_GET["phone"])) {$phone=$_GET["phone"];} + elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];} + elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];} +if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];} + elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];} +if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];} + elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];} +if (isset($_GET["end_call"])) {$end_call=$_GET["end_call"];} + elseif (isset($_POST["end_call"])) {$end_call=$_POST["end_call"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];} + elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];} + elseif (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["call_began"])) {$call_began=$_GET["call_began"];} + elseif (isset($_POST["call_began"])) {$call_began=$_POST["call_began"];} +if (isset($_GET["parked_time"])) {$parked_time=$_GET["parked_time"];} + elseif (isset($_POST["parked_time"])) {$parked_time=$_POST["parked_time"];} +if (isset($_GET["tsr"])) {$tsr=$_GET["tsr"];} + elseif (isset($_POST["tsr"])) {$tsr=$_POST["tsr"];} +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["postal_code"])) {$postal_code=$_GET["postal_code"];} + elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];} +if (isset($_GET["province"])) {$province=$_GET["province"];} + elseif (isset($_POST["province"])) {$province=$_POST["province"];} +if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];} + elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];} +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"])) {$security=$_GET["security"];} + elseif (isset($_POST["security"])) {$security=$_POST["security"];} +if (isset($_GET["comments"])) {$comments=$_GET["comments"];} + elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["CBchangeUSERtoANY"])) {$CBchangeUSERtoANY=$_GET["CBchangeUSERtoANY"];} + elseif (isset($_POST["CBchangeUSERtoANY"])) {$CBchangeUSERtoANY=$_POST["CBchangeUSERtoANY"];} +if (isset($_GET["CBchangeUSERtoUSER"])) {$CBchangeUSERtoUSER=$_GET["CBchangeUSERtoUSER"];} + elseif (isset($_POST["CBchangeUSERtoUSER"])) {$CBchangeUSERtoUSER=$_POST["CBchangeUSERtoUSER"];} +if (isset($_GET["CBchangeANYtoUSER"])) {$CBchangeANYtoUSER=$_GET["CBchangeANYtoUSER"];} + elseif (isset($_POST["CBchangeANYtoUSER"])) {$CBchangeANYtoUSER=$_POST["CBchangeANYtoUSER"];} +if (isset($_GET["callback_id"])) {$callback_id=$_GET["callback_id"];} + elseif (isset($_POST["callback_id"])) {$callback_id=$_POST["callback_id"];} +if (isset($_GET["CBuser"])) {$CBuser=$_GET["CBuser"];} + elseif (isset($_POST["CBuser"])) {$CBuser=$_POST["CBuser"];} +if (isset($_GET["modify_logs"])) {$modify_logs=$_GET["modify_logs"];} + elseif (isset($_POST["modify_logs"])) {$modify_logs=$_POST["modify_logs"];} + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + + +### AST GUI database administration modify lead in vicidial_list +### admin_modify_lead.php + +# this is the administration lead information modifier screen, the administrator just needs to enter the leadID and then they can view and modify the information in the record for that lead + +# CHANGES +# +# 60419-1705 - Added ability to change lead callback record from USERONLY to ANYONE or USERONLY-user +# 60421-1459 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60609-1112 - Added DNC list addition if status changed to DNC +# 60619-1539 - Added variable filtering to eliminate SQL injection attack threat +# 61130-1639 - Added recording_log lookup and list for this lead_id +# 61201-1136 - Added recording_log user(TSR) display and link +# 70305-1133 - Changed to default CHECKED modify logs upon status change +# 70424-1128 - Added campaign-specific statuses, reformatted recordings list +# + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); + + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and modify_leads='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Unzulässiges Username/Kennwort:|$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $stmt="SELECT full_name,modify_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[0]; + $LOGmodify_leads =$row[1]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +?> + + + +VICIDIAL ADMIN: Leitung notieren Änderung + + +
+VICIDIAL ADMIN: Leitung notieren Änderung
\n"; + +if ($end_call > 0) +{ + +$call_length = ($STARTtime - $call_began); + + ### insert a NEW record to the vicidial_closer_log table + $stmt="INSERT INTO vicidial_closer_log (lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed) values('" . mysql_real_escape_string($lead_id) . "','" . mysql_real_escape_string($list_id) . "','" . mysql_real_escape_string($campaign_id) . "','" . mysql_real_escape_string($parked_time) . "','" . mysql_real_escape_string($call_began) . "','$STARTtime','" . mysql_real_escape_string($call_length) . "','" . mysql_real_escape_string($status) . "','" . mysql_real_escape_string($phone_code) . "','" . mysql_real_escape_string($phone_number) . "','$PHP_AUTH_USER','" . mysql_real_escape_string($comments) . "','Y')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ### update the lead record in the vicidial_list table + $stmt="UPDATE vicidial_list set status='" . mysql_real_escape_string($status) . "',first_name='" . mysql_real_escape_string($first_name) . "',last_name='" . mysql_real_escape_string($last_name) . "',address1='" . mysql_real_escape_string($address1) . "',address2='" . mysql_real_escape_string($address2) . "',address3='" . mysql_real_escape_string($address3) . "',city='" . mysql_real_escape_string($city) . "',state='" . mysql_real_escape_string($state) . "',province='" . mysql_real_escape_string($province) . "',postal_code='" . mysql_real_escape_string($postal_code) . "',country_code='" . mysql_real_escape_string($country_code) . "',alt_phone='" . mysql_real_escape_string($alt_phone) . "',email='" . mysql_real_escape_string($email) . "',security_phrase='" . mysql_real_escape_string($security) . "',comments='" . mysql_real_escape_string($comments) . "' where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "Informationen geändert

\n"; + echo "\n"; + + if ( ($dispo != $status) and ($dispo == 'CBHOLD') ) + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='" . mysql_real_escape_string($lead_id) . "' and status='ACTIVE';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record inactivated: $lead_id
\n"; + } + if ( ($dispo != $status) and ($dispo == 'CALLBK') ) + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='" . mysql_real_escape_string($lead_id) . "' and status IN('ACTIVE','LIVE');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record inactivated: $lead_id
\n"; + } + + if ( ($dispo != $status) and ($status == 'DNC') ) + { + ### add lead to the internal DNC list + $stmt="INSERT INTO vicidial_dnc (phone_number) values('" . mysql_real_escape_string($phone_number) . "');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
Lead added to DNC List: $lead_id - $phone_number
\n"; + } + ### update last record in vicidial_agent_log and vicidial_log tables + if (($dispo != $status) and ($modify_logs > 0)) + { + $stmt="UPDATE vicidial_log set status='" . mysql_real_escape_string($status) . "' where lead_id='" . mysql_real_escape_string($lead_id) . "' order by call_date desc limit 1"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_agent_log set status='" . mysql_real_escape_string($status) . "' where lead_id='" . mysql_real_escape_string($lead_id) . "' order by agent_log_id desc limit 1"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + } + +} +else +{ + + if ($CBchangeUSERtoANY == 'YES') + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set recipient='ANYONE' where callback_id='" . mysql_real_escape_string($callback_id) . "';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record changed to ANYONE
\n"; + } + if ($CBchangeUSERtoUSER == 'YES') + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set user='" . mysql_real_escape_string($CBuser) . "' where callback_id='" . mysql_real_escape_string($callback_id) . "';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record user changed to $CBuser
\n"; + } + if ($CBchangeANYtoUSER == 'YES') + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set user='" . mysql_real_escape_string($CBuser) . "',recipient='USERONLY' where callback_id='" . mysql_real_escape_string($callback_id) . "';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record changed to USERONLY, user: $CBuser
\n"; + } + + + + $stmt="SELECT count(*) from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_count = $row[0]; + + if ($lead_count > 0) + { + + $stmt="select * from vicidial_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by uniqueid desc limit 500;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + $call_log = ''; + $log_campaign = ''; + while ($logs_to_print > $u) + { + $row=mysql_fetch_row($rslt); + if (strlen($log_campaign)<1) {$log_campaign = $row[3];} + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $u++; + $call_log .= "
"; + $call_log .= ""; + $call_log .= ""; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + + } + + $stmt="select * from vicidial_closer_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by closecallid desc limit 500;"; + $rslt=mysql_query($stmt, $link); + $Clogs_to_print = mysql_num_rows($rslt); + + $y=0; + $closer_log = ''; + $Clog_campaign = ''; + while ($Clogs_to_print > $y) + { + $row=mysql_fetch_row($rslt); + if (strlen($Clog_campaign)<1) {$Clog_campaign = $row[3];} + if (eregi("1$|3$|5$|7$|9$", $y)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $y++; + $closer_log .= ""; + $closer_log .= ""; + $closer_log .= ""; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + + } + + $stmt="SELECT * from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_id = "$row[0]"; + $dispo = "$row[3]"; + $tsr = "$row[4]"; + $vendor_id = "$row[5]"; + $list_id = "$row[7]"; + $campaign_id = "$row[8]"; + $phone_code = "$row[10]"; + $phone_number = "$row[11]"; + $title = "$row[12]"; + $first_name = "$row[13]"; # + $middle_initial = "$row[14]"; + $last_name = "$row[15]"; # + $address1 = "$row[16]"; # + $address2 = "$row[17]"; # + $address3 = "$row[18]"; # + $city = "$row[19]"; # + $state = "$row[20]"; # + $province = "$row[21]"; # + $postal_code = "$row[22]"; # + $country_code = "$row[23]"; # + $gender = "$row[24]"; + $date_of_birth = "$row[25]"; + $alt_phone = "$row[26]"; # + $email = "$row[27]"; # + $security = "$row[28]"; # + $comments = "$row[29]"; # + + echo "
Anrufinformationen: $first_name $last_name - $phone_number

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
$u$row[4] $row[7] $row[8] $row[11] $row[3] $row[2] $row[1]
$y$row[4] $row[7] $row[8] $row[11] $row[3] $row[2] $row[1]   $row[14]
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + echo "\n"; + + echo "\n"; + echo "
Vendor ID: $vendor_id     Lead ID: $lead_id
Fronter: $tsr     Liste Identifikation: $list_id
Vorname:   \n"; + echo " Letzter Name:
  \n"; + echo "Postcode:
(with $log_campaign statuses)
Modify agent and vicidial logs
\n"; + echo "


\n"; + + if ( ($dispo == 'CALLBK') or ($dispo == 'CBHOLD') ) + { + ### find any vicidial_callback records for this lead + $stmt="select * from vicidial_callbacks where lead_id='" . mysql_real_escape_string($lead_id) . "' and status IN('ACTIVE','LIVE') order by callback_id desc LIMIT 1;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $CB_to_print = mysql_num_rows($rslt); + $rowx=mysql_fetch_row($rslt); + + if ($CB_to_print>0) + { + if ($rowx[9] == 'USERONLY') + { + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "

\n"; + + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "New Callback Owner UserID: \n"; + echo "

\n"; + } + else + { + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "New Callback Owner UserID: \n"; + echo "

\n"; + } + } + else + { + echo "
No Callback records found
\n"; + } + } + + + + + + + } + else + { + echo "Leitung Nachschlagen FIEL für lead_id aus $lead_id       $NOW_TIME\n

\n"; +# echo "Close this window\n

\n"; + } + + + +echo "

\n"; + +echo "
\n"; + +echo "ANRUFE ZU DIESEM LEITUNG:\n"; +echo "\n"; +echo "\n"; + + echo "$call_log\n"; + +echo "
# DATE/TIME LENGTH STATUS TSR KAMPAGNE LIST LEAD
\n"; +echo "

\n"; + +echo "CLOSER RECORDS FOR THIS LEAD:\n"; +echo "\n"; +echo "\n"; + + echo "$closer_log\n"; + +echo "
# DATE/TIME LENGTH STATUS TSR KAMPAGNE LIST LEAD WAIT
\n"; +echo "

\n"; + + +echo "RECORDINGS FOR THIS LEAD:\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from recording_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by recording_id desc limit 500;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) + { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $location = $row[11]; + if (strlen($location)>30) + {$locat = substr($location,0,27); $locat = "$locat...";} + else + {$locat = $location;} + if (eregi("http",$location)) + {$location = "$locat";} + else + {$location = $locat;} + $u++; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + + } + + +echo "
# LEADDATE/TIME SECONDS   RECIDFILENAMELOCATIONTSR
$u $row[12] $row[4] $row[8] $row[0]   $row[10] $location $row[13]
\n"; + + + + +} + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nIndexlaufzeit: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/admin_search_lead.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/admin_search_lead.php new file mode 100644 index 00000000..689579d0 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/admin_search_lead.php @@ -0,0 +1,225 @@ + LICENSE: GPLv2 +### +### AST GUI database administration search for lead info +### admin_modify_lead.php +# +# this is the administration lead information modifier screen, the administrator just needs to enter the leadID and then they can view and modify the information in the record for that lead +# +# changes: +# 60620-1055 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# - Changed results to multi-record +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} +if (isset($_GET["phone"])) {$phone=$_GET["phone"];} + elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); + + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and modify_leads='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Unzulässiges Username/Kennwort:|$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name,modify_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[0]; + $LOGmodify_leads =$row[1]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +?> + + + +VICIDIAL ADMIN: Leitung Suche + +Leitung Nachschlagen + + +VICIDIAL ADMIN: Lead search
\n"; + + +if ( (!$vendor_id) and (!$phone) and (!$lead_id) ) + { + echo date("l F j, Y G:i:s A"); + echo "\n

\n"; + echo "
\n"; + echo "\n"; + echo "Tragen Sie bitte a ein:
Vendor ID(Verkäuferleitung Code): or \n"; + echo "
eine Haupttelefonnummer: or\n"; + echo "
eine Leitung Identifikation:

\n"; + echo "
\n"; + echo "\n
\n"; + echo "\n"; + exit; + } + +else + { + + if ($vendor_id) + { + $stmt="SELECT * from vicidial_list where vendor_lead_code='" . mysql_real_escape_string($vendor_id) . "' order by modify_date desc limit 1000"; + } + else + { + if ($phone) + { + $stmt="SELECT * from vicidial_list where phone_number='" . mysql_real_escape_string($phone) . "' order by modify_date desc limit 1000"; + } + else + { + if ($lead_id) + { + $stmt="SELECT * from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "' order by modify_date desc limit 1000"; + } + else + { + print "ERROR: you must search for something! Go back and search for something"; + exit; + } + } + } + if ($DB) + { + echo "\n\n$stmt\n\n"; + } + + $rslt=mysql_query($stmt, $link); + $results_to_print = mysql_num_rows($rslt); + if ($results_to_print < 1) + { + echo date("l F j, Y G:i:s A"); + echo "\n

\n"; + echo "Die Suchvariablen, die Sie eintrugen, sind nicht im System aktiv

\n"; + echo "Bitte zurück und verdoppeln Überprüfung gehen die Informationen,die Sie eintrugen und reichen wieder ein\n"; + echo "
\n"; + echo "\n"; + exit; + } + else + { + echo "RESULTS: $results_to_print

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + $o=0; + while ($results_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $o++; + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + echo "
#LEAD IDSTATUSVENDOR IDLAST AGENTLISTE IDENTIFIKATIONPHONENAMECITYSECURITYLAST CALL
$o$row[0]$row[3]$row[5]$row[4]$row[7]$row[11]$row[13] $row[15]$row[19]$row[28]$row[2]
\n"; + } + } + + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\nNEUE SUCHE"; + + +echo "\n\n\n


\nIndexlaufzeit: $RUNtime seconds"; + + +?> + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/count.htm b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/count.htm new file mode 100644 index 00000000..51f8a361 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/count.htm @@ -0,0 +1 @@ + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/dbconnect.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/dbconnect.php new file mode 100644 index 00000000..5247e166 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/dbconnect.php @@ -0,0 +1,49 @@ + LICENSE: GPLv2 +# +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"); +mysql_select_db("$VARDB_database"); + +$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 + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/group_hourly_stats.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/group_hourly_stats.php new file mode 100644 index 00000000..467d685d --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/group_hourly_stats.php @@ -0,0 +1,252 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60620-1014 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["date_with_hour"])) {$date_with_hour=$_GET["date_with_hour"];} + elseif (isset($_POST["date_with_hour"])) {$date_with_hour=$_POST["date_with_hour"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Unzulässiges Username/Kennwort:|$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$date_with_hour_default = date("Y-m-d H"); +$date_no_hour_default = $TODAY; + +if (!isset($date_with_hour)) {$date_with_hour = $date_with_hour_default;} + $date_no_hour = $date_with_hour; + $date_no_hour = eregi_replace(" ([0-9]{2})",'',$date_no_hour); +if (!isset($begin_date)) {$begin_date = $TODAY;} +if (!isset($end_date)) {$end_date = $TODAY;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Unzulässiges Username/Kennwort:|$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + +# $stmt="SELECT full_name from vicidial_users where user='$user';"; +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# $full_name = $row[0]; + + } + + + + +?> + + +VICIDIAL ADMIN: Gruppe Stündlicher Notfall +\n"; +?> + + +
+ + + + + += '" . mysql_real_escape_string($date_with_hour) . ":00:00' and call_date <= '" . mysql_real_escape_string($date_with_hour) . ":59:59' and user='$VDuser[$o]';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDtotal[$o] = "$row[0]"; + + $stmt="select count(*) from vicidial_log where call_date >= '" . mysql_real_escape_string($date_no_hour) . " 00:00:00' and call_date <= '" . mysql_real_escape_string($date_no_hour) . " 23:59:59' and user='$VDuser[$o]' and status='" . mysql_real_escape_string($status) . "';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDday[$o] = "$row[0]"; + + $stmt="select count(*) from vicidial_log where call_date >= '" . mysql_real_escape_string($date_with_hour) . ":00:00' and call_date <= '" . mysql_real_escape_string($date_with_hour) . ":59:59' and user='$VDuser[$o]' and status='" . mysql_real_escape_string($status) . "';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDcount[$o] = "$row[0]"; + $o++; + } + +echo "
" ?>   VICIDIAL ADMIN: Gruppe Stündlicher Notfall  
\n"; + +echo "
\n"; + +echo "TSR STUNDE ZÄHLIMPULSE: $group | $status | $date_with_hour | $date_no_hour\n"; + +echo "
\n"; +echo "\n"; + + $day_calls=0; + $hour_calls=0; + $total_calls=0; + $o=0; + while($o < $tsrs_to_print) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + $total_calls = ($total_calls + $VDtotal[$o]); + $hour_calls = ($hour_calls + $VDcount[$o]); + $day_calls = ($day_calls + $VDday[$o]); + + $o++; + } + +echo "\n"; + + +} + +echo "
TSR ID   $status   GESAMTANRUFE   $status DAY    
$VDuser[$o] $VDname[$o] $VDcount[$o] $VDtotal[$o] $VDday[$o]ÄNDERN Sie | Notfall
TOTAL $status $hour_calls $total_calls $day_calls
\n"; +echo "

\n"; + + + echo "
Melden Sie bitte die Gruppe an, die Sie stündlichen Notfall fürerhalten möchten:
\n"; + echo "\n"; + echo "group:
\n"; + echo "status:   (example: XFER)
\n"; + echo "date with hour:   (example: 2004-06-25 14)
\n"; + echo "\n"; + echo "


\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nIndexlaufzeit: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/help.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/help.gif new file mode 100644 index 00000000..5575d7c8 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/help.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/listloader.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/listloader.php new file mode 100644 index 00000000..5fee38ac --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/listloader.php @@ -0,0 +1,926 @@ + LICENSE: GPLv2 +# +# AST Web GUI lead loader from formatted file +# +# CHANGES +# 50602-1640 - First version created by Joe Johnson +# 51128-1108 - Removed PHP global vars requirement +# 60421-1043 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60616-1006 - added listID override and gmt_offset lookup while loading +# 60619-1652 - Added variable filtering to eliminate SQL injection attack threat +# 60822-1105 - fixed for nonwritable directories +# 60906-1059 - added filter of non-digits in alt_phone field +# 61110-1222 - added new USA-Canada DST scheme and Brazil DST scheme +# 61128-1046 - added postal code GMT lookup and duplicate check options +# 70205-1703 - Defaulted phone_code to 1 if not populated +# 70417-1059 - Fixed default phone_code bug +# +# make sure vicidial_list exists and that your file follows the formatting correctly. This page does not dedupe or do any other lead filtering actions yet at this time. +# + +$version = '2.0.3'; +$build = '770417-1059'; + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$leadfile=$_FILES["leadfile"]; + $LF_orig = $_FILES['leadfile']['name']; + $LF_path = $_FILES['leadfile']['tmp_name']; +$submit_file=$_GET["submit_file"]; if (!$submit_file) {$submit_file=$_POST["submit_file"];} +$list_id_override=$_GET["list_id_override"]; if (!$list_id_override) {$list_id_override=$_POST["list_id_override"];} + $list_id_override = (preg_replace("/\D/","",$list_id_override)); +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["dupcheck"])) {$dupcheck=$_GET["dupcheck"];} + elseif (isset($_POST["dupcheck"])) {$dupcheck=$_POST["dupcheck"];} +if (isset($_GET["postalgmt"])) {$postalgmt=$_GET["postalgmt"];} + elseif (isset($_POST["postalgmt"])) {$postalgmt=$_POST["postalgmt"];} + + +#$DB=1; +#$DBX=1; + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); +$list_id_override = ereg_replace("[^0-9]","",$list_id_override); + + +$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://';} +$admDIR = "$HTTPprotocol$server_name$script_name"; +$admDIR = eregi_replace('listloader.php','',$admDIR); +$admSCR = 'admin.php'; +$NWB = "   \"HILFE\""; + + +$secX = date("U"); +$hour = date("H"); +$min = date("i"); +$sec = date("s"); +$mon = date("m"); +$mday = date("d"); +$year = date("Y"); +$isdst = date("I"); +$Shour = date("H"); +$Smin = date("i"); +$Ssec = date("s"); +$Smon = date("m"); +$Smday = date("d"); +$Syear = date("Y"); +$pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; +$inSD = $pulldate0; +$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + ### Grab Server GMT value from the database + $stmt="SELECT local_gmt FROM servers where server_ip = '$server_ip';"; + $rslt=mysql_query($stmt, $link); + $gmt_recs = mysql_num_rows($rslt); + if ($gmt_recs > 0) + { + $row=mysql_fetch_row($rslt); + $DBSERVER_GMT = "$row[0]"; + if (strlen($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;} + if ($isdst) {$SERVER_GMT++;} + } + else + { + $SERVER_GMT = date("O"); + $SERVER_GMT = eregi_replace("\+","",$SERVER_GMT); + $SERVER_GMT = ($SERVER_GMT + 0); + $SERVER_GMT = ($SERVER_GMT / 100); + } + + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + +#if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";} + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + +?> + + + + + + method=post enctype="multipart/form-data"> +
+ + + + + + + + + + + + + + + + + + + + + +
Last Leitungen von dieser Akte:
Liste Identifikation Override: (nur Zahlen or leave blank for values in the file)
Leitung Duplikat-Überprüfung:
Vorbereitungs- und Anlaufzeit Zone Nachschlagen:
KLICKEN SIE HIER, UM ZUR SUPERLEITUNG LADEVORRICHTUNG ZU GEHEN (BETA VERSION)     ZURÜCK ZU ADMIN
+ +document.forms[0].leadfile.disabled=true; document.forms[0].submit_file.disabled=true; document.forms[0].reload_page.disabled=true;"; + flush(); + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"); + $lead_file = "./vicidial_temp_file.txt"; + } + else + { + $lead_file = "$LF_path"; + } + $file=fopen("$lead_file", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + $pulldate=date("Y-m-d H:i:s"); + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + + if (count($field_check)>=5) { + flush(); + $file=fopen("$lead_file", "r"); + $total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list=''; + print "
Verarbeitung$delim_name-delimited file... ($tab_count|$pipe_count)\n"; + + if (strlen($list_id_override)>0) + { + print "

LISTE IDENTIFIKATION OVERRIDE FOR THIS FILE: $list_id_override

"; + } + + while (!feof($file)) { + $record++; + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + + if (strlen($buffer)>0) { + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + $vendor_lead_code = $row[0]; + $source_code = $row[1]; + $source_id=$source_code; + $list_id = $row[2]; + $phone_code = eregi_replace("[^0-9]", "", $row[3]); + $phone_number = eregi_replace("[^0-9]", "", $row[4]); + $USarea = substr($phone_number, 0, 3); + $title = $row[5]; + $first_name = $row[6]; + $middle_initial = $row[7]; + $last_name = $row[8]; + $address1 = $row[9]; + $address2 = $row[10]; + $address3 = $row[11]; + $city = $row[12]; + $state = $row[13]; + $province = $row[14]; + $postal_code = $row[15]; + $country = $row[16]; + $gender = $row[17]; + $date_of_birth = $row[18]; + $alt_phone = eregi_replace("[^0-9]", "", $row[19]); + $email = $row[20]; + $security_phrase = $row[21]; + $comments = trim($row[22]); + + if (strlen($list_id_override)>0) + { + # print "

LISTE IDENTIFIKATION OVERRIDE FOR THIS FILE: $list_id_override

"; + $list_id = $list_id_override; + } + + ##### Check for duplicate phone numbers in vicidial_list table ##### + if (eregi("DUP",$dupcheck)) + { + $dup_lead=0; + $stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_lead = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + if ( (strlen($phone_number)>6) and ($dup_lead<1) ) + { + $US='_'; + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user = ""; + $gmt_offset = '0'; + $called_since_last_reset='N'; + $phone_list .= "$phone_number$US$list_id|"; + + if (strlen($phone_code)<1) {$phone_code = '1';} + + $postalgmt_found=0; + if ( (eregi("POSTAL",$postalgmt)) && (strlen($postal_code)>4) ) + { + if (preg_match('/^1$/', $phone_code)) + { + $stmt="select * from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[2]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[3]; + $dst_range = $row[4]; + $PC_processed++; + $postalgmt_found++; + $post++; + } + } + } + if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =='1') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### MEXICO ### + if ($phone_code =='52') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### AUSTRALIA ### + if ($phone_code =='61') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $PC_processed++; + $stmt="select * from vicidial_phone_codes where country_code='$phone_code';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + } + + ### Find out if DST to raise the gmt offset ### + $AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); + $AC_localtime = mktime(($Shour + $AC_GMT_diff), $Smin, $Ssec, $Smon, $Smday, $Syear); + $hour = date("H",$AC_localtime); + $min = date("i",$AC_localtime); + $sec = date("s",$AC_localtime); + $mon = date("m",$AC_localtime); + $mday = date("d",$AC_localtime); + $wday = date("w",$AC_localtime); + $year = date("Y",$AC_localtime); + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + if ( (!$AC_processed) and ($dst_range == 'SSM-FSN') ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + #********************************************************************** + # SSM-FSN + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on Second Sunday March to First Sunday November at 2 am. + # INPUTS: + # mm INTEGER Month. + # dd INTEGER Day of the month. + # ns INTEGER Seconds into the day. + # dow INTEGER Day of week (0=Sunday, to 6=Saturday) + # OPTIONAL INPUT: + # timezone INTEGER hour difference UTC - local standard time + # (DEFAULT is blank) + # make calculations based on UTC time, + # which means shift at 10:00 UTC in April + # and 9:00 UTC in October + # OUTPUT: + # INTEGER 1 = DST, 0 = not DST + # + # S M T W T F S + # 1 2 3 4 5 6 7 + # 8 9 10 11 12 13 14 + #15 16 17 18 19 20 21 + #22 23 24 25 26 27 28 + #29 30 31 + # + # S M T W T F S + # 1 2 3 4 5 6 + # 7 8 9 10 11 12 13 + #14 15 16 17 18 19 20 + #21 22 23 24 25 26 27 + #28 29 30 31 + # + #********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; + } elseif ($mm >= 4 and $mm <= 10) { + $USACAN_DST=1; + } elseif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; + } elseif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } + } else { + $USACAN_DST=0; + } + } elseif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; + } elseif ($dd < ($dow+1)) { + $USACAN_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } else { # lokale Zeit calculations + if ($ns < 7200) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } + } else { + $USACAN_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + #********************************************************************** + # FSA-LSO + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in April and last Sunday in October at 2 am. + #********************************************************************** + + $NA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $NA_DST=0; + } elseif ($mm >= 5 and $mm <= 9) { + $NA_DST=1; + } elseif ($mm == 4) { + if ($dd > 7) { + $NA_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $NA_DST=0; + } else { + $NA_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $NA_DST=0; + } else { + $NA_DST=1; + } + } + } else { + $NA_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $NA_DST=1; + } elseif ($dd < ($dow+25)) { + $NA_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $NA_DST=1; + } else { + $NA_DST=0; + } + } else { # lokale Zeit calculations + if ($ns < 7200) { + $NA_DST=1; + } else { + $NA_DST=0; + } + } + } else { + $NA_DST=0; + } + } # end of month checks + + if ($DBX) {print " DST: $NA_DST\n";} + if ($NA_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'LSM-LSO') ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in March and last Sunday in October at 1 am. + #********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; + } elseif ($mm >= 4 and $mm <= 9) { + $GBR_DST=1; + } elseif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; + } elseif ($dd < ($dow+25)) { + $GBR_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } else { # lokale Zeit calculations + if ($ns < 3600) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } + } else { + $GBR_DST=1; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; + } elseif ($dd < ($dow+25)) { + $GBR_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } else { # lokale Zeit calculations + if ($ns < 3600) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } + } else { + $GBR_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) and ($dst_range == 'LSO-LSM') ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUS_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; + } elseif ($dd < ($dow+25)) { + $AUS_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } else { # lokale Zeit calculations + if ($ns < 3600) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } + } else { + $AUS_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; + } elseif ($dd < ($dow+25)) { + $AUS_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } else { # lokale Zeit calculations + if ($ns < 3600) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } + } else { + $AUS_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-LSM') ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + #********************************************************************** + # TASMANIA ONLY + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUST_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; + } elseif ($dd < ($dow+25)) { + $AUST_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } else { # lokale Zeit calculations + if ($ns < 3600) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } + } else { + $AUST_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $AUST_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } + } else { + $AUST_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and third Sunday in March at 1 am. + #********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $NZL_DST=0; + } elseif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; + } elseif ($dd < ($dow+14)) { + $NZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } else { # lokale Zeit calculations + if ($ns < 3600) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } + } else { + $NZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $NZL_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } + } else { + $NZL_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + #********************************************************************** + # TSO-LSF + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. Brazil + # Based on Third Sunday October to Last Sunday February at 1 am. + #********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; + } elseif ($mm >= 3 and $mm <= 9) { + $BZL_DST=0; + } elseif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; + } elseif ($dd < ($dow+22)) { + $BZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } else { # lokale Zeit calculations + if ($ns < 3600) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } + } else { + $BZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; + } elseif ($dd < ($dow+22)) { + $BZL_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } else { # lokale Zeit calculations + if ($ns < 3600) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } + } else { + $BZL_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } + else + { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead\n";} + $bad++; + } + $total++; + if ($total%100==0) + { + print ""; + usleep(1000); + flush(); + } + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
DUPLICATE: $dup       POSTAL MATCH: $post
"; + + } else { + print "
STÖRUNG: Die Akte hat nicht die erforderliche Zahl vonauffängt, um sie zu verarbeiten.
"; + } + print ""; +} else if (filesize($leadfile)>8388608) { + print "
STÖRUNG: Akte übersteigt die Begrenzung 8MB.
"; +} +?> + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/listloader.pl b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/listloader.pl new file mode 100644 index 00000000..d926368b --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/listloader.pl @@ -0,0 +1,1084 @@ +#!/usr/bin/perl + +### listloader.pl version 0.4 *DBI-version* +### +### Copyright (C) 2007 Matt Florell,Joe Johnson LICENSE: GPLv2 +### +# +# +# CHANGES +# 60616-1548 - Added listID override feature to force all leads into same list +# - Added gmt_offset_now lookup for each lead +# 60811-1232 - Changed to DBI +# 60811-1329 - changed to use /etc/astguiclient.conf for configs +# 60822-1121 - fixed for nonwritable directories +# 60906-1058 - added filter of non-digits in alt_phone field +# 61110-1229 - added new USA-Canada DST scheme and Brazil DST scheme +# 61128-1215 - added postal code GMT lookup and duplicate check options +# 70205-1703 - Defaulted phone_code to 1 if not populated +# 70417-1059 - Fixed default phone_code bug +# 70510-1518 - Added campaign and system duplicate check and phonecode override +# + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help|-h/i) + { + print "allowed run time options:\n [-forcelistid=1234] = overrides the listID given in the file with the 1234\n [-h] = this help screen\n\n"; + + exit; + } + else + { + if ($args =~ /-duplicate-check/i) + {$dupcheck=1;} + if ($args =~ /-duplicate-campaign-check/i) + {$dupcheckcamp=1;} + if ($args =~ /-duplicate-system-check/i) + {$dupchecksys=1;} + if ($args =~ /-postal-code-gmt/i) + {$postalgmt=1;} + if ($args =~ /--forcelistid=/i) + { + @data_in = split(/--forcelistid=/,$args); + $forcelistid = $data_in[1]; + $forcelistid =~ s/ .*//gi; + print "\n----- FORCE LISTID OVERRIDE: $forcelistid -----\n\n"; + } + else + {$forcelistid = '';} + + if ($args =~ /--forcephonecode=/i) + { + @data_in = split(/--forcephonecode=/,$args); + $forcephonecode = $data_in[1]; + $forcephonecode =~ s/ .*//gi; + print "\n----- FORCE PHONECODE OVERRIDE: $forcephonecode -----\n\n"; + } + else + {$forcephonecode = '';} + + if ($args =~ /--lead-file=/i) + { + @data_in = split(/--lead-file=/,$args); + $lead_file = $data_in[1]; + $lead_file =~ s/ .*//gi; + # print "\n----- LEAD FILE: $lead_file -----\n\n"; + } + else + {$lead_file = './vicidial_temp_file.xls';} + } +} +### end parsing run-time options ### + + +use Spreadsheet::ParseExcel; +use Time::Local; +use DBI; + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + +$|=0; +$secX = time(); + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($hour < 10) {$hour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +$pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; +$pulldate="$year-$mon-$mday $hour:$min:$sec"; +$inSD = $pulldate0; +$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + + ### Grab Server values from the database + $stmtA = "SELECT local_gmt FROM servers where server_ip = '$server_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBSERVER_GMT = "$aryA[0]"; + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + $rec_count++; + } + $sthA->finish(); + + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + +if ($isdst) {$LOCAL_GMT_OFF++;} +if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";} + + + +$total=0; $good=0; $bad=0; +print "
Processing Excel file...\n"; +open(STMT_FILE, "> $PATHlogs/listloader_stmts.txt"); + +$oBook = Spreadsheet::ParseExcel::Workbook->Parse("$lead_file"); +my($iR, $iC, $oWkS, $oWkC); + +foreach $oWkS (@{$oBook->{Worksheet}}) { + for($iR = 0 ; defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow} ; $iR++) { + + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user = ""; + $oWkC = $oWkS->{Cells}[$iR][0]; + if ($oWkC) {$vendor_lead_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][1]; + if ($oWkC) {$source_code=$oWkC->Value; } + $source_id=$source_code; + $oWkC = $oWkS->{Cells}[$iR][2]; + if ($oWkC) {$list_id=$oWkC->Value; } + $gmt_offset = '0'; + $called_since_last_reset='N'; + $oWkC = $oWkS->{Cells}[$iR][3]; + if ($oWkC) {$phone_code=$oWkC->Value; } + $phone_code=~s/[^0-9]//g; + $oWkC = $oWkS->{Cells}[$iR][4]; + if ($oWkC) {$phone_number=$oWkC->Value; } + $phone_number=~s/[^0-9]//g; + $USarea = substr($phone_number, 0, 3); + $oWkC = $oWkS->{Cells}[$iR][5]; + if ($oWkC) {$title=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][6]; + if ($oWkC) {$first_name=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][7]; + if ($oWkC) {$middle_initial=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][8]; + if ($oWkC) {$last_name=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][9]; + if ($oWkC) {$address1=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][10]; + if ($oWkC) {$address2=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][11]; + if ($oWkC) {$address3=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][12]; + if ($oWkC) {$city=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][13]; + if ($oWkC) {$state=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][14]; + if ($oWkC) {$province=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][15]; + if ($oWkC) {$postal_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][16]; + if ($oWkC) {$country=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][17]; + if ($oWkC) {$gender=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][18]; + if ($oWkC) {$date_of_birth=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][19]; + if ($oWkC) {$alt_phone=$oWkC->Value; } + $alt_phone=~s/[^0-9]//g; + $oWkC = $oWkS->{Cells}[$iR][20]; + if ($oWkC) {$email=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][21]; + if ($oWkC) {$security_phrase=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][22]; + if ($oWkC) {$comments=$oWkC->Value; } + $comments=~s/^\s*(.*?)\s*$/$1/; + + if (length($forcelistid) > 0) + { + $list_id = $forcelistid; # set list_id to override value + } + if (length($forcephonecode) > 0) + { + $phone_code = $forcephonecode; # set phone_code to override value + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if ($dupchecksys > 0) + { + $dup_lead=0; + $stmtA = "select count(*) from vicidial_list where phone_number='$phone_number';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $dup_lead = $aryA[0]; + $dup_lead_list=$list_id; + } + $sthA->finish(); + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if ($dupcheck > 0) + { + $dup_lead=0; + $stmtA = "select list_id from vicidial_list where phone_number='$phone_number' and list_id='$list_id' limit 1;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $dup_lead_list = $aryA[0]; + $dup_lead++; + } + $sthA->finish(); + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if ($dupcheckcamp > 0) + { + $dup_lead=0; + $dup_lists=''; + + $stmtA = "select count(*) from vicidial_lists where list_id='$list_id';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + @aryA = $sthA->fetchrow_array; + $ci_recs = $aryA[0]; + $sthA->finish(); + if ($ci_recs > 0) + { + $stmtA = "select campaign_id from vicidial_lists where list_id='$list_id';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + @aryA = $sthA->fetchrow_array; + $dup_camp = $aryA[0]; + $sthA->finish(); + + $stmtA = "select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $dup_lists .= "'$aryA[0]',"; + $rec_count++; + } + $sthA->finish(); + + chop($dup_lists); + $stmtA = "select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $dup_lead_list = "'$aryA[0]',"; + $rec_count++; + $dup_lead=1; + } + $sthA->finish(); + } + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + + if ( (length($phone_number)>6) && ($dup_lead < 1) ) + { + $phone_list .= "$phone_number$US$list_id|"; + $postalgmt_found=0; + if (length($phone_code)<1) {$phone_code = '1';} + + if ( ($postalgmt > 0) && (length($postal_code)>4) ) + { + if ($phone_code =~ /^1$/) + { + $stmtA = "select * from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[2]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[3]; + $dst_range = $aryA[4]; + $PC_processed++; + $rec_count++; + $postalgmt_found++; + if ($DBX) {print " Postal GMT record found for $postal_code: |$gmt_offset|$dst|$dst_range|\n";} + } + $sthA->finish(); + } + } + if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =~ /^1$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### MEXICO ### + if ($phone_code =~ /^52$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### AUSTRALIA ### + if ($phone_code =~ /^61$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + } + + ### Find out if DST to raise the gmt offset ### + $AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); + $AC_localtime = ($secX + (3600 * $AC_GMT_diff)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($AC_localtime); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + + if ( (!$AC_processed) && ($dst_range =~ /SSM-FSN/) ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + &USACAN_dstcalc; + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSA-LSO/) ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + &NA_dstcalc; + if ($DBX) {print " DST: $NA_DST\n";} + if ($NA_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /LSM-LSO/) ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + &GBR_dstcalc; + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /LSO-LSM/) ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + &AUS_dstcalc; + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSO-LSM/) ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + &AUST_dstcalc; + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSO-TSM/) ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + &NZL_dstcalc; + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /TSO-LSF/) ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + &BZL_dstcalc; + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$area_GMT++;} + $AC_processed++; + } + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $affected_rows = $dbhA->do($stmtZ); + print STMT_FILE $stmtZ."\r\n"; + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| $dup_lead_list\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + sleep(1); +# flush(); + } + } +} + +if ($multi_insert_counter > 0) { + $stmtZ = "INSERT INTO vicidial_list values ".substr($multistmt, 0, -1).";"; + $affected_rows = $dbhA->do($stmtZ); + print STMT_FILE $stmtZ."\r\n"; +} + +print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + +exit; + + + + + + +sub USACAN_dstcalc { +#********************************************************************** +# SSM-FSN +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on Second Sunday March to First Sunday November at 2 am. +# INPUTS: +# mm INTEGER Month. +# dd INTEGER Day of the month. +# ns INTEGER Seconds into the day. +# dow INTEGER Day of week (0=Sunday, to 6=Saturday) +# OPTIONAL INPUT: +# timezone INTEGER hour difference UTC - local standard time +# (DEFAULT is blank) +# make calculations based on UTC time, +# which means shift at 10:00 UTC in April +# and 9:00 UTC in October +# OUTPUT: +# INTEGER 1 = DST, 0 = not DST +# +# S M T W T F S +# 1 2 3 4 5 6 7 +# 8 9 10 11 12 13 14 +#15 16 17 18 19 20 21 +#22 23 24 25 26 27 28 +#29 30 31 +# +# S M T W T F S +# 1 2 3 4 5 6 +# 7 8 9 10 11 12 13 +#14 15 16 17 18 19 20 +#21 22 23 24 25 26 27 +#28 29 30 31 +# +#********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; return 0; + } elsif ($mm >= 4 && $mm <= 10) { + $USACAN_DST=1; return 1; + } elsif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; return 1; + } elsif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; return 0; + } else { + $USACAN_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $USACAN_DST=0; return 0; + } else { + $USACAN_DST=1; return 1; + } + } + } else { + $USACAN_DST=0; return 0; + } + } elsif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; return 0; + } elsif ($dd < ($dow+1)) { + $USACAN_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; return 1; + } else { + $USACAN_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; return 1; + } else { + $USACAN_DST=0; return 0; + } + } + } else { + $USACAN_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub NA_dstcalc { +#********************************************************************** +# FSA-LSO +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in April and last Sunday in October at 2 am. +#********************************************************************** + + $NA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $NA_DST=0; return 0; + } elsif ($mm >= 5 && $mm <= 9) { + $NA_DST=1; return 1; + } elsif ($mm == 4) { + if ($dd > 7) { + $NA_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $NA_DST=0; return 0; + } else { + $NA_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $NA_DST=0; return 0; + } else { + $NA_DST=1; return 1; + } + } + } else { + $NA_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $NA_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $NA_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $NA_DST=1; return 1; + } else { + $NA_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 7200) { + $NA_DST=1; return 1; + } else { + $NA_DST=0; return 0; + } + } + } else { + $NA_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub GBR_dstcalc { +#********************************************************************** +# LSM-LSO +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in March and last Sunday in October at 1 am. +#********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; return 0; + } elsif ($mm >= 4 && $mm <= 9) { + $GBR_DST=1; return 1; + } elsif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $GBR_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; return 0; + } else { + $GBR_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; return 0; + } else { + $GBR_DST=1; return 1; + } + } + } else { + $GBR_DST=1; return 1; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $GBR_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; return 1; + } else { + $GBR_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; return 1; + } else { + $GBR_DST=0; return 0; + } + } + } else { + $GBR_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub AUS_dstcalc { +#********************************************************************** +# LSO-LSM +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in October and last Sunday in March at 1 am. +#********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $AUS_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $AUS_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; return 1; + } else { + $AUS_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; return 1; + } else { + $AUS_DST=0; return 0; + } + } + } else { + $AUS_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $AUS_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; return 0; + } else { + $AUS_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; return 0; + } else { + $AUS_DST=1; return 1; + } + } + } else { + $AUS_DST=1; return 1; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub AUST_dstcalc { +#********************************************************************** +# FSO-LSM +# TASMANIA ONLY +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and last Sunday in March at 1 am. +#********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $AUST_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $AUST_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; return 1; + } else { + $AUST_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; return 1; + } else { + $AUST_DST=0; return 0; + } + } + } else { + $AUST_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd >= 8) { + $AUST_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $AUST_DST=0; return 0; + } else { + $AUST_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $AUST_DST=0; return 0; + } else { + $AUST_DST=1; return 1; + } + } + } else { + $AUST_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub NZL_dstcalc { +#********************************************************************** +# FSO-TSM +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and third Sunday in March at 1 am. +#********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $NZL_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; return 1; + } elsif ($dd < ($dow+14)) { + $NZL_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; return 1; + } else { + $NZL_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; return 1; + } else { + $NZL_DST=0; return 0; + } + } + } else { + $NZL_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd >= 8) { + $NZL_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $NZL_DST=0; return 0; + } else { + $NZL_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $NZL_DST=0; return 0; + } else { + $NZL_DST=1; return 1; + } + } + } else { + $NZL_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub BZL_dstcalc { +#********************************************************************** +# TSO-LSF +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. Brazil +# Based on Third Sunday October to Last Sunday February at 1 am. +#********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; return 1; + } elsif ($mm >= 3 && $mm <= 9) { + $BZL_DST=0; return 0; + } elsif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; return 1; + } elsif ($dd < ($dow+22)) { + $BZL_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; return 1; + } else { + $BZL_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; return 1; + } else { + $BZL_DST=0; return 0; + } + } + } else { + $BZL_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; return 0; + } elsif ($dd < ($dow+22)) { + $BZL_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; return 0; + } else { + $BZL_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; return 0; + } else { + $BZL_DST=1; return 1; + } + } + } else { + $BZL_DST=1; return 1; + } + } # end of month checks +} # end of subroutine dstcalc diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/listloaderMAIN.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/listloaderMAIN.php new file mode 100644 index 00000000..30c5fc5e --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/listloaderMAIN.php @@ -0,0 +1,86 @@ + LICENSE: GPLv2 +# +# this is the main frame page for the lead loading section. This is where you +# would upload a file and have it inserted into vicidial_list +# +# changes: +# 60620-1149 - Added variable filtering to eliminate SQL injection attack threat +# 60822-1105 - fixed for nonwritable directories +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_datetime = $STARTtime; + +$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +if ($WeBRooTWritablE > 0) {$fp = fopen ("./project_auth_entries.txt", "a");} +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-LEAD-LOADER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Unzulässiges Username/Kennwort:|$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT load_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGload_leads =$row[0]; + + if ($LOGload_leads < 1) + { + echo "You do not have permissions to load leads\n"; + exit; + } + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "LIST_LOAD|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "LIST_LOAD|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +?> + +VICIDIAL: Leitung Ladevorrichtung Modul + + + + + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/listloader_rowdisplay.pl b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/listloader_rowdisplay.pl new file mode 100644 index 00000000..3f8695c0 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/listloader_rowdisplay.pl @@ -0,0 +1,153 @@ +#!/usr/bin/perl + +### listloader_rowdisplay.pl version 0.2 *DBI-version* +### +### Copyright (C) 2006 Matt Florell,Joe Johnson LICENSE: GPLv2 +### +# +# CHANGES +# +# 60811-1232 - Changed to DBI +# 60811-1329 - changed to use /etc/astguiclient.conf for configs +# + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help|-h/i) + { + print "allowed run time options:\n [-forcelistid=1234] = overrides the listID given in the file with the 1234\n [-h] = this help screen\n\n"; + + exit; + } + else + { + if ($args =~ /-duplicate-check/i) + {$dupcheck=1;} + if ($args =~ /-postal-code-gmt/i) + {$postalgmt=1;} + if ($args =~ /--lead-file=/i) + { + @data_in = split(/--lead-file=/,$args); + $lead_file = $data_in[1]; + $lead_file =~ s/ .*//gi; + # print "\n----- LEAD FILE: $lead_file -----\n\n"; + } + else + {$lead_file = './vicidial_temp_file.xls';} + } +} +### end parsing run-time options ### + +use Spreadsheet::ParseExcel; +use Time::Local; +use DBI; + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + +$oBook = Spreadsheet::ParseExcel::Workbook->Parse("$lead_file"); +my($iR, $iC, $oWkS, $oWkC); +$var_str=""; + +foreach $oWkS (@{$oBook->{Worksheet}}) { + for(my $iC = $oWkS->{MinCol} ; defined $oWkS->{MaxCol} && $iC <= $oWkS->{MaxCol} ; $iC++) { + $oWkC = $oWkS->{Cells}[0][$iC]; + if ($oWkC) { + $var_str.=$oWkC->Value."|"; + } else { + $var_str.="|"; + } + } +} + +@xls_row=split(/\|/, $var_str); + + +$stmtA = "select vendor_lead_code, source_id, list_id, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments from vicidial_list limit 1;"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + my $names = $sthA->{'NAME'}; + my $numFields = $sthA->{'NUM_OF_FIELDS'}; + for (my $i = 0; $i < $numFields; $i++) + { + # printf("%s%s", $i ? "," : "", $$names[$i]); + # printf("%s%s", $i ? "," : "", $$ref[$i]); + + $field_name=uc($$names[$i]); + $field_name=~s/\_/ /g; + print "
".$field_name.": \r\n"; + print " \r\n"; + print "
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Last Leitungen von dieser Akte:
Liste Identifikation Override: (nur Zahlen or leave blank for values in the file)
Phone Code Override: (nur Zahlen or leave blank for values in the file)
Zu verwenden Dateiaufbau:Standard-VICIDIAL    Kundenspezifischer Plan
Leitung Duplikat-Überprüfung:
Vorbereitungs- und Anlaufzeit Zone Nachschlagen:
        
        ZURÜCK ZU ADMINLIST LOADER-     VERSION:     BAU:    
+ + +document.forms[0].leadfile.disabled=true;document.forms[0].list_id_override.disabled=true;document.forms[0].phone_code_override.disabled=true; document.forms[0].submit_file.disabled=true; document.forms[0].reload_page.disabled=true;"; + flush(); + $total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list=''; + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) { + # copy($leadfile, "./vicidial_temp_file.txt"); + $file=fopen("$lead_file", "r"); + if ($WeBRooTWritablE > 0) + { + $stmt_file=fopen("listloader_stmts.txt", "w"); + } + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + + if (count($field_check)>=5) { + flush(); + $file=fopen("$lead_file", "r"); + print "
Verarbeitung$delim_name-delimited file...\n"; + + if (strlen($list_id_override)>0) + { + print "

LISTE IDENTIFIKATION OVERRIDE FOR THIS FILE: $list_id_override

"; + } + + if (strlen($phone_code_override)>0) + { + print "

TELEFON-CODE-ÜBERSTEUERUNG FÜR DIESE AKTE: $phone_code_override

"; + } + + while (!feof($file)) { + $record++; + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + + if (strlen($buffer)>0) { + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[$vendor_lead_code_field]; + $source_code = $row[$source_id_field]; + $source_id=$source_code; + $list_id = $row[$list_id_field]; + $gmt_offset = '0'; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[$phone_code_field]); + $phone_number = eregi_replace("[^0-9]", "", $row[$phone_number_field]); + $USarea = substr($phone_number, 0, 3); + $title = $row[$title_field]; + $first_name = $row[$first_name_field]; + $middle_initial = $row[$middle_initial_field]; + $last_name = $row[$last_name_field]; + $address1 = $row[$address1_field]; + $address2 = $row[$address2_field]; + $address3 = $row[$address3_field]; + $city =$row[$city_field]; + $state = $row[$state_field]; + $province = $row[$province_field]; + $postal_code = $row[$postal_code_field]; + $country_code = $row[$country_code_field]; + $gender = $row[$gender_field]; + $date_of_birth = $row[$date_of_birth_field]; + $alt_phone = eregi_replace("[^0-9]", "", $row[$alt_phone_field]); + $email = $row[$email_field]; + $security_phrase = $row[$security_phrase_field]; + $comments = trim($row[$comments_field]); + + if (strlen($list_id_override)>0) + { + # print "

LISTE IDENTIFIKATION OVERRIDE FOR THIS FILE: $list_id_override

"; + $list_id = $list_id_override; + } + if (strlen($phone_code_override)>0) + { + $phone_code = $phone_code_override; + } + + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if (eregi("DUPCAMP",$dupcheck)) + { + $dup_lead=0; + $dup_lists=''; + $stmt="select campaign_id from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $ci_recs = mysql_num_rows($rslt); + if ($ci_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_camp = $row[0]; + + $stmt="select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $rslt=mysql_query($stmt, $link); + $li_recs = mysql_num_rows($rslt); + if ($li_recs > 0) + { + $L=0; + while ($li_recs > $L) + { + $row=mysql_fetch_row($rslt); + $dup_lists .= "'$row[0]',"; + $L++; + } + $dup_lists = eregi_replace(",$",'',$dup_lists); + + $stmt="select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + } + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if (eregi("DUPSYS",$dupcheck)) + { + $dup_lead=0; + $stmt="select list_id from vicidial_list where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if (eregi("DUPLIST",$dupcheck)) + { + $dup_lead=0; + $stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_lead = $row[0]; + $dup_lead_list = $list_id; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + if ( (strlen($phone_number)>6) and ($dup_lead<1) ) + { + if (strlen($phone_code)<1) {$phone_code = '1';} + + $US='_'; + $phone_list .= "$phone_number$US$list_id|"; + + $gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code); + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead $dup_lead_list\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } else { + print "
STÖRUNG: Die Akte hat nicht die erforderliche Zahl vonauffängt, um sie zu verarbeiten.
"; + } + } else if (!eregi(".csv", $leadfile_name)) { + # copy($leadfile, "./vicidial_temp_file.xls"); + $file=fopen("$lead_file", "r"); + + print "
VerarbeitungExcel file... \n"; + if (strlen($list_id_override)>0) + { + print "

LISTE IDENTIFIKATION OVERRIDE FOR THIS FILE: $list_id_override

\n"; + } + if (strlen($phone_code_override)>0) + { + print "

TELEFON-CODE-ÜBERSTEUERUNG FÜR DIESE AKTE: $phone_code_override

\n"; + } + # print "|$WeBServeRRooT/vicidial/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field, --forcelistid=$list_id_override --lead_file=$lead_file|"; + $dupcheckCLI=''; $postalgmtCLI=''; + if (eregi("DUPLIST",$dupcheck)) {$dupcheckCLI='--duplicate-check';} + if (eregi("DUPCAMP",$dupcheck)) {$dupcheckCLI='--duplicate-campaign-check';} + if (eregi("DUPSYS",$dupcheck)) {$dupcheckCLI='--duplicate-system-check';} + if (eregi("POSTAL",$postalgmt)) {$postalgmtCLI='--postal-code-gmt';} + passthru("$WeBServeRRooT/vicidial/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field, --forcelistid=$list_id_override --forcephonecode=$phone_code_override --lead-file=$lead_file $postalgmtCLI $dupcheckCLI"); + } else { + # copy($leadfile, "./vicidial_temp_file.csv"); + $file=fopen("$lead_file", "r"); + + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + print "
VerarbeitungCSV file... \n"; + if (strlen($list_id_override)>0) + { + print "

LISTE IDENTIFIKATION OVERRIDE FOR THIS FILE: $list_id_override

"; + } + + if (strlen($phone_code_override)>0) + { + print "

TELEFON-CODE-ÜBERSTEUERUNG FÜR DIESE AKTE: $phone_code_override

"; + } + + while($row=fgetcsv($file, 1000, ",")) { + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[$vendor_lead_code_field]; + $source_code = $row[$source_id_field]; + $source_id=$source_code; + $list_id = $row[$list_id_field]; + $gmt_offset = '0'; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[$phone_code_field]); + $phone_number = eregi_replace("[^0-9]", "", $row[$phone_number_field]); + $USarea = substr($phone_number, 0, 3); + $title = $row[$title_field]; + $first_name = $row[$first_name_field]; + $middle_initial = $row[$middle_initial_field]; + $last_name = $row[$last_name_field]; + $address1 = $row[$address1_field]; + $address2 = $row[$address2_field]; + $address3 = $row[$address3_field]; + $city =$row[$city_field]; + $state = $row[$state_field]; + $province = $row[$province_field]; + $postal_code = $row[$postal_code_field]; + $country_code = $row[$country_code_field]; + $gender = $row[$gender_field]; + $date_of_birth = $row[$date_of_birth_field]; + $alt_phone = eregi_replace("[^0-9]", "", $row[$alt_phone_field]); + $email = $row[$email_field]; + $security_phrase = $row[$security_phrase_field]; + $comments = trim($row[$comments_field]); + + if (strlen($list_id_override)>0) + { + $list_id = $list_id_override; + } + if (strlen($phone_code_override)>0) + { + $phone_code = $phone_code_override; + } + + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if (eregi("DUPCAMP",$dupcheck)) + { + $dup_lead=0; + $dup_lists=''; + $stmt="select campaign_id from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $ci_recs = mysql_num_rows($rslt); + if ($ci_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_camp = $row[0]; + + $stmt="select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $rslt=mysql_query($stmt, $link); + $li_recs = mysql_num_rows($rslt); + if ($li_recs > 0) + { + $L=0; + while ($li_recs > $L) + { + $row=mysql_fetch_row($rslt); + $dup_lists .= "'$row[0]',"; + $L++; + } + $dup_lists = eregi_replace(",$",'',$dup_lists); + + $stmt="select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + } + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if (eregi("DUPSYS",$dupcheck)) + { + $dup_lead=0; + $stmt="select list_id from vicidial_list where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if (eregi("DUPLIST",$dupcheck)) + { + $dup_lead=0; + $stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_lead = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + if ( (strlen($phone_number)>6) and ($dup_lead<1) ) + { + if (strlen($phone_code)<1) {$phone_code = '1';} + + $US='_'; + $phone_list .= "$phone_number$US$list_id|"; + + $gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code); + + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + } + print ""; + } + +if ($leadfile && filesize($LF_path)<=8388608) { + $total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list=''; + if ($file_layout=="standard") { + + print ""; + flush(); + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) { + + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"); + $lead_file = "./vicidial_temp_file.txt"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.txt"); + $lead_file = "/tmp/vicidial_temp_file.txt"; + } + $file=fopen("$lead_file", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + + if (count($field_check)>=5) { + flush(); + $file=fopen("$lead_file", "r"); + $total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list=''; + print "
Verarbeitung$delim_name-delimited file... ($tab_count|$pipe_count)\n"; + if (strlen($list_id_override)>0) + { + print "

LISTE IDENTIFIKATION OVERRIDE FOR THIS FILE: $list_id_override

"; + } + if (strlen($phone_code_override)>0) + { + print "

TELEFON-CODE-ÜBERSTEUERUNG FÜR DIESE AKTE: $phone_code_override

\n"; + } + while (!feof($file)) { + $record++; + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + + if (strlen($buffer)>0) { + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[0]; + $source_code = $row[1]; + $source_id=$source_code; + $list_id = $row[2]; + $gmt_offset = '0'; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[3]); + $phone_number = eregi_replace("[^0-9]", "", $row[4]); + $USarea = substr($phone_number, 0, 3); + $title = $row[5]; + $first_name = $row[6]; + $middle_initial = $row[7]; + $last_name = $row[8]; + $address1 = $row[9]; + $address2 = $row[10]; + $address3 = $row[11]; + $city =$row[12]; + $state = $row[13]; + $province = $row[14]; + $postal_code = $row[15]; + $country_code = $row[16]; + $gender = $row[17]; + $date_of_birth = $row[18]; + $alt_phone = eregi_replace("[^0-9]", "", $row[19]); + $email = $row[20]; + $security_phrase = $row[21]; + $comments = trim($row[22]); + + if (strlen($list_id_override)>0) + { + $list_id = $list_id_override; + } + if (strlen($phone_code_override)>0) + { + $phone_code = $phone_code_override; + } + + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if (eregi("DUPCAMP",$dupcheck)) + { + $dup_lead=0; + $dup_lists=''; + $stmt="select campaign_id from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $ci_recs = mysql_num_rows($rslt); + if ($ci_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_camp = $row[0]; + + $stmt="select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $rslt=mysql_query($stmt, $link); + $li_recs = mysql_num_rows($rslt); + if ($li_recs > 0) + { + $L=0; + while ($li_recs > $L) + { + $row=mysql_fetch_row($rslt); + $dup_lists .= "'$row[0]',"; + $L++; + } + $dup_lists = eregi_replace(",$",'',$dup_lists); + + $stmt="select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + } + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if (eregi("DUPSYS",$dupcheck)) + { + $dup_lead=0; + $stmt="select list_id from vicidial_list where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if (eregi("DUPLIST",$dupcheck)) + { + $dup_lead=0; + $stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_lead = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + if ( (strlen($phone_number)>6) and ($dup_lead<1) ) + { + if (strlen($phone_code)<1) {$phone_code = '1';} + + $US='_'; + $phone_list .= "$phone_number$US$list_id|"; + + $gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code); + + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } else { + print "
STÖRUNG: Die Akte hat nicht die erforderliche Zahl vonauffängt, um sie zu verarbeiten.
"; + } + } else if (!eregi(".csv", $leadfile_name)) + { + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"); + $lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.xls"); + $lead_file = "/tmp/vicidial_temp_file.xls"; + } + $file=fopen("$lead_file", "r"); + + # echo "|$WeBServeRRooT/vicidial/listloader.pl --forcelistid=$list_id_override --lead-file=$lead_file|"; + $dupcheckCLI=''; $postalgmtCLI=''; + if (eregi("DUPLIST",$dupcheck)) {$dupcheckCLI='--duplicate-check';} + if (eregi("DUPCAMP",$dupcheck)) {$dupcheckCLI='--duplicate-campaign-check';} + if (eregi("DUPSYS",$dupcheck)) {$dupcheckCLI='--duplicate-system-check';} + if (eregi("POSTAL",$postalgmt)) {$postalgmtCLI='--postal-code-gmt';} + passthru("$WeBServeRRooT/vicidial/listloader.pl --forcelistid=$list_id_override --forcephonecode=$phone_code_override --lead-file=$lead_file $postalgmtCLI $dupcheckCLI"); + + } + else + { + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"); + $lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.csv"); + $lead_file = "/tmp/vicidial_temp_file.csv"; + } + $file=fopen("$lead_file", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + print "
VerarbeitungCSV file... \n"; + + if (strlen($list_id_override)>0) + { + print "

LISTE IDENTIFIKATION OVERRIDE FOR THIS FILE: $list_id_override

"; + } + if (strlen($phone_code_override)>0) + { + print "

TELEFON-CODE-ÜBERSTEUERUNG FÜR DIESE AKTE: $phone_code_override

"; + } + + while($row=fgetcsv($file, 1000, ",")) { + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[0]; + $source_code = $row[1]; + $source_id=$source_code; + $list_id = $row[2]; + $gmt_offset = '0'; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[3]); + $phone_number = eregi_replace("[^0-9]", "", $row[4]); + $USarea = substr($phone_number, 0, 3); + $title = $row[5]; + $first_name = $row[6]; + $middle_initial = $row[7]; + $last_name = $row[8]; + $address1 = $row[9]; + $address2 = $row[10]; + $address3 = $row[11]; + $city =$row[12]; + $state = $row[13]; + $province = $row[14]; + $postal_code = $row[15]; + $country_code = $row[16]; + $gender = $row[17]; + $date_of_birth = $row[18]; + $alt_phone = eregi_replace("[^0-9]", "", $row[19]); + $email = $row[20]; + $security_phrase = $row[21]; + $comments = trim($row[22]); + + if (strlen($list_id_override)>0) + { + $list_id = $list_id_override; + } + if (strlen($phone_code_override)>0) + { + $phone_code = $phone_code_override; + } + + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if (eregi("DUPCAMP",$dupcheck)) + { + $dup_lead=0; + $dup_lists=''; + $stmt="select campaign_id from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $ci_recs = mysql_num_rows($rslt); + if ($ci_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_camp = $row[0]; + + $stmt="select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $rslt=mysql_query($stmt, $link); + $li_recs = mysql_num_rows($rslt); + if ($li_recs > 0) + { + $L=0; + while ($li_recs > $L) + { + $row=mysql_fetch_row($rslt); + $dup_lists .= "'$row[0]',"; + $L++; + } + $dup_lists = eregi_replace(",$",'',$dup_lists); + + $stmt="select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + } + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if (eregi("DUPSYS",$dupcheck)) + { + $dup_lead=0; + $stmt="select list_id from vicidial_list where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if (eregi("DUPLIST",$dupcheck)) + { + $dup_lead=0; + $stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_lead = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + if ( (strlen($phone_number)>6) and ($dup_lead<1) ) + { + if (strlen($phone_code)<1) {$phone_code = '1';} + + $US='_'; + $phone_list .= "$phone_number$US$list_id|"; + + $gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code); + + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } + print ""; + + } else { + print "
"; + flush(); + print "\r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + + $rslt=mysql_query("select vendor_lead_code, source_id, list_id, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments from vicidial_list limit 1", $link); + + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) + { + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"); + $lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.txt"); + $lead_file = "/tmp/vicidial_temp_file.txt"; + } + $file=fopen("$lead_file", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + flush(); + $file=fopen("$lead_file", "r"); + print "
Verarbeitung$delim_name-delimited file...\n"; + + if (strlen($list_id_override)>0) + { + print "

LISTE IDENTIFIKATION OVERRIDE FOR THIS FILE: $list_id_override

"; + } + if (strlen($phone_code_override)>0) + { + print "

TELEFON-CODE-ÜBERSTEUERUNG FÜR DIESE AKTE: $phone_code_override

"; + } + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + for ($i=0; $i\r\n"; + print "
\r\n"; + print " \r\n"; + print " \r\n"; + + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + } + } + else if (!eregi(".csv", $leadfile_name)) + { + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"); + $lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.xls"); + $lead_file = "/tmp/vicidial_temp_file.xls"; + } + + # echo "|$WeBServeRRooT/vicidial/listloader_rowdisplay.pl --lead-file=$lead_file|"; + $dupcheckCLI=''; $postalgmtCLI=''; + if (eregi("DUPLIST",$dupcheck)) {$dupcheckCLI='--duplicate-check';} + if (eregi("DUPCAMP",$dupcheck)) {$dupcheckCLI='--duplicate-campaign-check';} + if (eregi("DUPSYS",$dupcheck)) {$dupcheckCLI='--duplicate-system-check';} + if (eregi("POSTAL",$postalgmt)) {$postalgmtCLI='--postal-code-gmt';} + passthru("$WeBServeRRooT/vicidial/listloader_rowdisplay.pl --lead-file=$lead_file $postalgmtCLI $dupcheckCLI"); + } + else + { + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"); + $lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.csv"); + $lead_file = "/tmp/vicidial_temp_file.csv"; + } + $file=fopen("$lead_file", "r"); + + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + print "
VerarbeitungCSV file... \n"; + + if (strlen($list_id_override)>0) + { + print "

LISTE IDENTIFIKATION OVERRIDE FOR THIS FILE: $list_id_override

"; + } + if (strlen($phone_code_override)>0) + { + print "

TELEFON-CODE-ÜBERSTEUERUNG FÜR DIESE AKTE: $phone_code_override

"; + } + + $total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list=''; + $row=fgetcsv($file, 1000, ","); + for ($i=0; $i\r\n"; + print "
\r\n"; + print " \r\n"; + print " \r\n"; + + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + } + } + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print "
VICIDIAL SpalteAkte Daten
".strtoupper(eregi_replace("_", " ", mysql_field_name($rslt, $i))).":
$row[$i]
".strtoupper(eregi_replace("_", " ", mysql_field_name($rslt, $i))).":
$row[$i]
        
\r\n"; + # } + print ""; + } +} else if (filesize($leadfile)>8388608) { + print "
STÖRUNG: Akte übersteigt die Begrenzung 8MB.
"; +} +?> + + + + + + + + +4) ) + { + if (preg_match('/^1$/', $phone_code)) + { + $stmt="select * from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[2]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[3]; + $dst_range = $row[4]; + $PC_processed++; + $postalgmt_found++; + $post++; + } + } + } +if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =='1') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### MEXICO ### + if ($phone_code =='52') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### AUSTRALIA ### + if ($phone_code =='61') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $PC_processed++; + $stmt="select * from vicidial_phone_codes where country_code='$phone_code';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + } + +### Find out if DST to raise the gmt offset ### +$AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); +$AC_localtime = mktime(($Shour + $AC_GMT_diff), $Smin, $Ssec, $Smon, $Smday, $Syear); + $hour = date("H",$AC_localtime); + $min = date("i",$AC_localtime); + $sec = date("s",$AC_localtime); + $mon = date("m",$AC_localtime); + $mday = date("d",$AC_localtime); + $wday = date("w",$AC_localtime); + $year = date("Y",$AC_localtime); +$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + +$AC_processed=0; +if ( (!$AC_processed) and ($dst_range == 'SSM-FSN') ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + #********************************************************************** + # SSM-FSN + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on Second Sunday March to First Sunday November at 2 am. + # INPUTS: + # mm INTEGER Month. + # dd INTEGER Day of the month. + # ns INTEGER Seconds into the day. + # dow INTEGER Day of week (0=Sunday, to 6=Saturday) + # OPTIONAL INPUT: + # timezone INTEGER hour difference UTC - local standard time + # (DEFAULT is blank) + # make calculations based on UTC time, + # which means shift at 10:00 UTC in April + # and 9:00 UTC in October + # OUTPUT: + # INTEGER 1 = DST, 0 = not DST + # + # S M T W T F S + # 1 2 3 4 5 6 7 + # 8 9 10 11 12 13 14 + #15 16 17 18 19 20 21 + #22 23 24 25 26 27 28 + #29 30 31 + # + # S M T W T F S + # 1 2 3 4 5 6 + # 7 8 9 10 11 12 13 + #14 15 16 17 18 19 20 + #21 22 23 24 25 26 27 + #28 29 30 31 + # + #********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; + } elseif ($mm >= 4 and $mm <= 10) { + $USACAN_DST=1; + } elseif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; + } elseif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } + } else { + $USACAN_DST=0; + } + } elseif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; + } elseif ($dd < ($dow+1)) { + $USACAN_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } else { # lokale Zeit calculations + if ($ns < 7200) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } + } else { + $USACAN_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$gmt_offset++;} + $AC_processed++; + } + +if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + #********************************************************************** + # FSA-LSO + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in April and last Sunday in October at 2 am. + #********************************************************************** + + $USA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $USA_DST=0; + } elseif ($mm >= 5 and $mm <= 9) { + $USA_DST=1; + } elseif ($mm == 4) { + if ($dd > 7) { + $USA_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } + } else { + $USA_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $USA_DST=1; + } elseif ($dd < ($dow+25)) { + $USA_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } else { # lokale Zeit calculations + if ($ns < 7200) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } + } else { + $USA_DST=0; + } + } # end of month checks + + if ($DBX) {print " DST: $USA_DST\n";} + if ($USA_DST) {$gmt_offset++;} + $AC_processed++; + } + +if ( (!$AC_processed) and ($dst_range == 'LSM-LSO') ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in March and last Sunday in October at 1 am. + #********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; + } elseif ($mm >= 4 and $mm <= 9) { + $GBR_DST=1; + } elseif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; + } elseif ($dd < ($dow+25)) { + $GBR_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } else { # lokale Zeit calculations + if ($ns < 3600) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } + } else { + $GBR_DST=1; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; + } elseif ($dd < ($dow+25)) { + $GBR_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } else { # lokale Zeit calculations + if ($ns < 3600) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } + } else { + $GBR_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } +if ( (!$AC_processed) and ($dst_range == 'LSO-LSM') ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUS_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; + } elseif ($dd < ($dow+25)) { + $AUS_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } else { # lokale Zeit calculations + if ($ns < 3600) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } + } else { + $AUS_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; + } elseif ($dd < ($dow+25)) { + $AUS_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } else { # lokale Zeit calculations + if ($ns < 3600) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } + } else { + $AUS_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + +if ( (!$AC_processed) and ($dst_range == 'FSO-LSM') ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + #********************************************************************** + # TASMANIA ONLY + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUST_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; + } elseif ($dd < ($dow+25)) { + $AUST_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } else { # lokale Zeit calculations + if ($ns < 3600) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } + } else { + $AUST_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $AUST_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } + } else { + $AUST_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } +if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and third Sunday in March at 1 am. + #********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $NZL_DST=0; + } elseif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; + } elseif ($dd < ($dow+14)) { + $NZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } else { # lokale Zeit calculations + if ($ns < 3600) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } + } else { + $NZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $NZL_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } + } else { + $NZL_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + +if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + #********************************************************************** + # TSO-LSF + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. Brazil + # Based on Third Sunday October to Last Sunday February at 1 am. + #********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; + } elseif ($mm >= 3 and $mm <= 9) { + $BZL_DST=0; + } elseif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; + } elseif ($dd < ($dow+22)) { + $BZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } else { # lokale Zeit calculations + if ($ns < 3600) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } + } else { + $BZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; + } elseif ($dd < ($dow+22)) { + $BZL_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } else { # lokale Zeit calculations + if ($ns < 3600) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } + } else { + $BZL_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$gmt_offset++;} + $AC_processed++; + } + +if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + +return $gmt_offset; +} \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/remote_dispo.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/remote_dispo.php new file mode 100644 index 00000000..01d5eb2d --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/remote_dispo.php @@ -0,0 +1,327 @@ + LICENSE: GPLv2 +### +# this is the remote agent disposition screen for calls sent to remote agents. This allows the remote agent to modify customer information and disposition the call + +# CHANGES +# +# 60619-1626 - Added variable filtering to eliminate SQL injection attack threat +# + + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +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["alt_phone"])) {$alt_phone=$_GET["alt_phone"];} + elseif (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];} +if (isset($_GET["call_began"])) {$call_began=$_GET["call_began"];} + elseif (isset($_POST["call_began"])) {$call_began=$_POST["call_began"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];} + elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];} +if (isset($_GET["city"])) {$city=$_GET["city"];} + elseif (isset($_POST["city"])) {$city=$_POST["city"];} +if (isset($_GET["comments"])) {$comments=$_GET["comments"];} + elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];} +if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];} + elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];} +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["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];} + elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];} +if (isset($_GET["email"])) {$email=$_GET["email"];} + elseif (isset($_POST["email"])) {$email=$_POST["email"];} +if (isset($_GET["end_call"])) {$end_call=$_GET["end_call"];} + elseif (isset($_POST["end_call"])) {$end_call=$_POST["end_call"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];} + elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];} + elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["parked_time"])) {$parked_time=$_GET["parked_time"];} + elseif (isset($_POST["parked_time"])) {$parked_time=$_POST["parked_time"];} +if (isset($_GET["pass"])) {$pass=$_GET["pass"];} + elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];} +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["phone"])) {$phone=$_GET["phone"];} + elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];} +if (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];} + elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];} +if (isset($_GET["province"])) {$province=$_GET["province"];} + elseif (isset($_POST["province"])) {$province=$_POST["province"];} +if (isset($_GET["security"])) {$security=$_GET["security"];} + elseif (isset($_POST["security"])) {$security=$_POST["security"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["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["session_id"])) {$session_id=$_GET["session_id"];} + elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];} +if (isset($_GET["state"])) {$state=$_GET["state"];} + elseif (isset($_POST["state"])) {$state=$_POST["state"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["tsr"])) {$tsr=$_GET["tsr"];} + elseif (isset($_POST["tsr"])) {$tsr=$_POST["tsr"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_datetime = $STARTtime; + +$ext_context = 'demo'; +if (!isset($begin_date)) {$begin_date = $TODAY;} +if (!isset($end_date)) {$end_date = $TODAY;} + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 2;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Unzulässiges Username/Kennwort:|$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + } + else + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +?> + + +VICIDIAL DIREKTÜBERTRAGUNG: Anruf-Einteilung +\n"; +?> + + +
+ +"; + +if ($end_call > 0) +{ + +$call_length = ($STARTtime - $call_began); + + ### insert a NEW record to the vicidial_closer_log table + $stmt="UPDATE vicidial_closer_log set end_epoch='$STARTtime', length_in_sec='" . mysql_real_escape_string($call_length) . "', status='" . mysql_real_escape_string($status) . "', user='$PHP_AUTH_USER' where lead_id='" . mysql_real_escape_string($lead_id) . "' order by start_epoch desc limit 1;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ### update the lead record in the vicidial_list table + $stmt="UPDATE vicidial_list set status='" . mysql_real_escape_string($status) . "',first_name='" . mysql_real_escape_string($first_name) . "',last_name='" . mysql_real_escape_string($last_name) . "',address1='" . mysql_real_escape_string($address1) . "',address2='" . mysql_real_escape_string($address2) . "',address3='" . mysql_real_escape_string($address3) . "',city='" . mysql_real_escape_string($city) . "',state='" . mysql_real_escape_string($state) . "',province='" . mysql_real_escape_string($province) . "',postal_code='" . mysql_real_escape_string($postal_code) . "',country_code='" . mysql_real_escape_string($country_code) . "',alt_phone='" . mysql_real_escape_string($alt_phone) . "',email='" . mysql_real_escape_string($email) . "',security_phrase='" . mysql_real_escape_string($security) . "',comments='" . mysql_real_escape_string($comments) . "',user='$PHP_AUTH_USER' where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "Anruf ist dispositioned gewesen       $NOW_TIME\n

\n"; + + echo "
\n"; + +} +else +{ + $stmt="SELECT count(*) from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_count = $row[0]; + + if ($lead_count > 0) + { + + $stmt="SELECT * from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_id = "$row[0]"; + $tsr = "$row[4]"; + $vendor_id = "$row[5]"; + $list_id = "$row[7]"; + $campaign_id = "$row[8]"; + $phone_code = "$row[10]"; + $phone_number = "$row[11]"; + $title = "$row[12]"; + $first_name = "$row[13]"; # + $middle_initial = "$row[14]"; + $last_name = "$row[15]"; # + $address1 = "$row[16]"; # + $address2 = "$row[17]"; # + $address3 = "$row[18]"; # + $city = "$row[19]"; # + $state = "$row[20]"; # + $province = "$row[21]"; # + $postal_code = "$row[22]"; # + $country_code = "$row[23]"; # + $gender = "$row[24]"; + $date_of_birth = "$row[25]"; + $alt_phone = "$row[26]"; # + $email = "$row[27]"; # + $security = "$row[28]"; # + $comments = "$row[29]"; # + + echo "
Anrufinformationen: $first_name $last_name - $phone_number

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + echo "\n"; + echo "
Vendor ID: $vendor_id     Kampagne Identifikation: $campaign_id
Fronter: $tsr     Liste Identifikation: $list_id
Vorname:   \n"; + echo " Letzter Name:
  \n"; + echo "Postcode:
\n"; + echo "


\n"; + + } + else + { + echo "Leitung Nachschlagen FIEL für lead_id aus $lead_id       $NOW_TIME\n

\n"; +# echo "Close this window\n

\n"; + } + + + + + + +} + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nIndexlaufzeit: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/server_stats.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/server_stats.php new file mode 100644 index 00000000..0040f875 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/server_stats.php @@ -0,0 +1,97 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60620-1037 - Added Link back to Admin section +# - Added required user/pass to gain access to this page +# 61101-1331 - Added SIP/IAX listen/barge links +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Unzulässiges Username/Kennwort:|$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($query_date)) {$query_date = $NOW_DATE;} + +$stmt="select * from servers;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$servers_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $servers_to_print) + { + $row=mysql_fetch_row($rslt); + $server_id[$i] = $row[0]; + $server_description[$i] = $row[1]; + $server_ip[$i] = $row[2]; + $active[$i] = $row[3]; + $i++; + } +?> + + + + + +VICIDIAL: Bediener-Notfall and Reports +VICIDIAL: Bediener-Notfall and Reports                           +ZURÜCK ZU ADMIN

+ + +

+
+ $o)
+	{
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	$o++;
+	}
+
+?>
+
SERVERBESCHREIBUNGIP ADDRESSAKTIVVDAD timeVDcall timePARK timeCLOSER/INBOUND time
$server_id[$o]$server_description[$o]$server_ip[$o]$active[$o]LINKLINKLINKLINK
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/user_stats.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/user_stats.php new file mode 100644 index 00000000..8b7ac6eb --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/user_stats.php @@ -0,0 +1,408 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1743 - Added variable filtering to eliminate SQL injection attack threat +# 61201-1136 - Added recordings display and changed calls to time range with 10000 limit +# 70118-1605 - Added user group column to login/out and calls lists +# 70702-1231 - Added recording location link and truncation +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["begin_date"])) {$begin_date=$_GET["begin_date"];} + elseif (isset($_POST["begin_date"])) {$begin_date=$_POST["begin_date"];} +if (isset($_GET["end_date"])) {$end_date=$_GET["end_date"];} + elseif (isset($_POST["end_date"])) {$end_date=$_POST["end_date"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); + +if (!isset($begin_date)) {$begin_date = $TODAY;} +if (!isset($end_date)) {$end_date = $TODAY;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and view_reports='1';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Unzulässiges Username/Kennwort:|$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + + $stmt="SELECT full_name from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + } + + + + +?> + + +VICIDIAL ADMIN: User Stats +\n"; +?> + + +
+ + + + + +\n"; +echo "
" ?>   VICIDIAL ADMIN: User Stats for  
  \n"; + +echo "
\n"; +echo "\n"; +echo " to \n"; +echo "  \n"; +echo "\n"; + + +echo "           $user - $full_name\n"; + +echo " - VICIDIAL Time Sheet\n"; +echo " - User Status\n"; +echo " - Ändern Sie Benutzer\n"; + + +echo "
\n"; + + + $stmt="SELECT count(*),status, sum(length_in_sec) from vicidial_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' group by status order by status"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + +echo "
\n"; + +echo "GESPRÄCH ZEIT UND STATUS:\n"; + +echo "
\n"; +echo "\n"; + + $total_calls=0; + $o=0; + while ($statuses_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $call_seconds = $row[2]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} + + echo ""; + echo "\n"; + echo "\n"; + $total_calls = ($total_calls + $row[0]); + + $call_seconds=0; + $o++; + } + + $stmt="SELECT sum(length_in_sec) from vicidial_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59'"; + $rslt=mysql_query($stmt, $link); + $counts_to_print = mysql_num_rows($rslt); + $row=mysql_fetch_row($rslt); + $call_seconds = $row[0]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} + +echo "\n"; +echo "
STATUSZÄHLIMPULSHOURS:MINUTES
$row[1] $row[0] $call_hours_int:$call_minutes_int
GESAMTANRUFE $total_calls $call_hours_int:$call_minutes_int
\n"; +echo "

\n"; + +echo "
\n"; + +echo "LOGIN/LOGOUT ZEIT:\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT event,event_epoch,event_date,campaign_id,user_group from vicidial_user_log where user='" . mysql_real_escape_string($user) . "' and event_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and event_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59'"; + $rslt=mysql_query($stmt, $link); + $events_to_print = mysql_num_rows($rslt); + + $total_calls=0; + $o=0; + $event_start_seconds=''; + $event_stop_seconds=''; + while ($events_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("LOGIN", $row[0])) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + if (ereg("LOGIN", $row[0])) + { + $event_start_seconds = $row[1]; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + if (ereg("LOGOUT", $row[0])) + { + if ($event_start_seconds) + { + $event_stop_seconds = $row[1]; + $event_seconds = ($event_stop_seconds - $event_start_seconds); + $total_login_time = ($total_login_time + $event_seconds); + $event_hours = ($event_seconds / 3600); + $event_hours = round($event_hours, 2); + $event_hours_int = intval("$event_hours"); + $event_minutes = ($event_hours - $event_hours_int); + $event_minutes = ($event_minutes * 60); + $event_minutes_int = round($event_minutes, 0); + if ($event_minutes_int < 10) {$event_minutes_int = "0$event_minutes_int";} + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + $event_start_seconds=''; + $event_stop_seconds=''; + } + else + { + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + } + } + + $total_calls = ($total_calls + $row[0]); + + $call_seconds=0; + $o++; + } + +$total_login_hours = ($total_login_time / 3600); +$total_login_hours = round($total_login_hours, 2); +$total_login_hours_int = intval("$total_login_hours"); +$total_login_minutes = ($total_login_hours - $total_login_hours_int); +$total_login_minutes = ($total_login_minutes * 60); +$total_login_minutes_int = round($total_login_minutes, 0); +if ($total_login_minutes_int < 10) {$total_login_minutes_int = "0$total_login_minutes_int";} + +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "
FALL DATUM KAMPAGNE GROUPHOURS:MINUTES
$row[0] $row[2] $row[3] $row[4]
$row[0] $row[2] $row[3] $row[4] $event_hours_int:$event_minutes_int
$row[0] $row[2] $row[3]
GESAMTMENGE $total_login_hours_int:$total_login_minutes_int
\n"; + + +echo "

\n"; + +echo "
\n"; + +echo "OUTBOUND CALLS FOR THIS TIME PERIOD: (10000 record limit)\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from vicidial_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $u++; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + } + + +echo "
# DATE/TIME LENGTH STATUS PHONE KAMPAGNE GROUP LIST LEAD
$u$row[4] $row[7] $row[8] $row[10] $row[3] $row[14] $row[2] $row[1]


\n"; + + + +echo "CLOSER CALLS FOR THIS TIME PERIOD: (10000 record limit)\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from vicidial_closer_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $u++; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + } + + +echo "
# DATE/TIME LENGTH STATUS PHONE KAMPAGNE WAIT (S) LIST LEAD
$u$row[4] $row[7] $row[8] $row[10] $row[3] $row[14] $row[2] $row[1]


\n"; + + + + +echo "RECORDINGS FOR THIS TIME PERIOD: (10000 record limit)\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from recording_log where user='" . mysql_real_escape_string($user) . "' and start_time >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and start_time <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by recording_id desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) + { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $location = $row[11]; + if (strlen($location)>30) + {$locat = substr($location,0,27); $locat = "$locat...";} + else + {$locat = $location;} + if (eregi("http",$location)) + {$location = "$locat";} + else + {$location = $locat;} + $u++; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + } + + +echo "
# LEADDATE/TIME SECONDS   RECIDFILENAMELOCATION  
$u $row[12] $row[4] $row[8] $row[0] $row[10] $location  
\n"; + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nIndexlaufzeit: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/user_status.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/user_status.php new file mode 100644 index 00000000..cfd46c20 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/user_status.php @@ -0,0 +1,242 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1738 - Added variable filtering to eliminate SQL injection attack threat +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["begin_date"])) {$begin_date=$_GET["begin_date"];} + elseif (isset($_POST["begin_date"])) {$begin_date=$_POST["begin_date"];} +if (isset($_GET["end_date"])) {$end_date=$_GET["end_date"];} + elseif (isset($_POST["end_date"])) {$end_date=$_POST["end_date"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); + +if (!isset($begin_date)) {$begin_date = $TODAY;} +if (!isset($end_date)) {$end_date = $TODAY;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and view_reports='1';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Unzulässiges Username/Kennwort:|$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $stmt="SELECT full_name,change_agent_campaign from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $change_agent_campaign=$row[1]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + + $stmt="SELECT full_name,user_group from vicidial_users where user='" . mysql_real_escape_string($user) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + $user_group = $row[1]; + + $stmt="SELECT * from vicidial_live_agents where user='" . mysql_real_escape_string($user) . "';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $agents_to_print = mysql_num_rows($rslt); + $i=0; + while ($i < $agents_to_print) + { + $row=mysql_fetch_row($rslt); + $Aserver_ip = $row[2]; + $Asession_id = $row[3]; + $Aextension = $row[4]; + $Astatus = $row[5]; + $Acampaign = $row[7]; + $Alast_call = $row[14]; + $Acl_campaigns = $row[15]; + $i++; + } + + } + +$stmt="select * from vicidial_campaigns;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + + + +?> + + +VICIDIAL ADMIN: User Status +\n"; +?> + + +
+
+ + + + +\n"; +echo "
" ?>   VICIDIAL ADMIN: User Status for  
  \n"; + +if ($stage == "live_campaign_change") +{ + $stmt="UPDATE vicidial_live_agents set campaign_id='" . mysql_real_escape_string($group) . "' where user='" . mysql_real_escape_string($user) . "';"; + $rslt=mysql_query($stmt, $link); + + echo "Agent $user - $full_name changed to $group campaign
\n"; + + exit; +} + +if ($stage == "log_agent_out") +{ + $stmt="DELETE from vicidial_live_agents where user='" . mysql_real_escape_string($user) . "';"; + $rslt=mysql_query($stmt, $link); + + echo "Agent $user - $full_name has been emergency logged out, make sure they close their web browser
\n"; + + exit; +} + +if ($agents_to_print > 0) +{ + echo "
";
+	echo "Agent Logged in at server:  $Aserver_ip\n";
+	echo "               in session:  $Asession_id\n";
+	echo "               from phone:  $Aextension\n";
+	echo "Agent is in campaign:       $Acampaign\n";
+	echo "              status:       $Astatus\n";
+	echo " hungup last call at:       $Alast_call\n";
+	echo "       Closer groups:       $Acl_campaigns\n\n";
+
+	echo "
"; + + + if ($change_agent_campaign > 0) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "Current Kampagne: \n"; + echo "
\n"; + + + echo "
\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + } +} + +else +{ + echo "Agent is not logged in\n
"; + +} + + +echo "           $user - $full_name \n"; +echo "       GROUP: $user_group

\n"; + +echo "VICIDIAL Time Sheet\n"; +echo " - User Stats\n"; +echo " - Ändern Sie Benutzer\n"; + +echo "
\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nIndexlaufzeit: $RUNtime seconds
"; + +echo "|$stage|$group|"; + +?> + + +
+ + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/vdremote.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/vdremote.php new file mode 100644 index 00000000..58bcd035 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/vdremote.php @@ -0,0 +1,602 @@ + LICENSE: GPLv2 +# +# Changes +# 50307-1721 - First version +# 51123-1502 - removed requirement of PHP Globals=on +# 60421-1229 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1603 - Added variable filtering to eliminate SQL injection attack threat +# +# make sure you have added a user to the vicidial_users MySQL table with at least user_level 4 to access this page the first time + +$version = '1.1.12'; +$build = '60619-1603'; + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["ADD"])) {$ADD=$_GET["ADD"];} + elseif (isset($_POST["ADD"])) {$ADD=$_POST["ADD"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["force_logout"])) {$force_logout=$_GET["force_logout"];} + elseif (isset($_POST["force_logout"])) {$force_logout=$_POST["force_logout"];} +if (isset($_GET["groups"])) {$groups=$_GET["groups"];} + elseif (isset($_POST["groups"])) {$groups=$_POST["groups"];} +if (isset($_GET["remote_agent_id"])) {$remote_agent_id=$_GET["remote_agent_id"];} + elseif (isset($_POST["remote_agent_id"])) {$remote_agent_id=$_POST["remote_agent_id"];} +if (isset($_GET["user_start"])) {$user_start=$_GET["user_start"];} + elseif (isset($_POST["user_start"])) {$user_start=$_POST["user_start"];} +if (isset($_GET["number_of_lines"])) {$number_of_lines=$_GET["number_of_lines"];} + elseif (isset($_POST["number_of_lines"])) {$number_of_lines=$_POST["number_of_lines"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["conf_exten"])) {$conf_exten=$_GET["conf_exten"];} + elseif (isset($_POST["conf_exten"])) {$conf_exten=$_POST["conf_exten"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["groups"])) {$groups=$_GET["groups"];} + elseif (isset($_POST["groups"])) {$groups=$_POST["groups"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +if (!isset($force_logout)) {$force_logout = 0;} + +if ($force_logout) +{ + if( (strlen($PHP_AUTH_USER)>0) or (strlen($PHP_AUTH_PW)>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "Sie haben jetzt heraus geloggt. Danke\n"; + exit; +} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + +$popup_page = './closer_popup.php'; +$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='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 3;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Unzulässiges Username/Kennwort:|$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + + $stmt="SELECT count(*) from vicidial_remote_agents where user_start='$PHP_AUTH_USER';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $authx=$row[0]; + + if($authx>0) + { + $stmt="SELECT remote_agent_id,server_ip,number_of_lines from vicidial_remote_agents where user_start='$PHP_AUTH_USER';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id=$row[0]; + $server_ip=$row[1]; + if (!$number_of_lines) {$number_of_lines=$row[2];} + + fwrite ($fp, "VDremote|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VDremote|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + echo "This remote agent does not exist: |$PHP_AUTH_USER|\n"; + exit; + } + } + else + { + fwrite ($fp, "VDremote|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +echo "\n"; +if ($ADD==61111) + { + echo"\n"; + } +echo "\n"; +?> + +VICIDIAL DIREKTÜBERTRAGUNG MITTEL: $LOGfullname - $PHP_AUTH_USER "; + +if (!$ADD) {$ADD="31111";} +if ($ADD==31111) {echo "Ändern Sie Remotemittel";} +if ($ADD==41111) {echo "Ändern Sie Remotemittel";} +if ($ADD==61111) {echo "Remote Agent Status";} +if ($ADD==71111) {echo "Remote Agent Closer Stats";} + + +if (strlen($ADD)>4) + { + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rslt=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rslt); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $servers_list .= "\n"; + $o++; + } + + ##### get campaigns listing for dynamic pulldown + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + $campaigns_list=''; + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $campaigns_list .= "\n"; + $o++; + } + + ##### get inbound groups listing for checkboxes + if ( (($ADD==31111) or ($ADD==31111)) and (count($groups)<1) ) + { + $stmt="SELECT closer_campaigns from vicidial_remote_agents where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + $stmt="SELECT group_id,group_name from vicidial_inbound_groups order by group_id"; + $rslt=mysql_query($stmt, $link); + $groups_to_print = mysql_num_rows($rslt); + $groups_list=''; + $groups_value=''; + + $o=0; + while ($groups_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $group_id_value = $rowx[0]; + $group_name_value = $rowx[1]; + $groups_list .= "2) {$groups_value .= " -";} + } + +?> + + + +
+
+ + + +
  VICIDIAL DIREKTÜBERTRAGUNG MITTEL:   Logout  
  ÄNDERN Sie | ">STATUS | ">INBOUND NOTFALL
+"; + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + +echo "
ÄNDERN Sie Eine REMOTEMITTEL-EINTRAGUNG: $row[0]
\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Benutzernummer Anfang: $user_start
Zeilenzahl: (nur Zahlen)
Bediener IP: $row[3]
Externe Verlängerung: (number dialed to reach agents [i.e. 913125551212])
Status:
Kampagne: $campaign_id
Inbound Gruppen: \n"; +echo "$groups_list"; +echo "
\n"; +echo "ANMERKUNG: Sie kann bis 30 Sekunden für die Änderungen dauern, dieauf diesem Schirm eingereicht werden, um Phasen zu gehen\n"; + +} + + + + +###################### +# ADD=41111 modify remote agents info in the system +###################### + +if ($ADD==41111) +{ + echo ""; + + if ( (strlen($number_of_lines) < 1) or (strlen($conf_exten) < 2) ) + {echo "
REMOTEMITTEL NICHT GEÄNDERT - gehen Sie bitte zurück und betrachtenSie die Daten, die Sie eingaben\n";} + else + { + $stmt="UPDATE vicidial_remote_agents set number_of_lines='" . mysql_real_escape_string($number_of_lines) . "', conf_exten='" . mysql_real_escape_string($conf_exten) . "', status='" . mysql_real_escape_string($status) . "', closer_campaigns='" . mysql_real_escape_string($groups_value) . "' where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';"; + $rslt=mysql_query($stmt, $link); + +# echo "$stmt\n"; + echo "
REMOTEMITTEL GEÄNDERT\n"; + + ### LOG CHANGES TO LOG FILE ### + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY REMOTEMITTEL ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + + } + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + +echo "
ÄNDERN Sie Eine REMOTEMITTEL-EINTRAGUNG: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Benutzernummer Anfang: $user_start
Zeilenzahl: (nur Zahlen)
Bediener IP: $row[3]
Externe Verlängerung: (number dialed to reach agents [i.e. 913125551212])
Status:
Kampagne: $campaign_id
Inbound Gruppen: \n"; +echo "$groups_list"; +echo "
\n"; +echo "ANMERKUNG: Sie kann bis 30 Sekunden für die Änderungen dauern, dieauf diesem Schirm eingereicht werden, um Phasen zu gehen\n"; + +} + + + + +###################### +# ADD=61111 status of remote agent in the system and active calls and queue +###################### + +if ($ADD==61111) +{ + echo "
";
+
+	 if ( (strlen($server_ip) < 2) or (strlen($user) < 2) )
+		{echo "
REMOTEMITTEL-STÖRUNG - gehen Sie bitte zurück und betrachten Sie dieDaten, die Sie eingaben\n";} + else + { + + $users_list = ''; + $k=0; + while($k < $number_of_lines) + { + $nextuser=($user + $k); + $users_list .= "'" . mysql_real_escape_string($nextuser) . "',"; + $k++; + } + $users_list = preg_replace("/.$/","",$users_list); + + echo "VICIDIAL: Remote Agent Time On Calls $NOW_TIME\n\n"; + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + echo "| STATION | USER | LEADID | CHANNEL | STATUS | START TIME | MINUTES |\n"; + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + + + $stmt="select extension,user,lead_id,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish) from vicidial_live_agents where status NOT IN('PAUSED') and server_ip='" . mysql_real_escape_string($server_ip) . "' and user IN($users_list) order by extension;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + while ($i < $talking_to_print) + { + $leadlink=0; + $row=mysql_fetch_row($rslt); + if (eregi("READY|PAUSED",$row[4])) + { + $row[3]=''; + $row[5]='- WARTEND -'; + $row[6]=$row[7]; + } + $extension = sprintf("%-10s", $row[0]); + $user = sprintf("%-6s", $row[1]); + $leadid = sprintf("%-12s", $row[2]); + if ($row[2] > 0) + { + $leadidLINK=$row[2]; + $leadlink++; + if ( eregi("QUEUE",$row[4]) ) {$row[6]=$STARTtime;} + $leadid = "$leadid"; + } + $channel = sprintf("%-10s", $row[3]); + $cc=0; + while ( (strlen($channel) > 10) and ($cc < 100) ) + { + $channel = eregi_replace(".$","",$channel); + $cc++; + if (strlen($channel) <= 10) {$cc=101;} + } + $status = sprintf("%-6s", $row[4]); + $start_time = sprintf("%-19s", $row[5]); + $call_time_S = ($STARTtime - $row[6]); + + $call_time_M = ($call_time_S / 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"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + if ($call_time_M_int >= 5) {$G=''; $EG='';} + if ($call_time_M_int >= 10) {$G=''; $EG='';} + + echo "| $G$extension$EG | $G$user$EG | $G$leadid$EG | $G$channel$EG | $G$status$EG | $G$start_time$EG | $G$call_time_MS$EG |\n"; + + $i++; + } + + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + echo " $i Mittel geloggt innen auf Bediener $server_ip\n\n"; + + echo " - 5 Minuten oder mehr beim Anruf\n"; + echo " - Über 10 Minuten beim Anruf\n"; + + } + else + { + echo "**************************************************************************************\n"; + echo "*********************************KEINE MITTEL BEI DEN ANRUFEN*********************************\n"; + echo "**************************************************************************************\n"; + } + } + +echo "
\n\n"; + +} + + +###################### +# ADD=71111 stats for remote agents from closer logs(vicidial_closer_log) +###################### + +if ($ADD==71111) +{ + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n\n"; + echo "
";
+
+	 if ( (strlen($server_ip) < 2) or (strlen($user) < 2) )
+		{echo "
REMOTEMITTEL-STÖRUNG - gehen Sie bitte zurück und betrachten Sie dieDaten, die Sie eingaben\n";} + else + { + + $users_list = ''; + $k=0; + while($k < $number_of_lines) + { + $nextuser=($user + $k); + $users_list .= "'$nextuser',"; + $k++; + } + $users_list = preg_replace("/.$/","",$users_list); + + $stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and user IN($users_list);"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $in_calls = $row[0]; + $in_time = $row[1]; + $in_time_M = ($in_time / 60); + $in_time_M = round($in_time_M, 2); + $in_time_M_int = intval("$in_time_M"); + $in_time_SEC = ($in_time_M - $in_time_M_int); + $in_time_SEC = ($in_time_SEC * 60); + $in_time_SEC = round($in_time_SEC, 0); + if ($in_time_SEC < 10) {$in_time_SEC = "0$in_time_SEC";} + $in_time_MS = "$in_time_M_int:$in_time_SEC"; + $in_time_MS = sprintf("%7s", $in_time_MS); + + echo "VICIDIAL: Inbound Notfall des Remotemittels $NOW_TIME\n\n"; + echo "\n"; + echo "Gesamtanrufe genommen$query_date: $in_calls\n"; + echo "Gesamtgespräch Zeit an$query_date: $in_time_MS (minutes:seconds)\n"; + echo "\n"; + echo "\n"; + echo "Anrufliste für$query_date:\n"; + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + echo "| USER | LEADID | GROUP | PHONE NUM | STATUS | CALL TIME | MINUTES |\n"; + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + + + $stmt="select user,lead_id,campaign_id,phone_number,status,call_date,length_in_sec from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and user IN($users_list) order by call_date;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + while ($i < $talking_to_print) + { + $row=mysql_fetch_row($rslt); + $user = sprintf("%-8s", $row[0]); + $leadid = sprintf("%-10s", $row[1]); + $group = sprintf("%-14s", $row[2]); + $phone = sprintf("%-10s", $row[3]); + $status = sprintf("%-6s", $row[4]); + $start_time = sprintf("%-19s", $row[5]); + $call_time_S = $row[6]; + + $call_time_M = ($call_time_S / 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"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + # if ($call_time_M_int >= 5) {$G=''; $EG='';} + # if ($call_time_M_int >= 10) {$G=''; $EG='';} + + echo "| $G$user$EG | $G$leadid$EG | $G$group$EG | $G$phone$EG | $G$status$EG | $G$start_time$EG | $G$call_time_MS$EG |\n"; + + $i++; + } + + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + # echo " $i Mittel geloggt innen auf Bediener $server_ip\n\n"; + + # echo " - 5 Minuten oder mehr beim Anruf\n"; + # echo " - Über 10 Minuten beim Anruf\n"; + + } + else + { + echo "**************************************************************************************\n"; + echo "*********************************KEIN ERSUCHT UM DIESEN TAG*******************************\n"; + echo "**************************************************************************************\n"; + } + } + +echo "
\n\n"; + +} + + + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nIndexlaufzeit: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/welcome.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/welcome.php new file mode 100644 index 00000000..d4f31e18 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_de/welcome.php @@ -0,0 +1,25 @@ + LICENSE: GPLv2 +# + +echo "VICIDIAL Willkommen\n"; +echo "\n"; +echo "\n"; +echo "




"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Willkommen
 
Agent Login
 
Administration
 
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; + +?> \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_CLOSERstats.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_CLOSERstats.php new file mode 100644 index 00000000..b10caf49 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_CLOSERstats.php @@ -0,0 +1,617 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1714 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 60905-1326 - Added queue time stats +# 71008-1436 - Added shift to be defined in dbconnect.php +# 71025-0021 - Added status breakdown +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["shift"])) {$shift=$_GET["shift"];} + elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"];} + elseif (isset($_POST["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +if (strlen($shift)<2) {$shift='ALL';} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = '';} +if (!isset($query_date)) {$query_date = $NOW_DATE;} + +$stmt="select group_id from vicidial_inbound_groups;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: Στατιστικά VDAD Closer\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "           ΤΡΟΠΟΠΟΙΗΣΗ | ΑÎΑΦΟΡΕΣ \n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "ΠΑΡΑΚΑΛΩ ΕΠΙΛΕΞΤΕ ΜΙΑ ΕΚΣΤΡΑΤΕΙΑ ΚΑΙ ΜΙΑ ΗΜΕΡΟΜΗÎΙΑ ΑÎΩΤΕΡΩ, ΚΑΙ ΠΑΤΗΣΤΕ ΕΠΙΒΕΒΑΙΩΣΗ\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$time_BEGIN=$AM_shift_BEGIN;
+	$time_END=$AM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "03:45:00";}   
+	if (strlen($time_END) < 6) {$time_END = "15:15:00";}
+	}
+if ($shift == 'PM') 
+	{
+	$time_BEGIN=$PM_shift_BEGIN;
+	$time_END=$PM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "15:15:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:15:00";}
+	}
+if ($shift == 'ALL') 
+	{
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "00:00:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:59:59";}
+	}
+$query_date_BEGIN = "$query_date $time_BEGIN";   
+$query_date_END = "$query_date $time_END";
+
+
+
+echo "VICIDIAL: Στατιστικά αυτόματης κλήσης Closer                      $NOW_TIME\n";
+
+echo "\n";
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{$average_hold_seconds = '         0';}
+else
+	{
+	$average_hold_seconds = ($row[1] / $row[0]);
+	$average_hold_seconds = round($average_hold_seconds, 0);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+
+echo "Συνολικά κλήσεις που τοποθετήθηκαν από την ΕκστÏατεία: $TOTALcalls\n";
+echo "Average Call Length for all Calls:            $average_hold_seconds seconds\n";
+
+echo "\n";
+echo "---------- ΕΓΚΑΤΑΛ\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP' and (length_in_sec <= 999 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$DROPcalls =	sprintf("%10s", $row[0]);
+if ( ($DROPcalls < 1) or ($TOTALcalls < 1) )
+	{$DROPpercent = '0';}
+else
+	{
+	$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
+	$DROPpercent = round($DROPpercent, 0);
+	}
+
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{$average_hold_seconds = '         0';}
+else
+	{
+	$average_hold_seconds = ($row[1] / $row[0]);
+	$average_hold_seconds = round($average_hold_seconds, 0);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+
+echo "Συνολικά ΕΓΚΑΤΑΛΕΙΜΕÎΕΣ κλήσεις: $DROPcalls  $DROPpercent%\n";
+echo "Average hold time for DROP Calls:             $average_hold_seconds seconds\n";
+
+
+
+##############################
+#########  CALL STATUS STATS
+
+$TOTALcalls = 0;
+
+echo "\n";
+echo "---------- CALL STATUS STATS\n";
+echo "+--------+----------------------+------------+\n";
+echo "| STATUS | DESCRIPTION          | CALLS      |\n";
+echo "+--------+----------------------+------------+\n";
+
+$stmt="SELECT * from vicidial_statuses order by status";
+$rslt=mysql_query($stmt, $link);
+$statuses_to_print = mysql_num_rows($rslt);
+$statuses_list='';
+
+$o=0;
+while ($statuses_to_print > $o) 
+	{
+	$rowx=mysql_fetch_row($rslt);
+	$statname_list["$rowx[0]"] = "$rowx[1]";
+	$o++;
+	}
+
+$stmt="SELECT * from vicidial_campaign_statuses order by status";
+$rslt=mysql_query($stmt, $link);
+$Cstatuses_to_print = mysql_num_rows($rslt);
+
+$o=0;
+while ($Cstatuses_to_print > $o) 
+	{
+	$rowx=mysql_fetch_row($rslt);
+	$statname_list["$rowx[0]"] = "$rowx[1]";
+	$o++;
+	}
+
+$stmt="select count(*),status from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysql_real_escape_string($group) . "' group by status;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$statuses_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $statuses_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$TOTALcalls = ($TOTALcalls + $row[0]);
+
+	$STATUScount =	sprintf("%10s", $row[0]);while(strlen($STATUScount)>10) {$STATUScount = substr("$STATUScount", 0, -1);}
+	$RAWstatus = $row[1];
+	$status =	sprintf("%-6s", $row[1]);while(strlen($status)>6) {$status = substr("$status", 0, -1);}
+
+	if ($non_latin < 1)
+		{
+		 $status_name =	sprintf("%-20s", $statname_list[$RAWstatus]); 
+		 while(strlen($status_name)>20) {$status_name = substr("$status_name", 0, -1);}	
+		}
+	else
+		{
+		 $status_name =	sprintf("%-60s", $statname_list[$RAWstatus]); 
+		 while(mb_strlen($status_name,'utf-8')>20) {$status_name = mb_substr("$status_name", 0, -1,'utf-8');}	
+		}
+
+
+	echo "| $status | $status_name | $STATUScount |\n";
+
+	$i++;
+	}
+
+$TOTALcalls =		sprintf("%10s", $TOTALcalls);
+
+echo "+--------+----------------------+------------+\n";
+echo "| TOTAL:                        | $TOTALcalls |\n";
+echo "+-------------------------------+------------+\n";
+
+
+
+
+echo "\n";
+echo "---------- QUEUE STATS\n";
+
+$stmt="select count(*),sum(queue_seconds) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and (queue_seconds > 0);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$QUEUEcalls =	sprintf("%10s", $row[0]);
+if ( ($QUEUEcalls < 1) or ($TOTALcalls < 1) )
+	{$QUEUEpercent = '0';}
+else
+	{
+	$QUEUEpercent = (($QUEUEcalls / $TOTALcalls) * 100);
+	$QUEUEpercent = round($QUEUEpercent, 0);
+	}
+
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{$average_queue_seconds = '         0';}
+else
+	{
+	$average_queue_seconds = ($row[1] / $row[0]);
+	$average_queue_seconds = round($average_queue_seconds, 2);
+	$average_queue_seconds = sprintf("%10.2f", $average_queue_seconds);
+	}
+
+if ( ($TOTALcalls < 1) or ($row[1] < 1) )
+	{$average_total_queue_seconds = '         0';}
+else
+	{
+	$average_total_queue_seconds = ($row[1] / $TOTALcalls);
+	$average_total_queue_seconds = round($average_total_queue_seconds, 2);
+	$average_total_queue_seconds = sprintf("%10.2f", $average_total_queue_seconds);
+	}
+
+echo "Total Calls That entered Queue:               $QUEUEcalls  $QUEUEpercent%\n";
+echo "Average QUEUE Length for queue calls:         $average_queue_seconds seconds\n";
+echo "Average QUEUE Length across all calls:        $average_total_queue_seconds seconds\n";
+
+
+##############################
+#########  USER STATS
+
+$TOTagents=0;
+$TOTcalls=0;
+$TOTtime=0;
+$TOTavg=0;
+
+echo "\n";
+echo "---------- ΧΕΙΡΙΣΤΗΣSTATS\n";
+echo "+--------------------------+------------+----------+--------+\n";
+echo "| ΧΕΙΡΙΣΤΗΣ                   | CALLS      | TIME M   | AVRG M |\n";
+echo "+--------------------------+------------+----------+--------+\n";
+
+$stmt="select vicidial_closer_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_closer_log,vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysql_real_escape_string($group) . "' and vicidial_closer_log.user is not null and length_in_sec is not null and length_in_sec > 4 and vicidial_closer_log.user=vicidial_users.user group by vicidial_closer_log.user;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$TOTcalls = ($TOTcalls + $row[2]);
+	$TOTtime = ($TOTtime + $row[3]);
+
+	$user =			sprintf("%-6s", $row[0]);
+	$full_name =	sprintf("%-15s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
+	$USERcalls =	sprintf("%10s", $row[2]);
+	$USERtotTALK =	$row[3];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$USERtotTALK_MS =		sprintf("%8s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $user - $full_name | $USERcalls | $USERtotTALK_MS | $USERavgTALK_MS |\n";
+
+	$i++;
+	}
+
+if (!$TOTcalls) {$TOTcalls = 1;}
+$TOTavg = ($TOTtime / $TOTcalls);
+$TOTavg = round($TOTavg, 0);
+$TOTavg_M = ($TOTavg / 60);
+$TOTavg_M = round($TOTavg_M, 2);
+$TOTavg_M_int = intval("$TOTavg_M");
+$TOTavg_S = ($TOTavg_M - $TOTavg_M_int);
+$TOTavg_S = ($TOTavg_S * 60);
+$TOTavg_S = round($TOTavg_S, 0);
+if ($TOTavg_S < 10) {$TOTavg_S = "0$TOTavg_S";}
+$TOTavg_MS = "$TOTavg_M_int:$TOTavg_S";
+$TOTavg =		sprintf("%6s", $TOTavg_MS);
+
+$TOTtime_M = ($TOTtime / 60);
+$TOTtime_M = 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 ($TOTtime_S < 10) {$TOTtime_S = "0$TOTtime_S";}
+$TOTtime_MS = "$TOTtime_M_int:$TOTtime_S";
+$TOTtime =		sprintf("%6s", $TOTtime_MS);
+
+$TOTagents =		sprintf("%10s", $i);
+$TOTcalls =			sprintf("%10s", $TOTcalls);
+$TOTtime =			sprintf("%8s", $TOTtime);
+$TOTavg =			sprintf("%6s", $TOTavg);
+
+echo "+--------------------------+------------+----------+--------+\n";
+echo "| TOTAL Agents: $TOTagents | $TOTcalls | $TOTtime | $TOTavg |\n";
+echo "+--------------------------+------------+----------+--------+\n";
+
+
+##############################
+#########  TIME STATS
+
+echo "\n";
+echo "---------- ΣΤΑΤ.ΧΡΟÎ.\n";
+
+echo "\n";
+
+$hi_hour_count=0;
+$last_full_record=0;
+$i=0;
+$h=0;
+while ($i <= 96)
+	{
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+	$h++;
+	}
+
+if ($hi_hour_count < 1)
+	{$hour_multiplier = 0;}
+else
+	{
+	$hour_multiplier = (100 / $hi_hour_count);
+	#$hour_multiplier = round($hour_multiplier, 0);
+	}
+
+echo "\n";
+echo "ΓΡΑΦΙΚΗ ΠΑΡΑΣΤΑΣΗ ΜΕ 15ΛΕΠΤΕΣ ΑΥΞΗΣΕΙΣ ΤΩΠΣΥÎΟΛΙΚΩΠΚΛΗΣΕΩΠΠΟΥ ΤΟΠΟΘΕΤΟΥÎΤΑΙ ΑΠΟ ΑΥΤΗΠΤΗΠΕΚΣΤΡΑΤΕΙΑ\n";
+
+$k=1;
+$Mk=0;
+$call_scale = '0';
+while ($k <= 102) 
+	{
+	if ($Mk >= 5) 
+		{
+		$Mk=0;
+		if ( ($k < 1) or ($hour_multiplier <= 0) )
+			{$scale_num = 100;}
+		else
+			{
+			$scale_num=($k / $hour_multiplier);
+			$scale_num = round($scale_num, 0);
+			}
+		$LENscale_num = (strlen($scale_num));
+		$k = ($k + $LENscale_num);
+		$call_scale .= "$scale_num";
+		}
+	else
+		{
+		$call_scale .= " ";
+		$k++;   $Mk++;
+		}
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+$ZZ = '00';
+$i=0;
+$h=4;
+$hour= -1;
+$no_lines_yet=1;
+
+while ($i <= 96)
+	{
+	$char_counter=0;
+	$time = '      ';
+	if ($h >= 4) 
+		{
+		$hour++;
+		$h=0;
+		if ($hour < 10) {$hour = "0$hour";}
+		$time = "+$hour$ZZ+";
+		}
+	if ($h == 1) {$time = "   15 ";}
+	if ($h == 2) {$time = "   30 ";}
+	if ($h == 3) {$time = "   45 ";}
+	$Ghour_count = $hour_count[$i];
+	if ($Ghour_count < 1) 
+		{
+		if ( ($no_lines_yet) or ($i > $last_full_record) )
+			{
+			$do_nothing=1;
+			}
+		else
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			echo "|$time|";
+			$k=0;   while ($k <= 102) {echo " ";   $k++;}
+			echo "| $hour_count[$i] |\n";
+			}
+		}
+	else
+		{
+		$no_lines_yet=0;
+		$Xhour_count = ($Ghour_count * $hour_multiplier);
+		$Yhour_count = (99 - $Xhour_count);
+
+		$Gdrop_count = $drop_count[$i];
+		if ($Gdrop_count < 1) 
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "*X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 101) {echo " ";   $char_counter++;}
+			echo "| 0     | $hour_count[$i] |\n";
+
+			}
+		else
+			{
+			$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+		#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+			$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+			echo "D";   $char_counter++;
+			$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 102) {echo " ";   $char_counter++;}
+			echo "| $drop_count[$i] | $hour_count[$i] |\n";
+			}
+		}
+	
+	
+	$i++;
+	$h++;
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n\n";
+
+
+
+
+
+$ENDtime = date("U");
+$RUNtime = ($ENDtime - $STARTtime);
+echo "\nRun Time: $RUNtime seconds\n";
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_VDADstats.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_VDADstats.php new file mode 100644 index 00000000..d37410dd --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_VDADstats.php @@ -0,0 +1,647 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1718 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 61215-1139 - Added drop percentage of answered and round-2 decimal +# 71008-1436 - Added shift to be defined in dbconnect.php +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["shift"])) {$shift=$_GET["shift"];} + elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"];} + elseif (isset($_POST["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +if (strlen($shift)<2) {$shift='ALL';} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = '';} +if (!isset($query_date)) {$query_date = $NOW_DATE;} + +$stmt="select campaign_id from vicidial_campaigns;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: VDAD Stats\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "           ΤΡΟΠΟΠΟΙΗΣΗ | ΑÎΑΦΟΡΕΣ \n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "ΠΑΡΑΚΑΛΩ ΕΠΙΛΕΞΤΕ ΜΙΑ ΕΚΣΤΡΑΤΕΙΑ ΚΑΙ ΜΙΑ ΗΜΕΡΟΜΗÎΙΑ ΑÎΩΤΕΡΩ, ΚΑΙ ΠΑΤΗΣΤΕ ΕΠΙΒΕΒΑΙΩΣΗ\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$time_BEGIN=$AM_shift_BEGIN;
+	$time_END=$AM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "03:45:00";}   
+	if (strlen($time_END) < 6) {$time_END = "15:15:00";}
+	}
+if ($shift == 'PM') 
+	{
+	$time_BEGIN=$PM_shift_BEGIN;
+	$time_END=$PM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "15:15:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:15:00";}
+	}
+if ($shift == 'ALL') 
+	{
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "00:00:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:59:59";}
+	}
+$query_date_BEGIN = "$query_date $time_BEGIN";   
+$query_date_END = "$query_date $time_END";
+
+
+
+echo "VICIDIAL: Auto-dial Stats                             $NOW_TIME\n";
+
+echo "\n";
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{$average_hold_seconds = '         0';}
+else
+	{
+	$average_hold_seconds = ($row[1] / $row[0]);
+	$average_hold_seconds = round($average_hold_seconds, 2);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+echo "Συνολικά κλήσεις που τοποθετήθηκαν από την ΕκστÏατεία: $TOTALcalls\n";
+echo "Μέσος ÏŒÏος σε δευτεÏόλεπτα για όλες τις κλήσεις: $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- ΕΓΚΑΤΑΛ\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP' and (length_in_sec <= 60 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$DROPcalls =	sprintf("%10s", $row[0]);
+$DROPcallsRAW =	$row[0];
+$DROPseconds =	$row[1];
+
+$stmt="select count(*) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and status NOT IN('NA','B');";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$ANSWERcalls =	$row[0];
+
+if ( ($DROPcalls < 1) or ($TOTALcalls < 1) )
+	{$DROPpercent = '0';}
+else
+	{
+	$DROPpercent = (($DROPcallsRAW / $TOTALcalls) * 100);
+	$DROPpercent = round($DROPpercent, 2);
+	}
+
+if ( ($DROPcalls < 1) or ($ANSWERcalls < 1) )
+	{$DROPANSWERpercent = '0';}
+else
+	{
+	$DROPANSWERpercent = (($DROPcallsRAW / $ANSWERcalls) * 100);
+	$DROPANSWERpercent = round($DROPANSWERpercent, 2);
+	}
+
+if ( ($DROPseconds < 1) or ($DROPcallsRAW < 1) )
+	{$average_hold_seconds = '         0';}
+else
+	{
+	$average_hold_seconds = ($DROPseconds / $DROPcallsRAW);
+	$average_hold_seconds = round($average_hold_seconds, 2);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+
+echo "Συνολικά ΕΓΚΑΤΑΛΕΙΜΕÎΕΣ κλήσεις: $DROPcalls  $DROPpercent%\n";
+echo "Percent of DROP Calls taken out of Answers:   $DROPcalls / $ANSWERcalls  $DROPANSWERpercent%\n";
+echo "Μέσος ÏŒÏος σε δευτεÏόλεπτα για ΕΓΚΑΤΑΕΙΜΕÎΕΣ κλήσεις: $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- ΜΗ ΑΠΑÎΤ ΑΥΤ ΚΛΗΣΕΙΣ\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and status IN('NA','B') and (length_in_sec <= 60 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$NAcalls =	sprintf("%10s", $row[0]);
+if ( ($NAcalls < 1) or ($TOTALcalls < 1) )
+	{$NApercent = '0';}
+else
+	{
+	$NApercent = (($NAcalls / $TOTALcalls) * 100);
+	$NApercent = round($NApercent, 2);
+	}
+
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{$average_na_seconds = '         0';}
+else
+	{
+	$average_na_seconds = ($row[1] / $row[0]);
+	$average_na_seconds = round($average_na_seconds, 2);
+	$average_na_seconds =	sprintf("%10s", $average_na_seconds);
+	}
+
+echo "Total NA calls -Busy,Disconnect,RingNoAnswer: $NAcalls  $NApercent%\n";
+echo "Μέσος ÏŒÏος σε δευτεÏόλεπτα για ÎΑ κλήσεις: $average_na_seconds\n";
+
+
+##############################
+#########  CALL STATUS STATS
+
+$TOTALcalls = 0;
+
+echo "\n";
+echo "---------- CALL STATUS STATS\n";
+echo "+--------+----------------------+------------+\n";
+echo "| STATUS | DESCRIPTION          | CALLS      |\n";
+echo "+--------+----------------------+------------+\n";
+
+$stmt="SELECT * from vicidial_statuses order by status";
+$rslt=mysql_query($stmt, $link);
+$statuses_to_print = mysql_num_rows($rslt);
+$statuses_list='';
+
+$o=0;
+while ($statuses_to_print > $o) 
+	{
+	$rowx=mysql_fetch_row($rslt);
+	$statname_list["$rowx[0]"] = "$rowx[1]";
+	$o++;
+	}
+
+$stmt="SELECT * from vicidial_campaign_statuses where campaign_id='" . mysql_real_escape_string($group) . "' order by status";
+$rslt=mysql_query($stmt, $link);
+$Cstatuses_to_print = mysql_num_rows($rslt);
+
+$o=0;
+while ($Cstatuses_to_print > $o) 
+	{
+	$rowx=mysql_fetch_row($rslt);
+	$statname_list["$rowx[0]"] = "$rowx[1]";
+	$o++;
+	}
+
+$stmt="select count(*),status from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysql_real_escape_string($group) . "' group by status;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$statuses_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $statuses_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$TOTALcalls = ($TOTALcalls + $row[0]);
+
+	$STATUScount =	sprintf("%10s", $row[0]);while(strlen($STATUScount)>10) {$STATUScount = substr("$STATUScount", 0, -1);}
+	$RAWstatus = $row[1];
+	$status =	sprintf("%-6s", $row[1]);while(strlen($status)>6) {$status = substr("$status", 0, -1);}
+
+	if ($non_latin < 1)
+		{
+		 $status_name =	sprintf("%-20s", $statname_list[$RAWstatus]); 
+		 while(strlen($status_name)>20) {$status_name = substr("$status_name", 0, -1);}	
+		}
+	else
+		{
+		 $status_name =	sprintf("%-60s", $statname_list[$RAWstatus]); 
+		 while(mb_strlen($status_name,'utf-8')>20) {$status_name = mb_substr("$status_name", 0, -1,'utf-8');}	
+		}
+
+
+	echo "| $status | $status_name | $STATUScount |\n";
+
+	$i++;
+	}
+
+$TOTALcalls =		sprintf("%10s", $TOTALcalls);
+
+echo "+--------+----------------------+------------+\n";
+echo "| TOTAL:                        | $TOTALcalls |\n";
+echo "+-------------------------------+------------+\n";
+
+
+##############################
+#########  USER STATS
+
+$TOTagents=0;
+$TOTcalls=0;
+$TOTtime=0;
+$TOTavg=0;
+
+echo "\n";
+echo "---------- ΧΕΙΡΙΣΤΗΣSTATS\n";
+echo "+--------------------------+------------+----------+--------+\n";
+echo "| ΧΕΙΡΙΣΤΗΣ                   | CALLS      | TIME M   | AVRG M |\n";
+echo "+--------------------------+------------+----------+--------+\n";
+
+$stmt="select vicidial_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_log,vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysql_real_escape_string($group) . "' and vicidial_log.user is not null and length_in_sec is not null and length_in_sec > 4 and vicidial_log.user=vicidial_users.user group by vicidial_log.user;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$TOTcalls = ($TOTcalls + $row[2]);
+	$TOTtime = ($TOTtime + $row[3]);
+
+	$user =	sprintf("%-6s", $row[0]);while(strlen($user)>6) {$user = substr("$user", 0, -1);}
+	if ($non_latin < 1)
+	{
+ 	 $full_name =	sprintf("%-15s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}	
+	}
+	else
+	{
+	 $full_name =	sprintf("%-45s", $row[1]); while(mb_strlen($full_name,'utf-8')>15) {$full_name = mb_substr("$full_name", 0, -1,'utf-8');}	
+	}
+	$USERcalls =	sprintf("%10s", $row[2]);
+	$USERtotTALK =	$row[3];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$USERtotTALK_MS =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $user - $full_name | $USERcalls |   $USERtotTALK_MS | $USERavgTALK_MS |\n";
+
+	$i++;
+	}
+
+if (!$TOTcalls) {$TOTcalls = 1;}
+$TOTavg = ($TOTtime / $TOTcalls);
+$TOTavg = round($TOTavg, 0);
+$TOTavg_M = ($TOTavg / 60);
+$TOTavg_M = round($TOTavg_M, 2);
+$TOTavg_M_int = intval("$TOTavg_M");
+$TOTavg_S = ($TOTavg_M - $TOTavg_M_int);
+$TOTavg_S = ($TOTavg_S * 60);
+$TOTavg_S = round($TOTavg_S, 0);
+if ($TOTavg_S < 10) {$TOTavg_S = "0$TOTavg_S";}
+$TOTavg_MS = "$TOTavg_M_int:$TOTavg_S";
+$TOTavg =		sprintf("%6s", $TOTavg_MS);
+
+$TOTtime_M = ($TOTtime / 60);
+$TOTtime_M = 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 ($TOTtime_S < 10) {$TOTtime_S = "0$TOTtime_S";}
+$TOTtime_MS = "$TOTtime_M_int:$TOTtime_S";
+$TOTtime =		sprintf("%6s", $TOTtime_MS);
+
+$TOTagents =		sprintf("%10s", $i);
+$TOTcalls =			sprintf("%10s", $TOTcalls);
+$TOTtime =			sprintf("%8s", $TOTtime);
+$TOTavg =			sprintf("%6s", $TOTavg);
+
+$stmt="select avg(wait_sec) from vicidial_agent_log where event_time >= '$query_date_BEGIN' and event_time <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$AVGwait = $row[0];
+$AVGwait_M = ($AVGwait / 60);
+$AVGwait_M = round($AVGwait_M, 2);
+$AVGwait_M_int = intval("$AVGwait_M");
+$AVGwait_S = ($AVGwait_M - $AVGwait_M_int);
+$AVGwait_S = ($AVGwait_S * 60);
+$AVGwait_S = round($AVGwait_S, 0);
+if ($AVGwait_S < 10) {$AVGwait_S = "0$AVGwait_S";}
+$AVGwait_MS = "$AVGwait_M_int:$AVGwait_S";
+$AVGwait =		sprintf("%6s", $AVGwait_MS);
+
+echo "+--------------------------+------------+----------+--------+\n";
+echo "| TOTAL Agents: $TOTagents | $TOTcalls | $TOTtime | $TOTavg |\n";
+echo "+--------------------------+------------+----------+--------+\n";
+echo "| Average Wait time between calls                    $AVGwait |\n";
+echo "+-----------------------------------------------------------+\n";
+
+##############################
+#########  TIME STATS
+
+echo "\n";
+echo "---------- ΣΤΑΤ.ΧΡΟÎ.\n";
+
+echo "\n";
+
+$hi_hour_count=0;
+$last_full_record=0;
+$i=0;
+$h=0;
+while ($i <= 96)
+	{
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+	$h++;
+	}
+
+if ($hi_hour_count < 1)
+	{$hour_multiplier = 0;}
+else
+	{
+	$hour_multiplier = (100 / $hi_hour_count);
+	#$hour_multiplier = round($hour_multiplier, 0);
+	}
+
+echo "\n";
+echo "ΓΡΑΦΙΚΗ ΠΑΡΑΣΤΑΣΗ ΜΕ 15ΛΕΠΤΕΣ ΑΥΞΗΣΕΙΣ ΤΩΠΣΥÎΟΛΙΚΩΠΚΛΗΣΕΩΠΠΟΥ ΤΟΠΟΘΕΤΟΥÎΤΑΙ ΑΠΟ ΑΥΤΗΠΤΗΠΕΚΣΤΡΑΤΕΙΑ\n";
+
+$k=1;
+$Mk=0;
+$call_scale = '0';
+while ($k <= 102) 
+	{
+	if ($Mk >= 5) 
+		{
+		$Mk=0;
+		if ( ($k < 1) or ($hour_multiplier <= 0) )
+			{$scale_num = 100;}
+		else
+			{
+			$scale_num=($k / $hour_multiplier);
+			$scale_num = round($scale_num, 0);
+			}
+		$LENscale_num = (strlen($scale_num));
+		$k = ($k + $LENscale_num);
+		$call_scale .= "$scale_num";
+		}
+	else
+		{
+		$call_scale .= " ";
+		$k++;   $Mk++;
+		}
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+$ZZ = '00';
+$i=0;
+$h=4;
+$hour= -1;
+$no_lines_yet=1;
+
+while ($i <= 96)
+	{
+	$char_counter=0;
+	$time = '      ';
+	if ($h >= 4) 
+		{
+		$hour++;
+		$h=0;
+		if ($hour < 10) {$hour = "0$hour";}
+		$time = "+$hour$ZZ+";
+		}
+	if ($h == 1) {$time = "   15 ";}
+	if ($h == 2) {$time = "   30 ";}
+	if ($h == 3) {$time = "   45 ";}
+	$Ghour_count = $hour_count[$i];
+	if ($Ghour_count < 1) 
+		{
+		if ( ($no_lines_yet) or ($i > $last_full_record) )
+			{
+			$do_nothing=1;
+			}
+		else
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			echo "|$time|";
+			$k=0;   while ($k <= 102) {echo " ";   $k++;}
+			echo "| $hour_count[$i] |\n";
+			}
+		}
+	else
+		{
+		$no_lines_yet=0;
+		$Xhour_count = ($Ghour_count * $hour_multiplier);
+		$Yhour_count = (99 - $Xhour_count);
+
+		$Gdrop_count = $drop_count[$i];
+		if ($Gdrop_count < 1) 
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "*X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 101) {echo " ";   $char_counter++;}
+			echo "| 0     | $hour_count[$i] |\n";
+
+			}
+		else
+			{
+			$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+		#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+			$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+			echo "D";   $char_counter++;
+			$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 102) {echo " ";   $char_counter++;}
+			echo "| $drop_count[$i] | $hour_count[$i] |\n";
+			}
+		}
+	
+	
+	$i++;
+	$h++;
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+
+
+
+
+
+$ENDtime = date("U");
+$RUNtime = ($ENDtime - $STARTtime);
+echo "\nRun Time: $RUNtime seconds\n";
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_VICIDIAL_hopperlist.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_VICIDIAL_hopperlist.php new file mode 100644 index 00000000..538d8534 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_VICIDIAL_hopperlist.php @@ -0,0 +1,169 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1654 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 70115-1614 - Added ALT field for vicidial_hopper alt_dial column +# 71029-0852 - Added list_id to the output +# 71030-2118 - Added priority to display +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"];} + elseif (isset($_POST["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and modify_campaigns='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = '';} +if (!isset($query_date)) {$query_date = $NOW_DATE;} +if (!isset($server_ip)) {$server_ip = '10.10.10.15';} + +$stmt="select campaign_id,campaign_name from vicidial_campaigns order by campaign_id;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$campaigns_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $campaigns_to_print) + { + $row=mysql_fetch_row($rslt); + $campaign_id[$i] =$row[0]; + $campaign_name[$i] =$row[1]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: Λίστα Hopper\n"; +echo "
\n"; +#echo "\n"; +#echo "\n"; +echo "\n"; +echo "\n"; +echo "           ΤΡΟΠΟΠΟΙΗΣΗ \n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "ΠΑΡΑΚΑΛΩ ΕΠΙΛΕΞΤΕ ΜΙΑ ΕΚΣΤΡΑΤΕΙΑ ΑÎΩΤΕΡΩ ΚΑΙ ΠΑΤΗΣΤΕ ΕΠΙΒΕΒΑΙΩΣΗ\n";
+}
+
+else
+{
+
+
+echo "VICIDIAL: ΕνεÏγή Λίστα στον Hopper                      $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+
+echo "ΑÏιθμός οδηγών στον hopper τώÏα::       $TOTALcalls\n";
+
+
+##############################
+#########  LEAD STATS
+
+echo "\n";
+echo "---------- LEADS IN HOPPER\n";
+echo "+------+--------+-----------+------------+------------+-------+--------+-------+--------+-------+\n";
+echo "|ORDER |PRIORITY| LEAD ID   | ID ΛΙΣΤΑΣ    | PHONE NUM  | STATE | STATUS | COUNT | GMT    | ALT   |\n";
+echo "+------+--------+-----------+------------+------------+-------+--------+-------+--------+-------+\n";
+
+$stmt="select vicidial_hopper.lead_id,phone_number,vicidial_hopper.state,vicidial_list.status,called_count,vicidial_hopper.gmt_offset_now,hopper_id,alt_dial,vicidial_hopper.list_id,vicidial_hopper.priority from vicidial_hopper,vicidial_list where vicidial_hopper.campaign_id='" . mysql_real_escape_string($group) . "' and vicidial_hopper.lead_id=vicidial_list.lead_id order by priority desc,hopper_id limit 2000;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$FMT_i =		sprintf("%-4s", $i);
+	$lead_id =		sprintf("%-9s", $row[0]);
+	$phone_number =	sprintf("%-10s", $row[1]);
+	$state =		sprintf("%-5s", $row[2]);
+	$status =		sprintf("%-6s", $row[3]);
+	$count =		sprintf("%-5s", $row[4]);
+	$gmt =			sprintf("%-6s", $row[5]);
+	$hopper_id =	sprintf("%-6s", $row[6]);
+	$alt_dial =		sprintf("%-5s", $row[7]);
+	$list_id =		sprintf("%-10s", $row[8]);
+	$priority =		sprintf("%-6s", $row[9]);
+
+if ($DB) {echo "| $FMT_i | $priority | $lead_id | $list_id | $phone_number | $state | $status | $count | $gmt | $hopper_id |\n";}
+else {echo "| $FMT_i | $priority | $lead_id | $list_id | $phone_number | $state | $status | $count | $gmt | $alt_dial |\n";}
+
+	$i++;
+	}
+
+echo "+------+--------+-----------+------------+------------+-------+--------+-------+--------+-------+\n";
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_admin_log_display.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_admin_log_display.php new file mode 100644 index 00000000..a26ee60f --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_admin_log_display.php @@ -0,0 +1,118 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"];} + elseif (isset($_POST["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); +$query_date = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$query_date); + +# AST GUI database administration +# AST_admin_log_display.php +# +# CHANGES +# 50325-0932 - First build +# 51123-1443 - removed globals=on requirement +# 60421-1229 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60620-1044 - Added variable filtering to eliminate SQL injection attack threat +# + +$version = '0.0.4'; +$build = '60620-1044'; + +$STARTtime = date("U"); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 8 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "ΔΙΑΧΕΙΡΙΣΗ LOG DISPLAY"; +echo "\n"; + +# Fri, 25 Mar 2005 + +$DAY_DATE = date("j"); +if ($DAY_DATE < 10) +# {$GREP_DATE = date("D, j M Y");} + {$GREP_DATE = date("D, 0j M Y");} +else + {$GREP_DATE = date("D, j M Y");} + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!$query_date) {$query_date = $GREP_DATE;} + +$Gquery_date = eregi_replace(" ",'\ ',$query_date); +echo "\n"; + +echo "
\n"; +echo "\n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+echo "ΔΙΑΧΕΙΡΙΣΗ CHANGE LOG                             $NOW_TIME\n";
+
+#passthru("grep $Gquery_date /home/www/htdocs/vicidial/admin_changes_log.txt");
+passthru("grep $Gquery_date $WeBServeRRooT/vicidial/admin_changes_log.txt");
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_agent_performance.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_agent_performance.php new file mode 100644 index 00000000..0d3690c9 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_agent_performance.php @@ -0,0 +1,257 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1711 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 70201-1203 - Added non_latin UTF8 output code, widened USER ID to 8 chars +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["shift"])) {$shift=$_GET["shift"];} + elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"];} + elseif (isset($_POST["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + 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($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = '';} +if (!isset($query_date)) {$query_date = $NOW_DATE;} + +$stmt="select campaign_id from vicidial_campaigns;"; +if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$campaigns_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $campaigns_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: Agent Performance\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "           ΤΡΟΠΟΠΟΙΗΣΗ | ΑÎΑΦΟΡΕΣ \n"; +echo "
\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A ΔΙΑΚΟΜΙΣΤΗΣ AND DATE-TIME ABOVE AND CLICK ΕΠΙΒΕΒΑΙΩΣΗ\n";
+echo " NOTE: stats taken from 6 hour shift specified\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$query_date_BEGIN = "$query_date 08:45:00";   
+	$query_date_END = "$query_date 15:33:00";
+	$time_BEGIN = "08:45:00";   
+	$time_END = "15:33:00";
+	}
+if ($shift == 'PM') 
+	{
+	$query_date_BEGIN = "$query_date 15:33:00";   
+	$query_date_END = "$query_date 23:15:00";
+	$time_BEGIN = "15:33:00";   
+	$time_END = "23:15:00";
+	}
+
+echo "VICIDIAL: Agent Performance                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENTS Details -------------\n\n";
+
+echo "+-----------------+----------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+echo "| USER NAME       | ID       | CALLS  | TALK   | TALKAVG| A    | B    | DC   | DNC  | N    | NI   | SALE |\n";
+echo "+-----------------+----------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+
+$stmt="select count(*) as calls,sum(length_in_sec) as talk,full_name,vicidial_users.user,avg(length_in_sec) from vicidial_users,vicidial_log where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN' and vicidial_users.user=vicidial_log.user and campaign_id='" . mysql_real_escape_string($group) . "' group by full_name order by calls desc limit 1000;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$TOTcalls=($TOTcalls + $row[0]);
+	$TOTtotTALK=($TOTtotTALK + $row[1]);
+	$calls[$i] =	sprintf("%-6s", $row[0]);
+
+	if ($non_latin < 1)
+	{
+   	 $full_name[$i]=	sprintf("%-15s", $row[2]); 
+	 while(strlen($full_name[$i])>15) {$full_name[$i] = substr("$full_name[$i]", 0, -1);}
+
+	 $user[$i] =		sprintf("%-6s", $row[3]);
+        while(strlen($user[$i])>6) {$user[$i] = substr("$user[$i]", 0, -1);}
+       }
+	else
+	{	
+        $full_name[$i]=	sprintf("%-45s", $row[2]); 
+	 while(mb_strlen($full_name[$i],'utf-8')>15) {$full_name[$i] = mb_substr("$full_name[$i]", 0, -1,'utf-8');}
+
+ 	 $user[$i] =		sprintf("%-18s", $row[3]);
+	 while(mb_strlen($user[$i],'utf-8')>6) {$user[$i] = mb_substr("$user[$i]", 0, -1,'utf-8');}
+	}
+
+	$user[$i] =		sprintf("%-8s", $row[3]);
+	$USERtotTALK =	$row[1];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$pfUSERtotTALK_MS[$i] =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$pfUSERavgTALK_MS[$i] =		sprintf("%6s", $USERavgTALK_MS);
+	$i++;
+	}
+
+$k=0;
+while($k < $i)
+	{
+	$ctA[$k]="0   "; $ctB[$k]="0   "; $ctDC[$k]="0   "; $ctDNC[$k]="0   "; $ctN[$k]="0   "; $ctNI[$k]="0   "; $ctSALE[$k]="0   "; 
+	$stmt="select count(*),status from vicidial_log where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN' and user='$user[$k]' and campaign_id='" . mysql_real_escape_string($group) . "' group by status;";
+	if ($non_latin > 0)
+	{
+	$rslt=mysql_query("SET NAMES 'UTF8'");
+	}
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$rows_to_print = mysql_num_rows($rslt);
+	$m=0;
+	while ($m < $rows_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if ($row[1] == 'A') {$ctA[$k]=sprintf("%-4s", $row[0]);		$TOT_A = ($TOT_A + $row[0]);}
+		if ($row[1] == 'B') {$ctB[$k]=sprintf("%-4s", $row[0]);		$TOT_B = ($TOT_B + $row[0]);}
+		if ($row[1] == 'DC') {$ctDC[$k]=sprintf("%-4s", $row[0]);	$TOT_DC = ($TOT_DC + $row[0]);}
+		if ($row[1] == 'DNC') {$ctDNC[$k]=sprintf("%-4s", $row[0]);	$TOT_DNC = ($TOT_DNC + $row[0]);}
+		if ($row[1] == 'N') {$ctN[$k]=sprintf("%-4s", $row[0]);		$TOT_N = ($TOT_N + $row[0]);}
+		if ($row[1] == 'NI') {$ctNI[$k]=sprintf("%-4s", $row[0]);	$TOT_NI = ($TOT_NI + $row[0]);}
+		if (($row[1] == 'SALE') || ($row[1] == 'XFER') ) {$ctSALE[$k]=sprintf("%-4s", $row[0]);	$TOT_SALE = ($TOT_SALE + $row[0]);}
+		$m++;
+		}
+	echo "| $full_name[$k] | $user[$k] | $calls[$k] | $pfUSERtotTALK_MS[$k] | $pfUSERavgTALK_MS[$k] | $ctA[$k] | $ctB[$k] | $ctDC[$k] | $ctDNC[$k] | $ctN[$k] | $ctNI[$k] | $ctSALE[$k] |\n";
+
+
+
+	$k++;
+	}
+
+	$TOTcalls =	sprintf("%-7s", $TOTcalls);
+
+	$TOTtotTALK_M = ($TOTtotTALK / 60);
+	$TOTtotTALK_M = round($TOTtotTALK_M, 2);
+	$TOTtotTALK_M_int = intval("$TOTtotTALK_M");
+	$TOTtotTALK_S = ($TOTtotTALK_M - $TOTtotTALK_M_int);
+	$TOTtotTALK_S = ($TOTtotTALK_S * 60);
+	$TOTtotTALK_S = round($TOTtotTALK_S, 0);
+	if ($TOTtotTALK_S < 10) {$TOTtotTALK_S = "0$TOTtotTALK_S";}
+	$TOTtotTALK_MS = "$TOTtotTALK_M_int:$TOTtotTALK_S";
+	$TOTtotTALK_MS =		sprintf("%7s", $TOTtotTALK_MS);
+		while(strlen($TOTtotTALK_MS)>7) {$TOTtotTALK_MS = substr("$TOTtotTALK_MS", 0, -1);}
+
+	$TOT_A = sprintf("%-5s", $TOT_A);
+	$TOT_B = sprintf("%-5s", $TOT_B);
+	$TOT_DC = sprintf("%-5s", $TOT_DC);
+	$TOT_DNC = sprintf("%-5s", $TOT_DNC);
+	$TOT_N = sprintf("%-5s", $TOT_N);
+	$TOT_NI = sprintf("%-5s", $TOT_NI);
+	$TOT_SALE = sprintf("%-5s", $TOT_SALE);
+
+echo "+-----------------+----------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+echo "|  TOTALS                    | $TOTcalls| $TOTtotTALK_MS|        | $TOT_A| $TOT_B| $TOT_DC| $TOT_DNC| $TOT_N| $TOT_NI| $TOT_SALE|\n";
+echo "+-----------------+----------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+
+echo "\n";
+
+}
+
+
+
+?>
+
+
\ No newline at end of file
diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_agent_performance_detail.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_agent_performance_detail.php
new file mode 100644
index 00000000..0bbb9d35
--- /dev/null
+++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_agent_performance_detail.php
@@ -0,0 +1,557 @@
+    LICENSE: GPLv2
+###
+# CHANGES
+#
+# 71119-2359 - First build
+# 71121-0144 - Replace existing AST_agent_performance_detail.php script with this one
+#            - Fixed zero division bug
+#
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+if (isset($_GET["query_date"]))				{$query_date=$_GET["query_date"];}
+	elseif (isset($_POST["query_date"]))	{$query_date=$_POST["query_date"];}
+if (isset($_GET["group"]))				{$group=$_GET["group"];}
+	elseif (isset($_POST["group"]))		{$group=$_POST["group"];}
+if (isset($_GET["user_group"]))				{$user_group=$_GET["user_group"];}
+	elseif (isset($_POST["user_group"]))	{$user_group=$_POST["user_group"];}
+if (isset($_GET["shift"]))				{$shift=$_GET["shift"];}
+	elseif (isset($_POST["shift"]))		{$shift=$_POST["shift"];}
+if (isset($_GET["submit"]))				{$submit=$_GET["submit"];}
+	elseif (isset($_POST["submit"]))	{$submit=$_POST["submit"];}
+if (isset($_GET["ΕΠΙΒΕΒΑΙΩΣΗ"]))				{$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"];}
+	elseif (isset($_POST["ΕΠΙΒΕΒΑΙΩΣΗ"]))	{$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];}
+
+if (strlen($shift)<2) {$shift='ALL';}
+
+$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
+$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
+
+	$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
+	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($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
+	{
+    Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
+    Header("HTTP/1.0 401 Unauthorized");
+    echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
+    exit;
+	}
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!isset($group)) {$group = '';}
+if (!isset($query_date)) {$query_date = $NOW_DATE;}
+
+$stmt="select campaign_id from vicidial_campaigns;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$campaigns_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $campaigns_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$groups[$i] =$row[0];
+	$i++;
+	}
+$stmt="select user_group from vicidial_user_groups;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$user_groups_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $user_groups_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$user_groups[$i] =$row[0];
+	$i++;
+	}
+?>
+
+
+
+
+
+\n";
+echo "VICIDIAL: Agent Performance\n";
+echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "           ΤΡΟΠΟΠΟΙΗΣΗ | ΑÎΑΦΟΡΕΣ \n"; +echo "
\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A CAMPAIGN AND DATE-TIME ABOVE AND CLICK ΕΠΙΒΕΒΑΙΩΣΗ\n";
+echo " NOTE: stats taken from shift specified\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$time_BEGIN=$AM_shift_BEGIN;
+	$time_END=$AM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "03:45:00";}   
+	if (strlen($time_END) < 6) {$time_END = "15:15:00";}
+	}
+if ($shift == 'PM') 
+	{
+	$time_BEGIN=$PM_shift_BEGIN;
+	$time_END=$PM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "15:15:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:15:00";}
+	}
+if ($shift == 'ALL') 
+	{
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "00:00:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:59:59";}
+	}
+$query_date_BEGIN = "$query_date $time_BEGIN";   
+$query_date_END = "$query_date $time_END";
+
+if (strlen($user_group)>0) {$ugSQL="and vicidial_agent_log.user_group='$user_group'";}
+else {$ugSQL='';}
+
+echo "VICIDIAL: Agent Performance Detail                        $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENTS Details -------------\n\n";
+
+
+
+
+
+$statuses='-';
+$statusesTXT='';
+$statusesHEAD='';
+$statusesHTML='';
+$statusesARY[0]='';
+$j=0;
+$users='-';
+$usersARY[0]='';
+$user_namesARY[0]='';
+$k=0;
+
+$stmt="select count(*) as calls,sum(talk_sec) as talk,full_name,vicidial_users.user,sum(pause_sec),sum(wait_sec),sum(dispo_sec),status from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user and campaign_id='" . mysql_real_escape_string($group) . "' and pause_sec<36000 and wait_sec<36000 and talk_sec<36000 and dispo_sec<36000 $ugSQL group by full_name,status order by status desc,full_name limit 100000;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$row[0] = ($row[0] - 1);	# subtract 1 for login/logout event compensation
+	
+	$calls[$i] =		$row[0];
+	$talk_sec[$i] =		$row[1];
+	$full_name[$i] =	$row[2];
+	$user[$i] =			$row[3];
+	$pause_sec[$i] =	$row[4];
+	$wait_sec[$i] =		$row[5];
+	$dispo_sec[$i] =	$row[6];
+	$status[$i] =		$row[7];
+	if ( (!eregi("-$status[$i]-", $statuses)) and (strlen($status[$i])>0) )
+		{
+		$statusesTXT = sprintf("%8s", $status[$i]);
+		$statusesHEAD .= "----------+";
+		$statusesHTML .= " $statusesTXT |";
+		$statuses .= "$status[$i]-";
+		$statusesARY[$j] = $status[$i];
+		$j++;
+		}
+	if (!eregi("-$user[$i]-", $users))
+		{
+		$users .= "$user[$i]-";
+		$usersARY[$k] = $user[$i];
+		$user_namesARY[$k] = $full_name[$i];
+		$k++;
+		}
+
+	$i++;
+	}
+
+
+echo "+-----------------+----------+--------+---------+--------+--------+--------+--------+--------+--------+--------+--------+$statusesHEAD\n";
+echo "| USER NAME       | ID       | CALLS  | TIME    | PAUSE  | PAUSAVG| WAIT   | WAITAVG| TALK   | TALKAVG| DISPO  | DISPAVG|$statusesHTML\n";
+echo "+-----------------+----------+--------+---------+--------+--------+--------+--------+--------+--------+--------+--------+$statusesHEAD\n";
+
+
+### BEGIN loop through each user ###
+$m=0;
+while ($m < $k)
+	{
+	$Suser=$usersARY[$m];
+	$Sfull_name=$user_namesARY[$m];
+	$Stime=0;
+	$Scalls=0;
+	$Stalk_sec=0;
+	$Spause_sec=0;
+	$Swait_sec=0;
+	$Sdispo_sec=0;
+	$SstatusesHTML='';
+
+	### BEGIN loop through each status ###
+	$n=0;
+	while ($n < $j)
+		{
+		$Sstatus=$statusesARY[$n];
+		$SstatusTXT='';
+		### BEGIN loop through each stat line ###
+		$i=0; $status_found=0;
+		while ($i < $rows_to_print)
+			{
+			if ( ($Suser=="$user[$i]") and ($Sstatus=="$status[$i]") )
+				{
+				$Scalls =		($Scalls + $calls[$i]);
+				$Stalk_sec =	($Stalk_sec + $talk_sec[$i]);
+				$Spause_sec =	($Spause_sec + $pause_sec[$i]);
+				$Swait_sec =	($Swait_sec + $wait_sec[$i]);
+				$Sdispo_sec =	($Sdispo_sec + $dispo_sec[$i]);
+				$SstatusTXT = sprintf("%8s", $calls[$i]);
+				$SstatusesHTML .= " $SstatusTXT |";
+				$status_found++;
+				}
+			$i++;
+			}
+		if ($status_found < 1)
+			{
+			$SstatusesHTML .= "        0 |";
+			}
+		### END loop through each stat line ###
+		$n++;
+		}
+	### END loop through each status ###
+	$Stime = ($Stalk_sec + $Spause_sec + $Swait_sec + $Sdispo_sec);
+	$TOTcalls=($TOTcalls + $Scalls);
+	$TOTtime=($TOTtime + $Stime);
+	$TOTtotTALK=($TOTtotTALK + $Stalk_sec);
+	$TOTtotWAIT=($TOTtotWAIT + $Swait_sec);
+	$TOTtotPAUSE=($TOTtotPAUSE + $Spause_sec);
+	$TOTtotDISPO=($TOTtotDISPO + $Sdispo_sec);
+	$Stime = ($Stalk_sec + $Spause_sec + $Swait_sec + $Sdispo_sec);
+	if ( ($Scalls > 0) and ($Stalk_sec > 0) ) {$Stalk_avg = ($Stalk_sec/$Scalls);}
+		else {$Stalk_avg=0;}
+	if ( ($Scalls > 0) and ($Spause_sec > 0) ) {$Spause_avg = ($Spause_sec/$Scalls);}
+		else {$Spause_avg=0;}
+	if ( ($Scalls > 0) and ($Swait_sec > 0) ) {$Swait_avg = ($Swait_sec/$Scalls);}
+		else {$Swait_avg=0;}
+	if ( ($Scalls > 0) and ($Sdispo_sec > 0) ) {$Sdispo_avg = ($Sdispo_sec/$Scalls);}
+		else {$Sdispo_avg=0;}
+
+	$Scalls =	sprintf("%6s", $Scalls);
+
+	if ($non_latin < 1)
+	{
+   	 $Sfull_name=	sprintf("%-15s", $Sfull_name); 
+		while(strlen($Sfull_name)>15) {$Sfull_name = substr("$Sfull_name", 0, -1);}
+	 $Suser =		sprintf("%-8s", $Suser);
+        while(strlen($Suser)>8) {$Suser = substr("$Suser", 0, -1);}
+       }
+	else
+	{	
+        $Sfull_name=	sprintf("%-45s", $Sfull_name); 
+	 while(mb_strlen($Sfull_name,'utf-8')>15) {$Sfull_name = mb_substr("$Sfull_name", 0, -1,'utf-8');}
+
+ 		$Suser =	sprintf("%-24s", $Suser);
+	 while(mb_strlen($Suser,'utf-8')>8) {$Suser = mb_substr("$Suser", 0, -1,'utf-8');}
+	}
+
+	$USERtime_M = ($Stime / 60);
+	$USERtime_M = round($USERtime_M, 2);
+	$USERtime_M_int = intval("$USERtime_M");
+	$USERtime_S = ($USERtime_M - $USERtime_M_int);
+	$USERtime_S = ($USERtime_S * 60);
+	$USERtime_S = round($USERtime_S, 0);
+	if ($USERtime_S < 10) {$USERtime_S = "0$USERtime_S";}
+	$USERtime_MS = "$USERtime_M_int:$USERtime_S";
+	$pfUSERtime_MS =		sprintf("%7s", $USERtime_MS);
+
+	$USERtotTALK_M = ($Stalk_sec / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$pfUSERtotTALK_MS =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($Stalk_avg / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$pfUSERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	$USERtotPAUSE_M = ($Spause_sec / 60);
+	$USERtotPAUSE_M = round($USERtotPAUSE_M, 2);
+	$USERtotPAUSE_M_int = intval("$USERtotPAUSE_M");
+	$USERtotPAUSE_S = ($USERtotPAUSE_M - $USERtotPAUSE_M_int);
+	$USERtotPAUSE_S = ($USERtotPAUSE_S * 60);
+	$USERtotPAUSE_S = round($USERtotPAUSE_S, 0);
+	if ($USERtotPAUSE_S < 10) {$USERtotPAUSE_S = "0$USERtotPAUSE_S";}
+	$USERtotPAUSE_MS = "$USERtotPAUSE_M_int:$USERtotPAUSE_S";
+	$pfUSERtotPAUSE_MS =		sprintf("%6s", $USERtotPAUSE_MS);
+
+	$USERavgPAUSE_M = ($Spause_avg / 60);
+	$USERavgPAUSE_M = round($USERavgPAUSE_M, 2);
+	$USERavgPAUSE_M_int = intval("$USERavgPAUSE_M");
+	$USERavgPAUSE_S = ($USERavgPAUSE_M - $USERavgPAUSE_M_int);
+	$USERavgPAUSE_S = ($USERavgPAUSE_S * 60);
+	$USERavgPAUSE_S = round($USERavgPAUSE_S, 0);
+	if ($USERavgPAUSE_S < 10) {$USERavgPAUSE_S = "0$USERavgPAUSE_S";}
+	$USERavgPAUSE_MS = "$USERavgPAUSE_M_int:$USERavgPAUSE_S";
+	$pfUSERavgPAUSE_MS =		sprintf("%6s", $USERavgPAUSE_MS);
+
+	$USERtotWAIT_M = ($Swait_sec / 60);
+	$USERtotWAIT_M = round($USERtotWAIT_M, 2);
+	$USERtotWAIT_M_int = intval("$USERtotWAIT_M");
+	$USERtotWAIT_S = ($USERtotWAIT_M - $USERtotWAIT_M_int);
+	$USERtotWAIT_S = ($USERtotWAIT_S * 60);
+	$USERtotWAIT_S = round($USERtotWAIT_S, 0);
+	if ($USERtotWAIT_S < 10) {$USERtotWAIT_S = "0$USERtotWAIT_S";}
+	$USERtotWAIT_MS = "$USERtotWAIT_M_int:$USERtotWAIT_S";
+	$pfUSERtotWAIT_MS =		sprintf("%6s", $USERtotWAIT_MS);
+
+	$USERavgWAIT_M = ($Swait_avg / 60);
+	$USERavgWAIT_M = round($USERavgWAIT_M, 2);
+	$USERavgWAIT_M_int = intval("$USERavgWAIT_M");
+	$USERavgWAIT_S = ($USERavgWAIT_M - $USERavgWAIT_M_int);
+	$USERavgWAIT_S = ($USERavgWAIT_S * 60);
+	$USERavgWAIT_S = round($USERavgWAIT_S, 0);
+	if ($USERavgWAIT_S < 10) {$USERavgWAIT_S = "0$USERavgWAIT_S";}
+	$USERavgWAIT_MS = "$USERavgWAIT_M_int:$USERavgWAIT_S";
+	$pfUSERavgWAIT_MS =		sprintf("%6s", $USERavgWAIT_MS);
+	
+	$USERtotDISPO_M = ($Sdispo_sec / 60);
+	$USERtotDISPO_M = round($USERtotDISPO_M, 2);
+	$USERtotDISPO_M_int = intval("$USERtotDISPO_M");
+	$USERtotDISPO_S = ($USERtotDISPO_M - $USERtotDISPO_M_int);
+	$USERtotDISPO_S = ($USERtotDISPO_S * 60);
+	$USERtotDISPO_S = round($USERtotDISPO_S, 0);
+	if ($USERtotDISPO_S < 10) {$USERtotDISPO_S = "0$USERtotDISPO_S";}
+	$USERtotDISPO_MS = "$USERtotDISPO_M_int:$USERtotDISPO_S";
+	$pfUSERtotDISPO_MS =		sprintf("%6s", $USERtotDISPO_MS);
+
+	$USERavgDISPO_M = ($Sdispo_avg / 60);
+	$USERavgDISPO_M = round($USERavgDISPO_M, 2);
+	$USERavgDISPO_M_int = intval("$USERavgDISPO_M");
+	$USERavgDISPO_S = ($USERavgDISPO_M - $USERavgDISPO_M_int);
+	$USERavgDISPO_S = ($USERavgDISPO_S * 60);
+	$USERavgDISPO_S = round($USERavgDISPO_S, 0);
+	if ($USERavgDISPO_S < 10) {$USERavgDISPO_S = "0$USERavgDISPO_S";}
+	$USERavgDISPO_MS = "$USERavgDISPO_M_int:$USERavgDISPO_S";
+	$pfUSERavgDISPO_MS =		sprintf("%6s", $USERavgDISPO_MS);
+
+	echo "| $Sfull_name | $Suser | $Scalls | $pfUSERtime_MS | $pfUSERtotPAUSE_MS | $pfUSERavgPAUSE_MS | $pfUSERtotWAIT_MS | $pfUSERavgWAIT_MS | $pfUSERtotTALK_MS | $pfUSERavgTALK_MS | $pfUSERtotDISPO_MS | $pfUSERavgDISPO_MS |$SstatusesHTML\n";
+	$m++;
+	}
+### END loop through each user ###
+
+
+###### LAST LINE FORMATTING ##########
+### BEGIN loop through each status ###
+$SUMstatusesHTML='';
+$n=0;
+while ($n < $j)
+	{
+	$Scalls=0;
+	$Sstatus=$statusesARY[$n];
+	$SUMstatusTXT='';
+	### BEGIN loop through each stat line ###
+	$i=0; $status_found=0;
+	while ($i < $rows_to_print)
+		{
+		if ($Sstatus=="$status[$i]")
+			{
+			$Scalls =		($Scalls + $calls[$i]);
+			$status_found++;
+			}
+		$i++;
+		}
+	### END loop through each stat line ###
+	if ($status_found < 1)
+		{
+		$SUMstatusesHTML .= "        0 |";
+		}
+	else
+		{
+		$SUMstatusTXT = sprintf("%8s", $Scalls);
+		$SUMstatusesHTML .= " $SUMstatusTXT |";
+		}
+	$n++;
+	}
+### END loop through each status ###
+
+
+	$TOTcalls =	sprintf("%7s", $TOTcalls);
+	$TOT_AGENTS = sprintf("%-4s", $m);
+
+	$TOTtime_M = ($TOTtime / 60);
+	$TOTtime_M = 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 ($TOTtime_S < 10) {$TOTtime_S = "0$TOTtime_S";}
+	$TOTtime_MS = "$TOTtime_M_int:$TOTtime_S";
+	$TOTtime_MS =		sprintf("%8s", $TOTtime_MS);
+		while(strlen($TOTtime_MS)>8) {$TOTtime_MS = substr("$TOTtime_MS", 0, -1);}
+
+	$TOTtotTALK_M = ($TOTtotTALK / 60);
+	$TOTtotTALK_M = round($TOTtotTALK_M, 2);
+	$TOTtotTALK_M_int = intval("$TOTtotTALK_M");
+	$TOTtotTALK_S = ($TOTtotTALK_M - $TOTtotTALK_M_int);
+	$TOTtotTALK_S = ($TOTtotTALK_S * 60);
+	$TOTtotTALK_S = round($TOTtotTALK_S, 0);
+	if ($TOTtotTALK_S < 10) {$TOTtotTALK_S = "0$TOTtotTALK_S";}
+	$TOTtotTALK_MS = "$TOTtotTALK_M_int:$TOTtotTALK_S";
+	$TOTtotTALK_MS =		sprintf("%8s", $TOTtotTALK_MS);
+		while(strlen($TOTtotTALK_MS)>8) {$TOTtotTALK_MS = substr("$TOTtotTALK_MS", 0, -1);}
+
+	$TOTtotDISPO_M = ($TOTtotDISPO / 60);
+	$TOTtotDISPO_M = round($TOTtotDISPO_M, 2);
+	$TOTtotDISPO_M_int = intval("$TOTtotDISPO_M");
+	$TOTtotDISPO_S = ($TOTtotDISPO_M - $TOTtotDISPO_M_int);
+	$TOTtotDISPO_S = ($TOTtotDISPO_S * 60);
+	$TOTtotDISPO_S = round($TOTtotDISPO_S, 0);
+	if ($TOTtotDISPO_S < 10) {$TOTtotDISPO_S = "0$TOTtotDISPO_S";}
+	$TOTtotDISPO_MS = "$TOTtotDISPO_M_int:$TOTtotDISPO_S";
+	$TOTtotDISPO_MS =		sprintf("%8s", $TOTtotDISPO_MS);
+		while(strlen($TOTtotDISPO_MS)>8) {$TOTtotDISPO_MS = substr("$TOTtotDISPO_MS", 0, -1);}
+
+	$TOTtotPAUSE_M = ($TOTtotPAUSE / 60);
+	$TOTtotPAUSE_M = round($TOTtotPAUSE_M, 2);
+	$TOTtotPAUSE_M_int = intval("$TOTtotPAUSE_M");
+	$TOTtotPAUSE_S = ($TOTtotPAUSE_M - $TOTtotPAUSE_M_int);
+	$TOTtotPAUSE_S = ($TOTtotPAUSE_S * 60);
+	$TOTtotPAUSE_S = round($TOTtotPAUSE_S, 0);
+	if ($TOTtotPAUSE_S < 10) {$TOTtotPAUSE_S = "0$TOTtotPAUSE_S";}
+	$TOTtotPAUSE_MS = "$TOTtotPAUSE_M_int:$TOTtotPAUSE_S";
+	$TOTtotPAUSE_MS =		sprintf("%8s", $TOTtotPAUSE_MS);
+		while(strlen($TOTtotPAUSE_MS)>8) {$TOTtotPAUSE_MS = substr("$TOTtotPAUSE_MS", 0, -1);}
+
+	$TOTtotWAIT_M = ($TOTtotWAIT / 60);
+	$TOTtotWAIT_M = round($TOTtotWAIT_M, 2);
+	$TOTtotWAIT_M_int = intval("$TOTtotWAIT_M");
+	$TOTtotWAIT_S = ($TOTtotWAIT_M - $TOTtotWAIT_M_int);
+	$TOTtotWAIT_S = ($TOTtotWAIT_S * 60);
+	$TOTtotWAIT_S = round($TOTtotWAIT_S, 0);
+	if ($TOTtotWAIT_S < 10) {$TOTtotWAIT_S = "0$TOTtotWAIT_S";}
+	$TOTtotWAIT_MS = "$TOTtotWAIT_M_int:$TOTtotWAIT_S";
+	$TOTtotWAIT_MS =		sprintf("%8s", $TOTtotWAIT_MS);
+		while(strlen($TOTtotWAIT_MS)>8) {$TOTtotWAIT_MS = substr("$TOTtotWAIT_MS", 0, -1);}
+
+
+	$TOTavgTALK_M = ( ($TOTtotTALK / $TOTcalls) / 60);
+	$TOTavgTALK_M = round($TOTavgTALK_M, 2);
+	$TOTavgTALK_M_int = intval("$TOTavgTALK_M");
+	$TOTavgTALK_S = ($TOTavgTALK_M - $TOTavgTALK_M_int);
+	$TOTavgTALK_S = ($TOTavgTALK_S * 60);
+	$TOTavgTALK_S = round($TOTavgTALK_S, 0);
+	if ($TOTavgTALK_S < 10) {$TOTavgTALK_S = "0$TOTavgTALK_S";}
+	$TOTavgTALK_MS = "$TOTavgTALK_M_int:$TOTavgTALK_S";
+	$TOTavgTALK_MS =		sprintf("%6s", $TOTavgTALK_MS);
+		while(strlen($TOTavgTALK_MS)>6) {$TOTavgTALK_MS = substr("$TOTavgTALK_MS", 0, -1);}
+
+	$TOTavgDISPO_M = ( ($TOTtotDISPO / $TOTcalls) / 60);
+	$TOTavgDISPO_M = round($TOTavgDISPO_M, 2);
+	$TOTavgDISPO_M_int = intval("$TOTavgDISPO_M");
+	$TOTavgDISPO_S = ($TOTavgDISPO_M - $TOTavgDISPO_M_int);
+	$TOTavgDISPO_S = ($TOTavgDISPO_S * 60);
+	$TOTavgDISPO_S = round($TOTavgDISPO_S, 0);
+	if ($TOTavgDISPO_S < 10) {$TOTavgDISPO_S = "0$TOTavgDISPO_S";}
+	$TOTavgDISPO_MS = "$TOTavgDISPO_M_int:$TOTavgDISPO_S";
+	$TOTavgDISPO_MS =		sprintf("%6s", $TOTavgDISPO_MS);
+		while(strlen($TOTavgDISPO_MS)>6) {$TOTavgDISPO_MS = substr("$TOTavgDISPO_MS", 0, -1);}
+
+	$TOTavgPAUSE_M = ( ($TOTtotPAUSE / $TOTcalls) / 60);
+	$TOTavgPAUSE_M = round($TOTavgPAUSE_M, 2);
+	$TOTavgPAUSE_M_int = intval("$TOTavgPAUSE_M");
+	$TOTavgPAUSE_S = ($TOTavgPAUSE_M - $TOTavgPAUSE_M_int);
+	$TOTavgPAUSE_S = ($TOTavgPAUSE_S * 60);
+	$TOTavgPAUSE_S = round($TOTavgPAUSE_S, 0);
+	if ($TOTavgPAUSE_S < 10) {$TOTavgPAUSE_S = "0$TOTavgPAUSE_S";}
+	$TOTavgPAUSE_MS = "$TOTavgPAUSE_M_int:$TOTavgPAUSE_S";
+	$TOTavgPAUSE_MS =		sprintf("%6s", $TOTavgPAUSE_MS);
+		while(strlen($TOTavgPAUSE_MS)>6) {$TOTavgPAUSE_MS = substr("$TOTavgPAUSE_MS", 0, -1);}
+
+	$TOTavgWAIT_M = ( ($TOTtotWAIT / $TOTcalls) / 60);
+	$TOTavgWAIT_M = round($TOTavgWAIT_M, 2);
+	$TOTavgWAIT_M_int = intval("$TOTavgWAIT_M");
+	$TOTavgWAIT_S = ($TOTavgWAIT_M - $TOTavgWAIT_M_int);
+	$TOTavgWAIT_S = ($TOTavgWAIT_S * 60);
+	$TOTavgWAIT_S = round($TOTavgWAIT_S, 0);
+	if ($TOTavgWAIT_S < 10) {$TOTavgWAIT_S = "0$TOTavgWAIT_S";}
+	$TOTavgWAIT_MS = "$TOTavgWAIT_M_int:$TOTavgWAIT_S";
+	$TOTavgWAIT_MS =		sprintf("%6s", $TOTavgWAIT_MS);
+		while(strlen($TOTavgWAIT_MS)>6) {$TOTavgWAIT_MS = substr("$TOTavgWAIT_MS", 0, -1);}
+
+
+echo "+-----------------+----------+--------+---------+--------+--------+--------+--------+--------+--------+--------+--------+$statusesHEAD\n";
+echo "|  TOTALS        AGENTS:$TOT_AGENTS | $TOTcalls| $TOTtime_MS|$TOTtotPAUSE_MS| $TOTavgPAUSE_MS |$TOTtotWAIT_MS| $TOTavgWAIT_MS |$TOTtotTALK_MS| $TOTavgTALK_MS |$TOTtotDISPO_MS| $TOTavgDISPO_MS |$SUMstatusesHTML\n";
+echo "+----------------------------+--------+---------+--------+--------+--------+--------+--------+--------+--------+--------+$statusesHEAD\n";
+
+echo "\n";
+
+}
+
+
+?>
+
+
\ No newline at end of file
diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_agent_time_sheet.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_agent_time_sheet.php
new file mode 100644
index 00000000..00985781
--- /dev/null
+++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_agent_time_sheet.php
@@ -0,0 +1,286 @@
+    LICENSE: GPLv2
+###
+# CHANGES
+#
+# 60619-1729 - Added variable filtering to eliminate SQL injection attack threat
+#            - Added required user/pass to gain access to this page
+#
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+if (isset($_GET["agent"]))				{$agent=$_GET["agent"];}
+	elseif (isset($_POST["agent"]))		{$agent=$_POST["agent"];}
+if (isset($_GET["query_date"]))				{$query_date=$_GET["query_date"];}
+	elseif (isset($_POST["query_date"]))		{$query_date=$_POST["query_date"];}
+if (isset($_GET["calls_summary"]))				{$calls_summary=$_GET["calls_summary"];}
+	elseif (isset($_POST["calls_summary"]))		{$calls_summary=$_POST["calls_summary"];}
+if (isset($_GET["submit"]))				{$submit=$_GET["submit"];}
+	elseif (isset($_POST["submit"]))		{$submit=$_POST["submit"];}
+if (isset($_GET["ΕΠΙΒΕΒΑΙΩΣΗ"]))				{$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"];}
+	elseif (isset($_POST["ΕΠΙΒΕΒΑΙΩΣΗ"]))		{$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];}
+
+$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
+$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
+
+	$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
+	if ($DB) {echo "|$stmt|\n";}
+	$rslt=mysql_query($stmt, $link);
+	$row=mysql_fetch_row($rslt);
+	$auth=$row[0];
+
+  if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
+	{
+    Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
+    Header("HTTP/1.0 401 Unauthorized");
+    echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
+    exit;
+	}
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!isset($query_date)) {$query_date = $NOW_DATE;}
+
+?>
+
+
+
+
+
+\n";
+echo "VICIDIAL: Agent Time Sheet\n";
+echo "ΔΙΑΧΕΙΡΙΣΗ: Agent Time Sheet\n";
+echo " - User Stats\n";
+echo " - User Status\n";
+echo " - ΤÏοποποίηση ΧÏήστη\n";
+echo "
\n"; +echo "
  \n"; +echo "Date: \n"; +echo "User ID: \n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n";
+
+
+if (!$agent)
+{
+echo "\n";
+echo "PLEASE SELECT AN ΧΕΙΡΙΣΤΗΣID AND DATE-TIME ABOVE AND CLICK ΕΠΙΒΕΒΑΙΩΣΗ\n";
+echo " NOTE: stats taken from available agent log data\n";
+}
+
+else
+{
+$query_date_BEGIN = "$query_date 00:00:00";   
+$query_date_END = "$query_date 23:59:59";
+$time_BEGIN = "00:00:00";   
+$time_END = "23:59:59";
+
+$stmt="select full_name from vicidial_users where user='$agent';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$full_name = $row[0];
+
+echo "VICIDIAL: Agent Time Sheet                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- ΧΕΙΡΙΣΤΗΣTIME SHEET: $agent - $full_name -------------\n\n";
+
+if ($calls_summary)
+	{
+	$stmt="select count(*) as calls,sum(talk_sec) as talk,avg(talk_sec),sum(pause_sec),avg(pause_sec),sum(wait_sec),avg(wait_sec),sum(dispo_sec),avg(dispo_sec) from vicidial_agent_log where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' and pause_sec<48800 and wait_sec<48800 and talk_sec<48800 and dispo_sec<48800 limit 1;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+
+	$TOTAL_TIME = ($row[1] + $row[3] + $row[5] + $row[7]);
+
+		$TOTAL_TIME_H = ($TOTAL_TIME / 3600);
+		$TOTAL_TIME_H = round($TOTAL_TIME_H, 2);
+		$TOTAL_TIME_H_int = intval("$TOTAL_TIME_H");
+		$TOTAL_TIME_M = ($TOTAL_TIME_H - $TOTAL_TIME_H_int);
+		$TOTAL_TIME_M = ($TOTAL_TIME_M * 60);
+		$TOTAL_TIME_M = round($TOTAL_TIME_M, 2);
+		$TOTAL_TIME_M_int = intval("$TOTAL_TIME_M");
+		$TOTAL_TIME_S = ($TOTAL_TIME_M - $TOTAL_TIME_M_int);
+		$TOTAL_TIME_S = ($TOTAL_TIME_S * 60);
+		$TOTAL_TIME_S = round($TOTAL_TIME_S, 0);
+		if ($TOTAL_TIME_S < 10) {$TOTAL_TIME_S = "0$TOTAL_TIME_S";}
+		if ($TOTAL_TIME_M_int < 10) {$TOTAL_TIME_M_int = "0$TOTAL_TIME_M_int";}
+		$TOTAL_TIME_HMS = "$TOTAL_TIME_H_int:$TOTAL_TIME_M_int:$TOTAL_TIME_S";
+		$pfTOTAL_TIME_HMS =		sprintf("%8s", $TOTAL_TIME_HMS);
+
+		$TALK_TIME_H = ($row[1] / 3600);
+		$TALK_TIME_H = round($TALK_TIME_H, 2);
+		$TALK_TIME_H_int = intval("$TALK_TIME_H");
+		$TALK_TIME_M = ($TALK_TIME_H - $TALK_TIME_H_int);
+		$TALK_TIME_M = ($TALK_TIME_M * 60);
+		$TALK_TIME_M = round($TALK_TIME_M, 2);
+		$TALK_TIME_M_int = intval("$TALK_TIME_M");
+		$TALK_TIME_S = ($TALK_TIME_M - $TALK_TIME_M_int);
+		$TALK_TIME_S = ($TALK_TIME_S * 60);
+		$TALK_TIME_S = round($TALK_TIME_S, 0);
+		if ($TALK_TIME_S < 10) {$TALK_TIME_S = "0$TALK_TIME_S";}
+		if ($TALK_TIME_M_int < 10) {$TALK_TIME_M_int = "0$TALK_TIME_M_int";}
+		$TALK_TIME_HMS = "$TALK_TIME_H_int:$TALK_TIME_M_int:$TALK_TIME_S";
+		$pfTALK_TIME_HMS =		sprintf("%8s", $TALK_TIME_HMS);
+
+		$PAUSE_TIME_H = ($row[3] / 3600);
+		$PAUSE_TIME_H = round($PAUSE_TIME_H, 2);
+		$PAUSE_TIME_H_int = intval("$PAUSE_TIME_H");
+		$PAUSE_TIME_M = ($PAUSE_TIME_H - $PAUSE_TIME_H_int);
+		$PAUSE_TIME_M = ($PAUSE_TIME_M * 60);
+		$PAUSE_TIME_M = round($PAUSE_TIME_M, 2);
+		$PAUSE_TIME_M_int = intval("$PAUSE_TIME_M");
+		$PAUSE_TIME_S = ($PAUSE_TIME_M - $PAUSE_TIME_M_int);
+		$PAUSE_TIME_S = ($PAUSE_TIME_S * 60);
+		$PAUSE_TIME_S = round($PAUSE_TIME_S, 0);
+		if ($PAUSE_TIME_S < 10) {$PAUSE_TIME_S = "0$PAUSE_TIME_S";}
+		if ($PAUSE_TIME_M_int < 10) {$PAUSE_TIME_M_int = "0$PAUSE_TIME_M_int";}
+		$PAUSE_TIME_HMS = "$PAUSE_TIME_H_int:$PAUSE_TIME_M_int:$PAUSE_TIME_S";
+		$pfPAUSE_TIME_HMS =		sprintf("%8s", $PAUSE_TIME_HMS);
+
+		$WAIT_TIME_H = ($row[5] / 3600);
+		$WAIT_TIME_H = round($WAIT_TIME_H, 2);
+		$WAIT_TIME_H_int = intval("$WAIT_TIME_H");
+		$WAIT_TIME_M = ($WAIT_TIME_H - $WAIT_TIME_H_int);
+		$WAIT_TIME_M = ($WAIT_TIME_M * 60);
+		$WAIT_TIME_M = round($WAIT_TIME_M, 2);
+		$WAIT_TIME_M_int = intval("$WAIT_TIME_M");
+		$WAIT_TIME_S = ($WAIT_TIME_M - $WAIT_TIME_M_int);
+		$WAIT_TIME_S = ($WAIT_TIME_S * 60);
+		$WAIT_TIME_S = round($WAIT_TIME_S, 0);
+		if ($WAIT_TIME_S < 10) {$WAIT_TIME_S = "0$WAIT_TIME_S";}
+		if ($WAIT_TIME_M_int < 10) {$WAIT_TIME_M_int = "0$WAIT_TIME_M_int";}
+		$WAIT_TIME_HMS = "$WAIT_TIME_H_int:$WAIT_TIME_M_int:$WAIT_TIME_S";
+		$pfWAIT_TIME_HMS =		sprintf("%8s", $WAIT_TIME_HMS);
+
+		$WRAPUP_TIME_H = ($row[7] / 3600);
+		$WRAPUP_TIME_H = round($WRAPUP_TIME_H, 2);
+		$WRAPUP_TIME_H_int = intval("$WRAPUP_TIME_H");
+		$WRAPUP_TIME_M = ($WRAPUP_TIME_H - $WRAPUP_TIME_H_int);
+		$WRAPUP_TIME_M = ($WRAPUP_TIME_M * 60);
+		$WRAPUP_TIME_M = round($WRAPUP_TIME_M, 2);
+		$WRAPUP_TIME_M_int = intval("$WRAPUP_TIME_M");
+		$WRAPUP_TIME_S = ($WRAPUP_TIME_M - $WRAPUP_TIME_M_int);
+		$WRAPUP_TIME_S = ($WRAPUP_TIME_S * 60);
+		$WRAPUP_TIME_S = round($WRAPUP_TIME_S, 0);
+		if ($WRAPUP_TIME_S < 10) {$WRAPUP_TIME_S = "0$WRAPUP_TIME_S";}
+		if ($WRAPUP_TIME_M_int < 10) {$WRAPUP_TIME_M_int = "0$WRAPUP_TIME_M_int";}
+		$WRAPUP_TIME_HMS = "$WRAPUP_TIME_H_int:$WRAPUP_TIME_M_int:$WRAPUP_TIME_S";
+		$pfWRAPUP_TIME_HMS =		sprintf("%8s", $WRAPUP_TIME_HMS);
+
+		$TALK_AVG_M = ($row[2] / 60);
+		$TALK_AVG_M = round($TALK_AVG_M, 2);
+		$TALK_AVG_M_int = intval("$TALK_AVG_M");
+		$TALK_AVG_S = ($TALK_AVG_M - $TALK_AVG_M_int);
+		$TALK_AVG_S = ($TALK_AVG_S * 60);
+		$TALK_AVG_S = round($TALK_AVG_S, 0);
+		if ($TALK_AVG_S < 10) {$TALK_AVG_S = "0$TALK_AVG_S";}
+		$TALK_AVG_MS = "$TALK_AVG_M_int:$TALK_AVG_S";
+		$pfTALK_AVG_MS =		sprintf("%6s", $TALK_AVG_MS);
+
+		$PAUSE_AVG_M = ($row[4] / 60);
+		$PAUSE_AVG_M = round($PAUSE_AVG_M, 2);
+		$PAUSE_AVG_M_int = intval("$PAUSE_AVG_M");
+		$PAUSE_AVG_S = ($PAUSE_AVG_M - $PAUSE_AVG_M_int);
+		$PAUSE_AVG_S = ($PAUSE_AVG_S * 60);
+		$PAUSE_AVG_S = round($PAUSE_AVG_S, 0);
+		if ($PAUSE_AVG_S < 10) {$PAUSE_AVG_S = "0$PAUSE_AVG_S";}
+		$PAUSE_AVG_MS = "$PAUSE_AVG_M_int:$PAUSE_AVG_S";
+		$pfPAUSE_AVG_MS =		sprintf("%6s", $PAUSE_AVG_MS);
+
+		$WAIT_AVG_M = ($row[6] / 60);
+		$WAIT_AVG_M = round($WAIT_AVG_M, 2);
+		$WAIT_AVG_M_int = intval("$WAIT_AVG_M");
+		$WAIT_AVG_S = ($WAIT_AVG_M - $WAIT_AVG_M_int);
+		$WAIT_AVG_S = ($WAIT_AVG_S * 60);
+		$WAIT_AVG_S = round($WAIT_AVG_S, 0);
+		if ($WAIT_AVG_S < 10) {$WAIT_AVG_S = "0$WAIT_AVG_S";}
+		$WAIT_AVG_MS = "$WAIT_AVG_M_int:$WAIT_AVG_S";
+		$pfWAIT_AVG_MS =		sprintf("%6s", $WAIT_AVG_MS);
+
+		$WRAPUP_AVG_M = ($row[8] / 60);
+		$WRAPUP_AVG_M = round($WRAPUP_AVG_M, 2);
+		$WRAPUP_AVG_M_int = intval("$WRAPUP_AVG_M");
+		$WRAPUP_AVG_S = ($WRAPUP_AVG_M - $WRAPUP_AVG_M_int);
+		$WRAPUP_AVG_S = ($WRAPUP_AVG_S * 60);
+		$WRAPUP_AVG_S = round($WRAPUP_AVG_S, 0);
+		if ($WRAPUP_AVG_S < 10) {$WRAPUP_AVG_S = "0$WRAPUP_AVG_S";}
+		$WRAPUP_AVG_MS = "$WRAPUP_AVG_M_int:$WRAPUP_AVG_S";
+		$pfWRAPUP_AVG_MS =		sprintf("%6s", $WRAPUP_AVG_MS);
+
+	echo "ΣΥÎΟΛΙΚΕΣ ΚΛΗΣΕΙΣTAKEN: $row[0]\n";
+	echo "TALK TIME:               $pfTALK_TIME_HMS     AVERAGE: $pfTALK_AVG_MS\n";
+	echo "PAUSE TIME:              $pfPAUSE_TIME_HMS     AVERAGE: $pfPAUSE_AVG_MS\n";
+	echo "WAIT TIME:               $pfWAIT_TIME_HMS     AVERAGE: $pfWAIT_AVG_MS\n";
+	echo "WRAPUP TIME:             $pfWRAPUP_TIME_HMS     AVERAGE: $pfWRAPUP_AVG_MS\n";
+	echo "----------------------------------------------------------------\n";
+	echo "TOTAL ACTIVE ΧΕΙΡΙΣΤΗΣTIME: $pfTOTAL_TIME_HMS\n";
+
+	echo "\n";
+	}
+else
+	{
+	echo "Call Activity Summary\n\n";
+
+	}
+
+$stmt="select event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' order by event_time limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+echo "FIRST LOGIN:          $row[0]\n";
+$start = $row[1];
+
+$stmt="select event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' order by event_time desc limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+echo "LAST LOG ACTIVITY:    $row[0]\n";
+$end = $row[1];
+
+$login_time = ($end - $start);
+	$LOGIN_TIME_H = ($login_time / 3600);
+	$LOGIN_TIME_H = round($LOGIN_TIME_H, 2);
+	$LOGIN_TIME_H_int = intval("$LOGIN_TIME_H");
+	$LOGIN_TIME_M = ($LOGIN_TIME_H - $LOGIN_TIME_H_int);
+	$LOGIN_TIME_M = ($LOGIN_TIME_M * 60);
+	$LOGIN_TIME_M = round($LOGIN_TIME_M, 2);
+	$LOGIN_TIME_M_int = intval("$LOGIN_TIME_M");
+	$LOGIN_TIME_S = ($LOGIN_TIME_M - $LOGIN_TIME_M_int);
+	$LOGIN_TIME_S = ($LOGIN_TIME_S * 60);
+	$LOGIN_TIME_S = round($LOGIN_TIME_S, 0);
+	if ($LOGIN_TIME_S < 10) {$LOGIN_TIME_S = "0$LOGIN_TIME_S";}
+	if ($LOGIN_TIME_M_int < 10) {$LOGIN_TIME_M_int = "0$LOGIN_TIME_M_int";}
+	$LOGIN_TIME_HMS = "$LOGIN_TIME_H_int:$LOGIN_TIME_M_int:$LOGIN_TIME_S";
+	$pfLOGIN_TIME_HMS =		sprintf("%8s", $LOGIN_TIME_HMS);
+
+echo "-----------------------------------------\n";
+echo "TOTAL LOGGED-IN TIME:    $pfLOGIN_TIME_HMS\n";
+
+}
+
+
+
+?>
+
+
\ No newline at end of file
diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_inboundEXTstats.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_inboundEXTstats.php
new file mode 100644
index 00000000..0181b547
--- /dev/null
+++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_inboundEXTstats.php
@@ -0,0 +1,400 @@
+    LICENSE: GPLv2
+#
+# CHANGES
+# 60421-1450 - check GET/POST vars lines with isset to not trigger PHP NOTICES
+# 60620-1322 - Added variable filtering to eliminate SQL injection attack threat
+#            - Added required user/pass to gain access to this page
+#
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+if (isset($_GET["group"]))					{$group=$_GET["group"];}
+	elseif (isset($_POST["group"]))			{$group=$_POST["group"];}
+if (isset($_GET["query_date"]))				{$query_date=$_GET["query_date"];}
+	elseif (isset($_POST["query_date"]))	{$query_date=$_POST["query_date"];}
+if (isset($_GET["server_ip"]))				{$server_ip=$_GET["server_ip"];}
+	elseif (isset($_POST["server_ip"]))		{$server_ip=$_POST["server_ip"];}
+if (isset($_GET["submit"]))					{$submit=$_GET["submit"];}
+	elseif (isset($_POST["submit"]))		{$submit=$_POST["submit"];}
+if (isset($_GET["ΕΠΙΒΕΒΑΙΩΣΗ"]))					{$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"];}
+	elseif (isset($_POST["ΕΠΙΒΕΒΑΙΩΣΗ"]))		{$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];}
+
+$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
+$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
+
+	$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
+	if ($DB) {echo "|$stmt|\n";}
+	$rslt=mysql_query($stmt, $link);
+	$row=mysql_fetch_row($rslt);
+	$auth=$row[0];
+
+  if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
+	{
+    Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
+    Header("HTTP/1.0 401 Unauthorized");
+    echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
+    exit;
+	}
+
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!isset($query_date)) {$query_date = $NOW_DATE;}
+if (!isset($server_ip)) {$server_ip = '10.10.11.20';}
+
+$stmt="select extension,full_number,inbound_name from inbound_numbers where server_ip='" . mysql_real_escape_string($server_ip) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$inbound_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $inbound_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$inbound[$i] =$row[0];
+	$fullnum[$i] =$row[1];
+	$inbname[$i] =$row[2];
+	$i++;
+	}
+?>
+
+
+
+
+
+\n";
+#echo"\n";
+echo "ASTERISK: Στατιστικά ΕισεÏχομένων Κλήσεων\n";
+echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "ΠΑΡΑΚΑΛΩ ΕΠΙΛΕΞΤΕ ΕÎΑΠΑΡΙΘΜΟ ΚΑΙ ΗΜΕΡΟΜΗÎΙΑ ΑÎΩΤΕΡΩ, ΚΑΙ ΠΑΤΗΣΤΕ ΕΠΙΒΕΒΑΙΩΣΗ\n";
+}
+
+else
+{
+
+
+echo "ASTERISK: Στατιστικά ΕισεÏχομένων Κλήσεων                      $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$extenSQL = "and extension='" . mysql_real_escape_string($group) . "'";
+if (eregi("\*",$group))
+	{$extenSQL = "and extension LIKE \"%$group\"";}
+$stmt="select count(*),sum(length_in_sec) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " 00:00:01' and start_time <= '" . mysql_real_escape_string($query_date) . " 23:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Συνολικές κλήσεις που ήÏθαν σε αυτό τον αÏιθμό:       $TOTALcalls\n";
+echo "Average Call Length(seconds) for all Calls:   $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- ΕΓΚΑΤΑΛ\n";
+
+$stmt="select count(*),sum(length_in_sec) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " 00:00:01' and start_time <= '" . mysql_real_escape_string($query_date) . " 23:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$DROPcalls =	sprintf("%10s", $row[0]);
+$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
+$DROPpercent = round($DROPpercent, 0);
+
+if ($row[0])
+	{
+	$average_hold_seconds = ($row[1] / $row[0]);
+	$average_hold_seconds = round($average_hold_seconds, 0);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+else {$DROPpercent=0;   $average_hold_seconds=0;}
+echo "Total DROP Calls:   (less than 10 seconds)    $DROPcalls  $DROPpercent%\n";
+echo "Average Call Length(seconds) for DROP Calls:  $average_hold_seconds\n";
+
+
+##############################
+#########  CALLS STATS
+
+echo "\n";
+echo "---------- CALL LISTINGS\n";
+echo "+----------------------+----------------------+--------+---------------------+\n";
+echo "| CALLERID             | CALLERIDNAME         | LENGTH | DATE TIME           |\n";
+echo "+----------------------+----------------------+--------+---------------------+\n";
+
+$stmt="select number_dialed,caller_code,length_in_sec,start_time from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " 00:00:01' and start_time <= '" . mysql_real_escape_string($query_date) . " 23:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$CID =			sprintf("%-20s", $row[0]);
+	$CIDname =		sprintf("%-20s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
+	$datetime =		sprintf("%-19s", $row[3]);
+	$USERavgTALK =	$row[2];
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $CID | $CIDname | $USERavgTALK_MS | $datetime |\n";
+
+	$i++;
+	}
+
+echo "+----------------------+----------------------+--------+---------------------+\n";
+
+##############################
+#########  TIME STATS
+
+if ($output == 'FULL')
+	{
+
+	echo "\n";
+	echo "---------- ΣΤΑΤ.ΧΡΟÎ.\n";
+
+	echo "\n";
+
+	$hi_hour_count=0;
+	$last_full_record=0;
+	$i=0;
+	$h=0;
+	while ($i <= 96)
+		{
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:00:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:14:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:00:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:14:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:15:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:29:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:15:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:29:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:30:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:44:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:30:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:44:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:45:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:45:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+		$h++;
+		}
+
+	$hour_multiplier = (100 / $hi_hour_count);
+	#$hour_multiplier = round($hour_multiplier, 0);
+
+	echo "\n";
+	echo "ΓΡΑΦΙΚΗ ΠΑΡΑΣΤΑΣΗ ΜΕ 15ΛΕΠΤΕΣ ΑΥΞΗΣΕΙΣ ΤΩΠΣΥÎΟΛΙΚΩΠΚΛΗΣΕΩÎ\n";
+
+	$k=1;
+	$Mk=0;
+	$call_scale = '0';
+	while ($k <= 102) 
+		{
+		if ($Mk >= 5) 
+			{
+			$Mk=0;
+			$scale_num=($k / $hour_multiplier);
+			$scale_num = round($scale_num, 0);
+			$LENscale_num = (strlen($scale_num));
+			$k = ($k + $LENscale_num);
+			$call_scale .= "$scale_num";
+			}
+		else
+			{
+			$call_scale .= " ";
+			$k++;   $Mk++;
+			}
+		}
+
+
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+	#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+	echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+	$ZZ = '00';
+	$i=0;
+	$h=4;
+	$hour= -1;
+	$no_lines_yet=1;
+
+	while ($i <= 96)
+		{
+		$char_counter=0;
+		$time = '      ';
+		if ($h >= 4) 
+			{
+			$hour++;
+			$h=0;
+			if ($hour < 10) {$hour = "0$hour";}
+			$time = "+$hour$ZZ+";
+			}
+		if ($h == 1) {$time = "   15 ";}
+		if ($h == 2) {$time = "   30 ";}
+		if ($h == 3) {$time = "   45 ";}
+		$Ghour_count = $hour_count[$i];
+		if ($Ghour_count < 1) 
+			{
+			if ( ($no_lines_yet) or ($i > $last_full_record) )
+				{
+				$do_nothing=1;
+				}
+			else
+				{
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+				echo "|$time|";
+				$k=0;   while ($k <= 102) {echo " ";   $k++;}
+				echo "| $hour_count[$i] |\n";
+				}
+			}
+		else
+			{
+			$no_lines_yet=0;
+			$Xhour_count = ($Ghour_count * $hour_multiplier);
+			$Yhour_count = (99 - $Xhour_count);
+
+			$Gdrop_count = $drop_count[$i];
+			if ($Gdrop_count < 1) 
+				{
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+				echo "|$time|";
+				$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+				echo "*X";   $char_counter++;
+				$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+					while ($char_counter <= 101) {echo " ";   $char_counter++;}
+				echo "| 0     | $hour_count[$i] |\n";
+
+				}
+			else
+				{
+				$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+			#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+				$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+				$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+				echo "|$time|";
+				$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+				echo "D";   $char_counter++;
+				$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+				echo "X";   $char_counter++;
+				$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+					while ($char_counter <= 102) {echo " ";   $char_counter++;}
+				echo "| $drop_count[$i] | $hour_count[$i] |\n";
+				}
+			}
+		
+		
+		$i++;
+		$h++;
+		}
+
+
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+
+	}
+
+
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_server_performance.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_server_performance.php new file mode 100644 index 00000000..01c91c40 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_server_performance.php @@ -0,0 +1,306 @@ + LICENSE: GPLv2 +# +# CHANGES +# +# 60619-1732 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 70417-1106 - Changed time frame to be definable per time range on a single day +# - Fixed vertical scaling issues +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["begin_query_time"])) {$begin_query_time=$_GET["begin_query_time"];} + elseif (isset($_POST["begin_query_time"])) {$begin_query_time=$_POST["begin_query_time"];} +if (isset($_GET["end_query_time"])) {$end_query_time=$_GET["end_query_time"];} + elseif (isset($_POST["end_query_time"])) {$end_query_time=$_POST["end_query_time"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"];} + elseif (isset($_POST["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and modify_servers='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +# path from root to where ploticus files will be stored +$PLOTroot = "vicidial/ploticus"; +$DOCroot = "$WeBServeRRooT/$PLOTroot/"; + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); + +if (!isset($query_date)) {$query_date = $NOW_DATE;} +if (!isset($begin_query_time)) {$begin_query_time = '09:00:00';} +if (!isset($end_query_time)) {$end_query_time = '15:30:00';} +if (!isset($group)) {$group = '';} + +$stmt="select server_ip from servers;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$servers_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $servers_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: Server Performance\n"; +echo "
\n"; +echo "Date:   \n"; +echo "Time: \n"; +echo "to \n"; +echo "Server: \n"; +echo "\n"; +echo "             ΑÎΑΦΟΡΕΣ \n"; +echo "
\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A SERVER, DATE AND TIME RANGE ABOVE AND CLICK ΕΠΙΒΕΒΑΙΩΣΗ\n";
+}
+
+else
+{
+
+$query_date_BEGIN = "$query_date $begin_query_time";   
+$query_date_END = "$query_date $end_query_time";
+$time_BEGIN = "$begin_query_time";   
+$time_END = "$end_query_time";
+
+echo "VICIDIAL: Server Performance                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- TOTALS, PEAKS and AVERAGES\n";
+
+$stmt="select AVG(sysload),AVG(channels_total),MAX(sysload),MAX(channels_total),MAX(processes) from server_performance where start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and server_ip='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$AVGload =	sprintf("%10s", $row[0]);
+$AVGchannels =	sprintf("%10s", $row[1]);
+$HIGHload =	$row[2];
+	$HIGHmulti = intval($HIGHload / 100);
+$HIGHchannels =	$row[3];
+$HIGHprocesses =$row[4];
+if ($row[2] > $row[3]) {$HIGHlimit = $row[2];}
+else {$HIGHlimit = $row[3];}
+if ($HIGHlimit < $row[4]) {$HIGHlimit = $row[4];}
+
+$stmt="select AVG(cpu_user_percent),AVG(cpu_system_percent),AVG(cpu_idle_percent) from server_performance where start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and server_ip='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$AVGcpuUSER =	sprintf("%10s", $row[0]);
+$AVGcpuSYSTEM =	sprintf("%10s", $row[1]);
+$AVGcpuIDLE =	sprintf("%10s", $row[2]);
+
+$stmt="select count(*),SUM(length_in_min) from call_log where extension NOT IN('8365','8366','8367') and  start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and server_ip='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$OFFHOOKtime =	sprintf("%10s", $row[1]);
+
+
+echo "Total Calls in/out on this server:        $TOTALcalls\n";
+echo "Total Off-Hook time on this server (min): $OFFHOOKtime\n";
+echo "Average/Peak channels in use for server:  $AVGchannels / $HIGHchannels\n";
+echo "Average/Peak load for server:             $AVGload / $HIGHload\n";
+echo "Average USER process cpu percentage:      $AVGcpuUSER %\n";
+echo "Average SYSTEM process cpu percentage:    $AVGcpuSYSTEM %\n";
+echo "Average IDLE process cpu percentage:      $AVGcpuIDLE %\n";
+
+echo "\n";
+echo "---------- LINE GRAPH:\n";
+
+
+
+##############################
+#########  Graph stats
+
+$DAT = '.dat';
+$HTM = '.htm';
+$PNG = '.png';
+$filedate = date("Y-m-d_His");
+$DATfile = "$group$query_date$shift$filedate$DAT";
+$HTMfile = "$group$query_date$shift$filedate$HTM";
+$PNGfile = "$group$query_date$shift$filedate$PNG";
+
+$HTMfp = fopen ("$DOCroot/$HTMfile", "a");
+$DATfp = fopen ("$DOCroot/$DATfile", "a");
+
+$stmt="select DATE_FORMAT(start_time,'%H:%i:%s') as timex,sysload,processes,channels_total,live_recordings,cpu_user_percent,cpu_system_percent from server_performance where server_ip='" . mysql_real_escape_string($group) . "' and start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' order by timex;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$row[5] = intval(($row[5] + $row[6]) * $HIGHmulti);
+	$row[6] = intval($row[6] * $HIGHmulti);
+	fwrite ($DATfp, "$row[5]\t$row[6]\t$row[0]\t$row[1]\t$row[2]\t$row[3]\n");
+	$i++;
+	}
+fclose($DATfp);
+
+$rows_to_max = ($rows_to_print + 100);
+
+#print "rows: $i\n";
+
+$time_scale_abb = '5 minutes';
+$time_scale_tick = '1 minute';
+if ($i > 1000) {$time_scale_abb = '10 minutes';   $time_scale_tick = '2 minutes';}
+if ($i > 2000) {$time_scale_abb = '20 minutes';   $time_scale_tick = '4 minutes';}
+if ($i > 3000) {$time_scale_abb = '30 minutes';   $time_scale_tick = '5 minutes';}
+if ($i > 4000) {$time_scale_abb = '40 minutes';   $time_scale_tick = '10 minutes';}
+if ($i > 5000) {$time_scale_abb = '60 minutes';   $time_scale_tick = '15 minutes';}
+if ($i > 6000) {$time_scale_abb = '90 minutes';   $time_scale_tick = '15 minutes';}
+if ($i > 7000) {$time_scale_abb = '120 minutes';   $time_scale_tick = '30 minutes';}
+
+$HTMcontent  = '';
+$HTMcontent .= "#proc page\n";
+$HTMcontent .= "#if @DEVICE in png,gif\n";
+$HTMcontent .= "   scale: 0.6\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#endif\n";
+$HTMcontent .= "#proc getdata\n";
+$HTMcontent .= "file: $DOCroot/$DATfile\n";
+$HTMcontent .= "fieldnames: userproc sysproc time load processes channels\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc areadef\n";
+$HTMcontent .= "title: Server $group   $query_date_BEGIN to $query_date_END\n";
+$HTMcontent .= "titledetails: size=14  align=C\n";
+$HTMcontent .= "rectangle: 1 1 14 7\n";
+$HTMcontent .= "xscaletype: time hh:mm:ss\n";
+$HTMcontent .= "xrange: $time_BEGIN $time_END\n";
+$HTMcontent .= "yrange: 0 $HIGHlimit\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc xaxis\n";
+$HTMcontent .= "stubs: inc $time_scale_abb\n";
+$HTMcontent .= "minorticinc: $time_scale_tick\n";
+$HTMcontent .= "stubformat: hh:mm:ssa\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc yaxis\n";
+$HTMcontent .= "stubs: inc 50\n";
+$HTMcontent .= "grid: color=yellow\n";
+$HTMcontent .= "gridskip: min\n";
+$HTMcontent .= "ticincrement: 100 1000\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc lineplot\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: userproc\n";
+$HTMcontent .= "linedetails: color=purple width=.5\n";
+$HTMcontent .= "fill: lavender\n";
+$HTMcontent .= "legendlabel: user proc%\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc lineplot\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: sysproc\n";
+$HTMcontent .= "linedetails: color=yelloworange width=.5\n";
+$HTMcontent .= "fill: dullyellow\n";
+$HTMcontent .= "legendlabel: system proc%\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: load\n";
+$HTMcontent .= "linedetails: color=blue width=.5\n";
+$HTMcontent .= "legendlabel: load\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: processes\n";
+$HTMcontent .= "linedetails: color=red width=.5\n";
+$HTMcontent .= "legendlabel: processes\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: channels\n";
+$HTMcontent .= "linedetails: color=green width=.5\n";
+$HTMcontent .= "legendlabel: channels\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc legend\n";
+$HTMcontent .= "location: max-2 max\n";
+$HTMcontent .= "seglen: 0.2\n";
+$HTMcontent .= "\n";
+
+fwrite ($HTMfp, "$HTMcontent");
+fclose($HTMfp);
+
+
+passthru("/usr/local/bin/pl -png $DOCroot/$HTMfile -o $DOCroot/$PNGfile");
+
+sleep(1);
+
+echo "
\n"; +echo "\n"; +echo "\n"; + + +echo ""; + +} + + + +?> + + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_timeonVDAD.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_timeonVDAD.php new file mode 100644 index 00000000..a0f5f64d --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_timeonVDAD.php @@ -0,0 +1,374 @@ + LICENSE: GPLv2 +### +# live real-time stats for the VICIDIAL Auto-Dialer +# +# CHANGES +# +# 60620-1037 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 61114-2004 - Changed to display CLOSER and DEFAULT, added trunk shortage +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["reset_counter"])) {$reset_counter=$_GET["reset_counter"];} + elseif (isset($_POST["reset_counter"])) {$reset_counter=$_POST["reset_counter"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"];} + elseif (isset($_POST["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];} +if (isset($_GET["closer_display"])) {$closer_display=$_GET["closer_display"];} + elseif (isset($_POST["closer_display"])) {$closer_display=$_POST["closer_display"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +$epochSIXhoursAGO = ($STARTtime - 21600); +$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO); + +$reset_counter++; + +if ($reset_counter > 7) + { + $reset_counter=0; + + $stmt="update park_log set status='HUNGUP' where hangup_time is not null;"; +# $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + + if ($DB) + { + $stmt="delete from park_log where grab_time < '$timeSIXhoursAGO' and (hangup_time is null or hangup_time='');"; +# $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + } + } + +?> + + + +\n"; +echo " + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On VDAD\n"; +echo "
";
+
+###################################################################################
+###### SERVER INFORMATION
+###################################################################################
+
+$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where server_ip='" . mysql_real_escape_string($server_ip) . "';";
+$rslt=mysql_query($stmt, $link);
+$row=mysql_fetch_row($rslt);
+$balanceSHORT = $row[0];
+
+echo "SERVER: $server_ip\n";
+
+
+
+###################################################################################
+###### TIME ON SYSTEM
+###################################################################################
+
+if ($closer_display>0) {$closer_display_reverse=0;   $closer_reverse_link='DEFAULT';}
+else {$closer_display_reverse=1;   $closer_reverse_link='CLOSER';}
+
+echo "VICIDIAL: Agents Time On Calls           $NOW_TIME    $closer_reverse_link | ΑÎΑΦΟΡΕΣ\n\n";
+
+if ($closer_display>0)
+{
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+echo "| STATION    | USER   | SESSIONID | CHANNEL             | STATUS | CALLTIME | MINUTES | CAMPAIGN     | FRONT  |\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+}
+else
+{
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+\n";
+echo "| STATION    | USER   | SESSIONID | CHANNEL             | STATUS | CALLTIME | MINUTES |\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+\n";
+}
+
+$stmt="select extension,user,conf_exten,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),uniqueid,lead_id from vicidial_live_agents where status NOT IN('PAUSED') and server_ip='" . mysql_real_escape_string($server_ip) . "' order by extension;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$talking_to_print = mysql_num_rows($rslt);
+	if ($talking_to_print > 0)
+	{
+	$i=0;
+	while ($i < $talking_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+			if (eregi("READY|PAUSED|CLOSER",$row[4]))
+			{
+			$row[3]='';
+			$row[5]='- WAIT -';
+			$row[6]=$row[7];
+			}
+		$extension[$i] = eregi_replace('Local/',"",$row[0]);
+		$extension[$i] =		sprintf("%-10s", $extension[$i]);
+			while(strlen($extension[$i])>10) {$extension[$i] = substr("$extension[$i]", 0, -1);}
+		$user[$i] =				sprintf("%-6s", $row[1]);
+		$sessionid[$i] =		sprintf("%-9s", $row[2]);
+		$channel[$i] =			sprintf("%-19s", $row[3]);
+			$cc[$i]=0;
+		while ( (strlen($channel[$i]) > 19) and ($cc[$i] < 100) )
+			{
+			$channel[$i] = eregi_replace(".$","",$channel[$i]);   
+			$cc[$i]++;
+			if (strlen($channel[$i]) <= 19) {$cc[$i]=101;}
+			}
+		$status[$i] =			sprintf("%-6s", $row[4]);
+		$start_time[$i] =		sprintf("%-8s", $row[5]);
+			$cd[$i]=0;
+		while ( (strlen($start_time[$i]) > 8) and ($cd[$i] < 100) )
+			{
+			$start_time[$i] = eregi_replace("^.","",$start_time[$i]);   
+			$cd[$i]++;
+			if (strlen($start_time[$i]) <= 8) {$cd[$i]=101;}
+			}
+		$uniqueid[$i] =			$row[8];
+		$lead_id[$i] =			$row[9];
+		$closer[$i] =			$row[1];
+		$call_time_S[$i] = ($STARTtime - $row[6]);
+
+		$call_time_M[$i] = ($call_time_S[$i] / 60);
+		$call_time_M[$i] = round($call_time_M[$i], 2);
+		$call_time_M_int[$i] = intval("$call_time_M[$i]");
+		$call_time_SEC[$i] = ($call_time_M[$i] - $call_time_M_int[$i]);
+		$call_time_SEC[$i] = ($call_time_SEC[$i] * 60);
+		$call_time_SEC[$i] = round($call_time_SEC[$i], 0);
+		if ($call_time_SEC[$i] < 10) {$call_time_SEC[$i] = "0$call_time_SEC[$i]";}
+		$call_time_MS[$i] = "$call_time_M_int[$i]:$call_time_SEC[$i]";
+		$call_time_MS[$i] =		sprintf("%7s", $call_time_MS[$i]);
+
+		if ($closer_display<1)
+			{
+			$G = '';		$EG = '';
+			if ($call_time_M_int[$i] >= 5) {$G=''; $EG='';}
+			if ($call_time_M_int[$i] >= 10) {$G=''; $EG='';}
+			if (eregi("PAUSED",$row[4])) 
+				{
+				if ($call_time_M_int >= 1) 
+					{$i++; continue;} 
+				else
+					{$G=''; $EG='';}
+				}
+			$agentcount++;
+			echo "| $G$extension[$i]$EG | $G$user[$i]$EG | $G$sessionid[$i]$EG | $G$channel[$i]$EG | $G$status[$i]$EG | $G$start_time[$i]$EG | $G$call_time_MS[$i]$EG |\n";
+			}
+		$i++;
+		}
+
+		if ($closer_display>0)
+		{
+
+			$ext_count = $i;
+			$i=0;
+		while ($i < $ext_count)
+			{
+
+			$stmt="select campaign_id from vicidial_auto_calls where lead_id='$lead_id[$i]' and server_ip='" . mysql_real_escape_string($server_ip) . "';";
+			$rslt=mysql_query($stmt, $link);
+			if ($DB) {echo "$stmt\n";}
+			$camp_to_print = mysql_num_rows($rslt);
+			if ($camp_to_print > 0)
+				{
+				$row=mysql_fetch_row($rslt);
+				$campaign = sprintf("%-12s", $row[0]);
+				$camp_color = $row[0];
+				}
+			else
+				{$campaign = 'DEAD        ';   	$camp_color = 'DEAD';}
+			if (eregi("READY|PAUSED|CLOSER",$status[$i]))
+				{$campaign = '            ';   	$camp_color = '';}
+
+			$stmt="select user from vicidial_xfer_log where lead_id='$lead_id[$i]' and closer='$closer[$i]' order by call_date desc limit 1;";
+			$rslt=mysql_query($stmt, $link);
+			if ($DB) {echo "$stmt\n";}
+			$xfer_to_print = mysql_num_rows($rslt);
+			if ($xfer_to_print > 0)
+				{
+				$row=mysql_fetch_row($rslt);
+				$fronter = sprintf("%-6s", $row[0]);
+				}
+			else
+				{$fronter = '      ';}
+
+			$G = '';		$EG = '';
+			$G=""; $EG='';
+		#	if ($call_time_M_int[$i] >= 5) {$G=''; $EG='';}
+		#	if ($call_time_M_int[$i] >= 10) {$G=''; $EG='';}
+
+			echo "| $G$extension[$i]$EG | $G$user[$i]$EG | $G$sessionid[$i]$EG | $G$channel[$i]$EG | $G$status[$i]$EG | $G$start_time[$i]$EG | $G$call_time_MS[$i]$EG | $G$campaign$EG | $G$fronter$EG |\n";
+
+			$i++;
+			}
+		echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+		echo "  $i ΧειÏιστές συνδεμένοι στον διακομιστή $server_ip\n\n";
+	#	echo "             - 5 λεπτά ή παÏαπάνω σε κλήση\n";
+	#	echo "             - Πάνω από 10 λεπτά σε κλήση\n";
+		}
+	else
+		{
+		echo "+------------|--------+-----------+---------------------+--------+----------+---------+\n";
+		echo "  $agentcount ΧειÏιστές συνδεμένοι στον διακομιστή $server_ip\n\n";
+
+		echo "             - ΧειÏιστές σε παÏση\n";
+		echo "             - 5 λεπτά ή παÏαπάνω σε κλήση\n";
+		echo "             - Πάνω από 10 λεπτά σε κλήση\n";
+		}
+
+	}
+	else
+	{
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	echo "********************************* ΚΑÎΕÎΑΣ ΧΕΙΡ. ΣΕ ΚΛΗΣΕΙΣ *********************************\n";
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	}
+
+
+###################################################################################
+###### OUTBOUND CALLS
+###################################################################################
+#echo "\n\n";
+echo "----------------------------------------------------------------------------------------";
+echo "\n\n";
+echo "VICIDIAL: Time On VDAD            TRUNK SHORT: $balanceSHORT              $NOW_TIME\n\n";
+echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+echo "| CHANNEL             | STATUS | CAMPAIGN     | PHONE NUMBER       | CALLTIME | MINUTES |\n";
+echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+
+$stmt="select channel,status,campaign_id,phone_code,phone_number,call_time,UNIX_TIMESTAMP(call_time) from vicidial_auto_calls where status NOT IN('XFER') and server_ip='" . mysql_real_escape_string($server_ip) . "' order by auto_call_id desc;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$parked_to_print = mysql_num_rows($rslt);
+	if ($parked_to_print > 0)
+	{
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$channel =			sprintf("%-19s", $row[0]);
+			$cc=0;
+		while ( (strlen($channel) > 19) and ($cc < 100) )
+			{
+			$channel = eregi_replace(".$","",$channel);   
+			$cc++;
+			if (strlen($channel) <= 19) {$cc=101;}
+			}
+		$start_time =		sprintf("%-8s", $row[5]);
+			$cd=0;
+		while ( (strlen($start_time) > 8) and ($cd < 100) )
+			{
+			$start_time = eregi_replace("^.","",$start_time);   
+			$cd++;
+			if (strlen($start_time) <= 8) {$cd=101;}
+			}
+		$status =			sprintf("%-6s", $row[1]);
+		$campaign =			sprintf("%-12s", $row[2]);
+			$all_phone = "$row[3]$row[4]";
+		$number_dialed =	sprintf("%-18s", $all_phone);
+		$call_time_S = ($STARTtime - $row[6]);
+
+		$call_time_M = ($call_time_S / 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";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if (eregi("LIVE",$status)) {$G=''; $EG='';}
+	#	if ($call_time_M_int >= 6) {$G=''; $EG='';}
+
+		echo "| $G$channel$EG | $G$status$EG | $G$campaign$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+		echo "  $i κλήσεις που τοποθετήθηκαν στον διακομιστή $server_ip\n\n";
+
+		echo "             - ΑÎΑΜΟÎΗ ΕÎΕΡΓΗΣ ΚΛΗΣΗΣ\n";
+	#	echo "             - Over 5 minutes on hold\n";
+
+		}
+	else
+	{
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	echo "*******************************ΔΕΠΥΠΑΡΧΟΥΠΕÎΕΡΓΕΣ ΚΛΗΣΕΙΣ ΣΕ ΑÎΑΜΟÎΗ *********************************\n";
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	}
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_timeonVDAD_closer.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_timeonVDAD_closer.php new file mode 100644 index 00000000..07470b84 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_timeonVDAD_closer.php @@ -0,0 +1,318 @@ + LICENSE: GPLv2 +### +# live real-time stats for the VICIDIAL Auto-Dialer +# +# CHANGES +# +# 60620-1037 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["reset_counter"])) {$reset_counter=$_GET["reset_counter"];} + elseif (isset($_POST["reset_counter"])) {$reset_counter=$_POST["reset_counter"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"];} + elseif (isset($_POST["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +$epochSIXhoursAGO = ($STARTtime - 21600); +$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO); + +$reset_counter++; + +if ($reset_counter > 7) + { + $reset_counter=0; + + $stmt="update park_log set status='HUNGUP' where hangup_time is not null;"; +# $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + + if ($DB) + { + $stmt="delete from park_log where grab_time < '$timeSIXhoursAGO' and (hangup_time is null or hangup_time='');"; +# $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + } + } + +?> + + + +\n"; +echo " + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On VDAD\n"; +echo "
";
+
+###################################################################################
+###### TIME ON SYSTEM
+###################################################################################
+
+echo "VICIDIAL: ΧÏόνος ΧειÏιστών σε κλήσεις                   $NOW_TIME    ΑÎΑΦΟΡΕΣ\n\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+echo "| STATION    | USER   | SESSIONID | CHANNEL             | STATUS | CALLTIME | MINUTES | CAMPAIGN     | FRONT  |\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+
+
+$stmt="select extension,user,conf_exten,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),uniqueid,lead_id from vicidial_live_agents where status NOT IN('PAUSED') and server_ip='" . mysql_real_escape_string($server_ip) . "' order by extension;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$talking_to_print = mysql_num_rows($rslt);
+	if ($talking_to_print > 0)
+	{
+	$i=0;
+	while ($i < $talking_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+			if (eregi("READY|PAUSED|CLOSER",$row[4]))
+			{
+			$row[3]='';
+			$row[5]='- WAIT -';
+			$row[6]=$row[7];
+			}
+		$extension[$i] = eregi_replace('Local/',"",$row[0]);
+		$extension[$i] =		sprintf("%-10s", $extension[$i]);
+			while(strlen($extension[$i])>10) {$extension[$i] = substr("$extension[$i]", 0, -1);}
+		$user[$i] =				sprintf("%-6s", $row[1]);
+		$sessionid[$i] =		sprintf("%-9s", $row[2]);
+		$channel[$i] =			sprintf("%-19s", $row[3]);
+			$cc[$i]=0;
+		while ( (strlen($channel[$i]) > 19) and ($cc[$i] < 100) )
+			{
+			$channel[$i] = eregi_replace(".$","",$channel[$i]);   
+			$cc[$i]++;
+			if (strlen($channel[$i]) <= 19) {$cc[$i]=101;}
+			}
+		$status[$i] =			sprintf("%-6s", $row[4]);
+		$start_time[$i] =		sprintf("%-8s", $row[5]);
+			$cd[$i]=0;
+		while ( (strlen($start_time[$i]) > 8) and ($cd[$i] < 100) )
+			{
+			$start_time[$i] = eregi_replace("^.","",$start_time[$i]);   
+			$cd[$i]++;
+			if (strlen($start_time[$i]) <= 8) {$cd[$i]=101;}
+			}
+		$uniqueid[$i] =			$row[8];
+		$lead_id[$i] =			$row[9];
+		$closer[$i] =			$row[1];
+		$call_time_S[$i] = ($STARTtime - $row[6]);
+
+		$call_time_M[$i] = ($call_time_S[$i] / 60);
+		$call_time_M[$i] = round($call_time_M[$i], 2);
+		$call_time_M_int[$i] = intval("$call_time_M[$i]");
+		$call_time_SEC[$i] = ($call_time_M[$i] - $call_time_M_int[$i]);
+		$call_time_SEC[$i] = ($call_time_SEC[$i] * 60);
+		$call_time_SEC[$i] = round($call_time_SEC[$i], 0);
+		if ($call_time_SEC[$i] < 10) {$call_time_SEC[$i] = "0$call_time_SEC[$i]";}
+		$call_time_MS[$i] = "$call_time_M_int[$i]:$call_time_SEC[$i]";
+		$call_time_MS[$i] =		sprintf("%7s", $call_time_MS[$i]);
+		$i++;
+		}
+		$ext_count = $i;
+		$i=0;
+	while ($i < $ext_count)
+		{
+
+		$stmt="select campaign_id from vicidial_auto_calls where lead_id='$lead_id[$i]' and server_ip='" . mysql_real_escape_string($server_ip) . "';";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$camp_to_print = mysql_num_rows($rslt);
+		if ($camp_to_print > 0)
+			{
+			$row=mysql_fetch_row($rslt);
+			$campaign = sprintf("%-12s", $row[0]);
+			$camp_color = $row[0];
+			}
+		else
+			{$campaign = 'DEAD        ';   	$camp_color = 'DEAD';}
+		if (eregi("READY|PAUSED|CLOSER",$status[$i]))
+			{$campaign = '            ';   	$camp_color = '';}
+
+		$stmt="select user from vicidial_xfer_log where lead_id='$lead_id[$i]' and closer='$closer[$i]' order by call_date desc limit 1;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$xfer_to_print = mysql_num_rows($rslt);
+		if ($xfer_to_print > 0)
+			{
+			$row=mysql_fetch_row($rslt);
+			$fronter = sprintf("%-6s", $row[0]);
+			}
+		else
+			{$fronter = '      ';}
+
+		$G = '';		$EG = '';
+		$G=""; $EG='';
+	#	if ($call_time_M_int[$i] >= 5) {$G=''; $EG='';}
+	#	if ($call_time_M_int[$i] >= 10) {$G=''; $EG='';}
+
+		echo "| $G$extension[$i]$EG | $G$user[$i]$EG | $G$sessionid[$i]$EG | $G$channel[$i]$EG | $G$status[$i]$EG | $G$start_time[$i]$EG | $G$call_time_MS[$i]$EG | $G$campaign$EG | $G$fronter$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+		echo "  $i ΧειÏιστές συνδεμένοι στον διακομιστή $server_ip\n\n";
+
+	#	echo "             - 5 λεπτά ή παÏαπάνω σε κλήση\n";
+	#	echo "             - Πάνω από 10 λεπτά σε κλήση\n";
+
+	}
+	else
+	{
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	echo "********************************* ΚΑÎΕÎΑΣ ΧΕΙΡ. ΣΕ ΚΛΗΣΕΙΣ *********************************\n";
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	}
+
+
+###################################################################################
+###### OUTBOUND CALLS
+###################################################################################
+#echo "\n\n";
+echo "----------------------------------------------------------------------------------------";
+echo "\n\n";
+echo "VICIDIAL: Time On VDAD                                              $NOW_TIME\n\n";
+echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+echo "| CHANNEL             | STATUS | CAMPAIGN     | PHONE NUMBER       | CALLTIME | MINUTES |\n";
+echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+
+#$link=mysql_connect("localhost", "cron", "1234");
+# $linkX=mysql_connect("localhost", "cron", "1234");
+#mysql_select_db("asterisk");
+
+$stmt="select channel,status,campaign_id,phone_code,phone_number,call_time,UNIX_TIMESTAMP(call_time) from vicidial_auto_calls where status NOT IN('XFER') and server_ip='" . mysql_real_escape_string($server_ip) . "' order by auto_call_id desc;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$parked_to_print = mysql_num_rows($rslt);
+	if ($parked_to_print > 0)
+	{
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$channel =			sprintf("%-19s", $row[0]);
+			$cc=0;
+		while ( (strlen($channel) > 19) and ($cc < 100) )
+			{
+			$channel = eregi_replace(".$","",$channel);   
+			$cc++;
+			if (strlen($channel) <= 19) {$cc=101;}
+			}
+		$start_time =		sprintf("%-8s", $row[5]);
+			$cd=0;
+		while ( (strlen($start_time) > 8) and ($cd < 100) )
+			{
+			$start_time = eregi_replace("^.","",$start_time);   
+			$cd++;
+			if (strlen($start_time) <= 8) {$cd=101;}
+			}
+		$status =			sprintf("%-6s", $row[1]);
+		$campaign =			sprintf("%-12s", $row[2]);
+			$all_phone = "$row[3]$row[4]";
+		$number_dialed =	sprintf("%-18s", $all_phone);
+		$call_time_S = ($STARTtime - $row[6]);
+
+		$call_time_M = ($call_time_S / 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";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if (eregi("LIVE",$status)) {$G=''; $EG='';}
+	#	if ($call_time_M_int >= 6) {$G=''; $EG='';}
+
+		echo "| $G$channel$EG | $G$status$EG | $G$campaign$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+		echo "  $i κλήσεις που τοποθετήθηκαν στον διακομιστή $server_ip\n\n";
+
+		echo "             - ΑÎΑΜΟÎΗ ΕÎΕΡΓΗΣ ΚΛΗΣΗΣ\n";
+	#	echo "             - Over 5 minutes on hold\n";
+
+		}
+	else
+	{
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	echo "*******************************ΔΕΠΥΠΑΡΧΟΥΠΕÎΕΡΓΕΣ ΚΛΗΣΕΙΣ ΣΕ ΑÎΑΜΟÎΗ *********************************\n";
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	}
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_timeonVDADall.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_timeonVDADall.php new file mode 100644 index 00000000..808205af --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_timeonVDADall.php @@ -0,0 +1,826 @@ + LICENSE: GPLv2 +# +# live real-time stats for the VICIDIAL Auto-Dialer all servers +# +# STOP=4000, SLOW=40, GO=4 seconds refresh interval +# +# CHANGELOG: +# 50406-0920 - Added Paused agents < 1 min (Chris Doyle) +# 51130-1218 - Modified layout and info to show all servers in a vicidial system +# 60421-1043 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60511-1343 - Added leads and drop info at the top of the screen +# 60608-1539 - Fixed CLOSER tallies for active calls +# 60619-1658 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 60626-1453 - Added display of system load to bottom (Angelito Manansala) +# 60901-1123 - Changed display elements at the top of the screen +# 60905-1342 - Fixed non INCALL|QUEUE timer column +# 61002-1642 - Added TRUNK SHORT/FILL stats +# 61101-1318 - Added SIP and IAX Listen and Barge links option +# 61101-1647 - Added Usergroup column and user name option as well as sorting +# 61102-1155 - Made display of columns more modular, added ability to hide server info +# 61215-1131 - Added answered calls and drop percent taken from answered calls +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70123-1151 - Added non_latin options for substr in display variables, thanks Marin Blu +# 70206-1140 - Added call-type statuses to display(A-Auto, M-Manual, I-Inbound/Closer) +# 70619-1339 - Added Status Category tally display +# 71029-1900 - Changed CLOSER-type to not require campaign_id restriction +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["RR"])) {$RR=$_GET["RR"];} + elseif (isset($_POST["RR"])) {$RR=$_POST["RR"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["usergroup"])) {$usergroup=$_GET["usergroup"];} + elseif (isset($_POST["usergroup"])) {$usergroup=$_POST["usergroup"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["adastats"])) {$adastats=$_GET["adastats"];} + elseif (isset($_POST["adastats"])) {$adastats=$_POST["adastats"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"];} + elseif (isset($_POST["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];} +if (isset($_GET["SIPmonitorLINK"])) {$SIPmonitorLINK=$_GET["SIPmonitorLINK"];} + elseif (isset($_POST["SIPmonitorLINK"])) {$SIPmonitorLINK=$_POST["SIPmonitorLINK"];} +if (isset($_GET["IAXmonitorLINK"])) {$IAXmonitorLINK=$_GET["IAXmonitorLINK"];} + elseif (isset($_POST["IAXmonitorLINK"])) {$IAXmonitorLINK=$_POST["IAXmonitorLINK"];} +if (isset($_GET["UGdisplay"])) {$UGdisplay=$_GET["UGdisplay"];} + elseif (isset($_POST["UGdisplay"])) {$UGdisplay=$_POST["UGdisplay"];} +if (isset($_GET["UidORname"])) {$UidORname=$_GET["UidORname"];} + elseif (isset($_POST["UidORname"])) {$UidORname=$_POST["UidORname"];} +if (isset($_GET["orderby"])) {$orderby=$_GET["orderby"];} + elseif (isset($_POST["orderby"])) {$orderby=$_POST["orderby"];} +if (isset($_GET["SERVdisplay"])) {$SERVdisplay=$_GET["SERVdisplay"];} + elseif (isset($_POST["SERVdisplay"])) {$SERVdisplay=$_POST["SERVdisplay"];} + + + +if (!isset($RR)) {$gRRroup=4;} +if (!isset($group)) {$group='';} +if (!isset($usergroup)) {$usergroup='';} +if (!isset($UGdisplay)) {$UGdisplay=0;} # 0=no, 1=yes +if (!isset($UidORname)) {$UidORname=0;} # 0=id, 1=name +if (!isset($orderby)) {$orderby='timeup';} +if (!isset($SERVdisplay)) {$SERVdisplay=1;} # 0=no, 1=yes + +function get_server_load($windows = false) { +$os = strtolower(PHP_OS); +if(strpos($os, "win") === false) { +if(file_exists("/proc/loadavg")) { +$load = file_get_contents("/proc/loadavg"); +$load = explode(' ', $load); +return $load[0]; +} +elseif(function_exists("shell_exec")) { +$load = explode(' ', `uptime`); +return $load[count($load)-1]; +} +else { +return false; +} +} +elseif($windows) { +if(class_exists("COM")) { +$wmi = new COM("WinMgmts:\\\\."); +$cpus = $wmi->InstancesOf("Win32_Processor"); + +$cpuload = 0; +$i = 0; +while ($cpu = $cpus->Next()) { +$cpuload += $cpu->LoadPercentage; +$i++; +} + +$cpuload = round($cpuload / $i, 2); +return "$cpuload%"; +} +else { +return false; +} +} +} + +$load_ave = get_server_load(true); + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + 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($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_TIME = date("Y-m-d H:i:s"); +$NOW_DAY = date("Y-m-d"); +$NOW_HOUR = date("H:i:s"); +$STARTtime = date("U"); +$epochSIXhoursAGO = ($STARTtime - 21600); +$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO); + +$stmt="select campaign_id from vicidial_campaigns where active='Y';"; +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +if (!isset($DB)) {$DB=0;} +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + +$stmt="select * from vicidial_user_groups;"; +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +if (!isset($DB)) {$DB=0;} +if ($DB) {echo "$stmt\n";} +$usergroups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $usergroups_to_print) + { + $row=mysql_fetch_row($rslt); + $usergroups[$i] =$row[0]; + $i++; + } + +if (!isset($RR)) {$RR=4;} + +$NFB = ''; +$NFE = ''; +$F=''; $FG=''; $B=''; $BG=''; + +?> + + + + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On VDAD ΕκστÏατεία: $group\n"; +echo "
\n"; +echo "VICIDIAL ΕκστÏατεία: \n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +if ($UGdisplay > 0) + { + echo "\n"; + } +echo "         \n"; +echo "STOP | "; +echo "SLOW | "; +echo "GO"; +echo "       ΤΡΟΠΟΠΟΙΗΣΗ | \n"; +echo "SUMMARY | \n"; +echo "ΑÎΑΦΟΡΕΣ \n"; +echo "\n\n"; + + +if (!$group) {echo "

please select a campaign from the pulldown above
\n"; exit;} +else +{ +$stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select avg(auto_dial_level),min(dial_status_a),min(dial_status_b),min(dial_status_c),min(dial_status_d),min(dial_status_e),min(lead_order),min(lead_filter_id),sum(hopper_level),min(dial_method),avg(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),min(available_only_ratio_tally),min(adaptive_latest_server_time),min(local_call_time),avg(dial_timeout),min(dial_statuses) from vicidial_campaigns;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$DIALlev = $row[0]; +$DIALstatusA = $row[1]; +$DIALstatusB = $row[2]; +$DIALstatusC = $row[3]; +$DIALstatusD = $row[4]; +$DIALstatusE = $row[5]; +$DIALorder = $row[6]; +$DIALfilter = $row[7]; +$HOPlev = $row[8]; +$DIALmethod = $row[9]; +$maxDIALlev = $row[10]; +$DROPmax = $row[11]; +$targetDIFF = $row[12]; +$ADAintense = $row[13]; +$ADAavailonly = $row[14]; +$TAPERtime = $row[15]; +$CALLtime = $row[16]; +$DIALtimeout = $row[17]; +$DIALstatuses = $row[18]; + $DIALstatuses = (preg_replace("/ -$|^ /","",$DIALstatuses)); + $DIALstatuses = (ereg_replace(' ',', ',$DIALstatuses)); + +$stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select count(*) from vicidial_hopper;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$VDhop = $row[0]; + +$stmt="select dialable_leads,calls_today,drops_today,drops_answers_today_pct,differential_onemin,agents_average_onemin,balance_trunk_fill,answers_today,status_category_1,status_category_count_1,status_category_2,status_category_count_2,status_category_3,status_category_count_3,status_category_4,status_category_count_4 from vicidial_campaign_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),min(status_category_1),sum(status_category_count_1),min(status_category_2),sum(status_category_count_2),min(status_category_3),sum(status_category_count_3),min(status_category_4),sum(status_category_count_4) from vicidial_campaign_stats;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$DAleads = $row[0]; +$callsTODAY = $row[1]; +$dropsTODAY = $row[2]; +$drpctTODAY = $row[3]; +$diffONEMIN = $row[4]; +$agentsONEMIN = $row[5]; +$balanceFILL = $row[6]; +$answersTODAY = $row[7]; +$VSCcat1 = $row[8]; +$VSCcat1tally = $row[9]; +$VSCcat2 = $row[10]; +$VSCcat2tally = $row[11]; +$VSCcat3 = $row[12]; +$VSCcat3tally = $row[13]; +$VSCcat4 = $row[14]; +$VSCcat4tally = $row[15]; + +if ( ($diffONEMIN != 0) and ($agentsONEMIN > 0) ) + { + $diffpctONEMIN = ( ($diffONEMIN / $agentsONEMIN) * 100); + $diffpctONEMIN = sprintf("%01.2f", $diffpctONEMIN); + } +else {$diffpctONEMIN = '0.00';} + +$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$balanceSHORT = $row[0]; + +echo "
"; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +if ($adastats>1) + { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; + + + + +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo "
DIAL LEVEL:  $DIALlev    TRUNK SHORT/FILL:  $balanceSHORT / $balanceFILL     FILTER:  $DIALfilter   TIME:   $NOW_TIME
- min   MAX LEVEL:  $maxDIALlev   DROPPED MAX:  $DROPmax%    TARGET DIFF:  $targetDIFF     INTENSITY:  $ADAintense    
DIAL TIMEOUT:  $DIALtimeout  TAPER TIME:  $TAPERtime  LOCAL TIME:  $CALLtime  AVAIL ONLY:  $ADAavailonly  
DIALABLE LEADS:  $DAleads     CALLS TODAY:  $callsTODAY     AVG AGENTS:  $agentsONEMIN     DIAL METHOD:  $DIALmethod    
HOPPER LEVEL:  $HOPlev     DROPPED / ANSWERED:  $dropsTODAY / $answersTODAY   DL DIFF:  $diffONEMIN     STATUSES:  $DIALstatuses    
LEADS IN HOPPER:  $VDhop     DROPPED PERCENT:  "; +if ($drpctTODAY >= $DROPmax) + {echo "$drpctTODAY%";} +else + {echo "$drpctTODAY%";} +echo "    DIFF:  $diffpctONEMIN%     ORDER:  $DIALorder    
"; +if ( (!eregi('NULL',$VSCcat1)) and (strlen($VSCcat1)>0) ) + {echo "$VSCcat1:   $VSCcat1tally       \n";} +if ( (!eregi('NULL',$VSCcat2)) and (strlen($VSCcat2)>0) ) + {echo "$VSCcat2:   $VSCcat2tally       \n";} +if ( (!eregi('NULL',$VSCcat3)) and (strlen($VSCcat3)>0) ) + {echo "$VSCcat3:   $VSCcat3tally       \n";} +if ( (!eregi('NULL',$VSCcat4)) and (strlen($VSCcat4)>0) ) + {echo "$VSCcat4:   $VSCcat4tally       \n";} +echo "
"; + +if ($adastats<2) + { + echo "+ VIEW MORE SETTINGS"; + } +if ($UGdisplay>0) + { + echo "       ΑΠΟΚΡΥΨΗ USER GROUP"; + } +else + { + echo "       VIEW USER GROUP"; + } +if ($UidORname>0) + { + echo "       ΕΜΦΑÎΙΣΗ ΧΕΙΡΙΣΤΗΣID"; + } +else + { + echo "       ΕΜΦΑÎΙΣΗ ΧΕΙΡΙΣΤΗΣNAME"; + } +if ($SERVdisplay>0) + { + echo "       ΑΠΟΚΡΥΨΗ ΔΙΑΚΟΜΙΣΤΗΣ INFO"; + } +else + { + echo "       ΕΜΦΑÎΙΣΗ ΔΙΑΚΟΜΙΣΤΗΣ INFO"; + } +echo "
"; + +echo "\n\n"; +} +################################################################################### +###### OUTBOUND CALLS +################################################################################### +if ($campaign_allow_inbound > 0) + { + $stmt="select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = preg_replace("/^ | -$/","",$row[0]); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaigns = "'$closer_campaigns'"; + + $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') and ( (call_type='IN' and campaign_id IN($closer_campaigns)) or (campaign_id='" . mysql_real_escape_string($group) . "' and call_type='OUT') );"; + } +else + { + if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';} + else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";} + + $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') $groupSQL;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$parked_to_print = mysql_num_rows($rslt); + if ($parked_to_print > 0) + { + $i=0; + $out_total=0; + $out_ring=0; + $out_live=0; + while ($i < $parked_to_print) + { + $row=mysql_fetch_row($rslt); + + if (eregi("LIVE",$row[0])) + {$out_live++;} + else + { + if (eregi("CLOSER",$row[0])) + {$nothing=1;} + else + {$out_ring++;} + } + $out_total++; + $i++; + } + + if ($out_live > 0) {$F=''; $FG='';} + if ($out_live > 4) {$F=''; $FG='';} + if ($out_live > 9) {$F=''; $FG='';} + if ($out_live > 14) {$F=''; $FG='';} + + if ($campaign_allow_inbound > 0) + {echo "$NFB$out_total$NFE current active calls      \n";} + else + {echo "$NFB$out_total$NFE calls being placed       \n";} + + echo "$NFB$out_ring$NFE calls ringing         \n"; + echo "$NFB$F  $out_live $FG$NFE calls waiting for agents       \n"; + } + else + { + echo "ΔΕΠΥΠΑΡΧΟΥΠΕÎΕΡΓΕΣ ΚΛΗΣΕΙΣ ΣΕ ΑÎΑΜΟÎΗ \n"; + } + + +################################################################################### +###### TIME ON SYSTEM +################################################################################### + +$agent_incall=0; +$agent_ready=0; +$agent_paused=0; +$agent_total=0; + +$Aecho = ''; +$Aecho .= "VICIDIAL: Agents Time On Calls ΕκστÏατεία: $group $NOW_TIME\n\n"; + + +$HDbegin = "+"; +$HTbegin = "|"; +$HDstation = "------------+"; +$HTstation = " STATION |"; +$HDuser = "--------------------+"; +$HTuser = " USER |"; +$HDusergroup = "--------------+"; +$HTusergroup = " USER GROUP |"; +$HDsessionid = "------------------+"; +$HTsessionid = " SESSIONID |"; +$HDbarge = "-------+"; +$HTbarge = " BARGE |"; +$HDstatus = "----------+"; +$HTstatus = " STATUS |"; +$HDserver_ip = "-----------------+"; +$HTserver_ip = " ΔΙΑΚΟΜΙΣΤΗΣ IP |"; +$HDcall_server_ip = "-----------------+"; +$HTcall_server_ip = " CALL ΔΙΑΚΟΜΙΣΤΗΣ IP |"; +$HDtime = "---------+"; +$HTtime = " MM:SS |"; +$HDcampaign = "------------+"; +$HTcampaign = " CAMPAIGN |"; + +if ($UGdisplay < 1) + { + $HDusergroup = ''; + $HTusergroup = ''; + } +if ( ($SIPmonitorLINK<1) && ($IAXmonitorLINK<1) ) + { + $HDsessionid = "-----------+"; + $HTsessionid = " SESSIONID |"; + } +if ( ($SIPmonitorLINK<2) && ($IAXmonitorLINK<2) ) + { + $HDbarge = ''; + $HTbarge = ''; + } +if ($SERVdisplay < 1) + { + $HDserver_ip = ''; + $HTserver_ip = ''; + $HDcall_server_ip = ''; + $HTcall_server_ip = ''; + } + + + +$Aline = "$HDbegin$HDstation$HDuser$HDusergroup$HDsessionid$HDbarge$HDstatus$HDserver_ip$HDcall_server_ip$HDtime$HDcampaign\n"; +$Bline = "$HTbegin$HTstation$HTuser$HTusergroup$HTsessionid$HTbarge$HTstatus$HTserver_ip$HTcall_server_ip$HTtime$HTcampaign\n"; +$Aecho .= "$Aline"; +$Aecho .= "$Bline"; +$Aecho .= "$Aline"; + +if ($orderby=='timeup') {$orderSQL='status,last_call_time';} +if ($orderby=='timedown') {$orderSQL='status desc,last_call_time desc';} +if ($orderby=='campaignup') {$orderSQL='campaign_id,status,last_call_time';} +if ($orderby=='campaigndown') {$orderSQL='campaign_id desc,status desc,last_call_time desc';} +if ($orderby=='groupup') {$orderSQL='user_group,status,last_call_time';} +if ($orderby=='groupdown') {$orderSQL='user_group desc,status desc,last_call_time desc';} +if ($UidORname > 0) + { + if ($orderby=='userup') {$orderSQL='full_name,status,last_call_time';} + if ($orderby=='userdown') {$orderSQL='full_name desc,status desc,last_call_time desc';} + } +else + { + if ($orderby=='userup') {$orderSQL='vicidial_live_agents.user';} + if ($orderby=='userdown') {$orderSQL='vicidial_live_agents.user desc';} + } + +if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';} +else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";} +if (strlen($usergroup)<1) {$usergroupSQL = '';} +else {$usergroupSQL = " and user_group='" . mysql_real_escape_string($usergroup) . "'";} + +$stmt="select extension,vicidial_live_agents.user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id,vicidial_users.user_group,vicidial_users.full_name,vicidial_live_agents.comments from vicidial_live_agents,vicidial_users where vicidial_live_agents.user=vicidial_users.user $groupSQL $usergroupSQL order by $orderSQL;"; + +#$stmt="select extension,vicidial_live_agents.user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id,vicidial_users.user_group,vicidial_users.full_name from vicidial_live_agents,vicidial_users where vicidial_live_agents.user=vicidial_users.user and campaign_id='" . mysql_real_escape_string($group) . "' order by $orderSQL;"; + +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + $agentcount=0; + while ($i < $talking_to_print) + { + $row=mysql_fetch_row($rslt); + if (eregi("READY|PAUSED",$row[3])) + { + $row[5]=$row[6]; + } + if ($non_latin < 1) + { + $extension = eregi_replace('Local/',"",$row[0]); + $extension = sprintf("%-10s", $extension); + while(strlen($extension)>10) {$extension = substr("$extension", 0, -1);} + } + else + { + $extension = eregi_replace('Local/',"",$row[0]); + $extension = sprintf("%-40s", $extension); + while(mb_strlen($extension, 'utf-8')>10) {$extension = mb_substr("$extension", 0, -1,'utf8');} + } + $Luser = $row[1]; + $user = sprintf("%-18s", $row[1]); + $Lsessionid = $row[2]; + $sessionid = sprintf("%-9s", $row[2]); + $Lstatus = $row[3]; + $status = sprintf("%-6s", $row[3]); + $server_ip = sprintf("%-15s", $row[4]); + $call_server_ip = sprintf("%-15s", $row[7]); + $campaign_id = sprintf("%-10s", $row[8]); + $comments= $row[11]; + + if (eregi("INCALL",$Lstatus)) + { + if ( (eregi("AUTO",$comments)) or (strlen($comments)<1) ) + {$CM='A';} + else + { + if (eregi("INBOUND",$comments)) + {$CM='I';} + else + {$CM='M';} + } + } + else {$CM=' ';} + + if ($UGdisplay > 0) + { + if ($non_latin < 1) + { + $user_group = sprintf("%-12s", $row[9]); + while(strlen($user_group)>12) {$user_group = substr("$user_group", 0, -1);} + } + else + { + $user_group = sprintf("%-40s", $row[9]); + while(mb_strlen($user_group, 'utf-8')>12) {$user_group = mb_substr("$user_group", 0, -1,'utf8');} + } + } + if ($UidORname > 0) + { + if ($non_latin < 1) + { + $user = sprintf("%-18s", $row[10]); + while(strlen($user)>18) {$user = substr("$user", 0, -1);} + } + else + { + $user = sprintf("%-40s", $row[10]); + while(mb_strlen($user, 'utf-8')>18) {$user = mb_substr("$user", 0, -1,'utf8');} + } + } + if (!eregi("INCALL|QUEUE",$row[3])) + {$call_time_S = ($STARTtime - $row[6]);} + else + {$call_time_S = ($STARTtime - $row[5]);} + + $call_time_M = ($call_time_S / 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"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + if ($Lstatus=='INCALL') + { + if ($call_time_S >= 10) {$G=''; $EG='';} + if ($call_time_M_int >= 1) {$G=''; $EG='';} + if ($call_time_M_int >= 5) {$G=''; $EG='';} + # if ($call_time_M_int >= 10) {$G=''; $EG='';} + } + if (eregi("PAUSED",$row[3])) + { + if ($call_time_M_int >= 30) + {$i++; continue;} + else + { + $agent_paused++; $agent_total++; + $G=''; $EG=''; + if ($call_time_S >= 10) {$G=''; $EG='';} + if ($call_time_M_int >= 1) {$G=''; $EG='';} + if ($call_time_M_int >= 5) {$G=''; $EG='';} + } + } +# if ( (strlen($row[7])> 4) and ($row[7] != "$row[4]") ) +# {$G=''; $EG='';} + + if ( (eregi("INCALL",$status)) or (eregi("QUEUE",$status)) ) {$agent_incall++; $agent_total++;} + if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) {$agent_ready++; $agent_total++;} + if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) + { + $G=''; $EG=''; + if ($call_time_M_int >= 1) {$G=''; $EG='';} + if ($call_time_M_int >= 5) {$G=''; $EG='';} + } + + $L=''; + $R=''; + if ($SIPmonitorLINK>0) {$L=" LISTEN"; $R='';} + if ($IAXmonitorLINK>0) {$L=" LISTEN"; $R='';} + if ($SIPmonitorLINK>1) {$R=" | BARGE";} + if ($IAXmonitorLINK>1) {$R=" | BARGE";} + + if ($UGdisplay > 0) {$UGD = " $G$user_group$EG |";} + else {$UGD = "";} + + if ($SERVdisplay > 0) {$SVD = "$G$server_ip$EG | $G$call_server_ip$EG | ";} + else {$SVD = "";} + + $agentcount++; + + $Aecho .= "| $G$extension$EG | $G$user$EG |$UGD $G$sessionid$EG$L$R | $G$status$EG $CM | $SVD$G$call_time_MS$EG | $G$campaign_id$EG |\n"; + + $i++; + } + + $Aecho .= "$Aline"; + $Aecho .= " $agentcount agents logged in on all servers\n"; + $Aecho .= " System Load Average: $load_ave\n\n"; + + # $Aecho .= " - Balanced call\n"; + $Aecho .= " - Agent waiting for call\n"; + $Aecho .= " - Agent waiting for call > 1 minute\n"; + $Aecho .= " - Agent waiting for call > 5 minutes\n"; + $Aecho .= " - Agent on call > 10 seconds\n"; + $Aecho .= " - Agent on call > 1 minute\n"; + $Aecho .= " - Agent on call > 5 minutes\n"; + $Aecho .= " - Agent Paused > 10 seconds\n"; + $Aecho .= " - Agent Paused > 1 minute\n"; + $Aecho .= " - Agent Paused > 5 minutes\n"; + + if ($agent_ready > 0) {$B=''; $BG='';} + if ($agent_ready > 4) {$B=''; $BG='';} + if ($agent_ready > 9) {$B=''; $BG='';} + if ($agent_ready > 14) {$B=''; $BG='';} + + + echo "\n
\n"; + + echo "$NFB$agent_total$NFE agents logged in         \n"; + echo "$NFB$agent_incall$NFE agents in calls       \n"; + echo "$NFB$B  $agent_ready $BG$NFE agents waiting       \n"; + echo "$NFB$agent_paused$NFE paused agents       \n"; + + echo "
";
+		echo "";
+		echo "$Aecho";
+	}
+	else
+	{
+	echo " ΚΑÎΕÎΑΣ ΧΕΙΡ. ΣΕ ΚΛΗΣΕΙΣ \n";
+	}
+
+?>
+
+ + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_timeonVDADallSUMMARY.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_timeonVDADallSUMMARY.php new file mode 100644 index 00000000..0fe755a0 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_timeonVDADallSUMMARY.php @@ -0,0 +1,442 @@ + LICENSE: GPLv2 +# +# Summary for all campaigns live real-time stats for the VICIDIAL Auto-Dialer all servers +# +# STOP=4000, SLOW=40, GO=4 seconds refresh interval +# +# changes: +# 61102-1616 - first build +# 61215-1131 - added answered calls and drop percent taken from answered calls +# 70111-1600 - added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70619-1339 - Added Status Category tally display +# 71029-1900 - Changed CLOSER-type to not require campaign_id restriction +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["RR"])) {$RR=$_GET["RR"];} + elseif (isset($_POST["RR"])) {$RR=$_POST["RR"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["adastats"])) {$adastats=$_GET["adastats"];} + elseif (isset($_POST["adastats"])) {$adastats=$_POST["adastats"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"];} + elseif (isset($_POST["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];} + +if (!isset($RR)) {$gRRroup=4;} + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); + +$stmt="select campaign_id from vicidial_campaigns where active='Y';"; +$rslt=mysql_query($stmt, $link); +if (!isset($DB)) {$DB=0;} +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + +if (!isset($RR)) {$RR=4;} + +?> + + + + + +\n"; +echo "VICIDIAL: Realtime All ΕκστÏατείες Summary\n"; +echo "VICIDIAL: Realtime All ΕκστÏατείες Summary           \n"; +echo "STOP | "; +echo "SLOW | "; +echo "GO "; +echo "       \n"; +if ($adastats<2) + { + echo "+ VIEW MORE SETTINGS"; + } +else + { + echo "- VIEW LESS SETTINGS"; + } +echo "       ΑÎΑΦΟΡΕΣ"; +echo "

\n\n"; + +$k=0; +while($k<$groups_to_print) +{ +$NFB = ''; +$NFE = ''; +$F=''; $FG=''; $B=''; $BG=''; + +$group = $groups[$k]; +echo "$group   -   "; +echo "Modify\n"; + + +$stmt = "select count(*) from vicidial_campaigns where campaign_id='$group' and campaign_allow_inbound='Y';"; +$rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $campaign_allow_inbound = $row[0]; + +$stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$DIALlev = $row[0]; +$DIALstatusA = $row[1]; +$DIALstatusB = $row[2]; +$DIALstatusC = $row[3]; +$DIALstatusD = $row[4]; +$DIALstatusE = $row[5]; +$DIALorder = $row[6]; +$DIALfilter = $row[7]; +$HOPlev = $row[8]; +$DIALmethod = $row[9]; +$maxDIALlev = $row[10]; +$DROPmax = $row[11]; +$targetDIFF = $row[12]; +$ADAintense = $row[13]; +$ADAavailonly = $row[14]; +$TAPERtime = $row[15]; +$CALLtime = $row[16]; +$DIALtimeout = $row[17]; +$DIALstatuses = $row[18]; + $DIALstatuses = (preg_replace("/ -$|^ /","",$DIALstatuses)); + $DIALstatuses = (ereg_replace(' ',', ',$DIALstatuses)); + +$stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$VDhop = $row[0]; + +$stmt="select dialable_leads,calls_today,drops_today,drops_answers_today_pct,differential_onemin,agents_average_onemin,balance_trunk_fill,answers_today,status_category_1,status_category_count_1,status_category_2,status_category_count_2,status_category_3,status_category_count_3,status_category_4,status_category_count_4 from vicidial_campaign_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$DAleads = $row[0]; +$callsTODAY = $row[1]; +$dropsTODAY = $row[2]; +$drpctTODAY = $row[3]; +$diffONEMIN = $row[4]; +$agentsONEMIN = $row[5]; +$balanceFILL = $row[6]; +$answersTODAY = $row[7]; +$VSCcat1 = $row[8]; +$VSCcat1tally = $row[9]; +$VSCcat2 = $row[10]; +$VSCcat2tally = $row[11]; +$VSCcat3 = $row[12]; +$VSCcat3tally = $row[13]; +$VSCcat4 = $row[14]; +$VSCcat4tally = $row[15]; + +if ( ($diffONEMIN != 0) and ($agentsONEMIN > 0) ) + { + $diffpctONEMIN = ( ($diffONEMIN / $agentsONEMIN) * 100); + $diffpctONEMIN = sprintf("%01.2f", $diffpctONEMIN); + } +else {$diffpctONEMIN = '0.00';} + +$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$balanceSHORT = $row[0]; + +echo "
"; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +if ($adastats>1) + { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo "
DIAL LEVEL:  $DIALlev    TRUNK SHORT/FILL:  $balanceSHORT / $balanceFILL     FILTER:  $DIALfilter   TIME:   $NOW_TIME
  MAX LEVEL:  $maxDIALlev   DROPPED MAX:  $DROPmax%    TARGET DIFF:  $targetDIFF     INTENSITY:  $ADAintense    
DIAL TIMEOUT:  $DIALtimeout  TAPER TIME:  $TAPERtime  LOCAL TIME:  $CALLtime  AVAIL ONLY:  $ADAavailonly  
DIALABLE LEADS:  $DAleads     CALLS TODAY:  $callsTODAY     AVG AGENTS:  $agentsONEMIN     DIAL METHOD:  $DIALmethod    
HOPPER LEVEL:  $HOPlev     DROPPED / ANSWERED:  $dropsTODAY / $answersTODAY   DL DIFF:  $diffONEMIN     STATUSES:  $DIALstatuses    
LEADS IN HOPPER:  $VDhop     DROPPED PERCENT:  "; +if ($drpctTODAY >= $DROPmax) + {echo "$drpctTODAY%";} +else + {echo "$drpctTODAY%";} +echo "    DIFF:  $diffpctONEMIN%     ORDER:  $DIALorder    
"; +if ( (!eregi('NULL',$VSCcat1)) and (strlen($VSCcat1)>0) ) + {echo "$VSCcat1:   $VSCcat1tally       \n";} +if ( (!eregi('NULL',$VSCcat2)) and (strlen($VSCcat2)>0) ) + {echo "$VSCcat2:   $VSCcat2tally       \n";} +if ( (!eregi('NULL',$VSCcat3)) and (strlen($VSCcat3)>0) ) + {echo "$VSCcat3:   $VSCcat3tally       \n";} +if ( (!eregi('NULL',$VSCcat4)) and (strlen($VSCcat4)>0) ) + {echo "$VSCcat4:   $VSCcat4tally       \n";} +echo "
"; + +### Header finish + + + + + +################################################################################ +### START calculating calls/agents +################################################################################ + +################################################################################ +###### OUTBOUND CALLS +################################################################################ +if ($campaign_allow_inbound > 0) + { + $stmt="select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = preg_replace("/^ | -$/","",$row[0]); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaigns = "'$closer_campaigns'"; + + $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') and ( (call_type='IN' and campaign_id IN($closer_campaigns)) or (campaign_id='" . mysql_real_escape_string($group) . "' and call_type='OUT') );"; + } +else + { + if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';} + else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";} + + $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') $groupSQL;"; + } +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$parked_to_print = mysql_num_rows($rslt); + if ($parked_to_print > 0) + { + $i=0; + $out_total=0; + $out_ring=0; + $out_live=0; + while ($i < $parked_to_print) + { + $row=mysql_fetch_row($rslt); + + if (eregi("LIVE",$row[0])) + {$out_live++;} + else + { + if (eregi("CLOSER",$row[0])) + {$nothing=1;} + else + {$out_ring++;} + } + $out_total++; + $i++; + } + + if ($out_live > 0) {$F=''; $FG='';} + if ($out_live > 4) {$F=''; $FG='';} + if ($out_live > 9) {$F=''; $FG='';} + if ($out_live > 14) {$F=''; $FG='';} + + if ($campaign_allow_inbound > 0) + {echo "$NFB$out_total$NFE current active calls      \n";} + else + {echo "$NFB$out_total$NFE calls being placed       \n";} + + echo "$NFB$out_ring$NFE calls ringing         \n"; + echo "$NFB$F  $out_live $FG$NFE calls waiting for agents       \n"; + } + else + { + echo "ΔΕΠΥΠΑΡΧΟΥΠΕÎΕΡΓΕΣ ΚΛΗΣΕΙΣ ΣΕ ΑÎΑΜΟÎΗ \n"; + } + + +################################################################################### +###### TIME ON SYSTEM +################################################################################### + +$agent_incall=0; +$agent_ready=0; +$agent_paused=0; +$agent_total=0; + +$stmt="select extension,user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id from vicidial_live_agents where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + $agentcount=0; + while ($i < $talking_to_print) + { + $row=mysql_fetch_row($rslt); + if (eregi("READY|PAUSED",$row[3])) + { + $row[5]=$row[6]; + } + $Lstatus = $row[3]; + $status = sprintf("%-6s", $row[3]); + if (!eregi("INCALL|QUEUE",$row[3])) + {$call_time_S = ($STARTtime - $row[6]);} + else + {$call_time_S = ($STARTtime - $row[5]);} + + $call_time_M = ($call_time_S / 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"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + if (eregi("PAUSED",$row[3])) + { + if ($call_time_M_int >= 30) + {$i++; continue;} + else + { + $agent_paused++; $agent_total++; + } + } + + if ( (eregi("INCALL",$status)) or (eregi("QUEUE",$status)) ) {$agent_incall++; $agent_total++;} + if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) {$agent_ready++; $agent_total++;} + $agentcount++; + + + $i++; + } + + if ($agent_ready > 0) {$B=''; $BG='';} + if ($agent_ready > 4) {$B=''; $BG='';} + if ($agent_ready > 9) {$B=''; $BG='';} + if ($agent_ready > 14) {$B=''; $BG='';} + + echo "\n
\n"; + + echo "$NFB$agent_total$NFE agents logged in         \n"; + echo "$NFB$agent_incall$NFE agents in calls       \n"; + echo "$NFB$B  $agent_ready $BG$NFE agents waiting       \n"; + echo "$NFB$agent_paused$NFE paused agents       \n"; + + echo "
";
+		echo "";
+	}
+	else
+	{
+	echo " NO AGENTS ON CALLS
\n"; + } + +################################################################################ +### END calculating calls/agents +################################################################################ + + + + + +echo "
"; + +echo "\n\n"; +$k++; +} + +?> +
+ + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_timeoncall.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_timeoncall.php new file mode 100644 index 00000000..76e2b1d6 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_timeoncall.php @@ -0,0 +1,180 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["reset_counter"])) {$reset_counter=$_GET["reset_counter"];} + elseif (isset($_POST["reset_counter"])) {$reset_counter=$_POST["reset_counter"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"];} + elseif (isset($_POST["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];} + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); + +?> + + + + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On Call\n"; +echo "
\n\n";
+
+echo "VICIDIAL: Time On Call                                          $NOW_TIME\n\n";
+echo "+------------+-----------+-----------+------------------+---------------------+---------+\n";
+echo "| STATION    | SESSIONID | CHANNEL   | NUMBER DIALED    | START TIME          | MINUTES |\n";
+echo "+------------+-----------+-----------+------------------+---------------------+---------+\n";
+
+$stmt="SELECT count(*) from live_sip_channels where server_ip='$server_ip';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$parked_count = $row[0];
+	if ($parked_count > 0)
+	{
+	$stmt="select extension from live_channels where server_ip='$server_ip';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$ext_to_print = mysql_num_rows($rslt);
+	$i=0;
+	$live_zap_counter=0;
+	$sessions = '';
+	while ($i < $ext_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if (preg_match("/^8600/i",$row[0]))
+			{
+			$sessions .= "$row[0]|";
+			}
+		$i++;
+		}
+	$sessions = preg_replace("/\|$/",'',$sessions);
+
+	if ($DB) {echo "SESSIONS: -$sessions-\n";}
+
+	$stmt="select * from live_sip_channels where server_ip='$server_ip' order by channel;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$parked_to_print = mysql_num_rows($rslt);
+	$i=0;
+	$live_calls_counter=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if ( (preg_match("/Zap\/|internal|ring/i",$row[3])) or (preg_match("/Local\//i",$row[0])) )
+			{
+			if ($DB) {echo "NOT STATION |$row[0]|$row[3]|\n";}
+			$session_id = '';
+			}
+		else 
+			{
+			if (preg_match("/$row[3]/i",$sessions))
+				{
+				if ($DB) {echo "LIVE STATION|$row[0]|$row[3]|\n";}
+				$session_id = $row[3];
+				$station = preg_replace("/SIP\//",'',$row[0]);
+				$station = preg_replace("/-.*/",'',$station);
+			
+				$LIVE_sessions[$live_calls_counter] =			"$session_id";
+				$LIVE_sessions_FORMAT[$live_calls_counter] =	sprintf("%-9s", $session_id);
+				$LIVE_stations[$live_calls_counter] =			"$station";
+				$LIVE_stations_FORMAT[$live_calls_counter] =	sprintf("%-10s", $station);
+
+		#		echo "| $station | $session_id | \n";
+
+				$live_calls_counter++;
+				}
+			else
+				{
+				if ($DB) {echo "NOT STATIONZ|$row[0]|$row[3]|\n";}
+				$session_id = '';
+				}
+			}
+
+		$i++;
+		}
+
+		if ($live_calls_counter > 0)
+		{
+		$i=0;
+		$LC_counter = $live_calls_counter;
+
+		while ($i < $live_calls_counter)
+			{
+			$stmt="select channel,extension,number_dialed,start_time,start_epoch from call_log where extension='$LIVE_stations[$i]' and server_ip='$server_ip' order by uniqueid desc LIMIT 1;";
+			$rslt=mysql_query($stmt, $link);
+			if ($DB) {echo "$stmt\n";}
+			$parked_to_print = mysql_num_rows($rslt);
+			$row=mysql_fetch_row($rslt);
+
+			$channel =			sprintf("%-9s", $row[0]);
+			$number_dialed =	sprintf("%-16s", $row[2]);
+			$start_time =		sprintf("%-19s", $row[3]);
+			$call_time_S = ($STARTtime - $row[4]);
+
+			$call_time_M = ($call_time_S / 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";
+			$call_time_MS =		sprintf("%7s", $call_time_MS);
+			$G = '';		$EG = '';
+			if ($call_time_M_int >= 12) {$G=''; $EG='';}
+			if ($call_time_M_int >= 31) {$G=''; $EG='';}
+
+			echo "| $G$LIVE_stations_FORMAT[$i]$EG | $G$LIVE_sessions_FORMAT[$i]$EG | $G$channel$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+			$i++;
+			}
+
+		echo "+------------+-----------+-----------+------------------+---------------------+---------+\n";
+		echo "  $i stations on live calls on server $server_ip\n\n";
+
+		echo "             - 12 minutes or more on live call\n";
+		echo "             - Over 30 minutes on live call\n";
+
+		}
+		else
+		{
+		echo "*****************************************************************************************\n";
+		echo "*****************************************************************************************\n";
+		echo "*************************************** NO LIVE STATIONS ********************************\n";
+		echo "*****************************************************************************************\n";
+		echo "*****************************************************************************************\n";
+		}
+
+	}
+	else
+	{
+	echo "*****************************************************************************************\n";
+	echo "*****************************************************************************************\n";
+	echo "*************************************** NO LIVE STATIONS ********************************\n";
+	echo "*****************************************************************************************\n";
+	echo "*****************************************************************************************\n";
+	}
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_timeonpark.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_timeonpark.php new file mode 100644 index 00000000..aa79106a --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/AST_timeonpark.php @@ -0,0 +1,219 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60620-1042 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["reset_counter"])) {$reset_counter=$_GET["reset_counter"];} + elseif (isset($_POST["reset_counter"])) {$reset_counter=$_POST["reset_counter"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"];} + elseif (isset($_POST["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +$timeONEhoursAGO = ($STARTtime - 3600); +$epochHALFhoursAGO = ($STARTtime - 1860); +$timeONEhoursAGO = date("Y-m-d H:i:s",$timeONEhoursAGO); +$timeHALFhoursAGO = date("Y-m-d H:i:s",$epochHALFhoursAGO); + +$reset_counter++; + +if ($reset_counter > 7) + { + $reset_counter=0; + + $stmt="update park_log set status='HUNGUP' where hangup_time is not null;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + + if ($DB) + { + $stmt="delete from park_log where status='TALKING' and grab_time < '$timeONEhoursAGO' and (hangup_time is null or hangup_time='');"; + $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + + $stmt="delete from park_log where status='PARKED' and parked_time < '$timeHALFhoursAGO' and (hangup_time is null or hangup_time='');"; + $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + + } + } + +?> + + + + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On Park\n"; +echo "
\n\n";
+
+echo "VICIDIAL: Time On Park         $NOW_TIME    ΑÎΑΦΟΡΕΣ\n\n";
+echo "+------------+-----------------+---------------------+---------+\n";
+echo "| CHANNEL    | GROUP           | START TIME          | MINUTES |\n";
+echo "+------------+-----------------+---------------------+---------+\n";
+
+#$link=mysql_connect("localhost", "cron", "1234");
+# $linkX=mysql_connect("localhost", "cron", "1234");
+#mysql_select_db("asterisk");
+
+$stmt="select extension,user,channel,channel_group,parked_time,UNIX_TIMESTAMP(parked_time) from park_log where status ='PARKED' and server_ip='" . mysql_real_escape_string($server_ip) . "' order by uniqueid;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$parked_to_print = mysql_num_rows($rslt);
+	if ($parked_to_print > 0)
+	{
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$channel =			sprintf("%-10s", $row[2]);
+		$number_dialed =	sprintf("%-15s", $row[3]);
+		$start_time =		sprintf("%-19s", $row[4]);
+		$call_time_S = ($STARTtime - $row[5]);
+
+		$call_time_M = ($call_time_S / 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";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if ($call_time_M_int >= 1) {$G=''; $EG='';}
+		if ($call_time_M_int >= 6) {$G=''; $EG='';}
+
+		echo "| $G$channel$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------+-----------------+---------------------+---------+\n";
+		echo "  $i callers waiting on server $server_ip\n\n";
+
+		echo "             - 1 minute or more on hold\n";
+		echo "             - Over 5 minutes on hold\n";
+
+		}
+	else
+	{
+	echo "****************************************************************\n";
+	echo "****************************************************************\n";
+	echo "********************ΔΕΠΥΠΑΡΧΟΥΠΕÎΕΡΓΕΣ ΚΛΗΣΕΙΣ ΣΕ ΑÎΑΜΟÎΗ *********************\n";
+	echo "****************************************************************\n";
+	echo "****************************************************************\n";
+	}
+
+###################################################################################
+###### TIME ON INBOUND CALLS
+###################################################################################
+echo "\n\n";
+echo "----------------------------------------------------------------------------------------";
+echo "\n\n";
+echo "VICIDIAL: Agents Time On Inbound Calls                             $NOW_TIME\n\n";
+echo "+------------|--------+------------+-----------------+---------------------+---------+\n";
+echo "| STATION    | USER   | CHANNEL    | GROUP           | START TIME          | MINUTES |\n";
+echo "+------------|--------+------------+-----------------+---------------------+---------+\n";
+
+
+$stmt="select extension,user,channel,channel_group,grab_time,UNIX_TIMESTAMP(grab_time) from park_log where status ='TALKING' and server_ip='" . mysql_real_escape_string($server_ip) . "' order by uniqueid;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$talking_to_print = mysql_num_rows($rslt);
+	if ($talking_to_print > 0)
+	{
+	$i=0;
+	while ($i < $talking_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$extension =		sprintf("%-10s", $row[0]);
+		$user =				sprintf("%-6s", $row[1]);
+		$channel =			sprintf("%-10s", $row[2]);
+		$number_dialed =	sprintf("%-15s", $row[3]);
+		$start_time =		sprintf("%-19s", $row[4]);
+		$call_time_S = ($STARTtime - $row[5]);
+
+		$call_time_M = ($call_time_S / 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";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if ($call_time_M_int >= 12) {$G=''; $EG='';}
+		if ($call_time_M_int >= 31) {$G=''; $EG='';}
+
+		echo "| $G$extension$EG | $G$user$EG | $G$channel$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------|--------+------------+-----------------+---------------------+---------+\n";
+		echo "  $i agents on calls on server $server_ip\n\n";
+
+		echo "             - 12 minutes or more on call\n";
+		echo "             - Over 30 minutes on call\n";
+
+	}
+	else
+	{
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	echo "********************************* ΚΑÎΕÎΑΣ ΧΕΙΡ. ΣΕ ΚΛΗΣΕΙΣ *********************************\n";
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	}
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/admin.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/admin.php new file mode 100644 index 00000000..0c2f9dbf --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/admin.php @@ -0,0 +1,13593 @@ + LICENSE: GPLv2 +# + + +require("dbconnect.php"); + + +###################################################################################################### +###################################################################################################### +####### static variable settings for display options +###################################################################################################### +###################################################################################################### + +$page_width='770'; +$section_width='720'; +$header_font_size='3'; +$subheader_font_size='2'; +$subcamp_font_size='2'; +$header_selected_bold=''; +$header_nonselected_bold=''; +$users_color = '#FFFF99'; +$campaigns_color = '#FFCC99'; +$lists_color = '#FFCCCC'; +$ingroups_color = '#CC99FF'; +$remoteagent_color ='#CCFFCC'; +$usergroups_color = '#CCFFFF'; +$scripts_color = '#99FFCC'; +$filters_color = '#CCCCCC'; +$admin_color = '#FF99FF'; +$reports_color = '#99FF33'; +#$users_color = '#FFFF99'; +#$campaigns_color = '#FFFF99'; +#$lists_color = '#FFFF99'; +#$ingroups_color = '#FFFF99'; +#$remoteagent_color ='#FFFF99'; +#$usergroups_color = '#FFFF99'; +#$scripts_color = '#FFFF99'; +#$filters_color = '#FFFF99'; +#$admin_color = '#FFFF99'; +#$reports_color = '#FFFF99'; + $times_color = '#FF33FF'; + $phones_color = '#FF33FF'; + $conference_color = '#FF33FF'; + $server_color = '#FF33FF'; + $settings_color = '#FF33FF'; + $status_color = '#FF33FF'; +$users_font = 'BLACK'; +$campaigns_font = 'BLACK'; +$lists_font = 'BLACK'; +$ingroups_font = 'BLACK'; +$remoteagent_font = 'BLACK'; +$usergroups_font = 'BLACK'; +$scripts_font = 'BLACK'; +$filters_font = 'BLACK'; +$admin_font = 'BLACK'; +$reports_font = 'BLACK'; + $times_font = 'BLACK'; + $phones_font = 'BLACK'; + $conference_font = 'BLACK'; + $server_font = 'BLACK'; + $settings_font = 'BLACK'; + $status_font = 'BLACK'; +$subcamp_color = '#FF9933'; +$subcamp_font = 'BLACK'; + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; + +###################################################################################################### +###################################################################################################### +####### Form variable declaration +###################################################################################################### +###################################################################################################### + + +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["active"])) {$active=$_GET["active"];} + elseif (isset($_POST["active"])) {$active=$_POST["active"];} +if (isset($_GET["adaptive_dl_diff_target"])) {$adaptive_dl_diff_target=$_GET["adaptive_dl_diff_target"];} + elseif (isset($_POST["adaptive_dl_diff_target"])) {$adaptive_dl_diff_target=$_POST["adaptive_dl_diff_target"];} +if (isset($_GET["adaptive_dropped_percentage"])) {$adaptive_dropped_percentage=$_GET["adaptive_dropped_percentage"];} + elseif (isset($_POST["adaptive_dropped_percentage"])){$adaptive_dropped_percentage=$_POST["adaptive_dropped_percentage"];} +if (isset($_GET["adaptive_intensity"])) {$adaptive_intensity=$_GET["adaptive_intensity"];} + elseif (isset($_POST["adaptive_intensity"])) {$adaptive_intensity=$_POST["adaptive_intensity"];} +if (isset($_GET["adaptive_latest_server_time"])) {$adaptive_latest_server_time=$_GET["adaptive_latest_server_time"];} + elseif (isset($_POST["adaptive_latest_server_time"])){$adaptive_latest_server_time=$_POST["adaptive_latest_server_time"];} +if (isset($_GET["adaptive_maximum_level"])) {$adaptive_maximum_level=$_GET["adaptive_maximum_level"];} + elseif (isset($_POST["adaptive_maximum_level"])) {$adaptive_maximum_level=$_POST["adaptive_maximum_level"];} +if (isset($_GET["SUB"])) {$SUB=$_GET["SUB"];} + elseif (isset($_POST["SUB"])) {$SUB=$_POST["SUB"];} +if (isset($_GET["ADD"])) {$ADD=$_GET["ADD"];} + elseif (isset($_POST["ADD"])) {$ADD=$_POST["ADD"];} +if (isset($_GET["admin_hangup_enabled"])) {$admin_hangup_enabled=$_GET["admin_hangup_enabled"];} + elseif (isset($_POST["admin_hangup_enabled"])) {$admin_hangup_enabled=$_POST["admin_hangup_enabled"];} +if (isset($_GET["admin_hijack_enabled"])) {$admin_hijack_enabled=$_GET["admin_hijack_enabled"];} + elseif (isset($_POST["admin_hijack_enabled"])) {$admin_hijack_enabled=$_POST["admin_hijack_enabled"];} +if (isset($_GET["admin_monitor_enabled"])) {$admin_monitor_enabled=$_GET["admin_monitor_enabled"];} + elseif (isset($_POST["admin_monitor_enabled"])) {$admin_monitor_enabled=$_POST["admin_monitor_enabled"];} +if (isset($_GET["AFLogging_enabled"])) {$AFLogging_enabled=$_GET["AFLogging_enabled"];} + elseif (isset($_POST["AFLogging_enabled"])) {$AFLogging_enabled=$_POST["AFLogging_enabled"];} +if (isset($_GET["agent_choose_ingroups"])) {$agent_choose_ingroups=$_GET["agent_choose_ingroups"];} + elseif (isset($_POST["agent_choose_ingroups"])) {$agent_choose_ingroups=$_POST["agent_choose_ingroups"];} +if (isset($_GET["agentcall_manual"])) {$agentcall_manual=$_GET["agentcall_manual"];} + elseif (isset($_POST["agentcall_manual"])) {$agentcall_manual=$_POST["agentcall_manual"];} +if (isset($_GET["agentonly_callbacks"])) {$agentonly_callbacks=$_GET["agentonly_callbacks"];} + elseif (isset($_POST["agentonly_callbacks"])) {$agentonly_callbacks=$_POST["agentonly_callbacks"];} +if (isset($_GET["AGI_call_logging_enabled"])) {$AGI_call_logging_enabled=$_GET["AGI_call_logging_enabled"];} + elseif (isset($_POST["AGI_call_logging_enabled"])) {$AGI_call_logging_enabled=$_POST["AGI_call_logging_enabled"];} +if (isset($_GET["agi_output"])) {$agi_output=$_GET["agi_output"];} + elseif (isset($_POST["agi_output"])) {$agi_output=$_POST["agi_output"];} +if (isset($_GET["allcalls_delay"])) {$allcalls_delay=$_GET["allcalls_delay"];} + elseif (isset($_POST["allcalls_delay"])) {$allcalls_delay=$_POST["allcalls_delay"];} +if (isset($_GET["allow_closers"])) {$allow_closers=$_GET["allow_closers"];} + elseif (isset($_POST["allow_closers"])) {$allow_closers=$_POST["allow_closers"];} +if (isset($_GET["alt_number_dialing"])) {$alt_number_dialing=$_GET["alt_number_dialing"];} + elseif (isset($_POST["alt_number_dialing"])) {$alt_number_dialing=$_POST["alt_number_dialing"];} +if (isset($_GET["alter_agent_interface_options"])) {$alter_agent_interface_options=$_GET["alter_agent_interface_options"];} + elseif (isset($_POST["alter_agent_interface_options"])) {$alter_agent_interface_options=$_POST["alter_agent_interface_options"];} +if (isset($_GET["am_message_exten"])) {$am_message_exten=$_GET["am_message_exten"];} + elseif (isset($_POST["am_message_exten"])) {$am_message_exten=$_POST["am_message_exten"];} +if (isset($_GET["amd_send_to_vmx"])) {$amd_send_to_vmx=$_GET["amd_send_to_vmx"];} + elseif (isset($_POST["amd_send_to_vmx"])) {$amd_send_to_vmx=$_POST["amd_send_to_vmx"];} +if (isset($_GET["answer_transfer_agent"])) {$answer_transfer_agent=$_GET["answer_transfer_agent"];} + elseif (isset($_POST["answer_transfer_agent"])) {$answer_transfer_agent=$_POST["answer_transfer_agent"];} +if (isset($_GET["ast_admin_access"])) {$ast_admin_access=$_GET["ast_admin_access"];} + elseif (isset($_POST["ast_admin_access"])) {$ast_admin_access=$_POST["ast_admin_access"];} +if (isset($_GET["ast_delete_phones"])) {$ast_delete_phones=$_GET["ast_delete_phones"];} + elseif (isset($_POST["ast_delete_phones"])) {$ast_delete_phones=$_POST["ast_delete_phones"];} +if (isset($_GET["asterisk_version"])) {$asterisk_version=$_GET["asterisk_version"];} + elseif (isset($_POST["asterisk_version"])) {$asterisk_version=$_POST["asterisk_version"];} +if (isset($_GET["ASTmgrSECRET"])) {$ASTmgrSECRET=$_GET["ASTmgrSECRET"];} + elseif (isset($_POST["ASTmgrSECRET"])) {$ASTmgrSECRET=$_POST["ASTmgrSECRET"];} +if (isset($_GET["ASTmgrUSERNAME"])) {$ASTmgrUSERNAME=$_GET["ASTmgrUSERNAME"];} + elseif (isset($_POST["ASTmgrUSERNAME"])) {$ASTmgrUSERNAME=$_POST["ASTmgrUSERNAME"];} +if (isset($_GET["ASTmgrUSERNAMElisten"])) {$ASTmgrUSERNAMElisten=$_GET["ASTmgrUSERNAMElisten"];} + elseif (isset($_POST["ASTmgrUSERNAMElisten"])) {$ASTmgrUSERNAMElisten=$_POST["ASTmgrUSERNAMElisten"];} +if (isset($_GET["ASTmgrUSERNAMEsend"])) {$ASTmgrUSERNAMEsend=$_GET["ASTmgrUSERNAMEsend"];} + elseif (isset($_POST["ASTmgrUSERNAMEsend"])) {$ASTmgrUSERNAMEsend=$_POST["ASTmgrUSERNAMEsend"];} +if (isset($_GET["ASTmgrUSERNAMEupdate"])) {$ASTmgrUSERNAMEupdate=$_GET["ASTmgrUSERNAMEupdate"];} + elseif (isset($_POST["ASTmgrUSERNAMEupdate"])) {$ASTmgrUSERNAMEupdate=$_POST["ASTmgrUSERNAMEupdate"];} +if (isset($_GET["attempt_delay"])) {$attempt_delay=$_GET["attempt_delay"];} + elseif (isset($_POST["attempt_delay"])) {$attempt_delay=$_POST["attempt_delay"];} +if (isset($_GET["attempt_maximum"])) {$attempt_maximum=$_GET["attempt_maximum"];} + elseif (isset($_POST["attempt_maximum"])) {$attempt_maximum=$_POST["attempt_maximum"];} +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["auto_dial_next_number"])) {$auto_dial_next_number=$_GET["auto_dial_next_number"];} + elseif (isset($_POST["auto_dial_next_number"])) {$auto_dial_next_number=$_POST["auto_dial_next_number"];} +if (isset($_GET["available_only_ratio_tally"])) {$available_only_ratio_tally=$_GET["available_only_ratio_tally"];} + elseif (isset($_POST["available_only_ratio_tally"])){$available_only_ratio_tally=$_POST["available_only_ratio_tally"];} +if (isset($_GET["call_out_number_group"])) {$call_out_number_group=$_GET["call_out_number_group"];} + elseif (isset($_POST["call_out_number_group"])) {$call_out_number_group=$_POST["call_out_number_group"];} +if (isset($_GET["call_parking_enabled"])) {$call_parking_enabled=$_GET["call_parking_enabled"];} + elseif (isset($_POST["call_parking_enabled"])) {$call_parking_enabled=$_POST["call_parking_enabled"];} +if (isset($_GET["call_time_comments"])) {$call_time_comments=$_GET["call_time_comments"];} + elseif (isset($_POST["call_time_comments"])) {$call_time_comments=$_POST["call_time_comments"];} +if (isset($_GET["call_time_id"])) {$call_time_id=$_GET["call_time_id"];} + elseif (isset($_POST["call_time_id"])) {$call_time_id=$_POST["call_time_id"];} +if (isset($_GET["call_time_name"])) {$call_time_name=$_GET["call_time_name"];} + elseif (isset($_POST["call_time_name"])) {$call_time_name=$_POST["call_time_name"];} +if (isset($_GET["CallerID_popup_enabled"])) {$CallerID_popup_enabled=$_GET["CallerID_popup_enabled"];} + elseif (isset($_POST["CallerID_popup_enabled"])) {$CallerID_popup_enabled=$_POST["CallerID_popup_enabled"];} +if (isset($_GET["campaign_cid"])) {$campaign_cid=$_GET["campaign_cid"];} + elseif (isset($_POST["campaign_cid"])) {$campaign_cid=$_POST["campaign_cid"];} +if (isset($_GET["campaign_detail"])) {$campaign_detail=$_GET["campaign_detail"];} + elseif (isset($_POST["campaign_detail"])) {$campaign_detail=$_POST["campaign_detail"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["campaign_name"])) {$campaign_name=$_GET["campaign_name"];} + elseif (isset($_POST["campaign_name"])) {$campaign_name=$_POST["campaign_name"];} +if (isset($_GET["campaign_rec_exten"])) {$campaign_rec_exten=$_GET["campaign_rec_exten"];} + elseif (isset($_POST["campaign_rec_exten"])) {$campaign_rec_exten=$_POST["campaign_rec_exten"];} +if (isset($_GET["campaign_rec_filename"])) {$campaign_rec_filename=$_GET["campaign_rec_filename"];} + elseif (isset($_POST["campaign_rec_filename"])) {$campaign_rec_filename=$_POST["campaign_rec_filename"];} +if (isset($_GET["campaign_recording"])) {$campaign_recording=$_GET["campaign_recording"];} + elseif (isset($_POST["campaign_recording"])) {$campaign_recording=$_POST["campaign_recording"];} +if (isset($_GET["campaign_vdad_exten"])) {$campaign_vdad_exten=$_GET["campaign_vdad_exten"];} + elseif (isset($_POST["campaign_vdad_exten"])) {$campaign_vdad_exten=$_POST["campaign_vdad_exten"];} +if (isset($_GET["change_agent_campaign"])) {$change_agent_campaign=$_GET["change_agent_campaign"];} + elseif (isset($_POST["change_agent_campaign"])) {$change_agent_campaign=$_POST["change_agent_campaign"];} +if (isset($_GET["client_browser"])) {$client_browser=$_GET["client_browser"];} + elseif (isset($_POST["client_browser"])) {$client_browser=$_POST["client_browser"];} +if (isset($_GET["closer_default_blended"])) {$closer_default_blended=$_GET["closer_default_blended"];} + elseif (isset($_POST["closer_default_blended"])) {$closer_default_blended=$_POST["closer_default_blended"];} +if (isset($_GET["company"])) {$company=$_GET["company"];} + elseif (isset($_POST["company"])) {$company=$_POST["company"];} +if (isset($_GET["computer_ip"])) {$computer_ip=$_GET["computer_ip"];} + elseif (isset($_POST["computer_ip"])) {$computer_ip=$_POST["computer_ip"];} +if (isset($_GET["conf_exten"])) {$conf_exten=$_GET["conf_exten"];} + elseif (isset($_POST["conf_exten"])) {$conf_exten=$_POST["conf_exten"];} +if (isset($_GET["conf_on_extension"])) {$conf_on_extension=$_GET["conf_on_extension"];} + elseif (isset($_POST["conf_on_extension"])) {$conf_on_extension=$_POST["conf_on_extension"];} +if (isset($_GET["conferencing_enabled"])) {$conferencing_enabled=$_GET["conferencing_enabled"];} + elseif (isset($_POST["conferencing_enabled"])) {$conferencing_enabled=$_POST["conferencing_enabled"];} +if (isset($_GET["CoNfIrM"])) {$CoNfIrM=$_GET["CoNfIrM"];} + elseif (isset($_POST["CoNfIrM"])) {$CoNfIrM=$_POST["CoNfIrM"];} +if (isset($_GET["ct_default_start"])) {$ct_default_start=$_GET["ct_default_start"];} + elseif (isset($_POST["ct_default_start"])) {$ct_default_start=$_POST["ct_default_start"];} +if (isset($_GET["ct_default_stop"])) {$ct_default_stop=$_GET["ct_default_stop"];} + elseif (isset($_POST["ct_default_stop"])) {$ct_default_stop=$_POST["ct_default_stop"];} +if (isset($_GET["ct_friday_start"])) {$ct_friday_start=$_GET["ct_friday_start"];} + elseif (isset($_POST["ct_friday_start"])) {$ct_friday_start=$_POST["ct_friday_start"];} +if (isset($_GET["ct_friday_stop"])) {$ct_friday_stop=$_GET["ct_friday_stop"];} + elseif (isset($_POST["ct_friday_stop"])) {$ct_friday_stop=$_POST["ct_friday_stop"];} +if (isset($_GET["ct_monday_start"])) {$ct_monday_start=$_GET["ct_monday_start"];} + elseif (isset($_POST["ct_monday_start"])) {$ct_monday_start=$_POST["ct_monday_start"];} +if (isset($_GET["ct_monday_stop"])) {$ct_monday_stop=$_GET["ct_monday_stop"];} + elseif (isset($_POST["ct_monday_stop"])) {$ct_monday_stop=$_POST["ct_monday_stop"];} +if (isset($_GET["ct_saturday_start"])) {$ct_saturday_start=$_GET["ct_saturday_start"];} + elseif (isset($_POST["ct_saturday_start"])) {$ct_saturday_start=$_POST["ct_saturday_start"];} +if (isset($_GET["ct_saturday_stop"])) {$ct_saturday_stop=$_GET["ct_saturday_stop"];} + elseif (isset($_POST["ct_saturday_stop"])) {$ct_saturday_stop=$_POST["ct_saturday_stop"];} +if (isset($_GET["ct_sunday_start"])) {$ct_sunday_start=$_GET["ct_sunday_start"];} + elseif (isset($_POST["ct_sunday_start"])) {$ct_sunday_start=$_POST["ct_sunday_start"];} +if (isset($_GET["ct_sunday_stop"])) {$ct_sunday_stop=$_GET["ct_sunday_stop"];} + elseif (isset($_POST["ct_sunday_stop"])) {$ct_sunday_stop=$_POST["ct_sunday_stop"];} +if (isset($_GET["ct_thursday_start"])) {$ct_thursday_start=$_GET["ct_thursday_start"];} + elseif (isset($_POST["ct_thursday_start"])) {$ct_thursday_start=$_POST["ct_thursday_start"];} +if (isset($_GET["ct_thursday_stop"])) {$ct_thursday_stop=$_GET["ct_thursday_stop"];} + elseif (isset($_POST["ct_thursday_stop"])) {$ct_thursday_stop=$_POST["ct_thursday_stop"];} +if (isset($_GET["ct_tuesday_start"])) {$ct_tuesday_start=$_GET["ct_tuesday_start"];} + elseif (isset($_POST["ct_tuesday_start"])) {$ct_tuesday_start=$_POST["ct_tuesday_start"];} +if (isset($_GET["ct_tuesday_stop"])) {$ct_tuesday_stop=$_GET["ct_tuesday_stop"];} + elseif (isset($_POST["ct_tuesday_stop"])) {$ct_tuesday_stop=$_POST["ct_tuesday_stop"];} +if (isset($_GET["ct_wednesday_start"])) {$ct_wednesday_start=$_GET["ct_wednesday_start"];} + elseif (isset($_POST["ct_wednesday_start"])) {$ct_wednesday_start=$_POST["ct_wednesday_start"];} +if (isset($_GET["ct_wednesday_stop"])) {$ct_wednesday_stop=$_GET["ct_wednesday_stop"];} + elseif (isset($_POST["ct_wednesday_stop"])) {$ct_wednesday_stop=$_POST["ct_wednesday_stop"];} +if (isset($_GET["DBX_database"])) {$DBX_database=$_GET["DBX_database"];} + elseif (isset($_POST["DBX_database"])) {$DBX_database=$_POST["DBX_database"];} +if (isset($_GET["DBX_pass"])) {$DBX_pass=$_GET["DBX_pass"];} + elseif (isset($_POST["DBX_pass"])) {$DBX_pass=$_POST["DBX_pass"];} +if (isset($_GET["DBX_port"])) {$DBX_port=$_GET["DBX_port"];} + elseif (isset($_POST["DBX_port"])) {$DBX_port=$_POST["DBX_port"];} +if (isset($_GET["DBX_server"])) {$DBX_server=$_GET["DBX_server"];} + elseif (isset($_POST["DBX_server"])) {$DBX_server=$_POST["DBX_server"];} +if (isset($_GET["DBX_user"])) {$DBX_user=$_GET["DBX_user"];} + elseif (isset($_POST["DBX_user"])) {$DBX_user=$_POST["DBX_user"];} +if (isset($_GET["DBY_database"])) {$DBY_database=$_GET["DBY_database"];} + elseif (isset($_POST["DBY_database"])) {$DBY_database=$_POST["DBY_database"];} +if (isset($_GET["DBY_pass"])) {$DBY_pass=$_GET["DBY_pass"];} + elseif (isset($_POST["DBY_pass"])) {$DBY_pass=$_POST["DBY_pass"];} +if (isset($_GET["DBY_port"])) {$DBY_port=$_GET["DBY_port"];} + elseif (isset($_POST["DBY_port"])) {$DBY_port=$_POST["DBY_port"];} +if (isset($_GET["DBY_server"])) {$DBY_server=$_GET["DBY_server"];} + elseif (isset($_POST["DBY_server"])) {$DBY_server=$_POST["DBY_server"];} +if (isset($_GET["DBY_user"])) {$DBY_user=$_GET["DBY_user"];} + elseif (isset($_POST["DBY_user"])) {$DBY_user=$_POST["DBY_user"];} +if (isset($_GET["delete_call_times"])) {$delete_call_times=$_GET["delete_call_times"];} + elseif (isset($_POST["delete_call_times"])) {$delete_call_times=$_POST["delete_call_times"];} +if (isset($_GET["delete_campaigns"])) {$delete_campaigns=$_GET["delete_campaigns"];} + elseif (isset($_POST["delete_campaigns"])) {$delete_campaigns=$_POST["delete_campaigns"];} +if (isset($_GET["delete_filters"])) {$delete_filters=$_GET["delete_filters"];} + elseif (isset($_POST["delete_filters"])) {$delete_filters=$_POST["delete_filters"];} +if (isset($_GET["delete_ingroups"])) {$delete_ingroups=$_GET["delete_ingroups"];} + elseif (isset($_POST["delete_ingroups"])) {$delete_ingroups=$_POST["delete_ingroups"];} +if (isset($_GET["delete_lists"])) {$delete_lists=$_GET["delete_lists"];} + elseif (isset($_POST["delete_lists"])) {$delete_lists=$_POST["delete_lists"];} +if (isset($_GET["delete_remote_agents"])) {$delete_remote_agents=$_GET["delete_remote_agents"];} + elseif (isset($_POST["delete_remote_agents"])) {$delete_remote_agents=$_POST["delete_remote_agents"];} +if (isset($_GET["delete_scripts"])) {$delete_scripts=$_GET["delete_scripts"];} + elseif (isset($_POST["delete_scripts"])) {$delete_scripts=$_POST["delete_scripts"];} +if (isset($_GET["delete_user_groups"])) {$delete_user_groups=$_GET["delete_user_groups"];} + elseif (isset($_POST["delete_user_groups"])) {$delete_user_groups=$_POST["delete_user_groups"];} +if (isset($_GET["delete_users"])) {$delete_users=$_GET["delete_users"];} + elseif (isset($_POST["delete_users"])) {$delete_users=$_POST["delete_users"];} +if (isset($_GET["dial_method"])) {$dial_method=$_GET["dial_method"];} + elseif (isset($_POST["dial_method"])) {$dial_method=$_POST["dial_method"];} +if (isset($_GET["dial_prefix"])) {$dial_prefix=$_GET["dial_prefix"];} + elseif (isset($_POST["dial_prefix"])) {$dial_prefix=$_POST["dial_prefix"];} +if (isset($_GET["dial_status_a"])) {$dial_status_a=$_GET["dial_status_a"];} + elseif (isset($_POST["dial_status_a"])) {$dial_status_a=$_POST["dial_status_a"];} +if (isset($_GET["dial_status_b"])) {$dial_status_b=$_GET["dial_status_b"];} + elseif (isset($_POST["dial_status_b"])) {$dial_status_b=$_POST["dial_status_b"];} +if (isset($_GET["dial_status_c"])) {$dial_status_c=$_GET["dial_status_c"];} + elseif (isset($_POST["dial_status_c"])) {$dial_status_c=$_POST["dial_status_c"];} +if (isset($_GET["dial_status_d"])) {$dial_status_d=$_GET["dial_status_d"];} + elseif (isset($_POST["dial_status_d"])) {$dial_status_d=$_POST["dial_status_d"];} +if (isset($_GET["dial_status_e"])) {$dial_status_e=$_GET["dial_status_e"];} + elseif (isset($_POST["dial_status_e"])) {$dial_status_e=$_POST["dial_status_e"];} +if (isset($_GET["dial_timeout"])) {$dial_timeout=$_GET["dial_timeout"];} + elseif (isset($_POST["dial_timeout"])) {$dial_timeout=$_POST["dial_timeout"];} +if (isset($_GET["dialplan_number"])) {$dialplan_number=$_GET["dialplan_number"];} + elseif (isset($_POST["dialplan_number"])) {$dialplan_number=$_POST["dialplan_number"];} +if (isset($_GET["drop_call_seconds"])) {$drop_call_seconds=$_GET["drop_call_seconds"];} + elseif (isset($_POST["drop_call_seconds"])) {$drop_call_seconds=$_POST["drop_call_seconds"];} +if (isset($_GET["drop_exten"])) {$drop_exten=$_GET["drop_exten"];} + elseif (isset($_POST["drop_exten"])) {$drop_exten=$_POST["drop_exten"];} +if (isset($_GET["drop_message"])) {$drop_message=$_GET["drop_message"];} + elseif (isset($_POST["drop_message"])) {$drop_message=$_POST["drop_message"];} +if (isset($_GET["dtmf_send_extension"])) {$dtmf_send_extension=$_GET["dtmf_send_extension"];} + elseif (isset($_POST["dtmf_send_extension"])) {$dtmf_send_extension=$_POST["dtmf_send_extension"];} +if (isset($_GET["enable_fast_refresh"])) {$enable_fast_refresh=$_GET["enable_fast_refresh"];} + elseif (isset($_POST["enable_fast_refresh"])) {$enable_fast_refresh=$_POST["enable_fast_refresh"];} +if (isset($_GET["enable_persistant_mysql"])) {$enable_persistant_mysql=$_GET["enable_persistant_mysql"];} + elseif (isset($_POST["enable_persistant_mysql"])) {$enable_persistant_mysql=$_POST["enable_persistant_mysql"];} +if (isset($_GET["ext_context"])) {$ext_context=$_GET["ext_context"];} + elseif (isset($_POST["ext_context"])) {$ext_context=$_POST["ext_context"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["fast_refresh_rate"])) {$fast_refresh_rate=$_GET["fast_refresh_rate"];} + elseif (isset($_POST["fast_refresh_rate"])) {$fast_refresh_rate=$_POST["fast_refresh_rate"];} +if (isset($_GET["force_logout"])) {$force_logout=$_GET["force_logout"];} + elseif (isset($_POST["force_logout"])) {$force_logout=$_POST["force_logout"];} +if (isset($_GET["fronter_display"])) {$fronter_display=$_GET["fronter_display"];} + elseif (isset($_POST["fronter_display"])) {$fronter_display=$_POST["fronter_display"];} +if (isset($_GET["full_name"])) {$full_name=$_GET["full_name"];} + elseif (isset($_POST["full_name"])) {$full_name=$_POST["full_name"];} +if (isset($_GET["fullname"])) {$fullname=$_GET["fullname"];} + elseif (isset($_POST["fullname"])) {$fullname=$_POST["fullname"];} +if (isset($_GET["get_call_launch"])) {$get_call_launch=$_GET["get_call_launch"];} + elseif (isset($_POST["get_call_launch"])) {$get_call_launch=$_POST["get_call_launch"];} +if (isset($_GET["group_color"])) {$group_color=$_GET["group_color"];} + elseif (isset($_POST["group_color"])) {$group_color=$_POST["group_color"];} +if (isset($_GET["group_id"])) {$group_id=$_GET["group_id"];} + elseif (isset($_POST["group_id"])) {$group_id=$_POST["group_id"];} +if (isset($_GET["group_name"])) {$group_name=$_GET["group_name"];} + elseif (isset($_POST["group_name"])) {$group_name=$_POST["group_name"];} +if (isset($_GET["groups"])) {$groups=$_GET["groups"];} + elseif (isset($_POST["groups"])) {$groups=$_POST["groups"];} +if (isset($_GET["XFERgroups"])) {$XFERgroups=$_GET["XFERgroups"];} + elseif (isset($_POST["XFERgroups"])) {$XFERgroups=$_POST["XFERgroups"];} +if (isset($_GET["HKstatus"])) {$HKstatus=$_GET["HKstatus"];} + elseif (isset($_POST["HKstatus"])) {$HKstatus=$_POST["HKstatus"];} +if (isset($_GET["hopper_level"])) {$hopper_level=$_GET["hopper_level"];} + elseif (isset($_POST["hopper_level"])) {$hopper_level=$_POST["hopper_level"];} +if (isset($_GET["hotkey"])) {$hotkey=$_GET["hotkey"];} + elseif (isset($_POST["hotkey"])) {$hotkey=$_POST["hotkey"];} +if (isset($_GET["hotkeys_active"])) {$hotkeys_active=$_GET["hotkeys_active"];} + elseif (isset($_POST["hotkeys_active"])) {$hotkeys_active=$_POST["hotkeys_active"];} +if (isset($_GET["install_directory"])) {$install_directory=$_GET["install_directory"];} + elseif (isset($_POST["install_directory"])) {$install_directory=$_POST["install_directory"];} +if (isset($_GET["lead_filter_comments"])) {$lead_filter_comments=$_GET["lead_filter_comments"];} + elseif (isset($_POST["lead_filter_comments"])) {$lead_filter_comments=$_POST["lead_filter_comments"];} +if (isset($_GET["lead_filter_id"])) {$lead_filter_id=$_GET["lead_filter_id"];} + elseif (isset($_POST["lead_filter_id"])) {$lead_filter_id=$_POST["lead_filter_id"];} +if (isset($_GET["lead_filter_name"])) {$lead_filter_name=$_GET["lead_filter_name"];} + elseif (isset($_POST["lead_filter_name"])) {$lead_filter_name=$_POST["lead_filter_name"];} +if (isset($_GET["lead_filter_sql"])) {$lead_filter_sql=$_GET["lead_filter_sql"];} + elseif (isset($_POST["lead_filter_sql"])) {$lead_filter_sql=$_POST["lead_filter_sql"];} +if (isset($_GET["lead_order"])) {$lead_order=$_GET["lead_order"];} + elseif (isset($_POST["lead_order"])) {$lead_order=$_POST["lead_order"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["list_name"])) {$list_name=$_GET["list_name"];} + elseif (isset($_POST["list_name"])) {$list_name=$_POST["list_name"];} +if (isset($_GET["load_leads"])) {$load_leads=$_GET["load_leads"];} + elseif (isset($_POST["load_leads"])) {$load_leads=$_POST["load_leads"];} +if (isset($_GET["local_call_time"])) {$local_call_time=$_GET["local_call_time"];} + elseif (isset($_POST["local_call_time"])) {$local_call_time=$_POST["local_call_time"];} +if (isset($_GET["local_gmt"])) {$local_gmt=$_GET["local_gmt"];} + elseif (isset($_POST["local_gmt"])) {$local_gmt=$_POST["local_gmt"];} +if (isset($_GET["local_web_callerID_URL"])) {$local_web_callerID_URL=$_GET["local_web_callerID_URL"];} + elseif (isset($_POST["local_web_callerID_URL"])) {$local_web_callerID_URL=$_POST["local_web_callerID_URL"];} +if (isset($_GET["login"])) {$login=$_GET["login"];} + elseif (isset($_POST["login"])) {$login=$_POST["login"];} +if (isset($_GET["login_campaign"])) {$login_campaign=$_GET["login_campaign"];} + elseif (isset($_POST["login_campaign"])) {$login_campaign=$_POST["login_campaign"];} +if (isset($_GET["login_pass"])) {$login_pass=$_GET["login_pass"];} + elseif (isset($_POST["login_pass"])) {$login_pass=$_POST["login_pass"];} +if (isset($_GET["login_user"])) {$login_user=$_GET["login_user"];} + elseif (isset($_POST["login_user"])) {$login_user=$_POST["login_user"];} +if (isset($_GET["max_vicidial_trunks"])) {$max_vicidial_trunks=$_GET["max_vicidial_trunks"];} + elseif (isset($_POST["max_vicidial_trunks"])) {$max_vicidial_trunks=$_POST["max_vicidial_trunks"];} +if (isset($_GET["modify_call_times"])) {$modify_call_times=$_GET["modify_call_times"];} + elseif (isset($_POST["modify_call_times"])) {$modify_call_times=$_POST["modify_call_times"];} +if (isset($_GET["modify_leads"])) {$modify_leads=$_GET["modify_leads"];} + elseif (isset($_POST["modify_leads"])) {$modify_leads=$_POST["modify_leads"];} +if (isset($_GET["monitor_prefix"])) {$monitor_prefix=$_GET["monitor_prefix"];} + elseif (isset($_POST["monitor_prefix"])) {$monitor_prefix=$_POST["monitor_prefix"];} +if (isset($_GET["next_agent_call"])) {$next_agent_call=$_GET["next_agent_call"];} + elseif (isset($_POST["next_agent_call"])) {$next_agent_call=$_POST["next_agent_call"];} +if (isset($_GET["number_of_lines"])) {$number_of_lines=$_GET["number_of_lines"];} + elseif (isset($_POST["number_of_lines"])) {$number_of_lines=$_POST["number_of_lines"];} +if (isset($_GET["old_campaign_id"])) {$old_campaign_id=$_GET["old_campaign_id"];} + elseif (isset($_POST["old_campaign_id"])) {$old_campaign_id=$_POST["old_campaign_id"];} +if (isset($_GET["old_conf_exten"])) {$old_conf_exten=$_GET["old_conf_exten"];} + elseif (isset($_POST["old_conf_exten"])) {$old_conf_exten=$_POST["old_conf_exten"];} +if (isset($_GET["old_extension"])) {$old_extension=$_GET["old_extension"];} + elseif (isset($_POST["old_extension"])) {$old_extension=$_POST["old_extension"];} +if (isset($_GET["old_server_id"])) {$old_server_id=$_GET["old_server_id"];} + elseif (isset($_POST["old_server_id"])) {$old_server_id=$_POST["old_server_id"];} +if (isset($_GET["old_server_ip"])) {$old_server_ip=$_GET["old_server_ip"];} + elseif (isset($_POST["old_server_ip"])) {$old_server_ip=$_POST["old_server_ip"];} +if (isset($_GET["OLDuser_group"])) {$OLDuser_group=$_GET["OLDuser_group"];} + elseif (isset($_POST["OLDuser_group"])) {$OLDuser_group=$_POST["OLDuser_group"];} +if (isset($_GET["omit_phone_code"])) {$omit_phone_code=$_GET["omit_phone_code"];} + elseif (isset($_POST["omit_phone_code"])) {$omit_phone_code=$_POST["omit_phone_code"];} +if (isset($_GET["outbound_cid"])) {$outbound_cid=$_GET["outbound_cid"];} + elseif (isset($_POST["outbound_cid"])) {$outbound_cid=$_POST["outbound_cid"];} +if (isset($_GET["park_ext"])) {$park_ext=$_GET["park_ext"];} + elseif (isset($_POST["park_ext"])) {$park_ext=$_POST["park_ext"];} +if (isset($_GET["park_file_name"])) {$park_file_name=$_GET["park_file_name"];} + elseif (isset($_POST["park_file_name"])) {$park_file_name=$_POST["park_file_name"];} +if (isset($_GET["park_on_extension"])) {$park_on_extension=$_GET["park_on_extension"];} + elseif (isset($_POST["park_on_extension"])) {$park_on_extension=$_POST["park_on_extension"];} +if (isset($_GET["pass"])) {$pass=$_GET["pass"];} + elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];} +if (isset($_GET["phone_ip"])) {$phone_ip=$_GET["phone_ip"];} + elseif (isset($_POST["phone_ip"])) {$phone_ip=$_POST["phone_ip"];} +if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];} + elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];} +if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];} + elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];} +if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];} + elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];} +if (isset($_GET["phone_type"])) {$phone_type=$_GET["phone_type"];} + elseif (isset($_POST["phone_type"])) {$phone_type=$_POST["phone_type"];} +if (isset($_GET["picture"])) {$picture=$_GET["picture"];} + elseif (isset($_POST["picture"])) {$picture=$_POST["picture"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} +if (isset($_GET["QUEUE_ACTION_enabled"])) {$QUEUE_ACTION_enabled=$_GET["QUEUE_ACTION_enabled"];} + elseif (isset($_POST["QUEUE_ACTION_enabled"])) {$QUEUE_ACTION_enabled=$_POST["QUEUE_ACTION_enabled"];} +if (isset($_GET["recording_exten"])) {$recording_exten=$_GET["recording_exten"];} + elseif (isset($_POST["recording_exten"])) {$recording_exten=$_POST["recording_exten"];} +if (isset($_GET["remote_agent_id"])) {$remote_agent_id=$_GET["remote_agent_id"];} + elseif (isset($_POST["remote_agent_id"])) {$remote_agent_id=$_POST["remote_agent_id"];} +if (isset($_GET["reset_hopper"])) {$reset_hopper=$_GET["reset_hopper"];} + elseif (isset($_POST["reset_hopper"])) {$reset_hopper=$_POST["reset_hopper"];} +if (isset($_GET["reset_list"])) {$reset_list=$_GET["reset_list"];} + elseif (isset($_POST["reset_list"])) {$reset_list=$_POST["reset_list"];} +if (isset($_GET["safe_harbor_exten"])) {$safe_harbor_exten=$_GET["safe_harbor_exten"];} + elseif (isset($_POST["safe_harbor_exten"])) {$safe_harbor_exten=$_POST["safe_harbor_exten"];} +if (isset($_GET["safe_harbor_message"])) {$safe_harbor_message=$_GET["safe_harbor_message"];} + elseif (isset($_POST["safe_harbor_message"])) {$safe_harbor_message=$_POST["safe_harbor_message"];} +if (isset($_GET["scheduled_callbacks"])) {$scheduled_callbacks=$_GET["scheduled_callbacks"];} + elseif (isset($_POST["scheduled_callbacks"])) {$scheduled_callbacks=$_POST["scheduled_callbacks"];} +if (isset($_GET["script_comments"])) {$script_comments=$_GET["script_comments"];} + elseif (isset($_POST["script_comments"])) {$script_comments=$_POST["script_comments"];} +if (isset($_GET["script_id"])) {$script_id=$_GET["script_id"];} + elseif (isset($_POST["script_id"])) {$script_id=$_POST["script_id"];} +if (isset($_GET["script_name"])) {$script_name=$_GET["script_name"];} + elseif (isset($_POST["script_name"])) {$script_name=$_POST["script_name"];} +if (isset($_GET["script_text"])) {$script_text=$_GET["script_text"];} + elseif (isset($_POST["script_text"])) {$script_text=$_POST["script_text"];} +if (isset($_GET["selectable"])) {$selectable=$_GET["selectable"];} + elseif (isset($_POST["selectable"])) {$selectable=$_POST["selectable"];} +if (isset($_GET["server_description"])) {$server_description=$_GET["server_description"];} + elseif (isset($_POST["server_description"])) {$server_description=$_POST["server_description"];} +if (isset($_GET["server_id"])) {$server_id=$_GET["server_id"];} + elseif (isset($_POST["server_id"])) {$server_id=$_POST["server_id"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["state_call_time_state"])) {$state_call_time_state=$_GET["state_call_time_state"];} + elseif (isset($_POST["state_call_time_state"])) {$state_call_time_state=$_POST["state_call_time_state"];} +if (isset($_GET["state_rule"])) {$state_rule=$_GET["state_rule"];} + elseif (isset($_POST["state_rule"])) {$state_rule=$_POST["state_rule"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["status_name"])) {$status_name=$_GET["status_name"];} + elseif (isset($_POST["status_name"])) {$status_name=$_POST["status_name"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"];} + elseif (isset($_POST["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];} +if (isset($_GET["sys_perf_log"])) {$sys_perf_log=$_GET["sys_perf_log"];} + elseif (isset($_POST["sys_perf_log"])) {$sys_perf_log=$_POST["sys_perf_log"];} +if (isset($_GET["telnet_host"])) {$telnet_host=$_GET["telnet_host"];} + elseif (isset($_POST["telnet_host"])) {$telnet_host=$_POST["telnet_host"];} +if (isset($_GET["telnet_port"])) {$telnet_port=$_GET["telnet_port"];} + elseif (isset($_POST["telnet_port"])) {$telnet_port=$_POST["telnet_port"];} +if (isset($_GET["updater_check_enabled"])) {$updater_check_enabled=$_GET["updater_check_enabled"];} + elseif (isset($_POST["updater_check_enabled"])) {$updater_check_enabled=$_POST["updater_check_enabled"];} +if (isset($_GET["use_internal_dnc"])) {$use_internal_dnc=$_GET["use_internal_dnc"];} + elseif (isset($_POST["use_internal_dnc"])) {$use_internal_dnc=$_POST["use_internal_dnc"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["user_group"])) {$user_group=$_GET["user_group"];} + elseif (isset($_POST["user_group"])) {$user_group=$_POST["user_group"];} +if (isset($_GET["user_level"])) {$user_level=$_GET["user_level"];} + elseif (isset($_POST["user_level"])) {$user_level=$_POST["user_level"];} +if (isset($_GET["user_start"])) {$user_start=$_GET["user_start"];} + elseif (isset($_POST["user_start"])) {$user_start=$_POST["user_start"];} +if (isset($_GET["user_switching_enabled"])) {$user_switching_enabled=$_GET["user_switching_enabled"];} + elseif (isset($_POST["user_switching_enabled"])) {$user_switching_enabled=$_POST["user_switching_enabled"];} +if (isset($_GET["vd_server_logs"])) {$vd_server_logs=$_GET["vd_server_logs"];} + elseif (isset($_POST["vd_server_logs"])) {$vd_server_logs=$_POST["vd_server_logs"];} +if (isset($_GET["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_GET["VDstop_rec_after_each_call"];} + elseif (isset($_POST["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_POST["VDstop_rec_after_each_call"];} +if (isset($_GET["VICIDIAL_park_on_extension"])) {$VICIDIAL_park_on_extension=$_GET["VICIDIAL_park_on_extension"];} + elseif (isset($_POST["VICIDIAL_park_on_extension"])) {$VICIDIAL_park_on_extension=$_POST["VICIDIAL_park_on_extension"];} +if (isset($_GET["VICIDIAL_park_on_filename"])) {$VICIDIAL_park_on_filename=$_GET["VICIDIAL_park_on_filename"];} + elseif (isset($_POST["VICIDIAL_park_on_filename"])) {$VICIDIAL_park_on_filename=$_POST["VICIDIAL_park_on_filename"];} +if (isset($_GET["vicidial_recording"])) {$vicidial_recording=$_GET["vicidial_recording"];} + elseif (isset($_POST["vicidial_recording"])) {$vicidial_recording=$_POST["vicidial_recording"];} +if (isset($_GET["vicidial_transfers"])) {$vicidial_transfers=$_GET["vicidial_transfers"];} + elseif (isset($_POST["vicidial_transfers"])) {$vicidial_transfers=$_POST["vicidial_transfers"];} +if (isset($_GET["VICIDIAL_web_URL"])) {$VICIDIAL_web_URL=$_GET["VICIDIAL_web_URL"];} + elseif (isset($_POST["VICIDIAL_web_URL"])) {$VICIDIAL_web_URL=$_POST["VICIDIAL_web_URL"];} +if (isset($_GET["voicemail_button_enabled"])) {$voicemail_button_enabled=$_GET["voicemail_button_enabled"];} + elseif (isset($_POST["voicemail_button_enabled"])) {$voicemail_button_enabled=$_POST["voicemail_button_enabled"];} +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["voicemail_ext"])) {$voicemail_ext=$_GET["voicemail_ext"];} + elseif (isset($_POST["voicemail_ext"])) {$voicemail_ext=$_POST["voicemail_ext"];} +if (isset($_GET["voicemail_exten"])) {$voicemail_exten=$_GET["voicemail_exten"];} + elseif (isset($_POST["voicemail_exten"])) {$voicemail_exten=$_POST["voicemail_exten"];} +if (isset($_GET["voicemail_id"])) {$voicemail_id=$_GET["voicemail_id"];} + elseif (isset($_POST["voicemail_id"])) {$voicemail_id=$_POST["voicemail_id"];} +if (isset($_GET["web_form_address"])) {$web_form_address=$_GET["web_form_address"];} + elseif (isset($_POST["web_form_address"])) {$web_form_address=$_POST["web_form_address"];} +if (isset($_GET["wrapup_message"])) {$wrapup_message=$_GET["wrapup_message"];} + elseif (isset($_POST["wrapup_message"])) {$wrapup_message=$_POST["wrapup_message"];} +if (isset($_GET["wrapup_seconds"])) {$wrapup_seconds=$_GET["wrapup_seconds"];} + elseif (isset($_POST["wrapup_seconds"])) {$wrapup_seconds=$_POST["wrapup_seconds"];} +if (isset($_GET["xferconf_a_dtmf"])) {$xferconf_a_dtmf=$_GET["xferconf_a_dtmf"];} + elseif (isset($_POST["xferconf_a_dtmf"])) {$xferconf_a_dtmf=$_POST["xferconf_a_dtmf"];} +if (isset($_GET["xferconf_a_number"])) {$xferconf_a_number=$_GET["xferconf_a_number"];} + elseif (isset($_POST["xferconf_a_number"])) {$xferconf_a_number=$_POST["xferconf_a_number"];} +if (isset($_GET["xferconf_b_dtmf"])) {$xferconf_b_dtmf=$_GET["xferconf_b_dtmf"];} + elseif (isset($_POST["xferconf_b_dtmf"])) {$xferconf_b_dtmf=$_POST["xferconf_b_dtmf"];} +if (isset($_GET["xferconf_b_number"])) {$xferconf_b_number=$_GET["xferconf_b_number"];} + elseif (isset($_POST["xferconf_b_number"])) {$xferconf_b_number=$_POST["xferconf_b_number"];} +if (isset($_GET["vicidial_balance_active"])) {$vicidial_balance_active=$_GET["vicidial_balance_active"];} + elseif (isset($_POST["vicidial_balance_active"])) {$vicidial_balance_active=$_POST["vicidial_balance_active"];} +if (isset($_GET["balance_trunks_offlimits"])) {$balance_trunks_offlimits=$_GET["balance_trunks_offlimits"];} + elseif (isset($_POST["balance_trunks_offlimits"])) {$balance_trunks_offlimits=$_POST["balance_trunks_offlimits"];} +if (isset($_GET["dedicated_trunks"])) {$dedicated_trunks=$_GET["dedicated_trunks"];} + elseif (isset($_POST["dedicated_trunks"])) {$dedicated_trunks=$_POST["dedicated_trunks"];} +if (isset($_GET["trunk_restriction"])) {$trunk_restriction=$_GET["trunk_restriction"];} + elseif (isset($_POST["trunk_restriction"])) {$trunk_restriction=$_POST["trunk_restriction"];} +if (isset($_GET["campaigns"])) {$campaigns=$_GET["campaigns"];} + elseif (isset($_POST["campaigns"])) {$campaigns=$_POST["campaigns"];} +if (isset($_GET["dial_level_override"])) {$dial_level_override=$_GET["dial_level_override"];} + elseif (isset($_POST["dial_level_override"])) {$dial_level_override=$_POST["dial_level_override"];} +if (isset($_GET["concurrent_transfers"])) {$concurrent_transfers=$_GET["concurrent_transfers"];} + elseif (isset($_POST["concurrent_transfers"])) {$concurrent_transfers=$_POST["concurrent_transfers"];} +if (isset($_GET["auto_alt_dial"])) {$auto_alt_dial=$_GET["auto_alt_dial"];} + elseif (isset($_POST["auto_alt_dial"])) {$auto_alt_dial=$_POST["auto_alt_dial"];} +if (isset($_GET["modify_users"])) {$modify_users=$_GET["modify_users"];} + elseif (isset($_POST["modify_users"])) {$modify_users=$_POST["modify_users"];} +if (isset($_GET["modify_campaigns"])) {$modify_campaigns=$_GET["modify_campaigns"];} + elseif (isset($_POST["modify_campaigns"])) {$modify_campaigns=$_POST["modify_campaigns"];} +if (isset($_GET["modify_lists"])) {$modify_lists=$_GET["modify_lists"];} + elseif (isset($_POST["modify_lists"])) {$modify_lists=$_POST["modify_lists"];} +if (isset($_GET["modify_scripts"])) {$modify_scripts=$_GET["modify_scripts"];} + elseif (isset($_POST["modify_scripts"])) {$modify_scripts=$_POST["modify_scripts"];} +if (isset($_GET["modify_filters"])) {$modify_filters=$_GET["modify_filters"];} + elseif (isset($_POST["modify_filters"])) {$modify_filters=$_POST["modify_filters"];} +if (isset($_GET["modify_ingroups"])) {$modify_ingroups=$_GET["modify_ingroups"];} + elseif (isset($_POST["modify_ingroups"])) {$modify_ingroups=$_POST["modify_ingroups"];} +if (isset($_GET["modify_usergroups"])) {$modify_usergroups=$_GET["modify_usergroups"];} + elseif (isset($_POST["modify_usergroups"])) {$modify_usergroups=$_POST["modify_usergroups"];} +if (isset($_GET["modify_remoteagents"])) {$modify_remoteagents=$_GET["modify_remoteagents"];} + elseif (isset($_POST["modify_remoteagents"])) {$modify_remoteagents=$_POST["modify_remoteagents"];} +if (isset($_GET["modify_servers"])) {$modify_servers=$_GET["modify_servers"];} + elseif (isset($_POST["modify_servers"])) {$modify_servers=$_POST["modify_servers"];} +if (isset($_GET["view_reports"])) {$view_reports=$_GET["view_reports"];} + elseif (isset($_POST["view_reports"])) {$view_reports=$_POST["view_reports"];} +if (isset($_GET["agent_pause_codes_active"])) {$agent_pause_codes_active=$_GET["agent_pause_codes_active"];} + elseif (isset($_POST["agent_pause_codes_active"])) {$agent_pause_codes_active=$_POST["agent_pause_codes_active"];} +if (isset($_GET["pause_code"])) {$pause_code=$_GET["pause_code"];} + elseif (isset($_POST["pause_code"])) {$pause_code=$_POST["pause_code"];} +if (isset($_GET["pause_code_name"])) {$pause_code_name=$_GET["pause_code_name"];} + elseif (isset($_POST["pause_code_name"])) {$pause_code_name=$_POST["pause_code_name"];} +if (isset($_GET["billable"])) {$billable=$_GET["billable"];} + elseif (isset($_POST["billable"])) {$billable=$_POST["billable"];} +if (isset($_GET["campaign_description"])) {$campaign_description=$_GET["campaign_description"];} + elseif (isset($_POST["campaign_description"])) {$campaign_description=$_POST["campaign_description"];} +if (isset($_GET["campaign_stats_refresh"])) {$campaign_stats_refresh=$_GET["campaign_stats_refresh"];} + elseif (isset($_POST["campaign_stats_refresh"])){$campaign_stats_refresh=$_POST["campaign_stats_refresh"];} +if (isset($_GET["list_description"])) {$list_description=$_GET["list_description"];} + elseif (isset($_POST["list_description"])) {$list_description=$_POST["list_description"];} +if (isset($_GET["vicidial_recording_override"])) {$vicidial_recording_override=$_GET["vicidial_recording_override"];} elseif (isset($_POST["vicidial_recording_override"])) {$vicidial_recording_override=$_POST["vicidial_recording_override"];} +if (isset($_GET["use_non_latin"])) {$use_non_latin=$_GET["use_non_latin"];} + elseif (isset($_POST["use_non_latin"])) {$use_non_latin=$_POST["use_non_latin"];} +if (isset($_GET["webroot_writable"])) {$webroot_writable=$_GET["webroot_writable"];} + elseif (isset($_POST["webroot_writable"])) {$webroot_writable=$_POST["webroot_writable"];} +if (isset($_GET["enable_queuemetrics_logging"])) {$enable_queuemetrics_logging=$_GET["enable_queuemetrics_logging"];} + elseif (isset($_POST["enable_queuemetrics_logging"])) {$enable_queuemetrics_logging=$_POST["enable_queuemetrics_logging"];} +if (isset($_GET["queuemetrics_server_ip"])) {$queuemetrics_server_ip=$_GET["queuemetrics_server_ip"];} + elseif (isset($_POST["queuemetrics_server_ip"])) {$queuemetrics_server_ip=$_POST["queuemetrics_server_ip"];} +if (isset($_GET["queuemetrics_dbname"])) {$queuemetrics_dbname=$_GET["queuemetrics_dbname"];} + elseif (isset($_POST["queuemetrics_dbname"])) {$queuemetrics_dbname=$_POST["queuemetrics_dbname"];} +if (isset($_GET["queuemetrics_login"])) {$queuemetrics_login=$_GET["queuemetrics_login"];} + elseif (isset($_POST["queuemetrics_login"])) {$queuemetrics_login=$_POST["queuemetrics_login"];} +if (isset($_GET["queuemetrics_pass"])) {$queuemetrics_pass=$_GET["queuemetrics_pass"];} + elseif (isset($_POST["queuemetrics_pass"])) {$queuemetrics_pass=$_POST["queuemetrics_pass"];} +if (isset($_GET["queuemetrics_url"])) {$queuemetrics_url=$_GET["queuemetrics_url"];} + elseif (isset($_POST["queuemetrics_url"])) {$queuemetrics_url=$_POST["queuemetrics_url"];} +if (isset($_GET["queuemetrics_log_id"])) {$queuemetrics_log_id=$_GET["queuemetrics_log_id"];} + elseif (isset($_POST["queuemetrics_log_id"])) {$queuemetrics_log_id=$_POST["queuemetrics_log_id"];} +if (isset($_GET["dial_status"])) {$dial_status=$_GET["dial_status"];} + elseif (isset($_POST["dial_status"])) {$dial_status=$_POST["dial_status"];} +if (isset($_GET["queuemetrics_eq_prepend"])) {$queuemetrics_eq_prepend=$_GET["queuemetrics_eq_prepend"];} + elseif (isset($_POST["queuemetrics_eq_prepend"])) {$queuemetrics_eq_prepend=$_POST["queuemetrics_eq_prepend"];} +if (isset($_GET["vicidial_agent_disable"])) {$vicidial_agent_disable=$_GET["vicidial_agent_disable"];} + elseif (isset($_POST["vicidial_agent_disable"])) {$vicidial_agent_disable=$_POST["vicidial_agent_disable"];} +if (isset($_GET["disable_alter_custdata"])) {$disable_alter_custdata=$_GET["disable_alter_custdata"];} + elseif (isset($_POST["disable_alter_custdata"])) {$disable_alter_custdata=$_POST["disable_alter_custdata"];} +if (isset($_GET["alter_custdata_override"])) {$alter_custdata_override=$_GET["alter_custdata_override"];} + elseif (isset($_POST["alter_custdata_override"])) {$alter_custdata_override=$_POST["alter_custdata_override"];} +if (isset($_GET["no_hopper_leads_logins"])) {$no_hopper_leads_logins=$_GET["no_hopper_leads_logins"];} + elseif (isset($_POST["no_hopper_leads_logins"])) {$no_hopper_leads_logins=$_POST["no_hopper_leads_logins"];} +if (isset($_GET["enable_sipsak_messages"])) {$enable_sipsak_messages=$_GET["enable_sipsak_messages"];} + elseif (isset($_POST["enable_sipsak_messages"])) {$enable_sipsak_messages=$_POST["enable_sipsak_messages"];} +if (isset($_GET["allow_sipsak_messages"])) {$allow_sipsak_messages=$_GET["allow_sipsak_messages"];} + elseif (isset($_POST["allow_sipsak_messages"])) {$allow_sipsak_messages=$_POST["allow_sipsak_messages"];} +if (isset($_GET["admin_home_url"])) {$admin_home_url=$_GET["admin_home_url"];} + elseif (isset($_POST["admin_home_url"])) {$admin_home_url=$_POST["admin_home_url"];} +if (isset($_GET["list_order_mix"])) {$list_order_mix=$_GET["list_order_mix"];} + elseif (isset($_POST["list_order_mix"])) {$list_order_mix=$_POST["list_order_mix"];} +if (isset($_GET["vcl_id"])) {$vcl_id=$_GET["vcl_id"];} + elseif (isset($_POST["vcl_id"])) {$vcl_id=$_POST["vcl_id"];} +if (isset($_GET["vcl_name"])) {$vcl_name=$_GET["vcl_name"];} + elseif (isset($_POST["vcl_name"])) {$vcl_name=$_POST["vcl_name"];} +if (isset($_GET["list_mix_container"])) {$list_mix_container=$_GET["list_mix_container"];} + elseif (isset($_POST["list_mix_container"])) {$list_mix_container=$_POST["list_mix_container"];} +if (isset($_GET["mix_method"])) {$mix_method=$_GET["mix_method"];} + elseif (isset($_POST["mix_method"])) {$mix_method=$_POST["mix_method"];} +if (isset($_GET["human_answered"])) {$human_answered=$_GET["human_answered"];} + elseif (isset($_POST["human_answered"])) {$human_answered=$_POST["human_answered"];} +if (isset($_GET["category"])) {$category=$_GET["category"];} + elseif (isset($_POST["category"])) {$category=$_POST["category"];} +if (isset($_GET["vsc_id"])) {$vsc_id=$_GET["vsc_id"];} + elseif (isset($_POST["vsc_id"])) {$vsc_id=$_POST["vsc_id"];} +if (isset($_GET["vsc_name"])) {$vsc_name=$_GET["vsc_name"];} + elseif (isset($_POST["vsc_name"])) {$vsc_name=$_POST["vsc_name"];} +if (isset($_GET["vsc_description"])) {$vsc_description=$_GET["vsc_description"];} + elseif (isset($_POST["vsc_description"])) {$vsc_description=$_POST["vsc_description"];} +if (isset($_GET["tovdad_display"])) {$tovdad_display=$_GET["tovdad_display"];} + elseif (isset($_POST["tovdad_display"])) {$tovdad_display=$_POST["tovdad_display"];} +if (isset($_GET["mix_container_item"])) {$mix_container_item=$_GET["mix_container_item"];} + elseif (isset($_POST["mix_container_item"])) {$mix_container_item=$_POST["mix_container_item"];} +if (isset($_GET["enable_agc_xfer_log"])) {$enable_agc_xfer_log=$_GET["enable_agc_xfer_log"];} + elseif (isset($_POST["enable_agc_xfer_log"])) {$enable_agc_xfer_log=$_POST["enable_agc_xfer_log"];} +if (isset($_GET["after_hours_action"])) {$after_hours_action=$_GET["after_hours_action"];} + elseif (isset($_POST["after_hours_action"])) {$after_hours_action=$_POST["after_hours_action"];} +if (isset($_GET["after_hours_message_filename"])) {$after_hours_message_filename=$_GET["after_hours_message_filename"];} + elseif (isset($_POST["after_hours_message_filename"])) {$after_hours_message_filename=$_POST["after_hours_message_filename"];} +if (isset($_GET["after_hours_exten"])) {$after_hours_exten=$_GET["after_hours_exten"];} + elseif (isset($_POST["after_hours_exten"])) {$after_hours_exten=$_POST["after_hours_exten"];} +if (isset($_GET["after_hours_voicemail"])) {$after_hours_voicemail=$_GET["after_hours_voicemail"];} + elseif (isset($_POST["after_hours_voicemail"])) {$after_hours_voicemail=$_POST["after_hours_voicemail"];} +if (isset($_GET["welcome_message_filename"])) {$welcome_message_filename=$_GET["welcome_message_filename"];} + elseif (isset($_POST["welcome_message_filename"])) {$welcome_message_filename=$_POST["welcome_message_filename"];} +if (isset($_GET["moh_context"])) {$moh_context=$_GET["moh_context"];} + elseif (isset($_POST["moh_context"])) {$moh_context=$_POST["moh_context"];} +if (isset($_GET["onhold_prompt_filename"])) {$onhold_prompt_filename=$_GET["onhold_prompt_filename"];} + elseif (isset($_POST["onhold_prompt_filename"])) {$onhold_prompt_filename=$_POST["onhold_prompt_filename"];} +if (isset($_GET["prompt_interval"])) {$prompt_interval=$_GET["prompt_interval"];} + elseif (isset($_POST["prompt_interval"])) {$prompt_interval=$_POST["prompt_interval"];} +if (isset($_GET["agent_alert_exten"])) {$agent_alert_exten=$_GET["agent_alert_exten"];} + elseif (isset($_POST["agent_alert_exten"])) {$agent_alert_exten=$_POST["agent_alert_exten"];} +if (isset($_GET["agent_alert_delay"])) {$agent_alert_delay=$_GET["agent_alert_delay"];} + elseif (isset($_POST["agent_alert_delay"])) {$agent_alert_delay=$_POST["agent_alert_delay"];} +if (isset($_GET["group_rank"])) {$group_rank=$_GET["group_rank"];} + elseif (isset($_POST["group_rank"])) {$group_rank=$_POST["group_rank"];} +if (isset($_GET["campaign_allow_inbound"])) {$campaign_allow_inbound=$_GET["campaign_allow_inbound"];} + elseif (isset($_POST["campaign_allow_inbound"])) {$campaign_allow_inbound=$_POST["campaign_allow_inbound"];} +if (isset($_GET["manual_dial_list_id"])) {$manual_dial_list_id=$_GET["manual_dial_list_id"];} + elseif (isset($_POST["manual_dial_list_id"])) {$manual_dial_list_id=$_POST["manual_dial_list_id"];} +if (isset($_GET["campaign_rank"])) {$campaign_rank=$_GET["campaign_rank"];} + elseif (isset($_POST["campaign_rank"])) {$campaign_rank=$_POST["campaign_rank"];} +if (isset($_GET["source_campaign_id"])) {$source_campaign_id=$_GET["source_campaign_id"];} + elseif (isset($_POST["source_campaign_id"])) {$source_campaign_id=$_POST["source_campaign_id"];} +if (isset($_GET["source_user_id"])) {$source_user_id=$_GET["source_user_id"];} + elseif (isset($_POST["source_user_id"])) {$source_user_id=$_POST["source_user_id"];} +if (isset($_GET["source_group_id"])) {$source_group_id=$_GET["source_group_id"];} + elseif (isset($_POST["source_group_id"])) {$source_group_id=$_POST["source_group_id"];} +if (isset($_GET["default_xfer_group"])) {$default_xfer_group=$_GET["default_xfer_group"];} + elseif (isset($_POST["default_xfer_group"])) {$default_xfer_group=$_POST["default_xfer_group"];} + + + if (isset($script_id)) {$script_id= strtoupper($script_id);} + if (isset($lead_filter_id)) {$lead_filter_id = strtoupper($lead_filter_id);} + +if (strlen($dial_status) > 0) + { + $ADD='28'; + $status = $dial_status; + } + +###################################################################################################### +###################################################################################################### +####### Form variable filtering for security and data integrity +###################################################################################################### +###################################################################################################### + +if ($non_latin < 1) +{ +### DIGITS ONLY ### +$adaptive_dropped_percentage = ereg_replace("[^0-9]","",$adaptive_dropped_percentage); +$adaptive_latest_server_time = ereg_replace("[^0-9]","",$adaptive_latest_server_time); +$admin_hangup_enabled = ereg_replace("[^0-9]","",$admin_hangup_enabled); +$admin_hijack_enabled = ereg_replace("[^0-9]","",$admin_hijack_enabled); +$admin_monitor_enabled = ereg_replace("[^0-9]","",$admin_monitor_enabled); +$AFLogging_enabled = ereg_replace("[^0-9]","",$AFLogging_enabled); +$agent_choose_ingroups = ereg_replace("[^0-9]","",$agent_choose_ingroups); +$agentcall_manual = ereg_replace("[^0-9]","",$agentcall_manual); +$agentonly_callbacks = ereg_replace("[^0-9]","",$agentonly_callbacks); +$AGI_call_logging_enabled = ereg_replace("[^0-9]","",$AGI_call_logging_enabled); +$allcalls_delay = ereg_replace("[^0-9]","",$allcalls_delay); +$alter_agent_interface_options = ereg_replace("[^0-9]","",$alter_agent_interface_options); +$am_message_exten = ereg_replace("[^0-9]","",$am_message_exten); +$answer_transfer_agent = ereg_replace("[^0-9]","",$answer_transfer_agent); +$ast_admin_access = ereg_replace("[^0-9]","",$ast_admin_access); +$ast_delete_phones = ereg_replace("[^0-9]","",$ast_delete_phones); +$attempt_delay = ereg_replace("[^0-9]","",$attempt_delay); +$attempt_maximum = ereg_replace("[^0-9]","",$attempt_maximum); +$auto_dial_next_number = ereg_replace("[^0-9]","",$auto_dial_next_number); +$balance_trunks_offlimits = ereg_replace("[^0-9]","",$balance_trunks_offlimits); +$call_parking_enabled = ereg_replace("[^0-9]","",$call_parking_enabled); +$CallerID_popup_enabled = ereg_replace("[^0-9]","",$CallerID_popup_enabled); +$campaign_detail = ereg_replace("[^0-9]","",$campaign_detail); +$campaign_rec_exten = ereg_replace("[^0-9]","",$campaign_rec_exten); +$campaign_vdad_exten = ereg_replace("[^0-9]","",$campaign_vdad_exten); +$change_agent_campaign = ereg_replace("[^0-9]","",$change_agent_campaign); +$closer_default_blended = ereg_replace("[^0-9]","",$closer_default_blended); +$conf_exten = ereg_replace("[^0-9]","",$conf_exten); +$conf_on_extension = ereg_replace("[^0-9]","",$conf_on_extension); +$conferencing_enabled = ereg_replace("[^0-9]","",$conferencing_enabled); +$ct_default_start = ereg_replace("[^0-9]","",$ct_default_start); +$ct_default_stop = ereg_replace("[^0-9]","",$ct_default_stop); +$ct_friday_start = ereg_replace("[^0-9]","",$ct_friday_start); +$ct_friday_stop = ereg_replace("[^0-9]","",$ct_friday_stop); +$ct_monday_start = ereg_replace("[^0-9]","",$ct_monday_start); +$ct_monday_stop = ereg_replace("[^0-9]","",$ct_monday_stop); +$ct_saturday_start = ereg_replace("[^0-9]","",$ct_saturday_start); +$ct_saturday_stop = ereg_replace("[^0-9]","",$ct_saturday_stop); +$ct_sunday_start = ereg_replace("[^0-9]","",$ct_sunday_start); +$ct_sunday_stop = ereg_replace("[^0-9]","",$ct_sunday_stop); +$ct_thursday_start = ereg_replace("[^0-9]","",$ct_thursday_start); +$ct_thursday_stop = ereg_replace("[^0-9]","",$ct_thursday_stop); +$ct_tuesday_start = ereg_replace("[^0-9]","",$ct_tuesday_start); +$ct_tuesday_stop = ereg_replace("[^0-9]","",$ct_tuesday_stop); +$ct_wednesday_start = ereg_replace("[^0-9]","",$ct_wednesday_start); +$ct_wednesday_stop = ereg_replace("[^0-9]","",$ct_wednesday_stop); +$DBX_port = ereg_replace("[^0-9]","",$DBX_port); +$DBY_port = ereg_replace("[^0-9]","",$DBY_port); +$dedicated_trunks = ereg_replace("[^0-9]","",$dedicated_trunks); +$delete_call_times = ereg_replace("[^0-9]","",$delete_call_times); +$delete_campaigns = ereg_replace("[^0-9]","",$delete_campaigns); +$delete_filters = ereg_replace("[^0-9]","",$delete_filters); +$delete_ingroups = ereg_replace("[^0-9]","",$delete_ingroups); +$delete_lists = ereg_replace("[^0-9]","",$delete_lists); +$delete_remote_agents = ereg_replace("[^0-9]","",$delete_remote_agents); +$delete_scripts = ereg_replace("[^0-9]","",$delete_scripts); +$delete_user_groups = ereg_replace("[^0-9]","",$delete_user_groups); +$delete_users = ereg_replace("[^0-9]","",$delete_users); +$dial_timeout = ereg_replace("[^0-9]","",$dial_timeout); +$dialplan_number = ereg_replace("[^0-9]","",$dialplan_number); +$drop_call_seconds = ereg_replace("[^0-9]","",$drop_call_seconds); +$drop_exten = ereg_replace("[^0-9]","",$drop_exten); +$enable_fast_refresh = ereg_replace("[^0-9]","",$enable_fast_refresh); +$enable_persistant_mysql = ereg_replace("[^0-9]","",$enable_persistant_mysql); +$fast_refresh_rate = ereg_replace("[^0-9]","",$fast_refresh_rate); +$hopper_level = ereg_replace("[^0-9]","",$hopper_level); +$hotkey = ereg_replace("[^0-9]","",$hotkey); +$hotkeys_active = ereg_replace("[^0-9]","",$hotkeys_active); +$list_id = ereg_replace("[^0-9]","",$list_id); +$load_leads = ereg_replace("[^0-9]","",$load_leads); +$max_vicidial_trunks = ereg_replace("[^0-9]","",$max_vicidial_trunks); +$modify_call_times = ereg_replace("[^0-9]","",$modify_call_times); +$modify_users = ereg_replace("[^0-9]","",$modify_users); +$modify_campaigns = ereg_replace("[^0-9]","",$modify_campaigns); +$modify_lists = ereg_replace("[^0-9]","",$modify_lists); +$modify_scripts = ereg_replace("[^0-9]","",$modify_scripts); +$modify_filters = ereg_replace("[^0-9]","",$modify_filters); +$modify_ingroups = ereg_replace("[^0-9]","",$modify_ingroups); +$modify_usergroups = ereg_replace("[^0-9]","",$modify_usergroups); +$modify_remoteagents = ereg_replace("[^0-9]","",$modify_remoteagents); +$modify_servers = ereg_replace("[^0-9]","",$modify_servers); +$view_reports = ereg_replace("[^0-9]","",$view_reports); +$modify_leads = ereg_replace("[^0-9]","",$modify_leads); +$monitor_prefix = ereg_replace("[^0-9]","",$monitor_prefix); +$number_of_lines = ereg_replace("[^0-9]","",$number_of_lines); +$old_conf_exten = ereg_replace("[^0-9]","",$old_conf_exten); +$outbound_cid = ereg_replace("[^0-9]","",$outbound_cid); +$park_ext = ereg_replace("[^0-9]","",$park_ext); +$park_on_extension = ereg_replace("[^0-9]","",$park_on_extension); +$phone_number = ereg_replace("[^0-9]","",$phone_number); +$QUEUE_ACTION_enabled = ereg_replace("[^0-9]","",$QUEUE_ACTION_enabled); +$recording_exten = ereg_replace("[^0-9]","",$recording_exten); +$remote_agent_id = ereg_replace("[^0-9]","",$remote_agent_id); +$safe_harbor_exten = ereg_replace("[^0-9]","",$safe_harbor_exten); +$telnet_port = ereg_replace("[^0-9]","",$telnet_port); +$updater_check_enabled = ereg_replace("[^0-9]","",$updater_check_enabled); +$user_level = ereg_replace("[^0-9]","",$user_level); +$user_start = ereg_replace("[^0-9]","",$user_start); +$user_switching_enabled = ereg_replace("[^0-9]","",$user_switching_enabled); +$VDstop_rec_after_each_call = ereg_replace("[^0-9]","",$VDstop_rec_after_each_call); +$VICIDIAL_park_on_extension = ereg_replace("[^0-9]","",$VICIDIAL_park_on_extension); +$vicidial_recording = ereg_replace("[^0-9]","",$vicidial_recording); +$vicidial_transfers = ereg_replace("[^0-9]","",$vicidial_transfers); +$voicemail_button_enabled = ereg_replace("[^0-9]","",$voicemail_button_enabled); +$voicemail_dump_exten = ereg_replace("[^0-9]","",$voicemail_dump_exten); +$voicemail_ext = ereg_replace("[^0-9]","",$voicemail_ext); +$voicemail_exten = ereg_replace("[^0-9]","",$voicemail_exten); +$voicemail_id = ereg_replace("[^0-9]","",$voicemail_id); +$wrapup_seconds = ereg_replace("[^0-9]","",$wrapup_seconds); +$use_non_latin = ereg_replace("[^0-9]","",$use_non_latin); +$webroot_writable = ereg_replace("[^0-9]","",$webroot_writable); +$enable_queuemetrics_logging = ereg_replace("[^0-9]","",$enable_queuemetrics_logging); +$enable_sipsak_messages = ereg_replace("[^0-9]","",$enable_sipsak_messages); +$allow_sipsak_messages = ereg_replace("[^0-9]","",$allow_sipsak_messages); +$mix_container_item = ereg_replace("[^0-9]","",$mix_container_item); +$prompt_interval = ereg_replace("[^0-9]","",$prompt_interval); +$agent_alert_delay = ereg_replace("[^0-9]","",$agent_alert_delay); +$manual_dial_list_id = ereg_replace("[^0-9]","",$manual_dial_list_id); + +### DIGITS and DASHES +$group_rank = ereg_replace("[^-0-9]","",$group_rank); +$campaign_rank = ereg_replace("[^-0-9]","",$campaign_rank); + +### Y or N ONLY ### +$active = ereg_replace("[^NY]","",$active); +$allow_closers = ereg_replace("[^NY]","",$allow_closers); +$reset_hopper = ereg_replace("[^NY]","",$reset_hopper); +$amd_send_to_vmx = ereg_replace("[^NY]","",$amd_send_to_vmx); +$alt_number_dialing = ereg_replace("[^NY]","",$alt_number_dialing); +$safe_harbor_message = ereg_replace("[^NY]","",$safe_harbor_message); +$selectable = ereg_replace("[^NY]","",$selectable); +$reset_list = ereg_replace("[^NY]","",$reset_list); +$fronter_display = ereg_replace("[^NY]","",$fronter_display); +$drop_message = ereg_replace("[^NY]","",$drop_message); +$use_internal_dnc = ereg_replace("[^NY]","",$use_internal_dnc); +$omit_phone_code = ereg_replace("[^NY]","",$omit_phone_code); +$available_only_ratio_tally = ereg_replace("[^NY]","",$available_only_ratio_tally); +$sys_perf_log = ereg_replace("[^NY]","",$sys_perf_log); +$vicidial_balance_active = ereg_replace("[^NY]","",$vicidial_balance_active); +$vd_server_logs = ereg_replace("[^NY]","",$vd_server_logs); +$agent_pause_codes_active = ereg_replace("[^NY]","",$agent_pause_codes_active); +$campaign_stats_refresh = ereg_replace("[^NY]","",$campaign_stats_refresh); +$disable_alter_custdata = ereg_replace("[^NY]","",$disable_alter_custdata); +$no_hopper_leads_logins = ereg_replace("[^NY]","",$no_hopper_leads_logins); +$human_answered = ereg_replace("[^NY]","",$human_answered); +$tovdad_display = ereg_replace("[^NY]","",$tovdad_display); +$campaign_allow_inbound = ereg_replace("[^NY]","",$campaign_allow_inbound); + +### ALPHA-NUMERIC ONLY ### +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); +$script_id = ereg_replace("[^0-9a-zA-Z]","",$script_id); +$submit = ereg_replace("[^0-9a-zA-Z]","",$submit); +$campaign_cid = ereg_replace("[^0-9a-zA-Z]","",$campaign_cid); +$get_call_launch = ereg_replace("[^0-9a-zA-Z]","",$get_call_launch); +$campaign_recording = ereg_replace("[^0-9a-zA-Z]","",$campaign_recording); +$ADD = ereg_replace("[^0-9a-zA-Z]","",$ADD); +$dial_prefix = ereg_replace("[^0-9a-zA-Z]","",$dial_prefix); +$state_call_time_state = ereg_replace("[^0-9a-zA-Z]","",$state_call_time_state); +$scheduled_callbacks = ereg_replace("[^0-9a-zA-Z]","",$scheduled_callbacks); +$concurrent_transfers = ereg_replace("[^0-9a-zA-Z]","",$concurrent_transfers); +$billable = ereg_replace("[^0-9a-zA-Z]","",$billable); +$pause_code = ereg_replace("[^0-9a-zA-Z]","",$pause_code); +$vicidial_recording_override = ereg_replace("[^0-9a-zA-Z]","",$vicidial_recording_override); +$queuemetrics_log_id = ereg_replace("[^0-9a-zA-Z]","",$queuemetrics_log_id); +$after_hours_action = ereg_replace("[^0-9a-zA-Z]","",$after_hours_action); +$after_hours_exten = ereg_replace("[^0-9a-zA-Z]","",$after_hours_exten); +$after_hours_voicemail = ereg_replace("[^0-9a-zA-Z]","",$after_hours_voicemail); + +### DIGITS and Dots +$server_ip = ereg_replace("[^\.0-9]","",$server_ip); +$auto_dial_level = ereg_replace("[^\.0-9]","",$auto_dial_level); +$adaptive_maximum_level = ereg_replace("[^\.0-9]","",$adaptive_maximum_level); +$phone_ip = ereg_replace("[^\.0-9]","",$phone_ip); +$old_server_ip = ereg_replace("[^\.0-9]","",$old_server_ip); +$computer_ip = ereg_replace("[^\.0-9]","",$computer_ip); +$queuemetrics_server_ip = ereg_replace("[^\.0-9]","",$queuemetrics_server_ip); + +### ALPHA-NUMERIC and spaces and hash and star and comma +$xferconf_a_dtmf = ereg_replace("[^ \,\*\#0-9a-zA-Z]","",$xferconf_a_dtmf); +$xferconf_b_dtmf = ereg_replace("[^ \,\*\#0-9a-zA-Z]","",$xferconf_b_dtmf); + +### ALPHACAPS-NUMERIC +$xferconf_a_number = ereg_replace("[^0-9A-Z]","",$xferconf_a_number); +$xferconf_b_number = ereg_replace("[^0-9A-Z]","",$xferconf_b_number); + +### ALPHA-NUMERIC and underscore and dash +$agi_output = ereg_replace("[^-\_0-9a-zA-Z]","",$agi_output); +$ASTmgrSECRET = ereg_replace("[^-\_0-9a-zA-Z]","",$ASTmgrSECRET); +$ASTmgrUSERNAME = ereg_replace("[^-\_0-9a-zA-Z]","",$ASTmgrUSERNAME); +$ASTmgrUSERNAMElisten = ereg_replace("[^-\_0-9a-zA-Z]","",$ASTmgrUSERNAMElisten); +$ASTmgrUSERNAMEsend = ereg_replace("[^-\_0-9a-zA-Z]","",$ASTmgrUSERNAMEsend); +$ASTmgrUSERNAMEupdate = ereg_replace("[^-\_0-9a-zA-Z]","",$ASTmgrUSERNAMEupdate); +$call_time_id = ereg_replace("[^-\_0-9a-zA-Z]","",$call_time_id); +$campaign_id = ereg_replace("[^-\_0-9a-zA-Z]","",$campaign_id); +$CoNfIrM = ereg_replace("[^-\_0-9a-zA-Z]","",$CoNfIrM); +$DBX_database = ereg_replace("[^-\_0-9a-zA-Z]","",$DBX_database); +$DBX_pass = ereg_replace("[^-\_0-9a-zA-Z]","",$DBX_pass); +$DBX_user = ereg_replace("[^-\_0-9a-zA-Z]","",$DBX_user); +$DBY_database = ereg_replace("[^-\_0-9a-zA-Z]","",$DBY_database); +$DBY_pass = ereg_replace("[^-\_0-9a-zA-Z]","",$DBY_pass); +$DBY_user = ereg_replace("[^-\_0-9a-zA-Z]","",$DBY_user); +$dial_method = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_method); +$dial_status_a = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status_a); +$dial_status_b = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status_b); +$dial_status_c = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status_c); +$dial_status_d = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status_d); +$dial_status_e = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status_e); +$ext_context = ereg_replace("[^-\_0-9a-zA-Z]","",$ext_context); +$group_id = ereg_replace("[^-\_0-9a-zA-Z]","",$group_id); +$lead_filter_id = ereg_replace("[^-\_0-9a-zA-Z]","",$lead_filter_id); +$local_call_time = ereg_replace("[^-\_0-9a-zA-Z]","",$local_call_time); +$login = ereg_replace("[^-\_0-9a-zA-Z]","",$login); +$login_campaign = ereg_replace("[^-\_0-9a-zA-Z]","",$login_campaign); +$login_pass = ereg_replace("[^-\_0-9a-zA-Z]","",$login_pass); +$login_user = ereg_replace("[^-\_0-9a-zA-Z]","",$login_user); +$next_agent_call = ereg_replace("[^-\_0-9a-zA-Z]","",$next_agent_call); +$old_campaign_id = ereg_replace("[^-\_0-9a-zA-Z]","",$old_campaign_id); +$old_server_id = ereg_replace("[^-\_0-9a-zA-Z]","",$old_server_id); +$OLDuser_group = ereg_replace("[^-\_0-9a-zA-Z]","",$OLDuser_group); +$park_file_name = ereg_replace("[^-\_0-9a-zA-Z]","",$park_file_name); +$pass = ereg_replace("[^-\_0-9a-zA-Z]","",$pass); +$phone_login = ereg_replace("[^-\_0-9a-zA-Z]","",$phone_login); +$phone_pass = ereg_replace("[^-\_0-9a-zA-Z]","",$phone_pass); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$protocol = ereg_replace("[^-\_0-9a-zA-Z]","",$protocol); +$server_id = ereg_replace("[^-\_0-9a-zA-Z]","",$server_id); +$stage = ereg_replace("[^-\_0-9a-zA-Z]","",$stage); +$state_rule = ereg_replace("[^-\_0-9a-zA-Z]","",$state_rule); +$status = ereg_replace("[^-\_0-9a-zA-Z]","",$status); +$trunk_restriction = ereg_replace("[^-\_0-9a-zA-Z]","",$trunk_restriction); +$user = ereg_replace("[^-\_0-9a-zA-Z]","",$user); +$user_group = ereg_replace("[^-\_0-9a-zA-Z]","",$user_group); +$VICIDIAL_park_on_filename = ereg_replace("[^-\_0-9a-zA-Z]","",$VICIDIAL_park_on_filename); +$auto_alt_dial = ereg_replace("[^-\_0-9a-zA-Z]","",$auto_alt_dial); +$dial_status = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status); +$queuemetrics_eq_prepend = ereg_replace("[^-\_0-9a-zA-Z]","",$queuemetrics_eq_prepend); +$vicidial_agent_disable = ereg_replace("[^-\_0-9a-zA-Z]","",$vicidial_agent_disable); +$alter_custdata_override = ereg_replace("[^-\_0-9a-zA-Z]","",$alter_custdata_override); +$list_order_mix = ereg_replace("[^-\_0-9a-zA-Z]","",$list_order_mix); +$vcl_id = ereg_replace("[^-\_0-9a-zA-Z]","",$vcl_id); +$mix_method = ereg_replace("[^-\_0-9a-zA-Z]","",$mix_method); +$category = ereg_replace("[^-\_0-9a-zA-Z]","",$category); +$vsc_id = ereg_replace("[^-\_0-9a-zA-Z]","",$vsc_id); +$moh_context = ereg_replace("[^-\_0-9a-zA-Z]","",$moh_context); +$agent_alert_exten = ereg_replace("[^-\_0-9a-zA-Z]","",$agent_alert_exten); +$source_campaign_id = ereg_replace("[^-\_0-9a-zA-Z]","",$source_campaign_id); +$source_user_id = ereg_replace("[^-\_0-9a-zA-Z]","",$source_user_id); +$source_group_id = ereg_replace("[^-\_0-9a-zA-Z]","",$source_group_id); +$default_xfer_group = ereg_replace("[^-\_0-9a-zA-Z]","",$default_xfer_group); + +### ALPHA-NUMERIC and spaces +$lead_order = ereg_replace("[^ 0-9a-zA-Z]","",$lead_order); +### ALPHA-NUMERIC and hash +$group_color = ereg_replace("[^\#0-9a-zA-Z]","",$group_color); + +### ALPHA-NUMERIC and spaces dots, commas, dashes, underscores +$adaptive_dl_diff_target = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$adaptive_dl_diff_target); +$adaptive_intensity = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$adaptive_intensity); +$asterisk_version = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$asterisk_version); +$call_time_comments = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$call_time_comments); +$call_time_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$call_time_name); +$campaign_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$campaign_name); +$campaign_rec_filename = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$campaign_rec_filename); +$company = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$company); +$full_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$full_name); +$fullname = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$fullname); +$group_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$group_name); +$HKstatus = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$HKstatus); +$lead_filter_comments = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$lead_filter_comments); +$lead_filter_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$lead_filter_name); +$list_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$list_name); +$local_gmt = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$local_gmt); +$phone_type = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$phone_type); +$picture = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$picture); +$script_comments = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$script_comments); +$script_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$script_name); +$server_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$server_description); +$status = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$status); +$status_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$status_name); +$wrapup_message = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$wrapup_message); +$pause_code_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$pause_code_name); +$campaign_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$campaign_description); +$list_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$list_description); +$vcl_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$vcl_name); +$vsc_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$vsc_name); +$vsc_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$vsc_description); + +### ALPHA-NUMERIC and underscore and dash and slash and at and dot +$call_out_number_group = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$call_out_number_group); +$client_browser = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$client_browser); +$DBX_server = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$DBX_server); +$DBY_server = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$DBY_server); +$dtmf_send_extension = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$dtmf_send_extension); +$extension = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$extension); +$install_directory = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$install_directory); +$old_extension = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$old_extension); +$telnet_host = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$telnet_host); +$queuemetrics_dbname = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$queuemetrics_dbname); +$queuemetrics_login = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$queuemetrics_login); +$queuemetrics_pass = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$queuemetrics_pass); +$after_hours_message_filename = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$after_hours_message_filename); +$welcome_message_filename = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$welcome_message_filename); +$onhold_prompt_filename = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$onhold_prompt_filename); + +### remove semi-colons ### +$lead_filter_sql = ereg_replace(";","",$lead_filter_sql); +$list_mix_container = ereg_replace(";","",$list_mix_container); + +### VARIABLES TO BE mysql_real_escape_string ### +# $web_form_address +# $queuemetrics_url +# $admin_home_url + +### VARIABLES not filtered at all ### +# $script_text + +} # end of non_latin + + +##### END VARIABLE FILTERING FOR SECURITY ##### + + +# AST GUI database administration +# admin.php +# +# CHANGELOG: +# 50315-1110 - Added Custom Campaign Statuses +# 50317-1438 - Added Fronter Display var to inbound groups +# 50322-1355 - Added custom callerID per campaign +# 50517-1356 - Added user_groups sections and user_group to vicidial_users +# 50517-1440 - Added ability to logout (must click OK with empty user/pass) +# 50602-1622 - Added lead loader pages to load new files into vicidial_list +# 50620-1351 - Added custom vdad transfer AGI extension per campaign +# 50810-1414 - modified in groups to kick out spaces and dashes +# 50908-2136 - Added Custom Campaign HotKeys +# 50914-0950 - Fixed user search by user_group +# 50926-1358 - Modified to allow for language translation +# 50926-1615 - Added WeBRooTWritablE write controls +# 51020-1008 - Added editable web address and park ext - NEW dial campaigns +# 51020-1056 - Added fields and help for campaign recording control +# 51123-1335 - Altered code to function in php globals=off +# 51208-1038 - Added user_level changes, function controls and default user phones +# 51208-1556 - Added deletion of users/lists/campaigns/in groups/remote agents +# 51213-1706 - Added add/delete/modify vicidial scripts +# 51214-1737 - Added preview of vicidial script in popup window +# 51219-1225 - Added campaign and ingroups script selector and get_call_launch field +# 51222-1055 - Added am_message_exten to campaigns to allow for AM Message button +# 51222-1125 - Fixed new vicidial_campaigns default values not being assigned bug +# 51222-1156 - Added LOG OUT ALL AGENTS ON THIS CAMPAIGN button to campaign screen +# 60204-0659 - Fixed hopper reset bug +# 60207-1413 - Added AMD send to voicemail extension and xfer-conf dtmf presets +# 60213-1100 - Added several vicidial_users permissions fields +# 60215-1319 - Added On-hold CallBacks display and links +# 60227-1226 - Fixed vicidial_inbound_groups insert bug +# 60413-1308 - Fixed list display to have 1 row/status: count and time zone tables +# - Added status name in selected dial statuses in campaign screen +# 60417-1416 - Added vicidial_lead_filters sections +# - Changed the header links to color-coded sectional with sublinks below +# - Added filter name and script name to campaign and in-group modify sections +# - Added callback and alt dial options to campaigns section +# - Added callback, alt dial and other options to users section +# 60419-1628 - Alter Callbacks display to include status and LIVE listings, reordered +# 60421-1441 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60425-2355 - Added agent options to vicidial_users, reformatted user page +# 60502-1627 - Added drop_call_seconds and safe_harbor_ fields to campaign screen +# 60503-1228 - Added drop_call_seconds and drop_ fields to inbound groups screen +# 60505-1117 - Added initial framework for new local_call_times tables and definitions +# 60506-1033 - More revisions to the local_call_time section +# 60508-1354 - Finished call_times and state_call_times sections +# - Added modify/delete options for call_times +# 60509-1311 - Functionalize campaign dialable leads calculation +# - Change state_call_times selection from call_times to only allow one per state +# - Added dialable leads count popup to campaign screen if auto-calc is disabled +# - Added test dialable leads count popup to filter screen +# 60510-1050 - Added Wrapup seconds and Wrapup message to campaigns screen +# 60608-1401 - Added allowable inbound_groups checkboxes to CLOSER campaign detail screen +# 60609-1051 - Added add-to-dnc in LISTS section +# 60613-1415 - Added lead recycling options to campaign detail screen +# 60619-1523 - Added variable filtering to eliminate SQL injection attack threat +# 60622-1216 - Fixed HotKey addition form issues and variable filtering +# 60623-1159 - Fixed Scheduled Callbacks over-filtering bug and filter_sql bug +# 60808-1147 - Changed filtering for and added instructions for consutative transfers +# 60816-1552 - Added allcalls_delay start delay for recordings in vicidial.php +# 60817-2226 - Fixed bug that would not allow lead recycling of non-selectable statuses +# 60821-1543 - Added option to Omit Phone Code while dialing in vicidial +# 60821-1625 - Added ALLFORCE recording option for campaign_recording +# 60823-1154 - Added fields for adaptive dialing +# 60824-1326 - Added adaptive_latest_target_gmt for ADAPT_TAPERED dial method +# 60825-1205 - Added adaptive_intensity for ADAPT_ dial methods +# 60828-1019 - Changed adaptive_latest_target_gmt to adaptive_latest_server_time +# 60828-1115 - Added adaptive_dl_diff_target and changed intensity dropdown +# 60927-1246 - Added astguiclient/admin.php functions under SERVERS tab +# 61002-1402 - Added fields for vicidial balance trunk controls +# 61003-1123 - Added functions for vicidial_server_trunks records +# 61109-1022 - Added Emergency VDAC Jam Clear function to Campaign Detail screen +# 61110-1502 - Add ability to select NONE in dial statuses, new list_id must not be < 100 +# 61122-1228 - Added user group campaign restrictions +# 61122-1535 - Changed script_text to unfiltered and added more variables to SCRIPTS +# 61129-1028 - Added headers to Users and Phones with clickable order-by titles +# 70108-1405 - Added ADAPT OVERRIDE to allow for forced dial_level changes in ADAPT dial methods +# - Screen width definable at top of script, merged server_stats into this script +# 70109-1638 - Added ALTPH2 and ADDR3 hotkey options for alt number dialing with HotKeys +# 70109-1716 - Added concurrent_transfers option to vicidial_campaigns +# 70115-1152 - Aded (CLOSER|BLEND|INBND|_C$|_B$|_I$) options for CLOSER-type campaigns +# 70115-1532 - Added auto_alt_dial field to campaign screen for auto-dialing of alt numbers +# 70116-1200 - Added auto_alt_dial_status functionality to campaign screen +# 70117-1235 - Added header formatting variables at top of script +# - Moved Call Times and Phones/Server functions to Admin section +# 70118-1706 - Added new user group displays and links +# 70123-1519 - Added user permission settings for all sections +# 70124-1346 - Fixed spelling errors and formatting consistency +# 70202-1120 - Added agent_pause_codes section to campaigns +# 70205-1204 - Added memo, last dialed, timestamp and stats-refresh fields to vicidial_campaigns/lists +# 70206-1323 - Added user setting for vicidial_recording_override +# 70212-1412 - Added system settings section +# 70214-1226 - Added QueueMetrics Log ID field to system settings section +# 70219-1102 - Changed campaign dial statuses to be one string allowing for high limit +# 70223-0957 - Added queuemetrics_eq_prepend for custom ENTERQUEUE prepending of a field +# 70302-1111 - Fixed small bug in dialable leads calculation +# 70314-1133 - Added insert selection on script forms +# 70319-1423 - Added Alter Customer Data and agent disable display functions +# 70319-1625 - Added option to allow agents to login to outbound campaigns with no leads in the hopper +# 70322-1455 - Added sipsak messages parameters +# 70402-1157 - Added HOME link and entry to system_settings table, added QM link on reports section +# 70516-1628 - Started reformatting campaigns to use submenus to break up options +# 70529-1653 - Added help for list mix +# 70530-1354 - Added human_answered field to statuses, added system status modification +# 70530-1714 - Added lists for all campaign subsections +# 70531-1631 - Development on List mix admin interface +# 70601-1629 - More development on List mix admin interface, formatting, and added some javascript +# 70602-1300 - More development on List mix admin interface, more javascript +# 70608-1459 - Added option to set LIVE Callbacks to INACTIVE after one month +# 70612-1451 - Added Callback INACTIVE link for after one week, sort by user/group/entrydate +# 70614-0231 - Added Status Categories, ability to Modify Statuses, moved system statuses to sub-section +# 70623-1008 - List Mix section now allows modification of list mix entries +# 70629-1721 - List Mix section adding and removing of list entries active +# 70706-1636 - List Mix section cleanup and more error-checking +# 70908-0941 - Added agc logile enable system_settings +# 71020-1934 - Added inbound groups options: on-hold music, messages, call_times +# 71022-1343 - Added inbound group ranks for users +# 71029-1710 - Added option for campaign to be inbound and/or blended with no restrictions on the campaign_id name +# - Added 5th NEW and 6th NEW to the dial order options +# 71030-2010 - Added Manual Dial List ID field to campaigns table +# 71103-2207 - Added inbound_group_rank and fewest_calls to the inbound groups call order options +# 71113-1521 - Added campaign_rank to agent options +# - Added ability to Copy a campaign's setting to a new campaign +# 71113-2225 - Added ability to copy user and in-group settings to new users and in-groups +# 71116-0942 - Added campaign_rank and fewest_calls as methods for agent call routing +# 71122-1135 - Added default transfer group for campaigns and inbound groups +# 71125-1751 - Added allowable transfer groups to campaign detail screen +# +# +# make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time + +$admin_version = '2.0.4-119'; +$build = '71125-1751'; + +$STARTtime = date("U"); +$SQLdate = date("Y-m-d H:i:s"); +$MT[0]=''; +$US='_'; + +$month_old = mktime(0, 0, 0, date("m")-1, date("d"), date("Y")); +$past_month_date = date("Y-m-d H:i:s",$month_old); +$week_old = mktime(0, 0, 0, date("m"), date("d")-7, date("Y")); +$past_week_date = date("Y-m-d H:i:s",$week_old); + +if ($force_logout) +{ + if( (strlen($PHP_AUTH_USER)>0) or (strlen($PHP_AUTH_PW)>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "Έχετε αποσυνδεθεί. Σας ευχαÏιστοÏμε\n"; + exit; +} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or ($auth<1)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT * from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[3]; + $LOGuser_level =$row[4]; + $LOGuser_group =$row[5]; + $LOGdelete_users =$row[8]; + $LOGdelete_user_groups =$row[9]; + $LOGdelete_lists =$row[10]; + $LOGdelete_campaigns =$row[11]; + $LOGdelete_ingroups =$row[12]; + $LOGdelete_remote_agents =$row[13]; + $LOGload_leads =$row[14]; + $LOGcampaign_detail =$row[15]; + $LOGast_admin_access =$row[16]; + $LOGast_delete_phones =$row[17]; + $LOGdelete_scripts =$row[18]; + $LOGdelete_filters =$row[29]; + $LOGalter_agent_interface =$row[30]; + $LOGdelete_call_times =$row[32]; + $LOGmodify_call_times =$row[33]; + $LOGmodify_users =$row[34]; + $LOGmodify_campaigns =$row[35]; + $LOGmodify_lists =$row[36]; + $LOGmodify_scripts =$row[37]; + $LOGmodify_filters =$row[38]; + $LOGmodify_ingroups =$row[39]; + $LOGmodify_usergroups =$row[40]; + $LOGmodify_remoteagents =$row[41]; + $LOGmodify_servers =$row[42]; + $LOGview_reports =$row[43]; + + $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$LOGuser_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGallowed_campaigns =$row[0]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +###################################################################################################### +###################################################################################################### +####### Header settings +###################################################################################################### +###################################################################################################### + + +header ("Content-type: text/html; charset=utf-8"); +echo "\n"; +echo "\n"; +echo "\n"; +echo "ΔΙΑΧΕΙΡΙΣΗ: "; + +if (!isset($ADD)) {$ADD=0;} + +if ($ADD=="1") {$hh='users'; echo "ΠÏόσθεσε Îέο ΧÏήστη";} +if ($ADD=="1A") {$hh='users'; echo "ΧÏήστης αντιγÏάφων";} +if ($ADD==11) {$hh='campaigns'; $sh='basic'; echo "ΠÏόσθεσε Îέα ΕκστÏατεία";} +if ($ADD==12) {$hh='campaigns'; $sh='basic'; echo "ΕκστÏατεία αντιγÏάφων";} +if ($ADD==111) {$hh='lists'; echo "ΠÏόσθεσε Îέα Λίστα";} +if ($ADD==121) {$hh='lists'; echo "ΠÏοσθέστε νέο DNC";} +if ($ADD==1111) {$hh='ingroups'; echo "ΠÏόσθεσε Îέα Εισ-Ομάδα";} +if ($ADD==1211) {$hh='ingroups'; echo "$$$-ΟΜΑΔΑ αντιγÏάφων";} +if ($ADD==11111) {$hh='remoteagent'; echo "ΠÏόσθεσε Îέους ΑπομακÏυσμένους ΧειÏιστές";} +if ($ADD==111111) {$hh='usergroups'; echo "ΠÏόσθεσε Îέα Ομάδα ΧÏηστών";} +if ($ADD==1111111) {$hh='scripts'; echo "ΠÏόσθεσε Îέο Βοηθό";} +if ($ADD==11111111) {$hh='filters'; echo "ΠÏόσθεσε ΦίλτÏο";} +if ($ADD==111111111) {$hh='admin'; $sh='times'; echo "ΠÏόσθεσε Îέο ΧÏόνο Κλήσης";} +if ($ADD==1111111111) {$hh='admin'; $sh='times'; echo "ΠÏόσθεσε Îέο ΧÏόνο Κλήσης Κατάστασης";} +if ($ADD==11111111111) {$hh='admin'; $sh='phones'; echo "ΠΡΟΣΘΕΣΕ ÎΕΟ ΤΗΛΕΦΩÎΟ";} +if ($ADD==111111111111) {$hh='admin'; $sh='server'; echo "ΠΡΟΣΘΕΣΕ ÎΕΟ ΔΙΑΚΟΜΙΣΤΗ";} +if ($ADD==1111111111111) {$hh='admin'; $sh='conference'; echo "ΠΡΟΣΘΕΣΕ ÎΕΑ ΣΥÎΔΙΑΛΕΞΗ";} +if ($ADD==11111111111111) {$hh='admin'; $sh='conference'; echo "ADD NEW VICIDIAL CONFERENCE";} +if ($ADD=="2") {$hh='users'; echo "ΠÏοσθήκη Îέου ΧÏήστη";} +if ($ADD=="2A") {$hh='users'; echo "Îέα αντιγÏαμμένη Ï€Ïοσθήκη χÏηστών";} +if ($ADD==20) {$hh='campaigns'; $sh='basic'; echo "Îέα αντιγÏαμμένη Ï€Ïοσθήκη εκστÏατείας";} +if ($ADD==21) {$hh='campaigns'; $sh='basic'; echo "ΠÏοσθήκη Îέας ΕκστÏατείας";} +if ($ADD==22) {$hh='campaigns'; $sh='status'; echo "ΠÏοσθήκη Îέας Κατάστασης ΕκστÏατείας";} +if ($ADD==23) {$hh='campaigns'; $sh='hotkey'; echo "New ΕκστÏατεία HotKey Addition";} +if ($ADD==25) {$hh='campaigns'; $sh='recycle'; echo "Îέα Ï€Ïοσθήκη Î¿Î´Î·Î³Î¿Ï Î±Î½Î±ÎºÏκλωσης εκστÏατείας";} +if ($ADD==26) {$hh='campaigns'; $sh='autoalt'; echo "Îέα αυτόματη θέση πινάκων ALT";} +if ($ADD==27) {$hh='campaigns'; $sh='pause'; echo "Îέος κώδικας μικÏής διακοπής Ï€ÏακτόÏων";} +if ($ADD==28) {$hh='campaigns'; $sh='dialstat'; echo "Θέση πινάκων εκστÏατείας Ï€Ïοστιθέμενη";} +if ($ADD==29) {$hh='campaigns'; $sh='listmix'; echo "Μίγμα καταλόγων εκστÏατείας Ï€Ïοστιθέμενο";} +if ($ADD==211) {$hh='lists'; echo "ΠÏοσθήκη Îέας Λίστας";} +if ($ADD==2111) {$hh='ingroups'; echo "ΠÏοσθήκη Îέας Εισ-Ομάδας";} +if ($ADD==2011) {$hh='ingroups'; echo "Îέα αντιγÏαμμένη Ï€Ïοσθήκη-ΟΜΑΔΑΣ";} +if ($ADD==21111) {$hh='remoteagent'; echo "ΠÏοσθήκη Îέων ΑπομακÏυσμένων ΧειÏιστών";} +if ($ADD==211111) {$hh='usergroups'; echo "ΠÏοσθήκη Îέας Ομάδας ΧÏηστών";} +if ($ADD==2111111) {$hh='scripts'; echo "Îέα Ï€Ïοσθήκη ΒοηθοÏ";} +if ($ADD==21111111) {$hh='filters'; echo "ΠÏοσθήκη Îέου ΦίλτÏου";} +if ($ADD==211111111) {$hh='admin'; $sh='times'; echo "ΠÏοσθήκη Îέου ΧÏόνου Κλήσης";} +if ($ADD==2111111111) {$hh='admin'; $sh='times'; echo "ΠÏοσθήκη Îέου ΧÏόνου Κλήσης Κατάστασης";} +if ($ADD==21111111111) {$hh='admin'; $sh='phones'; echo "ΠΡΟΣΘΗΚΗ ÎΕΟΥ ΤΗΛΕΦΩÎΟΥ";} +if ($ADD==211111111111) {$hh='admin'; $sh='server'; echo "ΠΡΟΣΘΗΚΗ ÎΕΟΥ ΔΙΑΚΟΜΙΣΤΗ";} +if ($ADD==221111111111) {$hh='admin'; $sh='server'; echo "ΠΡΟΣΘΕΤΕΙ ÎΕΑ ΕΓΓΡΑΦΗ ΕΞΥΠΗΡΕΤΗΤΗ ΚΟΡΜΟΥ";} +if ($ADD==2111111111111) {$hh='admin'; $sh='conference'; echo "ΠΡΟΣΘΗΚΗ ÎΕΑΣ ΣΥÎΔΙΑΛΕΞΗΣ";} +if ($ADD==21111111111111) {$hh='admin'; $sh='conference'; echo "ADDING NEW VICIDIAL CONFERENCE";} +if ($ADD==221111111111111) {$hh='admin'; $sh='status'; echo "ΠΡΟΣΘΗΚΗ ΤΩΠΘΈΣΕΩΠΣΥΣΤΗΜΑΤΩΠVICIDIAL";} +if ($ADD==231111111111111) {$hh='admin'; $sh='status'; echo "ΠΡΟΣΘΗΚΗ ΤΗΣ ΚΑΤΗΓΟΡΊΑΣ ΘΈΣΗΣ VICIDIAL";} +if ($ADD==3) {$hh='users'; echo "ΤÏοποποίηση ΧÏήστη";} +if ($ADD==30) {$hh='campaigns'; echo "ΕκστÏατεία δεν επιτÏέπεται";} +if ($ADD==31) + { + $hh='campaigns'; $sh='detail'; echo "ΤÏοποποίηση ΕκστÏατείας - Detail - $campaign_id"; + if ($SUB==22) {echo " - Statuses";} + if ($SUB==23) {echo " - HotKeys";} + if ($SUB==25) {echo " -Μόλυβδος ανακÏκλωσηςEntries";} + if ($SUB==26) {echo " - Auto Alt Dial Statuses";} + if ($SUB==27) {echo " - Agent Pause Codes";} + if ($SUB==29) {echo " - List Mixes";} + } +if ($ADD==32) {$hh='campaigns'; $sh='status'; echo "Θέσεις εκστÏατείας";} +if ($ADD==33) {$hh='campaigns'; $sh='hotkey'; echo "ΕκστÏατεία HotKeys";} +if ($ADD==34) {$hh='campaigns'; $sh='basic'; echo "ΤÏοποποίηση ΕκστÏατείας - Βασική Επισκόπηση";} +if ($ADD==35) {$hh='campaigns'; $sh='recycle'; echo "ΑνακÏκλωσης καταχωÏήσεις μολÏβδου εκστÏατείας";} +if ($ADD==36) {$hh='campaigns'; $sh='autoalt'; echo "Αυτόματες ALT θέσεις πινάκων εκστÏατείας";} +if ($ADD==37) {$hh='campaigns'; $sh='pause'; echo "Κώδικες μικÏής διακοπής Ï€ÏακτόÏων εκστÏατείας";} +if ($ADD==38) {$hh='campaigns'; $sh='dialstat'; echo "Θέσεις πινάκων εκστÏατείας";} +if ($ADD==39) {$hh='campaigns'; $sh='listmix'; echo "Μίγματα καταλόγων εκστÏατείας";} +if ($ADD==311) {$hh='lists'; echo "ΤÏοποποίηση Λίστας";} +if ($ADD==3111) {$hh='ingroups'; echo "ΤÏοποποίηση Εισ-Ομάδων";} +if ($ADD==31111) {$hh='remoteagent'; echo "ΤÏοποποίηση ΑπομακÏυσμένων ΧειÏιστών";} +if ($ADD==311111) {$hh='usergroups'; echo "ΤÏοποποίηση Ομάδων ΧÏηστών";} +if ($ADD==3111111) {$hh='scripts'; echo "ΤÏοποποιήστε τον Βοηθό";} +if ($ADD==31111111) {$hh='filters'; echo "ΤÏοποποίηση ΦίλτÏου";} +if ($ADD==311111111) {$hh='admin'; $sh='times'; echo "ΤÏοποποίηση ΧÏόνου Κλήσης";} +if ($ADD==321111111) {$hh='admin'; $sh='times'; echo "ΤÏοποποίηση Λίστας ΟÏισμών ΧÏόνου Κλήσης Κατάστασης ";} +if ($ADD==3111111111) {$hh='admin'; $sh='times'; echo "ΤÏοποπίηση ΧÏόνου Κλήσης Κατάστασης";} +if ($ADD==31111111111) {$hh='admin'; $sh='phones'; echo "ΤΡΟΠΟΠΟΙΗΣΕ ΤΗΛΕΦΩÎΟ";} +if ($ADD==311111111111) {$hh='admin'; $sh='server'; echo "ΤΡΟΠΟΠΟΙΗΣΕ ΔΙΑΚΟΜΙΣΤΗ";} +if ($ADD==3111111111111) {$hh='admin'; $sh='conference'; echo "ΤΡΟΠΟΠΟΙΗΣΕ ΣΥÎΔΙΑΛΕΞΗ";} +if ($ADD==31111111111111) {$hh='admin'; $sh='conference'; echo "MODIFY VICIDIAL CONFERENCE";} +if ($ADD==311111111111111) {$hh='admin'; $sh='settings'; echo "ΤΡΟΠΟΠΟΙΗΣΤΕ ΤΙΣ ΤΟΠΟΘΕΤΉΣΕΙΣ ΣΥΣΤΗΜΑΤΩΠVICIDIAL";} +if ($ADD==321111111111111) {$hh='admin'; $sh='status'; echo "ΤΡΟΠΟΠΟΙΗΣΤΕ ΤΙΣ ΘΈΣΕΙΣ ΣΥΣΤΗΜΑΤΩΠVICIDIAL";} +if ($ADD==331111111111111) {$hh='admin'; $sh='status'; echo "ΤΡΟΠΟΠΟΙΗΣΤΕ ΤΗΠΚΑΤΗΓΟΡΊΑ ΘΈΣΗΣ VICIDIAL";} +if ($ADD=="4A") {$hh='users'; echo "ΤÏοποποίηση ΧÏήστη - Admin";} +if ($ADD=="4B") {$hh='users'; echo "ΤÏοποποίηση ΧÏήστη - Admin";} +if ($ADD==4) {$hh='users'; echo "ΤÏοποποίηση ΧÏήστη";} +if ($ADD==41) {$hh='campaigns'; $sh='detail'; echo "ΤÏοποποίηση ΕκστÏατείας";} +if ($ADD==42) {$hh='campaigns'; $sh='status'; echo "ΤÏοποποίηση ΕκστÏατείας Status";} +if ($ADD==43) {$hh='campaigns'; $sh='hotkey'; echo "ΤÏοποποίηση ΕκστÏατείας HotKey";} +if ($ADD==44) {$hh='campaigns'; $sh='basic'; echo "ΤÏοποποίηση ΕκστÏατείας - Βασική Επισκόπηση";} +if ($ADD==45) {$hh='campaigns'; $sh='recycle'; echo "ΤÏοποποιήστε τον οδηγό εκστÏατείας ανακÏκλωσης";} +if ($ADD==47) {$hh='campaigns'; $sh='pause'; echo "ΤÏοποποιήστε τον κώδικα μικÏής διακοπής Ï€ÏακτόÏων";} +if ($ADD==49) {$hh='campaigns'; $sh='listmix'; echo "ΤÏοποποιήστε το μίγμα καταλόγων εκστÏατείας";} +if ($ADD==411) {$hh='lists'; echo "ΤÏοποποίηση Λίστας";} +if ($ADD==4111) {$hh='ingroups'; echo "ΤÏοποποίηση Εισ-Ομάδων";} +if ($ADD==41111) {$hh='remoteagent'; echo "ΤÏοποποίηση ΑπομακÏυσμένων ΧειÏιστών";} +if ($ADD==411111) {$hh='usergroups'; echo "ΤÏοποποίηση Ομάδων ΧÏηστών";} +if ($ADD==4111111) {$hh='scripts'; echo "ΤÏοποποιήστε τον Βοηθό";} +if ($ADD==41111111) {$hh='filters'; echo "ΤÏοποποίηση ΦίλτÏου";} +if ($ADD==411111111) {$hh='admin'; $sh='times'; echo "ΤÏοποποίηση ΧÏόνου Κλήσης";} +if ($ADD==4111111111) {$hh='admin'; $sh='times'; echo "ΤÏοποπίηση ΧÏόνου Κλήσης Κατάστασης";} +if ($ADD==41111111111) {$hh='admin'; $sh='phones'; echo "ΤΡΟΠΟΠΟΙΗΣΕ ΤΗΛΕΦΩÎΟ";} +if ($ADD==411111111111) {$hh='admin'; $sh='server'; echo "ΤΡΟΠΟΠΟΙΗΣΕ ΔΙΑΚΟΜΙΣΤΗ";} +if ($ADD==421111111111) {$hh='admin'; $sh='server'; echo "ΤΡΟΠΟΠΟΙΗΣΗ ΕΓΓΡΑΦΗΣ ΕΞΥΠΗΡΕΤΗΤΗ ΚΟΡΜΟΥ";} +if ($ADD==4111111111111) {$hh='admin'; $sh='conference'; echo "ΤΡΟΠΟΠΟΙΗΣΕ ΣΥÎΔΙΑΛΕΞΗ";} +if ($ADD==41111111111111) {$hh='admin'; $sh='conference'; echo "MODIFY VICIDIAL CONFERENCE";} +if ($ADD==411111111111111) {$hh='admin'; $sh='settings'; echo "ΤΡΟΠΟΠΟΙΗΣΤΕ ΤΙΣ ΤΟΠΟΘΕΤΉΣΕΙΣ ΣΥΣΤΗΜΑΤΩΠVICIDIAL";} +if ($ADD==421111111111111) {$hh='admin'; $sh='status'; echo "ΤΡΟΠΟΠΟΙΗΣΤΕ ΤΙΣ ΘΈΣΕΙΣ ΣΥΣΤΗΜΑΤΩΠVICIDIAL";} +if ($ADD==431111111111111) {$hh='admin'; $sh='status'; echo "ΤΡΟΠΟΠΟΙΗΣΤΕ ΤΙΣ ΚΑΤΗΓΟΡΊΕΣ ΘΈΣΗΣ VICIDIAL";} +if ($ADD==5) {$hh='users'; echo "Delete User";} +if ($ADD==51) {$hh='campaigns'; $sh='detail'; echo "Delete ΕκστÏατεία";} +if ($ADD==52) {$hh='campaigns'; $sh='detail'; echo "Αποσυνδεμένοι ΧειÏιστές";} +if ($ADD==53) {$hh='campaigns'; $sh='detail'; echo "έκτακτης ανάγκης καθαÏÎ¹ÏƒÎ¼Î¿Ï VDAC";} +if ($ADD==511) {$hh='lists'; echo "Delete List";} +if ($ADD==5111) {$hh='ingroups'; echo "Delete In-Group";} +if ($ADD==51111) {$hh='remoteagent'; echo "ΔιάγÏαψε τους ΑπομακÏυσμένους ΧειÏιστές";} +if ($ADD==511111) {$hh='usergroups'; echo "ΔιάγÏαψε τους χÏήστες Group";} +if ($ADD==5111111) {$hh='scripts'; echo "ΔιάγÏαψε τον Βοηθό";} +if ($ADD==51111111) {$hh='filters'; echo "ΔιαγÏαφή ΦίλτÏου";} +if ($ADD==511111111) {$hh='admin'; $sh='times'; echo "ΔιαγÏαφή ΧÏόνου Κλήσης";} +if ($ADD==5111111111) {$hh='admin'; $sh='times'; echo "ΔιαγÏαφή ΧÏόνου Κλήσης Κατάστασης";} +if ($ADD==51111111111) {$hh='admin'; $sh='phones'; echo "DELETE PHONE";} +if ($ADD==511111111111) {$hh='admin'; $sh='server'; echo "DELETE SERVER";} +if ($ADD==5111111111111) {$hh='admin'; $sh='conference'; echo "DELETE CONFERENCE";} +if ($ADD==51111111111111) {$hh='admin'; $sh='conference'; echo "DELETE VICIDIAL CONFERENCE";} +if ($ADD==6) {$hh='users'; echo "Delete User";} +if ($ADD==61) {$hh='campaigns'; $sh='detail'; echo "Delete ΕκστÏατεία";} +if ($ADD==62) {$hh='campaigns'; $sh='detail'; echo "Αποσυνδεμένοι ΧειÏιστές";} +if ($ADD==63) {$hh='campaigns'; $sh='detail'; echo "έκτακτης ανάγκης καθαÏÎ¹ÏƒÎ¼Î¿Ï VDAC";} +if ($ADD==65) {$hh='campaigns'; $sh='recycle'; echo "ΔιαγÏάψτε τον οδηγό ανακÏκλωσης";} +if ($ADD==66) {$hh='campaigns'; $sh='autoalt'; echo "ΔιαγÏάψτε την αυτόματη θέση πινάκων ALT";} +if ($ADD==67) {$hh='campaigns'; $sh='pause'; echo "ΔιαγÏάψτε τον κώδικα μικÏής διακοπής Ï€ÏακτόÏων";} +if ($ADD==68) {$hh='campaigns'; $sh='dialstat'; echo "Θέση πινάκων εκστÏατείας αφαιÏοÏμενη";} +if ($ADD==69) {$hh='campaigns'; $sh='listmix'; echo "Μίγμα καταλόγων εκστÏατείας αφαιÏοÏμενο";} +if ($ADD==611) {$hh='lists'; echo "Delete List";} +if ($ADD==6111) {$hh='ingroups'; echo "Delete In-Group";} +if ($ADD==61111) {$hh='remoteagent'; echo "ΔιάγÏαψε τους ΑπομακÏυσμένους ΧειÏιστές";} +if ($ADD==611111) {$hh='usergroups'; echo "ΔιάγÏαψε τους χÏήστες Group";} +if ($ADD==6111111) {$hh='scripts'; echo "ΔιάγÏαψε τον Βοηθό";} +if ($ADD==61111111) {$hh='filters'; echo "ΔιαγÏαφή ΦίλτÏου";} +if ($ADD==611111111) {$hh='admin'; $sh='times'; echo "ΔιαγÏαφή ΧÏόνου Κλήσης";} +if ($ADD==6111111111) {$hh='admin'; $sh='times'; echo "ΔιαγÏαφή ΧÏόνου Κλήσης Κατάστασης";} +if ($ADD==61111111111) {$hh='admin'; $sh='phones'; echo "DELETE PHONE";} +if ($ADD==611111111111) {$hh='admin'; $sh='server'; echo "DELETE SERVER";} +if ($ADD==621111111111) {$hh='admin'; $sh='server'; echo "ΔΙΑΓΡΑΦΗ ΕΓΓΡΑΦΗΣ ΕΞΥΠΗΡΕΤΗΤΗ ΚΟΡΜΟΥ";} +if ($ADD==6111111111111) {$hh='admin'; $sh='conference'; echo "DELETE CONFERENCE";} +if ($ADD==61111111111111) {$hh='admin'; $sh='conference'; echo "DELETE VICIDIAL CONFERENCE";} +if ($ADD==73) {$hh='campaigns'; echo "ΜετÏητής Κληθέντων Οδηγών";} +if ($ADD==7111111) {$hh='scripts'; echo "ΠÏοεπισκόπιση ΒοηθοÏ";} +if ($ADD==0) {$hh='users'; echo "Λίστα ΧÏηστών";} +if ($ADD==8) {$hh='users'; echo "Επανακλήσεις μέσα στον χειÏιστή";} +if ($ADD==81) {$hh='campaigns'; $sh='list'; echo "Επανακλήσεις μέσα στην εκστÏατεία";} +if ($ADD==811) {$hh='lists'; echo "Επανακλήσεις μέσα στην λίστα";} +if ($ADD==8111) {$hh='usergroups'; echo "CallBacks μέσα στην ομάδα χÏηστών ";} +if ($ADD==10) {$hh='campaigns'; $sh='list'; echo "ΕκστÏατείες";} +if ($ADD==100) {$hh='lists'; echo "Λίστες";} +if ($ADD==1000) {$hh='ingroups'; echo "Εισ-Ομάδες";} +if ($ADD==10000) {$hh='remoteagent'; echo "ΑπομακÏυσμένοι ΧειÏιστές";} +if ($ADD==100000) {$hh='usergroups'; echo "Ομάδες ΧÏήστη";} +if ($ADD==1000000) {$hh='scripts'; echo "Βοηθοί";} +if ($ADD==10000000) {$hh='filters'; echo "ΦίλτÏα";} +if ($ADD==100000000) {$hh='admin'; $sh='times'; echo "ΧÏόνοι Κλήσεων";} +if ($ADD==1000000000) {$hh='admin'; $sh='times'; echo "";} +if ($ADD==10000000000) {$hh='admin'; $sh='phones'; echo "ΛΙΣΤΑ ΤΗΛΕΦΩÎΟΥ";} +if ($ADD==100000000000) {$hh='admin'; $sh='server'; echo "ΛΙΣΤΑ ΔΙΑΚΟΜΙΣΤΗ";} +if ($ADD==1000000000000) {$hh='admin'; $sh='conference'; echo "ΛΙΣΤΑ ΣΥÎΔΙΑΛΕΞΕΩÎ";} +if ($ADD==10000000000000) {$hh='admin'; $sh='conference'; echo "VICIDIAL ΛΙΣΤΑ ΣΥÎΔΙΑΛΕΞΕΩÎ";} +if ($ADD==550) {$hh='users'; echo "ΦόÏμα Αναζήτησης";} +if ($ADD==551) {$hh='users'; echo "ΑÎΑΖΗΤΗΣΗ ΤΗΛΕΦΩÎΩÎ";} +if ($ADD==660) {$hh='users'; echo "Αποτελέσματα Αναζήτησης";} +if ($ADD==661) {$hh='users'; echo "ΑÎΑΖΗΤΗΣΗ ΑΠΟΤΕΛΕΣΜΑΤΩΠΤΗΛΕΦΩÎΩÎ";} +if ($ADD==99999) {$hh='users'; echo "ΒΟΗΘΕΙΑ";} +if ($ADD==999999) {$hh='reports'; echo "ΑÎΑΦΟΡΕΣ";} + +if ( ($ADD>9) && ($ADD < 99998) ) + { + ##### get scripts listing for dynamic pulldown + $stmt="SELECT script_id,script_name from vicidial_scripts order by script_id"; + $rslt=mysql_query($stmt, $link); + $scripts_to_print = mysql_num_rows($rslt); + $scripts_list="<option value=\"\">NONE</option>\n"; + + $o=0; + while ($scripts_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $scripts_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $scriptname_list["$rowx[0]"] = "$rowx[1]"; + $o++; + } + + ##### get filters listing for dynamic pulldown + $stmt="SELECT lead_filter_id,lead_filter_name,lead_filter_sql from vicidial_lead_filters order by lead_filter_id"; + $rslt=mysql_query($stmt, $link); + $filters_to_print = mysql_num_rows($rslt); + $filters_list="<option value=\"\">NONE</option>\n"; + + $o=0; + while ($filters_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $filters_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $filtername_list["$rowx[0]"] = "$rowx[1]"; + $filtersql_list["$rowx[0]"] = "$rowx[2]"; + $o++; + } + + ##### get call_times listing for dynamic pulldown + $stmt="SELECT call_time_id,call_time_name from vicidial_call_times order by call_time_id"; + $rslt=mysql_query($stmt, $link); + $times_to_print = mysql_num_rows($rslt); + + $o=0; + while ($times_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $call_times_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $call_timename_list["$rowx[0]"] = "$rowx[1]"; + $o++; + } + } + +if ( ( (strlen($ADD)>4) && ($ADD < 99998) ) or ($ADD==3) or (($ADD>20) and ($ADD<70)) or ($ADD=="4A") or ($ADD=="4B") or (strlen($ADD)==12) ) + { + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rslt=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rslt); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $servers_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $o++; + } + + ##### BEGIN get campaigns listing for rankings ##### + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + $campaigns_list=''; + $campaigns_value=''; + $RANKcampaigns_list="<tr><td>CAMPAIGN</td><td>     RANK</td><td>     CALLS</td></tr>\n"; + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $campaigns_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $campaign_id_values[$o] = $rowx[0]; + $campaign_name_values[$o] = $rowx[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + $stmt="SELECT campaign_rank,calls_today from vicidial_campaign_agents where user='$user' and campaign_id='$campaign_id_values[$o]'"; + $rslt=mysql_query($stmt, $link); + $ranks_to_print = mysql_num_rows($rslt); + if ($ranks_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $SELECT_campaign_rank = $row[0]; + $calls_today = $row[1]; + } + else + {$calls_today=0; $SELECT_campaign_rank=0;} + if ( ($ADD=="4A") or ($ADD=="4B") ) + { + if (isset($_GET["RANK_$campaign_id_values[$o]"])) {$campaign_rank=$_GET["RANK_$campaign_id_values[$o]"];} + elseif (isset($_POST["RANK_$campaign_id_values[$o]"])) {$campaign_rank=$_POST["RANK_$campaign_id_values[$o]"];} + + if ($ranks_to_print > 0) + { + $stmt="UPDATE vicidial_campaign_agents set campaign_rank='$campaign_rank', campaign_weight='$campaign_rank' where campaign_id='$campaign_id_values[$o]' and user='$user';"; + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="INSERT INTO vicidial_campaign_agents set campaign_rank='$campaign_rank', campaign_weight='$campaign_rank', campaign_id='$campaign_id_values[$o]', user='$user';"; + $rslt=mysql_query($stmt, $link); + } + + $stmt="UPDATE vicidial_live_agents set campaign_weight='$campaign_rank' where campaign_id='$campaign_id_values[$o]' and user='$user';"; + $rslt=mysql_query($stmt, $link); + } + else {$campaign_rank = $SELECT_campaign_rank;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + # disable non user-group allowable campaign ranks + $stmt="SELECT user_group from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Ruser_group = $row[0]; + + $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$Ruser_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $allowed_campaigns = $row[0]; + $allowed_campaigns = preg_replace("/ -$/","",$allowed_campaigns); + $UGcampaigns = explode(" ", $allowed_campaigns); + + $p=0; $RANK_camp_active=0; $CR_disabled = ''; + if (eregi('-ALL-CAMPAIGNS-',$allowed_campaigns)) + {$RANK_camp_active++;} + else + { + $UGcampaign_ct = count($UGcampaigns); + while ($p < $UGcampaign_ct) + { + if ($campaign_id_values[$o] == $UGcampaigns[$p]) + {$RANK_camp_active++;} + $p++; + } + } + if ($RANK_camp_active < 1) {$CR_disabled = 'DISABLED';} + + $RANKcampaigns_list .= "<tr $bgcolor><td>"; + $campaigns_list .= "<a href=\"$PHP_SELF?ADD=31&campaign_id=$campaign_id_values[$o]\">$campaign_id_values[$o]</a> - $campaign_name_values[$o] <BR>\n"; + $RANKcampaigns_list .= "<a href=\"$PHP_SELF?ADD=31&campaign_id=$campaign_id_values[$o]\">$campaign_id_values[$o]</a> - $campaign_name_values[$o] </td>"; + $RANKcampaigns_list .= "<td>     <select size=1 name=RANK_$campaign_id_values[$o] $CR_disabled>\n"; + $h="9"; + while ($h>=-9) + { + $RANKcampaigns_list .= "<option value=\"$h\""; + if ($h==$campaign_rank) + {$RANKcampaigns_list .= " SELECTED";} + $RANKcampaigns_list .= ">$h</option>"; + $h--; + } + $RANKcampaigns_list .= "</select></td>\n"; + $RANKcampaigns_list .= "<td align=right>     $calls_today</td></tr>\n"; + $o++; + } + ##### END get campaigns listing for rankings ##### + + + ##### BEGIN get inbound groups listing for checkboxes ##### + $xfer_groupsSQL=''; + if ( (($ADD>20) and ($ADD<70)) and ($ADD!=41) ) + { + $stmt="SELECT closer_campaigns,xfer_groups from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + $xfer_groups = $row[1]; + $xfer_groups = preg_replace("/ -$/","",$xfer_groups); + $XFERgroups = explode(" ", $xfer_groups); + $xfer_groupsSQL = preg_replace("/^ | -$/","",$xfer_groups); + $xfer_groupsSQL = preg_replace("/ /","','",$xfer_groupsSQL); + $xfer_groupsSQL = "WHERE group_id IN('$xfer_groupsSQL')"; + } + if ($ADD==41) + { + $p=0; + $XFERgroup_ct = count($XFERgroups); + while ($p < $XFERgroup_ct) + { + $xfer_groups .= " $XFERgroups[$p]"; + $p++; + } + $xfer_groupsSQL = preg_replace("/^ | -$/","",$xfer_groups); + $xfer_groupsSQL = preg_replace("/ /","','",$xfer_groupsSQL); + $xfer_groupsSQL = "WHERE group_id IN('$xfer_groupsSQL')"; + } + + if ( (($ADD==31111) or ($ADD==31111)) and (count($groups)<1) ) + { + $stmt="SELECT closer_campaigns from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + if ($ADD==3) + { + $stmt="SELECT closer_campaigns from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + $stmt="SELECT group_id,group_name from vicidial_inbound_groups order by group_id"; + $rslt=mysql_query($stmt, $link); + $groups_to_print = mysql_num_rows($rslt); + $groups_list=''; + $groups_value=''; + $XFERgroups_list=''; + $RANKgroups_list="<tr><td>INBOUND GROUP</td><td>     RANK</td><td>     CALLS</td></tr>\n"; + + $o=0; + while ($groups_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $group_id_values[$o] = $rowx[0]; + $group_name_values[$o] = $rowx[1]; + $o++; + } + + $o=0; + while ($groups_to_print > $o) + { + $stmt="SELECT group_rank,calls_today from vicidial_inbound_group_agents where user='$user' and group_id='$group_id_values[$o]'"; + $rslt=mysql_query($stmt, $link); + $ranks_to_print = mysql_num_rows($rslt); + if ($ranks_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $SELECT_group_rank = $row[0]; + $calls_today = $row[1]; + } + else + {$calls_today=0; $SELECT_group_rank=0;} + if ( ($ADD=="4A") or ($ADD=="4B") ) + { + if (isset($_GET["RANK_$group_id_values[$o]"])) {$group_rank=$_GET["RANK_$group_id_values[$o]"];} + elseif (isset($_POST["RANK_$group_id_values[$o]"])) {$group_rank=$_POST["RANK_$group_id_values[$o]"];} + + if ($ranks_to_print > 0) + { + $stmt="UPDATE vicidial_inbound_group_agents set group_rank='$group_rank', group_weight='$group_rank' where group_id='$group_id_values[$o]' and user='$user';"; + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="INSERT INTO vicidial_inbound_group_agents set group_rank='$group_rank', group_weight='$group_rank', group_id='$group_id_values[$o]', user='$user';"; + $rslt=mysql_query($stmt, $link); + } + + $stmt="UPDATE vicidial_live_inbound_agents set group_weight='$group_rank' where group_id='$group_id_values[$o]' and user='$user';"; + $rslt=mysql_query($stmt, $link); + } + else {$group_rank = $SELECT_group_rank;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $groups_list .= "<input type=\"checkbox\" name=\"groups[]\" value=\"$group_id_values[$o]\""; + $XFERgroups_list .= "<input type=\"checkbox\" name=\"XFERgroups[]\" value=\"$group_id_values[$o]\""; + $RANKgroups_list .= "<tr $bgcolor><td><input type=\"checkbox\" name=\"groups[]\" value=\"$group_id_values[$o]\""; + $p=0; + $group_ct = count($groups); + while ($p < $group_ct) + { + if ($group_id_values[$o] == $groups[$p]) + { + $groups_list .= " CHECKED"; + $RANKgroups_list .= " CHECKED"; + $groups_value .= " $group_id_values[$o]"; + } + $p++; + } + $p=0; + $XFERgroup_ct = count($XFERgroups); + while ($p < $XFERgroup_ct) + { + if ($group_id_values[$o] == $XFERgroups[$p]) + { + $XFERgroups_list .= " CHECKED"; + $XFERgroups_value .= " $group_id_values[$o]"; + } + $p++; + } + $groups_list .= "> <a href=\"$PHP_SELF?ADD=3111&group_id=$group_id_values[$o]\">$group_id_values[$o]</a> - $group_name_values[$o] <BR>\n"; + $XFERgroups_list .= "> <a href=\"$PHP_SELF?ADD=3111&group_id=$group_id_values[$o]\">$group_id_values[$o]</a> - $group_name_values[$o] <BR>\n"; + $RANKgroups_list .= "> <a href=\"$PHP_SELF?ADD=3111&group_id=$group_id_values[$o]\">$group_id_values[$o]</a> - $group_name_values[$o] </td>"; + $RANKgroups_list .= "<td>     <select size=1 name=RANK_$group_id_values[$o]>\n"; + $h="9"; + while ($h>=-9) + { + $RANKgroups_list .= "<option value=\"$h\""; + if ($h==$group_rank) + {$RANKgroups_list .= " SELECTED";} + $RANKgroups_list .= ">$h</option>"; + $h--; + } + $RANKgroups_list .= "</select></td>\n"; + $RANKgroups_list .= "<td align=right>     $calls_today</td></tr>\n"; + $o++; + } + if (strlen($groups_value)>2) {$groups_value .= " -";} + if (strlen($XFERgroups_value)>2) {$XFERgroups_value .= " -";} + } + ##### END get inbound groups listing for checkboxes ##### + + + ##### BEGIN get campaigns listing for checkboxes ##### + if ( ($ADD==211111) or ($ADD==311111) or ($ADD==411111) or ($ADD==511111) or ($ADD==611111) ) + { + if ( ($ADD==211111) or ($ADD==311111) or ($ADD==511111) or ($ADD==611111) ) + { + $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$user_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $allowed_campaigns = $row[0]; + $allowed_campaigns = preg_replace("/ -$/","",$allowed_campaigns); + $campaigns = explode(" ", $allowed_campaigns); + } + + $campaigns_value=''; + $campaigns_list='<B><input type="checkbox" name="campaigns[]" value="-ALL-CAMPAIGNS-"'; + $p=0; + while ($p<100) + { + if (eregi('ALL-CAMPAIGNS',$campaigns[$p])) + { + $campaigns_list.=" CHECKED"; + $campaigns_value .= " -ALL-CAMPAIGNS- -"; + } + $p++; + } + $campaigns_list.="> ALL-CAMPAIGNS - ΟΙ ΧΡΗΣΤΕΣ ΜΠΟΡΟΥΠÎΑ ΔΟΥΠΟΠΟΙΑΔΗΠΟΤΕ ΕΚΣΤΡΑΤΕΙΑ</B><BR>\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $campaign_id_value = $rowx[0]; + $campaign_name_value = $rowx[1]; + $campaigns_list .= "<input type=\"checkbox\" name=\"campaigns[]\" value=\"$campaign_id_value\""; + $p=0; + while ($p<100) + { + if ($campaign_id_value == $campaigns[$p]) + { + # echo "<!-- X $p|$campaign_id_value|$campaigns[$p]| -->"; + $campaigns_list .= " CHECKED"; + $campaigns_value .= " $campaign_id_value"; + } + # echo "<!-- O $p|$campaign_id_value|$campaigns[$p]| -->"; + $p++; + } + $campaigns_list .= "> $campaign_id_value - $campaign_name_value<BR>\n"; + $o++; + } + if (strlen($campaigns_value)>2) {$campaigns_value .= " -";} + } + ##### END get campaigns listing for checkboxes ##### + + + if ( (strlen($ADD)==11) or (strlen($ADD)>12) ) + { + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rsltx=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rsltx); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $servers_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $o++; + } + } + + + +$NWB = "   <a href=\"javascript:openNewWindow('$PHP_SELF?ADD=99999"; +$NWE = "')\"><IMG SRC=\"help.gif\" WIDTH=20 HEIGHT=20 Border=0 ALT=\"ΒΟΗΘΕΙΑ\" ALIGN=TOP></A>"; + + +###################################################################################################### +###################################################################################################### +####### 9 series, HELP screen +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=99999 display the HELP SCREENS +###################### + +if ($ADD==99999) +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "
ΔΙΑΧΕΙΡΙΣΗ: ΒΟΗΘΕΙΑ


\n"; + +?> +VICIDIAL_ΧΡΗΣΤΕΣ ΠΙÎΑΚΑΣ

+ +
+ID ΧÏήστη - Σε αυτό το πεδίο τοποθετείται ο αÏιθμός ID του χÏήστη, μποÏεί να είναι Î¼ÎµÏ„Î±Î¾Ï 2 και 8 ψηφία. + +
+
+
+Κωδικός - Σε αυτό το πεδίο τοποθετείται ο κωδικός του χÏήστη στο VICIDIAL. ΠÏέπει να είναι τουλάχιστον 2 χαÏακτήÏες. + +
+
+
+ΠλήÏες Ονομα - Αυτό το πεδίο είναι που μποÏείτε να οÏίσετε το πλήÏες όνομα των χÏηστών VICIDIAL. ΠÏέπει να είναι τουλάχιστον 2 χαÏακτήÏες. + +
+
+
+Επίπεδο ΧÏήστη - Αυτός ο κατάλογος επιλογών είναι που μποÏείτε να επιλέξετε το επίπεδο χÏήστη των VICIDIAL χÏηστών. ΠÏέπει να έχει επίπεδο 1 για να συνδεθεί στο σÏστημα. ΠÏέπει να έχει επίπεδο μεγαλÏτεÏο από 2 για να συνδεθεί ως closer. ΠÏέπει να έχει επίπεδο 8 ή μεγαλÏεÏο για ενέÏγειες διαχειÏιστή. + +
+
+
+Ομάδα ΧÏήστη - Αυτός ο κατάλογος επιλογών είναι που μποÏείτε να επιλέξετε την ομάδα χÏηστών που ανήκει ο χÏήστης. + +
+
+
+ΣÏνδεση Τηλεφώνου - εδώ μποÏείτε να θέσετε μία Ï€ÏοκαθοÏισμένη σÏνδεση τηλεφώνου κατά την είσοδο του χειÏιστή στο vicidial.php. + +
+
+
+Κωδικός Τηλεφώνου - εδώ μποÏείτε να θέσετε ένα Ï€ÏοκαθοÏισμένο κωδικό τηλεφώνου κατά την είσοδο του χειÏιστή στο vicidial.php. + +
+
+
+Hot Keys ενεÏγός - εάν θέσετε σε 1 αυτή την επιλογή, επιτÏέπει στο χÏήστη να χÏησιμοποιήσει τα πλήκτÏα γÏήγοÏου τεÏÎ¼Î±Ï„Î¹ÏƒÎ¼Î¿Ï vicidial.php. + +
+
+
+Ο Ï€ÏάκτοÏας επιλέγει Ingroups - εάν θέσετε σε 1 αυτή την επιλογή επιτÏέπει στο χÏήστη να επιλέξει τις εισ-ομάδες που θα λάβουν τις κλήσεις. ΔιαφοÏετικά ο Manager θα Ï€Ïέπει να το θέσει αυτό στην σελίδα διαχείÏισης. + +
+
+
+ΠÏογÏαμματισμένες Επανακλήσεις - Αυτή η επιλογή επιτÏέπει στον χειÏιστή να τεÏματίσει μία κλήση ως CALLBK και να επιλέξει τα δεδομένα και την ÏŽÏα κατά την οποία ο οδηγός θα ξανα-ενεÏγοποιηθεί. + +
+
+
+Μόνο του ΧÏήστη Επανακλήσεις- Αυτή η επιλογή επιτÏέπει στον χÏήστη να θέσει μία επανάκληση με τέτοιο Ï„Ïόπο, ώστε μόνο αυτός να μποÏεί να καλέσει τον πελάτη. Επίσης, επιτÏέπει στον χÏήστη να δει τις λίστες των επανακλήσεων και να τις καλέσει οποιαδήποτε στιγμή. + +
+
+
+ΧειÏοκίνητη Κλήση ΧÏήστη - Αυτή η επιλογή επιτÏέπει στον χειÏιστή να καταχωÏήσει χειÏοκίνητα ένα νέο οδηγό στο σÏστημα και να τον καλέσε. + +
+
+
+ΗχογÏάφηση - Αυτή η επιλογή μποÏεί να απαγοÏεÏσει σε έναν χειÏιστή να κάνει ηχογÏαφήσεις και θα Ï€Ïέπει να ακολουθεί την διαδικασία ηχογÏάφησης της εκστÏατείας. + +
+
+
+ΜεταφοÏές- Αυτή η επιλογή μποÏεί να απαγοÏεÏσει σε έναν χειÏιστή να ανοίξει την διαδικασία μεταφοÏά-συνδιάσκεψη. Αν είναι απενεÏγοποιημένη, ο χÏήστης δεν μποÏεί να μεαφέÏει κλήσεις ή να κάνει κλήση σε Ï„Ïίτο. + +
+
+
+Πιό στενή Ï€Ïοεπιλογή που συνδυάζεται - αυτή η επιλογή Ï€ÏοκαθοÏίζει απλά το συνδυασμένο τετÏαγωνίδιο σε μια ΠΙΟ ΣΤΕÎΉ οθόνη σÏνδεσης. + +
+
+
+VICIDIAL συμπληÏωματική Ï€Ïομήθεια καταγÏαφής - αυτή η επιλογήθα αγνοήσει οποιο δήποτε η επιλογή είναι στην εκστÏατεία για τηνκαταγÏαφή. Τα ΑΤΟΜΑ ΜΕ ΕΙΔΙΚΈΣ ΑÎΑΓΚΕΣ δεν θα αγνοήσουν τηÏÏθμιση καταγÏαφής εκστÏατείας. Δεν θα θέσει εκτός λειτουÏγίαςΠΟΤΕ την καταγÏαφή στον πελάτη. ONDEMAND είναι η Ï€Ïοεπιλογήκαι επιτÏέπει στον Ï€ÏάκτοÏα για να αÏχίσει και να σταματήσει όπωςαπαιτείται. ALLCALLS θα αÏχίσει την καταγÏαφή στον πελάτηόποτε μια κλήση στέλνεται σε έναν Ï€ÏάκτοÏα. ALLFORCE θααÏχίσει την καταγÏαφή στον πελάτη όποτε μια κλήση στέλνεται σεέναν Ï€ÏάκτοÏα που δεν δίνει στον Ï€ÏάκτοÏα καμία επιλογή νασταματήσει. Για ALLCALLS και ALLFORCE υπάÏχει μια επιλογή ναχÏησιμοποιηθεί η καθυστέÏηση καταγÏαφής για να πεÏικόψει ÏƒÏ„Î¹Ï‚Ï€Î¿Î»Ï ÏƒÏντομα καταγÏαφές και recude το φοÏτίο συστημάτων. + +
+
+
+Τάξεις εκστÏατείας - σε αυτό το τμήμα μποÏείτε να καθοÏίσετε τηντάξη που ένας Ï€ÏάκτοÏας θα έχει για κάθε εκστÏατεία. Αυτές οιτάξεις μποÏοÏν να χÏησιμοποιηθοÏν για να επιτÏέψουν τηνπÏοτιμημένη κλήση καθοδηγώντας όταν τίθεται η επόμενη κλήσηπÏακτόÏων campaign_rank. + +
+
+
+ΕισεÏχόμενες Ομάδες - Εδώ μποÏείτε να επιλέξετε τις εισεÏχόμενες ομάδες που θέλετε να λαμβάνουν τις κλήσεις , εάν έχετε επιλέξει την εκστÏατεία CLOSER. Θα είστε σε θέση επίσης να θέσετε την τάξη, ή το επίπεδοικανότητας, σε αυτό το τμήμα κάθε μιας από τις εισεÏχόμενεςομάδες καθώς επίσης και όντας σε θέση να δείτε τοναÏιθμό κλήσεων που παÏαλαμβάνονται από κάθε εισεÏχόμενη ομάδαγια αυτόν τον συγκεκÏιμένο Ï€ÏάκτοÏα. Επίσης σε αυτό το τμήμα είναι η δυνατότητα να δοθεί στονπÏάκτοÏα μια τάξη για κάθε εισεÏχόμενη ομάδα. Αυτές οι τάξειςμποÏοÏν να χÏησιμοποιηθοÏν για την Ï€Ïοτιμημένη κλήση καθοδηγώνταςόταν επιλέγεται εκείνη η επιλογή στην οθόνη-ΟΜΑΔΑΣ. + +
+
+
+Ο Ï€ÏάκτοÏας αλλάζει τη συμπληÏωματική Ï€Ïομήθεια στοιχείωνπελατών - αυτή η επιλογή θα αγνοήσει οποιος δήποτε η επιλογήείναι στην εκστÏατεία για την αλλαγή των στοιχείων πελατών.NOT_ACTIVE θα χÏησιμοποιήσει οποιου δήποτε που θέτει είναιπαÏών για την εκστÏατεία. ALLOW_ALTER θα επιτÏέψει πάντα τονπÏάκτοÏα να αλλάξει τα στοιχεία πελατών, η των οποίων ÏÏθμισηεκστÏατείας είναι. Η Ï€Ïοεπιλογή είναι NOT_ACTIVE. + +
+
+
+Αλλάξτε τις επιλογές διεπαφών ΧειÏιστών - εάν θέσετε σε 1 αυτή την επιλογή, επιτÏέπει στο διαχειÏιστή να Ï„Ïοποποιήσει τις επιλογές διεπαφών χειÏιστών στην admin.php. + +
+
+
+ΔιαγÏαφή ΧÏηστών - εάν θέσετε σε 1 αυτή την επιλογή, επιτÏέπει στο χÏήστη να διαγÏάψει άλλους χÏήστες ίσου ή μικÏότεÏου επιπέδου από το σÏστημα. + +
+
+
+ΔιαγÏαφή Ομάδων ΧÏηστών - εάν θέσετε σε 1 αυτή την επιλογή, επιτÏέπει στο χÏήστη να διαγÏάψει τις ομάδες χÏηστών από το σÏστημα. + +
+
+
+ΔιαγÏαφή Λιστών - εάν θέσετε σε 1 αυτή την επιλογή, επιτÏέπει στο χÏήστη να διαγÏάψει τις λίστες από το σÏστημα. + +
+
+
+ΔιαγÏαφή ΕκστÏατειών - εάν θέσετε σε 1 αυτή την επιλογή, επιτÏέπει στο χÏήστη να διαγÏάψει τις εκστÏατείες από το σÏστημα. + +
+
+
+ΔιαγÏαφή Εισ-Ομάδων - εάν θέσετε σε 1 αυτή την επιλογή, επιτÏέπει στο χÏήστη να διαγÏάψει τις Εισ-Ομάδες από το σÏστημα. + +
+
+
+ΔιαγÏάψτε τους ΑπομακÏυσμένους ΧειÏιστές - εάν θέσετε σε 1 αυτή την επιλογή, επιτÏέπει στο χÏήστη να διαγÏάψει τους απομακÏυσμένους χειÏιστές από το σÏστημα. + +
+
+
+Εισαγωγή Οδηγών - εάν θέσετε σε 1 αυτή την επιλογή, επιτÏέπει στο χÏήστη να εισάγει τους οδηγοÏÏ‚ στον πίνακα vicidial_list μέσω του βασισμένου σε Ιστοσελίδα Εισαγωγέα οδηγών. + +
+
+
+ΛεπτομέÏειες ΕκστÏατείας - εάν θέσετε σε 1 αυτή την επιλογή, επιτÏέπει στο χÏήστη να δει και να Ï„Ïοποποιήσει τα λεπτομεÏή στοιχεία της εκστÏατείας. + +
+
+
+AGC ΠÏόσβαση ΔιαχειÏιστή - εάν θέσετε σε 1 αυτή την επιλογή, επιτÏέπει στο χÏήστη να συνδεθεί στις σελίδες του astGUIclient ως διαχειÏιστής. + +
+
+
+AGC διαγÏαφή τηλεφώνων - εάν θέσετε σε 1 αυτή την επιλογή, επιτÏέπει στο χÏήστη να διαγÏάψει τα τηλέφωνα στις σελίδες του διαχειÏιστή του astGUIclient. + +
+
+
+ΔιαγÏαφή Î’Î¿Î·Î¸Î¿Ï - εάν θέσετε σε 1 αυτή την επιλογή, επιτÏέπει στο χÏήστη να διαγÏάψει τους οδηγοÏÏ‚ της εκστÏατείας . + +
+
+
+ΤÏοποποιήστε τους οδηγοÏÏ‚ - αυτή η επιλογή εάν τη θέσετε σε 1, επιτÏέπει στο χÏήστη να Ï„Ïοποποιήσει τους οδηγοÏÏ‚ στη σελίδα αποτελεσμάτων αναζήτησης οδηγών. + +
+
+
+Αλλαγή ΕκστÏατείας ΧειÏÎ¹ÏƒÏ„Î¿Ï - εάν θέσετε σε 1 αυτή την επιλογή, επιτÏέπει στο χÏήστη να αλλάξει την εκτÏατεία όπου ένας Ï€ÏάκτοÏας έχει συνδεθεί . + +
+
+
+ΔιαγÏαφή ΦίλτÏων - Αυτή η επιλογή επιτÏέπει στον χειÏιστή να διαγÏάφει φίλτÏα από το σÏστημα. + +
+
+
+ΔιαγÏαφή ΧÏόνων Κλήσεων - Αυτή η επιλογή επιτÏέπει στον χÏήστη να διαγÏάφει εγγÏαφές χÏόνων κλήσεων και καταστάσεων από το σÏστημα. + +
+
+
+ΤÏοποποίηση ΧÏόνων Κλήσεων - Αυτή η επιλογή επιτÏέπει στον χÏήστη εμφανίσει και να Ï„Ïοποποιήσει τους χÏόνους κλήσεων και τις εγγÏαφές χÏόνων κλήσεων κατάστασης. Δεν χÏειάζεται να είναι ενεÏγή αυτή η επιλογή εάν μόνο χÏειάζεται η αλλαγή της επιλογής των χÏόνων κλήσεων στην οθόνη των εκστÏατειών. + +
+
+
+ΤÏοποποιήστε τα τμήματα - αυτές οι επιλογές επιτÏέπουν στοχÏήστη για να δουν και να Ï„Ïοποποιήσουν κάθε ένας αÏχείατμημάτων. Εάν θέστε 0, ο χÏήστης θα είναι σε θέση ναδει τον κατάλογο τμημάτων, αλλά όχι την οθόνηλεπτομέÏειας ή Ï„Ïοποποίησης ενός αÏχείου σε εκείνο το τμήμα. + +
+
+
+Εκθέσεις άποψης - αυτή η επιλογή επιτÏέπει στο χÏήστη για να δειτις εκθέσεις VICIDIAL. + + + + +



+ +VICIDIAL_CAMPAIGNS ΠΙÎΑΚΑΣ

+
+
+ID ΕκστÏατείας - Αυτό είναι το σÏντομο όνομα της εκστÏατείας, δεν μποÏεί να διοÏθωθεί μετά από την αÏχική παÏάδοση, δεν μποÏεί να πεÏιέχει κενά και Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 2 και 8 χαÏακτήεςh. + +
+
+
+Ονομα ΕκστÏατείας - Αυτό είναι η πεÏιγÏαφή της εκστÏατείας, Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 6 και 40 χαÏακτήÏες. + +
+
+
+ΠεÏιγÏαφή εκστÏατείας - αυτό είναι ένας τομέας υπομνημάτων γιατην εκστÏατεία, είναι Ï€ÏοαιÏετικό και μποÏεί να είναι έναμέγιστο 255 χαÏακτήÏων στο μήκος. + +
+
+
+ΗμεÏομηνία αλλαγής εκστÏατείας - αυτό είναι η τελευταία φοÏάότι οι τοποθετήσεις για αυτήν την εκστÏατεία Ï„Ïοποποιήθηκαν απόκαμιά άποψη. + +
+
+
+Τελευταία ημεÏομηνία σÏνδεσης εκστÏατείας - αυτό είναι ητελευταία φοÏά ότι ένας Ï€ÏάκτοÏας καταγÏάφηκε σε αυτήν τηνεκστÏατεία. + +
+
+
+Η εκστÏατεία Stats αναζωογονεί - αυτό το τετÏαγωνίδιο θαεπιτÏέψει ότι για να αναγκάσετε τα vicidial statsαναζωογονείτε, ακόμα κι αν η εκστÏατεία δεν είναι ενεÏγός. + +
+
+
+ΕνεÏγοποίηση - Εδώ μποÏείτε να θέσετε την εκστÏατεία ενεÏγή ή μη ενεÏγή. Εάν είναι μη ενεÏγή, κανένας δεν μποÏεί να συνδεθεί σε αυτήν. + +
+
+
+Τηλ.ΣÏνδεση Στάθμευσης - Εδώ μποÏείτε να οÏίσετε την μουσική αναμονής για το VICIDIAL. Επιβεβαιώστε, ότι η εσωτ.σÏνδεση βÏίσκεται στο extensions.conf και ότι δείχνει το αÏχείο παÏακάτω. + +
+
+
+ν ΑÏχείου Στάθμευσης - Εδώ μποÏείτε να Ï€ÏοσαÏμόσετε την μουσική αναμονής για το VICIDIAL. Επιβεβαιώστε ότι το αÏχείο έχει 10 χαÏακτήÏες ή λιγότεÏους και ότι το αÏχείο βÏίσκεται στον κατάλογο /var/lib/asterisk/sounds. + +
+
+
+Ιστοσελίδα - Αυτή είναι η Ï€ÏοσαÏμοσμένη διεÏθυνση που θα σας κατευθÏνει για κλήσεις που έÏχονται σε αυτήν την ομάδα. + +
+
+
+ΕπιτÏέπει τους Closers - Εδώ οÏίζετε εάν οι χÏήστες της εκστÏατείας θα έχουν την επιλογή να στείλουν την κλήση σε έναν closer. + +
+
+
+Ομάδα μεταφοÏάς Ï€Ïοεπιλογής - αυτός ο τομέας είναι η-ΟΜΑΔΑπÏοεπιλογής που θα επιλεχτεί αυτόματα όταν πηγαίνει ο Ï€ÏάκτοÏαςστο πλαίσιο μεταφοÏά-διασκέψεων στη διεπαφή Ï€ÏακτόÏων τους. + +
+
+
+Ομάδες μεταφοÏάς - με αυτές τις λίστες τετÏαγωνιδίου μποÏείτε ναεπιλέξετε τις ομάδες ότι οι Ï€ÏάκτοÏες σε αυτήν την εκστÏατείαμποÏοÏν να μεταφέÏουν τις κλήσεις. ΕπιτÏέψτε ότι ClosersÏ€Ïέπει να επιτÏαπεί για αυτήν την επιλογή να παÏουσιάσει. + +
+
+
+ΕπιτÏέψτε πλησίον και συνδÏασε - αυτό είναι όπου μποÏείτε ναθέσετε εάν οι χÏήστες αυτής της εκστÏατείας θα έχουν τηνεπιλογή να πάÏουν τις εισεÏχόμενες κλήσεις με αυτήν τηνεκστÏατεία. Εάν θέλετε να κάνετε συνδυασμένων εισεÏχόμενος καιεξεÏχόμενος έπειτα αυτό Ï€Ïέπει να τεθεί το Î¥. Εάν θέλετε μόνονα κάνετε τον εξεÏχόμενο σχηματισμό σε αυτήν την εκστÏατείαθέστε αυτό σε Î. Default είναι ν. + +
+
+
+Κατάσταση Κλήσης - Εδώ οÏίζετε τις καταστάσεις που θέλετε να κληθοÏν μέσα στις λίστες, οι οποίες είναι ενεÏγές για την εκστÏατεία παÏακάτω. Îα Ï€Ïοσθέσει μια άλλη θέση στον πίνακα, να το επιλέξει από τονεξελισσόμενους κατάλογο και τον κÏότο ΠΡΟΣΘΕΤΕΙ. Για να αφαιÏέσετεμια από τις θέσεις πινάκων, χτυπήστε στη REMOVE σÏνδεση δίπλαστη θέση που θέλετε να αφαιÏέσετε. + +
+
+
+Ταξινόμηση Λίστας - Σε αυτόν τον κατάλογο επιλογών μποÏείτε να επιλέξετε πώς οι οδηγοί, που ταιÏιάζουν με τις καταστάσεις που επιλέξατε παÏαπάνω, θα τοποθετηθοÏν στον hopper: +
  - DOWN: επιλογή των Ï€Ïώτων οδηγών που εισήχθησαν στον πίνακα vicidial_list +
  - UP: επιλογή των τελευταίων οδηγών που εισήχθησαν στον πίνακα vicidial_list +
  - UP PHONE: επιλογή του υψηλότεÏου Ï„Î·Î»ÎµÏ†Ï‰Î½Î¹ÎºÎ¿Ï Î±ÏÎ¹Î¸Î¼Î¿Ï ÎºÎ±Î¹ συνεχίζει Ï€Ïος τα κάτω +
  - DOWN PHONE: επιλογή του χαμηλότεÏου Ï„Î·Î»ÎµÏ†Ï‰Î½Î¹ÎºÎ¿Ï Î±ÏÎ¹Î¸Î¼Î¿Ï ÎºÎ±Î¹ συνεχίζει Ï€Ïος τα πάνω +
  - UP LAST NAME: έναÏξη με τα επίθετα να ξεκινάνε με Ζ και συνεχίζει Ï€Ïος τα κάτω +
  - DOWN LAST NAME: έναÏξη με τα επίθετα να ξεκινάνε με Α και συνεχίζει Ï€Ïος τα πάνω +
  - UP COUNT: έναÏξη με τους λιγότεÏους σε κλήση οδηγοÏÏ‚ και συνεχίζει Ï€Ïος τα κάτω +
  - DOWN COUNT: έναÏξη με τους λιγότεÏους σε κλήση οδηγοÏÏ‚ και συνεχίζει +
  - DOWN COUNT 2nd NEW: έναÏξη με τους λιγότεÏους σε κλήση οδηγοÏÏ‚ και συνεχίζει Ï€Ïος τα πάνω με την εισαγωγή ενός ÎΕΟΥ Î¿Î´Î·Î³Î¿Ï Î³Î¹Î± κάθε άλλο οδηγό - ΠÏέπει να ΜΗΠέχει νέα επιλεγμένα στις καταστάσεις κλήσεων +
  - DOWN COUNT 3nd NEW: έναÏξη με τους λιγότεÏους σε κλήση οδηγοÏÏ‚ και συνεχίζει Ï€Ïος τα πάνω με την εισαγωγή ενός ÎΕΟΥ Î¿Î´Î·Î³Î¿Ï Î³Î¹Î± κάθε Ï„Ïίτο οδηγό - ΠÏέπει να ΜΗΠέχει νέα επιλεγμένα στις καταστάσεις κλήσεων +
  - DOWN COUNT 4th NEW: έναÏξη με τους λιγότεÏους σε κλήση οδηγοÏÏ‚ και συνεχίζει Ï€Ïος τα πάνω με την εισαγωγή ενός ÎΕΟΥ Î¿Î´Î·Î³Î¿Ï Î³Î¹Î± κάθε τέταÏτο οδηγό - ΠÏέπει να ΜΗΠέχει νέα επιλεγμένα στις καταστάσεις κλήσεων + +
+
+
+Επίπεδο Hopper - Αυτό είναι το πόσους οδηγοÏÏ‚ η διαδικασία VDhopper, Ï€Ïοσπαθεί να διατηÏήσει στον πίνακα vicidial_hopper για αυτήν την εκστÏατεία. Εάν η διαδικασία VDhopper Ï„Ïέχει κάθε λεπτό, Ïυθμίστε αυτό λίγο πεÏισσότεÏο από τον αÏιθμό των οδηγών που πεÏνοÏν σε ένα λεπτό. + +
+
+
+ΦίλτÏο ÎŸÎ´Î·Î³Î¿Î¹Ï - αυτή είναι μία μέθοδος για να δημιουÏγήτε φίλτÏα για την SQL εÏώτηση. ΧÏησιμοποιήστε αυτό το χαÏακτηÏιστικό με Ï€Ïοσοχή, είναι εÏκολο να σταματήσει το σÏστημα με μία μικÏή αλλαγή στη δήλωση SQL. Η Ï€Ïοεπιλογή είναι ΚΑΜΙΑ. + +
+
+
+ΥποχÏεωτική ΕπαναφοÏά του Hopper - Αυτό σας επιτÏέπει καθαÏίσετε τα πεÏιεχόμενα κατά την επιβεβαίωση της φόÏμας. Αυτό θα συμβεί πάλι όταν η διαδικασία VDhopper θα Ï„Ïέξει. + +
+
+
+Μέθοδος Κλήσης + - This field is the way to define how dialing is to take place. If MANUAL then the auto_dial_level will be locked at 0 unless Μέθοδος Κλήσης + is changed. If RATIO then the normal dialing a number of lines for Active agents. ADAPT_HARD_LIMIT will dial predictively up to the dropped percentage and then not allow aggressive dialing once the drop limit is reached until the percentage goes down again. ADAPT_TAPERED allows for running over the dropped percentage in the first half of the shift -as defined by call_time selected for campaign- and gets more strict as the shift goes on. ADAPT_AVERAGE tries to maintain an average or the dropped percentage not imposing hard limits as aggressively as the other two methods. Δεν μποÏείτε να αλλάξετε το επίπεδο Αυτόματης Κλήσης, εάν έχετε οÏίσει κάποια μέθοδο ΠÏοσαÏμογής Κλήσεων. Μόνο ο διακομιστής μποÏεί να το αλλάξει όταν είναι σε διαδικασία αυτόματων κλήσεων. +. + +
+
+
+Επίπεδο Αυτόματης Κλήσης - Εδώ είναι που καθοÏίζεται πόσες γÏαμμές θα χÏησιμοποιοÏνται ανά ενεÏγό χÏήστη. Μηδέν (0) σημαίνει ότι η αυτόματη κλήση είναι μη ενεÏγή και οι χÏήστες πατοÏν το πλήκτÏο για την κλήση κάθε αÏιθμοÏ. ΔιαφοÏετικά, το σÏστημα καλεί γÏαμμές ίσες με τους ενεÏγοÏÏ‚ χÏήστες, πολλαπλασιασμένους με το επίπεδο κλήσης και σÏμφωνα με το πόσες γÏαμμές η εκστÏτεία σε κάθε διακομιστή επιτÏέπει. Το ADAPT τετÏαγωνίδιο ΣΥΜΠΛΗΡΩΜΑΤΙΚΗΣ ΠΡΟΜΉΘΕΙΑΣ επιτÏέπει σεσας για να αναγκάσει ένα νέο επίπεδο πινάκων ακόμα κι αν ημέθοδος πινάκων είναι σε έναν ADAPT Ï„Ïόπο. Αυτό είναιχÏήσιμο εάν υπάÏχει μια δÏαματική μετατόπιση στην ποιότητα τωνμολÏβδων και θέλετε να αλλάξετε δÏαστικά το dial_level με τοχέÏι. + +
+
+
+Διαθέσιμα μόνο ετικέτες - Εάν θέσετε σε Παυτό το πεδίο, θα αφήσει εκτός τις καταστάσεις των χειÏιστών out INCALL και QUEUE, καθώς υπολογίζεται ο αÏιθμός των κλήσεων όταν δεν είναι σε κατάσταση κλήσης MANUAL. ΠÏοκαθοÏισμένα είναι Ο. + +
+
+
+Ποσοστό ΟÏίου Εγκατ. Κλήσεων - Σε αυτό το πεδίο μποÏείτε να θέσετε το ÏŒÏιο του Ï€Î¿ÏƒÎ¿ÏƒÏ„Î¿Ï ÎµÎ³ÎºÎ±Ï„. κλήσεων καθώς χÏησιμοποιείτε μία μέθοδος Ï€ÏοσαÏμοσμένης-Ï€Ïόβλεψη κλήσεων, όχι MANUAL ή RATIO. + +
+
+
+Μέγιστο Επίπεδο ΠÏοσαÏμογής Κλήσεων - Σε αυτό το πεδίο μποÏείτε να θέσετε το ÏŒÏιο για το ÏŒÏιο του αÏÎ¹Î¸Î¼Î¿Ï Î³Ïαμμών για κάθε χειÏιστή καθώς χÏησιμοποιείτε μία μέθοδος Ï€ÏοσαÏμοσμένης-Ï€Ïόβλεψη κλήσεων, όχι MANUAL ή RATIO. Αυτός ο αÏιθμός μποÏεί να είναι μεγαλÏτεÏος από το επίπεδο αυτόματης κλήσης εάν το υλικό σας το υποστηÏίζει. Η τιμή Ï€Ïέπει να είναι θετικός αÏιθμός μεγαλÏτεÏος από ένα και μποÏεί να έχει δεκαδικά. ΠÏοκαθοÏισμένα είναι 3.0. + +
+
+
+Τελευταίος ΧÏόνος Διακομιστή - Αυτό το πεδίο χÏησιμοποιείτε μόνο από την μέθοδο ADAPT_TAPERED. Θα Ï€Ïέπει να καταχωÏήσετε την ÏŽÏα και τα λεπτά που θα σταματήσει τις κλήσεις η εκστÏατεία. Αυτό επιτÏέπει στον αλγόÏιθμο να αποφασίσει πόσο επιθετικά θα κάνει κλήσεις και πόσο χÏόνο. + +
+
+
+Ενταση ΤÏοποποίησης ΠÏοσαÏμογής - Αυτό το πεδίο χÏησιμοποιείτε για να αλλάζει ένταση Ï€Ïοβλέψεων είτε υψηλότεÏα ή χαμηλότεÏα. ΠÏοκαθοÏισμένα είναι 0. Αυτό το πεδίο δεν χÏησιμοποιείται από τις μεθόδους MANUAL ή RATIO. + +
+
+
+Επίπεδο Κλήσεων Μεταβολής Στόχου - Αυτό το πεδίο χÏησιμοποιείτε για να έχει στόχο ένα συγκεκÏιμένο αÏιθμό χειÏιστών να πεÏιμένουν κλήσεις ή κλήσεις να πεÏιμένουν για χειÏιστές. Π.χ. εάν θέλετε πάντα να έχετε κατά μέσο ÏŒÏο έναν χειÏιστή ελεÏθεÏο για ν παίÏνει τις κλήσεις, τότε Ï€Ïέπει να το θέσετε σε -1. Εάν στόχος είναι να έχετε πάντα μία κλήση σε αναμονή για ένα χειÏιστή, τότε Ï€Ïέπει να το θέσετε σε 1. ΠÏοκαθοÏισμένα είναι 0. Αυτό το πεδίο δεν χÏησιμοποιείται από τις μεθόδους MANUAL ή RATIO. + +
+
+
+ΤαυτόχÏονες μεταφοÏές - αυτή η ÏÏθμιση χÏησιμοποιείται για νακαθοÏίσει τον αÏιθμό κλήσεων που μποÏεί να σταλεί στουςπÏάκτοÏες συγχÏόνως. Συνιστάται αυτή η ÏÏθμιση να αφήνεται στοΑΥΤΟΚΙÎΗΤΟ. Αυτός ο τομέας δεν χÏησιμοποιείται με τη ΧΕΙΡΩÎΑΚΤΙΚΗμέθοδο πινάκων. + +
+
+
+Αυτόματος ALT-ARJCMO'S που σχηματίζει - αυτή η ÏÏθμισηχÏησιμοποιείται για να σχηματίσει αυτόματα τους εναλλάσσομαιτομείς αÏÎ¹Î¸Î¼Î¿Ï ÏƒÏ‡Î·Î¼Î±Ï„Î¯Î¶Î¿Î½Ï„Î±Ï‚ σε ΑÎΑΛΟΓΙΑ και ÎΑ ΠΡΟΣΑΡΜΟΣΕΙ τιςμεθόδους πινάκων όταν δεν υπάÏχει καμία επαφή στον κÏÏιοτηλεφωνικό αÏιθμό για έναν μόλυβδο, τις θέσεις NA, β,συνεχοÏÏ‚ ÏεÏματος και ν. Αυτή η ÏÏθμιση δεν χÏησιμοποιείται με τηΧΕΙΡΩÎΑΚΤΙΚΗ μέθοδο πινάκων. + +
+
+
+Επόμενη Κλήση ΧÏήστη - Αυτό Ï€ÏοσδιοÏίζει ποιος χÏήστης λαμβάνει την επόμενη κλήση που είναι διαθέσιμη: +
  - random: ταξινομημένο με τυχαία τιμή ενημέÏωσης στον πίνακα vicidial_live_agents +
  - oldest_call_start: ταξινομημένο με την τελευταία φοÏά που σε ένα χÏήστη στάλθηκε μία κλήση. Με αποτέλεσμα, ο χÏήστης να λαμβάνει συνολικά το ίδιο αÏιθό κλήσεων. +
  - oldest_call_finish: ταξινομημένο με την τελευταία φοÏά που ένας χÏήστης τελείωσε μία κλήση. Ο χÏήστης που πεÏιμένει πεÏισσότεÏο λαμβάνει την Ï€Ïώτη κλήση. +
  - overall_user_level: οι διαταγές από το user_level του χειÏιστή όπως καθοÏίζεται στα vicidial_users παÏουσιάζουν ένα υψηλότεÏο user_level θα άβουν πεÏισσότεÏες κλήσεις. +
  - campaign_rank: διαταγές από την τάξη που δίνεται στον Ï€ÏάκτοÏαγια την εκστÏατεία. Ο υψηλότεÏος σε χαμηλότεÏο. +
  - fewest_calls: διαταγές από τον αÏιθμό κλήσεων πουπαÏαλαμβάνονται από έναν Ï€ÏάκτοÏα για εκείνη την συγκεκÏιμένηεισεÏχόμενη ομάδα. ΛιγότεÏες κλήσεις Ï€Ïώτα. + +
+
+
+Τοπική ΩÏα Κλήσης - Εδώ, μποÏείτε να οÏίσετε τις ÏŽÏες που θα θέλατε να γίνουν οι κλήσεις. Αυτό ελέγχετε από τον κωδικό πεÏις και Ïυθμίζεται για Daylight Savings εάν είναι εφαÏμόσιμο. + +
+
+
+Κλήση Εκτός ΧÏόνου - άν έχει οÏιστεί, οι κλήσεις που φυσιολογικά θα έκλειναν μετά το χÏόνο που έχει οÏιστεί στο extensions.conf, θα κλείσουν σε αυτόν τον χÏόνο εάν είναι μικÏότεÏος του extensions.conf. Αυτό επιτÏέπει στην γÏήγοÏη αλλαγή των χÏόνων από διακομιστή σε διακομιστή και πεÏιοÏίζοντας τα αοτελέσματα σε μία εκστÏατεία. Εάν έχετε πολλές κλήσεις με Αυτόματους Τηλεφωνητές ή Φωνητικών ΤαχυδÏομείων, μποÏείτε να αλλάξετε αυτή την τιμή Î¼ÎµÏ„Î±Î¾Ï 21-26 και να δείτε αν τα αποτελέσματα είναι καλÏτεÏα. + +
+
+
+ΠÏόθεμα Κλήσης - Αυτό το ο επιτÏέπει την πιο εÏκολη αλλαγή της διαδÏομής της κλήσης να βγει έξω μέσω διαφοÏετικής μεθόδου, χωÏίς να γίνει επαναφόÏτωση στο Asterisk. ΠÏοκαθοÏισμένο είναι το 9 βασισμένο σÏμφωνα με το 91NXXNXXXXXX στο σχέδιο κλήσεων - extensions.conf. + +
+
+
+ΠαÏάλειψη ÎšÏ‰Î´Î¹ÎºÎ¿Ï Î¤Î·Î»ÎµÏ†ÏŽÎ½Î¿Ï… - Αυτό το πεδίο σας επιτÏέπει να αφήσετε εκτός το πεδίο phone_code καθώς γίνονται οι κλήσεις. ΠÏοκαθοÏισμένα είναι Ο. + +
+
+
+CallerID ΕκστÏατείας - Αυτός ο τομέας επιτÏέπει την αποστολή ενός αÏÎ¹Î¸Î¼Î¿Ï ÏƒÏ…Î½Î®Î¸ÎµÎ¹Î±Ï‚ callerid στις εξεÏχόμενες κλήσεις. Αυτό είναι ο αÏιθμός που θα παÏουσίαζε στο callerid του Ï€Ïοσώπου που καλείτε. Η Ï€Ïοεπιλογή είναι ΑΓÎΩΣΤΗ. Εάν χÏησιμοποιείτε το T1 ή Eί να σχηματίσει έξω αυτήν την επιλογή είναι μόνο διαθέσιμος εάν χÏησιμοποιετε PRIs - ISDN Tί ή Eί - που ανοίγουν το χαÏακτηÏιστικό γνώÏισμα συνήθειας callerid, αυτό δεν θα λειτουÏγήσει με την υπηÏεσία ληστεÏω-κομματιών - RBS - κυκλώματα. Αυτό θα λειτουÏγήσει επίσης μέσω του πεÏισσότεÏου VOIP - ΓΟΥΛΙΑ ή κοÏμοί IAX - Ï€Ïομηθευτές που επιτÏέπουν δυναμικό εξεÏχόμενο callerID. Η σνήθεια callerID ισχÏει μόνο για τις κλήσεις που τοποθετοÏνται για την εκστÏατεία VICIDIAL άμεσα, οποιεσδήποτε κλήσεις ή μεταφοÏές 3$ων συμβαλλόμενων μεÏών δεν θα στείλουν τη συνήθεια callerID. ΣΗΜΕΙΩΣΗ: ΜεÏικές φοÏές να βάλει ΑΓÎΩΣΤΗ ή ΙΔΙΩΤΙΚΗ στον τομέα θα παÏαγάγει την αποστολή του αÏÎ¹Î¸Î¼Î¿Ï Ï€Ïοεπιλογής σας callerID από το μεταφοÏέα σας με τις κλήσεις. ΜποÏείτε να θελήσετε να εξετάσετε αυτό και να υποβάλετε 0000000000 ο τομέας callerid αντ' Î±Ï…Ï„Î¿Ï ÎµÎ¬Î½ δεν θέλετε να σας στείλετε CallerID. + +
+
+
+Τηλ.ΣÏνδεση ΕκστÏατείας VDAD - Αυτό το πεδίο επιτÏέπει γαι μία Ï€ÏοσαÏμόσιμη VDAD εσωτ.σÏνδεση μεταφοÏάς. Αυτό σας επιτÏέπει να χÏησιμοποιήσετε διαφοÏετικές διαδικασίες VDADtransfer.agi, σÏμφωνα με την κστÏατεία. Η Ï€ÏοκαθοÏισμένη AGI μεταφοÏά - εσωτ.σÏνδ. 8365 agi VDADtransfer.agi - στέλνει αμέσως τις κλήσεις στον χÏήστη, μόλις το σηκώσουν. Ενα Ï€Ïόσθετο AGI παÏάεα πολιτικής έÏευνας συμπεÏιλαμβάνεται - 8366 agi - VDADtransferSURVEY.agi - όπου παίζει ένα μήνυμα στο κληθέν Ï€Ïόσωπο και επιτÏέπει να κάνουν επιλογς με τα πλήκτÏα. + +
+
+
+Τηλ.Επέκταση εκσÏατείας Î—Ï‡Î¿Î³Ï - αυτό το πεδίο επιτÏέπει να οÏίσετε μία επέκταση ηχογÏάφησης που χÏησιμοποιείται με το VICIDIAL. Αυτό επιτÏέπει να χÏησιμοποιήσετε διαφοÏετικές επεκτάσεις ανάλογα με πόσο χÏόνο θέλετε να επιτÏέψετε μία ηχογÏάφηση και ποιο Ï„Ïπος κωδικοποιητή-αποκωδικοποιητή θα χÏσιμοποιηθεί. Η Ï€Ïοεπιλογή είναι 8309 και θα καταγÏάψει με το σχήμα WAV μέχÏι μια ÏŽÏα. Μια άλλη επιλογή που πεÏιλαμβάνεται στα παÏαδείγματα είναι 8310 που θα καταγÏάψουν με το σχήμα GSM για μέχÏι μια ÏŽÏα. + +
+
+
+ΗχογÏάφηση ΕκστÏατείας - Αυτές οι επιλογές σας επιτÏέπουν να διαλέξετε πιο επίπεδο ηχογÏάφησης επιτÏέπετε στην εκστÏατεία. NEVER θα απενεÏγοποιήσει την ηχογÏάφηση στον πελάτη. ONDEMAND είναι το Ï€ÏοκαθοÏισμένο και επιτÏέπει στον χειÏιστή να ξεκινάει και να σταματάει την ηχογÏάφηση. ALLCALLS ξεκινάει η ηχογÏάφηση όποτε η κλήση μεταφέÏετε στον χειÏιστή. + +
+
+
+Όνομα αÏχείου Î·Ï‡Î¿Î³Ï ÎµÎºÏƒÏ„Ïατείας - αυτό το πεδίο επιτÏέπει να Ï€ÏοσαÏμόσετε το όνομα της ηχογÏάφησης, όταν η ηχογÏάφηση της εκστÏατείας είναι ONDEMAND ή ALLCALLS. Οι μεταβλητές είναι CAMPAIGN CUSTPHONE FULLDATE TINYDATE EPOCH AGENT. Η Ï€Ïοεπιλογή είναι FULLDATE_ΧΕΙΡΙΣΤΗΣκαι θα μοιάζει με το 20051020-103108_6666. Ένα άλλο παÏάδειγμα είναι CAMPAIGN_TINYDATE_CUSTPHONE που θα μοιάζει με το TESTCAMP_51020103108_3125551212. 50 char max. + +
+
+
+ΚαθυστέÏηση ΗχογÏάφησης - Μόνο για ηχογÏαφήσεις ALLCALLS και ALLFORCE. ΠÏοκαθοÏισμένα είναι 0. + +
+
+
+Βοηθός εκστÏατείας - αυτές οι επιλογές επιτÏέπουν να επιλέξετε τον Βοηθό που θα εμφανιστεί στην οθόνη των χειÏιστών για αυτήν την εκστÏατεία. Επιλέξτε NONE για να μην παÏουσιάσετε κανένα χειÏόγÏαφο για αυτήν την εκστÏατεία. + +
+
+
+Κατά την έναÏξη κλήσης - αυτές οι επιλογές επιτÏέπουν να επιλέξετε εάν θέλετε την αυτόματη έναÏξη μίας ιστο σελίδας σε ένα διαφοÏετικό παÏάθυÏο, αυτόματη μεάβαση στον Βοηθό ή τίποτα. + +
+
+
+Μήνυμα αυτόματου Ï„Î·Î»ÎµÏ†Ï‰Î½Î·Ï„Î¿Ï - αυτός το πεδίο χÏησιμοποιείτε για τις τυφλές κλήσεις μεταφοÏάς όταν παίÏνει ο χειÏιστής έναν αυτόματο τηλεφωνητή και χτυπά στο πλήκτÏο μηνυμάτων αυτόματων τηλεφωνητών στο πλαίσιο διασκέψεων μεταφοÏάς. ΠÏέπει το θέσετε αυτό στο dial plan - extensions.conf - και σιγουÏευτείτε ότι παίζει ένα αÏχείο μουσικής κατόπιν κλείνει το τηλέφωνο. + +
+
+
+AMD στέλνει στο VM - αυτές οι επιλογές επιτÏέπουν να καθοÏίσετε εάν ένα μήνυμα αφήνεται σε έναν αυτόματο τηλεφωνητή όταν ανιχνεÏεται ότι η κλήση είναι ένας αυτόματος τηλεφωνητής και εάν το AMD είναι ενεÏγό. + +
+
+
+Xfer- Συνδ DTMF - αυτά τα τέσσεÏα πεδία επιτÏέπουν να έχετε δÏο σÏνολα συνδιάσκεψης μεταφοÏάς και DTMF. Όταν η κλήση ή η εκστÏατεία φοÏτώνεται, ο Βοηθός θα παÏουσιάσει δÏο πλήκτÏα στο πλαίσιο μεταφοÏά-διασκέψεων και αυτόματα θα παÏουσιάσει τα πεδία αÏιθμό για κλήση και στείλε DTMF όταν πατηθεί. Εάν θέλετε να επιτÏέψετε τις μεταφοÏές σε σÏμβουλο, ενός fronter σε έναν closer, θα Ï€Ïέπει να θέσετε CXFER στο πεδίο number-to-dial και το σωστό κείμενο κλήσης θα σταλεί να κάνει μία τοπική μεταφοÏά σε σÏμβουλο. Καθώς η κλήση θα απαντηθεί, μποÏείτε να αφήσετε το πελάτη με τον χειÏιστή closer και να συνεχίσετε στην επόμενη κλήση πατώντας το πλήκτÏο ΑΠΟΧΩΡΗΣΗ 3μελής ΚΛΗΣΗΣ. Εάν θέλετε να μεταφέÏετε τους πελάτες σε AGI διαδικασία ή σε IVR, τότε θα Ï€Ïέπει να θέσετε AXFER στο πεδίο number-to-dial. ΜποÏείτε επίσης να θέσετε και μία Ï€Ïοσωπική τηλ. σÏνδεση μετά το AXFER ή CXFER. + +
+
+
+Κλήση Εναλ Î‘Ï Î§Ïήστη - Αυτή η επιλογή επιτÏέπει στον χειÏιστή να κάνει χειÏοκίνητη κλήση του ÎµÎ½Î±Î»Î»Î±ÎºÏ„Î¹ÎºÎ¿Ï Î±ÏÎ¹Î¸Î¼Î¿Ï Ï„Î·Î»ÎµÏ†ÏŽÎ½Î¿Ï… ή το πεδίο address3 μετά την κλήση του κυÏίου αÏιθμοÏ. + +
+
+
+ΠÏογÏαμματισμένες Επανακλήσεις - Αυτή η επιλογή επιτÏέπει στον χειÏιστή να τεÏματίσει μία κλήση ως CALLBK και να επιλέξει τα δεδομένα και την ÏŽÏα κατά την οποία ο οδηγός θα ξανα-ενεÏγοποιηθεί. + +
+
+
+ΔευτεÏ. Εγκαταλ. Κλήσης - Ο αÏιθμός των δευτεÏολέπτων από την στιγμή που ο πελάτης σηκώνει το τηλ μέχÏι η κλήση να θεωÏηθεί εγκαταλειμένη. Μόνο για εξεÏχόμενες κλήσεις . + +
+
+
+Φωνητικό ΤαχυδÏομείο - Εάν έχει οÏιστεί, οι κλήσεις που φυσιολογικά θα ΕΓΚΑΤΑΛΕΙΠΟÎΤΑÎ, θα κατευθυνθοÏν σε αυό το φωνητικό ταχυδÏομείο, ώστε να ακοÏσετε και να αφήσετε ένα μήνυμα. + +
+
+
+Μήνυμα ΑσφαλοÏÏ‚ ΦÏλαξης - Εάν είναι Î¥ θα παίξει ένα μήνυμα στον πελάτη μετά το πέÏας των δευτεÏολέπτων ασφαλοÏÏ‚ εγκατάλειψης, χωÏίς να μεταφεÏθεί σε ένν χειÏιστή. Αυτή η επιλογή υπεÏβαίνει την αποστολή σε θυÏίδα Î·Ï‡Î·Ï„Î¹ÎºÎ¿Ï Î¼Î·Î½Ïματος εάν είναι Î¥. + +
+
+
+Εσωτ.σÏνδεση ΑσφαλοÏÏ‚ ΦÏλαξης - Αυτή είναι η εσωτ.σÏνδεση του πλάνου κλήσεων, όπου βÏίσκεται το ηχητικό αÏχείο της Ασφαλής ΦÏλαξης στον διακομιστή. + +
+
+
+ΔευτεÏ. Τυλίγματος - Ο αÏιθμός των δευεÏολέπτων που αναγκάζει έναν χειÏιστή να πεÏιμένει Ï€Ïιν του επιτÏαπεί να λάβει ή να κάνει άλλη κλήση. Ο χÏόνος ξεκινάει μόλις τεÏματίσει μία κλήση. ΠÏοκαθοÏισμένα είναι 0 δευτεÏ. Αν ο χÏόνος πεÏάσει Ï€Ïιν ο χειÏιστής τεÏματίσει την κλήση, δεν θα μετακινηθεί στην άλλη κλήση Ï€Ïιν συβεί αυτό. + +
+
+
+Μήνυμα Τυλίγματος - Αυτό είναι ένα συγκεκÏιμένο μήνυμα εκστÏατείας που εμφανίζεται στην οθόνη τυλίγματος όταν έχει οÏιστεί ο χÏόνος τυλίγματος. + +
+
+
+ΕσωτεÏικός κατάλογος DNC χÏήσης - αυτό καθοÏίζει εάν αυτή ηεκστÏατεία είναι στους μολÏβδους φίλτν ενάντια στον εσωτεÏικόκατάλογο DNC. Εάν τίθεται το Î¥, η χοάνη θα ψάξει κάθετηλεφωνικό αÏιθμό στον κατάλογο DNC Ï€Ïίν τοποθετεί τον στηχοάνη. Εάν είναι στον κατάλογο DNC έπειτα θα αλλάξει ότιθέση μολÏβδου σε DNCL έτσι που δεν μποÏεί να σχηματιστεί. ΗπÏοεπιλογή είναι ν. + +
+
+
+ΕισεÏχόμενες ομάδες - For CLOSER campaigns only. Here is where you select the inbound groups you want agents in this CLOSER campaign to be able to take calls from. It is important for BLENDED inbound-outbound campaigns only to select the inbound groups that are used for agents in this campaign. The calls coming into the inbound groups selected here will be counted as active calls for a blended campaign even if all agents in the campaign are not logged in to receive calls from all of those selected inbound groups. + +
+
+
+Η μικÏή διακοπή Ï€ÏακτόÏων κωδικοποιεί ενεÏγό - επιτÏέπει στουςπÏάκτοÏες για να επιλέξει έναν κώδικα μικÏής διακοπής ότανχτυποÏν στο κουμπί ΜΙΚΡΗΣ ΔΙΑΚΟΠΉΣ στους κώδικες μικÏής διακοπήςvicidial.php. είναι ευπÏοσδιόÏιστοι ανά εκστÏατεία στοκατώτατο σημείο της οθόνης λεπτομέÏειας άποψης εκστÏατείας καιαποθηκεÏονται στον πίνακα vicidial_agent_log. Η Ï€Ïοεπιλογήείναι ν. + +
+
+
+Θέστε εκτός λειτουÏγίας αλλάζει τα στοιχεία πελατών - εάνθέστε το Î¥, δεν αλλάζει οποιων δήποτε από το αÏχείο στοιχείωνπελατών όταν διαθέσεις Ï€ÏακτόÏων η κλήση. Η Ï€Ïοεπιλογή είναι ν. + +
+
+
+ΕπιτÏέψτε τους κανένας-χοάνη-μολÏβδους Logins - εάν θέστε τοΥ, επιτÏέπει στους Ï€ÏάκτοÏες στη σÏνδεση στην εκστÏατεία ακόμα κιαν δεν υπάÏχει κανένας μόλυβδος που φοÏτώνεται στη χοάνη γιαεκείνη την εκστÏατεία. Αυτή η λειτουÏγία δεν απαιτείται στιςεκστÏατείες στενός-Ï„Ïπων. Η Ï€Ïοεπιλογή είναι ν. + +
+
+
+Μίγμα διαταγής καταλόγων - αγνοεί τους τομείς θέσης διαταγήςκαι πινάκων μολÏβδου. Θα χÏησιμοποιήσει τις παÏαμέτÏους καταλόγωνκαι θέσης για την επιλεγμένη είσοδο μιγμάτων καταλόγων στο υπο-τμήμα μιγμάτων καταλόγων αντ' αυτοÏ. Η Ï€Ïοεπιλογή είναι ΕΚΤΟΣΛΕΙΤΟΥΡΓΊΑΣ. + +
+
+
+Ταυτότητα μιγμάτων καταλόγων - ταυτότητα του μίγματος καταλόγων.ΠÏέπει να είστε από 2-20 χαÏακτήÏες στο μήκος χωÏίς ταδιαστήματα ή άλλη ειδική στίξη. + +
+
+
+Όνομα μιγμάτων καταλόγων - πεÏιγÏαφικό όνομα του μίγματοςκαταλόγων. ΠÏέπει να είστε από 2-50 χαÏακτήÏες στο μήκος. + +
+
+
+ΛεπτομέÏεια μιγμάτων καταλόγων - η σÏνθεση της εισόδου μιγμάτωνκαταλόγων. ΠεÏιέχει τον κατάλογο ταυτότητα, τη διαταγή μιγμάτων,τα ποσοστά και τις θέσεις που αποτελοÏν αυτό το μίγμα καταλόγων.Τα ποσοστά Ï€Ïέπει πάντα να Ï€Ïοσθέσουν μέχÏι 100, και οικατάλογοι όλοι Ï€Ïέπει να είναι ενεÏγοί και καθοÏισμένοι τηνεκστÏατεία για την είσοδο μιγμάτων διαταγής που ενεÏγοποιείται. + +
+
+
+Μέθοδος μιγμάτων καταλόγων - η μέθοδος όλα τα μέÏη τηςλεπτομέÏειας μιγμάτων καταλόγων από κοινοÏ. EVEN_MIX θααναμίξει τους μολÏβδους από κάθε μέÏος που παÏεμβάλλεται λευκέςσελίδες με τα άλλα μέÏη, όπως αυτό το 1,2,3,1,2,3,1,2,3.IN_ORDER θα βάλει τους μολÏβδους στη διαταγή στην οποίαπαÏατίθενται στην οθόνη λεπτομέÏειας μιγμάτων καταλόγων1,1,1,2,2,2,3,3,3. ΤΥΧΑΊΑ θα τους βάλουν στην ΤΥΧΑΊΑ Ï€Ïοεπιλογήδιαταγής 1,3,2,1,1,3,2,1,3. είναι IN_ORDER. + +
+
+
+ΧειÏωνακτικός κατάλογος ταυτότητα πινάκων - η Ï€Ïοεπιλογήlist_id για να χÏησιμοποιηθεί όταν δημιουÏγείται έναςπÏάκτοÏας placces μια χειÏωνακτική κλήση και ένα νέο αÏχείομολÏβδου στο vicidial_list. Η Ï€Ïοεπιλογή είναι 999. Αυτός οτομέας μποÏεί να πεÏιέχει τα ψηφία μόνο. + + + + +



+ +VICIDIAL_ΛΙΣΤΕΣ ΠΙÎΑΚΑΣ

+
+
+ID Λίστας - Αυτό είναι το αÏιθμητικό όνομα της λίστας, δεν μποÏεί να διοÏθωθεί μετά από την αÏχική εισαγωγή, Ï€Ïέπει να πεÏιέχει μόνο αÏιθμοÏÏ‚ και Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 2 και 8 χαÏακτήÏες. Must be a number greater than 100. + +
+
+
+Ονομα Λίστας - Αυτή είναι η πεÏιγÏαφή της λίστας, Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 2 και 20 χαÏακτήÏες. + +
+
+
+ΠεÏιγÏαφή καταλόγων - αυτό είναι ο τομέας υπομνημάτων για τονκατάλογο, είναι Ï€ÏοαιÏετικό. + +
+
+
+ΗμεÏομηνία αλλαγής καταλόγων - αυτό είναι η τελευταία φοÏά ότιοι τοποθετήσεις για αυτόν τον κατάλογο Ï„Ïοποποιήθηκαν από καμιάάποψη. + +
+
+
+Τελευταία ημεÏομηνία κλήσης καταλόγων - αυτό είναι η τελευταίαφοÏά ότι ο μόλυβδος σχηματίστηκε από αυτόν τον κατάλογο. + +
+
+
+ΕκστÏατεία - Αυτή είναι η εκστÏατεία όπου ανήκει η λίστα. Μία λίστα μποÏεί μόνο να κληθεί από μία εκστÏατεία κάθε φοÏά. + +
+
+
+ΕνεÏγή - Αυτό οÏίζει κατά πόσον η λίστα Ï€Ïόκειται να κληθεί ή όχι. + +
+
+
+ΕπαναφοÏά Κατάστασης-Κλήσης-Καθοδήγησης για την λίστα - Αυτό επαναφέÏει τους οδηγοÏÏ‚ σε αυτή την λίστα στο Πσε \"μη κληθέντα από την τελευταία επαναφοÏά\" και σημαίνει ότι για οποιαδήποτε καθοδήγηση μποÏεί να γίνει κλήση εάν είναι η σωστή κατάσταση, όπως οÏίσθηκε στην οθόνη τις εκστÏατείας. + +
+
+
+Κατάλογος VICIDIAL DNC - αυτό δεν καλεί τον κατάλογοπεÏιέχει κάθε μόλυβδο που έχει τεθεί μια θέση DNC στοσÏστημα. Μέσω των ΚΑΤΑΛΩΠ- ΠΡΟΣΘΕΣΤΕ τον ΑΡΙΘΜΟ στη σελίδαDNC που είστε σε θέση να Ï€Ïοσθέσετε με το χέÏι έναν αÏιθμό σεαυτόν τον κατάλογο έτσι ώστε δεν θα κληθεί από τις εκστÏατείεςπου χÏησιμοποιοÏν τον εσωτεÏικό κατάλογο DNC. + + + +



+ +VICIDIAL_INBOUND_GROUPS ΠΙÎΑΚΑΣ

+
+
+ID Ομάδας - Αυτό είναι το σÏντομο όνομα της εισεÏχόμενης ομάδας, δεν μποÏεί να διοÏθωθεί μετά από την αÏχική παÏάδοση, δεν μποÏεί να πεÏιέχει κενά και Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 2 και 20χαÏακτήÏες. + +
+
+
+Ονομα Ομάδας - Αυτή είναι η πεÏιγÏαφή της ομάδας, Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 2 και 30 χαÏακτήÏες. Δεν μποÏεί να συμπεÏιαμβάνει παÏλες, συν ή κενά . + +
+
+
+ΧÏώμα Ομάδας - Αυτό είναι το χÏώμα που εμφανίζεται στην VICIDIAL εφαÏμογή όταν η κλήση έÏχεται σε αυτή την ομάδα. ΠÏέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 2 και 7 χαÏακτήÏες. Εάν αυτό είναι οÏισμένο ως hex , θα Ï€Ïέπει να τοποθετήσετε ένα # στην αÏχή του κειμένου ή το VICIDIAL δεν θα δουλεÏει σωστά. + +
+
+
+ΕνεÏγοποίηση - Αυτό καθοÏίζει κατά πόσον αυτή η ομάδα εμφανίζεται στο κουτί επιλογής όταν ένας χÏήστης συνδέεται. + +
+
+
+Ιστοσελίδα - Αυτή είναι η Ï€ÏοσαÏμοσμένη διεÏθυνση που θα σας κατευθÏνει για κλήσεις που έÏχονται σε αυ την ομάδα. + +
+
+
+Επόμενη Κλήση ΧÏήστη - Αυτό Ï€ÏοσδιοÏίζει ποιος χÏήστης λαμβάνει την επόμενη κλήση που είναι διαθέσιμη: +
  - random: ταξινομημένο με τυχαία τιμή ενημέÏωσης στον πίνακα vicidial_live_agents +
  - oldest_call_start: ταξινομημένο με την τελευταία φοÏά που σε ένα χÏήστη στάλθηκε μία κλήση. Με αποτέλεσμα, ο χÏήστης να λαμβάνει συνολικά το ίδιο αÏιθό κλήσεων. +
  - oldest_call_finish: ταξινομημένο με την τελευταία φοÏά που ένας χÏήστης τελείωσε μία κλήση. Ο χÏήστης που πεÏιμένει πεÏισσότεÏο λαμβάνει την Ï€Ïώτη κλήση. +
  - overall_user_level: οι διαταγές από το user_level του χειÏιστή όπως καθοÏίζεται στα vicidial_users παÏουσιάζουν ένα υψηλότεÏο user_level θα άβουν πεÏισσότεÏες κλήσεις. +
  - inbound_group_rank: διαταγές από την τάξη που δίνεται στονπÏάκτοÏα για τη συγκεκÏιμένη εισεÏχόμενη ομάδα. Ο υψηλότεÏος σεχαμηλότεÏο. +
  - fewest_calls: διαταγές από τον αÏιθμό κλήσεων πουπαÏαλαμβάνονται από έναν Ï€ÏάκτοÏα για εκείνη την συγκεκÏιμένηεισεÏχόμενη ομάδα. ΛιγότεÏες κλήσεις Ï€Ïώτα. +
  - campaign_rank: διαταγές από την τάξη που δίνεται στον Ï€ÏάκτοÏαγια την εκστÏατεία. Ο υψηλότεÏος σε χαμηλότεÏο. +
  - fewest_calls_campaign: orders by the number of calls received by an agent for the campaign. Least calls first. +
+
+
+Οθόνη ΜπÏÎ¿ÏƒÏ„Î¹Î½Î¿Ï - Αυτό το πεδίο καθοÏίζει κατά πόσον στον VICIDIAL χόμενος χÏήστης θα εμφανίζεται το όνομα του μπÏÎ¿ÏƒÏ„Î¹Î½Î¿Ï - εάν υπάÏχει κάποιο - στο πεδίο κατάστασης όταν η κλήση έÏχεται στον χÏήστη. + +
+
+
+Βοηθός εκστÏατείας - αυτές οι επιλογές επιτÏέπουν να επιλέξετε τον Βοηθό που θα εμφανιστεί στην οθόνη των χειÏιστών για αυτήν την εκστÏατεία. Επιλέξτε NONE για να μην παÏουσιάσετε κανένα χειÏόγÏαφο για αυτήν την εκστÏατεία. + +
+
+
+Κατά την έναÏξη κλήσης - αυτές οι επιλογές επιτÏέπουν να επιλέξετε εάν θέλετε την αυτόματη έναÏξη μίας ιστο σελίδας σε ένα διαφοÏετικό παÏάθυÏο, αυτόματη μεάβαση στον Βοηθό ή τίποτα. + +
+
+
+Xfer- Συνδ DTMF - αυτά τα τέσσεÏα πεδία επιτÏέπουν να έχετε δÏο σÏνολα συνδιάσκεψης μεταφοÏάς και DTMF. Όταν η κλήση ή η εκστÏατεία φοÏτώνεται, ο Βοηθός θα παÏουσιάσει δÏο πλήκτÏα στο πλαίσιο μεταφοÏά-διασκέψεων και αυτόματα θα παÏουσιάσει τα πεδία αÏιθμό για κλήση και στείλε DTMF όταν πατηθεί. Εάν θέλετε να επιτÏέψετε τις μεταφοÏές σε σÏμβουλο, ενός fronter σε έναν closer, θα Ï€Ïέπει να θέσετε CXFER στο πεδίο number-to-dial και το σωστό κείμενο κλήσης θα σταλεί να κάνει μία τοπική μεταφοÏά σε σÏμβουλο. Καθώς η κλήση θα απαντηθεί, μποÏείτε να αφήσετε το πελάτη με τον χειÏιστή closer και να συνεχίσετε στην επόμενη κλήση πατώντας το πλήκτÏο ΑΠΟΧΩΡΗΣΗ 3μελής ΚΛΗΣΗΣ. Εάν θέλετε να μεταφέÏετε τους πελάτες σε AGI διαδικασία ή σε IVR, τότε θα Ï€Ïέπει να θέσετε AXFER στο πεδίο number-to-dial. ΜποÏείτε επίσης να θέσετε και μία Ï€Ïοσωπική τηλ. σÏνδεση μετά το AXFER ή CXFER. + +
+
+
+ΔευτεÏ. Εγκαταλ. Κλήσης - Ο αÏιθμός των δευτεÏολέπτων από την στιγμή που ο πελάτης σηκώνει το τηλ μέχÏι η κλήση να θεωÏηθεί εγκαταλειμένη. Μόνο για εξεÏχόμενες κλήσεις . + +
+
+
+Φωνητικό ΤαχυδÏομείο - Εάν έχει οÏιστεί, οι κλήσεις που φυσιολογικά θα ΕΓΚΑΤΑΛΕΙΠΟÎΤΑÎ, θα κατευθυνθοÏν σε αυό το φωνητικό ταχυδÏομείο, ώστε να ακοÏσετε και να αφήσετε ένα μήνυμα. + +
+
+
+Μήνυμα Εγκατάλειψης - Εάν είναι Î¥ θα παίξει ένα μήνυμα στον πελάτη μετά το πέÏας των δευτεÏολέπτων Εγκατάλειψης, χωÏίς να μεταφεÏθεί σε έναν χειÏιστή. Αυτή η επιλογή υπεÏβαίνει την αποστολή σε θυÏίδα Î·Ï‡Î·Ï„Î¹ÎºÎ¿Ï Î¼Î·Î½Ïματος εάν είναι Î¥. + +
+
+
+Εσωτ.ΣÏνδεση Εγκατάλειψης - Αυτή είναι η εσωτ.σÏνδεση του πλάνου κλήσεων, όπου βÏίσκεται το ηχητικό αÏχείο της Εγκατάλειψης στον διακομιστή. + +
+
+
+ΧÏόνος κλήσης - αυτό είναι το χÏονικό σχέδιο κλήσης ναχÏησιμοποιήσει για αυτήν την εισεÏχόμενη ομάδα. Λάβετε υπόψηότι ο χÏόνος είναι βασισμένος στο χÏόνο κεντÏικών υπολογιστών.Η Ï€Ïοεπιλογή είναι 24hours. + +
+
+
+Μετά από τη δÏάση ωÏών - η δÏάση για να εκτελέσει εάν είναιμετά από τις ÏŽÏες όπως καθοÏίζεται στο χÏόνο Ï€Ïόσκλησης γιααυτήν την εισεÏχόμενη ομάδα. HANGUP hangup αμέσως η κλήση,MESSASGE θα παίξει το αÏχείο στο μετέπειτα τομέα Filenamμηνυμάτων ωÏών, η ΕΠΈΚΤΑΣΗ θα στείλει την κλήση στη μετέπειταπαÏάταση ωÏών στον dialplan και το ΦΩÎΗΤΙΚΌ ΤΑΧΥΔΡΟΜΕΊΟ θαστείλει την κλήση στο παÏάθυÏο Ï†Ï‰Î½Î·Ï„Î¹ÎºÎ¿Ï Ï„Î±Ï‡Ï…Î´Ïομείου πουαπαÏιθμείται στο μετέπειτα τομέα Ï†Ï‰Î½Î·Ï„Î¹ÎºÎ¿Ï Ï„Î±Ï‡Ï…Î´Ïομείου ωÏών. ΗπÏοεπιλογή είναι ΜΗÎΥΜΑ. + +
+
+
+Μετά από το όνομα αÏχείου μηνυμάτων ωÏών - το ακουστικό αÏχείοπου βÏίσκεται στον κεντÏικό υπολογιστή που παίζεται εάν η δÏάσητίθεται το ΜΗÎΥΜΑ. Η Ï€Ïοεπιλογή είναι VM-ANTJ'O + +
+
+
+Μετά από την παÏάταση ωÏών - η dialplan επέκταση για ναστείλει την Ï€Ïόσκληση εάν η δÏάση τίθεται την ΕΠΕΚΤΑΣΗ. ΗπÏοεπιλογή είναι 8300. + +
+
+
+Μετά από το φωνητικό ταχυδÏομείο ωÏών - το κιβώτιο φωνητικοÏταχυδÏομείου για να στείλει την Ï€Ïόσκληση εάν η δÏάση τίθεται τοΦΩÎΗΤΙΚΟ ΤΑΧΥΔΡΟΜΕΊΟ. + +
+
+
+ΕυπÏόσδεκτο όνομα αÏχείου μηνυμάτων - το ακουστικό αÏχείο πουβÏίσκεται στον κεντÏικό υπολογιστή που παίζεται όταν μπαίνει ηκλήση. Εάν θέστε ΚΑÎΕÎΑΣ --- έπειτα κανένα μήνυμα δεν θαπαιχτεί. Η Ï€Ïοεπιλογή είναι ΚΑΜΙΑ --- + +
+
+
+Μουσική στο πλαίσιο λαβής - η μουσική στο πλαίσιο λαβής στηχÏήση όταν τοποθετείται ο πελάτης στη λαβή. Η Ï€Ïοεπιλογή είναιπÏοεπιλογή. + +
+
+
+Στο γÏήγοÏο όνομα αÏχείου λαβής - το ακουστικό αÏχείο πουβÏίσκεται στον κεντÏικό υπολογιστή που παίζεται σε ένα τακτόχÏονικό διάστημα όταν είναι ο πελάτης στη λαβή. Η Ï€Ïοεπιλογήείναι generic_hold. Αυτό το ακουστικό αÏχείο ΠΡΕΠΕΙ να είναι 9δευτεÏόλεπτα ή λιγότεÏοι στο μήκος. + +
+
+
+Στο γÏήγοÏο διάστημα λαβής - το χÏονικό διάστημα σταδευτεÏόλεπτα για να πεÏιμένει Ï€Ïίν παίζει επάνω κÏατά γÏήγοÏος.Η Ï€Ïοεπιλογή είναι 60. + +
+
+
+ΑγÏυπνη επέκταση Ï€ÏακτόÏων - η επέκταση που στέλνει στη σÏνοδοπÏακτόÏων για να αναγγείλει ότι μια κλήση έÏχεται στον Ï€ÏάκτοÏα.Αυτή η επέκταση Ï€Ïέπει να έχει μια αναπαÏαγωγή ήχου ÎµÎ½ÏŒÏ‚Î±ÎºÎ¿Ï…ÏƒÏ„Î¹ÎºÎ¿Ï Î±Ïχείου. Για να μην χÏησιμοποιήσετε αυτήν τηνλειτουÏγία θέστε αυτό σε Χ. Default είναι Χ. + +
+
+
+ΑγÏυπνη καθυστέÏηση Ï€ÏακτόÏων - το χÏονικό διάστημα στα χιλιοστάτου δευτεÏολέπτου για να πεÏιμένει Ï€Ïίν στέλνει την κλήση στονπÏάκτοÏα μετά από να παίξει την επάνω άγÏυπνη επέκτασηπÏακτόÏων. Η Ï€Ïοεπιλογή είναι 1000. + +
+
+
+Ομάδα μεταφοÏάς Ï€Ïοεπιλογής - αυτός ο τομέας είναι η-ΟΜΑΔΑπÏοεπιλογής που θα επιλεχτεί αυτόματα όταν πηγαίνει ο Ï€ÏάκτοÏαςστο πλαίσιο μεταφοÏά-διασκέψεων στη διεπαφή Ï€ÏακτόÏων τους. + + + +



+ +VICIDIAL_REMOTE_AGENTS ΠΙÎΑΚΑΣ

+
+
+ΑÏχή ID ΧÏήστη - Αυτό είναι η αÏχή του ID ΧÏήστη που χÏησιοποιείται όταν οι καταχωÏήσεις των απομακÏυσμένων χÏηστών παÏεμβάλλονται στο σÏστημα. Εάν ο αÏιθμός των γÏαμμών είναι μεγαλÏτεÏος από 1, αυτός ο αÏιθμός αυξάνει κατά ένα μέχÏι κάθε γÏαμμή να έχει μία καταχώÏηση. Επιβεβαιώστε, ότι δημιουÏγήσατε ένα νέο VICIDIAL λογαÏιασμό η με επίπεο χÏήσης 4 ή μεγαλÏτεÏο, εάν θέλετε να μποÏεί να χÏησιμοποιήσει την σελίδα vdremote για απομακÏυσμένη Ï€Ïόσβαση του λογαÏÎ¹Î±ÏƒÎ¼Î¿Ï Ï„Î¿Ï…. + +
+
+
+ΑÏιθμός ΓÏαμμών - Αυτό οÏίζει πόσες καταχωÏήσεις απομακÏυσμένων χÏηστών το σÏστημα δημιουÏ, και καθοÏίζει πόσες γÏαμμές μποÏεί με ασφάλεια να στείλει στον αÏιθμό παÏακάτω. + +
+
+
+IP Διακομιστή - Μία καταχώÏηση απομακÏυσμένου χÏήστη είναι μόνο καλό για ένα συγκεκÏιμένο διακομιστή, εδώ επιλέγετε τον διακομιστή που ανήκει. + +
+
+
+ΕξωτεÏική Τηλ.ΣÏνδεση - Αυτός είναι ο αÏιθμός που θέλετε οι κλήσεις να Ï€ÏοωθοÏνται. Επιβεβαιώστε ότι είναι ένας πλήÏης αÏιθμός από το σχέδιο κλήεων και εάν θέλετε ένα 9 στην αÏχή το βάζετε εδώ. Κάντε μία δοκιμή καλώντας αυτόν τον αÏιθμό από ένα τηλέφωνο του συστήματος. + +
+
+
+Κτάσταση - Εδώ μποÏείτε να θέσετε τον απομακÏυσμένο χÏήστη σε ενεÏγό και μη ενεÏγό. Μόλις ο χÏήστης γίνει ενεÏγός το σÏστημα μποÏεί να στείλει κλήσεις σε αυτόν. ΜποÏεί να διαÏκέσει μέχÏι 30 δευτεÏόλεπτα μετά την αλλαγή της κατάστασης σε μη ενεÏγός, ώστε να σταματήσει να δέχεται κ. + +
+
+
+ΕκστÏατεία - Εδώ μποÏείτε να επιλέξετε την εκστÏατεία όπου οι απομακÏυσμένοι χÏήστες θα συνδεθοÏν. Για εισεÏχόμενες Ï€Ïέπει να χÏησιμοποιηθεί η εκστÏατεία CLOSER και επιλέξτε τις εισεÏχόμενες εκστÏατείες παÏακάτω, από που θέλετε να λαμβάνεται τις κλήσεις. + +
+
+
+ΕισεÏχόμενες Ομάδες - Εδώ μποÏείτε να επιλέξετε τις εισεÏχόμενες ομάδες που θέλετε να λαμβάνουν τις κλήσεις , εάν έχετε επιλέξει την εκστÏατεία CLOSER. + + +



+ +VICIDIAL_CAMPAIGN_ΛΙΣΤΕΣ

+
+
+Οι λίστες της εκστÏατείας παÏουσιάζονται εδώ, και εάν είναι ενεÏγές (Î¥ ή Î) μποÏείτε να πάτε στην οθόνη λίστας με το να πατήσετε στο ID λίστας, στην Ï€Ïώτη στήλη. + + +



+ +VICIDIAL_CAMPAIGN_STATUSES ΠΙÎΑΚΑΣ

+
+
+Με την χÏήση Ï€ÏοσαÏμοσμένων καταστάσεων εκστÏατείας, μποÏείτε να έχετε καταστάσεις μόνο για συγκεκÏιμένες εκστÏατείες. Η κατάσταση Ï€Ïέπει να είναι 1-8 χαÏακτήÏες, η πεÏιγÏαφή 2-30 χαÏακτήÏες και Επιλέξιμα καθοÏίζεται αν εμφανίζεται στο VICIDIAL ως τεÏματισμός. Ο τομέας χÏησιμοποιείται κατά τον υπολογισμό του ποσοστοÏπτώσης, ή εγκαταλείπει το ποσοστό. Η ÏÏθμιση την στο Î¥ θαχÏησιμοποιήσει αυτήν την θέση κατά υπολογισμό τωνανθÏώπινος-απαντημένων κλήσεων. Η επιλογή κατηγοÏίας επιτÏέπει σε σας για να ομαδοποιήσειδιάφοÏες θέσεις σε ένα catogy που μποÏεί να χÏησιμοποιηθεί γιατη στατιστική ανάλυση. + + + +



+ +VICIDIAL_CAMPAIGN_HOTKEYS ΠΙÎΑΚΑΣ

+
+
+Με την χÏήση Ï€ÏοσαÏμοσμένων κλειδιών εκστÏατείας, οι χÏήστες που χÏησιμοποιοÏν την εφαÏμογή vicidial μποÏοÏν να κλείσουν και να τεÏματίσουν την κλήση, με ένα μόνο πάτημα πλήκτÏου. There are two special HotKey options that you can use in conjunction with Alternate Phone number dialing, ALTPH2 - Alternate Phone Hot Dial and ADDR3-----Address3 Hot Dial allow an agent to use a hotkey to hang up their call, stay on the same lead, and dial another contact number from that lead. + + + + + +



+ +VICIDIAL_LEAD_RECYCLE ΠΙÎΑΚΑΣ

+
+
+Through the use of lead recycling, you can call specific statuses of leads again at a specified interval without resetting the entire list. Lead recycling is campaign-specific and does not have to be a selected dialable status in your campaign. The attempt delay field is the number of seconds until the lead can be placed back in the hopper, this number must be at least 120 seconds. The attempt maximum field is the maximum number of times that a lead of this status can be attempted before the list needs to be reset, this number can be from 1 to 10. You can activate and deactivate a lead recycle entry with the provided links. + + + + + +



+ +VICIDIAL ΑΥΤΟΜΑΤΕΣ ΘΈΣΕΙΣ ΠΙÎΑΚΩΠALT

+
+
+Εάν ο αυτόματος τομέας ÏƒÏ‡Î·Î¼Î±Ï„Î¹ÏƒÎ¼Î¿Ï ALT-ARJCMOY' τίθεται,κατόπιν οι μόλυβδοι που είναι κάτω από αυτές τις αυτόματεςθέσεις πινάκων ALT θα σχηματίσουν το alt_phone και-ή τουςτομείς address3 τους αφότου τίθενται οποιεσδήποτε από αυτέςτις θέσεις κανένας-απάντησης. + + + + + +



+ +VICIDIAL ΚΩΔΙΚΕΣ ΜΙΚΡΗΣ ΔΙΑΚΟΠΉΣ ΠΡΑΚΤΟΡΩÎ

+
+
+_ εάν ο Ï€ÏάκτοÏας διακοπή κωδικοποιώ ενεÏγός τομέας είμαι θέτωνα ενεÏγός έπειτα ο Ï€ÏάκτοÏας θα είμαι σε θέση να επι:λέγω απόαυτός διακοπή κώδικας όταν αυτός χτυπώ ο ΔΙΑΚΟΠΉ κουμπί τουςοθόνη. Αυτό το στοιχείο αποθηκεÏεται έπειτα στο vicidialκοÏτσουÏο Ï€ÏακτόÏων. Ο κώδικας μικÏής διακοπής Ï€Ïέπει ναπεÏιέχει μόνο τα γÏάμματα και τους αÏιθμοÏÏ‚ και να είναιλιγότεÏο από 7 χαÏακτήÏες μακÏοχÏόνιοι. Το όνομα κώδικα μικÏήςδιακοπής δεν μποÏεί να είναι πλέον από 30 χαÏακτήÏες. + + + + + +



+ +VICIDIAL_USER_GROUPS ΠΙÎΑΚΑΣ

+
+
+Ομάδα ΧÏήστη - Αυτό είναι το σÏντομο όνομα της Vicidial ομάδας χÏήστη, Ï€Ïσπαθήστε να μην χÏησιμοποιήσετε κενά ή στίξεις για αυτό το πεδίο. Από 2 μέχÏι 20 χαÏακτήÏες. + +
+
+
+Ονομα Ομάδας- Αυτή είναι η πεÏιγÏαφή της vicidial ομάδας χÏήστη μέχÏι 40 χαÏακτήÏες. + +
+
+
+ΕκστÏατείες - αυτό είναι ένας επιλέξιμος κατάλογος εκστÏατειώνστον οποίο τα μέλη αυτής της ομάδας χÏηστών μποÏοÏν νασυνδεθοÏν. Η επιλογή όλος-ΕΚΣΤΡΑΤΕΙΩΠεπιτÏέπει στους χÏήστες σεαυτήν την ομάδα για να δει και να συνδεθεί σε οποιαδήποτεεκστÏατεία στο σÏστημα. + + + + + +



+ +VICIDIAL_ΒΟΗΘΟΙ ΠΙÎΑΚΑΣ

+
+
+Ταυτότητα Î’Î¿Î·Î¸Î¿Ï - αυτό είναι το σÏντομο όνομα ενός ΒοπηθοÏ. ΠÏέπει να είναι ένα μοναδικό Ï€ÏοσδιοÏιστικό. ΠÏοσπαθήστε να μην χÏησιμοποιήσετε οποιαδήποτε διαστήμα ή στίξη για τους 10 χαÏακτήÏες Î±Ï…Ï„Î¿Ï Ï„Î¿Ï… πεδίου, ελάχιστο 2 χαÏακτήÏων. + +
+
+Όνομα Î’Î¿Î·Î¸Î¿Ï - αυτός είναι ο τίτλος ενός ΒοηθοÏ. Αυτή είναι μια σÏντομη πεÏίληψη. 2-50 χαÏακτήÏες. Δεν Ï€Ïέπει να υπάÏξουν διάστηματα ή στίξεις σε αυτό το πεδίο. + +
+
+Σχόλια Î’Î¿Î·Î¸Î¿Ï - εδώ μποÏείτε να τοποθετήσετε τα σχόλια για έναν Βοηθό. 2-255 χαÏακτήÏες . + +
+
+Κείμενο χειÏόγÏαφου - This is where you place the content of a Vicidial Script. Minimum of 2 characters. You can have customer information be auto-populated in this script using "--A--field--B--" where field is one of the following fieldnames: vendor_lead_code, source_id, list_id, gmt_offset_now, called_since_last_reset, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments, lead_id, campaign, phone_login, group, channel_group, SQLdate, epoch, uniqueid, customer_zap_channel, server_ip, SIPexten, session_id. For example, this sentence would print the persons name in it----

Hello, can I speak with --A--first_name--B-- --A--last_name--B-- please? Well hello --A--title--B-- --A--last_name--B-- how are you today?

This would read----

Hello, can I speak with John Doe please? Well hello Mr. Doe how are you today?

You can also use an iframe to load a separate window within the SCRIPT tab, here is an example with prepopulated variables: + +
+<iframe src="http://astguiclient.sf.net/test_VICIDIAL_output.php?lead_id=--A--lead_id--B--&vendor_id=--A--vendor_lead_code--B--&list_id=--A--list_id--B--&gmt_offset_now=--A--gmt_offset_now--B--&phone_code=--A--phone_code--B--&phone_number=--A--phone_number--B--&title=--A--title--B--&first_name=--A--first_name--B--&middle_initial=--A--middle_initial--B--&last_name=--A--last_name--B--&address1=--A--address1--B--&address2=--A--address2--B--&address3=--A--address3--B--&city=--A--city--B--&state=--A--state--B--&province=--A--province--B--&postal_code=--A--postal_code--B--&country_code=--A--country_code--B--&gender=--A--gender--B--&date_of_birth=--A--date_of_birth--B--&alt_phone=--A--alt_phone--B--&email=--A--email--B--&security_phrase=--A--security_phrase--B--&comments=--A--comments--B--&user=--A--user--B--&campaign=--A--campaign--B--&phone_login=--A--phone_login--B--&fronter=--A--fronter--B--&closer=--A--user--B--&group=--A--group--B--&channel_group=--A--group--B--&SQLdate=--A--SQLdate--B--&epoch=--A--epoch--B--&uniqueid=--A--uniqueid--B--&customer_zap_channel=--A--customer_zap_channel--B--&server_ip=--A--server_ip--B--&SIPexten=--A--SIPexten--B--&session_id=--A--session_id--B--&phone=--A--phone--B--" style="width:580;height:290;background-color:transparent;" scrolling="auto" frameborder="0" allowtransparency="true" id="popupFrame" name="popupFrame" width="460" height="290" STYLE="z-index:17"> +</iframe> +
+ +
+
+
+ΕνεÏγός - αυτό καθοÏίζει εάν αυτός ο οδηγός μποÏεί να επιλεχτεί για να χÏησιμοποιηθεί από μια εκστÏατεία. + + + + + +



+ +VICIDIAL_LEAD_ΦΙΛΤΡΑ ΠΙÎΑΚΑΣ

+
+
+ID ΦίλτÏου - Αυτό είναι το σÏντομο όνομα ενός ΦίλτÏου ΟδηγοÏ. ΠÏέπει να είναι ένας μοναδικός κωδικός. Μην χÏησιμοποιήσετε κενά ή στίξη για αυτό το πεδίο. ΧαÏακτήÏες 2 με 10. + +
+
+Ονομα ΦίλτÏου - Αυτό είναι ένα πιο πεÏιγÏαφικό όνομα για το ΦίλτÏο. Είναι μία σÏντομη πεÏιγÏφή του φίλτÏου. ΧαÏακτήÏες 2 με 30. + +
+
+Σχόλια ΦίλτÏου - Εδώ μποÏείτε σχολιάσετε το φίλτÏο. ΧαÏακτήÏες 2 με 255. + +
+
+SQL ΦίλτÏου - Εδώ μποÏείτε να οÏίσετε SQL εÏώτημα για το φίλτÏο. Μην ξεκινήσετε ή τελειώσετε με ένα AND, αυτό θα γίνει αυτόματα από το hopper. Ένα παÏάδειγμα είναι- called_count > 4 and called_count < 8 -. + + + + + +



+ +VICIDIAL_ΧΡΟÎΟΙ ΚΛΗΣΕΩΠΠΙÎΑΚΑΣ

+
+
+ID ΧÏόνου Κλήσης - Αυτό είναι το σÏντομο όνομα του ΟÏÎ¹ÏƒÎ¼Î¿Ï Î§Ïόνου Κλήσης. ΠÏέπει να είναι ένα μοναδικό στοιχείο. Μην χÏησιμοποιηθοÏν διαστήματα ή στίξεις. 2-10 χαÏατήÏες. + +
+
+Ονομα ΧÏόνου Κλήσης - Αυτό είναι ένα πιο πεÏιγÏαφικό όνομα του ΟÏÎ¹ÏƒÎ¼Î¿Ï Î§Ïόνου Κλήσης. Είναι μία σÏντομη πεÏιγÏαφή. 2-30 χαÏακτήÏεςΣχόλια ΧÏόνου Κλήσης - This is where you can place comments for a Vicidial Call Time Definition such as -10am to 4pm with extra call state restrictions-. max 255 characters. + +
+
+Σχόλια ΧÏόνου Κλήσης - This is where you can place comments for a Vicidial Call Time Definition such as -10am to 4pm with extra call state restrictions-. max 255 characters. + +
+
+ΠÏοκαθοÏισμένοι ΧÏόνοι Εκκίνησης και ΠαÏσης - Αυτός είναι ο Ï€ÏοκαοÏισμένος χÏόνος όπου θα επιτÏέπετε οι κλήσεις εάν δεν έχει οÏιστεί ο χÏόνος εκκίνησης της ημέÏας-της-εβδομάδας. 0 είναι μεσάνυχτα. Εάν δεν θέλετε καμία κλήση θέστε αυτό το πεδίο σε 2400 και το Ï€ÏοκαθοÏισμένο χÏόνο ΠαÏσης σε 2400. Για να επιτÏέψετε την 24ωÏη κλήση την ημέÏα θέστε σε 0 τον χÏόνο εκκίνησης και σε 2400 τον χÏόνο παÏσης +. + +
+
+Εβδομαδιαίοι ΧÏόνοι Εκκίνησης και ΠαÏσης - Αυτοί είναι Ï€ÏοσαÏμόσιμοι χÏόνοι ανά ημέÏα για τον οÏισμό χÏόνων κλήσεων. + +
+
+ΟÏισμοί ΧÏόνων Κλήσεων Καταστάσεων - Είναι η λίστα συγκεκÏιμένων ΟÏισμών ΧÏόνων Κλήσεων Καταστάσεων. + +
+
+Κατάσταση ΧÏόνου Κλήσης Κατάστασης - Αυτό είναι ο δÏο γÏαμμάτων κωδικός για την κατάσταση όπου ο οÏισμός χÏόνου κλήης είναι για. Θα Ï€Ïέπει και οι Οδηγοί της εκστÏατείας να έχουν δÏο γÏάμματα κωδικοÏÏ‚ κατάστασης για τον χÏόνο κλήσης κατάστασης. + + + + +



+ +ΛΕΙΤΟΥΡΓΙΑ ΕΙΣΑΓΩΓΗΣ ΛΙΣΤΑΣ

+
+
+Ο βασικός βασισμένος στο WEB φοÏτωτής μολÏβδου VICIDIALσχεδιάζεται απλά για να πάÏει ένα αÏχείο μολÏβδου - μέχÏι8MB στο μέγεθος - που είναι είτε ετικέττα είτε σωλήνας πουοÏιοθετείται και τον φοÏτώνει στον πίνακα vicidial_list. ΟφοÏτωτής μολÏβδου επιτÏέπει τον τομέα επιλέγοντας και TXT -σαφές κείμενο, CSV - κόμμα χώÏισε τις τιμές και XLS -σχήματα αÏχείων Excel. Ο φοÏτωτής μολÏβδου δεν κάνει τηνεπικÏÏωση στοιχείων, αλλά επιτÏέπει σε σας για να ελέγξει για τααντίγÏαφα σε το, μέσα στην εκστÏατεία ή μέσα το σε ολόκληÏοσÏστημα. Επίσης, σιγουÏευτείτε ότι έχετε δημιουÏγήσει τονκατάλογο ότι αυτοί οι μόλυβδοι Ï€Ïόκειται να κάτω έτσι ώστεμποÏείτε να τους χÏησιμοποιήσετε. Εδώ είναι ένας κατάλογος τωντομέων στην κατάλληλη διαταγή τους για τα αÏχεία μολÏβδου: +
    +
  1. Κωδικός ÎŸÎ´Î·Î³Î¿Ï Î ÏÎ¿Î¼Î·Î¸ÎµÏ…Ï„Î¿Ï +
  2. Πηγαίος Κώδικας - εσωτεÏική χÏήση μόνο από διαχειÏιστές και DBAs +
  3. ID λίστας - ο αÏιθμός λίστας που οι οδηγοί θα παÏουσιαστοÏν κάτω από +
  4. Κωδικός τηλεφώνου - το Ï€Ïόθεμα του Ï„Î·Î»ÎµÏ†Ï‰Î½Î¹ÎºÎ¿Ï Î±ÏÎ¹Î¸Î¼Î¿Ï (1 για ΗΠΑ, 01144 για Î’Ïετανία κλπ) +
  5. Ο αÏιθμός τηλεφώνου - Ï€Ïέπει να είναι τουλάχιστον 8 ψηφία +
  6. Τίτλος - ο τίτλος του πελάτη (κος. κα. κλπ) +
  7. Ονομα +
  8. Μεσαίο ΑÏχικό +
  9. Επίθετο +
  10. 1 ΓÏαμμή ΔιεÏθυνσης +
  11. 2 ΓÏαμμή ΔιεÏθυνσης +
  12. 3 ΓÏαμμή ΔιεÏθυνσης +
  13. Πόλη +
  14. ΚÏάτος - πεÏιοÏισμός σε 2 χαÏακτήÏες +
  15. ΕπαÏχία +
  16. Ταχ.Κωδ. +
  17. ΧώÏα +
  18. ΦÏλο +
  19. ΗμεÏ. Γέννησης +
  20. Εναλ. ΑÏιθμός Τηλ. +
  21. ΔιεÏθυνση ΗλεκτÏ.ΤαχυδÏομείου +
  22. ΦÏάση Ασφαλείας +
  23. Σχόλια +
+ +
ΣΗΜΕΙΩΣΕΙΣ: Η λειτουÏγία φοÏτωτών μολÏβδου Excel επιτÏέπεταιαπό μια σειÏά χειÏογÏάφων perl και Ï€Ïέπει να έχει κατάλληλαδιαμοÏφωμένη/ένα αÏχείο κ.λπ.../astguiclient.conf σε Î¹ÏƒÏ‡Ï ÏƒÏ„Î¿Î½ÎºÎµÎ½Ï„Ïικό υπολογιστή δικτÏου. Επίσης, οι ενότητες ζευγών perlÏ€Ïέπει να φοÏτωθοÏν για το για να εÏγαστοÏν επίσης - ολε-Storage_Lite και υπολογισμός με λογιστικό φÏλλο(spreadsheet)- ParseExcel. ΜποÏείτε να ελέγξετε για τα λάθηχÏόνου εκτέλεσης σε αυτοί με την εξέταση το αÏχείο apache σαςerror_log. Επίσης, για τους ελέγχους Î´Î¹Ï€Î»Î±ÏƒÎ¹Î±ÏƒÎ¼Î¿Ï ÎµÎ½Î¬Î½Ï„Î¹Î± στουςκαταλόγους gampaign, ο κατάλογος που έχει τα νέα Ï€Ïοβαδίσματαπου πηγαίνουν σε το Ï€Ïέπει να δημιουÏγηθεί στο σÏστημα Ï€ÏÎ¿Ï„Î¿Ï Î½Î±Î±Ïχίσετε να φοÏτώνετε τους μολÏβδους. + + + + +



+ + + + + + +ΠΙÎΑΚΑΣ ΤΗΛΕΦΩÎΩÎ

+
+
+Εωτ.ΣÏνδεση Τηλεφώνου - Αυτό το πεδίο είναι για την καταχώÏηση του ονόματος του τηλεφώνου, όπως αυτό εμφανίζεται στο Asterisk, χωÏίς να συμπεÏιλαμβάνει το Ï€Ïωτόκολλο ή slash στην αÏχή. Για παÏάδειγμα: για SIP τηλέφωνο SIPVtest101 η Εσω.ΓÏαμμή Τηλεφώνου θα είναι test101. Επίσης, για IAX2 τηλέφωνα χÏησιμοποιείστε τα πλήÏης ονόματα: IAX2/IAXphone1@IAXphone1 θα είναι IAXphone1@IAXphone1. Για Zap τηλέφωνα καταχωÏήστε το πλήÏες κανάλι: Zap/25-1 θα είναι 25-1. Αλλη σημείωση, οÏίστε το Ï€Ïωτόκολλο παÏακάτω σωστά για τον Ï„Ïπο του τηλεφώνου. + +
+
+
+ΑÏιθμός Σχεδίου Κλήσεων - Αυτό το πεδίο είναι για τον αÏιθμό που καλείται για να κουδουνίζει το τηλέφωνο. Αυτός ο αÏιθμός οÏίζεται στο αÏχείο extensions.conf του διακομιστή Asterisk + +
+
+
+ΠεÏιεχόμενο Î¦Ï‰Î½Î·Ï„Î¹ÎºÎ¿Ï Î¤Î±Ï‡Ï…Î´Ïομείου - Αυτό το πεδίο είναι για το πεÏιεχόμενο του Ï†Ï‰Î½Î·Ï„Î¹ÎºÎ¿Ï Ï„Î±Ï‡Ï…Î´Ïομείου, όπου πηγαίνουν τα μηνÏματα του τηλεφώνου του χÏήστη. Το χÏησιμοποιοÏμαι για να ελέγξουμε τα φωνητικά μηνÏματα και για να μποÏεί ο χÏήστης να χÏησιμοποιήσει το πλήκτÏο VOICEMAIL. + +
+
+
+CallerID ΕξεÏχομένων - Αυτό το πεδίο είναι για την καταχώÏιση του αÏÎ¹Î¸Î¼Î¿Ï callerID που θα θέλατε να εμφανίζεται στις εξεÏχόμενες κλήσεις. + +
+
+
+Δνση IP Τηλεφώνου - Αυτό το πεδίο είναι για την δνση IP του τηλέφωνου εάν είναι ένα VOIP τηλέφωνο. Αυτό είναι ένα Ï€ÏοαιÏετικό πεδίο + +
+
+
+Δνση IP Î¥Ï€Î¿Î»Î¿Î³Î¹ÏƒÏ„Î¿Ï - Αυτό το πεδίο είναι για την δνση IP του υπολογιστή του χÏήστη. Αυτό είναι ένα Ï€ÏοαιÏετικό πεδίο + +
+
+
+IP Διακομιστή - Αυτός ο κατάλογος επιλογών είναι που επιλέγετε σε ποιον διακομιστή το τηλέφωνο είναι ενεÏγό. + +
+
+
+ΣÏνδεση - η σÏνδεση που χÏησιμοποιείται για τον τηλεφωνικό χÏήστηστη σÏνδεση στις εφαÏμογές πελατών. + +
+
+
+Κωδικός Ï€Ïόσβασης - ο κωδικός Ï€Ïόσβασης που χÏησιμοποιείται γιατον τηλεφωνικό χÏήστη στη σÏνδεση στις εφαÏμογές πελατών. + +
+
+
+Κατάσταση - Η κατάσταση του τηλεφώνου στο σÏστημα, ΕÎΕΡΓΗ και ΔΙΑΧ επιτÏέπουν στους GUI πελάτες να δουλέψουν. Η ΔΙΑΧ επιτÏέπει την Ï€Ïόσβαση στην ιστοσελίδα διαχείÏισης. + +
+
+
+ΕνεÏγός ΛογαÏιασμός - Κατά πόσο το τηλέφωνο είναι ενεÏγό για να τοποθετηθεί στην λίστα στο GUI. + +
+
+
+ΤÏπος Τηλεφώνου - Απλά για σημειώσεις διαχείÏισης. + +
+
+
+ΠλήÏες Ονομα - ΧÏησιμοποιείται από τον χÏήστη GUI στην λίστα ενεÏγών τηλεφώνων. + +
+
+
+ΕταιÏία - Απλά για σημειώσεις διαχείÏισης. + +
+
+
+Εικόνα - Δεν έχει υλοποιηθεί ακόμα. + +
+
+
+Îέα ΜηνÏματα - ΑÏιθμός νέων φωνητικών μηνυμάτων για αυτό το τηλέφωνο στον διακομιστή Asterisk. + +
+
+
+Παλαιά ΜηνÏματα - ΑÏιθμός παλαιών φωνητικών μηνυμάτων για αυτό το τηλέφωνο στον διακομιστή Asterisk. + +
+
+
+ΠÏωτόκολλο Πελάτη - Το Ï€Ïωτόκολλο που χÏησιμοποιεί το τηλέφωνο για συνδεθεί στον διακομιστή Asterisk: SIP, IAX2, Zap. + +
+
+
+οπική GMT - Η διαφοÏά από την GMT όπου το τηλέφωνο βÏίσκεται. Μην το Ïυθμίσετε για DAYLIGHT SAVINGS ΩΡΑ. Αυτή χÏησιμοποιείται από την VICIDIAL εκστÏατεία για την επακÏιβή εμφάνιση της ÏŽÏας. + +
+
+
+ΣÏνδεση ΔιαχειÏιστή - Αυτή είναι η σÏνδεση που χÏησιμοποιοÏν οι GUI χÏήστες του τηλεφώνου, για Ï€Ïόσβαση στην Βάση Δεδομένων όπου ο διακομιστής δεδομένων βÏίσκεται. + +
+
+
+Μυστικό ΔιαχειÏιστή - Αυτός είναι ο κωδικός που χÏησιμοποιοÏν οι GUI χÏήστες του τηλεφώνου, για Ï€Ïόσβαση στην Βάση Δεδομένων όπου ο διακομιστής δεδομένων βÏίσκεται. + +
+
+
+ΠÏοκαθοÏισμένος VICIDIAL ΧÏήστης - Εδώ οÏίζεται μία Ï€ÏοκαθοÏισμένη τιμή χÏήστη, οπουδήποτε αυτός ο χÏήστης τηλεφώνου ανοίξει την εφαÏμογή VICIDIAL. Αφήστε κενό για κανένα χÏήστη. + +
+
+
+ΠÏοκαθοÏισμένος VICIDIAL Κωδικός - Εδώ οÏίζεται μία Ï€ÏοκαθοÏισμένη τιμή κωδικοÏ, οπουδήποτε αυτός ο χÏήστης τηλεφώνου ανοίξει την εφαÏμογή VICIDIAL. Αφήστε κενό για κανένα κωδικό. + +
+
+
+VICIDIAL ΠÏοκαθοÏισμένη ΕκστÏατεία - Εδώ οÏίζεται μα Ï€ÏοκαθοÏισμένη τιμή εκστÏατείας, οπουδήποτε αυτός ο χÏήστης τηλεφώνου ανοίξει την εφαÏμογή VICIDIAL. Αφήστε κενό για καμία εκστÏατεία. + +
+
+
+Εσ.ΣÏνδ. Στάθμευσης - Αυτή είναι η Ï€ÏοκαθοÏισμένη εσωτ.σÏνδεση Στάθμευσης για τις εφαÏμογές του χÏήστη. + +
+
+
+Εσ.ΣÏνδ. Συνδιάλεξης - Αυτή είναι η Ï€ÏοκαθοÏισμένη εσωτ.σÏνδεση Συνδιάλεξης για τις εφαÏμογές του χÏήστη. + +
+
+
+Εσωτ.ΣÏνδεση Στάθμευσης VICIDIAL - Η Ï€ÏοκαθοÏισμένη εσωτ.σÏνδεση στάθμευσης. ΕξακÏιβώστε ότι κάποια διαφοÏετική δουλεÏει Ï€Ïιν την αλλάξετε. + +
+
+
+ ΑÏχείο Στάθμευσης VICIDIAL - Το Ï€ÏοκαθοÏισμένο αÏχείο στάθμευσης. ΜέχÏι 10 χαÏακτήÏες. + +
+
+
+ΠÏόθεμα παÏακολοÏθησης - Αυτό είναι το Ï€Ïόθεμα παÏακολοÏθησης των καναλιών ZAP. + +
+
+
+Εσωτ.ΣÏνδεση ΗχογÏάφησης - Αυτή είναι η εσωτ.σÏνδεση του πλάνου κλήσεων για την εσωτ.σÏνδεση ηχογÏάφησης που χÏησιμοποιείται για μεταφοÏά στις συνδιαλέξεις, ώστε να ηχογÏαφηθοÏν.Extensions.conf . + +
+
+
+Βασική Εσωτ.ΣÏνδεση VMAIL - Αυτή είναι η εσωτ.σÏνδεση του πλάνου κλήσεων που ελέγχει την θυÏίδα ηχητικών μηνυμάτων. + +
+
+
+Εσωτ.ΣÏνδεση απόÏÏιψης VMAIL - Αυτο είναι το Ï€Ïόθεμα του πλάνου κλήσεων που χÏησιμοποιείται στο να στέλνει κλήσεις κατευθείαν στη θυÏίδα του χÏήστη από μία κλήση. + +
+
+
+ΠεÏιεχόμενο Εσωτ.ΣÏνδεσης - Αυτό είναι το πεÏιεχόμενο του πλάνου κλήσεων όπου το τηλέφωνο χÏησιμοποιεί. + +
+
+
+Κανάλι αποστολής DTMF - Αυτό είναι το κανάλι του χÏησιμοποιείται για την αποστολή DTMF ήχων στις συνδιαλέξεις. + +
+
+
+ΕξεÏχόμεη ομάδα κλήσης - αυτή είναι η ομάδα ÎºÎ±Î½Î±Î»Î¹Î¿Ï ÏŒÏ€Î¿Ï… οι εξεÏχόμενες κλήσεις από αυτό το τηλέφωνο τοποθετοÏνται. ΥπάÏχουν Ïουτίνες που την χÏησιμοποιοÏν. Για τα κανάλια Zap θέλετε να χÏησιμοποιήσετε κάτι σαν Zap/g2, για IAX2 trunks θα θέλετε να χÏησιμοποιήσετε το πλήÏες Ï€Ïόθεμα IAX όπως IAX2/VICItest1:secret@10.10.10.15:4569. Ελέγξτε τα trunks με το αÏχείο extensions.conf. + +
+
+
+ΠεÏιοχή Ιστο-Î Î»Î¿Î·Î³Î¿Ï - Αυτό χÏειάζεται μόνο σε Linux συστήματα. + +
+
+
+Κατάλογος Εγκατάστασης - . + +
+
+
+CallerID URL - Αυτή είναι η Δνση της ιστοσελίδας που χÏησιμοποιείται για αναζήτηση με callerID + +
+
+
+ΠÏοκαθοÏισμένο VICIDIAL URL - Αυτή είναι η δνση ιστοσελίδας που χÏησιμοποιείται για Ï€ÏοσαÏμοσμένα VICIDIAL εÏωτήματα ιστοσελίδας + +
+
+
+ΚαταγÏαφή Γεγονότων Κλήσης - Αυτό τοποθετείται σε αληθές εάν το αÏχείο call_log.agi βÏίσκεται στο αÏχείο extensions.conf για τις εξεÏχόμενες κλήσεις και για τις εσωτ.συνδέσεις 'h' που κλείνουν. Αυτό Ï€Ïέπει πάντα να είναι 1 για να δουλεÏουν σωστά πολλά χαÏακτηÏιστικά των εφαÏμογών. + +
+
+
+Μεταγωγή ΧÏήστη - Εάν το θέσετε σε αληθές θα επιτÏέπετε στους χÏήστες να μεταβοÏν σε άλλον λογαÏιασμό χÏήστη + +
+
+
+Σε συνδιάλεξη - Εάν το θέσετε σε αληθές θα επιτÏέπετε στους χÏήστες να ξεκινοÏν συνδιαλέξεις μέχÏι 6 εξωτεÏικές γÏαμμές. + +
+
+
+ΔιαχειÏÎ¹ÏƒÏ„Î¿Ï ÎšÎ»ÎµÎ¯ÏƒÎ¹Î¼Î¿- Εάν το θέσετε σε αληθές θα επιτÏέπετε στους χÏήστες να κλείνουν κάθε γÏαμμή. + +
+
+
+ΔιαχειÏÎ¹ÏƒÏ„Î¿Ï ÎšÎ»Î­ÏˆÎ¹Î¼Î¿ - Εάν το θέσετε σε αληθές θα επιτÏέπετε στους χÏήστες να λαμβάνουν και να ανακατευθÏνουν στην εσωτ.σÏνδεσή τους οποιαδήποτε γÏαμμή. + +
+
+
+ΔιαχειÏÎ¹ÏƒÏ„Î¿Ï Î Î±ÏακολοÏθηση - Εάν το θέσετε σε αληθές θα επιτÏέπετε στους χÏήστες να λαμβάνουν και να ανακατευθÏνουν στην εσωτ.σÏνδεσή τους οποιαδποτε γÏαμμή. + +
+
+
+Στάθμευση Κλήσης - Εάν το θέσετε σε αληθές θα επιτÏέπετε σε χÏήστες να σταθμεÏουν κλήσεις και κλήσεις σε αναμονή να διαχειÏίζονται από οποιοδήποτε άλλο Ïήστη. Οι κλήσεις μένουν σε αναμονή για 30 δευτεÏόλεπτα και μετά κλείνουν. Συνήθως ενεÏγοποιημένη για όλους. + +
+
+
+ΕνεÏγοποιημένη ΟυÏά - Εάν το θέσετε σε αληθές θα εμφανίζεται ένα παÏάθυÏο ειδοποίησης, ότι η ÏŽÏα ενημέÏωσης δεν έχει αλλάξει σε 20 δευτεÏόλεπτα. + +
+
+
+AF ΚαταγÏαφή Γεγονότος - Εάν το θέσετε σε αληθές θα καταγÏάφονται οι ενέÏγειες χÏήσης του astGUIclient σε ένα αÏχείο στον υπολογιστή του χÏήστη. + +
+
+
+ΕνεÏγοποιημένη ΟυÏά - Εάν το θέσετε σε αληθές οι εφαÏμογές θα χÏησιμοποιοÏν το ACQS. + +
+
+
+ΥπεÏεμφανιζόμενο παÏαθÏÏο CallerID - Εάν το θέσετε σε αληθές θα επιτÏέψετε σε αÏιθμοÏÏ‚ οÏισμένους στο αÏχείο extensions.conf, να στέλνουν οθόνες με CallerID στους astGUIclient χÏήστες. + +
+
+
+VMail ΠλήκτÏο - Εάν το θέσετε σε αληθές θα εμφανιστεί το πλήκτÏο VOICEMAIL και τα μηνÏματα μποÏοÏν να εμφανίζονται στο astGUIclient. + +
+
+
+ΤαχÏτητα Ανανέωσης - Εάν το θέσετε σε αληθές ενεÏγοποιείται ένα νέο Ïυθμό ανανέωσης πληÏοφοÏιών κλήσης για το astGUIclient. ΠÏοκαθοÏισμένος απενεÏγοποιημένος Ïυθμός είναι 1000 ms (1 δευτεÏόλεπτο). + +
+
+
+Ρυθμός Ανανέωσης ΤαχÏτητας - σε χιλιοστά δευτεÏολέπτου. ΧÏημοποιείται μόνο εάν η ΤαχÏτητα Ανανέωσης είναι ενεÏγοποιημένη. ΠÏοκαθοÏισμένος απενεÏγοποιημένος Ïυθμός είναι 1000 ms (1 δευεÏόλεπτο). + +
+
+
+Συνεχής MySQL - Εάν είναι ενεÏγοποιημένο, το astGUIclient θα παÏαμένει συνδεμένο αντί να συνδέεται κάθε δευτεÏόλεπτο. + +
+
+
+Αυτόματη Κλήση Επόμενου ΑÏÎ¹Î¸Î¼Î¿Ï - Εάν είναι ενεÏγοποιημένο, μετά από τον τεÏματισμό θα γίνει κλήση του επόμενου αÏιθμοÏ, εκτός εάν επιλέξουμε "Μη κάνεις κλήσεις". + +
+
+
+Σταμάτα την ηχογÏάφηση μετά από κάθε κλήση - Εάν είναι ενεÏγοποιημένο η ηχογÏάφηση θα σταματήσει μετά τον τεÏματισμό. + +
+
+
+ΕπιτÏέψτε τα μηνÏματα SIPSAK - εάν επιτÏέπεται ο κεντÏικόςυπολογιστής θα στείλει τα μηνÏματα στο τηλέφωνο ΓΟΥΛΙÎΠστηνεπίδειξη στην τηλεφωνική LCD επίδειξη όταν συνδέεται μεVICIDIAL. Το χαÏακτηÏιστικό γνώÏισμα λειτουÏγεί μόνο με τατηλέφωνα ΓΟΥΛΙΩΠκαι απαιτεί sipsak την εφαÏμογή για ναεγκατασταθεί στον κεντÏικό υπολογιστή δικτÏου. Η Ï€Ïοεπιλογήείναι 0. + +
+
+
+DBΧ Διακομιστής - Ο διακομιστής της Βάσης Δεδομένων MySQL που ο χÏήστης θα συνδεθεί. + +
+
+
+DBΧ Βάση Δεδομένων - Η βάση δεδομένων MySQL στην οποία ο χÏήστης θα συνδεθεί. Η Ï€ÏοκαθοÏισμένη είναι asterisk. + +
+
+
+DBΧ ΧÏήστης - Ο χÏήστης MySQL για την σÏνδεση. Ο Ï€ÏοκαθοÏισμένος είναι cron. + +
+
+
+DBΧ Κωδικός - Ο κωδικός χÏήστη MySQL που ο χÏήστης χÏησιμοποιεί όταν συνδέεται. Ο Ï€ÏοκαθοÏισμένος είναι 1234. + +
+
+
+DBΧ ΠόÏτα - Η MySQL TCP πόÏτα που ο χÏήστης χÏησιμοποιεί όταν συνδέεται. Η Ï€ÏοκαθοÏισμένη είναι 3306. + +
+
+
+DBY Διακομιστής - Ο διακομιστής της Βάσης Δεδομένων MySQL που ο χÏήστης θα συνδεθεί. ΔευτεÏεÏονserver, μην χÏησιμοποιημένος αυτήν την πεÏίοδο. + +
+
+
+DBY Βάση Δεδομένων - Η βάση δεδομένων MySQL στην οποία ο χÏήστης θα συνδεθεί. Η Ï€ÏοκαθοÏισμένη είναι asterisk. ΔευτεÏεÏονserver, μην χÏησιμοποιημένος αυτήν την πεÏίοδο. + +
+
+
+DBY ΧÏήστης - Ο χÏήστης MySQL για την σÏνδεση. Ο Ï€ÏοκαθοÏισμένος είναι cron. ΔευτεÏεÏονserver, μην χÏησιμοποιημένος αυτήν την πεÏίοδο. + +
+
+
+DBY Κωδικός - Ο κωδικός χÏήστη MySQL που ο χÏήστης χÏησιμοποιεί όταν συνδέεται. Ο Ï€ÏοκαθοÏισμένος είναι 1234. ΔευτεÏεÏονserver, μην χÏησιμοποιημένος αυτήν την πεÏίοδο. + +
+
+
+DBY ΠόÏτα - Η MySQL TCP πόÏτα που ο χÏήστης χÏησιμοποιεί όταν συνδέεται. Η Ï€ÏοκαθοÏισμένη είναι 3306. ΔευτεÏεÏονserver, μην χÏησιμοποιημένος αυτήν την πεÏίοδο. + + +



+ +ΠΙÎΑΚΑΣ ΔΙΑΚΟΜΙΣΤΩÎ

+
+
+ID Διακομιστή - Σε αυτό το πεδίο οÏίζεται το όνομα του διακομιστή Asterisk, είναι μόνο μία επωνυμία ώστε να αναγνωÏίζεται από τους διαχειÏιστές. + +
+
+
+ΠεÏιγÏαφή Διακομιστή - Το πεδίο στο οποίο πεÏιγÏάφεται με μία φÏάση τον διακομιστή Asterisk. + +
+
+
+Δνση IP Διακομιστή - Το πεδίο που οÏίζεται η δνση IP του δικτÏου του διακομιστή Asterisk. + +
+
+
+ΕνεÏγός - ΟÏίζει κατά πόσον ο διακομιστής Asterisk είναι ενεÏγός ή μη ενεÏγός. + +
+
+
+Εκδοση Asterisk. + +
+
+
+Μέγιστος ΑÏιθμός Trunk του VICIDIAL - Αυτό το πεδίο θα Ï€ÏοσδιοÏίσει τον μέγιστο αÏιθμό γÏαμμών, τις οποίες θα χÏησιμοποιήσει η διεÏγασία αυτόατης κλήσης. Εάν θέλετε να αφιεÏώσετε δÏο PRI σε ένα διακομιστή τότε θα Ï€Ïέπει να το οÏίσετε σε 46. Το Ï€ÏοκαθοÏισμένο είναι 96. + +
+
+
+Telnet Πελάτης - Αυτή είναι η δνση ή το όνομα του διακομιστή Asterisk και το πώς οι εφαÏμογές διαχείÏισης συνδέονται σε αυτόν, όπου Ï„Ïέχουν. Το Ï€ÏοκαθοÏισμένο είναι 'localhost'. + +
+
+
+ΠόÏτα Telnet - Αυτή είναι η πόÏτα της σÏνδεσης με τον διαχειÏιστή του διακομιστή Asterisk και το πώς οι εφαÏμογές διαχείÏισης συνδέονται σε αυτόν, όπου Ï„Ïέχουν. Το Ï€ÏοκαθοÏισμένο είναι '5038'. + +
+
+
+ ΔιαχειÏιστής ΧÏήστης - Το όνομα χÏήστη που χÏησιμοποιείτε γενικά για τον διαχειÏιστή του διακομιστή Asterisk. Το Ï€ÏοκαθοÏισμένο είναι 'cron' + +
+
+
+Μυστικό ΔιαχειÏιστή - Το μυστικό ή κωδικός που χÏησιμοποιείτε γενικά για τον διαχειÏιστή του διακομιστή Asterisk. Το Ï€ÏοκαθοÏισμένο είναι '1111' + +
+
+
+ΕνημέÏωση ΧÏήστη ΔιαχειÏιστή - Το όνομα χÏήστη που χÏησιμοποιείτε για σÏνδεση στον διακομιστή Asterisk, βελτιστοποιημένο για διεÏγασίες ενημέÏωσης. Το Ï€ÏοκαθοÏισμένο είαι 'updatecron'. + +
+
+
+Ακουσμα ΧÏήστη ΔιαχειÏιστή- Το όνομα χÏήστη που χÏησιμοποιείτε για σÏνδεση στον διακομιστή Asterisk, βελτιστοποιημένο για διεÏγασίες που μόνο ακοÏν για έξοδο. Τ Ï€ÏοκαθοÏισμένο είναι 'listencron'. + +
+
+
+Αποστολή Διακομιστή ΔιαχειÏιστή- Το όνομα χÏήστη που χÏησιμοποιείτε για σÏνδεση στον διακομιστή Asterisk, βελτιστοποιημένο για διεÏγασίες που μόνο στέλνουν ΕνέÏγειες στον διαχειÏιστή.Το Ï€ÏοκαθοÏισμένο είναι 'sendcron'. + +
+
+
+GMT offset Διακομιστής - Η διαφοÏά σε ÏŽÏες από την GMT ÏŽÏα που δεν έχει Ïυθμιστεί με Daylight-Savings-Time. Το Ï€ÏοκαθοÏισμένο είναι '-5' + +
+
+
+Εσωτ.σÏνδεση απόÏÏιψης VMail - Το Ï€Ïόθεμα εσωτ.σÏνδεσης που χÏησιμοποιείται στον διακομιστή για να στείλει τις κλήσεις κατευθείαν μέσω agc σε ένα συγκεκÏιμένο φωνητικό ταχυδÏομείο. Το Ï€ÏοκαθοÏισμένο είναι '85026666666666' + +
+
+
+VICIDIAL AD εσωτ.σÏνδεση - Η Ï€ÏοκαθοÏισμένη εσωτ.σÏνδεση εάν δεν έχει οÏιστεί στην εκστÏατεία για να στείλει τις κλήσεις στην διεÏγασία αυτόματης κλήσης. Η Ï€ÏοκαθοÏισμένη είναι '8365' + +
+
+
+ΠÏοκαθοÏισμένο ΠεÏιεχόμενο - Το Ï€ÏοκαθοÏισμένο πεÏιεχόμενο του πλάνου κλήσεων για διεÏγασίες του διακομιστή. Το Ï€ÏοκαθοÏισμένο είναι 'Ï€ÏοκαθοÏισμένο' + +
+
+
+Επίδοση Συστήματος - Θέτοντας αυτήν την επιλογή σε Î, θα ενεÏγοποιήσετε την καταγÏαφή στατιστικών γεγονότων επίδοσης για τον διακομιστή, συμπεÏιλαμβάνοντας το φόÏτο του συστήματος, τις διεÏγασίες και τα κανάλια που χÏησιμοποιεί. ΠÏοκαθοÏισμένα είναι Ο. + +
+
+
+Γεγονότα Διακομιστή - Θέτοντας αυτήν την επιλογή σε Πθα ενεÏγοποιήσετε την καταγÏαφή των γεγονότων για όλες τις διεÏγασίες. Επίσης, η καταγÏαφή γεγονότων της οθόνης θα είναι απενεÏγοποιημένη, εάν είναι Πόταν το σÏστημα ξεκινήσει. ΠÏοκαθοÏισμένα είναι Î. + +
+
+
+Εξοδος AGI - Θέτοντας αυτήν την επιλογή σε NONE θα απενεÏγοποιήσετε την έξοδο από όλες τις διαδικασίες AGI. Αν θέσετε STDERR θα σταλεί η έξοδος των AGI στο CLI. Επίσης υπάÏχουν οι επιλογές FILE και BOTH. ΠÏοκαθοÏισμένα είναι FILE. + +
+
+
+ΔιακÏμανση Τηλεφωνικής Κλήσης - ΚαθοÏίζοντας αυτό το πεδίο σε Πθα επιτÏέψει στον εξυπηÏετητή να οÏίζει κλήσεις διακÏμανσης για την εκστÏατεία, ώστε το καθοÏισμένο επίπεδο κλήσης να μποÏεί να ικανοποιείται έστω και εάν δεν υπάÏχουν συνδεμένοι χειÏιστές σε αυτήν την εκστÏατεία. ΠÏοκαθοÏισμένα είναι Ο. + +
+
+
+ΔιακÏμανση εκτός οÏίων - ΚαθοÏίζει τον αÏιθμό των τηλ.κυκλ.συνδ. που δεν επιτÏέπετε στο σÏστημα να χειÏιστεί για ΔιακÏμανση Τηλεφωνικής Κλήσης. + + +



+ +ΠΙÎΑΚΑΣ ΣΥÎΔΙΑΛΕΞΕΩÎ

+
+
+ΑÏιθμός Συνδιάλεξης - Αυτό το πεδίο είναι για τον αÏιθμό συνδιάλεξης meetme στο σχέδιο κλήσεων. Επίσης, συνιστοÏμε ο αÏιθμς meetme στο meetme.conf να ταιÏιάζει με αυτό τον αÏιθμό για κάθε καταχώÏηση. Αυτό είναι για τις συνδιαλέξε στο astGUIclient και χÏησιμοποιείται για την λειτουÏγία αποχώÏησης από κλήση με 3 γÏαμμές στο VICIDIAL. + +
+
+
+IP Διακομιστή- Ο κατάλογος που επιλέξατε τον διακομιστή ASTERISK όπου η συνδιάλεξη θα είναι. + + + + +



+ +VICIDIAL_SERVER_TRUNKS ΠΙÎΑΚΑΣ

+
+
+Οι Τηλ.Κυκλ.Συνδ. του εξυπηÏετητή σας επιτÏέπουν να πεÏιοÏίσετε τις εξεÏχόμενες γÏαμμές που χÏησιμοποιοÏνται στον εξυπηÏετητή ανά εκστÏατεία. ΧωÏίς αυτές τις εγγÏαφές, επιτÏέπετε στην εκστÏατεία να έχει όσες γÏαμμές μποÏεί να έχει, μέχÏι τον μέγιστο καθοÏισμένο αÏιθμό Τηλ.Κυκλ.Συνδ.. + + + + + +



+ +SYSTEM_SETTINGS ΠΙÎΑΚΑΣ

+
+
+Μη-λατινικά χÏήσης - αυτή η επιλογή επιτÏέπει σε σας για ναπÏοκαθοÏίσει το χειÏόγÏαφο επίδειξης Î™ÏƒÏ„Î¿Ï Î³Î¹Î± να χÏησιμοποιήσειUTF8 τους χαÏακτήÏες και να μην κάνει οποιαδήποτε φιλτÏάÏισμαλατινικός-χαÏακτήÏας-οικογενειακής κανονική έκφÏασης ήμοÏφοποίηση επίδειξης. Η Ï€Ïοεπιλογή είναι 0. + +
+
+
+Webroot writable - αυτή η ÏÏθμιση επιτÏέπει σε σας για νακαθοÏίσει εάν temp τα αÏχεία και τα αÏχεία επικÏÏωσης Ï€Ïέπεινα τοποθετηθοÏν στο webroot στον κεντÏικό υπολογιστή δικτÏουσας. Η Ï€Ïοεπιλογή είναι 1. + +
+
+
+ΕπιτÏέψτε την αναγÏαφή QueueMetrics - αυτή η ÏÏθμιση επιτÏέπεισε σας για να καθοÏίσει εάν VICIDIAL θα παÏεμβάλει τιςκαταχωÏήσεις κοÏτσουÏων στον πίνακα βάσεων δεδομένων queue_logόπως η δÏαστηÏιότητα σειÏών αναμονής αστεÏίσκων. ΤοQueueMetrics είναι ένα Ï€ÏόγÏαμμα αυτόνομης, ανάλυσηςκλείνω-πηγής στατιστικό. ΠÏέπει που εγκαταστάθηκε ήδη ναδιαμοÏφώσετε QueueMetrics και Ï€Ïίν επιτÏέπετε αυτό τοχαÏακτηÏιστικό γνώÏισμα. Η Ï€Ïοεπιλογή είναι 0. + +
+
+
+QueueMetrics κεντÏικός υπολογιστής IP - αυτό είναι ηδιεÏθυνση IP της βάσης δεδομένων για την εγκατάστασηQueueMetrics σας. + +
+
+
+QueueMetrics όνομα βάσεων δεδομένων - αυτό είναι το όνομαβάσεων δεδομένων για τη βάση δεδομένων QueueMetrics σας. + +
+
+
+QueueMetrics σÏνδεση βάσεων δεδομένων - αυτό είναι το όνομαχÏηστών που χÏησιμοποιείται για να συνδεθεί στη βάση δεδομένωνQueueMetrics σας. + +
+
+
+QueueMetrics κωδικός Ï€Ïόσβασης βάσεων δεδομένων - αυτό είναιο κωδικός Ï€Ïόσβασης που χÏησιμοποιείται για να συνδεθεί στη βάσηδεδομένων QueueMetrics σας. + +
+
+
+QueueMetrics URL - αυτό είναι η διεÏθυνση URL ήιστοχώÏων που χÏησιμοποιείται για να φτάσει στην εγκατάστασηQueueMetrics σας. + +
+
+
+QueueMetrics ταυτότητα κοÏτσουÏων - αυτό είναι η ταυτότητακεντÏικών υπολογιστών που όλα τα κοÏτσουÏα VICIDIAL πουπηγαίνουν στη βάση δεδομένων QueueMetrics θα χÏησιμοποιήσουν ωςπÏοσδιοÏιστικό για κάθε αÏχείο. + +
+
+
+QueueMetrics EnterQueue Prepend - αυτός ο τομέαςχÏησιμοποιείται για να επιτÏέψει ένας από τους τομείς στοιχείωνvicidial_list μπÏοστά από τον τηλεφωνικό αÏιθμό του πελάτη γιατις Ï€ÏοσαÏμοσμένες εκθέσεις QueueMetrics. Η Ï€Ïοεπιλογή δενείναι ΚΑΜΙΑ για να μην εποικήσει τίποτα. + +
+
+
+VICIDIAL ο Ï€ÏάκτοÏας θέτει εκτός λειτουÏγίας την επίδειξη - αυτός ο τομέας χÏησιμοποιείται για να επιλέξει πότε για ναπαÏουσιάσει σε έναν Ï€ÏάκτοÏα πότε η σÏνοδός τους έχει τεθείεκτός λειτουÏγίας από το σÏστημα, μια δÏάση διευθυντών ή απόένα εξωτεÏικό μέτÏο. Η ÏÏθμιση NOT_ACTIVE θα θέσει εκτόςλειτουÏγίας το μήνυμα στην οθόνη Ï€ÏακτόÏων. Η ÏÏθμισηLIVE_ΧΕΙΡΙΣΤΗΣθα επιδείξει μόνο το εκτός λειτουÏγίας μήνυμα όταναφαιÏεθεί το αÏχείο Ï€ÏακτόÏων vicidial_auto_calls, όπως κατάτη διάÏκεια μιας αποσÏνδεσης δÏναμης ή της αποσÏνδεσης έκτακτηςανάγκης. + +
+
+
+ΕπιτÏέψτε τα μηνÏματα SIPSAK - εάν θέστε 1, αυτό θα επιτÏέψειτον τηλεφωνικό πίνακα θέτοντας για να εÏγαστεί κατάλληλα, οκεντÏικός υπολογιστής θα στείλει τα μηνÏματα στο τηλέφωνοΓΟΥΛΙÎΠστην επίδειξη στην τηλεφωνική LCD επίδειξη ότανσυνδέεται με VICIDIAL. Αυτό το χαÏακτηÏιστικό γνώÏισμαλειτουÏγεί μόνο με τα τηλέφωνα ΓΟΥΛΙΩΠκαι απαιτεί sipsak τηνεφαÏμογή για να εγκατασταθεί στον κεντÏικό υπολογιστή δικτÏου. ΗπÏοεπιλογή είναι 0. + +
+
+
+Σπίτι URL Admin - αυτό είναι η διεÏθυνση URL ήιστοχώÏων ότι θα πάτε εάν χτυπήσετε στην ΕΓΧÎΡΙΑ σÏνδεση στηνκοÏυφή της σελίδας admin.php. + +
+
+
+ΕπιτÏέψτε το αÏχείο ημεÏολογίου μεταφοÏάς Ï€ÏακτόÏων - αυτή ηεπιλογή θα καταγÏάψει σε ένα αÏχείο ημεÏολογίου κειμένων στοwebserver κάθε φοÏά που μεταφέÏεται μια κλήση σε ένανπÏάκτοÏα. Η Ï€Ïοεπιλογή είναι 0, άτομα με ειδικές ανάγκες. + + + + + +



+ +VICIDIAL_STATUSES ΠΙÎΑΚΑΣ

+
+
+Μέσω της χÏήσης των θέσεων συστημάτων, μποÏείτε να έχετε τιςθέσεις που υπάÏχουν για την εκστÏατεία και την-ΟΜΑΔΑ. Η θέσηπÏέπει να είναι 1-6 χαÏακτήÏες στο μήκος, η πεÏιγÏαφή Ï€Ïέπεινα είναι 2-30 χαÏακτήÏες στο μήκος και επιλέξιμος καθοÏίζειεάν παÏουσιάζει σε VICIDIAL ως διάθεση Ï€ÏακτόÏων. Ο τομέαςχÏησιμοποιείται κατά τον υπολογισμό του Ï€Î¿ÏƒÎ¿ÏƒÏ„Î¿Ï Ï€Ï„ÏŽÏƒÎ·Ï‚, ήεγκαταλείπει το ποσοστό. Η ÏÏθμιση την στο Î¥ θα χÏησιμοποιήσειαυτήν την θέση κατά υπολογισμό των ανθÏώπινος-απαντημένωνκλήσεων. Η επιλογή κατηγοÏίας επιτÏέπει σε σας για ναομαδοποιήσει διάφοÏες θέσεις σε ένα catogy που μποÏεί ναχÏησιμοποιηθεί για τη στατιστική ανάλυση. + + +



+ +VICIDIAL_STATUS_CATEGORIES ΠΙÎΑΚΑΣ

+
+
+Μέσω της χÏήσης των κατηγοÏιών θέσης συστημάτων, μποÏείτε νασυγκεντÏώσετε τις θέσεις για να επιτÏέψετε τη στατιστική ανάλυσησε μια ομάδα θέσεων. Η ταυτότητα κατηγοÏίας Ï€Ïέπει να είναι2-20 χαÏακτήÏες στο μήκος χωÏίς τα διαστήματα, το όνομαπÏέπει να είναι 2-50 χαÏακτήÏες στο μήκος, η πεÏιγÏαφή είναιπÏοαιÏετική και η επίδειξη TimeonVDAD καθοÏίζει εάν εκείνη ηθέση θα είναι ενός θέσης από μέχÏι 4 θέσεις που μποÏοÏν ναυπολογιστοÏν και να επιδειχθοÏν στο χÏόνο στη σε Ï€Ïαγματικό χÏόνοέκθεση VDAD. + + + + +







+







+ΤΕΛΟΣ +
+\n"; + echo "\n"; + echo "\n"; + echo ""; + + $stmt="SELECT dial_statuses,local_call_time,lead_filter_id from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $dial_statuses = $row[0]; + $local_call_time = $row[1]; + if ($lead_filter_id=='') + { + $lead_filter_id = $row[2]; + if ($lead_filter_id=='') + { + $lead_filter_id='NONE'; + } + } + + $stmt="SELECT list_id,active,list_name from vicidial_lists where campaign_id='$campaign_id'"; + $rslt=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rslt); + $camp_lists=''; + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + if (ereg("Y", $rowx[1])) {$camp_lists .= "'$rowx[0]',";} + } + $camp_lists = eregi_replace(".$","",$camp_lists); + + $filterSQL = $filtersql_list[$lead_filter_id]; + $filterSQL = eregi_replace("^and|and$|^or|or$","",$filterSQL); + if (strlen($filterSQL)>4) + {$fSQL = "and $filterSQL";} + else + {$fSQL = '';} + + + echo "

\n"; + echo "Εμφάνιση ΜετÏητή Κληθέντων Οδηγών -

\n"; + echo "CAMPAIGN: $campaign_id
\n"; + echo "ΛΙΣΤΕΣ: $camp_lists
\n"; + echo "STATUSES: $dial_statuses
\n"; + echo "FILTER: $lead_filter_id
\n"; + echo "CALL TIME: $local_call_time

\n"; + + ### call function to calculate and print dialable leads + dialable_leads($DB,$link,$local_call_time,$dial_statuses,$camp_lists,$fSQL); + + echo "

\n"; + echo "\n"; + + exit; + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + +###################### +# ADD=7111111 view sample script with test variables +###################### + +if ($ADD==7111111) +{ + ##### TEST VARIABLES ##### + $vendor_lead_code = 'VENDOR:LEAD;CODE'; + $list_id = 'LISTID'; + $gmt_offset_now = 'GMTOFFSET'; + $phone_code = '1'; + $phone_number = '7275551212'; + $title = 'Mr.'; + $first_name = 'JOHN'; + $middle_initial = 'Q'; + $last_name = 'PUBLIC'; + $address1 = '1234 Main St.'; + $address2 = 'Apt. 3'; + $address3 = 'ADDRESS3'; + $city = 'CHICAGO'; + $state = 'IL'; + $province = 'PROVINCE'; + $postal_code = '33760'; + $country_code = 'USA'; + $gender = 'M'; + $date_of_birth = '1970-01-01'; + $alt_phone = '3125551212'; + $email = 'test@test.com'; + $security_phrase = 'SECUTIRY'; + $comments = 'COMMENTS FIELD'; + $RGfullname = 'JOE AGENT'; + $RGuser = '6666'; + $RGlead_id = '1234'; + $RGcampaign = 'TESTCAMP'; + $RGphone_login = 'gs102'; + $RGgroup = 'TESTCAMP'; + $RGchannel_group = 'TESTCAMP'; + $RGSQLdate = date("Y-m-d H:i:s"); + $RGepoch = date("U"); + $RGuniqueid = '1163095830.4136'; + $RGcustomer_zap_channel = 'Zap/1-1'; + $RGserver_ip = '10.10.10.15'; + $RGSIPexten = 'SIP/gs102'; + $RGsession_id = '8600051'; + +echo "\n"; +echo "\n"; +echo "\n"; +echo ""; + +$stmt="SELECT * from vicidial_scripts where script_id='$script_id';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$script_name = $row[1]; +$script_text = $row[3]; + +if (eregi("iframe src",$script_text)) + { + $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(' ','+',$address2); + $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); + $RGfullname = eregi_replace(' ','+',$RGfullname); + $RGuser = eregi_replace(' ','+',$RGuser); + $RGlead_id = eregi_replace(' ','+',$RGlead_id); + $RGcampaign = eregi_replace(' ','+',$RGcampaign); + $RGphone_login = eregi_replace(' ','+',$RGphone_login); + $RGgroup = eregi_replace(' ','+',$RGgroup); + $RGchannel_group = eregi_replace(' ','+',$RGchannel_group); + $RGSQLdate = eregi_replace(' ','+',$RGSQLdate); + $RGepoch = eregi_replace(' ','+',$RGepoch); + $RGuniqueid = eregi_replace(' ','+',$RGuniqueid); + $RGcustomer_zap_channel = eregi_replace(' ','+',$RGcustomer_zap_channel); + $RGserver_ip = eregi_replace(' ','+',$RGserver_ip); + $RGSIPexten = eregi_replace(' ','+',$RGSIPexten); + $RGsession_id = eregi_replace(' ','+',$RGsession_id); + } + +$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--fullname--B--',"$RGfullname",$script_text); +$script_text = eregi_replace('--A--fronter--B--',"$RGuser",$script_text); +$script_text = eregi_replace('--A--user--B--',"$RGuser",$script_text); +$script_text = eregi_replace('--A--lead_id--B--',"$RGlead_id",$script_text); +$script_text = eregi_replace('--A--campaign--B--',"$RGcampaign",$script_text); +$script_text = eregi_replace('--A--phone_login--B--',"$RGphone_login",$script_text); +$script_text = eregi_replace('--A--group--B--',"$RGgroup",$script_text); +$script_text = eregi_replace('--A--channel_group--B--',"$RGchannel_group",$script_text); +$script_text = eregi_replace('--A--SQLdate--B--',"$RGSQLdate",$script_text); +$script_text = eregi_replace('--A--epoch--B--',"$RGepoch",$script_text); +$script_text = eregi_replace('--A--uniqueid--B--',"$RGuniqueid",$script_text); +$script_text = eregi_replace('--A--customer_zap_channel--B--',"$RGcustomer_zap_channel",$script_text); +$script_text = eregi_replace('--A--server_ip--B--',"$RGserver_ip",$script_text); +$script_text = eregi_replace('--A--SIPexten--B--',"$RGSIPexten",$script_text); +$script_text = eregi_replace('--A--session_id--B--',"$RGsession_id",$script_text); +$script_text = eregi_replace("\n","
",$script_text); + + +echo ""; + +echo "ΠÏοεπισκόπιση ΒοηθοÏ: $script_id
\n"; +echo "
\n"; +echo "
$script_name
\n"; +echo "$script_text\n"; +echo "
\n"; + +echo "\n"; + +exit; +} + + + + +######################### HTML HEADER BEGIN ####################################### +if ($hh=='users') + {$users_hh="bgcolor =\"$users_color\""; $users_fc="$users_font"; $users_bold="$header_selected_bold";} + else {$users_hh=''; $users_fc='WHITE'; $users_bold="$header_nonselected_bold";} +if ($hh=='campaigns') + {$campaigns_hh="bgcolor=\"$campaigns_color\""; $campaigns_fc="$campaigns_font"; $campaigns_bold="$header_selected_bold";} + else {$campaigns_hh=''; $campaigns_fc='WHITE'; $campaigns_bold="$header_nonselected_bold";} +if ($hh=='lists') + {$lists_hh="bgcolor=\"$lists_color\""; $lists_fc="$lists_font"; $lists_bold="$header_selected_bold";} + else {$lists_hh=''; $lists_fc='WHITE'; $lists_bold="$header_nonselected_bold";} +if ($hh=='ingroups') + {$ingroups_hh="bgcolor=\"$ingroups_color\""; $ingroups_fc="$ingroups_font"; $ingroups_bold="$header_selected_bold";} + else {$ingroups_hh=''; $ingroups_fc='WHITE'; $ingroups_bold="$header_nonselected_bold";} +if ($hh=='remoteagent') + {$remoteagent_hh="bgcolor=\"$remoteagent_color\""; $remoteagent_fc="$remoteagent_font"; $remoteagent_bold="$header_selected_bold";} + else {$remoteagent_hh=''; $remoteagent_fc='WHITE'; $remoteagent_bold="$header_nonselected_bold";} +if ($hh=='usergroups') + {$usergroups_hh="bgcolor=\"$usergroups_color\""; $usergroups_fc="$usergroups_font"; $usergroups_bold="$header_selected_bold";} + else {$usergroups_hh=''; $usergroups_fc='WHITE'; $usergroups_bold="$header_nonselected_bold";} +if ($hh=='scripts') + {$scripts_hh="bgcolor=\"$scripts_color\""; $scripts_fc="$scripts_font"; $scripts_bold="$header_selected_bold";} + else {$scripts_hh=''; $scripts_fc='WHITE'; $scripts_bold="$header_nonselected_bold";} +if ($hh=='filters') + {$filters_hh="bgcolor=\"$filters_color\""; $filters_fc="$filters_font"; $filters_bold="$header_selected_bold";} + else {$filters_hh=''; $filters_fc='WHITE'; $filters_bold="$header_nonselected_bold";} +if ($hh=='admin') + {$admin_hh="bgcolor=\"$admin_color\""; $admin_fc="$admin_font"; $admin_bold="$header_selected_bold";} + else {$admin_hh=''; $admin_fc='WHITE'; $admin_bold="$header_nonselected_bold";} +if ($hh=='reports') + {$reports_hh="bgcolor=\"$reports_color\""; $reports_fc="$reports_font"; $reports_bold="$header_selected_bold";} + else {$reports_hh=''; $reports_fc='WHITE'; $reports_bold="$header_nonselected_bold";} + +echo "\n"; +echo " + + +\n"; +echo "
English Ελληνικά
BGCOLOR=#D9E6FE cellpadding=2 cellspacing=0> + + + + + + + + + + + + + + + 1) { + ?> +> + 1) + { + +# if ($sh=='basic') {$basic_sh="bgcolor=\"$subcamp_color\""; $basic_fc="$subcamp_font";} +# else {$basic_sh=''; $basic_fc='BLACK';} +# if ($sh=='detail') {$detail_sh="bgcolor=\"$subcamp_color\""; $detail_fc="$subcamp_font";} +# else {$detail_sh=''; $detail_fc='BLACK';} +# if ($sh=='dialstat') {$dialstat_sh="bgcolor=\"$subcamp_color\""; $dialstat_fc="$subcamp_font";} +# else {$dialstat_sh=''; $dialstat_fc='BLACK';} + + if ($sh=='basic') {$sh='list';} + if ($sh=='detail') {$sh='list';} + if ($sh=='dialstat') {$sh='list';} + + if ($sh=='list') {$list_sh="bgcolor=\"$subcamp_color\""; $list_fc="$subcamp_font";} + else {$list_sh=''; $list_fc='BLACK';} + if ($sh=='status') {$status_sh="bgcolor=\"$subcamp_color\""; $status_fc="$subcamp_font";} + else {$status_sh=''; $status_fc='BLACK';} + if ($sh=='hotkey') {$hotkey_sh="bgcolor=\"$subcamp_color\""; $hotkey_fc="$subcamp_font";} + else {$hotkey_sh=''; $hotkey_fc='BLACK';} + if ($sh=='recycle') {$recycle_sh="bgcolor=\"$subcamp_color\""; $recycle_fc="$subcamp_font";} + else {$recycle_sh=''; $recycle_fc='BLACK';} + if ($sh=='autoalt') {$autoalt_sh="bgcolor=\"$subcamp_color\""; $autoalt_fc="$subcamp_font";} + else {$autoalt_sh=''; $autoalt_fc='BLACK';} + if ($sh=='pause') {$pause_sh="bgcolor=\"$subcamp_color\""; $pause_fc="$subcamp_font";} + else {$pause_sh=''; $pause_fc='BLACK';} + if ($sh=='listmix') {$listmix_sh="bgcolor=\"$subcamp_color\""; $listmix_fc="$subcamp_font";} + else {$listmix_sh=''; $listmix_fc='BLACK';} + + ?> +> + + + + + + + + + 1) { + ?> + > + 1) { + ?> +> + 1) { + ?> +> + 1) { + ?> +> + 1) { + ?> +> + 1) { + ?> +> + 1) { + ?> +> + 1) { + if ($sh=='times') {$times_sh="bgcolor=\"$times_color\""; $times_fc="$times_font";} # hard teal + else {$times_sh=''; $times_fc='BLACK';} + if ($sh=='phones') {$phones_sh="bgcolor=\"$server_color\""; $phones_fc="$phones_font";} # pink + else {$phones_sh=''; $phones_fc='BLACK';} + if ($sh=='server') {$server_sh="bgcolor=\"$server_color\""; $server_fc="$server_font";} # pink + else {$server_sh=''; $server_fc='BLACK';} + if ($sh=='conference') {$conference_sh="bgcolor=\"$server_color\""; $conference_fc="$server_font";} # pink + else {$conference_sh=''; $conference_fc='BLACK';} + if ($sh=='settings') {$settings_sh="bgcolor=\"$settings_color\""; $settings_fc="$settings_font";} # pink + else {$settings_sh=''; $settings_fc='BLACK';} + if ($sh=='status') {$status_sh="bgcolor=\"$status_color\""; $status_fc="$status_font";} # pink + else {$status_sh=''; $status_fc='BLACK';} + + ?> +> + + + + + + + + 1) { + ?> + > + 1) { + ?> + > + 1) { + ?> + > + 1) { + ?> + > + 1) { + ?> + > + 1) { + ?> + > + \n"; + echo "Δεν έχετε το δικαίωμα για να δείτε την σελίδα. ΠαÏακαλώ επιστÏέψτε.\n"; + } + +} +if (strlen($reports_hh) > 1) { + ?> +> + + + + +
  ΔΙΑΧΕΙΡΙΣΗ - ΣΠΙΤΙ | ΑποσÏνδεση  
> SIZE=> ΧÏήστες > SIZE=> ΕκστÏατείες > SIZE=> Κατάλογοι > SIZE=> ΧειÏόγÏαφα > SIZE=> ΦίλτÏα > SIZE=> $$$-ΟΜΑΔΕΣ > SIZE=> Ομάδες χÏηστών > SIZE=> ΜακÏινοί Ï€ÏάκτοÏες > SIZE=> Admin > SIZE=> Εκθέσεις
>   > ΠαÏουσιάστε χÏήστες     |     > ΠÏοσθέστε έναν νέο χÏήστη     |     > ΧÏήστης αντιγÏάφων     |     > Αναζήτηση ενός χÏήστη
COLSPAN=2> SIZE=>ΚεντÏικός αγωγός εκστÏατειών COLSPAN=1> SIZE=> Statuses COLSPAN=1> SIZE=> HotKeys COLSPAN=2> SIZE=>Μόλυβδος ανακÏκλωσης COLSPAN=1> SIZE=>Αυτόματος-ALT πίνακας COLSPAN=1> SIZE=>Κώδικες μικÏής διακοπής COLSPAN=2> SIZE=>Μίγμα καταλόγων
>   > ΠαÏουσιάστε εκστÏατείες     |     > ΠÏοσθέστε μια νέα εκστÏατεία     |     > ΕκστÏατεία αντιγÏάφων     |     > Σε Ï€Ïαγματικό χÏόνο πεÏίληψη εκστÏατειών
>   > ΠαÏουσιάστε καταλόγους     |     > ΠÏοσθέστε έναν νέο κατάλογο     |     > Αναζήτηση ενός μολÏβδου     |     > ΠÏοσθέστε τον αÏιθμό σε DNC     |     > Îέοι μόλυβδοι φοÏτίων
>   > ΠαÏουσιάστε χειÏόγÏαφα     |     > ΠÏοσθέστε ένα νέο χειÏόγÏαφο
>   > ΠαÏουσιάστε φίλτÏα     |     > ΠÏοσθέστε ένα νέο φίλτÏο
>   > ΠαÏουσιάστε-ΟΜΑΔΕΣ     |     > ΠÏοσθέστε μια νέα-ΟΜΑΔΑ     |     > $$$-ΟΜΑΔΑ αντιγÏάφων
>   > ΠαÏουσιάστε ομάδες χÏηστών     |     > ΠÏοσθέστε μια νέα ομάδα χÏηστών     |     > ΩÏιαία έκθεση ομάδας
>   > ΠαÏουσιάστε μακÏινοÏÏ‚ Ï€ÏάκτοÏες     |     > ΠÏοσθέστε τους νέους μακÏινοÏÏ‚ Ï€ÏάκτοÏες
COLSPAN=2> SIZE=> ΧÏόνοι κλήσης COLSPAN=2> SIZE=> Τηλέφωνα COLSPAN=2> SIZE=> Διασκέψεις COLSPAN=1> SIZE=> ΚεντÏικοί υπολογιστές COLSPAN=1> SIZE=> Τοποθετήσεις συστημάτων COLSPAN=2> SIZE=>Θέσεις συστημάτων
>   > ΠαÏουσιάστε χÏόνους κλήσης     |     > ΠÏοσθέστε έναν νέο χÏόνο κλήσης     |     > ΠαÏουσιάστε χÏόνους κÏατικής κλήσης     |     > ΠÏοσθέστε έναν νέο χÏόνο κÏατικής κλήσης  
>   > ΠαÏουσιάστε τηλέφωνα   |   > ΠÏοσθέστε ένα νέο τηλέφωνο
> ΠαÏουσιάστε διασκέψεις   |   > ΠÏοσθέστε μια νέα διάσκεψη   |   > ΠαÏουσιάστε διασκέψεις VICIDIAL   |   > ΠÏοσθέστε μια νέα διάσκεψη VICIDIAL
> ΠαÏουσιάστε κεντÏικοÏÏ‚ υπολογιστές   |   > ΠÏοσθέστε έναν νέο κεντÏικό υπολογιστή
> Τοποθετήσεις συστημάτων
>Θέσεις συστημάτων   |   >ΚατηγοÏίες θέσης
>  
+
\n"; + echo ""; + + echo "
ΠΡΟΣΘΗΚΗ ÎΕΟΥ ΧΡΗΣΤΗ
\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "$NWB#vicidial_users-user_group$NWE\n"; + echo "\n"; + echo "
ΑÏιθμός ΧÏήστη: $NWB#vicidial_users-user$NWE
Κωδικός:$NWB#vicidial_users-pass$NWE
ΠλήÏες Ονομα: $NWB#vicidial_users-full_name$NWE
Επίπεδο ΧÏήστη: $NWB#vicidial_users-user_level$NWE
Ομάδα ΧÏήστη:
Τηλέφωνο ΣÏνδεσης: $NWB#vicidial_users-phone_login$NWE
Κωδικός ΠÏόσβασης Τηλεφώνου: $NWB#vicidial_users-phone_pass$NWE
\n"; + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + +###################### +# ADD=1 display the COPY USER FORM SCREEN +###################### + +if ($ADD=="1A") +{ + if ($LOGmodify_users==1) + { + echo "
\n"; + echo ""; + + echo "
ΧΡΗΣΤΗΣ ΑÎΤΙΓΡΑΦΩÎ\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + if ($LOGuser_level==9) {$levelMAX=10;} + else {$levelMAX=$LOGuser_level;} + + echo "\n"; + echo "\n"; + echo "
ΑÏιθμός ΧÏήστη: $NWB#vicidial_users-user$NWE
Κωδικός:$NWB#vicidial_users-pass$NWE
ΠλήÏες Ονομα: $NWB#vicidial_users-full_name$NWE
Source User: $NWB#vicidial_users-user$NWE
\n"; + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + +###################### +# ADD=11 display the ADD NEW CAMPAIGN FORM SCREEN +###################### + +if ($ADD==11) +{ + if ($LOGmodify_campaigns==1) + { + echo "
\n"; + echo ""; + + echo "
ΠΡΟΣΘΗΚΗ ÎΕΑΣ ΕΚΣΤΡΑΤΕΙΑΣ\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
ID ΕκστÏατείας: $NWB#vicidial_campaigns-campaign_id$NWE
Ονομα ΕκστÏατείας: $NWB#vicidial_campaigns-campaign_name$NWE
ΠεÏιγÏαφή εκστÏατείας: $NWB#vicidial_campaigns-campaign_description$NWE
ΕνεÏγή:$NWB#vicidial_campaigns-active$NWE
Τηλ.σÏνδ. Στάθμευσης: $NWB#vicidial_campaigns-park_ext$NWE
Ονομα ΑÏχείου Στάθμευσης: $NWB#vicidial_campaigns-park_file_name$NWE
Ιστο-σελίδα: $NWB#vicidial_campaigns-web_form_address$NWE
ΕπιτÏέπω τους Closers: $NWB#vicidial_campaigns-allow_closers$NWE
Επίπεδο Hopper: $NWB#vicidial_campaigns-hopper_level$NWE
ΕΠΙΠΕΔΟ ΑΥΤΟΜΑΤΗΣ ΚΛΗΣΗΣ: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE
Επόμενη Κλήση ΧειÏιστή: $NWB#vicidial_campaigns-next_agent_call$NWE
ΧÏόνος Τοπικής Κλήσης: $NWB#vicidial_campaigns-local_call_time$NWE
ΦΩÎΗΤΙΚΟ ΤΑΧΥΔΡΟΜΕΙΟ: $NWB#vicidial_campaigns-voicemail_ext$NWE
Βοηθός: $NWB#vicidial_campaigns-campaign_script$NWE
Κατά την έναÏξη κλήσης: $NWB#vicidial_campaigns-get_call_launch$NWE
\n"; + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + +###################### +# ADD=12 display the COPY CAMPAIGN FORM SCREEN +###################### + +if ($ADD==12) +{ + if ($LOGmodify_campaigns==1) + { + echo "
\n"; + echo ""; + + echo "
ΑÎΤΙΓΡΑΨΤΕ μια ΕΚΣΤΡΑΤΕΙΑ\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + + echo "\n"; + echo "
ID ΕκστÏατείας: $NWB#vicidial_campaigns-campaign_id$NWE
Ονομα ΕκστÏατείας: $NWB#vicidial_campaigns-campaign_name$NWE
ΕκστÏατεία πηγής:$NWB#vicidial_campaigns-campaign_id$NWE
\n"; + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + +###################### +# ADD=111 display the ADD NEW LIST FORM SCREEN +###################### + +if ($ADD==111) +{ + if ($LOGmodify_lists==1) + { + echo "
\n"; + echo ""; + + echo "
ADD A NEW LIST\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
ID Λίστας: (μόνο αÏιθμοί)$NWB#vicidial_lists-list_id$NWE
Ονομα Λίστας: $NWB#vicidial_lists-list_name$NWE
ΠεÏιγÏαφή καταλόγων: $NWB#vicidial_lists-list_description$NWE
ΕκστÏατεία: $NWB#vicidial_lists-campaign_id$NWE
ΕνεÏγή:$NWB#vicidial_lists-active$NWE
\n"; + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + +###################### +# ADD=121 display the ADD NUMBER TO DNC FORM SCREEN and add a new number +###################### + +if ($ADD==121) +{ +echo "
\n"; +echo ""; + +if (strlen($phone_number) > 2) + { + $stmt="SELECT count(*) from vicidial_dnc where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
DNC ΠΡΟΣΤΙΘΈΜΕÎΟ - αυτός ο τηλεφωνικός αÏιθμός είναι ήδη δενκαλεί τον κατάλογο: $phone_number

\n";} + else + { + $stmt="INSERT INTO vicidial_dnc (phone_number) values('$phone_number');"; + $rslt=mysql_query($stmt, $link); + + echo "
DNC ΠΡΟΣΤΙΘΈΜΕÎΟ: $phone_number

\n"; + + ### LOG INSERTION TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW DNC NUMBER|$PHP_AUTH_USER|$ip|'$phone_number'|\n"); + fclose($fp); + } + } + } + +echo "
ΠΡΟΣΘΕΣΤΕ έναν ΑΡΙΘΜΟ στον ΚΑΤΑΛΟΓΟ DNC\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "
Τηλεφωνικός αÏιθμός: (μόνο αÏιθμοί)$NWB#vicidial_list-dnc$NWE
\n"; + +} + + +###################### +# ADD=1111 display the ADD NEW INBOUND GROUP SCREEN +###################### + +if ($ADD==1111) +{ + if ($LOGmodify_ingroups==1) + { + echo "
\n"; + echo ""; + + echo "
ΠΡΟΣΘΗΚΗ ΕΙΣΕΡΧΟΜΕÎΗΣ ΟΜΑΔΑΣ\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
ID Ομάδας: (no spaces)$NWB#vicidial_inbound_groups-group_id$NWE
Ονομα Ομάδας: $NWB#vicidial_inbound_groups-group_name$NWE
ΧÏώμα Ομάδας: $NWB#vicidial_inbound_groups-group_color$NWE
ΕνεÏγή:$NWB#vicidial_inbound_groups-active$NWE
Ιστο-σελίδα: $NWB#vicidial_inbound_groups-web_form_address$NWE
ΦΩÎΗΤΙΚΟ ΤΑΧΥΔΡΟΜΕΙΟ: $NWB#vicidial_inbound_groups-voicemail_ext$NWE
Επόμενη Κλήση ΧειÏιστή: $NWB#vicidial_inbound_groups-next_agent_call$NWE
ΜπÏοστινή Οθόνη: $NWB#vicidial_inbound_groups-fronter_display$NWE
Βοηθός: $NWB#vicidial_inbound_groups-ingroup_script$NWE
Κατά την έναÏξη κλήσης: $NWB#vicidial_inbound_groups-get_call_launch$NWE
\n"; + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + +###################### +# ADD=1211 display the COPY INBOUND GROUP SCREEN +###################### + +if ($ADD==1211) +{ + if ($LOGmodify_ingroups==1) + { + echo "
\n"; + echo ""; + + echo "
ΕΙΣΕΡΧΟΜΕÎΗ ΟΜΑΔΑ ΑÎΤΙΓΡΑΦΩÎ\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + + echo "\n"; + echo "
ID Ομάδας: (no spaces)$NWB#vicidial_inbound_groups-group_id$NWE
Ονομα Ομάδας: $NWB#vicidial_inbound_groups-group_name$NWE
Source ID Ομάδας: $NWB#vicidial_inbound_groups-group_id$NWE
\n"; + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + +###################### +# ADD=11111 display the ADD NEW REMOTE AGENTS SCREEN +###################### + +if ($ADD==11111) +{ + if ($LOGmodify_remoteagents==1) + { + echo "
\n"; + echo ""; + + echo "
ΠΡΟΣΘΗΚΗ ÎΕΩΠΑΠΟΜΑΚΡΥΣΜΕÎΩΠΧΕΙΡΙΣΤΩÎ\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
ID ΧÏήστη Ξεκινά: (μόνο αÏιθμοί, incremented)$NWB#vicidial_remote_agents-user_start$NWE
ΑÏιθμός ΓÏαμμών: (μόνο αÏιθμοί)$NWB#vicidial_remote_agents-number_of_lines$NWE
IP Διακομιστή: $NWB#vicidial_remote_agents-server_ip$NWE
ΕξωτεÏική Τηλ. ΣÏνδεση: (ο αÏιθμός που κλήθηκε από το πλάνο κλήσεων για να καλέσει τους χειÏιστές)$NWB#vicidial_remote_agents-conf_exten$NWE
Κατάσταση:$NWB#vicidial_remote_agents-status$NWE
ΕκστÏατεία: $NWB#vicidial_remote_agents-campaign_id$NWE
ΕισεÏχόμενες Ομάδες: \n"; + echo "$groups_list"; + echo "$NWB#vicidial_remote_agents-closer_campaigns$NWE
\n"; + echo "ΣΗΜΕΙΩΣΗ: ΜποÏεί να διαÏκέσει και 30 δευτεÏόλεπτα για να καταχωÏηθοÏν οι αλλαγές της οθόνης\n"; + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + +###################### +# ADD=111111 display the ADD NEW USERS GROUP SCREEN +###################### + +if ($ADD==111111) +{ + if ($LOGmodify_usergroups==1) + { + echo "
\n"; + echo ""; + + echo "
ΠΡΟΣΘΗΚΗ ΟΜΑΔΑΣ ΧΡΗΣΤΩÎ\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Ομάδα: (όχι κενά ή στίξη)$NWB#vicidial_user_groups-user_group$NWE
ΠεÏιγÏαφή: (πεÏιγÏαφή ομάδας)$NWB#vicidial_user_groups-group_name$NWE
\n"; + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + +###################### +# ADD=1111111 display the ADD NEW SCRIPT SCREEN +###################### + +if ($ADD==1111111) +{ + if ($LOGmodify_scripts==1) + { + echo "
\n"; + echo ""; + + echo "
ADD NEW SCRIPT\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Ταυτότητα χειÏογÏάφων:: (όχι κενά ή στίξη)$NWB#vicidial_scripts-script_id$NWE
Όνομα χειÏογÏάφων: (τίτλος του βοηθοÏ)$NWB#vicidial_scripts-script_name$NWE
Σχόλια χειÏόγÏαφου: $NWB#vicidial_scripts-script_comments$NWE
ΕνεÏγή:$NWB#vicidial_scripts-active$NWE
Κείμενο χειÏόγÏαφου: "; + # BEGIN Insert Field + echo ""; + echo "
"; + # END Insert Field + echo " $NWB#vicidial_scripts-script_text$NWE
\n"; + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + +###################### +# ADD=11111111 display the ADD NEW FILTER SCREEN +###################### + +if ($ADD==11111111) +{ + if ($LOGmodify_filters==1) + { + echo "
\n"; + echo ""; + + echo "
ΠΡΟΣΘΕΣΕ ΦΙΛΤΡΟ\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
ID ΦίλτÏου: (όχι κενά ή στίξη)$NWB#vicidial_lead_filters-lead_filter_id$NWE
Όνομα ΦίλτÏου: (σÏντομη πεÏιγÏαφή του φίλτÏου)$NWB#vicidial_lead_filters-lead_filter_name$NWE
Σχόλια ΦίλτÏου: $NWB#vicidial_lead_filters-lead_filter_comments$NWE
SQL ΦίλτÏου: $NWB#vicidial_lead_filters-lead_filter_sql$NWE
\n"; + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + +###################### +# ADD=111111111 display the ADD NEW CALL TIME SCREEN +###################### + +if ($ADD==111111111) +{ + if ($LOGmodify_call_times==1) + { + echo "
\n"; + echo ""; + + echo "
ΠΡΟΣΘΗΚΗ ÎΕΟΥ ΧΡΟÎΟΥ ΚΛΗΣΗΣ\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "
ID ΧÏόνου Κλήσης: (όχι κενά ή στίξη)$NWB#vicidial_call_times-call_time_id$NWE
Ονομα ΧÏόνου Κλήσης: (σÏντομη πεÏιγÏαφή του χÏόνου κλήσης)$NWB#vicidial_call_times-call_time_name$NWE
Σχόλια ΧÏόνου Κλήσης: $NWB#vicidial_call_times-call_time_comments$NWE
Οι επιλογές ΗμέÏας και ÏŽÏας θα εμφανιστοÏν όταν θα δημιουÏγήσετε τον ΟÏισμό ΧÏόνου Κλήσης
\n"; + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + +###################### +# ADD=1111111111 display the ADD NEW STATE CALL TIME SCREEN +###################### + +if ($ADD==1111111111) +{ + if ($LOGmodify_call_times==1) + { + echo "
\n"; + echo ""; + + echo "
ΠΡΟΣΘΗΚΗ ÎΕΟΥ ΧΡΟÎΟΥ ΚΛΗΣΗΣ ΚΑΤΑΣΤΑΣΗΣ\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "
ID ΧÏόνου Κλήσης Κατάστασης: (όχι κενά ή στίξη)$NWB#vicidial_call_times-call_time_id$NWE
State Call Time State: (όχι κενά ή στίξη)$NWB#vicidial_call_times-state_call_time_state$NWE
Ονομα ΧÏόνου Κλήσης Κατάτασης: (σÏντομη πεÏιγÏαφή του χÏόνου κλήσης)$NWB#vicidial_call_times-call_time_name$NWE
Σχόλια ΧÏόνου Κλήσης Κατάστασης: $NWB#vicidial_call_times-call_time_comments$NWE
Οι επιλογές ΗμέÏας και ÏŽÏας θα εμφανιστοÏν όταν θα δημιουÏγήσετε τον ΟÏισμό ΧÏόνου Κλήσης
\n"; + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + +###################### +# ADD=11111111111 display the ADD NEW PHONE SCREEN +###################### + +if ($ADD==11111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + echo "
ΠΡΟΣΘΗΚΗ ΤΗΛΕΦΩÎΟΥ\n"; + echo "\n"; + echo "
\n"; + + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Τηλ.σÏνδεσης τηλεφώνου: $NWB#phones-extension$NWE
ΑÏιθμός Σχεδίου Κλήσεων: (μόνο αÏιθμοί)$NWB#phones-dialplan_number$NWE
ΠεÏιεχόμενο Î¦Ï‰Î½Î·Ï„Î¹ÎºÎ¿Ï Î¤Î±Ï‡Ï…Î´Ïομείου: (μόνο αÏιθμοί)$NWB#phones-voicemail_id$NWE
ΕξεÏχόμενο CallerID: (μόνο αÏιθμοί)$NWB#phones-outbound_cid$NWE
Δνση IP Τηλεφώνου: (optional)$NWB#phones-phone_ip$NWE
Δνση IP Υπολογιστή: (optional)$NWB#phones-computer_ip$NWE
IP Διακομιστή: $NWB#phones-server_ip$NWE
ΣÏνδεση:$NWB#phones-login$NWE
Κωδικός:$NWB#phones-pass$NWE
Κατάσταση:$NWB#phones-status$NWE
ΕνεÏγός ΛογαÏιασμός: $NWB#phones-active$NWE
ΤÏπος τηλεφώνου: $NWB#phones-phone_type$NWE
ΠλήÏες Ονομα: $NWB#phones-fullname$NWE
ΕταιÏία:$NWB#phones-company$NWE
Εικόνα:$NWB#phones-picture$NWE
ΠÏοτόκολο Πελάτη: $NWB#phones-protocol$NWE
Τοπικό GMT: (Μην Ïυθμίσεις για DST)$NWB#phones-local_gmt$NWE
\n"; + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + +###################### +# ADD=111111111111 display the ADD NEW SERVER SCREEN +###################### + +if ($ADD==111111111111) +{ + if ($LOGmodify_servers==1) + { + echo "
\n"; + echo ""; + + echo "
ΠΡΟΣΘΗΚΗ ΔΙΑΚΟΜΙΣΤΗ\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
ID Διακομιστή: $NWB#servers-server_id$NWE
ΠεÏιγÏαφή Διακομιστή: $NWB#servers-server_description$NWE
Δνση IP Διακομιστή: $NWB#servers-server_ip$NWE
ΕνεÏγή:$NWB#servers-active$NWE
Εκδοση Asterisk: $NWB#servers-asterisk_version$NWE
\n"; + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + +###################### +# ADD=1111111111111 display the ADD NEW CONFERENCE SCREEN +###################### + +if ($ADD==1111111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + echo "
ΠΡΟΣΘΗΚΗ ΣΥÎΔΙΑΛΕΞΗΣ\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
ΑÏιθμός Συνδιάλεξης: (μόνο αÏιθμοί)$NWB#conferences-conf_exten$NWE
IP Διακομιστή: $NWB#conferences-server_ip$NWE
\n"; + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + +###################### +# ADD=11111111111111 display the ADD NEW VICIDIAL CONFERENCE SCREEN +###################### + +if ($ADD==11111111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + echo "
ADD A NEW VICIDIAL CONFERENCE\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
ΑÏιθμός Συνδιάλεξης: (μόνο αÏιθμοί)$NWB#conferences-conf_exten$NWE
IP Διακομιστή: $NWB#conferences-server_ip$NWE
\n"; + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + + +###################################################################################################### +###################################################################################################### +####### 2 series, validates form data and inserts the new record into the database +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=2 adds the new user to the system +###################### + +if ($ADD=="2") +{ + echo ""; + $stmt="SELECT count(*) from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
Ο ΧΡΗΣΤΗΣ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - υπάÏχει ήδη ένας χÏήστης με αυτό τον αÏιθμό\n";} + else + { + if ( (strlen($user) < 2) or (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user) > 8) ) + { + echo "
Ο ΧΡΗΣΤΗΣ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
το id χÏήστη Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 2 και 8 χαÏακτήÏες\n"; + echo "
το πλήÏες όνομα και κωδικός Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες\n"; + } + else + { + echo "
ΧΡΗΣΤΗΣ ΠΡΟΣΤΕΘΗΚΕ: $user\n"; + + $stmt="INSERT INTO vicidial_users (user,pass,full_name,user_level,user_group,phone_login,phone_pass) values('$user','$pass','$full_name','$user_level','$user_group','$phone_login','$phone_pass');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A USER |$PHP_AUTH_USER|$ip|'$user','$pass','$full_name','$user_level','$user_group','$phone_login','$phone_pass'|\n"); + fclose($fp); + } + } + } + +$ADD=3; +} + +###################### +# ADD=2A adds the copied new user to the system +###################### + +if ($ADD=="2A") +{ + echo ""; + $stmt="SELECT count(*) from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
Ο ΧΡΗΣΤΗΣ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - υπάÏχει ήδη ένας χÏήστης με αυτό τον αÏιθμό\n";} + else + { + if ( (strlen($user) < 2) or (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user) > 8) ) + { + echo "
Ο ΧΡΗΣΤΗΣ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
το id χÏήστη Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 2 και 8 χαÏακτήÏες\n"; + echo "
το πλήÏες όνομα και κωδικός Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες\n"; + } + else + { + $stmt="INSERT INTO vicidial_users (user,pass,full_name,user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override) SELECT \"$user\",\"$pass\",\"$full_name\",user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override from vicidial_users where user=\"$source_user_id\";"; + $rslt=mysql_query($stmt, $link); + + $stmtA="INSERT INTO vicidial_inbound_group_agents (user,group_id,group_rank,group_weight,calls_today) SELECT \"$user\",group_id,group_rank,group_weight,\"0\" from vicidial_inbound_group_agents where user=\"$source_user_id\";"; + $rslt=mysql_query($stmtA, $link); + + $stmtA="INSERT INTO vicidial_campaign_agents (user,campaign_id,campaign_rank,campaign_weight,calls_today) SELECT \"$user\",campaign_id,campaign_rank,campaign_weight,\"0\" from vicidial_campaign_agents where user=\"$source_user_id\";"; + $rslt=mysql_query($stmtA, $link); + + echo "
USER COPIED: $user copied from $source_user_id\n"; + echo "

\n"; + echo "Click here to go to the user record\n"; + echo "

\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A COPIED USER |$PHP_AUTH_USER|$ip|$user|$source_user_id|$stmt|\n"); + fclose($fp); + } + } + } +exit; +} + +###################### +# ADD=21 adds the new campaign to the system +###################### + +if ($ADD==21) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
Η ΕΚΣΤΡΑΤΕΙΑ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - υπάÏχει ήδη μία εκστÏατεία με αυτό το ID\n";} + else + { + $stmt="SELECT count(*) from vicidial_inbound_groups where group_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN NOT ADDED - there is already an inbound group in the system with this ID\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($campaign_id) > 8) or (strlen($campaign_name) < 6) or (strlen($campaign_name) > 40) ) + { + echo "
Η ΕΚΣΤΡΑΤΕΙΑ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
το ID της εκστÏατείας Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 2 και 8 χαÏακτήÏες\n"; + echo "
το όνομα της εκστÏατείας Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 6 και 40 χαÏακτήÏες\n"; + } + else + { + echo "
ΕΚΣΤΡΑΤΕΙΑ ΠΡΟΣΤΕΘΗΚΕ: $campaign_id\n"; + + $stmt="INSERT INTO vicidial_campaigns (campaign_id,campaign_name,campaign_description,active,dial_status_a,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,campaign_script,get_call_launch,campaign_changedate,campaign_stats_refresh,list_order_mix) values('$campaign_id','$campaign_name','$campaign_description','$active','NEW','DOWN','$park_ext','$park_file_name','" . mysql_real_escape_string($web_form_address) . "','$allow_closers','$hopper_level','$auto_dial_level','$next_agent_call','$local_call_time','$voicemail_ext','$script_id','$get_call_launch','$SQLdate','Y','DISABLED');"; + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_campaign_stats (campaign_id) values('$campaign_id');"; + $rslt=mysql_query($stmt, $link); + + echo ""; + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ΠΡΟΣΘΗΚΗ ÎΕΑΣ ΕΚΣΤΡΑΤΕΙΑΣ |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + } + } + } +$ADD=31; +} + +###################### +# ADD=20 adds copied new campaign to the system +###################### + +if ($ADD==20) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
Η ΕΚΣΤΡΑΤΕΙΑ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - υπάÏχει ήδη μία εκστÏατεία με αυτό το ID\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($campaign_id) > 8) or (strlen($campaign_name) < 2) or (strlen($source_campaign_id) < 2) or (strlen($source_campaign_id) > 8) ) + { + echo "
Η ΕΚΣΤΡΑΤΕΙΑ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
το ID της εκστÏατείας Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 2 και 8 χαÏακτήÏες\n"; + echo "
source το ID της εκστÏατείας Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 2 και 8 χαÏακτήÏες\n"; + } + else + { + echo "
CAMPAIGN COPIED: $campaign_id copied from $source_campaign_id\n"; + + $stmt="INSERT INTO vicidial_campaigns (campaign_name,campaign_id,active,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,safe_harbor_message,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,list_order_mix,campaign_allow_inbound,manual_dial_list_id,default_xfer_group) SELECT \"$campaign_name\",\"$campaign_id\",\"N\",dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,safe_harbor_message,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,\"DISABLED\",campaign_allow_inbound,manual_dial_list_id,default_xfer_group from vicidial_campaigns where campaign_id='$source_campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmtA="INSERT INTO vicidial_campaign_stats (campaign_id) values('$campaign_id');"; + $rslt=mysql_query($stmtA, $link); + + $stmtA="INSERT INTO vicidial_campaign_statuses (status,status_name,selectable,campaign_id,human_answered,category) SELECT status,status_name,selectable,\"$campaign_id\",human_answered,category from vicidial_campaign_statuses where campaign_id='$source_campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + $stmtA="INSERT INTO vicidial_campaign_hotkeys (status,hotkey,status_name,selectable,campaign_id) SELECT status,hotkey,status_name,selectable,\"$campaign_id\" from vicidial_campaign_hotkeys where campaign_id='$source_campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + $stmtA="INSERT INTO vicidial_lead_recycle (status,attempt_delay,attempt_maximum,active,campaign_id) SELECT status,attempt_delay,attempt_maximum,active,\"$campaign_id\" from vicidial_lead_recycle where campaign_id='$source_campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + $stmtA="INSERT INTO vicidial_pause_codes (pause_code,pause_code_name,billable,campaign_id) SELECT pause_code,pause_code_name,billable,\"$campaign_id\" from vicidial_pause_codes where campaign_id='$source_campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + echo ""; + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|COPY TO NEW CAMPAIGN|$PHP_AUTH_USER|$ip|$campaign_id|$source_campaign_id|$stmt|$stmtA|\n"); + fclose($fp); + } + + } + } +$ADD=31; +} + +###################### +# ADD=22 adds the new campaign status to the system +###################### + +if ($ADD==22) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
Η ΚΑΤΑΣΤΑΣΗ ΤΗΣ ΕΚΣΤΡΑΤΕΙΑΣ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - υπάÏχει ήδη κατάσταση-εκστÏατείας με αυτό το όνομα\n";} + else + { + $stmt="SELECT count(*) from vicidial_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
Η ΚΑΤΑΣΤΑΣΗ ΤΗΣ ΕΚΣΤΡΑΤΕΙΑΣ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - υπάÏχει ήδη μία καθολική-κατάσταση με αυτό το όνομα\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($status_name) < 2) ) + { + echo "
Η ΚΑΤΑΣΤΑΣΗ ΤΗΣ ΕΚΣΤΡΑΤΕΙΑΣ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
η κατάσταση Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 1 και 8 χαÏακτήÏÏες\n"; + echo "
το όνομα της κατάστασης Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 2 και 30 χαÏακτήÏÏες\n"; + } + else + { + echo "
ΚΑΤΑΣΤΑΣΗ ΕΚΣΤΡΑΤΕΙΑΣ ΠΡΟΣΤΕΘΗΚΕ: $campaign_id - $status\n"; + + $stmt="INSERT INTO vicidial_campaign_statuses (status,status_name,selectable,campaign_id,human_answered,category) values('$status','$status_name','$selectable','$campaign_id','$human_answered','$category');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ΠΡΟΣΘΗΚΗ ÎΕΑΣ ΕΚΣΤΡΑΤΕΙΑΣ STATUS |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } +$SUB=22; +$ADD=31; +} + + +###################### +# ADD=23 adds the new campaign hotkey to the system +###################### + +if ($ADD==23) +{ + $HKstatus_data = explode('-----',$HKstatus); + $status = $HKstatus_data[0]; + $status_name = $HKstatus_data[1]; + + echo ""; + $stmt="SELECT count(*) from vicidial_campaign_hotkeys where campaign_id='$campaign_id' and hotkey='$hotkey' and hotkey='$hotkey';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN HOT KEY NOT ADDED - there is already a campaign-hotkey in the system with this hotkey\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($hotkey) < 1) ) + { + echo "
ΤΟ ΚΛΕΙΔΙ ΤΗΣ ΕΚΣΤΡΑΤΕΙΑΣ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
hotkey must be a single character between 1 and 9 \n"; + echo "
η κατάσταση Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 1 και 8 χαÏακτήÏÏες\n"; + } + else + { + echo "
ΚΛΕΙΔΙ ΕΚΣΤΡΑΤΕΙΑΣ ΠΡΟΣΤΕΘΗΚΕ: $campaign_id - $status - $hotkey\n"; + + $stmt="INSERT INTO vicidial_campaign_hotkeys values('$status','$hotkey','$status_name','$selectable','$campaign_id');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ΠΡΟΣΘΗΚΗ ÎΕΑΣ ΕΚΣΤΡΑΤΕΙΑΣ HOT KEY |$PHP_AUTH_USER|$ip|'$status','$hotkey','$status_name','$selectable','$campaign_id'|\n"); + fclose($fp); + } + } + } +$SUB=23; +$ADD=31; +} + + +###################### +# ADD=25 adds the new campaign lead recycle entry to the system +###################### + +if ($ADD==25) +{ + $status = eregi_replace("-----.*",'',$status); + echo ""; + $stmt="SELECT count(*) from vicidial_lead_recycle where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
ΑÎΑΚΥΚΛΩΣΗΣ ΜΟΛΥΒΔΟΥ ΕΚΣΤΡΑΤΕΙΑΣ ΠΡΟΣΤΙΘΕΜΕÎΟΣ - υπάÏχει ήδη έναςμόλυβδος-ανακÏκλωσης για αυτήν την εκστÏατεία με αυτήν την θέση\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or ($attempt_delay < 120) or ($attempt_maximum < 1) or ($attempt_maximum > 10) ) + { + echo "
ΑÎΑΚΥΚΛΩΣΗΣ ΜΟΛΥΒΔΟΥ ΕΚΣΤΡΑΤΕΙΑΣ ΠΡΟΣΤΙΘΕΜΕÎΟΣ - παÏακαλώ επιστÏέψτεκαι εξετάστε τα στοιχεία που εισαγάγατε\n"; + echo "
η κατάσταση Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 1 και 6 χαÏακτήÏων στο μήκος\n"; + echo "
η καθυστέÏηση Ï€Ïοσπάθειας Ï€Ïέπει να είναι τουλάχιστον 120δευτεÏόλεπτα\n"; + echo "
οι μέγιστες Ï€Ïοσπάθειες Ï€Ïέπει να είναι από 1 έως 10\n"; + } + else + { + echo "
ΠΡΟΣΤΙΘΕΜΕÎΟΣ ΟΔΗΓΟΣ ΑÎΑΚΥΚΛΩΣΗΣ ΕΚΣΤΡΑΤΕΙΑΣ: $campaign_id - $status - $attempt_delay\n"; + + $stmt="INSERT INTO vicidial_lead_recycle(campaign_id,status,attempt_delay,attempt_maximum,active) values('$campaign_id','$status','$attempt_delay','$attempt_maximum','$active');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW LEAD RECYCLE |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$SUB=25; +$ADD=31; +} + + +###################### +# ADD=26 adds the new auto alt dial status to the campaign +###################### + +if ($ADD==26) +{ + $status = eregi_replace("-----.*",'',$status); + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and auto_alt_dial_statuses LIKE \"% $status %\";"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
ΑΥΤΟΜΑΤΗ ΘΈΣΗ ΠΙÎΑΚΩΠALT ΠΡΟΣΤΙΘΈΜΕÎΗ - υπάÏχει ήδη μια είσοδος για αυτήν την εκστÏατεία με αυτήν τηνθέση\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
ΑΥΤΟΜΑΤΗ ΘΈΣΗ ΠΙÎΑΚΩΠALT ΠΡΟΣΤΙΘΈΜΕÎΗ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
η κατάσταση Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 1 και 6 χαÏακτήÏων στο μήκος\n"; + } + else + { + echo "
ΑΥΤΟΜΑΤΗ ΘΈΣΗ ΠΙÎΑΚΩΠALT ΠΡΟΣΤΙΘΈΜΕÎΗ: $campaign_id - $status\n"; + + $stmt="SELECT auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if (strlen($row[0])<2) {$row[0] = ' -';} + $auto_alt_dial_statuses = " $status$row[0]"; + $stmt="UPDATE vicidial_campaigns set auto_alt_dial_statuses='$auto_alt_dial_statuses' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A AUTO-ALT-DIAL STATUS|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$SUB=26; +$ADD=31; +} + + +###################### +# ADD=27 adds the new campaign agent pause code entry to the system +###################### + +if ($ADD==27) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_pause_codes where campaign_id='$campaign_id' and pause_code='$pause_code';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
ΚΩΔΙΚΑΣ ΜΙΚΡΗΣ ΔΙΑΚΟΠΉΣ ΠΡΑΚΤΟΡΩΠΠΡΟΣΤΙΘΕΜΕÎΟΣ - υπάÏχει ήδη μια είσοδος για αυτήν την εκστÏατεία με αυτόν τονκώδικα μικÏής διακοπής\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($pause_code) < 1) or (strlen($pause_code) > 6) or (strlen($pause_code_name) < 2) ) + { + echo "
ΚΩΔΙΚΑΣ ΜΙΚΡΗΣ ΔΙΑΚΟΠΉΣ ΠΡΑΚΤΟΡΩΠΠΡΟΣΤΙΘΕΜΕÎΟΣ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
pause code must be between 1 and 6 characters in length\n"; + echo "
pause code name must be between 2 and 30 characters in length\n"; + } + else + { + echo "
ΚΩΔΙΚΑΣ ΜΙΚΡΗΣ ΔΙΑΚΟΠΉΣ ΠΡΑΚΤΟΡΩΠΠΡΟΣΤΙΘΕΜΕÎΟΣ: $campaign_id - $pause_code - $pause_code_name\n"; + + $stmt="INSERT INTO vicidial_pause_codes(campaign_id,pause_code,pause_code_name,billable) values('$campaign_id','$pause_code','$pause_code_name','$billable');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW ΧΕΙΡΙΣΤΗΣPAUSE CODE|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$SUB=27; +$ADD=31; +} + + +###################### +# ADD=28 adds new status to the campaign dial statuses +###################### + +if ($ADD==28) +{ + $status = eregi_replace("-----.*",'',$status); + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and dial_statuses LIKE \"% $status %\";"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
ΘΕΣΗ ΠΙÎΑΚΩΠΕΚΣΤΡΑΤΕΙΑΣ ΠΡΟΣΤΙΘΕΜΕÎΗ - υπάÏχει ήδη μια είσοδος για αυτήν την εκστÏατεία με αυτήν τηνθέση\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
ΘΕΣΗ ΠΙÎΑΚΩΠΕΚΣΤΡΑΤΕΙΑΣ ΠΡΟΣΤΙΘΕΜΕÎΗ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
η κατάσταση Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 1 και 6 χαÏακτήÏων στο μήκος\n"; + } + else + { + echo "
ΘΕΣΗ ΠΙÎΑΚΩΠΕΚΣΤΡΑΤΕΙΑΣ ΠΡΟΣΤΙΘΕΜΕÎΗ: $campaign_id - $status\n"; + + $stmt="SELECT dial_statuses from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if (strlen($row[0])<2) {$row[0] = ' -';} + $dial_statuses = " $status$row[0]"; + $stmt="UPDATE vicidial_campaigns set dial_statuses='$dial_statuses' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ΠΡΟΣΘΗΚΗ ΕΚΣΤΡΑΤΕΙΑΣ DIAL STATUS |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +#$SUB=28; +$ADD=31; +} + + +###################### +# ADD=211 adds the new list to the system +###################### + +if ($ADD==211) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
Η ΛΙΣΤΑ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - υπάÏχει ήδη μία λίστα με αυτό το ID\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($list_name) < 2) or ($list_id < 100) or (strlen($list_id) > 8) ) + { + echo "
Η ΛΙΣΤΑ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
Το ID λίστας Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 2 και 8 χαÏακτήÏες\n"; + echo "
Το όνομα λίστας Ï€Ïέπει να είναι 2 χαÏακτήÏες\n"; + echo "
ID Λίστας must be greater than 100\n"; + } + else + { + echo "
ΛΙΣΤΑ ΠΡΟΣΤΕΘΗΚΕ: $list_id\n"; + + $stmt="INSERT INTO vicidial_lists (list_id,list_name,campaign_id,active,list_description,list_changedate) values('$list_id','$list_name','$campaign_id','$active','$list_description','$SQLdate');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW LIST |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=311; +} + + + +###################### +# ADD=2111 adds the new inbound group to the system +###################### + +if ($ADD==2111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_inbound_groups where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
Η ΟΜΑΔΑ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - υπάÏχει ήδη μία ομάδα με αυτό το ID\n";} + else + { + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
GROUP NOT ADDED - there is already a campaign in the system with this ID\n";} + else + { + if ( (strlen($group_id) < 2) or (strlen($group_name) < 2) or (strlen($group_color) < 2) or (strlen($group_id) > 20) or (eregi(' ',$group_id)) or (eregi("\-",$group_id)) or (eregi("\+",$group_id)) ) + { + echo "
Η ΟΜΑΔΑ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
Το ID ομάδας Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 2 και 20 χαÏακτήÏες ' -+'.\n"; + echo "
Το όνομα και χÏώμα ομάδας Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες\n"; + } + else + { + $stmt="INSERT INTO vicidial_inbound_groups (group_id,group_name,group_color,active,web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch) values('$group_id','$group_name','$group_color','$active','" . mysql_real_escape_string($web_form_address) . "','$voicemail_ext','$next_agent_call','$fronter_display','$script_id','$get_call_launch');"; + $rslt=mysql_query($stmt, $link); + + echo "
ΟΜΑΔΑ ΠΡΟΣΤΕΘΗΚΕ: $group_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW GROUP |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } +$ADD=3111; +} + + +###################### +# ADD=2011 adds copied inbound group to the system +###################### + +if ($ADD==2011) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_inbound_groups where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
Η ΟΜΑΔΑ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - υπάÏχει ήδη μία ομάδα με αυτό το ID\n";} + else + { + if ( (strlen($group_id) < 2) or (strlen($group_name) < 2) or (strlen($group_id) > 20) or (eregi(' ',$group_id)) or (eregi("\-",$group_id)) or (eregi("\+",$group_id)) ) + { + echo "
Η ΟΜΑΔΑ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
Το ID ομάδας Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 2 και 20 χαÏακτήÏες ' -+'.\n"; + echo "
Το όνομα και χÏώμα ομάδας Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες\n"; + } + else + { + $stmt="INSERT INTO vicidial_inbound_groups (group_id,group_name,group_color,active,web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_message,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group) SELECT \"$group_id\",\"$group_name\",group_color,\"N\",web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_message,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group from vicidial_inbound_groups where group_id=\"$source_group_id\";"; + $rslt=mysql_query($stmt, $link); + + echo "
ΟΜΑΔΑ ΠΡΟΣΤΕΘΗΚΕ: $group_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|COPIED TO NEW GROUP |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=3111; +} + + +###################### +# ADD=21111 adds new remote agents to the system +###################### + +if ($ADD==21111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_remote_agents where server_ip='$server_ip' and user_start='$user_start';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
ΟΙ ΑΠΟΜΑΚΡΥΣΜΕÎΟΙ ΧΕΙΡΙΣΤΕΣ ΔΕΠΠΡΟΣΤΕΘΗΚΑΠ- υπάÏχει ήδη καταχώÏηση απομακÏυσμένων χειÏιστών που ξεκινάει με αυτό το ID χÏήστη\n";} + else + { + if ( (strlen($server_ip) < 2) or (strlen($user_start) < 2) or (strlen($campaign_id) < 2) or (strlen($conf_exten) < 2) ) + { + echo "
ΟΙ ΑΠΟΜΑΚΡΥΣΜΕÎΟΙ ΧΕΙΡΙΣΤΕΣ ΔΕΠΠΡΟΣΤΕΘΗΚΑΠ- ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
Το ID χÏήστη και η εξωτεÏική εσωτ.σÏνδεση Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες\n"; + } + else + { + $stmt="INSERT INTO vicidial_remote_agents values('','$user_start','$number_of_lines','$server_ip','$conf_exten','$status','$campaign_id','$groups_value');"; + $rslt=mysql_query($stmt, $link); + + echo "
ΑΠΟΜΑΚΡΥΣΜΕÎΟΙ ΧΕΙΡΙΣΤΕΣ ΠΡΟΣΤΕΘΗΚΑÎ: $user_start\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW ΑΠΟΜΑΚΡΥΣΜΕÎΟΙ ΧΕΙΡΙΣΤΕΣ ENTRY |$PHP_AUTH_USER|$ip|'$user_start','$number_of_lines','$server_ip','$conf_exten','$status','$campaign_id','$groups_value'|\n"); + fclose($fp); + } + } + } +$ADD=10000; +} + +###################### +# ADD=211111 adds new user group to the system +###################### + +if ($ADD==211111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_user_groups where user_group='$user_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
ΔΕΠΠΡΟΣΤΕΘΗΚΕ Η ΟΜΑΔΑ ΧΡΗΣΤΗ - υπάÏχει ήδη μία καταχώÏηση ομάδας χÏήστη με αυτό το όνομα\n";} + else + { + if ( (strlen($user_group) < 2) or (strlen($group_name) < 2) ) + { + echo "
ΔΕΠΠΡΟΣΤΕΘΗΚΕ Η ΟΜΑΔΑ ΧΡΗΣΤΗ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
Η ομάδα και η πεÏιγÏαφή Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες\n"; + } + else + { + $stmt="INSERT INTO vicidial_user_groups(user_group,group_name,allowed_campaigns) values('$user_group','$group_name','-ALL-CAMPAIGNS-');"; + $rslt=mysql_query($stmt, $link); + + echo "
ΟΜΑΔΑ ΧΡΗΣΤΗ ΠΡΟΣΤΕΘΗΚΕ: $user_group\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ΠΡΟΣΘΗΚΗ ÎΕΟΥ ΧΡΗΣΤΗ GROUP ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=100000; +} + +###################### +# ADD=2111111 adds new script to the system +###################### + +if ($ADD==2111111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_scripts where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
Ο ΒΟΗΘΟΣ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - υπάÏχει ήδη μια είσοδος χειÏογÏάφων με αυτό το όνομα\n";} + else + { + if ( (strlen($script_id) < 2) or (strlen($script_name) < 2) or (strlen($script_text) < 2) ) + { + echo "
Ο ΒΟΗΘΟΣ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
Το όνομα, η πεÏιγÏαφή και το κείμενο χειÏογÏάφων Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες στο μήκος\n"; + } + else + { + $stmt="INSERT INTO vicidial_scripts values('$script_id','$script_name','$script_comments','$script_text','$active');"; + $rslt=mysql_query($stmt, $link); + + echo "
Ο ΒΟΗΘΟΣ ΠΡΟΣΤΕΘΗΚΕ: $script_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW SCRIPT ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=1000000; +} + + +###################### +# ADD=21111111 adds new filter to the system +###################### + +if ($ADD==21111111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_lead_filters where lead_filter_id='$lead_filter_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
ΤΟ ΦΙΛΤΡΟ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - υπάÏχει ήδη ένα φίλτÏο με αυτό το ID\n";} + else + { + if ( (strlen($lead_filter_id) < 2) or (strlen($lead_filter_name) < 2) or (strlen($lead_filter_sql) < 2) ) + { + echo "
ΤΟ ΦΙΛΤΡΟ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
ID φίλτÏου, όνομα και SQL Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες\n"; + } + else + { + $stmt="INSERT INTO vicidial_lead_filters SET lead_filter_id='$lead_filter_id',lead_filter_name='$lead_filter_name',lead_filter_comments='$lead_filter_comments',lead_filter_sql='$lead_filter_sql';"; + $rslt=mysql_query($stmt, $link); + + echo "
ΤΟ ΦΙΛΤΡΟ ΠΡΟΣΤΕΘΗΚΕ: $lead_filter_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW FILTER ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=10000000; +} + + +###################### +# ADD=211111111 adds new call time definition to the system +###################### + +if ($ADD==211111111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_call_times where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
Ο ΟΡΙΣΜΟΣ ΧΡΟÎΟΥ ΚΛΗΣΗ ΔΕΠΔΙΑΓΡΑΦΗΚΕ - υπάÏχει ήδη μία εγγÏαφή χÏόνου κλήσης με αυτό το ID\n";} + else + { + if ( (strlen($call_time_id) < 2) or (strlen($call_time_name) < 2) ) + { + echo "
Ο ΟΡΙΣΜΟΣ ΧΡΟÎΟΥ ΚΛΗΣΗ ΔΕΠΔΙΑΓΡΑΦΗΚΕ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
Το ID ΧÏόνου Κλήσης και το όνομα Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες\n"; + } + else + { + $stmt="INSERT INTO vicidial_call_times SET call_time_id='$call_time_id',call_time_name='$call_time_name',call_time_comments='$call_time_comments';"; + $rslt=mysql_query($stmt, $link); + + echo "
ΠΡΟΣΘΗΚΗ ΧΡΟÎΟΥ ΚΛΗΣΗΣ: $call_time_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW CALL TIME ENTRY |$stmt|\n"); + fclose($fp); + } + } + } +$ADD=311111111; +} + + +###################### +# ADD=2111111111 adds new state call time definition to the system +###################### + +if ($ADD==2111111111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_state_call_times where state_call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
Ο ΟΡΙΣΜΟΣ ΧΡΟÎΟΥ ΚΛΗΣΗΣ ΚΑΤΑΣΤΑΣΗΣ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - υπάÏχει ήδη μία εγγÏαφή χÏόνου κλήσης με αυτό το ID\n";} + else + { + if ( (strlen($call_time_id) < 2) or (strlen($call_time_name) < 2) or (strlen($state_call_time_state) < 2) ) + { + echo "
Ο ΟΡΙΣΜΟΣ ΧΡΟÎΟΥ ΚΛΗΣΗΣ ΚΑΤΑΣΤΑΣΗΣ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
Το ID ΧÏόνου Κλήσης Κατάστασης, το όνομα και η κατάσταση Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες \n"; + } + else + { + $stmt="INSERT INTO vicidial_state_call_times SET state_call_time_id='$call_time_id',state_call_time_name='$call_time_name',state_call_time_comments='$call_time_comments',state_call_time_state='$state_call_time_state';"; + $rslt=mysql_query($stmt, $link); + + echo "
ΠΡΟΣΘΗΚΗ ΧΡΟÎΟΥ ΚΛΗΣΗΣ ΚΑΤΑΣΤΑΣΗΣ: $call_time_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW STATE CALL TIME ENTRY|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=3111111111; +} + + +###################### +# ADD=21111111111 adds new phone to the system +###################### + +if ($ADD==21111111111) +{ +echo "
\n"; + echo ""; + $stmt="SELECT count(*) from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
ΤΟ ΤΗΛΕΦΩÎΟ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - υπάÏχει ήδη ένα τηλέφωνο με αυτή την εσωτ.σÏνδεση/διακομιστή\n";} + else + { + if ( (strlen($extension) < 1) or (strlen($server_ip) < 7) or (strlen($dialplan_number) < 1) or (strlen($voicemail_id) < 1) or (strlen($login) < 1) or (strlen($pass) < 1)) + {echo "
ΤΟ ΤΗΛΕΦΩÎΟ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n";} + else + { + echo "
ΤΟ ΤΗΛΕΦΩÎΟ ΠΡΟΣΤΕΘΗΚΕ\n"; + + $stmt="INSERT INTO phones (extension,dialplan_number,voicemail_id,phone_ip,computer_ip,server_ip,login,pass,status,active,phone_type,fullname,company,picture,protocol,local_gmt,outbound_cid) values('$extension','$dialplan_number','$voicemail_id','$phone_ip','$computer_ip','$server_ip','$login','$pass','$status','$active','$phone_type','$fullname','$company','$picture','$protocol','$local_gmt','$outbound_cid');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=31111111111; +} + + +###################### +# ADD=211111111111 adds new server to the system +###################### + +if ($ADD==211111111111) +{ +echo "
\n"; + echo ""; + $stmt="SELECT count(*) from servers where server_id='$server_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
Ο ΔΙΑΚΟΜΙΣΤΗΣ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - υπάÏχει ήδη ένας διακομιστής με αυτό το ID\n";} + else + { + if ( (strlen($server_id) < 1) or (strlen($server_ip) < 7) ) + {echo "
Ο ΔΙΑΚΟΜΙΣΤΗΣ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n";} + else + { + echo "
Ο ΔΙΑΚΟΜΙΣΤΗΣ ΠΡΟΣΤΕΘΗΚΕ\n"; + + $stmt="INSERT INTO servers (server_id,server_description,server_ip,active,asterisk_version) values('$server_id','$server_description','$server_ip','$active','$asterisk_version');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=311111111111; +} + + +###################### +# ADD=221111111111 adds the new vicidial server trunk record to the system +###################### + +if ($ADD==221111111111) +{ + echo ""; + $stmt="SELECT max_vicidial_trunks from servers where server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $MAXvicidial_trunks = $rowx[0]; + + $stmt="SELECT sum(dedicated_trunks) from vicidial_server_trunks where server_ip='$server_ip' and campaign_id !='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $SUMvicidial_trunks = ($rowx[0] + $dedicated_trunks); + + if ($SUMvicidial_trunks > $MAXvicidial_trunks) + { + echo "
Η ΕΓΓΡΑΦΗ ΤΟΥ ΚΟΡΜΟΥ ΣΤΟΠΕΞΥΠΗΡΕΤΗΤΗ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - ο αÏιθμός των κοÏμών είναι Ï€Î¿Î»Ï Ï…ÏˆÎ·Î»ÏŒÏ‚: $SUMvicidial_trunks / $MAXvicidial_trunks\n"; + } + else + { + $stmt="SELECT count(*) from vicidial_server_trunks where campaign_id='$campaign_id' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
Η ΕΓΓΡΑΦΗ ΤΟΥ ΚΟΡΜΟΥ ΣΤΟΠΕΞΥΠΗΡΕΤΗΤΗ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - υπάÏχει ήδη μία εγγÏαφή-κοÏÎ¼Î¿Ï ÏƒÏ„Î¿Î½ εξυπηÏετητή για την εκστÏατεία\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($server_ip) < 7) or (strlen($dedicated_trunks) < 1) or (strlen($trunk_restriction) < 1) ) + { + echo "
Η ΕΓΓΡΑΦΗ ΤΟΥ ΚΟΡΜΟΥ ΣΤΟΠΕΞΥΠΗΡΕΤΗΤΗ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
η εκστÏατεία Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 3 και 8 χαÏακτήÏων στο μήκος\n"; + echo "
η server_ip καθυστέÏηση Ï€Ïέπει να είναι τουλάχιστον 7 χαÏακτήÏες\n"; + echo "
οι κοÏμοί Ï€Ïέπει να είναι ένα ψηφίο από 0 έως 9999\n"; + } + else + { + echo "
Η ΕΓΓΡΑΦΗ ΤΟΥ ΚΟΡΜΟΥ ΣΤΟΠΕΞΥΠΗΡΕΤΗΤΗ ΠΡΟΣΤΕΘΗΚΕ: $campaign_id - $server_ip - $dedicated_trunks - $trunk_restriction\n"; + + $stmt="INSERT INTO vicidial_server_trunks(server_ip,campaign_id,dedicated_trunks,trunk_restriction) values('$server_ip','$campaign_id','$dedicated_trunks','$trunk_restriction');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW VICIDIAL TRUNK |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } +$ADD=311111111111; +} + + +###################### +# ADD=2111111111111 adds new conference to the system +###################### + +if ($ADD==2111111111111) +{ +echo "
\n"; + echo ""; + $stmt="SELECT count(*) from conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
Η ΣΥÎΔΙΑΛΕΞΗ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - υπάÏχει ήδη μία συνδιάλεξη με αυτό το ID και διακομιστή\n";} + else + { + if ( (strlen($conf_exten) < 1) or (strlen($server_ip) < 7) ) + {echo "
Η ΣΥÎΔΙΑΛΕΞΗ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n";} + else + { + echo "
Η ΣΥÎΔΙΑΛΕΞΗ ΠΡΟΣΤΕΘΗΚΕ\n"; + + $stmt="INSERT INTO conferences (conf_exten,server_ip) values('$conf_exten','$server_ip');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=3111111111111; +} + + +###################### +# ADD=21111111111111 adds new vicidial conference to the system +###################### + +if ($ADD==21111111111111) +{ +echo "
\n"; + echo ""; + $stmt="SELECT count(*) from vicidial_conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
VICIDIAL CONFERENCE NOT ADDED - there is already a vicidial conference in the system with this ID and server\n";} + else + { + if ( (strlen($conf_exten) < 1) or (strlen($server_ip) < 7) ) + {echo "
VICIDIAL Η ΣΥÎΔΙΑΛΕΞΗ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n";} + else + { + echo "
VICIDIAL Η ΣΥÎΔΙΑΛΕΞΗ ΠΡΟΣΤΕΘΗΚΕ\n"; + + $stmt="INSERT INTO vicidial_conferences (conf_exten,server_ip) values('$conf_exten','$server_ip');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=31111111111111; +} + + +###################### +# ADD=221111111111111 adds the new system status to the system +###################### + +if ($ADD==221111111111111) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaign_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
ΘΕΣΗ ΣΥΣΤΗΜΑΤΩΠΠΡΟΣΤΙΘΕΜΕÎΗ - there is already a campaign-status in the system with this name: $row[0]\n";} + else + { + $stmt="SELECT count(*) from vicidial_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
ΘΕΣΗ ΣΥΣΤΗΜΑΤΩΠΠΡΟΣΤΙΘΕΜΕÎΗ - there is already a global-status in the system with this name\n";} + else + { + if ( (strlen($status) < 1) or (strlen($status_name) < 2) ) + { + echo "
ΘΕΣΗ ΣΥΣΤΗΜΑΤΩΠΠΡΟΣΤΙΘΕΜΕÎΗ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
η κατάσταση Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 1 και 8 χαÏακτήÏÏες\n"; + echo "
το όνομα της κατάστασης Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 2 και 30 χαÏακτήÏÏες\n"; + } + else + { + echo "
ΘΕΣΗ ΣΥΣΤΗΜΑΤΩΠΠΡΟΣΤΙΘΕΜΕÎΗ: $status_name - $status\n"; + + $stmt="INSERT INTO vicidial_statuses (status,status_name,selectable,human_answered,category) values('$status','$status_name','$selectable','$human_answered','$category');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW SYSTEM STATUS |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } +$ADD=321111111111111; +} + + +###################### +# ADD=231111111111111 adds the new status category to the system +###################### + +if ($ADD==231111111111111) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_status_categories where vsc_id='$vsc_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
ΚΑΤΗΓΟΡΙΑ ΘΕΣΗΣ ΠΡΟΣΤΙΘΕΜΕÎΗ - υπάÏχει ήδη μια κατηγοÏία θέσης στο σÏστημα με αυτήν τηνταυτότητα: $row[0]\n";} + else + { + if ( (strlen($vsc_id) < 2) or (strlen($vsc_id) > 20) or (strlen($vsc_name) < 2) ) + { + echo "
ΚΑΤΗΓΟΡΙΑ ΘΕΣΗΣ ΠΡΟΣΤΙΘΕΜΕÎΗ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
Η ταυτότητα Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 2 και 20 χαÏακτήÏων στο μήκος\n"; + echo "
το όνομα ονόματος Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 2 και 50 χαÏακτήÏων στομήκος\n"; + } + else + { + echo "
STATUS CATEGORY ADDED: $vsc_id - $vsc_name\n"; + + $stmt="SELECT count(*) from vicidial_status_categories where tovdad_display='Y' and vsc_id NOT IN('$vsc_id');"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 3) and (ereg('Y',$tovdad_display)) ) + { + $tovdad_display = 'N'; + echo "
ΛΑΘΟΣ: ΥπάÏχουν ήδη 4 κατηγοÏίες θέσης καθοÏισμένες την επίδειξηTimeOnVDAD\n"; + } + + $stmt="INSERT INTO vicidial_status_categories (vsc_id,vsc_name,vsc_description,tovdad_display) values('$vsc_id','$vsc_name','$vsc_description','$tovdad_display');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW STATUS CATEGORY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=331111111111111; +} + + + +###################################################################################################### +###################################################################################################### +####### 4 series, record modifications submitted and DB is modified, then on to 3 series forms below +###################################################################################################### +###################################################################################################### + + + +###################### +# ADD=4A submit user modifications to the system - ADMIN +###################### + +if ($ADD=="4A") +{ + if ($LOGmodify_users==1) + { + echo ""; + + if ( (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) + { + echo "
Ο ΧΡΗΣΤΗΣ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
Ο κωδικός και το πλήÏες όνομα Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες το κάθε ένα\n"; + } + else + { + echo "
ΧΡΗΣΤΗΣ ΤΡΟΠΟΠΟΙΗΘΗΚΕ - ADMIN: $user\n"; + + $stmt="UPDATE vicidial_users set pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass',delete_users='$delete_users',delete_user_groups='$delete_user_groups',delete_lists='$delete_lists',delete_campaigns='$delete_campaigns',delete_ingroups='$delete_ingroups',delete_remote_agents='$delete_remote_agents',load_leads='$load_leads',campaign_detail='$campaign_detail',ast_admin_access='$ast_admin_access',ast_delete_phones='$ast_delete_phones',delete_scripts='$delete_scripts',modify_leads='$modify_leads',hotkeys_active='$hotkeys_active',change_agent_campaign='$change_agent_campaign',agent_choose_ingroups='$agent_choose_ingroups',closer_campaigns='$groups_value',scheduled_callbacks='$scheduled_callbacks',agentonly_callbacks='$agentonly_callbacks',agentcall_manual='$agentcall_manual',vicidial_recording='$vicidial_recording',vicidial_transfers='$vicidial_transfers',delete_filters='$delete_filters',alter_agent_interface_options='$alter_agent_interface_options',closer_default_blended='$closer_default_blended',delete_call_times='$delete_call_times',modify_call_times='$modify_call_times',modify_users='$modify_users',modify_campaigns='$modify_campaigns',modify_lists='$modify_lists',modify_scripts='$modify_scripts',modify_filters='$modify_filters',modify_ingroups='$modify_ingroups',modify_usergroups='$modify_usergroups',modify_remoteagents='$modify_remoteagents',modify_servers='$modify_servers',view_reports='$view_reports',vicidial_recording_override='$vicidial_recording_override',alter_custdata_override='$alter_custdata_override' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER INFO |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +$ADD=3; # go to user modification below +} + + +###################### +# ADD=4B submit user modifications to the system - ADMIN +###################### + +if ($ADD=="4B") +{ + if ($LOGmodify_users==1) + { + echo ""; + + if ( (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) + { + echo "
Ο ΧΡΗΣΤΗΣ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
Ο κωδικός και το πλήÏες όνομα Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες το κάθε ένα\n"; + } + else + { + echo "
ΧΡΗΣΤΗΣ ΤΡΟΠΟΠΟΙΗΘΗΚΕ - ADMIN: $user\n"; + + $stmt="UPDATE vicidial_users set pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass',hotkeys_active='$hotkeys_active',agent_choose_ingroups='$agent_choose_ingroups',closer_campaigns='$groups_value',scheduled_callbacks='$scheduled_callbacks',agentonly_callbacks='$agentonly_callbacks',agentcall_manual='$agentcall_manual',vicidial_recording='$vicidial_recording',vicidial_transfers='$vicidial_transfers',closer_default_blended='$closer_default_blended',vicidial_recording_override='$vicidial_recording_override',alter_custdata_override='$alter_custdata_override' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER INFO |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +$ADD=3; # go to user modification below +} + + + +###################### +# ADD=4 submit user modifications to the system +###################### + +if ($ADD==4) +{ + if ($LOGmodify_users==1) + { + echo ""; + + if ( (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) + { + echo "
Ο ΧΡΗΣΤΗΣ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
Ο κωδικός και το πλήÏες όνομα Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες το κάθε ένα\n"; + } + else + { + echo "
ΧΡΗΣΤΗΣ ΤΡΟΠΟΠΟΙΗΘΗΚΕ: $user\n"; + + $stmt="UPDATE vicidial_users set pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER INFO |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +$ADD=3; # go to user modification below +} + +###################### +# ADD=41 submit campaign modifications to the system +###################### + +if ($ADD==41) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_name) < 6) or (strlen($active) < 1) ) + { + echo "
Η ΕΚΣΤΡΑΤΕΙΑ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
το όνομα της εκστÏατείας Ï€Ïέπει να είναι τουλάχιστον 6 χαÏακτήÏες\n"; + echo "
|$campaign_name|$active|\n"; + } + else + { + echo "
ΕΣΤΡΑΤΕΙΑ ΤΡΟΠΟΠΟΙΗΘΗΚΕ: $campaign_id\n"; + + if ($dial_method == 'MANUAL') + { + $auto_dial_level='0'; + $adlSQL = "auto_dial_level='0',"; + } + else + { + if ($dial_level_override > 0) + { + $adlSQL = "auto_dial_level='$auto_dial_level',"; + } + else + { + if ($dial_method == 'RATIO') + { + if ($auto_dial_level < 1) {$auto_dial_level = "1.0";} + $adlSQL = "auto_dial_level='$auto_dial_level',"; + } + else + { + $adlSQL = ""; + if ($auto_dial_level < 1) + { + $auto_dial_level = "1.0"; + $adlSQL = "auto_dial_level='$auto_dial_level',"; + } + } + } + } + if ( (!ereg("DISABLED",$list_order_mix)) and ($hopper_level < 100) ) + {$hopper_level='100';} + + $stmtA="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',allow_closers='$allow_closers',hopper_level='$hopper_level', $adlSQL next_agent_call='$next_agent_call', local_call_time='$local_call_time', voicemail_ext='$voicemail_ext', dial_timeout='$dial_timeout', dial_prefix='$dial_prefix', campaign_cid='$campaign_cid', campaign_vdad_exten='$campaign_vdad_exten', web_form_address='" . mysql_real_escape_string($web_form_address) . "', park_ext='$park_ext', park_file_name='$park_file_name', campaign_rec_exten='$campaign_rec_exten', campaign_recording='$campaign_recording', campaign_rec_filename='$campaign_rec_filename', campaign_script='$script_id', get_call_launch='$get_call_launch', am_message_exten='$am_message_exten', amd_send_to_vmx='$amd_send_to_vmx', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number',lead_filter_id='$lead_filter_id',alt_number_dialing='$alt_number_dialing',scheduled_callbacks='$scheduled_callbacks',safe_harbor_message='$safe_harbor_message',drop_call_seconds='$drop_call_seconds',safe_harbor_exten='$safe_harbor_exten',wrapup_seconds='$wrapup_seconds',wrapup_message='$wrapup_message',closer_campaigns='$groups_value',use_internal_dnc='$use_internal_dnc',allcalls_delay='$allcalls_delay',omit_phone_code='$omit_phone_code',dial_method='$dial_method',available_only_ratio_tally='$available_only_ratio_tally',adaptive_dropped_percentage='$adaptive_dropped_percentage',adaptive_maximum_level='$adaptive_maximum_level',adaptive_latest_server_time='$adaptive_latest_server_time',adaptive_intensity='$adaptive_intensity',adaptive_dl_diff_target='$adaptive_dl_diff_target',concurrent_transfers='$concurrent_transfers',auto_alt_dial='$auto_alt_dial',agent_pause_codes_active='$agent_pause_codes_active',campaign_description='$campaign_description',campaign_changedate='$SQLdate',campaign_stats_refresh='$campaign_stats_refresh',disable_alter_custdata='$disable_alter_custdata',no_hopper_leads_logins='$no_hopper_leads_logins',list_order_mix='$list_order_mix',campaign_allow_inbound='$campaign_allow_inbound',manual_dial_list_id='$manual_dial_list_id',default_xfer_group='$default_xfer_group',xfer_groups='$XFERgroups_value' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + if ($reset_hopper == 'Y') + { + echo "
ΕΠΑÎΑΦΟΡΑ ΚΑΘΟΘΗΓΗΤΗ ΕΚΣΤΡΑΤΕΙΑΣ HOPPER\n"; + echo "
- Αναμονή 1 Î»ÎµÏ€Ï„Î¿Ï Ï€Ïιν την κλήση του επόμενου αÏιθμοÏ\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id' and status IN('READY','QUEUE','DONE');"; + $rslt=mysql_query($stmt, $link); + + ### LOG RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|CAMPAIGN HOPPERRESET|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CAMPAIGN INFO|$PHP_AUTH_USER|$ip|$stmtA|$reset_hopper|\n"); + fclose($fp); + } + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=42 modify/delete campaign status in the system +###################### + +if ($ADD==42) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
Η ΚΑΤΑΣΤΑΣΗ ΤΗΣ ΕΚΣΤΡΑΤΕΙΑΣ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
το ID της εκστÏατείας Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες\n"; + echo "
η κατάσταση της εκστÏατείας Ï€Ïέπει να είναι τουλάχιστον 1 χαÏακτήÏας\n"; + } + else + { + if (ereg('delete',$stage)) + { + echo "
ΔΙΑΓΡΑΦΗΚΕ Η ΠΡΟΣΑΡΜΟΣΜΕÎΗ ΚΑΤΑΣΤΑΣΗ ΤΗΣ ΕΚΣΤΡΑΤΕΙΑΣ: $campaign_id - $status\n"; + + $stmt="DELETE FROM vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + + $stmtA="DELETE FROM vicidial_campaign_hotkeys where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmtA, $link); + + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE CAMPAIGN STATUS|$PHP_AUTH_USER|$ip|$stmt|$stmtA|\n"); + fclose($fp); + } + } + if (ereg('modify',$stage)) + { + echo "
ΘΕΣΗ ΕΚΣΤΡΑΤΕΙΑΣ ΣΥÎΗΘΕΙΑΣ ΤΡΟΠΟΠΟΙΗΜΕÎΗ: $campaign_id - $status\n"; + + $stmt="UPDATE vicidial_campaign_statuses SET status_name='$status_name',selectable='$selectable',human_answered='$human_answered',category='$category' where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CAMPAIGN STATUS|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +$SUB=22; +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=43 delete campaign hotkey in the system +###################### + +if ($ADD==43) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($hotkey) < 1) ) + { + echo "
ΤΟ ΚΛΕΙΔΙ ΤΗΣ ΕΚΣΤΡΑΤΕΙΑΣ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
το ID της εκστÏατείας Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες\n"; + echo "
η κατάσταση της εκστÏατείας Ï€Ïέπει να είναι τουλάχιστον 1 χαÏακτήÏας\n"; + echo "
the campaign hotkey needs to be at least 1 characters in length\n"; + } + else + { + echo "
ΔΙΑΦΡΑΦΗΚΕ ΤΟ ΠΡΟΣΑΡΜΟΣΜΕÎΟ ΚΛΕΙΔΙ ΤΗΣ ΕΚΣΤΡΑΤΕΙΑΣ: $campaign_id - $status - $hotkey\n"; + + $stmt="DELETE FROM vicidial_campaign_hotkeys where campaign_id='$campaign_id' and status='$status' and hotkey='$hotkey';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE CAMPAIGN STATUS|$PHP_AUTH_USER|$ip|DELETE FROM vicidial_campaign_hotkeys where campaign_id='$campaign_id' and status='$status' and hotkey='$hotkey'|\n"); + fclose($fp); + } + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +$SUB=23; +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=44 submit campaign modifications to the system - Basic View +###################### + +if ($ADD==44) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_name) < 6) or (strlen($active) < 1) ) + { + echo "
Η ΕΚΣΤΡΑΤΕΙΑ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
το όνομα της εκστÏατείας Ï€Ïέπει να είναι τουλάχιστον 6 χαÏακτήÏες\n"; + } + else + { + echo "
ΕΣΤΡΑΤΕΙΑ ΤΡΟΠΟΠΟΙΗΘΗΚΕ: $campaign_id\n"; + + if ($dial_method == 'RATIO') + { + if ($auto_dial_level < 1) {$auto_dial_level = "1.0";} + $adlSQL = "auto_dial_level='$auto_dial_level',"; + } + else + { + if ($dial_method == 'MANUAL') + { + $auto_dial_level='0'; + $adlSQL = "auto_dial_level='0',"; + } + else + { + $adlSQL = ""; + if ($auto_dial_level < 1) + { + $auto_dial_level = "1.0"; + $adlSQL = "auto_dial_level='$auto_dial_level',"; + } + } + } + if ( (!ereg("DISABLED",$list_order_mix)) and ($hopper_level < 100) ) + {$hopper_level='100';} + + $stmtA="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',hopper_level='$hopper_level', $adlSQL lead_filter_id='$lead_filter_id',dial_method='$dial_method',adaptive_intensity='$adaptive_intensity',campaign_changedate='$SQLdate',list_order_mix='$list_order_mix' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + if ($reset_hopper == 'Y') + { + echo "
ΕΠΑÎΑΦΟΡΑ ΚΑΘΟΘΗΓΗΤΗ ΕΚΣΤΡΑΤΕΙΑΣ HOPPER\n"; + echo "
- Αναμονή 1 Î»ÎµÏ€Ï„Î¿Ï Ï€Ïιν την κλήση του επόμενου αÏιθμοÏ\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id' and status IN('READY','QUEUE','DONE');;"; + $rslt=mysql_query($stmt, $link); + + ### LOG HOPPER RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|CAMPAIGN HOPPERRESET|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CAMPAIGN INFO|$PHP_AUTH_USER|$ip|$stmtA|$reset_hopper|\n"); + fclose($fp); + } + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +$ADD=34; # go to campaign modification form below +} + +###################### +# ADD=45 modify campaign lead recycle in the system +###################### + +if ($ADD==45) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or ($attempt_delay < 120) or ($attempt_maximum < 1) or ($attempt_maximum > 10) ) + { + echo "
CAMPAIGN LEAD RECYCLE NOT MODIFIED - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
η κατάσταση Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 1 και 6 χαÏακτήÏων στο μήκος\n"; + echo "
η καθυστέÏηση Ï€Ïοσπάθειας Ï€Ïέπει να είναι τουλάχιστον 120δευτεÏόλεπτα\n"; + echo "
οι μέγιστες Ï€Ïοσπάθειες Ï€Ïέπει να είναι από 1 έως 10\n"; + } + else + { + echo "
CAMPAIGN LEAD MODIFIED: $campaign_id - $status - $attempt_delay\n"; + + $stmt="UPDATE vicidial_lead_recycle SET attempt_delay='$attempt_delay',attempt_maximum='$attempt_maximum',active='$active' where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LEAD RECYCLE |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +$SUB=25; +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=47 modify agent pause code in the system +###################### + +if ($ADD==47) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($pause_code) < 1) or (strlen($pause_code) > 6) or (strlen($pause_code_name) < 2) ) + { + echo "
ΚΩΔΙΚΑΣ ΜΙΚΡΗΣ ΔΙΑΚΟΠΉΣ ΠΡΑΚΤΟΡΩΠΤΡΟΠΟΠΟΙΗΜΕÎΟΣ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
pause_code must be between 1 and 6 characters in length\n"; + echo "
pause_code name must be between 2 and 30 characters in length\n"; + } + else + { + echo "
ΧΕΙΡΙΣΤΗΣPAUSE CODE MODIFIED: $campaign_id - $pause_code - $pause_code_name\n"; + + $stmt="UPDATE vicidial_pause_codes SET pause_code_name='$pause_code_name',billable='$billable' where campaign_id='$campaign_id' and pause_code='$pause_code';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY ΧΕΙΡΙΣΤΗΣPAUSECODE|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +$SUB=27; +$ADD=31; # go to campaign modification form below +} + + +###################### +# ADD=49 modify campaign list mix in the system +###################### + +if ($ADD==49) +{ + if ($LOGmodify_campaigns==1) + { + ##### MODIFY a list mix container entry ##### + if ($stage=='MODIFY') + { + echo ""; + + $Flist_mix_container = "list_mix_container_$vcl_id"; + $Fmix_method = "mix_method_$vcl_id"; + $Fstatus = "status_$vcl_id"; + $Fvcl_name = "vcl_name_$vcl_id"; + + if (isset($_GET[$Flist_mix_container])) {$list_mix_container=$_GET[$Flist_mix_container];} + elseif (isset($_POST[$Flist_mix_container])) {$list_mix_container=$_POST[$Flist_mix_container];} + if (isset($_GET[$Fmix_method])) {$mix_method=$_GET[$Fmix_method];} + elseif (isset($_POST[$Fmix_method])) {$mix_method=$_POST[$Fmix_method];} + if (isset($_GET[$Fstatus])) {$status=$_GET[$Fstatus];} + elseif (isset($_POST[$Fstatus])) {$status=$_POST[$Fstatus];} + if (isset($_GET[$Fvcl_name])) {$vcl_name=$_GET[$Fvcl_name];} + elseif (isset($_POST[$Fvcl_name])) {$vcl_name=$_POST[$Fvcl_name];} + $list_mix_container = preg_replace("/:$/","",$list_mix_container); + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) or (strlen($list_mix_container) < 6) or (strlen($vcl_name) < 2) ) + { + echo "
ΜΙΓΜΑ ΚΑΤΑΛΟΓΩΠΤΡΟΠΟΠΟΙΗΜΕÎΟ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + echo "
vcl_name name must be between 2 and 30 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_campaigns_list_mix SET vcl_name='$vcl_name',mix_method='$mix_method',list_mix_container='$list_mix_container' where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
ΜΙΓΜΑ ΚΑΤΑΛΟΓΩΠΤΡΟΠΟΠΟΙΗΜΕÎΟ: $campaign_id - $vcl_id - $vcl_name\n"; + } + } + + ##### ADD a list mix container entry ##### + if ($stage=='ADD') + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) or (strlen($list_id) < 1) ) + { + echo "
ΜΙΓΜΑ ΚΑΤΑΛΟΓΩΠΤΡΟΠΟΠΟΙΗΜΕÎΟ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + echo "
list_id must be at least 2 characters in length\n"; + } + else + { + $stmt="SELECT list_mix_container from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $OLDlist_mix_container = $row[0]; + $NEWlist_mix_container = "$OLDlist_mix_container:$list_id|10|0| -|"; + + $stmt="UPDATE vicidial_campaigns_list_mix SET list_mix_container='$NEWlist_mix_container' where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
ΜΙΓΜΑ ΚΑΤΑΛΟΓΩΠΤΡΟΠΟΠΟΙΗΜΕÎΟ: $campaign_id - $vcl_id - $list_id\n"; + } + } + + ##### REMOVE a list mix container entry ##### + if ($stage=='REMOVE') + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) or (strlen($list_id) < 1) ) + { + echo "
ΜΙΓΜΑ ΚΑΤΑΛΟΓΩΠΤΡΟΠΟΠΟΙΗΜΕÎΟ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + echo "
list_id must be at least 2 characters in length\n"; + } + else + { + $stmt="SELECT list_mix_container from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $MIXentries = $MT; + $MIXentries = explode(":", $row[0]); + $Ms_to_print = (count($MIXentries) - 0); + + if ($Ms_to_print < 2) + { + echo "
ΜΙΓΜΑ ΚΑΤΑΛΟΓΩΠΤΡΟΠΟΠΟΙΗΜΕÎΟ: Δεν μποÏείτε να διαγÏάψετε το τελευταίο λήμμα list_id από έναμίγμα καταλόγων\n"; + } + else + { + $MIXdetailsPCT = explode('|', $MIXentries[$mix_container_item]); + $MIXpercentPCT = $MIXdetailsPCT[2]; + + $q=0; + while ($Ms_to_print > $q) + { + if ( ($mix_container_item > $q) or ($mix_container_item < $q) ) + { + if ( ($q==0) and ($mix_container_item > 0) ) + { + $MIXdetailsONE = explode('|', $MIXentries[$q]); + $MIXpercentONE = ($MIXdetailsONE[2] + $MIXpercentPCT); + $NEWlist_mix_container .= "$MIXdetailsONE[0]|$MIXdetailsONE[1]|$MIXpercentONE|$MIXdetailsONE[3]|:"; + } + else + { + if ( ($q==1) and ($mix_container_item < 1) ) + { + $MIXdetailsONE = explode('|', $MIXentries[$q]); + $MIXpercentONE = ($MIXdetailsONE[2] + $MIXpercentPCT); + $NEWlist_mix_container .= "$MIXdetailsONE[0]|$MIXdetailsONE[1]|$MIXpercentONE|$MIXdetailsONE[3]|:"; + } + else + { + $NEWlist_mix_container .= "$MIXentries[$q]:"; + } + } + } + $q++; + } + $NEWlist_mix_container = preg_replace("/.$/",'',$NEWlist_mix_container); + + $stmt="UPDATE vicidial_campaigns_list_mix SET list_mix_container='$NEWlist_mix_container' where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
ΜΙΓΜΑ ΚΑΤΑΛΟΓΩΠΤΡΟΠΟΠΟΙΗΜΕÎΟ: $campaign_id - $vcl_id - $list_id - $mix_container_item\n"; + } + } + } + + ##### ADD a NEW list mix ##### + if ($stage=='NEWMIX') + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) or (strlen($vcl_name) < 2) ) + { + echo "
ΜΙΓΜΑ ΚΑΤΑΛΟΓΩΠΠΡΟΣΤΙΘΕΜΕÎΟ- ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + echo "
vcl_name must be at least 2 characters in length\n"; + } + else + { + $stmt="SELECT count(*) from vicidial_campaigns_list_mix where vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + echo "
ΜΙΓΜΑ ΚΑΤΑΛΟΓΩΠΠΡΟΣΤΙΘΕΜΕÎΟ- ΥπάÏχει ήδη ένα μίγμα καταλόγων με αυτήν την ταυτότητα στοσÏστημα\n"; + } + else + { + $stmt="INSERT INTO vicidial_campaigns_list_mix SET list_mix_container='$list_id|1|100| $status -|',campaign_id='$campaign_id',vcl_id='$vcl_id',vcl_name='$vcl_name',mix_method='$mix_method',status='INACTIVE';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
ΜΙΓΜΑ ΚΑΤΑΛΟΓΩΠΠΡΟΣΤΙΘΕΜΕÎΟ:$campaign_id - $vcl_id - $vcl_name\n"; + } + } + } + + ##### DELETE an existing list mix ##### + if ($stage=='DELMIX') + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) ) + { + echo "
ΜΙΓΜΑ ΚΑΤΑΛΟΓΩΠΠΟΥ ΔΕΠΔΙΑΓΡΑΦΕΤΑΙ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_campaigns_list_mix where vcl_id='$vcl_id' and campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
ΜΙΓΜΑ ΚΑΤΑΛΟΓΩΠΠΟΥ ΔΙΑΓΡΑΦΕΤΑΙ:$campaign_id - $vcl_id - $vcl_name\n"; + } + } + + ##### Set list mix entry to active ##### + if ($stage=='SETACTIVE') + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) ) + { + echo "
ΜΙΓΜΑ ΚΑΤΑΛΟΓΩΠΠΟΥ ΔΕΠΕÎΕΡΓΟΠΟΙΕΙΤΑΙ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_campaigns_list_mix SET status='INACTIVE' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_campaigns_list_mix SET status='ACTIVE' where vcl_id='$vcl_id' and campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
ΜΙΓΜΑ ΚΑΤΑΛΟΓΩΠΠΟΥ ΕÎΕΡΓΟΠΟΙΕΙΤΑΙ: $campaign_id - $vcl_id - $vcl_name\n"; + } + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +$SUB=29; +$ADD=31; # go to campaign modification form below +} + + +###################### +# ADD=411 submit list modifications to the system +###################### + +if ($ADD==411) +{ + if ($LOGmodify_lists==1) + { + echo ""; + + if ( (strlen($list_name) < 2) or (strlen($campaign_id) < 2) ) + { + echo "
Η ΛΙΣΤΑ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
η λίστα Ï€Ïέπει να είναι τουλαχιστον 2 χαÏακτήÏες\n"; + } + else + { + echo "
ΛΙΣΤΑ ΤΡΟΠΟΠΟΙΗΘΗΚΕ: $list_id\n"; + + $stmt="UPDATE vicidial_lists set list_name='$list_name',campaign_id='$campaign_id',active='$active',list_description='$list_description',list_changedate='$SQLdate' where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + if ($reset_list == 'Y') + { + echo "
ΕΠΑÎΑΦΟΡΑ ΚΑΤΑΣΤΑΣΗΣ ΚΛΗΣΗΣ ΛΙΣΤΑΣ\n"; + $stmt="UPDATE vicidial_list set called_since_last_reset='N' where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|RESET LIST CALLED |$PHP_AUTH_USER|$ip|list_name='$list_name'|\n"); + fclose($fp); + } + } + if ($campaign_id != "$old_campaign_id") + { + echo "
ΑΠΟΜΑΚΡΥÎΣΗ ΚΑΘΟΔΗΓΗΤΩΠΛΙΣΤΑΣ HOPPER ΑΠΟ ΠΑΛΑΙΑ HOPPER ΕΚΣΤΡΑΤΕΙΑ ($old_campaign_id)\n"; + $stmt="DELETE from vicidial_hopper where list_id='$list_id' and campaign_id='$old_campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST INFO |$PHP_AUTH_USER|$ip|list_name='$list_name',campaign_id='$campaign_id',active='$active',list_description='$list_description' where list_id='$list_id'|\n"); + fclose($fp); + } + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +$ADD=311; # go to list modification form below +} + + +###################### +# ADD=4111 modify in-group info in the system +###################### + +if ($ADD==4111) +{ + if ($LOGmodify_ingroups==1) + { + echo ""; + + if ( (strlen($group_name) < 2) or (strlen($group_color) < 2) ) + { + echo "
Η ΟΜΑΔΑ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
το όνομα και χÏώμα ομάδας Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες\n"; + } + else + { + echo "
ΟΜΑΔΑ ΤΡΟΠΟΠΟΙΗΘΗΚΕ: $group_id\n"; + + $stmt="UPDATE vicidial_inbound_groups set group_name='$group_name', group_color='$group_color', active='$active', web_form_address='" . mysql_real_escape_string($web_form_address) . "', voicemail_ext='$voicemail_ext', next_agent_call='$next_agent_call', fronter_display='$fronter_display', ingroup_script='$script_id', get_call_launch='$get_call_launch', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number',drop_message='$drop_message',drop_call_seconds='$drop_call_seconds',drop_exten='$drop_exten',call_time_id='$call_time_id',after_hours_action='$after_hours_action',after_hours_message_filename='$after_hours_message_filename',after_hours_exten='$after_hours_exten',after_hours_voicemail='$after_hours_voicemail',welcome_message_filename='$welcome_message_filename',moh_context='$moh_context',onhold_prompt_filename='$onhold_prompt_filename',prompt_interval='$prompt_interval',agent_alert_exten='$agent_alert_exten',agent_alert_delay='$agent_alert_delay',default_xfer_group='$default_xfer_group' where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY GROUP INFO |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +$ADD=3111; # go to in-group modification form below +} + + + +###################### +# ADD=41111 modify remote agents info in the system +###################### + +if ($ADD==41111) +{ + if ($LOGmodify_remoteagents==1) + { + echo ""; + + if ( (strlen($server_ip) < 2) or (strlen($user_start) < 2) or (strlen($campaign_id) < 2) or (strlen($conf_exten) < 2) ) + { + echo "
ΑΠΟΜΑΚΡΥΣΜΕÎΟΙ ΧΕΙΡΙΣΤΕΣ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΑΠ- ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
Το ID του χÏήστη και η εξωτεÏική εσωτ.σÏνδεση Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες\n"; + } + else + { + $stmt="UPDATE vicidial_remote_agents set user_start='$user_start', number_of_lines='$number_of_lines', server_ip='$server_ip', conf_exten='$conf_exten', status='$status', campaign_id='$campaign_id', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
ΑΠΟΜΑΚΡΥΣΜΕÎΟΙ ΧΕΙΡΙΣΤΕΣ ΤΡΟΠΟΠΟΙΗΘΗΚΑÎ\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY ΑΠΟΜΑΚΡΥΣΜΕÎΟΙ ΧΕΙΡΙΣΤΕΣ ENTRY |$PHP_AUTH_USER|$ip|set user_start='$user_start', number_of_lines='$number_of_lines', server_ip='$server_ip', conf_exten='$conf_exten', status='$status', campaign_id='$campaign_id', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id'|\n"); + fclose($fp); + } + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +$ADD=31111; # go to remote agents modification form below +} + + + +###################### +# ADD=411111 modify user group info in the system +###################### + +if ($ADD==411111) +{ + if ($LOGmodify_usergroups==1) + { + echo ""; + + if ( (strlen($user_group) < 2) or (strlen($group_name) < 2) ) + { + echo "
Η ΟΜΑΔΑ ΧΡΗΣΤΗ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n"; + echo "
Η ομάδα και η πεÏιγÏαφή Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες\n"; + } + else + { + $stmt="UPDATE vicidial_user_groups set user_group='$user_group', group_name='$group_name',allowed_campaigns='$campaigns_value' where user_group='$OLDuser_group';"; + $rslt=mysql_query($stmt, $link); + + echo "
ΟΜΑΔΑ ΧΡΗΣΤΗ ΤΡΟΠΟΠΟΙΗΘΗΚΕ\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER GROUP ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +$ADD=311111; # go to user group modification form below +} + +###################### +# ADD=4111111 modify script in the system +###################### + +if ($ADD==4111111) +{ + if ($LOGmodify_scripts==1) + { + echo "\n"; + echo "\n"; + echo ""; + + if ( (strlen($script_id) < 2) or (strlen($script_name) < 2) or (strlen($script_text) < 2) ) + { + echo "
Ο ΒΟΗΘΟΣ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
Το όνομα, η πεÏιγÏαφή και το κείμενο χειÏογÏάφων Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες στο μήκος\n"; + } + else + { + $stmt="UPDATE vicidial_scripts set script_name='$script_name', script_comments='$script_comments', script_text='$script_text', active='$active' where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
Ο ΒΟΗΘΟΣ ΤΡΟΠΟΠΟΙΗΘΗΚΕ\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY SCRIPT ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +$ADD=3111111; # go to script modification form below +} + + +###################### +# ADD=41111111 modify filter in the system +###################### + +if ($ADD==41111111) +{ + if ($LOGmodify_filters==1) + { + echo ""; + + if ( (strlen($lead_filter_id) < 2) or (strlen($lead_filter_name) < 2) or (strlen($lead_filter_sql) < 2) ) + { + echo "
ΤΟ ΦΙΛΤΡΟ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
ID φίλτÏου, όνομα και SQL Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες\n"; + } + else + { + $stmt="UPDATE vicidial_lead_filters set lead_filter_name='$lead_filter_name', lead_filter_comments='$lead_filter_comments', lead_filter_sql='$lead_filter_sql' where lead_filter_id='$lead_filter_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
ΤΟ ΦΙΛΤΡΟ ΤΡΟΠΟΠΟΙΗΘΗΚΕ\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY FILTER ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +$ADD=31111111; # go to filter modification form below +} + + +###################### +# ADD=411111111 modify call time in the system +###################### + +if ($ADD==411111111) +{ + if ($LOGmodify_call_times==1) + { + echo ""; + + if ( (strlen($call_time_id) < 2) or (strlen($call_time_name) < 2) ) + { + echo "
ΧΟÎΟΣ ΚΛΗΣΗΣ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
Το ID ΧÏόνου Κλήσης και το όνομα Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες\n"; + } + else + { + $ct_default_start = preg_replace('/\D/', '', $ct_default_start); + $ct_default_stop = preg_replace('/\D/', '', $ct_default_stop); + $ct_sunday_start = preg_replace('/\D/', '', $ct_sunday_start); + $ct_sunday_stop = preg_replace('/\D/', '', $ct_sunday_stop); + $ct_monday_start = preg_replace('/\D/', '', $ct_monday_start); + $ct_monday_stop = preg_replace('/\D/', '', $ct_monday_stop); + $ct_tuesday_start = preg_replace('/\D/', '', $ct_tuesday_start); + $ct_tuesday_stop = preg_replace('/\D/', '', $ct_tuesday_stop); + $ct_wednesday_start = preg_replace('/\D/', '', $ct_wednesday_start); + $ct_wednesday_stop = preg_replace('/\D/', '', $ct_wednesday_stop); + $ct_thursday_start = preg_replace('/\D/', '', $ct_thursday_start); + $ct_thursday_stop = preg_replace('/\D/', '', $ct_thursday_stop); + $ct_friday_start = preg_replace('/\D/', '', $ct_friday_start); + $ct_friday_stop = preg_replace('/\D/', '', $ct_friday_stop); + $ct_saturday_start = preg_replace('/\D/', '', $ct_saturday_start); + $ct_saturday_stop = preg_replace('/\D/', '', $ct_saturday_stop); + $stmt="UPDATE vicidial_call_times set call_time_name='$call_time_name', call_time_comments='$call_time_comments', ct_default_start='$ct_default_start', ct_default_stop='$ct_default_stop', ct_sunday_start='$ct_sunday_start', ct_sunday_stop='$ct_sunday_stop', ct_monday_start='$ct_monday_start', ct_monday_stop='$ct_monday_stop', ct_tuesday_start='$ct_tuesday_start', ct_tuesday_stop='$ct_tuesday_stop', ct_wednesday_start='$ct_wednesday_start', ct_wednesday_stop='$ct_wednesday_stop', ct_thursday_start='$ct_thursday_start', ct_thursday_stop='$ct_thursday_stop', ct_friday_start='$ct_friday_start', ct_friday_stop='$ct_friday_stop', ct_saturday_start='$ct_saturday_start', ct_saturday_stop='$ct_saturday_stop' where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
ΤΡΟΠΟΠΟΙΗΘΗΚΕ ΧΡΟÎΟΣ ΚΛΗΣΗΣ\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CALL TIME ENTRY |$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +$ADD=311111111; # go to call time modification form below +} + + +###################### +# ADD=4111111111 modify state call time in the system +###################### + +if ($ADD==4111111111) +{ + if ($LOGmodify_call_times==1) + { + echo ""; + + if ( (strlen($call_time_id) < 2) or (strlen($call_time_name) < 2) or (strlen($state_call_time_state) < 2) ) + { + echo "
ΧΡΟÎΟΣ ΚΛΗΣΗΣ ΚΑΤΑΣΤΑΣΗΣ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
Το ID ΧÏόνου Κλήσης Κατάστασης, το όνομα και η κατάσταση Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες \n"; + } + else + { + $ct_default_start = preg_replace('/\D/', '', $ct_default_start); + $ct_default_stop = preg_replace('/\D/', '', $ct_default_stop); + $ct_sunday_start = preg_replace('/\D/', '', $ct_sunday_start); + $ct_sunday_stop = preg_replace('/\D/', '', $ct_sunday_stop); + $ct_monday_start = preg_replace('/\D/', '', $ct_monday_start); + $ct_monday_stop = preg_replace('/\D/', '', $ct_monday_stop); + $ct_tuesday_start = preg_replace('/\D/', '', $ct_tuesday_start); + $ct_tuesday_stop = preg_replace('/\D/', '', $ct_tuesday_stop); + $ct_wednesday_start = preg_replace('/\D/', '', $ct_wednesday_start); + $ct_wednesday_stop = preg_replace('/\D/', '', $ct_wednesday_stop); + $ct_thursday_start = preg_replace('/\D/', '', $ct_thursday_start); + $ct_thursday_stop = preg_replace('/\D/', '', $ct_thursday_stop); + $ct_friday_start = preg_replace('/\D/', '', $ct_friday_start); + $ct_friday_stop = preg_replace('/\D/', '', $ct_friday_stop); + $ct_saturday_start = preg_replace('/\D/', '', $ct_saturday_start); + $ct_saturday_stop = preg_replace('/\D/', '', $ct_saturday_stop); + $stmt="UPDATE vicidial_state_call_times set state_call_time_name='$call_time_name', state_call_time_comments='$call_time_comments', sct_default_start='$ct_default_start', sct_default_stop='$ct_default_stop', sct_sunday_start='$ct_sunday_start', sct_sunday_stop='$ct_sunday_stop', sct_monday_start='$ct_monday_start', sct_monday_stop='$ct_monday_stop', sct_tuesday_start='$ct_tuesday_start', sct_tuesday_stop='$ct_tuesday_stop', sct_wednesday_start='$ct_wednesday_start', sct_wednesday_stop='$ct_wednesday_stop', sct_thursday_start='$ct_thursday_start', sct_thursday_stop='$ct_thursday_stop', sct_friday_start='$ct_friday_start', sct_friday_stop='$ct_friday_stop', sct_saturday_start='$ct_saturday_start', sct_saturday_stop='$ct_saturday_stop', state_call_time_state='$state_call_time_state' where state_call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
ΤΡΟΠΟΠΟΙΗΘΗΚΕ ΧΡΟÎΟΣ ΚΛΗΣΗΣ ΚΑΤΑΣΤΑΣΗΣ\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY STATE CALL TIME ENTRY|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +$ADD=3111111111; # go to state call time modification form below +} + + +###################### +# ADD=41111111111 modify phone record in the system +###################### + +if ($ADD==41111111111) +{ + if ($LOGast_admin_access==1) + { + echo ""; + + $stmt="SELECT count(*) from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ( ($extension != $old_extension) or ($server_ip != $old_server_ip) ) ) + {echo "
ΤΟ ΤΗΛΕΦΩÎΟ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - υπάÏχει ήδη ένα τηλέφωνο με αυτή την εσωτ.σÏνδεση/διακομιστή\n";} + else + { + if ( (strlen($extension) < 1) or (strlen($server_ip) < 7) or (strlen($dialplan_number) < 1) or (strlen($voicemail_id) < 1) or (strlen($login) < 1) or (strlen($pass) < 1)) + {echo "
ΤΟ ΤΗΛΕΦΩÎΟ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n";} + else + { + echo "
ΤΟ ΤΗΛΕΦΩÎΟ ΤΡΟΠΟΠΟΙΗΘΗΚΕ: $extension\n"; + + $stmt="UPDATE phones set extension='$extension', dialplan_number='$dialplan_number', voicemail_id='$voicemail_id', phone_ip='$phone_ip', computer_ip='$computer_ip', server_ip='$server_ip', login='$login', pass='$pass', status='$status', active='$active', phone_type='$phone_type', fullname='$fullname', company='$company', picture='$picture', protocol='$protocol', local_gmt='$local_gmt', ASTmgrUSERNAME='$ASTmgrUSERNAME', ASTmgrSECRET='$ASTmgrSECRET', login_user='$login_user', login_pass='$login_pass', login_campaign='$login_campaign', park_on_extension='$park_on_extension', conf_on_extension='$conf_on_extension', VICIDIAL_park_on_extension='$VICIDIAL_park_on_extension', VICIDIAL_park_on_filename='$VICIDIAL_park_on_filename', monitor_prefix='$monitor_prefix', recording_exten='$recording_exten', voicemail_exten='$voicemail_exten', voicemail_dump_exten='$voicemail_dump_exten', ext_context='$ext_context', dtmf_send_extension='$dtmf_send_extension', call_out_number_group='$call_out_number_group', client_browser='$client_browser', install_directory='$install_directory', local_web_callerID_URL='" . mysql_real_escape_string($local_web_callerID_URL) . "', VICIDIAL_web_URL='" . mysql_real_escape_string($VICIDIAL_web_URL) . "', AGI_call_logging_enabled='$AGI_call_logging_enabled', user_switching_enabled='$user_switching_enabled', conferencing_enabled='$conferencing_enabled', admin_hangup_enabled='$admin_hangup_enabled', admin_hijack_enabled='$admin_hijack_enabled', admin_monitor_enabled='$admin_monitor_enabled', call_parking_enabled='$call_parking_enabled', updater_check_enabled='$updater_check_enabled', AFLogging_enabled='$AFLogging_enabled', QUEUE_ACTION_enabled='$QUEUE_ACTION_enabled', CallerID_popup_enabled='$CallerID_popup_enabled', voicemail_button_enabled='$voicemail_button_enabled', enable_fast_refresh='$enable_fast_refresh', fast_refresh_rate='$fast_refresh_rate', enable_persistant_mysql='$enable_persistant_mysql', auto_dial_next_number='$auto_dial_next_number', VDstop_rec_after_each_call='$VDstop_rec_after_each_call', DBX_server='$DBX_server', DBX_database='$DBX_database', DBX_user='$DBX_user', DBX_pass='$DBX_pass', DBX_port='$DBX_port', DBY_server='$DBY_server', DBY_database='$DBY_database', DBY_user='$DBY_user', DBY_pass='$DBY_pass', DBY_port='$DBY_port', outbound_cid='$outbound_cid', enable_sipsak_messages='$enable_sipsak_messages' where extension='$old_extension' and server_ip='$old_server_ip';"; + $rslt=mysql_query($stmt, $link); + } + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +$ADD=31111111111; # go to phone modification form below +} + + +###################### +# ADD=411111111111 modify server record in the system +###################### + +if ($ADD==411111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + + $stmt="SELECT count(*) from servers where server_id='$server_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ($server_id != $old_server_id) ) + {echo "
ΔΙΑΚΟΜΙΣΤΗΣ NOT MODIFIED - there is already a server in the system with this server_id\n";} + else + { + $stmt="SELECT count(*) from servers where server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ($server_ip != $old_server_ip) ) + {echo "
Ο ΔΙΑΚΟΜΙΣΤΗΣ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - υπάÏχει ήδη ένας διακομιστής με αυτό το IP\n";} + else + { + if ( (strlen($server_id) < 1) or (strlen($server_ip) < 7) ) + {echo "
Ο ΔΙΑΚΟΜΙΣΤΗΣ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n";} + else + { + echo "
Ο ΔΙΑΚΟΜΙΣΤΗΣ ΤΡΟΠΟΠΟΙΗΘΗΚΕ: $server_ip\n"; + + $stmt="UPDATE servers set server_id='$server_id',server_description='$server_description',server_ip='$server_ip',active='$active',asterisk_version='$asterisk_version', max_vicidial_trunks='$max_vicidial_trunks', telnet_host='$telnet_host', telnet_port='$telnet_port', ASTmgrUSERNAME='$ASTmgrUSERNAME', ASTmgrSECRET='$ASTmgrSECRET', ASTmgrUSERNAMEupdate='$ASTmgrUSERNAMEupdate', ASTmgrUSERNAMElisten='$ASTmgrUSERNAMElisten', ASTmgrUSERNAMEsend='$ASTmgrUSERNAMEsend', local_gmt='$local_gmt', voicemail_dump_exten='$voicemail_dump_exten', answer_transfer_agent='$answer_transfer_agent', ext_context='$ext_context', sys_perf_log='$sys_perf_log', vd_server_logs='$vd_server_logs', agi_output='$agi_output', vicidial_balance_active='$vicidial_balance_active', balance_trunks_offlimits='$balance_trunks_offlimits' where server_id='$old_server_id';"; + $rslt=mysql_query($stmt, $link); + } + } + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +$ADD=311111111111; # go to server modification form below +} + + +###################### +# ADD=421111111111 modify vicidial server trunks record in the system +###################### + +if ($ADD==421111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + $stmt="SELECT max_vicidial_trunks from servers where server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $MAXvicidial_trunks = $rowx[0]; + + $stmt="SELECT sum(dedicated_trunks) from vicidial_server_trunks where server_ip='$server_ip' and campaign_id !='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $SUMvicidial_trunks = ($rowx[0] + $dedicated_trunks); + + if ($SUMvicidial_trunks > $MAXvicidial_trunks) + { + echo "
Η ΕΓΓΡΑΦΗ ΤΟΥ ΚΟΡΜΟΥ ΣΤΟΠΕΞΥΠΗΡΕΤΗΤΗ ΔΕΠΠΡΟΣΤΕΘΗΚΕ - ο αÏιθμός των κοÏμών είναι Ï€Î¿Î»Ï Ï…ÏˆÎ·Î»ÏŒÏ‚: $SUMvicidial_trunks / $MAXvicidial_trunks\n"; + } + else + { + if ( (strlen($campaign_id) < 2) or (strlen($server_ip) < 7) or (strlen($dedicated_trunks) < 1) or (strlen($trunk_restriction) < 1) ) + { + echo "
Η ΕΓΓΡΑΦΗ ΤΟΥ ΚΟΡΜΟΥ ΣΤΟΠΕΞΥΠΗΡΕΤΗΤΗ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
η εκστÏατεία Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 3 και 8 χαÏακτήÏων στο μήκος\n"; + echo "
η server_ip καθυστέÏηση Ï€Ïέπει να είναι τουλάχιστον 7 χαÏακτήÏες\n"; + echo "
οι κοÏμοί Ï€Ïέπει να είναι ένα ψηφίο από 0 έως 9999\n"; + } + else + { + echo "
Η ΕΓΓΡΑΦΗ ΤΟΥ ΚΟΡΜΟΥ ΣΤΟΠΕΞΥΠΗΡΕΤΗΤΗ ΤΡΟΠΟΠΟΙΗΘΗΚΕ: $campaign_id - $server_ip - $dedicated_trunks - $trunk_restriction\n"; + + $stmt="UPDATE vicidial_server_trunks SET dedicated_trunks='$dedicated_trunks',trunk_restriction='$trunk_restriction' where campaign_id='$campaign_id' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ΤΡΟΠΟΠΟΙΗΣΕ ΔΙΑΚΟΜΙΣΤΗ TRUNK |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +$ADD=311111111111; # go to server modification form below +} + + +###################### +# ADD=4111111111111 modify conference record in the system +###################### + +if ($ADD==4111111111111) +{ + if ($LOGast_admin_access==1) + { + echo ""; + + $stmt="SELECT count(*) from conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ( ($conf_exten != $old_conf_exten) or ($server_ip != $old_server_ip) ) ) + {echo "
Η ΣΥÎΔΙΑΛΕΞΗ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - υπάÏχει ήδη μία συνδιάλεξη με αυτή την εσωτ.σÏνδεση-διακομιστή\n";} + else + { + if ( (strlen($conf_exten) < 1) or (strlen($server_ip) < 7) ) + {echo "
Η ΣΥÎΔΙΑΛΕΞΗ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n";} + else + { + echo "
Η ΣΥÎΔΙΑΛΕΞΗ ΤΡΟΠΟΠΟΙΗΘΗΚΕ: $conf_exten\n"; + + $stmt="UPDATE conferences set conf_exten='$conf_exten',server_ip='$server_ip',extension='$extension' where conf_exten='$old_conf_exten';"; + $rslt=mysql_query($stmt, $link); + } + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +$ADD=3111111111111; # go to conference modification form below +} + + +###################### +# ADD=41111111111111 modify vicidial conference record in the system +###################### + +if ($ADD==41111111111111) +{ + if ($LOGast_admin_access==1) + { + echo ""; + + $stmt="SELECT count(*) from vicidial_conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ( ($conf_exten != $old_conf_exten) or ($server_ip != $old_server_ip) ) ) + {echo "
VICIDIAL Η ΣΥÎΔΙΑΛΕΞΗ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - υπάÏχει ήδη μία συνδιάλεξη με αυτή την εσωτ.σÏνδεση-διακομιστή\n";} + else + { + if ( (strlen($conf_exten) < 1) or (strlen($server_ip) < 7) ) + {echo "
VICIDIAL Η ΣΥÎΔΙΑΛΕΞΗ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΕ - ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n";} + else + { + echo "
VICIDIAL Η ΣΥÎΔΙΑΛΕΞΗ ΤΡΟΠΟΠΟΙΗΘΗΚΕ: $conf_exten\n"; + + $stmt="UPDATE vicidial_conferences set conf_exten='$conf_exten',server_ip='$server_ip',extension='$extension' where conf_exten='$old_conf_exten';"; + $rslt=mysql_query($stmt, $link); + + } + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +$ADD=31111111111111; # go to vicidial conference modification form below +} + + + +###################### +# ADD=411111111111111 modify vicidial system settings +###################### + +if ($ADD==411111111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + + echo "
VICIDIAL ΤΟΠΟΘΕΤΗΣΕΙΣ ΣΥΣΤΗΜΑΤΩΠΤΡΟΠΟΠΟΙΗΜΕÎΕΣ\n"; + + $stmt="UPDATE system_settings set use_non_latin='$use_non_latin',webroot_writable='$webroot_writable',enable_queuemetrics_logging='$enable_queuemetrics_logging',queuemetrics_server_ip='$queuemetrics_server_ip',queuemetrics_dbname='$queuemetrics_dbname',queuemetrics_login='$queuemetrics_login',queuemetrics_pass='$queuemetrics_pass',queuemetrics_url='$queuemetrics_url',queuemetrics_log_id='$queuemetrics_log_id',queuemetrics_eq_prepend='$queuemetrics_eq_prepend',vicidial_agent_disable='$vicidial_agent_disable',allow_sipsak_messages='$allow_sipsak_messages',admin_home_url='$admin_home_url',enable_agc_xfer_log='$enable_agc_xfer_log';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY SYSTEM SETTINGS|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +$ADD=311111111111111; # go to vicidial system settings form below +} + + +###################### +# ADD=421111111111111 modify/delete system status in the system +###################### + +if ($ADD==421111111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + + if (ereg('delete',$stage)) + { + if ( (strlen($status) < 1) or (preg_match("/^B$|^NA$|^DNC$|^NA$|^DROP$|^INCALL$|^QUEUE$|^NEW$/i",$status)) ) + { + echo "
ΘΕΣΗ ΣΥΣΤΗΜΑΤΩΠΠΟΥ ΔΕΠΔΙΑΓΡΑΦΕΤΑΙ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
η θέση συστημάτων δεν μποÏεί να είναι μια διατηÏημένη θέση:B,NA,DNC,NA,DROP,INCALL,QUEUE,NEW\n"; + echo "
η θέση συστημάτων Ï€Ïέπει να είναι χαÏακτήÏες τουλάχιστον 1 στομήκος\n"; + } + else + { + echo "
SYSTEM STATUS DELETED: $status\n"; + + $stmt="DELETE FROM vicidial_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + + $stmtA="DELETE FROM vicidial_campaign_hotkeys where status='$status';"; + $rslt=mysql_query($stmtA, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE SYSTEM STATUS |$PHP_AUTH_USER|$ip|$stmt|$stmtA|\n"); + fclose($fp); + } + } + } + if (ereg('modify',$stage)) + { + if ( (strlen($status) < 1) or (strlen($status_name) < 2) ) + { + echo "
ΘΕΣΗ ΣΥΣΤΗΜΑΤΩΠΤΡΟΠΟΠΟΙΗΜΕÎΗ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
η θέση συστημάτων Ï€Ïέπει να είναι χαÏακτήÏες τουλάχιστον 1 στομήκος\n"; + echo "
το όνομα θέσης συστημάτων Ï€Ïέπει να είναι χαÏακτήÏεςτουλάχιστον 1 στο μήκος\n"; + } + else + { + echo "
ΘΕΣΗ ΣΥΣΤΗΜΑΤΩΠΤΡΟΠΟΠΟΙΗΜΕÎΗ: $status\n"; + + $stmt="UPDATE vicidial_statuses SET status_name='$status_name',selectable='$selectable',human_answered='$human_answered',category='$category' where status='$status';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY SYSTEM STATUS |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +$ADD=321111111111111; # go to system settings modification form below +} + + +###################### +# ADD=431111111111111 modify/delete status category in the system +###################### + +if ($ADD==431111111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + + if ( (strlen($vsc_id) < 2) or (preg_match("/^UNDEFINED$/i",$vsc_id)) ) + { + echo "
ΚΑΤΗΓΟΡΙΑ ΘΕΣΗΣ ΤΡΟΠΟΠΟΙΗΜΕÎΗ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
η κατηγοÏία θέσης δεν μποÏεί να είναι μια διατηÏημένη κατηγοÏία:UNDEFINED\n"; + echo "
η κατηγοÏία θέσης Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες στομήκος\n"; + } + else + { + if (ereg('delete',$stage)) + { + echo "
ΚΑΤΗΓΟΡΙΑ ΘΕΣΗΣ ΠΟΥ ΔΙΑΓΡΑΦΕΤΑΙ: $vsc_id\n"; + + $stmt="DELETE FROM vicidial_status_categories where vsc_id='$vsc_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE STATUS CATEGORY|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + if (ereg('modify',$stage)) + { + echo "
ΚΑΤΗΓΟΡΙΑ ΘΕΣΗΣ ΤΡΟΠΟΠΟΙΗΜΕÎΗ: $vsc_id\n"; + + $stmt="SELECT count(*) from vicidial_status_categories where tovdad_display='Y' and vsc_id NOT IN('$vsc_id');"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 3) and (ereg('Y',$tovdad_display)) ) + { + $tovdad_display = 'N'; + echo "
ΛΑΘΟΣ: ΥπάÏχουν ήδη 4 κατηγοÏίες θέσης καθοÏισμένες την επίδειξηTimeOnVDAD\n"; + } + + $stmt="UPDATE vicidial_status_categories SET vsc_name='$vsc_name',vsc_description='$vsc_description',tovdad_display='$tovdad_display' where vsc_id='$vsc_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY STATUS CATEGORY|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +$ADD=331111111111111; # go to system settings modification form below +} + + + + +###################################################################################################### +###################################################################################################### +####### 5 series, delete records confirmation +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=5 confirmation before deletion of user +###################### + +if ($ADD==5) +{ + echo ""; + + if ( (strlen($user) < 2) or ($LOGdelete_users < 1) ) + { + echo "
ΧΡΗΣΤΗΣ ΔΕΠΔΙΑΓΡΑΦΗΚΕ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
User be at least 2 characters in length\n"; + } + else + { + echo "
ΕΠΙΒΕΒΑΙΩΣΗ ΔΙΑΓΡΑΦΗΣ ΧΡΗΣΤΗ: $user\n"; + echo "

Χτυπήστε εδώ για να διαγÏάψετε το χÏήστη $user


\n"; + } + +$ADD='3'; # go to user modification below +} + +###################### +# ADD=51 confirmation before deletion of campaign +###################### + +if ($ADD==51) +{ + echo ""; + + if ( (strlen($campaign_id) < 2) or ($LOGdelete_campaigns < 1) ) + { + echo "
ΕΚΣΤΡΑΤΕΙΑ ΔΕΠΔΙΑΓΡΑΦΗΚΕ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
ΕκστÏατεία_id be at least 2 characters in length\n"; + } + else + { + echo "
ΕΠΙΒΕΒΑΙΩΣΗ ΔΙΑΓΡΑΦΗΣ ΕΚΣΤΡΑΤΕΙΑΣ: $campaign_id\n"; + echo "

Χτυπήστε εδώ για να διαγÏάψετε την εκστÏατεία $campaign_id


\n"; + } + +$ADD='31'; # go to campaign modification below +} + +###################### +# ADD=52 confirmation before logging all agents out of campaign of campaign +###################### + +if ($ADD==52) +{ + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
ΧΕΙΡΙΣΤΕΣ ΠΟΥ ΔΕΠΕΙÎΑΙ ΑΠΟΣΥÎΔΕΜΕÎΟΙ ΑΠΟ ΤΗΠΕΚΣΤΡΑΤΕΙΑ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
ΕκστÏατεία_id be at least 2 characters in length\n"; + } + else + { + echo "
ΕΠΙΒΕΒΑΙΩΣΗ ΑΠΟΣΥÎΔΕΣΗΣ ΧΕΙΡΙΣΤΩÎ: $campaign_id\n"; + echo "

Επιλέξτε εδώ για να αποσυνδέσετε όλους τους χειÏιστές από $campaign_id


\n"; + } + +$ADD='31'; # go to campaign modification below +} + +###################### +# ADD=53 confirmation before Emergency VDAC Jam Clear - deletes oldest LIVE vicidial_auto_call record +###################### + +if ($ADD==53) +{ + if (eregi('IN',$stage)) + {$group_id=$campaign_id;} + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
VDAC ΔΕΠΚΑΘΑΡΙΣΤΗΚΕ ΓΙΑ ΤΗΠΕΚΣΤΡΑΤΕΊΑ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
ΕκστÏατεία_id be at least 2 characters in length\n"; + } + else + { + echo "
ΕΠΙΒΕΒΑΙΩΣΗ ΚΑΘΑΡΙΣΜΟΥ VDAC: $campaign_id\n"; + echo "

Επιλέξτε εδώ για να διαγÏάψετε την παλαιότεÏη ΖΩÎΤΑÎΗ εγγÏαφή στο VDAC για $campaign_id


\n"; + } + +# go to campaign modification below +if (eregi('IN',$stage)) + {$ADD='3111';} +else + {$ADD='31';} +} + +###################### +# ADD=511 confirmation before deletion of list +###################### + +if ($ADD==511) +{ + echo ""; + + if ( (strlen($list_id) < 2) or ($LOGdelete_lists < 1) ) + { + echo "
ΛΙΣΤΑ ΔΕΠΔΙΑΓΡΑΦΗΚΕ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
List_id be at least 2 characters in length\n"; + } + else + { + echo "
ΕΠΙΒΕΒΑΙΩΣΗ ΔΙΑΓΡΑΦΗΣ ΛΙΣΤΑΣ: $list_id\n"; + echo "

Χτυπήστε εδώ για να διαγÏάψετε τον κατάλογο και όλους τους οδηγοÏÏ‚ του $list_id


\n"; + } + +$ADD='311'; # go to campaign modification below +} + +###################### +# ADD=5111 confirmation before deletion of in-group +###################### + +if ($ADD==5111) +{ + echo ""; + + if ( (strlen($group_id) < 2) or ($LOGdelete_ingroups < 1) ) + { + echo "
ΕΙΣ-ΟΜΑΔΑ ΔΕΠΔΙΑΓΡΑΦΗΚΕ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
Group_id be at least 2 characters in length\n"; + } + else + { + echo "
ΕΠΙΒΕΒΑΙΩΣΗ ΔΙΑΓΡΑΦΗΣ ΕΙΣ-ΟΜΑΔΑΣ: $group_id\n"; + echo "

Επιλέξτε εδώ για να διαγÏάψετε την-ΟΜΑΔΑ $group_id


\n"; + } + +$ADD='3111'; # go to in-group modification below +} + +###################### +# ADD=51111 confirmation before deletion of remote agent record +###################### + +if ($ADD==51111) +{ + echo ""; + + if ( (strlen($remote_agent_id) < 1) or ($LOGdelete_remote_agents < 1) ) + { + echo "
ΑΠΟΜΑΚΡΥΣΜΕÎΟΣ ΧΕΙΡΙΣΤΗΣ ΔΕΠΔΙΑΓΡΑΦΗΚΕ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
Remote_agent_id be at least 2 characters in length\n"; + } + else + { + echo "
ΕΠΙΒΕΒΑΙΩΣΗ ΔΙΑΓΡΑΦΗΣ ΑΠΟΜΑΚΡΥΣΜΕÎΩΠΧΕΙΡΙΣΤΩΠ: $remote_agent_id\n"; + echo "

Επιλέξτε εδώ για να διαγÏάψετε τον απομακÏυσμένο χειÏιστή $remote_agent_id


\n"; + } + +$ADD='31111'; # go to remote agent modification below +} + +###################### +# ADD=511111 confirmation before deletion of user group record +###################### + +if ($ADD==511111) +{ + echo ""; + + if ( (strlen($user_group) < 2) or ($LOGdelete_user_groups < 1) ) + { + echo "
ΟΜΑΔΑ ΧΡΗΣΤΗ ΔΕΠΔΙΑΓΡΑΦΗΚΕ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
User_group be at least 2 characters in length\n"; + } + else + { + echo "
ΕΠΙΒΕΒΑΙΩΣΗ ΔΙΑΓΡΑΦΗΣ ΟΜΑΔΑΣ ΧΡΗΣΤΩÎ: $user_group\n"; + echo "

Επιλέξτε εδώ για να διαγÏάψετε την ομάδα χÏηστών $user_group


\n"; + } + +$ADD='311111'; # go to user group modification below +} + +###################### +# ADD=5111111 confirmation before deletion of script record +###################### + +if ($ADD==5111111) +{ + echo ""; + + if ( (strlen($script_id) < 2) or ($LOGdelete_scripts < 1) ) + { + echo "
ΔΕΠΔΙΑΓΡΑΦΗΚΕ Ο ΒΟΗΘΟΣ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
Script_id must be at least 2 characters in length\n"; + } + else + { + echo "
ΕΠΙΒΕΒΑΙΩΣΗ ΔΙΑΓΡΑΦΗΣ ΒΟΗΘΟΥ: $script_id\n"; + echo "

επιλέξτε εδώ για να διαγÏάψετε τον βοηθό $script_id


\n"; + } + +$ADD='3111111'; # go to script modification below +} + +###################### +# ADD=51111111 confirmation before deletion of filter record +###################### + +if ($ADD==51111111) +{ + echo ""; + + if ( (strlen($lead_filter_id) < 2) or ($LOGdelete_filters < 1) ) + { + echo "
ΤΟ ΦΙΛΤΡΟ ΔΕΠΔΙΑΓΡΑΦΗΚΕ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
To ID φίλτÏου Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες\n"; + } + else + { + echo "
FILTER DELETION CONFIRMATION: $lead_filter_id\n"; + echo "

Πατήστε εδώ για διαγÏαφή του φίλτÏου$lead_filter_id


\n"; + } + +$ADD='31111111'; # go to filter modification below +} + +###################### +# ADD=511111111 confirmation before deletion of call time record +###################### + +if ($ADD==511111111) +{ + echo ""; + + if ( (strlen($call_time_id) < 2) or ($LOGdelete_call_times < 1) ) + { + echo "
Ο ΧΡΟÎΟΣ ΚΛΗΣΗΣ ΔΕΠΔΙΑΓΡΑΦΗΚΕ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
Το ID χÏόνου κλήσης Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες\n"; + } + else + { + echo "
ΕΠΙΒΕΒΑΙΩΣΗ ΔΙΑΓΡΑΦΗΣ ΧΡΟÎΟΥ ΚΛΗΣΗΣ: $call_time_id\n"; + echo "

Click here to delete call time $call_time_id


\n"; + } + +$ADD='311111111'; # go to call time modification below +} + +###################### +# ADD=5111111111 confirmation before deletion of state call time record +###################### + +if ($ADD==5111111111) +{ + echo ""; + + if ( (strlen($call_time_id) < 2) or ($LOGdelete_call_times < 1) ) + { + echo "
Ο ΧΡΟÎΟΣ ΚΛΗΣΗΣ ΚΑΤΑΣΤΑΣΗΣΔΕΠΔΙΑΓΡΑΦΗΚΕ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
Το ID χÏόνου κλήσης Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες\n"; + } + else + { + echo "
ΕΠΙΒΕΒΑΙΩΣΗ ΔΙΑΓΡΑΦΗΣ ΧΡΟÎΟΥ ΚΛΗΣΗΣ ΚΑΤΑΣΤΑΣΗΣ: $call_time_id\n"; + echo "

Click here to delete state call time $call_time_id


\n"; + } + +$ADD='3111111111'; # go to state call time modification below +} + + +###################### +# ADD=51111111111 confirmation before deletion of phone record +###################### + +if ($ADD==51111111111) +{ + echo ""; + + if ( (strlen($extension) < 2) or (strlen($server_ip) < 7) or ($LOGast_delete_phones < 1) ) + { + echo "
ΤΟ ΤΗΛΕΦΩÎΟ ΔΕΠΔΙΑΓΡΑΦΗΚΕ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
Extension be at least 2 characters in length\n"; + echo "
IP Διακομιστή be at least 7 characters in length\n"; + } + else + { + echo "
ΕΠΙΒΕΒΑΙΩΣΗ ΔΙΑΓΡΑΦΗΣ ΤΗΛΕΦΩÎΟΥ: $extension - $server_ip\n"; + echo "

Επιλέξτε εδώ για να διαγÏάψετε το τηλέφωνο $extension - $server_ip


\n"; + } +$ADD='31111111111'; # go to phone modification below +} + + +###################### +# ADD=511111111111 confirmation before deletion of server record +###################### + +if ($ADD==511111111111) +{ + echo ""; + + if ( (strlen($server_id) < 2) or (strlen($server_ip) < 7) or ($LOGast_delete_phones < 1) ) + { + echo "
ΔΙΑΚΟΜΙΣΤΗΣ NOT DELETED - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
ID Διακομιστή be at least 2 characters in length\n"; + echo "
IP Διακομιστή be at least 7 characters in length\n"; + } + else + { + echo "
ΔΙΑΚΟΜΙΣΤΗΣ DELETION CONFIRMATION: $server_id - $server_ip\n"; + echo "

Επιλέξτε εδώ για να διαγÏάψετε το τηλέφωνο $server_id - $server_ip


\n"; + } +$ADD='311111111111'; # go to server modification below +} + + +###################### +# ADD=5111111111111 confirmation before deletion of conference record +###################### + +if ($ADD==5111111111111) +{ + echo ""; + + if ( (strlen($conf_exten) < 2) or (strlen($server_ip) < 7) or ($LOGast_delete_phones < 1) ) + { + echo "
CONFERENCE NOT DELETED - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
Conference must be at least 2 characters in length\n"; + echo "
IP Διακομιστή be at least 7 characters in length\n"; + } + else + { + echo "
CONFERENCE DELETION CONFIRMATION: $conf_exten - $server_ip\n"; + echo "

Επιλέξτε εδώ για να διαγÏάψετε το τηλέφωνο $conf_exten - $server_ip


\n"; + } +$ADD='3111111111111'; # go to conference modification below +} + + +###################### +# ADD=51111111111111 confirmation before deletion of vicidial conference record +###################### + +if ($ADD==51111111111111) +{ + echo ""; + + if ( (strlen($conf_exten) < 2) or (strlen($server_ip) < 7) or ($LOGast_delete_phones < 1) ) + { + echo "
VICIDIAL CONFERENCE NOT DELETED - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
Conference must be at least 2 characters in length\n"; + echo "
IP Διακομιστή be at least 7 characters in length\n"; + } + else + { + echo "
VICIDIAL CONFERENCE DELETION CONFIRMATION: $conf_exten - $server_ip\n"; + echo "

Επιλέξτε εδώ για να διαγÏάψετε το τηλέφωνο $conf_exten - $server_ip


\n"; + } +$ADD='31111111111111'; # go to vicidial conference modification below +} + + + +###################################################################################################### +###################################################################################################### +####### 6 series, delete records +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=6 delete user record +###################### + +if ($ADD==6) +{ + echo ""; + + if ( ( strlen($user) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_users < 1) ) + { + echo "
ΧΡΗΣΤΗΣ ΔΕΠΔΙΑΓΡΑΦΗΚΕ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
User be at least 2 characters in length\n"; + } + else + { + $stmtA="DELETE from vicidial_users where user='$user' limit 1;"; + $rslt=mysql_query($stmtA, $link); + + $stmt="DELETE from vicidial_campaign_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_inbound_group_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING USER!!!!|$PHP_AUTH_USER|$ip|$user|$stmtA|$stmt|\n"); + fclose($fp); + } + echo "
ΔΙΑΓΡΑΦΗ ΧΡΗΣΤΗ ΟΛΟΚΛΗΡΩΘΗΚΕ: $user\n"; + echo "

\n"; + } + +$ADD='0'; # go to user list +} + +###################### +# ADD=61 delete campaign record +###################### + +if ($ADD==61) +{ + echo ""; + + if ( ( strlen($campaign_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_campaigns < 1) ) + { + echo "
ΕΚΣΤΡΑΤΕΙΑ ΔΕΠΔΙΑΓΡΑΦΗΚΕ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
ΕκστÏατεία_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_campaigns where campaign_id='$campaign_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaign_agents where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_live_agents where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaign_statuses where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaign_hotkeys where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_callbacks where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaign_stats where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_lead_recycle where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaign_server_stats where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_server_trunks where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_pause_codes where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaigns_list_mix where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
ΑΠΟΜΑΚΡΥÎΣΗ ΚΑΘΟΔΗΓΗΤΩΠΛΙΣΤΑΣ HOPPER ΑΠΟ ΠΑΛΑΙΑ HOPPER ΕΚΣΤΡΑΤΕΙΑ ($campaign_id)\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!DELETING CAMPAIGN!|$PHP_AUTH_USER|$ip|campaign_id='$campaign_id'|\n"); + fclose($fp); + } + echo "
ΔΙΑΓΡΑΦΗ ΕΚΣΤΡΑΤΕΙΑΣ ΟΛΟΚΛΗΡΩΘΗΚΕ: $campaign_id\n"; + echo "

\n"; + } + +$ADD='10'; # go to campaigns list +} + +###################### +# ADD=62 Logout all agents from a campaign +###################### + +if ($ADD==62) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
ΧΕΙΡΙΣΤΕΣ ΠΟΥ ΔΕΠΕΙÎΑΙ ΑΠΟΣΥÎΔΕΜΕÎΟΙ ΑΠΟ ΤΗΠΕΚΣΤΡΑΤΕΙΑ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
ΕκστÏατεία_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_live_agents where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!ΧΕΙΡΙΣΤΗΣLOGOUT!!!!!!|$PHP_AUTH_USER|$ip|campaign_id='$campaign_id'|\n"); + fclose($fp); + } + echo "
ΑΠΟΣΥÎΔΕΣΗ ΧΕΙΡΙΣΤΩΠΟΛΟΚΛΗΡΩΘΗΚΕ: $campaign_id\n"; + echo "

\n"; + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +$ADD='31'; # go to campaign modification below +} + + +###################### +# ADD=63 Emergency VDAC Jam Clear +###################### + +if ($ADD==63) +{ + if ($LOGmodify_campaigns==1) + { + if (eregi('IN',$stage)) + {$group_id=$campaign_id;} + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
VDAC ΔΕΠΚΑΘΑΡΙΣΤΗΚΕ ΓΙΑ ΤΗΠΕΚΣΤΡΑΤΕΊΑ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
ΕκστÏατεία_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_auto_calls where status='LIVE' and campaign_id='$campaign_id' order by call_time limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|EMERGENCY VDAC CLEAR|$PHP_AUTH_USER|$ip|campaign_id='$campaign_id'|\n"); + fclose($fp); + } + echo "
ΤΕΛΕΥΤΑΙΑ ΕΓΓΡΑΦΗ VDAC ΠΟΥ ΚΑΘΑΡΙΖΕΤΑΙ ΓΙΑ ΤΗΠΕΚΣΤΡΑΤΕΙΑ: $campaign_id\n"; + echo "

\n"; + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +# go to campaign modification below +if (eregi('IN',$stage)) + {$ADD='3111';} +else + {$ADD='31';} +} + + +###################### +# ADD=65 delete campaign lead recycle in the system +###################### + +if ($ADD==65) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
ΔΕΠΔΙΑΓΡΑΦΗΚΕ Ο ΟΔΗΓΟΣ ΑÎΑΚΥΚΛΩΣΗΣ ΕΚΣΤΡΑΤΕΙΑΣ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
η κατάσταση Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 1 και 6 χαÏακτήÏων στο μήκος\n"; + echo "
η καθυστέÏηση Ï€Ïοσπάθειας Ï€Ïέπει να είναι τουλάχιστον 120δευτεÏόλεπτα\n"; + echo "
οι μέγιστες Ï€Ïοσπάθειες Ï€Ïέπει να είναι από 1 έως 10\n"; + } + else + { + echo "
ΔΙΑΓΡΑΦΗΚΕ Ο ΟΔΗΓΟΣ ΑÎΑΚΥΚΛΩΣΗΣ ΕΚΣΤΡΑΤΕΙΑΣ: $campaign_id - $status - $attempt_delay\n"; + + $stmt="DELETE FROM vicidial_lead_recycle where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE LEAD RECYCLE |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +$SUB=25; +$ADD=31; # go to campaign modification form below +} + + +###################### +# ADD=66 delete auto alt dial status from the campaign +###################### + +if ($ADD==66) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and auto_alt_dial_statuses LIKE \"% $status %\";"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] < 1) + {echo "
ΑΥΤΟΜΑΤΗ ΘΈΣΗ ΠΙÎΑΚΩΠALT ΠΟΥ ΔΕΠΔΙΑΓΡΑΦΕΤΑΙ - αυτή η αυτόματη θέση πινάκων ALT δεν είναι σε αυτήν τηνεκστÏατεία\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
ΑΥΤΟΜΑΤΗ ΘΈΣΗ ΠΙÎΑΚΩΠALT ΠΟΥ ΔΕΠΔΙΑΓΡΑΦΕΤΑΙ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
η κατάσταση Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 1 και 6 χαÏακτήÏων στο μήκος\n"; + } + else + { + echo "
ΑΥΤΟΜΑΤΗ ΘΈΣΗ ΠΙÎΑΚΩΠALT ΠΟΥ ΔΙΑΓΡΑΦΕΤΑΙ: $campaign_id - $status\n"; + + $stmt="SELECT auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + $auto_alt_dial_statuses = eregi_replace(" $status "," ",$row[0]); + $stmt="UPDATE vicidial_campaigns set auto_alt_dial_statuses='$auto_alt_dial_statuses' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE AUTALTDIALSTTUS|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +$SUB=26; +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=67 delete agent pause code in the system +###################### + +if ($ADD==67) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($pause_code) < 1) ) + { + echo "
ΚΩΔΙΚΑΣ ΜΙΚΡΗΣ ΔΙΑΚΟΠΉΣ ΕΚΣΤΡΑΤΕΙΑΣ ΠΟΥ ΔΕΠΔΙΑΓΡΑΦΕΤΑΙ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
pause code must be between 1 and 6 characters in length\n"; + } + else + { + echo "
CAMPAIGN PAUSE CODE DELETED: $campaign_id - $pause_code\n"; + + $stmt="DELETE FROM vicidial_pause_codes where campaign_id='$campaign_id' and pause_code='$pause_code';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE ΧΕΙΡΙΣΤΗΣPAUSECODE|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +$SUB=27; +$ADD=31; # go to campaign modification form below +} + + +###################### +# ADD=68 remove campaign dial status +###################### + +if ($ADD==68) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and dial_statuses LIKE \"% $status %\";"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] < 1) + {echo "
ΘΕΣΗ ΠΙÎΑΚΩΠΕΚΣΤΡΑΤΕΙΑΣ ΑΦΑΙΡΟΥΜΕÎΗ - αυτή η θέση πινάκων δεν επιλέγεται για αυτήν την εκστÏατεία\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
ΘΕΣΗ ΠΙÎΑΚΩΠΕΚΣΤΡΑΤΕΙΑΣ ΑΦΑΙΡΟΥΜΕÎΗ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
η κατάσταση Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 1 και 6 χαÏακτήÏων στο μήκος\n"; + } + else + { + echo "
ΘΕΣΗ ΠΙÎΑΚΩΠΕΚΣΤΡΑΤΕΙΑΣ ΑΦΑΙΡΟΥΜΕÎΗ: $campaign_id - $status\n"; + + $stmt="SELECT dial_statuses from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + $dial_statuses = eregi_replace(" $status "," ",$row[0]); + $stmt="UPDATE vicidial_campaigns set dial_statuses='$dial_statuses' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DIAL STATUS REMOVED |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +#$SUB=28; +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=611 delete list record and all leads within it +###################### + +if ($ADD==611) +{ + echo ""; + + if ( ( strlen($list_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_lists < 1) ) + { + echo "
ΛΙΣΤΑ ΔΕΠΔΙΑΓΡΑΦΗΚΕ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
List_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_lists where list_id='$list_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + echo "
ΑΠΟΜΑΚΡΥÎΣΗ ΚΑΘΟΔΗΓΗΤΩΠΛΙΣΤΑΣ HOPPER ΑΠΟ ΠΑΛΑΙΑ HOPPER ΕΚΣΤΡΑΤΕΙΑ ($list_id)\n"; + $stmt="DELETE from vicidial_hopper where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
ΑΦΑΙΡΕΣΗ ΤΩΠΜΟΛΥΒΔΩΠΚΑΤΑΛΟΓΩΠΑΠΟ ΤΟΠΠΊÎΑΚΑ VICIDIAL_LIST\n"; + $stmt="DELETE from vicidial_list where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING LIST!!!!|$PHP_AUTH_USER|$ip|list_id='$list_id'|\n"); + fclose($fp); + } + echo "
ΔΙΑΓΡΑΦΗ ΛΙΣΤΑΣ ΟΛΟΚΛΗΡΩΘΗΚΕ: $list_id\n"; + echo "

\n"; + } + +$ADD='100'; # go to lists list +} + +###################### +# ADD=6111 delete in-group record +###################### + +if ($ADD==6111) +{ + echo ""; + + if ( (strlen($group_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_ingroups < 1) ) + { + echo "
ΕΙΣ-ΟΜΑΔΑ ΔΕΠΔΙΑΓΡΑΦΗΚΕ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
Group_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_inbound_groups where group_id='$group_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_inbound_group_agents where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_live_inbound_agents where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING IN-GROUP!!|$PHP_AUTH_USER|$ip|group_id='$group_id'|\n"); + fclose($fp); + } + echo "
ΔΙΑΓΡΑΦΗ ΕΙΣ-ΟΜΑΔΑΣ ΟΛΟΚΛΗΡΩΘΗΚΕ: $group_id\n"; + echo "

\n"; + } + +$ADD='1000'; # go to in-group list +} + +###################### +# ADD=61111 delete remote agent record +###################### + +if ($ADD==61111) +{ + echo ""; + + if ( (strlen($remote_agent_id) < 1) or ($CoNfIrM != 'YES') or ($LOGdelete_remote_agents < 1) ) + { + echo "
ΑΠΟΜΑΚΡΥΣΜΕÎΟΣ ΧΕΙΡΙΣΤΗΣ ΔΕΠΔΙΑΓΡΑΦΗΚΕ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
Remote_agent_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_remote_agents where remote_agent_id='$remote_agent_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING RMTAGENT!!|$PHP_AUTH_USER|$ip|remote_agent_id='$remote_agent_id'|\n"); + fclose($fp); + } + echo "
ΔΙΑΓΡΑΦΗ ΑΠΟΜΑΚΡΥΣΜΕÎΩΠΧΕΙΡΙΣΤΩΠΟΛΟΚΛΗΡΩΘΗΚΕ: $remote_agent_id\n"; + echo "

\n"; + } + +$ADD='10000'; # go to remote agents list +} + +###################### +# ADD=611111 delete user group record +###################### + +if ($ADD==611111) +{ + echo ""; + + if ( (strlen($user_group) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_user_groups < 1) ) + { + echo "
ΟΜΑΔΑ ΧΡΗΣΤΗ ΔΕΠΔΙΑΓΡΑΦΗΚΕ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
User_group be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_user_groups where user_group='$user_group' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING USRGROUP!!|$PHP_AUTH_USER|$ip|user_group='$user_group'|\n"); + fclose($fp); + } + echo "
ΔΙΑΓΡΑΦΗ ΟΜΑΔΑΣ ΧΡΗΣΤΩΠΟΛΟΚΛΗΡΩΘΗΚΕ: $user_group\n"; + echo "

\n"; + } + +$ADD='100000'; # go to user group list +} + +###################### +# ADD=6111111 delete script record +###################### + +if ($ADD==6111111) +{ + echo ""; + + if ( (strlen($script_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_scripts < 1) ) + { + echo "
ΔΕΠΔΙΑΓΡΑΦΗΚΕ Ο ΒΟΗΘΟΣ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
Script_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_scripts where script_id='$script_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING SCRIPT!!!!|$PHP_AUTH_USER|$ip|script_id='$script_id'|\n"); + fclose($fp); + } + echo "
ΔΙΑΓΡΑΦΗ ΒΟΗΘΟΥ ΟΛΟΚΛΗΡΩΘΗΚΕ: $script_id\n"; + echo "

\n"; + } + +$ADD='1000000'; # go to script list +} + + +###################### +# ADD=61111111 delete filter record +###################### + +if ($ADD==61111111) +{ + echo ""; + + if ( (strlen($lead_filter_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_filters < 1) ) + { + echo "
ΤΟ ΦΙΛΤΡΟ ΔΕΠΔΙΑΓΡΑΦΗΚΕ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
To ID φίλτÏου Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες\n"; + } + else + { + $stmt="DELETE from vicidial_lead_filters where lead_filter_id='$lead_filter_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING FILTER!!!!|$PHP_AUTH_USER|$ip|lead_filter_id='$lead_filter_id'|\n"); + fclose($fp); + } + echo "
Η ΔΙΑΓΡΑΦΗ ΤΟΥ ΦΙΛΤΡΟΥ ΟΛΟΚΛΗΡΩΘΗΚΕ: $lead_filter_id\n"; + echo "

\n"; + } + +$ADD='10000000'; # go to filter list +} + + +###################### +# ADD=611111111 delete call times record +###################### + +if ($ADD==611111111) +{ + echo ""; + + if ( (strlen($call_time_id) < 2) or ($LOGdelete_call_times < 1) ) + { + echo "
Ο ΧΡΟÎΟΣ ΚΛΗΣΗΣ ΔΕΠΔΙΑΓΡΑΦΗΚΕ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
Το ID χÏόνου κλήσης Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες\n"; + } + else + { + $stmt="DELETE from vicidial_call_times where call_time_id='$call_time_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING CALL TIME!|$PHP_AUTH_USER|$ip|call_time_id='$call_time_id'|\n"); + fclose($fp); + } + echo "
ΟΛΟΚΛΗΡΩΣΗ ΔΙΑΓΡΑΦΗΣ ΧΡΟÎΟΥ ΚΛΗΣΗΣ: $call_time_id\n"; + echo "

\n"; + } + +$ADD='100000000'; # go to call times list +} + + +###################### +# ADD=6111111111 delete state call times record +###################### + +if ($ADD==6111111111) +{ + echo ""; + + if ( (strlen($call_time_id) < 2) or ($LOGdelete_call_times < 1) ) + { + echo "
Ο ΧΡΟÎΟΣ ΚΛΗΣΗΣ ΚΑΤΑΣΤΑΣΗΣΔΕΠΔΙΑΓΡΑΦΗΚΕ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
Το ID χÏόνου κλήσης Ï€Ïέπει να είναι τουλάχιστον 2 χαÏακτήÏες\n"; + } + else + { + $stmt="DELETE from vicidial_state_call_times where state_call_time_id='$call_time_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT call_time_id,ct_state_call_times from vicidial_call_times where ct_state_call_times LIKE \"%|$call_time_id|%\" order by call_time_id;"; + $rslt=mysql_query($stmt, $link); + $sct_to_print = mysql_num_rows($rslt); + $sct_list=''; + + $o=0; + while ($sct_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $sct_ids[$o] = "$rowx[0]"; + $sct_states[$o] = "$rowx[1]"; + $o++; + } + $o=0; + + while ($sct_to_print > $o) { + $sct_states[$o] = eregi_replace("\|$call_time_id\|",'|',$sct_states[$o]); + $stmt="UPDATE vicidial_call_times set ct_state_call_times='$sct_states[$o]' where call_time_id='$sct_ids[$o]';"; + $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + echo "ΑπομάκÏυνση Κανόνα Κατάστασης: $sct_ids[$o]
\n"; + $o++; + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING CALL TIME!|$PHP_AUTH_USER|$ip|state_call_time_id='$call_time_id'|\n"); + fclose($fp); + } + echo "
ΟΛΟΚΛΗΡΩΣΗ ΔΙΑΓΡΑΦΗΣ ΧΡΟÎΟΥ ΚΛΗΣΗΣ ΚΑΤΑΣΤΑΣΗΣ: $call_time_id\n"; + echo "

\n"; + } + +$ADD='1000000000'; # go to call times list +} + + +###################### +# ADD=61111111111 delete phone record +###################### + +if ($ADD==61111111111) +{ + echo ""; + + if ( (strlen($extension) < 2) or (strlen($server_ip) < 7) or ($CoNfIrM != 'YES') or ($LOGast_delete_phones < 1) ) + { + echo "
ΤΟ ΤΗΛΕΦΩÎΟ ΔΕΠΔΙΑΓΡΑΦΗΚΕ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
Extension be at least 2 characters in length\n"; + echo "
IP Διακομιστή be at least 7 characters in length\n"; + } + else + { + $stmt="DELETE from phones where extension='$extension' and server_ip='$server_ip' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING PHONE!!!|$PHP_AUTH_USER|$ip|extension='$extension'|server_ip='$server_ip'|\n"); + fclose($fp); + } + echo "
Η ΔΙΑΓΡΑΦΗ ΤΟΥ ΤΗΛΕΦΩÎΟΥ ΟΛΟΚΛΗΡΩΘΗΚΕ: $extension - $server_ip\n"; + echo "

\n"; + } +$ADD='10000000000'; # go to phone list +} + + +###################### +# ADD=611111111111 delete server record +###################### + +if ($ADD==611111111111) +{ + echo ""; + + if ( (strlen($server_id) < 2) or (strlen($server_ip) < 7) or ($CoNfIrM != 'YES') or ($LOGast_delete_phones < 1) ) + { + echo "
ΔΙΑΚΟΜΙΣΤΗΣ NOT DELETED - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
ID Διακομιστή be at least 2 characters in length\n"; + echo "
IP Διακομιστή be at least 7 characters in length\n"; + } + else + { + $stmt="DELETE from servers where server_id='$server_id' and server_ip='$server_ip' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING SERVER!!|$PHP_AUTH_USER|$ip|server_id='$server_id'|server_ip='$server_ip'|\n"); + fclose($fp); + } + echo "
ΔΙΑΚΟΜΙΣΤΗΣ DELETION COMPLETED: $server_id - $server_ip\n"; + echo "

\n"; + } +$ADD='100000000000'; # go to server list +} + + +###################### +# ADD=621111111111 delete vicidial server trunk record in the system +###################### + +if ($ADD==621111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($server_ip) < 7) ) + { + echo "
Η ΕΓΓΡΑΦΗ ΤΟΥ ΚΟΡΜΟΥ ΣΤΟΠΕΞΥΠΗΡΕΤΗΤΗ ΔΕΠΔΙΑΓΡΑΦΗΚΕ - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
η εκστÏατεία Ï€Ïέπει να είναι Î¼ÎµÏ„Î±Î¾Ï 3 και 8 χαÏακτήÏων στο μήκος\n"; + echo "
η server_ip καθυστέÏηση Ï€Ïέπει να είναι τουλάχιστον 7 χαÏακτήÏες\n"; + } + else + { + echo "
Η ΕΓΓΡΑΦΗ ΤΟΥ ΚΟΡΜΟΥ ΣΤΟΠΕΞΥΠΗΡΕΤΗΤΗ ΔΙΑΓΡΑΦΗΚΕ: $campaign_id - $server_ip\n"; + + $stmt="DELETE FROM vicidial_server_trunks where campaign_id='$campaign_id' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE ΔΙΑΚΟΜΙΣΤΗΣ TRUNK |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +$ADD=311111111111; # go to server modification form below +} + + +###################### +# ADD=6111111111111 delete conference record +###################### + +if ($ADD==6111111111111) +{ + echo ""; + + if ( (strlen($conf_exten) < 2) or (strlen($server_ip) < 7) or ($CoNfIrM != 'YES') or ($LOGast_delete_phones < 1) ) + { + echo "
CONFERENCE NOT DELETED - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
Conference be at least 2 characters in length\n"; + echo "
IP Διακομιστή be at least 7 characters in length\n"; + } + else + { + $stmt="DELETE from conferences where conf_exten='$conf_exten' and server_ip='$server_ip' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING CONF!!!!|$PHP_AUTH_USER|$ip|conf_exten='$conf_exten'|server_ip='$server_ip'|\n"); + fclose($fp); + } + echo "
CONFERENCE DELETION COMPLETED: $conf_exten - $server_ip\n"; + echo "

\n"; + } +$ADD='1000000000000'; # go to conference list +} + + +###################### +# ADD=61111111111111 delete vicidial conference record +###################### + +if ($ADD==61111111111111) +{ + echo ""; + + if ( (strlen($conf_exten) < 2) or (strlen($server_ip) < 7) or ($CoNfIrM != 'YES') or ($LOGast_delete_phones < 1) ) + { + echo "
VICIDIAL CONFERENCE NOT DELETED - ΠαÏακαλώ επιστÏέψτε πίσω και κάνετε έλεγχο των δεδομένων που καταχωÏήσατε\n"; + echo "
Conference be at least 2 characters in length\n"; + echo "
IP Διακομιστή be at least 7 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_conferences where conf_exten='$conf_exten' and server_ip='$server_ip' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING CONF!!!!|$PHP_AUTH_USER|$ip|conf_exten='$conf_exten'|server_ip='$server_ip'|\n"); + fclose($fp); + } + echo "
VICIDIAL CONFERENCE DELETION COMPLETED: $conf_exten - $server_ip\n"; + echo "

\n"; + } +$ADD='10000000000000'; # go to vicidial conference list +} + + + + + +###################################################################################################### +###################################################################################################### +####### 3 series, record modification forms +###################################################################################################### +###################################################################################################### + + + + +###################### +# ADD=3 modify user info in the system +###################### + +if ($ADD==3) +{ + if ($LOGmodify_users==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $user_level = $row[4]; + $user_group = $row[5]; + $phone_login = $row[6]; + $phone_pass = $row[7]; + $delete_users = $row[8]; + $delete_user_groups = $row[9]; + $delete_lists = $row[10]; + $delete_campaigns = $row[11]; + $delete_ingroups = $row[12]; + $delete_remote_agents = $row[13]; + $load_leads = $row[14]; + $campaign_detail = $row[15]; + $ast_admin_access = $row[16]; + $ast_delete_phones = $row[17]; + $delete_scripts = $row[18]; + $modify_leads = $row[19]; + $hotkeys_active = $row[20]; + $change_agent_campaign =$row[21]; + $agent_choose_ingroups =$row[22]; + $scheduled_callbacks = $row[24]; + $agentonly_callbacks = $row[25]; + $agentcall_manual = $row[26]; + $vicidial_recording = $row[27]; + $vicidial_transfers = $row[28]; + $delete_filters = $row[29]; + $alter_agent_interface_options =$row[30]; + $closer_default_blended = $row[31]; + $delete_call_times = $row[32]; + $modify_call_times = $row[33]; + $modify_users = $row[34]; + $modify_campaigns = $row[35]; + $modify_lists = $row[36]; + $modify_scripts = $row[37]; + $modify_filters = $row[38]; + $modify_ingroups = $row[39]; + $modify_usergroups = $row[40]; + $modify_remoteagents = $row[41]; + $modify_servers = $row[42]; + $view_reports = $row[43]; + $vicidial_recording_override = $row[44]; + $alter_custdata_override = $row[45]; + + if ( ($user_level >= $LOGuser_level) and ($LOGuser_level < 9) ) + { + echo "
Δεν έχετε τις άδειες να Ï„Ïοποποιήσετε αυτόν τον χÏήστη: $row[1]\n"; + } + else + { + echo "
ΤΡΟΠΟΠΟΙΗΣΗ ΕΓΓΡΑΦΗΣ ΧΡΗΣΤΩÎ: $row[1]\n"; + if ($LOGuser_level > 8) + {echo "\n";} + else + { + if ($LOGalter_agent_interface == "1") + {echo "\n";} + else + {echo "\n";} + } + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + if ( ($LOGuser_level > 8) or ($LOGalter_agent_interface == "1") ) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + if ($LOGuser_level > 8) + { + echo "\n"; + +#9BB9FB +#B9CBFD + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + echo "\n"; + echo "
ΑÏιθμός ΧÏήστη: $row[1]$NWB#vicidial_users-user$NWE
Κωδικός:$NWB#vicidial_users-pass$NWE
ΠλήÏες Ονομα: $NWB#vicidial_users-full_name$NWE
Επίπεδο ΧÏήστη: $NWB#vicidial_users-user_level$NWE
Ομάδα ΧÏήστη: $NWB#vicidial_users-user_group$NWE
Τηλέφωνο ΣÏνδεσης: $NWB#vicidial_users-phone_login$NWE
Κωδικός ΠÏόσβασης Τηλεφώνου: $NWB#vicidial_users-phone_pass$NWE
ΕΠΙΛΟΓΕΣ ΕΠΙΦΑÎΕΙΑΣ ΕΡΓΑΣΙΑΣ ΧΕΙΡΙΣΤΩÎ:
Ο χειÏιστής επιλέγει Εισ.Ομάδες: $NWB#vicidial_users-agent_choose_ingroups$NWE
ΕνεÏγά Κλειδιά: $NWB#vicidial_users-hotkeys_active$NWE
ΠÏογÏαμματισμένες Επανακλήσεις: $NWB#vicidial_users-scheduled_callbacks$NWE
Μόνο του ΧειÏιστή Επανακλήσεις: $NWB#vicidial_users-agentonly_callbacks$NWE
ΕγχειÏίδιο κλήσεων ΧειÏιστή: $NWB#vicidial_users-agentcall_manual$NWE
ΚαταγÏαφή: $NWB#vicidial_users-vicidial_recording$NWE
ΜεταφοÏές: $NWB#vicidial_users-vicidial_transfers$NWE
Η πιό στενή Ï€Ïοεπιλογή συνδÏασε: $NWB#vicidial_users-closer_default_blended$NWE
VICIDIAL συμπληÏωματική Ï€Ïομήθεια καταγÏαφής: $NWB#vicidial_users-vicidial_recording_override$NWE
Ο Ï€ÏάκτοÏας αλλάζει τη συμπληÏωματική Ï€Ïομήθεια στοιχείωνπελατών: $NWB#vicidial_users-alter_custdata_override$NWE
Τάξεις εκστÏατείας:$NWB#vicidial_users-campaign_ranks$NWE
\n"; + echo "\n"; + echo "$RANKcampaigns_list"; + echo "
\n"; + echo "
ΕισεÏχόμενες Ομάδες: $NWB#vicidial_users-closer_campaigns$NWE
\n"; + echo "\n"; + echo "$RANKgroups_list"; + echo "
\n"; + echo "
ΕΠΙΛΟΓΈΣ ΕΠΙΦΑÎΕΙΑΣ ΕΡΓΑΣΙΑΣ ΔΙΑΧ:
Εκθέσεις άποψης: $NWB#vicidial_users-view_reports$NWE
Αλλάξτε τις επιλογές επιφάνειας εÏγασίας των χειÏιστών: $NWB#vicidial_users-alter_agent_interface_options$NWE
ΤÏοποποιήστε τους χÏήστες: $NWB#vicidial_users-modify_sections$NWE
Αλλαγή ΕκστÏατείας ΧειÏιστή: $NWB#vicidial_users-change_agent_campaign$NWE
ΔιάγÏαψε τους χÏήστες: $NWB#vicidial_users-delete_users$NWE
ΤÏοποποιήστε τις ομάδες χÏηστών: $NWB#vicidial_users-modify_sections$NWE
ΔιάγÏαψε τις ομάδες χÏηστών: $NWB#vicidial_users-delete_user_groups$NWE
ΤÏοποποιήστε τους καταλόγους: $NWB#vicidial_users-modify_sections$NWE
ΔιάγÏαψε τις Λίστες: $NWB#vicidial_users-delete_lists$NWE
Εισαγωγή Οδηγών: $NWB#vicidial_users-load_leads$NWE
ΤÏοποποίηση Οδηγών: $NWB#vicidial_users-modify_leads$NWE
ΤÏοποποιήστε τις εκστÏατείες: $NWB#vicidial_users-modify_sections$NWE
ΛεπτομέÏειες εκστÏατείας: $NWB#vicidial_users-campaign_detail$NWE
ΔιάγÏαψε τις εκστÏατείες: $NWB#vicidial_users-delete_campaigns$NWE
ΤÏοποποιήστε τις-ΟΜΑΔΕΣ: $NWB#vicidial_users-modify_sections$NWE
ΔιάγÏαψε τις Εισ-ΟΜΑΔΕΣ: $NWB#vicidial_users-delete_ingroups$NWE
ΤÏοποποιήστε τους μακÏινοÏÏ‚ Ï€ÏάκτοÏες: $NWB#vicidial_users-modify_sections$NWE
ΔιάγÏαψε τους ΑπομακÏυσμένους ΧειÏιστές: $NWB#vicidial_users-delete_remote_agents$NWE
ΤÏοποποιήστε τα χειÏόγÏαφα: $NWB#vicidial_users-modify_sections$NWE
ΔιάγÏαψε τον Βοηθόs: $NWB#vicidial_users-delete_scripts$NWE
ΤÏοποποιήστε τα φίλτÏα: $NWB#vicidial_users-modify_sections$NWE
ΔιαγÏαφή ΦίλτÏουs: $NWB#vicidial_users-delete_filters$NWE
ΠÏόσβαση AGC Admin: $NWB#vicidial_users-ast_admin_access$NWE
Το AGC διαγÏάφει τα τηλέφωνα: $NWB#vicidial_users-ast_delete_phones$NWE
ΤÏοποποίηση ΧÏόνου Κλήσηςs: $NWB#vicidial_users-modify_call_times$NWE
ΔιαγÏαφή ΧÏόνου Κλήσηςs: $NWB#vicidial_users-delete_call_times$NWE
ΤÏοποποιήστε τους κεντÏικοÏÏ‚ υπολογιστές: $NWB#vicidial_users-modify_sections$NWE
\n"; + + if ($LOGdelete_users > 0) + { + echo "

ΔΙΑΓΡΑΨΕ ΑΥΤΟΠΤΟΠΧΡΗΣΤΗ\n"; + } + echo "

Επιλέξτε εδώ για την σελίδα με τους χÏόνους χÏήσης\n"; + echo "

Επιλέξτε εδώ για τη κατάσταση του χÏήστη\n"; + echo "

Πατήστε εδώ για στατιστικά χÏήστη\n"; + echo "

Επιλέξτε εδώ για τις Επανακλήσεις του χÏήστη που κÏατήθηκαν\n"; + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + +###################### +# ADD=31 modify campaign info in the system - Detail view +###################### + +if ( ($LOGcampaign_detail < 1) and ($ADD==31) ) {$ADD=34;} # send to Basic if not allowed + +if ( ($ADD==31) and ( (!eregi("$campaign_id",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) ) + {$ADD=30;} # send to not allowed screen if not in vicidial_user_groups allowed_campaigns list + +if ($ADD==31) +{ + if ($LOGmodify_campaigns==1) + { + if ($stage=='show_dialable') + { + $stmt="UPDATE vicidial_campaigns set display_dialable_count='Y' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + if ($stage=='hide_dialable') + { + $stmt="UPDATE vicidial_campaigns set display_dialable_count='N' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + + $stmt="SELECT * from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $campaign_name = $row[1]; + $dial_status_a = $row[3]; + $dial_status_b = $row[4]; + $dial_status_c = $row[5]; + $dial_status_d = $row[6]; + $dial_status_e = $row[7]; + $lead_order = $row[8]; + $allow_closers = $row[12]; + $hopper_level = $row[13]; + $auto_dial_level = $row[14]; + $next_agent_call = $row[15]; + $local_call_time = $row[16]; + $voicemail_ext = $row[17]; + $dial_timeout = $row[18]; + $dial_prefix = $row[19]; + $campaign_cid = $row[20]; + $campaign_vdad_exten = $row[21]; + $campaign_rec_exten = $row[22]; + $campaign_recording = $row[23]; + $campaign_rec_filename = $row[24]; + $script_id = $row[25]; + $get_call_launch = $row[26]; + $am_message_exten = $row[27]; + $amd_send_to_vmx = $row[28]; + $xferconf_a_dtmf = $row[29]; + $xferconf_a_number = $row[30]; + $xferconf_b_dtmf = $row[31]; + $xferconf_b_number = $row[32]; + $alt_number_dialing = $row[33]; + $scheduled_callbacks = $row[34]; + $lead_filter_id = $row[35]; + if ($lead_filter_id=='') {$lead_filter_id='NONE';} + $drop_call_seconds = $row[36]; + $safe_harbor_message = $row[37]; + $safe_harbor_exten = $row[38]; + $display_dialable_count = $row[39]; + $wrapup_seconds = $row[40]; + $wrapup_message = $row[41]; + # $closer_campaigns = $row[42]; + $use_internal_dnc = $row[43]; + $allcalls_delay = $row[44]; + $omit_phone_code = $row[45]; + $dial_method = $row[46]; + $available_only_ratio_tally = $row[47]; + $adaptive_dropped_percentage = $row[48]; + $adaptive_maximum_level = $row[49]; + $adaptive_latest_server_time = $row[50]; + $adaptive_intensity = $row[51]; + $adaptive_dl_diff_target = $row[52]; + $concurrent_transfers = $row[53]; + $auto_alt_dial = $row[54]; + $auto_alt_dial_statuses = $row[55]; + $agent_pause_codes_active = $row[56]; + $campaign_description = $row[57]; + $campaign_changedate = $row[58]; + $campaign_stats_refresh = $row[59]; + $campaign_logindate = $row[60]; + $dial_statuses = $row[61]; + $disable_alter_custdata = $row[62]; + $no_hopper_leads_logins = $row[63]; + $list_order_mix = $row[64]; + $campaign_allow_inbound = $row[65]; + $manual_dial_list_id = $row[66]; + $default_xfer_group = $row[67]; + + if (ereg("DISABLED",$list_order_mix)) + {$DEFlistDISABLE = ''; $DEFstatusDISABLED=0;} + else + {$DEFlistDISABLE = 'disabled'; $DEFstatusDISABLED=1;} + + $stmt="SELECT count(*) from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and status='ACTIVE'"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0] < 1) + { + $mixes_list="\n"; + $mixname_list["DISABLED"] = "DISABLED"; + } + else + { + ##### get list_mix listings for dynamic pulldown + $stmt="SELECT vcl_id,vcl_name from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and status='ACTIVE' limit 1"; + $rslt=mysql_query($stmt, $link); + $mixes_to_print = mysql_num_rows($rslt); + $mixes_list="\n"; + + $o=0; + while ($mixes_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $mixes_list .= "\n"; + $mixname_list["ACTIVE"] = "$rowx[0] - $rowx[1]"; + $o++; + } + } + + ##### get status listings for dynamic pulldown + $stmt="SELECT * from vicidial_statuses order by status"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $statuses_list=''; + + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $statuses_list .= "\n"; + $statname_list["$rowx[0]"] = "$rowx[1]"; + $LRstatuses_list .= "\n"; + if (eregi("Y",$rowx[2])) + {$HKstatuses_list .= "\n";} + $o++; + } + + $stmt="SELECT * from vicidial_campaign_statuses where campaign_id='$campaign_id' order by status"; + $rslt=mysql_query($stmt, $link); + $Cstatuses_to_print = mysql_num_rows($rslt); + + $o=0; + while ($Cstatuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $statuses_list .= "\n"; + $statname_list["$rowx[0]"] = "$rowx[1]"; + $LRstatuses_list .= "\n"; + if (eregi("Y",$rowx[2])) + {$HKstatuses_list .= "\n";} + $o++; + } + + $dial_statuses = preg_replace("/ -$/","",$dial_statuses); + $Dstatuses = explode(" ", $dial_statuses); + $Ds_to_print = (count($Dstatuses) -1); + + ##### get in-groups listings for dynamic pulldown list menu + $stmt="SELECT group_id,group_name from vicidial_inbound_groups $xfer_groupsSQL order by group_id"; + $rslt=mysql_query($stmt, $link); + $Xgroups_to_print = mysql_num_rows($rslt); + $Xgroups_menu=''; + $Xgroups_selected=0; + $o=0; + while ($Xgroups_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $Xgroups_menu .= "\n"; + $o++; + } + if ($Xgroups_selected < 1) + {$Xgroups_menu .= "\n";} + else + {$Xgroups_menu .= "\n";} + + + if ($SUB<1) {$camp_detail_color=$subcamp_color;} + else {$camp_detail_color=$campaigns_color;} + if ($SUB==22) {$camp_statuses_color=$subcamp_color;} + else {$camp_statuses_color=$campaigns_color;} + if ($SUB==23) {$camp_hotkeys_color=$subcamp_color;} + else {$camp_hotkeys_color=$campaigns_color;} + if ($SUB==25) {$camp_recycle_color=$subcamp_color;} + else {$camp_recycle_color=$campaigns_color;} + if ($SUB==26) {$camp_autoalt_color=$subcamp_color;} + else {$camp_autoalt_color=$campaigns_color;} + if ($SUB==27) {$camp_pause_color=$subcamp_color;} + else {$camp_pause_color=$campaigns_color;} + if ($SUB==29) {$camp_listmix_color=$subcamp_color;} + else {$camp_listmix_color=$campaigns_color;} + echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "
$row[0]: Basic Detail StatusesHotKeysLead RecyclingAuto Alt DialPause CodesList Mix Real-Time
\n"; + + echo "
\n"; + echo ""; + + echo "
\n"; + + if ($SUB < 1) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + $o=0; + while ($Ds_to_print > $o) + { + $o++; + $Dstatus = $Dstatuses[$o]; + + echo "\n"; + } + else + { + echo "$Dstatus - $statname_list[$Dstatus]         \n"; + echo "ΑΦΑΙΡΕΣΤΕ\n"; + } + } + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + + + echo "\n"; + + echo "\n"; + + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + if ($campaign_allow_inbound == 'Y') + { + echo "\n"; + } + + echo "\n"; + + if ($allow_closers == 'Y') + { + echo "\n"; + } + + echo "\n"; + echo "
ID ΕκστÏατείας: $row[0]$NWB#vicidial_campaigns-campaign_id$NWE
Ονομα ΕκστÏατείας: $NWB#vicidial_campaigns-campaign_name$NWE
ΠεÏιγÏαφή εκστÏατείας: $NWB#vicidial_campaigns-campaign_description$NWE
ΕκστÏατεία Change Date: $campaign_changedate   $NWB#vicidial_campaigns-campaign_changedate$NWE
ΕκστÏατεία Login Date: $campaign_logindate   $NWB#vicidial_campaigns-campaign_logindate$NWE
ΕνεÏγή:$NWB#vicidial_campaigns-active$NWE
Τηλ.σÏνδ. Στάθμευσης: - Filename: $NWB#vicidial_campaigns-park_ext$NWE
Ιστο-σελίδα: $NWB#vicidial_campaigns-web_form_address$NWE
ΕπιτÏέπω τους Closers: $NWB#vicidial_campaigns-allow_closers$NWE
ΕπιτÏέψτε πλησίον και συνδÏασε:$NWB#vicidial_campaigns-campaign_allow_inbound$NWE
Θέση πινάκων$o: \n"; + + if ($DEFstatusDISABLED > 0) + { + echo "$Dstatus - $statname_list[$Dstatus]         \n"; + echo "REMOVE
Add A Dial Κατάσταση:   \n"; + echo "     $NWB#vicidial_campaigns-dial_status$NWE
ΣειÏά Λίστας: $NWB#vicidial_campaigns-lead_order$NWE
List Mix: $NWB#vicidial_campaigns-list_order_mix$NWE
ΦίλτÏο ΟδηγοÏ: $NWB#vicidial_campaigns-lead_filter_id$NWE
Επίπεδο Hopper: $NWB#vicidial_campaigns-hopper_level$NWE
Αναγκαστική ΕπαναφοÏά του Hopper: $NWB#vicidial_campaigns-force_reset_hopper$NWE
Μέθοδος Κλήσης +: $NWB#vicidial_campaigns-dial_method$NWE
ΕΠΙΠΕΔΟ ΑΥΤΟΜΑΤΗΣ ΚΛΗΣΗΣ: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE       ΠΡΟΣΑΡΜΟΣΤΕ ΤΗ ΣΥΜΠΛΗΡΩΜΑΤΙΚΗ ΠΡΟΜΉΘΕΙΑ
Διαθέσιμα μόνο ετικέτες +: $NWB#vicidial_campaigns-available_only_ratio_tally$NWE
Ποσοστό ΟÏίου Εγκατ.Κλήσεων +: % $NWB#vicidial_campaigns-adaptive_dropped_percentage$NWE
Μέγιστο Επίπεδο ΠÏοσαÏμογής Κλήσεων +: number only $NWB#vicidial_campaigns-adaptive_maximum_level$NWE
Τελευταίος ΧÏόνος Διακομιστή +: 4 μόνο αÏιθμοί $NWB#vicidial_campaigns-adaptive_latest_server_time$NWE
Ενταση ΤÏοποποίησης ΠÏοσαÏμογής +: $NWB#vicidial_campaigns-adaptive_intensity$NWE
Επίπεδο Κλήσεων Μεταβολής Στόχου +: $NWB#vicidial_campaigns-adaptive_dl_diff_target$NWE
ΤαυτόχÏονες μεταφοÏές: $NWB#vicidial_campaigns-concurrent_transfers$NWE
Αυτόματος σχηματισμός ALT-ARJCMOY: $NWB#vicidial_campaigns-auto_alt_dial$NWE
Επόμενη Κλήση ΧειÏιστή: $NWB#vicidial_campaigns-next_agent_call$NWE
ΧÏόνος Τοπικής Κλήσης: $NWB#vicidial_campaigns-local_call_time$NWE
Κλήση εκτός χÏόνου: in seconds$NWB#vicidial_campaigns-dial_timeout$NWE
ΠÏόθεμα Κλήσης: for 91NXXNXXXXXX value would be 9, for no dial prefix use X$NWB#vicidial_campaigns-dial_prefix$NWE
ΠαÏάλειψη ÎšÏ‰Î´Î¹ÎºÎ¿Ï Î¤Î·Î»ÎµÏ†ÏŽÎ½Î¿Ï… +: $NWB#vicidial_campaigns-omit_phone_code$NWE
CallerID ΕκστÏατείας: $NWB#vicidial_campaigns-campaign_cid$NWE
ΕκστÏατείας VDAD εσωτ.σÏνδεση: $NWB#vicidial_campaigns-campaign_vdad_exten$NWE
Επέκταση εκστÏατείας ΗχογÏ: $NWB#vicidial_campaigns-campaign_rec_exten$NWE
ΗχογÏάφηση εκστÏατείας: $NWB#vicidial_campaigns-campaign_recording$NWE
Όνομα αÏχείου εκστÏατείας ΗχογÏ: $NWB#vicidial_campaigns-campaign_rec_filename$NWE
ΚαθυστέÏηση ΗχογÏάφησης +: in seconds$NWB#vicidial_campaigns-allcalls_delay$NWE
Script: $NWB#vicidial_campaigns-campaign_script$NWE
Κατά την έναÏξη κλήσης: $NWB#vicidial_campaigns-get_call_launch$NWE
Μήνυμα Αυτόματου Τηλεφωνητή: $NWB#vicidial_campaigns-am_message_exten$NWE
AMD στέλνει στο VM: $NWB#vicidial_campaigns-amd_send_to_vmx$NWE
DTMF ΜεταφοÏάς-Συνδ 1: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
ΑÏιθμός ΜεταφοÏάς-Συνδ 1: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
DTMF ΜεταφοÏάς-Συνδ 2: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
ΑÏιθμός ΜεταφοÏάς-Συνδ 2: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
Κλήση Εναλ ΑÏιθμοÏ: $NWB#vicidial_campaigns-alt_number_dialing$NWE
ΠÏογÏαμματισμένες Επανακλήσεις: $NWB#vicidial_campaigns-scheduled_callbacks$NWE
ΔευτεÏ. Εγκαταλ. Κλήσης: $NWB#vicidial_campaigns-drop_call_seconds$NWE
ΦΩÎΗΤΙΚΟ ΤΑΧΥΔΡΟΜΕΙΟ: $NWB#vicidial_campaigns-voicemail_ext$NWE
ΧÏήση μηνÏματος ΑσφαλοÏÏ‚ Φιλοξενίας: $NWB#vicidial_campaigns-safe_harbor_message$NWE
Εσωτ.ΣÏνδεση ΑσφαλοÏÏ‚ Φιλοξενίας: $NWB#vicidial_campaigns-safe_harbor_exten$NWE
Î”ÎµÏ…Ï„ÎµÏ Î¤Ï…Î»Î¯Î³Î¼Î±Ï„Î¿Ï‚: $NWB#vicidial_campaigns-wrapup_seconds$NWE
Μήνυμα Τυλίγματος: $NWB#vicidial_campaigns-wrapup_message$NWE
ΕσωτεÏικός κατάλογος DNC χÏήσης: $NWB#vicidial_campaigns-use_internal_dnc$NWE
AgentΚώδικες μικÏής διακοπήςΕνεÏγή:$NWB#vicidial_campaigns-agent_pause_codes_active$NWE
ΕκστÏατεία Stats Refresh: $NWB#vicidial_campaigns-campaign_stats_refresh$NWE
Θέστε εκτός λειτουÏγίας αλλάζει τα στοιχεία πελατών: $NWB#vicidial_campaigns-disable_alter_custdata$NWE
ΕπιτÏέψτε τους κανένας-χοάνη-μολÏβδους Logins: $NWB#vicidial_campaigns-no_hopper_leads_logins$NWE
ΧειÏωνακτικός κατάλογος ταυτότητα πινάκων:$NWB#vicidial_campaigns-manual_dial_list_id$NWE
ΕισεÏχόμενες ομάδες:
"; + echo " $NWB#vicidial_campaigns-closer_campaigns$NWE
\n"; + echo "$groups_list"; + echo "
Ομάδα μεταφοÏάς Ï€Ïοεπιλογής:$NWB#vicidial_campaigns-default_xfer_group$NWE
Ομάδες μεταφοÏάς:
"; + echo " $NWB#vicidial_campaigns-xfer_groups$NWE
\n"; + echo "$XFERgroups_list"; + echo "
\n"; + + echo "
\n"; + echo "
ΛΙΣΤΕΣ ΣΤΗΠΕΚΣΤΡΑΤΕΙΑ:   $NWB#vicidial_campaign_lists$NWE
\n"; + echo "\n"; + echo "\n"; + + $active_lists = 0; + $inactive_lists = 0; + $stmt="SELECT list_id,active,list_name from vicidial_lists where campaign_id='$campaign_id'"; + $rslt=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rslt); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $o++; + if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_lists++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + echo "
ID ΛΙΣΤΑΣΟÎΟΜΑ ΛΙΣΤΑΣΕÎΕΡΓΟ
$rowx[0]$rowx[2]$rowx[1]

\n"; + echo "
\n"; + + $filterSQL = $filtersql_list[$lead_filter_id]; + $filterSQL = eregi_replace("^and|and$|^or|or$","",$filterSQL); + if (strlen($filterSQL)>4) + {$fSQL = "and $filterSQL";} + else + {$fSQL = '';} + + $camp_lists = eregi_replace(".$","",$camp_lists); + echo "Αυτή η εκστÏατεία έχει$active_lists ενεÏγές λίστες και$inactive_lists Μη ενεÏγές λίστες

\n"; + + if ($display_dialable_count == 'Y') + { + ### call function to calculate and print dialable leads + dialable_leads($DB,$link,$local_call_time,$dial_statuses,$camp_lists,$fSQL); + echo " - ΑΠΟΚΡΥΨΗ

"; + } + else + { + echo "Popup Dialable Leads Count"; + echo " - ΕΜΦΑÎΙΣΗ

"; + } + + + + + + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id='$campaign_id' and status IN('READY')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $hopper_leads = "$rowx[0]"; + + echo "Αυτή η εκστÏατεία έχει$hopper_leads >οδηγοί στον hopper κλήσεων<

\n"; + echo "Πατήστε εδώ για να δείτε ποιοι οδηγοί είναι στον hopper τώÏα

\n"; + echo "Επιλέξτε εδώ για να δείτε τις κÏατειμένες Επανακλήσεις σε αυτήν την εκστÏατεία

\n"; + echo "Click here to see a VDAD report for this campaign

\n"; + echo "
\n"; + } + + + + if ($SUB==22) + { + + ##### get status category listings for dynamic pulldown + $stmt="SELECT vsc_id,vsc_name from vicidial_status_categories order by vsc_id desc"; + $rslt=mysql_query($stmt, $link); + $cats_to_print = mysql_num_rows($rslt); + $cats_list=""; + + $o=0; + while ($cats_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $cats_list .= "\n"; + $catsname_list["$rowx[0]"] = substr($rowx[1],0,20); + $o++; + } + + + echo "
\n"; + echo "
ΠΡΟΣΑΡΜΟΣΜΕÎΕΣ ΚΑΤΑΣΤΑΣΕΙΣ ΣΤΗΠΕΚΣΤΡΑΤΕΙΑ:   $NWB#vicidial_campaign_statuses$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_campaign_statuses where campaign_id='$campaign_id'"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $AScategory = $rowx[5]; + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
ΚΑΤΑΣΤΑΣΗΠΕΡΙΓΡΑΦΗΕΠΙΛΕΞΙΜΟΑÎΘΡΩΠΙÎΗ ΑΠΑÎΤΗΣΗΔΙΑΓΡΑΦΗ
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "$rowx[0]
\n"; + echo "\n"; + echo "         \n"; + echo "   \n"; + echo "ΔΙΑΓΡΑΦΗ\n"; + echo "
\n"; + + echo "
ΠΡΟΣΘΗΚΗ ÎΕΑΣ ΠΡΟΣΑΡΜΟΣΜΕÎΗΣ ΚΑΤΑΣΤΑΣΗΣ ΣΤΗΠΕΚΣΤΡΑΤΕΙΑ
\n"; + echo "\n"; + echo "\n"; + echo "Κατάσταση:   \n"; + echo "ΠεÏιγÏαφή:   \n"; + echo "Επιλέξιμο:   \n"; + echo "Human Answer:   \n"; + echo "ΚατηγοÏία:\n"; + echo "  
\n"; + echo "
\n"; + + echo "

\n"; + } + + + if ($SUB==23) + { + echo "
ΠΡΟΣΑΡΜΟΣΜΕÎΑ ΚΛΕΙΔΙΑ ΣΤΗΠΕΚΣΤΡΑΤΕΙΑ:   $NWB#vicidial_campaign_hotkeys$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_campaign_hotkeys where campaign_id='$campaign_id' order by hotkey"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $o=0; + while ($statuses_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + + echo "
ΚΛΕΙΔΙΚΑΤΑΣΤΑΣΗΠΕΡΙΓΡΑΦΗΔΙΑΓΡΑΦΗ
$rowx[1]$rowx[0]$rowx[2]ΔΙΑΓΡΑΦΗ
\n"; + + echo "
ΠΡΟΣΘΗΚΗ ÎΕΟΥ ΠΡΟΣΑΡΜΟΣΜΕÎΟΥ ΚΛΕΙΔΙΟΥ ΕΚΣΤΡΑΤΕΙΑΣ
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Hotkey:   \n"; + echo "Κατάσταση:   \n"; + echo "
\n"; + echo "

\n"; + } + + + if ($SUB==25) + { + echo "

ΑÎΑΚΥΚΛΩΣΗ ΟΔΗΓΟΥ ΜΕΣΑ ΣΕ ΑΥΤΗΠΤΗΠΕΚΣΤΡΑΤΕΙΑ:   $NWB#vicidial_lead_recycle$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_lead_recycle where campaign_id='$campaign_id' order by status"; + $rslt=mysql_query($stmt, $link); + $recycle_to_print = mysql_num_rows($rslt); + $o=0; + while ($recycle_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
ΚΑΤΑΣΤΑΣΗΚΑΘΥΣΤΕΡΗΣΗ ΠΡΟΣΠΑΘΕΙΑΣΜΕΓΙΣΤΟ ΠΡΟΣΠΑΘΕΙΑΣΕÎΕΡΓΟ ΔΙΑΓΡΑΦΗ
$rowx[2]
\n"; + echo "\n"; + echo "\n"; + echo "
ΔΙΑΓΡΑΦΗ
\n"; + + echo "
ΠΡΟΣΘΕΣΕ ÎΕΟ ΟΔΗΓΟ ΕΚΣΤΡΑΤΕΙΑΣ ΑÎΑΚΥΚΛΩΣΗΣ
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Κατάσταση:   \n"; + echo "ΚαθυστέÏηση Ï€Ïοσπάθειας: \n"; + echo "Μέγιστο Ï€Ïοσπάθειας: \n"; + echo "
\n"; + + echo "

\n"; + } + + + if ($SUB==26) + { + echo "

ΑΥΤΟΜΑΤΟΣ ΣΧΗΜΑΤΙΣΜΌΣ ΑΡΙΘΜΟΎ ALT ΓΙΑ ΑΥΤΉΠΤΗΠΕΚΣΤΡΑΤΕΊΑ:   $NWB#vicidial_auto_alt_dial_statuses$NWE
\n"; + echo "\n"; + echo "\n"; + + $auto_alt_dial_statuses = preg_replace("/ -$/","",$auto_alt_dial_statuses); + $AADstatuses = explode(" ", $auto_alt_dial_statuses); + $AADs_to_print = (count($AADstatuses) -1); + + $o=0; + while ($AADs_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + $o++; + + echo "\n"; + echo "\n"; + } + + echo "
STATUSESΔΙΑΓΡΑΦΗ
$AADstatuses[$o]ΔΙΑΓΡΑΦΗ
\n"; + + echo "
ΠΡΟΣΘΕΣΤΕ ΤΗ ÎΕΑ ΑΥΤΟΜΑΤΗ ΘΈΣΗ ΣΧΗΜΑΤΙΣΜΟΎ ΑΡΙΘΜΟΎ ALT
\n"; + echo "\n"; + echo "\n"; + echo "Κατάσταση:   \n"; + echo "
\n"; + + echo "

\n"; + } + + + if ($SUB==27) + { + echo "

ΚΩΔΙΚΕΣ ΜΙΚΡΗΣ ΔΙΑΚΟΠΉΣ ΠΡΑΚΤΟΡΩΠΓΙΑ ΑΥΤΗΠΤΗΠΕΚΣΤΡΑΤΕΙΑ:   $NWB#vicidial_pause_codes$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_pause_codes where campaign_id='$campaign_id' order by pause_code"; + $rslt=mysql_query($stmt, $link); + $pause_codes_to_print = mysql_num_rows($rslt); + $o=0; + while ($pause_codes_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
ΚΩΔΙΚΕΣ ΜΙΚΡΗΣ ΔΙΑΚΟΠΉΣΧΡΕΩΤΕΟΣΤΡΟΠΟΠΟΙΗΣΗΔΙΑΓΡΑΦΗ
$rowx[0]\n"; + echo "\n"; + echo "\n"; + echo "  \n"; + echo "
ΔΙΑΓΡΑΦΗ
\n"; + + echo "
ΠΡΟΣΘΕΣΤΕ ΤΟ ÎΕΟ ΚΩΔΙΚΑ ΜΙΚΡΗΣ ΔΙΑΚΟΠΉΣ ΠΡΑΚΤΟΡΩÎ
\n"; + echo "\n"; + echo "\n"; + echo "Κώδικας μικÏής διακοπής: \n"; + echo "Όνομα κώδικα μικÏής διακοπής: \n"; + echo "   ΧÏεωτέος: \n"; + echo "
\n"; + + echo "

\n"; + } + + + if ($SUB < 1) + { + echo "

\n"; + echo "ΑΠΟΣΥÎΔΕΣΗ ΟΛΩΠΤΩΠΧΕΙΡΙΣΤΩΠΑΠΟ ΑΥΤΗΠΤΗΠΕΚΣΤΡΑΤΕΙΑ

\n"; + echo "EMERGENCY VDAC CLEAR FOR THIS CAMPAIGN

\n"; + + if ($LOGdelete_campaigns > 0) + { + echo "

ΔΙΑΓΡΑΨΕ ΑΥΤΗΠΤΗΠΕΚΣΤΡΑΤΕΙΑ\n"; + } + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + +###################### +# ADD=34 modify campaign info in the system - Basic View +###################### + +if ( ($ADD==34) and ( (!eregi("$campaign_id",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) ) + {$ADD=30;} # send to not allowed screen if not in vicidial_user_groups allowed_campaigns list + +if ($ADD==34) +{ + if ($LOGmodify_campaigns==1) + { + if ($stage=='show_dialable') + { + $stmt="UPDATE vicidial_campaigns set display_dialable_count='Y' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + if ($stage=='hide_dialable') + { + $stmt="UPDATE vicidial_campaigns set display_dialable_count='N' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + + $stmt="SELECT * from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $dial_status_a = $row[3]; + $dial_status_b = $row[4]; + $dial_status_c = $row[5]; + $dial_status_d = $row[6]; + $dial_status_e = $row[7]; + $lead_order = $row[8]; + $hopper_level = $row[13]; + $auto_dial_level = $row[14]; + $next_agent_call = $row[15]; + $local_call_time = $row[16]; + $voicemail_ext = $row[17]; + $dial_timeout = $row[18]; + $dial_prefix = $row[19]; + $campaign_cid = $row[20]; + $campaign_vdad_exten = $row[21]; + $script_id = $row[25]; + $get_call_launch = $row[26]; + $lead_filter_id = $row[35]; + if ($lead_filter_id=='') {$lead_filter_id='NONE';} + $display_dialable_count = $row[39]; + $dial_method = $row[46]; + $adaptive_intensity = $row[51]; + $campaign_description = $row[57]; + $campaign_changedate = $row[58]; + $campaign_stats_refresh = $row[59]; + $campaign_logindate = $row[60]; + $dial_statuses = $row[61]; + $list_order_mix = $row[64]; + $default_xfer_group = $row[67]; + $campaign_allow_inbound = $row[65]; + $default_xfer_group = $row[67]; + + if (ereg("DISABLED",$list_order_mix)) + {$DEFlistDISABLE = ''; $DEFstatusDISABLED=0;} + else + {$DEFlistDISABLE = 'disabled'; $DEFstatusDISABLED=1;} + + $stmt="SELECT * from vicidial_statuses order by status"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $statuses_list=''; + + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $statuses_list .= "\n"; + $statname_list["$rowx[0]"] = "$rowx[1]"; + $LRstatuses_list .= "\n"; + if (eregi("Y",$rowx[2])) + {$HKstatuses_list .= "\n";} + $o++; + } + + $stmt="SELECT * from vicidial_campaign_statuses where campaign_id='$campaign_id' order by status"; + $rslt=mysql_query($stmt, $link); + $Cstatuses_to_print = mysql_num_rows($rslt); + + $o=0; + while ($Cstatuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $statuses_list .= "\n"; + $statname_list["$rowx[0]"] = "$rowx[1]"; + $LRstatuses_list .= "\n"; + if (eregi("Y",$rowx[2])) + {$HKstatuses_list .= "\n";} + $o++; + } + + $dial_statuses = preg_replace("/ -$/","",$dial_statuses); + $Dstatuses = explode(" ", $dial_statuses); + $Ds_to_print = (count($Dstatuses) -1); + + $stmt="SELECT count(*) from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and status='ACTIVE'"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0] < 1) + { + $mixes_list="\n"; + $mixname_list["DISABLED"] = "DISABLED"; + } + else + { + ##### get list_mix listings for dynamic pulldown + $stmt="SELECT vcl_id,vcl_name from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and status='ACTIVE' limit 1"; + $rslt=mysql_query($stmt, $link); + $mixes_to_print = mysql_num_rows($rslt); + $mixes_list="\n"; + + $o=0; + while ($mixes_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $mixes_list .= "\n"; + $mixname_list["ACTIVE"] = "$rowx[0] - $rowx[1]"; + $o++; + } + } + + if ($SUB<1) {$camp_detail_color=$subcamp_color;} + else {$camp_detail_color=$campaigns_color;} + if ($SUB==22) {$camp_statuses_color=$subcamp_color;} + else {$camp_statuses_color=$campaigns_color;} + if ($SUB==23) {$camp_hotkeys_color=$subcamp_color;} + else {$camp_hotkeys_color=$campaigns_color;} + if ($SUB==25) {$camp_recycle_color=$subcamp_color;} + else {$camp_recycle_color=$campaigns_color;} + if ($SUB==26) {$camp_autoalt_color=$subcamp_color;} + else {$camp_autoalt_color=$campaigns_color;} + if ($SUB==27) {$camp_pause_color=$subcamp_color;} + else {$camp_pause_color=$campaigns_color;} + if ($SUB==29) {$camp_listmix_color=$subcamp_color;} + else {$camp_listmix_color=$campaigns_color;} + echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "
$row[0]: Βασική Επισκόπηση Αναλυτική Επισκόπηση List Mix ΠÏÎ±Î³Î¼Î±Ï„Î¹ÎºÎ¿Ï Î§Ïόνου Οθόνη  
\n"; + + if ($SUB < 1) + { + echo "
\n"; + echo ""; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + $o=0; + while ($Ds_to_print > $o) + { + $o++; + $Dstatus = $Dstatuses[$o]; + + echo "\n"; + } + else + { + echo "$Dstatus - $statname_list[$Dstatus]         \n"; + echo "ΑΦΑΙΡΕΣΤΕ\n"; + } + } + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + echo "
ID ΕκστÏατείας: $row[0]$NWB#vicidial_campaigns-campaign_id$NWE
Ονομα ΕκστÏατείας: $NWB#vicidial_campaigns-campaign_name$NWE
ΠεÏιγÏαφή εκστÏατείας: $row[57]$NWB#vicidial_campaigns-campaign_description$NWE
ΕκστÏατεία Change Date: $campaign_changedate   $NWB#vicidial_campaigns-campaign_changedate$NWE
ΕκστÏατεία Login Date: $campaign_logindate   $NWB#vicidial_campaigns-campaign_logindate$NWE
ΕνεÏγή:$NWB#vicidial_campaigns-active$NWE
Τηλ.σÏνδ. Στάθμευσης: $row[9] - $row[10]$NWB#vicidial_campaigns-park_ext$NWE
Ιστο-σελίδα: $row[11]$NWB#vicidial_campaigns-web_form_address$NWE
ΕπιτÏέπω τους Closers: $row[12] $NWB#vicidial_campaigns-allow_closers$NWE
Ομάδα μεταφοÏάς Ï€Ïοεπιλογής:$default_xfer_group $NWB#vicidial_campaigns-default_xfer_group$NWE
ΕπιτÏέψτε πλησίον και συνδÏασε:$campaign_allow_inbound $NWB#vicidial_campaigns-campaign_allow_inbound$NWE
Θέση πινάκων$o: \n"; + if ($DEFstatusDISABLED > 0) + { + echo "$Dstatus - $statname_list[$Dstatus]         \n"; + echo "REMOVE
Add A Dial Κατάσταση:   \n"; + echo "     $NWB#vicidial_campaigns-dial_status$NWE
ΣειÏά Λίστας: $NWB#vicidial_campaigns-lead_order$NWE
List Mix: $NWB#vicidial_campaigns-list_order_mix$NWE
ΦίλτÏο ΟδηγοÏ: $NWB#vicidial_campaigns-lead_filter_id$NWE
Επίπεδο Hopper: $NWB#vicidial_campaigns-hopper_level$NWE
Αναγκαστική ΕπαναφοÏά του Hopper: $NWB#vicidial_campaigns-force_reset_hopper$NWE
Μέθοδος Κλήσης +: $NWB#vicidial_campaigns-dial_method$NWE
ΕΠΙΠΕΔΟ ΑΥΤΟΜΑΤΗΣ ΚΛΗΣΗΣ: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE
Ενταση ΤÏοποποίησης ΠÏοσαÏμογής +: $NWB#vicidial_campaigns-adaptive_intensity$NWE
Script: $script_id
Κατά την έναÏξη κλήσης: $get_call_launch
\n"; + + echo "
\n"; + echo "
ΛΙΣΤΕΣ ΣΤΗΠΕΚΣΤΡΑΤΕΙΑ:   $NWB#vicidial_campaign_lists$NWE
\n"; + echo "\n"; + echo "\n"; + + $active_lists = 0; + $inactive_lists = 0; + $stmt="SELECT list_id,active,list_name from vicidial_lists where campaign_id='$campaign_id'"; + $rslt=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rslt); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_lists++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + + echo "
ID ΛΙΣΤΑΣΟÎΟΜΑ ΛΙΣΤΑΣΕÎΕΡΓΟ
$rowx[0]$rowx[2]$rowx[1]

\n"; + echo "
\n"; + + $filterSQL = $filtersql_list[$lead_filter_id]; + $filterSQL = eregi_replace("^and|and$|^or|or$","",$filterSQL); + if (strlen($filterSQL)>4) + {$fSQL = "and $filterSQL";} + else + {$fSQL = '';} + + $camp_lists = eregi_replace(".$","",$camp_lists); + echo "Αυτή η εκστÏατεία έχει$active_lists ενεÏγές λίστες και$inactive_lists Μη ενεÏγές λίστες

\n"; + + + if ($display_dialable_count == 'Y') + { + ### call function to calculate and print dialable leads + dialable_leads($DB,$link,$local_call_time,$dial_statuses,$camp_lists,$fSQL); + echo " - ΑΠΟΚΡΥΨΗ

"; + } + else + { + echo "Popup Dialable Leads Count"; + echo " - ΕΜΦΑÎΙΣΗ

"; + } + + + + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id='$campaign_id' and status IN('READY')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $hopper_leads = "$rowx[0]"; + + echo "Αυτή η εκστÏατεία έχει$hopper_leads >οδηγοί στον hopper κλήσεων<

\n"; + echo "Πατήστε εδώ για να δείτε ποιοι οδηγοί είναι στον hopper τώÏα

\n"; + echo "Επιλέξτε εδώ για να δείτε τις κÏατειμένες Επανακλήσεις σε αυτήν την εκστÏατεία

\n"; + echo "Click here to see a VDAD report for this campaign

\n"; + echo "
\n"; + + echo "
\n"; + + ### list of agent rank or skill-level for this campaign + echo "
\n"; + echo "
ΤΑΞΕΙΣ ΠΡΑΚΤΟΡΩΠΓΙΑ ΑΥΤΗΠΤΗΠΕΚΣΤΡΑΤΕΙΑ:
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT user,campaign_rank,calls_today from vicidial_campaign_agents where campaign_id='$campaign_id'"; + $rsltx=mysql_query($stmt, $link); + $users_to_print = mysql_num_rows($rsltx); + + $o=0; + while ($users_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + + echo "
USER     RANK     CALLS TODAY
$rowx[0]$rowx[1]$rowx[2]

\n"; + + + echo "ΑΠΟΣΥÎΔΕΣΗ ΟΛΩΠΤΩΠΧΕΙΡΙΣΤΩΠΑΠΟ ΑΥΤΗΠΤΗΠΕΚΣΤΡΑΤΕΙΑ

\n"; + + + if ($LOGdelete_campaigns > 0) + { + echo "

ΔΙΑΓΡΑΨΕ ΑΥΤΗΠΤΗΠΕΚΣΤΡΑΤΕΙΑ\n"; + } + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + +###################### +# ADD=31 or 34 and SUB=29 for list mixes +###################### +if ( ( ($ADD==34) or ($ADD==31) ) and ( (!eregi("$campaign_id",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) ) + {$ADD=30;} # send to not allowed screen if not in vicidial_user_groups allowed_campaigns list + +if ( ($ADD==34) or ($ADD==31) ) +{ + if ($LOGmodify_campaigns==1) + { + if ($SUB==29) + { + ##### get list_id listings for dynamic pulldown + $stmt="SELECT list_id,list_name from vicidial_lists where campaign_id='$campaign_id' order by list_id"; + $rslt=mysql_query($stmt, $link); + $mixlists_to_print = mysql_num_rows($rslt); + $mixlists_list=""; + + $o=0; + while ($mixlists_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $mixlists_list .= "\n"; + $mixlistsname_list["$rowx[0]"] = "$rowx[1]"; + $o++; + } + + + echo "

ΜΙΓΜΑΤΑ ΚΑΤΑΛΟΓΩΠΓΙΑ ΑΥΤΗΠΤΗΠΕΚΣΤΡΑΤΕΙΑ:  $NWB#vicidial_campaigns-list_order_mix$NWE
\n"; + + echo "

Experimental Feature in development!!! NON-FUNCTIONAL
\n"; + + + $stmt="SELECT * from vicidial_campaigns_list_mix where campaign_id='$campaign_id' order by status, vcl_id"; + $rslt=mysql_query($stmt, $link); + $listmixes = mysql_num_rows($rslt); + $o=0; + while ($listmixes > $o) + { + $rowx=mysql_fetch_row($rslt); + $vcl_id=$rowx[0]; + $o++; + + if ($o < 2) + {$tablecolor='bgcolor="#99FF99"'; $bgcolor='bgcolor="#CCFFCC"';} + else + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$tablecolor='bgcolor="#B9CBFD"'; $bgcolor='bgcolor="#9BB9FB"';} + else + {$tablecolor='bgcolor="#9BB9FB"'; $bgcolor='bgcolor="#B9CBFD"';} + } + echo "
\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + } + else + {echo "$rowx[5]\n";} + echo "\n"; + echo "\n"; + +# list_id|order|percent|statuses|:list_id|order|percent|statuses|:... +# 101|1|40| A B NA -|:102|2|25| NEW -|:103|3|30| DROP CALLBK -|:101|4|5| DROP -| +# INSERT INTO vicidial_campaigns_list_mix values('TESTMIX','TESTCAMP List Mix','TESTCAMP','101|1|40| A B NA -|:102|2|25| NEW -|:103|3|30| DROP CALLBK -|:101|4|5| DROP -|','IN_ORDER','ACTIVE'); +# INSERT INTO vicidial_campaigns_list_mix values('TESTMIX2','TESTCAMP List Mix2','TESTCAMP','101|1|20| A B -|:102|2|45| NEW -|:103|3|30| DROP CALLBK -|:101|4|5| DROP -|','IN_ORDER','ACTIVE'); +# INSERT INTO vicidial_campaigns_list_mix values('TESTMIX3','TESTCAMP List Mix3','TESTCAMP','101|1|30| A NA -|:102|2|35| NEW -|:103|3|30| DROP CALLBK -|:101|4|5| DROP -|','IN_ORDER','ACTIVE'); + + $MIXentries = $MT; + $MIXentries = explode(":", $rowx[3]); + $Ms_to_print = (count($MIXentries) - 0); + $q=0; + while ($Ms_to_print > $q) + { + $MIXdetails = explode('|', $MIXentries[$q]); + $MIXdetailsLIST = $MIXdetails[0]; + + $dial_statuses = preg_replace("/ -$/","",$dial_statuses); + $Dstatuses = explode(" ", $dial_statuses); + $Ds_to_print = (count($Dstatuses) - 0); + $Dsql = ''; + $r=0; + while ($Ds_to_print > $r) + { + $r++; + $Dsql .= "'$Dstatuses[$r]',"; + } + $Dsql = preg_replace("/,$/","",$Dsql); + + echo "\n"; + + echo "\n"; + + echo "\n"; + + + echo "\n"; + echo "\n"; + + + echo "\n"; + + + $q++; + + } + + + + + echo "\n"; + + echo "\n"; + + + echo "\n"; + + if ($q > 9) {$AE_disabled = 'DISABLED';} + else {$AE_disabled = '';} + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "$vcl_id:\n"; + echo "\n"; + echo "     DELETE LIST MIX
Κατάσταση:\n"; + if ($rowx[5]=='INACTIVE') + { + echo "$rowx[5]\n"; + echo "ΘΕΣΤΕ ΕÎΕΡΓΟΣMethod:\n"; + echo "
ID ΛΙΣΤΑΣPRIORITY% MIXSTATUSES
\n"; + echo "\n"; + echo "List: $MIXdetailsLIST   ΑΦΑΙΡΕΣΤΕ\n"; + + + + echo " \n"; + echo "ADD   \n"; + echo "ΑΦΑΙΡΕΣΤΕ\n"; + echo "
\n"; + echo "Difference %: \n"; + echo "   \n"; + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "List:
\n"; + echo "
\n"; + } + + + echo "

ΠΡΟΣΘΗΚΗ ÎΕΑΣ ΛΙΣΤΑΣ MIX
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Mix ID: Mix Name: Mix Method: "; + echo "
List: Dial Κατάσταση:  
\n"; + + echo "
\n"; + + } + } +} + + +###################### +# ADD=30 campaign not allowed +###################### + +if ($ADD==30) +{ +echo "
\n"; + echo ""; +echo "You do not have permission to view campaign $campaign_id\n"; +} + + +###################### +# ADD=32 display all campaign statuses +###################### +if ($ADD==32) +{ +echo "
\n"; + echo ""; + +echo "
ΛΙΣΤΕΣ ΘΕΣΕΩΠΕΚΣΤΡΑΤΕΙΑΣ ΣΥÎΗΘΕΙΑΣ:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNΟÎΟΜΑSTATUSESΤΡΟΠΟΠΟΙΗΣΗ
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT status from vicidial_campaign_statuses where campaign_id='$campaigns_id_list[$o]' order by status"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if ($p<1) + {echo "NONE";} + echo "MODIFY STATUSES
\n"; +} + + +###################### +# ADD=33 display all campaign hotkeys +###################### +if ($ADD==33) +{ +echo "
\n"; + echo ""; + +echo "
ΛΊΣΤΕΣ ΕΚΣΤΡΑΤΕΙΑΣ HOTKEYS:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNΟÎΟΜΑHOTKEYSΤΡΟΠΟΠΟΙΗΣΗ
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT status from vicidial_campaign_hotkeys where campaign_id='$campaigns_id_list[$o]' order by status"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if ($p<1) + {echo "NONE";} + echo "MODIFY HOTKEYS
\n"; +} + + +###################### +# ADD=35 display all campaign lead recycle entries +###################### +if ($ADD==35) +{ +echo "
\n"; + echo ""; + +echo "
ΑÎΑΚΥΚΛΩΣΗΣ ΛΙΣΤΕΣ ΜΟΛΥΒΔΟΥ ΕΚΣΤΡΑΤΕΙΑΣ:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNΟÎΟΜΑΟ ΜΟΛΥΒΔΟΣ ΑÎΑΚΥΚΛΩÎΕΙΤΡΟΠΟΠΟΙΗΣΗ
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT status from vicidial_lead_recycle where campaign_id='$campaigns_id_list[$o]' order by status"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if ($p<1) + {echo "NONE";} + echo "MODIFY Ο ΜΟΛΥΒΔΟΣ ΑÎΑΚΥΚΛΩÎΕΙ
\n"; +} + + +###################### +# ADD=36 display all campaign auto-alt dial entries +###################### +if ($ADD==36) +{ +echo "
\n"; + echo ""; + +echo "
ΛΊΣΤΕΣ ΠΙÎΑΚΩΠΜΟΛΥΒΔΟΥ ΑΥΤΌΜΑΤΟΣ-ALT ΕΚΣΤΡΑΤΕΙΑΣ:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNΟÎΟΜΑAUTO-ALT DIALΤΡΟΠΟΠΟΙΗΣΗ
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$campaigns_id_list[$o]';"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if (strlen($row[0])<3) + {echo "NONE";} + echo "MODIFY AUTO-ALT DIAL
\n"; +} + + +###################### +# ADD=37 display all campaign agent pause codes +###################### +if ($ADD==37) +{ +echo "
\n"; + echo ""; + +echo "
ΛΙΣΤΕΣ ΚΩΔΙΚΑ ΜΙΚΡΗΣ ΔΙΑΚΟΠΉΣ ΠΡΑΚΤΟΡΩΠΕΚΣΤΡΑΤΕΙΑΣ:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNΟÎΟΜΑΚΩΔΙΚΕΣ ΜΙΚΡΗΣ ΔΙΑΚΟΠΉΣΤΡΟΠΟΠΟΙΗΣΗ
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT pause_code from vicidial_pause_codes where campaign_id='$campaigns_id_list[$o]' order by pause_code;"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if ($p<1) + {echo "NONE";} + echo "MODIFY ΚΩΔΙΚΕΣ ΜΙΚΡΗΣ ΔΙΑΚΟΠΉΣ
\n"; +} + + +###################### +# ADD=39 display all campaign list mixes +###################### +if ($ADD==39) +{ +echo "
\n"; + echo ""; + +echo "
ΛΙΣΤΕΣ ΜΙΓΜΑΤΩΠΚΑΤΑΛΟΓΩΠΕΚΣΤΡΑΤΕΙΑΣ:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNΟÎΟΜΑLIST MIXΤΡΟΠΟΠΟΙΗΣΗ
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT vcl_id from vicidial_campaigns_list_mix where campaign_id='$campaigns_id_list[$o]' order by status,vcl_id;"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if ($p<1) + {echo "NONE";} + echo "MODIFY LIST MIX
\n"; +} + + + + + +###################### +# ADD=311 modify list info in the system +###################### + +if ($ADD==311) +{ + if ($LOGmodify_lists==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $campaign_id = $row[2]; + $active = $row[3]; + $list_description = $row[4]; + $list_changedate = $row[5]; + $list_lastcalldate = $row[6]; + + # grab names of global statuses and statuses in the selected campaign + $stmt="SELECT * from vicidial_statuses order by status"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + + $o=0; + while ($statuses_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $statuses_list["$rowx[0]"] = "$rowx[1]"; + $o++; + } + + $stmt="SELECT * from vicidial_campaign_statuses where campaign_id='$campaign_id' order by status"; + $rslt=mysql_query($stmt, $link); + $Cstatuses_to_print = mysql_num_rows($rslt); + + $o=0; + while ($Cstatuses_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $statuses_list["$rowx[0]"] = "$rowx[1]"; + $o++; + } + # end grab status names + + + echo "
ΤΡΟΠΟΠΟΙΗΣΗ ΕΓΓΡΑΦΗΣ ΛΙΣΤΑΣ: $row[0]
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
ID Λίστας: $row[0]$NWB#vicidial_lists-list_id$NWE
Ονομα Λίστας: $NWB#vicidial_lists-list_name$NWE
ΠεÏιγÏαφή καταλόγων: $NWB#vicidial_lists-list_description$NWE
ΕκστÏατεία: $NWB#vicidial_lists-campaign_id$NWE
ΕνεÏγή:$NWB#vicidial_lists-active$NWE
ΕΠΑÎΑΦΟΡΑ ΚΑΤΑΣΤΑΣΗΣ ΚΛΗΣΗΣ ΟΔΗΓΟΥ ΓΙΑ ΤΗΠΛΙΣΤΑ: $NWB#vicidial_lists-reset_list$NWE
ΗμεÏομηνία αλλαγής καταλόγων: $list_changedate   $NWB#vicidial_lists-list_changedate$NWE
List Last Call Date: $list_lastcalldate   $NWB#vicidial_lists-list_lastcalldate$NWE
\n"; + + echo "
\n"; + echo "
ΚΑΤΑΣΤΑΣΕΙΣ ΣΤΗΠΛΙΣΤΑ:
\n"; + echo "\n"; + echo "\n"; + + $leads_in_list = 0; + $leads_in_list_N = 0; + $leads_in_list_Y = 0; + $stmt="SELECT status,called_since_last_reset,count(*) from vicidial_list where list_id='$list_id' group by status,called_since_last_reset order by status,called_since_last_reset"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + + $o=0; + $lead_list['count'] = 0; + $lead_list['Y_count'] = 0; + $lead_list['N_count'] = 0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + + $lead_list['count'] = ($lead_list['count'] + $rowx[2]); + if ($rowx[1] == 'N') + { + $since_reset = 'N'; + $since_resetX = 'Y'; + } + else + { + $since_reset = 'Y'; + $since_resetX = 'N'; + } + $lead_list[$since_reset][$rowx[0]] = ($lead_list[$since_reset][$rowx[0]] + $rowx[2]); + $lead_list[$since_reset.'_count'] = ($lead_list[$since_reset.'_count'] + $rowx[2]); + #If opposite side is not set, it may not in the future so give it a value of zero + if (!isset($lead_list[$since_resetX][$rowx[0]])) + { + $lead_list[$since_resetX][$rowx[0]]=0; + } + $o++; + } + + $o=0; + if ($lead_list['count'] > 0) + { + while (list($dispo,) = each($lead_list[$since_reset])) + { + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + if ($dispo == 'CBHOLD') + { + $CLB=""; + $CLE=""; + } + else + { + $CLB=''; + $CLE=''; + } + + echo "\n"; + $o++; + } + } + + echo "\n"; + echo "\n"; + + echo "
ΚΑΤΑΣΤΑΣΗΟÎΟΜΑ ΚΑΤΑΣΤΑΣΗΣΚΛΗΘΕÎΤΑΜΗ ΚΛΗΘΕÎΤΑ
$CLB$dispo$CLE$statuses_list[$dispo]".$lead_list['Y'][$dispo]."".$lead_list['N'][$dispo]."
ΥΠΟΣΥÎΟΛΑ$lead_list[Y_count]$lead_list[N_count]
ΣΥÎΟΛΙΚΑ$lead_list[count]

\n"; + unset($lead_list); + + + echo "
\n"; + echo "
ΖΩÎΕΣ ΩΡΑΣ ΣΤΗΠΛΙΣΤΑ:
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT gmt_offset_now,called_since_last_reset,count(*) from vicidial_list where list_id='$list_id' group by gmt_offset_now,called_since_last_reset order by gmt_offset_now,called_since_last_reset"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + + $o=0; + $plus='+'; + $lead_list['count'] = 0; + $lead_list['Y_count'] = 0; + $lead_list['N_count'] = 0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + + $lead_list['count'] = ($lead_list['count'] + $rowx[2]); + if ($rowx[1] == 'N') + { + $since_reset = 'N'; + $since_resetX = 'Y'; + } + else + { + $since_reset = 'Y'; + $since_resetX = 'N'; + } + $lead_list[$since_reset][$rowx[0]] = ($lead_list[$since_reset][$rowx[0]] + $rowx[2]); + $lead_list[$since_reset.'_count'] = ($lead_list[$since_reset.'_count'] + $rowx[2]); + #If opposite side is not set, it may not in the future so give it a value of zero + if (!isset($lead_list[$since_resetX][$rowx[0]])) + { + $lead_list[$since_resetX][$rowx[0]]=0; + } + $o++; + } + + if ($lead_list['count'] > 0) + { + while (list($tzone,) = each($lead_list[$since_reset])) + { + $LOCALzone=3600 * $tzone; + $LOCALdate=gmdate("D M Y H:i", time() + $LOCALzone); + + if ($tzone >= 0) {$DISPtzone = "$plus$tzone";} + else {$DISPtzone = "$tzone";} + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + } + + echo "\n"; + echo "\n"; + + echo "
GMT OFFSET (τοπικός χÏόνος)ΚΛΗΘΕÎΤΑΜΗ ΚΛΗΘΕÎΤΑ
".$DISPtzone."     ($LOCALdate)".$lead_list['Y'][$tzone]."".$lead_list['N'][$tzone]."
ΥΠΟΣΥÎΟΛΑ$lead_list[Y_count]$lead_list[N_count]
ΣΥÎΟΛΙΚΑ$lead_list[count]

\n"; + unset($lead_list); + + + + $leads_in_list = 0; + $leads_in_list_N = 0; + $leads_in_list_Y = 0; + $stmt="SELECT status,called_count,count(*) from vicidial_list where list_id='$list_id' group by status,called_count order by status,called_count"; + $rslt=mysql_query($stmt, $link); + $status_called_to_print = mysql_num_rows($rslt); + + $o=0; + $sts=0; + $first_row=1; + $all_called_first=1000; + $all_called_last=0; + while ($status_called_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $leads_in_list = ($leads_in_list + $rowx[2]); + $count_statuses[$o] = "$rowx[0]"; + $count_called[$o] = "$rowx[1]"; + $count_count[$o] = "$rowx[2]"; + $all_called_count[$rowx[1]] = ($all_called_count[$rowx[1]] + $rowx[2]); + + if ( (strlen($status[$sts]) < 1) or ($status[$sts] != "$rowx[0]") ) + { + if ($first_row) {$first_row=0;} + else {$sts++;} + $status[$sts] = "$rowx[0]"; + $status_called_first[$sts] = "$rowx[1]"; + if ($status_called_first[$sts] < $all_called_first) {$all_called_first = $status_called_first[$sts];} + } + $leads_in_sts[$sts] = ($leads_in_sts[$sts] + $rowx[2]); + $status_called_last[$sts] = "$rowx[1]"; + if ($status_called_last[$sts] > $all_called_last) {$all_called_last = $status_called_last[$sts];} + + $o++; + } + + + + + echo "
\n"; + echo "
ΜΕΤΡΗΣΗ ΚΛΗΣΕΩΠΣΤΗΠΛΙΣΤΑ:
\n"; + echo "\n"; + echo ""; + $first = $all_called_first; + while ($first <= $all_called_last) + { + if (eregi("1$|3$|5$|7$|9$", $first)) {$AB='bgcolor="#AFEEEE"';} + else{$AB='bgcolor="#E0FFFF"';} + echo ""; + $first++; + } + echo "\n"; + + $sts=0; + $statuses_called_to_print = count($status); + while ($statuses_called_to_print > $sts) + { + $Pstatus = $status[$sts]; + if (eregi("1$|3$|5$|7$|9$", $sts)) + {$bgcolor='bgcolor="#B9CBFD"'; $AB='bgcolor="#9BB9FB"';} + else + {$bgcolor='bgcolor="#9BB9FB"'; $AB='bgcolor="#B9CBFD"';} + # echo "$status[$sts]|$status_called_first[$sts]|$status_called_last[$sts]|$leads_in_sts[$sts]|\n"; + # echo "$status[$sts]|"; + echo ""; + + $first = $all_called_first; + while ($first <= $all_called_last) + { + if (eregi("1$|3$|5$|7$|9$", $sts)) + { + if (eregi("1$|3$|5$|7$|9$", $first)) {$AB='bgcolor="#9BB9FB"';} + else{$AB='bgcolor="#B9CBFD"';} + } + else + { + if (eregi("0$|2$|4$|6$|8$", $first)) {$AB='bgcolor="#9BB9FB"';} + else{$AB='bgcolor="#B9CBFD"';} + } + + $called_printed=0; + $o=0; + while ($status_called_to_print > $o) + { + if ( ($count_statuses[$o] == "$Pstatus") and ($count_called[$o] == "$first") ) + { + $called_printed++; + echo ""; + } + + + $o++; + } + if (!$called_printed) + {echo "";} + $first++; + } + echo "\n\n"; + + $sts++; + } + + echo ""; + $first = $all_called_first; + while ($first <= $all_called_last) + { + if (eregi("1$|3$|5$|7$|9$", $first)) {$AB='bgcolor="#AFEEEE"';} + else{$AB='bgcolor="#E0FFFF"';} + echo ""; + $first++; + } + echo "\n"; + + echo "
ΚΑΤΑΣΤΑΣΗΟÎΟΜΑ ΚΑΤΑΣΤΑΣΗΣ$firstΥΠΟΣΥÎΟΛΟ
$Pstatus$statuses_list[$Pstatus] $count_count[$o]  $leads_in_sts[$sts]
ΣΥÎΟΛΙΚΑ$all_called_count[$first]$leads_in_list

\n"; + + + + + + echo "
\n"; + + echo "

Click here to see all CallBack Holds in this list

\n"; + + if ($LOGdelete_lists > 0) + { + echo "

ΔΙΑΓΡΑΨΕ ΑΥΤΗ ΤΗΠΛΙΣΤΑ\n"; + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + + +###################### +# ADD=3111 modify in-group info in the system +###################### + +if ($ADD==3111) +{ + if ($LOGmodify_ingroups==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_inbound_groups where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $group_name = $row[1]; + $group_color = $row[2]; + $active = $row[3]; + $web_form_address = $row[4]; + $voicemail_ext = $row[5]; + $next_agent_call = $row[6]; + $fronter_display = $row[7]; + $script_id = $row[8]; + $get_call_launch = $row[9]; + $xferconf_a_dtmf = $row[10]; + $xferconf_a_number = $row[11]; + $xferconf_b_dtmf = $row[12]; + $xferconf_b_number = $row[13]; + $drop_call_seconds = $row[14]; + $drop_message = $row[15]; + $drop_exten = $row[16]; + $call_time_id = $row[17]; + $after_hours_action = $row[18]; + $after_hours_message_filename = $row[19]; + $after_hours_exten = $row[20]; + $after_hours_voicemail = $row[21]; + $welcome_message_filename = $row[22]; + $moh_context = $row[23]; + $onhold_prompt_filename = $row[24]; + $prompt_interval = $row[25]; + $agent_alert_exten = $row[26]; + $agent_alert_delay = $row[27]; + $default_xfer_group = $row[28]; + + ##### get in-groups listings for dynamic pulldown + $stmt="SELECT group_id,group_name from vicidial_inbound_groups order by group_id"; + $rslt=mysql_query($stmt, $link); + $Xgroups_to_print = mysql_num_rows($rslt); + $Xgroups_menu=''; + $Xgroups_selected=0; + $o=0; + while ($Xgroups_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $Xgroups_menu .= "\n"; + $o++; + } + if ($Xgroups_selected < 1) + {$Xgroups_menu .= "\n";} + else + {$Xgroups_menu .= "\n";} + + + echo "
ΤΡΟΠΟΠΟΙΗΣΗ ΕΓΓΡΑΦΗΣ ΟΜΑΔΩÎ: $row[0]\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + echo "
ID Ομάδας: $row[0]$NWB#vicidial_inbound_groups-group_id$NWE
Ονομα Ομάδας: $NWB#vicidial_inbound_groups-group_name$NWE
ΧÏώμα Ομάδας: $NWB#vicidial_inbound_groups-group_color$NWE
ΕνεÏγή:$NWB#vicidial_inbound_groups-active$NWE
Ιστο-σελίδα: $NWB#vicidial_inbound_groups-web_form_address$NWE
Επόμενη Κλήση ΧειÏιστή: $NWB#vicidial_inbound_groups-next_agent_call$NWE
ΜπÏοστινή Οθόνη: $NWB#vicidial_inbound_groups-fronter_display$NWE
Script: $NWB#vicidial_inbound_groups-ingroup_script$NWE
Κατά την έναÏξη κλήσης: $NWB#vicidial_inbound_groups-get_call_launch$NWE
DTMF ΜεταφοÏάς-Συνδ 1: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
ΑÏιθμός ΜεταφοÏάς-Συνδ 1: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
DTMF ΜεταφοÏάς-Συνδ 2: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
ΑÏιθμός ΜεταφοÏάς-Συνδ 2: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
ΔευτεÏ. Εγκαταλ. Κλήσης: $NWB#vicidial_inbound_groups-drop_call_seconds$NWE
ΦΩÎΗΤΙΚΟ ΤΑΧΥΔΡΟΜΕΙΟ: $NWB#vicidial_inbound_groups-voicemail_ext$NWE
ΧÏήση μηνÏματος Εγκατάλειψης: $NWB#vicidial_inbound_groups-drop_message$NWE
Εσωτ. ΣÏνδεση Εγκατάλειψης: $NWB#vicidial_inbound_groups-drop_exten$NWE
ΧÏόνος κλήσης:$NWB#vicidial_inbound_groups-call_time_id$NWE
Μετά από τη δÏάση ωÏών:$NWB#vicidial_inbound_groups-after_hours_action$NWE
Μετά από το όνομα αÏχείου μηνυμάτων ωÏών:$NWB#vicidial_inbound_groups-after_hours_message_filename$NWE
Μετά από την παÏάταση ωÏών:$NWB#vicidial_inbound_groups-after_hours_exten$NWE
Μετά από το φωνητικό ταχυδÏομείο ωÏών:$NWB#vicidial_inbound_groups-after_hours_voicemail$NWE
ΕυπÏόσδεκτο όνομα αÏχείου μηνυμάτων:$NWB#vicidial_inbound_groups-welcome_message_filename$NWE
Μουσική στο πλαίσιο λαβής:$NWB#vicidial_inbound_groups-moh_context$NWE
Στο γÏήγοÏο όνομα αÏχείου λαβής:$NWB#vicidial_inbound_groups-onhold_prompt_filename$NWE
Στο γÏήγοÏο διάστημα λαβής:$NWB#vicidial_inbound_groups-prompt_interval$NWE
ΑγÏυπνη επέκταση Ï€ÏακτόÏων:$NWB#vicidial_inbound_groups-agent_alert_exten$NWE
ΑγÏυπνη καθυστέÏηση Ï€ÏακτόÏων:$NWB#vicidial_inbound_groups-agent_alert_delay$NWE
Ομάδα μεταφοÏάς Ï€Ïοεπιλογής:$NWB#vicidial_inbound_groups-default_xfer_group$NWE
\n"; + + ### list of agent rank or skill-level for this inbound group + echo "
\n"; + echo "
ΧΕΙΡΙΣΤΗΣRANKS FOR THIS INBOUND GROUP:
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT user,group_rank,calls_today from vicidial_inbound_group_agents where group_id='$group_id'"; + $rsltx=mysql_query($stmt, $link); + $users_to_print = mysql_num_rows($rsltx); + + $o=0; + while ($users_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + + echo "
USER     RANK     CALLS TODAY
$rowx[0]$rowx[1]$rowx[2]

\n"; + + echo "

\n"; + + echo "Click here to see a report for this inbound group

\n"; + + echo "
\n"; + + if ($LOGdelete_ingroups > 0) + { + echo "

EMERGENCY VDAC CLEAR FOR THIS IN-GROUP

\n"; + echo "

ΔΙΑΓΡΑΨΕ ΑΥΤΗΠΤΗΠΕΙΣ-ΟΜΑΔΑ\n"; + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + + +###################### +# ADD=31111 modify remote agents info in the system +###################### + +if ($ADD==31111) +{ + if ($LOGmodify_remoteagents==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + + echo "
ΤΡΟΠΟΠΟΙΗΣΗ ΚΑΤΑΧΩΡΗΣΗΣ ΑΠΟΜΑΚΡΥΣΜΕÎΩΠΧΕΙΡΙΣΤΩÎ: $row[0]\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
ID ΧÏήστη Ξεκινά: (μόνο αÏιθμοί, incremented)$NWB#vicidial_remote_agents-user_start$NWE
ΑÏιθμός ΓÏαμμών: (μόνο αÏιθμοί)$NWB#vicidial_remote_agents-number_of_lines$NWE
IP Διακομιστή: $NWB#vicidial_remote_agents-server_ip$NWE
ΕξωτεÏική Τηλ. ΣÏνδεση: (ο αÏιθμός που κλήθηκε από το πλάνο κλήσεων για να καλέσει τους χειÏιστές)$NWB#vicidial_remote_agents-conf_exten$NWE
Κατάσταση:$NWB#vicidial_remote_agents-status$NWE
ΕκστÏατεία: $NWB#vicidial_remote_agents-campaign_id$NWE
ΕισεÏχόμενες Ομάδες: \n"; + echo "$groups_list"; + echo "$NWB#vicidial_remote_agents-closer_campaigns$NWE
\n"; + echo "ΣΗΜΕΙΩΣΗ: ΜποÏεί να διαÏκέσει και 30 δευτεÏόλεπτα για να καταχωÏηθοÏν οι αλλαγές της οθόνης\n"; + + + if ($LOGdelete_remote_agents > 0) + { + echo "

ΔΙΑΓΡΑΨΕ ΑΥΤΟΠΤΟΠΑΠΟΜΑΚΡΥΣΜΕÎΟ ΧΕΙΡΙΣΤΗ\n"; + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + +###################### +# ADD=311111 modify user group info in the system +###################### + +if ($ADD==311111) +{ + if ($LOGmodify_usergroups==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_user_groups where user_group='$user_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $user_group = $row[0]; + $group_name = $row[1]; + echo ""; + + echo "
ΤΡΟΠΟΠΟΙΗΣΗ ΚΑΤΑΧΩΡΗΣΗΣ ΟΜΑΔΑΣ ΧΡΗΣΤΩÎ\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Ομάδα: (όχι κενά ή στίξη)$NWB#vicidial_user_groups-user_group$NWE
ΠεÏιγÏαφή: (πεÏιγÏαφή ομάδας)$NWB#vicidial_user_groups-group_name$NWE
ΕπιτÏεπόμενες ΕκστÏατείες: \n"; + echo "$campaigns_list"; + echo "$NWB#vicidial_user_groups-allowed_campaigns$NWE
\n"; + + + ### list of users in this user group + + $active_confs = 0; + $stmt="SELECT user,full_name,user_level from vicidial_users where user_group='$user_group'"; + $rsltx=mysql_query($stmt, $link); + $users_to_print = mysql_num_rows($rsltx); + + echo "
\n"; + echo "
ΧΡΗΣΤΕΣ ΜΕΣΑ ΣΕ ΑΥΤΗΠΤΗΠΟΜΑΔΑ ΧΡΗΣΤΩΠ: $users_to_print
\n"; + echo "\n"; + echo "\n"; + + $o=0; + while ($users_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
USERFULL NAMELEVEL
$rowx[0]$rowx[1]$rowx[2]

\n"; + + + + echo "

Click here to see all CallBack Holds in this user group

\n"; + + if ($LOGdelete_user_groups > 0) + { + echo "

ΔΙΑΓΡΑΨΕ ΑΥΤΗΠΤΗΠΟΜΑΔΑ ΧΡΗΣΤΩÎ\n"; + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + +###################### +# ADD=3111111 modify script info in the system +###################### + +if ($ADD==3111111) +{ + if ($LOGmodify_scripts==1) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_scripts where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $script_name = $row[1]; + $script_comments = $row[2]; + $script_text = $row[3]; + $active = $row[4]; + echo ""; + + echo "
ΤΡΟΠΟΠΟΙΗΣΤΕ ΕÎΑΠΒΟΗΘΟ\n"; + echo "\n"; + echo "\n"; + echo "
Ταυτότητα χειÏογÏάφων:: $script_id$NWB#vicidial_scripts-script_name$NWE
Όνομα χειÏογÏάφων: (τίτλος του βοηθοÏ)$NWB#vicidial_scripts-script_name$NWE
Σχόλια χειÏόγÏαφου: $NWB#vicidial_scripts-script_comments$NWE
ΕνεÏγή:$NWB#vicidial_scripts-active$NWE
Κείμενο χειÏόγÏαφου:

ΠÏοεπισκόπιση ΒοηθοÏ
"; + # BEGIN Insert Field + echo ""; + echo "
"; + # END Insert Field + echo " $NWB#vicidial_scripts-script_text$NWE
\n"; + + if ($LOGdelete_scripts > 0) + { + echo "

ΔΙΑΓΡΑΨΕ ΑΥΤΟΠΤΟΠΒΟΗΘΟ\n"; + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + +###################### +# ADD=31111111 modify filter info in the system +###################### + +if ($ADD==31111111) +{ + if ($LOGmodify_filters==1) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_lead_filters where lead_filter_id='$lead_filter_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $lead_filter_name = $row[1]; + $lead_filter_comments = $row[2]; + $lead_filter_sql = $row[3]; + echo ""; + + echo "
ΤΡΟΠΟΠΟΙΗΣΗ ΕÎΟΣ ΦΙΛΤΡΟΥ\n"; + echo "\n"; + echo "\n"; + echo "
ID ΦίλτÏου: $lead_filter_id$NWB#vicidial_lead_filters-lead_filter_id$NWE
Όνομα ΦίλτÏου: (σÏντομη πεÏιγÏαφή του φίλτÏου)$NWB#vicidial_lead_filters-lead_filter_name$NWE
Σχόλια ΦίλτÏου: $NWB#vicidial_lead_filters-lead_filter_comments$NWE
SQL ΦίλτÏου: $NWB#vicidial_lead_filters-lead_filter_sql$NWE
\n"; + + ##### get campaigns listing for dynamic pulldown + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + $campaigns_list=''; + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $campaigns_list .= "\n"; + $o++; + } + + echo "

"; + echo "
ΕΛΕΓΧΟΣ ΣΤΗΠΕΚΣΤΡΑΤΕΙΑ:
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + if ($LOGdelete_filters > 0) + { + echo "

ΔΙΑΓΡΑΦΗ ΤΟΥ ΦΙΛΤΡΟΥ\n"; + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + +###################### +# ADD=321111111 modify call time definition info in the system +###################### + +if ($ADD==321111111) +{ +if ($LOGmodify_call_times==1) +{ + +if ( ($stage=="ADD") and (strlen($state_rule)>0) ) + { + $stmt="SELECT ct_state_call_times from vicidial_call_times where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $ct_state_call_times = $row[0]; + + if (eregi("\|$",$ct_state_call_times)) + {$ct_state_call_times = "$ct_state_call_times$state_rule\|";} + else + {$ct_state_call_times = "$ct_state_call_times\|$state_rule\|";} + $stmt="UPDATE vicidial_call_times set ct_state_call_times='$ct_state_call_times' where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + echo "ΠÏοσθήκη Κανόνα Κατάστασης: $state_rule
\n"; + } +if ( ($stage=="REMOVE") and (strlen($state_rule)>0) ) + { + $stmt="SELECT ct_state_call_times from vicidial_call_times where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $ct_state_call_times = $row[0]; + + $ct_state_call_times = eregi_replace("\|$state_rule\|",'|',$ct_state_call_times); + $stmt="UPDATE vicidial_call_times set ct_state_call_times='$ct_state_call_times' where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + echo "ΑπομάκÏυνση Κανόνα Κατάστασης: $state_rule
\n"; + } + +$ADD=311111111; +} +else +{ +echo "Δεν έχετε το δικαίωμα για να δείτε την σελίδα. ΠαÏακαλώ επιστÏέψτε."; +} + +} + + +###################### +# ADD=311111111 modify call time definition info in the system +###################### + +if ($ADD==311111111) +{ + +if ($LOGmodify_call_times==1) +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +$ct_srs=1; +$b=0; +$srs_SQL =''; +if (strlen($ct_state_call_times)>2) + { + $state_rules = explode('|',$ct_state_call_times); + $ct_srs = ((count($state_rules)) - 1); + } +echo "\n"; +echo "\n"; +while($ct_srs >= $b) + { + if (strlen($state_rules[$b])>0) + { + $stmt="SELECT state_call_time_state,state_call_time_name from vicidial_state_call_times where state_call_time_id='$state_rules[$b]';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + echo "\n"; + $srs_SQL .= "'$state_rules[$b]',"; + $srs_state_SQL .= "'$row[0]',"; + } + $b++; + } +if (strlen($srs_SQL)>2) + { + $srs_SQL = "$srs_SQL''"; + $srs_state_SQL = "$srs_state_SQL''"; + $srs_SQL = "where state_call_time_id NOT IN($srs_SQL) and state_call_time_state NOT IN($srs_state_SQL)"; + } +else + {$srs_SQL='';} +$stmt="SELECT state_call_time_id,state_call_time_name from vicidial_state_call_times $srs_SQL order by state_call_time_id;"; +$rslt=mysql_query($stmt, $link); +$sct_to_print = mysql_num_rows($rslt); +$sct_list=''; + +$o=0; +while ($sct_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $sct_list .= "\n"; + $o++; +} +echo "\n"; +echo "\n"; + +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_call_times where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $call_time_name = $row[1]; + $call_time_comments = $row[2]; + $ct_default_start = $row[3]; + $ct_default_stop = $row[4]; + $ct_sunday_start = $row[5]; + $ct_sunday_stop = $row[6]; + $ct_monday_start = $row[7]; + $ct_monday_stop = $row[8]; + $ct_tuesday_start = $row[9]; + $ct_tuesday_stop = $row[10]; + $ct_wednesday_start = $row[11]; + $ct_wednesday_stop = $row[12]; + $ct_thursday_start = $row[13]; + $ct_thursday_stop = $row[14]; + $ct_friday_start = $row[15]; + $ct_friday_stop = $row[16]; + $ct_saturday_start = $row[17]; + $ct_saturday_stop = $row[18]; + $ct_state_call_times = $row[19]; + +echo ""; + +echo "
ΤΡΟΠΟΠΟΙΗΣΗ ΧΡΟÎΟΥ ΚΛΗΣΗΣ\n"; +echo "\n"; +echo "\n"; +echo "
ID ΧÏόνου Κλήσης: $call_time_id$NWB#vicidial_call_times-call_time_id$NWE
Ονομα ΧÏόνου Κλήσης: (σÏντομη πεÏιγÏαφή του χÏόνου κλήσης)$NWB#vicidial_call_times-call_time_name$NWE
Σχόλια ΧÏόνου Κλήσης: $NWB#vicidial_call_times-call_time_comments$NWE
ΠÏοκαθοÏσμένη Εκκίνηση ΠÏοκαθοÏσμένη ΠαÏση: $NWB#vicidial_call_times-ct_default_start$NWE
ΚυÏιακή Εκκίνηση: ΚυÏιακή ΠαÏση: $NWB#vicidial_call_times-ct_sunday_start$NWE
ΔευτέÏα Εκκίνηση: ΔευτέÏα ΠαÏση: $NWB#vicidial_call_times-ct_sunday_start$NWE
ΤÏίτη Εκκίνηση: ΤÏίτη ΠαÏση: $NWB#vicidial_call_times-ct_sunday_start$NWE
Wednesday Start: ΤετάÏτη ΠαÏση: $NWB#vicidial_call_times-ct_sunday_start$NWE
Πέμπτη Εκκίνηση: Πέμπτη ΠαÏση: $NWB#vicidial_call_times-ct_sunday_start$NWE
ΠαÏασκευή Εκκίνηση: ΠαÏασκευή ΠαÏση: $NWB#vicidial_call_times-ct_sunday_start$NWE
Σάββατο Εκκίνηση: Σάββατο ΠαÏση: $NWB#vicidial_call_times-ct_sunday_start$NWE
ΕνεÏγοί ΟÏισμοί ΧÏόνου Κλήσης Κατάστασης για αυτή την ΕγγÏαφή:  
$state_rules[$b] - REMOVE $row[0] - $row[1]
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "Add state call time rule:


\n"; +echo "ΕΚΣΤΑΤΕΙΕΣ ΠΟΥ ΧΡΗΣΙΜΟΠΟΙΟΥΠΑΥΤΟ ΤΟΠΧΡΟÎΟ ΚΛΗΣΗΣ:
\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns where local_call_time='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + $o=0; + while ($camps_to_print > $o) { + $row=mysql_fetch_row($rslt); + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]
\n"; +echo "INBOUND GROUPS USING THIS CALL TIME:
\n"; +echo "\n"; + + $stmt="SELECT group_id,group_name from vicidial_inbound_groups where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + $o=0; + while ($camps_to_print > $o) { + $row=mysql_fetch_row($rslt); + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]
\n"; +echo "

\n"; + +if ($LOGdelete_call_times > 0) + { + echo "

ΔΙΑΓΡΑΦΗ ΟΡΙΣΜΟΥ ΧΡΟÎΟΥ ΚΛΗΣΗΣ\n"; + } +} +else +{ +echo "Δεν έχετε το δικαίωμα για να δείτε την σελίδα. ΠαÏακαλώ επιστÏέψτε."; +} + +} + + +###################### +# ADD=3111111111 modify state call time definition info in the system +###################### + +if ($ADD==3111111111) +{ + +if ($LOGmodify_call_times==1) +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_state_call_times where state_call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $state_call_time_state =$row[1]; + $call_time_name = $row[2]; + $call_time_comments = $row[3]; + $ct_default_start = $row[4]; + $ct_default_stop = $row[5]; + $ct_sunday_start = $row[6]; + $ct_sunday_stop = $row[7]; + $ct_monday_start = $row[8]; + $ct_monday_stop = $row[9]; + $ct_tuesday_start = $row[10]; + $ct_tuesday_stop = $row[11]; + $ct_wednesday_start = $row[12]; + $ct_wednesday_stop = $row[13]; + $ct_thursday_start = $row[14]; + $ct_thursday_stop = $row[15]; + $ct_friday_start = $row[16]; + $ct_friday_stop = $row[17]; + $ct_saturday_start = $row[18]; + $ct_saturday_stop = $row[19]; + +echo ""; + +echo "
ΤΡΟΠΟΠΟΙΗΣΗ ΧΡΟÎΟΥ ΚΛΗΣΗΣ ΚΑΤΑΣΤΑΣΗΣ
\n"; +echo "\n"; +echo "\n"; +echo "
ID ΧÏόνου Κλήσης: $call_time_id$NWB#vicidial_call_times-call_time_id$NWE
State Call Time State: $NWB#vicidial_call_times-state_call_time_state$NWE
Ονομα ΧÏόνου Κλήσης Κατάτασης: (σÏντομη πεÏιγÏαφή του χÏόνου κλήσης)$NWB#vicidial_call_times-call_time_name$NWE
Σχόλια ΧÏόνου Κλήσης Κατάστασης: $NWB#vicidial_call_times-call_time_comments$NWE
ΠÏοκαθοÏσμένη Εκκίνηση ΠÏοκαθοÏσμένη ΠαÏση: $NWB#vicidial_call_times-ct_default_start$NWE
ΚυÏιακή Εκκίνηση: ΚυÏιακή ΠαÏση: $NWB#vicidial_call_times-ct_sunday_start$NWE
ΔευτέÏα Εκκίνηση: ΔευτέÏα ΠαÏση: $NWB#vicidial_call_times-ct_sunday_start$NWE
ΤÏίτη Εκκίνηση: ΤÏίτη ΠαÏση: $NWB#vicidial_call_times-ct_sunday_start$NWE
Wednesday Start: ΤετάÏτη ΠαÏση: $NWB#vicidial_call_times-ct_sunday_start$NWE
Πέμπτη Εκκίνηση: Πέμπτη ΠαÏση: $NWB#vicidial_call_times-ct_sunday_start$NWE
ΠαÏασκευή Εκκίνηση: ΠαÏασκευή ΠαÏση: $NWB#vicidial_call_times-ct_sunday_start$NWE
Σάββατο Εκκίνηση: Σάββατο ΠαÏση: $NWB#vicidial_call_times-ct_sunday_start$NWE


\n"; +echo "ΧΡΟÎΟΙ ΚΛΗΣΕΩΠΠΟΥ ΧΡΗΣΙΜΟΠΟΙΟΥΠΑΥΤΟ ΤΟΠΧΡΟÎΟ ΚΛΗΣΗΣ ΚΑΤΑΣΤΑΣΗΣ:
\n"; +echo "\n"; + + $stmt="SELECT call_time_id,call_time_name from vicidial_call_times where ct_state_call_times LIKE \"%|$call_time_id|%\";"; + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + $o=0; + while ($camps_to_print > $o) { + $row=mysql_fetch_row($rslt); + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]
\n"; +echo "

\n"; + +if ($LOGdelete_call_times > 0) + { + echo "

ΔΙΑΓΡΑΦΗ ΟΡΙΣΜΟΥ ΧΡΟÎΟΥ ΚΛΗΣΗΣ ΚΑΤΑΣΤΑΣΗΣ\n"; + } + +} +else +{ +echo "Δεν έχετε το δικαίωμα για να δείτε την σελίδα. ΠαÏακαλώ επιστÏέψτε."; +} + +} + + +###################### +# ADD=31111111111 modify phone record in the system +###################### + +if ($ADD==31111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + echo "
ΤΡΟΠΟΠΟΙΗΣΗ ΕΓΓΡΑΦΗΣ ΤΗΛΕΦΩÎΟΥ: $row[1]\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Τηλ.σÏνδεσης τηλεφώνου: $NWB#phones-extension$NWE
ΑÏιθμός Σχεδίου Κλήσεων: (μόνο αÏιθμοί)$NWB#phones-dialplan_number$NWE
ΠεÏιεχόμενο Î¦Ï‰Î½Î·Ï„Î¹ÎºÎ¿Ï Î¤Î±Ï‡Ï…Î´Ïομείου: (μόνο αÏιθμοί)$NWB#phones-voicemail_id$NWE
ΕξεÏχόμενο CallerID: (μόνο αÏιθμοί)$NWB#phones-outbound_cid$NWE
Δνση IP Τηλεφώνου: (optional)$NWB#phones-phone_ip$NWE
Δνση IP Υπολογιστή: (optional)$NWB#phones-computer_ip$NWE
IP Διακομιστή: $NWB#phones-server_ip$NWE
ΣÏνδεση:$NWB#phones-login$NWE
Κωδικός:$NWB#phones-pass$NWE
Κατάσταση:$NWB#phones-status$NWE
ΕνεÏγός ΛογαÏιασμός: $NWB#phones-active$NWE
ΤÏπος τηλεφώνου: $NWB#phones-phone_type$NWE
ΠλήÏες Ονομα: $NWB#phones-fullname$NWE
ΕταιÏία:$NWB#phones-company$NWE
Εικόνα:$NWB#phones-picture$NWE
Îέα ΜηνÏματα: $row[14]$NWB#phones-messages$NWE
Παλαιά ΜηνÏματα: $row[15]$NWB#phones-old_messages$NWE
ΠÏοτόκολο Πελάτη: $NWB#phones-protocol$NWE
Τοπικό GMT: (Μην Ïυθμίσεις για DST)$NWB#phones-local_gmt$NWE
ΔιαχειÏιστή ΣÏνδεση: $NWB#phones-ASTmgrUSERNAME$NWE
Κωδικός ΔιαχειÏιστή: $NWB#phones-ASTmgrSECRET$NWE
VICIDIAL ΠÏοκαθοÏισμένος ΧÏήστης: $NWB#phones-login_user$NWE
VICIDIAL ΠÏοκαθοÏισμένος Κωδικός: $NWB#phones-login_pass$NWE
VICIDIAL ΠÏοκαθοÏισμένη εκστÏατεία: $NWB#phones-login_campaign$NWE
Τηλ.σÏνδ. Στάθμευσης: $NWB#phones-park_on_extension$NWE
Τηλ.σÏνδ. Συνδ.: $NWB#phones-conf_on_extension$NWE
VICIDIAL Τηλ.σÏνδ. Στάθμευσης: $NWB#phones-VICIDIAL_park_on_extension$NWE
VICIDIAL ΑÏχείο Στάθμευσης: $NWB#phones-VICIDIAL_park_on_filename$NWE
ΠÏόθεμα ΠαÏακολοÏθησης: $NWB#phones-monitor_prefix$NWE
ΗχογÏάφηση εσωτ.σÏνδ.: $NWB#phones-recording_exten$NWE
VMailMain Τηλ.σÏνδ.: $NWB#phones-voicemail_exten$NWE
VMailDump Τηλ.σÏνδ.: $NWB#phones-voicemail_dump_exten$NWE
ΠεÏιεχόμενο Τηλ.σÏνδ: $NWB#phones-ext_context$NWE
DTMFSend Κανάλι: $NWB#phones-dtmf_send_extension$NWE
Ομάδα ΕξεÏχομένων Κλήσεων: $NWB#phones-call_out_number_group$NWE
Θέση ΦυλλομετÏητή: $NWB#phones-client_browser$NWE
Κατάλογος εγκατάστασης: $NWB#phones-install_directory$NWE
CallerID URL: $NWB#phones-local_web_callerID_URL$NWE
VICIDIAL ΠÏοκαθοÏισμένο URL: $NWB#phones-VICIDIAL_web_URL$NWE
ΚαταγÏαφή Γεγονότος Κλήσης: $NWB#phones-AGI_call_logging_enabled$NWE
Μεταγωγή ΧÏήστη: $NWB#phones-user_switching_enabled$NWE
Σε συνδιαλέξη: $NWB#phones-conferencing_enabled$NWE
ΔιαχειÏÎ¹ÏƒÏ„Î¿Ï ÎšÎ»ÎµÎ¯ÏƒÎ¹Î¼Î¿: $NWB#phones-admin_hangup_enabled$NWE
ΔιαχειÏÎ¹ÏƒÏ„Î¿Ï ÎšÎ»Î­ÏˆÎ¹Î¼Î¿: $NWB#phones-admin_hijack_enabled$NWE
ΔιαχειÏÎ¹ÏƒÏ„Î¿Ï Î Î±ÏακολοÏθηση: $NWB#phones-admin_monitor_enabled$NWE
Στάθμευση Κλήσης: $NWB#phones-call_parking_enabled$NWE
Ελεγχος ενημεÏωτή: $NWB#phones-updater_check_enabled$NWE
AF ΚαταγÏαφή Γεγονότος: $NWB#phones-AFLogging_enabled$NWE
ΕνεÏγή ΟυÏά: $NWB#phones-QUEUE_ACTION_enabled$NWE
ΥπεÏεμφανιζόμενο παÏαθÏÏο CallerID: $NWB#phones-CallerID_popup_enabled$NWE
ΠλήκτÏο VMail: $NWB#phones-voicemail_button_enabled$NWE
ΤαχÏτητα Ανανέωσης: $NWB#phones-enable_fast_refresh$NWE
Ρυθμός Ανανέωσης ΤαχÏτητας: (in ms)$NWB#phones-fast_refresh_rate$NWE
Συνεχής MySQL: $NWB#phones-enable_persistant_mysql$NWE
Αυτόματη Κλήση Επόμενου ΑÏιθμοÏ: $NWB#phones-auto_dial_next_number$NWE
Σταμάτα την ηχογÏάφηση μετά από κάθε κλήση: $NWB#phones-VDstop_rec_after_each_call$NWE
ΕπιτÏέψτε τα μηνÏματα SIPSAK: $NWB#phones-enable_sipsak_messages$NWE
DBX Διακομιστής: (ΠÏωταÏχικό DB Server)$NWB#phones-DBX_server$NWE
DBX Βάση Δεδομένων: (ΠÏωταÏχικό Server Database)$NWB#phones-DBX_database$NWE
DBX ΧÏήστης: (ΠÏωταÏχικό DB Login)$NWB#phones-DBX_user$NWE
DBX Κωδικός: (ΠÏωταÏχικό DB Secret)$NWB#phones-DBX_pass$NWE
DBX ΠόÏτα: (ΠÏωταÏχικό DB Port)$NWB#phones-DBX_port$NWE
DBY Διακομιστής: (ΔευτεÏεÏονDB Server)$NWB#phones-DBY_server$NWE
DBY Βάση Δεδομένων: (ΔευτεÏεÏονServer Database)$NWB#phones-DBY_database$NWE
DBY ΧÏήστης: (ΔευτεÏεÏονDB Login)$NWB#phones-DBY_user$NWE
DBY Κωδικός: (ΔευτεÏεÏονDB Secret)$NWB#phones-DBY_pass$NWE
DBY ΠόÏτα: (ΔευτεÏεÏονDB Port)$NWB#phones-DBY_port$NWE
\n"; + + echo "

Επιλέξτε εδώ για στατιστικά τηλεφώνου\n"; + + if ($LOGast_delete_phones > 0) + { + echo "

ΔΙΑΓΡΑΨΕ ΑΥΤΟ ΤΟ ΤΗΛΕΦΩÎΟ\n"; + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + +###################### +# ADD=311111111111 modify server record in the system +###################### + +if ($ADD==311111111111) +{ + if ($LOGmodify_servers==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from servers where server_id='$server_id' or server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $server_id = $row[0]; + $server_ip = $row[2]; + + echo "
ΤΡΟΠΟΠΟΙΗΣΗ ΕΓΓΡΑΦΗΣ ΔΙΑΚΟΜΙΣΤΗ: $row[0]\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
ID Διακομιστή: $NWB#servers-server_id$NWE
ΠεÏιγÏαφή Διακομιστή: $NWB#servers-server_description$NWE
Δνση IP Διακομιστή: $NWB#servers-server_ip$NWE
ΕνεÏγή:$NWB#servers-active$NWE
Εκδοση Asterisk: $NWB#servers-asterisk_version$NWE
Μέγιστος ΑÏιθμός Trunk: $NWB#servers-max_vicidial_trunks$NWE
ΔιακÏμανση Τηλεφωνικής Κλήσης: $NWB#servers-vicidial_balance_active$NWE
ΔιακÏμανση εκτός οÏίων: $NWB#servers-balance_trunks_offlimits$NWE
Λήπτης Telnet: $NWB#servers-telnet_host$NWE
ΠόÏτα Telnet: $NWB#servers-telnet_port$NWE
ΧÏήστη ΔιαχειÏιστή: $NWB#servers-ASTmgrUSERNAME$NWE
Κωδικός ΔιαχειÏιστή: $NWB#servers-ASTmgrSECRET$NWE
ΕνημέÏωση ΧÏήστη ΔιαχειÏιστή: $NWB#servers-ASTmgrUSERNAMEupdate$NWE
ΠαÏακολοÏθηση ΧÏήστη ΔιαχειÏιστή: $NWB#servers-ASTmgrUSERNAMElisten$NWE
Αποστολή ΧÏήστη ΔιαχειÏιστή: $NWB#servers-ASTmgrUSERNAMEsend$NWE
Τοπικό GMT: (Μην Ïυθμίσεις για DST)$NWB#servers-local_gmt$NWE
VMail εσωτ.σÏνδεση απόÏÏιψης: $NWB#servers-voicemail_dump_exten$NWE
AD εσωτ.σÏνδεση: $NWB#servers-answer_transfer_agent$NWE
ΠÏοκαθοÏισμένο ΠεÏιεχόμενο: $NWB#servers-ext_context$NWE
Επίδοση Συστήματος +: $NWB#servers-sys_perf_log$NWE
Γεγονότα Διακομιστή +: $NWB#servers-vd_server_logs$NWE
Εξοδος AGI +: $NWB#servers-agi_output$NWE
\n"; + + + ### vicidial server trunk records for this server + echo "

ΚΟΡΜΟΙ ΓΙΑ ΤΟΠΕΞΥΠΗΡΕΤΗΤΗ:   $NWB#vicidial_server_trunks$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_server_trunks where server_ip='$server_ip' order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $recycle_to_print = mysql_num_rows($rslt); + $o=0; + while ($recycle_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
ΕΚΣΤΡΑΤΕΙΑ ΚΟΡΜΟΙ ΠΕΡΙΟΡΙΣΜΟΣ DELETE
$rowx[1]
\n"; + echo "\n"; + echo "\n"; + echo "
ΔΙΑΓΡΑΦΗ
\n"; + + echo "
ΠΡΟΣΘΗΚΗ ΕΓΓΡΑΦΗΣ ΕΞΥΠΗΡΕΤΗΤΗ ΚΟΣΡΜΟΥ
\n"; + echo "\n"; + echo "\n"; + echo "TRUNKS:
\n"; + echo "ΕΚΣΤΡΑΤΕΙΑ:
\n"; + echo "RESTRICTION:
\n"; + echo "
\n"; + + echo "

\n"; + + + ### list of phones on this server + echo "
\n"; + echo "
ΤΗΛΕΦΩÎΑ ΣΤΟΠΔΙΑΚΟΜΙΣΤΗ:
\n"; + echo "\n"; + echo "\n"; + + $active_phones = 0; + $inactive_phones = 0; + $stmt="SELECT extension,active,fullname from phones where server_ip='$row[2]'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + if (ereg("Y", $rowx[1])) {$active_phones++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_phones++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + + echo "
ΤΗΛ.ΣΥÎΔΕΣΗΟÎΟΜΑΕÎΕΡΓΟ
$rowx[0]$rowx[2]$rowx[1]

\n"; + + + ### list of conferences on this server + echo "
\n"; + echo "
CONFERENCES WITHIN THIS SERVER:
\n"; + echo "\n"; + echo "\n"; + + $active_confs = 0; + $stmt="SELECT conf_exten,extension from conferences where server_ip='$row[2]'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + $active_confs++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + + echo "
CONFERENCEΤΗΛ.ΣΥÎΔΕΣΗ
$rowx[0]$rowx[2]

\n"; + + + ### list of vicidial conferences on this server + echo "
\n"; + echo "
VICIDIAL CONFERENCES WITHIN THIS SERVER:
\n"; + echo "\n"; + echo "\n"; + + $active_vdconfs = 0; + $stmt="SELECT conf_exten,extension from vicidial_conferences where server_ip='$row[2]'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + $active_vdconfs++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + + echo "
VD CONFERENCEΤΗΛ.ΣΥÎΔΕΣΗ
$rowx[0]$rowx[2]

\n"; + + + echo "
\n"; + + $camp_lists = eregi_replace(".$","",$camp_lists); + echo "Αυτός ο διακομιστής έχει $active_phones ενεÏγά τηλέφωνα και $inactive_phones μη ενεÏγά τηλέφωνα

\n"; + echo "Αυτός ο διακομιστής έχει $active_confs active conferences

\n"; + echo "Αυτός ο διακομιστής έχει $active_vdconfs active vicidial conferences

\n"; + echo "
\n"; + if ($LOGast_delete_phones > 0) + { + echo "

DELETE THIS SERVER\n"; + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + +###################### +# ADD=3111111111111 modify conference record in the system +###################### + +if ($ADD==3111111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $conf_exten = $row[0]; + $server_ip = $row[1]; + + echo "
ΤΡΟΠΟΠΟΙΗΣΗ ΕΓΓΡΑΦΗΣ ΣΥÎΔΙΑΛΕΞΗΣ: $row[0]
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Συνδιάλεξη:$NWB#conferences-conf_exten$NWE
IP Διακομιστή: $NWB#conferences-server_ip$NWE
ΙσχÏουσα εσωτ.σÏνδεση:
\n"; + + echo "
\n"; + if ($LOGast_delete_phones > 0) + { + echo "

DELETE THIS CONFERENCE\n"; + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + +###################### +# ADD=31111111111111 modify vicidial conference record in the system +###################### + +if ($ADD==31111111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $conf_exten = $row[0]; + $server_ip = $row[1]; + + echo "
MODIFY A VICIDIAL CONFERENCE RECORD: $row[0]\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Συνδιάλεξη:$NWB#conferences-conf_exten$NWE
IP Διακομιστή: $NWB#conferences-server_ip$NWE
ΙσχÏουσα εσωτ.σÏνδεση:
\n"; + + echo "
\n"; + if ($LOGast_delete_phones > 0) + { + echo "

DELETE THIS VICIDIAL CONFERENCE\n"; + } + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + + +###################### +# ADD=311111111111111 modify vicidial system settings +###################### + +if ($ADD==311111111111111) +{ + if ($LOGmodify_servers==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT version,install_date,use_non_latin,webroot_writable,enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_url,queuemetrics_log_id,queuemetrics_eq_prepend,vicidial_agent_disable,allow_sipsak_messages,admin_home_url,enable_agc_xfer_log from system_settings;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $version = $row[0]; + $install_date = $row[1]; + $use_non_latin = $row[2]; + $webroot_writable = $row[3]; + $enable_queuemetrics_logging = $row[4]; + $queuemetrics_server_ip = $row[5]; + $queuemetrics_dbname = $row[6]; + $queuemetrics_login = $row[7]; + $queuemetrics_pass = $row[8]; + $queuemetrics_url = $row[9]; + $queuemetrics_log_id = $row[10]; + $queuemetrics_eq_prepend = $row[11]; + $vicidial_agent_disable = $row[12]; + $allow_sipsak_messages = $row[13]; + $admin_home_url = $row[14]; + $enable_agc_xfer_log = $row[15]; + + echo "
ΤΡΟΠΟΠΟΙΗΣΤΕ ΤΙΣ ΤΟΠΟΘΕΤΉΣΕΙΣ ΣΥΣΤΗΜΑΤΩΠVICIDIAL\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + echo "\n"; + echo "
Έκδοση: $version
Install Date: $install_date
Μη-λατινικά χÏήσης: $NWB#settings-use_non_latin$NWE
Webroot writable: $NWB#settings-webroot_writable$NWE
ΕπιτÏέψτε την αναγÏαφή QueueMetrics: $NWB#settings-enable_queuemetrics_logging$NWE
QueueMetrics κεντÏικός υπολογιστής IP: $NWB#settings-queuemetrics_server_ip$NWE
QueueMetrics όνομα DB: $NWB#settings-queuemetrics_dbname$NWE
QueueMetrics σÏνδεση DB: $NWB#settings-queuemetrics_login$NWE
QueueMetrics κωδικός Ï€Ïόσβασης DB: $NWB#settings-queuemetrics_pass$NWE
QueueMetrics URL: $NWB#settings-queuemetrics_url$NWE
QueueMetrics καταγÏάψτε την ταυτότητα: $NWB#settings-queuemetrics_log_id$NWE
QueueMetrics EnterQueue Prepend:$NWB#settings-queuemetrics_eq_prepend$NWE
VICIDIAL ο Ï€ÏάκτοÏας θέτει εκτός λειτουÏγίας την επίδειξη: $NWB#settings-vicidial_agent_disable$NWE
ΕπιτÏέψτε τα μηνÏματα SIPSAK: $NWB#settings-allow_sipsak_messages$NWE
Σπίτι URL Admin:$NWB#settings-admin_home_url$NWE
ΕπιτÏέψτε το αÏχείο ημεÏολογίου μεταφοÏάς Ï€ÏακτόÏων: $NWB#settings-enable_agc_xfer_log$NWE
\n"; + echo "\n"; + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + + + + + +###################### +# ADD=321111111111111 modify vicidial system statuses +###################### + +if ($ADD==321111111111111) +{ + if ($LOGmodify_servers==1) + { + echo "
\n"; + echo ""; + + echo "
\n"; + echo "VICIDIAL ΘΕΣΕΙΣ ΜΕΣΑ ΣΕ ΑΥΤΟ ΤΟ ΣΥΣΤΗΜΑ:  $NWB#vicidial_statuses$NWE
\n"; + echo "\n"; + echo "\n"; + + ##### get status category listings for dynamic pulldown + $stmt="SELECT vsc_id,vsc_name from vicidial_status_categories order by vsc_id desc"; + $rslt=mysql_query($stmt, $link); + $cats_to_print = mysql_num_rows($rslt); + $cats_list=""; + + $o=0; + while ($cats_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $cats_list .= "\n"; + $catsname_list["$rowx[0]"] = substr($rowx[1],0,20); + $o++; + } + + + $stmt="SELECT * from vicidial_statuses order by status;"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $AScategory = $rowx[4]; + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
ΚΑΤΑΣΤΑΣΗΠΕΡΙΓΡΑΦΗSELECT-
ABLE
HUMAN
ANSWER
CATEGORYMODIFY/DELETE
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "$rowx[0]
\n"; + echo "\n"; + echo "         \n"; + echo "   \n"; + + if (preg_match("/^B$|^NA$|^DNC$|^NA$|^DROP$|^INCALL$|^QUEUE$|^NEW$/i",$rowx[0])) + { + echo "ΔΙΑΓΡΑΦΗ\n"; + } + else + { + echo "ΔΙΑΓΡΑΦΗ\n"; + } + echo "
\n"; + + echo "
ΠΡΟΣΘΕΣΤΕ ΤΗ ÎΕΑ ΘΕΣΗ ΣΥΣΤΗΜΑΤΩÎ
\n"; + echo "\n"; + echo "Κατάσταση:   \n"; + echo "ΠεÏιγÏαφή:
\n"; + echo "Επιλέξιμο:   \n"; + echo "Human Answer:   \n"; + echo "ΚατηγοÏία:\n"; + echo "  
\n"; + echo "
\n"; + + echo "

\n"; + + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + + + + +###################### +# ADD=331111111111111 modify vicidial status categories +###################### + +if ($ADD==331111111111111) +{ + if ($LOGmodify_servers==1) + { + echo "
\n"; + echo ""; + + echo "
\n"; + echo "VICIDIAL STATUS CATEGORIES:   $NWB#vicidial_status_categories$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_status_categories order by vsc_id;"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + + $Avsc_id[$o] = $rowx[0]; + $Avsc_name[$o] = $rowx[1]; + $Avsc_description[$o] = $rowx[2]; + $Atovdad_display[$o] = $rowx[3]; + + $o++; + } + $p=0; + while ($o > $p) + { + if (eregi("1$|3$|5$|7$|9$", $p)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $CATstatuses=''; + $stmt="SELECT status from vicidial_statuses where category='$Avsc_id[$p]' order by status;"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $q=0; + while ($statuses_to_print > $q) + { + $rowx=mysql_fetch_row($rslt); + $CATstatuses.=" $rowx[0]"; + $q++; + } + $stmt="SELECT status from vicidial_campaign_statuses where category='$Avsc_id[$p]' order by status;"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $q=0; + while ($statuses_to_print > $q) + { + $rowx=mysql_fetch_row($rslt); + $CATstatuses.=" $rowx[0]"; + $q++; + } + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + $p++; + } + + echo "
CATEGORYΟÎΟΜΑTOVDADSTATUSES IN THIS CATEGORY
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "$Avsc_id[$p]
\n"; + echo "$CATstatuses"; + echo "
ΠεÏιγÏαφή:
        \n"; + echo "   ΔΙΑΓΡΑΦΗ
 
\n"; + + echo "
ΠΡΟΣΘΕΣΤΕ ΤΗ ÎΕΑ ΚΑΤΗΓΟΡΙΑ ΘΕΣΗΣ
\n"; + echo "\n"; + echo "Category ID:   \n"; + echo "Name:   \n"; + echo "TimeOnVDAD Display:  
\n"; + echo "ΠεÏιγÏαφή:   \n"; + echo "
\n"; + + echo "

\n"; + + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + + + + + +###################### +# ADD=550 search form +###################### + +if ($ADD==550) +{ +echo "
\n"; +echo ""; + +echo "
ΑÎΑΖΗΤΗΣΗ ΧΡΗΣΤΗ
\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "
ΑÏιθμός ΧÏήστη:
ΠλήÏες Ονομα:
Επίπεδο ΧÏήστη:
Ομάδα ΧÏήστη:
\n"; + +} + +###################### +# ADD=660 user search results +###################### + +if ($ADD==660) +{ +echo "
\n"; + echo ""; + + $SQL = ''; + if ($user) {$SQL .= " user LIKE \"%$user%\" and";} + if ($full_name) {$SQL .= " full_name LIKE \"%$full_name%\" and";} + if ($user_level > 0) {$SQL .= " user_level LIKE \"%$user_level%\" and";} + if ($user_group) {$SQL .= " user_group = '$user_group' and";} + $SQL = eregi_replace(" and$", "", $SQL); + if (strlen($SQL)>5) {$SQL = "where $SQL";} + + $stmt="SELECT * from vicidial_users $SQL order by full_name desc;"; +# echo "\n|$stmt|\n"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
ΑÎΑΖΗΤΗΣΗ ΑΠΟΤΕΛΕΣΜΑΤΩÎ:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[1]$row[3]$row[4]$row[5]ΤΡΟΠΟΠΟΙΗΣΗ | ΣΤΑΤΙΣΤΙΚΑ | ΚΑΤΑΣΤΑΣΗ | TIME
\n"; + +} + + +###################################################################################################### +###################################################################################################### +####### 8 series, Callback lists +###################################################################################################### +###################################################################################################### + +###################### +# ADD=8 find all callbacks on hold by a User +###################### +if ($ADD==8) +{ + if ($LOGmodify_users==1) + { + if ($SUB==89) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where user='$user' and status='LIVE' and callback_time < '$past_month_date';"; + $rslt=mysql_query($stmt, $link); + echo "
User($user) callback listings LIVE for more than one month have been made INACTIVE\n"; + } + if ($SUB==899) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where user='$user' and status='LIVE' and callback_time < '$past_week_date';"; + $rslt=mysql_query($stmt, $link); + echo "
User($user) callback listings LIVE for more than one week have been made INACTIVE\n"; + } + } +$CBinactiveLINK = "
Remove LIVE Callbacks older than one month for this user
Remove LIVE Callbacks older than one week for this user
"; + +echo ""; + + $CBquerySQLwhere = "and user='$user'"; + +echo "
USER CALLBACK HOLD LISTINGS: $user\n"; +$oldADD = "ADD=8&user=$user"; +$ADD='82'; +} + +###################### +# ADD=81 find all callbacks on hold within a Campaign +###################### +if ($ADD==81) +{ + if ($LOGmodify_campaigns==1) + { + if ($SUB==89) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where campaign_id='$campaign_id' and status='LIVE' and callback_time < '$past_month_date';"; + $rslt=mysql_query($stmt, $link); + echo "
campaign($campaign_id) callback listings LIVE for more than one month have been made INACTIVE\n"; + } + if ($SUB==899) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where campaign_id='$campaign_id' and status='LIVE' and callback_time < '$past_week_date';"; + $rslt=mysql_query($stmt, $link); + echo "
campaign($campaign_id) callback listings LIVE for more than one week have been made INACTIVE\n"; + } + } +$CBinactiveLINK = "
Remove LIVE Callbacks older than one month for this campaign
Remove LIVE Callbacks older than one week for this campaign
"; + +echo ""; + + $CBquerySQLwhere = "and campaign_id='$campaign_id'"; + +echo "
CAMPAIGN CALLBACK HOLD LISTINGS: $campaign_id\n"; +$oldADD = "ADD=81&campaign_id=$campaign_id"; +$ADD='82'; +} + +###################### +# ADD=811 find all callbacks on hold within a List +###################### +if ($ADD==811) +{ + if ($LOGmodify_lists==1) + { + if ($SUB==89) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where list_id='$list_id' and status='LIVE' and callback_time < '$past_month_date';"; + $rslt=mysql_query($stmt, $link); + echo "
list($list_id) callback listings LIVE for more than one month have been made INACTIVE\n"; + } + if ($SUB==899) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where list_id='$list_id' and status='LIVE' and callback_time < '$past_week_date';"; + $rslt=mysql_query($stmt, $link); + echo "
list($list_id) callback listings LIVE for more than one week have been made INACTIVE\n"; + } + } +$CBinactiveLINK = "
Remove LIVE Callbacks older than one month for this list
Remove LIVE Callbacks older than one week for this list
"; + +echo ""; + + $CBquerySQLwhere = "and list_id='$list_id'"; + +echo "
LIST CALLBACK HOLD LISTINGS: $list_id\n"; +$oldADD = "ADD=811&list_id=$list_id"; +$ADD='82'; +} + +###################### +# ADD=8111 find all callbacks on hold within a user group +###################### +if ($ADD==8111) +{ + if ($LOGmodify_usergroups==1) + { + if ($SUB==89) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where user_group='$user_group' and status='LIVE' and callback_time < '$past_month_date';"; + $rslt=mysql_query($stmt, $link); + echo "
user group($user_group) callback listings LIVE for more than one month have been made INACTIVE\n"; + } + if ($SUB==899) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where user_group='$user_group' and status='LIVE' and callback_time < '$past_week_date';"; + $rslt=mysql_query($stmt, $link); + echo "
user group($user_group) callback listings LIVE for more than one week have been made INACTIVE\n"; + } + } + $CBinactiveLINK = "
Remove LIVE Callbacks older than one month for this user group
Remove LIVE Callbacks older than one week for this user group
"; + + echo ""; + + $CBquerySQLwhere = "and user_group='$user_group'"; + +echo "
USER GROUP CALLBACK HOLD LISTINGS: $list_id\n"; +$oldADD = "ADD=8111&user_group=$user_group"; +$ADD='82'; +} + +###################### +# ADD=82 display all callbacks on hold +###################### +if ($ADD==82) +{ + +$USERlink='stage=USERIDDOWN'; +$GROUPlink='stage=GROUPDOWN'; +$ENDATElink='stage=ENDATEDOWN'; +$SQLorder='order by '; +if (eregi("USERIDDOWN",$stage)) {$SQLorder='order by user desc,'; $USERlink='stage=USERIDUP';} +if (eregi("GROUPDOWN",$stage)) {$SQLorder='order by user_group desc,'; $NAMElink='stage=NAMEUP';} +if (eregi("ENDATEDOWN",$stage)) {$SQLorder='order by entry_time desc,'; $LEVELlink='stage=LEVELUP';} + + $stmt="SELECT * from vicidial_callbacks where status IN('ACTIVE','LIVE') $CBquerySQLwhere $SQLorder recipient,status desc,callback_time"; + $rslt=mysql_query($stmt, $link); + $cb_to_print = mysql_num_rows($rslt); + +echo "
\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $o=0; + while ($cb_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
LEADLISTΕΚΣΤΡΑΤΕΙΑENTRY ΗΜΕΡΑCALLBACK ΗΜΕΡΑUSERRECIPIENTΚΑΤΑΣΤΑΣΗGROUP
$row[1]$row[2]$row[3]$row[5]$row[6]$row[8]$row[9]$row[4]$row[11]
\n"; + +echo "$CBinactiveLINK"; +} + + + +###################################################################################################### +###################################################################################################### +####### 0 series, displays and searches +###################################################################################################### +###################################################################################################### + +###################### +# ADD=0 display all active users +###################### +if ($ADD==0) +{ +echo "
\n"; +echo ""; + +$USERlink='stage=USERIDDOWN'; +$NAMElink='stage=NAMEDOWN'; +$LEVELlink='stage=LEVELDOWN'; +$GROUPlink='stage=GROUPDOWN'; +$SQLorder='order by full_name'; +if (eregi("USERIDUP",$stage)) {$SQLorder='order by user asc'; $USERlink='stage=USERIDDOWN';} +if (eregi("USERIDDOWN",$stage)) {$SQLorder='order by user desc'; $USERlink='stage=USERIDUP';} +if (eregi("NAMEUP",$stage)) {$SQLorder='order by full_name asc'; $NAMElink='stage=NAMEDOWN';} +if (eregi("NAMEDOWN",$stage)) {$SQLorder='order by full_name desc'; $NAMElink='stage=NAMEUP';} +if (eregi("LEVELUP",$stage)) {$SQLorder='order by user_level asc'; $LEVELlink='stage=LEVELDOWN';} +if (eregi("LEVELDOWN",$stage)) {$SQLorder='order by user_level desc'; $LEVELlink='stage=LEVELUP';} +if (eregi("GROUPUP",$stage)) {$SQLorder='order by user_group asc'; $GROUPlink='stage=GROUPDOWN';} +if (eregi("GROUPDOWN",$stage)) {$SQLorder='order by user_group desc'; $GROUPlink='stage=GROUPUP';} + $stmt="SELECT * from vicidial_users $SQLorder"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
ΛΙΣΤΕΣ ΧΡΗΣΤΗ:\n"; +echo "
\n"; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo "\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
USER IDFULL NAMELEVELGROUPLINKS
$row[1]$row[3]$row[4]$row[5]ΤΡΟΠΟΠΟΙΗΣΗ | ΣΤΑΤΙΣΤΙΚΑ | ΚΑΤΑΣΤΑΣΗ | TIME
\n"; +} + +###################### +# ADD=10 display all campaigns +###################### +if ($ADD==10) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
ΕÎΤΑΓΜΕÎΕΣ ΕΚΣΤΡΑΤΕΙΕΣ:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2] $row[3]$row[4]$row[5] $row[6]$row[7]  Î¤Î¡ÎŸÎ ÎŸÎ ÎŸÎ™Î—ΣΗ
\n"; +} + + +###################### +# ADD=100 display all lists +###################### +if ($ADD==100) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_lists order by list_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
ΕÎΤΑΓΜΕÎΕΣ ΛΙΣΤΕΣ:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2]$row[4]$row[5] $row[3]$row[7]  Î¤Î¡ÎŸÎ ÎŸÎ ÎŸÎ™Î—ΣΗ
\n"; +} + + + +###################### +# ADD=1000 display all inbound groups +###################### +if ($ADD==1000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_inbound_groups order by group_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
ΕÎΤΑΓΜΕÎΕΣ ΕΙΣΕΡΧΟΜΕÎΕΣ ΟΜΑΔΕΣ:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[3] $row[5]  Î¤Î¡ÎŸÎ ÎŸÎ ÎŸÎ™Î—ΣΗ
\n"; +} + + +###################### +# ADD=10000 display all remote agents +###################### +if ($ADD==10000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_remote_agents order by server_ip,campaign_id,user_start"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
ΕÎΤΑΓΜΕÎΟΙ ΑΠΟΜΑΚΡΥΣΜΕÎΟΙ ΧΕΙΡΙΣΤΕΣ:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[1] $row[2] $row[3] $row[4] $row[5] $row[6]ΤΡΟΠΟΠΟΙΗΣΗ
\n"; +} + + +###################### +# ADD=100000 display all user groups +###################### +if ($ADD==100000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_user_groups order by user_group"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
ΕÎΤΑΓΜΕÎΕΣ ΟΜΑΔΕΣ ΧΡΗΣΤΗ:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]ΤΡΟΠΟΠΟΙΗΣΗ
\n"; +} + + +###################### +# ADD=1000000 display all scripts +###################### +if ($ADD==1000000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_scripts order by script_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
ΛΙΣΤΕΣ ΒΟΗΘΩÎ:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]ΤΡΟΠΟΠΟΙΗΣΗ
\n"; +} + + +###################### +# ADD=10000000 display all filters +###################### +if ($ADD==10000000) +{ +echo "
\n"; + + echo ""; + + $stmt="SELECT * from vicidial_lead_filters order by lead_filter_id"; + $rslt=mysql_query($stmt, $link); + $filters_to_print = mysql_num_rows($rslt); + +echo "
ΛΙΣΤΕΣ ΟΔΗΓΟΥ ΦΙΛΤΡΟΥ:\n"; +echo "
\n"; + + $o=0; + while ($filters_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]ΤΡΟΠΟΠΟΙΗΣΗ
\n"; +} + + +###################### +# ADD=100000000 display all call times +###################### +if ($ADD==100000000) +{ +echo "
\n"; + + echo ""; + + $stmt="SELECT * from vicidial_call_times order by call_time_id"; + $rslt=mysql_query($stmt, $link); + $filters_to_print = mysql_num_rows($rslt); + +echo "
ΛΙΣΤΕΣ ΧΡΟÎΟΥ ΚΛΗΣΗΣ:\n"; +echo "
\n"; + + $o=0; + while ($filters_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[3] $row[4] ΤΡΟΠΟΠΟΙΗΣΗ
\n"; +} + +###################### +# ADD=1000000000 display all state call times +###################### +if ($ADD==1000000000) +{ +echo "
\n"; + + echo ""; + + $stmt="SELECT * from vicidial_state_call_times order by state_call_time_id"; + $rslt=mysql_query($stmt, $link); + $filters_to_print = mysql_num_rows($rslt); + +echo "
ΛΙΣΤΕΣ ΧΡΟÎΟΥ ΚΛΗΣΗΣ ΚΑΤΑΣΤΑΣΗΣ:\n"; +echo "
\n"; + + $o=0; + while ($filters_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2] $row[3] $row[4] ΤΡΟΠΟΠΟΙΗΣΗ
\n"; +} + +###################### +# ADD=10000000000 display all phones +###################### +if ($ADD==10000000000) +{ +echo "
\n"; +echo ""; + +$EXTENlink='stage=EXTENDOWN'; +$PROTOlink='stage=PROTODOWN'; +$SERVERlink='stage=SERVERDOWN'; +$STATUSlink='stage=STATUSDOWN'; +$SQLorder='order by extension,server_ip'; +if (eregi("EXTENUP",$stage)) {$SQLorder='order by extension asc'; $EXTENlink='stage=EXTENDOWN';} +if (eregi("EXTENDOWN",$stage)) {$SQLorder='order by extension desc'; $EXTENlink='stage=EXTENUP';} +if (eregi("PROTOUP",$stage)) {$SQLorder='order by protocol asc'; $PROTOlink='stage=PROTODOWN';} +if (eregi("PROTODOWN",$stage)) {$SQLorder='order by protocol desc'; $PROTOlink='stage=PROTOUP';} +if (eregi("SERVERUP",$stage)) {$SQLorder='order by server_ip asc'; $SERVERlink='stage=SERVERDOWN';} +if (eregi("SERVERDOWN",$stage)) {$SQLorder='order by server_ip desc'; $SERVERlink='stage=SERVERUP';} +if (eregi("STATUSUP",$stage)) {$SQLorder='order by status asc'; $STATUSlink='stage=STATUSDOWN';} +if (eregi("STATUSDOWN",$stage)) {$SQLorder='order by status desc'; $STATUSlink='stage=STATUSUP';} + $stmt="SELECT * from phones $SQLorder"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
ΕÎΤΑΓΜΕÎΑ ΤΗΛΕΦΩÎΑ:\n"; +echo "
\n"; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo "\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
EXTENPROTOSERVERDIAL PLANΚΑΤΑΣΤΑΣΗΟÎΟΜΑVMAILLINKS
$row[0]$row[16]$row[5]$row[1]$row[2]$row[8]$row[11]$row[14]$row[15]ΤΡΟΠΟΠΟΙΗΣΗ | ΣΤΑΤΙΣΤΙΚΑ
\n"; +} + +###################### +# ADD=100000000000 display all servers +###################### +if ($ADD==100000000000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from servers order by server_id"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
ΕÎΤΑΓΜΕÎΟΙ ΔΙΑΚΟΜΙΣΤΕΣ:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0]$row[1] $row[2] $row[4] $row[3]  Î¤Î¡ÎŸÎ ÎŸÎ ÎŸÎ™Î—ΣΗ
\n"; +} + +###################### +# ADD=1000000000000 display all conferences +###################### +if ($ADD==1000000000000) +{ +echo "\r\n"; + print " \r\n"; + } + $rec_count++; + } +$sthA->finish(); + +exit; diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/listloader_super.pl b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/listloader_super.pl new file mode 100644 index 00000000..167fff5e --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/listloader_super.pl @@ -0,0 +1,1086 @@ +#!/usr/bin/perl + +### listloader_super.pl version 0.4 *DBI-version* +### +### Copyright (C) 2007 Matt Florell,Joe Johnson LICENSE: GPLv2 +### +# +# +# CHANGES +# 60616-1548 - Added listID override feature to force all leads into same list +# - Added gmt_offset_now lookup for each lead +# 60811-1232 - Changed to DBI +# 60811-1329 - changed to use /etc/astguiclient.conf for configs +# 60906-1056 - added filter of non-digits in alt_phone field +# 61110-1229 - added new USA-Canada DST scheme and Brazil DST scheme +# 61128-1207 - added postal code GMT lookup and duplicate check options +# 70205-1703 - Defaulted phone_code to 1 if not populated +# 70417-1059 - Fixed default phone_code bug +# 70510-1518 - Added campaign and system duplicate check and phonecode override +# + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help|-h/i) + { + print "allowed run time options:\n [-forcelistid=1234] = overrides the listID given in the file with the 1234\n [-h] = this help screen\n\n"; + + exit; + } + else + { + if ($args =~ /-duplicate-check/i) + {$dupcheck=1;} + if ($args =~ /-duplicate-campaign-check/i) + {$dupcheckcamp=1;} + if ($args =~ /-duplicate-system-check/i) + {$dupchecksys=1;} + if ($args =~ /-postal-code-gmt/i) + {$postalgmt=1;} + if ($args =~ /--forcelistid=/i) + { + @data_in = split(/--forcelistid=/,$args); + $forcelistid = $data_in[1]; + $forcelistid =~ s/ .*//gi; + print "\n----- FORCE LISTID OVERRIDE: $forcelistid -----\n\n"; + } + else + {$forcelistid = '';} + + if ($args =~ /--forcephonecode=/i) + { + @data_in = split(/--forcephonecode=/,$args); + $forcephonecode = $data_in[1]; + $forcephonecode =~ s/ .*//gi; + print "\n----- FORCE PHONECODE OVERRIDE: $forcephonecode -----\n\n"; + } + else + {$forcephonecode = '';} + + if ($args =~ /--lead-file=/i) + { + @data_in = split(/--lead-file=/,$args); + $lead_file = $data_in[1]; + $lead_file =~ s/ .*//gi; + # print "\n----- LEAD FILE: $lead_file -----\n\n"; + } + else + {$lead_file = './vicidial_temp_file.xls';} + } +} +### end parsing run-time options ### + +use Spreadsheet::ParseExcel; +use Time::Local; +use DBI; + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + +$vars=$ARGV[0]; +@xls_fields=split(/\,/, $vars); + +$|=0; +$secX = time(); + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($hour < 10) {$hour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +$pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; +$pulldate="$year-$mon-$mday $hour:$min:$sec"; +$inSD = $pulldate0; +$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + + ### Grab Server values from the database + $stmtA = "SELECT local_gmt FROM servers where server_ip = '$server_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBSERVER_GMT = "$aryA[0]"; + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + $rec_count++; + } + $sthA->finish(); + + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + +if ($isdst) {$LOCAL_GMT_OFF++;} +if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";} + + + +$total=0; $good=0; $bad=0; +open(STMT_FILE, "> $PATHlogs/listloader_stmts.txt"); + +$oBook = Spreadsheet::ParseExcel::Workbook->Parse("$lead_file"); +my($iR, $iC, $oWkS, $oWkC); + +foreach $oWkS (@{$oBook->{Worksheet}}) { + for($iR = 0 ; defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow} ; $iR++) { + + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user = ""; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[0]]; + if ($oWkC) {$vendor_lead_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[1]]; + if ($oWkC) {$source_code=$oWkC->Value; } + $source_id=$source_code; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[2]]; + if ($oWkC) {$list_id=$oWkC->Value; } + $gmt_offset = '0'; + $called_since_last_reset='N'; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[3]]; + if ($oWkC) {$phone_code=$oWkC->Value; } + $phone_code=~s/[^0-9]//g; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[4]]; + if ($oWkC) {$phone_number=$oWkC->Value; } + $phone_number=~s/[^0-9]//g; + $USarea = substr($phone_number, 0, 3); + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[5]]; + if ($oWkC) {$title=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[6]]; + if ($oWkC) {$first_name=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[7]]; + if ($oWkC) {$middle_initial=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[8]]; + if ($oWkC) {$last_name=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[9]]; + if ($oWkC) {$address1=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[10]]; + if ($oWkC) {$address2=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[11]]; + if ($oWkC) {$address3=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[12]]; + if ($oWkC) {$city=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[13]]; + if ($oWkC) {$state=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[14]]; + if ($oWkC) {$province=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[15]]; + if ($oWkC) {$postal_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[16]]; + if ($oWkC) {$country_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[17]]; + if ($oWkC) {$gender=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[18]]; + if ($oWkC) {$date_of_birth=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[19]]; + if ($oWkC) {$alt_phone=$oWkC->Value; } + $alt_phone=~s/[^0-9]//g; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[20]]; + if ($oWkC) {$email=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[21]]; + if ($oWkC) {$security_phrase=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[22]]; + if ($oWkC) {$comments=$oWkC->Value; } + $comments=~s/^\s*(.*?)\s*$/$1/; + + + + if (length($forcelistid) > 0) + { + $list_id = $forcelistid; # set list_id to override value + } + if (length($forcephonecode) > 0) + { + $phone_code = $forcephonecode; # set phone_code to override value + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if ($dupchecksys > 0) + { + $dup_lead=0; + $stmtA = "select count(*) from vicidial_list where phone_number='$phone_number';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $dup_lead = $aryA[0]; + $dup_lead_list=$list_id; + } + $sthA->finish(); + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if ($dupcheck > 0) + { + $dup_lead=0; + $stmtA = "select list_id from vicidial_list where phone_number='$phone_number' and list_id='$list_id' limit 1;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $dup_lead_list = $aryA[0]; + $dup_lead++; + } + $sthA->finish(); + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if ($dupcheckcamp > 0) + { + $dup_lead=0; + $dup_lists=''; + + $stmtA = "select count(*) from vicidial_lists where list_id='$list_id';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + @aryA = $sthA->fetchrow_array; + $ci_recs = $aryA[0]; + $sthA->finish(); + if ($ci_recs > 0) + { + $stmtA = "select campaign_id from vicidial_lists where list_id='$list_id';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + @aryA = $sthA->fetchrow_array; + $dup_camp = $aryA[0]; + $sthA->finish(); + + $stmtA = "select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $dup_lists .= "'$aryA[0]',"; + $rec_count++; + } + $sthA->finish(); + + chop($dup_lists); + $stmtA = "select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $dup_lead_list = "'$aryA[0]',"; + $rec_count++; + $dup_lead=1; + } + $sthA->finish(); + } + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + + if ( (length($phone_number)>6) && ($dup_lead < 1) ) + { + $phone_list .= "$phone_number$US$list_id|"; + $postalgmt_found=0; + if (length($phone_code)<1) {$phone_code = '1';} + + if ( ($postalgmt > 0) && (length($postal_code)>4) ) + { + if ($phone_code =~ /^1$/) + { + $stmtA = "select * from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[2]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[3]; + $dst_range = $aryA[4]; + $PC_processed++; + $rec_count++; + $postalgmt_found++; + if ($DBX) {print " Postal GMT record found for $postal_code: |$gmt_offset|$dst|$dst_range|\n";} + } + $sthA->finish(); + } + } + if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =~ /^1$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### MEXICO ### + if ($phone_code =~ /^52$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### AUSTRALIA ### + if ($phone_code =~ /^61$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + } + + ### Find out if DST to raise the gmt offset ### + $AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); + $AC_localtime = ($secX + (3600 * $AC_GMT_diff)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($AC_localtime); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + + if ( (!$AC_processed) && ($dst_range =~ /SSM-FSN/) ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + &USACAN_dstcalc; + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSA-LSO/) ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + &NA_dstcalc; + if ($DBX) {print " DST: $NA_DST\n";} + if ($NA_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /LSM-LSO/) ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + &GBR_dstcalc; + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /LSO-LSM/) ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + &AUS_dstcalc; + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSO-LSM/) ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + &AUST_dstcalc; + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSO-TSM/) ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + &NZL_dstcalc; + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /TSO-LSF/) ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + &BZL_dstcalc; + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$area_GMT++;} + $AC_processed++; + } + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $affected_rows = $dbhA->do($stmtZ); + print STMT_FILE $stmtZ."\r\n"; + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| $dup_lead_list\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + sleep(1); +# flush(); + } + } +} + +if ($multi_insert_counter > 0) { + $stmtZ = "INSERT INTO vicidial_list values ".substr($multistmt, 0, -1).";"; + $affected_rows = $dbhA->do($stmtZ); + print STMT_FILE $stmtZ."\r\n"; +} + +print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total"; + +exit; + + + + + + +sub USACAN_dstcalc { +#********************************************************************** +# SSM-FSN +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on Second Sunday March to First Sunday November at 2 am. +# INPUTS: +# mm INTEGER Month. +# dd INTEGER Day of the month. +# ns INTEGER Seconds into the day. +# dow INTEGER Day of week (0=Sunday, to 6=Saturday) +# OPTIONAL INPUT: +# timezone INTEGER hour difference UTC - local standard time +# (DEFAULT is blank) +# make calculations based on UTC time, +# which means shift at 10:00 UTC in April +# and 9:00 UTC in October +# OUTPUT: +# INTEGER 1 = DST, 0 = not DST +# +# S M T W T F S +# 1 2 3 4 5 6 7 +# 8 9 10 11 12 13 14 +#15 16 17 18 19 20 21 +#22 23 24 25 26 27 28 +#29 30 31 +# +# S M T W T F S +# 1 2 3 4 5 6 +# 7 8 9 10 11 12 13 +#14 15 16 17 18 19 20 +#21 22 23 24 25 26 27 +#28 29 30 31 +# +#********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; return 0; + } elsif ($mm >= 4 && $mm <= 10) { + $USACAN_DST=1; return 1; + } elsif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; return 1; + } elsif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; return 0; + } else { + $USACAN_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $USACAN_DST=0; return 0; + } else { + $USACAN_DST=1; return 1; + } + } + } else { + $USACAN_DST=0; return 0; + } + } elsif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; return 0; + } elsif ($dd < ($dow+1)) { + $USACAN_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; return 1; + } else { + $USACAN_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; return 1; + } else { + $USACAN_DST=0; return 0; + } + } + } else { + $USACAN_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub NA_dstcalc { +#********************************************************************** +# FSA-LSO +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in April and last Sunday in October at 2 am. +#********************************************************************** + + $NA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $NA_DST=0; return 0; + } elsif ($mm >= 5 && $mm <= 9) { + $NA_DST=1; return 1; + } elsif ($mm == 4) { + if ($dd > 7) { + $NA_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $NA_DST=0; return 0; + } else { + $NA_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $NA_DST=0; return 0; + } else { + $NA_DST=1; return 1; + } + } + } else { + $NA_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $NA_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $NA_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $NA_DST=1; return 1; + } else { + $NA_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 7200) { + $NA_DST=1; return 1; + } else { + $NA_DST=0; return 0; + } + } + } else { + $NA_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub GBR_dstcalc { +#********************************************************************** +# LSM-LSO +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in March and last Sunday in October at 1 am. +#********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; return 0; + } elsif ($mm >= 4 && $mm <= 9) { + $GBR_DST=1; return 1; + } elsif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $GBR_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; return 0; + } else { + $GBR_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; return 0; + } else { + $GBR_DST=1; return 1; + } + } + } else { + $GBR_DST=1; return 1; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $GBR_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; return 1; + } else { + $GBR_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; return 1; + } else { + $GBR_DST=0; return 0; + } + } + } else { + $GBR_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub AUS_dstcalc { +#********************************************************************** +# LSO-LSM +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in October and last Sunday in March at 1 am. +#********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $AUS_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $AUS_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; return 1; + } else { + $AUS_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; return 1; + } else { + $AUS_DST=0; return 0; + } + } + } else { + $AUS_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $AUS_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; return 0; + } else { + $AUS_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; return 0; + } else { + $AUS_DST=1; return 1; + } + } + } else { + $AUS_DST=1; return 1; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub AUST_dstcalc { +#********************************************************************** +# FSO-LSM +# TASMANIA ONLY +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and last Sunday in March at 1 am. +#********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $AUST_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $AUST_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; return 1; + } else { + $AUST_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; return 1; + } else { + $AUST_DST=0; return 0; + } + } + } else { + $AUST_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd >= 8) { + $AUST_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $AUST_DST=0; return 0; + } else { + $AUST_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $AUST_DST=0; return 0; + } else { + $AUST_DST=1; return 1; + } + } + } else { + $AUST_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub NZL_dstcalc { +#********************************************************************** +# FSO-TSM +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and third Sunday in March at 1 am. +#********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $NZL_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; return 1; + } elsif ($dd < ($dow+14)) { + $NZL_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; return 1; + } else { + $NZL_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; return 1; + } else { + $NZL_DST=0; return 0; + } + } + } else { + $NZL_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd >= 8) { + $NZL_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $NZL_DST=0; return 0; + } else { + $NZL_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $NZL_DST=0; return 0; + } else { + $NZL_DST=1; return 1; + } + } + } else { + $NZL_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub BZL_dstcalc { +#********************************************************************** +# TSO-LSF +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. Brazil +# Based on Third Sunday October to Last Sunday February at 1 am. +#********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; return 1; + } elsif ($mm >= 3 && $mm <= 9) { + $BZL_DST=0; return 0; + } elsif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; return 1; + } elsif ($dd < ($dow+22)) { + $BZL_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; return 1; + } else { + $BZL_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; return 1; + } else { + $BZL_DST=0; return 0; + } + } + } else { + $BZL_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; return 0; + } elsif ($dd < ($dow+22)) { + $BZL_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; return 0; + } else { + $BZL_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; return 0; + } else { + $BZL_DST=1; return 1; + } + } + } else { + $BZL_DST=1; return 1; + } + } # end of month checks +} # end of subroutine dstcalc diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/new_listloader_superL.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/new_listloader_superL.php new file mode 100644 index 00000000..d3c0060d --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/new_listloader_superL.php @@ -0,0 +1,2069 @@ + LICENSE: GPLv2 +# +# AST GUI lead loader from formatted file +# +# CHANGES +# 50602-1640 - First version created by Joe Johnson +# 51128-1108 - Removed PHP global vars requirement +# 60113-1603 - Fixed a few bugs in Excel import +# 60421-1624 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60616-1240 - added listID override +# 60616-1604 - added gmt lookup for each lead +# 60619-1651 - Added variable filtering to eliminate SQL injection attack threat +# 60822-1121 - fixed for nonwritable directories +# 60906-1100 - added filter of non-digits in alt_phone field +# 61110-1222 - added new USA-Canada DST scheme and Brazil DST scheme +# 61128-1149 - added postal code GMT lookup and duplicate check options +# 70417-1059 - Fixed default phone_code bug +# 70510-1518 - Added campaign and system duplicate check and phonecode override +# +# make sure vicidial_list exists and that your file follows the formatting correctly. This page does not dedupe or do any other lead filtering actions yet at this time. + +$version = '2.0.4'; +$build = '70510-1518'; + + +require("dbconnect.php"); + +### links used for testing +#$link=mysql_connect("10.10.10.15", "cron", "1234"); +#mysql_select_db("asterisk"); +#$WeBServeRRooT = '/home/www/htdocs'; + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$leadfile=$_FILES["leadfile"]; + $LF_orig = $_FILES['leadfile']['name']; + $LF_path = $_FILES['leadfile']['tmp_name']; +if (isset($_GET["submit_file"])) {$submit_file=$_GET["submit_file"];} + elseif (isset($_POST["submit_file"])) {$submit_file=$_POST["submit_file"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"];} + elseif (isset($_POST["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];} +if (isset($_GET["leadfile_name"])) {$leadfile_name=$_GET["leadfile_name"];} + elseif (isset($_POST["leadfile_name"])) {$leadfile_name=$_POST["leadfile_name"];} +if (isset($_GET["file_layout"])) {$file_layout=$_GET["file_layout"];} + elseif (isset($_POST["file_layout"])) {$file_layout=$_POST["file_layout"];} +if (isset($_GET["OK_to_process"])) {$OK_to_process=$_GET["OK_to_process"];} + elseif (isset($_POST["OK_to_process"])) {$OK_to_process=$_POST["OK_to_process"];} +if (isset($_GET["vendor_lead_code_field"])) {$vendor_lead_code_field=$_GET["vendor_lead_code_field"];} + elseif (isset($_POST["vendor_lead_code_field"])) {$vendor_lead_code_field=$_POST["vendor_lead_code_field"];} +if (isset($_GET["source_id_field"])) {$source_id_field=$_GET["source_id_field"];} + elseif (isset($_POST["source_id_field"])) {$source_id_field=$_POST["source_id_field"];} +if (isset($_GET["list_id_field"])) {$list_id_field=$_GET["list_id_field"];} + elseif (isset($_POST["list_id_field"])) {$list_id_field=$_POST["list_id_field"];} +if (isset($_GET["phone_code_field"])) {$phone_code_field=$_GET["phone_code_field"];} + elseif (isset($_POST["phone_code_field"])) {$phone_code_field=$_POST["phone_code_field"];} +if (isset($_GET["phone_number_field"])) {$phone_number_field=$_GET["phone_number_field"];} + elseif (isset($_POST["phone_number_field"])) {$phone_number_field=$_POST["phone_number_field"];} +if (isset($_GET["title_field"])) {$title_field=$_GET["title_field"];} + elseif (isset($_POST["title_field"])) {$title_field=$_POST["title_field"];} +if (isset($_GET["first_name_field"])) {$first_name_field=$_GET["first_name_field"];} + elseif (isset($_POST["first_name_field"])) {$first_name_field=$_POST["first_name_field"];} +if (isset($_GET["middle_initial_field"])) {$middle_initial_field=$_GET["middle_initial_field"];} + elseif (isset($_POST["middle_initial_field"])) {$middle_initial_field=$_POST["middle_initial_field"];} +if (isset($_GET["last_name_field"])) {$last_name_field=$_GET["last_name_field"];} + elseif (isset($_POST["last_name_field"])) {$last_name_field=$_POST["last_name_field"];} +if (isset($_GET["address1_field"])) {$address1_field=$_GET["address1_field"];} + elseif (isset($_POST["address1_field"])) {$address1_field=$_POST["address1_field"];} +if (isset($_GET["address2_field"])) {$address2_field=$_GET["address2_field"];} + elseif (isset($_POST["address2_field"])) {$address2_field=$_POST["address2_field"];} +if (isset($_GET["address3_field"])) {$address3_field=$_GET["address3_field"];} + elseif (isset($_POST["address3_field"])) {$address3_field=$_POST["address3_field"];} +if (isset($_GET["city_field"])) {$city_field=$_GET["city_field"];} + elseif (isset($_POST["city_field"])) {$city_field=$_POST["city_field"];} +if (isset($_GET["state_field"])) {$state_field=$_GET["state_field"];} + elseif (isset($_POST["state_field"])) {$state_field=$_POST["state_field"];} +if (isset($_GET["province_field"])) {$province_field=$_GET["province_field"];} + elseif (isset($_POST["province_field"])) {$province_field=$_POST["province_field"];} +if (isset($_GET["postal_code_field"])) {$postal_code_field=$_GET["postal_code_field"];} + elseif (isset($_POST["postal_code_field"])) {$postal_code_field=$_POST["postal_code_field"];} +if (isset($_GET["country_code_field"])) {$country_code_field=$_GET["country_code_field"];} + elseif (isset($_POST["country_code_field"])) {$country_code_field=$_POST["country_code_field"];} +if (isset($_GET["gender_field"])) {$gender_field=$_GET["gender_field"];} + elseif (isset($_POST["gender_field"])) {$gender_field=$_POST["gender_field"];} +if (isset($_GET["date_of_birth_field"])) {$date_of_birth_field=$_GET["date_of_birth_field"];} + elseif (isset($_POST["date_of_birth_field"])) {$date_of_birth_field=$_POST["date_of_birth_field"];} +if (isset($_GET["alt_phone_field"])) {$alt_phone_field=$_GET["alt_phone_field"];} + elseif (isset($_POST["alt_phone_field"])) {$alt_phone_field=$_POST["alt_phone_field"];} +if (isset($_GET["email_field"])) {$email_field=$_GET["email_field"];} + elseif (isset($_POST["email_field"])) {$email_field=$_POST["email_field"];} +if (isset($_GET["security_phrase_field"])) {$security_phrase_field=$_GET["security_phrase_field"];} + elseif (isset($_POST["security_phrase_field"])) {$security_phrase_field=$_POST["security_phrase_field"];} +if (isset($_GET["comments_field"])) {$comments_field=$_GET["comments_field"];} + elseif (isset($_POST["comments_field"])) {$comments_field=$_POST["comments_field"];} +if (isset($_GET["list_id_override"])) {$list_id_override=$_GET["list_id_override"];} + elseif (isset($_POST["list_id_override"])) {$list_id_override=$_POST["list_id_override"];} + $list_id_override = (preg_replace("/\D/","",$list_id_override)); +if (isset($_GET["lead_file"])) {$lead_file=$_GET["lead_file"];} + elseif (isset($_POST["lead_file"])) {$lead_file=$_POST["lead_file"];} +if (isset($_GET["dupcheck"])) {$dupcheck=$_GET["dupcheck"];} + elseif (isset($_POST["dupcheck"])) {$dupcheck=$_POST["dupcheck"];} +if (isset($_GET["postalgmt"])) {$postalgmt=$_GET["postalgmt"];} + elseif (isset($_POST["postalgmt"])) {$postalgmt=$_POST["postalgmt"];} +if (isset($_GET["phone_code_override"])) {$phone_code_override=$_GET["phone_code_override"];} + elseif (isset($_POST["phone_code_override"])) {$phone_code_override=$_POST["phone_code_override"];} + $phone_code_override = (preg_replace("/\D/","",$phone_code_override)); + +# $country_field=$_GET["country_field"]; if (!$country_field) {$country_field=$_POST["country_field"];} + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); +$list_id_override = ereg_replace("[^0-9]","",$list_id_override); + + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_datetime = $STARTtime; + +$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +if ($WeBRooTWritablE > 0) {$fp = fopen ("./project_auth_entries.txt", "a");} +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-LEAD-LOADER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT load_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGload_leads =$row[0]; + + if ($LOGload_leads < 1) + { + echo "You do not have permissions to load leads\n"; + exit; + } + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "LIST_LOAD|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "LIST_LOAD|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + + +$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://';} +$admDIR = "$HTTPprotocol$server_name$script_name"; +$admDIR = eregi_replace('new_listloader_superL.php','',$admDIR); +$admSCR = 'admin.php'; +$NWB = "   \"ΒΟΗΘΕΙΑ\""; + +$secX = date("U"); +$hour = date("H"); +$min = date("i"); +$sec = date("s"); +$mon = date("m"); +$mday = date("d"); +$year = date("Y"); +$isdst = date("I"); +$Shour = date("H"); +$Smin = date("i"); +$Ssec = date("s"); +$Smon = date("m"); +$Smday = date("d"); +$Syear = date("Y"); +$pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; +$inSD = $pulldate0; +$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + ### Grab Server GMT value from the database + $stmt="SELECT local_gmt FROM servers where server_ip = '$server_ip';"; + $rslt=mysql_query($stmt, $link); + $gmt_recs = mysql_num_rows($rslt); + if ($gmt_recs > 0) + { + $row=mysql_fetch_row($rslt); + $DBSERVER_GMT = "$row[0]"; + if (strlen($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;} + if ($isdst) {$SERVER_GMT++;} + } + else + { + $SERVER_GMT = date("O"); + $SERVER_GMT = eregi_replace("\+","",$SERVER_GMT); + $SERVER_GMT = ($SERVER_GMT + 0); + $SERVER_GMT = ($SERVER_GMT / 100); + } + + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + +#if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";} + + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +function macfontfix($fontsize) { + + $browser = getenv("HTTP_USER_AGENT"); + $pctype = explode("(", $browser); + if (ereg("Mac",$pctype[1])) { + /* Browser is a Mac. If not Netscape 6, raise fonts */ + + $blownbrowser = explode('/', $browser); + $ver = explode(' ', $blownbrowser[1]); + $ver = $ver[0]; + if ($ver >= 5.0) return $fontsize; else return ($fontsize+2); + + } else return $fontsize; /* Browser is not a Mac - don't touch fonts */ +} + +echo "\n"; + +?> + + + +ΔΙΑΧΕΙΡΙΣΗ: Lead Loader + + +
method=post onSubmit="ParseFileName()" enctype="multipart/form-data"> + + +
\n"; + echo ""; + + $stmt="SELECT * from conferences order by conf_exten"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
ΕÎΤΑΓΜΕÎΕΣ ΣΥÎΔΙΑΛΕΞΕΙΣ:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2]$row[4]  Î¤Î¡ÎŸÎ ÎŸÎ ÎŸÎ™Î—ΣΗ
\n"; +} + +###################### +# ADD=10000000000000 display all vicidial conferences +###################### +if ($ADD==10000000000000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_conferences order by conf_exten"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
ΕÎΤΑΓΜΕÎΕΣ ΣΥÎΔΙΑΛΕΞΕΙΣ:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2]$row[4]  Î¤Î¡ÎŸÎ ÎŸÎ ÎŸÎ™Î—ΣΗ
\n"; +} + +###################### +# ADD=999999 display reports section +###################### +if ($ADD==999999) +{ + if ($LOGview_reports==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_conferences order by conf_exten"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + + $stmt="select * from servers;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $servers_to_print = mysql_num_rows($rslt); + $i=0; + while ($i < $servers_to_print) + { + $row=mysql_fetch_row($rslt); + $server_id[$i] = $row[0]; + $server_description[$i] = $row[1]; + $server_ip[$i] = $row[2]; + $active[$i] = $row[3]; + $i++; + } + + $stmt="SELECT enable_queuemetrics_logging,queuemetrics_url from system_settings;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $enable_queuemetrics_logging_LU = $row[0]; + $queuemetrics_url_LU = $row[1]; + + ?> + + + + + + VICIDIAL: Στατιστικά Διακομιστή and Reports + VICIDIAL: Στατιστικά Διακομιστή and Reports

+ +

+	
+	 $o)
+		{
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		$o++;
+		}
+
+	echo "
SERVERΠΕΡΙΓΡΑΦΗIP ADDRESSΕÎΕΡΓΟVDAD timePARK timeCLOSER/INBOUND time
$server_id[$o]$server_description[$o]$server_ip[$o]$active[$o]LINKLINKLINK
\n"; + } + else + { + echo "Δεν έχετε την άδεια να δείτε αυτήν την σελίδα\n"; + exit; + } +} + + + + + +echo "
\n"; + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n
\n"; + + +echo "\n\n\n


\nχÏόνος εκτέλεσης διαδικασίας: $RUNtime seconds"; +echo "                   ΕΚΔΟΣΗ: $admin_version"; +echo "                   ΔΗΜΙΟΥΡΓΙΑ: $build
\n"; + + +?> + + +
+ + + +1) + { + if (strlen($dial_statuses)>2) + { + $g=0; + $p='13'; + $GMT_gmt[0] = ''; + $GMT_hour[0] = ''; + $GMT_day[0] = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $pmin=(gmdate("i", time() + $pzone)); + $phour=( (gmdate("G", time() + $pzone)) * 100); + $pday=gmdate("w", time() + $pzone); + $tz = sprintf("%.2f", $p); + $GMT_gmt[$g] = "$tz"; + $GMT_day[$g] = "$pday"; + $GMT_hour[$g] = ($phour + $pmin); + $p = ($p - 0.25); + $g++; + } + + $stmt="SELECT * FROM vicidial_call_times where call_time_id='$local_call_time';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $Gct_default_start = "$rowx[3]"; + $Gct_default_stop = "$rowx[4]"; + $Gct_sunday_start = "$rowx[5]"; + $Gct_sunday_stop = "$rowx[6]"; + $Gct_monday_start = "$rowx[7]"; + $Gct_monday_stop = "$rowx[8]"; + $Gct_tuesday_start = "$rowx[9]"; + $Gct_tuesday_stop = "$rowx[10]"; + $Gct_wednesday_start = "$rowx[11]"; + $Gct_wednesday_stop = "$rowx[12]"; + $Gct_thursday_start = "$rowx[13]"; + $Gct_thursday_stop = "$rowx[14]"; + $Gct_friday_start = "$rowx[15]"; + $Gct_friday_stop = "$rowx[16]"; + $Gct_saturday_start = "$rowx[17]"; + $Gct_saturday_stop = "$rowx[18]"; + $Gct_state_call_times = "$rowx[19]"; + + $ct_states = ''; + $ct_state_gmt_SQL = ''; + $ct_srs=0; + $b=0; + if (strlen($Gct_state_call_times)>2) + { + $state_rules = explode('|',$Gct_state_call_times); + $ct_srs = ((count($state_rules)) - 2); + } + while($ct_srs >= $b) + { + if (strlen($state_rules[$b])>1) + { + $stmt="SELECT * from vicidial_state_call_times where state_call_time_id='$state_rules[$b]';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Gstate_call_time_id = "$row[0]"; + $Gstate_call_time_state = "$row[1]"; + $Gsct_default_start = "$row[4]"; + $Gsct_default_stop = "$row[5]"; + $Gsct_sunday_start = "$row[6]"; + $Gsct_sunday_stop = "$row[7]"; + $Gsct_monday_start = "$row[8]"; + $Gsct_monday_stop = "$row[9]"; + $Gsct_tuesday_start = "$row[10]"; + $Gsct_tuesday_stop = "$row[11]"; + $Gsct_wednesday_start = "$row[12]"; + $Gsct_wednesday_stop = "$row[13]"; + $Gsct_thursday_start = "$row[14]"; + $Gsct_thursday_stop = "$row[15]"; + $Gsct_friday_start = "$row[16]"; + $Gsct_friday_stop = "$row[17]"; + $Gsct_saturday_start = "$row[18]"; + $Gsct_saturday_stop = "$row[19]"; + + $ct_states .="'$Gstate_call_time_state',"; + + $r=0; + $state_gmt=''; + while($r < $g) + { + if ($GMT_day[$r]==0) #### Sunday τοπικός χÏόνος + { + if (($Gsct_sunday_start==0) and ($Gsct_sunday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_sunday_start) and ($GMT_hour[$r]<$Gsct_sunday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==1) #### Monday τοπικός χÏόνος + { + if (($Gsct_monday_start==0) and ($Gsct_monday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_monday_start) and ($GMT_hour[$r]<$Gsct_monday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==2) #### Tuesday τοπικός χÏόνος + { + if (($Gsct_tuesday_start==0) and ($Gsct_tuesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_tuesday_start) and ($GMT_hour[$r]<$Gsct_tuesday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==3) #### Wednesday τοπικός χÏόνος + { + if (($Gsct_wednesday_start==0) and ($Gsct_wednesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_wednesday_start) and ($GMT_hour[$r]<$Gsct_wednesday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==4) #### Thursday τοπικός χÏόνος + { + if (($Gsct_thursday_start==0) and ($Gsct_thursday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_thursday_start) and ($GMT_hour[$r]<$Gsct_thursday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==5) #### Friday τοπικός χÏόνος + { + if (($Gsct_friday_start==0) and ($Gsct_friday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_friday_start) and ($GMT_hour[$r]<$Gsct_friday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==6) #### Saturday τοπικός χÏόνος + { + if (($Gsct_saturday_start==0) and ($Gsct_saturday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_saturday_start) and ($GMT_hour[$r]<$Gsct_saturday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + $r++; + } + $state_gmt = "$state_gmt'99'"; + $ct_state_gmt_SQL .= "or (state='$Gstate_call_time_state' and gmt_offset_now IN($state_gmt)) "; + } + + $b++; + } + if (strlen($ct_states)>2) + { + $ct_states = eregi_replace(",$",'',$ct_states); + $ct_statesSQL = "and state NOT IN($ct_states)"; + } + else + { + $ct_statesSQL = ""; + } + + $r=0; + $default_gmt=''; + while($r < $g) + { + if ($GMT_day[$r]==0) #### Sunday τοπικός χÏόνος + { + if (($Gct_sunday_start==0) and ($Gct_sunday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_sunday_start) and ($GMT_hour[$r]<$Gct_sunday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==1) #### Monday τοπικός χÏόνος + { + if (($Gct_monday_start==0) and ($Gct_monday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_monday_start) and ($GMT_hour[$r]<$Gct_monday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==2) #### Tuesday τοπικός χÏόνος + { + if (($Gct_tuesday_start==0) and ($Gct_tuesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_tuesday_start) and ($GMT_hour[$r]<$Gct_tuesday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==3) #### Wednesday τοπικός χÏόνος + { + if (($Gct_wednesday_start==0) and ($Gct_wednesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_wednesday_start) and ($GMT_hour[$r]<$Gct_wednesday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==4) #### Thursday τοπικός χÏόνος + { + if (($Gct_thursday_start==0) and ($Gct_thursday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_thursday_start) and ($GMT_hour[$r]<$Gct_thursday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==5) #### Friday τοπικός χÏόνος + { + if (($Gct_friday_start==0) and ($Gct_friday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_friday_start) and ($GMT_hour[$r]<$Gct_friday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==6) #### Saturday τοπικός χÏόνος + { + if (($Gct_saturday_start==0) and ($Gct_saturday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_saturday_start) and ($GMT_hour[$r]<$Gct_saturday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + $r++; + } + + $default_gmt = "$default_gmt'99'"; + $all_gmtSQL = "(gmt_offset_now IN($default_gmt) $ct_statesSQL) $ct_state_gmt_SQL"; + + + $dial_statuses = preg_replace("/ -$/","",$dial_statuses); + $Dstatuses = explode(" ", $dial_statuses); + $Ds_to_print = (count($Dstatuses) - 0); + $Dsql = ''; + $o=0; + while ($Ds_to_print > $o) + { + $o++; + $Dsql .= "'$Dstatuses[$o]',"; + } + $Dsql = preg_replace("/,$/","",$Dsql); + + $stmt="SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN($Dsql) and list_id IN($camp_lists) and ($all_gmtSQL) $fSQL"; + #$DB=1; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rslt_rows = mysql_num_rows($rslt); + if ($rslt_rows) + { + $rowx=mysql_fetch_row($rslt); + $active_leads = "$rowx[0]"; + } + else {$active_leads = '0';} + + echo "|$DB|\n"; + echo "Αυτή η εκστÏατεία έχει$active_leads οδηγοί που καλοÏντε στις λίστες\n"; + } + else + { + echo "καμία θέση πινάκων που επιλέγεται για αυτήν την εκστÏατεία\n"; + } + } + else + { + echo "δεν έχουν επιλεχθεί ενεÏγές λίστες για την εκστÏατεία\n"; + } + } +else + { + echo "δεν έχουν επιλεχθεί ενεÏγές λίστες για την εκστÏατεία\n"; + } +##### END calculate what gmt_offset_now values are within the allowed local_call_time setting ### +} +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/admin_modify_lead.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/admin_modify_lead.php new file mode 100644 index 00000000..76af1164 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/admin_modify_lead.php @@ -0,0 +1,610 @@ + LICENSE: GPLv2 +# + +# CHANGES +# +# 70702-1259 - Added recording location link and truncation +# 70906-2132 - Added closer_log records display +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} +if (isset($_GET["phone"])) {$phone=$_GET["phone"];} + elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];} + elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];} +if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];} + elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];} +if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];} + elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];} +if (isset($_GET["end_call"])) {$end_call=$_GET["end_call"];} + elseif (isset($_POST["end_call"])) {$end_call=$_POST["end_call"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];} + elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];} + elseif (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["call_began"])) {$call_began=$_GET["call_began"];} + elseif (isset($_POST["call_began"])) {$call_began=$_POST["call_began"];} +if (isset($_GET["parked_time"])) {$parked_time=$_GET["parked_time"];} + elseif (isset($_POST["parked_time"])) {$parked_time=$_POST["parked_time"];} +if (isset($_GET["tsr"])) {$tsr=$_GET["tsr"];} + elseif (isset($_POST["tsr"])) {$tsr=$_POST["tsr"];} +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["postal_code"])) {$postal_code=$_GET["postal_code"];} + elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];} +if (isset($_GET["province"])) {$province=$_GET["province"];} + elseif (isset($_POST["province"])) {$province=$_POST["province"];} +if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];} + elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];} +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"])) {$security=$_GET["security"];} + elseif (isset($_POST["security"])) {$security=$_POST["security"];} +if (isset($_GET["comments"])) {$comments=$_GET["comments"];} + elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"];} + elseif (isset($_POST["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];} +if (isset($_GET["CBchangeUSERtoANY"])) {$CBchangeUSERtoANY=$_GET["CBchangeUSERtoANY"];} + elseif (isset($_POST["CBchangeUSERtoANY"])) {$CBchangeUSERtoANY=$_POST["CBchangeUSERtoANY"];} +if (isset($_GET["CBchangeUSERtoUSER"])) {$CBchangeUSERtoUSER=$_GET["CBchangeUSERtoUSER"];} + elseif (isset($_POST["CBchangeUSERtoUSER"])) {$CBchangeUSERtoUSER=$_POST["CBchangeUSERtoUSER"];} +if (isset($_GET["CBchangeANYtoUSER"])) {$CBchangeANYtoUSER=$_GET["CBchangeANYtoUSER"];} + elseif (isset($_POST["CBchangeANYtoUSER"])) {$CBchangeANYtoUSER=$_POST["CBchangeANYtoUSER"];} +if (isset($_GET["callback_id"])) {$callback_id=$_GET["callback_id"];} + elseif (isset($_POST["callback_id"])) {$callback_id=$_POST["callback_id"];} +if (isset($_GET["CBuser"])) {$CBuser=$_GET["CBuser"];} + elseif (isset($_POST["CBuser"])) {$CBuser=$_POST["CBuser"];} +if (isset($_GET["modify_logs"])) {$modify_logs=$_GET["modify_logs"];} + elseif (isset($_POST["modify_logs"])) {$modify_logs=$_POST["modify_logs"];} + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + + +### AST GUI database administration modify lead in vicidial_list +### admin_modify_lead.php + +# this is the administration lead information modifier screen, the administrator just needs to enter the leadID and then they can view and modify the information in the record for that lead + +# CHANGES +# +# 60419-1705 - Added ability to change lead callback record from USERONLY to ANYONE or USERONLY-user +# 60421-1459 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60609-1112 - Added DNC list addition if status changed to DNC +# 60619-1539 - Added variable filtering to eliminate SQL injection attack threat +# 61130-1639 - Added recording_log lookup and list for this lead_id +# 61201-1136 - Added recording_log user(TSR) display and link +# 70305-1133 - Changed to default CHECKED modify logs upon status change +# 70424-1128 - Added campaign-specific statuses, reformatted recordings list +# + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); + + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and modify_leads='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $stmt="SELECT full_name,modify_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[0]; + $LOGmodify_leads =$row[1]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +?> + + + +ΔΙΑΧΕΙΡΙΣΗ: ΤÏοποποίηση Î¿Î´Î·Î³Î¿Ï + + +
+ΔΙΑΧΕΙΡΙΣΗ: ΤÏοποποίηση οδηγοÏ
\n"; + +if ($end_call > 0) +{ + +$call_length = ($STARTtime - $call_began); + + ### insert a NEW record to the vicidial_closer_log table + $stmt="INSERT INTO vicidial_closer_log (lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed) values('" . mysql_real_escape_string($lead_id) . "','" . mysql_real_escape_string($list_id) . "','" . mysql_real_escape_string($campaign_id) . "','" . mysql_real_escape_string($parked_time) . "','" . mysql_real_escape_string($call_began) . "','$STARTtime','" . mysql_real_escape_string($call_length) . "','" . mysql_real_escape_string($status) . "','" . mysql_real_escape_string($phone_code) . "','" . mysql_real_escape_string($phone_number) . "','$PHP_AUTH_USER','" . mysql_real_escape_string($comments) . "','Y')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ### update the lead record in the vicidial_list table + $stmt="UPDATE vicidial_list set status='" . mysql_real_escape_string($status) . "',first_name='" . mysql_real_escape_string($first_name) . "',last_name='" . mysql_real_escape_string($last_name) . "',address1='" . mysql_real_escape_string($address1) . "',address2='" . mysql_real_escape_string($address2) . "',address3='" . mysql_real_escape_string($address3) . "',city='" . mysql_real_escape_string($city) . "',state='" . mysql_real_escape_string($state) . "',province='" . mysql_real_escape_string($province) . "',postal_code='" . mysql_real_escape_string($postal_code) . "',country_code='" . mysql_real_escape_string($country_code) . "',alt_phone='" . mysql_real_escape_string($alt_phone) . "',email='" . mysql_real_escape_string($email) . "',security_phrase='" . mysql_real_escape_string($security) . "',comments='" . mysql_real_escape_string($comments) . "' where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "οι πληÏοφοÏίες Ï„Ïοποποιήθηκαν

\n"; + echo "\n"; + + if ( ($dispo != $status) and ($dispo == 'CBHOLD') ) + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='" . mysql_real_escape_string($lead_id) . "' and status='ACTIVE';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record inactivated: $lead_id
\n"; + } + if ( ($dispo != $status) and ($dispo == 'CALLBK') ) + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='" . mysql_real_escape_string($lead_id) . "' and status IN('ACTIVE','LIVE');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record inactivated: $lead_id
\n"; + } + + if ( ($dispo != $status) and ($status == 'DNC') ) + { + ### add lead to the internal DNC list + $stmt="INSERT INTO vicidial_dnc (phone_number) values('" . mysql_real_escape_string($phone_number) . "');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
Lead added to DNC List: $lead_id - $phone_number
\n"; + } + ### update last record in vicidial_agent_log and vicidial_log tables + if (($dispo != $status) and ($modify_logs > 0)) + { + $stmt="UPDATE vicidial_log set status='" . mysql_real_escape_string($status) . "' where lead_id='" . mysql_real_escape_string($lead_id) . "' order by call_date desc limit 1"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_agent_log set status='" . mysql_real_escape_string($status) . "' where lead_id='" . mysql_real_escape_string($lead_id) . "' order by agent_log_id desc limit 1"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + } + +} +else +{ + + if ($CBchangeUSERtoANY == 'YES') + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set recipient='ANYONE' where callback_id='" . mysql_real_escape_string($callback_id) . "';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record changed to ANYONE
\n"; + } + if ($CBchangeUSERtoUSER == 'YES') + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set user='" . mysql_real_escape_string($CBuser) . "' where callback_id='" . mysql_real_escape_string($callback_id) . "';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record user changed to $CBuser
\n"; + } + if ($CBchangeANYtoUSER == 'YES') + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set user='" . mysql_real_escape_string($CBuser) . "',recipient='USERONLY' where callback_id='" . mysql_real_escape_string($callback_id) . "';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record changed to USERONLY, user: $CBuser
\n"; + } + + + + $stmt="SELECT count(*) from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_count = $row[0]; + + if ($lead_count > 0) + { + + $stmt="select * from vicidial_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by uniqueid desc limit 500;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + $call_log = ''; + $log_campaign = ''; + while ($logs_to_print > $u) + { + $row=mysql_fetch_row($rslt); + if (strlen($log_campaign)<1) {$log_campaign = $row[3];} + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $u++; + $call_log .= "
"; + $call_log .= ""; + $call_log .= ""; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + + } + + $stmt="select * from vicidial_closer_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by closecallid desc limit 500;"; + $rslt=mysql_query($stmt, $link); + $Clogs_to_print = mysql_num_rows($rslt); + + $y=0; + $closer_log = ''; + $Clog_campaign = ''; + while ($Clogs_to_print > $y) + { + $row=mysql_fetch_row($rslt); + if (strlen($Clog_campaign)<1) {$Clog_campaign = $row[3];} + if (eregi("1$|3$|5$|7$|9$", $y)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $y++; + $closer_log .= ""; + $closer_log .= ""; + $closer_log .= ""; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + + } + + $stmt="SELECT * from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_id = "$row[0]"; + $dispo = "$row[3]"; + $tsr = "$row[4]"; + $vendor_id = "$row[5]"; + $list_id = "$row[7]"; + $campaign_id = "$row[8]"; + $phone_code = "$row[10]"; + $phone_number = "$row[11]"; + $title = "$row[12]"; + $first_name = "$row[13]"; # + $middle_initial = "$row[14]"; + $last_name = "$row[15]"; # + $address1 = "$row[16]"; # + $address2 = "$row[17]"; # + $address3 = "$row[18]"; # + $city = "$row[19]"; # + $state = "$row[20]"; # + $province = "$row[21]"; # + $postal_code = "$row[22]"; # + $country_code = "$row[23]"; # + $gender = "$row[24]"; + $date_of_birth = "$row[25]"; + $alt_phone = "$row[26]"; # + $email = "$row[27]"; # + $security = "$row[28]"; # + $comments = "$row[29]"; # + + echo "
ΠληÏοφοÏίες Κλήσης: $first_name $last_name - $phone_number

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
$u$row[4] $row[7] $row[8] $row[11] $row[3] $row[2] $row[1]
$y$row[4] $row[7] $row[8] $row[11] $row[3] $row[2] $row[1]   $row[14]
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + echo "\n"; + + echo "\n"; + echo "
Vendor ID: $vendor_id     Lead ID: $lead_id
Fronter: $tsr     ID Λίστας: $list_id
Ονομα:   \n"; + echo " Επίθετο:
ΔιεÏθυνση 1 :
ΔιεÏθυνση 2 :
ΔιεÏθυνση 3 :
Πόλη :
ΚÏάτος:   \n"; + echo "Ταχ.Κωδ.
ΧώÏα :
Εναλ Τηλέφωνο :
Ασφάλεια :
Σχόλια :
ΤεÏματισμός: (with $log_campaign statuses)
Modify agent and vicidial logs
\n"; + echo "


\n"; + + if ( ($dispo == 'CALLBK') or ($dispo == 'CBHOLD') ) + { + ### find any vicidial_callback records for this lead + $stmt="select * from vicidial_callbacks where lead_id='" . mysql_real_escape_string($lead_id) . "' and status IN('ACTIVE','LIVE') order by callback_id desc LIMIT 1;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $CB_to_print = mysql_num_rows($rslt); + $rowx=mysql_fetch_row($rslt); + + if ($CB_to_print>0) + { + if ($rowx[9] == 'USERONLY') + { + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "

\n"; + + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "New Callback Owner UserID: \n"; + echo "

\n"; + } + else + { + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "New Callback Owner UserID: \n"; + echo "

\n"; + } + } + else + { + echo "
No Callback records found
\n"; + } + } + + + + + + + } + else + { + echo "ΑΠΟΤΥΧΙΑ ψαξίματος καθοδήγησης για lead_id $lead_id       $NOW_TIME\n

\n"; +# echo "Close this window\n

\n"; + } + + + +echo "

\n"; + +echo "
\n"; + +echo "Κλήσεις για αυτόν τον οδηγό:\n"; +echo "\n"; +echo "\n"; + + echo "$call_log\n"; + +echo "
# DATE/TIME LENGTH STATUS TSRΕΚΣΤΡΑΤΕΙΑ LIST LEAD
\n"; +echo "

\n"; + +echo "CLOSER RECORDS FOR THIS LEAD:\n"; +echo "\n"; +echo "\n"; + + echo "$closer_log\n"; + +echo "
# DATE/TIME LENGTH STATUS TSRΕΚΣΤΡΑΤΕΙΑ LIST LEAD WAIT
\n"; +echo "

\n"; + + +echo "RECORDINGS FOR THIS LEAD:\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from recording_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by recording_id desc limit 500;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) + { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $location = $row[11]; + if (strlen($location)>30) + {$locat = substr($location,0,27); $locat = "$locat...";} + else + {$locat = $location;} + if (eregi("http",$location)) + {$location = "$locat";} + else + {$location = $locat;} + $u++; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + + } + + +echo "
# LEADDATE/TIME SECONDS   RECIDFILENAMELOCATIONTSR
$u $row[12] $row[4] $row[8] $row[0]   $row[10] $location $row[13]
\n"; + + + + +} + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nχÏόνος εκτέλεσης διαδικασίας: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/admin_search_lead.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/admin_search_lead.php new file mode 100644 index 00000000..01549ba9 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/admin_search_lead.php @@ -0,0 +1,225 @@ + LICENSE: GPLv2 +### +### AST GUI database administration search for lead info +### admin_modify_lead.php +# +# this is the administration lead information modifier screen, the administrator just needs to enter the leadID and then they can view and modify the information in the record for that lead +# +# changes: +# 60620-1055 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# - Changed results to multi-record +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} +if (isset($_GET["phone"])) {$phone=$_GET["phone"];} + elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"];} + elseif (isset($_POST["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); + + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and modify_leads='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name,modify_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[0]; + $LOGmodify_leads =$row[1]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +?> + + + +ΔΙΑΧΕΙΡΙΣΗ: Αναζήτηση ÎŸÎ´Î·Î³Î¿Ï + +Ψάξιμο Καθοδήγησης + + +ΔΙΑΧΕΙΡΙΣΗ: Lead search
\n"; + + +if ( (!$vendor_id) and (!$phone) and (!$lead_id) ) + { + echo date("l F j, Y G:i:s A"); + echo "\n

\n"; + echo "
\n"; + echo "\n"; + echo "ΠαÏακαλώ καταχωÏήστε:
Vendor ID(αυτόματος κωδικός καθοδήγησης): or \n"; + echo "
ένας αÏιθμός τηλεφώνου ÏƒÏ€Î¹Ï„Î¹Î¿Ï or\n"; + echo "
ID οδηγοÏ

\n"; + echo "
\n"; + echo "\n
\n"; + echo "\n"; + exit; + } + +else + { + + if ($vendor_id) + { + $stmt="SELECT * from vicidial_list where vendor_lead_code='" . mysql_real_escape_string($vendor_id) . "' order by modify_date desc limit 1000"; + } + else + { + if ($phone) + { + $stmt="SELECT * from vicidial_list where phone_number='" . mysql_real_escape_string($phone) . "' order by modify_date desc limit 1000"; + } + else + { + if ($lead_id) + { + $stmt="SELECT * from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "' order by modify_date desc limit 1000"; + } + else + { + print "ERROR: you must search for something! Go back and search for something"; + exit; + } + } + } + if ($DB) + { + echo "\n\n$stmt\n\n"; + } + + $rslt=mysql_query($stmt, $link); + $results_to_print = mysql_num_rows($rslt); + if ($results_to_print < 1) + { + echo date("l F j, Y G:i:s A"); + echo "\n

\n"; + echo "Οι μεταβλητές αναζήτησης που καταχωÏήσατε δεν είναι ενεÏγές στο σÏστημα

\n"; + echo "ΠαÏακαλώ, επιστÏέψτε πίσω και ελέγξτε τις πληÏοφοÏίες που καταχωÏήσατε και Ï€Ïοσπαθήστε πάλι\n"; + echo "
\n"; + echo "\n"; + exit; + } + else + { + echo "RESULTS: $results_to_print

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + $o=0; + while ($results_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $o++; + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + echo "
#LEAD IDΚΑΤΑΣΤΑΣΗVENDOR IDLAST AGENTID ΛΙΣΤΑΣPHONEΟÎΟΜΑCITYSECURITYLAST CALL
$o$row[0]$row[3]$row[5]$row[4]$row[7]$row[11]$row[13] $row[15]$row[19]$row[28]$row[2]
\n"; + } + } + + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\nÎΕΑ ΑÎΑΖΗΤΗΣΗ"; + + +echo "\n\n\n


\nχÏόνος εκτέλεσης διαδικασίας: $RUNtime seconds"; + + +?> + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/count.htm b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/count.htm new file mode 100644 index 00000000..51f8a361 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/count.htm @@ -0,0 +1 @@ + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/dbconnect.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/dbconnect.php new file mode 100644 index 00000000..5247e166 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/dbconnect.php @@ -0,0 +1,49 @@ + LICENSE: GPLv2 +# +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"); +mysql_select_db("$VARDB_database"); + +$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 + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/group_hourly_stats.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/group_hourly_stats.php new file mode 100644 index 00000000..1f85a0e6 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/group_hourly_stats.php @@ -0,0 +1,252 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60620-1014 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["date_with_hour"])) {$date_with_hour=$_GET["date_with_hour"];} + elseif (isset($_POST["date_with_hour"])) {$date_with_hour=$_POST["date_with_hour"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"];} + elseif (isset($_POST["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$date_with_hour_default = date("Y-m-d H"); +$date_no_hour_default = $TODAY; + +if (!isset($date_with_hour)) {$date_with_hour = $date_with_hour_default;} + $date_no_hour = $date_with_hour; + $date_no_hour = eregi_replace(" ([0-9]{2})",'',$date_no_hour); +if (!isset($begin_date)) {$begin_date = $TODAY;} +if (!isset($end_date)) {$end_date = $TODAY;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + +# $stmt="SELECT full_name from vicidial_users where user='$user';"; +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# $full_name = $row[0]; + + } + + + + +?> + + +ΔΙΑΧΕΙΡΙΣΗ: Ομαδοποιημένα ΩÏιαία Στατιστικά +\n"; +?> + + +
+ + + + + += '" . mysql_real_escape_string($date_with_hour) . ":00:00' and call_date <= '" . mysql_real_escape_string($date_with_hour) . ":59:59' and user='$VDuser[$o]';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDtotal[$o] = "$row[0]"; + + $stmt="select count(*) from vicidial_log where call_date >= '" . mysql_real_escape_string($date_no_hour) . " 00:00:00' and call_date <= '" . mysql_real_escape_string($date_no_hour) . " 23:59:59' and user='$VDuser[$o]' and status='" . mysql_real_escape_string($status) . "';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDday[$o] = "$row[0]"; + + $stmt="select count(*) from vicidial_log where call_date >= '" . mysql_real_escape_string($date_with_hour) . ":00:00' and call_date <= '" . mysql_real_escape_string($date_with_hour) . ":59:59' and user='$VDuser[$o]' and status='" . mysql_real_escape_string($status) . "';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDcount[$o] = "$row[0]"; + $o++; + } + +echo "
" ?>   ΔΙΑΧΕΙΡΙΣΗ: Ομαδοποιημένα ΩÏιαία Στατιστικά  
\n"; + +echo "
\n"; + +echo "ΜΕΤΡΗΣΗ ΩΡΩΠTSR: $group | $status | $date_with_hour | $date_no_hour\n"; + +echo "
\n"; +echo "\n"; + + $day_calls=0; + $hour_calls=0; + $total_calls=0; + $o=0; + while($o < $tsrs_to_print) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + $total_calls = ($total_calls + $VDtotal[$o]); + $hour_calls = ($hour_calls + $VDcount[$o]); + $day_calls = ($day_calls + $VDday[$o]); + + $o++; + } + +echo "\n"; + + +} + +echo "
TSR ID   $status   ΣΥÎΟΛΙΚΕΣ ΚΛΗΣΕΙΣ   $status DAY    
$VDuser[$o] $VDname[$o] $VDcount[$o] $VDtotal[$o] $VDday[$o]ΤΡΟΠΟΠΟΙΗΣΗ | ΣΤΑΤΙΣΤΙΚΑ
TOTAL $status $hour_calls $total_calls $day_calls
\n"; +echo "

\n"; + + + echo "
ΠαÏακαλώ, καταχωÏήστε την ομάδα για την οποία θέλετε στατιστικά ανά ÏŽÏα:
\n"; + echo "\n"; + echo "group:
\n"; + echo "status:   (example: XFER)
\n"; + echo "date with hour:   (example: 2004-06-25 14)
\n"; + echo "\n"; + echo "


\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nχÏόνος εκτέλεσης διαδικασίας: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/help.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/help.gif new file mode 100644 index 00000000..5575d7c8 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/help.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/listloader.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/listloader.php new file mode 100644 index 00000000..234b2be7 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/listloader.php @@ -0,0 +1,926 @@ + LICENSE: GPLv2 +# +# AST Web GUI lead loader from formatted file +# +# CHANGES +# 50602-1640 - First version created by Joe Johnson +# 51128-1108 - Removed PHP global vars requirement +# 60421-1043 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60616-1006 - added listID override and gmt_offset lookup while loading +# 60619-1652 - Added variable filtering to eliminate SQL injection attack threat +# 60822-1105 - fixed for nonwritable directories +# 60906-1059 - added filter of non-digits in alt_phone field +# 61110-1222 - added new USA-Canada DST scheme and Brazil DST scheme +# 61128-1046 - added postal code GMT lookup and duplicate check options +# 70205-1703 - Defaulted phone_code to 1 if not populated +# 70417-1059 - Fixed default phone_code bug +# +# make sure vicidial_list exists and that your file follows the formatting correctly. This page does not dedupe or do any other lead filtering actions yet at this time. +# + +$version = '2.0.3'; +$build = '770417-1059'; + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$leadfile=$_FILES["leadfile"]; + $LF_orig = $_FILES['leadfile']['name']; + $LF_path = $_FILES['leadfile']['tmp_name']; +$submit_file=$_GET["submit_file"]; if (!$submit_file) {$submit_file=$_POST["submit_file"];} +$list_id_override=$_GET["list_id_override"]; if (!$list_id_override) {$list_id_override=$_POST["list_id_override"];} + $list_id_override = (preg_replace("/\D/","",$list_id_override)); +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"]; if (!$ΕΠΙΒΕΒΑΙΩΣΗ) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];} +if (isset($_GET["dupcheck"])) {$dupcheck=$_GET["dupcheck"];} + elseif (isset($_POST["dupcheck"])) {$dupcheck=$_POST["dupcheck"];} +if (isset($_GET["postalgmt"])) {$postalgmt=$_GET["postalgmt"];} + elseif (isset($_POST["postalgmt"])) {$postalgmt=$_POST["postalgmt"];} + + +#$DB=1; +#$DBX=1; + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); +$list_id_override = ereg_replace("[^0-9]","",$list_id_override); + + +$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://';} +$admDIR = "$HTTPprotocol$server_name$script_name"; +$admDIR = eregi_replace('listloader.php','',$admDIR); +$admSCR = 'admin.php'; +$NWB = "   \"ΒΟΗΘΕΙΑ\""; + + +$secX = date("U"); +$hour = date("H"); +$min = date("i"); +$sec = date("s"); +$mon = date("m"); +$mday = date("d"); +$year = date("Y"); +$isdst = date("I"); +$Shour = date("H"); +$Smin = date("i"); +$Ssec = date("s"); +$Smon = date("m"); +$Smday = date("d"); +$Syear = date("Y"); +$pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; +$inSD = $pulldate0; +$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + ### Grab Server GMT value from the database + $stmt="SELECT local_gmt FROM servers where server_ip = '$server_ip';"; + $rslt=mysql_query($stmt, $link); + $gmt_recs = mysql_num_rows($rslt); + if ($gmt_recs > 0) + { + $row=mysql_fetch_row($rslt); + $DBSERVER_GMT = "$row[0]"; + if (strlen($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;} + if ($isdst) {$SERVER_GMT++;} + } + else + { + $SERVER_GMT = date("O"); + $SERVER_GMT = eregi_replace("\+","",$SERVER_GMT); + $SERVER_GMT = ($SERVER_GMT + 0); + $SERVER_GMT = ($SERVER_GMT / 100); + } + + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + +#if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";} + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + +?> + + + + + + method=post enctype="multipart/form-data"> +
+ + + + + + + + + + + + + + + + + + + + + +
Εισαγωγή οδηγών από αυτό το αÏχείο:
ID Λίστας Override: (μόνο αÏιθμοί or leave blank for values in the file)
Διπλός έλεγχος μολÏβδου:
ΣυμβοÏλευση ζώνης χÏονικής ανοχής:
ΕΠΙΛΕΞΤΕ ΕΔΩ ΓΙΑ ÎΑ ΠΑΤΕ ΣΤΟΠΠΡΟΗΓΜΕÎΟ ΕΙΣΑΓΩΓΕΑ ΟΔΗΓΩΠ(BETA ΕΚΔΟΣΗ)     ΠΙΣΩ ΣΤΗ ΔΙΑΧΕΙΡΙΣΗ
+ +document.forms[0].leadfile.disabled=true; document.forms[0].submit_file.disabled=true; document.forms[0].reload_page.disabled=true;"; + flush(); + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"); + $lead_file = "./vicidial_temp_file.txt"; + } + else + { + $lead_file = "$LF_path"; + } + $file=fopen("$lead_file", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + $pulldate=date("Y-m-d H:i:s"); + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + + if (count($field_check)>=5) { + flush(); + $file=fopen("$lead_file", "r"); + $total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list=''; + print "
ΕπεξεÏγασία$delim_name-delimited file... ($tab_count|$pipe_count)\n"; + + if (strlen($list_id_override)>0) + { + print "

ID ΛΙΣΤΑΣ OVERRIDE FOR THIS FILE: $list_id_override

"; + } + + while (!feof($file)) { + $record++; + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + + if (strlen($buffer)>0) { + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + $vendor_lead_code = $row[0]; + $source_code = $row[1]; + $source_id=$source_code; + $list_id = $row[2]; + $phone_code = eregi_replace("[^0-9]", "", $row[3]); + $phone_number = eregi_replace("[^0-9]", "", $row[4]); + $USarea = substr($phone_number, 0, 3); + $title = $row[5]; + $first_name = $row[6]; + $middle_initial = $row[7]; + $last_name = $row[8]; + $address1 = $row[9]; + $address2 = $row[10]; + $address3 = $row[11]; + $city = $row[12]; + $state = $row[13]; + $province = $row[14]; + $postal_code = $row[15]; + $country = $row[16]; + $gender = $row[17]; + $date_of_birth = $row[18]; + $alt_phone = eregi_replace("[^0-9]", "", $row[19]); + $email = $row[20]; + $security_phrase = $row[21]; + $comments = trim($row[22]); + + if (strlen($list_id_override)>0) + { + # print "

ID ΛΙΣΤΑΣ OVERRIDE FOR THIS FILE: $list_id_override

"; + $list_id = $list_id_override; + } + + ##### Check for duplicate phone numbers in vicidial_list table ##### + if (eregi("DUP",$dupcheck)) + { + $dup_lead=0; + $stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_lead = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + if ( (strlen($phone_number)>6) and ($dup_lead<1) ) + { + $US='_'; + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user = ""; + $gmt_offset = '0'; + $called_since_last_reset='N'; + $phone_list .= "$phone_number$US$list_id|"; + + if (strlen($phone_code)<1) {$phone_code = '1';} + + $postalgmt_found=0; + if ( (eregi("POSTAL",$postalgmt)) && (strlen($postal_code)>4) ) + { + if (preg_match('/^1$/', $phone_code)) + { + $stmt="select * from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[2]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[3]; + $dst_range = $row[4]; + $PC_processed++; + $postalgmt_found++; + $post++; + } + } + } + if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =='1') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### MEXICO ### + if ($phone_code =='52') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### AUSTRALIA ### + if ($phone_code =='61') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $PC_processed++; + $stmt="select * from vicidial_phone_codes where country_code='$phone_code';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + } + + ### Find out if DST to raise the gmt offset ### + $AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); + $AC_localtime = mktime(($Shour + $AC_GMT_diff), $Smin, $Ssec, $Smon, $Smday, $Syear); + $hour = date("H",$AC_localtime); + $min = date("i",$AC_localtime); + $sec = date("s",$AC_localtime); + $mon = date("m",$AC_localtime); + $mday = date("d",$AC_localtime); + $wday = date("w",$AC_localtime); + $year = date("Y",$AC_localtime); + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + if ( (!$AC_processed) and ($dst_range == 'SSM-FSN') ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + #********************************************************************** + # SSM-FSN + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on Second Sunday March to First Sunday November at 2 am. + # INPUTS: + # mm INTEGER Month. + # dd INTEGER Day of the month. + # ns INTEGER Seconds into the day. + # dow INTEGER Day of week (0=Sunday, to 6=Saturday) + # OPTIONAL INPUT: + # timezone INTEGER hour difference UTC - local standard time + # (DEFAULT is blank) + # make calculations based on UTC time, + # which means shift at 10:00 UTC in April + # and 9:00 UTC in October + # OUTPUT: + # INTEGER 1 = DST, 0 = not DST + # + # S M T W T F S + # 1 2 3 4 5 6 7 + # 8 9 10 11 12 13 14 + #15 16 17 18 19 20 21 + #22 23 24 25 26 27 28 + #29 30 31 + # + # S M T W T F S + # 1 2 3 4 5 6 + # 7 8 9 10 11 12 13 + #14 15 16 17 18 19 20 + #21 22 23 24 25 26 27 + #28 29 30 31 + # + #********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; + } elseif ($mm >= 4 and $mm <= 10) { + $USACAN_DST=1; + } elseif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; + } elseif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } + } else { + $USACAN_DST=0; + } + } elseif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; + } elseif ($dd < ($dow+1)) { + $USACAN_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } else { # τοπικός χÏόνος calculations + if ($ns < 7200) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } + } else { + $USACAN_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + #********************************************************************** + # FSA-LSO + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in April and last Sunday in October at 2 am. + #********************************************************************** + + $NA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $NA_DST=0; + } elseif ($mm >= 5 and $mm <= 9) { + $NA_DST=1; + } elseif ($mm == 4) { + if ($dd > 7) { + $NA_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $NA_DST=0; + } else { + $NA_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $NA_DST=0; + } else { + $NA_DST=1; + } + } + } else { + $NA_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $NA_DST=1; + } elseif ($dd < ($dow+25)) { + $NA_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $NA_DST=1; + } else { + $NA_DST=0; + } + } else { # τοπικός χÏόνος calculations + if ($ns < 7200) { + $NA_DST=1; + } else { + $NA_DST=0; + } + } + } else { + $NA_DST=0; + } + } # end of month checks + + if ($DBX) {print " DST: $NA_DST\n";} + if ($NA_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'LSM-LSO') ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in March and last Sunday in October at 1 am. + #********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; + } elseif ($mm >= 4 and $mm <= 9) { + $GBR_DST=1; + } elseif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; + } elseif ($dd < ($dow+25)) { + $GBR_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } else { # τοπικός χÏόνος calculations + if ($ns < 3600) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } + } else { + $GBR_DST=1; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; + } elseif ($dd < ($dow+25)) { + $GBR_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } else { # τοπικός χÏόνος calculations + if ($ns < 3600) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } + } else { + $GBR_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) and ($dst_range == 'LSO-LSM') ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUS_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; + } elseif ($dd < ($dow+25)) { + $AUS_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } else { # τοπικός χÏόνος calculations + if ($ns < 3600) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } + } else { + $AUS_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; + } elseif ($dd < ($dow+25)) { + $AUS_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } else { # τοπικός χÏόνος calculations + if ($ns < 3600) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } + } else { + $AUS_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-LSM') ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + #********************************************************************** + # TASMANIA ONLY + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUST_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; + } elseif ($dd < ($dow+25)) { + $AUST_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } else { # τοπικός χÏόνος calculations + if ($ns < 3600) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } + } else { + $AUST_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $AUST_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } + } else { + $AUST_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and third Sunday in March at 1 am. + #********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $NZL_DST=0; + } elseif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; + } elseif ($dd < ($dow+14)) { + $NZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } else { # τοπικός χÏόνος calculations + if ($ns < 3600) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } + } else { + $NZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $NZL_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } + } else { + $NZL_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + #********************************************************************** + # TSO-LSF + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. Brazil + # Based on Third Sunday October to Last Sunday February at 1 am. + #********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; + } elseif ($mm >= 3 and $mm <= 9) { + $BZL_DST=0; + } elseif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; + } elseif ($dd < ($dow+22)) { + $BZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } else { # τοπικός χÏόνος calculations + if ($ns < 3600) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } + } else { + $BZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; + } elseif ($dd < ($dow+22)) { + $BZL_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } else { # τοπικός χÏόνος calculations + if ($ns < 3600) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } + } else { + $BZL_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } + else + { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead\n";} + $bad++; + } + $total++; + if ($total%100==0) + { + print ""; + usleep(1000); + flush(); + } + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
DUPLICATE: $dup       POSTAL MATCH: $post
"; + + } else { + print "
Λάθος: Το αÏχείο δεν έχει τον απαιτοÏμενο αÏιθμό πεδίων.
"; + } + print ""; +} else if (filesize($leadfile)>8388608) { + print "
Λάθος: Το αÏχείο ξεπέÏασε το ÏŒÏιο των 8ΜΒ.
"; +} +?> + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/listloader.pl b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/listloader.pl new file mode 100644 index 00000000..d926368b --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/listloader.pl @@ -0,0 +1,1084 @@ +#!/usr/bin/perl + +### listloader.pl version 0.4 *DBI-version* +### +### Copyright (C) 2007 Matt Florell,Joe Johnson LICENSE: GPLv2 +### +# +# +# CHANGES +# 60616-1548 - Added listID override feature to force all leads into same list +# - Added gmt_offset_now lookup for each lead +# 60811-1232 - Changed to DBI +# 60811-1329 - changed to use /etc/astguiclient.conf for configs +# 60822-1121 - fixed for nonwritable directories +# 60906-1058 - added filter of non-digits in alt_phone field +# 61110-1229 - added new USA-Canada DST scheme and Brazil DST scheme +# 61128-1215 - added postal code GMT lookup and duplicate check options +# 70205-1703 - Defaulted phone_code to 1 if not populated +# 70417-1059 - Fixed default phone_code bug +# 70510-1518 - Added campaign and system duplicate check and phonecode override +# + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help|-h/i) + { + print "allowed run time options:\n [-forcelistid=1234] = overrides the listID given in the file with the 1234\n [-h] = this help screen\n\n"; + + exit; + } + else + { + if ($args =~ /-duplicate-check/i) + {$dupcheck=1;} + if ($args =~ /-duplicate-campaign-check/i) + {$dupcheckcamp=1;} + if ($args =~ /-duplicate-system-check/i) + {$dupchecksys=1;} + if ($args =~ /-postal-code-gmt/i) + {$postalgmt=1;} + if ($args =~ /--forcelistid=/i) + { + @data_in = split(/--forcelistid=/,$args); + $forcelistid = $data_in[1]; + $forcelistid =~ s/ .*//gi; + print "\n----- FORCE LISTID OVERRIDE: $forcelistid -----\n\n"; + } + else + {$forcelistid = '';} + + if ($args =~ /--forcephonecode=/i) + { + @data_in = split(/--forcephonecode=/,$args); + $forcephonecode = $data_in[1]; + $forcephonecode =~ s/ .*//gi; + print "\n----- FORCE PHONECODE OVERRIDE: $forcephonecode -----\n\n"; + } + else + {$forcephonecode = '';} + + if ($args =~ /--lead-file=/i) + { + @data_in = split(/--lead-file=/,$args); + $lead_file = $data_in[1]; + $lead_file =~ s/ .*//gi; + # print "\n----- LEAD FILE: $lead_file -----\n\n"; + } + else + {$lead_file = './vicidial_temp_file.xls';} + } +} +### end parsing run-time options ### + + +use Spreadsheet::ParseExcel; +use Time::Local; +use DBI; + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + +$|=0; +$secX = time(); + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($hour < 10) {$hour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +$pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; +$pulldate="$year-$mon-$mday $hour:$min:$sec"; +$inSD = $pulldate0; +$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + + ### Grab Server values from the database + $stmtA = "SELECT local_gmt FROM servers where server_ip = '$server_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBSERVER_GMT = "$aryA[0]"; + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + $rec_count++; + } + $sthA->finish(); + + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + +if ($isdst) {$LOCAL_GMT_OFF++;} +if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";} + + + +$total=0; $good=0; $bad=0; +print "
Processing Excel file...\n"; +open(STMT_FILE, "> $PATHlogs/listloader_stmts.txt"); + +$oBook = Spreadsheet::ParseExcel::Workbook->Parse("$lead_file"); +my($iR, $iC, $oWkS, $oWkC); + +foreach $oWkS (@{$oBook->{Worksheet}}) { + for($iR = 0 ; defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow} ; $iR++) { + + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user = ""; + $oWkC = $oWkS->{Cells}[$iR][0]; + if ($oWkC) {$vendor_lead_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][1]; + if ($oWkC) {$source_code=$oWkC->Value; } + $source_id=$source_code; + $oWkC = $oWkS->{Cells}[$iR][2]; + if ($oWkC) {$list_id=$oWkC->Value; } + $gmt_offset = '0'; + $called_since_last_reset='N'; + $oWkC = $oWkS->{Cells}[$iR][3]; + if ($oWkC) {$phone_code=$oWkC->Value; } + $phone_code=~s/[^0-9]//g; + $oWkC = $oWkS->{Cells}[$iR][4]; + if ($oWkC) {$phone_number=$oWkC->Value; } + $phone_number=~s/[^0-9]//g; + $USarea = substr($phone_number, 0, 3); + $oWkC = $oWkS->{Cells}[$iR][5]; + if ($oWkC) {$title=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][6]; + if ($oWkC) {$first_name=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][7]; + if ($oWkC) {$middle_initial=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][8]; + if ($oWkC) {$last_name=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][9]; + if ($oWkC) {$address1=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][10]; + if ($oWkC) {$address2=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][11]; + if ($oWkC) {$address3=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][12]; + if ($oWkC) {$city=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][13]; + if ($oWkC) {$state=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][14]; + if ($oWkC) {$province=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][15]; + if ($oWkC) {$postal_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][16]; + if ($oWkC) {$country=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][17]; + if ($oWkC) {$gender=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][18]; + if ($oWkC) {$date_of_birth=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][19]; + if ($oWkC) {$alt_phone=$oWkC->Value; } + $alt_phone=~s/[^0-9]//g; + $oWkC = $oWkS->{Cells}[$iR][20]; + if ($oWkC) {$email=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][21]; + if ($oWkC) {$security_phrase=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][22]; + if ($oWkC) {$comments=$oWkC->Value; } + $comments=~s/^\s*(.*?)\s*$/$1/; + + if (length($forcelistid) > 0) + { + $list_id = $forcelistid; # set list_id to override value + } + if (length($forcephonecode) > 0) + { + $phone_code = $forcephonecode; # set phone_code to override value + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if ($dupchecksys > 0) + { + $dup_lead=0; + $stmtA = "select count(*) from vicidial_list where phone_number='$phone_number';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $dup_lead = $aryA[0]; + $dup_lead_list=$list_id; + } + $sthA->finish(); + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if ($dupcheck > 0) + { + $dup_lead=0; + $stmtA = "select list_id from vicidial_list where phone_number='$phone_number' and list_id='$list_id' limit 1;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $dup_lead_list = $aryA[0]; + $dup_lead++; + } + $sthA->finish(); + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if ($dupcheckcamp > 0) + { + $dup_lead=0; + $dup_lists=''; + + $stmtA = "select count(*) from vicidial_lists where list_id='$list_id';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + @aryA = $sthA->fetchrow_array; + $ci_recs = $aryA[0]; + $sthA->finish(); + if ($ci_recs > 0) + { + $stmtA = "select campaign_id from vicidial_lists where list_id='$list_id';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + @aryA = $sthA->fetchrow_array; + $dup_camp = $aryA[0]; + $sthA->finish(); + + $stmtA = "select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $dup_lists .= "'$aryA[0]',"; + $rec_count++; + } + $sthA->finish(); + + chop($dup_lists); + $stmtA = "select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $dup_lead_list = "'$aryA[0]',"; + $rec_count++; + $dup_lead=1; + } + $sthA->finish(); + } + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + + if ( (length($phone_number)>6) && ($dup_lead < 1) ) + { + $phone_list .= "$phone_number$US$list_id|"; + $postalgmt_found=0; + if (length($phone_code)<1) {$phone_code = '1';} + + if ( ($postalgmt > 0) && (length($postal_code)>4) ) + { + if ($phone_code =~ /^1$/) + { + $stmtA = "select * from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[2]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[3]; + $dst_range = $aryA[4]; + $PC_processed++; + $rec_count++; + $postalgmt_found++; + if ($DBX) {print " Postal GMT record found for $postal_code: |$gmt_offset|$dst|$dst_range|\n";} + } + $sthA->finish(); + } + } + if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =~ /^1$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### MEXICO ### + if ($phone_code =~ /^52$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### AUSTRALIA ### + if ($phone_code =~ /^61$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + } + + ### Find out if DST to raise the gmt offset ### + $AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); + $AC_localtime = ($secX + (3600 * $AC_GMT_diff)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($AC_localtime); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + + if ( (!$AC_processed) && ($dst_range =~ /SSM-FSN/) ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + &USACAN_dstcalc; + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSA-LSO/) ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + &NA_dstcalc; + if ($DBX) {print " DST: $NA_DST\n";} + if ($NA_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /LSM-LSO/) ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + &GBR_dstcalc; + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /LSO-LSM/) ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + &AUS_dstcalc; + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSO-LSM/) ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + &AUST_dstcalc; + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSO-TSM/) ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + &NZL_dstcalc; + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /TSO-LSF/) ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + &BZL_dstcalc; + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$area_GMT++;} + $AC_processed++; + } + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $affected_rows = $dbhA->do($stmtZ); + print STMT_FILE $stmtZ."\r\n"; + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| $dup_lead_list\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + sleep(1); +# flush(); + } + } +} + +if ($multi_insert_counter > 0) { + $stmtZ = "INSERT INTO vicidial_list values ".substr($multistmt, 0, -1).";"; + $affected_rows = $dbhA->do($stmtZ); + print STMT_FILE $stmtZ."\r\n"; +} + +print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + +exit; + + + + + + +sub USACAN_dstcalc { +#********************************************************************** +# SSM-FSN +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on Second Sunday March to First Sunday November at 2 am. +# INPUTS: +# mm INTEGER Month. +# dd INTEGER Day of the month. +# ns INTEGER Seconds into the day. +# dow INTEGER Day of week (0=Sunday, to 6=Saturday) +# OPTIONAL INPUT: +# timezone INTEGER hour difference UTC - local standard time +# (DEFAULT is blank) +# make calculations based on UTC time, +# which means shift at 10:00 UTC in April +# and 9:00 UTC in October +# OUTPUT: +# INTEGER 1 = DST, 0 = not DST +# +# S M T W T F S +# 1 2 3 4 5 6 7 +# 8 9 10 11 12 13 14 +#15 16 17 18 19 20 21 +#22 23 24 25 26 27 28 +#29 30 31 +# +# S M T W T F S +# 1 2 3 4 5 6 +# 7 8 9 10 11 12 13 +#14 15 16 17 18 19 20 +#21 22 23 24 25 26 27 +#28 29 30 31 +# +#********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; return 0; + } elsif ($mm >= 4 && $mm <= 10) { + $USACAN_DST=1; return 1; + } elsif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; return 1; + } elsif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; return 0; + } else { + $USACAN_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $USACAN_DST=0; return 0; + } else { + $USACAN_DST=1; return 1; + } + } + } else { + $USACAN_DST=0; return 0; + } + } elsif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; return 0; + } elsif ($dd < ($dow+1)) { + $USACAN_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; return 1; + } else { + $USACAN_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; return 1; + } else { + $USACAN_DST=0; return 0; + } + } + } else { + $USACAN_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub NA_dstcalc { +#********************************************************************** +# FSA-LSO +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in April and last Sunday in October at 2 am. +#********************************************************************** + + $NA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $NA_DST=0; return 0; + } elsif ($mm >= 5 && $mm <= 9) { + $NA_DST=1; return 1; + } elsif ($mm == 4) { + if ($dd > 7) { + $NA_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $NA_DST=0; return 0; + } else { + $NA_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $NA_DST=0; return 0; + } else { + $NA_DST=1; return 1; + } + } + } else { + $NA_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $NA_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $NA_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $NA_DST=1; return 1; + } else { + $NA_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 7200) { + $NA_DST=1; return 1; + } else { + $NA_DST=0; return 0; + } + } + } else { + $NA_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub GBR_dstcalc { +#********************************************************************** +# LSM-LSO +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in March and last Sunday in October at 1 am. +#********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; return 0; + } elsif ($mm >= 4 && $mm <= 9) { + $GBR_DST=1; return 1; + } elsif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $GBR_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; return 0; + } else { + $GBR_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; return 0; + } else { + $GBR_DST=1; return 1; + } + } + } else { + $GBR_DST=1; return 1; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $GBR_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; return 1; + } else { + $GBR_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; return 1; + } else { + $GBR_DST=0; return 0; + } + } + } else { + $GBR_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub AUS_dstcalc { +#********************************************************************** +# LSO-LSM +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in October and last Sunday in March at 1 am. +#********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $AUS_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $AUS_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; return 1; + } else { + $AUS_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; return 1; + } else { + $AUS_DST=0; return 0; + } + } + } else { + $AUS_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $AUS_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; return 0; + } else { + $AUS_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; return 0; + } else { + $AUS_DST=1; return 1; + } + } + } else { + $AUS_DST=1; return 1; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub AUST_dstcalc { +#********************************************************************** +# FSO-LSM +# TASMANIA ONLY +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and last Sunday in March at 1 am. +#********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $AUST_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $AUST_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; return 1; + } else { + $AUST_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; return 1; + } else { + $AUST_DST=0; return 0; + } + } + } else { + $AUST_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd >= 8) { + $AUST_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $AUST_DST=0; return 0; + } else { + $AUST_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $AUST_DST=0; return 0; + } else { + $AUST_DST=1; return 1; + } + } + } else { + $AUST_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub NZL_dstcalc { +#********************************************************************** +# FSO-TSM +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and third Sunday in March at 1 am. +#********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $NZL_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; return 1; + } elsif ($dd < ($dow+14)) { + $NZL_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; return 1; + } else { + $NZL_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; return 1; + } else { + $NZL_DST=0; return 0; + } + } + } else { + $NZL_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd >= 8) { + $NZL_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $NZL_DST=0; return 0; + } else { + $NZL_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $NZL_DST=0; return 0; + } else { + $NZL_DST=1; return 1; + } + } + } else { + $NZL_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub BZL_dstcalc { +#********************************************************************** +# TSO-LSF +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. Brazil +# Based on Third Sunday October to Last Sunday February at 1 am. +#********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; return 1; + } elsif ($mm >= 3 && $mm <= 9) { + $BZL_DST=0; return 0; + } elsif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; return 1; + } elsif ($dd < ($dow+22)) { + $BZL_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; return 1; + } else { + $BZL_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; return 1; + } else { + $BZL_DST=0; return 0; + } + } + } else { + $BZL_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; return 0; + } elsif ($dd < ($dow+22)) { + $BZL_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; return 0; + } else { + $BZL_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; return 0; + } else { + $BZL_DST=1; return 1; + } + } + } else { + $BZL_DST=1; return 1; + } + } # end of month checks +} # end of subroutine dstcalc diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/listloaderMAIN.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/listloaderMAIN.php new file mode 100644 index 00000000..a51563f1 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/listloaderMAIN.php @@ -0,0 +1,86 @@ + LICENSE: GPLv2 +# +# this is the main frame page for the lead loading section. This is where you +# would upload a file and have it inserted into vicidial_list +# +# changes: +# 60620-1149 - Added variable filtering to eliminate SQL injection attack threat +# 60822-1105 - fixed for nonwritable directories +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_datetime = $STARTtime; + +$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +if ($WeBRooTWritablE > 0) {$fp = fopen ("./project_auth_entries.txt", "a");} +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-LEAD-LOADER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT load_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGload_leads =$row[0]; + + if ($LOGload_leads < 1) + { + echo "You do not have permissions to load leads\n"; + exit; + } + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "LIST_LOAD|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "LIST_LOAD|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +?> + +VICIDIAL: Υπομονάδα εισαγωγής οδηγών + + + + + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/listloader_rowdisplay.pl b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/listloader_rowdisplay.pl new file mode 100644 index 00000000..3f8695c0 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/listloader_rowdisplay.pl @@ -0,0 +1,153 @@ +#!/usr/bin/perl + +### listloader_rowdisplay.pl version 0.2 *DBI-version* +### +### Copyright (C) 2006 Matt Florell,Joe Johnson LICENSE: GPLv2 +### +# +# CHANGES +# +# 60811-1232 - Changed to DBI +# 60811-1329 - changed to use /etc/astguiclient.conf for configs +# + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help|-h/i) + { + print "allowed run time options:\n [-forcelistid=1234] = overrides the listID given in the file with the 1234\n [-h] = this help screen\n\n"; + + exit; + } + else + { + if ($args =~ /-duplicate-check/i) + {$dupcheck=1;} + if ($args =~ /-postal-code-gmt/i) + {$postalgmt=1;} + if ($args =~ /--lead-file=/i) + { + @data_in = split(/--lead-file=/,$args); + $lead_file = $data_in[1]; + $lead_file =~ s/ .*//gi; + # print "\n----- LEAD FILE: $lead_file -----\n\n"; + } + else + {$lead_file = './vicidial_temp_file.xls';} + } +} +### end parsing run-time options ### + +use Spreadsheet::ParseExcel; +use Time::Local; +use DBI; + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + +$oBook = Spreadsheet::ParseExcel::Workbook->Parse("$lead_file"); +my($iR, $iC, $oWkS, $oWkC); +$var_str=""; + +foreach $oWkS (@{$oBook->{Worksheet}}) { + for(my $iC = $oWkS->{MinCol} ; defined $oWkS->{MaxCol} && $iC <= $oWkS->{MaxCol} ; $iC++) { + $oWkC = $oWkS->{Cells}[0][$iC]; + if ($oWkC) { + $var_str.=$oWkC->Value."|"; + } else { + $var_str.="|"; + } + } +} + +@xls_row=split(/\|/, $var_str); + + +$stmtA = "select vendor_lead_code, source_id, list_id, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments from vicidial_list limit 1;"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + my $names = $sthA->{'NAME'}; + my $numFields = $sthA->{'NUM_OF_FIELDS'}; + for (my $i = 0; $i < $numFields; $i++) + { + # printf("%s%s", $i ? "," : "", $$names[$i]); + # printf("%s%s", $i ? "," : "", $$ref[$i]); + + $field_name=uc($$names[$i]); + $field_name=~s/\_/ /g; + print "
".$field_name.": \r\n"; + print " \r\n"; + print "
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Εισαγωγή οδηγών από αυτό το αÏχείο:
ID Λίστας Override: (μόνο αÏιθμοί or leave blank for values in the file)
Phone Code Override: (μόνο αÏιθμοί or leave blank for values in the file)
ΜοÏφή αÏχείων για χÏήση:Τυποποιημένο VICIDIAL    Î•μφάνιση συνήθειας
Διπλός έλεγχος μολÏβδου:
ΣυμβοÏλευση ζώνης χÏονικής ανοχής:
        
        ΠΙΣΩ ΣΤΗ ΔΙΑΧΕΙΡΙΣΗLIST LOADER-     ΕΚΔΟΣΗ:     ΔΗΜΙΟΥΡΓΙΑ:    
+ + +document.forms[0].leadfile.disabled=true;document.forms[0].list_id_override.disabled=true;document.forms[0].phone_code_override.disabled=true; document.forms[0].submit_file.disabled=true; document.forms[0].reload_page.disabled=true;"; + flush(); + $total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list=''; + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) { + # copy($leadfile, "./vicidial_temp_file.txt"); + $file=fopen("$lead_file", "r"); + if ($WeBRooTWritablE > 0) + { + $stmt_file=fopen("listloader_stmts.txt", "w"); + } + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + + if (count($field_check)>=5) { + flush(); + $file=fopen("$lead_file", "r"); + print "
ΕπεξεÏγασία$delim_name-delimited file...\n"; + + if (strlen($list_id_override)>0) + { + print "

ID ΛΙΣΤΑΣ OVERRIDE FOR THIS FILE: $list_id_override

"; + } + + if (strlen($phone_code_override)>0) + { + print "

ΣΥΜΠΛΗΡΩΜΑΤΙΚΗ ΠΡΟΜΉΘΕΙΑ ΤΗΛΕΦΩÎΙΚΟΥ ΚΩΔΙΚΑ ΓΙΑ ΑΥΤΟ ΤΟ ΑΡΧΕΙΟ: $phone_code_override

"; + } + + while (!feof($file)) { + $record++; + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + + if (strlen($buffer)>0) { + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[$vendor_lead_code_field]; + $source_code = $row[$source_id_field]; + $source_id=$source_code; + $list_id = $row[$list_id_field]; + $gmt_offset = '0'; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[$phone_code_field]); + $phone_number = eregi_replace("[^0-9]", "", $row[$phone_number_field]); + $USarea = substr($phone_number, 0, 3); + $title = $row[$title_field]; + $first_name = $row[$first_name_field]; + $middle_initial = $row[$middle_initial_field]; + $last_name = $row[$last_name_field]; + $address1 = $row[$address1_field]; + $address2 = $row[$address2_field]; + $address3 = $row[$address3_field]; + $city =$row[$city_field]; + $state = $row[$state_field]; + $province = $row[$province_field]; + $postal_code = $row[$postal_code_field]; + $country_code = $row[$country_code_field]; + $gender = $row[$gender_field]; + $date_of_birth = $row[$date_of_birth_field]; + $alt_phone = eregi_replace("[^0-9]", "", $row[$alt_phone_field]); + $email = $row[$email_field]; + $security_phrase = $row[$security_phrase_field]; + $comments = trim($row[$comments_field]); + + if (strlen($list_id_override)>0) + { + # print "

ID ΛΙΣΤΑΣ OVERRIDE FOR THIS FILE: $list_id_override

"; + $list_id = $list_id_override; + } + if (strlen($phone_code_override)>0) + { + $phone_code = $phone_code_override; + } + + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if (eregi("DUPCAMP",$dupcheck)) + { + $dup_lead=0; + $dup_lists=''; + $stmt="select campaign_id from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $ci_recs = mysql_num_rows($rslt); + if ($ci_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_camp = $row[0]; + + $stmt="select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $rslt=mysql_query($stmt, $link); + $li_recs = mysql_num_rows($rslt); + if ($li_recs > 0) + { + $L=0; + while ($li_recs > $L) + { + $row=mysql_fetch_row($rslt); + $dup_lists .= "'$row[0]',"; + $L++; + } + $dup_lists = eregi_replace(",$",'',$dup_lists); + + $stmt="select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + } + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if (eregi("DUPSYS",$dupcheck)) + { + $dup_lead=0; + $stmt="select list_id from vicidial_list where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if (eregi("DUPLIST",$dupcheck)) + { + $dup_lead=0; + $stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_lead = $row[0]; + $dup_lead_list = $list_id; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + if ( (strlen($phone_number)>6) and ($dup_lead<1) ) + { + if (strlen($phone_code)<1) {$phone_code = '1';} + + $US='_'; + $phone_list .= "$phone_number$US$list_id|"; + + $gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code); + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead $dup_lead_list\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } else { + print "
Λάθος: Το αÏχείο δεν έχει τον απαιτοÏμενο αÏιθμό πεδίων.
"; + } + } else if (!eregi(".csv", $leadfile_name)) { + # copy($leadfile, "./vicidial_temp_file.xls"); + $file=fopen("$lead_file", "r"); + + print "
ΕπεξεÏγασίαExcel file... \n"; + if (strlen($list_id_override)>0) + { + print "

ID ΛΙΣΤΑΣ OVERRIDE FOR THIS FILE: $list_id_override

\n"; + } + if (strlen($phone_code_override)>0) + { + print "

ΣΥΜΠΛΗΡΩΜΑΤΙΚΗ ΠΡΟΜΉΘΕΙΑ ΤΗΛΕΦΩÎΙΚΟΥ ΚΩΔΙΚΑ ΓΙΑ ΑΥΤΟ ΤΟ ΑΡΧΕΙΟ: $phone_code_override

\n"; + } + # print "|$WeBServeRRooT/vicidial/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field, --forcelistid=$list_id_override --lead_file=$lead_file|"; + $dupcheckCLI=''; $postalgmtCLI=''; + if (eregi("DUPLIST",$dupcheck)) {$dupcheckCLI='--duplicate-check';} + if (eregi("DUPCAMP",$dupcheck)) {$dupcheckCLI='--duplicate-campaign-check';} + if (eregi("DUPSYS",$dupcheck)) {$dupcheckCLI='--duplicate-system-check';} + if (eregi("POSTAL",$postalgmt)) {$postalgmtCLI='--postal-code-gmt';} + passthru("$WeBServeRRooT/vicidial/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field, --forcelistid=$list_id_override --forcephonecode=$phone_code_override --lead-file=$lead_file $postalgmtCLI $dupcheckCLI"); + } else { + # copy($leadfile, "./vicidial_temp_file.csv"); + $file=fopen("$lead_file", "r"); + + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + print "
ΕπεξεÏγασίαCSV file... \n"; + if (strlen($list_id_override)>0) + { + print "

ID ΛΙΣΤΑΣ OVERRIDE FOR THIS FILE: $list_id_override

"; + } + + if (strlen($phone_code_override)>0) + { + print "

ΣΥΜΠΛΗΡΩΜΑΤΙΚΗ ΠΡΟΜΉΘΕΙΑ ΤΗΛΕΦΩÎΙΚΟΥ ΚΩΔΙΚΑ ΓΙΑ ΑΥΤΟ ΤΟ ΑΡΧΕΙΟ: $phone_code_override

"; + } + + while($row=fgetcsv($file, 1000, ",")) { + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[$vendor_lead_code_field]; + $source_code = $row[$source_id_field]; + $source_id=$source_code; + $list_id = $row[$list_id_field]; + $gmt_offset = '0'; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[$phone_code_field]); + $phone_number = eregi_replace("[^0-9]", "", $row[$phone_number_field]); + $USarea = substr($phone_number, 0, 3); + $title = $row[$title_field]; + $first_name = $row[$first_name_field]; + $middle_initial = $row[$middle_initial_field]; + $last_name = $row[$last_name_field]; + $address1 = $row[$address1_field]; + $address2 = $row[$address2_field]; + $address3 = $row[$address3_field]; + $city =$row[$city_field]; + $state = $row[$state_field]; + $province = $row[$province_field]; + $postal_code = $row[$postal_code_field]; + $country_code = $row[$country_code_field]; + $gender = $row[$gender_field]; + $date_of_birth = $row[$date_of_birth_field]; + $alt_phone = eregi_replace("[^0-9]", "", $row[$alt_phone_field]); + $email = $row[$email_field]; + $security_phrase = $row[$security_phrase_field]; + $comments = trim($row[$comments_field]); + + if (strlen($list_id_override)>0) + { + $list_id = $list_id_override; + } + if (strlen($phone_code_override)>0) + { + $phone_code = $phone_code_override; + } + + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if (eregi("DUPCAMP",$dupcheck)) + { + $dup_lead=0; + $dup_lists=''; + $stmt="select campaign_id from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $ci_recs = mysql_num_rows($rslt); + if ($ci_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_camp = $row[0]; + + $stmt="select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $rslt=mysql_query($stmt, $link); + $li_recs = mysql_num_rows($rslt); + if ($li_recs > 0) + { + $L=0; + while ($li_recs > $L) + { + $row=mysql_fetch_row($rslt); + $dup_lists .= "'$row[0]',"; + $L++; + } + $dup_lists = eregi_replace(",$",'',$dup_lists); + + $stmt="select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + } + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if (eregi("DUPSYS",$dupcheck)) + { + $dup_lead=0; + $stmt="select list_id from vicidial_list where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if (eregi("DUPLIST",$dupcheck)) + { + $dup_lead=0; + $stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_lead = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + if ( (strlen($phone_number)>6) and ($dup_lead<1) ) + { + if (strlen($phone_code)<1) {$phone_code = '1';} + + $US='_'; + $phone_list .= "$phone_number$US$list_id|"; + + $gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code); + + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + } + print ""; + } + +if ($leadfile && filesize($LF_path)<=8388608) { + $total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list=''; + if ($file_layout=="standard") { + + print ""; + flush(); + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) { + + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"); + $lead_file = "./vicidial_temp_file.txt"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.txt"); + $lead_file = "/tmp/vicidial_temp_file.txt"; + } + $file=fopen("$lead_file", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + + if (count($field_check)>=5) { + flush(); + $file=fopen("$lead_file", "r"); + $total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list=''; + print "
ΕπεξεÏγασία$delim_name-delimited file... ($tab_count|$pipe_count)\n"; + if (strlen($list_id_override)>0) + { + print "

ID ΛΙΣΤΑΣ OVERRIDE FOR THIS FILE: $list_id_override

"; + } + if (strlen($phone_code_override)>0) + { + print "

ΣΥΜΠΛΗΡΩΜΑΤΙΚΗ ΠΡΟΜΉΘΕΙΑ ΤΗΛΕΦΩÎΙΚΟΥ ΚΩΔΙΚΑ ΓΙΑ ΑΥΤΟ ΤΟ ΑΡΧΕΙΟ: $phone_code_override

\n"; + } + while (!feof($file)) { + $record++; + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + + if (strlen($buffer)>0) { + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[0]; + $source_code = $row[1]; + $source_id=$source_code; + $list_id = $row[2]; + $gmt_offset = '0'; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[3]); + $phone_number = eregi_replace("[^0-9]", "", $row[4]); + $USarea = substr($phone_number, 0, 3); + $title = $row[5]; + $first_name = $row[6]; + $middle_initial = $row[7]; + $last_name = $row[8]; + $address1 = $row[9]; + $address2 = $row[10]; + $address3 = $row[11]; + $city =$row[12]; + $state = $row[13]; + $province = $row[14]; + $postal_code = $row[15]; + $country_code = $row[16]; + $gender = $row[17]; + $date_of_birth = $row[18]; + $alt_phone = eregi_replace("[^0-9]", "", $row[19]); + $email = $row[20]; + $security_phrase = $row[21]; + $comments = trim($row[22]); + + if (strlen($list_id_override)>0) + { + $list_id = $list_id_override; + } + if (strlen($phone_code_override)>0) + { + $phone_code = $phone_code_override; + } + + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if (eregi("DUPCAMP",$dupcheck)) + { + $dup_lead=0; + $dup_lists=''; + $stmt="select campaign_id from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $ci_recs = mysql_num_rows($rslt); + if ($ci_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_camp = $row[0]; + + $stmt="select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $rslt=mysql_query($stmt, $link); + $li_recs = mysql_num_rows($rslt); + if ($li_recs > 0) + { + $L=0; + while ($li_recs > $L) + { + $row=mysql_fetch_row($rslt); + $dup_lists .= "'$row[0]',"; + $L++; + } + $dup_lists = eregi_replace(",$",'',$dup_lists); + + $stmt="select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + } + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if (eregi("DUPSYS",$dupcheck)) + { + $dup_lead=0; + $stmt="select list_id from vicidial_list where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if (eregi("DUPLIST",$dupcheck)) + { + $dup_lead=0; + $stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_lead = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + if ( (strlen($phone_number)>6) and ($dup_lead<1) ) + { + if (strlen($phone_code)<1) {$phone_code = '1';} + + $US='_'; + $phone_list .= "$phone_number$US$list_id|"; + + $gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code); + + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } else { + print "
Λάθος: Το αÏχείο δεν έχει τον απαιτοÏμενο αÏιθμό πεδίων.
"; + } + } else if (!eregi(".csv", $leadfile_name)) + { + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"); + $lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.xls"); + $lead_file = "/tmp/vicidial_temp_file.xls"; + } + $file=fopen("$lead_file", "r"); + + # echo "|$WeBServeRRooT/vicidial/listloader.pl --forcelistid=$list_id_override --lead-file=$lead_file|"; + $dupcheckCLI=''; $postalgmtCLI=''; + if (eregi("DUPLIST",$dupcheck)) {$dupcheckCLI='--duplicate-check';} + if (eregi("DUPCAMP",$dupcheck)) {$dupcheckCLI='--duplicate-campaign-check';} + if (eregi("DUPSYS",$dupcheck)) {$dupcheckCLI='--duplicate-system-check';} + if (eregi("POSTAL",$postalgmt)) {$postalgmtCLI='--postal-code-gmt';} + passthru("$WeBServeRRooT/vicidial/listloader.pl --forcelistid=$list_id_override --forcephonecode=$phone_code_override --lead-file=$lead_file $postalgmtCLI $dupcheckCLI"); + + } + else + { + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"); + $lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.csv"); + $lead_file = "/tmp/vicidial_temp_file.csv"; + } + $file=fopen("$lead_file", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + print "
ΕπεξεÏγασίαCSV file... \n"; + + if (strlen($list_id_override)>0) + { + print "

ID ΛΙΣΤΑΣ OVERRIDE FOR THIS FILE: $list_id_override

"; + } + if (strlen($phone_code_override)>0) + { + print "

ΣΥΜΠΛΗΡΩΜΑΤΙΚΗ ΠΡΟΜΉΘΕΙΑ ΤΗΛΕΦΩÎΙΚΟΥ ΚΩΔΙΚΑ ΓΙΑ ΑΥΤΟ ΤΟ ΑΡΧΕΙΟ: $phone_code_override

"; + } + + while($row=fgetcsv($file, 1000, ",")) { + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[0]; + $source_code = $row[1]; + $source_id=$source_code; + $list_id = $row[2]; + $gmt_offset = '0'; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[3]); + $phone_number = eregi_replace("[^0-9]", "", $row[4]); + $USarea = substr($phone_number, 0, 3); + $title = $row[5]; + $first_name = $row[6]; + $middle_initial = $row[7]; + $last_name = $row[8]; + $address1 = $row[9]; + $address2 = $row[10]; + $address3 = $row[11]; + $city =$row[12]; + $state = $row[13]; + $province = $row[14]; + $postal_code = $row[15]; + $country_code = $row[16]; + $gender = $row[17]; + $date_of_birth = $row[18]; + $alt_phone = eregi_replace("[^0-9]", "", $row[19]); + $email = $row[20]; + $security_phrase = $row[21]; + $comments = trim($row[22]); + + if (strlen($list_id_override)>0) + { + $list_id = $list_id_override; + } + if (strlen($phone_code_override)>0) + { + $phone_code = $phone_code_override; + } + + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if (eregi("DUPCAMP",$dupcheck)) + { + $dup_lead=0; + $dup_lists=''; + $stmt="select campaign_id from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $ci_recs = mysql_num_rows($rslt); + if ($ci_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_camp = $row[0]; + + $stmt="select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $rslt=mysql_query($stmt, $link); + $li_recs = mysql_num_rows($rslt); + if ($li_recs > 0) + { + $L=0; + while ($li_recs > $L) + { + $row=mysql_fetch_row($rslt); + $dup_lists .= "'$row[0]',"; + $L++; + } + $dup_lists = eregi_replace(",$",'',$dup_lists); + + $stmt="select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + } + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if (eregi("DUPSYS",$dupcheck)) + { + $dup_lead=0; + $stmt="select list_id from vicidial_list where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if (eregi("DUPLIST",$dupcheck)) + { + $dup_lead=0; + $stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_lead = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + if ( (strlen($phone_number)>6) and ($dup_lead<1) ) + { + if (strlen($phone_code)<1) {$phone_code = '1';} + + $US='_'; + $phone_list .= "$phone_number$US$list_id|"; + + $gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code); + + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } + print ""; + + } else { + print "
"; + flush(); + print "\r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + + $rslt=mysql_query("select vendor_lead_code, source_id, list_id, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments from vicidial_list limit 1", $link); + + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) + { + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"); + $lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.txt"); + $lead_file = "/tmp/vicidial_temp_file.txt"; + } + $file=fopen("$lead_file", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + flush(); + $file=fopen("$lead_file", "r"); + print "
ΕπεξεÏγασία$delim_name-delimited file...\n"; + + if (strlen($list_id_override)>0) + { + print "

ID ΛΙΣΤΑΣ OVERRIDE FOR THIS FILE: $list_id_override

"; + } + if (strlen($phone_code_override)>0) + { + print "

ΣΥΜΠΛΗΡΩΜΑΤΙΚΗ ΠΡΟΜΉΘΕΙΑ ΤΗΛΕΦΩÎΙΚΟΥ ΚΩΔΙΚΑ ΓΙΑ ΑΥΤΟ ΤΟ ΑΡΧΕΙΟ: $phone_code_override

"; + } + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + for ($i=0; $i\r\n"; + print "
\r\n"; + print " \r\n"; + print " \r\n"; + + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + } + } + else if (!eregi(".csv", $leadfile_name)) + { + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"); + $lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.xls"); + $lead_file = "/tmp/vicidial_temp_file.xls"; + } + + # echo "|$WeBServeRRooT/vicidial/listloader_rowdisplay.pl --lead-file=$lead_file|"; + $dupcheckCLI=''; $postalgmtCLI=''; + if (eregi("DUPLIST",$dupcheck)) {$dupcheckCLI='--duplicate-check';} + if (eregi("DUPCAMP",$dupcheck)) {$dupcheckCLI='--duplicate-campaign-check';} + if (eregi("DUPSYS",$dupcheck)) {$dupcheckCLI='--duplicate-system-check';} + if (eregi("POSTAL",$postalgmt)) {$postalgmtCLI='--postal-code-gmt';} + passthru("$WeBServeRRooT/vicidial/listloader_rowdisplay.pl --lead-file=$lead_file $postalgmtCLI $dupcheckCLI"); + } + else + { + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"); + $lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.csv"); + $lead_file = "/tmp/vicidial_temp_file.csv"; + } + $file=fopen("$lead_file", "r"); + + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + print "
ΕπεξεÏγασίαCSV file... \n"; + + if (strlen($list_id_override)>0) + { + print "

ID ΛΙΣΤΑΣ OVERRIDE FOR THIS FILE: $list_id_override

"; + } + if (strlen($phone_code_override)>0) + { + print "

ΣΥΜΠΛΗΡΩΜΑΤΙΚΗ ΠΡΟΜΉΘΕΙΑ ΤΗΛΕΦΩÎΙΚΟΥ ΚΩΔΙΚΑ ΓΙΑ ΑΥΤΟ ΤΟ ΑΡΧΕΙΟ: $phone_code_override

"; + } + + $total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list=''; + $row=fgetcsv($file, 1000, ","); + for ($i=0; $i\r\n"; + print "
\r\n"; + print " \r\n"; + print " \r\n"; + + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + } + } + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print "
VICIDIAL ΣτήληΑÏχεία δεδομένων
".strtoupper(eregi_replace("_", " ", mysql_field_name($rslt, $i))).":
$row[$i]
".strtoupper(eregi_replace("_", " ", mysql_field_name($rslt, $i))).":
$row[$i]
        
\r\n"; + # } + print ""; + } +} else if (filesize($leadfile)>8388608) { + print "
Λάθος: Το αÏχείο ξεπέÏασε το ÏŒÏιο των 8ΜΒ.
"; +} +?> + + + + + + + + +4) ) + { + if (preg_match('/^1$/', $phone_code)) + { + $stmt="select * from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[2]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[3]; + $dst_range = $row[4]; + $PC_processed++; + $postalgmt_found++; + $post++; + } + } + } +if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =='1') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### MEXICO ### + if ($phone_code =='52') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### AUSTRALIA ### + if ($phone_code =='61') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $PC_processed++; + $stmt="select * from vicidial_phone_codes where country_code='$phone_code';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + } + +### Find out if DST to raise the gmt offset ### +$AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); +$AC_localtime = mktime(($Shour + $AC_GMT_diff), $Smin, $Ssec, $Smon, $Smday, $Syear); + $hour = date("H",$AC_localtime); + $min = date("i",$AC_localtime); + $sec = date("s",$AC_localtime); + $mon = date("m",$AC_localtime); + $mday = date("d",$AC_localtime); + $wday = date("w",$AC_localtime); + $year = date("Y",$AC_localtime); +$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + +$AC_processed=0; +if ( (!$AC_processed) and ($dst_range == 'SSM-FSN') ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + #********************************************************************** + # SSM-FSN + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on Second Sunday March to First Sunday November at 2 am. + # INPUTS: + # mm INTEGER Month. + # dd INTEGER Day of the month. + # ns INTEGER Seconds into the day. + # dow INTEGER Day of week (0=Sunday, to 6=Saturday) + # OPTIONAL INPUT: + # timezone INTEGER hour difference UTC - local standard time + # (DEFAULT is blank) + # make calculations based on UTC time, + # which means shift at 10:00 UTC in April + # and 9:00 UTC in October + # OUTPUT: + # INTEGER 1 = DST, 0 = not DST + # + # S M T W T F S + # 1 2 3 4 5 6 7 + # 8 9 10 11 12 13 14 + #15 16 17 18 19 20 21 + #22 23 24 25 26 27 28 + #29 30 31 + # + # S M T W T F S + # 1 2 3 4 5 6 + # 7 8 9 10 11 12 13 + #14 15 16 17 18 19 20 + #21 22 23 24 25 26 27 + #28 29 30 31 + # + #********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; + } elseif ($mm >= 4 and $mm <= 10) { + $USACAN_DST=1; + } elseif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; + } elseif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } + } else { + $USACAN_DST=0; + } + } elseif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; + } elseif ($dd < ($dow+1)) { + $USACAN_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } else { # τοπικός χÏόνος calculations + if ($ns < 7200) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } + } else { + $USACAN_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$gmt_offset++;} + $AC_processed++; + } + +if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + #********************************************************************** + # FSA-LSO + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in April and last Sunday in October at 2 am. + #********************************************************************** + + $USA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $USA_DST=0; + } elseif ($mm >= 5 and $mm <= 9) { + $USA_DST=1; + } elseif ($mm == 4) { + if ($dd > 7) { + $USA_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } + } else { + $USA_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $USA_DST=1; + } elseif ($dd < ($dow+25)) { + $USA_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } else { # τοπικός χÏόνος calculations + if ($ns < 7200) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } + } else { + $USA_DST=0; + } + } # end of month checks + + if ($DBX) {print " DST: $USA_DST\n";} + if ($USA_DST) {$gmt_offset++;} + $AC_processed++; + } + +if ( (!$AC_processed) and ($dst_range == 'LSM-LSO') ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in March and last Sunday in October at 1 am. + #********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; + } elseif ($mm >= 4 and $mm <= 9) { + $GBR_DST=1; + } elseif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; + } elseif ($dd < ($dow+25)) { + $GBR_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } else { # τοπικός χÏόνος calculations + if ($ns < 3600) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } + } else { + $GBR_DST=1; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; + } elseif ($dd < ($dow+25)) { + $GBR_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } else { # τοπικός χÏόνος calculations + if ($ns < 3600) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } + } else { + $GBR_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } +if ( (!$AC_processed) and ($dst_range == 'LSO-LSM') ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUS_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; + } elseif ($dd < ($dow+25)) { + $AUS_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } else { # τοπικός χÏόνος calculations + if ($ns < 3600) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } + } else { + $AUS_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; + } elseif ($dd < ($dow+25)) { + $AUS_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } else { # τοπικός χÏόνος calculations + if ($ns < 3600) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } + } else { + $AUS_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + +if ( (!$AC_processed) and ($dst_range == 'FSO-LSM') ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + #********************************************************************** + # TASMANIA ONLY + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUST_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; + } elseif ($dd < ($dow+25)) { + $AUST_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } else { # τοπικός χÏόνος calculations + if ($ns < 3600) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } + } else { + $AUST_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $AUST_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } + } else { + $AUST_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } +if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and third Sunday in March at 1 am. + #********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $NZL_DST=0; + } elseif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; + } elseif ($dd < ($dow+14)) { + $NZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } else { # τοπικός χÏόνος calculations + if ($ns < 3600) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } + } else { + $NZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $NZL_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } + } else { + $NZL_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + +if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + #********************************************************************** + # TSO-LSF + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. Brazil + # Based on Third Sunday October to Last Sunday February at 1 am. + #********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; + } elseif ($mm >= 3 and $mm <= 9) { + $BZL_DST=0; + } elseif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; + } elseif ($dd < ($dow+22)) { + $BZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } else { # τοπικός χÏόνος calculations + if ($ns < 3600) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } + } else { + $BZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; + } elseif ($dd < ($dow+22)) { + $BZL_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } else { # τοπικός χÏόνος calculations + if ($ns < 3600) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } + } else { + $BZL_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$gmt_offset++;} + $AC_processed++; + } + +if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + +return $gmt_offset; +} \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/remote_dispo.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/remote_dispo.php new file mode 100644 index 00000000..3f45251b --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/remote_dispo.php @@ -0,0 +1,327 @@ + LICENSE: GPLv2 +### +# this is the remote agent disposition screen for calls sent to remote agents. This allows the remote agent to modify customer information and disposition the call + +# CHANGES +# +# 60619-1626 - Added variable filtering to eliminate SQL injection attack threat +# + + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +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["alt_phone"])) {$alt_phone=$_GET["alt_phone"];} + elseif (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];} +if (isset($_GET["call_began"])) {$call_began=$_GET["call_began"];} + elseif (isset($_POST["call_began"])) {$call_began=$_POST["call_began"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];} + elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];} +if (isset($_GET["city"])) {$city=$_GET["city"];} + elseif (isset($_POST["city"])) {$city=$_POST["city"];} +if (isset($_GET["comments"])) {$comments=$_GET["comments"];} + elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];} +if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];} + elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];} +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["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];} + elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];} +if (isset($_GET["email"])) {$email=$_GET["email"];} + elseif (isset($_POST["email"])) {$email=$_POST["email"];} +if (isset($_GET["end_call"])) {$end_call=$_GET["end_call"];} + elseif (isset($_POST["end_call"])) {$end_call=$_POST["end_call"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];} + elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];} + elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["parked_time"])) {$parked_time=$_GET["parked_time"];} + elseif (isset($_POST["parked_time"])) {$parked_time=$_POST["parked_time"];} +if (isset($_GET["pass"])) {$pass=$_GET["pass"];} + elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];} +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["phone"])) {$phone=$_GET["phone"];} + elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];} +if (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];} + elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];} +if (isset($_GET["province"])) {$province=$_GET["province"];} + elseif (isset($_POST["province"])) {$province=$_POST["province"];} +if (isset($_GET["security"])) {$security=$_GET["security"];} + elseif (isset($_POST["security"])) {$security=$_POST["security"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["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["session_id"])) {$session_id=$_GET["session_id"];} + elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];} +if (isset($_GET["state"])) {$state=$_GET["state"];} + elseif (isset($_POST["state"])) {$state=$_POST["state"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["tsr"])) {$tsr=$_GET["tsr"];} + elseif (isset($_POST["tsr"])) {$tsr=$_POST["tsr"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"];} + elseif (isset($_POST["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];} + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_datetime = $STARTtime; + +$ext_context = 'demo'; +if (!isset($begin_date)) {$begin_date = $TODAY;} +if (!isset($end_date)) {$end_date = $TODAY;} + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 2;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + } + else + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +?> + + +ΑπομακÏυσμένο: ΤεÏματισμός Κλήσης +\n"; +?> + + +
+ +"; + +if ($end_call > 0) +{ + +$call_length = ($STARTtime - $call_began); + + ### insert a NEW record to the vicidial_closer_log table + $stmt="UPDATE vicidial_closer_log set end_epoch='$STARTtime', length_in_sec='" . mysql_real_escape_string($call_length) . "', status='" . mysql_real_escape_string($status) . "', user='$PHP_AUTH_USER' where lead_id='" . mysql_real_escape_string($lead_id) . "' order by start_epoch desc limit 1;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ### update the lead record in the vicidial_list table + $stmt="UPDATE vicidial_list set status='" . mysql_real_escape_string($status) . "',first_name='" . mysql_real_escape_string($first_name) . "',last_name='" . mysql_real_escape_string($last_name) . "',address1='" . mysql_real_escape_string($address1) . "',address2='" . mysql_real_escape_string($address2) . "',address3='" . mysql_real_escape_string($address3) . "',city='" . mysql_real_escape_string($city) . "',state='" . mysql_real_escape_string($state) . "',province='" . mysql_real_escape_string($province) . "',postal_code='" . mysql_real_escape_string($postal_code) . "',country_code='" . mysql_real_escape_string($country_code) . "',alt_phone='" . mysql_real_escape_string($alt_phone) . "',email='" . mysql_real_escape_string($email) . "',security_phrase='" . mysql_real_escape_string($security) . "',comments='" . mysql_real_escape_string($comments) . "',user='$PHP_AUTH_USER' where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "Η κλήση έχει τεÏματίσει       $NOW_TIME\n

\n"; + + echo "
\n"; + +} +else +{ + $stmt="SELECT count(*) from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_count = $row[0]; + + if ($lead_count > 0) + { + + $stmt="SELECT * from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_id = "$row[0]"; + $tsr = "$row[4]"; + $vendor_id = "$row[5]"; + $list_id = "$row[7]"; + $campaign_id = "$row[8]"; + $phone_code = "$row[10]"; + $phone_number = "$row[11]"; + $title = "$row[12]"; + $first_name = "$row[13]"; # + $middle_initial = "$row[14]"; + $last_name = "$row[15]"; # + $address1 = "$row[16]"; # + $address2 = "$row[17]"; # + $address3 = "$row[18]"; # + $city = "$row[19]"; # + $state = "$row[20]"; # + $province = "$row[21]"; # + $postal_code = "$row[22]"; # + $country_code = "$row[23]"; # + $gender = "$row[24]"; + $date_of_birth = "$row[25]"; + $alt_phone = "$row[26]"; # + $email = "$row[27]"; # + $security = "$row[28]"; # + $comments = "$row[29]"; # + + echo "
ΠληÏοφοÏίες Κλήσης: $first_name $last_name - $phone_number

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + echo "\n"; + echo "
Vendor ID: $vendor_id     ID ΕκστÏατείας: $campaign_id
Fronter: $tsr     ID Λίστας: $list_id
Ονομα:   \n"; + echo " Επίθετο:
ΔιεÏθυνση 1 :
ΔιεÏθυνση 2 :
ΔιεÏθυνση 3 :
Πόλη :
ΚÏάτος:   \n"; + echo "Ταχ.Κωδ.
ΧώÏα :
Εναλ Τηλέφωνο :
Ασφάλεια :
Σχόλια :
ΤεÏματισμός:
\n"; + echo "


\n"; + + } + else + { + echo "ΑΠΟΤΥΧΙΑ ψαξίματος καθοδήγησης για lead_id $lead_id       $NOW_TIME\n

\n"; +# echo "Close this window\n

\n"; + } + + + + + + +} + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nχÏόνος εκτέλεσης διαδικασίας: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/server_stats.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/server_stats.php new file mode 100644 index 00000000..d46d3c10 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/server_stats.php @@ -0,0 +1,97 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60620-1037 - Added Link back to Admin section +# - Added required user/pass to gain access to this page +# 61101-1331 - Added SIP/IAX listen/barge links +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($query_date)) {$query_date = $NOW_DATE;} + +$stmt="select * from servers;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$servers_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $servers_to_print) + { + $row=mysql_fetch_row($rslt); + $server_id[$i] = $row[0]; + $server_description[$i] = $row[1]; + $server_ip[$i] = $row[2]; + $active[$i] = $row[3]; + $i++; + } +?> + + + + + +VICIDIAL: Στατιστικά Διακομιστή and Reports +VICIDIAL: Στατιστικά Διακομιστή and Reports                           +ΠΙΣΩ ΣΤΗ ΔΙΑΧΕΙΡΙΣΗ

+ + +

+
+ $o)
+	{
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	$o++;
+	}
+
+?>
+
SERVERΠΕΡΙΓΡΑΦΗIP ADDRESSΕÎΕΡΓΟVDAD timeVDcall timePARK timeCLOSER/INBOUND time
$server_id[$o]$server_description[$o]$server_ip[$o]$active[$o]LINKLINKLINKLINK
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/user_stats.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/user_stats.php new file mode 100644 index 00000000..d03abe1d --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/user_stats.php @@ -0,0 +1,408 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1743 - Added variable filtering to eliminate SQL injection attack threat +# 61201-1136 - Added recordings display and changed calls to time range with 10000 limit +# 70118-1605 - Added user group column to login/out and calls lists +# 70702-1231 - Added recording location link and truncation +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["begin_date"])) {$begin_date=$_GET["begin_date"];} + elseif (isset($_POST["begin_date"])) {$begin_date=$_POST["begin_date"];} +if (isset($_GET["end_date"])) {$end_date=$_GET["end_date"];} + elseif (isset($_POST["end_date"])) {$end_date=$_POST["end_date"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"];} + elseif (isset($_POST["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); + +if (!isset($begin_date)) {$begin_date = $TODAY;} +if (!isset($end_date)) {$end_date = $TODAY;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and view_reports='1';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + + $stmt="SELECT full_name from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + } + + + + +?> + + +ΔΙΑΧΕΙΡΙΣΗ: User Stats +\n"; +?> + + +
+ + + + + +\n"; +echo "
" ?>   ΔΙΑΧΕΙΡΙΣΗ: User Stats for  
  \n"; + +echo "
\n"; +echo "\n"; +echo " to \n"; +echo "  \n"; +echo "\n"; + + +echo "           $user - $full_name\n"; + +echo " - VICIDIAL Time Sheet\n"; +echo " - User Status\n"; +echo " - ΤÏοποποίηση ΧÏήστη\n"; + + +echo "
\n"; + + + $stmt="SELECT count(*),status, sum(length_in_sec) from vicidial_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' group by status order by status"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + +echo "
\n"; + +echo "ΧΡΟÎΟΣ ΟΜΙΛΙΑΣ ΚΑΙ ΚΑΤΑΣΤΑΣΗ:\n"; + +echo "
\n"; +echo "\n"; + + $total_calls=0; + $o=0; + while ($statuses_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $call_seconds = $row[2]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} + + echo ""; + echo "\n"; + echo "\n"; + $total_calls = ($total_calls + $row[0]); + + $call_seconds=0; + $o++; + } + + $stmt="SELECT sum(length_in_sec) from vicidial_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59'"; + $rslt=mysql_query($stmt, $link); + $counts_to_print = mysql_num_rows($rslt); + $row=mysql_fetch_row($rslt); + $call_seconds = $row[0]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} + +echo "\n"; +echo "
ΚΑΤΑΣΤΑΣΗΚΑΤΑΜΕΤΡΗΣΗΩΡΕΣ:ΛΕΠΤΑ
$row[1] $row[0] $call_hours_int:$call_minutes_int
ΣΥÎΟΛΙΚΕΣ ΚΛΗΣΕΙΣ $total_calls $call_hours_int:$call_minutes_int
\n"; +echo "

\n"; + +echo "
\n"; + +echo " ΧΡΟÎΟΣ ΣYÎΔΕΣΗΣ/ΑΠΟΣΥÎΔΕΣΗΣ:\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT event,event_epoch,event_date,campaign_id,user_group from vicidial_user_log where user='" . mysql_real_escape_string($user) . "' and event_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and event_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59'"; + $rslt=mysql_query($stmt, $link); + $events_to_print = mysql_num_rows($rslt); + + $total_calls=0; + $o=0; + $event_start_seconds=''; + $event_stop_seconds=''; + while ($events_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("LOGIN", $row[0])) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + if (ereg("LOGIN", $row[0])) + { + $event_start_seconds = $row[1]; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + if (ereg("LOGOUT", $row[0])) + { + if ($event_start_seconds) + { + $event_stop_seconds = $row[1]; + $event_seconds = ($event_stop_seconds - $event_start_seconds); + $total_login_time = ($total_login_time + $event_seconds); + $event_hours = ($event_seconds / 3600); + $event_hours = round($event_hours, 2); + $event_hours_int = intval("$event_hours"); + $event_minutes = ($event_hours - $event_hours_int); + $event_minutes = ($event_minutes * 60); + $event_minutes_int = round($event_minutes, 0); + if ($event_minutes_int < 10) {$event_minutes_int = "0$event_minutes_int";} + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + $event_start_seconds=''; + $event_stop_seconds=''; + } + else + { + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + } + } + + $total_calls = ($total_calls + $row[0]); + + $call_seconds=0; + $o++; + } + +$total_login_hours = ($total_login_time / 3600); +$total_login_hours = round($total_login_hours, 2); +$total_login_hours_int = intval("$total_login_hours"); +$total_login_minutes = ($total_login_hours - $total_login_hours_int); +$total_login_minutes = ($total_login_minutes * 60); +$total_login_minutes_int = round($total_login_minutes, 0); +if ($total_login_minutes_int < 10) {$total_login_minutes_int = "0$total_login_minutes_int";} + +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "
ΣΥΜΒΑΠΗΜΕΡΑΕΚΣΤΡΑΤΕΙΑ GROUPΩΡΕΣ:ΛΕΠΤΑ
$row[0] $row[2] $row[3] $row[4]
$row[0] $row[2] $row[3] $row[4] $event_hours_int:$event_minutes_int
$row[0] $row[2] $row[3]
ΣΥÎΟΛΙΚΑ $total_login_hours_int:$total_login_minutes_int
\n"; + + +echo "

\n"; + +echo "
\n"; + +echo "OUTBOUND CALLS FOR THIS TIME PERIOD: (10000 record limit)\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from vicidial_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $u++; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + } + + +echo "
# DATE/TIME LENGTH STATUS PHONEΕΚΣΤΡΑΤΕΙΑ GROUP LIST LEAD
$u$row[4] $row[7] $row[8] $row[10] $row[3] $row[14] $row[2] $row[1]


\n"; + + + +echo "CLOSER CALLS FOR THIS TIME PERIOD: (10000 record limit)\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from vicidial_closer_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $u++; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + } + + +echo "
# DATE/TIME LENGTH STATUS PHONEΕΚΣΤΡΑΤΕΙΑ WAIT (S) LIST LEAD
$u$row[4] $row[7] $row[8] $row[10] $row[3] $row[14] $row[2] $row[1]


\n"; + + + + +echo "RECORDINGS FOR THIS TIME PERIOD: (10000 record limit)\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from recording_log where user='" . mysql_real_escape_string($user) . "' and start_time >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and start_time <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by recording_id desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) + { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $location = $row[11]; + if (strlen($location)>30) + {$locat = substr($location,0,27); $locat = "$locat...";} + else + {$locat = $location;} + if (eregi("http",$location)) + {$location = "$locat";} + else + {$location = $locat;} + $u++; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + } + + +echo "
# LEADDATE/TIME SECONDS   RECIDFILENAMELOCATION  
$u $row[12] $row[4] $row[8] $row[0] $row[10] $location  
\n"; + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nχÏόνος εκτέλεσης διαδικασίας: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/user_status.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/user_status.php new file mode 100644 index 00000000..97ef2cac --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/user_status.php @@ -0,0 +1,242 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1738 - Added variable filtering to eliminate SQL injection attack threat +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["begin_date"])) {$begin_date=$_GET["begin_date"];} + elseif (isset($_POST["begin_date"])) {$begin_date=$_POST["begin_date"];} +if (isset($_GET["end_date"])) {$end_date=$_GET["end_date"];} + elseif (isset($_POST["end_date"])) {$end_date=$_POST["end_date"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"];} + elseif (isset($_POST["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); + +if (!isset($begin_date)) {$begin_date = $TODAY;} +if (!isset($end_date)) {$end_date = $TODAY;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and view_reports='1';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $stmt="SELECT full_name,change_agent_campaign from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $change_agent_campaign=$row[1]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + + $stmt="SELECT full_name,user_group from vicidial_users where user='" . mysql_real_escape_string($user) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + $user_group = $row[1]; + + $stmt="SELECT * from vicidial_live_agents where user='" . mysql_real_escape_string($user) . "';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $agents_to_print = mysql_num_rows($rslt); + $i=0; + while ($i < $agents_to_print) + { + $row=mysql_fetch_row($rslt); + $Aserver_ip = $row[2]; + $Asession_id = $row[3]; + $Aextension = $row[4]; + $Astatus = $row[5]; + $Acampaign = $row[7]; + $Alast_call = $row[14]; + $Acl_campaigns = $row[15]; + $i++; + } + + } + +$stmt="select * from vicidial_campaigns;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + + + +?> + + +ΔΙΑΧΕΙΡΙΣΗ: User Status +\n"; +?> + + +
+
+ + + + +\n"; +echo "
" ?>   ΔΙΑΧΕΙΡΙΣΗ: User Status for  
  \n"; + +if ($stage == "live_campaign_change") +{ + $stmt="UPDATE vicidial_live_agents set campaign_id='" . mysql_real_escape_string($group) . "' where user='" . mysql_real_escape_string($user) . "';"; + $rslt=mysql_query($stmt, $link); + + echo "Agent $user - $full_name changed to $group campaign
\n"; + + exit; +} + +if ($stage == "log_agent_out") +{ + $stmt="DELETE from vicidial_live_agents where user='" . mysql_real_escape_string($user) . "';"; + $rslt=mysql_query($stmt, $link); + + echo "Agent $user - $full_name has been emergency logged out, make sure they close their web browser
\n"; + + exit; +} + +if ($agents_to_print > 0) +{ + echo "
";
+	echo "Agent Logged in at server:  $Aserver_ip\n";
+	echo "               in session:  $Asession_id\n";
+	echo "               from phone:  $Aextension\n";
+	echo "Agent is in campaign:       $Acampaign\n";
+	echo "              status:       $Astatus\n";
+	echo " hungup last call at:       $Alast_call\n";
+	echo "       Closer groups:       $Acl_campaigns\n\n";
+
+	echo "
"; + + + if ($change_agent_campaign > 0) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "Current ΕκστÏατεία: \n"; + echo "
\n"; + + + echo "
\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + } +} + +else +{ + echo "Agent is not logged in\n
"; + +} + + +echo "           $user - $full_name \n"; +echo "       GROUP: $user_group

\n"; + +echo "VICIDIAL Time Sheet\n"; +echo " - User Stats\n"; +echo " - ΤÏοποποίηση ΧÏήστη\n"; + +echo "
\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nχÏόνος εκτέλεσης διαδικασίας: $RUNtime seconds
"; + +echo "|$stage|$group|"; + +?> + + +
+ + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/vdremote.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/vdremote.php new file mode 100644 index 00000000..a0adc1ed --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/vdremote.php @@ -0,0 +1,602 @@ + LICENSE: GPLv2 +# +# Changes +# 50307-1721 - First version +# 51123-1502 - removed requirement of PHP Globals=on +# 60421-1229 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1603 - Added variable filtering to eliminate SQL injection attack threat +# +# make sure you have added a user to the vicidial_users MySQL table with at least user_level 4 to access this page the first time + +$version = '1.1.12'; +$build = '60619-1603'; + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["ADD"])) {$ADD=$_GET["ADD"];} + elseif (isset($_POST["ADD"])) {$ADD=$_POST["ADD"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["force_logout"])) {$force_logout=$_GET["force_logout"];} + elseif (isset($_POST["force_logout"])) {$force_logout=$_POST["force_logout"];} +if (isset($_GET["groups"])) {$groups=$_GET["groups"];} + elseif (isset($_POST["groups"])) {$groups=$_POST["groups"];} +if (isset($_GET["remote_agent_id"])) {$remote_agent_id=$_GET["remote_agent_id"];} + elseif (isset($_POST["remote_agent_id"])) {$remote_agent_id=$_POST["remote_agent_id"];} +if (isset($_GET["user_start"])) {$user_start=$_GET["user_start"];} + elseif (isset($_POST["user_start"])) {$user_start=$_POST["user_start"];} +if (isset($_GET["number_of_lines"])) {$number_of_lines=$_GET["number_of_lines"];} + elseif (isset($_POST["number_of_lines"])) {$number_of_lines=$_POST["number_of_lines"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["conf_exten"])) {$conf_exten=$_GET["conf_exten"];} + elseif (isset($_POST["conf_exten"])) {$conf_exten=$_POST["conf_exten"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["groups"])) {$groups=$_GET["groups"];} + elseif (isset($_POST["groups"])) {$groups=$_POST["groups"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_GET["ΕΠΙΒΕΒΑΙΩΣΗ"];} + elseif (isset($_POST["ΕΠΙΒΕΒΑΙΩΣΗ"])) {$ΕΠΙΒΕΒΑΙΩΣΗ=$_POST["ΕΠΙΒΕΒΑΙΩΣΗ"];} + +if (!isset($force_logout)) {$force_logout = 0;} + +if ($force_logout) +{ + if( (strlen($PHP_AUTH_USER)>0) or (strlen($PHP_AUTH_PW)>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "Έχετε αποσυνδεθεί. Σας ευχαÏιστοÏμε\n"; + exit; +} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + +$popup_page = './closer_popup.php'; +$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='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 3;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "ΑκυÏο Ονομα ΧÏήστη/Κωδικός ΠÏόσβασης: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + + $stmt="SELECT count(*) from vicidial_remote_agents where user_start='$PHP_AUTH_USER';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $authx=$row[0]; + + if($authx>0) + { + $stmt="SELECT remote_agent_id,server_ip,number_of_lines from vicidial_remote_agents where user_start='$PHP_AUTH_USER';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id=$row[0]; + $server_ip=$row[1]; + if (!$number_of_lines) {$number_of_lines=$row[2];} + + fwrite ($fp, "VDremote|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VDremote|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + echo "This remote agent does not exist: |$PHP_AUTH_USER|\n"; + exit; + } + } + else + { + fwrite ($fp, "VDremote|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +echo "\n"; +if ($ADD==61111) + { + echo"\n"; + } +echo "\n"; +?> + +ΑΠΟΜΑΚΡΥΣΜΕÎΟΙ ΧΕΙΡΙΣΤΕΣ: $LOGfullname - $PHP_AUTH_USER "; + +if (!$ADD) {$ADD="31111";} +if ($ADD==31111) {echo "ΤÏοποποίηση ΑπομακÏυσμένων ΧειÏιστών";} +if ($ADD==41111) {echo "ΤÏοποποίηση ΑπομακÏυσμένων ΧειÏιστών";} +if ($ADD==61111) {echo "Remote Agent Status";} +if ($ADD==71111) {echo "Remote Agent Closer Stats";} + + +if (strlen($ADD)>4) + { + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rslt=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rslt); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $servers_list .= "\n"; + $o++; + } + + ##### get campaigns listing for dynamic pulldown + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + $campaigns_list=''; + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $campaigns_list .= "\n"; + $o++; + } + + ##### get inbound groups listing for checkboxes + if ( (($ADD==31111) or ($ADD==31111)) and (count($groups)<1) ) + { + $stmt="SELECT closer_campaigns from vicidial_remote_agents where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + $stmt="SELECT group_id,group_name from vicidial_inbound_groups order by group_id"; + $rslt=mysql_query($stmt, $link); + $groups_to_print = mysql_num_rows($rslt); + $groups_list=''; + $groups_value=''; + + $o=0; + while ($groups_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $group_id_value = $rowx[0]; + $group_name_value = $rowx[1]; + $groups_list .= "2) {$groups_value .= " -";} + } + +?> + + + +
+
+ + + +
  ΑΠΟΜΑΚΡΥΣΜΕÎΟΙ ΧΕΙΡΙΣΤΕΣ:   ΑποσÏνδεση  
  ΤΡΟΠΟΠΟΙΗΣΗ | ">ΚΑΤΑΣΤΑΣΗ | ">ΣΤΑΤΙΣΤΙΚΑ ΕΙΣΕΡΧΟΜΕÎΩÎ
+"; + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + +echo "
ΤΡΟΠΟΠΟΙΗΣΗ ΚΑΤΑΧΩΡΗΣΗΣ ΑΠΟΜΑΚΡΥΣΜΕÎΩΠΧΕΙΡΙΣΤΩÎ: $row[0]
\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
ID ΧÏήστη Ξεκινά: $user_start
ΑÏιθμός ΓÏαμμών: (μόνο αÏιθμοί)
IP Διακομιστή: $row[3]
ΕξωτεÏική Τηλ. ΣÏνδεση: (number dialed to reach agents [i.e. 913125551212])
Κατάσταση:
ΕκστÏατεία: $campaign_id
ΕισεÏχόμενες Ομάδες: \n"; +echo "$groups_list"; +echo "
\n"; +echo "ΣΗΜΕΙΩΣΗ: ΜποÏεί να διαÏκέσει και 30 δευτεÏόλεπτα για να καταχωÏηθοÏν οι αλλαγές της οθόνης\n"; + +} + + + + +###################### +# ADD=41111 modify remote agents info in the system +###################### + +if ($ADD==41111) +{ + echo ""; + + if ( (strlen($number_of_lines) < 1) or (strlen($conf_exten) < 2) ) + {echo "
ΑΠΟΜΑΚΡΥΣΜΕÎΟΙ ΧΕΙΡΙΣΤΕΣ ΔΕΠΤΡΟΠΟΠΟΙΗΘΗΚΑΠ- ΠαÏακαλώ ελέγξτε τα δεδομένα που καταχωÏήσατε\n";} + else + { + $stmt="UPDATE vicidial_remote_agents set number_of_lines='" . mysql_real_escape_string($number_of_lines) . "', conf_exten='" . mysql_real_escape_string($conf_exten) . "', status='" . mysql_real_escape_string($status) . "', closer_campaigns='" . mysql_real_escape_string($groups_value) . "' where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';"; + $rslt=mysql_query($stmt, $link); + +# echo "$stmt\n"; + echo "
ΑΠΟΜΑΚΡΥΣΜΕÎΟΙ ΧΕΙΡΙΣΤΕΣ ΤΡΟΠΟΠΟΙΗΘΗΚΑÎ\n"; + + ### LOG CHANGES TO LOG FILE ### + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY ΑΠΟΜΑΚΡΥΣΜΕÎΟΙ ΧΕΙΡΙΣΤΕΣ ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + + } + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + +echo "
ΤΡΟΠΟΠΟΙΗΣΗ ΚΑΤΑΧΩΡΗΣΗΣ ΑΠΟΜΑΚΡΥΣΜΕÎΩΠΧΕΙΡΙΣΤΩÎ: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
ID ΧÏήστη Ξεκινά: $user_start
ΑÏιθμός ΓÏαμμών: (μόνο αÏιθμοί)
IP Διακομιστή: $row[3]
ΕξωτεÏική Τηλ. ΣÏνδεση: (number dialed to reach agents [i.e. 913125551212])
Κατάσταση:
ΕκστÏατεία: $campaign_id
ΕισεÏχόμενες Ομάδες: \n"; +echo "$groups_list"; +echo "
\n"; +echo "ΣΗΜΕΙΩΣΗ: ΜποÏεί να διαÏκέσει και 30 δευτεÏόλεπτα για να καταχωÏηθοÏν οι αλλαγές της οθόνης\n"; + +} + + + + +###################### +# ADD=61111 status of remote agent in the system and active calls and queue +###################### + +if ($ADD==61111) +{ + echo "
";
+
+	 if ( (strlen($server_ip) < 2) or (strlen($user) < 2) )
+		{echo "
ΛΑΘΟΣ ΑΠΟΜΑΚΡΥΣΜΕÎΩΠΧΕΙΡΙΣΤΩÎ\n";} + else + { + + $users_list = ''; + $k=0; + while($k < $number_of_lines) + { + $nextuser=($user + $k); + $users_list .= "'" . mysql_real_escape_string($nextuser) . "',"; + $k++; + } + $users_list = preg_replace("/.$/","",$users_list); + + echo "VICIDIAL: Remote Agent Time On Calls $NOW_TIME\n\n"; + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + echo "| STATION | USER | LEADID | CHANNEL | STATUS | START TIME | MINUTES |\n"; + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + + + $stmt="select extension,user,lead_id,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish) from vicidial_live_agents where status NOT IN('PAUSED') and server_ip='" . mysql_real_escape_string($server_ip) . "' and user IN($users_list) order by extension;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + while ($i < $talking_to_print) + { + $leadlink=0; + $row=mysql_fetch_row($rslt); + if (eregi("READY|PAUSED",$row[4])) + { + $row[3]=''; + $row[5]='- ΑÎΑΜΟÎΗ -'; + $row[6]=$row[7]; + } + $extension = sprintf("%-10s", $row[0]); + $user = sprintf("%-6s", $row[1]); + $leadid = sprintf("%-12s", $row[2]); + if ($row[2] > 0) + { + $leadidLINK=$row[2]; + $leadlink++; + if ( eregi("QUEUE",$row[4]) ) {$row[6]=$STARTtime;} + $leadid = "$leadid"; + } + $channel = sprintf("%-10s", $row[3]); + $cc=0; + while ( (strlen($channel) > 10) and ($cc < 100) ) + { + $channel = eregi_replace(".$","",$channel); + $cc++; + if (strlen($channel) <= 10) {$cc=101;} + } + $status = sprintf("%-6s", $row[4]); + $start_time = sprintf("%-19s", $row[5]); + $call_time_S = ($STARTtime - $row[6]); + + $call_time_M = ($call_time_S / 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"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + if ($call_time_M_int >= 5) {$G=''; $EG='';} + if ($call_time_M_int >= 10) {$G=''; $EG='';} + + echo "| $G$extension$EG | $G$user$EG | $G$leadid$EG | $G$channel$EG | $G$status$EG | $G$start_time$EG | $G$call_time_MS$EG |\n"; + + $i++; + } + + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + echo " $i ΧειÏιστές συνδεμένοι στον διακομιστή $server_ip\n\n"; + + echo " - 5 λεπτά ή παÏαπάνω σε κλήση\n"; + echo " - Πάνω από 10 λεπτά σε κλήση\n"; + + } + else + { + echo "**************************************************************************************\n"; + echo "********************************* ΚΑÎΕÎΑΣ ΧΕΙΡ. ΣΕ ΚΛΗΣΕΙΣ *********************************\n"; + echo "**************************************************************************************\n"; + } + } + +echo "
\n\n"; + +} + + +###################### +# ADD=71111 stats for remote agents from closer logs(vicidial_closer_log) +###################### + +if ($ADD==71111) +{ + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n\n"; + echo "
";
+
+	 if ( (strlen($server_ip) < 2) or (strlen($user) < 2) )
+		{echo "
ΛΑΘΟΣ ΑΠΟΜΑΚΡΥΣΜΕÎΩΠΧΕΙΡΙΣΤΩÎ\n";} + else + { + + $users_list = ''; + $k=0; + while($k < $number_of_lines) + { + $nextuser=($user + $k); + $users_list .= "'$nextuser',"; + $k++; + } + $users_list = preg_replace("/.$/","",$users_list); + + $stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and user IN($users_list);"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $in_calls = $row[0]; + $in_time = $row[1]; + $in_time_M = ($in_time / 60); + $in_time_M = round($in_time_M, 2); + $in_time_M_int = intval("$in_time_M"); + $in_time_SEC = ($in_time_M - $in_time_M_int); + $in_time_SEC = ($in_time_SEC * 60); + $in_time_SEC = round($in_time_SEC, 0); + if ($in_time_SEC < 10) {$in_time_SEC = "0$in_time_SEC";} + $in_time_MS = "$in_time_M_int:$in_time_SEC"; + $in_time_MS = sprintf("%7s", $in_time_MS); + + echo "VICIDIAL: Στατιστικά εισεÏχομένων απομακÏυσμένου χειÏιστή $NOW_TIME\n\n"; + echo "\n"; + echo "Συνολικές κλήσεις που διακομίστηκαν$query_date: $in_calls\n"; + echo "Συνολικός χÏόνος ομιλίας σε$query_date: $in_time_MS (minutes:seconds)\n"; + echo "\n"; + echo "\n"; + echo "Λίστα Κλήσεων για$query_date:\n"; + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + echo "| USER | LEADID | GROUP | PHONE NUM | STATUS | CALL TIME | MINUTES |\n"; + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + + + $stmt="select user,lead_id,campaign_id,phone_number,status,call_date,length_in_sec from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and user IN($users_list) order by call_date;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + while ($i < $talking_to_print) + { + $row=mysql_fetch_row($rslt); + $user = sprintf("%-8s", $row[0]); + $leadid = sprintf("%-10s", $row[1]); + $group = sprintf("%-14s", $row[2]); + $phone = sprintf("%-10s", $row[3]); + $status = sprintf("%-6s", $row[4]); + $start_time = sprintf("%-19s", $row[5]); + $call_time_S = $row[6]; + + $call_time_M = ($call_time_S / 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"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + # if ($call_time_M_int >= 5) {$G=''; $EG='';} + # if ($call_time_M_int >= 10) {$G=''; $EG='';} + + echo "| $G$user$EG | $G$leadid$EG | $G$group$EG | $G$phone$EG | $G$status$EG | $G$start_time$EG | $G$call_time_MS$EG |\n"; + + $i++; + } + + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + # echo " $i ΧειÏιστές συνδεμένοι στον διακομιστή $server_ip\n\n"; + + # echo " - 5 λεπτά ή παÏαπάνω σε κλήση\n"; + # echo " - Πάνω από 10 λεπτά σε κλήση\n"; + + } + else + { + echo "**************************************************************************************\n"; + echo "*********************************ΔΕΠΥΠΑΡΧΟΥΠΚΛΗΣΕΙΣ ΓΙΑ ΑΥΤΗ ΤΗΠΗΜΕΡΑ*******************************\n"; + echo "**************************************************************************************\n"; + } + } + +echo "
\n\n"; + +} + + + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nχÏόνος εκτέλεσης διαδικασίας: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/welcome.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/welcome.php new file mode 100644 index 00000000..00b8d8f0 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_el/welcome.php @@ -0,0 +1,25 @@ + LICENSE: GPLv2 +# + +echo "VICIDIAL ΚαλωσήÏθες\n"; +echo "\n"; +echo "\n"; +echo "




"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Υποδοχή
 
Agent Login
 
Administration
 
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; + +?> \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_CLOSERstats.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_CLOSERstats.php new file mode 100644 index 00000000..ec53f93f --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_CLOSERstats.php @@ -0,0 +1,617 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1714 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 60905-1326 - Added queue time stats +# 71008-1436 - Added shift to be defined in dbconnect.php +# 71025-0021 - Added status breakdown +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["shift"])) {$shift=$_GET["shift"];} + elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +if (strlen($shift)<2) {$shift='ALL';} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = '';} +if (!isset($query_date)) {$query_date = $NOW_DATE;} + +$stmt="select group_id from vicidial_inbound_groups;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: VDAD Closer Stats\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "           MODIFY | REPORTS \n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "PLEASE SELECT A CAMPAIGN AND DATE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$time_BEGIN=$AM_shift_BEGIN;
+	$time_END=$AM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "03:45:00";}   
+	if (strlen($time_END) < 6) {$time_END = "15:15:00";}
+	}
+if ($shift == 'PM') 
+	{
+	$time_BEGIN=$PM_shift_BEGIN;
+	$time_END=$PM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "15:15:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:15:00";}
+	}
+if ($shift == 'ALL') 
+	{
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "00:00:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:59:59";}
+	}
+$query_date_BEGIN = "$query_date $time_BEGIN";   
+$query_date_END = "$query_date $time_END";
+
+
+
+echo "VICIDIAL: Auto-dial Closer Stats                      $NOW_TIME\n";
+
+echo "\n";
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{$average_hold_seconds = '         0';}
+else
+	{
+	$average_hold_seconds = ($row[1] / $row[0]);
+	$average_hold_seconds = round($average_hold_seconds, 0);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+
+echo "Total Calls placed from this Campaign:        $TOTALcalls\n";
+echo "Average Call Length for all Calls:            $average_hold_seconds seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP' and (length_in_sec <= 999 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$DROPcalls =	sprintf("%10s", $row[0]);
+if ( ($DROPcalls < 1) or ($TOTALcalls < 1) )
+	{$DROPpercent = '0';}
+else
+	{
+	$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
+	$DROPpercent = round($DROPpercent, 0);
+	}
+
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{$average_hold_seconds = '         0';}
+else
+	{
+	$average_hold_seconds = ($row[1] / $row[0]);
+	$average_hold_seconds = round($average_hold_seconds, 0);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+
+echo "Total DROP Calls:                             $DROPcalls  $DROPpercent%\n";
+echo "Average hold time for DROP Calls:             $average_hold_seconds seconds\n";
+
+
+
+##############################
+#########  CALL STATUS STATS
+
+$TOTALcalls = 0;
+
+echo "\n";
+echo "---------- CALL STATUS STATS\n";
+echo "+--------+----------------------+------------+\n";
+echo "| STATUS | DESCRIPTION          | CALLS      |\n";
+echo "+--------+----------------------+------------+\n";
+
+$stmt="SELECT * from vicidial_statuses order by status";
+$rslt=mysql_query($stmt, $link);
+$statuses_to_print = mysql_num_rows($rslt);
+$statuses_list='';
+
+$o=0;
+while ($statuses_to_print > $o) 
+	{
+	$rowx=mysql_fetch_row($rslt);
+	$statname_list["$rowx[0]"] = "$rowx[1]";
+	$o++;
+	}
+
+$stmt="SELECT * from vicidial_campaign_statuses order by status";
+$rslt=mysql_query($stmt, $link);
+$Cstatuses_to_print = mysql_num_rows($rslt);
+
+$o=0;
+while ($Cstatuses_to_print > $o) 
+	{
+	$rowx=mysql_fetch_row($rslt);
+	$statname_list["$rowx[0]"] = "$rowx[1]";
+	$o++;
+	}
+
+$stmt="select count(*),status from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysql_real_escape_string($group) . "' group by status;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$statuses_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $statuses_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$TOTALcalls = ($TOTALcalls + $row[0]);
+
+	$STATUScount =	sprintf("%10s", $row[0]);while(strlen($STATUScount)>10) {$STATUScount = substr("$STATUScount", 0, -1);}
+	$RAWstatus = $row[1];
+	$status =	sprintf("%-6s", $row[1]);while(strlen($status)>6) {$status = substr("$status", 0, -1);}
+
+	if ($non_latin < 1)
+		{
+		 $status_name =	sprintf("%-20s", $statname_list[$RAWstatus]); 
+		 while(strlen($status_name)>20) {$status_name = substr("$status_name", 0, -1);}	
+		}
+	else
+		{
+		 $status_name =	sprintf("%-60s", $statname_list[$RAWstatus]); 
+		 while(mb_strlen($status_name,'utf-8')>20) {$status_name = mb_substr("$status_name", 0, -1,'utf-8');}	
+		}
+
+
+	echo "| $status | $status_name | $STATUScount |\n";
+
+	$i++;
+	}
+
+$TOTALcalls =		sprintf("%10s", $TOTALcalls);
+
+echo "+--------+----------------------+------------+\n";
+echo "| TOTAL:                        | $TOTALcalls |\n";
+echo "+-------------------------------+------------+\n";
+
+
+
+
+echo "\n";
+echo "---------- QUEUE STATS\n";
+
+$stmt="select count(*),sum(queue_seconds) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and (queue_seconds > 0);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$QUEUEcalls =	sprintf("%10s", $row[0]);
+if ( ($QUEUEcalls < 1) or ($TOTALcalls < 1) )
+	{$QUEUEpercent = '0';}
+else
+	{
+	$QUEUEpercent = (($QUEUEcalls / $TOTALcalls) * 100);
+	$QUEUEpercent = round($QUEUEpercent, 0);
+	}
+
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{$average_queue_seconds = '         0';}
+else
+	{
+	$average_queue_seconds = ($row[1] / $row[0]);
+	$average_queue_seconds = round($average_queue_seconds, 2);
+	$average_queue_seconds = sprintf("%10.2f", $average_queue_seconds);
+	}
+
+if ( ($TOTALcalls < 1) or ($row[1] < 1) )
+	{$average_total_queue_seconds = '         0';}
+else
+	{
+	$average_total_queue_seconds = ($row[1] / $TOTALcalls);
+	$average_total_queue_seconds = round($average_total_queue_seconds, 2);
+	$average_total_queue_seconds = sprintf("%10.2f", $average_total_queue_seconds);
+	}
+
+echo "Total Calls That entered Queue:               $QUEUEcalls  $QUEUEpercent%\n";
+echo "Average QUEUE Length for queue calls:         $average_queue_seconds seconds\n";
+echo "Average QUEUE Length across all calls:        $average_total_queue_seconds seconds\n";
+
+
+##############################
+#########  USER STATS
+
+$TOTagents=0;
+$TOTcalls=0;
+$TOTtime=0;
+$TOTavg=0;
+
+echo "\n";
+echo "---------- AGENT STATS\n";
+echo "+--------------------------+------------+----------+--------+\n";
+echo "| AGENT                    | CALLS      | TIME M   | AVRG M |\n";
+echo "+--------------------------+------------+----------+--------+\n";
+
+$stmt="select vicidial_closer_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_closer_log,vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysql_real_escape_string($group) . "' and vicidial_closer_log.user is not null and length_in_sec is not null and length_in_sec > 4 and vicidial_closer_log.user=vicidial_users.user group by vicidial_closer_log.user;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$TOTcalls = ($TOTcalls + $row[2]);
+	$TOTtime = ($TOTtime + $row[3]);
+
+	$user =			sprintf("%-6s", $row[0]);
+	$full_name =	sprintf("%-15s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
+	$USERcalls =	sprintf("%10s", $row[2]);
+	$USERtotTALK =	$row[3];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$USERtotTALK_MS =		sprintf("%8s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $user - $full_name | $USERcalls | $USERtotTALK_MS | $USERavgTALK_MS |\n";
+
+	$i++;
+	}
+
+if (!$TOTcalls) {$TOTcalls = 1;}
+$TOTavg = ($TOTtime / $TOTcalls);
+$TOTavg = round($TOTavg, 0);
+$TOTavg_M = ($TOTavg / 60);
+$TOTavg_M = round($TOTavg_M, 2);
+$TOTavg_M_int = intval("$TOTavg_M");
+$TOTavg_S = ($TOTavg_M - $TOTavg_M_int);
+$TOTavg_S = ($TOTavg_S * 60);
+$TOTavg_S = round($TOTavg_S, 0);
+if ($TOTavg_S < 10) {$TOTavg_S = "0$TOTavg_S";}
+$TOTavg_MS = "$TOTavg_M_int:$TOTavg_S";
+$TOTavg =		sprintf("%6s", $TOTavg_MS);
+
+$TOTtime_M = ($TOTtime / 60);
+$TOTtime_M = 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 ($TOTtime_S < 10) {$TOTtime_S = "0$TOTtime_S";}
+$TOTtime_MS = "$TOTtime_M_int:$TOTtime_S";
+$TOTtime =		sprintf("%6s", $TOTtime_MS);
+
+$TOTagents =		sprintf("%10s", $i);
+$TOTcalls =			sprintf("%10s", $TOTcalls);
+$TOTtime =			sprintf("%8s", $TOTtime);
+$TOTavg =			sprintf("%6s", $TOTavg);
+
+echo "+--------------------------+------------+----------+--------+\n";
+echo "| TOTAL Agents: $TOTagents | $TOTcalls | $TOTtime | $TOTavg |\n";
+echo "+--------------------------+------------+----------+--------+\n";
+
+
+##############################
+#########  TIME STATS
+
+echo "\n";
+echo "---------- TIME STATS\n";
+
+echo "\n";
+
+$hi_hour_count=0;
+$last_full_record=0;
+$i=0;
+$h=0;
+while ($i <= 96)
+	{
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+	$h++;
+	}
+
+if ($hi_hour_count < 1)
+	{$hour_multiplier = 0;}
+else
+	{
+	$hour_multiplier = (100 / $hi_hour_count);
+	#$hour_multiplier = round($hour_multiplier, 0);
+	}
+
+echo "\n";
+echo "GRAPH IN 15 MINUTE INCREMENTS OF TOTAL CALLS PLACED FROM THIS CAMPAIGN\n";
+
+$k=1;
+$Mk=0;
+$call_scale = '0';
+while ($k <= 102) 
+	{
+	if ($Mk >= 5) 
+		{
+		$Mk=0;
+		if ( ($k < 1) or ($hour_multiplier <= 0) )
+			{$scale_num = 100;}
+		else
+			{
+			$scale_num=($k / $hour_multiplier);
+			$scale_num = round($scale_num, 0);
+			}
+		$LENscale_num = (strlen($scale_num));
+		$k = ($k + $LENscale_num);
+		$call_scale .= "$scale_num";
+		}
+	else
+		{
+		$call_scale .= " ";
+		$k++;   $Mk++;
+		}
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+$ZZ = '00';
+$i=0;
+$h=4;
+$hour= -1;
+$no_lines_yet=1;
+
+while ($i <= 96)
+	{
+	$char_counter=0;
+	$time = '      ';
+	if ($h >= 4) 
+		{
+		$hour++;
+		$h=0;
+		if ($hour < 10) {$hour = "0$hour";}
+		$time = "+$hour$ZZ+";
+		}
+	if ($h == 1) {$time = "   15 ";}
+	if ($h == 2) {$time = "   30 ";}
+	if ($h == 3) {$time = "   45 ";}
+	$Ghour_count = $hour_count[$i];
+	if ($Ghour_count < 1) 
+		{
+		if ( ($no_lines_yet) or ($i > $last_full_record) )
+			{
+			$do_nothing=1;
+			}
+		else
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			echo "|$time|";
+			$k=0;   while ($k <= 102) {echo " ";   $k++;}
+			echo "| $hour_count[$i] |\n";
+			}
+		}
+	else
+		{
+		$no_lines_yet=0;
+		$Xhour_count = ($Ghour_count * $hour_multiplier);
+		$Yhour_count = (99 - $Xhour_count);
+
+		$Gdrop_count = $drop_count[$i];
+		if ($Gdrop_count < 1) 
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "*X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 101) {echo " ";   $char_counter++;}
+			echo "| 0     | $hour_count[$i] |\n";
+
+			}
+		else
+			{
+			$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+		#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+			$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+			echo "D";   $char_counter++;
+			$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 102) {echo " ";   $char_counter++;}
+			echo "| $drop_count[$i] | $hour_count[$i] |\n";
+			}
+		}
+	
+	
+	$i++;
+	$h++;
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n\n";
+
+
+
+
+
+$ENDtime = date("U");
+$RUNtime = ($ENDtime - $STARTtime);
+echo "\nRun Time: $RUNtime seconds\n";
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_VDADstats.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_VDADstats.php new file mode 100644 index 00000000..d8afbdd6 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_VDADstats.php @@ -0,0 +1,647 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1718 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 61215-1139 - Added drop percentage of answered and round-2 decimal +# 71008-1436 - Added shift to be defined in dbconnect.php +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["shift"])) {$shift=$_GET["shift"];} + elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +if (strlen($shift)<2) {$shift='ALL';} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = '';} +if (!isset($query_date)) {$query_date = $NOW_DATE;} + +$stmt="select campaign_id from vicidial_campaigns;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: VDAD Stats\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "           MODIFY | REPORTS \n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "PLEASE SELECT A CAMPAIGN AND DATE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$time_BEGIN=$AM_shift_BEGIN;
+	$time_END=$AM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "03:45:00";}   
+	if (strlen($time_END) < 6) {$time_END = "15:15:00";}
+	}
+if ($shift == 'PM') 
+	{
+	$time_BEGIN=$PM_shift_BEGIN;
+	$time_END=$PM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "15:15:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:15:00";}
+	}
+if ($shift == 'ALL') 
+	{
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "00:00:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:59:59";}
+	}
+$query_date_BEGIN = "$query_date $time_BEGIN";   
+$query_date_END = "$query_date $time_END";
+
+
+
+echo "VICIDIAL: Auto-dial Stats                             $NOW_TIME\n";
+
+echo "\n";
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{$average_hold_seconds = '         0';}
+else
+	{
+	$average_hold_seconds = ($row[1] / $row[0]);
+	$average_hold_seconds = round($average_hold_seconds, 2);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+echo "Total Calls placed from this Campaign:        $TOTALcalls\n";
+echo "Average Call Length for all Calls in seconds: $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP' and (length_in_sec <= 60 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$DROPcalls =	sprintf("%10s", $row[0]);
+$DROPcallsRAW =	$row[0];
+$DROPseconds =	$row[1];
+
+$stmt="select count(*) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and status NOT IN('NA','B');";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$ANSWERcalls =	$row[0];
+
+if ( ($DROPcalls < 1) or ($TOTALcalls < 1) )
+	{$DROPpercent = '0';}
+else
+	{
+	$DROPpercent = (($DROPcallsRAW / $TOTALcalls) * 100);
+	$DROPpercent = round($DROPpercent, 2);
+	}
+
+if ( ($DROPcalls < 1) or ($ANSWERcalls < 1) )
+	{$DROPANSWERpercent = '0';}
+else
+	{
+	$DROPANSWERpercent = (($DROPcallsRAW / $ANSWERcalls) * 100);
+	$DROPANSWERpercent = round($DROPANSWERpercent, 2);
+	}
+
+if ( ($DROPseconds < 1) or ($DROPcallsRAW < 1) )
+	{$average_hold_seconds = '         0';}
+else
+	{
+	$average_hold_seconds = ($DROPseconds / $DROPcallsRAW);
+	$average_hold_seconds = round($average_hold_seconds, 2);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+
+echo "Total DROP Calls:                             $DROPcalls  $DROPpercent%\n";
+echo "Percent of DROP Calls taken out of Answers:   $DROPcalls / $ANSWERcalls  $DROPANSWERpercent%\n";
+echo "Average Length for DROP Calls in seconds:     $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- AUTO-DIAL NO ANSWERS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and status IN('NA','B') and (length_in_sec <= 60 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$NAcalls =	sprintf("%10s", $row[0]);
+if ( ($NAcalls < 1) or ($TOTALcalls < 1) )
+	{$NApercent = '0';}
+else
+	{
+	$NApercent = (($NAcalls / $TOTALcalls) * 100);
+	$NApercent = round($NApercent, 2);
+	}
+
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{$average_na_seconds = '         0';}
+else
+	{
+	$average_na_seconds = ($row[1] / $row[0]);
+	$average_na_seconds = round($average_na_seconds, 2);
+	$average_na_seconds =	sprintf("%10s", $average_na_seconds);
+	}
+
+echo "Total NA calls -Busy,Disconnect,RingNoAnswer: $NAcalls  $NApercent%\n";
+echo "Average Call Length for NA Calls in seconds:  $average_na_seconds\n";
+
+
+##############################
+#########  CALL STATUS STATS
+
+$TOTALcalls = 0;
+
+echo "\n";
+echo "---------- CALL STATUS STATS\n";
+echo "+--------+----------------------+------------+\n";
+echo "| STATUS | DESCRIPTION          | CALLS      |\n";
+echo "+--------+----------------------+------------+\n";
+
+$stmt="SELECT * from vicidial_statuses order by status";
+$rslt=mysql_query($stmt, $link);
+$statuses_to_print = mysql_num_rows($rslt);
+$statuses_list='';
+
+$o=0;
+while ($statuses_to_print > $o) 
+	{
+	$rowx=mysql_fetch_row($rslt);
+	$statname_list["$rowx[0]"] = "$rowx[1]";
+	$o++;
+	}
+
+$stmt="SELECT * from vicidial_campaign_statuses where campaign_id='" . mysql_real_escape_string($group) . "' order by status";
+$rslt=mysql_query($stmt, $link);
+$Cstatuses_to_print = mysql_num_rows($rslt);
+
+$o=0;
+while ($Cstatuses_to_print > $o) 
+	{
+	$rowx=mysql_fetch_row($rslt);
+	$statname_list["$rowx[0]"] = "$rowx[1]";
+	$o++;
+	}
+
+$stmt="select count(*),status from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysql_real_escape_string($group) . "' group by status;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$statuses_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $statuses_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$TOTALcalls = ($TOTALcalls + $row[0]);
+
+	$STATUScount =	sprintf("%10s", $row[0]);while(strlen($STATUScount)>10) {$STATUScount = substr("$STATUScount", 0, -1);}
+	$RAWstatus = $row[1];
+	$status =	sprintf("%-6s", $row[1]);while(strlen($status)>6) {$status = substr("$status", 0, -1);}
+
+	if ($non_latin < 1)
+		{
+		 $status_name =	sprintf("%-20s", $statname_list[$RAWstatus]); 
+		 while(strlen($status_name)>20) {$status_name = substr("$status_name", 0, -1);}	
+		}
+	else
+		{
+		 $status_name =	sprintf("%-60s", $statname_list[$RAWstatus]); 
+		 while(mb_strlen($status_name,'utf-8')>20) {$status_name = mb_substr("$status_name", 0, -1,'utf-8');}	
+		}
+
+
+	echo "| $status | $status_name | $STATUScount |\n";
+
+	$i++;
+	}
+
+$TOTALcalls =		sprintf("%10s", $TOTALcalls);
+
+echo "+--------+----------------------+------------+\n";
+echo "| TOTAL:                        | $TOTALcalls |\n";
+echo "+-------------------------------+------------+\n";
+
+
+##############################
+#########  USER STATS
+
+$TOTagents=0;
+$TOTcalls=0;
+$TOTtime=0;
+$TOTavg=0;
+
+echo "\n";
+echo "---------- AGENT STATS\n";
+echo "+--------------------------+------------+----------+--------+\n";
+echo "| AGENT                    | CALLS      | TIME M   | AVRG M |\n";
+echo "+--------------------------+------------+----------+--------+\n";
+
+$stmt="select vicidial_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_log,vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysql_real_escape_string($group) . "' and vicidial_log.user is not null and length_in_sec is not null and length_in_sec > 4 and vicidial_log.user=vicidial_users.user group by vicidial_log.user;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$TOTcalls = ($TOTcalls + $row[2]);
+	$TOTtime = ($TOTtime + $row[3]);
+
+	$user =	sprintf("%-6s", $row[0]);while(strlen($user)>6) {$user = substr("$user", 0, -1);}
+	if ($non_latin < 1)
+	{
+ 	 $full_name =	sprintf("%-15s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}	
+	}
+	else
+	{
+	 $full_name =	sprintf("%-45s", $row[1]); while(mb_strlen($full_name,'utf-8')>15) {$full_name = mb_substr("$full_name", 0, -1,'utf-8');}	
+	}
+	$USERcalls =	sprintf("%10s", $row[2]);
+	$USERtotTALK =	$row[3];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$USERtotTALK_MS =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $user - $full_name | $USERcalls |   $USERtotTALK_MS | $USERavgTALK_MS |\n";
+
+	$i++;
+	}
+
+if (!$TOTcalls) {$TOTcalls = 1;}
+$TOTavg = ($TOTtime / $TOTcalls);
+$TOTavg = round($TOTavg, 0);
+$TOTavg_M = ($TOTavg / 60);
+$TOTavg_M = round($TOTavg_M, 2);
+$TOTavg_M_int = intval("$TOTavg_M");
+$TOTavg_S = ($TOTavg_M - $TOTavg_M_int);
+$TOTavg_S = ($TOTavg_S * 60);
+$TOTavg_S = round($TOTavg_S, 0);
+if ($TOTavg_S < 10) {$TOTavg_S = "0$TOTavg_S";}
+$TOTavg_MS = "$TOTavg_M_int:$TOTavg_S";
+$TOTavg =		sprintf("%6s", $TOTavg_MS);
+
+$TOTtime_M = ($TOTtime / 60);
+$TOTtime_M = 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 ($TOTtime_S < 10) {$TOTtime_S = "0$TOTtime_S";}
+$TOTtime_MS = "$TOTtime_M_int:$TOTtime_S";
+$TOTtime =		sprintf("%6s", $TOTtime_MS);
+
+$TOTagents =		sprintf("%10s", $i);
+$TOTcalls =			sprintf("%10s", $TOTcalls);
+$TOTtime =			sprintf("%8s", $TOTtime);
+$TOTavg =			sprintf("%6s", $TOTavg);
+
+$stmt="select avg(wait_sec) from vicidial_agent_log where event_time >= '$query_date_BEGIN' and event_time <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$AVGwait = $row[0];
+$AVGwait_M = ($AVGwait / 60);
+$AVGwait_M = round($AVGwait_M, 2);
+$AVGwait_M_int = intval("$AVGwait_M");
+$AVGwait_S = ($AVGwait_M - $AVGwait_M_int);
+$AVGwait_S = ($AVGwait_S * 60);
+$AVGwait_S = round($AVGwait_S, 0);
+if ($AVGwait_S < 10) {$AVGwait_S = "0$AVGwait_S";}
+$AVGwait_MS = "$AVGwait_M_int:$AVGwait_S";
+$AVGwait =		sprintf("%6s", $AVGwait_MS);
+
+echo "+--------------------------+------------+----------+--------+\n";
+echo "| TOTAL Agents: $TOTagents | $TOTcalls | $TOTtime | $TOTavg |\n";
+echo "+--------------------------+------------+----------+--------+\n";
+echo "| Average Wait time between calls                    $AVGwait |\n";
+echo "+-----------------------------------------------------------+\n";
+
+##############################
+#########  TIME STATS
+
+echo "\n";
+echo "---------- TIME STATS\n";
+
+echo "\n";
+
+$hi_hour_count=0;
+$last_full_record=0;
+$i=0;
+$h=0;
+while ($i <= 96)
+	{
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+	$h++;
+	}
+
+if ($hi_hour_count < 1)
+	{$hour_multiplier = 0;}
+else
+	{
+	$hour_multiplier = (100 / $hi_hour_count);
+	#$hour_multiplier = round($hour_multiplier, 0);
+	}
+
+echo "\n";
+echo "GRAPH IN 15 MINUTE INCREMENTS OF TOTAL CALLS PLACED FROM THIS CAMPAIGN\n";
+
+$k=1;
+$Mk=0;
+$call_scale = '0';
+while ($k <= 102) 
+	{
+	if ($Mk >= 5) 
+		{
+		$Mk=0;
+		if ( ($k < 1) or ($hour_multiplier <= 0) )
+			{$scale_num = 100;}
+		else
+			{
+			$scale_num=($k / $hour_multiplier);
+			$scale_num = round($scale_num, 0);
+			}
+		$LENscale_num = (strlen($scale_num));
+		$k = ($k + $LENscale_num);
+		$call_scale .= "$scale_num";
+		}
+	else
+		{
+		$call_scale .= " ";
+		$k++;   $Mk++;
+		}
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+$ZZ = '00';
+$i=0;
+$h=4;
+$hour= -1;
+$no_lines_yet=1;
+
+while ($i <= 96)
+	{
+	$char_counter=0;
+	$time = '      ';
+	if ($h >= 4) 
+		{
+		$hour++;
+		$h=0;
+		if ($hour < 10) {$hour = "0$hour";}
+		$time = "+$hour$ZZ+";
+		}
+	if ($h == 1) {$time = "   15 ";}
+	if ($h == 2) {$time = "   30 ";}
+	if ($h == 3) {$time = "   45 ";}
+	$Ghour_count = $hour_count[$i];
+	if ($Ghour_count < 1) 
+		{
+		if ( ($no_lines_yet) or ($i > $last_full_record) )
+			{
+			$do_nothing=1;
+			}
+		else
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			echo "|$time|";
+			$k=0;   while ($k <= 102) {echo " ";   $k++;}
+			echo "| $hour_count[$i] |\n";
+			}
+		}
+	else
+		{
+		$no_lines_yet=0;
+		$Xhour_count = ($Ghour_count * $hour_multiplier);
+		$Yhour_count = (99 - $Xhour_count);
+
+		$Gdrop_count = $drop_count[$i];
+		if ($Gdrop_count < 1) 
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "*X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 101) {echo " ";   $char_counter++;}
+			echo "| 0     | $hour_count[$i] |\n";
+
+			}
+		else
+			{
+			$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+		#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+			$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+			echo "D";   $char_counter++;
+			$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 102) {echo " ";   $char_counter++;}
+			echo "| $drop_count[$i] | $hour_count[$i] |\n";
+			}
+		}
+	
+	
+	$i++;
+	$h++;
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+
+
+
+
+
+$ENDtime = date("U");
+$RUNtime = ($ENDtime - $STARTtime);
+echo "\nRun Time: $RUNtime seconds\n";
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_VICIDIAL_hopperlist.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_VICIDIAL_hopperlist.php new file mode 100644 index 00000000..a30832be --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_VICIDIAL_hopperlist.php @@ -0,0 +1,169 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1654 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 70115-1614 - Added ALT field for vicidial_hopper alt_dial column +# 71029-0852 - Added list_id to the output +# 71030-2118 - Added priority to display +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and modify_campaigns='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = '';} +if (!isset($query_date)) {$query_date = $NOW_DATE;} +if (!isset($server_ip)) {$server_ip = '10.10.10.15';} + +$stmt="select campaign_id,campaign_name from vicidial_campaigns order by campaign_id;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$campaigns_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $campaigns_to_print) + { + $row=mysql_fetch_row($rslt); + $campaign_id[$i] =$row[0]; + $campaign_name[$i] =$row[1]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: Hopper List\n"; +echo "
\n"; +#echo "\n"; +#echo "\n"; +echo "\n"; +echo "\n"; +echo "           MODIFY \n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "PLEASE SELECT A CAMPAIGN ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+
+
+echo "VICIDIAL: Live Current Hopper List                      $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+
+echo "Total leads in hopper right now:       $TOTALcalls\n";
+
+
+##############################
+#########  LEAD STATS
+
+echo "\n";
+echo "---------- LEADS IN HOPPER\n";
+echo "+------+--------+-----------+------------+------------+-------+--------+-------+--------+-------+\n";
+echo "|ORDER |PRIORITY| LEAD ID   | LIST ID    | PHONE NUM  | STATE | STATUS | COUNT | GMT    | ALT   |\n";
+echo "+------+--------+-----------+------------+------------+-------+--------+-------+--------+-------+\n";
+
+$stmt="select vicidial_hopper.lead_id,phone_number,vicidial_hopper.state,vicidial_list.status,called_count,vicidial_hopper.gmt_offset_now,hopper_id,alt_dial,vicidial_hopper.list_id,vicidial_hopper.priority from vicidial_hopper,vicidial_list where vicidial_hopper.campaign_id='" . mysql_real_escape_string($group) . "' and vicidial_hopper.lead_id=vicidial_list.lead_id order by priority desc,hopper_id limit 2000;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$FMT_i =		sprintf("%-4s", $i);
+	$lead_id =		sprintf("%-9s", $row[0]);
+	$phone_number =	sprintf("%-10s", $row[1]);
+	$state =		sprintf("%-5s", $row[2]);
+	$status =		sprintf("%-6s", $row[3]);
+	$count =		sprintf("%-5s", $row[4]);
+	$gmt =			sprintf("%-6s", $row[5]);
+	$hopper_id =	sprintf("%-6s", $row[6]);
+	$alt_dial =		sprintf("%-5s", $row[7]);
+	$list_id =		sprintf("%-10s", $row[8]);
+	$priority =		sprintf("%-6s", $row[9]);
+
+if ($DB) {echo "| $FMT_i | $priority | $lead_id | $list_id | $phone_number | $state | $status | $count | $gmt | $hopper_id |\n";}
+else {echo "| $FMT_i | $priority | $lead_id | $list_id | $phone_number | $state | $status | $count | $gmt | $alt_dial |\n";}
+
+	$i++;
+	}
+
+echo "+------+--------+-----------+------------+------------+-------+--------+-------+--------+-------+\n";
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_admin_log_display.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_admin_log_display.php new file mode 100644 index 00000000..9c5c4af6 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_admin_log_display.php @@ -0,0 +1,118 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); +$query_date = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$query_date); + +# AST GUI database administration +# AST_admin_log_display.php +# +# CHANGES +# 50325-0932 - First build +# 51123-1443 - removed globals=on requirement +# 60421-1229 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60620-1044 - Added variable filtering to eliminate SQL injection attack threat +# + +$version = '0.0.4'; +$build = '60620-1044'; + +$STARTtime = date("U"); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 8 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDIAL ADMIN LOG DISPLAY"; +echo "\n"; + +# Fri, 25 Mar 2005 + +$DAY_DATE = date("j"); +if ($DAY_DATE < 10) +# {$GREP_DATE = date("D, j M Y");} + {$GREP_DATE = date("D, 0j M Y");} +else + {$GREP_DATE = date("D, j M Y");} + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!$query_date) {$query_date = $GREP_DATE;} + +$Gquery_date = eregi_replace(" ",'\ ',$query_date); +echo "\n"; + +echo "
\n"; +echo "\n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+echo "VICIDIAL ADMIN CHANGE LOG                             $NOW_TIME\n";
+
+#passthru("grep $Gquery_date /home/www/htdocs/vicidial/admin_changes_log.txt");
+passthru("grep $Gquery_date $WeBServeRRooT/vicidial/admin_changes_log.txt");
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_agent_disposition.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_agent_disposition.php new file mode 100644 index 00000000..b0b0a461 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_agent_disposition.php @@ -0,0 +1,237 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 70201-1213 - First build - from Marin Blu +# +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["shift"])) {$shift=$_GET["shift"];} + elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = '';} +if (!isset($begin_date)) {$begin_date = $NOW_DATE;} +if (!isset($end_date)) {$end_date = $NOW_DATE;} + +$stmt="select campaign_id from vicidial_campaigns;"; +if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$campaigns_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $campaigns_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: Agent Disposition\n"; +echo "
\n"; +echo "Date - From: to \n"; +echo "  \n"; +echo "\n"; +echo "\n"; +echo "           MODIFY | REPORTS \n"; +echo "\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A SERVER AND DATE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+
+echo "VICIDIAL: Agent Disposition                             $NOW_TIME\n";
+
+echo "Time range: $begin_date to $end_date \n\n";
+echo "---------- Disposition Details -------------\n\n";
+
+echo "+-----------------+------------+--------+--------+--------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+\n";
+echo "| USER NAME       | ID         | CALLS  | TALK   | TALKAVG| A    | B    |CALLBK|CBHOLD| DEC  | DC   | DNC  | DROP |INCALL| LB   | N    | NA   | NI   | NP   | NQ   |QUEUE | SALE | XFER |\n";
+echo "+-----------------+------------+--------+--------+--------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+\n";
+
+$stmt="select count(*) as calls,sum(length_in_sec) as talk,full_name,vicidial_users.user,avg(length_in_sec) from vicidial_users,vicidial_log where call_date >= '$begin_date 00:00:01' and call_date <= '$end_date 23:59:59'  and vicidial_users.user=vicidial_log.user and campaign_id='" . mysql_real_escape_string($group) . "' group by full_name order by calls desc limit 1000;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$TOTcalls=($TOTcalls + $row[0]);
+	$TOTtotTALK=($TOTtotTALK + $row[1]);
+	$calls[$i] =	sprintf("%-6s", $row[0]);
+	$full_name[$i]=	sprintf("%-15s", $row[2]); while(strlen($full_name[$i])>15) {$full_name[$i] = substr("$full_name[$i]", 0, -1);}
+	$user[$i] =		sprintf("%-10s", $row[3]); while(strlen($user[$i])>10) {$user[$i] = substr("$user[$i]", 0, -1);}
+	$USERtotTALK =	$row[1];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$pfUSERtotTALK_MS[$i] =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$pfUSERavgTALK_MS[$i] =		sprintf("%6s", $USERavgTALK_MS);
+	$i++;
+	}
+	
+$k=0;
+
+while($k < $i)
+	
+	{
+	$ctA[$k]="0   "; $ctB[$k]="0   "; $ctDC[$k]="0   "; $ctDNC[$k]="0   "; $ctN[$k]="0   "; $ctNI[$k]="0   "; $ctSALE[$k]="0   ";  $ctINCALL[$k]="0   ";  $ctDROP[$k]="0   ";  $ctQUEUE[$k]="0   ";  $ctNP[$k]="0   ";   $ctDEC[$k]="0   ";  $ctNQ[$k]="0   ";  $ctNA[$k]="0   ";   $ctXFER[$k]="0   "; $ctLB[$k]="0   ";  $ctCALLBK[$k]="0   "; $ctCBHOLD[$k]="0   ";
+	$stmt="select count(*),status from vicidial_log where call_date >= '$begin_date 00:00:01' and call_date <= '$end_date 23:59:59'  and user='$user[$k]' and campaign_id='" . mysql_real_escape_string($group) . "' group by status;";
+	if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$rows_to_print = mysql_num_rows($rslt);
+	$m=0;
+	while ($m < $rows_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if ($row[1] == 'A') {$ctA[$k]=sprintf("%-4s", $row[0]);		$TOT_A = ($TOT_A + $row[0]);}
+		if ($row[1] == 'B') {$ctB[$k]=sprintf("%-4s", $row[0]);		$TOT_B = ($TOT_B + $row[0]);}
+		if ($row[1] == 'DC') {$ctDC[$k]=sprintf("%-4s", $row[0]);	$TOT_DC = ($TOT_DC + $row[0]);}
+		if ($row[1] == 'DNC') {$ctDNC[$k]=sprintf("%-4s", $row[0]);	$TOT_DNC = ($TOT_DNC + $row[0]);}
+		if ($row[1] == 'N') {$ctN[$k]=sprintf("%-4s", $row[0]);		$TOT_N = ($TOT_N + $row[0]);}
+		if ($row[1] == 'NI') {$ctNI[$k]=sprintf("%-4s", $row[0]);	$TOT_NI = ($TOT_NI + $row[0]);}
+		if ($row[1] == 'SALE') {$ctSALE[$k]=sprintf("%-4s", $row[0]);	$TOT_SALE = ($TOT_SALE + $row[0]);}
+		if ($row[1] == 'INCALL') {$ctINCALL[$k]=sprintf("%-4s", $row[0]);	$TOT_INCALL = ($TOT_INCALL + $row[0]);}
+		if ($row[1] == 'DROP') {$ctDROP[$k]=sprintf("%-4s", $row[0]);	$TOT_DROP = ($TOT_DROP + $row[0]);}
+		if ($row[1] == 'QUEUE') {$ctQUEUE[$k]=sprintf("%-4s", $row[0]);	$TOT_QUEUE = ($TOT_QUEUE + $row[0]);}
+		if ($row[1] == 'NP') {$ctNP[$k]=sprintf("%-4s", $row[0]);	$TOT_NP = ($TOT_NP + $row[0]);}
+		if ($row[1] == 'DEC') {$ctDEC[$k]=sprintf("%-4s", $row[0]);	$TOT_DEC = ($TOT_DEC + $row[0]);}
+		if ($row[1] == 'NQ') {$ctNQ[$k]=sprintf("%-4s", $row[0]);	$TOT_NQ = ($TOT_NQ + $row[0]);}
+		if ($row[1] == 'NA') {$ctNA[$k]=sprintf("%-4s", $row[0]);	$TOT_NA = ($TOT_NA + $row[0]);}
+		if ($row[1] == 'XFER') {$ctXFER[$k]=sprintf("%-4s", $row[0]);	$TOT_XFER = ($TOT_XFER + $row[0]);}
+		if ($row[1] == 'LB') {$ctLB[$k]=sprintf("%-4s", $row[0]);	$TOT_LB = ($TOT_LB + $row[0]);}
+		if ($row[1] == 'CALLBK') {$ctCALLBK[$k]=sprintf("%-4s", $row[0]);	$TOT_CALLBK = ($TOT_CALLBK + $row[0]);}
+		if ($row[1] == 'CBHOLD') {$ctCBHOLD[$k]=sprintf("%-4s", $row[0]);	$TOT_CBHOLD = ($TOT_CBHOLD + $row[0]);}
+		$m++;
+		}
+	echo "| $full_name[$k] | $user[$k] | $calls[$k] | $pfUSERtotTALK_MS[$k] | $pfUSERavgTALK_MS[$k] | $ctA[$k] | $ctB[$k] | $ctCALLBK[$k] | $ctCBHOLD[$k] | $ctDEC[$k] | $ctDC[$k] | $ctDNC[$k] | $ctDROP[$k] | $ctINCALL[$k] | $ctLB[$k] | $ctN[$k] | $ctNA[$k] | $ctNI[$k] | $ctNP[$k] | $ctNQ[$k] | $ctQUEUE[$k] | $ctSALE[$k] | $ctXFER[$k] | \n";
+
+	$k++;
+	}
+
+	$TOTcalls =	sprintf("%-7s", $TOTcalls);
+
+	$TOTtotTALK_M = ($TOTtotTALK / 60);
+	$TOTtotTALK_M = round($TOTtotTALK_M, 2);
+	$TOTtotTALK_M_int = intval("$TOTtotTALK_M");
+	$TOTtotTALK_S = ($TOTtotTALK_M - $TOTtotTALK_M_int);
+	$TOTtotTALK_S = ($TOTtotTALK_S * 60);
+	$TOTtotTALK_S = round($TOTtotTALK_S, 0);
+	if ($TOTtotTALK_S < 10) {$TOTtotTALK_S = "0$TOTtotTALK_S";}
+	$TOTtotTALK_MS = "$TOTtotTALK_M_int:$TOTtotTALK_S";
+	$TOTtotTALK_MS =		sprintf("%7s", $TOTtotTALK_MS);
+		while(strlen($TOTtotTALK_MS)>7) {$TOTtotTALK_MS = substr("$TOTtotTALK_MS", 0, -1);}
+
+	$TOT_A = sprintf("%-5s", $TOT_A);
+	$TOT_B = sprintf("%-5s", $TOT_B);
+	$TOT_DC = sprintf("%-5s", $TOT_DC);
+	$TOT_DNC = sprintf("%-5s", $TOT_DNC);
+	$TOT_N = sprintf("%-5s", $TOT_N);
+	$TOT_NI = sprintf("%-5s", $TOT_NI);
+	$TOT_SALE = sprintf("%-5s", $TOT_SALE);
+	$TOT_INCALL = sprintf("%-5s", $TOT_INCALL);
+	$TOT_DROP = sprintf("%-5s", $TOT_DROP); 
+	$TOT_QUEUE = sprintf("%-5s", $TOT_QUEUE);
+	$TOT_NP = sprintf("%-5s", $TOT_NP);
+	$TOT_DEC = sprintf("%-5s", $TOT_DEC);
+	$TOT_NQ = sprintf("%-5s", $TOT_NQ);
+	$TOT_NA = sprintf("%-5s", $TOT_NA);
+	$TOT_XFER = sprintf("%-5s", $TOT_XFER);
+	$TOT_LB= sprintf("%-5s", $TOT_LB);
+	$TOT_CALLBK = sprintf("%-5s", $TOT_CALLBK);
+	$TOT_CBHOLD = sprintf("%-5s", $TOT_CBHOLD);
+
+echo "+-----------------+------------+--------+--------+--------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+\n";
+echo "|  TOTALS                      | $TOTcalls| $TOTtotTALK_MS|        | $TOT_A| $TOT_B| $TOT_CALLBK| $TOT_CBHOLD| $TOT_DEC| $TOT_DC| $TOT_DNC| $TOT_DROP| $TOT_INCALL| $TOT_LB| $TOT_N| $TOT_NA| $TOT_NI| $TOT_NP| $TOT_NQ| $TOT_QUEUE| $TOT_SALE| $TOT_XFER|\n";
+echo "+-----------------+------------+--------+--------+--------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+\n";
+echo "\n";
+
+}
+?>
+
\ No newline at end of file
diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_agent_performance.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_agent_performance.php
new file mode 100644
index 00000000..eb2ceac4
--- /dev/null
+++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_agent_performance.php
@@ -0,0 +1,257 @@
+    LICENSE: GPLv2
+###
+# CHANGES
+#
+# 60619-1711 - Added variable filtering to eliminate SQL injection attack threat
+#            - Added required user/pass to gain access to this page
+# 70201-1203 - Added non_latin UTF8 output code, widened USER ID to 8 chars
+#
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+if (isset($_GET["group"]))				{$group=$_GET["group"];}
+	elseif (isset($_POST["group"]))		{$group=$_POST["group"];}
+if (isset($_GET["query_date"]))				{$query_date=$_GET["query_date"];}
+	elseif (isset($_POST["query_date"]))		{$query_date=$_POST["query_date"];}
+if (isset($_GET["shift"]))				{$shift=$_GET["shift"];}
+	elseif (isset($_POST["shift"]))		{$shift=$_POST["shift"];}
+if (isset($_GET["submit"]))				{$submit=$_GET["submit"];}
+	elseif (isset($_POST["submit"]))		{$submit=$_POST["submit"];}
+if (isset($_GET["SUBMIT"]))				{$SUBMIT=$_GET["SUBMIT"];}
+	elseif (isset($_POST["SUBMIT"]))		{$SUBMIT=$_POST["SUBMIT"];}
+
+$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
+$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
+
+	$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
+	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($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
+	{
+    Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
+    Header("HTTP/1.0 401 Unauthorized");
+    echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
+    exit;
+	}
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!isset($group)) {$group = '';}
+if (!isset($query_date)) {$query_date = $NOW_DATE;}
+
+$stmt="select campaign_id from vicidial_campaigns;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$campaigns_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $campaigns_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$groups[$i] =$row[0];
+	$i++;
+	}
+?>
+
+
+
+
+
+\n";
+echo "VICIDIAL: Agent Performance\n";
+echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "           MODIFY | REPORTS \n"; +echo "
\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A SERVER AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
+echo " NOTE: stats taken from 6 hour shift specified\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$query_date_BEGIN = "$query_date 08:45:00";   
+	$query_date_END = "$query_date 15:33:00";
+	$time_BEGIN = "08:45:00";   
+	$time_END = "15:33:00";
+	}
+if ($shift == 'PM') 
+	{
+	$query_date_BEGIN = "$query_date 15:33:00";   
+	$query_date_END = "$query_date 23:15:00";
+	$time_BEGIN = "15:33:00";   
+	$time_END = "23:15:00";
+	}
+
+echo "VICIDIAL: Agent Performance                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENTS Details -------------\n\n";
+
+echo "+-----------------+----------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+echo "| USER NAME       | ID       | CALLS  | TALK   | TALKAVG| A    | B    | DC   | DNC  | N    | NI   | SALE |\n";
+echo "+-----------------+----------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+
+$stmt="select count(*) as calls,sum(length_in_sec) as talk,full_name,vicidial_users.user,avg(length_in_sec) from vicidial_users,vicidial_log where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN' and vicidial_users.user=vicidial_log.user and campaign_id='" . mysql_real_escape_string($group) . "' group by full_name order by calls desc limit 1000;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$TOTcalls=($TOTcalls + $row[0]);
+	$TOTtotTALK=($TOTtotTALK + $row[1]);
+	$calls[$i] =	sprintf("%-6s", $row[0]);
+
+	if ($non_latin < 1)
+	{
+   	 $full_name[$i]=	sprintf("%-15s", $row[2]); 
+	 while(strlen($full_name[$i])>15) {$full_name[$i] = substr("$full_name[$i]", 0, -1);}
+
+	 $user[$i] =		sprintf("%-6s", $row[3]);
+        while(strlen($user[$i])>6) {$user[$i] = substr("$user[$i]", 0, -1);}
+       }
+	else
+	{	
+        $full_name[$i]=	sprintf("%-45s", $row[2]); 
+	 while(mb_strlen($full_name[$i],'utf-8')>15) {$full_name[$i] = mb_substr("$full_name[$i]", 0, -1,'utf-8');}
+
+ 	 $user[$i] =		sprintf("%-18s", $row[3]);
+	 while(mb_strlen($user[$i],'utf-8')>6) {$user[$i] = mb_substr("$user[$i]", 0, -1,'utf-8');}
+	}
+
+	$user[$i] =		sprintf("%-8s", $row[3]);
+	$USERtotTALK =	$row[1];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$pfUSERtotTALK_MS[$i] =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$pfUSERavgTALK_MS[$i] =		sprintf("%6s", $USERavgTALK_MS);
+	$i++;
+	}
+
+$k=0;
+while($k < $i)
+	{
+	$ctA[$k]="0   "; $ctB[$k]="0   "; $ctDC[$k]="0   "; $ctDNC[$k]="0   "; $ctN[$k]="0   "; $ctNI[$k]="0   "; $ctSALE[$k]="0   "; 
+	$stmt="select count(*),status from vicidial_log where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN' and user='$user[$k]' and campaign_id='" . mysql_real_escape_string($group) . "' group by status;";
+	if ($non_latin > 0)
+	{
+	$rslt=mysql_query("SET NAMES 'UTF8'");
+	}
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$rows_to_print = mysql_num_rows($rslt);
+	$m=0;
+	while ($m < $rows_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if ($row[1] == 'A') {$ctA[$k]=sprintf("%-4s", $row[0]);		$TOT_A = ($TOT_A + $row[0]);}
+		if ($row[1] == 'B') {$ctB[$k]=sprintf("%-4s", $row[0]);		$TOT_B = ($TOT_B + $row[0]);}
+		if ($row[1] == 'DC') {$ctDC[$k]=sprintf("%-4s", $row[0]);	$TOT_DC = ($TOT_DC + $row[0]);}
+		if ($row[1] == 'DNC') {$ctDNC[$k]=sprintf("%-4s", $row[0]);	$TOT_DNC = ($TOT_DNC + $row[0]);}
+		if ($row[1] == 'N') {$ctN[$k]=sprintf("%-4s", $row[0]);		$TOT_N = ($TOT_N + $row[0]);}
+		if ($row[1] == 'NI') {$ctNI[$k]=sprintf("%-4s", $row[0]);	$TOT_NI = ($TOT_NI + $row[0]);}
+		if (($row[1] == 'SALE') || ($row[1] == 'XFER') ) {$ctSALE[$k]=sprintf("%-4s", $row[0]);	$TOT_SALE = ($TOT_SALE + $row[0]);}
+		$m++;
+		}
+	echo "| $full_name[$k] | $user[$k] | $calls[$k] | $pfUSERtotTALK_MS[$k] | $pfUSERavgTALK_MS[$k] | $ctA[$k] | $ctB[$k] | $ctDC[$k] | $ctDNC[$k] | $ctN[$k] | $ctNI[$k] | $ctSALE[$k] |\n";
+
+
+
+	$k++;
+	}
+
+	$TOTcalls =	sprintf("%-7s", $TOTcalls);
+
+	$TOTtotTALK_M = ($TOTtotTALK / 60);
+	$TOTtotTALK_M = round($TOTtotTALK_M, 2);
+	$TOTtotTALK_M_int = intval("$TOTtotTALK_M");
+	$TOTtotTALK_S = ($TOTtotTALK_M - $TOTtotTALK_M_int);
+	$TOTtotTALK_S = ($TOTtotTALK_S * 60);
+	$TOTtotTALK_S = round($TOTtotTALK_S, 0);
+	if ($TOTtotTALK_S < 10) {$TOTtotTALK_S = "0$TOTtotTALK_S";}
+	$TOTtotTALK_MS = "$TOTtotTALK_M_int:$TOTtotTALK_S";
+	$TOTtotTALK_MS =		sprintf("%7s", $TOTtotTALK_MS);
+		while(strlen($TOTtotTALK_MS)>7) {$TOTtotTALK_MS = substr("$TOTtotTALK_MS", 0, -1);}
+
+	$TOT_A = sprintf("%-5s", $TOT_A);
+	$TOT_B = sprintf("%-5s", $TOT_B);
+	$TOT_DC = sprintf("%-5s", $TOT_DC);
+	$TOT_DNC = sprintf("%-5s", $TOT_DNC);
+	$TOT_N = sprintf("%-5s", $TOT_N);
+	$TOT_NI = sprintf("%-5s", $TOT_NI);
+	$TOT_SALE = sprintf("%-5s", $TOT_SALE);
+
+echo "+-----------------+----------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+echo "|  TOTALS                    | $TOTcalls| $TOTtotTALK_MS|        | $TOT_A| $TOT_B| $TOT_DC| $TOT_DNC| $TOT_N| $TOT_NI| $TOT_SALE|\n";
+echo "+-----------------+----------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+
+echo "\n";
+
+}
+
+
+
+?>
+
+
\ No newline at end of file
diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_agent_performance_detail.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_agent_performance_detail.php
new file mode 100644
index 00000000..5557d4dd
--- /dev/null
+++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_agent_performance_detail.php
@@ -0,0 +1,557 @@
+    LICENSE: GPLv2
+###
+# CHANGES
+#
+# 71119-2359 - First build
+# 71121-0144 - Replace existing AST_agent_performance_detail.php script with this one
+#            - Fixed zero division bug
+#
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+if (isset($_GET["query_date"]))				{$query_date=$_GET["query_date"];}
+	elseif (isset($_POST["query_date"]))	{$query_date=$_POST["query_date"];}
+if (isset($_GET["group"]))				{$group=$_GET["group"];}
+	elseif (isset($_POST["group"]))		{$group=$_POST["group"];}
+if (isset($_GET["user_group"]))				{$user_group=$_GET["user_group"];}
+	elseif (isset($_POST["user_group"]))	{$user_group=$_POST["user_group"];}
+if (isset($_GET["shift"]))				{$shift=$_GET["shift"];}
+	elseif (isset($_POST["shift"]))		{$shift=$_POST["shift"];}
+if (isset($_GET["submit"]))				{$submit=$_GET["submit"];}
+	elseif (isset($_POST["submit"]))	{$submit=$_POST["submit"];}
+if (isset($_GET["SUBMIT"]))				{$SUBMIT=$_GET["SUBMIT"];}
+	elseif (isset($_POST["SUBMIT"]))	{$SUBMIT=$_POST["SUBMIT"];}
+
+if (strlen($shift)<2) {$shift='ALL';}
+
+$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
+$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
+
+	$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
+	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($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
+	{
+    Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
+    Header("HTTP/1.0 401 Unauthorized");
+    echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
+    exit;
+	}
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!isset($group)) {$group = '';}
+if (!isset($query_date)) {$query_date = $NOW_DATE;}
+
+$stmt="select campaign_id from vicidial_campaigns;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$campaigns_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $campaigns_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$groups[$i] =$row[0];
+	$i++;
+	}
+$stmt="select user_group from vicidial_user_groups;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$user_groups_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $user_groups_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$user_groups[$i] =$row[0];
+	$i++;
+	}
+?>
+
+
+
+
+
+\n";
+echo "VICIDIAL: Agent Performance\n";
+echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "           MODIFY | REPORTS \n"; +echo "
\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A CAMPAIGN AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
+echo " NOTE: stats taken from shift specified\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$time_BEGIN=$AM_shift_BEGIN;
+	$time_END=$AM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "03:45:00";}   
+	if (strlen($time_END) < 6) {$time_END = "15:15:00";}
+	}
+if ($shift == 'PM') 
+	{
+	$time_BEGIN=$PM_shift_BEGIN;
+	$time_END=$PM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "15:15:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:15:00";}
+	}
+if ($shift == 'ALL') 
+	{
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "00:00:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:59:59";}
+	}
+$query_date_BEGIN = "$query_date $time_BEGIN";   
+$query_date_END = "$query_date $time_END";
+
+if (strlen($user_group)>0) {$ugSQL="and vicidial_agent_log.user_group='$user_group'";}
+else {$ugSQL='';}
+
+echo "VICIDIAL: Agent Performance Detail                        $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENTS Details -------------\n\n";
+
+
+
+
+
+$statuses='-';
+$statusesTXT='';
+$statusesHEAD='';
+$statusesHTML='';
+$statusesARY[0]='';
+$j=0;
+$users='-';
+$usersARY[0]='';
+$user_namesARY[0]='';
+$k=0;
+
+$stmt="select count(*) as calls,sum(talk_sec) as talk,full_name,vicidial_users.user,sum(pause_sec),sum(wait_sec),sum(dispo_sec),status from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user and campaign_id='" . mysql_real_escape_string($group) . "' and pause_sec<36000 and wait_sec<36000 and talk_sec<36000 and dispo_sec<36000 $ugSQL group by full_name,status order by status desc,full_name limit 100000;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$row[0] = ($row[0] - 1);	# subtract 1 for login/logout event compensation
+	
+	$calls[$i] =		$row[0];
+	$talk_sec[$i] =		$row[1];
+	$full_name[$i] =	$row[2];
+	$user[$i] =			$row[3];
+	$pause_sec[$i] =	$row[4];
+	$wait_sec[$i] =		$row[5];
+	$dispo_sec[$i] =	$row[6];
+	$status[$i] =		$row[7];
+	if ( (!eregi("-$status[$i]-", $statuses)) and (strlen($status[$i])>0) )
+		{
+		$statusesTXT = sprintf("%8s", $status[$i]);
+		$statusesHEAD .= "----------+";
+		$statusesHTML .= " $statusesTXT |";
+		$statuses .= "$status[$i]-";
+		$statusesARY[$j] = $status[$i];
+		$j++;
+		}
+	if (!eregi("-$user[$i]-", $users))
+		{
+		$users .= "$user[$i]-";
+		$usersARY[$k] = $user[$i];
+		$user_namesARY[$k] = $full_name[$i];
+		$k++;
+		}
+
+	$i++;
+	}
+
+
+echo "+-----------------+----------+--------+---------+--------+--------+--------+--------+--------+--------+--------+--------+$statusesHEAD\n";
+echo "| USER NAME       | ID       | CALLS  | TIME    | PAUSE  | PAUSAVG| WAIT   | WAITAVG| TALK   | TALKAVG| DISPO  | DISPAVG|$statusesHTML\n";
+echo "+-----------------+----------+--------+---------+--------+--------+--------+--------+--------+--------+--------+--------+$statusesHEAD\n";
+
+
+### BEGIN loop through each user ###
+$m=0;
+while ($m < $k)
+	{
+	$Suser=$usersARY[$m];
+	$Sfull_name=$user_namesARY[$m];
+	$Stime=0;
+	$Scalls=0;
+	$Stalk_sec=0;
+	$Spause_sec=0;
+	$Swait_sec=0;
+	$Sdispo_sec=0;
+	$SstatusesHTML='';
+
+	### BEGIN loop through each status ###
+	$n=0;
+	while ($n < $j)
+		{
+		$Sstatus=$statusesARY[$n];
+		$SstatusTXT='';
+		### BEGIN loop through each stat line ###
+		$i=0; $status_found=0;
+		while ($i < $rows_to_print)
+			{
+			if ( ($Suser=="$user[$i]") and ($Sstatus=="$status[$i]") )
+				{
+				$Scalls =		($Scalls + $calls[$i]);
+				$Stalk_sec =	($Stalk_sec + $talk_sec[$i]);
+				$Spause_sec =	($Spause_sec + $pause_sec[$i]);
+				$Swait_sec =	($Swait_sec + $wait_sec[$i]);
+				$Sdispo_sec =	($Sdispo_sec + $dispo_sec[$i]);
+				$SstatusTXT = sprintf("%8s", $calls[$i]);
+				$SstatusesHTML .= " $SstatusTXT |";
+				$status_found++;
+				}
+			$i++;
+			}
+		if ($status_found < 1)
+			{
+			$SstatusesHTML .= "        0 |";
+			}
+		### END loop through each stat line ###
+		$n++;
+		}
+	### END loop through each status ###
+	$Stime = ($Stalk_sec + $Spause_sec + $Swait_sec + $Sdispo_sec);
+	$TOTcalls=($TOTcalls + $Scalls);
+	$TOTtime=($TOTtime + $Stime);
+	$TOTtotTALK=($TOTtotTALK + $Stalk_sec);
+	$TOTtotWAIT=($TOTtotWAIT + $Swait_sec);
+	$TOTtotPAUSE=($TOTtotPAUSE + $Spause_sec);
+	$TOTtotDISPO=($TOTtotDISPO + $Sdispo_sec);
+	$Stime = ($Stalk_sec + $Spause_sec + $Swait_sec + $Sdispo_sec);
+	if ( ($Scalls > 0) and ($Stalk_sec > 0) ) {$Stalk_avg = ($Stalk_sec/$Scalls);}
+		else {$Stalk_avg=0;}
+	if ( ($Scalls > 0) and ($Spause_sec > 0) ) {$Spause_avg = ($Spause_sec/$Scalls);}
+		else {$Spause_avg=0;}
+	if ( ($Scalls > 0) and ($Swait_sec > 0) ) {$Swait_avg = ($Swait_sec/$Scalls);}
+		else {$Swait_avg=0;}
+	if ( ($Scalls > 0) and ($Sdispo_sec > 0) ) {$Sdispo_avg = ($Sdispo_sec/$Scalls);}
+		else {$Sdispo_avg=0;}
+
+	$Scalls =	sprintf("%6s", $Scalls);
+
+	if ($non_latin < 1)
+	{
+   	 $Sfull_name=	sprintf("%-15s", $Sfull_name); 
+		while(strlen($Sfull_name)>15) {$Sfull_name = substr("$Sfull_name", 0, -1);}
+	 $Suser =		sprintf("%-8s", $Suser);
+        while(strlen($Suser)>8) {$Suser = substr("$Suser", 0, -1);}
+       }
+	else
+	{	
+        $Sfull_name=	sprintf("%-45s", $Sfull_name); 
+	 while(mb_strlen($Sfull_name,'utf-8')>15) {$Sfull_name = mb_substr("$Sfull_name", 0, -1,'utf-8');}
+
+ 		$Suser =	sprintf("%-24s", $Suser);
+	 while(mb_strlen($Suser,'utf-8')>8) {$Suser = mb_substr("$Suser", 0, -1,'utf-8');}
+	}
+
+	$USERtime_M = ($Stime / 60);
+	$USERtime_M = round($USERtime_M, 2);
+	$USERtime_M_int = intval("$USERtime_M");
+	$USERtime_S = ($USERtime_M - $USERtime_M_int);
+	$USERtime_S = ($USERtime_S * 60);
+	$USERtime_S = round($USERtime_S, 0);
+	if ($USERtime_S < 10) {$USERtime_S = "0$USERtime_S";}
+	$USERtime_MS = "$USERtime_M_int:$USERtime_S";
+	$pfUSERtime_MS =		sprintf("%7s", $USERtime_MS);
+
+	$USERtotTALK_M = ($Stalk_sec / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$pfUSERtotTALK_MS =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($Stalk_avg / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$pfUSERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	$USERtotPAUSE_M = ($Spause_sec / 60);
+	$USERtotPAUSE_M = round($USERtotPAUSE_M, 2);
+	$USERtotPAUSE_M_int = intval("$USERtotPAUSE_M");
+	$USERtotPAUSE_S = ($USERtotPAUSE_M - $USERtotPAUSE_M_int);
+	$USERtotPAUSE_S = ($USERtotPAUSE_S * 60);
+	$USERtotPAUSE_S = round($USERtotPAUSE_S, 0);
+	if ($USERtotPAUSE_S < 10) {$USERtotPAUSE_S = "0$USERtotPAUSE_S";}
+	$USERtotPAUSE_MS = "$USERtotPAUSE_M_int:$USERtotPAUSE_S";
+	$pfUSERtotPAUSE_MS =		sprintf("%6s", $USERtotPAUSE_MS);
+
+	$USERavgPAUSE_M = ($Spause_avg / 60);
+	$USERavgPAUSE_M = round($USERavgPAUSE_M, 2);
+	$USERavgPAUSE_M_int = intval("$USERavgPAUSE_M");
+	$USERavgPAUSE_S = ($USERavgPAUSE_M - $USERavgPAUSE_M_int);
+	$USERavgPAUSE_S = ($USERavgPAUSE_S * 60);
+	$USERavgPAUSE_S = round($USERavgPAUSE_S, 0);
+	if ($USERavgPAUSE_S < 10) {$USERavgPAUSE_S = "0$USERavgPAUSE_S";}
+	$USERavgPAUSE_MS = "$USERavgPAUSE_M_int:$USERavgPAUSE_S";
+	$pfUSERavgPAUSE_MS =		sprintf("%6s", $USERavgPAUSE_MS);
+
+	$USERtotWAIT_M = ($Swait_sec / 60);
+	$USERtotWAIT_M = round($USERtotWAIT_M, 2);
+	$USERtotWAIT_M_int = intval("$USERtotWAIT_M");
+	$USERtotWAIT_S = ($USERtotWAIT_M - $USERtotWAIT_M_int);
+	$USERtotWAIT_S = ($USERtotWAIT_S * 60);
+	$USERtotWAIT_S = round($USERtotWAIT_S, 0);
+	if ($USERtotWAIT_S < 10) {$USERtotWAIT_S = "0$USERtotWAIT_S";}
+	$USERtotWAIT_MS = "$USERtotWAIT_M_int:$USERtotWAIT_S";
+	$pfUSERtotWAIT_MS =		sprintf("%6s", $USERtotWAIT_MS);
+
+	$USERavgWAIT_M = ($Swait_avg / 60);
+	$USERavgWAIT_M = round($USERavgWAIT_M, 2);
+	$USERavgWAIT_M_int = intval("$USERavgWAIT_M");
+	$USERavgWAIT_S = ($USERavgWAIT_M - $USERavgWAIT_M_int);
+	$USERavgWAIT_S = ($USERavgWAIT_S * 60);
+	$USERavgWAIT_S = round($USERavgWAIT_S, 0);
+	if ($USERavgWAIT_S < 10) {$USERavgWAIT_S = "0$USERavgWAIT_S";}
+	$USERavgWAIT_MS = "$USERavgWAIT_M_int:$USERavgWAIT_S";
+	$pfUSERavgWAIT_MS =		sprintf("%6s", $USERavgWAIT_MS);
+	
+	$USERtotDISPO_M = ($Sdispo_sec / 60);
+	$USERtotDISPO_M = round($USERtotDISPO_M, 2);
+	$USERtotDISPO_M_int = intval("$USERtotDISPO_M");
+	$USERtotDISPO_S = ($USERtotDISPO_M - $USERtotDISPO_M_int);
+	$USERtotDISPO_S = ($USERtotDISPO_S * 60);
+	$USERtotDISPO_S = round($USERtotDISPO_S, 0);
+	if ($USERtotDISPO_S < 10) {$USERtotDISPO_S = "0$USERtotDISPO_S";}
+	$USERtotDISPO_MS = "$USERtotDISPO_M_int:$USERtotDISPO_S";
+	$pfUSERtotDISPO_MS =		sprintf("%6s", $USERtotDISPO_MS);
+
+	$USERavgDISPO_M = ($Sdispo_avg / 60);
+	$USERavgDISPO_M = round($USERavgDISPO_M, 2);
+	$USERavgDISPO_M_int = intval("$USERavgDISPO_M");
+	$USERavgDISPO_S = ($USERavgDISPO_M - $USERavgDISPO_M_int);
+	$USERavgDISPO_S = ($USERavgDISPO_S * 60);
+	$USERavgDISPO_S = round($USERavgDISPO_S, 0);
+	if ($USERavgDISPO_S < 10) {$USERavgDISPO_S = "0$USERavgDISPO_S";}
+	$USERavgDISPO_MS = "$USERavgDISPO_M_int:$USERavgDISPO_S";
+	$pfUSERavgDISPO_MS =		sprintf("%6s", $USERavgDISPO_MS);
+
+	echo "| $Sfull_name | $Suser | $Scalls | $pfUSERtime_MS | $pfUSERtotPAUSE_MS | $pfUSERavgPAUSE_MS | $pfUSERtotWAIT_MS | $pfUSERavgWAIT_MS | $pfUSERtotTALK_MS | $pfUSERavgTALK_MS | $pfUSERtotDISPO_MS | $pfUSERavgDISPO_MS |$SstatusesHTML\n";
+	$m++;
+	}
+### END loop through each user ###
+
+
+###### LAST LINE FORMATTING ##########
+### BEGIN loop through each status ###
+$SUMstatusesHTML='';
+$n=0;
+while ($n < $j)
+	{
+	$Scalls=0;
+	$Sstatus=$statusesARY[$n];
+	$SUMstatusTXT='';
+	### BEGIN loop through each stat line ###
+	$i=0; $status_found=0;
+	while ($i < $rows_to_print)
+		{
+		if ($Sstatus=="$status[$i]")
+			{
+			$Scalls =		($Scalls + $calls[$i]);
+			$status_found++;
+			}
+		$i++;
+		}
+	### END loop through each stat line ###
+	if ($status_found < 1)
+		{
+		$SUMstatusesHTML .= "        0 |";
+		}
+	else
+		{
+		$SUMstatusTXT = sprintf("%8s", $Scalls);
+		$SUMstatusesHTML .= " $SUMstatusTXT |";
+		}
+	$n++;
+	}
+### END loop through each status ###
+
+
+	$TOTcalls =	sprintf("%7s", $TOTcalls);
+	$TOT_AGENTS = sprintf("%-4s", $m);
+
+	$TOTtime_M = ($TOTtime / 60);
+	$TOTtime_M = 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 ($TOTtime_S < 10) {$TOTtime_S = "0$TOTtime_S";}
+	$TOTtime_MS = "$TOTtime_M_int:$TOTtime_S";
+	$TOTtime_MS =		sprintf("%8s", $TOTtime_MS);
+		while(strlen($TOTtime_MS)>8) {$TOTtime_MS = substr("$TOTtime_MS", 0, -1);}
+
+	$TOTtotTALK_M = ($TOTtotTALK / 60);
+	$TOTtotTALK_M = round($TOTtotTALK_M, 2);
+	$TOTtotTALK_M_int = intval("$TOTtotTALK_M");
+	$TOTtotTALK_S = ($TOTtotTALK_M - $TOTtotTALK_M_int);
+	$TOTtotTALK_S = ($TOTtotTALK_S * 60);
+	$TOTtotTALK_S = round($TOTtotTALK_S, 0);
+	if ($TOTtotTALK_S < 10) {$TOTtotTALK_S = "0$TOTtotTALK_S";}
+	$TOTtotTALK_MS = "$TOTtotTALK_M_int:$TOTtotTALK_S";
+	$TOTtotTALK_MS =		sprintf("%8s", $TOTtotTALK_MS);
+		while(strlen($TOTtotTALK_MS)>8) {$TOTtotTALK_MS = substr("$TOTtotTALK_MS", 0, -1);}
+
+	$TOTtotDISPO_M = ($TOTtotDISPO / 60);
+	$TOTtotDISPO_M = round($TOTtotDISPO_M, 2);
+	$TOTtotDISPO_M_int = intval("$TOTtotDISPO_M");
+	$TOTtotDISPO_S = ($TOTtotDISPO_M - $TOTtotDISPO_M_int);
+	$TOTtotDISPO_S = ($TOTtotDISPO_S * 60);
+	$TOTtotDISPO_S = round($TOTtotDISPO_S, 0);
+	if ($TOTtotDISPO_S < 10) {$TOTtotDISPO_S = "0$TOTtotDISPO_S";}
+	$TOTtotDISPO_MS = "$TOTtotDISPO_M_int:$TOTtotDISPO_S";
+	$TOTtotDISPO_MS =		sprintf("%8s", $TOTtotDISPO_MS);
+		while(strlen($TOTtotDISPO_MS)>8) {$TOTtotDISPO_MS = substr("$TOTtotDISPO_MS", 0, -1);}
+
+	$TOTtotPAUSE_M = ($TOTtotPAUSE / 60);
+	$TOTtotPAUSE_M = round($TOTtotPAUSE_M, 2);
+	$TOTtotPAUSE_M_int = intval("$TOTtotPAUSE_M");
+	$TOTtotPAUSE_S = ($TOTtotPAUSE_M - $TOTtotPAUSE_M_int);
+	$TOTtotPAUSE_S = ($TOTtotPAUSE_S * 60);
+	$TOTtotPAUSE_S = round($TOTtotPAUSE_S, 0);
+	if ($TOTtotPAUSE_S < 10) {$TOTtotPAUSE_S = "0$TOTtotPAUSE_S";}
+	$TOTtotPAUSE_MS = "$TOTtotPAUSE_M_int:$TOTtotPAUSE_S";
+	$TOTtotPAUSE_MS =		sprintf("%8s", $TOTtotPAUSE_MS);
+		while(strlen($TOTtotPAUSE_MS)>8) {$TOTtotPAUSE_MS = substr("$TOTtotPAUSE_MS", 0, -1);}
+
+	$TOTtotWAIT_M = ($TOTtotWAIT / 60);
+	$TOTtotWAIT_M = round($TOTtotWAIT_M, 2);
+	$TOTtotWAIT_M_int = intval("$TOTtotWAIT_M");
+	$TOTtotWAIT_S = ($TOTtotWAIT_M - $TOTtotWAIT_M_int);
+	$TOTtotWAIT_S = ($TOTtotWAIT_S * 60);
+	$TOTtotWAIT_S = round($TOTtotWAIT_S, 0);
+	if ($TOTtotWAIT_S < 10) {$TOTtotWAIT_S = "0$TOTtotWAIT_S";}
+	$TOTtotWAIT_MS = "$TOTtotWAIT_M_int:$TOTtotWAIT_S";
+	$TOTtotWAIT_MS =		sprintf("%8s", $TOTtotWAIT_MS);
+		while(strlen($TOTtotWAIT_MS)>8) {$TOTtotWAIT_MS = substr("$TOTtotWAIT_MS", 0, -1);}
+
+
+	$TOTavgTALK_M = ( ($TOTtotTALK / $TOTcalls) / 60);
+	$TOTavgTALK_M = round($TOTavgTALK_M, 2);
+	$TOTavgTALK_M_int = intval("$TOTavgTALK_M");
+	$TOTavgTALK_S = ($TOTavgTALK_M - $TOTavgTALK_M_int);
+	$TOTavgTALK_S = ($TOTavgTALK_S * 60);
+	$TOTavgTALK_S = round($TOTavgTALK_S, 0);
+	if ($TOTavgTALK_S < 10) {$TOTavgTALK_S = "0$TOTavgTALK_S";}
+	$TOTavgTALK_MS = "$TOTavgTALK_M_int:$TOTavgTALK_S";
+	$TOTavgTALK_MS =		sprintf("%6s", $TOTavgTALK_MS);
+		while(strlen($TOTavgTALK_MS)>6) {$TOTavgTALK_MS = substr("$TOTavgTALK_MS", 0, -1);}
+
+	$TOTavgDISPO_M = ( ($TOTtotDISPO / $TOTcalls) / 60);
+	$TOTavgDISPO_M = round($TOTavgDISPO_M, 2);
+	$TOTavgDISPO_M_int = intval("$TOTavgDISPO_M");
+	$TOTavgDISPO_S = ($TOTavgDISPO_M - $TOTavgDISPO_M_int);
+	$TOTavgDISPO_S = ($TOTavgDISPO_S * 60);
+	$TOTavgDISPO_S = round($TOTavgDISPO_S, 0);
+	if ($TOTavgDISPO_S < 10) {$TOTavgDISPO_S = "0$TOTavgDISPO_S";}
+	$TOTavgDISPO_MS = "$TOTavgDISPO_M_int:$TOTavgDISPO_S";
+	$TOTavgDISPO_MS =		sprintf("%6s", $TOTavgDISPO_MS);
+		while(strlen($TOTavgDISPO_MS)>6) {$TOTavgDISPO_MS = substr("$TOTavgDISPO_MS", 0, -1);}
+
+	$TOTavgPAUSE_M = ( ($TOTtotPAUSE / $TOTcalls) / 60);
+	$TOTavgPAUSE_M = round($TOTavgPAUSE_M, 2);
+	$TOTavgPAUSE_M_int = intval("$TOTavgPAUSE_M");
+	$TOTavgPAUSE_S = ($TOTavgPAUSE_M - $TOTavgPAUSE_M_int);
+	$TOTavgPAUSE_S = ($TOTavgPAUSE_S * 60);
+	$TOTavgPAUSE_S = round($TOTavgPAUSE_S, 0);
+	if ($TOTavgPAUSE_S < 10) {$TOTavgPAUSE_S = "0$TOTavgPAUSE_S";}
+	$TOTavgPAUSE_MS = "$TOTavgPAUSE_M_int:$TOTavgPAUSE_S";
+	$TOTavgPAUSE_MS =		sprintf("%6s", $TOTavgPAUSE_MS);
+		while(strlen($TOTavgPAUSE_MS)>6) {$TOTavgPAUSE_MS = substr("$TOTavgPAUSE_MS", 0, -1);}
+
+	$TOTavgWAIT_M = ( ($TOTtotWAIT / $TOTcalls) / 60);
+	$TOTavgWAIT_M = round($TOTavgWAIT_M, 2);
+	$TOTavgWAIT_M_int = intval("$TOTavgWAIT_M");
+	$TOTavgWAIT_S = ($TOTavgWAIT_M - $TOTavgWAIT_M_int);
+	$TOTavgWAIT_S = ($TOTavgWAIT_S * 60);
+	$TOTavgWAIT_S = round($TOTavgWAIT_S, 0);
+	if ($TOTavgWAIT_S < 10) {$TOTavgWAIT_S = "0$TOTavgWAIT_S";}
+	$TOTavgWAIT_MS = "$TOTavgWAIT_M_int:$TOTavgWAIT_S";
+	$TOTavgWAIT_MS =		sprintf("%6s", $TOTavgWAIT_MS);
+		while(strlen($TOTavgWAIT_MS)>6) {$TOTavgWAIT_MS = substr("$TOTavgWAIT_MS", 0, -1);}
+
+
+echo "+-----------------+----------+--------+---------+--------+--------+--------+--------+--------+--------+--------+--------+$statusesHEAD\n";
+echo "|  TOTALS        AGENTS:$TOT_AGENTS | $TOTcalls| $TOTtime_MS|$TOTtotPAUSE_MS| $TOTavgPAUSE_MS |$TOTtotWAIT_MS| $TOTavgWAIT_MS |$TOTtotTALK_MS| $TOTavgTALK_MS |$TOTtotDISPO_MS| $TOTavgDISPO_MS |$SUMstatusesHTML\n";
+echo "+----------------------------+--------+---------+--------+--------+--------+--------+--------+--------+--------+--------+$statusesHEAD\n";
+
+echo "\n";
+
+}
+
+
+?>
+
+
\ No newline at end of file
diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_agent_time_sheet.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_agent_time_sheet.php
new file mode 100644
index 00000000..bd562a7b
--- /dev/null
+++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_agent_time_sheet.php
@@ -0,0 +1,286 @@
+    LICENSE: GPLv2
+###
+# CHANGES
+#
+# 60619-1729 - Added variable filtering to eliminate SQL injection attack threat
+#            - Added required user/pass to gain access to this page
+#
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+if (isset($_GET["agent"]))				{$agent=$_GET["agent"];}
+	elseif (isset($_POST["agent"]))		{$agent=$_POST["agent"];}
+if (isset($_GET["query_date"]))				{$query_date=$_GET["query_date"];}
+	elseif (isset($_POST["query_date"]))		{$query_date=$_POST["query_date"];}
+if (isset($_GET["calls_summary"]))				{$calls_summary=$_GET["calls_summary"];}
+	elseif (isset($_POST["calls_summary"]))		{$calls_summary=$_POST["calls_summary"];}
+if (isset($_GET["submit"]))				{$submit=$_GET["submit"];}
+	elseif (isset($_POST["submit"]))		{$submit=$_POST["submit"];}
+if (isset($_GET["SUBMIT"]))				{$SUBMIT=$_GET["SUBMIT"];}
+	elseif (isset($_POST["SUBMIT"]))		{$SUBMIT=$_POST["SUBMIT"];}
+
+$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
+$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
+
+	$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
+	if ($DB) {echo "|$stmt|\n";}
+	$rslt=mysql_query($stmt, $link);
+	$row=mysql_fetch_row($rslt);
+	$auth=$row[0];
+
+  if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
+	{
+    Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
+    Header("HTTP/1.0 401 Unauthorized");
+    echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
+    exit;
+	}
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!isset($query_date)) {$query_date = $NOW_DATE;}
+
+?>
+
+
+
+
+
+\n";
+echo "VICIDIAL: Agent Time Sheet\n";
+echo "VICIDIAL ADMIN: Agent Time Sheet\n";
+echo " - User Stats\n";
+echo " - User Status\n";
+echo " - Modify User\n";
+echo "
\n"; +echo "
  \n"; +echo "Date: \n"; +echo "User ID: \n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n";
+
+
+if (!$agent)
+{
+echo "\n";
+echo "PLEASE SELECT AN AGENT ID AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
+echo " NOTE: stats taken from available agent log data\n";
+}
+
+else
+{
+$query_date_BEGIN = "$query_date 00:00:00";   
+$query_date_END = "$query_date 23:59:59";
+$time_BEGIN = "00:00:00";   
+$time_END = "23:59:59";
+
+$stmt="select full_name from vicidial_users where user='$agent';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$full_name = $row[0];
+
+echo "VICIDIAL: Agent Time Sheet                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENT TIME SHEET: $agent - $full_name -------------\n\n";
+
+if ($calls_summary)
+	{
+	$stmt="select count(*) as calls,sum(talk_sec) as talk,avg(talk_sec),sum(pause_sec),avg(pause_sec),sum(wait_sec),avg(wait_sec),sum(dispo_sec),avg(dispo_sec) from vicidial_agent_log where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' and pause_sec<48800 and wait_sec<48800 and talk_sec<48800 and dispo_sec<48800 limit 1;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+
+	$TOTAL_TIME = ($row[1] + $row[3] + $row[5] + $row[7]);
+
+		$TOTAL_TIME_H = ($TOTAL_TIME / 3600);
+		$TOTAL_TIME_H = round($TOTAL_TIME_H, 2);
+		$TOTAL_TIME_H_int = intval("$TOTAL_TIME_H");
+		$TOTAL_TIME_M = ($TOTAL_TIME_H - $TOTAL_TIME_H_int);
+		$TOTAL_TIME_M = ($TOTAL_TIME_M * 60);
+		$TOTAL_TIME_M = round($TOTAL_TIME_M, 2);
+		$TOTAL_TIME_M_int = intval("$TOTAL_TIME_M");
+		$TOTAL_TIME_S = ($TOTAL_TIME_M - $TOTAL_TIME_M_int);
+		$TOTAL_TIME_S = ($TOTAL_TIME_S * 60);
+		$TOTAL_TIME_S = round($TOTAL_TIME_S, 0);
+		if ($TOTAL_TIME_S < 10) {$TOTAL_TIME_S = "0$TOTAL_TIME_S";}
+		if ($TOTAL_TIME_M_int < 10) {$TOTAL_TIME_M_int = "0$TOTAL_TIME_M_int";}
+		$TOTAL_TIME_HMS = "$TOTAL_TIME_H_int:$TOTAL_TIME_M_int:$TOTAL_TIME_S";
+		$pfTOTAL_TIME_HMS =		sprintf("%8s", $TOTAL_TIME_HMS);
+
+		$TALK_TIME_H = ($row[1] / 3600);
+		$TALK_TIME_H = round($TALK_TIME_H, 2);
+		$TALK_TIME_H_int = intval("$TALK_TIME_H");
+		$TALK_TIME_M = ($TALK_TIME_H - $TALK_TIME_H_int);
+		$TALK_TIME_M = ($TALK_TIME_M * 60);
+		$TALK_TIME_M = round($TALK_TIME_M, 2);
+		$TALK_TIME_M_int = intval("$TALK_TIME_M");
+		$TALK_TIME_S = ($TALK_TIME_M - $TALK_TIME_M_int);
+		$TALK_TIME_S = ($TALK_TIME_S * 60);
+		$TALK_TIME_S = round($TALK_TIME_S, 0);
+		if ($TALK_TIME_S < 10) {$TALK_TIME_S = "0$TALK_TIME_S";}
+		if ($TALK_TIME_M_int < 10) {$TALK_TIME_M_int = "0$TALK_TIME_M_int";}
+		$TALK_TIME_HMS = "$TALK_TIME_H_int:$TALK_TIME_M_int:$TALK_TIME_S";
+		$pfTALK_TIME_HMS =		sprintf("%8s", $TALK_TIME_HMS);
+
+		$PAUSE_TIME_H = ($row[3] / 3600);
+		$PAUSE_TIME_H = round($PAUSE_TIME_H, 2);
+		$PAUSE_TIME_H_int = intval("$PAUSE_TIME_H");
+		$PAUSE_TIME_M = ($PAUSE_TIME_H - $PAUSE_TIME_H_int);
+		$PAUSE_TIME_M = ($PAUSE_TIME_M * 60);
+		$PAUSE_TIME_M = round($PAUSE_TIME_M, 2);
+		$PAUSE_TIME_M_int = intval("$PAUSE_TIME_M");
+		$PAUSE_TIME_S = ($PAUSE_TIME_M - $PAUSE_TIME_M_int);
+		$PAUSE_TIME_S = ($PAUSE_TIME_S * 60);
+		$PAUSE_TIME_S = round($PAUSE_TIME_S, 0);
+		if ($PAUSE_TIME_S < 10) {$PAUSE_TIME_S = "0$PAUSE_TIME_S";}
+		if ($PAUSE_TIME_M_int < 10) {$PAUSE_TIME_M_int = "0$PAUSE_TIME_M_int";}
+		$PAUSE_TIME_HMS = "$PAUSE_TIME_H_int:$PAUSE_TIME_M_int:$PAUSE_TIME_S";
+		$pfPAUSE_TIME_HMS =		sprintf("%8s", $PAUSE_TIME_HMS);
+
+		$WAIT_TIME_H = ($row[5] / 3600);
+		$WAIT_TIME_H = round($WAIT_TIME_H, 2);
+		$WAIT_TIME_H_int = intval("$WAIT_TIME_H");
+		$WAIT_TIME_M = ($WAIT_TIME_H - $WAIT_TIME_H_int);
+		$WAIT_TIME_M = ($WAIT_TIME_M * 60);
+		$WAIT_TIME_M = round($WAIT_TIME_M, 2);
+		$WAIT_TIME_M_int = intval("$WAIT_TIME_M");
+		$WAIT_TIME_S = ($WAIT_TIME_M - $WAIT_TIME_M_int);
+		$WAIT_TIME_S = ($WAIT_TIME_S * 60);
+		$WAIT_TIME_S = round($WAIT_TIME_S, 0);
+		if ($WAIT_TIME_S < 10) {$WAIT_TIME_S = "0$WAIT_TIME_S";}
+		if ($WAIT_TIME_M_int < 10) {$WAIT_TIME_M_int = "0$WAIT_TIME_M_int";}
+		$WAIT_TIME_HMS = "$WAIT_TIME_H_int:$WAIT_TIME_M_int:$WAIT_TIME_S";
+		$pfWAIT_TIME_HMS =		sprintf("%8s", $WAIT_TIME_HMS);
+
+		$WRAPUP_TIME_H = ($row[7] / 3600);
+		$WRAPUP_TIME_H = round($WRAPUP_TIME_H, 2);
+		$WRAPUP_TIME_H_int = intval("$WRAPUP_TIME_H");
+		$WRAPUP_TIME_M = ($WRAPUP_TIME_H - $WRAPUP_TIME_H_int);
+		$WRAPUP_TIME_M = ($WRAPUP_TIME_M * 60);
+		$WRAPUP_TIME_M = round($WRAPUP_TIME_M, 2);
+		$WRAPUP_TIME_M_int = intval("$WRAPUP_TIME_M");
+		$WRAPUP_TIME_S = ($WRAPUP_TIME_M - $WRAPUP_TIME_M_int);
+		$WRAPUP_TIME_S = ($WRAPUP_TIME_S * 60);
+		$WRAPUP_TIME_S = round($WRAPUP_TIME_S, 0);
+		if ($WRAPUP_TIME_S < 10) {$WRAPUP_TIME_S = "0$WRAPUP_TIME_S";}
+		if ($WRAPUP_TIME_M_int < 10) {$WRAPUP_TIME_M_int = "0$WRAPUP_TIME_M_int";}
+		$WRAPUP_TIME_HMS = "$WRAPUP_TIME_H_int:$WRAPUP_TIME_M_int:$WRAPUP_TIME_S";
+		$pfWRAPUP_TIME_HMS =		sprintf("%8s", $WRAPUP_TIME_HMS);
+
+		$TALK_AVG_M = ($row[2] / 60);
+		$TALK_AVG_M = round($TALK_AVG_M, 2);
+		$TALK_AVG_M_int = intval("$TALK_AVG_M");
+		$TALK_AVG_S = ($TALK_AVG_M - $TALK_AVG_M_int);
+		$TALK_AVG_S = ($TALK_AVG_S * 60);
+		$TALK_AVG_S = round($TALK_AVG_S, 0);
+		if ($TALK_AVG_S < 10) {$TALK_AVG_S = "0$TALK_AVG_S";}
+		$TALK_AVG_MS = "$TALK_AVG_M_int:$TALK_AVG_S";
+		$pfTALK_AVG_MS =		sprintf("%6s", $TALK_AVG_MS);
+
+		$PAUSE_AVG_M = ($row[4] / 60);
+		$PAUSE_AVG_M = round($PAUSE_AVG_M, 2);
+		$PAUSE_AVG_M_int = intval("$PAUSE_AVG_M");
+		$PAUSE_AVG_S = ($PAUSE_AVG_M - $PAUSE_AVG_M_int);
+		$PAUSE_AVG_S = ($PAUSE_AVG_S * 60);
+		$PAUSE_AVG_S = round($PAUSE_AVG_S, 0);
+		if ($PAUSE_AVG_S < 10) {$PAUSE_AVG_S = "0$PAUSE_AVG_S";}
+		$PAUSE_AVG_MS = "$PAUSE_AVG_M_int:$PAUSE_AVG_S";
+		$pfPAUSE_AVG_MS =		sprintf("%6s", $PAUSE_AVG_MS);
+
+		$WAIT_AVG_M = ($row[6] / 60);
+		$WAIT_AVG_M = round($WAIT_AVG_M, 2);
+		$WAIT_AVG_M_int = intval("$WAIT_AVG_M");
+		$WAIT_AVG_S = ($WAIT_AVG_M - $WAIT_AVG_M_int);
+		$WAIT_AVG_S = ($WAIT_AVG_S * 60);
+		$WAIT_AVG_S = round($WAIT_AVG_S, 0);
+		if ($WAIT_AVG_S < 10) {$WAIT_AVG_S = "0$WAIT_AVG_S";}
+		$WAIT_AVG_MS = "$WAIT_AVG_M_int:$WAIT_AVG_S";
+		$pfWAIT_AVG_MS =		sprintf("%6s", $WAIT_AVG_MS);
+
+		$WRAPUP_AVG_M = ($row[8] / 60);
+		$WRAPUP_AVG_M = round($WRAPUP_AVG_M, 2);
+		$WRAPUP_AVG_M_int = intval("$WRAPUP_AVG_M");
+		$WRAPUP_AVG_S = ($WRAPUP_AVG_M - $WRAPUP_AVG_M_int);
+		$WRAPUP_AVG_S = ($WRAPUP_AVG_S * 60);
+		$WRAPUP_AVG_S = round($WRAPUP_AVG_S, 0);
+		if ($WRAPUP_AVG_S < 10) {$WRAPUP_AVG_S = "0$WRAPUP_AVG_S";}
+		$WRAPUP_AVG_MS = "$WRAPUP_AVG_M_int:$WRAPUP_AVG_S";
+		$pfWRAPUP_AVG_MS =		sprintf("%6s", $WRAPUP_AVG_MS);
+
+	echo "TOTAL CALLS TAKEN: $row[0]\n";
+	echo "TALK TIME:               $pfTALK_TIME_HMS     AVERAGE: $pfTALK_AVG_MS\n";
+	echo "PAUSE TIME:              $pfPAUSE_TIME_HMS     AVERAGE: $pfPAUSE_AVG_MS\n";
+	echo "WAIT TIME:               $pfWAIT_TIME_HMS     AVERAGE: $pfWAIT_AVG_MS\n";
+	echo "WRAPUP TIME:             $pfWRAPUP_TIME_HMS     AVERAGE: $pfWRAPUP_AVG_MS\n";
+	echo "----------------------------------------------------------------\n";
+	echo "TOTAL ACTIVE AGENT TIME: $pfTOTAL_TIME_HMS\n";
+
+	echo "\n";
+	}
+else
+	{
+	echo "Call Activity Summary\n\n";
+
+	}
+
+$stmt="select event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' order by event_time limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+echo "FIRST LOGIN:          $row[0]\n";
+$start = $row[1];
+
+$stmt="select event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' order by event_time desc limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+echo "LAST LOG ACTIVITY:    $row[0]\n";
+$end = $row[1];
+
+$login_time = ($end - $start);
+	$LOGIN_TIME_H = ($login_time / 3600);
+	$LOGIN_TIME_H = round($LOGIN_TIME_H, 2);
+	$LOGIN_TIME_H_int = intval("$LOGIN_TIME_H");
+	$LOGIN_TIME_M = ($LOGIN_TIME_H - $LOGIN_TIME_H_int);
+	$LOGIN_TIME_M = ($LOGIN_TIME_M * 60);
+	$LOGIN_TIME_M = round($LOGIN_TIME_M, 2);
+	$LOGIN_TIME_M_int = intval("$LOGIN_TIME_M");
+	$LOGIN_TIME_S = ($LOGIN_TIME_M - $LOGIN_TIME_M_int);
+	$LOGIN_TIME_S = ($LOGIN_TIME_S * 60);
+	$LOGIN_TIME_S = round($LOGIN_TIME_S, 0);
+	if ($LOGIN_TIME_S < 10) {$LOGIN_TIME_S = "0$LOGIN_TIME_S";}
+	if ($LOGIN_TIME_M_int < 10) {$LOGIN_TIME_M_int = "0$LOGIN_TIME_M_int";}
+	$LOGIN_TIME_HMS = "$LOGIN_TIME_H_int:$LOGIN_TIME_M_int:$LOGIN_TIME_S";
+	$pfLOGIN_TIME_HMS =		sprintf("%8s", $LOGIN_TIME_HMS);
+
+echo "-----------------------------------------\n";
+echo "TOTAL LOGGED-IN TIME:    $pfLOGIN_TIME_HMS\n";
+
+}
+
+
+
+?>
+
+
\ No newline at end of file
diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_agent_time_sheet_archive.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_agent_time_sheet_archive.php
new file mode 100644
index 00000000..fb71d1d6
--- /dev/null
+++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_agent_time_sheet_archive.php
@@ -0,0 +1,286 @@
+    LICENSE: GPLv2
+###
+# CHANGES
+#
+# 60619-1721 - Added variable filtering to eliminate SQL injection attack threat
+#            - Added required user/pass to gain access to this page
+#
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+if (isset($_GET["agent"]))				{$agent=$_GET["agent"];}
+	elseif (isset($_POST["agent"]))		{$agent=$_POST["agent"];}
+if (isset($_GET["query_date"]))				{$query_date=$_GET["query_date"];}
+	elseif (isset($_POST["query_date"]))		{$query_date=$_POST["query_date"];}
+if (isset($_GET["calls_summary"]))				{$calls_summary=$_GET["calls_summary"];}
+	elseif (isset($_POST["calls_summary"]))		{$calls_summary=$_POST["calls_summary"];}
+if (isset($_GET["submit"]))				{$submit=$_GET["submit"];}
+	elseif (isset($_POST["submit"]))		{$submit=$_POST["submit"];}
+if (isset($_GET["SUBMIT"]))				{$SUBMIT=$_GET["SUBMIT"];}
+	elseif (isset($_POST["SUBMIT"]))		{$SUBMIT=$_POST["SUBMIT"];}
+
+$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
+$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
+
+	$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
+	if ($DB) {echo "|$stmt|\n";}
+	$rslt=mysql_query($stmt, $link);
+	$row=mysql_fetch_row($rslt);
+	$auth=$row[0];
+
+  if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
+	{
+    Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
+    Header("HTTP/1.0 401 Unauthorized");
+    echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
+    exit;
+	}
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!isset($query_date)) {$query_date = $NOW_DATE;}
+
+?>
+
+
+
+
+
+\n";
+echo "VICIDIAL: Agent Time Sheet\n";
+echo "VICIDIAL ADMIN: Agent Time Sheet\n";
+echo " - User Stats\n";
+echo " - User Status\n";
+echo " - Modify User\n";
+echo "
\n"; +echo "
  \n"; +echo "Date: \n"; +echo "User ID: \n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n";
+
+
+if (!$agent)
+{
+echo "\n";
+echo "PLEASE SELECT AN AGENT ID AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
+echo " NOTE: stats taken from available agent log data\n";
+}
+
+else
+{
+$query_date_BEGIN = "$query_date 00:00:00";   
+$query_date_END = "$query_date 23:59:59";
+$time_BEGIN = "00:00:00";   
+$time_END = "23:59:59";
+
+$stmt="select full_name from vicidial_users where user='$agent';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$full_name = $row[0];
+
+echo "VICIDIAL: Agent Time Sheet                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENT TIME SHEET: $agent - $full_name -------------\n\n";
+
+if ($calls_summary)
+	{
+	$stmt="select count(*) as calls,sum(talk_sec) as talk,avg(talk_sec),sum(pause_sec),avg(pause_sec),sum(wait_sec),avg(wait_sec),sum(dispo_sec),avg(dispo_sec) from vicidial_agent_log_archive where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' and pause_sec<48800 and wait_sec<48800 and talk_sec<48800 and dispo_sec<48800 limit 1;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+
+	$TOTAL_TIME = ($row[1] + $row[3] + $row[5] + $row[7]);
+
+		$TOTAL_TIME_H = ($TOTAL_TIME / 3600);
+		$TOTAL_TIME_H = round($TOTAL_TIME_H, 2);
+		$TOTAL_TIME_H_int = intval("$TOTAL_TIME_H");
+		$TOTAL_TIME_M = ($TOTAL_TIME_H - $TOTAL_TIME_H_int);
+		$TOTAL_TIME_M = ($TOTAL_TIME_M * 60);
+		$TOTAL_TIME_M = round($TOTAL_TIME_M, 2);
+		$TOTAL_TIME_M_int = intval("$TOTAL_TIME_M");
+		$TOTAL_TIME_S = ($TOTAL_TIME_M - $TOTAL_TIME_M_int);
+		$TOTAL_TIME_S = ($TOTAL_TIME_S * 60);
+		$TOTAL_TIME_S = round($TOTAL_TIME_S, 0);
+		if ($TOTAL_TIME_S < 10) {$TOTAL_TIME_S = "0$TOTAL_TIME_S";}
+		if ($TOTAL_TIME_M_int < 10) {$TOTAL_TIME_M_int = "0$TOTAL_TIME_M_int";}
+		$TOTAL_TIME_HMS = "$TOTAL_TIME_H_int:$TOTAL_TIME_M_int:$TOTAL_TIME_S";
+		$pfTOTAL_TIME_HMS =		sprintf("%8s", $TOTAL_TIME_HMS);
+
+		$TALK_TIME_H = ($row[1] / 3600);
+		$TALK_TIME_H = round($TALK_TIME_H, 2);
+		$TALK_TIME_H_int = intval("$TALK_TIME_H");
+		$TALK_TIME_M = ($TALK_TIME_H - $TALK_TIME_H_int);
+		$TALK_TIME_M = ($TALK_TIME_M * 60);
+		$TALK_TIME_M = round($TALK_TIME_M, 2);
+		$TALK_TIME_M_int = intval("$TALK_TIME_M");
+		$TALK_TIME_S = ($TALK_TIME_M - $TALK_TIME_M_int);
+		$TALK_TIME_S = ($TALK_TIME_S * 60);
+		$TALK_TIME_S = round($TALK_TIME_S, 0);
+		if ($TALK_TIME_S < 10) {$TALK_TIME_S = "0$TALK_TIME_S";}
+		if ($TALK_TIME_M_int < 10) {$TALK_TIME_M_int = "0$TALK_TIME_M_int";}
+		$TALK_TIME_HMS = "$TALK_TIME_H_int:$TALK_TIME_M_int:$TALK_TIME_S";
+		$pfTALK_TIME_HMS =		sprintf("%8s", $TALK_TIME_HMS);
+
+		$PAUSE_TIME_H = ($row[3] / 3600);
+		$PAUSE_TIME_H = round($PAUSE_TIME_H, 2);
+		$PAUSE_TIME_H_int = intval("$PAUSE_TIME_H");
+		$PAUSE_TIME_M = ($PAUSE_TIME_H - $PAUSE_TIME_H_int);
+		$PAUSE_TIME_M = ($PAUSE_TIME_M * 60);
+		$PAUSE_TIME_M = round($PAUSE_TIME_M, 2);
+		$PAUSE_TIME_M_int = intval("$PAUSE_TIME_M");
+		$PAUSE_TIME_S = ($PAUSE_TIME_M - $PAUSE_TIME_M_int);
+		$PAUSE_TIME_S = ($PAUSE_TIME_S * 60);
+		$PAUSE_TIME_S = round($PAUSE_TIME_S, 0);
+		if ($PAUSE_TIME_S < 10) {$PAUSE_TIME_S = "0$PAUSE_TIME_S";}
+		if ($PAUSE_TIME_M_int < 10) {$PAUSE_TIME_M_int = "0$PAUSE_TIME_M_int";}
+		$PAUSE_TIME_HMS = "$PAUSE_TIME_H_int:$PAUSE_TIME_M_int:$PAUSE_TIME_S";
+		$pfPAUSE_TIME_HMS =		sprintf("%8s", $PAUSE_TIME_HMS);
+
+		$WAIT_TIME_H = ($row[5] / 3600);
+		$WAIT_TIME_H = round($WAIT_TIME_H, 2);
+		$WAIT_TIME_H_int = intval("$WAIT_TIME_H");
+		$WAIT_TIME_M = ($WAIT_TIME_H - $WAIT_TIME_H_int);
+		$WAIT_TIME_M = ($WAIT_TIME_M * 60);
+		$WAIT_TIME_M = round($WAIT_TIME_M, 2);
+		$WAIT_TIME_M_int = intval("$WAIT_TIME_M");
+		$WAIT_TIME_S = ($WAIT_TIME_M - $WAIT_TIME_M_int);
+		$WAIT_TIME_S = ($WAIT_TIME_S * 60);
+		$WAIT_TIME_S = round($WAIT_TIME_S, 0);
+		if ($WAIT_TIME_S < 10) {$WAIT_TIME_S = "0$WAIT_TIME_S";}
+		if ($WAIT_TIME_M_int < 10) {$WAIT_TIME_M_int = "0$WAIT_TIME_M_int";}
+		$WAIT_TIME_HMS = "$WAIT_TIME_H_int:$WAIT_TIME_M_int:$WAIT_TIME_S";
+		$pfWAIT_TIME_HMS =		sprintf("%8s", $WAIT_TIME_HMS);
+
+		$WRAPUP_TIME_H = ($row[7] / 3600);
+		$WRAPUP_TIME_H = round($WRAPUP_TIME_H, 2);
+		$WRAPUP_TIME_H_int = intval("$WRAPUP_TIME_H");
+		$WRAPUP_TIME_M = ($WRAPUP_TIME_H - $WRAPUP_TIME_H_int);
+		$WRAPUP_TIME_M = ($WRAPUP_TIME_M * 60);
+		$WRAPUP_TIME_M = round($WRAPUP_TIME_M, 2);
+		$WRAPUP_TIME_M_int = intval("$WRAPUP_TIME_M");
+		$WRAPUP_TIME_S = ($WRAPUP_TIME_M - $WRAPUP_TIME_M_int);
+		$WRAPUP_TIME_S = ($WRAPUP_TIME_S * 60);
+		$WRAPUP_TIME_S = round($WRAPUP_TIME_S, 0);
+		if ($WRAPUP_TIME_S < 10) {$WRAPUP_TIME_S = "0$WRAPUP_TIME_S";}
+		if ($WRAPUP_TIME_M_int < 10) {$WRAPUP_TIME_M_int = "0$WRAPUP_TIME_M_int";}
+		$WRAPUP_TIME_HMS = "$WRAPUP_TIME_H_int:$WRAPUP_TIME_M_int:$WRAPUP_TIME_S";
+		$pfWRAPUP_TIME_HMS =		sprintf("%8s", $WRAPUP_TIME_HMS);
+
+		$TALK_AVG_M = ($row[2] / 60);
+		$TALK_AVG_M = round($TALK_AVG_M, 2);
+		$TALK_AVG_M_int = intval("$TALK_AVG_M");
+		$TALK_AVG_S = ($TALK_AVG_M - $TALK_AVG_M_int);
+		$TALK_AVG_S = ($TALK_AVG_S * 60);
+		$TALK_AVG_S = round($TALK_AVG_S, 0);
+		if ($TALK_AVG_S < 10) {$TALK_AVG_S = "0$TALK_AVG_S";}
+		$TALK_AVG_MS = "$TALK_AVG_M_int:$TALK_AVG_S";
+		$pfTALK_AVG_MS =		sprintf("%6s", $TALK_AVG_MS);
+
+		$PAUSE_AVG_M = ($row[4] / 60);
+		$PAUSE_AVG_M = round($PAUSE_AVG_M, 2);
+		$PAUSE_AVG_M_int = intval("$PAUSE_AVG_M");
+		$PAUSE_AVG_S = ($PAUSE_AVG_M - $PAUSE_AVG_M_int);
+		$PAUSE_AVG_S = ($PAUSE_AVG_S * 60);
+		$PAUSE_AVG_S = round($PAUSE_AVG_S, 0);
+		if ($PAUSE_AVG_S < 10) {$PAUSE_AVG_S = "0$PAUSE_AVG_S";}
+		$PAUSE_AVG_MS = "$PAUSE_AVG_M_int:$PAUSE_AVG_S";
+		$pfPAUSE_AVG_MS =		sprintf("%6s", $PAUSE_AVG_MS);
+
+		$WAIT_AVG_M = ($row[6] / 60);
+		$WAIT_AVG_M = round($WAIT_AVG_M, 2);
+		$WAIT_AVG_M_int = intval("$WAIT_AVG_M");
+		$WAIT_AVG_S = ($WAIT_AVG_M - $WAIT_AVG_M_int);
+		$WAIT_AVG_S = ($WAIT_AVG_S * 60);
+		$WAIT_AVG_S = round($WAIT_AVG_S, 0);
+		if ($WAIT_AVG_S < 10) {$WAIT_AVG_S = "0$WAIT_AVG_S";}
+		$WAIT_AVG_MS = "$WAIT_AVG_M_int:$WAIT_AVG_S";
+		$pfWAIT_AVG_MS =		sprintf("%6s", $WAIT_AVG_MS);
+
+		$WRAPUP_AVG_M = ($row[8] / 60);
+		$WRAPUP_AVG_M = round($WRAPUP_AVG_M, 2);
+		$WRAPUP_AVG_M_int = intval("$WRAPUP_AVG_M");
+		$WRAPUP_AVG_S = ($WRAPUP_AVG_M - $WRAPUP_AVG_M_int);
+		$WRAPUP_AVG_S = ($WRAPUP_AVG_S * 60);
+		$WRAPUP_AVG_S = round($WRAPUP_AVG_S, 0);
+		if ($WRAPUP_AVG_S < 10) {$WRAPUP_AVG_S = "0$WRAPUP_AVG_S";}
+		$WRAPUP_AVG_MS = "$WRAPUP_AVG_M_int:$WRAPUP_AVG_S";
+		$pfWRAPUP_AVG_MS =		sprintf("%6s", $WRAPUP_AVG_MS);
+
+	echo "TOTAL CALLS TAKEN: $row[0]\n";
+	echo "TALK TIME:               $pfTALK_TIME_HMS     AVERAGE: $pfTALK_AVG_MS\n";
+	echo "PAUSE TIME:              $pfPAUSE_TIME_HMS     AVERAGE: $pfPAUSE_AVG_MS\n";
+	echo "WAIT TIME:               $pfWAIT_TIME_HMS     AVERAGE: $pfWAIT_AVG_MS\n";
+	echo "WRAPUP TIME:             $pfWRAPUP_TIME_HMS     AVERAGE: $pfWRAPUP_AVG_MS\n";
+	echo "----------------------------------------------------------------\n";
+	echo "TOTAL ACTIVE AGENT TIME: $pfTOTAL_TIME_HMS\n";
+
+	echo "\n";
+	}
+else
+	{
+	echo "Call Activity Summary\n\n";
+
+	}
+
+$stmt="select event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log_archive where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' order by event_time limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+echo "FIRST LOGIN:          $row[0]\n";
+$start = $row[1];
+
+$stmt="select event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log_archive where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' order by event_time desc limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+echo "LAST LOG ACTIVITY:    $row[0]\n";
+$end = $row[1];
+
+$login_time = ($end - $start);
+	$LOGIN_TIME_H = ($login_time / 3600);
+	$LOGIN_TIME_H = round($LOGIN_TIME_H, 2);
+	$LOGIN_TIME_H_int = intval("$LOGIN_TIME_H");
+	$LOGIN_TIME_M = ($LOGIN_TIME_H - $LOGIN_TIME_H_int);
+	$LOGIN_TIME_M = ($LOGIN_TIME_M * 60);
+	$LOGIN_TIME_M = round($LOGIN_TIME_M, 2);
+	$LOGIN_TIME_M_int = intval("$LOGIN_TIME_M");
+	$LOGIN_TIME_S = ($LOGIN_TIME_M - $LOGIN_TIME_M_int);
+	$LOGIN_TIME_S = ($LOGIN_TIME_S * 60);
+	$LOGIN_TIME_S = round($LOGIN_TIME_S, 0);
+	if ($LOGIN_TIME_S < 10) {$LOGIN_TIME_S = "0$LOGIN_TIME_S";}
+	if ($LOGIN_TIME_M_int < 10) {$LOGIN_TIME_M_int = "0$LOGIN_TIME_M_int";}
+	$LOGIN_TIME_HMS = "$LOGIN_TIME_H_int:$LOGIN_TIME_M_int:$LOGIN_TIME_S";
+	$pfLOGIN_TIME_HMS =		sprintf("%8s", $LOGIN_TIME_HMS);
+
+echo "-----------------------------------------\n";
+echo "TOTAL LOGGED-IN TIME:    $pfLOGIN_TIME_HMS\n";
+
+}
+
+
+
+?>
+
+
\ No newline at end of file
diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_inboundEXTstats.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_inboundEXTstats.php
new file mode 100644
index 00000000..5bc24935
--- /dev/null
+++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_inboundEXTstats.php
@@ -0,0 +1,400 @@
+    LICENSE: GPLv2
+#
+# CHANGES
+# 60421-1450 - check GET/POST vars lines with isset to not trigger PHP NOTICES
+# 60620-1322 - Added variable filtering to eliminate SQL injection attack threat
+#            - Added required user/pass to gain access to this page
+#
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+if (isset($_GET["group"]))					{$group=$_GET["group"];}
+	elseif (isset($_POST["group"]))			{$group=$_POST["group"];}
+if (isset($_GET["query_date"]))				{$query_date=$_GET["query_date"];}
+	elseif (isset($_POST["query_date"]))	{$query_date=$_POST["query_date"];}
+if (isset($_GET["server_ip"]))				{$server_ip=$_GET["server_ip"];}
+	elseif (isset($_POST["server_ip"]))		{$server_ip=$_POST["server_ip"];}
+if (isset($_GET["submit"]))					{$submit=$_GET["submit"];}
+	elseif (isset($_POST["submit"]))		{$submit=$_POST["submit"];}
+if (isset($_GET["SUBMIT"]))					{$SUBMIT=$_GET["SUBMIT"];}
+	elseif (isset($_POST["SUBMIT"]))		{$SUBMIT=$_POST["SUBMIT"];}
+
+$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
+$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
+
+	$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
+	if ($DB) {echo "|$stmt|\n";}
+	$rslt=mysql_query($stmt, $link);
+	$row=mysql_fetch_row($rslt);
+	$auth=$row[0];
+
+  if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
+	{
+    Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
+    Header("HTTP/1.0 401 Unauthorized");
+    echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
+    exit;
+	}
+
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!isset($query_date)) {$query_date = $NOW_DATE;}
+if (!isset($server_ip)) {$server_ip = '10.10.11.20';}
+
+$stmt="select extension,full_number,inbound_name from inbound_numbers where server_ip='" . mysql_real_escape_string($server_ip) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$inbound_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $inbound_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$inbound[$i] =$row[0];
+	$fullnum[$i] =$row[1];
+	$inbname[$i] =$row[2];
+	$i++;
+	}
+?>
+
+
+
+
+
+\n";
+#echo"\n";
+echo "ASTERISK: Inbound Calls Stats\n";
+echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "PLEASE SELECT A NUMBER AND DATE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+
+
+echo "ASTERISK: Inbound Calls Stats                      $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$extenSQL = "and extension='" . mysql_real_escape_string($group) . "'";
+if (eregi("\*",$group))
+	{$extenSQL = "and extension LIKE \"%$group\"";}
+$stmt="select count(*),sum(length_in_sec) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " 00:00:01' and start_time <= '" . mysql_real_escape_string($query_date) . " 23:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Total Calls That came into this number:       $TOTALcalls\n";
+echo "Average Call Length(seconds) for all Calls:   $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(length_in_sec) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " 00:00:01' and start_time <= '" . mysql_real_escape_string($query_date) . " 23:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$DROPcalls =	sprintf("%10s", $row[0]);
+$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
+$DROPpercent = round($DROPpercent, 0);
+
+if ($row[0])
+	{
+	$average_hold_seconds = ($row[1] / $row[0]);
+	$average_hold_seconds = round($average_hold_seconds, 0);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+else {$DROPpercent=0;   $average_hold_seconds=0;}
+echo "Total DROP Calls:   (less than 10 seconds)    $DROPcalls  $DROPpercent%\n";
+echo "Average Call Length(seconds) for DROP Calls:  $average_hold_seconds\n";
+
+
+##############################
+#########  CALLS STATS
+
+echo "\n";
+echo "---------- CALL LISTINGS\n";
+echo "+----------------------+----------------------+--------+---------------------+\n";
+echo "| CALLERID             | CALLERIDNAME         | LENGTH | DATE TIME           |\n";
+echo "+----------------------+----------------------+--------+---------------------+\n";
+
+$stmt="select number_dialed,caller_code,length_in_sec,start_time from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " 00:00:01' and start_time <= '" . mysql_real_escape_string($query_date) . " 23:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$CID =			sprintf("%-20s", $row[0]);
+	$CIDname =		sprintf("%-20s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
+	$datetime =		sprintf("%-19s", $row[3]);
+	$USERavgTALK =	$row[2];
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $CID | $CIDname | $USERavgTALK_MS | $datetime |\n";
+
+	$i++;
+	}
+
+echo "+----------------------+----------------------+--------+---------------------+\n";
+
+##############################
+#########  TIME STATS
+
+if ($output == 'FULL')
+	{
+
+	echo "\n";
+	echo "---------- TIME STATS\n";
+
+	echo "\n";
+
+	$hi_hour_count=0;
+	$last_full_record=0;
+	$i=0;
+	$h=0;
+	while ($i <= 96)
+		{
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:00:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:14:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:00:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:14:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:15:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:29:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:15:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:29:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:30:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:44:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:30:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:44:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:45:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:45:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+		$h++;
+		}
+
+	$hour_multiplier = (100 / $hi_hour_count);
+	#$hour_multiplier = round($hour_multiplier, 0);
+
+	echo "\n";
+	echo "GRAPH IN 15 MINUTE INCREMENTS OF TOTAL CALLS\n";
+
+	$k=1;
+	$Mk=0;
+	$call_scale = '0';
+	while ($k <= 102) 
+		{
+		if ($Mk >= 5) 
+			{
+			$Mk=0;
+			$scale_num=($k / $hour_multiplier);
+			$scale_num = round($scale_num, 0);
+			$LENscale_num = (strlen($scale_num));
+			$k = ($k + $LENscale_num);
+			$call_scale .= "$scale_num";
+			}
+		else
+			{
+			$call_scale .= " ";
+			$k++;   $Mk++;
+			}
+		}
+
+
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+	#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+	echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+	$ZZ = '00';
+	$i=0;
+	$h=4;
+	$hour= -1;
+	$no_lines_yet=1;
+
+	while ($i <= 96)
+		{
+		$char_counter=0;
+		$time = '      ';
+		if ($h >= 4) 
+			{
+			$hour++;
+			$h=0;
+			if ($hour < 10) {$hour = "0$hour";}
+			$time = "+$hour$ZZ+";
+			}
+		if ($h == 1) {$time = "   15 ";}
+		if ($h == 2) {$time = "   30 ";}
+		if ($h == 3) {$time = "   45 ";}
+		$Ghour_count = $hour_count[$i];
+		if ($Ghour_count < 1) 
+			{
+			if ( ($no_lines_yet) or ($i > $last_full_record) )
+				{
+				$do_nothing=1;
+				}
+			else
+				{
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+				echo "|$time|";
+				$k=0;   while ($k <= 102) {echo " ";   $k++;}
+				echo "| $hour_count[$i] |\n";
+				}
+			}
+		else
+			{
+			$no_lines_yet=0;
+			$Xhour_count = ($Ghour_count * $hour_multiplier);
+			$Yhour_count = (99 - $Xhour_count);
+
+			$Gdrop_count = $drop_count[$i];
+			if ($Gdrop_count < 1) 
+				{
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+				echo "|$time|";
+				$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+				echo "*X";   $char_counter++;
+				$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+					while ($char_counter <= 101) {echo " ";   $char_counter++;}
+				echo "| 0     | $hour_count[$i] |\n";
+
+				}
+			else
+				{
+				$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+			#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+				$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+				$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+				echo "|$time|";
+				$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+				echo "D";   $char_counter++;
+				$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+				echo "X";   $char_counter++;
+				$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+					while ($char_counter <= 102) {echo " ";   $char_counter++;}
+				echo "| $drop_count[$i] | $hour_count[$i] |\n";
+				}
+			}
+		
+		
+		$i++;
+		$h++;
+		}
+
+
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+
+	}
+
+
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_inboundEXTstats_department.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_inboundEXTstats_department.php new file mode 100644 index 00000000..015f6820 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_inboundEXTstats_department.php @@ -0,0 +1,178 @@ + LICENSE: GPLv2 +# +# CHANGES +# 70201-1710 - First Build +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["end_query_date"])) {$end_query_date=$_GET["end_query_date"];} + elseif (isset($_POST["end_query_date"])) {$end_query_date=$_POST["end_query_date"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($query_date)) {$query_date = $NOW_DATE;} +if (!isset($end_query_date)) {$end_query_date = $NOW_DATE;} +if (!isset($server_ip)) {$server_ip = '10.10.11.20';} + +$stmt="select distinct department from inbound_numbers;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$dept_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $dept_to_print) + { + $row=mysql_fetch_row($rslt); + $dept[$i] =$row[0]; + $i++; + } + +?> + + + + + +\n"; +#echo"\n"; +echo "ASTERISK: Inbound Calls Stats - By Department\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "PLEASE SELECT A DEPARTMENT AND DATE RANGE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+$extSQL='';
+$stmt="select extension from inbound_numbers where department='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$inbound_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $inbound_to_print)
+	{
+	if (strlen($extSQL)> 1) {$extSQL .= ",";}
+	$row=mysql_fetch_row($rslt);
+	$extensions[$i] =$row[0];
+	$extSQL .= "'$extensions[$i]'";
+	$i++;
+	}
+
+echo "ASTERISK: Inbound Calls Stats For $group   from $query_date to $end_query_date\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+echo "\n";
+
+echo "+----------------------+------------+------------+\n";
+echo "| NUMBER               | CALLS      | AVG TIME   |\n";
+echo "+----------------------+------------+------------+\n";
+
+$k=0;
+while ($k < $inbound_to_print)
+	{
+	$stmt="select count(*),sum(length_in_sec) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " 00:00:01' and start_time <= '" . mysql_real_escape_string($end_query_date) . " 23:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' and extension='$extensions[$k]' ;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+
+	$extensions[$k] = sprintf("%20s", $extensions[$k]);
+	$TOTALcalls =	sprintf("%10s", $row[0]);
+	if ( ($row[0]<1) or ($row[1]<1) )
+		{
+		$average_hold_seconds = "         0";
+		}
+	else
+		{
+		$average_hold_seconds = ($row[1] / $row[0]);
+		$average_hold_seconds = round($average_hold_seconds, 0);
+		$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+		}
+
+	$calls = ($TOTALcalls + $calls);
+	$seconds = ($row[1] + $seconds);
+
+	echo "| $extensions[$k] | $TOTALcalls | $average_hold_seconds |\n";
+	$k++;
+	}
+
+$calls =	sprintf("%10s", $calls);
+$seconds = ($seconds / $calls);
+$seconds = round($seconds, 0);
+$seconds =	sprintf("%5s", $seconds);
+echo "+----------------------+------------+------------+\n";
+echo "| TOTALS               | $calls | AVG: $seconds |\n";
+echo "+----------------------+------------+------------+\n";
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_server_performance.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_server_performance.php new file mode 100644 index 00000000..afa75bd3 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_server_performance.php @@ -0,0 +1,306 @@ + LICENSE: GPLv2 +# +# CHANGES +# +# 60619-1732 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 70417-1106 - Changed time frame to be definable per time range on a single day +# - Fixed vertical scaling issues +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["begin_query_time"])) {$begin_query_time=$_GET["begin_query_time"];} + elseif (isset($_POST["begin_query_time"])) {$begin_query_time=$_POST["begin_query_time"];} +if (isset($_GET["end_query_time"])) {$end_query_time=$_GET["end_query_time"];} + elseif (isset($_POST["end_query_time"])) {$end_query_time=$_POST["end_query_time"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and modify_servers='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +# path from root to where ploticus files will be stored +$PLOTroot = "vicidial/ploticus"; +$DOCroot = "$WeBServeRRooT/$PLOTroot/"; + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); + +if (!isset($query_date)) {$query_date = $NOW_DATE;} +if (!isset($begin_query_time)) {$begin_query_time = '09:00:00';} +if (!isset($end_query_time)) {$end_query_time = '15:30:00';} +if (!isset($group)) {$group = '';} + +$stmt="select server_ip from servers;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$servers_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $servers_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: Server Performance\n"; +echo "
\n"; +echo "Date:   \n"; +echo "Time: \n"; +echo "to \n"; +echo "Server: \n"; +echo "\n"; +echo "             REPORTS \n"; +echo "
\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A SERVER, DATE AND TIME RANGE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+
+$query_date_BEGIN = "$query_date $begin_query_time";   
+$query_date_END = "$query_date $end_query_time";
+$time_BEGIN = "$begin_query_time";   
+$time_END = "$end_query_time";
+
+echo "VICIDIAL: Server Performance                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- TOTALS, PEAKS and AVERAGES\n";
+
+$stmt="select AVG(sysload),AVG(channels_total),MAX(sysload),MAX(channels_total),MAX(processes) from server_performance where start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and server_ip='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$AVGload =	sprintf("%10s", $row[0]);
+$AVGchannels =	sprintf("%10s", $row[1]);
+$HIGHload =	$row[2];
+	$HIGHmulti = intval($HIGHload / 100);
+$HIGHchannels =	$row[3];
+$HIGHprocesses =$row[4];
+if ($row[2] > $row[3]) {$HIGHlimit = $row[2];}
+else {$HIGHlimit = $row[3];}
+if ($HIGHlimit < $row[4]) {$HIGHlimit = $row[4];}
+
+$stmt="select AVG(cpu_user_percent),AVG(cpu_system_percent),AVG(cpu_idle_percent) from server_performance where start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and server_ip='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$AVGcpuUSER =	sprintf("%10s", $row[0]);
+$AVGcpuSYSTEM =	sprintf("%10s", $row[1]);
+$AVGcpuIDLE =	sprintf("%10s", $row[2]);
+
+$stmt="select count(*),SUM(length_in_min) from call_log where extension NOT IN('8365','8366','8367') and  start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and server_ip='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$OFFHOOKtime =	sprintf("%10s", $row[1]);
+
+
+echo "Total Calls in/out on this server:        $TOTALcalls\n";
+echo "Total Off-Hook time on this server (min): $OFFHOOKtime\n";
+echo "Average/Peak channels in use for server:  $AVGchannels / $HIGHchannels\n";
+echo "Average/Peak load for server:             $AVGload / $HIGHload\n";
+echo "Average USER process cpu percentage:      $AVGcpuUSER %\n";
+echo "Average SYSTEM process cpu percentage:    $AVGcpuSYSTEM %\n";
+echo "Average IDLE process cpu percentage:      $AVGcpuIDLE %\n";
+
+echo "\n";
+echo "---------- LINE GRAPH:\n";
+
+
+
+##############################
+#########  Graph stats
+
+$DAT = '.dat';
+$HTM = '.htm';
+$PNG = '.png';
+$filedate = date("Y-m-d_His");
+$DATfile = "$group$query_date$shift$filedate$DAT";
+$HTMfile = "$group$query_date$shift$filedate$HTM";
+$PNGfile = "$group$query_date$shift$filedate$PNG";
+
+$HTMfp = fopen ("$DOCroot/$HTMfile", "a");
+$DATfp = fopen ("$DOCroot/$DATfile", "a");
+
+$stmt="select DATE_FORMAT(start_time,'%H:%i:%s') as timex,sysload,processes,channels_total,live_recordings,cpu_user_percent,cpu_system_percent from server_performance where server_ip='" . mysql_real_escape_string($group) . "' and start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' order by timex;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$row[5] = intval(($row[5] + $row[6]) * $HIGHmulti);
+	$row[6] = intval($row[6] * $HIGHmulti);
+	fwrite ($DATfp, "$row[5]\t$row[6]\t$row[0]\t$row[1]\t$row[2]\t$row[3]\n");
+	$i++;
+	}
+fclose($DATfp);
+
+$rows_to_max = ($rows_to_print + 100);
+
+#print "rows: $i\n";
+
+$time_scale_abb = '5 minutes';
+$time_scale_tick = '1 minute';
+if ($i > 1000) {$time_scale_abb = '10 minutes';   $time_scale_tick = '2 minutes';}
+if ($i > 2000) {$time_scale_abb = '20 minutes';   $time_scale_tick = '4 minutes';}
+if ($i > 3000) {$time_scale_abb = '30 minutes';   $time_scale_tick = '5 minutes';}
+if ($i > 4000) {$time_scale_abb = '40 minutes';   $time_scale_tick = '10 minutes';}
+if ($i > 5000) {$time_scale_abb = '60 minutes';   $time_scale_tick = '15 minutes';}
+if ($i > 6000) {$time_scale_abb = '90 minutes';   $time_scale_tick = '15 minutes';}
+if ($i > 7000) {$time_scale_abb = '120 minutes';   $time_scale_tick = '30 minutes';}
+
+$HTMcontent  = '';
+$HTMcontent .= "#proc page\n";
+$HTMcontent .= "#if @DEVICE in png,gif\n";
+$HTMcontent .= "   scale: 0.6\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#endif\n";
+$HTMcontent .= "#proc getdata\n";
+$HTMcontent .= "file: $DOCroot/$DATfile\n";
+$HTMcontent .= "fieldnames: userproc sysproc time load processes channels\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc areadef\n";
+$HTMcontent .= "title: Server $group   $query_date_BEGIN to $query_date_END\n";
+$HTMcontent .= "titledetails: size=14  align=C\n";
+$HTMcontent .= "rectangle: 1 1 14 7\n";
+$HTMcontent .= "xscaletype: time hh:mm:ss\n";
+$HTMcontent .= "xrange: $time_BEGIN $time_END\n";
+$HTMcontent .= "yrange: 0 $HIGHlimit\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc xaxis\n";
+$HTMcontent .= "stubs: inc $time_scale_abb\n";
+$HTMcontent .= "minorticinc: $time_scale_tick\n";
+$HTMcontent .= "stubformat: hh:mm:ssa\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc yaxis\n";
+$HTMcontent .= "stubs: inc 50\n";
+$HTMcontent .= "grid: color=yellow\n";
+$HTMcontent .= "gridskip: min\n";
+$HTMcontent .= "ticincrement: 100 1000\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc lineplot\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: userproc\n";
+$HTMcontent .= "linedetails: color=purple width=.5\n";
+$HTMcontent .= "fill: lavender\n";
+$HTMcontent .= "legendlabel: user proc%\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc lineplot\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: sysproc\n";
+$HTMcontent .= "linedetails: color=yelloworange width=.5\n";
+$HTMcontent .= "fill: dullyellow\n";
+$HTMcontent .= "legendlabel: system proc%\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: load\n";
+$HTMcontent .= "linedetails: color=blue width=.5\n";
+$HTMcontent .= "legendlabel: load\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: processes\n";
+$HTMcontent .= "linedetails: color=red width=.5\n";
+$HTMcontent .= "legendlabel: processes\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: channels\n";
+$HTMcontent .= "linedetails: color=green width=.5\n";
+$HTMcontent .= "legendlabel: channels\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc legend\n";
+$HTMcontent .= "location: max-2 max\n";
+$HTMcontent .= "seglen: 0.2\n";
+$HTMcontent .= "\n";
+
+fwrite ($HTMfp, "$HTMcontent");
+fclose($HTMfp);
+
+
+passthru("/usr/local/bin/pl -png $DOCroot/$HTMfile -o $DOCroot/$PNGfile");
+
+sleep(1);
+
+echo "
\n"; +echo "\n"; +echo "\n"; + + +echo ""; + +} + + + +?> + + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_timeonVDAD.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_timeonVDAD.php new file mode 100644 index 00000000..e9c8f52e --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_timeonVDAD.php @@ -0,0 +1,374 @@ + LICENSE: GPLv2 +### +# live real-time stats for the VICIDIAL Auto-Dialer +# +# CHANGES +# +# 60620-1037 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 61114-2004 - Changed to display CLOSER and DEFAULT, added trunk shortage +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["reset_counter"])) {$reset_counter=$_GET["reset_counter"];} + elseif (isset($_POST["reset_counter"])) {$reset_counter=$_POST["reset_counter"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["closer_display"])) {$closer_display=$_GET["closer_display"];} + elseif (isset($_POST["closer_display"])) {$closer_display=$_POST["closer_display"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +$epochSIXhoursAGO = ($STARTtime - 21600); +$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO); + +$reset_counter++; + +if ($reset_counter > 7) + { + $reset_counter=0; + + $stmt="update park_log set status='HUNGUP' where hangup_time is not null;"; +# $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + + if ($DB) + { + $stmt="delete from park_log where grab_time < '$timeSIXhoursAGO' and (hangup_time is null or hangup_time='');"; +# $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + } + } + +?> + + + +\n"; +echo " + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On VDAD\n"; +echo "
";
+
+###################################################################################
+###### SERVER INFORMATION
+###################################################################################
+
+$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where server_ip='" . mysql_real_escape_string($server_ip) . "';";
+$rslt=mysql_query($stmt, $link);
+$row=mysql_fetch_row($rslt);
+$balanceSHORT = $row[0];
+
+echo "SERVER: $server_ip\n";
+
+
+
+###################################################################################
+###### TIME ON SYSTEM
+###################################################################################
+
+if ($closer_display>0) {$closer_display_reverse=0;   $closer_reverse_link='DEFAULT';}
+else {$closer_display_reverse=1;   $closer_reverse_link='CLOSER';}
+
+echo "VICIDIAL: Agents Time On Calls           $NOW_TIME    $closer_reverse_link | REPORTS\n\n";
+
+if ($closer_display>0)
+{
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+echo "| STATION    | USER   | SESSIONID | CHANNEL             | STATUS | CALLTIME | MINUTES | CAMPAIGN     | FRONT  |\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+}
+else
+{
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+\n";
+echo "| STATION    | USER   | SESSIONID | CHANNEL             | STATUS | CALLTIME | MINUTES |\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+\n";
+}
+
+$stmt="select extension,user,conf_exten,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),uniqueid,lead_id from vicidial_live_agents where status NOT IN('PAUSED') and server_ip='" . mysql_real_escape_string($server_ip) . "' order by extension;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$talking_to_print = mysql_num_rows($rslt);
+	if ($talking_to_print > 0)
+	{
+	$i=0;
+	while ($i < $talking_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+			if (eregi("READY|PAUSED|CLOSER",$row[4]))
+			{
+			$row[3]='';
+			$row[5]='- WAIT -';
+			$row[6]=$row[7];
+			}
+		$extension[$i] = eregi_replace('Local/',"",$row[0]);
+		$extension[$i] =		sprintf("%-10s", $extension[$i]);
+			while(strlen($extension[$i])>10) {$extension[$i] = substr("$extension[$i]", 0, -1);}
+		$user[$i] =				sprintf("%-6s", $row[1]);
+		$sessionid[$i] =		sprintf("%-9s", $row[2]);
+		$channel[$i] =			sprintf("%-19s", $row[3]);
+			$cc[$i]=0;
+		while ( (strlen($channel[$i]) > 19) and ($cc[$i] < 100) )
+			{
+			$channel[$i] = eregi_replace(".$","",$channel[$i]);   
+			$cc[$i]++;
+			if (strlen($channel[$i]) <= 19) {$cc[$i]=101;}
+			}
+		$status[$i] =			sprintf("%-6s", $row[4]);
+		$start_time[$i] =		sprintf("%-8s", $row[5]);
+			$cd[$i]=0;
+		while ( (strlen($start_time[$i]) > 8) and ($cd[$i] < 100) )
+			{
+			$start_time[$i] = eregi_replace("^.","",$start_time[$i]);   
+			$cd[$i]++;
+			if (strlen($start_time[$i]) <= 8) {$cd[$i]=101;}
+			}
+		$uniqueid[$i] =			$row[8];
+		$lead_id[$i] =			$row[9];
+		$closer[$i] =			$row[1];
+		$call_time_S[$i] = ($STARTtime - $row[6]);
+
+		$call_time_M[$i] = ($call_time_S[$i] / 60);
+		$call_time_M[$i] = round($call_time_M[$i], 2);
+		$call_time_M_int[$i] = intval("$call_time_M[$i]");
+		$call_time_SEC[$i] = ($call_time_M[$i] - $call_time_M_int[$i]);
+		$call_time_SEC[$i] = ($call_time_SEC[$i] * 60);
+		$call_time_SEC[$i] = round($call_time_SEC[$i], 0);
+		if ($call_time_SEC[$i] < 10) {$call_time_SEC[$i] = "0$call_time_SEC[$i]";}
+		$call_time_MS[$i] = "$call_time_M_int[$i]:$call_time_SEC[$i]";
+		$call_time_MS[$i] =		sprintf("%7s", $call_time_MS[$i]);
+
+		if ($closer_display<1)
+			{
+			$G = '';		$EG = '';
+			if ($call_time_M_int[$i] >= 5) {$G=''; $EG='';}
+			if ($call_time_M_int[$i] >= 10) {$G=''; $EG='';}
+			if (eregi("PAUSED",$row[4])) 
+				{
+				if ($call_time_M_int >= 1) 
+					{$i++; continue;} 
+				else
+					{$G=''; $EG='';}
+				}
+			$agentcount++;
+			echo "| $G$extension[$i]$EG | $G$user[$i]$EG | $G$sessionid[$i]$EG | $G$channel[$i]$EG | $G$status[$i]$EG | $G$start_time[$i]$EG | $G$call_time_MS[$i]$EG |\n";
+			}
+		$i++;
+		}
+
+		if ($closer_display>0)
+		{
+
+			$ext_count = $i;
+			$i=0;
+		while ($i < $ext_count)
+			{
+
+			$stmt="select campaign_id from vicidial_auto_calls where lead_id='$lead_id[$i]' and server_ip='" . mysql_real_escape_string($server_ip) . "';";
+			$rslt=mysql_query($stmt, $link);
+			if ($DB) {echo "$stmt\n";}
+			$camp_to_print = mysql_num_rows($rslt);
+			if ($camp_to_print > 0)
+				{
+				$row=mysql_fetch_row($rslt);
+				$campaign = sprintf("%-12s", $row[0]);
+				$camp_color = $row[0];
+				}
+			else
+				{$campaign = 'DEAD        ';   	$camp_color = 'DEAD';}
+			if (eregi("READY|PAUSED|CLOSER",$status[$i]))
+				{$campaign = '            ';   	$camp_color = '';}
+
+			$stmt="select user from vicidial_xfer_log where lead_id='$lead_id[$i]' and closer='$closer[$i]' order by call_date desc limit 1;";
+			$rslt=mysql_query($stmt, $link);
+			if ($DB) {echo "$stmt\n";}
+			$xfer_to_print = mysql_num_rows($rslt);
+			if ($xfer_to_print > 0)
+				{
+				$row=mysql_fetch_row($rslt);
+				$fronter = sprintf("%-6s", $row[0]);
+				}
+			else
+				{$fronter = '      ';}
+
+			$G = '';		$EG = '';
+			$G=""; $EG='';
+		#	if ($call_time_M_int[$i] >= 5) {$G=''; $EG='';}
+		#	if ($call_time_M_int[$i] >= 10) {$G=''; $EG='';}
+
+			echo "| $G$extension[$i]$EG | $G$user[$i]$EG | $G$sessionid[$i]$EG | $G$channel[$i]$EG | $G$status[$i]$EG | $G$start_time[$i]$EG | $G$call_time_MS[$i]$EG | $G$campaign$EG | $G$fronter$EG |\n";
+
+			$i++;
+			}
+		echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+		echo "  $i agents logged in on server $server_ip\n\n";
+	#	echo "             - 5 minutes or more on call\n";
+	#	echo "             - Over 10 minutes on call\n";
+		}
+	else
+		{
+		echo "+------------|--------+-----------+---------------------+--------+----------+---------+\n";
+		echo "  $agentcount agents logged in on server $server_ip\n\n";
+
+		echo "             - Paused agents\n";
+		echo "             - 5 minutes or more on call\n";
+		echo "             - Over 10 minutes on call\n";
+		}
+
+	}
+	else
+	{
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	echo "********************************* NO AGENTS ON CALLS *********************************\n";
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	}
+
+
+###################################################################################
+###### OUTBOUND CALLS
+###################################################################################
+#echo "\n\n";
+echo "----------------------------------------------------------------------------------------";
+echo "\n\n";
+echo "VICIDIAL: Time On VDAD            TRUNK SHORT: $balanceSHORT              $NOW_TIME\n\n";
+echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+echo "| CHANNEL             | STATUS | CAMPAIGN     | PHONE NUMBER       | CALLTIME | MINUTES |\n";
+echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+
+$stmt="select channel,status,campaign_id,phone_code,phone_number,call_time,UNIX_TIMESTAMP(call_time) from vicidial_auto_calls where status NOT IN('XFER') and server_ip='" . mysql_real_escape_string($server_ip) . "' order by auto_call_id desc;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$parked_to_print = mysql_num_rows($rslt);
+	if ($parked_to_print > 0)
+	{
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$channel =			sprintf("%-19s", $row[0]);
+			$cc=0;
+		while ( (strlen($channel) > 19) and ($cc < 100) )
+			{
+			$channel = eregi_replace(".$","",$channel);   
+			$cc++;
+			if (strlen($channel) <= 19) {$cc=101;}
+			}
+		$start_time =		sprintf("%-8s", $row[5]);
+			$cd=0;
+		while ( (strlen($start_time) > 8) and ($cd < 100) )
+			{
+			$start_time = eregi_replace("^.","",$start_time);   
+			$cd++;
+			if (strlen($start_time) <= 8) {$cd=101;}
+			}
+		$status =			sprintf("%-6s", $row[1]);
+		$campaign =			sprintf("%-12s", $row[2]);
+			$all_phone = "$row[3]$row[4]";
+		$number_dialed =	sprintf("%-18s", $all_phone);
+		$call_time_S = ($STARTtime - $row[6]);
+
+		$call_time_M = ($call_time_S / 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";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if (eregi("LIVE",$status)) {$G=''; $EG='';}
+	#	if ($call_time_M_int >= 6) {$G=''; $EG='';}
+
+		echo "| $G$channel$EG | $G$status$EG | $G$campaign$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+		echo "  $i calls being placed on server $server_ip\n\n";
+
+		echo "             - LIVE CALL WAITING\n";
+	#	echo "             - Over 5 minutes on hold\n";
+
+		}
+	else
+	{
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	echo "******************************* NO LIVE CALLS WAITING *********************************\n";
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	}
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_timeonVDAD_closer.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_timeonVDAD_closer.php new file mode 100644 index 00000000..23eb851e --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_timeonVDAD_closer.php @@ -0,0 +1,318 @@ + LICENSE: GPLv2 +### +# live real-time stats for the VICIDIAL Auto-Dialer +# +# CHANGES +# +# 60620-1037 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["reset_counter"])) {$reset_counter=$_GET["reset_counter"];} + elseif (isset($_POST["reset_counter"])) {$reset_counter=$_POST["reset_counter"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +$epochSIXhoursAGO = ($STARTtime - 21600); +$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO); + +$reset_counter++; + +if ($reset_counter > 7) + { + $reset_counter=0; + + $stmt="update park_log set status='HUNGUP' where hangup_time is not null;"; +# $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + + if ($DB) + { + $stmt="delete from park_log where grab_time < '$timeSIXhoursAGO' and (hangup_time is null or hangup_time='');"; +# $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + } + } + +?> + + + +\n"; +echo " + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On VDAD\n"; +echo "
";
+
+###################################################################################
+###### TIME ON SYSTEM
+###################################################################################
+
+echo "VICIDIAL: Agents Time On Calls                         $NOW_TIME    REPORTS\n\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+echo "| STATION    | USER   | SESSIONID | CHANNEL             | STATUS | CALLTIME | MINUTES | CAMPAIGN     | FRONT  |\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+
+
+$stmt="select extension,user,conf_exten,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),uniqueid,lead_id from vicidial_live_agents where status NOT IN('PAUSED') and server_ip='" . mysql_real_escape_string($server_ip) . "' order by extension;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$talking_to_print = mysql_num_rows($rslt);
+	if ($talking_to_print > 0)
+	{
+	$i=0;
+	while ($i < $talking_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+			if (eregi("READY|PAUSED|CLOSER",$row[4]))
+			{
+			$row[3]='';
+			$row[5]='- WAIT -';
+			$row[6]=$row[7];
+			}
+		$extension[$i] = eregi_replace('Local/',"",$row[0]);
+		$extension[$i] =		sprintf("%-10s", $extension[$i]);
+			while(strlen($extension[$i])>10) {$extension[$i] = substr("$extension[$i]", 0, -1);}
+		$user[$i] =				sprintf("%-6s", $row[1]);
+		$sessionid[$i] =		sprintf("%-9s", $row[2]);
+		$channel[$i] =			sprintf("%-19s", $row[3]);
+			$cc[$i]=0;
+		while ( (strlen($channel[$i]) > 19) and ($cc[$i] < 100) )
+			{
+			$channel[$i] = eregi_replace(".$","",$channel[$i]);   
+			$cc[$i]++;
+			if (strlen($channel[$i]) <= 19) {$cc[$i]=101;}
+			}
+		$status[$i] =			sprintf("%-6s", $row[4]);
+		$start_time[$i] =		sprintf("%-8s", $row[5]);
+			$cd[$i]=0;
+		while ( (strlen($start_time[$i]) > 8) and ($cd[$i] < 100) )
+			{
+			$start_time[$i] = eregi_replace("^.","",$start_time[$i]);   
+			$cd[$i]++;
+			if (strlen($start_time[$i]) <= 8) {$cd[$i]=101;}
+			}
+		$uniqueid[$i] =			$row[8];
+		$lead_id[$i] =			$row[9];
+		$closer[$i] =			$row[1];
+		$call_time_S[$i] = ($STARTtime - $row[6]);
+
+		$call_time_M[$i] = ($call_time_S[$i] / 60);
+		$call_time_M[$i] = round($call_time_M[$i], 2);
+		$call_time_M_int[$i] = intval("$call_time_M[$i]");
+		$call_time_SEC[$i] = ($call_time_M[$i] - $call_time_M_int[$i]);
+		$call_time_SEC[$i] = ($call_time_SEC[$i] * 60);
+		$call_time_SEC[$i] = round($call_time_SEC[$i], 0);
+		if ($call_time_SEC[$i] < 10) {$call_time_SEC[$i] = "0$call_time_SEC[$i]";}
+		$call_time_MS[$i] = "$call_time_M_int[$i]:$call_time_SEC[$i]";
+		$call_time_MS[$i] =		sprintf("%7s", $call_time_MS[$i]);
+		$i++;
+		}
+		$ext_count = $i;
+		$i=0;
+	while ($i < $ext_count)
+		{
+
+		$stmt="select campaign_id from vicidial_auto_calls where lead_id='$lead_id[$i]' and server_ip='" . mysql_real_escape_string($server_ip) . "';";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$camp_to_print = mysql_num_rows($rslt);
+		if ($camp_to_print > 0)
+			{
+			$row=mysql_fetch_row($rslt);
+			$campaign = sprintf("%-12s", $row[0]);
+			$camp_color = $row[0];
+			}
+		else
+			{$campaign = 'DEAD        ';   	$camp_color = 'DEAD';}
+		if (eregi("READY|PAUSED|CLOSER",$status[$i]))
+			{$campaign = '            ';   	$camp_color = '';}
+
+		$stmt="select user from vicidial_xfer_log where lead_id='$lead_id[$i]' and closer='$closer[$i]' order by call_date desc limit 1;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$xfer_to_print = mysql_num_rows($rslt);
+		if ($xfer_to_print > 0)
+			{
+			$row=mysql_fetch_row($rslt);
+			$fronter = sprintf("%-6s", $row[0]);
+			}
+		else
+			{$fronter = '      ';}
+
+		$G = '';		$EG = '';
+		$G=""; $EG='';
+	#	if ($call_time_M_int[$i] >= 5) {$G=''; $EG='';}
+	#	if ($call_time_M_int[$i] >= 10) {$G=''; $EG='';}
+
+		echo "| $G$extension[$i]$EG | $G$user[$i]$EG | $G$sessionid[$i]$EG | $G$channel[$i]$EG | $G$status[$i]$EG | $G$start_time[$i]$EG | $G$call_time_MS[$i]$EG | $G$campaign$EG | $G$fronter$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+		echo "  $i agents logged in on server $server_ip\n\n";
+
+	#	echo "             - 5 minutes or more on call\n";
+	#	echo "             - Over 10 minutes on call\n";
+
+	}
+	else
+	{
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	echo "********************************* NO AGENTS ON CALLS *********************************\n";
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	}
+
+
+###################################################################################
+###### OUTBOUND CALLS
+###################################################################################
+#echo "\n\n";
+echo "----------------------------------------------------------------------------------------";
+echo "\n\n";
+echo "VICIDIAL: Time On VDAD                                              $NOW_TIME\n\n";
+echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+echo "| CHANNEL             | STATUS | CAMPAIGN     | PHONE NUMBER       | CALLTIME | MINUTES |\n";
+echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+
+#$link=mysql_connect("localhost", "cron", "1234");
+# $linkX=mysql_connect("localhost", "cron", "1234");
+#mysql_select_db("asterisk");
+
+$stmt="select channel,status,campaign_id,phone_code,phone_number,call_time,UNIX_TIMESTAMP(call_time) from vicidial_auto_calls where status NOT IN('XFER') and server_ip='" . mysql_real_escape_string($server_ip) . "' order by auto_call_id desc;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$parked_to_print = mysql_num_rows($rslt);
+	if ($parked_to_print > 0)
+	{
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$channel =			sprintf("%-19s", $row[0]);
+			$cc=0;
+		while ( (strlen($channel) > 19) and ($cc < 100) )
+			{
+			$channel = eregi_replace(".$","",$channel);   
+			$cc++;
+			if (strlen($channel) <= 19) {$cc=101;}
+			}
+		$start_time =		sprintf("%-8s", $row[5]);
+			$cd=0;
+		while ( (strlen($start_time) > 8) and ($cd < 100) )
+			{
+			$start_time = eregi_replace("^.","",$start_time);   
+			$cd++;
+			if (strlen($start_time) <= 8) {$cd=101;}
+			}
+		$status =			sprintf("%-6s", $row[1]);
+		$campaign =			sprintf("%-12s", $row[2]);
+			$all_phone = "$row[3]$row[4]";
+		$number_dialed =	sprintf("%-18s", $all_phone);
+		$call_time_S = ($STARTtime - $row[6]);
+
+		$call_time_M = ($call_time_S / 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";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if (eregi("LIVE",$status)) {$G=''; $EG='';}
+	#	if ($call_time_M_int >= 6) {$G=''; $EG='';}
+
+		echo "| $G$channel$EG | $G$status$EG | $G$campaign$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+		echo "  $i calls being placed on server $server_ip\n\n";
+
+		echo "             - LIVE CALL WAITING\n";
+	#	echo "             - Over 5 minutes on hold\n";
+
+		}
+	else
+	{
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	echo "******************************* NO LIVE CALLS WAITING *********************************\n";
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	}
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_timeonVDADall.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_timeonVDADall.php new file mode 100644 index 00000000..ec8eb52a --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_timeonVDADall.php @@ -0,0 +1,826 @@ + LICENSE: GPLv2 +# +# live real-time stats for the VICIDIAL Auto-Dialer all servers +# +# STOP=4000, SLOW=40, GO=4 seconds refresh interval +# +# CHANGELOG: +# 50406-0920 - Added Paused agents < 1 min (Chris Doyle) +# 51130-1218 - Modified layout and info to show all servers in a vicidial system +# 60421-1043 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60511-1343 - Added leads and drop info at the top of the screen +# 60608-1539 - Fixed CLOSER tallies for active calls +# 60619-1658 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 60626-1453 - Added display of system load to bottom (Angelito Manansala) +# 60901-1123 - Changed display elements at the top of the screen +# 60905-1342 - Fixed non INCALL|QUEUE timer column +# 61002-1642 - Added TRUNK SHORT/FILL stats +# 61101-1318 - Added SIP and IAX Listen and Barge links option +# 61101-1647 - Added Usergroup column and user name option as well as sorting +# 61102-1155 - Made display of columns more modular, added ability to hide server info +# 61215-1131 - Added answered calls and drop percent taken from answered calls +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70123-1151 - Added non_latin options for substr in display variables, thanks Marin Blu +# 70206-1140 - Added call-type statuses to display(A-Auto, M-Manual, I-Inbound/Closer) +# 70619-1339 - Added Status Category tally display +# 71029-1900 - Changed CLOSER-type to not require campaign_id restriction +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["RR"])) {$RR=$_GET["RR"];} + elseif (isset($_POST["RR"])) {$RR=$_POST["RR"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["usergroup"])) {$usergroup=$_GET["usergroup"];} + elseif (isset($_POST["usergroup"])) {$usergroup=$_POST["usergroup"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["adastats"])) {$adastats=$_GET["adastats"];} + elseif (isset($_POST["adastats"])) {$adastats=$_POST["adastats"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["SIPmonitorLINK"])) {$SIPmonitorLINK=$_GET["SIPmonitorLINK"];} + elseif (isset($_POST["SIPmonitorLINK"])) {$SIPmonitorLINK=$_POST["SIPmonitorLINK"];} +if (isset($_GET["IAXmonitorLINK"])) {$IAXmonitorLINK=$_GET["IAXmonitorLINK"];} + elseif (isset($_POST["IAXmonitorLINK"])) {$IAXmonitorLINK=$_POST["IAXmonitorLINK"];} +if (isset($_GET["UGdisplay"])) {$UGdisplay=$_GET["UGdisplay"];} + elseif (isset($_POST["UGdisplay"])) {$UGdisplay=$_POST["UGdisplay"];} +if (isset($_GET["UidORname"])) {$UidORname=$_GET["UidORname"];} + elseif (isset($_POST["UidORname"])) {$UidORname=$_POST["UidORname"];} +if (isset($_GET["orderby"])) {$orderby=$_GET["orderby"];} + elseif (isset($_POST["orderby"])) {$orderby=$_POST["orderby"];} +if (isset($_GET["SERVdisplay"])) {$SERVdisplay=$_GET["SERVdisplay"];} + elseif (isset($_POST["SERVdisplay"])) {$SERVdisplay=$_POST["SERVdisplay"];} + + + +if (!isset($RR)) {$gRRroup=4;} +if (!isset($group)) {$group='';} +if (!isset($usergroup)) {$usergroup='';} +if (!isset($UGdisplay)) {$UGdisplay=0;} # 0=no, 1=yes +if (!isset($UidORname)) {$UidORname=0;} # 0=id, 1=name +if (!isset($orderby)) {$orderby='timeup';} +if (!isset($SERVdisplay)) {$SERVdisplay=1;} # 0=no, 1=yes + +function get_server_load($windows = false) { +$os = strtolower(PHP_OS); +if(strpos($os, "win") === false) { +if(file_exists("/proc/loadavg")) { +$load = file_get_contents("/proc/loadavg"); +$load = explode(' ', $load); +return $load[0]; +} +elseif(function_exists("shell_exec")) { +$load = explode(' ', `uptime`); +return $load[count($load)-1]; +} +else { +return false; +} +} +elseif($windows) { +if(class_exists("COM")) { +$wmi = new COM("WinMgmts:\\\\."); +$cpus = $wmi->InstancesOf("Win32_Processor"); + +$cpuload = 0; +$i = 0; +while ($cpu = $cpus->Next()) { +$cpuload += $cpu->LoadPercentage; +$i++; +} + +$cpuload = round($cpuload / $i, 2); +return "$cpuload%"; +} +else { +return false; +} +} +} + +$load_ave = get_server_load(true); + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + 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($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_TIME = date("Y-m-d H:i:s"); +$NOW_DAY = date("Y-m-d"); +$NOW_HOUR = date("H:i:s"); +$STARTtime = date("U"); +$epochSIXhoursAGO = ($STARTtime - 21600); +$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO); + +$stmt="select campaign_id from vicidial_campaigns where active='Y';"; +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +if (!isset($DB)) {$DB=0;} +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + +$stmt="select * from vicidial_user_groups;"; +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +if (!isset($DB)) {$DB=0;} +if ($DB) {echo "$stmt\n";} +$usergroups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $usergroups_to_print) + { + $row=mysql_fetch_row($rslt); + $usergroups[$i] =$row[0]; + $i++; + } + +if (!isset($RR)) {$RR=4;} + +$NFB = ''; +$NFE = ''; +$F=''; $FG=''; $B=''; $BG=''; + +?> + + + + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On VDAD Campaign: $group\n"; +echo "
\n"; +echo "VICIDIAL Campaign: \n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +if ($UGdisplay > 0) + { + echo "\n"; + } +echo "         \n"; +echo "STOP | "; +echo "SLOW | "; +echo "GO"; +echo "       MODIFY | \n"; +echo "SUMMARY | \n"; +echo "REPORTS \n"; +echo "\n\n"; + + +if (!$group) {echo "

please select a campaign from the pulldown above
\n"; exit;} +else +{ +$stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select avg(auto_dial_level),min(dial_status_a),min(dial_status_b),min(dial_status_c),min(dial_status_d),min(dial_status_e),min(lead_order),min(lead_filter_id),sum(hopper_level),min(dial_method),avg(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),min(available_only_ratio_tally),min(adaptive_latest_server_time),min(local_call_time),avg(dial_timeout),min(dial_statuses) from vicidial_campaigns;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$DIALlev = $row[0]; +$DIALstatusA = $row[1]; +$DIALstatusB = $row[2]; +$DIALstatusC = $row[3]; +$DIALstatusD = $row[4]; +$DIALstatusE = $row[5]; +$DIALorder = $row[6]; +$DIALfilter = $row[7]; +$HOPlev = $row[8]; +$DIALmethod = $row[9]; +$maxDIALlev = $row[10]; +$DROPmax = $row[11]; +$targetDIFF = $row[12]; +$ADAintense = $row[13]; +$ADAavailonly = $row[14]; +$TAPERtime = $row[15]; +$CALLtime = $row[16]; +$DIALtimeout = $row[17]; +$DIALstatuses = $row[18]; + $DIALstatuses = (preg_replace("/ -$|^ /","",$DIALstatuses)); + $DIALstatuses = (ereg_replace(' ',', ',$DIALstatuses)); + +$stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select count(*) from vicidial_hopper;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$VDhop = $row[0]; + +$stmt="select dialable_leads,calls_today,drops_today,drops_answers_today_pct,differential_onemin,agents_average_onemin,balance_trunk_fill,answers_today,status_category_1,status_category_count_1,status_category_2,status_category_count_2,status_category_3,status_category_count_3,status_category_4,status_category_count_4 from vicidial_campaign_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),min(status_category_1),sum(status_category_count_1),min(status_category_2),sum(status_category_count_2),min(status_category_3),sum(status_category_count_3),min(status_category_4),sum(status_category_count_4) from vicidial_campaign_stats;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$DAleads = $row[0]; +$callsTODAY = $row[1]; +$dropsTODAY = $row[2]; +$drpctTODAY = $row[3]; +$diffONEMIN = $row[4]; +$agentsONEMIN = $row[5]; +$balanceFILL = $row[6]; +$answersTODAY = $row[7]; +$VSCcat1 = $row[8]; +$VSCcat1tally = $row[9]; +$VSCcat2 = $row[10]; +$VSCcat2tally = $row[11]; +$VSCcat3 = $row[12]; +$VSCcat3tally = $row[13]; +$VSCcat4 = $row[14]; +$VSCcat4tally = $row[15]; + +if ( ($diffONEMIN != 0) and ($agentsONEMIN > 0) ) + { + $diffpctONEMIN = ( ($diffONEMIN / $agentsONEMIN) * 100); + $diffpctONEMIN = sprintf("%01.2f", $diffpctONEMIN); + } +else {$diffpctONEMIN = '0.00';} + +$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$balanceSHORT = $row[0]; + +echo "
"; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +if ($adastats>1) + { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; + + + + +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo "
DIAL LEVEL:  $DIALlev    TRUNK SHORT/FILL:  $balanceSHORT / $balanceFILL     FILTER:  $DIALfilter   TIME:   $NOW_TIME
- min   MAX LEVEL:  $maxDIALlev   DROPPED MAX:  $DROPmax%    TARGET DIFF:  $targetDIFF     INTENSITY:  $ADAintense    
DIAL TIMEOUT:  $DIALtimeout  TAPER TIME:  $TAPERtime  LOCAL TIME:  $CALLtime  AVAIL ONLY:  $ADAavailonly  
DIALABLE LEADS:  $DAleads     CALLS TODAY:  $callsTODAY     AVG AGENTS:  $agentsONEMIN     DIAL METHOD:  $DIALmethod    
HOPPER LEVEL:  $HOPlev     DROPPED / ANSWERED:  $dropsTODAY / $answersTODAY   DL DIFF:  $diffONEMIN     STATUSES:  $DIALstatuses    
LEADS IN HOPPER:  $VDhop     DROPPED PERCENT:  "; +if ($drpctTODAY >= $DROPmax) + {echo "$drpctTODAY%";} +else + {echo "$drpctTODAY%";} +echo "    DIFF:  $diffpctONEMIN%     ORDER:  $DIALorder    
"; +if ( (!eregi('NULL',$VSCcat1)) and (strlen($VSCcat1)>0) ) + {echo "$VSCcat1:   $VSCcat1tally       \n";} +if ( (!eregi('NULL',$VSCcat2)) and (strlen($VSCcat2)>0) ) + {echo "$VSCcat2:   $VSCcat2tally       \n";} +if ( (!eregi('NULL',$VSCcat3)) and (strlen($VSCcat3)>0) ) + {echo "$VSCcat3:   $VSCcat3tally       \n";} +if ( (!eregi('NULL',$VSCcat4)) and (strlen($VSCcat4)>0) ) + {echo "$VSCcat4:   $VSCcat4tally       \n";} +echo "
"; + +if ($adastats<2) + { + echo "+ VIEW MORE SETTINGS"; + } +if ($UGdisplay>0) + { + echo "       HIDE USER GROUP"; + } +else + { + echo "       VIEW USER GROUP"; + } +if ($UidORname>0) + { + echo "       SHOW AGENT ID"; + } +else + { + echo "       SHOW AGENT NAME"; + } +if ($SERVdisplay>0) + { + echo "       HIDE SERVER INFO"; + } +else + { + echo "       SHOW SERVER INFO"; + } +echo "
"; + +echo "\n\n"; +} +################################################################################### +###### OUTBOUND CALLS +################################################################################### +if ($campaign_allow_inbound > 0) + { + $stmt="select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = preg_replace("/^ | -$/","",$row[0]); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaigns = "'$closer_campaigns'"; + + $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') and ( (call_type='IN' and campaign_id IN($closer_campaigns)) or (campaign_id='" . mysql_real_escape_string($group) . "' and call_type='OUT') );"; + } +else + { + if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';} + else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";} + + $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') $groupSQL;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$parked_to_print = mysql_num_rows($rslt); + if ($parked_to_print > 0) + { + $i=0; + $out_total=0; + $out_ring=0; + $out_live=0; + while ($i < $parked_to_print) + { + $row=mysql_fetch_row($rslt); + + if (eregi("LIVE",$row[0])) + {$out_live++;} + else + { + if (eregi("CLOSER",$row[0])) + {$nothing=1;} + else + {$out_ring++;} + } + $out_total++; + $i++; + } + + if ($out_live > 0) {$F=''; $FG='';} + if ($out_live > 4) {$F=''; $FG='';} + if ($out_live > 9) {$F=''; $FG='';} + if ($out_live > 14) {$F=''; $FG='';} + + if ($campaign_allow_inbound > 0) + {echo "$NFB$out_total$NFE current active calls      \n";} + else + {echo "$NFB$out_total$NFE calls being placed       \n";} + + echo "$NFB$out_ring$NFE calls ringing         \n"; + echo "$NFB$F  $out_live $FG$NFE calls waiting for agents       \n"; + } + else + { + echo " NO LIVE CALLS WAITING \n"; + } + + +################################################################################### +###### TIME ON SYSTEM +################################################################################### + +$agent_incall=0; +$agent_ready=0; +$agent_paused=0; +$agent_total=0; + +$Aecho = ''; +$Aecho .= "VICIDIAL: Agents Time On Calls Campaign: $group $NOW_TIME\n\n"; + + +$HDbegin = "+"; +$HTbegin = "|"; +$HDstation = "------------+"; +$HTstation = " STATION |"; +$HDuser = "--------------------+"; +$HTuser = " USER |"; +$HDusergroup = "--------------+"; +$HTusergroup = " USER GROUP |"; +$HDsessionid = "------------------+"; +$HTsessionid = " SESSIONID |"; +$HDbarge = "-------+"; +$HTbarge = " BARGE |"; +$HDstatus = "----------+"; +$HTstatus = " STATUS |"; +$HDserver_ip = "-----------------+"; +$HTserver_ip = " SERVER IP |"; +$HDcall_server_ip = "-----------------+"; +$HTcall_server_ip = " CALL SERVER IP |"; +$HDtime = "---------+"; +$HTtime = " MM:SS |"; +$HDcampaign = "------------+"; +$HTcampaign = " CAMPAIGN |"; + +if ($UGdisplay < 1) + { + $HDusergroup = ''; + $HTusergroup = ''; + } +if ( ($SIPmonitorLINK<1) && ($IAXmonitorLINK<1) ) + { + $HDsessionid = "-----------+"; + $HTsessionid = " SESSIONID |"; + } +if ( ($SIPmonitorLINK<2) && ($IAXmonitorLINK<2) ) + { + $HDbarge = ''; + $HTbarge = ''; + } +if ($SERVdisplay < 1) + { + $HDserver_ip = ''; + $HTserver_ip = ''; + $HDcall_server_ip = ''; + $HTcall_server_ip = ''; + } + + + +$Aline = "$HDbegin$HDstation$HDuser$HDusergroup$HDsessionid$HDbarge$HDstatus$HDserver_ip$HDcall_server_ip$HDtime$HDcampaign\n"; +$Bline = "$HTbegin$HTstation$HTuser$HTusergroup$HTsessionid$HTbarge$HTstatus$HTserver_ip$HTcall_server_ip$HTtime$HTcampaign\n"; +$Aecho .= "$Aline"; +$Aecho .= "$Bline"; +$Aecho .= "$Aline"; + +if ($orderby=='timeup') {$orderSQL='status,last_call_time';} +if ($orderby=='timedown') {$orderSQL='status desc,last_call_time desc';} +if ($orderby=='campaignup') {$orderSQL='campaign_id,status,last_call_time';} +if ($orderby=='campaigndown') {$orderSQL='campaign_id desc,status desc,last_call_time desc';} +if ($orderby=='groupup') {$orderSQL='user_group,status,last_call_time';} +if ($orderby=='groupdown') {$orderSQL='user_group desc,status desc,last_call_time desc';} +if ($UidORname > 0) + { + if ($orderby=='userup') {$orderSQL='full_name,status,last_call_time';} + if ($orderby=='userdown') {$orderSQL='full_name desc,status desc,last_call_time desc';} + } +else + { + if ($orderby=='userup') {$orderSQL='vicidial_live_agents.user';} + if ($orderby=='userdown') {$orderSQL='vicidial_live_agents.user desc';} + } + +if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';} +else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";} +if (strlen($usergroup)<1) {$usergroupSQL = '';} +else {$usergroupSQL = " and user_group='" . mysql_real_escape_string($usergroup) . "'";} + +$stmt="select extension,vicidial_live_agents.user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id,vicidial_users.user_group,vicidial_users.full_name,vicidial_live_agents.comments from vicidial_live_agents,vicidial_users where vicidial_live_agents.user=vicidial_users.user $groupSQL $usergroupSQL order by $orderSQL;"; + +#$stmt="select extension,vicidial_live_agents.user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id,vicidial_users.user_group,vicidial_users.full_name from vicidial_live_agents,vicidial_users where vicidial_live_agents.user=vicidial_users.user and campaign_id='" . mysql_real_escape_string($group) . "' order by $orderSQL;"; + +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + $agentcount=0; + while ($i < $talking_to_print) + { + $row=mysql_fetch_row($rslt); + if (eregi("READY|PAUSED",$row[3])) + { + $row[5]=$row[6]; + } + if ($non_latin < 1) + { + $extension = eregi_replace('Local/',"",$row[0]); + $extension = sprintf("%-10s", $extension); + while(strlen($extension)>10) {$extension = substr("$extension", 0, -1);} + } + else + { + $extension = eregi_replace('Local/',"",$row[0]); + $extension = sprintf("%-40s", $extension); + while(mb_strlen($extension, 'utf-8')>10) {$extension = mb_substr("$extension", 0, -1,'utf8');} + } + $Luser = $row[1]; + $user = sprintf("%-18s", $row[1]); + $Lsessionid = $row[2]; + $sessionid = sprintf("%-9s", $row[2]); + $Lstatus = $row[3]; + $status = sprintf("%-6s", $row[3]); + $server_ip = sprintf("%-15s", $row[4]); + $call_server_ip = sprintf("%-15s", $row[7]); + $campaign_id = sprintf("%-10s", $row[8]); + $comments= $row[11]; + + if (eregi("INCALL",$Lstatus)) + { + if ( (eregi("AUTO",$comments)) or (strlen($comments)<1) ) + {$CM='A';} + else + { + if (eregi("INBOUND",$comments)) + {$CM='I';} + else + {$CM='M';} + } + } + else {$CM=' ';} + + if ($UGdisplay > 0) + { + if ($non_latin < 1) + { + $user_group = sprintf("%-12s", $row[9]); + while(strlen($user_group)>12) {$user_group = substr("$user_group", 0, -1);} + } + else + { + $user_group = sprintf("%-40s", $row[9]); + while(mb_strlen($user_group, 'utf-8')>12) {$user_group = mb_substr("$user_group", 0, -1,'utf8');} + } + } + if ($UidORname > 0) + { + if ($non_latin < 1) + { + $user = sprintf("%-18s", $row[10]); + while(strlen($user)>18) {$user = substr("$user", 0, -1);} + } + else + { + $user = sprintf("%-40s", $row[10]); + while(mb_strlen($user, 'utf-8')>18) {$user = mb_substr("$user", 0, -1,'utf8');} + } + } + if (!eregi("INCALL|QUEUE",$row[3])) + {$call_time_S = ($STARTtime - $row[6]);} + else + {$call_time_S = ($STARTtime - $row[5]);} + + $call_time_M = ($call_time_S / 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"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + if ($Lstatus=='INCALL') + { + if ($call_time_S >= 10) {$G=''; $EG='';} + if ($call_time_M_int >= 1) {$G=''; $EG='';} + if ($call_time_M_int >= 5) {$G=''; $EG='';} + # if ($call_time_M_int >= 10) {$G=''; $EG='';} + } + if (eregi("PAUSED",$row[3])) + { + if ($call_time_M_int >= 30) + {$i++; continue;} + else + { + $agent_paused++; $agent_total++; + $G=''; $EG=''; + if ($call_time_S >= 10) {$G=''; $EG='';} + if ($call_time_M_int >= 1) {$G=''; $EG='';} + if ($call_time_M_int >= 5) {$G=''; $EG='';} + } + } +# if ( (strlen($row[7])> 4) and ($row[7] != "$row[4]") ) +# {$G=''; $EG='';} + + if ( (eregi("INCALL",$status)) or (eregi("QUEUE",$status)) ) {$agent_incall++; $agent_total++;} + if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) {$agent_ready++; $agent_total++;} + if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) + { + $G=''; $EG=''; + if ($call_time_M_int >= 1) {$G=''; $EG='';} + if ($call_time_M_int >= 5) {$G=''; $EG='';} + } + + $L=''; + $R=''; + if ($SIPmonitorLINK>0) {$L=" LISTEN"; $R='';} + if ($IAXmonitorLINK>0) {$L=" LISTEN"; $R='';} + if ($SIPmonitorLINK>1) {$R=" | BARGE";} + if ($IAXmonitorLINK>1) {$R=" | BARGE";} + + if ($UGdisplay > 0) {$UGD = " $G$user_group$EG |";} + else {$UGD = "";} + + if ($SERVdisplay > 0) {$SVD = "$G$server_ip$EG | $G$call_server_ip$EG | ";} + else {$SVD = "";} + + $agentcount++; + + $Aecho .= "| $G$extension$EG | $G$user$EG |$UGD $G$sessionid$EG$L$R | $G$status$EG $CM | $SVD$G$call_time_MS$EG | $G$campaign_id$EG |\n"; + + $i++; + } + + $Aecho .= "$Aline"; + $Aecho .= " $agentcount agents logged in on all servers\n"; + $Aecho .= " System Load Average: $load_ave\n\n"; + + # $Aecho .= " - Balanced call\n"; + $Aecho .= " - Agent waiting for call\n"; + $Aecho .= " - Agent waiting for call > 1 minute\n"; + $Aecho .= " - Agent waiting for call > 5 minutes\n"; + $Aecho .= " - Agent on call > 10 seconds\n"; + $Aecho .= " - Agent on call > 1 minute\n"; + $Aecho .= " - Agent on call > 5 minutes\n"; + $Aecho .= " - Agent Paused > 10 seconds\n"; + $Aecho .= " - Agent Paused > 1 minute\n"; + $Aecho .= " - Agent Paused > 5 minutes\n"; + + if ($agent_ready > 0) {$B=''; $BG='';} + if ($agent_ready > 4) {$B=''; $BG='';} + if ($agent_ready > 9) {$B=''; $BG='';} + if ($agent_ready > 14) {$B=''; $BG='';} + + + echo "\n
\n"; + + echo "$NFB$agent_total$NFE agents logged in         \n"; + echo "$NFB$agent_incall$NFE agents in calls       \n"; + echo "$NFB$B  $agent_ready $BG$NFE agents waiting       \n"; + echo "$NFB$agent_paused$NFE paused agents       \n"; + + echo "
";
+		echo "";
+		echo "$Aecho";
+	}
+	else
+	{
+	echo " NO AGENTS ON CALLS \n";
+	}
+
+?>
+
+ + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_timeonVDADallREC.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_timeonVDADallREC.php new file mode 100644 index 00000000..2abf27b2 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_timeonVDADallREC.php @@ -0,0 +1,943 @@ + LICENSE: GPLv2 +# +# live real-time stats for the VICIDIAL Auto-Dialer all servers +# +# STOP=4000, SLOW=40, GO=4 seconds refresh interval +# +# CHANGELOG: +# 50406-0920 - Added Paused agents < 1 min (Chris Doyle) +# 51130-1218 - Modified layout and info to show all servers in a vicidial system +# 60421-1043 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60511-1343 - Added leads and drop info at the top of the screen +# 60608-1539 - Fixed CLOSER tallies for active calls +# 60619-1658 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 60626-1453 - Added display of system load to bottom (Angelito Manansala) +# 60901-1123 - Changed display elements at the top of the screen +# 60905-1342 - Fixed non INCALL|QUEUE timer column +# 61002-1642 - Added TRUNK SHORT/FILL stats +# 61101-1318 - Added SIP and IAX Listen and Barge links option +# 61101-1647 - Added Usergroup column and user name option as well as sorting +# 61102-1155 - Made display of columns more modular, added ability to hide server info +# 61215-1131 - Added answered calls and drop percent taken from answered calls +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70123-1151 - Added non_latin options for substr in display variables, thanks Marin Blu +# 70206-1140 - Added call-type statuses to display(A-Auto, M-Manual, I-Inbound/Closer) +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["RR"])) {$RR=$_GET["RR"];} + elseif (isset($_POST["RR"])) {$RR=$_POST["RR"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["usergroup"])) {$usergroup=$_GET["usergroup"];} + elseif (isset($_POST["usergroup"])) {$usergroup=$_POST["usergroup"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["adastats"])) {$adastats=$_GET["adastats"];} + elseif (isset($_POST["adastats"])) {$adastats=$_POST["adastats"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["SIPmonitorLINK"])) {$SIPmonitorLINK=$_GET["SIPmonitorLINK"];} + elseif (isset($_POST["SIPmonitorLINK"])) {$SIPmonitorLINK=$_POST["SIPmonitorLINK"];} +if (isset($_GET["IAXmonitorLINK"])) {$IAXmonitorLINK=$_GET["IAXmonitorLINK"];} + elseif (isset($_POST["IAXmonitorLINK"])) {$IAXmonitorLINK=$_POST["IAXmonitorLINK"];} +if (isset($_GET["UGdisplay"])) {$UGdisplay=$_GET["UGdisplay"];} + elseif (isset($_POST["UGdisplay"])) {$UGdisplay=$_POST["UGdisplay"];} +if (isset($_GET["UidORname"])) {$UidORname=$_GET["UidORname"];} + elseif (isset($_POST["UidORname"])) {$UidORname=$_POST["UidORname"];} +if (isset($_GET["orderby"])) {$orderby=$_GET["orderby"];} + elseif (isset($_POST["orderby"])) {$orderby=$_POST["orderby"];} +if (isset($_GET["SERVdisplay"])) {$SERVdisplay=$_GET["SERVdisplay"];} + elseif (isset($_POST["SERVdisplay"])) {$SERVdisplay=$_POST["SERVdisplay"];} + +if (isset($_GET["RECmonitorLINK"])) {$RECmonitorLINK=$_GET["RECmonitorLINK"];} + elseif (isset($_POST["RECmonitorLINK"])) {$RECmonitorLINK=$_POST["RECmonitorLINK"];} + +if (!isset($RR)) {$gRRroup=4;} +if (!isset($group)) {$group='';} +if (!isset($usergroup)) {$usergroup='';} +if (!isset($UGdisplay)) {$UGdisplay=0;} # 0=no, 1=yes +if (!isset($UidORname)) {$UidORname=0;} # 0=id, 1=name +if (!isset($orderby)) {$orderby='timeup';} +if (!isset($SERVdisplay)) {$SERVdisplay=1;} # 0=no, 1=yes + +function get_server_load($windows = false) { +$os = strtolower(PHP_OS); +if(strpos($os, "win") === false) { +if(file_exists("/proc/loadavg")) { +$load = file_get_contents("/proc/loadavg"); +$load = explode(' ', $load); +return $load[0]; +} +elseif(function_exists("shell_exec")) { +$load = explode(' ', `uptime`); +return $load[count($load)-1]; +} +else { +return false; +} +} +elseif($windows) { +if(class_exists("COM")) { +$wmi = new COM("WinMgmts:\\\\."); +$cpus = $wmi->InstancesOf("Win32_Processor"); + +$cpuload = 0; +$i = 0; +while ($cpu = $cpus->Next()) { +$cpuload += $cpu->LoadPercentage; +$i++; +} + +$cpuload = round($cpuload / $i, 2); +return "$cpuload%"; +} +else { +return false; +} +} +} + +$load_ave = get_server_load(true); + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + + $stmt="SELECT vicidial_recording from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $authrec=$row[0]; + if ($authrec=='1') {$RECmonitorLINK = 1;} else {$RECmonitorLINK = 0;} + + +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_TIME = date("Ymd-His"); +$NOW_DAY = date("Y-m-d"); +$NOW_HOUR = date("H:i:s"); +$STARTtime = date("U"); +$epochSIXhoursAGO = ($STARTtime - 21600); +$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO); + +$stmt="select campaign_id from vicidial_campaigns where active='Y';"; +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); +if (!isset($DB)) {$DB=0;} +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + +$stmt="select * from vicidial_user_groups;"; +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); +if (!isset($DB)) {$DB=0;} +if ($DB) {echo "$stmt\n";} +$usergroups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $usergroups_to_print) + { + $row=mysql_fetch_row($rslt); + $usergroups[$i] =$row[0]; + $i++; + } + +if (!isset($RR)) {$RR=4;} + +$NFB = ''; +$NFE = ''; +$F=''; $FG=''; $B=''; $BG=''; + +?> + + + + + + + + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On VDAD Campaign: $group\n"; +echo "
\n"; +echo "VICIDIAL Campaign: \n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +if ($UGdisplay > 0) + { + echo "\n"; + } +echo "         \n"; +echo "STOP | "; +echo "SLOW | "; +echo "GO"; +echo "       MODIFY | \n"; +echo "SUMMARY | \n"; +echo "REPORTS \n"; +echo "\n\n"; + + +if (!$group) {echo "

please select a campaign from the pulldown above
\n"; exit;} +else +{ +$stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; + +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select avg(auto_dial_level),min(dial_status_a),min(dial_status_b),min(dial_status_c),min(dial_status_d),min(dial_status_e),min(lead_order),min(lead_filter_id),sum(hopper_level),min(dial_method),avg(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),min(available_only_ratio_tally),min(adaptive_latest_server_time),min(local_call_time),avg(dial_timeout),min(dial_statuses) from vicidial_campaigns;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$DIALlev = $row[0]; +$DIALstatusA = $row[1]; +$DIALstatusB = $row[2]; +$DIALstatusC = $row[3]; +$DIALstatusD = $row[4]; +$DIALstatusE = $row[5]; +$DIALorder = $row[6]; +$DIALfilter = $row[7]; +$HOPlev = $row[8]; +$DIALmethod = $row[9]; +$maxDIALlev = $row[10]; +$DROPmax = $row[11]; +$targetDIFF = $row[12]; +$ADAintense = $row[13]; +$ADAavailonly = $row[14]; +$TAPERtime = $row[15]; +$CALLtime = $row[16]; +$DIALtimeout = $row[17]; +$DIALstatuses = $row[18]; + $DIALstatuses = (preg_replace("/ -$|^ /","",$DIALstatuses)); + $DIALstatuses = (ereg_replace(' ',', ',$DIALstatuses)); + +$stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select count(*) from vicidial_hopper;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$VDhop = $row[0]; + +$stmt="select dialable_leads,calls_today,drops_today,drops_answers_today_pct,differential_onemin,agents_average_onemin,balance_trunk_fill,answers_today from vicidial_campaign_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today) from vicidial_campaign_stats;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$DAleads = $row[0]; +$callsTODAY = $row[1]; +$dropsTODAY = $row[2]; +$drpctTODAY = $row[3]; +$diffONEMIN = $row[4]; +$agentsONEMIN = $row[5]; +$balanceFILL = $row[6]; +$answersTODAY = $row[7]; +if ( ($diffONEMIN != 0) and ($agentsONEMIN > 0) ) + { + $diffpctONEMIN = ( ($diffONEMIN / $agentsONEMIN) * 100); + $diffpctONEMIN = sprintf("%01.2f", $diffpctONEMIN); + } +else {$diffpctONEMIN = '0.00';} + +$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$balanceSHORT = $row[0]; + +echo "
"; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +if ($adastats>1) + { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo "
DIAL LEVEL:  $DIALlev    TRUNK SHORT/FILL:  $balanceSHORT / $balanceFILL     FILTER:  $DIALfilter   TIME:   $NOW_TIME
- min   MAX LEVEL:  $maxDIALlev   DROPPED MAX:  $DROPmax%    TARGET DIFF:  $targetDIFF     INTENSITY:  $ADAintense    
DIAL TIMEOUT:  $DIALtimeout  TAPER TIME:  $TAPERtime  LOCAL TIME:  $CALLtime  AVAIL ONLY:  $ADAavailonly  
DIALABLE LEADS:  $DAleads     CALLS TODAY:  $callsTODAY     AVG AGENTS:  $agentsONEMIN     DIAL METHOD:  $DIALmethod    
HOPPER LEVEL:  $HOPlev     DROPPED / ANSWERED:  $dropsTODAY / $answersTODAY   DL DIFF:  $diffONEMIN     STATUSES:  $DIALstatuses    
LEADS IN HOPPER:  $VDhop     DROPPED PERCENT:  $drpctTODAY%    DIFF:  $diffpctONEMIN%     ORDER:  $DIALorder    
"; + +if ($adastats<2) + { + echo "+ VIEW MORE SETTINGS"; + } +if ($UGdisplay>0) + { + echo "       HIDE USER GROUP"; + } +else + { + echo "       VIEW USER GROUP"; + } +if ($UidORname>0) + { + echo "       SHOW AGENT ID"; + } +else + { + echo "       SHOW AGENT NAME"; + } +if ($SERVdisplay>0) + { + echo "       HIDE SERVER INFO"; + } +else + { + echo "       SHOW SERVER INFO"; + } +echo "
"; + +echo "\n\n"; +} +################################################################################### +###### OUTBOUND CALLS +################################################################################### +if (eregi("(CLOSER|BLEND|INBND|_C$|_B$|_I$)",$group)) + { + $stmt="select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} + if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = preg_replace("/^ | -$/","",$row[0]); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaigns = "'$closer_campaigns'"; + + $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') and ( (call_type='IN' and campaign_id IN($closer_campaigns)) or (campaign_id='" . mysql_real_escape_string($group) . "' and call_type='OUT') );"; + } +else + { + if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';} + else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";} + + $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') $groupSQL;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$parked_to_print = mysql_num_rows($rslt); + if ($parked_to_print > 0) + { + $i=0; + $out_total=0; + $out_ring=0; + $out_live=0; + while ($i < $parked_to_print) + { + $row=mysql_fetch_row($rslt); + + if (eregi("LIVE",$row[0])) + {$out_live++;} + else + { + if (eregi("CLOSER",$row[0])) + {$nothing=1;} + else + {$out_ring++;} + } + $out_total++; + $i++; + } + + if ($out_live > 0) {$F=''; $FG='';} + if ($out_live > 4) {$F=''; $FG='';} + if ($out_live > 9) {$F=''; $FG='';} + if ($out_live > 14) {$F=''; $FG='';} + + if (eregi("(CLOSER|BLEND|INBND|_C$|_B$|_I$)",$group)) + {echo "$NFB$out_total$NFE current active calls      \n";} + else + {echo "$NFB$out_total$NFE calls being placed       \n";} + + echo "$NFB$out_ring$NFE calls ringing         \n"; + echo "$NFB$F  $out_live $FG$NFE calls waiting for agents       \n"; + } + else + { + echo " NO LIVE CALLS WAITING \n"; + } + + +################################################################################### +###### TIME ON SYSTEM +################################################################################### + +$agent_incall=0; +$agent_ready=0; +$agent_paused=0; +$agent_total=0; + +$Aecho = ''; +$Aecho .= "VICIDIAL: Agents Time On Calls Campaign: $group $NOW_TIME\n\n"; + + +$HDbegin = "+"; +$HTbegin = "|"; +$HDstation = "------------+"; +$HTstation = " STATION |"; +$HDuser = "--------------------+"; +$HTuser = " USER |"; +$HDusergroup = "--------------+"; +$HTusergroup = " USER GROUP |"; +$HDsessionid = "------------------+"; +$HTsessionid = " SESSIONID |"; +$HDbarge = "-------+"; +$HTbarge = " BARGE |"; +$HDrec = "---------+"; +$HTrec = " MONITOR |"; +$HDstatus = "----------+"; +$HTstatus = " STATUS |"; +$HDserver_ip = "-----------------+"; +$HTserver_ip = " SERVER IP |"; +$HDcall_server_ip = "-----------------+"; +$HTcall_server_ip = " CALL SERVER IP |"; +$HDtime = "---------+"; +$HTtime = " MM:SS |"; +$HDcampaign = "------------+"; +$HTcampaign = " CAMPAIGN |"; + +if ($UGdisplay < 1) + { + $HDusergroup = ''; + $HTusergroup = ''; + } +if ( ($SIPmonitorLINK<1) && ($IAXmonitorLINK<1) ) + { + $HDsessionid = "-----------+"; + $HTsessionid = " SESSIONID |"; + } +if ( ($SIPmonitorLINK<2) && ($IAXmonitorLINK<2) ) + { + $HDbarge = ''; + $HTbarge = ''; + } +if ($SERVdisplay < 1) + { + $HDserver_ip = ''; + $HTserver_ip = ''; + $HDcall_server_ip = ''; + $HTcall_server_ip = ''; + } + +if ( ($RECmonitorLINK<1) ) +{ + $HDrec = ''; + $HTrec = ''; +} + +$Aline = "$HDbegin$HDstation$HDuser$HDusergroup$HDsessionid$HDbarge$HDstatus$HDrec$HDserver_ip$HDcall_server_ip$HDtime$HDcampaign\n"; +$Bline = "$HTbegin$HTstation$HTuser$HTusergroup$HTsessionid$HTbarge$HTstatus$HTrec$HTserver_ip$HTcall_server_ip$HTtime$HTcampaign\n"; + +$Aecho .= "$Aline"; +$Aecho .= "$Bline"; +$Aecho .= "$Aline"; + +if ($orderby=='timeup') {$orderSQL='status,last_call_time';} +if ($orderby=='timedown') {$orderSQL='status desc,last_call_time desc';} +if ($orderby=='campaignup') {$orderSQL='campaign_id,status,last_call_time';} +if ($orderby=='campaigndown') {$orderSQL='campaign_id desc,status desc,last_call_time desc';} +if ($orderby=='groupup') {$orderSQL='user_group,status,last_call_time';} +if ($orderby=='groupdown') {$orderSQL='user_group desc,status desc,last_call_time desc';} +if ($UidORname > 0) + { + if ($orderby=='userup') {$orderSQL='full_name,status,last_call_time';} + if ($orderby=='userdown') {$orderSQL='full_name desc,status desc,last_call_time desc';} + } +else + { + if ($orderby=='userup') {$orderSQL='vicidial_live_agents.user';} + if ($orderby=='userdown') {$orderSQL='vicidial_live_agents.user desc';} + } + +if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';} +else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";} +if (strlen($usergroup)<1) {$usergroupSQL = '';} +else {$usergroupSQL = " and user_group='" . mysql_real_escape_string($usergroup) . "'";} + +$stmt="select extension,vicidial_live_agents.user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id,vicidial_users.user_group,vicidial_users.full_name,vicidial_live_agents.comments,lead_id,vicidial_users.pass from vicidial_live_agents,vicidial_users where vicidial_live_agents.user=vicidial_users.user $groupSQL $usergroupSQL order by $orderSQL;"; + +#$stmt="select extension,vicidial_live_agents.user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id,vicidial_users.user_group,vicidial_users.full_name from vicidial_live_agents,vicidial_users where vicidial_live_agents.user=vicidial_users.user and campaign_id='" . mysql_real_escape_string($group) . "' order by $orderSQL;"; + +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + $agentcount=0; + while ($i < $talking_to_print) + { + $row=mysql_fetch_row($rslt); + if (eregi("READY|PAUSED",$row[3])) + { + $row[5]=$row[6]; + } + if ($non_latin < 1) + { + $extension = eregi_replace('Local/',"",$row[0]); + $extension = eregi_replace('IAX2/',"",$row[0]); + $extension = sprintf("%-10s", $extension); + while(strlen($extension)>10) {$extension = substr("$extension", 0, -1);} + } + else + { + $extension = eregi_replace('Local/',"",$row[0]); + $extension = eregi_replace('IAX2/',"",$row[0]); + $extension = sprintf("%-40s", $extension); + while(mb_strlen($extension, 'utf-8')>10) {$extension = mb_substr("$extension", 0, -1,'utf8');} + } + + $Luser = $row[1]; + $user = sprintf("%-18s", $row[1]); + $Lsessionid = $row[2]; + $sessionid = sprintf("%-9s", $row[2]); + $Lstatus = $row[3]; + $status = sprintf("%-6s", $row[3]); + $Lserver_ip = $row[4]; + $server_ip = sprintf("%-15s", $row[4]); + $call_server_ip = sprintf("%-15s", $row[7]); + $campaign_id = sprintf("%-10s", $row[8]); + $comments= $row[11]; + + $lead_id = $row[12]; + $user_pass = $row[13]; + + + if (eregi("INCALL",$Lstatus)) + { + if ( (eregi("AUTO",$comments)) or (strlen($comments)<1) ) + {$CM='A';} + else + { + if (eregi("INBOUND",$comments)) + {$CM='I';} + else + {$CM='M';} + } + } + else {$CM=' ';} + + if ($UGdisplay > 0) + { + if ($non_latin < 1) + { + $user_group = sprintf("%-12s", $row[9]); + while(strlen($user_group)>12) {$user_group = substr("$user_group", 0, -1);} + } + else + { + $user_group = sprintf("%-40s", $row[9]); + while(mb_strlen($user_group, 'utf-8')>12) {$user_group = mb_substr("$user_group", 0, -1,'utf8');} + } + } + if ($UidORname > 0) + { + if ($non_latin < 1) + { + $user = sprintf("%-18s", $row[10]); + while(strlen($user)>18) {$user = substr("$user", 0, -1);} + } + else + { + $user = sprintf("%-40s", $row[10]); + while(mb_strlen($user, 'utf-8')>18) {$user = mb_substr("$user", 0, -1,'utf8');} + } + } + if (!eregi("INCALL|QUEUE",$row[3])) + {$call_time_S = ($STARTtime - $row[6]);} + else + {$call_time_S = ($STARTtime - $row[5]);} + + $call_time_M = ($call_time_S / 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"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + if ($Lstatus=='INCALL') + { + if ($call_time_S >= 10) {$G=''; $EG='';} + if ($call_time_M_int >= 1) {$G=''; $EG='';} + if ($call_time_M_int >= 5) {$G=''; $EG='';} + # if ($call_time_M_int >= 10) {$G=''; $EG='';} + } + if (eregi("PAUSED",$row[3])) + { + if ($call_time_M_int >= 30) + {$i++; continue;} + else + { + $agent_paused++; $agent_total++; + $G=''; $EG=''; + if ($call_time_S >= 10) {$G=''; $EG='';} + if ($call_time_M_int >= 1) {$G=''; $EG='';} + if ($call_time_M_int >= 5) {$G=''; $EG='';} + } + } +# if ( (strlen($row[7])> 4) and ($row[7] != "$row[4]") ) +# {$G=''; $EG='';} + + if ( (eregi("INCALL",$status)) or (eregi("QUEUE",$status)) ) {$agent_incall++; $agent_total++;} + if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) {$agent_ready++; $agent_total++;} + if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) + { + $G=''; $EG=''; + if ($call_time_M_int >= 1) {$G=''; $EG='';} + if ($call_time_M_int >= 5) {$G=''; $EG='';} + } + + $L=''; + $R=''; + $LL=''; + $EXTF='6'; + $servip= str_replace('.','',$Lserver_ip); + if ($SIPmonitorLINK>0) {$L=" LISTEN"; $R='';} + if ($IAXmonitorLINK>0) {$L=" LISTEN"; $R='';} + if ($SIPmonitorLINK>1) {$R=" | BARGE";} + if ($IAXmonitorLINK>1) {$R=" | BARGE";} + + + if ($RECmonitorLINK>0) + { + + $stmt="select session_name from web_client_sessions where server_ip ='$server_ip' and extension ='$extension' limit 1;"; + if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} + $rslta=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $sess = mysql_num_rows($rslta); + + if ($sess > 0) + { + $row=mysql_fetch_row($rslta); + $sessionname = $row[0]; + } else + { + $sessionname = ""; + } + + + $stmt="select end_time,channel,extension,lead_id,user,server_ip,filename from recording_log where server_ip ='$server_ip' and user ='$Luser';"; + if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} + $rslta=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_channels = mysql_num_rows($rslta); + + if ($rec_channels > 0) + { + $ii=0; + while ($ii < $rec_channels) + { + $row=mysql_fetch_row($rslta); + $pos=strpos($row[1], $Lsessionid); + + if ($pos===false) + { + $LL=" Rec "; + } + else + { + if(is_null($row[0])) { + $LL=" Stop"; + } + else + { + $LL=" Rec "; + } + } + + $ii++; + } + } + else + { + $LL=" Rec "; + + } + } + + + if ($UGdisplay > 0) {$UGD = " $G$user_group$EG |";} + else {$UGD = "";} + + if ($SERVdisplay > 0) {$SVD = "$G$server_ip$EG | $G$call_server_ip$EG | ";} + else {$SVD = "";} + + $agentcount++; + + $Aecho .= "| $G$extension$EG | $G$user$EG |$UGD $G$sessionid$EG$L$R | $G$status$EG $CM | $LL | $SVD$G$call_time_MS$EG | $G$campaign_id$EG |\n"; + + $i++; + } + + $Aecho .= "$Aline"; + $Aecho .= " $agentcount agents logged in on all servers\n"; + $Aecho .= " System Load Average: $load_ave\n\n"; + + # $Aecho .= " - Balanced call\n"; + $Aecho .= " - Agent waiting for call\n"; + $Aecho .= " - Agent waiting for call > 1 minute\n"; + $Aecho .= " - Agent waiting for call > 5 minutes\n"; + $Aecho .= " - Agent on call > 10 seconds\n"; + $Aecho .= " - Agent on call > 1 minute\n"; + $Aecho .= " - Agent on call > 5 minutes\n"; + $Aecho .= " - Agent Paused > 10 seconds\n"; + $Aecho .= " - Agent Paused > 1 minute\n"; + $Aecho .= " - Agent Paused > 5 minutes\n"; + + if ($agent_ready > 0) {$B=''; $BG='';} + if ($agent_ready > 4) {$B=''; $BG='';} + if ($agent_ready > 9) {$B=''; $BG='';} + if ($agent_ready > 14) {$B=''; $BG='';} + + + echo "\n
\n"; + + echo "$NFB$agent_total$NFE agents logged in         \n"; + echo "$NFB$agent_incall$NFE agents in calls       \n"; + echo "$NFB$B  $agent_ready $BG$NFE agents waiting       \n"; + echo "$NFB$agent_paused$NFE paused agents       \n"; + + echo "
";
+		echo "";
+		echo "$Aecho";
+	}
+	else
+	{
+	echo " NO AGENTS ON CALLS \n";
+	}
+
+?>
+
+ + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_timeonVDADallSUMMARY.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_timeonVDADallSUMMARY.php new file mode 100644 index 00000000..242b27a0 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_timeonVDADallSUMMARY.php @@ -0,0 +1,442 @@ + LICENSE: GPLv2 +# +# Summary for all campaigns live real-time stats for the VICIDIAL Auto-Dialer all servers +# +# STOP=4000, SLOW=40, GO=4 seconds refresh interval +# +# changes: +# 61102-1616 - first build +# 61215-1131 - added answered calls and drop percent taken from answered calls +# 70111-1600 - added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70619-1339 - Added Status Category tally display +# 71029-1900 - Changed CLOSER-type to not require campaign_id restriction +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["RR"])) {$RR=$_GET["RR"];} + elseif (isset($_POST["RR"])) {$RR=$_POST["RR"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["adastats"])) {$adastats=$_GET["adastats"];} + elseif (isset($_POST["adastats"])) {$adastats=$_POST["adastats"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +if (!isset($RR)) {$gRRroup=4;} + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); + +$stmt="select campaign_id from vicidial_campaigns where active='Y';"; +$rslt=mysql_query($stmt, $link); +if (!isset($DB)) {$DB=0;} +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + +if (!isset($RR)) {$RR=4;} + +?> + + + + + +\n"; +echo "VICIDIAL: Realtime All Campaigns Summary\n"; +echo "VICIDIAL: Realtime All Campaigns Summary           \n"; +echo "STOP | "; +echo "SLOW | "; +echo "GO "; +echo "       \n"; +if ($adastats<2) + { + echo "+ VIEW MORE SETTINGS"; + } +else + { + echo "- VIEW LESS SETTINGS"; + } +echo "       REPORTS"; +echo "

\n\n"; + +$k=0; +while($k<$groups_to_print) +{ +$NFB = ''; +$NFE = ''; +$F=''; $FG=''; $B=''; $BG=''; + +$group = $groups[$k]; +echo "$group   -   "; +echo "Modify\n"; + + +$stmt = "select count(*) from vicidial_campaigns where campaign_id='$group' and campaign_allow_inbound='Y';"; +$rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $campaign_allow_inbound = $row[0]; + +$stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$DIALlev = $row[0]; +$DIALstatusA = $row[1]; +$DIALstatusB = $row[2]; +$DIALstatusC = $row[3]; +$DIALstatusD = $row[4]; +$DIALstatusE = $row[5]; +$DIALorder = $row[6]; +$DIALfilter = $row[7]; +$HOPlev = $row[8]; +$DIALmethod = $row[9]; +$maxDIALlev = $row[10]; +$DROPmax = $row[11]; +$targetDIFF = $row[12]; +$ADAintense = $row[13]; +$ADAavailonly = $row[14]; +$TAPERtime = $row[15]; +$CALLtime = $row[16]; +$DIALtimeout = $row[17]; +$DIALstatuses = $row[18]; + $DIALstatuses = (preg_replace("/ -$|^ /","",$DIALstatuses)); + $DIALstatuses = (ereg_replace(' ',', ',$DIALstatuses)); + +$stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$VDhop = $row[0]; + +$stmt="select dialable_leads,calls_today,drops_today,drops_answers_today_pct,differential_onemin,agents_average_onemin,balance_trunk_fill,answers_today,status_category_1,status_category_count_1,status_category_2,status_category_count_2,status_category_3,status_category_count_3,status_category_4,status_category_count_4 from vicidial_campaign_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$DAleads = $row[0]; +$callsTODAY = $row[1]; +$dropsTODAY = $row[2]; +$drpctTODAY = $row[3]; +$diffONEMIN = $row[4]; +$agentsONEMIN = $row[5]; +$balanceFILL = $row[6]; +$answersTODAY = $row[7]; +$VSCcat1 = $row[8]; +$VSCcat1tally = $row[9]; +$VSCcat2 = $row[10]; +$VSCcat2tally = $row[11]; +$VSCcat3 = $row[12]; +$VSCcat3tally = $row[13]; +$VSCcat4 = $row[14]; +$VSCcat4tally = $row[15]; + +if ( ($diffONEMIN != 0) and ($agentsONEMIN > 0) ) + { + $diffpctONEMIN = ( ($diffONEMIN / $agentsONEMIN) * 100); + $diffpctONEMIN = sprintf("%01.2f", $diffpctONEMIN); + } +else {$diffpctONEMIN = '0.00';} + +$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$balanceSHORT = $row[0]; + +echo "
"; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +if ($adastats>1) + { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo "
DIAL LEVEL:  $DIALlev    TRUNK SHORT/FILL:  $balanceSHORT / $balanceFILL     FILTER:  $DIALfilter   TIME:   $NOW_TIME
  MAX LEVEL:  $maxDIALlev   DROPPED MAX:  $DROPmax%    TARGET DIFF:  $targetDIFF     INTENSITY:  $ADAintense    
DIAL TIMEOUT:  $DIALtimeout  TAPER TIME:  $TAPERtime  LOCAL TIME:  $CALLtime  AVAIL ONLY:  $ADAavailonly  
DIALABLE LEADS:  $DAleads     CALLS TODAY:  $callsTODAY     AVG AGENTS:  $agentsONEMIN     DIAL METHOD:  $DIALmethod    
HOPPER LEVEL:  $HOPlev     DROPPED / ANSWERED:  $dropsTODAY / $answersTODAY   DL DIFF:  $diffONEMIN     STATUSES:  $DIALstatuses    
LEADS IN HOPPER:  $VDhop     DROPPED PERCENT:  "; +if ($drpctTODAY >= $DROPmax) + {echo "$drpctTODAY%";} +else + {echo "$drpctTODAY%";} +echo "    DIFF:  $diffpctONEMIN%     ORDER:  $DIALorder    
"; +if ( (!eregi('NULL',$VSCcat1)) and (strlen($VSCcat1)>0) ) + {echo "$VSCcat1:   $VSCcat1tally       \n";} +if ( (!eregi('NULL',$VSCcat2)) and (strlen($VSCcat2)>0) ) + {echo "$VSCcat2:   $VSCcat2tally       \n";} +if ( (!eregi('NULL',$VSCcat3)) and (strlen($VSCcat3)>0) ) + {echo "$VSCcat3:   $VSCcat3tally       \n";} +if ( (!eregi('NULL',$VSCcat4)) and (strlen($VSCcat4)>0) ) + {echo "$VSCcat4:   $VSCcat4tally       \n";} +echo "
"; + +### Header finish + + + + + +################################################################################ +### START calculating calls/agents +################################################################################ + +################################################################################ +###### OUTBOUND CALLS +################################################################################ +if ($campaign_allow_inbound > 0) + { + $stmt="select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = preg_replace("/^ | -$/","",$row[0]); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaigns = "'$closer_campaigns'"; + + $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') and ( (call_type='IN' and campaign_id IN($closer_campaigns)) or (campaign_id='" . mysql_real_escape_string($group) . "' and call_type='OUT') );"; + } +else + { + if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';} + else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";} + + $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') $groupSQL;"; + } +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$parked_to_print = mysql_num_rows($rslt); + if ($parked_to_print > 0) + { + $i=0; + $out_total=0; + $out_ring=0; + $out_live=0; + while ($i < $parked_to_print) + { + $row=mysql_fetch_row($rslt); + + if (eregi("LIVE",$row[0])) + {$out_live++;} + else + { + if (eregi("CLOSER",$row[0])) + {$nothing=1;} + else + {$out_ring++;} + } + $out_total++; + $i++; + } + + if ($out_live > 0) {$F=''; $FG='';} + if ($out_live > 4) {$F=''; $FG='';} + if ($out_live > 9) {$F=''; $FG='';} + if ($out_live > 14) {$F=''; $FG='';} + + if ($campaign_allow_inbound > 0) + {echo "$NFB$out_total$NFE current active calls      \n";} + else + {echo "$NFB$out_total$NFE calls being placed       \n";} + + echo "$NFB$out_ring$NFE calls ringing         \n"; + echo "$NFB$F  $out_live $FG$NFE calls waiting for agents       \n"; + } + else + { + echo " NO LIVE CALLS WAITING \n"; + } + + +################################################################################### +###### TIME ON SYSTEM +################################################################################### + +$agent_incall=0; +$agent_ready=0; +$agent_paused=0; +$agent_total=0; + +$stmt="select extension,user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id from vicidial_live_agents where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + $agentcount=0; + while ($i < $talking_to_print) + { + $row=mysql_fetch_row($rslt); + if (eregi("READY|PAUSED",$row[3])) + { + $row[5]=$row[6]; + } + $Lstatus = $row[3]; + $status = sprintf("%-6s", $row[3]); + if (!eregi("INCALL|QUEUE",$row[3])) + {$call_time_S = ($STARTtime - $row[6]);} + else + {$call_time_S = ($STARTtime - $row[5]);} + + $call_time_M = ($call_time_S / 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"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + if (eregi("PAUSED",$row[3])) + { + if ($call_time_M_int >= 30) + {$i++; continue;} + else + { + $agent_paused++; $agent_total++; + } + } + + if ( (eregi("INCALL",$status)) or (eregi("QUEUE",$status)) ) {$agent_incall++; $agent_total++;} + if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) {$agent_ready++; $agent_total++;} + $agentcount++; + + + $i++; + } + + if ($agent_ready > 0) {$B=''; $BG='';} + if ($agent_ready > 4) {$B=''; $BG='';} + if ($agent_ready > 9) {$B=''; $BG='';} + if ($agent_ready > 14) {$B=''; $BG='';} + + echo "\n
\n"; + + echo "$NFB$agent_total$NFE agents logged in         \n"; + echo "$NFB$agent_incall$NFE agents in calls       \n"; + echo "$NFB$B  $agent_ready $BG$NFE agents waiting       \n"; + echo "$NFB$agent_paused$NFE paused agents       \n"; + + echo "
";
+		echo "";
+	}
+	else
+	{
+	echo " NO AGENTS ON CALLS
\n"; + } + +################################################################################ +### END calculating calls/agents +################################################################################ + + + + + +echo "
"; + +echo "\n\n"; +$k++; +} + +?> +
+ + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_timeoncall.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_timeoncall.php new file mode 100644 index 00000000..4227f836 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_timeoncall.php @@ -0,0 +1,180 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["reset_counter"])) {$reset_counter=$_GET["reset_counter"];} + elseif (isset($_POST["reset_counter"])) {$reset_counter=$_POST["reset_counter"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); + +?> + + + + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On Call\n"; +echo "
\n\n";
+
+echo "VICIDIAL: Time On Call                                          $NOW_TIME\n\n";
+echo "+------------+-----------+-----------+------------------+---------------------+---------+\n";
+echo "| STATION    | SESSIONID | CHANNEL   | NUMBER DIALED    | START TIME          | MINUTES |\n";
+echo "+------------+-----------+-----------+------------------+---------------------+---------+\n";
+
+$stmt="SELECT count(*) from live_sip_channels where server_ip='$server_ip';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$parked_count = $row[0];
+	if ($parked_count > 0)
+	{
+	$stmt="select extension from live_channels where server_ip='$server_ip';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$ext_to_print = mysql_num_rows($rslt);
+	$i=0;
+	$live_zap_counter=0;
+	$sessions = '';
+	while ($i < $ext_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if (preg_match("/^8600/i",$row[0]))
+			{
+			$sessions .= "$row[0]|";
+			}
+		$i++;
+		}
+	$sessions = preg_replace("/\|$/",'',$sessions);
+
+	if ($DB) {echo "SESSIONS: -$sessions-\n";}
+
+	$stmt="select * from live_sip_channels where server_ip='$server_ip' order by channel;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$parked_to_print = mysql_num_rows($rslt);
+	$i=0;
+	$live_calls_counter=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if ( (preg_match("/Zap\/|internal|ring/i",$row[3])) or (preg_match("/Local\//i",$row[0])) )
+			{
+			if ($DB) {echo "NOT STATION |$row[0]|$row[3]|\n";}
+			$session_id = '';
+			}
+		else 
+			{
+			if (preg_match("/$row[3]/i",$sessions))
+				{
+				if ($DB) {echo "LIVE STATION|$row[0]|$row[3]|\n";}
+				$session_id = $row[3];
+				$station = preg_replace("/SIP\//",'',$row[0]);
+				$station = preg_replace("/-.*/",'',$station);
+			
+				$LIVE_sessions[$live_calls_counter] =			"$session_id";
+				$LIVE_sessions_FORMAT[$live_calls_counter] =	sprintf("%-9s", $session_id);
+				$LIVE_stations[$live_calls_counter] =			"$station";
+				$LIVE_stations_FORMAT[$live_calls_counter] =	sprintf("%-10s", $station);
+
+		#		echo "| $station | $session_id | \n";
+
+				$live_calls_counter++;
+				}
+			else
+				{
+				if ($DB) {echo "NOT STATIONZ|$row[0]|$row[3]|\n";}
+				$session_id = '';
+				}
+			}
+
+		$i++;
+		}
+
+		if ($live_calls_counter > 0)
+		{
+		$i=0;
+		$LC_counter = $live_calls_counter;
+
+		while ($i < $live_calls_counter)
+			{
+			$stmt="select channel,extension,number_dialed,start_time,start_epoch from call_log where extension='$LIVE_stations[$i]' and server_ip='$server_ip' order by uniqueid desc LIMIT 1;";
+			$rslt=mysql_query($stmt, $link);
+			if ($DB) {echo "$stmt\n";}
+			$parked_to_print = mysql_num_rows($rslt);
+			$row=mysql_fetch_row($rslt);
+
+			$channel =			sprintf("%-9s", $row[0]);
+			$number_dialed =	sprintf("%-16s", $row[2]);
+			$start_time =		sprintf("%-19s", $row[3]);
+			$call_time_S = ($STARTtime - $row[4]);
+
+			$call_time_M = ($call_time_S / 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";
+			$call_time_MS =		sprintf("%7s", $call_time_MS);
+			$G = '';		$EG = '';
+			if ($call_time_M_int >= 12) {$G=''; $EG='';}
+			if ($call_time_M_int >= 31) {$G=''; $EG='';}
+
+			echo "| $G$LIVE_stations_FORMAT[$i]$EG | $G$LIVE_sessions_FORMAT[$i]$EG | $G$channel$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+			$i++;
+			}
+
+		echo "+------------+-----------+-----------+------------------+---------------------+---------+\n";
+		echo "  $i stations on live calls on server $server_ip\n\n";
+
+		echo "             - 12 minutes or more on live call\n";
+		echo "             - Over 30 minutes on live call\n";
+
+		}
+		else
+		{
+		echo "*****************************************************************************************\n";
+		echo "*****************************************************************************************\n";
+		echo "*************************************** NO LIVE STATIONS ********************************\n";
+		echo "*****************************************************************************************\n";
+		echo "*****************************************************************************************\n";
+		}
+
+	}
+	else
+	{
+	echo "*****************************************************************************************\n";
+	echo "*****************************************************************************************\n";
+	echo "*************************************** NO LIVE STATIONS ********************************\n";
+	echo "*****************************************************************************************\n";
+	echo "*****************************************************************************************\n";
+	}
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_timeonpark.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_timeonpark.php new file mode 100644 index 00000000..fd54a333 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/AST_timeonpark.php @@ -0,0 +1,219 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60620-1042 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["reset_counter"])) {$reset_counter=$_GET["reset_counter"];} + elseif (isset($_POST["reset_counter"])) {$reset_counter=$_POST["reset_counter"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +$timeONEhoursAGO = ($STARTtime - 3600); +$epochHALFhoursAGO = ($STARTtime - 1860); +$timeONEhoursAGO = date("Y-m-d H:i:s",$timeONEhoursAGO); +$timeHALFhoursAGO = date("Y-m-d H:i:s",$epochHALFhoursAGO); + +$reset_counter++; + +if ($reset_counter > 7) + { + $reset_counter=0; + + $stmt="update park_log set status='HUNGUP' where hangup_time is not null;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + + if ($DB) + { + $stmt="delete from park_log where status='TALKING' and grab_time < '$timeONEhoursAGO' and (hangup_time is null or hangup_time='');"; + $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + + $stmt="delete from park_log where status='PARKED' and parked_time < '$timeHALFhoursAGO' and (hangup_time is null or hangup_time='');"; + $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + + } + } + +?> + + + + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On Park\n"; +echo "
\n\n";
+
+echo "VICIDIAL: Time On Park         $NOW_TIME    REPORTS\n\n";
+echo "+------------+-----------------+---------------------+---------+\n";
+echo "| CHANNEL    | GROUP           | START TIME          | MINUTES |\n";
+echo "+------------+-----------------+---------------------+---------+\n";
+
+#$link=mysql_connect("localhost", "cron", "1234");
+# $linkX=mysql_connect("localhost", "cron", "1234");
+#mysql_select_db("asterisk");
+
+$stmt="select extension,user,channel,channel_group,parked_time,UNIX_TIMESTAMP(parked_time) from park_log where status ='PARKED' and server_ip='" . mysql_real_escape_string($server_ip) . "' order by uniqueid;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$parked_to_print = mysql_num_rows($rslt);
+	if ($parked_to_print > 0)
+	{
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$channel =			sprintf("%-10s", $row[2]);
+		$number_dialed =	sprintf("%-15s", $row[3]);
+		$start_time =		sprintf("%-19s", $row[4]);
+		$call_time_S = ($STARTtime - $row[5]);
+
+		$call_time_M = ($call_time_S / 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";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if ($call_time_M_int >= 1) {$G=''; $EG='';}
+		if ($call_time_M_int >= 6) {$G=''; $EG='';}
+
+		echo "| $G$channel$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------+-----------------+---------------------+---------+\n";
+		echo "  $i callers waiting on server $server_ip\n\n";
+
+		echo "             - 1 minute or more on hold\n";
+		echo "             - Over 5 minutes on hold\n";
+
+		}
+	else
+	{
+	echo "****************************************************************\n";
+	echo "****************************************************************\n";
+	echo "******************** NO LIVE CALLS WAITING *********************\n";
+	echo "****************************************************************\n";
+	echo "****************************************************************\n";
+	}
+
+###################################################################################
+###### TIME ON INBOUND CALLS
+###################################################################################
+echo "\n\n";
+echo "----------------------------------------------------------------------------------------";
+echo "\n\n";
+echo "VICIDIAL: Agents Time On Inbound Calls                             $NOW_TIME\n\n";
+echo "+------------|--------+------------+-----------------+---------------------+---------+\n";
+echo "| STATION    | USER   | CHANNEL    | GROUP           | START TIME          | MINUTES |\n";
+echo "+------------|--------+------------+-----------------+---------------------+---------+\n";
+
+
+$stmt="select extension,user,channel,channel_group,grab_time,UNIX_TIMESTAMP(grab_time) from park_log where status ='TALKING' and server_ip='" . mysql_real_escape_string($server_ip) . "' order by uniqueid;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$talking_to_print = mysql_num_rows($rslt);
+	if ($talking_to_print > 0)
+	{
+	$i=0;
+	while ($i < $talking_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$extension =		sprintf("%-10s", $row[0]);
+		$user =				sprintf("%-6s", $row[1]);
+		$channel =			sprintf("%-10s", $row[2]);
+		$number_dialed =	sprintf("%-15s", $row[3]);
+		$start_time =		sprintf("%-19s", $row[4]);
+		$call_time_S = ($STARTtime - $row[5]);
+
+		$call_time_M = ($call_time_S / 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";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if ($call_time_M_int >= 12) {$G=''; $EG='';}
+		if ($call_time_M_int >= 31) {$G=''; $EG='';}
+
+		echo "| $G$extension$EG | $G$user$EG | $G$channel$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------|--------+------------+-----------------+---------------------+---------+\n";
+		echo "  $i agents on calls on server $server_ip\n\n";
+
+		echo "             - 12 minutes or more on call\n";
+		echo "             - Over 30 minutes on call\n";
+
+	}
+	else
+	{
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	echo "********************************* NO AGENTS ON CALLS *********************************\n";
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	}
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/admin.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/admin.php new file mode 100644 index 00000000..7fc0228a --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/admin.php @@ -0,0 +1,13575 @@ + LICENSE: GPLv2 +# + + +require("dbconnect.php"); + + +###################################################################################################### +###################################################################################################### +####### static variable settings for display options +###################################################################################################### +###################################################################################################### + +$page_width='770'; +$section_width='720'; +$header_font_size='3'; +$subheader_font_size='2'; +$subcamp_font_size='2'; +$header_selected_bold=''; +$header_nonselected_bold=''; +$users_color = '#FFFF99'; +$campaigns_color = '#FFCC99'; +$lists_color = '#FFCCCC'; +$ingroups_color = '#CC99FF'; +$remoteagent_color ='#CCFFCC'; +$usergroups_color = '#CCFFFF'; +$scripts_color = '#99FFCC'; +$filters_color = '#CCCCCC'; +$admin_color = '#FF99FF'; +$reports_color = '#99FF33'; +#$users_color = '#FFFF99'; +#$campaigns_color = '#FFFF99'; +#$lists_color = '#FFFF99'; +#$ingroups_color = '#FFFF99'; +#$remoteagent_color ='#FFFF99'; +#$usergroups_color = '#FFFF99'; +#$scripts_color = '#FFFF99'; +#$filters_color = '#FFFF99'; +#$admin_color = '#FFFF99'; +#$reports_color = '#FFFF99'; + $times_color = '#FF33FF'; + $phones_color = '#FF33FF'; + $conference_color = '#FF33FF'; + $server_color = '#FF33FF'; + $settings_color = '#FF33FF'; + $status_color = '#FF33FF'; +$users_font = 'BLACK'; +$campaigns_font = 'BLACK'; +$lists_font = 'BLACK'; +$ingroups_font = 'BLACK'; +$remoteagent_font = 'BLACK'; +$usergroups_font = 'BLACK'; +$scripts_font = 'BLACK'; +$filters_font = 'BLACK'; +$admin_font = 'BLACK'; +$reports_font = 'BLACK'; + $times_font = 'BLACK'; + $phones_font = 'BLACK'; + $conference_font = 'BLACK'; + $server_font = 'BLACK'; + $settings_font = 'BLACK'; + $status_font = 'BLACK'; +$subcamp_color = '#FF9933'; +$subcamp_font = 'BLACK'; + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; + +###################################################################################################### +###################################################################################################### +####### Form variable declaration +###################################################################################################### +###################################################################################################### + + +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["active"])) {$active=$_GET["active"];} + elseif (isset($_POST["active"])) {$active=$_POST["active"];} +if (isset($_GET["adaptive_dl_diff_target"])) {$adaptive_dl_diff_target=$_GET["adaptive_dl_diff_target"];} + elseif (isset($_POST["adaptive_dl_diff_target"])) {$adaptive_dl_diff_target=$_POST["adaptive_dl_diff_target"];} +if (isset($_GET["adaptive_dropped_percentage"])) {$adaptive_dropped_percentage=$_GET["adaptive_dropped_percentage"];} + elseif (isset($_POST["adaptive_dropped_percentage"])){$adaptive_dropped_percentage=$_POST["adaptive_dropped_percentage"];} +if (isset($_GET["adaptive_intensity"])) {$adaptive_intensity=$_GET["adaptive_intensity"];} + elseif (isset($_POST["adaptive_intensity"])) {$adaptive_intensity=$_POST["adaptive_intensity"];} +if (isset($_GET["adaptive_latest_server_time"])) {$adaptive_latest_server_time=$_GET["adaptive_latest_server_time"];} + elseif (isset($_POST["adaptive_latest_server_time"])){$adaptive_latest_server_time=$_POST["adaptive_latest_server_time"];} +if (isset($_GET["adaptive_maximum_level"])) {$adaptive_maximum_level=$_GET["adaptive_maximum_level"];} + elseif (isset($_POST["adaptive_maximum_level"])) {$adaptive_maximum_level=$_POST["adaptive_maximum_level"];} +if (isset($_GET["SUB"])) {$SUB=$_GET["SUB"];} + elseif (isset($_POST["SUB"])) {$SUB=$_POST["SUB"];} +if (isset($_GET["ADD"])) {$ADD=$_GET["ADD"];} + elseif (isset($_POST["ADD"])) {$ADD=$_POST["ADD"];} +if (isset($_GET["admin_hangup_enabled"])) {$admin_hangup_enabled=$_GET["admin_hangup_enabled"];} + elseif (isset($_POST["admin_hangup_enabled"])) {$admin_hangup_enabled=$_POST["admin_hangup_enabled"];} +if (isset($_GET["admin_hijack_enabled"])) {$admin_hijack_enabled=$_GET["admin_hijack_enabled"];} + elseif (isset($_POST["admin_hijack_enabled"])) {$admin_hijack_enabled=$_POST["admin_hijack_enabled"];} +if (isset($_GET["admin_monitor_enabled"])) {$admin_monitor_enabled=$_GET["admin_monitor_enabled"];} + elseif (isset($_POST["admin_monitor_enabled"])) {$admin_monitor_enabled=$_POST["admin_monitor_enabled"];} +if (isset($_GET["AFLogging_enabled"])) {$AFLogging_enabled=$_GET["AFLogging_enabled"];} + elseif (isset($_POST["AFLogging_enabled"])) {$AFLogging_enabled=$_POST["AFLogging_enabled"];} +if (isset($_GET["agent_choose_ingroups"])) {$agent_choose_ingroups=$_GET["agent_choose_ingroups"];} + elseif (isset($_POST["agent_choose_ingroups"])) {$agent_choose_ingroups=$_POST["agent_choose_ingroups"];} +if (isset($_GET["agentcall_manual"])) {$agentcall_manual=$_GET["agentcall_manual"];} + elseif (isset($_POST["agentcall_manual"])) {$agentcall_manual=$_POST["agentcall_manual"];} +if (isset($_GET["agentonly_callbacks"])) {$agentonly_callbacks=$_GET["agentonly_callbacks"];} + elseif (isset($_POST["agentonly_callbacks"])) {$agentonly_callbacks=$_POST["agentonly_callbacks"];} +if (isset($_GET["AGI_call_logging_enabled"])) {$AGI_call_logging_enabled=$_GET["AGI_call_logging_enabled"];} + elseif (isset($_POST["AGI_call_logging_enabled"])) {$AGI_call_logging_enabled=$_POST["AGI_call_logging_enabled"];} +if (isset($_GET["agi_output"])) {$agi_output=$_GET["agi_output"];} + elseif (isset($_POST["agi_output"])) {$agi_output=$_POST["agi_output"];} +if (isset($_GET["allcalls_delay"])) {$allcalls_delay=$_GET["allcalls_delay"];} + elseif (isset($_POST["allcalls_delay"])) {$allcalls_delay=$_POST["allcalls_delay"];} +if (isset($_GET["allow_closers"])) {$allow_closers=$_GET["allow_closers"];} + elseif (isset($_POST["allow_closers"])) {$allow_closers=$_POST["allow_closers"];} +if (isset($_GET["alt_number_dialing"])) {$alt_number_dialing=$_GET["alt_number_dialing"];} + elseif (isset($_POST["alt_number_dialing"])) {$alt_number_dialing=$_POST["alt_number_dialing"];} +if (isset($_GET["alter_agent_interface_options"])) {$alter_agent_interface_options=$_GET["alter_agent_interface_options"];} + elseif (isset($_POST["alter_agent_interface_options"])) {$alter_agent_interface_options=$_POST["alter_agent_interface_options"];} +if (isset($_GET["am_message_exten"])) {$am_message_exten=$_GET["am_message_exten"];} + elseif (isset($_POST["am_message_exten"])) {$am_message_exten=$_POST["am_message_exten"];} +if (isset($_GET["amd_send_to_vmx"])) {$amd_send_to_vmx=$_GET["amd_send_to_vmx"];} + elseif (isset($_POST["amd_send_to_vmx"])) {$amd_send_to_vmx=$_POST["amd_send_to_vmx"];} +if (isset($_GET["answer_transfer_agent"])) {$answer_transfer_agent=$_GET["answer_transfer_agent"];} + elseif (isset($_POST["answer_transfer_agent"])) {$answer_transfer_agent=$_POST["answer_transfer_agent"];} +if (isset($_GET["ast_admin_access"])) {$ast_admin_access=$_GET["ast_admin_access"];} + elseif (isset($_POST["ast_admin_access"])) {$ast_admin_access=$_POST["ast_admin_access"];} +if (isset($_GET["ast_delete_phones"])) {$ast_delete_phones=$_GET["ast_delete_phones"];} + elseif (isset($_POST["ast_delete_phones"])) {$ast_delete_phones=$_POST["ast_delete_phones"];} +if (isset($_GET["asterisk_version"])) {$asterisk_version=$_GET["asterisk_version"];} + elseif (isset($_POST["asterisk_version"])) {$asterisk_version=$_POST["asterisk_version"];} +if (isset($_GET["ASTmgrSECRET"])) {$ASTmgrSECRET=$_GET["ASTmgrSECRET"];} + elseif (isset($_POST["ASTmgrSECRET"])) {$ASTmgrSECRET=$_POST["ASTmgrSECRET"];} +if (isset($_GET["ASTmgrUSERNAME"])) {$ASTmgrUSERNAME=$_GET["ASTmgrUSERNAME"];} + elseif (isset($_POST["ASTmgrUSERNAME"])) {$ASTmgrUSERNAME=$_POST["ASTmgrUSERNAME"];} +if (isset($_GET["ASTmgrUSERNAMElisten"])) {$ASTmgrUSERNAMElisten=$_GET["ASTmgrUSERNAMElisten"];} + elseif (isset($_POST["ASTmgrUSERNAMElisten"])) {$ASTmgrUSERNAMElisten=$_POST["ASTmgrUSERNAMElisten"];} +if (isset($_GET["ASTmgrUSERNAMEsend"])) {$ASTmgrUSERNAMEsend=$_GET["ASTmgrUSERNAMEsend"];} + elseif (isset($_POST["ASTmgrUSERNAMEsend"])) {$ASTmgrUSERNAMEsend=$_POST["ASTmgrUSERNAMEsend"];} +if (isset($_GET["ASTmgrUSERNAMEupdate"])) {$ASTmgrUSERNAMEupdate=$_GET["ASTmgrUSERNAMEupdate"];} + elseif (isset($_POST["ASTmgrUSERNAMEupdate"])) {$ASTmgrUSERNAMEupdate=$_POST["ASTmgrUSERNAMEupdate"];} +if (isset($_GET["attempt_delay"])) {$attempt_delay=$_GET["attempt_delay"];} + elseif (isset($_POST["attempt_delay"])) {$attempt_delay=$_POST["attempt_delay"];} +if (isset($_GET["attempt_maximum"])) {$attempt_maximum=$_GET["attempt_maximum"];} + elseif (isset($_POST["attempt_maximum"])) {$attempt_maximum=$_POST["attempt_maximum"];} +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["auto_dial_next_number"])) {$auto_dial_next_number=$_GET["auto_dial_next_number"];} + elseif (isset($_POST["auto_dial_next_number"])) {$auto_dial_next_number=$_POST["auto_dial_next_number"];} +if (isset($_GET["available_only_ratio_tally"])) {$available_only_ratio_tally=$_GET["available_only_ratio_tally"];} + elseif (isset($_POST["available_only_ratio_tally"])){$available_only_ratio_tally=$_POST["available_only_ratio_tally"];} +if (isset($_GET["call_out_number_group"])) {$call_out_number_group=$_GET["call_out_number_group"];} + elseif (isset($_POST["call_out_number_group"])) {$call_out_number_group=$_POST["call_out_number_group"];} +if (isset($_GET["call_parking_enabled"])) {$call_parking_enabled=$_GET["call_parking_enabled"];} + elseif (isset($_POST["call_parking_enabled"])) {$call_parking_enabled=$_POST["call_parking_enabled"];} +if (isset($_GET["call_time_comments"])) {$call_time_comments=$_GET["call_time_comments"];} + elseif (isset($_POST["call_time_comments"])) {$call_time_comments=$_POST["call_time_comments"];} +if (isset($_GET["call_time_id"])) {$call_time_id=$_GET["call_time_id"];} + elseif (isset($_POST["call_time_id"])) {$call_time_id=$_POST["call_time_id"];} +if (isset($_GET["call_time_name"])) {$call_time_name=$_GET["call_time_name"];} + elseif (isset($_POST["call_time_name"])) {$call_time_name=$_POST["call_time_name"];} +if (isset($_GET["CallerID_popup_enabled"])) {$CallerID_popup_enabled=$_GET["CallerID_popup_enabled"];} + elseif (isset($_POST["CallerID_popup_enabled"])) {$CallerID_popup_enabled=$_POST["CallerID_popup_enabled"];} +if (isset($_GET["campaign_cid"])) {$campaign_cid=$_GET["campaign_cid"];} + elseif (isset($_POST["campaign_cid"])) {$campaign_cid=$_POST["campaign_cid"];} +if (isset($_GET["campaign_detail"])) {$campaign_detail=$_GET["campaign_detail"];} + elseif (isset($_POST["campaign_detail"])) {$campaign_detail=$_POST["campaign_detail"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["campaign_name"])) {$campaign_name=$_GET["campaign_name"];} + elseif (isset($_POST["campaign_name"])) {$campaign_name=$_POST["campaign_name"];} +if (isset($_GET["campaign_rec_exten"])) {$campaign_rec_exten=$_GET["campaign_rec_exten"];} + elseif (isset($_POST["campaign_rec_exten"])) {$campaign_rec_exten=$_POST["campaign_rec_exten"];} +if (isset($_GET["campaign_rec_filename"])) {$campaign_rec_filename=$_GET["campaign_rec_filename"];} + elseif (isset($_POST["campaign_rec_filename"])) {$campaign_rec_filename=$_POST["campaign_rec_filename"];} +if (isset($_GET["campaign_recording"])) {$campaign_recording=$_GET["campaign_recording"];} + elseif (isset($_POST["campaign_recording"])) {$campaign_recording=$_POST["campaign_recording"];} +if (isset($_GET["campaign_vdad_exten"])) {$campaign_vdad_exten=$_GET["campaign_vdad_exten"];} + elseif (isset($_POST["campaign_vdad_exten"])) {$campaign_vdad_exten=$_POST["campaign_vdad_exten"];} +if (isset($_GET["change_agent_campaign"])) {$change_agent_campaign=$_GET["change_agent_campaign"];} + elseif (isset($_POST["change_agent_campaign"])) {$change_agent_campaign=$_POST["change_agent_campaign"];} +if (isset($_GET["client_browser"])) {$client_browser=$_GET["client_browser"];} + elseif (isset($_POST["client_browser"])) {$client_browser=$_POST["client_browser"];} +if (isset($_GET["closer_default_blended"])) {$closer_default_blended=$_GET["closer_default_blended"];} + elseif (isset($_POST["closer_default_blended"])) {$closer_default_blended=$_POST["closer_default_blended"];} +if (isset($_GET["company"])) {$company=$_GET["company"];} + elseif (isset($_POST["company"])) {$company=$_POST["company"];} +if (isset($_GET["computer_ip"])) {$computer_ip=$_GET["computer_ip"];} + elseif (isset($_POST["computer_ip"])) {$computer_ip=$_POST["computer_ip"];} +if (isset($_GET["conf_exten"])) {$conf_exten=$_GET["conf_exten"];} + elseif (isset($_POST["conf_exten"])) {$conf_exten=$_POST["conf_exten"];} +if (isset($_GET["conf_on_extension"])) {$conf_on_extension=$_GET["conf_on_extension"];} + elseif (isset($_POST["conf_on_extension"])) {$conf_on_extension=$_POST["conf_on_extension"];} +if (isset($_GET["conferencing_enabled"])) {$conferencing_enabled=$_GET["conferencing_enabled"];} + elseif (isset($_POST["conferencing_enabled"])) {$conferencing_enabled=$_POST["conferencing_enabled"];} +if (isset($_GET["CoNfIrM"])) {$CoNfIrM=$_GET["CoNfIrM"];} + elseif (isset($_POST["CoNfIrM"])) {$CoNfIrM=$_POST["CoNfIrM"];} +if (isset($_GET["ct_default_start"])) {$ct_default_start=$_GET["ct_default_start"];} + elseif (isset($_POST["ct_default_start"])) {$ct_default_start=$_POST["ct_default_start"];} +if (isset($_GET["ct_default_stop"])) {$ct_default_stop=$_GET["ct_default_stop"];} + elseif (isset($_POST["ct_default_stop"])) {$ct_default_stop=$_POST["ct_default_stop"];} +if (isset($_GET["ct_friday_start"])) {$ct_friday_start=$_GET["ct_friday_start"];} + elseif (isset($_POST["ct_friday_start"])) {$ct_friday_start=$_POST["ct_friday_start"];} +if (isset($_GET["ct_friday_stop"])) {$ct_friday_stop=$_GET["ct_friday_stop"];} + elseif (isset($_POST["ct_friday_stop"])) {$ct_friday_stop=$_POST["ct_friday_stop"];} +if (isset($_GET["ct_monday_start"])) {$ct_monday_start=$_GET["ct_monday_start"];} + elseif (isset($_POST["ct_monday_start"])) {$ct_monday_start=$_POST["ct_monday_start"];} +if (isset($_GET["ct_monday_stop"])) {$ct_monday_stop=$_GET["ct_monday_stop"];} + elseif (isset($_POST["ct_monday_stop"])) {$ct_monday_stop=$_POST["ct_monday_stop"];} +if (isset($_GET["ct_saturday_start"])) {$ct_saturday_start=$_GET["ct_saturday_start"];} + elseif (isset($_POST["ct_saturday_start"])) {$ct_saturday_start=$_POST["ct_saturday_start"];} +if (isset($_GET["ct_saturday_stop"])) {$ct_saturday_stop=$_GET["ct_saturday_stop"];} + elseif (isset($_POST["ct_saturday_stop"])) {$ct_saturday_stop=$_POST["ct_saturday_stop"];} +if (isset($_GET["ct_sunday_start"])) {$ct_sunday_start=$_GET["ct_sunday_start"];} + elseif (isset($_POST["ct_sunday_start"])) {$ct_sunday_start=$_POST["ct_sunday_start"];} +if (isset($_GET["ct_sunday_stop"])) {$ct_sunday_stop=$_GET["ct_sunday_stop"];} + elseif (isset($_POST["ct_sunday_stop"])) {$ct_sunday_stop=$_POST["ct_sunday_stop"];} +if (isset($_GET["ct_thursday_start"])) {$ct_thursday_start=$_GET["ct_thursday_start"];} + elseif (isset($_POST["ct_thursday_start"])) {$ct_thursday_start=$_POST["ct_thursday_start"];} +if (isset($_GET["ct_thursday_stop"])) {$ct_thursday_stop=$_GET["ct_thursday_stop"];} + elseif (isset($_POST["ct_thursday_stop"])) {$ct_thursday_stop=$_POST["ct_thursday_stop"];} +if (isset($_GET["ct_tuesday_start"])) {$ct_tuesday_start=$_GET["ct_tuesday_start"];} + elseif (isset($_POST["ct_tuesday_start"])) {$ct_tuesday_start=$_POST["ct_tuesday_start"];} +if (isset($_GET["ct_tuesday_stop"])) {$ct_tuesday_stop=$_GET["ct_tuesday_stop"];} + elseif (isset($_POST["ct_tuesday_stop"])) {$ct_tuesday_stop=$_POST["ct_tuesday_stop"];} +if (isset($_GET["ct_wednesday_start"])) {$ct_wednesday_start=$_GET["ct_wednesday_start"];} + elseif (isset($_POST["ct_wednesday_start"])) {$ct_wednesday_start=$_POST["ct_wednesday_start"];} +if (isset($_GET["ct_wednesday_stop"])) {$ct_wednesday_stop=$_GET["ct_wednesday_stop"];} + elseif (isset($_POST["ct_wednesday_stop"])) {$ct_wednesday_stop=$_POST["ct_wednesday_stop"];} +if (isset($_GET["DBX_database"])) {$DBX_database=$_GET["DBX_database"];} + elseif (isset($_POST["DBX_database"])) {$DBX_database=$_POST["DBX_database"];} +if (isset($_GET["DBX_pass"])) {$DBX_pass=$_GET["DBX_pass"];} + elseif (isset($_POST["DBX_pass"])) {$DBX_pass=$_POST["DBX_pass"];} +if (isset($_GET["DBX_port"])) {$DBX_port=$_GET["DBX_port"];} + elseif (isset($_POST["DBX_port"])) {$DBX_port=$_POST["DBX_port"];} +if (isset($_GET["DBX_server"])) {$DBX_server=$_GET["DBX_server"];} + elseif (isset($_POST["DBX_server"])) {$DBX_server=$_POST["DBX_server"];} +if (isset($_GET["DBX_user"])) {$DBX_user=$_GET["DBX_user"];} + elseif (isset($_POST["DBX_user"])) {$DBX_user=$_POST["DBX_user"];} +if (isset($_GET["DBY_database"])) {$DBY_database=$_GET["DBY_database"];} + elseif (isset($_POST["DBY_database"])) {$DBY_database=$_POST["DBY_database"];} +if (isset($_GET["DBY_pass"])) {$DBY_pass=$_GET["DBY_pass"];} + elseif (isset($_POST["DBY_pass"])) {$DBY_pass=$_POST["DBY_pass"];} +if (isset($_GET["DBY_port"])) {$DBY_port=$_GET["DBY_port"];} + elseif (isset($_POST["DBY_port"])) {$DBY_port=$_POST["DBY_port"];} +if (isset($_GET["DBY_server"])) {$DBY_server=$_GET["DBY_server"];} + elseif (isset($_POST["DBY_server"])) {$DBY_server=$_POST["DBY_server"];} +if (isset($_GET["DBY_user"])) {$DBY_user=$_GET["DBY_user"];} + elseif (isset($_POST["DBY_user"])) {$DBY_user=$_POST["DBY_user"];} +if (isset($_GET["delete_call_times"])) {$delete_call_times=$_GET["delete_call_times"];} + elseif (isset($_POST["delete_call_times"])) {$delete_call_times=$_POST["delete_call_times"];} +if (isset($_GET["delete_campaigns"])) {$delete_campaigns=$_GET["delete_campaigns"];} + elseif (isset($_POST["delete_campaigns"])) {$delete_campaigns=$_POST["delete_campaigns"];} +if (isset($_GET["delete_filters"])) {$delete_filters=$_GET["delete_filters"];} + elseif (isset($_POST["delete_filters"])) {$delete_filters=$_POST["delete_filters"];} +if (isset($_GET["delete_ingroups"])) {$delete_ingroups=$_GET["delete_ingroups"];} + elseif (isset($_POST["delete_ingroups"])) {$delete_ingroups=$_POST["delete_ingroups"];} +if (isset($_GET["delete_lists"])) {$delete_lists=$_GET["delete_lists"];} + elseif (isset($_POST["delete_lists"])) {$delete_lists=$_POST["delete_lists"];} +if (isset($_GET["delete_remote_agents"])) {$delete_remote_agents=$_GET["delete_remote_agents"];} + elseif (isset($_POST["delete_remote_agents"])) {$delete_remote_agents=$_POST["delete_remote_agents"];} +if (isset($_GET["delete_scripts"])) {$delete_scripts=$_GET["delete_scripts"];} + elseif (isset($_POST["delete_scripts"])) {$delete_scripts=$_POST["delete_scripts"];} +if (isset($_GET["delete_user_groups"])) {$delete_user_groups=$_GET["delete_user_groups"];} + elseif (isset($_POST["delete_user_groups"])) {$delete_user_groups=$_POST["delete_user_groups"];} +if (isset($_GET["delete_users"])) {$delete_users=$_GET["delete_users"];} + elseif (isset($_POST["delete_users"])) {$delete_users=$_POST["delete_users"];} +if (isset($_GET["dial_method"])) {$dial_method=$_GET["dial_method"];} + elseif (isset($_POST["dial_method"])) {$dial_method=$_POST["dial_method"];} +if (isset($_GET["dial_prefix"])) {$dial_prefix=$_GET["dial_prefix"];} + elseif (isset($_POST["dial_prefix"])) {$dial_prefix=$_POST["dial_prefix"];} +if (isset($_GET["dial_status_a"])) {$dial_status_a=$_GET["dial_status_a"];} + elseif (isset($_POST["dial_status_a"])) {$dial_status_a=$_POST["dial_status_a"];} +if (isset($_GET["dial_status_b"])) {$dial_status_b=$_GET["dial_status_b"];} + elseif (isset($_POST["dial_status_b"])) {$dial_status_b=$_POST["dial_status_b"];} +if (isset($_GET["dial_status_c"])) {$dial_status_c=$_GET["dial_status_c"];} + elseif (isset($_POST["dial_status_c"])) {$dial_status_c=$_POST["dial_status_c"];} +if (isset($_GET["dial_status_d"])) {$dial_status_d=$_GET["dial_status_d"];} + elseif (isset($_POST["dial_status_d"])) {$dial_status_d=$_POST["dial_status_d"];} +if (isset($_GET["dial_status_e"])) {$dial_status_e=$_GET["dial_status_e"];} + elseif (isset($_POST["dial_status_e"])) {$dial_status_e=$_POST["dial_status_e"];} +if (isset($_GET["dial_timeout"])) {$dial_timeout=$_GET["dial_timeout"];} + elseif (isset($_POST["dial_timeout"])) {$dial_timeout=$_POST["dial_timeout"];} +if (isset($_GET["dialplan_number"])) {$dialplan_number=$_GET["dialplan_number"];} + elseif (isset($_POST["dialplan_number"])) {$dialplan_number=$_POST["dialplan_number"];} +if (isset($_GET["drop_call_seconds"])) {$drop_call_seconds=$_GET["drop_call_seconds"];} + elseif (isset($_POST["drop_call_seconds"])) {$drop_call_seconds=$_POST["drop_call_seconds"];} +if (isset($_GET["drop_exten"])) {$drop_exten=$_GET["drop_exten"];} + elseif (isset($_POST["drop_exten"])) {$drop_exten=$_POST["drop_exten"];} +if (isset($_GET["drop_message"])) {$drop_message=$_GET["drop_message"];} + elseif (isset($_POST["drop_message"])) {$drop_message=$_POST["drop_message"];} +if (isset($_GET["dtmf_send_extension"])) {$dtmf_send_extension=$_GET["dtmf_send_extension"];} + elseif (isset($_POST["dtmf_send_extension"])) {$dtmf_send_extension=$_POST["dtmf_send_extension"];} +if (isset($_GET["enable_fast_refresh"])) {$enable_fast_refresh=$_GET["enable_fast_refresh"];} + elseif (isset($_POST["enable_fast_refresh"])) {$enable_fast_refresh=$_POST["enable_fast_refresh"];} +if (isset($_GET["enable_persistant_mysql"])) {$enable_persistant_mysql=$_GET["enable_persistant_mysql"];} + elseif (isset($_POST["enable_persistant_mysql"])) {$enable_persistant_mysql=$_POST["enable_persistant_mysql"];} +if (isset($_GET["ext_context"])) {$ext_context=$_GET["ext_context"];} + elseif (isset($_POST["ext_context"])) {$ext_context=$_POST["ext_context"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["fast_refresh_rate"])) {$fast_refresh_rate=$_GET["fast_refresh_rate"];} + elseif (isset($_POST["fast_refresh_rate"])) {$fast_refresh_rate=$_POST["fast_refresh_rate"];} +if (isset($_GET["force_logout"])) {$force_logout=$_GET["force_logout"];} + elseif (isset($_POST["force_logout"])) {$force_logout=$_POST["force_logout"];} +if (isset($_GET["fronter_display"])) {$fronter_display=$_GET["fronter_display"];} + elseif (isset($_POST["fronter_display"])) {$fronter_display=$_POST["fronter_display"];} +if (isset($_GET["full_name"])) {$full_name=$_GET["full_name"];} + elseif (isset($_POST["full_name"])) {$full_name=$_POST["full_name"];} +if (isset($_GET["fullname"])) {$fullname=$_GET["fullname"];} + elseif (isset($_POST["fullname"])) {$fullname=$_POST["fullname"];} +if (isset($_GET["get_call_launch"])) {$get_call_launch=$_GET["get_call_launch"];} + elseif (isset($_POST["get_call_launch"])) {$get_call_launch=$_POST["get_call_launch"];} +if (isset($_GET["group_color"])) {$group_color=$_GET["group_color"];} + elseif (isset($_POST["group_color"])) {$group_color=$_POST["group_color"];} +if (isset($_GET["group_id"])) {$group_id=$_GET["group_id"];} + elseif (isset($_POST["group_id"])) {$group_id=$_POST["group_id"];} +if (isset($_GET["group_name"])) {$group_name=$_GET["group_name"];} + elseif (isset($_POST["group_name"])) {$group_name=$_POST["group_name"];} +if (isset($_GET["groups"])) {$groups=$_GET["groups"];} + elseif (isset($_POST["groups"])) {$groups=$_POST["groups"];} +if (isset($_GET["XFERgroups"])) {$XFERgroups=$_GET["XFERgroups"];} + elseif (isset($_POST["XFERgroups"])) {$XFERgroups=$_POST["XFERgroups"];} +if (isset($_GET["HKstatus"])) {$HKstatus=$_GET["HKstatus"];} + elseif (isset($_POST["HKstatus"])) {$HKstatus=$_POST["HKstatus"];} +if (isset($_GET["hopper_level"])) {$hopper_level=$_GET["hopper_level"];} + elseif (isset($_POST["hopper_level"])) {$hopper_level=$_POST["hopper_level"];} +if (isset($_GET["hotkey"])) {$hotkey=$_GET["hotkey"];} + elseif (isset($_POST["hotkey"])) {$hotkey=$_POST["hotkey"];} +if (isset($_GET["hotkeys_active"])) {$hotkeys_active=$_GET["hotkeys_active"];} + elseif (isset($_POST["hotkeys_active"])) {$hotkeys_active=$_POST["hotkeys_active"];} +if (isset($_GET["install_directory"])) {$install_directory=$_GET["install_directory"];} + elseif (isset($_POST["install_directory"])) {$install_directory=$_POST["install_directory"];} +if (isset($_GET["lead_filter_comments"])) {$lead_filter_comments=$_GET["lead_filter_comments"];} + elseif (isset($_POST["lead_filter_comments"])) {$lead_filter_comments=$_POST["lead_filter_comments"];} +if (isset($_GET["lead_filter_id"])) {$lead_filter_id=$_GET["lead_filter_id"];} + elseif (isset($_POST["lead_filter_id"])) {$lead_filter_id=$_POST["lead_filter_id"];} +if (isset($_GET["lead_filter_name"])) {$lead_filter_name=$_GET["lead_filter_name"];} + elseif (isset($_POST["lead_filter_name"])) {$lead_filter_name=$_POST["lead_filter_name"];} +if (isset($_GET["lead_filter_sql"])) {$lead_filter_sql=$_GET["lead_filter_sql"];} + elseif (isset($_POST["lead_filter_sql"])) {$lead_filter_sql=$_POST["lead_filter_sql"];} +if (isset($_GET["lead_order"])) {$lead_order=$_GET["lead_order"];} + elseif (isset($_POST["lead_order"])) {$lead_order=$_POST["lead_order"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["list_name"])) {$list_name=$_GET["list_name"];} + elseif (isset($_POST["list_name"])) {$list_name=$_POST["list_name"];} +if (isset($_GET["load_leads"])) {$load_leads=$_GET["load_leads"];} + elseif (isset($_POST["load_leads"])) {$load_leads=$_POST["load_leads"];} +if (isset($_GET["local_call_time"])) {$local_call_time=$_GET["local_call_time"];} + elseif (isset($_POST["local_call_time"])) {$local_call_time=$_POST["local_call_time"];} +if (isset($_GET["local_gmt"])) {$local_gmt=$_GET["local_gmt"];} + elseif (isset($_POST["local_gmt"])) {$local_gmt=$_POST["local_gmt"];} +if (isset($_GET["local_web_callerID_URL"])) {$local_web_callerID_URL=$_GET["local_web_callerID_URL"];} + elseif (isset($_POST["local_web_callerID_URL"])) {$local_web_callerID_URL=$_POST["local_web_callerID_URL"];} +if (isset($_GET["login"])) {$login=$_GET["login"];} + elseif (isset($_POST["login"])) {$login=$_POST["login"];} +if (isset($_GET["login_campaign"])) {$login_campaign=$_GET["login_campaign"];} + elseif (isset($_POST["login_campaign"])) {$login_campaign=$_POST["login_campaign"];} +if (isset($_GET["login_pass"])) {$login_pass=$_GET["login_pass"];} + elseif (isset($_POST["login_pass"])) {$login_pass=$_POST["login_pass"];} +if (isset($_GET["login_user"])) {$login_user=$_GET["login_user"];} + elseif (isset($_POST["login_user"])) {$login_user=$_POST["login_user"];} +if (isset($_GET["max_vicidial_trunks"])) {$max_vicidial_trunks=$_GET["max_vicidial_trunks"];} + elseif (isset($_POST["max_vicidial_trunks"])) {$max_vicidial_trunks=$_POST["max_vicidial_trunks"];} +if (isset($_GET["modify_call_times"])) {$modify_call_times=$_GET["modify_call_times"];} + elseif (isset($_POST["modify_call_times"])) {$modify_call_times=$_POST["modify_call_times"];} +if (isset($_GET["modify_leads"])) {$modify_leads=$_GET["modify_leads"];} + elseif (isset($_POST["modify_leads"])) {$modify_leads=$_POST["modify_leads"];} +if (isset($_GET["monitor_prefix"])) {$monitor_prefix=$_GET["monitor_prefix"];} + elseif (isset($_POST["monitor_prefix"])) {$monitor_prefix=$_POST["monitor_prefix"];} +if (isset($_GET["next_agent_call"])) {$next_agent_call=$_GET["next_agent_call"];} + elseif (isset($_POST["next_agent_call"])) {$next_agent_call=$_POST["next_agent_call"];} +if (isset($_GET["number_of_lines"])) {$number_of_lines=$_GET["number_of_lines"];} + elseif (isset($_POST["number_of_lines"])) {$number_of_lines=$_POST["number_of_lines"];} +if (isset($_GET["old_campaign_id"])) {$old_campaign_id=$_GET["old_campaign_id"];} + elseif (isset($_POST["old_campaign_id"])) {$old_campaign_id=$_POST["old_campaign_id"];} +if (isset($_GET["old_conf_exten"])) {$old_conf_exten=$_GET["old_conf_exten"];} + elseif (isset($_POST["old_conf_exten"])) {$old_conf_exten=$_POST["old_conf_exten"];} +if (isset($_GET["old_extension"])) {$old_extension=$_GET["old_extension"];} + elseif (isset($_POST["old_extension"])) {$old_extension=$_POST["old_extension"];} +if (isset($_GET["old_server_id"])) {$old_server_id=$_GET["old_server_id"];} + elseif (isset($_POST["old_server_id"])) {$old_server_id=$_POST["old_server_id"];} +if (isset($_GET["old_server_ip"])) {$old_server_ip=$_GET["old_server_ip"];} + elseif (isset($_POST["old_server_ip"])) {$old_server_ip=$_POST["old_server_ip"];} +if (isset($_GET["OLDuser_group"])) {$OLDuser_group=$_GET["OLDuser_group"];} + elseif (isset($_POST["OLDuser_group"])) {$OLDuser_group=$_POST["OLDuser_group"];} +if (isset($_GET["omit_phone_code"])) {$omit_phone_code=$_GET["omit_phone_code"];} + elseif (isset($_POST["omit_phone_code"])) {$omit_phone_code=$_POST["omit_phone_code"];} +if (isset($_GET["outbound_cid"])) {$outbound_cid=$_GET["outbound_cid"];} + elseif (isset($_POST["outbound_cid"])) {$outbound_cid=$_POST["outbound_cid"];} +if (isset($_GET["park_ext"])) {$park_ext=$_GET["park_ext"];} + elseif (isset($_POST["park_ext"])) {$park_ext=$_POST["park_ext"];} +if (isset($_GET["park_file_name"])) {$park_file_name=$_GET["park_file_name"];} + elseif (isset($_POST["park_file_name"])) {$park_file_name=$_POST["park_file_name"];} +if (isset($_GET["park_on_extension"])) {$park_on_extension=$_GET["park_on_extension"];} + elseif (isset($_POST["park_on_extension"])) {$park_on_extension=$_POST["park_on_extension"];} +if (isset($_GET["pass"])) {$pass=$_GET["pass"];} + elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];} +if (isset($_GET["phone_ip"])) {$phone_ip=$_GET["phone_ip"];} + elseif (isset($_POST["phone_ip"])) {$phone_ip=$_POST["phone_ip"];} +if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];} + elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];} +if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];} + elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];} +if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];} + elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];} +if (isset($_GET["phone_type"])) {$phone_type=$_GET["phone_type"];} + elseif (isset($_POST["phone_type"])) {$phone_type=$_POST["phone_type"];} +if (isset($_GET["picture"])) {$picture=$_GET["picture"];} + elseif (isset($_POST["picture"])) {$picture=$_POST["picture"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} +if (isset($_GET["QUEUE_ACTION_enabled"])) {$QUEUE_ACTION_enabled=$_GET["QUEUE_ACTION_enabled"];} + elseif (isset($_POST["QUEUE_ACTION_enabled"])) {$QUEUE_ACTION_enabled=$_POST["QUEUE_ACTION_enabled"];} +if (isset($_GET["recording_exten"])) {$recording_exten=$_GET["recording_exten"];} + elseif (isset($_POST["recording_exten"])) {$recording_exten=$_POST["recording_exten"];} +if (isset($_GET["remote_agent_id"])) {$remote_agent_id=$_GET["remote_agent_id"];} + elseif (isset($_POST["remote_agent_id"])) {$remote_agent_id=$_POST["remote_agent_id"];} +if (isset($_GET["reset_hopper"])) {$reset_hopper=$_GET["reset_hopper"];} + elseif (isset($_POST["reset_hopper"])) {$reset_hopper=$_POST["reset_hopper"];} +if (isset($_GET["reset_list"])) {$reset_list=$_GET["reset_list"];} + elseif (isset($_POST["reset_list"])) {$reset_list=$_POST["reset_list"];} +if (isset($_GET["safe_harbor_exten"])) {$safe_harbor_exten=$_GET["safe_harbor_exten"];} + elseif (isset($_POST["safe_harbor_exten"])) {$safe_harbor_exten=$_POST["safe_harbor_exten"];} +if (isset($_GET["safe_harbor_message"])) {$safe_harbor_message=$_GET["safe_harbor_message"];} + elseif (isset($_POST["safe_harbor_message"])) {$safe_harbor_message=$_POST["safe_harbor_message"];} +if (isset($_GET["scheduled_callbacks"])) {$scheduled_callbacks=$_GET["scheduled_callbacks"];} + elseif (isset($_POST["scheduled_callbacks"])) {$scheduled_callbacks=$_POST["scheduled_callbacks"];} +if (isset($_GET["script_comments"])) {$script_comments=$_GET["script_comments"];} + elseif (isset($_POST["script_comments"])) {$script_comments=$_POST["script_comments"];} +if (isset($_GET["script_id"])) {$script_id=$_GET["script_id"];} + elseif (isset($_POST["script_id"])) {$script_id=$_POST["script_id"];} +if (isset($_GET["script_name"])) {$script_name=$_GET["script_name"];} + elseif (isset($_POST["script_name"])) {$script_name=$_POST["script_name"];} +if (isset($_GET["script_text"])) {$script_text=$_GET["script_text"];} + elseif (isset($_POST["script_text"])) {$script_text=$_POST["script_text"];} +if (isset($_GET["selectable"])) {$selectable=$_GET["selectable"];} + elseif (isset($_POST["selectable"])) {$selectable=$_POST["selectable"];} +if (isset($_GET["server_description"])) {$server_description=$_GET["server_description"];} + elseif (isset($_POST["server_description"])) {$server_description=$_POST["server_description"];} +if (isset($_GET["server_id"])) {$server_id=$_GET["server_id"];} + elseif (isset($_POST["server_id"])) {$server_id=$_POST["server_id"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["state_call_time_state"])) {$state_call_time_state=$_GET["state_call_time_state"];} + elseif (isset($_POST["state_call_time_state"])) {$state_call_time_state=$_POST["state_call_time_state"];} +if (isset($_GET["state_rule"])) {$state_rule=$_GET["state_rule"];} + elseif (isset($_POST["state_rule"])) {$state_rule=$_POST["state_rule"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["status_name"])) {$status_name=$_GET["status_name"];} + elseif (isset($_POST["status_name"])) {$status_name=$_POST["status_name"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["sys_perf_log"])) {$sys_perf_log=$_GET["sys_perf_log"];} + elseif (isset($_POST["sys_perf_log"])) {$sys_perf_log=$_POST["sys_perf_log"];} +if (isset($_GET["telnet_host"])) {$telnet_host=$_GET["telnet_host"];} + elseif (isset($_POST["telnet_host"])) {$telnet_host=$_POST["telnet_host"];} +if (isset($_GET["telnet_port"])) {$telnet_port=$_GET["telnet_port"];} + elseif (isset($_POST["telnet_port"])) {$telnet_port=$_POST["telnet_port"];} +if (isset($_GET["updater_check_enabled"])) {$updater_check_enabled=$_GET["updater_check_enabled"];} + elseif (isset($_POST["updater_check_enabled"])) {$updater_check_enabled=$_POST["updater_check_enabled"];} +if (isset($_GET["use_internal_dnc"])) {$use_internal_dnc=$_GET["use_internal_dnc"];} + elseif (isset($_POST["use_internal_dnc"])) {$use_internal_dnc=$_POST["use_internal_dnc"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["user_group"])) {$user_group=$_GET["user_group"];} + elseif (isset($_POST["user_group"])) {$user_group=$_POST["user_group"];} +if (isset($_GET["user_level"])) {$user_level=$_GET["user_level"];} + elseif (isset($_POST["user_level"])) {$user_level=$_POST["user_level"];} +if (isset($_GET["user_start"])) {$user_start=$_GET["user_start"];} + elseif (isset($_POST["user_start"])) {$user_start=$_POST["user_start"];} +if (isset($_GET["user_switching_enabled"])) {$user_switching_enabled=$_GET["user_switching_enabled"];} + elseif (isset($_POST["user_switching_enabled"])) {$user_switching_enabled=$_POST["user_switching_enabled"];} +if (isset($_GET["vd_server_logs"])) {$vd_server_logs=$_GET["vd_server_logs"];} + elseif (isset($_POST["vd_server_logs"])) {$vd_server_logs=$_POST["vd_server_logs"];} +if (isset($_GET["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_GET["VDstop_rec_after_each_call"];} + elseif (isset($_POST["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_POST["VDstop_rec_after_each_call"];} +if (isset($_GET["VICIDIAL_park_on_extension"])) {$VICIDIAL_park_on_extension=$_GET["VICIDIAL_park_on_extension"];} + elseif (isset($_POST["VICIDIAL_park_on_extension"])) {$VICIDIAL_park_on_extension=$_POST["VICIDIAL_park_on_extension"];} +if (isset($_GET["VICIDIAL_park_on_filename"])) {$VICIDIAL_park_on_filename=$_GET["VICIDIAL_park_on_filename"];} + elseif (isset($_POST["VICIDIAL_park_on_filename"])) {$VICIDIAL_park_on_filename=$_POST["VICIDIAL_park_on_filename"];} +if (isset($_GET["vicidial_recording"])) {$vicidial_recording=$_GET["vicidial_recording"];} + elseif (isset($_POST["vicidial_recording"])) {$vicidial_recording=$_POST["vicidial_recording"];} +if (isset($_GET["vicidial_transfers"])) {$vicidial_transfers=$_GET["vicidial_transfers"];} + elseif (isset($_POST["vicidial_transfers"])) {$vicidial_transfers=$_POST["vicidial_transfers"];} +if (isset($_GET["VICIDIAL_web_URL"])) {$VICIDIAL_web_URL=$_GET["VICIDIAL_web_URL"];} + elseif (isset($_POST["VICIDIAL_web_URL"])) {$VICIDIAL_web_URL=$_POST["VICIDIAL_web_URL"];} +if (isset($_GET["voicemail_button_enabled"])) {$voicemail_button_enabled=$_GET["voicemail_button_enabled"];} + elseif (isset($_POST["voicemail_button_enabled"])) {$voicemail_button_enabled=$_POST["voicemail_button_enabled"];} +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["voicemail_ext"])) {$voicemail_ext=$_GET["voicemail_ext"];} + elseif (isset($_POST["voicemail_ext"])) {$voicemail_ext=$_POST["voicemail_ext"];} +if (isset($_GET["voicemail_exten"])) {$voicemail_exten=$_GET["voicemail_exten"];} + elseif (isset($_POST["voicemail_exten"])) {$voicemail_exten=$_POST["voicemail_exten"];} +if (isset($_GET["voicemail_id"])) {$voicemail_id=$_GET["voicemail_id"];} + elseif (isset($_POST["voicemail_id"])) {$voicemail_id=$_POST["voicemail_id"];} +if (isset($_GET["web_form_address"])) {$web_form_address=$_GET["web_form_address"];} + elseif (isset($_POST["web_form_address"])) {$web_form_address=$_POST["web_form_address"];} +if (isset($_GET["wrapup_message"])) {$wrapup_message=$_GET["wrapup_message"];} + elseif (isset($_POST["wrapup_message"])) {$wrapup_message=$_POST["wrapup_message"];} +if (isset($_GET["wrapup_seconds"])) {$wrapup_seconds=$_GET["wrapup_seconds"];} + elseif (isset($_POST["wrapup_seconds"])) {$wrapup_seconds=$_POST["wrapup_seconds"];} +if (isset($_GET["xferconf_a_dtmf"])) {$xferconf_a_dtmf=$_GET["xferconf_a_dtmf"];} + elseif (isset($_POST["xferconf_a_dtmf"])) {$xferconf_a_dtmf=$_POST["xferconf_a_dtmf"];} +if (isset($_GET["xferconf_a_number"])) {$xferconf_a_number=$_GET["xferconf_a_number"];} + elseif (isset($_POST["xferconf_a_number"])) {$xferconf_a_number=$_POST["xferconf_a_number"];} +if (isset($_GET["xferconf_b_dtmf"])) {$xferconf_b_dtmf=$_GET["xferconf_b_dtmf"];} + elseif (isset($_POST["xferconf_b_dtmf"])) {$xferconf_b_dtmf=$_POST["xferconf_b_dtmf"];} +if (isset($_GET["xferconf_b_number"])) {$xferconf_b_number=$_GET["xferconf_b_number"];} + elseif (isset($_POST["xferconf_b_number"])) {$xferconf_b_number=$_POST["xferconf_b_number"];} +if (isset($_GET["vicidial_balance_active"])) {$vicidial_balance_active=$_GET["vicidial_balance_active"];} + elseif (isset($_POST["vicidial_balance_active"])) {$vicidial_balance_active=$_POST["vicidial_balance_active"];} +if (isset($_GET["balance_trunks_offlimits"])) {$balance_trunks_offlimits=$_GET["balance_trunks_offlimits"];} + elseif (isset($_POST["balance_trunks_offlimits"])) {$balance_trunks_offlimits=$_POST["balance_trunks_offlimits"];} +if (isset($_GET["dedicated_trunks"])) {$dedicated_trunks=$_GET["dedicated_trunks"];} + elseif (isset($_POST["dedicated_trunks"])) {$dedicated_trunks=$_POST["dedicated_trunks"];} +if (isset($_GET["trunk_restriction"])) {$trunk_restriction=$_GET["trunk_restriction"];} + elseif (isset($_POST["trunk_restriction"])) {$trunk_restriction=$_POST["trunk_restriction"];} +if (isset($_GET["campaigns"])) {$campaigns=$_GET["campaigns"];} + elseif (isset($_POST["campaigns"])) {$campaigns=$_POST["campaigns"];} +if (isset($_GET["dial_level_override"])) {$dial_level_override=$_GET["dial_level_override"];} + elseif (isset($_POST["dial_level_override"])) {$dial_level_override=$_POST["dial_level_override"];} +if (isset($_GET["concurrent_transfers"])) {$concurrent_transfers=$_GET["concurrent_transfers"];} + elseif (isset($_POST["concurrent_transfers"])) {$concurrent_transfers=$_POST["concurrent_transfers"];} +if (isset($_GET["auto_alt_dial"])) {$auto_alt_dial=$_GET["auto_alt_dial"];} + elseif (isset($_POST["auto_alt_dial"])) {$auto_alt_dial=$_POST["auto_alt_dial"];} +if (isset($_GET["modify_users"])) {$modify_users=$_GET["modify_users"];} + elseif (isset($_POST["modify_users"])) {$modify_users=$_POST["modify_users"];} +if (isset($_GET["modify_campaigns"])) {$modify_campaigns=$_GET["modify_campaigns"];} + elseif (isset($_POST["modify_campaigns"])) {$modify_campaigns=$_POST["modify_campaigns"];} +if (isset($_GET["modify_lists"])) {$modify_lists=$_GET["modify_lists"];} + elseif (isset($_POST["modify_lists"])) {$modify_lists=$_POST["modify_lists"];} +if (isset($_GET["modify_scripts"])) {$modify_scripts=$_GET["modify_scripts"];} + elseif (isset($_POST["modify_scripts"])) {$modify_scripts=$_POST["modify_scripts"];} +if (isset($_GET["modify_filters"])) {$modify_filters=$_GET["modify_filters"];} + elseif (isset($_POST["modify_filters"])) {$modify_filters=$_POST["modify_filters"];} +if (isset($_GET["modify_ingroups"])) {$modify_ingroups=$_GET["modify_ingroups"];} + elseif (isset($_POST["modify_ingroups"])) {$modify_ingroups=$_POST["modify_ingroups"];} +if (isset($_GET["modify_usergroups"])) {$modify_usergroups=$_GET["modify_usergroups"];} + elseif (isset($_POST["modify_usergroups"])) {$modify_usergroups=$_POST["modify_usergroups"];} +if (isset($_GET["modify_remoteagents"])) {$modify_remoteagents=$_GET["modify_remoteagents"];} + elseif (isset($_POST["modify_remoteagents"])) {$modify_remoteagents=$_POST["modify_remoteagents"];} +if (isset($_GET["modify_servers"])) {$modify_servers=$_GET["modify_servers"];} + elseif (isset($_POST["modify_servers"])) {$modify_servers=$_POST["modify_servers"];} +if (isset($_GET["view_reports"])) {$view_reports=$_GET["view_reports"];} + elseif (isset($_POST["view_reports"])) {$view_reports=$_POST["view_reports"];} +if (isset($_GET["agent_pause_codes_active"])) {$agent_pause_codes_active=$_GET["agent_pause_codes_active"];} + elseif (isset($_POST["agent_pause_codes_active"])) {$agent_pause_codes_active=$_POST["agent_pause_codes_active"];} +if (isset($_GET["pause_code"])) {$pause_code=$_GET["pause_code"];} + elseif (isset($_POST["pause_code"])) {$pause_code=$_POST["pause_code"];} +if (isset($_GET["pause_code_name"])) {$pause_code_name=$_GET["pause_code_name"];} + elseif (isset($_POST["pause_code_name"])) {$pause_code_name=$_POST["pause_code_name"];} +if (isset($_GET["billable"])) {$billable=$_GET["billable"];} + elseif (isset($_POST["billable"])) {$billable=$_POST["billable"];} +if (isset($_GET["campaign_description"])) {$campaign_description=$_GET["campaign_description"];} + elseif (isset($_POST["campaign_description"])) {$campaign_description=$_POST["campaign_description"];} +if (isset($_GET["campaign_stats_refresh"])) {$campaign_stats_refresh=$_GET["campaign_stats_refresh"];} + elseif (isset($_POST["campaign_stats_refresh"])){$campaign_stats_refresh=$_POST["campaign_stats_refresh"];} +if (isset($_GET["list_description"])) {$list_description=$_GET["list_description"];} + elseif (isset($_POST["list_description"])) {$list_description=$_POST["list_description"];} +if (isset($_GET["vicidial_recording_override"])) {$vicidial_recording_override=$_GET["vicidial_recording_override"];} elseif (isset($_POST["vicidial_recording_override"])) {$vicidial_recording_override=$_POST["vicidial_recording_override"];} +if (isset($_GET["use_non_latin"])) {$use_non_latin=$_GET["use_non_latin"];} + elseif (isset($_POST["use_non_latin"])) {$use_non_latin=$_POST["use_non_latin"];} +if (isset($_GET["webroot_writable"])) {$webroot_writable=$_GET["webroot_writable"];} + elseif (isset($_POST["webroot_writable"])) {$webroot_writable=$_POST["webroot_writable"];} +if (isset($_GET["enable_queuemetrics_logging"])) {$enable_queuemetrics_logging=$_GET["enable_queuemetrics_logging"];} + elseif (isset($_POST["enable_queuemetrics_logging"])) {$enable_queuemetrics_logging=$_POST["enable_queuemetrics_logging"];} +if (isset($_GET["queuemetrics_server_ip"])) {$queuemetrics_server_ip=$_GET["queuemetrics_server_ip"];} + elseif (isset($_POST["queuemetrics_server_ip"])) {$queuemetrics_server_ip=$_POST["queuemetrics_server_ip"];} +if (isset($_GET["queuemetrics_dbname"])) {$queuemetrics_dbname=$_GET["queuemetrics_dbname"];} + elseif (isset($_POST["queuemetrics_dbname"])) {$queuemetrics_dbname=$_POST["queuemetrics_dbname"];} +if (isset($_GET["queuemetrics_login"])) {$queuemetrics_login=$_GET["queuemetrics_login"];} + elseif (isset($_POST["queuemetrics_login"])) {$queuemetrics_login=$_POST["queuemetrics_login"];} +if (isset($_GET["queuemetrics_pass"])) {$queuemetrics_pass=$_GET["queuemetrics_pass"];} + elseif (isset($_POST["queuemetrics_pass"])) {$queuemetrics_pass=$_POST["queuemetrics_pass"];} +if (isset($_GET["queuemetrics_url"])) {$queuemetrics_url=$_GET["queuemetrics_url"];} + elseif (isset($_POST["queuemetrics_url"])) {$queuemetrics_url=$_POST["queuemetrics_url"];} +if (isset($_GET["queuemetrics_log_id"])) {$queuemetrics_log_id=$_GET["queuemetrics_log_id"];} + elseif (isset($_POST["queuemetrics_log_id"])) {$queuemetrics_log_id=$_POST["queuemetrics_log_id"];} +if (isset($_GET["dial_status"])) {$dial_status=$_GET["dial_status"];} + elseif (isset($_POST["dial_status"])) {$dial_status=$_POST["dial_status"];} +if (isset($_GET["queuemetrics_eq_prepend"])) {$queuemetrics_eq_prepend=$_GET["queuemetrics_eq_prepend"];} + elseif (isset($_POST["queuemetrics_eq_prepend"])) {$queuemetrics_eq_prepend=$_POST["queuemetrics_eq_prepend"];} +if (isset($_GET["vicidial_agent_disable"])) {$vicidial_agent_disable=$_GET["vicidial_agent_disable"];} + elseif (isset($_POST["vicidial_agent_disable"])) {$vicidial_agent_disable=$_POST["vicidial_agent_disable"];} +if (isset($_GET["disable_alter_custdata"])) {$disable_alter_custdata=$_GET["disable_alter_custdata"];} + elseif (isset($_POST["disable_alter_custdata"])) {$disable_alter_custdata=$_POST["disable_alter_custdata"];} +if (isset($_GET["alter_custdata_override"])) {$alter_custdata_override=$_GET["alter_custdata_override"];} + elseif (isset($_POST["alter_custdata_override"])) {$alter_custdata_override=$_POST["alter_custdata_override"];} +if (isset($_GET["no_hopper_leads_logins"])) {$no_hopper_leads_logins=$_GET["no_hopper_leads_logins"];} + elseif (isset($_POST["no_hopper_leads_logins"])) {$no_hopper_leads_logins=$_POST["no_hopper_leads_logins"];} +if (isset($_GET["enable_sipsak_messages"])) {$enable_sipsak_messages=$_GET["enable_sipsak_messages"];} + elseif (isset($_POST["enable_sipsak_messages"])) {$enable_sipsak_messages=$_POST["enable_sipsak_messages"];} +if (isset($_GET["allow_sipsak_messages"])) {$allow_sipsak_messages=$_GET["allow_sipsak_messages"];} + elseif (isset($_POST["allow_sipsak_messages"])) {$allow_sipsak_messages=$_POST["allow_sipsak_messages"];} +if (isset($_GET["admin_home_url"])) {$admin_home_url=$_GET["admin_home_url"];} + elseif (isset($_POST["admin_home_url"])) {$admin_home_url=$_POST["admin_home_url"];} +if (isset($_GET["list_order_mix"])) {$list_order_mix=$_GET["list_order_mix"];} + elseif (isset($_POST["list_order_mix"])) {$list_order_mix=$_POST["list_order_mix"];} +if (isset($_GET["vcl_id"])) {$vcl_id=$_GET["vcl_id"];} + elseif (isset($_POST["vcl_id"])) {$vcl_id=$_POST["vcl_id"];} +if (isset($_GET["vcl_name"])) {$vcl_name=$_GET["vcl_name"];} + elseif (isset($_POST["vcl_name"])) {$vcl_name=$_POST["vcl_name"];} +if (isset($_GET["list_mix_container"])) {$list_mix_container=$_GET["list_mix_container"];} + elseif (isset($_POST["list_mix_container"])) {$list_mix_container=$_POST["list_mix_container"];} +if (isset($_GET["mix_method"])) {$mix_method=$_GET["mix_method"];} + elseif (isset($_POST["mix_method"])) {$mix_method=$_POST["mix_method"];} +if (isset($_GET["human_answered"])) {$human_answered=$_GET["human_answered"];} + elseif (isset($_POST["human_answered"])) {$human_answered=$_POST["human_answered"];} +if (isset($_GET["category"])) {$category=$_GET["category"];} + elseif (isset($_POST["category"])) {$category=$_POST["category"];} +if (isset($_GET["vsc_id"])) {$vsc_id=$_GET["vsc_id"];} + elseif (isset($_POST["vsc_id"])) {$vsc_id=$_POST["vsc_id"];} +if (isset($_GET["vsc_name"])) {$vsc_name=$_GET["vsc_name"];} + elseif (isset($_POST["vsc_name"])) {$vsc_name=$_POST["vsc_name"];} +if (isset($_GET["vsc_description"])) {$vsc_description=$_GET["vsc_description"];} + elseif (isset($_POST["vsc_description"])) {$vsc_description=$_POST["vsc_description"];} +if (isset($_GET["tovdad_display"])) {$tovdad_display=$_GET["tovdad_display"];} + elseif (isset($_POST["tovdad_display"])) {$tovdad_display=$_POST["tovdad_display"];} +if (isset($_GET["mix_container_item"])) {$mix_container_item=$_GET["mix_container_item"];} + elseif (isset($_POST["mix_container_item"])) {$mix_container_item=$_POST["mix_container_item"];} +if (isset($_GET["enable_agc_xfer_log"])) {$enable_agc_xfer_log=$_GET["enable_agc_xfer_log"];} + elseif (isset($_POST["enable_agc_xfer_log"])) {$enable_agc_xfer_log=$_POST["enable_agc_xfer_log"];} +if (isset($_GET["after_hours_action"])) {$after_hours_action=$_GET["after_hours_action"];} + elseif (isset($_POST["after_hours_action"])) {$after_hours_action=$_POST["after_hours_action"];} +if (isset($_GET["after_hours_message_filename"])) {$after_hours_message_filename=$_GET["after_hours_message_filename"];} + elseif (isset($_POST["after_hours_message_filename"])) {$after_hours_message_filename=$_POST["after_hours_message_filename"];} +if (isset($_GET["after_hours_exten"])) {$after_hours_exten=$_GET["after_hours_exten"];} + elseif (isset($_POST["after_hours_exten"])) {$after_hours_exten=$_POST["after_hours_exten"];} +if (isset($_GET["after_hours_voicemail"])) {$after_hours_voicemail=$_GET["after_hours_voicemail"];} + elseif (isset($_POST["after_hours_voicemail"])) {$after_hours_voicemail=$_POST["after_hours_voicemail"];} +if (isset($_GET["welcome_message_filename"])) {$welcome_message_filename=$_GET["welcome_message_filename"];} + elseif (isset($_POST["welcome_message_filename"])) {$welcome_message_filename=$_POST["welcome_message_filename"];} +if (isset($_GET["moh_context"])) {$moh_context=$_GET["moh_context"];} + elseif (isset($_POST["moh_context"])) {$moh_context=$_POST["moh_context"];} +if (isset($_GET["onhold_prompt_filename"])) {$onhold_prompt_filename=$_GET["onhold_prompt_filename"];} + elseif (isset($_POST["onhold_prompt_filename"])) {$onhold_prompt_filename=$_POST["onhold_prompt_filename"];} +if (isset($_GET["prompt_interval"])) {$prompt_interval=$_GET["prompt_interval"];} + elseif (isset($_POST["prompt_interval"])) {$prompt_interval=$_POST["prompt_interval"];} +if (isset($_GET["agent_alert_exten"])) {$agent_alert_exten=$_GET["agent_alert_exten"];} + elseif (isset($_POST["agent_alert_exten"])) {$agent_alert_exten=$_POST["agent_alert_exten"];} +if (isset($_GET["agent_alert_delay"])) {$agent_alert_delay=$_GET["agent_alert_delay"];} + elseif (isset($_POST["agent_alert_delay"])) {$agent_alert_delay=$_POST["agent_alert_delay"];} +if (isset($_GET["group_rank"])) {$group_rank=$_GET["group_rank"];} + elseif (isset($_POST["group_rank"])) {$group_rank=$_POST["group_rank"];} +if (isset($_GET["campaign_allow_inbound"])) {$campaign_allow_inbound=$_GET["campaign_allow_inbound"];} + elseif (isset($_POST["campaign_allow_inbound"])) {$campaign_allow_inbound=$_POST["campaign_allow_inbound"];} +if (isset($_GET["manual_dial_list_id"])) {$manual_dial_list_id=$_GET["manual_dial_list_id"];} + elseif (isset($_POST["manual_dial_list_id"])) {$manual_dial_list_id=$_POST["manual_dial_list_id"];} +if (isset($_GET["campaign_rank"])) {$campaign_rank=$_GET["campaign_rank"];} + elseif (isset($_POST["campaign_rank"])) {$campaign_rank=$_POST["campaign_rank"];} +if (isset($_GET["source_campaign_id"])) {$source_campaign_id=$_GET["source_campaign_id"];} + elseif (isset($_POST["source_campaign_id"])) {$source_campaign_id=$_POST["source_campaign_id"];} +if (isset($_GET["source_user_id"])) {$source_user_id=$_GET["source_user_id"];} + elseif (isset($_POST["source_user_id"])) {$source_user_id=$_POST["source_user_id"];} +if (isset($_GET["source_group_id"])) {$source_group_id=$_GET["source_group_id"];} + elseif (isset($_POST["source_group_id"])) {$source_group_id=$_POST["source_group_id"];} +if (isset($_GET["default_xfer_group"])) {$default_xfer_group=$_GET["default_xfer_group"];} + elseif (isset($_POST["default_xfer_group"])) {$default_xfer_group=$_POST["default_xfer_group"];} + + + if (isset($script_id)) {$script_id= strtoupper($script_id);} + if (isset($lead_filter_id)) {$lead_filter_id = strtoupper($lead_filter_id);} + +if (strlen($dial_status) > 0) + { + $ADD='28'; + $status = $dial_status; + } + +###################################################################################################### +###################################################################################################### +####### Form variable filtering for security and data integrity +###################################################################################################### +###################################################################################################### + +if ($non_latin < 1) +{ +### DIGITS ONLY ### +$adaptive_dropped_percentage = ereg_replace("[^0-9]","",$adaptive_dropped_percentage); +$adaptive_latest_server_time = ereg_replace("[^0-9]","",$adaptive_latest_server_time); +$admin_hangup_enabled = ereg_replace("[^0-9]","",$admin_hangup_enabled); +$admin_hijack_enabled = ereg_replace("[^0-9]","",$admin_hijack_enabled); +$admin_monitor_enabled = ereg_replace("[^0-9]","",$admin_monitor_enabled); +$AFLogging_enabled = ereg_replace("[^0-9]","",$AFLogging_enabled); +$agent_choose_ingroups = ereg_replace("[^0-9]","",$agent_choose_ingroups); +$agentcall_manual = ereg_replace("[^0-9]","",$agentcall_manual); +$agentonly_callbacks = ereg_replace("[^0-9]","",$agentonly_callbacks); +$AGI_call_logging_enabled = ereg_replace("[^0-9]","",$AGI_call_logging_enabled); +$allcalls_delay = ereg_replace("[^0-9]","",$allcalls_delay); +$alter_agent_interface_options = ereg_replace("[^0-9]","",$alter_agent_interface_options); +$am_message_exten = ereg_replace("[^0-9]","",$am_message_exten); +$answer_transfer_agent = ereg_replace("[^0-9]","",$answer_transfer_agent); +$ast_admin_access = ereg_replace("[^0-9]","",$ast_admin_access); +$ast_delete_phones = ereg_replace("[^0-9]","",$ast_delete_phones); +$attempt_delay = ereg_replace("[^0-9]","",$attempt_delay); +$attempt_maximum = ereg_replace("[^0-9]","",$attempt_maximum); +$auto_dial_next_number = ereg_replace("[^0-9]","",$auto_dial_next_number); +$balance_trunks_offlimits = ereg_replace("[^0-9]","",$balance_trunks_offlimits); +$call_parking_enabled = ereg_replace("[^0-9]","",$call_parking_enabled); +$CallerID_popup_enabled = ereg_replace("[^0-9]","",$CallerID_popup_enabled); +$campaign_detail = ereg_replace("[^0-9]","",$campaign_detail); +$campaign_rec_exten = ereg_replace("[^0-9]","",$campaign_rec_exten); +$campaign_vdad_exten = ereg_replace("[^0-9]","",$campaign_vdad_exten); +$change_agent_campaign = ereg_replace("[^0-9]","",$change_agent_campaign); +$closer_default_blended = ereg_replace("[^0-9]","",$closer_default_blended); +$conf_exten = ereg_replace("[^0-9]","",$conf_exten); +$conf_on_extension = ereg_replace("[^0-9]","",$conf_on_extension); +$conferencing_enabled = ereg_replace("[^0-9]","",$conferencing_enabled); +$ct_default_start = ereg_replace("[^0-9]","",$ct_default_start); +$ct_default_stop = ereg_replace("[^0-9]","",$ct_default_stop); +$ct_friday_start = ereg_replace("[^0-9]","",$ct_friday_start); +$ct_friday_stop = ereg_replace("[^0-9]","",$ct_friday_stop); +$ct_monday_start = ereg_replace("[^0-9]","",$ct_monday_start); +$ct_monday_stop = ereg_replace("[^0-9]","",$ct_monday_stop); +$ct_saturday_start = ereg_replace("[^0-9]","",$ct_saturday_start); +$ct_saturday_stop = ereg_replace("[^0-9]","",$ct_saturday_stop); +$ct_sunday_start = ereg_replace("[^0-9]","",$ct_sunday_start); +$ct_sunday_stop = ereg_replace("[^0-9]","",$ct_sunday_stop); +$ct_thursday_start = ereg_replace("[^0-9]","",$ct_thursday_start); +$ct_thursday_stop = ereg_replace("[^0-9]","",$ct_thursday_stop); +$ct_tuesday_start = ereg_replace("[^0-9]","",$ct_tuesday_start); +$ct_tuesday_stop = ereg_replace("[^0-9]","",$ct_tuesday_stop); +$ct_wednesday_start = ereg_replace("[^0-9]","",$ct_wednesday_start); +$ct_wednesday_stop = ereg_replace("[^0-9]","",$ct_wednesday_stop); +$DBX_port = ereg_replace("[^0-9]","",$DBX_port); +$DBY_port = ereg_replace("[^0-9]","",$DBY_port); +$dedicated_trunks = ereg_replace("[^0-9]","",$dedicated_trunks); +$delete_call_times = ereg_replace("[^0-9]","",$delete_call_times); +$delete_campaigns = ereg_replace("[^0-9]","",$delete_campaigns); +$delete_filters = ereg_replace("[^0-9]","",$delete_filters); +$delete_ingroups = ereg_replace("[^0-9]","",$delete_ingroups); +$delete_lists = ereg_replace("[^0-9]","",$delete_lists); +$delete_remote_agents = ereg_replace("[^0-9]","",$delete_remote_agents); +$delete_scripts = ereg_replace("[^0-9]","",$delete_scripts); +$delete_user_groups = ereg_replace("[^0-9]","",$delete_user_groups); +$delete_users = ereg_replace("[^0-9]","",$delete_users); +$dial_timeout = ereg_replace("[^0-9]","",$dial_timeout); +$dialplan_number = ereg_replace("[^0-9]","",$dialplan_number); +$drop_call_seconds = ereg_replace("[^0-9]","",$drop_call_seconds); +$drop_exten = ereg_replace("[^0-9]","",$drop_exten); +$enable_fast_refresh = ereg_replace("[^0-9]","",$enable_fast_refresh); +$enable_persistant_mysql = ereg_replace("[^0-9]","",$enable_persistant_mysql); +$fast_refresh_rate = ereg_replace("[^0-9]","",$fast_refresh_rate); +$hopper_level = ereg_replace("[^0-9]","",$hopper_level); +$hotkey = ereg_replace("[^0-9]","",$hotkey); +$hotkeys_active = ereg_replace("[^0-9]","",$hotkeys_active); +$list_id = ereg_replace("[^0-9]","",$list_id); +$load_leads = ereg_replace("[^0-9]","",$load_leads); +$max_vicidial_trunks = ereg_replace("[^0-9]","",$max_vicidial_trunks); +$modify_call_times = ereg_replace("[^0-9]","",$modify_call_times); +$modify_users = ereg_replace("[^0-9]","",$modify_users); +$modify_campaigns = ereg_replace("[^0-9]","",$modify_campaigns); +$modify_lists = ereg_replace("[^0-9]","",$modify_lists); +$modify_scripts = ereg_replace("[^0-9]","",$modify_scripts); +$modify_filters = ereg_replace("[^0-9]","",$modify_filters); +$modify_ingroups = ereg_replace("[^0-9]","",$modify_ingroups); +$modify_usergroups = ereg_replace("[^0-9]","",$modify_usergroups); +$modify_remoteagents = ereg_replace("[^0-9]","",$modify_remoteagents); +$modify_servers = ereg_replace("[^0-9]","",$modify_servers); +$view_reports = ereg_replace("[^0-9]","",$view_reports); +$modify_leads = ereg_replace("[^0-9]","",$modify_leads); +$monitor_prefix = ereg_replace("[^0-9]","",$monitor_prefix); +$number_of_lines = ereg_replace("[^0-9]","",$number_of_lines); +$old_conf_exten = ereg_replace("[^0-9]","",$old_conf_exten); +$outbound_cid = ereg_replace("[^0-9]","",$outbound_cid); +$park_ext = ereg_replace("[^0-9]","",$park_ext); +$park_on_extension = ereg_replace("[^0-9]","",$park_on_extension); +$phone_number = ereg_replace("[^0-9]","",$phone_number); +$QUEUE_ACTION_enabled = ereg_replace("[^0-9]","",$QUEUE_ACTION_enabled); +$recording_exten = ereg_replace("[^0-9]","",$recording_exten); +$remote_agent_id = ereg_replace("[^0-9]","",$remote_agent_id); +$safe_harbor_exten = ereg_replace("[^0-9]","",$safe_harbor_exten); +$telnet_port = ereg_replace("[^0-9]","",$telnet_port); +$updater_check_enabled = ereg_replace("[^0-9]","",$updater_check_enabled); +$user_level = ereg_replace("[^0-9]","",$user_level); +$user_start = ereg_replace("[^0-9]","",$user_start); +$user_switching_enabled = ereg_replace("[^0-9]","",$user_switching_enabled); +$VDstop_rec_after_each_call = ereg_replace("[^0-9]","",$VDstop_rec_after_each_call); +$VICIDIAL_park_on_extension = ereg_replace("[^0-9]","",$VICIDIAL_park_on_extension); +$vicidial_recording = ereg_replace("[^0-9]","",$vicidial_recording); +$vicidial_transfers = ereg_replace("[^0-9]","",$vicidial_transfers); +$voicemail_button_enabled = ereg_replace("[^0-9]","",$voicemail_button_enabled); +$voicemail_dump_exten = ereg_replace("[^0-9]","",$voicemail_dump_exten); +$voicemail_ext = ereg_replace("[^0-9]","",$voicemail_ext); +$voicemail_exten = ereg_replace("[^0-9]","",$voicemail_exten); +$voicemail_id = ereg_replace("[^0-9]","",$voicemail_id); +$wrapup_seconds = ereg_replace("[^0-9]","",$wrapup_seconds); +$use_non_latin = ereg_replace("[^0-9]","",$use_non_latin); +$webroot_writable = ereg_replace("[^0-9]","",$webroot_writable); +$enable_queuemetrics_logging = ereg_replace("[^0-9]","",$enable_queuemetrics_logging); +$enable_sipsak_messages = ereg_replace("[^0-9]","",$enable_sipsak_messages); +$allow_sipsak_messages = ereg_replace("[^0-9]","",$allow_sipsak_messages); +$mix_container_item = ereg_replace("[^0-9]","",$mix_container_item); +$prompt_interval = ereg_replace("[^0-9]","",$prompt_interval); +$agent_alert_delay = ereg_replace("[^0-9]","",$agent_alert_delay); +$manual_dial_list_id = ereg_replace("[^0-9]","",$manual_dial_list_id); + +### DIGITS and DASHES +$group_rank = ereg_replace("[^-0-9]","",$group_rank); +$campaign_rank = ereg_replace("[^-0-9]","",$campaign_rank); + +### Y or N ONLY ### +$active = ereg_replace("[^NY]","",$active); +$allow_closers = ereg_replace("[^NY]","",$allow_closers); +$reset_hopper = ereg_replace("[^NY]","",$reset_hopper); +$amd_send_to_vmx = ereg_replace("[^NY]","",$amd_send_to_vmx); +$alt_number_dialing = ereg_replace("[^NY]","",$alt_number_dialing); +$safe_harbor_message = ereg_replace("[^NY]","",$safe_harbor_message); +$selectable = ereg_replace("[^NY]","",$selectable); +$reset_list = ereg_replace("[^NY]","",$reset_list); +$fronter_display = ereg_replace("[^NY]","",$fronter_display); +$drop_message = ereg_replace("[^NY]","",$drop_message); +$use_internal_dnc = ereg_replace("[^NY]","",$use_internal_dnc); +$omit_phone_code = ereg_replace("[^NY]","",$omit_phone_code); +$available_only_ratio_tally = ereg_replace("[^NY]","",$available_only_ratio_tally); +$sys_perf_log = ereg_replace("[^NY]","",$sys_perf_log); +$vicidial_balance_active = ereg_replace("[^NY]","",$vicidial_balance_active); +$vd_server_logs = ereg_replace("[^NY]","",$vd_server_logs); +$agent_pause_codes_active = ereg_replace("[^NY]","",$agent_pause_codes_active); +$campaign_stats_refresh = ereg_replace("[^NY]","",$campaign_stats_refresh); +$disable_alter_custdata = ereg_replace("[^NY]","",$disable_alter_custdata); +$no_hopper_leads_logins = ereg_replace("[^NY]","",$no_hopper_leads_logins); +$human_answered = ereg_replace("[^NY]","",$human_answered); +$tovdad_display = ereg_replace("[^NY]","",$tovdad_display); +$campaign_allow_inbound = ereg_replace("[^NY]","",$campaign_allow_inbound); + +### ALPHA-NUMERIC ONLY ### +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); +$script_id = ereg_replace("[^0-9a-zA-Z]","",$script_id); +$submit = ereg_replace("[^0-9a-zA-Z]","",$submit); +$campaign_cid = ereg_replace("[^0-9a-zA-Z]","",$campaign_cid); +$get_call_launch = ereg_replace("[^0-9a-zA-Z]","",$get_call_launch); +$campaign_recording = ereg_replace("[^0-9a-zA-Z]","",$campaign_recording); +$ADD = ereg_replace("[^0-9a-zA-Z]","",$ADD); +$dial_prefix = ereg_replace("[^0-9a-zA-Z]","",$dial_prefix); +$state_call_time_state = ereg_replace("[^0-9a-zA-Z]","",$state_call_time_state); +$scheduled_callbacks = ereg_replace("[^0-9a-zA-Z]","",$scheduled_callbacks); +$concurrent_transfers = ereg_replace("[^0-9a-zA-Z]","",$concurrent_transfers); +$billable = ereg_replace("[^0-9a-zA-Z]","",$billable); +$pause_code = ereg_replace("[^0-9a-zA-Z]","",$pause_code); +$vicidial_recording_override = ereg_replace("[^0-9a-zA-Z]","",$vicidial_recording_override); +$queuemetrics_log_id = ereg_replace("[^0-9a-zA-Z]","",$queuemetrics_log_id); +$after_hours_action = ereg_replace("[^0-9a-zA-Z]","",$after_hours_action); +$after_hours_exten = ereg_replace("[^0-9a-zA-Z]","",$after_hours_exten); +$after_hours_voicemail = ereg_replace("[^0-9a-zA-Z]","",$after_hours_voicemail); + +### DIGITS and Dots +$server_ip = ereg_replace("[^\.0-9]","",$server_ip); +$auto_dial_level = ereg_replace("[^\.0-9]","",$auto_dial_level); +$adaptive_maximum_level = ereg_replace("[^\.0-9]","",$adaptive_maximum_level); +$phone_ip = ereg_replace("[^\.0-9]","",$phone_ip); +$old_server_ip = ereg_replace("[^\.0-9]","",$old_server_ip); +$computer_ip = ereg_replace("[^\.0-9]","",$computer_ip); +$queuemetrics_server_ip = ereg_replace("[^\.0-9]","",$queuemetrics_server_ip); + +### ALPHA-NUMERIC and spaces and hash and star and comma +$xferconf_a_dtmf = ereg_replace("[^ \,\*\#0-9a-zA-Z]","",$xferconf_a_dtmf); +$xferconf_b_dtmf = ereg_replace("[^ \,\*\#0-9a-zA-Z]","",$xferconf_b_dtmf); + +### ALPHACAPS-NUMERIC +$xferconf_a_number = ereg_replace("[^0-9A-Z]","",$xferconf_a_number); +$xferconf_b_number = ereg_replace("[^0-9A-Z]","",$xferconf_b_number); + +### ALPHA-NUMERIC and underscore and dash +$agi_output = ereg_replace("[^-\_0-9a-zA-Z]","",$agi_output); +$ASTmgrSECRET = ereg_replace("[^-\_0-9a-zA-Z]","",$ASTmgrSECRET); +$ASTmgrUSERNAME = ereg_replace("[^-\_0-9a-zA-Z]","",$ASTmgrUSERNAME); +$ASTmgrUSERNAMElisten = ereg_replace("[^-\_0-9a-zA-Z]","",$ASTmgrUSERNAMElisten); +$ASTmgrUSERNAMEsend = ereg_replace("[^-\_0-9a-zA-Z]","",$ASTmgrUSERNAMEsend); +$ASTmgrUSERNAMEupdate = ereg_replace("[^-\_0-9a-zA-Z]","",$ASTmgrUSERNAMEupdate); +$call_time_id = ereg_replace("[^-\_0-9a-zA-Z]","",$call_time_id); +$campaign_id = ereg_replace("[^-\_0-9a-zA-Z]","",$campaign_id); +$CoNfIrM = ereg_replace("[^-\_0-9a-zA-Z]","",$CoNfIrM); +$DBX_database = ereg_replace("[^-\_0-9a-zA-Z]","",$DBX_database); +$DBX_pass = ereg_replace("[^-\_0-9a-zA-Z]","",$DBX_pass); +$DBX_user = ereg_replace("[^-\_0-9a-zA-Z]","",$DBX_user); +$DBY_database = ereg_replace("[^-\_0-9a-zA-Z]","",$DBY_database); +$DBY_pass = ereg_replace("[^-\_0-9a-zA-Z]","",$DBY_pass); +$DBY_user = ereg_replace("[^-\_0-9a-zA-Z]","",$DBY_user); +$dial_method = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_method); +$dial_status_a = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status_a); +$dial_status_b = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status_b); +$dial_status_c = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status_c); +$dial_status_d = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status_d); +$dial_status_e = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status_e); +$ext_context = ereg_replace("[^-\_0-9a-zA-Z]","",$ext_context); +$group_id = ereg_replace("[^-\_0-9a-zA-Z]","",$group_id); +$lead_filter_id = ereg_replace("[^-\_0-9a-zA-Z]","",$lead_filter_id); +$local_call_time = ereg_replace("[^-\_0-9a-zA-Z]","",$local_call_time); +$login = ereg_replace("[^-\_0-9a-zA-Z]","",$login); +$login_campaign = ereg_replace("[^-\_0-9a-zA-Z]","",$login_campaign); +$login_pass = ereg_replace("[^-\_0-9a-zA-Z]","",$login_pass); +$login_user = ereg_replace("[^-\_0-9a-zA-Z]","",$login_user); +$next_agent_call = ereg_replace("[^-\_0-9a-zA-Z]","",$next_agent_call); +$old_campaign_id = ereg_replace("[^-\_0-9a-zA-Z]","",$old_campaign_id); +$old_server_id = ereg_replace("[^-\_0-9a-zA-Z]","",$old_server_id); +$OLDuser_group = ereg_replace("[^-\_0-9a-zA-Z]","",$OLDuser_group); +$park_file_name = ereg_replace("[^-\_0-9a-zA-Z]","",$park_file_name); +$pass = ereg_replace("[^-\_0-9a-zA-Z]","",$pass); +$phone_login = ereg_replace("[^-\_0-9a-zA-Z]","",$phone_login); +$phone_pass = ereg_replace("[^-\_0-9a-zA-Z]","",$phone_pass); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$protocol = ereg_replace("[^-\_0-9a-zA-Z]","",$protocol); +$server_id = ereg_replace("[^-\_0-9a-zA-Z]","",$server_id); +$stage = ereg_replace("[^-\_0-9a-zA-Z]","",$stage); +$state_rule = ereg_replace("[^-\_0-9a-zA-Z]","",$state_rule); +$status = ereg_replace("[^-\_0-9a-zA-Z]","",$status); +$trunk_restriction = ereg_replace("[^-\_0-9a-zA-Z]","",$trunk_restriction); +$user = ereg_replace("[^-\_0-9a-zA-Z]","",$user); +$user_group = ereg_replace("[^-\_0-9a-zA-Z]","",$user_group); +$VICIDIAL_park_on_filename = ereg_replace("[^-\_0-9a-zA-Z]","",$VICIDIAL_park_on_filename); +$auto_alt_dial = ereg_replace("[^-\_0-9a-zA-Z]","",$auto_alt_dial); +$dial_status = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status); +$queuemetrics_eq_prepend = ereg_replace("[^-\_0-9a-zA-Z]","",$queuemetrics_eq_prepend); +$vicidial_agent_disable = ereg_replace("[^-\_0-9a-zA-Z]","",$vicidial_agent_disable); +$alter_custdata_override = ereg_replace("[^-\_0-9a-zA-Z]","",$alter_custdata_override); +$list_order_mix = ereg_replace("[^-\_0-9a-zA-Z]","",$list_order_mix); +$vcl_id = ereg_replace("[^-\_0-9a-zA-Z]","",$vcl_id); +$mix_method = ereg_replace("[^-\_0-9a-zA-Z]","",$mix_method); +$category = ereg_replace("[^-\_0-9a-zA-Z]","",$category); +$vsc_id = ereg_replace("[^-\_0-9a-zA-Z]","",$vsc_id); +$moh_context = ereg_replace("[^-\_0-9a-zA-Z]","",$moh_context); +$agent_alert_exten = ereg_replace("[^-\_0-9a-zA-Z]","",$agent_alert_exten); +$source_campaign_id = ereg_replace("[^-\_0-9a-zA-Z]","",$source_campaign_id); +$source_user_id = ereg_replace("[^-\_0-9a-zA-Z]","",$source_user_id); +$source_group_id = ereg_replace("[^-\_0-9a-zA-Z]","",$source_group_id); +$default_xfer_group = ereg_replace("[^-\_0-9a-zA-Z]","",$default_xfer_group); + +### ALPHA-NUMERIC and spaces +$lead_order = ereg_replace("[^ 0-9a-zA-Z]","",$lead_order); +### ALPHA-NUMERIC and hash +$group_color = ereg_replace("[^\#0-9a-zA-Z]","",$group_color); + +### ALPHA-NUMERIC and spaces dots, commas, dashes, underscores +$adaptive_dl_diff_target = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$adaptive_dl_diff_target); +$adaptive_intensity = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$adaptive_intensity); +$asterisk_version = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$asterisk_version); +$call_time_comments = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$call_time_comments); +$call_time_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$call_time_name); +$campaign_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$campaign_name); +$campaign_rec_filename = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$campaign_rec_filename); +$company = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$company); +$full_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$full_name); +$fullname = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$fullname); +$group_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$group_name); +$HKstatus = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$HKstatus); +$lead_filter_comments = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$lead_filter_comments); +$lead_filter_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$lead_filter_name); +$list_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$list_name); +$local_gmt = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$local_gmt); +$phone_type = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$phone_type); +$picture = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$picture); +$script_comments = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$script_comments); +$script_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$script_name); +$server_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$server_description); +$status = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$status); +$status_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$status_name); +$wrapup_message = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$wrapup_message); +$pause_code_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$pause_code_name); +$campaign_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$campaign_description); +$list_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$list_description); +$vcl_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$vcl_name); +$vsc_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$vsc_name); +$vsc_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$vsc_description); + +### ALPHA-NUMERIC and underscore and dash and slash and at and dot +$call_out_number_group = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$call_out_number_group); +$client_browser = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$client_browser); +$DBX_server = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$DBX_server); +$DBY_server = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$DBY_server); +$dtmf_send_extension = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$dtmf_send_extension); +$extension = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$extension); +$install_directory = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$install_directory); +$old_extension = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$old_extension); +$telnet_host = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$telnet_host); +$queuemetrics_dbname = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$queuemetrics_dbname); +$queuemetrics_login = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$queuemetrics_login); +$queuemetrics_pass = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$queuemetrics_pass); +$after_hours_message_filename = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$after_hours_message_filename); +$welcome_message_filename = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$welcome_message_filename); +$onhold_prompt_filename = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$onhold_prompt_filename); + +### remove semi-colons ### +$lead_filter_sql = ereg_replace(";","",$lead_filter_sql); +$list_mix_container = ereg_replace(";","",$list_mix_container); + +### VARIABLES TO BE mysql_real_escape_string ### +# $web_form_address +# $queuemetrics_url +# $admin_home_url + +### VARIABLES not filtered at all ### +# $script_text + +} # end of non_latin + + +##### END VARIABLE FILTERING FOR SECURITY ##### + + +# AST GUI database administration +# admin.php +# +# CHANGELOG: +# 50315-1110 - Added Custom Campaign Statuses +# 50317-1438 - Added Fronter Display var to inbound groups +# 50322-1355 - Added custom callerID per campaign +# 50517-1356 - Added user_groups sections and user_group to vicidial_users +# 50517-1440 - Added ability to logout (must click OK with empty user/pass) +# 50602-1622 - Added lead loader pages to load new files into vicidial_list +# 50620-1351 - Added custom vdad transfer AGI extension per campaign +# 50810-1414 - modified in groups to kick out spaces and dashes +# 50908-2136 - Added Custom Campaign HotKeys +# 50914-0950 - Fixed user search by user_group +# 50926-1358 - Modified to allow for language translation +# 50926-1615 - Added WeBRooTWritablE write controls +# 51020-1008 - Added editable web address and park ext - NEW dial campaigns +# 51020-1056 - Added fields and help for campaign recording control +# 51123-1335 - Altered code to function in php globals=off +# 51208-1038 - Added user_level changes, function controls and default user phones +# 51208-1556 - Added deletion of users/lists/campaigns/in groups/remote agents +# 51213-1706 - Added add/delete/modify vicidial scripts +# 51214-1737 - Added preview of vicidial script in popup window +# 51219-1225 - Added campaign and ingroups script selector and get_call_launch field +# 51222-1055 - Added am_message_exten to campaigns to allow for AM Message button +# 51222-1125 - Fixed new vicidial_campaigns default values not being assigned bug +# 51222-1156 - Added LOG OUT ALL AGENTS ON THIS CAMPAIGN button to campaign screen +# 60204-0659 - Fixed hopper reset bug +# 60207-1413 - Added AMD send to voicemail extension and xfer-conf dtmf presets +# 60213-1100 - Added several vicidial_users permissions fields +# 60215-1319 - Added On-hold CallBacks display and links +# 60227-1226 - Fixed vicidial_inbound_groups insert bug +# 60413-1308 - Fixed list display to have 1 row/status: count and time zone tables +# - Added status name in selected dial statuses in campaign screen +# 60417-1416 - Added vicidial_lead_filters sections +# - Changed the header links to color-coded sectional with sublinks below +# - Added filter name and script name to campaign and in-group modify sections +# - Added callback and alt dial options to campaigns section +# - Added callback, alt dial and other options to users section +# 60419-1628 - Alter Callbacks display to include status and LIVE listings, reordered +# 60421-1441 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60425-2355 - Added agent options to vicidial_users, reformatted user page +# 60502-1627 - Added drop_call_seconds and safe_harbor_ fields to campaign screen +# 60503-1228 - Added drop_call_seconds and drop_ fields to inbound groups screen +# 60505-1117 - Added initial framework for new local_call_times tables and definitions +# 60506-1033 - More revisions to the local_call_time section +# 60508-1354 - Finished call_times and state_call_times sections +# - Added modify/delete options for call_times +# 60509-1311 - Functionalize campaign dialable leads calculation +# - Change state_call_times selection from call_times to only allow one per state +# - Added dialable leads count popup to campaign screen if auto-calc is disabled +# - Added test dialable leads count popup to filter screen +# 60510-1050 - Added Wrapup seconds and Wrapup message to campaigns screen +# 60608-1401 - Added allowable inbound_groups checkboxes to CLOSER campaign detail screen +# 60609-1051 - Added add-to-dnc in LISTS section +# 60613-1415 - Added lead recycling options to campaign detail screen +# 60619-1523 - Added variable filtering to eliminate SQL injection attack threat +# 60622-1216 - Fixed HotKey addition form issues and variable filtering +# 60623-1159 - Fixed Scheduled Callbacks over-filtering bug and filter_sql bug +# 60808-1147 - Changed filtering for and added instructions for consutative transfers +# 60816-1552 - Added allcalls_delay start delay for recordings in vicidial.php +# 60817-2226 - Fixed bug that would not allow lead recycling of non-selectable statuses +# 60821-1543 - Added option to Omit Phone Code while dialing in vicidial +# 60821-1625 - Added ALLFORCE recording option for campaign_recording +# 60823-1154 - Added fields for adaptive dialing +# 60824-1326 - Added adaptive_latest_target_gmt for ADAPT_TAPERED dial method +# 60825-1205 - Added adaptive_intensity for ADAPT_ dial methods +# 60828-1019 - Changed adaptive_latest_target_gmt to adaptive_latest_server_time +# 60828-1115 - Added adaptive_dl_diff_target and changed intensity dropdown +# 60927-1246 - Added astguiclient/admin.php functions under SERVERS tab +# 61002-1402 - Added fields for vicidial balance trunk controls +# 61003-1123 - Added functions for vicidial_server_trunks records +# 61109-1022 - Added Emergency VDAC Jam Clear function to Campaign Detail screen +# 61110-1502 - Add ability to select NONE in dial statuses, new list_id must not be < 100 +# 61122-1228 - Added user group campaign restrictions +# 61122-1535 - Changed script_text to unfiltered and added more variables to SCRIPTS +# 61129-1028 - Added headers to Users and Phones with clickable order-by titles +# 70108-1405 - Added ADAPT OVERRIDE to allow for forced dial_level changes in ADAPT dial methods +# - Screen width definable at top of script, merged server_stats into this script +# 70109-1638 - Added ALTPH2 and ADDR3 hotkey options for alt number dialing with HotKeys +# 70109-1716 - Added concurrent_transfers option to vicidial_campaigns +# 70115-1152 - Aded (CLOSER|BLEND|INBND|_C$|_B$|_I$) options for CLOSER-type campaigns +# 70115-1532 - Added auto_alt_dial field to campaign screen for auto-dialing of alt numbers +# 70116-1200 - Added auto_alt_dial_status functionality to campaign screen +# 70117-1235 - Added header formatting variables at top of script +# - Moved Call Times and Phones/Server functions to Admin section +# 70118-1706 - Added new user group displays and links +# 70123-1519 - Added user permission settings for all sections +# 70124-1346 - Fixed spelling errors and formatting consistency +# 70202-1120 - Added agent_pause_codes section to campaigns +# 70205-1204 - Added memo, last dialed, timestamp and stats-refresh fields to vicidial_campaigns/lists +# 70206-1323 - Added user setting for vicidial_recording_override +# 70212-1412 - Added system settings section +# 70214-1226 - Added QueueMetrics Log ID field to system settings section +# 70219-1102 - Changed campaign dial statuses to be one string allowing for high limit +# 70223-0957 - Added queuemetrics_eq_prepend for custom ENTERQUEUE prepending of a field +# 70302-1111 - Fixed small bug in dialable leads calculation +# 70314-1133 - Added insert selection on script forms +# 70319-1423 - Added Alter Customer Data and agent disable display functions +# 70319-1625 - Added option to allow agents to login to outbound campaigns with no leads in the hopper +# 70322-1455 - Added sipsak messages parameters +# 70402-1157 - Added HOME link and entry to system_settings table, added QM link on reports section +# 70516-1628 - Started reformatting campaigns to use submenus to break up options +# 70529-1653 - Added help for list mix +# 70530-1354 - Added human_answered field to statuses, added system status modification +# 70530-1714 - Added lists for all campaign subsections +# 70531-1631 - Development on List mix admin interface +# 70601-1629 - More development on List mix admin interface, formatting, and added some javascript +# 70602-1300 - More development on List mix admin interface, more javascript +# 70608-1459 - Added option to set LIVE Callbacks to INACTIVE after one month +# 70612-1451 - Added Callback INACTIVE link for after one week, sort by user/group/entrydate +# 70614-0231 - Added Status Categories, ability to Modify Statuses, moved system statuses to sub-section +# 70623-1008 - List Mix section now allows modification of list mix entries +# 70629-1721 - List Mix section adding and removing of list entries active +# 70706-1636 - List Mix section cleanup and more error-checking +# 70908-0941 - Added agc logile enable system_settings +# 71020-1934 - Added inbound groups options: on-hold music, messages, call_times +# 71022-1343 - Added inbound group ranks for users +# 71029-1710 - Added option for campaign to be inbound and/or blended with no restrictions on the campaign_id name +# - Added 5th NEW and 6th NEW to the dial order options +# 71030-2010 - Added Manual Dial List ID field to campaigns table +# 71103-2207 - Added inbound_group_rank and fewest_calls to the inbound groups call order options +# 71113-1521 - Added campaign_rank to agent options +# - Added ability to Copy a campaign's setting to a new campaign +# 71113-2225 - Added ability to copy user and in-group settings to new users and in-groups +# 71116-0942 - Added campaign_rank and fewest_calls as methods for agent call routing +# 71122-1135 - Added default transfer group for campaigns and inbound groups +# 71125-1751 - Added allowable transfer groups to campaign detail screen +# +# +# make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time + +$admin_version = '2.0.4-119'; +$build = '71125-1751'; + +$STARTtime = date("U"); +$SQLdate = date("Y-m-d H:i:s"); +$MT[0]=''; +$US='_'; + +$month_old = mktime(0, 0, 0, date("m")-1, date("d"), date("Y")); +$past_month_date = date("Y-m-d H:i:s",$month_old); +$week_old = mktime(0, 0, 0, date("m"), date("d")-7, date("Y")); +$past_week_date = date("Y-m-d H:i:s",$week_old); + +if ($force_logout) +{ + if( (strlen($PHP_AUTH_USER)>0) or (strlen($PHP_AUTH_PW)>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "You have now logged out. Thank you\n"; + exit; +} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or ($auth<1)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT * from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[3]; + $LOGuser_level =$row[4]; + $LOGuser_group =$row[5]; + $LOGdelete_users =$row[8]; + $LOGdelete_user_groups =$row[9]; + $LOGdelete_lists =$row[10]; + $LOGdelete_campaigns =$row[11]; + $LOGdelete_ingroups =$row[12]; + $LOGdelete_remote_agents =$row[13]; + $LOGload_leads =$row[14]; + $LOGcampaign_detail =$row[15]; + $LOGast_admin_access =$row[16]; + $LOGast_delete_phones =$row[17]; + $LOGdelete_scripts =$row[18]; + $LOGdelete_filters =$row[29]; + $LOGalter_agent_interface =$row[30]; + $LOGdelete_call_times =$row[32]; + $LOGmodify_call_times =$row[33]; + $LOGmodify_users =$row[34]; + $LOGmodify_campaigns =$row[35]; + $LOGmodify_lists =$row[36]; + $LOGmodify_scripts =$row[37]; + $LOGmodify_filters =$row[38]; + $LOGmodify_ingroups =$row[39]; + $LOGmodify_usergroups =$row[40]; + $LOGmodify_remoteagents =$row[41]; + $LOGmodify_servers =$row[42]; + $LOGview_reports =$row[43]; + + $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$LOGuser_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGallowed_campaigns =$row[0]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +###################################################################################################### +###################################################################################################### +####### Header settings +###################################################################################################### +###################################################################################################### + + +header ("Content-type: text/html; charset=utf-8"); +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDIAL ADMIN: "; + +if (!isset($ADD)) {$ADD=0;} + +if ($ADD=="1") {$hh='users'; echo "Add New User";} +if ($ADD=="1A") {$hh='users'; echo "Copy User";} +if ($ADD==11) {$hh='campaigns'; $sh='basic'; echo "Add New Campaign";} +if ($ADD==12) {$hh='campaigns'; $sh='basic'; echo "Copy Campaign";} +if ($ADD==111) {$hh='lists'; echo "Add New List";} +if ($ADD==121) {$hh='lists'; echo "Add New DNC";} +if ($ADD==1111) {$hh='ingroups'; echo "Add New In-Group";} +if ($ADD==1211) {$hh='ingroups'; echo "Copy In-Group";} +if ($ADD==11111) {$hh='remoteagent'; echo "Add New Remote Agents";} +if ($ADD==111111) {$hh='usergroups'; echo "Add New Users Group";} +if ($ADD==1111111) {$hh='scripts'; echo "Add New Script";} +if ($ADD==11111111) {$hh='filters'; echo "Add New Filter";} +if ($ADD==111111111) {$hh='admin'; $sh='times'; echo "Add New Call Time";} +if ($ADD==1111111111) {$hh='admin'; $sh='times'; echo "Add New State Call Time";} +if ($ADD==11111111111) {$hh='admin'; $sh='phones'; echo "ADD NEW PHONE";} +if ($ADD==111111111111) {$hh='admin'; $sh='server'; echo "ADD NEW SERVER";} +if ($ADD==1111111111111) {$hh='admin'; $sh='conference'; echo "ADD NEW CONFERENCE";} +if ($ADD==11111111111111) {$hh='admin'; $sh='conference'; echo "ADD NEW VICIDIAL CONFERENCE";} +if ($ADD=="2") {$hh='users'; echo "New User Addition";} +if ($ADD=="2A") {$hh='users'; echo "New Copied User Addition";} +if ($ADD==20) {$hh='campaigns'; $sh='basic'; echo "New Copied Campaign Addition";} +if ($ADD==21) {$hh='campaigns'; $sh='basic'; echo "New Campaign Addition";} +if ($ADD==22) {$hh='campaigns'; $sh='status'; echo "New Campaign Status Addition";} +if ($ADD==23) {$hh='campaigns'; $sh='hotkey'; echo "New Campaign HotKey Addition";} +if ($ADD==25) {$hh='campaigns'; $sh='recycle'; echo "New Campaign Lead Recycle Addition";} +if ($ADD==26) {$hh='campaigns'; $sh='autoalt'; echo "New Auto Alt Dial Status";} +if ($ADD==27) {$hh='campaigns'; $sh='pause'; echo "New Agent Pause Code";} +if ($ADD==28) {$hh='campaigns'; $sh='dialstat'; echo "Campaign Dial Status Added";} +if ($ADD==29) {$hh='campaigns'; $sh='listmix'; echo "Campaign List Mix Added";} +if ($ADD==211) {$hh='lists'; echo "New List Addition";} +if ($ADD==2111) {$hh='ingroups'; echo "New In-Group Addition";} +if ($ADD==2011) {$hh='ingroups'; echo "New Copied In-Group Addition";} +if ($ADD==21111) {$hh='remoteagent'; echo "New Remote Agents Addition";} +if ($ADD==211111) {$hh='usergroups'; echo "New Users Group Addition";} +if ($ADD==2111111) {$hh='scripts'; echo "New Script Addition";} +if ($ADD==21111111) {$hh='filters'; echo "New Filter Addition";} +if ($ADD==211111111) {$hh='admin'; $sh='times'; echo "New Call Time Addition";} +if ($ADD==2111111111) {$hh='admin'; $sh='times'; echo "New State Call Time Addition";} +if ($ADD==21111111111) {$hh='admin'; $sh='phones'; echo "ADDING NEW PHONE";} +if ($ADD==211111111111) {$hh='admin'; $sh='server'; echo "ADDING NEW SERVER";} +if ($ADD==221111111111) {$hh='admin'; $sh='server'; echo "ADDING NEW SERVER VICIDIAL TRUNK RECORD";} +if ($ADD==2111111111111) {$hh='admin'; $sh='conference'; echo "ADDING NEW CONFERENCE";} +if ($ADD==21111111111111) {$hh='admin'; $sh='conference'; echo "ADDING NEW VICIDIAL CONFERENCE";} +if ($ADD==221111111111111) {$hh='admin'; $sh='status'; echo "ADDING VICIDIAL SYSTEM STATUSES";} +if ($ADD==231111111111111) {$hh='admin'; $sh='status'; echo "ADDING VICIDIAL STATUS CATEGORY";} +if ($ADD==3) {$hh='users'; echo "Modify User";} +if ($ADD==30) {$hh='campaigns'; echo "Campaign Not Allowed";} +if ($ADD==31) + { + $hh='campaigns'; $sh='detail'; echo "Modify Campaign - Detail - $campaign_id"; + if ($SUB==22) {echo " - Statuses";} + if ($SUB==23) {echo " - HotKeys";} + if ($SUB==25) {echo " - Lead Recycle Entries";} + if ($SUB==26) {echo " - Auto Alt Dial Statuses";} + if ($SUB==27) {echo " - Agent Pause Codes";} + if ($SUB==29) {echo " - List Mixes";} + } +if ($ADD==32) {$hh='campaigns'; $sh='status'; echo "Campaign Statuses";} +if ($ADD==33) {$hh='campaigns'; $sh='hotkey'; echo "Campaign HotKeys";} +if ($ADD==34) {$hh='campaigns'; $sh='basic'; echo "Modify Campaign - Basic View";} +if ($ADD==35) {$hh='campaigns'; $sh='recycle'; echo "Campaign Lead Recycle Entries";} +if ($ADD==36) {$hh='campaigns'; $sh='autoalt'; echo "Campaign Auto Alt Dial Statuses";} +if ($ADD==37) {$hh='campaigns'; $sh='pause'; echo "Campaign Agent Pause Codes";} +if ($ADD==38) {$hh='campaigns'; $sh='dialstat'; echo "Campaign Dial Statuses";} +if ($ADD==39) {$hh='campaigns'; $sh='listmix'; echo "Campaign List Mixes";} +if ($ADD==311) {$hh='lists'; echo "Modify List";} +if ($ADD==3111) {$hh='ingroups'; echo "Modify In-Group";} +if ($ADD==31111) {$hh='remoteagent'; echo "Modify Remote Agents";} +if ($ADD==311111) {$hh='usergroups'; echo "Modify Users Groups";} +if ($ADD==3111111) {$hh='scripts'; echo "Modify Script";} +if ($ADD==31111111) {$hh='filters'; echo "Modify Filter";} +if ($ADD==311111111) {$hh='admin'; $sh='times'; echo "Modify Call Time";} +if ($ADD==321111111) {$hh='admin'; $sh='times'; echo "Modify Call Time State Definitions List";} +if ($ADD==3111111111) {$hh='admin'; $sh='times'; echo "Modify State Call Time";} +if ($ADD==31111111111) {$hh='admin'; $sh='phones'; echo "MODIFY PHONE";} +if ($ADD==311111111111) {$hh='admin'; $sh='server'; echo "MODIFY SERVER";} +if ($ADD==3111111111111) {$hh='admin'; $sh='conference'; echo "MODIFY CONFERENCE";} +if ($ADD==31111111111111) {$hh='admin'; $sh='conference'; echo "MODIFY VICIDIAL CONFERENCE";} +if ($ADD==311111111111111) {$hh='admin'; $sh='settings'; echo "MODIFY VICIDIAL SYSTEM SETTINGS";} +if ($ADD==321111111111111) {$hh='admin'; $sh='status'; echo "MODIFY VICIDIAL SYSTEM STATUSES";} +if ($ADD==331111111111111) {$hh='admin'; $sh='status'; echo "MODIFY VICIDIAL STATUS CATEGORY";} +if ($ADD=="4A") {$hh='users'; echo "Modify User - Admin";} +if ($ADD=="4B") {$hh='users'; echo "Modify User - Admin";} +if ($ADD==4) {$hh='users'; echo "Modify User";} +if ($ADD==41) {$hh='campaigns'; $sh='detail'; echo "Modify Campaign";} +if ($ADD==42) {$hh='campaigns'; $sh='status'; echo "Modify Campaign Status";} +if ($ADD==43) {$hh='campaigns'; $sh='hotkey'; echo "Modify Campaign HotKey";} +if ($ADD==44) {$hh='campaigns'; $sh='basic'; echo "Modify Campaign - Basic View";} +if ($ADD==45) {$hh='campaigns'; $sh='recycle'; echo "Modify Campaign Lead Recycle";} +if ($ADD==47) {$hh='campaigns'; $sh='pause'; echo "Modify Agent Pause Code";} +if ($ADD==49) {$hh='campaigns'; $sh='listmix'; echo "Modify Campaign List Mix";} +if ($ADD==411) {$hh='lists'; echo "Modify List";} +if ($ADD==4111) {$hh='ingroups'; echo "Modify In-Group";} +if ($ADD==41111) {$hh='remoteagent'; echo "Modify Remote Agents";} +if ($ADD==411111) {$hh='usergroups'; echo "Modify Users Groups";} +if ($ADD==4111111) {$hh='scripts'; echo "Modify Script";} +if ($ADD==41111111) {$hh='filters'; echo "Modify Filter";} +if ($ADD==411111111) {$hh='admin'; $sh='times'; echo "Modify Call Time";} +if ($ADD==4111111111) {$hh='admin'; $sh='times'; echo "Modify State Call Time";} +if ($ADD==41111111111) {$hh='admin'; $sh='phones'; echo "MODIFY PHONE";} +if ($ADD==411111111111) {$hh='admin'; $sh='server'; echo "MODIFY SERVER";} +if ($ADD==421111111111) {$hh='admin'; $sh='server'; echo "MODIFY SERVER VICIDIAL TRUNK RECORD";} +if ($ADD==4111111111111) {$hh='admin'; $sh='conference'; echo "MODIFY CONFERENCE";} +if ($ADD==41111111111111) {$hh='admin'; $sh='conference'; echo "MODIFY VICIDIAL CONFERENCE";} +if ($ADD==411111111111111) {$hh='admin'; $sh='settings'; echo "MODIFY VICIDIAL SYSTEM SETTINGS";} +if ($ADD==421111111111111) {$hh='admin'; $sh='status'; echo "MODIFY VICIDIAL SYSTEM STATUSES";} +if ($ADD==431111111111111) {$hh='admin'; $sh='status'; echo "MODIFY VICIDIAL STATUS CATEGORIES";} +if ($ADD==5) {$hh='users'; echo "Delete User";} +if ($ADD==51) {$hh='campaigns'; $sh='detail'; echo "Delete Campaign";} +if ($ADD==52) {$hh='campaigns'; $sh='detail'; echo "Logout Agents";} +if ($ADD==53) {$hh='campaigns'; $sh='detail'; echo "Emergency VDAC Jam Clear";} +if ($ADD==511) {$hh='lists'; echo "Delete List";} +if ($ADD==5111) {$hh='ingroups'; echo "Delete In-Group";} +if ($ADD==51111) {$hh='remoteagent'; echo "Delete Remote Agents";} +if ($ADD==511111) {$hh='usergroups'; echo "Delete Users Group";} +if ($ADD==5111111) {$hh='scripts'; echo "Delete Script";} +if ($ADD==51111111) {$hh='filters'; echo "Delete Filter";} +if ($ADD==511111111) {$hh='admin'; $sh='times'; echo "Delete Call Time";} +if ($ADD==5111111111) {$hh='admin'; $sh='times'; echo "Delete State Call Time";} +if ($ADD==51111111111) {$hh='admin'; $sh='phones'; echo "DELETE PHONE";} +if ($ADD==511111111111) {$hh='admin'; $sh='server'; echo "DELETE SERVER";} +if ($ADD==5111111111111) {$hh='admin'; $sh='conference'; echo "DELETE CONFERENCE";} +if ($ADD==51111111111111) {$hh='admin'; $sh='conference'; echo "DELETE VICIDIAL CONFERENCE";} +if ($ADD==6) {$hh='users'; echo "Delete User";} +if ($ADD==61) {$hh='campaigns'; $sh='detail'; echo "Delete Campaign";} +if ($ADD==62) {$hh='campaigns'; $sh='detail'; echo "Logout Agents";} +if ($ADD==63) {$hh='campaigns'; $sh='detail'; echo "Emergency VDAC Jam Clear";} +if ($ADD==65) {$hh='campaigns'; $sh='recycle'; echo "Delete Lead Recycle";} +if ($ADD==66) {$hh='campaigns'; $sh='autoalt'; echo "Delete Auto Alt Dial Status";} +if ($ADD==67) {$hh='campaigns'; $sh='pause'; echo "Delete Agent Pause Code";} +if ($ADD==68) {$hh='campaigns'; $sh='dialstat'; echo "Campaign Dial Status Removed";} +if ($ADD==69) {$hh='campaigns'; $sh='listmix'; echo "Campaign List Mix Removed";} +if ($ADD==611) {$hh='lists'; echo "Delete List";} +if ($ADD==6111) {$hh='ingroups'; echo "Delete In-Group";} +if ($ADD==61111) {$hh='remoteagent'; echo "Delete Remote Agents";} +if ($ADD==611111) {$hh='usergroups'; echo "Delete Users Group";} +if ($ADD==6111111) {$hh='scripts'; echo "Delete Script";} +if ($ADD==61111111) {$hh='filters'; echo "Delete Filter";} +if ($ADD==611111111) {$hh='admin'; $sh='times'; echo "Delete Call Time";} +if ($ADD==6111111111) {$hh='admin'; $sh='times'; echo "Delete State Call Time";} +if ($ADD==61111111111) {$hh='admin'; $sh='phones'; echo "DELETE PHONE";} +if ($ADD==611111111111) {$hh='admin'; $sh='server'; echo "DELETE SERVER";} +if ($ADD==621111111111) {$hh='admin'; $sh='server'; echo "DELETE SERVER VICIDIAL TRUNK RECORD";} +if ($ADD==6111111111111) {$hh='admin'; $sh='conference'; echo "DELETE CONFERENCE";} +if ($ADD==61111111111111) {$hh='admin'; $sh='conference'; echo "DELETE VICIDIAL CONFERENCE";} +if ($ADD==73) {$hh='campaigns'; echo "Dialable Lead Count";} +if ($ADD==7111111) {$hh='scripts'; echo "Preview Script";} +if ($ADD==0) {$hh='users'; echo "Users List";} +if ($ADD==8) {$hh='users'; echo "CallBacks Within Agent";} +if ($ADD==81) {$hh='campaigns'; $sh='list'; echo "CallBacks Within Campaign";} +if ($ADD==811) {$hh='lists'; echo "CallBacks Within List";} +if ($ADD==8111) {$hh='usergroups'; echo "CallBacks Within User Group";} +if ($ADD==10) {$hh='campaigns'; $sh='list'; echo "Campaigns";} +if ($ADD==100) {$hh='lists'; echo "Lists";} +if ($ADD==1000) {$hh='ingroups'; echo "In-Groups";} +if ($ADD==10000) {$hh='remoteagent'; echo "Remote Agents";} +if ($ADD==100000) {$hh='usergroups'; echo "User Groups";} +if ($ADD==1000000) {$hh='scripts'; echo "Scripts";} +if ($ADD==10000000) {$hh='filters'; echo "Filters";} +if ($ADD==100000000) {$hh='admin'; $sh='times'; echo "Call Times";} +if ($ADD==1000000000) {$hh='admin'; $sh='times'; echo "State Call Times";} +if ($ADD==10000000000) {$hh='admin'; $sh='phones'; echo "PHONE LIST";} +if ($ADD==100000000000) {$hh='admin'; $sh='server'; echo "SERVER LIST";} +if ($ADD==1000000000000) {$hh='admin'; $sh='conference'; echo "CONFERENCE LIST";} +if ($ADD==10000000000000) {$hh='admin'; $sh='conference'; echo "VICIDIAL CONFERENCE LIST";} +if ($ADD==550) {$hh='users'; echo "Search Form";} +if ($ADD==551) {$hh='users'; echo "SEARCH PHONES";} +if ($ADD==660) {$hh='users'; echo "Search Results";} +if ($ADD==661) {$hh='users'; echo "SEARCH PHONES RESULTS";} +if ($ADD==99999) {$hh='users'; echo "HELP";} +if ($ADD==999999) {$hh='reports'; echo "REPORTS";} + +if ( ($ADD>9) && ($ADD < 99998) ) + { + ##### get scripts listing for dynamic pulldown + $stmt="SELECT script_id,script_name from vicidial_scripts order by script_id"; + $rslt=mysql_query($stmt, $link); + $scripts_to_print = mysql_num_rows($rslt); + $scripts_list="<option value=\"\">NONE</option>\n"; + + $o=0; + while ($scripts_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $scripts_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $scriptname_list["$rowx[0]"] = "$rowx[1]"; + $o++; + } + + ##### get filters listing for dynamic pulldown + $stmt="SELECT lead_filter_id,lead_filter_name,lead_filter_sql from vicidial_lead_filters order by lead_filter_id"; + $rslt=mysql_query($stmt, $link); + $filters_to_print = mysql_num_rows($rslt); + $filters_list="<option value=\"\">NONE</option>\n"; + + $o=0; + while ($filters_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $filters_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $filtername_list["$rowx[0]"] = "$rowx[1]"; + $filtersql_list["$rowx[0]"] = "$rowx[2]"; + $o++; + } + + ##### get call_times listing for dynamic pulldown + $stmt="SELECT call_time_id,call_time_name from vicidial_call_times order by call_time_id"; + $rslt=mysql_query($stmt, $link); + $times_to_print = mysql_num_rows($rslt); + + $o=0; + while ($times_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $call_times_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $call_timename_list["$rowx[0]"] = "$rowx[1]"; + $o++; + } + } + +if ( ( (strlen($ADD)>4) && ($ADD < 99998) ) or ($ADD==3) or (($ADD>20) and ($ADD<70)) or ($ADD=="4A") or ($ADD=="4B") or (strlen($ADD)==12) ) + { + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rslt=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rslt); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $servers_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $o++; + } + + ##### BEGIN get campaigns listing for rankings ##### + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + $campaigns_list=''; + $campaigns_value=''; + $RANKcampaigns_list="<tr><td>CAMPAIGN</td><td>     RANK</td><td>     CALLS</td></tr>\n"; + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $campaigns_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $campaign_id_values[$o] = $rowx[0]; + $campaign_name_values[$o] = $rowx[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + $stmt="SELECT campaign_rank,calls_today from vicidial_campaign_agents where user='$user' and campaign_id='$campaign_id_values[$o]'"; + $rslt=mysql_query($stmt, $link); + $ranks_to_print = mysql_num_rows($rslt); + if ($ranks_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $SELECT_campaign_rank = $row[0]; + $calls_today = $row[1]; + } + else + {$calls_today=0; $SELECT_campaign_rank=0;} + if ( ($ADD=="4A") or ($ADD=="4B") ) + { + if (isset($_GET["RANK_$campaign_id_values[$o]"])) {$campaign_rank=$_GET["RANK_$campaign_id_values[$o]"];} + elseif (isset($_POST["RANK_$campaign_id_values[$o]"])) {$campaign_rank=$_POST["RANK_$campaign_id_values[$o]"];} + + if ($ranks_to_print > 0) + { + $stmt="UPDATE vicidial_campaign_agents set campaign_rank='$campaign_rank', campaign_weight='$campaign_rank' where campaign_id='$campaign_id_values[$o]' and user='$user';"; + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="INSERT INTO vicidial_campaign_agents set campaign_rank='$campaign_rank', campaign_weight='$campaign_rank', campaign_id='$campaign_id_values[$o]', user='$user';"; + $rslt=mysql_query($stmt, $link); + } + + $stmt="UPDATE vicidial_live_agents set campaign_weight='$campaign_rank' where campaign_id='$campaign_id_values[$o]' and user='$user';"; + $rslt=mysql_query($stmt, $link); + } + else {$campaign_rank = $SELECT_campaign_rank;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + # disable non user-group allowable campaign ranks + $stmt="SELECT user_group from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Ruser_group = $row[0]; + + $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$Ruser_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $allowed_campaigns = $row[0]; + $allowed_campaigns = preg_replace("/ -$/","",$allowed_campaigns); + $UGcampaigns = explode(" ", $allowed_campaigns); + + $p=0; $RANK_camp_active=0; $CR_disabled = ''; + if (eregi('-ALL-CAMPAIGNS-',$allowed_campaigns)) + {$RANK_camp_active++;} + else + { + $UGcampaign_ct = count($UGcampaigns); + while ($p < $UGcampaign_ct) + { + if ($campaign_id_values[$o] == $UGcampaigns[$p]) + {$RANK_camp_active++;} + $p++; + } + } + if ($RANK_camp_active < 1) {$CR_disabled = 'DISABLED';} + + $RANKcampaigns_list .= "<tr $bgcolor><td>"; + $campaigns_list .= "<a href=\"$PHP_SELF?ADD=31&campaign_id=$campaign_id_values[$o]\">$campaign_id_values[$o]</a> - $campaign_name_values[$o] <BR>\n"; + $RANKcampaigns_list .= "<a href=\"$PHP_SELF?ADD=31&campaign_id=$campaign_id_values[$o]\">$campaign_id_values[$o]</a> - $campaign_name_values[$o] </td>"; + $RANKcampaigns_list .= "<td>     <select size=1 name=RANK_$campaign_id_values[$o] $CR_disabled>\n"; + $h="9"; + while ($h>=-9) + { + $RANKcampaigns_list .= "<option value=\"$h\""; + if ($h==$campaign_rank) + {$RANKcampaigns_list .= " SELECTED";} + $RANKcampaigns_list .= ">$h</option>"; + $h--; + } + $RANKcampaigns_list .= "</select></td>\n"; + $RANKcampaigns_list .= "<td align=right>     $calls_today</td></tr>\n"; + $o++; + } + ##### END get campaigns listing for rankings ##### + + + ##### BEGIN get inbound groups listing for checkboxes ##### + $xfer_groupsSQL=''; + if ( (($ADD>20) and ($ADD<70)) and ($ADD!=41) ) + { + $stmt="SELECT closer_campaigns,xfer_groups from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + $xfer_groups = $row[1]; + $xfer_groups = preg_replace("/ -$/","",$xfer_groups); + $XFERgroups = explode(" ", $xfer_groups); + $xfer_groupsSQL = preg_replace("/^ | -$/","",$xfer_groups); + $xfer_groupsSQL = preg_replace("/ /","','",$xfer_groupsSQL); + $xfer_groupsSQL = "WHERE group_id IN('$xfer_groupsSQL')"; + } + if ($ADD==41) + { + $p=0; + $XFERgroup_ct = count($XFERgroups); + while ($p < $XFERgroup_ct) + { + $xfer_groups .= " $XFERgroups[$p]"; + $p++; + } + $xfer_groupsSQL = preg_replace("/^ | -$/","",$xfer_groups); + $xfer_groupsSQL = preg_replace("/ /","','",$xfer_groupsSQL); + $xfer_groupsSQL = "WHERE group_id IN('$xfer_groupsSQL')"; + } + + if ( (($ADD==31111) or ($ADD==31111)) and (count($groups)<1) ) + { + $stmt="SELECT closer_campaigns from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + if ($ADD==3) + { + $stmt="SELECT closer_campaigns from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + $stmt="SELECT group_id,group_name from vicidial_inbound_groups order by group_id"; + $rslt=mysql_query($stmt, $link); + $groups_to_print = mysql_num_rows($rslt); + $groups_list=''; + $groups_value=''; + $XFERgroups_list=''; + $RANKgroups_list="<tr><td>INBOUND GROUP</td><td>     RANK</td><td>     CALLS</td></tr>\n"; + + $o=0; + while ($groups_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $group_id_values[$o] = $rowx[0]; + $group_name_values[$o] = $rowx[1]; + $o++; + } + + $o=0; + while ($groups_to_print > $o) + { + $stmt="SELECT group_rank,calls_today from vicidial_inbound_group_agents where user='$user' and group_id='$group_id_values[$o]'"; + $rslt=mysql_query($stmt, $link); + $ranks_to_print = mysql_num_rows($rslt); + if ($ranks_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $SELECT_group_rank = $row[0]; + $calls_today = $row[1]; + } + else + {$calls_today=0; $SELECT_group_rank=0;} + if ( ($ADD=="4A") or ($ADD=="4B") ) + { + if (isset($_GET["RANK_$group_id_values[$o]"])) {$group_rank=$_GET["RANK_$group_id_values[$o]"];} + elseif (isset($_POST["RANK_$group_id_values[$o]"])) {$group_rank=$_POST["RANK_$group_id_values[$o]"];} + + if ($ranks_to_print > 0) + { + $stmt="UPDATE vicidial_inbound_group_agents set group_rank='$group_rank', group_weight='$group_rank' where group_id='$group_id_values[$o]' and user='$user';"; + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="INSERT INTO vicidial_inbound_group_agents set group_rank='$group_rank', group_weight='$group_rank', group_id='$group_id_values[$o]', user='$user';"; + $rslt=mysql_query($stmt, $link); + } + + $stmt="UPDATE vicidial_live_inbound_agents set group_weight='$group_rank' where group_id='$group_id_values[$o]' and user='$user';"; + $rslt=mysql_query($stmt, $link); + } + else {$group_rank = $SELECT_group_rank;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $groups_list .= "<input type=\"checkbox\" name=\"groups[]\" value=\"$group_id_values[$o]\""; + $XFERgroups_list .= "<input type=\"checkbox\" name=\"XFERgroups[]\" value=\"$group_id_values[$o]\""; + $RANKgroups_list .= "<tr $bgcolor><td><input type=\"checkbox\" name=\"groups[]\" value=\"$group_id_values[$o]\""; + $p=0; + $group_ct = count($groups); + while ($p < $group_ct) + { + if ($group_id_values[$o] == $groups[$p]) + { + $groups_list .= " CHECKED"; + $RANKgroups_list .= " CHECKED"; + $groups_value .= " $group_id_values[$o]"; + } + $p++; + } + $p=0; + $XFERgroup_ct = count($XFERgroups); + while ($p < $XFERgroup_ct) + { + if ($group_id_values[$o] == $XFERgroups[$p]) + { + $XFERgroups_list .= " CHECKED"; + $XFERgroups_value .= " $group_id_values[$o]"; + } + $p++; + } + $groups_list .= "> <a href=\"$PHP_SELF?ADD=3111&group_id=$group_id_values[$o]\">$group_id_values[$o]</a> - $group_name_values[$o] <BR>\n"; + $XFERgroups_list .= "> <a href=\"$PHP_SELF?ADD=3111&group_id=$group_id_values[$o]\">$group_id_values[$o]</a> - $group_name_values[$o] <BR>\n"; + $RANKgroups_list .= "> <a href=\"$PHP_SELF?ADD=3111&group_id=$group_id_values[$o]\">$group_id_values[$o]</a> - $group_name_values[$o] </td>"; + $RANKgroups_list .= "<td>     <select size=1 name=RANK_$group_id_values[$o]>\n"; + $h="9"; + while ($h>=-9) + { + $RANKgroups_list .= "<option value=\"$h\""; + if ($h==$group_rank) + {$RANKgroups_list .= " SELECTED";} + $RANKgroups_list .= ">$h</option>"; + $h--; + } + $RANKgroups_list .= "</select></td>\n"; + $RANKgroups_list .= "<td align=right>     $calls_today</td></tr>\n"; + $o++; + } + if (strlen($groups_value)>2) {$groups_value .= " -";} + if (strlen($XFERgroups_value)>2) {$XFERgroups_value .= " -";} + } + ##### END get inbound groups listing for checkboxes ##### + + + ##### BEGIN get campaigns listing for checkboxes ##### + if ( ($ADD==211111) or ($ADD==311111) or ($ADD==411111) or ($ADD==511111) or ($ADD==611111) ) + { + if ( ($ADD==211111) or ($ADD==311111) or ($ADD==511111) or ($ADD==611111) ) + { + $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$user_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $allowed_campaigns = $row[0]; + $allowed_campaigns = preg_replace("/ -$/","",$allowed_campaigns); + $campaigns = explode(" ", $allowed_campaigns); + } + + $campaigns_value=''; + $campaigns_list='<B><input type="checkbox" name="campaigns[]" value="-ALL-CAMPAIGNS-"'; + $p=0; + while ($p<100) + { + if (eregi('ALL-CAMPAIGNS',$campaigns[$p])) + { + $campaigns_list.=" CHECKED"; + $campaigns_value .= " -ALL-CAMPAIGNS- -"; + } + $p++; + } + $campaigns_list.="> ALL-CAMPAIGNS - USERS CAN VIEW ANY CAMPAIGN</B><BR>\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $campaign_id_value = $rowx[0]; + $campaign_name_value = $rowx[1]; + $campaigns_list .= "<input type=\"checkbox\" name=\"campaigns[]\" value=\"$campaign_id_value\""; + $p=0; + while ($p<100) + { + if ($campaign_id_value == $campaigns[$p]) + { + # echo "<!-- X $p|$campaign_id_value|$campaigns[$p]| -->"; + $campaigns_list .= " CHECKED"; + $campaigns_value .= " $campaign_id_value"; + } + # echo "<!-- O $p|$campaign_id_value|$campaigns[$p]| -->"; + $p++; + } + $campaigns_list .= "> $campaign_id_value - $campaign_name_value<BR>\n"; + $o++; + } + if (strlen($campaigns_value)>2) {$campaigns_value .= " -";} + } + ##### END get campaigns listing for checkboxes ##### + + + if ( (strlen($ADD)==11) or (strlen($ADD)>12) ) + { + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rsltx=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rsltx); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $servers_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $o++; + } + } + + + +$NWB = "   <a href=\"javascript:openNewWindow('$PHP_SELF?ADD=99999"; +$NWE = "')\"><IMG SRC=\"help.gif\" WIDTH=20 HEIGHT=20 BORDER=0 ALT=\"HELP\" ALIGN=TOP></A>"; + + +###################################################################################################### +###################################################################################################### +####### 9 series, HELP screen +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=99999 display the HELP SCREENS +###################### + +if ($ADD==99999) +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "
VICIDIAL ADMIN: HELP


\n"; + +?> +VICIDIAL_USERS TABLE

+ +
+User ID - This field is where you put the VICIDIAL users ID number, can be up to 8 digits in length, Must be at least 2 characters in length. + +
+
+
+Password - This field is where you put the VICIDIAL users password. Must be at least 2 characters in length. + +
+
+
+Full Name - This field is where you put the VICIDIAL users full name. Must be at least 2 characters in length. + +
+
+
+User Level - This menu is where you select the VICIDIAL users user level. Must be a level of 1 to log into VICIDIAL, Must be level greater than 2 to log in as a closer, Must be user level 8 or greater to get into admin web section. + +
+
+
+User Group - This menu is where you select the VICIDIAL users group that this user will belong to. This does not have any restrictions at this time, this is just to subdivide users and allow for future features based upon it. + +
+
+
+Phone Login - Here is where you can set a default phone login value for when the user logs into vicidial.php. This value will populate the phone_login automatically when the user logs in with their user-pass-campaign in the vicidial.php login screen. + +
+
+
+Phone Pass - Here is where you can set a default phone pass value for when the user logs into vicidial.php. This value will populate the phone_pass automatically when the user logs in with their user-pass-campaign in the vicidial.php login screen. + +
+
+
+Hot Keys Active - This option if set to 1 allows the user to use the Hot Keys quick-dispositioning function in vicidial.php. + +
+
+
+Agent Choose Ingroups - This option if set to 1 allows the user to choose the ingroups that they will receive calls from when they login to a CLOSER or INBOUND campaign. Otherwise the Manager will need to set this in their user detail screen of the admin page. + +
+
+
+Scheduled Callbacks - This option allows an agent to disposition a call as CALLBK and choose the data and time at which the lead will be re-activated. + +
+
+
+Agent-Only Callbacks - This option allows an agent to set a callback so that they are the only Agent that can call the customer back. This also allows the agent to see their callback listings and call them back any time they want to. + +
+
+
+Agent Call Manual - This option allows an agent to manually enter a new lead into the system and call them. This also allows the calling of any phone number from their vicidial screen and puts that call into their session. Use this option with caution. + +
+
+
+Vicidial Recording - This option can prevent an agent from doing any recordings after they log in to vicidial. This option must be on for vicidial to follow the campaign recording session. + +
+
+
+Vicidial Transfers - This option can prevent an agent from opening the transfer - conference session of vicidial. If this is disabled, the agent cannot third party call or blind transfer any calls. + +
+
+
+Closer Default Blended - This option simply defaults the Blended checkbox on a CLOSER login screen. + +
+
+
+VICIDIAL Recording Override - This option will override whatever the option is in the campaign for recording. DISABLED will not override the campaign recording setting. NEVER will disable recording on the client. ONDEMAND is the default and allows the agent to start and stop recording as needed. ALLCALLS will start recording on the client whenever a call is sent to an agent. ALLFORCE will start recording on the client whenever a call is sent to an agent giving the agent no option to stop recording. For ALLCALLS and ALLFORCE there is an option to use the Recording Delay to cut down on very short recordings and recude system load. + +
+
+
+Campaign Ranks - In this section you can define the rank an agent will have for each campaign. These ranks can be used to allow for preferred call routing when Next Agent Call is set to campaign_rank. + +
+
+
+Inbound Groups - Here is where you select the inbound groups you want to receive calls from if you have selected the CLOSER campaign. You will also be able to set the rank, or skill level, in this section for each of the inbound groups as well as being able to see the number of calls received from each inbound group for this specific agent. Also in this section is the ability to give the agent a rank for each inbound group. These ranks can be used for preferred call routing when that option is selected in the in-group screen. + +
+
+
+Agent Alter Customer Data Override - This option will override whatever the option is in the campaign for altering of customer data. NOT_ACTIVE will use whatever setting is present for the campaign. ALLOW_ALTER will always allow for the agent to alter the customer data, no matter what the campaign setting is. Default is NOT_ACTIVE. + +
+
+
+Alter Agent Interface Options - This option if set to 1 allows the administrative user to modify the Agents interface options in admin.php. + +
+
+
+Delete Users - This option if set to 1 allows the user to delete other users of equal or lesser user level from the system. + +
+
+
+Delete User Groups - This option if set to 1 allows the user to delete user groups from the system. + +
+
+
+Delete Lists - This option if set to 1 allows the user to delete vicidial lists from the system. + +
+
+
+Delete Campaigns - This option if set to 1 allows the user to delete vicidial campaigns from the system. + +
+
+
+Delete In-Groups - This option if set to 1 allows the user to delete vicidial In-Groups from the system. + +
+
+
+Delete Remote Agents - This option if set to 1 allows the user to delete vicidial remote agents from the system. + +
+
+
+Load Leads - This option if set to 1 allows the user to load vicidial leads into the vicidial_list table by way of the web based lead loader. + +
+
+
+Campaign Detail - This option if set to 1 allows the user to view and modify the campaign detail screen elements. + +
+
+
+AGC Admin Access - This option if set to 1 allows the user to login to the astGUIclient admin pages. + +
+
+
+AGC Delete Phones - This option if set to 1 allows the user to delete phone entries in the astGUIclient admin pages. + +
+
+
+Delete Scripts - This option if set to 1 allows the user to delete Campaign scripts in the script modification screen. + +
+
+
+Modify Leads - This option if set to 1 allows the user to modify leads in the admin section lead search results page. + +
+
+
+Change Agent Campaign - This option if set to 1 allows the user to alter the campaign that an agent is logged into while they are logged into it. + +
+
+
+Delete Filters - This option allows the user to be able to delete vicidial lead filters from the system. + +
+
+
+Delete Call Times - This option allows the user to be able to delete vicidial call times records and vicidial state call times records from the system. + +
+
+
+Modify Call Times - This option allows the user to view and modify the call times and state call times records. A user doesn't need this option enabled if they only need to change the call times option on the campaigns screen. + +
+
+
+Modify Sections - These options allow the user to view and modify each sections records. If set to 0, the user will be able to see the section list, but not the detail or modification screen of a record in that section. + +
+
+
+View Reports - This option allows the user to view the VICIDIAL reports. + + + + +



+ +VICIDIAL_CAMPAIGNS TABLE

+
+
+Campaign ID - This is the short name of the campaign, it is not editable after initial submission, cannot contain spaces and must be between 2 and 8 characters in length. + +
+
+
+Campaign Name - This is the description of the campaign, it must be between 6 and 40 characters in length. + +
+
+
+Campaign Description - This is a memo field for the campaign, it is optional and can be a maximum of 255 characters in length. + +
+
+
+Campaign Change Date - This is the last time that the settings for this campaign were modified in any way. + +
+
+
+Last Campaign Login Date - This is the last time that an agent was logged into this campaign. + +
+
+
+Campaign Stats Refresh - This checkbox will allow you to force a vicidial stats refresh, even if the campaign is not active. + +
+
+
+Active - This is where you set the campaign to Active or Inactive. If Inactive, noone can log into it. + +
+
+
+Park Extension - This is where you can customize the on-hold music for VICIDIAL. Make sure the extension is in place in the extensions.conf and that it points to the filename below. + +
+
+
+Park File Name - This is where you can customize the on-hold music for VICIDIAL. Make sure the filename is 10 characters in length or less and that the file is in place in the /var/lib/asterisk/sounds directory. + +
+
+
+Web Form - This is where you can set the custom web page that will be opened when the user clicks on the WEB FORM button. + +
+
+
+Allow Closers - This is where you can set whether the users of this campaign will have the option to send the call to a closer. + +
+
+
+Default Transfer Group - This field is the default In-Group that will be automatically selected when the agent goes to the transfer-conference frame in their agent interface. + +
+
+
+Allowed Transfer Groups - With these checkbox listings you can select the groups that agents in this campaign can transfer calls to. Allow Closers must be enabled for this option to show up. + +
+
+
+Allow Inbound and Blended - This is where you can set whether the users of this campaign will have the option to take inbound calls with this campaign. If you want to do blended inbound and outbound then this must be set to Y. If you only want to do outbound dialing on this campaign set this to N. Default is N. + +
+
+
+Dial Status - This is where you set the statuses that you are wanting to dial on within the lists that are active for the campaign below. To add another status to dial, select it from the drop-down list and click ADD. To remove one of the dial statuses, click on the REMOVE link next to the status you want to remove. + +
+
+
+List Order - This menu is where you select how the leads that match the statuses selected above will be put in the lead hopper: +
  - DOWN: select the first leads loaded into the vicidial_list table +
  - UP: select the last leads loaded into the vicidial_list table +
  - UP PHONE: select the highest phone number and works its way down +
  - DOWN PHONE: select the lowest phone number and works its way up +
  - UP LAST NAME: starts with last names starting with Z and works its way down +
  - DOWN LAST NAME: starts with last names starting with A and works its way up +
  - UP COUNT: starts with most called leads and works its way down +
  - DOWN COUNT: starts with least called leads and works its way up +
  - DOWN COUNT 2nd NEW: starts with least called leads and works its way up inserting a NEW lead in every other lead - Must NOT have NEW selected in the dial statuses +
  - DOWN COUNT 3nd NEW: starts with least called leads and works its way up inserting a NEW lead in every third lead - Must NOT have NEW selected in the dial statuses +
  - DOWN COUNT 4th NEW: starts with least called leads and works its way up inserting a NEW lead in every forth lead - Must NOT have NEW selected in the dial statuses + +
+
+
+Hopper Level - This is how many leads the VDhopper script tries to keep in the vicidial_hopper table for this campaign. If running VDhopper script every minute, make this slightly greater than the number of leads you go through in a minute. + +
+
+
+Lead Filter - This is a method of filtering your leads using a fragment of a SQL query. Use this feature with caution, it is easy to stop dialing accidentally with the slightest alteration to the SQL statement. Default is NONE. + +
+
+
+Force Reset of Hopper - This allows you to wipe out the hopper contents upon form submission. It should be filled again when the VDhopper script runs. + +
+
+
+Dial Method - This field is the way to define how dialing is to take place. If MANUAL then the auto_dial_level will be locked at 0 unless Dial Method is changed. If RATIO then the normal dialing a number of lines for Active agents. ADAPT_HARD_LIMIT will dial predictively up to the dropped percentage and then not allow aggressive dialing once the drop limit is reached until the percentage goes down again. ADAPT_TAPERED allows for running over the dropped percentage in the first half of the shift -as defined by call_time selected for campaign- and gets more strict as the shift goes on. ADAPT_AVERAGE tries to maintain an average or the dropped percentage not imposing hard limits as aggressively as the other two methods. You cannot change the Auto Dial Level if you are in any of the ADAPT dial methods. Only the Dialer can change the dial level when in predictive dialing mode. + +
+
+
+Auto Dial Level - This is where you set how many lines VICIDIAL should use per active agent. zero 0 means auto dialing is off and the agents will click to dial each number. Otherwise VICIDIAL will keep dialing lines equal to active agents multiplied by the dial level to arrive at how many lines this campaign on each server should allow. The ADAPT OVERRIDE checkbox allows you to force a new dial level even though the dial method is in an ADAPT mode. This is useful if there is a dramatic shift in the quality of leads and you want to drastically change the dial_level manually. + +
+
+
+Available Only Tally - This field if set to Y will leave out INCALL and QUEUE status agents when calculating the number of calls to dial when not in MANUAL dial mode. Default is N. + +
+
+
+Drop Percentage Limit - This field is where you set the limit of the percentage of dropped calls you would like while using an adaptive-predictive dial method, not MANUAL or RATIO. + +
+
+
+Maximum Adapt Dial Level - This field is where you set the limit of the limit to the numbr of lines you would like dialed per agent while using an adaptive-predictive dial method, not MANUAL or RATIO. This number can be higher than the Auto Dial Level if your hardware will support it. Value must be a positive number greater than one and can have decimal places Default 3.0. + +
+
+
+Latest Server Time - This field is only used by the ADAPT_TAPERED dial method. You should enter in the hour and minute that you will stop calling on this campaign, 2100 would mean that you will stop dialing this campaign at 9PM server time. This allows the Tapered algorithm to decide how aggressively to dial by how long you have until you will be finished calling. + +
+
+
+Adapt Intensity Modifier - This field is used to adjust the predictive intensity either higher or lower. The higher a positive number you select, the greater the dialer will increase the call pacing when it goes up and the slower the dialer will decrease the call pacing when it goes down. The lower the negative number you select here, the slower the dialer will increase the call pacing and the faster the dialer will lower the call pacing when it goes down. Default is 0. This field is not used by the MANUAL or RATIO dial methods. + +
+
+
+Dial Level Difference Target - This field is used to define whether you want to target having a specific number of agents waiting for calls or calls waiting for agents. For example if you would always like to have on average one agent free to take calls immediately you would set this to -1, if you would like to target always having one call on hold waiting for an agent you would set this to 1. Default is 0. This field is not used by the MANUAL or RATIO dial methods. + +
+
+
+Concurrent Transfers - This setting is used to define the number of calls that can be sent to agents at the same time. It is recommended that this setting is left at AUTO. This field is not used by the MANUAL dial method. + +
+
+
+Auto Alt-Number Dialing - This setting is used to automatically dial alternate number fields while dialing in the RATIO and ADAPT dial methods when there is no contact at the main phone number for a lead, the NA, B, DC and N statuses. This setting is not used by the MANUAL dial method. + +
+
+
+Next Agent Call - This determines which agent receives the next call that is available: +
  - random: orders by the random update value in the vicidial_live_agents table +
  - oldest_call_start: orders by the last time an agent was sent a call. Results in agents receiving about the same number of calls overall. +
  - oldest_call_finish: orders by the last time an agent finished a call. AKA agent waiting longest receives first call. +
  - overall_user_level: orders by the user_level of the agent as defined in the vicidial_users table a higher user_level will receive more calls. +
  - campaign_rank: orders by the rank given to the agent for the campaign. Highest to Lowest. +
  - fewest_calls: orders by the number of calls received by an agent for that specific inbound group. Least calls first. + +
+
+
+Local Call Time - This is where you set during which hours you would like to dial, as determined by the local time in the are in which you are calling. This is controlled by area code and is adjusted for Daylight Savings time if applicable. General Guidelines in the USA for Business to Business is 9am to 5pm and Business to Consumer calls is 9am to 9pm. + +
+
+
+Dial Timeout - If defined, calls that would normally hang up after the timeout defined in extensions.conf would instead timeout at this amount of seconds if it is less than the extensions.conf timeout. This allows for quickly changing dial timeouts from server to server and limiting the effects to a single campaign. If you are having a lot of Answering Machine or Voicemail calls you may want to try changing this value to between 21-26 and see if results improve. + +
+
+
+Dial Prefix - This field allows for more easily changing a path of dialing to go out through a different method without doing a reload in Asterisk. Default is 9 based upon a 91NXXNXXXXXX in the dial plan - extensions.conf. + +
+
+
+Omit Phone Code - This field allows you to leave out the phone_code field while dialing within VICIDIAL. For instance if you are dialing in the UK from the UK you would have 44 in as your phone_code field for all leads, but you just want to dial 10 digits in your dial plan extensions.conf to place calls instead of 44 then 10 digits. Default is N. + +
+
+
+Campaign CallerID - This field allows for the sending of a custom callerid number on the outbound calls. This is the number that would show up on the callerid of the person you are calling. The default is UNKNOWN. If you are using T1 or E1s to dial out this option is only available if you are using PRIs - ISDN T1s or E1s - that have the custom callerid feature turned on, this will not work with Robbed-bit service -RBS- circuits. This will also work through most VOIP -SIP or IAX trunks- providers that allow dynamic outbound callerID. The custom callerID only applies to calls placed for the VICIDIAL campaign directly, any 3rd party calls or transfers will not send the custom callerID. NOTE: Sometimes putting UNKNOWN or PRIVATE in the field will yield the sending of your default callerID number by your carrier with the calls. You may want to test this and put 0000000000 in the callerid field instead if you do not want to send you CallerID. + +
+
+
+Campaign VDAD extension - This field allows for a custom VDAD transfer extension. This allows you to use different VDADtransfer...agi scripts depending upon your campaign. The default transfer AGI - exten 8365 agi-VDADtransfer.agi - just immediately sends the calls on to agents as soon as they are picked up. An additional sample political survey AGI is also now included - 8366 agi-VDADtransferSURVEY.agi - that plays a message to the called person and allows them to make a choice by pressing buttons - effectively pre-screening the lead - . Please note that except for surveys, political calls and charities this form of calling is illegal in the United States. + +
+
+
+Campaign Rec extension - This field allows for a custom recording extension to be used with VICIDIAL. This allows you to use different extensions depending upon how long you want to allow a maximum recording and what type of codec you want to record in. The default exten is 8309 which if you follow the SCRATCH_INSTALL examples will record in the WAV format for upto one hour. Another option included in the examples is 8310 which will record in GSM format for upto one hour. + +
+
+
+Campaign Recording - This menu allows you to choose what level of recording is allowed on this campaign. NEVER will disable recording on the client. ONDEMAND is the default and allows the agent to start and stop recording as needed. ALLCALLS will start recording on the client whenever a call is sent to an agent. ALLFORCE will start recording on the client whenever a call is sent to an agent giving the agent no option to stop recording. For ALLCALLS and ALLFORCE there is an option to use the Recording Delay to cut down on very short recordings and recude system load. + +
+
+
+Campaign Rec Filename - This field allows you to customize the name of the recording when Campaign recording is ONDEMAND or ALLCALLS. The allowed variables are CAMPAIGN CUSTPHONE FULLDATE TINYDATE EPOCH AGENT. The default is FULLDATE_AGENT and would look like this 20051020-103108_6666. Another example is CAMPAIGN_TINYDATE_CUSTPHONE which would look like this TESTCAMP_51020103108_3125551212. 50 char max. + +
+
+
+Recording Delay - For ALLCALLS and ALLFORCE recording only. This setting will delay the starting of the recording on all calls for the number of seconds specified in this field. Default is 0. + +
+
+
+Campaign Script - This menu allows you to choose the script that will appear on the agents screen for this campaign. Select NONE to show no script for this campaign. + +
+
+
+Get Call Launch - This menu allows you to choose whether you want to auto-launch the web-form page in a separate window, auto-switch to the SCRIPT tab or do nothing when a call is sent to the agent for this campaign. + +
+
+
+Answering Machine Message - This field is for entering in an extension to blind transfer calls to when the agent gets an answering machine and clicks on the Answering Machine Message button in the transfer conference frame. You must set this exten up in the dial plan - extensions.conf - and make sure it plays an audio file then hangs up. + +
+
+
+AMD send to vm exten - This menu allows you to define whether a message is left on an answering machine when it is detected. the call will be immediately forwarded to the Answering-Machine-Message extension if AMD is active and it is determined that the call is an answering machine. + +
+
+
+Xfer-Conf DTMF - These four fields allow for you to have two sets of Transfer Conference and DTMF presets. When the call or campaign is loaded, the vicidial.php script will show two buttons on the transfer-conference frame and auto-populate the number-to-dial and the send-dtmf fields when pressed. If you want to allow Consultative Transfers, a fronter to a closer, you can place CXFER as one of the number-to-dial presets and the proper dial string will be sent to do a Local Consultative Transfer, then the agent can just LEAVE-3WAY-CALL and move on to their next call. If you want to allow Blind transfers of customers to a VICIDIAL AGI script for logging or an IVR, then place AXFER in the number-to-dial field. You can also specify an custom extension after the AXFER or CXFER, for instance if you want to do Internal Consultative transfers instead of Local you would put CXFER90009 in the number-to-dial field. + +
+
+
+Agent Alt Num Dialing - This option allows an agent to manually dial the alternate phone number or address3 field after the main number has been called. + +
+
+
+Scheduled Callbacks - This option allows an agent to disposition a call as CALLBK and choose the data and time at which the lead will be re-activated. + +
+
+
+Drop Call Seconds - The number of seconds from the time the customer line is picked up until the call is considered a DROP, only applies to outbound calls. + +
+
+
+Voicemail - If defined, calls that would normally DROP would instead be directed to this voicemail box to hear and leave a message. + +
+
+
+Safe Harbor Message - If set to Y will play a message to customer after the Drop Call Seconds timeout is reached without being transferred to an agent. This setting will override sending to a voicemail box if this is set to Y. + +
+
+
+Safe Harbor Exten - This is the dial plan extension that the desired Safe Harbor audio file is located at on your server. + +
+
+
+Wrap Up Seconds - The number of seconds to force an agent to wait before allowing them to receive or dial another call. The timer begins as soon as an agent hangs up on their customer - or in the case of alternate number dialing when the agent finishes the lead - Default is 0 seconds. If the timer runs out before the agent has dispositioned the call, the agent still will NOT move on to the next call until they select a disposition. + +
+
+
+Wrap Up Message - This is a campaign-specific message to be displayed on the wrap up screen if wrap up seconds is set. + +
+
+
+Use Internal DNC List - This defines whether this campaign is to filter leads against the Internal DNC list. If it is set to Y, the hopper will look for each phone number in the DNC list before placing it in the hopper. If it is in the DNC list then it will change that lead status to DNCL so it cannot be dialed. Default is N. + +
+
+
+Allowed Inbound Groups - For CLOSER campaigns only. Here is where you select the inbound groups you want agents in this CLOSER campaign to be able to take calls from. It is important for BLENDED inbound-outbound campaigns only to select the inbound groups that are used for agents in this campaign. The calls coming into the inbound groups selected here will be counted as active calls for a blended campaign even if all agents in the campaign are not logged in to receive calls from all of those selected inbound groups. + +
+
+
+Agent Pause Codes Active - Allows agents to select a pause code when they click on the PAUSE button in vicidial.php. Pause codes are definable per campaign at the bottom of the campaign view detail screen and they are stored in the vicidial_agent_log table. Default is N. + +
+
+
+Disable Alter Customer Data - If set to Y, does not change any of the customer data record when an agent dispositions the call. Default is N. + +
+
+
+Allow No-Hopper-Leads Logins - If set to Y, allows agents to login to the campaign even if there are no leads loaded into the hopper for that campaign. This function is not needed in CLOSER-type campaigns. Default is N. + +
+
+
+List Order Mix - Overrides the Lead Order and Dial Status fields. Will use the List and status parameters for the selected List Mix entry in the List Mix sub section instead. Default is DISABLED. + +
+
+
+List Mix ID - ID of the list mix. Must be from 2-20 characters in length with no spaces or other special punctuation. + +
+
+
+List Mix Name - Descriptive name of the list mix. Must be from 2-50 characters in length. + +
+
+
+List Mix Detail - The composition of the List Mix entry. Contains the List ID, mix order, percentages and statuses that make up this List Mix. The percentages always have to add up to 100, and the lists all have to be active and set to the campaign for the order mix entry to be Activated. + +
+
+
+List Mix Method - The method of mixing all of the parts of the List Mix Detail together. EVEN_MIX will mix leads from each part interleaved with the other parts, like this 1,2,3,1,2,3,1,2,3. IN_ORDER will put the leads in the order in which they are listed in the List Mix Detail screen 1,1,1,2,2,2,3,3,3. RANDOM will put them in RANDOM order 1,3,2,1,1,3,2,1,3. Default is IN_ORDER. + +
+
+
+Manual Dial List ID - The default list_id to be used when an agent placces a manual call and a new lead record is created in vicidial_list. Default is 999. This field can contain digits only. + + + + +



+ +VICIDIAL_LISTS TABLE

+
+
+List ID - This is the numerical name of the list, it is not editable after initial submission, must contain only numbers and must be between 2 and 8 characters in length. Must be a number greater than 100. + +
+
+
+List Name - This is the description of the list, it must be between 2 and 20 characters in length. + +
+
+
+List Description - This is the memo field for the list, it is optional. + +
+
+
+List Change Date - This is the last time that the settings for this list were modified in any way. + +
+
+
+List Last Call Date - This is the last time that lead was dialed from this list. + +
+
+
+Campaign - This is the campaign that this list belongs to. A list can only be dialed on a single campaign at one time. + +
+
+
+Active - This defines whether the list is to be dialed on or not. + +
+
+
+Reset Lead-Called-Status for this list - This resets all leads in this list to N for "not called since last reset" and means that any lead can now be called if it is the right status as defined in the campaign screen. + +
+
+
+VICIDIAL DNC List - This Do Not Call list contains every lead that has been set to a status of DNC in the system. Through the LISTS - ADD NUMBER TO DNC page you are able to manually add a number to this list so that it will not be called by campaigns that use the internal DNC list. + + + +



+ +VICIDIAL_INBOUND_GROUPS TABLE

+
+
+Group ID - This is the short name of the inbound group, it is not editable after initial submission, must not contain any spaces and must be between 2 and 20 characters in length. + +
+
+
+Group Name - This is the description of the group, it must be between 2 and 30 characters in length. Cannot include dashes, plusses or spaces . + +
+
+
+Group Color - This is the color that displays in the VICIDIAL client app when a call comes in on this group. It must be between 2 and 7 characters long. If this is a hex color definition you must remember to put a # at the beginning of the string or VICIDIAL will not work properly. + +
+
+
+Active - This determines whether this group show up in the selection box when a VICIDIAL agent logs in. + +
+
+
+Web Form - This is the custom address that clicking on the WEB FORM button in VICIDIAL will take you to for calls that come in on this group. + +
+
+
+Next Agent Call - This determines which agent receives the next call that is available: +
  - random: orders by the random update value in the vicidial_live_agents table +
  - oldest_call_start: orders by the last time an agent was sent a call. Results in agents receiving about the same number of calls overall. +
  - oldest_call_finish: orders by the last time an agent finished a call. AKA agent waiting longest receives first call. +
  - overall_user_level: orders by the user_level of the agent as defined in the vicidial_users table a higher user_level will receive more calls. +
  - inbound_group_rank: orders by the rank given to the agent for the specific inbound group. Highest to Lowest. +
  - fewest_calls: orders by the number of calls received by an agent for that specific inbound group. Least calls first. +
  - campaign_rank: orders by the rank given to the agent for the campaign. Highest to Lowest. +
  - fewest_calls_campaign: orders by the number of calls received by an agent for the campaign. Least calls first. +
+
+
+Fronter Display - This field determines whether the inbound VICIDIAL agent would have the fronter name - if there is one - displayed in the Status field when the call comes to the agent. + +
+
+
+Campaign Script - This menu allows you to choose the script that will appear on the agents screen for this campaign. Select NONE to show no script for this campaign. + +
+
+
+Get Call Launch - This menu allows you to choose whether you want to auto-launch the web-form page in a separate window, auto-switch to the SCRIPT tab or do nothing when a call is sent to the agent for this campaign. + +
+
+
+Xfer-Conf DTMF - These four fields allow for you to have two sets of Transfer Conference and DTMF presets. When the call or campaign is loaded, the vicidial.php script will show two buttons on the transfer-conference frame and auto-populate the number-to-dial and the send-dtmf fields when pressed. If you want to allow Consultative Transfers, a fronter to a closer, you can place CXFER as one of the number-to-dial presets and the proper dial string will be sent to do a Local Consultative Transfer, then the agent can just LEAVE-3WAY-CALL and move on to their next call. If you want to allow Blind transfers of customers to a VICIDIAL AGI script for logging or an IVR, then place AXFER in the number-to-dial field. You can also specify an custom extension after the AXFER or CXFER, for instance if you want to do Internal Consultative transfers instead of Local you would put CXFER90009 in the number-to-dial field. + +
+
+
+Drop Call Seconds - The number of seconds from the time the customer line is picked up until the call is considered a DROP, only applies to outbound calls. + +
+
+
+Voicemail - If defined, calls that would normally DROP would instead be directed to this voicemail box to hear and leave a message. + +
+
+
+Drop Message - If set to Y will play a message to customer after the Drop Call Seconds timeout is reached without being transferred to an agent. This setting will override sending to a voicemail box if this is set to Y. + +
+
+
+Drop Exten - This is the dial plan extension that the desired Dropped call audio file is located at on your server. + +
+
+
+Call Time - This is the call time scheme to use for this inbound group. Keep in mind that the time is based on the server time. Default is 24hours. + +
+
+
+After Hours Action - The action to perform if it is after hours as defined in the call time for this inbound group. HANGUP will immediately hangup the call, MESSASGE will play the file in the After Hours Message Filenam field, EXTENSION will send the call to the After Hours Extension in the dialplan and VOICEMAIL will send the call to the voicemail box listed in the After Hours Voicemail field. Default is MESSAGE. + +
+
+
+After Hours Message Filename - The audio file located on the server to be played if the Action is set to MESSAGE. Default is vm-goodbye + +
+
+
+After Hours Extension - The dialplan extension to send the call to if the Action is set to EXTENSION. Default is 8300. + +
+
+
+After Hours Voicemail - The voicemail box to send the call to if the Action is set to VOICEMAIL. + +
+
+
+Welcome Message Filename - The audio file located on the server to be played when the call comes in. If set to ---NONE--- then no message will be played. Default is ---NONE--- + +
+
+
+Music On Hold Context - The music on hold context to use when the customer is placed on hold. Default is default. + +
+
+
+On Hold Prompt Filename - The audio file located on the server to be played at a regular interval when the customer is on hold. Default is generic_hold. This audio file MUST be 9 seconds or less in length. + +
+
+
+On Hold Prompt Interval - The length of time in seconds to wait before playing the on hold prompt. Default is 60. + +
+
+
+Agent Alert Extension - The extension to send into the agent session to announce that a call is coming to the agent. This extension should have a Playback of an audio file. To not use this function set this to X. Default is X. + +
+
+
+Agent Alert Delay - The length of time in milliseconds to wait before sending the call to the agent after playing the on Agent Alert Extension. Default is 1000. + +
+
+
+Default Transfer Group - This field is the default In-Group that will be automatically selected when the agent goes to the transfer-conference frame in their agent interface. + + + +



+ +VICIDIAL_REMOTE_AGENTS TABLE

+
+
+User ID Start - This is the starting User ID that is used when the remote agent entries are inserted into the system. If the Number of Lines is set higher than 1, this number is incremented by one until each line has an entry. Make sure you create a new VICIDIAL user account with a user level of 4 or great if you want them to be able to use the vdremote.php page for remote web access of this account. + +
+
+
+Number of Lines - This defines how many remote agent entries the system creates, and determines how many lines it thinks it can safely send to the number below. + +
+
+
+Server IP - A remote agent entry is only good for one specific server, here is where you select which server you want. + +
+
+
+External Extension - This is the number that you want the calls forwarded to. Make sure that it is a full dial plan number and that if you need a 9 at the beginning you put it in here. Test by dialing this number from a phone on the system. + +
+
+
+Status - Here is where you turn the remote agent on and off. As soon as the agent is Active the system assumes that it can send calls to it. It may take up to 30 seconds once you change the status to Inactive to stop receiving calls. + +
+
+
+Campaign - Here is where you select the campaign that these remote agents will be logged into. Inbound needs to use the CLOSER campaign and select the inbound campaigns below that you want to receive calls from. + +
+
+
+Inbound Groups - Here is where you select the inbound groups you want to receive calls from if you have selected the CLOSER campaign. + + +



+ +VICIDIAL_CAMPAIGN_LISTS

+
+
+The lists within this campaign are listed here, whether they are active is denoted by the Y or N and you can go to the list screen by clicking on the list ID in the first column. + + +



+ +VICIDIAL_CAMPAIGN_STATUSES TABLE

+
+
+Through the use of custom campaign statuses, you can have statuses that only exist for a specific campaign. The Status must be 1-8 characters in length, the description must be 2-30 characters in length and Selectable defines whether it shows up in VICIDIAL as a disposition. The human_answered field is used when calculating the drop percentage, or abandon rate. Setting human_answered to Y will use this status when counting the human-answered calls. The Category option allows you to group several statuses into a catogy that can be used for statistical analysis. + + + +



+ +VICIDIAL_CAMPAIGN_HOTKEYS TABLE

+
+
+Through the use of custom campaign hot keys, agents that use the vicidial web-client can hang up and disposition calls just by pressing a single key on their keyboard. There are two special HotKey options that you can use in conjunction with Alternate Phone number dialing, ALTPH2 - Alternate Phone Hot Dial and ADDR3-----Address3 Hot Dial allow an agent to use a hotkey to hang up their call, stay on the same lead, and dial another contact number from that lead. + + + + + +



+ +VICIDIAL_LEAD_RECYCLE TABLE

+
+
+Through the use of lead recycling, you can call specific statuses of leads again at a specified interval without resetting the entire list. Lead recycling is campaign-specific and does not have to be a selected dialable status in your campaign. The attempt delay field is the number of seconds until the lead can be placed back in the hopper, this number must be at least 120 seconds. The attempt maximum field is the maximum number of times that a lead of this status can be attempted before the list needs to be reset, this number can be from 1 to 10. You can activate and deactivate a lead recycle entry with the provided links. + + + + + +



+ +VICIDIAL AUTO ALT DIAL STATUSES

+
+
+If the Auto Alt-Number Dialing field is set, then the leads that are dispositioned under these auto alt dial statuses will have their alt_phone and-or address3 fields dialed after any of these no-answer statuses are set. + + + + + +



+ +VICIDIAL AGENT PAUSE CODES

+
+
+If the Agent Pause Codes Active field is set to active then the agents will be able to select from these pause codes when they click on the PAUSE button on their screens. This data is then stored in the vicidial agent log. The Pause code must contain only letters and numbers and be less than 7 characters long. The pause code name can be no longer than 30 characters. + + + + + +



+ +VICIDIAL_USER_GROUPS TABLE

+
+
+User Group - This is the short name of a Vicidial User group, try not to use any spaces or punctuation for this field. max 20 characters, minimum of 2 characters. + +
+
+
+Group Name - This is the description of the vicidial user group max of 40 characters. + +
+
+
+Allowed Campaigns - This is a selectable list of Campaigns to which members of this user group can log in to. The ALL-CAMPAIGNS option allows the users in this group to see and log in to any campaign on the system. + + + + + +



+ +VICIDIAL_SCRIPTS TABLE

+
+
+Script ID - This is the short name of a Vicidial Script. This needs to be a unique identifier. Try not to use any spaces or punctuation for this field. max 10 characters, minimum of 2 characters. + +
+
+Script Name - This is the title of a Vicidial Script. This is a short summary of the script. max 50 characters, minimum of 2 characters. There should be no spaces or punctuation of any kind in theis field. + +
+
+Script Comments - This is where you can place comments for a Vicidial Script such as -changed to free upgrade on Sept 23-. max 255 characters, minimum of 2 characters. + +
+
+Script Text - This is where you place the content of a Vicidial Script. Minimum of 2 characters. You can have customer information be auto-populated in this script using "--A--field--B--" where field is one of the following fieldnames: vendor_lead_code, source_id, list_id, gmt_offset_now, called_since_last_reset, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments, lead_id, campaign, phone_login, group, channel_group, SQLdate, epoch, uniqueid, customer_zap_channel, server_ip, SIPexten, session_id. For example, this sentence would print the persons name in it----

Hello, can I speak with --A--first_name--B-- --A--last_name--B-- please? Well hello --A--title--B-- --A--last_name--B-- how are you today?

This would read----

Hello, can I speak with John Doe please? Well hello Mr. Doe how are you today?

You can also use an iframe to load a separate window within the SCRIPT tab, here is an example with prepopulated variables: + +
+<iframe src="http://astguiclient.sf.net/test_VICIDIAL_output.php?lead_id=--A--lead_id--B--&vendor_id=--A--vendor_lead_code--B--&list_id=--A--list_id--B--&gmt_offset_now=--A--gmt_offset_now--B--&phone_code=--A--phone_code--B--&phone_number=--A--phone_number--B--&title=--A--title--B--&first_name=--A--first_name--B--&middle_initial=--A--middle_initial--B--&last_name=--A--last_name--B--&address1=--A--address1--B--&address2=--A--address2--B--&address3=--A--address3--B--&city=--A--city--B--&state=--A--state--B--&province=--A--province--B--&postal_code=--A--postal_code--B--&country_code=--A--country_code--B--&gender=--A--gender--B--&date_of_birth=--A--date_of_birth--B--&alt_phone=--A--alt_phone--B--&email=--A--email--B--&security_phrase=--A--security_phrase--B--&comments=--A--comments--B--&user=--A--user--B--&campaign=--A--campaign--B--&phone_login=--A--phone_login--B--&fronter=--A--fronter--B--&closer=--A--user--B--&group=--A--group--B--&channel_group=--A--group--B--&SQLdate=--A--SQLdate--B--&epoch=--A--epoch--B--&uniqueid=--A--uniqueid--B--&customer_zap_channel=--A--customer_zap_channel--B--&server_ip=--A--server_ip--B--&SIPexten=--A--SIPexten--B--&session_id=--A--session_id--B--&phone=--A--phone--B--" style="width:580;height:290;background-color:transparent;" scrolling="auto" frameborder="0" allowtransparency="true" id="popupFrame" name="popupFrame" width="460" height="290" STYLE="z-index:17"> +</iframe> +
+ +
+
+
+Active - This determines whether this script can be selected to be used by a campaign. + + + + + +



+ +VICIDIAL_LEAD_FILTERS TABLE

+
+
+Filter ID - This is the short name of a Vicidial Lead Filter. This needs to be a unique identifier. Do not use any spaces or punctuation for this field. max 10 characters, minimum of 2 characters. + +
+
+Filter Name - This is a more descriptive name of the Filter. This is a short summary of the filter. max 30 characters, minimum of 2 characters. + +
+
+Filter Comments - This is where you can place comments for a Vicidial Filter such as -calls all California leads-. max 255 characters, minimum of 2 characters. + +
+
+Filter SQL - This is where you place the SQL query fragment that you want to filter by. do not begin or end with an AND, that will be added by the hopper cron script automatically. an example SQL query that would work here is- called_count > 4 and called_count < 8 -. + + + + + +



+ +VICIDIAL_CALL TIMES TABLE

+
+
+Call Time ID - This is the short name of a Vicidial Call Time Definition. This needs to be a unique identifier. Do not use any spaces or punctuation for this field. max 10 characters, minimum of 2 characters. + +
+
+Call Time Name - This is a more descriptive name of the Call Time Definition. This is a short summary of the Call Time definition. max 30 characters, minimum of 2 characters. + +
+
+Call Time Comments - This is where you can place comments for a Vicidial Call Time Definition such as -10am to 4pm with extra call state restrictions-. max 255 characters. + +
+
+Default Start and Stop Times - This is the default time that calling will be allowed to be started or stopped within this call time definition if the day-of-the-week start time is not defined. 0 is midnight. To prevent calling completely set this field to 2400 and set the Default Stop time to 2400. To allow calling 24 hours a day set the start time to 0 and the stop time to 2400. + +
+
+Weekday Start and Stop Times - These are the custom times per day that can be set for the call time definition. same rules apply as with the Default start and stop times. + +
+
+State Call Time Definitions - This is the list of State specific call time definitions that are followed in this Call Time Definition. + +
+
+State Call Time State - This is the two letter code for the state that this calling time definition is for. For this to be in effect the local call time that is set in the campaign must have this state call time record in it as well as all of the leads having two letter state codes in them. + + + + +



+ +VICIDIAL LIST LOADER FUNCTIONALITY

+
+
+The VICIDIAL basic web-based lead loader is designed simply to take a lead file - up to 8MB in size - that is either tab or pipe delimited and load it into the vicidial_list table. The lead loader allows for field choosing and TXT- Plain Text, CSV- Comma Separated Values and XLS- Excel file formats. The lead loader does not do data validation, but it does allow you to check for duplicates in itself, within the campaign or within the entire system. Also, make sure that you have created the list that these leads are to be under so that you can use them. Here is a list of the fields in their proper order for the lead files: +
    +
  1. Vendor Lead Code - shows up in the Vendor ID field of the GUI +
  2. Source Code - internal use only for admins and DBAs +
  3. List ID - the list number that these leads will show up under +
  4. Phone Code - the prefix for the phone number - 1 for US, 01144 for UK, 01161 for AUS, etc +
  5. Phone Number - must be at least 8 digits long +
  6. Title - title of the customer - Mr. Ms. Mrs, etc... +
  7. First Name +
  8. Middle Initial +
  9. Last Name +
  10. Address Line 1 +
  11. Address Line 2 +
  12. Address Line 3 +
  13. City +
  14. State - limited to 2 characters +
  15. Province +
  16. Postal Code +
  17. Country +
  18. Gender +
  19. Date of Birth +
  20. Alternate Phone Number +
  21. Email Address +
  22. Security Phrase +
  23. Comments +
+ +
NOTES: The Excel Lead loader functionality is enabled by a series of perl scripts and needs to have a properly configured /etc/astguiclient.conf file in place on the web server. Also, a couple perl modules must be loaded for it to work as well - OLE-Storage_Lite and Spreadsheet-ParseExcel. You can check for runtime errors in these by looking at your apache error_log file. Also, for duplication checks against gampaign lists, the list that has new leads going into it does need to be created in the system before you start to load the leads. + + + + +



+ + + + + + +PHONES TABLE

+
+
+Phone extension - This field is where you put the phones name as it appears to Asterisk not including the protocol or slash at the beginning. For Example: for the SIP phone SIP/test101 the Phone extension would be test101. Also, for IAX2 phones make sure you use the full phones name: IAX2/IAXphone1@IAXphone1 would be IAXphone1@IAXphone1. For Zap phones make sure you put the full channel: Zap/25-1 would be 25-1. Another note, make sure you set the Protocol below correctly for your type of phone. + +
+
+
+Dial Plan Number - This field is for the number you dial to have the phone ring. This number is defined in the extensions.conf file of your Asterisk server + +
+
+
+Voicemail Box - This field is for the voicemail box that the messages go to for the user of this phone. We use this to check for voicemail messages and for the user to be able to use the VOICEMAIL button on astGUIclient app. + +
+
+
+Outbound CallerID - This field is where you would enter the callerID number that you would like to appear on outbound calls placed form the astguiclient web-client. This does not work on RBS, non-PRI, T1/E1s. + +
+
+
+Phone IP address - This field is for the phone's IP address if it is a VOIP phone. This is an optional field + +
+
+
+Computer IP address - This field is for the user's computer IP address. This is an optional field + +
+
+
+Server IP - This menu is where you select which server the phone is active on. + +
+
+
+Login - The login used for the phone user to login to the client applications. + +
+
+
+Password - The password used for the phone user to login to the client applications. + +
+
+
+Status - The status of the phone in the system, ACTIVE and ADMIN allow for GUI clients to work. ADMIN allows access to this administrative web site. All other statuses do not allow GUI or Admin web access. + +
+
+
+Active Account - Whether the phone is active to put it in the list in the GUI client. + +
+
+
+Phone Type - Purely for administrative notes. + +
+
+
+Full Name - Used by the GUIclient in the list of active phones. + +
+
+
+Company - Purely for administrative notes. + +
+
+
+Picture - Not yet Implemented. + +
+
+
+New Messages - Number of new voicemail messages for this phone on the Asterisk server. + +
+
+
+Old Messages - Number of old voicemail messages for this phone on the Asterisk server. + +
+
+
+Client Protocol - The protocol that the phone uses to connect to the Asterisk server: SIP, IAX2, Zap . Also, there is EXTERNAL for remote dial numbers or speed dial numbers that you want to list as phones. + +
+
+
+Local GMT - The difference from Greenwich Mean time, or ZULU time where the phone is located. DO NOT ADJUST FOR DAYLIGHT SAVINGS TIME. This is used by the VICIDIAL campaign to accurately display the time and customer time. + +
+
+
+Manager Login - This is the login that the GUI clients for this phone will use to access the Database where the server data resides. + +
+
+
+Manager Secret - This is the password that the GUI clients for this phone will use to access the Database where the server data resides. + +
+
+
+VICIDIAL Default User - This is to place a default value in the VICIDIAL user field whenever this phone user opens the astVICIDIAL client app. Leave blank for no user. + +
+
+
+VICIDIAL Default Pass - This is to place a default value in the VICIDIAL password field whenever this phone user opens the astVICIDIAL client app. Leave blank for no pass. + +
+
+
+VICIDIAL Default Campaign - This is to place a default value in the VICIDIAL campaign field whenever this phone user opens the astVICIDIAL client app. Leave blank for no campaign. + +
+
+
+Park Exten - This is the default Parking extension for the client apps. Verify that a different one works before you change this. + +
+
+
+Conf Exten - This is the default Conference park extension for the client apps. Verify that a different one works before you change this. + +
+
+
+VICIDIAL Park Exten - This is the default Parking extension for VICIDIAL client app. Verify that a different one works before you change this. + +
+
+
+VICIDIAL Park File - This is the default VICIDIAL park extension file name for the client apps. Verify that a different one works before you change this. limited to 10 characters. + +
+
+
+Monitor Prefix - This is the dial plan prefix for monitoring of Zap channels automatically within the astGUIclient app. Only change according to the extensions.conf ZapBarge extensions records. + +
+
+
+Recording Exten - This is the dial plan extension for the recording extension that is used to drop into meetme conferences to record them. It usually lasts upto one hour if not stopped. verify with extensions.conf file before changing. + +
+
+
+VMAIL Main Exten - This is the dial plan extension going to check your voicemail. verify with extensions.conf file before changing. + +
+
+
+VMAIL Dump Exten - This is the dial plan prefix used to send calls directly to a user's voicemail from a live call in the astGUIclient app. verify with extensions.conf file before changing. + +
+
+
+Exten Context - This is the dial plan context that this phone primarily uses. It is assumed that all numbers dialed by the client apps are using this context so it is a good idea to make sure this is the most wide context possible. verify with extensions.conf file before changing. + +
+
+
+DTMF send Channel - This is the channel string used to send DTMF sounds into meetme conferences from the client apps. Verify the exten and context with the extensions.conf file. + +
+
+
+Outbound Call Group - This is the channel group that outbound calls from this phone are placed out of. There are a couple routines in the client apps that use this. For Zap channels you want to use something like Zap/g2 , for IAX2 trunks you would want to use the full IAX prefix like IAX2/VICItest1:secret@10.10.10.15:4569. Verify the trunks with the extensions.conf file, it is usually what you have defined as the TRUNK global variable at the top of the file. + +
+
+
+Browser Location - This is applicable to only UNIX/LINUX clients, the absolute path to Mozilla or Firefox browser on the machine. verify this by launching it manually. + +
+
+
+Install Directory - This is the place where the astGUIclient and astVICIDIAL scripts are located on your machine. For Win32 it should be something like C:\AST_VICI and for UNIX it should be something like /usr/local/perl_TK. verify this manually. + +
+
+
+CallerID URL - This is the web address of the page used to do custom callerID lookups. default testing address is: http://astguiclient.sf.net/test_callerid_output.php + +
+
+
+VICIDIAL Default URL - This is the web address of the page used to do custom VICIDIAL Web Form queries. default testing address is: http://astguiclient.sf.net/test_VICIDIAL_output.php + +
+
+
+Call Logging - This is set to true if the call_log.agi file is in place in the extensions.conf file for all outbound and hang up 'h' extensions to log all calls. This should always be 1 because it is manditory for many astGUIclient and VICIDIAL features to work properly. + +
+
+
+User Switching - Set to true to allow user to switch to another user account. NOTE: If user switches they can initiate recording on the new user's phone conversation + +
+
+
+Conferencing - Set to true to allow user to start conference calls with upto six external lines. + +
+
+
+Admin Hang Up - Set to true to allow user to be able to hang up any line at will through astGUIclient. Good idea only to enable this for Admin users. + +
+
+
+Admin Hijack - Set to true to allow user to be able to grab and redirect to their extension any line at will through astGUIclient. Good idea only to enable this for Admin users. But is very useful for Managers. + +
+
+
+Admin Monitor - Set to true to allow user to be able to grab and redirect to their extension any line at will through astGUIclient. Good idea only to enable this for Admin users. But is very useful for Managers and as a training tool. + +
+
+
+Call Park - Set to true to allow user to be able to park calls on astGUIclient hold to be picked up by any other astGUIclient user on the system. Calls stay on hold for upto a half hour then hang up. Usually enabled for all. + +
+
+
+Updater Check - Set to true to display a popup warning that the updater time has not changed in 20 seconds. Useful for Admin users. + +
+
+
+AF Logging - Set to true to log many actions of astGUIclient usage to a text file on the user's computer. + +
+
+
+Queue Enabled - Set to true to have client apps use the Asterisk Central Queue system. Required for VICIDIAL and recommended for all users. + +
+
+
+CallerID Popup - Set to true to allow for numbers defined in the extensions.conf file to send CallerID popup screens to astGUIclient users. + +
+
+
+VMail Button - Set to true to display the VOICEMAIL button and the messages count display on astGUIclient. + +
+
+
+Fast Refresh - Set to true to enable a new rate of refresh of call information for the astGUIclient. Default disabled rate is 1000 ms ,1 second. Can increase system load if you lower this number. + +
+
+
+Fast Refresh Rate - in milliseconds. Only used if Fast Refresh is enabled. Default disabled rate is 1000 ms ,1 second. Can increase system load if you lower this number. + +
+
+
+Persistant MySQL - If enabled the astGUIclient connection will remain connected instead of connecting every second. Useful if you have a fast refresh rate set. It will increase the number of connections on your MySQL machine. + +
+
+
+Auto Dial Next Number - If enabled the VICIDIAL client will dial the next number on the list automatically upon disposition of a call unless they selected to "Stop Dialing" on the disposition screen. + +
+
+
+Stop Rec after each call - If enabled the VICIDIAL client will stop whatever recording is going on after each call has been dispositioned. Useful if you are doing a lot of recording or you are using a web form to trigger recording. + +
+
+
+Enable SIPSAK Messages - If enabled the server will send messages to the SIP phone to display on the phone LCD display when logged into VICIDIAL. Feature only works with SIP phones and requires sipsak application to be installed on the web server. Default is 0. + +
+
+
+DBX Server - The MySQL database server that this user should be connecting to. + +
+
+
+DBX Database - The MySQL database that this user should be connecting to. Default is asterisk. + +
+
+
+DBX User - The MySQL user login that this user should be using when connecting. Default is cron. + +
+
+
+DBX Pass - The MySQL user password that this user should be using when connecting. Default is 1234. + +
+
+
+DBX Port - The MySQL TCP port that this user should be using when connecting. Default is 3306. + +
+
+
+DBY Server - The MySQL database server that this user should be connecting to. Secondary server, not used currently. + +
+
+
+DBY Database - The MySQL database that this user should be connecting to. Default is asterisk. Secondary server, not used currently. + +
+
+
+DBY User - The MySQL user login that this user should be using when connecting. Default is cron. Secondary server, not used currently. + +
+
+
+DBY Pass - The MySQL user password that this user should be using when connecting. Default is 1234. Secondary server, not used currently. + +
+
+
+DBY Port - The MySQL TCP port that this user should be using when connecting. Default is 3306. Secondary server, not used currently. + + +



+ +SERVERS TABLE

+
+
+Server ID - This field is where you put the Asterisk servers name, doesnt have to be an official domain sub, just a nickname to identify the server to Admin users. + +
+
+
+Server Description - The field where you use a small phrase to describe the Asterisk server. + +
+
+
+Server IP Address - The field where you put the Network IP address of the Asterisk server. + +
+
+
+Active - Set whether the Asterisk server is active or inactive. + +
+
+
+Asterisk Version - Set the version of Asterisk that you have installed on this server. Examples: '1.2', '1.0.8', '1.0.7', 'CVS_HEAD', 'REALLY OLD', etc... This is used because versions 1.0.8 and 1.0.9 have a different method of dealing with Local/ channels, a bug that has been fixed in CVS v1.0, and need to be treated differently when handling their Local/ channels. Also, current CVS_HEAD and the 1.2 release tree uses different manager and command output so it must be treated differently as well. + +
+
+
+Max VICIDIAL Trunks - This field will determine the maximum number of lines that the VICIDIAL auto-dialer will attempt to call on this server. If you want to dedicate two full PRI T1s to VICIDIALing on a server then you would set this to 46. Default is 96. + +
+
+
+Telnet Host - This is the address or name of the Asterisk server and is how the manager applications connect to it from where they are running. If they are running on the Asterisk server, then the default of 'localhost' is fine. + +
+
+
+Telnet Port - This is the port of the Asterisk server Manager connection and is how the manager applications connect to it from where they are running. The default of '5038' is fine for a standard install. + +
+
+
+Manager User - The username or login used to connect genericly to the Asterisk server manager. Default is 'cron' + +
+
+
+Manager Secret - The secret or password used to connect genericly to the Asterisk server manager. Default is '1234' + +
+
+
+Manager Update User - The username or login used to connect to the Asterisk server manager optimized for the Update scripts. Default is 'updatecron' and assumes the same secret as the generic user. + +
+
+
+Manager Listen User - The username or login used to connect to the Asterisk server manager optimized for scripts that only listen for output. Default is 'listencron' and assumes the same secret as the generic user. + +
+
+
+Manager Send User - The username or login used to connect to the Asterisk server manager optimized for scripts that only send Actions to the manager. Default is 'sendcron' and assumes the same secret as the generic user. + +
+
+
+Server GMT offset - The difference in hours from GMT time not adjusted for Daylight-Savings-Time of the server. Default is '-5' + +
+
+
+VMail Dump Exten - The extension prefix used on this server to send calls directly through agc to a specific voicemail box. Default is '85026666666666' + +
+
+
+VICIDIAL AD extension - The default extension if none is present in the campaign to send calls to for VICIDIAL auto dialing. Default is '8365' + +
+
+
+Default Context - The default dial plan context used for scripts that operate for this server. Default is 'default' + +
+
+
+System Performance - Setting this option to Y will enable logging of system performance stats for the server machine including system load, system processes and Asterisk channels in use. Default is N. + +
+
+
+Server Logs - Setting this option to Y will enable logging of all VICIDIAL related scripts to their text log files. Setting this to N will stop writing logs to files for these processes, also the screen logging of asterisk will be disabled if this is set to N when Asterisk is started. Default is Y. + +
+
+
+AGI Output - Setting this option to NONE will disable output from all VICIDIAL related AGI scripts. Setting this to STDERR will send the AGI output to the Asterisk CLI. Setting this to FILE will send the output to a file in the logs directory. Setting this to BOTH will send output to both the Asterisk CLI and a log file. Default is FILE. + +
+
+
+VICIDIAL Balance Dialing - Setting this field to Y will allow the server to place balance calls for campaigns in VICIDIAL so that the defined dial level can be met even if there are no agents logged into that campaign on this server. Default is N. + +
+
+
+VICIDIAL Balance Offlimits - This setting defines the number of trunks to not allow VICIDIAL balance dialing to use. For example if you have 40 max vicidial trunks and balance offlimits is set to 10 you will only be able to use 30 trunk lines for VICIDIAL balance dialing. Default is 0. + + +



+ +CONFERENCES TABLE

+
+
+Conference Number - This field is where you put the meetme conference dialpna number. It is also recommended that the meetme number in meetme.conf matches this number for each entry. This is for the conferences in astGUIclient and is used for leave-3way-call functionality in VICIDIAL. + +
+
+
+Server IP - The menu where you select the Asterisk server that this conference will be on. + + + + +



+ +VICIDIAL_SERVER_TRUNKS TABLE

+
+
+VICIDIAL Server Trunks allows you to restrict the outgoing lines that are used on this server for campaign dialing on a per-campaign basis. You have the option to reserve a specific number of lines to be used by only one campaign as well as allowing that campaign to run over its reserved lines into whatever lines remain open, as long at the total lines used by vicidial on this server is less than the Max VICIDIAL Trunks setting. Not having any of these records will allow the campaign that dials the line first to have as many lines as it can get under the Max VICIDIAL Trunks setting. + + + + + +



+ +SYSTEM_SETTINGS TABLE

+
+
+Use Non-Latin - This option allows you to default the web display script to use UTF8 characters and not do any latin-character-family regular expression filtering or display formatting. Default is 0. + +
+
+
+Webroot Writable - This setting allows you to define whether temp files and authentication files should be placed in the webroot on your web server. Default is 1. + +
+
+
+Enable QueueMetrics Logging - This setting allows you to define whether VICIDIAL will insert log entries into the queue_log database table as Asterisk Queues activity does. QueueMetrics is a standalone, closed-source statistical analysis program. You must have QueueMetrics already installed and configured before enabling this feature. Default is 0. + +
+
+
+QueueMetrics Server IP - This is the IP address of the database for your QueueMetrics installation. + +
+
+
+QueueMetrics Database Name - This is the database name for your QueueMetrics database. + +
+
+
+QueueMetrics Database Login - This is the user name used to log in to your QueueMetrics database. + +
+
+
+QueueMetrics Database Password - This is the password used to log in to your QueueMetrics database. + +
+
+
+QueueMetrics URL - This is the URL or web site address used to get to your QueueMetrics installation. + +
+
+
+QueueMetrics Log ID - This is the server ID that all VICIDIAL logs going into the QueueMetrics database will use as an identifier for each record. + +
+
+
+QueueMetrics EnterQueue Prepend - This field is used to allow for prepending of one of the vicidial_list data fields in front of the phone number of the customer for customized QueueMetrics reports. Default is NONE to not populate anything. + +
+
+
+VICIDIAL Agent Disable Display - This field is used to select when to show an agent when their session has been disabled by the system, a manager action or by an external measure. The NOT_ACTIVE setting will disable the message on the agents screen. The LIVE_AGENT setting will only display the disabled message when the agents vicidial_auto_calls record has been removed, such as during a force logout or emergency logout. + +
+
+
+Allow SIPSAK Messages - If set to 1, this will allow the phones table setting to work properly, the server will send messages to the SIP phone to display on the phone LCD display when logged into VICIDIAL. This feature only works with SIP phones and requires sipsak application to be installed on the web server. Default is 0. + +
+
+
+Admin Home URL - This is the URL or web site address that you will go to if you click on the HOME link at the top of the admin.php page. + +
+
+
+Enable Agent Transfer Logfile - This option will log to a text logfile on the webserver every time a call is transferred to an agent. Default is 0, disabled. + + + + + +



+ +VICIDIAL_STATUSES TABLE

+
+
+Through the use of system statuses, you can have statuses that exist for campaign and in-group. The Status must be 1-6 characters in length, the description must be 2-30 characters in length and Selectable defines whether it shows up in VICIDIAL as an agent disposition. The human_answered field is used when calculating the drop percentage, or abandon rate. Setting human_answered to Y will use this status when counting the human-answered calls. The Category option allows you to group several statuses into a catogy that can be used for statistical analysis. + + +



+ +VICIDIAL_STATUS_CATEGORIES TABLE

+
+
+Through the use of system status categories, you can group together statuses to allow for statistical analysis on a group of statuses. The Category ID must be 2-20 characters in length with no spaces, the name must be 2-50 characters in length, the description is optional and TimeonVDAD Display defines whether that status will be one of the upto 4 statuses that can be calculated and displayed on the Time On VDAD Real-Time report. + + + + +







+







+THE END +
+\n"; + echo "\n"; + echo "\n"; + echo ""; + + $stmt="SELECT dial_statuses,local_call_time,lead_filter_id from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $dial_statuses = $row[0]; + $local_call_time = $row[1]; + if ($lead_filter_id=='') + { + $lead_filter_id = $row[2]; + if ($lead_filter_id=='') + { + $lead_filter_id='NONE'; + } + } + + $stmt="SELECT list_id,active,list_name from vicidial_lists where campaign_id='$campaign_id'"; + $rslt=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rslt); + $camp_lists=''; + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + if (ereg("Y", $rowx[1])) {$camp_lists .= "'$rowx[0]',";} + } + $camp_lists = eregi_replace(".$","",$camp_lists); + + $filterSQL = $filtersql_list[$lead_filter_id]; + $filterSQL = eregi_replace("^and|and$|^or|or$","",$filterSQL); + if (strlen($filterSQL)>4) + {$fSQL = "and $filterSQL";} + else + {$fSQL = '';} + + + echo "

\n"; + echo "Show Dialable Leads Count -

\n"; + echo "CAMPAIGN: $campaign_id
\n"; + echo "LISTS: $camp_lists
\n"; + echo "STATUSES: $dial_statuses
\n"; + echo "FILTER: $lead_filter_id
\n"; + echo "CALL TIME: $local_call_time

\n"; + + ### call function to calculate and print dialable leads + dialable_leads($DB,$link,$local_call_time,$dial_statuses,$camp_lists,$fSQL); + + echo "

\n"; + echo "\n"; + + exit; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=7111111 view sample script with test variables +###################### + +if ($ADD==7111111) +{ + ##### TEST VARIABLES ##### + $vendor_lead_code = 'VENDOR:LEAD;CODE'; + $list_id = 'LISTID'; + $gmt_offset_now = 'GMTOFFSET'; + $phone_code = '1'; + $phone_number = '7275551212'; + $title = 'Mr.'; + $first_name = 'JOHN'; + $middle_initial = 'Q'; + $last_name = 'PUBLIC'; + $address1 = '1234 Main St.'; + $address2 = 'Apt. 3'; + $address3 = 'ADDRESS3'; + $city = 'CHICAGO'; + $state = 'IL'; + $province = 'PROVINCE'; + $postal_code = '33760'; + $country_code = 'USA'; + $gender = 'M'; + $date_of_birth = '1970-01-01'; + $alt_phone = '3125551212'; + $email = 'test@test.com'; + $security_phrase = 'SECUTIRY'; + $comments = 'COMMENTS FIELD'; + $RGfullname = 'JOE AGENT'; + $RGuser = '6666'; + $RGlead_id = '1234'; + $RGcampaign = 'TESTCAMP'; + $RGphone_login = 'gs102'; + $RGgroup = 'TESTCAMP'; + $RGchannel_group = 'TESTCAMP'; + $RGSQLdate = date("Y-m-d H:i:s"); + $RGepoch = date("U"); + $RGuniqueid = '1163095830.4136'; + $RGcustomer_zap_channel = 'Zap/1-1'; + $RGserver_ip = '10.10.10.15'; + $RGSIPexten = 'SIP/gs102'; + $RGsession_id = '8600051'; + +echo "\n"; +echo "\n"; +echo "\n"; +echo ""; + +$stmt="SELECT * from vicidial_scripts where script_id='$script_id';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$script_name = $row[1]; +$script_text = $row[3]; + +if (eregi("iframe src",$script_text)) + { + $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(' ','+',$address2); + $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); + $RGfullname = eregi_replace(' ','+',$RGfullname); + $RGuser = eregi_replace(' ','+',$RGuser); + $RGlead_id = eregi_replace(' ','+',$RGlead_id); + $RGcampaign = eregi_replace(' ','+',$RGcampaign); + $RGphone_login = eregi_replace(' ','+',$RGphone_login); + $RGgroup = eregi_replace(' ','+',$RGgroup); + $RGchannel_group = eregi_replace(' ','+',$RGchannel_group); + $RGSQLdate = eregi_replace(' ','+',$RGSQLdate); + $RGepoch = eregi_replace(' ','+',$RGepoch); + $RGuniqueid = eregi_replace(' ','+',$RGuniqueid); + $RGcustomer_zap_channel = eregi_replace(' ','+',$RGcustomer_zap_channel); + $RGserver_ip = eregi_replace(' ','+',$RGserver_ip); + $RGSIPexten = eregi_replace(' ','+',$RGSIPexten); + $RGsession_id = eregi_replace(' ','+',$RGsession_id); + } + +$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--fullname--B--',"$RGfullname",$script_text); +$script_text = eregi_replace('--A--fronter--B--',"$RGuser",$script_text); +$script_text = eregi_replace('--A--user--B--',"$RGuser",$script_text); +$script_text = eregi_replace('--A--lead_id--B--',"$RGlead_id",$script_text); +$script_text = eregi_replace('--A--campaign--B--',"$RGcampaign",$script_text); +$script_text = eregi_replace('--A--phone_login--B--',"$RGphone_login",$script_text); +$script_text = eregi_replace('--A--group--B--',"$RGgroup",$script_text); +$script_text = eregi_replace('--A--channel_group--B--',"$RGchannel_group",$script_text); +$script_text = eregi_replace('--A--SQLdate--B--',"$RGSQLdate",$script_text); +$script_text = eregi_replace('--A--epoch--B--',"$RGepoch",$script_text); +$script_text = eregi_replace('--A--uniqueid--B--',"$RGuniqueid",$script_text); +$script_text = eregi_replace('--A--customer_zap_channel--B--',"$RGcustomer_zap_channel",$script_text); +$script_text = eregi_replace('--A--server_ip--B--',"$RGserver_ip",$script_text); +$script_text = eregi_replace('--A--SIPexten--B--',"$RGSIPexten",$script_text); +$script_text = eregi_replace('--A--session_id--B--',"$RGsession_id",$script_text); +$script_text = eregi_replace("\n","
",$script_text); + + +echo ""; + +echo "Preview Script: $script_id
\n"; +echo "
\n"; +echo "
$script_name
\n"; +echo "$script_text\n"; +echo "
\n"; + +echo "\n"; + +exit; +} + + + + +######################### HTML HEADER BEGIN ####################################### +if ($hh=='users') + {$users_hh="bgcolor =\"$users_color\""; $users_fc="$users_font"; $users_bold="$header_selected_bold";} + else {$users_hh=''; $users_fc='WHITE'; $users_bold="$header_nonselected_bold";} +if ($hh=='campaigns') + {$campaigns_hh="bgcolor=\"$campaigns_color\""; $campaigns_fc="$campaigns_font"; $campaigns_bold="$header_selected_bold";} + else {$campaigns_hh=''; $campaigns_fc='WHITE'; $campaigns_bold="$header_nonselected_bold";} +if ($hh=='lists') + {$lists_hh="bgcolor=\"$lists_color\""; $lists_fc="$lists_font"; $lists_bold="$header_selected_bold";} + else {$lists_hh=''; $lists_fc='WHITE'; $lists_bold="$header_nonselected_bold";} +if ($hh=='ingroups') + {$ingroups_hh="bgcolor=\"$ingroups_color\""; $ingroups_fc="$ingroups_font"; $ingroups_bold="$header_selected_bold";} + else {$ingroups_hh=''; $ingroups_fc='WHITE'; $ingroups_bold="$header_nonselected_bold";} +if ($hh=='remoteagent') + {$remoteagent_hh="bgcolor=\"$remoteagent_color\""; $remoteagent_fc="$remoteagent_font"; $remoteagent_bold="$header_selected_bold";} + else {$remoteagent_hh=''; $remoteagent_fc='WHITE'; $remoteagent_bold="$header_nonselected_bold";} +if ($hh=='usergroups') + {$usergroups_hh="bgcolor=\"$usergroups_color\""; $usergroups_fc="$usergroups_font"; $usergroups_bold="$header_selected_bold";} + else {$usergroups_hh=''; $usergroups_fc='WHITE'; $usergroups_bold="$header_nonselected_bold";} +if ($hh=='scripts') + {$scripts_hh="bgcolor=\"$scripts_color\""; $scripts_fc="$scripts_font"; $scripts_bold="$header_selected_bold";} + else {$scripts_hh=''; $scripts_fc='WHITE'; $scripts_bold="$header_nonselected_bold";} +if ($hh=='filters') + {$filters_hh="bgcolor=\"$filters_color\""; $filters_fc="$filters_font"; $filters_bold="$header_selected_bold";} + else {$filters_hh=''; $filters_fc='WHITE'; $filters_bold="$header_nonselected_bold";} +if ($hh=='admin') + {$admin_hh="bgcolor=\"$admin_color\""; $admin_fc="$admin_font"; $admin_bold="$header_selected_bold";} + else {$admin_hh=''; $admin_fc='WHITE'; $admin_bold="$header_nonselected_bold";} +if ($hh=='reports') + {$reports_hh="bgcolor=\"$reports_color\""; $reports_fc="$reports_font"; $reports_bold="$header_selected_bold";} + else {$reports_hh=''; $reports_fc='WHITE'; $reports_bold="$header_nonselected_bold";} + +echo "\n"; +echo " + + +\n"; + +$stmt="SELECT admin_home_url from system_settings;"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$admin_home_url_LU = $row[0]; + +?> +
+ BGCOLOR=#D9E6FE cellpadding=2 cellspacing=0> + + + + + + + + + + + + + + + 1) { + ?> +> + 1) + { + +# if ($sh=='basic') {$basic_sh="bgcolor=\"$subcamp_color\""; $basic_fc="$subcamp_font";} +# else {$basic_sh=''; $basic_fc='BLACK';} +# if ($sh=='detail') {$detail_sh="bgcolor=\"$subcamp_color\""; $detail_fc="$subcamp_font";} +# else {$detail_sh=''; $detail_fc='BLACK';} +# if ($sh=='dialstat') {$dialstat_sh="bgcolor=\"$subcamp_color\""; $dialstat_fc="$subcamp_font";} +# else {$dialstat_sh=''; $dialstat_fc='BLACK';} + + if ($sh=='basic') {$sh='list';} + if ($sh=='detail') {$sh='list';} + if ($sh=='dialstat') {$sh='list';} + + if ($sh=='list') {$list_sh="bgcolor=\"$subcamp_color\""; $list_fc="$subcamp_font";} + else {$list_sh=''; $list_fc='BLACK';} + if ($sh=='status') {$status_sh="bgcolor=\"$subcamp_color\""; $status_fc="$subcamp_font";} + else {$status_sh=''; $status_fc='BLACK';} + if ($sh=='hotkey') {$hotkey_sh="bgcolor=\"$subcamp_color\""; $hotkey_fc="$subcamp_font";} + else {$hotkey_sh=''; $hotkey_fc='BLACK';} + if ($sh=='recycle') {$recycle_sh="bgcolor=\"$subcamp_color\""; $recycle_fc="$subcamp_font";} + else {$recycle_sh=''; $recycle_fc='BLACK';} + if ($sh=='autoalt') {$autoalt_sh="bgcolor=\"$subcamp_color\""; $autoalt_fc="$subcamp_font";} + else {$autoalt_sh=''; $autoalt_fc='BLACK';} + if ($sh=='pause') {$pause_sh="bgcolor=\"$subcamp_color\""; $pause_fc="$subcamp_font";} + else {$pause_sh=''; $pause_fc='BLACK';} + if ($sh=='listmix') {$listmix_sh="bgcolor=\"$subcamp_color\""; $listmix_fc="$subcamp_font";} + else {$listmix_sh=''; $listmix_fc='BLACK';} + + ?> +> + + + + + + + + + 1) { + ?> + > + 1) { + ?> +> + 1) { + ?> +> + 1) { + ?> +> + 1) { + ?> +> + 1) { + ?> +> + 1) { + ?> +> + 1) { + if ($sh=='times') {$times_sh="bgcolor=\"$times_color\""; $times_fc="$times_font";} # hard teal + else {$times_sh=''; $times_fc='BLACK';} + if ($sh=='phones') {$phones_sh="bgcolor=\"$server_color\""; $phones_fc="$phones_font";} # pink + else {$phones_sh=''; $phones_fc='BLACK';} + if ($sh=='server') {$server_sh="bgcolor=\"$server_color\""; $server_fc="$server_font";} # pink + else {$server_sh=''; $server_fc='BLACK';} + if ($sh=='conference') {$conference_sh="bgcolor=\"$server_color\""; $conference_fc="$server_font";} # pink + else {$conference_sh=''; $conference_fc='BLACK';} + if ($sh=='settings') {$settings_sh="bgcolor=\"$settings_color\""; $settings_fc="$settings_font";} # pink + else {$settings_sh=''; $settings_fc='BLACK';} + if ($sh=='status') {$status_sh="bgcolor=\"$status_color\""; $status_fc="$status_font";} # pink + else {$status_sh=''; $status_fc='BLACK';} + + ?> +> + + + + + + + + 1) { + ?> + > + 1) { + ?> + > + 1) { + ?> + > + 1) { + ?> + > + 1) { + ?> + > + 1) { + ?> + > + \n"; + echo "You are not authorized to view this page. Please go back.\n"; + } + +} +if (strlen($reports_hh) > 1) { + ?> +> + + + + +
  VICIDIAL ADMIN - HOME | Logout  
> SIZE=> Users > SIZE=> Campaigns > SIZE=> Lists > SIZE=> Scripts > SIZE=> Filters > SIZE=> In-Groups > SIZE=> User Groups > SIZE=> Remote Agents > SIZE=> Admin > SIZE=> Reports
>   > Show Users     |     > Add A New User     |     > Copy User     |     > Search For A User
COLSPAN=2> SIZE=> Campaigns Main COLSPAN=1> SIZE=> Statuses COLSPAN=1> SIZE=> HotKeys COLSPAN=2> SIZE=> Lead Recycle COLSPAN=1> SIZE=> Auto-Alt Dial COLSPAN=1> SIZE=> Pause Codes COLSPAN=2> SIZE=> List Mix
>   > Show Campaigns     |     > Add A New Campaign     |     > Copy Campaign     |     > Real-Time Campaigns Summary
>   > Show Lists     |     > Add A New List     |     > Search For A Lead     |     > Add Number To DNC     |     > Load New Leads
>   > Show Scripts     |     > Add A New Script
>   > Show Filters     |     > Add A New Filter
>   > Show In-Groups     |     > Add A New In-Group     |     > Copy In-Group
>   > Show User Groups     |     > Add A New User Group     |     > Group Hourly Report
>   > Show Remote Agents     |     > Add New Remote Agents
COLSPAN=2> SIZE=> Call Times COLSPAN=2> SIZE=> Phones COLSPAN=2> SIZE=> Conferences COLSPAN=1> SIZE=> Servers COLSPAN=1> SIZE=> System Settings COLSPAN=2> SIZE=> System Statuses
>   > Show Call Times     |     > Add A New Call Time     |     > Show State Call Times     |     > Add A New State Call Time  
>   > Show Phones   |   > Add A New Phone
> Show Conferences   |   > Add A New Conference   |   > Show VICIDIAL Conferences   |   > Add A New VICIDIAL Conference
> Show Servers   |   > Add A New Server
> System Settings
> System Statuses   |   > Status Categories
>  
+
\n"; + echo ""; + + echo "
ADD A NEW USER
\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "$NWB#vicidial_users-user_group$NWE\n"; + echo "\n"; + echo "
User Number: $NWB#vicidial_users-user$NWE
Password: $NWB#vicidial_users-pass$NWE
Full Name: $NWB#vicidial_users-full_name$NWE
User Level: $NWB#vicidial_users-user_level$NWE
User Group:
Phone Login: $NWB#vicidial_users-phone_login$NWE
Phone Pass: $NWB#vicidial_users-phone_pass$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=1 display the COPY USER FORM SCREEN +###################### + +if ($ADD=="1A") +{ + if ($LOGmodify_users==1) + { + echo "
\n"; + echo ""; + + echo "
COPY USER\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + if ($LOGuser_level==9) {$levelMAX=10;} + else {$levelMAX=$LOGuser_level;} + + echo "\n"; + echo "\n"; + echo "
User Number: $NWB#vicidial_users-user$NWE
Password: $NWB#vicidial_users-pass$NWE
Full Name: $NWB#vicidial_users-full_name$NWE
Source User: $NWB#vicidial_users-user$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=11 display the ADD NEW CAMPAIGN FORM SCREEN +###################### + +if ($ADD==11) +{ + if ($LOGmodify_campaigns==1) + { + echo "
\n"; + echo ""; + + echo "
ADD A NEW CAMPAIGN\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Campaign ID: $NWB#vicidial_campaigns-campaign_id$NWE
Campaign Name: $NWB#vicidial_campaigns-campaign_name$NWE
Campaign Description: $NWB#vicidial_campaigns-campaign_description$NWE
Active: $NWB#vicidial_campaigns-active$NWE
Park Extension: $NWB#vicidial_campaigns-park_ext$NWE
Park Filename: $NWB#vicidial_campaigns-park_file_name$NWE
Web Form: $NWB#vicidial_campaigns-web_form_address$NWE
Allow Closers: $NWB#vicidial_campaigns-allow_closers$NWE
Hopper Level: $NWB#vicidial_campaigns-hopper_level$NWE
Auto Dial Level: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE
Next Agent Call: $NWB#vicidial_campaigns-next_agent_call$NWE
Local Call Time: $NWB#vicidial_campaigns-local_call_time$NWE
Voicemail: $NWB#vicidial_campaigns-voicemail_ext$NWE
Script: $NWB#vicidial_campaigns-campaign_script$NWE
Get Call Launch: $NWB#vicidial_campaigns-get_call_launch$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=12 display the COPY CAMPAIGN FORM SCREEN +###################### + +if ($ADD==12) +{ + if ($LOGmodify_campaigns==1) + { + echo "
\n"; + echo ""; + + echo "
COPY A CAMPAIGN\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + + echo "\n"; + echo "
Campaign ID: $NWB#vicidial_campaigns-campaign_id$NWE
Campaign Name: $NWB#vicidial_campaigns-campaign_name$NWE
Source Campaign: $NWB#vicidial_campaigns-campaign_id$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=111 display the ADD NEW LIST FORM SCREEN +###################### + +if ($ADD==111) +{ + if ($LOGmodify_lists==1) + { + echo "
\n"; + echo ""; + + echo "
ADD A NEW LIST\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
List ID: (digits only)$NWB#vicidial_lists-list_id$NWE
List Name: $NWB#vicidial_lists-list_name$NWE
List Description: $NWB#vicidial_lists-list_description$NWE
Campaign: $NWB#vicidial_lists-campaign_id$NWE
Active: $NWB#vicidial_lists-active$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=121 display the ADD NUMBER TO DNC FORM SCREEN and add a new number +###################### + +if ($ADD==121) +{ +echo "
\n"; +echo ""; + +if (strlen($phone_number) > 2) + { + $stmt="SELECT count(*) from vicidial_dnc where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
DNC NOT ADDED - This phone number is already in the Do Not Call List: $phone_number

\n";} + else + { + $stmt="INSERT INTO vicidial_dnc (phone_number) values('$phone_number');"; + $rslt=mysql_query($stmt, $link); + + echo "
DNC ADDED: $phone_number

\n"; + + ### LOG INSERTION TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW DNC NUMBER|$PHP_AUTH_USER|$ip|'$phone_number'|\n"); + fclose($fp); + } + } + } + +echo "
ADD A NUMBER TO THE DNC LIST\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "
Phone Number: (digits only)$NWB#vicidial_list-dnc$NWE
\n"; + +} + + +###################### +# ADD=1111 display the ADD NEW INBOUND GROUP SCREEN +###################### + +if ($ADD==1111) +{ + if ($LOGmodify_ingroups==1) + { + echo "
\n"; + echo ""; + + echo "
ADD A NEW INBOUND GROUP\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Group ID: (no spaces)$NWB#vicidial_inbound_groups-group_id$NWE
Group Name: $NWB#vicidial_inbound_groups-group_name$NWE
Group Color: $NWB#vicidial_inbound_groups-group_color$NWE
Active: $NWB#vicidial_inbound_groups-active$NWE
Web Form: $NWB#vicidial_inbound_groups-web_form_address$NWE
Voicemail: $NWB#vicidial_inbound_groups-voicemail_ext$NWE
Next Agent Call: $NWB#vicidial_inbound_groups-next_agent_call$NWE
Fronter Display: $NWB#vicidial_inbound_groups-fronter_display$NWE
Script: $NWB#vicidial_inbound_groups-ingroup_script$NWE
Get Call Launch: $NWB#vicidial_inbound_groups-get_call_launch$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=1211 display the COPY INBOUND GROUP SCREEN +###################### + +if ($ADD==1211) +{ + if ($LOGmodify_ingroups==1) + { + echo "
\n"; + echo ""; + + echo "
COPY INBOUND GROUP\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + + echo "\n"; + echo "
Group ID: (no spaces)$NWB#vicidial_inbound_groups-group_id$NWE
Group Name: $NWB#vicidial_inbound_groups-group_name$NWE
Source Group ID: $NWB#vicidial_inbound_groups-group_id$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=11111 display the ADD NEW REMOTE AGENTS SCREEN +###################### + +if ($ADD==11111) +{ + if ($LOGmodify_remoteagents==1) + { + echo "
\n"; + echo ""; + + echo "
ADD NEW REMOTE AGENTS\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
User ID Start: (numbers only, incremented)$NWB#vicidial_remote_agents-user_start$NWE
Number of Lines: (numbers only)$NWB#vicidial_remote_agents-number_of_lines$NWE
Server IP: $NWB#vicidial_remote_agents-server_ip$NWE
External Extension: (dial plan number dialed to reach agents)$NWB#vicidial_remote_agents-conf_exten$NWE
Status: $NWB#vicidial_remote_agents-status$NWE
Campaign: $NWB#vicidial_remote_agents-campaign_id$NWE
Inbound Groups: \n"; + echo "$groups_list"; + echo "$NWB#vicidial_remote_agents-closer_campaigns$NWE
\n"; + echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=111111 display the ADD NEW USERS GROUP SCREEN +###################### + +if ($ADD==111111) +{ + if ($LOGmodify_usergroups==1) + { + echo "
\n"; + echo ""; + + echo "
ADD NEW USERS GROUP\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Group: (no spaces or punctuation)$NWB#vicidial_user_groups-user_group$NWE
Description: (description of group)$NWB#vicidial_user_groups-group_name$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=1111111 display the ADD NEW SCRIPT SCREEN +###################### + +if ($ADD==1111111) +{ + if ($LOGmodify_scripts==1) + { + echo "
\n"; + echo ""; + + echo "
ADD NEW SCRIPT\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Script ID: (no spaces or punctuation)$NWB#vicidial_scripts-script_id$NWE
Script Name: (title of the script)$NWB#vicidial_scripts-script_name$NWE
Script Comments: $NWB#vicidial_scripts-script_comments$NWE
Active: $NWB#vicidial_scripts-active$NWE
Script Text: "; + # BEGIN Insert Field + echo ""; + echo "
"; + # END Insert Field + echo " $NWB#vicidial_scripts-script_text$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=11111111 display the ADD NEW FILTER SCREEN +###################### + +if ($ADD==11111111) +{ + if ($LOGmodify_filters==1) + { + echo "
\n"; + echo ""; + + echo "
ADD NEW FILTER\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Filter ID: (no spaces or punctuation)$NWB#vicidial_lead_filters-lead_filter_id$NWE
Filter Name: (short description of the filter)$NWB#vicidial_lead_filters-lead_filter_name$NWE
Filter Comments: $NWB#vicidial_lead_filters-lead_filter_comments$NWE
Filter SQL: $NWB#vicidial_lead_filters-lead_filter_sql$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=111111111 display the ADD NEW CALL TIME SCREEN +###################### + +if ($ADD==111111111) +{ + if ($LOGmodify_call_times==1) + { + echo "
\n"; + echo ""; + + echo "
ADD NEW CALL TIME\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "
Call Time ID: (no spaces or punctuation)$NWB#vicidial_call_times-call_time_id$NWE
Call Time Name: (short description of the call time)$NWB#vicidial_call_times-call_time_name$NWE
Call Time Comments: $NWB#vicidial_call_times-call_time_comments$NWE
Day and time options will appear once you have created the Call Time Definition
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=1111111111 display the ADD NEW STATE CALL TIME SCREEN +###################### + +if ($ADD==1111111111) +{ + if ($LOGmodify_call_times==1) + { + echo "
\n"; + echo ""; + + echo "
ADD NEW STATE CALL TIME\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "
State Call Time ID: (no spaces or punctuation)$NWB#vicidial_call_times-call_time_id$NWE
State Call Time State: (no spaces or punctuation)$NWB#vicidial_call_times-state_call_time_state$NWE
State Call Time Name: (short description of the call time)$NWB#vicidial_call_times-call_time_name$NWE
State Call Time Comments: $NWB#vicidial_call_times-call_time_comments$NWE
Day and time options will appear once you have created the Call Time Definition
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=11111111111 display the ADD NEW PHONE SCREEN +###################### + +if ($ADD==11111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + echo "
ADD A NEW PHONE\n"; + echo "\n"; + echo "
\n"; + + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Phone extension: $NWB#phones-extension$NWE
Dial Plan Number: (digits only)$NWB#phones-dialplan_number$NWE
Voicemail Box: (digits only)$NWB#phones-voicemail_id$NWE
Outbound CallerID: (digits only)$NWB#phones-outbound_cid$NWE
Phone IP address: (optional)$NWB#phones-phone_ip$NWE
Computer IP address: (optional)$NWB#phones-computer_ip$NWE
Server IP: $NWB#phones-server_ip$NWE
Login: $NWB#phones-login$NWE
Password: $NWB#phones-pass$NWE
Status: $NWB#phones-status$NWE
Active Account: $NWB#phones-active$NWE
Phone Type: $NWB#phones-phone_type$NWE
Full Name: $NWB#phones-fullname$NWE
Company: $NWB#phones-company$NWE
Picture: $NWB#phones-picture$NWE
Client Protocol: $NWB#phones-protocol$NWE
Local GMT: (Do NOT Adjust for DST)$NWB#phones-local_gmt$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=111111111111 display the ADD NEW SERVER SCREEN +###################### + +if ($ADD==111111111111) +{ + if ($LOGmodify_servers==1) + { + echo "
\n"; + echo ""; + + echo "
ADD A NEW SERVER\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Server ID: $NWB#servers-server_id$NWE
Server Description: $NWB#servers-server_description$NWE
Server IP Address: $NWB#servers-server_ip$NWE
Active: $NWB#servers-active$NWE
Asterisk Version: $NWB#servers-asterisk_version$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=1111111111111 display the ADD NEW CONFERENCE SCREEN +###################### + +if ($ADD==1111111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + echo "
ADD A NEW CONFERENCE\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Conference Number: (digits only)$NWB#conferences-conf_exten$NWE
Server IP: $NWB#conferences-server_ip$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=11111111111111 display the ADD NEW VICIDIAL CONFERENCE SCREEN +###################### + +if ($ADD==11111111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + echo "
ADD A NEW VICIDIAL CONFERENCE\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Conference Number: (digits only)$NWB#conferences-conf_exten$NWE
Server IP: $NWB#conferences-server_ip$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + + +###################################################################################################### +###################################################################################################### +####### 2 series, validates form data and inserts the new record into the database +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=2 adds the new user to the system +###################### + +if ($ADD=="2") +{ + echo ""; + $stmt="SELECT count(*) from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
USER NOT ADDED - there is already a user in the system with this user number\n";} + else + { + if ( (strlen($user) < 2) or (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user) > 8) ) + { + echo "
USER NOT ADDED - Please go back and look at the data you entered\n"; + echo "
user id must be between 2 and 8 characters long\n"; + echo "
full name and password must be at least 2 characters long\n"; + } + else + { + echo "
USER ADDED: $user\n"; + + $stmt="INSERT INTO vicidial_users (user,pass,full_name,user_level,user_group,phone_login,phone_pass) values('$user','$pass','$full_name','$user_level','$user_group','$phone_login','$phone_pass');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A USER |$PHP_AUTH_USER|$ip|'$user','$pass','$full_name','$user_level','$user_group','$phone_login','$phone_pass'|\n"); + fclose($fp); + } + } + } + +$ADD=3; +} + +###################### +# ADD=2A adds the copied new user to the system +###################### + +if ($ADD=="2A") +{ + echo ""; + $stmt="SELECT count(*) from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
USER NOT ADDED - there is already a user in the system with this user number\n";} + else + { + if ( (strlen($user) < 2) or (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user) > 8) ) + { + echo "
USER NOT ADDED - Please go back and look at the data you entered\n"; + echo "
user id must be between 2 and 8 characters long\n"; + echo "
full name and password must be at least 2 characters long\n"; + } + else + { + $stmt="INSERT INTO vicidial_users (user,pass,full_name,user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override) SELECT \"$user\",\"$pass\",\"$full_name\",user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override from vicidial_users where user=\"$source_user_id\";"; + $rslt=mysql_query($stmt, $link); + + $stmtA="INSERT INTO vicidial_inbound_group_agents (user,group_id,group_rank,group_weight,calls_today) SELECT \"$user\",group_id,group_rank,group_weight,\"0\" from vicidial_inbound_group_agents where user=\"$source_user_id\";"; + $rslt=mysql_query($stmtA, $link); + + $stmtA="INSERT INTO vicidial_campaign_agents (user,campaign_id,campaign_rank,campaign_weight,calls_today) SELECT \"$user\",campaign_id,campaign_rank,campaign_weight,\"0\" from vicidial_campaign_agents where user=\"$source_user_id\";"; + $rslt=mysql_query($stmtA, $link); + + echo "
USER COPIED: $user copied from $source_user_id\n"; + echo "

\n"; + echo "Click here to go to the user record\n"; + echo "

\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A COPIED USER |$PHP_AUTH_USER|$ip|$user|$source_user_id|$stmt|\n"); + fclose($fp); + } + } + } +exit; +} + +###################### +# ADD=21 adds the new campaign to the system +###################### + +if ($ADD==21) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN NOT ADDED - there is already a campaign in the system with this ID\n";} + else + { + $stmt="SELECT count(*) from vicidial_inbound_groups where group_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN NOT ADDED - there is already an inbound group in the system with this ID\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($campaign_id) > 8) or (strlen($campaign_name) < 6) or (strlen($campaign_name) > 40) ) + { + echo "
CAMPAIGN NOT ADDED - Please go back and look at the data you entered\n"; + echo "
campaign ID must be between 2 and 8 characters in length\n"; + echo "
campaign name must be between 6 and 40 characters in length\n"; + } + else + { + echo "
CAMPAIGN ADDED: $campaign_id\n"; + + $stmt="INSERT INTO vicidial_campaigns (campaign_id,campaign_name,campaign_description,active,dial_status_a,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,campaign_script,get_call_launch,campaign_changedate,campaign_stats_refresh,list_order_mix) values('$campaign_id','$campaign_name','$campaign_description','$active','NEW','DOWN','$park_ext','$park_file_name','" . mysql_real_escape_string($web_form_address) . "','$allow_closers','$hopper_level','$auto_dial_level','$next_agent_call','$local_call_time','$voicemail_ext','$script_id','$get_call_launch','$SQLdate','Y','DISABLED');"; + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_campaign_stats (campaign_id) values('$campaign_id');"; + $rslt=mysql_query($stmt, $link); + + echo ""; + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW CAMPAIGN |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + } + } + } +$ADD=31; +} + +###################### +# ADD=20 adds copied new campaign to the system +###################### + +if ($ADD==20) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN NOT ADDED - there is already a campaign in the system with this ID\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($campaign_id) > 8) or (strlen($campaign_name) < 2) or (strlen($source_campaign_id) < 2) or (strlen($source_campaign_id) > 8) ) + { + echo "
CAMPAIGN NOT ADDED - Please go back and look at the data you entered\n"; + echo "
campaign ID must be between 2 and 8 characters in length\n"; + echo "
source campaign ID must be between 2 and 8 characters in length\n"; + } + else + { + echo "
CAMPAIGN COPIED: $campaign_id copied from $source_campaign_id\n"; + + $stmt="INSERT INTO vicidial_campaigns (campaign_name,campaign_id,active,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,safe_harbor_message,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,list_order_mix,campaign_allow_inbound,manual_dial_list_id,default_xfer_group) SELECT \"$campaign_name\",\"$campaign_id\",\"N\",dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,safe_harbor_message,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,\"DISABLED\",campaign_allow_inbound,manual_dial_list_id,default_xfer_group from vicidial_campaigns where campaign_id='$source_campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmtA="INSERT INTO vicidial_campaign_stats (campaign_id) values('$campaign_id');"; + $rslt=mysql_query($stmtA, $link); + + $stmtA="INSERT INTO vicidial_campaign_statuses (status,status_name,selectable,campaign_id,human_answered,category) SELECT status,status_name,selectable,\"$campaign_id\",human_answered,category from vicidial_campaign_statuses where campaign_id='$source_campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + $stmtA="INSERT INTO vicidial_campaign_hotkeys (status,hotkey,status_name,selectable,campaign_id) SELECT status,hotkey,status_name,selectable,\"$campaign_id\" from vicidial_campaign_hotkeys where campaign_id='$source_campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + $stmtA="INSERT INTO vicidial_lead_recycle (status,attempt_delay,attempt_maximum,active,campaign_id) SELECT status,attempt_delay,attempt_maximum,active,\"$campaign_id\" from vicidial_lead_recycle where campaign_id='$source_campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + $stmtA="INSERT INTO vicidial_pause_codes (pause_code,pause_code_name,billable,campaign_id) SELECT pause_code,pause_code_name,billable,\"$campaign_id\" from vicidial_pause_codes where campaign_id='$source_campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + echo ""; + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|COPY TO NEW CAMPAIGN|$PHP_AUTH_USER|$ip|$campaign_id|$source_campaign_id|$stmt|$stmtA|\n"); + fclose($fp); + } + + } + } +$ADD=31; +} + +###################### +# ADD=22 adds the new campaign status to the system +###################### + +if ($ADD==22) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN STATUS NOT ADDED - there is already a campaign-status in the system with this name\n";} + else + { + $stmt="SELECT count(*) from vicidial_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN STATUS NOT ADDED - there is already a global-status in the system with this name\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($status_name) < 2) ) + { + echo "
CAMPAIGN STATUS NOT ADDED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 8 characters in length\n"; + echo "
status name must be between 2 and 30 characters in length\n"; + } + else + { + echo "
CAMPAIGN STATUS ADDED: $campaign_id - $status\n"; + + $stmt="INSERT INTO vicidial_campaign_statuses (status,status_name,selectable,campaign_id,human_answered,category) values('$status','$status_name','$selectable','$campaign_id','$human_answered','$category');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW CAMPAIGN STATUS |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } +$SUB=22; +$ADD=31; +} + + +###################### +# ADD=23 adds the new campaign hotkey to the system +###################### + +if ($ADD==23) +{ + $HKstatus_data = explode('-----',$HKstatus); + $status = $HKstatus_data[0]; + $status_name = $HKstatus_data[1]; + + echo ""; + $stmt="SELECT count(*) from vicidial_campaign_hotkeys where campaign_id='$campaign_id' and hotkey='$hotkey' and hotkey='$hotkey';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN HOT KEY NOT ADDED - there is already a campaign-hotkey in the system with this hotkey\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($hotkey) < 1) ) + { + echo "
CAMPAIGN HOT KEY NOT ADDED - Please go back and look at the data you entered\n"; + echo "
hotkey must be a single character between 1 and 9 \n"; + echo "
status must be between 1 and 8 characters in length\n"; + } + else + { + echo "
CAMPAIGN HOT KEY ADDED: $campaign_id - $status - $hotkey\n"; + + $stmt="INSERT INTO vicidial_campaign_hotkeys values('$status','$hotkey','$status_name','$selectable','$campaign_id');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW CAMPAIGN HOT KEY |$PHP_AUTH_USER|$ip|'$status','$hotkey','$status_name','$selectable','$campaign_id'|\n"); + fclose($fp); + } + } + } +$SUB=23; +$ADD=31; +} + + +###################### +# ADD=25 adds the new campaign lead recycle entry to the system +###################### + +if ($ADD==25) +{ + $status = eregi_replace("-----.*",'',$status); + echo ""; + $stmt="SELECT count(*) from vicidial_lead_recycle where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN LEAD RECYCLE NOT ADDED - there is already a lead-recycle for this campaign with this status\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or ($attempt_delay < 120) or ($attempt_maximum < 1) or ($attempt_maximum > 10) ) + { + echo "
CAMPAIGN LEAD RECYCLE NOT ADDED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 6 characters in length\n"; + echo "
attempt delay must be at least 120 seconds\n"; + echo "
maximum attempts must be from 1 to 10\n"; + } + else + { + echo "
CAMPAIGN LEAD RECYCLE ADDED: $campaign_id - $status - $attempt_delay\n"; + + $stmt="INSERT INTO vicidial_lead_recycle(campaign_id,status,attempt_delay,attempt_maximum,active) values('$campaign_id','$status','$attempt_delay','$attempt_maximum','$active');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW LEAD RECYCLE |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$SUB=25; +$ADD=31; +} + + +###################### +# ADD=26 adds the new auto alt dial status to the campaign +###################### + +if ($ADD==26) +{ + $status = eregi_replace("-----.*",'',$status); + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and auto_alt_dial_statuses LIKE \"% $status %\";"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
AUTO ALT DIAL STATUS NOT ADDED - there is already an entry for this campaign with this status\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
AUTO ALT DIAL STATUS NOT ADDED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 6 characters in length\n"; + } + else + { + echo "
AUTO ALT DIAL STATUS ADDED: $campaign_id - $status\n"; + + $stmt="SELECT auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if (strlen($row[0])<2) {$row[0] = ' -';} + $auto_alt_dial_statuses = " $status$row[0]"; + $stmt="UPDATE vicidial_campaigns set auto_alt_dial_statuses='$auto_alt_dial_statuses' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A AUTO-ALT-DIAL STATUS|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$SUB=26; +$ADD=31; +} + + +###################### +# ADD=27 adds the new campaign agent pause code entry to the system +###################### + +if ($ADD==27) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_pause_codes where campaign_id='$campaign_id' and pause_code='$pause_code';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
AGENT PAUSE CODE NOT ADDED - there is already an entry for this campaign with this pause code\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($pause_code) < 1) or (strlen($pause_code) > 6) or (strlen($pause_code_name) < 2) ) + { + echo "
AGENT PAUSE CODE NOT ADDED - Please go back and look at the data you entered\n"; + echo "
pause code must be between 1 and 6 characters in length\n"; + echo "
pause code name must be between 2 and 30 characters in length\n"; + } + else + { + echo "
AGENT PAUSE CODE ADDED: $campaign_id - $pause_code - $pause_code_name\n"; + + $stmt="INSERT INTO vicidial_pause_codes(campaign_id,pause_code,pause_code_name,billable) values('$campaign_id','$pause_code','$pause_code_name','$billable');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW AGENT PAUSE CODE|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$SUB=27; +$ADD=31; +} + + +###################### +# ADD=28 adds new status to the campaign dial statuses +###################### + +if ($ADD==28) +{ + $status = eregi_replace("-----.*",'',$status); + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and dial_statuses LIKE \"% $status %\";"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN DIAL STATUS NOT ADDED - there is already an entry for this campaign with this status\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
CAMPAIGN DIAL STATUS NOT ADDED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 6 characters in length\n"; + } + else + { + echo "
CAMPAIGN DIAL STATUS ADDED: $campaign_id - $status\n"; + + $stmt="SELECT dial_statuses from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if (strlen($row[0])<2) {$row[0] = ' -';} + $dial_statuses = " $status$row[0]"; + $stmt="UPDATE vicidial_campaigns set dial_statuses='$dial_statuses' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD CAMPAIGN DIAL STATUS |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +#$SUB=28; +$ADD=31; +} + + +###################### +# ADD=211 adds the new list to the system +###################### + +if ($ADD==211) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
LIST NOT ADDED - there is already a list in the system with this ID\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($list_name) < 2) or ($list_id < 100) or (strlen($list_id) > 8) ) + { + echo "
LIST NOT ADDED - Please go back and look at the data you entered\n"; + echo "
List ID must be between 2 and 8 characters in length\n"; + echo "
List name must be at least 2 characters in length\n"; + echo "
List ID must be greater than 100\n"; + } + else + { + echo "
LIST ADDED: $list_id\n"; + + $stmt="INSERT INTO vicidial_lists (list_id,list_name,campaign_id,active,list_description,list_changedate) values('$list_id','$list_name','$campaign_id','$active','$list_description','$SQLdate');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW LIST |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=311; +} + + + +###################### +# ADD=2111 adds the new inbound group to the system +###################### + +if ($ADD==2111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_inbound_groups where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
GROUP NOT ADDED - there is already a group in the system with this ID\n";} + else + { + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
GROUP NOT ADDED - there is already a campaign in the system with this ID\n";} + else + { + if ( (strlen($group_id) < 2) or (strlen($group_name) < 2) or (strlen($group_color) < 2) or (strlen($group_id) > 20) or (eregi(' ',$group_id)) or (eregi("\-",$group_id)) or (eregi("\+",$group_id)) ) + { + echo "
GROUP NOT ADDED - Please go back and look at the data you entered\n"; + echo "
Group ID must be between 2 and 20 characters in length and contain no ' -+'.\n"; + echo "
Group name and group color must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_inbound_groups (group_id,group_name,group_color,active,web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch) values('$group_id','$group_name','$group_color','$active','" . mysql_real_escape_string($web_form_address) . "','$voicemail_ext','$next_agent_call','$fronter_display','$script_id','$get_call_launch');"; + $rslt=mysql_query($stmt, $link); + + echo "
GROUP ADDED: $group_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW GROUP |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } +$ADD=3111; +} + + +###################### +# ADD=2011 adds copied inbound group to the system +###################### + +if ($ADD==2011) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_inbound_groups where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
GROUP NOT ADDED - there is already a group in the system with this ID\n";} + else + { + if ( (strlen($group_id) < 2) or (strlen($group_name) < 2) or (strlen($group_id) > 20) or (eregi(' ',$group_id)) or (eregi("\-",$group_id)) or (eregi("\+",$group_id)) ) + { + echo "
GROUP NOT ADDED - Please go back and look at the data you entered\n"; + echo "
Group ID must be between 2 and 20 characters in length and contain no ' -+'.\n"; + echo "
Group name and group color must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_inbound_groups (group_id,group_name,group_color,active,web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_message,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group) SELECT \"$group_id\",\"$group_name\",group_color,\"N\",web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_message,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group from vicidial_inbound_groups where group_id=\"$source_group_id\";"; + $rslt=mysql_query($stmt, $link); + + echo "
GROUP ADDED: $group_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|COPIED TO NEW GROUP |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=3111; +} + + +###################### +# ADD=21111 adds new remote agents to the system +###################### + +if ($ADD==21111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_remote_agents where server_ip='$server_ip' and user_start='$user_start';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
REMOTE AGENTS NOT ADDED - there is already a remote agents entry starting with this userID\n";} + else + { + if ( (strlen($server_ip) < 2) or (strlen($user_start) < 2) or (strlen($campaign_id) < 2) or (strlen($conf_exten) < 2) ) + { + echo "
REMOTE AGENTS NOT ADDED - Please go back and look at the data you entered\n"; + echo "
User ID start and external extension must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_remote_agents values('','$user_start','$number_of_lines','$server_ip','$conf_exten','$status','$campaign_id','$groups_value');"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOTE AGENTS ADDED: $user_start\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW REMOTE AGENTS ENTRY |$PHP_AUTH_USER|$ip|'$user_start','$number_of_lines','$server_ip','$conf_exten','$status','$campaign_id','$groups_value'|\n"); + fclose($fp); + } + } + } +$ADD=10000; +} + +###################### +# ADD=211111 adds new user group to the system +###################### + +if ($ADD==211111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_user_groups where user_group='$user_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
USER GROUP NOT ADDED - there is already a user group entry with this name\n";} + else + { + if ( (strlen($user_group) < 2) or (strlen($group_name) < 2) ) + { + echo "
USER GROUP NOT ADDED - Please go back and look at the data you entered\n"; + echo "
Group name and description must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_user_groups(user_group,group_name,allowed_campaigns) values('$user_group','$group_name','-ALL-CAMPAIGNS-');"; + $rslt=mysql_query($stmt, $link); + + echo "
USER GROUP ADDED: $user_group\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW USER GROUP ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=100000; +} + +###################### +# ADD=2111111 adds new script to the system +###################### + +if ($ADD==2111111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_scripts where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
SCRIPT NOT ADDED - there is already a script entry with this name\n";} + else + { + if ( (strlen($script_id) < 2) or (strlen($script_name) < 2) or (strlen($script_text) < 2) ) + { + echo "
SCRIPT NOT ADDED - Please go back and look at the data you entered\n"; + echo "
Script name, description and text must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_scripts values('$script_id','$script_name','$script_comments','$script_text','$active');"; + $rslt=mysql_query($stmt, $link); + + echo "
SCRIPT ADDED: $script_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW SCRIPT ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=1000000; +} + + +###################### +# ADD=21111111 adds new filter to the system +###################### + +if ($ADD==21111111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_lead_filters where lead_filter_id='$lead_filter_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
FILTER NOT ADDED - there is already a filter entry with this ID\n";} + else + { + if ( (strlen($lead_filter_id) < 2) or (strlen($lead_filter_name) < 2) or (strlen($lead_filter_sql) < 2) ) + { + echo "
FILTER NOT ADDED - Please go back and look at the data you entered\n"; + echo "
Filter ID, name and SQL must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_lead_filters SET lead_filter_id='$lead_filter_id',lead_filter_name='$lead_filter_name',lead_filter_comments='$lead_filter_comments',lead_filter_sql='$lead_filter_sql';"; + $rslt=mysql_query($stmt, $link); + + echo "
FILTER ADDED: $lead_filter_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW FILTER ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=10000000; +} + + +###################### +# ADD=211111111 adds new call time definition to the system +###################### + +if ($ADD==211111111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_call_times where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CALL TIME DEFINITION NOT ADDED - there is already a call time entry with this ID\n";} + else + { + if ( (strlen($call_time_id) < 2) or (strlen($call_time_name) < 2) ) + { + echo "
CALL TIME DEFINITION NOT ADDED - Please go back and look at the data you entered\n"; + echo "
Call Time ID and name must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_call_times SET call_time_id='$call_time_id',call_time_name='$call_time_name',call_time_comments='$call_time_comments';"; + $rslt=mysql_query($stmt, $link); + + echo "
CALL TIME ADDED: $call_time_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW CALL TIME ENTRY |$stmt|\n"); + fclose($fp); + } + } + } +$ADD=311111111; +} + + +###################### +# ADD=2111111111 adds new state call time definition to the system +###################### + +if ($ADD==2111111111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_state_call_times where state_call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
STATE CALL TIME DEFINITION NOT ADDED - there is already a call time entry with this ID\n";} + else + { + if ( (strlen($call_time_id) < 2) or (strlen($call_time_name) < 2) or (strlen($state_call_time_state) < 2) ) + { + echo "
STATE CALL TIME DEFINITION NOT ADDED - Please go back and look at the data you entered\n"; + echo "
State Call Time ID, name and state must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_state_call_times SET state_call_time_id='$call_time_id',state_call_time_name='$call_time_name',state_call_time_comments='$call_time_comments',state_call_time_state='$state_call_time_state';"; + $rslt=mysql_query($stmt, $link); + + echo "
STATE CALL TIME ADDED: $call_time_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW STATE CALL TIME ENTRY|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=3111111111; +} + + +###################### +# ADD=21111111111 adds new phone to the system +###################### + +if ($ADD==21111111111) +{ +echo "
\n"; + echo ""; + $stmt="SELECT count(*) from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
PHONE NOT ADDED - there is already a Phone in the system with this extension/server\n";} + else + { + if ( (strlen($extension) < 1) or (strlen($server_ip) < 7) or (strlen($dialplan_number) < 1) or (strlen($voicemail_id) < 1) or (strlen($login) < 1) or (strlen($pass) < 1)) + {echo "
PHONE NOT ADDED - Please go back and look at the data you entered\n";} + else + { + echo "
PHONE ADDED\n"; + + $stmt="INSERT INTO phones (extension,dialplan_number,voicemail_id,phone_ip,computer_ip,server_ip,login,pass,status,active,phone_type,fullname,company,picture,protocol,local_gmt,outbound_cid) values('$extension','$dialplan_number','$voicemail_id','$phone_ip','$computer_ip','$server_ip','$login','$pass','$status','$active','$phone_type','$fullname','$company','$picture','$protocol','$local_gmt','$outbound_cid');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=31111111111; +} + + +###################### +# ADD=211111111111 adds new server to the system +###################### + +if ($ADD==211111111111) +{ +echo "
\n"; + echo ""; + $stmt="SELECT count(*) from servers where server_id='$server_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
SERVER NOT ADDED - there is already a server in the system with this ID\n";} + else + { + if ( (strlen($server_id) < 1) or (strlen($server_ip) < 7) ) + {echo "
SERVER NOT ADDED - Please go back and look at the data you entered\n";} + else + { + echo "
SERVER ADDED\n"; + + $stmt="INSERT INTO servers (server_id,server_description,server_ip,active,asterisk_version) values('$server_id','$server_description','$server_ip','$active','$asterisk_version');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=311111111111; +} + + +###################### +# ADD=221111111111 adds the new vicidial server trunk record to the system +###################### + +if ($ADD==221111111111) +{ + echo ""; + $stmt="SELECT max_vicidial_trunks from servers where server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $MAXvicidial_trunks = $rowx[0]; + + $stmt="SELECT sum(dedicated_trunks) from vicidial_server_trunks where server_ip='$server_ip' and campaign_id !='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $SUMvicidial_trunks = ($rowx[0] + $dedicated_trunks); + + if ($SUMvicidial_trunks > $MAXvicidial_trunks) + { + echo "
VICIDIAL SERVER TRUNK RECORD NOT ADDED - the number of vicidial trunks is too high: $SUMvicidial_trunks / $MAXvicidial_trunks\n"; + } + else + { + $stmt="SELECT count(*) from vicidial_server_trunks where campaign_id='$campaign_id' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
VICIDIAL SERVER TRUNK RECORD NOT ADDED - there is already a server-trunk record for this campaign\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($server_ip) < 7) or (strlen($dedicated_trunks) < 1) or (strlen($trunk_restriction) < 1) ) + { + echo "
VICIDIAL SERVER TRUNK RECORD NOT ADDED - Please go back and look at the data you entered\n"; + echo "
campaign must be between 3 and 8 characters in length\n"; + echo "
server_ip delay must be at least 7 characters\n"; + echo "
trunks must be a digit from 0 to 9999\n"; + } + else + { + echo "
VICIDIAL SERVER TRUNK RECORD ADDED: $campaign_id - $server_ip - $dedicated_trunks - $trunk_restriction\n"; + + $stmt="INSERT INTO vicidial_server_trunks(server_ip,campaign_id,dedicated_trunks,trunk_restriction) values('$server_ip','$campaign_id','$dedicated_trunks','$trunk_restriction');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW VICIDIAL TRUNK |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } +$ADD=311111111111; +} + + +###################### +# ADD=2111111111111 adds new conference to the system +###################### + +if ($ADD==2111111111111) +{ +echo "
\n"; + echo ""; + $stmt="SELECT count(*) from conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CONFERENCE NOT ADDED - there is already a conference in the system with this ID and server\n";} + else + { + if ( (strlen($conf_exten) < 1) or (strlen($server_ip) < 7) ) + {echo "
CONFERENCE NOT ADDED - Please go back and look at the data you entered\n";} + else + { + echo "
CONFERENCE ADDED\n"; + + $stmt="INSERT INTO conferences (conf_exten,server_ip) values('$conf_exten','$server_ip');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=3111111111111; +} + + +###################### +# ADD=21111111111111 adds new vicidial conference to the system +###################### + +if ($ADD==21111111111111) +{ +echo "
\n"; + echo ""; + $stmt="SELECT count(*) from vicidial_conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
VICIDIAL CONFERENCE NOT ADDED - there is already a vicidial conference in the system with this ID and server\n";} + else + { + if ( (strlen($conf_exten) < 1) or (strlen($server_ip) < 7) ) + {echo "
VICIDIAL CONFERENCE NOT ADDED - Please go back and look at the data you entered\n";} + else + { + echo "
VICIDIAL CONFERENCE ADDED\n"; + + $stmt="INSERT INTO vicidial_conferences (conf_exten,server_ip) values('$conf_exten','$server_ip');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=31111111111111; +} + + +###################### +# ADD=221111111111111 adds the new system status to the system +###################### + +if ($ADD==221111111111111) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaign_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
SYSTEM STATUS NOT ADDED - there is already a campaign-status in the system with this name: $row[0]\n";} + else + { + $stmt="SELECT count(*) from vicidial_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
SYSTEM STATUS NOT ADDED - there is already a global-status in the system with this name\n";} + else + { + if ( (strlen($status) < 1) or (strlen($status_name) < 2) ) + { + echo "
SYSTEM STATUS NOT ADDED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 8 characters in length\n"; + echo "
status name must be between 2 and 30 characters in length\n"; + } + else + { + echo "
SYSTEM STATUS ADDED: $status_name - $status\n"; + + $stmt="INSERT INTO vicidial_statuses (status,status_name,selectable,human_answered,category) values('$status','$status_name','$selectable','$human_answered','$category');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW SYSTEM STATUS |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } +$ADD=321111111111111; +} + + +###################### +# ADD=231111111111111 adds the new status category to the system +###################### + +if ($ADD==231111111111111) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_status_categories where vsc_id='$vsc_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
STATUS CATEGORY NOT ADDED - there is already a status category in the system with this ID: $row[0]\n";} + else + { + if ( (strlen($vsc_id) < 2) or (strlen($vsc_id) > 20) or (strlen($vsc_name) < 2) ) + { + echo "
STATUS CATEGORY NOT ADDED - Please go back and look at the data you entered\n"; + echo "
ID must be between 2 and 20 characters in length\n"; + echo "
name name must be between 2 and 50 characters in length\n"; + } + else + { + echo "
STATUS CATEGORY ADDED: $vsc_id - $vsc_name\n"; + + $stmt="SELECT count(*) from vicidial_status_categories where tovdad_display='Y' and vsc_id NOT IN('$vsc_id');"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 3) and (ereg('Y',$tovdad_display)) ) + { + $tovdad_display = 'N'; + echo "
ERROR: There are already 4 Status Categories set to TimeOnVDAD Display\n"; + } + + $stmt="INSERT INTO vicidial_status_categories (vsc_id,vsc_name,vsc_description,tovdad_display) values('$vsc_id','$vsc_name','$vsc_description','$tovdad_display');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW STATUS CATEGORY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=331111111111111; +} + + + +###################################################################################################### +###################################################################################################### +####### 4 series, record modifications submitted and DB is modified, then on to 3 series forms below +###################################################################################################### +###################################################################################################### + + + +###################### +# ADD=4A submit user modifications to the system - ADMIN +###################### + +if ($ADD=="4A") +{ + if ($LOGmodify_users==1) + { + echo ""; + + if ( (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) + { + echo "
USER NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Password and Full Name each need ot be at least 2 characters in length\n"; + } + else + { + echo "
USER MODIFIED - ADMIN: $user\n"; + + $stmt="UPDATE vicidial_users set pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass',delete_users='$delete_users',delete_user_groups='$delete_user_groups',delete_lists='$delete_lists',delete_campaigns='$delete_campaigns',delete_ingroups='$delete_ingroups',delete_remote_agents='$delete_remote_agents',load_leads='$load_leads',campaign_detail='$campaign_detail',ast_admin_access='$ast_admin_access',ast_delete_phones='$ast_delete_phones',delete_scripts='$delete_scripts',modify_leads='$modify_leads',hotkeys_active='$hotkeys_active',change_agent_campaign='$change_agent_campaign',agent_choose_ingroups='$agent_choose_ingroups',closer_campaigns='$groups_value',scheduled_callbacks='$scheduled_callbacks',agentonly_callbacks='$agentonly_callbacks',agentcall_manual='$agentcall_manual',vicidial_recording='$vicidial_recording',vicidial_transfers='$vicidial_transfers',delete_filters='$delete_filters',alter_agent_interface_options='$alter_agent_interface_options',closer_default_blended='$closer_default_blended',delete_call_times='$delete_call_times',modify_call_times='$modify_call_times',modify_users='$modify_users',modify_campaigns='$modify_campaigns',modify_lists='$modify_lists',modify_scripts='$modify_scripts',modify_filters='$modify_filters',modify_ingroups='$modify_ingroups',modify_usergroups='$modify_usergroups',modify_remoteagents='$modify_remoteagents',modify_servers='$modify_servers',view_reports='$view_reports',vicidial_recording_override='$vicidial_recording_override',alter_custdata_override='$alter_custdata_override' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER INFO |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=3; # go to user modification below +} + + +###################### +# ADD=4B submit user modifications to the system - ADMIN +###################### + +if ($ADD=="4B") +{ + if ($LOGmodify_users==1) + { + echo ""; + + if ( (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) + { + echo "
USER NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Password and Full Name each need ot be at least 2 characters in length\n"; + } + else + { + echo "
USER MODIFIED - ADMIN: $user\n"; + + $stmt="UPDATE vicidial_users set pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass',hotkeys_active='$hotkeys_active',agent_choose_ingroups='$agent_choose_ingroups',closer_campaigns='$groups_value',scheduled_callbacks='$scheduled_callbacks',agentonly_callbacks='$agentonly_callbacks',agentcall_manual='$agentcall_manual',vicidial_recording='$vicidial_recording',vicidial_transfers='$vicidial_transfers',closer_default_blended='$closer_default_blended',vicidial_recording_override='$vicidial_recording_override',alter_custdata_override='$alter_custdata_override' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER INFO |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=3; # go to user modification below +} + + + +###################### +# ADD=4 submit user modifications to the system +###################### + +if ($ADD==4) +{ + if ($LOGmodify_users==1) + { + echo ""; + + if ( (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) + { + echo "
USER NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Password and Full Name each need ot be at least 2 characters in length\n"; + } + else + { + echo "
USER MODIFIED: $user\n"; + + $stmt="UPDATE vicidial_users set pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER INFO |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=3; # go to user modification below +} + +###################### +# ADD=41 submit campaign modifications to the system +###################### + +if ($ADD==41) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_name) < 6) or (strlen($active) < 1) ) + { + echo "
CAMPAIGN NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the campaign name needs to be at least 6 characters in length\n"; + echo "
|$campaign_name|$active|\n"; + } + else + { + echo "
CAMPAIGN MODIFIED: $campaign_id\n"; + + if ($dial_method == 'MANUAL') + { + $auto_dial_level='0'; + $adlSQL = "auto_dial_level='0',"; + } + else + { + if ($dial_level_override > 0) + { + $adlSQL = "auto_dial_level='$auto_dial_level',"; + } + else + { + if ($dial_method == 'RATIO') + { + if ($auto_dial_level < 1) {$auto_dial_level = "1.0";} + $adlSQL = "auto_dial_level='$auto_dial_level',"; + } + else + { + $adlSQL = ""; + if ($auto_dial_level < 1) + { + $auto_dial_level = "1.0"; + $adlSQL = "auto_dial_level='$auto_dial_level',"; + } + } + } + } + if ( (!ereg("DISABLED",$list_order_mix)) and ($hopper_level < 100) ) + {$hopper_level='100';} + + $stmtA="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',allow_closers='$allow_closers',hopper_level='$hopper_level', $adlSQL next_agent_call='$next_agent_call', local_call_time='$local_call_time', voicemail_ext='$voicemail_ext', dial_timeout='$dial_timeout', dial_prefix='$dial_prefix', campaign_cid='$campaign_cid', campaign_vdad_exten='$campaign_vdad_exten', web_form_address='" . mysql_real_escape_string($web_form_address) . "', park_ext='$park_ext', park_file_name='$park_file_name', campaign_rec_exten='$campaign_rec_exten', campaign_recording='$campaign_recording', campaign_rec_filename='$campaign_rec_filename', campaign_script='$script_id', get_call_launch='$get_call_launch', am_message_exten='$am_message_exten', amd_send_to_vmx='$amd_send_to_vmx', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number',lead_filter_id='$lead_filter_id',alt_number_dialing='$alt_number_dialing',scheduled_callbacks='$scheduled_callbacks',safe_harbor_message='$safe_harbor_message',drop_call_seconds='$drop_call_seconds',safe_harbor_exten='$safe_harbor_exten',wrapup_seconds='$wrapup_seconds',wrapup_message='$wrapup_message',closer_campaigns='$groups_value',use_internal_dnc='$use_internal_dnc',allcalls_delay='$allcalls_delay',omit_phone_code='$omit_phone_code',dial_method='$dial_method',available_only_ratio_tally='$available_only_ratio_tally',adaptive_dropped_percentage='$adaptive_dropped_percentage',adaptive_maximum_level='$adaptive_maximum_level',adaptive_latest_server_time='$adaptive_latest_server_time',adaptive_intensity='$adaptive_intensity',adaptive_dl_diff_target='$adaptive_dl_diff_target',concurrent_transfers='$concurrent_transfers',auto_alt_dial='$auto_alt_dial',agent_pause_codes_active='$agent_pause_codes_active',campaign_description='$campaign_description',campaign_changedate='$SQLdate',campaign_stats_refresh='$campaign_stats_refresh',disable_alter_custdata='$disable_alter_custdata',no_hopper_leads_logins='$no_hopper_leads_logins',list_order_mix='$list_order_mix',campaign_allow_inbound='$campaign_allow_inbound',manual_dial_list_id='$manual_dial_list_id',default_xfer_group='$default_xfer_group',xfer_groups='$XFERgroups_value' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + if ($reset_hopper == 'Y') + { + echo "
RESETTING CAMPAIGN LEAD HOPPER\n"; + echo "
- Wait 1 minute before dialing next number\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id' and status IN('READY','QUEUE','DONE');"; + $rslt=mysql_query($stmt, $link); + + ### LOG RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|CAMPAIGN HOPPERRESET|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CAMPAIGN INFO|$PHP_AUTH_USER|$ip|$stmtA|$reset_hopper|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=42 modify/delete campaign status in the system +###################### + +if ($ADD==42) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
CAMPAIGN STATUS NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the campaign id needs to be at least 2 characters in length\n"; + echo "
the campaign status needs to be at least 1 characters in length\n"; + } + else + { + if (ereg('delete',$stage)) + { + echo "
CUSTOM CAMPAIGN STATUS DELETED: $campaign_id - $status\n"; + + $stmt="DELETE FROM vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + + $stmtA="DELETE FROM vicidial_campaign_hotkeys where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmtA, $link); + + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE CAMPAIGN STATUS|$PHP_AUTH_USER|$ip|$stmt|$stmtA|\n"); + fclose($fp); + } + } + if (ereg('modify',$stage)) + { + echo "
CUSTOM CAMPAIGN STATUS MODIFIED: $campaign_id - $status\n"; + + $stmt="UPDATE vicidial_campaign_statuses SET status_name='$status_name',selectable='$selectable',human_answered='$human_answered',category='$category' where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CAMPAIGN STATUS|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$SUB=22; +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=43 delete campaign hotkey in the system +###################### + +if ($ADD==43) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($hotkey) < 1) ) + { + echo "
CAMPAIGN HOT KEY NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the campaign id needs to be at least 2 characters in length\n"; + echo "
the campaign status needs to be at least 1 characters in length\n"; + echo "
the campaign hotkey needs to be at least 1 characters in length\n"; + } + else + { + echo "
CUSTOM CAMPAIGN HOT KEY DELETED: $campaign_id - $status - $hotkey\n"; + + $stmt="DELETE FROM vicidial_campaign_hotkeys where campaign_id='$campaign_id' and status='$status' and hotkey='$hotkey';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE CAMPAIGN STATUS|$PHP_AUTH_USER|$ip|DELETE FROM vicidial_campaign_hotkeys where campaign_id='$campaign_id' and status='$status' and hotkey='$hotkey'|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$SUB=23; +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=44 submit campaign modifications to the system - Basic View +###################### + +if ($ADD==44) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_name) < 6) or (strlen($active) < 1) ) + { + echo "
CAMPAIGN NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the campaign name needs to be at least 6 characters in length\n"; + } + else + { + echo "
CAMPAIGN MODIFIED: $campaign_id\n"; + + if ($dial_method == 'RATIO') + { + if ($auto_dial_level < 1) {$auto_dial_level = "1.0";} + $adlSQL = "auto_dial_level='$auto_dial_level',"; + } + else + { + if ($dial_method == 'MANUAL') + { + $auto_dial_level='0'; + $adlSQL = "auto_dial_level='0',"; + } + else + { + $adlSQL = ""; + if ($auto_dial_level < 1) + { + $auto_dial_level = "1.0"; + $adlSQL = "auto_dial_level='$auto_dial_level',"; + } + } + } + if ( (!ereg("DISABLED",$list_order_mix)) and ($hopper_level < 100) ) + {$hopper_level='100';} + + $stmtA="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',hopper_level='$hopper_level', $adlSQL lead_filter_id='$lead_filter_id',dial_method='$dial_method',adaptive_intensity='$adaptive_intensity',campaign_changedate='$SQLdate',list_order_mix='$list_order_mix' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + if ($reset_hopper == 'Y') + { + echo "
RESETTING CAMPAIGN LEAD HOPPER\n"; + echo "
- Wait 1 minute before dialing next number\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id' and status IN('READY','QUEUE','DONE');;"; + $rslt=mysql_query($stmt, $link); + + ### LOG HOPPER RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|CAMPAIGN HOPPERRESET|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CAMPAIGN INFO|$PHP_AUTH_USER|$ip|$stmtA|$reset_hopper|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=34; # go to campaign modification form below +} + +###################### +# ADD=45 modify campaign lead recycle in the system +###################### + +if ($ADD==45) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or ($attempt_delay < 120) or ($attempt_maximum < 1) or ($attempt_maximum > 10) ) + { + echo "
CAMPAIGN LEAD RECYCLE NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 6 characters in length\n"; + echo "
attempt delay must be at least 120 seconds\n"; + echo "
maximum attempts must be from 1 to 10\n"; + } + else + { + echo "
CAMPAIGN LEAD MODIFIED: $campaign_id - $status - $attempt_delay\n"; + + $stmt="UPDATE vicidial_lead_recycle SET attempt_delay='$attempt_delay',attempt_maximum='$attempt_maximum',active='$active' where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LEAD RECYCLE |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$SUB=25; +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=47 modify agent pause code in the system +###################### + +if ($ADD==47) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($pause_code) < 1) or (strlen($pause_code) > 6) or (strlen($pause_code_name) < 2) ) + { + echo "
AGENT PAUSE CODE NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
pause_code must be between 1 and 6 characters in length\n"; + echo "
pause_code name must be between 2 and 30 characters in length\n"; + } + else + { + echo "
AGENT PAUSE CODE MODIFIED: $campaign_id - $pause_code - $pause_code_name\n"; + + $stmt="UPDATE vicidial_pause_codes SET pause_code_name='$pause_code_name',billable='$billable' where campaign_id='$campaign_id' and pause_code='$pause_code';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY AGENT PAUSECODE|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$SUB=27; +$ADD=31; # go to campaign modification form below +} + + +###################### +# ADD=49 modify campaign list mix in the system +###################### + +if ($ADD==49) +{ + if ($LOGmodify_campaigns==1) + { + ##### MODIFY a list mix container entry ##### + if ($stage=='MODIFY') + { + echo ""; + + $Flist_mix_container = "list_mix_container_$vcl_id"; + $Fmix_method = "mix_method_$vcl_id"; + $Fstatus = "status_$vcl_id"; + $Fvcl_name = "vcl_name_$vcl_id"; + + if (isset($_GET[$Flist_mix_container])) {$list_mix_container=$_GET[$Flist_mix_container];} + elseif (isset($_POST[$Flist_mix_container])) {$list_mix_container=$_POST[$Flist_mix_container];} + if (isset($_GET[$Fmix_method])) {$mix_method=$_GET[$Fmix_method];} + elseif (isset($_POST[$Fmix_method])) {$mix_method=$_POST[$Fmix_method];} + if (isset($_GET[$Fstatus])) {$status=$_GET[$Fstatus];} + elseif (isset($_POST[$Fstatus])) {$status=$_POST[$Fstatus];} + if (isset($_GET[$Fvcl_name])) {$vcl_name=$_GET[$Fvcl_name];} + elseif (isset($_POST[$Fvcl_name])) {$vcl_name=$_POST[$Fvcl_name];} + $list_mix_container = preg_replace("/:$/","",$list_mix_container); + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) or (strlen($list_mix_container) < 6) or (strlen($vcl_name) < 2) ) + { + echo "
LIST MIX NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + echo "
vcl_name name must be between 2 and 30 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_campaigns_list_mix SET vcl_name='$vcl_name',mix_method='$mix_method',list_mix_container='$list_mix_container' where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
LIST MIX MODIFIED: $campaign_id - $vcl_id - $vcl_name\n"; + } + } + + ##### ADD a list mix container entry ##### + if ($stage=='ADD') + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) or (strlen($list_id) < 1) ) + { + echo "
LIST MIX NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + echo "
list_id must be at least 2 characters in length\n"; + } + else + { + $stmt="SELECT list_mix_container from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $OLDlist_mix_container = $row[0]; + $NEWlist_mix_container = "$OLDlist_mix_container:$list_id|10|0| -|"; + + $stmt="UPDATE vicidial_campaigns_list_mix SET list_mix_container='$NEWlist_mix_container' where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
LIST MIX MODIFIED: $campaign_id - $vcl_id - $list_id\n"; + } + } + + ##### REMOVE a list mix container entry ##### + if ($stage=='REMOVE') + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) or (strlen($list_id) < 1) ) + { + echo "
LIST MIX NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + echo "
list_id must be at least 2 characters in length\n"; + } + else + { + $stmt="SELECT list_mix_container from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $MIXentries = $MT; + $MIXentries = explode(":", $row[0]); + $Ms_to_print = (count($MIXentries) - 0); + + if ($Ms_to_print < 2) + { + echo "
LIST MIX NOT MODIFIED: You cannot delete the last list_id entry from a list mix\n"; + } + else + { + $MIXdetailsPCT = explode('|', $MIXentries[$mix_container_item]); + $MIXpercentPCT = $MIXdetailsPCT[2]; + + $q=0; + while ($Ms_to_print > $q) + { + if ( ($mix_container_item > $q) or ($mix_container_item < $q) ) + { + if ( ($q==0) and ($mix_container_item > 0) ) + { + $MIXdetailsONE = explode('|', $MIXentries[$q]); + $MIXpercentONE = ($MIXdetailsONE[2] + $MIXpercentPCT); + $NEWlist_mix_container .= "$MIXdetailsONE[0]|$MIXdetailsONE[1]|$MIXpercentONE|$MIXdetailsONE[3]|:"; + } + else + { + if ( ($q==1) and ($mix_container_item < 1) ) + { + $MIXdetailsONE = explode('|', $MIXentries[$q]); + $MIXpercentONE = ($MIXdetailsONE[2] + $MIXpercentPCT); + $NEWlist_mix_container .= "$MIXdetailsONE[0]|$MIXdetailsONE[1]|$MIXpercentONE|$MIXdetailsONE[3]|:"; + } + else + { + $NEWlist_mix_container .= "$MIXentries[$q]:"; + } + } + } + $q++; + } + $NEWlist_mix_container = preg_replace("/.$/",'',$NEWlist_mix_container); + + $stmt="UPDATE vicidial_campaigns_list_mix SET list_mix_container='$NEWlist_mix_container' where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
LIST MIX MODIFIED: $campaign_id - $vcl_id - $list_id - $mix_container_item\n"; + } + } + } + + ##### ADD a NEW list mix ##### + if ($stage=='NEWMIX') + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) or (strlen($vcl_name) < 2) ) + { + echo "
LIST MIX NOT ADDED - Please go back and look at the data you entered\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + echo "
vcl_name must be at least 2 characters in length\n"; + } + else + { + $stmt="SELECT count(*) from vicidial_campaigns_list_mix where vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + echo "
LIST MIX NOT ADDED - There is already a list mix with this ID in the system\n"; + } + else + { + $stmt="INSERT INTO vicidial_campaigns_list_mix SET list_mix_container='$list_id|1|100| $status -|',campaign_id='$campaign_id',vcl_id='$vcl_id',vcl_name='$vcl_name',mix_method='$mix_method',status='INACTIVE';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
LIST MIX ADDED: $campaign_id - $vcl_id - $vcl_name\n"; + } + } + } + + ##### DELETE an existing list mix ##### + if ($stage=='DELMIX') + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) ) + { + echo "
LIST MIX NOT DELETED - Please go back and look at the data you entered\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_campaigns_list_mix where vcl_id='$vcl_id' and campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
LIST MIX DELETED: $campaign_id - $vcl_id - $vcl_name\n"; + } + } + + ##### Set list mix entry to active ##### + if ($stage=='SETACTIVE') + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) ) + { + echo "
LIST MIX NOT ACTIVATED - Please go back and look at the data you entered\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_campaigns_list_mix SET status='INACTIVE' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_campaigns_list_mix SET status='ACTIVE' where vcl_id='$vcl_id' and campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
LIST MIX ACTIVATED: $campaign_id - $vcl_id - $vcl_name\n"; + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$SUB=29; +$ADD=31; # go to campaign modification form below +} + + +###################### +# ADD=411 submit list modifications to the system +###################### + +if ($ADD==411) +{ + if ($LOGmodify_lists==1) + { + echo ""; + + if ( (strlen($list_name) < 2) or (strlen($campaign_id) < 2) ) + { + echo "
LIST NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
list name must be at least 2 characters in length\n"; + } + else + { + echo "
LIST MODIFIED: $list_id\n"; + + $stmt="UPDATE vicidial_lists set list_name='$list_name',campaign_id='$campaign_id',active='$active',list_description='$list_description',list_changedate='$SQLdate' where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + if ($reset_list == 'Y') + { + echo "
RESETTING LIST-CALLED-STATUS\n"; + $stmt="UPDATE vicidial_list set called_since_last_reset='N' where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|RESET LIST CALLED |$PHP_AUTH_USER|$ip|list_name='$list_name'|\n"); + fclose($fp); + } + } + if ($campaign_id != "$old_campaign_id") + { + echo "
REMOVING LIST HOPPER LEADS FROM OLD CAMPAIGN HOPPER ($old_campaign_id)\n"; + $stmt="DELETE from vicidial_hopper where list_id='$list_id' and campaign_id='$old_campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST INFO |$PHP_AUTH_USER|$ip|list_name='$list_name',campaign_id='$campaign_id',active='$active',list_description='$list_description' where list_id='$list_id'|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=311; # go to list modification form below +} + + +###################### +# ADD=4111 modify in-group info in the system +###################### + +if ($ADD==4111) +{ + if ($LOGmodify_ingroups==1) + { + echo ""; + + if ( (strlen($group_name) < 2) or (strlen($group_color) < 2) ) + { + echo "
GROUP NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
group name and group color must be at least 2 characters in length\n"; + } + else + { + echo "
GROUP MODIFIED: $group_id\n"; + + $stmt="UPDATE vicidial_inbound_groups set group_name='$group_name', group_color='$group_color', active='$active', web_form_address='" . mysql_real_escape_string($web_form_address) . "', voicemail_ext='$voicemail_ext', next_agent_call='$next_agent_call', fronter_display='$fronter_display', ingroup_script='$script_id', get_call_launch='$get_call_launch', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number',drop_message='$drop_message',drop_call_seconds='$drop_call_seconds',drop_exten='$drop_exten',call_time_id='$call_time_id',after_hours_action='$after_hours_action',after_hours_message_filename='$after_hours_message_filename',after_hours_exten='$after_hours_exten',after_hours_voicemail='$after_hours_voicemail',welcome_message_filename='$welcome_message_filename',moh_context='$moh_context',onhold_prompt_filename='$onhold_prompt_filename',prompt_interval='$prompt_interval',agent_alert_exten='$agent_alert_exten',agent_alert_delay='$agent_alert_delay',default_xfer_group='$default_xfer_group' where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY GROUP INFO |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=3111; # go to in-group modification form below +} + + + +###################### +# ADD=41111 modify remote agents info in the system +###################### + +if ($ADD==41111) +{ + if ($LOGmodify_remoteagents==1) + { + echo ""; + + if ( (strlen($server_ip) < 2) or (strlen($user_start) < 2) or (strlen($campaign_id) < 2) or (strlen($conf_exten) < 2) ) + { + echo "
REMOTE AGENTS NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
User ID Start and External Extension must be at least 2 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_remote_agents set user_start='$user_start', number_of_lines='$number_of_lines', server_ip='$server_ip', conf_exten='$conf_exten', status='$status', campaign_id='$campaign_id', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOTE AGENTS MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY REMOTE AGENTS ENTRY |$PHP_AUTH_USER|$ip|set user_start='$user_start', number_of_lines='$number_of_lines', server_ip='$server_ip', conf_exten='$conf_exten', status='$status', campaign_id='$campaign_id', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id'|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=31111; # go to remote agents modification form below +} + + + +###################### +# ADD=411111 modify user group info in the system +###################### + +if ($ADD==411111) +{ + if ($LOGmodify_usergroups==1) + { + echo ""; + + if ( (strlen($user_group) < 2) or (strlen($group_name) < 2) ) + { + echo "
USER GROUP NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Group name and description must be at least 2 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_user_groups set user_group='$user_group', group_name='$group_name',allowed_campaigns='$campaigns_value' where user_group='$OLDuser_group';"; + $rslt=mysql_query($stmt, $link); + + echo "
USER GROUP MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER GROUP ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=311111; # go to user group modification form below +} + +###################### +# ADD=4111111 modify script in the system +###################### + +if ($ADD==4111111) +{ + if ($LOGmodify_scripts==1) + { + echo "\n"; + echo "\n"; + echo ""; + + if ( (strlen($script_id) < 2) or (strlen($script_name) < 2) or (strlen($script_text) < 2) ) + { + echo "
SCRIPT NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Script name, description and text must be at least 2 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_scripts set script_name='$script_name', script_comments='$script_comments', script_text='$script_text', active='$active' where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
SCRIPT MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY SCRIPT ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=3111111; # go to script modification form below +} + + +###################### +# ADD=41111111 modify filter in the system +###################### + +if ($ADD==41111111) +{ + if ($LOGmodify_filters==1) + { + echo ""; + + if ( (strlen($lead_filter_id) < 2) or (strlen($lead_filter_name) < 2) or (strlen($lead_filter_sql) < 2) ) + { + echo "
FILTER NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Filter ID, name and SQL must be at least 2 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_lead_filters set lead_filter_name='$lead_filter_name', lead_filter_comments='$lead_filter_comments', lead_filter_sql='$lead_filter_sql' where lead_filter_id='$lead_filter_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
FILTER MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY FILTER ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=31111111; # go to filter modification form below +} + + +###################### +# ADD=411111111 modify call time in the system +###################### + +if ($ADD==411111111) +{ + if ($LOGmodify_call_times==1) + { + echo ""; + + if ( (strlen($call_time_id) < 2) or (strlen($call_time_name) < 2) ) + { + echo "
CALL TIME NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Call Time ID and name must be at least 2 characters in length\n"; + } + else + { + $ct_default_start = preg_replace('/\D/', '', $ct_default_start); + $ct_default_stop = preg_replace('/\D/', '', $ct_default_stop); + $ct_sunday_start = preg_replace('/\D/', '', $ct_sunday_start); + $ct_sunday_stop = preg_replace('/\D/', '', $ct_sunday_stop); + $ct_monday_start = preg_replace('/\D/', '', $ct_monday_start); + $ct_monday_stop = preg_replace('/\D/', '', $ct_monday_stop); + $ct_tuesday_start = preg_replace('/\D/', '', $ct_tuesday_start); + $ct_tuesday_stop = preg_replace('/\D/', '', $ct_tuesday_stop); + $ct_wednesday_start = preg_replace('/\D/', '', $ct_wednesday_start); + $ct_wednesday_stop = preg_replace('/\D/', '', $ct_wednesday_stop); + $ct_thursday_start = preg_replace('/\D/', '', $ct_thursday_start); + $ct_thursday_stop = preg_replace('/\D/', '', $ct_thursday_stop); + $ct_friday_start = preg_replace('/\D/', '', $ct_friday_start); + $ct_friday_stop = preg_replace('/\D/', '', $ct_friday_stop); + $ct_saturday_start = preg_replace('/\D/', '', $ct_saturday_start); + $ct_saturday_stop = preg_replace('/\D/', '', $ct_saturday_stop); + $stmt="UPDATE vicidial_call_times set call_time_name='$call_time_name', call_time_comments='$call_time_comments', ct_default_start='$ct_default_start', ct_default_stop='$ct_default_stop', ct_sunday_start='$ct_sunday_start', ct_sunday_stop='$ct_sunday_stop', ct_monday_start='$ct_monday_start', ct_monday_stop='$ct_monday_stop', ct_tuesday_start='$ct_tuesday_start', ct_tuesday_stop='$ct_tuesday_stop', ct_wednesday_start='$ct_wednesday_start', ct_wednesday_stop='$ct_wednesday_stop', ct_thursday_start='$ct_thursday_start', ct_thursday_stop='$ct_thursday_stop', ct_friday_start='$ct_friday_start', ct_friday_stop='$ct_friday_stop', ct_saturday_start='$ct_saturday_start', ct_saturday_stop='$ct_saturday_stop' where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
CALL TIME MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CALL TIME ENTRY |$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=311111111; # go to call time modification form below +} + + +###################### +# ADD=4111111111 modify state call time in the system +###################### + +if ($ADD==4111111111) +{ + if ($LOGmodify_call_times==1) + { + echo ""; + + if ( (strlen($call_time_id) < 2) or (strlen($call_time_name) < 2) or (strlen($state_call_time_state) < 2) ) + { + echo "
STATE CALL TIME NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
State Call Time ID, name and state must be at least 2 characters in length\n"; + } + else + { + $ct_default_start = preg_replace('/\D/', '', $ct_default_start); + $ct_default_stop = preg_replace('/\D/', '', $ct_default_stop); + $ct_sunday_start = preg_replace('/\D/', '', $ct_sunday_start); + $ct_sunday_stop = preg_replace('/\D/', '', $ct_sunday_stop); + $ct_monday_start = preg_replace('/\D/', '', $ct_monday_start); + $ct_monday_stop = preg_replace('/\D/', '', $ct_monday_stop); + $ct_tuesday_start = preg_replace('/\D/', '', $ct_tuesday_start); + $ct_tuesday_stop = preg_replace('/\D/', '', $ct_tuesday_stop); + $ct_wednesday_start = preg_replace('/\D/', '', $ct_wednesday_start); + $ct_wednesday_stop = preg_replace('/\D/', '', $ct_wednesday_stop); + $ct_thursday_start = preg_replace('/\D/', '', $ct_thursday_start); + $ct_thursday_stop = preg_replace('/\D/', '', $ct_thursday_stop); + $ct_friday_start = preg_replace('/\D/', '', $ct_friday_start); + $ct_friday_stop = preg_replace('/\D/', '', $ct_friday_stop); + $ct_saturday_start = preg_replace('/\D/', '', $ct_saturday_start); + $ct_saturday_stop = preg_replace('/\D/', '', $ct_saturday_stop); + $stmt="UPDATE vicidial_state_call_times set state_call_time_name='$call_time_name', state_call_time_comments='$call_time_comments', sct_default_start='$ct_default_start', sct_default_stop='$ct_default_stop', sct_sunday_start='$ct_sunday_start', sct_sunday_stop='$ct_sunday_stop', sct_monday_start='$ct_monday_start', sct_monday_stop='$ct_monday_stop', sct_tuesday_start='$ct_tuesday_start', sct_tuesday_stop='$ct_tuesday_stop', sct_wednesday_start='$ct_wednesday_start', sct_wednesday_stop='$ct_wednesday_stop', sct_thursday_start='$ct_thursday_start', sct_thursday_stop='$ct_thursday_stop', sct_friday_start='$ct_friday_start', sct_friday_stop='$ct_friday_stop', sct_saturday_start='$ct_saturday_start', sct_saturday_stop='$ct_saturday_stop', state_call_time_state='$state_call_time_state' where state_call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
STATE CALL TIME MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY STATE CALL TIME ENTRY|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=3111111111; # go to state call time modification form below +} + + +###################### +# ADD=41111111111 modify phone record in the system +###################### + +if ($ADD==41111111111) +{ + if ($LOGast_admin_access==1) + { + echo ""; + + $stmt="SELECT count(*) from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ( ($extension != $old_extension) or ($server_ip != $old_server_ip) ) ) + {echo "
PHONE NOT MODIFIED - there is already a Phone in the system with this extension/server\n";} + else + { + if ( (strlen($extension) < 1) or (strlen($server_ip) < 7) or (strlen($dialplan_number) < 1) or (strlen($voicemail_id) < 1) or (strlen($login) < 1) or (strlen($pass) < 1)) + {echo "
PHONE NOT MODIFIED - Please go back and look at the data you entered\n";} + else + { + echo "
PHONE MODIFIED: $extension\n"; + + $stmt="UPDATE phones set extension='$extension', dialplan_number='$dialplan_number', voicemail_id='$voicemail_id', phone_ip='$phone_ip', computer_ip='$computer_ip', server_ip='$server_ip', login='$login', pass='$pass', status='$status', active='$active', phone_type='$phone_type', fullname='$fullname', company='$company', picture='$picture', protocol='$protocol', local_gmt='$local_gmt', ASTmgrUSERNAME='$ASTmgrUSERNAME', ASTmgrSECRET='$ASTmgrSECRET', login_user='$login_user', login_pass='$login_pass', login_campaign='$login_campaign', park_on_extension='$park_on_extension', conf_on_extension='$conf_on_extension', VICIDIAL_park_on_extension='$VICIDIAL_park_on_extension', VICIDIAL_park_on_filename='$VICIDIAL_park_on_filename', monitor_prefix='$monitor_prefix', recording_exten='$recording_exten', voicemail_exten='$voicemail_exten', voicemail_dump_exten='$voicemail_dump_exten', ext_context='$ext_context', dtmf_send_extension='$dtmf_send_extension', call_out_number_group='$call_out_number_group', client_browser='$client_browser', install_directory='$install_directory', local_web_callerID_URL='" . mysql_real_escape_string($local_web_callerID_URL) . "', VICIDIAL_web_URL='" . mysql_real_escape_string($VICIDIAL_web_URL) . "', AGI_call_logging_enabled='$AGI_call_logging_enabled', user_switching_enabled='$user_switching_enabled', conferencing_enabled='$conferencing_enabled', admin_hangup_enabled='$admin_hangup_enabled', admin_hijack_enabled='$admin_hijack_enabled', admin_monitor_enabled='$admin_monitor_enabled', call_parking_enabled='$call_parking_enabled', updater_check_enabled='$updater_check_enabled', AFLogging_enabled='$AFLogging_enabled', QUEUE_ACTION_enabled='$QUEUE_ACTION_enabled', CallerID_popup_enabled='$CallerID_popup_enabled', voicemail_button_enabled='$voicemail_button_enabled', enable_fast_refresh='$enable_fast_refresh', fast_refresh_rate='$fast_refresh_rate', enable_persistant_mysql='$enable_persistant_mysql', auto_dial_next_number='$auto_dial_next_number', VDstop_rec_after_each_call='$VDstop_rec_after_each_call', DBX_server='$DBX_server', DBX_database='$DBX_database', DBX_user='$DBX_user', DBX_pass='$DBX_pass', DBX_port='$DBX_port', DBY_server='$DBY_server', DBY_database='$DBY_database', DBY_user='$DBY_user', DBY_pass='$DBY_pass', DBY_port='$DBY_port', outbound_cid='$outbound_cid', enable_sipsak_messages='$enable_sipsak_messages' where extension='$old_extension' and server_ip='$old_server_ip';"; + $rslt=mysql_query($stmt, $link); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=31111111111; # go to phone modification form below +} + + +###################### +# ADD=411111111111 modify server record in the system +###################### + +if ($ADD==411111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + + $stmt="SELECT count(*) from servers where server_id='$server_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ($server_id != $old_server_id) ) + {echo "
SERVER NOT MODIFIED - there is already a server in the system with this server_id\n";} + else + { + $stmt="SELECT count(*) from servers where server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ($server_ip != $old_server_ip) ) + {echo "
SERVER NOT MODIFIED - there is already a server in the system with this server_ip\n";} + else + { + if ( (strlen($server_id) < 1) or (strlen($server_ip) < 7) ) + {echo "
SERVER NOT MODIFIED - Please go back and look at the data you entered\n";} + else + { + echo "
SERVER MODIFIED: $server_ip\n"; + + $stmt="UPDATE servers set server_id='$server_id',server_description='$server_description',server_ip='$server_ip',active='$active',asterisk_version='$asterisk_version', max_vicidial_trunks='$max_vicidial_trunks', telnet_host='$telnet_host', telnet_port='$telnet_port', ASTmgrUSERNAME='$ASTmgrUSERNAME', ASTmgrSECRET='$ASTmgrSECRET', ASTmgrUSERNAMEupdate='$ASTmgrUSERNAMEupdate', ASTmgrUSERNAMElisten='$ASTmgrUSERNAMElisten', ASTmgrUSERNAMEsend='$ASTmgrUSERNAMEsend', local_gmt='$local_gmt', voicemail_dump_exten='$voicemail_dump_exten', answer_transfer_agent='$answer_transfer_agent', ext_context='$ext_context', sys_perf_log='$sys_perf_log', vd_server_logs='$vd_server_logs', agi_output='$agi_output', vicidial_balance_active='$vicidial_balance_active', balance_trunks_offlimits='$balance_trunks_offlimits' where server_id='$old_server_id';"; + $rslt=mysql_query($stmt, $link); + } + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=311111111111; # go to server modification form below +} + + +###################### +# ADD=421111111111 modify vicidial server trunks record in the system +###################### + +if ($ADD==421111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + $stmt="SELECT max_vicidial_trunks from servers where server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $MAXvicidial_trunks = $rowx[0]; + + $stmt="SELECT sum(dedicated_trunks) from vicidial_server_trunks where server_ip='$server_ip' and campaign_id !='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $SUMvicidial_trunks = ($rowx[0] + $dedicated_trunks); + + if ($SUMvicidial_trunks > $MAXvicidial_trunks) + { + echo "
VICIDIAL SERVER TRUNK RECORD NOT ADDED - the number of vicidial trunks is too high: $SUMvicidial_trunks / $MAXvicidial_trunks\n"; + } + else + { + if ( (strlen($campaign_id) < 2) or (strlen($server_ip) < 7) or (strlen($dedicated_trunks) < 1) or (strlen($trunk_restriction) < 1) ) + { + echo "
VICIDIAL SERVER TRUNK RECORD NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
campaign must be between 3 and 8 characters in length\n"; + echo "
server_ip delay must be at least 7 characters\n"; + echo "
trunks must be a digit from 0 to 9999\n"; + } + else + { + echo "
VICIDIAL SERVER TRUNK RECORD MODIFIED: $campaign_id - $server_ip - $dedicated_trunks - $trunk_restriction\n"; + + $stmt="UPDATE vicidial_server_trunks SET dedicated_trunks='$dedicated_trunks',trunk_restriction='$trunk_restriction' where campaign_id='$campaign_id' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY SERVER TRUNK |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=311111111111; # go to server modification form below +} + + +###################### +# ADD=4111111111111 modify conference record in the system +###################### + +if ($ADD==4111111111111) +{ + if ($LOGast_admin_access==1) + { + echo ""; + + $stmt="SELECT count(*) from conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ( ($conf_exten != $old_conf_exten) or ($server_ip != $old_server_ip) ) ) + {echo "
CONFERENCE NOT MODIFIED - there is already a Conference in the system with this extension-server\n";} + else + { + if ( (strlen($conf_exten) < 1) or (strlen($server_ip) < 7) ) + {echo "
CONFERENCE NOT MODIFIED - Please go back and look at the data you entered\n";} + else + { + echo "
CONFERENCE MODIFIED: $conf_exten\n"; + + $stmt="UPDATE conferences set conf_exten='$conf_exten',server_ip='$server_ip',extension='$extension' where conf_exten='$old_conf_exten';"; + $rslt=mysql_query($stmt, $link); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=3111111111111; # go to conference modification form below +} + + +###################### +# ADD=41111111111111 modify vicidial conference record in the system +###################### + +if ($ADD==41111111111111) +{ + if ($LOGast_admin_access==1) + { + echo ""; + + $stmt="SELECT count(*) from vicidial_conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ( ($conf_exten != $old_conf_exten) or ($server_ip != $old_server_ip) ) ) + {echo "
VICIDIAL CONFERENCE NOT MODIFIED - there is already a Conference in the system with this extension-server\n";} + else + { + if ( (strlen($conf_exten) < 1) or (strlen($server_ip) < 7) ) + {echo "
VICIDIAL CONFERENCE NOT MODIFIED - Please go back and look at the data you entered\n";} + else + { + echo "
VICIDIAL CONFERENCE MODIFIED: $conf_exten\n"; + + $stmt="UPDATE vicidial_conferences set conf_exten='$conf_exten',server_ip='$server_ip',extension='$extension' where conf_exten='$old_conf_exten';"; + $rslt=mysql_query($stmt, $link); + + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=31111111111111; # go to vicidial conference modification form below +} + + + +###################### +# ADD=411111111111111 modify vicidial system settings +###################### + +if ($ADD==411111111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + + echo "
VICIDIAL SYSTEM SETTINGS MODIFIED\n"; + + $stmt="UPDATE system_settings set use_non_latin='$use_non_latin',webroot_writable='$webroot_writable',enable_queuemetrics_logging='$enable_queuemetrics_logging',queuemetrics_server_ip='$queuemetrics_server_ip',queuemetrics_dbname='$queuemetrics_dbname',queuemetrics_login='$queuemetrics_login',queuemetrics_pass='$queuemetrics_pass',queuemetrics_url='$queuemetrics_url',queuemetrics_log_id='$queuemetrics_log_id',queuemetrics_eq_prepend='$queuemetrics_eq_prepend',vicidial_agent_disable='$vicidial_agent_disable',allow_sipsak_messages='$allow_sipsak_messages',admin_home_url='$admin_home_url',enable_agc_xfer_log='$enable_agc_xfer_log';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY SYSTEM SETTINGS|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=311111111111111; # go to vicidial system settings form below +} + + +###################### +# ADD=421111111111111 modify/delete system status in the system +###################### + +if ($ADD==421111111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + + if (ereg('delete',$stage)) + { + if ( (strlen($status) < 1) or (preg_match("/^B$|^NA$|^DNC$|^NA$|^DROP$|^INCALL$|^QUEUE$|^NEW$/i",$status)) ) + { + echo "
SYSTEM STATUS NOT DELETED - Please go back and look at the data you entered\n"; + echo "
the system status cannot be a reserved status: B,NA,DNC,NA,DROP,INCALL,QUEUE,NEW\n"; + echo "
the system status needs to be at least 1 characters in length\n"; + } + else + { + echo "
SYSTEM STATUS DELETED: $status\n"; + + $stmt="DELETE FROM vicidial_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + + $stmtA="DELETE FROM vicidial_campaign_hotkeys where status='$status';"; + $rslt=mysql_query($stmtA, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE SYSTEM STATUS |$PHP_AUTH_USER|$ip|$stmt|$stmtA|\n"); + fclose($fp); + } + } + } + if (ereg('modify',$stage)) + { + if ( (strlen($status) < 1) or (strlen($status_name) < 2) ) + { + echo "
SYSTEM STATUS NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the system status needs to be at least 1 characters in length\n"; + echo "
the system status name needs to be at least 1 characters in length\n"; + } + else + { + echo "
SYSTEM STATUS MODIFIED: $status\n"; + + $stmt="UPDATE vicidial_statuses SET status_name='$status_name',selectable='$selectable',human_answered='$human_answered',category='$category' where status='$status';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY SYSTEM STATUS |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=321111111111111; # go to system settings modification form below +} + + +###################### +# ADD=431111111111111 modify/delete status category in the system +###################### + +if ($ADD==431111111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + + if ( (strlen($vsc_id) < 2) or (preg_match("/^UNDEFINED$/i",$vsc_id)) ) + { + echo "
STATUS CATEGORY NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the status category cannot be a reserved category: UNDEFINED\n"; + echo "
the status category needs to be at least 2 characters in length\n"; + } + else + { + if (ereg('delete',$stage)) + { + echo "
STATUS CATEGORY DELETED: $vsc_id\n"; + + $stmt="DELETE FROM vicidial_status_categories where vsc_id='$vsc_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE STATUS CATEGORY|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + if (ereg('modify',$stage)) + { + echo "
STATUS CATEGORY MODIFIED: $vsc_id\n"; + + $stmt="SELECT count(*) from vicidial_status_categories where tovdad_display='Y' and vsc_id NOT IN('$vsc_id');"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 3) and (ereg('Y',$tovdad_display)) ) + { + $tovdad_display = 'N'; + echo "
ERROR: There are already 4 Status Categories set to TimeOnVDAD Display\n"; + } + + $stmt="UPDATE vicidial_status_categories SET vsc_name='$vsc_name',vsc_description='$vsc_description',tovdad_display='$tovdad_display' where vsc_id='$vsc_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY STATUS CATEGORY|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=331111111111111; # go to system settings modification form below +} + + + + +###################################################################################################### +###################################################################################################### +####### 5 series, delete records confirmation +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=5 confirmation before deletion of user +###################### + +if ($ADD==5) +{ + echo ""; + + if ( (strlen($user) < 2) or ($LOGdelete_users < 1) ) + { + echo "
USER NOT DELETED - Please go back and look at the data you entered\n"; + echo "
User be at least 2 characters in length\n"; + } + else + { + echo "
USER DELETION CONFIRMATION: $user\n"; + echo "

Click here to delete user $user


\n"; + } + +$ADD='3'; # go to user modification below +} + +###################### +# ADD=51 confirmation before deletion of campaign +###################### + +if ($ADD==51) +{ + echo ""; + + if ( (strlen($campaign_id) < 2) or ($LOGdelete_campaigns < 1) ) + { + echo "
CAMPAIGN NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + echo "
CAMPAIGN DELETION CONFIRMATION: $campaign_id\n"; + echo "

Click here to delete campaign $campaign_id


\n"; + } + +$ADD='31'; # go to campaign modification below +} + +###################### +# ADD=52 confirmation before logging all agents out of campaign of campaign +###################### + +if ($ADD==52) +{ + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
AGENTS NOT LOGGED OUT OF CAMPAIGN - Please go back and look at the data you entered\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + echo "
AGENT LOGOUT CONFIRMATION: $campaign_id\n"; + echo "

Click here to log all agents out of $campaign_id


\n"; + } + +$ADD='31'; # go to campaign modification below +} + +###################### +# ADD=53 confirmation before Emergency VDAC Jam Clear - deletes oldest LIVE vicidial_auto_call record +###################### + +if ($ADD==53) +{ + if (eregi('IN',$stage)) + {$group_id=$campaign_id;} + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
VDAC NOT CLEARED FOR CAMPAIGN - Please go back and look at the data you entered\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + echo "
VDAC CLEAR CONFIRMATION: $campaign_id\n"; + echo "

Click here to delete the oldest LIVE record in VDAC for $campaign_id


\n"; + } + +# go to campaign modification below +if (eregi('IN',$stage)) + {$ADD='3111';} +else + {$ADD='31';} +} + +###################### +# ADD=511 confirmation before deletion of list +###################### + +if ($ADD==511) +{ + echo ""; + + if ( (strlen($list_id) < 2) or ($LOGdelete_lists < 1) ) + { + echo "
LIST NOT DELETED - Please go back and look at the data you entered\n"; + echo "
List_id be at least 2 characters in length\n"; + } + else + { + echo "
LIST DELETION CONFIRMATION: $list_id\n"; + echo "

Click here to delete list and all of its leads $list_id


\n"; + } + +$ADD='311'; # go to campaign modification below +} + +###################### +# ADD=5111 confirmation before deletion of in-group +###################### + +if ($ADD==5111) +{ + echo ""; + + if ( (strlen($group_id) < 2) or ($LOGdelete_ingroups < 1) ) + { + echo "
IN-GROUP NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Group_id be at least 2 characters in length\n"; + } + else + { + echo "
IN-GROUP DELETION CONFIRMATION: $group_id\n"; + echo "

Click here to delete in-group $group_id


\n"; + } + +$ADD='3111'; # go to in-group modification below +} + +###################### +# ADD=51111 confirmation before deletion of remote agent record +###################### + +if ($ADD==51111) +{ + echo ""; + + if ( (strlen($remote_agent_id) < 1) or ($LOGdelete_remote_agents < 1) ) + { + echo "
REMOTE AGENT NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Remote_agent_id be at least 2 characters in length\n"; + } + else + { + echo "
REMOTE AGENT DELETION CONFIRMATION: $remote_agent_id\n"; + echo "

Click here to delete remote agent $remote_agent_id


\n"; + } + +$ADD='31111'; # go to remote agent modification below +} + +###################### +# ADD=511111 confirmation before deletion of user group record +###################### + +if ($ADD==511111) +{ + echo ""; + + if ( (strlen($user_group) < 2) or ($LOGdelete_user_groups < 1) ) + { + echo "
USER GROUP NOT DELETED - Please go back and look at the data you entered\n"; + echo "
User_group be at least 2 characters in length\n"; + } + else + { + echo "
USER GROUP DELETION CONFIRMATION: $user_group\n"; + echo "

Click here to delete user group $user_group


\n"; + } + +$ADD='311111'; # go to user group modification below +} + +###################### +# ADD=5111111 confirmation before deletion of script record +###################### + +if ($ADD==5111111) +{ + echo ""; + + if ( (strlen($script_id) < 2) or ($LOGdelete_scripts < 1) ) + { + echo "
SCRIPT NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Script_id must be at least 2 characters in length\n"; + } + else + { + echo "
SCRIPT DELETION CONFIRMATION: $script_id\n"; + echo "

Click here to delete script $script_id


\n"; + } + +$ADD='3111111'; # go to script modification below +} + +###################### +# ADD=51111111 confirmation before deletion of filter record +###################### + +if ($ADD==51111111) +{ + echo ""; + + if ( (strlen($lead_filter_id) < 2) or ($LOGdelete_filters < 1) ) + { + echo "
FILTER NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Filter ID must be at least 2 characters in length\n"; + } + else + { + echo "
FILTER DELETION CONFIRMATION: $lead_filter_id\n"; + echo "

Click here to delete filter $lead_filter_id


\n"; + } + +$ADD='31111111'; # go to filter modification below +} + +###################### +# ADD=511111111 confirmation before deletion of call time record +###################### + +if ($ADD==511111111) +{ + echo ""; + + if ( (strlen($call_time_id) < 2) or ($LOGdelete_call_times < 1) ) + { + echo "
CALL TIME NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Call Time ID must be at least 2 characters in length\n"; + } + else + { + echo "
CALL TIME DELETION CONFIRMATION: $call_time_id\n"; + echo "

Click here to delete call time $call_time_id


\n"; + } + +$ADD='311111111'; # go to call time modification below +} + +###################### +# ADD=5111111111 confirmation before deletion of state call time record +###################### + +if ($ADD==5111111111) +{ + echo ""; + + if ( (strlen($call_time_id) < 2) or ($LOGdelete_call_times < 1) ) + { + echo "
STATE CALL TIME NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Call Time ID must be at least 2 characters in length\n"; + } + else + { + echo "
STATE CALL TIME DELETION CONFIRMATION: $call_time_id\n"; + echo "

Click here to delete state call time $call_time_id


\n"; + } + +$ADD='3111111111'; # go to state call time modification below +} + + +###################### +# ADD=51111111111 confirmation before deletion of phone record +###################### + +if ($ADD==51111111111) +{ + echo ""; + + if ( (strlen($extension) < 2) or (strlen($server_ip) < 7) or ($LOGast_delete_phones < 1) ) + { + echo "
PHONE NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Extension be at least 2 characters in length\n"; + echo "
Server IP be at least 7 characters in length\n"; + } + else + { + echo "
PHONE DELETION CONFIRMATION: $extension - $server_ip\n"; + echo "

Click here to delete phone $extension - $server_ip


\n"; + } +$ADD='31111111111'; # go to phone modification below +} + + +###################### +# ADD=511111111111 confirmation before deletion of server record +###################### + +if ($ADD==511111111111) +{ + echo ""; + + if ( (strlen($server_id) < 2) or (strlen($server_ip) < 7) or ($LOGast_delete_phones < 1) ) + { + echo "
SERVER NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Server ID be at least 2 characters in length\n"; + echo "
Server IP be at least 7 characters in length\n"; + } + else + { + echo "
SERVER DELETION CONFIRMATION: $server_id - $server_ip\n"; + echo "

Click here to delete phone $server_id - $server_ip


\n"; + } +$ADD='311111111111'; # go to server modification below +} + + +###################### +# ADD=5111111111111 confirmation before deletion of conference record +###################### + +if ($ADD==5111111111111) +{ + echo ""; + + if ( (strlen($conf_exten) < 2) or (strlen($server_ip) < 7) or ($LOGast_delete_phones < 1) ) + { + echo "
CONFERENCE NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Conference must be at least 2 characters in length\n"; + echo "
Server IP be at least 7 characters in length\n"; + } + else + { + echo "
CONFERENCE DELETION CONFIRMATION: $conf_exten - $server_ip\n"; + echo "

Click here to delete phone $conf_exten - $server_ip


\n"; + } +$ADD='3111111111111'; # go to conference modification below +} + + +###################### +# ADD=51111111111111 confirmation before deletion of vicidial conference record +###################### + +if ($ADD==51111111111111) +{ + echo ""; + + if ( (strlen($conf_exten) < 2) or (strlen($server_ip) < 7) or ($LOGast_delete_phones < 1) ) + { + echo "
VICIDIAL CONFERENCE NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Conference must be at least 2 characters in length\n"; + echo "
Server IP be at least 7 characters in length\n"; + } + else + { + echo "
VICIDIAL CONFERENCE DELETION CONFIRMATION: $conf_exten - $server_ip\n"; + echo "

Click here to delete phone $conf_exten - $server_ip


\n"; + } +$ADD='31111111111111'; # go to vicidial conference modification below +} + + + +###################################################################################################### +###################################################################################################### +####### 6 series, delete records +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=6 delete user record +###################### + +if ($ADD==6) +{ + echo ""; + + if ( ( strlen($user) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_users < 1) ) + { + echo "
USER NOT DELETED - Please go back and look at the data you entered\n"; + echo "
User be at least 2 characters in length\n"; + } + else + { + $stmtA="DELETE from vicidial_users where user='$user' limit 1;"; + $rslt=mysql_query($stmtA, $link); + + $stmt="DELETE from vicidial_campaign_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_inbound_group_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING USER!!!!|$PHP_AUTH_USER|$ip|$user|$stmtA|$stmt|\n"); + fclose($fp); + } + echo "
USER DELETION COMPLETED: $user\n"; + echo "

\n"; + } + +$ADD='0'; # go to user list +} + +###################### +# ADD=61 delete campaign record +###################### + +if ($ADD==61) +{ + echo ""; + + if ( ( strlen($campaign_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_campaigns < 1) ) + { + echo "
CAMPAIGN NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_campaigns where campaign_id='$campaign_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaign_agents where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_live_agents where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaign_statuses where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaign_hotkeys where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_callbacks where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaign_stats where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_lead_recycle where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaign_server_stats where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_server_trunks where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_pause_codes where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaigns_list_mix where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOVING LIST HOPPER LEADS FROM OLD CAMPAIGN HOPPER ($campaign_id)\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!DELETING CAMPAIGN!|$PHP_AUTH_USER|$ip|campaign_id='$campaign_id'|\n"); + fclose($fp); + } + echo "
CAMPAIGN DELETION COMPLETED: $campaign_id\n"; + echo "

\n"; + } + +$ADD='10'; # go to campaigns list +} + +###################### +# ADD=62 Logout all agents from a campaign +###################### + +if ($ADD==62) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
AGENTS NOT LOGGED OUT OF CAMPAIGN - Please go back and look at the data you entered\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_live_agents where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!AGENT LOGOUT!!!!!!|$PHP_AUTH_USER|$ip|campaign_id='$campaign_id'|\n"); + fclose($fp); + } + echo "
AGENT LOGOUT COMPLETED: $campaign_id\n"; + echo "

\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD='31'; # go to campaign modification below +} + + +###################### +# ADD=63 Emergency VDAC Jam Clear +###################### + +if ($ADD==63) +{ + if ($LOGmodify_campaigns==1) + { + if (eregi('IN',$stage)) + {$group_id=$campaign_id;} + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
VDAC NOT CLEARED FOR CAMPAIGN - Please go back and look at the data you entered\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_auto_calls where status='LIVE' and campaign_id='$campaign_id' order by call_time limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|EMERGENCY VDAC CLEAR|$PHP_AUTH_USER|$ip|campaign_id='$campaign_id'|\n"); + fclose($fp); + } + echo "
LAST VDAC RECORD CLEARED FOR CAMPAIGN: $campaign_id\n"; + echo "

\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +# go to campaign modification below +if (eregi('IN',$stage)) + {$ADD='3111';} +else + {$ADD='31';} +} + + +###################### +# ADD=65 delete campaign lead recycle in the system +###################### + +if ($ADD==65) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
CAMPAIGN LEAD RECYCLE NOT DELETED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 6 characters in length\n"; + echo "
attempt delay must be at least 120 seconds\n"; + echo "
maximum attempts must be from 1 to 10\n"; + } + else + { + echo "
CAMPAIGN LEAD RECYCLE DELETED: $campaign_id - $status - $attempt_delay\n"; + + $stmt="DELETE FROM vicidial_lead_recycle where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE LEAD RECYCLE |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$SUB=25; +$ADD=31; # go to campaign modification form below +} + + +###################### +# ADD=66 delete auto alt dial status from the campaign +###################### + +if ($ADD==66) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and auto_alt_dial_statuses LIKE \"% $status %\";"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] < 1) + {echo "
AUTO ALT DIAL STATUS NOT DELETED - this auto alt dial status is not in this campaign\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
AUTO ALT DIAL STATUS NOT DELETED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 6 characters in length\n"; + } + else + { + echo "
AUTO ALT DIAL STATUS DELETED: $campaign_id - $status\n"; + + $stmt="SELECT auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + $auto_alt_dial_statuses = eregi_replace(" $status "," ",$row[0]); + $stmt="UPDATE vicidial_campaigns set auto_alt_dial_statuses='$auto_alt_dial_statuses' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE AUTALTDIALSTTUS|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$SUB=26; +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=67 delete agent pause code in the system +###################### + +if ($ADD==67) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($pause_code) < 1) ) + { + echo "
CAMPAIGN PAUSE CODE NOT DELETED - Please go back and look at the data you entered\n"; + echo "
pause code must be between 1 and 6 characters in length\n"; + } + else + { + echo "
CAMPAIGN PAUSE CODE DELETED: $campaign_id - $pause_code\n"; + + $stmt="DELETE FROM vicidial_pause_codes where campaign_id='$campaign_id' and pause_code='$pause_code';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE AGENT PAUSECODE|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$SUB=27; +$ADD=31; # go to campaign modification form below +} + + +###################### +# ADD=68 remove campaign dial status +###################### + +if ($ADD==68) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and dial_statuses LIKE \"% $status %\";"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] < 1) + {echo "
CAMPAIGN DIAL STATUS NOT REMOVED - this dial status is not selected for this campaign\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
CAMPAIGN DIAL STATUS NOT REMOVED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 6 characters in length\n"; + } + else + { + echo "
CAMPAIGN DIAL STATUS REMOVED: $campaign_id - $status\n"; + + $stmt="SELECT dial_statuses from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + $dial_statuses = eregi_replace(" $status "," ",$row[0]); + $stmt="UPDATE vicidial_campaigns set dial_statuses='$dial_statuses' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DIAL STATUS REMOVED |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +#$SUB=28; +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=611 delete list record and all leads within it +###################### + +if ($ADD==611) +{ + echo ""; + + if ( ( strlen($list_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_lists < 1) ) + { + echo "
LIST NOT DELETED - Please go back and look at the data you entered\n"; + echo "
List_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_lists where list_id='$list_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOVING LIST HOPPER LEADS FROM OLD CAMPAIGN HOPPER ($list_id)\n"; + $stmt="DELETE from vicidial_hopper where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOVING LIST LEADS FROM VICIDIAL_LIST TABLE\n"; + $stmt="DELETE from vicidial_list where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING LIST!!!!|$PHP_AUTH_USER|$ip|list_id='$list_id'|\n"); + fclose($fp); + } + echo "
LIST DELETION COMPLETED: $list_id\n"; + echo "

\n"; + } + +$ADD='100'; # go to lists list +} + +###################### +# ADD=6111 delete in-group record +###################### + +if ($ADD==6111) +{ + echo ""; + + if ( (strlen($group_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_ingroups < 1) ) + { + echo "
IN-GROUP NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Group_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_inbound_groups where group_id='$group_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_inbound_group_agents where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_live_inbound_agents where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING IN-GROUP!!|$PHP_AUTH_USER|$ip|group_id='$group_id'|\n"); + fclose($fp); + } + echo "
IN-GROUP DELETION COMPLETED: $group_id\n"; + echo "

\n"; + } + +$ADD='1000'; # go to in-group list +} + +###################### +# ADD=61111 delete remote agent record +###################### + +if ($ADD==61111) +{ + echo ""; + + if ( (strlen($remote_agent_id) < 1) or ($CoNfIrM != 'YES') or ($LOGdelete_remote_agents < 1) ) + { + echo "
REMOTE AGENT NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Remote_agent_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_remote_agents where remote_agent_id='$remote_agent_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING RMTAGENT!!|$PHP_AUTH_USER|$ip|remote_agent_id='$remote_agent_id'|\n"); + fclose($fp); + } + echo "
REMOTE AGENT DELETION COMPLETED: $remote_agent_id\n"; + echo "

\n"; + } + +$ADD='10000'; # go to remote agents list +} + +###################### +# ADD=611111 delete user group record +###################### + +if ($ADD==611111) +{ + echo ""; + + if ( (strlen($user_group) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_user_groups < 1) ) + { + echo "
USER GROUP NOT DELETED - Please go back and look at the data you entered\n"; + echo "
User_group be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_user_groups where user_group='$user_group' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING USRGROUP!!|$PHP_AUTH_USER|$ip|user_group='$user_group'|\n"); + fclose($fp); + } + echo "
USER GROUP DELETION COMPLETED: $user_group\n"; + echo "

\n"; + } + +$ADD='100000'; # go to user group list +} + +###################### +# ADD=6111111 delete script record +###################### + +if ($ADD==6111111) +{ + echo ""; + + if ( (strlen($script_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_scripts < 1) ) + { + echo "
SCRIPT NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Script_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_scripts where script_id='$script_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING SCRIPT!!!!|$PHP_AUTH_USER|$ip|script_id='$script_id'|\n"); + fclose($fp); + } + echo "
SCRIPT DELETION COMPLETED: $script_id\n"; + echo "

\n"; + } + +$ADD='1000000'; # go to script list +} + + +###################### +# ADD=61111111 delete filter record +###################### + +if ($ADD==61111111) +{ + echo ""; + + if ( (strlen($lead_filter_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_filters < 1) ) + { + echo "
FILTER NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Filter ID must be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_lead_filters where lead_filter_id='$lead_filter_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING FILTER!!!!|$PHP_AUTH_USER|$ip|lead_filter_id='$lead_filter_id'|\n"); + fclose($fp); + } + echo "
FILTER DELETION COMPLETED: $lead_filter_id\n"; + echo "

\n"; + } + +$ADD='10000000'; # go to filter list +} + + +###################### +# ADD=611111111 delete call times record +###################### + +if ($ADD==611111111) +{ + echo ""; + + if ( (strlen($call_time_id) < 2) or ($LOGdelete_call_times < 1) ) + { + echo "
CALL TIME NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Call Time ID must be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_call_times where call_time_id='$call_time_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING CALL TIME!|$PHP_AUTH_USER|$ip|call_time_id='$call_time_id'|\n"); + fclose($fp); + } + echo "
CALL TIME DELETION COMPLETED: $call_time_id\n"; + echo "

\n"; + } + +$ADD='100000000'; # go to call times list +} + + +###################### +# ADD=6111111111 delete state call times record +###################### + +if ($ADD==6111111111) +{ + echo ""; + + if ( (strlen($call_time_id) < 2) or ($LOGdelete_call_times < 1) ) + { + echo "
STATE CALL TIME NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Call Time ID must be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_state_call_times where state_call_time_id='$call_time_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT call_time_id,ct_state_call_times from vicidial_call_times where ct_state_call_times LIKE \"%|$call_time_id|%\" order by call_time_id;"; + $rslt=mysql_query($stmt, $link); + $sct_to_print = mysql_num_rows($rslt); + $sct_list=''; + + $o=0; + while ($sct_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $sct_ids[$o] = "$rowx[0]"; + $sct_states[$o] = "$rowx[1]"; + $o++; + } + $o=0; + + while ($sct_to_print > $o) { + $sct_states[$o] = eregi_replace("\|$call_time_id\|",'|',$sct_states[$o]); + $stmt="UPDATE vicidial_call_times set ct_state_call_times='$sct_states[$o]' where call_time_id='$sct_ids[$o]';"; + $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + echo "State Rule Removed: $sct_ids[$o]
\n"; + $o++; + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING CALL TIME!|$PHP_AUTH_USER|$ip|state_call_time_id='$call_time_id'|\n"); + fclose($fp); + } + echo "
STATE CALL TIME DELETION COMPLETED: $call_time_id\n"; + echo "

\n"; + } + +$ADD='1000000000'; # go to call times list +} + + +###################### +# ADD=61111111111 delete phone record +###################### + +if ($ADD==61111111111) +{ + echo ""; + + if ( (strlen($extension) < 2) or (strlen($server_ip) < 7) or ($CoNfIrM != 'YES') or ($LOGast_delete_phones < 1) ) + { + echo "
PHONE NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Extension be at least 2 characters in length\n"; + echo "
Server IP be at least 7 characters in length\n"; + } + else + { + $stmt="DELETE from phones where extension='$extension' and server_ip='$server_ip' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING PHONE!!!|$PHP_AUTH_USER|$ip|extension='$extension'|server_ip='$server_ip'|\n"); + fclose($fp); + } + echo "
PHONE DELETION COMPLETED: $extension - $server_ip\n"; + echo "

\n"; + } +$ADD='10000000000'; # go to phone list +} + + +###################### +# ADD=611111111111 delete server record +###################### + +if ($ADD==611111111111) +{ + echo ""; + + if ( (strlen($server_id) < 2) or (strlen($server_ip) < 7) or ($CoNfIrM != 'YES') or ($LOGast_delete_phones < 1) ) + { + echo "
SERVER NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Server ID be at least 2 characters in length\n"; + echo "
Server IP be at least 7 characters in length\n"; + } + else + { + $stmt="DELETE from servers where server_id='$server_id' and server_ip='$server_ip' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING SERVER!!|$PHP_AUTH_USER|$ip|server_id='$server_id'|server_ip='$server_ip'|\n"); + fclose($fp); + } + echo "
SERVER DELETION COMPLETED: $server_id - $server_ip\n"; + echo "

\n"; + } +$ADD='100000000000'; # go to server list +} + + +###################### +# ADD=621111111111 delete vicidial server trunk record in the system +###################### + +if ($ADD==621111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($server_ip) < 7) ) + { + echo "
VICIDIAL SERVER TRUNK RECORD NOT DELETED - Please go back and look at the data you entered\n"; + echo "
campaign must be between 3 and 8 characters in length\n"; + echo "
server_ip delay must be at least 7 characters\n"; + } + else + { + echo "
VICIDIAL SERVER TRUNK RECORD DELETED: $campaign_id - $server_ip\n"; + + $stmt="DELETE FROM vicidial_server_trunks where campaign_id='$campaign_id' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE SERVER TRUNK |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=311111111111; # go to server modification form below +} + + +###################### +# ADD=6111111111111 delete conference record +###################### + +if ($ADD==6111111111111) +{ + echo ""; + + if ( (strlen($conf_exten) < 2) or (strlen($server_ip) < 7) or ($CoNfIrM != 'YES') or ($LOGast_delete_phones < 1) ) + { + echo "
CONFERENCE NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Conference be at least 2 characters in length\n"; + echo "
Server IP be at least 7 characters in length\n"; + } + else + { + $stmt="DELETE from conferences where conf_exten='$conf_exten' and server_ip='$server_ip' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING CONF!!!!|$PHP_AUTH_USER|$ip|conf_exten='$conf_exten'|server_ip='$server_ip'|\n"); + fclose($fp); + } + echo "
CONFERENCE DELETION COMPLETED: $conf_exten - $server_ip\n"; + echo "

\n"; + } +$ADD='1000000000000'; # go to conference list +} + + +###################### +# ADD=61111111111111 delete vicidial conference record +###################### + +if ($ADD==61111111111111) +{ + echo ""; + + if ( (strlen($conf_exten) < 2) or (strlen($server_ip) < 7) or ($CoNfIrM != 'YES') or ($LOGast_delete_phones < 1) ) + { + echo "
VICIDIAL CONFERENCE NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Conference be at least 2 characters in length\n"; + echo "
Server IP be at least 7 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_conferences where conf_exten='$conf_exten' and server_ip='$server_ip' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING CONF!!!!|$PHP_AUTH_USER|$ip|conf_exten='$conf_exten'|server_ip='$server_ip'|\n"); + fclose($fp); + } + echo "
VICIDIAL CONFERENCE DELETION COMPLETED: $conf_exten - $server_ip\n"; + echo "

\n"; + } +$ADD='10000000000000'; # go to vicidial conference list +} + + + + + +###################################################################################################### +###################################################################################################### +####### 3 series, record modification forms +###################################################################################################### +###################################################################################################### + + + + +###################### +# ADD=3 modify user info in the system +###################### + +if ($ADD==3) +{ + if ($LOGmodify_users==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $user_level = $row[4]; + $user_group = $row[5]; + $phone_login = $row[6]; + $phone_pass = $row[7]; + $delete_users = $row[8]; + $delete_user_groups = $row[9]; + $delete_lists = $row[10]; + $delete_campaigns = $row[11]; + $delete_ingroups = $row[12]; + $delete_remote_agents = $row[13]; + $load_leads = $row[14]; + $campaign_detail = $row[15]; + $ast_admin_access = $row[16]; + $ast_delete_phones = $row[17]; + $delete_scripts = $row[18]; + $modify_leads = $row[19]; + $hotkeys_active = $row[20]; + $change_agent_campaign =$row[21]; + $agent_choose_ingroups =$row[22]; + $scheduled_callbacks = $row[24]; + $agentonly_callbacks = $row[25]; + $agentcall_manual = $row[26]; + $vicidial_recording = $row[27]; + $vicidial_transfers = $row[28]; + $delete_filters = $row[29]; + $alter_agent_interface_options =$row[30]; + $closer_default_blended = $row[31]; + $delete_call_times = $row[32]; + $modify_call_times = $row[33]; + $modify_users = $row[34]; + $modify_campaigns = $row[35]; + $modify_lists = $row[36]; + $modify_scripts = $row[37]; + $modify_filters = $row[38]; + $modify_ingroups = $row[39]; + $modify_usergroups = $row[40]; + $modify_remoteagents = $row[41]; + $modify_servers = $row[42]; + $view_reports = $row[43]; + $vicidial_recording_override = $row[44]; + $alter_custdata_override = $row[45]; + + if ( ($user_level >= $LOGuser_level) and ($LOGuser_level < 9) ) + { + echo "
You do not have permissions to modify this user: $row[1]\n"; + } + else + { + echo "
MODIFY A USERS RECORD: $row[1]\n"; + if ($LOGuser_level > 8) + {echo "\n";} + else + { + if ($LOGalter_agent_interface == "1") + {echo "\n";} + else + {echo "\n";} + } + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + if ( ($LOGuser_level > 8) or ($LOGalter_agent_interface == "1") ) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + if ($LOGuser_level > 8) + { + echo "\n"; + +#9BB9FB +#B9CBFD + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + echo "\n"; + echo "
User Number: $row[1]$NWB#vicidial_users-user$NWE
Password: $NWB#vicidial_users-pass$NWE
Full Name: $NWB#vicidial_users-full_name$NWE
User Level: $NWB#vicidial_users-user_level$NWE
User Group: $NWB#vicidial_users-user_group$NWE
Phone Login: $NWB#vicidial_users-phone_login$NWE
Phone Pass: $NWB#vicidial_users-phone_pass$NWE
AGENT INTERFACE OPTIONS:
Agent Choose Ingroups: $NWB#vicidial_users-agent_choose_ingroups$NWE
Hot Keys Active: $NWB#vicidial_users-hotkeys_active$NWE
Scheduled Callbacks: $NWB#vicidial_users-scheduled_callbacks$NWE
Agent-Only Callbacks: $NWB#vicidial_users-agentonly_callbacks$NWE
Agent Call Manual: $NWB#vicidial_users-agentcall_manual$NWE
Vicidial Recording: $NWB#vicidial_users-vicidial_recording$NWE
Vicidial Transfers: $NWB#vicidial_users-vicidial_transfers$NWE
Closer Default Blended: $NWB#vicidial_users-closer_default_blended$NWE
VICIDIAL Recording Override: $NWB#vicidial_users-vicidial_recording_override$NWE
Agent Alter Customer Data Override: $NWB#vicidial_users-alter_custdata_override$NWE
Campaign Ranks: $NWB#vicidial_users-campaign_ranks$NWE
\n"; + echo "\n"; + echo "$RANKcampaigns_list"; + echo "
\n"; + echo "
Inbound Groups: $NWB#vicidial_users-closer_campaigns$NWE
\n"; + echo "\n"; + echo "$RANKgroups_list"; + echo "
\n"; + echo "
ADMIN INTERFACE OPTIONS:
View Reports: $NWB#vicidial_users-view_reports$NWE
Alter Agent Interface Options: $NWB#vicidial_users-alter_agent_interface_options$NWE
Modify Users: $NWB#vicidial_users-modify_sections$NWE
Change Agent Campaign: $NWB#vicidial_users-change_agent_campaign$NWE
Delete Users: $NWB#vicidial_users-delete_users$NWE
Modify User Groups: $NWB#vicidial_users-modify_sections$NWE
Delete User Groups: $NWB#vicidial_users-delete_user_groups$NWE
Modify Lists: $NWB#vicidial_users-modify_sections$NWE
Delete Lists: $NWB#vicidial_users-delete_lists$NWE
Load Leads: $NWB#vicidial_users-load_leads$NWE
Modify Leads: $NWB#vicidial_users-modify_leads$NWE
Modify Campaigns: $NWB#vicidial_users-modify_sections$NWE
Campaign Detail: $NWB#vicidial_users-campaign_detail$NWE
Delete Campaigns: $NWB#vicidial_users-delete_campaigns$NWE
Modify In-Groups: $NWB#vicidial_users-modify_sections$NWE
Delete In-Groups: $NWB#vicidial_users-delete_ingroups$NWE
Modify Remote Agents: $NWB#vicidial_users-modify_sections$NWE
Delete Remote Agents: $NWB#vicidial_users-delete_remote_agents$NWE
Modify Scripts: $NWB#vicidial_users-modify_sections$NWE
Delete Scripts: $NWB#vicidial_users-delete_scripts$NWE
Modify Filters: $NWB#vicidial_users-modify_sections$NWE
Delete Filters: $NWB#vicidial_users-delete_filters$NWE
AGC Admin Access: $NWB#vicidial_users-ast_admin_access$NWE
AGC Delete Phones: $NWB#vicidial_users-ast_delete_phones$NWE
Modify Call Times: $NWB#vicidial_users-modify_call_times$NWE
Delete Call Times: $NWB#vicidial_users-delete_call_times$NWE
Modify Servers: $NWB#vicidial_users-modify_sections$NWE
\n"; + + if ($LOGdelete_users > 0) + { + echo "

DELETE THIS USER\n"; + } + echo "

Click here for user time sheet\n"; + echo "

Click here for user status\n"; + echo "

Click here for user stats\n"; + echo "

Click here for user CallBack Holds\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=31 modify campaign info in the system - Detail view +###################### + +if ( ($LOGcampaign_detail < 1) and ($ADD==31) ) {$ADD=34;} # send to Basic if not allowed + +if ( ($ADD==31) and ( (!eregi("$campaign_id",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) ) + {$ADD=30;} # send to not allowed screen if not in vicidial_user_groups allowed_campaigns list + +if ($ADD==31) +{ + if ($LOGmodify_campaigns==1) + { + if ($stage=='show_dialable') + { + $stmt="UPDATE vicidial_campaigns set display_dialable_count='Y' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + if ($stage=='hide_dialable') + { + $stmt="UPDATE vicidial_campaigns set display_dialable_count='N' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + + $stmt="SELECT * from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $campaign_name = $row[1]; + $dial_status_a = $row[3]; + $dial_status_b = $row[4]; + $dial_status_c = $row[5]; + $dial_status_d = $row[6]; + $dial_status_e = $row[7]; + $lead_order = $row[8]; + $allow_closers = $row[12]; + $hopper_level = $row[13]; + $auto_dial_level = $row[14]; + $next_agent_call = $row[15]; + $local_call_time = $row[16]; + $voicemail_ext = $row[17]; + $dial_timeout = $row[18]; + $dial_prefix = $row[19]; + $campaign_cid = $row[20]; + $campaign_vdad_exten = $row[21]; + $campaign_rec_exten = $row[22]; + $campaign_recording = $row[23]; + $campaign_rec_filename = $row[24]; + $script_id = $row[25]; + $get_call_launch = $row[26]; + $am_message_exten = $row[27]; + $amd_send_to_vmx = $row[28]; + $xferconf_a_dtmf = $row[29]; + $xferconf_a_number = $row[30]; + $xferconf_b_dtmf = $row[31]; + $xferconf_b_number = $row[32]; + $alt_number_dialing = $row[33]; + $scheduled_callbacks = $row[34]; + $lead_filter_id = $row[35]; + if ($lead_filter_id=='') {$lead_filter_id='NONE';} + $drop_call_seconds = $row[36]; + $safe_harbor_message = $row[37]; + $safe_harbor_exten = $row[38]; + $display_dialable_count = $row[39]; + $wrapup_seconds = $row[40]; + $wrapup_message = $row[41]; + # $closer_campaigns = $row[42]; + $use_internal_dnc = $row[43]; + $allcalls_delay = $row[44]; + $omit_phone_code = $row[45]; + $dial_method = $row[46]; + $available_only_ratio_tally = $row[47]; + $adaptive_dropped_percentage = $row[48]; + $adaptive_maximum_level = $row[49]; + $adaptive_latest_server_time = $row[50]; + $adaptive_intensity = $row[51]; + $adaptive_dl_diff_target = $row[52]; + $concurrent_transfers = $row[53]; + $auto_alt_dial = $row[54]; + $auto_alt_dial_statuses = $row[55]; + $agent_pause_codes_active = $row[56]; + $campaign_description = $row[57]; + $campaign_changedate = $row[58]; + $campaign_stats_refresh = $row[59]; + $campaign_logindate = $row[60]; + $dial_statuses = $row[61]; + $disable_alter_custdata = $row[62]; + $no_hopper_leads_logins = $row[63]; + $list_order_mix = $row[64]; + $campaign_allow_inbound = $row[65]; + $manual_dial_list_id = $row[66]; + $default_xfer_group = $row[67]; + + if (ereg("DISABLED",$list_order_mix)) + {$DEFlistDISABLE = ''; $DEFstatusDISABLED=0;} + else + {$DEFlistDISABLE = 'disabled'; $DEFstatusDISABLED=1;} + + $stmt="SELECT count(*) from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and status='ACTIVE'"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0] < 1) + { + $mixes_list="\n"; + $mixname_list["DISABLED"] = "DISABLED"; + } + else + { + ##### get list_mix listings for dynamic pulldown + $stmt="SELECT vcl_id,vcl_name from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and status='ACTIVE' limit 1"; + $rslt=mysql_query($stmt, $link); + $mixes_to_print = mysql_num_rows($rslt); + $mixes_list="\n"; + + $o=0; + while ($mixes_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $mixes_list .= "\n"; + $mixname_list["ACTIVE"] = "$rowx[0] - $rowx[1]"; + $o++; + } + } + + ##### get status listings for dynamic pulldown + $stmt="SELECT * from vicidial_statuses order by status"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $statuses_list=''; + + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $statuses_list .= "\n"; + $statname_list["$rowx[0]"] = "$rowx[1]"; + $LRstatuses_list .= "\n"; + if (eregi("Y",$rowx[2])) + {$HKstatuses_list .= "\n";} + $o++; + } + + $stmt="SELECT * from vicidial_campaign_statuses where campaign_id='$campaign_id' order by status"; + $rslt=mysql_query($stmt, $link); + $Cstatuses_to_print = mysql_num_rows($rslt); + + $o=0; + while ($Cstatuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $statuses_list .= "\n"; + $statname_list["$rowx[0]"] = "$rowx[1]"; + $LRstatuses_list .= "\n"; + if (eregi("Y",$rowx[2])) + {$HKstatuses_list .= "\n";} + $o++; + } + + $dial_statuses = preg_replace("/ -$/","",$dial_statuses); + $Dstatuses = explode(" ", $dial_statuses); + $Ds_to_print = (count($Dstatuses) -1); + + ##### get in-groups listings for dynamic pulldown list menu + $stmt="SELECT group_id,group_name from vicidial_inbound_groups $xfer_groupsSQL order by group_id"; + $rslt=mysql_query($stmt, $link); + $Xgroups_to_print = mysql_num_rows($rslt); + $Xgroups_menu=''; + $Xgroups_selected=0; + $o=0; + while ($Xgroups_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $Xgroups_menu .= "\n"; + $o++; + } + if ($Xgroups_selected < 1) + {$Xgroups_menu .= "\n";} + else + {$Xgroups_menu .= "\n";} + + + if ($SUB<1) {$camp_detail_color=$subcamp_color;} + else {$camp_detail_color=$campaigns_color;} + if ($SUB==22) {$camp_statuses_color=$subcamp_color;} + else {$camp_statuses_color=$campaigns_color;} + if ($SUB==23) {$camp_hotkeys_color=$subcamp_color;} + else {$camp_hotkeys_color=$campaigns_color;} + if ($SUB==25) {$camp_recycle_color=$subcamp_color;} + else {$camp_recycle_color=$campaigns_color;} + if ($SUB==26) {$camp_autoalt_color=$subcamp_color;} + else {$camp_autoalt_color=$campaigns_color;} + if ($SUB==27) {$camp_pause_color=$subcamp_color;} + else {$camp_pause_color=$campaigns_color;} + if ($SUB==29) {$camp_listmix_color=$subcamp_color;} + else {$camp_listmix_color=$campaigns_color;} + echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "
$row[0]: Basic Detail StatusesHotKeysLead RecyclingAuto Alt DialPause CodesList Mix Real-Time
\n"; + + echo "
\n"; + echo ""; + + echo "
\n"; + + if ($SUB < 1) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + $o=0; + while ($Ds_to_print > $o) + { + $o++; + $Dstatus = $Dstatuses[$o]; + + echo "\n"; + } + else + { + echo "$Dstatus - $statname_list[$Dstatus]         \n"; + echo "REMOVE\n"; + } + } + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + + + echo "\n"; + + echo "\n"; + + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + if ($campaign_allow_inbound == 'Y') + { + echo "\n"; + } + + echo "\n"; + + if ($allow_closers == 'Y') + { + echo "\n"; + } + + echo "\n"; + echo "
Campaign ID: $row[0]$NWB#vicidial_campaigns-campaign_id$NWE
Campaign Name: $NWB#vicidial_campaigns-campaign_name$NWE
Campaign Description: $NWB#vicidial_campaigns-campaign_description$NWE
Campaign Change Date: $campaign_changedate   $NWB#vicidial_campaigns-campaign_changedate$NWE
Campaign Login Date: $campaign_logindate   $NWB#vicidial_campaigns-campaign_logindate$NWE
Active: $NWB#vicidial_campaigns-active$NWE
Park Extension: - Filename: $NWB#vicidial_campaigns-park_ext$NWE
Web Form: $NWB#vicidial_campaigns-web_form_address$NWE
Allow Closers: $NWB#vicidial_campaigns-allow_closers$NWE
Allow Inbound and Blended: $NWB#vicidial_campaigns-campaign_allow_inbound$NWE
Dial Status $o: \n"; + + if ($DEFstatusDISABLED > 0) + { + echo "$Dstatus - $statname_list[$Dstatus]         \n"; + echo "REMOVE
Add A Dial Status:   \n"; + echo "     $NWB#vicidial_campaigns-dial_status$NWE
List Order: $NWB#vicidial_campaigns-lead_order$NWE
List Mix: $NWB#vicidial_campaigns-list_order_mix$NWE
Lead Filter: $NWB#vicidial_campaigns-lead_filter_id$NWE
Hopper Level: $NWB#vicidial_campaigns-hopper_level$NWE
Force Reset of Hopper: $NWB#vicidial_campaigns-force_reset_hopper$NWE
Dial Method: $NWB#vicidial_campaigns-dial_method$NWE
Auto Dial Level: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE       ADAPT OVERRIDE
Available Only Tally: $NWB#vicidial_campaigns-available_only_ratio_tally$NWE
Drop Percentage Limit: % $NWB#vicidial_campaigns-adaptive_dropped_percentage$NWE
Maximum Adapt Dial Level: number only $NWB#vicidial_campaigns-adaptive_maximum_level$NWE
Latest Server Time: 4 digits only $NWB#vicidial_campaigns-adaptive_latest_server_time$NWE
Adapt Intensity Modifier: $NWB#vicidial_campaigns-adaptive_intensity$NWE
Dial Level Difference Target: $NWB#vicidial_campaigns-adaptive_dl_diff_target$NWE
Concurrent Transfers: $NWB#vicidial_campaigns-concurrent_transfers$NWE
Auto Alt-Number Dialing: $NWB#vicidial_campaigns-auto_alt_dial$NWE
Next Agent Call: $NWB#vicidial_campaigns-next_agent_call$NWE
Local Call Time: $NWB#vicidial_campaigns-local_call_time$NWE
Dial Timeout: in seconds$NWB#vicidial_campaigns-dial_timeout$NWE
Dial Prefix: for 91NXXNXXXXXX value would be 9, for no dial prefix use X$NWB#vicidial_campaigns-dial_prefix$NWE
Omit Phone Code: $NWB#vicidial_campaigns-omit_phone_code$NWE
Campaign CallerID: $NWB#vicidial_campaigns-campaign_cid$NWE
Campaign VDAD exten: $NWB#vicidial_campaigns-campaign_vdad_exten$NWE
Campaign Rec exten: $NWB#vicidial_campaigns-campaign_rec_exten$NWE
Campaign Recording: $NWB#vicidial_campaigns-campaign_recording$NWE
Campaign Rec Filename: $NWB#vicidial_campaigns-campaign_rec_filename$NWE
Recording Delay: in seconds$NWB#vicidial_campaigns-allcalls_delay$NWE
Script: $NWB#vicidial_campaigns-campaign_script$NWE
Get Call Launch: $NWB#vicidial_campaigns-get_call_launch$NWE
Answering Machine Message: $NWB#vicidial_campaigns-am_message_exten$NWE
AMD Send to VM exten: $NWB#vicidial_campaigns-amd_send_to_vmx$NWE
Transfer-Conf DTMF 1: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
Transfer-Conf Number 1: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
Transfer-Conf DTMF 2: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
Transfer-Conf Number 2: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
Alt Number Dialing: $NWB#vicidial_campaigns-alt_number_dialing$NWE
Scheduled Callbacks: $NWB#vicidial_campaigns-scheduled_callbacks$NWE
Drop Call Seconds: $NWB#vicidial_campaigns-drop_call_seconds$NWE
Voicemail: $NWB#vicidial_campaigns-voicemail_ext$NWE
Use Safe Harbor Message: $NWB#vicidial_campaigns-safe_harbor_message$NWE
Safe Harbor Exten: $NWB#vicidial_campaigns-safe_harbor_exten$NWE
Wrap Up Seconds: $NWB#vicidial_campaigns-wrapup_seconds$NWE
Wrap Up Message: $NWB#vicidial_campaigns-wrapup_message$NWE
Use Internal DNC List: $NWB#vicidial_campaigns-use_internal_dnc$NWE
Agent Pause Codes Active: $NWB#vicidial_campaigns-agent_pause_codes_active$NWE
Campaign Stats Refresh: $NWB#vicidial_campaigns-campaign_stats_refresh$NWE
Disable Alter Customer Data: $NWB#vicidial_campaigns-disable_alter_custdata$NWE
Allow No-Hopper-Leads Logins: $NWB#vicidial_campaigns-no_hopper_leads_logins$NWE
Manual Dial List ID: $NWB#vicidial_campaigns-manual_dial_list_id$NWE
Allowed Inbound Groups:
"; + echo " $NWB#vicidial_campaigns-closer_campaigns$NWE
\n"; + echo "$groups_list"; + echo "
Default Transfer Group: $NWB#vicidial_campaigns-default_xfer_group$NWE
Allowed Transfer Groups:
"; + echo " $NWB#vicidial_campaigns-xfer_groups$NWE
\n"; + echo "$XFERgroups_list"; + echo "
\n"; + + echo "
\n"; + echo "
LISTS WITHIN THIS CAMPAIGN:   $NWB#vicidial_campaign_lists$NWE
\n"; + echo "\n"; + echo "\n"; + + $active_lists = 0; + $inactive_lists = 0; + $stmt="SELECT list_id,active,list_name from vicidial_lists where campaign_id='$campaign_id'"; + $rslt=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rslt); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $o++; + if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_lists++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + echo "
LIST IDLIST NAMEACTIVE
$rowx[0]$rowx[2]$rowx[1]

\n"; + echo "
\n"; + + $filterSQL = $filtersql_list[$lead_filter_id]; + $filterSQL = eregi_replace("^and|and$|^or|or$","",$filterSQL); + if (strlen($filterSQL)>4) + {$fSQL = "and $filterSQL";} + else + {$fSQL = '';} + + $camp_lists = eregi_replace(".$","",$camp_lists); + echo "This campaign has $active_lists active lists and $inactive_lists inactive lists

\n"; + + if ($display_dialable_count == 'Y') + { + ### call function to calculate and print dialable leads + dialable_leads($DB,$link,$local_call_time,$dial_statuses,$camp_lists,$fSQL); + echo " - HIDE

"; + } + else + { + echo "Popup Dialable Leads Count"; + echo " - SHOW

"; + } + + + + + + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id='$campaign_id' and status IN('READY')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $hopper_leads = "$rowx[0]"; + + echo "This campaign has $hopper_leads leads in the dial hopper

\n"; + echo "Click here to see what leads are in the hopper right now

\n"; + echo "Click here to see all CallBack Holds in this campaign

\n"; + echo "Click here to see a VDAD report for this campaign

\n"; + echo "
\n"; + } + + + + if ($SUB==22) + { + + ##### get status category listings for dynamic pulldown + $stmt="SELECT vsc_id,vsc_name from vicidial_status_categories order by vsc_id desc"; + $rslt=mysql_query($stmt, $link); + $cats_to_print = mysql_num_rows($rslt); + $cats_list=""; + + $o=0; + while ($cats_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $cats_list .= "\n"; + $catsname_list["$rowx[0]"] = substr($rowx[1],0,20); + $o++; + } + + + echo "
\n"; + echo "
CUSTOM STATUSES WITHIN THIS CAMPAIGN:   $NWB#vicidial_campaign_statuses$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_campaign_statuses where campaign_id='$campaign_id'"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $AScategory = $rowx[5]; + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
STATUSDESCRIPTIONSELECTABLEHUMAN ANSWERDELETE
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "$rowx[0]
\n"; + echo "\n"; + echo "         \n"; + echo "   \n"; + echo "DELETE\n"; + echo "
\n"; + + echo "
ADD NEW CUSTOM CAMPAIGN STATUS
\n"; + echo "\n"; + echo "\n"; + echo "Status:   \n"; + echo "Description:   \n"; + echo "Selectable:   \n"; + echo "Human Answer:   \n"; + echo "Category: \n"; + echo "  
\n"; + echo "
\n"; + + echo "

\n"; + } + + + if ($SUB==23) + { + echo "
CUSTOM HOT KEYS WITHIN THIS CAMPAIGN:   $NWB#vicidial_campaign_hotkeys$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_campaign_hotkeys where campaign_id='$campaign_id' order by hotkey"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $o=0; + while ($statuses_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + + echo "
HOT KEYSTATUSDESCRIPTIONDELETE
$rowx[1]$rowx[0]$rowx[2]DELETE
\n"; + + echo "
ADD NEW CUSTOM CAMPAIGN HOT KEY
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Hotkey:   \n"; + echo "Status:   \n"; + echo "
\n"; + echo "

\n"; + } + + + if ($SUB==25) + { + echo "

LEAD RECYCLING WITHIN THIS CAMPAIGN:   $NWB#vicidial_lead_recycle$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_lead_recycle where campaign_id='$campaign_id' order by status"; + $rslt=mysql_query($stmt, $link); + $recycle_to_print = mysql_num_rows($rslt); + $o=0; + while ($recycle_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
STATUSATTEMPT DELAYATTEMPT MAXIMUMACTIVE DELETE
$rowx[2]
\n"; + echo "\n"; + echo "\n"; + echo "
DELETE
\n"; + + echo "
ADD NEW CAMPAIGN LEAD RECYCLE
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Status:   \n"; + echo "Attempt Delay: \n"; + echo "Attempt Maximum: \n"; + echo "
\n"; + + echo "

\n"; + } + + + if ($SUB==26) + { + echo "

AUTO ALT NUMBER DIALING FOR THIS CAMPAIGN:   $NWB#vicidial_auto_alt_dial_statuses$NWE
\n"; + echo "\n"; + echo "\n"; + + $auto_alt_dial_statuses = preg_replace("/ -$/","",$auto_alt_dial_statuses); + $AADstatuses = explode(" ", $auto_alt_dial_statuses); + $AADs_to_print = (count($AADstatuses) -1); + + $o=0; + while ($AADs_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + $o++; + + echo "\n"; + echo "\n"; + } + + echo "
STATUSESDELETE
$AADstatuses[$o]DELETE
\n"; + + echo "
ADD NEW AUTO ALT NUMBER DIALING STATUS
\n"; + echo "\n"; + echo "\n"; + echo "Status:   \n"; + echo "
\n"; + + echo "

\n"; + } + + + if ($SUB==27) + { + echo "

AGENT PAUSE CODES FOR THIS CAMPAIGN:   $NWB#vicidial_pause_codes$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_pause_codes where campaign_id='$campaign_id' order by pause_code"; + $rslt=mysql_query($stmt, $link); + $pause_codes_to_print = mysql_num_rows($rslt); + $o=0; + while ($pause_codes_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
PAUSE CODESBILLABLEMODIFYDELETE
$rowx[0]\n"; + echo "\n"; + echo "\n"; + echo "  \n"; + echo "
DELETE
\n"; + + echo "
ADD NEW AGENT PAUSE CODE
\n"; + echo "\n"; + echo "\n"; + echo "Pause Code: \n"; + echo "Pause Code Name: \n"; + echo "   Billable: \n"; + echo "
\n"; + + echo "

\n"; + } + + + if ($SUB < 1) + { + echo "

\n"; + echo "LOG ALL AGENTS OUT OF THIS CAMPAIGN

\n"; + echo "EMERGENCY VDAC CLEAR FOR THIS CAMPAIGN

\n"; + + if ($LOGdelete_campaigns > 0) + { + echo "

DELETE THIS CAMPAIGN\n"; + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=34 modify campaign info in the system - Basic View +###################### + +if ( ($ADD==34) and ( (!eregi("$campaign_id",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) ) + {$ADD=30;} # send to not allowed screen if not in vicidial_user_groups allowed_campaigns list + +if ($ADD==34) +{ + if ($LOGmodify_campaigns==1) + { + if ($stage=='show_dialable') + { + $stmt="UPDATE vicidial_campaigns set display_dialable_count='Y' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + if ($stage=='hide_dialable') + { + $stmt="UPDATE vicidial_campaigns set display_dialable_count='N' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + + $stmt="SELECT * from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $dial_status_a = $row[3]; + $dial_status_b = $row[4]; + $dial_status_c = $row[5]; + $dial_status_d = $row[6]; + $dial_status_e = $row[7]; + $lead_order = $row[8]; + $hopper_level = $row[13]; + $auto_dial_level = $row[14]; + $next_agent_call = $row[15]; + $local_call_time = $row[16]; + $voicemail_ext = $row[17]; + $dial_timeout = $row[18]; + $dial_prefix = $row[19]; + $campaign_cid = $row[20]; + $campaign_vdad_exten = $row[21]; + $script_id = $row[25]; + $get_call_launch = $row[26]; + $lead_filter_id = $row[35]; + if ($lead_filter_id=='') {$lead_filter_id='NONE';} + $display_dialable_count = $row[39]; + $dial_method = $row[46]; + $adaptive_intensity = $row[51]; + $campaign_description = $row[57]; + $campaign_changedate = $row[58]; + $campaign_stats_refresh = $row[59]; + $campaign_logindate = $row[60]; + $dial_statuses = $row[61]; + $list_order_mix = $row[64]; + $default_xfer_group = $row[67]; + $campaign_allow_inbound = $row[65]; + $default_xfer_group = $row[67]; + + if (ereg("DISABLED",$list_order_mix)) + {$DEFlistDISABLE = ''; $DEFstatusDISABLED=0;} + else + {$DEFlistDISABLE = 'disabled'; $DEFstatusDISABLED=1;} + + $stmt="SELECT * from vicidial_statuses order by status"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $statuses_list=''; + + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $statuses_list .= "\n"; + $statname_list["$rowx[0]"] = "$rowx[1]"; + $LRstatuses_list .= "\n"; + if (eregi("Y",$rowx[2])) + {$HKstatuses_list .= "\n";} + $o++; + } + + $stmt="SELECT * from vicidial_campaign_statuses where campaign_id='$campaign_id' order by status"; + $rslt=mysql_query($stmt, $link); + $Cstatuses_to_print = mysql_num_rows($rslt); + + $o=0; + while ($Cstatuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $statuses_list .= "\n"; + $statname_list["$rowx[0]"] = "$rowx[1]"; + $LRstatuses_list .= "\n"; + if (eregi("Y",$rowx[2])) + {$HKstatuses_list .= "\n";} + $o++; + } + + $dial_statuses = preg_replace("/ -$/","",$dial_statuses); + $Dstatuses = explode(" ", $dial_statuses); + $Ds_to_print = (count($Dstatuses) -1); + + $stmt="SELECT count(*) from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and status='ACTIVE'"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0] < 1) + { + $mixes_list="\n"; + $mixname_list["DISABLED"] = "DISABLED"; + } + else + { + ##### get list_mix listings for dynamic pulldown + $stmt="SELECT vcl_id,vcl_name from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and status='ACTIVE' limit 1"; + $rslt=mysql_query($stmt, $link); + $mixes_to_print = mysql_num_rows($rslt); + $mixes_list="\n"; + + $o=0; + while ($mixes_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $mixes_list .= "\n"; + $mixname_list["ACTIVE"] = "$rowx[0] - $rowx[1]"; + $o++; + } + } + + if ($SUB<1) {$camp_detail_color=$subcamp_color;} + else {$camp_detail_color=$campaigns_color;} + if ($SUB==22) {$camp_statuses_color=$subcamp_color;} + else {$camp_statuses_color=$campaigns_color;} + if ($SUB==23) {$camp_hotkeys_color=$subcamp_color;} + else {$camp_hotkeys_color=$campaigns_color;} + if ($SUB==25) {$camp_recycle_color=$subcamp_color;} + else {$camp_recycle_color=$campaigns_color;} + if ($SUB==26) {$camp_autoalt_color=$subcamp_color;} + else {$camp_autoalt_color=$campaigns_color;} + if ($SUB==27) {$camp_pause_color=$subcamp_color;} + else {$camp_pause_color=$campaigns_color;} + if ($SUB==29) {$camp_listmix_color=$subcamp_color;} + else {$camp_listmix_color=$campaigns_color;} + echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "
$row[0]: Basic View Detail View List Mix Real-Time Screen  
\n"; + + if ($SUB < 1) + { + echo "
\n"; + echo ""; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + $o=0; + while ($Ds_to_print > $o) + { + $o++; + $Dstatus = $Dstatuses[$o]; + + echo "\n"; + } + else + { + echo "$Dstatus - $statname_list[$Dstatus]         \n"; + echo "REMOVE\n"; + } + } + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + echo "
Campaign ID: $row[0]$NWB#vicidial_campaigns-campaign_id$NWE
Campaign Name: $NWB#vicidial_campaigns-campaign_name$NWE
Campaign Description: $row[57]$NWB#vicidial_campaigns-campaign_description$NWE
Campaign Change Date: $campaign_changedate   $NWB#vicidial_campaigns-campaign_changedate$NWE
Campaign Login Date: $campaign_logindate   $NWB#vicidial_campaigns-campaign_logindate$NWE
Active: $NWB#vicidial_campaigns-active$NWE
Park Extension: $row[9] - $row[10]$NWB#vicidial_campaigns-park_ext$NWE
Web Form: $row[11]$NWB#vicidial_campaigns-web_form_address$NWE
Allow Closers: $row[12] $NWB#vicidial_campaigns-allow_closers$NWE
Default Transfer Group: $default_xfer_group $NWB#vicidial_campaigns-default_xfer_group$NWE
Allow Inbound and Blended: $campaign_allow_inbound $NWB#vicidial_campaigns-campaign_allow_inbound$NWE
Dial Status $o: \n"; + if ($DEFstatusDISABLED > 0) + { + echo "$Dstatus - $statname_list[$Dstatus]         \n"; + echo "REMOVE
Add A Dial Status:   \n"; + echo "     $NWB#vicidial_campaigns-dial_status$NWE
List Order: $NWB#vicidial_campaigns-lead_order$NWE
List Mix: $NWB#vicidial_campaigns-list_order_mix$NWE
Lead Filter: $NWB#vicidial_campaigns-lead_filter_id$NWE
Hopper Level: $NWB#vicidial_campaigns-hopper_level$NWE
Force Reset of Hopper: $NWB#vicidial_campaigns-force_reset_hopper$NWE
Dial Method: $NWB#vicidial_campaigns-dial_method$NWE
Auto Dial Level: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE
Adapt Intensity Modifier: $NWB#vicidial_campaigns-adaptive_intensity$NWE
Script: $script_id
Get Call Launch: $get_call_launch
\n"; + + echo "
\n"; + echo "
LISTS WITHIN THIS CAMPAIGN:   $NWB#vicidial_campaign_lists$NWE
\n"; + echo "\n"; + echo "\n"; + + $active_lists = 0; + $inactive_lists = 0; + $stmt="SELECT list_id,active,list_name from vicidial_lists where campaign_id='$campaign_id'"; + $rslt=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rslt); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_lists++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + + echo "
LIST IDLIST NAMEACTIVE
$rowx[0]$rowx[2]$rowx[1]

\n"; + echo "
\n"; + + $filterSQL = $filtersql_list[$lead_filter_id]; + $filterSQL = eregi_replace("^and|and$|^or|or$","",$filterSQL); + if (strlen($filterSQL)>4) + {$fSQL = "and $filterSQL";} + else + {$fSQL = '';} + + $camp_lists = eregi_replace(".$","",$camp_lists); + echo "This campaign has $active_lists active lists and $inactive_lists inactive lists

\n"; + + + if ($display_dialable_count == 'Y') + { + ### call function to calculate and print dialable leads + dialable_leads($DB,$link,$local_call_time,$dial_statuses,$camp_lists,$fSQL); + echo " - HIDE

"; + } + else + { + echo "Popup Dialable Leads Count"; + echo " - SHOW

"; + } + + + + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id='$campaign_id' and status IN('READY')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $hopper_leads = "$rowx[0]"; + + echo "This campaign has $hopper_leads leads in the dial hopper

\n"; + echo "Click here to see what leads are in the hopper right now

\n"; + echo "Click here to see all CallBack Holds in this campaign

\n"; + echo "Click here to see a VDAD report for this campaign

\n"; + echo "
\n"; + + echo "
\n"; + + ### list of agent rank or skill-level for this campaign + echo "
\n"; + echo "
AGENT RANKS FOR THIS CAMPAIGN:
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT user,campaign_rank,calls_today from vicidial_campaign_agents where campaign_id='$campaign_id'"; + $rsltx=mysql_query($stmt, $link); + $users_to_print = mysql_num_rows($rsltx); + + $o=0; + while ($users_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + + echo "
USER     RANK     CALLS TODAY
$rowx[0]$rowx[1]$rowx[2]

\n"; + + + echo "LOG ALL AGENTS OUT OF THIS CAMPAIGN

\n"; + + + if ($LOGdelete_campaigns > 0) + { + echo "

DELETE THIS CAMPAIGN\n"; + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=31 or 34 and SUB=29 for list mixes +###################### +if ( ( ($ADD==34) or ($ADD==31) ) and ( (!eregi("$campaign_id",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) ) + {$ADD=30;} # send to not allowed screen if not in vicidial_user_groups allowed_campaigns list + +if ( ($ADD==34) or ($ADD==31) ) +{ + if ($LOGmodify_campaigns==1) + { + if ($SUB==29) + { + ##### get list_id listings for dynamic pulldown + $stmt="SELECT list_id,list_name from vicidial_lists where campaign_id='$campaign_id' order by list_id"; + $rslt=mysql_query($stmt, $link); + $mixlists_to_print = mysql_num_rows($rslt); + $mixlists_list=""; + + $o=0; + while ($mixlists_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $mixlists_list .= "\n"; + $mixlistsname_list["$rowx[0]"] = "$rowx[1]"; + $o++; + } + + + echo "

LIST MIXES FOR THIS CAMPAIGN:   $NWB#vicidial_campaigns-list_order_mix$NWE
\n"; + + echo "

Experimental Feature in development!!! NON-FUNCTIONAL
\n"; + + + $stmt="SELECT * from vicidial_campaigns_list_mix where campaign_id='$campaign_id' order by status, vcl_id"; + $rslt=mysql_query($stmt, $link); + $listmixes = mysql_num_rows($rslt); + $o=0; + while ($listmixes > $o) + { + $rowx=mysql_fetch_row($rslt); + $vcl_id=$rowx[0]; + $o++; + + if ($o < 2) + {$tablecolor='bgcolor="#99FF99"'; $bgcolor='bgcolor="#CCFFCC"';} + else + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$tablecolor='bgcolor="#B9CBFD"'; $bgcolor='bgcolor="#9BB9FB"';} + else + {$tablecolor='bgcolor="#9BB9FB"'; $bgcolor='bgcolor="#B9CBFD"';} + } + echo "
\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + } + else + {echo "$rowx[5]\n";} + echo "\n"; + echo "\n"; + +# list_id|order|percent|statuses|:list_id|order|percent|statuses|:... +# 101|1|40| A B NA -|:102|2|25| NEW -|:103|3|30| DROP CALLBK -|:101|4|5| DROP -| +# INSERT INTO vicidial_campaigns_list_mix values('TESTMIX','TESTCAMP List Mix','TESTCAMP','101|1|40| A B NA -|:102|2|25| NEW -|:103|3|30| DROP CALLBK -|:101|4|5| DROP -|','IN_ORDER','ACTIVE'); +# INSERT INTO vicidial_campaigns_list_mix values('TESTMIX2','TESTCAMP List Mix2','TESTCAMP','101|1|20| A B -|:102|2|45| NEW -|:103|3|30| DROP CALLBK -|:101|4|5| DROP -|','IN_ORDER','ACTIVE'); +# INSERT INTO vicidial_campaigns_list_mix values('TESTMIX3','TESTCAMP List Mix3','TESTCAMP','101|1|30| A NA -|:102|2|35| NEW -|:103|3|30| DROP CALLBK -|:101|4|5| DROP -|','IN_ORDER','ACTIVE'); + + $MIXentries = $MT; + $MIXentries = explode(":", $rowx[3]); + $Ms_to_print = (count($MIXentries) - 0); + $q=0; + while ($Ms_to_print > $q) + { + $MIXdetails = explode('|', $MIXentries[$q]); + $MIXdetailsLIST = $MIXdetails[0]; + + $dial_statuses = preg_replace("/ -$/","",$dial_statuses); + $Dstatuses = explode(" ", $dial_statuses); + $Ds_to_print = (count($Dstatuses) - 0); + $Dsql = ''; + $r=0; + while ($Ds_to_print > $r) + { + $r++; + $Dsql .= "'$Dstatuses[$r]',"; + } + $Dsql = preg_replace("/,$/","",$Dsql); + + echo "\n"; + + echo "\n"; + + echo "\n"; + + + echo "\n"; + echo "\n"; + + + echo "\n"; + + + $q++; + + } + + + + + echo "\n"; + + echo "\n"; + + + echo "\n"; + + if ($q > 9) {$AE_disabled = 'DISABLED';} + else {$AE_disabled = '';} + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "$vcl_id:\n"; + echo "\n"; + echo "     DELETE LIST MIX
Status: \n"; + if ($rowx[5]=='INACTIVE') + { + echo "$rowx[5]\n"; + echo "SET TO ACTIVEMethod:\n"; + echo "
LIST IDPRIORITY% MIXSTATUSES
\n"; + echo "\n"; + echo "List: $MIXdetailsLIST   REMOVE\n"; + + + + echo " \n"; + echo "ADD   \n"; + echo "REMOVE\n"; + echo "
\n"; + echo "Difference %: \n"; + echo "   \n"; + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "List:
\n"; + echo "
\n"; + } + + + echo "

ADD NEW LIST MIX
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Mix ID: Mix Name: Mix Method: "; + echo "
List: Dial Status:  
\n"; + + echo "
\n"; + + } + } +} + + +###################### +# ADD=30 campaign not allowed +###################### + +if ($ADD==30) +{ +echo "
\n"; + echo ""; +echo "You do not have permission to view campaign $campaign_id\n"; +} + + +###################### +# ADD=32 display all campaign statuses +###################### +if ($ADD==32) +{ +echo "
\n"; + echo ""; + +echo "
CUSTOM CAMPAIGN STATUSES LISTINGS:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNNAMESTATUSESMODIFY
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT status from vicidial_campaign_statuses where campaign_id='$campaigns_id_list[$o]' order by status"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if ($p<1) + {echo "NONE";} + echo "MODIFY STATUSES
\n"; +} + + +###################### +# ADD=33 display all campaign hotkeys +###################### +if ($ADD==33) +{ +echo "
\n"; + echo ""; + +echo "
CAMPAIGN HOTKEYS LISTINGS:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNNAMEHOTKEYSMODIFY
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT status from vicidial_campaign_hotkeys where campaign_id='$campaigns_id_list[$o]' order by status"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if ($p<1) + {echo "NONE";} + echo "MODIFY HOTKEYS
\n"; +} + + +###################### +# ADD=35 display all campaign lead recycle entries +###################### +if ($ADD==35) +{ +echo "
\n"; + echo ""; + +echo "
CAMPAIGN LEAD RECYCLE LISTINGS:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNNAMELEAD RECYCLESMODIFY
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT status from vicidial_lead_recycle where campaign_id='$campaigns_id_list[$o]' order by status"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if ($p<1) + {echo "NONE";} + echo "MODIFY LEAD RECYCLES
\n"; +} + + +###################### +# ADD=36 display all campaign auto-alt dial entries +###################### +if ($ADD==36) +{ +echo "
\n"; + echo ""; + +echo "
CAMPAIGN LEAD AUTO-ALT DIAL LISTINGS:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNNAMEAUTO-ALT DIALMODIFY
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$campaigns_id_list[$o]';"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if (strlen($row[0])<3) + {echo "NONE";} + echo "MODIFY AUTO-ALT DIAL
\n"; +} + + +###################### +# ADD=37 display all campaign agent pause codes +###################### +if ($ADD==37) +{ +echo "
\n"; + echo ""; + +echo "
CAMPAIGN AGENT PAUSE CODE LISTINGS:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNNAMEPAUSE CODESMODIFY
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT pause_code from vicidial_pause_codes where campaign_id='$campaigns_id_list[$o]' order by pause_code;"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if ($p<1) + {echo "NONE";} + echo "MODIFY PAUSE CODES
\n"; +} + + +###################### +# ADD=39 display all campaign list mixes +###################### +if ($ADD==39) +{ +echo "
\n"; + echo ""; + +echo "
CAMPAIGN LIST MIX LISTINGS:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNNAMELIST MIXMODIFY
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT vcl_id from vicidial_campaigns_list_mix where campaign_id='$campaigns_id_list[$o]' order by status,vcl_id;"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if ($p<1) + {echo "NONE";} + echo "MODIFY LIST MIX
\n"; +} + + + + + +###################### +# ADD=311 modify list info in the system +###################### + +if ($ADD==311) +{ + if ($LOGmodify_lists==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $campaign_id = $row[2]; + $active = $row[3]; + $list_description = $row[4]; + $list_changedate = $row[5]; + $list_lastcalldate = $row[6]; + + # grab names of global statuses and statuses in the selected campaign + $stmt="SELECT * from vicidial_statuses order by status"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + + $o=0; + while ($statuses_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $statuses_list["$rowx[0]"] = "$rowx[1]"; + $o++; + } + + $stmt="SELECT * from vicidial_campaign_statuses where campaign_id='$campaign_id' order by status"; + $rslt=mysql_query($stmt, $link); + $Cstatuses_to_print = mysql_num_rows($rslt); + + $o=0; + while ($Cstatuses_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $statuses_list["$rowx[0]"] = "$rowx[1]"; + $o++; + } + # end grab status names + + + echo "
MODIFY A LISTS RECORD: $row[0]
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
List ID: $row[0]$NWB#vicidial_lists-list_id$NWE
List Name: $NWB#vicidial_lists-list_name$NWE
List Description: $NWB#vicidial_lists-list_description$NWE
Campaign: $NWB#vicidial_lists-campaign_id$NWE
Active: $NWB#vicidial_lists-active$NWE
Reset Lead-Called-Status for this list: $NWB#vicidial_lists-reset_list$NWE
List Change Date: $list_changedate   $NWB#vicidial_lists-list_changedate$NWE
List Last Call Date: $list_lastcalldate   $NWB#vicidial_lists-list_lastcalldate$NWE
\n"; + + echo "
\n"; + echo "
STATUSES WITHIN THIS LIST:
\n"; + echo "\n"; + echo "\n"; + + $leads_in_list = 0; + $leads_in_list_N = 0; + $leads_in_list_Y = 0; + $stmt="SELECT status,called_since_last_reset,count(*) from vicidial_list where list_id='$list_id' group by status,called_since_last_reset order by status,called_since_last_reset"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + + $o=0; + $lead_list['count'] = 0; + $lead_list['Y_count'] = 0; + $lead_list['N_count'] = 0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + + $lead_list['count'] = ($lead_list['count'] + $rowx[2]); + if ($rowx[1] == 'N') + { + $since_reset = 'N'; + $since_resetX = 'Y'; + } + else + { + $since_reset = 'Y'; + $since_resetX = 'N'; + } + $lead_list[$since_reset][$rowx[0]] = ($lead_list[$since_reset][$rowx[0]] + $rowx[2]); + $lead_list[$since_reset.'_count'] = ($lead_list[$since_reset.'_count'] + $rowx[2]); + #If opposite side is not set, it may not in the future so give it a value of zero + if (!isset($lead_list[$since_resetX][$rowx[0]])) + { + $lead_list[$since_resetX][$rowx[0]]=0; + } + $o++; + } + + $o=0; + if ($lead_list['count'] > 0) + { + while (list($dispo,) = each($lead_list[$since_reset])) + { + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + if ($dispo == 'CBHOLD') + { + $CLB=""; + $CLE=""; + } + else + { + $CLB=''; + $CLE=''; + } + + echo "\n"; + $o++; + } + } + + echo "\n"; + echo "\n"; + + echo "
STATUSSTATUS NAMECALLEDNOT CALLED
$CLB$dispo$CLE$statuses_list[$dispo]".$lead_list['Y'][$dispo]."".$lead_list['N'][$dispo]."
SUBTOTALS$lead_list[Y_count]$lead_list[N_count]
TOTAL$lead_list[count]

\n"; + unset($lead_list); + + + echo "
\n"; + echo "
TIME ZONES WITHIN THIS LIST:
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT gmt_offset_now,called_since_last_reset,count(*) from vicidial_list where list_id='$list_id' group by gmt_offset_now,called_since_last_reset order by gmt_offset_now,called_since_last_reset"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + + $o=0; + $plus='+'; + $lead_list['count'] = 0; + $lead_list['Y_count'] = 0; + $lead_list['N_count'] = 0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + + $lead_list['count'] = ($lead_list['count'] + $rowx[2]); + if ($rowx[1] == 'N') + { + $since_reset = 'N'; + $since_resetX = 'Y'; + } + else + { + $since_reset = 'Y'; + $since_resetX = 'N'; + } + $lead_list[$since_reset][$rowx[0]] = ($lead_list[$since_reset][$rowx[0]] + $rowx[2]); + $lead_list[$since_reset.'_count'] = ($lead_list[$since_reset.'_count'] + $rowx[2]); + #If opposite side is not set, it may not in the future so give it a value of zero + if (!isset($lead_list[$since_resetX][$rowx[0]])) + { + $lead_list[$since_resetX][$rowx[0]]=0; + } + $o++; + } + + if ($lead_list['count'] > 0) + { + while (list($tzone,) = each($lead_list[$since_reset])) + { + $LOCALzone=3600 * $tzone; + $LOCALdate=gmdate("D M Y H:i", time() + $LOCALzone); + + if ($tzone >= 0) {$DISPtzone = "$plus$tzone";} + else {$DISPtzone = "$tzone";} + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + } + + echo "\n"; + echo "\n"; + + echo "
GMT OFFSET NOW (local time)CALLEDNOT CALLED
".$DISPtzone."     ($LOCALdate)".$lead_list['Y'][$tzone]."".$lead_list['N'][$tzone]."
SUBTOTALS$lead_list[Y_count]$lead_list[N_count]
TOTAL$lead_list[count]

\n"; + unset($lead_list); + + + + $leads_in_list = 0; + $leads_in_list_N = 0; + $leads_in_list_Y = 0; + $stmt="SELECT status,called_count,count(*) from vicidial_list where list_id='$list_id' group by status,called_count order by status,called_count"; + $rslt=mysql_query($stmt, $link); + $status_called_to_print = mysql_num_rows($rslt); + + $o=0; + $sts=0; + $first_row=1; + $all_called_first=1000; + $all_called_last=0; + while ($status_called_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $leads_in_list = ($leads_in_list + $rowx[2]); + $count_statuses[$o] = "$rowx[0]"; + $count_called[$o] = "$rowx[1]"; + $count_count[$o] = "$rowx[2]"; + $all_called_count[$rowx[1]] = ($all_called_count[$rowx[1]] + $rowx[2]); + + if ( (strlen($status[$sts]) < 1) or ($status[$sts] != "$rowx[0]") ) + { + if ($first_row) {$first_row=0;} + else {$sts++;} + $status[$sts] = "$rowx[0]"; + $status_called_first[$sts] = "$rowx[1]"; + if ($status_called_first[$sts] < $all_called_first) {$all_called_first = $status_called_first[$sts];} + } + $leads_in_sts[$sts] = ($leads_in_sts[$sts] + $rowx[2]); + $status_called_last[$sts] = "$rowx[1]"; + if ($status_called_last[$sts] > $all_called_last) {$all_called_last = $status_called_last[$sts];} + + $o++; + } + + + + + echo "
\n"; + echo "
CALLED COUNTS WITHIN THIS LIST:
\n"; + echo "\n"; + echo ""; + $first = $all_called_first; + while ($first <= $all_called_last) + { + if (eregi("1$|3$|5$|7$|9$", $first)) {$AB='bgcolor="#AFEEEE"';} + else{$AB='bgcolor="#E0FFFF"';} + echo ""; + $first++; + } + echo "\n"; + + $sts=0; + $statuses_called_to_print = count($status); + while ($statuses_called_to_print > $sts) + { + $Pstatus = $status[$sts]; + if (eregi("1$|3$|5$|7$|9$", $sts)) + {$bgcolor='bgcolor="#B9CBFD"'; $AB='bgcolor="#9BB9FB"';} + else + {$bgcolor='bgcolor="#9BB9FB"'; $AB='bgcolor="#B9CBFD"';} + # echo "$status[$sts]|$status_called_first[$sts]|$status_called_last[$sts]|$leads_in_sts[$sts]|\n"; + # echo "$status[$sts]|"; + echo ""; + + $first = $all_called_first; + while ($first <= $all_called_last) + { + if (eregi("1$|3$|5$|7$|9$", $sts)) + { + if (eregi("1$|3$|5$|7$|9$", $first)) {$AB='bgcolor="#9BB9FB"';} + else{$AB='bgcolor="#B9CBFD"';} + } + else + { + if (eregi("0$|2$|4$|6$|8$", $first)) {$AB='bgcolor="#9BB9FB"';} + else{$AB='bgcolor="#B9CBFD"';} + } + + $called_printed=0; + $o=0; + while ($status_called_to_print > $o) + { + if ( ($count_statuses[$o] == "$Pstatus") and ($count_called[$o] == "$first") ) + { + $called_printed++; + echo ""; + } + + + $o++; + } + if (!$called_printed) + {echo "";} + $first++; + } + echo "\n\n"; + + $sts++; + } + + echo ""; + $first = $all_called_first; + while ($first <= $all_called_last) + { + if (eregi("1$|3$|5$|7$|9$", $first)) {$AB='bgcolor="#AFEEEE"';} + else{$AB='bgcolor="#E0FFFF"';} + echo ""; + $first++; + } + echo "\n"; + + echo "
STATUSSTATUS NAME$firstSUBTOTAL
$Pstatus$statuses_list[$Pstatus] $count_count[$o]  $leads_in_sts[$sts]
TOTAL$all_called_count[$first]$leads_in_list

\n"; + + + + + + echo "
\n"; + + echo "

Click here to see all CallBack Holds in this list

\n"; + + if ($LOGdelete_lists > 0) + { + echo "

DELETE THIS LIST\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + + +###################### +# ADD=3111 modify in-group info in the system +###################### + +if ($ADD==3111) +{ + if ($LOGmodify_ingroups==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_inbound_groups where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $group_name = $row[1]; + $group_color = $row[2]; + $active = $row[3]; + $web_form_address = $row[4]; + $voicemail_ext = $row[5]; + $next_agent_call = $row[6]; + $fronter_display = $row[7]; + $script_id = $row[8]; + $get_call_launch = $row[9]; + $xferconf_a_dtmf = $row[10]; + $xferconf_a_number = $row[11]; + $xferconf_b_dtmf = $row[12]; + $xferconf_b_number = $row[13]; + $drop_call_seconds = $row[14]; + $drop_message = $row[15]; + $drop_exten = $row[16]; + $call_time_id = $row[17]; + $after_hours_action = $row[18]; + $after_hours_message_filename = $row[19]; + $after_hours_exten = $row[20]; + $after_hours_voicemail = $row[21]; + $welcome_message_filename = $row[22]; + $moh_context = $row[23]; + $onhold_prompt_filename = $row[24]; + $prompt_interval = $row[25]; + $agent_alert_exten = $row[26]; + $agent_alert_delay = $row[27]; + $default_xfer_group = $row[28]; + + ##### get in-groups listings for dynamic pulldown + $stmt="SELECT group_id,group_name from vicidial_inbound_groups order by group_id"; + $rslt=mysql_query($stmt, $link); + $Xgroups_to_print = mysql_num_rows($rslt); + $Xgroups_menu=''; + $Xgroups_selected=0; + $o=0; + while ($Xgroups_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $Xgroups_menu .= "\n"; + $o++; + } + if ($Xgroups_selected < 1) + {$Xgroups_menu .= "\n";} + else + {$Xgroups_menu .= "\n";} + + + echo "
MODIFY A GROUPS RECORD: $row[0]\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + echo "
Group ID: $row[0]$NWB#vicidial_inbound_groups-group_id$NWE
Group Name: $NWB#vicidial_inbound_groups-group_name$NWE
Group Color: $NWB#vicidial_inbound_groups-group_color$NWE
Active: $NWB#vicidial_inbound_groups-active$NWE
Web Form: $NWB#vicidial_inbound_groups-web_form_address$NWE
Next Agent Call: $NWB#vicidial_inbound_groups-next_agent_call$NWE
Fronter Display: $NWB#vicidial_inbound_groups-fronter_display$NWE
Script: $NWB#vicidial_inbound_groups-ingroup_script$NWE
Get Call Launch: $NWB#vicidial_inbound_groups-get_call_launch$NWE
Transfer-Conf DTMF 1: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
Transfer-Conf Number 1: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
Transfer-Conf DTMF 2: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
Transfer-Conf Number 2: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
Drop Call Seconds: $NWB#vicidial_inbound_groups-drop_call_seconds$NWE
Voicemail: $NWB#vicidial_inbound_groups-voicemail_ext$NWE
Use Drop Message: $NWB#vicidial_inbound_groups-drop_message$NWE
Drop Exten: $NWB#vicidial_inbound_groups-drop_exten$NWE
Call Time: $NWB#vicidial_inbound_groups-call_time_id$NWE
After Hours Action: $NWB#vicidial_inbound_groups-after_hours_action$NWE
After Hours Message Filename: $NWB#vicidial_inbound_groups-after_hours_message_filename$NWE
After Hours Extension: $NWB#vicidial_inbound_groups-after_hours_exten$NWE
After Hours Voicemail: $NWB#vicidial_inbound_groups-after_hours_voicemail$NWE
Welcome Message Filename: $NWB#vicidial_inbound_groups-welcome_message_filename$NWE
Music On Hold Context: $NWB#vicidial_inbound_groups-moh_context$NWE
On Hold Prompt Filename: $NWB#vicidial_inbound_groups-onhold_prompt_filename$NWE
On Hold Prompt Interval: $NWB#vicidial_inbound_groups-prompt_interval$NWE
Agent Alert Extension: $NWB#vicidial_inbound_groups-agent_alert_exten$NWE
Agent Alert Delay: $NWB#vicidial_inbound_groups-agent_alert_delay$NWE
Default Transfer Group: $NWB#vicidial_inbound_groups-default_xfer_group$NWE
\n"; + + ### list of agent rank or skill-level for this inbound group + echo "
\n"; + echo "
AGENT RANKS FOR THIS INBOUND GROUP:
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT user,group_rank,calls_today from vicidial_inbound_group_agents where group_id='$group_id'"; + $rsltx=mysql_query($stmt, $link); + $users_to_print = mysql_num_rows($rsltx); + + $o=0; + while ($users_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + + echo "
USER     RANK     CALLS TODAY
$rowx[0]$rowx[1]$rowx[2]

\n"; + + echo "

\n"; + + echo "Click here to see a report for this inbound group

\n"; + + echo "
\n"; + + if ($LOGdelete_ingroups > 0) + { + echo "

EMERGENCY VDAC CLEAR FOR THIS IN-GROUP

\n"; + echo "

DELETE THIS IN-GROUP\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + + +###################### +# ADD=31111 modify remote agents info in the system +###################### + +if ($ADD==31111) +{ + if ($LOGmodify_remoteagents==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + + echo "
MODIFY A REMOTE AGENTS ENTRY: $row[0]\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
User ID Start: (numbers only, incremented)$NWB#vicidial_remote_agents-user_start$NWE
Number of Lines: (numbers only)$NWB#vicidial_remote_agents-number_of_lines$NWE
Server IP: $NWB#vicidial_remote_agents-server_ip$NWE
External Extension: (dial plan number dialed to reach agents)$NWB#vicidial_remote_agents-conf_exten$NWE
Status: $NWB#vicidial_remote_agents-status$NWE
Campaign: $NWB#vicidial_remote_agents-campaign_id$NWE
Inbound Groups: \n"; + echo "$groups_list"; + echo "$NWB#vicidial_remote_agents-closer_campaigns$NWE
\n"; + echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n"; + + + if ($LOGdelete_remote_agents > 0) + { + echo "

DELETE THIS REMOTE AGENT\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=311111 modify user group info in the system +###################### + +if ($ADD==311111) +{ + if ($LOGmodify_usergroups==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_user_groups where user_group='$user_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $user_group = $row[0]; + $group_name = $row[1]; + echo ""; + + echo "
MODIFY A USERS GROUP ENTRY\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Group: (no spaces or punctuation)$NWB#vicidial_user_groups-user_group$NWE
Description: (description of group)$NWB#vicidial_user_groups-group_name$NWE
Allowed Campaigns: \n"; + echo "$campaigns_list"; + echo "$NWB#vicidial_user_groups-allowed_campaigns$NWE
\n"; + + + ### list of users in this user group + + $active_confs = 0; + $stmt="SELECT user,full_name,user_level from vicidial_users where user_group='$user_group'"; + $rsltx=mysql_query($stmt, $link); + $users_to_print = mysql_num_rows($rsltx); + + echo "
\n"; + echo "
USERS WITHIN THIS USER GROUP: $users_to_print
\n"; + echo "\n"; + echo "\n"; + + $o=0; + while ($users_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
USERFULL NAMELEVEL
$rowx[0]$rowx[1]$rowx[2]

\n"; + + + + echo "

Click here to see all CallBack Holds in this user group

\n"; + + if ($LOGdelete_user_groups > 0) + { + echo "

DELETE THIS USER GROUP\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=3111111 modify script info in the system +###################### + +if ($ADD==3111111) +{ + if ($LOGmodify_scripts==1) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_scripts where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $script_name = $row[1]; + $script_comments = $row[2]; + $script_text = $row[3]; + $active = $row[4]; + echo ""; + + echo "
MODIFY A SCRIPT\n"; + echo "\n"; + echo "\n"; + echo "
Script ID: $script_id$NWB#vicidial_scripts-script_name$NWE
Script Name: (title of the script)$NWB#vicidial_scripts-script_name$NWE
Script Comments: $NWB#vicidial_scripts-script_comments$NWE
Active: $NWB#vicidial_scripts-active$NWE
Script Text:

Preview Script
"; + # BEGIN Insert Field + echo ""; + echo "
"; + # END Insert Field + echo " $NWB#vicidial_scripts-script_text$NWE
\n"; + + if ($LOGdelete_scripts > 0) + { + echo "

DELETE THIS SCRIPT\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=31111111 modify filter info in the system +###################### + +if ($ADD==31111111) +{ + if ($LOGmodify_filters==1) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_lead_filters where lead_filter_id='$lead_filter_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $lead_filter_name = $row[1]; + $lead_filter_comments = $row[2]; + $lead_filter_sql = $row[3]; + echo ""; + + echo "
MODIFY A FILTER\n"; + echo "\n"; + echo "\n"; + echo "
Filter ID: $lead_filter_id$NWB#vicidial_lead_filters-lead_filter_id$NWE
Filter Name: (short description of the filter)$NWB#vicidial_lead_filters-lead_filter_name$NWE
Filter Comments: $NWB#vicidial_lead_filters-lead_filter_comments$NWE
Filter SQL: $NWB#vicidial_lead_filters-lead_filter_sql$NWE
\n"; + + ##### get campaigns listing for dynamic pulldown + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + $campaigns_list=''; + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $campaigns_list .= "\n"; + $o++; + } + + echo "

"; + echo "
TEST ON CAMPAIGN:
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + if ($LOGdelete_filters > 0) + { + echo "

DELETE THIS FILTER\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=321111111 modify call time definition info in the system +###################### + +if ($ADD==321111111) +{ +if ($LOGmodify_call_times==1) +{ + +if ( ($stage=="ADD") and (strlen($state_rule)>0) ) + { + $stmt="SELECT ct_state_call_times from vicidial_call_times where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $ct_state_call_times = $row[0]; + + if (eregi("\|$",$ct_state_call_times)) + {$ct_state_call_times = "$ct_state_call_times$state_rule\|";} + else + {$ct_state_call_times = "$ct_state_call_times\|$state_rule\|";} + $stmt="UPDATE vicidial_call_times set ct_state_call_times='$ct_state_call_times' where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + echo "State Rule Added: $state_rule
\n"; + } +if ( ($stage=="REMOVE") and (strlen($state_rule)>0) ) + { + $stmt="SELECT ct_state_call_times from vicidial_call_times where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $ct_state_call_times = $row[0]; + + $ct_state_call_times = eregi_replace("\|$state_rule\|",'|',$ct_state_call_times); + $stmt="UPDATE vicidial_call_times set ct_state_call_times='$ct_state_call_times' where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + echo "State Rule Removed: $state_rule
\n"; + } + +$ADD=311111111; +} +else +{ +echo "You are not authorized to view this page. Please go back."; +} + +} + + +###################### +# ADD=311111111 modify call time definition info in the system +###################### + +if ($ADD==311111111) +{ + +if ($LOGmodify_call_times==1) +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +$ct_srs=1; +$b=0; +$srs_SQL =''; +if (strlen($ct_state_call_times)>2) + { + $state_rules = explode('|',$ct_state_call_times); + $ct_srs = ((count($state_rules)) - 1); + } +echo "\n"; +echo "\n"; +while($ct_srs >= $b) + { + if (strlen($state_rules[$b])>0) + { + $stmt="SELECT state_call_time_state,state_call_time_name from vicidial_state_call_times where state_call_time_id='$state_rules[$b]';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + echo "\n"; + $srs_SQL .= "'$state_rules[$b]',"; + $srs_state_SQL .= "'$row[0]',"; + } + $b++; + } +if (strlen($srs_SQL)>2) + { + $srs_SQL = "$srs_SQL''"; + $srs_state_SQL = "$srs_state_SQL''"; + $srs_SQL = "where state_call_time_id NOT IN($srs_SQL) and state_call_time_state NOT IN($srs_state_SQL)"; + } +else + {$srs_SQL='';} +$stmt="SELECT state_call_time_id,state_call_time_name from vicidial_state_call_times $srs_SQL order by state_call_time_id;"; +$rslt=mysql_query($stmt, $link); +$sct_to_print = mysql_num_rows($rslt); +$sct_list=''; + +$o=0; +while ($sct_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $sct_list .= "\n"; + $o++; +} +echo "\n"; +echo "\n"; + +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_call_times where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $call_time_name = $row[1]; + $call_time_comments = $row[2]; + $ct_default_start = $row[3]; + $ct_default_stop = $row[4]; + $ct_sunday_start = $row[5]; + $ct_sunday_stop = $row[6]; + $ct_monday_start = $row[7]; + $ct_monday_stop = $row[8]; + $ct_tuesday_start = $row[9]; + $ct_tuesday_stop = $row[10]; + $ct_wednesday_start = $row[11]; + $ct_wednesday_stop = $row[12]; + $ct_thursday_start = $row[13]; + $ct_thursday_stop = $row[14]; + $ct_friday_start = $row[15]; + $ct_friday_stop = $row[16]; + $ct_saturday_start = $row[17]; + $ct_saturday_stop = $row[18]; + $ct_state_call_times = $row[19]; + +echo ""; + +echo "
MODIFY A CALL TIME\n"; +echo "\n"; +echo "\n"; +echo "
Call Time ID: $call_time_id$NWB#vicidial_call_times-call_time_id$NWE
Call Time Name: (short description of the call time)$NWB#vicidial_call_times-call_time_name$NWE
Call Time Comments: $NWB#vicidial_call_times-call_time_comments$NWE
Default Start: Default Stop: $NWB#vicidial_call_times-ct_default_start$NWE
Sunday Start: Sunday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Monday Start: Monday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Tuesday Start: Tuesday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Wednesday Start: Wednesday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Thursday Start: Thursday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Friday Start: Friday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Saturday Start: Saturday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Active State Call Time Definitions for this Record:  
$state_rules[$b] - REMOVE $row[0] - $row[1]
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "Add state call time rule:


\n"; +echo "CAMPAIGNS USING THIS CALL TIME:
\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns where local_call_time='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + $o=0; + while ($camps_to_print > $o) { + $row=mysql_fetch_row($rslt); + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]
\n"; +echo "INBOUND GROUPS USING THIS CALL TIME:
\n"; +echo "\n"; + + $stmt="SELECT group_id,group_name from vicidial_inbound_groups where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + $o=0; + while ($camps_to_print > $o) { + $row=mysql_fetch_row($rslt); + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]
\n"; +echo "

\n"; + +if ($LOGdelete_call_times > 0) + { + echo "

DELETE THIS CALL TIME DEFINITION\n"; + } +} +else +{ +echo "You are not authorized to view this page. Please go back."; +} + +} + + +###################### +# ADD=3111111111 modify state call time definition info in the system +###################### + +if ($ADD==3111111111) +{ + +if ($LOGmodify_call_times==1) +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_state_call_times where state_call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $state_call_time_state =$row[1]; + $call_time_name = $row[2]; + $call_time_comments = $row[3]; + $ct_default_start = $row[4]; + $ct_default_stop = $row[5]; + $ct_sunday_start = $row[6]; + $ct_sunday_stop = $row[7]; + $ct_monday_start = $row[8]; + $ct_monday_stop = $row[9]; + $ct_tuesday_start = $row[10]; + $ct_tuesday_stop = $row[11]; + $ct_wednesday_start = $row[12]; + $ct_wednesday_stop = $row[13]; + $ct_thursday_start = $row[14]; + $ct_thursday_stop = $row[15]; + $ct_friday_start = $row[16]; + $ct_friday_stop = $row[17]; + $ct_saturday_start = $row[18]; + $ct_saturday_stop = $row[19]; + +echo ""; + +echo "
MODIFY A STATE CALL TIME
\n"; +echo "\n"; +echo "\n"; +echo "
Call Time ID: $call_time_id$NWB#vicidial_call_times-call_time_id$NWE
State Call Time State: $NWB#vicidial_call_times-state_call_time_state$NWE
State Call Time Name: (short description of the call time)$NWB#vicidial_call_times-call_time_name$NWE
State Call Time Comments: $NWB#vicidial_call_times-call_time_comments$NWE
Default Start: Default Stop: $NWB#vicidial_call_times-ct_default_start$NWE
Sunday Start: Sunday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Monday Start: Monday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Tuesday Start: Tuesday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Wednesday Start: Wednesday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Thursday Start: Thursday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Friday Start: Friday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Saturday Start: Saturday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE


\n"; +echo "CALL TIMES USING THIS STATE CALL TIME:
\n"; +echo "\n"; + + $stmt="SELECT call_time_id,call_time_name from vicidial_call_times where ct_state_call_times LIKE \"%|$call_time_id|%\";"; + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + $o=0; + while ($camps_to_print > $o) { + $row=mysql_fetch_row($rslt); + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]
\n"; +echo "

\n"; + +if ($LOGdelete_call_times > 0) + { + echo "

DELETE THIS STATE CALL TIME DEFINITION\n"; + } + +} +else +{ +echo "You are not authorized to view this page. Please go back."; +} + +} + + +###################### +# ADD=31111111111 modify phone record in the system +###################### + +if ($ADD==31111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + echo "
MODIFY A PHONE RECORD: $row[1]\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Phone extension: $NWB#phones-extension$NWE
Dial Plan Number: (digits only)$NWB#phones-dialplan_number$NWE
Voicemail Box: (digits only)$NWB#phones-voicemail_id$NWE
Outbound CallerID: (digits only)$NWB#phones-outbound_cid$NWE
Phone IP address: (optional)$NWB#phones-phone_ip$NWE
Computer IP address: (optional)$NWB#phones-computer_ip$NWE
Server IP: $NWB#phones-server_ip$NWE
Login: $NWB#phones-login$NWE
Password: $NWB#phones-pass$NWE
Status: $NWB#phones-status$NWE
Active Account: $NWB#phones-active$NWE
Phone Type: $NWB#phones-phone_type$NWE
Full Name: $NWB#phones-fullname$NWE
Company: $NWB#phones-company$NWE
Picture: $NWB#phones-picture$NWE
New Messages: $row[14]$NWB#phones-messages$NWE
Old Messages: $row[15]$NWB#phones-old_messages$NWE
Client Protocol: $NWB#phones-protocol$NWE
Local GMT: (Do NOT Adjust for DST)$NWB#phones-local_gmt$NWE
Manager Login: $NWB#phones-ASTmgrUSERNAME$NWE
Manager Secret: $NWB#phones-ASTmgrSECRET$NWE
VICIDIAL Default User: $NWB#phones-login_user$NWE
VICIDIAL Default Pass: $NWB#phones-login_pass$NWE
VICIDIAL Default Campaign: $NWB#phones-login_campaign$NWE
Park Exten: $NWB#phones-park_on_extension$NWE
Conf Exten: $NWB#phones-conf_on_extension$NWE
VICIDIAL Park Exten: $NWB#phones-VICIDIAL_park_on_extension$NWE
VICIDIAL Park File: $NWB#phones-VICIDIAL_park_on_filename$NWE
Monitor Prefix: $NWB#phones-monitor_prefix$NWE
Recording Exten: $NWB#phones-recording_exten$NWE
VMailMain Exten: $NWB#phones-voicemail_exten$NWE
VMailDump Exten: $NWB#phones-voicemail_dump_exten$NWE
Exten Context: $NWB#phones-ext_context$NWE
DTMFSend Channel: $NWB#phones-dtmf_send_extension$NWE
Outbound Call Group: $NWB#phones-call_out_number_group$NWE
Browser Location: $NWB#phones-client_browser$NWE
Install Directory: $NWB#phones-install_directory$NWE
CallerID URL: $NWB#phones-local_web_callerID_URL$NWE
VICIDIAL Default URL: $NWB#phones-VICIDIAL_web_URL$NWE
Call Logging: $NWB#phones-AGI_call_logging_enabled$NWE
User Switching: $NWB#phones-user_switching_enabled$NWE
Conferencing: $NWB#phones-conferencing_enabled$NWE
Admin Hang Up: $NWB#phones-admin_hangup_enabled$NWE
Admin Hijack: $NWB#phones-admin_hijack_enabled$NWE
Admin Monitor: $NWB#phones-admin_monitor_enabled$NWE
Call Park: $NWB#phones-call_parking_enabled$NWE
Updater Check: $NWB#phones-updater_check_enabled$NWE
AF Logging: $NWB#phones-AFLogging_enabled$NWE
Queue Enabled: $NWB#phones-QUEUE_ACTION_enabled$NWE
CallerID Popup: $NWB#phones-CallerID_popup_enabled$NWE
VMail Button: $NWB#phones-voicemail_button_enabled$NWE
Fast Refresh: $NWB#phones-enable_fast_refresh$NWE
Fast Refresh Rate: (in ms)$NWB#phones-fast_refresh_rate$NWE
Persistant MySQL: $NWB#phones-enable_persistant_mysql$NWE
Auto Dial Next Number: $NWB#phones-auto_dial_next_number$NWE
Stop Rec after each call: $NWB#phones-VDstop_rec_after_each_call$NWE
Enable SIPSAK Messages: $NWB#phones-enable_sipsak_messages$NWE
DBX Server: (Primary DB Server)$NWB#phones-DBX_server$NWE
DBX Database: (Primary Server Database)$NWB#phones-DBX_database$NWE
DBX User: (Primary DB Login)$NWB#phones-DBX_user$NWE
DBX Pass: (Primary DB Secret)$NWB#phones-DBX_pass$NWE
DBX Port: (Primary DB Port)$NWB#phones-DBX_port$NWE
DBY Server: (Secondary DB Server)$NWB#phones-DBY_server$NWE
DBY Database: (Secondary Server Database)$NWB#phones-DBY_database$NWE
DBY User: (Secondary DB Login)$NWB#phones-DBY_user$NWE
DBY Pass: (Secondary DB Secret)$NWB#phones-DBY_pass$NWE
DBY Port: (Secondary DB Port)$NWB#phones-DBY_port$NWE
\n"; + + echo "

Click here for phone stats\n"; + + if ($LOGast_delete_phones > 0) + { + echo "

DELETE THIS PHONE\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=311111111111 modify server record in the system +###################### + +if ($ADD==311111111111) +{ + if ($LOGmodify_servers==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from servers where server_id='$server_id' or server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $server_id = $row[0]; + $server_ip = $row[2]; + + echo "
MODIFY A SERVER RECORD: $row[0]\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Server ID: $NWB#servers-server_id$NWE
Server Description: $NWB#servers-server_description$NWE
Server IP Address: $NWB#servers-server_ip$NWE
Active: $NWB#servers-active$NWE
Asterisk Version: $NWB#servers-asterisk_version$NWE
Max VICIDIAL Trunks: $NWB#servers-max_vicidial_trunks$NWE
VICIDIAL Balance Dialing: $NWB#servers-vicidial_balance_active$NWE
VICIDIAL Balance Offlimits: $NWB#servers-balance_trunks_offlimits$NWE
Telnet Host: $NWB#servers-telnet_host$NWE
Telnet Port: $NWB#servers-telnet_port$NWE
Manager User: $NWB#servers-ASTmgrUSERNAME$NWE
Manager Secret: $NWB#servers-ASTmgrSECRET$NWE
Manager Update User: $NWB#servers-ASTmgrUSERNAMEupdate$NWE
Manager Listen User: $NWB#servers-ASTmgrUSERNAMElisten$NWE
Manager Send User: $NWB#servers-ASTmgrUSERNAMEsend$NWE
Local GMT: (Do NOT Adjust for DST)$NWB#servers-local_gmt$NWE
VMail Dump Exten: $NWB#servers-voicemail_dump_exten$NWE
VICIDIAL AD extension: $NWB#servers-answer_transfer_agent$NWE
Default Context: $NWB#servers-ext_context$NWE
System Performance: $NWB#servers-sys_perf_log$NWE
Server Logs: $NWB#servers-vd_server_logs$NWE
AGI Output: $NWB#servers-agi_output$NWE
\n"; + + + ### vicidial server trunk records for this server + echo "

VICIDIAL TRUNKS FOR THIS SERVER:   $NWB#vicidial_server_trunks$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_server_trunks where server_ip='$server_ip' order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $recycle_to_print = mysql_num_rows($rslt); + $o=0; + while ($recycle_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
CAMPAIGN TRUNKS RESTRICTION DELETE
$rowx[1]
\n"; + echo "\n"; + echo "\n"; + echo "
DELETE
\n"; + + echo "
ADD NEW SERVER VICIDIAL TRUNK RECORD
\n"; + echo "\n"; + echo "\n"; + echo "TRUNKS:
\n"; + echo "CAMPAIGN:
\n"; + echo "RESTRICTION:
\n"; + echo "
\n"; + + echo "

\n"; + + + ### list of phones on this server + echo "
\n"; + echo "
PHONES WITHIN THIS SERVER:
\n"; + echo "\n"; + echo "\n"; + + $active_phones = 0; + $inactive_phones = 0; + $stmt="SELECT extension,active,fullname from phones where server_ip='$row[2]'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + if (ereg("Y", $rowx[1])) {$active_phones++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_phones++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + + echo "
EXTENSIONNAMEACTIVE
$rowx[0]$rowx[2]$rowx[1]

\n"; + + + ### list of conferences on this server + echo "
\n"; + echo "
CONFERENCES WITHIN THIS SERVER:
\n"; + echo "\n"; + echo "\n"; + + $active_confs = 0; + $stmt="SELECT conf_exten,extension from conferences where server_ip='$row[2]'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + $active_confs++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + + echo "
CONFERENCEEXTENSION
$rowx[0]$rowx[2]

\n"; + + + ### list of vicidial conferences on this server + echo "
\n"; + echo "
VICIDIAL CONFERENCES WITHIN THIS SERVER:
\n"; + echo "\n"; + echo "\n"; + + $active_vdconfs = 0; + $stmt="SELECT conf_exten,extension from vicidial_conferences where server_ip='$row[2]'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + $active_vdconfs++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + + echo "
VD CONFERENCEEXTENSION
$rowx[0]$rowx[2]

\n"; + + + echo "
\n"; + + $camp_lists = eregi_replace(".$","",$camp_lists); + echo "This server has $active_phones active phones and $inactive_phones inactive phones

\n"; + echo "This server has $active_confs active conferences

\n"; + echo "This server has $active_vdconfs active vicidial conferences

\n"; + echo "
\n"; + if ($LOGast_delete_phones > 0) + { + echo "

DELETE THIS SERVER\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=3111111111111 modify conference record in the system +###################### + +if ($ADD==3111111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $conf_exten = $row[0]; + $server_ip = $row[1]; + + echo "
MODIFY A CONFERENCE RECORD: $row[0]
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Conference: $NWB#conferences-conf_exten$NWE
Server IP: $NWB#conferences-server_ip$NWE
Current Extension:
\n"; + + echo "
\n"; + if ($LOGast_delete_phones > 0) + { + echo "

DELETE THIS CONFERENCE\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=31111111111111 modify vicidial conference record in the system +###################### + +if ($ADD==31111111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $conf_exten = $row[0]; + $server_ip = $row[1]; + + echo "
MODIFY A VICIDIAL CONFERENCE RECORD: $row[0]\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Conference: $NWB#conferences-conf_exten$NWE
Server IP: $NWB#conferences-server_ip$NWE
Current Extension:
\n"; + + echo "
\n"; + if ($LOGast_delete_phones > 0) + { + echo "

DELETE THIS VICIDIAL CONFERENCE\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + + +###################### +# ADD=311111111111111 modify vicidial system settings +###################### + +if ($ADD==311111111111111) +{ + if ($LOGmodify_servers==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT version,install_date,use_non_latin,webroot_writable,enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_url,queuemetrics_log_id,queuemetrics_eq_prepend,vicidial_agent_disable,allow_sipsak_messages,admin_home_url,enable_agc_xfer_log from system_settings;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $version = $row[0]; + $install_date = $row[1]; + $use_non_latin = $row[2]; + $webroot_writable = $row[3]; + $enable_queuemetrics_logging = $row[4]; + $queuemetrics_server_ip = $row[5]; + $queuemetrics_dbname = $row[6]; + $queuemetrics_login = $row[7]; + $queuemetrics_pass = $row[8]; + $queuemetrics_url = $row[9]; + $queuemetrics_log_id = $row[10]; + $queuemetrics_eq_prepend = $row[11]; + $vicidial_agent_disable = $row[12]; + $allow_sipsak_messages = $row[13]; + $admin_home_url = $row[14]; + $enable_agc_xfer_log = $row[15]; + + echo "
MODIFY VICIDIAL SYSTEM SETTINGS\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + echo "\n"; + echo "
Version: $version
Install Date: $install_date
Use Non-Latin: $NWB#settings-use_non_latin$NWE
Webroot Writable: $NWB#settings-webroot_writable$NWE
Enable QueueMetrics Logging: $NWB#settings-enable_queuemetrics_logging$NWE
QueueMetrics Server IP: $NWB#settings-queuemetrics_server_ip$NWE
QueueMetrics DB Name: $NWB#settings-queuemetrics_dbname$NWE
QueueMetrics DB Login: $NWB#settings-queuemetrics_login$NWE
QueueMetrics DB Password: $NWB#settings-queuemetrics_pass$NWE
QueueMetrics URL: $NWB#settings-queuemetrics_url$NWE
QueueMetrics Log ID: $NWB#settings-queuemetrics_log_id$NWE
QueueMetrics EnterQueue Prepend: $NWB#settings-queuemetrics_eq_prepend$NWE
VICIDIAL Agent Disable Display: $NWB#settings-vicidial_agent_disable$NWE
Allow SIPSAK Messages: $NWB#settings-allow_sipsak_messages$NWE
Admin Home URL: $NWB#settings-admin_home_url$NWE
Enable Agent Transfer Logfile: $NWB#settings-enable_agc_xfer_log$NWE
\n"; + echo "\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + + + + + +###################### +# ADD=321111111111111 modify vicidial system statuses +###################### + +if ($ADD==321111111111111) +{ + if ($LOGmodify_servers==1) + { + echo "
\n"; + echo ""; + + echo "
\n"; + echo "VICIDIAL STATUSES WITHIN THIS SYSTEM:   $NWB#vicidial_statuses$NWE
\n"; + echo "\n"; + echo "\n"; + + ##### get status category listings for dynamic pulldown + $stmt="SELECT vsc_id,vsc_name from vicidial_status_categories order by vsc_id desc"; + $rslt=mysql_query($stmt, $link); + $cats_to_print = mysql_num_rows($rslt); + $cats_list=""; + + $o=0; + while ($cats_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $cats_list .= "\n"; + $catsname_list["$rowx[0]"] = substr($rowx[1],0,20); + $o++; + } + + + $stmt="SELECT * from vicidial_statuses order by status;"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $AScategory = $rowx[4]; + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
STATUSDESCRIPTIONSELECT-
ABLE
HUMAN
ANSWER
CATEGORYMODIFY/DELETE
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "$rowx[0]
\n"; + echo "\n"; + echo "         \n"; + echo "   \n"; + + if (preg_match("/^B$|^NA$|^DNC$|^NA$|^DROP$|^INCALL$|^QUEUE$|^NEW$/i",$rowx[0])) + { + echo "DELETE\n"; + } + else + { + echo "DELETE\n"; + } + echo "
\n"; + + echo "
ADD NEW SYSTEM STATUS
\n"; + echo "\n"; + echo "Status:   \n"; + echo "Description:
\n"; + echo "Selectable:   \n"; + echo "Human Answer:   \n"; + echo "Category: \n"; + echo "  
\n"; + echo "
\n"; + + echo "

\n"; + + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + + + + +###################### +# ADD=331111111111111 modify vicidial status categories +###################### + +if ($ADD==331111111111111) +{ + if ($LOGmodify_servers==1) + { + echo "
\n"; + echo ""; + + echo "
\n"; + echo "VICIDIAL STATUS CATEGORIES:   $NWB#vicidial_status_categories$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_status_categories order by vsc_id;"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + + $Avsc_id[$o] = $rowx[0]; + $Avsc_name[$o] = $rowx[1]; + $Avsc_description[$o] = $rowx[2]; + $Atovdad_display[$o] = $rowx[3]; + + $o++; + } + $p=0; + while ($o > $p) + { + if (eregi("1$|3$|5$|7$|9$", $p)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $CATstatuses=''; + $stmt="SELECT status from vicidial_statuses where category='$Avsc_id[$p]' order by status;"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $q=0; + while ($statuses_to_print > $q) + { + $rowx=mysql_fetch_row($rslt); + $CATstatuses.=" $rowx[0]"; + $q++; + } + $stmt="SELECT status from vicidial_campaign_statuses where category='$Avsc_id[$p]' order by status;"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $q=0; + while ($statuses_to_print > $q) + { + $rowx=mysql_fetch_row($rslt); + $CATstatuses.=" $rowx[0]"; + $q++; + } + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + $p++; + } + + echo "
CATEGORYNAMETOVDADSTATUSES IN THIS CATEGORY
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "$Avsc_id[$p]
\n"; + echo "$CATstatuses"; + echo "
Description:
        \n"; + echo "   DELETE
 
\n"; + + echo "
ADD NEW STATUS CATEGORY
\n"; + echo "\n"; + echo "Category ID:   \n"; + echo "Name:   \n"; + echo "TimeOnVDAD Display:  
\n"; + echo "Description:   \n"; + echo "
\n"; + + echo "

\n"; + + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + + + + + +###################### +# ADD=550 search form +###################### + +if ($ADD==550) +{ +echo "
\n"; +echo ""; + +echo "
SEARCH FOR A USER
\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "
User Number:
Full Name:
User Level:
User Group:
\n"; + +} + +###################### +# ADD=660 user search results +###################### + +if ($ADD==660) +{ +echo "
\n"; + echo ""; + + $SQL = ''; + if ($user) {$SQL .= " user LIKE \"%$user%\" and";} + if ($full_name) {$SQL .= " full_name LIKE \"%$full_name%\" and";} + if ($user_level > 0) {$SQL .= " user_level LIKE \"%$user_level%\" and";} + if ($user_group) {$SQL .= " user_group = '$user_group' and";} + $SQL = eregi_replace(" and$", "", $SQL); + if (strlen($SQL)>5) {$SQL = "where $SQL";} + + $stmt="SELECT * from vicidial_users $SQL order by full_name desc;"; +# echo "\n|$stmt|\n"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
SEARCH RESULTS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[1]$row[3]$row[4]$row[5]MODIFY | STATS | STATUS | TIME
\n"; + +} + + +###################################################################################################### +###################################################################################################### +####### 8 series, Callback lists +###################################################################################################### +###################################################################################################### + +###################### +# ADD=8 find all callbacks on hold by a User +###################### +if ($ADD==8) +{ + if ($LOGmodify_users==1) + { + if ($SUB==89) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where user='$user' and status='LIVE' and callback_time < '$past_month_date';"; + $rslt=mysql_query($stmt, $link); + echo "
User($user) callback listings LIVE for more than one month have been made INACTIVE\n"; + } + if ($SUB==899) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where user='$user' and status='LIVE' and callback_time < '$past_week_date';"; + $rslt=mysql_query($stmt, $link); + echo "
User($user) callback listings LIVE for more than one week have been made INACTIVE\n"; + } + } +$CBinactiveLINK = "
Remove LIVE Callbacks older than one month for this user
Remove LIVE Callbacks older than one week for this user
"; + +echo ""; + + $CBquerySQLwhere = "and user='$user'"; + +echo "
USER CALLBACK HOLD LISTINGS: $user\n"; +$oldADD = "ADD=8&user=$user"; +$ADD='82'; +} + +###################### +# ADD=81 find all callbacks on hold within a Campaign +###################### +if ($ADD==81) +{ + if ($LOGmodify_campaigns==1) + { + if ($SUB==89) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where campaign_id='$campaign_id' and status='LIVE' and callback_time < '$past_month_date';"; + $rslt=mysql_query($stmt, $link); + echo "
campaign($campaign_id) callback listings LIVE for more than one month have been made INACTIVE\n"; + } + if ($SUB==899) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where campaign_id='$campaign_id' and status='LIVE' and callback_time < '$past_week_date';"; + $rslt=mysql_query($stmt, $link); + echo "
campaign($campaign_id) callback listings LIVE for more than one week have been made INACTIVE\n"; + } + } +$CBinactiveLINK = "
Remove LIVE Callbacks older than one month for this campaign
Remove LIVE Callbacks older than one week for this campaign
"; + +echo ""; + + $CBquerySQLwhere = "and campaign_id='$campaign_id'"; + +echo "
CAMPAIGN CALLBACK HOLD LISTINGS: $campaign_id\n"; +$oldADD = "ADD=81&campaign_id=$campaign_id"; +$ADD='82'; +} + +###################### +# ADD=811 find all callbacks on hold within a List +###################### +if ($ADD==811) +{ + if ($LOGmodify_lists==1) + { + if ($SUB==89) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where list_id='$list_id' and status='LIVE' and callback_time < '$past_month_date';"; + $rslt=mysql_query($stmt, $link); + echo "
list($list_id) callback listings LIVE for more than one month have been made INACTIVE\n"; + } + if ($SUB==899) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where list_id='$list_id' and status='LIVE' and callback_time < '$past_week_date';"; + $rslt=mysql_query($stmt, $link); + echo "
list($list_id) callback listings LIVE for more than one week have been made INACTIVE\n"; + } + } +$CBinactiveLINK = "
Remove LIVE Callbacks older than one month for this list
Remove LIVE Callbacks older than one week for this list
"; + +echo ""; + + $CBquerySQLwhere = "and list_id='$list_id'"; + +echo "
LIST CALLBACK HOLD LISTINGS: $list_id\n"; +$oldADD = "ADD=811&list_id=$list_id"; +$ADD='82'; +} + +###################### +# ADD=8111 find all callbacks on hold within a user group +###################### +if ($ADD==8111) +{ + if ($LOGmodify_usergroups==1) + { + if ($SUB==89) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where user_group='$user_group' and status='LIVE' and callback_time < '$past_month_date';"; + $rslt=mysql_query($stmt, $link); + echo "
user group($user_group) callback listings LIVE for more than one month have been made INACTIVE\n"; + } + if ($SUB==899) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where user_group='$user_group' and status='LIVE' and callback_time < '$past_week_date';"; + $rslt=mysql_query($stmt, $link); + echo "
user group($user_group) callback listings LIVE for more than one week have been made INACTIVE\n"; + } + } + $CBinactiveLINK = "
Remove LIVE Callbacks older than one month for this user group
Remove LIVE Callbacks older than one week for this user group
"; + + echo ""; + + $CBquerySQLwhere = "and user_group='$user_group'"; + +echo "
USER GROUP CALLBACK HOLD LISTINGS: $list_id\n"; +$oldADD = "ADD=8111&user_group=$user_group"; +$ADD='82'; +} + +###################### +# ADD=82 display all callbacks on hold +###################### +if ($ADD==82) +{ + +$USERlink='stage=USERIDDOWN'; +$GROUPlink='stage=GROUPDOWN'; +$ENDATElink='stage=ENDATEDOWN'; +$SQLorder='order by '; +if (eregi("USERIDDOWN",$stage)) {$SQLorder='order by user desc,'; $USERlink='stage=USERIDUP';} +if (eregi("GROUPDOWN",$stage)) {$SQLorder='order by user_group desc,'; $NAMElink='stage=NAMEUP';} +if (eregi("ENDATEDOWN",$stage)) {$SQLorder='order by entry_time desc,'; $LEVELlink='stage=LEVELUP';} + + $stmt="SELECT * from vicidial_callbacks where status IN('ACTIVE','LIVE') $CBquerySQLwhere $SQLorder recipient,status desc,callback_time"; + $rslt=mysql_query($stmt, $link); + $cb_to_print = mysql_num_rows($rslt); + +echo "
\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $o=0; + while ($cb_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
LEADLIST CAMPAIGNENTRY DATECALLBACK DATEUSERRECIPIENTSTATUSGROUP
$row[1]$row[2]$row[3]$row[5]$row[6]$row[8]$row[9]$row[4]$row[11]
\n"; + +echo "$CBinactiveLINK"; +} + + + +###################################################################################################### +###################################################################################################### +####### 0 series, displays and searches +###################################################################################################### +###################################################################################################### + +###################### +# ADD=0 display all active users +###################### +if ($ADD==0) +{ +echo "
\n"; +echo ""; + +$USERlink='stage=USERIDDOWN'; +$NAMElink='stage=NAMEDOWN'; +$LEVELlink='stage=LEVELDOWN'; +$GROUPlink='stage=GROUPDOWN'; +$SQLorder='order by full_name'; +if (eregi("USERIDUP",$stage)) {$SQLorder='order by user asc'; $USERlink='stage=USERIDDOWN';} +if (eregi("USERIDDOWN",$stage)) {$SQLorder='order by user desc'; $USERlink='stage=USERIDUP';} +if (eregi("NAMEUP",$stage)) {$SQLorder='order by full_name asc'; $NAMElink='stage=NAMEDOWN';} +if (eregi("NAMEDOWN",$stage)) {$SQLorder='order by full_name desc'; $NAMElink='stage=NAMEUP';} +if (eregi("LEVELUP",$stage)) {$SQLorder='order by user_level asc'; $LEVELlink='stage=LEVELDOWN';} +if (eregi("LEVELDOWN",$stage)) {$SQLorder='order by user_level desc'; $LEVELlink='stage=LEVELUP';} +if (eregi("GROUPUP",$stage)) {$SQLorder='order by user_group asc'; $GROUPlink='stage=GROUPDOWN';} +if (eregi("GROUPDOWN",$stage)) {$SQLorder='order by user_group desc'; $GROUPlink='stage=GROUPUP';} + $stmt="SELECT * from vicidial_users $SQLorder"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
USER LISTINGS:\n"; +echo "
\n"; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo "\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
USER IDFULL NAMELEVELGROUPLINKS
$row[1]$row[3]$row[4]$row[5]MODIFY | STATS | STATUS | TIME
\n"; +} + +###################### +# ADD=10 display all campaigns +###################### +if ($ADD==10) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
CAMPAIGN LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2] $row[3]$row[4]$row[5] $row[6]$row[7]  MODIFY
\n"; +} + + +###################### +# ADD=100 display all lists +###################### +if ($ADD==100) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_lists order by list_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
LIST LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2]$row[4]$row[5] $row[3]$row[7]  MODIFY
\n"; +} + + + +###################### +# ADD=1000 display all inbound groups +###################### +if ($ADD==1000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_inbound_groups order by group_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
INBOUND GROUP LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[3] $row[5]  MODIFY
\n"; +} + + +###################### +# ADD=10000 display all remote agents +###################### +if ($ADD==10000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_remote_agents order by server_ip,campaign_id,user_start"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
REMOTE AGENTS LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[1] $row[2] $row[3] $row[4] $row[5] $row[6]MODIFY
\n"; +} + + +###################### +# ADD=100000 display all user groups +###################### +if ($ADD==100000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_user_groups order by user_group"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
USER GROUPS LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]MODIFY
\n"; +} + + +###################### +# ADD=1000000 display all scripts +###################### +if ($ADD==1000000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_scripts order by script_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
SCRIPTS LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]MODIFY
\n"; +} + + +###################### +# ADD=10000000 display all filters +###################### +if ($ADD==10000000) +{ +echo "
\n"; + + echo ""; + + $stmt="SELECT * from vicidial_lead_filters order by lead_filter_id"; + $rslt=mysql_query($stmt, $link); + $filters_to_print = mysql_num_rows($rslt); + +echo "
LEAD FILTER LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($filters_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]MODIFY
\n"; +} + + +###################### +# ADD=100000000 display all call times +###################### +if ($ADD==100000000) +{ +echo "
\n"; + + echo ""; + + $stmt="SELECT * from vicidial_call_times order by call_time_id"; + $rslt=mysql_query($stmt, $link); + $filters_to_print = mysql_num_rows($rslt); + +echo "
CALL TIME LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($filters_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[3] $row[4] MODIFY
\n"; +} + +###################### +# ADD=1000000000 display all state call times +###################### +if ($ADD==1000000000) +{ +echo "
\n"; + + echo ""; + + $stmt="SELECT * from vicidial_state_call_times order by state_call_time_id"; + $rslt=mysql_query($stmt, $link); + $filters_to_print = mysql_num_rows($rslt); + +echo "
STATE CALL TIME LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($filters_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2] $row[3] $row[4] MODIFY
\n"; +} + +###################### +# ADD=10000000000 display all phones +###################### +if ($ADD==10000000000) +{ +echo "
\n"; +echo ""; + +$EXTENlink='stage=EXTENDOWN'; +$PROTOlink='stage=PROTODOWN'; +$SERVERlink='stage=SERVERDOWN'; +$STATUSlink='stage=STATUSDOWN'; +$SQLorder='order by extension,server_ip'; +if (eregi("EXTENUP",$stage)) {$SQLorder='order by extension asc'; $EXTENlink='stage=EXTENDOWN';} +if (eregi("EXTENDOWN",$stage)) {$SQLorder='order by extension desc'; $EXTENlink='stage=EXTENUP';} +if (eregi("PROTOUP",$stage)) {$SQLorder='order by protocol asc'; $PROTOlink='stage=PROTODOWN';} +if (eregi("PROTODOWN",$stage)) {$SQLorder='order by protocol desc'; $PROTOlink='stage=PROTOUP';} +if (eregi("SERVERUP",$stage)) {$SQLorder='order by server_ip asc'; $SERVERlink='stage=SERVERDOWN';} +if (eregi("SERVERDOWN",$stage)) {$SQLorder='order by server_ip desc'; $SERVERlink='stage=SERVERUP';} +if (eregi("STATUSUP",$stage)) {$SQLorder='order by status asc'; $STATUSlink='stage=STATUSDOWN';} +if (eregi("STATUSDOWN",$stage)) {$SQLorder='order by status desc'; $STATUSlink='stage=STATUSUP';} + $stmt="SELECT * from phones $SQLorder"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
PHONE LISTINGS:\n"; +echo "
\n"; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo "\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
EXTENPROTOSERVERDIAL PLANSTATUSNAMEVMAILLINKS
$row[0]$row[16]$row[5]$row[1]$row[2]$row[8]$row[11]$row[14]$row[15]MODIFY | STATS
\n"; +} + +###################### +# ADD=100000000000 display all servers +###################### +if ($ADD==100000000000) +{ +echo "\n";echo "\n"; +$stmt="SELECT admin_home_url from system_settings;"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$admin_home_url_LU = $row[0]; + +?> +
+
\n"; + echo ""; + + $stmt="SELECT * from servers order by server_id"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
SERVER LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0]$row[1] $row[2] $row[4] $row[3]  MODIFY
\n"; +} + +###################### +# ADD=1000000000000 display all conferences +###################### +if ($ADD==1000000000000) +{ +echo "\r\n"; + print " \r\n"; + } + $rec_count++; + } +$sthA->finish(); + +exit; diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/listloader_super.pl b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/listloader_super.pl new file mode 100644 index 00000000..167fff5e --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/listloader_super.pl @@ -0,0 +1,1086 @@ +#!/usr/bin/perl + +### listloader_super.pl version 0.4 *DBI-version* +### +### Copyright (C) 2007 Matt Florell,Joe Johnson LICENSE: GPLv2 +### +# +# +# CHANGES +# 60616-1548 - Added listID override feature to force all leads into same list +# - Added gmt_offset_now lookup for each lead +# 60811-1232 - Changed to DBI +# 60811-1329 - changed to use /etc/astguiclient.conf for configs +# 60906-1056 - added filter of non-digits in alt_phone field +# 61110-1229 - added new USA-Canada DST scheme and Brazil DST scheme +# 61128-1207 - added postal code GMT lookup and duplicate check options +# 70205-1703 - Defaulted phone_code to 1 if not populated +# 70417-1059 - Fixed default phone_code bug +# 70510-1518 - Added campaign and system duplicate check and phonecode override +# + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help|-h/i) + { + print "allowed run time options:\n [-forcelistid=1234] = overrides the listID given in the file with the 1234\n [-h] = this help screen\n\n"; + + exit; + } + else + { + if ($args =~ /-duplicate-check/i) + {$dupcheck=1;} + if ($args =~ /-duplicate-campaign-check/i) + {$dupcheckcamp=1;} + if ($args =~ /-duplicate-system-check/i) + {$dupchecksys=1;} + if ($args =~ /-postal-code-gmt/i) + {$postalgmt=1;} + if ($args =~ /--forcelistid=/i) + { + @data_in = split(/--forcelistid=/,$args); + $forcelistid = $data_in[1]; + $forcelistid =~ s/ .*//gi; + print "\n----- FORCE LISTID OVERRIDE: $forcelistid -----\n\n"; + } + else + {$forcelistid = '';} + + if ($args =~ /--forcephonecode=/i) + { + @data_in = split(/--forcephonecode=/,$args); + $forcephonecode = $data_in[1]; + $forcephonecode =~ s/ .*//gi; + print "\n----- FORCE PHONECODE OVERRIDE: $forcephonecode -----\n\n"; + } + else + {$forcephonecode = '';} + + if ($args =~ /--lead-file=/i) + { + @data_in = split(/--lead-file=/,$args); + $lead_file = $data_in[1]; + $lead_file =~ s/ .*//gi; + # print "\n----- LEAD FILE: $lead_file -----\n\n"; + } + else + {$lead_file = './vicidial_temp_file.xls';} + } +} +### end parsing run-time options ### + +use Spreadsheet::ParseExcel; +use Time::Local; +use DBI; + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + +$vars=$ARGV[0]; +@xls_fields=split(/\,/, $vars); + +$|=0; +$secX = time(); + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($hour < 10) {$hour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +$pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; +$pulldate="$year-$mon-$mday $hour:$min:$sec"; +$inSD = $pulldate0; +$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + + ### Grab Server values from the database + $stmtA = "SELECT local_gmt FROM servers where server_ip = '$server_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBSERVER_GMT = "$aryA[0]"; + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + $rec_count++; + } + $sthA->finish(); + + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + +if ($isdst) {$LOCAL_GMT_OFF++;} +if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";} + + + +$total=0; $good=0; $bad=0; +open(STMT_FILE, "> $PATHlogs/listloader_stmts.txt"); + +$oBook = Spreadsheet::ParseExcel::Workbook->Parse("$lead_file"); +my($iR, $iC, $oWkS, $oWkC); + +foreach $oWkS (@{$oBook->{Worksheet}}) { + for($iR = 0 ; defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow} ; $iR++) { + + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user = ""; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[0]]; + if ($oWkC) {$vendor_lead_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[1]]; + if ($oWkC) {$source_code=$oWkC->Value; } + $source_id=$source_code; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[2]]; + if ($oWkC) {$list_id=$oWkC->Value; } + $gmt_offset = '0'; + $called_since_last_reset='N'; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[3]]; + if ($oWkC) {$phone_code=$oWkC->Value; } + $phone_code=~s/[^0-9]//g; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[4]]; + if ($oWkC) {$phone_number=$oWkC->Value; } + $phone_number=~s/[^0-9]//g; + $USarea = substr($phone_number, 0, 3); + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[5]]; + if ($oWkC) {$title=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[6]]; + if ($oWkC) {$first_name=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[7]]; + if ($oWkC) {$middle_initial=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[8]]; + if ($oWkC) {$last_name=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[9]]; + if ($oWkC) {$address1=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[10]]; + if ($oWkC) {$address2=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[11]]; + if ($oWkC) {$address3=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[12]]; + if ($oWkC) {$city=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[13]]; + if ($oWkC) {$state=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[14]]; + if ($oWkC) {$province=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[15]]; + if ($oWkC) {$postal_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[16]]; + if ($oWkC) {$country_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[17]]; + if ($oWkC) {$gender=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[18]]; + if ($oWkC) {$date_of_birth=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[19]]; + if ($oWkC) {$alt_phone=$oWkC->Value; } + $alt_phone=~s/[^0-9]//g; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[20]]; + if ($oWkC) {$email=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[21]]; + if ($oWkC) {$security_phrase=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[22]]; + if ($oWkC) {$comments=$oWkC->Value; } + $comments=~s/^\s*(.*?)\s*$/$1/; + + + + if (length($forcelistid) > 0) + { + $list_id = $forcelistid; # set list_id to override value + } + if (length($forcephonecode) > 0) + { + $phone_code = $forcephonecode; # set phone_code to override value + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if ($dupchecksys > 0) + { + $dup_lead=0; + $stmtA = "select count(*) from vicidial_list where phone_number='$phone_number';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $dup_lead = $aryA[0]; + $dup_lead_list=$list_id; + } + $sthA->finish(); + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if ($dupcheck > 0) + { + $dup_lead=0; + $stmtA = "select list_id from vicidial_list where phone_number='$phone_number' and list_id='$list_id' limit 1;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $dup_lead_list = $aryA[0]; + $dup_lead++; + } + $sthA->finish(); + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if ($dupcheckcamp > 0) + { + $dup_lead=0; + $dup_lists=''; + + $stmtA = "select count(*) from vicidial_lists where list_id='$list_id';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + @aryA = $sthA->fetchrow_array; + $ci_recs = $aryA[0]; + $sthA->finish(); + if ($ci_recs > 0) + { + $stmtA = "select campaign_id from vicidial_lists where list_id='$list_id';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + @aryA = $sthA->fetchrow_array; + $dup_camp = $aryA[0]; + $sthA->finish(); + + $stmtA = "select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $dup_lists .= "'$aryA[0]',"; + $rec_count++; + } + $sthA->finish(); + + chop($dup_lists); + $stmtA = "select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $dup_lead_list = "'$aryA[0]',"; + $rec_count++; + $dup_lead=1; + } + $sthA->finish(); + } + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + + if ( (length($phone_number)>6) && ($dup_lead < 1) ) + { + $phone_list .= "$phone_number$US$list_id|"; + $postalgmt_found=0; + if (length($phone_code)<1) {$phone_code = '1';} + + if ( ($postalgmt > 0) && (length($postal_code)>4) ) + { + if ($phone_code =~ /^1$/) + { + $stmtA = "select * from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[2]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[3]; + $dst_range = $aryA[4]; + $PC_processed++; + $rec_count++; + $postalgmt_found++; + if ($DBX) {print " Postal GMT record found for $postal_code: |$gmt_offset|$dst|$dst_range|\n";} + } + $sthA->finish(); + } + } + if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =~ /^1$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### MEXICO ### + if ($phone_code =~ /^52$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### AUSTRALIA ### + if ($phone_code =~ /^61$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + } + + ### Find out if DST to raise the gmt offset ### + $AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); + $AC_localtime = ($secX + (3600 * $AC_GMT_diff)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($AC_localtime); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + + if ( (!$AC_processed) && ($dst_range =~ /SSM-FSN/) ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + &USACAN_dstcalc; + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSA-LSO/) ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + &NA_dstcalc; + if ($DBX) {print " DST: $NA_DST\n";} + if ($NA_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /LSM-LSO/) ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + &GBR_dstcalc; + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /LSO-LSM/) ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + &AUS_dstcalc; + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSO-LSM/) ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + &AUST_dstcalc; + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSO-TSM/) ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + &NZL_dstcalc; + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /TSO-LSF/) ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + &BZL_dstcalc; + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$area_GMT++;} + $AC_processed++; + } + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $affected_rows = $dbhA->do($stmtZ); + print STMT_FILE $stmtZ."\r\n"; + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| $dup_lead_list\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + sleep(1); +# flush(); + } + } +} + +if ($multi_insert_counter > 0) { + $stmtZ = "INSERT INTO vicidial_list values ".substr($multistmt, 0, -1).";"; + $affected_rows = $dbhA->do($stmtZ); + print STMT_FILE $stmtZ."\r\n"; +} + +print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total"; + +exit; + + + + + + +sub USACAN_dstcalc { +#********************************************************************** +# SSM-FSN +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on Second Sunday March to First Sunday November at 2 am. +# INPUTS: +# mm INTEGER Month. +# dd INTEGER Day of the month. +# ns INTEGER Seconds into the day. +# dow INTEGER Day of week (0=Sunday, to 6=Saturday) +# OPTIONAL INPUT: +# timezone INTEGER hour difference UTC - local standard time +# (DEFAULT is blank) +# make calculations based on UTC time, +# which means shift at 10:00 UTC in April +# and 9:00 UTC in October +# OUTPUT: +# INTEGER 1 = DST, 0 = not DST +# +# S M T W T F S +# 1 2 3 4 5 6 7 +# 8 9 10 11 12 13 14 +#15 16 17 18 19 20 21 +#22 23 24 25 26 27 28 +#29 30 31 +# +# S M T W T F S +# 1 2 3 4 5 6 +# 7 8 9 10 11 12 13 +#14 15 16 17 18 19 20 +#21 22 23 24 25 26 27 +#28 29 30 31 +# +#********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; return 0; + } elsif ($mm >= 4 && $mm <= 10) { + $USACAN_DST=1; return 1; + } elsif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; return 1; + } elsif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; return 0; + } else { + $USACAN_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $USACAN_DST=0; return 0; + } else { + $USACAN_DST=1; return 1; + } + } + } else { + $USACAN_DST=0; return 0; + } + } elsif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; return 0; + } elsif ($dd < ($dow+1)) { + $USACAN_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; return 1; + } else { + $USACAN_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; return 1; + } else { + $USACAN_DST=0; return 0; + } + } + } else { + $USACAN_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub NA_dstcalc { +#********************************************************************** +# FSA-LSO +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in April and last Sunday in October at 2 am. +#********************************************************************** + + $NA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $NA_DST=0; return 0; + } elsif ($mm >= 5 && $mm <= 9) { + $NA_DST=1; return 1; + } elsif ($mm == 4) { + if ($dd > 7) { + $NA_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $NA_DST=0; return 0; + } else { + $NA_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $NA_DST=0; return 0; + } else { + $NA_DST=1; return 1; + } + } + } else { + $NA_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $NA_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $NA_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $NA_DST=1; return 1; + } else { + $NA_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 7200) { + $NA_DST=1; return 1; + } else { + $NA_DST=0; return 0; + } + } + } else { + $NA_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub GBR_dstcalc { +#********************************************************************** +# LSM-LSO +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in March and last Sunday in October at 1 am. +#********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; return 0; + } elsif ($mm >= 4 && $mm <= 9) { + $GBR_DST=1; return 1; + } elsif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $GBR_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; return 0; + } else { + $GBR_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; return 0; + } else { + $GBR_DST=1; return 1; + } + } + } else { + $GBR_DST=1; return 1; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $GBR_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; return 1; + } else { + $GBR_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; return 1; + } else { + $GBR_DST=0; return 0; + } + } + } else { + $GBR_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub AUS_dstcalc { +#********************************************************************** +# LSO-LSM +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in October and last Sunday in March at 1 am. +#********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $AUS_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $AUS_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; return 1; + } else { + $AUS_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; return 1; + } else { + $AUS_DST=0; return 0; + } + } + } else { + $AUS_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $AUS_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; return 0; + } else { + $AUS_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; return 0; + } else { + $AUS_DST=1; return 1; + } + } + } else { + $AUS_DST=1; return 1; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub AUST_dstcalc { +#********************************************************************** +# FSO-LSM +# TASMANIA ONLY +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and last Sunday in March at 1 am. +#********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $AUST_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $AUST_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; return 1; + } else { + $AUST_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; return 1; + } else { + $AUST_DST=0; return 0; + } + } + } else { + $AUST_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd >= 8) { + $AUST_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $AUST_DST=0; return 0; + } else { + $AUST_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $AUST_DST=0; return 0; + } else { + $AUST_DST=1; return 1; + } + } + } else { + $AUST_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub NZL_dstcalc { +#********************************************************************** +# FSO-TSM +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and third Sunday in March at 1 am. +#********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $NZL_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; return 1; + } elsif ($dd < ($dow+14)) { + $NZL_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; return 1; + } else { + $NZL_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; return 1; + } else { + $NZL_DST=0; return 0; + } + } + } else { + $NZL_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd >= 8) { + $NZL_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $NZL_DST=0; return 0; + } else { + $NZL_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $NZL_DST=0; return 0; + } else { + $NZL_DST=1; return 1; + } + } + } else { + $NZL_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub BZL_dstcalc { +#********************************************************************** +# TSO-LSF +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. Brazil +# Based on Third Sunday October to Last Sunday February at 1 am. +#********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; return 1; + } elsif ($mm >= 3 && $mm <= 9) { + $BZL_DST=0; return 0; + } elsif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; return 1; + } elsif ($dd < ($dow+22)) { + $BZL_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; return 1; + } else { + $BZL_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; return 1; + } else { + $BZL_DST=0; return 0; + } + } + } else { + $BZL_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; return 0; + } elsif ($dd < ($dow+22)) { + $BZL_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; return 0; + } else { + $BZL_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; return 0; + } else { + $BZL_DST=1; return 1; + } + } + } else { + $BZL_DST=1; return 1; + } + } # end of month checks +} # end of subroutine dstcalc diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/new_listloader_superL.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/new_listloader_superL.php new file mode 100644 index 00000000..629321ed --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/new_listloader_superL.php @@ -0,0 +1,2069 @@ + LICENSE: GPLv2 +# +# AST GUI lead loader from formatted file +# +# CHANGES +# 50602-1640 - First version created by Joe Johnson +# 51128-1108 - Removed PHP global vars requirement +# 60113-1603 - Fixed a few bugs in Excel import +# 60421-1624 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60616-1240 - added listID override +# 60616-1604 - added gmt lookup for each lead +# 60619-1651 - Added variable filtering to eliminate SQL injection attack threat +# 60822-1121 - fixed for nonwritable directories +# 60906-1100 - added filter of non-digits in alt_phone field +# 61110-1222 - added new USA-Canada DST scheme and Brazil DST scheme +# 61128-1149 - added postal code GMT lookup and duplicate check options +# 70417-1059 - Fixed default phone_code bug +# 70510-1518 - Added campaign and system duplicate check and phonecode override +# +# make sure vicidial_list exists and that your file follows the formatting correctly. This page does not dedupe or do any other lead filtering actions yet at this time. + +$version = '2.0.4'; +$build = '70510-1518'; + + +require("dbconnect.php"); + +### links used for testing +#$link=mysql_connect("10.10.10.15", "cron", "1234"); +#mysql_select_db("asterisk"); +#$WeBServeRRooT = '/home/www/htdocs'; + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$leadfile=$_FILES["leadfile"]; + $LF_orig = $_FILES['leadfile']['name']; + $LF_path = $_FILES['leadfile']['tmp_name']; +if (isset($_GET["submit_file"])) {$submit_file=$_GET["submit_file"];} + elseif (isset($_POST["submit_file"])) {$submit_file=$_POST["submit_file"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["leadfile_name"])) {$leadfile_name=$_GET["leadfile_name"];} + elseif (isset($_POST["leadfile_name"])) {$leadfile_name=$_POST["leadfile_name"];} +if (isset($_GET["file_layout"])) {$file_layout=$_GET["file_layout"];} + elseif (isset($_POST["file_layout"])) {$file_layout=$_POST["file_layout"];} +if (isset($_GET["OK_to_process"])) {$OK_to_process=$_GET["OK_to_process"];} + elseif (isset($_POST["OK_to_process"])) {$OK_to_process=$_POST["OK_to_process"];} +if (isset($_GET["vendor_lead_code_field"])) {$vendor_lead_code_field=$_GET["vendor_lead_code_field"];} + elseif (isset($_POST["vendor_lead_code_field"])) {$vendor_lead_code_field=$_POST["vendor_lead_code_field"];} +if (isset($_GET["source_id_field"])) {$source_id_field=$_GET["source_id_field"];} + elseif (isset($_POST["source_id_field"])) {$source_id_field=$_POST["source_id_field"];} +if (isset($_GET["list_id_field"])) {$list_id_field=$_GET["list_id_field"];} + elseif (isset($_POST["list_id_field"])) {$list_id_field=$_POST["list_id_field"];} +if (isset($_GET["phone_code_field"])) {$phone_code_field=$_GET["phone_code_field"];} + elseif (isset($_POST["phone_code_field"])) {$phone_code_field=$_POST["phone_code_field"];} +if (isset($_GET["phone_number_field"])) {$phone_number_field=$_GET["phone_number_field"];} + elseif (isset($_POST["phone_number_field"])) {$phone_number_field=$_POST["phone_number_field"];} +if (isset($_GET["title_field"])) {$title_field=$_GET["title_field"];} + elseif (isset($_POST["title_field"])) {$title_field=$_POST["title_field"];} +if (isset($_GET["first_name_field"])) {$first_name_field=$_GET["first_name_field"];} + elseif (isset($_POST["first_name_field"])) {$first_name_field=$_POST["first_name_field"];} +if (isset($_GET["middle_initial_field"])) {$middle_initial_field=$_GET["middle_initial_field"];} + elseif (isset($_POST["middle_initial_field"])) {$middle_initial_field=$_POST["middle_initial_field"];} +if (isset($_GET["last_name_field"])) {$last_name_field=$_GET["last_name_field"];} + elseif (isset($_POST["last_name_field"])) {$last_name_field=$_POST["last_name_field"];} +if (isset($_GET["address1_field"])) {$address1_field=$_GET["address1_field"];} + elseif (isset($_POST["address1_field"])) {$address1_field=$_POST["address1_field"];} +if (isset($_GET["address2_field"])) {$address2_field=$_GET["address2_field"];} + elseif (isset($_POST["address2_field"])) {$address2_field=$_POST["address2_field"];} +if (isset($_GET["address3_field"])) {$address3_field=$_GET["address3_field"];} + elseif (isset($_POST["address3_field"])) {$address3_field=$_POST["address3_field"];} +if (isset($_GET["city_field"])) {$city_field=$_GET["city_field"];} + elseif (isset($_POST["city_field"])) {$city_field=$_POST["city_field"];} +if (isset($_GET["state_field"])) {$state_field=$_GET["state_field"];} + elseif (isset($_POST["state_field"])) {$state_field=$_POST["state_field"];} +if (isset($_GET["province_field"])) {$province_field=$_GET["province_field"];} + elseif (isset($_POST["province_field"])) {$province_field=$_POST["province_field"];} +if (isset($_GET["postal_code_field"])) {$postal_code_field=$_GET["postal_code_field"];} + elseif (isset($_POST["postal_code_field"])) {$postal_code_field=$_POST["postal_code_field"];} +if (isset($_GET["country_code_field"])) {$country_code_field=$_GET["country_code_field"];} + elseif (isset($_POST["country_code_field"])) {$country_code_field=$_POST["country_code_field"];} +if (isset($_GET["gender_field"])) {$gender_field=$_GET["gender_field"];} + elseif (isset($_POST["gender_field"])) {$gender_field=$_POST["gender_field"];} +if (isset($_GET["date_of_birth_field"])) {$date_of_birth_field=$_GET["date_of_birth_field"];} + elseif (isset($_POST["date_of_birth_field"])) {$date_of_birth_field=$_POST["date_of_birth_field"];} +if (isset($_GET["alt_phone_field"])) {$alt_phone_field=$_GET["alt_phone_field"];} + elseif (isset($_POST["alt_phone_field"])) {$alt_phone_field=$_POST["alt_phone_field"];} +if (isset($_GET["email_field"])) {$email_field=$_GET["email_field"];} + elseif (isset($_POST["email_field"])) {$email_field=$_POST["email_field"];} +if (isset($_GET["security_phrase_field"])) {$security_phrase_field=$_GET["security_phrase_field"];} + elseif (isset($_POST["security_phrase_field"])) {$security_phrase_field=$_POST["security_phrase_field"];} +if (isset($_GET["comments_field"])) {$comments_field=$_GET["comments_field"];} + elseif (isset($_POST["comments_field"])) {$comments_field=$_POST["comments_field"];} +if (isset($_GET["list_id_override"])) {$list_id_override=$_GET["list_id_override"];} + elseif (isset($_POST["list_id_override"])) {$list_id_override=$_POST["list_id_override"];} + $list_id_override = (preg_replace("/\D/","",$list_id_override)); +if (isset($_GET["lead_file"])) {$lead_file=$_GET["lead_file"];} + elseif (isset($_POST["lead_file"])) {$lead_file=$_POST["lead_file"];} +if (isset($_GET["dupcheck"])) {$dupcheck=$_GET["dupcheck"];} + elseif (isset($_POST["dupcheck"])) {$dupcheck=$_POST["dupcheck"];} +if (isset($_GET["postalgmt"])) {$postalgmt=$_GET["postalgmt"];} + elseif (isset($_POST["postalgmt"])) {$postalgmt=$_POST["postalgmt"];} +if (isset($_GET["phone_code_override"])) {$phone_code_override=$_GET["phone_code_override"];} + elseif (isset($_POST["phone_code_override"])) {$phone_code_override=$_POST["phone_code_override"];} + $phone_code_override = (preg_replace("/\D/","",$phone_code_override)); + +# $country_field=$_GET["country_field"]; if (!$country_field) {$country_field=$_POST["country_field"];} + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); +$list_id_override = ereg_replace("[^0-9]","",$list_id_override); + + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_datetime = $STARTtime; + +$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +if ($WeBRooTWritablE > 0) {$fp = fopen ("./project_auth_entries.txt", "a");} +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-LEAD-LOADER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT load_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGload_leads =$row[0]; + + if ($LOGload_leads < 1) + { + echo "You do not have permissions to load leads\n"; + exit; + } + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "LIST_LOAD|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "LIST_LOAD|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + + +$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://';} +$admDIR = "$HTTPprotocol$server_name$script_name"; +$admDIR = eregi_replace('new_listloader_superL.php','',$admDIR); +$admSCR = 'admin.php'; +$NWB = "   \"HELP\""; + +$secX = date("U"); +$hour = date("H"); +$min = date("i"); +$sec = date("s"); +$mon = date("m"); +$mday = date("d"); +$year = date("Y"); +$isdst = date("I"); +$Shour = date("H"); +$Smin = date("i"); +$Ssec = date("s"); +$Smon = date("m"); +$Smday = date("d"); +$Syear = date("Y"); +$pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; +$inSD = $pulldate0; +$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + ### Grab Server GMT value from the database + $stmt="SELECT local_gmt FROM servers where server_ip = '$server_ip';"; + $rslt=mysql_query($stmt, $link); + $gmt_recs = mysql_num_rows($rslt); + if ($gmt_recs > 0) + { + $row=mysql_fetch_row($rslt); + $DBSERVER_GMT = "$row[0]"; + if (strlen($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;} + if ($isdst) {$SERVER_GMT++;} + } + else + { + $SERVER_GMT = date("O"); + $SERVER_GMT = eregi_replace("\+","",$SERVER_GMT); + $SERVER_GMT = ($SERVER_GMT + 0); + $SERVER_GMT = ($SERVER_GMT / 100); + } + + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + +#if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";} + + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +function macfontfix($fontsize) { + + $browser = getenv("HTTP_USER_AGENT"); + $pctype = explode("(", $browser); + if (ereg("Mac",$pctype[1])) { + /* Browser is a Mac. If not Netscape 6, raise fonts */ + + $blownbrowser = explode('/', $browser); + $ver = explode(' ', $blownbrowser[1]); + $ver = $ver[0]; + if ($ver >= 5.0) return $fontsize; else return ($fontsize+2); + + } else return $fontsize; /* Browser is not a Mac - don't touch fonts */ +} + +echo "\n"; + +?> + + + +VICIDIAL ADMIN: Lead Loader + + +
method=post onSubmit="ParseFileName()" enctype="multipart/form-data"> + + +
\n"; + echo ""; + + $stmt="SELECT * from conferences order by conf_exten"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
CONFERENCE LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2]$row[4]  MODIFY
\n"; +} + +###################### +# ADD=10000000000000 display all vicidial conferences +###################### +if ($ADD==10000000000000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_conferences order by conf_exten"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
CONFERENCE LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2]$row[4]  MODIFY
\n"; +} + +###################### +# ADD=999999 display reports section +###################### +if ($ADD==999999) +{ + if ($LOGview_reports==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_conferences order by conf_exten"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + + $stmt="select * from servers;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $servers_to_print = mysql_num_rows($rslt); + $i=0; + while ($i < $servers_to_print) + { + $row=mysql_fetch_row($rslt); + $server_id[$i] = $row[0]; + $server_description[$i] = $row[1]; + $server_ip[$i] = $row[2]; + $active[$i] = $row[3]; + $i++; + } + + $stmt="SELECT enable_queuemetrics_logging,queuemetrics_url from system_settings;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $enable_queuemetrics_logging_LU = $row[0]; + $queuemetrics_url_LU = $row[1]; + + ?> + + + + + + VICIDIAL: Server Stats and Reports + VICIDIAL: Server Stats and Reports

+ +

+	
+	 $o)
+		{
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		$o++;
+		}
+
+	echo "
SERVERDESCRIPTIONIP ADDRESSACTIVEVDAD timePARK timeCLOSER/INBOUND time
$server_id[$o]$server_description[$o]$server_ip[$o]$active[$o]LINKLINKLINK
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + + + + +echo "
\n"; + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n
\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds"; +echo "                   VERSION: $admin_version"; +echo "                   BUILD: $build
\n"; + + +?> + + +
+ + + +1) + { + if (strlen($dial_statuses)>2) + { + $g=0; + $p='13'; + $GMT_gmt[0] = ''; + $GMT_hour[0] = ''; + $GMT_day[0] = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $pmin=(gmdate("i", time() + $pzone)); + $phour=( (gmdate("G", time() + $pzone)) * 100); + $pday=gmdate("w", time() + $pzone); + $tz = sprintf("%.2f", $p); + $GMT_gmt[$g] = "$tz"; + $GMT_day[$g] = "$pday"; + $GMT_hour[$g] = ($phour + $pmin); + $p = ($p - 0.25); + $g++; + } + + $stmt="SELECT * FROM vicidial_call_times where call_time_id='$local_call_time';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $Gct_default_start = "$rowx[3]"; + $Gct_default_stop = "$rowx[4]"; + $Gct_sunday_start = "$rowx[5]"; + $Gct_sunday_stop = "$rowx[6]"; + $Gct_monday_start = "$rowx[7]"; + $Gct_monday_stop = "$rowx[8]"; + $Gct_tuesday_start = "$rowx[9]"; + $Gct_tuesday_stop = "$rowx[10]"; + $Gct_wednesday_start = "$rowx[11]"; + $Gct_wednesday_stop = "$rowx[12]"; + $Gct_thursday_start = "$rowx[13]"; + $Gct_thursday_stop = "$rowx[14]"; + $Gct_friday_start = "$rowx[15]"; + $Gct_friday_stop = "$rowx[16]"; + $Gct_saturday_start = "$rowx[17]"; + $Gct_saturday_stop = "$rowx[18]"; + $Gct_state_call_times = "$rowx[19]"; + + $ct_states = ''; + $ct_state_gmt_SQL = ''; + $ct_srs=0; + $b=0; + if (strlen($Gct_state_call_times)>2) + { + $state_rules = explode('|',$Gct_state_call_times); + $ct_srs = ((count($state_rules)) - 2); + } + while($ct_srs >= $b) + { + if (strlen($state_rules[$b])>1) + { + $stmt="SELECT * from vicidial_state_call_times where state_call_time_id='$state_rules[$b]';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Gstate_call_time_id = "$row[0]"; + $Gstate_call_time_state = "$row[1]"; + $Gsct_default_start = "$row[4]"; + $Gsct_default_stop = "$row[5]"; + $Gsct_sunday_start = "$row[6]"; + $Gsct_sunday_stop = "$row[7]"; + $Gsct_monday_start = "$row[8]"; + $Gsct_monday_stop = "$row[9]"; + $Gsct_tuesday_start = "$row[10]"; + $Gsct_tuesday_stop = "$row[11]"; + $Gsct_wednesday_start = "$row[12]"; + $Gsct_wednesday_stop = "$row[13]"; + $Gsct_thursday_start = "$row[14]"; + $Gsct_thursday_stop = "$row[15]"; + $Gsct_friday_start = "$row[16]"; + $Gsct_friday_stop = "$row[17]"; + $Gsct_saturday_start = "$row[18]"; + $Gsct_saturday_stop = "$row[19]"; + + $ct_states .="'$Gstate_call_time_state',"; + + $r=0; + $state_gmt=''; + while($r < $g) + { + if ($GMT_day[$r]==0) #### Sunday local time + { + if (($Gsct_sunday_start==0) and ($Gsct_sunday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_sunday_start) and ($GMT_hour[$r]<$Gsct_sunday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==1) #### Monday local time + { + if (($Gsct_monday_start==0) and ($Gsct_monday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_monday_start) and ($GMT_hour[$r]<$Gsct_monday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==2) #### Tuesday local time + { + if (($Gsct_tuesday_start==0) and ($Gsct_tuesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_tuesday_start) and ($GMT_hour[$r]<$Gsct_tuesday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==3) #### Wednesday local time + { + if (($Gsct_wednesday_start==0) and ($Gsct_wednesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_wednesday_start) and ($GMT_hour[$r]<$Gsct_wednesday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==4) #### Thursday local time + { + if (($Gsct_thursday_start==0) and ($Gsct_thursday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_thursday_start) and ($GMT_hour[$r]<$Gsct_thursday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==5) #### Friday local time + { + if (($Gsct_friday_start==0) and ($Gsct_friday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_friday_start) and ($GMT_hour[$r]<$Gsct_friday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==6) #### Saturday local time + { + if (($Gsct_saturday_start==0) and ($Gsct_saturday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_saturday_start) and ($GMT_hour[$r]<$Gsct_saturday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + $r++; + } + $state_gmt = "$state_gmt'99'"; + $ct_state_gmt_SQL .= "or (state='$Gstate_call_time_state' and gmt_offset_now IN($state_gmt)) "; + } + + $b++; + } + if (strlen($ct_states)>2) + { + $ct_states = eregi_replace(",$",'',$ct_states); + $ct_statesSQL = "and state NOT IN($ct_states)"; + } + else + { + $ct_statesSQL = ""; + } + + $r=0; + $default_gmt=''; + while($r < $g) + { + if ($GMT_day[$r]==0) #### Sunday local time + { + if (($Gct_sunday_start==0) and ($Gct_sunday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_sunday_start) and ($GMT_hour[$r]<$Gct_sunday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==1) #### Monday local time + { + if (($Gct_monday_start==0) and ($Gct_monday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_monday_start) and ($GMT_hour[$r]<$Gct_monday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==2) #### Tuesday local time + { + if (($Gct_tuesday_start==0) and ($Gct_tuesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_tuesday_start) and ($GMT_hour[$r]<$Gct_tuesday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==3) #### Wednesday local time + { + if (($Gct_wednesday_start==0) and ($Gct_wednesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_wednesday_start) and ($GMT_hour[$r]<$Gct_wednesday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==4) #### Thursday local time + { + if (($Gct_thursday_start==0) and ($Gct_thursday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_thursday_start) and ($GMT_hour[$r]<$Gct_thursday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==5) #### Friday local time + { + if (($Gct_friday_start==0) and ($Gct_friday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_friday_start) and ($GMT_hour[$r]<$Gct_friday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==6) #### Saturday local time + { + if (($Gct_saturday_start==0) and ($Gct_saturday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_saturday_start) and ($GMT_hour[$r]<$Gct_saturday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + $r++; + } + + $default_gmt = "$default_gmt'99'"; + $all_gmtSQL = "(gmt_offset_now IN($default_gmt) $ct_statesSQL) $ct_state_gmt_SQL"; + + + $dial_statuses = preg_replace("/ -$/","",$dial_statuses); + $Dstatuses = explode(" ", $dial_statuses); + $Ds_to_print = (count($Dstatuses) - 0); + $Dsql = ''; + $o=0; + while ($Ds_to_print > $o) + { + $o++; + $Dsql .= "'$Dstatuses[$o]',"; + } + $Dsql = preg_replace("/,$/","",$Dsql); + + $stmt="SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN($Dsql) and list_id IN($camp_lists) and ($all_gmtSQL) $fSQL"; + #$DB=1; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rslt_rows = mysql_num_rows($rslt); + if ($rslt_rows) + { + $rowx=mysql_fetch_row($rslt); + $active_leads = "$rowx[0]"; + } + else {$active_leads = '0';} + + echo "|$DB|\n"; + echo "This campaign has $active_leads leads to be dialed in those lists\n"; + } + else + { + echo "no dial statuses selected for this campaign\n"; + } + } + else + { + echo "no active lists selected for this campaign\n"; + } + } +else + { + echo "no active lists selected for this campaign\n"; + } +##### END calculate what gmt_offset_now values are within the allowed local_call_time setting ### +} +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/admin_modify_lead.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/admin_modify_lead.php new file mode 100644 index 00000000..f8a285ec --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/admin_modify_lead.php @@ -0,0 +1,610 @@ + LICENSE: GPLv2 +# + +# CHANGES +# +# 70702-1259 - Added recording location link and truncation +# 70906-2132 - Added closer_log records display +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} +if (isset($_GET["phone"])) {$phone=$_GET["phone"];} + elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];} + elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];} +if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];} + elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];} +if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];} + elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];} +if (isset($_GET["end_call"])) {$end_call=$_GET["end_call"];} + elseif (isset($_POST["end_call"])) {$end_call=$_POST["end_call"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];} + elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];} + elseif (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["call_began"])) {$call_began=$_GET["call_began"];} + elseif (isset($_POST["call_began"])) {$call_began=$_POST["call_began"];} +if (isset($_GET["parked_time"])) {$parked_time=$_GET["parked_time"];} + elseif (isset($_POST["parked_time"])) {$parked_time=$_POST["parked_time"];} +if (isset($_GET["tsr"])) {$tsr=$_GET["tsr"];} + elseif (isset($_POST["tsr"])) {$tsr=$_POST["tsr"];} +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["postal_code"])) {$postal_code=$_GET["postal_code"];} + elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];} +if (isset($_GET["province"])) {$province=$_GET["province"];} + elseif (isset($_POST["province"])) {$province=$_POST["province"];} +if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];} + elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];} +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"])) {$security=$_GET["security"];} + elseif (isset($_POST["security"])) {$security=$_POST["security"];} +if (isset($_GET["comments"])) {$comments=$_GET["comments"];} + elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["CBchangeUSERtoANY"])) {$CBchangeUSERtoANY=$_GET["CBchangeUSERtoANY"];} + elseif (isset($_POST["CBchangeUSERtoANY"])) {$CBchangeUSERtoANY=$_POST["CBchangeUSERtoANY"];} +if (isset($_GET["CBchangeUSERtoUSER"])) {$CBchangeUSERtoUSER=$_GET["CBchangeUSERtoUSER"];} + elseif (isset($_POST["CBchangeUSERtoUSER"])) {$CBchangeUSERtoUSER=$_POST["CBchangeUSERtoUSER"];} +if (isset($_GET["CBchangeANYtoUSER"])) {$CBchangeANYtoUSER=$_GET["CBchangeANYtoUSER"];} + elseif (isset($_POST["CBchangeANYtoUSER"])) {$CBchangeANYtoUSER=$_POST["CBchangeANYtoUSER"];} +if (isset($_GET["callback_id"])) {$callback_id=$_GET["callback_id"];} + elseif (isset($_POST["callback_id"])) {$callback_id=$_POST["callback_id"];} +if (isset($_GET["CBuser"])) {$CBuser=$_GET["CBuser"];} + elseif (isset($_POST["CBuser"])) {$CBuser=$_POST["CBuser"];} +if (isset($_GET["modify_logs"])) {$modify_logs=$_GET["modify_logs"];} + elseif (isset($_POST["modify_logs"])) {$modify_logs=$_POST["modify_logs"];} + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + + +### AST GUI database administration modify lead in vicidial_list +### admin_modify_lead.php + +# this is the administration lead information modifier screen, the administrator just needs to enter the leadID and then they can view and modify the information in the record for that lead + +# CHANGES +# +# 60419-1705 - Added ability to change lead callback record from USERONLY to ANYONE or USERONLY-user +# 60421-1459 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60609-1112 - Added DNC list addition if status changed to DNC +# 60619-1539 - Added variable filtering to eliminate SQL injection attack threat +# 61130-1639 - Added recording_log lookup and list for this lead_id +# 61201-1136 - Added recording_log user(TSR) display and link +# 70305-1133 - Changed to default CHECKED modify logs upon status change +# 70424-1128 - Added campaign-specific statuses, reformatted recordings list +# + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); + + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and modify_leads='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $stmt="SELECT full_name,modify_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[0]; + $LOGmodify_leads =$row[1]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +?> + + + +VICIDIAL ADMIN: Lead record modification + + +
+VICIDIAL ADMIN: Lead record modification
\n"; + +if ($end_call > 0) +{ + +$call_length = ($STARTtime - $call_began); + + ### insert a NEW record to the vicidial_closer_log table + $stmt="INSERT INTO vicidial_closer_log (lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed) values('" . mysql_real_escape_string($lead_id) . "','" . mysql_real_escape_string($list_id) . "','" . mysql_real_escape_string($campaign_id) . "','" . mysql_real_escape_string($parked_time) . "','" . mysql_real_escape_string($call_began) . "','$STARTtime','" . mysql_real_escape_string($call_length) . "','" . mysql_real_escape_string($status) . "','" . mysql_real_escape_string($phone_code) . "','" . mysql_real_escape_string($phone_number) . "','$PHP_AUTH_USER','" . mysql_real_escape_string($comments) . "','Y')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ### update the lead record in the vicidial_list table + $stmt="UPDATE vicidial_list set status='" . mysql_real_escape_string($status) . "',first_name='" . mysql_real_escape_string($first_name) . "',last_name='" . mysql_real_escape_string($last_name) . "',address1='" . mysql_real_escape_string($address1) . "',address2='" . mysql_real_escape_string($address2) . "',address3='" . mysql_real_escape_string($address3) . "',city='" . mysql_real_escape_string($city) . "',state='" . mysql_real_escape_string($state) . "',province='" . mysql_real_escape_string($province) . "',postal_code='" . mysql_real_escape_string($postal_code) . "',country_code='" . mysql_real_escape_string($country_code) . "',alt_phone='" . mysql_real_escape_string($alt_phone) . "',email='" . mysql_real_escape_string($email) . "',security_phrase='" . mysql_real_escape_string($security) . "',comments='" . mysql_real_escape_string($comments) . "' where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "information modified

\n"; + echo "\n"; + + if ( ($dispo != $status) and ($dispo == 'CBHOLD') ) + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='" . mysql_real_escape_string($lead_id) . "' and status='ACTIVE';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record inactivated: $lead_id
\n"; + } + if ( ($dispo != $status) and ($dispo == 'CALLBK') ) + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='" . mysql_real_escape_string($lead_id) . "' and status IN('ACTIVE','LIVE');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record inactivated: $lead_id
\n"; + } + + if ( ($dispo != $status) and ($status == 'DNC') ) + { + ### add lead to the internal DNC list + $stmt="INSERT INTO vicidial_dnc (phone_number) values('" . mysql_real_escape_string($phone_number) . "');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
Lead added to DNC List: $lead_id - $phone_number
\n"; + } + ### update last record in vicidial_agent_log and vicidial_log tables + if (($dispo != $status) and ($modify_logs > 0)) + { + $stmt="UPDATE vicidial_log set status='" . mysql_real_escape_string($status) . "' where lead_id='" . mysql_real_escape_string($lead_id) . "' order by call_date desc limit 1"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_agent_log set status='" . mysql_real_escape_string($status) . "' where lead_id='" . mysql_real_escape_string($lead_id) . "' order by agent_log_id desc limit 1"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + } + +} +else +{ + + if ($CBchangeUSERtoANY == 'YES') + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set recipient='ANYONE' where callback_id='" . mysql_real_escape_string($callback_id) . "';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record changed to ANYONE
\n"; + } + if ($CBchangeUSERtoUSER == 'YES') + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set user='" . mysql_real_escape_string($CBuser) . "' where callback_id='" . mysql_real_escape_string($callback_id) . "';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record user changed to $CBuser
\n"; + } + if ($CBchangeANYtoUSER == 'YES') + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set user='" . mysql_real_escape_string($CBuser) . "',recipient='USERONLY' where callback_id='" . mysql_real_escape_string($callback_id) . "';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record changed to USERONLY, user: $CBuser
\n"; + } + + + + $stmt="SELECT count(*) from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_count = $row[0]; + + if ($lead_count > 0) + { + + $stmt="select * from vicidial_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by uniqueid desc limit 500;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + $call_log = ''; + $log_campaign = ''; + while ($logs_to_print > $u) + { + $row=mysql_fetch_row($rslt); + if (strlen($log_campaign)<1) {$log_campaign = $row[3];} + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $u++; + $call_log .= "
"; + $call_log .= ""; + $call_log .= ""; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + + } + + $stmt="select * from vicidial_closer_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by closecallid desc limit 500;"; + $rslt=mysql_query($stmt, $link); + $Clogs_to_print = mysql_num_rows($rslt); + + $y=0; + $closer_log = ''; + $Clog_campaign = ''; + while ($Clogs_to_print > $y) + { + $row=mysql_fetch_row($rslt); + if (strlen($Clog_campaign)<1) {$Clog_campaign = $row[3];} + if (eregi("1$|3$|5$|7$|9$", $y)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $y++; + $closer_log .= ""; + $closer_log .= ""; + $closer_log .= ""; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + + } + + $stmt="SELECT * from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_id = "$row[0]"; + $dispo = "$row[3]"; + $tsr = "$row[4]"; + $vendor_id = "$row[5]"; + $list_id = "$row[7]"; + $campaign_id = "$row[8]"; + $phone_code = "$row[10]"; + $phone_number = "$row[11]"; + $title = "$row[12]"; + $first_name = "$row[13]"; # + $middle_initial = "$row[14]"; + $last_name = "$row[15]"; # + $address1 = "$row[16]"; # + $address2 = "$row[17]"; # + $address3 = "$row[18]"; # + $city = "$row[19]"; # + $state = "$row[20]"; # + $province = "$row[21]"; # + $postal_code = "$row[22]"; # + $country_code = "$row[23]"; # + $gender = "$row[24]"; + $date_of_birth = "$row[25]"; + $alt_phone = "$row[26]"; # + $email = "$row[27]"; # + $security = "$row[28]"; # + $comments = "$row[29]"; # + + echo "
Call information: $first_name $last_name - $phone_number

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
$u$row[4] $row[7] $row[8] $row[11] $row[3] $row[2] $row[1]
$y$row[4] $row[7] $row[8] $row[11] $row[3] $row[2] $row[1]   $row[14]
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + echo "\n"; + + echo "\n"; + echo "
Vendor ID: $vendor_id     Lead ID: $lead_id
Fronter: $tsr     List ID: $list_id
First Name:   \n"; + echo " Last Name:
Address 1 :
Address 2 :
Address 3 :
City :
State:   \n"; + echo " Postal Code:
Province :
Country :
Alt Phone :
Email :
Security :
Comments :
Disposition: (with $log_campaign statuses)
Modify agent and vicidial logs
\n"; + echo "


\n"; + + if ( ($dispo == 'CALLBK') or ($dispo == 'CBHOLD') ) + { + ### find any vicidial_callback records for this lead + $stmt="select * from vicidial_callbacks where lead_id='" . mysql_real_escape_string($lead_id) . "' and status IN('ACTIVE','LIVE') order by callback_id desc LIMIT 1;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $CB_to_print = mysql_num_rows($rslt); + $rowx=mysql_fetch_row($rslt); + + if ($CB_to_print>0) + { + if ($rowx[9] == 'USERONLY') + { + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "

\n"; + + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "New Callback Owner UserID: \n"; + echo "

\n"; + } + else + { + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "New Callback Owner UserID: \n"; + echo "

\n"; + } + } + else + { + echo "
No Callback records found
\n"; + } + } + + + + + + + } + else + { + echo "lead lookup FAILED for lead_id $lead_id       $NOW_TIME\n

\n"; +# echo "Close this window\n

\n"; + } + + + +echo "

\n"; + +echo "
\n"; + +echo "CALLS TO THIS LEAD:\n"; +echo "\n"; +echo "\n"; + + echo "$call_log\n"; + +echo "
# DATE/TIME LENGTH STATUS TSR CAMPAIGN LIST LEAD
\n"; +echo "

\n"; + +echo "CLOSER RECORDS FOR THIS LEAD:\n"; +echo "\n"; +echo "\n"; + + echo "$closer_log\n"; + +echo "
# DATE/TIME LENGTH STATUS TSR CAMPAIGN LIST LEAD WAIT
\n"; +echo "

\n"; + + +echo "RECORDINGS FOR THIS LEAD:\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from recording_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by recording_id desc limit 500;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) + { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $location = $row[11]; + if (strlen($location)>30) + {$locat = substr($location,0,27); $locat = "$locat...";} + else + {$locat = $location;} + if (eregi("http",$location)) + {$location = "$locat";} + else + {$location = $locat;} + $u++; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + + } + + +echo "
# LEADDATE/TIME SECONDS   RECIDFILENAMELOCATIONTSR
$u $row[12] $row[4] $row[8] $row[0]   $row[10] $location $row[13]
\n"; + + + + +} + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/admin_search_lead.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/admin_search_lead.php new file mode 100644 index 00000000..ff814159 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/admin_search_lead.php @@ -0,0 +1,225 @@ + LICENSE: GPLv2 +### +### AST GUI database administration search for lead info +### admin_modify_lead.php +# +# this is the administration lead information modifier screen, the administrator just needs to enter the leadID and then they can view and modify the information in the record for that lead +# +# changes: +# 60620-1055 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# - Changed results to multi-record +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} +if (isset($_GET["phone"])) {$phone=$_GET["phone"];} + elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); + + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and modify_leads='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name,modify_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[0]; + $LOGmodify_leads =$row[1]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +?> + + + +VICIDIAL ADMIN: Lead Search + +Lead Lookup + + +VICIDIAL ADMIN: Lead search
\n"; + + +if ( (!$vendor_id) and (!$phone) and (!$lead_id) ) + { + echo date("l F j, Y G:i:s A"); + echo "\n

\n"; + echo "
\n"; + echo "\n"; + echo "Please enter a:
Vendor ID(vendor lead code): or \n"; + echo "
a Home Phone Number: or\n"; + echo "
a lead ID:

\n"; + echo "
\n"; + echo "\n
\n"; + echo "\n"; + exit; + } + +else + { + + if ($vendor_id) + { + $stmt="SELECT * from vicidial_list where vendor_lead_code='" . mysql_real_escape_string($vendor_id) . "' order by modify_date desc limit 1000"; + } + else + { + if ($phone) + { + $stmt="SELECT * from vicidial_list where phone_number='" . mysql_real_escape_string($phone) . "' order by modify_date desc limit 1000"; + } + else + { + if ($lead_id) + { + $stmt="SELECT * from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "' order by modify_date desc limit 1000"; + } + else + { + print "ERROR: you must search for something! Go back and search for something"; + exit; + } + } + } + if ($DB) + { + echo "\n\n$stmt\n\n"; + } + + $rslt=mysql_query($stmt, $link); + $results_to_print = mysql_num_rows($rslt); + if ($results_to_print < 1) + { + echo date("l F j, Y G:i:s A"); + echo "\n

\n"; + echo "The search variables you entered are not active in the system

\n"; + echo "Please go back and double check the information you entered and submit again\n"; + echo "
\n"; + echo "\n"; + exit; + } + else + { + echo "RESULTS: $results_to_print

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + $o=0; + while ($results_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $o++; + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + echo "
#LEAD IDSTATUSVENDOR IDLAST AGENTLIST IDPHONENAMECITYSECURITYLAST CALL
$o$row[0]$row[3]$row[5]$row[4]$row[7]$row[11]$row[13] $row[15]$row[19]$row[28]$row[2]
\n"; + } + } + + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\nNEW SEARCH"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds"; + + +?> + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/count.htm b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/count.htm new file mode 100644 index 00000000..51f8a361 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/count.htm @@ -0,0 +1 @@ + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/dbconnect.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/dbconnect.php new file mode 100644 index 00000000..5247e166 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/dbconnect.php @@ -0,0 +1,49 @@ + LICENSE: GPLv2 +# +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"); +mysql_select_db("$VARDB_database"); + +$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 + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/group_hourly_stats.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/group_hourly_stats.php new file mode 100644 index 00000000..607f2fd7 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/group_hourly_stats.php @@ -0,0 +1,252 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60620-1014 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["date_with_hour"])) {$date_with_hour=$_GET["date_with_hour"];} + elseif (isset($_POST["date_with_hour"])) {$date_with_hour=$_POST["date_with_hour"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$date_with_hour_default = date("Y-m-d H"); +$date_no_hour_default = $TODAY; + +if (!isset($date_with_hour)) {$date_with_hour = $date_with_hour_default;} + $date_no_hour = $date_with_hour; + $date_no_hour = eregi_replace(" ([0-9]{2})",'',$date_no_hour); +if (!isset($begin_date)) {$begin_date = $TODAY;} +if (!isset($end_date)) {$end_date = $TODAY;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + +# $stmt="SELECT full_name from vicidial_users where user='$user';"; +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# $full_name = $row[0]; + + } + + + + +?> + + +VICIDIAL ADMIN: Group Hourly Stats +\n"; +?> + + +
+ + + + + += '" . mysql_real_escape_string($date_with_hour) . ":00:00' and call_date <= '" . mysql_real_escape_string($date_with_hour) . ":59:59' and user='$VDuser[$o]';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDtotal[$o] = "$row[0]"; + + $stmt="select count(*) from vicidial_log where call_date >= '" . mysql_real_escape_string($date_no_hour) . " 00:00:00' and call_date <= '" . mysql_real_escape_string($date_no_hour) . " 23:59:59' and user='$VDuser[$o]' and status='" . mysql_real_escape_string($status) . "';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDday[$o] = "$row[0]"; + + $stmt="select count(*) from vicidial_log where call_date >= '" . mysql_real_escape_string($date_with_hour) . ":00:00' and call_date <= '" . mysql_real_escape_string($date_with_hour) . ":59:59' and user='$VDuser[$o]' and status='" . mysql_real_escape_string($status) . "';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDcount[$o] = "$row[0]"; + $o++; + } + +echo "
" ?>   VICIDIAL ADMIN: Group Hourly Stats  
\n"; + +echo "
\n"; + +echo "TSR HOUR COUNTS: $group | $status | $date_with_hour | $date_no_hour\n"; + +echo "
\n"; +echo "\n"; + + $day_calls=0; + $hour_calls=0; + $total_calls=0; + $o=0; + while($o < $tsrs_to_print) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + $total_calls = ($total_calls + $VDtotal[$o]); + $hour_calls = ($hour_calls + $VDcount[$o]); + $day_calls = ($day_calls + $VDday[$o]); + + $o++; + } + +echo "\n"; + + +} + +echo "
TSR ID   $status   TOTAL CALLS   $status DAY    
$VDuser[$o] $VDname[$o] $VDcount[$o] $VDtotal[$o] $VDday[$o]MODIFY | STATS
TOTAL $status $hour_calls $total_calls $day_calls
\n"; +echo "

\n"; + + + echo "
Please enter the group you want to get hourly stats for:
\n"; + echo "\n"; + echo "group:
\n"; + echo "status:   (example: XFER)
\n"; + echo "date with hour:   (example: 2004-06-25 14)
\n"; + echo "\n"; + echo "


\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/help.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/help.gif new file mode 100644 index 00000000..5575d7c8 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/help.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/listloader.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/listloader.php new file mode 100644 index 00000000..b6e8ae5e --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/listloader.php @@ -0,0 +1,926 @@ + LICENSE: GPLv2 +# +# AST Web GUI lead loader from formatted file +# +# CHANGES +# 50602-1640 - First version created by Joe Johnson +# 51128-1108 - Removed PHP global vars requirement +# 60421-1043 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60616-1006 - added listID override and gmt_offset lookup while loading +# 60619-1652 - Added variable filtering to eliminate SQL injection attack threat +# 60822-1105 - fixed for nonwritable directories +# 60906-1059 - added filter of non-digits in alt_phone field +# 61110-1222 - added new USA-Canada DST scheme and Brazil DST scheme +# 61128-1046 - added postal code GMT lookup and duplicate check options +# 70205-1703 - Defaulted phone_code to 1 if not populated +# 70417-1059 - Fixed default phone_code bug +# +# make sure vicidial_list exists and that your file follows the formatting correctly. This page does not dedupe or do any other lead filtering actions yet at this time. +# + +$version = '2.0.3'; +$build = '770417-1059'; + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$leadfile=$_FILES["leadfile"]; + $LF_orig = $_FILES['leadfile']['name']; + $LF_path = $_FILES['leadfile']['tmp_name']; +$submit_file=$_GET["submit_file"]; if (!$submit_file) {$submit_file=$_POST["submit_file"];} +$list_id_override=$_GET["list_id_override"]; if (!$list_id_override) {$list_id_override=$_POST["list_id_override"];} + $list_id_override = (preg_replace("/\D/","",$list_id_override)); +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["dupcheck"])) {$dupcheck=$_GET["dupcheck"];} + elseif (isset($_POST["dupcheck"])) {$dupcheck=$_POST["dupcheck"];} +if (isset($_GET["postalgmt"])) {$postalgmt=$_GET["postalgmt"];} + elseif (isset($_POST["postalgmt"])) {$postalgmt=$_POST["postalgmt"];} + + +#$DB=1; +#$DBX=1; + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); +$list_id_override = ereg_replace("[^0-9]","",$list_id_override); + + +$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://';} +$admDIR = "$HTTPprotocol$server_name$script_name"; +$admDIR = eregi_replace('listloader.php','',$admDIR); +$admSCR = 'admin.php'; +$NWB = "   \"HELP\""; + + +$secX = date("U"); +$hour = date("H"); +$min = date("i"); +$sec = date("s"); +$mon = date("m"); +$mday = date("d"); +$year = date("Y"); +$isdst = date("I"); +$Shour = date("H"); +$Smin = date("i"); +$Ssec = date("s"); +$Smon = date("m"); +$Smday = date("d"); +$Syear = date("Y"); +$pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; +$inSD = $pulldate0; +$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + ### Grab Server GMT value from the database + $stmt="SELECT local_gmt FROM servers where server_ip = '$server_ip';"; + $rslt=mysql_query($stmt, $link); + $gmt_recs = mysql_num_rows($rslt); + if ($gmt_recs > 0) + { + $row=mysql_fetch_row($rslt); + $DBSERVER_GMT = "$row[0]"; + if (strlen($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;} + if ($isdst) {$SERVER_GMT++;} + } + else + { + $SERVER_GMT = date("O"); + $SERVER_GMT = eregi_replace("\+","",$SERVER_GMT); + $SERVER_GMT = ($SERVER_GMT + 0); + $SERVER_GMT = ($SERVER_GMT / 100); + } + + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + +#if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";} + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + +?> + + + + + + method=post enctype="multipart/form-data"> +
+ + + + + + + + + + + + + + + + + + + + + +
Load leads from this file:
List ID Override: (numbers only or leave blank for values in the file)
Lead Duplicate Check:
Lead Time Zone Lookup:
CLICK HERE TO GO TO THE SUPER LEAD LOADER (BETA VERSION)     BACK TO ADMIN
+ +document.forms[0].leadfile.disabled=true; document.forms[0].submit_file.disabled=true; document.forms[0].reload_page.disabled=true;"; + flush(); + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"); + $lead_file = "./vicidial_temp_file.txt"; + } + else + { + $lead_file = "$LF_path"; + } + $file=fopen("$lead_file", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + $pulldate=date("Y-m-d H:i:s"); + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + + if (count($field_check)>=5) { + flush(); + $file=fopen("$lead_file", "r"); + $total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list=''; + print "
Processing $delim_name-delimited file... ($tab_count|$pipe_count)\n"; + + if (strlen($list_id_override)>0) + { + print "

LIST ID OVERRIDE FOR THIS FILE: $list_id_override

"; + } + + while (!feof($file)) { + $record++; + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + + if (strlen($buffer)>0) { + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + $vendor_lead_code = $row[0]; + $source_code = $row[1]; + $source_id=$source_code; + $list_id = $row[2]; + $phone_code = eregi_replace("[^0-9]", "", $row[3]); + $phone_number = eregi_replace("[^0-9]", "", $row[4]); + $USarea = substr($phone_number, 0, 3); + $title = $row[5]; + $first_name = $row[6]; + $middle_initial = $row[7]; + $last_name = $row[8]; + $address1 = $row[9]; + $address2 = $row[10]; + $address3 = $row[11]; + $city = $row[12]; + $state = $row[13]; + $province = $row[14]; + $postal_code = $row[15]; + $country = $row[16]; + $gender = $row[17]; + $date_of_birth = $row[18]; + $alt_phone = eregi_replace("[^0-9]", "", $row[19]); + $email = $row[20]; + $security_phrase = $row[21]; + $comments = trim($row[22]); + + if (strlen($list_id_override)>0) + { + # print "

LIST ID OVERRIDE FOR THIS FILE: $list_id_override

"; + $list_id = $list_id_override; + } + + ##### Check for duplicate phone numbers in vicidial_list table ##### + if (eregi("DUP",$dupcheck)) + { + $dup_lead=0; + $stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_lead = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + if ( (strlen($phone_number)>6) and ($dup_lead<1) ) + { + $US='_'; + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user = ""; + $gmt_offset = '0'; + $called_since_last_reset='N'; + $phone_list .= "$phone_number$US$list_id|"; + + if (strlen($phone_code)<1) {$phone_code = '1';} + + $postalgmt_found=0; + if ( (eregi("POSTAL",$postalgmt)) && (strlen($postal_code)>4) ) + { + if (preg_match('/^1$/', $phone_code)) + { + $stmt="select * from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[2]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[3]; + $dst_range = $row[4]; + $PC_processed++; + $postalgmt_found++; + $post++; + } + } + } + if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =='1') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### MEXICO ### + if ($phone_code =='52') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### AUSTRALIA ### + if ($phone_code =='61') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $PC_processed++; + $stmt="select * from vicidial_phone_codes where country_code='$phone_code';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + } + + ### Find out if DST to raise the gmt offset ### + $AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); + $AC_localtime = mktime(($Shour + $AC_GMT_diff), $Smin, $Ssec, $Smon, $Smday, $Syear); + $hour = date("H",$AC_localtime); + $min = date("i",$AC_localtime); + $sec = date("s",$AC_localtime); + $mon = date("m",$AC_localtime); + $mday = date("d",$AC_localtime); + $wday = date("w",$AC_localtime); + $year = date("Y",$AC_localtime); + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + if ( (!$AC_processed) and ($dst_range == 'SSM-FSN') ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + #********************************************************************** + # SSM-FSN + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on Second Sunday March to First Sunday November at 2 am. + # INPUTS: + # mm INTEGER Month. + # dd INTEGER Day of the month. + # ns INTEGER Seconds into the day. + # dow INTEGER Day of week (0=Sunday, to 6=Saturday) + # OPTIONAL INPUT: + # timezone INTEGER hour difference UTC - local standard time + # (DEFAULT is blank) + # make calculations based on UTC time, + # which means shift at 10:00 UTC in April + # and 9:00 UTC in October + # OUTPUT: + # INTEGER 1 = DST, 0 = not DST + # + # S M T W T F S + # 1 2 3 4 5 6 7 + # 8 9 10 11 12 13 14 + #15 16 17 18 19 20 21 + #22 23 24 25 26 27 28 + #29 30 31 + # + # S M T W T F S + # 1 2 3 4 5 6 + # 7 8 9 10 11 12 13 + #14 15 16 17 18 19 20 + #21 22 23 24 25 26 27 + #28 29 30 31 + # + #********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; + } elseif ($mm >= 4 and $mm <= 10) { + $USACAN_DST=1; + } elseif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; + } elseif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } + } else { + $USACAN_DST=0; + } + } elseif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; + } elseif ($dd < ($dow+1)) { + $USACAN_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } + } else { + $USACAN_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + #********************************************************************** + # FSA-LSO + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in April and last Sunday in October at 2 am. + #********************************************************************** + + $NA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $NA_DST=0; + } elseif ($mm >= 5 and $mm <= 9) { + $NA_DST=1; + } elseif ($mm == 4) { + if ($dd > 7) { + $NA_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $NA_DST=0; + } else { + $NA_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $NA_DST=0; + } else { + $NA_DST=1; + } + } + } else { + $NA_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $NA_DST=1; + } elseif ($dd < ($dow+25)) { + $NA_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $NA_DST=1; + } else { + $NA_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $NA_DST=1; + } else { + $NA_DST=0; + } + } + } else { + $NA_DST=0; + } + } # end of month checks + + if ($DBX) {print " DST: $NA_DST\n";} + if ($NA_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'LSM-LSO') ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in March and last Sunday in October at 1 am. + #********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; + } elseif ($mm >= 4 and $mm <= 9) { + $GBR_DST=1; + } elseif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; + } elseif ($dd < ($dow+25)) { + $GBR_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } + } else { + $GBR_DST=1; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; + } elseif ($dd < ($dow+25)) { + $GBR_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } + } else { + $GBR_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) and ($dst_range == 'LSO-LSM') ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUS_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; + } elseif ($dd < ($dow+25)) { + $AUS_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } + } else { + $AUS_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; + } elseif ($dd < ($dow+25)) { + $AUS_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } + } else { + $AUS_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-LSM') ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + #********************************************************************** + # TASMANIA ONLY + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUST_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; + } elseif ($dd < ($dow+25)) { + $AUST_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } + } else { + $AUST_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $AUST_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } + } else { + $AUST_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and third Sunday in March at 1 am. + #********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $NZL_DST=0; + } elseif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; + } elseif ($dd < ($dow+14)) { + $NZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } + } else { + $NZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $NZL_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } + } else { + $NZL_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + #********************************************************************** + # TSO-LSF + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. Brazil + # Based on Third Sunday October to Last Sunday February at 1 am. + #********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; + } elseif ($mm >= 3 and $mm <= 9) { + $BZL_DST=0; + } elseif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; + } elseif ($dd < ($dow+22)) { + $BZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } + } else { + $BZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; + } elseif ($dd < ($dow+22)) { + $BZL_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } + } else { + $BZL_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } + else + { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead\n";} + $bad++; + } + $total++; + if ($total%100==0) + { + print ""; + usleep(1000); + flush(); + } + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
DUPLICATE: $dup       POSTAL MATCH: $post
"; + + } else { + print "
ERROR: The file does not have the required number of fields to process it.
"; + } + print ""; +} else if (filesize($leadfile)>8388608) { + print "
ERROR: File exceeds the 8MB limit.
"; +} +?> + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/listloader.pl b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/listloader.pl new file mode 100644 index 00000000..d926368b --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/listloader.pl @@ -0,0 +1,1084 @@ +#!/usr/bin/perl + +### listloader.pl version 0.4 *DBI-version* +### +### Copyright (C) 2007 Matt Florell,Joe Johnson LICENSE: GPLv2 +### +# +# +# CHANGES +# 60616-1548 - Added listID override feature to force all leads into same list +# - Added gmt_offset_now lookup for each lead +# 60811-1232 - Changed to DBI +# 60811-1329 - changed to use /etc/astguiclient.conf for configs +# 60822-1121 - fixed for nonwritable directories +# 60906-1058 - added filter of non-digits in alt_phone field +# 61110-1229 - added new USA-Canada DST scheme and Brazil DST scheme +# 61128-1215 - added postal code GMT lookup and duplicate check options +# 70205-1703 - Defaulted phone_code to 1 if not populated +# 70417-1059 - Fixed default phone_code bug +# 70510-1518 - Added campaign and system duplicate check and phonecode override +# + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help|-h/i) + { + print "allowed run time options:\n [-forcelistid=1234] = overrides the listID given in the file with the 1234\n [-h] = this help screen\n\n"; + + exit; + } + else + { + if ($args =~ /-duplicate-check/i) + {$dupcheck=1;} + if ($args =~ /-duplicate-campaign-check/i) + {$dupcheckcamp=1;} + if ($args =~ /-duplicate-system-check/i) + {$dupchecksys=1;} + if ($args =~ /-postal-code-gmt/i) + {$postalgmt=1;} + if ($args =~ /--forcelistid=/i) + { + @data_in = split(/--forcelistid=/,$args); + $forcelistid = $data_in[1]; + $forcelistid =~ s/ .*//gi; + print "\n----- FORCE LISTID OVERRIDE: $forcelistid -----\n\n"; + } + else + {$forcelistid = '';} + + if ($args =~ /--forcephonecode=/i) + { + @data_in = split(/--forcephonecode=/,$args); + $forcephonecode = $data_in[1]; + $forcephonecode =~ s/ .*//gi; + print "\n----- FORCE PHONECODE OVERRIDE: $forcephonecode -----\n\n"; + } + else + {$forcephonecode = '';} + + if ($args =~ /--lead-file=/i) + { + @data_in = split(/--lead-file=/,$args); + $lead_file = $data_in[1]; + $lead_file =~ s/ .*//gi; + # print "\n----- LEAD FILE: $lead_file -----\n\n"; + } + else + {$lead_file = './vicidial_temp_file.xls';} + } +} +### end parsing run-time options ### + + +use Spreadsheet::ParseExcel; +use Time::Local; +use DBI; + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + +$|=0; +$secX = time(); + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($hour < 10) {$hour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +$pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; +$pulldate="$year-$mon-$mday $hour:$min:$sec"; +$inSD = $pulldate0; +$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + + ### Grab Server values from the database + $stmtA = "SELECT local_gmt FROM servers where server_ip = '$server_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBSERVER_GMT = "$aryA[0]"; + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + $rec_count++; + } + $sthA->finish(); + + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + +if ($isdst) {$LOCAL_GMT_OFF++;} +if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";} + + + +$total=0; $good=0; $bad=0; +print "
Processing Excel file...\n"; +open(STMT_FILE, "> $PATHlogs/listloader_stmts.txt"); + +$oBook = Spreadsheet::ParseExcel::Workbook->Parse("$lead_file"); +my($iR, $iC, $oWkS, $oWkC); + +foreach $oWkS (@{$oBook->{Worksheet}}) { + for($iR = 0 ; defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow} ; $iR++) { + + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user = ""; + $oWkC = $oWkS->{Cells}[$iR][0]; + if ($oWkC) {$vendor_lead_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][1]; + if ($oWkC) {$source_code=$oWkC->Value; } + $source_id=$source_code; + $oWkC = $oWkS->{Cells}[$iR][2]; + if ($oWkC) {$list_id=$oWkC->Value; } + $gmt_offset = '0'; + $called_since_last_reset='N'; + $oWkC = $oWkS->{Cells}[$iR][3]; + if ($oWkC) {$phone_code=$oWkC->Value; } + $phone_code=~s/[^0-9]//g; + $oWkC = $oWkS->{Cells}[$iR][4]; + if ($oWkC) {$phone_number=$oWkC->Value; } + $phone_number=~s/[^0-9]//g; + $USarea = substr($phone_number, 0, 3); + $oWkC = $oWkS->{Cells}[$iR][5]; + if ($oWkC) {$title=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][6]; + if ($oWkC) {$first_name=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][7]; + if ($oWkC) {$middle_initial=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][8]; + if ($oWkC) {$last_name=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][9]; + if ($oWkC) {$address1=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][10]; + if ($oWkC) {$address2=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][11]; + if ($oWkC) {$address3=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][12]; + if ($oWkC) {$city=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][13]; + if ($oWkC) {$state=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][14]; + if ($oWkC) {$province=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][15]; + if ($oWkC) {$postal_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][16]; + if ($oWkC) {$country=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][17]; + if ($oWkC) {$gender=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][18]; + if ($oWkC) {$date_of_birth=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][19]; + if ($oWkC) {$alt_phone=$oWkC->Value; } + $alt_phone=~s/[^0-9]//g; + $oWkC = $oWkS->{Cells}[$iR][20]; + if ($oWkC) {$email=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][21]; + if ($oWkC) {$security_phrase=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][22]; + if ($oWkC) {$comments=$oWkC->Value; } + $comments=~s/^\s*(.*?)\s*$/$1/; + + if (length($forcelistid) > 0) + { + $list_id = $forcelistid; # set list_id to override value + } + if (length($forcephonecode) > 0) + { + $phone_code = $forcephonecode; # set phone_code to override value + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if ($dupchecksys > 0) + { + $dup_lead=0; + $stmtA = "select count(*) from vicidial_list where phone_number='$phone_number';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $dup_lead = $aryA[0]; + $dup_lead_list=$list_id; + } + $sthA->finish(); + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if ($dupcheck > 0) + { + $dup_lead=0; + $stmtA = "select list_id from vicidial_list where phone_number='$phone_number' and list_id='$list_id' limit 1;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $dup_lead_list = $aryA[0]; + $dup_lead++; + } + $sthA->finish(); + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if ($dupcheckcamp > 0) + { + $dup_lead=0; + $dup_lists=''; + + $stmtA = "select count(*) from vicidial_lists where list_id='$list_id';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + @aryA = $sthA->fetchrow_array; + $ci_recs = $aryA[0]; + $sthA->finish(); + if ($ci_recs > 0) + { + $stmtA = "select campaign_id from vicidial_lists where list_id='$list_id';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + @aryA = $sthA->fetchrow_array; + $dup_camp = $aryA[0]; + $sthA->finish(); + + $stmtA = "select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $dup_lists .= "'$aryA[0]',"; + $rec_count++; + } + $sthA->finish(); + + chop($dup_lists); + $stmtA = "select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $dup_lead_list = "'$aryA[0]',"; + $rec_count++; + $dup_lead=1; + } + $sthA->finish(); + } + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + + if ( (length($phone_number)>6) && ($dup_lead < 1) ) + { + $phone_list .= "$phone_number$US$list_id|"; + $postalgmt_found=0; + if (length($phone_code)<1) {$phone_code = '1';} + + if ( ($postalgmt > 0) && (length($postal_code)>4) ) + { + if ($phone_code =~ /^1$/) + { + $stmtA = "select * from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[2]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[3]; + $dst_range = $aryA[4]; + $PC_processed++; + $rec_count++; + $postalgmt_found++; + if ($DBX) {print " Postal GMT record found for $postal_code: |$gmt_offset|$dst|$dst_range|\n";} + } + $sthA->finish(); + } + } + if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =~ /^1$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### MEXICO ### + if ($phone_code =~ /^52$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### AUSTRALIA ### + if ($phone_code =~ /^61$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + } + + ### Find out if DST to raise the gmt offset ### + $AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); + $AC_localtime = ($secX + (3600 * $AC_GMT_diff)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($AC_localtime); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + + if ( (!$AC_processed) && ($dst_range =~ /SSM-FSN/) ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + &USACAN_dstcalc; + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSA-LSO/) ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + &NA_dstcalc; + if ($DBX) {print " DST: $NA_DST\n";} + if ($NA_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /LSM-LSO/) ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + &GBR_dstcalc; + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /LSO-LSM/) ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + &AUS_dstcalc; + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSO-LSM/) ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + &AUST_dstcalc; + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSO-TSM/) ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + &NZL_dstcalc; + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /TSO-LSF/) ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + &BZL_dstcalc; + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$area_GMT++;} + $AC_processed++; + } + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $affected_rows = $dbhA->do($stmtZ); + print STMT_FILE $stmtZ."\r\n"; + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| $dup_lead_list\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + sleep(1); +# flush(); + } + } +} + +if ($multi_insert_counter > 0) { + $stmtZ = "INSERT INTO vicidial_list values ".substr($multistmt, 0, -1).";"; + $affected_rows = $dbhA->do($stmtZ); + print STMT_FILE $stmtZ."\r\n"; +} + +print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + +exit; + + + + + + +sub USACAN_dstcalc { +#********************************************************************** +# SSM-FSN +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on Second Sunday March to First Sunday November at 2 am. +# INPUTS: +# mm INTEGER Month. +# dd INTEGER Day of the month. +# ns INTEGER Seconds into the day. +# dow INTEGER Day of week (0=Sunday, to 6=Saturday) +# OPTIONAL INPUT: +# timezone INTEGER hour difference UTC - local standard time +# (DEFAULT is blank) +# make calculations based on UTC time, +# which means shift at 10:00 UTC in April +# and 9:00 UTC in October +# OUTPUT: +# INTEGER 1 = DST, 0 = not DST +# +# S M T W T F S +# 1 2 3 4 5 6 7 +# 8 9 10 11 12 13 14 +#15 16 17 18 19 20 21 +#22 23 24 25 26 27 28 +#29 30 31 +# +# S M T W T F S +# 1 2 3 4 5 6 +# 7 8 9 10 11 12 13 +#14 15 16 17 18 19 20 +#21 22 23 24 25 26 27 +#28 29 30 31 +# +#********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; return 0; + } elsif ($mm >= 4 && $mm <= 10) { + $USACAN_DST=1; return 1; + } elsif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; return 1; + } elsif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; return 0; + } else { + $USACAN_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $USACAN_DST=0; return 0; + } else { + $USACAN_DST=1; return 1; + } + } + } else { + $USACAN_DST=0; return 0; + } + } elsif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; return 0; + } elsif ($dd < ($dow+1)) { + $USACAN_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; return 1; + } else { + $USACAN_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; return 1; + } else { + $USACAN_DST=0; return 0; + } + } + } else { + $USACAN_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub NA_dstcalc { +#********************************************************************** +# FSA-LSO +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in April and last Sunday in October at 2 am. +#********************************************************************** + + $NA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $NA_DST=0; return 0; + } elsif ($mm >= 5 && $mm <= 9) { + $NA_DST=1; return 1; + } elsif ($mm == 4) { + if ($dd > 7) { + $NA_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $NA_DST=0; return 0; + } else { + $NA_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $NA_DST=0; return 0; + } else { + $NA_DST=1; return 1; + } + } + } else { + $NA_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $NA_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $NA_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $NA_DST=1; return 1; + } else { + $NA_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 7200) { + $NA_DST=1; return 1; + } else { + $NA_DST=0; return 0; + } + } + } else { + $NA_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub GBR_dstcalc { +#********************************************************************** +# LSM-LSO +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in March and last Sunday in October at 1 am. +#********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; return 0; + } elsif ($mm >= 4 && $mm <= 9) { + $GBR_DST=1; return 1; + } elsif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $GBR_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; return 0; + } else { + $GBR_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; return 0; + } else { + $GBR_DST=1; return 1; + } + } + } else { + $GBR_DST=1; return 1; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $GBR_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; return 1; + } else { + $GBR_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; return 1; + } else { + $GBR_DST=0; return 0; + } + } + } else { + $GBR_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub AUS_dstcalc { +#********************************************************************** +# LSO-LSM +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in October and last Sunday in March at 1 am. +#********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $AUS_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $AUS_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; return 1; + } else { + $AUS_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; return 1; + } else { + $AUS_DST=0; return 0; + } + } + } else { + $AUS_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $AUS_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; return 0; + } else { + $AUS_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; return 0; + } else { + $AUS_DST=1; return 1; + } + } + } else { + $AUS_DST=1; return 1; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub AUST_dstcalc { +#********************************************************************** +# FSO-LSM +# TASMANIA ONLY +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and last Sunday in March at 1 am. +#********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $AUST_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $AUST_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; return 1; + } else { + $AUST_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; return 1; + } else { + $AUST_DST=0; return 0; + } + } + } else { + $AUST_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd >= 8) { + $AUST_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $AUST_DST=0; return 0; + } else { + $AUST_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $AUST_DST=0; return 0; + } else { + $AUST_DST=1; return 1; + } + } + } else { + $AUST_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub NZL_dstcalc { +#********************************************************************** +# FSO-TSM +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and third Sunday in March at 1 am. +#********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $NZL_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; return 1; + } elsif ($dd < ($dow+14)) { + $NZL_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; return 1; + } else { + $NZL_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; return 1; + } else { + $NZL_DST=0; return 0; + } + } + } else { + $NZL_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd >= 8) { + $NZL_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $NZL_DST=0; return 0; + } else { + $NZL_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $NZL_DST=0; return 0; + } else { + $NZL_DST=1; return 1; + } + } + } else { + $NZL_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub BZL_dstcalc { +#********************************************************************** +# TSO-LSF +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. Brazil +# Based on Third Sunday October to Last Sunday February at 1 am. +#********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; return 1; + } elsif ($mm >= 3 && $mm <= 9) { + $BZL_DST=0; return 0; + } elsif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; return 1; + } elsif ($dd < ($dow+22)) { + $BZL_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; return 1; + } else { + $BZL_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; return 1; + } else { + $BZL_DST=0; return 0; + } + } + } else { + $BZL_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; return 0; + } elsif ($dd < ($dow+22)) { + $BZL_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; return 0; + } else { + $BZL_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; return 0; + } else { + $BZL_DST=1; return 1; + } + } + } else { + $BZL_DST=1; return 1; + } + } # end of month checks +} # end of subroutine dstcalc diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/listloaderMAIN.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/listloaderMAIN.php new file mode 100644 index 00000000..bb292c36 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/listloaderMAIN.php @@ -0,0 +1,86 @@ + LICENSE: GPLv2 +# +# this is the main frame page for the lead loading section. This is where you +# would upload a file and have it inserted into vicidial_list +# +# changes: +# 60620-1149 - Added variable filtering to eliminate SQL injection attack threat +# 60822-1105 - fixed for nonwritable directories +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_datetime = $STARTtime; + +$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +if ($WeBRooTWritablE > 0) {$fp = fopen ("./project_auth_entries.txt", "a");} +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-LEAD-LOADER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT load_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGload_leads =$row[0]; + + if ($LOGload_leads < 1) + { + echo "You do not have permissions to load leads\n"; + exit; + } + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "LIST_LOAD|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "LIST_LOAD|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +?> + +VICIDIAL: Lead Loader Module + + + + + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/listloader_rowdisplay.pl b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/listloader_rowdisplay.pl new file mode 100644 index 00000000..3f8695c0 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/listloader_rowdisplay.pl @@ -0,0 +1,153 @@ +#!/usr/bin/perl + +### listloader_rowdisplay.pl version 0.2 *DBI-version* +### +### Copyright (C) 2006 Matt Florell,Joe Johnson LICENSE: GPLv2 +### +# +# CHANGES +# +# 60811-1232 - Changed to DBI +# 60811-1329 - changed to use /etc/astguiclient.conf for configs +# + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help|-h/i) + { + print "allowed run time options:\n [-forcelistid=1234] = overrides the listID given in the file with the 1234\n [-h] = this help screen\n\n"; + + exit; + } + else + { + if ($args =~ /-duplicate-check/i) + {$dupcheck=1;} + if ($args =~ /-postal-code-gmt/i) + {$postalgmt=1;} + if ($args =~ /--lead-file=/i) + { + @data_in = split(/--lead-file=/,$args); + $lead_file = $data_in[1]; + $lead_file =~ s/ .*//gi; + # print "\n----- LEAD FILE: $lead_file -----\n\n"; + } + else + {$lead_file = './vicidial_temp_file.xls';} + } +} +### end parsing run-time options ### + +use Spreadsheet::ParseExcel; +use Time::Local; +use DBI; + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + +$oBook = Spreadsheet::ParseExcel::Workbook->Parse("$lead_file"); +my($iR, $iC, $oWkS, $oWkC); +$var_str=""; + +foreach $oWkS (@{$oBook->{Worksheet}}) { + for(my $iC = $oWkS->{MinCol} ; defined $oWkS->{MaxCol} && $iC <= $oWkS->{MaxCol} ; $iC++) { + $oWkC = $oWkS->{Cells}[0][$iC]; + if ($oWkC) { + $var_str.=$oWkC->Value."|"; + } else { + $var_str.="|"; + } + } +} + +@xls_row=split(/\|/, $var_str); + + +$stmtA = "select vendor_lead_code, source_id, list_id, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments from vicidial_list limit 1;"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + my $names = $sthA->{'NAME'}; + my $numFields = $sthA->{'NUM_OF_FIELDS'}; + for (my $i = 0; $i < $numFields; $i++) + { + # printf("%s%s", $i ? "," : "", $$names[$i]); + # printf("%s%s", $i ? "," : "", $$ref[$i]); + + $field_name=uc($$names[$i]); + $field_name=~s/\_/ /g; + print "
".$field_name.": \r\n"; + print " \r\n"; + print "
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Load leads from this file:
List ID Override: (numbers only or leave blank for values in the file)
Phone Code Override: (numbers only or leave blank for values in the file)
File layout to use:Standard VICIDIAL    Custom layout
Lead Duplicate Check:
Lead Time Zone Lookup:
        
        BACK TO ADMINLIST LOADER-     VERSION:     BUILD:    
+ + +document.forms[0].leadfile.disabled=true;document.forms[0].list_id_override.disabled=true;document.forms[0].phone_code_override.disabled=true; document.forms[0].submit_file.disabled=true; document.forms[0].reload_page.disabled=true;"; + flush(); + $total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list=''; + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) { + # copy($leadfile, "./vicidial_temp_file.txt"); + $file=fopen("$lead_file", "r"); + if ($WeBRooTWritablE > 0) + { + $stmt_file=fopen("listloader_stmts.txt", "w"); + } + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + + if (count($field_check)>=5) { + flush(); + $file=fopen("$lead_file", "r"); + print "
Processing $delim_name-delimited file...\n"; + + if (strlen($list_id_override)>0) + { + print "

LIST ID OVERRIDE FOR THIS FILE: $list_id_override

"; + } + + if (strlen($phone_code_override)>0) + { + print "

PHONE CODE OVERRIDE FOR THIS FILE: $phone_code_override

"; + } + + while (!feof($file)) { + $record++; + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + + if (strlen($buffer)>0) { + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[$vendor_lead_code_field]; + $source_code = $row[$source_id_field]; + $source_id=$source_code; + $list_id = $row[$list_id_field]; + $gmt_offset = '0'; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[$phone_code_field]); + $phone_number = eregi_replace("[^0-9]", "", $row[$phone_number_field]); + $USarea = substr($phone_number, 0, 3); + $title = $row[$title_field]; + $first_name = $row[$first_name_field]; + $middle_initial = $row[$middle_initial_field]; + $last_name = $row[$last_name_field]; + $address1 = $row[$address1_field]; + $address2 = $row[$address2_field]; + $address3 = $row[$address3_field]; + $city =$row[$city_field]; + $state = $row[$state_field]; + $province = $row[$province_field]; + $postal_code = $row[$postal_code_field]; + $country_code = $row[$country_code_field]; + $gender = $row[$gender_field]; + $date_of_birth = $row[$date_of_birth_field]; + $alt_phone = eregi_replace("[^0-9]", "", $row[$alt_phone_field]); + $email = $row[$email_field]; + $security_phrase = $row[$security_phrase_field]; + $comments = trim($row[$comments_field]); + + if (strlen($list_id_override)>0) + { + # print "

LIST ID OVERRIDE FOR THIS FILE: $list_id_override

"; + $list_id = $list_id_override; + } + if (strlen($phone_code_override)>0) + { + $phone_code = $phone_code_override; + } + + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if (eregi("DUPCAMP",$dupcheck)) + { + $dup_lead=0; + $dup_lists=''; + $stmt="select campaign_id from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $ci_recs = mysql_num_rows($rslt); + if ($ci_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_camp = $row[0]; + + $stmt="select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $rslt=mysql_query($stmt, $link); + $li_recs = mysql_num_rows($rslt); + if ($li_recs > 0) + { + $L=0; + while ($li_recs > $L) + { + $row=mysql_fetch_row($rslt); + $dup_lists .= "'$row[0]',"; + $L++; + } + $dup_lists = eregi_replace(",$",'',$dup_lists); + + $stmt="select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + } + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if (eregi("DUPSYS",$dupcheck)) + { + $dup_lead=0; + $stmt="select list_id from vicidial_list where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if (eregi("DUPLIST",$dupcheck)) + { + $dup_lead=0; + $stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_lead = $row[0]; + $dup_lead_list = $list_id; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + if ( (strlen($phone_number)>6) and ($dup_lead<1) ) + { + if (strlen($phone_code)<1) {$phone_code = '1';} + + $US='_'; + $phone_list .= "$phone_number$US$list_id|"; + + $gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code); + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead $dup_lead_list\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } else { + print "
ERROR: The file does not have the required number of fields to process it.
"; + } + } else if (!eregi(".csv", $leadfile_name)) { + # copy($leadfile, "./vicidial_temp_file.xls"); + $file=fopen("$lead_file", "r"); + + print "
Processing Excel file... \n"; + if (strlen($list_id_override)>0) + { + print "

LIST ID OVERRIDE FOR THIS FILE: $list_id_override

\n"; + } + if (strlen($phone_code_override)>0) + { + print "

PHONE CODE OVERRIDE FOR THIS FILE: $phone_code_override

\n"; + } + # print "|$WeBServeRRooT/vicidial/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field, --forcelistid=$list_id_override --lead_file=$lead_file|"; + $dupcheckCLI=''; $postalgmtCLI=''; + if (eregi("DUPLIST",$dupcheck)) {$dupcheckCLI='--duplicate-check';} + if (eregi("DUPCAMP",$dupcheck)) {$dupcheckCLI='--duplicate-campaign-check';} + if (eregi("DUPSYS",$dupcheck)) {$dupcheckCLI='--duplicate-system-check';} + if (eregi("POSTAL",$postalgmt)) {$postalgmtCLI='--postal-code-gmt';} + passthru("$WeBServeRRooT/vicidial/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field, --forcelistid=$list_id_override --forcephonecode=$phone_code_override --lead-file=$lead_file $postalgmtCLI $dupcheckCLI"); + } else { + # copy($leadfile, "./vicidial_temp_file.csv"); + $file=fopen("$lead_file", "r"); + + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + print "
Processing CSV file... \n"; + if (strlen($list_id_override)>0) + { + print "

LIST ID OVERRIDE FOR THIS FILE: $list_id_override

"; + } + + if (strlen($phone_code_override)>0) + { + print "

PHONE CODE OVERRIDE FOR THIS FILE: $phone_code_override

"; + } + + while($row=fgetcsv($file, 1000, ",")) { + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[$vendor_lead_code_field]; + $source_code = $row[$source_id_field]; + $source_id=$source_code; + $list_id = $row[$list_id_field]; + $gmt_offset = '0'; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[$phone_code_field]); + $phone_number = eregi_replace("[^0-9]", "", $row[$phone_number_field]); + $USarea = substr($phone_number, 0, 3); + $title = $row[$title_field]; + $first_name = $row[$first_name_field]; + $middle_initial = $row[$middle_initial_field]; + $last_name = $row[$last_name_field]; + $address1 = $row[$address1_field]; + $address2 = $row[$address2_field]; + $address3 = $row[$address3_field]; + $city =$row[$city_field]; + $state = $row[$state_field]; + $province = $row[$province_field]; + $postal_code = $row[$postal_code_field]; + $country_code = $row[$country_code_field]; + $gender = $row[$gender_field]; + $date_of_birth = $row[$date_of_birth_field]; + $alt_phone = eregi_replace("[^0-9]", "", $row[$alt_phone_field]); + $email = $row[$email_field]; + $security_phrase = $row[$security_phrase_field]; + $comments = trim($row[$comments_field]); + + if (strlen($list_id_override)>0) + { + $list_id = $list_id_override; + } + if (strlen($phone_code_override)>0) + { + $phone_code = $phone_code_override; + } + + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if (eregi("DUPCAMP",$dupcheck)) + { + $dup_lead=0; + $dup_lists=''; + $stmt="select campaign_id from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $ci_recs = mysql_num_rows($rslt); + if ($ci_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_camp = $row[0]; + + $stmt="select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $rslt=mysql_query($stmt, $link); + $li_recs = mysql_num_rows($rslt); + if ($li_recs > 0) + { + $L=0; + while ($li_recs > $L) + { + $row=mysql_fetch_row($rslt); + $dup_lists .= "'$row[0]',"; + $L++; + } + $dup_lists = eregi_replace(",$",'',$dup_lists); + + $stmt="select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + } + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if (eregi("DUPSYS",$dupcheck)) + { + $dup_lead=0; + $stmt="select list_id from vicidial_list where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if (eregi("DUPLIST",$dupcheck)) + { + $dup_lead=0; + $stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_lead = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + if ( (strlen($phone_number)>6) and ($dup_lead<1) ) + { + if (strlen($phone_code)<1) {$phone_code = '1';} + + $US='_'; + $phone_list .= "$phone_number$US$list_id|"; + + $gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code); + + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + } + print ""; + } + +if ($leadfile && filesize($LF_path)<=8388608) { + $total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list=''; + if ($file_layout=="standard") { + + print ""; + flush(); + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) { + + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"); + $lead_file = "./vicidial_temp_file.txt"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.txt"); + $lead_file = "/tmp/vicidial_temp_file.txt"; + } + $file=fopen("$lead_file", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + + if (count($field_check)>=5) { + flush(); + $file=fopen("$lead_file", "r"); + $total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list=''; + print "
Processing $delim_name-delimited file... ($tab_count|$pipe_count)\n"; + if (strlen($list_id_override)>0) + { + print "

LIST ID OVERRIDE FOR THIS FILE: $list_id_override

"; + } + if (strlen($phone_code_override)>0) + { + print "

PHONE CODE OVERRIDE FOR THIS FILE: $phone_code_override

\n"; + } + while (!feof($file)) { + $record++; + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + + if (strlen($buffer)>0) { + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[0]; + $source_code = $row[1]; + $source_id=$source_code; + $list_id = $row[2]; + $gmt_offset = '0'; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[3]); + $phone_number = eregi_replace("[^0-9]", "", $row[4]); + $USarea = substr($phone_number, 0, 3); + $title = $row[5]; + $first_name = $row[6]; + $middle_initial = $row[7]; + $last_name = $row[8]; + $address1 = $row[9]; + $address2 = $row[10]; + $address3 = $row[11]; + $city =$row[12]; + $state = $row[13]; + $province = $row[14]; + $postal_code = $row[15]; + $country_code = $row[16]; + $gender = $row[17]; + $date_of_birth = $row[18]; + $alt_phone = eregi_replace("[^0-9]", "", $row[19]); + $email = $row[20]; + $security_phrase = $row[21]; + $comments = trim($row[22]); + + if (strlen($list_id_override)>0) + { + $list_id = $list_id_override; + } + if (strlen($phone_code_override)>0) + { + $phone_code = $phone_code_override; + } + + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if (eregi("DUPCAMP",$dupcheck)) + { + $dup_lead=0; + $dup_lists=''; + $stmt="select campaign_id from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $ci_recs = mysql_num_rows($rslt); + if ($ci_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_camp = $row[0]; + + $stmt="select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $rslt=mysql_query($stmt, $link); + $li_recs = mysql_num_rows($rslt); + if ($li_recs > 0) + { + $L=0; + while ($li_recs > $L) + { + $row=mysql_fetch_row($rslt); + $dup_lists .= "'$row[0]',"; + $L++; + } + $dup_lists = eregi_replace(",$",'',$dup_lists); + + $stmt="select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + } + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if (eregi("DUPSYS",$dupcheck)) + { + $dup_lead=0; + $stmt="select list_id from vicidial_list where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if (eregi("DUPLIST",$dupcheck)) + { + $dup_lead=0; + $stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_lead = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + if ( (strlen($phone_number)>6) and ($dup_lead<1) ) + { + if (strlen($phone_code)<1) {$phone_code = '1';} + + $US='_'; + $phone_list .= "$phone_number$US$list_id|"; + + $gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code); + + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } else { + print "
ERROR: The file does not have the required number of fields to process it.
"; + } + } else if (!eregi(".csv", $leadfile_name)) + { + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"); + $lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.xls"); + $lead_file = "/tmp/vicidial_temp_file.xls"; + } + $file=fopen("$lead_file", "r"); + + # echo "|$WeBServeRRooT/vicidial/listloader.pl --forcelistid=$list_id_override --lead-file=$lead_file|"; + $dupcheckCLI=''; $postalgmtCLI=''; + if (eregi("DUPLIST",$dupcheck)) {$dupcheckCLI='--duplicate-check';} + if (eregi("DUPCAMP",$dupcheck)) {$dupcheckCLI='--duplicate-campaign-check';} + if (eregi("DUPSYS",$dupcheck)) {$dupcheckCLI='--duplicate-system-check';} + if (eregi("POSTAL",$postalgmt)) {$postalgmtCLI='--postal-code-gmt';} + passthru("$WeBServeRRooT/vicidial/listloader.pl --forcelistid=$list_id_override --forcephonecode=$phone_code_override --lead-file=$lead_file $postalgmtCLI $dupcheckCLI"); + + } + else + { + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"); + $lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.csv"); + $lead_file = "/tmp/vicidial_temp_file.csv"; + } + $file=fopen("$lead_file", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + print "
Processing CSV file... \n"; + + if (strlen($list_id_override)>0) + { + print "

LIST ID OVERRIDE FOR THIS FILE: $list_id_override

"; + } + if (strlen($phone_code_override)>0) + { + print "

PHONE CODE OVERRIDE FOR THIS FILE: $phone_code_override

"; + } + + while($row=fgetcsv($file, 1000, ",")) { + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[0]; + $source_code = $row[1]; + $source_id=$source_code; + $list_id = $row[2]; + $gmt_offset = '0'; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[3]); + $phone_number = eregi_replace("[^0-9]", "", $row[4]); + $USarea = substr($phone_number, 0, 3); + $title = $row[5]; + $first_name = $row[6]; + $middle_initial = $row[7]; + $last_name = $row[8]; + $address1 = $row[9]; + $address2 = $row[10]; + $address3 = $row[11]; + $city =$row[12]; + $state = $row[13]; + $province = $row[14]; + $postal_code = $row[15]; + $country_code = $row[16]; + $gender = $row[17]; + $date_of_birth = $row[18]; + $alt_phone = eregi_replace("[^0-9]", "", $row[19]); + $email = $row[20]; + $security_phrase = $row[21]; + $comments = trim($row[22]); + + if (strlen($list_id_override)>0) + { + $list_id = $list_id_override; + } + if (strlen($phone_code_override)>0) + { + $phone_code = $phone_code_override; + } + + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if (eregi("DUPCAMP",$dupcheck)) + { + $dup_lead=0; + $dup_lists=''; + $stmt="select campaign_id from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $ci_recs = mysql_num_rows($rslt); + if ($ci_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_camp = $row[0]; + + $stmt="select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $rslt=mysql_query($stmt, $link); + $li_recs = mysql_num_rows($rslt); + if ($li_recs > 0) + { + $L=0; + while ($li_recs > $L) + { + $row=mysql_fetch_row($rslt); + $dup_lists .= "'$row[0]',"; + $L++; + } + $dup_lists = eregi_replace(",$",'',$dup_lists); + + $stmt="select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + } + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if (eregi("DUPSYS",$dupcheck)) + { + $dup_lead=0; + $stmt="select list_id from vicidial_list where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if (eregi("DUPLIST",$dupcheck)) + { + $dup_lead=0; + $stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_lead = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + if ( (strlen($phone_number)>6) and ($dup_lead<1) ) + { + if (strlen($phone_code)<1) {$phone_code = '1';} + + $US='_'; + $phone_list .= "$phone_number$US$list_id|"; + + $gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code); + + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } + print ""; + + } else { + print "
"; + flush(); + print "\r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + + $rslt=mysql_query("select vendor_lead_code, source_id, list_id, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments from vicidial_list limit 1", $link); + + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) + { + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"); + $lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.txt"); + $lead_file = "/tmp/vicidial_temp_file.txt"; + } + $file=fopen("$lead_file", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + flush(); + $file=fopen("$lead_file", "r"); + print "
Processing $delim_name-delimited file...\n"; + + if (strlen($list_id_override)>0) + { + print "

LIST ID OVERRIDE FOR THIS FILE: $list_id_override

"; + } + if (strlen($phone_code_override)>0) + { + print "

PHONE CODE OVERRIDE FOR THIS FILE: $phone_code_override

"; + } + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + for ($i=0; $i\r\n"; + print "
\r\n"; + print " \r\n"; + print " \r\n"; + + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + } + } + else if (!eregi(".csv", $leadfile_name)) + { + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"); + $lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.xls"); + $lead_file = "/tmp/vicidial_temp_file.xls"; + } + + # echo "|$WeBServeRRooT/vicidial/listloader_rowdisplay.pl --lead-file=$lead_file|"; + $dupcheckCLI=''; $postalgmtCLI=''; + if (eregi("DUPLIST",$dupcheck)) {$dupcheckCLI='--duplicate-check';} + if (eregi("DUPCAMP",$dupcheck)) {$dupcheckCLI='--duplicate-campaign-check';} + if (eregi("DUPSYS",$dupcheck)) {$dupcheckCLI='--duplicate-system-check';} + if (eregi("POSTAL",$postalgmt)) {$postalgmtCLI='--postal-code-gmt';} + passthru("$WeBServeRRooT/vicidial/listloader_rowdisplay.pl --lead-file=$lead_file $postalgmtCLI $dupcheckCLI"); + } + else + { + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"); + $lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.csv"); + $lead_file = "/tmp/vicidial_temp_file.csv"; + } + $file=fopen("$lead_file", "r"); + + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + print "
Processing CSV file... \n"; + + if (strlen($list_id_override)>0) + { + print "

LIST ID OVERRIDE FOR THIS FILE: $list_id_override

"; + } + if (strlen($phone_code_override)>0) + { + print "

PHONE CODE OVERRIDE FOR THIS FILE: $phone_code_override

"; + } + + $total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list=''; + $row=fgetcsv($file, 1000, ","); + for ($i=0; $i\r\n"; + print "
\r\n"; + print " \r\n"; + print " \r\n"; + + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + } + } + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print "
VICIDIAL ColumnFile data
".strtoupper(eregi_replace("_", " ", mysql_field_name($rslt, $i))).":
$row[$i]
".strtoupper(eregi_replace("_", " ", mysql_field_name($rslt, $i))).":
$row[$i]
        
\r\n"; + # } + print ""; + } +} else if (filesize($leadfile)>8388608) { + print "
ERROR: File exceeds the 8MB limit.
"; +} +?> + + + + + + + + +4) ) + { + if (preg_match('/^1$/', $phone_code)) + { + $stmt="select * from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[2]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[3]; + $dst_range = $row[4]; + $PC_processed++; + $postalgmt_found++; + $post++; + } + } + } +if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =='1') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### MEXICO ### + if ($phone_code =='52') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### AUSTRALIA ### + if ($phone_code =='61') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $PC_processed++; + $stmt="select * from vicidial_phone_codes where country_code='$phone_code';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + } + +### Find out if DST to raise the gmt offset ### +$AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); +$AC_localtime = mktime(($Shour + $AC_GMT_diff), $Smin, $Ssec, $Smon, $Smday, $Syear); + $hour = date("H",$AC_localtime); + $min = date("i",$AC_localtime); + $sec = date("s",$AC_localtime); + $mon = date("m",$AC_localtime); + $mday = date("d",$AC_localtime); + $wday = date("w",$AC_localtime); + $year = date("Y",$AC_localtime); +$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + +$AC_processed=0; +if ( (!$AC_processed) and ($dst_range == 'SSM-FSN') ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + #********************************************************************** + # SSM-FSN + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on Second Sunday March to First Sunday November at 2 am. + # INPUTS: + # mm INTEGER Month. + # dd INTEGER Day of the month. + # ns INTEGER Seconds into the day. + # dow INTEGER Day of week (0=Sunday, to 6=Saturday) + # OPTIONAL INPUT: + # timezone INTEGER hour difference UTC - local standard time + # (DEFAULT is blank) + # make calculations based on UTC time, + # which means shift at 10:00 UTC in April + # and 9:00 UTC in October + # OUTPUT: + # INTEGER 1 = DST, 0 = not DST + # + # S M T W T F S + # 1 2 3 4 5 6 7 + # 8 9 10 11 12 13 14 + #15 16 17 18 19 20 21 + #22 23 24 25 26 27 28 + #29 30 31 + # + # S M T W T F S + # 1 2 3 4 5 6 + # 7 8 9 10 11 12 13 + #14 15 16 17 18 19 20 + #21 22 23 24 25 26 27 + #28 29 30 31 + # + #********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; + } elseif ($mm >= 4 and $mm <= 10) { + $USACAN_DST=1; + } elseif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; + } elseif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } + } else { + $USACAN_DST=0; + } + } elseif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; + } elseif ($dd < ($dow+1)) { + $USACAN_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } + } else { + $USACAN_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$gmt_offset++;} + $AC_processed++; + } + +if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + #********************************************************************** + # FSA-LSO + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in April and last Sunday in October at 2 am. + #********************************************************************** + + $USA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $USA_DST=0; + } elseif ($mm >= 5 and $mm <= 9) { + $USA_DST=1; + } elseif ($mm == 4) { + if ($dd > 7) { + $USA_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } + } else { + $USA_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $USA_DST=1; + } elseif ($dd < ($dow+25)) { + $USA_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } + } else { + $USA_DST=0; + } + } # end of month checks + + if ($DBX) {print " DST: $USA_DST\n";} + if ($USA_DST) {$gmt_offset++;} + $AC_processed++; + } + +if ( (!$AC_processed) and ($dst_range == 'LSM-LSO') ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in March and last Sunday in October at 1 am. + #********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; + } elseif ($mm >= 4 and $mm <= 9) { + $GBR_DST=1; + } elseif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; + } elseif ($dd < ($dow+25)) { + $GBR_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } + } else { + $GBR_DST=1; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; + } elseif ($dd < ($dow+25)) { + $GBR_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } + } else { + $GBR_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } +if ( (!$AC_processed) and ($dst_range == 'LSO-LSM') ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUS_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; + } elseif ($dd < ($dow+25)) { + $AUS_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } + } else { + $AUS_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; + } elseif ($dd < ($dow+25)) { + $AUS_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } + } else { + $AUS_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + +if ( (!$AC_processed) and ($dst_range == 'FSO-LSM') ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + #********************************************************************** + # TASMANIA ONLY + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUST_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; + } elseif ($dd < ($dow+25)) { + $AUST_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } + } else { + $AUST_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $AUST_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } + } else { + $AUST_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } +if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and third Sunday in March at 1 am. + #********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $NZL_DST=0; + } elseif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; + } elseif ($dd < ($dow+14)) { + $NZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } + } else { + $NZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $NZL_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } + } else { + $NZL_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + +if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + #********************************************************************** + # TSO-LSF + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. Brazil + # Based on Third Sunday October to Last Sunday February at 1 am. + #********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; + } elseif ($mm >= 3 and $mm <= 9) { + $BZL_DST=0; + } elseif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; + } elseif ($dd < ($dow+22)) { + $BZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } + } else { + $BZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; + } elseif ($dd < ($dow+22)) { + $BZL_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } + } else { + $BZL_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$gmt_offset++;} + $AC_processed++; + } + +if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + +return $gmt_offset; +} \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/remote_dispo.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/remote_dispo.php new file mode 100644 index 00000000..da249fba --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/remote_dispo.php @@ -0,0 +1,327 @@ + LICENSE: GPLv2 +### +# this is the remote agent disposition screen for calls sent to remote agents. This allows the remote agent to modify customer information and disposition the call + +# CHANGES +# +# 60619-1626 - Added variable filtering to eliminate SQL injection attack threat +# + + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +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["alt_phone"])) {$alt_phone=$_GET["alt_phone"];} + elseif (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];} +if (isset($_GET["call_began"])) {$call_began=$_GET["call_began"];} + elseif (isset($_POST["call_began"])) {$call_began=$_POST["call_began"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];} + elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];} +if (isset($_GET["city"])) {$city=$_GET["city"];} + elseif (isset($_POST["city"])) {$city=$_POST["city"];} +if (isset($_GET["comments"])) {$comments=$_GET["comments"];} + elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];} +if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];} + elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];} +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["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];} + elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];} +if (isset($_GET["email"])) {$email=$_GET["email"];} + elseif (isset($_POST["email"])) {$email=$_POST["email"];} +if (isset($_GET["end_call"])) {$end_call=$_GET["end_call"];} + elseif (isset($_POST["end_call"])) {$end_call=$_POST["end_call"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];} + elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];} + elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["parked_time"])) {$parked_time=$_GET["parked_time"];} + elseif (isset($_POST["parked_time"])) {$parked_time=$_POST["parked_time"];} +if (isset($_GET["pass"])) {$pass=$_GET["pass"];} + elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];} +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["phone"])) {$phone=$_GET["phone"];} + elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];} +if (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];} + elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];} +if (isset($_GET["province"])) {$province=$_GET["province"];} + elseif (isset($_POST["province"])) {$province=$_POST["province"];} +if (isset($_GET["security"])) {$security=$_GET["security"];} + elseif (isset($_POST["security"])) {$security=$_POST["security"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["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["session_id"])) {$session_id=$_GET["session_id"];} + elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];} +if (isset($_GET["state"])) {$state=$_GET["state"];} + elseif (isset($_POST["state"])) {$state=$_POST["state"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["tsr"])) {$tsr=$_GET["tsr"];} + elseif (isset($_POST["tsr"])) {$tsr=$_POST["tsr"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_datetime = $STARTtime; + +$ext_context = 'demo'; +if (!isset($begin_date)) {$begin_date = $TODAY;} +if (!isset($end_date)) {$end_date = $TODAY;} + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 2;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + } + else + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +?> + + +VICIDIAL REMOTE: Call Disposition +\n"; +?> + + +
+ +"; + +if ($end_call > 0) +{ + +$call_length = ($STARTtime - $call_began); + + ### insert a NEW record to the vicidial_closer_log table + $stmt="UPDATE vicidial_closer_log set end_epoch='$STARTtime', length_in_sec='" . mysql_real_escape_string($call_length) . "', status='" . mysql_real_escape_string($status) . "', user='$PHP_AUTH_USER' where lead_id='" . mysql_real_escape_string($lead_id) . "' order by start_epoch desc limit 1;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ### update the lead record in the vicidial_list table + $stmt="UPDATE vicidial_list set status='" . mysql_real_escape_string($status) . "',first_name='" . mysql_real_escape_string($first_name) . "',last_name='" . mysql_real_escape_string($last_name) . "',address1='" . mysql_real_escape_string($address1) . "',address2='" . mysql_real_escape_string($address2) . "',address3='" . mysql_real_escape_string($address3) . "',city='" . mysql_real_escape_string($city) . "',state='" . mysql_real_escape_string($state) . "',province='" . mysql_real_escape_string($province) . "',postal_code='" . mysql_real_escape_string($postal_code) . "',country_code='" . mysql_real_escape_string($country_code) . "',alt_phone='" . mysql_real_escape_string($alt_phone) . "',email='" . mysql_real_escape_string($email) . "',security_phrase='" . mysql_real_escape_string($security) . "',comments='" . mysql_real_escape_string($comments) . "',user='$PHP_AUTH_USER' where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "Call has been dispositioned       $NOW_TIME\n

\n"; + + echo "
\n"; + +} +else +{ + $stmt="SELECT count(*) from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_count = $row[0]; + + if ($lead_count > 0) + { + + $stmt="SELECT * from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_id = "$row[0]"; + $tsr = "$row[4]"; + $vendor_id = "$row[5]"; + $list_id = "$row[7]"; + $campaign_id = "$row[8]"; + $phone_code = "$row[10]"; + $phone_number = "$row[11]"; + $title = "$row[12]"; + $first_name = "$row[13]"; # + $middle_initial = "$row[14]"; + $last_name = "$row[15]"; # + $address1 = "$row[16]"; # + $address2 = "$row[17]"; # + $address3 = "$row[18]"; # + $city = "$row[19]"; # + $state = "$row[20]"; # + $province = "$row[21]"; # + $postal_code = "$row[22]"; # + $country_code = "$row[23]"; # + $gender = "$row[24]"; + $date_of_birth = "$row[25]"; + $alt_phone = "$row[26]"; # + $email = "$row[27]"; # + $security = "$row[28]"; # + $comments = "$row[29]"; # + + echo "
Call information: $first_name $last_name - $phone_number

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + echo "\n"; + echo "
Vendor ID: $vendor_id     Campaign ID: $campaign_id
Fronter: $tsr     List ID: $list_id
First Name:   \n"; + echo " Last Name:
Address 1 :
Address 2 :
Address 3 :
City :
State:   \n"; + echo " Postal Code:
Province :
Country :
Alt Phone :
Email :
Security :
Comments :
Disposition:
\n"; + echo "


\n"; + + } + else + { + echo "lead lookup FAILED for lead_id $lead_id       $NOW_TIME\n

\n"; +# echo "Close this window\n

\n"; + } + + + + + + +} + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/server_stats.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/server_stats.php new file mode 100644 index 00000000..8e509383 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/server_stats.php @@ -0,0 +1,97 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60620-1037 - Added Link back to Admin section +# - Added required user/pass to gain access to this page +# 61101-1331 - Added SIP/IAX listen/barge links +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($query_date)) {$query_date = $NOW_DATE;} + +$stmt="select * from servers;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$servers_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $servers_to_print) + { + $row=mysql_fetch_row($rslt); + $server_id[$i] = $row[0]; + $server_description[$i] = $row[1]; + $server_ip[$i] = $row[2]; + $active[$i] = $row[3]; + $i++; + } +?> + + + + + +VICIDIAL: Server Stats and Reports +VICIDIAL: Server Stats and Reports                           +BACK TO ADMIN

+ + +

+
+ $o)
+	{
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	$o++;
+	}
+
+?>
+
SERVERDESCRIPTIONIP ADDRESSACTIVEVDAD timeVDcall timePARK timeCLOSER/INBOUND time
$server_id[$o]$server_description[$o]$server_ip[$o]$active[$o]LINKLINKLINKLINK
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/user_stats.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/user_stats.php new file mode 100644 index 00000000..ecd457f8 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/user_stats.php @@ -0,0 +1,408 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1743 - Added variable filtering to eliminate SQL injection attack threat +# 61201-1136 - Added recordings display and changed calls to time range with 10000 limit +# 70118-1605 - Added user group column to login/out and calls lists +# 70702-1231 - Added recording location link and truncation +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["begin_date"])) {$begin_date=$_GET["begin_date"];} + elseif (isset($_POST["begin_date"])) {$begin_date=$_POST["begin_date"];} +if (isset($_GET["end_date"])) {$end_date=$_GET["end_date"];} + elseif (isset($_POST["end_date"])) {$end_date=$_POST["end_date"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); + +if (!isset($begin_date)) {$begin_date = $TODAY;} +if (!isset($end_date)) {$end_date = $TODAY;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and view_reports='1';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + + $stmt="SELECT full_name from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + } + + + + +?> + + +VICIDIAL ADMIN: User Stats +\n"; +?> + + +
+ + + + + +\n"; +echo "
" ?>   VICIDIAL ADMIN: User Stats for  
  \n"; + +echo "
\n"; +echo "\n"; +echo " to \n"; +echo "  \n"; +echo "\n"; + + +echo "           $user - $full_name\n"; + +echo " - VICIDIAL Time Sheet\n"; +echo " - User Status\n"; +echo " - Modify User\n"; + + +echo "
\n"; + + + $stmt="SELECT count(*),status, sum(length_in_sec) from vicidial_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' group by status order by status"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + +echo "
\n"; + +echo "TALK TIME AND STATUS:\n"; + +echo "
\n"; +echo "\n"; + + $total_calls=0; + $o=0; + while ($statuses_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $call_seconds = $row[2]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} + + echo ""; + echo "\n"; + echo "\n"; + $total_calls = ($total_calls + $row[0]); + + $call_seconds=0; + $o++; + } + + $stmt="SELECT sum(length_in_sec) from vicidial_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59'"; + $rslt=mysql_query($stmt, $link); + $counts_to_print = mysql_num_rows($rslt); + $row=mysql_fetch_row($rslt); + $call_seconds = $row[0]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} + +echo "\n"; +echo "
STATUSCOUNTHOURS:MINUTES
$row[1] $row[0] $call_hours_int:$call_minutes_int
TOTAL CALLS $total_calls $call_hours_int:$call_minutes_int
\n"; +echo "

\n"; + +echo "
\n"; + +echo "LOGIN/LOGOUT TIME:\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT event,event_epoch,event_date,campaign_id,user_group from vicidial_user_log where user='" . mysql_real_escape_string($user) . "' and event_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and event_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59'"; + $rslt=mysql_query($stmt, $link); + $events_to_print = mysql_num_rows($rslt); + + $total_calls=0; + $o=0; + $event_start_seconds=''; + $event_stop_seconds=''; + while ($events_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("LOGIN", $row[0])) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + if (ereg("LOGIN", $row[0])) + { + $event_start_seconds = $row[1]; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + if (ereg("LOGOUT", $row[0])) + { + if ($event_start_seconds) + { + $event_stop_seconds = $row[1]; + $event_seconds = ($event_stop_seconds - $event_start_seconds); + $total_login_time = ($total_login_time + $event_seconds); + $event_hours = ($event_seconds / 3600); + $event_hours = round($event_hours, 2); + $event_hours_int = intval("$event_hours"); + $event_minutes = ($event_hours - $event_hours_int); + $event_minutes = ($event_minutes * 60); + $event_minutes_int = round($event_minutes, 0); + if ($event_minutes_int < 10) {$event_minutes_int = "0$event_minutes_int";} + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + $event_start_seconds=''; + $event_stop_seconds=''; + } + else + { + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + } + } + + $total_calls = ($total_calls + $row[0]); + + $call_seconds=0; + $o++; + } + +$total_login_hours = ($total_login_time / 3600); +$total_login_hours = round($total_login_hours, 2); +$total_login_hours_int = intval("$total_login_hours"); +$total_login_minutes = ($total_login_hours - $total_login_hours_int); +$total_login_minutes = ($total_login_minutes * 60); +$total_login_minutes_int = round($total_login_minutes, 0); +if ($total_login_minutes_int < 10) {$total_login_minutes_int = "0$total_login_minutes_int";} + +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "
EVENT DATE CAMPAIGN GROUPHOURS:MINUTES
$row[0] $row[2] $row[3] $row[4]
$row[0] $row[2] $row[3] $row[4] $event_hours_int:$event_minutes_int
$row[0] $row[2] $row[3]
TOTAL $total_login_hours_int:$total_login_minutes_int
\n"; + + +echo "

\n"; + +echo "
\n"; + +echo "OUTBOUND CALLS FOR THIS TIME PERIOD: (10000 record limit)\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from vicidial_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $u++; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + } + + +echo "
# DATE/TIME LENGTH STATUS PHONE CAMPAIGN GROUP LIST LEAD
$u$row[4] $row[7] $row[8] $row[10] $row[3] $row[14] $row[2] $row[1]


\n"; + + + +echo "CLOSER CALLS FOR THIS TIME PERIOD: (10000 record limit)\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from vicidial_closer_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $u++; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + } + + +echo "
# DATE/TIME LENGTH STATUS PHONE CAMPAIGN WAIT (S) LIST LEAD
$u$row[4] $row[7] $row[8] $row[10] $row[3] $row[14] $row[2] $row[1]


\n"; + + + + +echo "RECORDINGS FOR THIS TIME PERIOD: (10000 record limit)\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from recording_log where user='" . mysql_real_escape_string($user) . "' and start_time >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and start_time <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by recording_id desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) + { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $location = $row[11]; + if (strlen($location)>30) + {$locat = substr($location,0,27); $locat = "$locat...";} + else + {$locat = $location;} + if (eregi("http",$location)) + {$location = "$locat";} + else + {$location = $locat;} + $u++; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + } + + +echo "
# LEADDATE/TIME SECONDS   RECIDFILENAMELOCATION  
$u $row[12] $row[4] $row[8] $row[0] $row[10] $location  
\n"; + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/user_status.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/user_status.php new file mode 100644 index 00000000..ecffbc5c --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/user_status.php @@ -0,0 +1,242 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1738 - Added variable filtering to eliminate SQL injection attack threat +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["begin_date"])) {$begin_date=$_GET["begin_date"];} + elseif (isset($_POST["begin_date"])) {$begin_date=$_POST["begin_date"];} +if (isset($_GET["end_date"])) {$end_date=$_GET["end_date"];} + elseif (isset($_POST["end_date"])) {$end_date=$_POST["end_date"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); + +if (!isset($begin_date)) {$begin_date = $TODAY;} +if (!isset($end_date)) {$end_date = $TODAY;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and view_reports='1';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $stmt="SELECT full_name,change_agent_campaign from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $change_agent_campaign=$row[1]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + + $stmt="SELECT full_name,user_group from vicidial_users where user='" . mysql_real_escape_string($user) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + $user_group = $row[1]; + + $stmt="SELECT * from vicidial_live_agents where user='" . mysql_real_escape_string($user) . "';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $agents_to_print = mysql_num_rows($rslt); + $i=0; + while ($i < $agents_to_print) + { + $row=mysql_fetch_row($rslt); + $Aserver_ip = $row[2]; + $Asession_id = $row[3]; + $Aextension = $row[4]; + $Astatus = $row[5]; + $Acampaign = $row[7]; + $Alast_call = $row[14]; + $Acl_campaigns = $row[15]; + $i++; + } + + } + +$stmt="select * from vicidial_campaigns;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + + + +?> + + +VICIDIAL ADMIN: User Status +\n"; +?> + + +
+
+ + + + +\n"; +echo "
" ?>   VICIDIAL ADMIN: User Status for  
  \n"; + +if ($stage == "live_campaign_change") +{ + $stmt="UPDATE vicidial_live_agents set campaign_id='" . mysql_real_escape_string($group) . "' where user='" . mysql_real_escape_string($user) . "';"; + $rslt=mysql_query($stmt, $link); + + echo "Agent $user - $full_name changed to $group campaign
\n"; + + exit; +} + +if ($stage == "log_agent_out") +{ + $stmt="DELETE from vicidial_live_agents where user='" . mysql_real_escape_string($user) . "';"; + $rslt=mysql_query($stmt, $link); + + echo "Agent $user - $full_name has been emergency logged out, make sure they close their web browser
\n"; + + exit; +} + +if ($agents_to_print > 0) +{ + echo "
";
+	echo "Agent Logged in at server:  $Aserver_ip\n";
+	echo "               in session:  $Asession_id\n";
+	echo "               from phone:  $Aextension\n";
+	echo "Agent is in campaign:       $Acampaign\n";
+	echo "              status:       $Astatus\n";
+	echo " hungup last call at:       $Alast_call\n";
+	echo "       Closer groups:       $Acl_campaigns\n\n";
+
+	echo "
"; + + + if ($change_agent_campaign > 0) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "Current Campaign: \n"; + echo "
\n"; + + + echo "
\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + } +} + +else +{ + echo "Agent is not logged in\n
"; + +} + + +echo "           $user - $full_name \n"; +echo "       GROUP: $user_group

\n"; + +echo "VICIDIAL Time Sheet\n"; +echo " - User Stats\n"; +echo " - Modify User\n"; + +echo "
\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + +echo "|$stage|$group|"; + +?> + + +
+ + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/vdremote.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/vdremote.php new file mode 100644 index 00000000..dfe11fa3 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/vdremote.php @@ -0,0 +1,602 @@ + LICENSE: GPLv2 +# +# Changes +# 50307-1721 - First version +# 51123-1502 - removed requirement of PHP Globals=on +# 60421-1229 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1603 - Added variable filtering to eliminate SQL injection attack threat +# +# make sure you have added a user to the vicidial_users MySQL table with at least user_level 4 to access this page the first time + +$version = '1.1.12'; +$build = '60619-1603'; + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["ADD"])) {$ADD=$_GET["ADD"];} + elseif (isset($_POST["ADD"])) {$ADD=$_POST["ADD"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["force_logout"])) {$force_logout=$_GET["force_logout"];} + elseif (isset($_POST["force_logout"])) {$force_logout=$_POST["force_logout"];} +if (isset($_GET["groups"])) {$groups=$_GET["groups"];} + elseif (isset($_POST["groups"])) {$groups=$_POST["groups"];} +if (isset($_GET["remote_agent_id"])) {$remote_agent_id=$_GET["remote_agent_id"];} + elseif (isset($_POST["remote_agent_id"])) {$remote_agent_id=$_POST["remote_agent_id"];} +if (isset($_GET["user_start"])) {$user_start=$_GET["user_start"];} + elseif (isset($_POST["user_start"])) {$user_start=$_POST["user_start"];} +if (isset($_GET["number_of_lines"])) {$number_of_lines=$_GET["number_of_lines"];} + elseif (isset($_POST["number_of_lines"])) {$number_of_lines=$_POST["number_of_lines"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["conf_exten"])) {$conf_exten=$_GET["conf_exten"];} + elseif (isset($_POST["conf_exten"])) {$conf_exten=$_POST["conf_exten"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["groups"])) {$groups=$_GET["groups"];} + elseif (isset($_POST["groups"])) {$groups=$_POST["groups"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +if (!isset($force_logout)) {$force_logout = 0;} + +if ($force_logout) +{ + if( (strlen($PHP_AUTH_USER)>0) or (strlen($PHP_AUTH_PW)>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "You have now logged out. Thank you\n"; + exit; +} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + +$popup_page = './closer_popup.php'; +$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='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 3;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + + $stmt="SELECT count(*) from vicidial_remote_agents where user_start='$PHP_AUTH_USER';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $authx=$row[0]; + + if($authx>0) + { + $stmt="SELECT remote_agent_id,server_ip,number_of_lines from vicidial_remote_agents where user_start='$PHP_AUTH_USER';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id=$row[0]; + $server_ip=$row[1]; + if (!$number_of_lines) {$number_of_lines=$row[2];} + + fwrite ($fp, "VDremote|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VDremote|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + echo "This remote agent does not exist: |$PHP_AUTH_USER|\n"; + exit; + } + } + else + { + fwrite ($fp, "VDremote|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +echo "\n"; +if ($ADD==61111) + { + echo"\n"; + } +echo "\n"; +?> + +VICIDIAL REMOTE AGENTS: $LOGfullname - $PHP_AUTH_USER "; + +if (!$ADD) {$ADD="31111";} +if ($ADD==31111) {echo "Modify Remote Agents";} +if ($ADD==41111) {echo "Modify Remote Agents";} +if ($ADD==61111) {echo "Remote Agent Status";} +if ($ADD==71111) {echo "Remote Agent Closer Stats";} + + +if (strlen($ADD)>4) + { + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rslt=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rslt); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $servers_list .= "\n"; + $o++; + } + + ##### get campaigns listing for dynamic pulldown + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + $campaigns_list=''; + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $campaigns_list .= "\n"; + $o++; + } + + ##### get inbound groups listing for checkboxes + if ( (($ADD==31111) or ($ADD==31111)) and (count($groups)<1) ) + { + $stmt="SELECT closer_campaigns from vicidial_remote_agents where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + $stmt="SELECT group_id,group_name from vicidial_inbound_groups order by group_id"; + $rslt=mysql_query($stmt, $link); + $groups_to_print = mysql_num_rows($rslt); + $groups_list=''; + $groups_value=''; + + $o=0; + while ($groups_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $group_id_value = $rowx[0]; + $group_name_value = $rowx[1]; + $groups_list .= "2) {$groups_value .= " -";} + } + +?> + + + +
+
+ + + +
  VICIDIAL REMOTE AGENTS:   Logout  
  MODIFY | ">STATUS | ">INBOUND STATS
+"; + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + +echo "
MODIFY A REMOTE AGENTS ENTRY: $row[0]
\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
User ID Start: $user_start
Number of Lines: (numbers only)
Server IP: $row[3]
External Extension: (number dialed to reach agents [i.e. 913125551212])
Status:
Campaign: $campaign_id
Inbound Groups: \n"; +echo "$groups_list"; +echo "
\n"; +echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n"; + +} + + + + +###################### +# ADD=41111 modify remote agents info in the system +###################### + +if ($ADD==41111) +{ + echo ""; + + if ( (strlen($number_of_lines) < 1) or (strlen($conf_exten) < 2) ) + {echo "
REMOTE AGENTS NOT MODIFIED - Please go back and look at the data you entered\n";} + else + { + $stmt="UPDATE vicidial_remote_agents set number_of_lines='" . mysql_real_escape_string($number_of_lines) . "', conf_exten='" . mysql_real_escape_string($conf_exten) . "', status='" . mysql_real_escape_string($status) . "', closer_campaigns='" . mysql_real_escape_string($groups_value) . "' where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';"; + $rslt=mysql_query($stmt, $link); + +# echo "$stmt\n"; + echo "
REMOTE AGENTS MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY REMOTE AGENTS ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + + } + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + +echo "
MODIFY A REMOTE AGENTS ENTRY: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
User ID Start: $user_start
Number of Lines: (numbers only)
Server IP: $row[3]
External Extension: (number dialed to reach agents [i.e. 913125551212])
Status:
Campaign: $campaign_id
Inbound Groups: \n"; +echo "$groups_list"; +echo "
\n"; +echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n"; + +} + + + + +###################### +# ADD=61111 status of remote agent in the system and active calls and queue +###################### + +if ($ADD==61111) +{ + echo "
";
+
+	 if ( (strlen($server_ip) < 2) or (strlen($user) < 2) )
+		{echo "
REMOTE AGENTS ERROR - Please go back and look at the data you entered\n";} + else + { + + $users_list = ''; + $k=0; + while($k < $number_of_lines) + { + $nextuser=($user + $k); + $users_list .= "'" . mysql_real_escape_string($nextuser) . "',"; + $k++; + } + $users_list = preg_replace("/.$/","",$users_list); + + echo "VICIDIAL: Remote Agent Time On Calls $NOW_TIME\n\n"; + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + echo "| STATION | USER | LEADID | CHANNEL | STATUS | START TIME | MINUTES |\n"; + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + + + $stmt="select extension,user,lead_id,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish) from vicidial_live_agents where status NOT IN('PAUSED') and server_ip='" . mysql_real_escape_string($server_ip) . "' and user IN($users_list) order by extension;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + while ($i < $talking_to_print) + { + $leadlink=0; + $row=mysql_fetch_row($rslt); + if (eregi("READY|PAUSED",$row[4])) + { + $row[3]=''; + $row[5]=' - WAITING - '; + $row[6]=$row[7]; + } + $extension = sprintf("%-10s", $row[0]); + $user = sprintf("%-6s", $row[1]); + $leadid = sprintf("%-12s", $row[2]); + if ($row[2] > 0) + { + $leadidLINK=$row[2]; + $leadlink++; + if ( eregi("QUEUE",$row[4]) ) {$row[6]=$STARTtime;} + $leadid = "$leadid"; + } + $channel = sprintf("%-10s", $row[3]); + $cc=0; + while ( (strlen($channel) > 10) and ($cc < 100) ) + { + $channel = eregi_replace(".$","",$channel); + $cc++; + if (strlen($channel) <= 10) {$cc=101;} + } + $status = sprintf("%-6s", $row[4]); + $start_time = sprintf("%-19s", $row[5]); + $call_time_S = ($STARTtime - $row[6]); + + $call_time_M = ($call_time_S / 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"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + if ($call_time_M_int >= 5) {$G=''; $EG='';} + if ($call_time_M_int >= 10) {$G=''; $EG='';} + + echo "| $G$extension$EG | $G$user$EG | $G$leadid$EG | $G$channel$EG | $G$status$EG | $G$start_time$EG | $G$call_time_MS$EG |\n"; + + $i++; + } + + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + echo " $i agents logged in on server $server_ip\n\n"; + + echo " - 5 minutes or more on call\n"; + echo " - Over 10 minutes on call\n"; + + } + else + { + echo "**************************************************************************************\n"; + echo "********************************* NO AGENTS ON CALLS *********************************\n"; + echo "**************************************************************************************\n"; + } + } + +echo "
\n\n"; + +} + + +###################### +# ADD=71111 stats for remote agents from closer logs(vicidial_closer_log) +###################### + +if ($ADD==71111) +{ + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n\n"; + echo "
";
+
+	 if ( (strlen($server_ip) < 2) or (strlen($user) < 2) )
+		{echo "
REMOTE AGENTS ERROR - Please go back and look at the data you entered\n";} + else + { + + $users_list = ''; + $k=0; + while($k < $number_of_lines) + { + $nextuser=($user + $k); + $users_list .= "'$nextuser',"; + $k++; + } + $users_list = preg_replace("/.$/","",$users_list); + + $stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and user IN($users_list);"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $in_calls = $row[0]; + $in_time = $row[1]; + $in_time_M = ($in_time / 60); + $in_time_M = round($in_time_M, 2); + $in_time_M_int = intval("$in_time_M"); + $in_time_SEC = ($in_time_M - $in_time_M_int); + $in_time_SEC = ($in_time_SEC * 60); + $in_time_SEC = round($in_time_SEC, 0); + if ($in_time_SEC < 10) {$in_time_SEC = "0$in_time_SEC";} + $in_time_MS = "$in_time_M_int:$in_time_SEC"; + $in_time_MS = sprintf("%7s", $in_time_MS); + + echo "VICIDIAL: Remote Agent inbound stats $NOW_TIME\n\n"; + echo "\n"; + echo "Total calls taken $query_date: $in_calls\n"; + echo "Total talk time on $query_date: $in_time_MS (minutes:seconds)\n"; + echo "\n"; + echo "\n"; + echo "Call list for $query_date:\n"; + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + echo "| USER | LEADID | GROUP | PHONE NUM | STATUS | CALL TIME | MINUTES |\n"; + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + + + $stmt="select user,lead_id,campaign_id,phone_number,status,call_date,length_in_sec from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and user IN($users_list) order by call_date;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + while ($i < $talking_to_print) + { + $row=mysql_fetch_row($rslt); + $user = sprintf("%-8s", $row[0]); + $leadid = sprintf("%-10s", $row[1]); + $group = sprintf("%-14s", $row[2]); + $phone = sprintf("%-10s", $row[3]); + $status = sprintf("%-6s", $row[4]); + $start_time = sprintf("%-19s", $row[5]); + $call_time_S = $row[6]; + + $call_time_M = ($call_time_S / 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"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + # if ($call_time_M_int >= 5) {$G=''; $EG='';} + # if ($call_time_M_int >= 10) {$G=''; $EG='';} + + echo "| $G$user$EG | $G$leadid$EG | $G$group$EG | $G$phone$EG | $G$status$EG | $G$start_time$EG | $G$call_time_MS$EG |\n"; + + $i++; + } + + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + # echo " $i agents logged in on server $server_ip\n\n"; + + # echo " - 5 minutes or more on call\n"; + # echo " - Over 10 minutes on call\n"; + + } + else + { + echo "**************************************************************************************\n"; + echo "********************************* NO CALLS ON THIS DAY *******************************\n"; + echo "**************************************************************************************\n"; + } + } + +echo "
\n\n"; + +} + + + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/voice_lab.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/voice_lab.php new file mode 100644 index 00000000..2ce3a2a9 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/voice_lab.php @@ -0,0 +1,312 @@ + LICENSE: GPLv2 +### +# +# CHANGES +# +# 61220-1050 - First Build +# 70115-1246 - Added ability to define an exten to play +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["message"])) {$message=$_GET["message"];} + elseif (isset($_POST["message"])) {$message=$_POST["message"];} +if (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];} + elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["NEW_VOICE_LAB"])) {$NEW_VOICE_LAB=$_GET["NEW_VOICE_LAB"];} + elseif (isset($_POST["NEW_VOICE_LAB"])) {$NEW_VOICE_LAB=$_POST["NEW_VOICE_LAB"];} +if (isset($_GET["KILL_VOICE_LAB"])) {$KILL_VOICE_LAB=$_GET["KILL_VOICE_LAB"];} + elseif (isset($_POST["KILL_VOICE_LAB"])) {$KILL_VOICE_LAB=$_POST["KILL_VOICE_LAB"];} +if (isset($_GET["PLAY_MESSAGE"])) {$PLAY_MESSAGE=$_GET["PLAY_MESSAGE"];} + elseif (isset($_POST["PLAY_MESSAGE"])) {$PLAY_MESSAGE=$_POST["PLAY_MESSAGE"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$MYSQL_datetime = date("Y-m-d H:i:s"); +$FILE_datetime = date("Ymd-His_"); +$secX = $STARTtime; + +$local_DEF = 'Local/'; +$local_AMP = '@'; +$ext_context = 'demo'; + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + + $stmt="SELECT full_name from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + } + + +##### get server listing for dynamic pulldown +$stmt="SELECT server_ip,server_description from servers order by server_ip"; +$rslt=mysql_query($stmt, $link); +$servers_to_print = mysql_num_rows($rslt); +$servers_list=''; + +$o=0; +while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $servers_list .= "\n"; + $o++; + } + +##### get campaigns listing for dynamic pulldown +$stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; +$rslt=mysql_query($stmt, $link); +$campaigns_to_print = mysql_num_rows($rslt); +$campaigns_list=''; + +$o=0; +while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $campaigns_list .= "\n"; + $o++; + } + + + + +?> + + +VICIDIAL VOICE LAB: Admin +\n"; +?> + + +
+ + 0) +{ + if ( (strlen($server_ip) > 6) && (strlen($session_id) > 6) && (strlen($campaign_id) > 2) ) + { + echo "


TO START YOUR VOICE LAB, DIAL 9$session_id ON YOUR PHONE NOW
\n"; + + echo "
or, you can enter an extension that you want played below
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Message Extension\n"; + echo "\n"; + echo "


\n"; + + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $remote_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$session_id"; + + $thirty_minutes_old = mktime(date("H"), date("i"), date("s")-30, date("m"), date("d"), date("Y")); + $past_thirty = date("Y-m-d H:i:s",$thirty_minutes_old); + + $stmt="SELECT conf_exten,server_ip,user from vicidial_live_agents where last_update_time > '$past_thirty' and campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $agents_to_loop = mysql_num_rows($rslt); + $agents_sessions[0]=''; + $agents_servers[0]=''; + $agents_users[0]=''; + + $o=0; + while ($agents_to_loop > $o) + { + $rowx=mysql_fetch_row($rslt); + $agents_sessions[$o] = "$rowx[0]"; + $agents_servers[$o] = "$rowx[1]"; + $agents_users[$o] = "$rowx[2]"; + $o++; + } + + $o=0; + while ($agents_to_loop > $o) + { + if ($agents_servers[$o] == "$server_ip") + {$dial_string = $session_id;} + else + {$dial_string = $remote_dialstring;} + + $stmt="INSERT INTO vicidial_manager values('','','$MYSQL_datetime','NEW','N','$agents_servers[$o]','','Originate','VL$FILE_datetime$o','Channel: $local_DEF$dial_string$local_AMP$ext_context','Context: $ext_context','Exten: $agents_sessions[$o]','Priority: 1','Callerid: VL$FILE_datetime$o','','','','','')"; + echo "|$stmt|\n

\n"; + $rslt=mysql_query($stmt, $link); + + echo "LOGGED IN USER $agents_users[$o] at session $agents_sessions[$o] on server $agents_servers[$o]\n"; + + $o++; + } + + + + echo "
Kill a Voice Lab Session: 8600900
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


\n"; + } + else + { + echo "ERROR!!!! Not all info entered properly\n

\n"; + echo "|$server_ip| |$session_id| |$campaign_id|\n

\n"; + echo "Back to main voicelab screen\n

\n"; + } +} +else +{ + if ($PLAY_MESSAGE > 0) + { + if ( (strlen($server_ip) > 6) && (strlen($session_id) > 6) && (strlen($campaign_id) > 2) && (strlen($message) > 0) ) + { + echo "


TO START YOUR VOICE LAB, DIAL 9$session_id ON YOUR PHONE NOW
\n"; + + echo "
or, you can enter an extension that you want played below
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Message Extension\n"; + echo "\n"; + echo "


\n"; + + $nn='99'; + $n='9'; + + $stmt="INSERT INTO vicidial_manager values('','','$MYSQL_datetime','NEW','N','$server_ip','','Originate','VL$FILE_datetime$nn','Channel: $local_DEF$n$session_id$local_AMP$ext_context','Context: $ext_context','Exten: $message','Priority: 1','Callerid: VL$FILE_datetime$nn','','','','','')"; + echo "|$stmt|\n

\n"; + $rslt=mysql_query($stmt, $link); + + echo "MESSAGE $message played at session $session_id on server $server_ip\n"; + + echo "
Kill a Voice Lab Session: 8600900
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


\n"; + } + else + { + echo "ERROR!!!! Not all info entered properly\n

\n"; + echo "|$server_ip| |$session_id| |$campaign_id|\n

\n"; + echo "Back to main voicelab screen\n

\n"; + } + } +else + { + echo "
Start a Voice Lab Session: 8600900
\n"; + echo "\n"; + echo "\n"; + echo "Your Server: \n"; + echo "
\n"; + echo "Campaign: "; + echo "
\n"; + echo "\n"; + echo "


\n"; + + + echo "
Kill a Voice Lab Session: 8600900
\n"; + echo "\n"; + echo "\n"; + echo "Your Server: \n"; + echo "
\n"; + echo "Campaign: "; + echo "
\n"; + echo "\n"; + echo "


\n"; + } +} + + +if ($KILL_VOICE_LAB > 1) +{ + if ( (strlen($server_ip) > 6) && (strlen($session_id) > 6) && (strlen($campaign_id) > 2) ) + { + $kill_dial_string = "5555$session_id"; + $hangup_exten='8300'; + $stmt="INSERT INTO vicidial_manager values('','','$MYSQL_datetime','NEW','N','$server_ip','','Originate','VLK$FILE_datetime','Channel: $local_DEF$kill_dial_string$local_AMP$ext_context','Context: $ext_context','Exten: $hangup_exten','Priority: 1','Callerid: VLK$FILE_datetime','','','','','')"; + echo "|$stmt|\n

\n"; + $rslt=mysql_query($stmt, $link); + + echo "VOICELAB SESSION KILLED: $session_id at $server_ip | $KILL_VOICE_LAB\n"; + } + else + { + echo "ERROR!!!! Not all info entered properly\n

\n"; + echo "|$server_ip| |$session_id| |$campaign_id|\n

\n"; + echo "Back to main voicelab screen\n

\n"; + } + +} + +?> + + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/vtiger_search.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/vtiger_search.php new file mode 100644 index 00000000..6eaaf1bf --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/vtiger_search.php @@ -0,0 +1,313 @@ + LICENSE: GPLv2 +### +# This page does a search against a standard vtiger CRM system. If the record +# is not present, it will create a new one and send the agent's screen to that new page. +# +# This code is tested against vtiger 4.2 +# +# CHANGES +# 60719-1615 - First version +# 60801-2304 - added mysql debug and auto-forward +# 60802-1111 - added insertion of not-found record into vtiger system +# + +#Asterisk/VICIDIAL Server (ASTERISK) +#Internal : 10.10.10.15 +#External : 55.55.55.55 + +#vtiger Server(TEST1) +#Internal : 10.10.10.16 +#External : 55.55.55.56 + + +### alter to connect to your vtiger database +$link=mysql_connect("10.10.10.16", "cron",'1234'); +if (!$link) {die('Could not connect: ' . mysql_error());} +echo 'Connected successfully'; +mysql_select_db("vtigercrm4_2"); + + +$PHP_SELF=$_SERVER['PHP_SELF']; +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["alt_phone"])) {$alt_phone=$_GET["alt_phone"];} + elseif (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];} +if (isset($_GET["call_began"])) {$call_began=$_GET["call_began"];} + elseif (isset($_POST["call_began"])) {$call_began=$_POST["call_began"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];} + elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];} +if (isset($_GET["city"])) {$city=$_GET["city"];} + elseif (isset($_POST["city"])) {$city=$_POST["city"];} +if (isset($_GET["comments"])) {$comments=$_GET["comments"];} + elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];} +if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];} + elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];} +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["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];} + elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];} +if (isset($_GET["email"])) {$email=$_GET["email"];} + elseif (isset($_POST["email"])) {$email=$_POST["email"];} +if (isset($_GET["end_call"])) {$end_call=$_GET["end_call"];} + elseif (isset($_POST["end_call"])) {$end_call=$_POST["end_call"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];} + elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];} + elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["parked_time"])) {$parked_time=$_GET["parked_time"];} + elseif (isset($_POST["parked_time"])) {$parked_time=$_POST["parked_time"];} +if (isset($_GET["pass"])) {$pass=$_GET["pass"];} + elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];} +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["phone"])) {$phone=$_GET["phone"];} + elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];} +if (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];} + elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];} +if (isset($_GET["province"])) {$province=$_GET["province"];} + elseif (isset($_POST["province"])) {$province=$_POST["province"];} +if (isset($_GET["security"])) {$security=$_GET["security"];} + elseif (isset($_POST["security"])) {$security=$_POST["security"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["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["session_id"])) {$session_id=$_GET["session_id"];} + elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];} +if (isset($_GET["state"])) {$state=$_GET["state"];} + elseif (isset($_POST["state"])) {$state=$_POST["state"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["tsr"])) {$tsr=$_GET["tsr"];} + elseif (isset($_POST["tsr"])) {$tsr=$_POST["tsr"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +#$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +#$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +#$DB = '1'; # DEBUG override +$US = '_'; +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$REC_TIME = date("Ymd-His"); +$FILE_datetime = $STARTtime; +$parked_time = $STARTtime; + +# $ext_context = 'default'; defined in dbconnect file + +# $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]; + +#$fp = fopen ("./project_auth_entries.txt", "a"); +#$date = date("r"); +#$ip = getenv("REMOTE_ADDR"); +#$browser = getenv("HTTP_USER_AGENT"); + +# if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) +# { +# Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); +# Header("HTTP/1.0 401 Unauthorized"); +# echo "Invalid Username/Password: |$user|$pass|\n"; +# exit; +# } +# else +# { +# +# if($auth>0) +# { +# $office_no=strtoupper($user); +# $password=strtoupper($pass); +# $stmt="SELECT full_name from vicidial_users where user='$user' and pass='$pass'"; +# if ($DB) {echo "$stmt\n";} +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# $LOGfullname=$row[0]; +# $fullname = $row[0]; +# fwrite ($fp, "VD_CLOSER|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); +# fclose($fp); +# +# if ( (strlen($customer_zap_channel)>2) and (eregi('zap',$customer_zap_channel)) ) +# { +# echo "\n\n"; +# echo "\n\n"; +# +# } +# else +# { +# echo "Bad channel: $customer_zap_channel\n"; +# echo "Make sure the Zap channel is live and try again\n"; +# exit; +# } +# +# } +# else +# { +# fwrite ($fp, "VD_CLOSER|FAIL|$date|$user|$pass|$ip|$browser|\n"); +# fclose($fp); +# } +# } + +echo "\n"; +echo "\n"; +echo "VICIDIAL Vtiger Lookup\n"; +echo "\n"; + + +$stmt="SELECT count(*) from account where phone='$phone' or otherphone='$phone' or fax='$phone';"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +if (!$rslt) { + die('Could not execute: ' . mysql_error()); +} +$row=mysql_fetch_row($rslt); +$found_count = $row[0]; + +#echo "
\n|$phone|$found_count|\n"; + +if ($found_count < 1) +{ + echo "\n"; + echo "\n"; + echo "
\n"; + echo "$phone not found, creating account...\n"; + + if ($DB) {echo "
";}
+	$stmt="SELECT id from users where user_name='$user';";
+	if ($DB) {echo "$stmt\n";}
+	$rslt=mysql_query($stmt, $link);
+	$row=mysql_fetch_row($rslt);
+	$user_id = $row[0];
+	if (!$rslt) {die('Could not execute: ' . mysql_error());}
+
+	$stmt = "INSERT INTO crmentity (smcreatorid, smownerid, modifiedby, setype, description, createdtime, modifiedtime, viewedtime, status, version, presence, deleted) VALUES ('$user_id', '$user_id', 0, 'Accounts', NULL, '$NOW_TIME', '$NOW_TIME', '$NOW_TIME', NULL, 0, 1, 1);";
+	if ($DB) {echo "|$stmt|\n";}
+	$rslt=mysql_query($stmt, $link);
+	$recordID = mysql_insert_id($link);
+	if ($DB) {echo "|$recordID|\n";}
+	if (!$rslt) {die('Could not execute: ' . mysql_error());}
+
+#	$stmt = "INSERT INTO accountscf (accountid, cf_393, cf_397, cf_403, cf_405, cf_407, cf_409, cf_411) VALUES ('$recordID', NULL, NULL, NULL, NULL, NULL, NULL, NULL);";
+#	if ($DB) {echo "|$stmt|\n";}
+#	$rslt=mysql_query($stmt, $link);
+#	if (!$rslt) {die('Could not execute: ' . mysql_error());}
+
+	$stmt = "INSERT INTO account (accountid,accountname,contactname,phone,otherphone,email1) values('$recordID','$last_name, $first_name','$first_name $last_name','$phone','$alt_phone','$email');";
+	if ($DB) {echo "|$stmt|\n";}
+	$rslt=mysql_query($stmt, $link);
+	if (!$rslt) {die('Could not execute: ' . mysql_error());}
+
+	$stmt = "INSERT INTO accountbillads (accountaddressid,city,code,country,state,street) values('$recordID','$city','$postal_code','US','$state','$address1');";
+	if ($DB) {echo "|$stmt|\n";}
+	$rslt=mysql_query($stmt, $link);
+	if (!$rslt) {die('Could not execute: ' . mysql_error());}
+
+	$stmt = "INSERT INTO accountshipads (accountaddressid,city,code,country,state,street) values('$recordID','$city','$postal_code','US','$state','$address1');";
+	if ($DB) {echo "|$stmt|\n";}
+	$rslt=mysql_query($stmt, $link);
+	if (!$rslt) {die('Could not execute: ' . mysql_error());}
+
+	if ($DB) {echo "DONE\n";}
+
+	$account_URL = "http://55.55.55.56/index.php?module=Accounts&action=DetailView&record=$recordID";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "
\n"; + + echo "
";
+	echo "account created!\n";
+	echo "accountid:   $recordID\n";
+	echo "phone:       $phone\n";
+	echo "

"; + +} +else +{ + $stmt="SELECT accountid,accountname,contactname from account where phone='$phone' or otherphone='$phone' or fax='$phone';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $accountid = $row[0]; + $accountname = $row[1]; + $contactname = $row[2]; + + $account_URL = "http://55.55.55.56/index.php?module=Accounts&action=DetailView&record=$accountid"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + + echo "
";
+	echo "account found!\n";
+	echo "accountid:   $accountid\n";
+	echo "phone:       $phone\n";
+	echo "accountname: $accountname\n";
+	echo "contactname: $contactname\n";
+	echo "

"; + +} + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/welcome.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/welcome.php new file mode 100644 index 00000000..f0bad6d9 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_en/welcome.php @@ -0,0 +1,25 @@ + LICENSE: GPLv2 +# + +echo "VICIDIAL Welcome\n"; +echo "\n"; +echo "\n"; +echo "




"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Welcome
 
Agent Login
 
Administration
 
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; + +?> \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_CLOSERstats.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_CLOSERstats.php new file mode 100644 index 00000000..93a7bc05 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_CLOSERstats.php @@ -0,0 +1,617 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1714 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 60905-1326 - Added queue time stats +# 71008-1436 - Added shift to be defined in dbconnect.php +# 71025-0021 - Added status breakdown +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["shift"])) {$shift=$_GET["shift"];} + elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ENVIAR"])) {$ENVIAR=$_GET["ENVIAR"];} + elseif (isset($_POST["ENVIAR"])) {$ENVIAR=$_POST["ENVIAR"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +if (strlen($shift)<2) {$shift='ALL';} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = '';} +if (!isset($query_date)) {$query_date = $NOW_DATE;} + +$stmt="select group_id from vicidial_inbound_groups;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: Estadísticas de VDAD Closer\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "           MODIFICAR | INFORMES \n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "SELECCIONE POR FAVOR Una CAMPAÚA Y La FECHA ARRIBA Y El TECLEO SOMETEN\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$time_BEGIN=$AM_shift_BEGIN;
+	$time_END=$AM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "03:45:00";}   
+	if (strlen($time_END) < 6) {$time_END = "15:15:00";}
+	}
+if ($shift == 'PM') 
+	{
+	$time_BEGIN=$PM_shift_BEGIN;
+	$time_END=$PM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "15:15:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:15:00";}
+	}
+if ($shift == 'ALL') 
+	{
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "00:00:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:59:59";}
+	}
+$query_date_BEGIN = "$query_date $time_BEGIN";   
+$query_date_END = "$query_date $time_END";
+
+
+
+echo "VICIDIAL: Estadísticas de Auto-dial en CLOSER                      $NOW_TIME\n";
+
+echo "\n";
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{$average_hold_seconds = '         0';}
+else
+	{
+	$average_hold_seconds = ($row[1] / $row[0]);
+	$average_hold_seconds = round($average_hold_seconds, 0);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+
+echo "Llamadas dentro de esta campaña $TOTALcalls\n";
+echo "Average Call Length for all Calls:            $average_hold_seconds seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP' and (length_in_sec <= 999 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$DROPcalls =	sprintf("%10s", $row[0]);
+if ( ($DROPcalls < 1) or ($TOTALcalls < 1) )
+	{$DROPpercent = '0';}
+else
+	{
+	$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
+	$DROPpercent = round($DROPpercent, 0);
+	}
+
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{$average_hold_seconds = '         0';}
+else
+	{
+	$average_hold_seconds = ($row[1] / $row[0]);
+	$average_hold_seconds = round($average_hold_seconds, 0);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+
+echo "Total DROP Calls: $DROPcalls  $DROPpercent%\n";
+echo "Average hold time for DROP Calls:             $average_hold_seconds seconds\n";
+
+
+
+##############################
+#########  CALL STATUS STATS
+
+$TOTALcalls = 0;
+
+echo "\n";
+echo "---------- CALL STATUS STATS\n";
+echo "+--------+----------------------+------------+\n";
+echo "| STATUS | DESCRIPTION          | CALLS      |\n";
+echo "+--------+----------------------+------------+\n";
+
+$stmt="SELECT * from vicidial_statuses order by status";
+$rslt=mysql_query($stmt, $link);
+$statuses_to_print = mysql_num_rows($rslt);
+$statuses_list='';
+
+$o=0;
+while ($statuses_to_print > $o) 
+	{
+	$rowx=mysql_fetch_row($rslt);
+	$statname_list["$rowx[0]"] = "$rowx[1]";
+	$o++;
+	}
+
+$stmt="SELECT * from vicidial_campaign_statuses order by status";
+$rslt=mysql_query($stmt, $link);
+$Cstatuses_to_print = mysql_num_rows($rslt);
+
+$o=0;
+while ($Cstatuses_to_print > $o) 
+	{
+	$rowx=mysql_fetch_row($rslt);
+	$statname_list["$rowx[0]"] = "$rowx[1]";
+	$o++;
+	}
+
+$stmt="select count(*),status from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysql_real_escape_string($group) . "' group by status;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$statuses_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $statuses_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$TOTALcalls = ($TOTALcalls + $row[0]);
+
+	$STATUScount =	sprintf("%10s", $row[0]);while(strlen($STATUScount)>10) {$STATUScount = substr("$STATUScount", 0, -1);}
+	$RAWstatus = $row[1];
+	$status =	sprintf("%-6s", $row[1]);while(strlen($status)>6) {$status = substr("$status", 0, -1);}
+
+	if ($non_latin < 1)
+		{
+		 $status_name =	sprintf("%-20s", $statname_list[$RAWstatus]); 
+		 while(strlen($status_name)>20) {$status_name = substr("$status_name", 0, -1);}	
+		}
+	else
+		{
+		 $status_name =	sprintf("%-60s", $statname_list[$RAWstatus]); 
+		 while(mb_strlen($status_name,'utf-8')>20) {$status_name = mb_substr("$status_name", 0, -1,'utf-8');}	
+		}
+
+
+	echo "| $status | $status_name | $STATUScount |\n";
+
+	$i++;
+	}
+
+$TOTALcalls =		sprintf("%10s", $TOTALcalls);
+
+echo "+--------+----------------------+------------+\n";
+echo "| TOTAL:                        | $TOTALcalls |\n";
+echo "+-------------------------------+------------+\n";
+
+
+
+
+echo "\n";
+echo "---------- QUEUE STATS\n";
+
+$stmt="select count(*),sum(queue_seconds) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and (queue_seconds > 0);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$QUEUEcalls =	sprintf("%10s", $row[0]);
+if ( ($QUEUEcalls < 1) or ($TOTALcalls < 1) )
+	{$QUEUEpercent = '0';}
+else
+	{
+	$QUEUEpercent = (($QUEUEcalls / $TOTALcalls) * 100);
+	$QUEUEpercent = round($QUEUEpercent, 0);
+	}
+
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{$average_queue_seconds = '         0';}
+else
+	{
+	$average_queue_seconds = ($row[1] / $row[0]);
+	$average_queue_seconds = round($average_queue_seconds, 2);
+	$average_queue_seconds = sprintf("%10.2f", $average_queue_seconds);
+	}
+
+if ( ($TOTALcalls < 1) or ($row[1] < 1) )
+	{$average_total_queue_seconds = '         0';}
+else
+	{
+	$average_total_queue_seconds = ($row[1] / $TOTALcalls);
+	$average_total_queue_seconds = round($average_total_queue_seconds, 2);
+	$average_total_queue_seconds = sprintf("%10.2f", $average_total_queue_seconds);
+	}
+
+echo "Total Calls That entered Queue:               $QUEUEcalls  $QUEUEpercent%\n";
+echo "Average QUEUE Length for queue calls:         $average_queue_seconds seconds\n";
+echo "Average QUEUE Length across all calls:        $average_total_queue_seconds seconds\n";
+
+
+##############################
+#########  USER STATS
+
+$TOTagents=0;
+$TOTcalls=0;
+$TOTtime=0;
+$TOTavg=0;
+
+echo "\n";
+echo "---------- AGENTE STATS\n";
+echo "+--------------------------+------------+----------+--------+\n";
+echo "| AGENTE                    | CALLS      | TIME M   | AVRG M |\n";
+echo "+--------------------------+------------+----------+--------+\n";
+
+$stmt="select vicidial_closer_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_closer_log,vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysql_real_escape_string($group) . "' and vicidial_closer_log.user is not null and length_in_sec is not null and length_in_sec > 4 and vicidial_closer_log.user=vicidial_users.user group by vicidial_closer_log.user;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$TOTcalls = ($TOTcalls + $row[2]);
+	$TOTtime = ($TOTtime + $row[3]);
+
+	$user =			sprintf("%-6s", $row[0]);
+	$full_name =	sprintf("%-15s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
+	$USERcalls =	sprintf("%10s", $row[2]);
+	$USERtotTALK =	$row[3];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$USERtotTALK_MS =		sprintf("%8s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $user - $full_name | $USERcalls | $USERtotTALK_MS | $USERavgTALK_MS |\n";
+
+	$i++;
+	}
+
+if (!$TOTcalls) {$TOTcalls = 1;}
+$TOTavg = ($TOTtime / $TOTcalls);
+$TOTavg = round($TOTavg, 0);
+$TOTavg_M = ($TOTavg / 60);
+$TOTavg_M = round($TOTavg_M, 2);
+$TOTavg_M_int = intval("$TOTavg_M");
+$TOTavg_S = ($TOTavg_M - $TOTavg_M_int);
+$TOTavg_S = ($TOTavg_S * 60);
+$TOTavg_S = round($TOTavg_S, 0);
+if ($TOTavg_S < 10) {$TOTavg_S = "0$TOTavg_S";}
+$TOTavg_MS = "$TOTavg_M_int:$TOTavg_S";
+$TOTavg =		sprintf("%6s", $TOTavg_MS);
+
+$TOTtime_M = ($TOTtime / 60);
+$TOTtime_M = 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 ($TOTtime_S < 10) {$TOTtime_S = "0$TOTtime_S";}
+$TOTtime_MS = "$TOTtime_M_int:$TOTtime_S";
+$TOTtime =		sprintf("%6s", $TOTtime_MS);
+
+$TOTagents =		sprintf("%10s", $i);
+$TOTcalls =			sprintf("%10s", $TOTcalls);
+$TOTtime =			sprintf("%8s", $TOTtime);
+$TOTavg =			sprintf("%6s", $TOTavg);
+
+echo "+--------------------------+------------+----------+--------+\n";
+echo "| TOTAL Agents: $TOTagents | $TOTcalls | $TOTtime | $TOTavg |\n";
+echo "+--------------------------+------------+----------+--------+\n";
+
+
+##############################
+#########  TIME STATS
+
+echo "\n";
+echo "---------- ESTADÃSTICAS DEL TIEMPO\n";
+
+echo "\n";
+
+$hi_hour_count=0;
+$last_full_record=0;
+$i=0;
+$h=0;
+while ($i <= 96)
+	{
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+	$h++;
+	}
+
+if ($hi_hour_count < 1)
+	{$hour_multiplier = 0;}
+else
+	{
+	$hour_multiplier = (100 / $hi_hour_count);
+	#$hour_multiplier = round($hour_multiplier, 0);
+	}
+
+echo "\n";
+echo "GRÃFICO EN 15 INCREMENTOS MINUCIOSOS DE LAS LLAMADAS TOTALES PUESTAS DE ESTA CAMPAÚA\n";
+
+$k=1;
+$Mk=0;
+$call_scale = '0';
+while ($k <= 102) 
+	{
+	if ($Mk >= 5) 
+		{
+		$Mk=0;
+		if ( ($k < 1) or ($hour_multiplier <= 0) )
+			{$scale_num = 100;}
+		else
+			{
+			$scale_num=($k / $hour_multiplier);
+			$scale_num = round($scale_num, 0);
+			}
+		$LENscale_num = (strlen($scale_num));
+		$k = ($k + $LENscale_num);
+		$call_scale .= "$scale_num";
+		}
+	else
+		{
+		$call_scale .= " ";
+		$k++;   $Mk++;
+		}
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+$ZZ = '00';
+$i=0;
+$h=4;
+$hour= -1;
+$no_lines_yet=1;
+
+while ($i <= 96)
+	{
+	$char_counter=0;
+	$time = '      ';
+	if ($h >= 4) 
+		{
+		$hour++;
+		$h=0;
+		if ($hour < 10) {$hour = "0$hour";}
+		$time = "+$hour$ZZ+";
+		}
+	if ($h == 1) {$time = "   15 ";}
+	if ($h == 2) {$time = "   30 ";}
+	if ($h == 3) {$time = "   45 ";}
+	$Ghour_count = $hour_count[$i];
+	if ($Ghour_count < 1) 
+		{
+		if ( ($no_lines_yet) or ($i > $last_full_record) )
+			{
+			$do_nothing=1;
+			}
+		else
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			echo "|$time|";
+			$k=0;   while ($k <= 102) {echo " ";   $k++;}
+			echo "| $hour_count[$i] |\n";
+			}
+		}
+	else
+		{
+		$no_lines_yet=0;
+		$Xhour_count = ($Ghour_count * $hour_multiplier);
+		$Yhour_count = (99 - $Xhour_count);
+
+		$Gdrop_count = $drop_count[$i];
+		if ($Gdrop_count < 1) 
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "*X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 101) {echo " ";   $char_counter++;}
+			echo "| 0     | $hour_count[$i] |\n";
+
+			}
+		else
+			{
+			$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+		#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+			$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+			echo "D";   $char_counter++;
+			$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 102) {echo " ";   $char_counter++;}
+			echo "| $drop_count[$i] | $hour_count[$i] |\n";
+			}
+		}
+	
+	
+	$i++;
+	$h++;
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n\n";
+
+
+
+
+
+$ENDtime = date("U");
+$RUNtime = ($ENDtime - $STARTtime);
+echo "\nRun Time: $RUNtime seconds\n";
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_VDADstats.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_VDADstats.php new file mode 100644 index 00000000..c8a5109c --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_VDADstats.php @@ -0,0 +1,647 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1718 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 61215-1139 - Added drop percentage of answered and round-2 decimal +# 71008-1436 - Added shift to be defined in dbconnect.php +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["shift"])) {$shift=$_GET["shift"];} + elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ENVIAR"])) {$ENVIAR=$_GET["ENVIAR"];} + elseif (isset($_POST["ENVIAR"])) {$ENVIAR=$_POST["ENVIAR"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +if (strlen($shift)<2) {$shift='ALL';} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = '';} +if (!isset($query_date)) {$query_date = $NOW_DATE;} + +$stmt="select campaign_id from vicidial_campaigns;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: VDAD Stats\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "           MODIFICAR | INFORMES \n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "SELECCIONE POR FAVOR Una CAMPAÚA Y La FECHA ARRIBA Y El TECLEO SOMETEN\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$time_BEGIN=$AM_shift_BEGIN;
+	$time_END=$AM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "03:45:00";}   
+	if (strlen($time_END) < 6) {$time_END = "15:15:00";}
+	}
+if ($shift == 'PM') 
+	{
+	$time_BEGIN=$PM_shift_BEGIN;
+	$time_END=$PM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "15:15:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:15:00";}
+	}
+if ($shift == 'ALL') 
+	{
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "00:00:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:59:59";}
+	}
+$query_date_BEGIN = "$query_date $time_BEGIN";   
+$query_date_END = "$query_date $time_END";
+
+
+
+echo "VICIDIAL: Auto-dial Stats                             $NOW_TIME\n";
+
+echo "\n";
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{$average_hold_seconds = '         0';}
+else
+	{
+	$average_hold_seconds = ($row[1] / $row[0]);
+	$average_hold_seconds = round($average_hold_seconds, 2);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+echo "Llamadas dentro de esta campaña $TOTALcalls\n";
+echo "Longitud media para las llamadas en segundos: $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP' and (length_in_sec <= 60 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$DROPcalls =	sprintf("%10s", $row[0]);
+$DROPcallsRAW =	$row[0];
+$DROPseconds =	$row[1];
+
+$stmt="select count(*) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and status NOT IN('NA','B');";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$ANSWERcalls =	$row[0];
+
+if ( ($DROPcalls < 1) or ($TOTALcalls < 1) )
+	{$DROPpercent = '0';}
+else
+	{
+	$DROPpercent = (($DROPcallsRAW / $TOTALcalls) * 100);
+	$DROPpercent = round($DROPpercent, 2);
+	}
+
+if ( ($DROPcalls < 1) or ($ANSWERcalls < 1) )
+	{$DROPANSWERpercent = '0';}
+else
+	{
+	$DROPANSWERpercent = (($DROPcallsRAW / $ANSWERcalls) * 100);
+	$DROPANSWERpercent = round($DROPANSWERpercent, 2);
+	}
+
+if ( ($DROPseconds < 1) or ($DROPcallsRAW < 1) )
+	{$average_hold_seconds = '         0';}
+else
+	{
+	$average_hold_seconds = ($DROPseconds / $DROPcallsRAW);
+	$average_hold_seconds = round($average_hold_seconds, 2);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+
+echo "Total DROP Calls: $DROPcalls  $DROPpercent%\n";
+echo "Percent of DROP Calls taken out of Answers:   $DROPcalls / $ANSWERcalls  $DROPANSWERpercent%\n";
+echo "Longitud media para las llamadas DROP en segundos:    $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- AUTO-DIAL SIN RESPUESTA\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and status IN('NA','B') and (length_in_sec <= 60 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$NAcalls =	sprintf("%10s", $row[0]);
+if ( ($NAcalls < 1) or ($TOTALcalls < 1) )
+	{$NApercent = '0';}
+else
+	{
+	$NApercent = (($NAcalls / $TOTALcalls) * 100);
+	$NApercent = round($NApercent, 2);
+	}
+
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{$average_na_seconds = '         0';}
+else
+	{
+	$average_na_seconds = ($row[1] / $row[0]);
+	$average_na_seconds = round($average_na_seconds, 2);
+	$average_na_seconds =	sprintf("%10s", $average_na_seconds);
+	}
+
+echo "Total NA calls -Busy,Disconnect,RingNoAnswer: $NAcalls  $NApercent%\n";
+echo "Longitud media para las Llamadas sin Respuesta en segundos:       $average_na_seconds\n";
+
+
+##############################
+#########  CALL STATUS STATS
+
+$TOTALcalls = 0;
+
+echo "\n";
+echo "---------- CALL STATUS STATS\n";
+echo "+--------+----------------------+------------+\n";
+echo "| STATUS | DESCRIPTION          | CALLS      |\n";
+echo "+--------+----------------------+------------+\n";
+
+$stmt="SELECT * from vicidial_statuses order by status";
+$rslt=mysql_query($stmt, $link);
+$statuses_to_print = mysql_num_rows($rslt);
+$statuses_list='';
+
+$o=0;
+while ($statuses_to_print > $o) 
+	{
+	$rowx=mysql_fetch_row($rslt);
+	$statname_list["$rowx[0]"] = "$rowx[1]";
+	$o++;
+	}
+
+$stmt="SELECT * from vicidial_campaign_statuses where campaign_id='" . mysql_real_escape_string($group) . "' order by status";
+$rslt=mysql_query($stmt, $link);
+$Cstatuses_to_print = mysql_num_rows($rslt);
+
+$o=0;
+while ($Cstatuses_to_print > $o) 
+	{
+	$rowx=mysql_fetch_row($rslt);
+	$statname_list["$rowx[0]"] = "$rowx[1]";
+	$o++;
+	}
+
+$stmt="select count(*),status from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysql_real_escape_string($group) . "' group by status;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$statuses_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $statuses_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$TOTALcalls = ($TOTALcalls + $row[0]);
+
+	$STATUScount =	sprintf("%10s", $row[0]);while(strlen($STATUScount)>10) {$STATUScount = substr("$STATUScount", 0, -1);}
+	$RAWstatus = $row[1];
+	$status =	sprintf("%-6s", $row[1]);while(strlen($status)>6) {$status = substr("$status", 0, -1);}
+
+	if ($non_latin < 1)
+		{
+		 $status_name =	sprintf("%-20s", $statname_list[$RAWstatus]); 
+		 while(strlen($status_name)>20) {$status_name = substr("$status_name", 0, -1);}	
+		}
+	else
+		{
+		 $status_name =	sprintf("%-60s", $statname_list[$RAWstatus]); 
+		 while(mb_strlen($status_name,'utf-8')>20) {$status_name = mb_substr("$status_name", 0, -1,'utf-8');}	
+		}
+
+
+	echo "| $status | $status_name | $STATUScount |\n";
+
+	$i++;
+	}
+
+$TOTALcalls =		sprintf("%10s", $TOTALcalls);
+
+echo "+--------+----------------------+------------+\n";
+echo "| TOTAL:                        | $TOTALcalls |\n";
+echo "+-------------------------------+------------+\n";
+
+
+##############################
+#########  USER STATS
+
+$TOTagents=0;
+$TOTcalls=0;
+$TOTtime=0;
+$TOTavg=0;
+
+echo "\n";
+echo "---------- AGENTE STATS\n";
+echo "+--------------------------+------------+----------+--------+\n";
+echo "| AGENTE                    | CALLS      | TIME M   | AVRG M |\n";
+echo "+--------------------------+------------+----------+--------+\n";
+
+$stmt="select vicidial_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_log,vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysql_real_escape_string($group) . "' and vicidial_log.user is not null and length_in_sec is not null and length_in_sec > 4 and vicidial_log.user=vicidial_users.user group by vicidial_log.user;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$TOTcalls = ($TOTcalls + $row[2]);
+	$TOTtime = ($TOTtime + $row[3]);
+
+	$user =	sprintf("%-6s", $row[0]);while(strlen($user)>6) {$user = substr("$user", 0, -1);}
+	if ($non_latin < 1)
+	{
+ 	 $full_name =	sprintf("%-15s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}	
+	}
+	else
+	{
+	 $full_name =	sprintf("%-45s", $row[1]); while(mb_strlen($full_name,'utf-8')>15) {$full_name = mb_substr("$full_name", 0, -1,'utf-8');}	
+	}
+	$USERcalls =	sprintf("%10s", $row[2]);
+	$USERtotTALK =	$row[3];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$USERtotTALK_MS =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $user - $full_name | $USERcalls |   $USERtotTALK_MS | $USERavgTALK_MS |\n";
+
+	$i++;
+	}
+
+if (!$TOTcalls) {$TOTcalls = 1;}
+$TOTavg = ($TOTtime / $TOTcalls);
+$TOTavg = round($TOTavg, 0);
+$TOTavg_M = ($TOTavg / 60);
+$TOTavg_M = round($TOTavg_M, 2);
+$TOTavg_M_int = intval("$TOTavg_M");
+$TOTavg_S = ($TOTavg_M - $TOTavg_M_int);
+$TOTavg_S = ($TOTavg_S * 60);
+$TOTavg_S = round($TOTavg_S, 0);
+if ($TOTavg_S < 10) {$TOTavg_S = "0$TOTavg_S";}
+$TOTavg_MS = "$TOTavg_M_int:$TOTavg_S";
+$TOTavg =		sprintf("%6s", $TOTavg_MS);
+
+$TOTtime_M = ($TOTtime / 60);
+$TOTtime_M = 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 ($TOTtime_S < 10) {$TOTtime_S = "0$TOTtime_S";}
+$TOTtime_MS = "$TOTtime_M_int:$TOTtime_S";
+$TOTtime =		sprintf("%6s", $TOTtime_MS);
+
+$TOTagents =		sprintf("%10s", $i);
+$TOTcalls =			sprintf("%10s", $TOTcalls);
+$TOTtime =			sprintf("%8s", $TOTtime);
+$TOTavg =			sprintf("%6s", $TOTavg);
+
+$stmt="select avg(wait_sec) from vicidial_agent_log where event_time >= '$query_date_BEGIN' and event_time <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$AVGwait = $row[0];
+$AVGwait_M = ($AVGwait / 60);
+$AVGwait_M = round($AVGwait_M, 2);
+$AVGwait_M_int = intval("$AVGwait_M");
+$AVGwait_S = ($AVGwait_M - $AVGwait_M_int);
+$AVGwait_S = ($AVGwait_S * 60);
+$AVGwait_S = round($AVGwait_S, 0);
+if ($AVGwait_S < 10) {$AVGwait_S = "0$AVGwait_S";}
+$AVGwait_MS = "$AVGwait_M_int:$AVGwait_S";
+$AVGwait =		sprintf("%6s", $AVGwait_MS);
+
+echo "+--------------------------+------------+----------+--------+\n";
+echo "| TOTAL Agents: $TOTagents | $TOTcalls | $TOTtime | $TOTavg |\n";
+echo "+--------------------------+------------+----------+--------+\n";
+echo "| Average Wait time between calls                    $AVGwait |\n";
+echo "+-----------------------------------------------------------+\n";
+
+##############################
+#########  TIME STATS
+
+echo "\n";
+echo "---------- ESTADÃSTICAS DEL TIEMPO\n";
+
+echo "\n";
+
+$hi_hour_count=0;
+$last_full_record=0;
+$i=0;
+$h=0;
+while ($i <= 96)
+	{
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+	$h++;
+	}
+
+if ($hi_hour_count < 1)
+	{$hour_multiplier = 0;}
+else
+	{
+	$hour_multiplier = (100 / $hi_hour_count);
+	#$hour_multiplier = round($hour_multiplier, 0);
+	}
+
+echo "\n";
+echo "GRÃFICO EN 15 INCREMENTOS MINUCIOSOS DE LAS LLAMADAS TOTALES PUESTAS DE ESTA CAMPAÚA\n";
+
+$k=1;
+$Mk=0;
+$call_scale = '0';
+while ($k <= 102) 
+	{
+	if ($Mk >= 5) 
+		{
+		$Mk=0;
+		if ( ($k < 1) or ($hour_multiplier <= 0) )
+			{$scale_num = 100;}
+		else
+			{
+			$scale_num=($k / $hour_multiplier);
+			$scale_num = round($scale_num, 0);
+			}
+		$LENscale_num = (strlen($scale_num));
+		$k = ($k + $LENscale_num);
+		$call_scale .= "$scale_num";
+		}
+	else
+		{
+		$call_scale .= " ";
+		$k++;   $Mk++;
+		}
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+$ZZ = '00';
+$i=0;
+$h=4;
+$hour= -1;
+$no_lines_yet=1;
+
+while ($i <= 96)
+	{
+	$char_counter=0;
+	$time = '      ';
+	if ($h >= 4) 
+		{
+		$hour++;
+		$h=0;
+		if ($hour < 10) {$hour = "0$hour";}
+		$time = "+$hour$ZZ+";
+		}
+	if ($h == 1) {$time = "   15 ";}
+	if ($h == 2) {$time = "   30 ";}
+	if ($h == 3) {$time = "   45 ";}
+	$Ghour_count = $hour_count[$i];
+	if ($Ghour_count < 1) 
+		{
+		if ( ($no_lines_yet) or ($i > $last_full_record) )
+			{
+			$do_nothing=1;
+			}
+		else
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			echo "|$time|";
+			$k=0;   while ($k <= 102) {echo " ";   $k++;}
+			echo "| $hour_count[$i] |\n";
+			}
+		}
+	else
+		{
+		$no_lines_yet=0;
+		$Xhour_count = ($Ghour_count * $hour_multiplier);
+		$Yhour_count = (99 - $Xhour_count);
+
+		$Gdrop_count = $drop_count[$i];
+		if ($Gdrop_count < 1) 
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "*X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 101) {echo " ";   $char_counter++;}
+			echo "| 0     | $hour_count[$i] |\n";
+
+			}
+		else
+			{
+			$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+		#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+			$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+			echo "D";   $char_counter++;
+			$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 102) {echo " ";   $char_counter++;}
+			echo "| $drop_count[$i] | $hour_count[$i] |\n";
+			}
+		}
+	
+	
+	$i++;
+	$h++;
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+
+
+
+
+
+$ENDtime = date("U");
+$RUNtime = ($ENDtime - $STARTtime);
+echo "\nRun Time: $RUNtime seconds\n";
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_VICIDIAL_hopperlist.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_VICIDIAL_hopperlist.php new file mode 100644 index 00000000..5969cfd1 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_VICIDIAL_hopperlist.php @@ -0,0 +1,169 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1654 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 70115-1614 - Added ALT field for vicidial_hopper alt_dial column +# 71029-0852 - Added list_id to the output +# 71030-2118 - Added priority to display +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ENVIAR"])) {$ENVIAR=$_GET["ENVIAR"];} + elseif (isset($_POST["ENVIAR"])) {$ENVIAR=$_POST["ENVIAR"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and modify_campaigns='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = '';} +if (!isset($query_date)) {$query_date = $NOW_DATE;} +if (!isset($server_ip)) {$server_ip = '10.10.10.15';} + +$stmt="select campaign_id,campaign_name from vicidial_campaigns order by campaign_id;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$campaigns_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $campaigns_to_print) + { + $row=mysql_fetch_row($rslt); + $campaign_id[$i] =$row[0]; + $campaign_name[$i] =$row[1]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: Lista De Hopper\n"; +echo "
\n"; +#echo "\n"; +#echo "\n"; +echo "\n"; +echo "\n"; +echo "           MODIFICAR \n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "SELECCIONE POR FAVOR Una CAMPAÚA ARRIBA Y El TECLEO SOMETE\n";
+}
+
+else
+{
+
+
+echo "VICIDIAL: Live Current Lista De Hopper                      $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+
+echo "Total de Leads en el hopper ahora mismo:       $TOTALcalls\n";
+
+
+##############################
+#########  LEAD STATS
+
+echo "\n";
+echo "---------- LEADS IN HOPPER\n";
+echo "+------+--------+-----------+------------+------------+-------+--------+-------+--------+-------+\n";
+echo "|ORDER |PRIORITY| LEAD ID   | ID DE LA LISTA    | PHONE NUM  | STATE | STATUS | COUNT | GMT    | ALT   |\n";
+echo "+------+--------+-----------+------------+------------+-------+--------+-------+--------+-------+\n";
+
+$stmt="select vicidial_hopper.lead_id,phone_number,vicidial_hopper.state,vicidial_list.status,called_count,vicidial_hopper.gmt_offset_now,hopper_id,alt_dial,vicidial_hopper.list_id,vicidial_hopper.priority from vicidial_hopper,vicidial_list where vicidial_hopper.campaign_id='" . mysql_real_escape_string($group) . "' and vicidial_hopper.lead_id=vicidial_list.lead_id order by priority desc,hopper_id limit 2000;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$FMT_i =		sprintf("%-4s", $i);
+	$lead_id =		sprintf("%-9s", $row[0]);
+	$phone_number =	sprintf("%-10s", $row[1]);
+	$state =		sprintf("%-5s", $row[2]);
+	$status =		sprintf("%-6s", $row[3]);
+	$count =		sprintf("%-5s", $row[4]);
+	$gmt =			sprintf("%-6s", $row[5]);
+	$hopper_id =	sprintf("%-6s", $row[6]);
+	$alt_dial =		sprintf("%-5s", $row[7]);
+	$list_id =		sprintf("%-10s", $row[8]);
+	$priority =		sprintf("%-6s", $row[9]);
+
+if ($DB) {echo "| $FMT_i | $priority | $lead_id | $list_id | $phone_number | $state | $status | $count | $gmt | $hopper_id |\n";}
+else {echo "| $FMT_i | $priority | $lead_id | $list_id | $phone_number | $state | $status | $count | $gmt | $alt_dial |\n";}
+
+	$i++;
+	}
+
+echo "+------+--------+-----------+------------+------------+-------+--------+-------+--------+-------+\n";
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_admin_log_display.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_admin_log_display.php new file mode 100644 index 00000000..f7936b12 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_admin_log_display.php @@ -0,0 +1,118 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ENVIAR"])) {$ENVIAR=$_GET["ENVIAR"];} + elseif (isset($_POST["ENVIAR"])) {$ENVIAR=$_POST["ENVIAR"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); +$query_date = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$query_date); + +# AST GUI database administration +# AST_admin_log_display.php +# +# CHANGES +# 50325-0932 - First build +# 51123-1443 - removed globals=on requirement +# 60421-1229 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60620-1044 - Added variable filtering to eliminate SQL injection attack threat +# + +$version = '0.0.4'; +$build = '60620-1044'; + +$STARTtime = date("U"); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 8 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDIAL ADMIN LOG DISPLAY"; +echo "\n"; + +# Fri, 25 Mar 2005 + +$DAY_DATE = date("j"); +if ($DAY_DATE < 10) +# {$GREP_DATE = date("D, j M Y");} + {$GREP_DATE = date("D, 0j M Y");} +else + {$GREP_DATE = date("D, j M Y");} + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!$query_date) {$query_date = $GREP_DATE;} + +$Gquery_date = eregi_replace(" ",'\ ',$query_date); +echo "\n"; + +echo "
\n"; +echo "\n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+echo "VICIDIAL ADMIN CHANGE LOG                             $NOW_TIME\n";
+
+#passthru("grep $Gquery_date /home/www/htdocs/vicidial/admin_changes_log.txt");
+passthru("grep $Gquery_date $WeBServeRRooT/vicidial/admin_changes_log.txt");
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_agent_performance.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_agent_performance.php new file mode 100644 index 00000000..220a5be5 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_agent_performance.php @@ -0,0 +1,257 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1711 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 70201-1203 - Added non_latin UTF8 output code, widened USER ID to 8 chars +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["shift"])) {$shift=$_GET["shift"];} + elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ENVIAR"])) {$ENVIAR=$_GET["ENVIAR"];} + elseif (isset($_POST["ENVIAR"])) {$ENVIAR=$_POST["ENVIAR"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + 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($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = '';} +if (!isset($query_date)) {$query_date = $NOW_DATE;} + +$stmt="select campaign_id from vicidial_campaigns;"; +if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$campaigns_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $campaigns_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: Agent Performance\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "           MODIFICAR | INFORMES \n"; +echo "
\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A SERVIDOR AND DATE-TIME ABOVE AND CLICK ENVIAR\n";
+echo " NOTE: stats taken from 6 hour shift specified\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$query_date_BEGIN = "$query_date 08:45:00";   
+	$query_date_END = "$query_date 15:33:00";
+	$time_BEGIN = "08:45:00";   
+	$time_END = "15:33:00";
+	}
+if ($shift == 'PM') 
+	{
+	$query_date_BEGIN = "$query_date 15:33:00";   
+	$query_date_END = "$query_date 23:15:00";
+	$time_BEGIN = "15:33:00";   
+	$time_END = "23:15:00";
+	}
+
+echo "VICIDIAL: Agent Performance                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENTS Details -------------\n\n";
+
+echo "+-----------------+----------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+echo "| USER NAME       | ID       | CALLS  | TALK   | TALKAVG| A    | B    | DC   | DNC  | N    | NI   | SALE |\n";
+echo "+-----------------+----------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+
+$stmt="select count(*) as calls,sum(length_in_sec) as talk,full_name,vicidial_users.user,avg(length_in_sec) from vicidial_users,vicidial_log where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN' and vicidial_users.user=vicidial_log.user and campaign_id='" . mysql_real_escape_string($group) . "' group by full_name order by calls desc limit 1000;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$TOTcalls=($TOTcalls + $row[0]);
+	$TOTtotTALK=($TOTtotTALK + $row[1]);
+	$calls[$i] =	sprintf("%-6s", $row[0]);
+
+	if ($non_latin < 1)
+	{
+   	 $full_name[$i]=	sprintf("%-15s", $row[2]); 
+	 while(strlen($full_name[$i])>15) {$full_name[$i] = substr("$full_name[$i]", 0, -1);}
+
+	 $user[$i] =		sprintf("%-6s", $row[3]);
+        while(strlen($user[$i])>6) {$user[$i] = substr("$user[$i]", 0, -1);}
+       }
+	else
+	{	
+        $full_name[$i]=	sprintf("%-45s", $row[2]); 
+	 while(mb_strlen($full_name[$i],'utf-8')>15) {$full_name[$i] = mb_substr("$full_name[$i]", 0, -1,'utf-8');}
+
+ 	 $user[$i] =		sprintf("%-18s", $row[3]);
+	 while(mb_strlen($user[$i],'utf-8')>6) {$user[$i] = mb_substr("$user[$i]", 0, -1,'utf-8');}
+	}
+
+	$user[$i] =		sprintf("%-8s", $row[3]);
+	$USERtotTALK =	$row[1];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$pfUSERtotTALK_MS[$i] =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$pfUSERavgTALK_MS[$i] =		sprintf("%6s", $USERavgTALK_MS);
+	$i++;
+	}
+
+$k=0;
+while($k < $i)
+	{
+	$ctA[$k]="0   "; $ctB[$k]="0   "; $ctDC[$k]="0   "; $ctDNC[$k]="0   "; $ctN[$k]="0   "; $ctNI[$k]="0   "; $ctSALE[$k]="0   "; 
+	$stmt="select count(*),status from vicidial_log where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN' and user='$user[$k]' and campaign_id='" . mysql_real_escape_string($group) . "' group by status;";
+	if ($non_latin > 0)
+	{
+	$rslt=mysql_query("SET NAMES 'UTF8'");
+	}
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$rows_to_print = mysql_num_rows($rslt);
+	$m=0;
+	while ($m < $rows_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if ($row[1] == 'A') {$ctA[$k]=sprintf("%-4s", $row[0]);		$TOT_A = ($TOT_A + $row[0]);}
+		if ($row[1] == 'B') {$ctB[$k]=sprintf("%-4s", $row[0]);		$TOT_B = ($TOT_B + $row[0]);}
+		if ($row[1] == 'DC') {$ctDC[$k]=sprintf("%-4s", $row[0]);	$TOT_DC = ($TOT_DC + $row[0]);}
+		if ($row[1] == 'DNC') {$ctDNC[$k]=sprintf("%-4s", $row[0]);	$TOT_DNC = ($TOT_DNC + $row[0]);}
+		if ($row[1] == 'N') {$ctN[$k]=sprintf("%-4s", $row[0]);		$TOT_N = ($TOT_N + $row[0]);}
+		if ($row[1] == 'NI') {$ctNI[$k]=sprintf("%-4s", $row[0]);	$TOT_NI = ($TOT_NI + $row[0]);}
+		if (($row[1] == 'SALE') || ($row[1] == 'XFER') ) {$ctSALE[$k]=sprintf("%-4s", $row[0]);	$TOT_SALE = ($TOT_SALE + $row[0]);}
+		$m++;
+		}
+	echo "| $full_name[$k] | $user[$k] | $calls[$k] | $pfUSERtotTALK_MS[$k] | $pfUSERavgTALK_MS[$k] | $ctA[$k] | $ctB[$k] | $ctDC[$k] | $ctDNC[$k] | $ctN[$k] | $ctNI[$k] | $ctSALE[$k] |\n";
+
+
+
+	$k++;
+	}
+
+	$TOTcalls =	sprintf("%-7s", $TOTcalls);
+
+	$TOTtotTALK_M = ($TOTtotTALK / 60);
+	$TOTtotTALK_M = round($TOTtotTALK_M, 2);
+	$TOTtotTALK_M_int = intval("$TOTtotTALK_M");
+	$TOTtotTALK_S = ($TOTtotTALK_M - $TOTtotTALK_M_int);
+	$TOTtotTALK_S = ($TOTtotTALK_S * 60);
+	$TOTtotTALK_S = round($TOTtotTALK_S, 0);
+	if ($TOTtotTALK_S < 10) {$TOTtotTALK_S = "0$TOTtotTALK_S";}
+	$TOTtotTALK_MS = "$TOTtotTALK_M_int:$TOTtotTALK_S";
+	$TOTtotTALK_MS =		sprintf("%7s", $TOTtotTALK_MS);
+		while(strlen($TOTtotTALK_MS)>7) {$TOTtotTALK_MS = substr("$TOTtotTALK_MS", 0, -1);}
+
+	$TOT_A = sprintf("%-5s", $TOT_A);
+	$TOT_B = sprintf("%-5s", $TOT_B);
+	$TOT_DC = sprintf("%-5s", $TOT_DC);
+	$TOT_DNC = sprintf("%-5s", $TOT_DNC);
+	$TOT_N = sprintf("%-5s", $TOT_N);
+	$TOT_NI = sprintf("%-5s", $TOT_NI);
+	$TOT_SALE = sprintf("%-5s", $TOT_SALE);
+
+echo "+-----------------+----------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+echo "|  TOTALS                    | $TOTcalls| $TOTtotTALK_MS|        | $TOT_A| $TOT_B| $TOT_DC| $TOT_DNC| $TOT_N| $TOT_NI| $TOT_SALE|\n";
+echo "+-----------------+----------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+
+echo "\n";
+
+}
+
+
+
+?>
+
+
\ No newline at end of file
diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_agent_performance_detail.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_agent_performance_detail.php
new file mode 100644
index 00000000..bce7e506
--- /dev/null
+++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_agent_performance_detail.php
@@ -0,0 +1,557 @@
+    LICENSE: GPLv2
+###
+# CHANGES
+#
+# 71119-2359 - First build
+# 71121-0144 - Replace existing AST_agent_performance_detail.php script with this one
+#            - Fixed zero division bug
+#
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+if (isset($_GET["query_date"]))				{$query_date=$_GET["query_date"];}
+	elseif (isset($_POST["query_date"]))	{$query_date=$_POST["query_date"];}
+if (isset($_GET["group"]))				{$group=$_GET["group"];}
+	elseif (isset($_POST["group"]))		{$group=$_POST["group"];}
+if (isset($_GET["user_group"]))				{$user_group=$_GET["user_group"];}
+	elseif (isset($_POST["user_group"]))	{$user_group=$_POST["user_group"];}
+if (isset($_GET["shift"]))				{$shift=$_GET["shift"];}
+	elseif (isset($_POST["shift"]))		{$shift=$_POST["shift"];}
+if (isset($_GET["submit"]))				{$submit=$_GET["submit"];}
+	elseif (isset($_POST["submit"]))	{$submit=$_POST["submit"];}
+if (isset($_GET["ENVIAR"]))				{$ENVIAR=$_GET["ENVIAR"];}
+	elseif (isset($_POST["ENVIAR"]))	{$ENVIAR=$_POST["ENVIAR"];}
+
+if (strlen($shift)<2) {$shift='ALL';}
+
+$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
+$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
+
+	$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
+	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($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
+	{
+    Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
+    Header("HTTP/1.0 401 Unauthorized");
+    echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
+    exit;
+	}
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!isset($group)) {$group = '';}
+if (!isset($query_date)) {$query_date = $NOW_DATE;}
+
+$stmt="select campaign_id from vicidial_campaigns;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$campaigns_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $campaigns_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$groups[$i] =$row[0];
+	$i++;
+	}
+$stmt="select user_group from vicidial_user_groups;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$user_groups_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $user_groups_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$user_groups[$i] =$row[0];
+	$i++;
+	}
+?>
+
+
+
+
+
+\n";
+echo "VICIDIAL: Agent Performance\n";
+echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "           MODIFICAR | INFORMES \n"; +echo "
\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A CAMPAIGN AND DATE-TIME ABOVE AND CLICK ENVIAR\n";
+echo " NOTE: stats taken from shift specified\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$time_BEGIN=$AM_shift_BEGIN;
+	$time_END=$AM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "03:45:00";}   
+	if (strlen($time_END) < 6) {$time_END = "15:15:00";}
+	}
+if ($shift == 'PM') 
+	{
+	$time_BEGIN=$PM_shift_BEGIN;
+	$time_END=$PM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "15:15:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:15:00";}
+	}
+if ($shift == 'ALL') 
+	{
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "00:00:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:59:59";}
+	}
+$query_date_BEGIN = "$query_date $time_BEGIN";   
+$query_date_END = "$query_date $time_END";
+
+if (strlen($user_group)>0) {$ugSQL="and vicidial_agent_log.user_group='$user_group'";}
+else {$ugSQL='';}
+
+echo "VICIDIAL: Agent Performance Detail                        $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENTS Details -------------\n\n";
+
+
+
+
+
+$statuses='-';
+$statusesTXT='';
+$statusesHEAD='';
+$statusesHTML='';
+$statusesARY[0]='';
+$j=0;
+$users='-';
+$usersARY[0]='';
+$user_namesARY[0]='';
+$k=0;
+
+$stmt="select count(*) as calls,sum(talk_sec) as talk,full_name,vicidial_users.user,sum(pause_sec),sum(wait_sec),sum(dispo_sec),status from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user and campaign_id='" . mysql_real_escape_string($group) . "' and pause_sec<36000 and wait_sec<36000 and talk_sec<36000 and dispo_sec<36000 $ugSQL group by full_name,status order by status desc,full_name limit 100000;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$row[0] = ($row[0] - 1);	# subtract 1 for login/logout event compensation
+	
+	$calls[$i] =		$row[0];
+	$talk_sec[$i] =		$row[1];
+	$full_name[$i] =	$row[2];
+	$user[$i] =			$row[3];
+	$pause_sec[$i] =	$row[4];
+	$wait_sec[$i] =		$row[5];
+	$dispo_sec[$i] =	$row[6];
+	$status[$i] =		$row[7];
+	if ( (!eregi("-$status[$i]-", $statuses)) and (strlen($status[$i])>0) )
+		{
+		$statusesTXT = sprintf("%8s", $status[$i]);
+		$statusesHEAD .= "----------+";
+		$statusesHTML .= " $statusesTXT |";
+		$statuses .= "$status[$i]-";
+		$statusesARY[$j] = $status[$i];
+		$j++;
+		}
+	if (!eregi("-$user[$i]-", $users))
+		{
+		$users .= "$user[$i]-";
+		$usersARY[$k] = $user[$i];
+		$user_namesARY[$k] = $full_name[$i];
+		$k++;
+		}
+
+	$i++;
+	}
+
+
+echo "+-----------------+----------+--------+---------+--------+--------+--------+--------+--------+--------+--------+--------+$statusesHEAD\n";
+echo "| USER NAME       | ID       | CALLS  | TIME    | PAUSE  | PAUSAVG| WAIT   | WAITAVG| TALK   | TALKAVG| DISPO  | DISPAVG|$statusesHTML\n";
+echo "+-----------------+----------+--------+---------+--------+--------+--------+--------+--------+--------+--------+--------+$statusesHEAD\n";
+
+
+### BEGIN loop through each user ###
+$m=0;
+while ($m < $k)
+	{
+	$Suser=$usersARY[$m];
+	$Sfull_name=$user_namesARY[$m];
+	$Stime=0;
+	$Scalls=0;
+	$Stalk_sec=0;
+	$Spause_sec=0;
+	$Swait_sec=0;
+	$Sdispo_sec=0;
+	$SstatusesHTML='';
+
+	### BEGIN loop through each status ###
+	$n=0;
+	while ($n < $j)
+		{
+		$Sstatus=$statusesARY[$n];
+		$SstatusTXT='';
+		### BEGIN loop through each stat line ###
+		$i=0; $status_found=0;
+		while ($i < $rows_to_print)
+			{
+			if ( ($Suser=="$user[$i]") and ($Sstatus=="$status[$i]") )
+				{
+				$Scalls =		($Scalls + $calls[$i]);
+				$Stalk_sec =	($Stalk_sec + $talk_sec[$i]);
+				$Spause_sec =	($Spause_sec + $pause_sec[$i]);
+				$Swait_sec =	($Swait_sec + $wait_sec[$i]);
+				$Sdispo_sec =	($Sdispo_sec + $dispo_sec[$i]);
+				$SstatusTXT = sprintf("%8s", $calls[$i]);
+				$SstatusesHTML .= " $SstatusTXT |";
+				$status_found++;
+				}
+			$i++;
+			}
+		if ($status_found < 1)
+			{
+			$SstatusesHTML .= "        0 |";
+			}
+		### END loop through each stat line ###
+		$n++;
+		}
+	### END loop through each status ###
+	$Stime = ($Stalk_sec + $Spause_sec + $Swait_sec + $Sdispo_sec);
+	$TOTcalls=($TOTcalls + $Scalls);
+	$TOTtime=($TOTtime + $Stime);
+	$TOTtotTALK=($TOTtotTALK + $Stalk_sec);
+	$TOTtotWAIT=($TOTtotWAIT + $Swait_sec);
+	$TOTtotPAUSE=($TOTtotPAUSE + $Spause_sec);
+	$TOTtotDISPO=($TOTtotDISPO + $Sdispo_sec);
+	$Stime = ($Stalk_sec + $Spause_sec + $Swait_sec + $Sdispo_sec);
+	if ( ($Scalls > 0) and ($Stalk_sec > 0) ) {$Stalk_avg = ($Stalk_sec/$Scalls);}
+		else {$Stalk_avg=0;}
+	if ( ($Scalls > 0) and ($Spause_sec > 0) ) {$Spause_avg = ($Spause_sec/$Scalls);}
+		else {$Spause_avg=0;}
+	if ( ($Scalls > 0) and ($Swait_sec > 0) ) {$Swait_avg = ($Swait_sec/$Scalls);}
+		else {$Swait_avg=0;}
+	if ( ($Scalls > 0) and ($Sdispo_sec > 0) ) {$Sdispo_avg = ($Sdispo_sec/$Scalls);}
+		else {$Sdispo_avg=0;}
+
+	$Scalls =	sprintf("%6s", $Scalls);
+
+	if ($non_latin < 1)
+	{
+   	 $Sfull_name=	sprintf("%-15s", $Sfull_name); 
+		while(strlen($Sfull_name)>15) {$Sfull_name = substr("$Sfull_name", 0, -1);}
+	 $Suser =		sprintf("%-8s", $Suser);
+        while(strlen($Suser)>8) {$Suser = substr("$Suser", 0, -1);}
+       }
+	else
+	{	
+        $Sfull_name=	sprintf("%-45s", $Sfull_name); 
+	 while(mb_strlen($Sfull_name,'utf-8')>15) {$Sfull_name = mb_substr("$Sfull_name", 0, -1,'utf-8');}
+
+ 		$Suser =	sprintf("%-24s", $Suser);
+	 while(mb_strlen($Suser,'utf-8')>8) {$Suser = mb_substr("$Suser", 0, -1,'utf-8');}
+	}
+
+	$USERtime_M = ($Stime / 60);
+	$USERtime_M = round($USERtime_M, 2);
+	$USERtime_M_int = intval("$USERtime_M");
+	$USERtime_S = ($USERtime_M - $USERtime_M_int);
+	$USERtime_S = ($USERtime_S * 60);
+	$USERtime_S = round($USERtime_S, 0);
+	if ($USERtime_S < 10) {$USERtime_S = "0$USERtime_S";}
+	$USERtime_MS = "$USERtime_M_int:$USERtime_S";
+	$pfUSERtime_MS =		sprintf("%7s", $USERtime_MS);
+
+	$USERtotTALK_M = ($Stalk_sec / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$pfUSERtotTALK_MS =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($Stalk_avg / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$pfUSERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	$USERtotPAUSE_M = ($Spause_sec / 60);
+	$USERtotPAUSE_M = round($USERtotPAUSE_M, 2);
+	$USERtotPAUSE_M_int = intval("$USERtotPAUSE_M");
+	$USERtotPAUSE_S = ($USERtotPAUSE_M - $USERtotPAUSE_M_int);
+	$USERtotPAUSE_S = ($USERtotPAUSE_S * 60);
+	$USERtotPAUSE_S = round($USERtotPAUSE_S, 0);
+	if ($USERtotPAUSE_S < 10) {$USERtotPAUSE_S = "0$USERtotPAUSE_S";}
+	$USERtotPAUSE_MS = "$USERtotPAUSE_M_int:$USERtotPAUSE_S";
+	$pfUSERtotPAUSE_MS =		sprintf("%6s", $USERtotPAUSE_MS);
+
+	$USERavgPAUSE_M = ($Spause_avg / 60);
+	$USERavgPAUSE_M = round($USERavgPAUSE_M, 2);
+	$USERavgPAUSE_M_int = intval("$USERavgPAUSE_M");
+	$USERavgPAUSE_S = ($USERavgPAUSE_M - $USERavgPAUSE_M_int);
+	$USERavgPAUSE_S = ($USERavgPAUSE_S * 60);
+	$USERavgPAUSE_S = round($USERavgPAUSE_S, 0);
+	if ($USERavgPAUSE_S < 10) {$USERavgPAUSE_S = "0$USERavgPAUSE_S";}
+	$USERavgPAUSE_MS = "$USERavgPAUSE_M_int:$USERavgPAUSE_S";
+	$pfUSERavgPAUSE_MS =		sprintf("%6s", $USERavgPAUSE_MS);
+
+	$USERtotWAIT_M = ($Swait_sec / 60);
+	$USERtotWAIT_M = round($USERtotWAIT_M, 2);
+	$USERtotWAIT_M_int = intval("$USERtotWAIT_M");
+	$USERtotWAIT_S = ($USERtotWAIT_M - $USERtotWAIT_M_int);
+	$USERtotWAIT_S = ($USERtotWAIT_S * 60);
+	$USERtotWAIT_S = round($USERtotWAIT_S, 0);
+	if ($USERtotWAIT_S < 10) {$USERtotWAIT_S = "0$USERtotWAIT_S";}
+	$USERtotWAIT_MS = "$USERtotWAIT_M_int:$USERtotWAIT_S";
+	$pfUSERtotWAIT_MS =		sprintf("%6s", $USERtotWAIT_MS);
+
+	$USERavgWAIT_M = ($Swait_avg / 60);
+	$USERavgWAIT_M = round($USERavgWAIT_M, 2);
+	$USERavgWAIT_M_int = intval("$USERavgWAIT_M");
+	$USERavgWAIT_S = ($USERavgWAIT_M - $USERavgWAIT_M_int);
+	$USERavgWAIT_S = ($USERavgWAIT_S * 60);
+	$USERavgWAIT_S = round($USERavgWAIT_S, 0);
+	if ($USERavgWAIT_S < 10) {$USERavgWAIT_S = "0$USERavgWAIT_S";}
+	$USERavgWAIT_MS = "$USERavgWAIT_M_int:$USERavgWAIT_S";
+	$pfUSERavgWAIT_MS =		sprintf("%6s", $USERavgWAIT_MS);
+	
+	$USERtotDISPO_M = ($Sdispo_sec / 60);
+	$USERtotDISPO_M = round($USERtotDISPO_M, 2);
+	$USERtotDISPO_M_int = intval("$USERtotDISPO_M");
+	$USERtotDISPO_S = ($USERtotDISPO_M - $USERtotDISPO_M_int);
+	$USERtotDISPO_S = ($USERtotDISPO_S * 60);
+	$USERtotDISPO_S = round($USERtotDISPO_S, 0);
+	if ($USERtotDISPO_S < 10) {$USERtotDISPO_S = "0$USERtotDISPO_S";}
+	$USERtotDISPO_MS = "$USERtotDISPO_M_int:$USERtotDISPO_S";
+	$pfUSERtotDISPO_MS =		sprintf("%6s", $USERtotDISPO_MS);
+
+	$USERavgDISPO_M = ($Sdispo_avg / 60);
+	$USERavgDISPO_M = round($USERavgDISPO_M, 2);
+	$USERavgDISPO_M_int = intval("$USERavgDISPO_M");
+	$USERavgDISPO_S = ($USERavgDISPO_M - $USERavgDISPO_M_int);
+	$USERavgDISPO_S = ($USERavgDISPO_S * 60);
+	$USERavgDISPO_S = round($USERavgDISPO_S, 0);
+	if ($USERavgDISPO_S < 10) {$USERavgDISPO_S = "0$USERavgDISPO_S";}
+	$USERavgDISPO_MS = "$USERavgDISPO_M_int:$USERavgDISPO_S";
+	$pfUSERavgDISPO_MS =		sprintf("%6s", $USERavgDISPO_MS);
+
+	echo "| $Sfull_name | $Suser | $Scalls | $pfUSERtime_MS | $pfUSERtotPAUSE_MS | $pfUSERavgPAUSE_MS | $pfUSERtotWAIT_MS | $pfUSERavgWAIT_MS | $pfUSERtotTALK_MS | $pfUSERavgTALK_MS | $pfUSERtotDISPO_MS | $pfUSERavgDISPO_MS |$SstatusesHTML\n";
+	$m++;
+	}
+### END loop through each user ###
+
+
+###### LAST LINE FORMATTING ##########
+### BEGIN loop through each status ###
+$SUMstatusesHTML='';
+$n=0;
+while ($n < $j)
+	{
+	$Scalls=0;
+	$Sstatus=$statusesARY[$n];
+	$SUMstatusTXT='';
+	### BEGIN loop through each stat line ###
+	$i=0; $status_found=0;
+	while ($i < $rows_to_print)
+		{
+		if ($Sstatus=="$status[$i]")
+			{
+			$Scalls =		($Scalls + $calls[$i]);
+			$status_found++;
+			}
+		$i++;
+		}
+	### END loop through each stat line ###
+	if ($status_found < 1)
+		{
+		$SUMstatusesHTML .= "        0 |";
+		}
+	else
+		{
+		$SUMstatusTXT = sprintf("%8s", $Scalls);
+		$SUMstatusesHTML .= " $SUMstatusTXT |";
+		}
+	$n++;
+	}
+### END loop through each status ###
+
+
+	$TOTcalls =	sprintf("%7s", $TOTcalls);
+	$TOT_AGENTS = sprintf("%-4s", $m);
+
+	$TOTtime_M = ($TOTtime / 60);
+	$TOTtime_M = 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 ($TOTtime_S < 10) {$TOTtime_S = "0$TOTtime_S";}
+	$TOTtime_MS = "$TOTtime_M_int:$TOTtime_S";
+	$TOTtime_MS =		sprintf("%8s", $TOTtime_MS);
+		while(strlen($TOTtime_MS)>8) {$TOTtime_MS = substr("$TOTtime_MS", 0, -1);}
+
+	$TOTtotTALK_M = ($TOTtotTALK / 60);
+	$TOTtotTALK_M = round($TOTtotTALK_M, 2);
+	$TOTtotTALK_M_int = intval("$TOTtotTALK_M");
+	$TOTtotTALK_S = ($TOTtotTALK_M - $TOTtotTALK_M_int);
+	$TOTtotTALK_S = ($TOTtotTALK_S * 60);
+	$TOTtotTALK_S = round($TOTtotTALK_S, 0);
+	if ($TOTtotTALK_S < 10) {$TOTtotTALK_S = "0$TOTtotTALK_S";}
+	$TOTtotTALK_MS = "$TOTtotTALK_M_int:$TOTtotTALK_S";
+	$TOTtotTALK_MS =		sprintf("%8s", $TOTtotTALK_MS);
+		while(strlen($TOTtotTALK_MS)>8) {$TOTtotTALK_MS = substr("$TOTtotTALK_MS", 0, -1);}
+
+	$TOTtotDISPO_M = ($TOTtotDISPO / 60);
+	$TOTtotDISPO_M = round($TOTtotDISPO_M, 2);
+	$TOTtotDISPO_M_int = intval("$TOTtotDISPO_M");
+	$TOTtotDISPO_S = ($TOTtotDISPO_M - $TOTtotDISPO_M_int);
+	$TOTtotDISPO_S = ($TOTtotDISPO_S * 60);
+	$TOTtotDISPO_S = round($TOTtotDISPO_S, 0);
+	if ($TOTtotDISPO_S < 10) {$TOTtotDISPO_S = "0$TOTtotDISPO_S";}
+	$TOTtotDISPO_MS = "$TOTtotDISPO_M_int:$TOTtotDISPO_S";
+	$TOTtotDISPO_MS =		sprintf("%8s", $TOTtotDISPO_MS);
+		while(strlen($TOTtotDISPO_MS)>8) {$TOTtotDISPO_MS = substr("$TOTtotDISPO_MS", 0, -1);}
+
+	$TOTtotPAUSE_M = ($TOTtotPAUSE / 60);
+	$TOTtotPAUSE_M = round($TOTtotPAUSE_M, 2);
+	$TOTtotPAUSE_M_int = intval("$TOTtotPAUSE_M");
+	$TOTtotPAUSE_S = ($TOTtotPAUSE_M - $TOTtotPAUSE_M_int);
+	$TOTtotPAUSE_S = ($TOTtotPAUSE_S * 60);
+	$TOTtotPAUSE_S = round($TOTtotPAUSE_S, 0);
+	if ($TOTtotPAUSE_S < 10) {$TOTtotPAUSE_S = "0$TOTtotPAUSE_S";}
+	$TOTtotPAUSE_MS = "$TOTtotPAUSE_M_int:$TOTtotPAUSE_S";
+	$TOTtotPAUSE_MS =		sprintf("%8s", $TOTtotPAUSE_MS);
+		while(strlen($TOTtotPAUSE_MS)>8) {$TOTtotPAUSE_MS = substr("$TOTtotPAUSE_MS", 0, -1);}
+
+	$TOTtotWAIT_M = ($TOTtotWAIT / 60);
+	$TOTtotWAIT_M = round($TOTtotWAIT_M, 2);
+	$TOTtotWAIT_M_int = intval("$TOTtotWAIT_M");
+	$TOTtotWAIT_S = ($TOTtotWAIT_M - $TOTtotWAIT_M_int);
+	$TOTtotWAIT_S = ($TOTtotWAIT_S * 60);
+	$TOTtotWAIT_S = round($TOTtotWAIT_S, 0);
+	if ($TOTtotWAIT_S < 10) {$TOTtotWAIT_S = "0$TOTtotWAIT_S";}
+	$TOTtotWAIT_MS = "$TOTtotWAIT_M_int:$TOTtotWAIT_S";
+	$TOTtotWAIT_MS =		sprintf("%8s", $TOTtotWAIT_MS);
+		while(strlen($TOTtotWAIT_MS)>8) {$TOTtotWAIT_MS = substr("$TOTtotWAIT_MS", 0, -1);}
+
+
+	$TOTavgTALK_M = ( ($TOTtotTALK / $TOTcalls) / 60);
+	$TOTavgTALK_M = round($TOTavgTALK_M, 2);
+	$TOTavgTALK_M_int = intval("$TOTavgTALK_M");
+	$TOTavgTALK_S = ($TOTavgTALK_M - $TOTavgTALK_M_int);
+	$TOTavgTALK_S = ($TOTavgTALK_S * 60);
+	$TOTavgTALK_S = round($TOTavgTALK_S, 0);
+	if ($TOTavgTALK_S < 10) {$TOTavgTALK_S = "0$TOTavgTALK_S";}
+	$TOTavgTALK_MS = "$TOTavgTALK_M_int:$TOTavgTALK_S";
+	$TOTavgTALK_MS =		sprintf("%6s", $TOTavgTALK_MS);
+		while(strlen($TOTavgTALK_MS)>6) {$TOTavgTALK_MS = substr("$TOTavgTALK_MS", 0, -1);}
+
+	$TOTavgDISPO_M = ( ($TOTtotDISPO / $TOTcalls) / 60);
+	$TOTavgDISPO_M = round($TOTavgDISPO_M, 2);
+	$TOTavgDISPO_M_int = intval("$TOTavgDISPO_M");
+	$TOTavgDISPO_S = ($TOTavgDISPO_M - $TOTavgDISPO_M_int);
+	$TOTavgDISPO_S = ($TOTavgDISPO_S * 60);
+	$TOTavgDISPO_S = round($TOTavgDISPO_S, 0);
+	if ($TOTavgDISPO_S < 10) {$TOTavgDISPO_S = "0$TOTavgDISPO_S";}
+	$TOTavgDISPO_MS = "$TOTavgDISPO_M_int:$TOTavgDISPO_S";
+	$TOTavgDISPO_MS =		sprintf("%6s", $TOTavgDISPO_MS);
+		while(strlen($TOTavgDISPO_MS)>6) {$TOTavgDISPO_MS = substr("$TOTavgDISPO_MS", 0, -1);}
+
+	$TOTavgPAUSE_M = ( ($TOTtotPAUSE / $TOTcalls) / 60);
+	$TOTavgPAUSE_M = round($TOTavgPAUSE_M, 2);
+	$TOTavgPAUSE_M_int = intval("$TOTavgPAUSE_M");
+	$TOTavgPAUSE_S = ($TOTavgPAUSE_M - $TOTavgPAUSE_M_int);
+	$TOTavgPAUSE_S = ($TOTavgPAUSE_S * 60);
+	$TOTavgPAUSE_S = round($TOTavgPAUSE_S, 0);
+	if ($TOTavgPAUSE_S < 10) {$TOTavgPAUSE_S = "0$TOTavgPAUSE_S";}
+	$TOTavgPAUSE_MS = "$TOTavgPAUSE_M_int:$TOTavgPAUSE_S";
+	$TOTavgPAUSE_MS =		sprintf("%6s", $TOTavgPAUSE_MS);
+		while(strlen($TOTavgPAUSE_MS)>6) {$TOTavgPAUSE_MS = substr("$TOTavgPAUSE_MS", 0, -1);}
+
+	$TOTavgWAIT_M = ( ($TOTtotWAIT / $TOTcalls) / 60);
+	$TOTavgWAIT_M = round($TOTavgWAIT_M, 2);
+	$TOTavgWAIT_M_int = intval("$TOTavgWAIT_M");
+	$TOTavgWAIT_S = ($TOTavgWAIT_M - $TOTavgWAIT_M_int);
+	$TOTavgWAIT_S = ($TOTavgWAIT_S * 60);
+	$TOTavgWAIT_S = round($TOTavgWAIT_S, 0);
+	if ($TOTavgWAIT_S < 10) {$TOTavgWAIT_S = "0$TOTavgWAIT_S";}
+	$TOTavgWAIT_MS = "$TOTavgWAIT_M_int:$TOTavgWAIT_S";
+	$TOTavgWAIT_MS =		sprintf("%6s", $TOTavgWAIT_MS);
+		while(strlen($TOTavgWAIT_MS)>6) {$TOTavgWAIT_MS = substr("$TOTavgWAIT_MS", 0, -1);}
+
+
+echo "+-----------------+----------+--------+---------+--------+--------+--------+--------+--------+--------+--------+--------+$statusesHEAD\n";
+echo "|  TOTALS        AGENTS:$TOT_AGENTS | $TOTcalls| $TOTtime_MS|$TOTtotPAUSE_MS| $TOTavgPAUSE_MS |$TOTtotWAIT_MS| $TOTavgWAIT_MS |$TOTtotTALK_MS| $TOTavgTALK_MS |$TOTtotDISPO_MS| $TOTavgDISPO_MS |$SUMstatusesHTML\n";
+echo "+----------------------------+--------+---------+--------+--------+--------+--------+--------+--------+--------+--------+$statusesHEAD\n";
+
+echo "\n";
+
+}
+
+
+?>
+
+
\ No newline at end of file
diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_agent_time_sheet.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_agent_time_sheet.php
new file mode 100644
index 00000000..0c562ea2
--- /dev/null
+++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_agent_time_sheet.php
@@ -0,0 +1,286 @@
+    LICENSE: GPLv2
+###
+# CHANGES
+#
+# 60619-1729 - Added variable filtering to eliminate SQL injection attack threat
+#            - Added required user/pass to gain access to this page
+#
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+if (isset($_GET["agent"]))				{$agent=$_GET["agent"];}
+	elseif (isset($_POST["agent"]))		{$agent=$_POST["agent"];}
+if (isset($_GET["query_date"]))				{$query_date=$_GET["query_date"];}
+	elseif (isset($_POST["query_date"]))		{$query_date=$_POST["query_date"];}
+if (isset($_GET["calls_summary"]))				{$calls_summary=$_GET["calls_summary"];}
+	elseif (isset($_POST["calls_summary"]))		{$calls_summary=$_POST["calls_summary"];}
+if (isset($_GET["submit"]))				{$submit=$_GET["submit"];}
+	elseif (isset($_POST["submit"]))		{$submit=$_POST["submit"];}
+if (isset($_GET["ENVIAR"]))				{$ENVIAR=$_GET["ENVIAR"];}
+	elseif (isset($_POST["ENVIAR"]))		{$ENVIAR=$_POST["ENVIAR"];}
+
+$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
+$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
+
+	$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
+	if ($DB) {echo "|$stmt|\n";}
+	$rslt=mysql_query($stmt, $link);
+	$row=mysql_fetch_row($rslt);
+	$auth=$row[0];
+
+  if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
+	{
+    Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
+    Header("HTTP/1.0 401 Unauthorized");
+    echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
+    exit;
+	}
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!isset($query_date)) {$query_date = $NOW_DATE;}
+
+?>
+
+
+
+
+
+\n";
+echo "VICIDIAL: Agent Time Sheet\n";
+echo "VICIDIAL ADMIN: Agent Time Sheet\n";
+echo " - User Stats\n";
+echo " - User Status\n";
+echo " - Modificar Usuario\n";
+echo "
\n"; +echo "
  \n"; +echo "Date: \n"; +echo "User ID: \n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n";
+
+
+if (!$agent)
+{
+echo "\n";
+echo "PLEASE SELECT AN AGENTE ID AND DATE-TIME ABOVE AND CLICK ENVIAR\n";
+echo " NOTE: stats taken from available agent log data\n";
+}
+
+else
+{
+$query_date_BEGIN = "$query_date 00:00:00";   
+$query_date_END = "$query_date 23:59:59";
+$time_BEGIN = "00:00:00";   
+$time_END = "23:59:59";
+
+$stmt="select full_name from vicidial_users where user='$agent';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$full_name = $row[0];
+
+echo "VICIDIAL: Agent Time Sheet                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENTE TIME SHEET: $agent - $full_name -------------\n\n";
+
+if ($calls_summary)
+	{
+	$stmt="select count(*) as calls,sum(talk_sec) as talk,avg(talk_sec),sum(pause_sec),avg(pause_sec),sum(wait_sec),avg(wait_sec),sum(dispo_sec),avg(dispo_sec) from vicidial_agent_log where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' and pause_sec<48800 and wait_sec<48800 and talk_sec<48800 and dispo_sec<48800 limit 1;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+
+	$TOTAL_TIME = ($row[1] + $row[3] + $row[5] + $row[7]);
+
+		$TOTAL_TIME_H = ($TOTAL_TIME / 3600);
+		$TOTAL_TIME_H = round($TOTAL_TIME_H, 2);
+		$TOTAL_TIME_H_int = intval("$TOTAL_TIME_H");
+		$TOTAL_TIME_M = ($TOTAL_TIME_H - $TOTAL_TIME_H_int);
+		$TOTAL_TIME_M = ($TOTAL_TIME_M * 60);
+		$TOTAL_TIME_M = round($TOTAL_TIME_M, 2);
+		$TOTAL_TIME_M_int = intval("$TOTAL_TIME_M");
+		$TOTAL_TIME_S = ($TOTAL_TIME_M - $TOTAL_TIME_M_int);
+		$TOTAL_TIME_S = ($TOTAL_TIME_S * 60);
+		$TOTAL_TIME_S = round($TOTAL_TIME_S, 0);
+		if ($TOTAL_TIME_S < 10) {$TOTAL_TIME_S = "0$TOTAL_TIME_S";}
+		if ($TOTAL_TIME_M_int < 10) {$TOTAL_TIME_M_int = "0$TOTAL_TIME_M_int";}
+		$TOTAL_TIME_HMS = "$TOTAL_TIME_H_int:$TOTAL_TIME_M_int:$TOTAL_TIME_S";
+		$pfTOTAL_TIME_HMS =		sprintf("%8s", $TOTAL_TIME_HMS);
+
+		$TALK_TIME_H = ($row[1] / 3600);
+		$TALK_TIME_H = round($TALK_TIME_H, 2);
+		$TALK_TIME_H_int = intval("$TALK_TIME_H");
+		$TALK_TIME_M = ($TALK_TIME_H - $TALK_TIME_H_int);
+		$TALK_TIME_M = ($TALK_TIME_M * 60);
+		$TALK_TIME_M = round($TALK_TIME_M, 2);
+		$TALK_TIME_M_int = intval("$TALK_TIME_M");
+		$TALK_TIME_S = ($TALK_TIME_M - $TALK_TIME_M_int);
+		$TALK_TIME_S = ($TALK_TIME_S * 60);
+		$TALK_TIME_S = round($TALK_TIME_S, 0);
+		if ($TALK_TIME_S < 10) {$TALK_TIME_S = "0$TALK_TIME_S";}
+		if ($TALK_TIME_M_int < 10) {$TALK_TIME_M_int = "0$TALK_TIME_M_int";}
+		$TALK_TIME_HMS = "$TALK_TIME_H_int:$TALK_TIME_M_int:$TALK_TIME_S";
+		$pfTALK_TIME_HMS =		sprintf("%8s", $TALK_TIME_HMS);
+
+		$PAUSE_TIME_H = ($row[3] / 3600);
+		$PAUSE_TIME_H = round($PAUSE_TIME_H, 2);
+		$PAUSE_TIME_H_int = intval("$PAUSE_TIME_H");
+		$PAUSE_TIME_M = ($PAUSE_TIME_H - $PAUSE_TIME_H_int);
+		$PAUSE_TIME_M = ($PAUSE_TIME_M * 60);
+		$PAUSE_TIME_M = round($PAUSE_TIME_M, 2);
+		$PAUSE_TIME_M_int = intval("$PAUSE_TIME_M");
+		$PAUSE_TIME_S = ($PAUSE_TIME_M - $PAUSE_TIME_M_int);
+		$PAUSE_TIME_S = ($PAUSE_TIME_S * 60);
+		$PAUSE_TIME_S = round($PAUSE_TIME_S, 0);
+		if ($PAUSE_TIME_S < 10) {$PAUSE_TIME_S = "0$PAUSE_TIME_S";}
+		if ($PAUSE_TIME_M_int < 10) {$PAUSE_TIME_M_int = "0$PAUSE_TIME_M_int";}
+		$PAUSE_TIME_HMS = "$PAUSE_TIME_H_int:$PAUSE_TIME_M_int:$PAUSE_TIME_S";
+		$pfPAUSE_TIME_HMS =		sprintf("%8s", $PAUSE_TIME_HMS);
+
+		$WAIT_TIME_H = ($row[5] / 3600);
+		$WAIT_TIME_H = round($WAIT_TIME_H, 2);
+		$WAIT_TIME_H_int = intval("$WAIT_TIME_H");
+		$WAIT_TIME_M = ($WAIT_TIME_H - $WAIT_TIME_H_int);
+		$WAIT_TIME_M = ($WAIT_TIME_M * 60);
+		$WAIT_TIME_M = round($WAIT_TIME_M, 2);
+		$WAIT_TIME_M_int = intval("$WAIT_TIME_M");
+		$WAIT_TIME_S = ($WAIT_TIME_M - $WAIT_TIME_M_int);
+		$WAIT_TIME_S = ($WAIT_TIME_S * 60);
+		$WAIT_TIME_S = round($WAIT_TIME_S, 0);
+		if ($WAIT_TIME_S < 10) {$WAIT_TIME_S = "0$WAIT_TIME_S";}
+		if ($WAIT_TIME_M_int < 10) {$WAIT_TIME_M_int = "0$WAIT_TIME_M_int";}
+		$WAIT_TIME_HMS = "$WAIT_TIME_H_int:$WAIT_TIME_M_int:$WAIT_TIME_S";
+		$pfWAIT_TIME_HMS =		sprintf("%8s", $WAIT_TIME_HMS);
+
+		$WRAPUP_TIME_H = ($row[7] / 3600);
+		$WRAPUP_TIME_H = round($WRAPUP_TIME_H, 2);
+		$WRAPUP_TIME_H_int = intval("$WRAPUP_TIME_H");
+		$WRAPUP_TIME_M = ($WRAPUP_TIME_H - $WRAPUP_TIME_H_int);
+		$WRAPUP_TIME_M = ($WRAPUP_TIME_M * 60);
+		$WRAPUP_TIME_M = round($WRAPUP_TIME_M, 2);
+		$WRAPUP_TIME_M_int = intval("$WRAPUP_TIME_M");
+		$WRAPUP_TIME_S = ($WRAPUP_TIME_M - $WRAPUP_TIME_M_int);
+		$WRAPUP_TIME_S = ($WRAPUP_TIME_S * 60);
+		$WRAPUP_TIME_S = round($WRAPUP_TIME_S, 0);
+		if ($WRAPUP_TIME_S < 10) {$WRAPUP_TIME_S = "0$WRAPUP_TIME_S";}
+		if ($WRAPUP_TIME_M_int < 10) {$WRAPUP_TIME_M_int = "0$WRAPUP_TIME_M_int";}
+		$WRAPUP_TIME_HMS = "$WRAPUP_TIME_H_int:$WRAPUP_TIME_M_int:$WRAPUP_TIME_S";
+		$pfWRAPUP_TIME_HMS =		sprintf("%8s", $WRAPUP_TIME_HMS);
+
+		$TALK_AVG_M = ($row[2] / 60);
+		$TALK_AVG_M = round($TALK_AVG_M, 2);
+		$TALK_AVG_M_int = intval("$TALK_AVG_M");
+		$TALK_AVG_S = ($TALK_AVG_M - $TALK_AVG_M_int);
+		$TALK_AVG_S = ($TALK_AVG_S * 60);
+		$TALK_AVG_S = round($TALK_AVG_S, 0);
+		if ($TALK_AVG_S < 10) {$TALK_AVG_S = "0$TALK_AVG_S";}
+		$TALK_AVG_MS = "$TALK_AVG_M_int:$TALK_AVG_S";
+		$pfTALK_AVG_MS =		sprintf("%6s", $TALK_AVG_MS);
+
+		$PAUSE_AVG_M = ($row[4] / 60);
+		$PAUSE_AVG_M = round($PAUSE_AVG_M, 2);
+		$PAUSE_AVG_M_int = intval("$PAUSE_AVG_M");
+		$PAUSE_AVG_S = ($PAUSE_AVG_M - $PAUSE_AVG_M_int);
+		$PAUSE_AVG_S = ($PAUSE_AVG_S * 60);
+		$PAUSE_AVG_S = round($PAUSE_AVG_S, 0);
+		if ($PAUSE_AVG_S < 10) {$PAUSE_AVG_S = "0$PAUSE_AVG_S";}
+		$PAUSE_AVG_MS = "$PAUSE_AVG_M_int:$PAUSE_AVG_S";
+		$pfPAUSE_AVG_MS =		sprintf("%6s", $PAUSE_AVG_MS);
+
+		$WAIT_AVG_M = ($row[6] / 60);
+		$WAIT_AVG_M = round($WAIT_AVG_M, 2);
+		$WAIT_AVG_M_int = intval("$WAIT_AVG_M");
+		$WAIT_AVG_S = ($WAIT_AVG_M - $WAIT_AVG_M_int);
+		$WAIT_AVG_S = ($WAIT_AVG_S * 60);
+		$WAIT_AVG_S = round($WAIT_AVG_S, 0);
+		if ($WAIT_AVG_S < 10) {$WAIT_AVG_S = "0$WAIT_AVG_S";}
+		$WAIT_AVG_MS = "$WAIT_AVG_M_int:$WAIT_AVG_S";
+		$pfWAIT_AVG_MS =		sprintf("%6s", $WAIT_AVG_MS);
+
+		$WRAPUP_AVG_M = ($row[8] / 60);
+		$WRAPUP_AVG_M = round($WRAPUP_AVG_M, 2);
+		$WRAPUP_AVG_M_int = intval("$WRAPUP_AVG_M");
+		$WRAPUP_AVG_S = ($WRAPUP_AVG_M - $WRAPUP_AVG_M_int);
+		$WRAPUP_AVG_S = ($WRAPUP_AVG_S * 60);
+		$WRAPUP_AVG_S = round($WRAPUP_AVG_S, 0);
+		if ($WRAPUP_AVG_S < 10) {$WRAPUP_AVG_S = "0$WRAPUP_AVG_S";}
+		$WRAPUP_AVG_MS = "$WRAPUP_AVG_M_int:$WRAPUP_AVG_S";
+		$pfWRAPUP_AVG_MS =		sprintf("%6s", $WRAPUP_AVG_MS);
+
+	echo "LLAMADAS TOTALES TAKEN: $row[0]\n";
+	echo "TALK TIME:               $pfTALK_TIME_HMS     AVERAGE: $pfTALK_AVG_MS\n";
+	echo "PAUSE TIME:              $pfPAUSE_TIME_HMS     AVERAGE: $pfPAUSE_AVG_MS\n";
+	echo "WAIT TIME:               $pfWAIT_TIME_HMS     AVERAGE: $pfWAIT_AVG_MS\n";
+	echo "WRAPUP TIME:             $pfWRAPUP_TIME_HMS     AVERAGE: $pfWRAPUP_AVG_MS\n";
+	echo "----------------------------------------------------------------\n";
+	echo "TOTAL ACTIVE AGENTE TIME: $pfTOTAL_TIME_HMS\n";
+
+	echo "\n";
+	}
+else
+	{
+	echo "Call Activity Summary\n\n";
+
+	}
+
+$stmt="select event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' order by event_time limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+echo "FIRST LOGIN:          $row[0]\n";
+$start = $row[1];
+
+$stmt="select event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' order by event_time desc limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+echo "LAST LOG ACTIVITY:    $row[0]\n";
+$end = $row[1];
+
+$login_time = ($end - $start);
+	$LOGIN_TIME_H = ($login_time / 3600);
+	$LOGIN_TIME_H = round($LOGIN_TIME_H, 2);
+	$LOGIN_TIME_H_int = intval("$LOGIN_TIME_H");
+	$LOGIN_TIME_M = ($LOGIN_TIME_H - $LOGIN_TIME_H_int);
+	$LOGIN_TIME_M = ($LOGIN_TIME_M * 60);
+	$LOGIN_TIME_M = round($LOGIN_TIME_M, 2);
+	$LOGIN_TIME_M_int = intval("$LOGIN_TIME_M");
+	$LOGIN_TIME_S = ($LOGIN_TIME_M - $LOGIN_TIME_M_int);
+	$LOGIN_TIME_S = ($LOGIN_TIME_S * 60);
+	$LOGIN_TIME_S = round($LOGIN_TIME_S, 0);
+	if ($LOGIN_TIME_S < 10) {$LOGIN_TIME_S = "0$LOGIN_TIME_S";}
+	if ($LOGIN_TIME_M_int < 10) {$LOGIN_TIME_M_int = "0$LOGIN_TIME_M_int";}
+	$LOGIN_TIME_HMS = "$LOGIN_TIME_H_int:$LOGIN_TIME_M_int:$LOGIN_TIME_S";
+	$pfLOGIN_TIME_HMS =		sprintf("%8s", $LOGIN_TIME_HMS);
+
+echo "-----------------------------------------\n";
+echo "TOTAL LOGGED-IN TIME:    $pfLOGIN_TIME_HMS\n";
+
+}
+
+
+
+?>
+
+
\ No newline at end of file
diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_inboundEXTstats.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_inboundEXTstats.php
new file mode 100644
index 00000000..e85f742c
--- /dev/null
+++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_inboundEXTstats.php
@@ -0,0 +1,400 @@
+    LICENSE: GPLv2
+#
+# CHANGES
+# 60421-1450 - check GET/POST vars lines with isset to not trigger PHP NOTICES
+# 60620-1322 - Added variable filtering to eliminate SQL injection attack threat
+#            - Added required user/pass to gain access to this page
+#
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+if (isset($_GET["group"]))					{$group=$_GET["group"];}
+	elseif (isset($_POST["group"]))			{$group=$_POST["group"];}
+if (isset($_GET["query_date"]))				{$query_date=$_GET["query_date"];}
+	elseif (isset($_POST["query_date"]))	{$query_date=$_POST["query_date"];}
+if (isset($_GET["server_ip"]))				{$server_ip=$_GET["server_ip"];}
+	elseif (isset($_POST["server_ip"]))		{$server_ip=$_POST["server_ip"];}
+if (isset($_GET["submit"]))					{$submit=$_GET["submit"];}
+	elseif (isset($_POST["submit"]))		{$submit=$_POST["submit"];}
+if (isset($_GET["ENVIAR"]))					{$ENVIAR=$_GET["ENVIAR"];}
+	elseif (isset($_POST["ENVIAR"]))		{$ENVIAR=$_POST["ENVIAR"];}
+
+$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
+$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
+
+	$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
+	if ($DB) {echo "|$stmt|\n";}
+	$rslt=mysql_query($stmt, $link);
+	$row=mysql_fetch_row($rslt);
+	$auth=$row[0];
+
+  if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
+	{
+    Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
+    Header("HTTP/1.0 401 Unauthorized");
+    echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
+    exit;
+	}
+
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!isset($query_date)) {$query_date = $NOW_DATE;}
+if (!isset($server_ip)) {$server_ip = '10.10.11.20';}
+
+$stmt="select extension,full_number,inbound_name from inbound_numbers where server_ip='" . mysql_real_escape_string($server_ip) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$inbound_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $inbound_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$inbound[$i] =$row[0];
+	$fullnum[$i] =$row[1];
+	$inbname[$i] =$row[2];
+	$i++;
+	}
+?>
+
+
+
+
+
+\n";
+#echo"\n";
+echo "ASTERISK: Estadística de Llamadas Entrantes\n";
+echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "SELECCIONE POR FAVOR Un NÚMERO Y La FECHA ARRIBA Y El TECLEO SOMETEN\n";
+}
+
+else
+{
+
+
+echo "ASTERISK: Estadística de Llamadas Entrantes                      $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$extenSQL = "and extension='" . mysql_real_escape_string($group) . "'";
+if (eregi("\*",$group))
+	{$extenSQL = "and extension LIKE \"%$group\"";}
+$stmt="select count(*),sum(length_in_sec) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " 00:00:01' and start_time <= '" . mysql_real_escape_string($query_date) . " 23:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Llamadas totales que vinieron en este número:       $TOTALcalls\n";
+echo "Average Call Length(seconds) for all Calls:   $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(length_in_sec) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " 00:00:01' and start_time <= '" . mysql_real_escape_string($query_date) . " 23:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$DROPcalls =	sprintf("%10s", $row[0]);
+$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
+$DROPpercent = round($DROPpercent, 0);
+
+if ($row[0])
+	{
+	$average_hold_seconds = ($row[1] / $row[0]);
+	$average_hold_seconds = round($average_hold_seconds, 0);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+else {$DROPpercent=0;   $average_hold_seconds=0;}
+echo "Total DROP Calls:   (less than 10 seconds)    $DROPcalls  $DROPpercent%\n";
+echo "Average Call Length(seconds) for DROP Calls:  $average_hold_seconds\n";
+
+
+##############################
+#########  CALLS STATS
+
+echo "\n";
+echo "---------- CALL LISTINGS\n";
+echo "+----------------------+----------------------+--------+---------------------+\n";
+echo "| CALLERID             | CALLERIDNAME         | LENGTH | DATE TIME           |\n";
+echo "+----------------------+----------------------+--------+---------------------+\n";
+
+$stmt="select number_dialed,caller_code,length_in_sec,start_time from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " 00:00:01' and start_time <= '" . mysql_real_escape_string($query_date) . " 23:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$CID =			sprintf("%-20s", $row[0]);
+	$CIDname =		sprintf("%-20s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
+	$datetime =		sprintf("%-19s", $row[3]);
+	$USERavgTALK =	$row[2];
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $CID | $CIDname | $USERavgTALK_MS | $datetime |\n";
+
+	$i++;
+	}
+
+echo "+----------------------+----------------------+--------+---------------------+\n";
+
+##############################
+#########  TIME STATS
+
+if ($output == 'FULL')
+	{
+
+	echo "\n";
+	echo "---------- ESTADÃSTICAS DEL TIEMPO\n";
+
+	echo "\n";
+
+	$hi_hour_count=0;
+	$last_full_record=0;
+	$i=0;
+	$h=0;
+	while ($i <= 96)
+		{
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:00:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:14:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:00:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:14:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:15:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:29:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:15:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:29:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:30:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:44:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:30:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:44:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:45:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:45:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+		$h++;
+		}
+
+	$hour_multiplier = (100 / $hi_hour_count);
+	#$hour_multiplier = round($hour_multiplier, 0);
+
+	echo "\n";
+	echo "GRÃFICO EN 15 INCREMENTOS MINUCIOSOS DE LLAMADAS TOTALES\n";
+
+	$k=1;
+	$Mk=0;
+	$call_scale = '0';
+	while ($k <= 102) 
+		{
+		if ($Mk >= 5) 
+			{
+			$Mk=0;
+			$scale_num=($k / $hour_multiplier);
+			$scale_num = round($scale_num, 0);
+			$LENscale_num = (strlen($scale_num));
+			$k = ($k + $LENscale_num);
+			$call_scale .= "$scale_num";
+			}
+		else
+			{
+			$call_scale .= " ";
+			$k++;   $Mk++;
+			}
+		}
+
+
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+	#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+	echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+	$ZZ = '00';
+	$i=0;
+	$h=4;
+	$hour= -1;
+	$no_lines_yet=1;
+
+	while ($i <= 96)
+		{
+		$char_counter=0;
+		$time = '      ';
+		if ($h >= 4) 
+			{
+			$hour++;
+			$h=0;
+			if ($hour < 10) {$hour = "0$hour";}
+			$time = "+$hour$ZZ+";
+			}
+		if ($h == 1) {$time = "   15 ";}
+		if ($h == 2) {$time = "   30 ";}
+		if ($h == 3) {$time = "   45 ";}
+		$Ghour_count = $hour_count[$i];
+		if ($Ghour_count < 1) 
+			{
+			if ( ($no_lines_yet) or ($i > $last_full_record) )
+				{
+				$do_nothing=1;
+				}
+			else
+				{
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+				echo "|$time|";
+				$k=0;   while ($k <= 102) {echo " ";   $k++;}
+				echo "| $hour_count[$i] |\n";
+				}
+			}
+		else
+			{
+			$no_lines_yet=0;
+			$Xhour_count = ($Ghour_count * $hour_multiplier);
+			$Yhour_count = (99 - $Xhour_count);
+
+			$Gdrop_count = $drop_count[$i];
+			if ($Gdrop_count < 1) 
+				{
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+				echo "|$time|";
+				$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+				echo "*X";   $char_counter++;
+				$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+					while ($char_counter <= 101) {echo " ";   $char_counter++;}
+				echo "| 0     | $hour_count[$i] |\n";
+
+				}
+			else
+				{
+				$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+			#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+				$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+				$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+				echo "|$time|";
+				$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+				echo "D";   $char_counter++;
+				$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+				echo "X";   $char_counter++;
+				$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+					while ($char_counter <= 102) {echo " ";   $char_counter++;}
+				echo "| $drop_count[$i] | $hour_count[$i] |\n";
+				}
+			}
+		
+		
+		$i++;
+		$h++;
+		}
+
+
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+
+	}
+
+
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_server_performance.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_server_performance.php new file mode 100644 index 00000000..064b65f4 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_server_performance.php @@ -0,0 +1,306 @@ + LICENSE: GPLv2 +# +# CHANGES +# +# 60619-1732 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 70417-1106 - Changed time frame to be definable per time range on a single day +# - Fixed vertical scaling issues +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["begin_query_time"])) {$begin_query_time=$_GET["begin_query_time"];} + elseif (isset($_POST["begin_query_time"])) {$begin_query_time=$_POST["begin_query_time"];} +if (isset($_GET["end_query_time"])) {$end_query_time=$_GET["end_query_time"];} + elseif (isset($_POST["end_query_time"])) {$end_query_time=$_POST["end_query_time"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ENVIAR"])) {$ENVIAR=$_GET["ENVIAR"];} + elseif (isset($_POST["ENVIAR"])) {$ENVIAR=$_POST["ENVIAR"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and modify_servers='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +# path from root to where ploticus files will be stored +$PLOTroot = "vicidial/ploticus"; +$DOCroot = "$WeBServeRRooT/$PLOTroot/"; + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); + +if (!isset($query_date)) {$query_date = $NOW_DATE;} +if (!isset($begin_query_time)) {$begin_query_time = '09:00:00';} +if (!isset($end_query_time)) {$end_query_time = '15:30:00';} +if (!isset($group)) {$group = '';} + +$stmt="select server_ip from servers;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$servers_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $servers_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: Server Performance\n"; +echo "
\n"; +echo "Date:   \n"; +echo "Time: \n"; +echo "to \n"; +echo "Server: \n"; +echo "\n"; +echo "             INFORMES \n"; +echo "
\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A SERVER, DATE AND TIME RANGE ABOVE AND CLICK ENVIAR\n";
+}
+
+else
+{
+
+$query_date_BEGIN = "$query_date $begin_query_time";   
+$query_date_END = "$query_date $end_query_time";
+$time_BEGIN = "$begin_query_time";   
+$time_END = "$end_query_time";
+
+echo "VICIDIAL: Server Performance                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- TOTALS, PEAKS and AVERAGES\n";
+
+$stmt="select AVG(sysload),AVG(channels_total),MAX(sysload),MAX(channels_total),MAX(processes) from server_performance where start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and server_ip='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$AVGload =	sprintf("%10s", $row[0]);
+$AVGchannels =	sprintf("%10s", $row[1]);
+$HIGHload =	$row[2];
+	$HIGHmulti = intval($HIGHload / 100);
+$HIGHchannels =	$row[3];
+$HIGHprocesses =$row[4];
+if ($row[2] > $row[3]) {$HIGHlimit = $row[2];}
+else {$HIGHlimit = $row[3];}
+if ($HIGHlimit < $row[4]) {$HIGHlimit = $row[4];}
+
+$stmt="select AVG(cpu_user_percent),AVG(cpu_system_percent),AVG(cpu_idle_percent) from server_performance where start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and server_ip='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$AVGcpuUSER =	sprintf("%10s", $row[0]);
+$AVGcpuSYSTEM =	sprintf("%10s", $row[1]);
+$AVGcpuIDLE =	sprintf("%10s", $row[2]);
+
+$stmt="select count(*),SUM(length_in_min) from call_log where extension NOT IN('8365','8366','8367') and  start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and server_ip='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$OFFHOOKtime =	sprintf("%10s", $row[1]);
+
+
+echo "Total Calls in/out on this server:        $TOTALcalls\n";
+echo "Total Off-Hook time on this server (min): $OFFHOOKtime\n";
+echo "Average/Peak channels in use for server:  $AVGchannels / $HIGHchannels\n";
+echo "Average/Peak load for server:             $AVGload / $HIGHload\n";
+echo "Average USER process cpu percentage:      $AVGcpuUSER %\n";
+echo "Average SYSTEM process cpu percentage:    $AVGcpuSYSTEM %\n";
+echo "Average IDLE process cpu percentage:      $AVGcpuIDLE %\n";
+
+echo "\n";
+echo "---------- LINE GRAPH:\n";
+
+
+
+##############################
+#########  Graph stats
+
+$DAT = '.dat';
+$HTM = '.htm';
+$PNG = '.png';
+$filedate = date("Y-m-d_His");
+$DATfile = "$group$query_date$shift$filedate$DAT";
+$HTMfile = "$group$query_date$shift$filedate$HTM";
+$PNGfile = "$group$query_date$shift$filedate$PNG";
+
+$HTMfp = fopen ("$DOCroot/$HTMfile", "a");
+$DATfp = fopen ("$DOCroot/$DATfile", "a");
+
+$stmt="select DATE_FORMAT(start_time,'%H:%i:%s') as timex,sysload,processes,channels_total,live_recordings,cpu_user_percent,cpu_system_percent from server_performance where server_ip='" . mysql_real_escape_string($group) . "' and start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' order by timex;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$row[5] = intval(($row[5] + $row[6]) * $HIGHmulti);
+	$row[6] = intval($row[6] * $HIGHmulti);
+	fwrite ($DATfp, "$row[5]\t$row[6]\t$row[0]\t$row[1]\t$row[2]\t$row[3]\n");
+	$i++;
+	}
+fclose($DATfp);
+
+$rows_to_max = ($rows_to_print + 100);
+
+#print "rows: $i\n";
+
+$time_scale_abb = '5 minutes';
+$time_scale_tick = '1 minute';
+if ($i > 1000) {$time_scale_abb = '10 minutes';   $time_scale_tick = '2 minutes';}
+if ($i > 2000) {$time_scale_abb = '20 minutes';   $time_scale_tick = '4 minutes';}
+if ($i > 3000) {$time_scale_abb = '30 minutes';   $time_scale_tick = '5 minutes';}
+if ($i > 4000) {$time_scale_abb = '40 minutes';   $time_scale_tick = '10 minutes';}
+if ($i > 5000) {$time_scale_abb = '60 minutes';   $time_scale_tick = '15 minutes';}
+if ($i > 6000) {$time_scale_abb = '90 minutes';   $time_scale_tick = '15 minutes';}
+if ($i > 7000) {$time_scale_abb = '120 minutes';   $time_scale_tick = '30 minutes';}
+
+$HTMcontent  = '';
+$HTMcontent .= "#proc page\n";
+$HTMcontent .= "#if @DEVICE in png,gif\n";
+$HTMcontent .= "   scale: 0.6\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#endif\n";
+$HTMcontent .= "#proc getdata\n";
+$HTMcontent .= "file: $DOCroot/$DATfile\n";
+$HTMcontent .= "fieldnames: userproc sysproc time load processes channels\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc areadef\n";
+$HTMcontent .= "title: Server $group   $query_date_BEGIN to $query_date_END\n";
+$HTMcontent .= "titledetails: size=14  align=C\n";
+$HTMcontent .= "rectangle: 1 1 14 7\n";
+$HTMcontent .= "xscaletype: time hh:mm:ss\n";
+$HTMcontent .= "xrange: $time_BEGIN $time_END\n";
+$HTMcontent .= "yrange: 0 $HIGHlimit\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc xaxis\n";
+$HTMcontent .= "stubs: inc $time_scale_abb\n";
+$HTMcontent .= "minorticinc: $time_scale_tick\n";
+$HTMcontent .= "stubformat: hh:mm:ssa\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc yaxis\n";
+$HTMcontent .= "stubs: inc 50\n";
+$HTMcontent .= "grid: color=yellow\n";
+$HTMcontent .= "gridskip: min\n";
+$HTMcontent .= "ticincrement: 100 1000\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc lineplot\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: userproc\n";
+$HTMcontent .= "linedetails: color=purple width=.5\n";
+$HTMcontent .= "fill: lavender\n";
+$HTMcontent .= "legendlabel: user proc%\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc lineplot\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: sysproc\n";
+$HTMcontent .= "linedetails: color=yelloworange width=.5\n";
+$HTMcontent .= "fill: dullyellow\n";
+$HTMcontent .= "legendlabel: system proc%\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: load\n";
+$HTMcontent .= "linedetails: color=blue width=.5\n";
+$HTMcontent .= "legendlabel: load\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: processes\n";
+$HTMcontent .= "linedetails: color=red width=.5\n";
+$HTMcontent .= "legendlabel: processes\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: channels\n";
+$HTMcontent .= "linedetails: color=green width=.5\n";
+$HTMcontent .= "legendlabel: channels\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc legend\n";
+$HTMcontent .= "location: max-2 max\n";
+$HTMcontent .= "seglen: 0.2\n";
+$HTMcontent .= "\n";
+
+fwrite ($HTMfp, "$HTMcontent");
+fclose($HTMfp);
+
+
+passthru("/usr/local/bin/pl -png $DOCroot/$HTMfile -o $DOCroot/$PNGfile");
+
+sleep(1);
+
+echo "
\n"; +echo "\n"; +echo "\n"; + + +echo ""; + +} + + + +?> + + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_timeonVDAD.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_timeonVDAD.php new file mode 100644 index 00000000..b9024460 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_timeonVDAD.php @@ -0,0 +1,374 @@ + LICENSE: GPLv2 +### +# live real-time stats for the VICIDIAL Auto-Dialer +# +# CHANGES +# +# 60620-1037 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 61114-2004 - Changed to display CLOSER and DEFAULT, added trunk shortage +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["reset_counter"])) {$reset_counter=$_GET["reset_counter"];} + elseif (isset($_POST["reset_counter"])) {$reset_counter=$_POST["reset_counter"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ENVIAR"])) {$ENVIAR=$_GET["ENVIAR"];} + elseif (isset($_POST["ENVIAR"])) {$ENVIAR=$_POST["ENVIAR"];} +if (isset($_GET["closer_display"])) {$closer_display=$_GET["closer_display"];} + elseif (isset($_POST["closer_display"])) {$closer_display=$_POST["closer_display"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +$epochSIXhoursAGO = ($STARTtime - 21600); +$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO); + +$reset_counter++; + +if ($reset_counter > 7) + { + $reset_counter=0; + + $stmt="update park_log set status='HUNGUP' where hangup_time is not null;"; +# $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + + if ($DB) + { + $stmt="delete from park_log where grab_time < '$timeSIXhoursAGO' and (hangup_time is null or hangup_time='');"; +# $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + } + } + +?> + + + +\n"; +echo " + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On VDAD\n"; +echo "
";
+
+###################################################################################
+###### SERVER INFORMATION
+###################################################################################
+
+$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where server_ip='" . mysql_real_escape_string($server_ip) . "';";
+$rslt=mysql_query($stmt, $link);
+$row=mysql_fetch_row($rslt);
+$balanceSHORT = $row[0];
+
+echo "SERVER: $server_ip\n";
+
+
+
+###################################################################################
+###### TIME ON SYSTEM
+###################################################################################
+
+if ($closer_display>0) {$closer_display_reverse=0;   $closer_reverse_link='DEFAULT';}
+else {$closer_display_reverse=1;   $closer_reverse_link='CLOSER';}
+
+echo "VICIDIAL: Agents Time On Calls           $NOW_TIME    $closer_reverse_link | INFORMES\n\n";
+
+if ($closer_display>0)
+{
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+echo "| STATION    | USER   | SESSIONID | CHANNEL             | STATUS | CALLTIME | MINUTES | CAMPAIGN     | FRONT  |\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+}
+else
+{
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+\n";
+echo "| STATION    | USER   | SESSIONID | CHANNEL             | STATUS | CALLTIME | MINUTES |\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+\n";
+}
+
+$stmt="select extension,user,conf_exten,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),uniqueid,lead_id from vicidial_live_agents where status NOT IN('PAUSED') and server_ip='" . mysql_real_escape_string($server_ip) . "' order by extension;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$talking_to_print = mysql_num_rows($rslt);
+	if ($talking_to_print > 0)
+	{
+	$i=0;
+	while ($i < $talking_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+			if (eregi("READY|PAUSED|CLOSER",$row[4]))
+			{
+			$row[3]='';
+			$row[5]='- WAIT -';
+			$row[6]=$row[7];
+			}
+		$extension[$i] = eregi_replace('Local/',"",$row[0]);
+		$extension[$i] =		sprintf("%-10s", $extension[$i]);
+			while(strlen($extension[$i])>10) {$extension[$i] = substr("$extension[$i]", 0, -1);}
+		$user[$i] =				sprintf("%-6s", $row[1]);
+		$sessionid[$i] =		sprintf("%-9s", $row[2]);
+		$channel[$i] =			sprintf("%-19s", $row[3]);
+			$cc[$i]=0;
+		while ( (strlen($channel[$i]) > 19) and ($cc[$i] < 100) )
+			{
+			$channel[$i] = eregi_replace(".$","",$channel[$i]);   
+			$cc[$i]++;
+			if (strlen($channel[$i]) <= 19) {$cc[$i]=101;}
+			}
+		$status[$i] =			sprintf("%-6s", $row[4]);
+		$start_time[$i] =		sprintf("%-8s", $row[5]);
+			$cd[$i]=0;
+		while ( (strlen($start_time[$i]) > 8) and ($cd[$i] < 100) )
+			{
+			$start_time[$i] = eregi_replace("^.","",$start_time[$i]);   
+			$cd[$i]++;
+			if (strlen($start_time[$i]) <= 8) {$cd[$i]=101;}
+			}
+		$uniqueid[$i] =			$row[8];
+		$lead_id[$i] =			$row[9];
+		$closer[$i] =			$row[1];
+		$call_time_S[$i] = ($STARTtime - $row[6]);
+
+		$call_time_M[$i] = ($call_time_S[$i] / 60);
+		$call_time_M[$i] = round($call_time_M[$i], 2);
+		$call_time_M_int[$i] = intval("$call_time_M[$i]");
+		$call_time_SEC[$i] = ($call_time_M[$i] - $call_time_M_int[$i]);
+		$call_time_SEC[$i] = ($call_time_SEC[$i] * 60);
+		$call_time_SEC[$i] = round($call_time_SEC[$i], 0);
+		if ($call_time_SEC[$i] < 10) {$call_time_SEC[$i] = "0$call_time_SEC[$i]";}
+		$call_time_MS[$i] = "$call_time_M_int[$i]:$call_time_SEC[$i]";
+		$call_time_MS[$i] =		sprintf("%7s", $call_time_MS[$i]);
+
+		if ($closer_display<1)
+			{
+			$G = '';		$EG = '';
+			if ($call_time_M_int[$i] >= 5) {$G=''; $EG='';}
+			if ($call_time_M_int[$i] >= 10) {$G=''; $EG='';}
+			if (eregi("PAUSED",$row[4])) 
+				{
+				if ($call_time_M_int >= 1) 
+					{$i++; continue;} 
+				else
+					{$G=''; $EG='';}
+				}
+			$agentcount++;
+			echo "| $G$extension[$i]$EG | $G$user[$i]$EG | $G$sessionid[$i]$EG | $G$channel[$i]$EG | $G$status[$i]$EG | $G$start_time[$i]$EG | $G$call_time_MS[$i]$EG |\n";
+			}
+		$i++;
+		}
+
+		if ($closer_display>0)
+		{
+
+			$ext_count = $i;
+			$i=0;
+		while ($i < $ext_count)
+			{
+
+			$stmt="select campaign_id from vicidial_auto_calls where lead_id='$lead_id[$i]' and server_ip='" . mysql_real_escape_string($server_ip) . "';";
+			$rslt=mysql_query($stmt, $link);
+			if ($DB) {echo "$stmt\n";}
+			$camp_to_print = mysql_num_rows($rslt);
+			if ($camp_to_print > 0)
+				{
+				$row=mysql_fetch_row($rslt);
+				$campaign = sprintf("%-12s", $row[0]);
+				$camp_color = $row[0];
+				}
+			else
+				{$campaign = 'DEAD        ';   	$camp_color = 'DEAD';}
+			if (eregi("READY|PAUSED|CLOSER",$status[$i]))
+				{$campaign = '            ';   	$camp_color = '';}
+
+			$stmt="select user from vicidial_xfer_log where lead_id='$lead_id[$i]' and closer='$closer[$i]' order by call_date desc limit 1;";
+			$rslt=mysql_query($stmt, $link);
+			if ($DB) {echo "$stmt\n";}
+			$xfer_to_print = mysql_num_rows($rslt);
+			if ($xfer_to_print > 0)
+				{
+				$row=mysql_fetch_row($rslt);
+				$fronter = sprintf("%-6s", $row[0]);
+				}
+			else
+				{$fronter = '      ';}
+
+			$G = '';		$EG = '';
+			$G=""; $EG='';
+		#	if ($call_time_M_int[$i] >= 5) {$G=''; $EG='';}
+		#	if ($call_time_M_int[$i] >= 10) {$G=''; $EG='';}
+
+			echo "| $G$extension[$i]$EG | $G$user[$i]$EG | $G$sessionid[$i]$EG | $G$channel[$i]$EG | $G$status[$i]$EG | $G$start_time[$i]$EG | $G$call_time_MS[$i]$EG | $G$campaign$EG | $G$fronter$EG |\n";
+
+			$i++;
+			}
+		echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+		echo "  $i agentes identificados en el servidor $server_ip\n\n";
+	#	echo "             - Llamadas de 5 minutos o más\n";
+	#	echo "             - Sobre 10 minutos en llamada\n";
+		}
+	else
+		{
+		echo "+------------|--------+-----------+---------------------+--------+----------+---------+\n";
+		echo "  $agentcount agentes identificados en el servidor $server_ip\n\n";
+
+		echo "             - Agentes detenidos brevemente\n";
+		echo "             - Llamadas de 5 minutos o más\n";
+		echo "             - Sobre 10 minutos en llamada\n";
+		}
+
+	}
+	else
+	{
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	echo "*********************************AGENTES SIN LLAMADAS*********************************\n";
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	}
+
+
+###################################################################################
+###### OUTBOUND CALLS
+###################################################################################
+#echo "\n\n";
+echo "----------------------------------------------------------------------------------------";
+echo "\n\n";
+echo "VICIDIAL: Time On VDAD            TRUNK SHORT: $balanceSHORT              $NOW_TIME\n\n";
+echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+echo "| CHANNEL             | STATUS | CAMPAIGN     | PHONE NUMBER       | CALLTIME | MINUTES |\n";
+echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+
+$stmt="select channel,status,campaign_id,phone_code,phone_number,call_time,UNIX_TIMESTAMP(call_time) from vicidial_auto_calls where status NOT IN('XFER') and server_ip='" . mysql_real_escape_string($server_ip) . "' order by auto_call_id desc;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$parked_to_print = mysql_num_rows($rslt);
+	if ($parked_to_print > 0)
+	{
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$channel =			sprintf("%-19s", $row[0]);
+			$cc=0;
+		while ( (strlen($channel) > 19) and ($cc < 100) )
+			{
+			$channel = eregi_replace(".$","",$channel);   
+			$cc++;
+			if (strlen($channel) <= 19) {$cc=101;}
+			}
+		$start_time =		sprintf("%-8s", $row[5]);
+			$cd=0;
+		while ( (strlen($start_time) > 8) and ($cd < 100) )
+			{
+			$start_time = eregi_replace("^.","",$start_time);   
+			$cd++;
+			if (strlen($start_time) <= 8) {$cd=101;}
+			}
+		$status =			sprintf("%-6s", $row[1]);
+		$campaign =			sprintf("%-12s", $row[2]);
+			$all_phone = "$row[3]$row[4]";
+		$number_dialed =	sprintf("%-18s", $all_phone);
+		$call_time_S = ($STARTtime - $row[6]);
+
+		$call_time_M = ($call_time_S / 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";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if (eregi("LIVE",$status)) {$G=''; $EG='';}
+	#	if ($call_time_M_int >= 6) {$G=''; $EG='';}
+
+		echo "| $G$channel$EG | $G$status$EG | $G$campaign$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+		echo "  $i llamadas en el servidor $server_ip\n\n";
+
+		echo "             - LLAMADAS ACTUALES EN ESPERA\n";
+	#	echo "             - Over 5 minutes on hold\n";
+
+		}
+	else
+	{
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	echo "*******************************LLAMADAS EN ESPERA*********************************\n";
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	}
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_timeonVDAD_closer.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_timeonVDAD_closer.php new file mode 100644 index 00000000..1230001d --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_timeonVDAD_closer.php @@ -0,0 +1,318 @@ + LICENSE: GPLv2 +### +# live real-time stats for the VICIDIAL Auto-Dialer +# +# CHANGES +# +# 60620-1037 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["reset_counter"])) {$reset_counter=$_GET["reset_counter"];} + elseif (isset($_POST["reset_counter"])) {$reset_counter=$_POST["reset_counter"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ENVIAR"])) {$ENVIAR=$_GET["ENVIAR"];} + elseif (isset($_POST["ENVIAR"])) {$ENVIAR=$_POST["ENVIAR"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +$epochSIXhoursAGO = ($STARTtime - 21600); +$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO); + +$reset_counter++; + +if ($reset_counter > 7) + { + $reset_counter=0; + + $stmt="update park_log set status='HUNGUP' where hangup_time is not null;"; +# $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + + if ($DB) + { + $stmt="delete from park_log where grab_time < '$timeSIXhoursAGO' and (hangup_time is null or hangup_time='');"; +# $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + } + } + +?> + + + +\n"; +echo " + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On VDAD\n"; +echo "
";
+
+###################################################################################
+###### TIME ON SYSTEM
+###################################################################################
+
+echo "VICIDIAL: Tiempo de los  Agentes En Llamadas        $NOW_TIME    INFORMES\n\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+echo "| STATION    | USER   | SESSIONID | CHANNEL             | STATUS | CALLTIME | MINUTES | CAMPAIGN     | FRONT  |\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+
+
+$stmt="select extension,user,conf_exten,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),uniqueid,lead_id from vicidial_live_agents where status NOT IN('PAUSED') and server_ip='" . mysql_real_escape_string($server_ip) . "' order by extension;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$talking_to_print = mysql_num_rows($rslt);
+	if ($talking_to_print > 0)
+	{
+	$i=0;
+	while ($i < $talking_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+			if (eregi("READY|PAUSED|CLOSER",$row[4]))
+			{
+			$row[3]='';
+			$row[5]='- WAIT -';
+			$row[6]=$row[7];
+			}
+		$extension[$i] = eregi_replace('Local/',"",$row[0]);
+		$extension[$i] =		sprintf("%-10s", $extension[$i]);
+			while(strlen($extension[$i])>10) {$extension[$i] = substr("$extension[$i]", 0, -1);}
+		$user[$i] =				sprintf("%-6s", $row[1]);
+		$sessionid[$i] =		sprintf("%-9s", $row[2]);
+		$channel[$i] =			sprintf("%-19s", $row[3]);
+			$cc[$i]=0;
+		while ( (strlen($channel[$i]) > 19) and ($cc[$i] < 100) )
+			{
+			$channel[$i] = eregi_replace(".$","",$channel[$i]);   
+			$cc[$i]++;
+			if (strlen($channel[$i]) <= 19) {$cc[$i]=101;}
+			}
+		$status[$i] =			sprintf("%-6s", $row[4]);
+		$start_time[$i] =		sprintf("%-8s", $row[5]);
+			$cd[$i]=0;
+		while ( (strlen($start_time[$i]) > 8) and ($cd[$i] < 100) )
+			{
+			$start_time[$i] = eregi_replace("^.","",$start_time[$i]);   
+			$cd[$i]++;
+			if (strlen($start_time[$i]) <= 8) {$cd[$i]=101;}
+			}
+		$uniqueid[$i] =			$row[8];
+		$lead_id[$i] =			$row[9];
+		$closer[$i] =			$row[1];
+		$call_time_S[$i] = ($STARTtime - $row[6]);
+
+		$call_time_M[$i] = ($call_time_S[$i] / 60);
+		$call_time_M[$i] = round($call_time_M[$i], 2);
+		$call_time_M_int[$i] = intval("$call_time_M[$i]");
+		$call_time_SEC[$i] = ($call_time_M[$i] - $call_time_M_int[$i]);
+		$call_time_SEC[$i] = ($call_time_SEC[$i] * 60);
+		$call_time_SEC[$i] = round($call_time_SEC[$i], 0);
+		if ($call_time_SEC[$i] < 10) {$call_time_SEC[$i] = "0$call_time_SEC[$i]";}
+		$call_time_MS[$i] = "$call_time_M_int[$i]:$call_time_SEC[$i]";
+		$call_time_MS[$i] =		sprintf("%7s", $call_time_MS[$i]);
+		$i++;
+		}
+		$ext_count = $i;
+		$i=0;
+	while ($i < $ext_count)
+		{
+
+		$stmt="select campaign_id from vicidial_auto_calls where lead_id='$lead_id[$i]' and server_ip='" . mysql_real_escape_string($server_ip) . "';";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$camp_to_print = mysql_num_rows($rslt);
+		if ($camp_to_print > 0)
+			{
+			$row=mysql_fetch_row($rslt);
+			$campaign = sprintf("%-12s", $row[0]);
+			$camp_color = $row[0];
+			}
+		else
+			{$campaign = 'DEAD        ';   	$camp_color = 'DEAD';}
+		if (eregi("READY|PAUSED|CLOSER",$status[$i]))
+			{$campaign = '            ';   	$camp_color = '';}
+
+		$stmt="select user from vicidial_xfer_log where lead_id='$lead_id[$i]' and closer='$closer[$i]' order by call_date desc limit 1;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$xfer_to_print = mysql_num_rows($rslt);
+		if ($xfer_to_print > 0)
+			{
+			$row=mysql_fetch_row($rslt);
+			$fronter = sprintf("%-6s", $row[0]);
+			}
+		else
+			{$fronter = '      ';}
+
+		$G = '';		$EG = '';
+		$G=""; $EG='';
+	#	if ($call_time_M_int[$i] >= 5) {$G=''; $EG='';}
+	#	if ($call_time_M_int[$i] >= 10) {$G=''; $EG='';}
+
+		echo "| $G$extension[$i]$EG | $G$user[$i]$EG | $G$sessionid[$i]$EG | $G$channel[$i]$EG | $G$status[$i]$EG | $G$start_time[$i]$EG | $G$call_time_MS[$i]$EG | $G$campaign$EG | $G$fronter$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+		echo "  $i agentes identificados en el servidor $server_ip\n\n";
+
+	#	echo "             - Llamadas de 5 minutos o más\n";
+	#	echo "             - Sobre 10 minutos en llamada\n";
+
+	}
+	else
+	{
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	echo "*********************************AGENTES SIN LLAMADAS*********************************\n";
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	}
+
+
+###################################################################################
+###### OUTBOUND CALLS
+###################################################################################
+#echo "\n\n";
+echo "----------------------------------------------------------------------------------------";
+echo "\n\n";
+echo "VICIDIAL: Time On VDAD                                              $NOW_TIME\n\n";
+echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+echo "| CHANNEL             | STATUS | CAMPAIGN     | PHONE NUMBER       | CALLTIME | MINUTES |\n";
+echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+
+#$link=mysql_connect("localhost", "cron", "1234");
+# $linkX=mysql_connect("localhost", "cron", "1234");
+#mysql_select_db("asterisk");
+
+$stmt="select channel,status,campaign_id,phone_code,phone_number,call_time,UNIX_TIMESTAMP(call_time) from vicidial_auto_calls where status NOT IN('XFER') and server_ip='" . mysql_real_escape_string($server_ip) . "' order by auto_call_id desc;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$parked_to_print = mysql_num_rows($rslt);
+	if ($parked_to_print > 0)
+	{
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$channel =			sprintf("%-19s", $row[0]);
+			$cc=0;
+		while ( (strlen($channel) > 19) and ($cc < 100) )
+			{
+			$channel = eregi_replace(".$","",$channel);   
+			$cc++;
+			if (strlen($channel) <= 19) {$cc=101;}
+			}
+		$start_time =		sprintf("%-8s", $row[5]);
+			$cd=0;
+		while ( (strlen($start_time) > 8) and ($cd < 100) )
+			{
+			$start_time = eregi_replace("^.","",$start_time);   
+			$cd++;
+			if (strlen($start_time) <= 8) {$cd=101;}
+			}
+		$status =			sprintf("%-6s", $row[1]);
+		$campaign =			sprintf("%-12s", $row[2]);
+			$all_phone = "$row[3]$row[4]";
+		$number_dialed =	sprintf("%-18s", $all_phone);
+		$call_time_S = ($STARTtime - $row[6]);
+
+		$call_time_M = ($call_time_S / 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";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if (eregi("LIVE",$status)) {$G=''; $EG='';}
+	#	if ($call_time_M_int >= 6) {$G=''; $EG='';}
+
+		echo "| $G$channel$EG | $G$status$EG | $G$campaign$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+		echo "  $i llamadas en el servidor $server_ip\n\n";
+
+		echo "             - LLAMADAS ACTUALES EN ESPERA\n";
+	#	echo "             - Over 5 minutes on hold\n";
+
+		}
+	else
+	{
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	echo "*******************************LLAMADAS EN ESPERA*********************************\n";
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	}
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_timeonVDADall.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_timeonVDADall.php new file mode 100644 index 00000000..c625746e --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_timeonVDADall.php @@ -0,0 +1,826 @@ + LICENSE: GPLv2 +# +# live real-time stats for the VICIDIAL Auto-Dialer all servers +# +# STOP=4000, SLOW=40, GO=4 seconds refresh interval +# +# CHANGELOG: +# 50406-0920 - Added Paused agents < 1 min (Chris Doyle) +# 51130-1218 - Modified layout and info to show all servers in a vicidial system +# 60421-1043 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60511-1343 - Added leads and drop info at the top of the screen +# 60608-1539 - Fixed CLOSER tallies for active calls +# 60619-1658 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 60626-1453 - Added display of system load to bottom (Angelito Manansala) +# 60901-1123 - Changed display elements at the top of the screen +# 60905-1342 - Fixed non INCALL|QUEUE timer column +# 61002-1642 - Added TRUNK SHORT/FILL stats +# 61101-1318 - Added SIP and IAX Listen and Barge links option +# 61101-1647 - Added Usergroup column and user name option as well as sorting +# 61102-1155 - Made display of columns more modular, added ability to hide server info +# 61215-1131 - Added answered calls and drop percent taken from answered calls +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70123-1151 - Added non_latin options for substr in display variables, thanks Marin Blu +# 70206-1140 - Added call-type statuses to display(A-Auto, M-Manual, I-Inbound/Closer) +# 70619-1339 - Added Status Category tally display +# 71029-1900 - Changed CLOSER-type to not require campaign_id restriction +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["RR"])) {$RR=$_GET["RR"];} + elseif (isset($_POST["RR"])) {$RR=$_POST["RR"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["usergroup"])) {$usergroup=$_GET["usergroup"];} + elseif (isset($_POST["usergroup"])) {$usergroup=$_POST["usergroup"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["adastats"])) {$adastats=$_GET["adastats"];} + elseif (isset($_POST["adastats"])) {$adastats=$_POST["adastats"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ENVIAR"])) {$ENVIAR=$_GET["ENVIAR"];} + elseif (isset($_POST["ENVIAR"])) {$ENVIAR=$_POST["ENVIAR"];} +if (isset($_GET["SIPmonitorLINK"])) {$SIPmonitorLINK=$_GET["SIPmonitorLINK"];} + elseif (isset($_POST["SIPmonitorLINK"])) {$SIPmonitorLINK=$_POST["SIPmonitorLINK"];} +if (isset($_GET["IAXmonitorLINK"])) {$IAXmonitorLINK=$_GET["IAXmonitorLINK"];} + elseif (isset($_POST["IAXmonitorLINK"])) {$IAXmonitorLINK=$_POST["IAXmonitorLINK"];} +if (isset($_GET["UGdisplay"])) {$UGdisplay=$_GET["UGdisplay"];} + elseif (isset($_POST["UGdisplay"])) {$UGdisplay=$_POST["UGdisplay"];} +if (isset($_GET["UidORname"])) {$UidORname=$_GET["UidORname"];} + elseif (isset($_POST["UidORname"])) {$UidORname=$_POST["UidORname"];} +if (isset($_GET["orderby"])) {$orderby=$_GET["orderby"];} + elseif (isset($_POST["orderby"])) {$orderby=$_POST["orderby"];} +if (isset($_GET["SERVdisplay"])) {$SERVdisplay=$_GET["SERVdisplay"];} + elseif (isset($_POST["SERVdisplay"])) {$SERVdisplay=$_POST["SERVdisplay"];} + + + +if (!isset($RR)) {$gRRroup=4;} +if (!isset($group)) {$group='';} +if (!isset($usergroup)) {$usergroup='';} +if (!isset($UGdisplay)) {$UGdisplay=0;} # 0=no, 1=yes +if (!isset($UidORname)) {$UidORname=0;} # 0=id, 1=name +if (!isset($orderby)) {$orderby='timeup';} +if (!isset($SERVdisplay)) {$SERVdisplay=1;} # 0=no, 1=yes + +function get_server_load($windows = false) { +$os = strtolower(PHP_OS); +if(strpos($os, "win") === false) { +if(file_exists("/proc/loadavg")) { +$load = file_get_contents("/proc/loadavg"); +$load = explode(' ', $load); +return $load[0]; +} +elseif(function_exists("shell_exec")) { +$load = explode(' ', `uptime`); +return $load[count($load)-1]; +} +else { +return false; +} +} +elseif($windows) { +if(class_exists("COM")) { +$wmi = new COM("WinMgmts:\\\\."); +$cpus = $wmi->InstancesOf("Win32_Processor"); + +$cpuload = 0; +$i = 0; +while ($cpu = $cpus->Next()) { +$cpuload += $cpu->LoadPercentage; +$i++; +} + +$cpuload = round($cpuload / $i, 2); +return "$cpuload%"; +} +else { +return false; +} +} +} + +$load_ave = get_server_load(true); + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + 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($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_TIME = date("Y-m-d H:i:s"); +$NOW_DAY = date("Y-m-d"); +$NOW_HOUR = date("H:i:s"); +$STARTtime = date("U"); +$epochSIXhoursAGO = ($STARTtime - 21600); +$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO); + +$stmt="select campaign_id from vicidial_campaigns where active='Y';"; +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +if (!isset($DB)) {$DB=0;} +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + +$stmt="select * from vicidial_user_groups;"; +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +if (!isset($DB)) {$DB=0;} +if ($DB) {echo "$stmt\n";} +$usergroups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $usergroups_to_print) + { + $row=mysql_fetch_row($rslt); + $usergroups[$i] =$row[0]; + $i++; + } + +if (!isset($RR)) {$RR=4;} + +$NFB = ''; +$NFE = ''; +$F=''; $FG=''; $B=''; $BG=''; + +?> + + + + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On VDAD Campaña: $group\n"; +echo "
\n"; +echo "VICIDIAL Campaña: \n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +if ($UGdisplay > 0) + { + echo "\n"; + } +echo "         \n"; +echo "STOP | "; +echo "SLOW | "; +echo "GO"; +echo "       MODIFICAR | \n"; +echo "SUMMARY | \n"; +echo "INFORMES \n"; +echo "\n\n"; + + +if (!$group) {echo "

please select a campaign from the pulldown above
\n"; exit;} +else +{ +$stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select avg(auto_dial_level),min(dial_status_a),min(dial_status_b),min(dial_status_c),min(dial_status_d),min(dial_status_e),min(lead_order),min(lead_filter_id),sum(hopper_level),min(dial_method),avg(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),min(available_only_ratio_tally),min(adaptive_latest_server_time),min(local_call_time),avg(dial_timeout),min(dial_statuses) from vicidial_campaigns;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$DIALlev = $row[0]; +$DIALstatusA = $row[1]; +$DIALstatusB = $row[2]; +$DIALstatusC = $row[3]; +$DIALstatusD = $row[4]; +$DIALstatusE = $row[5]; +$DIALorder = $row[6]; +$DIALfilter = $row[7]; +$HOPlev = $row[8]; +$DIALmethod = $row[9]; +$maxDIALlev = $row[10]; +$DROPmax = $row[11]; +$targetDIFF = $row[12]; +$ADAintense = $row[13]; +$ADAavailonly = $row[14]; +$TAPERtime = $row[15]; +$CALLtime = $row[16]; +$DIALtimeout = $row[17]; +$DIALstatuses = $row[18]; + $DIALstatuses = (preg_replace("/ -$|^ /","",$DIALstatuses)); + $DIALstatuses = (ereg_replace(' ',', ',$DIALstatuses)); + +$stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select count(*) from vicidial_hopper;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$VDhop = $row[0]; + +$stmt="select dialable_leads,calls_today,drops_today,drops_answers_today_pct,differential_onemin,agents_average_onemin,balance_trunk_fill,answers_today,status_category_1,status_category_count_1,status_category_2,status_category_count_2,status_category_3,status_category_count_3,status_category_4,status_category_count_4 from vicidial_campaign_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),min(status_category_1),sum(status_category_count_1),min(status_category_2),sum(status_category_count_2),min(status_category_3),sum(status_category_count_3),min(status_category_4),sum(status_category_count_4) from vicidial_campaign_stats;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$DAleads = $row[0]; +$callsTODAY = $row[1]; +$dropsTODAY = $row[2]; +$drpctTODAY = $row[3]; +$diffONEMIN = $row[4]; +$agentsONEMIN = $row[5]; +$balanceFILL = $row[6]; +$answersTODAY = $row[7]; +$VSCcat1 = $row[8]; +$VSCcat1tally = $row[9]; +$VSCcat2 = $row[10]; +$VSCcat2tally = $row[11]; +$VSCcat3 = $row[12]; +$VSCcat3tally = $row[13]; +$VSCcat4 = $row[14]; +$VSCcat4tally = $row[15]; + +if ( ($diffONEMIN != 0) and ($agentsONEMIN > 0) ) + { + $diffpctONEMIN = ( ($diffONEMIN / $agentsONEMIN) * 100); + $diffpctONEMIN = sprintf("%01.2f", $diffpctONEMIN); + } +else {$diffpctONEMIN = '0.00';} + +$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$balanceSHORT = $row[0]; + +echo "
"; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +if ($adastats>1) + { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; + + + + +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo "
DIAL LEVEL:  $DIALlev    TRUNK SHORT/FILL:  $balanceSHORT / $balanceFILL     FILTER:  $DIALfilter   TIME:   $NOW_TIME
- min   MAX LEVEL:  $maxDIALlev   DROPPED MAX:  $DROPmax%    TARGET DIFF:  $targetDIFF     INTENSITY:  $ADAintense    
DIAL TIMEOUT:  $DIALtimeout  TAPER TIME:  $TAPERtime  LOCAL TIME:  $CALLtime  AVAIL ONLY:  $ADAavailonly  
DIALABLE LEADS:  $DAleads     CALLS TODAY:  $callsTODAY     AVG AGENTS:  $agentsONEMIN     DIAL METHOD:  $DIALmethod    
HOPPER LEVEL:  $HOPlev     DROPPED / ANSWERED:  $dropsTODAY / $answersTODAY   DL DIFF:  $diffONEMIN     STATUSES:  $DIALstatuses    
LEADS IN HOPPER:  $VDhop     DROPPED PERCENT:  "; +if ($drpctTODAY >= $DROPmax) + {echo "$drpctTODAY%";} +else + {echo "$drpctTODAY%";} +echo "    DIFF:  $diffpctONEMIN%     ORDER:  $DIALorder    
"; +if ( (!eregi('NULL',$VSCcat1)) and (strlen($VSCcat1)>0) ) + {echo "$VSCcat1:   $VSCcat1tally       \n";} +if ( (!eregi('NULL',$VSCcat2)) and (strlen($VSCcat2)>0) ) + {echo "$VSCcat2:   $VSCcat2tally       \n";} +if ( (!eregi('NULL',$VSCcat3)) and (strlen($VSCcat3)>0) ) + {echo "$VSCcat3:   $VSCcat3tally       \n";} +if ( (!eregi('NULL',$VSCcat4)) and (strlen($VSCcat4)>0) ) + {echo "$VSCcat4:   $VSCcat4tally       \n";} +echo "
"; + +if ($adastats<2) + { + echo "+ VIEW MORE SETTINGS"; + } +if ($UGdisplay>0) + { + echo "       PIEL USER GROUP"; + } +else + { + echo "       VIEW USER GROUP"; + } +if ($UidORname>0) + { + echo "       DEMOSTRACIÓN AGENTE ID"; + } +else + { + echo "       DEMOSTRACIÓN AGENTE NAME"; + } +if ($SERVdisplay>0) + { + echo "       PIEL SERVIDOR INFO"; + } +else + { + echo "       DEMOSTRACIÓN SERVIDOR INFO"; + } +echo "
"; + +echo "\n\n"; +} +################################################################################### +###### OUTBOUND CALLS +################################################################################### +if ($campaign_allow_inbound > 0) + { + $stmt="select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = preg_replace("/^ | -$/","",$row[0]); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaigns = "'$closer_campaigns'"; + + $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') and ( (call_type='IN' and campaign_id IN($closer_campaigns)) or (campaign_id='" . mysql_real_escape_string($group) . "' and call_type='OUT') );"; + } +else + { + if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';} + else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";} + + $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') $groupSQL;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$parked_to_print = mysql_num_rows($rslt); + if ($parked_to_print > 0) + { + $i=0; + $out_total=0; + $out_ring=0; + $out_live=0; + while ($i < $parked_to_print) + { + $row=mysql_fetch_row($rslt); + + if (eregi("LIVE",$row[0])) + {$out_live++;} + else + { + if (eregi("CLOSER",$row[0])) + {$nothing=1;} + else + {$out_ring++;} + } + $out_total++; + $i++; + } + + if ($out_live > 0) {$F=''; $FG='';} + if ($out_live > 4) {$F=''; $FG='';} + if ($out_live > 9) {$F=''; $FG='';} + if ($out_live > 14) {$F=''; $FG='';} + + if ($campaign_allow_inbound > 0) + {echo "$NFB$out_total$NFE current active calls      \n";} + else + {echo "$NFB$out_total$NFE calls being placed       \n";} + + echo "$NFB$out_ring$NFE calls ringing         \n"; + echo "$NFB$F  $out_live $FG$NFE calls waiting for agents       \n"; + } + else + { + echo "LLAMADAS EN ESPERA\n"; + } + + +################################################################################### +###### TIME ON SYSTEM +################################################################################### + +$agent_incall=0; +$agent_ready=0; +$agent_paused=0; +$agent_total=0; + +$Aecho = ''; +$Aecho .= "VICIDIAL: Agents Time On Calls Campaña: $group $NOW_TIME\n\n"; + + +$HDbegin = "+"; +$HTbegin = "|"; +$HDstation = "------------+"; +$HTstation = " STATION |"; +$HDuser = "--------------------+"; +$HTuser = " USER |"; +$HDusergroup = "--------------+"; +$HTusergroup = " USER GROUP |"; +$HDsessionid = "------------------+"; +$HTsessionid = " SESSIONID |"; +$HDbarge = "-------+"; +$HTbarge = " BARGE |"; +$HDstatus = "----------+"; +$HTstatus = " STATUS |"; +$HDserver_ip = "-----------------+"; +$HTserver_ip = " SERVIDOR IP |"; +$HDcall_server_ip = "-----------------+"; +$HTcall_server_ip = " CALL SERVIDOR IP |"; +$HDtime = "---------+"; +$HTtime = " MM:SS |"; +$HDcampaign = "------------+"; +$HTcampaign = " CAMPAIGN |"; + +if ($UGdisplay < 1) + { + $HDusergroup = ''; + $HTusergroup = ''; + } +if ( ($SIPmonitorLINK<1) && ($IAXmonitorLINK<1) ) + { + $HDsessionid = "-----------+"; + $HTsessionid = " SESSIONID |"; + } +if ( ($SIPmonitorLINK<2) && ($IAXmonitorLINK<2) ) + { + $HDbarge = ''; + $HTbarge = ''; + } +if ($SERVdisplay < 1) + { + $HDserver_ip = ''; + $HTserver_ip = ''; + $HDcall_server_ip = ''; + $HTcall_server_ip = ''; + } + + + +$Aline = "$HDbegin$HDstation$HDuser$HDusergroup$HDsessionid$HDbarge$HDstatus$HDserver_ip$HDcall_server_ip$HDtime$HDcampaign\n"; +$Bline = "$HTbegin$HTstation$HTuser$HTusergroup$HTsessionid$HTbarge$HTstatus$HTserver_ip$HTcall_server_ip$HTtime$HTcampaign\n"; +$Aecho .= "$Aline"; +$Aecho .= "$Bline"; +$Aecho .= "$Aline"; + +if ($orderby=='timeup') {$orderSQL='status,last_call_time';} +if ($orderby=='timedown') {$orderSQL='status desc,last_call_time desc';} +if ($orderby=='campaignup') {$orderSQL='campaign_id,status,last_call_time';} +if ($orderby=='campaigndown') {$orderSQL='campaign_id desc,status desc,last_call_time desc';} +if ($orderby=='groupup') {$orderSQL='user_group,status,last_call_time';} +if ($orderby=='groupdown') {$orderSQL='user_group desc,status desc,last_call_time desc';} +if ($UidORname > 0) + { + if ($orderby=='userup') {$orderSQL='full_name,status,last_call_time';} + if ($orderby=='userdown') {$orderSQL='full_name desc,status desc,last_call_time desc';} + } +else + { + if ($orderby=='userup') {$orderSQL='vicidial_live_agents.user';} + if ($orderby=='userdown') {$orderSQL='vicidial_live_agents.user desc';} + } + +if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';} +else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";} +if (strlen($usergroup)<1) {$usergroupSQL = '';} +else {$usergroupSQL = " and user_group='" . mysql_real_escape_string($usergroup) . "'";} + +$stmt="select extension,vicidial_live_agents.user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id,vicidial_users.user_group,vicidial_users.full_name,vicidial_live_agents.comments from vicidial_live_agents,vicidial_users where vicidial_live_agents.user=vicidial_users.user $groupSQL $usergroupSQL order by $orderSQL;"; + +#$stmt="select extension,vicidial_live_agents.user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id,vicidial_users.user_group,vicidial_users.full_name from vicidial_live_agents,vicidial_users where vicidial_live_agents.user=vicidial_users.user and campaign_id='" . mysql_real_escape_string($group) . "' order by $orderSQL;"; + +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + $agentcount=0; + while ($i < $talking_to_print) + { + $row=mysql_fetch_row($rslt); + if (eregi("READY|PAUSED",$row[3])) + { + $row[5]=$row[6]; + } + if ($non_latin < 1) + { + $extension = eregi_replace('Local/',"",$row[0]); + $extension = sprintf("%-10s", $extension); + while(strlen($extension)>10) {$extension = substr("$extension", 0, -1);} + } + else + { + $extension = eregi_replace('Local/',"",$row[0]); + $extension = sprintf("%-40s", $extension); + while(mb_strlen($extension, 'utf-8')>10) {$extension = mb_substr("$extension", 0, -1,'utf8');} + } + $Luser = $row[1]; + $user = sprintf("%-18s", $row[1]); + $Lsessionid = $row[2]; + $sessionid = sprintf("%-9s", $row[2]); + $Lstatus = $row[3]; + $status = sprintf("%-6s", $row[3]); + $server_ip = sprintf("%-15s", $row[4]); + $call_server_ip = sprintf("%-15s", $row[7]); + $campaign_id = sprintf("%-10s", $row[8]); + $comments= $row[11]; + + if (eregi("INCALL",$Lstatus)) + { + if ( (eregi("AUTO",$comments)) or (strlen($comments)<1) ) + {$CM='A';} + else + { + if (eregi("INBOUND",$comments)) + {$CM='I';} + else + {$CM='M';} + } + } + else {$CM=' ';} + + if ($UGdisplay > 0) + { + if ($non_latin < 1) + { + $user_group = sprintf("%-12s", $row[9]); + while(strlen($user_group)>12) {$user_group = substr("$user_group", 0, -1);} + } + else + { + $user_group = sprintf("%-40s", $row[9]); + while(mb_strlen($user_group, 'utf-8')>12) {$user_group = mb_substr("$user_group", 0, -1,'utf8');} + } + } + if ($UidORname > 0) + { + if ($non_latin < 1) + { + $user = sprintf("%-18s", $row[10]); + while(strlen($user)>18) {$user = substr("$user", 0, -1);} + } + else + { + $user = sprintf("%-40s", $row[10]); + while(mb_strlen($user, 'utf-8')>18) {$user = mb_substr("$user", 0, -1,'utf8');} + } + } + if (!eregi("INCALL|QUEUE",$row[3])) + {$call_time_S = ($STARTtime - $row[6]);} + else + {$call_time_S = ($STARTtime - $row[5]);} + + $call_time_M = ($call_time_S / 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"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + if ($Lstatus=='INCALL') + { + if ($call_time_S >= 10) {$G=''; $EG='';} + if ($call_time_M_int >= 1) {$G=''; $EG='';} + if ($call_time_M_int >= 5) {$G=''; $EG='';} + # if ($call_time_M_int >= 10) {$G=''; $EG='';} + } + if (eregi("PAUSED",$row[3])) + { + if ($call_time_M_int >= 30) + {$i++; continue;} + else + { + $agent_paused++; $agent_total++; + $G=''; $EG=''; + if ($call_time_S >= 10) {$G=''; $EG='';} + if ($call_time_M_int >= 1) {$G=''; $EG='';} + if ($call_time_M_int >= 5) {$G=''; $EG='';} + } + } +# if ( (strlen($row[7])> 4) and ($row[7] != "$row[4]") ) +# {$G=''; $EG='';} + + if ( (eregi("INCALL",$status)) or (eregi("QUEUE",$status)) ) {$agent_incall++; $agent_total++;} + if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) {$agent_ready++; $agent_total++;} + if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) + { + $G=''; $EG=''; + if ($call_time_M_int >= 1) {$G=''; $EG='';} + if ($call_time_M_int >= 5) {$G=''; $EG='';} + } + + $L=''; + $R=''; + if ($SIPmonitorLINK>0) {$L=" LISTEN"; $R='';} + if ($IAXmonitorLINK>0) {$L=" LISTEN"; $R='';} + if ($SIPmonitorLINK>1) {$R=" | BARGE";} + if ($IAXmonitorLINK>1) {$R=" | BARGE";} + + if ($UGdisplay > 0) {$UGD = " $G$user_group$EG |";} + else {$UGD = "";} + + if ($SERVdisplay > 0) {$SVD = "$G$server_ip$EG | $G$call_server_ip$EG | ";} + else {$SVD = "";} + + $agentcount++; + + $Aecho .= "| $G$extension$EG | $G$user$EG |$UGD $G$sessionid$EG$L$R | $G$status$EG $CM | $SVD$G$call_time_MS$EG | $G$campaign_id$EG |\n"; + + $i++; + } + + $Aecho .= "$Aline"; + $Aecho .= " $agentcount agents logged in on all servers\n"; + $Aecho .= " System Load Average: $load_ave\n\n"; + + # $Aecho .= " - Balanced call\n"; + $Aecho .= " - Agent waiting for call\n"; + $Aecho .= " - Agent waiting for call > 1 minute\n"; + $Aecho .= " - Agent waiting for call > 5 minutes\n"; + $Aecho .= " - Agent on call > 10 seconds\n"; + $Aecho .= " - Agent on call > 1 minute\n"; + $Aecho .= " - Agent on call > 5 minutes\n"; + $Aecho .= " - Agent Paused > 10 seconds\n"; + $Aecho .= " - Agent Paused > 1 minute\n"; + $Aecho .= " - Agent Paused > 5 minutes\n"; + + if ($agent_ready > 0) {$B=''; $BG='';} + if ($agent_ready > 4) {$B=''; $BG='';} + if ($agent_ready > 9) {$B=''; $BG='';} + if ($agent_ready > 14) {$B=''; $BG='';} + + + echo "\n
\n"; + + echo "$NFB$agent_total$NFE agents logged in         \n"; + echo "$NFB$agent_incall$NFE agents in calls       \n"; + echo "$NFB$B  $agent_ready $BG$NFE agents waiting       \n"; + echo "$NFB$agent_paused$NFE paused agents       \n"; + + echo "
";
+		echo "";
+		echo "$Aecho";
+	}
+	else
+	{
+	echo "AGENTES SIN LLAMADAS\n";
+	}
+
+?>
+
+ + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_timeonVDADallSUMMARY.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_timeonVDADallSUMMARY.php new file mode 100644 index 00000000..4a45a5b6 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_timeonVDADallSUMMARY.php @@ -0,0 +1,442 @@ + LICENSE: GPLv2 +# +# Summary for all campaigns live real-time stats for the VICIDIAL Auto-Dialer all servers +# +# STOP=4000, SLOW=40, GO=4 seconds refresh interval +# +# changes: +# 61102-1616 - first build +# 61215-1131 - added answered calls and drop percent taken from answered calls +# 70111-1600 - added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70619-1339 - Added Status Category tally display +# 71029-1900 - Changed CLOSER-type to not require campaign_id restriction +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["RR"])) {$RR=$_GET["RR"];} + elseif (isset($_POST["RR"])) {$RR=$_POST["RR"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["adastats"])) {$adastats=$_GET["adastats"];} + elseif (isset($_POST["adastats"])) {$adastats=$_POST["adastats"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ENVIAR"])) {$ENVIAR=$_GET["ENVIAR"];} + elseif (isset($_POST["ENVIAR"])) {$ENVIAR=$_POST["ENVIAR"];} + +if (!isset($RR)) {$gRRroup=4;} + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); + +$stmt="select campaign_id from vicidial_campaigns where active='Y';"; +$rslt=mysql_query($stmt, $link); +if (!isset($DB)) {$DB=0;} +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + +if (!isset($RR)) {$RR=4;} + +?> + + + + + +\n"; +echo "VICIDIAL: Realtime All Campañas Summary\n"; +echo "VICIDIAL: Realtime All Campañas Summary           \n"; +echo "STOP | "; +echo "SLOW | "; +echo "GO "; +echo "       \n"; +if ($adastats<2) + { + echo "+ VIEW MORE SETTINGS"; + } +else + { + echo "- VIEW LESS SETTINGS"; + } +echo "       INFORMES"; +echo "

\n\n"; + +$k=0; +while($k<$groups_to_print) +{ +$NFB = ''; +$NFE = ''; +$F=''; $FG=''; $B=''; $BG=''; + +$group = $groups[$k]; +echo "$group   -   "; +echo "Modify\n"; + + +$stmt = "select count(*) from vicidial_campaigns where campaign_id='$group' and campaign_allow_inbound='Y';"; +$rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $campaign_allow_inbound = $row[0]; + +$stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$DIALlev = $row[0]; +$DIALstatusA = $row[1]; +$DIALstatusB = $row[2]; +$DIALstatusC = $row[3]; +$DIALstatusD = $row[4]; +$DIALstatusE = $row[5]; +$DIALorder = $row[6]; +$DIALfilter = $row[7]; +$HOPlev = $row[8]; +$DIALmethod = $row[9]; +$maxDIALlev = $row[10]; +$DROPmax = $row[11]; +$targetDIFF = $row[12]; +$ADAintense = $row[13]; +$ADAavailonly = $row[14]; +$TAPERtime = $row[15]; +$CALLtime = $row[16]; +$DIALtimeout = $row[17]; +$DIALstatuses = $row[18]; + $DIALstatuses = (preg_replace("/ -$|^ /","",$DIALstatuses)); + $DIALstatuses = (ereg_replace(' ',', ',$DIALstatuses)); + +$stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$VDhop = $row[0]; + +$stmt="select dialable_leads,calls_today,drops_today,drops_answers_today_pct,differential_onemin,agents_average_onemin,balance_trunk_fill,answers_today,status_category_1,status_category_count_1,status_category_2,status_category_count_2,status_category_3,status_category_count_3,status_category_4,status_category_count_4 from vicidial_campaign_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$DAleads = $row[0]; +$callsTODAY = $row[1]; +$dropsTODAY = $row[2]; +$drpctTODAY = $row[3]; +$diffONEMIN = $row[4]; +$agentsONEMIN = $row[5]; +$balanceFILL = $row[6]; +$answersTODAY = $row[7]; +$VSCcat1 = $row[8]; +$VSCcat1tally = $row[9]; +$VSCcat2 = $row[10]; +$VSCcat2tally = $row[11]; +$VSCcat3 = $row[12]; +$VSCcat3tally = $row[13]; +$VSCcat4 = $row[14]; +$VSCcat4tally = $row[15]; + +if ( ($diffONEMIN != 0) and ($agentsONEMIN > 0) ) + { + $diffpctONEMIN = ( ($diffONEMIN / $agentsONEMIN) * 100); + $diffpctONEMIN = sprintf("%01.2f", $diffpctONEMIN); + } +else {$diffpctONEMIN = '0.00';} + +$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$balanceSHORT = $row[0]; + +echo "
"; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +if ($adastats>1) + { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo "
DIAL LEVEL:  $DIALlev    TRUNK SHORT/FILL:  $balanceSHORT / $balanceFILL     FILTER:  $DIALfilter   TIME:   $NOW_TIME
  MAX LEVEL:  $maxDIALlev   DROPPED MAX:  $DROPmax%    TARGET DIFF:  $targetDIFF     INTENSITY:  $ADAintense    
DIAL TIMEOUT:  $DIALtimeout  TAPER TIME:  $TAPERtime  LOCAL TIME:  $CALLtime  AVAIL ONLY:  $ADAavailonly  
DIALABLE LEADS:  $DAleads     CALLS TODAY:  $callsTODAY     AVG AGENTS:  $agentsONEMIN     DIAL METHOD:  $DIALmethod    
HOPPER LEVEL:  $HOPlev     DROPPED / ANSWERED:  $dropsTODAY / $answersTODAY   DL DIFF:  $diffONEMIN     STATUSES:  $DIALstatuses    
LEADS IN HOPPER:  $VDhop     DROPPED PERCENT:  "; +if ($drpctTODAY >= $DROPmax) + {echo "$drpctTODAY%";} +else + {echo "$drpctTODAY%";} +echo "    DIFF:  $diffpctONEMIN%     ORDER:  $DIALorder    
"; +if ( (!eregi('NULL',$VSCcat1)) and (strlen($VSCcat1)>0) ) + {echo "$VSCcat1:   $VSCcat1tally       \n";} +if ( (!eregi('NULL',$VSCcat2)) and (strlen($VSCcat2)>0) ) + {echo "$VSCcat2:   $VSCcat2tally       \n";} +if ( (!eregi('NULL',$VSCcat3)) and (strlen($VSCcat3)>0) ) + {echo "$VSCcat3:   $VSCcat3tally       \n";} +if ( (!eregi('NULL',$VSCcat4)) and (strlen($VSCcat4)>0) ) + {echo "$VSCcat4:   $VSCcat4tally       \n";} +echo "
"; + +### Header finish + + + + + +################################################################################ +### START calculating calls/agents +################################################################################ + +################################################################################ +###### OUTBOUND CALLS +################################################################################ +if ($campaign_allow_inbound > 0) + { + $stmt="select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = preg_replace("/^ | -$/","",$row[0]); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaigns = "'$closer_campaigns'"; + + $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') and ( (call_type='IN' and campaign_id IN($closer_campaigns)) or (campaign_id='" . mysql_real_escape_string($group) . "' and call_type='OUT') );"; + } +else + { + if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';} + else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";} + + $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') $groupSQL;"; + } +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$parked_to_print = mysql_num_rows($rslt); + if ($parked_to_print > 0) + { + $i=0; + $out_total=0; + $out_ring=0; + $out_live=0; + while ($i < $parked_to_print) + { + $row=mysql_fetch_row($rslt); + + if (eregi("LIVE",$row[0])) + {$out_live++;} + else + { + if (eregi("CLOSER",$row[0])) + {$nothing=1;} + else + {$out_ring++;} + } + $out_total++; + $i++; + } + + if ($out_live > 0) {$F=''; $FG='';} + if ($out_live > 4) {$F=''; $FG='';} + if ($out_live > 9) {$F=''; $FG='';} + if ($out_live > 14) {$F=''; $FG='';} + + if ($campaign_allow_inbound > 0) + {echo "$NFB$out_total$NFE current active calls      \n";} + else + {echo "$NFB$out_total$NFE calls being placed       \n";} + + echo "$NFB$out_ring$NFE calls ringing         \n"; + echo "$NFB$F  $out_live $FG$NFE calls waiting for agents       \n"; + } + else + { + echo "LLAMADAS EN ESPERA\n"; + } + + +################################################################################### +###### TIME ON SYSTEM +################################################################################### + +$agent_incall=0; +$agent_ready=0; +$agent_paused=0; +$agent_total=0; + +$stmt="select extension,user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id from vicidial_live_agents where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + $agentcount=0; + while ($i < $talking_to_print) + { + $row=mysql_fetch_row($rslt); + if (eregi("READY|PAUSED",$row[3])) + { + $row[5]=$row[6]; + } + $Lstatus = $row[3]; + $status = sprintf("%-6s", $row[3]); + if (!eregi("INCALL|QUEUE",$row[3])) + {$call_time_S = ($STARTtime - $row[6]);} + else + {$call_time_S = ($STARTtime - $row[5]);} + + $call_time_M = ($call_time_S / 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"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + if (eregi("PAUSED",$row[3])) + { + if ($call_time_M_int >= 30) + {$i++; continue;} + else + { + $agent_paused++; $agent_total++; + } + } + + if ( (eregi("INCALL",$status)) or (eregi("QUEUE",$status)) ) {$agent_incall++; $agent_total++;} + if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) {$agent_ready++; $agent_total++;} + $agentcount++; + + + $i++; + } + + if ($agent_ready > 0) {$B=''; $BG='';} + if ($agent_ready > 4) {$B=''; $BG='';} + if ($agent_ready > 9) {$B=''; $BG='';} + if ($agent_ready > 14) {$B=''; $BG='';} + + echo "\n
\n"; + + echo "$NFB$agent_total$NFE agents logged in         \n"; + echo "$NFB$agent_incall$NFE agents in calls       \n"; + echo "$NFB$B  $agent_ready $BG$NFE agents waiting       \n"; + echo "$NFB$agent_paused$NFE paused agents       \n"; + + echo "
";
+		echo "";
+	}
+	else
+	{
+	echo " NO AGENTS ON CALLS
\n"; + } + +################################################################################ +### END calculating calls/agents +################################################################################ + + + + + +echo "
"; + +echo "\n\n"; +$k++; +} + +?> +
+ + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_timeoncall.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_timeoncall.php new file mode 100644 index 00000000..c417350c --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_timeoncall.php @@ -0,0 +1,180 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["reset_counter"])) {$reset_counter=$_GET["reset_counter"];} + elseif (isset($_POST["reset_counter"])) {$reset_counter=$_POST["reset_counter"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ENVIAR"])) {$ENVIAR=$_GET["ENVIAR"];} + elseif (isset($_POST["ENVIAR"])) {$ENVIAR=$_POST["ENVIAR"];} + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); + +?> + + + + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On Call\n"; +echo "
\n\n";
+
+echo "VICIDIAL: Time On Call                                          $NOW_TIME\n\n";
+echo "+------------+-----------+-----------+------------------+---------------------+---------+\n";
+echo "| STATION    | SESSIONID | CHANNEL   | NUMBER DIALED    | START TIME          | MINUTES |\n";
+echo "+------------+-----------+-----------+------------------+---------------------+---------+\n";
+
+$stmt="SELECT count(*) from live_sip_channels where server_ip='$server_ip';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$parked_count = $row[0];
+	if ($parked_count > 0)
+	{
+	$stmt="select extension from live_channels where server_ip='$server_ip';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$ext_to_print = mysql_num_rows($rslt);
+	$i=0;
+	$live_zap_counter=0;
+	$sessions = '';
+	while ($i < $ext_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if (preg_match("/^8600/i",$row[0]))
+			{
+			$sessions .= "$row[0]|";
+			}
+		$i++;
+		}
+	$sessions = preg_replace("/\|$/",'',$sessions);
+
+	if ($DB) {echo "SESSIONS: -$sessions-\n";}
+
+	$stmt="select * from live_sip_channels where server_ip='$server_ip' order by channel;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$parked_to_print = mysql_num_rows($rslt);
+	$i=0;
+	$live_calls_counter=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if ( (preg_match("/Zap\/|internal|ring/i",$row[3])) or (preg_match("/Local\//i",$row[0])) )
+			{
+			if ($DB) {echo "NOT STATION |$row[0]|$row[3]|\n";}
+			$session_id = '';
+			}
+		else 
+			{
+			if (preg_match("/$row[3]/i",$sessions))
+				{
+				if ($DB) {echo "LIVE STATION|$row[0]|$row[3]|\n";}
+				$session_id = $row[3];
+				$station = preg_replace("/SIP\//",'',$row[0]);
+				$station = preg_replace("/-.*/",'',$station);
+			
+				$LIVE_sessions[$live_calls_counter] =			"$session_id";
+				$LIVE_sessions_FORMAT[$live_calls_counter] =	sprintf("%-9s", $session_id);
+				$LIVE_stations[$live_calls_counter] =			"$station";
+				$LIVE_stations_FORMAT[$live_calls_counter] =	sprintf("%-10s", $station);
+
+		#		echo "| $station | $session_id | \n";
+
+				$live_calls_counter++;
+				}
+			else
+				{
+				if ($DB) {echo "NOT STATIONZ|$row[0]|$row[3]|\n";}
+				$session_id = '';
+				}
+			}
+
+		$i++;
+		}
+
+		if ($live_calls_counter > 0)
+		{
+		$i=0;
+		$LC_counter = $live_calls_counter;
+
+		while ($i < $live_calls_counter)
+			{
+			$stmt="select channel,extension,number_dialed,start_time,start_epoch from call_log where extension='$LIVE_stations[$i]' and server_ip='$server_ip' order by uniqueid desc LIMIT 1;";
+			$rslt=mysql_query($stmt, $link);
+			if ($DB) {echo "$stmt\n";}
+			$parked_to_print = mysql_num_rows($rslt);
+			$row=mysql_fetch_row($rslt);
+
+			$channel =			sprintf("%-9s", $row[0]);
+			$number_dialed =	sprintf("%-16s", $row[2]);
+			$start_time =		sprintf("%-19s", $row[3]);
+			$call_time_S = ($STARTtime - $row[4]);
+
+			$call_time_M = ($call_time_S / 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";
+			$call_time_MS =		sprintf("%7s", $call_time_MS);
+			$G = '';		$EG = '';
+			if ($call_time_M_int >= 12) {$G=''; $EG='';}
+			if ($call_time_M_int >= 31) {$G=''; $EG='';}
+
+			echo "| $G$LIVE_stations_FORMAT[$i]$EG | $G$LIVE_sessions_FORMAT[$i]$EG | $G$channel$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+			$i++;
+			}
+
+		echo "+------------+-----------+-----------+------------------+---------------------+---------+\n";
+		echo "  $i stations on live calls on server $server_ip\n\n";
+
+		echo "             - 12 minutes or more on live call\n";
+		echo "             - Over 30 minutes on live call\n";
+
+		}
+		else
+		{
+		echo "*****************************************************************************************\n";
+		echo "*****************************************************************************************\n";
+		echo "*************************************** NO LIVE STATIONS ********************************\n";
+		echo "*****************************************************************************************\n";
+		echo "*****************************************************************************************\n";
+		}
+
+	}
+	else
+	{
+	echo "*****************************************************************************************\n";
+	echo "*****************************************************************************************\n";
+	echo "*************************************** NO LIVE STATIONS ********************************\n";
+	echo "*****************************************************************************************\n";
+	echo "*****************************************************************************************\n";
+	}
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_timeonpark.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_timeonpark.php new file mode 100644 index 00000000..c48ee38c --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/AST_timeonpark.php @@ -0,0 +1,219 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60620-1042 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["reset_counter"])) {$reset_counter=$_GET["reset_counter"];} + elseif (isset($_POST["reset_counter"])) {$reset_counter=$_POST["reset_counter"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ENVIAR"])) {$ENVIAR=$_GET["ENVIAR"];} + elseif (isset($_POST["ENVIAR"])) {$ENVIAR=$_POST["ENVIAR"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +$timeONEhoursAGO = ($STARTtime - 3600); +$epochHALFhoursAGO = ($STARTtime - 1860); +$timeONEhoursAGO = date("Y-m-d H:i:s",$timeONEhoursAGO); +$timeHALFhoursAGO = date("Y-m-d H:i:s",$epochHALFhoursAGO); + +$reset_counter++; + +if ($reset_counter > 7) + { + $reset_counter=0; + + $stmt="update park_log set status='HUNGUP' where hangup_time is not null;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + + if ($DB) + { + $stmt="delete from park_log where status='TALKING' and grab_time < '$timeONEhoursAGO' and (hangup_time is null or hangup_time='');"; + $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + + $stmt="delete from park_log where status='PARKED' and parked_time < '$timeHALFhoursAGO' and (hangup_time is null or hangup_time='');"; + $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + + } + } + +?> + + + + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On Park\n"; +echo "
\n\n";
+
+echo "VICIDIAL: Time On Park         $NOW_TIME    INFORMES\n\n";
+echo "+------------+-----------------+---------------------+---------+\n";
+echo "| CHANNEL    | GROUP           | START TIME          | MINUTES |\n";
+echo "+------------+-----------------+---------------------+---------+\n";
+
+#$link=mysql_connect("localhost", "cron", "1234");
+# $linkX=mysql_connect("localhost", "cron", "1234");
+#mysql_select_db("asterisk");
+
+$stmt="select extension,user,channel,channel_group,parked_time,UNIX_TIMESTAMP(parked_time) from park_log where status ='PARKED' and server_ip='" . mysql_real_escape_string($server_ip) . "' order by uniqueid;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$parked_to_print = mysql_num_rows($rslt);
+	if ($parked_to_print > 0)
+	{
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$channel =			sprintf("%-10s", $row[2]);
+		$number_dialed =	sprintf("%-15s", $row[3]);
+		$start_time =		sprintf("%-19s", $row[4]);
+		$call_time_S = ($STARTtime - $row[5]);
+
+		$call_time_M = ($call_time_S / 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";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if ($call_time_M_int >= 1) {$G=''; $EG='';}
+		if ($call_time_M_int >= 6) {$G=''; $EG='';}
+
+		echo "| $G$channel$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------+-----------------+---------------------+---------+\n";
+		echo "  $i callers waiting on server $server_ip\n\n";
+
+		echo "             - 1 minute or more on hold\n";
+		echo "             - Over 5 minutes on hold\n";
+
+		}
+	else
+	{
+	echo "****************************************************************\n";
+	echo "****************************************************************\n";
+	echo "********************LLAMADAS EN ESPERA*********************\n";
+	echo "****************************************************************\n";
+	echo "****************************************************************\n";
+	}
+
+###################################################################################
+###### TIME ON INBOUND CALLS
+###################################################################################
+echo "\n\n";
+echo "----------------------------------------------------------------------------------------";
+echo "\n\n";
+echo "VICIDIAL: Agents Time On Inbound Calls                             $NOW_TIME\n\n";
+echo "+------------|--------+------------+-----------------+---------------------+---------+\n";
+echo "| STATION    | USER   | CHANNEL    | GROUP           | START TIME          | MINUTES |\n";
+echo "+------------|--------+------------+-----------------+---------------------+---------+\n";
+
+
+$stmt="select extension,user,channel,channel_group,grab_time,UNIX_TIMESTAMP(grab_time) from park_log where status ='TALKING' and server_ip='" . mysql_real_escape_string($server_ip) . "' order by uniqueid;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$talking_to_print = mysql_num_rows($rslt);
+	if ($talking_to_print > 0)
+	{
+	$i=0;
+	while ($i < $talking_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$extension =		sprintf("%-10s", $row[0]);
+		$user =				sprintf("%-6s", $row[1]);
+		$channel =			sprintf("%-10s", $row[2]);
+		$number_dialed =	sprintf("%-15s", $row[3]);
+		$start_time =		sprintf("%-19s", $row[4]);
+		$call_time_S = ($STARTtime - $row[5]);
+
+		$call_time_M = ($call_time_S / 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";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if ($call_time_M_int >= 12) {$G=''; $EG='';}
+		if ($call_time_M_int >= 31) {$G=''; $EG='';}
+
+		echo "| $G$extension$EG | $G$user$EG | $G$channel$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------|--------+------------+-----------------+---------------------+---------+\n";
+		echo "  $i agents on calls on server $server_ip\n\n";
+
+		echo "             - 12 minutes or more on call\n";
+		echo "             - Over 30 minutes on call\n";
+
+	}
+	else
+	{
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	echo "*********************************AGENTES SIN LLAMADAS*********************************\n";
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	}
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/admin.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/admin.php new file mode 100644 index 00000000..5fa5509c --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/admin.php @@ -0,0 +1,13575 @@ + LICENSE: GPLv2 +# + + +require("dbconnect.php"); + + +###################################################################################################### +###################################################################################################### +####### static variable settings for display options +###################################################################################################### +###################################################################################################### + +$page_width='770'; +$section_width='720'; +$header_font_size='3'; +$subheader_font_size='2'; +$subcamp_font_size='2'; +$header_selected_bold=''; +$header_nonselected_bold=''; +$users_color = '#FFFF99'; +$campaigns_color = '#FFCC99'; +$lists_color = '#FFCCCC'; +$ingroups_color = '#CC99FF'; +$remoteagent_color ='#CCFFCC'; +$usergroups_color = '#CCFFFF'; +$scripts_color = '#99FFCC'; +$filters_color = '#CCCCCC'; +$admin_color = '#FF99FF'; +$reports_color = '#99FF33'; +#$users_color = '#FFFF99'; +#$campaigns_color = '#FFFF99'; +#$lists_color = '#FFFF99'; +#$ingroups_color = '#FFFF99'; +#$remoteagent_color ='#FFFF99'; +#$usergroups_color = '#FFFF99'; +#$scripts_color = '#FFFF99'; +#$filters_color = '#FFFF99'; +#$admin_color = '#FFFF99'; +#$reports_color = '#FFFF99'; + $times_color = '#FF33FF'; + $phones_color = '#FF33FF'; + $conference_color = '#FF33FF'; + $server_color = '#FF33FF'; + $settings_color = '#FF33FF'; + $status_color = '#FF33FF'; +$users_font = 'BLACK'; +$campaigns_font = 'BLACK'; +$lists_font = 'BLACK'; +$ingroups_font = 'BLACK'; +$remoteagent_font = 'BLACK'; +$usergroups_font = 'BLACK'; +$scripts_font = 'BLACK'; +$filters_font = 'BLACK'; +$admin_font = 'BLACK'; +$reports_font = 'BLACK'; + $times_font = 'BLACK'; + $phones_font = 'BLACK'; + $conference_font = 'BLACK'; + $server_font = 'BLACK'; + $settings_font = 'BLACK'; + $status_font = 'BLACK'; +$subcamp_color = '#FF9933'; +$subcamp_font = 'BLACK'; + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; + +###################################################################################################### +###################################################################################################### +####### Form variable declaration +###################################################################################################### +###################################################################################################### + + +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["active"])) {$active=$_GET["active"];} + elseif (isset($_POST["active"])) {$active=$_POST["active"];} +if (isset($_GET["adaptive_dl_diff_target"])) {$adaptive_dl_diff_target=$_GET["adaptive_dl_diff_target"];} + elseif (isset($_POST["adaptive_dl_diff_target"])) {$adaptive_dl_diff_target=$_POST["adaptive_dl_diff_target"];} +if (isset($_GET["adaptive_dropped_percentage"])) {$adaptive_dropped_percentage=$_GET["adaptive_dropped_percentage"];} + elseif (isset($_POST["adaptive_dropped_percentage"])){$adaptive_dropped_percentage=$_POST["adaptive_dropped_percentage"];} +if (isset($_GET["adaptive_intensity"])) {$adaptive_intensity=$_GET["adaptive_intensity"];} + elseif (isset($_POST["adaptive_intensity"])) {$adaptive_intensity=$_POST["adaptive_intensity"];} +if (isset($_GET["adaptive_latest_server_time"])) {$adaptive_latest_server_time=$_GET["adaptive_latest_server_time"];} + elseif (isset($_POST["adaptive_latest_server_time"])){$adaptive_latest_server_time=$_POST["adaptive_latest_server_time"];} +if (isset($_GET["adaptive_maximum_level"])) {$adaptive_maximum_level=$_GET["adaptive_maximum_level"];} + elseif (isset($_POST["adaptive_maximum_level"])) {$adaptive_maximum_level=$_POST["adaptive_maximum_level"];} +if (isset($_GET["SUB"])) {$SUB=$_GET["SUB"];} + elseif (isset($_POST["SUB"])) {$SUB=$_POST["SUB"];} +if (isset($_GET["ADD"])) {$ADD=$_GET["ADD"];} + elseif (isset($_POST["ADD"])) {$ADD=$_POST["ADD"];} +if (isset($_GET["admin_hangup_enabled"])) {$admin_hangup_enabled=$_GET["admin_hangup_enabled"];} + elseif (isset($_POST["admin_hangup_enabled"])) {$admin_hangup_enabled=$_POST["admin_hangup_enabled"];} +if (isset($_GET["admin_hijack_enabled"])) {$admin_hijack_enabled=$_GET["admin_hijack_enabled"];} + elseif (isset($_POST["admin_hijack_enabled"])) {$admin_hijack_enabled=$_POST["admin_hijack_enabled"];} +if (isset($_GET["admin_monitor_enabled"])) {$admin_monitor_enabled=$_GET["admin_monitor_enabled"];} + elseif (isset($_POST["admin_monitor_enabled"])) {$admin_monitor_enabled=$_POST["admin_monitor_enabled"];} +if (isset($_GET["AFLogging_enabled"])) {$AFLogging_enabled=$_GET["AFLogging_enabled"];} + elseif (isset($_POST["AFLogging_enabled"])) {$AFLogging_enabled=$_POST["AFLogging_enabled"];} +if (isset($_GET["agent_choose_ingroups"])) {$agent_choose_ingroups=$_GET["agent_choose_ingroups"];} + elseif (isset($_POST["agent_choose_ingroups"])) {$agent_choose_ingroups=$_POST["agent_choose_ingroups"];} +if (isset($_GET["agentcall_manual"])) {$agentcall_manual=$_GET["agentcall_manual"];} + elseif (isset($_POST["agentcall_manual"])) {$agentcall_manual=$_POST["agentcall_manual"];} +if (isset($_GET["agentonly_callbacks"])) {$agentonly_callbacks=$_GET["agentonly_callbacks"];} + elseif (isset($_POST["agentonly_callbacks"])) {$agentonly_callbacks=$_POST["agentonly_callbacks"];} +if (isset($_GET["AGI_call_logging_enabled"])) {$AGI_call_logging_enabled=$_GET["AGI_call_logging_enabled"];} + elseif (isset($_POST["AGI_call_logging_enabled"])) {$AGI_call_logging_enabled=$_POST["AGI_call_logging_enabled"];} +if (isset($_GET["agi_output"])) {$agi_output=$_GET["agi_output"];} + elseif (isset($_POST["agi_output"])) {$agi_output=$_POST["agi_output"];} +if (isset($_GET["allcalls_delay"])) {$allcalls_delay=$_GET["allcalls_delay"];} + elseif (isset($_POST["allcalls_delay"])) {$allcalls_delay=$_POST["allcalls_delay"];} +if (isset($_GET["allow_closers"])) {$allow_closers=$_GET["allow_closers"];} + elseif (isset($_POST["allow_closers"])) {$allow_closers=$_POST["allow_closers"];} +if (isset($_GET["alt_number_dialing"])) {$alt_number_dialing=$_GET["alt_number_dialing"];} + elseif (isset($_POST["alt_number_dialing"])) {$alt_number_dialing=$_POST["alt_number_dialing"];} +if (isset($_GET["alter_agent_interface_options"])) {$alter_agent_interface_options=$_GET["alter_agent_interface_options"];} + elseif (isset($_POST["alter_agent_interface_options"])) {$alter_agent_interface_options=$_POST["alter_agent_interface_options"];} +if (isset($_GET["am_message_exten"])) {$am_message_exten=$_GET["am_message_exten"];} + elseif (isset($_POST["am_message_exten"])) {$am_message_exten=$_POST["am_message_exten"];} +if (isset($_GET["amd_send_to_vmx"])) {$amd_send_to_vmx=$_GET["amd_send_to_vmx"];} + elseif (isset($_POST["amd_send_to_vmx"])) {$amd_send_to_vmx=$_POST["amd_send_to_vmx"];} +if (isset($_GET["answer_transfer_agent"])) {$answer_transfer_agent=$_GET["answer_transfer_agent"];} + elseif (isset($_POST["answer_transfer_agent"])) {$answer_transfer_agent=$_POST["answer_transfer_agent"];} +if (isset($_GET["ast_admin_access"])) {$ast_admin_access=$_GET["ast_admin_access"];} + elseif (isset($_POST["ast_admin_access"])) {$ast_admin_access=$_POST["ast_admin_access"];} +if (isset($_GET["ast_delete_phones"])) {$ast_delete_phones=$_GET["ast_delete_phones"];} + elseif (isset($_POST["ast_delete_phones"])) {$ast_delete_phones=$_POST["ast_delete_phones"];} +if (isset($_GET["asterisk_version"])) {$asterisk_version=$_GET["asterisk_version"];} + elseif (isset($_POST["asterisk_version"])) {$asterisk_version=$_POST["asterisk_version"];} +if (isset($_GET["ASTmgrSECRET"])) {$ASTmgrSECRET=$_GET["ASTmgrSECRET"];} + elseif (isset($_POST["ASTmgrSECRET"])) {$ASTmgrSECRET=$_POST["ASTmgrSECRET"];} +if (isset($_GET["ASTmgrUSERNAME"])) {$ASTmgrUSERNAME=$_GET["ASTmgrUSERNAME"];} + elseif (isset($_POST["ASTmgrUSERNAME"])) {$ASTmgrUSERNAME=$_POST["ASTmgrUSERNAME"];} +if (isset($_GET["ASTmgrUSERNAMElisten"])) {$ASTmgrUSERNAMElisten=$_GET["ASTmgrUSERNAMElisten"];} + elseif (isset($_POST["ASTmgrUSERNAMElisten"])) {$ASTmgrUSERNAMElisten=$_POST["ASTmgrUSERNAMElisten"];} +if (isset($_GET["ASTmgrUSERNAMEsend"])) {$ASTmgrUSERNAMEsend=$_GET["ASTmgrUSERNAMEsend"];} + elseif (isset($_POST["ASTmgrUSERNAMEsend"])) {$ASTmgrUSERNAMEsend=$_POST["ASTmgrUSERNAMEsend"];} +if (isset($_GET["ASTmgrUSERNAMEupdate"])) {$ASTmgrUSERNAMEupdate=$_GET["ASTmgrUSERNAMEupdate"];} + elseif (isset($_POST["ASTmgrUSERNAMEupdate"])) {$ASTmgrUSERNAMEupdate=$_POST["ASTmgrUSERNAMEupdate"];} +if (isset($_GET["attempt_delay"])) {$attempt_delay=$_GET["attempt_delay"];} + elseif (isset($_POST["attempt_delay"])) {$attempt_delay=$_POST["attempt_delay"];} +if (isset($_GET["attempt_maximum"])) {$attempt_maximum=$_GET["attempt_maximum"];} + elseif (isset($_POST["attempt_maximum"])) {$attempt_maximum=$_POST["attempt_maximum"];} +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["auto_dial_next_number"])) {$auto_dial_next_number=$_GET["auto_dial_next_number"];} + elseif (isset($_POST["auto_dial_next_number"])) {$auto_dial_next_number=$_POST["auto_dial_next_number"];} +if (isset($_GET["available_only_ratio_tally"])) {$available_only_ratio_tally=$_GET["available_only_ratio_tally"];} + elseif (isset($_POST["available_only_ratio_tally"])){$available_only_ratio_tally=$_POST["available_only_ratio_tally"];} +if (isset($_GET["call_out_number_group"])) {$call_out_number_group=$_GET["call_out_number_group"];} + elseif (isset($_POST["call_out_number_group"])) {$call_out_number_group=$_POST["call_out_number_group"];} +if (isset($_GET["call_parking_enabled"])) {$call_parking_enabled=$_GET["call_parking_enabled"];} + elseif (isset($_POST["call_parking_enabled"])) {$call_parking_enabled=$_POST["call_parking_enabled"];} +if (isset($_GET["call_time_comments"])) {$call_time_comments=$_GET["call_time_comments"];} + elseif (isset($_POST["call_time_comments"])) {$call_time_comments=$_POST["call_time_comments"];} +if (isset($_GET["call_time_id"])) {$call_time_id=$_GET["call_time_id"];} + elseif (isset($_POST["call_time_id"])) {$call_time_id=$_POST["call_time_id"];} +if (isset($_GET["call_time_name"])) {$call_time_name=$_GET["call_time_name"];} + elseif (isset($_POST["call_time_name"])) {$call_time_name=$_POST["call_time_name"];} +if (isset($_GET["CallerID_popup_enabled"])) {$CallerID_popup_enabled=$_GET["CallerID_popup_enabled"];} + elseif (isset($_POST["CallerID_popup_enabled"])) {$CallerID_popup_enabled=$_POST["CallerID_popup_enabled"];} +if (isset($_GET["campaign_cid"])) {$campaign_cid=$_GET["campaign_cid"];} + elseif (isset($_POST["campaign_cid"])) {$campaign_cid=$_POST["campaign_cid"];} +if (isset($_GET["campaign_detail"])) {$campaign_detail=$_GET["campaign_detail"];} + elseif (isset($_POST["campaign_detail"])) {$campaign_detail=$_POST["campaign_detail"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["campaign_name"])) {$campaign_name=$_GET["campaign_name"];} + elseif (isset($_POST["campaign_name"])) {$campaign_name=$_POST["campaign_name"];} +if (isset($_GET["campaign_rec_exten"])) {$campaign_rec_exten=$_GET["campaign_rec_exten"];} + elseif (isset($_POST["campaign_rec_exten"])) {$campaign_rec_exten=$_POST["campaign_rec_exten"];} +if (isset($_GET["campaign_rec_filename"])) {$campaign_rec_filename=$_GET["campaign_rec_filename"];} + elseif (isset($_POST["campaign_rec_filename"])) {$campaign_rec_filename=$_POST["campaign_rec_filename"];} +if (isset($_GET["campaign_recording"])) {$campaign_recording=$_GET["campaign_recording"];} + elseif (isset($_POST["campaign_recording"])) {$campaign_recording=$_POST["campaign_recording"];} +if (isset($_GET["campaign_vdad_exten"])) {$campaign_vdad_exten=$_GET["campaign_vdad_exten"];} + elseif (isset($_POST["campaign_vdad_exten"])) {$campaign_vdad_exten=$_POST["campaign_vdad_exten"];} +if (isset($_GET["change_agent_campaign"])) {$change_agent_campaign=$_GET["change_agent_campaign"];} + elseif (isset($_POST["change_agent_campaign"])) {$change_agent_campaign=$_POST["change_agent_campaign"];} +if (isset($_GET["client_browser"])) {$client_browser=$_GET["client_browser"];} + elseif (isset($_POST["client_browser"])) {$client_browser=$_POST["client_browser"];} +if (isset($_GET["closer_default_blended"])) {$closer_default_blended=$_GET["closer_default_blended"];} + elseif (isset($_POST["closer_default_blended"])) {$closer_default_blended=$_POST["closer_default_blended"];} +if (isset($_GET["company"])) {$company=$_GET["company"];} + elseif (isset($_POST["company"])) {$company=$_POST["company"];} +if (isset($_GET["computer_ip"])) {$computer_ip=$_GET["computer_ip"];} + elseif (isset($_POST["computer_ip"])) {$computer_ip=$_POST["computer_ip"];} +if (isset($_GET["conf_exten"])) {$conf_exten=$_GET["conf_exten"];} + elseif (isset($_POST["conf_exten"])) {$conf_exten=$_POST["conf_exten"];} +if (isset($_GET["conf_on_extension"])) {$conf_on_extension=$_GET["conf_on_extension"];} + elseif (isset($_POST["conf_on_extension"])) {$conf_on_extension=$_POST["conf_on_extension"];} +if (isset($_GET["conferencing_enabled"])) {$conferencing_enabled=$_GET["conferencing_enabled"];} + elseif (isset($_POST["conferencing_enabled"])) {$conferencing_enabled=$_POST["conferencing_enabled"];} +if (isset($_GET["CoNfIrM"])) {$CoNfIrM=$_GET["CoNfIrM"];} + elseif (isset($_POST["CoNfIrM"])) {$CoNfIrM=$_POST["CoNfIrM"];} +if (isset($_GET["ct_default_start"])) {$ct_default_start=$_GET["ct_default_start"];} + elseif (isset($_POST["ct_default_start"])) {$ct_default_start=$_POST["ct_default_start"];} +if (isset($_GET["ct_default_stop"])) {$ct_default_stop=$_GET["ct_default_stop"];} + elseif (isset($_POST["ct_default_stop"])) {$ct_default_stop=$_POST["ct_default_stop"];} +if (isset($_GET["ct_friday_start"])) {$ct_friday_start=$_GET["ct_friday_start"];} + elseif (isset($_POST["ct_friday_start"])) {$ct_friday_start=$_POST["ct_friday_start"];} +if (isset($_GET["ct_friday_stop"])) {$ct_friday_stop=$_GET["ct_friday_stop"];} + elseif (isset($_POST["ct_friday_stop"])) {$ct_friday_stop=$_POST["ct_friday_stop"];} +if (isset($_GET["ct_monday_start"])) {$ct_monday_start=$_GET["ct_monday_start"];} + elseif (isset($_POST["ct_monday_start"])) {$ct_monday_start=$_POST["ct_monday_start"];} +if (isset($_GET["ct_monday_stop"])) {$ct_monday_stop=$_GET["ct_monday_stop"];} + elseif (isset($_POST["ct_monday_stop"])) {$ct_monday_stop=$_POST["ct_monday_stop"];} +if (isset($_GET["ct_saturday_start"])) {$ct_saturday_start=$_GET["ct_saturday_start"];} + elseif (isset($_POST["ct_saturday_start"])) {$ct_saturday_start=$_POST["ct_saturday_start"];} +if (isset($_GET["ct_saturday_stop"])) {$ct_saturday_stop=$_GET["ct_saturday_stop"];} + elseif (isset($_POST["ct_saturday_stop"])) {$ct_saturday_stop=$_POST["ct_saturday_stop"];} +if (isset($_GET["ct_sunday_start"])) {$ct_sunday_start=$_GET["ct_sunday_start"];} + elseif (isset($_POST["ct_sunday_start"])) {$ct_sunday_start=$_POST["ct_sunday_start"];} +if (isset($_GET["ct_sunday_stop"])) {$ct_sunday_stop=$_GET["ct_sunday_stop"];} + elseif (isset($_POST["ct_sunday_stop"])) {$ct_sunday_stop=$_POST["ct_sunday_stop"];} +if (isset($_GET["ct_thursday_start"])) {$ct_thursday_start=$_GET["ct_thursday_start"];} + elseif (isset($_POST["ct_thursday_start"])) {$ct_thursday_start=$_POST["ct_thursday_start"];} +if (isset($_GET["ct_thursday_stop"])) {$ct_thursday_stop=$_GET["ct_thursday_stop"];} + elseif (isset($_POST["ct_thursday_stop"])) {$ct_thursday_stop=$_POST["ct_thursday_stop"];} +if (isset($_GET["ct_tuesday_start"])) {$ct_tuesday_start=$_GET["ct_tuesday_start"];} + elseif (isset($_POST["ct_tuesday_start"])) {$ct_tuesday_start=$_POST["ct_tuesday_start"];} +if (isset($_GET["ct_tuesday_stop"])) {$ct_tuesday_stop=$_GET["ct_tuesday_stop"];} + elseif (isset($_POST["ct_tuesday_stop"])) {$ct_tuesday_stop=$_POST["ct_tuesday_stop"];} +if (isset($_GET["ct_wednesday_start"])) {$ct_wednesday_start=$_GET["ct_wednesday_start"];} + elseif (isset($_POST["ct_wednesday_start"])) {$ct_wednesday_start=$_POST["ct_wednesday_start"];} +if (isset($_GET["ct_wednesday_stop"])) {$ct_wednesday_stop=$_GET["ct_wednesday_stop"];} + elseif (isset($_POST["ct_wednesday_stop"])) {$ct_wednesday_stop=$_POST["ct_wednesday_stop"];} +if (isset($_GET["DBX_database"])) {$DBX_database=$_GET["DBX_database"];} + elseif (isset($_POST["DBX_database"])) {$DBX_database=$_POST["DBX_database"];} +if (isset($_GET["DBX_pass"])) {$DBX_pass=$_GET["DBX_pass"];} + elseif (isset($_POST["DBX_pass"])) {$DBX_pass=$_POST["DBX_pass"];} +if (isset($_GET["DBX_port"])) {$DBX_port=$_GET["DBX_port"];} + elseif (isset($_POST["DBX_port"])) {$DBX_port=$_POST["DBX_port"];} +if (isset($_GET["DBX_server"])) {$DBX_server=$_GET["DBX_server"];} + elseif (isset($_POST["DBX_server"])) {$DBX_server=$_POST["DBX_server"];} +if (isset($_GET["DBX_user"])) {$DBX_user=$_GET["DBX_user"];} + elseif (isset($_POST["DBX_user"])) {$DBX_user=$_POST["DBX_user"];} +if (isset($_GET["DBY_database"])) {$DBY_database=$_GET["DBY_database"];} + elseif (isset($_POST["DBY_database"])) {$DBY_database=$_POST["DBY_database"];} +if (isset($_GET["DBY_pass"])) {$DBY_pass=$_GET["DBY_pass"];} + elseif (isset($_POST["DBY_pass"])) {$DBY_pass=$_POST["DBY_pass"];} +if (isset($_GET["DBY_port"])) {$DBY_port=$_GET["DBY_port"];} + elseif (isset($_POST["DBY_port"])) {$DBY_port=$_POST["DBY_port"];} +if (isset($_GET["DBY_server"])) {$DBY_server=$_GET["DBY_server"];} + elseif (isset($_POST["DBY_server"])) {$DBY_server=$_POST["DBY_server"];} +if (isset($_GET["DBY_user"])) {$DBY_user=$_GET["DBY_user"];} + elseif (isset($_POST["DBY_user"])) {$DBY_user=$_POST["DBY_user"];} +if (isset($_GET["delete_call_times"])) {$delete_call_times=$_GET["delete_call_times"];} + elseif (isset($_POST["delete_call_times"])) {$delete_call_times=$_POST["delete_call_times"];} +if (isset($_GET["delete_campaigns"])) {$delete_campaigns=$_GET["delete_campaigns"];} + elseif (isset($_POST["delete_campaigns"])) {$delete_campaigns=$_POST["delete_campaigns"];} +if (isset($_GET["delete_filters"])) {$delete_filters=$_GET["delete_filters"];} + elseif (isset($_POST["delete_filters"])) {$delete_filters=$_POST["delete_filters"];} +if (isset($_GET["delete_ingroups"])) {$delete_ingroups=$_GET["delete_ingroups"];} + elseif (isset($_POST["delete_ingroups"])) {$delete_ingroups=$_POST["delete_ingroups"];} +if (isset($_GET["delete_lists"])) {$delete_lists=$_GET["delete_lists"];} + elseif (isset($_POST["delete_lists"])) {$delete_lists=$_POST["delete_lists"];} +if (isset($_GET["delete_remote_agents"])) {$delete_remote_agents=$_GET["delete_remote_agents"];} + elseif (isset($_POST["delete_remote_agents"])) {$delete_remote_agents=$_POST["delete_remote_agents"];} +if (isset($_GET["delete_scripts"])) {$delete_scripts=$_GET["delete_scripts"];} + elseif (isset($_POST["delete_scripts"])) {$delete_scripts=$_POST["delete_scripts"];} +if (isset($_GET["delete_user_groups"])) {$delete_user_groups=$_GET["delete_user_groups"];} + elseif (isset($_POST["delete_user_groups"])) {$delete_user_groups=$_POST["delete_user_groups"];} +if (isset($_GET["delete_users"])) {$delete_users=$_GET["delete_users"];} + elseif (isset($_POST["delete_users"])) {$delete_users=$_POST["delete_users"];} +if (isset($_GET["dial_method"])) {$dial_method=$_GET["dial_method"];} + elseif (isset($_POST["dial_method"])) {$dial_method=$_POST["dial_method"];} +if (isset($_GET["dial_prefix"])) {$dial_prefix=$_GET["dial_prefix"];} + elseif (isset($_POST["dial_prefix"])) {$dial_prefix=$_POST["dial_prefix"];} +if (isset($_GET["dial_status_a"])) {$dial_status_a=$_GET["dial_status_a"];} + elseif (isset($_POST["dial_status_a"])) {$dial_status_a=$_POST["dial_status_a"];} +if (isset($_GET["dial_status_b"])) {$dial_status_b=$_GET["dial_status_b"];} + elseif (isset($_POST["dial_status_b"])) {$dial_status_b=$_POST["dial_status_b"];} +if (isset($_GET["dial_status_c"])) {$dial_status_c=$_GET["dial_status_c"];} + elseif (isset($_POST["dial_status_c"])) {$dial_status_c=$_POST["dial_status_c"];} +if (isset($_GET["dial_status_d"])) {$dial_status_d=$_GET["dial_status_d"];} + elseif (isset($_POST["dial_status_d"])) {$dial_status_d=$_POST["dial_status_d"];} +if (isset($_GET["dial_status_e"])) {$dial_status_e=$_GET["dial_status_e"];} + elseif (isset($_POST["dial_status_e"])) {$dial_status_e=$_POST["dial_status_e"];} +if (isset($_GET["dial_timeout"])) {$dial_timeout=$_GET["dial_timeout"];} + elseif (isset($_POST["dial_timeout"])) {$dial_timeout=$_POST["dial_timeout"];} +if (isset($_GET["dialplan_number"])) {$dialplan_number=$_GET["dialplan_number"];} + elseif (isset($_POST["dialplan_number"])) {$dialplan_number=$_POST["dialplan_number"];} +if (isset($_GET["drop_call_seconds"])) {$drop_call_seconds=$_GET["drop_call_seconds"];} + elseif (isset($_POST["drop_call_seconds"])) {$drop_call_seconds=$_POST["drop_call_seconds"];} +if (isset($_GET["drop_exten"])) {$drop_exten=$_GET["drop_exten"];} + elseif (isset($_POST["drop_exten"])) {$drop_exten=$_POST["drop_exten"];} +if (isset($_GET["drop_message"])) {$drop_message=$_GET["drop_message"];} + elseif (isset($_POST["drop_message"])) {$drop_message=$_POST["drop_message"];} +if (isset($_GET["dtmf_send_extension"])) {$dtmf_send_extension=$_GET["dtmf_send_extension"];} + elseif (isset($_POST["dtmf_send_extension"])) {$dtmf_send_extension=$_POST["dtmf_send_extension"];} +if (isset($_GET["enable_fast_refresh"])) {$enable_fast_refresh=$_GET["enable_fast_refresh"];} + elseif (isset($_POST["enable_fast_refresh"])) {$enable_fast_refresh=$_POST["enable_fast_refresh"];} +if (isset($_GET["enable_persistant_mysql"])) {$enable_persistant_mysql=$_GET["enable_persistant_mysql"];} + elseif (isset($_POST["enable_persistant_mysql"])) {$enable_persistant_mysql=$_POST["enable_persistant_mysql"];} +if (isset($_GET["ext_context"])) {$ext_context=$_GET["ext_context"];} + elseif (isset($_POST["ext_context"])) {$ext_context=$_POST["ext_context"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["fast_refresh_rate"])) {$fast_refresh_rate=$_GET["fast_refresh_rate"];} + elseif (isset($_POST["fast_refresh_rate"])) {$fast_refresh_rate=$_POST["fast_refresh_rate"];} +if (isset($_GET["force_logout"])) {$force_logout=$_GET["force_logout"];} + elseif (isset($_POST["force_logout"])) {$force_logout=$_POST["force_logout"];} +if (isset($_GET["fronter_display"])) {$fronter_display=$_GET["fronter_display"];} + elseif (isset($_POST["fronter_display"])) {$fronter_display=$_POST["fronter_display"];} +if (isset($_GET["full_name"])) {$full_name=$_GET["full_name"];} + elseif (isset($_POST["full_name"])) {$full_name=$_POST["full_name"];} +if (isset($_GET["fullname"])) {$fullname=$_GET["fullname"];} + elseif (isset($_POST["fullname"])) {$fullname=$_POST["fullname"];} +if (isset($_GET["get_call_launch"])) {$get_call_launch=$_GET["get_call_launch"];} + elseif (isset($_POST["get_call_launch"])) {$get_call_launch=$_POST["get_call_launch"];} +if (isset($_GET["group_color"])) {$group_color=$_GET["group_color"];} + elseif (isset($_POST["group_color"])) {$group_color=$_POST["group_color"];} +if (isset($_GET["group_id"])) {$group_id=$_GET["group_id"];} + elseif (isset($_POST["group_id"])) {$group_id=$_POST["group_id"];} +if (isset($_GET["group_name"])) {$group_name=$_GET["group_name"];} + elseif (isset($_POST["group_name"])) {$group_name=$_POST["group_name"];} +if (isset($_GET["groups"])) {$groups=$_GET["groups"];} + elseif (isset($_POST["groups"])) {$groups=$_POST["groups"];} +if (isset($_GET["XFERgroups"])) {$XFERgroups=$_GET["XFERgroups"];} + elseif (isset($_POST["XFERgroups"])) {$XFERgroups=$_POST["XFERgroups"];} +if (isset($_GET["HKstatus"])) {$HKstatus=$_GET["HKstatus"];} + elseif (isset($_POST["HKstatus"])) {$HKstatus=$_POST["HKstatus"];} +if (isset($_GET["hopper_level"])) {$hopper_level=$_GET["hopper_level"];} + elseif (isset($_POST["hopper_level"])) {$hopper_level=$_POST["hopper_level"];} +if (isset($_GET["hotkey"])) {$hotkey=$_GET["hotkey"];} + elseif (isset($_POST["hotkey"])) {$hotkey=$_POST["hotkey"];} +if (isset($_GET["hotkeys_active"])) {$hotkeys_active=$_GET["hotkeys_active"];} + elseif (isset($_POST["hotkeys_active"])) {$hotkeys_active=$_POST["hotkeys_active"];} +if (isset($_GET["install_directory"])) {$install_directory=$_GET["install_directory"];} + elseif (isset($_POST["install_directory"])) {$install_directory=$_POST["install_directory"];} +if (isset($_GET["lead_filter_comments"])) {$lead_filter_comments=$_GET["lead_filter_comments"];} + elseif (isset($_POST["lead_filter_comments"])) {$lead_filter_comments=$_POST["lead_filter_comments"];} +if (isset($_GET["lead_filter_id"])) {$lead_filter_id=$_GET["lead_filter_id"];} + elseif (isset($_POST["lead_filter_id"])) {$lead_filter_id=$_POST["lead_filter_id"];} +if (isset($_GET["lead_filter_name"])) {$lead_filter_name=$_GET["lead_filter_name"];} + elseif (isset($_POST["lead_filter_name"])) {$lead_filter_name=$_POST["lead_filter_name"];} +if (isset($_GET["lead_filter_sql"])) {$lead_filter_sql=$_GET["lead_filter_sql"];} + elseif (isset($_POST["lead_filter_sql"])) {$lead_filter_sql=$_POST["lead_filter_sql"];} +if (isset($_GET["lead_order"])) {$lead_order=$_GET["lead_order"];} + elseif (isset($_POST["lead_order"])) {$lead_order=$_POST["lead_order"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["list_name"])) {$list_name=$_GET["list_name"];} + elseif (isset($_POST["list_name"])) {$list_name=$_POST["list_name"];} +if (isset($_GET["load_leads"])) {$load_leads=$_GET["load_leads"];} + elseif (isset($_POST["load_leads"])) {$load_leads=$_POST["load_leads"];} +if (isset($_GET["local_call_time"])) {$local_call_time=$_GET["local_call_time"];} + elseif (isset($_POST["local_call_time"])) {$local_call_time=$_POST["local_call_time"];} +if (isset($_GET["local_gmt"])) {$local_gmt=$_GET["local_gmt"];} + elseif (isset($_POST["local_gmt"])) {$local_gmt=$_POST["local_gmt"];} +if (isset($_GET["local_web_callerID_URL"])) {$local_web_callerID_URL=$_GET["local_web_callerID_URL"];} + elseif (isset($_POST["local_web_callerID_URL"])) {$local_web_callerID_URL=$_POST["local_web_callerID_URL"];} +if (isset($_GET["login"])) {$login=$_GET["login"];} + elseif (isset($_POST["login"])) {$login=$_POST["login"];} +if (isset($_GET["login_campaign"])) {$login_campaign=$_GET["login_campaign"];} + elseif (isset($_POST["login_campaign"])) {$login_campaign=$_POST["login_campaign"];} +if (isset($_GET["login_pass"])) {$login_pass=$_GET["login_pass"];} + elseif (isset($_POST["login_pass"])) {$login_pass=$_POST["login_pass"];} +if (isset($_GET["login_user"])) {$login_user=$_GET["login_user"];} + elseif (isset($_POST["login_user"])) {$login_user=$_POST["login_user"];} +if (isset($_GET["max_vicidial_trunks"])) {$max_vicidial_trunks=$_GET["max_vicidial_trunks"];} + elseif (isset($_POST["max_vicidial_trunks"])) {$max_vicidial_trunks=$_POST["max_vicidial_trunks"];} +if (isset($_GET["modify_call_times"])) {$modify_call_times=$_GET["modify_call_times"];} + elseif (isset($_POST["modify_call_times"])) {$modify_call_times=$_POST["modify_call_times"];} +if (isset($_GET["modify_leads"])) {$modify_leads=$_GET["modify_leads"];} + elseif (isset($_POST["modify_leads"])) {$modify_leads=$_POST["modify_leads"];} +if (isset($_GET["monitor_prefix"])) {$monitor_prefix=$_GET["monitor_prefix"];} + elseif (isset($_POST["monitor_prefix"])) {$monitor_prefix=$_POST["monitor_prefix"];} +if (isset($_GET["next_agent_call"])) {$next_agent_call=$_GET["next_agent_call"];} + elseif (isset($_POST["next_agent_call"])) {$next_agent_call=$_POST["next_agent_call"];} +if (isset($_GET["number_of_lines"])) {$number_of_lines=$_GET["number_of_lines"];} + elseif (isset($_POST["number_of_lines"])) {$number_of_lines=$_POST["number_of_lines"];} +if (isset($_GET["old_campaign_id"])) {$old_campaign_id=$_GET["old_campaign_id"];} + elseif (isset($_POST["old_campaign_id"])) {$old_campaign_id=$_POST["old_campaign_id"];} +if (isset($_GET["old_conf_exten"])) {$old_conf_exten=$_GET["old_conf_exten"];} + elseif (isset($_POST["old_conf_exten"])) {$old_conf_exten=$_POST["old_conf_exten"];} +if (isset($_GET["old_extension"])) {$old_extension=$_GET["old_extension"];} + elseif (isset($_POST["old_extension"])) {$old_extension=$_POST["old_extension"];} +if (isset($_GET["old_server_id"])) {$old_server_id=$_GET["old_server_id"];} + elseif (isset($_POST["old_server_id"])) {$old_server_id=$_POST["old_server_id"];} +if (isset($_GET["old_server_ip"])) {$old_server_ip=$_GET["old_server_ip"];} + elseif (isset($_POST["old_server_ip"])) {$old_server_ip=$_POST["old_server_ip"];} +if (isset($_GET["OLDuser_group"])) {$OLDuser_group=$_GET["OLDuser_group"];} + elseif (isset($_POST["OLDuser_group"])) {$OLDuser_group=$_POST["OLDuser_group"];} +if (isset($_GET["omit_phone_code"])) {$omit_phone_code=$_GET["omit_phone_code"];} + elseif (isset($_POST["omit_phone_code"])) {$omit_phone_code=$_POST["omit_phone_code"];} +if (isset($_GET["outbound_cid"])) {$outbound_cid=$_GET["outbound_cid"];} + elseif (isset($_POST["outbound_cid"])) {$outbound_cid=$_POST["outbound_cid"];} +if (isset($_GET["park_ext"])) {$park_ext=$_GET["park_ext"];} + elseif (isset($_POST["park_ext"])) {$park_ext=$_POST["park_ext"];} +if (isset($_GET["park_file_name"])) {$park_file_name=$_GET["park_file_name"];} + elseif (isset($_POST["park_file_name"])) {$park_file_name=$_POST["park_file_name"];} +if (isset($_GET["park_on_extension"])) {$park_on_extension=$_GET["park_on_extension"];} + elseif (isset($_POST["park_on_extension"])) {$park_on_extension=$_POST["park_on_extension"];} +if (isset($_GET["pass"])) {$pass=$_GET["pass"];} + elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];} +if (isset($_GET["phone_ip"])) {$phone_ip=$_GET["phone_ip"];} + elseif (isset($_POST["phone_ip"])) {$phone_ip=$_POST["phone_ip"];} +if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];} + elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];} +if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];} + elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];} +if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];} + elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];} +if (isset($_GET["phone_type"])) {$phone_type=$_GET["phone_type"];} + elseif (isset($_POST["phone_type"])) {$phone_type=$_POST["phone_type"];} +if (isset($_GET["picture"])) {$picture=$_GET["picture"];} + elseif (isset($_POST["picture"])) {$picture=$_POST["picture"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} +if (isset($_GET["QUEUE_ACTION_enabled"])) {$QUEUE_ACTION_enabled=$_GET["QUEUE_ACTION_enabled"];} + elseif (isset($_POST["QUEUE_ACTION_enabled"])) {$QUEUE_ACTION_enabled=$_POST["QUEUE_ACTION_enabled"];} +if (isset($_GET["recording_exten"])) {$recording_exten=$_GET["recording_exten"];} + elseif (isset($_POST["recording_exten"])) {$recording_exten=$_POST["recording_exten"];} +if (isset($_GET["remote_agent_id"])) {$remote_agent_id=$_GET["remote_agent_id"];} + elseif (isset($_POST["remote_agent_id"])) {$remote_agent_id=$_POST["remote_agent_id"];} +if (isset($_GET["reset_hopper"])) {$reset_hopper=$_GET["reset_hopper"];} + elseif (isset($_POST["reset_hopper"])) {$reset_hopper=$_POST["reset_hopper"];} +if (isset($_GET["reset_list"])) {$reset_list=$_GET["reset_list"];} + elseif (isset($_POST["reset_list"])) {$reset_list=$_POST["reset_list"];} +if (isset($_GET["safe_harbor_exten"])) {$safe_harbor_exten=$_GET["safe_harbor_exten"];} + elseif (isset($_POST["safe_harbor_exten"])) {$safe_harbor_exten=$_POST["safe_harbor_exten"];} +if (isset($_GET["safe_harbor_message"])) {$safe_harbor_message=$_GET["safe_harbor_message"];} + elseif (isset($_POST["safe_harbor_message"])) {$safe_harbor_message=$_POST["safe_harbor_message"];} +if (isset($_GET["scheduled_callbacks"])) {$scheduled_callbacks=$_GET["scheduled_callbacks"];} + elseif (isset($_POST["scheduled_callbacks"])) {$scheduled_callbacks=$_POST["scheduled_callbacks"];} +if (isset($_GET["script_comments"])) {$script_comments=$_GET["script_comments"];} + elseif (isset($_POST["script_comments"])) {$script_comments=$_POST["script_comments"];} +if (isset($_GET["script_id"])) {$script_id=$_GET["script_id"];} + elseif (isset($_POST["script_id"])) {$script_id=$_POST["script_id"];} +if (isset($_GET["script_name"])) {$script_name=$_GET["script_name"];} + elseif (isset($_POST["script_name"])) {$script_name=$_POST["script_name"];} +if (isset($_GET["script_text"])) {$script_text=$_GET["script_text"];} + elseif (isset($_POST["script_text"])) {$script_text=$_POST["script_text"];} +if (isset($_GET["selectable"])) {$selectable=$_GET["selectable"];} + elseif (isset($_POST["selectable"])) {$selectable=$_POST["selectable"];} +if (isset($_GET["server_description"])) {$server_description=$_GET["server_description"];} + elseif (isset($_POST["server_description"])) {$server_description=$_POST["server_description"];} +if (isset($_GET["server_id"])) {$server_id=$_GET["server_id"];} + elseif (isset($_POST["server_id"])) {$server_id=$_POST["server_id"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["state_call_time_state"])) {$state_call_time_state=$_GET["state_call_time_state"];} + elseif (isset($_POST["state_call_time_state"])) {$state_call_time_state=$_POST["state_call_time_state"];} +if (isset($_GET["state_rule"])) {$state_rule=$_GET["state_rule"];} + elseif (isset($_POST["state_rule"])) {$state_rule=$_POST["state_rule"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["status_name"])) {$status_name=$_GET["status_name"];} + elseif (isset($_POST["status_name"])) {$status_name=$_POST["status_name"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ENVIAR"])) {$ENVIAR=$_GET["ENVIAR"];} + elseif (isset($_POST["ENVIAR"])) {$ENVIAR=$_POST["ENVIAR"];} +if (isset($_GET["sys_perf_log"])) {$sys_perf_log=$_GET["sys_perf_log"];} + elseif (isset($_POST["sys_perf_log"])) {$sys_perf_log=$_POST["sys_perf_log"];} +if (isset($_GET["telnet_host"])) {$telnet_host=$_GET["telnet_host"];} + elseif (isset($_POST["telnet_host"])) {$telnet_host=$_POST["telnet_host"];} +if (isset($_GET["telnet_port"])) {$telnet_port=$_GET["telnet_port"];} + elseif (isset($_POST["telnet_port"])) {$telnet_port=$_POST["telnet_port"];} +if (isset($_GET["updater_check_enabled"])) {$updater_check_enabled=$_GET["updater_check_enabled"];} + elseif (isset($_POST["updater_check_enabled"])) {$updater_check_enabled=$_POST["updater_check_enabled"];} +if (isset($_GET["use_internal_dnc"])) {$use_internal_dnc=$_GET["use_internal_dnc"];} + elseif (isset($_POST["use_internal_dnc"])) {$use_internal_dnc=$_POST["use_internal_dnc"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["user_group"])) {$user_group=$_GET["user_group"];} + elseif (isset($_POST["user_group"])) {$user_group=$_POST["user_group"];} +if (isset($_GET["user_level"])) {$user_level=$_GET["user_level"];} + elseif (isset($_POST["user_level"])) {$user_level=$_POST["user_level"];} +if (isset($_GET["user_start"])) {$user_start=$_GET["user_start"];} + elseif (isset($_POST["user_start"])) {$user_start=$_POST["user_start"];} +if (isset($_GET["user_switching_enabled"])) {$user_switching_enabled=$_GET["user_switching_enabled"];} + elseif (isset($_POST["user_switching_enabled"])) {$user_switching_enabled=$_POST["user_switching_enabled"];} +if (isset($_GET["vd_server_logs"])) {$vd_server_logs=$_GET["vd_server_logs"];} + elseif (isset($_POST["vd_server_logs"])) {$vd_server_logs=$_POST["vd_server_logs"];} +if (isset($_GET["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_GET["VDstop_rec_after_each_call"];} + elseif (isset($_POST["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_POST["VDstop_rec_after_each_call"];} +if (isset($_GET["VICIDIAL_park_on_extension"])) {$VICIDIAL_park_on_extension=$_GET["VICIDIAL_park_on_extension"];} + elseif (isset($_POST["VICIDIAL_park_on_extension"])) {$VICIDIAL_park_on_extension=$_POST["VICIDIAL_park_on_extension"];} +if (isset($_GET["VICIDIAL_park_on_filename"])) {$VICIDIAL_park_on_filename=$_GET["VICIDIAL_park_on_filename"];} + elseif (isset($_POST["VICIDIAL_park_on_filename"])) {$VICIDIAL_park_on_filename=$_POST["VICIDIAL_park_on_filename"];} +if (isset($_GET["vicidial_recording"])) {$vicidial_recording=$_GET["vicidial_recording"];} + elseif (isset($_POST["vicidial_recording"])) {$vicidial_recording=$_POST["vicidial_recording"];} +if (isset($_GET["vicidial_transfers"])) {$vicidial_transfers=$_GET["vicidial_transfers"];} + elseif (isset($_POST["vicidial_transfers"])) {$vicidial_transfers=$_POST["vicidial_transfers"];} +if (isset($_GET["VICIDIAL_web_URL"])) {$VICIDIAL_web_URL=$_GET["VICIDIAL_web_URL"];} + elseif (isset($_POST["VICIDIAL_web_URL"])) {$VICIDIAL_web_URL=$_POST["VICIDIAL_web_URL"];} +if (isset($_GET["voicemail_button_enabled"])) {$voicemail_button_enabled=$_GET["voicemail_button_enabled"];} + elseif (isset($_POST["voicemail_button_enabled"])) {$voicemail_button_enabled=$_POST["voicemail_button_enabled"];} +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["voicemail_ext"])) {$voicemail_ext=$_GET["voicemail_ext"];} + elseif (isset($_POST["voicemail_ext"])) {$voicemail_ext=$_POST["voicemail_ext"];} +if (isset($_GET["voicemail_exten"])) {$voicemail_exten=$_GET["voicemail_exten"];} + elseif (isset($_POST["voicemail_exten"])) {$voicemail_exten=$_POST["voicemail_exten"];} +if (isset($_GET["voicemail_id"])) {$voicemail_id=$_GET["voicemail_id"];} + elseif (isset($_POST["voicemail_id"])) {$voicemail_id=$_POST["voicemail_id"];} +if (isset($_GET["web_form_address"])) {$web_form_address=$_GET["web_form_address"];} + elseif (isset($_POST["web_form_address"])) {$web_form_address=$_POST["web_form_address"];} +if (isset($_GET["wrapup_message"])) {$wrapup_message=$_GET["wrapup_message"];} + elseif (isset($_POST["wrapup_message"])) {$wrapup_message=$_POST["wrapup_message"];} +if (isset($_GET["wrapup_seconds"])) {$wrapup_seconds=$_GET["wrapup_seconds"];} + elseif (isset($_POST["wrapup_seconds"])) {$wrapup_seconds=$_POST["wrapup_seconds"];} +if (isset($_GET["xferconf_a_dtmf"])) {$xferconf_a_dtmf=$_GET["xferconf_a_dtmf"];} + elseif (isset($_POST["xferconf_a_dtmf"])) {$xferconf_a_dtmf=$_POST["xferconf_a_dtmf"];} +if (isset($_GET["xferconf_a_number"])) {$xferconf_a_number=$_GET["xferconf_a_number"];} + elseif (isset($_POST["xferconf_a_number"])) {$xferconf_a_number=$_POST["xferconf_a_number"];} +if (isset($_GET["xferconf_b_dtmf"])) {$xferconf_b_dtmf=$_GET["xferconf_b_dtmf"];} + elseif (isset($_POST["xferconf_b_dtmf"])) {$xferconf_b_dtmf=$_POST["xferconf_b_dtmf"];} +if (isset($_GET["xferconf_b_number"])) {$xferconf_b_number=$_GET["xferconf_b_number"];} + elseif (isset($_POST["xferconf_b_number"])) {$xferconf_b_number=$_POST["xferconf_b_number"];} +if (isset($_GET["vicidial_balance_active"])) {$vicidial_balance_active=$_GET["vicidial_balance_active"];} + elseif (isset($_POST["vicidial_balance_active"])) {$vicidial_balance_active=$_POST["vicidial_balance_active"];} +if (isset($_GET["balance_trunks_offlimits"])) {$balance_trunks_offlimits=$_GET["balance_trunks_offlimits"];} + elseif (isset($_POST["balance_trunks_offlimits"])) {$balance_trunks_offlimits=$_POST["balance_trunks_offlimits"];} +if (isset($_GET["dedicated_trunks"])) {$dedicated_trunks=$_GET["dedicated_trunks"];} + elseif (isset($_POST["dedicated_trunks"])) {$dedicated_trunks=$_POST["dedicated_trunks"];} +if (isset($_GET["trunk_restriction"])) {$trunk_restriction=$_GET["trunk_restriction"];} + elseif (isset($_POST["trunk_restriction"])) {$trunk_restriction=$_POST["trunk_restriction"];} +if (isset($_GET["campaigns"])) {$campaigns=$_GET["campaigns"];} + elseif (isset($_POST["campaigns"])) {$campaigns=$_POST["campaigns"];} +if (isset($_GET["dial_level_override"])) {$dial_level_override=$_GET["dial_level_override"];} + elseif (isset($_POST["dial_level_override"])) {$dial_level_override=$_POST["dial_level_override"];} +if (isset($_GET["concurrent_transfers"])) {$concurrent_transfers=$_GET["concurrent_transfers"];} + elseif (isset($_POST["concurrent_transfers"])) {$concurrent_transfers=$_POST["concurrent_transfers"];} +if (isset($_GET["auto_alt_dial"])) {$auto_alt_dial=$_GET["auto_alt_dial"];} + elseif (isset($_POST["auto_alt_dial"])) {$auto_alt_dial=$_POST["auto_alt_dial"];} +if (isset($_GET["modify_users"])) {$modify_users=$_GET["modify_users"];} + elseif (isset($_POST["modify_users"])) {$modify_users=$_POST["modify_users"];} +if (isset($_GET["modify_campaigns"])) {$modify_campaigns=$_GET["modify_campaigns"];} + elseif (isset($_POST["modify_campaigns"])) {$modify_campaigns=$_POST["modify_campaigns"];} +if (isset($_GET["modify_lists"])) {$modify_lists=$_GET["modify_lists"];} + elseif (isset($_POST["modify_lists"])) {$modify_lists=$_POST["modify_lists"];} +if (isset($_GET["modify_scripts"])) {$modify_scripts=$_GET["modify_scripts"];} + elseif (isset($_POST["modify_scripts"])) {$modify_scripts=$_POST["modify_scripts"];} +if (isset($_GET["modify_filters"])) {$modify_filters=$_GET["modify_filters"];} + elseif (isset($_POST["modify_filters"])) {$modify_filters=$_POST["modify_filters"];} +if (isset($_GET["modify_ingroups"])) {$modify_ingroups=$_GET["modify_ingroups"];} + elseif (isset($_POST["modify_ingroups"])) {$modify_ingroups=$_POST["modify_ingroups"];} +if (isset($_GET["modify_usergroups"])) {$modify_usergroups=$_GET["modify_usergroups"];} + elseif (isset($_POST["modify_usergroups"])) {$modify_usergroups=$_POST["modify_usergroups"];} +if (isset($_GET["modify_remoteagents"])) {$modify_remoteagents=$_GET["modify_remoteagents"];} + elseif (isset($_POST["modify_remoteagents"])) {$modify_remoteagents=$_POST["modify_remoteagents"];} +if (isset($_GET["modify_servers"])) {$modify_servers=$_GET["modify_servers"];} + elseif (isset($_POST["modify_servers"])) {$modify_servers=$_POST["modify_servers"];} +if (isset($_GET["view_reports"])) {$view_reports=$_GET["view_reports"];} + elseif (isset($_POST["view_reports"])) {$view_reports=$_POST["view_reports"];} +if (isset($_GET["agent_pause_codes_active"])) {$agent_pause_codes_active=$_GET["agent_pause_codes_active"];} + elseif (isset($_POST["agent_pause_codes_active"])) {$agent_pause_codes_active=$_POST["agent_pause_codes_active"];} +if (isset($_GET["pause_code"])) {$pause_code=$_GET["pause_code"];} + elseif (isset($_POST["pause_code"])) {$pause_code=$_POST["pause_code"];} +if (isset($_GET["pause_code_name"])) {$pause_code_name=$_GET["pause_code_name"];} + elseif (isset($_POST["pause_code_name"])) {$pause_code_name=$_POST["pause_code_name"];} +if (isset($_GET["billable"])) {$billable=$_GET["billable"];} + elseif (isset($_POST["billable"])) {$billable=$_POST["billable"];} +if (isset($_GET["campaign_description"])) {$campaign_description=$_GET["campaign_description"];} + elseif (isset($_POST["campaign_description"])) {$campaign_description=$_POST["campaign_description"];} +if (isset($_GET["campaign_stats_refresh"])) {$campaign_stats_refresh=$_GET["campaign_stats_refresh"];} + elseif (isset($_POST["campaign_stats_refresh"])){$campaign_stats_refresh=$_POST["campaign_stats_refresh"];} +if (isset($_GET["list_description"])) {$list_description=$_GET["list_description"];} + elseif (isset($_POST["list_description"])) {$list_description=$_POST["list_description"];} +if (isset($_GET["vicidial_recording_override"])) {$vicidial_recording_override=$_GET["vicidial_recording_override"];} elseif (isset($_POST["vicidial_recording_override"])) {$vicidial_recording_override=$_POST["vicidial_recording_override"];} +if (isset($_GET["use_non_latin"])) {$use_non_latin=$_GET["use_non_latin"];} + elseif (isset($_POST["use_non_latin"])) {$use_non_latin=$_POST["use_non_latin"];} +if (isset($_GET["webroot_writable"])) {$webroot_writable=$_GET["webroot_writable"];} + elseif (isset($_POST["webroot_writable"])) {$webroot_writable=$_POST["webroot_writable"];} +if (isset($_GET["enable_queuemetrics_logging"])) {$enable_queuemetrics_logging=$_GET["enable_queuemetrics_logging"];} + elseif (isset($_POST["enable_queuemetrics_logging"])) {$enable_queuemetrics_logging=$_POST["enable_queuemetrics_logging"];} +if (isset($_GET["queuemetrics_server_ip"])) {$queuemetrics_server_ip=$_GET["queuemetrics_server_ip"];} + elseif (isset($_POST["queuemetrics_server_ip"])) {$queuemetrics_server_ip=$_POST["queuemetrics_server_ip"];} +if (isset($_GET["queuemetrics_dbname"])) {$queuemetrics_dbname=$_GET["queuemetrics_dbname"];} + elseif (isset($_POST["queuemetrics_dbname"])) {$queuemetrics_dbname=$_POST["queuemetrics_dbname"];} +if (isset($_GET["queuemetrics_login"])) {$queuemetrics_login=$_GET["queuemetrics_login"];} + elseif (isset($_POST["queuemetrics_login"])) {$queuemetrics_login=$_POST["queuemetrics_login"];} +if (isset($_GET["queuemetrics_pass"])) {$queuemetrics_pass=$_GET["queuemetrics_pass"];} + elseif (isset($_POST["queuemetrics_pass"])) {$queuemetrics_pass=$_POST["queuemetrics_pass"];} +if (isset($_GET["queuemetrics_url"])) {$queuemetrics_url=$_GET["queuemetrics_url"];} + elseif (isset($_POST["queuemetrics_url"])) {$queuemetrics_url=$_POST["queuemetrics_url"];} +if (isset($_GET["queuemetrics_log_id"])) {$queuemetrics_log_id=$_GET["queuemetrics_log_id"];} + elseif (isset($_POST["queuemetrics_log_id"])) {$queuemetrics_log_id=$_POST["queuemetrics_log_id"];} +if (isset($_GET["dial_status"])) {$dial_status=$_GET["dial_status"];} + elseif (isset($_POST["dial_status"])) {$dial_status=$_POST["dial_status"];} +if (isset($_GET["queuemetrics_eq_prepend"])) {$queuemetrics_eq_prepend=$_GET["queuemetrics_eq_prepend"];} + elseif (isset($_POST["queuemetrics_eq_prepend"])) {$queuemetrics_eq_prepend=$_POST["queuemetrics_eq_prepend"];} +if (isset($_GET["vicidial_agent_disable"])) {$vicidial_agent_disable=$_GET["vicidial_agent_disable"];} + elseif (isset($_POST["vicidial_agent_disable"])) {$vicidial_agent_disable=$_POST["vicidial_agent_disable"];} +if (isset($_GET["disable_alter_custdata"])) {$disable_alter_custdata=$_GET["disable_alter_custdata"];} + elseif (isset($_POST["disable_alter_custdata"])) {$disable_alter_custdata=$_POST["disable_alter_custdata"];} +if (isset($_GET["alter_custdata_override"])) {$alter_custdata_override=$_GET["alter_custdata_override"];} + elseif (isset($_POST["alter_custdata_override"])) {$alter_custdata_override=$_POST["alter_custdata_override"];} +if (isset($_GET["no_hopper_leads_logins"])) {$no_hopper_leads_logins=$_GET["no_hopper_leads_logins"];} + elseif (isset($_POST["no_hopper_leads_logins"])) {$no_hopper_leads_logins=$_POST["no_hopper_leads_logins"];} +if (isset($_GET["enable_sipsak_messages"])) {$enable_sipsak_messages=$_GET["enable_sipsak_messages"];} + elseif (isset($_POST["enable_sipsak_messages"])) {$enable_sipsak_messages=$_POST["enable_sipsak_messages"];} +if (isset($_GET["allow_sipsak_messages"])) {$allow_sipsak_messages=$_GET["allow_sipsak_messages"];} + elseif (isset($_POST["allow_sipsak_messages"])) {$allow_sipsak_messages=$_POST["allow_sipsak_messages"];} +if (isset($_GET["admin_home_url"])) {$admin_home_url=$_GET["admin_home_url"];} + elseif (isset($_POST["admin_home_url"])) {$admin_home_url=$_POST["admin_home_url"];} +if (isset($_GET["list_order_mix"])) {$list_order_mix=$_GET["list_order_mix"];} + elseif (isset($_POST["list_order_mix"])) {$list_order_mix=$_POST["list_order_mix"];} +if (isset($_GET["vcl_id"])) {$vcl_id=$_GET["vcl_id"];} + elseif (isset($_POST["vcl_id"])) {$vcl_id=$_POST["vcl_id"];} +if (isset($_GET["vcl_name"])) {$vcl_name=$_GET["vcl_name"];} + elseif (isset($_POST["vcl_name"])) {$vcl_name=$_POST["vcl_name"];} +if (isset($_GET["list_mix_container"])) {$list_mix_container=$_GET["list_mix_container"];} + elseif (isset($_POST["list_mix_container"])) {$list_mix_container=$_POST["list_mix_container"];} +if (isset($_GET["mix_method"])) {$mix_method=$_GET["mix_method"];} + elseif (isset($_POST["mix_method"])) {$mix_method=$_POST["mix_method"];} +if (isset($_GET["human_answered"])) {$human_answered=$_GET["human_answered"];} + elseif (isset($_POST["human_answered"])) {$human_answered=$_POST["human_answered"];} +if (isset($_GET["category"])) {$category=$_GET["category"];} + elseif (isset($_POST["category"])) {$category=$_POST["category"];} +if (isset($_GET["vsc_id"])) {$vsc_id=$_GET["vsc_id"];} + elseif (isset($_POST["vsc_id"])) {$vsc_id=$_POST["vsc_id"];} +if (isset($_GET["vsc_name"])) {$vsc_name=$_GET["vsc_name"];} + elseif (isset($_POST["vsc_name"])) {$vsc_name=$_POST["vsc_name"];} +if (isset($_GET["vsc_description"])) {$vsc_description=$_GET["vsc_description"];} + elseif (isset($_POST["vsc_description"])) {$vsc_description=$_POST["vsc_description"];} +if (isset($_GET["tovdad_display"])) {$tovdad_display=$_GET["tovdad_display"];} + elseif (isset($_POST["tovdad_display"])) {$tovdad_display=$_POST["tovdad_display"];} +if (isset($_GET["mix_container_item"])) {$mix_container_item=$_GET["mix_container_item"];} + elseif (isset($_POST["mix_container_item"])) {$mix_container_item=$_POST["mix_container_item"];} +if (isset($_GET["enable_agc_xfer_log"])) {$enable_agc_xfer_log=$_GET["enable_agc_xfer_log"];} + elseif (isset($_POST["enable_agc_xfer_log"])) {$enable_agc_xfer_log=$_POST["enable_agc_xfer_log"];} +if (isset($_GET["after_hours_action"])) {$after_hours_action=$_GET["after_hours_action"];} + elseif (isset($_POST["after_hours_action"])) {$after_hours_action=$_POST["after_hours_action"];} +if (isset($_GET["after_hours_message_filename"])) {$after_hours_message_filename=$_GET["after_hours_message_filename"];} + elseif (isset($_POST["after_hours_message_filename"])) {$after_hours_message_filename=$_POST["after_hours_message_filename"];} +if (isset($_GET["after_hours_exten"])) {$after_hours_exten=$_GET["after_hours_exten"];} + elseif (isset($_POST["after_hours_exten"])) {$after_hours_exten=$_POST["after_hours_exten"];} +if (isset($_GET["after_hours_voicemail"])) {$after_hours_voicemail=$_GET["after_hours_voicemail"];} + elseif (isset($_POST["after_hours_voicemail"])) {$after_hours_voicemail=$_POST["after_hours_voicemail"];} +if (isset($_GET["welcome_message_filename"])) {$welcome_message_filename=$_GET["welcome_message_filename"];} + elseif (isset($_POST["welcome_message_filename"])) {$welcome_message_filename=$_POST["welcome_message_filename"];} +if (isset($_GET["moh_context"])) {$moh_context=$_GET["moh_context"];} + elseif (isset($_POST["moh_context"])) {$moh_context=$_POST["moh_context"];} +if (isset($_GET["onhold_prompt_filename"])) {$onhold_prompt_filename=$_GET["onhold_prompt_filename"];} + elseif (isset($_POST["onhold_prompt_filename"])) {$onhold_prompt_filename=$_POST["onhold_prompt_filename"];} +if (isset($_GET["prompt_interval"])) {$prompt_interval=$_GET["prompt_interval"];} + elseif (isset($_POST["prompt_interval"])) {$prompt_interval=$_POST["prompt_interval"];} +if (isset($_GET["agent_alert_exten"])) {$agent_alert_exten=$_GET["agent_alert_exten"];} + elseif (isset($_POST["agent_alert_exten"])) {$agent_alert_exten=$_POST["agent_alert_exten"];} +if (isset($_GET["agent_alert_delay"])) {$agent_alert_delay=$_GET["agent_alert_delay"];} + elseif (isset($_POST["agent_alert_delay"])) {$agent_alert_delay=$_POST["agent_alert_delay"];} +if (isset($_GET["group_rank"])) {$group_rank=$_GET["group_rank"];} + elseif (isset($_POST["group_rank"])) {$group_rank=$_POST["group_rank"];} +if (isset($_GET["campaign_allow_inbound"])) {$campaign_allow_inbound=$_GET["campaign_allow_inbound"];} + elseif (isset($_POST["campaign_allow_inbound"])) {$campaign_allow_inbound=$_POST["campaign_allow_inbound"];} +if (isset($_GET["manual_dial_list_id"])) {$manual_dial_list_id=$_GET["manual_dial_list_id"];} + elseif (isset($_POST["manual_dial_list_id"])) {$manual_dial_list_id=$_POST["manual_dial_list_id"];} +if (isset($_GET["campaign_rank"])) {$campaign_rank=$_GET["campaign_rank"];} + elseif (isset($_POST["campaign_rank"])) {$campaign_rank=$_POST["campaign_rank"];} +if (isset($_GET["source_campaign_id"])) {$source_campaign_id=$_GET["source_campaign_id"];} + elseif (isset($_POST["source_campaign_id"])) {$source_campaign_id=$_POST["source_campaign_id"];} +if (isset($_GET["source_user_id"])) {$source_user_id=$_GET["source_user_id"];} + elseif (isset($_POST["source_user_id"])) {$source_user_id=$_POST["source_user_id"];} +if (isset($_GET["source_group_id"])) {$source_group_id=$_GET["source_group_id"];} + elseif (isset($_POST["source_group_id"])) {$source_group_id=$_POST["source_group_id"];} +if (isset($_GET["default_xfer_group"])) {$default_xfer_group=$_GET["default_xfer_group"];} + elseif (isset($_POST["default_xfer_group"])) {$default_xfer_group=$_POST["default_xfer_group"];} + + + if (isset($script_id)) {$script_id= strtoupper($script_id);} + if (isset($lead_filter_id)) {$lead_filter_id = strtoupper($lead_filter_id);} + +if (strlen($dial_status) > 0) + { + $ADD='28'; + $status = $dial_status; + } + +###################################################################################################### +###################################################################################################### +####### Form variable filtering for security and data integrity +###################################################################################################### +###################################################################################################### + +if ($non_latin < 1) +{ +### DIGITS ONLY ### +$adaptive_dropped_percentage = ereg_replace("[^0-9]","",$adaptive_dropped_percentage); +$adaptive_latest_server_time = ereg_replace("[^0-9]","",$adaptive_latest_server_time); +$admin_hangup_enabled = ereg_replace("[^0-9]","",$admin_hangup_enabled); +$admin_hijack_enabled = ereg_replace("[^0-9]","",$admin_hijack_enabled); +$admin_monitor_enabled = ereg_replace("[^0-9]","",$admin_monitor_enabled); +$AFLogging_enabled = ereg_replace("[^0-9]","",$AFLogging_enabled); +$agent_choose_ingroups = ereg_replace("[^0-9]","",$agent_choose_ingroups); +$agentcall_manual = ereg_replace("[^0-9]","",$agentcall_manual); +$agentonly_callbacks = ereg_replace("[^0-9]","",$agentonly_callbacks); +$AGI_call_logging_enabled = ereg_replace("[^0-9]","",$AGI_call_logging_enabled); +$allcalls_delay = ereg_replace("[^0-9]","",$allcalls_delay); +$alter_agent_interface_options = ereg_replace("[^0-9]","",$alter_agent_interface_options); +$am_message_exten = ereg_replace("[^0-9]","",$am_message_exten); +$answer_transfer_agent = ereg_replace("[^0-9]","",$answer_transfer_agent); +$ast_admin_access = ereg_replace("[^0-9]","",$ast_admin_access); +$ast_delete_phones = ereg_replace("[^0-9]","",$ast_delete_phones); +$attempt_delay = ereg_replace("[^0-9]","",$attempt_delay); +$attempt_maximum = ereg_replace("[^0-9]","",$attempt_maximum); +$auto_dial_next_number = ereg_replace("[^0-9]","",$auto_dial_next_number); +$balance_trunks_offlimits = ereg_replace("[^0-9]","",$balance_trunks_offlimits); +$call_parking_enabled = ereg_replace("[^0-9]","",$call_parking_enabled); +$CallerID_popup_enabled = ereg_replace("[^0-9]","",$CallerID_popup_enabled); +$campaign_detail = ereg_replace("[^0-9]","",$campaign_detail); +$campaign_rec_exten = ereg_replace("[^0-9]","",$campaign_rec_exten); +$campaign_vdad_exten = ereg_replace("[^0-9]","",$campaign_vdad_exten); +$change_agent_campaign = ereg_replace("[^0-9]","",$change_agent_campaign); +$closer_default_blended = ereg_replace("[^0-9]","",$closer_default_blended); +$conf_exten = ereg_replace("[^0-9]","",$conf_exten); +$conf_on_extension = ereg_replace("[^0-9]","",$conf_on_extension); +$conferencing_enabled = ereg_replace("[^0-9]","",$conferencing_enabled); +$ct_default_start = ereg_replace("[^0-9]","",$ct_default_start); +$ct_default_stop = ereg_replace("[^0-9]","",$ct_default_stop); +$ct_friday_start = ereg_replace("[^0-9]","",$ct_friday_start); +$ct_friday_stop = ereg_replace("[^0-9]","",$ct_friday_stop); +$ct_monday_start = ereg_replace("[^0-9]","",$ct_monday_start); +$ct_monday_stop = ereg_replace("[^0-9]","",$ct_monday_stop); +$ct_saturday_start = ereg_replace("[^0-9]","",$ct_saturday_start); +$ct_saturday_stop = ereg_replace("[^0-9]","",$ct_saturday_stop); +$ct_sunday_start = ereg_replace("[^0-9]","",$ct_sunday_start); +$ct_sunday_stop = ereg_replace("[^0-9]","",$ct_sunday_stop); +$ct_thursday_start = ereg_replace("[^0-9]","",$ct_thursday_start); +$ct_thursday_stop = ereg_replace("[^0-9]","",$ct_thursday_stop); +$ct_tuesday_start = ereg_replace("[^0-9]","",$ct_tuesday_start); +$ct_tuesday_stop = ereg_replace("[^0-9]","",$ct_tuesday_stop); +$ct_wednesday_start = ereg_replace("[^0-9]","",$ct_wednesday_start); +$ct_wednesday_stop = ereg_replace("[^0-9]","",$ct_wednesday_stop); +$DBX_port = ereg_replace("[^0-9]","",$DBX_port); +$DBY_port = ereg_replace("[^0-9]","",$DBY_port); +$dedicated_trunks = ereg_replace("[^0-9]","",$dedicated_trunks); +$delete_call_times = ereg_replace("[^0-9]","",$delete_call_times); +$delete_campaigns = ereg_replace("[^0-9]","",$delete_campaigns); +$delete_filters = ereg_replace("[^0-9]","",$delete_filters); +$delete_ingroups = ereg_replace("[^0-9]","",$delete_ingroups); +$delete_lists = ereg_replace("[^0-9]","",$delete_lists); +$delete_remote_agents = ereg_replace("[^0-9]","",$delete_remote_agents); +$delete_scripts = ereg_replace("[^0-9]","",$delete_scripts); +$delete_user_groups = ereg_replace("[^0-9]","",$delete_user_groups); +$delete_users = ereg_replace("[^0-9]","",$delete_users); +$dial_timeout = ereg_replace("[^0-9]","",$dial_timeout); +$dialplan_number = ereg_replace("[^0-9]","",$dialplan_number); +$drop_call_seconds = ereg_replace("[^0-9]","",$drop_call_seconds); +$drop_exten = ereg_replace("[^0-9]","",$drop_exten); +$enable_fast_refresh = ereg_replace("[^0-9]","",$enable_fast_refresh); +$enable_persistant_mysql = ereg_replace("[^0-9]","",$enable_persistant_mysql); +$fast_refresh_rate = ereg_replace("[^0-9]","",$fast_refresh_rate); +$hopper_level = ereg_replace("[^0-9]","",$hopper_level); +$hotkey = ereg_replace("[^0-9]","",$hotkey); +$hotkeys_active = ereg_replace("[^0-9]","",$hotkeys_active); +$list_id = ereg_replace("[^0-9]","",$list_id); +$load_leads = ereg_replace("[^0-9]","",$load_leads); +$max_vicidial_trunks = ereg_replace("[^0-9]","",$max_vicidial_trunks); +$modify_call_times = ereg_replace("[^0-9]","",$modify_call_times); +$modify_users = ereg_replace("[^0-9]","",$modify_users); +$modify_campaigns = ereg_replace("[^0-9]","",$modify_campaigns); +$modify_lists = ereg_replace("[^0-9]","",$modify_lists); +$modify_scripts = ereg_replace("[^0-9]","",$modify_scripts); +$modify_filters = ereg_replace("[^0-9]","",$modify_filters); +$modify_ingroups = ereg_replace("[^0-9]","",$modify_ingroups); +$modify_usergroups = ereg_replace("[^0-9]","",$modify_usergroups); +$modify_remoteagents = ereg_replace("[^0-9]","",$modify_remoteagents); +$modify_servers = ereg_replace("[^0-9]","",$modify_servers); +$view_reports = ereg_replace("[^0-9]","",$view_reports); +$modify_leads = ereg_replace("[^0-9]","",$modify_leads); +$monitor_prefix = ereg_replace("[^0-9]","",$monitor_prefix); +$number_of_lines = ereg_replace("[^0-9]","",$number_of_lines); +$old_conf_exten = ereg_replace("[^0-9]","",$old_conf_exten); +$outbound_cid = ereg_replace("[^0-9]","",$outbound_cid); +$park_ext = ereg_replace("[^0-9]","",$park_ext); +$park_on_extension = ereg_replace("[^0-9]","",$park_on_extension); +$phone_number = ereg_replace("[^0-9]","",$phone_number); +$QUEUE_ACTION_enabled = ereg_replace("[^0-9]","",$QUEUE_ACTION_enabled); +$recording_exten = ereg_replace("[^0-9]","",$recording_exten); +$remote_agent_id = ereg_replace("[^0-9]","",$remote_agent_id); +$safe_harbor_exten = ereg_replace("[^0-9]","",$safe_harbor_exten); +$telnet_port = ereg_replace("[^0-9]","",$telnet_port); +$updater_check_enabled = ereg_replace("[^0-9]","",$updater_check_enabled); +$user_level = ereg_replace("[^0-9]","",$user_level); +$user_start = ereg_replace("[^0-9]","",$user_start); +$user_switching_enabled = ereg_replace("[^0-9]","",$user_switching_enabled); +$VDstop_rec_after_each_call = ereg_replace("[^0-9]","",$VDstop_rec_after_each_call); +$VICIDIAL_park_on_extension = ereg_replace("[^0-9]","",$VICIDIAL_park_on_extension); +$vicidial_recording = ereg_replace("[^0-9]","",$vicidial_recording); +$vicidial_transfers = ereg_replace("[^0-9]","",$vicidial_transfers); +$voicemail_button_enabled = ereg_replace("[^0-9]","",$voicemail_button_enabled); +$voicemail_dump_exten = ereg_replace("[^0-9]","",$voicemail_dump_exten); +$voicemail_ext = ereg_replace("[^0-9]","",$voicemail_ext); +$voicemail_exten = ereg_replace("[^0-9]","",$voicemail_exten); +$voicemail_id = ereg_replace("[^0-9]","",$voicemail_id); +$wrapup_seconds = ereg_replace("[^0-9]","",$wrapup_seconds); +$use_non_latin = ereg_replace("[^0-9]","",$use_non_latin); +$webroot_writable = ereg_replace("[^0-9]","",$webroot_writable); +$enable_queuemetrics_logging = ereg_replace("[^0-9]","",$enable_queuemetrics_logging); +$enable_sipsak_messages = ereg_replace("[^0-9]","",$enable_sipsak_messages); +$allow_sipsak_messages = ereg_replace("[^0-9]","",$allow_sipsak_messages); +$mix_container_item = ereg_replace("[^0-9]","",$mix_container_item); +$prompt_interval = ereg_replace("[^0-9]","",$prompt_interval); +$agent_alert_delay = ereg_replace("[^0-9]","",$agent_alert_delay); +$manual_dial_list_id = ereg_replace("[^0-9]","",$manual_dial_list_id); + +### DIGITS and DASHES +$group_rank = ereg_replace("[^-0-9]","",$group_rank); +$campaign_rank = ereg_replace("[^-0-9]","",$campaign_rank); + +### Y or N ONLY ### +$active = ereg_replace("[^NY]","",$active); +$allow_closers = ereg_replace("[^NY]","",$allow_closers); +$reset_hopper = ereg_replace("[^NY]","",$reset_hopper); +$amd_send_to_vmx = ereg_replace("[^NY]","",$amd_send_to_vmx); +$alt_number_dialing = ereg_replace("[^NY]","",$alt_number_dialing); +$safe_harbor_message = ereg_replace("[^NY]","",$safe_harbor_message); +$selectable = ereg_replace("[^NY]","",$selectable); +$reset_list = ereg_replace("[^NY]","",$reset_list); +$fronter_display = ereg_replace("[^NY]","",$fronter_display); +$drop_message = ereg_replace("[^NY]","",$drop_message); +$use_internal_dnc = ereg_replace("[^NY]","",$use_internal_dnc); +$omit_phone_code = ereg_replace("[^NY]","",$omit_phone_code); +$available_only_ratio_tally = ereg_replace("[^NY]","",$available_only_ratio_tally); +$sys_perf_log = ereg_replace("[^NY]","",$sys_perf_log); +$vicidial_balance_active = ereg_replace("[^NY]","",$vicidial_balance_active); +$vd_server_logs = ereg_replace("[^NY]","",$vd_server_logs); +$agent_pause_codes_active = ereg_replace("[^NY]","",$agent_pause_codes_active); +$campaign_stats_refresh = ereg_replace("[^NY]","",$campaign_stats_refresh); +$disable_alter_custdata = ereg_replace("[^NY]","",$disable_alter_custdata); +$no_hopper_leads_logins = ereg_replace("[^NY]","",$no_hopper_leads_logins); +$human_answered = ereg_replace("[^NY]","",$human_answered); +$tovdad_display = ereg_replace("[^NY]","",$tovdad_display); +$campaign_allow_inbound = ereg_replace("[^NY]","",$campaign_allow_inbound); + +### ALPHA-NUMERIC ONLY ### +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); +$script_id = ereg_replace("[^0-9a-zA-Z]","",$script_id); +$submit = ereg_replace("[^0-9a-zA-Z]","",$submit); +$campaign_cid = ereg_replace("[^0-9a-zA-Z]","",$campaign_cid); +$get_call_launch = ereg_replace("[^0-9a-zA-Z]","",$get_call_launch); +$campaign_recording = ereg_replace("[^0-9a-zA-Z]","",$campaign_recording); +$ADD = ereg_replace("[^0-9a-zA-Z]","",$ADD); +$dial_prefix = ereg_replace("[^0-9a-zA-Z]","",$dial_prefix); +$state_call_time_state = ereg_replace("[^0-9a-zA-Z]","",$state_call_time_state); +$scheduled_callbacks = ereg_replace("[^0-9a-zA-Z]","",$scheduled_callbacks); +$concurrent_transfers = ereg_replace("[^0-9a-zA-Z]","",$concurrent_transfers); +$billable = ereg_replace("[^0-9a-zA-Z]","",$billable); +$pause_code = ereg_replace("[^0-9a-zA-Z]","",$pause_code); +$vicidial_recording_override = ereg_replace("[^0-9a-zA-Z]","",$vicidial_recording_override); +$queuemetrics_log_id = ereg_replace("[^0-9a-zA-Z]","",$queuemetrics_log_id); +$after_hours_action = ereg_replace("[^0-9a-zA-Z]","",$after_hours_action); +$after_hours_exten = ereg_replace("[^0-9a-zA-Z]","",$after_hours_exten); +$after_hours_voicemail = ereg_replace("[^0-9a-zA-Z]","",$after_hours_voicemail); + +### DIGITS and Dots +$server_ip = ereg_replace("[^\.0-9]","",$server_ip); +$auto_dial_level = ereg_replace("[^\.0-9]","",$auto_dial_level); +$adaptive_maximum_level = ereg_replace("[^\.0-9]","",$adaptive_maximum_level); +$phone_ip = ereg_replace("[^\.0-9]","",$phone_ip); +$old_server_ip = ereg_replace("[^\.0-9]","",$old_server_ip); +$computer_ip = ereg_replace("[^\.0-9]","",$computer_ip); +$queuemetrics_server_ip = ereg_replace("[^\.0-9]","",$queuemetrics_server_ip); + +### ALPHA-NUMERIC and spaces and hash and star and comma +$xferconf_a_dtmf = ereg_replace("[^ \,\*\#0-9a-zA-Z]","",$xferconf_a_dtmf); +$xferconf_b_dtmf = ereg_replace("[^ \,\*\#0-9a-zA-Z]","",$xferconf_b_dtmf); + +### ALPHACAPS-NUMERIC +$xferconf_a_number = ereg_replace("[^0-9A-Z]","",$xferconf_a_number); +$xferconf_b_number = ereg_replace("[^0-9A-Z]","",$xferconf_b_number); + +### ALPHA-NUMERIC and underscore and dash +$agi_output = ereg_replace("[^-\_0-9a-zA-Z]","",$agi_output); +$ASTmgrSECRET = ereg_replace("[^-\_0-9a-zA-Z]","",$ASTmgrSECRET); +$ASTmgrUSERNAME = ereg_replace("[^-\_0-9a-zA-Z]","",$ASTmgrUSERNAME); +$ASTmgrUSERNAMElisten = ereg_replace("[^-\_0-9a-zA-Z]","",$ASTmgrUSERNAMElisten); +$ASTmgrUSERNAMEsend = ereg_replace("[^-\_0-9a-zA-Z]","",$ASTmgrUSERNAMEsend); +$ASTmgrUSERNAMEupdate = ereg_replace("[^-\_0-9a-zA-Z]","",$ASTmgrUSERNAMEupdate); +$call_time_id = ereg_replace("[^-\_0-9a-zA-Z]","",$call_time_id); +$campaign_id = ereg_replace("[^-\_0-9a-zA-Z]","",$campaign_id); +$CoNfIrM = ereg_replace("[^-\_0-9a-zA-Z]","",$CoNfIrM); +$DBX_database = ereg_replace("[^-\_0-9a-zA-Z]","",$DBX_database); +$DBX_pass = ereg_replace("[^-\_0-9a-zA-Z]","",$DBX_pass); +$DBX_user = ereg_replace("[^-\_0-9a-zA-Z]","",$DBX_user); +$DBY_database = ereg_replace("[^-\_0-9a-zA-Z]","",$DBY_database); +$DBY_pass = ereg_replace("[^-\_0-9a-zA-Z]","",$DBY_pass); +$DBY_user = ereg_replace("[^-\_0-9a-zA-Z]","",$DBY_user); +$dial_method = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_method); +$dial_status_a = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status_a); +$dial_status_b = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status_b); +$dial_status_c = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status_c); +$dial_status_d = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status_d); +$dial_status_e = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status_e); +$ext_context = ereg_replace("[^-\_0-9a-zA-Z]","",$ext_context); +$group_id = ereg_replace("[^-\_0-9a-zA-Z]","",$group_id); +$lead_filter_id = ereg_replace("[^-\_0-9a-zA-Z]","",$lead_filter_id); +$local_call_time = ereg_replace("[^-\_0-9a-zA-Z]","",$local_call_time); +$login = ereg_replace("[^-\_0-9a-zA-Z]","",$login); +$login_campaign = ereg_replace("[^-\_0-9a-zA-Z]","",$login_campaign); +$login_pass = ereg_replace("[^-\_0-9a-zA-Z]","",$login_pass); +$login_user = ereg_replace("[^-\_0-9a-zA-Z]","",$login_user); +$next_agent_call = ereg_replace("[^-\_0-9a-zA-Z]","",$next_agent_call); +$old_campaign_id = ereg_replace("[^-\_0-9a-zA-Z]","",$old_campaign_id); +$old_server_id = ereg_replace("[^-\_0-9a-zA-Z]","",$old_server_id); +$OLDuser_group = ereg_replace("[^-\_0-9a-zA-Z]","",$OLDuser_group); +$park_file_name = ereg_replace("[^-\_0-9a-zA-Z]","",$park_file_name); +$pass = ereg_replace("[^-\_0-9a-zA-Z]","",$pass); +$phone_login = ereg_replace("[^-\_0-9a-zA-Z]","",$phone_login); +$phone_pass = ereg_replace("[^-\_0-9a-zA-Z]","",$phone_pass); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$protocol = ereg_replace("[^-\_0-9a-zA-Z]","",$protocol); +$server_id = ereg_replace("[^-\_0-9a-zA-Z]","",$server_id); +$stage = ereg_replace("[^-\_0-9a-zA-Z]","",$stage); +$state_rule = ereg_replace("[^-\_0-9a-zA-Z]","",$state_rule); +$status = ereg_replace("[^-\_0-9a-zA-Z]","",$status); +$trunk_restriction = ereg_replace("[^-\_0-9a-zA-Z]","",$trunk_restriction); +$user = ereg_replace("[^-\_0-9a-zA-Z]","",$user); +$user_group = ereg_replace("[^-\_0-9a-zA-Z]","",$user_group); +$VICIDIAL_park_on_filename = ereg_replace("[^-\_0-9a-zA-Z]","",$VICIDIAL_park_on_filename); +$auto_alt_dial = ereg_replace("[^-\_0-9a-zA-Z]","",$auto_alt_dial); +$dial_status = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status); +$queuemetrics_eq_prepend = ereg_replace("[^-\_0-9a-zA-Z]","",$queuemetrics_eq_prepend); +$vicidial_agent_disable = ereg_replace("[^-\_0-9a-zA-Z]","",$vicidial_agent_disable); +$alter_custdata_override = ereg_replace("[^-\_0-9a-zA-Z]","",$alter_custdata_override); +$list_order_mix = ereg_replace("[^-\_0-9a-zA-Z]","",$list_order_mix); +$vcl_id = ereg_replace("[^-\_0-9a-zA-Z]","",$vcl_id); +$mix_method = ereg_replace("[^-\_0-9a-zA-Z]","",$mix_method); +$category = ereg_replace("[^-\_0-9a-zA-Z]","",$category); +$vsc_id = ereg_replace("[^-\_0-9a-zA-Z]","",$vsc_id); +$moh_context = ereg_replace("[^-\_0-9a-zA-Z]","",$moh_context); +$agent_alert_exten = ereg_replace("[^-\_0-9a-zA-Z]","",$agent_alert_exten); +$source_campaign_id = ereg_replace("[^-\_0-9a-zA-Z]","",$source_campaign_id); +$source_user_id = ereg_replace("[^-\_0-9a-zA-Z]","",$source_user_id); +$source_group_id = ereg_replace("[^-\_0-9a-zA-Z]","",$source_group_id); +$default_xfer_group = ereg_replace("[^-\_0-9a-zA-Z]","",$default_xfer_group); + +### ALPHA-NUMERIC and spaces +$lead_order = ereg_replace("[^ 0-9a-zA-Z]","",$lead_order); +### ALPHA-NUMERIC and hash +$group_color = ereg_replace("[^\#0-9a-zA-Z]","",$group_color); + +### ALPHA-NUMERIC and spaces dots, commas, dashes, underscores +$adaptive_dl_diff_target = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$adaptive_dl_diff_target); +$adaptive_intensity = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$adaptive_intensity); +$asterisk_version = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$asterisk_version); +$call_time_comments = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$call_time_comments); +$call_time_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$call_time_name); +$campaign_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$campaign_name); +$campaign_rec_filename = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$campaign_rec_filename); +$company = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$company); +$full_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$full_name); +$fullname = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$fullname); +$group_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$group_name); +$HKstatus = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$HKstatus); +$lead_filter_comments = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$lead_filter_comments); +$lead_filter_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$lead_filter_name); +$list_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$list_name); +$local_gmt = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$local_gmt); +$phone_type = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$phone_type); +$picture = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$picture); +$script_comments = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$script_comments); +$script_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$script_name); +$server_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$server_description); +$status = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$status); +$status_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$status_name); +$wrapup_message = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$wrapup_message); +$pause_code_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$pause_code_name); +$campaign_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$campaign_description); +$list_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$list_description); +$vcl_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$vcl_name); +$vsc_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$vsc_name); +$vsc_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$vsc_description); + +### ALPHA-NUMERIC and underscore and dash and slash and at and dot +$call_out_number_group = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$call_out_number_group); +$client_browser = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$client_browser); +$DBX_server = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$DBX_server); +$DBY_server = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$DBY_server); +$dtmf_send_extension = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$dtmf_send_extension); +$extension = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$extension); +$install_directory = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$install_directory); +$old_extension = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$old_extension); +$telnet_host = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$telnet_host); +$queuemetrics_dbname = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$queuemetrics_dbname); +$queuemetrics_login = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$queuemetrics_login); +$queuemetrics_pass = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$queuemetrics_pass); +$after_hours_message_filename = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$after_hours_message_filename); +$welcome_message_filename = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$welcome_message_filename); +$onhold_prompt_filename = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$onhold_prompt_filename); + +### remove semi-colons ### +$lead_filter_sql = ereg_replace(";","",$lead_filter_sql); +$list_mix_container = ereg_replace(";","",$list_mix_container); + +### VARIABLES TO BE mysql_real_escape_string ### +# $web_form_address +# $queuemetrics_url +# $admin_home_url + +### VARIABLES not filtered at all ### +# $script_text + +} # end of non_latin + + +##### END VARIABLE FILTERING FOR SECURITY ##### + + +# AST GUI database administration +# admin.php +# +# CHANGELOG: +# 50315-1110 - Added Custom Campaign Statuses +# 50317-1438 - Added Fronter Display var to inbound groups +# 50322-1355 - Added custom callerID per campaign +# 50517-1356 - Added user_groups sections and user_group to vicidial_users +# 50517-1440 - Added ability to logout (must click OK with empty user/pass) +# 50602-1622 - Added lead loader pages to load new files into vicidial_list +# 50620-1351 - Added custom vdad transfer AGI extension per campaign +# 50810-1414 - modified in groups to kick out spaces and dashes +# 50908-2136 - Added Custom Campaign HotKeys +# 50914-0950 - Fixed user search by user_group +# 50926-1358 - Modified to allow for language translation +# 50926-1615 - Added WeBRooTWritablE write controls +# 51020-1008 - Added editable web address and park ext - NEW dial campaigns +# 51020-1056 - Added fields and help for campaign recording control +# 51123-1335 - Altered code to function in php globals=off +# 51208-1038 - Added user_level changes, function controls and default user phones +# 51208-1556 - Added deletion of users/lists/campaigns/in groups/remote agents +# 51213-1706 - Added add/delete/modify vicidial scripts +# 51214-1737 - Added preview of vicidial script in popup window +# 51219-1225 - Added campaign and ingroups script selector and get_call_launch field +# 51222-1055 - Added am_message_exten to campaigns to allow for AM Message button +# 51222-1125 - Fixed new vicidial_campaigns default values not being assigned bug +# 51222-1156 - Added LOG OUT ALL AGENTS ON THIS CAMPAIGN button to campaign screen +# 60204-0659 - Fixed hopper reset bug +# 60207-1413 - Added AMD send to voicemail extension and xfer-conf dtmf presets +# 60213-1100 - Added several vicidial_users permissions fields +# 60215-1319 - Added On-hold CallBacks display and links +# 60227-1226 - Fixed vicidial_inbound_groups insert bug +# 60413-1308 - Fixed list display to have 1 row/status: count and time zone tables +# - Added status name in selected dial statuses in campaign screen +# 60417-1416 - Added vicidial_lead_filters sections +# - Changed the header links to color-coded sectional with sublinks below +# - Added filter name and script name to campaign and in-group modify sections +# - Added callback and alt dial options to campaigns section +# - Added callback, alt dial and other options to users section +# 60419-1628 - Alter Callbacks display to include status and LIVE listings, reordered +# 60421-1441 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60425-2355 - Added agent options to vicidial_users, reformatted user page +# 60502-1627 - Added drop_call_seconds and safe_harbor_ fields to campaign screen +# 60503-1228 - Added drop_call_seconds and drop_ fields to inbound groups screen +# 60505-1117 - Added initial framework for new local_call_times tables and definitions +# 60506-1033 - More revisions to the local_call_time section +# 60508-1354 - Finished call_times and state_call_times sections +# - Added modify/delete options for call_times +# 60509-1311 - Functionalize campaign dialable leads calculation +# - Change state_call_times selection from call_times to only allow one per state +# - Added dialable leads count popup to campaign screen if auto-calc is disabled +# - Added test dialable leads count popup to filter screen +# 60510-1050 - Added Wrapup seconds and Wrapup message to campaigns screen +# 60608-1401 - Added allowable inbound_groups checkboxes to CLOSER campaign detail screen +# 60609-1051 - Added add-to-dnc in LISTS section +# 60613-1415 - Added lead recycling options to campaign detail screen +# 60619-1523 - Added variable filtering to eliminate SQL injection attack threat +# 60622-1216 - Fixed HotKey addition form issues and variable filtering +# 60623-1159 - Fixed Scheduled Callbacks over-filtering bug and filter_sql bug +# 60808-1147 - Changed filtering for and added instructions for consutative transfers +# 60816-1552 - Added allcalls_delay start delay for recordings in vicidial.php +# 60817-2226 - Fixed bug that would not allow lead recycling of non-selectable statuses +# 60821-1543 - Added option to Omit Phone Code while dialing in vicidial +# 60821-1625 - Added ALLFORCE recording option for campaign_recording +# 60823-1154 - Added fields for adaptive dialing +# 60824-1326 - Added adaptive_latest_target_gmt for ADAPT_TAPERED dial method +# 60825-1205 - Added adaptive_intensity for ADAPT_ dial methods +# 60828-1019 - Changed adaptive_latest_target_gmt to adaptive_latest_server_time +# 60828-1115 - Added adaptive_dl_diff_target and changed intensity dropdown +# 60927-1246 - Added astguiclient/admin.php functions under SERVERS tab +# 61002-1402 - Added fields for vicidial balance trunk controls +# 61003-1123 - Added functions for vicidial_server_trunks records +# 61109-1022 - Added Emergency VDAC Jam Clear function to Campaign Detail screen +# 61110-1502 - Add ability to select NONE in dial statuses, new list_id must not be < 100 +# 61122-1228 - Added user group campaign restrictions +# 61122-1535 - Changed script_text to unfiltered and added more variables to SCRIPTS +# 61129-1028 - Added headers to Users and Phones with clickable order-by titles +# 70108-1405 - Added ADAPT OVERRIDE to allow for forced dial_level changes in ADAPT dial methods +# - Screen width definable at top of script, merged server_stats into this script +# 70109-1638 - Added ALTPH2 and ADDR3 hotkey options for alt number dialing with HotKeys +# 70109-1716 - Added concurrent_transfers option to vicidial_campaigns +# 70115-1152 - Aded (CLOSER|BLEND|INBND|_C$|_B$|_I$) options for CLOSER-type campaigns +# 70115-1532 - Added auto_alt_dial field to campaign screen for auto-dialing of alt numbers +# 70116-1200 - Added auto_alt_dial_status functionality to campaign screen +# 70117-1235 - Added header formatting variables at top of script +# - Moved Call Times and Phones/Server functions to Admin section +# 70118-1706 - Added new user group displays and links +# 70123-1519 - Added user permission settings for all sections +# 70124-1346 - Fixed spelling errors and formatting consistency +# 70202-1120 - Added agent_pause_codes section to campaigns +# 70205-1204 - Added memo, last dialed, timestamp and stats-refresh fields to vicidial_campaigns/lists +# 70206-1323 - Added user setting for vicidial_recording_override +# 70212-1412 - Added system settings section +# 70214-1226 - Added QueueMetrics Log ID field to system settings section +# 70219-1102 - Changed campaign dial statuses to be one string allowing for high limit +# 70223-0957 - Added queuemetrics_eq_prepend for custom ENTERQUEUE prepending of a field +# 70302-1111 - Fixed small bug in dialable leads calculation +# 70314-1133 - Added insert selection on script forms +# 70319-1423 - Added Alter Customer Data and agent disable display functions +# 70319-1625 - Added option to allow agents to login to outbound campaigns with no leads in the hopper +# 70322-1455 - Added sipsak messages parameters +# 70402-1157 - Added HOME link and entry to system_settings table, added QM link on reports section +# 70516-1628 - Started reformatting campaigns to use submenus to break up options +# 70529-1653 - Added help for list mix +# 70530-1354 - Added human_answered field to statuses, added system status modification +# 70530-1714 - Added lists for all campaign subsections +# 70531-1631 - Development on List mix admin interface +# 70601-1629 - More development on List mix admin interface, formatting, and added some javascript +# 70602-1300 - More development on List mix admin interface, more javascript +# 70608-1459 - Added option to set LIVE Callbacks to INACTIVE after one month +# 70612-1451 - Added Callback INACTIVE link for after one week, sort by user/group/entrydate +# 70614-0231 - Added Status Categories, ability to Modify Statuses, moved system statuses to sub-section +# 70623-1008 - List Mix section now allows modification of list mix entries +# 70629-1721 - List Mix section adding and removing of list entries active +# 70706-1636 - List Mix section cleanup and more error-checking +# 70908-0941 - Added agc logile enable system_settings +# 71020-1934 - Added inbound groups options: on-hold music, messages, call_times +# 71022-1343 - Added inbound group ranks for users +# 71029-1710 - Added option for campaign to be inbound and/or blended with no restrictions on the campaign_id name +# - Added 5th NEW and 6th NEW to the dial order options +# 71030-2010 - Added Manual Dial List ID field to campaigns table +# 71103-2207 - Added inbound_group_rank and fewest_calls to the inbound groups call order options +# 71113-1521 - Added campaign_rank to agent options +# - Added ability to Copy a campaign's setting to a new campaign +# 71113-2225 - Added ability to copy user and in-group settings to new users and in-groups +# 71116-0942 - Added campaign_rank and fewest_calls as methods for agent call routing +# 71122-1135 - Added default transfer group for campaigns and inbound groups +# 71125-1751 - Added allowable transfer groups to campaign detail screen +# +# +# make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time + +$admin_version = '2.0.4-119'; +$build = '71125-1751'; + +$STARTtime = date("U"); +$SQLdate = date("Y-m-d H:i:s"); +$MT[0]=''; +$US='_'; + +$month_old = mktime(0, 0, 0, date("m")-1, date("d"), date("Y")); +$past_month_date = date("Y-m-d H:i:s",$month_old); +$week_old = mktime(0, 0, 0, date("m"), date("d")-7, date("Y")); +$past_week_date = date("Y-m-d H:i:s",$week_old); + +if ($force_logout) +{ + if( (strlen($PHP_AUTH_USER)>0) or (strlen($PHP_AUTH_PW)>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "Usted ahora ha salido. Gracias\n"; + exit; +} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or ($auth<1)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT * from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[3]; + $LOGuser_level =$row[4]; + $LOGuser_group =$row[5]; + $LOGdelete_users =$row[8]; + $LOGdelete_user_groups =$row[9]; + $LOGdelete_lists =$row[10]; + $LOGdelete_campaigns =$row[11]; + $LOGdelete_ingroups =$row[12]; + $LOGdelete_remote_agents =$row[13]; + $LOGload_leads =$row[14]; + $LOGcampaign_detail =$row[15]; + $LOGast_admin_access =$row[16]; + $LOGast_delete_phones =$row[17]; + $LOGdelete_scripts =$row[18]; + $LOGdelete_filters =$row[29]; + $LOGalter_agent_interface =$row[30]; + $LOGdelete_call_times =$row[32]; + $LOGmodify_call_times =$row[33]; + $LOGmodify_users =$row[34]; + $LOGmodify_campaigns =$row[35]; + $LOGmodify_lists =$row[36]; + $LOGmodify_scripts =$row[37]; + $LOGmodify_filters =$row[38]; + $LOGmodify_ingroups =$row[39]; + $LOGmodify_usergroups =$row[40]; + $LOGmodify_remoteagents =$row[41]; + $LOGmodify_servers =$row[42]; + $LOGview_reports =$row[43]; + + $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$LOGuser_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGallowed_campaigns =$row[0]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +###################################################################################################### +###################################################################################################### +####### Header settings +###################################################################################################### +###################################################################################################### + + +header ("Content-type: text/html; charset=utf-8"); +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDIAL ADMIN: "; + +if (!isset($ADD)) {$ADD=0;} + +if ($ADD=="1") {$hh='users'; echo "Añadir un Usuario";} +if ($ADD=="1A") {$hh='users'; echo "Usuario Del Copy";} +if ($ADD==11) {$hh='campaigns'; $sh='basic'; echo "Añadir una Campaña";} +if ($ADD==12) {$hh='campaigns'; $sh='basic'; echo "Campaña Del Copy";} +if ($ADD==111) {$hh='lists'; echo "Añadir una Lista";} +if ($ADD==121) {$hh='lists'; echo "Agregue DNC Nuevo";} +if ($ADD==1111) {$hh='ingroups'; echo "Añadir un Grupo-Entrantes";} +if ($ADD==1211) {$hh='ingroups'; echo "En-Grupo Del Copy";} +if ($ADD==11111) {$hh='remoteagent'; echo "Añadir Agentes Remotos";} +if ($ADD==111111) {$hh='usergroups'; echo "Añadir un Grupo De Usuarios";} +if ($ADD==1111111) {$hh='scripts'; echo "Agregue La Nueva Escritura";} +if ($ADD==11111111) {$hh='filters'; echo "Agregue El Filtro Nuevo";} +if ($ADD==111111111) {$hh='admin'; $sh='times'; echo "Agregue El Nuevo Tiempo De la Llamada";} +if ($ADD==1111111111) {$hh='admin'; $sh='times'; echo "Agregue El Nuevo Tiempo De la Llamada Del Estado";} +if ($ADD==11111111111) {$hh='admin'; $sh='phones'; echo "NUEVO TELÉFONO";} +if ($ADD==111111111111) {$hh='admin'; $sh='server'; echo "NUEVO SERVIDOR";} +if ($ADD==1111111111111) {$hh='admin'; $sh='conference'; echo "NUEVA CONFERENCIA";} +if ($ADD==11111111111111) {$hh='admin'; $sh='conference'; echo "ADD NEW VICIDIAL CONFERENCE";} +if ($ADD=="2") {$hh='users'; echo "Nueva Adición De Usuario";} +if ($ADD=="2A") {$hh='users'; echo "Nueva Adición Copiada Del Usuario";} +if ($ADD==20) {$hh='campaigns'; $sh='basic'; echo "Nueva Adición Copiada De la Campaña";} +if ($ADD==21) {$hh='campaigns'; $sh='basic'; echo "Nueva Adición De la Campaña";} +if ($ADD==22) {$hh='campaigns'; $sh='status'; echo "Nueva Adición Del Estado De la Campaña";} +if ($ADD==23) {$hh='campaigns'; $sh='hotkey'; echo "New Campaña HotKey Addition";} +if ($ADD==25) {$hh='campaigns'; $sh='recycle'; echo "El Nuevo Plomo De la Campaña Recicla La Adición";} +if ($ADD==26) {$hh='campaigns'; $sh='autoalt'; echo "Nuevo Estado Del Dial Del Alt Del Automóvil";} +if ($ADD==27) {$hh='campaigns'; $sh='pause'; echo "Nuevo Código De la Pausa Del Agente";} +if ($ADD==28) {$hh='campaigns'; $sh='dialstat'; echo "Estado Del Dial De la Campaña Agregado";} +if ($ADD==29) {$hh='campaigns'; $sh='listmix'; echo "Mezcla De la Lista De la Campaña Agregada";} +if ($ADD==211) {$hh='lists'; echo "Nueva Adición De la Lista";} +if ($ADD==2111) {$hh='ingroups'; echo "Nueva Adición Del Grupo de Entrantes";} +if ($ADD==2011) {$hh='ingroups'; echo "Nueva Adicin Copiada Del En-Grupo";} +if ($ADD==21111) {$hh='remoteagent'; echo "Nueva Adición de Agentes Remotos";} +if ($ADD==211111) {$hh='usergroups'; echo "Nueva Adición Del Grupo De Usuarios";} +if ($ADD==2111111) {$hh='scripts'; echo "Nueva Adición De la Escritura";} +if ($ADD==21111111) {$hh='filters'; echo "Nueva Adición Del Filtro";} +if ($ADD==211111111) {$hh='admin'; $sh='times'; echo "Nueva Adición Del Tiempo De la Llamada";} +if ($ADD==2111111111) {$hh='admin'; $sh='times'; echo "Nueva Adición Del Tiempo De la Llamada Del Estado";} +if ($ADD==21111111111) {$hh='admin'; $sh='phones'; echo "CREANDO TELÉFONO";} +if ($ADD==211111111111) {$hh='admin'; $sh='server'; echo "CREANDO SERVIDOR";} +if ($ADD==221111111111) {$hh='admin'; $sh='server'; echo "ADICIÓN DEL NUEVO EXPEDIENTE DEL TRONCO DEL SERVIDOR VICIDIAL";} +if ($ADD==2111111111111) {$hh='admin'; $sh='conference'; echo "CREANDO CONFERENCIA";} +if ($ADD==21111111111111) {$hh='admin'; $sh='conference'; echo "ADDING NEW VICIDIAL CONFERENCE";} +if ($ADD==221111111111111) {$hh='admin'; $sh='status'; echo "ADICIÓN DE ESTADOS DE SISTEMA DE VICIDIAL";} +if ($ADD==231111111111111) {$hh='admin'; $sh='status'; echo "ADICIÓN DE CATEGORÃA DEL ESTADO DE VICIDIAL";} +if ($ADD==3) {$hh='users'; echo "Modificar Usuario";} +if ($ADD==30) {$hh='campaigns'; echo "Campaña No permitida";} +if ($ADD==31) + { + $hh='campaigns'; $sh='detail'; echo "Modifcar Campaña - Detail - $campaign_id"; + if ($SUB==22) {echo " - Statuses";} + if ($SUB==23) {echo " - HotKeys";} + if ($SUB==25) {echo " -El Plomo ReciclaEntries";} + if ($SUB==26) {echo " - Auto Alt Dial Statuses";} + if ($SUB==27) {echo " - Agent Pause Codes";} + if ($SUB==29) {echo " - List Mixes";} + } +if ($ADD==32) {$hh='campaigns'; $sh='status'; echo "Estados De la Campaña";} +if ($ADD==33) {$hh='campaigns'; $sh='hotkey'; echo "Campaña HotKeys";} +if ($ADD==34) {$hh='campaigns'; $sh='basic'; echo "Modificar Campaña - Vista Básica";} +if ($ADD==35) {$hh='campaigns'; $sh='recycle'; echo "El Plomo De la Campaña Recicla Entradas";} +if ($ADD==36) {$hh='campaigns'; $sh='autoalt'; echo "Estados Auto Del Dial Del Alt De la Campaña";} +if ($ADD==37) {$hh='campaigns'; $sh='pause'; echo "Códigos De la Pausa Del Agente De la Campaña";} +if ($ADD==38) {$hh='campaigns'; $sh='dialstat'; echo "Estados Del Dial De la Campaña";} +if ($ADD==39) {$hh='campaigns'; $sh='listmix'; echo "Mezclas De la Lista De la Campaña";} +if ($ADD==311) {$hh='lists'; echo "Modificar Lista";} +if ($ADD==3111) {$hh='ingroups'; echo "Modificar In-Group";} +if ($ADD==31111) {$hh='remoteagent'; echo "Modificar Agentes Remotos";} +if ($ADD==311111) {$hh='usergroups'; echo "Modificar Grupos De Usuarios";} +if ($ADD==3111111) {$hh='scripts'; echo "Modifique La Escritura";} +if ($ADD==31111111) {$hh='filters'; echo "Modifique El Filtro";} +if ($ADD==311111111) {$hh='admin'; $sh='times'; echo "Modifique El Tiempo De la Llamada";} +if ($ADD==321111111) {$hh='admin'; $sh='times'; echo "Modifique La Lista De las Definiciones Del Estado Del Tiempo De laLlamada";} +if ($ADD==3111111111) {$hh='admin'; $sh='times'; echo "Modifique El Tiempo De la Llamada Del Estado";} +if ($ADD==31111111111) {$hh='admin'; $sh='phones'; echo "MODIFICAR EL TELÉFONO";} +if ($ADD==311111111111) {$hh='admin'; $sh='server'; echo "MODIFICAR EL SERVIDOR";} +if ($ADD==3111111111111) {$hh='admin'; $sh='conference'; echo "MODIFICAR LA CONFERENCIA";} +if ($ADD==31111111111111) {$hh='admin'; $sh='conference'; echo "MODIFY VICIDIAL CONFERENCE";} +if ($ADD==311111111111111) {$hh='admin'; $sh='settings'; echo "MODIFIQUE LOS AJUSTES DEL SISTEMA DE VICIDIAL";} +if ($ADD==321111111111111) {$hh='admin'; $sh='status'; echo "MODIFIQUE LOS ESTADOS DE SISTEMA DE VICIDIAL";} +if ($ADD==331111111111111) {$hh='admin'; $sh='status'; echo "MODIFIQUE LA CATEGORÃA DEL ESTADO DE VICIDIAL";} +if ($ADD=="4A") {$hh='users'; echo "Modificar Usuario - Admin";} +if ($ADD=="4B") {$hh='users'; echo "Modificar Usuario - Admin";} +if ($ADD==4) {$hh='users'; echo "Modificar Usuario";} +if ($ADD==41) {$hh='campaigns'; $sh='detail'; echo "Modifcar Campaña";} +if ($ADD==42) {$hh='campaigns'; $sh='status'; echo "Modifcar Campaña Status";} +if ($ADD==43) {$hh='campaigns'; $sh='hotkey'; echo "Modifcar Campaña HotKey";} +if ($ADD==44) {$hh='campaigns'; $sh='basic'; echo "Modificar Campaña - Vista Básica";} +if ($ADD==45) {$hh='campaigns'; $sh='recycle'; echo "Modifique El Plomo De la Campaña Reciclan";} +if ($ADD==47) {$hh='campaigns'; $sh='pause'; echo "Modifique El Código De la Pausa Del Agente";} +if ($ADD==49) {$hh='campaigns'; $sh='listmix'; echo "Modifique La Mezcla De la Lista De la Campaña";} +if ($ADD==411) {$hh='lists'; echo "Modificar Lista";} +if ($ADD==4111) {$hh='ingroups'; echo "Modificar In-Group";} +if ($ADD==41111) {$hh='remoteagent'; echo "Modificar Agentes Remotos";} +if ($ADD==411111) {$hh='usergroups'; echo "Modificar Grupos De Usuarios";} +if ($ADD==4111111) {$hh='scripts'; echo "Modifique La Escritura";} +if ($ADD==41111111) {$hh='filters'; echo "Modifique El Filtro";} +if ($ADD==411111111) {$hh='admin'; $sh='times'; echo "Modifique El Tiempo De la Llamada";} +if ($ADD==4111111111) {$hh='admin'; $sh='times'; echo "Modifique El Tiempo De la Llamada Del Estado";} +if ($ADD==41111111111) {$hh='admin'; $sh='phones'; echo "MODIFICAR EL TELÉFONO";} +if ($ADD==411111111111) {$hh='admin'; $sh='server'; echo "MODIFICAR EL SERVIDOR";} +if ($ADD==421111111111) {$hh='admin'; $sh='server'; echo "MODIFIQUE EL EXPEDIENTE DEL TRONCO DEL SERVIDOR VICIDIAL";} +if ($ADD==4111111111111) {$hh='admin'; $sh='conference'; echo "MODIFICAR LA CONFERENCIA";} +if ($ADD==41111111111111) {$hh='admin'; $sh='conference'; echo "MODIFY VICIDIAL CONFERENCE";} +if ($ADD==411111111111111) {$hh='admin'; $sh='settings'; echo "MODIFIQUE LOS AJUSTES DEL SISTEMA DE VICIDIAL";} +if ($ADD==421111111111111) {$hh='admin'; $sh='status'; echo "MODIFIQUE LOS ESTADOS DE SISTEMA DE VICIDIAL";} +if ($ADD==431111111111111) {$hh='admin'; $sh='status'; echo "MODIFIQUE LAS CATEGORÃAS DEL ESTADO DE VICIDIAL";} +if ($ADD==5) {$hh='users'; echo "Delete User";} +if ($ADD==51) {$hh='campaigns'; $sh='detail'; echo "Delete Campaña";} +if ($ADD==52) {$hh='campaigns'; $sh='detail'; echo "Agentes Del Registro de estado de la máquina";} +if ($ADD==53) {$hh='campaigns'; $sh='detail'; echo "Claro Del Atasco De la Emergencia VDAC";} +if ($ADD==511) {$hh='lists'; echo "Delete List";} +if ($ADD==5111) {$hh='ingroups'; echo "Delete In-Group";} +if ($ADD==51111) {$hh='remoteagent'; echo "Suprima los agentes alejados";} +if ($ADD==511111) {$hh='usergroups'; echo "Usuarios de la cancelación Group";} +if ($ADD==5111111) {$hh='scripts'; echo "Escritura De la Cancelación";} +if ($ADD==51111111) {$hh='filters'; echo "Filtro De la Cancelación";} +if ($ADD==511111111) {$hh='admin'; $sh='times'; echo "Delete Call Time";} +if ($ADD==5111111111) {$hh='admin'; $sh='times'; echo "Tiempo De la Llamada Del Estado De la Cancelación";} +if ($ADD==51111111111) {$hh='admin'; $sh='phones'; echo "DELETE PHONE";} +if ($ADD==511111111111) {$hh='admin'; $sh='server'; echo "DELETE SERVER";} +if ($ADD==5111111111111) {$hh='admin'; $sh='conference'; echo "DELETE CONFERENCE";} +if ($ADD==51111111111111) {$hh='admin'; $sh='conference'; echo "DELETE VICIDIAL CONFERENCE";} +if ($ADD==6) {$hh='users'; echo "Delete User";} +if ($ADD==61) {$hh='campaigns'; $sh='detail'; echo "Delete Campaña";} +if ($ADD==62) {$hh='campaigns'; $sh='detail'; echo "Agentes Del Registro de estado de la máquina";} +if ($ADD==63) {$hh='campaigns'; $sh='detail'; echo "Claro Del Atasco De la Emergencia VDAC";} +if ($ADD==65) {$hh='campaigns'; $sh='recycle'; echo "El Plomo De la Cancelación Recicla";} +if ($ADD==66) {$hh='campaigns'; $sh='autoalt'; echo "Estado Auto Del Dial Del Alt De la Cancelación";} +if ($ADD==67) {$hh='campaigns'; $sh='pause'; echo "Código De la Pausa Del Agente De la Cancelación";} +if ($ADD==68) {$hh='campaigns'; $sh='dialstat'; echo "El Estado Del Dial De la Campaña Quitó";} +if ($ADD==69) {$hh='campaigns'; $sh='listmix'; echo "La Mezcla De la Lista De la Campaña Quitó";} +if ($ADD==611) {$hh='lists'; echo "Delete List";} +if ($ADD==6111) {$hh='ingroups'; echo "Delete In-Group";} +if ($ADD==61111) {$hh='remoteagent'; echo "Suprima los agentes alejados";} +if ($ADD==611111) {$hh='usergroups'; echo "Usuarios de la cancelación Group";} +if ($ADD==6111111) {$hh='scripts'; echo "Escritura De la Cancelación";} +if ($ADD==61111111) {$hh='filters'; echo "Filtro De la Cancelación";} +if ($ADD==611111111) {$hh='admin'; $sh='times'; echo "Delete Call Time";} +if ($ADD==6111111111) {$hh='admin'; $sh='times'; echo "Tiempo De la Llamada Del Estado De la Cancelación";} +if ($ADD==61111111111) {$hh='admin'; $sh='phones'; echo "DELETE PHONE";} +if ($ADD==611111111111) {$hh='admin'; $sh='server'; echo "DELETE SERVER";} +if ($ADD==621111111111) {$hh='admin'; $sh='server'; echo "EXPEDIENTE DEL TRONCO DEL SERVIDOR VICIDIAL DE LA CANCELACIÓN";} +if ($ADD==6111111111111) {$hh='admin'; $sh='conference'; echo "DELETE CONFERENCE";} +if ($ADD==61111111111111) {$hh='admin'; $sh='conference'; echo "DELETE VICIDIAL CONFERENCE";} +if ($ADD==73) {$hh='campaigns'; echo "Cuenta Del Plomo De Dialable";} +if ($ADD==7111111) {$hh='scripts'; echo "Escritura De la Inspección previo";} +if ($ADD==0) {$hh='users'; echo "Lista De Usuarios";} +if ($ADD==8) {$hh='users'; echo "Servicios repetidos Dentro Del Agente";} +if ($ADD==81) {$hh='campaigns'; $sh='list'; echo "Servicios repetidos Dentro De la Campaña";} +if ($ADD==811) {$hh='lists'; echo "Servicios repetidos Dentro De la Lista";} +if ($ADD==8111) {$hh='usergroups'; echo "Servicios repetidos Dentro Del Grupo De Usuario";} +if ($ADD==10) {$hh='campaigns'; $sh='list'; echo "Campañas";} +if ($ADD==100) {$hh='lists'; echo "Listas";} +if ($ADD==1000) {$hh='ingroups'; echo "In-Groups";} +if ($ADD==10000) {$hh='remoteagent'; echo "Agentes Remotos";} +if ($ADD==100000) {$hh='usergroups'; echo "Grupos De Usuario";} +if ($ADD==1000000) {$hh='scripts'; echo "Escrituras";} +if ($ADD==10000000) {$hh='filters'; echo "Filtros";} +if ($ADD==100000000) {$hh='admin'; $sh='times'; echo "Tiempos De la Llamada";} +if ($ADD==1000000000) {$hh='admin'; $sh='times'; echo "Tiempos De la Llamada Del Estado";} +if ($ADD==10000000000) {$hh='admin'; $sh='phones'; echo "LISTA DE TELÉFONOS";} +if ($ADD==100000000000) {$hh='admin'; $sh='server'; echo "LISTA DE SERVIDORES";} +if ($ADD==1000000000000) {$hh='admin'; $sh='conference'; echo "LISTA DE CONFERENCIAS";} +if ($ADD==10000000000000) {$hh='admin'; $sh='conference'; echo "VICIDIAL LISTA DE CONFERENCIAS";} +if ($ADD==550) {$hh='users'; echo "Formulario De Búsqueda";} +if ($ADD==551) {$hh='users'; echo "BUSCAR TELÉFONOS";} +if ($ADD==660) {$hh='users'; echo "RESULTADOS DE LA BÚSQUEDA";} +if ($ADD==661) {$hh='users'; echo "RESULTADO DE LA BÚSQUEDA DE TELÉFONOS";} +if ($ADD==99999) {$hh='users'; echo "AYUDA";} +if ($ADD==999999) {$hh='reports'; echo "INFORMES";} + +if ( ($ADD>9) && ($ADD < 99998) ) + { + ##### get scripts listing for dynamic pulldown + $stmt="SELECT script_id,script_name from vicidial_scripts order by script_id"; + $rslt=mysql_query($stmt, $link); + $scripts_to_print = mysql_num_rows($rslt); + $scripts_list="<option value=\"\">NONE</option>\n"; + + $o=0; + while ($scripts_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $scripts_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $scriptname_list["$rowx[0]"] = "$rowx[1]"; + $o++; + } + + ##### get filters listing for dynamic pulldown + $stmt="SELECT lead_filter_id,lead_filter_name,lead_filter_sql from vicidial_lead_filters order by lead_filter_id"; + $rslt=mysql_query($stmt, $link); + $filters_to_print = mysql_num_rows($rslt); + $filters_list="<option value=\"\">NONE</option>\n"; + + $o=0; + while ($filters_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $filters_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $filtername_list["$rowx[0]"] = "$rowx[1]"; + $filtersql_list["$rowx[0]"] = "$rowx[2]"; + $o++; + } + + ##### get call_times listing for dynamic pulldown + $stmt="SELECT call_time_id,call_time_name from vicidial_call_times order by call_time_id"; + $rslt=mysql_query($stmt, $link); + $times_to_print = mysql_num_rows($rslt); + + $o=0; + while ($times_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $call_times_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $call_timename_list["$rowx[0]"] = "$rowx[1]"; + $o++; + } + } + +if ( ( (strlen($ADD)>4) && ($ADD < 99998) ) or ($ADD==3) or (($ADD>20) and ($ADD<70)) or ($ADD=="4A") or ($ADD=="4B") or (strlen($ADD)==12) ) + { + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rslt=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rslt); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $servers_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $o++; + } + + ##### BEGIN get campaigns listing for rankings ##### + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + $campaigns_list=''; + $campaigns_value=''; + $RANKcampaigns_list="<tr><td>CAMPAIGN</td><td>     RANK</td><td>     CALLS</td></tr>\n"; + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $campaigns_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $campaign_id_values[$o] = $rowx[0]; + $campaign_name_values[$o] = $rowx[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + $stmt="SELECT campaign_rank,calls_today from vicidial_campaign_agents where user='$user' and campaign_id='$campaign_id_values[$o]'"; + $rslt=mysql_query($stmt, $link); + $ranks_to_print = mysql_num_rows($rslt); + if ($ranks_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $SELECT_campaign_rank = $row[0]; + $calls_today = $row[1]; + } + else + {$calls_today=0; $SELECT_campaign_rank=0;} + if ( ($ADD=="4A") or ($ADD=="4B") ) + { + if (isset($_GET["RANK_$campaign_id_values[$o]"])) {$campaign_rank=$_GET["RANK_$campaign_id_values[$o]"];} + elseif (isset($_POST["RANK_$campaign_id_values[$o]"])) {$campaign_rank=$_POST["RANK_$campaign_id_values[$o]"];} + + if ($ranks_to_print > 0) + { + $stmt="UPDATE vicidial_campaign_agents set campaign_rank='$campaign_rank', campaign_weight='$campaign_rank' where campaign_id='$campaign_id_values[$o]' and user='$user';"; + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="INSERT INTO vicidial_campaign_agents set campaign_rank='$campaign_rank', campaign_weight='$campaign_rank', campaign_id='$campaign_id_values[$o]', user='$user';"; + $rslt=mysql_query($stmt, $link); + } + + $stmt="UPDATE vicidial_live_agents set campaign_weight='$campaign_rank' where campaign_id='$campaign_id_values[$o]' and user='$user';"; + $rslt=mysql_query($stmt, $link); + } + else {$campaign_rank = $SELECT_campaign_rank;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + # disable non user-group allowable campaign ranks + $stmt="SELECT user_group from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Ruser_group = $row[0]; + + $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$Ruser_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $allowed_campaigns = $row[0]; + $allowed_campaigns = preg_replace("/ -$/","",$allowed_campaigns); + $UGcampaigns = explode(" ", $allowed_campaigns); + + $p=0; $RANK_camp_active=0; $CR_disabled = ''; + if (eregi('-ALL-CAMPAIGNS-',$allowed_campaigns)) + {$RANK_camp_active++;} + else + { + $UGcampaign_ct = count($UGcampaigns); + while ($p < $UGcampaign_ct) + { + if ($campaign_id_values[$o] == $UGcampaigns[$p]) + {$RANK_camp_active++;} + $p++; + } + } + if ($RANK_camp_active < 1) {$CR_disabled = 'DISABLED';} + + $RANKcampaigns_list .= "<tr $bgcolor><td>"; + $campaigns_list .= "<a href=\"$PHP_SELF?ADD=31&campaign_id=$campaign_id_values[$o]\">$campaign_id_values[$o]</a> - $campaign_name_values[$o] <BR>\n"; + $RANKcampaigns_list .= "<a href=\"$PHP_SELF?ADD=31&campaign_id=$campaign_id_values[$o]\">$campaign_id_values[$o]</a> - $campaign_name_values[$o] </td>"; + $RANKcampaigns_list .= "<td>     <select size=1 name=RANK_$campaign_id_values[$o] $CR_disabled>\n"; + $h="9"; + while ($h>=-9) + { + $RANKcampaigns_list .= "<option value=\"$h\""; + if ($h==$campaign_rank) + {$RANKcampaigns_list .= " SELECTED";} + $RANKcampaigns_list .= ">$h</option>"; + $h--; + } + $RANKcampaigns_list .= "</select></td>\n"; + $RANKcampaigns_list .= "<td align=right>     $calls_today</td></tr>\n"; + $o++; + } + ##### END get campaigns listing for rankings ##### + + + ##### BEGIN get inbound groups listing for checkboxes ##### + $xfer_groupsSQL=''; + if ( (($ADD>20) and ($ADD<70)) and ($ADD!=41) ) + { + $stmt="SELECT closer_campaigns,xfer_groups from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + $xfer_groups = $row[1]; + $xfer_groups = preg_replace("/ -$/","",$xfer_groups); + $XFERgroups = explode(" ", $xfer_groups); + $xfer_groupsSQL = preg_replace("/^ | -$/","",$xfer_groups); + $xfer_groupsSQL = preg_replace("/ /","','",$xfer_groupsSQL); + $xfer_groupsSQL = "WHERE group_id IN('$xfer_groupsSQL')"; + } + if ($ADD==41) + { + $p=0; + $XFERgroup_ct = count($XFERgroups); + while ($p < $XFERgroup_ct) + { + $xfer_groups .= " $XFERgroups[$p]"; + $p++; + } + $xfer_groupsSQL = preg_replace("/^ | -$/","",$xfer_groups); + $xfer_groupsSQL = preg_replace("/ /","','",$xfer_groupsSQL); + $xfer_groupsSQL = "WHERE group_id IN('$xfer_groupsSQL')"; + } + + if ( (($ADD==31111) or ($ADD==31111)) and (count($groups)<1) ) + { + $stmt="SELECT closer_campaigns from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + if ($ADD==3) + { + $stmt="SELECT closer_campaigns from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + $stmt="SELECT group_id,group_name from vicidial_inbound_groups order by group_id"; + $rslt=mysql_query($stmt, $link); + $groups_to_print = mysql_num_rows($rslt); + $groups_list=''; + $groups_value=''; + $XFERgroups_list=''; + $RANKgroups_list="<tr><td>INBOUND GROUP</td><td>     RANK</td><td>     CALLS</td></tr>\n"; + + $o=0; + while ($groups_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $group_id_values[$o] = $rowx[0]; + $group_name_values[$o] = $rowx[1]; + $o++; + } + + $o=0; + while ($groups_to_print > $o) + { + $stmt="SELECT group_rank,calls_today from vicidial_inbound_group_agents where user='$user' and group_id='$group_id_values[$o]'"; + $rslt=mysql_query($stmt, $link); + $ranks_to_print = mysql_num_rows($rslt); + if ($ranks_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $SELECT_group_rank = $row[0]; + $calls_today = $row[1]; + } + else + {$calls_today=0; $SELECT_group_rank=0;} + if ( ($ADD=="4A") or ($ADD=="4B") ) + { + if (isset($_GET["RANK_$group_id_values[$o]"])) {$group_rank=$_GET["RANK_$group_id_values[$o]"];} + elseif (isset($_POST["RANK_$group_id_values[$o]"])) {$group_rank=$_POST["RANK_$group_id_values[$o]"];} + + if ($ranks_to_print > 0) + { + $stmt="UPDATE vicidial_inbound_group_agents set group_rank='$group_rank', group_weight='$group_rank' where group_id='$group_id_values[$o]' and user='$user';"; + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="INSERT INTO vicidial_inbound_group_agents set group_rank='$group_rank', group_weight='$group_rank', group_id='$group_id_values[$o]', user='$user';"; + $rslt=mysql_query($stmt, $link); + } + + $stmt="UPDATE vicidial_live_inbound_agents set group_weight='$group_rank' where group_id='$group_id_values[$o]' and user='$user';"; + $rslt=mysql_query($stmt, $link); + } + else {$group_rank = $SELECT_group_rank;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $groups_list .= "<input type=\"checkbox\" name=\"groups[]\" value=\"$group_id_values[$o]\""; + $XFERgroups_list .= "<input type=\"checkbox\" name=\"XFERgroups[]\" value=\"$group_id_values[$o]\""; + $RANKgroups_list .= "<tr $bgcolor><td><input type=\"checkbox\" name=\"groups[]\" value=\"$group_id_values[$o]\""; + $p=0; + $group_ct = count($groups); + while ($p < $group_ct) + { + if ($group_id_values[$o] == $groups[$p]) + { + $groups_list .= " CHECKED"; + $RANKgroups_list .= " CHECKED"; + $groups_value .= " $group_id_values[$o]"; + } + $p++; + } + $p=0; + $XFERgroup_ct = count($XFERgroups); + while ($p < $XFERgroup_ct) + { + if ($group_id_values[$o] == $XFERgroups[$p]) + { + $XFERgroups_list .= " CHECKED"; + $XFERgroups_value .= " $group_id_values[$o]"; + } + $p++; + } + $groups_list .= "> <a href=\"$PHP_SELF?ADD=3111&group_id=$group_id_values[$o]\">$group_id_values[$o]</a> - $group_name_values[$o] <BR>\n"; + $XFERgroups_list .= "> <a href=\"$PHP_SELF?ADD=3111&group_id=$group_id_values[$o]\">$group_id_values[$o]</a> - $group_name_values[$o] <BR>\n"; + $RANKgroups_list .= "> <a href=\"$PHP_SELF?ADD=3111&group_id=$group_id_values[$o]\">$group_id_values[$o]</a> - $group_name_values[$o] </td>"; + $RANKgroups_list .= "<td>     <select size=1 name=RANK_$group_id_values[$o]>\n"; + $h="9"; + while ($h>=-9) + { + $RANKgroups_list .= "<option value=\"$h\""; + if ($h==$group_rank) + {$RANKgroups_list .= " SELECTED";} + $RANKgroups_list .= ">$h</option>"; + $h--; + } + $RANKgroups_list .= "</select></td>\n"; + $RANKgroups_list .= "<td align=right>     $calls_today</td></tr>\n"; + $o++; + } + if (strlen($groups_value)>2) {$groups_value .= " -";} + if (strlen($XFERgroups_value)>2) {$XFERgroups_value .= " -";} + } + ##### END get inbound groups listing for checkboxes ##### + + + ##### BEGIN get campaigns listing for checkboxes ##### + if ( ($ADD==211111) or ($ADD==311111) or ($ADD==411111) or ($ADD==511111) or ($ADD==611111) ) + { + if ( ($ADD==211111) or ($ADD==311111) or ($ADD==511111) or ($ADD==611111) ) + { + $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$user_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $allowed_campaigns = $row[0]; + $allowed_campaigns = preg_replace("/ -$/","",$allowed_campaigns); + $campaigns = explode(" ", $allowed_campaigns); + } + + $campaigns_value=''; + $campaigns_list='<B><input type="checkbox" name="campaigns[]" value="-ALL-CAMPAIGNS-"'; + $p=0; + while ($p<100) + { + if (eregi('ALL-CAMPAIGNS',$campaigns[$p])) + { + $campaigns_list.=" CHECKED"; + $campaigns_value .= " -ALL-CAMPAIGNS- -"; + } + $p++; + } + $campaigns_list.="> ALL-CAMPAIGNS - LOS USUARIOS PUEDEN VISIÓN CUALQUIER CAMPAÑA</B><BR>\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $campaign_id_value = $rowx[0]; + $campaign_name_value = $rowx[1]; + $campaigns_list .= "<input type=\"checkbox\" name=\"campaigns[]\" value=\"$campaign_id_value\""; + $p=0; + while ($p<100) + { + if ($campaign_id_value == $campaigns[$p]) + { + # echo "<!-- X $p|$campaign_id_value|$campaigns[$p]| -->"; + $campaigns_list .= " CHECKED"; + $campaigns_value .= " $campaign_id_value"; + } + # echo "<!-- O $p|$campaign_id_value|$campaigns[$p]| -->"; + $p++; + } + $campaigns_list .= "> $campaign_id_value - $campaign_name_value<BR>\n"; + $o++; + } + if (strlen($campaigns_value)>2) {$campaigns_value .= " -";} + } + ##### END get campaigns listing for checkboxes ##### + + + if ( (strlen($ADD)==11) or (strlen($ADD)>12) ) + { + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rsltx=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rsltx); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $servers_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $o++; + } + } + + + +$NWB = "   <a href=\"javascript:openNewWindow('$PHP_SELF?ADD=99999"; +$NWE = "')\"><IMG SRC=\"help.gif\" WIDTH=20 HEIGHT=20 Border=0 ALT=\"AYUDA\" ALIGN=TOP></A>"; + + +###################################################################################################### +###################################################################################################### +####### 9 series, HELP screen +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=99999 display the HELP SCREENS +###################### + +if ($ADD==99999) +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "
VICIDIAL ADMIN: AYUDA


\n"; + +?> +VICIDIAL_USUARIOS TABLA

+ +
+Identificación del usuario - este campo es donde usted pone el número de la identificación del usuario de VICIDIAL, puede ser hasta 8 dígitos en longitud, debe ser por lo menos 2 caracteres en longitud. + +
+
+
+Contraseña - este campo es donde usted pone la contraseña de los usuarios de VICIDIAL. Deben ser por lo menos 2 caracteres en longitud. + +
+
+
+Nombre completo - este campo es donde usted pone el nombre completo de los usuarios de VICIDIAL. Deben ser por lo menos 2 caracteres en longitud. + +
+
+
+Nivel de usuario - este menú es donde usted selecciona el nivel de usuario de los usuarios de VICIDIAL. Debe ser un nivel de 1 a registrar en VICIDIAL, debe ser llano mayor de 2 a abrirse una sesión como más cercano, deben ser el nivel de usuario 8 o mayor conseguir en la sección de la tela del admin. + +
+
+
+Grupo de usuario - este menú es donde usted selecciona a grupo de usuarios de VICIDIAL que este usuario pertenecerá a. Esto no tiene ninguna restricciones en este tiempo, éste es justo subdividir a usuarios y permitir las características futuras basadas sobre él. + +
+
+
+Conexión del teléfono - aquí es para donde usted puede fijar un valor de la conexión del teléfono del defecto cuando los registros del usuario en vicidial.php. Este valor poblará el phone_login automáticamente cuando el usuario entra con su usuario-pasar-campaña en la pantalla de la conexión de vicidial.php. + +
+
+
+Paso del teléfono - aquí es para donde usted puede fijar un valor del paso del teléfono del defecto cuando los registros del usuario en vicidial.php. Este valor poblará los phone_pass automáticamente cuando el usuario entra con su usuario-pasar-campaña en la pantalla de la conexión de vicidial.php. + +
+
+
+Hot Keys activo - esta opción si el sistema a 1 permite que el usuario utilice la función ra'pida-dispositioning de Hot Keys adentro vicidial.php. + +
+
+
+El agente elige Ingroups - esta opción si el sistema a 1 permite que el usuario elija los ingroups de los cuales recibirán llamadas cuando ellos conexión a una campaña MÃS CERCANA o DE ENTRADA. Si no el encargado necesitará fijar esto en su pantalla del detalle del usuario de la página del admin. + +
+
+
+Servicios repetidos programar - esta opción no prohibe a agente a la disposición una llamada como CALLBK y elige los datos y el tiempo en los cuales el plomo será reactivado. + +
+
+
+Servicios repetidos del Agente-Solamente - esta opción permite que un agente fije un servicio repetido de modo que sean el único agente que puede llamar la parte posteriora del cliente. Esto también permite que el agente vea sus listados del servicio repetido y los llame detrás cualquier momento desean a. + +
+
+
+Manual de la llamada del agente - esta opción permite que un agente incorpore manualmente un nuevo plomo en el sistema y los llame. Esto también permite llamar de cualquier número de teléfono de su pantalla vicidial y pone esa llamada en su sesión. Utilice esta opción con la precaución. + +
+
+
+Grabación de Vicidial - esta opción puede evitar que un agente haga cualquier grabación después de que se abran una sesión a vicidial. Esta opción debe estar encendido para que vicidial siga la sesión de la grabación de la campaña. + +
+
+
+Vicidial transfiere - esta opción puede evitar que un agente abra la transferencia - la sesión de la conferencia de vicidial. Si esto es lisiado, el agente no puede llamada de los terceros o la transferencia oculta cualquiera llama. + +
+
+
+Un defecto más cercano mezclado - esta opción omite simplemente el checkbox mezclado en una pantalla MÃS CERCANA de la conexión. + +
+
+
+Invalidación de la grabación de VICIDIAL - esta opción seeliminará lo que es la opción en la campaña para la grabación.LISIADO no eliminará el ajuste de la grabación de la campaña. NUNCAinhabilitará la grabación en el cliente. ONDEMAND es el defecto ypermite que el agente comience y pare a registrar según lonecesitado. ALLCALLS comenzará la grabación en el cliente siempreque una llamada se envíe a un agente. ALLFORCE comenzará lagrabación en el cliente siempre que una llamada se envíe a un agenteque no da al agente ninguna opción para parar el registrar. ParaALLCALLS y ALLFORCE hay una opción para utilizar la grabaciónretrasa para reducir en grabaciones y carga de sistema muy cortas delrecude. + +
+
+
+La campaña alinea - en esta sección usted puede definir a la filaque un agente tendrá para cada campaña. Estas filas pueden serutilizadas para tener en cuenta la encaminamiento preferida de lallamada cuando la llamada siguiente del agente se fija alcampaign_rank. + +
+
+
+Grupos de entrada - aquí es donde usted selecciona a grupos de entrada que usted desea recibir llamadas de si usted ha seleccionado la campaña MÃS CERCANA. Usted también podrá fijar la fila, o el nivel de habilidad, en estasección para cada uno de los grupos de entrada así como poder ver elnúmero de las llamadas recibidas de cada grupo de entrada para esteagente específico. También en esta sección está la capacidad de dar al agente una filapara cada grupo de entrada. Estas filas pueden ser utilizadas para laencaminamiento preferida de la llamada cuando esa opción seselecciona en la pantalla del en-grupo. + +
+
+
+El agente altera la invalidación de los datos del cliente - estaopción se eliminará lo que es la opción en la campaña paraalterarse de los datos del cliente. NOT_ACTIVE utilizará lo que estápresente el ajuste para la campaña. ALLOW_ALTER permitirá siemprepara que el agente altere los datos del cliente, no importa qué es elajuste de la campaña. El defecto es NOT_ACTIVE. + +
+
+
+Altere las opciones de interfaz del agente - esta opción si el sistema a 1 permite que el usuario administrativo modifique las opciones de interfaz de los agentes en admin.php. + +
+
+
+Usuarios de la cancelación - esta opción si el sistema a 1 permite que el usuario suprima a otros usuarios del igual o de poco nivel de usuario del sistema. + +
+
+
+Suprima a grupos de usuario - esta opción si el sistema a 1 permite que el usuario suprima a grupos de usuario del sistema. + +
+
+
+La cancelación enumera - esta opción si el sistema a 1 permite que el usuario suprima listas vicidial del sistema. + +
+
+
+La cancelación hace campaña - esta opción si el sistema a 1 permite que el usuario suprima campañas vicidial del sistema. + +
+
+
+En-Grupos de la cancelación - esta opción si el sistema a 1 permite que el usuario suprima a En-Grupos vicidial del sistema. + +
+
+
+Suprima los agentes alejados - esta opción si el sistema a 1 permite que el usuario suprima agentes alejados vicidial del sistema. + +
+
+
+La carga conduce - esta opción si el sistema a 1 permite que el usuario cargue los plomos vicidial en la tabla del vicidial_list por el cargador basado tela del plomo. + +
+
+
+Detalle de la campaña - esta opción si el sistema a 1 permite que el usuario visión y modifique los elementos de la pantalla del detalle de la campaña. + +
+
+
+Acceso de AGC Admin - esta opción si el sistema a 1 permite a usuario a la conexión a las páginas astGUIclient del admin. + +
+
+
+La cancelación de AGC telefona - esta opción si el sistema a 1 permite que el usuario suprima entradas del teléfono en las páginas astGUIclient del admin. + +
+
+
+Escrituras de la cancelación - esta opción si el sistema a 1 permite que el usuario suprima las escrituras de la campaña en la pantalla de la modificación de la escritura. + +
+
+
+Modifique los plomos - esta opción si el sistema a 1 permite que el usuario modifique los plomos en la página de los resultados de la búsqueda del plomo de la sección del admin. + +
+
+
+Cambie la campaña del agente - esta opción si el sistema a 1 permite que el usuario altere la campaña que un agente está registrado en mientras que se registran en él. + +
+
+
+La cancelación se filtra - esta opción permite que el usuario pueda suprimir los filtros vicidial del plomo del sistema. + +
+
+
+Tiempos de la llamada de la cancelación - esta opción permite que elusuario pueda suprimir expedientes vicidial de los tiempos de lallamada y expedientes vicidial de los tiempos de la llamada del estadodel sistema. + +
+
+
+Modifique los tiempos de la llamada - esta opción permite que elusuario visión y modifique los expedientes de los tiempos de lallamada y de los tiempos de la llamada del estado. Un usuario nonecesita esta opción permitida si necesitan solamente cambiar laopción de los tiempos de la llamada en la pantalla de las campañas. + +
+
+
+Modifique las secciones - estas opciones permiten que el usuariovisión y modifique cada uno los expedientes de las secciones. Si elsistema a 0, el usuario puede considerar la lista de la sección, perono el detalle o la pantalla de la modificación de un expediente enesa sección. + +
+
+
+La visión divulga - esta opción permite que el usuario visión losinformes de VICIDIAL. + + + + +



+ +VICIDIAL_CAMPAIGNS TABLA

+
+
+Identificación de la campaña - Úste es el nombre corto de la campaña, él no es editable después de la sumisión inicial, no puede contener espacios y debe estar entre 2 y 8 caracteres en longitudh. + +
+
+
+Nombre de la campaña - Ésta es la descripción de la campaña, debe estar entre 6 y 40 caracteres en longitud. + +
+
+
+Descripción de la campaña - esto es un campo de la nota para lacampaña, es opcional y puede ser un máximo de 255 caracteres enlongitud. + +
+
+
+Fecha del cambio de la campaña - ésta es la vez última que losajustes para esta campaña fueron modificados de cualquier manera. + +
+
+
+La fecha pasada de la conexión de la campaña - ésta es la vezúltima que un agente fue registrado en esta campaña. + +
+
+
+Los Stats de la campaña restauran - este checkbox permitirá queusted fuerce un stats vicidial restaura, incluso si la campaña no esactiva. + +
+
+
+Activo - aquí es adonde usted fija la campaña a activo o a inactivo. Si es inactivo, noone puede registrar en él. + +
+
+
+Extensión del parque - aquí es donde usted puede modificar para requisitos particulares en-sostiene la música para VICIDIAL. Cerciórese de que la extensión esté en lugar en el extensions.conf y eso que señala al nombre de fichero abajo. + +
+
+
+Nombre del archivo del parque - aquí es donde usted puede modificar para requisitos particulares en-sostiene la música para VICIDIAL. Cerciórese de que el nombre de fichero sea 10 caracteres en longitud o menos y que el archivo está en lugar en el directorio de /var/lib/asterisk/sounds. + +
+
+
+Forma del Web - aquí es donde usted puede fijar el Web page de encargo que será abierto cuando el usuario chasca encendido el botón de la FORMA del WEB. + +
+
+
+Permita Closers - aquí es donde usted puede fijar si los usuarios de esta campaña tendrán la opción para enviar la llamada a un más cercano. + +
+
+
+Grupo de la transferencia del defecto - este campo es el En-Grupo deldefecto que será seleccionado automáticamente cuando el agente va almarco de la transferir-conferencia en su interfaz del agente. + +
+
+
+Grupos permitidos de la transferencia - con estos listados delcheckbox usted puede seleccionar a los grupos a quienes los agentes enesta campaña pueden transferir llamadas. Permita Closers debe serpermitido para que esta opción demuestre para arriba. + +
+
+
+Permita de entrada y mezclado - aquí es donde usted puede fijar silos usuarios de esta campaña tendrán la opción para tomar llamadasde entrada con esta campaña. Si usted desea hacer de entrada y desalida mezclada entonces esto se debe fijar a Y. Si usted deseasolamente hacer marcar de salida en esta campaña fijó esto a N.Default es N. + +
+
+
+Estado del dial - aquí es adonde usted fija los estados que usted está deseando marcar encendido dentro de las listas que son activas para la campaña abajo. Para agregar otro estado al dial, selecciónelo de la lista drop-downy el tecleo AGREGA. Para quitar uno de los estados del dial, chasqueencendido el acoplamiento del QUITAR al lado del estado que usteddesea quitar. + +
+
+
+Orden de la lista - Este menú es donde usted selecciona cómo los plomos que emparejan los estados seleccionados arriba serán puestos en la tolva del plomo: +
  - DOWN: seleccione los primeros plomos cargados en la tabla del vicidial_list +
  - UP: seleccione los plomos pasados cargados en la tabla del vicidial_list +
  - UP PHONE: seleccione el número y los trabajos más altos de teléfono su manera abajo +
  - DOWN PHONE: seleccione el número y los trabajos más bajos de teléfono su manera para arriba +
  - UP LAST NAME: comienzo con los nombres pasados comenzando con Z y trabajos su manera abajo +
  - DOWN LAST NAME: comienzo con los nombres pasados comenzando con A y trabajos su manera para arriba +
  - UP COUNT: comienzo con los plomos y los trabajos llamados su manera abajo +
  - DOWN COUNT: comienzo con menos plomos y trabajos llamados su manera para arriba +
  - DOWN COUNT 2nd NEW: comienzo con menos plomos y trabajos llamados su manera para arriba que inserta un NEW plomo en cada otro lead(Must para no tener NEW seleccionado en los estados del dial) +
  - DOWN COUNT 3nd NEW: comienzo con menos plomos y trabajos llamados su manera para arriba que inserta un NEW plomo en cada tercer lead(Must para no tener NEW seleccionado en los estados del dial) +
  - DOWN COUNT 4th NEW: comienzo con menos plomos y trabajos llamados que su manera para arriba que inserta un NEW plomo en cada adelante conduzca (no debe tener NEW seleccionado en los estados del dial) + +
+
+
+Tolva llana - éste es cuántos conducen los intentos de la escritura de VDhopper para mantener la tabla del vicidial_hopper para esta campaña. Si funciona la escritura de VDhopper cada minuto, haga esto levemente mayor que el número de plomos que usted entra a través en un minuto. + +
+
+
+Filtro del plomo - éste es un método de filtrar sus plomos usando un fragmento de una pregunta del SQL. Utilice esta característica con la precaución, él es fácil de parar el marcar accidentalmente con la alteración más leve a la declaración del SQL. El defecto no es NINGUNO. + +
+
+
+Reajuste de la fuerza de la tolva - esto permite que usted limpie fuera del contenido de la tolva sobre la sumisión de la forma. Debe ser llenada otra vez cuando la escritura de VDhopper funciona. + +
+
+
+Método del dial - Este campo es la manera de definir cómo el marcar debe ocurrir. Si el MANUAL entonces el auto_dial_level es bloqueado en 0 a menos que se cambie el método del dial. Si COCIENTE entonces el normal marcando un número de líneas para los agentes activos. ADAPT_HARD_LIMIT marcará predictively hasta el porcentaje caído y después no permitirá marcar agresivo una vez que se alcance el límite de la gota hasta que va el porcentaje abajo otra vez. ADAPT_TAPERED permite para el excedente de funcionamiento el porcentaje caído por la mitad primer de la cambio - según lo definido por el call_time seleccionado para la campaña y consigue más terminante mientras que se enciende la cambio. ADAPT_AVERAGE intenta mantener un promedio o el porcentaje caído que no impone límites duros tan agresivamente como los otros dos métodos. Usted no puede cambiar el nivel auto del dial si usted está en cualesquiera de los métodos del dial del ADAPTAR. Solamente el sintonizador puede cambiar el nivel del dial cuando en modo que marca profético. + +
+
+
+Nivel auto del dial - aquí es adonde usted fija cuántos alinea VICIDIAL debe utilizar por medios del agente activo cero 0 que el marcar del automóvil está apagado y los agentes chascarán para marcar cada número. Si no VICIDIAL mantendrá líneas que marcan iguales a los agentes activos multiplicados por el nivel del dial para llegar cuántas líneas debe permitir esta campaña en cada servidor. El checkbox de la INVALIDACIÓN del ADAPTAR permite que usted fuerceun nuevo nivel del dial aunque el método del dial está en un mododel ADAPTAR. Esto es útil si hay una cambio dramática en la calidadde plomos y usted desea cambiar drástico el dial_level manualmente. + +
+
+
+Solamente cuenta disponible - este campo si el sistema a Y deja haciafuera los agentes del estado de INCALL y de la COLETA al calcular elnúmero de llamadas al dial cuando no en modo de dial MANUAL. Eldefecto es N. + +
+
+
+Límite del porcentaje de la gota - este campo es donde usted fijó ellímite del porcentaje de llamadas caídas que usted quisiera mientrasque usaba un método adaptante-profe'tico del dial, NO MANUAL o delCOCIENTE. + +
+
+
+El máximo adapta el dial llano - este campo es donde usted fijó ellímite del límite al numbr de líneas que usted quisiera marcado poragente mientras que usaba un método adaptante-profe'tico del dial, NOMANUAL o del COCIENTE. Este número puede ser más alto que el nivelauto del dial si su hardware lo apoya. El valor debe ser un númeropositivo mayor de uno y puede tener defecto 3.0 de los lugaresdecimales. + +
+
+
+El tiempo más último del servidor - este campo es utilizadosolamente por el método del dial de ADAPT_TAPERED. Usted debe entraren la hora y el minuto que usted parará el invitar de esta campaña,2100 significaría que usted parará el marcar de esta campaña en eltiempo del servidor de los 9PM. Esto permite que el algoritmo afiladodecida a cómo agresivamente al dial cerca cuánto tiempo usted tienehasta que usted será el llamar acabado. + +
+
+
+Adapte el modificante de la intensidad - este campo se utiliza paraajustar la intensidad profética más alta o más baja. El más altoun número positivo que usted selecciona, mayor va el sintonizadoraumentará la llamada que establece el paso cuando para arriba y máslentamente va el sintonizador disminuirá la llamada que establece elpaso cuando abajo. Cuanto más bajo es el número negativo que ustedseleccionan aquí, más lentamente el sintonizador aumentará lallamada que establece el paso y más rápidamente el sintonizadorbajará la llamada que establece el paso cuando va abajo. El defectoes 0. Este campo no es utilizado por los métodos del dial del MANUALo del COCIENTE. + +
+
+
+Blanco llana de la diferencia del dial - este campo se utiliza paradefinir si usted desea apuntar tener un número específico de losagentes que esperan agentes de las llamadas o el esperar de llamadas.Por ejemplo si usted siempre quisiera tener en agente del promedio unolibre tomar llamadas inmediatamente usted fijaría esto a -1, si ustedquisiera apuntar siempre tener uno invita el asimiento que espera unagente que usted fijaría esto a 1. El defecto es 0. Este campo no esutilizado por los métodos del dial del MANUAL o del COCIENTE. + +
+
+
+Transferencias concurrentes - este ajuste se utiliza para definir elnúmero de las llamadas que se pueden enviar a los agentes en el mismotiempo. Se recomienda que este ajuste está dejado en el AUTOMÓVIL. Este campo no es utilizado por el método MANUAL del dial. + +
+
+
+Alt-Nu'mero auto que marca - este ajuste se utiliza para marcarautomáticamente campos alternos del número mientras que marca en elCOCIENTE y ADAPTA métodos del dial cuando no hay contacto en elnúmero de teléfono principal para un plomo, los estados del NA, deB, de la C.C. y de N. Este ajuste no es utilizado por el métodoMANUAL del dial. + +
+
+
+Llamada siguiente del agente - esto se determina qué agente recibe la llamada siguiente que está disponible: +
  - random: órdenes por el valor al azar de la actualización en la tabla de los vicidial_live_agents +
  - oldest_call_start: las órdenes por la vez última un agente fueron enviadas una llamada. Resultados en los agentes que reciben el número casi igual de llamadas cabalmente. +
  - oldest_call_finish: las órdenes por la vez última un agente acabaron una llamada. El agente de AKA que espera lo más de largo posible recibe la primera llamada. +
  - overall_user_level: las órdenes por el user_level del agente según lo definido en los vicidial_users tabulan un user_level más alto recibirán más llamadas. +
  - campaign_rank: órdenes de la fila dada al agente para la campaña. Lomás arriba posible a lo más bajo posible. +
  - fewest_calls: órdenes por el número de las llamadas recibidas por unagente para ese grupo de entrada específico. Menos llamadas primero. + +
+
+
+Tiempo de la llamada local - aquí es adonde usted fijó durante qué horas usted quisiera marcar, según lo determinado por el tiempo local en está en cuál usted está llamando. Esto es controlada por código de área y ajustada por tiempo de los ahorros de la luz del día si es aplicable. Las pautas generales en los E.E.U.U. para el negocio al negocio son los 9am a los 5pm y el negocio a las llamadas del consumidor es los 9am a los 9pm. + +
+
+
+Descanso del dial - si está definido, llamadas que normalmente retraso después de que el descanso definido en extensions.conf en lugar de otro descanso en esta cantidad de segundos si es menos que el descanso de extensions.conf. Esto permite descansos del dial rápidamente que cambian del servidor al servidor y a limitar los efectos a una sola campaña. Si usted está teniendo muchos de llamadas del contestador automático o de Buzón de Voz usted puede desear intentar cambiar este valor entre a 21-26 y ver si los resultados mejoran. + +
+
+
+Prefijo del dial - este campo permite más fácilmente cambiar una trayectoria de marcar a salir con un diverso método sin hacer una recarga en asterisco. El defecto es 9 basados sobre un 91NXXNXXXXXX en el dial plan - extensions.conf. + +
+
+
+Omita el código del teléfono - este campo permite que usted dejehacia fuera el campo del phone_code mientras que marca dentro deVICIDIAL. Por ejemplo si usted está marcando en el Reino Unido delReino Unido usted tendría 44 adentro como su campo del phone_codepara todos los plomos, pero usted apenas desea marcar 10 dígitos ensu extensions.conf dial plan para poner llamadas en vez de 44 entonces10 dígitos. El defecto es N. + +
+
+
+Campaña CallerID - este campo permite enviar de un número de encargo del callerid en las llamadas de salida. Úste es el número que demostraría para arriba en el callerid de la persona que usted está llamando. El defecto es DESCONOCIDO. Esta opción está solamente disponible si usted está utilizando PRIs - ISDN T1 o E1 - que tienen la característica de encargo del callerid se giraron. Esta característica puede también trabajar con los troncos IAX2 dependiendo de lo que admite su abastecedor. El callerID de encargo se aplica solamente a las llamadas puestas para la campaña de VICIDIAL directamente, cualquier tercer persona llama o las transferencias no enviarán el callerID de encargo. NOTA: A veces el poner DESCONOCIDO o PRIVADO en el campo rendirá enviar de su número del callerID del defecto por su portador con las llamadas. Usted puede desear probar esto y poner 0000000000 en el campo del callerid en lugar de otro si usted no desea enviarle CallerID. + +
+
+
+Extensión de la campaña VDAD - este campo permite una extensión de la transferencia del costumbre VDAD. Esto permite que usted utilice diversas escrituras del agi de VDADtransfer... dependiendo de su campaña. La transferencia AGI(exten 8365 agi-VDADtransfer.agi del defecto) apenas envía inmediatamente invita a los agentes tan pronto como él se tome. Una encuesta sobre política AGI la muestra adicional es también (8366 agi-VDADtransferSURVEY.agi ) ese ahora incluido los juegos un mensaje a la persona llamada y permite que él haga una opción presionando buttons(effectively la pre-investigacio'n el plomo). Observe por favor eso a excepción de los exámenes, llamadas políticas y las caridades esta forma de llamar son ilegales en los Estados Unidos. + +
+
+
+Extensión de Rec de la Campaña - este campo permite para que una extensión de encargo de la grabación sea utilizada con VICIDIAL. Esto permite que usted utilice diversas extensiones dependiendo sobre cuánto tiempo usted desea permitir una grabación máxima y qué tipo de codec usted desea registrar adentro. El defecto exten es 8309 que si usted sigue los ejemplos de SCRATCH_INSTALL registrarán en el formato de WAV para hasta que una hora. Otra opción incluida en los ejemplos es 8310 que registrarán en el formato del GSM para hasta que una hora. + +
+
+
+Grabación de la campaña - este menú permite que usted elija quénivel de la grabación se permite en esta campaña. NUNCAinhabilitará la grabación en el cliente. ONDEMAND es el defecto ypermite que el agente comience y pare a registrar según lonecesitado. ALLCALLS comenzará la grabación en el cliente siempreque una llamada se envíe a un agente. ALLFORCE comenzará lagrabación en el cliente siempre que una llamada se envíe a un agenteque no da al agente ninguna opción para parar el registrar. ParaALLCALLS y ALLFORCE hay una opción para utilizar la grabaciónretrasa para reducir en grabaciones y carga de sistema muy cortas delrecude. + +
+
+
+Nombre de fichero de Rec de la campaña - este campo permite que usted modifique el nombre para requisitos particulares de la grabación cuando la grabación de la campaña es ONDEMAND o ALLCALLS. Las variables permitidas son CAMPAIGN CUSTPHONE FULLDATE TINYDATE EPOCH AGENT. El defecto es FULLDATE_AGENTE y parecería este 20051020-103108_6666. Otro ejemplo es CAMPAIGN_TINYDATE_CUSTPHONE que parecería este TESTCAMP_51020103108_3125551212. 50 char max. + +
+
+
+La registración retrasa - para la grabación de ALLCALLS y deALLFORCE solamente. Esta voluntad del ajuste retrasa comenzar de lagrabación en todas las llamadas para el número de los segundosespecificados en este campo. El defecto es 0. + +
+
+
+Escritura de la campaña - este menú permite que usted elija la escritura que aparecerá en la pantalla de los agentes para esta campaña. No seleccione NONE no demostrar ninguna escritura para esta campaña. + +
+
+
+Consiga el lanzamiento de la llamada - este menú permite que usted elija si usted desee automo'vil-lance la página en una ventana separada, auto-switch de la tela-forma a la lengüeta de la ESCRITURA o no haga nada cuando una llamada se envía al agente para esta campaña. + +
+
+
+Mensaje del contestador automático - este campo está para entrar en una extensión para cegar llamadas de la transferencia a cuando el agente consigue un contestador automático y chasca encendido el botón del mensaje del contestador automático en el marco de la conferencia de la transferencia. Usted debe fijar esto exten para arriba en el dial plan - extensions.conf - y se cerciora de que juega un archivo audio después que cuelga para arriba. + +
+
+
+AMD envían a la VM exten - este menú permite que usted defina si un mensaje esté dejado en un contestador automático cuando se detecta la llamada será remitido inmediatamente a la extensión del Contestar-Ma'quina-Mensaje si AMD es activo y se determina que la llamada es un contestador automático. + +
+
+
+Xfer-Conf DTMF - Estos cuatro campos permiten para que usted tenga dos sistemas de conferencia de la transferencia y de precolocaciones de DTMF. Cuando se carga la llamada o la campaña, la escritura de vicidial.php demostrará dos botones en el marco de la transferir-conferencia y automo'vil-poblara' el nu'mero-a-dial y los campos del enviar-dtmf cuando está presionada. Si usted desea permitir transferencias consultivas, un fronter a unmás cercano, usted puede colocar CXFER pues uno de lasprecolocaciones del nu'mero-a-dial y del dial string apropiado seráenviado para hacer una transferencia consultiva local, entonces lalata LEAVE-3WAY-CALL justo del agente y movimiento encendido a sullamada siguiente. Si usted desea permitir transferencias ocultas declientes a una escritura de VICIDIAL AGI para registrar o un IVR,entonces coloque AXFER en el campo del nu'mero-a-dial. Usted puedetambién especificar una extensión de encargo después del AXFER odel CXFER, por ejemplo si usted desea hacer transferencias consultivasinternas en vez de local que usted pondría CXFER90009 en el campo delnu'mero-a-dial. + +
+
+
+El marcar numérico del Alt del agente - esta opción permite que un agente marque manualmente el número de teléfono o el campo alterno address3 después de que se haya llamado el número principal. + +
+
+
+Servicios repetidos programar - esta opción no prohibe a agente a la disposición una llamada como CALLBK y elige los datos y el tiempo en los cuales el plomo será reactivado. + +
+
+
+Segundos de la llamada de la gota - el número de segundos a partirdel tiempo que la línea de cliente se escoge encima de hasta que lallamada se considera una GOTA, sólo se aplica a las llamadas desalida. + +
+
+
+Buzón de Voz - si estuvieron definidas, las llamadas que CAERÃAN normalmente en lugar de otro serían ordenadas a esta caja del voicemail para oír y para dejar un mensaje. + +
+
+
+seguro puerto mensaje - si fijar y juego uno mensaje clientedespués gota llamar segundo descanso ser alcanzar sin ser transferiruno agente. _ este fijar eliminar sending uno voicemail caja si esteser fijar y. + +
+
+
+seguro puerto Exten - este ser dial plan extensión que desear seguropuerto audio archivo ser localizar en en su servidor. + +
+
+
+Segundos de Wrap Up - el número de los segundos para forzar un agenteesperar antes de permitir que reciban o que marquen otra llamada. Elcontador de tiempo comienza tan pronto como un agente cuelgue paraarriba en su cliente - o en el caso del número alterno que marcacuando el agente acaba el plomo - defecto sea los segundos 0. Si elcontador de tiempo funciona hacia fuera antes de que el agente tengadispositioned la llamada, el agente todavía no se mueve encendido ala llamada siguiente hasta que seleccionan una disposición. + +
+
+
+Mensaje de Wrap up - esto es un mensaje campaña-especi'fico que seexhibirá en la pantalla del wrapup si se fijan los segundos delwrapup. + +
+
+
+Lista interna del uso DNC - esto define si esta campaña es filtrarlos plomos contra la lista interna de DNC. Si se fija a Y, la tolvabuscará cada número de teléfono en la lista de DNC antes de ponerlaen la tolva. Si está en la lista de DNC entonces que cambiará eseconduce estado a DNCL así que no puede ser marcada. El defecto es N. + +
+
+
+Grupos De entrada Permitidos - For CLOSER campaigns only. Here is where you select the inbound groups you want agents in this CLOSER campaign to be able to take calls from. It is important for BLENDED inbound-outbound campaigns only to select the inbound groups that are used for agents in this campaign. The calls coming into the inbound groups selected here will be counted as active calls for a blended campaign even if all agents in the campaign are not logged in to receive calls from all of those selected inbound groups. + +
+
+
+La pausa del agente cifra activo - permite que los agentes seleccionenun código de la pausa cuando chascan encendido el botón de PAUSA envicidial.php. Los códigos de la pausa son definibles por campaña enel fondo de la pantalla del detalle de la opinión de la campaña y sealmacenan en la tabla del vicidial_agent_log. El defecto es N. + +
+
+
+Inhabilite alteran datos del cliente - si el sistema a Y, no cambiacualquiera del expediente de datos del cliente cuando lasdisposiciones de un agente la llamada. El defecto es N. + +
+
+
+Permita Ninguno-Tolva-Conduce conexiones - si el sistema a Y, permiteagentes a la conexión a la campaña incluso si no hay plomos cargadosen la tolva para esa campaña. Esta función no se necesita encampañas de CLOSER-type. El defecto es N. + +
+
+
+Mezcla de la orden de la lista - elimina los campos de la orden delplomo y del estado del dial. Utilizará los parámetros de la lista ydel estado para la entrada seleccionada de la mezcla de la lista en lasección del submarino de la mezcla de la lista en lugar de otro. Eldefecto es LISIADO. + +
+
+
+Identificación de la mezcla de la lista - identificación de lamezcla de la lista. Debe ser a partir de 2-20 caracteres en longitudsin los espacios o la otra puntuación especial. + +
+
+
+Nombre de la mezcla de la lista - nombre descriptivo de la mezcla dela lista. Debe ser a partir de 2-50 caracteres en longitud. + +
+
+
+Detalle de la mezcla de la lista - la composición de la entrada de lamezcla de la lista. Contiene la identificación de la lista, la ordende la mezcla, los porcentajes y los estados que hacen para arriba estamezcla de la lista. Los porcentajes tienen que agregar siempre hasta100, y las listas todas tienen que ser activas y fijadas a la campañapara que la entrada de la mezcla de la orden sea activada. + +
+
+
+Método de la mezcla de la lista - el método de mezclar a todas laspartes del detalle de la mezcla de la lista juntas. EVEN_MIX mezclarálos plomos de cada parte interpolada con las otras partes, como estos1.2.3.1.2.3.1.2.3. IN_ORDER pondrá los plomos en la orden en la cualse enumeran en la pantalla 1.1.1.2.2.2.3.3.3 del detalle de la mezclade la lista. La voluntad AL AZAR los puso en la orden AL AZAR1.3.2.1.1.3.2.1.3. El defecto es IN_ORDER. + +
+
+
+Identificación manual de la lista del dial - el list_id del defectoque se utilizará cuando los placces de un agente una llamada manual yun nuevo expediente del plomo se crean en vicidial_list. El defecto es999. Este campo puede contener dígitos solamente. + + + + +



+ +VICIDIAL_LISTAS TABLA

+
+
+Identificación de la lista - Úste es el nombre numérico de la lista, él no es editable después de la sumisión inicial, debe contener solamente números y debe estar entre 2 y 8 caracteres en longitud. Must be a number greater than 100. + +
+
+
+Nombre de la lista - Ésta es la descripción de la lista, debe estar entre 2 y 20 caracteres en longitud. + +
+
+
+Descripción de la lista - éste es el campo de la nota para la lista,él es opcional. + +
+
+
+Fecha del cambio de la lista - ésta es la vez última que los ajustespara esta lista fueron modificados de cualquier manera. + +
+
+
+Fecha de la llamada del último de la lista - ésta es la vez últimaque conduce fue marcado de esta lista. + +
+
+
+Campaña - Ésta es la campaña que esta lista pertenece a. Una lista se puede marcar solamente en una sola campaña contemporáneamente. + +
+
+
+Activo - esto define si la lista debe ser marcada encendido o no. + +
+
+
+Reajuste el Conducir-Llamar-Estado para esta lista - esto reajusta todos los plomos en esta lista a N para "no llamado puesto que reajuste pasado" y significa que cualquier plomo puede ahora ser llamado si es el estado derecho según lo definido en la pantalla de la campaña. + +
+
+
+Lista de VICIDIAL DNC - esto no llama la lista contiene cada plomo quese ha fijado a un estado de DNC en el sistema. A través de las LISTAS- AGREGUE EL NÚMERO a la página de DNC que usted puede agregarmanualmente un número a esta lista de modo que no sea llamada por lascampañas que utilizan la lista interna de DNC. + + + +



+ +VICIDIAL_INBOUND_GROUPS TABLA

+
+
+Identificación de grupo - Úste es el nombre corto del grupo de entrada, él no es editable después de la sumisión inicial, no debe contener cualquier espacio y debe estar entre 2 y 20 caracteres en longitud. + +
+
+
+Nombre de grupo - Ésta es la descripción del grupo, debe estar entre 2 y 30 caracteres en longitud. No puede incluir rociadas -, plusses + o espacios . + +
+
+
+Color del grupo - éste es el color que exhibe en el cliente app de VICIDIAL cuando una llamada viene adentro en este grupo. Debe estar entre 2 y 7 caracteres de largo. Si esto es una definición del color de la tuerca hexagonal usted debe recordar poner a # al principio de la secuencia o VICIDIAL no trabajará correctamente. + +
+
+
+Activo - esto se determina si este grupo demuestra para arriba en la caja de la selección cuando un agente de VICIDIAL entra. + +
+
+
+Forma del Web - Ésta es la dirección de encargo que el chascar en el botón de la FORMA del WEB en VICIDIAL le llevará para las llamadas que vienen adentro en este grupo. + +
+
+
+Llamada siguiente del agente - esto se determina qué agente recibe la llamada siguiente que está disponible: +
  - random: órdenes por el valor al azar de la actualización en la tabla de los vicidial_live_agents +
  - oldest_call_start: las órdenes por la vez última un agente fueron enviadas una llamada. Resultados en los agentes que reciben el número casi igual de llamadas cabalmente. +
  - oldest_call_finish: las órdenes por la vez última un agente acabaron una llamada. El agente de AKA que espera lo más de largo posible recibe la primera llamada. +
  - overall_user_level: las órdenes por el user_level del agente según lo definido en los vicidial_users tabulan un user_level más alto recibirán más llamadas. +
  - inbound_group_rank: órdenes de la fila dada al agente para el grupode entrada específico. Lo más arriba posible a lo más bajo posible. +
  - fewest_calls: órdenes por el número de las llamadas recibidas por unagente para ese grupo de entrada específico. Menos llamadas primero. +
  - campaign_rank: órdenes de la fila dada al agente para la campaña. Lomás arriba posible a lo más bajo posible. +
  - fewest_calls_campaign: orders by the number of calls received by an agent for the campaign. Least calls first. +
+
+
+Exhibición de Fronter - este campo se determina si el agente de entrada de VICIDIAL tendría el name(if del fronter allí es uno) exhibido en el campo del estado cuando la llamada viene al agente. + +
+
+
+Escritura de la campaña - este menú permite que usted elija la escritura que aparecerá en la pantalla de los agentes para esta campaña. No seleccione NONE no demostrar ninguna escritura para esta campaña. + +
+
+
+Consiga el lanzamiento de la llamada - este menú permite que usted elija si usted desee automo'vil-lance la página en una ventana separada, auto-switch de la tela-forma a la lengüeta de la ESCRITURA o no haga nada cuando una llamada se envía al agente para esta campaña. + +
+
+
+Xfer-Conf DTMF - Estos cuatro campos permiten para que usted tenga dos sistemas de conferencia de la transferencia y de precolocaciones de DTMF. Cuando se carga la llamada o la campaña, la escritura de vicidial.php demostrará dos botones en el marco de la transferir-conferencia y automo'vil-poblara' el nu'mero-a-dial y los campos del enviar-dtmf cuando está presionada. Si usted desea permitir transferencias consultivas, un fronter a unmás cercano, usted puede colocar CXFER pues uno de lasprecolocaciones del nu'mero-a-dial y del dial string apropiado seráenviado para hacer una transferencia consultiva local, entonces lalata LEAVE-3WAY-CALL justo del agente y movimiento encendido a sullamada siguiente. Si usted desea permitir transferencias ocultas declientes a una escritura de VICIDIAL AGI para registrar o un IVR,entonces coloque AXFER en el campo del nu'mero-a-dial. Usted puedetambién especificar una extensión de encargo después del AXFER odel CXFER, por ejemplo si usted desea hacer transferencias consultivasinternas en vez de local que usted pondría CXFER90009 en el campo delnu'mero-a-dial. + +
+
+
+Segundos de la llamada de la gota - el número de segundos a partirdel tiempo que la línea de cliente se escoge encima de hasta que lallamada se considera una GOTA, sólo se aplica a las llamadas desalida. + +
+
+
+Buzón de Voz - si estuvieron definidas, las llamadas que CAERÃAN normalmente en lugar de otro serían ordenadas a esta caja del voicemail para oír y para dejar un mensaje. + +
+
+
+Mensaje de la gota - si el sistema a Y juega un mensaje al clientedespués de que el descanso de los segundos de la llamada de la gotase alcance sin la transferencia a un agente. Este ajuste eliminaráenviar a una caja del voicemail si esto se fija a Y. + +
+
+
+Gota Exten - ésta es la extensión dial plan que el archivo audiocaído deseado de la llamada está situado en en su servidor. + +
+
+
+Tiempo de la llamada - éste es el esquema del tiempo de la llamada autilizar para este grupo de entrada. Tenga presente que el tiempoestá basado en el tiempo del servidor. El defecto es 24hours. + +
+
+
+Después de la acción de las horas - la acción a realizarse si esdespués de horas según lo definido en la época de la llamada paraeste grupo de entrada. Del RETRASO de la voluntad el retrasoinmediatamente la llamada, MESSASGE jugará el archivo en después delcampo de Filenam del mensaje de las horas, la EXTENSIÓN enviará lallamada a después de la extensión de las horas en el dialplan yVOICEMAIL enviará la llamada a la caja del voicemail enumerada endespués del campo de Buzón de Voz de las horas. El defecto es MENSAJE. + +
+
+
+Después del nombre de fichero del mensaje de las horas - el archivoaudio situado en el servidor que se jugará si la acción se fija alMENSAJE. El defecto es VM-ADIO'S + +
+
+
+Después de la extensión de las horas - la extensión dialplan paraenviar la llamada si la acción se fija a la EXTENSIÓN. El defecto es8300. + +
+
+
+Después de las horas Buzón de Voz - la caja del voicemail para enviar lallamada si la acción se fija a VOICEMAIL. + +
+
+
+Nombre de fichero agradable del mensaje - el archivo audio situado enel servidor que se jugará cuando viene la llamada adentro. Si sistemaa ---NONE --- entonces no se jugará ningún mensaje. El defecto es---NONE --- + +
+
+
+Música en contexto del asimiento - la música en el contexto delasimiento para utilizar cuando colocan al cliente en asimiento. Eldefecto es defecto. + +
+
+
+En el nombre de fichero del aviso del asimiento - el archivo audiosituado en el servidor que se jugará en un intervalo regular cuandoel cliente está en asimiento. El defecto es generic_hold. Estearchivo audio DEBE estar 9 segundos o menos en longitud. + +
+
+
+En el intervalo del aviso del asimiento - la longitud de la hora ensegundos de esperar antes de jugar encendido el aviso del sostener. Eldefecto es 60. + +
+
+
+Extensión alerta del agente - la extensión a enviar en la sesióndel agente para anunciar que una llamada está viniendo al agente.Esta extensión debe tener un aparato de lectura de un archivo audio.No utilizar esta función fijó esto a X. Default es X. + +
+
+
+La alarma del agente retrasa - la longitud de la hora en milisegundosde esperar antes de enviar la llamada al agente después de jugarencendido la extensión alerta del agente. El defecto es 1000. + +
+
+
+Grupo de la transferencia del defecto - este campo es el En-Grupo deldefecto que será seleccionado automáticamente cuando el agente va almarco de la transferir-conferencia en su interfaz del agente. + + + +



+ +VICIDIAL_REMOTE_AGENTS TABLA

+
+
+Comienzo de la identificación del usuario - Ésta es la identificación del usuario que comienza se utiliza que cuando las entradas alejadas del agente se insertan en el sistema. Si el número de líneas se fija más altamente de 1, este número es incrementado por uno hasta que cada línea tiene una entrada. Se cerciora de usted crear una nueva cuenta del usuario de VICIDIAL con un nivel de usuario de 4 o grande si usted quisiera que pudieran utilizar la página de vdremote.php para el acceso alejado de la tela de esta cuenta. + +
+
+
+Número de líneas - el define cuánto crea el agente alejado las entradas el sistema, y se determina cuántas líneas piensa que puede enviar con seguridad al número debajo. + +
+
+
+IP del servidor - Una entrada alejada del agente es solamente buena para un servidor específico, aquí es donde usted selecciona a que el servidor usted desea. + +
+
+
+Extensión externa - éste es el número que usted desea las llamadas remitidas a. Cerciórese de que sea un número dial plan completo y que si usted necesita 9 al principio usted lo pone adentro aquí. Pruebe marcando este número de un teléfono en el sistema. + +
+
+
+Estado - aquí es donde usted da vuelta al agente alejado por intervalos. Tan pronto como el agente sea activo el sistema asume que puede enviarle llamadas. Puede tomar hasta 30 segundos una vez que usted cambie el estado a inactivo para parar el recibir de llamadas. + +
+
+
+Campaña - aquí es donde usted selecciona la campaña que estos agentes alejados serán registrados en. Necesidades de entrada de utilizar la campaña MÃS CERCANA y de seleccionar las campañas de entrada debajo de ésa que usted desea recibir llamadas de. + +
+
+
+Grupos de entrada - aquí es donde usted selecciona a grupos de entrada que usted desea recibir llamadas de si usted ha seleccionado la campaña MÃS CERCANA. + + +



+ +VICIDIAL_CAMPAIGN_LISTAS

+
+
+Las listas dentro de esta campaña se enumeran aquí, si son activas son denotadas por la Y o N y usted pueden ir a la pantalla de la lista chascando en la identificación de la lista en la primera columna. + + +



+ +VICIDIAL_CAMPAIGN_STATUSES TABLA

+
+
+Con el uso de los estados de encargo de la campaña, usted puede tener estados que existan solamente para una campaña específica. El estado debe ser 1-8 caracteres en longitud, la descripción debe ser 2-30 caracteres en longitud y seleccionable define si demuestra para arriba en VICIDIAL como disposición. Human_answered el campo se utiliza al calcular el porcentaje de lagota, o la tarifa del abandono. El ajuste human_answered a Yutilizará este estado al contar las llamadas humano-contestadas. La opción de la categoría permite que usted agrupe varios estados enun catogy que se pueda utilizar para el análisis estadístico. + + + +



+ +VICIDIAL_CAMPAIGN_HOTKEYS TABLA

+
+
+Con el uso de los hot keys de encargo de la campaña, los agentes que utilizan el retraso vicidial de la lata del tela-cliente y la disposición llama apenas presionando una sola llave en su teclado. Hay dos opciones especiales que usted puede utilizar conjuntamente conel número de teléfono alterno que marca, ALTPH2 de HotKey - el dialcaliente del teléfono alterno y el dial caliente ADDR3-----Address3permiten que un agente utilice un hotkey al retraso su llamada,permanecen en el mismo plomo, y marcan otro número del contacto deese conducen. + + + + + +



+ +VICIDIAL_LEAD_RECYCLE TABLA

+
+
+Through the use of lead recycling, you can call specific statuses of leads again at a specified interval without resetting the entire list. Lead recycling is campaign-specific and does not have to be a selected dialable status in your campaign. The attempt delay field is the number of seconds until the lead can be placed back in the hopper, this number must be at least 120 seconds. The attempt maximum field is the maximum number of times that a lead of this status can be attempted before the list needs to be reset, this number can be from 1 to 10. You can activate and deactivate a lead recycle entry with the provided links. + + + + + +



+ +ESTADOS AUTO DEL DIAL DE VICIDIAL ALT

+
+
+Si se fija el campo que marca del Alt-Nu'mero auto, después losplomos que son dispositioned bajo estos estados del dial del alt delautomóvil tendrán su alt_phone y-o los campos address3 marcadosdespués de que cualesquiera de estos ninguno-contesten a estados sefijan. + + + + + +



+ +VICIDIAL CÓDIGOS DE LA PAUSA DEL AGENTE

+
+
+Si la pausa del agente cifra el campo activo se fija a activo entonceslos agentes podrá seleccionar de estos códigos de la pausa cuandochascan encendido el botón de PAUSA en sus pantallas. Estos datosentonces se almacenan en el registro vicidial del agente. El códigode la pausa debe contener solamente letras y números y ser menos de 7caracteres de largo. El nombre del código de la pausa puede estar nomás de largo de 30 caracteres. + + + + + +



+ +VICIDIAL_USER_GROUPS TABLA

+
+
+Grupo de usuario - éste es el nombre corto de un grupo de usuario de Vicidial, intento para no utilizar ningunos espacios o puntuación para los caracteres de este máximo 20 del campo, mínimo de 2 caracteres. + +
+
+
+Nombre de grupo - Ésta es la descripción del máximo vicidial del grupo de usuario de 40 caracteres. + +
+
+
+Campañas permitidas - ésta es una lista seleccionable de lascampañas a las cuales los miembros de este grupo de usuario puedenabrirse una sesión. La opción de ALL-CAMPAIGNS permite que losusuarios en este grupo consideren y se abran una sesión a cualquiercampaña en el sistema. + + + + + +



+ +VICIDIAL_ESCRITURAS TABLA

+
+
+Identificación de la escritura - Éste es el nombre corto de una escritura de Vicidial. Éste necesita ser un identificador único. Intente no utilizar ningunos espacios o puntuación para los caracteres de este máximo 10 del campo, mínimo de 2 caracteres. + +
+
+Nombre de la escritura - éste es el título de una escritura de Vicidial. Éste es un resumen corto de los caracteres del máximo 50 de la escritura, mínimo de 2 caracteres. No debe haber espacios o puntuación de la clase en campo de los theis. + +
+
+Comentarios de la escritura - éste es tal como donde usted puede poner los comentarios para una escritura de Vicidial - cambiantes para liberar mejora de sept. el 23 -. caracteres del máximo 255, mínimo de 2 caracteres. + +
+
+Texto de la escritura - This is where you place the content of a Vicidial Script. Minimum of 2 characters. You can have customer information be auto-populated in this script using "--A--field--B--" where field is one of the following fieldnames: vendor_lead_code, source_id, list_id, gmt_offset_now, called_since_last_reset, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments, lead_id, campaign, phone_login, group, channel_group, SQLdate, epoch, uniqueid, customer_zap_channel, server_ip, SIPexten, session_id. For example, this sentence would print the persons name in it----

Hello, can I speak with --A--first_name--B-- --A--last_name--B-- please? Well hello --A--title--B-- --A--last_name--B-- how are you today?

This would read----

Hello, can I speak with John Doe please? Well hello Mr. Doe how are you today?

You can also use an iframe to load a separate window within the SCRIPT tab, here is an example with prepopulated variables: + +
+<iframe src="http://astguiclient.sf.net/test_VICIDIAL_output.php?lead_id=--A--lead_id--B--&vendor_id=--A--vendor_lead_code--B--&list_id=--A--list_id--B--&gmt_offset_now=--A--gmt_offset_now--B--&phone_code=--A--phone_code--B--&phone_number=--A--phone_number--B--&title=--A--title--B--&first_name=--A--first_name--B--&middle_initial=--A--middle_initial--B--&last_name=--A--last_name--B--&address1=--A--address1--B--&address2=--A--address2--B--&address3=--A--address3--B--&city=--A--city--B--&state=--A--state--B--&province=--A--province--B--&postal_code=--A--postal_code--B--&country_code=--A--country_code--B--&gender=--A--gender--B--&date_of_birth=--A--date_of_birth--B--&alt_phone=--A--alt_phone--B--&email=--A--email--B--&security_phrase=--A--security_phrase--B--&comments=--A--comments--B--&user=--A--user--B--&campaign=--A--campaign--B--&phone_login=--A--phone_login--B--&fronter=--A--fronter--B--&closer=--A--user--B--&group=--A--group--B--&channel_group=--A--group--B--&SQLdate=--A--SQLdate--B--&epoch=--A--epoch--B--&uniqueid=--A--uniqueid--B--&customer_zap_channel=--A--customer_zap_channel--B--&server_ip=--A--server_ip--B--&SIPexten=--A--SIPexten--B--&session_id=--A--session_id--B--&phone=--A--phone--B--" style="width:580;height:290;background-color:transparent;" scrolling="auto" frameborder="0" allowtransparency="true" id="popupFrame" name="popupFrame" width="460" height="290" STYLE="z-index:17"> +</iframe> +
+ +
+
+
+Activo - esto se determina si esta escritura se puede seleccionar para ser utilizado por una campaña. + + + + + +



+ +VICIDIAL_LEAD_FILTROS TABLA

+
+
+Identificación del filtro - Éste es el nombre corto de un filtro del plomo de Vicidial. Éste necesita ser un identificador único. No utilice ningunos espacios o puntuación para los caracteres de este máximo 10 del campo, mínimo de 2 caracteres. + +
+
+Nombre del filtro - éste es un nombre más descriptivo del filtro. Éste es un resumen corto de los caracteres del máximo 30 del filtro, mínimo de 2 caracteres. + +
+
+El filtro comenta - aquí es tal como donde usted puede poner los comentarios para un filtro de Vicidial - las llamadas todos los plomos de California -. los caracteres del máximo 255, mínimo de 2 caracteres. + +
+
+Filtro SQL - Aquí es adonde usted pone el fragmento de la pregunta del SQL que usted desea filtrar cerca no comienza o el extremo con Y, eso será agregado por la escritura del cron de la tolva automáticamente. una pregunta del SQL del ejemplo que trabajaría aquí es el called_count 4 y called_count. + + + + + +



+ +VICIDIAL_TIEMPOS DE LA LLAMADA TABLA

+
+
+Identificación del tiempo de la llamada - éste es el nombre corto deuna definición del tiempo de la llamada de Vicidial. Éste necesitaser un identificador único. No utilice ningunos espacios opuntuación para los caracteres de este máximo 10 del campo, mínimode 2 caracteres. + +
+
+Nombre del tiempo de la llamada - éste es un nombre más descriptivode la definición del tiempo de la llamada. Éste es un resumen cortode los caracteres del máximo 30 de la definición del tiempo de lallamada, mínimo de 2 caracteres. + +
+
+El tiempo de la llamada comenta - aquí es donde usted puede poner loscomentarios para una definición del tiempo de la llamada de Vicidialtal como -10am hasta los 4pm con restricciones adicionales del estadode la llamada -. los caracteres del máximo 255. + +
+
+Tiempos del comienzo y de parada del defecto - éste es el tiempo dedefecto paran que el llamar será permitido que sea comenzado o dentrode esta definición del tiempo de la llamada si la hora de salida dela di'a-de-$$$-SEMANA no se define. 0 es medianoche. Evitar el llamarfijó totalmente este campo a 2400 y fijó el tiempo de parada deldefecto a 2400. Permitir el llamar 24 horas al día fijó la hora desalida a 0 y el tiempo de parada a 2400. + +
+
+Tiempos del comienzo y de parada del día laborable - éstos son lostiempos de encargo por el día que se puede fijar para la definicióndel tiempo de la llamada que las mismas reglas se aplican como con lostiempos del comienzo y de parada del defecto. + +
+
+Definiciones del tiempo de la llamada del estado - ésta es la listade las definiciones específicas del tiempo de la llamada del estadoque se siguen en esta definición del tiempo de la llamada. + +
+
+Estado del tiempo de la llamada del estado - éste es el código dedos letras para el estado que esta definición del tiempo que llamaestá para. Para que esto sea en efecto la llamada local mida eltiempo que se fija en la campaña debe tener este expediente deltiempo de la llamada del estado en él así como todos los plomos quetienen dos códigos del estado de la letra en ellos. + + + + +



+ +FUNCIONALIDAD DEL CARGADOR DE LA LISTA DE VICIDIAL

+
+
+El cargador tela-basado básico del plomo de VICIDIAL se diseñasimplemente para tomar un archivo del plomo - hasta 8MB de tamaño quees la lengüeta o la pipa delimitada y para cargarlo en la tabla delvicidial_list. El cargador del plomo permite el campo que elige y deTXT- el texto claramente, los valores separados coma de CSV- y XLS-sobresalen formatos del archivo. El cargador del plomo no hace lavalidación de datos, sino que permite que usted compruebe para sabersi hay duplicados en sí mismo, dentro de la campaña o dentro delsistema entero. También, cerciórese de que usted haya creado lalista que estos plomos son estar debajo de modo que usted puedautilizarlos. Aquí está una lista de los campos en su orden apropiadapara los archivos del plomo: +
    +
  1. Código del plomo del vendedor - demuestra para arriba en el campo de la identificación del vendedor del GUI +
  2. Código de fuente - uso interno solamente para los admins y DBAs +
  3. Identificación de la lista - el número de la lista que estos plomos demostrarán para arriba debajo +
  4. Código del teléfono - el prefijo para el teléfono number(1 para los E.E.U.U., 01144 para Reino Unido, 01161 para AUS, el etc) +
  5. Número de teléfono - debe ser por lo menos 8 dígitos de largo +
  6. Título - título del customer(Mr. Ms señ., etc...) +
  7. Nombre +
  8. Inicial Media +
  9. Apellidos +
  10. Dirección, línea 1 +
  11. Dirección, línea 2 +
  12. Dirección, línea 3 +
  13. Ciudad +
  14. Estado - limitado a 2 caracteres +
  15. Provincia +
  16. Código Postal +
  17. País +
  18. Sexo +
  19. Fecha de nacimiento +
  20. Número De Teléfono Alternativo +
  21. Dirección Email +
  22. Frase De Seguridad +
  23. Comentarios +
+ +
NOTAS: La funcionalidad del cargador del plomo del sobresalir espermitida por una serie de escrituras del Perl y necesita tener unarchivo correctamente configurado de /etc/astguiclient.conf en lugaren el web server. También, los módulos de un Perl de los pares sedeben cargar para ella para trabajar también -oLE-Storage_Lite-Storage_Lite y la Hoja de balance-ParseExcel. Ustedpuede comprobar para saber si hay errores runtime en éstos mirando suarchivo del error_log de apache. También, para los cheques deduplicación contra gampaign enumera, la lista que tiene nuevos plomosel entrar él necesita ser creada en el sistema antes de que ustedcomience a cargar los plomos. + + + + +



+ + + + + + +TABLA DE LOS TELÉFONOS

+
+
+Extensión del teléfono - este campo es donde usted pone los nombres del teléfono que aparecen al marcar con asterisco no incluyendo el protocolo o la barra vertical del principio. Por ejemplo: para el teléfono SIP/test101 del SIP la extensión del teléfono sería test101. También, para los teléfonos IAX2 compruebe que usted utiliza el nombre del teléfono completo: IAX2/IAXphone1@IAXphone1 sería IAXphone1@IAXphone1. Para zap los teléfonos compruebe que usted pone el canal completo: Zap/25-1 sería 25-1. Otra nota, compruebe que usted fija el protocolo abajo correctamente para su tipo de teléfono. + +
+
+
+Número del Dial plan - este campo está para el número que usted marca para tener el anillo del teléfono. Este número se define en el archivo de extensions.conf de su servidor asterisco + +
+
+
+Caja de Buzón de Voz - este campo es para la caja del buzón de voz donde van los mensajes para al usuario de este teléfono. Utilizamos esto para comprobar los mensajes del buzón de voz y para que el usuario pueda acceder al Buzón de Voz desde astGUIclient. + +
+
+
+CallerID de salida - este campo es donde usted incorporara el número del callerID que usted quiera que aparezca en las llamadas de salida. Esto no funciona en las líneas RTB(non-PRI) T1/E1. + +
+
+
+Dirección IP del teléfono - este campo es para la dirección IP del teléfono si es un teléfono de VOZIP. Este es un campo opcional + +
+
+
+Dirección IP del ordenador - este campo es para la dirección IP del ordenador del usuario. Es un campo opcional + +
+
+
+IP del servidor - Este menú es donde usted selecciona en que servidor está el teléfono activo. + +
+
+
+Conexión - la conexión usada para el usuario del teléfono a laconexión a los usos del cliente. + +
+
+
+Contraseña - la contraseña usada para el usuario del teléfono a laconexión a los usos del cliente. + +
+
+
+Estado - el estado del teléfono en el sistema, puede ser ACTIVO y ADMIN permiten que los clientes del GUI trabajen. ADMIN permite el acceso a este Web site de administración. El resto de los estados no permiten el acceso al GUI o al Web de Admin. + +
+
+
+Cuenta activa - si el teléfono está activado ponerla en la lista del cliente del GUI. + +
+
+
+Tipo de teléfono - solamente para información administrativas. + +
+
+
+Nombre completo - usado por el GUIclient en la lista de teléfonos activos. + +
+
+
+Compañía - solamente para las notas administrativas. + +
+
+
+Cuadro - todavía no puesto en ejecución. + +
+
+
+Nuevos mensajes - número de los nuevos mensajes del Buzón de Voz para este teléfono en el servidor del asterisco. + +
+
+
+Viejos mensajes - número de los viejos mensajes del Buzón de Voz para este teléfono en el servidor del asterisco. + +
+
+
+Protocolo del cliente - el protocolo que el teléfono utiliza para conectar con el servidor del asterisco: El Sip, IAX2, Zap. También, para los números External remotos o los números SpeedDial que usted desea enumerar como teléfonos. + +
+
+
+GMT local - La diferencia a partir del tiempo malo del ZULÚ del time(or de Greenwich) donde se localiza el teléfono. NO AJUSTE POR TIEMPO DE LOS AHORROS DE LA LUZ DEL DÃA. Esto es utilizada por la campaña de VICIDIAL para exhibir exactamente el tiempo y el tiempo del cliente. + +
+
+
+Conexión del encargado - Ésta es la conexión que los clientes del GUI para este teléfono utilizarán tener acceso a la base de datos donde residen los datos del servidor. + +
+
+
+Secreto del encargado - Ésta es la contraseña que los clientes del GUI para este teléfono utilizarán tener acceso a la base de datos donde residen los datos del servidor. + +
+
+
+Usuario del defecto de VICIDIAL - éste debe poner un valor prefijado en el campo del usuario de VICIDIAL siempre que este usuario del teléfono abra a cliente app de astVICIDIAL. Deje el espacio en blanco para ningún usuario. + +
+
+
+Paso del defecto de VICIDIAL - éste debe poner un valor prefijado en el campo de la contraseña de VICIDIAL siempre que este usuario del teléfono abra a cliente app de astVICIDIAL. Deje el espacio en blanco para ningún paso. + +
+
+
+Campaña del defecto de VICIDIAL - éste debe poner un valor prefijado en el campo de la campaña de VICIDIAL siempre que este usuario del teléfono abra a cliente app de astVICIDIAL. Deje el espacio en blanco para ninguna campaña. + +
+
+
+Parque Exten - Ésta es la extensión del estacionamiento del defecto para los apps del cliente. Verifique que diverso trabaje antes de que usted cambie esto. + +
+
+
+Extensión de la conferencia - Ésta es la extensión del parque de la conferencia del defecto para los apps del cliente. Verifique que diverso trabaje antes de que usted cambie esto. + +
+
+
+Parque Exten de VICIDIAL - Ésta es la extensión del estacionamiento del defecto para el cliente app de VICIDIAL. Verifique que diverso trabaje antes de que usted cambie esto. + +
+
+
+Archivo del parque de VICIDIAL - éste es el nombre del archivo de la extensión del parque del defecto VICIDIAL para los apps del cliente. Verifique que diverso trabaje antes de que usted cambie éste limitado a 10 caracteres. + +
+
+
+Prefijo del monitor - éste es el prefijo dial plan para supervisar de zap los canales automáticamente dentro del app astGUIclient. Cambie solamente según los expedientes de extensiones de extensions.conf ZapBarge. + +
+
+
+Grabación Exten - Ésta es la extensión dial plan para la extensión de la grabación que se utiliza para caer en conferencias del meetme para registrarlas. Dura generalmente hasta que una hora si no parada verifica con el archivo de extensions.conf antes de cambiar. + +
+
+
+VMAIL Exten principal - Ésta es la extensión dial plan que va a comprobar su voicemail. verifica con el archivo de extensions.conf antes de cambiar. + +
+
+
+Descarga Exten de VMAIL - éste es el prefijo dial plan usado para enviar llamadas directamente al voicemail de un usuario de una llamada viva en el app. astGUIclient verifica con el archivo de extensions.conf antes de cambiar. + +
+
+
+Contexto de Exten - éste es el contexto dial plan que este teléfono utiliza sobre todo. Se asume que todos los números marcados por los apps del cliente están utilizando este contexto así que es una buena idea cerciorarse de que éste es el contexto más amplio posible verifica con el archivo de extensions.conf antes de cambiar. + +
+
+
+DTMF envían el canal - Ésta es la secuencia del canal usada para enviar sonidos de DTMF en conferencias del meetme de los apps del cliente. Verifique que exten y contexto con el archivo de extensions.conf. + +
+
+
+Grupo de salida de la llamada - éste es el grupo de canal que las llamadas de salida de este teléfono están puestas de. Hay rutinas de un par en los apps del cliente que utilizan esto. Para zap los canales que usted desea utilizar algo como Zap/g2, porque los troncos IAX2 usted desearía utilizar el prefijo completo de IAX como IAX2/VICItest1:secret@10.10.10.15:4569. Verifique que los troncos con el file(it de extensions.conf sean generalmente lo que usted ha definido como la variable global del TRUNK en la tapa del archivo). + +
+
+
+Localización del browser - esto es aplicable solamente a los clientes de UNIX/LINUX, el camino absoluto a Mozilla o el browser de Firefox en la máquina verifica esto lanzándolo manualmente. + +
+
+
+Instale el directorio - éste es el lugar en donde las escrituras astGUIclient y de astVICIDIAL están situadas en su máquina. Para Win32 debe ser algo como C:\AST_VICI y para UNIX debe ser algo como /usr/local/perl_TK. verifica esto manualmente. + +
+
+
+URL de CallerID - Ústa es la dirección de la tela de la página usada para hacer operaciones de búsqueda de encargo del callerID que es la dirección de prueba del defecto: http://astguiclient.sf.net/test_callerid_output.php + +
+
+
+URL del defecto de VICIDIAL - Ésta es la dirección de la tela de la página usada para hacer preguntas de encargo de la forma del Web de VICIDIAL que es la dirección de prueba del defecto: http://astguiclient.sf.net/test_VICIDIAL_output.php + +
+
+
+Registración de la llamada - esto se fija para verdad si el archivo de call_log.agi está en lugar en el archivo de extensions.conf para todo el de salida y las extensiones del retraso ' h ' para registrar todo llama. Ústa debe siempre ser 1 porque es manditory para muchos astGUIclient y características de VICIDIAL a trabajar correctamente. + +
+
+
+Conmutación del usuario - fije para verdad para permitir que el usuario cambie a otra cuenta del usuario. NOTA: Si los interruptores del usuario ellos pueden iniciar la grabación en la conversación de teléfono del nuevo usuario + +
+
+
+Comunicación - fije para verdad para permitir que el usuario comience llamadas de conferencia con hasta que seis líneas externas. + +
+
+
+Retraso del Admin - sistema a verdad para permitir que el usuario pueda al retraso cualquier línea en la voluntad con astGUIclient. Buena idea de permitir solamente esto para los usuarios del Admin. + +
+
+
+Secuestro del Admin - fije para verdad para permitir que el usuario pueda asir y volver a dirigir a su extensión cualquier línea en la voluntad con astGUIclient. Buena idea de permitir solamente esto para los usuarios del Admin. Pero es muy útil para los encargados. + +
+
+
+Monitor del Admin - fije para verdad para permitir que el usuario pueda asir y volver a dirigir a su extensión cualquier línea en la voluntad con astGUIclient. Buena idea de permitir solamente esto para los usuarios del Admin. Pero es muy útil para los encargados y como herramienta del entrenamiento. + +
+
+
+Parque de llamada - el sistema a verdad para permitir que el usuario pueda parquear invita el asimiento astGUIclient para ser tomado por cualquier otro usuario astGUIclient en el sistema. Las llamadas permanecen en el asimiento para hasta que un retraso de la media-hora entonces. Permitido generalmente para todos. + +
+
+
+Cheque de Updater - fije para verdad para exhibir una advertencia del popup que el tiempo del updater no ha cambiado en 20 segundos. Útil para los usuarios del Admin. + +
+
+
+Af que registra - fije para verdad para registrar muchas acciones del uso astGUIclient a un archivo de texto en la computadora del usuario. + +
+
+
+La coleta permitió - al sistema verdad para hacer que los apps del cliente utilicen el sistema central de la coleta del asterisco. Requerido para VICIDIAL y recomendado para todos los usuarios. + +
+
+
+Ventana emergente del CallerID - sistema a verdad para tener en cuenta los números definidos en el archivo de extensions.conf para enviar las pantallas del popup de CallerID a los usuarios astGUIclient. + +
+
+
+Botón de VMail - fije para verdad para exhibir el botón de VOICEMAIL y los mensajes cuentan la exhibición en astGUIclient. + +
+
+
+Rápido restaure - fije para verdad para permitir un nuevo índice de restauran de la información de la llamada para el astGUIclient. La tarifa inhabilitada defecto es el ms 1000 (1 segundo). Puede aumentar la carga de sistema si usted baja este número. + +
+
+
+Rápido restaure la tarifa - en milisegundos. Utilizado solamente si es rápido restaure se permite. La tarifa inhabilitada defecto es el ms 1000 (1 segundo). Puede aumentar la carga de sistema si usted baja este número. + +
+
+
+Persistant MySQL - si está permitida la conexión astGUIclient seguirá conectada en vez de conectar cada segundo. Útil si usted hace que un rápido restaure la tarifa fijada. Aumentará el número de conexiones en su máquina de MySQL. + +
+
+
+Número siguiente del dial auto - si está permitido el cliente de VICIDIAL marcará el número siguiente en la lista automáticamente sobre la disposición de una llamada a menos que seleccionaran "para parar el marcar" en la pantalla de la disposición. + +
+
+
+Pare Rec después de cada llamada - si está permitido el cliente de VICIDIAL parará se está encendiendo cualquier grabación después de que haya sido cada llamada dispositioned. Útil si usted está haciendo muchos de la grabación o usted están utilizando una forma de la tela para accionar la grabación. + +
+
+
+Permita los mensajes de SIPSAK - si está permitido el servidorenviará mensajes al teléfono del SIP a la exhibición en laexhibición del LCD del teléfono cuando está registrado en VICIDIAL.La característica trabaja solamente con los teléfonos del SIP yrequiere el uso del sipsak ser instalada en el web server. El defectoes 0. + +
+
+
+Servidor de DBX - el servidor de la base de datos de MySQL con el cual este usuario debe conectar. + +
+
+
+Base de datos de DBX - la base de datos de MySQL con la cual este usuario debe conectar. El defecto es asterisco. + +
+
+
+Usuario de DBX - la conexión del usuario de MySQL que este usuario debe utilizar al conectar. El defecto es cron. + +
+
+
+Paso de DBX - la contraseña del usuario de MySQL que este usuario debe utilizar al conectar. El defecto es 1234. + +
+
+
+DBX viran - el puerto de MySQL hacia el lado de babor TCP que este usuario debe utilizar al conectar. El defecto es 3306. + +
+
+
+Servidor de DBY - el servidor de la base de datos de MySQL con el cual este usuario debe conectar. Secundario server, no utilizado actualmente. + +
+
+
+Base de datos de DBY - la base de datos de MySQL con la cual este usuario debe conectar. El defecto es asterisco. Secundario server, no utilizado actualmente. + +
+
+
+Usuario de DBY - la conexión del usuario de MySQL que este usuario debe utilizar al conectar. El defecto es cron. Secundario server, no utilizado actualmente. + +
+
+
+Paso de DBY - la contraseña del usuario de MySQL que este usuario debe utilizar al conectar. El defecto es 1234. Secundario server, no utilizado actualmente. + +
+
+
+DBY viran - el puerto de MySQL hacia el lado de babor TCP que este usuario debe utilizar al conectar. El defecto es 3306. Secundario server, no utilizado actualmente. + + +



+ +TABLA DE LOS SERVIDORES

+
+
+ID Del Servidor - Este campo es donde usted pone el nombre del servidor del asterisco, no tiene que ser un submarino oficial del dominio, apenas un apodo para identificar el servidor a los usuarios del Admin. + +
+
+
+Descripción del servidor - el campo donde usted utiliza una frase pequeña para describir el servidor del asterisco. + +
+
+
+IP address del servidor - el campo donde usted puso el IP address de la red del servidor del asterisco. + +
+
+
+Activo - fije si el servidor del asterisco es activo o inactivo. + +
+
+
+Versión del asterisco - fije la versión del asterisco que usted ha instalado en este servidor. Ejemplos: ' 1.2 ', ' 1.0.8 ', ' 1.0.7 ', ' CVS_HEAD ', ' REALMENTE VIEJO ', etc... Se utiliza esto porque las versiones 1.0.8 y 1.0.9 tienen un diverso método de ocuparse del insecto local del channels(a que ha estado fijado en CVS v1.0) y necesidad de ser tratado diferentemente cuando la manipulación de su Local/ acanala. También, CVS_HEAD actual y las 1.2 aplicaciones diverso encargado y comando del árbol del lanzamiento hicieron salir así que debe ser tratado diverso también. + +
+
+
+Troncos máximos de VICIDIAL - este campo determinará el número de las líneas máximo que el auto-dialer de VICIDIAL procurará invitar este servidor. Si usted desea dedicar dos PRI llenos T1 a VICIDIALing en un servidor entonces usted fijaría esto a 46. E1 defecto es 96. + +
+
+
+Anfitrión del telnet - éste es la dirección o el nombre del servidor del asterisco y es cómo los usos del encargado conectan con él de donde están funcionando. Si están funcionando en el servidor del asterisco, después el defecto del ' localhost ' está muy bien. + +
+
+
+El telnet vira hacia el lado de babor - éste es el puerto de la conexión del encargado del servidor del asterisco y es cómo los usos del encargado conectan con ella de donde están funcionando. El defecto de ' 5038 ' está para un estándar instala muy bien. + +
+
+
+Usuario del encargado - el username o la conexión conectaba genericly con el encargado del servidor del asterisco. El defecto es 'cron' + +
+
+
+Secreto del encargado - el secreto o la contraseña conectaba genericly con el encargado del servidor del asterisco. El defecto es '1234' + +
+
+
+Usuario en modo actualización del encargado - el username o la conexión conectaba con el encargado del servidor del asterisco optimizado para las escrituras de la actualización. Omita es 'updatecron' y asume el mismo secreto que el usuario genérico. + +
+
+
+El encargado escucha usuario - el username o la conexión usada para conectar con el encargado del servidor del asterisco optimizado para las escrituras que esperan a escuchar solamente salida. Omita es 'listencron' y asume el mismo secreto que el usuario genérico. + +
+
+
+El encargado envía a usuario - el username o la conexión usada para conectar con el encargado del servidor del asterisco optimizado para las escrituras que envían solamente acciones al encargado. Omita es 'sendcron' y asume el mismo secreto que el usuario genérico. + +
+
+
+El GMT del servidor compensó - la diferencia sobre horas a partir del tiempo del GMT no ajustado según el Luz del di'a-Ahorro-Tiempo del servidor. El defecto es '-5' + +
+
+
+Descarga Exten - el prefijo de VMail de la extensión usado en este servidor para enviar llamadas directamente a través de agc a una caja específica del voicemail. El defecto es '85026666666666' + +
+
+
+Extensión del ANUNCIO de VICIDIAL - la extensión del defecto si ninguno está presente en la campaña enviar llamadas para a marcar auto de VICIDIAL. El defecto es '8365' + +
+
+
+Contexto del defecto - el contexto dial plan del defecto usado para las escrituras que funcionan para este servidor. El defecto es 'defecto' + +
+
+
+Funcionamiento del sistema - fijar esta opción a Y permitirá laregistración del stats del funcionamiento del sistema para lamáquina del servidor incluyendo carga de sistema, procesos delsistema y canales del asterisco en uso. El defecto es N. + +
+
+
+Registros del servidor - fijar esta opción a Y permitirá laregistración de todas las escrituras relacionadas VICIDIAL a susficheros de diario del texto. Fijar esto a N parará registros de laescritura a los archivos para estos procesos, también laregistración de la pantalla del asterisco será lisiado si esto sefija a N cuando se comienza el asterisco. El defecto es Y. + +
+
+
+AGI hecho salir - fijar esta opción a NINGUNOS inhabilitará salidade todas las escrituras relacionadas VICIDIAL de AGI. Fijar esto aSTDERR enviará el AGI hecho salir al asterisco CLI. Fijar esto alARCHIVO enviará la salida a un archivo en el directorio de losregistros. Fijar esto a AMBOS enviará salida al asterisco CLI y a unfichero de diario. El defecto es ARCHIVO. + +
+
+
+El marcar del balance de VICIDIAL - fijar este campo a Y permitiráque el servidor ponga las llamadas del balance para las campañas enVICIDIAL para poder resolver el nivel definido del dial incluso si nohay agentes registrados en esa campaña en este servidor. El defectoes N. + +
+
+
+Balance Offlimits de VICIDIAL - este ajuste define el número detroncos para no permitir el balance de VICIDIAL que marca parautilizar. Por ejemplo si usted tiene 40 troncos y offlimits vicidialmáximos del balance se fijan a 10 que usted podrá solamenteutilizar 30 líneas interurbanas para marcar del balance de VICIDIAL.El defecto es 0. + + +



+ +TABLA DE CONFERENCIAS

+
+
+Número de la conferencia - este campo es donde usted pone el número del dialpna de la conferencia del meetme. También se recomienda que el número del meetme en meetme.conf empareja este número para cada entrada. Esto está para las conferencias en astGUIclient y se utiliza para la funcionalidad de leave-3way-call en VICIDIAL. + +
+
+
+IP del servidor - El menú donde usted selecciona el servidor del asterisco que esta conferencia estará encendido. + + + + +



+ +VICIDIAL_SERVER_TRUNKS TABLA

+
+
+Los troncos del servidor de VICIDIAL permiten que usted restrinja laslíneas salientes que se utilizan en este servidor para la campañaque marca sobre una base de la por-campaña. Usted tiene la opciónpara reservar un número de las líneas específico que se utilizaránpor solamente una campaña así como permitir que esa campañafuncione sobre sus líneas reservadas en cualesquiera líneas siguensiendo abiertas, según lo en las líneas totales usadas por vicidialen este servidor es de largo menos que fijar de los troncos delmáximo VICIDIAL. No tener cualesquiera de estos expedientespermitirá la campaña que marca la línea primero para tener tantaslíneas mientras que puede conseguir bajo fijar de los troncos delmáximo VICIDIAL. + + + + + +



+ +SYSTEM_SETTINGS TABLA

+
+
+Uso No-Latino - esta opción permite que usted omita la escritura dela exhibición de la tela los caracteres del uso UTF8 y que no haganinguna expresión regular de la latino-cara'cter-familia que sefiltra ni que no exhiba el formato. El defecto es 0. + +
+
+
+Webroot escribible - este ajuste permite que usted defina si losarchivos de la temperatura y los archivos de la autentificación seancolocados en el webroot en su web server. El defecto es 1. + +
+
+
+Permita la registración de QueueMetrics - este ajuste permite queusted defina si VICIDIAL inserte entradas del registro en la tabla dela base de datos del queue_log como lo hace la actividad de lascoletas del asterisco. QueueMetrics es un independiente, programa delanálisis estadístico de la cerrado-fuente. Usted debe tenerQueueMetrics instalado y configurado ya antes de permitir estacaracterística. El defecto es 0. + +
+
+
+IP del servidor de QueueMetrics - éste es el IP address de la base dedatos para su instalación de QueueMetrics. + +
+
+
+Nombre de la base de datos de QueueMetrics - éste es el nombre de labase de datos para su base de datos de QueueMetrics. + +
+
+
+Conexión de la base de datos de QueueMetrics - éste es el nombre delusuario usado para abrirse una sesión a su base de datos deQueueMetrics. + +
+
+
+Contraseña de la base de datos de QueueMetrics - ésta es lacontraseña usada para abrirse una sesión a su base de datos deQueueMetrics. + +
+
+
+URL de QueueMetrics - Ésta es la dirección del URL o del Web siteusada para conseguir a su instalación de QueueMetrics. + +
+
+
+Identificación del registro de QueueMetrics - ésta es laidentificación del servidor que todos los registros de VICIDIAL queentran la base de datos de QueueMetrics utilizarán como identificadorpara cada expediente. + +
+
+
+QueueMetrics EnterQueue prepend - este campo se utiliza para permitirprepending de una de las zonas de informaciones del vicidial_listdelante del número de teléfono del cliente para los informesmodificados para requisitos particulares de QueueMetrics. El defectono es NINGUNO no poblar cualquier cosa. + +
+
+
+El agente de VICIDIAL inhabilita la exhibición - este campo seutiliza para seleccionar cuando demostrar a un agente cuando susesión ha sido inhabilitada por el sistema, una acción del encargadoo por una medida externa. El ajuste de NOT_ACTIVE inhabilitará elmensaje en la pantalla de los agentes. El ajuste de LIVE_AGENTexhibirá solamente el mensaje lisiado cuando se ha quitado elexpediente de los vicidial_auto_calls de los agentes, por ejemplodurante un registro de estado de la máquina de la fuerza o registrode estado de la máquina de la emergencia. + +
+
+
+Permita los mensajes de SIPSAK - si el sistema a 1, éste permite queel ajuste de la tabla de los teléfonos trabaje correctamente, elservidor enviará mensajes al teléfono del SIP a la exhibición en laexhibición del LCD del teléfono cuando está registrado en VICIDIAL.Esta característica trabaja solamente con los teléfonos del SIP yrequiere el uso del sipsak ser instalada en el web server. El defectoes 0. + +
+
+
+URL casero del Admin - ésta es la dirección del URL o del Web siteque usted irá si usted chasca encendido el acoplamiento CASERO en latapa de la página de admin.php. + +
+
+
+Permita el logfile de la transferencia del agente - esta opciónregistrará a un logfile del texto en el webserver cada vez que unallamada se transfiere a un agente. El defecto es 0, inhabilitado. + + + + + +



+ +VICIDIAL_STATUSES TABLA

+
+
+Con el uso de los estados de sistema, usted puede tener estados queexistan para la campaña y el en-grupo. El estado debe ser 1-6caracteres en longitud, la descripción debe ser 2-30 caracteres enlongitud y seleccionable define si demuestra para arriba en VICIDIALcomo disposición del agente. Human_answered el campo se utiliza alcalcular el porcentaje de la gota, o la tarifa del abandono. El ajustehuman_answered a Y utilizará este estado al contar las llamadashumano-contestadas. La opción de la categoría permite que ustedagrupe varios estados en un catogy que se pueda utilizar para elanálisis estadístico. + + +



+ +VICIDIAL_STATUS_CATEGORIES TABLA

+
+
+Con el uso de las categorías del estado de sistema, usted puedeagrupar juntos estados para tener en cuenta análisis estadístico enun grupo de estados. La identificación de la categoría debe ser 2-20caracteres en longitud sin espacios, el nombre debe ser 2-50caracteres en longitud, la descripción es opcional y la exhibiciónde TimeonVDAD define si ese estado será uno de hasta que 4 estadosque se puedan calcular y exhibir en el tiempo en informe del tiemporeal de VDAD. + + + + +







+







+EL EXTREMO +
+\n"; + echo "\n"; + echo "\n"; + echo ""; + + $stmt="SELECT dial_statuses,local_call_time,lead_filter_id from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $dial_statuses = $row[0]; + $local_call_time = $row[1]; + if ($lead_filter_id=='') + { + $lead_filter_id = $row[2]; + if ($lead_filter_id=='') + { + $lead_filter_id='NONE'; + } + } + + $stmt="SELECT list_id,active,list_name from vicidial_lists where campaign_id='$campaign_id'"; + $rslt=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rslt); + $camp_lists=''; + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + if (ereg("Y", $rowx[1])) {$camp_lists .= "'$rowx[0]',";} + } + $camp_lists = eregi_replace(".$","",$camp_lists); + + $filterSQL = $filtersql_list[$lead_filter_id]; + $filterSQL = eregi_replace("^and|and$|^or|or$","",$filterSQL); + if (strlen($filterSQL)>4) + {$fSQL = "and $filterSQL";} + else + {$fSQL = '';} + + + echo "

\n"; + echo "Demuestre La Cuenta De los Plomos De Dialable -

\n"; + echo "CAMPAIGN: $campaign_id
\n"; + echo "LISTAS: $camp_lists
\n"; + echo "STATUSES: $dial_statuses
\n"; + echo "FILTER: $lead_filter_id
\n"; + echo "CALL TIME: $local_call_time

\n"; + + ### call function to calculate and print dialable leads + dialable_leads($DB,$link,$local_call_time,$dial_statuses,$camp_lists,$fSQL); + + echo "

\n"; + echo "\n"; + + exit; + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + +###################### +# ADD=7111111 view sample script with test variables +###################### + +if ($ADD==7111111) +{ + ##### TEST VARIABLES ##### + $vendor_lead_code = 'VENDOR:LEAD;CODE'; + $list_id = 'LISTID'; + $gmt_offset_now = 'GMTOFFSET'; + $phone_code = '1'; + $phone_number = '7275551212'; + $title = 'Mr.'; + $first_name = 'JOHN'; + $middle_initial = 'Q'; + $last_name = 'PUBLIC'; + $address1 = '1234 Main St.'; + $address2 = 'Apt. 3'; + $address3 = 'ADDRESS3'; + $city = 'CHICAGO'; + $state = 'IL'; + $province = 'PROVINCE'; + $postal_code = '33760'; + $country_code = 'USA'; + $gender = 'M'; + $date_of_birth = '1970-01-01'; + $alt_phone = '3125551212'; + $email = 'test@test.com'; + $security_phrase = 'SECUTIRY'; + $comments = 'COMMENTS FIELD'; + $RGfullname = 'JOE AGENT'; + $RGuser = '6666'; + $RGlead_id = '1234'; + $RGcampaign = 'TESTCAMP'; + $RGphone_login = 'gs102'; + $RGgroup = 'TESTCAMP'; + $RGchannel_group = 'TESTCAMP'; + $RGSQLdate = date("Y-m-d H:i:s"); + $RGepoch = date("U"); + $RGuniqueid = '1163095830.4136'; + $RGcustomer_zap_channel = 'Zap/1-1'; + $RGserver_ip = '10.10.10.15'; + $RGSIPexten = 'SIP/gs102'; + $RGsession_id = '8600051'; + +echo "\n"; +echo "\n"; +echo "\n"; +echo ""; + +$stmt="SELECT * from vicidial_scripts where script_id='$script_id';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$script_name = $row[1]; +$script_text = $row[3]; + +if (eregi("iframe src",$script_text)) + { + $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(' ','+',$address2); + $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); + $RGfullname = eregi_replace(' ','+',$RGfullname); + $RGuser = eregi_replace(' ','+',$RGuser); + $RGlead_id = eregi_replace(' ','+',$RGlead_id); + $RGcampaign = eregi_replace(' ','+',$RGcampaign); + $RGphone_login = eregi_replace(' ','+',$RGphone_login); + $RGgroup = eregi_replace(' ','+',$RGgroup); + $RGchannel_group = eregi_replace(' ','+',$RGchannel_group); + $RGSQLdate = eregi_replace(' ','+',$RGSQLdate); + $RGepoch = eregi_replace(' ','+',$RGepoch); + $RGuniqueid = eregi_replace(' ','+',$RGuniqueid); + $RGcustomer_zap_channel = eregi_replace(' ','+',$RGcustomer_zap_channel); + $RGserver_ip = eregi_replace(' ','+',$RGserver_ip); + $RGSIPexten = eregi_replace(' ','+',$RGSIPexten); + $RGsession_id = eregi_replace(' ','+',$RGsession_id); + } + +$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--fullname--B--',"$RGfullname",$script_text); +$script_text = eregi_replace('--A--fronter--B--',"$RGuser",$script_text); +$script_text = eregi_replace('--A--user--B--',"$RGuser",$script_text); +$script_text = eregi_replace('--A--lead_id--B--',"$RGlead_id",$script_text); +$script_text = eregi_replace('--A--campaign--B--',"$RGcampaign",$script_text); +$script_text = eregi_replace('--A--phone_login--B--',"$RGphone_login",$script_text); +$script_text = eregi_replace('--A--group--B--',"$RGgroup",$script_text); +$script_text = eregi_replace('--A--channel_group--B--',"$RGchannel_group",$script_text); +$script_text = eregi_replace('--A--SQLdate--B--',"$RGSQLdate",$script_text); +$script_text = eregi_replace('--A--epoch--B--',"$RGepoch",$script_text); +$script_text = eregi_replace('--A--uniqueid--B--',"$RGuniqueid",$script_text); +$script_text = eregi_replace('--A--customer_zap_channel--B--',"$RGcustomer_zap_channel",$script_text); +$script_text = eregi_replace('--A--server_ip--B--',"$RGserver_ip",$script_text); +$script_text = eregi_replace('--A--SIPexten--B--',"$RGSIPexten",$script_text); +$script_text = eregi_replace('--A--session_id--B--',"$RGsession_id",$script_text); +$script_text = eregi_replace("\n","
",$script_text); + + +echo ""; + +echo "Escritura De la Inspección previo: $script_id
\n"; +echo "
\n"; +echo "
$script_name
\n"; +echo "$script_text\n"; +echo "
\n"; + +echo "\n"; + +exit; +} + + + + +######################### HTML HEADER BEGIN ####################################### +if ($hh=='users') + {$users_hh="bgcolor =\"$users_color\""; $users_fc="$users_font"; $users_bold="$header_selected_bold";} + else {$users_hh=''; $users_fc='WHITE'; $users_bold="$header_nonselected_bold";} +if ($hh=='campaigns') + {$campaigns_hh="bgcolor=\"$campaigns_color\""; $campaigns_fc="$campaigns_font"; $campaigns_bold="$header_selected_bold";} + else {$campaigns_hh=''; $campaigns_fc='WHITE'; $campaigns_bold="$header_nonselected_bold";} +if ($hh=='lists') + {$lists_hh="bgcolor=\"$lists_color\""; $lists_fc="$lists_font"; $lists_bold="$header_selected_bold";} + else {$lists_hh=''; $lists_fc='WHITE'; $lists_bold="$header_nonselected_bold";} +if ($hh=='ingroups') + {$ingroups_hh="bgcolor=\"$ingroups_color\""; $ingroups_fc="$ingroups_font"; $ingroups_bold="$header_selected_bold";} + else {$ingroups_hh=''; $ingroups_fc='WHITE'; $ingroups_bold="$header_nonselected_bold";} +if ($hh=='remoteagent') + {$remoteagent_hh="bgcolor=\"$remoteagent_color\""; $remoteagent_fc="$remoteagent_font"; $remoteagent_bold="$header_selected_bold";} + else {$remoteagent_hh=''; $remoteagent_fc='WHITE'; $remoteagent_bold="$header_nonselected_bold";} +if ($hh=='usergroups') + {$usergroups_hh="bgcolor=\"$usergroups_color\""; $usergroups_fc="$usergroups_font"; $usergroups_bold="$header_selected_bold";} + else {$usergroups_hh=''; $usergroups_fc='WHITE'; $usergroups_bold="$header_nonselected_bold";} +if ($hh=='scripts') + {$scripts_hh="bgcolor=\"$scripts_color\""; $scripts_fc="$scripts_font"; $scripts_bold="$header_selected_bold";} + else {$scripts_hh=''; $scripts_fc='WHITE'; $scripts_bold="$header_nonselected_bold";} +if ($hh=='filters') + {$filters_hh="bgcolor=\"$filters_color\""; $filters_fc="$filters_font"; $filters_bold="$header_selected_bold";} + else {$filters_hh=''; $filters_fc='WHITE'; $filters_bold="$header_nonselected_bold";} +if ($hh=='admin') + {$admin_hh="bgcolor=\"$admin_color\""; $admin_fc="$admin_font"; $admin_bold="$header_selected_bold";} + else {$admin_hh=''; $admin_fc='WHITE'; $admin_bold="$header_nonselected_bold";} +if ($hh=='reports') + {$reports_hh="bgcolor=\"$reports_color\""; $reports_fc="$reports_font"; $reports_bold="$header_selected_bold";} + else {$reports_hh=''; $reports_fc='WHITE'; $reports_bold="$header_nonselected_bold";} + +echo "\n"; +echo " + + +\n"; +echo "
English Español
BGCOLOR=#D9E6FE cellpadding=2 cellspacing=0> + + + + + + + + + + + + + + + 1) { + ?> +> + 1) + { + +# if ($sh=='basic') {$basic_sh="bgcolor=\"$subcamp_color\""; $basic_fc="$subcamp_font";} +# else {$basic_sh=''; $basic_fc='BLACK';} +# if ($sh=='detail') {$detail_sh="bgcolor=\"$subcamp_color\""; $detail_fc="$subcamp_font";} +# else {$detail_sh=''; $detail_fc='BLACK';} +# if ($sh=='dialstat') {$dialstat_sh="bgcolor=\"$subcamp_color\""; $dialstat_fc="$subcamp_font";} +# else {$dialstat_sh=''; $dialstat_fc='BLACK';} + + if ($sh=='basic') {$sh='list';} + if ($sh=='detail') {$sh='list';} + if ($sh=='dialstat') {$sh='list';} + + if ($sh=='list') {$list_sh="bgcolor=\"$subcamp_color\""; $list_fc="$subcamp_font";} + else {$list_sh=''; $list_fc='BLACK';} + if ($sh=='status') {$status_sh="bgcolor=\"$subcamp_color\""; $status_fc="$subcamp_font";} + else {$status_sh=''; $status_fc='BLACK';} + if ($sh=='hotkey') {$hotkey_sh="bgcolor=\"$subcamp_color\""; $hotkey_fc="$subcamp_font";} + else {$hotkey_sh=''; $hotkey_fc='BLACK';} + if ($sh=='recycle') {$recycle_sh="bgcolor=\"$subcamp_color\""; $recycle_fc="$subcamp_font";} + else {$recycle_sh=''; $recycle_fc='BLACK';} + if ($sh=='autoalt') {$autoalt_sh="bgcolor=\"$subcamp_color\""; $autoalt_fc="$subcamp_font";} + else {$autoalt_sh=''; $autoalt_fc='BLACK';} + if ($sh=='pause') {$pause_sh="bgcolor=\"$subcamp_color\""; $pause_fc="$subcamp_font";} + else {$pause_sh=''; $pause_fc='BLACK';} + if ($sh=='listmix') {$listmix_sh="bgcolor=\"$subcamp_color\""; $listmix_fc="$subcamp_font";} + else {$listmix_sh=''; $listmix_fc='BLACK';} + + ?> +> + + + + + + + + + 1) { + ?> + > + 1) { + ?> +> + 1) { + ?> +> + 1) { + ?> +> + 1) { + ?> +> + 1) { + ?> +> + 1) { + ?> +> + 1) { + if ($sh=='times') {$times_sh="bgcolor=\"$times_color\""; $times_fc="$times_font";} # hard teal + else {$times_sh=''; $times_fc='BLACK';} + if ($sh=='phones') {$phones_sh="bgcolor=\"$server_color\""; $phones_fc="$phones_font";} # pink + else {$phones_sh=''; $phones_fc='BLACK';} + if ($sh=='server') {$server_sh="bgcolor=\"$server_color\""; $server_fc="$server_font";} # pink + else {$server_sh=''; $server_fc='BLACK';} + if ($sh=='conference') {$conference_sh="bgcolor=\"$server_color\""; $conference_fc="$server_font";} # pink + else {$conference_sh=''; $conference_fc='BLACK';} + if ($sh=='settings') {$settings_sh="bgcolor=\"$settings_color\""; $settings_fc="$settings_font";} # pink + else {$settings_sh=''; $settings_fc='BLACK';} + if ($sh=='status') {$status_sh="bgcolor=\"$status_color\""; $status_fc="$status_font";} # pink + else {$status_sh=''; $status_fc='BLACK';} + + ?> +> + + + + + + + + 1) { + ?> + > + 1) { + ?> + > + 1) { + ?> + > + 1) { + ?> + > + 1) { + ?> + > + 1) { + ?> + > + \n"; + echo "Le no autorizan a visión esta página. Vaya por favor detrás.\n"; + } + +} +if (strlen($reports_hh) > 1) { + ?> +> + + + + +
  VICIDIAL ADMIN - CASERO | Salir  
> SIZE=> Usuarios > SIZE=> Campañas > SIZE=> Listas > SIZE=> Escrituras > SIZE=> Filtros > SIZE=> En-Grupos > SIZE=> Grupos De Usuario > SIZE=> Agentes Alejados > SIZE=> Admin > SIZE=> Informes
>   > Demuestre A Usuarios     |     > Agregue A Nuevo Usuario     |     > Usuario Del Copy     |     > Búsqueda Para Un Usuario
COLSPAN=2> SIZE=>Campañas Principales COLSPAN=1> SIZE=> Statuses COLSPAN=1> SIZE=> HotKeys COLSPAN=2> SIZE=>El Plomo Recicla COLSPAN=1> SIZE=>Dial Automo'vil-Auto-Alt COLSPAN=1> SIZE=>Códigos De la Pausa COLSPAN=2> SIZE=>Mezcla De la Lista
>   > Demuestre Las Campañas     |     > Agregue Una Nueva Campaña     |     > Campaña Del Copy     |     > Campañas En tiempo real Sumarias
>   > Demuestre Las Listas     |     > Agregue Una Nueva Lista     |     > Búsqueda Para Un Plomo     |     > Agregue El Número a DNC     |     > Nuevos Plomos De la Carga
>   > Demuestre Las Escrituras     |     > Agregue Una Nueva Escritura
>   > Demuestre Los Filtros     |     > Agregue Un Filtro Nuevo
>   > Demuestre A En-Grupos     |     > Agregue A Nuevo En-Grupo     |     > En-Grupo Del Copy
>   > Demuestre A Grupos De Usuario     |     > Agregue A Nuevo Grupo De Usuario     |     > Informe Cada hora Del Grupo
>   > Demuestre Los Agentes Alejados     |     > Agregue Los Agentes Alejados Nuevos
COLSPAN=2> SIZE=> Tiempos De la Llamada COLSPAN=2> SIZE=> Teléfonos COLSPAN=2> SIZE=> Conferencias COLSPAN=1> SIZE=> Servidores COLSPAN=1> SIZE=> Ajustes Del Sistema COLSPAN=2> SIZE=>Estados De Sistema
>   > Demuestre Los Tiempos De la Llamada     |     > Agregue Un Nuevo Rato De la Llamada     |     > Demuestre Los Tiempos De la Llamada Del Estado     |     > Agregue Un Nuevo Rato De la Llamada Del Estado  
>   > Demuestre Los Teléfonos   |   > Agregue Un Teléfono Nuevo
> Demuestre Las Conferencias   |   > Agregue Una Nueva Conferencia   |   > Demuestre Las Conferencias de VICIDIAL   |   > Agregue Una Nueva Conferencia de VICIDIAL
> Demuestre Los Servidores   |   > Agregue Un Servidor Nuevo
> Ajustes Del Sistema
>Estados De Sistema   |   >Categorías Del Estado
>  
+
\n"; + echo ""; + + echo "
NUEVO USUARIO
\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "$NWB#vicidial_users-user_group$NWE\n"; + echo "\n"; + echo "
NÚmero De Usuario: $NWB#vicidial_users-user$NWE
Contraseña: $NWB#vicidial_users-pass$NWE
Nombre Completo: $NWB#vicidial_users-full_name$NWE
Nivel Del Usuario: $NWB#vicidial_users-user_level$NWE
Grupo Del Usuario:
Conexión Del Teléfono: $NWB#vicidial_users-phone_login$NWE
Contraseña Del Teléfono: $NWB#vicidial_users-phone_pass$NWE
\n"; + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + +###################### +# ADD=1 display the COPY USER FORM SCREEN +###################### + +if ($ADD=="1A") +{ + if ($LOGmodify_users==1) + { + echo "
\n"; + echo ""; + + echo "
USUARIO DEL COPY\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + if ($LOGuser_level==9) {$levelMAX=10;} + else {$levelMAX=$LOGuser_level;} + + echo "\n"; + echo "\n"; + echo "
NÚmero De Usuario: $NWB#vicidial_users-user$NWE
Contraseña: $NWB#vicidial_users-pass$NWE
Nombre Completo: $NWB#vicidial_users-full_name$NWE
Source User: $NWB#vicidial_users-user$NWE
\n"; + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + +###################### +# ADD=11 display the ADD NEW CAMPAIGN FORM SCREEN +###################### + +if ($ADD==11) +{ + if ($LOGmodify_campaigns==1) + { + echo "
\n"; + echo ""; + + echo "
NUEVA CAMPAÑA\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
ID De la Campaña: $NWB#vicidial_campaigns-campaign_id$NWE
Nombre de la Campaña: $NWB#vicidial_campaigns-campaign_name$NWE
Descripción De la Campaña: $NWB#vicidial_campaigns-campaign_description$NWE
Activo: $NWB#vicidial_campaigns-active$NWE
Extensión del parking: $NWB#vicidial_campaigns-park_ext$NWE
Nombre de fichero Del Parking: $NWB#vicidial_campaigns-park_file_name$NWE
Formulario Web: $NWB#vicidial_campaigns-web_form_address$NWE
Permitir Closers: $NWB#vicidial_campaigns-allow_closers$NWE
Nivel Del Hopper: $NWB#vicidial_campaigns-hopper_level$NWE
Nivel del Auto-Dial: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE
Llamar al Siguiente Agente: $NWB#vicidial_campaigns-next_agent_call$NWE
Franja horaria de llamada: $NWB#vicidial_campaigns-local_call_time$NWE
Buzón de Voz: $NWB#vicidial_campaigns-voicemail_ext$NWE
Escritura: $NWB#vicidial_campaigns-campaign_script$NWE
Consiga El Lanzamiento De la Llamada: $NWB#vicidial_campaigns-get_call_launch$NWE
\n"; + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + +###################### +# ADD=12 display the COPY CAMPAIGN FORM SCREEN +###################### + +if ($ADD==12) +{ + if ($LOGmodify_campaigns==1) + { + echo "
\n"; + echo ""; + + echo "
Copy Una CAMPAÑA\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + + echo "\n"; + echo "
ID De la Campaña: $NWB#vicidial_campaigns-campaign_id$NWE
Nombre de la Campaña: $NWB#vicidial_campaigns-campaign_name$NWE
Campaña De la Fuente:$NWB#vicidial_campaigns-campaign_id$NWE
\n"; + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + +###################### +# ADD=111 display the ADD NEW LIST FORM SCREEN +###################### + +if ($ADD==111) +{ + if ($LOGmodify_lists==1) + { + echo "
\n"; + echo ""; + + echo "
ADD A NEW LIST\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
ID De la Lista: (Solamente dígitos)$NWB#vicidial_lists-list_id$NWE
Nombre De la Lista: $NWB#vicidial_lists-list_name$NWE
Descripción De la Lista: $NWB#vicidial_lists-list_description$NWE
Campaña: $NWB#vicidial_lists-campaign_id$NWE
Activo: $NWB#vicidial_lists-active$NWE
\n"; + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + +###################### +# ADD=121 display the ADD NUMBER TO DNC FORM SCREEN and add a new number +###################### + +if ($ADD==121) +{ +echo "
\n"; +echo ""; + +if (strlen($phone_number) > 2) + { + $stmt="SELECT count(*) from vicidial_dnc where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
DNC NO AGREGADO - este número de teléfono está en no llama ya lalista: $phone_number

\n";} + else + { + $stmt="INSERT INTO vicidial_dnc (phone_number) values('$phone_number');"; + $rslt=mysql_query($stmt, $link); + + echo "
DNC AGREGADO: $phone_number

\n"; + + ### LOG INSERTION TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW DNC NUMBER|$PHP_AUTH_USER|$ip|'$phone_number'|\n"); + fclose($fp); + } + } + } + +echo "
AGREGUE Un NÚMERO A la LISTA De DNC\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "
Número De Teléfono: (Solamente dígitos)$NWB#vicidial_list-dnc$NWE
\n"; + +} + + +###################### +# ADD=1111 display the ADD NEW INBOUND GROUP SCREEN +###################### + +if ($ADD==1111) +{ + if ($LOGmodify_ingroups==1) + { + echo "
\n"; + echo ""; + + echo "
NUEVO GRUPO DE ENTRADA\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
ID De Grupo: (no spaces)$NWB#vicidial_inbound_groups-group_id$NWE
Nombre De Grupo: $NWB#vicidial_inbound_groups-group_name$NWE
Color Del Grupo: $NWB#vicidial_inbound_groups-group_color$NWE
Activo: $NWB#vicidial_inbound_groups-active$NWE
Formulario Web: $NWB#vicidial_inbound_groups-web_form_address$NWE
Buzón de Voz: $NWB#vicidial_inbound_groups-voicemail_ext$NWE
Llamar al Siguiente Agente: $NWB#vicidial_inbound_groups-next_agent_call$NWE
Mostrar Fronter: $NWB#vicidial_inbound_groups-fronter_display$NWE
Escritura: $NWB#vicidial_inbound_groups-ingroup_script$NWE
Consiga El Lanzamiento De la Llamada: $NWB#vicidial_inbound_groups-get_call_launch$NWE
\n"; + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + +###################### +# ADD=1211 display the COPY INBOUND GROUP SCREEN +###################### + +if ($ADD==1211) +{ + if ($LOGmodify_ingroups==1) + { + echo "
\n"; + echo ""; + + echo "
GRUPO DE ENTRADA DEL COPY\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + + echo "\n"; + echo "
ID De Grupo: (no spaces)$NWB#vicidial_inbound_groups-group_id$NWE
Nombre De Grupo: $NWB#vicidial_inbound_groups-group_name$NWE
Source ID De Grupo: $NWB#vicidial_inbound_groups-group_id$NWE
\n"; + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + +###################### +# ADD=11111 display the ADD NEW REMOTE AGENTS SCREEN +###################### + +if ($ADD==11111) +{ + if ($LOGmodify_remoteagents==1) + { + echo "
\n"; + echo ""; + + echo "
NUEVO AGENTE REMOTO\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Comienzo Del ID del usuario: (Solamente números, incremented)$NWB#vicidial_remote_agents-user_start$NWE
Número de líneas: (Solamente números)$NWB#vicidial_remote_agents-number_of_lines$NWE
IP Del Servidor: $NWB#vicidial_remote_agents-server_ip$NWE
Extensión Externa: (número del dial plan para alcanzar agentes)$NWB#vicidial_remote_agents-conf_exten$NWE
Estado: $NWB#vicidial_remote_agents-status$NWE
Campaña: $NWB#vicidial_remote_agents-campaign_id$NWE
Grupos De entrada: \n"; + echo "$groups_list"; + echo "$NWB#vicidial_remote_agents-closer_campaigns$NWE
\n"; + echo "NOTA: Puede tomar hasta 30 segundos para los cambios sometidos en esta pantalla para ir viva\n"; + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + +###################### +# ADD=111111 display the ADD NEW USERS GROUP SCREEN +###################### + +if ($ADD==111111) +{ + if ($LOGmodify_usergroups==1) + { + echo "
\n"; + echo ""; + + echo "
NUEVO GRUPO DE USUARIOS\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Grupo: (sin espacios o signos de puntuación)$NWB#vicidial_user_groups-user_group$NWE
Descripción: (Descripción del grupo)$NWB#vicidial_user_groups-group_name$NWE
\n"; + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + +###################### +# ADD=1111111 display the ADD NEW SCRIPT SCREEN +###################### + +if ($ADD==1111111) +{ + if ($LOGmodify_scripts==1) + { + echo "
\n"; + echo ""; + + echo "
ADD NEW SCRIPT\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Identificación De la Escritura:: (sin espacios o signos de puntuación)$NWB#vicidial_scripts-script_id$NWE
Nombre de la escritura: (título de la escritura)$NWB#vicidial_scripts-script_name$NWE
Comentarios de la escritura: $NWB#vicidial_scripts-script_comments$NWE
Activo: $NWB#vicidial_scripts-active$NWE
Texto de la escritura: "; + # BEGIN Insert Field + echo ""; + echo "
"; + # END Insert Field + echo " $NWB#vicidial_scripts-script_text$NWE
\n"; + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + +###################### +# ADD=11111111 display the ADD NEW FILTER SCREEN +###################### + +if ($ADD==11111111) +{ + if ($LOGmodify_filters==1) + { + echo "
\n"; + echo ""; + + echo "
AGREGUE EL FILTRO NUEVO\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Identificación Del Filtro: (sin espacios o signos de puntuación)$NWB#vicidial_lead_filters-lead_filter_id$NWE
Nombre Del Filtro: (descripción corta del filtro)$NWB#vicidial_lead_filters-lead_filter_name$NWE
Comentarios Del Filtro: $NWB#vicidial_lead_filters-lead_filter_comments$NWE
Filtro Sql: $NWB#vicidial_lead_filters-lead_filter_sql$NWE
\n"; + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + +###################### +# ADD=111111111 display the ADD NEW CALL TIME SCREEN +###################### + +if ($ADD==111111111) +{ + if ($LOGmodify_call_times==1) + { + echo "
\n"; + echo ""; + + echo "
AGREGUE EL NUEVO TIEMPO DE LA LLAMADA\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "
Identificación Del Tiempo De la Llamada: (sin espacios o signos de puntuación)$NWB#vicidial_call_times-call_time_id$NWE
Nombre Del Tiempo De la Llamada: (descripción corta del tiempo de la llamada)$NWB#vicidial_call_times-call_time_name$NWE
Comentarios Del Tiempo De la Llamada: $NWB#vicidial_call_times-call_time_comments$NWE
Las opciones del día y del tiempo aparecerán una vez que usted hayacreado la definición del tiempo de la llamada
\n"; + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + +###################### +# ADD=1111111111 display the ADD NEW STATE CALL TIME SCREEN +###################### + +if ($ADD==1111111111) +{ + if ($LOGmodify_call_times==1) + { + echo "
\n"; + echo ""; + + echo "
AGREGUE EL NUEVO TIEMPO DE LA LLAMADA DEL ESTADO\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "
Identificación Del Tiempo De la Llamada Del Estado: (sin espacios o signos de puntuación)$NWB#vicidial_call_times-call_time_id$NWE
State Call Time State: (sin espacios o signos de puntuación)$NWB#vicidial_call_times-state_call_time_state$NWE
_ Estado Llamar Tiempo Nombre: (descripción corta del tiempo de la llamada)$NWB#vicidial_call_times-call_time_name$NWE
Comentarios Del Tiempo De la Llamada Del Estado: $NWB#vicidial_call_times-call_time_comments$NWE
Las opciones del día y del tiempo aparecerán una vez que usted hayacreado la definición del tiempo de la llamada
\n"; + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + +###################### +# ADD=11111111111 display the ADD NEW PHONE SCREEN +###################### + +if ($ADD==11111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + echo "
AGREGUE Un TELÉFONO NUEVO\n"; + echo "\n"; + echo "
\n"; + + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Extensión del teléfono: $NWB#phones-extension$NWE
Número De Dial plan: (Solamente dígitos)$NWB#phones-dialplan_number$NWE
Buzón de voz: (Solamente dígitos)$NWB#phones-voicemail_id$NWE
CallerID De salida: (Solamente dígitos)$NWB#phones-outbound_cid$NWE
Dirección IP del teléfono: (optional)$NWB#phones-phone_ip$NWE
Dirección IP del ordenador: (optional)$NWB#phones-computer_ip$NWE
IP Del Servidor: $NWB#phones-server_ip$NWE
Login: $NWB#phones-login$NWE
Contraseña: $NWB#phones-pass$NWE
Estado: $NWB#phones-status$NWE
Cuenta Activa: $NWB#phones-active$NWE
Tipo Del Teléfono: $NWB#phones-phone_type$NWE
Nombre Completo: $NWB#phones-fullname$NWE
Compañía: $NWB#phones-company$NWE
Foto: $NWB#phones-picture$NWE
Protocolo Del Cliente: $NWB#phones-protocol$NWE
GMT Local: (No ajustar para el DST)$NWB#phones-local_gmt$NWE
\n"; + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + +###################### +# ADD=111111111111 display the ADD NEW SERVER SCREEN +###################### + +if ($ADD==111111111111) +{ + if ($LOGmodify_servers==1) + { + echo "
\n"; + echo ""; + + echo "
AGREGAR Un SERVIDOR NUEVO\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
ID Del Servidor: $NWB#servers-server_id$NWE
Descripción Del Servidor: $NWB#servers-server_description$NWE
Dirección IP del Servidor: $NWB#servers-server_ip$NWE
Activo: $NWB#servers-active$NWE
Versión De Asterisk: $NWB#servers-asterisk_version$NWE
\n"; + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + +###################### +# ADD=1111111111111 display the ADD NEW CONFERENCE SCREEN +###################### + +if ($ADD==1111111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + echo "
AGREGUE Una NUEVA CONFERENCIA\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Número de la Conferencia: (Solamente dígitos)$NWB#conferences-conf_exten$NWE
IP Del Servidor: $NWB#conferences-server_ip$NWE
\n"; + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + +###################### +# ADD=11111111111111 display the ADD NEW VICIDIAL CONFERENCE SCREEN +###################### + +if ($ADD==11111111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + echo "
ADD A NEW VICIDIAL CONFERENCE\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Número de la Conferencia: (Solamente dígitos)$NWB#conferences-conf_exten$NWE
IP Del Servidor: $NWB#conferences-server_ip$NWE
\n"; + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + + +###################################################################################################### +###################################################################################################### +####### 2 series, validates form data and inserts the new record into the database +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=2 adds the new user to the system +###################### + +if ($ADD=="2") +{ + echo ""; + $stmt="SELECT count(*) from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
USUARIO NO AGREGADO - hay ya un usuario en el sistema con este número del usuario\n";} + else + { + if ( (strlen($user) < 2) or (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user) > 8) ) + { + echo "
USUARIO NO AGREGADO - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
la ID del usuario debe estar entre 2 y 8 caracteres de largo\n"; + echo "
el nombre completo y la contraseña deben ser por lo menos 2 caracteres de largo\n"; + } + else + { + echo "
EL USUARIOAÑADIDO: $user\n"; + + $stmt="INSERT INTO vicidial_users (user,pass,full_name,user_level,user_group,phone_login,phone_pass) values('$user','$pass','$full_name','$user_level','$user_group','$phone_login','$phone_pass');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A USER |$PHP_AUTH_USER|$ip|'$user','$pass','$full_name','$user_level','$user_group','$phone_login','$phone_pass'|\n"); + fclose($fp); + } + } + } + +$ADD=3; +} + +###################### +# ADD=2A adds the copied new user to the system +###################### + +if ($ADD=="2A") +{ + echo ""; + $stmt="SELECT count(*) from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
USUARIO NO AGREGADO - hay ya un usuario en el sistema con este número del usuario\n";} + else + { + if ( (strlen($user) < 2) or (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user) > 8) ) + { + echo "
USUARIO NO AGREGADO - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
la ID del usuario debe estar entre 2 y 8 caracteres de largo\n"; + echo "
el nombre completo y la contraseña deben ser por lo menos 2 caracteres de largo\n"; + } + else + { + $stmt="INSERT INTO vicidial_users (user,pass,full_name,user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override) SELECT \"$user\",\"$pass\",\"$full_name\",user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override from vicidial_users where user=\"$source_user_id\";"; + $rslt=mysql_query($stmt, $link); + + $stmtA="INSERT INTO vicidial_inbound_group_agents (user,group_id,group_rank,group_weight,calls_today) SELECT \"$user\",group_id,group_rank,group_weight,\"0\" from vicidial_inbound_group_agents where user=\"$source_user_id\";"; + $rslt=mysql_query($stmtA, $link); + + $stmtA="INSERT INTO vicidial_campaign_agents (user,campaign_id,campaign_rank,campaign_weight,calls_today) SELECT \"$user\",campaign_id,campaign_rank,campaign_weight,\"0\" from vicidial_campaign_agents where user=\"$source_user_id\";"; + $rslt=mysql_query($stmtA, $link); + + echo "
USER COPIED: $user copied from $source_user_id\n"; + echo "

\n"; + echo "Click here to go to the user record\n"; + echo "

\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A COPIED USER |$PHP_AUTH_USER|$ip|$user|$source_user_id|$stmt|\n"); + fclose($fp); + } + } + } +exit; +} + +###################### +# ADD=21 adds the new campaign to the system +###################### + +if ($ADD==21) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAÚA NO AGREGADA - hay ya una campaña en el sistema con esta identificación\n";} + else + { + $stmt="SELECT count(*) from vicidial_inbound_groups where group_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN NOT ADDED - there is already an inbound group in the system with this ID\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($campaign_id) > 8) or (strlen($campaign_name) < 6) or (strlen($campaign_name) > 40) ) + { + echo "
CAMPAÚA NO AGREGADA - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
la ID de la campaña debe estar entre 2 y 8 caracteres en longitud\n"; + echo "
el nombre de la campaña debe estar entre 6 y 40 caracteres en longitud\n"; + } + else + { + echo "
CAMPAÑA AÑADIDA: $campaign_id\n"; + + $stmt="INSERT INTO vicidial_campaigns (campaign_id,campaign_name,campaign_description,active,dial_status_a,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,campaign_script,get_call_launch,campaign_changedate,campaign_stats_refresh,list_order_mix) values('$campaign_id','$campaign_name','$campaign_description','$active','NEW','DOWN','$park_ext','$park_file_name','" . mysql_real_escape_string($web_form_address) . "','$allow_closers','$hopper_level','$auto_dial_level','$next_agent_call','$local_call_time','$voicemail_ext','$script_id','$get_call_launch','$SQLdate','Y','DISABLED');"; + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_campaign_stats (campaign_id) values('$campaign_id');"; + $rslt=mysql_query($stmt, $link); + + echo ""; + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|NUEVA CAMPAÑA |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + } + } + } +$ADD=31; +} + +###################### +# ADD=20 adds copied new campaign to the system +###################### + +if ($ADD==20) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAÚA NO AGREGADA - hay ya una campaña en el sistema con esta identificación\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($campaign_id) > 8) or (strlen($campaign_name) < 2) or (strlen($source_campaign_id) < 2) or (strlen($source_campaign_id) > 8) ) + { + echo "
CAMPAÚA NO AGREGADA - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
la ID de la campaña debe estar entre 2 y 8 caracteres en longitud\n"; + echo "
source la ID de la campaña debe estar entre 2 y 8 caracteres en longitud\n"; + } + else + { + echo "
CAMPAIGN COPIED: $campaign_id copied from $source_campaign_id\n"; + + $stmt="INSERT INTO vicidial_campaigns (campaign_name,campaign_id,active,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,safe_harbor_message,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,list_order_mix,campaign_allow_inbound,manual_dial_list_id,default_xfer_group) SELECT \"$campaign_name\",\"$campaign_id\",\"N\",dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,safe_harbor_message,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,\"DISABLED\",campaign_allow_inbound,manual_dial_list_id,default_xfer_group from vicidial_campaigns where campaign_id='$source_campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmtA="INSERT INTO vicidial_campaign_stats (campaign_id) values('$campaign_id');"; + $rslt=mysql_query($stmtA, $link); + + $stmtA="INSERT INTO vicidial_campaign_statuses (status,status_name,selectable,campaign_id,human_answered,category) SELECT status,status_name,selectable,\"$campaign_id\",human_answered,category from vicidial_campaign_statuses where campaign_id='$source_campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + $stmtA="INSERT INTO vicidial_campaign_hotkeys (status,hotkey,status_name,selectable,campaign_id) SELECT status,hotkey,status_name,selectable,\"$campaign_id\" from vicidial_campaign_hotkeys where campaign_id='$source_campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + $stmtA="INSERT INTO vicidial_lead_recycle (status,attempt_delay,attempt_maximum,active,campaign_id) SELECT status,attempt_delay,attempt_maximum,active,\"$campaign_id\" from vicidial_lead_recycle where campaign_id='$source_campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + $stmtA="INSERT INTO vicidial_pause_codes (pause_code,pause_code_name,billable,campaign_id) SELECT pause_code,pause_code_name,billable,\"$campaign_id\" from vicidial_pause_codes where campaign_id='$source_campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + echo ""; + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|COPY TO NEW CAMPAIGN|$PHP_AUTH_USER|$ip|$campaign_id|$source_campaign_id|$stmt|$stmtA|\n"); + fclose($fp); + } + + } + } +$ADD=31; +} + +###################### +# ADD=22 adds the new campaign status to the system +###################### + +if ($ADD==22) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
ESTADO de la CAMPAÚA - hay ya una campaña - estado NO AGREGADO en el sistema con este nombre\n";} + else + { + $stmt="SELECT count(*) from vicidial_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
ESTADO de la CAMPAÚA NO AGREGADO - hay ya un global-estado en el sistema con este nombre\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($status_name) < 2) ) + { + echo "
ESTADO de la CAMPAÚA NO AGREGADO - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
el estado debe estar entre 1 y 8 caracteres en longitud\n"; + echo "
el nombre del estado debe estar entre 2 y 30 caracteres en longitud\n"; + } + else + { + echo "
ESTADO DE LA CAMPAÑA AÑADIDA: $campaign_id - $status\n"; + + $stmt="INSERT INTO vicidial_campaign_statuses (status,status_name,selectable,campaign_id,human_answered,category) values('$status','$status_name','$selectable','$campaign_id','$human_answered','$category');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|NUEVA CAMPAÑA STATUS |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } +$SUB=22; +$ADD=31; +} + + +###################### +# ADD=23 adds the new campaign hotkey to the system +###################### + +if ($ADD==23) +{ + $HKstatus_data = explode('-----',$HKstatus); + $status = $HKstatus_data[0]; + $status_name = $HKstatus_data[1]; + + echo ""; + $stmt="SELECT count(*) from vicidial_campaign_hotkeys where campaign_id='$campaign_id' and hotkey='$hotkey' and hotkey='$hotkey';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN HOT KEY NOT ADDED - there is already a campaign-hotkey in the system with this hotkey\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($hotkey) < 1) ) + { + echo "
CAMPAÚA HOT KEY NO AGREGADA - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
hotkey must be a single character between 1 and 9 \n"; + echo "
el estado debe estar entre 1 y 8 caracteres en longitud\n"; + } + else + { + echo "
ACCESO DIRECTO A LA CAMPAÑA AÑADIDO: $campaign_id - $status - $hotkey\n"; + + $stmt="INSERT INTO vicidial_campaign_hotkeys values('$status','$hotkey','$status_name','$selectable','$campaign_id');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|NUEVA CAMPAÑA HOT KEY |$PHP_AUTH_USER|$ip|'$status','$hotkey','$status_name','$selectable','$campaign_id'|\n"); + fclose($fp); + } + } + } +$SUB=23; +$ADD=31; +} + + +###################### +# ADD=25 adds the new campaign lead recycle entry to the system +###################### + +if ($ADD==25) +{ + $status = eregi_replace("-----.*",'',$status); + echo ""; + $stmt="SELECT count(*) from vicidial_lead_recycle where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
El PLOMO de la CAMPAÑA RECICLA NO AGREGADO - hay ya unconducir-reciclaje para esta campaña con este estado\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or ($attempt_delay < 120) or ($attempt_maximum < 1) or ($attempt_maximum > 10) ) + { + echo "
CAMPAIGN LEAD RECYCLE NOT ADDED - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
el estado debe estar entre 1 y 6 caracteres en longitud\n"; + echo "
la tentativa retrasa debe ser por lo menos 120 segundos\n"; + echo "
las tentativas máximas deben ser a partir la 1 a 10\n"; + } + else + { + echo "
EL PLOMO DE LA CAMPAÑA RECICLA AGREGADO: $campaign_id - $status - $attempt_delay\n"; + + $stmt="INSERT INTO vicidial_lead_recycle(campaign_id,status,attempt_delay,attempt_maximum,active) values('$campaign_id','$status','$attempt_delay','$attempt_maximum','$active');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW LEAD RECYCLE |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$SUB=25; +$ADD=31; +} + + +###################### +# ADD=26 adds the new auto alt dial status to the campaign +###################### + +if ($ADD==26) +{ + $status = eregi_replace("-----.*",'',$status); + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and auto_alt_dial_statuses LIKE \"% $status %\";"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
ESTADO AUTO DEL DIAL DEL ALT NO AGREGADO - hay ya una entrada para esta campaña con este estado\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
ESTADO AUTO DEL DIAL DEL ALT NO AGREGADO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
el estado debe estar entre 1 y 6 caracteres en longitud\n"; + } + else + { + echo "
ESTADO AUTO DEL DIAL DEL ALT AGREGADO: $campaign_id - $status\n"; + + $stmt="SELECT auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if (strlen($row[0])<2) {$row[0] = ' -';} + $auto_alt_dial_statuses = " $status$row[0]"; + $stmt="UPDATE vicidial_campaigns set auto_alt_dial_statuses='$auto_alt_dial_statuses' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A AUTO-ALT-DIAL STATUS|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$SUB=26; +$ADD=31; +} + + +###################### +# ADD=27 adds the new campaign agent pause code entry to the system +###################### + +if ($ADD==27) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_pause_codes where campaign_id='$campaign_id' and pause_code='$pause_code';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CÓDIGO DE LA PAUSA DEL AGENTE NO AGREGADO - hay ya una entrada para esta campaña con este code\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($pause_code) < 1) or (strlen($pause_code) > 6) or (strlen($pause_code_name) < 2) ) + { + echo "
CÓDIGO DE LA PAUSA DEL AGENTE NO AGREGADO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
pause code must be between 1 and 6 characters in length\n"; + echo "
pause code name must be between 2 and 30 characters in length\n"; + } + else + { + echo "
EL CÓDIGO DE LA PAUSA DEL AGENTE AGREGÓ: $campaign_id - $pause_code - $pause_code_name\n"; + + $stmt="INSERT INTO vicidial_pause_codes(campaign_id,pause_code,pause_code_name,billable) values('$campaign_id','$pause_code','$pause_code_name','$billable');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW AGENTE PAUSE CODE|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$SUB=27; +$ADD=31; +} + + +###################### +# ADD=28 adds new status to the campaign dial statuses +###################### + +if ($ADD==28) +{ + $status = eregi_replace("-----.*",'',$status); + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and dial_statuses LIKE \"% $status %\";"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
ESTADO DEL DIAL DE LA CAMPAÑA NO AGREGADO - hay ya una entrada para esta campaña con este estado\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
ESTADO DEL DIAL DE LA CAMPAÑA NO AGREGADO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
el estado debe estar entre 1 y 6 caracteres en longitud\n"; + } + else + { + echo "
EL ESTADO DEL DIAL DE LA CAMPAÑA AGREGÓ: $campaign_id - $status\n"; + + $stmt="SELECT dial_statuses from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if (strlen($row[0])<2) {$row[0] = ' -';} + $dial_statuses = " $status$row[0]"; + $stmt="UPDATE vicidial_campaigns set dial_statuses='$dial_statuses' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|NUEVA CAMPAÑA DIAL STATUS |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +#$SUB=28; +$ADD=31; +} + + +###################### +# ADD=211 adds the new list to the system +###################### + +if ($ADD==211) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
LISTA NO AGREGADA - hay ya una lista en el sistema con esta ID\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($list_name) < 2) or ($list_id < 100) or (strlen($list_id) > 8) ) + { + echo "
LISTA NO AGREGADA - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
La ID de la lista debe estar entre 2 y 8 caracteres en longitud\n"; + echo "
El nombre de la lista debe ser por lo menos 2 caracteres en longitud\n"; + echo "
ID De la Lista must be greater than 100\n"; + } + else + { + echo "
LISTA AÑADIDA: $list_id\n"; + + $stmt="INSERT INTO vicidial_lists (list_id,list_name,campaign_id,active,list_description,list_changedate) values('$list_id','$list_name','$campaign_id','$active','$list_description','$SQLdate');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW LIST |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=311; +} + + + +###################### +# ADD=2111 adds the new inbound group to the system +###################### + +if ($ADD==2111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_inbound_groups where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
GRUPO NO AGREGADO - hay ya un grupo en el sistema con esta ID\n";} + else + { + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
GROUP NOT ADDED - there is already a campaign in the system with this ID\n";} + else + { + if ( (strlen($group_id) < 2) or (strlen($group_name) < 2) or (strlen($group_color) < 2) or (strlen($group_id) > 20) or (eregi(' ',$group_id)) or (eregi("\-",$group_id)) or (eregi("\+",$group_id)) ) + { + echo "
GRUPO NO AGREGADO - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
La ID de grupo debe estar entre 2 y 20 caracteres en longitud y contener no ' -+'.\n"; + echo "
El color del nombre de grupo y del grupo debe ser por lo menos 2 caracteres en longitud\n"; + } + else + { + $stmt="INSERT INTO vicidial_inbound_groups (group_id,group_name,group_color,active,web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch) values('$group_id','$group_name','$group_color','$active','" . mysql_real_escape_string($web_form_address) . "','$voicemail_ext','$next_agent_call','$fronter_display','$script_id','$get_call_launch');"; + $rslt=mysql_query($stmt, $link); + + echo "
GRUPO AÑADIDO: $group_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW GROUP |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } +$ADD=3111; +} + + +###################### +# ADD=2011 adds copied inbound group to the system +###################### + +if ($ADD==2011) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_inbound_groups where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
GRUPO NO AGREGADO - hay ya un grupo en el sistema con esta ID\n";} + else + { + if ( (strlen($group_id) < 2) or (strlen($group_name) < 2) or (strlen($group_id) > 20) or (eregi(' ',$group_id)) or (eregi("\-",$group_id)) or (eregi("\+",$group_id)) ) + { + echo "
GRUPO NO AGREGADO - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
La ID de grupo debe estar entre 2 y 20 caracteres en longitud y contener no ' -+'.\n"; + echo "
El color del nombre de grupo y del grupo debe ser por lo menos 2 caracteres en longitud\n"; + } + else + { + $stmt="INSERT INTO vicidial_inbound_groups (group_id,group_name,group_color,active,web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_message,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group) SELECT \"$group_id\",\"$group_name\",group_color,\"N\",web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_message,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group from vicidial_inbound_groups where group_id=\"$source_group_id\";"; + $rslt=mysql_query($stmt, $link); + + echo "
GRUPO AÑADIDO: $group_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|COPIED TO NEW GROUP |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=3111; +} + + +###################### +# ADD=21111 adds new remote agents to the system +###################### + +if ($ADD==21111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_remote_agents where server_ip='$server_ip' and user_start='$user_start';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
AGENTES ALEJADOS NO AGREGADOS - hay ya una entrada alejada de los agentes comenzando con esta ID del usuario\n";} + else + { + if ( (strlen($server_ip) < 2) or (strlen($user_start) < 2) or (strlen($campaign_id) < 2) or (strlen($conf_exten) < 2) ) + { + echo "
AGENTES ALEJADOS NO AGREGADOS - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
El comienzo de la ID del usuario y la extensión externa deben ser por lo menos 2 caracteres en longitud\n"; + } + else + { + $stmt="INSERT INTO vicidial_remote_agents values('','$user_start','$number_of_lines','$server_ip','$conf_exten','$status','$campaign_id','$groups_value');"; + $rslt=mysql_query($stmt, $link); + + echo "
AGENTES REMOTO AÑADIDO: $user_start\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW AGENTES REMOTOS ENTRY |$PHP_AUTH_USER|$ip|'$user_start','$number_of_lines','$server_ip','$conf_exten','$status','$campaign_id','$groups_value'|\n"); + fclose($fp); + } + } + } +$ADD=10000; +} + +###################### +# ADD=211111 adds new user group to the system +###################### + +if ($ADD==211111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_user_groups where user_group='$user_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
GRUPO de USUARIO NO AGREGADO - hay ya una entrada del grupo de usuario con este nombre\n";} + else + { + if ( (strlen($user_group) < 2) or (strlen($group_name) < 2) ) + { + echo "
GRUPO de USUARIO NO AGREGADO - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
El nombre y la descripción de grupo deben ser por lo menos 2 caracteres en longitud\n"; + } + else + { + $stmt="INSERT INTO vicidial_user_groups(user_group,group_name,allowed_campaigns) values('$user_group','$group_name','-ALL-CAMPAIGNS-');"; + $rslt=mysql_query($stmt, $link); + + echo "
GRUPO DE USUARIO AÑADIDO: $user_group\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|NUEVO USUARIO GROUP ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=100000; +} + +###################### +# ADD=2111111 adds new script to the system +###################### + +if ($ADD==2111111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_scripts where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
ESCRITURA NO AGREGADA - hay ya una entrada de la escritura con este nombre\n";} + else + { + if ( (strlen($script_id) < 2) or (strlen($script_name) < 2) or (strlen($script_text) < 2) ) + { + echo "
ESCRITURA NO AGREGADA - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
El nombre, la descripción y el texto de la escritura deben ser por lo menos 2 caracteres en longitud\n"; + } + else + { + $stmt="INSERT INTO vicidial_scripts values('$script_id','$script_name','$script_comments','$script_text','$active');"; + $rslt=mysql_query($stmt, $link); + + echo "
ESCRITURA AGREGADA: $script_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW SCRIPT ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=1000000; +} + + +###################### +# ADD=21111111 adds new filter to the system +###################### + +if ($ADD==21111111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_lead_filters where lead_filter_id='$lead_filter_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
FILTRO NO AGREGADO - hay ya una entrada del filtro con esta identificación\n";} + else + { + if ( (strlen($lead_filter_id) < 2) or (strlen($lead_filter_name) < 2) or (strlen($lead_filter_sql) < 2) ) + { + echo "
FILTRO NO AGREGADO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Filtre la identificación, nombre y el SQL debe ser por lo menos 2 caracteres en longitud\n"; + } + else + { + $stmt="INSERT INTO vicidial_lead_filters SET lead_filter_id='$lead_filter_id',lead_filter_name='$lead_filter_name',lead_filter_comments='$lead_filter_comments',lead_filter_sql='$lead_filter_sql';"; + $rslt=mysql_query($stmt, $link); + + echo "
EL FILTRO AGREGÓ: $lead_filter_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW FILTER ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=10000000; +} + + +###################### +# ADD=211111111 adds new call time definition to the system +###################### + +if ($ADD==211111111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_call_times where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
DEFINICIÓN DEL TIEMPO DE LA LLAMADA NO AGREGADA - hay ya una entrada de tiempo de la llamada con esta identificación\n";} + else + { + if ( (strlen($call_time_id) < 2) or (strlen($call_time_name) < 2) ) + { + echo "
DEFINICIÓN DEL TIEMPO DE LA LLAMADA NO AGREGADA - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
La identificación del tiempo de la llamada y el nombre deben ser porlo menos 2 caracteres en longitud\n"; + } + else + { + $stmt="INSERT INTO vicidial_call_times SET call_time_id='$call_time_id',call_time_name='$call_time_name',call_time_comments='$call_time_comments';"; + $rslt=mysql_query($stmt, $link); + + echo "
TIEMPO DE LA LLAMADA AGREGADO: $call_time_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW CALL TIME ENTRY |$stmt|\n"); + fclose($fp); + } + } + } +$ADD=311111111; +} + + +###################### +# ADD=2111111111 adds new state call time definition to the system +###################### + +if ($ADD==2111111111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_state_call_times where state_call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
DEFINICIÓN DEL TIEMPO DE LA LLAMADA DEL ESTADO NO AGREGADA - hay ya una entrada de tiempo de la llamada con esta identificación\n";} + else + { + if ( (strlen($call_time_id) < 2) or (strlen($call_time_name) < 2) or (strlen($state_call_time_state) < 2) ) + { + echo "
DEFINICIÓN DEL TIEMPO DE LA LLAMADA DEL ESTADO NO AGREGADA - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Indique que identificación del tiempo de la llamada, nombre y estadodebe ser por lo menos 2 caracteres en longitud\n"; + } + else + { + $stmt="INSERT INTO vicidial_state_call_times SET state_call_time_id='$call_time_id',state_call_time_name='$call_time_name',state_call_time_comments='$call_time_comments',state_call_time_state='$state_call_time_state';"; + $rslt=mysql_query($stmt, $link); + + echo "
TIEMPO DE LA LLAMADA DEL ESTADO AGREGADO: $call_time_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW STATE CALL TIME ENTRY|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=3111111111; +} + + +###################### +# ADD=21111111111 adds new phone to the system +###################### + +if ($ADD==21111111111) +{ +echo "
\n"; + echo ""; + $stmt="SELECT count(*) from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
TELÉFONO NO AGREGADO - hay ya un teléfono en el sistema con esta extensión/servidor\n";} + else + { + if ( (strlen($extension) < 1) or (strlen($server_ip) < 7) or (strlen($dialplan_number) < 1) or (strlen($voicemail_id) < 1) or (strlen($login) < 1) or (strlen($pass) < 1)) + {echo "
TELÉFONO NO AGREGADO - vaya por favor detrás y mire los datos que usted incorporó\n";} + else + { + echo "
EL TELÉFONO AGREGÚ\n"; + + $stmt="INSERT INTO phones (extension,dialplan_number,voicemail_id,phone_ip,computer_ip,server_ip,login,pass,status,active,phone_type,fullname,company,picture,protocol,local_gmt,outbound_cid) values('$extension','$dialplan_number','$voicemail_id','$phone_ip','$computer_ip','$server_ip','$login','$pass','$status','$active','$phone_type','$fullname','$company','$picture','$protocol','$local_gmt','$outbound_cid');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=31111111111; +} + + +###################### +# ADD=211111111111 adds new server to the system +###################### + +if ($ADD==211111111111) +{ +echo "
\n"; + echo ""; + $stmt="SELECT count(*) from servers where server_id='$server_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
SERVIDOR NO AGREGADO - hay ya un servidor en el sistema con esta identificación\n";} + else + { + if ( (strlen($server_id) < 1) or (strlen($server_ip) < 7) ) + {echo "
SERVIDOR NO AGREGADO - vaya por favor detrás y mire los datos que usted incorporó\n";} + else + { + echo "
SERVIDOR AGREGADO\n"; + + $stmt="INSERT INTO servers (server_id,server_description,server_ip,active,asterisk_version) values('$server_id','$server_description','$server_ip','$active','$asterisk_version');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=311111111111; +} + + +###################### +# ADD=221111111111 adds the new vicidial server trunk record to the system +###################### + +if ($ADD==221111111111) +{ + echo ""; + $stmt="SELECT max_vicidial_trunks from servers where server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $MAXvicidial_trunks = $rowx[0]; + + $stmt="SELECT sum(dedicated_trunks) from vicidial_server_trunks where server_ip='$server_ip' and campaign_id !='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $SUMvicidial_trunks = ($rowx[0] + $dedicated_trunks); + + if ($SUMvicidial_trunks > $MAXvicidial_trunks) + { + echo "
EXPEDIENTE DEL TRONCO DEL SERVIDOR DE VICIDIAL NO AGREGADO - el número de troncos vicidial es demasiado alto: $SUMvicidial_trunks / $MAXvicidial_trunks\n"; + } + else + { + $stmt="SELECT count(*) from vicidial_server_trunks where campaign_id='$campaign_id' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
EXPEDIENTE DEL TRONCO DEL SERVIDOR DE VICIDIAL NO AGREGADO - hay ya un expediente del servidor-tronco para esta campaña\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($server_ip) < 7) or (strlen($dedicated_trunks) < 1) or (strlen($trunk_restriction) < 1) ) + { + echo "
EXPEDIENTE DEL TRONCO DEL SERVIDOR DE VICIDIAL NO AGREGADO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
la campaña debe estar entre 3 y 8 caracteres en longitud\n"; + echo "
el server_ip retrasa debe ser por lo menos 7 caracteres\n"; + echo "
los troncos deben ser un dígito a partir de la 0 a 9999\n"; + } + else + { + echo "
EL EXPEDIENTE DEL TRONCO DEL SERVIDOR DE VICIDIAL AGREGÓ: $campaign_id - $server_ip - $dedicated_trunks - $trunk_restriction\n"; + + $stmt="INSERT INTO vicidial_server_trunks(server_ip,campaign_id,dedicated_trunks,trunk_restriction) values('$server_ip','$campaign_id','$dedicated_trunks','$trunk_restriction');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW VICIDIAL TRUNK |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } +$ADD=311111111111; +} + + +###################### +# ADD=2111111111111 adds new conference to the system +###################### + +if ($ADD==2111111111111) +{ +echo "
\n"; + echo ""; + $stmt="SELECT count(*) from conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CONFERENCIA NO AGREGADA - hay ya una conferencia en el sistema con esta identificación y servidor\n";} + else + { + if ( (strlen($conf_exten) < 1) or (strlen($server_ip) < 7) ) + {echo "
CONFERENCIA NO AGREGADA - vaya por favor detrás y mire los datos que usted incorporó\n";} + else + { + echo "
LA CONFERENCIA AGREGÚ\n"; + + $stmt="INSERT INTO conferences (conf_exten,server_ip) values('$conf_exten','$server_ip');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=3111111111111; +} + + +###################### +# ADD=21111111111111 adds new vicidial conference to the system +###################### + +if ($ADD==21111111111111) +{ +echo "
\n"; + echo ""; + $stmt="SELECT count(*) from vicidial_conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
VICIDIAL CONFERENCE NOT ADDED - there is already a vicidial conference in the system with this ID and server\n";} + else + { + if ( (strlen($conf_exten) < 1) or (strlen($server_ip) < 7) ) + {echo "
VICIDIAL CONFERENCIA NO AGREGADA - vaya por favor detrás y mire los datos que usted incorporó\n";} + else + { + echo "
VICIDIAL LA CONFERENCIA AGREGÚ\n"; + + $stmt="INSERT INTO vicidial_conferences (conf_exten,server_ip) values('$conf_exten','$server_ip');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=31111111111111; +} + + +###################### +# ADD=221111111111111 adds the new system status to the system +###################### + +if ($ADD==221111111111111) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaign_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
ESTADO DE SISTEMA NO AGREGADO - there is already a campaign-status in the system with this name: $row[0]\n";} + else + { + $stmt="SELECT count(*) from vicidial_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
ESTADO DE SISTEMA NO AGREGADO - there is already a global-status in the system with this name\n";} + else + { + if ( (strlen($status) < 1) or (strlen($status_name) < 2) ) + { + echo "
ESTADO DE SISTEMA NO AGREGADO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
el estado debe estar entre 1 y 8 caracteres en longitud\n"; + echo "
el nombre del estado debe estar entre 2 y 30 caracteres en longitud\n"; + } + else + { + echo "
EL ESTADO DE SISTEMA AGREGÓ: $status_name - $status\n"; + + $stmt="INSERT INTO vicidial_statuses (status,status_name,selectable,human_answered,category) values('$status','$status_name','$selectable','$human_answered','$category');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW SYSTEM STATUS |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } +$ADD=321111111111111; +} + + +###################### +# ADD=231111111111111 adds the new status category to the system +###################### + +if ($ADD==231111111111111) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_status_categories where vsc_id='$vsc_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CATEGORÃA DEL ESTADO NO AGREGADA - hay ya una categoría del estado en el sistema con estaidentificación: $row[0]\n";} + else + { + if ( (strlen($vsc_id) < 2) or (strlen($vsc_id) > 20) or (strlen($vsc_name) < 2) ) + { + echo "
CATEGORÃA DEL ESTADO NO AGREGADA - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
La identificación debe estar entre 2 y 20 caracteres en longitud\n"; + echo "
el nombre conocido debe estar entre 2 y 50 caracteres en longitud\n"; + } + else + { + echo "
STATUS CATEGORY ADDED: $vsc_id - $vsc_name\n"; + + $stmt="SELECT count(*) from vicidial_status_categories where tovdad_display='Y' and vsc_id NOT IN('$vsc_id');"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 3) and (ereg('Y',$tovdad_display)) ) + { + $tovdad_display = 'N'; + echo "
ERROR: Hay ya sistema de 4 categorías del estado a la exhibición deTimeOnVDAD\n"; + } + + $stmt="INSERT INTO vicidial_status_categories (vsc_id,vsc_name,vsc_description,tovdad_display) values('$vsc_id','$vsc_name','$vsc_description','$tovdad_display');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW STATUS CATEGORY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=331111111111111; +} + + + +###################################################################################################### +###################################################################################################### +####### 4 series, record modifications submitted and DB is modified, then on to 3 series forms below +###################################################################################################### +###################################################################################################### + + + +###################### +# ADD=4A submit user modifications to the system - ADMIN +###################### + +if ($ADD=="4A") +{ + if ($LOGmodify_users==1) + { + echo ""; + + if ( (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) + { + echo "
USUARIO NO MODIFICADO - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
La contraseña y el nombre completo cada ot de la necesidad sean por lo menos 2 caracteres en longitud\n"; + } + else + { + echo "
USUARIO MODIFICADO - ADMIN: $user\n"; + + $stmt="UPDATE vicidial_users set pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass',delete_users='$delete_users',delete_user_groups='$delete_user_groups',delete_lists='$delete_lists',delete_campaigns='$delete_campaigns',delete_ingroups='$delete_ingroups',delete_remote_agents='$delete_remote_agents',load_leads='$load_leads',campaign_detail='$campaign_detail',ast_admin_access='$ast_admin_access',ast_delete_phones='$ast_delete_phones',delete_scripts='$delete_scripts',modify_leads='$modify_leads',hotkeys_active='$hotkeys_active',change_agent_campaign='$change_agent_campaign',agent_choose_ingroups='$agent_choose_ingroups',closer_campaigns='$groups_value',scheduled_callbacks='$scheduled_callbacks',agentonly_callbacks='$agentonly_callbacks',agentcall_manual='$agentcall_manual',vicidial_recording='$vicidial_recording',vicidial_transfers='$vicidial_transfers',delete_filters='$delete_filters',alter_agent_interface_options='$alter_agent_interface_options',closer_default_blended='$closer_default_blended',delete_call_times='$delete_call_times',modify_call_times='$modify_call_times',modify_users='$modify_users',modify_campaigns='$modify_campaigns',modify_lists='$modify_lists',modify_scripts='$modify_scripts',modify_filters='$modify_filters',modify_ingroups='$modify_ingroups',modify_usergroups='$modify_usergroups',modify_remoteagents='$modify_remoteagents',modify_servers='$modify_servers',view_reports='$view_reports',vicidial_recording_override='$vicidial_recording_override',alter_custdata_override='$alter_custdata_override' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER INFO |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +$ADD=3; # go to user modification below +} + + +###################### +# ADD=4B submit user modifications to the system - ADMIN +###################### + +if ($ADD=="4B") +{ + if ($LOGmodify_users==1) + { + echo ""; + + if ( (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) + { + echo "
USUARIO NO MODIFICADO - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
La contraseña y el nombre completo cada ot de la necesidad sean por lo menos 2 caracteres en longitud\n"; + } + else + { + echo "
USUARIO MODIFICADO - ADMIN: $user\n"; + + $stmt="UPDATE vicidial_users set pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass',hotkeys_active='$hotkeys_active',agent_choose_ingroups='$agent_choose_ingroups',closer_campaigns='$groups_value',scheduled_callbacks='$scheduled_callbacks',agentonly_callbacks='$agentonly_callbacks',agentcall_manual='$agentcall_manual',vicidial_recording='$vicidial_recording',vicidial_transfers='$vicidial_transfers',closer_default_blended='$closer_default_blended',vicidial_recording_override='$vicidial_recording_override',alter_custdata_override='$alter_custdata_override' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER INFO |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +$ADD=3; # go to user modification below +} + + + +###################### +# ADD=4 submit user modifications to the system +###################### + +if ($ADD==4) +{ + if ($LOGmodify_users==1) + { + echo ""; + + if ( (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) + { + echo "
USUARIO NO MODIFICADO - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
La contraseña y el nombre completo cada ot de la necesidad sean por lo menos 2 caracteres en longitud\n"; + } + else + { + echo "
USUARIO MODIFICADO: $user\n"; + + $stmt="UPDATE vicidial_users set pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER INFO |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +$ADD=3; # go to user modification below +} + +###################### +# ADD=41 submit campaign modifications to the system +###################### + +if ($ADD==41) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_name) < 6) or (strlen($active) < 1) ) + { + echo "
CAMPAÚA NO MODIFICADA - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
el nombre de la campaña necesita ser por lo menos 6 caracteres en longitud\n"; + echo "
|$campaign_name|$active|\n"; + } + else + { + echo "
CAMPAÑA MODIFICADA: $campaign_id\n"; + + if ($dial_method == 'MANUAL') + { + $auto_dial_level='0'; + $adlSQL = "auto_dial_level='0',"; + } + else + { + if ($dial_level_override > 0) + { + $adlSQL = "auto_dial_level='$auto_dial_level',"; + } + else + { + if ($dial_method == 'RATIO') + { + if ($auto_dial_level < 1) {$auto_dial_level = "1.0";} + $adlSQL = "auto_dial_level='$auto_dial_level',"; + } + else + { + $adlSQL = ""; + if ($auto_dial_level < 1) + { + $auto_dial_level = "1.0"; + $adlSQL = "auto_dial_level='$auto_dial_level',"; + } + } + } + } + if ( (!ereg("DISABLED",$list_order_mix)) and ($hopper_level < 100) ) + {$hopper_level='100';} + + $stmtA="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',allow_closers='$allow_closers',hopper_level='$hopper_level', $adlSQL next_agent_call='$next_agent_call', local_call_time='$local_call_time', voicemail_ext='$voicemail_ext', dial_timeout='$dial_timeout', dial_prefix='$dial_prefix', campaign_cid='$campaign_cid', campaign_vdad_exten='$campaign_vdad_exten', web_form_address='" . mysql_real_escape_string($web_form_address) . "', park_ext='$park_ext', park_file_name='$park_file_name', campaign_rec_exten='$campaign_rec_exten', campaign_recording='$campaign_recording', campaign_rec_filename='$campaign_rec_filename', campaign_script='$script_id', get_call_launch='$get_call_launch', am_message_exten='$am_message_exten', amd_send_to_vmx='$amd_send_to_vmx', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number',lead_filter_id='$lead_filter_id',alt_number_dialing='$alt_number_dialing',scheduled_callbacks='$scheduled_callbacks',safe_harbor_message='$safe_harbor_message',drop_call_seconds='$drop_call_seconds',safe_harbor_exten='$safe_harbor_exten',wrapup_seconds='$wrapup_seconds',wrapup_message='$wrapup_message',closer_campaigns='$groups_value',use_internal_dnc='$use_internal_dnc',allcalls_delay='$allcalls_delay',omit_phone_code='$omit_phone_code',dial_method='$dial_method',available_only_ratio_tally='$available_only_ratio_tally',adaptive_dropped_percentage='$adaptive_dropped_percentage',adaptive_maximum_level='$adaptive_maximum_level',adaptive_latest_server_time='$adaptive_latest_server_time',adaptive_intensity='$adaptive_intensity',adaptive_dl_diff_target='$adaptive_dl_diff_target',concurrent_transfers='$concurrent_transfers',auto_alt_dial='$auto_alt_dial',agent_pause_codes_active='$agent_pause_codes_active',campaign_description='$campaign_description',campaign_changedate='$SQLdate',campaign_stats_refresh='$campaign_stats_refresh',disable_alter_custdata='$disable_alter_custdata',no_hopper_leads_logins='$no_hopper_leads_logins',list_order_mix='$list_order_mix',campaign_allow_inbound='$campaign_allow_inbound',manual_dial_list_id='$manual_dial_list_id',default_xfer_group='$default_xfer_group',xfer_groups='$XFERgroups_value' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + if ($reset_hopper == 'Y') + { + echo "
REAJUSTE DE LA TOLVA DEL PLOMO DE LA CAMPAÚA\n"; + echo "
- Espera 1 minuto antes de marcar el número siguiente\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id' and status IN('READY','QUEUE','DONE');"; + $rslt=mysql_query($stmt, $link); + + ### LOG RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|CAMPAIGN HOPPERRESET|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CAMPAIGN INFO|$PHP_AUTH_USER|$ip|$stmtA|$reset_hopper|\n"); + fclose($fp); + } + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=42 modify/delete campaign status in the system +###################### + +if ($ADD==42) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
ESTADO de la CAMPAÚA NO MODIFICADO - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
la ID de la campaña necesita ser por lo menos 2 caracteres en longitud\n"; + echo "
el estado de la campaña necesita ser por lo menos los caracteres 1 en longitud\n"; + } + else + { + if (ereg('delete',$stage)) + { + echo "
ESTADO DE ENCARGO DE LA CAMPAÚA SUPRIMIDO: $campaign_id - $status\n"; + + $stmt="DELETE FROM vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + + $stmtA="DELETE FROM vicidial_campaign_hotkeys where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmtA, $link); + + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE CAMPAIGN STATUS|$PHP_AUTH_USER|$ip|$stmt|$stmtA|\n"); + fclose($fp); + } + } + if (ereg('modify',$stage)) + { + echo "
EL ESTADO DE ENCARGO DE LA CAMPAÑA SE MODIFICÓ: $campaign_id - $status\n"; + + $stmt="UPDATE vicidial_campaign_statuses SET status_name='$status_name',selectable='$selectable',human_answered='$human_answered',category='$category' where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CAMPAIGN STATUS|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +$SUB=22; +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=43 delete campaign hotkey in the system +###################### + +if ($ADD==43) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($hotkey) < 1) ) + { + echo "
CAMPAÚA HOT KEY NO MODIFICADA - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
la ID de la campaña necesita ser por lo menos 2 caracteres en longitud\n"; + echo "
el estado de la campaña necesita ser por lo menos los caracteres 1 en longitud\n"; + echo "
the campaign hotkey needs to be at least 1 characters in length\n"; + } + else + { + echo "
LA CAMPAÚA DE ENCARGO HOT KEY SUPRIMIÚ: $campaign_id - $status - $hotkey\n"; + + $stmt="DELETE FROM vicidial_campaign_hotkeys where campaign_id='$campaign_id' and status='$status' and hotkey='$hotkey';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE CAMPAIGN STATUS|$PHP_AUTH_USER|$ip|DELETE FROM vicidial_campaign_hotkeys where campaign_id='$campaign_id' and status='$status' and hotkey='$hotkey'|\n"); + fclose($fp); + } + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +$SUB=23; +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=44 submit campaign modifications to the system - Basic View +###################### + +if ($ADD==44) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_name) < 6) or (strlen($active) < 1) ) + { + echo "
CAMPAÚA NO MODIFICADA - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
el nombre de la campaña necesita ser por lo menos 6 caracteres en longitud\n"; + } + else + { + echo "
CAMPAÑA MODIFICADA: $campaign_id\n"; + + if ($dial_method == 'RATIO') + { + if ($auto_dial_level < 1) {$auto_dial_level = "1.0";} + $adlSQL = "auto_dial_level='$auto_dial_level',"; + } + else + { + if ($dial_method == 'MANUAL') + { + $auto_dial_level='0'; + $adlSQL = "auto_dial_level='0',"; + } + else + { + $adlSQL = ""; + if ($auto_dial_level < 1) + { + $auto_dial_level = "1.0"; + $adlSQL = "auto_dial_level='$auto_dial_level',"; + } + } + } + if ( (!ereg("DISABLED",$list_order_mix)) and ($hopper_level < 100) ) + {$hopper_level='100';} + + $stmtA="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',hopper_level='$hopper_level', $adlSQL lead_filter_id='$lead_filter_id',dial_method='$dial_method',adaptive_intensity='$adaptive_intensity',campaign_changedate='$SQLdate',list_order_mix='$list_order_mix' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + if ($reset_hopper == 'Y') + { + echo "
REAJUSTE DE LA TOLVA DEL PLOMO DE LA CAMPAÚA\n"; + echo "
- Espera 1 minuto antes de marcar el número siguiente\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id' and status IN('READY','QUEUE','DONE');;"; + $rslt=mysql_query($stmt, $link); + + ### LOG HOPPER RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|CAMPAIGN HOPPERRESET|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CAMPAIGN INFO|$PHP_AUTH_USER|$ip|$stmtA|$reset_hopper|\n"); + fclose($fp); + } + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +$ADD=34; # go to campaign modification form below +} + +###################### +# ADD=45 modify campaign lead recycle in the system +###################### + +if ($ADD==45) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or ($attempt_delay < 120) or ($attempt_maximum < 1) or ($attempt_maximum > 10) ) + { + echo "
CAMPAIGN LEAD RECYCLE NOT MODIFIED - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
el estado debe estar entre 1 y 6 caracteres en longitud\n"; + echo "
la tentativa retrasa debe ser por lo menos 120 segundos\n"; + echo "
las tentativas máximas deben ser a partir la 1 a 10\n"; + } + else + { + echo "
CAMPAIGN LEAD MODIFIED: $campaign_id - $status - $attempt_delay\n"; + + $stmt="UPDATE vicidial_lead_recycle SET attempt_delay='$attempt_delay',attempt_maximum='$attempt_maximum',active='$active' where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LEAD RECYCLE |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +$SUB=25; +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=47 modify agent pause code in the system +###################### + +if ($ADD==47) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($pause_code) < 1) or (strlen($pause_code) > 6) or (strlen($pause_code_name) < 2) ) + { + echo "
CÓDIGO DE LA PAUSA DEL AGENTE NO MODIFICADO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
pause_code must be between 1 and 6 characters in length\n"; + echo "
pause_code name must be between 2 and 30 characters in length\n"; + } + else + { + echo "
AGENTE PAUSE CODE MODIFIED: $campaign_id - $pause_code - $pause_code_name\n"; + + $stmt="UPDATE vicidial_pause_codes SET pause_code_name='$pause_code_name',billable='$billable' where campaign_id='$campaign_id' and pause_code='$pause_code';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY AGENTE PAUSECODE|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +$SUB=27; +$ADD=31; # go to campaign modification form below +} + + +###################### +# ADD=49 modify campaign list mix in the system +###################### + +if ($ADD==49) +{ + if ($LOGmodify_campaigns==1) + { + ##### MODIFY a list mix container entry ##### + if ($stage=='MODIFY') + { + echo ""; + + $Flist_mix_container = "list_mix_container_$vcl_id"; + $Fmix_method = "mix_method_$vcl_id"; + $Fstatus = "status_$vcl_id"; + $Fvcl_name = "vcl_name_$vcl_id"; + + if (isset($_GET[$Flist_mix_container])) {$list_mix_container=$_GET[$Flist_mix_container];} + elseif (isset($_POST[$Flist_mix_container])) {$list_mix_container=$_POST[$Flist_mix_container];} + if (isset($_GET[$Fmix_method])) {$mix_method=$_GET[$Fmix_method];} + elseif (isset($_POST[$Fmix_method])) {$mix_method=$_POST[$Fmix_method];} + if (isset($_GET[$Fstatus])) {$status=$_GET[$Fstatus];} + elseif (isset($_POST[$Fstatus])) {$status=$_POST[$Fstatus];} + if (isset($_GET[$Fvcl_name])) {$vcl_name=$_GET[$Fvcl_name];} + elseif (isset($_POST[$Fvcl_name])) {$vcl_name=$_POST[$Fvcl_name];} + $list_mix_container = preg_replace("/:$/","",$list_mix_container); + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) or (strlen($list_mix_container) < 6) or (strlen($vcl_name) < 2) ) + { + echo "
MEZCLA DE LA LISTA NO MODIFICADA - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + echo "
vcl_name name must be between 2 and 30 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_campaigns_list_mix SET vcl_name='$vcl_name',mix_method='$mix_method',list_mix_container='$list_mix_container' where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
LA MEZCLA DE LA LISTA SE MODIFICÓ: $campaign_id - $vcl_id - $vcl_name\n"; + } + } + + ##### ADD a list mix container entry ##### + if ($stage=='ADD') + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) or (strlen($list_id) < 1) ) + { + echo "
MEZCLA DE LA LISTA NO MODIFICADA - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + echo "
list_id must be at least 2 characters in length\n"; + } + else + { + $stmt="SELECT list_mix_container from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $OLDlist_mix_container = $row[0]; + $NEWlist_mix_container = "$OLDlist_mix_container:$list_id|10|0| -|"; + + $stmt="UPDATE vicidial_campaigns_list_mix SET list_mix_container='$NEWlist_mix_container' where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
LA MEZCLA DE LA LISTA SE MODIFICÓ: $campaign_id - $vcl_id - $list_id\n"; + } + } + + ##### REMOVE a list mix container entry ##### + if ($stage=='REMOVE') + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) or (strlen($list_id) < 1) ) + { + echo "
MEZCLA DE LA LISTA NO MODIFICADA - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + echo "
list_id must be at least 2 characters in length\n"; + } + else + { + $stmt="SELECT list_mix_container from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $MIXentries = $MT; + $MIXentries = explode(":", $row[0]); + $Ms_to_print = (count($MIXentries) - 0); + + if ($Ms_to_print < 2) + { + echo "
MEZCLA DE LA LISTA NO MODIFICADA: Usted no puede suprimir la entrada pasada del list_id de una mezcla dela lista\n"; + } + else + { + $MIXdetailsPCT = explode('|', $MIXentries[$mix_container_item]); + $MIXpercentPCT = $MIXdetailsPCT[2]; + + $q=0; + while ($Ms_to_print > $q) + { + if ( ($mix_container_item > $q) or ($mix_container_item < $q) ) + { + if ( ($q==0) and ($mix_container_item > 0) ) + { + $MIXdetailsONE = explode('|', $MIXentries[$q]); + $MIXpercentONE = ($MIXdetailsONE[2] + $MIXpercentPCT); + $NEWlist_mix_container .= "$MIXdetailsONE[0]|$MIXdetailsONE[1]|$MIXpercentONE|$MIXdetailsONE[3]|:"; + } + else + { + if ( ($q==1) and ($mix_container_item < 1) ) + { + $MIXdetailsONE = explode('|', $MIXentries[$q]); + $MIXpercentONE = ($MIXdetailsONE[2] + $MIXpercentPCT); + $NEWlist_mix_container .= "$MIXdetailsONE[0]|$MIXdetailsONE[1]|$MIXpercentONE|$MIXdetailsONE[3]|:"; + } + else + { + $NEWlist_mix_container .= "$MIXentries[$q]:"; + } + } + } + $q++; + } + $NEWlist_mix_container = preg_replace("/.$/",'',$NEWlist_mix_container); + + $stmt="UPDATE vicidial_campaigns_list_mix SET list_mix_container='$NEWlist_mix_container' where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
LA MEZCLA DE LA LISTA SE MODIFICÓ: $campaign_id - $vcl_id - $list_id - $mix_container_item\n"; + } + } + } + + ##### ADD a NEW list mix ##### + if ($stage=='NEWMIX') + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) or (strlen($vcl_name) < 2) ) + { + echo "
MEZCLA DE LA LISTA NO AGREGADA- Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + echo "
vcl_name must be at least 2 characters in length\n"; + } + else + { + $stmt="SELECT count(*) from vicidial_campaigns_list_mix where vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + echo "
MEZCLA DE LA LISTA NO AGREGADA- Hay ya una mezcla de la lista con esta identificación en el sistema\n"; + } + else + { + $stmt="INSERT INTO vicidial_campaigns_list_mix SET list_mix_container='$list_id|1|100| $status -|',campaign_id='$campaign_id',vcl_id='$vcl_id',vcl_name='$vcl_name',mix_method='$mix_method',status='INACTIVE';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
LA MEZCLA DE LA LISTA AGREGÓ:$campaign_id - $vcl_id - $vcl_name\n"; + } + } + } + + ##### DELETE an existing list mix ##### + if ($stage=='DELMIX') + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) ) + { + echo "
MEZCLA DE LA LISTA NO SUPRIMIDA - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_campaigns_list_mix where vcl_id='$vcl_id' and campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
MEZCLA DE LA LISTA SUPRIMIDA:$campaign_id - $vcl_id - $vcl_name\n"; + } + } + + ##### Set list mix entry to active ##### + if ($stage=='SETACTIVE') + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) ) + { + echo "
MEZCLA DE LA LISTA NO ACTIVADA - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_campaigns_list_mix SET status='INACTIVE' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_campaigns_list_mix SET status='ACTIVE' where vcl_id='$vcl_id' and campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
LA MEZCLA DE LA LISTA ACTIVÓ: $campaign_id - $vcl_id - $vcl_name\n"; + } + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +$SUB=29; +$ADD=31; # go to campaign modification form below +} + + +###################### +# ADD=411 submit list modifications to the system +###################### + +if ($ADD==411) +{ + if ($LOGmodify_lists==1) + { + echo ""; + + if ( (strlen($list_name) < 2) or (strlen($campaign_id) < 2) ) + { + echo "
LISTA NO MODIFICADA - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
el nombre de la lista debe ser por lo menos 2 caracteres en longitud\n"; + } + else + { + echo "
LISTA MODIFICADA: $list_id\n"; + + $stmt="UPDATE vicidial_lists set list_name='$list_name',campaign_id='$campaign_id',active='$active',list_description='$list_description',list_changedate='$SQLdate' where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + if ($reset_list == 'Y') + { + echo "
REAJUSTANDO LA LISTA - LLAMADA - ESTADO\n"; + $stmt="UPDATE vicidial_list set called_since_last_reset='N' where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|RESET LIST CALLED |$PHP_AUTH_USER|$ip|list_name='$list_name'|\n"); + fclose($fp); + } + } + if ($campaign_id != "$old_campaign_id") + { + echo "
QUITAR LOS PLOMOS DE LA TOLVA DE LA LISTA DE VIEJA TOLVA DE LA CAMPAÚA ($old_campaign_id)\n"; + $stmt="DELETE from vicidial_hopper where list_id='$list_id' and campaign_id='$old_campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST INFO |$PHP_AUTH_USER|$ip|list_name='$list_name',campaign_id='$campaign_id',active='$active',list_description='$list_description' where list_id='$list_id'|\n"); + fclose($fp); + } + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +$ADD=311; # go to list modification form below +} + + +###################### +# ADD=4111 modify in-group info in the system +###################### + +if ($ADD==4111) +{ + if ($LOGmodify_ingroups==1) + { + echo ""; + + if ( (strlen($group_name) < 2) or (strlen($group_color) < 2) ) + { + echo "
GRUPO NO MODIFICADO - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
el color del nombre de grupo y del grupo debe ser por lo menos 2 caracteres en longitud\n"; + } + else + { + echo "
GRUPO MODIFICADO: $group_id\n"; + + $stmt="UPDATE vicidial_inbound_groups set group_name='$group_name', group_color='$group_color', active='$active', web_form_address='" . mysql_real_escape_string($web_form_address) . "', voicemail_ext='$voicemail_ext', next_agent_call='$next_agent_call', fronter_display='$fronter_display', ingroup_script='$script_id', get_call_launch='$get_call_launch', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number',drop_message='$drop_message',drop_call_seconds='$drop_call_seconds',drop_exten='$drop_exten',call_time_id='$call_time_id',after_hours_action='$after_hours_action',after_hours_message_filename='$after_hours_message_filename',after_hours_exten='$after_hours_exten',after_hours_voicemail='$after_hours_voicemail',welcome_message_filename='$welcome_message_filename',moh_context='$moh_context',onhold_prompt_filename='$onhold_prompt_filename',prompt_interval='$prompt_interval',agent_alert_exten='$agent_alert_exten',agent_alert_delay='$agent_alert_delay',default_xfer_group='$default_xfer_group' where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY GROUP INFO |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +$ADD=3111; # go to in-group modification form below +} + + + +###################### +# ADD=41111 modify remote agents info in the system +###################### + +if ($ADD==41111) +{ + if ($LOGmodify_remoteagents==1) + { + echo ""; + + if ( (strlen($server_ip) < 2) or (strlen($user_start) < 2) or (strlen($campaign_id) < 2) or (strlen($conf_exten) < 2) ) + { + echo "
AGENTES ALEJADOS NO MODIFICADOS - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
El comienzo de la ID del usuario y la extensión externa deben ser por lo menos 2 caracteres en longitud\n"; + } + else + { + $stmt="UPDATE vicidial_remote_agents set user_start='$user_start', number_of_lines='$number_of_lines', server_ip='$server_ip', conf_exten='$conf_exten', status='$status', campaign_id='$campaign_id', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
LOS AGENTES ALEJADOS SE MODIFICARON\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY AGENTES REMOTOS ENTRY |$PHP_AUTH_USER|$ip|set user_start='$user_start', number_of_lines='$number_of_lines', server_ip='$server_ip', conf_exten='$conf_exten', status='$status', campaign_id='$campaign_id', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id'|\n"); + fclose($fp); + } + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +$ADD=31111; # go to remote agents modification form below +} + + + +###################### +# ADD=411111 modify user group info in the system +###################### + +if ($ADD==411111) +{ + if ($LOGmodify_usergroups==1) + { + echo ""; + + if ( (strlen($user_group) < 2) or (strlen($group_name) < 2) ) + { + echo "
GRUPO de USUARIO NO MODIFICADO - vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
El nombre y la descripción de grupo deben ser por lo menos 2 caracteres en longitud\n"; + } + else + { + $stmt="UPDATE vicidial_user_groups set user_group='$user_group', group_name='$group_name',allowed_campaigns='$campaigns_value' where user_group='$OLDuser_group';"; + $rslt=mysql_query($stmt, $link); + + echo "
GRUPO DE USUARIO MODIFICADO\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER GROUP ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +$ADD=311111; # go to user group modification form below +} + +###################### +# ADD=4111111 modify script in the system +###################### + +if ($ADD==4111111) +{ + if ($LOGmodify_scripts==1) + { + echo "\n"; + echo "\n"; + echo ""; + + if ( (strlen($script_id) < 2) or (strlen($script_name) < 2) or (strlen($script_text) < 2) ) + { + echo "
ESCRITURA NO MODIFICADA - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
El nombre, la descripción y el texto de la escritura deben ser por lo menos 2 caracteres en longitud\n"; + } + else + { + $stmt="UPDATE vicidial_scripts set script_name='$script_name', script_comments='$script_comments', script_text='$script_text', active='$active' where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
LA ESCRITURA SE MODIFICÓ\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY SCRIPT ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +$ADD=3111111; # go to script modification form below +} + + +###################### +# ADD=41111111 modify filter in the system +###################### + +if ($ADD==41111111) +{ + if ($LOGmodify_filters==1) + { + echo ""; + + if ( (strlen($lead_filter_id) < 2) or (strlen($lead_filter_name) < 2) or (strlen($lead_filter_sql) < 2) ) + { + echo "
FILTRO NO MODIFICADO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Filtre la identificación, nombre y el SQL debe ser por lo menos 2 caracteres en longitud\n"; + } + else + { + $stmt="UPDATE vicidial_lead_filters set lead_filter_name='$lead_filter_name', lead_filter_comments='$lead_filter_comments', lead_filter_sql='$lead_filter_sql' where lead_filter_id='$lead_filter_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
FILTRO MODIFICADO\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY FILTER ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +$ADD=31111111; # go to filter modification form below +} + + +###################### +# ADD=411111111 modify call time in the system +###################### + +if ($ADD==411111111) +{ + if ($LOGmodify_call_times==1) + { + echo ""; + + if ( (strlen($call_time_id) < 2) or (strlen($call_time_name) < 2) ) + { + echo "
TIEMPO DE LA LLAMADA NO MODIFICADO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
La identificación del tiempo de la llamada y el nombre deben ser porlo menos 2 caracteres en longitud\n"; + } + else + { + $ct_default_start = preg_replace('/\D/', '', $ct_default_start); + $ct_default_stop = preg_replace('/\D/', '', $ct_default_stop); + $ct_sunday_start = preg_replace('/\D/', '', $ct_sunday_start); + $ct_sunday_stop = preg_replace('/\D/', '', $ct_sunday_stop); + $ct_monday_start = preg_replace('/\D/', '', $ct_monday_start); + $ct_monday_stop = preg_replace('/\D/', '', $ct_monday_stop); + $ct_tuesday_start = preg_replace('/\D/', '', $ct_tuesday_start); + $ct_tuesday_stop = preg_replace('/\D/', '', $ct_tuesday_stop); + $ct_wednesday_start = preg_replace('/\D/', '', $ct_wednesday_start); + $ct_wednesday_stop = preg_replace('/\D/', '', $ct_wednesday_stop); + $ct_thursday_start = preg_replace('/\D/', '', $ct_thursday_start); + $ct_thursday_stop = preg_replace('/\D/', '', $ct_thursday_stop); + $ct_friday_start = preg_replace('/\D/', '', $ct_friday_start); + $ct_friday_stop = preg_replace('/\D/', '', $ct_friday_stop); + $ct_saturday_start = preg_replace('/\D/', '', $ct_saturday_start); + $ct_saturday_stop = preg_replace('/\D/', '', $ct_saturday_stop); + $stmt="UPDATE vicidial_call_times set call_time_name='$call_time_name', call_time_comments='$call_time_comments', ct_default_start='$ct_default_start', ct_default_stop='$ct_default_stop', ct_sunday_start='$ct_sunday_start', ct_sunday_stop='$ct_sunday_stop', ct_monday_start='$ct_monday_start', ct_monday_stop='$ct_monday_stop', ct_tuesday_start='$ct_tuesday_start', ct_tuesday_stop='$ct_tuesday_stop', ct_wednesday_start='$ct_wednesday_start', ct_wednesday_stop='$ct_wednesday_stop', ct_thursday_start='$ct_thursday_start', ct_thursday_stop='$ct_thursday_stop', ct_friday_start='$ct_friday_start', ct_friday_stop='$ct_friday_stop', ct_saturday_start='$ct_saturday_start', ct_saturday_stop='$ct_saturday_stop' where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
TIEMPO DE LA LLAMADA MODIFICADO\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CALL TIME ENTRY |$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +$ADD=311111111; # go to call time modification form below +} + + +###################### +# ADD=4111111111 modify state call time in the system +###################### + +if ($ADD==4111111111) +{ + if ($LOGmodify_call_times==1) + { + echo ""; + + if ( (strlen($call_time_id) < 2) or (strlen($call_time_name) < 2) or (strlen($state_call_time_state) < 2) ) + { + echo "
TIEMPO DE LA LLAMADA DEL ESTADO NO MODIFICADO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Indique que identificación del tiempo de la llamada, nombre y estadodebe ser por lo menos 2 caracteres en longitud\n"; + } + else + { + $ct_default_start = preg_replace('/\D/', '', $ct_default_start); + $ct_default_stop = preg_replace('/\D/', '', $ct_default_stop); + $ct_sunday_start = preg_replace('/\D/', '', $ct_sunday_start); + $ct_sunday_stop = preg_replace('/\D/', '', $ct_sunday_stop); + $ct_monday_start = preg_replace('/\D/', '', $ct_monday_start); + $ct_monday_stop = preg_replace('/\D/', '', $ct_monday_stop); + $ct_tuesday_start = preg_replace('/\D/', '', $ct_tuesday_start); + $ct_tuesday_stop = preg_replace('/\D/', '', $ct_tuesday_stop); + $ct_wednesday_start = preg_replace('/\D/', '', $ct_wednesday_start); + $ct_wednesday_stop = preg_replace('/\D/', '', $ct_wednesday_stop); + $ct_thursday_start = preg_replace('/\D/', '', $ct_thursday_start); + $ct_thursday_stop = preg_replace('/\D/', '', $ct_thursday_stop); + $ct_friday_start = preg_replace('/\D/', '', $ct_friday_start); + $ct_friday_stop = preg_replace('/\D/', '', $ct_friday_stop); + $ct_saturday_start = preg_replace('/\D/', '', $ct_saturday_start); + $ct_saturday_stop = preg_replace('/\D/', '', $ct_saturday_stop); + $stmt="UPDATE vicidial_state_call_times set state_call_time_name='$call_time_name', state_call_time_comments='$call_time_comments', sct_default_start='$ct_default_start', sct_default_stop='$ct_default_stop', sct_sunday_start='$ct_sunday_start', sct_sunday_stop='$ct_sunday_stop', sct_monday_start='$ct_monday_start', sct_monday_stop='$ct_monday_stop', sct_tuesday_start='$ct_tuesday_start', sct_tuesday_stop='$ct_tuesday_stop', sct_wednesday_start='$ct_wednesday_start', sct_wednesday_stop='$ct_wednesday_stop', sct_thursday_start='$ct_thursday_start', sct_thursday_stop='$ct_thursday_stop', sct_friday_start='$ct_friday_start', sct_friday_stop='$ct_friday_stop', sct_saturday_start='$ct_saturday_start', sct_saturday_stop='$ct_saturday_stop', state_call_time_state='$state_call_time_state' where state_call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
TIEMPO DE LA LLAMADA DEL ESTADO MODIFICADO\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY STATE CALL TIME ENTRY|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +$ADD=3111111111; # go to state call time modification form below +} + + +###################### +# ADD=41111111111 modify phone record in the system +###################### + +if ($ADD==41111111111) +{ + if ($LOGast_admin_access==1) + { + echo ""; + + $stmt="SELECT count(*) from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ( ($extension != $old_extension) or ($server_ip != $old_server_ip) ) ) + {echo "
TELÉFONO NO MODIFICADO - hay ya un teléfono en el sistema con esta extensión/servidor\n";} + else + { + if ( (strlen($extension) < 1) or (strlen($server_ip) < 7) or (strlen($dialplan_number) < 1) or (strlen($voicemail_id) < 1) or (strlen($login) < 1) or (strlen($pass) < 1)) + {echo "
TELÉFONO NO MODIFICADO - vaya por favor detrás y mire los datos que usted incorporó\n";} + else + { + echo "
TELÉFONO MODIFICADO: $extension\n"; + + $stmt="UPDATE phones set extension='$extension', dialplan_number='$dialplan_number', voicemail_id='$voicemail_id', phone_ip='$phone_ip', computer_ip='$computer_ip', server_ip='$server_ip', login='$login', pass='$pass', status='$status', active='$active', phone_type='$phone_type', fullname='$fullname', company='$company', picture='$picture', protocol='$protocol', local_gmt='$local_gmt', ASTmgrUSERNAME='$ASTmgrUSERNAME', ASTmgrSECRET='$ASTmgrSECRET', login_user='$login_user', login_pass='$login_pass', login_campaign='$login_campaign', park_on_extension='$park_on_extension', conf_on_extension='$conf_on_extension', VICIDIAL_park_on_extension='$VICIDIAL_park_on_extension', VICIDIAL_park_on_filename='$VICIDIAL_park_on_filename', monitor_prefix='$monitor_prefix', recording_exten='$recording_exten', voicemail_exten='$voicemail_exten', voicemail_dump_exten='$voicemail_dump_exten', ext_context='$ext_context', dtmf_send_extension='$dtmf_send_extension', call_out_number_group='$call_out_number_group', client_browser='$client_browser', install_directory='$install_directory', local_web_callerID_URL='" . mysql_real_escape_string($local_web_callerID_URL) . "', VICIDIAL_web_URL='" . mysql_real_escape_string($VICIDIAL_web_URL) . "', AGI_call_logging_enabled='$AGI_call_logging_enabled', user_switching_enabled='$user_switching_enabled', conferencing_enabled='$conferencing_enabled', admin_hangup_enabled='$admin_hangup_enabled', admin_hijack_enabled='$admin_hijack_enabled', admin_monitor_enabled='$admin_monitor_enabled', call_parking_enabled='$call_parking_enabled', updater_check_enabled='$updater_check_enabled', AFLogging_enabled='$AFLogging_enabled', QUEUE_ACTION_enabled='$QUEUE_ACTION_enabled', CallerID_popup_enabled='$CallerID_popup_enabled', voicemail_button_enabled='$voicemail_button_enabled', enable_fast_refresh='$enable_fast_refresh', fast_refresh_rate='$fast_refresh_rate', enable_persistant_mysql='$enable_persistant_mysql', auto_dial_next_number='$auto_dial_next_number', VDstop_rec_after_each_call='$VDstop_rec_after_each_call', DBX_server='$DBX_server', DBX_database='$DBX_database', DBX_user='$DBX_user', DBX_pass='$DBX_pass', DBX_port='$DBX_port', DBY_server='$DBY_server', DBY_database='$DBY_database', DBY_user='$DBY_user', DBY_pass='$DBY_pass', DBY_port='$DBY_port', outbound_cid='$outbound_cid', enable_sipsak_messages='$enable_sipsak_messages' where extension='$old_extension' and server_ip='$old_server_ip';"; + $rslt=mysql_query($stmt, $link); + } + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +$ADD=31111111111; # go to phone modification form below +} + + +###################### +# ADD=411111111111 modify server record in the system +###################### + +if ($ADD==411111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + + $stmt="SELECT count(*) from servers where server_id='$server_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ($server_id != $old_server_id) ) + {echo "
SERVIDOR NOT MODIFIED - there is already a server in the system with this server_id\n";} + else + { + $stmt="SELECT count(*) from servers where server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ($server_ip != $old_server_ip) ) + {echo "
SERVIDOR NO MODIFICADO - hay ya un servidor en el sistema con este server_ip\n";} + else + { + if ( (strlen($server_id) < 1) or (strlen($server_ip) < 7) ) + {echo "
SERVIDOR NO MODIFICADO - vaya por favor detrás y mire los datos que usted incorporó\n";} + else + { + echo "
SERVIDOR MODIFICADO: $server_ip\n"; + + $stmt="UPDATE servers set server_id='$server_id',server_description='$server_description',server_ip='$server_ip',active='$active',asterisk_version='$asterisk_version', max_vicidial_trunks='$max_vicidial_trunks', telnet_host='$telnet_host', telnet_port='$telnet_port', ASTmgrUSERNAME='$ASTmgrUSERNAME', ASTmgrSECRET='$ASTmgrSECRET', ASTmgrUSERNAMEupdate='$ASTmgrUSERNAMEupdate', ASTmgrUSERNAMElisten='$ASTmgrUSERNAMElisten', ASTmgrUSERNAMEsend='$ASTmgrUSERNAMEsend', local_gmt='$local_gmt', voicemail_dump_exten='$voicemail_dump_exten', answer_transfer_agent='$answer_transfer_agent', ext_context='$ext_context', sys_perf_log='$sys_perf_log', vd_server_logs='$vd_server_logs', agi_output='$agi_output', vicidial_balance_active='$vicidial_balance_active', balance_trunks_offlimits='$balance_trunks_offlimits' where server_id='$old_server_id';"; + $rslt=mysql_query($stmt, $link); + } + } + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +$ADD=311111111111; # go to server modification form below +} + + +###################### +# ADD=421111111111 modify vicidial server trunks record in the system +###################### + +if ($ADD==421111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + $stmt="SELECT max_vicidial_trunks from servers where server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $MAXvicidial_trunks = $rowx[0]; + + $stmt="SELECT sum(dedicated_trunks) from vicidial_server_trunks where server_ip='$server_ip' and campaign_id !='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $SUMvicidial_trunks = ($rowx[0] + $dedicated_trunks); + + if ($SUMvicidial_trunks > $MAXvicidial_trunks) + { + echo "
EXPEDIENTE DEL TRONCO DEL SERVIDOR DE VICIDIAL NO AGREGADO - el número de troncos vicidial es demasiado alto: $SUMvicidial_trunks / $MAXvicidial_trunks\n"; + } + else + { + if ( (strlen($campaign_id) < 2) or (strlen($server_ip) < 7) or (strlen($dedicated_trunks) < 1) or (strlen($trunk_restriction) < 1) ) + { + echo "
EXPEDIENTE DEL TRONCO DEL SERVIDOR DE VICIDIAL NO MODIFICADO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
la campaña debe estar entre 3 y 8 caracteres en longitud\n"; + echo "
el server_ip retrasa debe ser por lo menos 7 caracteres\n"; + echo "
los troncos deben ser un dígito a partir de la 0 a 9999\n"; + } + else + { + echo "
EXPEDIENTE DEL TRONCO DEL SERVIDOR DE VICIDIAL MODIFICADO: $campaign_id - $server_ip - $dedicated_trunks - $trunk_restriction\n"; + + $stmt="UPDATE vicidial_server_trunks SET dedicated_trunks='$dedicated_trunks',trunk_restriction='$trunk_restriction' where campaign_id='$campaign_id' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFICAR EL SERVIDOR TRUNK |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +$ADD=311111111111; # go to server modification form below +} + + +###################### +# ADD=4111111111111 modify conference record in the system +###################### + +if ($ADD==4111111111111) +{ + if ($LOGast_admin_access==1) + { + echo ""; + + $stmt="SELECT count(*) from conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ( ($conf_exten != $old_conf_exten) or ($server_ip != $old_server_ip) ) ) + {echo "
CONFERENCIA - hay ya una conferencia en el sistema con esta extensión - servidor NO MODIFICADO\n";} + else + { + if ( (strlen($conf_exten) < 1) or (strlen($server_ip) < 7) ) + {echo "
CONFERENCIA NO MODIFICADA - vaya por favor detrás y mire los datos que usted incorporó\n";} + else + { + echo "
CONFERENCIA MODIFICADA: $conf_exten\n"; + + $stmt="UPDATE conferences set conf_exten='$conf_exten',server_ip='$server_ip',extension='$extension' where conf_exten='$old_conf_exten';"; + $rslt=mysql_query($stmt, $link); + } + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +$ADD=3111111111111; # go to conference modification form below +} + + +###################### +# ADD=41111111111111 modify vicidial conference record in the system +###################### + +if ($ADD==41111111111111) +{ + if ($LOGast_admin_access==1) + { + echo ""; + + $stmt="SELECT count(*) from vicidial_conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ( ($conf_exten != $old_conf_exten) or ($server_ip != $old_server_ip) ) ) + {echo "
VICIDIAL CONFERENCIA - hay ya una conferencia en el sistema con esta extensión - servidor NO MODIFICADO\n";} + else + { + if ( (strlen($conf_exten) < 1) or (strlen($server_ip) < 7) ) + {echo "
VICIDIAL CONFERENCIA NO MODIFICADA - vaya por favor detrás y mire los datos que usted incorporó\n";} + else + { + echo "
VICIDIAL CONFERENCIA MODIFICADA: $conf_exten\n"; + + $stmt="UPDATE vicidial_conferences set conf_exten='$conf_exten',server_ip='$server_ip',extension='$extension' where conf_exten='$old_conf_exten';"; + $rslt=mysql_query($stmt, $link); + + } + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +$ADD=31111111111111; # go to vicidial conference modification form below +} + + + +###################### +# ADD=411111111111111 modify vicidial system settings +###################### + +if ($ADD==411111111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + + echo "
AJUSTES DEL SISTEMA DE VICIDIAL MODIFICADOS\n"; + + $stmt="UPDATE system_settings set use_non_latin='$use_non_latin',webroot_writable='$webroot_writable',enable_queuemetrics_logging='$enable_queuemetrics_logging',queuemetrics_server_ip='$queuemetrics_server_ip',queuemetrics_dbname='$queuemetrics_dbname',queuemetrics_login='$queuemetrics_login',queuemetrics_pass='$queuemetrics_pass',queuemetrics_url='$queuemetrics_url',queuemetrics_log_id='$queuemetrics_log_id',queuemetrics_eq_prepend='$queuemetrics_eq_prepend',vicidial_agent_disable='$vicidial_agent_disable',allow_sipsak_messages='$allow_sipsak_messages',admin_home_url='$admin_home_url',enable_agc_xfer_log='$enable_agc_xfer_log';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY SYSTEM SETTINGS|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +$ADD=311111111111111; # go to vicidial system settings form below +} + + +###################### +# ADD=421111111111111 modify/delete system status in the system +###################### + +if ($ADD==421111111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + + if (ereg('delete',$stage)) + { + if ( (strlen($status) < 1) or (preg_match("/^B$|^NA$|^DNC$|^NA$|^DROP$|^INCALL$|^QUEUE$|^NEW$/i",$status)) ) + { + echo "
ESTADO DE SISTEMA NO SUPRIMIDO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
el estado de sistema no puede ser un estado reservado:B,NA,DNC,NA,DROP,INCALL,QUEUE,NEW\n"; + echo "
el estado de sistema necesita ser por lo menos los caracteres 1 enlongitud\n"; + } + else + { + echo "
SYSTEM STATUS DELETED: $status\n"; + + $stmt="DELETE FROM vicidial_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + + $stmtA="DELETE FROM vicidial_campaign_hotkeys where status='$status';"; + $rslt=mysql_query($stmtA, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE SYSTEM STATUS |$PHP_AUTH_USER|$ip|$stmt|$stmtA|\n"); + fclose($fp); + } + } + } + if (ereg('modify',$stage)) + { + if ( (strlen($status) < 1) or (strlen($status_name) < 2) ) + { + echo "
ESTADO DE SISTEMA NO MODIFICADO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
el estado de sistema necesita ser por lo menos los caracteres 1 enlongitud\n"; + echo "
el nombre del estado de sistema necesita ser por lo menos loscaracteres 1 en longitud\n"; + } + else + { + echo "
ESTADO DE SISTEMA MODIFICADO: $status\n"; + + $stmt="UPDATE vicidial_statuses SET status_name='$status_name',selectable='$selectable',human_answered='$human_answered',category='$category' where status='$status';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY SYSTEM STATUS |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +$ADD=321111111111111; # go to system settings modification form below +} + + +###################### +# ADD=431111111111111 modify/delete status category in the system +###################### + +if ($ADD==431111111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + + if ( (strlen($vsc_id) < 2) or (preg_match("/^UNDEFINED$/i",$vsc_id)) ) + { + echo "
CATEGORÃA DEL ESTADO NO MODIFICADA - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
la categoría del estado no puede ser una categoría reservada:UNDEFINED\n"; + echo "
la categoría del estado necesita ser por lo menos 2 caracteres enlongitud\n"; + } + else + { + if (ereg('delete',$stage)) + { + echo "
CATEGORÃA DEL ESTADO SUPRIMIDA: $vsc_id\n"; + + $stmt="DELETE FROM vicidial_status_categories where vsc_id='$vsc_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE STATUS CATEGORY|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + if (ereg('modify',$stage)) + { + echo "
LA CATEGORÃA DEL ESTADO SE MODIFICÓ: $vsc_id\n"; + + $stmt="SELECT count(*) from vicidial_status_categories where tovdad_display='Y' and vsc_id NOT IN('$vsc_id');"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 3) and (ereg('Y',$tovdad_display)) ) + { + $tovdad_display = 'N'; + echo "
ERROR: Hay ya sistema de 4 categorías del estado a la exhibición deTimeOnVDAD\n"; + } + + $stmt="UPDATE vicidial_status_categories SET vsc_name='$vsc_name',vsc_description='$vsc_description',tovdad_display='$tovdad_display' where vsc_id='$vsc_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY STATUS CATEGORY|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +$ADD=331111111111111; # go to system settings modification form below +} + + + + +###################################################################################################### +###################################################################################################### +####### 5 series, delete records confirmation +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=5 confirmation before deletion of user +###################### + +if ($ADD==5) +{ + echo ""; + + if ( (strlen($user) < 2) or ($LOGdelete_users < 1) ) + { + echo "
USUARIO NO SUPRIMIDO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
User be at least 2 characters in length\n"; + } + else + { + echo "
CONFIRMACIÓN DE LA CANCELADURA DEL USUARIO: $user\n"; + echo "

Chasque aquí para suprimir a usuario $user


\n"; + } + +$ADD='3'; # go to user modification below +} + +###################### +# ADD=51 confirmation before deletion of campaign +###################### + +if ($ADD==51) +{ + echo ""; + + if ( (strlen($campaign_id) < 2) or ($LOGdelete_campaigns < 1) ) + { + echo "
CAMPAÑA NO SUPRIMIDA - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Campaña_id be at least 2 characters in length\n"; + } + else + { + echo "
CONFIRMACIÓN DE LA CANCELADURA DE LA CAMPAÑA: $campaign_id\n"; + echo "

Chasque aquí para suprimir campaña $campaign_id


\n"; + } + +$ADD='31'; # go to campaign modification below +} + +###################### +# ADD=52 confirmation before logging all agents out of campaign of campaign +###################### + +if ($ADD==52) +{ + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
AGENTES NO REGISTRADOS FUERA DE CAMPAÑA - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Campaña_id be at least 2 characters in length\n"; + } + else + { + echo "
CONFIRMACIÓN DEL REGISTRO DE ESTADO DE LA MÃQUINA DEL AGENTE: $campaign_id\n"; + echo "

Chasque aquí para registrar todos los agentes fuera de $campaign_id


\n"; + } + +$ADD='31'; # go to campaign modification below +} + +###################### +# ADD=53 confirmation before Emergency VDAC Jam Clear - deletes oldest LIVE vicidial_auto_call record +###################### + +if ($ADD==53) +{ + if (eregi('IN',$stage)) + {$group_id=$campaign_id;} + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
VDAC NO DESPEJÓ PARA LA CAMPAÑA - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Campaña_id be at least 2 characters in length\n"; + } + else + { + echo "
CONFIRMACIÓN CLARA DE VDAC: $campaign_id\n"; + echo "

Chasque aquí para suprimir el más viejo VIVEN expediente en VDACpara $campaign_id


\n"; + } + +# go to campaign modification below +if (eregi('IN',$stage)) + {$ADD='3111';} +else + {$ADD='31';} +} + +###################### +# ADD=511 confirmation before deletion of list +###################### + +if ($ADD==511) +{ + echo ""; + + if ( (strlen($list_id) < 2) or ($LOGdelete_lists < 1) ) + { + echo "
LISTA NO SUPRIMIDA - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
List_id be at least 2 characters in length\n"; + } + else + { + echo "
CONFIRMACIÓN DE LA CANCELADURA DE LA LISTA: $list_id\n"; + echo "

Chasque aquí para suprimir la lista y todos sus plomos $list_id


\n"; + } + +$ADD='311'; # go to campaign modification below +} + +###################### +# ADD=5111 confirmation before deletion of in-group +###################### + +if ($ADD==5111) +{ + echo ""; + + if ( (strlen($group_id) < 2) or ($LOGdelete_ingroups < 1) ) + { + echo "
EN-GRUPO NO SUPRIMIDO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Group_id be at least 2 characters in length\n"; + } + else + { + echo "
CONFIRMACIÓN DE LA CANCELADURA DE EN-GRUPO: $group_id\n"; + echo "

Chasque aquí para suprimir a en-grupo $group_id


\n"; + } + +$ADD='3111'; # go to in-group modification below +} + +###################### +# ADD=51111 confirmation before deletion of remote agent record +###################### + +if ($ADD==51111) +{ + echo ""; + + if ( (strlen($remote_agent_id) < 1) or ($LOGdelete_remote_agents < 1) ) + { + echo "
AGENTE ALEJADO NO SUPRIMIDO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Remote_agent_id be at least 2 characters in length\n"; + } + else + { + echo "
CONFIRMACIÓN ALEJADA DE LA CANCELADURA DEL AGENTE: $remote_agent_id\n"; + echo "

Chasque aquí para suprimir el agente alejado $remote_agent_id


\n"; + } + +$ADD='31111'; # go to remote agent modification below +} + +###################### +# ADD=511111 confirmation before deletion of user group record +###################### + +if ($ADD==511111) +{ + echo ""; + + if ( (strlen($user_group) < 2) or ($LOGdelete_user_groups < 1) ) + { + echo "
GRUPO DE USUARIO NO SUPRIMIDO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
User_group be at least 2 characters in length\n"; + } + else + { + echo "
CONFIRMACIÓN DE LA CANCELADURA DEL GRUPO DE USUARIO: $user_group\n"; + echo "

Chasque aquí para suprimir a grupo de usuario $user_group


\n"; + } + +$ADD='311111'; # go to user group modification below +} + +###################### +# ADD=5111111 confirmation before deletion of script record +###################### + +if ($ADD==5111111) +{ + echo ""; + + if ( (strlen($script_id) < 2) or ($LOGdelete_scripts < 1) ) + { + echo "
ESCRITURA NO SUPRIMIDA - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Script_id must be at least 2 characters in length\n"; + } + else + { + echo "
CONFIRMACIÓN DE LA CANCELADURA DE LA ESCRITURA: $script_id\n"; + echo "

Chasque aquí para suprimir la escritura $script_id


\n"; + } + +$ADD='3111111'; # go to script modification below +} + +###################### +# ADD=51111111 confirmation before deletion of filter record +###################### + +if ($ADD==51111111) +{ + echo ""; + + if ( (strlen($lead_filter_id) < 2) or ($LOGdelete_filters < 1) ) + { + echo "
FILTRO NO SUPRIMIDO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
La identificación del filtro debe ser por lo menos 2 caracteres en longitud\n"; + } + else + { + echo "
FILTER DELETION CONFIRMATION: $lead_filter_id\n"; + echo "

Chasque aquí para suprimir el filtro$lead_filter_id


\n"; + } + +$ADD='31111111'; # go to filter modification below +} + +###################### +# ADD=511111111 confirmation before deletion of call time record +###################### + +if ($ADD==511111111) +{ + echo ""; + + if ( (strlen($call_time_id) < 2) or ($LOGdelete_call_times < 1) ) + { + echo "
TIEMPO DE LA LLAMADA NO SUPRIMIDO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
_ llamar tiempo identificación deber ser por lo menos 2 carácter enlongitud\n"; + } + else + { + echo "
CONFIRMACIÓN DE LA CANCELADURA DEL TIEMPO DE LA LLAMADA: $call_time_id\n"; + echo "

Click here to delete call time $call_time_id


\n"; + } + +$ADD='311111111'; # go to call time modification below +} + +###################### +# ADD=5111111111 confirmation before deletion of state call time record +###################### + +if ($ADD==5111111111) +{ + echo ""; + + if ( (strlen($call_time_id) < 2) or ($LOGdelete_call_times < 1) ) + { + echo "
TIEMPO DE LA LLAMADA DEL ESTADO NO SUPRIMIDO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
_ llamar tiempo identificación deber ser por lo menos 2 carácter enlongitud\n"; + } + else + { + echo "
CONFIRMACIÓN DE LA CANCELADURA DEL TIEMPO DE LA LLAMADA DEL ESTADO: $call_time_id\n"; + echo "

Click here to delete state call time $call_time_id


\n"; + } + +$ADD='3111111111'; # go to state call time modification below +} + + +###################### +# ADD=51111111111 confirmation before deletion of phone record +###################### + +if ($ADD==51111111111) +{ + echo ""; + + if ( (strlen($extension) < 2) or (strlen($server_ip) < 7) or ($LOGast_delete_phones < 1) ) + { + echo "
TELÉFONO NO SUPRIMIDO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Extension be at least 2 characters in length\n"; + echo "
IP Del Servidor be at least 7 characters in length\n"; + } + else + { + echo "
CONFIRMACIÓN DE LA CANCELADURA DEL TELÉFONO: $extension - $server_ip\n"; + echo "

Chasque aquí para suprimir el teléfono $extension - $server_ip


\n"; + } +$ADD='31111111111'; # go to phone modification below +} + + +###################### +# ADD=511111111111 confirmation before deletion of server record +###################### + +if ($ADD==511111111111) +{ + echo ""; + + if ( (strlen($server_id) < 2) or (strlen($server_ip) < 7) or ($LOGast_delete_phones < 1) ) + { + echo "
SERVIDOR NOT DELETED - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
ID Del Servidor be at least 2 characters in length\n"; + echo "
IP Del Servidor be at least 7 characters in length\n"; + } + else + { + echo "
SERVIDOR DELETION CONFIRMATION: $server_id - $server_ip\n"; + echo "

Chasque aquí para suprimir el teléfono $server_id - $server_ip


\n"; + } +$ADD='311111111111'; # go to server modification below +} + + +###################### +# ADD=5111111111111 confirmation before deletion of conference record +###################### + +if ($ADD==5111111111111) +{ + echo ""; + + if ( (strlen($conf_exten) < 2) or (strlen($server_ip) < 7) or ($LOGast_delete_phones < 1) ) + { + echo "
CONFERENCE NOT DELETED - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Conference must be at least 2 characters in length\n"; + echo "
IP Del Servidor be at least 7 characters in length\n"; + } + else + { + echo "
CONFERENCE DELETION CONFIRMATION: $conf_exten - $server_ip\n"; + echo "

Chasque aquí para suprimir el teléfono $conf_exten - $server_ip


\n"; + } +$ADD='3111111111111'; # go to conference modification below +} + + +###################### +# ADD=51111111111111 confirmation before deletion of vicidial conference record +###################### + +if ($ADD==51111111111111) +{ + echo ""; + + if ( (strlen($conf_exten) < 2) or (strlen($server_ip) < 7) or ($LOGast_delete_phones < 1) ) + { + echo "
VICIDIAL CONFERENCE NOT DELETED - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Conference must be at least 2 characters in length\n"; + echo "
IP Del Servidor be at least 7 characters in length\n"; + } + else + { + echo "
VICIDIAL CONFERENCE DELETION CONFIRMATION: $conf_exten - $server_ip\n"; + echo "

Chasque aquí para suprimir el teléfono $conf_exten - $server_ip


\n"; + } +$ADD='31111111111111'; # go to vicidial conference modification below +} + + + +###################################################################################################### +###################################################################################################### +####### 6 series, delete records +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=6 delete user record +###################### + +if ($ADD==6) +{ + echo ""; + + if ( ( strlen($user) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_users < 1) ) + { + echo "
USUARIO NO SUPRIMIDO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
User be at least 2 characters in length\n"; + } + else + { + $stmtA="DELETE from vicidial_users where user='$user' limit 1;"; + $rslt=mysql_query($stmtA, $link); + + $stmt="DELETE from vicidial_campaign_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_inbound_group_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING USER!!!!|$PHP_AUTH_USER|$ip|$user|$stmtA|$stmt|\n"); + fclose($fp); + } + echo "
CANCELADURA DEL USUARIO TERMINADA: $user\n"; + echo "

\n"; + } + +$ADD='0'; # go to user list +} + +###################### +# ADD=61 delete campaign record +###################### + +if ($ADD==61) +{ + echo ""; + + if ( ( strlen($campaign_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_campaigns < 1) ) + { + echo "
CAMPAÑA NO SUPRIMIDA - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Campaña_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_campaigns where campaign_id='$campaign_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaign_agents where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_live_agents where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaign_statuses where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaign_hotkeys where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_callbacks where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaign_stats where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_lead_recycle where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaign_server_stats where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_server_trunks where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_pause_codes where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaigns_list_mix where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
QUITAR LOS PLOMOS DE LA TOLVA DE LA LISTA DE VIEJA TOLVA DE LA CAMPAÚA ($campaign_id)\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!DELETING CAMPAIGN!|$PHP_AUTH_USER|$ip|campaign_id='$campaign_id'|\n"); + fclose($fp); + } + echo "
LA CANCELADURA DE LA CAMPAÑA TERMINÓ: $campaign_id\n"; + echo "

\n"; + } + +$ADD='10'; # go to campaigns list +} + +###################### +# ADD=62 Logout all agents from a campaign +###################### + +if ($ADD==62) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
AGENTES NO REGISTRADOS FUERA DE CAMPAÑA - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Campaña_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_live_agents where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!AGENTE LOGOUT!!!!!!|$PHP_AUTH_USER|$ip|campaign_id='$campaign_id'|\n"); + fclose($fp); + } + echo "
EL REGISTRO DE ESTADO DE LA MÃQUINA DEL AGENTE TERMINÓ: $campaign_id\n"; + echo "

\n"; + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +$ADD='31'; # go to campaign modification below +} + + +###################### +# ADD=63 Emergency VDAC Jam Clear +###################### + +if ($ADD==63) +{ + if ($LOGmodify_campaigns==1) + { + if (eregi('IN',$stage)) + {$group_id=$campaign_id;} + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
VDAC NO DESPEJÓ PARA LA CAMPAÑA - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Campaña_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_auto_calls where status='LIVE' and campaign_id='$campaign_id' order by call_time limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|EMERGENCY VDAC CLEAR|$PHP_AUTH_USER|$ip|campaign_id='$campaign_id'|\n"); + fclose($fp); + } + echo "
DE REGISTRO PASADO DE VDAC DESPEJADA PARA LA CAMPAÑA: $campaign_id\n"; + echo "

\n"; + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +# go to campaign modification below +if (eregi('IN',$stage)) + {$ADD='3111';} +else + {$ADD='31';} +} + + +###################### +# ADD=65 delete campaign lead recycle in the system +###################### + +if ($ADD==65) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
EL PLOMO DE LA CAMPAÑA RECICLA NO SUPRIMIDO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
el estado debe estar entre 1 y 6 caracteres en longitud\n"; + echo "
la tentativa retrasa debe ser por lo menos 120 segundos\n"; + echo "
las tentativas máximas deben ser a partir la 1 a 10\n"; + } + else + { + echo "
EL PLOMO DE LA CAMPAÑA RECICLA SUPRIMIDO: $campaign_id - $status - $attempt_delay\n"; + + $stmt="DELETE FROM vicidial_lead_recycle where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE LEAD RECYCLE |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +$SUB=25; +$ADD=31; # go to campaign modification form below +} + + +###################### +# ADD=66 delete auto alt dial status from the campaign +###################### + +if ($ADD==66) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and auto_alt_dial_statuses LIKE \"% $status %\";"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] < 1) + {echo "
ESTADO AUTO DEL DIAL DEL ALT NO SUPRIMIDO - este estado del dial del alt del automóvil no está en esta campaña\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
ESTADO AUTO DEL DIAL DEL ALT NO SUPRIMIDO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
el estado debe estar entre 1 y 6 caracteres en longitud\n"; + } + else + { + echo "
ESTADO AUTO DEL DIAL DEL ALT SUPRIMIDO: $campaign_id - $status\n"; + + $stmt="SELECT auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + $auto_alt_dial_statuses = eregi_replace(" $status "," ",$row[0]); + $stmt="UPDATE vicidial_campaigns set auto_alt_dial_statuses='$auto_alt_dial_statuses' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE AUTALTDIALSTTUS|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +$SUB=26; +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=67 delete agent pause code in the system +###################### + +if ($ADD==67) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($pause_code) < 1) ) + { + echo "
CÓDIGO DE LA PAUSA DE LA CAMPAÑA NO SUPRIMIDO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
pause code must be between 1 and 6 characters in length\n"; + } + else + { + echo "
CAMPAIGN PAUSE CODE DELETED: $campaign_id - $pause_code\n"; + + $stmt="DELETE FROM vicidial_pause_codes where campaign_id='$campaign_id' and pause_code='$pause_code';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE AGENTE PAUSECODE|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +$SUB=27; +$ADD=31; # go to campaign modification form below +} + + +###################### +# ADD=68 remove campaign dial status +###################### + +if ($ADD==68) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and dial_statuses LIKE \"% $status %\";"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] < 1) + {echo "
ESTADO DEL DIAL DE LA CAMPAÑA NO QUITADO - este estado del dial no se selecciona para esta campaña\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
ESTADO DEL DIAL DE LA CAMPAÑA NO QUITADO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
el estado debe estar entre 1 y 6 caracteres en longitud\n"; + } + else + { + echo "
EL ESTADO DEL DIAL DE LA CAMPAÑA QUITÓ: $campaign_id - $status\n"; + + $stmt="SELECT dial_statuses from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + $dial_statuses = eregi_replace(" $status "," ",$row[0]); + $stmt="UPDATE vicidial_campaigns set dial_statuses='$dial_statuses' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DIAL STATUS REMOVED |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +#$SUB=28; +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=611 delete list record and all leads within it +###################### + +if ($ADD==611) +{ + echo ""; + + if ( ( strlen($list_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_lists < 1) ) + { + echo "
LISTA NO SUPRIMIDA - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
List_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_lists where list_id='$list_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + echo "
QUITAR LOS PLOMOS DE LA TOLVA DE LA LISTA DE VIEJA TOLVA DE LA CAMPAÚA ($list_id)\n"; + $stmt="DELETE from vicidial_hopper where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
QUITAR LOS PLOMOS DE LA LISTA DE LA TABLA DE VICIDIAL_LIST\n"; + $stmt="DELETE from vicidial_list where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING LIST!!!!|$PHP_AUTH_USER|$ip|list_id='$list_id'|\n"); + fclose($fp); + } + echo "
LA CANCELADURA DE LA LISTA TERMINÓ: $list_id\n"; + echo "

\n"; + } + +$ADD='100'; # go to lists list +} + +###################### +# ADD=6111 delete in-group record +###################### + +if ($ADD==6111) +{ + echo ""; + + if ( (strlen($group_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_ingroups < 1) ) + { + echo "
EN-GRUPO NO SUPRIMIDO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Group_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_inbound_groups where group_id='$group_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_inbound_group_agents where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_live_inbound_agents where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING IN-GROUP!!|$PHP_AUTH_USER|$ip|group_id='$group_id'|\n"); + fclose($fp); + } + echo "
CANCELADURA DE EN-GRUPO TERMINADA: $group_id\n"; + echo "

\n"; + } + +$ADD='1000'; # go to in-group list +} + +###################### +# ADD=61111 delete remote agent record +###################### + +if ($ADD==61111) +{ + echo ""; + + if ( (strlen($remote_agent_id) < 1) or ($CoNfIrM != 'YES') or ($LOGdelete_remote_agents < 1) ) + { + echo "
AGENTE ALEJADO NO SUPRIMIDO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Remote_agent_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_remote_agents where remote_agent_id='$remote_agent_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING RMTAGENT!!|$PHP_AUTH_USER|$ip|remote_agent_id='$remote_agent_id'|\n"); + fclose($fp); + } + echo "
CANCELADURA ALEJADA DEL AGENTE TERMINADA: $remote_agent_id\n"; + echo "

\n"; + } + +$ADD='10000'; # go to remote agents list +} + +###################### +# ADD=611111 delete user group record +###################### + +if ($ADD==611111) +{ + echo ""; + + if ( (strlen($user_group) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_user_groups < 1) ) + { + echo "
GRUPO DE USUARIO NO SUPRIMIDO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
User_group be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_user_groups where user_group='$user_group' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING USRGROUP!!|$PHP_AUTH_USER|$ip|user_group='$user_group'|\n"); + fclose($fp); + } + echo "
CANCELADURA DEL GRUPO DE USUARIO TERMINADA: $user_group\n"; + echo "

\n"; + } + +$ADD='100000'; # go to user group list +} + +###################### +# ADD=6111111 delete script record +###################### + +if ($ADD==6111111) +{ + echo ""; + + if ( (strlen($script_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_scripts < 1) ) + { + echo "
ESCRITURA NO SUPRIMIDA - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Script_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_scripts where script_id='$script_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING SCRIPT!!!!|$PHP_AUTH_USER|$ip|script_id='$script_id'|\n"); + fclose($fp); + } + echo "
CANCELADURA DE LA ESCRITURA TERMINADA: $script_id\n"; + echo "

\n"; + } + +$ADD='1000000'; # go to script list +} + + +###################### +# ADD=61111111 delete filter record +###################### + +if ($ADD==61111111) +{ + echo ""; + + if ( (strlen($lead_filter_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_filters < 1) ) + { + echo "
FILTRO NO SUPRIMIDO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
La identificación del filtro debe ser por lo menos 2 caracteres en longitud\n"; + } + else + { + $stmt="DELETE from vicidial_lead_filters where lead_filter_id='$lead_filter_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING FILTER!!!!|$PHP_AUTH_USER|$ip|lead_filter_id='$lead_filter_id'|\n"); + fclose($fp); + } + echo "
CANCELADURA DEL FILTRO TERMINADA: $lead_filter_id\n"; + echo "

\n"; + } + +$ADD='10000000'; # go to filter list +} + + +###################### +# ADD=611111111 delete call times record +###################### + +if ($ADD==611111111) +{ + echo ""; + + if ( (strlen($call_time_id) < 2) or ($LOGdelete_call_times < 1) ) + { + echo "
TIEMPO DE LA LLAMADA NO SUPRIMIDO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
_ llamar tiempo identificación deber ser por lo menos 2 carácter enlongitud\n"; + } + else + { + $stmt="DELETE from vicidial_call_times where call_time_id='$call_time_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING CALL TIME!|$PHP_AUTH_USER|$ip|call_time_id='$call_time_id'|\n"); + fclose($fp); + } + echo "
_ LLAMAR TIEMPO CANCELADURA TERMINAR: $call_time_id\n"; + echo "

\n"; + } + +$ADD='100000000'; # go to call times list +} + + +###################### +# ADD=6111111111 delete state call times record +###################### + +if ($ADD==6111111111) +{ + echo ""; + + if ( (strlen($call_time_id) < 2) or ($LOGdelete_call_times < 1) ) + { + echo "
TIEMPO DE LA LLAMADA DEL ESTADO NO SUPRIMIDO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
_ llamar tiempo identificación deber ser por lo menos 2 carácter enlongitud\n"; + } + else + { + $stmt="DELETE from vicidial_state_call_times where state_call_time_id='$call_time_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT call_time_id,ct_state_call_times from vicidial_call_times where ct_state_call_times LIKE \"%|$call_time_id|%\" order by call_time_id;"; + $rslt=mysql_query($stmt, $link); + $sct_to_print = mysql_num_rows($rslt); + $sct_list=''; + + $o=0; + while ($sct_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $sct_ids[$o] = "$rowx[0]"; + $sct_states[$o] = "$rowx[1]"; + $o++; + } + $o=0; + + while ($sct_to_print > $o) { + $sct_states[$o] = eregi_replace("\|$call_time_id\|",'|',$sct_states[$o]); + $stmt="UPDATE vicidial_call_times set ct_state_call_times='$sct_states[$o]' where call_time_id='$sct_ids[$o]';"; + $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + echo "Regla Del Estado Quitada: $sct_ids[$o]
\n"; + $o++; + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING CALL TIME!|$PHP_AUTH_USER|$ip|state_call_time_id='$call_time_id'|\n"); + fclose($fp); + } + echo "
CANCELADURA DEL TIEMPO DE LA LLAMADA DEL ESTADO TERMINADA: $call_time_id\n"; + echo "

\n"; + } + +$ADD='1000000000'; # go to call times list +} + + +###################### +# ADD=61111111111 delete phone record +###################### + +if ($ADD==61111111111) +{ + echo ""; + + if ( (strlen($extension) < 2) or (strlen($server_ip) < 7) or ($CoNfIrM != 'YES') or ($LOGast_delete_phones < 1) ) + { + echo "
TELÉFONO NO SUPRIMIDO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Extension be at least 2 characters in length\n"; + echo "
IP Del Servidor be at least 7 characters in length\n"; + } + else + { + $stmt="DELETE from phones where extension='$extension' and server_ip='$server_ip' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING PHONE!!!|$PHP_AUTH_USER|$ip|extension='$extension'|server_ip='$server_ip'|\n"); + fclose($fp); + } + echo "
LA CANCELADURA DEL TELÉFONO TERMINÓ: $extension - $server_ip\n"; + echo "

\n"; + } +$ADD='10000000000'; # go to phone list +} + + +###################### +# ADD=611111111111 delete server record +###################### + +if ($ADD==611111111111) +{ + echo ""; + + if ( (strlen($server_id) < 2) or (strlen($server_ip) < 7) or ($CoNfIrM != 'YES') or ($LOGast_delete_phones < 1) ) + { + echo "
SERVIDOR NOT DELETED - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
ID Del Servidor be at least 2 characters in length\n"; + echo "
IP Del Servidor be at least 7 characters in length\n"; + } + else + { + $stmt="DELETE from servers where server_id='$server_id' and server_ip='$server_ip' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING SERVER!!|$PHP_AUTH_USER|$ip|server_id='$server_id'|server_ip='$server_ip'|\n"); + fclose($fp); + } + echo "
SERVIDOR DELETION COMPLETED: $server_id - $server_ip\n"; + echo "

\n"; + } +$ADD='100000000000'; # go to server list +} + + +###################### +# ADD=621111111111 delete vicidial server trunk record in the system +###################### + +if ($ADD==621111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($server_ip) < 7) ) + { + echo "
EXPEDIENTE DEL TRONCO DEL SERVIDOR DE VICIDIAL NO SUPRIMIDO - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
la campaña debe estar entre 3 y 8 caracteres en longitud\n"; + echo "
el server_ip retrasa debe ser por lo menos 7 caracteres\n"; + } + else + { + echo "
EXPEDIENTE DEL TRONCO DEL SERVIDOR DE VICIDIAL SUPRIMIDO: $campaign_id - $server_ip\n"; + + $stmt="DELETE FROM vicidial_server_trunks where campaign_id='$campaign_id' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE SERVIDOR TRUNK |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +$ADD=311111111111; # go to server modification form below +} + + +###################### +# ADD=6111111111111 delete conference record +###################### + +if ($ADD==6111111111111) +{ + echo ""; + + if ( (strlen($conf_exten) < 2) or (strlen($server_ip) < 7) or ($CoNfIrM != 'YES') or ($LOGast_delete_phones < 1) ) + { + echo "
CONFERENCE NOT DELETED - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Conference be at least 2 characters in length\n"; + echo "
IP Del Servidor be at least 7 characters in length\n"; + } + else + { + $stmt="DELETE from conferences where conf_exten='$conf_exten' and server_ip='$server_ip' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING CONF!!!!|$PHP_AUTH_USER|$ip|conf_exten='$conf_exten'|server_ip='$server_ip'|\n"); + fclose($fp); + } + echo "
CONFERENCE DELETION COMPLETED: $conf_exten - $server_ip\n"; + echo "

\n"; + } +$ADD='1000000000000'; # go to conference list +} + + +###################### +# ADD=61111111111111 delete vicidial conference record +###################### + +if ($ADD==61111111111111) +{ + echo ""; + + if ( (strlen($conf_exten) < 2) or (strlen($server_ip) < 7) or ($CoNfIrM != 'YES') or ($LOGast_delete_phones < 1) ) + { + echo "
VICIDIAL CONFERENCE NOT DELETED - Vaya por favor detrás y mire los datos que usted incorporó\n"; + echo "
Conference be at least 2 characters in length\n"; + echo "
IP Del Servidor be at least 7 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_conferences where conf_exten='$conf_exten' and server_ip='$server_ip' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING CONF!!!!|$PHP_AUTH_USER|$ip|conf_exten='$conf_exten'|server_ip='$server_ip'|\n"); + fclose($fp); + } + echo "
VICIDIAL CONFERENCE DELETION COMPLETED: $conf_exten - $server_ip\n"; + echo "

\n"; + } +$ADD='10000000000000'; # go to vicidial conference list +} + + + + + +###################################################################################################### +###################################################################################################### +####### 3 series, record modification forms +###################################################################################################### +###################################################################################################### + + + + +###################### +# ADD=3 modify user info in the system +###################### + +if ($ADD==3) +{ + if ($LOGmodify_users==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $user_level = $row[4]; + $user_group = $row[5]; + $phone_login = $row[6]; + $phone_pass = $row[7]; + $delete_users = $row[8]; + $delete_user_groups = $row[9]; + $delete_lists = $row[10]; + $delete_campaigns = $row[11]; + $delete_ingroups = $row[12]; + $delete_remote_agents = $row[13]; + $load_leads = $row[14]; + $campaign_detail = $row[15]; + $ast_admin_access = $row[16]; + $ast_delete_phones = $row[17]; + $delete_scripts = $row[18]; + $modify_leads = $row[19]; + $hotkeys_active = $row[20]; + $change_agent_campaign =$row[21]; + $agent_choose_ingroups =$row[22]; + $scheduled_callbacks = $row[24]; + $agentonly_callbacks = $row[25]; + $agentcall_manual = $row[26]; + $vicidial_recording = $row[27]; + $vicidial_transfers = $row[28]; + $delete_filters = $row[29]; + $alter_agent_interface_options =$row[30]; + $closer_default_blended = $row[31]; + $delete_call_times = $row[32]; + $modify_call_times = $row[33]; + $modify_users = $row[34]; + $modify_campaigns = $row[35]; + $modify_lists = $row[36]; + $modify_scripts = $row[37]; + $modify_filters = $row[38]; + $modify_ingroups = $row[39]; + $modify_usergroups = $row[40]; + $modify_remoteagents = $row[41]; + $modify_servers = $row[42]; + $view_reports = $row[43]; + $vicidial_recording_override = $row[44]; + $alter_custdata_override = $row[45]; + + if ( ($user_level >= $LOGuser_level) and ($LOGuser_level < 9) ) + { + echo "
Usted no tiene permisos de modificar a este usuario: $row[1]\n"; + } + else + { + echo "
MODIFIQUE Un EXPEDIENTE De los USUARIOS: $row[1]\n"; + if ($LOGuser_level > 8) + {echo "\n";} + else + { + if ($LOGalter_agent_interface == "1") + {echo "\n";} + else + {echo "\n";} + } + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + if ( ($LOGuser_level > 8) or ($LOGalter_agent_interface == "1") ) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + if ($LOGuser_level > 8) + { + echo "\n"; + +#9BB9FB +#B9CBFD + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + echo "\n"; + echo "
NÚmero De Usuario: $row[1]$NWB#vicidial_users-user$NWE
Contraseña: $NWB#vicidial_users-pass$NWE
Nombre Completo: $NWB#vicidial_users-full_name$NWE
Nivel Del Usuario: $NWB#vicidial_users-user_level$NWE
Grupo Del Usuario: $NWB#vicidial_users-user_group$NWE
Conexión Del Teléfono: $NWB#vicidial_users-phone_login$NWE
Contraseña Del Teléfono: $NWB#vicidial_users-phone_pass$NWE
OPCIONES DE INTERFAZ DEL AGENTE:
El Agente Elige Ingroups: $NWB#vicidial_users-agent_choose_ingroups$NWE
Hot Keys Activo: $NWB#vicidial_users-hotkeys_active$NWE
Servicios repetidos Programar: $NWB#vicidial_users-scheduled_callbacks$NWE
Servicios repetidos Del Agente-Solamente: $NWB#vicidial_users-agentonly_callbacks$NWE
Manual de la llamada del agente: $NWB#vicidial_users-agentcall_manual$NWE
Grabación de Vicidial: $NWB#vicidial_users-vicidial_recording$NWE
Vicidial transfiere: $NWB#vicidial_users-vicidial_transfers$NWE
Un Defecto Más cercano Mezclado: $NWB#vicidial_users-closer_default_blended$NWE
Invalidación De la Grabación de VICIDIAL:$NWB#vicidial_users-vicidial_recording_override$NWE
El Agente Altera La Invalidación De los Datos Del Cliente: $NWB#vicidial_users-alter_custdata_override$NWE
Filas De la Campaña:$NWB#vicidial_users-campaign_ranks$NWE
\n"; + echo "\n"; + echo "$RANKcampaigns_list"; + echo "
\n"; + echo "
Grupos De entrada: $NWB#vicidial_users-closer_campaigns$NWE
\n"; + echo "\n"; + echo "$RANKgroups_list"; + echo "
\n"; + echo "
OPCIONES DE INTERFAZ DEL ADMIN:
Informes De la Visión: $NWB#vicidial_users-view_reports$NWE
Altere Las Opciones De Interfaz Del Agente: $NWB#vicidial_users-alter_agent_interface_options$NWE
Modifique A Usuarios: $NWB#vicidial_users-modify_sections$NWE
Cambie La Campaña Del Agente: $NWB#vicidial_users-change_agent_campaign$NWE
Usuarios de la cancelación: $NWB#vicidial_users-delete_users$NWE
Modifique A Grupos De Usuario: $NWB#vicidial_users-modify_sections$NWE
Suprima a grupos de usuario: $NWB#vicidial_users-delete_user_groups$NWE
Modifique Las Listas: $NWB#vicidial_users-modify_sections$NWE
La cancelación enumera: $NWB#vicidial_users-delete_lists$NWE
La carga conduce: $NWB#vicidial_users-load_leads$NWE
Modifique Los Plomos: $NWB#vicidial_users-modify_leads$NWE
Modifique Las Campañas: $NWB#vicidial_users-modify_sections$NWE
Detalle de la campaña: $NWB#vicidial_users-campaign_detail$NWE
La cancelación hace campaña: $NWB#vicidial_users-delete_campaigns$NWE
Modifique A En-Grupos: $NWB#vicidial_users-modify_sections$NWE
En-Grupos de la cancelación: $NWB#vicidial_users-delete_ingroups$NWE
Modifique Los Agentes Alejados: $NWB#vicidial_users-modify_sections$NWE
Suprima los agentes alejados: $NWB#vicidial_users-delete_remote_agents$NWE
Modifique Las Escrituras: $NWB#vicidial_users-modify_sections$NWE
Escritura De la Cancelacións: $NWB#vicidial_users-delete_scripts$NWE
Modifique Los Filtros: $NWB#vicidial_users-modify_sections$NWE
Filtro De la Cancelacións: $NWB#vicidial_users-delete_filters$NWE
Acceso de AGC Admin: $NWB#vicidial_users-ast_admin_access$NWE
La cancelación de AGC telefona: $NWB#vicidial_users-ast_delete_phones$NWE
Modifique El Tiempo De la Llamadas: $NWB#vicidial_users-modify_call_times$NWE
Delete Tiempos De la Llamada: $NWB#vicidial_users-delete_call_times$NWE
Modifique Los Servidores: $NWB#vicidial_users-modify_sections$NWE
\n"; + + if ($LOGdelete_users > 0) + { + echo "

SUPRIMA A ESTE USUARIO\n"; + } + echo "

Chasque aquí para la hoja de tiempo del usuario\n"; + echo "

Chasque aquí para el estado del usuario\n"; + echo "

Clique aquí para ver las estadísticas del usuario\n"; + echo "

Chasque aquí para los asimientos del servicio repetido del usuario\n"; + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + +###################### +# ADD=31 modify campaign info in the system - Detail view +###################### + +if ( ($LOGcampaign_detail < 1) and ($ADD==31) ) {$ADD=34;} # send to Basic if not allowed + +if ( ($ADD==31) and ( (!eregi("$campaign_id",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) ) + {$ADD=30;} # send to not allowed screen if not in vicidial_user_groups allowed_campaigns list + +if ($ADD==31) +{ + if ($LOGmodify_campaigns==1) + { + if ($stage=='show_dialable') + { + $stmt="UPDATE vicidial_campaigns set display_dialable_count='Y' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + if ($stage=='hide_dialable') + { + $stmt="UPDATE vicidial_campaigns set display_dialable_count='N' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + + $stmt="SELECT * from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $campaign_name = $row[1]; + $dial_status_a = $row[3]; + $dial_status_b = $row[4]; + $dial_status_c = $row[5]; + $dial_status_d = $row[6]; + $dial_status_e = $row[7]; + $lead_order = $row[8]; + $allow_closers = $row[12]; + $hopper_level = $row[13]; + $auto_dial_level = $row[14]; + $next_agent_call = $row[15]; + $local_call_time = $row[16]; + $voicemail_ext = $row[17]; + $dial_timeout = $row[18]; + $dial_prefix = $row[19]; + $campaign_cid = $row[20]; + $campaign_vdad_exten = $row[21]; + $campaign_rec_exten = $row[22]; + $campaign_recording = $row[23]; + $campaign_rec_filename = $row[24]; + $script_id = $row[25]; + $get_call_launch = $row[26]; + $am_message_exten = $row[27]; + $amd_send_to_vmx = $row[28]; + $xferconf_a_dtmf = $row[29]; + $xferconf_a_number = $row[30]; + $xferconf_b_dtmf = $row[31]; + $xferconf_b_number = $row[32]; + $alt_number_dialing = $row[33]; + $scheduled_callbacks = $row[34]; + $lead_filter_id = $row[35]; + if ($lead_filter_id=='') {$lead_filter_id='NONE';} + $drop_call_seconds = $row[36]; + $safe_harbor_message = $row[37]; + $safe_harbor_exten = $row[38]; + $display_dialable_count = $row[39]; + $wrapup_seconds = $row[40]; + $wrapup_message = $row[41]; + # $closer_campaigns = $row[42]; + $use_internal_dnc = $row[43]; + $allcalls_delay = $row[44]; + $omit_phone_code = $row[45]; + $dial_method = $row[46]; + $available_only_ratio_tally = $row[47]; + $adaptive_dropped_percentage = $row[48]; + $adaptive_maximum_level = $row[49]; + $adaptive_latest_server_time = $row[50]; + $adaptive_intensity = $row[51]; + $adaptive_dl_diff_target = $row[52]; + $concurrent_transfers = $row[53]; + $auto_alt_dial = $row[54]; + $auto_alt_dial_statuses = $row[55]; + $agent_pause_codes_active = $row[56]; + $campaign_description = $row[57]; + $campaign_changedate = $row[58]; + $campaign_stats_refresh = $row[59]; + $campaign_logindate = $row[60]; + $dial_statuses = $row[61]; + $disable_alter_custdata = $row[62]; + $no_hopper_leads_logins = $row[63]; + $list_order_mix = $row[64]; + $campaign_allow_inbound = $row[65]; + $manual_dial_list_id = $row[66]; + $default_xfer_group = $row[67]; + + if (ereg("DISABLED",$list_order_mix)) + {$DEFlistDISABLE = ''; $DEFstatusDISABLED=0;} + else + {$DEFlistDISABLE = 'disabled'; $DEFstatusDISABLED=1;} + + $stmt="SELECT count(*) from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and status='ACTIVE'"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0] < 1) + { + $mixes_list="\n"; + $mixname_list["DISABLED"] = "DISABLED"; + } + else + { + ##### get list_mix listings for dynamic pulldown + $stmt="SELECT vcl_id,vcl_name from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and status='ACTIVE' limit 1"; + $rslt=mysql_query($stmt, $link); + $mixes_to_print = mysql_num_rows($rslt); + $mixes_list="\n"; + + $o=0; + while ($mixes_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $mixes_list .= "\n"; + $mixname_list["ACTIVE"] = "$rowx[0] - $rowx[1]"; + $o++; + } + } + + ##### get status listings for dynamic pulldown + $stmt="SELECT * from vicidial_statuses order by status"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $statuses_list=''; + + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $statuses_list .= "\n"; + $statname_list["$rowx[0]"] = "$rowx[1]"; + $LRstatuses_list .= "\n"; + if (eregi("Y",$rowx[2])) + {$HKstatuses_list .= "\n";} + $o++; + } + + $stmt="SELECT * from vicidial_campaign_statuses where campaign_id='$campaign_id' order by status"; + $rslt=mysql_query($stmt, $link); + $Cstatuses_to_print = mysql_num_rows($rslt); + + $o=0; + while ($Cstatuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $statuses_list .= "\n"; + $statname_list["$rowx[0]"] = "$rowx[1]"; + $LRstatuses_list .= "\n"; + if (eregi("Y",$rowx[2])) + {$HKstatuses_list .= "\n";} + $o++; + } + + $dial_statuses = preg_replace("/ -$/","",$dial_statuses); + $Dstatuses = explode(" ", $dial_statuses); + $Ds_to_print = (count($Dstatuses) -1); + + ##### get in-groups listings for dynamic pulldown list menu + $stmt="SELECT group_id,group_name from vicidial_inbound_groups $xfer_groupsSQL order by group_id"; + $rslt=mysql_query($stmt, $link); + $Xgroups_to_print = mysql_num_rows($rslt); + $Xgroups_menu=''; + $Xgroups_selected=0; + $o=0; + while ($Xgroups_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $Xgroups_menu .= "\n"; + $o++; + } + if ($Xgroups_selected < 1) + {$Xgroups_menu .= "\n";} + else + {$Xgroups_menu .= "\n";} + + + if ($SUB<1) {$camp_detail_color=$subcamp_color;} + else {$camp_detail_color=$campaigns_color;} + if ($SUB==22) {$camp_statuses_color=$subcamp_color;} + else {$camp_statuses_color=$campaigns_color;} + if ($SUB==23) {$camp_hotkeys_color=$subcamp_color;} + else {$camp_hotkeys_color=$campaigns_color;} + if ($SUB==25) {$camp_recycle_color=$subcamp_color;} + else {$camp_recycle_color=$campaigns_color;} + if ($SUB==26) {$camp_autoalt_color=$subcamp_color;} + else {$camp_autoalt_color=$campaigns_color;} + if ($SUB==27) {$camp_pause_color=$subcamp_color;} + else {$camp_pause_color=$campaigns_color;} + if ($SUB==29) {$camp_listmix_color=$subcamp_color;} + else {$camp_listmix_color=$campaigns_color;} + echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "
$row[0]: Basic Detail StatusesHotKeysLead RecyclingAuto Alt DialPause CodesList Mix Real-Time
\n"; + + echo "
\n"; + echo ""; + + echo "
\n"; + + if ($SUB < 1) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + $o=0; + while ($Ds_to_print > $o) + { + $o++; + $Dstatus = $Dstatuses[$o]; + + echo "\n"; + } + else + { + echo "$Dstatus - $statname_list[$Dstatus]         \n"; + echo "QUITE\n"; + } + } + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + + + echo "\n"; + + echo "\n"; + + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + if ($campaign_allow_inbound == 'Y') + { + echo "\n"; + } + + echo "\n"; + + if ($allow_closers == 'Y') + { + echo "\n"; + } + + echo "\n"; + echo "
ID De la Campaña: $row[0]$NWB#vicidial_campaigns-campaign_id$NWE
Nombre de la Campaña: $NWB#vicidial_campaigns-campaign_name$NWE
Descripción De la Campaña: $NWB#vicidial_campaigns-campaign_description$NWE
Campaña Change Date: $campaign_changedate   $NWB#vicidial_campaigns-campaign_changedate$NWE
Campaña Login Date: $campaign_logindate   $NWB#vicidial_campaigns-campaign_logindate$NWE
Activo: $NWB#vicidial_campaigns-active$NWE
Extensión del parking: - Filename: $NWB#vicidial_campaigns-park_ext$NWE
Formulario Web: $NWB#vicidial_campaigns-web_form_address$NWE
Permitir Closers: $NWB#vicidial_campaigns-allow_closers$NWE
Permita de entrada y mezclado:$NWB#vicidial_campaigns-campaign_allow_inbound$NWE
Estado Del Dial $o: \n"; + + if ($DEFstatusDISABLED > 0) + { + echo "$Dstatus - $statname_list[$Dstatus]         \n"; + echo "REMOVE
Add A Dial Estado:   \n"; + echo "     $NWB#vicidial_campaigns-dial_status$NWE
Orden De la Lista: $NWB#vicidial_campaigns-lead_order$NWE
List Mix: $NWB#vicidial_campaigns-list_order_mix$NWE
Filtro del plomo: $NWB#vicidial_campaigns-lead_filter_id$NWE
Nivel Del Hopper: $NWB#vicidial_campaigns-hopper_level$NWE
Forzar el Reinicio del Hopper: $NWB#vicidial_campaigns-force_reset_hopper$NWE
Método Del Dial: $NWB#vicidial_campaigns-dial_method$NWE
Nivel del Auto-Dial: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE       ADAPTE LA INVALIDACIÓN
Solamente Cuenta Disponible: $NWB#vicidial_campaigns-available_only_ratio_tally$NWE
Límite Del Porcentaje De la Gota: % $NWB#vicidial_campaigns-adaptive_dropped_percentage$NWE
El Máximo Adapta El Nivel Del Dial: number only $NWB#vicidial_campaigns-adaptive_maximum_level$NWE
El Tiempo Más último Del Servidor: 4 Solamente dígitos $NWB#vicidial_campaigns-adaptive_latest_server_time$NWE
Adapte El Modificante De la Intensidad: $NWB#vicidial_campaigns-adaptive_intensity$NWE
Blanco Llana De la Diferencia Del Dial: $NWB#vicidial_campaigns-adaptive_dl_diff_target$NWE
Transferencias Concurrentes: $NWB#vicidial_campaigns-concurrent_transfers$NWE
El Marcar Auto Del Alt-Nu'mero: $NWB#vicidial_campaigns-auto_alt_dial$NWE
Llamar al Siguiente Agente: $NWB#vicidial_campaigns-next_agent_call$NWE
Franja horaria de llamada: $NWB#vicidial_campaigns-local_call_time$NWE
Tiempo de espera Del Dial: in seconds$NWB#vicidial_campaigns-dial_timeout$NWE
Prefijo al marcar: for 91NXXNXXXXXX value would be 9, for no dial prefix use X$NWB#vicidial_campaigns-dial_prefix$NWE
Omita El Código Del Teléfono: $NWB#vicidial_campaigns-omit_phone_code$NWE
CallerID de la Campaña: $NWB#vicidial_campaigns-campaign_cid$NWE
Exten VDAD de La campaña: $NWB#vicidial_campaigns-campaign_vdad_exten$NWE
Extensión de Rec de la campaña: $NWB#vicidial_campaigns-campaign_rec_exten$NWE
Grabación De la Campaña: $NWB#vicidial_campaigns-campaign_recording$NWE
Nombre de fichero De Rec De la Campaña: $NWB#vicidial_campaigns-campaign_rec_filename$NWE
La Registración Retrasa: in seconds$NWB#vicidial_campaigns-allcalls_delay$NWE
Script: $NWB#vicidial_campaigns-campaign_script$NWE
Consiga El Lanzamiento De la Llamada: $NWB#vicidial_campaigns-get_call_launch$NWE
Mensaje del contestador automático: $NWB#vicidial_campaigns-am_message_exten$NWE
AMD envían a la VM exten: $NWB#vicidial_campaigns-amd_send_to_vmx$NWE
Transfiera -Conf DTMF 1: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
Transfiera -Conf El Número 1: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
Transfiera -Conf DTMF 2: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
Transfiera -Conf El Número 2: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
El Marcar Del Número Del Alt: $NWB#vicidial_campaigns-alt_number_dialing$NWE
Servicios repetidos Programar: $NWB#vicidial_campaigns-scheduled_callbacks$NWE
Segundos De la Llamada De la Gota: $NWB#vicidial_campaigns-drop_call_seconds$NWE
Buzón de Voz: $NWB#vicidial_campaigns-voicemail_ext$NWE
Utilice El Mensaje Seguro Del Puerto: $NWB#vicidial_campaigns-safe_harbor_message$NWE
Puerto Seguro Exten: $NWB#vicidial_campaigns-safe_harbor_exten$NWE
Segundos De Wrap Up: $NWB#vicidial_campaigns-wrapup_seconds$NWE
Mensaje De Wrap Up: $NWB#vicidial_campaigns-wrapup_message$NWE
Utilice La Lista Interna de DNC: $NWB#vicidial_campaigns-use_internal_dnc$NWE
AgentCódigos De la PausaActivo: $NWB#vicidial_campaigns-agent_pause_codes_active$NWE
Campaña Stats Refresh: $NWB#vicidial_campaigns-campaign_stats_refresh$NWE
Inhabilite Alteran Datos Del Cliente:$NWB#vicidial_campaigns-disable_alter_custdata$NWE
Permita Ninguno-Tolva-Conduce Conexiones: $NWB#vicidial_campaigns-no_hopper_leads_logins$NWE
Identificación Manual De la Lista Del Dial:$NWB#vicidial_campaigns-manual_dial_list_id$NWE
Grupos De entrada Permitidos:
"; + echo " $NWB#vicidial_campaigns-closer_campaigns$NWE
\n"; + echo "$groups_list"; + echo "
Grupo De la Transferencia Del Defecto:$NWB#vicidial_campaigns-default_xfer_group$NWE
Grupos Permitidos De la Transferencia:
"; + echo " $NWB#vicidial_campaigns-xfer_groups$NWE
\n"; + echo "$XFERgroups_list"; + echo "
\n"; + + echo "
\n"; + echo "
LISTAS DENTRO DE ESTA CAMPAÑA:   $NWB#vicidial_campaign_lists$NWE
\n"; + echo "\n"; + echo "\n"; + + $active_lists = 0; + $inactive_lists = 0; + $stmt="SELECT list_id,active,list_name from vicidial_lists where campaign_id='$campaign_id'"; + $rslt=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rslt); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $o++; + if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_lists++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + echo "
ID DE LA LISTANOMBRE DE LA LISTAACTIVO
$rowx[0]$rowx[2]$rowx[1]

\n"; + echo "
\n"; + + $filterSQL = $filtersql_list[$lead_filter_id]; + $filterSQL = eregi_replace("^and|and$|^or|or$","",$filterSQL); + if (strlen($filterSQL)>4) + {$fSQL = "and $filterSQL";} + else + {$fSQL = '';} + + $camp_lists = eregi_replace(".$","",$camp_lists); + echo "Esta campaña tiene $active_lists listas activas y $inactive_lists listas inactivas

\n"; + + if ($display_dialable_count == 'Y') + { + ### call function to calculate and print dialable leads + dialable_leads($DB,$link,$local_call_time,$dial_statuses,$camp_lists,$fSQL); + echo " - PIEL

"; + } + else + { + echo "Popup Dialable Leads Count"; + echo " - DEMOSTRACIÓN

"; + } + + + + + + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id='$campaign_id' and status IN('READY')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $hopper_leads = "$rowx[0]"; + + echo "Esta campaña tiene $hopper_leads Leads en el Hopper

\n"; + echo "Chasque aquí para ver qué plomos están en la tolva ahora

\n"; + echo "Chasque aquí para ver todos los asimientos del servicio repetido en esta campaña

\n"; + echo "Click here to see a VDAD report for this campaign

\n"; + echo "
\n"; + } + + + + if ($SUB==22) + { + + ##### get status category listings for dynamic pulldown + $stmt="SELECT vsc_id,vsc_name from vicidial_status_categories order by vsc_id desc"; + $rslt=mysql_query($stmt, $link); + $cats_to_print = mysql_num_rows($rslt); + $cats_list=""; + + $o=0; + while ($cats_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $cats_list .= "\n"; + $catsname_list["$rowx[0]"] = substr($rowx[1],0,20); + $o++; + } + + + echo "
\n"; + echo "
ESTADOS DE ENCARGO DENTRO DE ESTA CAMPAÚA:   $NWB#vicidial_campaign_statuses$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_campaign_statuses where campaign_id='$campaign_id'"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $AScategory = $rowx[5]; + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
ESTADODESCRIPCIÓNSELECCIONABLERESPUESTA HUMANAELIMINAR
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "$rowx[0]
\n"; + echo "\n"; + echo "         \n"; + echo "   \n"; + echo "ELIMINAR\n"; + echo "
\n"; + + echo "
AGREGAR ESTADO PERSONALIZADO A LA CAMPAÑA
\n"; + echo "\n"; + echo "\n"; + echo "Estado:   \n"; + echo "Descripción:   \n"; + echo "Seleccionable:   \n"; + echo "Human Answer:   \n"; + echo "Categoría:\n"; + echo "  
\n"; + echo "
\n"; + + echo "

\n"; + } + + + if ($SUB==23) + { + echo "
PERSONALIZAR ACCEDOS DIRECTOS PARA ESTA CAMPAÑA:   $NWB#vicidial_campaign_hotkeys$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_campaign_hotkeys where campaign_id='$campaign_id' order by hotkey"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $o=0; + while ($statuses_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + + echo "
ACCESO DIRECTOESTADODESCRIPCIÓNELIMINAR
$rowx[1]$rowx[0]$rowx[2]ELIMINAR
\n"; + + echo "
AÑADIR ACCESO DIRECTO A LA CAMPAÑA
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Hotkey:   \n"; + echo "Estado:   \n"; + echo "
\n"; + echo "

\n"; + } + + + if ($SUB==25) + { + echo "

PLOMO QUE RECICLA DENTRO DE ESTA CAMPAÑA:   $NWB#vicidial_lead_recycle$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_lead_recycle where campaign_id='$campaign_id' order by status"; + $rslt=mysql_query($stmt, $link); + $recycle_to_print = mysql_num_rows($rslt); + $o=0; + while ($recycle_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
ESTADOLA TENTATIVA RETRASAMÃXIMO DE LA TENTATIVAACTIVO ELIMINAR
$rowx[2]
\n"; + echo "\n"; + echo "\n"; + echo "
ELIMINAR
\n"; + + echo "
AGREGUE EL NUEVO PLOMO DE LA CAMPAÑA RECICLAN
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Estado:   \n"; + echo "La Tentativa Retrasa: \n"; + echo "Máximo De la Tentativa: \n"; + echo "
\n"; + + echo "

\n"; + } + + + if ($SUB==26) + { + echo "

NÚMERO AUTO DEL ALT QUE MARCA PARA ESTA CAMPAÑA:   $NWB#vicidial_auto_alt_dial_statuses$NWE
\n"; + echo "\n"; + echo "\n"; + + $auto_alt_dial_statuses = preg_replace("/ -$/","",$auto_alt_dial_statuses); + $AADstatuses = explode(" ", $auto_alt_dial_statuses); + $AADs_to_print = (count($AADstatuses) -1); + + $o=0; + while ($AADs_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + $o++; + + echo "\n"; + echo "\n"; + } + + echo "
STATUSESELIMINAR
$AADstatuses[$o]ELIMINAR
\n"; + + echo "
AGREGUE EL ESTADO QUE MARCA DEL NUEVO DEL AUTOMÓVIL NÚMERO DEL ALT
\n"; + echo "\n"; + echo "\n"; + echo "Estado:   \n"; + echo "
\n"; + + echo "

\n"; + } + + + if ($SUB==27) + { + echo "

CÓDIGOS DE LA PAUSA DEL AGENTE PARA ESTA CAMPAÑA:   $NWB#vicidial_pause_codes$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_pause_codes where campaign_id='$campaign_id' order by pause_code"; + $rslt=mysql_query($stmt, $link); + $pause_codes_to_print = mysql_num_rows($rslt); + $o=0; + while ($pause_codes_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
CÓDIGOS DE LA PAUSAFACTURABLEMODIFICARELIMINAR
$rowx[0]\n"; + echo "\n"; + echo "\n"; + echo "  \n"; + echo "
ELIMINAR
\n"; + + echo "
AGREGUE EL NUEVO CÓDIGO DE LA PAUSA DEL AGENTE
\n"; + echo "\n"; + echo "\n"; + echo "Código De la Pausa: \n"; + echo "Nombre Del Código De la Pausa: \n"; + echo "   Facturable: \n"; + echo "
\n"; + + echo "

\n"; + } + + + if ($SUB < 1) + { + echo "

\n"; + echo "REGISTRE TODOS LOS AGENTES FUERA DE ESTA CAMPAÑA

\n"; + echo "EMERGENCY VDAC CLEAR FOR THIS CAMPAIGN

\n"; + + if ($LOGdelete_campaigns > 0) + { + echo "

SUPRIMA ESTA CAMPAÑA\n"; + } + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + +###################### +# ADD=34 modify campaign info in the system - Basic View +###################### + +if ( ($ADD==34) and ( (!eregi("$campaign_id",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) ) + {$ADD=30;} # send to not allowed screen if not in vicidial_user_groups allowed_campaigns list + +if ($ADD==34) +{ + if ($LOGmodify_campaigns==1) + { + if ($stage=='show_dialable') + { + $stmt="UPDATE vicidial_campaigns set display_dialable_count='Y' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + if ($stage=='hide_dialable') + { + $stmt="UPDATE vicidial_campaigns set display_dialable_count='N' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + + $stmt="SELECT * from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $dial_status_a = $row[3]; + $dial_status_b = $row[4]; + $dial_status_c = $row[5]; + $dial_status_d = $row[6]; + $dial_status_e = $row[7]; + $lead_order = $row[8]; + $hopper_level = $row[13]; + $auto_dial_level = $row[14]; + $next_agent_call = $row[15]; + $local_call_time = $row[16]; + $voicemail_ext = $row[17]; + $dial_timeout = $row[18]; + $dial_prefix = $row[19]; + $campaign_cid = $row[20]; + $campaign_vdad_exten = $row[21]; + $script_id = $row[25]; + $get_call_launch = $row[26]; + $lead_filter_id = $row[35]; + if ($lead_filter_id=='') {$lead_filter_id='NONE';} + $display_dialable_count = $row[39]; + $dial_method = $row[46]; + $adaptive_intensity = $row[51]; + $campaign_description = $row[57]; + $campaign_changedate = $row[58]; + $campaign_stats_refresh = $row[59]; + $campaign_logindate = $row[60]; + $dial_statuses = $row[61]; + $list_order_mix = $row[64]; + $default_xfer_group = $row[67]; + $campaign_allow_inbound = $row[65]; + $default_xfer_group = $row[67]; + + if (ereg("DISABLED",$list_order_mix)) + {$DEFlistDISABLE = ''; $DEFstatusDISABLED=0;} + else + {$DEFlistDISABLE = 'disabled'; $DEFstatusDISABLED=1;} + + $stmt="SELECT * from vicidial_statuses order by status"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $statuses_list=''; + + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $statuses_list .= "\n"; + $statname_list["$rowx[0]"] = "$rowx[1]"; + $LRstatuses_list .= "\n"; + if (eregi("Y",$rowx[2])) + {$HKstatuses_list .= "\n";} + $o++; + } + + $stmt="SELECT * from vicidial_campaign_statuses where campaign_id='$campaign_id' order by status"; + $rslt=mysql_query($stmt, $link); + $Cstatuses_to_print = mysql_num_rows($rslt); + + $o=0; + while ($Cstatuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $statuses_list .= "\n"; + $statname_list["$rowx[0]"] = "$rowx[1]"; + $LRstatuses_list .= "\n"; + if (eregi("Y",$rowx[2])) + {$HKstatuses_list .= "\n";} + $o++; + } + + $dial_statuses = preg_replace("/ -$/","",$dial_statuses); + $Dstatuses = explode(" ", $dial_statuses); + $Ds_to_print = (count($Dstatuses) -1); + + $stmt="SELECT count(*) from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and status='ACTIVE'"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0] < 1) + { + $mixes_list="\n"; + $mixname_list["DISABLED"] = "DISABLED"; + } + else + { + ##### get list_mix listings for dynamic pulldown + $stmt="SELECT vcl_id,vcl_name from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and status='ACTIVE' limit 1"; + $rslt=mysql_query($stmt, $link); + $mixes_to_print = mysql_num_rows($rslt); + $mixes_list="\n"; + + $o=0; + while ($mixes_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $mixes_list .= "\n"; + $mixname_list["ACTIVE"] = "$rowx[0] - $rowx[1]"; + $o++; + } + } + + if ($SUB<1) {$camp_detail_color=$subcamp_color;} + else {$camp_detail_color=$campaigns_color;} + if ($SUB==22) {$camp_statuses_color=$subcamp_color;} + else {$camp_statuses_color=$campaigns_color;} + if ($SUB==23) {$camp_hotkeys_color=$subcamp_color;} + else {$camp_hotkeys_color=$campaigns_color;} + if ($SUB==25) {$camp_recycle_color=$subcamp_color;} + else {$camp_recycle_color=$campaigns_color;} + if ($SUB==26) {$camp_autoalt_color=$subcamp_color;} + else {$camp_autoalt_color=$campaigns_color;} + if ($SUB==27) {$camp_pause_color=$subcamp_color;} + else {$camp_pause_color=$campaigns_color;} + if ($SUB==29) {$camp_listmix_color=$subcamp_color;} + else {$camp_listmix_color=$campaigns_color;} + echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "
$row[0]: Vista Básica Vista Detallada List Mix Pantalla En tiempo real  
\n"; + + if ($SUB < 1) + { + echo "
\n"; + echo ""; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + $o=0; + while ($Ds_to_print > $o) + { + $o++; + $Dstatus = $Dstatuses[$o]; + + echo "\n"; + } + else + { + echo "$Dstatus - $statname_list[$Dstatus]         \n"; + echo "QUITE\n"; + } + } + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + echo "
ID De la Campaña: $row[0]$NWB#vicidial_campaigns-campaign_id$NWE
Nombre de la Campaña: $NWB#vicidial_campaigns-campaign_name$NWE
Descripción De la Campaña: $row[57]$NWB#vicidial_campaigns-campaign_description$NWE
Campaña Change Date: $campaign_changedate   $NWB#vicidial_campaigns-campaign_changedate$NWE
Campaña Login Date: $campaign_logindate   $NWB#vicidial_campaigns-campaign_logindate$NWE
Activo: $NWB#vicidial_campaigns-active$NWE
Extensión del parking: $row[9] - $row[10]$NWB#vicidial_campaigns-park_ext$NWE
Formulario Web: $row[11]$NWB#vicidial_campaigns-web_form_address$NWE
Permitir Closers: $row[12] $NWB#vicidial_campaigns-allow_closers$NWE
Grupo De la Transferencia Del Defecto:$default_xfer_group $NWB#vicidial_campaigns-default_xfer_group$NWE
Permita de entrada y mezclado:$campaign_allow_inbound $NWB#vicidial_campaigns-campaign_allow_inbound$NWE
Estado Del Dial $o: \n"; + if ($DEFstatusDISABLED > 0) + { + echo "$Dstatus - $statname_list[$Dstatus]         \n"; + echo "REMOVE
Add A Dial Estado:   \n"; + echo "     $NWB#vicidial_campaigns-dial_status$NWE
Orden De la Lista: $NWB#vicidial_campaigns-lead_order$NWE
List Mix: $NWB#vicidial_campaigns-list_order_mix$NWE
Filtro del plomo: $NWB#vicidial_campaigns-lead_filter_id$NWE
Nivel Del Hopper: $NWB#vicidial_campaigns-hopper_level$NWE
Forzar el Reinicio del Hopper: $NWB#vicidial_campaigns-force_reset_hopper$NWE
Método Del Dial: $NWB#vicidial_campaigns-dial_method$NWE
Nivel del Auto-Dial: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE
Adapte El Modificante De la Intensidad: $NWB#vicidial_campaigns-adaptive_intensity$NWE
Script: $script_id
Consiga El Lanzamiento De la Llamada: $get_call_launch
\n"; + + echo "
\n"; + echo "
LISTAS DENTRO DE ESTA CAMPAÑA:   $NWB#vicidial_campaign_lists$NWE
\n"; + echo "\n"; + echo "\n"; + + $active_lists = 0; + $inactive_lists = 0; + $stmt="SELECT list_id,active,list_name from vicidial_lists where campaign_id='$campaign_id'"; + $rslt=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rslt); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_lists++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + + echo "
ID DE LA LISTANOMBRE DE LA LISTAACTIVO
$rowx[0]$rowx[2]$rowx[1]

\n"; + echo "
\n"; + + $filterSQL = $filtersql_list[$lead_filter_id]; + $filterSQL = eregi_replace("^and|and$|^or|or$","",$filterSQL); + if (strlen($filterSQL)>4) + {$fSQL = "and $filterSQL";} + else + {$fSQL = '';} + + $camp_lists = eregi_replace(".$","",$camp_lists); + echo "Esta campaña tiene $active_lists listas activas y $inactive_lists listas inactivas

\n"; + + + if ($display_dialable_count == 'Y') + { + ### call function to calculate and print dialable leads + dialable_leads($DB,$link,$local_call_time,$dial_statuses,$camp_lists,$fSQL); + echo " - PIEL

"; + } + else + { + echo "Popup Dialable Leads Count"; + echo " - DEMOSTRACIÓN

"; + } + + + + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id='$campaign_id' and status IN('READY')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $hopper_leads = "$rowx[0]"; + + echo "Esta campaña tiene $hopper_leads Leads en el Hopper

\n"; + echo "Chasque aquí para ver qué plomos están en la tolva ahora

\n"; + echo "Chasque aquí para ver todos los asimientos del servicio repetido en esta campaña

\n"; + echo "Click here to see a VDAD report for this campaign

\n"; + echo "
\n"; + + echo "
\n"; + + ### list of agent rank or skill-level for this campaign + echo "
\n"; + echo "
FILAS DEL AGENTE PARA ESTA CAMPAÑA:
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT user,campaign_rank,calls_today from vicidial_campaign_agents where campaign_id='$campaign_id'"; + $rsltx=mysql_query($stmt, $link); + $users_to_print = mysql_num_rows($rsltx); + + $o=0; + while ($users_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + + echo "
USER     RANK     CALLS TODAY
$rowx[0]$rowx[1]$rowx[2]

\n"; + + + echo "REGISTRE TODOS LOS AGENTES FUERA DE ESTA CAMPAÑA

\n"; + + + if ($LOGdelete_campaigns > 0) + { + echo "

SUPRIMA ESTA CAMPAÑA\n"; + } + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + +###################### +# ADD=31 or 34 and SUB=29 for list mixes +###################### +if ( ( ($ADD==34) or ($ADD==31) ) and ( (!eregi("$campaign_id",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) ) + {$ADD=30;} # send to not allowed screen if not in vicidial_user_groups allowed_campaigns list + +if ( ($ADD==34) or ($ADD==31) ) +{ + if ($LOGmodify_campaigns==1) + { + if ($SUB==29) + { + ##### get list_id listings for dynamic pulldown + $stmt="SELECT list_id,list_name from vicidial_lists where campaign_id='$campaign_id' order by list_id"; + $rslt=mysql_query($stmt, $link); + $mixlists_to_print = mysql_num_rows($rslt); + $mixlists_list=""; + + $o=0; + while ($mixlists_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $mixlists_list .= "\n"; + $mixlistsname_list["$rowx[0]"] = "$rowx[1]"; + $o++; + } + + + echo "

MEZCLAS DE LA LISTA PARA ESTA CAMPAÑA:  $NWB#vicidial_campaigns-list_order_mix$NWE
\n"; + + echo "

Experimental Feature in development!!! NON-FUNCTIONAL
\n"; + + + $stmt="SELECT * from vicidial_campaigns_list_mix where campaign_id='$campaign_id' order by status, vcl_id"; + $rslt=mysql_query($stmt, $link); + $listmixes = mysql_num_rows($rslt); + $o=0; + while ($listmixes > $o) + { + $rowx=mysql_fetch_row($rslt); + $vcl_id=$rowx[0]; + $o++; + + if ($o < 2) + {$tablecolor='bgcolor="#99FF99"'; $bgcolor='bgcolor="#CCFFCC"';} + else + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$tablecolor='bgcolor="#B9CBFD"'; $bgcolor='bgcolor="#9BB9FB"';} + else + {$tablecolor='bgcolor="#9BB9FB"'; $bgcolor='bgcolor="#B9CBFD"';} + } + echo "
\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + } + else + {echo "$rowx[5]\n";} + echo "\n"; + echo "\n"; + +# list_id|order|percent|statuses|:list_id|order|percent|statuses|:... +# 101|1|40| A B NA -|:102|2|25| NEW -|:103|3|30| DROP CALLBK -|:101|4|5| DROP -| +# INSERT INTO vicidial_campaigns_list_mix values('TESTMIX','TESTCAMP List Mix','TESTCAMP','101|1|40| A B NA -|:102|2|25| NEW -|:103|3|30| DROP CALLBK -|:101|4|5| DROP -|','IN_ORDER','ACTIVE'); +# INSERT INTO vicidial_campaigns_list_mix values('TESTMIX2','TESTCAMP List Mix2','TESTCAMP','101|1|20| A B -|:102|2|45| NEW -|:103|3|30| DROP CALLBK -|:101|4|5| DROP -|','IN_ORDER','ACTIVE'); +# INSERT INTO vicidial_campaigns_list_mix values('TESTMIX3','TESTCAMP List Mix3','TESTCAMP','101|1|30| A NA -|:102|2|35| NEW -|:103|3|30| DROP CALLBK -|:101|4|5| DROP -|','IN_ORDER','ACTIVE'); + + $MIXentries = $MT; + $MIXentries = explode(":", $rowx[3]); + $Ms_to_print = (count($MIXentries) - 0); + $q=0; + while ($Ms_to_print > $q) + { + $MIXdetails = explode('|', $MIXentries[$q]); + $MIXdetailsLIST = $MIXdetails[0]; + + $dial_statuses = preg_replace("/ -$/","",$dial_statuses); + $Dstatuses = explode(" ", $dial_statuses); + $Ds_to_print = (count($Dstatuses) - 0); + $Dsql = ''; + $r=0; + while ($Ds_to_print > $r) + { + $r++; + $Dsql .= "'$Dstatuses[$r]',"; + } + $Dsql = preg_replace("/,$/","",$Dsql); + + echo "\n"; + + echo "\n"; + + echo "\n"; + + + echo "\n"; + echo "\n"; + + + echo "\n"; + + + $q++; + + } + + + + + echo "\n"; + + echo "\n"; + + + echo "\n"; + + if ($q > 9) {$AE_disabled = 'DISABLED';} + else {$AE_disabled = '';} + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "$vcl_id:\n"; + echo "\n"; + echo "     DELETE LIST MIX
Estado: \n"; + if ($rowx[5]=='INACTIVE') + { + echo "$rowx[5]\n"; + echo "FIJE A ACTIVOMethod:\n"; + echo "
ID DE LA LISTAPRIORITY% MIXSTATUSES
\n"; + echo "\n"; + echo "List: $MIXdetailsLIST   QUITE\n"; + + + + echo " \n"; + echo "ADD   \n"; + echo "QUITE\n"; + echo "
\n"; + echo "Difference %: \n"; + echo "   \n"; + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "List:
\n"; + echo "
\n"; + } + + + echo "

NUEVA LISTA MIX
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Mix ID: Mix Name: Mix Method: "; + echo "
List: Dial Estado:  
\n"; + + echo "
\n"; + + } + } +} + + +###################### +# ADD=30 campaign not allowed +###################### + +if ($ADD==30) +{ +echo "
\n"; + echo ""; +echo "You do not have permission to view campaign $campaign_id\n"; +} + + +###################### +# ADD=32 display all campaign statuses +###################### +if ($ADD==32) +{ +echo "
\n"; + echo ""; + +echo "
LISTADOS DE ENCARGO DE LOS ESTADOS DE LA CAMPAÑA:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNNOMBRESTATUSESMODIFICAR
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT status from vicidial_campaign_statuses where campaign_id='$campaigns_id_list[$o]' order by status"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if ($p<1) + {echo "NONE";} + echo "MODIFY STATUSES
\n"; +} + + +###################### +# ADD=33 display all campaign hotkeys +###################### +if ($ADD==33) +{ +echo "
\n"; + echo ""; + +echo "
LISTADOS DE LA CAMPAÑA HOTKEYS:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNNOMBREHOTKEYSMODIFICAR
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT status from vicidial_campaign_hotkeys where campaign_id='$campaigns_id_list[$o]' order by status"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if ($p<1) + {echo "NONE";} + echo "MODIFY HOTKEYS
\n"; +} + + +###################### +# ADD=35 display all campaign lead recycle entries +###################### +if ($ADD==35) +{ +echo "
\n"; + echo ""; + +echo "
EL PLOMO DE LA CAMPAÑA RECICLA LISTADOS:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNNOMBREEL PLOMO RECICLAMODIFICAR
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT status from vicidial_lead_recycle where campaign_id='$campaigns_id_list[$o]' order by status"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if ($p<1) + {echo "NONE";} + echo "MODIFY EL PLOMO RECICLA
\n"; +} + + +###################### +# ADD=36 display all campaign auto-alt dial entries +###################### +if ($ADD==36) +{ +echo "
\n"; + echo ""; + +echo "
LISTADOS DEL DIAL DEL PLOMO AUTO-ALT DE LA CAMPAÑA:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNNOMBREAUTO-ALT DIALMODIFICAR
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$campaigns_id_list[$o]';"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if (strlen($row[0])<3) + {echo "NONE";} + echo "MODIFY AUTO-ALT DIAL
\n"; +} + + +###################### +# ADD=37 display all campaign agent pause codes +###################### +if ($ADD==37) +{ +echo "
\n"; + echo ""; + +echo "
LISTADOS DE CÓDIGO DE LA PAUSA DEL AGENTE DE LA CAMPAÑA:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNNOMBRECÓDIGOS DE LA PAUSAMODIFICAR
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT pause_code from vicidial_pause_codes where campaign_id='$campaigns_id_list[$o]' order by pause_code;"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if ($p<1) + {echo "NONE";} + echo "MODIFY CÓDIGOS DE LA PAUSA
\n"; +} + + +###################### +# ADD=39 display all campaign list mixes +###################### +if ($ADD==39) +{ +echo "
\n"; + echo ""; + +echo "
LISTADOS DE LA MEZCLA DE LA LISTA DE LA CAMPAÑA:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNNOMBRELIST MIXMODIFICAR
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT vcl_id from vicidial_campaigns_list_mix where campaign_id='$campaigns_id_list[$o]' order by status,vcl_id;"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if ($p<1) + {echo "NONE";} + echo "MODIFY LIST MIX
\n"; +} + + + + + +###################### +# ADD=311 modify list info in the system +###################### + +if ($ADD==311) +{ + if ($LOGmodify_lists==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $campaign_id = $row[2]; + $active = $row[3]; + $list_description = $row[4]; + $list_changedate = $row[5]; + $list_lastcalldate = $row[6]; + + # grab names of global statuses and statuses in the selected campaign + $stmt="SELECT * from vicidial_statuses order by status"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + + $o=0; + while ($statuses_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $statuses_list["$rowx[0]"] = "$rowx[1]"; + $o++; + } + + $stmt="SELECT * from vicidial_campaign_statuses where campaign_id='$campaign_id' order by status"; + $rslt=mysql_query($stmt, $link); + $Cstatuses_to_print = mysql_num_rows($rslt); + + $o=0; + while ($Cstatuses_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $statuses_list["$rowx[0]"] = "$rowx[1]"; + $o++; + } + # end grab status names + + + echo "
MODIFICAR UN REGISTRO DE LAS LISTAS: $row[0]
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
ID De la Lista: $row[0]$NWB#vicidial_lists-list_id$NWE
Nombre De la Lista: $NWB#vicidial_lists-list_name$NWE
Descripción De la Lista: $NWB#vicidial_lists-list_description$NWE
Campaña: $NWB#vicidial_lists-campaign_id$NWE
Activo: $NWB#vicidial_lists-active$NWE
Reiniciar el Lead-Called-Status para esta lista: $NWB#vicidial_lists-reset_list$NWE
Fecha Del Cambio De la Lista: $list_changedate   $NWB#vicidial_lists-list_changedate$NWE
List Last Call Date: $list_lastcalldate   $NWB#vicidial_lists-list_lastcalldate$NWE
\n"; + + echo "
\n"; + echo "
ESTADOS DENTRO DE ESTA LISTA:
\n"; + echo "\n"; + echo "\n"; + + $leads_in_list = 0; + $leads_in_list_N = 0; + $leads_in_list_Y = 0; + $stmt="SELECT status,called_since_last_reset,count(*) from vicidial_list where list_id='$list_id' group by status,called_since_last_reset order by status,called_since_last_reset"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + + $o=0; + $lead_list['count'] = 0; + $lead_list['Y_count'] = 0; + $lead_list['N_count'] = 0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + + $lead_list['count'] = ($lead_list['count'] + $rowx[2]); + if ($rowx[1] == 'N') + { + $since_reset = 'N'; + $since_resetX = 'Y'; + } + else + { + $since_reset = 'Y'; + $since_resetX = 'N'; + } + $lead_list[$since_reset][$rowx[0]] = ($lead_list[$since_reset][$rowx[0]] + $rowx[2]); + $lead_list[$since_reset.'_count'] = ($lead_list[$since_reset.'_count'] + $rowx[2]); + #If opposite side is not set, it may not in the future so give it a value of zero + if (!isset($lead_list[$since_resetX][$rowx[0]])) + { + $lead_list[$since_resetX][$rowx[0]]=0; + } + $o++; + } + + $o=0; + if ($lead_list['count'] > 0) + { + while (list($dispo,) = each($lead_list[$since_reset])) + { + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + if ($dispo == 'CBHOLD') + { + $CLB=""; + $CLE=""; + } + else + { + $CLB=''; + $CLE=''; + } + + echo "\n"; + $o++; + } + } + + echo "\n"; + echo "\n"; + + echo "
ESTADONOMBRE DEL ESTADOLLAMADONO LLAMADO
$CLB$dispo$CLE$statuses_list[$dispo]".$lead_list['Y'][$dispo]."".$lead_list['N'][$dispo]."
SUBTOTALES$lead_list[Y_count]$lead_list[N_count]
TOTAL$lead_list[count]

\n"; + unset($lead_list); + + + echo "
\n"; + echo "
ZONAS DE TIEMPO DENTRO DE ESTA LISTA:
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT gmt_offset_now,called_since_last_reset,count(*) from vicidial_list where list_id='$list_id' group by gmt_offset_now,called_since_last_reset order by gmt_offset_now,called_since_last_reset"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + + $o=0; + $plus='+'; + $lead_list['count'] = 0; + $lead_list['Y_count'] = 0; + $lead_list['N_count'] = 0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + + $lead_list['count'] = ($lead_list['count'] + $rowx[2]); + if ($rowx[1] == 'N') + { + $since_reset = 'N'; + $since_resetX = 'Y'; + } + else + { + $since_reset = 'Y'; + $since_resetX = 'N'; + } + $lead_list[$since_reset][$rowx[0]] = ($lead_list[$since_reset][$rowx[0]] + $rowx[2]); + $lead_list[$since_reset.'_count'] = ($lead_list[$since_reset.'_count'] + $rowx[2]); + #If opposite side is not set, it may not in the future so give it a value of zero + if (!isset($lead_list[$since_resetX][$rowx[0]])) + { + $lead_list[$since_resetX][$rowx[0]]=0; + } + $o++; + } + + if ($lead_list['count'] > 0) + { + while (list($tzone,) = each($lead_list[$since_reset])) + { + $LOCALzone=3600 * $tzone; + $LOCALdate=gmdate("D M Y H:i", time() + $LOCALzone); + + if ($tzone >= 0) {$DISPtzone = "$plus$tzone";} + else {$DISPtzone = "$tzone";} + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + } + + echo "\n"; + echo "\n"; + + echo "
DESPLAZAMIENTO GMT AHORA (tiempo local)LLAMADONO LLAMADO
".$DISPtzone."     ($LOCALdate)".$lead_list['Y'][$tzone]."".$lead_list['N'][$tzone]."
SUBTOTALES$lead_list[Y_count]$lead_list[N_count]
TOTAL$lead_list[count]

\n"; + unset($lead_list); + + + + $leads_in_list = 0; + $leads_in_list_N = 0; + $leads_in_list_Y = 0; + $stmt="SELECT status,called_count,count(*) from vicidial_list where list_id='$list_id' group by status,called_count order by status,called_count"; + $rslt=mysql_query($stmt, $link); + $status_called_to_print = mysql_num_rows($rslt); + + $o=0; + $sts=0; + $first_row=1; + $all_called_first=1000; + $all_called_last=0; + while ($status_called_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $leads_in_list = ($leads_in_list + $rowx[2]); + $count_statuses[$o] = "$rowx[0]"; + $count_called[$o] = "$rowx[1]"; + $count_count[$o] = "$rowx[2]"; + $all_called_count[$rowx[1]] = ($all_called_count[$rowx[1]] + $rowx[2]); + + if ( (strlen($status[$sts]) < 1) or ($status[$sts] != "$rowx[0]") ) + { + if ($first_row) {$first_row=0;} + else {$sts++;} + $status[$sts] = "$rowx[0]"; + $status_called_first[$sts] = "$rowx[1]"; + if ($status_called_first[$sts] < $all_called_first) {$all_called_first = $status_called_first[$sts];} + } + $leads_in_sts[$sts] = ($leads_in_sts[$sts] + $rowx[2]); + $status_called_last[$sts] = "$rowx[1]"; + if ($status_called_last[$sts] > $all_called_last) {$all_called_last = $status_called_last[$sts];} + + $o++; + } + + + + + echo "
\n"; + echo "
LLAMADAS REALIZADAS DENTRO DE ESTA LISTA:
\n"; + echo "\n"; + echo ""; + $first = $all_called_first; + while ($first <= $all_called_last) + { + if (eregi("1$|3$|5$|7$|9$", $first)) {$AB='bgcolor="#AFEEEE"';} + else{$AB='bgcolor="#E0FFFF"';} + echo ""; + $first++; + } + echo "\n"; + + $sts=0; + $statuses_called_to_print = count($status); + while ($statuses_called_to_print > $sts) + { + $Pstatus = $status[$sts]; + if (eregi("1$|3$|5$|7$|9$", $sts)) + {$bgcolor='bgcolor="#B9CBFD"'; $AB='bgcolor="#9BB9FB"';} + else + {$bgcolor='bgcolor="#9BB9FB"'; $AB='bgcolor="#B9CBFD"';} + # echo "$status[$sts]|$status_called_first[$sts]|$status_called_last[$sts]|$leads_in_sts[$sts]|\n"; + # echo "$status[$sts]|"; + echo ""; + + $first = $all_called_first; + while ($first <= $all_called_last) + { + if (eregi("1$|3$|5$|7$|9$", $sts)) + { + if (eregi("1$|3$|5$|7$|9$", $first)) {$AB='bgcolor="#9BB9FB"';} + else{$AB='bgcolor="#B9CBFD"';} + } + else + { + if (eregi("0$|2$|4$|6$|8$", $first)) {$AB='bgcolor="#9BB9FB"';} + else{$AB='bgcolor="#B9CBFD"';} + } + + $called_printed=0; + $o=0; + while ($status_called_to_print > $o) + { + if ( ($count_statuses[$o] == "$Pstatus") and ($count_called[$o] == "$first") ) + { + $called_printed++; + echo ""; + } + + + $o++; + } + if (!$called_printed) + {echo "";} + $first++; + } + echo "\n\n"; + + $sts++; + } + + echo ""; + $first = $all_called_first; + while ($first <= $all_called_last) + { + if (eregi("1$|3$|5$|7$|9$", $first)) {$AB='bgcolor="#AFEEEE"';} + else{$AB='bgcolor="#E0FFFF"';} + echo ""; + $first++; + } + echo "\n"; + + echo "
ESTADONOMBRE DEL ESTADO$firstSUBTOTAL
$Pstatus$statuses_list[$Pstatus] $count_count[$o]  $leads_in_sts[$sts]
TOTAL$all_called_count[$first]$leads_in_list

\n"; + + + + + + echo "
\n"; + + echo "

Click here to see all CallBack Holds in this list

\n"; + + if ($LOGdelete_lists > 0) + { + echo "

SUPRIMA ESTA LISTA\n"; + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + + +###################### +# ADD=3111 modify in-group info in the system +###################### + +if ($ADD==3111) +{ + if ($LOGmodify_ingroups==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_inbound_groups where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $group_name = $row[1]; + $group_color = $row[2]; + $active = $row[3]; + $web_form_address = $row[4]; + $voicemail_ext = $row[5]; + $next_agent_call = $row[6]; + $fronter_display = $row[7]; + $script_id = $row[8]; + $get_call_launch = $row[9]; + $xferconf_a_dtmf = $row[10]; + $xferconf_a_number = $row[11]; + $xferconf_b_dtmf = $row[12]; + $xferconf_b_number = $row[13]; + $drop_call_seconds = $row[14]; + $drop_message = $row[15]; + $drop_exten = $row[16]; + $call_time_id = $row[17]; + $after_hours_action = $row[18]; + $after_hours_message_filename = $row[19]; + $after_hours_exten = $row[20]; + $after_hours_voicemail = $row[21]; + $welcome_message_filename = $row[22]; + $moh_context = $row[23]; + $onhold_prompt_filename = $row[24]; + $prompt_interval = $row[25]; + $agent_alert_exten = $row[26]; + $agent_alert_delay = $row[27]; + $default_xfer_group = $row[28]; + + ##### get in-groups listings for dynamic pulldown + $stmt="SELECT group_id,group_name from vicidial_inbound_groups order by group_id"; + $rslt=mysql_query($stmt, $link); + $Xgroups_to_print = mysql_num_rows($rslt); + $Xgroups_menu=''; + $Xgroups_selected=0; + $o=0; + while ($Xgroups_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $Xgroups_menu .= "\n"; + $o++; + } + if ($Xgroups_selected < 1) + {$Xgroups_menu .= "\n";} + else + {$Xgroups_menu .= "\n";} + + + echo "
MODIFICAR UN REGISTRO DE LOS GRUPOS: $row[0]\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + echo "
ID De Grupo: $row[0]$NWB#vicidial_inbound_groups-group_id$NWE
Nombre De Grupo: $NWB#vicidial_inbound_groups-group_name$NWE
Color Del Grupo: $NWB#vicidial_inbound_groups-group_color$NWE
Activo: $NWB#vicidial_inbound_groups-active$NWE
Formulario Web: $NWB#vicidial_inbound_groups-web_form_address$NWE
Llamar al Siguiente Agente: $NWB#vicidial_inbound_groups-next_agent_call$NWE
Mostrar Fronter: $NWB#vicidial_inbound_groups-fronter_display$NWE
Script: $NWB#vicidial_inbound_groups-ingroup_script$NWE
Consiga El Lanzamiento De la Llamada: $NWB#vicidial_inbound_groups-get_call_launch$NWE
Transfiera -Conf DTMF 1: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
Transfiera -Conf El Número 1: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
Transfiera -Conf DTMF 2: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
Transfiera -Conf El Número 2: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
Segundos De la Llamada De la Gota: $NWB#vicidial_inbound_groups-drop_call_seconds$NWE
Buzón de Voz: $NWB#vicidial_inbound_groups-voicemail_ext$NWE
Utilice El Mensaje De la Gota: $NWB#vicidial_inbound_groups-drop_message$NWE
Gota Exten: $NWB#vicidial_inbound_groups-drop_exten$NWE
Tiempo De la Llamada:$NWB#vicidial_inbound_groups-call_time_id$NWE
Después De la Acción De las Horas:$NWB#vicidial_inbound_groups-after_hours_action$NWE
Después De Nombre de fichero Del Mensaje De las Horas:$NWB#vicidial_inbound_groups-after_hours_message_filename$NWE
Después De la Extensión De las Horas:$NWB#vicidial_inbound_groups-after_hours_exten$NWE
Después De las Horas Buzón de Voz:$NWB#vicidial_inbound_groups-after_hours_voicemail$NWE
Nombre de fichero Agradable Del Mensaje:$NWB#vicidial_inbound_groups-welcome_message_filename$NWE
Música En Contexto Del Asimiento:$NWB#vicidial_inbound_groups-moh_context$NWE
En Nombre de fichero Del Aviso Del Asimiento:$NWB#vicidial_inbound_groups-onhold_prompt_filename$NWE
En Intervalo Del Aviso Del Asimiento:$NWB#vicidial_inbound_groups-prompt_interval$NWE
Extensión Alerta Del Agente:$NWB#vicidial_inbound_groups-agent_alert_exten$NWE
La Alarma Del Agente Retrasa:$NWB#vicidial_inbound_groups-agent_alert_delay$NWE
Grupo De la Transferencia Del Defecto:$NWB#vicidial_inbound_groups-default_xfer_group$NWE
\n"; + + ### list of agent rank or skill-level for this inbound group + echo "
\n"; + echo "
AGENTE RANKS FOR THIS INBOUND GROUP:
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT user,group_rank,calls_today from vicidial_inbound_group_agents where group_id='$group_id'"; + $rsltx=mysql_query($stmt, $link); + $users_to_print = mysql_num_rows($rsltx); + + $o=0; + while ($users_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + + echo "
USER     RANK     CALLS TODAY
$rowx[0]$rowx[1]$rowx[2]

\n"; + + echo "

\n"; + + echo "Click here to see a report for this inbound group

\n"; + + echo "
\n"; + + if ($LOGdelete_ingroups > 0) + { + echo "

EMERGENCY VDAC CLEAR FOR THIS IN-GROUP

\n"; + echo "

SUPRIMA A ESTE EN-GRUPO\n"; + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + + +###################### +# ADD=31111 modify remote agents info in the system +###################### + +if ($ADD==31111) +{ + if ($LOGmodify_remoteagents==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + + echo "
MODIFICAR UNA ENTRADA DE LOS AGENTES REMOTOS: $row[0]\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Comienzo Del ID del usuario: (Solamente números, incremented)$NWB#vicidial_remote_agents-user_start$NWE
Número de líneas: (Solamente números)$NWB#vicidial_remote_agents-number_of_lines$NWE
IP Del Servidor: $NWB#vicidial_remote_agents-server_ip$NWE
Extensión Externa: (número del dial plan para alcanzar agentes)$NWB#vicidial_remote_agents-conf_exten$NWE
Estado: $NWB#vicidial_remote_agents-status$NWE
Campaña: $NWB#vicidial_remote_agents-campaign_id$NWE
Grupos De entrada: \n"; + echo "$groups_list"; + echo "$NWB#vicidial_remote_agents-closer_campaigns$NWE
\n"; + echo "NOTA: Puede tomar hasta 30 segundos para los cambios sometidos en esta pantalla para ir viva\n"; + + + if ($LOGdelete_remote_agents > 0) + { + echo "

SUPRIMA ESTE AGENTE ALEJADO\n"; + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + +###################### +# ADD=311111 modify user group info in the system +###################### + +if ($ADD==311111) +{ + if ($LOGmodify_usergroups==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_user_groups where user_group='$user_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $user_group = $row[0]; + $group_name = $row[1]; + echo ""; + + echo "
MODIFICAR UNA ENTRADA EN LOS GRUPOS DE USUARIOS\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Grupo: (sin espacios o signos de puntuación)$NWB#vicidial_user_groups-user_group$NWE
Descripción: (Descripción del grupo)$NWB#vicidial_user_groups-group_name$NWE
Campañas Permitidas: \n"; + echo "$campaigns_list"; + echo "$NWB#vicidial_user_groups-allowed_campaigns$NWE
\n"; + + + ### list of users in this user group + + $active_confs = 0; + $stmt="SELECT user,full_name,user_level from vicidial_users where user_group='$user_group'"; + $rsltx=mysql_query($stmt, $link); + $users_to_print = mysql_num_rows($rsltx); + + echo "
\n"; + echo "
USUARIOS DENTRO DE ESTE GRUPO DE USUARIO: $users_to_print
\n"; + echo "\n"; + echo "\n"; + + $o=0; + while ($users_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
USERFULL NAMELEVEL
$rowx[0]$rowx[1]$rowx[2]

\n"; + + + + echo "

Click here to see all CallBack Holds in this user group

\n"; + + if ($LOGdelete_user_groups > 0) + { + echo "

SUPRIMA A ESTE GRUPO DE USUARIO\n"; + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + +###################### +# ADD=3111111 modify script info in the system +###################### + +if ($ADD==3111111) +{ + if ($LOGmodify_scripts==1) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_scripts where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $script_name = $row[1]; + $script_comments = $row[2]; + $script_text = $row[3]; + $active = $row[4]; + echo ""; + + echo "
MODIFIQUE Una ESCRITURA\n"; + echo "\n"; + echo "\n"; + echo "
Identificación De la Escritura:: $script_id$NWB#vicidial_scripts-script_name$NWE
Nombre de la escritura: (título de la escritura)$NWB#vicidial_scripts-script_name$NWE
Comentarios de la escritura: $NWB#vicidial_scripts-script_comments$NWE
Activo: $NWB#vicidial_scripts-active$NWE
Texto de la escritura:

Escritura De la Inspección previo
"; + # BEGIN Insert Field + echo ""; + echo "
"; + # END Insert Field + echo " $NWB#vicidial_scripts-script_text$NWE
\n"; + + if ($LOGdelete_scripts > 0) + { + echo "

SUPRIMA ESTA ESCRITURA\n"; + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + +###################### +# ADD=31111111 modify filter info in the system +###################### + +if ($ADD==31111111) +{ + if ($LOGmodify_filters==1) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_lead_filters where lead_filter_id='$lead_filter_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $lead_filter_name = $row[1]; + $lead_filter_comments = $row[2]; + $lead_filter_sql = $row[3]; + echo ""; + + echo "
MODIFIQUE Un FILTRO\n"; + echo "\n"; + echo "\n"; + echo "
Identificación Del Filtro:$lead_filter_id$NWB#vicidial_lead_filters-lead_filter_id$NWE
Nombre Del Filtro: (descripción corta del filtro)$NWB#vicidial_lead_filters-lead_filter_name$NWE
Comentarios Del Filtro: $NWB#vicidial_lead_filters-lead_filter_comments$NWE
Filtro Sql: $NWB#vicidial_lead_filters-lead_filter_sql$NWE
\n"; + + ##### get campaigns listing for dynamic pulldown + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + $campaigns_list=''; + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $campaigns_list .= "\n"; + $o++; + } + + echo "

"; + echo "
PRUEBE EN CAMPAÑA:
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + if ($LOGdelete_filters > 0) + { + echo "

SUPRIMA ESTE FILTRO\n"; + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + +###################### +# ADD=321111111 modify call time definition info in the system +###################### + +if ($ADD==321111111) +{ +if ($LOGmodify_call_times==1) +{ + +if ( ($stage=="ADD") and (strlen($state_rule)>0) ) + { + $stmt="SELECT ct_state_call_times from vicidial_call_times where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $ct_state_call_times = $row[0]; + + if (eregi("\|$",$ct_state_call_times)) + {$ct_state_call_times = "$ct_state_call_times$state_rule\|";} + else + {$ct_state_call_times = "$ct_state_call_times\|$state_rule\|";} + $stmt="UPDATE vicidial_call_times set ct_state_call_times='$ct_state_call_times' where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + echo "Regla Del Estado Agregada: $state_rule
\n"; + } +if ( ($stage=="REMOVE") and (strlen($state_rule)>0) ) + { + $stmt="SELECT ct_state_call_times from vicidial_call_times where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $ct_state_call_times = $row[0]; + + $ct_state_call_times = eregi_replace("\|$state_rule\|",'|',$ct_state_call_times); + $stmt="UPDATE vicidial_call_times set ct_state_call_times='$ct_state_call_times' where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + echo "Regla Del Estado Quitada: $state_rule
\n"; + } + +$ADD=311111111; +} +else +{ +echo "Le no autorizan a visión esta página. Vaya por favor detrás."; +} + +} + + +###################### +# ADD=311111111 modify call time definition info in the system +###################### + +if ($ADD==311111111) +{ + +if ($LOGmodify_call_times==1) +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +$ct_srs=1; +$b=0; +$srs_SQL =''; +if (strlen($ct_state_call_times)>2) + { + $state_rules = explode('|',$ct_state_call_times); + $ct_srs = ((count($state_rules)) - 1); + } +echo "\n"; +echo "\n"; +while($ct_srs >= $b) + { + if (strlen($state_rules[$b])>0) + { + $stmt="SELECT state_call_time_state,state_call_time_name from vicidial_state_call_times where state_call_time_id='$state_rules[$b]';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + echo "\n"; + $srs_SQL .= "'$state_rules[$b]',"; + $srs_state_SQL .= "'$row[0]',"; + } + $b++; + } +if (strlen($srs_SQL)>2) + { + $srs_SQL = "$srs_SQL''"; + $srs_state_SQL = "$srs_state_SQL''"; + $srs_SQL = "where state_call_time_id NOT IN($srs_SQL) and state_call_time_state NOT IN($srs_state_SQL)"; + } +else + {$srs_SQL='';} +$stmt="SELECT state_call_time_id,state_call_time_name from vicidial_state_call_times $srs_SQL order by state_call_time_id;"; +$rslt=mysql_query($stmt, $link); +$sct_to_print = mysql_num_rows($rslt); +$sct_list=''; + +$o=0; +while ($sct_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $sct_list .= "\n"; + $o++; +} +echo "\n"; +echo "\n"; + +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_call_times where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $call_time_name = $row[1]; + $call_time_comments = $row[2]; + $ct_default_start = $row[3]; + $ct_default_stop = $row[4]; + $ct_sunday_start = $row[5]; + $ct_sunday_stop = $row[6]; + $ct_monday_start = $row[7]; + $ct_monday_stop = $row[8]; + $ct_tuesday_start = $row[9]; + $ct_tuesday_stop = $row[10]; + $ct_wednesday_start = $row[11]; + $ct_wednesday_stop = $row[12]; + $ct_thursday_start = $row[13]; + $ct_thursday_stop = $row[14]; + $ct_friday_start = $row[15]; + $ct_friday_stop = $row[16]; + $ct_saturday_start = $row[17]; + $ct_saturday_stop = $row[18]; + $ct_state_call_times = $row[19]; + +echo ""; + +echo "
MODIFIQUE Un RATO De la LLAMADA\n"; +echo "\n"; +echo "\n"; +echo "
Identificación Del Tiempo De la Llamada: $call_time_id$NWB#vicidial_call_times-call_time_id$NWE
Nombre Del Tiempo De la Llamada: (descripción corta del tiempo de la llamada)$NWB#vicidial_call_times-call_time_name$NWE
Comentarios Del Tiempo De la Llamada: $NWB#vicidial_call_times-call_time_comments$NWE
Comienzo Del Defecto: Parada Del Defecto: $NWB#vicidial_call_times-ct_default_start$NWE
Comienzo De Domingo: Parada De Domingo: $NWB#vicidial_call_times-ct_sunday_start$NWE
Comienzo De Lunes: Parada De Lunes: $NWB#vicidial_call_times-ct_sunday_start$NWE
Comienzo De Martes: Parada De Martes: $NWB#vicidial_call_times-ct_sunday_start$NWE
Comienzo De Miércoles: Parada De Miércoles: $NWB#vicidial_call_times-ct_sunday_start$NWE
Thursday Start: Parada De Jueves: $NWB#vicidial_call_times-ct_sunday_start$NWE
Comienzo De Viernes: Parada De Viernes: $NWB#vicidial_call_times-ct_sunday_start$NWE
Comienzo De Sábado: Parada De Sábado: $NWB#vicidial_call_times-ct_sunday_start$NWE
Definiciones activas del tiempo de la llamada del estado para estoexpediente:  
$state_rules[$b] - REMOVE $row[0] - $row[1]
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "Add state call time rule:


\n"; +echo "CAMPAÑAS USANDO ESTE TIEMPO DE LA LLAMADA:
\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns where local_call_time='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + $o=0; + while ($camps_to_print > $o) { + $row=mysql_fetch_row($rslt); + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]
\n"; +echo "INBOUND GROUPS USING THIS CALL TIME:
\n"; +echo "\n"; + + $stmt="SELECT group_id,group_name from vicidial_inbound_groups where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + $o=0; + while ($camps_to_print > $o) { + $row=mysql_fetch_row($rslt); + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]
\n"; +echo "

\n"; + +if ($LOGdelete_call_times > 0) + { + echo "

SUPRIMA ESTA DEFINICIÓN DEL TIEMPO DE LA LLAMADA\n"; + } +} +else +{ +echo "Le no autorizan a visión esta página. Vaya por favor detrás."; +} + +} + + +###################### +# ADD=3111111111 modify state call time definition info in the system +###################### + +if ($ADD==3111111111) +{ + +if ($LOGmodify_call_times==1) +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_state_call_times where state_call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $state_call_time_state =$row[1]; + $call_time_name = $row[2]; + $call_time_comments = $row[3]; + $ct_default_start = $row[4]; + $ct_default_stop = $row[5]; + $ct_sunday_start = $row[6]; + $ct_sunday_stop = $row[7]; + $ct_monday_start = $row[8]; + $ct_monday_stop = $row[9]; + $ct_tuesday_start = $row[10]; + $ct_tuesday_stop = $row[11]; + $ct_wednesday_start = $row[12]; + $ct_wednesday_stop = $row[13]; + $ct_thursday_start = $row[14]; + $ct_thursday_stop = $row[15]; + $ct_friday_start = $row[16]; + $ct_friday_stop = $row[17]; + $ct_saturday_start = $row[18]; + $ct_saturday_stop = $row[19]; + +echo ""; + +echo "
_ MODIFICAR Uno ESTADO LLAMAR TIEMPO
\n"; +echo "\n"; +echo "\n"; +echo "
Identificación Del Tiempo De la Llamada: $call_time_id$NWB#vicidial_call_times-call_time_id$NWE
State Call Time State: $NWB#vicidial_call_times-state_call_time_state$NWE
_ Estado Llamar Tiempo Nombre: (descripción corta del tiempo de la llamada)$NWB#vicidial_call_times-call_time_name$NWE
Comentarios Del Tiempo De la Llamada Del Estado: $NWB#vicidial_call_times-call_time_comments$NWE
Comienzo Del Defecto: Parada Del Defecto: $NWB#vicidial_call_times-ct_default_start$NWE
Comienzo De Domingo: Parada De Domingo: $NWB#vicidial_call_times-ct_sunday_start$NWE
Comienzo De Lunes: Parada De Lunes: $NWB#vicidial_call_times-ct_sunday_start$NWE
Comienzo De Martes: Parada De Martes: $NWB#vicidial_call_times-ct_sunday_start$NWE
Comienzo De Miércoles: Parada De Miércoles: $NWB#vicidial_call_times-ct_sunday_start$NWE
Thursday Start: Parada De Jueves: $NWB#vicidial_call_times-ct_sunday_start$NWE
Comienzo De Viernes: Parada De Viernes: $NWB#vicidial_call_times-ct_sunday_start$NWE
Comienzo De Sábado: Parada De Sábado: $NWB#vicidial_call_times-ct_sunday_start$NWE


\n"; +echo "TIEMPOS DE LA LLAMADA USANDO ESTE TIEMPO DE LA LLAMADA DEL ESTADO:
\n"; +echo "\n"; + + $stmt="SELECT call_time_id,call_time_name from vicidial_call_times where ct_state_call_times LIKE \"%|$call_time_id|%\";"; + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + $o=0; + while ($camps_to_print > $o) { + $row=mysql_fetch_row($rslt); + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]
\n"; +echo "

\n"; + +if ($LOGdelete_call_times > 0) + { + echo "

SUPRIMA ESTA DEFINICIÓN DEL TIEMPO DE LA LLAMADA DEL ESTADO\n"; + } + +} +else +{ +echo "Le no autorizan a visión esta página. Vaya por favor detrás."; +} + +} + + +###################### +# ADD=31111111111 modify phone record in the system +###################### + +if ($ADD==31111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + echo "
MODIFICANDO EL TELÉFONO: $row[1]\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Extensión del teléfono: $NWB#phones-extension$NWE
Número De Dial plan: (Solamente dígitos)$NWB#phones-dialplan_number$NWE
Buzón de voz: (Solamente dígitos)$NWB#phones-voicemail_id$NWE
CallerID De salida: (Solamente dígitos)$NWB#phones-outbound_cid$NWE
Dirección IP del teléfono: (optional)$NWB#phones-phone_ip$NWE
Dirección IP del ordenador: (optional)$NWB#phones-computer_ip$NWE
IP Del Servidor: $NWB#phones-server_ip$NWE
Login: $NWB#phones-login$NWE
Contraseña: $NWB#phones-pass$NWE
Estado: $NWB#phones-status$NWE
Cuenta Activa: $NWB#phones-active$NWE
Tipo Del Teléfono: $NWB#phones-phone_type$NWE
Nombre Completo: $NWB#phones-fullname$NWE
Compañía: $NWB#phones-company$NWE
Foto: $NWB#phones-picture$NWE
Mensajes Nuevos: $row[14]$NWB#phones-messages$NWE
Mensajes Viejos: $row[15]$NWB#phones-old_messages$NWE
Protocolo Del Cliente: $NWB#phones-protocol$NWE
GMT Local: (No ajustar para el DST)$NWB#phones-local_gmt$NWE
Login del Manager: $NWB#phones-ASTmgrUSERNAME$NWE
Contraseña del Manager: $NWB#phones-ASTmgrSECRET$NWE
Usuario por defecto de VICIDIAL: $NWB#phones-login_user$NWE
Contraseña por defecto de VICIDIAL: $NWB#phones-login_pass$NWE
Campaña por defecto de VICIDIAL: $NWB#phones-login_campaign$NWE
Extensión del parking: $NWB#phones-park_on_extension$NWE
Extensión de la conferencia: $NWB#phones-conf_on_extension$NWE
Exten. Del parking de VICIDIAL: $NWB#phones-VICIDIAL_park_on_extension$NWE
Archivo para música del parking de VICIDIAL: $NWB#phones-VICIDIAL_park_on_filename$NWE
Prefijo al monitorizar: $NWB#phones-monitor_prefix$NWE
Exten de Grabación: $NWB#phones-recording_exten$NWE
Exten de VmailMain: $NWB#phones-voicemail_exten$NWE
Exten de VmaiDumpl: $NWB#phones-voicemail_dump_exten$NWE
Contexto De Exten: $NWB#phones-ext_context$NWE
Canal de envío del DTMF: $NWB#phones-dtmf_send_extension$NWE
Grupo de las llamadas de salida: $NWB#phones-call_out_number_group$NWE
Localización del Navegador: $NWB#phones-client_browser$NWE
Directorio de instalación: $NWB#phones-install_directory$NWE
URL del CallerID: $NWB#phones-local_web_callerID_URL$NWE
URL por defecto de VICIDIAL: $NWB#phones-VICIDIAL_web_URL$NWE
Call Logging: $NWB#phones-AGI_call_logging_enabled$NWE
Cambio de Usuario: $NWB#phones-user_switching_enabled$NWE
Conferencias: $NWB#phones-conferencing_enabled$NWE
Colgar del Admin: $NWB#phones-admin_hangup_enabled$NWE
Captura del Admin: $NWB#phones-admin_hijack_enabled$NWE
Monitorización del Admin: $NWB#phones-admin_monitor_enabled$NWE
Parking de Llamada: $NWB#phones-call_parking_enabled$NWE
Uptader Check: $NWB#phones-updater_check_enabled$NWE
AF Logging: $NWB#phones-AFLogging_enabled$NWE
Colas permitidas: $NWB#phones-QUEUE_ACTION_enabled$NWE
Ventana emergente del CallerID: $NWB#phones-CallerID_popup_enabled$NWE
Botón Vmail: $NWB#phones-voicemail_button_enabled$NWE
Refresco rápido: $NWB#phones-enable_fast_refresh$NWE
Refresco rápido de la tarifa: (in ms)$NWB#phones-fast_refresh_rate$NWE
Persistant MySQL: $NWB#phones-enable_persistant_mysql$NWE
Auto Marcar el Siguiente Número: $NWB#phones-auto_dial_next_number$NWE
Parar de Grabar después de cada llamada: $NWB#phones-VDstop_rec_after_each_call$NWE
Permita Los Mensajes de SIPSAK: $NWB#phones-enable_sipsak_messages$NWE
Servidor de DBX: (Primario DB Server)$NWB#phones-DBX_server$NWE
Base de datos de DBX: (Primario Server Database)$NWB#phones-DBX_database$NWE
Usuario de DBX: (Primario DB Login)$NWB#phones-DBX_user$NWE
Contraseña de DBX: (Primario DB Secret)$NWB#phones-DBX_pass$NWE
Puerto de DBX: (Primario DB Port)$NWB#phones-DBX_port$NWE
Servidor de DBY: (Secundario DB Server)$NWB#phones-DBY_server$NWE
Base de datos de DBY: (Secundario Server Database)$NWB#phones-DBY_database$NWE
Usuario de DBY: (Secundario DB Login)$NWB#phones-DBY_user$NWE
Contraseña de DBY: (Secundario DB Secret)$NWB#phones-DBY_pass$NWE
Puerto de DBY: (Secundario DB Port)$NWB#phones-DBY_port$NWE
\n"; + + echo "

Pinchar aquí­ para ver las estadísticas del teléfono\n"; + + if ($LOGast_delete_phones > 0) + { + echo "

SUPRIMA ESTE TELÉFONO\n"; + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + +###################### +# ADD=311111111111 modify server record in the system +###################### + +if ($ADD==311111111111) +{ + if ($LOGmodify_servers==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from servers where server_id='$server_id' or server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $server_id = $row[0]; + $server_ip = $row[2]; + + echo "
MODIFICAR UN REGISTRO DEL SERVIDOR: $row[0]\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
ID Del Servidor: $NWB#servers-server_id$NWE
Descripción Del Servidor: $NWB#servers-server_description$NWE
Dirección IP del Servidor: $NWB#servers-server_ip$NWE
Activo: $NWB#servers-active$NWE
Versión De Asterisk: $NWB#servers-asterisk_version$NWE
Máx. Trunks en VICIDIAL: $NWB#servers-max_vicidial_trunks$NWE
El Marcar Del Balance de VICIDIAL: $NWB#servers-vicidial_balance_active$NWE
Balance Offlimits de VICIDIAL: $NWB#servers-balance_trunks_offlimits$NWE
Host Del Telnet: $NWB#servers-telnet_host$NWE
Puerto Del Telnet: $NWB#servers-telnet_port$NWE
Usuario Del Manager: $NWB#servers-ASTmgrUSERNAME$NWE
Contraseña del Manager: $NWB#servers-ASTmgrSECRET$NWE
Usuario del Updater del Manager: $NWB#servers-ASTmgrUSERNAMEupdate$NWE
Usuario Listen del Manager: $NWB#servers-ASTmgrUSERNAMElisten$NWE
Usuario Send del Manager: $NWB#servers-ASTmgrUSERNAMEsend$NWE
GMT Local: (No ajustar para el DST)$NWB#servers-local_gmt$NWE
Extensión de Vmail Dump : $NWB#servers-voicemail_dump_exten$NWE
Extensión del AD de VICIDIAL: $NWB#servers-answer_transfer_agent$NWE
Contexto por Defecto: $NWB#servers-ext_context$NWE
Funcionamiento Del Sistema: $NWB#servers-sys_perf_log$NWE
Registros Del Servidor: $NWB#servers-vd_server_logs$NWE
Salida de AGI: $NWB#servers-agi_output$NWE
\n"; + + + ### vicidial server trunk records for this server + echo "

TRONCOS DE VICIDIAL PARA ESTE SERVIDOR:   $NWB#vicidial_server_trunks$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_server_trunks where server_ip='$server_ip' order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $recycle_to_print = mysql_num_rows($rslt); + $o=0; + while ($recycle_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
CAMPAÑA TRONCOS RESTRICCIÓN DELETE
$rowx[1]
\n"; + echo "\n"; + echo "\n"; + echo "
ELIMINAR
\n"; + + echo "
AGREGUE EL NUEVO EXPEDIENTE DEL TRONCO DEL SERVIDOR VICIDIAL
\n"; + echo "\n"; + echo "\n"; + echo "TRUNKS:
\n"; + echo "CAMPAÑA:
\n"; + echo "RESTRICTION:
\n"; + echo "
\n"; + + echo "

\n"; + + + ### list of phones on this server + echo "
\n"; + echo "
TELÉFONOS DENTRO DE ESTE SERVIDOR:
\n"; + echo "\n"; + echo "\n"; + + $active_phones = 0; + $inactive_phones = 0; + $stmt="SELECT extension,active,fullname from phones where server_ip='$row[2]'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + if (ereg("Y", $rowx[1])) {$active_phones++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_phones++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + + echo "
EXTENSIÓNNOMBREACTIVO
$rowx[0]$rowx[2]$rowx[1]

\n"; + + + ### list of conferences on this server + echo "
\n"; + echo "
CONFERENCES WITHIN THIS SERVER:
\n"; + echo "\n"; + echo "\n"; + + $active_confs = 0; + $stmt="SELECT conf_exten,extension from conferences where server_ip='$row[2]'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + $active_confs++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + + echo "
CONFERENCEEXTENSIÓN
$rowx[0]$rowx[2]

\n"; + + + ### list of vicidial conferences on this server + echo "
\n"; + echo "
VICIDIAL CONFERENCES WITHIN THIS SERVER:
\n"; + echo "\n"; + echo "\n"; + + $active_vdconfs = 0; + $stmt="SELECT conf_exten,extension from vicidial_conferences where server_ip='$row[2]'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + $active_vdconfs++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + + echo "
VD CONFERENCEEXTENSIÓN
$rowx[0]$rowx[2]

\n"; + + + echo "
\n"; + + $camp_lists = eregi_replace(".$","",$camp_lists); + echo "Este servidor tiene $active_phones Teléfonos activos y $inactive_phones Teléfonos inactivos

\n"; + echo "Este servidor tiene $active_confs active conferences

\n"; + echo "Este servidor tiene $active_vdconfs active vicidial conferences

\n"; + echo "
\n"; + if ($LOGast_delete_phones > 0) + { + echo "

DELETE THIS SERVER\n"; + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + +###################### +# ADD=3111111111111 modify conference record in the system +###################### + +if ($ADD==3111111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $conf_exten = $row[0]; + $server_ip = $row[1]; + + echo "
MODIFICAR UN REGISTRO DE LA CONFERENCIA: $row[0]
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Conferencia: $NWB#conferences-conf_exten$NWE
IP Del Servidor: $NWB#conferences-server_ip$NWE
Extensión Actual:
\n"; + + echo "
\n"; + if ($LOGast_delete_phones > 0) + { + echo "

DELETE THIS CONFERENCE\n"; + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + +###################### +# ADD=31111111111111 modify vicidial conference record in the system +###################### + +if ($ADD==31111111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $conf_exten = $row[0]; + $server_ip = $row[1]; + + echo "
MODIFY A VICIDIAL CONFERENCE RECORD: $row[0]\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Conferencia: $NWB#conferences-conf_exten$NWE
IP Del Servidor: $NWB#conferences-server_ip$NWE
Extensión Actual:
\n"; + + echo "
\n"; + if ($LOGast_delete_phones > 0) + { + echo "

DELETE THIS VICIDIAL CONFERENCE\n"; + } + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + + +###################### +# ADD=311111111111111 modify vicidial system settings +###################### + +if ($ADD==311111111111111) +{ + if ($LOGmodify_servers==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT version,install_date,use_non_latin,webroot_writable,enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_url,queuemetrics_log_id,queuemetrics_eq_prepend,vicidial_agent_disable,allow_sipsak_messages,admin_home_url,enable_agc_xfer_log from system_settings;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $version = $row[0]; + $install_date = $row[1]; + $use_non_latin = $row[2]; + $webroot_writable = $row[3]; + $enable_queuemetrics_logging = $row[4]; + $queuemetrics_server_ip = $row[5]; + $queuemetrics_dbname = $row[6]; + $queuemetrics_login = $row[7]; + $queuemetrics_pass = $row[8]; + $queuemetrics_url = $row[9]; + $queuemetrics_log_id = $row[10]; + $queuemetrics_eq_prepend = $row[11]; + $vicidial_agent_disable = $row[12]; + $allow_sipsak_messages = $row[13]; + $admin_home_url = $row[14]; + $enable_agc_xfer_log = $row[15]; + + echo "
MODIFIQUE LOS AJUSTES DEL SISTEMA DE VICIDIAL\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + echo "\n"; + echo "
Versión: $version
Install Date: $install_date
Uso No-Latino: $NWB#settings-use_non_latin$NWE
Webroot Escribible: $NWB#settings-webroot_writable$NWE
Permita La Registración De QueueMetrics: $NWB#settings-enable_queuemetrics_logging$NWE
IP Del Servidor De QueueMetrics: $NWB#settings-queuemetrics_server_ip$NWE
Nombre del DB De QueueMetrics: $NWB#settings-queuemetrics_dbname$NWE
Conexión del DB De QueueMetrics: $NWB#settings-queuemetrics_login$NWE
Contraseña del DB De QueueMetrics: $NWB#settings-queuemetrics_pass$NWE
QueueMetrics URL: $NWB#settings-queuemetrics_url$NWE
Identificación Del Registro De QueueMetrics: $NWB#settings-queuemetrics_log_id$NWE
QueueMetrics EnterQueue Prepend: $NWB#settings-queuemetrics_eq_prepend$NWE
El Agente de VICIDIAL Inhabilita La Exhibición:$NWB#settings-vicidial_agent_disable$NWE
Permita Los Mensajes de SIPSAK: $NWB#settings-allow_sipsak_messages$NWE
URL Casero Del Admin: $NWB#settings-admin_home_url$NWE
Permita El Logfile De la Transferencia Del Agente: $NWB#settings-enable_agc_xfer_log$NWE
\n"; + echo "\n"; + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + + + + + +###################### +# ADD=321111111111111 modify vicidial system statuses +###################### + +if ($ADD==321111111111111) +{ + if ($LOGmodify_servers==1) + { + echo "
\n"; + echo ""; + + echo "
\n"; + echo "ESTADOS DE VICIDIAL DENTRO DE ESTE SISTEMA:  $NWB#vicidial_statuses$NWE
\n"; + echo "\n"; + echo "\n"; + + ##### get status category listings for dynamic pulldown + $stmt="SELECT vsc_id,vsc_name from vicidial_status_categories order by vsc_id desc"; + $rslt=mysql_query($stmt, $link); + $cats_to_print = mysql_num_rows($rslt); + $cats_list=""; + + $o=0; + while ($cats_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $cats_list .= "\n"; + $catsname_list["$rowx[0]"] = substr($rowx[1],0,20); + $o++; + } + + + $stmt="SELECT * from vicidial_statuses order by status;"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $AScategory = $rowx[4]; + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
ESTADODESCRIPCIÓNSELECT-
ABLE
HUMAN
ANSWER
CATEGORYMODIFY/DELETE
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "$rowx[0]
\n"; + echo "\n"; + echo "         \n"; + echo "   \n"; + + if (preg_match("/^B$|^NA$|^DNC$|^NA$|^DROP$|^INCALL$|^QUEUE$|^NEW$/i",$rowx[0])) + { + echo "ELIMINAR\n"; + } + else + { + echo "ELIMINAR\n"; + } + echo "
\n"; + + echo "
AGREGUE EL NUEVO ESTADO DE SISTEMA
\n"; + echo "\n"; + echo "Estado:   \n"; + echo "Descripción:
\n"; + echo "Seleccionable:   \n"; + echo "Human Answer:   \n"; + echo "Categoría:\n"; + echo "  
\n"; + echo "
\n"; + + echo "

\n"; + + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + + + + +###################### +# ADD=331111111111111 modify vicidial status categories +###################### + +if ($ADD==331111111111111) +{ + if ($LOGmodify_servers==1) + { + echo "
\n"; + echo ""; + + echo "
\n"; + echo "VICIDIAL STATUS CATEGORIES:   $NWB#vicidial_status_categories$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_status_categories order by vsc_id;"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + + $Avsc_id[$o] = $rowx[0]; + $Avsc_name[$o] = $rowx[1]; + $Avsc_description[$o] = $rowx[2]; + $Atovdad_display[$o] = $rowx[3]; + + $o++; + } + $p=0; + while ($o > $p) + { + if (eregi("1$|3$|5$|7$|9$", $p)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $CATstatuses=''; + $stmt="SELECT status from vicidial_statuses where category='$Avsc_id[$p]' order by status;"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $q=0; + while ($statuses_to_print > $q) + { + $rowx=mysql_fetch_row($rslt); + $CATstatuses.=" $rowx[0]"; + $q++; + } + $stmt="SELECT status from vicidial_campaign_statuses where category='$Avsc_id[$p]' order by status;"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $q=0; + while ($statuses_to_print > $q) + { + $rowx=mysql_fetch_row($rslt); + $CATstatuses.=" $rowx[0]"; + $q++; + } + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + $p++; + } + + echo "
CATEGORYNOMBRETOVDADSTATUSES IN THIS CATEGORY
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "$Avsc_id[$p]
\n"; + echo "$CATstatuses"; + echo "
Descripción:
        \n"; + echo "   ELIMINAR
 
\n"; + + echo "
AGREGUE LA NUEVA CATEGORÃA DEL ESTADO
\n"; + echo "\n"; + echo "Category ID:   \n"; + echo "Name:   \n"; + echo "TimeOnVDAD Display:  
\n"; + echo "Descripción:   \n"; + echo "
\n"; + + echo "

\n"; + + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + + + + + +###################### +# ADD=550 search form +###################### + +if ($ADD==550) +{ +echo "
\n"; +echo ""; + +echo "
BUSCAR UN USUARIO
\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "
NÚmero De Usuario:
Nombre Completo:
Nivel Del Usuario:
Grupo Del Usuario:
\n"; + +} + +###################### +# ADD=660 user search results +###################### + +if ($ADD==660) +{ +echo "
\n"; + echo ""; + + $SQL = ''; + if ($user) {$SQL .= " user LIKE \"%$user%\" and";} + if ($full_name) {$SQL .= " full_name LIKE \"%$full_name%\" and";} + if ($user_level > 0) {$SQL .= " user_level LIKE \"%$user_level%\" and";} + if ($user_group) {$SQL .= " user_group = '$user_group' and";} + $SQL = eregi_replace(" and$", "", $SQL); + if (strlen($SQL)>5) {$SQL = "where $SQL";} + + $stmt="SELECT * from vicidial_users $SQL order by full_name desc;"; +# echo "\n|$stmt|\n"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
RESULTADOS DE LA BÚSQUEDA:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[1]$row[3]$row[4]$row[5]MODIFICAR | ESTADÃSTICAS | ESTADO | TIME
\n"; + +} + + +###################################################################################################### +###################################################################################################### +####### 8 series, Callback lists +###################################################################################################### +###################################################################################################### + +###################### +# ADD=8 find all callbacks on hold by a User +###################### +if ($ADD==8) +{ + if ($LOGmodify_users==1) + { + if ($SUB==89) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where user='$user' and status='LIVE' and callback_time < '$past_month_date';"; + $rslt=mysql_query($stmt, $link); + echo "
User($user) callback listings LIVE for more than one month have been made INACTIVE\n"; + } + if ($SUB==899) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where user='$user' and status='LIVE' and callback_time < '$past_week_date';"; + $rslt=mysql_query($stmt, $link); + echo "
User($user) callback listings LIVE for more than one week have been made INACTIVE\n"; + } + } +$CBinactiveLINK = "
Remove LIVE Callbacks older than one month for this user
Remove LIVE Callbacks older than one week for this user
"; + +echo ""; + + $CBquerySQLwhere = "and user='$user'"; + +echo "
USER CALLBACK HOLD LISTINGS: $user\n"; +$oldADD = "ADD=8&user=$user"; +$ADD='82'; +} + +###################### +# ADD=81 find all callbacks on hold within a Campaign +###################### +if ($ADD==81) +{ + if ($LOGmodify_campaigns==1) + { + if ($SUB==89) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where campaign_id='$campaign_id' and status='LIVE' and callback_time < '$past_month_date';"; + $rslt=mysql_query($stmt, $link); + echo "
campaign($campaign_id) callback listings LIVE for more than one month have been made INACTIVE\n"; + } + if ($SUB==899) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where campaign_id='$campaign_id' and status='LIVE' and callback_time < '$past_week_date';"; + $rslt=mysql_query($stmt, $link); + echo "
campaign($campaign_id) callback listings LIVE for more than one week have been made INACTIVE\n"; + } + } +$CBinactiveLINK = "
Remove LIVE Callbacks older than one month for this campaign
Remove LIVE Callbacks older than one week for this campaign
"; + +echo ""; + + $CBquerySQLwhere = "and campaign_id='$campaign_id'"; + +echo "
CAMPAIGN CALLBACK HOLD LISTINGS: $campaign_id\n"; +$oldADD = "ADD=81&campaign_id=$campaign_id"; +$ADD='82'; +} + +###################### +# ADD=811 find all callbacks on hold within a List +###################### +if ($ADD==811) +{ + if ($LOGmodify_lists==1) + { + if ($SUB==89) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where list_id='$list_id' and status='LIVE' and callback_time < '$past_month_date';"; + $rslt=mysql_query($stmt, $link); + echo "
list($list_id) callback listings LIVE for more than one month have been made INACTIVE\n"; + } + if ($SUB==899) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where list_id='$list_id' and status='LIVE' and callback_time < '$past_week_date';"; + $rslt=mysql_query($stmt, $link); + echo "
list($list_id) callback listings LIVE for more than one week have been made INACTIVE\n"; + } + } +$CBinactiveLINK = "
Remove LIVE Callbacks older than one month for this list
Remove LIVE Callbacks older than one week for this list
"; + +echo ""; + + $CBquerySQLwhere = "and list_id='$list_id'"; + +echo "
LIST CALLBACK HOLD LISTINGS: $list_id\n"; +$oldADD = "ADD=811&list_id=$list_id"; +$ADD='82'; +} + +###################### +# ADD=8111 find all callbacks on hold within a user group +###################### +if ($ADD==8111) +{ + if ($LOGmodify_usergroups==1) + { + if ($SUB==89) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where user_group='$user_group' and status='LIVE' and callback_time < '$past_month_date';"; + $rslt=mysql_query($stmt, $link); + echo "
user group($user_group) callback listings LIVE for more than one month have been made INACTIVE\n"; + } + if ($SUB==899) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where user_group='$user_group' and status='LIVE' and callback_time < '$past_week_date';"; + $rslt=mysql_query($stmt, $link); + echo "
user group($user_group) callback listings LIVE for more than one week have been made INACTIVE\n"; + } + } + $CBinactiveLINK = "
Remove LIVE Callbacks older than one month for this user group
Remove LIVE Callbacks older than one week for this user group
"; + + echo ""; + + $CBquerySQLwhere = "and user_group='$user_group'"; + +echo "
USER GROUP CALLBACK HOLD LISTINGS: $list_id\n"; +$oldADD = "ADD=8111&user_group=$user_group"; +$ADD='82'; +} + +###################### +# ADD=82 display all callbacks on hold +###################### +if ($ADD==82) +{ + +$USERlink='stage=USERIDDOWN'; +$GROUPlink='stage=GROUPDOWN'; +$ENDATElink='stage=ENDATEDOWN'; +$SQLorder='order by '; +if (eregi("USERIDDOWN",$stage)) {$SQLorder='order by user desc,'; $USERlink='stage=USERIDUP';} +if (eregi("GROUPDOWN",$stage)) {$SQLorder='order by user_group desc,'; $NAMElink='stage=NAMEUP';} +if (eregi("ENDATEDOWN",$stage)) {$SQLorder='order by entry_time desc,'; $LEVELlink='stage=LEVELUP';} + + $stmt="SELECT * from vicidial_callbacks where status IN('ACTIVE','LIVE') $CBquerySQLwhere $SQLorder recipient,status desc,callback_time"; + $rslt=mysql_query($stmt, $link); + $cb_to_print = mysql_num_rows($rslt); + +echo "
\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $o=0; + while ($cb_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
LEADLIST CAMPAÑAENTRY FECHACALLBACK FECHAUSERRECIPIENTESTADOGROUP
$row[1]$row[2]$row[3]$row[5]$row[6]$row[8]$row[9]$row[4]$row[11]
\n"; + +echo "$CBinactiveLINK"; +} + + + +###################################################################################################### +###################################################################################################### +####### 0 series, displays and searches +###################################################################################################### +###################################################################################################### + +###################### +# ADD=0 display all active users +###################### +if ($ADD==0) +{ +echo "
\n"; +echo ""; + +$USERlink='stage=USERIDDOWN'; +$NAMElink='stage=NAMEDOWN'; +$LEVELlink='stage=LEVELDOWN'; +$GROUPlink='stage=GROUPDOWN'; +$SQLorder='order by full_name'; +if (eregi("USERIDUP",$stage)) {$SQLorder='order by user asc'; $USERlink='stage=USERIDDOWN';} +if (eregi("USERIDDOWN",$stage)) {$SQLorder='order by user desc'; $USERlink='stage=USERIDUP';} +if (eregi("NAMEUP",$stage)) {$SQLorder='order by full_name asc'; $NAMElink='stage=NAMEDOWN';} +if (eregi("NAMEDOWN",$stage)) {$SQLorder='order by full_name desc'; $NAMElink='stage=NAMEUP';} +if (eregi("LEVELUP",$stage)) {$SQLorder='order by user_level asc'; $LEVELlink='stage=LEVELDOWN';} +if (eregi("LEVELDOWN",$stage)) {$SQLorder='order by user_level desc'; $LEVELlink='stage=LEVELUP';} +if (eregi("GROUPUP",$stage)) {$SQLorder='order by user_group asc'; $GROUPlink='stage=GROUPDOWN';} +if (eregi("GROUPDOWN",$stage)) {$SQLorder='order by user_group desc'; $GROUPlink='stage=GROUPUP';} + $stmt="SELECT * from vicidial_users $SQLorder"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
USUARIOS:\n"; +echo "
\n"; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo "\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
USER IDFULL NAMELEVELGROUPLINKS
$row[1]$row[3]$row[4]$row[5]MODIFICAR | ESTADÃSTICAS | ESTADO | TIME
\n"; +} + +###################### +# ADD=10 display all campaigns +###################### +if ($ADD==10) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
CAMPAÑAS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2] $row[3]$row[4]$row[5] $row[6]$row[7]  MODIFICAR
\n"; +} + + +###################### +# ADD=100 display all lists +###################### +if ($ADD==100) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_lists order by list_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
LISTAS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2]$row[4]$row[5] $row[3]$row[7]  MODIFICAR
\n"; +} + + + +###################### +# ADD=1000 display all inbound groups +###################### +if ($ADD==1000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_inbound_groups order by group_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
GRUPOS DE ENTRADA :\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[3] $row[5]  MODIFICAR
\n"; +} + + +###################### +# ADD=10000 display all remote agents +###################### +if ($ADD==10000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_remote_agents order by server_ip,campaign_id,user_start"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
AGENTES REMOTOS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[1] $row[2] $row[3] $row[4] $row[5] $row[6]MODIFICAR
\n"; +} + + +###################### +# ADD=100000 display all user groups +###################### +if ($ADD==100000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_user_groups order by user_group"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
GRUPOS DE USUARIO :\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]MODIFICAR
\n"; +} + + +###################### +# ADD=1000000 display all scripts +###################### +if ($ADD==1000000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_scripts order by script_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
ESCRITURAS DE LA VISIÓN:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]MODIFICAR
\n"; +} + + +###################### +# ADD=10000000 display all filters +###################### +if ($ADD==10000000) +{ +echo "
\n"; + + echo ""; + + $stmt="SELECT * from vicidial_lead_filters order by lead_filter_id"; + $rslt=mysql_query($stmt, $link); + $filters_to_print = mysql_num_rows($rslt); + +echo "
LISTADOS DEL FILTRO DEL PLOMO:\n"; +echo "
\n"; + + $o=0; + while ($filters_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]MODIFICAR
\n"; +} + + +###################### +# ADD=100000000 display all call times +###################### +if ($ADD==100000000) +{ +echo "
\n"; + + echo ""; + + $stmt="SELECT * from vicidial_call_times order by call_time_id"; + $rslt=mysql_query($stmt, $link); + $filters_to_print = mysql_num_rows($rslt); + +echo "
LISTADOS DEL TIEMPO DE LA LLAMADA:\n"; +echo "
\n"; + + $o=0; + while ($filters_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[3] $row[4] MODIFICAR
\n"; +} + +###################### +# ADD=1000000000 display all state call times +###################### +if ($ADD==1000000000) +{ +echo "
\n"; + + echo ""; + + $stmt="SELECT * from vicidial_state_call_times order by state_call_time_id"; + $rslt=mysql_query($stmt, $link); + $filters_to_print = mysql_num_rows($rslt); + +echo "
LISTADOS DEL TIEMPO DE LA LLAMADA DEL ESTADO:\n"; +echo "
\n"; + + $o=0; + while ($filters_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2] $row[3] $row[4] MODIFICAR
\n"; +} + +###################### +# ADD=10000000000 display all phones +###################### +if ($ADD==10000000000) +{ +echo "
\n"; +echo ""; + +$EXTENlink='stage=EXTENDOWN'; +$PROTOlink='stage=PROTODOWN'; +$SERVERlink='stage=SERVERDOWN'; +$STATUSlink='stage=STATUSDOWN'; +$SQLorder='order by extension,server_ip'; +if (eregi("EXTENUP",$stage)) {$SQLorder='order by extension asc'; $EXTENlink='stage=EXTENDOWN';} +if (eregi("EXTENDOWN",$stage)) {$SQLorder='order by extension desc'; $EXTENlink='stage=EXTENUP';} +if (eregi("PROTOUP",$stage)) {$SQLorder='order by protocol asc'; $PROTOlink='stage=PROTODOWN';} +if (eregi("PROTODOWN",$stage)) {$SQLorder='order by protocol desc'; $PROTOlink='stage=PROTOUP';} +if (eregi("SERVERUP",$stage)) {$SQLorder='order by server_ip asc'; $SERVERlink='stage=SERVERDOWN';} +if (eregi("SERVERDOWN",$stage)) {$SQLorder='order by server_ip desc'; $SERVERlink='stage=SERVERUP';} +if (eregi("STATUSUP",$stage)) {$SQLorder='order by status asc'; $STATUSlink='stage=STATUSDOWN';} +if (eregi("STATUSDOWN",$stage)) {$SQLorder='order by status desc'; $STATUSlink='stage=STATUSUP';} + $stmt="SELECT * from phones $SQLorder"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
LISTADOS DE TELÉFONOS:\n"; +echo "
\n"; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo "\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
EXTENPROTOSERVERDIAL PLANESTADONOMBREVMAILLINKS
$row[0]$row[16]$row[5]$row[1]$row[2]$row[8]$row[11]$row[14]$row[15]MODIFICAR | ESTADÃSTICAS
\n"; +} + +###################### +# ADD=100000000000 display all servers +###################### +if ($ADD==100000000000) +{ +echo "\\n\";"; + } + $e++; + } + } + else + { + if ($file[$LINESct] =~ /INTERNATIONALIZATION-LINKS-PLACEHOLDER-AGC/) + { + $file[$LINESct] =~ s/INTERNATIONALIZATION-LINKS-PLACEHOLDER-AGC/ILPA/g; + $e=0; + $gif = '.gif'; + foreach(@lang_link_list) + { + if (length($lang_link_list[$e]) > 2) + { + @lang_list_detail = split(/-/, $lang_link_list[$e]); + $lang_list_abb = $lang_list_detail[0]; + $lang_list_name = $lang_list_detail[1]; + if ($lang_list_abb =~ /$lang_abb/) {$list_bgcolor = ' BGCOLOR=\"#CCFFCC\"';} + else {$list_bgcolor = '';} + $file[$LINESct] .= "echo \"\\n\";"; + } + $e++; + } + } + else + { + if ( ($lang_abb =~ /^en/) && ($Tct > 2) ) + { + $file[$LINESct] =~ s/\.\/images\//\.\.\/agc\/images\//g; + $file[$LINESct] =~ s/\"help.gif/\"..\/astguiclient\/help.gif/g; + $phrase_found_counter++; + } + if ($lang_abb !~ /^en/) + { + $file[$LINESct] =~ s/$ORIGtext/$TRANStext/g; + $phrase_found_counter++; + } + } + } + } + + if ($phrase_found_counter < 1) + { + open(ERRout, ">>$LANG_FILE_ERROR") + || die "Can't open $LANG_FILE_ERROR: $!\n"; + print ERRout "|$ORIGtext|\n"; + close(ERRout); + } + + $LINESct++; + + if ($a =~ /00000$/i) {print "$a $file[$LINESct]\n|$ORIGtext|$TRANStext|";} + $a++; + } + $Tct++; + } + } + ### open the translation result file for writing ### + open(out, ">$webroot/$file_path$US$lang_abb/$file_name") + || die "Can't open $webroot/$file_path$US$lang_abb/$file_name: $!\n"; + # print out "Header(\"Content-type: text/html; charset=utf-8\");\n"; + $LINESct=0; + foreach(@file) + { + print out "$file[$LINESct]"; + $LINESct++; + } + close(out); + print "\n"; + print "File Written: $webroot/$file_path$US$lang_abb/$file_name\n"; + } + else + { + print "File does not exist: $webroot/$file_path/$file_name\n"; + } + $Fct++; + } + } + } + $i++; + } + +} \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/bin/start_asterisk_boot.pl b/agc_2-X/branches/agc_2.0.4/bin/start_asterisk_boot.pl new file mode 100644 index 00000000..9b44adc7 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/start_asterisk_boot.pl @@ -0,0 +1,76 @@ +#!/usr/bin/perl + +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# CHANGES +# +# 60814-1658 - added option to start without logging through servers table setting +# + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +`PERL5LIB="$PATHhome/libs"; export PERL5LIB`; + +use DBI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### Grab Server values from the database + $stmtA = "SELECT vd_server_logs FROM servers where server_ip = '$VARserver_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBvd_server_logs = "$aryA[0]"; + if ($DBvd_server_logs =~ /Y/) {$SYSLOG = '1';} + else {$SYSLOG = '0';} + $rec_count++; + } + $sthA->finish(); + +if ($SYSLOG) + { + print "\nStarting Asterisk... screen logging on\n"; + `/usr/bin/screen -L -d -m -S asterisk /usr/sbin/asterisk -vvvvvvvvvvvvvvvvvvvvvgc`; + } +else + { + print "\nStarting Asterisk... screen logging off\n"; + `/usr/bin/screen -d -m -S asterisk /usr/sbin/asterisk -vvvvgc`; + } + +print "Asterisk started\n"; + +sleep(10); + diff --git a/agc_2-X/branches/agc_2.0.4/docs/ACQS.txt b/agc_2-X/branches/agc_2.0.4/docs/ACQS.txt new file mode 100644 index 00000000..050bcdf0 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/ACQS.txt @@ -0,0 +1,93 @@ ++------------------------------------------------------------------------------+ +| Asterisk GUI client - astguiclient | +| Description of the Asterisk Central Queue System | +| created by Matt Florell | +| project started 2003-10-06 http://sourceforge.net/projects/astguiclient/ | ++------------------------------------------------------------------------------+ + +This suite of programs is designed to work with the Asterisk Open-source PBX +(http://www.asterisk.org) as a cross-platform GUI client and the supporting +server side applications necessary for the features of the GUI application to +work with Asterisk. + +Scripts that are involved with the ACQS backend are: + + - /etc/astguiclient.conf - file where you define your variables for the server apps + + Must be present and configured through the install.pl script + + - AST_manager_listen.pl - listener for the Asterisk Central Queue System (ACQS) + + Must be present in the /home/cron/ directory + + Requires Net::Telnet, Net::MySQL and Time::HiRes perl Modules + + - AST_manager_send.pl - send-spawn for the ACQS + + Must be present in the /home/cron/ directory + + Requires Net::Telnet, Net::MySQL and Time::HiRes perl Modules + + - AST_send_action_child.pl - blind-send for the ACQS + + Must be present in the /home/cron/ directory + + Requires Net::Telnet, Net::MySQL perl Modules + + - ADMIN_keepalive_ALL.pl - checks to see that ACQS is running + + Must put entry for this script in the cron as "* * * * * /path/script" + + - ADMIN_restart_roll_logs.pl - rolls logs over datestamp upon restart + + put this script in your machine's startup routine + + +DESCRIPTION: +This set of programs was created to reduce the risk of deadlocks that occur when +the manager interface connection from a remote machine to the Asterisk server +becomes severed or backlogged in some way resulting in a buffer-overflow of the +manager interface on the Asterisk box and a deadlock of the Asterisk PBX. The +probability of this happening is rare on a system where you may have 100 or less +action commans being executed a day, but when the action commands rise to the +level of 3000+ per server across 30 machines you will have at least 1 deadlock +per day if not one per hour. That's why we needed to find a way to still issue +manager Actions but not have to maintain a connection with the Asterisk Manager +interface. Here is a rundown of how the ACQS works: + +There is a simple database table where the action information with unique IDs is +stored and where each action's information is updated by the listener. The table +I use is called vicidial_manager and is detailed in the CONF_MySQL.txt file in +this distribution. + +1. First, the GUI client application inserts a record into the table as a NEW +action and includes a unique callerID for REDIRECT and ORIGINATE commands(the +callerID field is how the listener will update the record in the DB) +INSERT INTO vicidial_manager values('','','2004-01-30 +17:22:53','NEW','N','10.10.11.12','','Originate','DL40130172253cc160','Channel: +local/8600011@demo','Context: default','Exten: 917274515135','Priority: +1','Callerid: DL40130172253cc160','','','','',''); + +2. Second, there is a constantly running application on the Asterisk box that +selects queues from the database to be processed, and launches a new child +script to send the action to the database, then marks the action as SENT. + +3. Third, each child process logs into the manager interface and sends the +action immediately, then stays open for 10 seconds to not cause any problems, +clears it's buffer and then logs out and exits. + +4. Fourth, the listener app is constantly connected on the Asterisk box to the +manager interface and parses all output from the manager interface. Every time a +"Newstate Ringing" event is seen an update statement is sent to the DB based +upon the callerid of the call filling in the channel that the call is on and the +uniqueID of the call and sets the record to "UPDATED" + +5. Fifth, the listener also listens for "Hangup" events and sends an update to +the DB with a "DEAD" status keyed by the call's uniqueID. + +The above process is executed extremely fast and actually has suprisingly little +effect on the load of the Asterisk box. Because each action is sent through it's +own child process there is no risk of the system deadlocking because of a single +bad action thread. + + + +NOTES: +This started out as a desperate quick fix that evolved into a system that has +been up and running reliably on two separate Asterisk servers. Since we +implemented ACQS we haven't had a single deadlock on either of these servers. +If anyone has suggestions/praises/criticisms I would love to hear them. + +To use, follow the instructions in the docs/SCRATCH_INSTALL.txt document. + diff --git a/agc_2-X/branches/agc_2.0.4/docs/ALTERNATE_NUMBER_DIALING.txt b/agc_2-X/branches/agc_2.0.4/docs/ALTERNATE_NUMBER_DIALING.txt new file mode 100644 index 00000000..3640bf8f --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/ALTERNATE_NUMBER_DIALING.txt @@ -0,0 +1,54 @@ +ALTERNATE NUMBER DIALING Summary and Overview 2007-01-15 + +*** ALTERNATE NUMBER DIALING IN AUTODIAL MODE HAS BEEN ADDED IN THE 2.0.3 RELEASE *** + +This document will outline the methods used to automatically dial the alt_phone and/or address3 fields containing phone numbers for a lead while in Auto-dial modes(RATIO or ADAPT*). This feature does not function for leads dialed with the MANUAL dial_method. + +If you will be using automatic alt number dialing, it is strongly recommended that you filter your alternate numbers to be the proper length, and remove any non-numeric characters from those fields. + + + +First, a new field in vicidial_campaigns was needed to tell the dialer that it should look for contact numbers in the alt_phone and/or address3 fields if a call to a regular number results in a no-contact(NA/B/DC/N)[defined in the auto_alt_dial_statuses field in the vicidial_campaigns table]. + +ALTER TABLE vicidial_campaigns ADD auto_alt_dial ENUM('NONE','ALT_ONLY','ADDR3_ONLY','ALT_AND_ADDR3') default 'NONE'; + + +Second, a new field in vicidial_auto_calls and vicidial_hopper tables was needed to tell the dialer that when this call is terminated as no-contact(NA/B/DC/N), it needs to try dialing the next alternate number(s). This field is populated accordingly: +- If the main phone_number is currently being dialed, the alt_dial field will be MAIN +- If the alt_phone is being dialed, ALT +- If the address3 field is being dialed, ADDR3 +- If the campaign has AUTO_ALT_DIAL set to NONE or the alt numbers are invalid, then this field will also be set to NONE +This tells the scripts handling the call termination what needs to be done with the call status and what number(if any) it should place in the hopper next. + +ALTER TABLE vicidial_auto_calls ADD alt_dial ENUM('NONE','MAIN','ALT','ADDR3') default 'NONE'; +ALTER TABLE vicidial_hopper ADD alt_dial ENUM('NONE','ALT','ADDR3') default 'NONE'; + + +Third, because of how the insertion into the hopper of the next attempt has to work when the call is answered by an agent we need to modify the status field in the vicidial_hopper to allow for a HOLD status that can be made READY once the lead is dispositioned: + +ALTER TABLE vicidial_hopper MODIFY status ENUM('READY','QUEUE','INCALL','DONE','HOLD') default 'READY'; + + +Fourth, so that the no-answer statuses can be definable, we need to add a new field to vicidial_campaigns to hold the statuses and allow the admin.php interface to be able to modify them. + +ALTER TABLE vicidial_campaigns ADD auto_alt_dial_statuses VARCHAR(255) default ' B N NA DC -'; + + + + +STEPS OF AN AUTO-ALT-DIAL CALL: + +1. When a call to a lead's main phone_number is placed by AST_VDauto_dial.pl or AST_VDauto_dial_FILL.pl and the auto_alt_dial field is NOT set to NONE, a flag will be set in the vicidial_auto_calls field as MAIN to note that this lead needs to be called again under it's alternate number(s) if it is terminated under a no-connect status(NA/B/DC/N). + +2. What happens when one of these calls is terminated: + 2a. If the call has an alt_dial value of MAIN or ALT and went to an agent and was defined as no-contact(NA/B/DC/N) then the vdc_db_query.php script will immediately place that lead back into the vicidial_hopper to be dialed under it's alternate phone number or addr3. + + 2b. If call has an alt_dial value of MAIN or ALT and was terminated as no-contact by no-answer(NA/B/DC) then the VDhangup process will immediately place that lead back into the vicidial_hopper to be dialed under it's alternate phone number. + +3. When the alt_phone is dialed of the same lead, the alt_dial flag in vicidial_auto_calls will be set to ALT, then repeat step 2 + +4. When the address3 field is dialed from the same lead, the alt_dial flag is set to ADDR3 + +5. When a call is terminated in auto-dial mode and the number dialed was not the main phone_number, the status will not be changed in the vicidial_list table unless the status is a connect status and it came from an agent. + + diff --git a/agc_2-X/branches/agc_2.0.4/docs/APP_CONFERENCE.txt b/agc_2-X/branches/agc_2.0.4/docs/APP_CONFERENCE.txt new file mode 100644 index 00000000..92011ec2 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/APP_CONFERENCE.txt @@ -0,0 +1,86 @@ +VICIDIAL and app_conference +(1.2 tree) EXPERIMENTAL!!! + +app_conference offers the plusses of being able to do conferencing +without any zaptel hardware or timers as well as doing native codec +streaming, meaning no manditory downsampling to slin like meetme. +These two features alone mean a rather significant performance boost +to companies who only use VOIP for agents and trunks as well as not +requiring the cost of zaptel hardware or the nightmare of getting +ztdummy to work on some systems. + +As of right now, I have a test system fully up and running using +app_conference with VICIDIAL on Asterisk 1.2.8. I have made several +modifications to the app_conference code to make it more of a drop-in +replacement for meetme so that it does not require any changes to the +VICIDIAL codebase. I have added entry and exit sounds(slightly +different from meetme's) as well as "only one in this conference" +message in addition to changing the default member type to speaker(S). +So far I have tested with IAX and SIP channels only and everything +works just like on meetme but I have not done any capacity testing or +tested it in production yet. + +If you want to use app_conference instead of meetme for VICIDIAL then follow these instructions: + +cd /usr/src/asterisk +wget http://www.eflo.net/files/VD_app_conference_0.6.zip +unzip VD_app_conference_0.6.zip +cd app_conference +make clean +make +make install + + +In your extensions.conf file you would replace these lines: +exten => 8600051,1,Meetme,8600051 +exten => 8600052,1,Meetme,8600052 +...continue through 8600100... +exten => 78600051,1,Meetme,8600051|q +exten => 78600052,1,Meetme,8600052|q +...continue through 78600100... +exten => 68600051,1,Meetme,8600051|mq +exten => 68600052,1,Meetme,8600052|mq +...continue through 68600100... + + +with these lines: +exten => 8600051,1,Conference(8600051) +exten => 8600052,1,Conference(8600052) +...continue through 8600100... +exten => 78600051,1,Conference(8600051|q) +exten => 78600052,1,Conference(8600052|q) +...continue through 78600100... +exten => 68600051,1,Conference(8600051|Lq) +exten => 68600052,1,Conference(8600052|Lq) +...continue through 68600100... + +NOTES: +Here are the possible feature flags for this version of app_conference: + o M: Moderator (presently same as speaker) [default] + o S: Speaker + o L: Listener + o T: "Telephone caller" (just for stats?). + o V: Do VAD on this caller + o D: Use Denoise filter on this caller. + o d: Send manager events when DTMF is received. + o q: Do not play enter or exit sounds. + o i: use inband dtmf broadcast. + o t: use rfc dtmf signal broadcast. + +COMPILE NOTES: + +Some Makefile alterations may be necessary for your system: + +From Alek Barkley: +I am running FC4 with latest updates ( 2.6.16 kernel ) +My CPU is AMD K6 and GCC 4.0.2. + +I edited Makefile in app_conference distribution. +To enter CPU architecture in my case -march=k6 +======================================================== +PROC = k6 +# this is fun for x86 +#CFLAGS += -march=pentium3 -msse -mfpmath=sse,387 +CFLAGS += -march=k6 +=========================================================== + diff --git a/agc_2-X/branches/agc_2.0.4/docs/BALANCE_FILL_PROCESS.txt b/agc_2-X/branches/agc_2.0.4/docs/BALANCE_FILL_PROCESS.txt new file mode 100644 index 00000000..54253ed0 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/BALANCE_FILL_PROCESS.txt @@ -0,0 +1,42 @@ +VICIDIAL Dialing-out Balance FILL proces flow 2006-11-20 + +** FULL VICIDIAL BALANCE DIALING FUNCTIONALITY WAS ADDED IN THE 2.0.2 RELEASE ** + +This will outline the process I have thought through in my head for a way to allow for dialing-out only servers and for dialing-out-trunk-lines on one VICIDIAL server to be utilized when another dialing server does not have enough lines to meet it's dial level for the number of agents that are on the server. + +This process is made much more complicated by the addition of the new campaign-reserved-trunks feature for servers, meaning that you need to check on the trunk reservations and their settngs before being able to place any calls. + +This script(AST_VDauto_dial_FILL.pl) will be a constantly running script that needs to only be run on one server in a VICIDIAL cluster of servers. + +This script will be started up and monitored by the ADMIN_keepalive_ALL.pl script. + +This script is not needed on a single-server or single-VICIDIAL/Asterisk server setup. + + + +MySQL database changes needed for this new feature:(already in upgrade_2.0.2.sql file) +ALTER TABLE vicidial_auto_calls MODIFY call_type ENUM('IN','OUT','OUTBALANCE') default 'OUT'; +- Added OUTBALANCE to keep track of the calls that were originated by the Balance FILL process. + + + +Changes to existing AST_VDauto_dial.pl script: +Only one notable change for CLOSER campaigns to look for OUTBALANCE in addition to OUT calls in vicidial_auto_calls when dialing BLENDED on CLOSER campaigns. + + + +Process Flow of the AST_VDauto_dial_FILL.pl script: +- Check if there are any servers with vicidial_balance_active=Y and no trunk shortage + - Get a count of the shortages and what campaigns they are on + - Start looping through the campaigns with trunk shortages + - Get a count of the DB value and current balance_trunk_fill + - Get list of servers with trunk shortfall + - Get a count of the servers that have no shortfall and allow balance dialing + - Get dialing variable values for servers with balance available and no shortfall + - Loop through these servers + - Calculate the available trunks for this campaign per server + - Calculate the number of trunks to dial for this server for this campaign + - Select leads from the hopper and dial + (this step is identical to normal AST_VDauto_dial.pl script) + + diff --git a/agc_2-X/branches/agc_2.0.4/docs/BASE_INSTALL.txt b/agc_2-X/branches/agc_2.0.4/docs/BASE_INSTALL.txt new file mode 100644 index 00000000..03f00071 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/BASE_INSTALL.txt @@ -0,0 +1,816 @@ +Asterisk/astguiclient install from existing server. v.2.0.4 2007-12-03 + By the astGUIclient group astguiclient@eflo.net + + +This document is meant to be more of an overview of a VICIDIAL/astGUIclient +installation. If you are looking for more detail or are having problems with +installation please read the SCRATCH_INSTALL.txt document. + +End-user Manuals for Agents and Managers are available from http://www.eflo.net + +REQUIREMENTS: +- root access on the server you want to install asGUIclient/VICIDIAL on to. +- Zap trunks(T1/E1 or PSTN lines), IAX2 trunks or SIP trunks required +- You must have a zaptel timer like a PSTN/T1/E1 card or ztdummy + or you can use the experimental app_conference module +- Client phones can be SIP/IAX/Zap +- SoX 12.17.5 or greater must be installed +- GNU screen 3.9.15 or greater must be installed +- ntp must be installed and syncd to same time source as any other servers +- Perl5 with several CPAN modules(Time::HiRes, DBI, DBD::mysql, Net::Telnet, Net::Server etc) +- asterisk-perl 0.08, do NOT use the 0.09 version, it does not work with VICIDIAL +- MySQL server or mysqlclientlibs, must be version 4.0.X or higher +- If you will be installing Asterisk 1.4 releases you need Gnu Make 3.81 +- Apache/PHP server with php.ini memory_limit set to 48M + + + + +PHASE 1: INSTALLING ASTERISK + +1. follow these command line steps: +mkdir /usr/src/asterisk +cd /usr/src/asterisk +wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.2.24.tar.gz +wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.2.21.tar.gz +wget http://ftp.digium.com/pub/libpri/releases/libpri-1.2.5.tar.gz +gunzip asterisk-1.2.24.tar.gz +tar xvf asterisk-1.2.24.tar +gunzip zaptel-1.2.21.tar.gz +tar xvf zaptel-1.2.21.tar +gunzip libpri-1.2.5.tar.gz +tar xvf libpri-1.2.5.tar +cd ./zaptel-1.2.21 +wget http://www.freedomphones.net/files/newt-0.51.6.tar.gz +gunzip newt-0.51.6.tar.gz +tar xvf newt-0.51.6.tar +cd newt-0.51.6 +./configure +make +make install +cd ../ +ln -s /usr/lib/libnewt.so.0.51.6 /usr/lib/libnewt.so.0.51 +make clean +make zttool +make +make install +cd ../libpri-1.2.5 +make clean +make +make install +cd ../asterisk-1.2.24 + (1.2 tree) If you want to include Answering Machine Detection ability + you will need to download app_amd.c and amd.conf and alter the + apps/Makefile to compile it properly + cd apps + wget http://www.eflo.net/files/app_amd2.c + mv app_amd2.c app_amd.c + vi Makefile + replace this line(line 32): + app_mixmonitor.so app_stack.so + with this line: + app_mixmonitor.so app_stack.so app_amd.so + wget http://www.eflo.net/files/amd2.conf + mkdir /etc/asterisk + mv amd2.conf /etc/asterisk/amd.conf + *OPTIONAL*(1.2.23 thru 1.2.24) apply the meetme DTMF passthru patch + wget http://www.eflo.net/files/meetme_DTMF_passthru-1.2.23.patch + patch -p1 < ./meetme_DTMF_passthru-1.2.23.patch + - File to patch: app_meetme.c + *OPTIONAL*(1.2.12.1 thru 1.2.24) apply the meetme volume control patch + *Different patches available for 1.2.7.1 through 1.2.14 + wget http://www.eflo.net/files/meetme_volume_control_1.2.16.patch + patch -p1 < ./meetme_volume_control_1.2.16.patch + - File to patch: app_meetme.c + cd ../ + + (1.2 tree) apply the cli delimiter patch + wget http://www.eflo.net/files/cli_chan_concise_delimiter.patch + patch -p1 < ./cli_chan_concise_delimiter.patch + - File to patch: cli.c + + *OPTIONAL*(1.2.14 thru 1.2.24) rewrite of waitforsilence + wget http://www.eflo.net/files/app_waitforsilence.c + mv app_waitforsilence.c apps/app_waitforsilence.c + + *OPTIONAL* shorter enter and leave sounds for meetme + wget http://www.eflo.net/files/enter.h + wget http://www.eflo.net/files/leave.h + mv -f enter.h apps/enter.h + mv -f leave.h apps/leave.h + +make clean +make +make install +make samples # this makes sample conf files (only use for new installs) + +modprobe zaptel # this loads the zaptel module + - install the module for the digium device that you are using, we are + using the T100P single span T1 card so we use: +modprobe wct1xxp + Here's the list of all digium cards and the modules you use with +them: + Card Module + ----------------- + TDM400P wctdm + X100P wcfxo + TDM* wcfxs + S100U wcusb + T100P wct1xxp + E100P wct1xxp + T400P tor2 + E400P tor2 + TE110P wcte11xp + TE410P wct4xxp + TE405P wct4xxp + TE411P wct4xxp + TE406P wct4xxp + TE210P wct2xxp + TE205P wct2xxp + TDM2400P wctdm24xxp + - If you have chosen a Sangoma T1/E1 or analog card, you will need to + follow their instructions for installation of their driver software + LATEST Sangoma Wanpipe drivers: + ftp://ftp.sangoma.com/linux/current_wanpipe/wanpipe-2.3.4-13.tgz + - now your asterisk installation is built and loaded and it's time to +configure it. + +NOTES: If you want to install zttool diagnostics you may need the newt package installed: +http://www.freedomphones.net/files/newt-0.51.6.tar.gz +ln -s /usr/lib/libnewt.so.0.51.6 /usr/lib/libnewt.so.0.51 +then go to your zaptel folder and do 'make zttool' + +Digium/Clone X100P EXAMPLE for reliable cheap hardware timer: +./conf_examples/zaptel.conf.x100p.sample +./conf_examples/zapata.conf.x100p.sample + +Digium/Clone T100P EXAMPLE, also works for TE4xxp cards +./conf_examples/zaptel.conf.t100p.sample +./conf_examples/zapata.conf.t100p.sample + + + + + +PHASE 2: CONFIGURING ASTERISK + +Sample conf files for a system with: +- astGUIclient and VICIDIAL +- two SIP phones +- one IAX phone +- a SIP trunk +- an IAX trunk +- a set of Zap phones through a channelbank +- a Zap T1 PRI line with 23 voice channels +These are available in these sample conf files: +./conf_examples/sip.conf.sample +./conf_examples/iax.conf.sample +./conf_examples/extensions.conf.sample +./conf_examples/meetme.conf.sample +./conf_examples/voicemail.conf.sample +./conf_examples/manager.conf.sample +./conf_examples/logger.conf.sample +./conf_examples/dnsmgr.conf.sample + +For more information on configuring Asterisk or your phones read the +SCRATCH_INSTALL document. + + + + + +PHASE 3: INSTALLING ASTGUICLIENT AND VICIDIAL + +Now that Asterisk is installed and running we can add the astGUIclient and +VICIDIAL components to the system. + +There are two methods for downloading astGUIclient/VICIDIAL, a release and SVN + +1. Go to http://astguiclient.sf.net/ and download the latest astguiclient +package(as of this writing it is 2.0.4) + - for 2.0.X release: + mkdir /usr/src/astguiclient + cd /usr/src/astguiclient + wget http://internap.dl.sourceforge.net/sourceforge/astguiclient/astguiclient_2.0.4.zip + unzip astguiclient_2.0.4.zip + perl install.pl + - for SVN 2.0 trunk: + mkdir /usr/src/astguiclient + cd /usr/src/astguiclient + svn checkout svn://svn.eflo.net:43690/agc_2-X/trunk + cd trunk + perl install.pl + select to do interactive setup and customize to your server + - there is one more file you need that's not included with the download +package, it's the conf.gsm file(this is the half-hour music file that we use +to put people on hold). I have a free classical music file that is available +free for download at the following two sites: + http://www.freedomphones.net/conf.gsm + http://astguiclient.sf.net/conf.gsm + Once you have downloaded it, you will need to copy it to this folder: + /var/lib/asterisk/sounds/ + Then you will need to execute this command to copy it as the park file + 'cp /var/lib/asterisk/sounds/conf.gsm /var/lib/asterisk/sounds/park.gsm' + Here are the steps spelled out: + cd /var/lib/asterisk/sounds + wget http://www.freedomphones.net/conf.gsm + cp conf.gsm park.gsm + - you are done + +If you will be doing native music-on-hold for your inbound calls, you will need +musiconhold audio files to be converted to native formats like GSM, ULAW and ALAW: + + cd /var/lib/asterisk/mohmp3/ + mpg123 -s --rate 44100 --mono /var/lib/asterisk/mohmp3/fpm-sunshine.mp3 > /var/lib/asterisk/mohmp3/fpm-sunshine.raw + sox -r 44100 -w -s -c 1 fpm-sunshine.raw -r 8000 -c 1 fpm-sunshine.wav + sox fpm-sunshine.wav -t gsm -r 8000 -b -c 1 fpm-sunshine.gsm + sox fpm-sunshine.wav -t ul -r 8000 -b -c 1 fpm-sunshine.pcm + mpg123 -s --rate 44100 --mono /var/lib/asterisk/mohmp3/fpm-calm-river.mp3 > /var/lib/asterisk/mohmp3/fpm-calm-river.raw + sox -r 44100 -w -s -c 1 fpm-calm-river.raw -r 8000 -c 1 fpm-calm-river.wav + sox fpm-calm-river.wav -t gsm -r 8000 -b -c 1 fpm-calm-river.gsm + sox fpm-calm-river.wav -t ul -r 8000 -b -c 1 fpm-calm-river.pcm + mpg123 -s --rate 44100 --mono /var/lib/asterisk/mohmp3/fpm-world-mix.mp3 > /var/lib/asterisk/mohmp3/fpm-world-mix.raw + sox -r 44100 -w -s -c 1 fpm-world-mix.raw -r 8000 -c 1 fpm-world-mix.wav + sox fpm-world-mix.wav -t gsm -r 8000 -b -c 1 fpm-world-mix.gsm + sox fpm-world-mix.wav -t ul -r 8000 -b -c 1 fpm-world-mix.pcm + rm -f *.raw + mkdir ../orig-mp3 + mv -f *.mp3 ../orig-mp3/ + + + + + +PHASE 4: CREATING MYSQL DATABASE AND POPULATING IT + +we will create the database and add a few initial records so that we can +use the administrative web interface. Since this is a new install it is easier +to use our new mysql script file to add the tables to the database: + +1. at the command prompt type go to the mysql client: +/usr/local/mysql/bin/mysql +2. type the following into the mysql client prompt: + (make sure you put your IP address in place of "10.10.10.15" in the queries below) +######------ BEGIN Mysql data entry(you can copy and paste this into terminal) # + +create database asterisk; + +GRANT SELECT,INSERT,UPDATE,DELETE,LOCK TABLES on asterisk.* TO cron@'%' IDENTIFIED BY '1234'; +GRANT SELECT,INSERT,UPDATE,DELETE,LOCK TABLES on asterisk.* TO cron@localhost IDENTIFIED BY '1234'; + +use asterisk; + +\. /usr/src/astguiclient/trunk/extras/MySQL_AST_CREATE_tables.sql + or you may need to run this if you get an error: + \. /usr/src/astguiclient/astguiclient/MySQL_AST_CREATE_tables.sql + +##### make sure on these queries that you change the server_ip "10.10.10.15" +##### to the server IP that you are using + +insert into servers (server_id,server_description,server_ip,active,asterisk_version)values('TESTasterisk','Test install of Asterisk server', '10.10.10.15','Y','1.2.24'); + +insert into server_updater values('10.10.10.15',''); + +insert into phones (extension, dialplan_number, voicemail_id, phone_ip, computer_ip, server_ip, login, pass, status, active, phone_type, fullname, company, picture, messages, old_messages, protocol) values('gs102','102','102','10.10.10.16','10.10.9.16','10.10.10.15','gs102','test', 'ADMIN','Y','Grandstream BT 102','Test Admin Phone','TEST','','0','0','SIP'); + +insert into vicidial_users (user,pass,full_name,user_level,user_group,load_leads,campaign_detail,ast_admin_access,modify_users) values('6666','1234','Admin','9','ADMIN','1','1','1','1'); + +insert into conferences values('8600001','10.10.10.15',''); +insert into conferences values('8600002','10.10.10.15',''); +insert into conferences values('8600003','10.10.10.15',''); +insert into conferences values('8600004','10.10.10.15',''); +insert into conferences values('8600005','10.10.10.15',''); +insert into conferences values('8600006','10.10.10.15',''); +insert into conferences values('8600007','10.10.10.15',''); +insert into conferences values('8600008','10.10.10.15',''); +insert into conferences values('8600009','10.10.10.15',''); +insert into conferences values('8600010','10.10.10.15',''); +insert into conferences values('8600011','10.10.10.15',''); +insert into conferences values('8600012','10.10.10.15',''); +insert into conferences values('8600013','10.10.10.15',''); +insert into conferences values('8600014','10.10.10.15',''); +insert into conferences values('8600015','10.10.10.15',''); +insert into conferences values('8600016','10.10.10.15',''); +insert into conferences values('8600017','10.10.10.15',''); +insert into conferences values('8600018','10.10.10.15',''); +insert into conferences values('8600019','10.10.10.15',''); +insert into conferences values('8600020','10.10.10.15',''); +insert into conferences values('8600021','10.10.10.15',''); +insert into conferences values('8600022','10.10.10.15',''); +insert into conferences values('8600023','10.10.10.15',''); +insert into conferences values('8600024','10.10.10.15',''); +insert into conferences values('8600025','10.10.10.15',''); +insert into conferences values('8600026','10.10.10.15',''); +insert into conferences values('8600027','10.10.10.15',''); +insert into conferences values('8600028','10.10.10.15',''); +insert into conferences values('8600029','10.10.10.15',''); + +insert into vicidial_conferences values('8600051','10.10.10.15',''); +insert into vicidial_conferences values('8600052','10.10.10.15',''); +insert into vicidial_conferences values('8600053','10.10.10.15',''); +insert into vicidial_conferences values('8600054','10.10.10.15',''); +insert into vicidial_conferences values('8600055','10.10.10.15',''); +insert into vicidial_conferences values('8600056','10.10.10.15',''); +insert into vicidial_conferences values('8600057','10.10.10.15',''); +insert into vicidial_conferences values('8600058','10.10.10.15',''); +insert into vicidial_conferences values('8600059','10.10.10.15',''); +insert into vicidial_conferences values('8600060','10.10.10.15',''); +insert into vicidial_conferences values('8600061','10.10.10.15',''); +insert into vicidial_conferences values('8600062','10.10.10.15',''); +insert into vicidial_conferences values('8600063','10.10.10.15',''); +insert into vicidial_conferences values('8600064','10.10.10.15',''); +insert into vicidial_conferences values('8600065','10.10.10.15',''); +insert into vicidial_conferences values('8600066','10.10.10.15',''); +insert into vicidial_conferences values('8600067','10.10.10.15',''); +insert into vicidial_conferences values('8600068','10.10.10.15',''); +insert into vicidial_conferences values('8600069','10.10.10.15',''); +insert into vicidial_conferences values('8600070','10.10.10.15',''); +insert into vicidial_conferences values('8600071','10.10.10.15',''); +insert into vicidial_conferences values('8600072','10.10.10.15',''); +insert into vicidial_conferences values('8600073','10.10.10.15',''); +insert into vicidial_conferences values('8600074','10.10.10.15',''); +insert into vicidial_conferences values('8600075','10.10.10.15',''); +insert into vicidial_conferences values('8600076','10.10.10.15',''); +insert into vicidial_conferences values('8600077','10.10.10.15',''); +insert into vicidial_conferences values('8600078','10.10.10.15',''); +insert into vicidial_conferences values('8600079','10.10.10.15',''); +insert into vicidial_conferences values('8600080','10.10.10.15',''); +insert into vicidial_conferences values('8600081','10.10.10.15',''); +insert into vicidial_conferences values('8600082','10.10.10.15',''); +insert into vicidial_conferences values('8600083','10.10.10.15',''); +insert into vicidial_conferences values('8600084','10.10.10.15',''); +insert into vicidial_conferences values('8600085','10.10.10.15',''); +insert into vicidial_conferences values('8600086','10.10.10.15',''); +insert into vicidial_conferences values('8600087','10.10.10.15',''); +insert into vicidial_conferences values('8600088','10.10.10.15',''); +insert into vicidial_conferences values('8600089','10.10.10.15',''); +insert into vicidial_conferences values('8600090','10.10.10.15',''); +insert into vicidial_conferences values('8600091','10.10.10.15',''); +insert into vicidial_conferences values('8600092','10.10.10.15',''); +insert into vicidial_conferences values('8600093','10.10.10.15',''); +insert into vicidial_conferences values('8600094','10.10.10.15',''); +insert into vicidial_conferences values('8600095','10.10.10.15',''); +insert into vicidial_conferences values('8600096','10.10.10.15',''); +insert into vicidial_conferences values('8600097','10.10.10.15',''); +insert into vicidial_conferences values('8600098','10.10.10.15',''); +insert into vicidial_conferences values('8600099','10.10.10.15',''); +insert into vicidial_conferences values('8600100','10.10.10.15',''); +insert into vicidial_conferences values('8600101','10.10.10.15',''); +insert into vicidial_conferences values('8600102','10.10.10.15',''); +insert into vicidial_conferences values('8600103','10.10.10.15',''); +insert into vicidial_conferences values('8600104','10.10.10.15',''); +insert into vicidial_conferences values('8600105','10.10.10.15',''); +insert into vicidial_conferences values('8600106','10.10.10.15',''); +insert into vicidial_conferences values('8600107','10.10.10.15',''); +insert into vicidial_conferences values('8600108','10.10.10.15',''); +insert into vicidial_conferences values('8600109','10.10.10.15',''); +insert into vicidial_conferences values('8600110','10.10.10.15',''); +insert into vicidial_conferences values('8600111','10.10.10.15',''); +insert into vicidial_conferences values('8600112','10.10.10.15',''); +insert into vicidial_conferences values('8600113','10.10.10.15',''); +insert into vicidial_conferences values('8600114','10.10.10.15',''); +insert into vicidial_conferences values('8600115','10.10.10.15',''); +insert into vicidial_conferences values('8600116','10.10.10.15',''); +insert into vicidial_conferences values('8600117','10.10.10.15',''); +insert into vicidial_conferences values('8600118','10.10.10.15',''); +insert into vicidial_conferences values('8600119','10.10.10.15',''); +insert into vicidial_conferences values('8600120','10.10.10.15',''); +insert into vicidial_conferences values('8600121','10.10.10.15',''); +insert into vicidial_conferences values('8600122','10.10.10.15',''); +insert into vicidial_conferences values('8600123','10.10.10.15',''); +insert into vicidial_conferences values('8600124','10.10.10.15',''); +insert into vicidial_conferences values('8600125','10.10.10.15',''); +insert into vicidial_conferences values('8600126','10.10.10.15',''); +insert into vicidial_conferences values('8600127','10.10.10.15',''); +insert into vicidial_conferences values('8600128','10.10.10.15',''); +insert into vicidial_conferences values('8600129','10.10.10.15',''); +insert into vicidial_conferences values('8600130','10.10.10.15',''); +insert into vicidial_conferences values('8600131','10.10.10.15',''); +insert into vicidial_conferences values('8600132','10.10.10.15',''); +insert into vicidial_conferences values('8600133','10.10.10.15',''); +insert into vicidial_conferences values('8600134','10.10.10.15',''); +insert into vicidial_conferences values('8600135','10.10.10.15',''); +insert into vicidial_conferences values('8600136','10.10.10.15',''); +insert into vicidial_conferences values('8600137','10.10.10.15',''); +insert into vicidial_conferences values('8600138','10.10.10.15',''); +insert into vicidial_conferences values('8600139','10.10.10.15',''); +insert into vicidial_conferences values('8600140','10.10.10.15',''); +insert into vicidial_conferences values('8600141','10.10.10.15',''); +insert into vicidial_conferences values('8600142','10.10.10.15',''); +insert into vicidial_conferences values('8600143','10.10.10.15',''); +insert into vicidial_conferences values('8600144','10.10.10.15',''); +insert into vicidial_conferences values('8600145','10.10.10.15',''); +insert into vicidial_conferences values('8600146','10.10.10.15',''); +insert into vicidial_conferences values('8600147','10.10.10.15',''); +insert into vicidial_conferences values('8600148','10.10.10.15',''); +insert into vicidial_conferences values('8600149','10.10.10.15',''); +insert into vicidial_conferences values('8600150','10.10.10.15',''); +insert into vicidial_conferences values('8600151','10.10.10.15',''); +insert into vicidial_conferences values('8600152','10.10.10.15',''); +insert into vicidial_conferences values('8600153','10.10.10.15',''); +insert into vicidial_conferences values('8600154','10.10.10.15',''); +insert into vicidial_conferences values('8600155','10.10.10.15',''); +insert into vicidial_conferences values('8600156','10.10.10.15',''); +insert into vicidial_conferences values('8600157','10.10.10.15',''); +insert into vicidial_conferences values('8600158','10.10.10.15',''); +insert into vicidial_conferences values('8600159','10.10.10.15',''); +insert into vicidial_conferences values('8600160','10.10.10.15',''); +insert into vicidial_conferences values('8600161','10.10.10.15',''); +insert into vicidial_conferences values('8600162','10.10.10.15',''); +insert into vicidial_conferences values('8600163','10.10.10.15',''); +insert into vicidial_conferences values('8600164','10.10.10.15',''); +insert into vicidial_conferences values('8600165','10.10.10.15',''); +insert into vicidial_conferences values('8600166','10.10.10.15',''); +insert into vicidial_conferences values('8600167','10.10.10.15',''); +insert into vicidial_conferences values('8600168','10.10.10.15',''); +insert into vicidial_conferences values('8600169','10.10.10.15',''); +insert into vicidial_conferences values('8600170','10.10.10.15',''); +insert into vicidial_conferences values('8600171','10.10.10.15',''); +insert into vicidial_conferences values('8600172','10.10.10.15',''); +insert into vicidial_conferences values('8600173','10.10.10.15',''); +insert into vicidial_conferences values('8600174','10.10.10.15',''); +insert into vicidial_conferences values('8600175','10.10.10.15',''); +insert into vicidial_conferences values('8600176','10.10.10.15',''); +insert into vicidial_conferences values('8600177','10.10.10.15',''); +insert into vicidial_conferences values('8600178','10.10.10.15',''); +insert into vicidial_conferences values('8600179','10.10.10.15',''); +insert into vicidial_conferences values('8600180','10.10.10.15',''); +insert into vicidial_conferences values('8600181','10.10.10.15',''); +insert into vicidial_conferences values('8600182','10.10.10.15',''); +insert into vicidial_conferences values('8600183','10.10.10.15',''); +insert into vicidial_conferences values('8600184','10.10.10.15',''); +insert into vicidial_conferences values('8600185','10.10.10.15',''); +insert into vicidial_conferences values('8600186','10.10.10.15',''); +insert into vicidial_conferences values('8600187','10.10.10.15',''); +insert into vicidial_conferences values('8600188','10.10.10.15',''); +insert into vicidial_conferences values('8600189','10.10.10.15',''); +insert into vicidial_conferences values('8600190','10.10.10.15',''); +insert into vicidial_conferences values('8600191','10.10.10.15',''); +insert into vicidial_conferences values('8600192','10.10.10.15',''); +insert into vicidial_conferences values('8600193','10.10.10.15',''); +insert into vicidial_conferences values('8600194','10.10.10.15',''); +insert into vicidial_conferences values('8600195','10.10.10.15',''); +insert into vicidial_conferences values('8600196','10.10.10.15',''); +insert into vicidial_conferences values('8600197','10.10.10.15',''); +insert into vicidial_conferences values('8600198','10.10.10.15',''); +insert into vicidial_conferences values('8600199','10.10.10.15',''); +insert into vicidial_conferences values('8600200','10.10.10.15',''); + +### insert test vicidial leads, you may want to replace 7275551212 +### with a real number to test in these records +insert into vicidial_list values('','2004-01-06','','NEW','','','TEST01','101','TESTCAMP','N','1','7275551212','Mr','Matt','X','lead01','1234 Fake St.','','','Clearwater','FL','','33760','USA','M','1970-01-01','','test@test.com','suprise','comments go here','0'); +insert into vicidial_list values('','2004-01-06','','NEW','','','TEST01','101','TESTCAMP','N','1','7275551212','Mr','Matt','X','lead02','1234 Fake St.','','','Clearwater','FL','','33760','USA','M','1970-01-01','','test@test.com','suprise','comments go here','0'); +insert into vicidial_list values('','2004-01-07','','NEW','','','TEST01','101','TESTCAMP','N','1','7275551212','Mr','Matt','X','lead03','1234 Fake St.','','','Clearwater','FL','','33760','USA','M','1970-01-01','','test@test.com','suprise','comments go here','0'); +insert into vicidial_list values('','2004-01-07','','NEW','','','TEST01','101','TESTCAMP','N','1','7275551212','Mr','Matt','X','lead04','1234 Fake St.','','','Clearwater','FL','','33760','USA','M','1970-01-01','','test@test.com','suprise','comments go here','0'); +insert into vicidial_list values('','2004-01-07','','NEW','','','TEST01','101','TESTCAMP','N','1','7275551212','Mr','Matt','X','lead05','1234 Fake St.','','','Clearwater','FL','','33760','USA','M','1970-01-01','','test@test.com','suprise','comments go here','0'); +insert into vicidial_list values('','2004-01-07','','NEW','','','TEST01','101','TESTCAMP','N','1','7275551212','Mr','Matt','X','lead06','1234 Fake St.','','','Clearwater','FL','','33760','USA','M','1970-01-01','','test@test.com','suprise','comments go here','0'); +insert into vicidial_list values('','2004-01-07','','NEW','','','TEST01','101','TESTCAMP','N','1','7275551212','Mr','Matt','X','lead07','1234 Fake St.','','','Clearwater','FL','','33760','USA','M','1970-01-01','','test@test.com','suprise','comments go here','0'); + +### these first 5 must be in all VICIDIAL systems for it to work properly # +insert into vicidial_statuses values('NEW','New Lead','N','N','UNDEFINED'); +insert into vicidial_statuses values('QUEUE','Lead To Be Called','N','N','UNDEFINED'); +insert into vicidial_statuses values('INCALL','Lead Being Called','N','N','UNDEFINED'); +insert into vicidial_statuses values('DROP','Agent Not Available','N','Y','UNDEFINED'); +insert into vicidial_statuses values('NA','No Answer AutoDial','N','N','UNDEFINED'); + +insert into vicidial_statuses values('CALLBK','Call Back','Y','Y','UNDEFINED'); +insert into vicidial_statuses values('A','Answering Machine','Y','N','UNDEFINED'); +insert into vicidial_statuses values('AA','Answering Machine Auto','N','N','UNDEFINED'); +insert into vicidial_statuses values('AM','Answering Machine Sent to Mesg','N','N','UNDEFINED'); +insert into vicidial_statuses values('AL','Answering Machine Msg Played','N','N','UNDEFINED'); +insert into vicidial_statuses values('B','Busy','Y','N','UNDEFINED'); +insert into vicidial_statuses values('DC','Disconnected Number','Y','N','UNDEFINED'); +insert into vicidial_statuses values('DEC','Declined Sale','Y','Y','UNDEFINED'); +insert into vicidial_statuses values('DNC','DO NOT CALL','Y','Y','UNDEFINED'); +insert into vicidial_statuses values('SALE','Sale Made','Y','Y','UNDEFINED'); +insert into vicidial_statuses values('N','No Answer','Y','N','UNDEFINED'); +insert into vicidial_statuses values('NI','Not Interested','Y','Y','UNDEFINED'); +insert into vicidial_statuses values('NP','No Pitch No Price','Y','Y','UNDEFINED'); +insert into vicidial_statuses values('XFER','Call Transferred','Y','Y','UNDEFINED'); + +quit + + run this command from command line: + - /usr/share/astguiclient/ADMIN_area_code_populate.pl + +######------ END Mysql data entry ------###### + +NOTE: if you are not installing using default user/pass or have MySQL on another +server, you will need to edit either the /etc/astguiclient.conf file or the +dbconnect.php files in the astguiclient, vicidial and agc directories of your +webroot. + +3. Enter the astguiclient administration page: +http://10.10.10.15/vicidial/admin.php +NOTE: if you click on the Logout button you must leave the user/pass empty and click OK + - Here you will enter the login and password that you inserted into the mysql +database in the vicidial_users table (above [6666/1234]) + - Now that you are logged into the astGUIclient administration system we can +add a new phone entry for each of the sipura lines we created. + - click on the "PHONES" link at the top, then the "ADD PHONE" link below +that and enter in the proper information for each of the new phone lines. +Here's what we entered for spa2000: + - Phone extension: spa2000 + - Dialplan Number: 2000 + - Voicemail Box: 2000 + - Phone IP address: 10.10.10.17 + - Computer IP address: 10.10.9.17 + - Server IP: 10.10.10.15 + - Login: spa2000 + - Password: test + - Status: ACTIVE + - Active Account: Y + - Phone Type: Sipura SPA-2000 line 1 + - Full Name: Sipura line 1 test + - Company: TEST + - Picture: + - Protocol: SIP + - for the next phone simply replace 2000 with 2001 in the above example + - now your phones are all all set up in the astguiclient system and you can +use this website to add new phones to be used with astguiclient and monitor +the number of calls people are making. + - click on the "LIST ALL SERVERS" link at the top then click on the + server to modify. Verify that the GMT time zone and all other fields + are what you want them to be. There is a setting(Max VICIDIAL Trunks) + that can be modified to limit the number of VICIDIAL outbound trunks + that will be allowed to use on this server. + +**OPTIONAL** For Zap clients you will need to use full Zap Channel name as the +extension on the admin page entry: "1-1" for our Zap phone example +previously. And do not forget to set the protocol on this page to Zap + + + + + +PHASE 5: ADDING STARTUP ENTRIES FOR ASTGUICLIENT/VICIDIAL SCRIPTS + +1. Make several entries in the rc.local of your system: + - on the command line type: + - vi /etc/rc.d/rc.local + - add the following entries(here's what we used): + +### Path to local asterisk-perl_0.08 module if needed +PERL5LIB="/usr/share/astguiclient/libs"; export PERL5LIB + +### start time server +/usr/local/bin/ntpdate -u 18.145.0.30 +/usr/sbin/ntpd + +### start up the MySQL server +/usr/local/mysql/bin/mysqld_safe --user=mysql --skip-name-resolve --skip-host-cache & + +### roll the Asterisk logs upon reboot +/usr/share/astguiclient/ADMIN_restart_roll_logs.pl + +### clear the server-related records from the database +/usr/share/astguiclient/AST_reset_mysql_vars.pl + +### start up the apache web server +/usr/local/apache2/bin/apachectl start + +### load digium zaptel 4xT1 drivers into system +# if using Sangoma card, put wanrouter start in place or modprobes +modprobe zaptel +modprobe wct4xxp +/sbin/ztcfg -vvvvvvvvvvvv + +### sybsys local login +touch /var/lock/subsys/local + +### sleep for 10 seconds before launching Asterisk +sleep 10 + +### start up asterisk +/usr/share/astguiclient/start_asterisk_boot.pl + + - you are done + + + + + +PHASE 6: ADDING CRONTAB ENTRIES FOR ASTGUICLIENT/VICIDIAL SCRIPTS + +1. Make several entries in the cron of your system: + - on the command line type: + - cd /usr/share/astguiclient + - crontab -e + - add the following entries(here's what we used): + (Note if you have not edited the AST_CRON_mix_recordings.pl script +to FTP to a different server, then you should use the +AST_CRON_mix_recordings_BASIC.pl file in it's place) + +### recording mixing for Asterisk run every 5 minutes +1,6,11,16,21,26,31,36,41,46,51,56 * * * 1,2,3,4,5,6 /usr/share/astguiclient/AST_CRON_mix_recordings_BASIC.pl + +### keepalive script for astguiclient processes +* * * * * /usr/share/astguiclient/ADMIN_keepalive_ALL.pl + +### kill Hangup script for Asterisk updaters +* * * * * /usr/share/astguiclient/AST_manager_kill_hung_congested.pl + +### updater for voicemail +* * * * * /usr/share/astguiclient/AST_vm_update.pl + +### updater for conference validator +* * * * * /usr/share/astguiclient/AST_conf_update.pl + +### flush queue DB table every hour for entries older than 1 hour +11 * * * * /usr/share/astguiclient/AST_flush_DBqueue.pl -q + +### fix the vicidial_agent_log once every hour +33 * * * * /usr/share/astguiclient/AST_cleanup_agent_log.pl + +### updater for VICIDIAL hopper +* * * * * /usr/share/astguiclient/AST_VDhopper.pl -q + +### adjust the GMT offset for the leads in the vicidial_list table +1 1,7 * * * /usr/share/astguiclient/ADMIN_adjust_GMTnow_on_leads.pl --debug --postal-code-gmt + +### reset several temporary-info tables in the database +2 1 * * * /usr/share/astguiclient/AST_reset_mysql_vars.pl + +### optimize the database tables within the asterisk database +3 1 * * * /usr/share/astguiclient/AST_DB_optimize.pl + +## adjust time on the server with ntp +30 * * * * /usr/local/bin/ntpdate -u 18.145.0.30 2>/dev/null 1>&2 + +### VICIDIAL agent time log weekly summary report generation +2 0 * * 0 /usr/share/astguiclient/AST_agent_week.pl + +### remove old recordings more than 7 days old +24 0 * * * /usr/bin/find /var/spool/asterisk/monitor -maxdepth 2 -type f -mtime +7 -print | xargs rm -f + +### remove old vicidial logs and asterisk logs more than 2 days old +28 0 * * * /usr/bin/find /var/log/astguiclient -maxdepth 1 -type f -mtime +2 -print | xargs rm -f +29 0 * * * /usr/bin/find /var/log/asterisk -maxdepth 3 -type f -mtime +2 -print | xargs rm -f + + + + - once your system starts up you can attach to the screen running asterisk by +typing "screen -r " find which screen by typing "screen -r" and +looking for the lowest screen number. Then to detach again from the screen +while you are in it type 'Ctrl+a' then 'd' + - you are done + + + + + +PHASE 7: ADDING TEST LEADS TO VICIDIAL AND CONFIGURING A TEST CAMPAIGN AND USERS + +First we will add a few test leads to the vicidial_list table so that we can +test our system. There is also an application included with the distribution +that will accept a delimited file of leads placed in the /usr/share/astguiclient/VICIDIAL/LEADS_IN/ +directory and load it into the database automatically(VICIDIAL_IN_new_leads_file.pl +[a sample lead file in the proper format is included with this release: + - test_VICIDIAL_lead_file.txt]) +If you want to use the lead import script I suggest looking at the code to make +sure it is entering what you want it to. We are not going to go over that +particular script in this document. + +Also, there is a web-based lead loader available and is accessible from the +VICIDIAL admin.php web page(click on the "LOAD NEW LEADS" link in the LIST +section at the top of the admin page). To get to this page you must have +permissions in the vicidial_user table(Load Leads set to 1). Instructions on +it's use are included on the page through the help question mark link. + +NOTE: in PHP you must have "fileuploads" enabled for this page to work. +NOTE: it is important to have your proper country code in the phone_code field +of your leads so that the GMT offset encodding will properly code the time +zones for your leads. For the USA/Canada/Caribbean this would be 1. For the +UK this is 44 and Mexico is 52 and so on. + +Now that the sample leads have been entered, we can go into the VICIDIAL +administration website and set up our campaigns, lists and users. +But first let's make sure that they have the right GMT offset: + run this on the command line: + - /usr/share/astguiclient/ADMIN_adjust_GMTnow_on_leads.pl --postal-code-gmt + +3. Enter the astguiclient administration page: +http://10.10.10.15/vicidial/admin.php +(use the username and password created when we entered a record into the +vicidial_users table in SUBPHASE 6.3, In our case this is 6666 and 1234) +NOTE: if you click on the Logout button you must leave the user/pass empty and click OK + - Now that you are logged into the vicidial administration system we can add +new user entries for each of the new users and enter new campaigns and new +lists. + - The first step is to enter your new users, Click on the ADD A NEW USER +and fill in the appropriate information for each now user you want to +add. + - Next, you need to create a new campaign, click on the ADD A NEW +CAMPAIGN link and fill in what you want the campaign to be called as +well as a description + - Next, you need to define a new list, click on the ADD A NEW LIST link +and fill in what you want the list to be called as well as a using the +list ID of the leads that we loaded in the previous step "101" and +select the new campaign from the pull-down menu that we just created. + - Now that you have created your list, make it active by changing active to Y + - now modify your campaign ang change the first status to be called to +NEW and submit. Now your system is ready to dial. + - you are done + + + + + +PHASE 8: astGUIclient and VICIDIAL WEB CLIENTS + +The browser requirements for the web-client interfaces are: +- Firefox 0.9 or greater (Firefox 1.0.7 is the recommended browser) +- Mozilla 1.7 or greater +- Netscape 8 or greater +- Opera 8.5 or greater +- Microsoft Internet Explorer 5.0 or greater (we have noticed some serious + memory leaks in IE5 and IE6 when using this program, they do not occur in + Firefox which is why we recommend it overall.) + +To log into this app you will need a login setup in the vicidial_users table +as well as an entry for the phone you are using in the phones table. You will +first get a login prompt for the vicidial login then you will have the phone +login where you enter the Login and Password for that phone entry. From there +the app should display and you will see the MAIN screen with your login +information at the top. + +The example web page you would go to on this installation would be: +http://10.10.10.15/agc/astguiclient.php +http://10.10.10.15/agc/vicidial.php + +Another thing to note is that you can have the agc folder(with the .php files +in it) copied to multiple web servers, you just need to make sure that the +MySQL database connection works (check the settings in the dbconnect.php file +that is in the agc directory). We have had astguiclient.php running on 3 +separate web servers for the same DB server and Asterisk server. This is an +easy way to allow for auto failover and/or redundancy. Also, this client will +work over SSL connections(https) for encrypted communications with the server. + +New in astGUIclient release 1.1.7 is multi-language support. multi-language +versions of web-clients and admin pages are available in the LANG_agc.zip and +LANG_www directries and can be copied into your webroot directory. + +One more feature that the VICIDIAL web-client offers is the ability to set up +an EXTERNAL phone extension in the astguiclient admin section so that you can +have agents log in to vicidial.php wherever they have access to a phone with +an external phone number and a web browser. To do this follow these steps: +- "ADD PHONE" in the admin.php web page and enter whatever name you want +- For the dialplan number field put in the full digits that you would dial from + the Asterisk server to get to that agent's external phone(with 91 if used) +- For the Protocol select EXTERNAL +- make sure the agent knows the login and password set for this phone entry. +Then the agent will go to the vicidial.php page and enter in their phone +login/pass, their vicidial user/pass/campaign and their phone should ring in a +few seconds, and they are logged in and ready to take calls. + +Admin Note: If you want to enable your agents to login with only their user/pass +you can hardcode the phone_login and phone_pass into the query string(URL) and +use a bookmark on their desktop, taking one more step out of their login process +example: http://10.10.10.15/agc/vicidial.php?pl=gs102&pp=test + +It is recommended if you are in a call center environment that you would disable +the "Saved Form Information" option in Firefox settings. This is a checkbox in +the Privacy settings under the Options menu. + + + + + +PHASE 9: VICIDIAL REMOTE AGENTS + +With v1.0 of VICIDIAL we have the ability to use a simple web form to give +remote agents a way to receive calls to whatever number they happen to be at, +and they can view/edit call details and see a call log all through a web page +(vdremote.php) or http://10.10.10.15/vicidial/vdremote.php on this installation. +Remote Agents is only recommended for inbound calls because of the extra time +needed to dial a number out to transfer the call to. To set up remote agents, +just go to the vicidial admin.php page and ADD NEW REMOTE AGENTS(Make sure the +userID start also has a user login so they can get to the vdremote page). You +will see that you can set up a remote agent entry to take multiple lines if you +wish meaning that, for example, if you need to send all of your calls to another +location because of a massive snowstorm(and none of your agents showed up at work) +you just log in that remote agent record with say 10 lines and then all of those +calls will be directed to the same number you set up for the remote agent. Then +again you could just get your agents to log in from home if they have a phone +and computer + + + + + +PHASE 10: You are done with installation + +If you have problems and it is not working right(and are NOT celebrating right +now), feel free to take a look at the FAQ for solutions to common installation +errors, read the SCRATCH_INSTALL document, visit the VICIDIAL forum or send an +email to the mailing list: +http://www.eflo.net/VICIDIALforum/index.php +https://lists.sourceforge.net/lists/listinfo/astguiclient-users + +Also, check out our weblog: http://astguiclient.blogspot.com/ + + +**** IMPORTANT - In order for vicidial/astguiclient to function correctly please +read the REQUIREMENTS.txt for a minimum requirements list. *** + +End-user Manuals for Agents and Managers are available from http://www.eflo.net diff --git a/agc_2-X/branches/agc_2.0.4/docs/CALLBACKS_PROCESS.txt b/agc_2-X/branches/agc_2.0.4/docs/CALLBACKS_PROCESS.txt new file mode 100644 index 00000000..2077cdb7 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/CALLBACKS_PROCESS.txt @@ -0,0 +1,98 @@ +CALLBACK proces flow 2006-01-05 + +***** FULL CALLBACKS FUNCTIONALITY WAS ADDED IN THE 1.1.11 RELEASE ***** + +This will outline the process I have thought through in my head for a call-back +process in VICIDIAL. I have received suggestions for methodologies of how many +people think that call-backs should work and I think I've finally come to a +conclusion of how I may build it into VICIDIAL that incorporates most of these +suggestions. + + + +The Agent Side: +When an Agent dispositions a call as CALLBK, a popup frame will appear that will +allow selecting a date from a calendar window(with option to go forward by month +up to 1 year) and a pull-down list that will show hours(in 30 minute increments +defaulting to current half hour). After the agent selects a day and time, they +must check a box to denote that only they should be able to get this Callback. +If the box is unchecked, anyone will be able to call this lead after it's +callback_time elapses. The lead will be entered as vicidial_list.status CBHOLD +in the system and will not be able to be dialed or selected as a dial status in +the admin screen. + +If the agent checks the box that they will be the only one that can callback the +lead and it is time to call that lead again(vicidial.php will check at login and +every 30 minutes to see if there are any agent-specific leads that need to be +called back by that agent) then when the agent is paused they will be able to +click on the "CALLBACK" button on the bottom of the screen and select which lead +that they want to callback. The call will proceed as a normal call and will be +dispositioned as normal. The callback button will probably be able to flash or +gently strobe like the astguiclient.php voicemail button does when callbacks are +available to be called for that logged-in agent. + +If the agent does not check that they are the only ones to be able to call that +specific lead back, then it will be updated by the AST_VDhopper.pl script once +it's callback date/time has been reached the status will be changed to CALLBK +and will be available for calling if that status is selected in the dial +statuses for the campaign and if the list is active. + +If the managr has given the agent permission to set USERONLY callbacks, then +the agent will be able to call those customers back by clicking on the CALLBACK +count link below the comments field of vicidial.php once they are logged in. +From here they can see the listing of their callbacks and their settings, and +can call the customer back by clicking on the callback record. + + + +The Admin Side: +In the admin.php web page will be a callback viewer. Admin users will be able to +search and sort by campaign, list, user, status and time-range to see summary +lists of the Callbacks in the vicidial_callbacks table. Callbacks will be +alterable through the modify lead screen. + + + +The Server Side: +The vicidial_callbacks table will look like this: + CREATE TABLE vicidial_callbacks ( +callback_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +lead_id INT(9) UNSIGNED, +list_id INT(8) UNSIGNED, +campaign_id VARCHAR(8), +status VARCHAR(10), +entry_time DATETIME, +callback_time DATETIME, +modify_date TIMESTAMP, +user VARCHAR(20), +recipient ENUM('USERONLY','ANYONE'), +comments VARCHAR(255), +index (lead_id), +index (status), +index (callback_time) +); + +The status field will probably have the following possible values: ACTIVE, LIVE, +ARCHIVE and all old callback entries will be kept for archival purposes, +anthough not viewable by the agent. + +The AST_VDhopper.pl script will do a select every minute(before it does it's +hopper filling run) for callbacks that need to be placed back in CALLBK status. +Something like this query: + SELECT lead_id from vicidial_callbacks where callback_time < '2006-01-06 +10:02:03' and status='ACTIVE'; + +AST_VDhopper.pl will then: +- set these leads to vicidial_list.status of CALLBK +- set the called_since_last_reset to N +- insert the lead into the vicidial_hopper under the campaign it was originally + set if it is an ANYONE callback +- change the vicidial_callbacks.status to LIVE. + +At the time of a hangup of a callback call, the vicidial.php script will set the +vicidial_callbacks.status to ARCHIVE. The leads that designate the recipient as +USERONLY will not be altered in any way by AST_VDhopper.pl. + + + + diff --git a/agc_2-X/branches/agc_2.0.4/docs/IE_INCOMPATIBILITIES.txt b/agc_2-X/branches/agc_2.0.4/docs/IE_INCOMPATIBILITIES.txt new file mode 100644 index 00000000..ea564347 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/IE_INCOMPATIBILITIES.txt @@ -0,0 +1,31 @@ +Microsoft Internet Explorer Incompatibilities with VICIDIAL Agent Interface 2007-06-13 + +*** AS OF RELEASE 2.0.4 VICIDIAL IS COMPATIBLE WITH IE 6.0 *** + +There are quite a few issues with using Microsoft Internet Explorer(IE) with VICIDIAL because of incompatibilites with the W3C standards as well as stability and architectural issues. + +The decision was made to stop testing on IE because of time constraints as well as the lack of cross-compatibility of IE and lack of compatibility with standards, even between IE versions. Firefox meets all compatibility requirements which is why that is the recommended platform for VICIDIAL agents. + +As of release 2.0.4 of astguiclient, IE 5.0 and 5.5 compatibility was broken to make VICIDIAL fully compatible with IE 6.0. Along with this change, all of the memory issues were fixed, along with several features that were not working before in IE like HotKeys. + + +Some of the issues include the following: +- Because ActiveX is used for AJAX with IE(and no other browser) it is difficult to debug the issue with faulty garabage collection where IE, or rather ActiveX, will not delete any of the XMLHTTPRequest events that it grabs resulting in the eventual crashing of IE after it hits its memory limit. I have heard that with IE7 and newer ActiveX there is a potential way around this through using some different Javascript commands. +- Using a span with NOSCROLL and a form element inside of it are sometimes ignored by IE, not sure why, but using spans with form elements may need to be changed to accomodate IE in the future. + Changed: + .cust_form {font-family: sans-serif; font-size: 10px; overflow:} + To: + .cust_form {font-family: sans-serif; font-size: 10px} +- For some reason form elements inside of a hidden span cannot be given focus or blur(Causing Hotkeys not to work): + Commented out the following lines: + document.vicidial_form.inert_button.focus(); + document.vicidial_form.inert_button.blur(); +- There are issues with Hotkeys key-binding working with some versions of IE dues to the Javascript used to achieve the function. +- Sometimes document elements will error out as undefined even though Firefox ses them just fine, for example: + Commented out the folowing lines(3 locations): + if ( (dialed_label.length < 3) || (dialed_label=='NONE') ) {dialed_label='MAIN';} + Changed to: + if (dialed_label=='NONE') {dialed_label='MAIN';} + Making these changes allows IE to work with 2.0.3 but does not allow for color status bar changes on inbound calls. + + diff --git a/agc_2-X/branches/agc_2.0.4/docs/INBOUND-CLOSER_PROCESS.txt b/agc_2-X/branches/agc_2.0.4/docs/INBOUND-CLOSER_PROCESS.txt new file mode 100644 index 00000000..bbc9ac92 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/INBOUND-CLOSER_PROCESS.txt @@ -0,0 +1,113 @@ +INOUND/CLOSER proces flow 2007-05-02 + +** THIS FULLY REDONE INBOUND-CLOSER PROSESS IS PLANNED FOR THE 2.0.4 RELEASE ** + +This will outline the process I have thought through in my head for rewriting the inbound and closer call queueing and handling processes within VICIDIAL. The objective is to add the following features to make VICIDIAL a more well-rounded product: +- consolidate the 13 VDAD inbound and closer scripts into one script with CLI options +- custom hold music per in-group +- put call_times into effect for in-groups allowing calls coming in after hours to be directed to another extension or voicemail box +- allow any campaign to take inbound calls, removing the restriction on campaign_id name for that purpose + + + + + + + +***** Here are some planned features that will have to wait for the next release: +- add concurrent-transfers options to inbound groups +- announce estimated time on hold +- announce place in line +- option for customer to leave the queue and leave a message while still keeping their place in line +- allow agent to search for customer lead in system after they have been connected +- for closer transfers, allow fronter to send calls to any in-group by a pull-down list + + + +The Agent Side: +The vicidial.php script will need to be modified to allow for a record to load and show that a customer has called and possibly display their callerID and play a message that they may have left. The agent would then have the option to place a manual dial call to reach the customer. + +Another important change that needs to be made to the vicidial.php agent interface is to allow searching for a customer's record and changing the lead_id that is associated with the call while the call is going on. This could prove problematic, but will end up being a much better solution than locking the agent into a record when the call comes in. This may also result in records having to be associated with other records, which might mean either another table or possibly adding another field to the vicidial_list table. + +For the changes in the Fronter/Closer transfers, new User Group permissions will need to be added to be able to restrict the in-groups that agents are allowed to transfer calls to. When Closer transfers are enabled in a campaign the agent interface will select these in-groups and can transfer calls to any of those groups. Also, a complete reworking of how the Transfer Conference box is laid out will be done. + + + +The Admin Side: +More settings will be needed for the In-Groups section to be able to accomodate these changes: +ALTER TABLE vicidial_inbound_groups ADD moh_extension VARCHAR(20); +ALTER TABLE vicidial_inbound_groups ADD prompt_interval SMALLINT(5) UNSIGNED default '60'; +ALTER TABLE vicidial_inbound_groups ADD announce_place_in_line ENUM('Y','N') default 'N'; +ALTER TABLE vicidial_inbound_groups ADD announce_estimate_hold_time ENUM('Y','N') default 'N'; +ALTER TABLE vicidial_inbound_groups ADD allow_leave_queue_place ENUM('Y','N') default 'N'; +ALTER TABLE vicidial_inbound_groups ADD allow_leave_queue_message ENUM('Y','N') default 'N'; +ALTER TABLE vicidial_inbound_groups ADD callback_number_validation ENUM('6','7','8','9','10','11','12','13','14','NORTH_AMERICA','UK'); +ALTER TABLE vicidial_inbound_groups ADD call_time VARCHAR(20); +ALTER TABLE vicidial_inbound_groups ADD after_hours ENUM('HANGUP','VOICEMAIL','EXTENSION') default 'EXTENSION'; +ALTER TABLE vicidial_inbound_groups ADD after_hours_exten VARCHAR(20); + +In the servers table a field will also be added: +ALTER TABLE servers ADD hold_queue_prompt_exten VARCHAR(20) default '8359'; + +In the vicidial_auto_calls table a field will also be added: +ALTER TABLE vicidial_auto_calls ADD last_prompt_time DATETIME; +ALTER TABLE vicidial_auto_calls ADD random_id INT(9) UNSIGNED; +ALTER TABLE vicidial_auto_calls ADD recording_id INT(10) UNSIGNED; + +For the fronter/closer transfers some fields will need to be added to the vicidial_user groups table: +ALTER TABLE vicidial_user_groups ADD allowable_xfer_inbound_groups TEXT +ALTER TABLE vicidial_user_groups ADD default_xfer_inbound_group VARCHAR(20) + + + +The Server Side: +For inbound and closer transfers, the agi_VDAD... scripts will still run as they normally do now, but after 5 seconds, without a transfer to an agent, the customer will be put into the new call-queue manager which will consist of a constantly running perl script(we will call it "AST_VD_hold_queue.pl") that will keep track of the call while it is still active and before it gets sent to an agent, and an AGI script(we will call this one agi-VD_queue_prompts.agi) that will perform the dynamic functions of speaking the customer's place in line, estimated hold time and offer the option to press a DTMF digit and either leave a message for the agent to take the call or leave a callback number to be called back when their turn arrives. This script will also have to somehow keep the vicidial_auto_calls records active even after a customer has hung up in order to preserve place-in-line and allow for playing of a customer message or callback to a customer. + +*** This section to be removed due to change in architecture it was not implemented *** + +Here is a process flow explanation of how a call would move through the hold queue: +- Call comes in to the agi_VDADcloser... script and cannot find an agent to send the call to within 5 seconds +- the agi_VDADcloser script changes the status of the call in vicidial_auto_calls to HOLDP and sends the call to the extension that the agi-VD_queue_prompts.agi script is on(defined in the servers table, default will be 8359) +- the agi-VD_queue_prompts.agi script will query the database for the vicidial_inbound_group settings to see what options it should offer the customer and then that script plays the desired prompts(if selected, leave number and/or leave voice message), then it will wait 15 seconds for a digit press and if there is no valid digit press then it will continue on(steps for if there is a digit press are at the end of this process flow) +- Then the agi script checks for a "conferences" table entry that matches that moh_extension(for a moh_extension of 1234 this would be reserved under HOLDQ1234 in the conferences table) +- If the conference is reserved then the customer call is immediately transferred there, if it does not exist, the agi script will reserve a new conferences record and post an Originate record to the vicidial_manager table so that the hold music/message will start playing in that meetme conference +- The vicidial_auto_calls record is changed to HOLDQ and the customer call is then sent to that meetme room in listen-only mode so that multiple customers can be sent to the same meetme room.(This adds the extra option of allowing a manager to dial into that conference and speak a message to all of the people waiting in the queue) +- The AST_VD_hold_queue.pl script then checks to see if there are any available agents as well as updates the time on the vicidial_auto_calls record every second to keep it alive, as well as checking to see whether the call is due to be sent back to the prompt agi by how old the call's last_prompt_time field is set to(even if a call is in HOLDP and is in the prompt agi process, it will still keep it's place in line and it will immediately be transferred if an agent becomes available) +- If the last_prompt_time is older than prompt_interval seconds, then the vicidial_auto_calls status is set back to HOLDP and the call is sent back to the agi-VD_queue_prompts.agi script for another loop +- If there is an available agent, then the vicidial_live_agents record is updated and the call is immediately sent to the agent's meetme room +- If the customer is in the agi-prompt script and they choose to leave a message and/or leave a callback phone number, the script will add the callback number to the alt_phone field(if it does not match callerIDnumber that the call came in under), and the voice message will be logged in the recording_log table along with the server_ip that it was recorded on. The filename for the recording will be something like this "70503124128_CUSTSERV_7275551212-all.wav" which is the datetimecode_inboundgroup_customerphone +- If customer enters in a callback number and vicidial_inbound_groups callback_number_validation field is set to 6-14, NORTH_AMERICA or UK then the number of digits and pattern are validated or cleaned to make sure it is a valid number. The agi prompt script will also read back the phone number they entered to verify it again with the customer and ask for a confirmation of that number with press of a 1 or 2. +- After the customer has left a callback phone number and left a message, their vicidial_auto_calls status is changed to PLACE and their call is hung-up +- When a PLACE call that a customer had left a message on is sent to an agent, the agent will see the customer record appear and the audio recording will be automatically played in their session with a button to allow them to play it again. Then the agent screen will go into manual-dial-alt-dial mode allowing the agent to place a call back to the customer. + + + +This functionality will require three new statuses in the vicidial_auto_calls table: +HOLDQ - this status will be for the LIVE-status calls that were not sent to an agent in the first five seconds on the system, so they will be handed over to be taken care of by the AST_VD_queue_hold.pl perl script. +HOLDP - this status will be for the HOLDQ calls that are currently in the agi-VD_queue_prompts.agi script. +PLACE - this status is a placeholder for the customer after they choose the option to hang-up and either leave a message or leave their contact number for a callback. They are no longer on an active channel, but their place in line as a customer should be preserved so that the agent that receives their record can proceed with a call to follow-up with the customer. + + +MORE TO COME... + + + +- optionally make native audio files for Music On Hold: + +cd /var/lib/asterisk/mohmp3/ +mpg123 -s --rate 44100 --mono /var/lib/asterisk/mohmp3/fpm-sunshine.mp3 > /var/lib/asterisk/mohmp3/fpm-sunshine.raw +sox -r 44100 -w -s -c 1 fpm-sunshine.raw -r 8000 -c 1 fpm-sunshine.wav +sox fpm-sunshine.wav -t gsm -r 8000 -b -c 1 fpm-sunshine.gsm +sox fpm-sunshine.wav -t ul -r 8000 -b -c 1 fpm-sunshine.pcm +mpg123 -s --rate 44100 --mono /var/lib/asterisk/mohmp3/fpm-calm-river.mp3 > /var/lib/asterisk/mohmp3/fpm-calm-river.raw +sox -r 44100 -w -s -c 1 fpm-calm-river.raw -r 8000 -c 1 fpm-calm-river.wav +sox fpm-calm-river.wav -t gsm -r 8000 -b -c 1 fpm-calm-river.gsm +sox fpm-calm-river.wav -t ul -r 8000 -b -c 1 fpm-calm-river.pcm +mpg123 -s --rate 44100 --mono /var/lib/asterisk/mohmp3/fpm-world-mix.mp3 > /var/lib/asterisk/mohmp3/fpm-world-mix.raw +sox -r 44100 -w -s -c 1 fpm-world-mix.raw -r 8000 -c 1 fpm-world-mix.wav +sox fpm-world-mix.wav -t gsm -r 8000 -b -c 1 fpm-world-mix.gsm +sox fpm-world-mix.wav -t ul -r 8000 -b -c 1 fpm-world-mix.pcm +rm -f *.raw +mkdir ../orig-mp3 +mv -f *.mp3 ../orig-mp3/ + diff --git a/agc_2-X/branches/agc_2.0.4/docs/LICENSE.txt b/agc_2-X/branches/agc_2.0.4/docs/LICENSE.txt new file mode 100644 index 00000000..d3ca3645 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/LICENSE.txt @@ -0,0 +1,278 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. diff --git a/agc_2-X/branches/agc_2.0.4/docs/LOAD_BALANCING.txt b/agc_2-X/branches/agc_2.0.4/docs/LOAD_BALANCING.txt new file mode 100644 index 00000000..e1ea0567 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/LOAD_BALANCING.txt @@ -0,0 +1,314 @@ +VICIDIAL - LOAD BALANCING setup. + +This document is meant to summarize the capabilities and setup of VICIDIAL in a multi-server environment. + +Why Load Balance? + +The primary reason to do load balancing, or clustering of multiple VICIDIAL servers, is to spread the calls taken in or the answered calls on an outbound campaign across all of the agents that are logged into a campaign no matter what server they are on. For instance, on an outbound campaign, you have 2 servers, server one has 20 agents logged in on a campaign and the other server(two) has 5 agents logged in on the same campaign. Lets say that the campaign is set to a dial_level of 3.0 so there are 60 active calls being placed on server one and 15 active calls being placed on server two. Then 23 of the calls on server one answer, meaning that there are three calls too many for the agents available on that server. Under a load-balancing-overflow setup, those three calls can travel over an IAX2 trunk directly to the agents on that server that are still available. This increased efficiency in both inbound and outbound environments as well as reducing on-hold times for customers and equalizing wait times for agents across all servers for a campaign. + +Another reason for load balancing is the ability to use cheaper hardware on the server side. It is much cheaper and more fault-tolerant to buy four P4 2.0GHz 1U servers for $800 a piece than it is to buy a single 4U quad Xeon 3.2GHz server. The four 1U servers will have more total capacity, can be easily scaled and if one fails you've only lost 25% of capacity instead of everything. This philosophy has serverd our call center very well over the last two years. + +As of release 2.0.2, a new script(AST_VDauto_dial_FILL.pl) allows for dial-out-only(no agents on the server) VICIDIAL servers as well as balance dialing where a server with available trunk lines can dial lines for another server that does not have enough lines to dial for it's dial_level. AST_VDauto_dial_FILL.pl script is only for multi-server systems and is started from new ADMIN_keepalive_ALL.pl script with option 7 in astguiclient.conf. + + + +How do I set up load balancing on my two server VICIDIAL setup? + +These steps are mostly taken directly from the SCRATCH_INSTALL document, but they are all put together here to give a better idea of what is needed all in one place. It is assumed that you already have VICIDIAL up and running on both servers. + +NOTE: In a multi-server setup you may want to have your database and web server on a separate machine from your Asterisk/VICIDIAL servers. Simply copy the web page directories to your new database/web server and set the /etc/astguiclient.conf files on your VICIDIAL servers to point to that new database server. You can also have several web servers(or even load-balancing web servers) if you have more than 70 seats in one installation you may want to do that if you are not using eaccelerator. For the web pages you just need to make sure the dbconnect.php files are configured for your database server. We have had 12 VICIDIAL servers and 2 web servers using a single database server with no problems. + +NOTE: at the bottom of this document are conf examples for a 3 server load balancing setup. + + +1. The VICIDIAL/Asterisk servers need to have all of the perl scripts and cron jobs installed on them, except these which only need to be on one of the servers: + - AST_VDhopper.pl + - AST_cleanup_agent_log.pl + - ADMIN_adjust_GMTnow_on_leads.pl + - AST_DB_optimize.pl + - AST_VDadapt.pl + - AST_VDauto_dial_FILL.pl + +2. The VARactive_keepalives variable in /etc/astguiclient.conf should have "5" and "7" on only ONE SERVER in your entire dialer setup, the other servers should not have 5 or 7 in that field. + # 1 - AST_update + # 2 - AST_send_listen + # 3 - AST_VDauto_dial + # 4 - AST_VDremote_agents + # 5 - AST_VDadapt (If multi-server system, this must only be on one server) + # 6 - FastAGI_log + # 7 - AST_VDauto_dial_FILL (only for multi-server, this must only be on one server) + +3. The two servers need to be registered to each other as IAX2 friends: + SERVER ONE(ASTtest1-10.10.10.15) + iax.conf: + register => ASTtest1:test@10.10.10.16 + + [ASTtest2] + type=friend + accountcode=IAXtrunk2 + context=default + auth=plaintext + host=dynamic + permit=0.0.0.0/0.0.0.0 + secret=test + qualify=yes + + SERVER TWO(ASTtest2-10.10.10.16) + iax.conf: + register => ASTtest2:test@10.10.10.15 + + [ASTtest1] + type=friend + accountcode=IAXtrunk1 + context=default + auth=plaintext + host=dynamic + permit=0.0.0.0/0.0.0.0 + secret=test + qualify=yes + + +4. The two servers need to have wildcard extensions assigned to the other server in the dialplan: + SERVER ONE(ASTtest1-10.10.10.15) + extensions.conf: + [globals] + TRUNKIAX2=IAX2/ASTtest1:test@10.10.10.16 + + [default] + exten => _010*010*010*015*8600XXX,1,Goto(default,${EXTEN:16},1) + exten => _010*010*010*016*8600XXX,1,Dial(${TRUNKIAX2}/${EXTEN:16},55,o) + exten => _010*010*010*015*78600XXX,1,Goto(default,${EXTEN:16},1) + exten => _010*010*010*016*78600XXX,1,Dial(${TRUNKIAX2}/${EXTEN:16},55,o) + + exten => _010*010*010*015*8600XXX*.,1,AGI(agi-VDADfixCXFER.agi) + exten => _010*010*010*016*8600XXX*.,1,Dial(${TRUNKIAX2}/${EXTEN:16},55,o) + exten => _8600XXX*.,1,AGI(agi-VDADfixCXFER.agi) + exten => _010*010*010*015*78600XXX*.,1,AGI(agi-VDADfixCXFER.agi) + exten => _010*010*010*016*78600XXX*.,1,Dial(${TRUNKIAX2}/${EXTEN:16},55,o) + exten => _78600XXX*.,1,AGI(agi-VDADfixCXFER.agi) + + SERVER TWO(ASTtest2-10.10.10.16) + extensions.conf: + [globals] + TRUNKIAX1=IAX2/ASTtest2:test@10.10.10.15 + + [default] + exten => _010*010*010*015*8600XXX,1,Dial(${TRUNKIAX1}/${EXTEN:16},55,o) + exten => _010*010*010*016*8600XXX,1,Goto(default,${EXTEN:16},1) + exten => _010*010*010*015*78600XXX,1,Dial(${TRUNKIAX1}/${EXTEN:16},55,o) + exten => _010*010*010*016*78600XXX,1,Goto(default,${EXTEN:16},1) + + exten => _010*010*010*015*8600XXX*.,1,Dial(${TRUNKIAX1}/${EXTEN:16},55,o) + exten => _010*010*010*016*8600XXX*.,1,Goto(default,${EXTEN:16},1) + exten => _8600XXX*.,1,AGI(agi-VDADfixCXFER.agi) + exten => _010*010*010*015*78600XXX*.,1,Dial(${TRUNKIAX1}/${EXTEN:16},55,o) + exten => _010*010*010*016*78600XXX*.,1,Goto(default,${EXTEN:16},1) + exten => _78600XXX*.,1,AGI(agi-VDADfixCXFER.agi) + +5. For BOTH servers the VDAD extens need to be setup there as well for the Load-Balance and Load-Balance-Overflow AGI scripts, as well as setting up the closer and inbound extens if needed: + + ; VICIDIAL_auto_dialer transfer script Load Balance Overflow: + exten => 8367,1,AGI(call_log.agi,${EXTEN}) + exten => 8367,2,AGI(agi-VDAD_LO_transfer.agi,${EXTEN}) + exten => 8367,3,AGI(agi-VDAD_LO_transfer.agi,${EXTEN}) + exten => 8367,4,AGI(agi-VDAD_LO_transfer.agi,${EXTEN}) + exten => 8367,5,Hangup + + ; VICIDIAL_auto_dialer transfer script Load Balanced: + exten => 8368,1,AGI(call_log.agi,${EXTEN}) + exten => 8368,2,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) + exten => 8368,3,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) + exten => 8368,4,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) + exten => 8368,5,Hangup + + ; parameters for agi-VDAD_LB_closer.agi (2 fields separated by five dashes "-----"): + ; 1. the full extension formatted by VICIDIAL for internal transfers * separated + ; 2. the word START to denote the beginning of the acceptance of the transfer + ; inbound VICIDIAL transfer calls [INTERNAL TRANSFER] + exten => _90009.,1,Answer ; Answer the line + exten => _90009.,2,AGI(agi-VDAD_LB_closer.agi,${EXTEN}-----START) + exten => _90009.,3,Hangup + + ; parameters for agi-VDAD_LO_closer.agi (2 fields separated by five dashes "-----"): + ; 1. the full extension formatted by VICIDIAL for internal transfers * separated + ; 2. the word START to denote the beginning of the acceptance of the transfer + ; inbound VICIDIAL transfer calls [LOCAL TRANSFER] + exten => _990009.,1,Answer ; Answer the line + exten => _990009.,2,AGI(agi-VDAD_LO_closer.agi,${EXTEN}-----START) + exten => _990009.,3,Hangup + + ; inbound VICIDIAL call with prompt for 4-digit fronter code + exten => 1234,1,Answer ; Answer the line + exten => 1234,2,AGI(agi-VDAD_LO_closer_inbound.agi,CL_GALLERIA-----7275555134-----Closer-----park----------999-----1) + exten => 1234,3,Hangup + + +6. Reload both Asterisk servers and for outbound change the VDAD exten to 8367 or 8368 and kill the AST_VDauto_dial.pl scripts on both servers so they can restart and you can now look at the AST_timeonVDADall.php page(per campaign time-on-VDAD available from the STATS and REPORTS link on the vicidial admin screen) that will allo you to see the server_ip of the agent and the server_ip of the call per campaign across all campaigns. + +If you have any questions or problems please post to the astguiclient-users list(link available on the project website) + +7. For multi-server VICIDIAL/astGUIclient installations these cron scripts only need to be set up and run on one of the servers: +- AST_VDhopper.pl +- AST_cleanup_agent_log.pl +- ADMIN_adjust_GMTnow_on_leads.pl +- AST_DB_optimize.pl +- AST_VDadapt.pl +- AST_VDauto_dial_FILL.pl + +8. On all servers but one you should DELETE the following line from your extensions.conf: + ; prompt recording AGI script, ID is 4321 + exten => 8168,1,Answer + exten => 8168,2,AGI(agi-record_prompts.agi) + exten => 8168,3,Hangup +This should help to prevent overwriting of prompts that are copied over from the one server that is used to do prompt creation. + + + + + +THREE VICIDIAL SERVER LOAD BALANCING SETUP: + +The only steps that are different as you add more load-balanced servers are steps 2 and 3: + +3. The three servers need to be registered to each other as IAX2 friends: + SERVER ONE(ASTtest1-10.10.10.15) + iax.conf: + register => ASTtest1:test@10.10.10.16 + register => ASTtest1:test@10.10.10.17 + + [ASTtest2] + type=friend + accountcode=IAXtrunk2 + context=default + auth=plaintext + host=dynamic + permit=0.0.0.0/0.0.0.0 + secret=test + qualify=yes + + [ASTtest3] + type=friend + accountcode=IAXtrunk3 + context=default + auth=plaintext + host=dynamic + permit=0.0.0.0/0.0.0.0 + secret=test + qualify=yes + + SERVER TWO(ASTtest2-10.10.10.16) + iax.conf: + register => ASTtest2:test@10.10.10.15 + register => ASTtest2:test@10.10.10.17 + + [ASTtest1] + type=friend + accountcode=IAXtrunk1 + context=default + auth=plaintext + host=dynamic + permit=0.0.0.0/0.0.0.0 + secret=test + qualify=yes + + [ASTtest3] + type=friend + accountcode=IAXtrunk3 + context=default + auth=plaintext + host=dynamic + permit=0.0.0.0/0.0.0.0 + secret=test + qualify=yes + + SERVER THREE(ASTtest3-10.10.10.17) + iax.conf: + register => ASTtest3:test@10.10.10.15 + register => ASTtest3:test@10.10.10.16 + + [ASTtest1] + type=friend + accountcode=IAXtrunk1 + context=default + auth=plaintext + host=dynamic + permit=0.0.0.0/0.0.0.0 + secret=test + qualify=yes + + [ASTtest2] + type=friend + accountcode=IAXtrunk2 + context=default + auth=plaintext + host=dynamic + permit=0.0.0.0/0.0.0.0 + secret=test + qualify=yes + + +4. The three servers need to have wildcard extensions assigned to the other server in the dialplan: + SERVER ONE(ASTtest1-10.10.10.15) + extensions.conf: + [globals] + TRUNKIAX2=IAX2/ASTtest1:test@10.10.10.16 + TRUNKIAX3=IAX2/ASTtest1:test@10.10.10.17 + + [default] + exten => _010*010*010*015*8600XXX,1,Goto(default,${EXTEN:16},1) + exten => _010*010*010*016*8600XXX,1,Dial(${TRUNKIAX2}/${EXTEN:16},55,o) + exten => _010*010*010*017*8600XXX,1,Dial(${TRUNKIAX3}/${EXTEN:16},55,o) + exten => _010*010*010*015*78600XXX,1,Goto(default,${EXTEN:16},1) + exten => _010*010*010*016*78600XXX,1,Dial(${TRUNKIAX2}/${EXTEN:16},55,o) + exten => _010*010*010*017*78600XXX,1,Dial(${TRUNKIAX3}/${EXTEN:16},55,o) + + exten => _010*010*010*015*8600XXX*.,1,AGI(agi-VDADfixCXFER.agi) + exten => _010*010*010*016*8600XXX*.,1,Dial(${TRUNKIAX2}/${EXTEN:16},55,o) + exten => _010*010*010*017*8600XXX*.,1,Dial(${TRUNKIAX3}/${EXTEN:16},55,o) + exten => _8600XXX*.,1,AGI(agi-VDADfixCXFER.agi) + exten => _010*010*010*015*78600XXX*.,1,AGI(agi-VDADfixCXFER.agi) + exten => _010*010*010*016*78600XXX*.,1,Dial(${TRUNKIAX2}/${EXTEN:16},55,o) + exten => _010*010*010*017*78600XXX*.,1,Dial(${TRUNKIAX3}/${EXTEN:16},55,o) + exten => _78600XXX*.,1,AGI(agi-VDADfixCXFER.agi) + + SERVER TWO(ASTtest2-10.10.10.16) + extensions.conf: + [globals] + TRUNKIAX1=IAX2/ASTtest2:test@10.10.10.15 + TRUNKIAX3=IAX2/ASTtest2:test@10.10.10.17 + + [default] + exten => _010*010*010*015*8600XXX,1,Dial(${TRUNKIAX1}/${EXTEN:16},55,o) + exten => _010*010*010*016*8600XXX,1,Goto(default,${EXTEN:16},1) + exten => _010*010*010*017*8600XXX,1,Dial(${TRUNKIAX3}/${EXTEN:16},55,o) + exten => _010*010*010*015*78600XXX,1,Dial(${TRUNKIAX1}/${EXTEN:16},55,o) + exten => _010*010*010*016*78600XXX,1,Goto(default,${EXTEN:16},1) + exten => _010*010*010*017*78600XXX,1,Dial(${TRUNKIAX3}/${EXTEN:16},55,o) + + exten => _010*010*010*015*8600XXX*.,1,Dial(${TRUNKIAX1}/${EXTEN:16},55,o) + exten => _010*010*010*016*8600XXX*.,1,Goto(default,${EXTEN:16},1) + exten => _010*010*010*017*8600XXX*.,1,Dial(${TRUNKIAX3}/${EXTEN:16},55,o) + exten => _8600XXX*.,1,AGI(agi-VDADfixCXFER.agi) + exten => _010*010*010*015*78600XXX*.,1,Dial(${TRUNKIAX1}/${EXTEN:16},55,o) + exten => _010*010*010*016*78600XXX*.,1,Goto(default,${EXTEN:16},1) + exten => _010*010*010*017*78600XXX*.,1,Dial(${TRUNKIAX3}/${EXTEN:16},55,o) + exten => _78600XXX*.,1,AGI(agi-VDADfixCXFER.agi) + + SERVER THREE(ASTtest3-10.10.10.17) + extensions.conf: + [globals] + TRUNKIAX1=IAX2/ASTtest2:test@10.10.10.15 + TRUNKIAX2=IAX2/ASTtest2:test@10.10.10.16 + + [default] + exten => _010*010*010*015*8600XXX,1,Dial(${TRUNKIAX1}/${EXTEN:16},55,o) + exten => _010*010*010*016*8600XXX,1,Dial(${TRUNKIAX2}/${EXTEN:16},55,o) + exten => _010*010*010*017*8600XXX,1,Goto(default,${EXTEN:16},1) + exten => _010*010*010*015*78600XXX,1,Dial(${TRUNKIAX1}/${EXTEN:16},55,o) + exten => _010*010*010*016*78600XXX,1,Dial(${TRUNKIAX2}/${EXTEN:16},55,o) + exten => _010*010*010*017*78600XXX,1,Goto(default,${EXTEN:16},1) + + exten => _010*010*010*015*78600XXX*.,1,Dial(${TRUNKIAX1}/${EXTEN:16},55,o) + exten => _010*010*010*016*78600XXX*.,1,Dial(${TRUNKIAX2}/${EXTEN:16},55,o) + exten => _010*010*010*017*78600XXX*.,1,Goto(default,${EXTEN:16},1) + exten => _78600XXX*.,1,AGI(agi-VDADfixCXFER.agi) diff --git a/agc_2-X/branches/agc_2.0.4/docs/OUTBOUND_LIST_ORDERING.txt b/agc_2-X/branches/agc_2.0.4/docs/OUTBOUND_LIST_ORDERING.txt new file mode 100644 index 00000000..4c74307d --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/OUTBOUND_LIST_ORDERING.txt @@ -0,0 +1,48 @@ +OUTBOUND LIST ORDERING AND MIXING 2007-05-16 + +** THIS NEW OPTIONAL LIST ORDERING FEATURE IS PLANNED FOR THE 2.0.4 RELEASE ** + +This document will outline the new optional feature within VICIDIAL outbound dialing that will allow for both list ordering and mixing while dialing outbound vicidial campaigns. + + + +The Agent Side: +Nothing changes + + + +The Admin Side: +The lists used in a VICIDIAL campaign will be moved to a different tab in the Campaign Modification screen to allow for easier quick modification of the lists used and their order and mixing percentage. Also, a new field will be added to vicidial_campaigns table and a new vicidial_campaigns_list_mix table will be created to store the information for list ordering and mixing: + +ALTER TABLE vicidial_campaigns ADD list_order_mix VARCHAR(20) default 'DISABLED'; + + CREATE TABLE vicidial_campaigns_list_mix ( +vcl_id VARCHAR(20) PRIMARY KEY NOT NULL, +vcl_name VARCHAR(50), +campaign_id VARCHAR(8), +list_mix_container TEXT, +mix_method ENUM('EVEN_MIX','IN_ORDER','RANDOM') default 'EVEN_MIX', +status ENUM('ACTIVE','INACTIVE') default 'INACTIVE', +index (campaign_id) +); + +The list_mix field would be a container for the following parameters: +list_id|order|percent|statuses|:list_id|order|percent|statuses|:... +for example: +101|1|40| A B NA -|:102|2|25| NEW -|:103|3|30| DROP CALLBK -|:101|4|5| DROP -| +The percentages always have to add up to 100, and the lists all have to be active and set to the campaign for the order mix entry to be Activated. + +campaign hopper_level must be at least 100 when in list-mix-mode + +No more than 10 lists can be in a single list mix record + +List orders with "2nd NEW, 3rd NEW and 4th NEW" are ignored, and only DOWN COUNT is used + + + +The Server Side: +The AST_VDhopper.pl script will need to be changed to use the new order mix to grab and order the leads for a campaign. This will involve checking if the list_order_mix is set to DISABLED or not, and if it is then it will proceed as it currently does. If it does not, it will grab the vicidial_campaigns_list_mix record that matches the list_order_mix and parse through it's lists. Then it will do a SELECT for each of the lists and mix all of the leads together using the proper mix_method. + + + +MORE TO COME... diff --git a/agc_2-X/branches/agc_2.0.4/docs/PERFORMANCE_TESTING.txt b/agc_2-X/branches/agc_2.0.4/docs/PERFORMANCE_TESTING.txt new file mode 100644 index 00000000..9aec88fb --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/PERFORMANCE_TESTING.txt @@ -0,0 +1,107 @@ +PERFORMANCE TESTING OF A VICIDIAL SERVER 2006-10-12 + + +OVERVIEW: + +This document goes over the setup of a VICIDIAL/Asterisk server that you are testing, and the control Asterisk server that will be taking the calls from the serer being tested. + +It is very difficult to realistically performance test a VICIDIAL server not in production because of the randomness of call center operations. + +How this process works is that multiple remote agents are activated and calls are placed from the server being tested to a control server that will take those calls and send various signals and play various audio files so that the randomness of outbound dialing is simulated. + +The test server and the control server(s) need to be connected through either crossover T1 cables, SIP trunks or IAX trunks. + +It is important that there are no live VICIDIAL agents or calls happening on this server when performance testing is enabled. + +If you want pretty server performance graphics you need to make sure the server record has performance logging enabled. + + +EXAMPLE TESTING SCENARIO: + +For this test below we will be placing calls out over crossover T1 cables to other Asterisk servers and we will be attempting to simulate agents logging in over SIP phones to meetme rooms on the test server. The agent connections will actually be a six(6) hour loop of on-hold-music to simulate voice(the conf.gsm file). This will be on one of the control servers so simulate true SIP phone agent connections to meetme rooms on the test server. + +When setting up the remote agents record we will use 999999999999(twelve nines) as the dialplan number. This is a special flag in the remote agents handling script that will give a different session_id to each remote agent and will place a call from each of those sessions(meetme rooms) to the 999999999999 extension that should be setup to call the on-hold-music on the control server over SIP trunk. + +We will also be using a special list of phone numbers to call so that we are sure that we do not place any real phone calls. The special list is available in the extras directory and is called: performance_test_leads.txt + +In the control server you will need the following in your extensions.conf: + +exten => _999XXXXXX1,1,Answer +exten => _999XXXXXX1,2,Wait(2) +exten => _999XXXXXX1,3,Playback(beep) +exten => _999XXXXXX1,4,Hangup + +exten => _999XXXX112,1,Wait(8) +exten => _999XXXX112,2,Answer +exten => _999XXXX112,3,Playback(demo-instruct) +exten => _999XXXX112,4,Playback(demo-instruct) +exten => _999XXXX112,5,Hangup + +exten => _999XXXXXX2,1,Wait(8) +exten => _999XXXXXX2,2,Answer +exten => _999XXXXXX2,3,Playback(demo-instruct) +exten => _999XXXXXX2,4,Hangup + +exten => _999XXXXXX3,1,SetVar(PRI_CAUSE=1) +exten => _999XXXXXX3,2,Hangup + +exten => _999XXXXXX4,1,SetVar(PRI_CAUSE=27) +exten => _999XXXXXX4,2,Hangup + +exten => _999XXXXXX5,1,Wait(60) +exten => _999XXXXXX5,2,Hangup + +exten => _999XXXXXX6,1,Wait(10) +exten => _999XXXXXX6,2,Answer +exten => _999XXXXXX6,3,Playback(demo-instruct) +exten => _999XXXXXX6,4,Hangup + +exten => _999XXXXXX7,1,Wait(12) +exten => _999XXXXXX7,2,Answer +exten => _999XXXXXX7,3,Playback(demo-enterkeywords) +exten => _999XXXXXX7,4,Hangup + +exten => _999XXXXXX8,1,SetVar(PRI_CAUSE=17) +exten => _999XXXXXX8,2,Hangup + +exten => _999XXXXXX9,1,Wait(6) +exten => _999XXXXXX9,2,Answer +exten => _999XXXXXX9,3,Playback(demo-abouttotry) +exten => _999XXXXXX9,4,Hangup + +exten => _999XXXXXX0,1,Wait(5) +exten => _999XXXXXX0,2,Answer +exten => _999XXXXXX0,3,Playback(vm-goodbye) +exten => _999XXXXXX0,4,Hangup + +exten => 999999999999,1,Answer +exten => 999999999999,2,Playback(conf) +exten => 999999999999,3,Playback(conf) +exten => 999999999999,4,Playback(conf) +exten => 999999999999,5,Playback(conf) +exten => 999999999999,6,Playback(conf) +exten => 999999999999,7,Playback(conf) +exten => 999999999999,8,Playback(conf) +exten => 999999999999,9,Playback(conf) +exten => 999999999999,10,Playback(conf) +exten => 999999999999,11,Playback(conf) +exten => 999999999999,12,Playback(conf) +exten => 999999999999,13,Playback(conf) +exten => 999999999999,14,Hangup + + +In the test server you will need the following in your extensions.conf: + +[globals] +TESTTRUNK = Zap/g2 +TESTSIPTRUNK = SIP/VICItest:test@10.10.10.16:5060 + +[default] +;exten => _91999NXXXXXX,1,AGI(call_log.agi) +exten => _91999NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +exten => _91999NXXXXXX,2,Dial(${TESTTRUNK}/${EXTEN:2},,tTo) +exten => _91999NXXXXXX,3,Hangup + +exten => 999999999999,1,Answer +exten => 999999999999,2,Dial(${TESTSIPTRUNK}/${EXTEN},,tTo) +exten => 999999999999,2,Hangup diff --git a/agc_2-X/branches/agc_2.0.4/docs/PREDICTIVE.txt b/agc_2-X/branches/agc_2.0.4/docs/PREDICTIVE.txt new file mode 100644 index 00000000..6eadcb23 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/PREDICTIVE.txt @@ -0,0 +1,132 @@ +PREDICTIVE Summary and Overview 2006-08-29 + +*** PREDICTIVE OUTBOUND CALLING FUNCTIONALITY WAS ADDED IN THE 2.0.1 RELEASE *** + +This will outline the methods used to predictively dial outbound calling +campaigns in VICIDIAL with the ADAPT dial methods. This is a description of the +first versions of the Predictive/Adaptive dialing algorithms used in VICIDIAL. +As the need arises we will create more versions of different algorithms in the +future. + + +The gathering of data to analyze: + +In order to properly analyze calling trends and adapt to the current list that +is being called we need to first gather a lot of data to analyze. + +The first set of data we want to gather is the recent queue and agent statistics +for each campaign. This information is gathered by the AST_VDauto_dial.pl script +as it runs through each loop every 2.5-3.0 seconds. This data is used only for +Blended CLOSER campaigns doing Predictive dialing and for the timeonVDADall +realtime campaign reports. The data gathered in this script are all averages of +the last 15 and 60 seconds of agent and queue activity: + 1. The average number of agents that are logged into the campaign across +one minute + 2. The average number of calls waiting to be transferred to an agent +across one minute + 3. The average number of agents waiting for calls across one minute + 4. The difference between the waiting calls and ready agents across one +minute + This number if positive means that on average more agents were +waiting for calls than calls waiting for agents in the last +minute for that campaign. + +The second set of data to gather is dropped call information across several +intervals as well as faster agent and queue call statistics. This information +will be gathered by the actual AST_VDadapt.pl script that will also be the +script actually changing the dial level when the predictive/adaptive dial method +is activated. +Once a second this script will gather: + 1. The average number of agents that are logged into the campaign for +the last 15 seconds + 2. The average number of calls waiting to be transferred to an agent for +the last 15 seconds + 3. The average number of agents waiting for calls for the last 15 +seconds + 4. The difference between the waiting calls and ready agents for the +last 15 seconds +Once every 15 seconds this script will: + 1. Calculate the average dial level differential for the last 15 seconds + 2. Apply the campaign's adaptive_dl_diff_target + 3. Apply the campaign's adaptive_intensity setting + 4. Calculate the new desired dial_level + 5. Check the drop rate cap method(HARD_LIMIT, TAPERED, AVERAGE) + 6. If drop rate is over the limit the proper equation is used to figure +out new dial_level difference. + 7. Change the dial level for the campaign to the new suggested dial +level +Once a minute this script will gather: + 1. Total drops and total calls for the campaign since midnight + 2. Total drops and total calls for the campaign in the past hour + 3. Total drops and total calls for the campaign in the past half hour + 4. Total drops and total calls for the campaign in the past five minutes + 5. Total drops and total calls for the campaign in the past one minute + Also, the drop percentage is calculated and stored in the +vicidial_campaign_stats table. + + +The settings in the campaign detail screen: + +Dial Method - This field is the way to define how dialing is to take place. If +MANUAL then the auto_dial_level will be locked at 0 unless Dial Method is +changed. If RATIO then the normal dialing a number of lines for Active agents. +ADAPT_HARD_LIMIT will dial predictively up to the dropped percentage and then +not allow aggressive dialing once the drop limit is reached until the percentage +goes down again. ADAPT_TAPERED allows for running over the dropped percentage in +the first half of the shift(as defined by call_time selected for campaign) and +gets more strict as the shift goes on. ADAPT_AVERAGE tries to maintain an +average or the dropped percentage not imposing hard limits as aggressively as +the other two methods. + +Auto Dial Level - This is where you set how many lines VICIDIAL should use per +active agent. zero 0 means auto dialing is off and the agents will click to dial +each number. Otherwise VICIDIAL will keep dialing lines equal to active agents +multiplied by the dial level to arrive at how many lines this campaign on each +server should allow. + +Available Only Tally - This field if set to Y will leave out INCALL and QUEUE +status agents when calculating the number of calls to dial when not in MANUAL +dial mode. Default is N. + +Drop Percentage Limit - This field is where you set the limit of the percentage +of dropped calls you would like while using an adaptive-predictive dial method, +not MANUAL or RATIO. Dropped calls percentage is measured out of the total +number of Answered calls for the campaign for the day. + +Maximum Adapt Dial Level - This field is where you set the limit of the limit to +the numbr of lines you would like dialed per agent while using an +adaptive-predictive dial method, not MANUAL or RATIO. This number can be higher +than the Auto Dial Level if your hardware will support it. Value must be a +positive number greater than one and can have decimal places Default 3.0. + +Latest Server Time - This field is only used by the ADAPT_TAPERED dial method. +You should enter in the hour and minute that you will stop calling on this +campaign, 2100 would mean that you will stop dialing this campaign at 9PM server +time. This allows the Tapered algorithm to decide how aggressively to dial by +how long you have until you will be finished calling. + +Adapt Intensity Modifier - This field is used to adjust the predictive intensity +either higher or lower. The higher a positive number you select, the greater the +dialer will increase the call pacing when it goes up and the slower the dialer +will decrease the call pacing when it goes down. The lower the negative number +you select here, the slower the dialer will increase the call pacing and the +faster the dialer will lower the call pacing when it goes down. Default is 0. +This field is not used by the MANUAL or RATIO dial methods. + +Dial Level Difference Target - This field is used to define whether you want to +target having a specific number of agents waiting for calls or calls waiting for +agents. For example if you would always like to have on average one agent free +to take calls immediately you would set this to -1, if you would like to target +always having one call on hold waiting for an agent you would set this to 1. +Default is 0. This field is not used by the MANUAL or RATIO dial methods. + + + +To use adaptive dialing you must have the ADMIN keepaliveAST_VDadapt.pl script +in your crontab running every minute: +### keepalive script for VICIDIAL predictive script +* * * * * /usr/share/astguiclient/ADMIN_keepalive_AST_VDadapt.pl + + +NOTE: With Predictive dialing, the dial_level will never drop below 1.0. + diff --git a/agc_2-X/branches/agc_2.0.4/docs/QUEUEMETRICS.txt b/agc_2-X/branches/agc_2.0.4/docs/QUEUEMETRICS.txt new file mode 100644 index 00000000..24524276 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/QUEUEMETRICS.txt @@ -0,0 +1,180 @@ +VICIDIAL and QueueMetrics + +queue_log logging was added to VICIDIAL outbound calling as an option in the 2.0.3 release tree. + +This document goes over the features and needed changes made to VICIDIAL to enable it to insert activity records into the queue_log and other tables in MySQL that QueueMetrics uses for it's statistical analysis and reports. This document should not be taken as a HOWTO for proper installation steps to get QueueMetrics working. + +QueueMetrics is a closed-source, commercial product written by Loway Research in Italy. The writers of VICIDIAL do not support or warranty QueueMetrics or it's functionality with VICIDIAL in any way. + +This feature was added to the package at the request of several users of VICIDIAL and was achieved with some help from the makers of QueueMetrics(although all VICIDIAL code changes were done entirely by Matt Florell). + +This feature is currently only functional on outbound dialing. + + + +Here is a short summary of the needed steps to install QueueMetrics on your system: + +First, get Sun Java SDK/JRE and install on your system. +NOTE: the GCJ java JRE available on most RedHat/Feroda/CentOS systems WILL NOT WORK + +download and install the Java jdk-1_5_0_11-linux-i586-rpm.bin from: +http://www.sun.com/software/communitysource/j2se/java2/index.xml + + +cd /usr/local +chmod 0777 jdk-1_5_0_11-linux-i586-rpm.bin +./jdk-1_5_0_11-linux-i586-rpm.bin +ls -l +rpm -i jdk-1_5_0_11-linux-i586.rpm +wget http://www.mirrorgeek.com/apache.org/tomcat/tomcat-5/v5.5.20/bin/apache-tomcat-5.5.20.tar.gz +gunzip apache-tomcat-5.5.20.tar.gz +tar xvf apache-tomcat-5.5.20.tar +ln -s apache-tomcat-5.5.20 tomcat +cd apache-tomcat-5.5.20 + +JAVA_HOME=/usr/java/jdk1.5.0_11/ +JAVA_OPTS="-Xms256M -Xmx512M" +JRE_HOME=/usr/java/jdk1.5.0_11/jre + +or + +JRE_HOME=/usr/java/jre1.6.0/ +JAVA_HOME=/usr/java/ +JAVA_OPTS="-Xms256M -Xmx512M" + +export JAVA_HOME +export JAVA_OPTS +export JRE_HOME +/usr/local/tomcat/bin/startup.sh + +At this point you should go here on your web browser to see if the tomcat installation went well: +http://ip-address:8080/ + +If it did, then you want to add the following lines to your /etc/rc.d/rc.local file so that tomcat will start up on boot: + JAVA_HOME=/usr/java/jdk1.5.0_11/ + JAVA_OPTS="-Xms256M -Xmx512M" + JRE_HOME=/usr/java/jdk1.5.0_11/jre + export JAVA_HOME + export JAVA_OPTS + export JRE_HOME + /usr/local/tomcat/bin/startup.sh + + + +cd /usr/local +*** download QueueMetrics and place it in /usr/local *** +gunzip QueueMetrics-1.1.tar.gz +tar xvf QueueMetrics-1.1.tar +mv queuemetrics-1.1 /usr/local/tomcat/webapps/qm +cd /usr/local/tomcat/webapps/qm/WEB_INF +wget http://mysql.mirrors.pair.com/Downloads/Connector-J/mysql-connector-java-3.0.10-stable.tar.gz +gunzip mysql-connector-java-3.0.10-stable.tar.gz +tar xvf mysql-connector-java-3.0.10-stable.tar +cp mysql-connector-java-3.0.10-stable/mysql-connector-java-3.0.10-stable-bin.jar ./lib/ + +At this point you should go here on your web browser to see if the tomcat installation went well: +http://ip-address:8080/qm + +If you see a QueueMetrics page(probably with many errors), then installation went well up to this point. + +You now need to add the database tables, configure the web.xml file and configuration.properties file for your system. + + + + + +Now to the database side of things. +First, give permissions to your user: + +GRANT ALL PRIVILEGES ON queuemetrics.* TO qm@'localhost' IDENTIFIED BY 'qm'; +GRANT ALL PRIVILEGES ON queuemetrics.* TO qm@'%' IDENTIFIED BY 'qm'; + +Second, the queue_log table: + +mysql> describe queue_log; ++-----------+------------------+------+-----+---------+-------+ +| Field | Type | Null | Key | Default | Extra | ++-----------+------------------+------+-----+---------+-------+ +| partition | char(20) | NO | MUL | | | +| time_id | int(11) unsigned | NO | MUL | 0 | | +| call_id | char(30) | NO | MUL | | | +| queue | char(30) | NO | | | | +| agent | char(30) | NO | | | | +| verb | char(30) | NO | | | | +| data1 | char(30) | NO | | | | +| data2 | char(30) | NO | | | | +| data3 | char(30) | NO | | | | +| data4 | char(30) | NO | | | | +| serverid | varchar(10) | NO | | 0 | | ++-----------+------------------+------+-----+---------+-------+ + +partition: set to "P01" for the first partition, should match up with configuration.properties presets + +time_id: epoch, unixtime (seconds since 1970-01-01 00:00:00) [1170345603] + +call_id: Asterisk unique prepended with server_id field [1-1170345497.30369] + For VICIDIAL we will use the CallerIDname of the call to + +queue: the queue that call came into (we will use the campaign_id here) + +agent: we will use the user ID prepended by "agent/" [agent/6666] + +verbs: + +system actions - used by the AST_VDadapt.pl script when starting up + QUEUESTART + +agent actions - used by vicidial.php, vdc_db_query.php and AST_VDremote_agents.pl + AGENTLOGIN(channel) + AGENTLOGOFF(channel|logintime) + PAUSEALL + PAUSE + UNPAUSEALL + UNPAUSE + PAUSEREASON + +call actions before going to agent - used by agi-VDADtransfer scripts + ENTERQUEUE(url|callerid) + CONNECT(holdtime) + EXITWITHTIMEOUT(position) + +call actions before going to agent - used by AST_VDauto_dial.pl + ABANDON(position|origposition|waittime) + +call actions after going to agent - used by vicidial.php, vdc_db_query.php and FastAGI_log.pl + COMPLETEAGENT(holdtime|calltime|origposition) + COMPLETECALLER(holdtime|calltime|origposition) + CALLSTATUS(status) + + +not used in vicidial - + TRANSFER(extension,context) + + + + +data1: call termination codes, TBD + +data2: callerID or number called(sometimes prepended by DNIS) [3101-9015556189] + NOTE: the queuemetrics_eq_prepend field allows you to specify what + vicidial_list field you would like to prefend to the phone number on + ENTERQUEUE events + +data3: ?? + +data4: ?? + +serverid: number of the server the call came from [for VICIDIAL use the system_settings.queuemetrics_log_id field] + + + + +On the vicidial side of things, we will add the following columns to the system_settings table: +enable_queuemetrics_logging ENUM('0','1') default '0', +queuemetrics_server_ip VARCHAR(15), +queuemetrics_dbname VARCHAR(50), +queuemetrics_login VARCHAR(50), +queuemetrics_pass VARCHAR(50), +queuemetrics_url VARCHAR(255), +queuemetrics_log_id VARCHAR(10) default 'VIC' +queuemetrics_eq_prepend VARCHAR(255) default 'NONE' diff --git a/agc_2-X/branches/agc_2.0.4/docs/README.txt b/agc_2-X/branches/agc_2.0.4/docs/README.txt new file mode 100644 index 00000000..41119f30 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/README.txt @@ -0,0 +1,583 @@ ++------------------------------------------------------------------------------+ +| Asterisk GUI client - astguiclient - twenty-ninth public release 2.0.4 | +| created by astGUIclient group | +| project started 2003-10-06 http://sourceforge.net/projects/astguiclient/ | ++------------------------------------------------------------------------------+ + +This suite of programs is designed to work with the Asterisk Open-source PBX +(http://www.asterisk.org) as a cross-platform GUI client and the supporting +server side applications necessary for the features of the GUI application to +work with Asterisk. The client-side GUI apps are available as web pages running +AJAX scripted web pages(Firefox recommended) + +End-user Manuals for Agents and Managers are available from http://www.eflo.net + + ***** Description, Notes and Changelog below ***** + +Included in this distribution of the Asterisk GUI client are: +- agi/ - the Asterisk agi-bin files needed for astguiclient +- bin/ - the astGUIclient server-side perl script applications +- docs/ - astGUIclient installation and other documentation +- docs/conf_examples/ - example Asterisk conf files for astGUIclient +- extras/ - data files, sql files and other extra files needed for astGUIclient +- LANG_www/ - astGUIclient admin and user web pages translated into other languages +- sounds/ - Asterisk sounds needed by astGUIclient +- translations/ - UTF8 language translation files for other language versions +- www/ - the pages and scripts of the user and admin astGUIclient web interface + + +DESCRIPTION: +This program was designed as a GUI client for the Asterisk PBX with Zaptel +trunks or IAX or SIP VOIP trunks and SIP/IAX/Zap hard or softphones or devices +as extensions, it could be adapted to other functions, but it was designed for +Zap/IAX/SIP users. The client programs are web-based and will run on most +modern web browsers. + + +TO BE ADDED: +See the TODO page on the project Wiki for more info on what has been finished in +this version as well as what we're thinking of working on. The items marked HIGH +priority in the TODO file are the ones we expect to have finished for the next +release. If you have suggestions please send them. +http://www.eflo.net/VICIDIALwiki/index.php/TODO:current + + +NOTES: +There are several features/processes that could have been done many different +ways in this suite, one for example is call parking. After tinkering with +Asterisk/AGI-only call parking where all of the call parking would be achieved +with no need for a GUI client, I discovered that my implementation did not +function well on all single line phones or the Grandstream phones. I settled on +the current method of call-parking by creating a record in a table for a call +parked and Redirecting the call to a constant music extension to take any phone +button pressing out of the loop. We haven't had any problems since we switched +to this method of call parking. Many of the other decisions of how to program +features in this suite we arrived at through similar trial-and-error methods. If +anyone has suggestions/praises/criticisms I would love to hear them. + + +KNOWN BUGS: +- the astGUIclient web client exposes a nasty memory leak in Internet Explorer, + Firefox does not have the same problem so we recommend it instead. +- on astGUIclient you cannot record a native bridge VOIP-only conversation + unless you go into a conference, you also cannot monitor a native-bridge + VOIP-only conversation +- Depending on what version of perl you are running(for the Perl scripts only), + you may have a conflicting version of the Time::HiRes perl module installed. + To fix this, jut go to http://search.cpan.org/~jhi/Time-HiRes-1.82/ and + download the version that your error message says it's looking for(HiRes.pm). + + +VERSION HISTORY: + +0.7 - First public release - 2003-11-18 +This is the first release of the Asterisk GUI Client code, it is entirely +written in Perl with portability and rapid development/testing in mind. The perl +code is NOT strict, it was written loose and fast and has been functioning +rather well in a production environment of 60 clients for one month now. + +0.8 - Second public release - 2003-12-09 +- Several bug fixes +- New button for monitoring live extensions on Zap channels +- Changed the method that the live channels/phone were populated on the +listboxes of the client app. +- Changed the Asterisk/Manager commands to work correctly with new Asterisk CVS +versions requirements. +- A new routine was enabled to allow for making sure that the updater is +running and bringing up a popup alert window on the client if the updater has +not updated in the last 6 seconds. (this also added a new MySQL table) +- Changed the updater to run every 450 milliseconds instead of every 333 +milliseconds. +- Updater changed to allow for ringing channels to appear in the live_channels +table. + +0.9 - Third public release - 2004-02-05 +The majority of the work in this release it to make it more stable and fix some +pretty bad bugs. We created the Asterisk Central Queue System to address the +problem with buffer-overflows in the manager interface of Asterisk causing total +system deadlocks. We also completed and touched-up many other features that we +didn't finish in previous releases. Here is the list of changes: +- Several bug fixes +- Inclusion of listing for active SIP/Local channels and ability to hang them up +- Completely changed the method of conferencing to be more fluid +- Added HELP popup screen +- Added intrasystem calling funtionality +- Updater changed to allow for SIP/Local channels +- Recording for conferences is now able to record all audio in and out +- Added ability to send DTMF tones within a conference +- Changed alert window for updater being down timeout to 20 seconds +- Added an option for using the new Asterisk Central Queue System(ACQS) that +reduces the risk of deadlocks that occur with buffer-overflows on remote manager +interface connections +- Included new script to run at boot time and rotate the logs as well as a +keepalive script for the new ACQS +- Changed non-AGI server-side scripts to allow for a single config file +- Detailed activity logging to text file option added +- Activity logging added to all non-AGI server applications + +0.9.2 - Fourth public release - 2004-03-08 +- several bug fixes for the GUI client and ACQS applications +- addition of the new VICIDIAL auto-dialer application and admin web pages +- added new script to reset MySQL tables +- added new script to kill CONGEST Local/ channels + +0.9.4 - Fifth public release - 2004-03-12 +- a few bug fixes for the GUI and server apps +- addition of callerID popup for the GUI +- callerID buttons to launch web pages from callerID popup +- addition of voicemail count display to GUI +- addition of button to directly connect to voicemail +- addition of voicemail counter updater +- MySQL table "phones" modified and "inbound" table added(see CONF_MySQL.txt) +- new extensions.conf entries need to be added to use callerid and vmail GUI + +1.0.0 - Sixth public release - 2004-03-26 +- a few bug fixes for the GUI and server apps +- Major documentation changes with the addition of the SCRATCH_INSTALL.txt file +that goes step-by-step through the entire install process of an asterisk server +from blank hardware to astguiclient installation and configuration. +- added pretty buttons to the WINphoneAPP +- added blind transfer to voicemail, blind transfer to another extension and +blind external transfer +- new install script created to put server files in default positions and set +permissions to execute +- new sql file to create all tables by running a script execute command in MySQL + +1.0.1 - Seventh public release - 2004-04-27 +- a few bug fixes for the GUI and server apps +- minor changes to WINphoneAPP +- major changes to VICIDIAL client code: + + rearranged VICIDIAL buttons and added some color to DIAL and HANGUP buttons + + allowed for call parking with different park music per-campaign + + allowed for webpage forms launched from GUI with call info + + allowed for different web form web page per-campaign + + allowed agents using VICIDIAL client to send calls with data to a closer + + new call-closer functionality is web-based for flexibility + + added new DTMF dialpad for sending tones quickly +- fixed bugs in VICIDIAL web admin pages +- fixed bugs in ASTGUICLIENT web admin pages +- added code from Paul Concepcion to allow admin pages to work with globals off +- added common database connection file for each set of PHP admin pages +- made small changes to the MySQL database Schema + (NOTE: if upgrading from 1.0.0 run the upgrade_1.0.1.sql script in MySQL) + +1.0.2 - Eighth public release - 2004-06-03 +- a few bug fixes for the GUI apps +- corrected documentation errors in SCRATCH_INSTALL instructions +- updated SCRATCH_INSTALL instructions for some newer software +- corrected errors in SQL install queries +- corrected errors in server installation scripts +- WINphoneAPP config option to allow one persistant mysql DB connection +- WINphoneAPP config option to allow modification of info refresh interval +- VICIDIAL modified to allow for auto-dial of next number + (NOTE: if upgrading from 1.0.1 you do not need to update any web pages or + server apps, this update is only a client GUI and docs update. Note that the + AST_VICI_conf.pl has been updated, so you may need to modify your client + configs to enable new features.) + +1.0.3 - Ninth public release - 2004-07-21 +- a few bug fixes for the GUI apps +- changed the recording to show recording ID when recording is started +- VICIDIAL overhauled: + + added Time::HiRes module requirement to better control time increments + + changed to dial from a small hopper of pre-ordered leads per campaign + + added cron script to always keep leads in the hopper every minute + + added a counter to see how many times a lead is called + + added ability to dial campaign by how many times lead called + + added some new stats to the admin web pages + + created a limited predictive-dialer that will dial a certain amount of leads + per logged in agent and direct the calls that are picked up to the next agent + + ability to transfer the called line and the 3rd party call into a separate + meetme room and continue on dialing + UPGRADE NOTES: + * if upgrading from 1.0.2 you need to update the web pages and all + server apps. + * if upgrading from 1.0.2 run the upgrade_1.0.3.sql script in MySQL + * if upgrading from 1.0.2 you may want to run AST_upgrade_1.0.3.pl to update + your called counts of your leads in vicidial_list. + * AST_SERVER_conf.pl has been updated, so you may need to modify your server + configs to enable new features. + * client app names have been changed to astVICIDIAL and astGUIclient + +1.0.4 - Tenth public release - 2004-09-21 +- several minor bug fixes for GUI apps and server apps +- fixed recording bug in astGUIclient that would rarely stop recording +- added timezone dialing in VICIDIAL +- added new client GUI app for inserting leads into the VICIDIAL leads table +- adjusted timings in the VICIDIAL autodialer for better performance +- added streamlined manager interface logins to help scripts run more smoothly + UPGRADE NOTES: + * if upgrading from 1.0.3 you need to update the web pages and all + server apps. + * if upgrading from 1.0.3 run the upgrade_1.0.4.sql script in MySQL + * if upgrading from 1.0.3 you may want to run ADMIN_adjust_GMTnow_on_leads.pl + to update the timezone in the vicidial_list table + * AST_SERVER_conf.pl on the server has been updated, so you may need to modify + your server configs to enable new features(like timezone dialing). + * AST_VICI_conf.pl for clients has been updated, so you may need to modify + your client configs to enable new features(like timezone dialing). + * run this script if you plan on doing timezone restrictions on VICIDIAL: + ADMIN_area_code_populate.pl + +1.0.5 - Eleventh public release - 2004-10-28 +- many minor bug fixes in most of the server and client scripts +- fixed multiple login bug on VICIDIAL +- fixed the manual-dial/auto-dial switching bug on VICIDIAL +- fixed a few time zone calling bugs on VICIDIAL server apps +- all apps now allow for IAX trunks to be used in addition to the usual Zap +- added more options to install script +- changed CLI lead loader to use Net::MySQL instead of DBI +- modified several scripts that handle CallerID because of the early October + change in the CVS of outputting CID info as two separate fields(CallerID and + CallerIDname) instead of everything being sent in CallerID. +UPGRADE NOTES: + * if upgrading from 1.0.4 you need to update the web pages and all + server and client apps. + * if upgrading from 1.0.4 run the upgrade_1.0.5.sql script in MySQL + * if using a CVS version 2004-10-07 or newer or release 1.0.3 or newer + change the line in extensions.conf + exten => 8309,2,Monitor(wav,${CALLERIDNUM}) + change to + exten => 8309,2,Monitor(wav,${CALLERIDNAME}) + +1.0.6 - Twelfth public release - 2004-12-23 +- many minor bug fixes in most of the server and client scripts +- optimized the ACQS and restructured its keepalive scripts +- added hijack line feature to astGUIclient +- added inbound call handling for VICIDIAL +- added blended in-outbound calling within VICIDIAL +- added new closer stats report +- updated the SCRATCH_INSTALL instructions and corrected errors +- see the TODO.txt file for other items DONE in this release +UPGRADE NOTES: + * if upgrading from 1.0.5 you need to update the web pages and all + server and client apps. + * if upgrading from 1.0.5 run the upgrade_1.0.6.sql script in MySQL + * if upgrading from 1.0.5 add a campaign "CLOSER" to enable closers and + inbound call taking through the VICIDIAL application + (see the SCRATCH_INSTALL document SUBPHASE 6.2 for more information) + +1.1.0 - Thirteenth public release - 2005-03-09 +- several small bug fixes in most of the server and client scripts +- added IAX and Zap client/agent compatibility +- implemented some major database optimizations +- ability to specify MySQL port across all apps +- moved almost all client config variables from client files to the Database +- created a meetme room validator that will allow faster reassignment of conferences +- created a new remote_agent login system for VICIDIAL in/outbound calls +- restructuring of AST_update script to cope better with manager output hiccups +- added dial timeout field to VICIDIAL to specify the timeout per campaign +- added help popups to every page of the admin web pages to explain fields +- see the TODO.txt file for other items DONE in this release +UPGRADE NOTES: + * if upgrading from 1.0.6 you need to update the web pages and all + server and client apps. + * if upgrading from 1.0.6 run the upgrade_1.1.0.sql script in MySQL + * if upgrading from 1.0.6 you will need to configure your client parameters on + the admin web page and remove them from the client computers (except for the + fields that are in the sample AST_VICI_conf.pl file) + * older client apps are not compatible with this version, you must upgrade + +1.1.1 - Fourteenth public release - 2005-06-03 +- several small bug fixes in most of the server and client scripts +- added astGUIclient web-only client +- added campaign-custom disposition statuses to VICIDIAL +- added campaign-custom CallerID to VICIDIAL +- added fronter-display-disable option to VICIDIAL Inbound Groups +- added ability to separate vicidial users by groups +- added performance stats gathering ability to AST_update script +- fixed the send-to-vmail portion of inbound AGI scripts +- added simple web-based lead file loader for VICIDIAL +UPGRADE NOTES: + * if upgrading from 1.1.0 you need to update the web pages and all + server apps. + * if upgrading from 1.1.0 run the upgrade_1.1.1.sql script in MySQL + +1.1.2 - Fifteenth public release - 2005-06-06 +- fixed fatal bug in AST_update.pl script +- added instructions for ploticus install to SCRATCH_INSTALL +UPGRADE NOTES: + * if upgrading from 1.1.0 you need to: + - download the new version from the project website + - unzip the zip file into the astguiclientastguiclient directory + - and either: + + copy the web pages and all server apps to their proper locations manually + + or run the install_server_files.pl script to put all items in their + default places + * if upgrading from 1.1.0 run the upgrade_1.1.1.sql script in MySQL + (\. astguiclientastguiclient/upgrade_1.1.1.sql) + +1.1.3 - Sixteenth public release - 2005-06-10 +- fixed config bug in AST_VDauto_dial.pl script +- added null query result checks to scripts in the agc web-only client +- added documentation for the inbound and transfer AGI script variables +- added documentation and tested install with MySQL 4.1 tree (4.1.12) +UPGRADE NOTES: + * if upgrading from 1.1.0 - 1.1.2 you need to: + - download the new version from the project website + - unzip the zip file into the astguiclientastguiclient directory + - and either: + + copy the web pages and all server apps to their proper locations manually + + or run the install_server_files.pl script to put all items in their + default places + * if upgrading from 1.1.0 run the upgrade_1.1.1.sql script in MySQL + (\. astguiclientastguiclient/upgrade_1.1.1.sql) + +1.1.4 - Seventeenth public release - 2005-06-24 +- fixed new Local channel bugs caused by changes in Asterisk 1.0.8 and CVS +- added beta support for SIP trunks +- added ability to send VICIDIAL outbound calls to custom AGI script per + campaign and included new survey sample AGI script +- added better Asterisk shutdown detection to AST_manager_listen script +UPGRADE NOTES: + * if upgrading from 1.1.3 you need to: + - download the new version from the project website + - unzip the zip file into the astguiclientastguiclient directory + - and either: + + copy the web pages and all server apps to their proper locations manually + + or run the install_server_files.pl script to put all items in their + default places + - if using VICIDIAL download the new client script to all client stations + - make sure you populate the new $AST_ver variable in AST_SERVER_conf.pl + * if upgrading from 1.1.3 run the upgrade_1.1.4.sql script in MySQL + (\. astguiclientastguiclient/upgrade_1.1.4.sql) + +1.1.5 - Eighteenth public release - 2005-08-12 +- fixed new Local channel bugs caused by changes in Asterisk 1.0.8 and 1.0.9 +- moved many server variables to the database, editable through admin.php +- added ability to limit number of outbound trunks used by VICIDIAL auto dialer +- many small changes and bug fixes to the astguiclient web client +- added alpha vicidial web-client (click-to-dial only) +UPGRADE NOTES: + * if upgrading from 1.1.4 you need to: + - download the new version from the project website + - unzip the zip file into the astguiclientastguiclient directory + - and either: + + copy the web pages and all server apps to their proper locations manually + + or run the install_server_files.pl script to put all items in their + default places + - VICIDIAL perl/TK client is unchanged from 1.1.4 + - make sure you check the astguiclient admin.php server parameters + * if upgrading from 1.1.4 run the upgrade_1.1.5.sql script in MySQL + (\. astguiclientastguiclient/upgrade_1.1.5.sql) + +1.1.6 - Nineteenth public release - 2005-08-29 +- streamlined many of the server apps and added command-line debug capability +- finished the vicidial web-client and tested in prduction +- modified server-side scripts to function with Asterisk CVS_HEAD(soon to be 1.2) +- modified server performance logging and graphing, added user/system proc % +UPGRADE NOTES: + * if upgrading from 1.1.5 you need to: + - download the new version from the project website + - unzip the zip file into the astguiclientastguiclient directory + - and either: + + copy the web pages and all server apps to their proper locations manually + + or run the install_server_files.pl script to put all items in their + default places + (make sure AST_SERVER_conf.pl and dbconnect.php files are config'd properly) + - perl/TK clients are unchanged from 1.1.5 + - make sure you check the astguiclient admin.php server parameters + - make the agi-VDADtransfer.agi changes in extensions.conf (mentioned in SCRATCH_INSTALL doc) + * if upgrading from 1.1.5 run the upgrade_1.1.6.sql script in MySQL + (\. astguiclientastguiclient/upgrade_1.1.6.sql) + +1.1.7 - Twentieth public release - 2005-10-05 +- Added HotKeys key binding for VICIDIAL web-client fast dispositioning +- Internationalization(multi-language) of web-clients and admin pages +- Added ability in manual VICIDIAL to call alternate lead phone numbers +- Added option of pull-down of active campaigns to VICIDIAL web login +- Fixed some issues with scripts interacting with Asterisk 1.2 +- other small changes listed in the TODO.txt file +UPGRADE NOTES: + * if upgrading from 1.1.6 you need to: + - download the new version from the project website + - unzip the zip file into the astguiclientastguiclient directory + - and either: + + copy the web pages and all server apps to their proper locations manually + + or run the install_server_files.pl script to put all items in their + default places + (make sure AST_SERVER_conf.pl and dbconnect.php files are config'd properly) + - perl/TK clients have been slightly updated(will be unsupported soon) + - multi-language versions of web-clients and admin pages are available in the + LANG_agc.zip and LANG_admin.zip files and can be unzipped into your webroot + directory. Make sure you check the dbconnect.php file in each directory. + * if upgrading from 1.1.6 run the upgrade_1.1.7.sql script in MySQL + (\. astguiclientastguiclient/upgrade_1.1.7.sql) + +1.1.8 - Twenty-First public release - 2005-11-10 +- Added per-campaign call recording options to VICIDIAL +- Added detailed logging for VICIDIAL agent time +- Fixed some issues with scripts interacting with Asterisk 1.2 +- other small changes listed in the TODO.txt file +UPGRADE NOTES: + * if upgrading from 1.1.7 you need to: + - download the new version from the project website + - unzip the zip file into the astguiclientastguiclient directory + - and either: + + copy the web pages and all server apps to their proper locations manually + + or run the install_server_files.pl script to put all items in their + default places + (make sure AST_SERVER_conf.pl and dbconnect.php files are config'd properly) + - multi-language versions of web-clients and admin pages are available in the + LANG_agc.zip and LANG_admin.zip files and can be unzipped into your webroot + directory. Make sure you check the dbconnect.php file in each directory. + * if upgrading from 1.1.7 run the upgrade_1.1.8.sql script in MySQL + (\. astguiclientastguiclient/upgrade_1.1.8.sql) + +1.1.9 - Twenty-Second public release - 2006-01-19 +- Added Load Balancing of Inbound and Outbound calls across multiple Asterisk + servers in the same setup +- Removed all PHP globals requirements, can now use register_globals=Off in PHP +- Add fully translated Greek admin and agc scripts(agc images to come) +- Added security elements to admin pages and added record deletion functions +- Added a script tab to VICIDIAL to have a variable-populated agent script +- Added new Super lead loader with field chooser and CVS/XLS-format capability +- Added favorites panel to astguiclient.php that shows off/on hook +- Many other small changes listed in the TODO.txt file +UPGRADE NOTES: + * if upgrading from 1.1.8 you need to: + - download the new version from the project website + - unzip the zip file into the astguiclientastguiclient directory + - and either: + + copy the web pages and all server apps to their proper locations manually + + or run the install_server_files.pl script to put all items in their + default places + (make sure AST_SERVER_conf.pl and dbconnect.php files are config'd properly) + - multi-language versions of web-clients and admin pages are available in the + LANG_agc.zip and LANG_admin.zip files and can be unzipped into your webroot + directory. Make sure you check the dbconnect.php file in each directory. + * if upgrading from 1.1.8 run the upgrade_1.1.9.sql script in MySQL + (\. astguiclientastguiclient/upgrade_1.1.9.sql) + +1.1.10 - Twenty-Third public release - 2006-03-17 +- Added capability to work with app_amd(answering machine detection) +- Added transfer-conference number and DTMF presets per campaign +- Added sphinx ring-time analysis disposition package(beta) +- Added scheduled callbacks to VICIDIAL +- Added more user-permission options/restrictions +- Several small bug fixes for better Asterisk 1.2.4 compatibility +- Many other small changes listed in the TODO.txt file +UPGRADE NOTES: + * if upgrading from 1.1.9 you need to: + - download the new version from the project website + - unzip the zip file into the astguiclientastguiclient directory + - and either: + + copy the web pages and all server apps to their proper locations manually + + or run the install_server_files.pl script to put all items in their + default places + (make sure AST_SERVER_conf.pl and dbconnect.php files are config'd properly) + - add "exten => h,2,DeadAGI(VD_hangup.agi,${EXTEN})" to extensions.conf + - multi-language versions of web-clients and admin pages are available in the + LANG_agc.zip and LANG_admin.zip files and can be unzipped into your webroot + directory. Make sure you check the dbconnect.php file in each directory. + * if upgrading from 1.1.9 run the upgrade_1.1.10.sql script in MySQL + (\. astguiclientastguiclient/upgrade_1.1.10.sql) + +1.1.11 - Twenty-Fourth public release - 2006-04-28 +- Added Agent-only Scheduled Callbacks +- Added Lead Filters for campaigns to use custom SQL to narrow calling scope +- Added Agent manual-lead-insertion capability +- Fixed PHP variable checking in all PHP scripts to be more compliant +- Added more user-permission options/restrictions for both agents and admins +- Several small bug fixes for better Asterisk 1.2.6 and SVN compatibility +- Many other small changes listed in the TODO.txt file +UPGRADE NOTES: + * if upgrading from 1.1.10 you need to: + - download the new version from the project website + - unzip the zip file into the astguiclientastguiclient directory + - and either: + + copy the web pages and all server apps to their proper locations manually + + or run the install_server_files.pl script to put all items in their + default places + (make sure AST_SERVER_conf.pl and dbconnect.php files are config'd properly) + - multi-language versions of web-clients and admin pages are available in the + LANG_agc.zip and LANG_admin.zip files and can be unzipped into your webroot + directory. Make sure you check the dbconnect.php file in each directory. + * if upgrading from 1.1.10 run the upgrade_1.1.11.sql script in MySQL + (\. astguiclient/upgrade_1.1.11.sql) + +1.1.12 - Twenty-Fifth public release - 2006-06-22 +- Security enhancements of PHP scripts to reduce SQL-injection and other threats +- Completely redesigned local call time system in VICIDIAL for more flexibility +- Added Drop-call and safe-harbor options to campaigns and inbound groups +- Added option for allowing wrapup time between calls in vicidial.php +- Multi-language translation rewritten for more flexibility and easy of use +- Added more user-permission options/restrictions for both agents and admins +- Added option of using app_conference instead of meetme engine +- Added internal DNC list for Do-Not-Call entries across the system +- Added automatic lead recycling to call back Busy calls at definable intervals +- Added listID override and timezone lookup to all lead importing scripts +- Added easy-prompt-recording AGI and playback: agi-record_prompts.agi +- Many other changes and bug fixes listed in the TODO.txt file +UPGRADE NOTES: + * if upgrading from 1.1.11 you need to: + - download the new version from the project website + - unzip the zip file into the astguiclientastguiclient directory + - and either: + + copy the web pages and all server apps to their proper locations manually + + or run the install_server_files.pl script to put all items in their + default places + (make sure AST_SERVER_conf.pl and dbconnect.php files are config'd properly) + - multi-language versions of web-clients and admin pages are available in the + LANG_agc.zip and LANG_admin.zip files and can be unzipped into your webroot + directory. Make sure you check the dbconnect.php file in each directory. + * if upgrading from 1.1.11 run the upgrade_1.1.12.sql script in MySQL + (\. astguiclientastguiclient/upgrade_1.1.12.sql) + * if upgrading from older version you will need to run this query for each + campaign in VICIDIAL in MySQL: + (INSERT INTO vicidial_campaign_stats (campaign_id) values('campaignname');) + +2.0.1 - Twenty-Sixth public release - 2006-09-15 +- Changed all Perl script to use DBI instead of Net::MySQL +- Completely new interactive install script with new astguiclient.conf file +- Ability to turn off or on logging of server scripts +- Ability to redirect AGI output to file, STDERR, both or nowhere. +- Code and process optimization of many of the server-side scripts +- Added a Predictive outbound dialing algorithm with many user-defined settings +- Wrote new BASE_INSTALL.txt doc for simple install and added sample conf files +- Many other changes and bug fixes listed in the TODO Wiki webpage: + http://www.eflo.net/VICIDIALwiki/index.php/TODO:2.0.1 +UPGRADE NOTES: + * if upgrading from 1.1.12 you need to follow instructions in the UPGRADE doc + +2.0.2 - Twenty-Seventh public release - 2006-12-22 +- Added FastAGI replacement for call_log and VDhangup scripts +- Added new USA-Canada Daylight Savings time scheme and DST for Brazil +- astguiclient/admin.php removed and merged into vicidial/admin.php +- Ability for agent to alter volume levels of participants +- Keepalives consolidated into single script +- New all-active-campaigns realtime summary screen +- New script added to make it easier to change IP address of servers in VICIDIAL +- Added ability to reserver trunk lines for specific VICIDIAL campaigns +- Added ability for balance dialing and dialing-only servers in VICIDIAL +- Many other changes and bug fixes listed in the TODO Wiki webpage: + http://www.eflo.net/VICIDIALwiki/index.php/TODO:2.0.2 +UPGRADE NOTES: + * if upgrading from 2.0.1 you need to follow instructions in the UPGRADE doc + +2.0.3 - Twenty-Eighth public release - 2007-04-27 +- Added optimized manager sending scripts +- Made several changes to admin.php and made it more customizable +- Made changes to HotKeys to allow for manual auto dial and auto alt number dial +- Added ability to dial alternate lead phone numbers in auto-dial modes +- Added ability to send more calls to agents at once, helping large installations +- Added more levels of access control to the administrative interfaces +- Added Agent Pause codes to alow agents to categorize their PAUSE time +- Added VICIDIAL outbound compatibility with QueueMetrics +- Many other changes and bug fixes listed in the TODO Wiki webpage: + http://www.eflo.net/VICIDIALwiki/index.php/TODO:2.0.3 +UPGRADE NOTES: + * if upgrading from 2.0.2 you need to follow instructions in the UPGRADE doc + +2.0.4 - Twenty-Ninth public release - 2007-12-03 +- Easy control over System Statuses, including the addition of Status Categories +- Several new additional In-Group features including music-on-hold, alert messages and call times +- Skills based ranking and call routing for inbound and outbound +- Agent call routing based on the number of calls taken today per in-group or campaign +- Added the ability to copy the settings of an existing User/Campaign/In-Group into a new one +- Changing the Transfer feature in the agent screen to allow for more transfer In-Group choices +- Dynamic display of available campaigns for an agent in the agent login screen +- Many other changes and bug fixes listed in the TODO Wiki webpage: + http://www.eflo.net/VICIDIALwiki/index.php/TODO:2.0.4 +UPGRADE NOTES: + * if upgrading from 2.0.3 you need to follow instructions in the UPGRADE doc diff --git a/agc_2-X/branches/agc_2.0.4/docs/REQUIRED_APPS_INSTALL.txt b/agc_2-X/branches/agc_2.0.4/docs/REQUIRED_APPS_INSTALL.txt new file mode 100644 index 00000000..5ec95dda --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/REQUIRED_APPS_INSTALL.txt @@ -0,0 +1,458 @@ +# Quick install of required apps v.2.0.4 2007-12-03 +# This file is a supplement to the BASE_INSTALL document giving you simple copy/ +# paste installation shell commands for required and helper apps for VICIDIAL +# might need: echo '/* Linuxthreads */' >> /usr/include/pthread.h + +cd /usr/local +wget http://mirrors.kernel.org/gnu/make/make-3.81.tar.gz +gunzip make-3.81.tar.gz +tar xvf make-3.81.tar +cd make-3.81 +./configure +make +make install + +cd /usr/local +wget http://mirror.trouble-free.net/mysql_mirror/Downloads/MySQL-4.0/mysql-4.0.27.tar.gz +gunzip mysql-4.0.27.tar.gz +tar xvf mysql-4.0.27.tar +cd mysql-4.0.27 +groupadd mysql +useradd -g mysql mysql +./configure --prefix=/usr/local/mysql --enable-large-files --enable-shared=yes --with-readline +make +make install +scripts/mysql_install_db +chown -R root /usr/local/mysql +chown -R mysql /usr/local/mysql/var +chgrp -R mysql /usr/local/mysql +cp support-files/my-medium.cnf /etc/my.cnf +/usr/local/mysql/bin/mysqld_safe --user=mysql & +ln -s /tmp/mysql.sock /var/run/mysql/mysql.sock + + +perl -MCPAN -e shell +install MD5 +install Digest::MD5 +install Digest::SHA1 +install readline +install Bundle::CPAN +install DBI +force install DBD::mysql +install Net::Telnet +install Time::HiRes +install Net::Server +install Unicode::Map +install Jcode +install Spreadsheet::WriteExcel +install OLE::Storage_Lite +install Proc::ProcessTable +install IO::Scalar +install Spreadsheet::ParseExcel +quit + + +cd /usr/local +wget http://asterisk.gnuinter.net/files/asterisk-perl-0.08.tar.gz +gunzip asterisk-perl-0.08.tar.gz +tar xvf asterisk-perl-0.08.tar +cd asterisk-perl-0.08 +perl Makefile.PL +make all +make install + + +cd /usr/local +wget http://easynews.dl.sourceforge.net/sourceforge/sox/sox-12.17.9.tar.gz +gunzip sox-12.17.9.tar.gz +tar xvf sox-12.17.9.tar +cd sox-12.17.9 +./configure +make +make install + + +cd /usr/local +wget http://ftp.gnu.org/gnu/screen/screen-4.0.2.tar.gz +gunzip screen-4.0.2.tar.gz +tar xvf screen-4.0.2.tar +cd screen-4.0.2 +./configure +make +make install + + +cd /usr/local +wget http://www.daveltd.com/src/util/ttyload/ttyload-0.4.4.tar.gz +gunzip ttyload-0.4.4.tar.gz +tar xvf ttyload-0.4.4.tar +cd ttyload-0.4.4 +make +ln -s /usr/local/ttyload-0.4.4/ttyload /usr/bin/ttyload + + +cd /usr/local +wget http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-4.2.2p3.tar.gz +gunzip ntp-4.2.2p3.tar.gz +tar xvf ntp-4.2.2p3.tar +cd ntp-4.2.2p3 +./configure +make +make install +/usr/local/bin/ntpdate -u 18.145.0.30 + + +cd /usr/local +wget http://www.tcpdump.org/release/libpcap-0.9.4.tar.gz +gunzip libpcap-0.9.4.tar.gz +tar xvf libpcap-0.9.4.tar +cd libpcap-0.9.4 +./configure +make +make install +cd /usr/local +wget http://www.ex-parrot.com/~pdw/iftop/download/iftop-0.17.tar.gz +gunzip iftop-0.17.tar.gz +tar xvf iftop-0.17.tar +cd iftop-0.17 +./configure +make +make install + + +cd /usr/local +wget http://www.zlib.net/zlib-1.2.3.tar.gz +gunzip zlib-1.2.3.tar.gz +tar xvf zlib-1.2.3.tar +cd zlib-1.2.3 +./configure +make +make install +cd /usr/local +wget http://gulus.usherbrooke.ca/pub/appl/ssh/OpenSSH/portable/openssh-4.7p1.tar.gz +gunzip openssh-4.7p1.tar.gz +tar xvf openssh-4.7p1.tar +cd openssh-4.7p1 +./configure +make +make install + + +cd /usr/local +wget http://www.openssl.org/source/openssl-0.9.8g.tar.gz +gunzip openssl-0.9.8g.tar.gz +tar xvf openssl-0.9.8g.tar +cd openssl-0.9.8g +./config +make +make install + + +cd /usr/local +wget http://subversion.tigris.org/downloads/subversion-1.3.2.tar.gz +gunzip subversion-1.3.2.tar.gz +tar xvf subversion-1.3.2.tar +cd subversion-1.3.2 +./configure +make +make install + + +cd /usr/local +wget http://ploticus.sourceforge.net/download/pl232src.tar.gz +gunzip pl232src.tar.gz +tar xvf pl232src.tar +cd pl232src/src/ +make clean +make +make install + + +cd /usr/local +wget http://apache.secsup.org/dist/httpd/httpd-2.0.61.tar.gz +gunzip httpd-2.0.61.tar.gz +tar xvf httpd-2.0.61.tar +wget http://us2.php.net/distributions/php-4.4.7.tar.gz +gunzip php-4.4.7.tar.gz +tar xvf php-4.4.7.tar +cd httpd-2.0.61 +./configure --prefix=/usr/local/apache2 --enable-ssl --enable-setenvif --enable-so --with-apxs2 --enable-dav --enable-maintainer-mode +make +make install +mkdir /usr/local/apache2/conf/ssl.key +mkdir /usr/local/apache2/conf/ssl.crt +mkdir /usr/local/apache2/conf/ssl.crl +openssl req -new -x509 -days 1200 -keyout /usr/local/apache2/conf/ssl.key/server.key.cpy -out /usr/local/apache2/conf/ssl.crt/server.crt -subj '/CN=10.10.10.15' + + +openssl rsa -in /usr/local/apache2/conf/ssl.key/server.key.cpy -out /usr/local/apache2/conf/ssl.key/server.key + + +cd ../php-4.4.7 +./configure --with-mysql=/usr/local/mysql --enable-inline-optimization --enable-memory-limit --enable-track-vars --enable-libgcc --with-xml --enable-versioning --enable-sysvsem --with-openssl --disable-debug --with-apxs2=/usr/local/apache2/bin/apxs --with-zlib +make +make install +cp php.ini-dist /usr/local/lib/php.ini +vi /usr/local/apache2/conf/httpd.conf + + + add the following lines: + "AddType application/x-httpd-php .php .phtml" + "LoadModule php4_module libexec/libphp4.so" + or + "LoadModule php4_module module/libphp4.so" + modify the index.html line and add index.php to the list + + +vi /usr/local/lib/php.ini + + + modify the following line: + "memory_limit = 8M" + and change it to: + "memory_limit = 48M" + + +/usr/local/apache2/bin/apachectl startssl + + +cd /usr/local +wget http://bart.eaccelerator.net/source/0.9.5/eaccelerator-0.9.5.zip +unzip eaccelerator-0.9.5.zip +cd eaccelerator-0.9.5 +export PHP_PREFIX="/usr/local" +$PHP_PREFIX/bin/phpize +./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config +make +make install +vi /usr/local/lib/php.ini + + + Add the following lines to the dynamic extensions section of php.ini: + (you may need to change the extension location depending on your install of php) +extension="../../../usr/local/eaccelerator-0.9.5/modules/eaccelerator.so" +eaccelerator.shm_size="48" +eaccelerator.cache_dir="/tmp/eaccelerator" +eaccelerator.enable="1" +eaccelerator.optimizer="1" +eaccelerator.check_mtime="1" +eaccelerator.debug="0" +eaccelerator.filter="" +eaccelerator.shm_max="0" +eaccelerator.shm_ttl="0" +eaccelerator.shm_prune_period="0" +eaccelerator.shm_only="0" +eaccelerator.compress="1" +eaccelerator.compress_level="9" + + +mkdir /tmp/eaccelerator +chmod 0777 /tmp/eaccelerator +php -v + + +cd /usr/local +wget http://superb-east.dl.sourceforge.net/sourceforge/mtop/mtop-0.6.6.tar.gz +gunzip mtop-0.6.6.tar.gz +tar xvf mtop-0.6.6.tar +cd mtop-0.6.6 +cpan + + +install Curses +install Getopt::Long +install Net::Domain +quit + + +perl Makefile.PL +make +make install +/usr/local/bin/mtop --dbuser=root --seconds=3 + + +cd /usr/local +wget http://download.berlios.de/sipsak/sipsak-0.9.6-1.tar.gz +gunzip sipsak-0.9.6-1.tar.gz +tar xvf sipsak-0.9.6-1.tar +cd sipsak-0.9.6 +./configure +make +make install +/usr/local/bin/sipsak --version + + + + +#### OPTIONAL NEWEST VERSIONS OF ASTERISK #### + +mkdir /usr/src/asterisk +cd /usr/src/asterisk +wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.2.24.tar.gz +wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.2.21.tar.gz +wget http://ftp.digium.com/pub/libpri/releases/libpri-1.2.5.tar.gz +gunzip asterisk-1.2.24.tar.gz +tar xvf asterisk-1.2.24.tar +gunzip zaptel-1.2.21.tar.gz +tar xvf zaptel-1.2.21.tar +gunzip libpri-1.2.5.tar.gz +tar xvf libpri-1.2.5.tar +cd ./zaptel-1.2.21 +wget http://www.freedomphones.net/files/newt-0.51.6.tar.gz +gunzip newt-0.51.6.tar.gz +tar xvf newt-0.51.6.tar +cd newt-0.51.6 +./configure +make +make install +cd ../ +ln -s /usr/lib/libnewt.so.0.51.6 /usr/lib/libnewt.so.0.51 +make clean +make zttool +make +make install +cd ../libpri-1.2.5 +make clean +make +make install +cd ../asterisk-1.2.24 +cd apps +wget http://www.eflo.net/files/app_amd2.c +mv app_amd2.c app_amd.c +vi Makefile + + + replace this line(line 32): + app_mixmonitor.so app_stack.so + with this line: + app_mixmonitor.so app_stack.so app_amd.so + + +wget http://www.eflo.net/files/amd2.conf +mkdir /etc/asterisk +mv amd2.conf /etc/asterisk/amd.conf +wget http://www.eflo.net/files/meetme_DTMF_passthru-1.2.23.patch +patch -p1 < ./meetme_DTMF_passthru-1.2.23.patch + + + - File to patch: app_meetme.c + + +wget http://www.eflo.net/files/meetme_volume_control_1.2.16.patch +patch -p1 < ./meetme_volume_control_1.2.16.patch + + + - File to patch: app_meetme.c + + +cd ../ +wget http://www.eflo.net/files/cli_chan_concise_delimiter.patch +patch -p1 < ./cli_chan_concise_delimiter.patch + + + - File to patch: cli.c + + +wget http://www.eflo.net/files/app_waitforsilence.c +mv app_waitforsilence.c apps/app_waitforsilence.c +wget http://www.eflo.net/files/enter.h +wget http://www.eflo.net/files/leave.h +mv -f enter.h apps/enter.h +mv -f leave.h apps/leave.h + +make clean +make +make install + +make samples + +cd /var/lib/asterisk/mohmp3/ +mpg123 -s --rate 44100 --mono /var/lib/asterisk/mohmp3/fpm-sunshine.mp3 > /var/lib/asterisk/mohmp3/fpm-sunshine.raw +sox -r 44100 -w -s -c 1 fpm-sunshine.raw -r 8000 -c 1 fpm-sunshine.wav +sox fpm-sunshine.wav -t gsm -r 8000 -b -c 1 fpm-sunshine.gsm +sox fpm-sunshine.wav -t ul -r 8000 -b -c 1 fpm-sunshine.pcm +mpg123 -s --rate 44100 --mono /var/lib/asterisk/mohmp3/fpm-calm-river.mp3 > /var/lib/asterisk/mohmp3/fpm-calm-river.raw +sox -r 44100 -w -s -c 1 fpm-calm-river.raw -r 8000 -c 1 fpm-calm-river.wav +sox fpm-calm-river.wav -t gsm -r 8000 -b -c 1 fpm-calm-river.gsm +sox fpm-calm-river.wav -t ul -r 8000 -b -c 1 fpm-calm-river.pcm +mpg123 -s --rate 44100 --mono /var/lib/asterisk/mohmp3/fpm-world-mix.mp3 > /var/lib/asterisk/mohmp3/fpm-world-mix.raw +sox -r 44100 -w -s -c 1 fpm-world-mix.raw -r 8000 -c 1 fpm-world-mix.wav +sox fpm-world-mix.wav -t gsm -r 8000 -b -c 1 fpm-world-mix.gsm +sox fpm-world-mix.wav -t ul -r 8000 -b -c 1 fpm-world-mix.pcm +rm -f *.raw +mkdir ../orig-mp3 +mv -f *.mp3 ../orig-mp3/ + + + +############# INSTRUCTIONS FOR Asterik 1.4 release #################### + +NOTE: If you want to use Asterisk 1.4, you will need to make sure that you set +the servers table "asterisk_version" field to the proper version number and you +can use the docs/conf_examples/extensions.conf.sample-1.4 file for your default +dialplan + +### If upgrading from 1.2.X Asterisk, run the following lines first: +rm -f /usr/lib/asterisk/modules/app_curl.so +rm -f /usr/lib/asterisk/modules/app_cut.so +rm -f /usr/lib/asterisk/modules/app_enumlookup.so +rm -f /usr/lib/asterisk/modules/app_eval.so +rm -f /usr/lib/asterisk/modules/app_groupcount.so +rm -f /usr/lib/asterisk/modules/app_math.so +rm -f /usr/lib/asterisk/modules/app_md5.so +rm -f /usr/lib/asterisk/modules/app_setcidname.so +rm -f /usr/lib/asterisk/modules/app_setcidnum.so +rm -f /usr/lib/asterisk/modules/app_setrdnis.so +rm -f /usr/lib/asterisk/modules/app_txtcidname.so +rm -f /usr/lib/asterisk/modules/chan_features.so +rm -f /usr/lib/asterisk/modules/format_au.so +rm -f /usr/lib/asterisk/modules/format_pcm_alaw.so +rm -f /usr/lib/asterisk/modules/pbx_functions.so + + +mkdir /usr/src/asterisk-1.4 +cd /usr/src/asterisk-1.4 +wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.4.14.tar.gz +wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.4.6.tar.gz +wget http://ftp.digium.com/pub/libpri/releases/libpri-1.4.2.tar.gz +gunzip asterisk-1.4.14.tar.gz +tar xvf asterisk-1.4.14.tar +gunzip zaptel-1.4.6.tar.gz +tar xvf zaptel-1.4.6.tar +gunzip libpri-1.4.2.tar.gz +tar xvf libpri-1.4.2.tar +cd ./zaptel-1.4.6 +./configure +make +make install +cd ../libpri-1.4.2 +make clean +make +make install +cd ../asterisk-1.4.14 +wget http://www.eflo.net/files/enter.h +wget http://www.eflo.net/files/leave.h +mv -f enter.h apps/enter.h +mv -f leave.h apps/leave.h +./configure +make +make install + + + + + + +#### pureftpd FTP server installation instructions #### + +cd /usr/local +wget ftp://ftp.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.20.tar.gz +gunzip pure-ftpd-1.0.20.tar.gz +tar xvf pure-ftpd-1.0.20.tar +cd pure-ftpd-1.0.20 +groupadd ftpgroup +useradd -g ftpgroup -d /dev/null -s /etc ftpuser +./configure --with-everything --with-largefile --with-virtualchroot +make install-strip +pure-pw useradd cron -u ftpuser -d /home/cron +/usr/local/sbin/pure-ftpd & diff --git a/agc_2-X/branches/agc_2.0.4/docs/REQUIREMENTS.txt b/agc_2-X/branches/agc_2.0.4/docs/REQUIREMENTS.txt new file mode 100644 index 00000000..37400c31 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/REQUIREMENTS.txt @@ -0,0 +1,31 @@ +This is the basic list of requirements for using astGUIclient. It is highly +recommended that you read the SCRATCH_INSTALL doc for more information on +installing the package properly. + +Requirements for installing astGUIclient/VICIDIAL on an Asterisk server: +- Asterisk 1.2.24 recommended but will work with most older Asterisk versions +- Zap trunks(T1/E1 or PSTN lines), IAX2 trunks or SIP trunks required +- If using VOIP trunks and VICIDIAL auto-dial, you must have trunks registered +- It is strongly suggested that you have a zaptel timer like a PSTN/T1/E1 card or ztdummy +- Client phones can be SIP/IAX/Zap +- In extensions.conf you must use the 'o' Dial flag on your outbound extensions +- In extensions.conf you must have the following line in your default context: + exten => h,1,DeadAGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME})) +- No modification of outgoing callerID (you can set callerID through admin) +- Access to Apache/PHP webserver, php.ini memory_limit set to 48M +- In php.ini you must have uploads turned on to use the web lead loader +- SoX 12.17.5 or greater must be installed +- GNU screen 3.9.15 or greater must be installed +- ntp must be installed and syncd to same time source as any other servers +- Perl5 with several CPAN modules(Time::HiRes, DBD::mysql, Net::Telnet, etc) +- asterisk-perl-0.08 perl module required (0.09 version does NOT work) +- Access to MySQL server and mysqlclientlibs, must be version 4.0.X or higher +- Several entries in the crontab for interval-running scripts and keepalives + +Requirements for using the astGUIclient/VICIDIAL web-client versions +- Recommended 500MHz speed or faster and 64MB RAM or more +- Any Unix with Xwindows, Mac OS9/X or Win98/2k/XP operating system +- Recommended use Firefox for all OSs (will run under IE5.0 or greater as well) + Will also run on Opera 8.5+, Mozilla 1.7+, Netscape 8+ and IE 6.0 +- ntp or sntp time syncing to same source as server recommended +- Proper configuration settings for each phone/computer in the phones DB table diff --git a/agc_2-X/branches/agc_2.0.4/docs/SCRATCH_INSTALL.txt b/agc_2-X/branches/agc_2.0.4/docs/SCRATCH_INSTALL.txt new file mode 100644 index 00000000..1da6b15b --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/SCRATCH_INSTALL.txt @@ -0,0 +1,3159 @@ +Asterisk/astguiclient install from scratch. v.2.0.4 2007-12-03 + By the astGUIclient group astguiclient@eflo.net + +**** IMPORTANT - In order for vicidial/astguiclient to function correctly please +read the REQUIREMENTS.txt for a minimum requirements list. *** + +End-user Manuals for Agents and Managers are available from http://www.eflo.net + + +This document is meant to be a very in-depth step-by-step explanation of +installing the Asterisk open-source PBX on a Linux system and also installing +the astGUIclient suite. The instructions will assume starting from nothing and +will try to give several side step instructions to account for some differences +in choices of hardware and software. + +The actual installation that I am doing as I write these instructions will be on +the following hardware: + + - Pentium 3 500MHz + - Intel motherboard D815BN + - 256MB PC133 RAM + - 80GB IBM deskstar 7200RPM Hard Drive + - Digium Wildcard Single Span T1 Card T100P + - 2U rackmount case with 250W power supply + - Phone hardware will be a Grandstream BT102 and a Sipura SPA-2000 because they +are so cheap and readily available + +All of these parts, aside from the Digium card and the two SIP VOIP devices, +were purchased from ebay and the entire package(with the two VOIP devices and +all server hardware included) cost me about $1100 to put together including the +phones and Digium adapter. + +We have many other Asterisk servers at our main office, but this one can be +experimented with easily because it was so cheap to make and has a relatively +small capacity when compared with a multi-processor server with a quad span T1 +card. + +This is our test Asterisk server and functions well for a dozen or so extensions +in use if it were to be used in production. A size that is optimal for many +small offices operating with a fractional data/voice T1 for instance. + +For hardware you can use almost any Pentium-class processor(PII, PIII, Athlon, +Xeon, etc), and you can use any digium telco interface card. Both of these +choices will determine what the capacity of your Asterisk server will be. If you +want to do simple IVR or conference calling and a few extensions, then a PIII +with a single Digium T1 card will work just fine for you. If you want to use the +VICIDIAL application, you will want to get as high-powered of a machine as you +can afford and get a digium quad-span T1 card. + +The following is assumed for these installation procedures: +- You have access to a CD burner and 3 blank CDs +- You have some sort of broadband internet connection +- You understand basic linux commands and can use a file editor like vi +- You have all of the necessary hardware: + - a pentium-class computer + - a digium telco interface card with appropriate telco lines + - at least 1 SIP VOIP device + - a Local Area Network(LAN) with extra ports enough for the new server +and the number of phones you want + + + + + +PHASE 1: INSTALLING AN OPERATING SYSTEM + + +This installation will be using Slackware 11 for the linux distribution, +Slackware 10.X will also work with these instructions. There are several easier +linux distributions and there are others that are more popular, but Slackware is +a nice non-commercial distro that has been around for a long time and proven +itself to be a very uncluttered and stable platform for development. + +1. Go to http://www.ultimatebootcd.com/ , download the latest bootcd and +burn it to a CD. This will be needed to partition the hard drive prior to +installation of Slackware linux. The latest version as of this writing is 4.1 +(If you have problems with your hardware booting some of the utilities with 4.1 +I suggest trying 1.7, that version has older utilities, but still gets the job +done and works on every machine I've tried it on). + +2. Insert the ultimatebootcd you just burned into your CDROM drive and boot +to it. You will select "filesystem utilities" and then "XFDISK" + +3. Select any old partitions and delete them and then create 2 new +partitions: + - 70000 MB, select yes to validate, change partition type to "Linux Native" + - 3332 MB, select yes to validate, change partition type to "Linux Swap" + - press F3 to exit and let it do it's thing, this will take an hour or so. + +4. Go to http://www.slackware.com/getslack/ to download Slackware linux. +The most recent release as of this writing is 12.0. This release fits on 3 CDs +or 1 DVD. Download both installation disks from any close server listed on the +download page and burn them both to CDs. + +5. Insert Disk 1 of the Slackware installation CD and boot your computer. +If you have a simple computer with just an IDE drive just hit enter at the boot: +prompt. If you have other hard drive adapters(SCSI/RAID/SATA/etc..) you will +need to look at the Slackware installation help page to determine what boot +image you will need to use to install Slackware correctly. + +6. Login as root and type "setup" at the prompt to go to the setup menu. +7. Go to ADDSWAP and hit Enter +8. Select the swap partition you just created and hit Yes, The swap +partition will then be formatted +9. Select the root partiton you just created as Linux Native and hit +Select, then select "ext3" for the file system, then select 4096 for the inodes +and the root partition will then be formatted +10. Select "Install Slackware from a CD" and hit OK +11. Select "auto" installation and hit OK +12. Select every package except for "KDEI" and hit OK +13. Select "full" installation and hit OK +14. Insert the next Slackware installation disk (disk 2) when it prompts +you, and hit OK to continue +15. Now you will select the boot kernel that you will use from now on. If +you have a simple system with IDE drives you can probably just select "skip" and +go to the next step. If not then you should probably select "cdrom" and select +the kernel from the list that you selected to boot into the installation. +16. You can make a bootdisk if you like, but you don't have to. +17. For Modem you can select "no modem" and hit OK to continue +18. Enable hotplug, hit Yes to continue +19. Install lilo "simple" and hit OK to continue +20. lilo frame buffer console 640x480 is safe choice if you're not sure +21. Optional Lilo append, leave blank and hit OK to continue +22. Lilo destination, I usually choose MBR but root works most of the time +23. Mouse, select the mouse type that you have hooked up, or select ps/2 +24. Load GPM at boot time, Hit Yes to continue +25. select Yes to configure your network +26. Hostname, we are typing "phone" +27. network, we are typing our local domain name +28. IP address, we are selecting Static IP, here's what we enter for +network, you should enter a network setup that will work with your local LAN: + - IP address: 10.10.10.15 + - subnet: 255.255.0.0 + - gateway: 10.10.10.1 + - name server: 10.10.10.1 +29. Accept your network settings +30. Startup services to run, change nothing and select OK to continue +31. select NO for custom screen fonts +32. Hardware clock to UTC, select NO +33. Select your time zone and hit OK +34. I usually select gnome as the window manager, even though you won't be +using it on this machine +35. Select Yes to enter a root password. type something that you will +remember. +36. Setup of Slackware Linux is complete, hit OK and EXIT then press +CTRL-ALT-DELETE to reboot your computer + + + + + +PHASE 2: COMPILING A CUSTOM LINUX KERNEL + + +From this step on you should be able to continue the installation remotely +although it is wise to at least have quick access to the machine if something +goes wrong. + +To connect remotely through SSH on linux type "slogin serveripaddress" or to use +Windows to connect you can use a piece of free software called putty available +here: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html +Also, for windows you can use SSH file transferring(SFTP) with a program called +filezilla: http://filezilla.sourceforge.net/ + +This is an optional step if your linux system is running, but compiling your own +custom kernel is always a way to optimize your system for the hardware you have +installed or a way to remove the unnecesary modules that are in the default +kernel. You will definately want to build your own kernel if you have a multi +processor machine. If you are new to Linux you probably do not want to do this. + +If you are using a newer Digium Octasic-based echo-cancellation quad T1/E1 card +then you need to use a 2.6 Linux kernel in order to use the echo-cancellation +functionality of the card. + +If you want to compile a 2.6 kernel then start with OPTION 1, otherwise to +compile the 2.4 kernel that comes with Slackware(2.4.33) start with OPTION 2: + +OPTION 1: compile Linux kernel 2.6.17 *RECOMMENDED* + +1. cd /usr/src +2. wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.17.11.tar.gz +3. gunzip linux-2.6.17.11.tar.gz +4. tar xvf linux-2.6.17.11.tar +5. mv -f /usr/src/linux /usr/src/linux-old +6. ln -s /usr/src/linux-2.6.17.11 /usr/src/linux +7. cd linux +8. make mrproper # prep for kernel assembly +9. make menuconfig # launch configuration menu app + (this part is very dependant upon your own hardware) + (what is mentioned below are only changes beyond what is selected by default) + + Processor Type and Features ---> + ->Symmetric multi-processing support + (if you have multiple processors or a Dual-core or HT enabled) + ->High Memory Support + (if you have more than 900MB of System RAM move upto 4GB) + ->Timer frequency (1000 HZ) + (change to 1000Hz if using ztdummy for timer) + ->Preemption Model (No Forced Preemption (Server)) + (This one is very important!!!) + Power management options (ACPI, APM) ---> + ->ACPI (Advanced Configuration and Power Interface) Support + (enable all down to Processor and thermal zone) + Bus options (PCI, PCMCIA, EISA, MCA, ISA) ---> + ->[*] PCI Express support + (if using Sangoma PCI Express card) + Networking ---> + Amateur Radio support ---> + <*> Amateur Radio AX.25 Level 2 protocol + [*] AX.25 DAMA Slave support + <*> Amateur Radio NET/ROM protocol + <*> Amateur Radio X.25 PLP (Rose) + (all needed for new Digium Octasic drivers) + Device Drivers ---> + ATA/ATAPI/MFM/RLL support ---> + <*> SCSI emulation support + (needed for SATA drives, also further down check chipset drivers) + Block devices ---> + <*> Loopback device support + <*> RAM disk support + (1) Default number of RAM disks + (128000) Default RAM disk size (kbytes) + [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support + (ONLY USE THE ABOVE 4 SETTINGS IF YOU WILL BE SETTING UP A RAM DRIVE FOR RECORDING) + SCSI device support ---> + <*> RAID Transport Class + (needed if you are using a RAID) + SCSI low-level drivers ---> + <*> Serial ATA (SATA) support + (required if using SATA drives) + (if using a SCSI RAID card pick correct driver here) + Multi-device support (RAID and LVM) ---> + (select proper RAID types if using Linux RAID) + Network device support ---> + Ethernet (10 or 100Mbit) ---> + Ethernet (1000 Mbit) ---> + (select proper drivers for the eype of network card you have) + Character devices ---> + <*> Enhanced Real Time Clock Support + (double-check that this is enabled, very important) + Real Time Clock ---> + <*> RTC class + (double-check that this is enabled, very important) + File systems ---> + <*> Ext3 journalling file system support + (important if using ext3 filesystem) + Library routines ---> + <*> CRC-CCITT functions + <*> CRC16 functions + <*> CRC32c (Castagnoli, et al) Cyclic Redundancy-Check + (important for new Digium Octasic drivers) + EXIT AND SAVE YOUR CONFIGURATION + +10. make clean # clean up the kernel build areas +11. make bzImage # create a kernel bzImage +12. make modules # build the modules into the image +13. make modules_install # install kernel modules +14. cp arch/i386/boot/bzImage /boot/bzImage-XXXX # copy image + (put whatever you want in XXXX, that is your new kernel name) +15. cp System.map /boot/System.map-XXXX # copy system map +16. mv -f /boot/System.map /boot/System.map-orig +17. ln -s /boot/System.map-XXXX /boot/System.map # symlink map +18. vi /etc/lilo.conf # edit the lilo boot config file + image=/boot/bzImage-XXXX # add the new image in above- + label=test-XXXX # the previous one + root=/dev/hda1 # device of root partition + read-only +19. /sbin/lilo # run the lilo reload script +20. shutdown -r 0 # reboot machine and hope it worked + + + +OPTION 2: compile Linux kernel 2.4.33.3 + +1. cd /usr/src/linux # move to your linux source directory +2. cp .config config.save # copy old config to a save file +3. make mrproper # prep for kernel assembly +4. make menuconfig # launch configuration menu app + (this part is very dependant upon your own hardware) + enable processor version # select the processor that you have + enable SMP # if more than 1 processor or Intel HT + enable high memory () # if more than 1GB of RAM + enable SCSI Multiple # if SCSI drives + enable SCSI devices AMI Megaraid # if SCSI Megaraid adapter + enable 3com network devices # if 3com network card + enable ext3 file system # for ext3 to work + enable all ACPI options # for SMP to work + enable Enhanced Real Time Clock Support in Character devices section + # for SMP to work + enable any other hardware specific options + exit and save configuration +5. make dep # build the kernel dependancies +6. make clean # clean up the kernel build areas +7. make bzImage # create a kernel bzImage +8. make modules # build the modules into the image +9. make modules_install # install kernel modules +10. # nothing# mkinitrd /boot/initrd-XXXXXX.img XXXXXX *not needed on Slackware* +11. cp arch/i386/boot/bzImage /boot/bzImage-XXXXXX # copy image + (put whatever you want in XXXXXX, that is your new kernel name) +12. cp System.map /boot/System.map-XXXXXXN # copy system map +13. mv -f /boot/System.map /boot/System.map-orig +14. ln -s /boot/System.map-XXXXXX /boot/System.map # symlink map +15. vi /etc/lilo.conf # edit the lilo boot config file + image=/boot/bzImage-XXXXXX # add the new image in above- + label=test-XXXXXX # the previous one + root=/dev/hda1 # device of root partition + read-only +16. /sbin/lilo # run the lilo reload script +17. shutdown -r 0 # reboot machine and hope it worked + + +After compiling your kernel you can run a few commands to verify that you are +running your new kernel and that devices are running as they are supposed to: + ps --info (will show you your linux kernel version and other info) + cat /proc/cpuinfo (will show you processor type and more than one if SMP) + top (will show you system memory) + + + + +PHASE 3: INSTALLING SOFTWARE BEFORE ASTERISK + +In this step we will be installing software that Asterisk and/or astGUIclient +needs to be able to function to its fullest ability. Not all of these software +packages are manditory to successfully install Asterisk and some of them can be +installed on other machines on your network like MySQL or Apache. But, in this +installation we are assuming that there are no other machines on our network to +help the Asterisk server, so it must have everything it needs installed locally. + + + +SUBPHASE 3.0: install new Gnu Make + +A new version of the "make" compilation application replaced the 4-year-old +version that most Linux distros(Including Slackware) use. This is only needed +if you will be building Asterisk from the 1.4 release tree. + + - wget http://mirrors.kernel.org/gnu/make/make-3.81.tar.gz + - gunzip make-3.81.tar.gz + - tar xvf make-3.81.tar + - cd make-3.81 + - ./configure + - make + - make install + + + +SUBPHASE 3.1: MySQL requirements + +You must at least have Mysql client installed on each VICIDIAL server, but you +only need one database server. + +MySQL is a fast database system that is very easy to integrate with any +application. You can either install the server on the local Asterisk system or +have one somewhere on your network. For our purposes, we are creating an Asterisk +installation that is self contained and needs no other local servers to operate, +so we will need to install mysql on this machine. +*REQUIRED and OPTIONAL* (only install MySQL server locally if you don't want to use an installation +on another machine, Mysql client is required on all VICIDIAL servers) +NOTE: a minimum of MySQL server 4.0.X is required + + Go to http://www.mysql.com/ and download the mysql package + - to install this directly on the command line type: + - cd /usr/local + - wget http://mirror.trouble-free.net/mysql_mirror/Downloads/MySQL-4.0/mysql-4.0.27.tar.gz + # http://mirror.trouble-free.net/mysql_mirror/Downloads/MySQL-5.0/mysql-5.0.41.tar.gz + - gunzip mysql-4.0.27.tar.gz + - tar xvf mysql-4.0.27.tar + - cd mysql-4.0.27 + - groupadd mysql + - useradd -g mysql mysql + - "./configure --prefix=/usr/local/mysql --enable-large-files --enable-shared=yes --with-readline" + **** If only MySQL client is needed for DBD::mysql then use this: + - "./configure --prefix=/usr/local/mysql --without-server --enable-shared=yes --with-readline" + **** If using version 5 tree MySQL client then use this: + - "./configure --prefix=/usr/local/mysql --without-server --enable-shared=yes --with-readline --enable-thread-safe-client" + - make + - make install + - scripts/mysql_install_db + - chown -R root /usr/local/mysql + - chown -R mysql /usr/local/mysql/var + - chgrp -R mysql /usr/local/mysql + - cp support-files/my-medium.cnf /etc/my.cnf + - /usr/local/mysql/bin/mysqld_safe --user=mysql & + - ln -s /tmp/mysql.sock /var/run/mysql/mysql.sock + **** For some systems you may need to add the mysql/bin directory to your PATH: + - PATH=$PATH:$HOME/bin:/usr/local/mysql/bin/ + - export PATH + **** you may also want to add those two lines to your /root/.bash_profile file + **** For Mysql 5 tree only, you also may need to copy the libmysqlclient.so file to libs + - cp /usr/local/mysql-5.0.27/libmysql/.libs/libmysqlclient.so /usr/lib/ + - cp /usr/local/mysql-5.0.27/libmysql/.libs/libmysqlclient.so.15 /usr/lib/ + - you are done + + ** INSTALLATION NOTE ** + If you are having Linuxthreads problems upon onfigure, just execute the following command: + echo '/* Linuxthreads */' >> /usr/include/pthread.h + + ***** NOTE: if you will be using any of the DBI perl scripts: ***** + Every machine that you will be using the newer BDI perl scripts on will need + to have the perl modules DBI and DBD::mysql installed on them. To do this + you will also need to at least have the MySQL client installed on the server + (see above) then you will need to go to 'cpan' and "install DBI" and + "install DBD::mysql". You may need to "force install DBD::mysql" if the DBD + tests fail on your first try, but that is OK since the tests are not needed + + + +SUBPHASE 3.2: Installing Perl Modules + +NOTE - you can install ActiveState http://www.activestate.com perl which may +improve performance, but it is not required. Here's the source for ActiveState +Perl 5.8: (it's free) + http://downloads.activestate.com/ActivePerl/src/5.8/AP817_source.tgz +I hope to add the lengthy steps for installing it as your default perl on your +server but I need some time and a free machine to do that. + +cpan is the "Comprehensive Perl Archive Network". It's a mirrored archive of +most of the perl modules out there complete with a installation and management +command-line interface. Here's what you do to start it: +*REQUIRED* (needed for perl AGIs) + +1. perl -MCPAN -e shell # type in the command line +2. You will then go through CPAN setup, just hit ENTER for most prompts except +for the mirrors list, you will want to select at least 4 mirrors + - yes for manual configuration + - enter for the next 18 prompts + - for the "make install options" it's a good idea to add UNINST=1 + - enter for the next 4 prompts + - select your continent and country + - select a few cpan mirrors + - enter for the next 2 prompts +3. Once you see the cpan> prompt you can begin installing modules +4. If you've never installed cpan before you should probably install the +following modules first: (say YES if asked to install prerequisites) + - install MD5 + - install Digest::MD5 + - install Digest::SHA1 + - install readline (just hit Enter when it asks for operator) + - install Bundle::CPAN + - reload cpan +- then you can install other modules: + - install DBI + - force install DBD::mysql (must at least have mysqlclientlibs installed) + - install Net::Telnet + - install Time::HiRes + - install Net::Server + - install Unicode::Map (needed for super list loader Excel) + - install Jcode (needed for super list loader Excel) + - install Spreadsheet::WriteExcel (needed for super list loader Excel) + - install OLE::Storage_Lite (needed for super list loader Excel) + - install Proc::ProcessTable (needed for super list loader Excel) + - install IO::Scalar (needed for super list loader Excel) + - install Spreadsheet::ParseExcel (needed for super list loader Excel) +- then quit cpan, you are done +5. Go to http://asterisk.gnuinter.net/ and download the asterisk-perl module +(backup link: http://www.freedomphones.net/files/asterisk-perl-0.08.tar.gz) +NOTE: Do NOT use the 0.09 version, it does not work with VICIDIAL + - to install this directly on the command line type: + - cd /usr/local + - wget http://asterisk.gnuinter.net/files/asterisk-perl-0.08.tar.gz + - gunzip asterisk-perl-0.08.tar.gz + - tar xvf asterisk-perl-0.08.tar + - cd asterisk-perl-0.08 + - perl Makefile.PL + - make all + - make install + - you are done + + + +SUBPHASE 3.3: Installing other utilities + +Sox is an audio utility that allows you to mix audio files together at their +start point into one file. it is necessary for Asterisk recordings that record +in and out as separate files +*REQUIRED* (needed for recording mixing) + +1. Go to http://sourceforge.net/projects/sox/ and download the sox package + - to install this directly on the command line type: + - cd /usr/local + - wget http://easynews.dl.sourceforge.net/sourceforge/sox/sox-12.17.9.tar.gz + - gunzip sox-12.17.9.tar.gz + - tar xvf sox-12.17.9.tar + - cd sox-12.17.9 + - ./configure + - make (if alsa.o errors add --disable-alsa-dsp to configure and redo) + - make install + - you are done + + +LAME is an MP3 encoder used to convert audio files from WAV to MP3. We prefer GSM +usually, but some users have standardized on MP3 so they would need this utility +to be loaded to use that option. +*OPTIONAL* (only needed if you will be converting recordings to MP3) + +2. Go to http://lame.sourceforge.net/ and download the lame package + - to install this directly on the command line type: + - cd /usr/local + -wget http://easynews.dl.sourceforge.net/sourceforge/lame/lame-3.96.1.tar.gz + -gunzip lame-3.96.1.tar.gz + -tar xvf lame-3.96.1.tar + -cd lame-3.96.1 + -./configure + -make + -make install + - you are done + + + +Screen is a terminal emulator that allows you to run a process as command line +and be able to detach from them('Ctrl+a' then 'd') and log all output of the +terminal to a screenlog file if desired(add a '-L' to the launching command). +In our installations this is how we launch Asterisk upon startup and still have +the ability to log output and still attach to the screen that executed asterisk +originally. +*REQUIRED* *MANDITORY FOR VICIDIAL SERVERS* + +3. Go to http://www.gnu.org/software/screen/ and download the screen package + - to install this directly on the command line type: + - cd /usr/local + - wget http://ftp.gnu.org/gnu/screen/screen-4.0.2.tar.gz + or for older version: + - wget http://mirrors.kernel.org/gnu/screen/screen-3.9.15.tar.gz + - gunzip screen-4.0.2.tar.gz + - tar xvf screen-4.0.2.tar + - cd screen-4.0.2 + - ./configure + - make + - make install + - you are done + + +ttyload is a simple terminal application that shows the processor load in a +graphical time-based scrolling graph. We use it to view how loaded the system is +and it visualizes load spikes very well +*OPTIONAL* (only for obsessive admins like me) + +4. Go to http://www.daveltd.com/src/util/ttyload/ and download the ttyload +package + - to install this directly on the command line type: + - cd /usr/local + - wget http://www.daveltd.com/src/util/ttyload/ttyload-0.4.4.tar.gz + - gunzip ttyload-0.4.4.tar.gz + - tar xvf ttyload-0.4.4.tar + - cd ttyload-0.4.4 + - make + - ln -s /usr/local/ttyload-0.4.4/ttyload /usr/bin/ttyload + - you are done + + +ntpd is the network time protocol daemon that matches the time on your machine +with the time of a master server somewhere in the world. We use it to make sure +the time is the same on our client computers and our servers. +*MANDITORY FOR VICIDIAL SERVERS* (install on server and all clients) + +5. Go to http://www.ntp.org/ and download the ntpd package + - to install this directly on the command line type: + - cd /usr/local + - wget http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-4.2.2p3.tar.gz + If you get compilation errors here try 4.1.2: + - wget http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.1.2.tar.gz + - gunzip ntp-4.2.2p3.tar.gz + - tar xvf ntp-4.2.2p3.tar + - cd ntp-4.2.2p3 + - ./configure + - make + - make install + - vi /etc/ntp.conf (change to just 1 line: "server 18.145.0.30") + - cp /etc/ntp.conf /etc/ntpd.conf # just to be sure + - /usr/local/bin/ntpdate -u 18.145.0.30 # initial sync + - /usr/sbin/ntpd # run it + - you are done + + +iftop is a good console bandwidth visualization tool that shows you active +connections, where they are going to/from and how much of your precious bandwidth +they are using. *OPTIONAL* +NOTE: another good network analysis utility is "iptraf" and is on most system + +6. Go to http://www.ex-parrot.com/~pdw/iftop/ and download the package + - to install this directly on the command line type: + - cd /usr/local + - wget http://www.tcpdump.org/release/libpcap-0.9.4.tar.gz + - gunzip libpcap-0.9.4.tar.gz + - tar xvf libpcap-0.9.4.tar + - cd libpcap-0.9.4 + - ./configure + - make + - make install + - cd /usr/local + - wget http://www.ex-parrot.com/~pdw/iftop/download/iftop-0.17.tar.gz + - gunzip iftop-0.17.tar.gz + - tar xvf iftop-0.17.tar + - cd iftop-0.17 + - ./configure + - make + - make install + - iftop + - you are done + + +ploticus is a free graph creation package that allows you to create line graphs +within PNG files simply by creating a config file and a data file. We use this +package along with the included PHP script to generate server performance graphs +that can be displayed real-time on a web page. +*OPTIONAL* (only needed for server performance graphing web reports) + +7. Go to http://ploticus.sourceforge.net/ and download the package + - to install this directly on the command line type: + NOTE: you may have to edit the Makefile to remove X11 if you don't have it + - cd /usr/local + - wget http://ploticus.sourceforge.net/download/pl232src.tar.gz + - gunzip pl232src.tar.gz + - tar xvf pl232src.tar + - cd pl232src/src/ + - make clean + - make + - make install + - you are done + NOTE: uncomment these lines to compile on systems without X11: + NOXFLAG = -DNOX11 + XLIBS = + XOBJ = + NOTE: for the graphics to work on the AST_server_performance page you will + need the 'pl' script to be linked or copied into your htdocs/vicidial/ploticus directory + NOTE: you may need to edit the Makefile for ploticus if you do not have X11 + + +openssh is a remote login protocol server that is always a good idea to have +updated on your system, so we're going to install a new version now. +*OPTIONAL* (only updated as a precaution, not manditory) + [NOTE: newer zlib is needed before installing] + +8. Go to http://www.openssh.org/ and download the linux source for openssh + - to install this directly on the command line type: + - cd /usr/local + - wget http://www.zlib.net/zlib-1.2.3.tar.gz + - gunzip zlib-1.2.3.tar.gz + - tar xvf zlib-1.2.3.tar + - cd zlib-1.2.3 + - ./configure + - make + - make install + - cd /usr/local + - wget http://gulus.usherbrooke.ca/pub/appl/ssh/OpenSSH/portable/openssh-4.7p1.tar.gz + - gunzip openssh-4.7p1.tar.gz + - tar xvf openssh-4.7p1.tar + - cd openssh-4.7p1 + - ./configure + - make + - make install + - you are done + + +openssl is the open-source SSL libraries package, and to install a fake SSL cert +locally and have it work with apache, you need it installed on your machine +*OPTIONAL* (only install openssl if you want to use SSL secured web pages on +your locally installed copy of Apache web server) + +9. Go to http://www.openssl.org/ and download the linux source for openssl + - to install this directly on the command line type: + - cd /usr/local + - wget http://www.openssl.org/source/openssl-0.9.8g.tar.gz + - gunzip openssl-0.9.8g.tar.gz + - tar xvf openssl-0.9.8g.tar + - cd openssl-0.9.8g + - ./config + - make + - make install + - you are done + + +apache is a web server that allows you to use many different modules with it to +extend it's functionality. In order to use some of the astguiclient +functionalities we need to have Apache and PHP installed on this machine. +*OPTIONAL* (only install Apache and PHP locally if you don't want to use an +installation on another machine) + +10. Go to http://www.apache.org/ and download the apache unix source + Go to http://www.php.net/ and download the php unix source code + - to install this directly on the command line type: + - cd /usr/local + - wget http://apache.secsup.org/dist/httpd/httpd-2.0.61.tar.gz + - gunzip httpd-2.0.61.tar.gz + - tar xvf httpd-2.0.61.tar + - wget http://us2.php.net/distributions/php-4.4.7.tar.gz + NOTE: PHP 5.1.1 has also been tested with this release + - gunzip php-4.4.7.tar.gz + - tar xvf php-4.4.7.tar + - cd httpd-2.0.61 + - ./configure --enable-so --with-apxs2 + - make + - make install + - cd ../php-4.4.7 + - ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql + - make + - make install + - cp php.ini-dist /usr/local/lib/php.ini + NOTE: you will want to make sure notice logging is turned off: + error_reporting = E_ALL & ~E_NOTICE ; (this is default) +!!! REQUIRED !!! raise the memory limit for scripts in php.ini: + memory_limit = 48M + - vi /usr/local/apache2/conf/httpd.conf + add the following lines: + "AddType application/x-httpd-php .php .phtml" + "LoadModule php4_module libexec/libphp4.so" + or + "LoadModule php4_module modules/libphp4.so" + modify the index.html line and add index.php to the list + - /usr/local/apache2/bin/apachectl start + - go to http://your-new-asterisk-server-ipaddress/ to see if it worked + - you are done + + OPTIONAL- Load eaccelerator PHP-caching application: + - Go to http://eaccelerator.net and download the most recent package + - cd /usr/local + - wget http://bart.eaccelerator.net/source/0.9.5/eaccelerator-0.9.5.zip + - unzip eaccelerator-0.9.5.zip + - cd eaccelerator-0.9.5 + - export PHP_PREFIX="/usr/local" + - $PHP_PREFIX/bin/phpize + - ./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config + - make + - make install + - vi /usr/local/lib/php.ini + Add the following lines to the dynamic extensions section of php.ini: + (you may need to change the extension location depending on your install of php) + extension="../../../usr/local/eaccelerator-0.9.5/modules/eaccelerator.so" + eaccelerator.shm_size="48" + eaccelerator.cache_dir="/tmp/eaccelerator" + eaccelerator.enable="1" + eaccelerator.optimizer="1" + eaccelerator.check_mtime="1" + eaccelerator.debug="0" + eaccelerator.filter="" + eaccelerator.shm_max="0" + eaccelerator.shm_ttl="0" + eaccelerator.shm_prune_period="0" + eaccelerator.shm_only="0" + eaccelerator.compress="1" + eaccelerator.compress_level="9" + - mkdir /tmp/eaccelerator + - chmod 0777 /tmp/eaccelerator + # to verify installation: + - php -v + + + + +balance is a load-balancing application for Linux that will allow you to spread +the load of your web traffic across many servers. If you are running more than +70 agents on a single server you may want to install this application and build +another cheap web server to handle the extra load. +*OPTIONAL* + +11. Go to http://balance.sourceforge.net to download the most recent source version + - to install this directly on the command line type: + - cd /usr/local + - wget http://voxel.dl.sourceforge.net/sourceforge/balance/balance-3.34.tgz + - gunzip balance-3.34.tgz + - tar xvf balance-3.34.tar + - cd balance-3.34 + - make + - make install + - /usr/sbin/balance -f 81 localhost:80 10.10.10.16:80 + That command will take port 81 traffic and send it evenly to the local + server and the 10.10.10.16 server reducing the load and speeding up + the applications. More info on balance: http://www.inlab.de/balance.pdf + + +subversion is the new code control framework use by the Asterisk community. If +you want to use the latest development code of Asterisk you will need to have +this loaded on your system. +*OPTIONAL* + +12. Go to http://subversion.tigris.org to download the most recent source version + - to install this directly on the command line type: + - cd /usr/local + - wget http://subversion.tigris.org/downloads/subversion-1.3.2.tar.gz + - gunzip subversion-1.3.2.tar.gz + - tar xvf subversion-1.3.2.tar + - cd subversion-1.3.2 + - ./configure + - make + - make install + + +mtop is a great utility for real-time monitoring of mysql and the queries that +are running in it. +*OPTIONAL* + 13. Go to http://mtop.sourceforge.net to download the most recent version + - to install this directly on the command line type: + - cd /usr/local + - wget http://superb-east.dl.sourceforge.net/sourceforge/mtop/mtop-0.6.6.tar.gz + - gunzip mtop-0.6.6.tar.gz + - tar xvf mtop-0.6.6.tar + - cd mtop-0.6.6 + - cpan + - install Curses + - install Getopt::Long + - install Net::Domain + - quit + - perl Makefile.PL + - make + - make install + - /usr/local/bin/mtop --dbuser=root --seconds=3 + + +sipsak is an optional utility that VICIDIAL can use to send messages to an +agent's SIP-based phone(like the Snom 320) to display text on their LCD screen. +If you want to use this, make sure it is installed on the same server that your +web server is installed on(Apache). +*OPTIONAL* + 14. Go to http://sipsak.org to download the most recent version + - to install this directly on the command line, type: + - cd /usr/local + - wget http://download.berlios.de/sipsak/sipsak-0.9.6-1.tar.gz + - gunzip sipsak-0.9.6-1.tar.gz + - tar xvf sipsak-0.9.6-1.tar + - cd sipsak-0.9.6-1 + - ./configure + - make + - make install + - /usr/local/bin/sipsak --version + + + + + +PHASE 4: INSTALLING ASTERISK + +OK, all the prep work is done, now it's time to start having fun with Asterisk. +There are two basic ways to install Asterisk, an official release(at the time of +this writing the official release is 1.2.24) and the SVN_DEV version(development +branch). We recommend using Asterisk 1.2.24. These instructions are how we get +our Asterisk system with it's T1 line installed with our 2 SIP VOIP devices and +one IAX2 softphone. + +NOTE: If you want to use Asterisk 1.4, you will need to make sure that you set +the servers table "asterisk_version" field to the proper version number and you +can use the docs/conf_examples/extensions.conf.sample-1.4 file for your default +dialplan + +NOTE: If you want to use release 1.0.8 or 9 we would recommend either using the +CVS_v1-0 branch where the issues are fixed, or patching your 1.0.8/1.0.9 code +with the following patch: +(http://astguiclient.sourceforge.net/experimental_code/localmasq.patch) +- If you do patch your system make sure you put the asterisk version + field for the server on the admin pages as '1.0.11.1' + +1. follow these command line steps: + - mkdir /usr/src/asterisk + - cd /usr/src/asterisk + A. if you want 1.2 release (reliable with new features): + - wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.2.24.tar.gz + - wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.2.21.tar.gz + - wget http://ftp.digium.com/pub/libpri/releases/libpri-1.2.5.tar.gz + - gunzip asterisk-1.2.24.tar.gz + - tar xvf asterisk-1.2.24.tar + - gunzip zaptel-1.2.21.tar.gz + - tar xvf zaptel-1.2.21.tar + - gunzip libpri-1.2.5.tar.gz + - tar xvf libpri-1.2.5.tar + B. if you want latest SVN_1.2 version (release tree with new patches) + - svn checkout http://svn.digium.com/svn/asterisk/branches/1.2 asterisk-1.2 + - svn checkout http://svn.digium.com/svn/zaptel/branches/1.2 zaptel-1.2 + - svn checkout http://svn.digium.com/svn/libpri/branches/1.2 libpri-1.2 + C. if you want latest SVN_DEV version (not recommended) [1.6 tree] + - svn checkout http://svn.digium.com/svn/asterisk/trunk asterisk + - svn checkout http://svn.digium.com/svn/zaptel/trunk zaptel + - svn checkout http://svn.digium.com/svn/libpri/trunk libpri + - ALL -> + - (1.0 tree)if you want to allow for more than 100 voicemail messages in a + mailbox(warning this will slightly increase memory usage when a call + is in voicemail) edit the voicemail source code file: + - vi /usr/src/asterisk/asterisk/apps/app_voicemail.c + edit this line and change 100 to 999: + #define MAXMSG 100 + - (1.0 tree)if you have no X server installed on your Asterisk machine, then you + will need to comment out the gtk console lib(only affects 1.0 releases) + edit the voicemail source code file: + - vi /usr/src/asterisk/asterisk/pbx/Makefile + edit this line at the top and just add a hash # in front of it as shown: + #PBX_LIBS+=$(shell $(CROSS_COMPILE_BIN)gtk-config --cflags >/dev/null 2>/dev/null && echo "pbx_gtkconsole.so") + + - cd ./zaptel-1.2.21 + - make clean + - make + - make install + - cd ../libpri-1.2.5 + - make clean + - make + - make install + - cd ../asterisk-1.2.24 + - (1.2 tree) If you want to include Answering Machine Detection ability + you will need to download app_amd.c and amd.conf and alter the + apps/Makefile to compile it properly + - cd apps + - wget http://www.eflo.net/files/app_amd2.c + - mv app_amd2.c app_amd.c + - vi Makefile + replace this line(line 32): + app_mixmonitor.so app_stack.so + with this line: + app_mixmonitor.so app_stack.so app_amd.so + - wget http://www.eflo.net/files/amd2.conf + - mkdir /etc/asterisk + - mv amd2.conf /etc/asterisk/amd.conf + *OPTIONAL*(1.2.23 thru 1.2.24) apply the meetme DTMF passthru patch + - wget http://www.eflo.net/files/meetme_DTMF_passthru-1.2.23.patch + - patch -p1 < ./meetme_DTMF_passthru-1.2.23.patch + - File to patch: app_meetme.c + *OPTIONAL*(1.2.12.1 thru 1.2.24) apply the meetme volume control patch + *Different patches available for 1.2.7.1 through 1.2.14 + - wget http://www.eflo.net/files/meetme_volume_control_1.2.16.patch + - patch -p1 < ./meetme_volume_control_1.2.16.patch + - File to patch: app_meetme.c + - cd ../ + + -(1.2 tree) apply the cli delimiter patch + - wget http://www.eflo.net/files/cli_chan_concise_delimiter.patch + - patch -p1 < ./cli_chan_concise_delimiter.patch + - File to patch: cli.c + + *OPTIONAL*(1.2.14 thru 1.2.24) rewrite of waitforsilence + - wget http://www.eflo.net/files/app_waitforsilence.c + - mv app_waitforsilence.c apps/app_waitforsilence.c + + *OPTIONAL* shorter enter and leave sounds for meetme + - wget http://www.eflo.net/files/enter.h + - wget http://www.eflo.net/files/leave.h + - mv -f enter.h apps/enter.h + - mv -f leave.h apps/leave.h + + + - make clean + - make + - make install + - make samples # this makes sample conf files (only use for new installs) + + - modprobe zaptel # this loads the zaptel module + - install the module for the digium device that you are using, we are +using the T100P single span T1 card so we use: + - modprobe wct1xxp + Here's the list of all digium cards and the modules you use with +them: + Card Module + ----------------- + TDM400P wctdm + X100P wcfxo + TDM* wcfxs + S100U wcusb + T100P wct1xxp + E100P wct1xxp + T400P tor2 + E400P tor2 + TE110P wcte11xp + TE410P wct4xxp + TE405P wct4xxp + TE411P wct4xxp + TE406P wct4xxp + TE210P wct2xxp + TE205P wct2xxp + TDM2400P wctdm24xxp + - If you have chosen a Sangoma T1/E1 or analog card, you will need to + follow their instructions for installation of their driver software + LATEST Sangoma Wanpipe drivers: + ftp://ftp.sangoma.com/linux/current_wanpipe/wanpipe-3.2.1.tgz + - now your asterisk installation is built and loaded and it's time to +configure it. + +NOTES: If you want to install zttool diagnostics you may need the newt package installed: + - wget http://www.freedomphones.net/files/newt-0.51.6.tar.gz + - gunzip newt-0.51.6.tar.gz + - tar xvf newt-0.51.6.tar + - cd newt-0.51.6 + - ./configure + - make + - make install + - cd ../ + - ln -s /usr/lib/libnewt.so.0.51.6 /usr/lib/libnewt.so.0.51 +then go to your zaptel folder and do 'make zttool' + +Digium/Clone X100P EXAMPLE: +Here is an example of a configuration where an X100P single FXO card is used for +zaptel timing and not used for calling: + +NOTE: you can get an X100P through ebay for $10-$30 that will work with Asterisk + + /etc/zaptel.conf: + loadzone=us + defaultzone=us + fxsks=1 + + /etc/asterisk/zapata.conf: + [trunkgroups] + [channels] + context=unused + signalling=fxs_ks + channel => 1 + + Added this to the rc.local file: + # Load zaptel drivers for x100p + modprobe zaptel + modprobe wcfxo + +If you will be doing native music-on-hold for your inbound calls, you will need +musiconhold audio files to be converted to native formats like GSM, ULAW and ALAW: + + cd /var/lib/asterisk/mohmp3/ + mpg123 -s --rate 44100 --mono /var/lib/asterisk/mohmp3/fpm-sunshine.mp3 > /var/lib/asterisk/mohmp3/fpm-sunshine.raw + sox -r 44100 -w -s -c 1 fpm-sunshine.raw -r 8000 -c 1 fpm-sunshine.wav + sox fpm-sunshine.wav -t gsm -r 8000 -b -c 1 fpm-sunshine.gsm + sox fpm-sunshine.wav -t ul -r 8000 -b -c 1 fpm-sunshine.pcm + mpg123 -s --rate 44100 --mono /var/lib/asterisk/mohmp3/fpm-calm-river.mp3 > /var/lib/asterisk/mohmp3/fpm-calm-river.raw + sox -r 44100 -w -s -c 1 fpm-calm-river.raw -r 8000 -c 1 fpm-calm-river.wav + sox fpm-calm-river.wav -t gsm -r 8000 -b -c 1 fpm-calm-river.gsm + sox fpm-calm-river.wav -t ul -r 8000 -b -c 1 fpm-calm-river.pcm + mpg123 -s --rate 44100 --mono /var/lib/asterisk/mohmp3/fpm-world-mix.mp3 > /var/lib/asterisk/mohmp3/fpm-world-mix.raw + sox -r 44100 -w -s -c 1 fpm-world-mix.raw -r 8000 -c 1 fpm-world-mix.wav + sox fpm-world-mix.wav -t gsm -r 8000 -b -c 1 fpm-world-mix.gsm + sox fpm-world-mix.wav -t ul -r 8000 -b -c 1 fpm-world-mix.pcm + rm -f *.raw + mkdir ../orig-mp3 + mv -f *.mp3 ../orig-mp3/ + + + +PHASE 5: CONFIGURING ASTERISK AND YOUR SIP PHONES + +In this phase we will configure the telco lines, the SIP phones, the extensions, +meetme(conference calling) rooms, dialplan extensions and the voicemail boxes. +After this phase your Asterisk system should be able to place and receive calls +to and from the SIP phones you have installed over the telco lines you've hooked +up. There are several things that we will not be showing how to do because +Asterisk is extremely flexible and has so many different ways of being +configured, that if we were to try to explain them all in this document it would +be 99% asterisk configuration and be 20,000 lines long, and that would +just be a barrier for those who just want to get it set up. The "Wiki" and the +mailing list are two very good resources for finding answers if you run into +problems configuring your system, here are links to them: +The Wiki: http://www.voip-info.org/tiki-index.php +The Lists: http://www.asterisk.org/index.php?menu=support + +I need to note that it is possible to install Asterisk and use astGUIclient +applications with no Zaptel(Digium) cards installed, but it is not recommended +even if you are not going to use Zap trunks for your inbound-outbound calls +with no real Zap devices, you would need to use a dummy timer(zt_dummy) based +on you USB ports to get meetme conference rooms working properly and you may +have other issues along the way. We would at least recommend getting a X100 or +X101 board from Digium or a clone manufacturer so there is a dedicated hardware +timer in place on your system. + + + +SUBPHASE 5.0: setting up your Asterisk configuration files + +1. edit zaptel.conf + - vi /etc/zaptel.conf + There are many examples inside of the zaptel.conf file that is +generated with the "make samples" command that we issued at the end +of the last phase. There are many different parameters for the +different telco line possibilities, because we are installing a T1 +that is NON-PRI-isdn B8ZS ExtendedSuperframe(ESF) E&M Wink start and 24 +channels, we will use the following settings for zaptel.conf: + span=1,1,0,esf,b8zs + e&m=1-24 + loadzone = us + defaultzone=us + FOR A PRI YOU WOULD USE SOMETHING LIKE THIS: + span=2,2,0,esf,b8zs + bchan=25-47 + dchan=48 + +2. edit zapata.conf + - vi /etc/asterisk/zapata.conf + There are also many examples of how to configure zapata.conf online. +we decided to separate our T1 into two line groups to keep some +incoming calls from being busy if we filled up all of our lines. +Here's what we used(you can set echocancel=no if you are using PRIs): + [channels] + group=1 + language=en + signalling=em_w + usecallerid=yes + callerid=asreceived + context=default + echocancel=64 + echocancelwhenbridged=yes + rxgain=1.0 + txgain=1.0 + channel => 1-2 + group=2 + language=en + signalling=em_w + usecallerid=yes + callerid=asreceived + context=default + echocancel=64 + echocancelwhenbridged=yes + rxgain=1.0 + txgain=1.0 + channel => 3-24 + FOR A PRI YOU WOULD USE SOMETHING LIKE THIS: + group=3 + language=en + signalling=pri_net + usecallerid=yes + callerid=asreceived + callprogress=no + busydetect=no + context=default + echocancel=64 + echocancelwhenbridged=yes + rxgain=1.0 + txgain=1.0 + channel => 25-47 + +3. edit sip.conf + - vi /etc/asterisk/sip.conf + here is where we will edit the configuration of our SIP compatible +phone devices. As stated at the beginning, we will be setting up a +Grandstream Budgetone 102 phone and a Sipura SPA-2000 adapter with +two analog phones connected(each with it's own extension). Here are +the settings we used to set each of them up: + [general] + port = 5060 + bindaddr = 0.0.0.0 + context = default + ; register SIP account on remote machine if using SIP trunks + ; register => testSIPtrunk:test@10.10.10.16:5060 + ; + ; setup account for SIP trunking: + ; [SIPtrunk] + ; disallow=all + ; allow=ulaw + ; allow=alaw + ; type=friend + ; username=testSIPtrunk + ; secret=test + ; host=10.10.10.16 + ; dtmfmode=inband + ; qualify=1000 + + [gs102] + disallow=all + allow=ulaw + allow=alaw + type=friend + username=gs102 + secret=test + host=dynamic + dtmfmode=inband + defaultip=10.10.10.16 + qualify=1000 + mailbox=102 + [spa2000] + disallow=all + allow=ulaw + allow=alaw + type=friend + username=spa2000 + secret=test + host=dynamic + dtmfmode=inband + defaultip=10.10.10.17 + qualify=1000 + mailbox=2000 + [spa2001] + disallow=all + allow=ulaw + allow=alaw + type=friend + username=spa2001 + secret=test + host=dynamic + dtmfmode=inband + defaultip=10.10.10.17 + qualify=1000 + mailbox=2001 +4. edit meetme.conf + - vi /etc/asterisk/meetme.conf + This is known as the conference calling configuration file. We are +just going to add two conferences(one without a pin number and one +with a pin number required for entry): + [rooms] + conf => 8600 + conf => 8601,1234 +5. edit iax.conf (only to do IAX trunks, not required) + - vi /etc/asterisk/iax.conf + This is the IAX configuration file, below is a very simple config for + having two Asterisk servers connect natively to each other, if you + will be using this, make sure to add the optional lines included + after the extensions.conf section. Also, there is an account setup + here for a firefly IAX softphone to use.(details on that later) + * IMPORTANT NOTE * if you plan to use IAX2 trunks for VICIDIAL + outbound dialing you must register with the remote IAX2 server + through the iax.conf file, not just in the Dial or TRUNK line + of the extensions.conf dialplan. + [general] + bindport=4569 + iaxcompat=yes + bandwidth=high + allow=all + allow=gsm ; Always allow GSM, it's cool :) + jitterbuffer=no + tos=lowdelay + register => ASTtest1:test@10.10.10.16:4569 + + [ASTtest2] + type=friend + accountcode=IAXtrunk2 + context=default + auth=plaintext + host=dynamic + permit=0.0.0.0/0.0.0.0 + secret=test + disallow=all + allow=ulaw + qualify=yes + + [firefly01] + type=friend + accountcode=firefly01 + context=default + auth=plaintext + host=dynamic + permit=0.0.0.0/0.0.0.0 + secret=test + disallow=all + allow=gsm + qualify=yes + +##### EXAMPLE - This is a config example for setting up Binfone service(http://www.binfone.com) + +NOTE: The "1112223333" is your iax username. When you signup, Binfone creates +a default IAX username for you, (a 5 digit number, usually, starting with a 1). +This works for most customers. Folks that want inbound then also sign up for +DIDs, each of which has its own IAX username. (Which is the 10 digit DID). +Each username has its own password which is managed through their web interface. + +NOTE: If you will be using the G729 codec through binfone there is now a +dedicated G729 gateway that only handles G729 calls. Please use this address to +register to if you plan on using G729 as your codec: iax-g729.binfone.com + + iax.conf: + [general] + register => 1112223333:PASSWORD@iax.binfone.com + + [1112223333] + auth=md5 + type=friend + username=1112223333 + secret=PASSWORD + host=iax.binfone.com + context=incoming-IAX-context-in-extensions.conf + + + extensions.conf: + [global] + TRUNKBINFONE=IAX2/1112223333:PASSWORD@iax.binfone.com ; IAX trunk interface + + [default] + exten => _91NXXNXXXXXX,1,AGI(AGI(agi://127.0.0.1:4577/call_log) + exten => _91NXXNXXXXXX,2,Dial(${TRUNKIAX}/${EXTEN},55,o) + exten => _91NXXNXXXXXX,3,Hangup + + [incoming] + exten => 1112223333,1,AGI(AGI(agi://127.0.0.1:4577/call_log) + exten => 1112223333,2,Dial(sip/gs102,55,o) + exten => 1112223333,3,Hangup + + + dnsmgr.conf: # It is very helpful to enable dnsmgr + [general] + enable=yes ; enable creation of managed DNS lookups + refreshinterval=300 ; refresh managed DNS lookups every seconds + + +##### END EXAMPLE + + +6. edit voicemail.conf + - vi /etc/asterisk/voicemail.conf + This is where we set up the voicemail boxes for the extensions that +we have set up: + [general] + format=wav49|gsm|wav + serveremail=asterisk + attach=yes + skipms=3000 + maxsilence=10 + silencethreshold=128 + maxlogins=3 + [zonemessages] + eastern=America/New_York|'vm-received' Q 'digits/at' IMp + central=America/Chicago|'vm-received' Q 'digits/at' IMp + central24=America/Chicago|'vm-received' q 'digits/at' H 'digits/hundred' M 'hours' + [default] + 102 => 102,Grandstream Mailbox,root@localhost + 2000 => 2000,Sipura Mailbox 1 + 2001 => 2001,Sipura Mailbox 2 + 3001 => 3001,Firefly Mailbox 1 +7. edit manager.conf + - vi /etc/asterisk/manager.conf + This is where we set up remote logins to the asterisk manager +interface, to allow sending of Action commands from remote +connections to the Asterisk server, this will be important for the +astguiclient applications so let's set that up now: + [general] + enabled = yes + port = 5038 + bindaddr = 0.0.0.0 + [cron] + secret = 1234 + read = system,call,log,verbose,command,agent,user + write = system,call,log,verbose,command,agent,user + [updatecron] + secret = 1234 + read = command + write = command + [listencron] + secret = 1234 + read = system,call,log,verbose,command,agent,user + write = command + [sendcron] + secret = 1234 + read = command + write = system,call,log,verbose,command,agent,user + +8. edit logger.conf + - vi /etc/asterisk/logger.conf + This file determines the messages that are logged to the console and +the /var/log/asterisk/messages file. We usually turn on full logging +to the messages file to more easily diagnose any problems that we may +run into, the problem with this is that is does produce very large +files, so be warned: + [logfiles] + console => notice,warning,error + messages => notice,warning,error,debug,verbose +9. edit extensions.conf + - vi /etc/asterisk/extensions.conf + This is known as the dialplan. Since we are installing a +Long-Distance T1 with one 800 number on it, we will need to put that +800 number in the plan, as well as how to dial out through the T1 +lines and we will need to add an entry for each of the phones that we +have just set up in the sip.conf file. There are many examples both +in the sample file and online for what to put in your dialplan, here +is the simplified dialplan that we are using: +######------ START extensions.conf example ------###### +[general] +static=yes +writeprotect=no + +[globals] +CONSOLE=Console/dsp ; Console interface for demo +TRUNK=Zap/g1 ; Trunk interface +TRUNKX=Zap/g2 ; 2nd trunk interface +TRUNKIAX=IAX2/ASTtest1:test@10.10.10.16:4569 ; IAX trunk interface + +[default] +; Extension 8600 + 8601 conference rooms +exten => 8600,1,Meetme,8600 +exten => 8601,1,Meetme,8601 + +; Extension 102 - Grandstream hardphone +exten => 102,1,Playback,transfer|skip ; "Please hold while..." +exten => 102,2,Dial,sip/gs102|20|to ; Ring, 20 secs max +exten => 102,3,Voicemail,u102 ; Send to voicemail... +; Extension 2000 Sipura line 1 +exten => 2000,1,Dial,sip/spa2000|30|to ; Ring, 30 secs max +exten => 2000,2,Voicemail,u2000 ; Send to voicemail... +; Extension 2001 Sipura line 2 +exten => 2001,1,Dial,sip/spa2001|30|to ; Ring, 30 secs max +exten => 2001,2,Voicemail,u2001 ; Send to voicemail... +; Extension 2020 rings both sipura lines +exten => 2001,1,Dial,sip/spa2000&sip/spa2001|30|to ; Ring, 30 secs max +exten => 2001,2,Voicemail,u2000 ; Send to voicemail... +; Extension 301 rings the firefly softphone +exten => 301,1,Dial,(IAX2/firefly01@firefly01/s) +exten => 301,2,Hangup + +; Extension 3429 - Inbound 800 number (1-800-555-3429) +exten => _**3429,1,Ringing +exten => _**3429,2,Answer +exten => _**3429,3,Dial,sip/spa2000&sip/spa2001|30|to ; Ring, 30 secs max +exten => _**3429,4,Voicemail,u2000 ; Send to voicemail... +; Extension 3429 - with ANI [callerID] +exten => _*NXXNXXXXXX*3429,1,Ringing +exten => _*NXXNXXXXXX*3429,2,Answer +exten => _*NXXNXXXXXX*3429,3,Dial,sip/spa2000&sip/spa2001|30|to ; Ring, 30 +secs max +exten => _*NXXNXXXXXX*3429,4,Voicemail,u2000 ; Send to voicemail... + +; dial a long distance outbound number to the UK +exten => _901144XXXXXXXXXX,1,Dial(${TRUNKX}/${EXTEN:1},55,tTo) +exten => _901144XXXXXXXXXX,2,Hangup + +; dial a long distance outbound number to Australia +exten => _901161XXXXXXXXX,1,Dial(${TRUNKX}/${EXTEN:1},,tTo) +exten => _901161XXXXXXXXX,2,Hangup + +; dial an 800 outbound number +exten => _91800NXXXXXX,1,Dial(${TRUNK}/${EXTEN:1},,tTo) +exten => _91800NXXXXXX,2,Hangup +exten => _91888NXXXXXX,1,Dial(${TRUNK}/${EXTEN:1},,tTo) +exten => _91888NXXXXXX,2,Hangup +exten => _91877NXXXXXX,1,Dial(${TRUNK}/${EXTEN:1},,tTo) +exten => _91877NXXXXXX,2,Hangup +exten => _91866NXXXXXX,1,Dial(${TRUNK}/${EXTEN:1},,tTo) +exten => _91866NXXXXXX,2,Hangup + +; dial a local 727 outbound number with area code +exten => _9727NXXXXXX,1,Dial(${TRUNK}/1${EXTEN:1},,tTo) +exten => _9727NXXXXXX,2,Hangup + +; dial a local 813 outbound number with area code +exten => _9813NXXXXXX,1,Dial(${TRUNK}/${EXTEN:1},,tTo) +exten => _9813NXXXXXX,2,Hangup + +; dial a long distance outbound number +exten => _91NXXNXXXXXX,1,Dial(${TRUNKX}/${EXTEN:1},,tTo) +exten => _91NXXNXXXXXX,2,Hangup + +; dial a local outbound number (modified because of only LD T1) +exten => _9NXXXXXX,1,Dial(${TRUNK}/1727${EXTEN:1},,tTo) +exten => _9NXXXXXX,2,Hangup + +; barge monitoring extension +exten => 8159,1,ZapBarge +exten => 8159,2,Hangup + +; # timeout invalid rules +exten => #,1,Playback(invalid) ; "Thanks for trying the demo" +exten => #,2,Hangup ; Hang them up. +exten => t,1,Goto(#,1) ; If they take too long, give up +exten => i,1,Playback(invalid) ; "That's not valid, try again" + +; Give voicemail at extension 8500 +exten => 8500,1,VoicemailMain +exten => 8500,2,Goto(s,6) + +; ASTERISK AGENTS LOGINS FOR QUEUES (NOT part of VICIDIAL) +; the following assumes phone agent login and exten are 3 digits and the same +; also assumes that 3-digit login is present in agents.conf and queueus.conf +;Agent Logout then stay onhook, DIAL 54 + 3-digit ID +exten => _54XXX,1,AgentCallbackLogin(||) +; the following are used to login and logout of Asterisk Queues from phone +;Agent Login then stay offhook on the phone, DIAL 55 + 3-digit ID +exten => _55XXX,1,AgentLogin(${EXTEN:1}) +;Agent Login then stay onhook, phones will ring, DIAL 56 + 3-digit ID +exten => _56XXX,1,AgentCallbackLogin(||${EXTEN:1}@default) + +######------ END extensions.conf example ------###### + +### OPTIONAL IAX trunk extensions entries for long distance dialing over IAX + exten => _91NXXNXXXXXX,1,AGI(AGI(agi://127.0.0.1:4577/call_log) + exten => _91NXXNXXXXXX,2,Dial(${TRUNKIAX}/${EXTEN},55,o) + exten => _91NXXNXXXXXX,3,Hangup + +### OPTIONAL SIP trunk extensions entries for long distance dialing over SIP + exten => _91NXXNXXXXXX,1,AGI(AGI(agi://127.0.0.1:4577/call_log) + exten => _91NXXNXXXXXX,2,Dial(sip/${EXTEN}@SIPtrunk,55,o) + exten => _91NXXNXXXXXX,3,Hangup + +### OPTIONAL IAX Load Balance extens to allow for Overflow and Balanced VDAD +### In this setup, the serverIP is the prefix followed by agent conf_exten +### FOR MORE INFORMATION, READ THE LOAD_BALANCING.txt DOCUMENT +### server 1 extens: + exten => _010*010*010*016*8600XXX,1,Dial(${TRUNKIAX2}/${EXTEN:16},55,o) + exten => _010*010*010*016*78600XXX,1,Dial(${TRUNKIAX2}/${EXTEN:16},55,o) +### server 2 extens: + exten => _010*010*010*015*8600XXX,1,Dial(${TRUNKIAX1}/${EXTEN:16},55,o) + exten => _010*010*010*015*78600XXX,1,Dial(${TRUNKIAX1}/${EXTEN:16},55,o) + +10. edit dnsmgr.conf: # It is very helpful to enable dnsmgr + [general] + enable=yes ; enable creation of managed DNS lookups + refreshinterval=300 ; refresh managed DNS lookups every seconds + + +11. Now that you have configured Asterisk, it is time to try to start it for the +first time. + - First make sure that your T1 line(or other telco line) is connected to the +digium card. + - next type the following at the command prompt: "ztcfg -vvvvvv" + - you should see a confirmation that the Zaptel device has loaded + - now you can launch asteris with the following command: + "asterisk -vvvvvvvvvvvvgc" + - you should see a lot of messages scroll by and at the end you should +be given a CLI> prompt if everything loaded OK. To get out of Asterisk you can +type "stop now". Now that you are sure it is running you can either run it in a +separate terminal window or use the start_asterisk_boot.pl that you will +install with astguiclient to start Asterisk. + + + +SUBPHASE 5.1: setting up your SIP phones + +You will need to follow the instructions for the phones that you are using with +your system, but here's the way to set up a Grandstream 102 and a Sipura +SPA-2000 + +1. Here are basic instructions for setting up a Grandstream BT 102: + - On the phone plug it in to power only at first and follow these +instructions: + - wait for the phone to boot up and press the MENU button + - go through the menu screens with the menu key and the up/down arrow +keys to move from setting to setting. We are setting the following +values: + - DHCP OFF + - IP Addr: 010.010.010.016 + - Subnet: 255.255.000.000 + - router: 010.010.010.001 + - dnS: 010.010.010.001 + - tftp: we leave this blank for now + - menu 7 we change the codec to G-711u + - now wait 10 seconds and unplug the power and plug it back in + - you can also plug the network cable into the LAN port on the phone + - at this time you can go to your workstation and open a new web browser + - go to http://10.10.10.16/ the password is "admin" + - here is where you will enter in the configuration details for the +phone to register with the Asterisk server + - SIP server: 10.10.10.15 + - SIP user ID: gs102 + - Authenticate ID: gs102 + - Password: test + - Name: gs102 + - Voice Mail UserID: 102 + - Send DTMF: in-audio + - NTP Server: tick.mit.edu + - then click update, click review changes, and click reboot + - your phone should now be able to register with the Asterisk server. If you +still have your console screen up you should see a registration message +appear telling you that gs102 has registered. + +2. Here are the basic instructions for setting up a Sipura SPA-2000 analog +adapter with 2 lines. + - Plug power and two analog phones into the adapter. + - pick up the phone plugged into line1 and press **** to enter admin menu + - press 101# then 0# to disable DHCP + - press 111# then 10*10*10*17# to change the IP address + - press 121# then 255*255*0*0# to change the subnet mask + - press 131# then 10*10*10*1# to change the default gateway + - hang up the phone, unplug the power, plug in the network cable and plug in +the power cable + - now you can go the the admin website: http://10.10.10.17/admin/advanced + - you will need to make these setting changes: + - click on the "Line 1" tab at the top and change the following values: + - Proxy: 10.10.10.15 + - Display Name: spa2000 + - userID: spa2000 + - password: test + - authID: spa2000 + - change the dialplan to the following: +(*xx|xxx|xxxx|xxxxx|xxxxxx|xxxxxxx|xxxxxxxx|xxxxxxxxxxx|xxxxxxxxxxxx|xxxxxxxxxxxxxxx|xxxxxxxxxxxxxxxx.) + - then click the "submit all changes" button at the bottom of the page +and your first phone line should work now + - to register the second line, simply click on the "Line 2" tab and go +through the above steps except use spa2001 instead of spa2000 for the use IDs + +3. Now both of your phone devices are set up and you can try making phone calls +between the three phones + + + +SUBPHASE 5.2: setting up an IAX2 phone + +This is optinal and we won't go into too much detail about this, but currently +there are several IAX hard and softphones on the market and more are coming +every month. Follow the instructions with the IAX phone you have chosen and +follow the steps below: + +1. Add an entry into your iax.conf file like below if you have not already + [firefly01] + type=friend + accountcode=firefly01 + context=default + auth=plaintext + host=dynamic + permit=0.0.0.0/0.0.0.0 + secret=test + qualify=yes + +2. Add an entry into your extensions.conf file like below if it is not in there + ; Extension 3001 rings IAX phone + exten => 301,1,Dial(IAX2/firefly01@firefly01/s) + exten => 301,2,Voicemail,u301 ; Send to voicemail... + +3. Download Firefly 3rd party, or IDEfisk for Windows or Linux: + - http://www.virbiage.com/firefly/download/firefly-thirdparty.exe + MIRRORS: + - http://mirror.isp.net.au/ftp/pub/firefly/firefly-thirdparty.exe + - http://www.freedomphones.net/files/firefly-thirdparty.exe + IDEFISK: + - http://www.asteriskguru.com/idefisk/ + - Install the application + - Launch Firefly Softphone + - click the "I wish to connect to a 3rd party network" button + - Enter in network name: Asterisk + - Select IAX2 as the protocol + - enter in your server address: "10.10.10.15" in our case + - enter login and pass: "firefly01" and "test" for in our case + - click OK and you should be logged in and can place calls + + +SUBPHASE 5.3: setting up a Zap phone + +This is optinal and we won't go into too much detail about this either, there +are a few ways to use Zap devices as phones on your Asterisk system: Zaptel +phone cards, Channel Banks going through Zaptel T1 card, outside line call +coming in going through Zaptel line card. There isn't much to do but set your +Zaptel config files up and put entries into your extensions.conf file: + +1. Add an entry into your extensions.conf file like below + ; Extension 4001 rings Zap phone + exten => 4001,1,Dial,Zap/1|30| ; ring Zap device 1 + exten => 4001,2,Voicemail,u4001 ; Send to voicemail... + + + + +PHASE 6: INSTALLING ASTGUICLIENT AND VICIDIAL + +Now that Asterisk is installed and running we can add the astGUIclient and +VICIDIAL components to the system. + + + +SUBPHASE 6.0: putting the files in place + +There are two methods for downloading astGUIclient/VICIDIAL, a release and SVN + +1. Go to http://astguiclient.sf.net/ and download the latest astguiclient +package(as of this writing it is 2.0.4) + - for 2.0.X release: + - mkdir /usr/src/astguiclient + - cd /usr/src/astguiclient + - wget http://internap.dl.sourceforge.net/sourceforge/astguiclient/astguiclient_2.0.4.zip + - unzip astguiclient_2.0.4.zip + - perl install.pl (make sure you are in the directory with the install.pl file) + - for SVN 2.0 trunk: + - mkdir /usr/src/astguiclient + - cd /usr/src/astguiclient + - svn checkout svn://svn.eflo.net:43690/agc_2-X/trunk + - cd trunk + - perl install.pl + select to do interactive setup and customize to your server + - there is one more file you need that's not included with the download +package, it's the conf.gsm file(this is the half-hour music file that we use +to put people on hold). I have a free classical music file that is available +free for download at the following two sites: + http://www.freedomphones.net/conf.gsm + http://astguiclient.sf.net/conf.gsm + Once you have downloaded it, you will need to copy it to this folder: + /var/lib/asterisk/sounds/ + Then you will need to execute this command to copy it as the park file + 'cp /var/lib/asterisk/sounds/conf.gsm /var/lib/asterisk/sounds/park.gsm' + Here are the steps spelled out: + - cd /var/lib/asterisk/sounds + - wget http://www.freedomphones.net/conf.gsm + - cp conf.gsm park.gsm + + - you are done + + + +SUBPHASE 6.1: creating the MySQL "asterisk" database + +we will create the database and add a few initial records so that we can +use the administrative web interface. Since this is a new install it is easier +to use our new mysql script file to add the tables to the database: + +1. at the command prompt type go to the mysql client: +/usr/local/mysql/bin/mysql +2. type the following into the mysql client prompt: + (make sure you put your IP address in place of "10.10.10.15" in the queries below) +######------ BEGIN Mysql data entry(you can copy and paste this into terminal) # +create database asterisk; + +GRANT SELECT,INSERT,UPDATE,DELETE,LOCK TABLES on asterisk.* TO cron@'%' IDENTIFIED BY '1234'; +GRANT SELECT,INSERT,UPDATE,DELETE,LOCK TABLES on asterisk.* TO cron@localhost IDENTIFIED BY '1234'; + +# NOTE: if using MySQL 4.1.12 or higher you may need to run this query too: +UPDATE mysql.user set password=OLD_PASSWORD('1234') where user='cron'; + +use asterisk; + +\. /usr/share/astguiclient/MySQL_AST_CREATE_tables.sql + or you may need to run this if you get an error: + \. /usr/src/astguiclient/trunk/extras/MySQL_AST_CREATE_tables.sql + +insert into servers (server_id,server_description,server_ip,active,asterisk_version)values('TESTasterisk','Test install of Asterisk server', '10.10.10.15','Y','1.2.17'); + +insert into server_updater values('10.10.10.15',''); + +insert into phones (extension, dialplan_number, voicemail_id, phone_ip, computer_ip, server_ip, login, pass, status, active, phone_type, fullname, company, picture, messages, old_messages, protocol) values('gs102','102','102','10.10.10.16','10.10.9.16','10.10.10.15','gs102','test', 'ADMIN','Y','Grandstream BT 102','Test Admin Phone','TEST','','0','0','SIP'); + +insert into vicidial_users (user,pass,full_name,user_level,user_group,load_leads,campaign_detail,ast_admin_access,modify_users) values('6666','1234','Admin','9','ADMIN','1','1','1','1'); + +insert into conferences values('8600001','10.10.10.15',''); +insert into conferences values('8600002','10.10.10.15',''); +insert into conferences values('8600003','10.10.10.15',''); +insert into conferences values('8600004','10.10.10.15',''); +insert into conferences values('8600005','10.10.10.15',''); +insert into conferences values('8600006','10.10.10.15',''); +insert into conferences values('8600007','10.10.10.15',''); +insert into conferences values('8600008','10.10.10.15',''); +insert into conferences values('8600009','10.10.10.15',''); +insert into conferences values('8600010','10.10.10.15',''); +insert into conferences values('8600011','10.10.10.15',''); +insert into conferences values('8600012','10.10.10.15',''); +insert into conferences values('8600013','10.10.10.15',''); +insert into conferences values('8600014','10.10.10.15',''); +insert into conferences values('8600015','10.10.10.15',''); +insert into conferences values('8600016','10.10.10.15',''); +insert into conferences values('8600017','10.10.10.15',''); +insert into conferences values('8600018','10.10.10.15',''); +insert into conferences values('8600019','10.10.10.15',''); +insert into conferences values('8600020','10.10.10.15',''); +insert into conferences values('8600021','10.10.10.15',''); +insert into conferences values('8600022','10.10.10.15',''); +insert into conferences values('8600023','10.10.10.15',''); +insert into conferences values('8600024','10.10.10.15',''); +insert into conferences values('8600025','10.10.10.15',''); +insert into conferences values('8600026','10.10.10.15',''); +insert into conferences values('8600027','10.10.10.15',''); +insert into conferences values('8600028','10.10.10.15',''); +insert into conferences values('8600029','10.10.10.15',''); + +quit + + run this command from command line: + - /usr/share/astguiclient/ADMIN_area_code_populate.pl + +######------ END Mysql data entry ------###### + +NOTE: If you will be using channelbanks for agent phones you can use the +/extras/single_channelbank_phones.sql file to help enter the phones table entries. + +NOTE: If you will be using IAX or SIP phones for agent phones you can use the +/extras/sip-iax_phones.sql file to help enter the phones table entries. + +NOTE: if you are not installing using default user/pass or have MySQL on another +server, you will need to edit either the /etc/astguiclient.conf file or the +dbconnect.php files in the astguiclient, vicidial and agc directories of your +webroot. + +3. Enter the vicidial administration page: +http://10.10.10.15/vicidial/admin.php +NOTE: if you click on the Logout button you must leave the user/pass empty and click OK + - Here you will enter the login and password that you inserted into the mysql +database in the vicidial_users table (subphase 6.1 [6666/1234]) + - Now that you are logged into the astGUIclient administration system we can +add a new phone entry for each of the sipura lines we created. + - click on the "Admin" link at the top, then the "ADD PHONE" link below +that and enter in the proper information for each of the new phone lines. +Here's what we entered for spa2000: + - Phone extension: spa2000 + - Dialplan Number: 2000 + - Voicemail Box: 2000 + - Phone IP address: 10.10.10.17 + - Computer IP address: 10.10.9.17 + - Server IP: 10.10.10.15 + - Login: spa2000 + - Password: test + - Status: ACTIVE + - Active Account: Y + - Phone Type: Sipura SPA-2000 line 1 + - Full Name: Sipura line 1 test + - Company: TEST + - Picture: + - for the next phone simply replace 2000 with 2001 in the above example + - now your phones are all all set up in the astguiclient system and you can +use this website to add new phones to be used with astguiclient and monitor +the number of calls people are making. + - now your database is set up for the astguiclient conferences which + will allow you to have over 6 remote parties that you called from your + GUI client application in one conference. + - click on the "LIST ALL SERVERS" link at the top then click on the + server to modify. Verify that the GMT time zone and all other fields + are what you want them to be. There is a setting(Max VICIDIAL Trunks) + that can be modified to limit the number of VICIDIAL outbound trunks + that will be allowed to use on this server. + +4. **OPTIONAL** For IAX clients you will need to use full phone name as the +extension on the admin page entry: "firefly01@firefly01" for our IAX phone example +previously. And do not forget to set the protocol on this page to IAX2 + +5. **OPTIONAL** For Zap clients you will need to use full Zap Channel name as the +extension on the admin page entry: "1-1" for our Zap phone example +previously. And do not forget to set the protocol on this page to Zap + + + + +SUBPHASE 6.2: making additions to your Asterisk conf files + +Now that the database is set up and our phones have entries in the system we can +make the additions to the running Asterisk system that will allow astguiclient +to work with it. + +1. Add the call_log entries to all incoming/outgoing extensions entries: + - here is how our sample dialplan changes for adding call_log entries(only +effected extension groups are show): +######------ START extensions.conf changes for call_log ------###### + +##### This 'h' exten is VERY important for VICIDIAL usage, +##### you will have problems if it is not in your dialplan! +exten => h,1,DeadAGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME}) + +; Extension 3429 - Inbound 800 number (1-800-555-3429) +exten => _**3429,1,Ringing +exten => _**3429,2,AGI(agi://127.0.0.1:4577/call_log) +exten => _**3429,3,Answer +exten => _**3429,4,Dial,sip/spa2000&sip/spa2001|30|to +exten => _**3429,5,Voicemail,u2000 +; Extension 3429 - with ANI [callerID] +exten => _*NXXNXXXXXX*3429,1,Ringing +exten => _*NXXNXXXXXX*3429,2,AGI(agi://127.0.0.1:4577/call_log) +exten => _*NXXNXXXXXX*3429,3,Answer +exten => _*NXXNXXXXXX*3429,4,Dial,sip/spa2000&sip/spa2001|30|to +exten => _*NXXNXXXXXX*3429,5,Voicemail,u2000 + +; Extension 7275551212 - Inbound local number from PRI with 10 digit delivery +exten => 7275551212,1,Ringing +exten => 7275551212,2,Wait(1) +exten => 7275551212,3,AGI(agi://127.0.0.1:4577/call_log--fullCID--${EXTEN}-----${CALLERID}-----${CALLERIDNUM}-----${CALLERIDNAME}) +exten => 7275551212,4,Answer +exten => 7275551212,5,Dial,sip/spa2000&sip/spa2001|30|to +exten => 7275551212,6,Voicemail,u2000 + +; This 'o' Dial flag is VERY important for VICIDIAL on outbound calls, + +; dial a long distance outbound number to the UK +exten => _901144XXXXXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +exten => _901144XXXXXXXXXX,2,Dial(${TRUNKX}/${EXTEN:1},55,tTo) +exten => _901144XXXXXXXXXX,3,Hangup + +; dial a long distance outbound number to Australia +exten => _901161XXXXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +exten => _901161XXXXXXXXX,2,Dial(${TRUNKX}/${EXTEN:1},,tTo) +exten => _901161XXXXXXXXX,3,Hangup + +; dial an 800 outbound number +exten => _91800NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +exten => _91800NXXXXXX,2,Dial(${TRUNK}/${EXTEN:1},,tTo) +exten => _91800NXXXXXX,3,Hangup +exten => _91888NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +exten => _91888NXXXXXX,2,Dial(${TRUNK}/${EXTEN:1},,tTo) +exten => _91888NXXXXXX,3,Hangup +exten => _91877NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +exten => _91877NXXXXXX,2,Dial(${TRUNK}/${EXTEN:1},,tTo) +exten => _91877NXXXXXX,3,Hangup +exten => _91866NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +exten => _91866NXXXXXX,2,Dial(${TRUNK}/${EXTEN:1},,tTo) +exten => _91866NXXXXXX,3,Hangup + +; dial a local 727 outbound number with area code +exten => _9727NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +exten => _9727NXXXXXX,2,Dial(${TRUNK}/1${EXTEN:1},,tTo) +exten => _9727NXXXXXX,3,Hangup + +; dial a local 813 outbound number with area code +exten => _9813NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +exten => _9813NXXXXXX,2,Dial(${TRUNK}/${EXTEN:1},,tTo) +exten => _9813NXXXXXX,3,Hangup + +; This 'o' Dial flag is VERY important for VICIDIAL on outbound calls, +; dial a long distance outbound number +exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +exten => _91NXXNXXXXXX,2,Dial(${TRUNKX}/${EXTEN:1},,tTo) +exten => _91NXXNXXXXXX,3,Hangup + +; dial a local outbound number (modified because of only LD T1) +exten => _9NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +exten => _9NXXXXXX,2,Dial(${TRUNK}/1727${EXTEN:1},,tTo) +exten => _9NXXXXXX,3,Hangup + +######------ END extensions.conf changes ------###### + + +2. Add the call_inbound entries to all incoming extensions entries that you want +CallerID popups on: + - here is how our sample dialplan changes for adding call_inbound +entries(only effected extension groups are show): +######------ START extensions.conf changes for call_inbound ------###### +; parameters for call_inbound.agi (7 fields separated by five dashes "-----"): +; 1. the extension of the phone to ring as defined in the asterisk.phones table +; 2. the phone number that was called, for the live_inbound/_log entry +; 3. a text description of the number that was called in +; 4-7. optional fields, they are also passed as fields in the GUI to web browser + +; Extension 3429 - Inbound 800 number (1-800-555-3429) +exten => _**3429,1,Ringing +exten => _**3429,2,AGI(agi://127.0.0.1:4577/call_log) +exten => _**3429,3,AGI(call_inbound.agi,spa2000-----8005553429-----Inbound 800-----x-----y-----z-----w) +exten => _**3429,4,Answer +exten => _**3429,5,Dial,sip/spa2000&sip/spa2001|30|to +exten => _**3429,6,Voicemail,u2000 +; Extension 3429 - with ANI [callerID] +exten => _*NXXNXXXXXX*3429,1,Ringing +exten => _*NXXNXXXXXX*3429,2,AGI(agi://127.0.0.1:4577/call_log) +exten => _*NXXNXXXXXX*3429,3,AGI(call_inbound.agi,spa2000-----8005553429-----Inbound 800-----x-----y-----z-----w) +exten => _*NXXNXXXXXX*3429,3,Answer +exten => _*NXXNXXXXXX*3429,4,Dial,sip/spa2000&sip/spa2001|30|to +exten => _*NXXNXXXXXX*3429,5,Voicemail,u2000 + +exten => _010*010*010*015*8600XXX,1,Goto(default,${EXTEN:16},1) +exten => _010*010*010*015*8600XXX*.,1,Goto(default,${EXTEN:16},1) +exten => _010*010*010*015*78600XXX,1,Goto(default,${EXTEN:16},1) +exten => _010*010*010*015*78600XXX*.,1,Goto(default,${EXTEN:16},1) +exten => _8600XXX*.,1,AGI(agi-VDADfixCXFER.agi) +exten => _78600XXX*.,1,AGI(agi-VDADfixCXFER.agi) + + +; parameters for agi-VDAD_ALL_inbound.agi (9 fields separated by five dashes "-----"): +; 1. the method of call handling for the script: +; - CID - CID received, add record with phone number +; - CIDLOOKUP - Lookup CID to find record in whole system +; - CIDLOOKUPRL - Restrict lookup to one list +; - CIDLOOKUPRC - Restrict lookup to one campaign's lists +; - CLOSER - Closer calls from VICIDIAL fronters +; - ANI - ANI received, add record with phone number +; - ANILOOKUP - Lookup ANI to find record in whole system +; - ANILOOKUPRL - Restrict lookup to one list +; - 3DIGITID - Enter 3 digit code to go to agent +; - 4DIGITID - Enter 4 digit code to go to agent +; - 5DIGITID - Enter 5 digit code to go to agent +; - 10DIGITID - Enter 10 digit code to go to agent +; 2. the method of searching for an available agent: +; - LO - Load Balance Overflow only (priority to home server) +; - LB - Load Balance total system +; - SO - Home server only +; 3. the full name of the IN GROUP to be used in vicidial for the inbound call +; 4. the phone number that was called, for the log entry +; 5. the callerID or lead_id of the person that called(usually overridden) +; 6. the park extension audio file name if used +; 7. the status of the call initially(usually not used) +; 8. the list_id to insert the new lead under if it is new (and CID/ANI available) +; 9. the phone dialing code to insert with the new lead if new (and CID/ANI available) +; 10. the campaign_id to search within lists if CIDLOOKUPRC +; inbound VICIDIAL call with CID delivery through T1 PRI +exten => 1234,1,Answer ; Answer the line +exten => 1234,2,AGI(agi-VDAD_ALL_inbound.agi,CID-----LB-----CL_GALLERIA-----7274515134-----Closer-----park----------999-----1) +exten => 1234,3,Hangup + +; inbound VICIDIAL transfer calls [can arrive through PRI T1 crossover, IAX or SIP channel] +exten => _90009.,1,Answer ; Answer the line +exten => _90009.,2,AGI(agi-VDAD_ALL_inbound.agi,CLOSER-----LB-----CL_TESTCAMP-----7275551212-----Closer-----park----------999-----1) +exten => _90009.,3,Hangup +exten => _990009.,1,Answer ; Answer the line +exten => _990009.,2,AGI(agi-VDAD_ALL_inbound.agi,CLOSER-----LB-----CL_TESTCAMP-----7275551212-----Closer-----park----------999-----1) +exten => _990009.,3,Hangup + + +### follow these instructions if you plan to have VICIDIAL agents take inbound or closer calls: + 1. in VICIDIAL web admin "add a new in-group" (the above examples would be "CL_GALLERIA") + - group IDs cannot contain spaces ' ' or dashes '-' or plusses '+' + - if you are using a HEX color value make sure to include the hash '#' at the beginning + 2. create a new campaign in VICIDIAL called "CLOSER" and set "allow inbound blended" to Y + 3. check the CL_GALLERIA checknox in the "Allowed In-Groups" section + 4. have agents log in to the CLOSER campaign and select the CL_GALLERIA in-group + 5. they will now start receiving inbound calls + 6. as calls come in, each call is inserted into the vicidial_list table under the + list specified int the AGI string, In the above example that would be list 999 + 7. if you want to take closer calls from the campaign "TEST" you will need to create + an in-group called "CL_TEST_" for internal closing(on the same system) or "CL_TEST_L" + for local closing(closer on different system from fronter) and then the fronter will + click on the "internal closer" button to send the call to a closer + +* NOTE, you need to set the dial_level of the CLOSER campaign to 1 or higher for inbound/closers to work + +######------ END extensions.conf changes for call_inbound ------###### + + +3. Add the ZapBarge entries for all zap lines: + - here is how our sample dialplan changes for adding zapbarge line-specific +entries(this is a pure addition, nothing is being modified): +######------ START extensions.conf additions for direct zapbarges ------###### +; ZapBarge direct channel extensions +exten => 8612001,1,ZapBarge(1) +exten => 8612002,1,ZapBarge(2) +exten => 8612003,1,ZapBarge(3) +exten => 8612004,1,ZapBarge(4) +exten => 8612005,1,ZapBarge(5) +exten => 8612006,1,ZapBarge(6) +exten => 8612007,1,ZapBarge(7) +exten => 8612008,1,ZapBarge(8) +exten => 8612009,1,ZapBarge(9) +exten => 8612010,1,ZapBarge(10) +exten => 8612011,1,ZapBarge(11) +exten => 8612012,1,ZapBarge(12) +exten => 8612013,1,ZapBarge(13) +exten => 8612014,1,ZapBarge(14) +exten => 8612015,1,ZapBarge(15) +exten => 8612016,1,ZapBarge(16) +exten => 8612017,1,ZapBarge(17) +exten => 8612018,1,ZapBarge(18) +exten => 8612019,1,ZapBarge(19) +exten => 8612020,1,ZapBarge(20) +exten => 8612021,1,ZapBarge(21) +exten => 8612022,1,ZapBarge(22) +exten => 8612023,1,ZapBarge(23) +exten => 8612024,1,ZapBarge(24) +######------ END extensions.conf additions for direct zapbarges ------###### + + +4. Add the meetme entries for astguiclient and VICIDIAL conferences to +meetme.conf: + - here is how our sample meetme.conf file changes for adding conference +entries (this is a pure addition, nothing is being modified): +######------ START meetme.conf additions for conferences ------###### +conf => 8600001 +conf => 8600002 +conf => 8600003 +conf => 8600004 +conf => 8600005 +conf => 8600006 +conf => 8600007 +conf => 8600008 +conf => 8600009 +conf => 8600010 +conf => 8600011 +conf => 8600012 +conf => 8600013 +conf => 8600014 +conf => 8600015 +conf => 8600016 +conf => 8600017 +conf => 8600018 +conf => 8600019 +conf => 8600020 +conf => 8600021 +conf => 8600022 +conf => 8600023 +conf => 8600024 +conf => 8600025 +conf => 8600026 +conf => 8600027 +conf => 8600028 +conf => 8600029 +conf => 8600051 +conf => 8600052 +conf => 8600053 +conf => 8600054 +conf => 8600055 +conf => 8600056 +conf => 8600057 +conf => 8600058 +conf => 8600059 +conf => 8600060 +conf => 8600061 +conf => 8600062 +conf => 8600063 +conf => 8600064 +conf => 8600065 +conf => 8600066 +conf => 8600067 +conf => 8600068 +conf => 8600069 +conf => 8600070 +conf => 8600071 +conf => 8600072 +conf => 8600073 +conf => 8600074 +conf => 8600075 +conf => 8600076 +conf => 8600077 +conf => 8600078 +conf => 8600079 +conf => 8600080 +conf => 8600081 +conf => 8600082 +conf => 8600083 +conf => 8600084 +conf => 8600085 +conf => 8600086 +conf => 8600087 +conf => 8600088 +conf => 8600089 +conf => 8600090 +conf => 8600091 +conf => 8600092 +conf => 8600093 +conf => 8600094 +conf => 8600095 +conf => 8600096 +conf => 8600097 +conf => 8600098 +conf => 8600099 +conf => 8600100 +conf => 8600101 +conf => 8600102 +conf => 8600103 +conf => 8600104 +conf => 8600105 +conf => 8600106 +conf => 8600107 +conf => 8600108 +conf => 8600109 +conf => 8600110 +conf => 8600111 +conf => 8600112 +conf => 8600113 +conf => 8600114 +conf => 8600115 +conf => 8600116 +conf => 8600117 +conf => 8600118 +conf => 8600119 +conf => 8600120 +conf => 8600121 +conf => 8600122 +conf => 8600123 +conf => 8600124 +conf => 8600125 +conf => 8600126 +conf => 8600127 +conf => 8600128 +conf => 8600129 +conf => 8600130 +conf => 8600131 +conf => 8600132 +conf => 8600133 +conf => 8600134 +conf => 8600135 +conf => 8600136 +conf => 8600137 +conf => 8600138 +conf => 8600139 +conf => 8600140 +conf => 8600141 +conf => 8600142 +conf => 8600143 +conf => 8600144 +conf => 8600145 +conf => 8600146 +conf => 8600147 +conf => 8600148 +conf => 8600149 +conf => 8600150 +conf => 8600151 +conf => 8600152 +conf => 8600153 +conf => 8600154 +conf => 8600155 +conf => 8600156 +conf => 8600157 +conf => 8600158 +conf => 8600159 +conf => 8600160 +conf => 8600161 +conf => 8600162 +conf => 8600163 +conf => 8600164 +conf => 8600165 +conf => 8600166 +conf => 8600167 +conf => 8600168 +conf => 8600169 +conf => 8600170 +conf => 8600171 +conf => 8600172 +conf => 8600173 +conf => 8600174 +conf => 8600175 +conf => 8600176 +conf => 8600177 +conf => 8600178 +conf => 8600179 +conf => 8600180 +conf => 8600181 +conf => 8600182 +conf => 8600183 +conf => 8600184 +conf => 8600185 +conf => 8600186 +conf => 8600187 +conf => 8600188 +conf => 8600189 +conf => 8600190 +conf => 8600191 +conf => 8600192 +conf => 8600193 +conf => 8600194 +conf => 8600195 +conf => 8600196 +conf => 8600197 +conf => 8600198 +conf => 8600199 +conf => 8600200 +######------ END meetme.conf additions for conferences ------###### + + +5. Add the conference entries for astguiclient conferences: + - here is how our sample dialplan changes for adding conference entries (this +is a pure addition, nothing is being modified): +######------ START extensions.conf additions for agc conferences ------###### +exten => 8600001,1,Meetme,8600001|q +exten => 8600002,1,Meetme,8600002|q +exten => 8600003,1,Meetme,8600003|q +exten => 8600004,1,Meetme,8600004|q +exten => 8600005,1,Meetme,8600005|q +exten => 8600006,1,Meetme,8600006|q +exten => 8600007,1,Meetme,8600007|q +exten => 8600008,1,Meetme,8600008|q +exten => 8600009,1,Meetme,8600009|q +exten => 8600010,1,Meetme,8600010|q +exten => 8600011,1,Meetme,8600011|q +exten => 8600012,1,Meetme,8600012|q +exten => 8600013,1,Meetme,8600013|q +exten => 8600014,1,Meetme,8600014|q +exten => 8600015,1,Meetme,8600015|q +exten => 8600016,1,Meetme,8600016|q +exten => 8600017,1,Meetme,8600017|q +exten => 8600018,1,Meetme,8600018|q +exten => 8600019,1,Meetme,8600019|q +exten => 8600020,1,Meetme,8600020|q +exten => 8600021,1,Meetme,8600021|q +exten => 8600022,1,Meetme,8600022|q +exten => 8600023,1,Meetme,8600023|q +exten => 8600024,1,Meetme,8600024|q +exten => 8600025,1,Meetme,8600025|q +exten => 8600026,1,Meetme,8600026|q +exten => 8600027,1,Meetme,8600027|q +exten => 8600028,1,Meetme,8600028|q +exten => 8600029,1,Meetme,8600029|q +######------ END extensions.conf additions for agc conferences ------###### + + +6. Add the conference entries for VICIDIAL conferences: + - here is how our sample dialplan changes for adding VICIDIAL conference +entries(this is a pure addition, nothing is being modified): +NOTE: see below these entries for app_conference instructions is used +######------ START extensions.conf changes for VD conf ------###### +exten => _X48600XXX,1,MeetMeAdmin(${EXTEN:2},T,${EXTEN:0:1}) +exten => _X48600XXX,2,Hangup + +exten => _X38600XXX,1,MeetMeAdmin(${EXTEN:2},t,${EXTEN:0:1}) +exten => _X38600XXX,2,Hangup + +exten => _X28600XXX,1,MeetMeAdmin(${EXTEN:2},m,${EXTEN:0:1}) +exten => _X28600XXX,2,Hangup + +exten => _X18600XXX,1,MeetMeAdmin(${EXTEN:2},M,${EXTEN:0:1}) +exten => _X18600XXX,2,Hangup + +exten => _55558600XXX,1,MeetMeAdmin(${EXTEN:4},K) +exten => _55558600XXX,2,Hangup +exten => 8300,1,Hangup + +exten => 8600051,1,Meetme,8600051 +exten => 8600052,1,Meetme,8600052 +exten => 8600053,1,Meetme,8600053 +exten => 8600054,1,Meetme,8600054 +exten => 8600055,1,Meetme,8600055 +exten => 8600056,1,Meetme,8600056 +exten => 8600057,1,Meetme,8600057 +exten => 8600058,1,Meetme,8600058 +exten => 8600059,1,Meetme,8600059 +exten => 8600060,1,Meetme,8600060 +exten => 8600061,1,Meetme,8600061 +exten => 8600062,1,Meetme,8600062 +exten => 8600063,1,Meetme,8600063 +exten => 8600064,1,Meetme,8600064 +exten => 8600065,1,Meetme,8600065 +exten => 8600066,1,Meetme,8600066 +exten => 8600067,1,Meetme,8600067 +exten => 8600068,1,Meetme,8600068 +exten => 8600069,1,Meetme,8600069 +exten => 8600070,1,Meetme,8600070 +exten => 8600071,1,Meetme,8600071 +exten => 8600072,1,Meetme,8600072 +exten => 8600073,1,Meetme,8600073 +exten => 8600074,1,Meetme,8600074 +exten => 8600075,1,Meetme,8600075 +exten => 8600076,1,Meetme,8600076 +exten => 8600077,1,Meetme,8600077 +exten => 8600078,1,Meetme,8600078 +exten => 8600079,1,Meetme,8600079 +exten => 8600080,1,Meetme,8600080 +exten => 8600081,1,Meetme,8600081 +exten => 8600082,1,Meetme,8600082 +exten => 8600083,1,Meetme,8600083 +exten => 8600084,1,Meetme,8600084 +exten => 8600085,1,Meetme,8600085 +exten => 8600086,1,Meetme,8600086 +exten => 8600087,1,Meetme,8600087 +exten => 8600088,1,Meetme,8600088 +exten => 8600089,1,Meetme,8600089 +exten => 8600090,1,Meetme,8600090 +exten => 8600091,1,Meetme,8600091 +exten => 8600092,1,Meetme,8600092 +exten => 8600093,1,Meetme,8600093 +exten => 8600094,1,Meetme,8600094 +exten => 8600095,1,Meetme,8600095 +exten => 8600096,1,Meetme,8600096 +exten => 8600097,1,Meetme,8600097 +exten => 8600098,1,Meetme,8600098 +exten => 8600099,1,Meetme,8600099 +exten => 8600100,1,Meetme,8600100 +exten => 8600101,1,Meetme,8600101 +exten => 8600102,1,Meetme,8600102 +exten => 8600103,1,Meetme,8600103 +exten => 8600104,1,Meetme,8600104 +exten => 8600105,1,Meetme,8600105 +exten => 8600106,1,Meetme,8600106 +exten => 8600107,1,Meetme,8600107 +exten => 8600108,1,Meetme,8600108 +exten => 8600109,1,Meetme,8600109 +exten => 8600110,1,Meetme,8600110 +exten => 8600111,1,Meetme,8600111 +exten => 8600112,1,Meetme,8600112 +exten => 8600113,1,Meetme,8600113 +exten => 8600114,1,Meetme,8600114 +exten => 8600115,1,Meetme,8600115 +exten => 8600116,1,Meetme,8600116 +exten => 8600117,1,Meetme,8600117 +exten => 8600118,1,Meetme,8600118 +exten => 8600119,1,Meetme,8600119 +exten => 8600120,1,Meetme,8600120 +exten => 8600121,1,Meetme,8600121 +exten => 8600122,1,Meetme,8600122 +exten => 8600123,1,Meetme,8600123 +exten => 8600124,1,Meetme,8600124 +exten => 8600125,1,Meetme,8600125 +exten => 8600126,1,Meetme,8600126 +exten => 8600127,1,Meetme,8600127 +exten => 8600128,1,Meetme,8600128 +exten => 8600129,1,Meetme,8600129 +exten => 8600130,1,Meetme,8600130 +exten => 8600131,1,Meetme,8600131 +exten => 8600132,1,Meetme,8600132 +exten => 8600133,1,Meetme,8600133 +exten => 8600134,1,Meetme,8600134 +exten => 8600135,1,Meetme,8600135 +exten => 8600136,1,Meetme,8600136 +exten => 8600137,1,Meetme,8600137 +exten => 8600138,1,Meetme,8600138 +exten => 8600139,1,Meetme,8600139 +exten => 8600140,1,Meetme,8600140 +exten => 8600141,1,Meetme,8600141 +exten => 8600142,1,Meetme,8600142 +exten => 8600143,1,Meetme,8600143 +exten => 8600144,1,Meetme,8600144 +exten => 8600145,1,Meetme,8600145 +exten => 8600146,1,Meetme,8600146 +exten => 8600147,1,Meetme,8600147 +exten => 8600148,1,Meetme,8600148 +exten => 8600149,1,Meetme,8600149 +exten => 8600150,1,Meetme,8600150 +exten => 8600151,1,Meetme,8600151 +exten => 8600152,1,Meetme,8600152 +exten => 8600153,1,Meetme,8600153 +exten => 8600154,1,Meetme,8600154 +exten => 8600155,1,Meetme,8600155 +exten => 8600156,1,Meetme,8600156 +exten => 8600157,1,Meetme,8600157 +exten => 8600158,1,Meetme,8600158 +exten => 8600159,1,Meetme,8600159 +exten => 8600160,1,Meetme,8600160 +exten => 8600161,1,Meetme,8600161 +exten => 8600162,1,Meetme,8600162 +exten => 8600163,1,Meetme,8600163 +exten => 8600164,1,Meetme,8600164 +exten => 8600165,1,Meetme,8600165 +exten => 8600166,1,Meetme,8600166 +exten => 8600167,1,Meetme,8600167 +exten => 8600168,1,Meetme,8600168 +exten => 8600169,1,Meetme,8600169 +exten => 8600170,1,Meetme,8600170 +exten => 8600171,1,Meetme,8600171 +exten => 8600172,1,Meetme,8600172 +exten => 8600173,1,Meetme,8600173 +exten => 8600174,1,Meetme,8600174 +exten => 8600175,1,Meetme,8600175 +exten => 8600176,1,Meetme,8600176 +exten => 8600177,1,Meetme,8600177 +exten => 8600178,1,Meetme,8600178 +exten => 8600179,1,Meetme,8600179 +exten => 8600180,1,Meetme,8600180 +exten => 8600181,1,Meetme,8600181 +exten => 8600182,1,Meetme,8600182 +exten => 8600183,1,Meetme,8600183 +exten => 8600184,1,Meetme,8600184 +exten => 8600185,1,Meetme,8600185 +exten => 8600186,1,Meetme,8600186 +exten => 8600187,1,Meetme,8600187 +exten => 8600188,1,Meetme,8600188 +exten => 8600189,1,Meetme,8600189 +exten => 8600190,1,Meetme,8600190 +exten => 8600191,1,Meetme,8600191 +exten => 8600192,1,Meetme,8600192 +exten => 8600193,1,Meetme,8600193 +exten => 8600194,1,Meetme,8600194 +exten => 8600195,1,Meetme,8600195 +exten => 8600196,1,Meetme,8600196 +exten => 8600197,1,Meetme,8600197 +exten => 8600198,1,Meetme,8600198 +exten => 8600199,1,Meetme,8600199 +exten => 8600200,1,Meetme,8600200 +; quiet entry and leaving conferences for VICIDIAL +exten => _78600XXX,1,Meetme,${EXTEN:1}|q +; quiet monitor extensions for meetme rooms (for room managers) +exten => _68600XXX,1,Meetme,${EXTEN:1}|mq + +######------ END extensions.conf changes for VD conf ------###### + +NOTE: If you want to do DTMF passthru with app_conference bee sure to add the +"i" and "t" flags to the 8600XX lines: Conference(8600051|it) + + +7. Add the more entries for astGUIclient specific uses: + - here are some more dialplan additions needed to use astGUIclient(this is a +pure addition, nothing is being modified): +######------ START extensions.conf other additions ------###### +; park channel for client GUI parking, hangup after 30 minutes +; create a GSM formatted audio file named "park.gsm" that is 30 minutes long +; and put it in /var/lib/asterisk/sounds +exten => 8301,1,Answer +exten => 8301,2,AGI(park_CID.agi) +exten => 8301,3,Playback(park) +exten => 8301,4,Hangup +exten => 8303,1,Answer +exten => 8303,2,AGI(park_CID.agi) +exten => 8303,3,Playback(conf) +exten => 8303,4,Hangup + +; park channel for client GUI conferencing, hangup after 30 minutes +; create a GSM formatted audio file named "conf.gsm" that is 30 minutes long +; and put it in /var/lib/asterisk/sounds +exten => 8302,1,Answer +exten => 8302,2,Playback(conf) +exten => 8302,3,Hangup + +exten => 8304,1,Answer +exten => 8304,2,Playback(ding) +exten => 8304,3,Hangup + +; default audio for safe harbor 2-second-after-hello message then hangup +; create a GSM formatted audio file complies with safe harbor rules +; and put it in /var/lib/asterisk/sounds then change filename below +exten => 8307,1,Answer +exten => 8307,2,Playback(vm-goodbye) +exten => 8307,3,Hangup + +; this is used for recording conference calls, the client app sends the filename +; value as a callerID recordings go to /var/spool/asterisk/monitor (WAV) +exten => 8309,1,Answer +exten => 8309,2,Monitor(wav,${CALLERIDNAME}) +exten => 8309,3,Wait,3600 +exten => 8309,4,Hangup + +; this is used for recording conference calls, the client app sends the filename +; value as a callerID recordings go to /var/spool/asterisk/monitor (GSM) +exten => 8310,1,Answer +exten => 8310,2,Monitor(gsm,${CALLERIDNAME}) +exten => 8310,3,Wait,3600 +exten => 8310,4,Hangup + +; this is used for playing a message to an answering machine forwarded from AMD in VICIDIAL +; replace conf with the message file you want to leave +exten => 8320,1,WaitForSilence(2000,2) ; AMD got machine. leave message after recording +exten => 8320,2,Playback(conf) +exten => 8320,3,AGI(VD_amd_post.agi,${EXTEN}) +exten => 8320,4,Hangup + +; this is used to allow the GUI to send you directly into voicemail +; don't forget to set GUI variable $voicemail_exten to this extension +exten => 8501,1,VoicemailMain(s${CALLERIDNUM}) +exten => 8501,2,Hangup + +; this is used to allow the GUI to send live calls directly into voicemail +; don't forget to set GUI variable $voicemail_dump_exten to this extension +exten => _85026666666666.,1,Wait(2) +exten => _85026666666666.,2,Voicemail(${EXTEN:14}) +exten => _85026666666666.,3,Hangup + +; this is used for sending DTMF signals within conference calls, the client app +; sends the digits to be played in the callerID field +; sound files must be placed in /var/lib/asterisk/sounds +exten => 8500998,1,Answer +exten => 8500998,2,Playback(silence) +exten => 8500998,3,AGI(agi-dtmf.agi) +exten => 8500998,4,Hangup + +; prompt recording AGI script, ID is 4321 +exten => 8168,1,Answer +exten => 8168,2,AGI(agi-record_prompts.agi) +exten => 8168,3,Hangup + +; playback of recorded prompts +exten => _851XXXXX,1,Answer +exten => _851XXXXX,2,Playback(${EXTEN}) +exten => _851XXXXX,3,Hangup + +#### VDAD STANDARD TRANSFER ENTRIES #### +; VICIDIAL_auto_dialer transfer script for no-agent campaigns: +exten => 8364,1,Playback(sip-silence) +exten => 8364,2,AGI(agi://127.0.0.1:4577/call_log) +exten => 8364,3,AGI(agi-VDADtransferBROADCAST.agi,${EXTEN}) +exten => 8364,4,AGI(agi-VDADtransferBROADCAST.agi,${EXTEN}) +exten => 8364,5,Hangup + +; VICIDIAL_auto_dialer transfer script: +exten => 8365,1,AGI(agi://127.0.0.1:4577/call_log) +exten => 8365,2,AGI(agi-VDADtransfer.agi,${EXTEN}) +exten => 8365,3,AGI(agi-VDADtransfer.agi,${EXTEN}) +exten => 8365,4,AGI(agi-VDADtransfer.agi,${EXTEN}) +exten => 8365,5,Hangup + +; VICIDIAL_auto_dialer transfer script SURVEY at beginning: +exten => 8366,1,AGI(agi://127.0.0.1:4577/call_log) +exten => 8366,2,AGI(agi-VDADtransferSURVEY.agi,${EXTEN}) +exten => 8366,3,AGI(agi-VDADtransferSURVEY.agi,${EXTEN}) +exten => 8366,4,AGI(agi-VDADtransferSURVEY.agi,${EXTEN}) +exten => 8366,5,Hangup + +; VICIDIAL_auto_dialer transfer script Load Balance Overflow: +exten => 8367,1,AGI(agi://127.0.0.1:4577/call_log) +exten => 8367,2,AGI(agi-VDAD_LO_transfer.agi,${EXTEN}) +exten => 8367,3,AGI(agi-VDAD_LO_transfer.agi,${EXTEN}) +exten => 8367,4,AGI(agi-VDAD_LO_transfer.agi,${EXTEN}) +exten => 8367,5,Hangup + +; VICIDIAL_auto_dialer transfer script Load Balanced: +exten => 8368,1,AGI(agi://127.0.0.1:4577/call_log) +exten => 8368,2,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +exten => 8368,3,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +exten => 8368,4,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +exten => 8368,5,Hangup + +; VICIDIAL_auto_dialer transfer script AMD with Load Balanced: +exten => 8369,1,AGI(agi://127.0.0.1:4577/call_log) +exten => 8369,2,AMD(3500|1500|300|5000|120|50|5|256) +exten => 8369,3,AGI(VD_amd.agi,${EXTEN}) +exten => 8369,4,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +exten => 8369,5,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +exten => 8369,6,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +exten => 8369,7,Hangup + +; VICIDIAL auto-dial reminder script +exten => 8372,1,AGI(agi://127.0.0.1:4577/call_log) +exten => 8372,2,AGI(agi-VDADautoREMINDER.agi,${EXTEN}) +exten => 8372,3,AGI(agi-VDADautoREMINDER.agi,${EXTEN}) +exten => 8372,4,AGI(agi-VDADautoREMINDER.agi,${EXTEN}) +exten => 8372,5,Hangup + +#### VDAD SIP UNREGISTERED TRANSFER ENTRIES #### +#### Use these entries IN PLACE OF the entries above if you are using SIP trunks +#### and are not registering your provider in sip.conf +; VICIDIAL_auto_dialer transfer script: +exten => 8365,1,Playback(sip-silence) +exten => 8365,2,AGI(agi://127.0.0.1:4577/call_log) +exten => 8365,3,AGI(agi-VDADtransfer.agi,${EXTEN}) +exten => 8365,4,AGI(agi-VDADtransfer.agi,${EXTEN}) +exten => 8365,5,Hangup + +; VICIDIAL_auto_dialer transfer script SURVEY at beginning: +exten => 8366,1,Playback(sip-silence) +exten => 8366,2,AGI(agi://127.0.0.1:4577/call_log) +exten => 8366,3,AGI(agi-VDADtransferSURVEY.agi,${EXTEN}) +exten => 8366,4,AGI(agi-VDADtransferSURVEY.agi,${EXTEN}) +exten => 8366,5,Hangup + +; VICIDIAL_auto_dialer transfer script Load Balance Overflow: +exten => 8367,1,Playback(sip-silence) +exten => 8367,2,AGI(agi://127.0.0.1:4577/call_log) +exten => 8367,3,AGI(agi-VDAD_LO_transfer.agi,${EXTEN}) +exten => 8367,4,AGI(agi-VDAD_LO_transfer.agi,${EXTEN}) +exten => 8367,5,Hangup + +; VICIDIAL_auto_dialer transfer script Load Balanced: +exten => 8368,1,Playback(sip-silence) +exten => 8368,2,AGI(agi://127.0.0.1:4577/call_log) +exten => 8368,3,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +exten => 8368,4,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +exten => 8368,5,Hangup + +; VICIDIAL_auto_dialer transfer script AMD with Load Balanced: +exten => 8369,1,Playback(sip-silence) +exten => 8369,2,AGI(agi://127.0.0.1:4577/call_log) +exten => 8369,3,AMD(3500|1500|300|5000|120|50|5|256) +exten => 8369,4,AGI(VD_amd.agi,${EXTEN}) +exten => 8369,5,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +exten => 8369,6,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +exten => 8369,7,Hangup + +; VICIDIAL auto-dial reminder script +exten => 8372,1,Playback(sip-silence) +exten => 8372,2,AGI(agi://127.0.0.1:4577/call_log) +exten => 8372,3,AGI(agi-VDADautoREMINDER.agi,${EXTEN}) +exten => 8372,4,AGI(agi-VDADautoREMINDER.agi,${EXTEN}) +exten => 8372,5,Hangup + +; MANDITORY VDAD extens: +; In this setup, the serverIP is the prefix followed by agent conf_exten +; These lines are REQUIRED for VICIDIAL to work properly +; local server extens: + exten => _010*010*010*015*8600XXX,1,Goto(default,${EXTEN:16},1) + exten => _010*010*010*015*8600XXX*.,1,Goto(default,${EXTEN:16},1) + exten => _010*010*010*015*78600XXX,1,Goto(default,${EXTEN:16},1) + exten => _010*010*010*015*78600XXX*.,1,Goto(default,${EXTEN:16},1) + exten => _8600XXX*.,1,AGI(agi-VDADfixCXFER.agi) + exten => _78600XXX*.,1,AGI(agi-VDADfixCXFER.agi) + +; OPTIONAL server 2 extens, needed for load balancing: + exten => _010*010*010*016*8600XXX,1,Dial(${TRUNKIAX2}/${EXTEN:16},55,o) + exten => _010*010*010*016*8600XXX*.,1,Dial(${TRUNKIAX2}/${EXTEN:16},55,o) + exten => _010*010*010*016*78600XXX,1,Dial(${TRUNKIAX2}/${EXTEN:16},55,o) + exten => _010*010*010*016*78600XXX*.,1,Dial(${TRUNKIAX2}/${EXTEN:16},55,o) + + +SUBPHASE 6.3: adding entries to your MySQL "asterisk" database for vicidial +applications + +We need to add a few initial values to the vicidial tables in the "asterisk" +database in order to start setting up the vicidial dialer system for use. + +1. at the command prompt type this to go to the mysql client: +/usr/local/mysql/bin/mysql +2. type the following into the mysql client prompt: + (make sure you put your IP address in place of "10.10.10.15" in the queries below) +######------ BEGIN Mysql data entry(you can copy and paste this into terminal) # + +insert into vicidial_conferences values('8600051','10.10.10.15',''); +insert into vicidial_conferences values('8600052','10.10.10.15',''); +insert into vicidial_conferences values('8600053','10.10.10.15',''); +insert into vicidial_conferences values('8600054','10.10.10.15',''); +insert into vicidial_conferences values('8600055','10.10.10.15',''); +insert into vicidial_conferences values('8600056','10.10.10.15',''); +insert into vicidial_conferences values('8600057','10.10.10.15',''); +insert into vicidial_conferences values('8600058','10.10.10.15',''); +insert into vicidial_conferences values('8600059','10.10.10.15',''); +insert into vicidial_conferences values('8600060','10.10.10.15',''); +insert into vicidial_conferences values('8600061','10.10.10.15',''); +insert into vicidial_conferences values('8600062','10.10.10.15',''); +insert into vicidial_conferences values('8600063','10.10.10.15',''); +insert into vicidial_conferences values('8600064','10.10.10.15',''); +insert into vicidial_conferences values('8600065','10.10.10.15',''); +insert into vicidial_conferences values('8600066','10.10.10.15',''); +insert into vicidial_conferences values('8600067','10.10.10.15',''); +insert into vicidial_conferences values('8600068','10.10.10.15',''); +insert into vicidial_conferences values('8600069','10.10.10.15',''); +insert into vicidial_conferences values('8600070','10.10.10.15',''); +insert into vicidial_conferences values('8600071','10.10.10.15',''); +insert into vicidial_conferences values('8600072','10.10.10.15',''); +insert into vicidial_conferences values('8600073','10.10.10.15',''); +insert into vicidial_conferences values('8600074','10.10.10.15',''); +insert into vicidial_conferences values('8600075','10.10.10.15',''); +insert into vicidial_conferences values('8600076','10.10.10.15',''); +insert into vicidial_conferences values('8600077','10.10.10.15',''); +insert into vicidial_conferences values('8600078','10.10.10.15',''); +insert into vicidial_conferences values('8600079','10.10.10.15',''); +insert into vicidial_conferences values('8600080','10.10.10.15',''); +insert into vicidial_conferences values('8600081','10.10.10.15',''); +insert into vicidial_conferences values('8600082','10.10.10.15',''); +insert into vicidial_conferences values('8600083','10.10.10.15',''); +insert into vicidial_conferences values('8600084','10.10.10.15',''); +insert into vicidial_conferences values('8600085','10.10.10.15',''); +insert into vicidial_conferences values('8600086','10.10.10.15',''); +insert into vicidial_conferences values('8600087','10.10.10.15',''); +insert into vicidial_conferences values('8600088','10.10.10.15',''); +insert into vicidial_conferences values('8600089','10.10.10.15',''); +insert into vicidial_conferences values('8600090','10.10.10.15',''); +insert into vicidial_conferences values('8600091','10.10.10.15',''); +insert into vicidial_conferences values('8600092','10.10.10.15',''); +insert into vicidial_conferences values('8600093','10.10.10.15',''); +insert into vicidial_conferences values('8600094','10.10.10.15',''); +insert into vicidial_conferences values('8600095','10.10.10.15',''); +insert into vicidial_conferences values('8600096','10.10.10.15',''); +insert into vicidial_conferences values('8600097','10.10.10.15',''); +insert into vicidial_conferences values('8600098','10.10.10.15',''); +insert into vicidial_conferences values('8600099','10.10.10.15',''); +insert into vicidial_conferences values('8600100','10.10.10.15',''); +insert into vicidial_conferences values('8600101','10.10.10.15',''); +insert into vicidial_conferences values('8600102','10.10.10.15',''); +insert into vicidial_conferences values('8600103','10.10.10.15',''); +insert into vicidial_conferences values('8600104','10.10.10.15',''); +insert into vicidial_conferences values('8600105','10.10.10.15',''); +insert into vicidial_conferences values('8600106','10.10.10.15',''); +insert into vicidial_conferences values('8600107','10.10.10.15',''); +insert into vicidial_conferences values('8600108','10.10.10.15',''); +insert into vicidial_conferences values('8600109','10.10.10.15',''); +insert into vicidial_conferences values('8600110','10.10.10.15',''); +insert into vicidial_conferences values('8600111','10.10.10.15',''); +insert into vicidial_conferences values('8600112','10.10.10.15',''); +insert into vicidial_conferences values('8600113','10.10.10.15',''); +insert into vicidial_conferences values('8600114','10.10.10.15',''); +insert into vicidial_conferences values('8600115','10.10.10.15',''); +insert into vicidial_conferences values('8600116','10.10.10.15',''); +insert into vicidial_conferences values('8600117','10.10.10.15',''); +insert into vicidial_conferences values('8600118','10.10.10.15',''); +insert into vicidial_conferences values('8600119','10.10.10.15',''); +insert into vicidial_conferences values('8600120','10.10.10.15',''); +insert into vicidial_conferences values('8600121','10.10.10.15',''); +insert into vicidial_conferences values('8600122','10.10.10.15',''); +insert into vicidial_conferences values('8600123','10.10.10.15',''); +insert into vicidial_conferences values('8600124','10.10.10.15',''); +insert into vicidial_conferences values('8600125','10.10.10.15',''); +insert into vicidial_conferences values('8600126','10.10.10.15',''); +insert into vicidial_conferences values('8600127','10.10.10.15',''); +insert into vicidial_conferences values('8600128','10.10.10.15',''); +insert into vicidial_conferences values('8600129','10.10.10.15',''); +insert into vicidial_conferences values('8600130','10.10.10.15',''); +insert into vicidial_conferences values('8600131','10.10.10.15',''); +insert into vicidial_conferences values('8600132','10.10.10.15',''); +insert into vicidial_conferences values('8600133','10.10.10.15',''); +insert into vicidial_conferences values('8600134','10.10.10.15',''); +insert into vicidial_conferences values('8600135','10.10.10.15',''); +insert into vicidial_conferences values('8600136','10.10.10.15',''); +insert into vicidial_conferences values('8600137','10.10.10.15',''); +insert into vicidial_conferences values('8600138','10.10.10.15',''); +insert into vicidial_conferences values('8600139','10.10.10.15',''); +insert into vicidial_conferences values('8600140','10.10.10.15',''); +insert into vicidial_conferences values('8600141','10.10.10.15',''); +insert into vicidial_conferences values('8600142','10.10.10.15',''); +insert into vicidial_conferences values('8600143','10.10.10.15',''); +insert into vicidial_conferences values('8600144','10.10.10.15',''); +insert into vicidial_conferences values('8600145','10.10.10.15',''); +insert into vicidial_conferences values('8600146','10.10.10.15',''); +insert into vicidial_conferences values('8600147','10.10.10.15',''); +insert into vicidial_conferences values('8600148','10.10.10.15',''); +insert into vicidial_conferences values('8600149','10.10.10.15',''); +insert into vicidial_conferences values('8600150','10.10.10.15',''); +insert into vicidial_conferences values('8600151','10.10.10.15',''); +insert into vicidial_conferences values('8600152','10.10.10.15',''); +insert into vicidial_conferences values('8600153','10.10.10.15',''); +insert into vicidial_conferences values('8600154','10.10.10.15',''); +insert into vicidial_conferences values('8600155','10.10.10.15',''); +insert into vicidial_conferences values('8600156','10.10.10.15',''); +insert into vicidial_conferences values('8600157','10.10.10.15',''); +insert into vicidial_conferences values('8600158','10.10.10.15',''); +insert into vicidial_conferences values('8600159','10.10.10.15',''); +insert into vicidial_conferences values('8600160','10.10.10.15',''); +insert into vicidial_conferences values('8600161','10.10.10.15',''); +insert into vicidial_conferences values('8600162','10.10.10.15',''); +insert into vicidial_conferences values('8600163','10.10.10.15',''); +insert into vicidial_conferences values('8600164','10.10.10.15',''); +insert into vicidial_conferences values('8600165','10.10.10.15',''); +insert into vicidial_conferences values('8600166','10.10.10.15',''); +insert into vicidial_conferences values('8600167','10.10.10.15',''); +insert into vicidial_conferences values('8600168','10.10.10.15',''); +insert into vicidial_conferences values('8600169','10.10.10.15',''); +insert into vicidial_conferences values('8600170','10.10.10.15',''); +insert into vicidial_conferences values('8600171','10.10.10.15',''); +insert into vicidial_conferences values('8600172','10.10.10.15',''); +insert into vicidial_conferences values('8600173','10.10.10.15',''); +insert into vicidial_conferences values('8600174','10.10.10.15',''); +insert into vicidial_conferences values('8600175','10.10.10.15',''); +insert into vicidial_conferences values('8600176','10.10.10.15',''); +insert into vicidial_conferences values('8600177','10.10.10.15',''); +insert into vicidial_conferences values('8600178','10.10.10.15',''); +insert into vicidial_conferences values('8600179','10.10.10.15',''); +insert into vicidial_conferences values('8600180','10.10.10.15',''); +insert into vicidial_conferences values('8600181','10.10.10.15',''); +insert into vicidial_conferences values('8600182','10.10.10.15',''); +insert into vicidial_conferences values('8600183','10.10.10.15',''); +insert into vicidial_conferences values('8600184','10.10.10.15',''); +insert into vicidial_conferences values('8600185','10.10.10.15',''); +insert into vicidial_conferences values('8600186','10.10.10.15',''); +insert into vicidial_conferences values('8600187','10.10.10.15',''); +insert into vicidial_conferences values('8600188','10.10.10.15',''); +insert into vicidial_conferences values('8600189','10.10.10.15',''); +insert into vicidial_conferences values('8600190','10.10.10.15',''); +insert into vicidial_conferences values('8600191','10.10.10.15',''); +insert into vicidial_conferences values('8600192','10.10.10.15',''); +insert into vicidial_conferences values('8600193','10.10.10.15',''); +insert into vicidial_conferences values('8600194','10.10.10.15',''); +insert into vicidial_conferences values('8600195','10.10.10.15',''); +insert into vicidial_conferences values('8600196','10.10.10.15',''); +insert into vicidial_conferences values('8600197','10.10.10.15',''); +insert into vicidial_conferences values('8600198','10.10.10.15',''); +insert into vicidial_conferences values('8600199','10.10.10.15',''); +insert into vicidial_conferences values('8600200','10.10.10.15',''); + +######------ END Mysql data entry ------###### + + + +SUBPHASE 6.4: setting up asterisk and helper applications for startup + +1. Make several entries in the rc.local of your system: + - on the command line type: + - vi /etc/rc.d/rc.local + - add the following entries(here's what we used): + +### uncomment If kernel RAM drive is enabled +# mke2fs -m 0 /dev/ram0 +# mount /dev/ram0 /var/spool/asterisk/monitor + +### Path to local asterisk-perl_0.08 module if needed +PERL5LIB="/usr/share/astguiclient/libs"; export PERL5LIB + +### start time server +/usr/local/bin/ntpdate -u 18.145.0.30 +/usr/sbin/ntpd + +### start up the MySQL server +/usr/local/mysql/bin/mysqld_safe --user=mysql --skip-name-resolve --skip-host-cache & + +### start up the MySQL 4.1.X server (with old passwords) +/usr/local/mysql/bin/safe_mysqld --old-passwords --skip-name-resolve --skip-host-cache & + +### start up the apache web server +/usr/local/apache2/bin/apachectl start + +### roll the Asterisk logs upon reboot +/usr/share/astguiclient/ADMIN_restart_roll_logs.pl + +### clear the server-related records from the database +/usr/share/astguiclient/AST_reset_mysql_vars.pl + +### load digium tormenta 4xT1 drivers into system +modprobe zaptel +modprobe wct1xxp +/sbin/ztcfg -vvvvvvvvvvvv + +### sybsys local login +touch /var/lock/subsys/local + +### sleep for 20 seconds before launching Asterisk +sleep 20 + +### start up asterisk +/usr/share/astguiclient/start_asterisk_boot.pl + + - you are done + + + + +SUBPHASE 6.5: setting up astguiclient scripts for continuous running + +1. Make several entries in the crontab of your system: + - on the command line type: + - cd /usr/share/astguiclient + - crontab -e + - add the following entries(here's what we used): + (Note if you have not edited the AST_CRON_mix_recordings.pl script +to FTP to a different server, then you should use the +AST_CRON_mix_recordings_BASIC.pl file in it's place) + +### recording mixing for Asterisk run every 5 minutes +1,6,11,16,21,26,31,36,41,46,51,56 * * * 1,2,3,4,5,6 /usr/share/astguiclient/AST_CRON_mix_recordings_BASIC.pl + +### keepalive script for astguiclient processes +* * * * * /usr/share/astguiclient/ADMIN_keepalive_ALL.pl + +### kill Hangup script for Asterisk updaters +* * * * * /usr/share/astguiclient/AST_manager_kill_hung_congested.pl + +### updater for voicemail +* * * * * /usr/share/astguiclient/AST_vm_update.pl + +### updater for conference validator +* * * * * /usr/share/astguiclient/AST_conf_update.pl + +### flush queue DB table every hour for entries older than 1 hour +11 * * * * /usr/share/astguiclient/AST_flush_DBqueue.pl -q + +### fix the vicidial_agent_log once every hour +33 * * * * /usr/share/astguiclient/AST_cleanup_agent_log.pl + +### updater for VICIDIAL hopper +* * * * * /usr/share/astguiclient/AST_VDhopper.pl -q + +### adjust the GMT offset for the leads in the vicidial_list table +1 1,7 * * * /usr/share/astguiclient/ADMIN_adjust_GMTnow_on_leads.pl --debug --postal-code-gmt + +### reset several temporary-info tables in the database +2 1 * * * /usr/share/astguiclient/AST_reset_mysql_vars.pl + +### optimize the database tables within the asterisk database +3 1 * * * /usr/share/astguiclient/AST_DB_optimize.pl + +## adjust time on the server with ntp +30 * * * * /usr/local/bin/ntpdate -u 18.145.0.30 2>/dev/null 1>&2 + +### VICIDIAL agent time log weekly and daily summary report generation +2 0 * * 0 /usr/share/astguiclient/AST_agent_week.pl +22 0 * * * /usr/share/astguiclient/AST_agent_day.pl + +### VICIDIAL campaign export scripts (OPTIONAL) +#32 0 * * * /usr/share/astguiclient/AST_VDsales_export.pl +#42 0 * * * /usr/share/astguiclient/AST_sourceID_summary_export.pl + +### remove old recordings more than 7 days old +24 0 * * * /usr/bin/find /var/spool/asterisk/monitor -maxdepth 2 -type f -mtime +7 -print | xargs rm -f + +### remove old vicidial logs and asterisk logs more than 2 days old +28 0 * * * /usr/bin/find /var/log/astguiclient -maxdepth 1 -type f -mtime +2 -print | xargs rm -f +29 0 * * * /usr/bin/find /var/log/asterisk -maxdepth 3 -type f -mtime +2 -print | xargs rm -f + + + + + - once your system starts up you can attach to the screen running asterisk by +typing "screen -r " find which screen by typing "screen -r" and +looking for the lowest screen number. Then to detach again from the screen +while you are in it type 'Ctrl+a' then 'd' + - you are done + +NOTES: +- The AST_agent_day.pl and AST_agent_week.pl scripts create an ASCII fixed-length report of all agent activity on the system +- The AST_VDsales_export.pl script allows for the exporting(into several different formats) of specified vicidial_list data based on status and campaign as well as inbound group +- The AST_sourceID_summary_export.pl script summarizes leads in the system by source_id and generates a text report + + + + + +SUBPHASE 6.6: adding test leads to the VICIDIAL database and configuring a +VICIDIAL campaign and users + +First we will add a few test leads to the vicidial_list table so that we can +test our system. There is also an application included with the distribution +that will accept a delimited file of leads placed in the /usr/share/astguiclient/VICIDIAL/LEADS_IN/ +directory and load it into the database automatically(VICIDIAL_IN_new_leads_file.pl +[a sample lead file in the proper format is included with this release: + - test_VICIDIAL_lead_file.txt]) +If you want to use the lead import script I suggest looking at the code to make +sure it is entering what you want it to. We are not going to go over that +particular script in this document. + +Also, there is a web-based lead loader that was made available as of the 1.1.1 +release and is accessible from the VICIDIAL admin.php web page(click on the +"LOAD NEW LEADS" link at the top of the admin page). To get to this page you +must have permissions in the vicidial_user table(Load Leads set to 1) . +Instructions on it's use are included on the page through the help question +mark link. +NOTE: in PHP you must have "fileuploads" enabled for this page to work. +NOTE: it is important to have your proper country code in the phone_code field of your leads so that the GMT offset encodding will properly code the time zones for your leads. For the USA/Canada/Caribbean this would be 1. For the UK this is 44 and Mexico is 52 and so on. + +Second we need to add the disposition statuses into the system, all of these +queries are below: +(Note: you may want to replace 7275551212 with a real number to test in these +records) + +1. at the command prompt type go to the mysql client: +/usr/local/mysql/bin/mysql +2. type the following into the mysql client prompt: + (make sure you put your IP address in place of "10.10.10.15" in the queries +below) +######------ BEGIN Mysql data entry(you can copy and paste this into terminal) # + +insert into vicidial_list values('','2004-01-06','','NEW','','','TEST01','101','TESTCAMP','N','1','7275551212','Mr','Matt','X','lead01','1234 Fake St.','','','Clearwater','FL','','33760','USA','M','1970-01-01','','test@test.com','suprise','comments go here','0'); +insert into vicidial_list values('','2004-01-06','','NEW','','','TEST01','101','TESTCAMP','N','1','7275551212','Mr','Matt','X','lead02','1234 Fake St.','','','Clearwater','FL','','33760','USA','M','1970-01-01','','test@test.com','suprise','comments go here','0'); +insert into vicidial_list values('','2004-01-07','','NEW','','','TEST01','101','TESTCAMP','N','1','7275551212','Mr','Matt','X','lead03','1234 Fake St.','','','Clearwater','FL','','33760','USA','M','1970-01-01','','test@test.com','suprise','comments go here','0'); +insert into vicidial_list values('','2004-01-07','','NEW','','','TEST01','101','TESTCAMP','N','1','7275551212','Mr','Matt','X','lead04','1234 Fake St.','','','Clearwater','FL','','33760','USA','M','1970-01-01','','test@test.com','suprise','comments go here','0'); +insert into vicidial_list values('','2004-01-07','','NEW','','','TEST01','101','TESTCAMP','N','1','7275551212','Mr','Matt','X','lead05','1234 Fake St.','','','Clearwater','FL','','33760','USA','M','1970-01-01','','test@test.com','suprise','comments go here','0'); +insert into vicidial_list values('','2004-01-07','','NEW','','','TEST01','101','TESTCAMP','N','1','7275551212','Mr','Matt','X','lead06','1234 Fake St.','','','Clearwater','FL','','33760','USA','M','1970-01-01','','test@test.com','suprise','comments go here','0'); +insert into vicidial_list values('','2004-01-07','','NEW','','','TEST01','101','TESTCAMP','N','1','7275551212','Mr','Matt','X','lead07','1234 Fake St.','','','Clearwater','FL','','33760','USA','M','1970-01-01','','test@test.com','suprise','comments go here','0'); + +### these first 5 must be in all VICIDIAL systems for it to work properly # +insert into vicidial_statuses values('NEW','New Lead','N','N','UNDEFINED'); +insert into vicidial_statuses values('QUEUE','Lead To Be Called','N','N','UNDEFINED'); +insert into vicidial_statuses values('INCALL','Lead Being Called','N','N','UNDEFINED'); +insert into vicidial_statuses values('DROP','Agent Not Available','N','Y','UNDEFINED'); +insert into vicidial_statuses values('NA','No Answer AutoDial','N','N','UNDEFINED'); + +insert into vicidial_statuses values('CALLBK','Call Back','Y','Y','UNDEFINED'); +insert into vicidial_statuses values('A','Answering Machine','Y','N','UNDEFINED'); +insert into vicidial_statuses values('AA','Answering Machine Auto','N','N','UNDEFINED'); +insert into vicidial_statuses values('AM','Answering Machine Sent to Mesg','N','N','UNDEFINED'); +insert into vicidial_statuses values('AL','Answering Machine Msg Played','N','N','UNDEFINED'); +insert into vicidial_statuses values('B','Busy','Y','N','UNDEFINED'); +insert into vicidial_statuses values('DC','Disconnected Number','Y','N','UNDEFINED'); +insert into vicidial_statuses values('DEC','Declined Sale','Y','Y','UNDEFINED'); +insert into vicidial_statuses values('DNC','DO NOT CALL','Y','Y','UNDEFINED'); +insert into vicidial_statuses values('SALE','Sale Made','Y','Y','UNDEFINED'); +insert into vicidial_statuses values('N','No Answer','Y','N','UNDEFINED'); +insert into vicidial_statuses values('NI','Not Interested','Y','Y','UNDEFINED'); +insert into vicidial_statuses values('NP','No Pitch No Price','Y','Y','UNDEFINED'); +insert into vicidial_statuses values('XFER','Call Transferred','Y','Y','UNDEFINED'); + +quit +######------ END Mysql data entry ------###### + +Now that the sample leads and disposition codes have been entered, we can go +into the VICIDIAL administration website and set up our campaigns, lists and users. +But first let's make sure that they have the right GMT offset: + run this on the command line: + - /usr/share/astguiclient/ADMIN_adjust_GMTnow_on_leads.pl --postal-code-gmt + +3. Enter the astguiclient administration page: +http://10.10.10.15/vicidial/admin.php +(use the username and password created when we entered a record into the +vicidial_users table in SUBPHASE 6.1, In our case this is 6666 and 1234) +NOTE: if you click on the Logout button you must leave the user/pass empty and click OK + - Now that you are logged into the vicidial administration system we can add +new user entries for each of the new users and enter new campaigns and new +lists. + - The first step is to enter your new users, Click on the ADD A NEW USER +and fill in the appropriate information for each now user you want to +add. + - Next, you need to create a new campaign, click on the ADD A NEW +CAMPAIGN link and fill in what you want the campaign to be called as +well as a description + - Next, you need to define a new list, click on the ADD A NEW LIST link +and fill in what you want the list to be called as well as a using the +list ID of the leads that we loaded in the previous step "101" and +select the new campaign from the pull-down menu that we just created. + - Now that you have created your list, make it active by changing active to Y + - now modify your campaign ang change the first status to be called to +NEW and submit. Now your system is ready to dial. + - you are done + + + +SUBPHASE 6.7: VICIDIAL remote agents: + +With v1.0 of VICIDIAL we have the ability to use a simple web form to give +remote agents a way to receive calls to whatever number they happen to be at, +and they can view/edit call details and see a call log all through a web page +(vdremote.php) or http://10.10.10.15/vicidial/vdremote.php on this installation. +Remote Agents is only recommended for inbound calls because of the extra time +needed to dial a number out to transfer the call to. To set up remote agents, +just go to the vicidial admin.php page and ADD NEW REMOTE AGENTS(Make sure the +userID start also has a user login so they can get to the vdremote page). You +will see that you can set up a remote agent entry to take multiple lines if you +wish meaning that, for example, if you need to send all of your calls to another +location because of a massive snowstorm(and none of your agents showed up at work) +you just log in that remote agent record with say 10 lines and then all of those +calls will be directed to the same number you set up for the remote agent. Then +again you could just get your agents to log in from home if they have a phone +and computer + + + +SUBPHASE 6.8: astGUIclient web-only client: + +With 1.1.1 release of astguiclient we have completely rewritten the astGUIclient +client app in AJAX(PHP/Javascript/XMLHTTPRequest) to enable a full, real-time +GUI interface using only a web browser. The browser requirements for this are: +- Firefox 0.9 or greater (Firefox 1.0.7 is the recommended browser) +- Mozilla 1.7 or greater +- Netscape 8 or greater +- Opera 8.5 or greater +- Microsoft Internet Explorer 6.0 + +This new version also has more flexibility and functionality than the perl/Tk +version as well as being prettier. We have successfully tested this on many +platforms and in remote locations. It functioned wonderfully off-site with one +of our IAX hardphones and offers a lot of promise for road warriors who need +a lot of options on their phone usage like conferencing and a detailed call log. + +To log into this app you will need a login setup in the vicidial_users table +with a user_level of 1 or greater as well as an entry for the phone you are +using in the phones table. You will first get a login prompt for the vicidial +login then you will have the phone login where you enter the Login and Password +for that phone entry. From there the app should display and you will see the +MAIN screen with your phone information, voicemail display and your inbound/ +outbound phone call log. + +The example web page you would go to on this installation would be: +http://10.10.10.15/agc/astguiclient.php + +The inbound log and callerID popup is dependant on having a call_inbound.agi +entry in your dialplan before you phone is dialed(see subphase 6.2 step 2) + +Another thing to note is that you can have the agc folder(with the .php files +in it) copied to multiple web servers, you just need to make sure that the +MySQL database connection works (check the settings in the dbconnect.php file +that is in the agc directory). We have had astguiclient.php running on 3 +separate web servers for the same DB server and Asterisk server. This is an +easy way to allow for auto failover and/or redundancy. Also, this client will +work over SSL connections(https) for encrypted communications with the server. + +New in astGUIclient release 1.1.7 is multi-language support. multi-language +versions of web-clients and admin pages are available in the LANG_www directory +and can be unzipped into your webroot directory. + + + +SUBPHASE 6.9: VICIDIAL web-only client: + +NOTE: There is a VICIDIAL Agent manual available from http://www.eflo.net + +With 1.1.6 release of astguiclient we have finished the rewrite of the VICIDIAL +client app in AJAX(PHP/Javascript/XMLHTTPRequest) to enable a full, real-time +GUI interface using only a web browser like we have done with astGUIclient. +The browser requirements for this are: +- Firefox 0.9 or greater (Firefox 1.0.7 is the recommended browser) +- Mozilla 1.7 or greater +- Netscape 8 or greater +- Opera 8.5 or greater +- Microsoft Internet Explorer 6.0 + +This version is fully functional and has been tested in our production +call center with no problems. On RedHat 9.0 Linux workstations we have noticed +a decrease in system load running the web-client as compared to the Perl/Tk +client. Also, the memory usage stayed at about 22MB for a full shift of +activity, so no memory leaks with Firefox. + +To log into this app you will need a login setup in the vicidial_users table +with a user_level of 1 or greater as well as an entry for the phone you are +using in the phones table. You will first get a login prompt for the vicidial +login then you will have the phone login where you enter the Login and Password +for that phone entry. From there the app should display and you will see the +VICIDIAL screen with your phone information. + +The example web page you would go to on this installation would be: +http://10.10.10.15/agc/vicidial.php + +One more feature that the VICIDIAL web-client offers is the ability to set up +an EXTERNAL phone extension in the astguiclient admin section so that you can +have agents log in to vicidial.php wherever they have access to a phone with +an external phone number and a web browser. To do this follow these steps: +- "ADD PHONE" in the admin.php web page and enter whatever name you want +- For the dialplan number field put in the full digits that you would dial from + the Asterisk server to get to that agent's external phone(with 91 if used) +- For the Protocol select EXTERNAL +- make sure the agent knows the login and password set for this phone entry. +Then the agent will go to the vicidial.php page and enter in their phone +login/pass, their vicidial user/pass/campaign and their phone should ring in a +few seconds, and they are logged in and ready to take calls. + +Another thing to note is that you can have the agc folder(with the .php files +in it) copied to multiple web servers, you just need to make sure that the +MySQL database connection works (check the settings in the dbconnect.php file +that is in the agc directory). We have had astguiclient.php running on 3 +separate web servers for the same DB server and Asterisk server. This is an +easy way to allow for auto failover and/or redundancy. Also, this client will +work over SSL connections(https) for encrypted communications with the server. + +New in astGUIclient release 1.1.7 is multi-language support. multi-language +versions of web-clients and admin pages are available in the LANG_www directory +and can be unzipped into your webroot directory. + +Admin Note: If you want to enable your agents to login with only their user/pass +you can hardcode the phone_login and phone_pass into the query string(URL) and +use a bookmark on their desktop, taking one more step out of their login process +example: http://10.10.10.15/agc/vicidial.php?pl=gs102&pp=test + +It is recommended if you are in a call center environment that you would disable +the "Saved Form Information" option in Firefox settings. This is a checkbox in +the Privacy settings under the Options menu. + + + +PHASE 7.0: You are done with installation + +If you have problems and it is not working right(and are NOT celebrating right +now), feel free to take a look at the FAQ for solutions to common installation +errors, read the SCRATCH_INSTALL document, visit the VICIDIAL forum or send an +email to the mailing list: +http://www.eflo.net/VICIDIALforum/index.php +https://lists.sourceforge.net/lists/listinfo/astguiclient-users + +Also, check out our weblog: http://astguiclient.blogspot.com/ + + +**** IMPORTANT - In order for vicidial/astguiclient to function correctly please +read the REQUIREMENTS.txt for a minimum requirements list. *** + +End-user Manuals for Agents and Managers are available from http://www.eflo.net diff --git a/agc_2-X/branches/agc_2.0.4/docs/Slackware-Linux_USA_DST_changes.txt b/agc_2-X/branches/agc_2.0.4/docs/Slackware-Linux_USA_DST_changes.txt new file mode 100644 index 00000000..b6c64cf0 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/Slackware-Linux_USA_DST_changes.txt @@ -0,0 +1,48 @@ +Below are Timezone update instructions for Slackware and any generic Linux +install. Because of the changes in Daylight Savings Time in the USA ad Canada +in 2007, it becomes necessary to update your system's timezone info if you are +using a Linux distro that was released before 2006 and have not updated it. + +SLACKWARE 10.2: +cd / +wget ftp://ftp.slackware.com/pub/slackware/slackware-10.2/patches/packages/glibc-zoneinfo-2.3.5-noarch-7_slack10.2.tgz +gunzip glibc-zoneinfo-2.3.5-noarch-7_slack10.2.tgz +tar xvf glibc-zoneinfo-2.3.5-noarch-7_slack10.2.tar +chmod 0777 install/doinst.sh +./install/doinst.sh +date + + +SLACKWARE 10.1: +cd / +ncftpget ftp://ftp.slackware.com/pub/slackware/slackware-10.1/patches/packages/glibc-zoneinfo-2.3.4-noarch-2_slack10.1.tgz +gunzip glibc-zoneinfo-2.3.4-noarch-2_slack10.1.tgz +tar xvf glibc-zoneinfo-2.3.4-noarch-2_slack10.1.tar +chmod 0777 install/doinst.sh +./install/doinst.sh +date + + +SLACKWARE 10.0: +cd / +ncftpget ftp://ftp.slackware.com/pub/slackware/slackware-10.0/patches/packages/glibc-zoneinfo-2.3.2-noarch-7_slack10.0.tgz +gunzip glibc-zoneinfo-2.3.2-noarch-7_slack10.0.tgz +tar xvf glibc-zoneinfo-2.3.2-noarch-7_slack10.0.tar +chmod 0777 install/doinst.sh +./install/doinst.sh +date + + +GENERIC LINUX TIMEZONE CHANGES(Example New York EST): +cd /tmp +ncftpget ftp://elsie.nci.nih.gov/pub/tzdata2007c.tar.gz +gunzip tzdata2007c.tar.gz +tar xvf tzdata2007c.tar +zic -d /tmp/zoneinfo northamerica +cp -f /tmp/zoneinfo/EST5EDT /usr/share/zoneinfo/ +cp -f /tmp/zoneinfo/America/New_York /usr/share/zoneinfo/America/ +zdump -v /usr/share/zoneinfo/EST5EDT | grep 2007 +zdump -v /usr/share/zoneinfo/America/New_York | grep 2007 +ln -fs /etc/localtime /usr/share/zoneinfo/EST5EDT +zdump -v /etc/localtime | grep 2007 +date diff --git a/agc_2-X/branches/agc_2.0.4/docs/VICIDIAL.txt b/agc_2-X/branches/agc_2.0.4/docs/VICIDIAL.txt new file mode 100644 index 00000000..b261ca04 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/VICIDIAL.txt @@ -0,0 +1,207 @@ +# VICIDIAL.txt - description of the vicidial call center system +# pronounced (VEE-CHEE DIAL) + +This system was initially created to fill the need of a customer service group +being able to call up clients efficiently and without using a predictive dialer +that would potentially lose calls and alienate clients. Since then we have added +the ability to do predictive dialing alongside ratio dialing and the traditional +one-call-at-a-time dialing as well as the ability to take inbound calls and set +up campaigns to do blended inbound and outbound call handling at the same time. + +Major Features: +- Inbound, Outbound and Blended call handling +- Outbound agent-controlled, broadcast and predictive dialing +- Full USA FTC-compliance capability +- Web-based agent and administrative interfaces +- Ability to have agents operate remotely +- Integrated call recording +- Three-Way calling within the agent application +- Scheduled Callbacks: Agent-Only and Anyone +- Scalable to hundreds of seats +- Ability to use standard Telco lines and VOIP trunks +- Open-Source GPL licensed, with no software licensing cost + +Complete Features List: +- Ability for an agent to call clients in succession from a database through a web-client +- Ability to display a script for the agent to read with fields like name, address, etc. filled-in +- Ability to set a campaign to auto-dial and send live calls to available agents +- Ability to dial predictively in a campaign with an adaptive dialing algorithm +- Ability to dial on a single campaign across multiple Asterisk servers, or multiple campaigns on a single server +- Ability to transfer calls with customer data to a closer on the local system or a remote Asterisk server +- Ability to open a custom web page with user data from the call, per campaign +- Ability to autodial campaigns to start with a simple IVR then direct to agent +- Ability to broadcast dial to customers with a pre-recorded message +- Ability to park the customer with custom music per campaign +- Ability to send a dropped call to a voicemail box per campaign if no agent is available +- Ability to set outbound CallerID per campaign +- Ability to take inbound calls grabbing CallerID +- Ability to function as an ACD for inbound and fronter/closer verification calls +- Ability to have an agent take both inbound and outbound calls in one session(blended) +- Ability to start and stop recording an agent's calls at any time +- Ability to automatically record all calls +- Ability to manually or automatically call upto two other customer numbers for the same lead +- Ability to schedule a callback with a customer as either any-agent or agent-specific +- Ability in Manual dial mode to preview leads before dialing +- Ability for agents to be logged in remotely anywhere with just a phone and a web browser +- Faster hangup and dispositioning of calls with one key press (HotKeys) +- Definable Agent Wrapup-time per campaign +- Ability to add custom call dispositions per campaign +- Ability to use custom database queries in campaign dialing +- Recycling of Busy calls at a specified interval without resetting a list +- Dialing with custom TimeZone restrictions including per state and per day-of-the-week +- Dialing with Answering Machine Detection, also playing a message for AM calls +- Multiple campaigns and lead-lists are possible +- Option of a drop timer with safe-harbor message for FTC compliance +- Variable drop call percentage when dialing predictively for FTC compliance +- Internal DNC list can optionally be activated per campaign +- All calls are logged and statuses of calls are logged as well as agent time breakdowns +- Load Balancing across multiple inbound or outbound Asterisk servers is possible +- Several real-time and summary reports available +- Real-time campaign display screens +- 3rd party conferencing(with DTMF macros and number presets) +- 3rd party blind call transfer +- 3rd party conferencing with agent drop-off +- Ability to set user levels and permissions for certain features and campaigns +- Ability for managers to listen-in on agent conversations +- Ability for managers to enter conversations with agents and customers +- Ability for agents to select a Pause Code when they are not active +- Ability for agents to control volume levels and mute themselves +- Outbound dialing is QueueMetrics-compatible +- Web-based administration +- Client web-app web pages available in English, Spanish, Greek, German, French, Italian, Polish, Portuguese and Brazillian Portuguese +- Admin web pages available in English, Spanish, Greek and German + +Required components: +- Asterisk server with Zap, IAX2 or SIP trunks +- SIP/IAX/Zap phones(hard or soft single-line or multiple) +- Computer with proper software installed + - on Win32 Activestate perl + - on UNIX Xwindows Activestate perl recommended with perlTK libs loaded +- Asterisk server with proper software installed +- astGUIclient must be installed with the Asterisk Central Queue System(ACQS) +running + +Approach: +This system is dependant on a MySQL server acting as the storage place of +all data and settings for the system. This was done so that it would be very +scalable and flexible. This application draws on a lot of the core scripting +inside of the astGUIclient suite of applications and was built with flexibility +in mind. We have used VICIDIAL for over three years now on up to 160 seats at +once across 8 separate Asterisk servers all using the same MySQL server and +dialing on the same campaigns. It is important to keep in mind that because +VICIDIAL uses Asterisk meetme rooms for it's dialing that the Asterisk server +will see an increased load as compared to a simple Zap/SIP-only calls. + +Installation: +Look at the INSTALL FROM SCRATCH documentation and start at phase 6 if you +already have asterisk running + +Process flow of a one-call-at-a-time call: + - all components are installed and running(with Asterisk and MySQL servers) + - user logs in to the client GUI [user/password/campaign] + - GUI assigns an open meetme extension to the user, this is called the +session_id + - GUI sends manager command ORIGINATE to connect the user to the meetme ext + - user clicks DIAL NEXT NUMBER and GUI UPDATEs first available number-to-call +in DB to PENDING status + - GUI SELECTs info on that number[name/address/...] + - GUI sends ORIGINATE command to call that client's number from meetme ext + - user is talking to the client + - user transfers call to 3rd party, client Zap channel is REDIRECTed to +3rd party + or + - User transfers client to a closer to finish the call + or + - user puts client on park and dials 3rd party, then transfers client +back to meetme room + - Call is Hung up + - user hangs up call and clicks HANGUP CALL on GUI + or + - person called hangs up so user clicks on the CALL HUNGUP then HANGUP +CALL + - call is disconnected + - user selects disposition status of the call and clicks OK + - goes back to step 4 and repeats + +Process flow of an auto-dial call: + - The lead hopper app(AST_VDhopper.pl) that is running every minute keeps the +hopper for each campaign up to at least the minimum hopper lead size providing +there are enough leads to fill it. + - The predictive dialing control app(AST_VDadapt.pl) that is running constantly +analyzes the current status of calls and agents and calculates the dial level +that the campaign will need to be set at for the campaign's specific settings. + - The call center manager can either set the dial method (on the campaign +screen of the admin web page) to Manual for no autodialing, Ratio for fixed +lines-to-agent dialing or any of the Adapt predictive dialing models to use +Predictive dialing. + - As soon as an agent logs into a campaign, the client app will look at the +auto_dial_level setting of the campaign and determine whether + - it will insert a record into the vicidial_live_agents table(and set +status to READY) and update that record every second with a random 8 +digit number to show that the client is still alive and ready. Also, +the client app will show a "pause" and "resume" button to start or stop +receiving calls automatically instead of the usual "dial next number" +button. + or + - it will allow normal manual dialing operation + - The auto_dial app(AST_VDauto_dial.pl) will: + - count how many agents are READY,QUEUE,INCALL with updated +last_update_time in the last 2.5 seconds. + - look at the campaign's auto_dial_level to determine how many calls +should be placed each specific campaign on each server. + - update the vicidial_auto_calls records by searching for active +callerids in the vicidial_manager to see if they have hung up. + - count the number of active calls that are +occuring(vicidial_auto_calls records with a status of SENT,RINGING or +LIVE) + - place the calls for each server if the active calls is less than the +total that should be placed + - The auto_dial app will then: + - grab the next lead to be called from the vicidial_hopper for each +campaign(it will update that lead record in the vicidial_hopper table +to QUEUE with VDAD as the user) + - grab the lead information from vicidial_list and update +called_since_last_reset Y, the user to VDAD and increment the +called_count by 1 + - delete the record from vicidial_hopper for that lead + - place the call first to the Zap trunk(Exten: 917275551212), then to a +specified Local extension number(Channel: Local/99999@default) where +the auto_dial_transfer_agent app(agi-VDADtransfer.agi) is waiting to +take over. + - if the call is busy, disconnect or telco voicemail the call is never +technically picked up so it never makes it to the +auto_dial_transfer_agent app + - check for dead calls by looking in the call_log for and end time of +the call keyed by callerID(caller_code) and delete them t=from the +vicidial_auto_calls table + - The auto_dial_transfer_agent app takes the call and: + - immediately grabs the uniqueid and callerid of the call and updates +the vicidial_auto_calls record to LIVE + - logs the call to vicidial_log using the callerid to find out the lead +number(VmmddhhmmssLLLLLLLLL[where LLLLLLLLL is the zero-padded lead_id +from vicidial_list]) + - inserts the number_dialed and the caller_code in the vicidial_log +table for the uniqueid record of the call + - attempts to update(limit 1) a record in the vicidial_live_agents +table to see who is the next agent to receive a call(ordered by +last_call_time)[update the status to QUEUE, the lead_id to the proper +lead_id and the uniqueid and callerID to proper values for the call] + - if there are agents available[affected rows = 1](goto substep VII.) + - if there are no agents available: + - wait in 1 second increments and then checking substep IV. + - if no agent is available for the drop interval(usually 5 +seconds on outbound campaigns), the call is hung up and logged as DROP in +vicidial_log under user VDAD + - grabs the agent info from the vicidial_live_agents[conf_exten] and +does a redirect to the agent's meetme room. + - agent's app checks the vicidial_live_agents record every second for +itself to see if it is changed to QUEUE + - agent's app changes the vicidial_live_agents status to INCALL and +updates the vicidial_list record to INCALL and user to the agent's +userID and the call progresses normally + - The agent hangs up and the vicidial_live_agents record is changed back to +READY with the lead and call fields cleared out so the agent is ready to take +another call + + + diff --git a/agc_2-X/branches/agc_2.0.4/docs/bind_named_install.txt b/agc_2-X/branches/agc_2.0.4/docs/bind_named_install.txt new file mode 100644 index 00000000..979d66e3 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/bind_named_install.txt @@ -0,0 +1,108 @@ +wget http://ftp.isc.org/isc/bind9/9.3.2/bind-9.3.2.tar.gz +gunzip bind-9.3.2.tar.gz +tar xvf bind-9.3.2.tar +cd bind-9.3.2 +./configure +make +make install +locate -u +vi /etc/named.conf +vi /var/named/vicimarketing.zone +/usr/sbin/named-checkconf +/usr/sbin/named-checkzone +/usr/sbin/named-checkzone vicimarketing.com /var/named/vicimarketing.zone +vi /etc/named.conf +vi /etc/resolv.conf +/usr/sbin/named -d 9 + +To kill named: +killall -15 named + +To run testing in foreground: +/usr/sbin/named -f -d 9 + + + +root@ftp:/# cat /var/named/vicimarketing.zone +; +; Zone file for vicimarketing.com +; +; The full zone file +; +$TTL 1H +@ IN SOA ftp.vicimarketing.com. sip.vicimarketing.com. ( + 200607101 ; serial# + 3600 ; refresh, seconds + 3600 ; retry, seconds + 3600 ; expire, seconds + 3600 ) ; minimum, seconds +; + NS ftp ; Inet Address of nameserver +vicimarketing.com. MX 10 email ; Primary Mail Exchanger +vicimarketing.com. MX 70 email2 ; Primary Mail Exchanger +; +localhost A 127.0.0.1 +@ A 64.31.159.154 +www A 64.31.159.154 +www2 A 205.201.151.24 +email A 205.201.151.23 +email2 A 68.143.231.202 +ftp A 205.201.151.22 +rsc1 A 205.201.151.21 +annex A 205.201.151.26 +telcove A 64.31.159.154 +tc2 A 64.31.159.155 +codygate A 67.79.161.170 +viciDB3 A 205.201.151.26 +exchange A 10.10.10.5 +ICIast20 CNAME www2 +VICIast1 CNAME www2 +app2 CNAME www2 +cody CNAME codygate +sip CNAME ftp +gate3 CNAME www2 +gate2 CNAME www + + + + + +root@ftp:/# cat /etc/named.conf +options { + directory "/var/named"; + forwarders { 209.84.253.11; 209.84.253.12; }; + /* + * If there is a firewall between you and nameservers you want + * to talk to, you might need to uncomment the query-source + * directive below. Previous versions of BIND always asked + * questions using port 53, but BIND 8.1 uses an unprivileged + * port by default. + */ + // query-source address * port 53; +}; + +// +// a caching only nameserver config +// +zone "." IN { + type hint; + file "caching-example/named.ca"; +}; + +zone "localhost" IN { + type master; + file "caching-example/localhost.zone"; + allow-update { none; }; +}; + +zone "0.0.127.in-addr.arpa" IN { + type master; + file "caching-example/named.local"; + allow-update { none; }; +}; +zone "vicimarketing.com" { + type master; + notify no; + allow-query { any; }; + file "vicimarketing.zone"; +}; diff --git a/agc_2-X/branches/agc_2.0.4/docs/conf_examples/dnsmgr.conf.sample b/agc_2-X/branches/agc_2.0.4/docs/conf_examples/dnsmgr.conf.sample new file mode 100644 index 00000000..160aecc4 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/conf_examples/dnsmgr.conf.sample @@ -0,0 +1,3 @@ +[general] +enable=yes ; enable creation of managed DNS lookups +refreshinterval=300 ; refresh managed DNS lookups every seconds diff --git a/agc_2-X/branches/agc_2.0.4/docs/conf_examples/extensions.conf.sample b/agc_2-X/branches/agc_2.0.4/docs/conf_examples/extensions.conf.sample new file mode 100644 index 00000000..3902f7b0 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/conf_examples/extensions.conf.sample @@ -0,0 +1,790 @@ +[general] +static=yes +writeprotect=no + +[globals] +CONSOLE=Console/dsp ; Console interface for demo +TRUNK=Zap/g1 ; Trunk interface +TRUNKX=Zap/g2 ; 2nd trunk interface +TRUNKIAX=IAX2/ASTtest1:test@10.10.10.16:4569 ; IAX trunk interface +TRUNKIAX1=IAX2/ASTtest1:test@10.10.10.16:4569 ; IAX trunk interface +TRUNKBINFONE=IAX2/1112223333:PASSWORD@iax.binfone.com ; IAX trunk interface +SIPtrunk=SIP/1234:PASSWORD@sip.provider.net ; SIP trunk + +[default] +; Example phone extensions + + +; Extension 2000 Sipura line 1 +exten => 2000,1,Dial,sip/spa2000|30|to ; Ring, 30 secs max +exten => 2000,2,Voicemail,u2000 ; Send to voicemail... +; Extension 2001 Sipura line 2 +exten => 2001,1,Dial,sip/spa2001|30|to ; Ring, 30 secs max +exten => 2001,2,Voicemail,u2001 ; Send to voicemail... +; Extension 2020 rings both sipura lines +exten => 2020,1,Dial,sip/spa2000&sip/spa2001|30|to ; Ring, 30 secs max +exten => 2020,2,Voicemail,u2000 ; Send to voicemail... +; Extension 301 rings the firefly softphone +exten => 401,1,Dial,(IAX2/firefly01@firefly01/s) +exten => 401,2,Hangup +; extensions for other SIP and IAX call center phones +exten => 100,2,Dial,sip/cc100|20|to +exten => 101,2,Dial,sip/cc101|20|to +exten => 102,2,Dial,sip/cc102|20|to +exten => 103,2,Dial,sip/cc103|20|to +exten => 104,2,Dial,sip/cc104|20|to +exten => 105,2,Dial,sip/cc105|20|to +exten => 106,2,Dial,sip/cc106|20|to +exten => 107,2,Dial,sip/cc107|20|to +exten => 108,2,Dial,sip/cc108|20|to +exten => 109,2,Dial,sip/cc109|20|to +exten => 110,2,Dial,sip/cc110|20|to +exten => 111,2,Dial,sip/cc111|20|to +exten => 112,2,Dial,sip/cc112|20|to +exten => 113,2,Dial,sip/cc113|20|to +exten => 114,2,Dial,sip/cc114|20|to +exten => 115,2,Dial,sip/cc115|20|to +exten => 116,2,Dial,sip/cc116|20|to +exten => 117,2,Dial,sip/cc117|20|to +exten => 118,2,Dial,sip/cc118|20|to +exten => 119,2,Dial,sip/cc119|20|to +exten => 120,2,Dial,sip/cc120|20|to +exten => 121,2,Dial,sip/cc121|20|to +exten => 122,2,Dial,sip/cc122|20|to +exten => 123,2,Dial,sip/cc123|20|to +exten => 124,2,Dial,sip/cc124|20|to +exten => 125,2,Dial,sip/cc125|20|to +exten => 126,2,Dial,sip/cc126|20|to +exten => 127,2,Dial,sip/cc127|20|to +exten => 128,2,Dial,sip/cc128|20|to +exten => 129,2,Dial,sip/cc129|20|to +exten => 130,2,Dial,sip/cc130|20|to +exten => 131,2,Dial,sip/cc131|20|to +exten => 132,2,Dial,sip/cc132|20|to +exten => 133,2,Dial,sip/cc133|20|to +exten => 134,2,Dial,sip/cc134|20|to +exten => 135,2,Dial,sip/cc135|20|to +exten => 136,2,Dial,sip/cc136|20|to +exten => 137,2,Dial,sip/cc137|20|to +exten => 138,2,Dial,sip/cc138|20|to +exten => 139,2,Dial,sip/cc139|20|to +exten => 140,2,Dial,sip/cc140|20|to +exten => 141,2,Dial,sip/cc141|20|to +exten => 142,2,Dial,sip/cc142|20|to +exten => 143,2,Dial,sip/cc143|20|to +exten => 144,2,Dial,sip/cc144|20|to +exten => 145,2,Dial,sip/cc145|20|to +exten => 146,2,Dial,sip/cc146|20|to +exten => 147,2,Dial,sip/cc147|20|to +exten => 148,2,Dial,sip/cc148|20|to +exten => 149,2,Dial,sip/cc149|20|to +exten => 150,2,Dial,sip/cc150|20|to + +exten => 300,2,Dial,IAX2/cc300|20|to +exten => 301,2,Dial,IAX2/cc301|20|to +exten => 302,2,Dial,IAX2/cc302|20|to +exten => 303,2,Dial,IAX2/cc303|20|to +exten => 304,2,Dial,IAX2/cc304|20|to +exten => 305,2,Dial,IAX2/cc305|20|to +exten => 306,2,Dial,IAX2/cc306|20|to +exten => 307,2,Dial,IAX2/cc307|20|to +exten => 308,2,Dial,IAX2/cc308|20|to +exten => 309,2,Dial,IAX2/cc309|20|to +exten => 310,2,Dial,IAX2/cc310|20|to +exten => 311,2,Dial,IAX2/cc311|20|to +exten => 312,2,Dial,IAX2/cc312|20|to +exten => 313,2,Dial,IAX2/cc313|20|to +exten => 314,2,Dial,IAX2/cc314|20|to +exten => 315,2,Dial,IAX2/cc315|20|to +exten => 316,2,Dial,IAX2/cc316|20|to +exten => 317,2,Dial,IAX2/cc317|20|to +exten => 318,2,Dial,IAX2/cc318|20|to +exten => 319,2,Dial,IAX2/cc319|20|to +exten => 320,2,Dial,IAX2/cc320|20|to +exten => 321,2,Dial,IAX2/cc321|20|to +exten => 322,2,Dial,IAX2/cc322|20|to +exten => 323,2,Dial,IAX2/cc323|20|to +exten => 324,2,Dial,IAX2/cc324|20|to +exten => 325,2,Dial,IAX2/cc325|20|to +exten => 326,2,Dial,IAX2/cc326|20|to +exten => 327,2,Dial,IAX2/cc327|20|to +exten => 328,2,Dial,IAX2/cc328|20|to +exten => 329,2,Dial,IAX2/cc329|20|to +exten => 330,2,Dial,IAX2/cc330|20|to +exten => 331,2,Dial,IAX2/cc331|20|to +exten => 332,2,Dial,IAX2/cc332|20|to +exten => 333,2,Dial,IAX2/cc333|20|to +exten => 334,2,Dial,IAX2/cc334|20|to +exten => 335,2,Dial,IAX2/cc335|20|to +exten => 336,2,Dial,IAX2/cc336|20|to +exten => 337,2,Dial,IAX2/cc337|20|to +exten => 338,2,Dial,IAX2/cc338|20|to +exten => 339,2,Dial,IAX2/cc339|20|to +exten => 340,2,Dial,IAX2/cc340|20|to +exten => 341,2,Dial,IAX2/cc341|20|to +exten => 342,2,Dial,IAX2/cc342|20|to +exten => 343,2,Dial,IAX2/cc343|20|to +exten => 344,2,Dial,IAX2/cc344|20|to +exten => 345,2,Dial,IAX2/cc345|20|to +exten => 346,2,Dial,IAX2/cc346|20|to +exten => 347,2,Dial,IAX2/cc347|20|to +exten => 348,2,Dial,IAX2/cc348|20|to +exten => 349,2,Dial,IAX2/cc349|20|to +exten => 350,2,Dial,IAX2/cc350|20|to + +; extensions if using a T1 channelbank +exten => 1901,1,Dial,Zap/1|30|o +exten => 1901,2,Hangup +exten => 1902,1,Dial,Zap/2|30|o +exten => 1902,2,Hangup +exten => 1903,1,Dial,Zap/3|30|o +exten => 1903,2,Hangup +exten => 1904,1,Dial,Zap/4|30|o +exten => 1904,2,Hangup +exten => 1905,1,Dial,Zap/5|30|o +exten => 1905,2,Hangup +exten => 1906,1,Dial,Zap/6|30|o +exten => 1906,2,Hangup +exten => 1907,1,Dial,Zap/7|30|o +exten => 1907,2,Hangup +exten => 1908,1,Dial,Zap/8|30|o +exten => 1908,2,Hangup +exten => 1909,1,Dial,Zap/9|30|o +exten => 1909,2,Hangup +exten => 1910,1,Dial,Zap/10|30|o +exten => 1910,2,Hangup +exten => 1911,1,Dial,Zap/11|30|o +exten => 1911,2,Hangup +exten => 1912,1,Dial,Zap/12|30|o +exten => 1912,2,Hangup +exten => 1913,1,Dial,Zap/13|30|o +exten => 1913,2,Hangup +exten => 1914,1,Dial,Zap/14|30|o +exten => 1914,2,Hangup +exten => 1915,1,Dial,Zap/15|30|o +exten => 1915,2,Hangup +exten => 1916,1,Dial,Zap/16|30|o +exten => 1916,2,Hangup +exten => 1917,1,Dial,Zap/17|30|o +exten => 1917,2,Hangup +exten => 1918,1,Dial,Zap/18|30|o +exten => 1918,2,Hangup +exten => 1919,1,Dial,Zap/19|30|o +exten => 1919,2,Hangup +exten => 1920,1,Dial,Zap/20|30|o +exten => 1920,2,Hangup +exten => 1921,1,Dial,Zap/21|30|o +exten => 1921,2,Hangup +exten => 1922,1,Dial,Zap/22|30|o +exten => 1922,2,Hangup +exten => 1923,1,Dial,Zap/23|30|o +exten => 1923,2,Hangup +exten => 1924,1,Dial,Zap/24|30|o +exten => 1924,2,Hangup + + +; # timeout invalid rules +exten => #,1,Playback(invalid) ; "Thanks for trying the demo" +exten => #,2,Hangup ; Hang them up. +exten => t,1,Goto(#,1) ; If they take too long, give up +exten => i,1,Playback(invalid) ; "That's not valid, try again" + +; Give voicemail at extension 8500 +exten => 8500,1,VoicemailMain +exten => 8500,2,Goto(s,6) + +; ASTERISK AGENTS LOGINS FOR QUEUES (NOT part of VICIDIAL) +; the following assumes phone agent login and exten are 3 digits and the same +; also assumes that 3-digit login is present in agents.conf and queueus.conf +;Agent Logout then stay onhook, DIAL 54 + 3-digit ID +exten => _54XXX,1,AgentCallbackLogin(||) +; the following are used to login and logout of Asterisk Queues from phone +;Agent Login then stay offhook on the phone, DIAL 55 + 3-digit ID +exten => _55XXX,1,AgentLogin(${EXTEN:1}) +;Agent Login then stay onhook, phones will ring, DIAL 56 + 3-digit ID +exten => _56XXX,1,AgentCallbackLogin(||${EXTEN:1}@default) + +; Extension 4001 rings Zap phone (this example for FXS on Zap port 1) +exten => 4001,1,Dial,Zap/1|30| ; ring Zap device 1 +exten => 4001,2,Voicemail,u4001 ; Send to voicemail... + + + + +; FastAGI for VICIDIAL/astGUIclient call logging +exten => h,1,DeadAGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME}) + +; Inbound call from BINFONE +; exten => 1112223333,1,AGI(agi://127.0.0.1:4577/call_log) +; exten => 1112223333,2,Dial(sip/gs102,55,o) +; exten => 1112223333,3,Hangup + +; Extension 7275551212 - Inbound local number from PRI with 10 digit delivery +exten => 7275551212,1,Ringing +exten => 7275551212,2,Wait(1) +exten => 7275551212,3,AGI(agi://127.0.0.1:4577/call_log--fullCID--${EXTEN}-----${CALLERID}-----${CALLERIDNUM}-----${CALLERIDNAME}) +exten => 7275551212,4,Answer +exten => 7275551212,5,Dial,sip/spa2000&sip/spa2001|30|to +exten => 7275551212,6,Voicemail,u2000 + +; dial a long distance outbound number to the UK +; This 'o' Dial flag is VERY important for VICIDIAL on outbound calls, +exten => _901144XXXXXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +exten => _901144XXXXXXXXXX,2,Dial(${TRUNKX}/${EXTEN:1},55,tTo) +exten => _901144XXXXXXXXXX,3,Hangup + +; dial a long distance outbound number to Australia +; This 'o' Dial flag is VERY important for VICIDIAL on outbound calls, +exten => _901161XXXXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +exten => _901161XXXXXXXXX,2,Dial(${TRUNKX}/${EXTEN:1},,tTo) +exten => _901161XXXXXXXXX,3,Hangup + +; dial an 800 outbound number +exten => _91800NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +exten => _91800NXXXXXX,2,Dial(${TRUNK}/${EXTEN:1},,tTo) +exten => _91800NXXXXXX,3,Hangup +exten => _91888NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +exten => _91888NXXXXXX,2,Dial(${TRUNK}/${EXTEN:1},,tTo) +exten => _91888NXXXXXX,3,Hangup +exten => _91877NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +exten => _91877NXXXXXX,2,Dial(${TRUNK}/${EXTEN:1},,tTo) +exten => _91877NXXXXXX,3,Hangup +exten => _91866NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +exten => _91866NXXXXXX,2,Dial(${TRUNK}/${EXTEN:1},,tTo) +exten => _91866NXXXXXX,3,Hangup + +; dial a local 727 outbound number with area code +exten => _9727NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +exten => _9727NXXXXXX,2,Dial(${TRUNK}/1${EXTEN:1},,tTo) +exten => _9727NXXXXXX,3,Hangup + +; dial a local 813 outbound number with area code +exten => _9813NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +exten => _9813NXXXXXX,2,Dial(${TRUNK}/${EXTEN:1},,tTo) +exten => _9813NXXXXXX,3,Hangup + +; dial a long distance outbound number +; This 'o' Dial flag is VERY important for VICIDIAL on outbound calls, +exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +exten => _91NXXNXXXXXX,2,Dial(${TRUNKX}/${EXTEN:1},,tTo) +exten => _91NXXNXXXXXX,3,Hangup +; dial a long distance outbound number through BINFONE +; exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +; exten => _91NXXNXXXXXX,2,Dial(${TRUNKIAX}/${EXTEN},55,o) +; exten => _91NXXNXXXXXX,3,Hangup +; dial a long distance outbound number through a SIP provider +; exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +; exten => _91NXXNXXXXXX,2,Dial(sip/${EXTEN}@SIPtrunk,55,o) +; exten => _91NXXNXXXXXX,3,Hangup + +; dial a local outbound number (modified because of only LD T1) +exten => _9NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +exten => _9NXXXXXX,2,Dial(${TRUNK}/1727${EXTEN:1},,tTo) +exten => _9NXXXXXX,3,Hangup + +; parameters for call_inbound.agi (7 fields separated by five dashes "-----"): +; 1. the extension of the phone to ring as defined in the asterisk.phones table +; 2. the phone number that was called, for the live_inbound/_log entry +; 3. a text description of the number that was called in +; 4-7. optional fields, they are also passed as fields in the GUI to web browser + +; Extension 3429 - Inbound 800 number (1-800-555-3429) example of RBS T1 +; with 10 digit ANI and 4 digit DNIS star separated +exten => _**3429,1,Ringing +exten => _**3429,2,AGI(agi://127.0.0.1:4577/call_log) +exten => _**3429,3,AGI(call_inbound.agi,spa2000-----8005553429-----Inbound 800-----x-----y-----z-----w) +exten => _**3429,4,Answer +exten => _**3429,5,Dial,sip/spa2000&sip/spa2001|30|to +exten => _**3429,6,Voicemail,u2000 +; Extension 3429 - with ANI [callerID] +exten => _*NXXNXXXXXX*3429,1,Ringing +exten => _*NXXNXXXXXX*3429,2,AGI(agi://127.0.0.1:4577/call_log) +exten => _*NXXNXXXXXX*3429,3,AGI(call_inbound.agi,spa2000-----8005553429-----Inbound 800-----x-----y-----z-----w) +exten => _*NXXNXXXXXX*3429,3,Answer +exten => _*NXXNXXXXXX*3429,4,Dial,sip/spa2000&sip/spa2001|30|to +exten => _*NXXNXXXXXX*3429,5,Voicemail,u2000 + +; BE SURE TO CHANGE THESE FOR YOUR IP ADDRESS! +exten => _010*010*010*015*8600XXX,1,Goto(default,${EXTEN:16},1) +exten => _010*010*010*015*8600XXX*.,1,Goto(default,${EXTEN:16},1) +exten => _010*010*010*015*78600XXX,1,Goto(default,${EXTEN:16},1) +exten => _010*010*010*015*78600XXX*.,1,Goto(default,${EXTEN:16},1) +exten => _8600XXX*.,1,AGI(agi-VDADfixCXFER.agi) +exten => _78600XXX*.,1,AGI(agi-VDADfixCXFER.agi) + +; ### server 2 extens: +; exten => _010*010*010*016*8600XXX,1,Dial(${TRUNKIAX1}/${EXTEN:16},55,o) +; exten => _010*010*010*016*8600XXX,2,Hangup +; exten => _010*010*010*016*8600XXX*.,1,Dial(${TRUNKIAX1}/${EXTEN:16},55,o) +; exten => _010*010*010*016*8600XXX*.,2,Hangup + + +; parameters for agi-VDAD_ALL_inbound.agi (9 fields separated by five dashes "-----"): +; 1. the method of call handling for the script: +; - CID - CID received, add record with phone number +; - CIDLOOKUP - Lookup CID to find record in whole system +; - CIDLOOKUPRL - Restrict lookup to one list +; - CLOSER - Closer calls from VICIDIAL fronters +; - ANI - ANI received, add record with phone number +; - ANILOOKUP - Lookup ANI to find record in whole system +; - ANILOOKUPRL - Restrict lookup to one list +; - 3DIGITID - Enter 3 digit code to go to agent +; - 4DIGITID - Enter 4 digit code to go to agent +; - 5DIGITID - Enter 5 digit code to go to agent +; - 10DIGITID - Enter 10 digit code to go to agent +; 2. the method of searching for an available agent: +; - LO - Load Balance Overflow only (priority to home server) +; - LB - Load Balance total system +; - SO - Home server only +; 3. the full name of the IN GROUP to be used in vicidial for the inbound call +; 4. the phone number that was called, for the log entry +; 5. the callerID or lead_id of the person that called(usually overridden) +; 6. the park extension audio file name if used +; 7. the status of the call initially(usually not used) +; 8. the list_id to insert the new lead under if it is new (and CID/ANI available) +; 9. the phone dialing code to insert with the new lead if new (and CID/ANI available) +; inbound VICIDIAL call with CID delivery through T1 PRI +exten => 1234,1,Answer ; Answer the line +exten => 1234,2,AGI(agi-VDAD_ALL_inbound.agi,CID-----LB-----CL_GALLERIA-----7274515134-----Closer-----park----------999-----1) +exten => 1234,3,Hangup + +; inbound VICIDIAL transfer calls [can arrive through PRI T1 crossover, IAX or SIP channel] +exten => _90009.,1,Answer ; Answer the line +exten => _90009.,2,AGI(agi-VDAD_ALL_inbound.agi,CLOSER-----LB-----CL_TESTCAMP-----7275551212-----Closer-----park----------999-----1) +exten => _90009.,3,Hangup +exten => _990009.,1,Answer ; Answer the line +exten => _990009.,2,AGI(agi-VDAD_ALL_inbound.agi,CLOSER-----LB-----CL_TESTCAMP-----7275551212-----Closer-----park----------999-----1) +exten => _990009.,3,Hangup + + + +; barge monitoring extension +exten => 8159,1,ZapBarge +exten => 8159,2,Hangup + +; ZapBarge direct channel extensions +exten => 8612001,1,ZapBarge(1) +exten => 8612002,1,ZapBarge(2) +exten => 8612003,1,ZapBarge(3) +exten => 8612004,1,ZapBarge(4) +exten => 8612005,1,ZapBarge(5) +exten => 8612006,1,ZapBarge(6) +exten => 8612007,1,ZapBarge(7) +exten => 8612008,1,ZapBarge(8) +exten => 8612009,1,ZapBarge(9) +exten => 8612010,1,ZapBarge(10) +exten => 8612011,1,ZapBarge(11) +exten => 8612012,1,ZapBarge(12) +exten => 8612013,1,ZapBarge(13) +exten => 8612014,1,ZapBarge(14) +exten => 8612015,1,ZapBarge(15) +exten => 8612016,1,ZapBarge(16) +exten => 8612017,1,ZapBarge(17) +exten => 8612018,1,ZapBarge(18) +exten => 8612019,1,ZapBarge(19) +exten => 8612020,1,ZapBarge(20) +exten => 8612021,1,ZapBarge(21) +exten => 8612022,1,ZapBarge(22) +exten => 8612023,1,ZapBarge(23) +exten => 8612024,1,ZapBarge(24) + +; astGUIclient conferences +exten => 8600001,1,Meetme,8600001|q +exten => 8600002,1,Meetme,8600002|q +exten => 8600003,1,Meetme,8600003|q +exten => 8600004,1,Meetme,8600004|q +exten => 8600005,1,Meetme,8600005|q +exten => 8600006,1,Meetme,8600006|q +exten => 8600007,1,Meetme,8600007|q +exten => 8600008,1,Meetme,8600008|q +exten => 8600009,1,Meetme,8600009|q +exten => 8600010,1,Meetme,8600010|q +exten => 8600011,1,Meetme,8600011|q +exten => 8600012,1,Meetme,8600012|q +exten => 8600013,1,Meetme,8600013|q +exten => 8600014,1,Meetme,8600014|q +exten => 8600015,1,Meetme,8600015|q +exten => 8600016,1,Meetme,8600016|q +exten => 8600017,1,Meetme,8600017|q +exten => 8600018,1,Meetme,8600018|q +exten => 8600019,1,Meetme,8600019|q +exten => 8600020,1,Meetme,8600020|q +exten => 8600021,1,Meetme,8600021|q +exten => 8600022,1,Meetme,8600022|q +exten => 8600023,1,Meetme,8600023|q +exten => 8600024,1,Meetme,8600024|q +exten => 8600025,1,Meetme,8600025|q +exten => 8600026,1,Meetme,8600026|q +exten => 8600027,1,Meetme,8600027|q +exten => 8600028,1,Meetme,8600028|q +exten => 8600029,1,Meetme,8600029|q + +exten => _X48600XXX,1,MeetMeAdmin(${EXTEN:2},T,${EXTEN:0:1}) +exten => _X48600XXX,2,Hangup + +exten => _X38600XXX,1,MeetMeAdmin(${EXTEN:2},t,${EXTEN:0:1}) +exten => _X38600XXX,2,Hangup + +exten => _X28600XXX,1,MeetMeAdmin(${EXTEN:2},m,${EXTEN:0:1}) +exten => _X28600XXX,2,Hangup + +exten => _X18600XXX,1,MeetMeAdmin(${EXTEN:2},M,${EXTEN:0:1}) +exten => _X18600XXX,2,Hangup + +exten => _55558600XXX,1,MeetMeAdmin(${EXTEN:4},K) +exten => _55558600XXX,2,Hangup +exten => 8300,1,Hangup + +; VICIDIAL conferences +exten => 8600051,1,Meetme,8600051 +exten => 8600052,1,Meetme,8600052 +exten => 8600053,1,Meetme,8600053 +exten => 8600054,1,Meetme,8600054 +exten => 8600055,1,Meetme,8600055 +exten => 8600056,1,Meetme,8600056 +exten => 8600057,1,Meetme,8600057 +exten => 8600058,1,Meetme,8600058 +exten => 8600059,1,Meetme,8600059 +exten => 8600060,1,Meetme,8600060 +exten => 8600061,1,Meetme,8600061 +exten => 8600062,1,Meetme,8600062 +exten => 8600063,1,Meetme,8600063 +exten => 8600064,1,Meetme,8600064 +exten => 8600065,1,Meetme,8600065 +exten => 8600066,1,Meetme,8600066 +exten => 8600067,1,Meetme,8600067 +exten => 8600068,1,Meetme,8600068 +exten => 8600069,1,Meetme,8600069 +exten => 8600070,1,Meetme,8600070 +exten => 8600071,1,Meetme,8600071 +exten => 8600072,1,Meetme,8600072 +exten => 8600073,1,Meetme,8600073 +exten => 8600074,1,Meetme,8600074 +exten => 8600075,1,Meetme,8600075 +exten => 8600076,1,Meetme,8600076 +exten => 8600077,1,Meetme,8600077 +exten => 8600078,1,Meetme,8600078 +exten => 8600079,1,Meetme,8600079 +exten => 8600080,1,Meetme,8600080 +exten => 8600081,1,Meetme,8600081 +exten => 8600082,1,Meetme,8600082 +exten => 8600083,1,Meetme,8600083 +exten => 8600084,1,Meetme,8600084 +exten => 8600085,1,Meetme,8600085 +exten => 8600086,1,Meetme,8600086 +exten => 8600087,1,Meetme,8600087 +exten => 8600088,1,Meetme,8600088 +exten => 8600089,1,Meetme,8600089 +exten => 8600090,1,Meetme,8600090 +exten => 8600091,1,Meetme,8600091 +exten => 8600092,1,Meetme,8600092 +exten => 8600093,1,Meetme,8600093 +exten => 8600094,1,Meetme,8600094 +exten => 8600095,1,Meetme,8600095 +exten => 8600096,1,Meetme,8600096 +exten => 8600097,1,Meetme,8600097 +exten => 8600098,1,Meetme,8600098 +exten => 8600099,1,Meetme,8600099 +exten => 8600100,1,Meetme,8600100 +exten => 8600101,1,Meetme,8600101 +exten => 8600102,1,Meetme,8600102 +exten => 8600103,1,Meetme,8600103 +exten => 8600104,1,Meetme,8600104 +exten => 8600105,1,Meetme,8600105 +exten => 8600106,1,Meetme,8600106 +exten => 8600107,1,Meetme,8600107 +exten => 8600108,1,Meetme,8600108 +exten => 8600109,1,Meetme,8600109 +exten => 8600110,1,Meetme,8600110 +exten => 8600111,1,Meetme,8600111 +exten => 8600112,1,Meetme,8600112 +exten => 8600113,1,Meetme,8600113 +exten => 8600114,1,Meetme,8600114 +exten => 8600115,1,Meetme,8600115 +exten => 8600116,1,Meetme,8600116 +exten => 8600117,1,Meetme,8600117 +exten => 8600118,1,Meetme,8600118 +exten => 8600119,1,Meetme,8600119 +exten => 8600120,1,Meetme,8600120 +exten => 8600121,1,Meetme,8600121 +exten => 8600122,1,Meetme,8600122 +exten => 8600123,1,Meetme,8600123 +exten => 8600124,1,Meetme,8600124 +exten => 8600125,1,Meetme,8600125 +exten => 8600126,1,Meetme,8600126 +exten => 8600127,1,Meetme,8600127 +exten => 8600128,1,Meetme,8600128 +exten => 8600129,1,Meetme,8600129 +exten => 8600130,1,Meetme,8600130 +exten => 8600131,1,Meetme,8600131 +exten => 8600132,1,Meetme,8600132 +exten => 8600133,1,Meetme,8600133 +exten => 8600134,1,Meetme,8600134 +exten => 8600135,1,Meetme,8600135 +exten => 8600136,1,Meetme,8600136 +exten => 8600137,1,Meetme,8600137 +exten => 8600138,1,Meetme,8600138 +exten => 8600139,1,Meetme,8600139 +exten => 8600140,1,Meetme,8600140 +exten => 8600141,1,Meetme,8600141 +exten => 8600142,1,Meetme,8600142 +exten => 8600143,1,Meetme,8600143 +exten => 8600144,1,Meetme,8600144 +exten => 8600145,1,Meetme,8600145 +exten => 8600146,1,Meetme,8600146 +exten => 8600147,1,Meetme,8600147 +exten => 8600148,1,Meetme,8600148 +exten => 8600149,1,Meetme,8600149 +exten => 8600150,1,Meetme,8600150 +exten => 8600151,1,Meetme,8600151 +exten => 8600152,1,Meetme,8600152 +exten => 8600153,1,Meetme,8600153 +exten => 8600154,1,Meetme,8600154 +exten => 8600155,1,Meetme,8600155 +exten => 8600156,1,Meetme,8600156 +exten => 8600157,1,Meetme,8600157 +exten => 8600158,1,Meetme,8600158 +exten => 8600159,1,Meetme,8600159 +exten => 8600160,1,Meetme,8600160 +exten => 8600161,1,Meetme,8600161 +exten => 8600162,1,Meetme,8600162 +exten => 8600163,1,Meetme,8600163 +exten => 8600164,1,Meetme,8600164 +exten => 8600165,1,Meetme,8600165 +exten => 8600166,1,Meetme,8600166 +exten => 8600167,1,Meetme,8600167 +exten => 8600168,1,Meetme,8600168 +exten => 8600169,1,Meetme,8600169 +exten => 8600170,1,Meetme,8600170 +exten => 8600171,1,Meetme,8600171 +exten => 8600172,1,Meetme,8600172 +exten => 8600173,1,Meetme,8600173 +exten => 8600174,1,Meetme,8600174 +exten => 8600175,1,Meetme,8600175 +exten => 8600176,1,Meetme,8600176 +exten => 8600177,1,Meetme,8600177 +exten => 8600178,1,Meetme,8600178 +exten => 8600179,1,Meetme,8600179 +exten => 8600180,1,Meetme,8600180 +exten => 8600181,1,Meetme,8600181 +exten => 8600182,1,Meetme,8600182 +exten => 8600183,1,Meetme,8600183 +exten => 8600184,1,Meetme,8600184 +exten => 8600185,1,Meetme,8600185 +exten => 8600186,1,Meetme,8600186 +exten => 8600187,1,Meetme,8600187 +exten => 8600188,1,Meetme,8600188 +exten => 8600189,1,Meetme,8600189 +exten => 8600190,1,Meetme,8600190 +exten => 8600191,1,Meetme,8600191 +exten => 8600192,1,Meetme,8600192 +exten => 8600193,1,Meetme,8600193 +exten => 8600194,1,Meetme,8600194 +exten => 8600195,1,Meetme,8600195 +exten => 8600196,1,Meetme,8600196 +exten => 8600197,1,Meetme,8600197 +exten => 8600198,1,Meetme,8600198 +exten => 8600199,1,Meetme,8600199 +exten => 8600200,1,Meetme,8600200 +; quiet entry and leaving conferences for VICIDIAL +exten => _78600XXX,1,Meetme,${EXTEN:1}|q +; quiet monitor extensions for meetme rooms (for room managers) +exten => _68600XXX,1,Meetme,${EXTEN:1}|mq + +; voicelab exten +exten => _86009XX,1,Meetme,${EXTEN}|mq +; voicelab exten moderator +exten => _986009XX,1,Meetme,${EXTEN:1} + + + +; park channel for client GUI parking, hangup after 30 minutes +; create a GSM formatted audio file named "park.gsm" that is 30 minutes long +; and put it in /var/lib/asterisk/sounds +exten => 8301,1,Answer +exten => 8301,2,AGI(park_CID.agi) +exten => 8301,3,Playback(park) +exten => 8301,4,Hangup +exten => 8303,1,Answer +exten => 8303,2,AGI(park_CID.agi) +exten => 8303,3,Playback(conf) +exten => 8303,4,Hangup + +; park channel for client GUI conferencing, hangup after 30 minutes +; create a GSM formatted audio file named "conf.gsm" that is 30 minutes long +; and put it in /var/lib/asterisk/sounds +exten => 8302,1,Answer +exten => 8302,2,Playback(conf) +exten => 8302,3,Hangup + +exten => 8304,1,Answer +exten => 8304,2,Playback(ding) +exten => 8304,3,Hangup + +; default audio for safe harbor 2-second-after-hello message then hangup +; create a GSM formatted audio file complies with safe harbor rules +; and put it in /var/lib/asterisk/sounds then change filename below +exten => 8307,1,Answer +exten => 8307,2,Playback(vm-goodbye) +exten => 8307,3,Hangup + +; this is used for recording conference calls, the client app sends the filename +; value as a callerID recordings go to /var/spool/asterisk/monitor (WAV) +exten => 8309,1,Answer +exten => 8309,2,Monitor(wav,${CALLERIDNAME}) +exten => 8309,3,Wait,3600 +exten => 8309,4,Hangup + +; this is used for recording conference calls, the client app sends the filename +; value as a callerID recordings go to /var/spool/asterisk/monitor (GSM) +exten => 8310,1,Answer +exten => 8310,2,Monitor(gsm,${CALLERIDNAME}) +exten => 8310,3,Wait,3600 +exten => 8310,4,Hangup + +; this is used for playing a message to an answering machine forwarded from AMD in VICIDIAL +; replace conf with the message file you want to leave +exten => 8320,1,WaitForSilence(2000,2) ; AMD got machine. leave message after recording +exten => 8320,2,Playback(conf) +exten => 8320,3,AGI(VD_amd_post.agi,${EXTEN}) +exten => 8320,4,Hangup + +; use for selective CallerID hangup by area code(hard-coded) +exten => 8352,1,AGI(agi-VDADselective_CID_hangup.agi,${EXTEN}) +exten => 8352,2,Playback(safe_harbor) +exten => 8352,3,Hangup + +; prompt recording AGI script, ID is 4321 +exten => 8168,1,Answer +exten => 8168,2,AGI(agi-record_prompts.agi) +exten => 8168,3,Hangup + +; playback of recorded prompts +exten => _851XXXXX,1,Answer +exten => _851XXXXX,2,Playback(${EXTEN}) +exten => _851XXXXX,3,Hangup + +; this is used to allow the GUI to send you directly into voicemail +; don't forget to set GUI variable $voicemail_exten to this extension +exten => 8501,1,VoicemailMain(s${CALLERIDNUM}) +exten => 8501,2,Hangup + +; this is used to allow the GUI to send live calls directly into voicemail +; don't forget to set GUI variable $voicemail_dump_exten to this extension +exten => _85026666666666.,1,Wait(2) +exten => _85026666666666.,2,Voicemail(${EXTEN:14}) +exten => _85026666666666.,3,Hangup + +; this is used for sending DTMF signals within conference calls, the client app +; sends the digits to be played in the callerID field +; sound files must be placed in /var/lib/asterisk/sounds +exten => 8500998,1,Answer +exten => 8500998,2,Playback(silence) +exten => 8500998,3,AGI(agi-dtmf.agi) +exten => 8500998,4,Hangup + +;#### VDAD STANDARD TRANSFER ENTRIES #### +; VICIDIAL_auto_dialer transfer script for no-agent campaigns: +exten => 8364,1,AGI(agi://127.0.0.1:4577/call_log) +exten => 8364,2,AGI(agi-VDADtransferBROADCAST.agi,${EXTEN}) +exten => 8364,3,AGI(agi-VDADtransferBROADCAST.agi,${EXTEN}) +exten => 8364,4,AGI(agi-VDADtransferBROADCAST.agi,${EXTEN}) +exten => 8364,5,Hangup + +; VICIDIAL_auto_dialer transfer script: +exten => 8365,1,AGI(agi://127.0.0.1:4577/call_log) +exten => 8365,2,AGI(agi-VDADtransfer.agi,${EXTEN}) +exten => 8365,3,AGI(agi-VDADtransfer.agi,${EXTEN}) +exten => 8365,4,AGI(agi-VDADtransfer.agi,${EXTEN}) +exten => 8365,5,Hangup + +; VICIDIAL_auto_dialer transfer script SURVEY at beginning: +exten => 8366,1,AGI(agi://127.0.0.1:4577/call_log) +exten => 8366,2,AGI(agi-VDADtransferSURVEY.agi,${EXTEN}) +exten => 8366,3,AGI(agi-VDADtransferSURVEY.agi,${EXTEN}) +exten => 8366,4,AGI(agi-VDADtransferSURVEY.agi,${EXTEN}) +exten => 8366,5,Hangup + +; VICIDIAL_auto_dialer transfer script Load Balance Overflow: +exten => 8367,1,AGI(agi://127.0.0.1:4577/call_log) +exten => 8367,2,AGI(agi-VDAD_LO_transfer.agi,${EXTEN}) +exten => 8367,3,AGI(agi-VDAD_LO_transfer.agi,${EXTEN}) +exten => 8367,4,AGI(agi-VDAD_LO_transfer.agi,${EXTEN}) +exten => 8367,5,Hangup + +; VICIDIAL_auto_dialer transfer script Load Balanced: +exten => 8368,1,AGI(agi://127.0.0.1:4577/call_log) +exten => 8368,2,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +exten => 8368,3,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +exten => 8368,4,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +exten => 8368,5,Hangup + +; VICIDIAL_auto_dialer transfer script AMD with Load Balanced: +exten => 8369,1,AGI(agi://127.0.0.1:4577/call_log) +exten => 8369,2,AMD(2000|2000|1000|5000|120|50|4|256) +exten => 8369,3,AGI(VD_amd.agi,${EXTEN}) +exten => 8369,4,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +exten => 8369,5,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +exten => 8369,6,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +exten => 8369,7,Hangup + +; VICIDIAL auto-dial reminder script +exten => 8372,1,AGI(agi://127.0.0.1:4577/call_log) +exten => 8372,2,AGI(agi-VDADautoREMINDER.agi,${EXTEN}) +exten => 8372,3,AGI(agi-VDADautoREMINDER.agi,${EXTEN}) +exten => 8372,4,AGI(agi-VDADautoREMINDER.agi,${EXTEN}) +exten => 8372,5,Hangup + +;#### VDAD SIP UNREGISTERED TRANSFER ENTRIES #### +;#### Use these entries IN PLACE OF the entries above if you are using SIP trunks +;#### and are not registering your provider in sip.conf +;; VICIDIAL_auto_dialer transfer script for no-agent campaigns: +;exten => 8364,1,Playback(sip-silence) +;exten => 8364,2,AGI(agi://127.0.0.1:4577/call_log) +;exten => 8364,3,AGI(agi-VDADtransferBROADCAST.agi,${EXTEN}) +;exten => 8364,4,AGI(agi-VDADtransferBROADCAST.agi,${EXTEN}) +;exten => 8364,5,Hangup +; +;; VICIDIAL_auto_dialer transfer script: +;exten => 8365,1,Playback(sip-silence) +;exten => 8365,2,AGI(agi://127.0.0.1:4577/call_log) +;exten => 8365,3,AGI(agi-VDADtransfer.agi,${EXTEN}) +;exten => 8365,4,AGI(agi-VDADtransfer.agi,${EXTEN}) +;exten => 8365,5,Hangup +; +;; VICIDIAL_auto_dialer transfer script SURVEY at beginning: +;exten => 8366,1,Playback(sip-silence) +;exten => 8366,2,AGI(agi://127.0.0.1:4577/call_log) +;exten => 8366,3,AGI(agi-VDADtransferSURVEY.agi,${EXTEN}) +;exten => 8366,4,AGI(agi-VDADtransferSURVEY.agi,${EXTEN}) +;exten => 8366,5,Hangup +; +;; VICIDIAL_auto_dialer transfer script Load Balance Overflow: +;exten => 8367,1,Playback(sip-silence) +;exten => 8367,2,AGI(agi://127.0.0.1:4577/call_log) +;exten => 8367,3,AGI(agi-VDAD_LO_transfer.agi,${EXTEN}) +;exten => 8367,4,AGI(agi-VDAD_LO_transfer.agi,${EXTEN}) +;exten => 8367,5,Hangup +; +;; VICIDIAL_auto_dialer transfer script Load Balanced: +;exten => 8368,1,Playback(sip-silence) +;exten => 8368,2,AGI(agi://127.0.0.1:4577/call_log) +;exten => 8368,3,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +;exten => 8368,4,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +;exten => 8368,5,Hangup +; +;; VICIDIAL_auto_dialer transfer script AMD with Load Balanced: +;exten => 8369,1,Playback(sip-silence) +;exten => 8369,2,AGI(agi://127.0.0.1:4577/call_log) +;exten => 8369,3,AMD(2000|2000|1000|5000|120|50|4|256) +;exten => 8369,4,AGI(VD_amd.agi,${EXTEN}) +;exten => 8369,5,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +;exten => 8369,6,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +;exten => 8369,7,Hangup +; +;; VICIDIAL auto-dial reminder script +;exten => 8372,1,Playback(sip-silence) +;exten => 8372,2,AGI(agi://127.0.0.1:4577/call_log) +;exten => 8372,3,AGI(agi-VDADautoREMINDER.agi,${EXTEN}) +;exten => 8372,4,AGI(agi-VDADautoREMINDER.agi,${EXTEN}) +;exten => 8372,5,Hangup diff --git a/agc_2-X/branches/agc_2.0.4/docs/conf_examples/extensions.conf.sample-1.4 b/agc_2-X/branches/agc_2.0.4/docs/conf_examples/extensions.conf.sample-1.4 new file mode 100644 index 00000000..7cc5b008 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/conf_examples/extensions.conf.sample-1.4 @@ -0,0 +1,789 @@ +[general] +static=yes +writeprotect=no + +[globals] +CONSOLE=Console/dsp ; Console interface for demo +TRUNK=Zap/g1 ; Trunk interface +TRUNKX=Zap/g2 ; 2nd trunk interface +TRUNKIAX=IAX2/ASTtest1:test@10.10.10.16:4569 ; IAX trunk interface +TRUNKIAX1=IAX2/ASTtest1:test@10.10.10.16:4569 ; IAX trunk interface +TRUNKBINFONE=IAX2/1112223333:PASSWORD@iax.binfone.com ; IAX trunk interface +SIPtrunk=SIP/1234:PASSWORD@sip.provider.net ; SIP trunk + +[default] +; Example phone extensions + +; Extension 2000 Sipura line 1 +exten => 2000,1,Dial,sip/spa2000|30|to ; Ring, 30 secs max +exten => 2000,2,Voicemail,u2000 ; Send to voicemail... +; Extension 2001 Sipura line 2 +exten => 2001,1,Dial,sip/spa2001|30|to ; Ring, 30 secs max +exten => 2001,2,Voicemail,u2001 ; Send to voicemail... +; Extension 2020 rings both sipura lines +exten => 2020,1,Dial,sip/spa2000&sip/spa2001|30|to ; Ring, 30 secs max +exten => 2020,2,Voicemail,u2000 ; Send to voicemail... +; Extension 301 rings the firefly softphone +exten => 401,1,Dial,(IAX2/firefly01@firefly01/s) +exten => 401,2,Hangup +; extensions for other SIP and IAX call center phones +exten => 100,2,Dial,sip/cc100|20|to +exten => 101,2,Dial,sip/cc101|20|to +exten => 102,2,Dial,sip/cc102|20|to +exten => 103,2,Dial,sip/cc103|20|to +exten => 104,2,Dial,sip/cc104|20|to +exten => 105,2,Dial,sip/cc105|20|to +exten => 106,2,Dial,sip/cc106|20|to +exten => 107,2,Dial,sip/cc107|20|to +exten => 108,2,Dial,sip/cc108|20|to +exten => 109,2,Dial,sip/cc109|20|to +exten => 110,2,Dial,sip/cc110|20|to +exten => 111,2,Dial,sip/cc111|20|to +exten => 112,2,Dial,sip/cc112|20|to +exten => 113,2,Dial,sip/cc113|20|to +exten => 114,2,Dial,sip/cc114|20|to +exten => 115,2,Dial,sip/cc115|20|to +exten => 116,2,Dial,sip/cc116|20|to +exten => 117,2,Dial,sip/cc117|20|to +exten => 118,2,Dial,sip/cc118|20|to +exten => 119,2,Dial,sip/cc119|20|to +exten => 120,2,Dial,sip/cc120|20|to +exten => 121,2,Dial,sip/cc121|20|to +exten => 122,2,Dial,sip/cc122|20|to +exten => 123,2,Dial,sip/cc123|20|to +exten => 124,2,Dial,sip/cc124|20|to +exten => 125,2,Dial,sip/cc125|20|to +exten => 126,2,Dial,sip/cc126|20|to +exten => 127,2,Dial,sip/cc127|20|to +exten => 128,2,Dial,sip/cc128|20|to +exten => 129,2,Dial,sip/cc129|20|to +exten => 130,2,Dial,sip/cc130|20|to +exten => 131,2,Dial,sip/cc131|20|to +exten => 132,2,Dial,sip/cc132|20|to +exten => 133,2,Dial,sip/cc133|20|to +exten => 134,2,Dial,sip/cc134|20|to +exten => 135,2,Dial,sip/cc135|20|to +exten => 136,2,Dial,sip/cc136|20|to +exten => 137,2,Dial,sip/cc137|20|to +exten => 138,2,Dial,sip/cc138|20|to +exten => 139,2,Dial,sip/cc139|20|to +exten => 140,2,Dial,sip/cc140|20|to +exten => 141,2,Dial,sip/cc141|20|to +exten => 142,2,Dial,sip/cc142|20|to +exten => 143,2,Dial,sip/cc143|20|to +exten => 144,2,Dial,sip/cc144|20|to +exten => 145,2,Dial,sip/cc145|20|to +exten => 146,2,Dial,sip/cc146|20|to +exten => 147,2,Dial,sip/cc147|20|to +exten => 148,2,Dial,sip/cc148|20|to +exten => 149,2,Dial,sip/cc149|20|to +exten => 150,2,Dial,sip/cc150|20|to + +exten => 300,2,Dial,IAX2/cc300|20|to +exten => 301,2,Dial,IAX2/cc301|20|to +exten => 302,2,Dial,IAX2/cc302|20|to +exten => 303,2,Dial,IAX2/cc303|20|to +exten => 304,2,Dial,IAX2/cc304|20|to +exten => 305,2,Dial,IAX2/cc305|20|to +exten => 306,2,Dial,IAX2/cc306|20|to +exten => 307,2,Dial,IAX2/cc307|20|to +exten => 308,2,Dial,IAX2/cc308|20|to +exten => 309,2,Dial,IAX2/cc309|20|to +exten => 310,2,Dial,IAX2/cc310|20|to +exten => 311,2,Dial,IAX2/cc311|20|to +exten => 312,2,Dial,IAX2/cc312|20|to +exten => 313,2,Dial,IAX2/cc313|20|to +exten => 314,2,Dial,IAX2/cc314|20|to +exten => 315,2,Dial,IAX2/cc315|20|to +exten => 316,2,Dial,IAX2/cc316|20|to +exten => 317,2,Dial,IAX2/cc317|20|to +exten => 318,2,Dial,IAX2/cc318|20|to +exten => 319,2,Dial,IAX2/cc319|20|to +exten => 320,2,Dial,IAX2/cc320|20|to +exten => 321,2,Dial,IAX2/cc321|20|to +exten => 322,2,Dial,IAX2/cc322|20|to +exten => 323,2,Dial,IAX2/cc323|20|to +exten => 324,2,Dial,IAX2/cc324|20|to +exten => 325,2,Dial,IAX2/cc325|20|to +exten => 326,2,Dial,IAX2/cc326|20|to +exten => 327,2,Dial,IAX2/cc327|20|to +exten => 328,2,Dial,IAX2/cc328|20|to +exten => 329,2,Dial,IAX2/cc329|20|to +exten => 330,2,Dial,IAX2/cc330|20|to +exten => 331,2,Dial,IAX2/cc331|20|to +exten => 332,2,Dial,IAX2/cc332|20|to +exten => 333,2,Dial,IAX2/cc333|20|to +exten => 334,2,Dial,IAX2/cc334|20|to +exten => 335,2,Dial,IAX2/cc335|20|to +exten => 336,2,Dial,IAX2/cc336|20|to +exten => 337,2,Dial,IAX2/cc337|20|to +exten => 338,2,Dial,IAX2/cc338|20|to +exten => 339,2,Dial,IAX2/cc339|20|to +exten => 340,2,Dial,IAX2/cc340|20|to +exten => 341,2,Dial,IAX2/cc341|20|to +exten => 342,2,Dial,IAX2/cc342|20|to +exten => 343,2,Dial,IAX2/cc343|20|to +exten => 344,2,Dial,IAX2/cc344|20|to +exten => 345,2,Dial,IAX2/cc345|20|to +exten => 346,2,Dial,IAX2/cc346|20|to +exten => 347,2,Dial,IAX2/cc347|20|to +exten => 348,2,Dial,IAX2/cc348|20|to +exten => 349,2,Dial,IAX2/cc349|20|to +exten => 350,2,Dial,IAX2/cc350|20|to + +; extensions if using a T1 channelbank +exten => 1901,1,Dial,Zap/1|30|o +exten => 1901,2,Hangup +exten => 1902,1,Dial,Zap/2|30|o +exten => 1902,2,Hangup +exten => 1903,1,Dial,Zap/3|30|o +exten => 1903,2,Hangup +exten => 1904,1,Dial,Zap/4|30|o +exten => 1904,2,Hangup +exten => 1905,1,Dial,Zap/5|30|o +exten => 1905,2,Hangup +exten => 1906,1,Dial,Zap/6|30|o +exten => 1906,2,Hangup +exten => 1907,1,Dial,Zap/7|30|o +exten => 1907,2,Hangup +exten => 1908,1,Dial,Zap/8|30|o +exten => 1908,2,Hangup +exten => 1909,1,Dial,Zap/9|30|o +exten => 1909,2,Hangup +exten => 1910,1,Dial,Zap/10|30|o +exten => 1910,2,Hangup +exten => 1911,1,Dial,Zap/11|30|o +exten => 1911,2,Hangup +exten => 1912,1,Dial,Zap/12|30|o +exten => 1912,2,Hangup +exten => 1913,1,Dial,Zap/13|30|o +exten => 1913,2,Hangup +exten => 1914,1,Dial,Zap/14|30|o +exten => 1914,2,Hangup +exten => 1915,1,Dial,Zap/15|30|o +exten => 1915,2,Hangup +exten => 1916,1,Dial,Zap/16|30|o +exten => 1916,2,Hangup +exten => 1917,1,Dial,Zap/17|30|o +exten => 1917,2,Hangup +exten => 1918,1,Dial,Zap/18|30|o +exten => 1918,2,Hangup +exten => 1919,1,Dial,Zap/19|30|o +exten => 1919,2,Hangup +exten => 1920,1,Dial,Zap/20|30|o +exten => 1920,2,Hangup +exten => 1921,1,Dial,Zap/21|30|o +exten => 1921,2,Hangup +exten => 1922,1,Dial,Zap/22|30|o +exten => 1922,2,Hangup +exten => 1923,1,Dial,Zap/23|30|o +exten => 1923,2,Hangup +exten => 1924,1,Dial,Zap/24|30|o +exten => 1924,2,Hangup + + +; # timeout invalid rules +exten => #,1,Playback(invalid) ; "Thanks for trying the demo" +exten => #,2,Hangup ; Hang them up. +exten => t,1,Goto(#,1) ; If they take too long, give up +exten => i,1,Playback(invalid) ; "That's not valid, try again" + +; Give voicemail at extension 8500 +exten => 8500,1,VoicemailMain +exten => 8500,2,Goto(s,6) + +; ASTERISK AGENTS LOGINS FOR QUEUES (NOT part of VICIDIAL) +; the following assumes phone agent login and exten are 3 digits and the same +; also assumes that 3-digit login is present in agents.conf and queueus.conf +;Agent Logout then stay onhook, DIAL 54 + 3-digit ID +exten => _54XXX,1,AgentCallbackLogin(||) +; the following are used to login and logout of Asterisk Queues from phone +;Agent Login then stay offhook on the phone, DIAL 55 + 3-digit ID +exten => _55XXX,1,AgentLogin(${EXTEN:1}) +;Agent Login then stay onhook, phones will ring, DIAL 56 + 3-digit ID +exten => _56XXX,1,AgentCallbackLogin(||${EXTEN:1}@default) + +; Extension 4001 rings Zap phone (this example for FXS on Zap port 1) +exten => 4001,1,Dial,Zap/1|30| ; ring Zap device 1 +exten => 4001,2,Voicemail,u4001 ; Send to voicemail... + + + + +; FastAGI for VICIDIAL/astGUIclient call logging +exten => h,1,DeadAGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME}) + +; Inbound call from BINFONE +; exten => 1112223333,1,AGI(agi://127.0.0.1:4577/call_log) +; exten => 1112223333,2,Dial(sip/gs102,55,o) +; exten => 1112223333,3,Hangup + +; Extension 7275551212 - Inbound local number from PRI with 10 digit delivery +exten => 7275551212,1,Ringing +exten => 7275551212,2,Wait(1) +exten => 7275551212,3,AGI(agi://127.0.0.1:4577/call_log--fullCID--${EXTEN}-----{CALLERID(all)}-----${CALLERID(num)}-----${CALLERID(name)}) +exten => 7275551212,4,Answer +exten => 7275551212,5,Dial,sip/spa2000&sip/spa2001|30|to +exten => 7275551212,6,Voicemail,u2000 + +; dial a long distance outbound number to the UK +; This 'o' Dial flag is VERY important for VICIDIAL on outbound calls, +exten => _901144XXXXXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +exten => _901144XXXXXXXXXX,2,Dial(${TRUNKX}/${EXTEN:1},55,tTo) +exten => _901144XXXXXXXXXX,3,Hangup + +; dial a long distance outbound number to Australia +; This 'o' Dial flag is VERY important for VICIDIAL on outbound calls, +exten => _901161XXXXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +exten => _901161XXXXXXXXX,2,Dial(${TRUNKX}/${EXTEN:1},,tTo) +exten => _901161XXXXXXXXX,3,Hangup + +; dial an 800 outbound number +exten => _91800NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +exten => _91800NXXXXXX,2,Dial(${TRUNK}/${EXTEN:1},,tTo) +exten => _91800NXXXXXX,3,Hangup +exten => _91888NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +exten => _91888NXXXXXX,2,Dial(${TRUNK}/${EXTEN:1},,tTo) +exten => _91888NXXXXXX,3,Hangup +exten => _91877NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +exten => _91877NXXXXXX,2,Dial(${TRUNK}/${EXTEN:1},,tTo) +exten => _91877NXXXXXX,3,Hangup +exten => _91866NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +exten => _91866NXXXXXX,2,Dial(${TRUNK}/${EXTEN:1},,tTo) +exten => _91866NXXXXXX,3,Hangup + +; dial a local 727 outbound number with area code +exten => _9727NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +exten => _9727NXXXXXX,2,Dial(${TRUNK}/1${EXTEN:1},,tTo) +exten => _9727NXXXXXX,3,Hangup + +; dial a local 813 outbound number with area code +exten => _9813NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +exten => _9813NXXXXXX,2,Dial(${TRUNK}/${EXTEN:1},,tTo) +exten => _9813NXXXXXX,3,Hangup + +; dial a long distance outbound number +; This 'o' Dial flag is VERY important for VICIDIAL on outbound calls, +exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +exten => _91NXXNXXXXXX,2,Dial(${TRUNKX}/${EXTEN:1},,tTo) +exten => _91NXXNXXXXXX,3,Hangup +; dial a long distance outbound number through BINFONE +; exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +; exten => _91NXXNXXXXXX,2,Dial(${TRUNKIAX}/${EXTEN},55,o) +; exten => _91NXXNXXXXXX,3,Hangup +; dial a long distance outbound number through a SIP provider +; exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +; exten => _91NXXNXXXXXX,2,Dial(sip/${EXTEN}@SIPtrunk,55,o) +; exten => _91NXXNXXXXXX,3,Hangup + +; dial a local outbound number (modified because of only LD T1) +exten => _9NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +exten => _9NXXXXXX,2,Dial(${TRUNK}/1727${EXTEN:1},,tTo) +exten => _9NXXXXXX,3,Hangup + +; parameters for call_inbound.agi (7 fields separated by five dashes "-----"): +; 1. the extension of the phone to ring as defined in the asterisk.phones table +; 2. the phone number that was called, for the live_inbound/_log entry +; 3. a text description of the number that was called in +; 4-7. optional fields, they are also passed as fields in the GUI to web browser + +; Extension 3429 - Inbound 800 number (1-800-555-3429) example of RBS T1 +; with 10 digit ANI and 4 digit DNIS star separated +exten => _**3429,1,Ringing +exten => _**3429,2,AGI(agi://127.0.0.1:4577/call_log) +exten => _**3429,3,AGI(call_inbound.agi,spa2000-----8005553429-----Inbound 800-----x-----y-----z-----w) +exten => _**3429,4,Answer +exten => _**3429,5,Dial,sip/spa2000&sip/spa2001|30|to +exten => _**3429,6,Voicemail,u2000 +; Extension 3429 - with ANI [callerID] +exten => _*NXXNXXXXXX*3429,1,Ringing +exten => _*NXXNXXXXXX*3429,2,AGI(agi://127.0.0.1:4577/call_log) +exten => _*NXXNXXXXXX*3429,3,AGI(call_inbound.agi,spa2000-----8005553429-----Inbound 800-----x-----y-----z-----w) +exten => _*NXXNXXXXXX*3429,3,Answer +exten => _*NXXNXXXXXX*3429,4,Dial,sip/spa2000&sip/spa2001|30|to +exten => _*NXXNXXXXXX*3429,5,Voicemail,u2000 + +; BE SURE TO CHANGE THESE FOR YOUR IP ADDRESS! +exten => _010*010*010*015*8600XXX,1,Goto(default,${EXTEN:16},1) +exten => _010*010*010*015*8600XXX*.,1,Goto(default,${EXTEN:16},1) +exten => _010*010*010*015*78600XXX,1,Goto(default,${EXTEN:16},1) +exten => _010*010*010*015*78600XXX*.,1,Goto(default,${EXTEN:16},1) +exten => _8600XXX*.,1,AGI(agi-VDADfixCXFER.agi) +exten => _78600XXX*.,1,AGI(agi-VDADfixCXFER.agi) + +; ### server 2 extens: +; exten => _010*010*010*016*8600XXX,1,Dial(${TRUNKIAX1}/${EXTEN:16},55,o) +; exten => _010*010*010*016*8600XXX,2,Hangup +; exten => _010*010*010*016*8600XXX*.,1,Dial(${TRUNKIAX1}/${EXTEN:16},55,o) +; exten => _010*010*010*016*8600XXX*.,2,Hangup + + +; parameters for agi-VDAD_ALL_inbound.agi (9 fields separated by five dashes "-----"): +; 1. the method of call handling for the script: +; - CID - CID received, add record with phone number +; - CIDLOOKUP - Lookup CID to find record in whole system +; - CIDLOOKUPRL - Restrict lookup to one list +; - CLOSER - Closer calls from VICIDIAL fronters +; - ANI - ANI received, add record with phone number +; - ANILOOKUP - Lookup ANI to find record in whole system +; - ANILOOKUPRL - Restrict lookup to one list +; - 3DIGITID - Enter 3 digit code to go to agent +; - 4DIGITID - Enter 4 digit code to go to agent +; - 5DIGITID - Enter 5 digit code to go to agent +; - 10DIGITID - Enter 10 digit code to go to agent +; 2. the method of searching for an available agent: +; - LO - Load Balance Overflow only (priority to home server) +; - LB - Load Balance total system +; - SO - Home server only +; 3. the full name of the IN GROUP to be used in vicidial for the inbound call +; 4. the phone number that was called, for the log entry +; 5. the callerID or lead_id of the person that called(usually overridden) +; 6. the park extension audio file name if used +; 7. the status of the call initially(usually not used) +; 8. the list_id to insert the new lead under if it is new (and CID/ANI available) +; 9. the phone dialing code to insert with the new lead if new (and CID/ANI available) +; inbound VICIDIAL call with CID delivery through T1 PRI +exten => 1234,1,Answer ; Answer the line +exten => 1234,2,AGI(agi-VDAD_ALL_inbound.agi,CID-----LB-----CL_GALLERIA-----7274515134-----Closer-----park----------999-----1) +exten => 1234,3,Hangup + +; inbound VICIDIAL transfer calls [can arrive through PRI T1 crossover, IAX or SIP channel] +exten => _90009.,1,Answer ; Answer the line +exten => _90009.,2,AGI(agi-VDAD_ALL_inbound.agi,CLOSER-----LB-----CL_TESTCAMP-----7275551212-----Closer-----park----------999-----1) +exten => _90009.,3,Hangup +exten => _990009.,1,Answer ; Answer the line +exten => _990009.,2,AGI(agi-VDAD_ALL_inbound.agi,CLOSER-----LB-----CL_TESTCAMP-----7275551212-----Closer-----park----------999-----1) +exten => _990009.,3,Hangup + + +; barge monitoring extension +exten => 8159,1,ZapBarge +exten => 8159,2,Hangup + +; ZapBarge direct channel extensions +exten => 8612001,1,ZapBarge(1) +exten => 8612002,1,ZapBarge(2) +exten => 8612003,1,ZapBarge(3) +exten => 8612004,1,ZapBarge(4) +exten => 8612005,1,ZapBarge(5) +exten => 8612006,1,ZapBarge(6) +exten => 8612007,1,ZapBarge(7) +exten => 8612008,1,ZapBarge(8) +exten => 8612009,1,ZapBarge(9) +exten => 8612010,1,ZapBarge(10) +exten => 8612011,1,ZapBarge(11) +exten => 8612012,1,ZapBarge(12) +exten => 8612013,1,ZapBarge(13) +exten => 8612014,1,ZapBarge(14) +exten => 8612015,1,ZapBarge(15) +exten => 8612016,1,ZapBarge(16) +exten => 8612017,1,ZapBarge(17) +exten => 8612018,1,ZapBarge(18) +exten => 8612019,1,ZapBarge(19) +exten => 8612020,1,ZapBarge(20) +exten => 8612021,1,ZapBarge(21) +exten => 8612022,1,ZapBarge(22) +exten => 8612023,1,ZapBarge(23) +exten => 8612024,1,ZapBarge(24) + +; astGUIclient conferences +exten => 8600001,1,Meetme,8600001|qF +exten => 8600002,1,Meetme,8600002|qF +exten => 8600003,1,Meetme,8600003|qF +exten => 8600004,1,Meetme,8600004|qF +exten => 8600005,1,Meetme,8600005|qF +exten => 8600006,1,Meetme,8600006|qF +exten => 8600007,1,Meetme,8600007|qF +exten => 8600008,1,Meetme,8600008|qF +exten => 8600009,1,Meetme,8600009|qF +exten => 8600010,1,Meetme,8600010|qF +exten => 8600011,1,Meetme,8600011|qF +exten => 8600012,1,Meetme,8600012|qF +exten => 8600013,1,Meetme,8600013|qF +exten => 8600014,1,Meetme,8600014|qF +exten => 8600015,1,Meetme,8600015|qF +exten => 8600016,1,Meetme,8600016|qF +exten => 8600017,1,Meetme,8600017|qF +exten => 8600018,1,Meetme,8600018|qF +exten => 8600019,1,Meetme,8600019|qF +exten => 8600020,1,Meetme,8600020|qF +exten => 8600021,1,Meetme,8600021|qF +exten => 8600022,1,Meetme,8600022|qF +exten => 8600023,1,Meetme,8600023|qF +exten => 8600024,1,Meetme,8600024|qF +exten => 8600025,1,Meetme,8600025|qF +exten => 8600026,1,Meetme,8600026|qF +exten => 8600027,1,Meetme,8600027|qF +exten => 8600028,1,Meetme,8600028|qF +exten => 8600029,1,Meetme,8600029|qF + +exten => _X48600XXX,1,MeetMeAdmin(${EXTEN:2},T,${EXTEN:0:1}) +exten => _X48600XXX,2,Hangup + +exten => _X38600XXX,1,MeetMeAdmin(${EXTEN:2},t,${EXTEN:0:1}) +exten => _X38600XXX,2,Hangup + +exten => _X28600XXX,1,MeetMeAdmin(${EXTEN:2},m,${EXTEN:0:1}) +exten => _X28600XXX,2,Hangup + +exten => _X18600XXX,1,MeetMeAdmin(${EXTEN:2},M,${EXTEN:0:1}) +exten => _X18600XXX,2,Hangup + +exten => _55558600XXX,1,MeetMeAdmin(${EXTEN:4},K) +exten => _55558600XXX,2,Hangup +exten => 8300,1,Hangup + +; VICIDIAL conferences +exten => 8600051,1,Meetme,8600051|F +exten => 8600052,1,Meetme,8600052|F +exten => 8600053,1,Meetme,8600053|F +exten => 8600054,1,Meetme,8600054|F +exten => 8600055,1,Meetme,8600055|F +exten => 8600056,1,Meetme,8600056|F +exten => 8600057,1,Meetme,8600057|F +exten => 8600058,1,Meetme,8600058|F +exten => 8600059,1,Meetme,8600059|F +exten => 8600060,1,Meetme,8600060|F +exten => 8600061,1,Meetme,8600061|F +exten => 8600062,1,Meetme,8600062|F +exten => 8600063,1,Meetme,8600063|F +exten => 8600064,1,Meetme,8600064|F +exten => 8600065,1,Meetme,8600065|F +exten => 8600066,1,Meetme,8600066|F +exten => 8600067,1,Meetme,8600067|F +exten => 8600068,1,Meetme,8600068|F +exten => 8600069,1,Meetme,8600069|F +exten => 8600070,1,Meetme,8600070|F +exten => 8600071,1,Meetme,8600071|F +exten => 8600072,1,Meetme,8600072|F +exten => 8600073,1,Meetme,8600073|F +exten => 8600074,1,Meetme,8600074|F +exten => 8600075,1,Meetme,8600075|F +exten => 8600076,1,Meetme,8600076|F +exten => 8600077,1,Meetme,8600077|F +exten => 8600078,1,Meetme,8600078|F +exten => 8600079,1,Meetme,8600079|F +exten => 8600080,1,Meetme,8600080|F +exten => 8600081,1,Meetme,8600081|F +exten => 8600082,1,Meetme,8600082|F +exten => 8600083,1,Meetme,8600083|F +exten => 8600084,1,Meetme,8600084|F +exten => 8600085,1,Meetme,8600085|F +exten => 8600086,1,Meetme,8600086|F +exten => 8600087,1,Meetme,8600087|F +exten => 8600088,1,Meetme,8600088|F +exten => 8600089,1,Meetme,8600089|F +exten => 8600090,1,Meetme,8600090|F +exten => 8600091,1,Meetme,8600091|F +exten => 8600092,1,Meetme,8600092|F +exten => 8600093,1,Meetme,8600093|F +exten => 8600094,1,Meetme,8600094|F +exten => 8600095,1,Meetme,8600095|F +exten => 8600096,1,Meetme,8600096|F +exten => 8600097,1,Meetme,8600097|F +exten => 8600098,1,Meetme,8600098|F +exten => 8600099,1,Meetme,8600099|F +exten => 8600100,1,Meetme,8600100|F +exten => 8600101,1,Meetme,8600101|F +exten => 8600102,1,Meetme,8600102|F +exten => 8600103,1,Meetme,8600103|F +exten => 8600104,1,Meetme,8600104|F +exten => 8600105,1,Meetme,8600105|F +exten => 8600106,1,Meetme,8600106|F +exten => 8600107,1,Meetme,8600107|F +exten => 8600108,1,Meetme,8600108|F +exten => 8600109,1,Meetme,8600109|F +exten => 8600110,1,Meetme,8600110|F +exten => 8600111,1,Meetme,8600111|F +exten => 8600112,1,Meetme,8600112|F +exten => 8600113,1,Meetme,8600113|F +exten => 8600114,1,Meetme,8600114|F +exten => 8600115,1,Meetme,8600115|F +exten => 8600116,1,Meetme,8600116|F +exten => 8600117,1,Meetme,8600117|F +exten => 8600118,1,Meetme,8600118|F +exten => 8600119,1,Meetme,8600119|F +exten => 8600120,1,Meetme,8600120|F +exten => 8600121,1,Meetme,8600121|F +exten => 8600122,1,Meetme,8600122|F +exten => 8600123,1,Meetme,8600123|F +exten => 8600124,1,Meetme,8600124|F +exten => 8600125,1,Meetme,8600125|F +exten => 8600126,1,Meetme,8600126|F +exten => 8600127,1,Meetme,8600127|F +exten => 8600128,1,Meetme,8600128|F +exten => 8600129,1,Meetme,8600129|F +exten => 8600130,1,Meetme,8600130|F +exten => 8600131,1,Meetme,8600131|F +exten => 8600132,1,Meetme,8600132|F +exten => 8600133,1,Meetme,8600133|F +exten => 8600134,1,Meetme,8600134|F +exten => 8600135,1,Meetme,8600135|F +exten => 8600136,1,Meetme,8600136|F +exten => 8600137,1,Meetme,8600137|F +exten => 8600138,1,Meetme,8600138|F +exten => 8600139,1,Meetme,8600139|F +exten => 8600140,1,Meetme,8600140|F +exten => 8600141,1,Meetme,8600141|F +exten => 8600142,1,Meetme,8600142|F +exten => 8600143,1,Meetme,8600143|F +exten => 8600144,1,Meetme,8600144|F +exten => 8600145,1,Meetme,8600145|F +exten => 8600146,1,Meetme,8600146|F +exten => 8600147,1,Meetme,8600147|F +exten => 8600148,1,Meetme,8600148|F +exten => 8600149,1,Meetme,8600149|F +exten => 8600150,1,Meetme,8600150|F +exten => 8600151,1,Meetme,8600151|F +exten => 8600152,1,Meetme,8600152|F +exten => 8600153,1,Meetme,8600153|F +exten => 8600154,1,Meetme,8600154|F +exten => 8600155,1,Meetme,8600155|F +exten => 8600156,1,Meetme,8600156|F +exten => 8600157,1,Meetme,8600157|F +exten => 8600158,1,Meetme,8600158|F +exten => 8600159,1,Meetme,8600159|F +exten => 8600160,1,Meetme,8600160|F +exten => 8600161,1,Meetme,8600161|F +exten => 8600162,1,Meetme,8600162|F +exten => 8600163,1,Meetme,8600163|F +exten => 8600164,1,Meetme,8600164|F +exten => 8600165,1,Meetme,8600165|F +exten => 8600166,1,Meetme,8600166|F +exten => 8600167,1,Meetme,8600167|F +exten => 8600168,1,Meetme,8600168|F +exten => 8600169,1,Meetme,8600169|F +exten => 8600170,1,Meetme,8600170|F +exten => 8600171,1,Meetme,8600171|F +exten => 8600172,1,Meetme,8600172|F +exten => 8600173,1,Meetme,8600173|F +exten => 8600174,1,Meetme,8600174|F +exten => 8600175,1,Meetme,8600175|F +exten => 8600176,1,Meetme,8600176|F +exten => 8600177,1,Meetme,8600177|F +exten => 8600178,1,Meetme,8600178|F +exten => 8600179,1,Meetme,8600179|F +exten => 8600180,1,Meetme,8600180|F +exten => 8600181,1,Meetme,8600181|F +exten => 8600182,1,Meetme,8600182|F +exten => 8600183,1,Meetme,8600183|F +exten => 8600184,1,Meetme,8600184|F +exten => 8600185,1,Meetme,8600185|F +exten => 8600186,1,Meetme,8600186|F +exten => 8600187,1,Meetme,8600187|F +exten => 8600188,1,Meetme,8600188|F +exten => 8600189,1,Meetme,8600189|F +exten => 8600190,1,Meetme,8600190|F +exten => 8600191,1,Meetme,8600191|F +exten => 8600192,1,Meetme,8600192|F +exten => 8600193,1,Meetme,8600193|F +exten => 8600194,1,Meetme,8600194|F +exten => 8600195,1,Meetme,8600195|F +exten => 8600196,1,Meetme,8600196|F +exten => 8600197,1,Meetme,8600197|F +exten => 8600198,1,Meetme,8600198|F +exten => 8600199,1,Meetme,8600199|F +exten => 8600200,1,Meetme,8600200|F +; quiet entry and leaving conferences for VICIDIAL +exten => _78600XXX,1,Meetme,${EXTEN:1}|qF +; quiet monitor extensions for meetme rooms (for room managers) +exten => _68600XXX,1,Meetme,${EXTEN:1}|mq + +; voicelab exten +exten => _86009XX,1,Meetme,${EXTEN}|mq +; voicelab exten moderator +exten => _986009XX,1,Meetme,${EXTEN:1} + + + +; park channel for client GUI parking, hangup after 30 minutes +; create a GSM formatted audio file named "park.gsm" that is 30 minutes long +; and put it in /var/lib/asterisk/sounds +exten => 8301,1,Answer +exten => 8301,2,AGI(park_CID.agi) +exten => 8301,3,Playback(park) +exten => 8301,4,Hangup +exten => 8303,1,Answer +exten => 8303,2,AGI(park_CID.agi) +exten => 8303,3,Playback(conf) +exten => 8303,4,Hangup + +; park channel for client GUI conferencing, hangup after 30 minutes +; create a GSM formatted audio file named "conf.gsm" that is 30 minutes long +; and put it in /var/lib/asterisk/sounds +exten => 8302,1,Answer +exten => 8302,2,Playback(conf) +exten => 8302,3,Hangup + +exten => 8304,1,Answer +exten => 8304,2,Playback(ding) +exten => 8304,3,Hangup + +; default audio for safe harbor 2-second-after-hello message then hangup +; create a GSM formatted audio file complies with safe harbor rules +; and put it in /var/lib/asterisk/sounds then change filename below +exten => 8307,1,Answer +exten => 8307,2,Playback(vm-goodbye) +exten => 8307,3,Hangup + +; this is used for recording conference calls, the client app sends the filename +; value as a callerID recordings go to /var/spool/asterisk/monitor (WAV) +exten => 8309,1,Answer +exten => 8309,2,Monitor(wav,${CALLERID(name)}) +exten => 8309,3,Wait,3600 +exten => 8309,4,Hangup + +; this is used for recording conference calls, the client app sends the filename +; value as a callerID recordings go to /var/spool/asterisk/monitor (GSM) +exten => 8310,1,Answer +exten => 8310,2,Monitor(gsm,${CALLERID(name)}) +exten => 8310,3,Wait,3600 +exten => 8310,4,Hangup + +; this is used for playing a message to an answering machine forwarded from AMD in VICIDIAL +; replace conf with the message file you want to leave +exten => 8320,1,WaitForSilence(2000,2) ; AMD got machine. leave message after recording +exten => 8320,2,Playback(conf) +exten => 8320,3,AGI(VD_amd_post.agi,${EXTEN}) +exten => 8320,4,Hangup + +; use for selective CallerID hangup by area code(hard-coded) +exten => 8352,1,AGI(agi-VDADselective_CID_hangup.agi,${EXTEN}) +exten => 8352,2,Playback(safe_harbor) +exten => 8352,3,Hangup + +; prompt recording AGI script, ID is 4321 +exten => 8168,1,Answer +exten => 8168,2,AGI(agi-record_prompts.agi) +exten => 8168,3,Hangup + +; playback of recorded prompts +exten => _851XXXXX,1,Answer +exten => _851XXXXX,2,Playback(${EXTEN}) +exten => _851XXXXX,3,Hangup + +; this is used to allow the GUI to send you directly into voicemail +; don't forget to set GUI variable $voicemail_exten to this extension +exten => 8501,1,VoicemailMain(s${{CALLERID(num)}(num)}) +exten => 8501,2,Hangup + +; this is used to allow the GUI to send live calls directly into voicemail +; don't forget to set GUI variable $voicemail_dump_exten to this extension +exten => _85026666666666.,1,Wait(2) +exten => _85026666666666.,2,Voicemail(${EXTEN:14}) +exten => _85026666666666.,3,Hangup + +; this is used for sending DTMF signals within conference calls, the client app +; sends the digits to be played in the callerID field +; sound files must be placed in /var/lib/asterisk/sounds +exten => 8500998,1,Answer +exten => 8500998,2,Playback(silence) +exten => 8500998,3,AGI(agi-dtmf.agi) +exten => 8500998,4,Hangup + +;#### VDAD STANDARD TRANSFER ENTRIES #### +; VICIDIAL_auto_dialer transfer script for no-agent campaigns: +exten => 8364,1,AGI(agi://127.0.0.1:4577/call_log) +exten => 8364,2,AGI(agi-VDADtransferBROADCAST.agi,${EXTEN}) +exten => 8364,3,AGI(agi-VDADtransferBROADCAST.agi,${EXTEN}) +exten => 8364,4,AGI(agi-VDADtransferBROADCAST.agi,${EXTEN}) +exten => 8364,5,Hangup + +; VICIDIAL_auto_dialer transfer script: +exten => 8365,1,AGI(agi://127.0.0.1:4577/call_log) +exten => 8365,2,AGI(agi-VDADtransfer.agi,${EXTEN}) +exten => 8365,3,AGI(agi-VDADtransfer.agi,${EXTEN}) +exten => 8365,4,AGI(agi-VDADtransfer.agi,${EXTEN}) +exten => 8365,5,Hangup + +; VICIDIAL_auto_dialer transfer script SURVEY at beginning: +exten => 8366,1,AGI(agi://127.0.0.1:4577/call_log) +exten => 8366,2,AGI(agi-VDADtransferSURVEY.agi,${EXTEN}) +exten => 8366,3,AGI(agi-VDADtransferSURVEY.agi,${EXTEN}) +exten => 8366,4,AGI(agi-VDADtransferSURVEY.agi,${EXTEN}) +exten => 8366,5,Hangup + +; VICIDIAL_auto_dialer transfer script Load Balance Overflow: +exten => 8367,1,AGI(agi://127.0.0.1:4577/call_log) +exten => 8367,2,AGI(agi-VDAD_LO_transfer.agi,${EXTEN}) +exten => 8367,3,AGI(agi-VDAD_LO_transfer.agi,${EXTEN}) +exten => 8367,4,AGI(agi-VDAD_LO_transfer.agi,${EXTEN}) +exten => 8367,5,Hangup + +; VICIDIAL_auto_dialer transfer script Load Balanced: +exten => 8368,1,AGI(agi://127.0.0.1:4577/call_log) +exten => 8368,2,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +exten => 8368,3,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +exten => 8368,4,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +exten => 8368,5,Hangup + +; VICIDIAL_auto_dialer transfer script AMD with Load Balanced: +exten => 8369,1,AGI(agi://127.0.0.1:4577/call_log) +exten => 8369,2,AMD(2000|2000|1000|5000|120|50|4|256) +exten => 8369,3,AGI(VD_amd.agi,${EXTEN}) +exten => 8369,4,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +exten => 8369,5,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +exten => 8369,6,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +exten => 8369,7,Hangup + +; VICIDIAL auto-dial reminder script +exten => 8372,1,AGI(agi://127.0.0.1:4577/call_log) +exten => 8372,2,AGI(agi-VDADautoREMINDER.agi,${EXTEN}) +exten => 8372,3,AGI(agi-VDADautoREMINDER.agi,${EXTEN}) +exten => 8372,4,AGI(agi-VDADautoREMINDER.agi,${EXTEN}) +exten => 8372,5,Hangup + +;#### VDAD SIP UNREGISTERED TRANSFER ENTRIES #### +;#### Use these entries IN PLACE OF the entries above if you are using SIP trunks +;#### and are not registering your provider in sip.conf +;; VICIDIAL_auto_dialer transfer script for no-agent campaigns: +;exten => 8364,1,Playback(sip-silence) +;exten => 8364,2,AGI(agi://127.0.0.1:4577/call_log) +;exten => 8364,3,AGI(agi-VDADtransferBROADCAST.agi,${EXTEN}) +;exten => 8364,4,AGI(agi-VDADtransferBROADCAST.agi,${EXTEN}) +;exten => 8364,5,Hangup +; +;; VICIDIAL_auto_dialer transfer script: +;exten => 8365,1,Playback(sip-silence) +;exten => 8365,2,AGI(agi://127.0.0.1:4577/call_log) +;exten => 8365,3,AGI(agi-VDADtransfer.agi,${EXTEN}) +;exten => 8365,4,AGI(agi-VDADtransfer.agi,${EXTEN}) +;exten => 8365,5,Hangup +; +;; VICIDIAL_auto_dialer transfer script SURVEY at beginning: +;exten => 8366,1,Playback(sip-silence) +;exten => 8366,2,AGI(agi://127.0.0.1:4577/call_log) +;exten => 8366,3,AGI(agi-VDADtransferSURVEY.agi,${EXTEN}) +;exten => 8366,4,AGI(agi-VDADtransferSURVEY.agi,${EXTEN}) +;exten => 8366,5,Hangup +; +;; VICIDIAL_auto_dialer transfer script Load Balance Overflow: +;exten => 8367,1,Playback(sip-silence) +;exten => 8367,2,AGI(agi://127.0.0.1:4577/call_log) +;exten => 8367,3,AGI(agi-VDAD_LO_transfer.agi,${EXTEN}) +;exten => 8367,4,AGI(agi-VDAD_LO_transfer.agi,${EXTEN}) +;exten => 8367,5,Hangup +; +;; VICIDIAL_auto_dialer transfer script Load Balanced: +;exten => 8368,1,Playback(sip-silence) +;exten => 8368,2,AGI(agi://127.0.0.1:4577/call_log) +;exten => 8368,3,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +;exten => 8368,4,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +;exten => 8368,5,Hangup +; +;; VICIDIAL_auto_dialer transfer script AMD with Load Balanced: +;exten => 8369,1,Playback(sip-silence) +;exten => 8369,2,AGI(agi://127.0.0.1:4577/call_log) +;exten => 8369,3,AMD(2000|2000|1000|5000|120|50|4|256) +;exten => 8369,4,AGI(VD_amd.agi,${EXTEN}) +;exten => 8369,5,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +;exten => 8369,6,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +;exten => 8369,7,Hangup +; +;; VICIDIAL auto-dial reminder script +;exten => 8372,1,Playback(sip-silence) +;exten => 8372,2,AGI(agi://127.0.0.1:4577/call_log) +;exten => 8372,3,AGI(agi-VDADautoREMINDER.agi,${EXTEN}) +;exten => 8372,4,AGI(agi-VDADautoREMINDER.agi,${EXTEN}) +;exten => 8372,5,Hangup + diff --git a/agc_2-X/branches/agc_2.0.4/docs/conf_examples/iax.conf.sample b/agc_2-X/branches/agc_2.0.4/docs/conf_examples/iax.conf.sample new file mode 100644 index 00000000..de00baf9 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/conf_examples/iax.conf.sample @@ -0,0 +1,758 @@ +[general] +bindport=4569 +iaxcompat=yes +bandwidth=high +allow=all +allow=gsm ; Always allow GSM, it's cool :) +jitterbuffer=no +tos=lowdelay + +;register => 1112223333:PASSWORD@iax.binfone.com + +[1112223333] +auth=md5 +type=friend +username=1112223333 +secret=PASSWORD +host=iax.binfone.com +context=incoming-IAX-context-in-extensions.conf + +[ASTtest2] +type=friend +accountcode=IAXtrunk2 +context=default +auth=plaintext +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +qualify=yes + +[firefly01] +type=friend +accountcode=firefly01 +context=default +auth=plaintext +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=gsm +qualify=yes + + +[cc300] +type=friend +accountcode=cc300 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc301] +type=friend +accountcode=cc301 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc302] +type=friend +accountcode=cc302 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc303] +type=friend +accountcode=cc303 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc304] +type=friend +accountcode=cc304 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc305] +type=friend +accountcode=cc305 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc306] +type=friend +accountcode=cc306 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc307] +type=friend +accountcode=cc307 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc308] +type=friend +accountcode=cc308 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc309] +type=friend +accountcode=cc309 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc310] +type=friend +accountcode=cc310 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc311] +type=friend +accountcode=cc311 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc312] +type=friend +accountcode=cc312 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc313] +type=friend +accountcode=cc313 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc314] +type=friend +accountcode=cc314 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc315] +type=friend +accountcode=cc315 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc316] +type=friend +accountcode=cc316 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc317] +type=friend +accountcode=cc317 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc318] +type=friend +accountcode=cc318 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc319] +type=friend +accountcode=cc319 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc320] +type=friend +accountcode=cc320 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc321] +type=friend +accountcode=cc321 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc322] +type=friend +accountcode=cc322 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc323] +type=friend +accountcode=cc323 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc324] +type=friend +accountcode=cc324 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc325] +type=friend +accountcode=cc325 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc326] +type=friend +accountcode=cc326 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc327] +type=friend +accountcode=cc327 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc328] +type=friend +accountcode=cc328 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc329] +type=friend +accountcode=cc329 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc330] +type=friend +accountcode=cc330 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc331] +type=friend +accountcode=cc331 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc332] +type=friend +accountcode=cc332 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc333] +type=friend +accountcode=cc333 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc334] +type=friend +accountcode=cc334 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc335] +type=friend +accountcode=cc335 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc336] +type=friend +accountcode=cc336 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc337] +type=friend +accountcode=cc337 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc338] +type=friend +accountcode=cc338 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc339] +type=friend +accountcode=cc339 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc340] +type=friend +accountcode=cc340 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc341] +type=friend +accountcode=cc341 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc342] +type=friend +accountcode=cc342 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc343] +type=friend +accountcode=cc343 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc344] +type=friend +accountcode=cc344 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc345] +type=friend +accountcode=cc345 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc346] +type=friend +accountcode=cc346 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc347] +type=friend +accountcode=cc347 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc348] +type=friend +accountcode=cc348 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc349] +type=friend +accountcode=cc349 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + +[cc350] +type=friend +accountcode=cc350 +context=default +auth=md5 +host=dynamic +permit=0.0.0.0/0.0.0.0 +secret=test +disallow=all +allow=ulaw +allow=alaw +allow=gsm +qualify=yes + diff --git a/agc_2-X/branches/agc_2.0.4/docs/conf_examples/logger.conf.sample b/agc_2-X/branches/agc_2.0.4/docs/conf_examples/logger.conf.sample new file mode 100644 index 00000000..0c4c74a3 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/conf_examples/logger.conf.sample @@ -0,0 +1,3 @@ +[logfiles] +console => notice,warning,error +messages => notice,warning,error,debug,verbose diff --git a/agc_2-X/branches/agc_2.0.4/docs/conf_examples/manager.conf.sample b/agc_2-X/branches/agc_2.0.4/docs/conf_examples/manager.conf.sample new file mode 100644 index 00000000..ac195fa5 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/conf_examples/manager.conf.sample @@ -0,0 +1,24 @@ +[general] +enabled = yes +port = 5038 +bindaddr = 0.0.0.0 + +[cron] +secret = 1234 +read = system,call,log,verbose,command,agent,user +write = system,call,log,verbose,command,agent,user + +[updatecron] +secret = 1234 +read = command +write = command + +[listencron] +secret = 1234 +read = system,call,log,verbose,command,agent,user +write = command + +[sendcron] +secret = 1234 +read = command +write = system,call,log,verbose,command,agent,user diff --git a/agc_2-X/branches/agc_2.0.4/docs/conf_examples/meetme.conf.sample b/agc_2-X/branches/agc_2.0.4/docs/conf_examples/meetme.conf.sample new file mode 100644 index 00000000..a7f98ebe --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/conf_examples/meetme.conf.sample @@ -0,0 +1,195 @@ +[rooms] +conf => 8600 +conf => 8601,1234 + +conf => 8600001 +conf => 8600002 +conf => 8600003 +conf => 8600004 +conf => 8600005 +conf => 8600006 +conf => 8600007 +conf => 8600008 +conf => 8600009 +conf => 8600010 +conf => 8600011 +conf => 8600012 +conf => 8600013 +conf => 8600014 +conf => 8600015 +conf => 8600016 +conf => 8600017 +conf => 8600018 +conf => 8600019 +conf => 8600020 +conf => 8600021 +conf => 8600022 +conf => 8600023 +conf => 8600024 +conf => 8600025 +conf => 8600026 +conf => 8600027 +conf => 8600028 +conf => 8600029 + +conf => 8600051 +conf => 8600052 +conf => 8600053 +conf => 8600054 +conf => 8600055 +conf => 8600056 +conf => 8600057 +conf => 8600058 +conf => 8600059 +conf => 8600060 +conf => 8600061 +conf => 8600062 +conf => 8600063 +conf => 8600064 +conf => 8600065 +conf => 8600066 +conf => 8600067 +conf => 8600068 +conf => 8600069 +conf => 8600070 +conf => 8600071 +conf => 8600072 +conf => 8600073 +conf => 8600074 +conf => 8600075 +conf => 8600076 +conf => 8600077 +conf => 8600078 +conf => 8600079 +conf => 8600080 +conf => 8600081 +conf => 8600082 +conf => 8600083 +conf => 8600084 +conf => 8600085 +conf => 8600086 +conf => 8600087 +conf => 8600088 +conf => 8600089 +conf => 8600090 +conf => 8600091 +conf => 8600092 +conf => 8600093 +conf => 8600094 +conf => 8600095 +conf => 8600096 +conf => 8600097 +conf => 8600098 +conf => 8600099 +conf => 8600100 +conf => 8600101 +conf => 8600102 +conf => 8600103 +conf => 8600104 +conf => 8600105 +conf => 8600106 +conf => 8600107 +conf => 8600108 +conf => 8600109 +conf => 8600110 +conf => 8600111 +conf => 8600112 +conf => 8600113 +conf => 8600114 +conf => 8600115 +conf => 8600116 +conf => 8600117 +conf => 8600118 +conf => 8600119 +conf => 8600120 +conf => 8600121 +conf => 8600122 +conf => 8600123 +conf => 8600124 +conf => 8600125 +conf => 8600126 +conf => 8600127 +conf => 8600128 +conf => 8600129 +conf => 8600130 +conf => 8600131 +conf => 8600132 +conf => 8600133 +conf => 8600134 +conf => 8600135 +conf => 8600136 +conf => 8600137 +conf => 8600138 +conf => 8600139 +conf => 8600140 +conf => 8600141 +conf => 8600142 +conf => 8600143 +conf => 8600144 +conf => 8600145 +conf => 8600146 +conf => 8600147 +conf => 8600148 +conf => 8600149 +conf => 8600150 +conf => 8600151 +conf => 8600152 +conf => 8600153 +conf => 8600154 +conf => 8600155 +conf => 8600156 +conf => 8600157 +conf => 8600158 +conf => 8600159 +conf => 8600160 +conf => 8600161 +conf => 8600162 +conf => 8600163 +conf => 8600164 +conf => 8600165 +conf => 8600166 +conf => 8600167 +conf => 8600168 +conf => 8600169 +conf => 8600170 +conf => 8600171 +conf => 8600172 +conf => 8600173 +conf => 8600174 +conf => 8600175 +conf => 8600176 +conf => 8600177 +conf => 8600178 +conf => 8600179 +conf => 8600180 +conf => 8600181 +conf => 8600182 +conf => 8600183 +conf => 8600184 +conf => 8600185 +conf => 8600186 +conf => 8600187 +conf => 8600188 +conf => 8600189 +conf => 8600190 +conf => 8600191 +conf => 8600192 +conf => 8600193 +conf => 8600194 +conf => 8600195 +conf => 8600196 +conf => 8600197 +conf => 8600198 +conf => 8600199 +conf => 8600200 + +conf => 8600900 +conf => 8600901 +conf => 8600902 +conf => 8600903 +conf => 8600904 +conf => 8600905 +conf => 8600906 +conf => 8600907 +conf => 8600908 +conf => 8600909 diff --git a/agc_2-X/branches/agc_2.0.4/docs/conf_examples/musiconhold.conf.sample b/agc_2-X/branches/agc_2.0.4/docs/conf_examples/musiconhold.conf.sample new file mode 100644 index 00000000..5b18de7a --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/conf_examples/musiconhold.conf.sample @@ -0,0 +1,16 @@ +; +; Music on Hold -- Sample Configuration +; + +[default] +mode=files +directory=/var/lib/asterisk/mohmp3 + +; valid mode options: +; quietmp3 -- default +; mp3 -- loud +; mp3nb -- unbuffered +; quietmp3nb -- quiet unbuffered +; custom -- run a custom application +; files -- read files from a directory in any Asterisk supported format + diff --git a/agc_2-X/branches/agc_2.0.4/docs/conf_examples/sip.conf.sample b/agc_2-X/branches/agc_2.0.4/docs/conf_examples/sip.conf.sample new file mode 100644 index 00000000..911d1713 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/conf_examples/sip.conf.sample @@ -0,0 +1,724 @@ +[general] +port = 5060 +bindaddr = 0.0.0.0 +context = default +; register SIP account on remote machine if using SIP trunks +; register => testSIPtrunk:test@10.10.10.16:5060 +; +; setup account for SIP trunking: +; [SIPtrunk] +; disallow=all +; allow=ulaw +; allow=alaw +; type=friend +; username=testSIPtrunk +; secret=test +; host=10.10.10.16 +; dtmfmode=inband +; qualify=1000 + +[gs102] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=gs102 +secret=test +host=dynamic +dtmfmode=inband +defaultip=10.10.10.16 +qualify=1000 +mailbox=102 + +[spa2000] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=spa2000 +secret=test +host=dynamic +dtmfmode=inband +defaultip=10.10.10.17 +qualify=1000 +mailbox=2000 + +[spa2001] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=spa2001 +secret=test +host=dynamic +dtmfmode=inband +defaultip=10.10.10.17 +qualify=1000 +mailbox=2001 + + + + + +[cc100] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc100 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1000 +mailbox=100 + +[cc101] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc101 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1000 +mailbox=101 + +[cc102] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc102 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1000 +mailbox=102 + +[cc103] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc103 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1000 +mailbox=103 + +[cc104] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc104 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1000 +mailbox=104 + +[cc105] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc105 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1000 +mailbox=105 + +[cc106] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc106 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1000 +mailbox=106 + +[cc107] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc107 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1000 +mailbox=107 + +[cc108] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc108 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1000 +mailbox=108 + +[cc109] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc109 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1000 +mailbox=109 + +[cc110] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc110 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1100 +mailbox=110 + +[cc111] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc111 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1100 +mailbox=111 + +[cc112] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc112 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1100 +mailbox=112 + +[cc113] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc113 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1100 +mailbox=113 + +[cc114] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc114 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1100 +mailbox=114 + +[cc115] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc115 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1100 +mailbox=115 + +[cc116] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc116 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1100 +mailbox=116 + +[cc117] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc117 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1100 +mailbox=117 + +[cc118] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc118 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1100 +mailbox=118 + +[cc119] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc119 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1100 +mailbox=119 + +[cc120] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc120 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1200 +mailbox=120 + +[cc121] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc121 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1200 +mailbox=121 + +[cc122] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc122 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1200 +mailbox=122 + +[cc123] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc123 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1200 +mailbox=123 + +[cc124] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc124 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1200 +mailbox=124 + +[cc125] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc125 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1200 +mailbox=125 + +[cc126] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc126 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1200 +mailbox=126 + +[cc127] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc127 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1200 +mailbox=127 + +[cc128] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc128 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1200 +mailbox=128 + +[cc129] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc129 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1200 +mailbox=129 + +[cc130] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc130 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1300 +mailbox=130 + +[cc131] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc131 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1300 +mailbox=131 + +[cc132] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc132 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1300 +mailbox=132 + +[cc133] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc133 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1300 +mailbox=133 + +[cc134] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc134 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1300 +mailbox=134 + +[cc135] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc135 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1300 +mailbox=135 + +[cc136] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc136 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1300 +mailbox=136 + +[cc137] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc137 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1300 +mailbox=137 + +[cc138] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc138 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1300 +mailbox=138 + +[cc139] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc139 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1300 +mailbox=139 + +[cc140] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc140 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1400 +mailbox=140 + +[cc141] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc141 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1400 +mailbox=141 + +[cc142] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc142 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1400 +mailbox=142 + +[cc143] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc143 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1400 +mailbox=143 + +[cc144] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc144 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1400 +mailbox=144 + +[cc145] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc145 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1400 +mailbox=145 + +[cc146] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc146 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1400 +mailbox=146 + +[cc147] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc147 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1400 +mailbox=147 + +[cc148] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc148 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1400 +mailbox=148 + +[cc149] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc149 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1400 +mailbox=149 + +[cc150] +disallow=all +allow=ulaw +allow=alaw +type=friend +username=cc150 +secret=test +host=dynamic +dtmfmode=inband +defaultip=192.168.1.249 +qualify=1400 +mailbox=150 diff --git a/agc_2-X/branches/agc_2.0.4/docs/conf_examples/voicemail.conf.sample b/agc_2-X/branches/agc_2.0.4/docs/conf_examples/voicemail.conf.sample new file mode 100644 index 00000000..4b3546ac --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/conf_examples/voicemail.conf.sample @@ -0,0 +1,19 @@ +[general] +format=wav49|gsm|wav +serveremail=asterisk +attach=yes +skipms=3000 +maxsilence=10 +silencethreshold=128 +maxlogins=3 + +[zonemessages] +eastern=America/New_York|'vm-received' Q 'digits/at' IMp +central=America/Chicago|'vm-received' Q 'digits/at' IMp +central24=America/Chicago|'vm-received' q 'digits/at' H 'digits/hundred' M 'hours' + +[default] +102 => 102,Grandstream Mailbox,root@localhost +2000 => 2000,Sipura Mailbox 1 +2001 => 2001,Sipura Mailbox 2 +3001 => 3001,Firefly Mailbox 1 diff --git a/agc_2-X/branches/agc_2.0.4/docs/conf_examples/zapata.conf.t100p.sample b/agc_2-X/branches/agc_2.0.4/docs/conf_examples/zapata.conf.t100p.sample new file mode 100644 index 00000000..c735d394 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/conf_examples/zapata.conf.t100p.sample @@ -0,0 +1,46 @@ +# /etc/asterisk/zapata.conf: +# Digium/Clone T100P EXAMPLE: +# Here is an example of a configuration where an T100P single T1 card is used +# for connecting a single T1 PRI circuit with 23 voice channels + +[channels] +group=1 +language=en +signalling=pri_net +usecallerid=yes +callerid=asreceived +callprogress=no +busydetect=no +context=default +echocancel=64 +echocancelwhenbridged=yes +rxgain=1.0 +txgain=1.0 +channel => 1-23 + +# FOR A RBS WinkStart T1 YOU WOULD USE SOMETHING LIKE THIS: +# group=1 +# language=en +# signalling=em_w +# usecallerid=yes +# callerid=asreceived +# context=default +# echocancel=64 +# echocancelwhenbridged=yes +# rxgain=1.0 +# txgain=1.0 +# channel => 1-24 +# +# FOR AN ANALOG T1 ChannelBank YOU WOULD USE SOMETHING LIKE THIS: +# group=4 +# language=en +# signalling=fxo_ks +# usecallerid=yes +# callerid=asreceived +# context=default +# echocancel=64 +# echocancelwhenbridged=no +# rxgain=-1.0 +# txgain=-1.0 +# channel => 1-24 + diff --git a/agc_2-X/branches/agc_2.0.4/docs/conf_examples/zapata.conf.x100p.sample b/agc_2-X/branches/agc_2.0.4/docs/conf_examples/zapata.conf.x100p.sample new file mode 100644 index 00000000..75084b4a --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/conf_examples/zapata.conf.x100p.sample @@ -0,0 +1,13 @@ +# /etc/asterisk/zapata.conf: +# Digium/Clone X100P EXAMPLE: +# Here is an example of a configuration where an X100P single FXO card is used +# for zaptel timing and not used for calling: +# +# NOTE: you can get an X100P on ebay for $10-30 that will work with Asterisk + +[trunkgroups] +[channels] +context=unused +signalling=fxs_ks +channel => 1 + diff --git a/agc_2-X/branches/agc_2.0.4/docs/conf_examples/zaptel.conf.t100p.sample b/agc_2-X/branches/agc_2.0.4/docs/conf_examples/zaptel.conf.t100p.sample new file mode 100644 index 00000000..178c9f01 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/conf_examples/zaptel.conf.t100p.sample @@ -0,0 +1,23 @@ +# /etc/zaptel.conf: +# Digium/Clone T100P EXAMPLE: +# Here is an example of a configuration where an T100P single T1 card is used +# for connecting a single T1 PRI circuit with 23 voice channels + +span=1,1,0,esf,b8zs +bchan=1-23 +dchan=24 +loadzone = us +defaultzone=us + +# FOR A RBS WinkStart T1 YOU WOULD USE SOMETHING LIKE THIS: +# span=1,1,0,esf,b8zs +# e&m=1-24 +# loadzone = us +# defaultzone=us +# +# FOR AN ANALOG T1 ChannelBank YOU WOULD USE SOMETHING LIKE THIS: +# span=1,1,0,esf,b8zs +# fxoks=1-24 +# loadzone = us +# defaultzone=us +# diff --git a/agc_2-X/branches/agc_2.0.4/docs/conf_examples/zaptel.conf.x100p.sample b/agc_2-X/branches/agc_2.0.4/docs/conf_examples/zaptel.conf.x100p.sample new file mode 100644 index 00000000..aa2adb65 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/docs/conf_examples/zaptel.conf.x100p.sample @@ -0,0 +1,10 @@ +# /etc/zaptel.conf: +# Digium/Clone X100P EXAMPLE: +# Here is an example of a configuration where an X100P single FXO card is used +# for zaptel timing and not used for calling: +# +# NOTE: you can get an X100P on ebay for $10-30 that will work with Asterisk + +loadzone=us +defaultzone=us +fxsks=1 diff --git a/agc_2-X/branches/agc_2.0.4/extras/AUS_zipcode_ranges.txt b/agc_2-X/branches/agc_2.0.4/extras/AUS_zipcode_ranges.txt new file mode 100644 index 00000000..af434eb0 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/extras/AUS_zipcode_ranges.txt @@ -0,0 +1,14 @@ +ACT|0200|0399 +NT|0800|0999 +NSW|1000|2599 +ACT|2600|2618 +NSW|2619|2899 +ACT|2900|2920 +NSW|2921|2999 +VIC|3000|3999 +QLD|4000|4999 +SA|5000|5999 +WA|6000|6999 +TAS|7000|7999 +VIC|8000|8999 +QLD|9000|9999 \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/extras/Asterisk.pm b/agc_2-X/branches/agc_2.0.4/extras/Asterisk.pm new file mode 100644 index 00000000..15ecd4a8 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/extras/Asterisk.pm @@ -0,0 +1,20 @@ +package Asterisk; + +require 5.004; + +$VERSION = '0.08'; + +sub version { $VERSION; } + +sub new { + my ($class, %args) = @_; + my $self = {}; + $self->{configfile} = undef; + $self->{config} = {}; + bless $self, ref $class || $class; + return $self; +} + +sub DESTROY { } + +1; diff --git a/agc_2-X/branches/agc_2.0.4/extras/Asterisk/AGI.pm b/agc_2-X/branches/agc_2.0.4/extras/Asterisk/AGI.pm new file mode 100644 index 00000000..b1680ea6 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/extras/Asterisk/AGI.pm @@ -0,0 +1,685 @@ +package Asterisk::AGI; + +require 5.004; + +use Asterisk; + +@ISA = ( 'Asterisk' ); + +=head1 NAME + +Asterisk::AGI - Simple Asterisk Gateway Interface Class + +=head1 SYNOPSIS + +use Asterisk::AGI; + +$AGI = new Asterisk::AGI; + +# pull AGI variables into %input + + %input = $AGI->ReadParse(); + +# say the number 1984 + + $AGI->say_number(1984); + +=head1 DESCRIPTION + +This module should make it easier to write scripts that interact with the +asterisk open source pbx via AGI (asterisk gateway interface) + +=head1 AGI COMMANDS + +=cut + +sub new { + my ($class, %args) = @_; + my $self = {}; + $self->{'callback'} = undef; + $self->{'status'} = undef; + $self->{'lastresponse'} = undef; + bless $self, ref $class || $class; + return $self; +} + +sub ReadParse { + my ($self, $fh) = @_; + + my %input = (); + + $fh = \*STDIN if (!$fh); + + while (<$fh>) { + chomp; + last unless length($_); + if (/^agi_(\w+)\:\s+(.*)$/) { + $input{$1} = $2; + } + } + + + if (defined($DEBUG)&&($DEBUG>0)) { + print STDERR "AGI Environment Dump:\n"; + foreach $i (sort keys %input) { + print STDERR " -- $i = $input{$i}\n"; + } + } + + return %input; +} + +sub setcallback { + my ($self, $function) = @_; + + if (defined($function) && ref($function) eq 'CODE') { + $self->{'callback'} = $function; + } +} + +sub callback { + my ($self, $result) = @_; + + if (defined($self->{'callback'}) && ref($self->{'callback'}) eq 'CODE') { + &{$self->{'callback'}}($result); + } +} + +sub execute { + my ($self, $command) = @_; + + $self->_execcommand($command); + my $res = $self->_readresponse(); + + return $self->_checkresult($res); +} + +sub _execcommand { + my ($self, $command, $fh) = @_; + + $fh = \*STDOUT if (!$fh); + + select ((select ($fh), $| = 1)[0]); + + return -1 if (!defined($command)); + + return print $fh "$command\n"; +} + +sub _readresponse { + my ($self, $fh) = @_; + + my $response = undef; + $fh = \*STDIN if (!$fh); + $response = <$fh> || return '200 result=-1 (noresponse)'; + chomp($response); + return $response; +} + +sub _checkresult { + my ($self, $response) = @_; + + return undef if (!defined($response)); + my $result = undef; + + $self->_lastresponse($response); + if ($response =~ /^200/) { + if ($response =~ /result=(-?[\d*#]+)/) { + $result = $1; + } + } elsif ($response =~ /\(noresponse\)/) { + $self->_status('noresponse'); + } else { + print STDERR "Unexpected result '$response'\n" if (defined($DEBUG) && $DEBUG); + } + print STDERR "_checkresult($response) = $result\n" if (defined($DEBUG) && $DEBUG>3); + + return $result; +} + +sub _status { + my ($self, $status) = @_; + + if (defined($status)) { + $self->{'status'} = $status; + } else { + return $self->{'status'}; + } +} + +sub _lastresponse { + my ($self, $response) = @_; + + if (defined($response)) { + $self->{'lastresponse'} = $response; + } else { + return $self->{'lastresponse'}; + } +} + +=over 4 + +=item $AGI->stream_file($filename, $digits) + +Executes AGI Command "STREAM FILE $filename $digits" + +This command instructs Asterisk to play the given sound file and listen for the given dtmf digits. The +fileextension must not be used in the filename because Asterisk will find the most appropriate file +type. + +Example: $AGI->stream_file('demo-echotest', '0123'); + +Returns: -1 on error or hangup, +0 if playback completes without a digit being pressed, +or the ASCII numerical value of the digit if a digit was pressed + +=cut + +sub stream_file { + my ($self, $filename, $digits) = @_; + + my $ret = 0; + + $digits = '""' if (!defined($digits)); + + return -1 if (!defined($filename)); + $ret = $self->execute("STREAM FILE $filename $digits"); + + $self->callback($ret) if ($ret == -1); + + return $ret; +} + +=item $AGI->send_text($text) + +Executes AGI Command "SEND TEXT "$text" + +Sends the given text on a channel. Most channels do not support the transmission of text. + +Example: $AGI->send_text('You've got mail!'); + +Returns: -1 on error or hangup, +0 if the text was sent or if the channel does not support text transmission. + +=cut + +sub send_text { + my ($self, $text) = @_; + + my $ret = 0; + + return $ret if (!defined($text)); + $ret = $self->execute("SEND TEXT \"$text\""); + $self->callback($ret) if ($ret == -1); + + return $ret; +} + +=item $AGI->send_image($image) + +Executes AGI Command "SEND IMAGE $image + +Sends the given image on a channel. Most channels do not support the transmission of images. + +Example: $AGI->send_image('image.png'); + +Returns: -1 on error or hangup, +0 if the image was sent or if the channel does not support image transmission. + +=cut + +sub send_image { + my ($self, $image) = @_; + + my $ret = 0; + return -1 if (!defined($image)); + + $ret = $self->execute("SEND IMAGE $image"); + $self->callback($ret) if ($ret == -1); + + return $ret; +} + +=item $AGI->say_number($number, $digits) + +Executes AGI Command "SAY NUMBER $number $digits" + +Says the given $number, returning early if any of the $digits are received. + +Example: $AGI->say_number('98765'); + +Returns: -1 on error or hangup, +0 if playback completes without a digit being pressed, +or the ASCII numerical value of the digit of one was pressed. + +=cut + +sub say_number { + my ($self, $number, $digits) = @_; + + my $ret = 0; + + $digits = '""' if (!defined($digits)); + + return -1 if (!defined($number)); + $number =~ s/\D//g; + $ret = $self->execute("SAY NUMBER $number $digits"); + + $self->callback($ret) if ($ret == -1); + + return $ret; +} + +=item $AGI->say_digits($number, $digits) + +Executes AGI Command "SAY DIGITS $number $digits" + +Says the given digit string $number, returning early if any of the $digits are received. + +Example: $AGI->say_digits('8675309'); + +Returns: -1 on error or hangup, +0 if playback completes without a digit being pressed, +or the ASCII numerical value of the digit of one was pressed. + +=cut + +sub say_digits { + my ($self, $number, $digits) = @_; + + my $ret = 0; + $digits = '""' if (!defined($digits)); + + return -1 if (!defined($number)); + $number =~ s/\D//g; + $ret = $self->execute("SAY DIGITS $number $digits"); + $self->callback($ret) if ($ret == -1); + + return $ret; +} + +=item $AGI->answer() + +Executes AGI Command "ANSWER" + +Answers channel if not already in answer state + +Example: $AGI->answer(); + +Returns: -1 on channel failure, or +0 if successful + +=cut + +sub answer { + my ($self) = @_; + + my $ret = 0; + $ret = $self->execute('ANSWER'); + $self->callback($ret) if ($ret == -1); + + return $ret; + +} + +=item $AGI->get_data($filename, $timeout, $maxdigits) + +Executes AGI Command "GET DATA $filename $timeout $maxdigits" + +Streams $filename and returns when $maxdigits have been received or +when $timeout has been reached. Timeout is specified in ms + +Example: $AGI->get_data('demo-welcome', 15000, 5); + +=cut + +sub get_data { + my ($self, $filename, $timeout, $maxdigits) = @_; + + my $ret = undef; + + return -1 if (!defined($filename)); + $ret = $self->execute("GET DATA $filename $timeout $maxdigits"); + $self->callback($ret) if ($ret == -1); + + return $ret; +} + +=item $AGI->set_callerid($number) + +Executes AGI Command "SET CALLERID $number" + +Changes the callerid of the current channel to + +Example: $AGI->set_callerid('9995551212'); + +Returns: Always returns 1 + +=cut + +sub set_callerid { + my ($self, $number) = @_; + + return if (!defined($number)); + return $self->execute("SET CALLERID $number"); +} + +=item $AGI->set_context($context) + +Executes AGI Command "SET CONTEXT $context" + +Changes the context for continuation upon exiting the agi application + +Example: $AGI->set_context('dialout'); + +Returns: Always returns 0 + +=cut + +sub set_context { + my ($self, $context) = @_; + + return -1 if (!defined($context)); + return $self->execute("SET CONTEXT $context"); +} + +=item $AGI->set_extension($extension) + +Executes AGI Command "SET EXTENSION $extension" + +Changes the extension for continuation upon exiting the agi application + +Example: $AGI->set_extension('7'); + +Returns: Always returns 0 + +=cut + +sub set_extension { + my ($self, $extension) = @_; + + return -1 if (!defined($extension)); + return $self->execute("SET EXTENSION $extension"); +} + +=item $AGI->set_priority($priority) + +Executes AGI Command "SET PRIORITY $priority" + +Changes the priority for continuation upon exiting the agi application + +Example: $AGI->set_priority(1); + +Returns: Always returns 0 + +=cut + +sub set_priority { + my ($self, $priority) = @_; + + return -1 if (!defined($priority)); + return $self->execute("SET PRIORITY $priority"); +} + +sub receive_char { + my ($self, $timeout) = @_; + + my $ret = 0; +#wait forever if timeout is not set. is this the prefered default? + $timeout = 0 if (!defined($timeout)); + $ret = $self->execute("RECEIVE CHAR $timeout"); + $self->callback($ret) if ($ret == -1); + + return $ret; + +} + +sub tdd_mode { + my ($self, $mode) = @_; + + return 0 if (!defined($mode)); + return $self->execute("TDD MODE $mode"); +} + + +sub wait_for_digit { + my ($self, $timeout) = @_; + + my $ret = 0; + $timeout = -1 if (!defined($timeout)); + $ret = $self->execute("WAIT FOR DIGIT $timeout"); + + $self->callback($ret) if ($ret == -1); + + return $ret; +} + +sub record_file { + my ($self, $filename, $format, $digits, $timeout, $beep) = @_; + + my $ret = 0; + + return -1 if (!defined($filename)); + $digits = '""' if (!defined($digits)); + $ret = $self->execute("RECORD FILE $filename $format $digits $timeout"); + + $self->callback($ret) if ($ret == -1); + + return $ret; +} + +sub set_autohangup { + my ($self, $time) = @_; + + $time = 0 if (!defined($time)); + return $self->execute("SET AUTOHANGUP $time"); +} + +=item $AGI->hangup($channel) + +Executes AGI Command "HANGUP $channel" + +Hangs up the passed $channel, or the current channel if $channel is not passed. +It is left to the AGI script to exit properly, otherwise you could end up with zombies. + +Example: $AGI->hangup(); + +Returns: Always returns 1 + +=cut + +sub hangup { + my ($self, $channel) = @_; + + if ($channel) { + return $self->execute("HANGUP $channel"); + } else { + return $self->execute("HANGUP"); + } +} + +=item $AGI->exec($app, $options) + +Executes AGI Command "EXEC $app $options" + +The most powerful AGI command. Executes the given application passing the given options. + +Example: $AGI->exec('Dial', 'Zap/g2/8005551212'); + +Returns: -2 on failure to find application, or +whatever the given application returns + +=cut + +sub exec { + my ($self, $app, $options) = @_; + return -1 if (!defined($app)); + $options = '""' if (!defined($options)); + return $self->execute("EXEC $app $options"); +} + +sub channel_status { + my ($self, $channel) = @_; + + return $self->execute("CHANNEL STATUS $channel"); +} + +=item $AGI->set_variable($variable, $value) + +Executes AGI Command "SET VARIABLE $variable $value" + +Sets the channel variable to + +Example: $AGI->set_variable('status', 'authorized'); + +Returns: Always returns 1 + +=cut + +sub set_variable { + my ($self, $variable, $value) = @_; + + return $self->execute("SET VARIABLE $variable $value"); +} + +=item $AGI->get_variable($variable) + +Executes AGI Command "GET VARIABLE $variablename" + +Gets the channel variable + +Example: $AGI->get_variable('status'); + +Returns: The value of the variable, or undef if variable does not exist + +=cut + +sub get_variable { + my ($self, $variable) = @_; + + my $result = undef; + + if ($self->execute("GET VARIABLE $variable")) { + my $tempresult = $self->_lastresponse(); + if ($tempresult =~ /\((.*)\)/) { + $result = $1; + } + } + return $result; +} + +=item $AGI->verbose($message, $level) + +Executes AGI Command "VERBOSE $message $level" + +Logs $message with verboselevel $level + +Example: $AGI->verbose("System Crashed\n", 1); + +Returns: Always returns 1 + +=cut + + +sub verbose { + my ($self, $message, $level) = @_; + + return $self->execute("VERBOSE \"$message\" $level"); +} + +=item $AGI->database_get($family, $key) + +Executes AGI Command "DATABASE GET $family $key" + +Example: $var = $AGI->database_get('test', 'status'); + +Returns: The value of the variable, or undef if variable does not exist + +=cut + +sub database_get { + my ($self, $family, $key) = @_; + + my $result = undef; + + if ($self->execute("DATABASE GET $family $key")) { + my $tempresult = $self->_lastresponse(); + if ($tempresult =~ /\((.*)\)/) { + $result = $1; + } + } + return $result; +} + +=item $AGI->database_put($family, $key, $value) + +Executes AGI Command "DATABASE PUT $family $key $value" + +Set/modifes database entry / to + +Example: $AGI->database_put('test', 'status', 'authorized'); + +Returns: 1 on success, 0 otherwise + +=cut + +sub database_put { + my ($self, $family, $key, $value) = @_; + + return $self->execute("DATABASE PUT $family $key $value"); +} + +=item $AGI->database_del($family, $key) + +Executes AGI Command "DATABASE DEL $family $key" + +Removes database entry / + +Example: $AGI->database_del('test', 'status'); + +Returns: 1 on success, 0 otherwise + +=cut + +sub database_del { + my ($self, $family, $key) = @_; + + return $self->execute("DATABASE DEL $family $key"); +} + +=item $AGI->database_deltree($family, $key) + +Executes AGI Command "DATABASE DELTREE $family $key" + +Deletes a family or specific keytree within a family in the Asterisk database + +Example: $AGI->database_deltree('test', 'status'); +Example: $AGI->database_deltree('test'); + +Returns: 1 on success, 0 otherwise + +=cut + +sub database_deltree { + my ($self, $family, $key) = @_; + + return $self->execute("DATABASE DELTREE $family $key"); +} + +sub noop { + my ($self) = @_; + + return $self->execute("NOOP"); +} + +sub set_music { + my ($self, $mode, $class) = @_; + + return $self->execute("SET MUSIC $mode $class"); +} + +1; + +__END__ + +=back diff --git a/agc_2-X/branches/agc_2.0.4/extras/Asterisk/Manager.pm b/agc_2-X/branches/agc_2.0.4/extras/Asterisk/Manager.pm new file mode 100644 index 00000000..69d860a1 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/extras/Asterisk/Manager.pm @@ -0,0 +1,412 @@ +package Asterisk::Manager; + +require 5.004; + +use Asterisk; +use IO::Socket; +use Digest::MD5; + +#use strict; +#use warnings; + +=head1 NAME + +Asterisk::Manager - Asterisk Manager Interface + +=head1 SYNOPSIS + +use Asterisk::Manager; + +my $astman = new Asterisk::Manager; + +$astman->user('username'); + +$astman->secret('test'); + +$astman->host('localhost'); + +$astman->connect || die "Could not connect to " . $astman->host . "!\n"; + +$astman->disconnect; + +=head1 DESCRIPTION + +This module provides a simple interface to the asterisk manager interface. + +=cut + +my $EOL = "\r\n"; +my $BLANK = $EOL x 2; + +my $VERSION = '0.01'; + +sub version { $VERSION; } + +sub new { + my ($class, %args) = @_; + + my $self = {}; + $self->{_CONNFD} = undef; + $self->{_PROTOVERS} = undef; + $self->{_ERRORSTR} = undef; + $self->{_HOST} = 'localhost'; + $self->{_PORT} = 5038; + $self->{_USER} = undef; + $self->{_SECRET} = undef; + $self->{_EVENTCB} = {}; + $self->{_DEBUG} = 0; + $self->{_CONNECTED} = 0; + bless $self, ref $class || $class; + return $self; +} + +sub DESTROY { } + +sub user { + my ($self, $user) = @_; + + if ($user) { + $self->{_USER} = $user; + } + + return $self->{_USER}; +} + +sub secret { + my ($self, $secret) = @_; + + if ($secret) { + $self->{_SECRET} = $secret; + } + + return $self->{_SECRET}; +} + +sub host { + my ($self, $host) = @_; + + if ($host) { + $self->{_HOST} = $host; + } + + return $self->{_HOST}; +} + +sub port { + my ($self, $port) = @_; + + if ($port) { + $self->{_PORT} = $port; + } + + return $self->{_PORT}; +} + +sub connected { + my ($self, $connected) = @_; + + if (defined($connected)) { + $self->{_CONNECTED} = $connected; + } + + return $self->{_CONNECTED}; +} + +sub error { + my ($self, $error) = @_; + + if ($error) { + $self->{_ERRORSTR} = $error; + } + + return $self->{_ERRORSTR}; +} + +sub debug { + my ($self, $debug) = @_; + + if ($debug) { + $self->{_DEBUG} = $debug; + } + + return $self->{_DEBUG}; +} + +sub connfd { + my ($self, $connfd) = @_; + + if ($connfd) { + $self->{_CONNFD} = $connfd; + } + + return $self->{_CONNFD}; +} + +sub read_response { + my ($self, $connfd) = @_; + + my @response; + + if (!$connfd) { + $connfd = $self->connfd; + } + + while (my $line = <$connfd>) { + last if ($line eq $EOL); + + if (wantarray) { + $line =~ s/$EOL//g; + push(@response, $line) if $line; + } else { + $response[0] .= $line; + } + + } + + return wantarray ? @response : $response[0]; +} + +sub connect { + my ($self) = @_; + + my $host = $self->host; + my $port = $self->port; + my $user = $self->user; + my $secret = $self->secret; + my %resp; + + my $conn = new IO::Socket::INET( Proto => 'tcp', + PeerAddr => $host, + PeerPort => $port + ); + if (!$conn) { + $self->error("Connection refused ($host:$port)\n"); + return undef; + } + + $conn->autoflush(1); + + my $input = <$conn>; + $input =~ s/$EOL//g; + + my ($manager, $version) = split('/', $input); + + if ($manager !~ /Asterisk Call Manager/) { + return $self->error("Unknown Protocol\n"); + } + + $self->{_PROTOVERS} = $version; + $self->connfd($conn); + + # check if the remote host supports MD5 Challenge authentication + my %authresp = $self->sendcommand( Action => 'Challenge', + AuthType => 'MD5' + ); + + if (($authresp{Response} eq 'Success')) { + # do md5 login + my $md5 = new Digest::MD5; + $md5->add($authresp{Challenge}); + $md5->add($secret); + my $digest = $md5->hexdigest; + %resp = $self->sendcommand( Action => 'Login', + AuthType => 'MD5', + Username => $user, + Key => $digest + ); + } else { + # do plain text login + %resp = $self->sendcommand( Action => 'Login', + Username => $user, + Secret => $secret + ); + + } + + if ( ($resp{Response} ne 'Success') && ($resp{Message} ne 'Authentication accepted') ) { + $self->error("Authentication failed for user $user\n"); + return undef; + } + + $self->connected(1); + + return $conn; +} + +sub astman_h2s { + my ($self, %thash) = @_; + + my $tstring = ''; + + foreach my $key (keys %thash) { + $tstring .= $key . ': ' . $thash{$key} . ${EOL}; + } + + return $tstring; +} + +sub astman_s2h { + my ($self, $tstring) = @_; + + my %thash; + + foreach my $line (split(/$EOL/, $tstring)) { + if ($line =~ /(\w*):\s*(\w*)/) { + $thash{$1} = $2; + } + } + + return %thash; +} + +#$want is how you want the data returned +#$want = 0 (default) returns the results in a hash +#$want = 1 returns the results in a large string +#$want = 2 returns the results in an array +sub sendcommand { + my ($self, %command, $want) = @_; + + if (!defined($want)) { + $want = 0; + } + + my $conn = $self->connfd || return; + my $cstring = $self->astman_h2s(%command); + + $conn->send("$cstring$EOL"); + + if ($want == 1) { + my $response = $self->read_response($conn); + return $response; + } + + my @resp = $self->read_response($conn); + + if ($want == 2) { + return @resp; + } else { + return map { split(': ', $_) } @resp; + } +} + +sub setcallback { + my ($self, $event, $function) = @_; + + if (defined($function) && ref($function) eq 'CODE') { + $self->{_EVENTCB}{$event} = $function; + } +} + +sub eventcallback { + my ($self, %resp) = @_; + + my $callback; + my $event = $resp{Event}; + + return if (!$event); + + if (defined($self->{_EVENTCB}{$event})) { + $callback = $self->{_EVENTCB}{$event}; + } elsif (defined($self->{_EVENTCB}{DEFAULT})) { + $callback = $self->{_EVENTCB}{DEFAULT}; + } else { + return; + } + + return &{$callback}(%resp); +} + +sub eventloop { + my ($self) = @_; + + while (1) { + $self->handleevent; + } +} + +sub handleevent { + my ($self) = @_; + + my %resp = map { split(': ', $_); } $self->read_response; + $self->eventcallback(%resp); + + return %resp; +} + +sub action { + my ($self, $command, $wanthash) = @_; + + return if (!$command); + + my $conn = $self->connfd || return; + + print $conn "Action: $command" . $BLANK; + my @resp = $self->read_response($conn); + + if ($wanthash) { + return map { split(': ', $_) } @resp; + } elsif (wantarray) { + return @resp; + } else { + return $resp[0]; + } +} + +sub command { + my ($self, $command) = @_; + + return if (!$command); + + return $self->sendcommand('Action' => 'Command', + 'Command' => $command, 1 ); +} + +sub monitor { + my ($self, $channel, $file) = @_; + + return if (!$channel); + + return $self->sendcommand('Action' => 'Monitor', + 'Channel' => $channel, + 'File' => $file, 1 ); +} + +sub changemonitor { + my ($self, $channel, $file) = @_; + + return if (!$channel); + + return $self->sendcommand('Action' => 'ChangeMonitor', + 'Channel' => $channel, + 'File' => $file, 1 ); +} + +sub stopmonitor { + my ($self, $channel, $file) = @_; + + return if (!$channel); + + return $self->sendcommand('Action' => 'StopMonitor', + 'Channel' => $channel, + 'File' => $file, 1 ); +} + + +sub disconnect { + my ($self) = @_; + + my $conn = $self->connfd; + + my %resp = $self->sendcommand('Action' => 'Logoff'); + + + if ($resp{Response} eq 'Goodbye') { + $self->{_CONNFD} = undef; + $self->connected(0); + return 1; + } + + return 0; +} + +1; diff --git a/agc_2-X/branches/agc_2.0.4/extras/Asterisk/Outgoing.pm b/agc_2-X/branches/agc_2.0.4/extras/Asterisk/Outgoing.pm new file mode 100644 index 00000000..6e128332 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/extras/Asterisk/Outgoing.pm @@ -0,0 +1,110 @@ +package Asterisk::Outgoing; + +=head1 NAME + +Asterisk::Outgoing - Create outgoing call queue file + +=head1 SYNOPSIS + +use Asterisk::Outgoing; + +my $out = new Asterisk::Outgoing; + +$out->setvariable('Channel', 'Zap/1/'); + +$out->setvariable('MaxRetries', 0); + +$out->setvariable('RetryTime', 60); + +$out->setvariable('WaitTime', 60); + +$out->setvariable('Application', 'Playback'); + +$out->setvariable('Data', 'beep'); + +$out->create_outgoing; + +=cut + +require 5.004; + +use Fcntl ':flock'; +use Asterisk; +@ISA = ('Asterisk'); + +$VERSION = '0.01'; + +sub new { + my ($class, %args) = @_; + my $self = {}; + $self->{OUTDIR} = '/var/spool/asterisk/outgoing'; + $self->{OUTTIME} = undef; + $self->{OUTVARS} = {}; + $self->{ALLOWEDVARS} = [ 'channel', 'maxretries', 'retrytime', 'waittime', 'context', 'extension', 'priority', 'application', 'data', 'callerid' ]; + bless $self, ref $class || $class; + return $self; +} + +sub outdir { + my ($self, $dir) = @_; + + if (defined($dir)) { + $self->{OUTDIR} = $dir; + } + + return $self->{OUTDIR}; +} + +sub outtime { + my ($self, $time) = @_; + + if (defined($time)) { + $self->{OUTTIME} = $time; + } elsif (!defined($self->{OUTTIME})) { + $self->{OUTTIME} = time(); + } + + return $self->{OUTTIME}; +} + +sub checkvariable { + my ($self, $var) = @_; + + my $ret = 0; + + foreach $allowed (@{$self->{ALLOWEDVARS}}) { + if ($allowed =~ /$var/i) { + $ret = 1; + } + } + return $ret; +} + +sub setvariable { + my ($self, $var, $value) = @_; + + if ($self->checkvariable($var)) { + $self->{OUTVARS}{$var} = $value; + } +} + +sub create_outgoing { + my ($self) = @_; + + my $time = $self->outtime(); + + my $outdir = $self->outdir(); + my $filename = $outdir . '/' . $time . '.outgoing'; + open(OUTFILE, ">$filename") || return 0; + flock(OUTFILE, LOCK_EX); + utime($time, $time, $filename); + foreach my $var (keys %{$self->{OUTVARS}}) { + print OUTFILE "$var: " . $self->{OUTVARS}{$var} . "\n"; + } + flock(OUTFILE, LOCK_UN); + close(OUTFILE); + utime($time, $time, $filename); + return 1; +} + +1; diff --git a/agc_2-X/branches/agc_2.0.4/extras/Asterisk/QCall.pm b/agc_2-X/branches/agc_2.0.4/extras/Asterisk/QCall.pm new file mode 100644 index 00000000..25f75a9c --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/extras/Asterisk/QCall.pm @@ -0,0 +1,61 @@ +package Asterisk::QCall; + +require 5.004; + +use Fcntl ':flock'; +use Asterisk; + +$VERSION = '0.01'; + +sub version { $VERSION; } + +sub new { + my ($class, %args) = @_; + my $self = {}; + $self->{QUEUEDIR} = '/var/spool/asterisk/qcall'; + $self->{QUEUETIME} = undef; + bless $self, ref $class || $class; + return $self; +} + +sub DESTROY { } + +sub queuedir { + my ($self, $dir) = @_; + + if (defined($dir)) { + $self->{QUEUEDIR} = $dir; + } + + return $self->{QUEUEDIR}; +} + +sub queuetime { + my ($self, $time) = @_; + + if (defined($time)) { + $self->{QUEUETIME} = $time; + } elsif (!defined($self->{QUEUETIME})) { + $self->{QUEUETIME} = time(); + } + + return $self->{QUEUETIME}; +} + +sub create_qcall { + my ($self, $dialstring, $callerid, $extension, $maxsecs, $identifier, $response) = @_; + + my $time = $self->queuetime(); + + my $queuedir = $self->queuedir(); + my $filename = $queuedir . '/' . $time . '.queue'; + open(QFILE, ">$filename") || return 0; + flock(QFILE, LOCK_EX); + print QFILE "$dialstring $callerid $extension $maxsecs $identifier $response"; + flock(QFILE, LOCK_UN); + close(QFILE); + my $ret = utime($time, $time, $filename); + return 1; +} + +1; diff --git a/agc_2-X/branches/agc_2.0.4/extras/Asterisk/Voicemail.pm b/agc_2-X/branches/agc_2.0.4/extras/Asterisk/Voicemail.pm new file mode 100644 index 00000000..780cef56 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/extras/Asterisk/Voicemail.pm @@ -0,0 +1,261 @@ +package Asterisk::Voicemail; + +require 5.004; + +=head1 NAME + +Asterisk::Voicemail - Stuff to deal with asterisk voicemail + +=head1 SYNOPSIS + +This is not completed yet + +=head1 DESCRIPTION + +description + +=cut + +use Asterisk; + +@ISA = ( 'Asterisk' ); + +$VERSION = '0.01'; + +$DEBUG = 5; + +sub version { $VERSION; } + +sub new { + my ($class, %args) = @_; + my $self = {}; + bless $self, ref $class || $class; +# while (my ($key,$value) = each %args) { $self->set($key,$value); } + return $self; +} + +sub DESTROY { } + +sub spooldirectory { + my ($self, $directory) = @_; + + if (defined($directory)) { + $self->{'spooldirectory'} = $directory; + } else { + $self->{'spooldirectory'} = '/var/spool/asterisk/vm' if (!defined($self->{'spooldirectory'})); + } + + return $self->{'spooldirectory'}; +} + +sub sounddirectory { + my ($self, $directory) = @_; + + if (defined($directory)) { + $self->{'sounddirectory'} = $directory; + } else { + $self->{'sounddirectory'} = '/var/lib/asterisk/sounds' if (!defined($self->{'sounddirectory'})); + } + + return $self->{'sounddirectory'}; +} + +sub serveremail { + my ($self, $email) = @_; + + $self->{'serveremail'} = $email if (defined($email)); + + return $self->{'serveremail'}; +} + +sub format { + my ($self, @formats) = @_; + + if (@formats) { + $self->{'formats'} = @formats; + } + + return $self->{'formats'}; +} + +sub vmbox { + my ($self, $vmbox, $vmpass, $vmfn, $vmemail) = @_; + + if (defined($vmbox) && (defined($vmpass) || defined($vmfn) || defined($vmemail)) ) { + $self->{'vmbox'}{$vmbox}{'pass'} = $vmpass if (defined($vmpass)); + $self->{'vmbox'}{$vmbox}{'fn'} = $vmfn if (defined($vmfn)); + $self->{'vmbox'}{$vmbox}{'email'} = $vmemail if (defined($vmemail)); + } elsif (defined($vmbox)) { + return ($self->{'vmbox'}{$vmbox}{'pass'}, + $self->{'vmbox'}{$vmbox}{'fn'}, + $self->{'vmbox'}{$vmbox}{'email'} ); + } + +} + +sub getfolders { + my ($self, $vmbox) = @_; + + my @folders = (); + + my $spool = $self->spooldirectory(); + + foreach $file (<$spool/$vmbox/*>) { + if ( -d $file ) { + $file =~ s/$spool\/$vmbox\///; + push(@folders, $file); + } + } + return @folders; +} + +sub configfile { + my ($self, $configfile) = @_; + + if (defined($configfile)) { + $self->{'configfile'} = $configfile; + } else { + $self->{'configfile'} = '/etc/asterisk/voicemail.conf' if (!defined($self->{'configfile'})); + } + + return $self->{'configfile'}; +} + +sub readconfig { + my ($self) = @_; + + my $context = ''; + my $line = ''; + + my $configfile = $self->configfile(); + + open(CF, "<$configfile") || die "Error loading $configfile: $!\n"; + while ($line = ) { + chop($line); + + $line =~ s/;.*$//; + $line =~ s/\s*$//; + + if ($line =~ /^;/) { + next; + } elsif ($line =~ /^\s*$/) { + next; + } elsif ($line =~ /^\[(\w+)\]$/) { + $context = $1; + print STDERR "Context: $context\n" if ($DEBUG>3); + } elsif ($line =~ /^format\s*[=>]+\s*(.*)/) { + my $formats = $1; + $self->format(split(/|/, $formats)); + } elsif ($line =~ /^serveremail\s*[=>]+\s*(.*)/) { + $self->serveremail($1); + } elsif ($line =~ /^(\d+)\s*[=>]+\s*(.*)/) { + my $vmbox = $1; + my $vmstr = $2; + my ($vmpass, $vmfn, $vmemail) = split(/,/, $vmstr); + print STDERR "VM BOX ($vmbox)\n" if ($DEBUG>3); + $self->vmbox($vmbox, $vmpass, $vmfn, $vmstr); + } else { + print STDERR "Unknown line: $line\n" if ($DEBUG); + } + } + + close(CF); +} + +sub appendsoundfile { + my ($self, $source, $dest) = @_; + + open(IN, "<$source") || return 0; + open(OUT, ">>$dest") || return 0; + while () { + print OUT $_; + } + close(IN); + close(OUT); + return 1; +} + +sub validmailbox { + my ($self, $vmbox) = @_; + + return 1 if ($self->vmbox($vmbox)); + return 0; +} + +sub msgcount { + my ($self, $vmbox, $folder) = @_; + + my $count = 0; + + return $count if (!defined($vmbox) || !defined($folder)); + + my $spool = $self->spooldirectory() . '/' . $vmbox . '/' . $folder; + + if (opendir(DIR, $spool)) { + my @msgs = grep(/^msg.*\.txt$/, readdir(DIR)); + $count = $#msgs+1; + closedir(DIR); + } + return $count; +} + +sub msgcountstr { + my ($self, $vmbox, $folder) = @_; + + my $count = $self->msgcount($vmbox, $folder); + + if ($count > 1) { + return "$count messages"; + } elsif ($count > 0) { + return "$count message"; + } else { + return "no messages"; + } +} + +sub createdefaultmailbox { + my ($self, $vmbox) = @_; + + my $spool = $self->spooldirectory(); + my $sounddir = $self->sounddirectory(); + + my $vmdir = "$spool/$vmbox"; + + + if ( -d $vmdir ) { + print STDERR "Directory already exists: $vmdir\n" if ($DEBUG); + } else { + mkdir($vmdir, 0755) || return 0; + mkdir("$vmdir/INBOX", 0755) || return 0; + } + + $self->appendsoundfile("$sounddir/vm-theperson.gsm", "$vmdir/unavail.gsm"); + $self->appendsoundfile("$sounddir/vm-theperson.gsm", "$vmdir/busy.gsm"); + $self->appendsoundfile("$sounddir/vm-extension.gsm", "$vmdir/greet.gsm"); + + foreach $chr (split(//, $vmbox)) { + $self->appendsoundfile("$sounddir/digits/$chr.gsm", "$vmdir/unavail.gsm"); + $self->appendsoundfile("$sounddir/digits/$chr.gsm", "$vmdir/busy.gsm"); + $self->appendsoundfile("$sounddir/digits/$chr.gsm", "$vmdir/greet.gsm"); + } + + $self->appendsoundfile("$sounddir/vm-isunavail.gsm", "$vmdir/unavail.gsm"); + $self->appendsoundfile("$sounddir/vm-isonphone.gsm", "$vmdir/busy.gsm"); + + return 1; +} + +sub messages { + my ($self, $messages, $folder) = @_; + + my $path = $self->spooldirectory() . '/' . $mailbox . '/' . $folder; + if (opendir(DIR, $path)) { + my @msgs = sort grep(/^msg....\.txt$/, readdir(DIR)); + closedir(DIR); + return map { s/^msg(....)\.txt$/$1/; $_ } @msgs; + } + return (); +} + +1; + diff --git a/agc_2-X/branches/agc_2.0.4/extras/Changed_meetme_sounds.txt b/agc_2-X/branches/agc_2.0.4/extras/Changed_meetme_sounds.txt new file mode 100644 index 00000000..579fd731 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/extras/Changed_meetme_sounds.txt @@ -0,0 +1,37 @@ +* Changed Meetme Sounds in Asterisk 2007-07-27 + + +For some reason, possibly effeciency, the enter and leave sounds that you hear in standard Asterisk meetme rooms are actually hex dumps of RAW ULAW 8bit audio that have been compiled into the code of Asterisk in a header file. This makes them somewhat difficult to change, especially since there are no instructions. + +This should slightly reduce time that it takes for calls to get to agents, as well as reduce the time of the locks that occur when these sounds are played in Asterisk. The new enter and leave sounds I include with VICIDIAL are 0.12 and 0.13 seconds respectively as compared to the default sounds which are more than double that. + + +Here are the steps I went to to change the meetme enter and leave sounds: + + +1. grab the source audio file you want and open it in your favorite editor + - In my case I tweaked the audio I used for the app_conference build I made and shrunk them a bit until they were at most, half the length as the Asterisk default sounds they would be replacing + + +2. Save the audio as 8-bit, 8k ULAW audio and save as .raw + + +3. used "hexdump" to dump the audio file into two-character hex chunks + /usr/bin/hexdump -C ./enter.raw + - I'm sure this could be made prettier with the proper formatting strings, but I didn't have time for that + - Here's some of the output: + + 00000000 d6 dc 55 5f 63 67 f0 f0 74 75 d6 ee 5d 73 66 60 |ÖÜU_cgððtuÖî]sf`| + 00000010 dc fd 62 68 5b 5a 57 5e 5b 5c ef fc 4d 51 57 4c |Üýbh[ZW^[\ïüMQWL| + 00000020 5d 66 60 51 6c 5f 3e 4d 59 47 72 e4 52 53 58 48 |]f`Ql_>MYGräRSXH| + + +4. Used favorite text edotor to format the data properly: + - 60 character length lines comma-space separated in the same format as enter.h and leave.h were in. Don't forget the header and footer to this raw hex audio, they are important + + 0xd6, 0xdc, 0x55, 0x5f, 0x63, 0x67, 0xf0, 0xf0, 0x74, 0x75, + 0xd6, 0xee, 0x5d, 0x73, 0x66, 0x60, 0xdc, 0xfd, 0x62, 0x68, + 0x5b, 0x5a, 0x57, 0x5e, 0x5b, 0x5c, 0xef, 0xfc, 0x4d, 0x51, + +5. Copied the new enter.h and leave.h files over the old ones, and compile Asterisk + diff --git a/agc_2-X/branches/agc_2.0.4/extras/GMT_USA_zip.txt b/agc_2-X/branches/agc_2.0.4/extras/GMT_USA_zip.txt new file mode 100644 index 00000000..b7877cd1 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/extras/GMT_USA_zip.txt @@ -0,0 +1,41750 @@ +00501 NY -5.0 Y +00544 NY -5.0 Y +00601 PR -4.0 N +00602 PR -4.0 N +00603 PR -4.0 N +00604 PR -4.0 N +00605 PR -4.0 N +00606 PR -4.0 N +00610 PR -4.0 N +00611 PR -4.0 N +00612 PR -4.0 N +00613 PR -4.0 N +00614 PR -4.0 N +00616 PR -4.0 N +00617 PR -4.0 N +00622 PR -4.0 N +00623 PR -4.0 N +00624 PR -4.0 N +00627 PR -4.0 N +00631 PR -4.0 N +00636 PR -4.0 N +00637 PR -4.0 N +00638 PR -4.0 N +00641 PR -4.0 N +00646 PR -4.0 N +00647 PR -4.0 N +00650 PR -4.0 N +00652 PR -4.0 N +00653 PR -4.0 N +00656 PR -4.0 N +00659 PR -4.0 N +00660 PR -4.0 N +00662 PR -4.0 N +00664 PR -4.0 N +00667 PR -4.0 N +00669 PR -4.0 N +00670 PR -4.0 N +00674 PR -4.0 N +00676 PR -4.0 N +00677 PR -4.0 N +00678 PR -4.0 N +00680 PR -4.0 N +00681 PR -4.0 N +00682 PR -4.0 N +00683 PR -4.0 N +00685 PR -4.0 N +00687 PR -4.0 N +00688 PR -4.0 N +00690 PR -4.0 N +00692 PR -4.0 N +00693 PR -4.0 N +00694 PR -4.0 N +00698 PR -4.0 N +00703 PR -4.0 N +00704 PR -4.0 N +00705 PR -4.0 N +00707 PR -4.0 N +00714 PR -4.0 N +00715 PR -4.0 N +00716 PR -4.0 N +00717 PR -4.0 N +00718 PR -4.0 N +00719 PR -4.0 N +00720 PR -4.0 N +00721 PR -4.0 N +00723 PR -4.0 N +00725 PR -4.0 N +00726 PR -4.0 N +00727 PR -4.0 N +00728 PR -4.0 N +00729 PR -4.0 N +00730 PR -4.0 N +00731 PR -4.0 N +00732 PR -4.0 N +00733 PR -4.0 N +00734 PR -4.0 N +00735 PR -4.0 N +00736 PR -4.0 N +00737 PR -4.0 N +00738 PR -4.0 N +00739 PR -4.0 N +00740 PR -4.0 N +00741 PR -4.0 N +00742 PR -4.0 N +00744 PR -4.0 N +00745 PR -4.0 N +00751 PR -4.0 N +00754 PR -4.0 N +00757 PR -4.0 N +00765 PR -4.0 N +00766 PR -4.0 N +00767 PR -4.0 N +00769 PR -4.0 N +00771 PR -4.0 N +00772 PR -4.0 N +00773 PR -4.0 N +00775 PR -4.0 N +00777 PR -4.0 N +00778 PR -4.0 N +00780 PR -4.0 N +00782 PR -4.0 N +00783 PR -4.0 N +00784 PR -4.0 N +00785 PR -4.0 N +00786 PR -4.0 N +00791 PR -4.0 N +00792 PR -4.0 N +00794 PR -4.0 N +00795 PR -4.0 N +00801 VI -4.0 N +00802 VI -4.0 N +00803 VI -4.0 N +00804 VI -4.0 N +00805 VI -4.0 N +00820 VI -4.0 N +00821 VI -4.0 N +00822 VI -4.0 N +00823 VI -4.0 N +00824 VI -4.0 N +00830 VI -4.0 N +00831 VI -4.0 N +00840 VI -4.0 N +00841 VI -4.0 N +00850 VI -4.0 N +00851 VI -4.0 N +00901 PR -4.0 N +00902 PR -4.0 N +00906 PR -4.0 N +00907 PR -4.0 N +00908 PR -4.0 N +00909 PR -4.0 N +00910 PR -4.0 N +00911 PR -4.0 N +00912 PR -4.0 N +00913 PR -4.0 N +00914 PR -4.0 N +00915 PR -4.0 N +00916 PR -4.0 N +00917 PR -4.0 N +00918 PR -4.0 N +00919 PR -4.0 N +00920 PR -4.0 N +00921 PR -4.0 N +00922 PR -4.0 N +00923 PR -4.0 N +00924 PR -4.0 N +00925 PR -4.0 N +00926 PR -4.0 N +00927 PR -4.0 N +00928 PR -4.0 N +00929 PR -4.0 N +00930 PR -4.0 N +00931 PR -4.0 N +00933 PR -4.0 N +00934 PR -4.0 N +00935 PR -4.0 N +00936 PR -4.0 N +00937 PR -4.0 N +00939 PR -4.0 N +00940 PR -4.0 N +00949 PR -4.0 N +00950 PR -4.0 N +00951 PR -4.0 N +00952 PR -4.0 N +00953 PR -4.0 N +00954 PR -4.0 N +00955 PR -4.0 N +00956 PR -4.0 N +00957 PR -4.0 N +00958 PR -4.0 N +00959 PR -4.0 N +00960 PR -4.0 N +00961 PR -4.0 N +00962 PR -4.0 N +00963 PR -4.0 N +00965 PR -4.0 N +00966 PR -4.0 N +00968 PR -4.0 N +00969 PR -4.0 N +00970 PR -4.0 N +00971 PR -4.0 N +00975 PR -4.0 N +00976 PR -4.0 N +00977 PR -4.0 N +00978 PR -4.0 N +00979 PR -4.0 N +00981 PR -4.0 N +00982 PR -4.0 N +00983 PR -4.0 N +00984 PR -4.0 N +00985 PR -4.0 N +00986 PR -4.0 N +00987 PR -4.0 N +00988 PR -4.0 N +01001 MA -5.0 Y +01002 MA -5.0 Y +01003 MA -5.0 Y +01004 MA -5.0 Y +01005 MA -5.0 Y +01007 MA -5.0 Y +01008 MA -5.0 Y +01009 MA -5.0 Y +01010 MA -5.0 Y +01011 MA -5.0 Y +01012 MA -5.0 Y +01013 MA -5.0 Y +01014 MA -5.0 Y +01020 MA -5.0 Y +01021 MA -5.0 Y +01022 MA -5.0 Y +01026 MA -5.0 Y +01027 MA -5.0 Y +01028 MA -5.0 Y +01029 MA -5.0 Y +01030 MA -5.0 Y +01031 MA -5.0 Y +01032 MA -5.0 Y +01033 MA -5.0 Y +01034 MA -5.0 Y +01035 MA -5.0 Y +01036 MA -5.0 Y +01037 MA -5.0 Y +01038 MA -5.0 Y +01039 MA -5.0 Y +01040 MA -5.0 Y +01041 MA -5.0 Y +01050 MA -5.0 Y +01053 MA -5.0 Y +01054 MA -5.0 Y +01056 MA -5.0 Y +01057 MA -5.0 Y +01059 MA -5.0 Y +01060 MA -5.0 Y +01061 MA -5.0 Y +01062 MA -5.0 Y +01063 MA -5.0 Y +01066 MA -5.0 Y +01068 MA -5.0 Y +01069 MA -5.0 Y +01070 MA -5.0 Y +01071 MA -5.0 Y +01072 MA -5.0 Y +01073 MA -5.0 Y +01074 MA -5.0 Y +01075 MA -5.0 Y +01077 MA -5.0 Y +01079 MA -5.0 Y +01080 MA -5.0 Y +01081 MA -5.0 Y +01082 MA -5.0 Y +01083 MA -5.0 Y +01084 MA -5.0 Y +01085 MA -5.0 Y +01086 MA -5.0 Y +01088 MA -5.0 Y +01089 MA -5.0 Y +01090 MA -5.0 Y +01092 MA -5.0 Y +01093 MA -5.0 Y +01094 MA -5.0 Y +01095 MA -5.0 Y +01096 MA -5.0 Y +01097 MA -5.0 Y +01098 MA -5.0 Y +01101 MA -5.0 Y +01102 MA -5.0 Y +01103 MA -5.0 Y +01104 MA -5.0 Y +01105 MA -5.0 Y +01106 MA -5.0 Y +01107 MA -5.0 Y +01108 MA -5.0 Y +01109 MA -5.0 Y +01111 MA -5.0 Y +01115 MA -5.0 Y +01116 MA -5.0 Y +01118 MA -5.0 Y +01119 MA -5.0 Y +01128 MA -5.0 Y +01129 MA -5.0 Y +01133 MA -5.0 Y +01138 MA -5.0 Y +01139 MA -5.0 Y +01144 MA -5.0 Y +01151 MA -5.0 Y +01152 MA -5.0 Y +01195 MA -5.0 Y +01199 MA -5.0 Y +01201 MA -5.0 Y +01202 MA -5.0 Y +01203 MA -5.0 Y +01220 MA -5.0 Y +01222 MA -5.0 Y +01223 MA -5.0 Y +01224 MA -5.0 Y +01225 MA -5.0 Y +01226 MA -5.0 Y +01227 MA -5.0 Y +01229 MA -5.0 Y +01230 MA -5.0 Y +01235 MA -5.0 Y +01236 MA -5.0 Y +01237 MA -5.0 Y +01238 MA -5.0 Y +01240 MA -5.0 Y +01242 MA -5.0 Y +01243 MA -5.0 Y +01244 MA -5.0 Y +01245 MA -5.0 Y +01247 MA -5.0 Y +01252 MA -5.0 Y +01253 MA -5.0 Y +01254 MA -5.0 Y +01255 MA -5.0 Y +01256 MA -5.0 Y +01257 MA -5.0 Y +01258 MA -5.0 Y +01259 MA -5.0 Y +01260 MA -5.0 Y +01262 MA -5.0 Y +01263 MA -5.0 Y +01264 MA -5.0 Y +01266 MA -5.0 Y +01267 MA -5.0 Y +01270 MA -5.0 Y +01301 MA -5.0 Y +01302 MA -5.0 Y +01330 MA -5.0 Y +01331 MA -5.0 Y +01337 MA -5.0 Y +01338 MA -5.0 Y +01339 MA -5.0 Y +01340 MA -5.0 Y +01341 MA -5.0 Y +01342 MA -5.0 Y +01343 MA -5.0 Y +01344 MA -5.0 Y +01346 MA -5.0 Y +01347 MA -5.0 Y +01349 MA -5.0 Y +01350 MA -5.0 Y +01351 MA -5.0 Y +01354 MA -5.0 Y +01355 MA -5.0 Y +01360 MA -5.0 Y +01364 MA -5.0 Y +01366 MA -5.0 Y +01367 MA -5.0 Y +01368 MA -5.0 Y +01370 MA -5.0 Y +01373 MA -5.0 Y +01375 MA -5.0 Y +01376 MA -5.0 Y +01378 MA -5.0 Y +01379 MA -5.0 Y +01380 MA -5.0 Y +01420 MA -5.0 Y +01430 MA -5.0 Y +01431 MA -5.0 Y +01432 MA -5.0 Y +01434 MA -5.0 Y +01436 MA -5.0 Y +01438 MA -5.0 Y +01440 MA -5.0 Y +01441 MA -5.0 Y +01450 MA -5.0 Y +01451 MA -5.0 Y +01452 MA -5.0 Y +01453 MA -5.0 Y +01460 MA -5.0 Y +01462 MA -5.0 Y +01463 MA -5.0 Y +01464 MA -5.0 Y +01467 MA -5.0 Y +01468 MA -5.0 Y +01469 MA -5.0 Y +01470 MA -5.0 Y +01471 MA -5.0 Y +01472 MA -5.0 Y +01473 MA -5.0 Y +01474 MA -5.0 Y +01475 MA -5.0 Y +01477 MA -5.0 Y +01501 MA -5.0 Y +01503 MA -5.0 Y +01504 MA -5.0 Y +01505 MA -5.0 Y +01506 MA -5.0 Y +01507 MA -5.0 Y +01508 MA -5.0 Y +01509 MA -5.0 Y +01510 MA -5.0 Y +01515 MA -5.0 Y +01516 MA -5.0 Y +01517 MA -5.0 Y +01518 MA -5.0 Y +01519 MA -5.0 Y +01520 MA -5.0 Y +01521 MA -5.0 Y +01522 MA -5.0 Y +01523 MA -5.0 Y +01524 MA -5.0 Y +01525 MA -5.0 Y +01526 MA -5.0 Y +01527 MA -5.0 Y +01529 MA -5.0 Y +01531 MA -5.0 Y +01532 MA -5.0 Y +01534 MA -5.0 Y +01535 MA -5.0 Y +01536 MA -5.0 Y +01537 MA -5.0 Y +01538 MA -5.0 Y +01540 MA -5.0 Y +01541 MA -5.0 Y +01542 MA -5.0 Y +01543 MA -5.0 Y +01545 MA -5.0 Y +01546 MA -5.0 Y +01550 MA -5.0 Y +01560 MA -5.0 Y +01561 MA -5.0 Y +01562 MA -5.0 Y +01564 MA -5.0 Y +01566 MA -5.0 Y +01568 MA -5.0 Y +01569 MA -5.0 Y +01570 MA -5.0 Y +01571 MA -5.0 Y +01580 MA -5.0 Y +01581 MA -5.0 Y +01582 MA -5.0 Y +01583 MA -5.0 Y +01585 MA -5.0 Y +01586 MA -5.0 Y +01588 MA -5.0 Y +01590 MA -5.0 Y +01601 MA -5.0 Y +01602 MA -5.0 Y +01603 MA -5.0 Y +01604 MA -5.0 Y +01605 MA -5.0 Y +01606 MA -5.0 Y +01607 MA -5.0 Y +01608 MA -5.0 Y +01609 MA -5.0 Y +01610 MA -5.0 Y +01611 MA -5.0 Y +01612 MA -5.0 Y +01613 MA -5.0 Y +01614 MA -5.0 Y +01615 MA -5.0 Y +01653 MA -5.0 Y +01654 MA -5.0 Y +01655 MA -5.0 Y +01701 MA -5.0 Y +01702 MA -5.0 Y +01703 MA -5.0 Y +01704 MA -5.0 Y +01705 MA -5.0 Y +01718 MA -5.0 Y +01719 MA -5.0 Y +01720 MA -5.0 Y +01721 MA -5.0 Y +01730 MA -5.0 Y +01731 MA -5.0 Y +01740 MA -5.0 Y +01741 MA -5.0 Y +01742 MA -5.0 Y +01745 MA -5.0 Y +01746 MA -5.0 Y +01747 MA -5.0 Y +01748 MA -5.0 Y +01749 MA -5.0 Y +01752 MA -5.0 Y +01754 MA -5.0 Y +01756 MA -5.0 Y +01757 MA -5.0 Y +01760 MA -5.0 Y +01770 MA -5.0 Y +01772 MA -5.0 Y +01773 MA -5.0 Y +01775 MA -5.0 Y +01776 MA -5.0 Y +01778 MA -5.0 Y +01784 MA -5.0 Y +01801 MA -5.0 Y +01803 MA -5.0 Y +01805 MA -5.0 Y +01806 MA -5.0 Y +01807 MA -5.0 Y +01808 MA -5.0 Y +01810 MA -5.0 Y +01812 MA -5.0 Y +01813 MA -5.0 Y +01815 MA -5.0 Y +01821 MA -5.0 Y +01822 MA -5.0 Y +01824 MA -5.0 Y +01826 MA -5.0 Y +01827 MA -5.0 Y +01830 MA -5.0 Y +01831 MA -5.0 Y +01832 MA -5.0 Y +01833 MA -5.0 Y +01834 MA -5.0 Y +01835 MA -5.0 Y +01840 MA -5.0 Y +01841 MA -5.0 Y +01842 MA -5.0 Y +01843 MA -5.0 Y +01844 MA -5.0 Y +01845 MA -5.0 Y +01850 MA -5.0 Y +01851 MA -5.0 Y +01852 MA -5.0 Y +01853 MA -5.0 Y +01854 MA -5.0 Y +01860 MA -5.0 Y +01862 MA -5.0 Y +01863 MA -5.0 Y +01864 MA -5.0 Y +01865 MA -5.0 Y +01866 MA -5.0 Y +01867 MA -5.0 Y +01876 MA -5.0 Y +01879 MA -5.0 Y +01880 MA -5.0 Y +01885 MA -5.0 Y +01886 MA -5.0 Y +01887 MA -5.0 Y +01888 MA -5.0 Y +01889 MA -5.0 Y +01890 MA -5.0 Y +01899 MA -5.0 Y +01901 MA -5.0 Y +01902 MA -5.0 Y +01903 MA -5.0 Y +01904 MA -5.0 Y +01905 MA -5.0 Y +01906 MA -5.0 Y +01907 MA -5.0 Y +01908 MA -5.0 Y +01910 MA -5.0 Y +01913 MA -5.0 Y +01915 MA -5.0 Y +01921 MA -5.0 Y +01922 MA -5.0 Y +01923 MA -5.0 Y +01929 MA -5.0 Y +01930 MA -5.0 Y +01931 MA -5.0 Y +01936 MA -5.0 Y +01937 MA -5.0 Y +01938 MA -5.0 Y +01940 MA -5.0 Y +01944 MA -5.0 Y +01945 MA -5.0 Y +01949 MA -5.0 Y +01950 MA -5.0 Y +01951 MA -5.0 Y +01952 MA -5.0 Y +01960 MA -5.0 Y +01961 MA -5.0 Y +01965 MA -5.0 Y +01966 MA -5.0 Y +01969 MA -5.0 Y +01970 MA -5.0 Y +01971 MA -5.0 Y +01982 MA -5.0 Y +01983 MA -5.0 Y +01984 MA -5.0 Y +01985 MA -5.0 Y +02018 MA -5.0 Y +02019 MA -5.0 Y +02020 MA -5.0 Y +02021 MA -5.0 Y +02025 MA -5.0 Y +02026 MA -5.0 Y +02027 MA -5.0 Y +02030 MA -5.0 Y +02031 MA -5.0 Y +02032 MA -5.0 Y +02035 MA -5.0 Y +02038 MA -5.0 Y +02040 MA -5.0 Y +02041 MA -5.0 Y +02043 MA -5.0 Y +02044 MA -5.0 Y +02045 MA -5.0 Y +02047 MA -5.0 Y +02048 MA -5.0 Y +02050 MA -5.0 Y +02051 MA -5.0 Y +02052 MA -5.0 Y +02053 MA -5.0 Y +02054 MA -5.0 Y +02055 MA -5.0 Y +02056 MA -5.0 Y +02059 MA -5.0 Y +02060 MA -5.0 Y +02061 MA -5.0 Y +02062 MA -5.0 Y +02065 MA -5.0 Y +02066 MA -5.0 Y +02067 MA -5.0 Y +02070 MA -5.0 Y +02071 MA -5.0 Y +02072 MA -5.0 Y +02081 MA -5.0 Y +02090 MA -5.0 Y +02093 MA -5.0 Y +02108 MA -5.0 Y +02109 MA -5.0 Y +02110 MA -5.0 Y +02111 MA -5.0 Y +02112 MA -5.0 Y +02113 MA -5.0 Y +02114 MA -5.0 Y +02115 MA -5.0 Y +02116 MA -5.0 Y +02117 MA -5.0 Y +02118 MA -5.0 Y +02119 MA -5.0 Y +02120 MA -5.0 Y +02121 MA -5.0 Y +02122 MA -5.0 Y +02123 MA -5.0 Y +02124 MA -5.0 Y +02125 MA -5.0 Y +02126 MA -5.0 Y +02127 MA -5.0 Y +02128 MA -5.0 Y +02129 MA -5.0 Y +02130 MA -5.0 Y +02131 MA -5.0 Y +02132 MA -5.0 Y +02133 MA -5.0 Y +02134 MA -5.0 Y +02135 MA -5.0 Y +02136 MA -5.0 Y +02137 MA -5.0 Y +02138 MA -5.0 Y +02139 MA -5.0 Y +02140 MA -5.0 Y +02141 MA -5.0 Y +02142 MA -5.0 Y +02143 MA -5.0 Y +02144 MA -5.0 Y +02145 MA -5.0 Y +02148 MA -5.0 Y +02149 MA -5.0 Y +02150 MA -5.0 Y +02151 MA -5.0 Y +02152 MA -5.0 Y +02153 MA -5.0 Y +02155 MA -5.0 Y +02156 MA -5.0 Y +02163 MA -5.0 Y +02169 MA -5.0 Y +02170 MA -5.0 Y +02171 MA -5.0 Y +02176 MA -5.0 Y +02180 MA -5.0 Y +02184 MA -5.0 Y +02185 MA -5.0 Y +02186 MA -5.0 Y +02187 MA -5.0 Y +02188 MA -5.0 Y +02189 MA -5.0 Y +02190 MA -5.0 Y +02191 MA -5.0 Y +02196 MA -5.0 Y +02199 MA -5.0 Y +02201 MA -5.0 Y +02203 MA -5.0 Y +02204 MA -5.0 Y +02205 MA -5.0 Y +02206 MA -5.0 Y +02207 MA -5.0 Y +02210 MA -5.0 Y +02211 MA -5.0 Y +02212 MA -5.0 Y +02215 MA -5.0 Y +02216 MA -5.0 Y +02217 MA -5.0 Y +02222 MA -5.0 Y +02228 MA -5.0 Y +02238 MA -5.0 Y +02239 MA -5.0 Y +02241 MA -5.0 Y +02266 MA -5.0 Y +02269 MA -5.0 Y +02283 MA -5.0 Y +02284 MA -5.0 Y +02293 MA -5.0 Y +02295 MA -5.0 Y +02297 MA -5.0 Y +02298 MA -5.0 Y +02301 MA -5.0 Y +02302 MA -5.0 Y +02303 MA -5.0 Y +02304 MA -5.0 Y +02305 MA -5.0 Y +02322 MA -5.0 Y +02324 MA -5.0 Y +02325 MA -5.0 Y +02327 MA -5.0 Y +02330 MA -5.0 Y +02331 MA -5.0 Y +02332 MA -5.0 Y +02333 MA -5.0 Y +02334 MA -5.0 Y +02337 MA -5.0 Y +02338 MA -5.0 Y +02339 MA -5.0 Y +02340 MA -5.0 Y +02341 MA -5.0 Y +02343 MA -5.0 Y +02344 MA -5.0 Y +02345 MA -5.0 Y +02346 MA -5.0 Y +02347 MA -5.0 Y +02348 MA -5.0 Y +02349 MA -5.0 Y +02350 MA -5.0 Y +02351 MA -5.0 Y +02355 MA -5.0 Y +02356 MA -5.0 Y +02357 MA -5.0 Y +02358 MA -5.0 Y +02359 MA -5.0 Y +02360 MA -5.0 Y +02361 MA -5.0 Y +02362 MA -5.0 Y +02364 MA -5.0 Y +02366 MA -5.0 Y +02367 MA -5.0 Y +02368 MA -5.0 Y +02370 MA -5.0 Y +02375 MA -5.0 Y +02379 MA -5.0 Y +02381 MA -5.0 Y +02382 MA -5.0 Y +02420 MA -5.0 Y +02421 MA -5.0 Y +02445 MA -5.0 Y +02446 MA -5.0 Y +02447 MA -5.0 Y +02451 MA -5.0 Y +02452 MA -5.0 Y +02453 MA -5.0 Y +02454 MA -5.0 Y +02455 MA -5.0 Y +02456 MA -5.0 Y +02457 MA -5.0 Y +02458 MA -5.0 Y +02459 MA -5.0 Y +02460 MA -5.0 Y +02461 MA -5.0 Y +02462 MA -5.0 Y +02464 MA -5.0 Y +02465 MA -5.0 Y +02466 MA -5.0 Y +02467 MA -5.0 Y +02468 MA -5.0 Y +02471 MA -5.0 Y +02472 MA -5.0 Y +02474 MA -5.0 Y +02475 MA -5.0 Y +02476 MA -5.0 Y +02477 MA -5.0 Y +02478 MA -5.0 Y +02479 MA -5.0 Y +02481 MA -5.0 Y +02482 MA -5.0 Y +02492 MA -5.0 Y +02493 MA -5.0 Y +02494 MA -5.0 Y +02495 MA -5.0 Y +02532 MA -5.0 Y +02534 MA -5.0 Y +02535 MA -5.0 Y +02536 MA -5.0 Y +02537 MA -5.0 Y +02538 MA -5.0 Y +02539 MA -5.0 Y +02540 MA -5.0 Y +02541 MA -5.0 Y +02542 MA -5.0 Y +02543 MA -5.0 Y +02552 MA -5.0 Y +02553 MA -5.0 Y +02554 MA -5.0 Y +02556 MA -5.0 Y +02557 MA -5.0 Y +02558 MA -5.0 Y +02559 MA -5.0 Y +02561 MA -5.0 Y +02562 MA -5.0 Y +02563 MA -5.0 Y +02564 MA -5.0 Y +02565 MA -5.0 Y +02568 MA -5.0 Y +02571 MA -5.0 Y +02573 MA -5.0 Y +02574 MA -5.0 Y +02575 MA -5.0 Y +02576 MA -5.0 Y +02584 MA -5.0 Y +02601 MA -5.0 Y +02630 MA -5.0 Y +02631 MA -5.0 Y +02632 MA -5.0 Y +02633 MA -5.0 Y +02634 MA -5.0 Y +02635 MA -5.0 Y +02636 MA -5.0 Y +02637 MA -5.0 Y +02638 MA -5.0 Y +02639 MA -5.0 Y +02641 MA -5.0 Y +02642 MA -5.0 Y +02643 MA -5.0 Y +02644 MA -5.0 Y +02645 MA -5.0 Y +02646 MA -5.0 Y +02647 MA -5.0 Y +02648 MA -5.0 Y +02649 MA -5.0 Y +02650 MA -5.0 Y +02651 MA -5.0 Y +02652 MA -5.0 Y +02653 MA -5.0 Y +02655 MA -5.0 Y +02657 MA -5.0 Y +02659 MA -5.0 Y +02660 MA -5.0 Y +02661 MA -5.0 Y +02662 MA -5.0 Y +02663 MA -5.0 Y +02664 MA -5.0 Y +02666 MA -5.0 Y +02667 MA -5.0 Y +02668 MA -5.0 Y +02669 MA -5.0 Y +02670 MA -5.0 Y +02671 MA -5.0 Y +02672 MA -5.0 Y +02673 MA -5.0 Y +02675 MA -5.0 Y +02702 MA -5.0 Y +02703 MA -5.0 Y +02712 MA -5.0 Y +02713 MA -5.0 Y +02714 MA -5.0 Y +02715 MA -5.0 Y +02717 MA -5.0 Y +02718 MA -5.0 Y +02719 MA -5.0 Y +02720 MA -5.0 Y +02721 MA -5.0 Y +02722 MA -5.0 Y +02723 MA -5.0 Y +02724 MA -5.0 Y +02725 MA -5.0 Y +02726 MA -5.0 Y +02738 MA -5.0 Y +02739 MA -5.0 Y +02740 MA -5.0 Y +02741 MA -5.0 Y +02742 MA -5.0 Y +02743 MA -5.0 Y +02744 MA -5.0 Y +02745 MA -5.0 Y +02746 MA -5.0 Y +02747 MA -5.0 Y +02748 MA -5.0 Y +02760 MA -5.0 Y +02761 MA -5.0 Y +02762 MA -5.0 Y +02763 MA -5.0 Y +02764 MA -5.0 Y +02766 MA -5.0 Y +02767 MA -5.0 Y +02768 MA -5.0 Y +02769 MA -5.0 Y +02770 MA -5.0 Y +02771 MA -5.0 Y +02777 MA -5.0 Y +02779 MA -5.0 Y +02780 MA -5.0 Y +02783 MA -5.0 Y +02790 MA -5.0 Y +02791 MA -5.0 Y +02801 RI -5.0 Y +02802 RI -5.0 Y +02804 RI -5.0 Y +02806 RI -5.0 Y +02807 RI -5.0 Y +02808 RI -5.0 Y +02809 RI -5.0 Y +02812 RI -5.0 Y +02813 RI -5.0 Y +02814 RI -5.0 Y +02815 RI -5.0 Y +02816 RI -5.0 Y +02817 RI -5.0 Y +02818 RI -5.0 Y +02822 RI -5.0 Y +02823 RI -5.0 Y +02824 RI -5.0 Y +02825 RI -5.0 Y +02826 RI -5.0 Y +02827 RI -5.0 Y +02828 RI -5.0 Y +02829 RI -5.0 Y +02830 RI -5.0 Y +02831 RI -5.0 Y +02832 RI -5.0 Y +02833 RI -5.0 Y +02835 RI -5.0 Y +02836 RI -5.0 Y +02837 RI -5.0 Y +02838 RI -5.0 Y +02839 RI -5.0 Y +02840 RI -5.0 Y +02841 RI -5.0 Y +02842 RI -5.0 Y +02852 RI -5.0 Y +02854 RI -5.0 Y +02857 RI -5.0 Y +02858 RI -5.0 Y +02859 RI -5.0 Y +02860 RI -5.0 Y +02861 RI -5.0 Y +02862 RI -5.0 Y +02863 RI -5.0 Y +02864 RI -5.0 Y +02865 RI -5.0 Y +02871 RI -5.0 Y +02872 RI -5.0 Y +02873 RI -5.0 Y +02874 RI -5.0 Y +02875 RI -5.0 Y +02876 RI -5.0 Y +02877 RI -5.0 Y +02878 RI -5.0 Y +02879 RI -5.0 Y +02880 RI -5.0 Y +02881 RI -5.0 Y +02882 RI -5.0 Y +02883 RI -5.0 Y +02885 RI -5.0 Y +02886 RI -5.0 Y +02887 RI -5.0 Y +02888 RI -5.0 Y +02889 RI -5.0 Y +02891 RI -5.0 Y +02892 RI -5.0 Y +02893 RI -5.0 Y +02894 RI -5.0 Y +02895 RI -5.0 Y +02896 RI -5.0 Y +02898 RI -5.0 Y +02901 RI -5.0 Y +02902 RI -5.0 Y +02903 RI -5.0 Y +02904 RI -5.0 Y +02905 RI -5.0 Y +02906 RI -5.0 Y +02907 RI -5.0 Y +02908 RI -5.0 Y +02909 RI -5.0 Y +02910 RI -5.0 Y +02911 RI -5.0 Y +02912 RI -5.0 Y +02914 RI -5.0 Y +02915 RI -5.0 Y +02916 RI -5.0 Y +02917 RI -5.0 Y +02918 RI -5.0 Y +02919 RI -5.0 Y +02920 RI -5.0 Y +02921 RI -5.0 Y +02940 RI -5.0 Y +03031 NH -5.0 Y +03032 NH -5.0 Y +03033 NH -5.0 Y +03034 NH -5.0 Y +03036 NH -5.0 Y +03037 NH -5.0 Y +03038 NH -5.0 Y +03040 NH -5.0 Y +03041 NH -5.0 Y +03042 NH -5.0 Y +03043 NH -5.0 Y +03044 NH -5.0 Y +03045 NH -5.0 Y +03046 NH -5.0 Y +03047 NH -5.0 Y +03048 NH -5.0 Y +03049 NH -5.0 Y +03051 NH -5.0 Y +03052 NH -5.0 Y +03053 NH -5.0 Y +03054 NH -5.0 Y +03055 NH -5.0 Y +03057 NH -5.0 Y +03060 NH -5.0 Y +03061 NH -5.0 Y +03062 NH -5.0 Y +03063 NH -5.0 Y +03064 NH -5.0 Y +03070 NH -5.0 Y +03071 NH -5.0 Y +03073 NH -5.0 Y +03076 NH -5.0 Y +03077 NH -5.0 Y +03079 NH -5.0 Y +03082 NH -5.0 Y +03084 NH -5.0 Y +03086 NH -5.0 Y +03087 NH -5.0 Y +03101 NH -5.0 Y +03102 NH -5.0 Y +03103 NH -5.0 Y +03104 NH -5.0 Y +03105 NH -5.0 Y +03106 NH -5.0 Y +03107 NH -5.0 Y +03108 NH -5.0 Y +03109 NH -5.0 Y +03110 NH -5.0 Y +03111 NH -5.0 Y +03215 NH -5.0 Y +03216 NH -5.0 Y +03217 NH -5.0 Y +03218 NH -5.0 Y +03220 NH -5.0 Y +03221 NH -5.0 Y +03222 NH -5.0 Y +03223 NH -5.0 Y +03224 NH -5.0 Y +03225 NH -5.0 Y +03226 NH -5.0 Y +03227 NH -5.0 Y +03229 NH -5.0 Y +03230 NH -5.0 Y +03231 NH -5.0 Y +03233 NH -5.0 Y +03234 NH -5.0 Y +03235 NH -5.0 Y +03237 NH -5.0 Y +03238 NH -5.0 Y +03240 NH -5.0 Y +03241 NH -5.0 Y +03242 NH -5.0 Y +03243 NH -5.0 Y +03244 NH -5.0 Y +03245 NH -5.0 Y +03246 NH -5.0 Y +03247 NH -5.0 Y +03249 NH -5.0 Y +03251 NH -5.0 Y +03252 NH -5.0 Y +03253 NH -5.0 Y +03254 NH -5.0 Y +03255 NH -5.0 Y +03256 NH -5.0 Y +03257 NH -5.0 Y +03258 NH -5.0 Y +03259 NH -5.0 Y +03260 NH -5.0 Y +03261 NH -5.0 Y +03262 NH -5.0 Y +03263 NH -5.0 Y +03264 NH -5.0 Y +03266 NH -5.0 Y +03268 NH -5.0 Y +03269 NH -5.0 Y +03272 NH -5.0 Y +03273 NH -5.0 Y +03274 NH -5.0 Y +03275 NH -5.0 Y +03276 NH -5.0 Y +03278 NH -5.0 Y +03279 NH -5.0 Y +03280 NH -5.0 Y +03281 NH -5.0 Y +03282 NH -5.0 Y +03284 NH -5.0 Y +03287 NH -5.0 Y +03289 NH -5.0 Y +03290 NH -5.0 Y +03291 NH -5.0 Y +03293 NH -5.0 Y +03298 NH -5.0 Y +03299 NH -5.0 Y +03301 NH -5.0 Y +03302 NH -5.0 Y +03303 NH -5.0 Y +03304 NH -5.0 Y +03305 NH -5.0 Y +03307 NH -5.0 Y +03431 NH -5.0 Y +03435 NH -5.0 Y +03440 NH -5.0 Y +03441 NH -5.0 Y +03442 NH -5.0 Y +03443 NH -5.0 Y +03444 NH -5.0 Y +03445 NH -5.0 Y +03446 NH -5.0 Y +03447 NH -5.0 Y +03448 NH -5.0 Y +03449 NH -5.0 Y +03450 NH -5.0 Y +03451 NH -5.0 Y +03452 NH -5.0 Y +03455 NH -5.0 Y +03456 NH -5.0 Y +03457 NH -5.0 Y +03458 NH -5.0 Y +03461 NH -5.0 Y +03462 NH -5.0 Y +03464 NH -5.0 Y +03465 NH -5.0 Y +03466 NH -5.0 Y +03467 NH -5.0 Y +03468 NH -5.0 Y +03469 NH -5.0 Y +03470 NH -5.0 Y +03561 NH -5.0 Y +03570 NH -5.0 Y +03574 NH -5.0 Y +03575 NH -5.0 Y +03576 NH -5.0 Y +03579 NH -5.0 Y +03580 NH -5.0 Y +03581 NH -5.0 Y +03582 NH -5.0 Y +03583 NH -5.0 Y +03584 NH -5.0 Y +03585 NH -5.0 Y +03586 NH -5.0 Y +03588 NH -5.0 Y +03589 NH -5.0 Y +03590 NH -5.0 Y +03592 NH -5.0 Y +03593 NH -5.0 Y +03595 NH -5.0 Y +03597 NH -5.0 Y +03598 NH -5.0 Y +03601 NH -5.0 Y +03602 NH -5.0 Y +03603 NH -5.0 Y +03604 NH -5.0 Y +03605 NH -5.0 Y +03607 NH -5.0 Y +03608 NH -5.0 Y +03609 NH -5.0 Y +03740 NH -5.0 Y +03741 NH -5.0 Y +03743 NH -5.0 Y +03745 NH -5.0 Y +03746 NH -5.0 Y +03748 NH -5.0 Y +03749 NH -5.0 Y +03750 NH -5.0 Y +03751 NH -5.0 Y +03752 NH -5.0 Y +03753 NH -5.0 Y +03754 NH -5.0 Y +03755 NH -5.0 Y +03756 NH -5.0 Y +03765 NH -5.0 Y +03766 NH -5.0 Y +03768 NH -5.0 Y +03769 NH -5.0 Y +03770 NH -5.0 Y +03771 NH -5.0 Y +03773 NH -5.0 Y +03774 NH -5.0 Y +03777 NH -5.0 Y +03779 NH -5.0 Y +03780 NH -5.0 Y +03781 NH -5.0 Y +03782 NH -5.0 Y +03784 NH -5.0 Y +03785 NH -5.0 Y +03801 NH -5.0 Y +03802 NH -5.0 Y +03803 NH -5.0 Y +03804 NH -5.0 Y +03805 NH -5.0 Y +03809 NH -5.0 Y +03810 NH -5.0 Y +03811 NH -5.0 Y +03812 NH -5.0 Y +03813 NH -5.0 Y +03814 NH -5.0 Y +03815 NH -5.0 Y +03816 NH -5.0 Y +03817 NH -5.0 Y +03818 NH -5.0 Y +03819 NH -5.0 Y +03820 NH -5.0 Y +03821 NH -5.0 Y +03822 NH -5.0 Y +03823 NH -5.0 Y +03824 NH -5.0 Y +03825 NH -5.0 Y +03826 NH -5.0 Y +03827 NH -5.0 Y +03830 NH -5.0 Y +03832 NH -5.0 Y +03833 NH -5.0 Y +03835 NH -5.0 Y +03836 NH -5.0 Y +03837 NH -5.0 Y +03838 NH -5.0 Y +03839 NH -5.0 Y +03840 NH -5.0 Y +03841 NH -5.0 Y +03842 NH -5.0 Y +03843 NH -5.0 Y +03844 NH -5.0 Y +03845 NH -5.0 Y +03846 NH -5.0 Y +03847 NH -5.0 Y +03848 NH -5.0 Y +03849 NH -5.0 Y +03850 NH -5.0 Y +03851 NH -5.0 Y +03852 NH -5.0 Y +03853 NH -5.0 Y +03854 NH -5.0 Y +03855 NH -5.0 Y +03856 NH -5.0 Y +03857 NH -5.0 Y +03858 NH -5.0 Y +03859 NH -5.0 Y +03860 NH -5.0 Y +03862 NH -5.0 Y +03864 NH -5.0 Y +03865 NH -5.0 Y +03866 NH -5.0 Y +03867 NH -5.0 Y +03868 NH -5.0 Y +03869 NH -5.0 Y +03870 NH -5.0 Y +03871 NH -5.0 Y +03872 NH -5.0 Y +03873 NH -5.0 Y +03874 NH -5.0 Y +03875 NH -5.0 Y +03878 NH -5.0 Y +03882 NH -5.0 Y +03883 NH -5.0 Y +03884 NH -5.0 Y +03885 NH -5.0 Y +03886 NH -5.0 Y +03887 NH -5.0 Y +03890 NH -5.0 Y +03894 NH -5.0 Y +03896 NH -5.0 Y +03897 NH -5.0 Y +03901 ME -5.0 Y +03902 ME -5.0 Y +03903 ME -5.0 Y +03904 ME -5.0 Y +03905 ME -5.0 Y +03906 ME -5.0 Y +03907 ME -5.0 Y +03908 ME -5.0 Y +03909 ME -5.0 Y +03910 ME -5.0 Y +03911 ME -5.0 Y +04001 ME -5.0 Y +04002 ME -5.0 Y +04003 ME -5.0 Y +04004 ME -5.0 Y +04005 ME -5.0 Y +04006 ME -5.0 Y +04007 ME -5.0 Y +04008 ME -5.0 Y +04009 ME -5.0 Y +04010 ME -5.0 Y +04011 ME -5.0 Y +04013 ME -5.0 Y +04014 ME -5.0 Y +04015 ME -5.0 Y +04016 ME -5.0 Y +04017 ME -5.0 Y +04019 ME -5.0 Y +04020 ME -5.0 Y +04021 ME -5.0 Y +04022 ME -5.0 Y +04024 ME -5.0 Y +04027 ME -5.0 Y +04028 ME -5.0 Y +04029 ME -5.0 Y +04030 ME -5.0 Y +04032 ME -5.0 Y +04033 ME -5.0 Y +04034 ME -5.0 Y +04037 ME -5.0 Y +04038 ME -5.0 Y +04039 ME -5.0 Y +04040 ME -5.0 Y +04041 ME -5.0 Y +04042 ME -5.0 Y +04043 ME -5.0 Y +04046 ME -5.0 Y +04047 ME -5.0 Y +04048 ME -5.0 Y +04049 ME -5.0 Y +04050 ME -5.0 Y +04051 ME -5.0 Y +04054 ME -5.0 Y +04055 ME -5.0 Y +04056 ME -5.0 Y +04057 ME -5.0 Y +04061 ME -5.0 Y +04062 ME -5.0 Y +04063 ME -5.0 Y +04064 ME -5.0 Y +04066 ME -5.0 Y +04068 ME -5.0 Y +04069 ME -5.0 Y +04070 ME -5.0 Y +04071 ME -5.0 Y +04072 ME -5.0 Y +04073 ME -5.0 Y +04074 ME -5.0 Y +04075 ME -5.0 Y +04076 ME -5.0 Y +04077 ME -5.0 Y +04078 ME -5.0 Y +04079 ME -5.0 Y +04082 ME -5.0 Y +04083 ME -5.0 Y +04084 ME -5.0 Y +04085 ME -5.0 Y +04086 ME -5.0 Y +04087 ME -5.0 Y +04088 ME -5.0 Y +04090 ME -5.0 Y +04091 ME -5.0 Y +04092 ME -5.0 Y +04093 ME -5.0 Y +04094 ME -5.0 Y +04095 ME -5.0 Y +04096 ME -5.0 Y +04097 ME -5.0 Y +04098 ME -5.0 Y +04101 ME -5.0 Y +04102 ME -5.0 Y +04103 ME -5.0 Y +04104 ME -5.0 Y +04105 ME -5.0 Y +04106 ME -5.0 Y +04107 ME -5.0 Y +04108 ME -5.0 Y +04109 ME -5.0 Y +04110 ME -5.0 Y +04112 ME -5.0 Y +04116 ME -5.0 Y +04122 ME -5.0 Y +04123 ME -5.0 Y +04124 ME -5.0 Y +04210 ME -5.0 Y +04211 ME -5.0 Y +04212 ME -5.0 Y +04216 ME -5.0 Y +04217 ME -5.0 Y +04219 ME -5.0 Y +04220 ME -5.0 Y +04221 ME -5.0 Y +04222 ME -5.0 Y +04223 ME -5.0 Y +04224 ME -5.0 Y +04225 ME -5.0 Y +04226 ME -5.0 Y +04227 ME -5.0 Y +04228 ME -5.0 Y +04230 ME -5.0 Y +04231 ME -5.0 Y +04234 ME -5.0 Y +04236 ME -5.0 Y +04237 ME -5.0 Y +04238 ME -5.0 Y +04239 ME -5.0 Y +04240 ME -5.0 Y +04241 ME -5.0 Y +04243 ME -5.0 Y +04250 ME -5.0 Y +04252 ME -5.0 Y +04253 ME -5.0 Y +04254 ME -5.0 Y +04255 ME -5.0 Y +04256 ME -5.0 Y +04257 ME -5.0 Y +04258 ME -5.0 Y +04259 ME -5.0 Y +04260 ME -5.0 Y +04261 ME -5.0 Y +04262 ME -5.0 Y +04263 ME -5.0 Y +04265 ME -5.0 Y +04266 ME -5.0 Y +04267 ME -5.0 Y +04268 ME -5.0 Y +04270 ME -5.0 Y +04271 ME -5.0 Y +04274 ME -5.0 Y +04275 ME -5.0 Y +04276 ME -5.0 Y +04278 ME -5.0 Y +04280 ME -5.0 Y +04281 ME -5.0 Y +04282 ME -5.0 Y +04284 ME -5.0 Y +04285 ME -5.0 Y +04286 ME -5.0 Y +04287 ME -5.0 Y +04288 ME -5.0 Y +04289 ME -5.0 Y +04290 ME -5.0 Y +04291 ME -5.0 Y +04292 ME -5.0 Y +04294 ME -5.0 Y +04330 ME -5.0 Y +04332 ME -5.0 Y +04333 ME -5.0 Y +04336 ME -5.0 Y +04338 ME -5.0 Y +04341 ME -5.0 Y +04342 ME -5.0 Y +04343 ME -5.0 Y +04344 ME -5.0 Y +04345 ME -5.0 Y +04346 ME -5.0 Y +04347 ME -5.0 Y +04348 ME -5.0 Y +04349 ME -5.0 Y +04350 ME -5.0 Y +04351 ME -5.0 Y +04352 ME -5.0 Y +04353 ME -5.0 Y +04354 ME -5.0 Y +04355 ME -5.0 Y +04357 ME -5.0 Y +04358 ME -5.0 Y +04359 ME -5.0 Y +04360 ME -5.0 Y +04363 ME -5.0 Y +04364 ME -5.0 Y +04401 ME -5.0 Y +04402 ME -5.0 Y +04406 ME -5.0 Y +04408 ME -5.0 Y +04410 ME -5.0 Y +04411 ME -5.0 Y +04412 ME -5.0 Y +04413 ME -5.0 Y +04414 ME -5.0 Y +04415 ME -5.0 Y +04416 ME -5.0 Y +04417 ME -5.0 Y +04418 ME -5.0 Y +04419 ME -5.0 Y +04420 ME -5.0 Y +04421 ME -5.0 Y +04422 ME -5.0 Y +04424 ME -5.0 Y +04426 ME -5.0 Y +04427 ME -5.0 Y +04428 ME -5.0 Y +04429 ME -5.0 Y +04430 ME -5.0 Y +04431 ME -5.0 Y +04434 ME -5.0 Y +04435 ME -5.0 Y +04438 ME -5.0 Y +04441 ME -5.0 Y +04442 ME -5.0 Y +04443 ME -5.0 Y +04444 ME -5.0 Y +04448 ME -5.0 Y +04449 ME -5.0 Y +04450 ME -5.0 Y +04451 ME -5.0 Y +04453 ME -5.0 Y +04454 ME -5.0 Y +04455 ME -5.0 Y +04456 ME -5.0 Y +04457 ME -5.0 Y +04459 ME -5.0 Y +04460 ME -5.0 Y +04461 ME -5.0 Y +04462 ME -5.0 Y +04463 ME -5.0 Y +04464 ME -5.0 Y +04467 ME -5.0 Y +04468 ME -5.0 Y +04469 ME -5.0 Y +04471 ME -5.0 Y +04472 ME -5.0 Y +04473 ME -5.0 Y +04474 ME -5.0 Y +04475 ME -5.0 Y +04476 ME -5.0 Y +04478 ME -5.0 Y +04479 ME -5.0 Y +04481 ME -5.0 Y +04485 ME -5.0 Y +04487 ME -5.0 Y +04488 ME -5.0 Y +04489 ME -5.0 Y +04490 ME -5.0 Y +04491 ME -5.0 Y +04492 ME -5.0 Y +04493 ME -5.0 Y +04495 ME -5.0 Y +04496 ME -5.0 Y +04497 ME -5.0 Y +04530 ME -5.0 Y +04535 ME -5.0 Y +04537 ME -5.0 Y +04538 ME -5.0 Y +04539 ME -5.0 Y +04541 ME -5.0 Y +04543 ME -5.0 Y +04544 ME -5.0 Y +04547 ME -5.0 Y +04548 ME -5.0 Y +04549 ME -5.0 Y +04551 ME -5.0 Y +04553 ME -5.0 Y +04554 ME -5.0 Y +04555 ME -5.0 Y +04556 ME -5.0 Y +04558 ME -5.0 Y +04562 ME -5.0 Y +04563 ME -5.0 Y +04564 ME -5.0 Y +04565 ME -5.0 Y +04568 ME -5.0 Y +04570 ME -5.0 Y +04571 ME -5.0 Y +04572 ME -5.0 Y +04573 ME -5.0 Y +04574 ME -5.0 Y +04575 ME -5.0 Y +04576 ME -5.0 Y +04578 ME -5.0 Y +04579 ME -5.0 Y +04605 ME -5.0 Y +04606 ME -5.0 Y +04607 ME -5.0 Y +04609 ME -5.0 Y +04611 ME -5.0 Y +04612 ME -5.0 Y +04613 ME -5.0 Y +04614 ME -5.0 Y +04616 ME -5.0 Y +04617 ME -5.0 Y +04619 ME -5.0 Y +04622 ME -5.0 Y +04623 ME -5.0 Y +04624 ME -5.0 Y +04625 ME -5.0 Y +04626 ME -5.0 Y +04627 ME -5.0 Y +04628 ME -5.0 Y +04629 ME -5.0 Y +04630 ME -5.0 Y +04631 ME -5.0 Y +04634 ME -5.0 Y +04635 ME -5.0 Y +04637 ME -5.0 Y +04640 ME -5.0 Y +04642 ME -5.0 Y +04643 ME -5.0 Y +04644 ME -5.0 Y +04645 ME -5.0 Y +04646 ME -5.0 Y +04648 ME -5.0 Y +04649 ME -5.0 Y +04650 ME -5.0 Y +04652 ME -5.0 Y +04653 ME -5.0 Y +04654 ME -5.0 Y +04655 ME -5.0 Y +04657 ME -5.0 Y +04658 ME -5.0 Y +04660 ME -5.0 Y +04662 ME -5.0 Y +04664 ME -5.0 Y +04666 ME -5.0 Y +04667 ME -5.0 Y +04668 ME -5.0 Y +04669 ME -5.0 Y +04671 ME -5.0 Y +04672 ME -5.0 Y +04673 ME -5.0 Y +04674 ME -5.0 Y +04675 ME -5.0 Y +04676 ME -5.0 Y +04677 ME -5.0 Y +04679 ME -5.0 Y +04680 ME -5.0 Y +04681 ME -5.0 Y +04683 ME -5.0 Y +04684 ME -5.0 Y +04685 ME -5.0 Y +04686 ME -5.0 Y +04691 ME -5.0 Y +04693 ME -5.0 Y +04694 ME -5.0 Y +04730 ME -5.0 Y +04732 ME -5.0 Y +04733 ME -5.0 Y +04734 ME -5.0 Y +04735 ME -5.0 Y +04736 ME -5.0 Y +04737 ME -5.0 Y +04738 ME -5.0 Y +04739 ME -5.0 Y +04740 ME -5.0 Y +04741 ME -5.0 Y +04742 ME -5.0 Y +04743 ME -5.0 Y +04744 ME -5.0 Y +04745 ME -5.0 Y +04746 ME -5.0 Y +04747 ME -5.0 Y +04750 ME -5.0 Y +04751 ME -5.0 Y +04756 ME -5.0 Y +04757 ME -5.0 Y +04758 ME -5.0 Y +04760 ME -5.0 Y +04761 ME -5.0 Y +04762 ME -5.0 Y +04763 ME -5.0 Y +04764 ME -5.0 Y +04765 ME -5.0 Y +04766 ME -5.0 Y +04768 ME -5.0 Y +04769 ME -5.0 Y +04772 ME -5.0 Y +04773 ME -5.0 Y +04774 ME -5.0 Y +04775 ME -5.0 Y +04776 ME -5.0 Y +04777 ME -5.0 Y +04779 ME -5.0 Y +04780 ME -5.0 Y +04781 ME -5.0 Y +04783 ME -5.0 Y +04785 ME -5.0 Y +04786 ME -5.0 Y +04787 ME -5.0 Y +04841 ME -5.0 Y +04843 ME -5.0 Y +04846 ME -5.0 Y +04847 ME -5.0 Y +04848 ME -5.0 Y +04849 ME -5.0 Y +04850 ME -5.0 Y +04851 ME -5.0 Y +04852 ME -5.0 Y +04853 ME -5.0 Y +04854 ME -5.0 Y +04855 ME -5.0 Y +04856 ME -5.0 Y +04858 ME -5.0 Y +04859 ME -5.0 Y +04860 ME -5.0 Y +04861 ME -5.0 Y +04862 ME -5.0 Y +04863 ME -5.0 Y +04864 ME -5.0 Y +04865 ME -5.0 Y +04901 ME -5.0 Y +04903 ME -5.0 Y +04910 ME -5.0 Y +04911 ME -5.0 Y +04912 ME -5.0 Y +04915 ME -5.0 Y +04917 ME -5.0 Y +04918 ME -5.0 Y +04920 ME -5.0 Y +04921 ME -5.0 Y +04922 ME -5.0 Y +04923 ME -5.0 Y +04924 ME -5.0 Y +04925 ME -5.0 Y +04926 ME -5.0 Y +04927 ME -5.0 Y +04928 ME -5.0 Y +04929 ME -5.0 Y +04930 ME -5.0 Y +04932 ME -5.0 Y +04933 ME -5.0 Y +04935 ME -5.0 Y +04936 ME -5.0 Y +04937 ME -5.0 Y +04938 ME -5.0 Y +04939 ME -5.0 Y +04940 ME -5.0 Y +04941 ME -5.0 Y +04942 ME -5.0 Y +04943 ME -5.0 Y +04944 ME -5.0 Y +04945 ME -5.0 Y +04947 ME -5.0 Y +04949 ME -5.0 Y +04950 ME -5.0 Y +04951 ME -5.0 Y +04952 ME -5.0 Y +04953 ME -5.0 Y +04954 ME -5.0 Y +04955 ME -5.0 Y +04956 ME -5.0 Y +04957 ME -5.0 Y +04958 ME -5.0 Y +04961 ME -5.0 Y +04962 ME -5.0 Y +04963 ME -5.0 Y +04964 ME -5.0 Y +04965 ME -5.0 Y +04966 ME -5.0 Y +04967 ME -5.0 Y +04969 ME -5.0 Y +04970 ME -5.0 Y +04971 ME -5.0 Y +04972 ME -5.0 Y +04973 ME -5.0 Y +04974 ME -5.0 Y +04975 ME -5.0 Y +04976 ME -5.0 Y +04978 ME -5.0 Y +04979 ME -5.0 Y +04981 ME -5.0 Y +04982 ME -5.0 Y +04983 ME -5.0 Y +04984 ME -5.0 Y +04985 ME -5.0 Y +04986 ME -5.0 Y +04987 ME -5.0 Y +04988 ME -5.0 Y +04989 ME -5.0 Y +04992 ME -5.0 Y +05001 VT -5.0 Y +05009 VT -5.0 Y +05030 VT -5.0 Y +05031 VT -5.0 Y +05032 VT -5.0 Y +05033 VT -5.0 Y +05034 VT -5.0 Y +05035 VT -5.0 Y +05036 VT -5.0 Y +05037 VT -5.0 Y +05038 VT -5.0 Y +05039 VT -5.0 Y +05040 VT -5.0 Y +05041 VT -5.0 Y +05042 VT -5.0 Y +05043 VT -5.0 Y +05045 VT -5.0 Y +05046 VT -5.0 Y +05047 VT -5.0 Y +05048 VT -5.0 Y +05049 VT -5.0 Y +05050 VT -5.0 Y +05051 VT -5.0 Y +05052 VT -5.0 Y +05053 VT -5.0 Y +05054 VT -5.0 Y +05055 VT -5.0 Y +05056 VT -5.0 Y +05058 VT -5.0 Y +05059 VT -5.0 Y +05060 VT -5.0 Y +05061 VT -5.0 Y +05062 VT -5.0 Y +05065 VT -5.0 Y +05067 VT -5.0 Y +05068 VT -5.0 Y +05069 VT -5.0 Y +05070 VT -5.0 Y +05071 VT -5.0 Y +05072 VT -5.0 Y +05073 VT -5.0 Y +05074 VT -5.0 Y +05075 VT -5.0 Y +05076 VT -5.0 Y +05077 VT -5.0 Y +05079 VT -5.0 Y +05081 VT -5.0 Y +05083 VT -5.0 Y +05084 VT -5.0 Y +05085 VT -5.0 Y +05086 VT -5.0 Y +05088 VT -5.0 Y +05089 VT -5.0 Y +05091 VT -5.0 Y +05101 VT -5.0 Y +05141 VT -5.0 Y +05142 VT -5.0 Y +05143 VT -5.0 Y +05144 VT -5.0 Y +05146 VT -5.0 Y +05148 VT -5.0 Y +05149 VT -5.0 Y +05150 VT -5.0 Y +05151 VT -5.0 Y +05152 VT -5.0 Y +05153 VT -5.0 Y +05154 VT -5.0 Y +05155 VT -5.0 Y +05156 VT -5.0 Y +05158 VT -5.0 Y +05159 VT -5.0 Y +05161 VT -5.0 Y +05201 VT -5.0 Y +05250 VT -5.0 Y +05251 VT -5.0 Y +05252 VT -5.0 Y +05253 VT -5.0 Y +05254 VT -5.0 Y +05255 VT -5.0 Y +05257 VT -5.0 Y +05260 VT -5.0 Y +05261 VT -5.0 Y +05262 VT -5.0 Y +05301 VT -5.0 Y +05302 VT -5.0 Y +05303 VT -5.0 Y +05304 VT -5.0 Y +05340 VT -5.0 Y +05341 VT -5.0 Y +05342 VT -5.0 Y +05343 VT -5.0 Y +05344 VT -5.0 Y +05345 VT -5.0 Y +05346 VT -5.0 Y +05350 VT -5.0 Y +05351 VT -5.0 Y +05352 VT -5.0 Y +05353 VT -5.0 Y +05354 VT -5.0 Y +05355 VT -5.0 Y +05356 VT -5.0 Y +05357 VT -5.0 Y +05358 VT -5.0 Y +05359 VT -5.0 Y +05360 VT -5.0 Y +05361 VT -5.0 Y +05362 VT -5.0 Y +05363 VT -5.0 Y +05401 VT -5.0 Y +05402 VT -5.0 Y +05403 VT -5.0 Y +05404 VT -5.0 Y +05405 VT -5.0 Y +05406 VT -5.0 Y +05407 VT -5.0 Y +05408 VT -5.0 Y +05439 VT -5.0 Y +05440 VT -5.0 Y +05441 VT -5.0 Y +05442 VT -5.0 Y +05443 VT -5.0 Y +05444 VT -5.0 Y +05445 VT -5.0 Y +05446 VT -5.0 Y +05447 VT -5.0 Y +05448 VT -5.0 Y +05449 VT -5.0 Y +05450 VT -5.0 Y +05451 VT -5.0 Y +05452 VT -5.0 Y +05453 VT -5.0 Y +05454 VT -5.0 Y +05455 VT -5.0 Y +05456 VT -5.0 Y +05457 VT -5.0 Y +05458 VT -5.0 Y +05459 VT -5.0 Y +05460 VT -5.0 Y +05461 VT -5.0 Y +05462 VT -5.0 Y +05463 VT -5.0 Y +05464 VT -5.0 Y +05465 VT -5.0 Y +05466 VT -5.0 Y +05468 VT -5.0 Y +05469 VT -5.0 Y +05470 VT -5.0 Y +05471 VT -5.0 Y +05472 VT -5.0 Y +05473 VT -5.0 Y +05474 VT -5.0 Y +05476 VT -5.0 Y +05477 VT -5.0 Y +05478 VT -5.0 Y +05479 VT -5.0 Y +05481 VT -5.0 Y +05482 VT -5.0 Y +05483 VT -5.0 Y +05485 VT -5.0 Y +05486 VT -5.0 Y +05487 VT -5.0 Y +05488 VT -5.0 Y +05489 VT -5.0 Y +05490 VT -5.0 Y +05491 VT -5.0 Y +05492 VT -5.0 Y +05494 VT -5.0 Y +05495 VT -5.0 Y +05501 MA -5.0 Y +05544 MA -5.0 Y +05601 VT -5.0 Y +05602 VT -5.0 Y +05603 VT -5.0 Y +05604 VT -5.0 Y +05609 VT -5.0 Y +05620 VT -5.0 Y +05633 VT -5.0 Y +05640 VT -5.0 Y +05641 VT -5.0 Y +05647 VT -5.0 Y +05648 VT -5.0 Y +05649 VT -5.0 Y +05650 VT -5.0 Y +05651 VT -5.0 Y +05652 VT -5.0 Y +05653 VT -5.0 Y +05654 VT -5.0 Y +05655 VT -5.0 Y +05656 VT -5.0 Y +05657 VT -5.0 Y +05658 VT -5.0 Y +05660 VT -5.0 Y +05661 VT -5.0 Y +05662 VT -5.0 Y +05663 VT -5.0 Y +05664 VT -5.0 Y +05665 VT -5.0 Y +05666 VT -5.0 Y +05667 VT -5.0 Y +05669 VT -5.0 Y +05670 VT -5.0 Y +05671 VT -5.0 Y +05672 VT -5.0 Y +05673 VT -5.0 Y +05674 VT -5.0 Y +05675 VT -5.0 Y +05676 VT -5.0 Y +05677 VT -5.0 Y +05678 VT -5.0 Y +05679 VT -5.0 Y +05680 VT -5.0 Y +05681 VT -5.0 Y +05682 VT -5.0 Y +05701 VT -5.0 Y +05702 VT -5.0 Y +05730 VT -5.0 Y +05731 VT -5.0 Y +05732 VT -5.0 Y +05733 VT -5.0 Y +05734 VT -5.0 Y +05735 VT -5.0 Y +05736 VT -5.0 Y +05737 VT -5.0 Y +05738 VT -5.0 Y +05739 VT -5.0 Y +05740 VT -5.0 Y +05741 VT -5.0 Y +05742 VT -5.0 Y +05743 VT -5.0 Y +05744 VT -5.0 Y +05745 VT -5.0 Y +05746 VT -5.0 Y +05747 VT -5.0 Y +05748 VT -5.0 Y +05750 VT -5.0 Y +05751 VT -5.0 Y +05753 VT -5.0 Y +05757 VT -5.0 Y +05758 VT -5.0 Y +05759 VT -5.0 Y +05760 VT -5.0 Y +05761 VT -5.0 Y +05762 VT -5.0 Y +05763 VT -5.0 Y +05764 VT -5.0 Y +05765 VT -5.0 Y +05766 VT -5.0 Y +05767 VT -5.0 Y +05768 VT -5.0 Y +05769 VT -5.0 Y +05770 VT -5.0 Y +05772 VT -5.0 Y +05773 VT -5.0 Y +05774 VT -5.0 Y +05775 VT -5.0 Y +05776 VT -5.0 Y +05777 VT -5.0 Y +05778 VT -5.0 Y +05819 VT -5.0 Y +05820 VT -5.0 Y +05821 VT -5.0 Y +05822 VT -5.0 Y +05823 VT -5.0 Y +05824 VT -5.0 Y +05825 VT -5.0 Y +05826 VT -5.0 Y +05827 VT -5.0 Y +05828 VT -5.0 Y +05829 VT -5.0 Y +05830 VT -5.0 Y +05832 VT -5.0 Y +05833 VT -5.0 Y +05836 VT -5.0 Y +05837 VT -5.0 Y +05838 VT -5.0 Y +05839 VT -5.0 Y +05840 VT -5.0 Y +05841 VT -5.0 Y +05842 VT -5.0 Y +05843 VT -5.0 Y +05845 VT -5.0 Y +05846 VT -5.0 Y +05847 VT -5.0 Y +05848 VT -5.0 Y +05849 VT -5.0 Y +05850 VT -5.0 Y +05851 VT -5.0 Y +05853 VT -5.0 Y +05855 VT -5.0 Y +05857 VT -5.0 Y +05858 VT -5.0 Y +05859 VT -5.0 Y +05860 VT -5.0 Y +05861 VT -5.0 Y +05862 VT -5.0 Y +05863 VT -5.0 Y +05866 VT -5.0 Y +05867 VT -5.0 Y +05868 VT -5.0 Y +05871 VT -5.0 Y +05872 VT -5.0 Y +05873 VT -5.0 Y +05874 VT -5.0 Y +05875 VT -5.0 Y +05901 VT -5.0 Y +05902 VT -5.0 Y +05903 VT -5.0 Y +05904 VT -5.0 Y +05905 VT -5.0 Y +05906 VT -5.0 Y +05907 VT -5.0 Y +06001 CT -5.0 Y +06002 CT -5.0 Y +06006 CT -5.0 Y +06010 CT -5.0 Y +06011 CT -5.0 Y +06013 CT -5.0 Y +06016 CT -5.0 Y +06018 CT -5.0 Y +06019 CT -5.0 Y +06020 CT -5.0 Y +06021 CT -5.0 Y +06022 CT -5.0 Y +06023 CT -5.0 Y +06024 CT -5.0 Y +06025 CT -5.0 Y +06026 CT -5.0 Y +06027 CT -5.0 Y +06028 CT -5.0 Y +06029 CT -5.0 Y +06030 CT -5.0 Y +06031 CT -5.0 Y +06032 CT -5.0 Y +06033 CT -5.0 Y +06034 CT -5.0 Y +06035 CT -5.0 Y +06037 CT -5.0 Y +06039 CT -5.0 Y +06040 CT -5.0 Y +06041 CT -5.0 Y +06042 CT -5.0 Y +06043 CT -5.0 Y +06045 CT -5.0 Y +06050 CT -5.0 Y +06051 CT -5.0 Y +06052 CT -5.0 Y +06053 CT -5.0 Y +06057 CT -5.0 Y +06058 CT -5.0 Y +06059 CT -5.0 Y +06060 CT -5.0 Y +06061 CT -5.0 Y +06062 CT -5.0 Y +06063 CT -5.0 Y +06064 CT -5.0 Y +06065 CT -5.0 Y +06066 CT -5.0 Y +06067 CT -5.0 Y +06068 CT -5.0 Y +06069 CT -5.0 Y +06070 CT -5.0 Y +06071 CT -5.0 Y +06072 CT -5.0 Y +06073 CT -5.0 Y +06074 CT -5.0 Y +06075 CT -5.0 Y +06076 CT -5.0 Y +06077 CT -5.0 Y +06078 CT -5.0 Y +06079 CT -5.0 Y +06080 CT -5.0 Y +06081 CT -5.0 Y +06082 CT -5.0 Y +06083 CT -5.0 Y +06084 CT -5.0 Y +06085 CT -5.0 Y +06087 CT -5.0 Y +06088 CT -5.0 Y +06089 CT -5.0 Y +06090 CT -5.0 Y +06091 CT -5.0 Y +06092 CT -5.0 Y +06093 CT -5.0 Y +06094 CT -5.0 Y +06095 CT -5.0 Y +06096 CT -5.0 Y +06098 CT -5.0 Y +06101 CT -5.0 Y +06102 CT -5.0 Y +06103 CT -5.0 Y +06104 CT -5.0 Y +06105 CT -5.0 Y +06106 CT -5.0 Y +06107 CT -5.0 Y +06108 CT -5.0 Y +06109 CT -5.0 Y +06110 CT -5.0 Y +06111 CT -5.0 Y +06112 CT -5.0 Y +06114 CT -5.0 Y +06115 CT -5.0 Y +06117 CT -5.0 Y +06118 CT -5.0 Y +06119 CT -5.0 Y +06120 CT -5.0 Y +06123 CT -5.0 Y +06126 CT -5.0 Y +06127 CT -5.0 Y +06128 CT -5.0 Y +06129 CT -5.0 Y +06131 CT -5.0 Y +06132 CT -5.0 Y +06133 CT -5.0 Y +06134 CT -5.0 Y +06137 CT -5.0 Y +06138 CT -5.0 Y +06140 CT -5.0 Y +06141 CT -5.0 Y +06142 CT -5.0 Y +06143 CT -5.0 Y +06144 CT -5.0 Y +06145 CT -5.0 Y +06146 CT -5.0 Y +06147 CT -5.0 Y +06150 CT -5.0 Y +06151 CT -5.0 Y +06152 CT -5.0 Y +06153 CT -5.0 Y +06154 CT -5.0 Y +06155 CT -5.0 Y +06156 CT -5.0 Y +06160 CT -5.0 Y +06161 CT -5.0 Y +06167 CT -5.0 Y +06176 CT -5.0 Y +06180 CT -5.0 Y +06183 CT -5.0 Y +06199 CT -5.0 Y +06226 CT -5.0 Y +06230 CT -5.0 Y +06231 CT -5.0 Y +06232 CT -5.0 Y +06233 CT -5.0 Y +06234 CT -5.0 Y +06235 CT -5.0 Y +06237 CT -5.0 Y +06238 CT -5.0 Y +06239 CT -5.0 Y +06241 CT -5.0 Y +06242 CT -5.0 Y +06243 CT -5.0 Y +06244 CT -5.0 Y +06245 CT -5.0 Y +06246 CT -5.0 Y +06247 CT -5.0 Y +06248 CT -5.0 Y +06249 CT -5.0 Y +06250 CT -5.0 Y +06251 CT -5.0 Y +06254 CT -5.0 Y +06255 CT -5.0 Y +06256 CT -5.0 Y +06258 CT -5.0 Y +06259 CT -5.0 Y +06260 CT -5.0 Y +06262 CT -5.0 Y +06263 CT -5.0 Y +06264 CT -5.0 Y +06265 CT -5.0 Y +06266 CT -5.0 Y +06267 CT -5.0 Y +06268 CT -5.0 Y +06269 CT -5.0 Y +06277 CT -5.0 Y +06278 CT -5.0 Y +06279 CT -5.0 Y +06280 CT -5.0 Y +06281 CT -5.0 Y +06282 CT -5.0 Y +06320 CT -5.0 Y +06330 CT -5.0 Y +06331 CT -5.0 Y +06332 CT -5.0 Y +06333 CT -5.0 Y +06334 CT -5.0 Y +06335 CT -5.0 Y +06336 CT -5.0 Y +06338 CT -5.0 Y +06339 CT -5.0 Y +06340 CT -5.0 Y +06349 CT -5.0 Y +06350 CT -5.0 Y +06351 CT -5.0 Y +06353 CT -5.0 Y +06354 CT -5.0 Y +06355 CT -5.0 Y +06357 CT -5.0 Y +06359 CT -5.0 Y +06360 CT -5.0 Y +06365 CT -5.0 Y +06370 CT -5.0 Y +06371 CT -5.0 Y +06372 CT -5.0 Y +06373 CT -5.0 Y +06374 CT -5.0 Y +06375 CT -5.0 Y +06376 CT -5.0 Y +06377 CT -5.0 Y +06378 CT -5.0 Y +06379 CT -5.0 Y +06380 CT -5.0 Y +06382 CT -5.0 Y +06383 CT -5.0 Y +06384 CT -5.0 Y +06385 CT -5.0 Y +06386 CT -5.0 Y +06387 CT -5.0 Y +06388 CT -5.0 Y +06389 CT -5.0 Y +06390 NY -5.0 Y +06401 CT -5.0 Y +06403 CT -5.0 Y +06404 CT -5.0 Y +06405 CT -5.0 Y +06408 CT -5.0 Y +06409 CT -5.0 Y +06410 CT -5.0 Y +06411 CT -5.0 Y +06412 CT -5.0 Y +06413 CT -5.0 Y +06414 CT -5.0 Y +06415 CT -5.0 Y +06416 CT -5.0 Y +06417 CT -5.0 Y +06418 CT -5.0 Y +06419 CT -5.0 Y +06420 CT -5.0 Y +06422 CT -5.0 Y +06423 CT -5.0 Y +06424 CT -5.0 Y +06426 CT -5.0 Y +06437 CT -5.0 Y +06438 CT -5.0 Y +06439 CT -5.0 Y +06440 CT -5.0 Y +06441 CT -5.0 Y +06442 CT -5.0 Y +06443 CT -5.0 Y +06444 CT -5.0 Y +06447 CT -5.0 Y +06450 CT -5.0 Y +06451 CT -5.0 Y +06454 CT -5.0 Y +06455 CT -5.0 Y +06456 CT -5.0 Y +06457 CT -5.0 Y +06459 CT -5.0 Y +06460 CT -5.0 Y +06461 CT -5.0 Y +06467 CT -5.0 Y +06468 CT -5.0 Y +06469 CT -5.0 Y +06470 CT -5.0 Y +06471 CT -5.0 Y +06472 CT -5.0 Y +06473 CT -5.0 Y +06474 CT -5.0 Y +06475 CT -5.0 Y +06477 CT -5.0 Y +06478 CT -5.0 Y +06479 CT -5.0 Y +06480 CT -5.0 Y +06481 CT -5.0 Y +06482 CT -5.0 Y +06483 CT -5.0 Y +06484 CT -5.0 Y +06487 CT -5.0 Y +06488 CT -5.0 Y +06489 CT -5.0 Y +06491 CT -5.0 Y +06492 CT -5.0 Y +06493 CT -5.0 Y +06494 CT -5.0 Y +06495 CT -5.0 Y +06497 CT -5.0 Y +06498 CT -5.0 Y +06501 CT -5.0 Y +06502 CT -5.0 Y +06503 CT -5.0 Y +06504 CT -5.0 Y +06505 CT -5.0 Y +06506 CT -5.0 Y +06507 CT -5.0 Y +06508 CT -5.0 Y +06509 CT -5.0 Y +06510 CT -5.0 Y +06511 CT -5.0 Y +06512 CT -5.0 Y +06513 CT -5.0 Y +06514 CT -5.0 Y +06515 CT -5.0 Y +06516 CT -5.0 Y +06517 CT -5.0 Y +06518 CT -5.0 Y +06519 CT -5.0 Y +06520 CT -5.0 Y +06521 CT -5.0 Y +06524 CT -5.0 Y +06525 CT -5.0 Y +06530 CT -5.0 Y +06531 CT -5.0 Y +06532 CT -5.0 Y +06533 CT -5.0 Y +06534 CT -5.0 Y +06535 CT -5.0 Y +06536 CT -5.0 Y +06537 CT -5.0 Y +06538 CT -5.0 Y +06540 CT -5.0 Y +06601 CT -5.0 Y +06602 CT -5.0 Y +06604 CT -5.0 Y +06605 CT -5.0 Y +06606 CT -5.0 Y +06607 CT -5.0 Y +06608 CT -5.0 Y +06610 CT -5.0 Y +06611 CT -5.0 Y +06612 CT -5.0 Y +06614 CT -5.0 Y +06615 CT -5.0 Y +06650 CT -5.0 Y +06673 CT -5.0 Y +06699 CT -5.0 Y +06701 CT -5.0 Y +06702 CT -5.0 Y +06703 CT -5.0 Y +06704 CT -5.0 Y +06705 CT -5.0 Y +06706 CT -5.0 Y +06708 CT -5.0 Y +06710 CT -5.0 Y +06712 CT -5.0 Y +06716 CT -5.0 Y +06720 CT -5.0 Y +06721 CT -5.0 Y +06722 CT -5.0 Y +06723 CT -5.0 Y +06724 CT -5.0 Y +06725 CT -5.0 Y +06726 CT -5.0 Y +06749 CT -5.0 Y +06750 CT -5.0 Y +06751 CT -5.0 Y +06752 CT -5.0 Y +06753 CT -5.0 Y +06754 CT -5.0 Y +06755 CT -5.0 Y +06756 CT -5.0 Y +06757 CT -5.0 Y +06758 CT -5.0 Y +06759 CT -5.0 Y +06762 CT -5.0 Y +06763 CT -5.0 Y +06770 CT -5.0 Y +06776 CT -5.0 Y +06777 CT -5.0 Y +06778 CT -5.0 Y +06779 CT -5.0 Y +06781 CT -5.0 Y +06782 CT -5.0 Y +06783 CT -5.0 Y +06784 CT -5.0 Y +06785 CT -5.0 Y +06786 CT -5.0 Y +06787 CT -5.0 Y +06790 CT -5.0 Y +06791 CT -5.0 Y +06792 CT -5.0 Y +06793 CT -5.0 Y +06794 CT -5.0 Y +06795 CT -5.0 Y +06796 CT -5.0 Y +06798 CT -5.0 Y +06801 CT -5.0 Y +06804 CT -5.0 Y +06807 CT -5.0 Y +06810 CT -5.0 Y +06811 CT -5.0 Y +06812 CT -5.0 Y +06813 CT -5.0 Y +06814 CT -5.0 Y +06816 CT -5.0 Y +06817 CT -5.0 Y +06820 CT -5.0 Y +06824 CT -5.0 Y +06825 CT -5.0 Y +06828 CT -5.0 Y +06829 CT -5.0 Y +06830 CT -5.0 Y +06831 CT -5.0 Y +06832 CT -5.0 Y +06836 CT -5.0 Y +06838 CT -5.0 Y +06840 CT -5.0 Y +06842 CT -5.0 Y +06850 CT -5.0 Y +06851 CT -5.0 Y +06852 CT -5.0 Y +06853 CT -5.0 Y +06854 CT -5.0 Y +06855 CT -5.0 Y +06856 CT -5.0 Y +06857 CT -5.0 Y +06858 CT -5.0 Y +06859 CT -5.0 Y +06860 CT -5.0 Y +06870 CT -5.0 Y +06875 CT -5.0 Y +06876 CT -5.0 Y +06877 CT -5.0 Y +06878 CT -5.0 Y +06879 CT -5.0 Y +06880 CT -5.0 Y +06881 CT -5.0 Y +06883 CT -5.0 Y +06888 CT -5.0 Y +06889 CT -5.0 Y +06890 CT -5.0 Y +06896 CT -5.0 Y +06897 CT -5.0 Y +06901 CT -5.0 Y +06902 CT -5.0 Y +06903 CT -5.0 Y +06904 CT -5.0 Y +06905 CT -5.0 Y +06906 CT -5.0 Y +06907 CT -5.0 Y +06910 CT -5.0 Y +06911 CT -5.0 Y +06912 CT -5.0 Y +06913 CT -5.0 Y +06914 CT -5.0 Y +06920 CT -5.0 Y +06921 CT -5.0 Y +06922 CT -5.0 Y +06925 CT -5.0 Y +06926 CT -5.0 Y +06927 CT -5.0 Y +06928 CT -5.0 Y +07001 NJ -5.0 Y +07002 NJ -5.0 Y +07003 NJ -5.0 Y +07004 NJ -5.0 Y +07005 NJ -5.0 Y +07006 NJ -5.0 Y +07007 NJ -5.0 Y +07008 NJ -5.0 Y +07009 NJ -5.0 Y +07010 NJ -5.0 Y +07011 NJ -5.0 Y +07012 NJ -5.0 Y +07013 NJ -5.0 Y +07014 NJ -5.0 Y +07015 NJ -5.0 Y +07016 NJ -5.0 Y +07017 NJ -5.0 Y +07018 NJ -5.0 Y +07019 NJ -5.0 Y +07020 NJ -5.0 Y +07021 NJ -5.0 Y +07022 NJ -5.0 Y +07023 NJ -5.0 Y +07024 NJ -5.0 Y +07026 NJ -5.0 Y +07027 NJ -5.0 Y +07028 NJ -5.0 Y +07029 NJ -5.0 Y +07030 NJ -5.0 Y +07031 NJ -5.0 Y +07032 NJ -5.0 Y +07033 NJ -5.0 Y +07034 NJ -5.0 Y +07035 NJ -5.0 Y +07036 NJ -5.0 Y +07039 NJ -5.0 Y +07040 NJ -5.0 Y +07041 NJ -5.0 Y +07042 NJ -5.0 Y +07043 NJ -5.0 Y +07044 NJ -5.0 Y +07045 NJ -5.0 Y +07046 NJ -5.0 Y +07047 NJ -5.0 Y +07050 NJ -5.0 Y +07051 NJ -5.0 Y +07052 NJ -5.0 Y +07054 NJ -5.0 Y +07055 NJ -5.0 Y +07057 NJ -5.0 Y +07058 NJ -5.0 Y +07059 NJ -5.0 Y +07060 NJ -5.0 Y +07061 NJ -5.0 Y +07062 NJ -5.0 Y +07063 NJ -5.0 Y +07064 NJ -5.0 Y +07065 NJ -5.0 Y +07066 NJ -5.0 Y +07067 NJ -5.0 Y +07068 NJ -5.0 Y +07069 NJ -5.0 Y +07070 NJ -5.0 Y +07071 NJ -5.0 Y +07072 NJ -5.0 Y +07073 NJ -5.0 Y +07074 NJ -5.0 Y +07075 NJ -5.0 Y +07076 NJ -5.0 Y +07077 NJ -5.0 Y +07078 NJ -5.0 Y +07079 NJ -5.0 Y +07080 NJ -5.0 Y +07081 NJ -5.0 Y +07082 NJ -5.0 Y +07083 NJ -5.0 Y +07086 NJ -5.0 Y +07087 NJ -5.0 Y +07088 NJ -5.0 Y +07090 NJ -5.0 Y +07091 NJ -5.0 Y +07092 NJ -5.0 Y +07093 NJ -5.0 Y +07094 NJ -5.0 Y +07095 NJ -5.0 Y +07096 NJ -5.0 Y +07097 NJ -5.0 Y +07099 NJ -5.0 Y +07101 NJ -5.0 Y +07102 NJ -5.0 Y +07103 NJ -5.0 Y +07104 NJ -5.0 Y +07105 NJ -5.0 Y +07106 NJ -5.0 Y +07107 NJ -5.0 Y +07108 NJ -5.0 Y +07109 NJ -5.0 Y +07110 NJ -5.0 Y +07111 NJ -5.0 Y +07112 NJ -5.0 Y +07114 NJ -5.0 Y +07175 NJ -5.0 Y +07182 NJ -5.0 Y +07184 NJ -5.0 Y +07188 NJ -5.0 Y +07189 NJ -5.0 Y +07191 NJ -5.0 Y +07192 NJ -5.0 Y +07193 NJ -5.0 Y +07194 NJ -5.0 Y +07195 NJ -5.0 Y +07197 NJ -5.0 Y +07198 NJ -5.0 Y +07199 NJ -5.0 Y +07201 NJ -5.0 Y +07202 NJ -5.0 Y +07203 NJ -5.0 Y +07204 NJ -5.0 Y +07205 NJ -5.0 Y +07206 NJ -5.0 Y +07207 NJ -5.0 Y +07208 NJ -5.0 Y +07302 NJ -5.0 Y +07303 NJ -5.0 Y +07304 NJ -5.0 Y +07305 NJ -5.0 Y +07306 NJ -5.0 Y +07307 NJ -5.0 Y +07308 NJ -5.0 Y +07309 NJ -5.0 Y +07310 NJ -5.0 Y +07311 NJ -5.0 Y +07395 NJ -5.0 Y +07399 NJ -5.0 Y +07401 NJ -5.0 Y +07403 NJ -5.0 Y +07405 NJ -5.0 Y +07407 NJ -5.0 Y +07410 NJ -5.0 Y +07416 NJ -5.0 Y +07417 NJ -5.0 Y +07418 NJ -5.0 Y +07419 NJ -5.0 Y +07420 NJ -5.0 Y +07421 NJ -5.0 Y +07422 NJ -5.0 Y +07423 NJ -5.0 Y +07424 NJ -5.0 Y +07428 NJ -5.0 Y +07430 NJ -5.0 Y +07432 NJ -5.0 Y +07435 NJ -5.0 Y +07436 NJ -5.0 Y +07438 NJ -5.0 Y +07439 NJ -5.0 Y +07440 NJ -5.0 Y +07442 NJ -5.0 Y +07444 NJ -5.0 Y +07446 NJ -5.0 Y +07450 NJ -5.0 Y +07451 NJ -5.0 Y +07452 NJ -5.0 Y +07456 NJ -5.0 Y +07457 NJ -5.0 Y +07458 NJ -5.0 Y +07460 NJ -5.0 Y +07461 NJ -5.0 Y +07462 NJ -5.0 Y +07463 NJ -5.0 Y +07465 NJ -5.0 Y +07470 NJ -5.0 Y +07474 NJ -5.0 Y +07477 NJ -5.0 Y +07480 NJ -5.0 Y +07481 NJ -5.0 Y +07495 NJ -5.0 Y +07501 NJ -5.0 Y +07502 NJ -5.0 Y +07503 NJ -5.0 Y +07504 NJ -5.0 Y +07505 NJ -5.0 Y +07506 NJ -5.0 Y +07507 NJ -5.0 Y +07508 NJ -5.0 Y +07509 NJ -5.0 Y +07510 NJ -5.0 Y +07511 NJ -5.0 Y +07512 NJ -5.0 Y +07513 NJ -5.0 Y +07514 NJ -5.0 Y +07522 NJ -5.0 Y +07524 NJ -5.0 Y +07533 NJ -5.0 Y +07538 NJ -5.0 Y +07543 NJ -5.0 Y +07544 NJ -5.0 Y +07601 NJ -5.0 Y +07602 NJ -5.0 Y +07603 NJ -5.0 Y +07604 NJ -5.0 Y +07605 NJ -5.0 Y +07606 NJ -5.0 Y +07607 NJ -5.0 Y +07608 NJ -5.0 Y +07620 NJ -5.0 Y +07621 NJ -5.0 Y +07624 NJ -5.0 Y +07626 NJ -5.0 Y +07627 NJ -5.0 Y +07628 NJ -5.0 Y +07630 NJ -5.0 Y +07631 NJ -5.0 Y +07632 NJ -5.0 Y +07640 NJ -5.0 Y +07641 NJ -5.0 Y +07642 NJ -5.0 Y +07643 NJ -5.0 Y +07644 NJ -5.0 Y +07645 NJ -5.0 Y +07646 NJ -5.0 Y +07647 NJ -5.0 Y +07648 NJ -5.0 Y +07649 NJ -5.0 Y +07650 NJ -5.0 Y +07652 NJ -5.0 Y +07653 NJ -5.0 Y +07656 NJ -5.0 Y +07657 NJ -5.0 Y +07660 NJ -5.0 Y +07661 NJ -5.0 Y +07662 NJ -5.0 Y +07663 NJ -5.0 Y +07666 NJ -5.0 Y +07670 NJ -5.0 Y +07675 NJ -5.0 Y +07676 NJ -5.0 Y +07677 NJ -5.0 Y +07699 NJ -5.0 Y +07701 NJ -5.0 Y +07702 NJ -5.0 Y +07703 NJ -5.0 Y +07704 NJ -5.0 Y +07709 NJ -5.0 Y +07710 NJ -5.0 Y +07711 NJ -5.0 Y +07712 NJ -5.0 Y +07715 NJ -5.0 Y +07716 NJ -5.0 Y +07717 NJ -5.0 Y +07718 NJ -5.0 Y +07719 NJ -5.0 Y +07720 NJ -5.0 Y +07721 NJ -5.0 Y +07722 NJ -5.0 Y +07723 NJ -5.0 Y +07724 NJ -5.0 Y +07726 NJ -5.0 Y +07727 NJ -5.0 Y +07728 NJ -5.0 Y +07730 NJ -5.0 Y +07731 NJ -5.0 Y +07732 NJ -5.0 Y +07733 NJ -5.0 Y +07734 NJ -5.0 Y +07735 NJ -5.0 Y +07737 NJ -5.0 Y +07738 NJ -5.0 Y +07739 NJ -5.0 Y +07740 NJ -5.0 Y +07746 NJ -5.0 Y +07747 NJ -5.0 Y +07748 NJ -5.0 Y +07750 NJ -5.0 Y +07751 NJ -5.0 Y +07752 NJ -5.0 Y +07753 NJ -5.0 Y +07754 NJ -5.0 Y +07755 NJ -5.0 Y +07756 NJ -5.0 Y +07757 NJ -5.0 Y +07758 NJ -5.0 Y +07760 NJ -5.0 Y +07762 NJ -5.0 Y +07763 NJ -5.0 Y +07764 NJ -5.0 Y +07765 NJ -5.0 Y +07777 NJ -5.0 Y +07799 NJ -5.0 Y +07801 NJ -5.0 Y +07802 NJ -5.0 Y +07803 NJ -5.0 Y +07806 NJ -5.0 Y +07820 NJ -5.0 Y +07821 NJ -5.0 Y +07822 NJ -5.0 Y +07823 NJ -5.0 Y +07825 NJ -5.0 Y +07826 NJ -5.0 Y +07827 NJ -5.0 Y +07828 NJ -5.0 Y +07829 NJ -5.0 Y +07830 NJ -5.0 Y +07831 NJ -5.0 Y +07832 NJ -5.0 Y +07833 NJ -5.0 Y +07834 NJ -5.0 Y +07836 NJ -5.0 Y +07837 NJ -5.0 Y +07838 NJ -5.0 Y +07839 NJ -5.0 Y +07840 NJ -5.0 Y +07842 NJ -5.0 Y +07843 NJ -5.0 Y +07844 NJ -5.0 Y +07845 NJ -5.0 Y +07846 NJ -5.0 Y +07847 NJ -5.0 Y +07848 NJ -5.0 Y +07849 NJ -5.0 Y +07850 NJ -5.0 Y +07851 NJ -5.0 Y +07852 NJ -5.0 Y +07853 NJ -5.0 Y +07855 NJ -5.0 Y +07856 NJ -5.0 Y +07857 NJ -5.0 Y +07860 NJ -5.0 Y +07863 NJ -5.0 Y +07865 NJ -5.0 Y +07866 NJ -5.0 Y +07869 NJ -5.0 Y +07870 NJ -5.0 Y +07871 NJ -5.0 Y +07874 NJ -5.0 Y +07875 NJ -5.0 Y +07876 NJ -5.0 Y +07877 NJ -5.0 Y +07878 NJ -5.0 Y +07879 NJ -5.0 Y +07880 NJ -5.0 Y +07881 NJ -5.0 Y +07882 NJ -5.0 Y +07885 NJ -5.0 Y +07890 NJ -5.0 Y +07901 NJ -5.0 Y +07902 NJ -5.0 Y +07920 NJ -5.0 Y +07921 NJ -5.0 Y +07922 NJ -5.0 Y +07924 NJ -5.0 Y +07926 NJ -5.0 Y +07927 NJ -5.0 Y +07928 NJ -5.0 Y +07930 NJ -5.0 Y +07931 NJ -5.0 Y +07932 NJ -5.0 Y +07933 NJ -5.0 Y +07934 NJ -5.0 Y +07935 NJ -5.0 Y +07936 NJ -5.0 Y +07938 NJ -5.0 Y +07939 NJ -5.0 Y +07940 NJ -5.0 Y +07945 NJ -5.0 Y +07946 NJ -5.0 Y +07950 NJ -5.0 Y +07960 NJ -5.0 Y +07961 NJ -5.0 Y +07962 NJ -5.0 Y +07963 NJ -5.0 Y +07970 NJ -5.0 Y +07974 NJ -5.0 Y +07976 NJ -5.0 Y +07977 NJ -5.0 Y +07978 NJ -5.0 Y +07979 NJ -5.0 Y +07980 NJ -5.0 Y +07981 NJ -5.0 Y +07983 NJ -5.0 Y +07999 NJ -5.0 Y +08001 NJ -5.0 Y +08002 NJ -5.0 Y +08003 NJ -5.0 Y +08004 NJ -5.0 Y +08005 NJ -5.0 Y +08006 NJ -5.0 Y +08007 NJ -5.0 Y +08008 NJ -5.0 Y +08009 NJ -5.0 Y +08010 NJ -5.0 Y +08011 NJ -5.0 Y +08012 NJ -5.0 Y +08014 NJ -5.0 Y +08015 NJ -5.0 Y +08016 NJ -5.0 Y +08018 NJ -5.0 Y +08019 NJ -5.0 Y +08020 NJ -5.0 Y +08021 NJ -5.0 Y +08022 NJ -5.0 Y +08023 NJ -5.0 Y +08025 NJ -5.0 Y +08026 NJ -5.0 Y +08027 NJ -5.0 Y +08028 NJ -5.0 Y +08029 NJ -5.0 Y +08030 NJ -5.0 Y +08031 NJ -5.0 Y +08032 NJ -5.0 Y +08033 NJ -5.0 Y +08034 NJ -5.0 Y +08035 NJ -5.0 Y +08036 NJ -5.0 Y +08037 NJ -5.0 Y +08038 NJ -5.0 Y +08039 NJ -5.0 Y +08041 NJ -5.0 Y +08042 NJ -5.0 Y +08043 NJ -5.0 Y +08045 NJ -5.0 Y +08046 NJ -5.0 Y +08048 NJ -5.0 Y +08049 NJ -5.0 Y +08050 NJ -5.0 Y +08051 NJ -5.0 Y +08052 NJ -5.0 Y +08053 NJ -5.0 Y +08054 NJ -5.0 Y +08055 NJ -5.0 Y +08056 NJ -5.0 Y +08057 NJ -5.0 Y +08059 NJ -5.0 Y +08060 NJ -5.0 Y +08061 NJ -5.0 Y +08062 NJ -5.0 Y +08063 NJ -5.0 Y +08064 NJ -5.0 Y +08065 NJ -5.0 Y +08066 NJ -5.0 Y +08067 NJ -5.0 Y +08068 NJ -5.0 Y +08069 NJ -5.0 Y +08070 NJ -5.0 Y +08071 NJ -5.0 Y +08072 NJ -5.0 Y +08073 NJ -5.0 Y +08074 NJ -5.0 Y +08075 NJ -5.0 Y +08076 NJ -5.0 Y +08077 NJ -5.0 Y +08078 NJ -5.0 Y +08079 NJ -5.0 Y +08080 NJ -5.0 Y +08081 NJ -5.0 Y +08083 NJ -5.0 Y +08084 NJ -5.0 Y +08085 NJ -5.0 Y +08086 NJ -5.0 Y +08087 NJ -5.0 Y +08088 NJ -5.0 Y +08089 NJ -5.0 Y +08090 NJ -5.0 Y +08091 NJ -5.0 Y +08092 NJ -5.0 Y +08093 NJ -5.0 Y +08094 NJ -5.0 Y +08095 NJ -5.0 Y +08096 NJ -5.0 Y +08097 NJ -5.0 Y +08098 NJ -5.0 Y +08099 NJ -5.0 Y +08101 NJ -5.0 Y +08102 NJ -5.0 Y +08103 NJ -5.0 Y +08104 NJ -5.0 Y +08105 NJ -5.0 Y +08106 NJ -5.0 Y +08107 NJ -5.0 Y +08108 NJ -5.0 Y +08109 NJ -5.0 Y +08110 NJ -5.0 Y +08201 NJ -5.0 Y +08202 NJ -5.0 Y +08203 NJ -5.0 Y +08204 NJ -5.0 Y +08205 NJ -5.0 Y +08210 NJ -5.0 Y +08212 NJ -5.0 Y +08213 NJ -5.0 Y +08214 NJ -5.0 Y +08215 NJ -5.0 Y +08217 NJ -5.0 Y +08218 NJ -5.0 Y +08219 NJ -5.0 Y +08220 NJ -5.0 Y +08221 NJ -5.0 Y +08223 NJ -5.0 Y +08224 NJ -5.0 Y +08225 NJ -5.0 Y +08226 NJ -5.0 Y +08230 NJ -5.0 Y +08231 NJ -5.0 Y +08232 NJ -5.0 Y +08234 NJ -5.0 Y +08240 NJ -5.0 Y +08241 NJ -5.0 Y +08242 NJ -5.0 Y +08243 NJ -5.0 Y +08244 NJ -5.0 Y +08245 NJ -5.0 Y +08246 NJ -5.0 Y +08247 NJ -5.0 Y +08248 NJ -5.0 Y +08250 NJ -5.0 Y +08251 NJ -5.0 Y +08252 NJ -5.0 Y +08260 NJ -5.0 Y +08270 NJ -5.0 Y +08302 NJ -5.0 Y +08310 NJ -5.0 Y +08311 NJ -5.0 Y +08312 NJ -5.0 Y +08313 NJ -5.0 Y +08314 NJ -5.0 Y +08315 NJ -5.0 Y +08316 NJ -5.0 Y +08317 NJ -5.0 Y +08318 NJ -5.0 Y +08319 NJ -5.0 Y +08320 NJ -5.0 Y +08321 NJ -5.0 Y +08322 NJ -5.0 Y +08323 NJ -5.0 Y +08324 NJ -5.0 Y +08326 NJ -5.0 Y +08327 NJ -5.0 Y +08328 NJ -5.0 Y +08329 NJ -5.0 Y +08330 NJ -5.0 Y +08332 NJ -5.0 Y +08340 NJ -5.0 Y +08341 NJ -5.0 Y +08342 NJ -5.0 Y +08343 NJ -5.0 Y +08344 NJ -5.0 Y +08345 NJ -5.0 Y +08346 NJ -5.0 Y +08347 NJ -5.0 Y +08348 NJ -5.0 Y +08349 NJ -5.0 Y +08350 NJ -5.0 Y +08352 NJ -5.0 Y +08353 NJ -5.0 Y +08360 NJ -5.0 Y +08361 NJ -5.0 Y +08362 NJ -5.0 Y +08401 NJ -5.0 Y +08402 NJ -5.0 Y +08403 NJ -5.0 Y +08404 NJ -5.0 Y +08405 NJ -5.0 Y +08406 NJ -5.0 Y +08501 NJ -5.0 Y +08502 NJ -5.0 Y +08504 NJ -5.0 Y +08505 NJ -5.0 Y +08510 NJ -5.0 Y +08511 NJ -5.0 Y +08512 NJ -5.0 Y +08514 NJ -5.0 Y +08515 NJ -5.0 Y +08518 NJ -5.0 Y +08520 NJ -5.0 Y +08525 NJ -5.0 Y +08526 NJ -5.0 Y +08527 NJ -5.0 Y +08528 NJ -5.0 Y +08530 NJ -5.0 Y +08533 NJ -5.0 Y +08534 NJ -5.0 Y +08535 NJ -5.0 Y +08536 NJ -5.0 Y +08540 NJ -5.0 Y +08541 NJ -5.0 Y +08542 NJ -5.0 Y +08543 NJ -5.0 Y +08544 NJ -5.0 Y +08550 NJ -5.0 Y +08551 NJ -5.0 Y +08553 NJ -5.0 Y +08554 NJ -5.0 Y +08555 NJ -5.0 Y +08556 NJ -5.0 Y +08557 NJ -5.0 Y +08558 NJ -5.0 Y +08559 NJ -5.0 Y +08560 NJ -5.0 Y +08561 NJ -5.0 Y +08562 NJ -5.0 Y +08601 NJ -5.0 Y +08602 NJ -5.0 Y +08603 NJ -5.0 Y +08604 NJ -5.0 Y +08605 NJ -5.0 Y +08606 NJ -5.0 Y +08607 NJ -5.0 Y +08608 NJ -5.0 Y +08609 NJ -5.0 Y +08610 NJ -5.0 Y +08611 NJ -5.0 Y +08618 NJ -5.0 Y +08619 NJ -5.0 Y +08620 NJ -5.0 Y +08625 NJ -5.0 Y +08628 NJ -5.0 Y +08629 NJ -5.0 Y +08638 NJ -5.0 Y +08640 NJ -5.0 Y +08641 NJ -5.0 Y +08645 NJ -5.0 Y +08646 NJ -5.0 Y +08647 NJ -5.0 Y +08648 NJ -5.0 Y +08650 NJ -5.0 Y +08666 NJ -5.0 Y +08677 NJ -5.0 Y +08690 NJ -5.0 Y +08691 NJ -5.0 Y +08695 NJ -5.0 Y +08701 NJ -5.0 Y +08720 NJ -5.0 Y +08721 NJ -5.0 Y +08722 NJ -5.0 Y +08723 NJ -5.0 Y +08724 NJ -5.0 Y +08730 NJ -5.0 Y +08731 NJ -5.0 Y +08732 NJ -5.0 Y +08733 NJ -5.0 Y +08734 NJ -5.0 Y +08735 NJ -5.0 Y +08736 NJ -5.0 Y +08738 NJ -5.0 Y +08739 NJ -5.0 Y +08740 NJ -5.0 Y +08741 NJ -5.0 Y +08742 NJ -5.0 Y +08750 NJ -5.0 Y +08751 NJ -5.0 Y +08752 NJ -5.0 Y +08753 NJ -5.0 Y +08754 NJ -5.0 Y +08755 NJ -5.0 Y +08756 NJ -5.0 Y +08757 NJ -5.0 Y +08758 NJ -5.0 Y +08759 NJ -5.0 Y +08801 NJ -5.0 Y +08802 NJ -5.0 Y +08803 NJ -5.0 Y +08804 NJ -5.0 Y +08805 NJ -5.0 Y +08807 NJ -5.0 Y +08808 NJ -5.0 Y +08809 NJ -5.0 Y +08810 NJ -5.0 Y +08812 NJ -5.0 Y +08816 NJ -5.0 Y +08817 NJ -5.0 Y +08818 NJ -5.0 Y +08820 NJ -5.0 Y +08821 NJ -5.0 Y +08822 NJ -5.0 Y +08823 NJ -5.0 Y +08824 NJ -5.0 Y +08825 NJ -5.0 Y +08826 NJ -5.0 Y +08827 NJ -5.0 Y +08828 NJ -5.0 Y +08829 NJ -5.0 Y +08830 NJ -5.0 Y +08831 NJ -5.0 Y +08832 NJ -5.0 Y +08833 NJ -5.0 Y +08834 NJ -5.0 Y +08835 NJ -5.0 Y +08836 NJ -5.0 Y +08837 NJ -5.0 Y +08840 NJ -5.0 Y +08844 NJ -5.0 Y +08846 NJ -5.0 Y +08848 NJ -5.0 Y +08850 NJ -5.0 Y +08852 NJ -5.0 Y +08853 NJ -5.0 Y +08854 NJ -5.0 Y +08855 NJ -5.0 Y +08857 NJ -5.0 Y +08858 NJ -5.0 Y +08859 NJ -5.0 Y +08861 NJ -5.0 Y +08862 NJ -5.0 Y +08863 NJ -5.0 Y +08865 NJ -5.0 Y +08867 NJ -5.0 Y +08868 NJ -5.0 Y +08869 NJ -5.0 Y +08870 NJ -5.0 Y +08871 NJ -5.0 Y +08872 NJ -5.0 Y +08873 NJ -5.0 Y +08875 NJ -5.0 Y +08876 NJ -5.0 Y +08879 NJ -5.0 Y +08880 NJ -5.0 Y +08882 NJ -5.0 Y +08884 NJ -5.0 Y +08885 NJ -5.0 Y +08886 NJ -5.0 Y +08887 NJ -5.0 Y +08888 NJ -5.0 Y +08889 NJ -5.0 Y +08890 NJ -5.0 Y +08896 NJ -5.0 Y +08899 NJ -5.0 Y +08901 NJ -5.0 Y +08902 NJ -5.0 Y +08903 NJ -5.0 Y +08904 NJ -5.0 Y +08905 NJ -5.0 Y +08906 NJ -5.0 Y +08922 NJ -5.0 Y +08933 NJ -5.0 Y +08988 NJ -5.0 Y +08989 NJ -5.0 Y +10001 NY -5.0 Y +10002 NY -5.0 Y +10003 NY -5.0 Y +10004 NY -5.0 Y +10005 NY -5.0 Y +10006 NY -5.0 Y +10007 NY -5.0 Y +10008 NY -5.0 Y +10009 NY -5.0 Y +10010 NY -5.0 Y +10011 NY -5.0 Y +10012 NY -5.0 Y +10013 NY -5.0 Y +10014 NY -5.0 Y +10015 NY -5.0 Y +10016 NY -5.0 Y +10017 NY -5.0 Y +10018 NY -5.0 Y +10019 NY -5.0 Y +10020 NY -5.0 Y +10021 NY -5.0 Y +10022 NY -5.0 Y +10023 NY -5.0 Y +10024 NY -5.0 Y +10025 NY -5.0 Y +10026 NY -5.0 Y +10027 NY -5.0 Y +10028 NY -5.0 Y +10029 NY -5.0 Y +10030 NY -5.0 Y +10031 NY -5.0 Y +10032 NY -5.0 Y +10033 NY -5.0 Y +10034 NY -5.0 Y +10035 NY -5.0 Y +10036 NY -5.0 Y +10037 NY -5.0 Y +10038 NY -5.0 Y +10039 NY -5.0 Y +10040 NY -5.0 Y +10041 NY -5.0 Y +10043 NY -5.0 Y +10044 NY -5.0 Y +10045 NY -5.0 Y +10046 NY -5.0 Y +10047 NY -5.0 Y +10048 NY -5.0 Y +10055 NY -5.0 Y +10060 NY -5.0 Y +10069 NY -5.0 Y +10072 NY -5.0 Y +10079 NY -5.0 Y +10080 NY -5.0 Y +10081 NY -5.0 Y +10082 NY -5.0 Y +10087 NY -5.0 Y +10090 NY -5.0 Y +10094 NY -5.0 Y +10095 NY -5.0 Y +10096 NY -5.0 Y +10098 NY -5.0 Y +10099 NY -5.0 Y +10101 NY -5.0 Y +10102 NY -5.0 Y +10103 NY -5.0 Y +10104 NY -5.0 Y +10105 NY -5.0 Y +10106 NY -5.0 Y +10107 NY -5.0 Y +10108 NY -5.0 Y +10109 NY -5.0 Y +10110 NY -5.0 Y +10111 NY -5.0 Y +10112 NY -5.0 Y +10113 NY -5.0 Y +10114 NY -5.0 Y +10115 NY -5.0 Y +10116 NY -5.0 Y +10117 NY -5.0 Y +10118 NY -5.0 Y +10119 NY -5.0 Y +10120 NY -5.0 Y +10121 NY -5.0 Y +10122 NY -5.0 Y +10123 NY -5.0 Y +10124 NY -5.0 Y +10125 NY -5.0 Y +10126 NY -5.0 Y +10128 NY -5.0 Y +10129 NY -5.0 Y +10130 NY -5.0 Y +10131 NY -5.0 Y +10132 NY -5.0 Y +10133 NY -5.0 Y +10138 NY -5.0 Y +10149 NY -5.0 Y +10150 NY -5.0 Y +10151 NY -5.0 Y +10152 NY -5.0 Y +10153 NY -5.0 Y +10154 NY -5.0 Y +10155 NY -5.0 Y +10156 NY -5.0 Y +10157 NY -5.0 Y +10158 NY -5.0 Y +10159 NY -5.0 Y +10160 NY -5.0 Y +10161 NY -5.0 Y +10162 NY -5.0 Y +10163 NY -5.0 Y +10164 NY -5.0 Y +10165 NY -5.0 Y +10166 NY -5.0 Y +10167 NY -5.0 Y +10168 NY -5.0 Y +10169 NY -5.0 Y +10170 NY -5.0 Y +10171 NY -5.0 Y +10172 NY -5.0 Y +10173 NY -5.0 Y +10174 NY -5.0 Y +10175 NY -5.0 Y +10176 NY -5.0 Y +10177 NY -5.0 Y +10178 NY -5.0 Y +10179 NY -5.0 Y +10184 NY -5.0 Y +10185 NY -5.0 Y +10196 NY -5.0 Y +10197 NY -5.0 Y +10199 NY -5.0 Y +10203 NY -5.0 Y +10211 NY -5.0 Y +10212 NY -5.0 Y +10213 NY -5.0 Y +10242 NY -5.0 Y +10249 NY -5.0 Y +10256 NY -5.0 Y +10257 NY -5.0 Y +10258 NY -5.0 Y +10259 NY -5.0 Y +10260 NY -5.0 Y +10261 NY -5.0 Y +10265 NY -5.0 Y +10268 NY -5.0 Y +10269 NY -5.0 Y +10270 NY -5.0 Y +10271 NY -5.0 Y +10272 NY -5.0 Y +10273 NY -5.0 Y +10274 NY -5.0 Y +10275 NY -5.0 Y +10276 NY -5.0 Y +10277 NY -5.0 Y +10278 NY -5.0 Y +10279 NY -5.0 Y +10280 NY -5.0 Y +10281 NY -5.0 Y +10282 NY -5.0 Y +10285 NY -5.0 Y +10286 NY -5.0 Y +10292 NY -5.0 Y +10301 NY -5.0 Y +10302 NY -5.0 Y +10303 NY -5.0 Y +10304 NY -5.0 Y +10305 NY -5.0 Y +10306 NY -5.0 Y +10307 NY -5.0 Y +10308 NY -5.0 Y +10309 NY -5.0 Y +10310 NY -5.0 Y +10311 NY -5.0 Y +10312 NY -5.0 Y +10313 NY -5.0 Y +10314 NY -5.0 Y +10451 NY -5.0 Y +10452 NY -5.0 Y +10453 NY -5.0 Y +10454 NY -5.0 Y +10455 NY -5.0 Y +10456 NY -5.0 Y +10457 NY -5.0 Y +10458 NY -5.0 Y +10459 NY -5.0 Y +10460 NY -5.0 Y +10461 NY -5.0 Y +10462 NY -5.0 Y +10463 NY -5.0 Y +10464 NY -5.0 Y +10465 NY -5.0 Y +10466 NY -5.0 Y +10467 NY -5.0 Y +10468 NY -5.0 Y +10469 NY -5.0 Y +10470 NY -5.0 Y +10471 NY -5.0 Y +10472 NY -5.0 Y +10473 NY -5.0 Y +10474 NY -5.0 Y +10475 NY -5.0 Y +10499 NY -5.0 Y +10501 NY -5.0 Y +10502 NY -5.0 Y +10503 NY -5.0 Y +10504 NY -5.0 Y +10505 NY -5.0 Y +10506 NY -5.0 Y +10507 NY -5.0 Y +10509 NY -5.0 Y +10510 NY -5.0 Y +10511 NY -5.0 Y +10512 NY -5.0 Y +10514 NY -5.0 Y +10516 NY -5.0 Y +10517 NY -5.0 Y +10518 NY -5.0 Y +10519 NY -5.0 Y +10520 NY -5.0 Y +10521 NY -5.0 Y +10522 NY -5.0 Y +10523 NY -5.0 Y +10524 NY -5.0 Y +10526 NY -5.0 Y +10527 NY -5.0 Y +10528 NY -5.0 Y +10530 NY -5.0 Y +10532 NY -5.0 Y +10533 NY -5.0 Y +10535 NY -5.0 Y +10536 NY -5.0 Y +10537 NY -5.0 Y +10538 NY -5.0 Y +10540 NY -5.0 Y +10541 NY -5.0 Y +10542 NY -5.0 Y +10543 NY -5.0 Y +10545 NY -5.0 Y +10546 NY -5.0 Y +10547 NY -5.0 Y +10548 NY -5.0 Y +10549 NY -5.0 Y +10550 NY -5.0 Y +10551 NY -5.0 Y +10552 NY -5.0 Y +10553 NY -5.0 Y +10557 NY -5.0 Y +10558 NY -5.0 Y +10560 NY -5.0 Y +10562 NY -5.0 Y +10566 NY -5.0 Y +10567 NY -5.0 Y +10570 NY -5.0 Y +10571 NY -5.0 Y +10572 NY -5.0 Y +10573 NY -5.0 Y +10576 NY -5.0 Y +10577 NY -5.0 Y +10578 NY -5.0 Y +10579 NY -5.0 Y +10580 NY -5.0 Y +10583 NY -5.0 Y +10587 NY -5.0 Y +10588 NY -5.0 Y +10589 NY -5.0 Y +10590 NY -5.0 Y +10591 NY -5.0 Y +10594 NY -5.0 Y +10595 NY -5.0 Y +10596 NY -5.0 Y +10597 NY -5.0 Y +10598 NY -5.0 Y +10601 NY -5.0 Y +10602 NY -5.0 Y +10603 NY -5.0 Y +10604 NY -5.0 Y +10605 NY -5.0 Y +10606 NY -5.0 Y +10607 NY -5.0 Y +10610 NY -5.0 Y +10701 NY -5.0 Y +10702 NY -5.0 Y +10703 NY -5.0 Y +10704 NY -5.0 Y +10705 NY -5.0 Y +10706 NY -5.0 Y +10707 NY -5.0 Y +10708 NY -5.0 Y +10709 NY -5.0 Y +10710 NY -5.0 Y +10801 NY -5.0 Y +10802 NY -5.0 Y +10803 NY -5.0 Y +10804 NY -5.0 Y +10805 NY -5.0 Y +10901 NY -5.0 Y +10910 NY -5.0 Y +10911 NY -5.0 Y +10912 NY -5.0 Y +10913 NY -5.0 Y +10914 NY -5.0 Y +10915 NY -5.0 Y +10916 NY -5.0 Y +10917 NY -5.0 Y +10918 NY -5.0 Y +10919 NY -5.0 Y +10920 NY -5.0 Y +10921 NY -5.0 Y +10922 NY -5.0 Y +10923 NY -5.0 Y +10924 NY -5.0 Y +10925 NY -5.0 Y +10926 NY -5.0 Y +10927 NY -5.0 Y +10928 NY -5.0 Y +10930 NY -5.0 Y +10931 NY -5.0 Y +10932 NY -5.0 Y +10933 NY -5.0 Y +10940 NY -5.0 Y +10941 NY -5.0 Y +10943 NY -5.0 Y +10949 NY -5.0 Y +10950 NY -5.0 Y +10952 NY -5.0 Y +10953 NY -5.0 Y +10954 NY -5.0 Y +10956 NY -5.0 Y +10958 NY -5.0 Y +10959 NY -5.0 Y +10960 NY -5.0 Y +10962 NY -5.0 Y +10963 NY -5.0 Y +10964 NY -5.0 Y +10965 NY -5.0 Y +10968 NY -5.0 Y +10969 NY -5.0 Y +10970 NY -5.0 Y +10973 NY -5.0 Y +10974 NY -5.0 Y +10975 NY -5.0 Y +10976 NY -5.0 Y +10977 NY -5.0 Y +10979 NY -5.0 Y +10980 NY -5.0 Y +10981 NY -5.0 Y +10982 NY -5.0 Y +10983 NY -5.0 Y +10984 NY -5.0 Y +10985 NY -5.0 Y +10986 NY -5.0 Y +10987 NY -5.0 Y +10988 NY -5.0 Y +10989 NY -5.0 Y +10990 NY -5.0 Y +10992 NY -5.0 Y +10993 NY -5.0 Y +10994 NY -5.0 Y +10996 NY -5.0 Y +10997 NY -5.0 Y +10998 NY -5.0 Y +11001 NY -5.0 Y +11002 NY -5.0 Y +11003 NY -5.0 Y +11004 NY -5.0 Y +11005 NY -5.0 Y +11010 NY -5.0 Y +11020 NY -5.0 Y +11021 NY -5.0 Y +11022 NY -5.0 Y +11023 NY -5.0 Y +11024 NY -5.0 Y +11025 NY -5.0 Y +11026 NY -5.0 Y +11027 NY -5.0 Y +11030 NY -5.0 Y +11040 NY -5.0 Y +11041 NY -5.0 Y +11042 NY -5.0 Y +11043 NY -5.0 Y +11044 NY -5.0 Y +11050 NY -5.0 Y +11051 NY -5.0 Y +11052 NY -5.0 Y +11053 NY -5.0 Y +11054 NY -5.0 Y +11055 NY -5.0 Y +11096 NY -5.0 Y +11099 NY -5.0 Y +11101 NY -5.0 Y +11102 NY -5.0 Y +11103 NY -5.0 Y +11104 NY -5.0 Y +11105 NY -5.0 Y +11106 NY -5.0 Y +11109 NY -5.0 Y +11120 NY -5.0 Y +11201 NY -5.0 Y +11202 NY -5.0 Y +11203 NY -5.0 Y +11204 NY -5.0 Y +11205 NY -5.0 Y +11206 NY -5.0 Y +11207 NY -5.0 Y +11208 NY -5.0 Y +11209 NY -5.0 Y +11210 NY -5.0 Y +11211 NY -5.0 Y +11212 NY -5.0 Y +11213 NY -5.0 Y +11214 NY -5.0 Y +11215 NY -5.0 Y +11216 NY -5.0 Y +11217 NY -5.0 Y +11218 NY -5.0 Y +11219 NY -5.0 Y +11220 NY -5.0 Y +11221 NY -5.0 Y +11222 NY -5.0 Y +11223 NY -5.0 Y +11224 NY -5.0 Y +11225 NY -5.0 Y +11226 NY -5.0 Y +11228 NY -5.0 Y +11229 NY -5.0 Y +11230 NY -5.0 Y +11231 NY -5.0 Y +11232 NY -5.0 Y +11233 NY -5.0 Y +11234 NY -5.0 Y +11235 NY -5.0 Y +11236 NY -5.0 Y +11237 NY -5.0 Y +11238 NY -5.0 Y +11239 NY -5.0 Y +11240 NY -5.0 Y +11241 NY -5.0 Y +11242 NY -5.0 Y +11243 NY -5.0 Y +11244 NY -5.0 Y +11245 NY -5.0 Y +11247 NY -5.0 Y +11248 NY -5.0 Y +11249 NY -5.0 Y +11251 NY -5.0 Y +11252 NY -5.0 Y +11254 NY -5.0 Y +11255 NY -5.0 Y +11256 NY -5.0 Y +11351 NY -5.0 Y +11352 NY -5.0 Y +11354 NY -5.0 Y +11355 NY -5.0 Y +11356 NY -5.0 Y +11357 NY -5.0 Y +11358 NY -5.0 Y +11359 NY -5.0 Y +11360 NY -5.0 Y +11361 NY -5.0 Y +11362 NY -5.0 Y +11363 NY -5.0 Y +11364 NY -5.0 Y +11365 NY -5.0 Y +11366 NY -5.0 Y +11367 NY -5.0 Y +11368 NY -5.0 Y +11369 NY -5.0 Y +11370 NY -5.0 Y +11371 NY -5.0 Y +11372 NY -5.0 Y +11373 NY -5.0 Y +11374 NY -5.0 Y +11375 NY -5.0 Y +11377 NY -5.0 Y +11378 NY -5.0 Y +11379 NY -5.0 Y +11380 NY -5.0 Y +11381 NY -5.0 Y +11385 NY -5.0 Y +11386 NY -5.0 Y +11390 NY -5.0 Y +11405 NY -5.0 Y +11411 NY -5.0 Y +11412 NY -5.0 Y +11413 NY -5.0 Y +11414 NY -5.0 Y +11415 NY -5.0 Y +11416 NY -5.0 Y +11417 NY -5.0 Y +11418 NY -5.0 Y +11419 NY -5.0 Y +11420 NY -5.0 Y +11421 NY -5.0 Y +11422 NY -5.0 Y +11423 NY -5.0 Y +11424 NY -5.0 Y +11425 NY -5.0 Y +11426 NY -5.0 Y +11427 NY -5.0 Y +11428 NY -5.0 Y +11429 NY -5.0 Y +11430 NY -5.0 Y +11431 NY -5.0 Y +11432 NY -5.0 Y +11433 NY -5.0 Y +11434 NY -5.0 Y +11435 NY -5.0 Y +11436 NY -5.0 Y +11439 NY -5.0 Y +11451 NY -5.0 Y +11499 NY -5.0 Y +11501 NY -5.0 Y +11507 NY -5.0 Y +11509 NY -5.0 Y +11510 NY -5.0 Y +11514 NY -5.0 Y +11516 NY -5.0 Y +11518 NY -5.0 Y +11520 NY -5.0 Y +11530 NY -5.0 Y +11531 NY -5.0 Y +11535 NY -5.0 Y +11536 NY -5.0 Y +11542 NY -5.0 Y +11545 NY -5.0 Y +11547 NY -5.0 Y +11548 NY -5.0 Y +11549 NY -5.0 Y +11550 NY -5.0 Y +11551 NY -5.0 Y +11552 NY -5.0 Y +11553 NY -5.0 Y +11554 NY -5.0 Y +11555 NY -5.0 Y +11556 NY -5.0 Y +11557 NY -5.0 Y +11558 NY -5.0 Y +11559 NY -5.0 Y +11560 NY -5.0 Y +11561 NY -5.0 Y +11563 NY -5.0 Y +11565 NY -5.0 Y +11566 NY -5.0 Y +11568 NY -5.0 Y +11569 NY -5.0 Y +11570 NY -5.0 Y +11571 NY -5.0 Y +11572 NY -5.0 Y +11575 NY -5.0 Y +11576 NY -5.0 Y +11577 NY -5.0 Y +11579 NY -5.0 Y +11580 NY -5.0 Y +11581 NY -5.0 Y +11582 NY -5.0 Y +11590 NY -5.0 Y +11592 NY -5.0 Y +11594 NY -5.0 Y +11595 NY -5.0 Y +11596 NY -5.0 Y +11597 NY -5.0 Y +11598 NY -5.0 Y +11599 NY -5.0 Y +11690 NY -5.0 Y +11691 NY -5.0 Y +11692 NY -5.0 Y +11693 NY -5.0 Y +11694 NY -5.0 Y +11695 NY -5.0 Y +11697 NY -5.0 Y +11701 NY -5.0 Y +11702 NY -5.0 Y +11703 NY -5.0 Y +11704 NY -5.0 Y +11705 NY -5.0 Y +11706 NY -5.0 Y +11707 NY -5.0 Y +11708 NY -5.0 Y +11709 NY -5.0 Y +11710 NY -5.0 Y +11713 NY -5.0 Y +11714 NY -5.0 Y +11715 NY -5.0 Y +11716 NY -5.0 Y +11717 NY -5.0 Y +11718 NY -5.0 Y +11719 NY -5.0 Y +11720 NY -5.0 Y +11721 NY -5.0 Y +11722 NY -5.0 Y +11724 NY -5.0 Y +11725 NY -5.0 Y +11726 NY -5.0 Y +11727 NY -5.0 Y +11729 NY -5.0 Y +11730 NY -5.0 Y +11731 NY -5.0 Y +11732 NY -5.0 Y +11733 NY -5.0 Y +11735 NY -5.0 Y +11736 NY -5.0 Y +11737 NY -5.0 Y +11738 NY -5.0 Y +11739 NY -5.0 Y +11740 NY -5.0 Y +11741 NY -5.0 Y +11742 NY -5.0 Y +11743 NY -5.0 Y +11746 NY -5.0 Y +11747 NY -5.0 Y +11749 NY -5.0 Y +11750 NY -5.0 Y +11751 NY -5.0 Y +11752 NY -5.0 Y +11753 NY -5.0 Y +11754 NY -5.0 Y +11755 NY -5.0 Y +11756 NY -5.0 Y +11757 NY -5.0 Y +11758 NY -5.0 Y +11760 NY -5.0 Y +11762 NY -5.0 Y +11763 NY -5.0 Y +11764 NY -5.0 Y +11765 NY -5.0 Y +11766 NY -5.0 Y +11767 NY -5.0 Y +11768 NY -5.0 Y +11769 NY -5.0 Y +11770 NY -5.0 Y +11771 NY -5.0 Y +11772 NY -5.0 Y +11773 NY -5.0 Y +11774 NY -5.0 Y +11775 NY -5.0 Y +11776 NY -5.0 Y +11777 NY -5.0 Y +11778 NY -5.0 Y +11779 NY -5.0 Y +11780 NY -5.0 Y +11782 NY -5.0 Y +11783 NY -5.0 Y +11784 NY -5.0 Y +11786 NY -5.0 Y +11787 NY -5.0 Y +11788 NY -5.0 Y +11789 NY -5.0 Y +11790 NY -5.0 Y +11791 NY -5.0 Y +11792 NY -5.0 Y +11793 NY -5.0 Y +11794 NY -5.0 Y +11795 NY -5.0 Y +11796 NY -5.0 Y +11797 NY -5.0 Y +11798 NY -5.0 Y +11801 NY -5.0 Y +11802 NY -5.0 Y +11803 NY -5.0 Y +11804 NY -5.0 Y +11815 NY -5.0 Y +11819 NY -5.0 Y +11853 NY -5.0 Y +11854 NY -5.0 Y +11855 NY -5.0 Y +11901 NY -5.0 Y +11930 NY -5.0 Y +11931 NY -5.0 Y +11932 NY -5.0 Y +11933 NY -5.0 Y +11934 NY -5.0 Y +11935 NY -5.0 Y +11937 NY -5.0 Y +11939 NY -5.0 Y +11940 NY -5.0 Y +11941 NY -5.0 Y +11942 NY -5.0 Y +11944 NY -5.0 Y +11946 NY -5.0 Y +11947 NY -5.0 Y +11948 NY -5.0 Y +11949 NY -5.0 Y +11950 NY -5.0 Y +11951 NY -5.0 Y +11952 NY -5.0 Y +11953 NY -5.0 Y +11954 NY -5.0 Y +11955 NY -5.0 Y +11956 NY -5.0 Y +11957 NY -5.0 Y +11958 NY -5.0 Y +11959 NY -5.0 Y +11960 NY -5.0 Y +11961 NY -5.0 Y +11962 NY -5.0 Y +11963 NY -5.0 Y +11964 NY -5.0 Y +11965 NY -5.0 Y +11967 NY -5.0 Y +11968 NY -5.0 Y +11969 NY -5.0 Y +11970 NY -5.0 Y +11971 NY -5.0 Y +11972 NY -5.0 Y +11973 NY -5.0 Y +11975 NY -5.0 Y +11976 NY -5.0 Y +11977 NY -5.0 Y +11978 NY -5.0 Y +11980 NY -5.0 Y +12007 NY -5.0 Y +12008 NY -5.0 Y +12009 NY -5.0 Y +12010 NY -5.0 Y +12015 NY -5.0 Y +12016 NY -5.0 Y +12017 NY -5.0 Y +12018 NY -5.0 Y +12019 NY -5.0 Y +12020 NY -5.0 Y +12022 NY -5.0 Y +12023 NY -5.0 Y +12024 NY -5.0 Y +12025 NY -5.0 Y +12027 NY -5.0 Y +12028 NY -5.0 Y +12029 NY -5.0 Y +12031 NY -5.0 Y +12032 NY -5.0 Y +12033 NY -5.0 Y +12035 NY -5.0 Y +12036 NY -5.0 Y +12037 NY -5.0 Y +12040 NY -5.0 Y +12041 NY -5.0 Y +12042 NY -5.0 Y +12043 NY -5.0 Y +12045 NY -5.0 Y +12046 NY -5.0 Y +12047 NY -5.0 Y +12050 NY -5.0 Y +12051 NY -5.0 Y +12052 NY -5.0 Y +12053 NY -5.0 Y +12054 NY -5.0 Y +12055 NY -5.0 Y +12056 NY -5.0 Y +12057 NY -5.0 Y +12058 NY -5.0 Y +12059 NY -5.0 Y +12060 NY -5.0 Y +12061 NY -5.0 Y +12062 NY -5.0 Y +12063 NY -5.0 Y +12064 NY -5.0 Y +12065 NY -5.0 Y +12066 NY -5.0 Y +12067 NY -5.0 Y +12068 NY -5.0 Y +12069 NY -5.0 Y +12070 NY -5.0 Y +12071 NY -5.0 Y +12072 NY -5.0 Y +12073 NY -5.0 Y +12074 NY -5.0 Y +12075 NY -5.0 Y +12076 NY -5.0 Y +12077 NY -5.0 Y +12078 NY -5.0 Y +12082 NY -5.0 Y +12083 NY -5.0 Y +12084 NY -5.0 Y +12085 NY -5.0 Y +12086 NY -5.0 Y +12087 NY -5.0 Y +12089 NY -5.0 Y +12090 NY -5.0 Y +12092 NY -5.0 Y +12093 NY -5.0 Y +12094 NY -5.0 Y +12095 NY -5.0 Y +12106 NY -5.0 Y +12107 NY -5.0 Y +12108 NY -5.0 Y +12110 NY -5.0 Y +12115 NY -5.0 Y +12116 NY -5.0 Y +12117 NY -5.0 Y +12118 NY -5.0 Y +12120 NY -5.0 Y +12121 NY -5.0 Y +12122 NY -5.0 Y +12123 NY -5.0 Y +12124 NY -5.0 Y +12125 NY -5.0 Y +12128 NY -5.0 Y +12130 NY -5.0 Y +12131 NY -5.0 Y +12132 NY -5.0 Y +12133 NY -5.0 Y +12134 NY -5.0 Y +12136 NY -5.0 Y +12137 NY -5.0 Y +12138 NY -5.0 Y +12139 NY -5.0 Y +12140 NY -5.0 Y +12141 NY -5.0 Y +12143 NY -5.0 Y +12144 NY -5.0 Y +12147 NY -5.0 Y +12148 NY -5.0 Y +12149 NY -5.0 Y +12150 NY -5.0 Y +12151 NY -5.0 Y +12153 NY -5.0 Y +12154 NY -5.0 Y +12155 NY -5.0 Y +12156 NY -5.0 Y +12157 NY -5.0 Y +12158 NY -5.0 Y +12159 NY -5.0 Y +12160 NY -5.0 Y +12161 NY -5.0 Y +12164 NY -5.0 Y +12165 NY -5.0 Y +12166 NY -5.0 Y +12167 NY -5.0 Y +12168 NY -5.0 Y +12169 NY -5.0 Y +12170 NY -5.0 Y +12172 NY -5.0 Y +12173 NY -5.0 Y +12174 NY -5.0 Y +12175 NY -5.0 Y +12176 NY -5.0 Y +12177 NY -5.0 Y +12180 NY -5.0 Y +12181 NY -5.0 Y +12182 NY -5.0 Y +12183 NY -5.0 Y +12184 NY -5.0 Y +12185 NY -5.0 Y +12186 NY -5.0 Y +12187 NY -5.0 Y +12188 NY -5.0 Y +12189 NY -5.0 Y +12190 NY -5.0 Y +12192 NY -5.0 Y +12193 NY -5.0 Y +12194 NY -5.0 Y +12195 NY -5.0 Y +12196 NY -5.0 Y +12197 NY -5.0 Y +12198 NY -5.0 Y +12201 NY -5.0 Y +12202 NY -5.0 Y +12203 NY -5.0 Y +12204 NY -5.0 Y +12205 NY -5.0 Y +12206 NY -5.0 Y +12207 NY -5.0 Y +12208 NY -5.0 Y +12209 NY -5.0 Y +12210 NY -5.0 Y +12211 NY -5.0 Y +12212 NY -5.0 Y +12214 NY -5.0 Y +12220 NY -5.0 Y +12222 NY -5.0 Y +12223 NY -5.0 Y +12224 NY -5.0 Y +12225 NY -5.0 Y +12226 NY -5.0 Y +12227 NY -5.0 Y +12228 NY -5.0 Y +12229 NY -5.0 Y +12230 NY -5.0 Y +12231 NY -5.0 Y +12232 NY -5.0 Y +12233 NY -5.0 Y +12234 NY -5.0 Y +12235 NY -5.0 Y +12236 NY -5.0 Y +12237 NY -5.0 Y +12238 NY -5.0 Y +12239 NY -5.0 Y +12240 NY -5.0 Y +12241 NY -5.0 Y +12242 NY -5.0 Y +12243 NY -5.0 Y +12244 NY -5.0 Y +12245 NY -5.0 Y +12246 NY -5.0 Y +12247 NY -5.0 Y +12248 NY -5.0 Y +12249 NY -5.0 Y +12250 NY -5.0 Y +12252 NY -5.0 Y +12255 NY -5.0 Y +12256 NY -5.0 Y +12257 NY -5.0 Y +12260 NY -5.0 Y +12261 NY -5.0 Y +12288 NY -5.0 Y +12301 NY -5.0 Y +12302 NY -5.0 Y +12303 NY -5.0 Y +12304 NY -5.0 Y +12305 NY -5.0 Y +12306 NY -5.0 Y +12307 NY -5.0 Y +12308 NY -5.0 Y +12309 NY -5.0 Y +12325 NY -5.0 Y +12345 NY -5.0 Y +12401 NY -5.0 Y +12402 NY -5.0 Y +12404 NY -5.0 Y +12405 NY -5.0 Y +12406 NY -5.0 Y +12407 NY -5.0 Y +12409 NY -5.0 Y +12410 NY -5.0 Y +12411 NY -5.0 Y +12412 NY -5.0 Y +12413 NY -5.0 Y +12414 NY -5.0 Y +12416 NY -5.0 Y +12417 NY -5.0 Y +12418 NY -5.0 Y +12419 NY -5.0 Y +12420 NY -5.0 Y +12421 NY -5.0 Y +12422 NY -5.0 Y +12423 NY -5.0 Y +12424 NY -5.0 Y +12427 NY -5.0 Y +12428 NY -5.0 Y +12429 NY -5.0 Y +12430 NY -5.0 Y +12431 NY -5.0 Y +12432 NY -5.0 Y +12433 NY -5.0 Y +12434 NY -5.0 Y +12435 NY -5.0 Y +12436 NY -5.0 Y +12438 NY -5.0 Y +12439 NY -5.0 Y +12440 NY -5.0 Y +12441 NY -5.0 Y +12442 NY -5.0 Y +12443 NY -5.0 Y +12444 NY -5.0 Y +12446 NY -5.0 Y +12448 NY -5.0 Y +12449 NY -5.0 Y +12450 NY -5.0 Y +12451 NY -5.0 Y +12452 NY -5.0 Y +12453 NY -5.0 Y +12454 NY -5.0 Y +12455 NY -5.0 Y +12456 NY -5.0 Y +12457 NY -5.0 Y +12458 NY -5.0 Y +12459 NY -5.0 Y +12460 NY -5.0 Y +12461 NY -5.0 Y +12463 NY -5.0 Y +12464 NY -5.0 Y +12465 NY -5.0 Y +12466 NY -5.0 Y +12468 NY -5.0 Y +12469 NY -5.0 Y +12470 NY -5.0 Y +12471 NY -5.0 Y +12472 NY -5.0 Y +12473 NY -5.0 Y +12474 NY -5.0 Y +12475 NY -5.0 Y +12477 NY -5.0 Y +12480 NY -5.0 Y +12481 NY -5.0 Y +12482 NY -5.0 Y +12483 NY -5.0 Y +12484 NY -5.0 Y +12485 NY -5.0 Y +12486 NY -5.0 Y +12487 NY -5.0 Y +12489 NY -5.0 Y +12490 NY -5.0 Y +12491 NY -5.0 Y +12492 NY -5.0 Y +12493 NY -5.0 Y +12494 NY -5.0 Y +12495 NY -5.0 Y +12496 NY -5.0 Y +12498 NY -5.0 Y +12501 NY -5.0 Y +12502 NY -5.0 Y +12503 NY -5.0 Y +12504 NY -5.0 Y +12506 NY -5.0 Y +12507 NY -5.0 Y +12508 NY -5.0 Y +12510 NY -5.0 Y +12511 NY -5.0 Y +12512 NY -5.0 Y +12513 NY -5.0 Y +12514 NY -5.0 Y +12515 NY -5.0 Y +12516 NY -5.0 Y +12517 NY -5.0 Y +12518 NY -5.0 Y +12520 NY -5.0 Y +12521 NY -5.0 Y +12522 NY -5.0 Y +12523 NY -5.0 Y +12524 NY -5.0 Y +12525 NY -5.0 Y +12526 NY -5.0 Y +12527 NY -5.0 Y +12528 NY -5.0 Y +12529 NY -5.0 Y +12530 NY -5.0 Y +12531 NY -5.0 Y +12533 NY -5.0 Y +12534 NY -5.0 Y +12537 NY -5.0 Y +12538 NY -5.0 Y +12540 NY -5.0 Y +12541 NY -5.0 Y +12542 NY -5.0 Y +12543 NY -5.0 Y +12544 NY -5.0 Y +12545 NY -5.0 Y +12546 NY -5.0 Y +12547 NY -5.0 Y +12548 NY -5.0 Y +12549 NY -5.0 Y +12550 NY -5.0 Y +12551 NY -5.0 Y +12552 NY -5.0 Y +12553 NY -5.0 Y +12555 NY -5.0 Y +12561 NY -5.0 Y +12563 NY -5.0 Y +12564 NY -5.0 Y +12565 NY -5.0 Y +12566 NY -5.0 Y +12567 NY -5.0 Y +12568 NY -5.0 Y +12569 NY -5.0 Y +12570 NY -5.0 Y +12571 NY -5.0 Y +12572 NY -5.0 Y +12574 NY -5.0 Y +12575 NY -5.0 Y +12577 NY -5.0 Y +12578 NY -5.0 Y +12580 NY -5.0 Y +12581 NY -5.0 Y +12582 NY -5.0 Y +12583 NY -5.0 Y +12584 NY -5.0 Y +12585 NY -5.0 Y +12586 NY -5.0 Y +12588 NY -5.0 Y +12589 NY -5.0 Y +12590 NY -5.0 Y +12592 NY -5.0 Y +12593 NY -5.0 Y +12594 NY -5.0 Y +12601 NY -5.0 Y +12602 NY -5.0 Y +12603 NY -5.0 Y +12604 NY -5.0 Y +12701 NY -5.0 Y +12719 NY -5.0 Y +12720 NY -5.0 Y +12721 NY -5.0 Y +12722 NY -5.0 Y +12723 NY -5.0 Y +12724 NY -5.0 Y +12725 NY -5.0 Y +12726 NY -5.0 Y +12727 NY -5.0 Y +12729 NY -5.0 Y +12732 NY -5.0 Y +12733 NY -5.0 Y +12734 NY -5.0 Y +12736 NY -5.0 Y +12737 NY -5.0 Y +12738 NY -5.0 Y +12740 NY -5.0 Y +12741 NY -5.0 Y +12742 NY -5.0 Y +12743 NY -5.0 Y +12745 NY -5.0 Y +12746 NY -5.0 Y +12747 NY -5.0 Y +12748 NY -5.0 Y +12749 NY -5.0 Y +12750 NY -5.0 Y +12751 NY -5.0 Y +12752 NY -5.0 Y +12754 NY -5.0 Y +12758 NY -5.0 Y +12759 NY -5.0 Y +12760 NY -5.0 Y +12762 NY -5.0 Y +12763 NY -5.0 Y +12764 NY -5.0 Y +12765 NY -5.0 Y +12766 NY -5.0 Y +12767 NY -5.0 Y +12768 NY -5.0 Y +12769 NY -5.0 Y +12770 NY -5.0 Y +12771 NY -5.0 Y +12775 NY -5.0 Y +12776 NY -5.0 Y +12777 NY -5.0 Y +12778 NY -5.0 Y +12779 NY -5.0 Y +12780 NY -5.0 Y +12781 NY -5.0 Y +12783 NY -5.0 Y +12784 NY -5.0 Y +12785 NY -5.0 Y +12786 NY -5.0 Y +12787 NY -5.0 Y +12788 NY -5.0 Y +12789 NY -5.0 Y +12790 NY -5.0 Y +12791 NY -5.0 Y +12792 NY -5.0 Y +12801 NY -5.0 Y +12803 NY -5.0 Y +12804 NY -5.0 Y +12808 NY -5.0 Y +12809 NY -5.0 Y +12810 NY -5.0 Y +12811 NY -5.0 Y +12812 NY -5.0 Y +12814 NY -5.0 Y +12815 NY -5.0 Y +12816 NY -5.0 Y +12817 NY -5.0 Y +12819 NY -5.0 Y +12820 NY -5.0 Y +12821 NY -5.0 Y +12822 NY -5.0 Y +12823 NY -5.0 Y +12824 NY -5.0 Y +12827 NY -5.0 Y +12828 NY -5.0 Y +12831 NY -5.0 Y +12832 NY -5.0 Y +12833 NY -5.0 Y +12834 NY -5.0 Y +12835 NY -5.0 Y +12836 NY -5.0 Y +12837 NY -5.0 Y +12838 NY -5.0 Y +12839 NY -5.0 Y +12841 NY -5.0 Y +12842 NY -5.0 Y +12843 NY -5.0 Y +12844 NY -5.0 Y +12845 NY -5.0 Y +12846 NY -5.0 Y +12847 NY -5.0 Y +12848 NY -5.0 Y +12849 NY -5.0 Y +12850 NY -5.0 Y +12851 NY -5.0 Y +12852 NY -5.0 Y +12853 NY -5.0 Y +12854 NY -5.0 Y +12855 NY -5.0 Y +12856 NY -5.0 Y +12857 NY -5.0 Y +12858 NY -5.0 Y +12859 NY -5.0 Y +12860 NY -5.0 Y +12861 NY -5.0 Y +12862 NY -5.0 Y +12863 NY -5.0 Y +12864 NY -5.0 Y +12865 NY -5.0 Y +12866 NY -5.0 Y +12870 NY -5.0 Y +12871 NY -5.0 Y +12872 NY -5.0 Y +12873 NY -5.0 Y +12874 NY -5.0 Y +12878 NY -5.0 Y +12879 NY -5.0 Y +12883 NY -5.0 Y +12884 NY -5.0 Y +12885 NY -5.0 Y +12886 NY -5.0 Y +12887 NY -5.0 Y +12901 NY -5.0 Y +12903 NY -5.0 Y +12910 NY -5.0 Y +12911 NY -5.0 Y +12912 NY -5.0 Y +12913 NY -5.0 Y +12914 NY -5.0 Y +12915 NY -5.0 Y +12916 NY -5.0 Y +12917 NY -5.0 Y +12918 NY -5.0 Y +12919 NY -5.0 Y +12920 NY -5.0 Y +12921 NY -5.0 Y +12922 NY -5.0 Y +12923 NY -5.0 Y +12924 NY -5.0 Y +12926 NY -5.0 Y +12927 NY -5.0 Y +12928 NY -5.0 Y +12929 NY -5.0 Y +12930 NY -5.0 Y +12932 NY -5.0 Y +12933 NY -5.0 Y +12934 NY -5.0 Y +12935 NY -5.0 Y +12936 NY -5.0 Y +12937 NY -5.0 Y +12939 NY -5.0 Y +12941 NY -5.0 Y +12942 NY -5.0 Y +12943 NY -5.0 Y +12944 NY -5.0 Y +12945 NY -5.0 Y +12946 NY -5.0 Y +12949 NY -5.0 Y +12950 NY -5.0 Y +12952 NY -5.0 Y +12953 NY -5.0 Y +12955 NY -5.0 Y +12956 NY -5.0 Y +12957 NY -5.0 Y +12958 NY -5.0 Y +12959 NY -5.0 Y +12960 NY -5.0 Y +12961 NY -5.0 Y +12962 NY -5.0 Y +12964 NY -5.0 Y +12965 NY -5.0 Y +12966 NY -5.0 Y +12967 NY -5.0 Y +12969 NY -5.0 Y +12970 NY -5.0 Y +12972 NY -5.0 Y +12973 NY -5.0 Y +12974 NY -5.0 Y +12975 NY -5.0 Y +12976 NY -5.0 Y +12977 NY -5.0 Y +12978 NY -5.0 Y +12979 NY -5.0 Y +12980 NY -5.0 Y +12981 NY -5.0 Y +12983 NY -5.0 Y +12985 NY -5.0 Y +12986 NY -5.0 Y +12987 NY -5.0 Y +12989 NY -5.0 Y +12992 NY -5.0 Y +12993 NY -5.0 Y +12995 NY -5.0 Y +12996 NY -5.0 Y +12997 NY -5.0 Y +12998 NY -5.0 Y +13020 NY -5.0 Y +13021 NY -5.0 Y +13022 NY -5.0 Y +13024 NY -5.0 Y +13026 NY -5.0 Y +13027 NY -5.0 Y +13028 NY -5.0 Y +13029 NY -5.0 Y +13030 NY -5.0 Y +13031 NY -5.0 Y +13032 NY -5.0 Y +13033 NY -5.0 Y +13034 NY -5.0 Y +13035 NY -5.0 Y +13036 NY -5.0 Y +13037 NY -5.0 Y +13039 NY -5.0 Y +13040 NY -5.0 Y +13041 NY -5.0 Y +13042 NY -5.0 Y +13043 NY -5.0 Y +13044 NY -5.0 Y +13045 NY -5.0 Y +13051 NY -5.0 Y +13052 NY -5.0 Y +13053 NY -5.0 Y +13054 NY -5.0 Y +13056 NY -5.0 Y +13057 NY -5.0 Y +13060 NY -5.0 Y +13061 NY -5.0 Y +13062 NY -5.0 Y +13063 NY -5.0 Y +13064 NY -5.0 Y +13065 NY -5.0 Y +13066 NY -5.0 Y +13068 NY -5.0 Y +13069 NY -5.0 Y +13071 NY -5.0 Y +13072 NY -5.0 Y +13073 NY -5.0 Y +13074 NY -5.0 Y +13076 NY -5.0 Y +13077 NY -5.0 Y +13078 NY -5.0 Y +13080 NY -5.0 Y +13081 NY -5.0 Y +13082 NY -5.0 Y +13083 NY -5.0 Y +13084 NY -5.0 Y +13087 NY -5.0 Y +13088 NY -5.0 Y +13089 NY -5.0 Y +13090 NY -5.0 Y +13092 NY -5.0 Y +13093 NY -5.0 Y +13101 NY -5.0 Y +13102 NY -5.0 Y +13103 NY -5.0 Y +13104 NY -5.0 Y +13107 NY -5.0 Y +13108 NY -5.0 Y +13110 NY -5.0 Y +13111 NY -5.0 Y +13112 NY -5.0 Y +13113 NY -5.0 Y +13114 NY -5.0 Y +13115 NY -5.0 Y +13116 NY -5.0 Y +13117 NY -5.0 Y +13118 NY -5.0 Y +13119 NY -5.0 Y +13120 NY -5.0 Y +13121 NY -5.0 Y +13122 NY -5.0 Y +13123 NY -5.0 Y +13124 NY -5.0 Y +13126 NY -5.0 Y +13131 NY -5.0 Y +13132 NY -5.0 Y +13134 NY -5.0 Y +13135 NY -5.0 Y +13136 NY -5.0 Y +13137 NY -5.0 Y +13138 NY -5.0 Y +13139 NY -5.0 Y +13140 NY -5.0 Y +13141 NY -5.0 Y +13142 NY -5.0 Y +13143 NY -5.0 Y +13144 NY -5.0 Y +13145 NY -5.0 Y +13146 NY -5.0 Y +13147 NY -5.0 Y +13148 NY -5.0 Y +13152 NY -5.0 Y +13153 NY -5.0 Y +13154 NY -5.0 Y +13155 NY -5.0 Y +13156 NY -5.0 Y +13157 NY -5.0 Y +13158 NY -5.0 Y +13159 NY -5.0 Y +13160 NY -5.0 Y +13162 NY -5.0 Y +13163 NY -5.0 Y +13164 NY -5.0 Y +13165 NY -5.0 Y +13166 NY -5.0 Y +13167 NY -5.0 Y +13201 NY -5.0 Y +13202 NY -5.0 Y +13203 NY -5.0 Y +13204 NY -5.0 Y +13205 NY -5.0 Y +13206 NY -5.0 Y +13207 NY -5.0 Y +13208 NY -5.0 Y +13209 NY -5.0 Y +13210 NY -5.0 Y +13211 NY -5.0 Y +13212 NY -5.0 Y +13214 NY -5.0 Y +13215 NY -5.0 Y +13217 NY -5.0 Y +13218 NY -5.0 Y +13219 NY -5.0 Y +13220 NY -5.0 Y +13221 NY -5.0 Y +13224 NY -5.0 Y +13225 NY -5.0 Y +13235 NY -5.0 Y +13244 NY -5.0 Y +13250 NY -5.0 Y +13251 NY -5.0 Y +13252 NY -5.0 Y +13261 NY -5.0 Y +13290 NY -5.0 Y +13301 NY -5.0 Y +13302 NY -5.0 Y +13303 NY -5.0 Y +13304 NY -5.0 Y +13305 NY -5.0 Y +13308 NY -5.0 Y +13309 NY -5.0 Y +13310 NY -5.0 Y +13312 NY -5.0 Y +13313 NY -5.0 Y +13314 NY -5.0 Y +13315 NY -5.0 Y +13316 NY -5.0 Y +13317 NY -5.0 Y +13318 NY -5.0 Y +13319 NY -5.0 Y +13320 NY -5.0 Y +13321 NY -5.0 Y +13322 NY -5.0 Y +13323 NY -5.0 Y +13324 NY -5.0 Y +13325 NY -5.0 Y +13326 NY -5.0 Y +13327 NY -5.0 Y +13328 NY -5.0 Y +13329 NY -5.0 Y +13331 NY -5.0 Y +13332 NY -5.0 Y +13333 NY -5.0 Y +13334 NY -5.0 Y +13335 NY -5.0 Y +13337 NY -5.0 Y +13338 NY -5.0 Y +13339 NY -5.0 Y +13340 NY -5.0 Y +13341 NY -5.0 Y +13342 NY -5.0 Y +13343 NY -5.0 Y +13345 NY -5.0 Y +13346 NY -5.0 Y +13348 NY -5.0 Y +13350 NY -5.0 Y +13352 NY -5.0 Y +13353 NY -5.0 Y +13354 NY -5.0 Y +13355 NY -5.0 Y +13357 NY -5.0 Y +13360 NY -5.0 Y +13361 NY -5.0 Y +13362 NY -5.0 Y +13363 NY -5.0 Y +13364 NY -5.0 Y +13365 NY -5.0 Y +13367 NY -5.0 Y +13368 NY -5.0 Y +13401 NY -5.0 Y +13402 NY -5.0 Y +13403 NY -5.0 Y +13404 NY -5.0 Y +13406 NY -5.0 Y +13407 NY -5.0 Y +13408 NY -5.0 Y +13409 NY -5.0 Y +13410 NY -5.0 Y +13411 NY -5.0 Y +13413 NY -5.0 Y +13415 NY -5.0 Y +13416 NY -5.0 Y +13417 NY -5.0 Y +13418 NY -5.0 Y +13420 NY -5.0 Y +13421 NY -5.0 Y +13424 NY -5.0 Y +13425 NY -5.0 Y +13426 NY -5.0 Y +13428 NY -5.0 Y +13431 NY -5.0 Y +13433 NY -5.0 Y +13435 NY -5.0 Y +13436 NY -5.0 Y +13437 NY -5.0 Y +13438 NY -5.0 Y +13439 NY -5.0 Y +13440 NY -5.0 Y +13441 NY -5.0 Y +13442 NY -5.0 Y +13449 NY -5.0 Y +13450 NY -5.0 Y +13452 NY -5.0 Y +13454 NY -5.0 Y +13455 NY -5.0 Y +13456 NY -5.0 Y +13457 NY -5.0 Y +13459 NY -5.0 Y +13460 NY -5.0 Y +13461 NY -5.0 Y +13464 NY -5.0 Y +13465 NY -5.0 Y +13468 NY -5.0 Y +13469 NY -5.0 Y +13470 NY -5.0 Y +13471 NY -5.0 Y +13472 NY -5.0 Y +13473 NY -5.0 Y +13475 NY -5.0 Y +13476 NY -5.0 Y +13477 NY -5.0 Y +13478 NY -5.0 Y +13479 NY -5.0 Y +13480 NY -5.0 Y +13482 NY -5.0 Y +13483 NY -5.0 Y +13484 NY -5.0 Y +13485 NY -5.0 Y +13486 NY -5.0 Y +13488 NY -5.0 Y +13489 NY -5.0 Y +13490 NY -5.0 Y +13491 NY -5.0 Y +13492 NY -5.0 Y +13493 NY -5.0 Y +13494 NY -5.0 Y +13495 NY -5.0 Y +13501 NY -5.0 Y +13502 NY -5.0 Y +13503 NY -5.0 Y +13504 NY -5.0 Y +13505 NY -5.0 Y +13599 NY -5.0 Y +13601 NY -5.0 Y +13602 NY -5.0 Y +13603 NY -5.0 Y +13605 NY -5.0 Y +13606 NY -5.0 Y +13607 NY -5.0 Y +13608 NY -5.0 Y +13611 NY -5.0 Y +13612 NY -5.0 Y +13613 NY -5.0 Y +13614 NY -5.0 Y +13615 NY -5.0 Y +13616 NY -5.0 Y +13617 NY -5.0 Y +13618 NY -5.0 Y +13619 NY -5.0 Y +13620 NY -5.0 Y +13621 NY -5.0 Y +13622 NY -5.0 Y +13623 NY -5.0 Y +13624 NY -5.0 Y +13625 NY -5.0 Y +13626 NY -5.0 Y +13627 NY -5.0 Y +13628 NY -5.0 Y +13630 NY -5.0 Y +13631 NY -5.0 Y +13632 NY -5.0 Y +13633 NY -5.0 Y +13634 NY -5.0 Y +13635 NY -5.0 Y +13636 NY -5.0 Y +13637 NY -5.0 Y +13638 NY -5.0 Y +13639 NY -5.0 Y +13640 NY -5.0 Y +13641 NY -5.0 Y +13642 NY -5.0 Y +13643 NY -5.0 Y +13645 NY -5.0 Y +13646 NY -5.0 Y +13647 NY -5.0 Y +13648 NY -5.0 Y +13649 NY -5.0 Y +13650 NY -5.0 Y +13651 NY -5.0 Y +13652 NY -5.0 Y +13654 NY -5.0 Y +13655 NY -5.0 Y +13656 NY -5.0 Y +13657 NY -5.0 Y +13658 NY -5.0 Y +13659 NY -5.0 Y +13660 NY -5.0 Y +13661 NY -5.0 Y +13662 NY -5.0 Y +13664 NY -5.0 Y +13665 NY -5.0 Y +13666 NY -5.0 Y +13667 NY -5.0 Y +13668 NY -5.0 Y +13669 NY -5.0 Y +13670 NY -5.0 Y +13671 NY -5.0 Y +13672 NY -5.0 Y +13673 NY -5.0 Y +13674 NY -5.0 Y +13675 NY -5.0 Y +13676 NY -5.0 Y +13677 NY -5.0 Y +13678 NY -5.0 Y +13679 NY -5.0 Y +13680 NY -5.0 Y +13681 NY -5.0 Y +13682 NY -5.0 Y +13683 NY -5.0 Y +13684 NY -5.0 Y +13685 NY -5.0 Y +13687 NY -5.0 Y +13690 NY -5.0 Y +13691 NY -5.0 Y +13692 NY -5.0 Y +13693 NY -5.0 Y +13694 NY -5.0 Y +13695 NY -5.0 Y +13696 NY -5.0 Y +13697 NY -5.0 Y +13699 NY -5.0 Y +13730 NY -5.0 Y +13731 NY -5.0 Y +13732 NY -5.0 Y +13733 NY -5.0 Y +13734 NY -5.0 Y +13736 NY -5.0 Y +13737 NY -5.0 Y +13738 NY -5.0 Y +13739 NY -5.0 Y +13740 NY -5.0 Y +13743 NY -5.0 Y +13744 NY -5.0 Y +13745 NY -5.0 Y +13746 NY -5.0 Y +13747 NY -5.0 Y +13748 NY -5.0 Y +13749 NY -5.0 Y +13750 NY -5.0 Y +13751 NY -5.0 Y +13752 NY -5.0 Y +13753 NY -5.0 Y +13754 NY -5.0 Y +13755 NY -5.0 Y +13756 NY -5.0 Y +13757 NY -5.0 Y +13758 NY -5.0 Y +13760 NY -5.0 Y +13761 NY -5.0 Y +13762 NY -5.0 Y +13763 NY -5.0 Y +13774 NY -5.0 Y +13775 NY -5.0 Y +13776 NY -5.0 Y +13777 NY -5.0 Y +13778 NY -5.0 Y +13780 NY -5.0 Y +13782 NY -5.0 Y +13783 NY -5.0 Y +13784 NY -5.0 Y +13786 NY -5.0 Y +13787 NY -5.0 Y +13788 NY -5.0 Y +13790 NY -5.0 Y +13794 NY -5.0 Y +13795 NY -5.0 Y +13796 NY -5.0 Y +13797 NY -5.0 Y +13801 NY -5.0 Y +13802 NY -5.0 Y +13803 NY -5.0 Y +13804 NY -5.0 Y +13806 NY -5.0 Y +13807 NY -5.0 Y +13808 NY -5.0 Y +13809 NY -5.0 Y +13810 NY -5.0 Y +13811 NY -5.0 Y +13812 NY -5.0 Y +13813 NY -5.0 Y +13814 NY -5.0 Y +13815 NY -5.0 Y +13820 NY -5.0 Y +13825 NY -5.0 Y +13826 NY -5.0 Y +13827 NY -5.0 Y +13830 NY -5.0 Y +13832 NY -5.0 Y +13833 NY -5.0 Y +13834 NY -5.0 Y +13835 NY -5.0 Y +13837 NY -5.0 Y +13838 NY -5.0 Y +13839 NY -5.0 Y +13840 NY -5.0 Y +13841 NY -5.0 Y +13842 NY -5.0 Y +13843 NY -5.0 Y +13844 NY -5.0 Y +13845 NY -5.0 Y +13846 NY -5.0 Y +13847 NY -5.0 Y +13848 NY -5.0 Y +13849 NY -5.0 Y +13850 NY -5.0 Y +13851 NY -5.0 Y +13856 NY -5.0 Y +13859 NY -5.0 Y +13860 NY -5.0 Y +13861 NY -5.0 Y +13862 NY -5.0 Y +13863 NY -5.0 Y +13864 NY -5.0 Y +13865 NY -5.0 Y +13901 NY -5.0 Y +13902 NY -5.0 Y +13903 NY -5.0 Y +13904 NY -5.0 Y +13905 NY -5.0 Y +14001 NY -5.0 Y +14004 NY -5.0 Y +14005 NY -5.0 Y +14006 NY -5.0 Y +14008 NY -5.0 Y +14009 NY -5.0 Y +14010 NY -5.0 Y +14011 NY -5.0 Y +14012 NY -5.0 Y +14013 NY -5.0 Y +14020 NY -5.0 Y +14021 NY -5.0 Y +14024 NY -5.0 Y +14025 NY -5.0 Y +14026 NY -5.0 Y +14027 NY -5.0 Y +14028 NY -5.0 Y +14029 NY -5.0 Y +14030 NY -5.0 Y +14031 NY -5.0 Y +14032 NY -5.0 Y +14033 NY -5.0 Y +14034 NY -5.0 Y +14035 NY -5.0 Y +14036 NY -5.0 Y +14037 NY -5.0 Y +14038 NY -5.0 Y +14039 NY -5.0 Y +14040 NY -5.0 Y +14041 NY -5.0 Y +14042 NY -5.0 Y +14043 NY -5.0 Y +14047 NY -5.0 Y +14048 NY -5.0 Y +14051 NY -5.0 Y +14052 NY -5.0 Y +14054 NY -5.0 Y +14055 NY -5.0 Y +14056 NY -5.0 Y +14057 NY -5.0 Y +14058 NY -5.0 Y +14059 NY -5.0 Y +14060 NY -5.0 Y +14061 NY -5.0 Y +14062 NY -5.0 Y +14063 NY -5.0 Y +14065 NY -5.0 Y +14066 NY -5.0 Y +14067 NY -5.0 Y +14068 NY -5.0 Y +14069 NY -5.0 Y +14070 NY -5.0 Y +14072 NY -5.0 Y +14075 NY -5.0 Y +14080 NY -5.0 Y +14081 NY -5.0 Y +14082 NY -5.0 Y +14083 NY -5.0 Y +14085 NY -5.0 Y +14086 NY -5.0 Y +14091 NY -5.0 Y +14092 NY -5.0 Y +14094 NY -5.0 Y +14095 NY -5.0 Y +14098 NY -5.0 Y +14101 NY -5.0 Y +14102 NY -5.0 Y +14103 NY -5.0 Y +14105 NY -5.0 Y +14107 NY -5.0 Y +14108 NY -5.0 Y +14109 NY -5.0 Y +14110 NY -5.0 Y +14111 NY -5.0 Y +14112 NY -5.0 Y +14113 NY -5.0 Y +14120 NY -5.0 Y +14125 NY -5.0 Y +14126 NY -5.0 Y +14127 NY -5.0 Y +14129 NY -5.0 Y +14130 NY -5.0 Y +14131 NY -5.0 Y +14132 NY -5.0 Y +14133 NY -5.0 Y +14134 NY -5.0 Y +14135 NY -5.0 Y +14136 NY -5.0 Y +14138 NY -5.0 Y +14139 NY -5.0 Y +14140 NY -5.0 Y +14141 NY -5.0 Y +14143 NY -5.0 Y +14144 NY -5.0 Y +14145 NY -5.0 Y +14150 NY -5.0 Y +14151 NY -5.0 Y +14166 NY -5.0 Y +14167 NY -5.0 Y +14168 NY -5.0 Y +14169 NY -5.0 Y +14170 NY -5.0 Y +14171 NY -5.0 Y +14172 NY -5.0 Y +14173 NY -5.0 Y +14174 NY -5.0 Y +14201 NY -5.0 Y +14202 NY -5.0 Y +14203 NY -5.0 Y +14204 NY -5.0 Y +14205 NY -5.0 Y +14206 NY -5.0 Y +14207 NY -5.0 Y +14208 NY -5.0 Y +14209 NY -5.0 Y +14210 NY -5.0 Y +14211 NY -5.0 Y +14212 NY -5.0 Y +14213 NY -5.0 Y +14214 NY -5.0 Y +14215 NY -5.0 Y +14216 NY -5.0 Y +14217 NY -5.0 Y +14218 NY -5.0 Y +14219 NY -5.0 Y +14220 NY -5.0 Y +14221 NY -5.0 Y +14222 NY -5.0 Y +14223 NY -5.0 Y +14224 NY -5.0 Y +14225 NY -5.0 Y +14226 NY -5.0 Y +14227 NY -5.0 Y +14228 NY -5.0 Y +14231 NY -5.0 Y +14233 NY -5.0 Y +14240 NY -5.0 Y +14241 NY -5.0 Y +14260 NY -5.0 Y +14261 NY -5.0 Y +14263 NY -5.0 Y +14264 NY -5.0 Y +14265 NY -5.0 Y +14267 NY -5.0 Y +14269 NY -5.0 Y +14270 NY -5.0 Y +14272 NY -5.0 Y +14273 NY -5.0 Y +14276 NY -5.0 Y +14280 NY -5.0 Y +14301 NY -5.0 Y +14302 NY -5.0 Y +14303 NY -5.0 Y +14304 NY -5.0 Y +14305 NY -5.0 Y +14410 NY -5.0 Y +14411 NY -5.0 Y +14413 NY -5.0 Y +14414 NY -5.0 Y +14415 NY -5.0 Y +14416 NY -5.0 Y +14418 NY -5.0 Y +14420 NY -5.0 Y +14422 NY -5.0 Y +14423 NY -5.0 Y +14424 NY -5.0 Y +14425 NY -5.0 Y +14427 NY -5.0 Y +14428 NY -5.0 Y +14429 NY -5.0 Y +14430 NY -5.0 Y +14432 NY -5.0 Y +14433 NY -5.0 Y +14435 NY -5.0 Y +14437 NY -5.0 Y +14441 NY -5.0 Y +14443 NY -5.0 Y +14445 NY -5.0 Y +14449 NY -5.0 Y +14450 NY -5.0 Y +14452 NY -5.0 Y +14453 NY -5.0 Y +14454 NY -5.0 Y +14456 NY -5.0 Y +14461 NY -5.0 Y +14462 NY -5.0 Y +14463 NY -5.0 Y +14464 NY -5.0 Y +14466 NY -5.0 Y +14467 NY -5.0 Y +14468 NY -5.0 Y +14469 NY -5.0 Y +14470 NY -5.0 Y +14471 NY -5.0 Y +14472 NY -5.0 Y +14475 NY -5.0 Y +14476 NY -5.0 Y +14477 NY -5.0 Y +14478 NY -5.0 Y +14479 NY -5.0 Y +14480 NY -5.0 Y +14481 NY -5.0 Y +14482 NY -5.0 Y +14485 NY -5.0 Y +14486 NY -5.0 Y +14487 NY -5.0 Y +14488 NY -5.0 Y +14489 NY -5.0 Y +14502 NY -5.0 Y +14504 NY -5.0 Y +14505 NY -5.0 Y +14506 NY -5.0 Y +14507 NY -5.0 Y +14508 NY -5.0 Y +14510 NY -5.0 Y +14511 NY -5.0 Y +14512 NY -5.0 Y +14513 NY -5.0 Y +14514 NY -5.0 Y +14515 NY -5.0 Y +14516 NY -5.0 Y +14517 NY -5.0 Y +14518 NY -5.0 Y +14519 NY -5.0 Y +14520 NY -5.0 Y +14521 NY -5.0 Y +14522 NY -5.0 Y +14525 NY -5.0 Y +14526 NY -5.0 Y +14527 NY -5.0 Y +14529 NY -5.0 Y +14530 NY -5.0 Y +14532 NY -5.0 Y +14533 NY -5.0 Y +14534 NY -5.0 Y +14536 NY -5.0 Y +14537 NY -5.0 Y +14538 NY -5.0 Y +14539 NY -5.0 Y +14541 NY -5.0 Y +14542 NY -5.0 Y +14543 NY -5.0 Y +14544 NY -5.0 Y +14545 NY -5.0 Y +14546 NY -5.0 Y +14547 NY -5.0 Y +14548 NY -5.0 Y +14549 NY -5.0 Y +14550 NY -5.0 Y +14551 NY -5.0 Y +14555 NY -5.0 Y +14556 NY -5.0 Y +14557 NY -5.0 Y +14558 NY -5.0 Y +14559 NY -5.0 Y +14560 NY -5.0 Y +14561 NY -5.0 Y +14563 NY -5.0 Y +14564 NY -5.0 Y +14568 NY -5.0 Y +14569 NY -5.0 Y +14571 NY -5.0 Y +14572 NY -5.0 Y +14580 NY -5.0 Y +14585 NY -5.0 Y +14586 NY -5.0 Y +14588 NY -5.0 Y +14589 NY -5.0 Y +14590 NY -5.0 Y +14591 NY -5.0 Y +14592 NY -5.0 Y +14602 NY -5.0 Y +14603 NY -5.0 Y +14604 NY -5.0 Y +14605 NY -5.0 Y +14606 NY -5.0 Y +14607 NY -5.0 Y +14608 NY -5.0 Y +14609 NY -5.0 Y +14610 NY -5.0 Y +14611 NY -5.0 Y +14612 NY -5.0 Y +14613 NY -5.0 Y +14614 NY -5.0 Y +14615 NY -5.0 Y +14616 NY -5.0 Y +14617 NY -5.0 Y +14618 NY -5.0 Y +14619 NY -5.0 Y +14620 NY -5.0 Y +14621 NY -5.0 Y +14622 NY -5.0 Y +14623 NY -5.0 Y +14624 NY -5.0 Y +14625 NY -5.0 Y +14626 NY -5.0 Y +14627 NY -5.0 Y +14638 NY -5.0 Y +14639 NY -5.0 Y +14642 NY -5.0 Y +14643 NY -5.0 Y +14644 NY -5.0 Y +14645 NY -5.0 Y +14646 NY -5.0 Y +14647 NY -5.0 Y +14649 NY -5.0 Y +14650 NY -5.0 Y +14651 NY -5.0 Y +14652 NY -5.0 Y +14653 NY -5.0 Y +14664 NY -5.0 Y +14673 NY -5.0 Y +14683 NY -5.0 Y +14692 NY -5.0 Y +14694 NY -5.0 Y +14701 NY -5.0 Y +14702 NY -5.0 Y +14706 NY -5.0 Y +14707 NY -5.0 Y +14708 NY -5.0 Y +14709 NY -5.0 Y +14710 NY -5.0 Y +14711 NY -5.0 Y +14712 NY -5.0 Y +14714 NY -5.0 Y +14715 NY -5.0 Y +14716 NY -5.0 Y +14717 NY -5.0 Y +14718 NY -5.0 Y +14719 NY -5.0 Y +14720 NY -5.0 Y +14721 NY -5.0 Y +14722 NY -5.0 Y +14723 NY -5.0 Y +14724 NY -5.0 Y +14726 NY -5.0 Y +14727 NY -5.0 Y +14728 NY -5.0 Y +14729 NY -5.0 Y +14730 NY -5.0 Y +14731 NY -5.0 Y +14732 NY -5.0 Y +14733 NY -5.0 Y +14735 NY -5.0 Y +14736 NY -5.0 Y +14737 NY -5.0 Y +14738 NY -5.0 Y +14739 NY -5.0 Y +14740 NY -5.0 Y +14741 NY -5.0 Y +14742 NY -5.0 Y +14743 NY -5.0 Y +14744 NY -5.0 Y +14745 NY -5.0 Y +14747 NY -5.0 Y +14748 NY -5.0 Y +14750 NY -5.0 Y +14751 NY -5.0 Y +14752 NY -5.0 Y +14753 NY -5.0 Y +14754 NY -5.0 Y +14755 NY -5.0 Y +14756 NY -5.0 Y +14757 NY -5.0 Y +14758 NY -5.0 Y +14760 NY -5.0 Y +14766 NY -5.0 Y +14767 NY -5.0 Y +14769 NY -5.0 Y +14770 NY -5.0 Y +14772 NY -5.0 Y +14774 NY -5.0 Y +14775 NY -5.0 Y +14777 NY -5.0 Y +14778 NY -5.0 Y +14779 NY -5.0 Y +14781 NY -5.0 Y +14782 NY -5.0 Y +14783 NY -5.0 Y +14784 NY -5.0 Y +14785 NY -5.0 Y +14786 NY -5.0 Y +14787 NY -5.0 Y +14788 NY -5.0 Y +14801 NY -5.0 Y +14802 NY -5.0 Y +14803 NY -5.0 Y +14804 NY -5.0 Y +14805 NY -5.0 Y +14806 NY -5.0 Y +14807 NY -5.0 Y +14808 NY -5.0 Y +14809 NY -5.0 Y +14810 NY -5.0 Y +14812 NY -5.0 Y +14813 NY -5.0 Y +14814 NY -5.0 Y +14815 NY -5.0 Y +14816 NY -5.0 Y +14817 NY -5.0 Y +14818 NY -5.0 Y +14819 NY -5.0 Y +14820 NY -5.0 Y +14821 NY -5.0 Y +14822 NY -5.0 Y +14823 NY -5.0 Y +14824 NY -5.0 Y +14825 NY -5.0 Y +14826 NY -5.0 Y +14827 NY -5.0 Y +14830 NY -5.0 Y +14831 NY -5.0 Y +14836 NY -5.0 Y +14837 NY -5.0 Y +14838 NY -5.0 Y +14839 NY -5.0 Y +14840 NY -5.0 Y +14841 NY -5.0 Y +14842 NY -5.0 Y +14843 NY -5.0 Y +14845 NY -5.0 Y +14846 NY -5.0 Y +14847 NY -5.0 Y +14850 NY -5.0 Y +14851 NY -5.0 Y +14852 NY -5.0 Y +14853 NY -5.0 Y +14854 NY -5.0 Y +14855 NY -5.0 Y +14856 NY -5.0 Y +14857 NY -5.0 Y +14858 NY -5.0 Y +14859 NY -5.0 Y +14860 NY -5.0 Y +14861 NY -5.0 Y +14863 NY -5.0 Y +14864 NY -5.0 Y +14865 NY -5.0 Y +14867 NY -5.0 Y +14869 NY -5.0 Y +14870 NY -5.0 Y +14871 NY -5.0 Y +14872 NY -5.0 Y +14873 NY -5.0 Y +14874 NY -5.0 Y +14876 NY -5.0 Y +14877 NY -5.0 Y +14878 NY -5.0 Y +14879 NY -5.0 Y +14880 NY -5.0 Y +14881 NY -5.0 Y +14882 NY -5.0 Y +14883 NY -5.0 Y +14884 NY -5.0 Y +14885 NY -5.0 Y +14886 NY -5.0 Y +14887 NY -5.0 Y +14889 NY -5.0 Y +14891 NY -5.0 Y +14892 NY -5.0 Y +14893 NY -5.0 Y +14894 NY -5.0 Y +14895 NY -5.0 Y +14897 NY -5.0 Y +14898 NY -5.0 Y +14901 NY -5.0 Y +14902 NY -5.0 Y +14903 NY -5.0 Y +14904 NY -5.0 Y +14905 NY -5.0 Y +14925 NY -5.0 Y +15001 PA -5.0 Y +15003 PA -5.0 Y +15004 PA -5.0 Y +15005 PA -5.0 Y +15006 PA -5.0 Y +15007 PA -5.0 Y +15009 PA -5.0 Y +15010 PA -5.0 Y +15012 PA -5.0 Y +15014 PA -5.0 Y +15015 PA -5.0 Y +15017 PA -5.0 Y +15018 PA -5.0 Y +15019 PA -5.0 Y +15020 PA -5.0 Y +15021 PA -5.0 Y +15022 PA -5.0 Y +15024 PA -5.0 Y +15025 PA -5.0 Y +15026 PA -5.0 Y +15027 PA -5.0 Y +15028 PA -5.0 Y +15030 PA -5.0 Y +15031 PA -5.0 Y +15032 PA -5.0 Y +15033 PA -5.0 Y +15034 PA -5.0 Y +15035 PA -5.0 Y +15037 PA -5.0 Y +15038 PA -5.0 Y +15042 PA -5.0 Y +15043 PA -5.0 Y +15044 PA -5.0 Y +15045 PA -5.0 Y +15046 PA -5.0 Y +15047 PA -5.0 Y +15049 PA -5.0 Y +15050 PA -5.0 Y +15051 PA -5.0 Y +15052 PA -5.0 Y +15053 PA -5.0 Y +15054 PA -5.0 Y +15055 PA -5.0 Y +15056 PA -5.0 Y +15057 PA -5.0 Y +15059 PA -5.0 Y +15060 PA -5.0 Y +15061 PA -5.0 Y +15062 PA -5.0 Y +15063 PA -5.0 Y +15064 PA -5.0 Y +15065 PA -5.0 Y +15066 PA -5.0 Y +15067 PA -5.0 Y +15068 PA -5.0 Y +15069 PA -5.0 Y +15071 PA -5.0 Y +15072 PA -5.0 Y +15074 PA -5.0 Y +15075 PA -5.0 Y +15076 PA -5.0 Y +15077 PA -5.0 Y +15078 PA -5.0 Y +15081 PA -5.0 Y +15082 PA -5.0 Y +15083 PA -5.0 Y +15084 PA -5.0 Y +15085 PA -5.0 Y +15086 PA -5.0 Y +15087 PA -5.0 Y +15088 PA -5.0 Y +15089 PA -5.0 Y +15090 PA -5.0 Y +15091 PA -5.0 Y +15095 PA -5.0 Y +15096 PA -5.0 Y +15101 PA -5.0 Y +15102 PA -5.0 Y +15104 PA -5.0 Y +15106 PA -5.0 Y +15108 PA -5.0 Y +15110 PA -5.0 Y +15112 PA -5.0 Y +15116 PA -5.0 Y +15120 PA -5.0 Y +15122 PA -5.0 Y +15123 PA -5.0 Y +15126 PA -5.0 Y +15127 PA -5.0 Y +15129 PA -5.0 Y +15131 PA -5.0 Y +15132 PA -5.0 Y +15133 PA -5.0 Y +15134 PA -5.0 Y +15135 PA -5.0 Y +15136 PA -5.0 Y +15137 PA -5.0 Y +15139 PA -5.0 Y +15140 PA -5.0 Y +15142 PA -5.0 Y +15143 PA -5.0 Y +15144 PA -5.0 Y +15145 PA -5.0 Y +15146 PA -5.0 Y +15147 PA -5.0 Y +15148 PA -5.0 Y +15201 PA -5.0 Y +15202 PA -5.0 Y +15203 PA -5.0 Y +15204 PA -5.0 Y +15205 PA -5.0 Y +15206 PA -5.0 Y +15207 PA -5.0 Y +15208 PA -5.0 Y +15209 PA -5.0 Y +15210 PA -5.0 Y +15211 PA -5.0 Y +15212 PA -5.0 Y +15213 PA -5.0 Y +15214 PA -5.0 Y +15215 PA -5.0 Y +15216 PA -5.0 Y +15217 PA -5.0 Y +15218 PA -5.0 Y +15219 PA -5.0 Y +15220 PA -5.0 Y +15221 PA -5.0 Y +15222 PA -5.0 Y +15223 PA -5.0 Y +15224 PA -5.0 Y +15225 PA -5.0 Y +15226 PA -5.0 Y +15227 PA -5.0 Y +15228 PA -5.0 Y +15229 PA -5.0 Y +15230 PA -5.0 Y +15231 PA -5.0 Y +15232 PA -5.0 Y +15233 PA -5.0 Y +15234 PA -5.0 Y +15235 PA -5.0 Y +15236 PA -5.0 Y +15237 PA -5.0 Y +15238 PA -5.0 Y +15239 PA -5.0 Y +15240 PA -5.0 Y +15241 PA -5.0 Y +15242 PA -5.0 Y +15243 PA -5.0 Y +15244 PA -5.0 Y +15250 PA -5.0 Y +15251 PA -5.0 Y +15252 PA -5.0 Y +15253 PA -5.0 Y +15254 PA -5.0 Y +15255 PA -5.0 Y +15257 PA -5.0 Y +15258 PA -5.0 Y +15259 PA -5.0 Y +15260 PA -5.0 Y +15261 PA -5.0 Y +15262 PA -5.0 Y +15263 PA -5.0 Y +15264 PA -5.0 Y +15265 PA -5.0 Y +15267 PA -5.0 Y +15268 PA -5.0 Y +15270 PA -5.0 Y +15272 PA -5.0 Y +15274 PA -5.0 Y +15275 PA -5.0 Y +15276 PA -5.0 Y +15277 PA -5.0 Y +15278 PA -5.0 Y +15279 PA -5.0 Y +15281 PA -5.0 Y +15282 PA -5.0 Y +15283 PA -5.0 Y +15285 PA -5.0 Y +15286 PA -5.0 Y +15289 PA -5.0 Y +15290 PA -5.0 Y +15295 PA -5.0 Y +15301 PA -5.0 Y +15310 PA -5.0 Y +15311 PA -5.0 Y +15312 PA -5.0 Y +15313 PA -5.0 Y +15314 PA -5.0 Y +15315 PA -5.0 Y +15316 PA -5.0 Y +15317 PA -5.0 Y +15320 PA -5.0 Y +15321 PA -5.0 Y +15322 PA -5.0 Y +15323 PA -5.0 Y +15324 PA -5.0 Y +15325 PA -5.0 Y +15327 PA -5.0 Y +15329 PA -5.0 Y +15330 PA -5.0 Y +15331 PA -5.0 Y +15332 PA -5.0 Y +15333 PA -5.0 Y +15334 PA -5.0 Y +15336 PA -5.0 Y +15337 PA -5.0 Y +15338 PA -5.0 Y +15339 PA -5.0 Y +15340 PA -5.0 Y +15341 PA -5.0 Y +15342 PA -5.0 Y +15344 PA -5.0 Y +15345 PA -5.0 Y +15346 PA -5.0 Y +15347 PA -5.0 Y +15348 PA -5.0 Y +15349 PA -5.0 Y +15350 PA -5.0 Y +15351 PA -5.0 Y +15352 PA -5.0 Y +15353 PA -5.0 Y +15357 PA -5.0 Y +15358 PA -5.0 Y +15359 PA -5.0 Y +15360 PA -5.0 Y +15361 PA -5.0 Y +15362 PA -5.0 Y +15363 PA -5.0 Y +15364 PA -5.0 Y +15365 PA -5.0 Y +15366 PA -5.0 Y +15367 PA -5.0 Y +15368 PA -5.0 Y +15370 PA -5.0 Y +15376 PA -5.0 Y +15377 PA -5.0 Y +15378 PA -5.0 Y +15379 PA -5.0 Y +15380 PA -5.0 Y +15401 PA -5.0 Y +15410 PA -5.0 Y +15411 PA -5.0 Y +15412 PA -5.0 Y +15413 PA -5.0 Y +15415 PA -5.0 Y +15416 PA -5.0 Y +15417 PA -5.0 Y +15419 PA -5.0 Y +15420 PA -5.0 Y +15421 PA -5.0 Y +15422 PA -5.0 Y +15423 PA -5.0 Y +15424 PA -5.0 Y +15425 PA -5.0 Y +15427 PA -5.0 Y +15428 PA -5.0 Y +15429 PA -5.0 Y +15430 PA -5.0 Y +15431 PA -5.0 Y +15432 PA -5.0 Y +15433 PA -5.0 Y +15434 PA -5.0 Y +15435 PA -5.0 Y +15436 PA -5.0 Y +15437 PA -5.0 Y +15438 PA -5.0 Y +15439 PA -5.0 Y +15440 PA -5.0 Y +15442 PA -5.0 Y +15443 PA -5.0 Y +15444 PA -5.0 Y +15445 PA -5.0 Y +15446 PA -5.0 Y +15447 PA -5.0 Y +15448 PA -5.0 Y +15449 PA -5.0 Y +15450 PA -5.0 Y +15451 PA -5.0 Y +15454 PA -5.0 Y +15455 PA -5.0 Y +15456 PA -5.0 Y +15458 PA -5.0 Y +15459 PA -5.0 Y +15460 PA -5.0 Y +15461 PA -5.0 Y +15462 PA -5.0 Y +15463 PA -5.0 Y +15464 PA -5.0 Y +15465 PA -5.0 Y +15466 PA -5.0 Y +15467 PA -5.0 Y +15468 PA -5.0 Y +15469 PA -5.0 Y +15470 PA -5.0 Y +15472 PA -5.0 Y +15473 PA -5.0 Y +15474 PA -5.0 Y +15475 PA -5.0 Y +15476 PA -5.0 Y +15477 PA -5.0 Y +15478 PA -5.0 Y +15479 PA -5.0 Y +15480 PA -5.0 Y +15482 PA -5.0 Y +15483 PA -5.0 Y +15484 PA -5.0 Y +15485 PA -5.0 Y +15486 PA -5.0 Y +15488 PA -5.0 Y +15489 PA -5.0 Y +15490 PA -5.0 Y +15492 PA -5.0 Y +15501 PA -5.0 Y +15502 PA -5.0 Y +15510 PA -5.0 Y +15520 PA -5.0 Y +15521 PA -5.0 Y +15522 PA -5.0 Y +15530 PA -5.0 Y +15531 PA -5.0 Y +15532 PA -5.0 Y +15533 PA -5.0 Y +15534 PA -5.0 Y +15535 PA -5.0 Y +15536 PA -5.0 Y +15537 PA -5.0 Y +15538 PA -5.0 Y +15539 PA -5.0 Y +15540 PA -5.0 Y +15541 PA -5.0 Y +15542 PA -5.0 Y +15544 PA -5.0 Y +15545 PA -5.0 Y +15546 PA -5.0 Y +15547 PA -5.0 Y +15548 PA -5.0 Y +15549 PA -5.0 Y +15550 PA -5.0 Y +15551 PA -5.0 Y +15552 PA -5.0 Y +15553 PA -5.0 Y +15554 PA -5.0 Y +15555 PA -5.0 Y +15557 PA -5.0 Y +15558 PA -5.0 Y +15559 PA -5.0 Y +15560 PA -5.0 Y +15561 PA -5.0 Y +15562 PA -5.0 Y +15563 PA -5.0 Y +15564 PA -5.0 Y +15565 PA -5.0 Y +15601 PA -5.0 Y +15605 PA -5.0 Y +15606 PA -5.0 Y +15610 PA -5.0 Y +15611 PA -5.0 Y +15612 PA -5.0 Y +15613 PA -5.0 Y +15615 PA -5.0 Y +15616 PA -5.0 Y +15617 PA -5.0 Y +15618 PA -5.0 Y +15619 PA -5.0 Y +15620 PA -5.0 Y +15621 PA -5.0 Y +15622 PA -5.0 Y +15623 PA -5.0 Y +15624 PA -5.0 Y +15625 PA -5.0 Y +15626 PA -5.0 Y +15627 PA -5.0 Y +15628 PA -5.0 Y +15629 PA -5.0 Y +15631 PA -5.0 Y +15632 PA -5.0 Y +15633 PA -5.0 Y +15634 PA -5.0 Y +15635 PA -5.0 Y +15636 PA -5.0 Y +15637 PA -5.0 Y +15638 PA -5.0 Y +15639 PA -5.0 Y +15640 PA -5.0 Y +15641 PA -5.0 Y +15642 PA -5.0 Y +15644 PA -5.0 Y +15646 PA -5.0 Y +15647 PA -5.0 Y +15650 PA -5.0 Y +15655 PA -5.0 Y +15656 PA -5.0 Y +15658 PA -5.0 Y +15660 PA -5.0 Y +15661 PA -5.0 Y +15662 PA -5.0 Y +15663 PA -5.0 Y +15664 PA -5.0 Y +15665 PA -5.0 Y +15666 PA -5.0 Y +15668 PA -5.0 Y +15670 PA -5.0 Y +15671 PA -5.0 Y +15672 PA -5.0 Y +15673 PA -5.0 Y +15674 PA -5.0 Y +15675 PA -5.0 Y +15676 PA -5.0 Y +15677 PA -5.0 Y +15678 PA -5.0 Y +15679 PA -5.0 Y +15680 PA -5.0 Y +15681 PA -5.0 Y +15682 PA -5.0 Y +15683 PA -5.0 Y +15684 PA -5.0 Y +15685 PA -5.0 Y +15686 PA -5.0 Y +15687 PA -5.0 Y +15688 PA -5.0 Y +15689 PA -5.0 Y +15690 PA -5.0 Y +15691 PA -5.0 Y +15692 PA -5.0 Y +15693 PA -5.0 Y +15695 PA -5.0 Y +15696 PA -5.0 Y +15697 PA -5.0 Y +15698 PA -5.0 Y +15701 PA -5.0 Y +15705 PA -5.0 Y +15710 PA -5.0 Y +15711 PA -5.0 Y +15712 PA -5.0 Y +15713 PA -5.0 Y +15714 PA -5.0 Y +15715 PA -5.0 Y +15716 PA -5.0 Y +15717 PA -5.0 Y +15720 PA -5.0 Y +15721 PA -5.0 Y +15722 PA -5.0 Y +15723 PA -5.0 Y +15724 PA -5.0 Y +15725 PA -5.0 Y +15727 PA -5.0 Y +15728 PA -5.0 Y +15729 PA -5.0 Y +15730 PA -5.0 Y +15731 PA -5.0 Y +15732 PA -5.0 Y +15733 PA -5.0 Y +15734 PA -5.0 Y +15736 PA -5.0 Y +15737 PA -5.0 Y +15738 PA -5.0 Y +15739 PA -5.0 Y +15740 PA -5.0 Y +15741 PA -5.0 Y +15742 PA -5.0 Y +15744 PA -5.0 Y +15745 PA -5.0 Y +15746 PA -5.0 Y +15747 PA -5.0 Y +15748 PA -5.0 Y +15750 PA -5.0 Y +15752 PA -5.0 Y +15753 PA -5.0 Y +15754 PA -5.0 Y +15756 PA -5.0 Y +15757 PA -5.0 Y +15758 PA -5.0 Y +15759 PA -5.0 Y +15760 PA -5.0 Y +15761 PA -5.0 Y +15762 PA -5.0 Y +15763 PA -5.0 Y +15764 PA -5.0 Y +15765 PA -5.0 Y +15767 PA -5.0 Y +15770 PA -5.0 Y +15771 PA -5.0 Y +15772 PA -5.0 Y +15773 PA -5.0 Y +15774 PA -5.0 Y +15775 PA -5.0 Y +15776 PA -5.0 Y +15777 PA -5.0 Y +15778 PA -5.0 Y +15779 PA -5.0 Y +15780 PA -5.0 Y +15781 PA -5.0 Y +15783 PA -5.0 Y +15784 PA -5.0 Y +15801 PA -5.0 Y +15821 PA -5.0 Y +15822 PA -5.0 Y +15823 PA -5.0 Y +15824 PA -5.0 Y +15825 PA -5.0 Y +15827 PA -5.0 Y +15828 PA -5.0 Y +15829 PA -5.0 Y +15831 PA -5.0 Y +15832 PA -5.0 Y +15834 PA -5.0 Y +15840 PA -5.0 Y +15841 PA -5.0 Y +15845 PA -5.0 Y +15846 PA -5.0 Y +15847 PA -5.0 Y +15848 PA -5.0 Y +15849 PA -5.0 Y +15851 PA -5.0 Y +15853 PA -5.0 Y +15856 PA -5.0 Y +15857 PA -5.0 Y +15860 PA -5.0 Y +15861 PA -5.0 Y +15863 PA -5.0 Y +15864 PA -5.0 Y +15865 PA -5.0 Y +15866 PA -5.0 Y +15868 PA -5.0 Y +15870 PA -5.0 Y +15901 PA -5.0 Y +15902 PA -5.0 Y +15904 PA -5.0 Y +15905 PA -5.0 Y +15906 PA -5.0 Y +15907 PA -5.0 Y +15909 PA -5.0 Y +15915 PA -5.0 Y +15920 PA -5.0 Y +15921 PA -5.0 Y +15922 PA -5.0 Y +15923 PA -5.0 Y +15924 PA -5.0 Y +15925 PA -5.0 Y +15926 PA -5.0 Y +15927 PA -5.0 Y +15928 PA -5.0 Y +15929 PA -5.0 Y +15930 PA -5.0 Y +15931 PA -5.0 Y +15934 PA -5.0 Y +15935 PA -5.0 Y +15936 PA -5.0 Y +15937 PA -5.0 Y +15938 PA -5.0 Y +15940 PA -5.0 Y +15942 PA -5.0 Y +15943 PA -5.0 Y +15944 PA -5.0 Y +15945 PA -5.0 Y +15946 PA -5.0 Y +15948 PA -5.0 Y +15949 PA -5.0 Y +15951 PA -5.0 Y +15952 PA -5.0 Y +15953 PA -5.0 Y +15954 PA -5.0 Y +15955 PA -5.0 Y +15956 PA -5.0 Y +15957 PA -5.0 Y +15958 PA -5.0 Y +15959 PA -5.0 Y +15960 PA -5.0 Y +15961 PA -5.0 Y +15962 PA -5.0 Y +15963 PA -5.0 Y +16001 PA -5.0 Y +16002 PA -5.0 Y +16003 PA -5.0 Y +16016 PA -5.0 Y +16017 PA -5.0 Y +16018 PA -5.0 Y +16020 PA -5.0 Y +16021 PA -5.0 Y +16022 PA -5.0 Y +16023 PA -5.0 Y +16024 PA -5.0 Y +16025 PA -5.0 Y +16027 PA -5.0 Y +16028 PA -5.0 Y +16029 PA -5.0 Y +16030 PA -5.0 Y +16033 PA -5.0 Y +16034 PA -5.0 Y +16035 PA -5.0 Y +16036 PA -5.0 Y +16037 PA -5.0 Y +16038 PA -5.0 Y +16039 PA -5.0 Y +16040 PA -5.0 Y +16041 PA -5.0 Y +16045 PA -5.0 Y +16046 PA -5.0 Y +16048 PA -5.0 Y +16049 PA -5.0 Y +16050 PA -5.0 Y +16051 PA -5.0 Y +16052 PA -5.0 Y +16053 PA -5.0 Y +16054 PA -5.0 Y +16055 PA -5.0 Y +16056 PA -5.0 Y +16057 PA -5.0 Y +16058 PA -5.0 Y +16059 PA -5.0 Y +16061 PA -5.0 Y +16063 PA -5.0 Y +16066 PA -5.0 Y +16101 PA -5.0 Y +16102 PA -5.0 Y +16103 PA -5.0 Y +16105 PA -5.0 Y +16107 PA -5.0 Y +16108 PA -5.0 Y +16110 PA -5.0 Y +16111 PA -5.0 Y +16112 PA -5.0 Y +16113 PA -5.0 Y +16114 PA -5.0 Y +16115 PA -5.0 Y +16116 PA -5.0 Y +16117 PA -5.0 Y +16120 PA -5.0 Y +16121 PA -5.0 Y +16123 PA -5.0 Y +16124 PA -5.0 Y +16125 PA -5.0 Y +16127 PA -5.0 Y +16130 PA -5.0 Y +16131 PA -5.0 Y +16132 PA -5.0 Y +16133 PA -5.0 Y +16134 PA -5.0 Y +16136 PA -5.0 Y +16137 PA -5.0 Y +16140 PA -5.0 Y +16141 PA -5.0 Y +16142 PA -5.0 Y +16143 PA -5.0 Y +16145 PA -5.0 Y +16146 PA -5.0 Y +16148 PA -5.0 Y +16150 PA -5.0 Y +16151 PA -5.0 Y +16153 PA -5.0 Y +16154 PA -5.0 Y +16155 PA -5.0 Y +16156 PA -5.0 Y +16157 PA -5.0 Y +16159 PA -5.0 Y +16160 PA -5.0 Y +16161 PA -5.0 Y +16172 PA -5.0 Y +16201 PA -5.0 Y +16210 PA -5.0 Y +16211 PA -5.0 Y +16212 PA -5.0 Y +16213 PA -5.0 Y +16214 PA -5.0 Y +16215 PA -5.0 Y +16217 PA -5.0 Y +16218 PA -5.0 Y +16220 PA -5.0 Y +16221 PA -5.0 Y +16222 PA -5.0 Y +16223 PA -5.0 Y +16224 PA -5.0 Y +16225 PA -5.0 Y +16226 PA -5.0 Y +16228 PA -5.0 Y +16229 PA -5.0 Y +16230 PA -5.0 Y +16232 PA -5.0 Y +16233 PA -5.0 Y +16234 PA -5.0 Y +16235 PA -5.0 Y +16236 PA -5.0 Y +16238 PA -5.0 Y +16239 PA -5.0 Y +16240 PA -5.0 Y +16242 PA -5.0 Y +16244 PA -5.0 Y +16245 PA -5.0 Y +16246 PA -5.0 Y +16248 PA -5.0 Y +16249 PA -5.0 Y +16250 PA -5.0 Y +16253 PA -5.0 Y +16254 PA -5.0 Y +16255 PA -5.0 Y +16256 PA -5.0 Y +16257 PA -5.0 Y +16258 PA -5.0 Y +16259 PA -5.0 Y +16260 PA -5.0 Y +16261 PA -5.0 Y +16262 PA -5.0 Y +16263 PA -5.0 Y +16301 PA -5.0 Y +16311 PA -5.0 Y +16312 PA -5.0 Y +16313 PA -5.0 Y +16314 PA -5.0 Y +16316 PA -5.0 Y +16317 PA -5.0 Y +16319 PA -5.0 Y +16321 PA -5.0 Y +16322 PA -5.0 Y +16323 PA -5.0 Y +16326 PA -5.0 Y +16327 PA -5.0 Y +16328 PA -5.0 Y +16329 PA -5.0 Y +16331 PA -5.0 Y +16332 PA -5.0 Y +16333 PA -5.0 Y +16334 PA -5.0 Y +16335 PA -5.0 Y +16340 PA -5.0 Y +16341 PA -5.0 Y +16342 PA -5.0 Y +16343 PA -5.0 Y +16344 PA -5.0 Y +16345 PA -5.0 Y +16346 PA -5.0 Y +16347 PA -5.0 Y +16350 PA -5.0 Y +16351 PA -5.0 Y +16352 PA -5.0 Y +16353 PA -5.0 Y +16354 PA -5.0 Y +16360 PA -5.0 Y +16361 PA -5.0 Y +16362 PA -5.0 Y +16364 PA -5.0 Y +16365 PA -5.0 Y +16366 PA -5.0 Y +16367 PA -5.0 Y +16368 PA -5.0 Y +16369 PA -5.0 Y +16370 PA -5.0 Y +16371 PA -5.0 Y +16372 PA -5.0 Y +16373 PA -5.0 Y +16374 PA -5.0 Y +16375 PA -5.0 Y +16388 PA -5.0 Y +16401 PA -5.0 Y +16402 PA -5.0 Y +16403 PA -5.0 Y +16404 PA -5.0 Y +16405 PA -5.0 Y +16406 PA -5.0 Y +16407 PA -5.0 Y +16410 PA -5.0 Y +16411 PA -5.0 Y +16412 PA -5.0 Y +16413 PA -5.0 Y +16415 PA -5.0 Y +16416 PA -5.0 Y +16417 PA -5.0 Y +16420 PA -5.0 Y +16421 PA -5.0 Y +16422 PA -5.0 Y +16423 PA -5.0 Y +16424 PA -5.0 Y +16426 PA -5.0 Y +16427 PA -5.0 Y +16428 PA -5.0 Y +16430 PA -5.0 Y +16432 PA -5.0 Y +16433 PA -5.0 Y +16434 PA -5.0 Y +16435 PA -5.0 Y +16436 PA -5.0 Y +16438 PA -5.0 Y +16440 PA -5.0 Y +16441 PA -5.0 Y +16442 PA -5.0 Y +16443 PA -5.0 Y +16444 PA -5.0 Y +16475 PA -5.0 Y +16501 PA -5.0 Y +16502 PA -5.0 Y +16503 PA -5.0 Y +16504 PA -5.0 Y +16505 PA -5.0 Y +16506 PA -5.0 Y +16507 PA -5.0 Y +16508 PA -5.0 Y +16509 PA -5.0 Y +16510 PA -5.0 Y +16511 PA -5.0 Y +16512 PA -5.0 Y +16514 PA -5.0 Y +16515 PA -5.0 Y +16522 PA -5.0 Y +16530 PA -5.0 Y +16531 PA -5.0 Y +16532 PA -5.0 Y +16533 PA -5.0 Y +16534 PA -5.0 Y +16538 PA -5.0 Y +16541 PA -5.0 Y +16544 PA -5.0 Y +16546 PA -5.0 Y +16550 PA -5.0 Y +16553 PA -5.0 Y +16554 PA -5.0 Y +16563 PA -5.0 Y +16565 PA -5.0 Y +16601 PA -5.0 Y +16602 PA -5.0 Y +16603 PA -5.0 Y +16611 PA -5.0 Y +16613 PA -5.0 Y +16616 PA -5.0 Y +16617 PA -5.0 Y +16619 PA -5.0 Y +16620 PA -5.0 Y +16621 PA -5.0 Y +16622 PA -5.0 Y +16623 PA -5.0 Y +16624 PA -5.0 Y +16625 PA -5.0 Y +16627 PA -5.0 Y +16629 PA -5.0 Y +16630 PA -5.0 Y +16631 PA -5.0 Y +16633 PA -5.0 Y +16634 PA -5.0 Y +16635 PA -5.0 Y +16636 PA -5.0 Y +16637 PA -5.0 Y +16638 PA -5.0 Y +16639 PA -5.0 Y +16640 PA -5.0 Y +16641 PA -5.0 Y +16644 PA -5.0 Y +16645 PA -5.0 Y +16646 PA -5.0 Y +16647 PA -5.0 Y +16648 PA -5.0 Y +16650 PA -5.0 Y +16651 PA -5.0 Y +16652 PA -5.0 Y +16654 PA -5.0 Y +16655 PA -5.0 Y +16656 PA -5.0 Y +16657 PA -5.0 Y +16659 PA -5.0 Y +16660 PA -5.0 Y +16661 PA -5.0 Y +16662 PA -5.0 Y +16663 PA -5.0 Y +16664 PA -5.0 Y +16665 PA -5.0 Y +16666 PA -5.0 Y +16667 PA -5.0 Y +16668 PA -5.0 Y +16669 PA -5.0 Y +16670 PA -5.0 Y +16671 PA -5.0 Y +16672 PA -5.0 Y +16673 PA -5.0 Y +16674 PA -5.0 Y +16675 PA -5.0 Y +16677 PA -5.0 Y +16678 PA -5.0 Y +16679 PA -5.0 Y +16680 PA -5.0 Y +16681 PA -5.0 Y +16682 PA -5.0 Y +16683 PA -5.0 Y +16684 PA -5.0 Y +16685 PA -5.0 Y +16686 PA -5.0 Y +16689 PA -5.0 Y +16691 PA -5.0 Y +16692 PA -5.0 Y +16693 PA -5.0 Y +16694 PA -5.0 Y +16695 PA -5.0 Y +16698 PA -5.0 Y +16699 PA -5.0 Y +16701 PA -5.0 Y +16720 PA -5.0 Y +16724 PA -5.0 Y +16725 PA -5.0 Y +16726 PA -5.0 Y +16727 PA -5.0 Y +16728 PA -5.0 Y +16729 PA -5.0 Y +16730 PA -5.0 Y +16731 PA -5.0 Y +16732 PA -5.0 Y +16733 PA -5.0 Y +16734 PA -5.0 Y +16735 PA -5.0 Y +16738 PA -5.0 Y +16740 PA -5.0 Y +16743 PA -5.0 Y +16744 PA -5.0 Y +16745 PA -5.0 Y +16746 PA -5.0 Y +16748 PA -5.0 Y +16749 PA -5.0 Y +16750 PA -5.0 Y +16801 PA -5.0 Y +16802 PA -5.0 Y +16803 PA -5.0 Y +16804 PA -5.0 Y +16805 PA -5.0 Y +16820 PA -5.0 Y +16821 PA -5.0 Y +16822 PA -5.0 Y +16823 PA -5.0 Y +16825 PA -5.0 Y +16826 PA -5.0 Y +16827 PA -5.0 Y +16828 PA -5.0 Y +16829 PA -5.0 Y +16830 PA -5.0 Y +16832 PA -5.0 Y +16833 PA -5.0 Y +16834 PA -5.0 Y +16835 PA -5.0 Y +16836 PA -5.0 Y +16837 PA -5.0 Y +16838 PA -5.0 Y +16839 PA -5.0 Y +16840 PA -5.0 Y +16841 PA -5.0 Y +16843 PA -5.0 Y +16844 PA -5.0 Y +16845 PA -5.0 Y +16847 PA -5.0 Y +16848 PA -5.0 Y +16849 PA -5.0 Y +16850 PA -5.0 Y +16851 PA -5.0 Y +16852 PA -5.0 Y +16853 PA -5.0 Y +16854 PA -5.0 Y +16855 PA -5.0 Y +16856 PA -5.0 Y +16858 PA -5.0 Y +16859 PA -5.0 Y +16860 PA -5.0 Y +16861 PA -5.0 Y +16863 PA -5.0 Y +16864 PA -5.0 Y +16865 PA -5.0 Y +16866 PA -5.0 Y +16868 PA -5.0 Y +16870 PA -5.0 Y +16871 PA -5.0 Y +16872 PA -5.0 Y +16873 PA -5.0 Y +16874 PA -5.0 Y +16875 PA -5.0 Y +16876 PA -5.0 Y +16877 PA -5.0 Y +16878 PA -5.0 Y +16879 PA -5.0 Y +16881 PA -5.0 Y +16882 PA -5.0 Y +16901 PA -5.0 Y +16910 PA -5.0 Y +16911 PA -5.0 Y +16912 PA -5.0 Y +16914 PA -5.0 Y +16915 PA -5.0 Y +16917 PA -5.0 Y +16918 PA -5.0 Y +16920 PA -5.0 Y +16921 PA -5.0 Y +16922 PA -5.0 Y +16923 PA -5.0 Y +16925 PA -5.0 Y +16926 PA -5.0 Y +16927 PA -5.0 Y +16928 PA -5.0 Y +16929 PA -5.0 Y +16930 PA -5.0 Y +16932 PA -5.0 Y +16933 PA -5.0 Y +16935 PA -5.0 Y +16936 PA -5.0 Y +16937 PA -5.0 Y +16938 PA -5.0 Y +16939 PA -5.0 Y +16940 PA -5.0 Y +16941 PA -5.0 Y +16942 PA -5.0 Y +16943 PA -5.0 Y +16945 PA -5.0 Y +16946 PA -5.0 Y +16947 PA -5.0 Y +16948 PA -5.0 Y +16950 PA -5.0 Y +17001 PA -5.0 Y +17002 PA -5.0 Y +17003 PA -5.0 Y +17004 PA -5.0 Y +17005 PA -5.0 Y +17006 PA -5.0 Y +17007 PA -5.0 Y +17008 PA -5.0 Y +17009 PA -5.0 Y +17010 PA -5.0 Y +17011 PA -5.0 Y +17012 PA -5.0 Y +17013 PA -5.0 Y +17014 PA -5.0 Y +17015 PA -5.0 Y +17016 PA -5.0 Y +17017 PA -5.0 Y +17018 PA -5.0 Y +17019 PA -5.0 Y +17020 PA -5.0 Y +17021 PA -5.0 Y +17022 PA -5.0 Y +17023 PA -5.0 Y +17024 PA -5.0 Y +17025 PA -5.0 Y +17026 PA -5.0 Y +17027 PA -5.0 Y +17028 PA -5.0 Y +17029 PA -5.0 Y +17030 PA -5.0 Y +17032 PA -5.0 Y +17033 PA -5.0 Y +17034 PA -5.0 Y +17035 PA -5.0 Y +17036 PA -5.0 Y +17037 PA -5.0 Y +17038 PA -5.0 Y +17039 PA -5.0 Y +17040 PA -5.0 Y +17041 PA -5.0 Y +17042 PA -5.0 Y +17043 PA -5.0 Y +17044 PA -5.0 Y +17045 PA -5.0 Y +17046 PA -5.0 Y +17047 PA -5.0 Y +17048 PA -5.0 Y +17049 PA -5.0 Y +17050 PA -5.0 Y +17051 PA -5.0 Y +17052 PA -5.0 Y +17053 PA -5.0 Y +17054 PA -5.0 Y +17055 PA -5.0 Y +17056 PA -5.0 Y +17057 PA -5.0 Y +17058 PA -5.0 Y +17059 PA -5.0 Y +17060 PA -5.0 Y +17061 PA -5.0 Y +17062 PA -5.0 Y +17063 PA -5.0 Y +17064 PA -5.0 Y +17065 PA -5.0 Y +17066 PA -5.0 Y +17067 PA -5.0 Y +17068 PA -5.0 Y +17069 PA -5.0 Y +17070 PA -5.0 Y +17071 PA -5.0 Y +17072 PA -5.0 Y +17073 PA -5.0 Y +17074 PA -5.0 Y +17075 PA -5.0 Y +17076 PA -5.0 Y +17077 PA -5.0 Y +17078 PA -5.0 Y +17080 PA -5.0 Y +17081 PA -5.0 Y +17082 PA -5.0 Y +17083 PA -5.0 Y +17084 PA -5.0 Y +17085 PA -5.0 Y +17086 PA -5.0 Y +17087 PA -5.0 Y +17088 PA -5.0 Y +17089 PA -5.0 Y +17090 PA -5.0 Y +17091 PA -5.0 Y +17093 PA -5.0 Y +17094 PA -5.0 Y +17097 PA -5.0 Y +17098 PA -5.0 Y +17099 PA -5.0 Y +17101 PA -5.0 Y +17102 PA -5.0 Y +17103 PA -5.0 Y +17104 PA -5.0 Y +17105 PA -5.0 Y +17106 PA -5.0 Y +17107 PA -5.0 Y +17108 PA -5.0 Y +17109 PA -5.0 Y +17110 PA -5.0 Y +17111 PA -5.0 Y +17112 PA -5.0 Y +17113 PA -5.0 Y +17120 PA -5.0 Y +17121 PA -5.0 Y +17122 PA -5.0 Y +17123 PA -5.0 Y +17124 PA -5.0 Y +17125 PA -5.0 Y +17126 PA -5.0 Y +17127 PA -5.0 Y +17128 PA -5.0 Y +17129 PA -5.0 Y +17130 PA -5.0 Y +17140 PA -5.0 Y +17177 PA -5.0 Y +17201 PA -5.0 Y +17210 PA -5.0 Y +17211 PA -5.0 Y +17212 PA -5.0 Y +17213 PA -5.0 Y +17214 PA -5.0 Y +17215 PA -5.0 Y +17217 PA -5.0 Y +17219 PA -5.0 Y +17220 PA -5.0 Y +17221 PA -5.0 Y +17222 PA -5.0 Y +17223 PA -5.0 Y +17224 PA -5.0 Y +17225 PA -5.0 Y +17228 PA -5.0 Y +17229 PA -5.0 Y +17231 PA -5.0 Y +17232 PA -5.0 Y +17233 PA -5.0 Y +17235 PA -5.0 Y +17236 PA -5.0 Y +17237 PA -5.0 Y +17238 PA -5.0 Y +17239 PA -5.0 Y +17240 PA -5.0 Y +17241 PA -5.0 Y +17243 PA -5.0 Y +17244 PA -5.0 Y +17246 PA -5.0 Y +17247 PA -5.0 Y +17249 PA -5.0 Y +17250 PA -5.0 Y +17251 PA -5.0 Y +17252 PA -5.0 Y +17253 PA -5.0 Y +17254 PA -5.0 Y +17255 PA -5.0 Y +17256 PA -5.0 Y +17257 PA -5.0 Y +17260 PA -5.0 Y +17261 PA -5.0 Y +17262 PA -5.0 Y +17263 PA -5.0 Y +17264 PA -5.0 Y +17265 PA -5.0 Y +17266 PA -5.0 Y +17267 PA -5.0 Y +17268 PA -5.0 Y +17270 PA -5.0 Y +17271 PA -5.0 Y +17272 PA -5.0 Y +17301 PA -5.0 Y +17302 PA -5.0 Y +17303 PA -5.0 Y +17304 PA -5.0 Y +17306 PA -5.0 Y +17307 PA -5.0 Y +17309 PA -5.0 Y +17310 PA -5.0 Y +17311 PA -5.0 Y +17312 PA -5.0 Y +17313 PA -5.0 Y +17314 PA -5.0 Y +17315 PA -5.0 Y +17316 PA -5.0 Y +17317 PA -5.0 Y +17318 PA -5.0 Y +17319 PA -5.0 Y +17320 PA -5.0 Y +17321 PA -5.0 Y +17322 PA -5.0 Y +17323 PA -5.0 Y +17324 PA -5.0 Y +17325 PA -5.0 Y +17326 PA -5.0 Y +17327 PA -5.0 Y +17329 PA -5.0 Y +17331 PA -5.0 Y +17332 PA -5.0 Y +17333 PA -5.0 Y +17334 PA -5.0 Y +17337 PA -5.0 Y +17339 PA -5.0 Y +17340 PA -5.0 Y +17342 PA -5.0 Y +17343 PA -5.0 Y +17344 PA -5.0 Y +17345 PA -5.0 Y +17347 PA -5.0 Y +17349 PA -5.0 Y +17350 PA -5.0 Y +17352 PA -5.0 Y +17353 PA -5.0 Y +17354 PA -5.0 Y +17355 PA -5.0 Y +17356 PA -5.0 Y +17358 PA -5.0 Y +17360 PA -5.0 Y +17361 PA -5.0 Y +17362 PA -5.0 Y +17363 PA -5.0 Y +17364 PA -5.0 Y +17365 PA -5.0 Y +17366 PA -5.0 Y +17368 PA -5.0 Y +17370 PA -5.0 Y +17371 PA -5.0 Y +17372 PA -5.0 Y +17375 PA -5.0 Y +17401 PA -5.0 Y +17402 PA -5.0 Y +17403 PA -5.0 Y +17404 PA -5.0 Y +17405 PA -5.0 Y +17406 PA -5.0 Y +17407 PA -5.0 Y +17408 PA -5.0 Y +17415 PA -5.0 Y +17501 PA -5.0 Y +17502 PA -5.0 Y +17503 PA -5.0 Y +17504 PA -5.0 Y +17505 PA -5.0 Y +17506 PA -5.0 Y +17507 PA -5.0 Y +17508 PA -5.0 Y +17509 PA -5.0 Y +17512 PA -5.0 Y +17516 PA -5.0 Y +17517 PA -5.0 Y +17518 PA -5.0 Y +17519 PA -5.0 Y +17520 PA -5.0 Y +17521 PA -5.0 Y +17522 PA -5.0 Y +17527 PA -5.0 Y +17528 PA -5.0 Y +17529 PA -5.0 Y +17532 PA -5.0 Y +17533 PA -5.0 Y +17534 PA -5.0 Y +17535 PA -5.0 Y +17536 PA -5.0 Y +17537 PA -5.0 Y +17538 PA -5.0 Y +17540 PA -5.0 Y +17543 PA -5.0 Y +17545 PA -5.0 Y +17547 PA -5.0 Y +17549 PA -5.0 Y +17550 PA -5.0 Y +17551 PA -5.0 Y +17552 PA -5.0 Y +17554 PA -5.0 Y +17555 PA -5.0 Y +17557 PA -5.0 Y +17560 PA -5.0 Y +17562 PA -5.0 Y +17563 PA -5.0 Y +17564 PA -5.0 Y +17565 PA -5.0 Y +17566 PA -5.0 Y +17567 PA -5.0 Y +17568 PA -5.0 Y +17569 PA -5.0 Y +17570 PA -5.0 Y +17572 PA -5.0 Y +17573 PA -5.0 Y +17575 PA -5.0 Y +17576 PA -5.0 Y +17578 PA -5.0 Y +17579 PA -5.0 Y +17580 PA -5.0 Y +17581 PA -5.0 Y +17582 PA -5.0 Y +17583 PA -5.0 Y +17584 PA -5.0 Y +17585 PA -5.0 Y +17601 PA -5.0 Y +17602 PA -5.0 Y +17603 PA -5.0 Y +17604 PA -5.0 Y +17605 PA -5.0 Y +17606 PA -5.0 Y +17607 PA -5.0 Y +17608 PA -5.0 Y +17611 PA -5.0 Y +17699 PA -5.0 Y +17701 PA -5.0 Y +17702 PA -5.0 Y +17703 PA -5.0 Y +17705 PA -5.0 Y +17720 PA -5.0 Y +17721 PA -5.0 Y +17723 PA -5.0 Y +17724 PA -5.0 Y +17726 PA -5.0 Y +17727 PA -5.0 Y +17728 PA -5.0 Y +17729 PA -5.0 Y +17730 PA -5.0 Y +17731 PA -5.0 Y +17735 PA -5.0 Y +17737 PA -5.0 Y +17738 PA -5.0 Y +17739 PA -5.0 Y +17740 PA -5.0 Y +17742 PA -5.0 Y +17744 PA -5.0 Y +17745 PA -5.0 Y +17747 PA -5.0 Y +17748 PA -5.0 Y +17749 PA -5.0 Y +17750 PA -5.0 Y +17751 PA -5.0 Y +17752 PA -5.0 Y +17754 PA -5.0 Y +17756 PA -5.0 Y +17758 PA -5.0 Y +17760 PA -5.0 Y +17762 PA -5.0 Y +17763 PA -5.0 Y +17764 PA -5.0 Y +17765 PA -5.0 Y +17767 PA -5.0 Y +17768 PA -5.0 Y +17769 PA -5.0 Y +17771 PA -5.0 Y +17772 PA -5.0 Y +17773 PA -5.0 Y +17774 PA -5.0 Y +17776 PA -5.0 Y +17777 PA -5.0 Y +17778 PA -5.0 Y +17779 PA -5.0 Y +17801 PA -5.0 Y +17810 PA -5.0 Y +17812 PA -5.0 Y +17813 PA -5.0 Y +17814 PA -5.0 Y +17815 PA -5.0 Y +17820 PA -5.0 Y +17821 PA -5.0 Y +17822 PA -5.0 Y +17823 PA -5.0 Y +17824 PA -5.0 Y +17827 PA -5.0 Y +17829 PA -5.0 Y +17830 PA -5.0 Y +17831 PA -5.0 Y +17832 PA -5.0 Y +17833 PA -5.0 Y +17834 PA -5.0 Y +17835 PA -5.0 Y +17836 PA -5.0 Y +17837 PA -5.0 Y +17839 PA -5.0 Y +17840 PA -5.0 Y +17841 PA -5.0 Y +17842 PA -5.0 Y +17843 PA -5.0 Y +17844 PA -5.0 Y +17845 PA -5.0 Y +17846 PA -5.0 Y +17847 PA -5.0 Y +17850 PA -5.0 Y +17851 PA -5.0 Y +17853 PA -5.0 Y +17855 PA -5.0 Y +17856 PA -5.0 Y +17857 PA -5.0 Y +17858 PA -5.0 Y +17859 PA -5.0 Y +17860 PA -5.0 Y +17861 PA -5.0 Y +17862 PA -5.0 Y +17864 PA -5.0 Y +17865 PA -5.0 Y +17866 PA -5.0 Y +17867 PA -5.0 Y +17868 PA -5.0 Y +17870 PA -5.0 Y +17872 PA -5.0 Y +17876 PA -5.0 Y +17877 PA -5.0 Y +17878 PA -5.0 Y +17880 PA -5.0 Y +17881 PA -5.0 Y +17882 PA -5.0 Y +17883 PA -5.0 Y +17884 PA -5.0 Y +17885 PA -5.0 Y +17886 PA -5.0 Y +17887 PA -5.0 Y +17888 PA -5.0 Y +17889 PA -5.0 Y +17901 PA -5.0 Y +17920 PA -5.0 Y +17921 PA -5.0 Y +17922 PA -5.0 Y +17923 PA -5.0 Y +17925 PA -5.0 Y +17929 PA -5.0 Y +17930 PA -5.0 Y +17931 PA -5.0 Y +17932 PA -5.0 Y +17933 PA -5.0 Y +17934 PA -5.0 Y +17935 PA -5.0 Y +17936 PA -5.0 Y +17938 PA -5.0 Y +17941 PA -5.0 Y +17942 PA -5.0 Y +17943 PA -5.0 Y +17944 PA -5.0 Y +17945 PA -5.0 Y +17946 PA -5.0 Y +17948 PA -5.0 Y +17949 PA -5.0 Y +17951 PA -5.0 Y +17952 PA -5.0 Y +17953 PA -5.0 Y +17954 PA -5.0 Y +17957 PA -5.0 Y +17959 PA -5.0 Y +17960 PA -5.0 Y +17961 PA -5.0 Y +17963 PA -5.0 Y +17964 PA -5.0 Y +17965 PA -5.0 Y +17966 PA -5.0 Y +17967 PA -5.0 Y +17968 PA -5.0 Y +17970 PA -5.0 Y +17972 PA -5.0 Y +17974 PA -5.0 Y +17976 PA -5.0 Y +17978 PA -5.0 Y +17979 PA -5.0 Y +17980 PA -5.0 Y +17981 PA -5.0 Y +17982 PA -5.0 Y +17983 PA -5.0 Y +17985 PA -5.0 Y +18001 PA -5.0 Y +18002 PA -5.0 Y +18003 PA -5.0 Y +18010 PA -5.0 Y +18011 PA -5.0 Y +18012 PA -5.0 Y +18013 PA -5.0 Y +18014 PA -5.0 Y +18015 PA -5.0 Y +18016 PA -5.0 Y +18017 PA -5.0 Y +18018 PA -5.0 Y +18020 PA -5.0 Y +18025 PA -5.0 Y +18030 PA -5.0 Y +18031 PA -5.0 Y +18032 PA -5.0 Y +18034 PA -5.0 Y +18035 PA -5.0 Y +18036 PA -5.0 Y +18037 PA -5.0 Y +18038 PA -5.0 Y +18039 PA -5.0 Y +18040 PA -5.0 Y +18041 PA -5.0 Y +18042 PA -5.0 Y +18043 PA -5.0 Y +18044 PA -5.0 Y +18045 PA -5.0 Y +18046 PA -5.0 Y +18049 PA -5.0 Y +18050 PA -5.0 Y +18051 PA -5.0 Y +18052 PA -5.0 Y +18053 PA -5.0 Y +18054 PA -5.0 Y +18055 PA -5.0 Y +18056 PA -5.0 Y +18058 PA -5.0 Y +18059 PA -5.0 Y +18060 PA -5.0 Y +18062 PA -5.0 Y +18063 PA -5.0 Y +18064 PA -5.0 Y +18065 PA -5.0 Y +18066 PA -5.0 Y +18067 PA -5.0 Y +18068 PA -5.0 Y +18069 PA -5.0 Y +18070 PA -5.0 Y +18071 PA -5.0 Y +18072 PA -5.0 Y +18073 PA -5.0 Y +18074 PA -5.0 Y +18076 PA -5.0 Y +18077 PA -5.0 Y +18078 PA -5.0 Y +18079 PA -5.0 Y +18080 PA -5.0 Y +18081 PA -5.0 Y +18083 PA -5.0 Y +18084 PA -5.0 Y +18085 PA -5.0 Y +18086 PA -5.0 Y +18087 PA -5.0 Y +18088 PA -5.0 Y +18091 PA -5.0 Y +18092 PA -5.0 Y +18098 PA -5.0 Y +18099 PA -5.0 Y +18101 PA -5.0 Y +18102 PA -5.0 Y +18103 PA -5.0 Y +18104 PA -5.0 Y +18105 PA -5.0 Y +18106 PA -5.0 Y +18109 PA -5.0 Y +18175 PA -5.0 Y +18195 PA -5.0 Y +18201 PA -5.0 Y +18202 PA -5.0 Y +18210 PA -5.0 Y +18211 PA -5.0 Y +18212 PA -5.0 Y +18214 PA -5.0 Y +18216 PA -5.0 Y +18218 PA -5.0 Y +18219 PA -5.0 Y +18220 PA -5.0 Y +18221 PA -5.0 Y +18222 PA -5.0 Y +18223 PA -5.0 Y +18224 PA -5.0 Y +18225 PA -5.0 Y +18229 PA -5.0 Y +18230 PA -5.0 Y +18231 PA -5.0 Y +18232 PA -5.0 Y +18234 PA -5.0 Y +18235 PA -5.0 Y +18237 PA -5.0 Y +18239 PA -5.0 Y +18240 PA -5.0 Y +18241 PA -5.0 Y +18242 PA -5.0 Y +18244 PA -5.0 Y +18245 PA -5.0 Y +18246 PA -5.0 Y +18247 PA -5.0 Y +18248 PA -5.0 Y +18249 PA -5.0 Y +18250 PA -5.0 Y +18251 PA -5.0 Y +18252 PA -5.0 Y +18254 PA -5.0 Y +18255 PA -5.0 Y +18256 PA -5.0 Y +18301 PA -5.0 Y +18302 PA -5.0 Y +18320 PA -5.0 Y +18321 PA -5.0 Y +18322 PA -5.0 Y +18323 PA -5.0 Y +18324 PA -5.0 Y +18325 PA -5.0 Y +18326 PA -5.0 Y +18327 PA -5.0 Y +18328 PA -5.0 Y +18330 PA -5.0 Y +18331 PA -5.0 Y +18332 PA -5.0 Y +18333 PA -5.0 Y +18334 PA -5.0 Y +18335 PA -5.0 Y +18336 PA -5.0 Y +18337 PA -5.0 Y +18340 PA -5.0 Y +18341 PA -5.0 Y +18342 PA -5.0 Y +18343 PA -5.0 Y +18344 PA -5.0 Y +18346 PA -5.0 Y +18347 PA -5.0 Y +18348 PA -5.0 Y +18349 PA -5.0 Y +18350 PA -5.0 Y +18351 PA -5.0 Y +18352 PA -5.0 Y +18353 PA -5.0 Y +18354 PA -5.0 Y +18355 PA -5.0 Y +18356 PA -5.0 Y +18357 PA -5.0 Y +18360 PA -5.0 Y +18370 PA -5.0 Y +18371 PA -5.0 Y +18372 PA -5.0 Y +18373 PA -5.0 Y +18403 PA -5.0 Y +18405 PA -5.0 Y +18407 PA -5.0 Y +18410 PA -5.0 Y +18411 PA -5.0 Y +18413 PA -5.0 Y +18414 PA -5.0 Y +18415 PA -5.0 Y +18416 PA -5.0 Y +18417 PA -5.0 Y +18419 PA -5.0 Y +18420 PA -5.0 Y +18421 PA -5.0 Y +18424 PA -5.0 Y +18425 PA -5.0 Y +18426 PA -5.0 Y +18427 PA -5.0 Y +18428 PA -5.0 Y +18430 PA -5.0 Y +18431 PA -5.0 Y +18433 PA -5.0 Y +18434 PA -5.0 Y +18435 PA -5.0 Y +18436 PA -5.0 Y +18437 PA -5.0 Y +18438 PA -5.0 Y +18439 PA -5.0 Y +18440 PA -5.0 Y +18441 PA -5.0 Y +18443 PA -5.0 Y +18444 PA -5.0 Y +18445 PA -5.0 Y +18446 PA -5.0 Y +18447 PA -5.0 Y +18448 PA -5.0 Y +18449 PA -5.0 Y +18451 PA -5.0 Y +18452 PA -5.0 Y +18453 PA -5.0 Y +18454 PA -5.0 Y +18455 PA -5.0 Y +18456 PA -5.0 Y +18457 PA -5.0 Y +18458 PA -5.0 Y +18459 PA -5.0 Y +18460 PA -5.0 Y +18461 PA -5.0 Y +18462 PA -5.0 Y +18463 PA -5.0 Y +18464 PA -5.0 Y +18465 PA -5.0 Y +18466 PA -5.0 Y +18469 PA -5.0 Y +18470 PA -5.0 Y +18471 PA -5.0 Y +18472 PA -5.0 Y +18473 PA -5.0 Y +18501 PA -5.0 Y +18502 PA -5.0 Y +18503 PA -5.0 Y +18504 PA -5.0 Y +18505 PA -5.0 Y +18507 PA -5.0 Y +18508 PA -5.0 Y +18509 PA -5.0 Y +18510 PA -5.0 Y +18512 PA -5.0 Y +18514 PA -5.0 Y +18515 PA -5.0 Y +18517 PA -5.0 Y +18518 PA -5.0 Y +18519 PA -5.0 Y +18522 PA -5.0 Y +18540 PA -5.0 Y +18577 PA -5.0 Y +18601 PA -5.0 Y +18602 PA -5.0 Y +18603 PA -5.0 Y +18610 PA -5.0 Y +18611 PA -5.0 Y +18612 PA -5.0 Y +18614 PA -5.0 Y +18615 PA -5.0 Y +18616 PA -5.0 Y +18617 PA -5.0 Y +18618 PA -5.0 Y +18619 PA -5.0 Y +18621 PA -5.0 Y +18622 PA -5.0 Y +18623 PA -5.0 Y +18624 PA -5.0 Y +18625 PA -5.0 Y +18626 PA -5.0 Y +18627 PA -5.0 Y +18628 PA -5.0 Y +18629 PA -5.0 Y +18630 PA -5.0 Y +18631 PA -5.0 Y +18632 PA -5.0 Y +18634 PA -5.0 Y +18635 PA -5.0 Y +18636 PA -5.0 Y +18640 PA -5.0 Y +18641 PA -5.0 Y +18642 PA -5.0 Y +18643 PA -5.0 Y +18644 PA -5.0 Y +18651 PA -5.0 Y +18653 PA -5.0 Y +18654 PA -5.0 Y +18655 PA -5.0 Y +18656 PA -5.0 Y +18657 PA -5.0 Y +18660 PA -5.0 Y +18661 PA -5.0 Y +18690 PA -5.0 Y +18701 PA -5.0 Y +18702 PA -5.0 Y +18703 PA -5.0 Y +18704 PA -5.0 Y +18705 PA -5.0 Y +18706 PA -5.0 Y +18707 PA -5.0 Y +18708 PA -5.0 Y +18709 PA -5.0 Y +18710 PA -5.0 Y +18711 PA -5.0 Y +18762 PA -5.0 Y +18764 PA -5.0 Y +18765 PA -5.0 Y +18766 PA -5.0 Y +18767 PA -5.0 Y +18769 PA -5.0 Y +18773 PA -5.0 Y +18801 PA -5.0 Y +18810 PA -5.0 Y +18812 PA -5.0 Y +18813 PA -5.0 Y +18814 PA -5.0 Y +18815 PA -5.0 Y +18816 PA -5.0 Y +18817 PA -5.0 Y +18818 PA -5.0 Y +18820 PA -5.0 Y +18821 PA -5.0 Y +18822 PA -5.0 Y +18823 PA -5.0 Y +18824 PA -5.0 Y +18825 PA -5.0 Y +18826 PA -5.0 Y +18827 PA -5.0 Y +18828 PA -5.0 Y +18829 PA -5.0 Y +18830 PA -5.0 Y +18831 PA -5.0 Y +18832 PA -5.0 Y +18833 PA -5.0 Y +18834 PA -5.0 Y +18837 PA -5.0 Y +18840 PA -5.0 Y +18842 PA -5.0 Y +18843 PA -5.0 Y +18844 PA -5.0 Y +18845 PA -5.0 Y +18846 PA -5.0 Y +18847 PA -5.0 Y +18848 PA -5.0 Y +18850 PA -5.0 Y +18851 PA -5.0 Y +18853 PA -5.0 Y +18854 PA -5.0 Y +18901 PA -5.0 Y +18902 PA -5.0 Y +18910 PA -5.0 Y +18911 PA -5.0 Y +18912 PA -5.0 Y +18913 PA -5.0 Y +18914 PA -5.0 Y +18915 PA -5.0 Y +18916 PA -5.0 Y +18917 PA -5.0 Y +18918 PA -5.0 Y +18920 PA -5.0 Y +18921 PA -5.0 Y +18922 PA -5.0 Y +18923 PA -5.0 Y +18924 PA -5.0 Y +18925 PA -5.0 Y +18926 PA -5.0 Y +18927 PA -5.0 Y +18928 PA -5.0 Y +18929 PA -5.0 Y +18930 PA -5.0 Y +18931 PA -5.0 Y +18932 PA -5.0 Y +18933 PA -5.0 Y +18934 PA -5.0 Y +18935 PA -5.0 Y +18936 PA -5.0 Y +18938 PA -5.0 Y +18940 PA -5.0 Y +18942 PA -5.0 Y +18943 PA -5.0 Y +18944 PA -5.0 Y +18946 PA -5.0 Y +18947 PA -5.0 Y +18949 PA -5.0 Y +18950 PA -5.0 Y +18951 PA -5.0 Y +18953 PA -5.0 Y +18954 PA -5.0 Y +18955 PA -5.0 Y +18956 PA -5.0 Y +18957 PA -5.0 Y +18958 PA -5.0 Y +18960 PA -5.0 Y +18962 PA -5.0 Y +18963 PA -5.0 Y +18964 PA -5.0 Y +18966 PA -5.0 Y +18968 PA -5.0 Y +18969 PA -5.0 Y +18970 PA -5.0 Y +18971 PA -5.0 Y +18972 PA -5.0 Y +18974 PA -5.0 Y +18976 PA -5.0 Y +18977 PA -5.0 Y +18979 PA -5.0 Y +18980 PA -5.0 Y +18981 PA -5.0 Y +18991 PA -5.0 Y +19001 PA -5.0 Y +19002 PA -5.0 Y +19003 PA -5.0 Y +19004 PA -5.0 Y +19006 PA -5.0 Y +19007 PA -5.0 Y +19008 PA -5.0 Y +19009 PA -5.0 Y +19010 PA -5.0 Y +19012 PA -5.0 Y +19013 PA -5.0 Y +19014 PA -5.0 Y +19015 PA -5.0 Y +19016 PA -5.0 Y +19017 PA -5.0 Y +19018 PA -5.0 Y +19019 PA -5.0 Y +19020 PA -5.0 Y +19021 PA -5.0 Y +19022 PA -5.0 Y +19023 PA -5.0 Y +19025 PA -5.0 Y +19026 PA -5.0 Y +19027 PA -5.0 Y +19028 PA -5.0 Y +19029 PA -5.0 Y +19030 PA -5.0 Y +19031 PA -5.0 Y +19032 PA -5.0 Y +19033 PA -5.0 Y +19034 PA -5.0 Y +19035 PA -5.0 Y +19036 PA -5.0 Y +19037 PA -5.0 Y +19038 PA -5.0 Y +19039 PA -5.0 Y +19040 PA -5.0 Y +19041 PA -5.0 Y +19043 PA -5.0 Y +19044 PA -5.0 Y +19046 PA -5.0 Y +19047 PA -5.0 Y +19048 PA -5.0 Y +19049 PA -5.0 Y +19050 PA -5.0 Y +19052 PA -5.0 Y +19053 PA -5.0 Y +19054 PA -5.0 Y +19055 PA -5.0 Y +19056 PA -5.0 Y +19057 PA -5.0 Y +19058 PA -5.0 Y +19061 PA -5.0 Y +19063 PA -5.0 Y +19064 PA -5.0 Y +19065 PA -5.0 Y +19066 PA -5.0 Y +19067 PA -5.0 Y +19070 PA -5.0 Y +19072 PA -5.0 Y +19073 PA -5.0 Y +19074 PA -5.0 Y +19075 PA -5.0 Y +19076 PA -5.0 Y +19078 PA -5.0 Y +19079 PA -5.0 Y +19080 PA -5.0 Y +19081 PA -5.0 Y +19082 PA -5.0 Y +19083 PA -5.0 Y +19085 PA -5.0 Y +19086 PA -5.0 Y +19087 PA -5.0 Y +19088 PA -5.0 Y +19089 PA -5.0 Y +19090 PA -5.0 Y +19091 PA -5.0 Y +19092 PA -5.0 Y +19093 PA -5.0 Y +19094 PA -5.0 Y +19095 PA -5.0 Y +19096 PA -5.0 Y +19098 PA -5.0 Y +19099 PA -5.0 Y +19101 PA -5.0 Y +19102 PA -5.0 Y +19103 PA -5.0 Y +19104 PA -5.0 Y +19105 PA -5.0 Y +19106 PA -5.0 Y +19107 PA -5.0 Y +19108 PA -5.0 Y +19109 PA -5.0 Y +19110 PA -5.0 Y +19111 PA -5.0 Y +19112 PA -5.0 Y +19113 PA -5.0 Y +19114 PA -5.0 Y +19115 PA -5.0 Y +19116 PA -5.0 Y +19118 PA -5.0 Y +19119 PA -5.0 Y +19120 PA -5.0 Y +19121 PA -5.0 Y +19122 PA -5.0 Y +19123 PA -5.0 Y +19124 PA -5.0 Y +19125 PA -5.0 Y +19126 PA -5.0 Y +19127 PA -5.0 Y +19128 PA -5.0 Y +19129 PA -5.0 Y +19130 PA -5.0 Y +19131 PA -5.0 Y +19132 PA -5.0 Y +19133 PA -5.0 Y +19134 PA -5.0 Y +19135 PA -5.0 Y +19136 PA -5.0 Y +19137 PA -5.0 Y +19138 PA -5.0 Y +19139 PA -5.0 Y +19140 PA -5.0 Y +19141 PA -5.0 Y +19142 PA -5.0 Y +19143 PA -5.0 Y +19144 PA -5.0 Y +19145 PA -5.0 Y +19146 PA -5.0 Y +19147 PA -5.0 Y +19148 PA -5.0 Y +19149 PA -5.0 Y +19150 PA -5.0 Y +19151 PA -5.0 Y +19152 PA -5.0 Y +19153 PA -5.0 Y +19154 PA -5.0 Y +19155 PA -5.0 Y +19160 PA -5.0 Y +19161 PA -5.0 Y +19162 PA -5.0 Y +19170 PA -5.0 Y +19171 PA -5.0 Y +19172 PA -5.0 Y +19173 PA -5.0 Y +19175 PA -5.0 Y +19176 PA -5.0 Y +19177 PA -5.0 Y +19178 PA -5.0 Y +19179 PA -5.0 Y +19181 PA -5.0 Y +19182 PA -5.0 Y +19183 PA -5.0 Y +19184 PA -5.0 Y +19185 PA -5.0 Y +19187 PA -5.0 Y +19188 PA -5.0 Y +19191 PA -5.0 Y +19192 PA -5.0 Y +19193 PA -5.0 Y +19194 PA -5.0 Y +19195 PA -5.0 Y +19196 PA -5.0 Y +19197 PA -5.0 Y +19244 PA -5.0 Y +19255 PA -5.0 Y +19301 PA -5.0 Y +19310 PA -5.0 Y +19311 PA -5.0 Y +19312 PA -5.0 Y +19316 PA -5.0 Y +19317 PA -5.0 Y +19318 PA -5.0 Y +19319 PA -5.0 Y +19320 PA -5.0 Y +19330 PA -5.0 Y +19331 PA -5.0 Y +19333 PA -5.0 Y +19335 PA -5.0 Y +19339 PA -5.0 Y +19340 PA -5.0 Y +19341 PA -5.0 Y +19342 PA -5.0 Y +19343 PA -5.0 Y +19344 PA -5.0 Y +19345 PA -5.0 Y +19346 PA -5.0 Y +19347 PA -5.0 Y +19348 PA -5.0 Y +19350 PA -5.0 Y +19351 PA -5.0 Y +19352 PA -5.0 Y +19353 PA -5.0 Y +19354 PA -5.0 Y +19355 PA -5.0 Y +19357 PA -5.0 Y +19358 PA -5.0 Y +19360 PA -5.0 Y +19362 PA -5.0 Y +19363 PA -5.0 Y +19365 PA -5.0 Y +19366 PA -5.0 Y +19367 PA -5.0 Y +19369 PA -5.0 Y +19371 PA -5.0 Y +19372 PA -5.0 Y +19373 PA -5.0 Y +19374 PA -5.0 Y +19375 PA -5.0 Y +19376 PA -5.0 Y +19380 PA -5.0 Y +19381 PA -5.0 Y +19382 PA -5.0 Y +19383 PA -5.0 Y +19390 PA -5.0 Y +19395 PA -5.0 Y +19397 PA -5.0 Y +19398 PA -5.0 Y +19399 PA -5.0 Y +19401 PA -5.0 Y +19403 PA -5.0 Y +19404 PA -5.0 Y +19405 PA -5.0 Y +19406 PA -5.0 Y +19407 PA -5.0 Y +19408 PA -5.0 Y +19409 PA -5.0 Y +19415 PA -5.0 Y +19420 PA -5.0 Y +19421 PA -5.0 Y +19422 PA -5.0 Y +19423 PA -5.0 Y +19424 PA -5.0 Y +19425 PA -5.0 Y +19426 PA -5.0 Y +19428 PA -5.0 Y +19429 PA -5.0 Y +19430 PA -5.0 Y +19432 PA -5.0 Y +19435 PA -5.0 Y +19436 PA -5.0 Y +19437 PA -5.0 Y +19438 PA -5.0 Y +19440 PA -5.0 Y +19441 PA -5.0 Y +19442 PA -5.0 Y +19443 PA -5.0 Y +19444 PA -5.0 Y +19446 PA -5.0 Y +19450 PA -5.0 Y +19451 PA -5.0 Y +19453 PA -5.0 Y +19454 PA -5.0 Y +19455 PA -5.0 Y +19456 PA -5.0 Y +19457 PA -5.0 Y +19460 PA -5.0 Y +19462 PA -5.0 Y +19464 PA -5.0 Y +19465 PA -5.0 Y +19468 PA -5.0 Y +19470 PA -5.0 Y +19472 PA -5.0 Y +19473 PA -5.0 Y +19474 PA -5.0 Y +19475 PA -5.0 Y +19477 PA -5.0 Y +19478 PA -5.0 Y +19480 PA -5.0 Y +19481 PA -5.0 Y +19482 PA -5.0 Y +19483 PA -5.0 Y +19484 PA -5.0 Y +19485 PA -5.0 Y +19486 PA -5.0 Y +19487 PA -5.0 Y +19488 PA -5.0 Y +19489 PA -5.0 Y +19490 PA -5.0 Y +19492 PA -5.0 Y +19493 PA -5.0 Y +19494 PA -5.0 Y +19495 PA -5.0 Y +19496 PA -5.0 Y +19501 PA -5.0 Y +19503 PA -5.0 Y +19504 PA -5.0 Y +19505 PA -5.0 Y +19506 PA -5.0 Y +19507 PA -5.0 Y +19508 PA -5.0 Y +19510 PA -5.0 Y +19511 PA -5.0 Y +19512 PA -5.0 Y +19516 PA -5.0 Y +19518 PA -5.0 Y +19519 PA -5.0 Y +19520 PA -5.0 Y +19522 PA -5.0 Y +19523 PA -5.0 Y +19525 PA -5.0 Y +19526 PA -5.0 Y +19529 PA -5.0 Y +19530 PA -5.0 Y +19533 PA -5.0 Y +19534 PA -5.0 Y +19535 PA -5.0 Y +19536 PA -5.0 Y +19538 PA -5.0 Y +19539 PA -5.0 Y +19540 PA -5.0 Y +19541 PA -5.0 Y +19542 PA -5.0 Y +19543 PA -5.0 Y +19544 PA -5.0 Y +19545 PA -5.0 Y +19547 PA -5.0 Y +19548 PA -5.0 Y +19549 PA -5.0 Y +19550 PA -5.0 Y +19551 PA -5.0 Y +19554 PA -5.0 Y +19555 PA -5.0 Y +19559 PA -5.0 Y +19560 PA -5.0 Y +19562 PA -5.0 Y +19564 PA -5.0 Y +19565 PA -5.0 Y +19567 PA -5.0 Y +19601 PA -5.0 Y +19602 PA -5.0 Y +19603 PA -5.0 Y +19604 PA -5.0 Y +19605 PA -5.0 Y +19606 PA -5.0 Y +19607 PA -5.0 Y +19608 PA -5.0 Y +19609 PA -5.0 Y +19610 PA -5.0 Y +19611 PA -5.0 Y +19612 PA -5.0 Y +19640 PA -5.0 Y +19701 DE -5.0 Y +19702 DE -5.0 Y +19703 DE -5.0 Y +19706 DE -5.0 Y +19707 DE -5.0 Y +19708 DE -5.0 Y +19709 DE -5.0 Y +19710 DE -5.0 Y +19711 DE -5.0 Y +19712 DE -5.0 Y +19713 DE -5.0 Y +19714 DE -5.0 Y +19715 DE -5.0 Y +19716 DE -5.0 Y +19717 DE -5.0 Y +19718 DE -5.0 Y +19720 DE -5.0 Y +19721 DE -5.0 Y +19725 DE -5.0 Y +19726 DE -5.0 Y +19730 DE -5.0 Y +19731 DE -5.0 Y +19732 DE -5.0 Y +19733 DE -5.0 Y +19734 DE -5.0 Y +19735 DE -5.0 Y +19736 DE -5.0 Y +19801 DE -5.0 Y +19802 DE -5.0 Y +19803 DE -5.0 Y +19804 DE -5.0 Y +19805 DE -5.0 Y +19806 DE -5.0 Y +19807 DE -5.0 Y +19808 DE -5.0 Y +19809 DE -5.0 Y +19810 DE -5.0 Y +19850 DE -5.0 Y +19880 DE -5.0 Y +19884 DE -5.0 Y +19885 DE -5.0 Y +19886 DE -5.0 Y +19887 DE -5.0 Y +19889 DE -5.0 Y +19890 DE -5.0 Y +19891 DE -5.0 Y +19892 DE -5.0 Y +19893 DE -5.0 Y +19894 DE -5.0 Y +19895 DE -5.0 Y +19896 DE -5.0 Y +19897 DE -5.0 Y +19898 DE -5.0 Y +19899 DE -5.0 Y +19901 DE -5.0 Y +19902 DE -5.0 Y +19903 DE -5.0 Y +19904 DE -5.0 Y +19905 DE -5.0 Y +19906 DE -5.0 Y +19930 DE -5.0 Y +19931 DE -5.0 Y +19933 DE -5.0 Y +19934 DE -5.0 Y +19936 DE -5.0 Y +19938 DE -5.0 Y +19939 DE -5.0 Y +19940 DE -5.0 Y +19941 DE -5.0 Y +19943 DE -5.0 Y +19944 DE -5.0 Y +19945 DE -5.0 Y +19946 DE -5.0 Y +19947 DE -5.0 Y +19950 DE -5.0 Y +19951 DE -5.0 Y +19952 DE -5.0 Y +19953 DE -5.0 Y +19954 DE -5.0 Y +19955 DE -5.0 Y +19956 DE -5.0 Y +19958 DE -5.0 Y +19960 DE -5.0 Y +19961 DE -5.0 Y +19962 DE -5.0 Y +19963 DE -5.0 Y +19964 DE -5.0 Y +19966 DE -5.0 Y +19967 DE -5.0 Y +19968 DE -5.0 Y +19969 DE -5.0 Y +19970 DE -5.0 Y +19971 DE -5.0 Y +19973 DE -5.0 Y +19975 DE -5.0 Y +19977 DE -5.0 Y +19979 DE -5.0 Y +19980 DE -5.0 Y +20001 DC -5.0 Y +20002 DC -5.0 Y +20003 DC -5.0 Y +20004 DC -5.0 Y +20005 DC -5.0 Y +20006 DC -5.0 Y +20007 DC -5.0 Y +20008 DC -5.0 Y +20009 DC -5.0 Y +20010 DC -5.0 Y +20011 DC -5.0 Y +20012 DC -5.0 Y +20013 DC -5.0 Y +20015 DC -5.0 Y +20016 DC -5.0 Y +20017 DC -5.0 Y +20018 DC -5.0 Y +20019 DC -5.0 Y +20020 DC -5.0 Y +20022 DC -5.0 Y +20023 DC -5.0 Y +20024 DC -5.0 Y +20026 DC -5.0 Y +20027 DC -5.0 Y +20029 DC -5.0 Y +20030 DC -5.0 Y +20032 DC -5.0 Y +20033 DC -5.0 Y +20035 DC -5.0 Y +20036 DC -5.0 Y +20037 DC -5.0 Y +20038 DC -5.0 Y +20039 DC -5.0 Y +20040 DC -5.0 Y +20041 DC -5.0 Y +20042 DC -5.0 Y +20043 DC -5.0 Y +20044 DC -5.0 Y +20045 DC -5.0 Y +20046 DC -5.0 Y +20047 DC -5.0 Y +20049 DC -5.0 Y +20050 DC -5.0 Y +20051 DC -5.0 Y +20052 DC -5.0 Y +20053 DC -5.0 Y +20055 DC -5.0 Y +20056 DC -5.0 Y +20057 DC -5.0 Y +20058 DC -5.0 Y +20059 DC -5.0 Y +20060 DC -5.0 Y +20061 DC -5.0 Y +20062 DC -5.0 Y +20063 DC -5.0 Y +20064 DC -5.0 Y +20065 DC -5.0 Y +20066 DC -5.0 Y +20067 DC -5.0 Y +20068 DC -5.0 Y +20069 DC -5.0 Y +20070 DC -5.0 Y +20071 DC -5.0 Y +20073 DC -5.0 Y +20074 DC -5.0 Y +20075 DC -5.0 Y +20076 DC -5.0 Y +20077 DC -5.0 Y +20078 DC -5.0 Y +20080 DC -5.0 Y +20081 DC -5.0 Y +20082 DC -5.0 Y +20088 DC -5.0 Y +20090 DC -5.0 Y +20091 DC -5.0 Y +20097 DC -5.0 Y +20098 DC -5.0 Y +20101 VA -5.0 Y +20102 VA -5.0 Y +20103 VA -5.0 Y +20104 VA -5.0 Y +20105 VA -5.0 Y +20106 VA -5.0 Y +20107 VA -5.0 Y +20108 VA -5.0 Y +20109 VA -5.0 Y +20110 VA -5.0 Y +20111 VA -5.0 Y +20112 VA -5.0 Y +20113 VA -5.0 Y +20115 VA -5.0 Y +20116 VA -5.0 Y +20117 VA -5.0 Y +20118 VA -5.0 Y +20119 VA -5.0 Y +20120 VA -5.0 Y +20121 VA -5.0 Y +20122 VA -5.0 Y +20124 VA -5.0 Y +20128 VA -5.0 Y +20129 VA -5.0 Y +20130 VA -5.0 Y +20131 VA -5.0 Y +20132 VA -5.0 Y +20134 VA -5.0 Y +20135 VA -5.0 Y +20136 VA -5.0 Y +20137 VA -5.0 Y +20138 VA -5.0 Y +20139 VA -5.0 Y +20140 VA -5.0 Y +20141 VA -5.0 Y +20142 VA -5.0 Y +20143 VA -5.0 Y +20144 VA -5.0 Y +20146 VA -5.0 Y +20147 VA -5.0 Y +20148 VA -5.0 Y +20149 VA -5.0 Y +20151 VA -5.0 Y +20152 VA -5.0 Y +20153 VA -5.0 Y +20155 VA -5.0 Y +20156 VA -5.0 Y +20158 VA -5.0 Y +20159 VA -5.0 Y +20160 VA -5.0 Y +20163 VA -5.0 Y +20164 VA -5.0 Y +20165 VA -5.0 Y +20166 VA -5.0 Y +20167 VA -5.0 Y +20168 VA -5.0 Y +20169 VA -5.0 Y +20170 VA -5.0 Y +20171 VA -5.0 Y +20172 VA -5.0 Y +20175 VA -5.0 Y +20176 VA -5.0 Y +20177 VA -5.0 Y +20178 VA -5.0 Y +20180 VA -5.0 Y +20181 VA -5.0 Y +20182 VA -5.0 Y +20184 VA -5.0 Y +20185 VA -5.0 Y +20186 VA -5.0 Y +20187 VA -5.0 Y +20188 VA -5.0 Y +20189 VA -5.0 Y +20190 VA -5.0 Y +20191 VA -5.0 Y +20192 VA -5.0 Y +20193 VA -5.0 Y +20194 VA -5.0 Y +20195 VA -5.0 Y +20196 VA -5.0 Y +20197 VA -5.0 Y +20198 VA -5.0 Y +20199 VA -5.0 Y +20201 DC -5.0 Y +20202 DC -5.0 Y +20203 DC -5.0 Y +20204 DC -5.0 Y +20206 DC -5.0 Y +20207 DC -5.0 Y +20208 DC -5.0 Y +20210 DC -5.0 Y +20211 DC -5.0 Y +20212 DC -5.0 Y +20213 DC -5.0 Y +20214 DC -5.0 Y +20215 DC -5.0 Y +20216 DC -5.0 Y +20217 DC -5.0 Y +20218 DC -5.0 Y +20219 DC -5.0 Y +20220 DC -5.0 Y +20221 DC -5.0 Y +20222 DC -5.0 Y +20223 DC -5.0 Y +20224 DC -5.0 Y +20226 DC -5.0 Y +20227 DC -5.0 Y +20228 DC -5.0 Y +20229 DC -5.0 Y +20230 DC -5.0 Y +20232 DC -5.0 Y +20233 DC -5.0 Y +20235 DC -5.0 Y +20237 DC -5.0 Y +20238 DC -5.0 Y +20239 DC -5.0 Y +20240 DC -5.0 Y +20241 DC -5.0 Y +20242 DC -5.0 Y +20244 DC -5.0 Y +20245 DC -5.0 Y +20250 DC -5.0 Y +20251 DC -5.0 Y +20254 DC -5.0 Y +20260 DC -5.0 Y +20261 DC -5.0 Y +20262 DC -5.0 Y +20265 DC -5.0 Y +20266 DC -5.0 Y +20268 DC -5.0 Y +20270 DC -5.0 Y +20277 DC -5.0 Y +20289 DC -5.0 Y +20299 DC -5.0 Y +20301 DC -5.0 Y +20303 DC -5.0 Y +20306 DC -5.0 Y +20307 DC -5.0 Y +20310 DC -5.0 Y +20314 DC -5.0 Y +20317 DC -5.0 Y +20318 DC -5.0 Y +20319 DC -5.0 Y +20330 DC -5.0 Y +20340 DC -5.0 Y +20350 DC -5.0 Y +20355 DC -5.0 Y +20370 DC -5.0 Y +20372 DC -5.0 Y +20373 DC -5.0 Y +20374 DC -5.0 Y +20375 DC -5.0 Y +20376 DC -5.0 Y +20380 DC -5.0 Y +20388 DC -5.0 Y +20389 DC -5.0 Y +20390 DC -5.0 Y +20391 DC -5.0 Y +20392 DC -5.0 Y +20393 DC -5.0 Y +20394 DC -5.0 Y +20395 DC -5.0 Y +20398 DC -5.0 Y +20401 DC -5.0 Y +20402 DC -5.0 Y +20403 DC -5.0 Y +20404 DC -5.0 Y +20405 DC -5.0 Y +20406 DC -5.0 Y +20407 DC -5.0 Y +20408 DC -5.0 Y +20409 DC -5.0 Y +20410 DC -5.0 Y +20411 DC -5.0 Y +20412 DC -5.0 Y +20413 DC -5.0 Y +20414 DC -5.0 Y +20415 DC -5.0 Y +20416 DC -5.0 Y +20418 DC -5.0 Y +20419 DC -5.0 Y +20420 DC -5.0 Y +20421 DC -5.0 Y +20422 DC -5.0 Y +20423 DC -5.0 Y +20424 DC -5.0 Y +20425 DC -5.0 Y +20426 DC -5.0 Y +20427 DC -5.0 Y +20428 DC -5.0 Y +20429 DC -5.0 Y +20431 DC -5.0 Y +20433 DC -5.0 Y +20434 DC -5.0 Y +20435 DC -5.0 Y +20436 DC -5.0 Y +20437 DC -5.0 Y +20439 DC -5.0 Y +20440 DC -5.0 Y +20441 DC -5.0 Y +20442 DC -5.0 Y +20444 DC -5.0 Y +20447 DC -5.0 Y +20451 DC -5.0 Y +20453 DC -5.0 Y +20456 DC -5.0 Y +20460 DC -5.0 Y +20463 DC -5.0 Y +20468 DC -5.0 Y +20469 DC -5.0 Y +20470 DC -5.0 Y +20472 DC -5.0 Y +20500 DC -5.0 Y +20501 DC -5.0 Y +20502 DC -5.0 Y +20503 DC -5.0 Y +20504 DC -5.0 Y +20505 DC -5.0 Y +20506 DC -5.0 Y +20507 DC -5.0 Y +20508 DC -5.0 Y +20509 DC -5.0 Y +20510 DC -5.0 Y +20511 DC -5.0 Y +20515 DC -5.0 Y +20520 DC -5.0 Y +20521 DC -5.0 Y +20522 DC -5.0 Y +20523 DC -5.0 Y +20524 DC -5.0 Y +20525 DC -5.0 Y +20526 DC -5.0 Y +20527 DC -5.0 Y +20528 DC -5.0 Y +20529 DC -5.0 Y +20530 DC -5.0 Y +20531 DC -5.0 Y +20532 DC -5.0 Y +20533 DC -5.0 Y +20534 DC -5.0 Y +20535 DC -5.0 Y +20536 DC -5.0 Y +20537 DC -5.0 Y +20538 DC -5.0 Y +20539 DC -5.0 Y +20540 DC -5.0 Y +20541 DC -5.0 Y +20542 DC -5.0 Y +20543 DC -5.0 Y +20544 DC -5.0 Y +20546 DC -5.0 Y +20547 DC -5.0 Y +20548 DC -5.0 Y +20549 DC -5.0 Y +20551 DC -5.0 Y +20552 DC -5.0 Y +20553 DC -5.0 Y +20554 DC -5.0 Y +20555 DC -5.0 Y +20557 DC -5.0 Y +20558 DC -5.0 Y +20559 DC -5.0 Y +20560 DC -5.0 Y +20565 DC -5.0 Y +20566 DC -5.0 Y +20570 DC -5.0 Y +20571 DC -5.0 Y +20572 DC -5.0 Y +20573 DC -5.0 Y +20575 DC -5.0 Y +20576 DC -5.0 Y +20577 DC -5.0 Y +20578 DC -5.0 Y +20579 DC -5.0 Y +20580 DC -5.0 Y +20581 DC -5.0 Y +20585 DC -5.0 Y +20586 DC -5.0 Y +20590 DC -5.0 Y +20591 DC -5.0 Y +20593 DC -5.0 Y +20594 DC -5.0 Y +20597 DC -5.0 Y +20599 DC -5.0 Y +20601 MD -5.0 Y +20602 MD -5.0 Y +20603 MD -5.0 Y +20604 MD -5.0 Y +20606 MD -5.0 Y +20607 MD -5.0 Y +20608 MD -5.0 Y +20609 MD -5.0 Y +20610 MD -5.0 Y +20611 MD -5.0 Y +20612 MD -5.0 Y +20613 MD -5.0 Y +20615 MD -5.0 Y +20616 MD -5.0 Y +20617 MD -5.0 Y +20618 MD -5.0 Y +20619 MD -5.0 Y +20620 MD -5.0 Y +20621 MD -5.0 Y +20622 MD -5.0 Y +20623 MD -5.0 Y +20624 MD -5.0 Y +20625 MD -5.0 Y +20626 MD -5.0 Y +20627 MD -5.0 Y +20628 MD -5.0 Y +20629 MD -5.0 Y +20630 MD -5.0 Y +20632 MD -5.0 Y +20634 MD -5.0 Y +20635 MD -5.0 Y +20636 MD -5.0 Y +20637 MD -5.0 Y +20639 MD -5.0 Y +20640 MD -5.0 Y +20643 MD -5.0 Y +20645 MD -5.0 Y +20646 MD -5.0 Y +20650 MD -5.0 Y +20653 MD -5.0 Y +20656 MD -5.0 Y +20657 MD -5.0 Y +20658 MD -5.0 Y +20659 MD -5.0 Y +20660 MD -5.0 Y +20661 MD -5.0 Y +20662 MD -5.0 Y +20664 MD -5.0 Y +20667 MD -5.0 Y +20670 MD -5.0 Y +20674 MD -5.0 Y +20675 MD -5.0 Y +20676 MD -5.0 Y +20677 MD -5.0 Y +20678 MD -5.0 Y +20680 MD -5.0 Y +20682 MD -5.0 Y +20684 MD -5.0 Y +20685 MD -5.0 Y +20686 MD -5.0 Y +20687 MD -5.0 Y +20688 MD -5.0 Y +20689 MD -5.0 Y +20690 MD -5.0 Y +20692 MD -5.0 Y +20693 MD -5.0 Y +20695 MD -5.0 Y +20697 MD -5.0 Y +20701 MD -5.0 Y +20703 MD -5.0 Y +20704 MD -5.0 Y +20705 MD -5.0 Y +20706 MD -5.0 Y +20707 MD -5.0 Y +20708 MD -5.0 Y +20709 MD -5.0 Y +20710 MD -5.0 Y +20711 MD -5.0 Y +20712 MD -5.0 Y +20714 MD -5.0 Y +20715 MD -5.0 Y +20716 MD -5.0 Y +20717 MD -5.0 Y +20718 MD -5.0 Y +20719 MD -5.0 Y +20720 MD -5.0 Y +20721 MD -5.0 Y +20722 MD -5.0 Y +20723 MD -5.0 Y +20724 MD -5.0 Y +20725 MD -5.0 Y +20726 MD -5.0 Y +20731 MD -5.0 Y +20732 MD -5.0 Y +20733 MD -5.0 Y +20735 MD -5.0 Y +20736 MD -5.0 Y +20737 MD -5.0 Y +20738 MD -5.0 Y +20740 MD -5.0 Y +20741 MD -5.0 Y +20742 MD -5.0 Y +20743 MD -5.0 Y +20744 MD -5.0 Y +20745 MD -5.0 Y +20746 MD -5.0 Y +20747 MD -5.0 Y +20748 MD -5.0 Y +20749 MD -5.0 Y +20750 MD -5.0 Y +20751 MD -5.0 Y +20752 MD -5.0 Y +20753 MD -5.0 Y +20754 MD -5.0 Y +20755 MD -5.0 Y +20757 MD -5.0 Y +20758 MD -5.0 Y +20759 MD -5.0 Y +20762 MD -5.0 Y +20763 MD -5.0 Y +20764 MD -5.0 Y +20765 MD -5.0 Y +20768 MD -5.0 Y +20769 MD -5.0 Y +20770 MD -5.0 Y +20771 MD -5.0 Y +20772 MD -5.0 Y +20773 MD -5.0 Y +20774 MD -5.0 Y +20775 MD -5.0 Y +20776 MD -5.0 Y +20777 MD -5.0 Y +20778 MD -5.0 Y +20779 MD -5.0 Y +20781 MD -5.0 Y +20782 MD -5.0 Y +20783 MD -5.0 Y +20784 MD -5.0 Y +20785 MD -5.0 Y +20787 MD -5.0 Y +20788 MD -5.0 Y +20790 MD -5.0 Y +20791 MD -5.0 Y +20792 MD -5.0 Y +20794 MD -5.0 Y +20797 MD -5.0 Y +20799 MD -5.0 Y +20810 MD -5.0 Y +20811 MD -5.0 Y +20812 MD -5.0 Y +20813 MD -5.0 Y +20814 MD -5.0 Y +20815 MD -5.0 Y +20816 MD -5.0 Y +20817 MD -5.0 Y +20818 MD -5.0 Y +20824 MD -5.0 Y +20825 MD -5.0 Y +20827 MD -5.0 Y +20830 MD -5.0 Y +20832 MD -5.0 Y +20833 MD -5.0 Y +20837 MD -5.0 Y +20838 MD -5.0 Y +20839 MD -5.0 Y +20841 MD -5.0 Y +20842 MD -5.0 Y +20847 MD -5.0 Y +20848 MD -5.0 Y +20849 MD -5.0 Y +20850 MD -5.0 Y +20851 MD -5.0 Y +20852 MD -5.0 Y +20853 MD -5.0 Y +20854 MD -5.0 Y +20855 MD -5.0 Y +20857 MD -5.0 Y +20859 MD -5.0 Y +20860 MD -5.0 Y +20861 MD -5.0 Y +20862 MD -5.0 Y +20866 MD -5.0 Y +20868 MD -5.0 Y +20871 MD -5.0 Y +20872 MD -5.0 Y +20874 MD -5.0 Y +20875 MD -5.0 Y +20876 MD -5.0 Y +20877 MD -5.0 Y +20878 MD -5.0 Y +20879 MD -5.0 Y +20880 MD -5.0 Y +20882 MD -5.0 Y +20883 MD -5.0 Y +20884 MD -5.0 Y +20885 MD -5.0 Y +20886 MD -5.0 Y +20889 MD -5.0 Y +20891 MD -5.0 Y +20892 MD -5.0 Y +20894 MD -5.0 Y +20895 MD -5.0 Y +20896 MD -5.0 Y +20897 MD -5.0 Y +20898 MD -5.0 Y +20899 MD -5.0 Y +20901 MD -5.0 Y +20902 MD -5.0 Y +20903 MD -5.0 Y +20904 MD -5.0 Y +20905 MD -5.0 Y +20906 MD -5.0 Y +20907 MD -5.0 Y +20908 MD -5.0 Y +20910 MD -5.0 Y +20911 MD -5.0 Y +20912 MD -5.0 Y +20913 MD -5.0 Y +20914 MD -5.0 Y +20915 MD -5.0 Y +20916 MD -5.0 Y +20918 MD -5.0 Y +20993 MD -5.0 Y +20997 MD -5.0 Y +21001 MD -5.0 Y +21005 MD -5.0 Y +21009 MD -5.0 Y +21010 MD -5.0 Y +21012 MD -5.0 Y +21013 MD -5.0 Y +21014 MD -5.0 Y +21015 MD -5.0 Y +21017 MD -5.0 Y +21018 MD -5.0 Y +21020 MD -5.0 Y +21022 MD -5.0 Y +21023 MD -5.0 Y +21027 MD -5.0 Y +21028 MD -5.0 Y +21029 MD -5.0 Y +21030 MD -5.0 Y +21031 MD -5.0 Y +21032 MD -5.0 Y +21034 MD -5.0 Y +21035 MD -5.0 Y +21036 MD -5.0 Y +21037 MD -5.0 Y +21040 MD -5.0 Y +21041 MD -5.0 Y +21042 MD -5.0 Y +21043 MD -5.0 Y +21044 MD -5.0 Y +21045 MD -5.0 Y +21046 MD -5.0 Y +21047 MD -5.0 Y +21048 MD -5.0 Y +21050 MD -5.0 Y +21051 MD -5.0 Y +21052 MD -5.0 Y +21053 MD -5.0 Y +21054 MD -5.0 Y +21056 MD -5.0 Y +21057 MD -5.0 Y +21060 MD -5.0 Y +21061 MD -5.0 Y +21062 MD -5.0 Y +21065 MD -5.0 Y +21071 MD -5.0 Y +21074 MD -5.0 Y +21075 MD -5.0 Y +21076 MD -5.0 Y +21077 MD -5.0 Y +21078 MD -5.0 Y +21082 MD -5.0 Y +21084 MD -5.0 Y +21085 MD -5.0 Y +21087 MD -5.0 Y +21088 MD -5.0 Y +21090 MD -5.0 Y +21092 MD -5.0 Y +21093 MD -5.0 Y +21094 MD -5.0 Y +21098 MD -5.0 Y +21102 MD -5.0 Y +21104 MD -5.0 Y +21105 MD -5.0 Y +21106 MD -5.0 Y +21108 MD -5.0 Y +21111 MD -5.0 Y +21113 MD -5.0 Y +21114 MD -5.0 Y +21117 MD -5.0 Y +21120 MD -5.0 Y +21122 MD -5.0 Y +21123 MD -5.0 Y +21128 MD -5.0 Y +21130 MD -5.0 Y +21131 MD -5.0 Y +21132 MD -5.0 Y +21133 MD -5.0 Y +21136 MD -5.0 Y +21139 MD -5.0 Y +21140 MD -5.0 Y +21144 MD -5.0 Y +21146 MD -5.0 Y +21150 MD -5.0 Y +21152 MD -5.0 Y +21153 MD -5.0 Y +21154 MD -5.0 Y +21155 MD -5.0 Y +21156 MD -5.0 Y +21157 MD -5.0 Y +21158 MD -5.0 Y +21160 MD -5.0 Y +21161 MD -5.0 Y +21162 MD -5.0 Y +21163 MD -5.0 Y +21201 MD -5.0 Y +21202 MD -5.0 Y +21203 MD -5.0 Y +21204 MD -5.0 Y +21205 MD -5.0 Y +21206 MD -5.0 Y +21207 MD -5.0 Y +21208 MD -5.0 Y +21209 MD -5.0 Y +21210 MD -5.0 Y +21211 MD -5.0 Y +21212 MD -5.0 Y +21213 MD -5.0 Y +21214 MD -5.0 Y +21215 MD -5.0 Y +21216 MD -5.0 Y +21217 MD -5.0 Y +21218 MD -5.0 Y +21219 MD -5.0 Y +21220 MD -5.0 Y +21221 MD -5.0 Y +21222 MD -5.0 Y +21223 MD -5.0 Y +21224 MD -5.0 Y +21225 MD -5.0 Y +21226 MD -5.0 Y +21227 MD -5.0 Y +21228 MD -5.0 Y +21229 MD -5.0 Y +21230 MD -5.0 Y +21231 MD -5.0 Y +21233 MD -5.0 Y +21234 MD -5.0 Y +21235 MD -5.0 Y +21236 MD -5.0 Y +21237 MD -5.0 Y +21239 MD -5.0 Y +21240 MD -5.0 Y +21241 MD -5.0 Y +21244 MD -5.0 Y +21250 MD -5.0 Y +21251 MD -5.0 Y +21252 MD -5.0 Y +21263 MD -5.0 Y +21264 MD -5.0 Y +21265 MD -5.0 Y +21268 MD -5.0 Y +21270 MD -5.0 Y +21273 MD -5.0 Y +21274 MD -5.0 Y +21275 MD -5.0 Y +21278 MD -5.0 Y +21279 MD -5.0 Y +21280 MD -5.0 Y +21281 MD -5.0 Y +21282 MD -5.0 Y +21283 MD -5.0 Y +21284 MD -5.0 Y +21285 MD -5.0 Y +21286 MD -5.0 Y +21287 MD -5.0 Y +21288 MD -5.0 Y +21289 MD -5.0 Y +21290 MD -5.0 Y +21297 MD -5.0 Y +21298 MD -5.0 Y +21401 MD -5.0 Y +21402 MD -5.0 Y +21403 MD -5.0 Y +21404 MD -5.0 Y +21405 MD -5.0 Y +21409 MD -5.0 Y +21411 MD -5.0 Y +21412 MD -5.0 Y +21501 MD -5.0 Y +21502 MD -5.0 Y +21503 MD -5.0 Y +21504 MD -5.0 Y +21505 MD -5.0 Y +21520 MD -5.0 Y +21521 MD -5.0 Y +21522 MD -5.0 Y +21523 MD -5.0 Y +21524 MD -5.0 Y +21528 MD -5.0 Y +21529 MD -5.0 Y +21530 MD -5.0 Y +21531 MD -5.0 Y +21532 MD -5.0 Y +21536 MD -5.0 Y +21538 MD -5.0 Y +21539 MD -5.0 Y +21540 MD -5.0 Y +21541 MD -5.0 Y +21542 MD -5.0 Y +21543 MD -5.0 Y +21545 MD -5.0 Y +21550 MD -5.0 Y +21555 MD -5.0 Y +21556 MD -5.0 Y +21557 MD -5.0 Y +21560 MD -5.0 Y +21561 MD -5.0 Y +21562 MD -5.0 Y +21601 MD -5.0 Y +21606 MD -5.0 Y +21607 MD -5.0 Y +21609 MD -5.0 Y +21610 MD -5.0 Y +21612 MD -5.0 Y +21613 MD -5.0 Y +21617 MD -5.0 Y +21619 MD -5.0 Y +21620 MD -5.0 Y +21622 MD -5.0 Y +21623 MD -5.0 Y +21624 MD -5.0 Y +21625 MD -5.0 Y +21626 MD -5.0 Y +21627 MD -5.0 Y +21628 MD -5.0 Y +21629 MD -5.0 Y +21631 MD -5.0 Y +21632 MD -5.0 Y +21634 MD -5.0 Y +21635 MD -5.0 Y +21636 MD -5.0 Y +21638 MD -5.0 Y +21639 MD -5.0 Y +21640 MD -5.0 Y +21641 MD -5.0 Y +21643 MD -5.0 Y +21644 MD -5.0 Y +21645 MD -5.0 Y +21647 MD -5.0 Y +21648 MD -5.0 Y +21649 MD -5.0 Y +21650 MD -5.0 Y +21651 MD -5.0 Y +21652 MD -5.0 Y +21653 MD -5.0 Y +21654 MD -5.0 Y +21655 MD -5.0 Y +21656 MD -5.0 Y +21657 MD -5.0 Y +21658 MD -5.0 Y +21659 MD -5.0 Y +21660 MD -5.0 Y +21661 MD -5.0 Y +21662 MD -5.0 Y +21663 MD -5.0 Y +21664 MD -5.0 Y +21665 MD -5.0 Y +21666 MD -5.0 Y +21667 MD -5.0 Y +21668 MD -5.0 Y +21669 MD -5.0 Y +21670 MD -5.0 Y +21671 MD -5.0 Y +21672 MD -5.0 Y +21673 MD -5.0 Y +21675 MD -5.0 Y +21676 MD -5.0 Y +21677 MD -5.0 Y +21678 MD -5.0 Y +21679 MD -5.0 Y +21681 MD -5.0 Y +21682 MD -5.0 Y +21683 MD -5.0 Y +21684 MD -5.0 Y +21685 MD -5.0 Y +21686 MD -5.0 Y +21687 MD -5.0 Y +21688 MD -5.0 Y +21690 MD -5.0 Y +21701 MD -5.0 Y +21702 MD -5.0 Y +21703 MD -5.0 Y +21704 MD -5.0 Y +21705 MD -5.0 Y +21709 MD -5.0 Y +21710 MD -5.0 Y +21711 MD -5.0 Y +21713 MD -5.0 Y +21714 MD -5.0 Y +21715 MD -5.0 Y +21716 MD -5.0 Y +21717 MD -5.0 Y +21718 MD -5.0 Y +21719 MD -5.0 Y +21720 MD -5.0 Y +21721 MD -5.0 Y +21722 MD -5.0 Y +21723 MD -5.0 Y +21727 MD -5.0 Y +21733 MD -5.0 Y +21734 MD -5.0 Y +21737 MD -5.0 Y +21738 MD -5.0 Y +21740 MD -5.0 Y +21741 MD -5.0 Y +21742 MD -5.0 Y +21746 MD -5.0 Y +21747 MD -5.0 Y +21748 MD -5.0 Y +21749 MD -5.0 Y +21750 MD -5.0 Y +21754 MD -5.0 Y +21755 MD -5.0 Y +21756 MD -5.0 Y +21757 MD -5.0 Y +21758 MD -5.0 Y +21759 MD -5.0 Y +21762 MD -5.0 Y +21765 MD -5.0 Y +21766 MD -5.0 Y +21767 MD -5.0 Y +21769 MD -5.0 Y +21770 MD -5.0 Y +21771 MD -5.0 Y +21773 MD -5.0 Y +21774 MD -5.0 Y +21775 MD -5.0 Y +21776 MD -5.0 Y +21777 MD -5.0 Y +21778 MD -5.0 Y +21779 MD -5.0 Y +21780 MD -5.0 Y +21781 MD -5.0 Y +21782 MD -5.0 Y +21783 MD -5.0 Y +21784 MD -5.0 Y +21787 MD -5.0 Y +21788 MD -5.0 Y +21790 MD -5.0 Y +21791 MD -5.0 Y +21792 MD -5.0 Y +21793 MD -5.0 Y +21794 MD -5.0 Y +21795 MD -5.0 Y +21797 MD -5.0 Y +21798 MD -5.0 Y +21801 MD -5.0 Y +21802 MD -5.0 Y +21803 MD -5.0 Y +21804 MD -5.0 Y +21810 MD -5.0 Y +21811 MD -5.0 Y +21813 MD -5.0 Y +21814 MD -5.0 Y +21817 MD -5.0 Y +21821 MD -5.0 Y +21822 MD -5.0 Y +21824 MD -5.0 Y +21826 MD -5.0 Y +21829 MD -5.0 Y +21830 MD -5.0 Y +21835 MD -5.0 Y +21836 MD -5.0 Y +21837 MD -5.0 Y +21838 MD -5.0 Y +21840 MD -5.0 Y +21841 MD -5.0 Y +21842 MD -5.0 Y +21843 MD -5.0 Y +21849 MD -5.0 Y +21850 MD -5.0 Y +21851 MD -5.0 Y +21852 MD -5.0 Y +21853 MD -5.0 Y +21856 MD -5.0 Y +21857 MD -5.0 Y +21861 MD -5.0 Y +21862 MD -5.0 Y +21863 MD -5.0 Y +21864 MD -5.0 Y +21865 MD -5.0 Y +21866 MD -5.0 Y +21867 MD -5.0 Y +21869 MD -5.0 Y +21871 MD -5.0 Y +21872 MD -5.0 Y +21874 MD -5.0 Y +21875 MD -5.0 Y +21890 MD -5.0 Y +21901 MD -5.0 Y +21902 MD -5.0 Y +21903 MD -5.0 Y +21904 MD -5.0 Y +21911 MD -5.0 Y +21912 MD -5.0 Y +21913 MD -5.0 Y +21914 MD -5.0 Y +21915 MD -5.0 Y +21916 MD -5.0 Y +21917 MD -5.0 Y +21918 MD -5.0 Y +21919 MD -5.0 Y +21920 MD -5.0 Y +21921 MD -5.0 Y +21922 MD -5.0 Y +21930 MD -5.0 Y +22003 VA -5.0 Y +22009 VA -5.0 Y +22015 VA -5.0 Y +22025 VA -5.0 Y +22026 VA -5.0 Y +22027 VA -5.0 Y +22030 VA -5.0 Y +22031 VA -5.0 Y +22032 VA -5.0 Y +22033 VA -5.0 Y +22034 VA -5.0 Y +22035 VA -5.0 Y +22036 VA -5.0 Y +22037 VA -5.0 Y +22038 VA -5.0 Y +22039 VA -5.0 Y +22040 VA -5.0 Y +22041 VA -5.0 Y +22042 VA -5.0 Y +22043 VA -5.0 Y +22044 VA -5.0 Y +22046 VA -5.0 Y +22047 VA -5.0 Y +22060 VA -5.0 Y +22066 VA -5.0 Y +22067 VA -5.0 Y +22079 VA -5.0 Y +22081 VA -5.0 Y +22082 VA -5.0 Y +22092 VA -5.0 Y +22093 VA -5.0 Y +22095 VA -5.0 Y +22096 VA -5.0 Y +22101 VA -5.0 Y +22102 VA -5.0 Y +22103 VA -5.0 Y +22106 VA -5.0 Y +22107 VA -5.0 Y +22108 VA -5.0 Y +22109 VA -5.0 Y +22116 VA -5.0 Y +22118 VA -5.0 Y +22119 VA -5.0 Y +22120 VA -5.0 Y +22121 VA -5.0 Y +22122 VA -5.0 Y +22124 VA -5.0 Y +22125 VA -5.0 Y +22134 VA -5.0 Y +22135 VA -5.0 Y +22150 VA -5.0 Y +22151 VA -5.0 Y +22152 VA -5.0 Y +22153 VA -5.0 Y +22156 VA -5.0 Y +22158 VA -5.0 Y +22159 VA -5.0 Y +22160 VA -5.0 Y +22161 VA -5.0 Y +22172 VA -5.0 Y +22180 VA -5.0 Y +22181 VA -5.0 Y +22182 VA -5.0 Y +22183 VA -5.0 Y +22184 VA -5.0 Y +22185 VA -5.0 Y +22191 VA -5.0 Y +22192 VA -5.0 Y +22193 VA -5.0 Y +22194 VA -5.0 Y +22195 VA -5.0 Y +22199 VA -5.0 Y +22201 VA -5.0 Y +22202 VA -5.0 Y +22203 VA -5.0 Y +22204 VA -5.0 Y +22205 VA -5.0 Y +22206 VA -5.0 Y +22207 VA -5.0 Y +22209 VA -5.0 Y +22210 VA -5.0 Y +22211 VA -5.0 Y +22212 VA -5.0 Y +22213 VA -5.0 Y +22214 VA -5.0 Y +22215 VA -5.0 Y +22216 VA -5.0 Y +22217 VA -5.0 Y +22218 VA -5.0 Y +22219 VA -5.0 Y +22222 VA -5.0 Y +22223 VA -5.0 Y +22225 VA -5.0 Y +22226 VA -5.0 Y +22227 VA -5.0 Y +22229 VA -5.0 Y +22230 VA -5.0 Y +22234 VA -5.0 Y +22240 VA -5.0 Y +22241 VA -5.0 Y +22242 VA -5.0 Y +22243 VA -5.0 Y +22244 VA -5.0 Y +22245 VA -5.0 Y +22246 VA -5.0 Y +22301 VA -5.0 Y +22302 VA -5.0 Y +22303 VA -5.0 Y +22304 VA -5.0 Y +22305 VA -5.0 Y +22306 VA -5.0 Y +22307 VA -5.0 Y +22308 VA -5.0 Y +22309 VA -5.0 Y +22310 VA -5.0 Y +22311 VA -5.0 Y +22312 VA -5.0 Y +22313 VA -5.0 Y +22314 VA -5.0 Y +22315 VA -5.0 Y +22320 VA -5.0 Y +22321 VA -5.0 Y +22331 VA -5.0 Y +22332 VA -5.0 Y +22333 VA -5.0 Y +22334 VA -5.0 Y +22336 VA -5.0 Y +22401 VA -5.0 Y +22402 VA -5.0 Y +22403 VA -5.0 Y +22404 VA -5.0 Y +22405 VA -5.0 Y +22406 VA -5.0 Y +22407 VA -5.0 Y +22408 VA -5.0 Y +22412 VA -5.0 Y +22427 VA -5.0 Y +22428 VA -5.0 Y +22430 VA -5.0 Y +22432 VA -5.0 Y +22433 VA -5.0 Y +22435 VA -5.0 Y +22436 VA -5.0 Y +22437 VA -5.0 Y +22438 VA -5.0 Y +22442 VA -5.0 Y +22443 VA -5.0 Y +22446 VA -5.0 Y +22448 VA -5.0 Y +22451 VA -5.0 Y +22454 VA -5.0 Y +22456 VA -5.0 Y +22460 VA -5.0 Y +22463 VA -5.0 Y +22469 VA -5.0 Y +22471 VA -5.0 Y +22472 VA -5.0 Y +22473 VA -5.0 Y +22476 VA -5.0 Y +22480 VA -5.0 Y +22481 VA -5.0 Y +22482 VA -5.0 Y +22485 VA -5.0 Y +22488 VA -5.0 Y +22501 VA -5.0 Y +22503 VA -5.0 Y +22504 VA -5.0 Y +22507 VA -5.0 Y +22508 VA -5.0 Y +22509 VA -5.0 Y +22511 VA -5.0 Y +22513 VA -5.0 Y +22514 VA -5.0 Y +22517 VA -5.0 Y +22520 VA -5.0 Y +22523 VA -5.0 Y +22524 VA -5.0 Y +22526 VA -5.0 Y +22528 VA -5.0 Y +22529 VA -5.0 Y +22530 VA -5.0 Y +22534 VA -5.0 Y +22535 VA -5.0 Y +22538 VA -5.0 Y +22539 VA -5.0 Y +22542 VA -5.0 Y +22544 VA -5.0 Y +22545 VA -5.0 Y +22546 VA -5.0 Y +22547 VA -5.0 Y +22548 VA -5.0 Y +22552 VA -5.0 Y +22553 VA -5.0 Y +22554 VA -5.0 Y +22555 VA -5.0 Y +22556 VA -5.0 Y +22558 VA -5.0 Y +22560 VA -5.0 Y +22565 VA -5.0 Y +22567 VA -5.0 Y +22570 VA -5.0 Y +22572 VA -5.0 Y +22576 VA -5.0 Y +22577 VA -5.0 Y +22578 VA -5.0 Y +22579 VA -5.0 Y +22580 VA -5.0 Y +22581 VA -5.0 Y +22601 VA -5.0 Y +22602 VA -5.0 Y +22603 VA -5.0 Y +22604 VA -5.0 Y +22610 VA -5.0 Y +22611 VA -5.0 Y +22620 VA -5.0 Y +22622 VA -5.0 Y +22623 VA -5.0 Y +22624 VA -5.0 Y +22625 VA -5.0 Y +22626 VA -5.0 Y +22627 VA -5.0 Y +22630 VA -5.0 Y +22637 VA -5.0 Y +22638 VA -5.0 Y +22639 VA -5.0 Y +22640 VA -5.0 Y +22641 VA -5.0 Y +22642 VA -5.0 Y +22643 VA -5.0 Y +22644 VA -5.0 Y +22645 VA -5.0 Y +22646 VA -5.0 Y +22649 VA -5.0 Y +22650 VA -5.0 Y +22652 VA -5.0 Y +22654 VA -5.0 Y +22655 VA -5.0 Y +22656 VA -5.0 Y +22657 VA -5.0 Y +22660 VA -5.0 Y +22663 VA -5.0 Y +22664 VA -5.0 Y +22701 VA -5.0 Y +22709 VA -5.0 Y +22711 VA -5.0 Y +22712 VA -5.0 Y +22713 VA -5.0 Y +22714 VA -5.0 Y +22715 VA -5.0 Y +22716 VA -5.0 Y +22718 VA -5.0 Y +22719 VA -5.0 Y +22720 VA -5.0 Y +22721 VA -5.0 Y +22722 VA -5.0 Y +22723 VA -5.0 Y +22724 VA -5.0 Y +22725 VA -5.0 Y +22726 VA -5.0 Y +22727 VA -5.0 Y +22728 VA -5.0 Y +22729 VA -5.0 Y +22730 VA -5.0 Y +22731 VA -5.0 Y +22732 VA -5.0 Y +22733 VA -5.0 Y +22734 VA -5.0 Y +22735 VA -5.0 Y +22736 VA -5.0 Y +22737 VA -5.0 Y +22738 VA -5.0 Y +22739 VA -5.0 Y +22740 VA -5.0 Y +22741 VA -5.0 Y +22742 VA -5.0 Y +22743 VA -5.0 Y +22746 VA -5.0 Y +22747 VA -5.0 Y +22748 VA -5.0 Y +22749 VA -5.0 Y +22801 VA -5.0 Y +22802 VA -5.0 Y +22803 VA -5.0 Y +22807 VA -5.0 Y +22810 VA -5.0 Y +22811 VA -5.0 Y +22812 VA -5.0 Y +22815 VA -5.0 Y +22820 VA -5.0 Y +22821 VA -5.0 Y +22824 VA -5.0 Y +22827 VA -5.0 Y +22830 VA -5.0 Y +22831 VA -5.0 Y +22832 VA -5.0 Y +22833 VA -5.0 Y +22834 VA -5.0 Y +22835 VA -5.0 Y +22840 VA -5.0 Y +22841 VA -5.0 Y +22842 VA -5.0 Y +22843 VA -5.0 Y +22844 VA -5.0 Y +22845 VA -5.0 Y +22846 VA -5.0 Y +22847 VA -5.0 Y +22848 VA -5.0 Y +22849 VA -5.0 Y +22850 VA -5.0 Y +22851 VA -5.0 Y +22853 VA -5.0 Y +22901 VA -5.0 Y +22902 VA -5.0 Y +22903 VA -5.0 Y +22904 VA -5.0 Y +22905 VA -5.0 Y +22906 VA -5.0 Y +22907 VA -5.0 Y +22908 VA -5.0 Y +22909 VA -5.0 Y +22910 VA -5.0 Y +22911 VA -5.0 Y +22920 VA -5.0 Y +22922 VA -5.0 Y +22923 VA -5.0 Y +22924 VA -5.0 Y +22931 VA -5.0 Y +22932 VA -5.0 Y +22935 VA -5.0 Y +22936 VA -5.0 Y +22937 VA -5.0 Y +22938 VA -5.0 Y +22939 VA -5.0 Y +22940 VA -5.0 Y +22942 VA -5.0 Y +22943 VA -5.0 Y +22945 VA -5.0 Y +22946 VA -5.0 Y +22947 VA -5.0 Y +22948 VA -5.0 Y +22949 VA -5.0 Y +22952 VA -5.0 Y +22957 VA -5.0 Y +22958 VA -5.0 Y +22959 VA -5.0 Y +22960 VA -5.0 Y +22963 VA -5.0 Y +22964 VA -5.0 Y +22965 VA -5.0 Y +22967 VA -5.0 Y +22968 VA -5.0 Y +22969 VA -5.0 Y +22971 VA -5.0 Y +22972 VA -5.0 Y +22973 VA -5.0 Y +22974 VA -5.0 Y +22976 VA -5.0 Y +22980 VA -5.0 Y +22987 VA -5.0 Y +22989 VA -5.0 Y +23001 VA -5.0 Y +23002 VA -5.0 Y +23003 VA -5.0 Y +23004 VA -5.0 Y +23005 VA -5.0 Y +23009 VA -5.0 Y +23011 VA -5.0 Y +23014 VA -5.0 Y +23015 VA -5.0 Y +23018 VA -5.0 Y +23021 VA -5.0 Y +23022 VA -5.0 Y +23023 VA -5.0 Y +23024 VA -5.0 Y +23025 VA -5.0 Y +23027 VA -5.0 Y +23030 VA -5.0 Y +23031 VA -5.0 Y +23032 VA -5.0 Y +23035 VA -5.0 Y +23038 VA -5.0 Y +23039 VA -5.0 Y +23040 VA -5.0 Y +23043 VA -5.0 Y +23045 VA -5.0 Y +23047 VA -5.0 Y +23050 VA -5.0 Y +23055 VA -5.0 Y +23056 VA -5.0 Y +23058 VA -5.0 Y +23059 VA -5.0 Y +23060 VA -5.0 Y +23061 VA -5.0 Y +23062 VA -5.0 Y +23063 VA -5.0 Y +23064 VA -5.0 Y +23065 VA -5.0 Y +23066 VA -5.0 Y +23067 VA -5.0 Y +23068 VA -5.0 Y +23069 VA -5.0 Y +23070 VA -5.0 Y +23071 VA -5.0 Y +23072 VA -5.0 Y +23075 VA -5.0 Y +23076 VA -5.0 Y +23079 VA -5.0 Y +23081 VA -5.0 Y +23083 VA -5.0 Y +23084 VA -5.0 Y +23085 VA -5.0 Y +23086 VA -5.0 Y +23089 VA -5.0 Y +23090 VA -5.0 Y +23091 VA -5.0 Y +23092 VA -5.0 Y +23093 VA -5.0 Y +23101 VA -5.0 Y +23102 VA -5.0 Y +23103 VA -5.0 Y +23105 VA -5.0 Y +23106 VA -5.0 Y +23107 VA -5.0 Y +23108 VA -5.0 Y +23109 VA -5.0 Y +23110 VA -5.0 Y +23111 VA -5.0 Y +23112 VA -5.0 Y +23113 VA -5.0 Y +23114 VA -5.0 Y +23115 VA -5.0 Y +23116 VA -5.0 Y +23117 VA -5.0 Y +23119 VA -5.0 Y +23120 VA -5.0 Y +23123 VA -5.0 Y +23124 VA -5.0 Y +23125 VA -5.0 Y +23126 VA -5.0 Y +23127 VA -5.0 Y +23128 VA -5.0 Y +23129 VA -5.0 Y +23130 VA -5.0 Y +23131 VA -5.0 Y +23138 VA -5.0 Y +23139 VA -5.0 Y +23140 VA -5.0 Y +23141 VA -5.0 Y +23146 VA -5.0 Y +23147 VA -5.0 Y +23148 VA -5.0 Y +23149 VA -5.0 Y +23150 VA -5.0 Y +23153 VA -5.0 Y +23154 VA -5.0 Y +23155 VA -5.0 Y +23156 VA -5.0 Y +23160 VA -5.0 Y +23161 VA -5.0 Y +23162 VA -5.0 Y +23163 VA -5.0 Y +23168 VA -5.0 Y +23169 VA -5.0 Y +23170 VA -5.0 Y +23173 VA -5.0 Y +23175 VA -5.0 Y +23176 VA -5.0 Y +23177 VA -5.0 Y +23178 VA -5.0 Y +23180 VA -5.0 Y +23181 VA -5.0 Y +23183 VA -5.0 Y +23184 VA -5.0 Y +23185 VA -5.0 Y +23186 VA -5.0 Y +23187 VA -5.0 Y +23188 VA -5.0 Y +23190 VA -5.0 Y +23192 VA -5.0 Y +23218 VA -5.0 Y +23219 VA -5.0 Y +23220 VA -5.0 Y +23221 VA -5.0 Y +23222 VA -5.0 Y +23223 VA -5.0 Y +23224 VA -5.0 Y +23225 VA -5.0 Y +23226 VA -5.0 Y +23227 VA -5.0 Y +23228 VA -5.0 Y +23229 VA -5.0 Y +23230 VA -5.0 Y +23231 VA -5.0 Y +23232 VA -5.0 Y +23233 VA -5.0 Y +23234 VA -5.0 Y +23235 VA -5.0 Y +23236 VA -5.0 Y +23237 VA -5.0 Y +23238 VA -5.0 Y +23240 VA -5.0 Y +23241 VA -5.0 Y +23242 VA -5.0 Y +23249 VA -5.0 Y +23250 VA -5.0 Y +23255 VA -5.0 Y +23260 VA -5.0 Y +23261 VA -5.0 Y +23269 VA -5.0 Y +23273 VA -5.0 Y +23274 VA -5.0 Y +23276 VA -5.0 Y +23278 VA -5.0 Y +23279 VA -5.0 Y +23282 VA -5.0 Y +23284 VA -5.0 Y +23285 VA -5.0 Y +23286 VA -5.0 Y +23288 VA -5.0 Y +23289 VA -5.0 Y +23290 VA -5.0 Y +23291 VA -5.0 Y +23292 VA -5.0 Y +23293 VA -5.0 Y +23294 VA -5.0 Y +23295 VA -5.0 Y +23297 VA -5.0 Y +23298 VA -5.0 Y +23301 VA -5.0 Y +23302 VA -5.0 Y +23303 VA -5.0 Y +23304 VA -5.0 Y +23306 VA -5.0 Y +23307 VA -5.0 Y +23308 VA -5.0 Y +23310 VA -5.0 Y +23313 VA -5.0 Y +23314 VA -5.0 Y +23315 VA -5.0 Y +23316 VA -5.0 Y +23320 VA -5.0 Y +23321 VA -5.0 Y +23322 VA -5.0 Y +23323 VA -5.0 Y +23324 VA -5.0 Y +23325 VA -5.0 Y +23326 VA -5.0 Y +23327 VA -5.0 Y +23328 VA -5.0 Y +23336 VA -5.0 Y +23337 VA -5.0 Y +23341 VA -5.0 Y +23345 VA -5.0 Y +23347 VA -5.0 Y +23350 VA -5.0 Y +23354 VA -5.0 Y +23356 VA -5.0 Y +23357 VA -5.0 Y +23358 VA -5.0 Y +23359 VA -5.0 Y +23389 VA -5.0 Y +23395 VA -5.0 Y +23396 VA -5.0 Y +23397 VA -5.0 Y +23398 VA -5.0 Y +23399 VA -5.0 Y +23401 VA -5.0 Y +23404 VA -5.0 Y +23405 VA -5.0 Y +23407 VA -5.0 Y +23408 VA -5.0 Y +23409 VA -5.0 Y +23410 VA -5.0 Y +23412 VA -5.0 Y +23413 VA -5.0 Y +23414 VA -5.0 Y +23415 VA -5.0 Y +23416 VA -5.0 Y +23417 VA -5.0 Y +23418 VA -5.0 Y +23419 VA -5.0 Y +23420 VA -5.0 Y +23421 VA -5.0 Y +23422 VA -5.0 Y +23423 VA -5.0 Y +23424 VA -5.0 Y +23426 VA -5.0 Y +23427 VA -5.0 Y +23429 VA -5.0 Y +23430 VA -5.0 Y +23431 VA -5.0 Y +23432 VA -5.0 Y +23433 VA -5.0 Y +23434 VA -5.0 Y +23435 VA -5.0 Y +23436 VA -5.0 Y +23437 VA -5.0 Y +23438 VA -5.0 Y +23439 VA -5.0 Y +23440 VA -5.0 Y +23441 VA -5.0 Y +23442 VA -5.0 Y +23443 VA -5.0 Y +23450 VA -5.0 Y +23451 VA -5.0 Y +23452 VA -5.0 Y +23453 VA -5.0 Y +23454 VA -5.0 Y +23455 VA -5.0 Y +23456 VA -5.0 Y +23457 VA -5.0 Y +23458 VA -5.0 Y +23459 VA -5.0 Y +23460 VA -5.0 Y +23461 VA -5.0 Y +23462 VA -5.0 Y +23463 VA -5.0 Y +23464 VA -5.0 Y +23465 VA -5.0 Y +23466 VA -5.0 Y +23467 VA -5.0 Y +23471 VA -5.0 Y +23479 VA -5.0 Y +23480 VA -5.0 Y +23482 VA -5.0 Y +23483 VA -5.0 Y +23486 VA -5.0 Y +23487 VA -5.0 Y +23488 VA -5.0 Y +23501 VA -5.0 Y +23502 VA -5.0 Y +23503 VA -5.0 Y +23504 VA -5.0 Y +23505 VA -5.0 Y +23506 VA -5.0 Y +23507 VA -5.0 Y +23508 VA -5.0 Y +23509 VA -5.0 Y +23510 VA -5.0 Y +23511 VA -5.0 Y +23512 VA -5.0 Y +23513 VA -5.0 Y +23514 VA -5.0 Y +23515 VA -5.0 Y +23517 VA -5.0 Y +23518 VA -5.0 Y +23519 VA -5.0 Y +23520 VA -5.0 Y +23521 VA -5.0 Y +23523 VA -5.0 Y +23529 VA -5.0 Y +23541 VA -5.0 Y +23551 VA -5.0 Y +23601 VA -5.0 Y +23602 VA -5.0 Y +23603 VA -5.0 Y +23604 VA -5.0 Y +23605 VA -5.0 Y +23606 VA -5.0 Y +23607 VA -5.0 Y +23608 VA -5.0 Y +23609 VA -5.0 Y +23612 VA -5.0 Y +23628 VA -5.0 Y +23630 VA -5.0 Y +23651 VA -5.0 Y +23661 VA -5.0 Y +23662 VA -5.0 Y +23663 VA -5.0 Y +23664 VA -5.0 Y +23665 VA -5.0 Y +23666 VA -5.0 Y +23667 VA -5.0 Y +23668 VA -5.0 Y +23669 VA -5.0 Y +23670 VA -5.0 Y +23681 VA -5.0 Y +23690 VA -5.0 Y +23691 VA -5.0 Y +23692 VA -5.0 Y +23693 VA -5.0 Y +23694 VA -5.0 Y +23696 VA -5.0 Y +23701 VA -5.0 Y +23702 VA -5.0 Y +23703 VA -5.0 Y +23704 VA -5.0 Y +23705 VA -5.0 Y +23707 VA -5.0 Y +23708 VA -5.0 Y +23709 VA -5.0 Y +23801 VA -5.0 Y +23803 VA -5.0 Y +23804 VA -5.0 Y +23805 VA -5.0 Y +23806 VA -5.0 Y +23821 VA -5.0 Y +23822 VA -5.0 Y +23824 VA -5.0 Y +23825 VA -5.0 Y +23827 VA -5.0 Y +23828 VA -5.0 Y +23829 VA -5.0 Y +23830 VA -5.0 Y +23831 VA -5.0 Y +23832 VA -5.0 Y +23833 VA -5.0 Y +23834 VA -5.0 Y +23836 VA -5.0 Y +23837 VA -5.0 Y +23838 VA -5.0 Y +23839 VA -5.0 Y +23840 VA -5.0 Y +23841 VA -5.0 Y +23842 VA -5.0 Y +23843 VA -5.0 Y +23844 VA -5.0 Y +23845 VA -5.0 Y +23846 VA -5.0 Y +23847 VA -5.0 Y +23850 VA -5.0 Y +23851 VA -5.0 Y +23856 VA -5.0 Y +23857 VA -5.0 Y +23860 VA -5.0 Y +23866 VA -5.0 Y +23867 VA -5.0 Y +23868 VA -5.0 Y +23870 VA -5.0 Y +23872 VA -5.0 Y +23873 VA -5.0 Y +23874 VA -5.0 Y +23875 VA -5.0 Y +23876 VA -5.0 Y +23878 VA -5.0 Y +23879 VA -5.0 Y +23881 VA -5.0 Y +23882 VA -5.0 Y +23883 VA -5.0 Y +23884 VA -5.0 Y +23885 VA -5.0 Y +23887 VA -5.0 Y +23888 VA -5.0 Y +23889 VA -5.0 Y +23890 VA -5.0 Y +23891 VA -5.0 Y +23893 VA -5.0 Y +23894 VA -5.0 Y +23897 VA -5.0 Y +23898 VA -5.0 Y +23899 VA -5.0 Y +23901 VA -5.0 Y +23909 VA -5.0 Y +23915 VA -5.0 Y +23917 VA -5.0 Y +23919 VA -5.0 Y +23920 VA -5.0 Y +23921 VA -5.0 Y +23922 VA -5.0 Y +23923 VA -5.0 Y +23924 VA -5.0 Y +23927 VA -5.0 Y +23930 VA -5.0 Y +23934 VA -5.0 Y +23936 VA -5.0 Y +23937 VA -5.0 Y +23938 VA -5.0 Y +23939 VA -5.0 Y +23941 VA -5.0 Y +23942 VA -5.0 Y +23943 VA -5.0 Y +23944 VA -5.0 Y +23947 VA -5.0 Y +23950 VA -5.0 Y +23952 VA -5.0 Y +23954 VA -5.0 Y +23955 VA -5.0 Y +23958 VA -5.0 Y +23959 VA -5.0 Y +23960 VA -5.0 Y +23962 VA -5.0 Y +23963 VA -5.0 Y +23964 VA -5.0 Y +23966 VA -5.0 Y +23967 VA -5.0 Y +23968 VA -5.0 Y +23970 VA -5.0 Y +23974 VA -5.0 Y +23976 VA -5.0 Y +24001 VA -5.0 Y +24002 VA -5.0 Y +24003 VA -5.0 Y +24004 VA -5.0 Y +24005 VA -5.0 Y +24006 VA -5.0 Y +24007 VA -5.0 Y +24008 VA -5.0 Y +24009 VA -5.0 Y +24010 VA -5.0 Y +24011 VA -5.0 Y +24012 VA -5.0 Y +24013 VA -5.0 Y +24014 VA -5.0 Y +24015 VA -5.0 Y +24016 VA -5.0 Y +24017 VA -5.0 Y +24018 VA -5.0 Y +24019 VA -5.0 Y +24020 VA -5.0 Y +24022 VA -5.0 Y +24023 VA -5.0 Y +24024 VA -5.0 Y +24025 VA -5.0 Y +24026 VA -5.0 Y +24027 VA -5.0 Y +24028 VA -5.0 Y +24029 VA -5.0 Y +24030 VA -5.0 Y +24031 VA -5.0 Y +24032 VA -5.0 Y +24033 VA -5.0 Y +24034 VA -5.0 Y +24035 VA -5.0 Y +24036 VA -5.0 Y +24037 VA -5.0 Y +24038 VA -5.0 Y +24040 VA -5.0 Y +24042 VA -5.0 Y +24043 VA -5.0 Y +24044 VA -5.0 Y +24045 VA -5.0 Y +24048 VA -5.0 Y +24050 VA -5.0 Y +24053 VA -5.0 Y +24054 VA -5.0 Y +24055 VA -5.0 Y +24058 VA -5.0 Y +24059 VA -5.0 Y +24060 VA -5.0 Y +24061 VA -5.0 Y +24062 VA -5.0 Y +24063 VA -5.0 Y +24064 VA -5.0 Y +24065 VA -5.0 Y +24066 VA -5.0 Y +24067 VA -5.0 Y +24068 VA -5.0 Y +24069 VA -5.0 Y +24070 VA -5.0 Y +24072 VA -5.0 Y +24073 VA -5.0 Y +24076 VA -5.0 Y +24077 VA -5.0 Y +24078 VA -5.0 Y +24079 VA -5.0 Y +24082 VA -5.0 Y +24083 VA -5.0 Y +24084 VA -5.0 Y +24085 VA -5.0 Y +24086 VA -5.0 Y +24087 VA -5.0 Y +24088 VA -5.0 Y +24089 VA -5.0 Y +24090 VA -5.0 Y +24091 VA -5.0 Y +24092 VA -5.0 Y +24093 VA -5.0 Y +24095 VA -5.0 Y +24101 VA -5.0 Y +24102 VA -5.0 Y +24104 VA -5.0 Y +24105 VA -5.0 Y +24111 VA -5.0 Y +24112 VA -5.0 Y +24113 VA -5.0 Y +24114 VA -5.0 Y +24115 VA -5.0 Y +24120 VA -5.0 Y +24121 VA -5.0 Y +24122 VA -5.0 Y +24124 VA -5.0 Y +24126 VA -5.0 Y +24127 VA -5.0 Y +24128 VA -5.0 Y +24129 VA -5.0 Y +24130 VA -5.0 Y +24131 VA -5.0 Y +24132 VA -5.0 Y +24133 VA -5.0 Y +24134 VA -5.0 Y +24136 VA -5.0 Y +24137 VA -5.0 Y +24138 VA -5.0 Y +24139 VA -5.0 Y +24141 VA -5.0 Y +24142 VA -5.0 Y +24143 VA -5.0 Y +24146 VA -5.0 Y +24147 VA -5.0 Y +24148 VA -5.0 Y +24149 VA -5.0 Y +24150 VA -5.0 Y +24151 VA -5.0 Y +24153 VA -5.0 Y +24155 VA -5.0 Y +24157 VA -5.0 Y +24161 VA -5.0 Y +24162 VA -5.0 Y +24165 VA -5.0 Y +24167 VA -5.0 Y +24168 VA -5.0 Y +24171 VA -5.0 Y +24174 VA -5.0 Y +24175 VA -5.0 Y +24176 VA -5.0 Y +24177 VA -5.0 Y +24178 VA -5.0 Y +24179 VA -5.0 Y +24184 VA -5.0 Y +24185 VA -5.0 Y +24201 VA -5.0 Y +24202 VA -5.0 Y +24203 VA -5.0 Y +24209 VA -5.0 Y +24210 VA -5.0 Y +24211 VA -5.0 Y +24212 VA -5.0 Y +24215 VA -5.0 Y +24216 VA -5.0 Y +24217 VA -5.0 Y +24218 VA -5.0 Y +24219 VA -5.0 Y +24220 VA -5.0 Y +24221 VA -5.0 Y +24224 VA -5.0 Y +24225 VA -5.0 Y +24226 VA -5.0 Y +24228 VA -5.0 Y +24230 VA -5.0 Y +24236 VA -5.0 Y +24237 VA -5.0 Y +24239 VA -5.0 Y +24243 VA -5.0 Y +24244 VA -5.0 Y +24245 VA -5.0 Y +24246 VA -5.0 Y +24248 VA -5.0 Y +24250 VA -5.0 Y +24251 VA -5.0 Y +24256 VA -5.0 Y +24258 VA -5.0 Y +24260 VA -5.0 Y +24263 VA -5.0 Y +24265 VA -5.0 Y +24266 VA -5.0 Y +24269 VA -5.0 Y +24270 VA -5.0 Y +24271 VA -5.0 Y +24272 VA -5.0 Y +24273 VA -5.0 Y +24277 VA -5.0 Y +24279 VA -5.0 Y +24280 VA -5.0 Y +24281 VA -5.0 Y +24282 VA -5.0 Y +24283 VA -5.0 Y +24290 VA -5.0 Y +24292 VA -5.0 Y +24293 VA -5.0 Y +24301 VA -5.0 Y +24311 VA -5.0 Y +24312 VA -5.0 Y +24313 VA -5.0 Y +24314 VA -5.0 Y +24315 VA -5.0 Y +24316 VA -5.0 Y +24317 VA -5.0 Y +24318 VA -5.0 Y +24319 VA -5.0 Y +24322 VA -5.0 Y +24323 VA -5.0 Y +24324 VA -5.0 Y +24325 VA -5.0 Y +24326 VA -5.0 Y +24327 VA -5.0 Y +24328 VA -5.0 Y +24330 VA -5.0 Y +24333 VA -5.0 Y +24340 VA -5.0 Y +24343 VA -5.0 Y +24347 VA -5.0 Y +24348 VA -5.0 Y +24350 VA -5.0 Y +24351 VA -5.0 Y +24352 VA -5.0 Y +24354 VA -5.0 Y +24360 VA -5.0 Y +24361 VA -5.0 Y +24363 VA -5.0 Y +24366 VA -5.0 Y +24368 VA -5.0 Y +24370 VA -5.0 Y +24374 VA -5.0 Y +24375 VA -5.0 Y +24377 VA -5.0 Y +24378 VA -5.0 Y +24380 VA -5.0 Y +24381 VA -5.0 Y +24382 VA -5.0 Y +24401 VA -5.0 Y +24402 VA -5.0 Y +24411 VA -5.0 Y +24412 VA -5.0 Y +24413 VA -5.0 Y +24415 VA -5.0 Y +24416 VA -5.0 Y +24421 VA -5.0 Y +24422 VA -5.0 Y +24426 VA -5.0 Y +24430 VA -5.0 Y +24431 VA -5.0 Y +24432 VA -5.0 Y +24433 VA -5.0 Y +24435 VA -5.0 Y +24437 VA -5.0 Y +24438 VA -5.0 Y +24439 VA -5.0 Y +24440 VA -5.0 Y +24441 VA -5.0 Y +24442 VA -5.0 Y +24445 VA -5.0 Y +24448 VA -5.0 Y +24450 VA -5.0 Y +24457 VA -5.0 Y +24458 VA -5.0 Y +24459 VA -5.0 Y +24460 VA -5.0 Y +24463 VA -5.0 Y +24464 VA -5.0 Y +24465 VA -5.0 Y +24467 VA -5.0 Y +24468 VA -5.0 Y +24469 VA -5.0 Y +24471 VA -5.0 Y +24472 VA -5.0 Y +24473 VA -5.0 Y +24474 VA -5.0 Y +24476 VA -5.0 Y +24477 VA -5.0 Y +24479 VA -5.0 Y +24482 VA -5.0 Y +24483 VA -5.0 Y +24484 VA -5.0 Y +24485 VA -5.0 Y +24486 VA -5.0 Y +24487 VA -5.0 Y +24501 VA -5.0 Y +24502 VA -5.0 Y +24503 VA -5.0 Y +24504 VA -5.0 Y +24505 VA -5.0 Y +24506 VA -5.0 Y +24512 VA -5.0 Y +24513 VA -5.0 Y +24514 VA -5.0 Y +24515 VA -5.0 Y +24517 VA -5.0 Y +24520 VA -5.0 Y +24521 VA -5.0 Y +24522 VA -5.0 Y +24523 VA -5.0 Y +24526 VA -5.0 Y +24527 VA -5.0 Y +24528 VA -5.0 Y +24529 VA -5.0 Y +24530 VA -5.0 Y +24531 VA -5.0 Y +24533 VA -5.0 Y +24534 VA -5.0 Y +24535 VA -5.0 Y +24536 VA -5.0 Y +24538 VA -5.0 Y +24539 VA -5.0 Y +24540 VA -5.0 Y +24541 VA -5.0 Y +24543 VA -5.0 Y +24544 VA -5.0 Y +24549 VA -5.0 Y +24550 VA -5.0 Y +24551 VA -5.0 Y +24553 VA -5.0 Y +24554 VA -5.0 Y +24555 VA -5.0 Y +24556 VA -5.0 Y +24557 VA -5.0 Y +24558 VA -5.0 Y +24562 VA -5.0 Y +24563 VA -5.0 Y +24565 VA -5.0 Y +24566 VA -5.0 Y +24569 VA -5.0 Y +24570 VA -5.0 Y +24571 VA -5.0 Y +24572 VA -5.0 Y +24574 VA -5.0 Y +24576 VA -5.0 Y +24577 VA -5.0 Y +24578 VA -5.0 Y +24579 VA -5.0 Y +24580 VA -5.0 Y +24581 VA -5.0 Y +24586 VA -5.0 Y +24588 VA -5.0 Y +24589 VA -5.0 Y +24590 VA -5.0 Y +24592 VA -5.0 Y +24593 VA -5.0 Y +24594 VA -5.0 Y +24595 VA -5.0 Y +24597 VA -5.0 Y +24598 VA -5.0 Y +24599 VA -5.0 Y +24601 VA -5.0 Y +24602 VA -5.0 Y +24603 VA -5.0 Y +24604 VA -5.0 Y +24605 VA -5.0 Y +24606 VA -5.0 Y +24607 VA -5.0 Y +24608 VA -5.0 Y +24609 VA -5.0 Y +24612 VA -5.0 Y +24613 VA -5.0 Y +24614 VA -5.0 Y +24619 VA -5.0 Y +24620 VA -5.0 Y +24622 VA -5.0 Y +24624 VA -5.0 Y +24627 VA -5.0 Y +24628 VA -5.0 Y +24630 VA -5.0 Y +24631 VA -5.0 Y +24634 VA -5.0 Y +24635 VA -5.0 Y +24637 VA -5.0 Y +24639 VA -5.0 Y +24640 VA -5.0 Y +24641 VA -5.0 Y +24646 VA -5.0 Y +24647 VA -5.0 Y +24649 VA -5.0 Y +24651 VA -5.0 Y +24656 VA -5.0 Y +24657 VA -5.0 Y +24658 VA -5.0 Y +24701 WV -5.0 Y +24712 WV -5.0 Y +24714 WV -5.0 Y +24715 WV -5.0 Y +24716 WV -5.0 Y +24719 WV -5.0 Y +24724 WV -5.0 Y +24726 WV -5.0 Y +24729 WV -5.0 Y +24731 WV -5.0 Y +24732 WV -5.0 Y +24733 WV -5.0 Y +24736 WV -5.0 Y +24737 WV -5.0 Y +24738 WV -5.0 Y +24739 WV -5.0 Y +24740 WV -5.0 Y +24747 WV -5.0 Y +24751 WV -5.0 Y +24801 WV -5.0 Y +24808 WV -5.0 Y +24811 WV -5.0 Y +24813 WV -5.0 Y +24815 WV -5.0 Y +24816 WV -5.0 Y +24817 WV -5.0 Y +24818 WV -5.0 Y +24822 WV -5.0 Y +24823 WV -5.0 Y +24824 WV -5.0 Y +24826 WV -5.0 Y +24827 WV -5.0 Y +24828 WV -5.0 Y +24829 WV -5.0 Y +24830 WV -5.0 Y +24831 WV -5.0 Y +24834 WV -5.0 Y +24836 WV -5.0 Y +24839 WV -5.0 Y +24842 WV -5.0 Y +24843 WV -5.0 Y +24844 WV -5.0 Y +24845 WV -5.0 Y +24846 WV -5.0 Y +24847 WV -5.0 Y +24848 WV -5.0 Y +24849 WV -5.0 Y +24850 WV -5.0 Y +24851 WV -5.0 Y +24853 WV -5.0 Y +24854 WV -5.0 Y +24855 WV -5.0 Y +24857 WV -5.0 Y +24859 WV -5.0 Y +24860 WV -5.0 Y +24861 WV -5.0 Y +24862 WV -5.0 Y +24866 WV -5.0 Y +24867 WV -5.0 Y +24868 WV -5.0 Y +24869 WV -5.0 Y +24870 WV -5.0 Y +24871 WV -5.0 Y +24872 WV -5.0 Y +24873 WV -5.0 Y +24874 WV -5.0 Y +24878 WV -5.0 Y +24879 WV -5.0 Y +24880 WV -5.0 Y +24881 WV -5.0 Y +24882 WV -5.0 Y +24884 WV -5.0 Y +24887 WV -5.0 Y +24888 WV -5.0 Y +24892 WV -5.0 Y +24894 WV -5.0 Y +24895 WV -5.0 Y +24898 WV -5.0 Y +24901 WV -5.0 Y +24902 WV -5.0 Y +24910 WV -5.0 Y +24915 WV -5.0 Y +24916 WV -5.0 Y +24918 WV -5.0 Y +24920 WV -5.0 Y +24924 WV -5.0 Y +24925 WV -5.0 Y +24927 WV -5.0 Y +24931 WV -5.0 Y +24934 WV -5.0 Y +24935 WV -5.0 Y +24938 WV -5.0 Y +24941 WV -5.0 Y +24943 WV -5.0 Y +24944 WV -5.0 Y +24945 WV -5.0 Y +24946 WV -5.0 Y +24951 WV -5.0 Y +24954 WV -5.0 Y +24957 WV -5.0 Y +24961 WV -5.0 Y +24962 WV -5.0 Y +24963 WV -5.0 Y +24966 WV -5.0 Y +24970 WV -5.0 Y +24974 WV -5.0 Y +24976 WV -5.0 Y +24977 WV -5.0 Y +24981 WV -5.0 Y +24983 WV -5.0 Y +24984 WV -5.0 Y +24985 WV -5.0 Y +24986 WV -5.0 Y +24991 WV -5.0 Y +24993 WV -5.0 Y +25002 WV -5.0 Y +25003 WV -5.0 Y +25005 WV -5.0 Y +25007 WV -5.0 Y +25008 WV -5.0 Y +25009 WV -5.0 Y +25011 WV -5.0 Y +25015 WV -5.0 Y +25019 WV -5.0 Y +25021 WV -5.0 Y +25022 WV -5.0 Y +25024 WV -5.0 Y +25025 WV -5.0 Y +25026 WV -5.0 Y +25028 WV -5.0 Y +25030 WV -5.0 Y +25031 WV -5.0 Y +25033 WV -5.0 Y +25035 WV -5.0 Y +25036 WV -5.0 Y +25039 WV -5.0 Y +25040 WV -5.0 Y +25043 WV -5.0 Y +25044 WV -5.0 Y +25045 WV -5.0 Y +25047 WV -5.0 Y +25048 WV -5.0 Y +25049 WV -5.0 Y +25051 WV -5.0 Y +25053 WV -5.0 Y +25054 WV -5.0 Y +25057 WV -5.0 Y +25059 WV -5.0 Y +25060 WV -5.0 Y +25061 WV -5.0 Y +25062 WV -5.0 Y +25063 WV -5.0 Y +25064 WV -5.0 Y +25067 WV -5.0 Y +25070 WV -5.0 Y +25071 WV -5.0 Y +25075 WV -5.0 Y +25076 WV -5.0 Y +25079 WV -5.0 Y +25081 WV -5.0 Y +25082 WV -5.0 Y +25083 WV -5.0 Y +25085 WV -5.0 Y +25086 WV -5.0 Y +25088 WV -5.0 Y +25090 WV -5.0 Y +25093 WV -5.0 Y +25102 WV -5.0 Y +25103 WV -5.0 Y +25106 WV -5.0 Y +25107 WV -5.0 Y +25108 WV -5.0 Y +25109 WV -5.0 Y +25110 WV -5.0 Y +25111 WV -5.0 Y +25112 WV -5.0 Y +25113 WV -5.0 Y +25114 WV -5.0 Y +25115 WV -5.0 Y +25118 WV -5.0 Y +25119 WV -5.0 Y +25121 WV -5.0 Y +25123 WV -5.0 Y +25124 WV -5.0 Y +25125 WV -5.0 Y +25126 WV -5.0 Y +25130 WV -5.0 Y +25132 WV -5.0 Y +25133 WV -5.0 Y +25134 WV -5.0 Y +25136 WV -5.0 Y +25139 WV -5.0 Y +25140 WV -5.0 Y +25141 WV -5.0 Y +25142 WV -5.0 Y +25143 WV -5.0 Y +25148 WV -5.0 Y +25149 WV -5.0 Y +25152 WV -5.0 Y +25154 WV -5.0 Y +25156 WV -5.0 Y +25159 WV -5.0 Y +25160 WV -5.0 Y +25161 WV -5.0 Y +25162 WV -5.0 Y +25164 WV -5.0 Y +25165 WV -5.0 Y +25168 WV -5.0 Y +25169 WV -5.0 Y +25173 WV -5.0 Y +25174 WV -5.0 Y +25177 WV -5.0 Y +25180 WV -5.0 Y +25181 WV -5.0 Y +25183 WV -5.0 Y +25185 WV -5.0 Y +25186 WV -5.0 Y +25187 WV -5.0 Y +25193 WV -5.0 Y +25201 WV -5.0 Y +25202 WV -5.0 Y +25203 WV -5.0 Y +25204 WV -5.0 Y +25205 WV -5.0 Y +25206 WV -5.0 Y +25208 WV -5.0 Y +25209 WV -5.0 Y +25211 WV -5.0 Y +25213 WV -5.0 Y +25214 WV -5.0 Y +25231 WV -5.0 Y +25234 WV -5.0 Y +25235 WV -5.0 Y +25239 WV -5.0 Y +25241 WV -5.0 Y +25243 WV -5.0 Y +25244 WV -5.0 Y +25245 WV -5.0 Y +25247 WV -5.0 Y +25248 WV -5.0 Y +25251 WV -5.0 Y +25252 WV -5.0 Y +25253 WV -5.0 Y +25259 WV -5.0 Y +25260 WV -5.0 Y +25261 WV -5.0 Y +25262 WV -5.0 Y +25264 WV -5.0 Y +25265 WV -5.0 Y +25266 WV -5.0 Y +25267 WV -5.0 Y +25268 WV -5.0 Y +25270 WV -5.0 Y +25271 WV -5.0 Y +25275 WV -5.0 Y +25276 WV -5.0 Y +25285 WV -5.0 Y +25286 WV -5.0 Y +25287 WV -5.0 Y +25301 WV -5.0 Y +25302 WV -5.0 Y +25303 WV -5.0 Y +25304 WV -5.0 Y +25305 WV -5.0 Y +25306 WV -5.0 Y +25309 WV -5.0 Y +25311 WV -5.0 Y +25312 WV -5.0 Y +25313 WV -5.0 Y +25314 WV -5.0 Y +25315 WV -5.0 Y +25317 WV -5.0 Y +25320 WV -5.0 Y +25321 WV -5.0 Y +25322 WV -5.0 Y +25323 WV -5.0 Y +25324 WV -5.0 Y +25325 WV -5.0 Y +25326 WV -5.0 Y +25327 WV -5.0 Y +25328 WV -5.0 Y +25329 WV -5.0 Y +25330 WV -5.0 Y +25331 WV -5.0 Y +25332 WV -5.0 Y +25333 WV -5.0 Y +25334 WV -5.0 Y +25335 WV -5.0 Y +25336 WV -5.0 Y +25337 WV -5.0 Y +25338 WV -5.0 Y +25339 WV -5.0 Y +25350 WV -5.0 Y +25356 WV -5.0 Y +25357 WV -5.0 Y +25358 WV -5.0 Y +25360 WV -5.0 Y +25361 WV -5.0 Y +25362 WV -5.0 Y +25364 WV -5.0 Y +25365 WV -5.0 Y +25375 WV -5.0 Y +25387 WV -5.0 Y +25389 WV -5.0 Y +25392 WV -5.0 Y +25396 WV -5.0 Y +25401 WV -5.0 Y +25402 WV -5.0 Y +25403 WV -5.0 Y +25404 WV -5.0 Y +25405 WV -5.0 Y +25410 WV -5.0 Y +25411 WV -5.0 Y +25413 WV -5.0 Y +25414 WV -5.0 Y +25419 WV -5.0 Y +25420 WV -5.0 Y +25421 WV -5.0 Y +25422 WV -5.0 Y +25423 WV -5.0 Y +25425 WV -5.0 Y +25427 WV -5.0 Y +25428 WV -5.0 Y +25429 WV -5.0 Y +25430 WV -5.0 Y +25431 WV -5.0 Y +25432 WV -5.0 Y +25434 WV -5.0 Y +25437 WV -5.0 Y +25438 WV -5.0 Y +25440 WV -5.0 Y +25441 WV -5.0 Y +25442 WV -5.0 Y +25443 WV -5.0 Y +25444 WV -5.0 Y +25446 WV -5.0 Y +25501 WV -5.0 Y +25502 WV -5.0 Y +25503 WV -5.0 Y +25504 WV -5.0 Y +25505 WV -5.0 Y +25506 WV -5.0 Y +25507 WV -5.0 Y +25508 WV -5.0 Y +25510 WV -5.0 Y +25511 WV -5.0 Y +25512 WV -5.0 Y +25514 WV -5.0 Y +25515 WV -5.0 Y +25517 WV -5.0 Y +25520 WV -5.0 Y +25521 WV -5.0 Y +25523 WV -5.0 Y +25524 WV -5.0 Y +25526 WV -5.0 Y +25529 WV -5.0 Y +25530 WV -5.0 Y +25534 WV -5.0 Y +25535 WV -5.0 Y +25537 WV -5.0 Y +25540 WV -5.0 Y +25541 WV -5.0 Y +25544 WV -5.0 Y +25545 WV -5.0 Y +25547 WV -5.0 Y +25550 WV -5.0 Y +25555 WV -5.0 Y +25557 WV -5.0 Y +25559 WV -5.0 Y +25560 WV -5.0 Y +25562 WV -5.0 Y +25564 WV -5.0 Y +25565 WV -5.0 Y +25567 WV -5.0 Y +25569 WV -5.0 Y +25570 WV -5.0 Y +25571 WV -5.0 Y +25572 WV -5.0 Y +25573 WV -5.0 Y +25601 WV -5.0 Y +25606 WV -5.0 Y +25607 WV -5.0 Y +25608 WV -5.0 Y +25611 WV -5.0 Y +25612 WV -5.0 Y +25614 WV -5.0 Y +25617 WV -5.0 Y +25621 WV -5.0 Y +25624 WV -5.0 Y +25625 WV -5.0 Y +25628 WV -5.0 Y +25630 WV -5.0 Y +25632 WV -5.0 Y +25634 WV -5.0 Y +25635 WV -5.0 Y +25637 WV -5.0 Y +25638 WV -5.0 Y +25639 WV -5.0 Y +25644 WV -5.0 Y +25646 WV -5.0 Y +25647 WV -5.0 Y +25649 WV -5.0 Y +25650 WV -5.0 Y +25651 WV -5.0 Y +25652 WV -5.0 Y +25653 WV -5.0 Y +25654 WV -5.0 Y +25661 WV -5.0 Y +25665 WV -5.0 Y +25666 WV -5.0 Y +25667 WV -5.0 Y +25669 WV -5.0 Y +25670 WV -5.0 Y +25671 WV -5.0 Y +25672 WV -5.0 Y +25674 WV -5.0 Y +25676 WV -5.0 Y +25678 WV -5.0 Y +25685 WV -5.0 Y +25686 WV -5.0 Y +25688 WV -5.0 Y +25690 WV -5.0 Y +25691 WV -5.0 Y +25692 WV -5.0 Y +25696 WV -5.0 Y +25697 WV -5.0 Y +25699 WV -5.0 Y +25701 WV -5.0 Y +25702 WV -5.0 Y +25703 WV -5.0 Y +25704 WV -5.0 Y +25705 WV -5.0 Y +25706 WV -5.0 Y +25707 WV -5.0 Y +25708 WV -5.0 Y +25709 WV -5.0 Y +25710 WV -5.0 Y +25711 WV -5.0 Y +25712 WV -5.0 Y +25713 WV -5.0 Y +25714 WV -5.0 Y +25715 WV -5.0 Y +25716 WV -5.0 Y +25717 WV -5.0 Y +25718 WV -5.0 Y +25719 WV -5.0 Y +25720 WV -5.0 Y +25721 WV -5.0 Y +25722 WV -5.0 Y +25723 WV -5.0 Y +25724 WV -5.0 Y +25725 WV -5.0 Y +25726 WV -5.0 Y +25727 WV -5.0 Y +25728 WV -5.0 Y +25729 WV -5.0 Y +25755 WV -5.0 Y +25770 WV -5.0 Y +25771 WV -5.0 Y +25772 WV -5.0 Y +25773 WV -5.0 Y +25774 WV -5.0 Y +25775 WV -5.0 Y +25776 WV -5.0 Y +25777 WV -5.0 Y +25778 WV -5.0 Y +25779 WV -5.0 Y +25801 WV -5.0 Y +25802 WV -5.0 Y +25810 WV -5.0 Y +25811 WV -5.0 Y +25812 WV -5.0 Y +25813 WV -5.0 Y +25816 WV -5.0 Y +25817 WV -5.0 Y +25818 WV -5.0 Y +25820 WV -5.0 Y +25823 WV -5.0 Y +25825 WV -5.0 Y +25826 WV -5.0 Y +25827 WV -5.0 Y +25831 WV -5.0 Y +25832 WV -5.0 Y +25833 WV -5.0 Y +25836 WV -5.0 Y +25837 WV -5.0 Y +25839 WV -5.0 Y +25840 WV -5.0 Y +25841 WV -5.0 Y +25843 WV -5.0 Y +25844 WV -5.0 Y +25845 WV -5.0 Y +25846 WV -5.0 Y +25848 WV -5.0 Y +25849 WV -5.0 Y +25851 WV -5.0 Y +25853 WV -5.0 Y +25854 WV -5.0 Y +25855 WV -5.0 Y +25857 WV -5.0 Y +25860 WV -5.0 Y +25862 WV -5.0 Y +25864 WV -5.0 Y +25865 WV -5.0 Y +25866 WV -5.0 Y +25868 WV -5.0 Y +25870 WV -5.0 Y +25871 WV -5.0 Y +25873 WV -5.0 Y +25875 WV -5.0 Y +25876 WV -5.0 Y +25878 WV -5.0 Y +25879 WV -5.0 Y +25880 WV -5.0 Y +25882 WV -5.0 Y +25901 WV -5.0 Y +25902 WV -5.0 Y +25904 WV -5.0 Y +25906 WV -5.0 Y +25907 WV -5.0 Y +25908 WV -5.0 Y +25909 WV -5.0 Y +25911 WV -5.0 Y +25913 WV -5.0 Y +25914 WV -5.0 Y +25915 WV -5.0 Y +25916 WV -5.0 Y +25917 WV -5.0 Y +25918 WV -5.0 Y +25919 WV -5.0 Y +25920 WV -5.0 Y +25921 WV -5.0 Y +25922 WV -5.0 Y +25926 WV -5.0 Y +25927 WV -5.0 Y +25928 WV -5.0 Y +25932 WV -5.0 Y +25936 WV -5.0 Y +25938 WV -5.0 Y +25942 WV -5.0 Y +25943 WV -5.0 Y +25951 WV -5.0 Y +25958 WV -5.0 Y +25962 WV -5.0 Y +25965 WV -5.0 Y +25966 WV -5.0 Y +25969 WV -5.0 Y +25971 WV -5.0 Y +25972 WV -5.0 Y +25976 WV -5.0 Y +25977 WV -5.0 Y +25978 WV -5.0 Y +25979 WV -5.0 Y +25981 WV -5.0 Y +25984 WV -5.0 Y +25985 WV -5.0 Y +25986 WV -5.0 Y +25989 WV -5.0 Y +26003 WV -5.0 Y +26030 WV -5.0 Y +26031 WV -5.0 Y +26032 WV -5.0 Y +26033 WV -5.0 Y +26034 WV -5.0 Y +26035 WV -5.0 Y +26036 WV -5.0 Y +26037 WV -5.0 Y +26038 WV -5.0 Y +26039 WV -5.0 Y +26040 WV -5.0 Y +26041 WV -5.0 Y +26047 WV -5.0 Y +26050 WV -5.0 Y +26055 WV -5.0 Y +26056 WV -5.0 Y +26058 WV -5.0 Y +26059 WV -5.0 Y +26060 WV -5.0 Y +26062 WV -5.0 Y +26070 WV -5.0 Y +26074 WV -5.0 Y +26075 WV -5.0 Y +26101 WV -5.0 Y +26102 WV -5.0 Y +26103 WV -5.0 Y +26104 WV -5.0 Y +26105 WV -5.0 Y +26106 WV -5.0 Y +26120 WV -5.0 Y +26121 WV -5.0 Y +26133 WV -5.0 Y +26134 WV -5.0 Y +26136 WV -5.0 Y +26137 WV -5.0 Y +26138 WV -5.0 Y +26141 WV -5.0 Y +26142 WV -5.0 Y +26143 WV -5.0 Y +26146 WV -5.0 Y +26147 WV -5.0 Y +26148 WV -5.0 Y +26149 WV -5.0 Y +26150 WV -5.0 Y +26151 WV -5.0 Y +26152 WV -5.0 Y +26155 WV -5.0 Y +26159 WV -5.0 Y +26160 WV -5.0 Y +26161 WV -5.0 Y +26162 WV -5.0 Y +26164 WV -5.0 Y +26167 WV -5.0 Y +26169 WV -5.0 Y +26170 WV -5.0 Y +26175 WV -5.0 Y +26178 WV -5.0 Y +26180 WV -5.0 Y +26181 WV -5.0 Y +26184 WV -5.0 Y +26186 WV -5.0 Y +26187 WV -5.0 Y +26201 WV -5.0 Y +26202 WV -5.0 Y +26203 WV -5.0 Y +26205 WV -5.0 Y +26206 WV -5.0 Y +26208 WV -5.0 Y +26209 WV -5.0 Y +26210 WV -5.0 Y +26215 WV -5.0 Y +26217 WV -5.0 Y +26218 WV -5.0 Y +26219 WV -5.0 Y +26222 WV -5.0 Y +26224 WV -5.0 Y +26228 WV -5.0 Y +26229 WV -5.0 Y +26230 WV -5.0 Y +26234 WV -5.0 Y +26236 WV -5.0 Y +26237 WV -5.0 Y +26238 WV -5.0 Y +26241 WV -5.0 Y +26250 WV -5.0 Y +26253 WV -5.0 Y +26254 WV -5.0 Y +26257 WV -5.0 Y +26259 WV -5.0 Y +26260 WV -5.0 Y +26261 WV -5.0 Y +26263 WV -5.0 Y +26264 WV -5.0 Y +26266 WV -5.0 Y +26267 WV -5.0 Y +26268 WV -5.0 Y +26269 WV -5.0 Y +26270 WV -5.0 Y +26271 WV -5.0 Y +26273 WV -5.0 Y +26275 WV -5.0 Y +26276 WV -5.0 Y +26278 WV -5.0 Y +26280 WV -5.0 Y +26282 WV -5.0 Y +26283 WV -5.0 Y +26285 WV -5.0 Y +26287 WV -5.0 Y +26288 WV -5.0 Y +26289 WV -5.0 Y +26291 WV -5.0 Y +26292 WV -5.0 Y +26293 WV -5.0 Y +26294 WV -5.0 Y +26296 WV -5.0 Y +26298 WV -5.0 Y +26301 WV -5.0 Y +26302 WV -5.0 Y +26306 WV -5.0 Y +26320 WV -5.0 Y +26321 WV -5.0 Y +26323 WV -5.0 Y +26325 WV -5.0 Y +26327 WV -5.0 Y +26330 WV -5.0 Y +26335 WV -5.0 Y +26337 WV -5.0 Y +26338 WV -5.0 Y +26339 WV -5.0 Y +26342 WV -5.0 Y +26343 WV -5.0 Y +26346 WV -5.0 Y +26347 WV -5.0 Y +26348 WV -5.0 Y +26349 WV -5.0 Y +26351 WV -5.0 Y +26354 WV -5.0 Y +26361 WV -5.0 Y +26362 WV -5.0 Y +26366 WV -5.0 Y +26369 WV -5.0 Y +26372 WV -5.0 Y +26374 WV -5.0 Y +26376 WV -5.0 Y +26377 WV -5.0 Y +26378 WV -5.0 Y +26384 WV -5.0 Y +26385 WV -5.0 Y +26386 WV -5.0 Y +26404 WV -5.0 Y +26405 WV -5.0 Y +26408 WV -5.0 Y +26410 WV -5.0 Y +26411 WV -5.0 Y +26412 WV -5.0 Y +26415 WV -5.0 Y +26416 WV -5.0 Y +26419 WV -5.0 Y +26421 WV -5.0 Y +26422 WV -5.0 Y +26424 WV -5.0 Y +26425 WV -5.0 Y +26426 WV -5.0 Y +26430 WV -5.0 Y +26431 WV -5.0 Y +26434 WV -5.0 Y +26435 WV -5.0 Y +26436 WV -5.0 Y +26437 WV -5.0 Y +26438 WV -5.0 Y +26440 WV -5.0 Y +26443 WV -5.0 Y +26444 WV -5.0 Y +26447 WV -5.0 Y +26448 WV -5.0 Y +26451 WV -5.0 Y +26452 WV -5.0 Y +26456 WV -5.0 Y +26461 WV -5.0 Y +26463 WV -5.0 Y +26501 WV -5.0 Y +26502 WV -5.0 Y +26504 WV -5.0 Y +26505 WV -5.0 Y +26506 WV -5.0 Y +26507 WV -5.0 Y +26508 WV -5.0 Y +26519 WV -5.0 Y +26520 WV -5.0 Y +26521 WV -5.0 Y +26524 WV -5.0 Y +26525 WV -5.0 Y +26527 WV -5.0 Y +26531 WV -5.0 Y +26534 WV -5.0 Y +26537 WV -5.0 Y +26541 WV -5.0 Y +26542 WV -5.0 Y +26543 WV -5.0 Y +26544 WV -5.0 Y +26546 WV -5.0 Y +26547 WV -5.0 Y +26554 WV -5.0 Y +26555 WV -5.0 Y +26559 WV -5.0 Y +26560 WV -5.0 Y +26561 WV -5.0 Y +26562 WV -5.0 Y +26563 WV -5.0 Y +26566 WV -5.0 Y +26568 WV -5.0 Y +26570 WV -5.0 Y +26571 WV -5.0 Y +26572 WV -5.0 Y +26574 WV -5.0 Y +26575 WV -5.0 Y +26576 WV -5.0 Y +26578 WV -5.0 Y +26581 WV -5.0 Y +26582 WV -5.0 Y +26585 WV -5.0 Y +26586 WV -5.0 Y +26587 WV -5.0 Y +26588 WV -5.0 Y +26590 WV -5.0 Y +26591 WV -5.0 Y +26601 WV -5.0 Y +26610 WV -5.0 Y +26611 WV -5.0 Y +26615 WV -5.0 Y +26617 WV -5.0 Y +26619 WV -5.0 Y +26621 WV -5.0 Y +26623 WV -5.0 Y +26624 WV -5.0 Y +26627 WV -5.0 Y +26629 WV -5.0 Y +26631 WV -5.0 Y +26636 WV -5.0 Y +26638 WV -5.0 Y +26651 WV -5.0 Y +26656 WV -5.0 Y +26660 WV -5.0 Y +26662 WV -5.0 Y +26667 WV -5.0 Y +26671 WV -5.0 Y +26675 WV -5.0 Y +26676 WV -5.0 Y +26678 WV -5.0 Y +26679 WV -5.0 Y +26680 WV -5.0 Y +26681 WV -5.0 Y +26684 WV -5.0 Y +26690 WV -5.0 Y +26691 WV -5.0 Y +26704 WV -5.0 Y +26705 WV -5.0 Y +26707 WV -5.0 Y +26710 WV -5.0 Y +26711 WV -5.0 Y +26714 WV -5.0 Y +26716 WV -5.0 Y +26717 WV -5.0 Y +26719 WV -5.0 Y +26720 WV -5.0 Y +26722 WV -5.0 Y +26726 WV -5.0 Y +26731 WV -5.0 Y +26739 WV -5.0 Y +26743 WV -5.0 Y +26750 WV -5.0 Y +26753 WV -5.0 Y +26755 WV -5.0 Y +26757 WV -5.0 Y +26761 WV -5.0 Y +26763 WV -5.0 Y +26764 WV -5.0 Y +26767 WV -5.0 Y +26801 WV -5.0 Y +26802 WV -5.0 Y +26804 WV -5.0 Y +26807 WV -5.0 Y +26808 WV -5.0 Y +26810 WV -5.0 Y +26812 WV -5.0 Y +26814 WV -5.0 Y +26815 WV -5.0 Y +26817 WV -5.0 Y +26818 WV -5.0 Y +26823 WV -5.0 Y +26833 WV -5.0 Y +26836 WV -5.0 Y +26838 WV -5.0 Y +26845 WV -5.0 Y +26847 WV -5.0 Y +26851 WV -5.0 Y +26852 WV -5.0 Y +26855 WV -5.0 Y +26865 WV -5.0 Y +26866 WV -5.0 Y +26884 WV -5.0 Y +26886 WV -5.0 Y +27006 NC -5.0 Y +27007 NC -5.0 Y +27009 NC -5.0 Y +27010 NC -5.0 Y +27011 NC -5.0 Y +27012 NC -5.0 Y +27013 NC -5.0 Y +27014 NC -5.0 Y +27016 NC -5.0 Y +27017 NC -5.0 Y +27018 NC -5.0 Y +27019 NC -5.0 Y +27020 NC -5.0 Y +27021 NC -5.0 Y +27022 NC -5.0 Y +27023 NC -5.0 Y +27024 NC -5.0 Y +27025 NC -5.0 Y +27027 NC -5.0 Y +27028 NC -5.0 Y +27030 NC -5.0 Y +27031 NC -5.0 Y +27040 NC -5.0 Y +27041 NC -5.0 Y +27042 NC -5.0 Y +27043 NC -5.0 Y +27045 NC -5.0 Y +27046 NC -5.0 Y +27047 NC -5.0 Y +27048 NC -5.0 Y +27049 NC -5.0 Y +27050 NC -5.0 Y +27051 NC -5.0 Y +27052 NC -5.0 Y +27053 NC -5.0 Y +27054 NC -5.0 Y +27055 NC -5.0 Y +27094 NC -5.0 Y +27098 NC -5.0 Y +27099 NC -5.0 Y +27101 NC -5.0 Y +27102 NC -5.0 Y +27103 NC -5.0 Y +27104 NC -5.0 Y +27105 NC -5.0 Y +27106 NC -5.0 Y +27107 NC -5.0 Y +27108 NC -5.0 Y +27109 NC -5.0 Y +27110 NC -5.0 Y +27111 NC -5.0 Y +27113 NC -5.0 Y +27114 NC -5.0 Y +27115 NC -5.0 Y +27116 NC -5.0 Y +27117 NC -5.0 Y +27120 NC -5.0 Y +27127 NC -5.0 Y +27130 NC -5.0 Y +27150 NC -5.0 Y +27151 NC -5.0 Y +27152 NC -5.0 Y +27155 NC -5.0 Y +27156 NC -5.0 Y +27157 NC -5.0 Y +27198 NC -5.0 Y +27199 NC -5.0 Y +27201 NC -5.0 Y +27202 NC -5.0 Y +27203 NC -5.0 Y +27204 NC -5.0 Y +27205 NC -5.0 Y +27207 NC -5.0 Y +27208 NC -5.0 Y +27209 NC -5.0 Y +27212 NC -5.0 Y +27213 NC -5.0 Y +27214 NC -5.0 Y +27215 NC -5.0 Y +27216 NC -5.0 Y +27217 NC -5.0 Y +27220 NC -5.0 Y +27228 NC -5.0 Y +27229 NC -5.0 Y +27230 NC -5.0 Y +27231 NC -5.0 Y +27233 NC -5.0 Y +27235 NC -5.0 Y +27237 NC -5.0 Y +27239 NC -5.0 Y +27242 NC -5.0 Y +27243 NC -5.0 Y +27244 NC -5.0 Y +27247 NC -5.0 Y +27248 NC -5.0 Y +27249 NC -5.0 Y +27252 NC -5.0 Y +27253 NC -5.0 Y +27256 NC -5.0 Y +27258 NC -5.0 Y +27259 NC -5.0 Y +27260 NC -5.0 Y +27261 NC -5.0 Y +27262 NC -5.0 Y +27263 NC -5.0 Y +27264 NC -5.0 Y +27265 NC -5.0 Y +27278 NC -5.0 Y +27281 NC -5.0 Y +27282 NC -5.0 Y +27283 NC -5.0 Y +27284 NC -5.0 Y +27285 NC -5.0 Y +27288 NC -5.0 Y +27289 NC -5.0 Y +27291 NC -5.0 Y +27292 NC -5.0 Y +27293 NC -5.0 Y +27294 NC -5.0 Y +27295 NC -5.0 Y +27298 NC -5.0 Y +27299 NC -5.0 Y +27301 NC -5.0 Y +27302 NC -5.0 Y +27305 NC -5.0 Y +27306 NC -5.0 Y +27310 NC -5.0 Y +27311 NC -5.0 Y +27312 NC -5.0 Y +27313 NC -5.0 Y +27314 NC -5.0 Y +27315 NC -5.0 Y +27316 NC -5.0 Y +27317 NC -5.0 Y +27320 NC -5.0 Y +27321 NC -5.0 Y +27322 NC -5.0 Y +27323 NC -5.0 Y +27325 NC -5.0 Y +27326 NC -5.0 Y +27330 NC -5.0 Y +27331 NC -5.0 Y +27332 NC -5.0 Y +27340 NC -5.0 Y +27341 NC -5.0 Y +27342 NC -5.0 Y +27343 NC -5.0 Y +27344 NC -5.0 Y +27349 NC -5.0 Y +27350 NC -5.0 Y +27351 NC -5.0 Y +27355 NC -5.0 Y +27356 NC -5.0 Y +27357 NC -5.0 Y +27358 NC -5.0 Y +27359 NC -5.0 Y +27360 NC -5.0 Y +27361 NC -5.0 Y +27370 NC -5.0 Y +27371 NC -5.0 Y +27373 NC -5.0 Y +27374 NC -5.0 Y +27375 NC -5.0 Y +27376 NC -5.0 Y +27377 NC -5.0 Y +27379 NC -5.0 Y +27395 NC -5.0 Y +27401 NC -5.0 Y +27402 NC -5.0 Y +27403 NC -5.0 Y +27404 NC -5.0 Y +27405 NC -5.0 Y +27406 NC -5.0 Y +27407 NC -5.0 Y +27408 NC -5.0 Y +27409 NC -5.0 Y +27410 NC -5.0 Y +27411 NC -5.0 Y +27412 NC -5.0 Y +27413 NC -5.0 Y +27415 NC -5.0 Y +27416 NC -5.0 Y +27417 NC -5.0 Y +27419 NC -5.0 Y +27420 NC -5.0 Y +27425 NC -5.0 Y +27427 NC -5.0 Y +27429 NC -5.0 Y +27435 NC -5.0 Y +27438 NC -5.0 Y +27455 NC -5.0 Y +27480 NC -5.0 Y +27495 NC -5.0 Y +27497 NC -5.0 Y +27498 NC -5.0 Y +27499 NC -5.0 Y +27501 NC -5.0 Y +27502 NC -5.0 Y +27503 NC -5.0 Y +27504 NC -5.0 Y +27505 NC -5.0 Y +27506 NC -5.0 Y +27507 NC -5.0 Y +27508 NC -5.0 Y +27509 NC -5.0 Y +27510 NC -5.0 Y +27511 NC -5.0 Y +27512 NC -5.0 Y +27513 NC -5.0 Y +27514 NC -5.0 Y +27515 NC -5.0 Y +27516 NC -5.0 Y +27517 NC -5.0 Y +27518 NC -5.0 Y +27519 NC -5.0 Y +27520 NC -5.0 Y +27521 NC -5.0 Y +27522 NC -5.0 Y +27523 NC -5.0 Y +27524 NC -5.0 Y +27525 NC -5.0 Y +27526 NC -5.0 Y +27527 NC -5.0 Y +27528 NC -5.0 Y +27529 NC -5.0 Y +27530 NC -5.0 Y +27531 NC -5.0 Y +27532 NC -5.0 Y +27533 NC -5.0 Y +27534 NC -5.0 Y +27536 NC -5.0 Y +27537 NC -5.0 Y +27539 NC -5.0 Y +27540 NC -5.0 Y +27541 NC -5.0 Y +27542 NC -5.0 Y +27543 NC -5.0 Y +27544 NC -5.0 Y +27545 NC -5.0 Y +27546 NC -5.0 Y +27549 NC -5.0 Y +27551 NC -5.0 Y +27552 NC -5.0 Y +27553 NC -5.0 Y +27555 NC -5.0 Y +27556 NC -5.0 Y +27557 NC -5.0 Y +27559 NC -5.0 Y +27560 NC -5.0 Y +27562 NC -5.0 Y +27563 NC -5.0 Y +27564 NC -5.0 Y +27565 NC -5.0 Y +27568 NC -5.0 Y +27569 NC -5.0 Y +27570 NC -5.0 Y +27571 NC -5.0 Y +27572 NC -5.0 Y +27573 NC -5.0 Y +27574 NC -5.0 Y +27576 NC -5.0 Y +27577 NC -5.0 Y +27581 NC -5.0 Y +27582 NC -5.0 Y +27583 NC -5.0 Y +27584 NC -5.0 Y +27586 NC -5.0 Y +27587 NC -5.0 Y +27588 NC -5.0 Y +27589 NC -5.0 Y +27591 NC -5.0 Y +27592 NC -5.0 Y +27593 NC -5.0 Y +27594 NC -5.0 Y +27596 NC -5.0 Y +27597 NC -5.0 Y +27599 NC -5.0 Y +27601 NC -5.0 Y +27602 NC -5.0 Y +27603 NC -5.0 Y +27604 NC -5.0 Y +27605 NC -5.0 Y +27606 NC -5.0 Y +27607 NC -5.0 Y +27608 NC -5.0 Y +27609 NC -5.0 Y +27610 NC -5.0 Y +27611 NC -5.0 Y +27612 NC -5.0 Y +27613 NC -5.0 Y +27614 NC -5.0 Y +27615 NC -5.0 Y +27616 NC -5.0 Y +27617 NC -5.0 Y +27619 NC -5.0 Y +27620 NC -5.0 Y +27621 NC -5.0 Y +27622 NC -5.0 Y +27623 NC -5.0 Y +27624 NC -5.0 Y +27625 NC -5.0 Y +27626 NC -5.0 Y +27627 NC -5.0 Y +27628 NC -5.0 Y +27629 NC -5.0 Y +27634 NC -5.0 Y +27635 NC -5.0 Y +27636 NC -5.0 Y +27640 NC -5.0 Y +27650 NC -5.0 Y +27656 NC -5.0 Y +27658 NC -5.0 Y +27661 NC -5.0 Y +27668 NC -5.0 Y +27675 NC -5.0 Y +27676 NC -5.0 Y +27690 NC -5.0 Y +27695 NC -5.0 Y +27697 NC -5.0 Y +27698 NC -5.0 Y +27699 NC -5.0 Y +27701 NC -5.0 Y +27702 NC -5.0 Y +27703 NC -5.0 Y +27704 NC -5.0 Y +27705 NC -5.0 Y +27706 NC -5.0 Y +27707 NC -5.0 Y +27708 NC -5.0 Y +27709 NC -5.0 Y +27710 NC -5.0 Y +27711 NC -5.0 Y +27712 NC -5.0 Y +27713 NC -5.0 Y +27715 NC -5.0 Y +27717 NC -5.0 Y +27722 NC -5.0 Y +27801 NC -5.0 Y +27802 NC -5.0 Y +27803 NC -5.0 Y +27804 NC -5.0 Y +27805 NC -5.0 Y +27806 NC -5.0 Y +27807 NC -5.0 Y +27808 NC -5.0 Y +27809 NC -5.0 Y +27810 NC -5.0 Y +27811 NC -5.0 Y +27812 NC -5.0 Y +27813 NC -5.0 Y +27814 NC -5.0 Y +27815 NC -5.0 Y +27816 NC -5.0 Y +27817 NC -5.0 Y +27818 NC -5.0 Y +27819 NC -5.0 Y +27820 NC -5.0 Y +27821 NC -5.0 Y +27822 NC -5.0 Y +27823 NC -5.0 Y +27824 NC -5.0 Y +27825 NC -5.0 Y +27826 NC -5.0 Y +27827 NC -5.0 Y +27828 NC -5.0 Y +27829 NC -5.0 Y +27830 NC -5.0 Y +27831 NC -5.0 Y +27832 NC -5.0 Y +27833 NC -5.0 Y +27834 NC -5.0 Y +27835 NC -5.0 Y +27836 NC -5.0 Y +27837 NC -5.0 Y +27839 NC -5.0 Y +27840 NC -5.0 Y +27841 NC -5.0 Y +27842 NC -5.0 Y +27843 NC -5.0 Y +27844 NC -5.0 Y +27845 NC -5.0 Y +27846 NC -5.0 Y +27847 NC -5.0 Y +27849 NC -5.0 Y +27850 NC -5.0 Y +27851 NC -5.0 Y +27852 NC -5.0 Y +27853 NC -5.0 Y +27854 NC -5.0 Y +27855 NC -5.0 Y +27856 NC -5.0 Y +27857 NC -5.0 Y +27858 NC -5.0 Y +27860 NC -5.0 Y +27861 NC -5.0 Y +27862 NC -5.0 Y +27863 NC -5.0 Y +27864 NC -5.0 Y +27865 NC -5.0 Y +27866 NC -5.0 Y +27867 NC -5.0 Y +27868 NC -5.0 Y +27869 NC -5.0 Y +27870 NC -5.0 Y +27871 NC -5.0 Y +27872 NC -5.0 Y +27873 NC -5.0 Y +27874 NC -5.0 Y +27875 NC -5.0 Y +27876 NC -5.0 Y +27877 NC -5.0 Y +27878 NC -5.0 Y +27879 NC -5.0 Y +27880 NC -5.0 Y +27881 NC -5.0 Y +27882 NC -5.0 Y +27883 NC -5.0 Y +27884 NC -5.0 Y +27885 NC -5.0 Y +27886 NC -5.0 Y +27887 NC -5.0 Y +27888 NC -5.0 Y +27889 NC -5.0 Y +27890 NC -5.0 Y +27891 NC -5.0 Y +27892 NC -5.0 Y +27893 NC -5.0 Y +27894 NC -5.0 Y +27895 NC -5.0 Y +27896 NC -5.0 Y +27897 NC -5.0 Y +27906 NC -5.0 Y +27907 NC -5.0 Y +27909 NC -5.0 Y +27910 NC -5.0 Y +27915 NC -5.0 Y +27916 NC -5.0 Y +27917 NC -5.0 Y +27919 NC -5.0 Y +27920 NC -5.0 Y +27921 NC -5.0 Y +27922 NC -5.0 Y +27923 NC -5.0 Y +27924 NC -5.0 Y +27925 NC -5.0 Y +27926 NC -5.0 Y +27927 NC -5.0 Y +27928 NC -5.0 Y +27929 NC -5.0 Y +27930 NC -5.0 Y +27932 NC -5.0 Y +27935 NC -5.0 Y +27936 NC -5.0 Y +27937 NC -5.0 Y +27938 NC -5.0 Y +27939 NC -5.0 Y +27941 NC -5.0 Y +27942 NC -5.0 Y +27943 NC -5.0 Y +27944 NC -5.0 Y +27946 NC -5.0 Y +27947 NC -5.0 Y +27948 NC -5.0 Y +27949 NC -5.0 Y +27950 NC -5.0 Y +27953 NC -5.0 Y +27954 NC -5.0 Y +27956 NC -5.0 Y +27957 NC -5.0 Y +27958 NC -5.0 Y +27959 NC -5.0 Y +27960 NC -5.0 Y +27962 NC -5.0 Y +27964 NC -5.0 Y +27965 NC -5.0 Y +27966 NC -5.0 Y +27967 NC -5.0 Y +27968 NC -5.0 Y +27969 NC -5.0 Y +27970 NC -5.0 Y +27972 NC -5.0 Y +27973 NC -5.0 Y +27974 NC -5.0 Y +27976 NC -5.0 Y +27978 NC -5.0 Y +27979 NC -5.0 Y +27980 NC -5.0 Y +27981 NC -5.0 Y +27982 NC -5.0 Y +27983 NC -5.0 Y +27985 NC -5.0 Y +27986 NC -5.0 Y +28001 NC -5.0 Y +28002 NC -5.0 Y +28006 NC -5.0 Y +28007 NC -5.0 Y +28009 NC -5.0 Y +28010 NC -5.0 Y +28012 NC -5.0 Y +28016 NC -5.0 Y +28017 NC -5.0 Y +28018 NC -5.0 Y +28019 NC -5.0 Y +28020 NC -5.0 Y +28021 NC -5.0 Y +28023 NC -5.0 Y +28024 NC -5.0 Y +28025 NC -5.0 Y +28026 NC -5.0 Y +28027 NC -5.0 Y +28031 NC -5.0 Y +28032 NC -5.0 Y +28033 NC -5.0 Y +28034 NC -5.0 Y +28035 NC -5.0 Y +28036 NC -5.0 Y +28037 NC -5.0 Y +28038 NC -5.0 Y +28039 NC -5.0 Y +28040 NC -5.0 Y +28041 NC -5.0 Y +28042 NC -5.0 Y +28043 NC -5.0 Y +28052 NC -5.0 Y +28053 NC -5.0 Y +28054 NC -5.0 Y +28055 NC -5.0 Y +28056 NC -5.0 Y +28070 NC -5.0 Y +28071 NC -5.0 Y +28072 NC -5.0 Y +28073 NC -5.0 Y +28074 NC -5.0 Y +28075 NC -5.0 Y +28076 NC -5.0 Y +28077 NC -5.0 Y +28078 NC -5.0 Y +28079 NC -5.0 Y +28080 NC -5.0 Y +28081 NC -5.0 Y +28082 NC -5.0 Y +28083 NC -5.0 Y +28086 NC -5.0 Y +28088 NC -5.0 Y +28089 NC -5.0 Y +28090 NC -5.0 Y +28091 NC -5.0 Y +28092 NC -5.0 Y +28093 NC -5.0 Y +28097 NC -5.0 Y +28098 NC -5.0 Y +28101 NC -5.0 Y +28102 NC -5.0 Y +28103 NC -5.0 Y +28104 NC -5.0 Y +28105 NC -5.0 Y +28106 NC -5.0 Y +28107 NC -5.0 Y +28108 NC -5.0 Y +28109 NC -5.0 Y +28110 NC -5.0 Y +28111 NC -5.0 Y +28112 NC -5.0 Y +28114 NC -5.0 Y +28115 NC -5.0 Y +28117 NC -5.0 Y +28119 NC -5.0 Y +28120 NC -5.0 Y +28123 NC -5.0 Y +28124 NC -5.0 Y +28125 NC -5.0 Y +28126 NC -5.0 Y +28127 NC -5.0 Y +28128 NC -5.0 Y +28129 NC -5.0 Y +28130 NC -5.0 Y +28133 NC -5.0 Y +28134 NC -5.0 Y +28135 NC -5.0 Y +28136 NC -5.0 Y +28137 NC -5.0 Y +28138 NC -5.0 Y +28139 NC -5.0 Y +28144 NC -5.0 Y +28145 NC -5.0 Y +28146 NC -5.0 Y +28147 NC -5.0 Y +28150 NC -5.0 Y +28151 NC -5.0 Y +28152 NC -5.0 Y +28159 NC -5.0 Y +28160 NC -5.0 Y +28163 NC -5.0 Y +28164 NC -5.0 Y +28166 NC -5.0 Y +28167 NC -5.0 Y +28168 NC -5.0 Y +28169 NC -5.0 Y +28170 NC -5.0 Y +28173 NC -5.0 Y +28174 NC -5.0 Y +28201 NC -5.0 Y +28202 NC -5.0 Y +28203 NC -5.0 Y +28204 NC -5.0 Y +28205 NC -5.0 Y +28206 NC -5.0 Y +28207 NC -5.0 Y +28208 NC -5.0 Y +28209 NC -5.0 Y +28210 NC -5.0 Y +28211 NC -5.0 Y +28212 NC -5.0 Y +28213 NC -5.0 Y +28214 NC -5.0 Y +28215 NC -5.0 Y +28216 NC -5.0 Y +28217 NC -5.0 Y +28218 NC -5.0 Y +28219 NC -5.0 Y +28220 NC -5.0 Y +28221 NC -5.0 Y +28222 NC -5.0 Y +28223 NC -5.0 Y +28224 NC -5.0 Y +28226 NC -5.0 Y +28227 NC -5.0 Y +28228 NC -5.0 Y +28229 NC -5.0 Y +28230 NC -5.0 Y +28231 NC -5.0 Y +28232 NC -5.0 Y +28233 NC -5.0 Y +28234 NC -5.0 Y +28235 NC -5.0 Y +28236 NC -5.0 Y +28237 NC -5.0 Y +28241 NC -5.0 Y +28242 NC -5.0 Y +28243 NC -5.0 Y +28244 NC -5.0 Y +28246 NC -5.0 Y +28247 NC -5.0 Y +28250 NC -5.0 Y +28253 NC -5.0 Y +28254 NC -5.0 Y +28255 NC -5.0 Y +28256 NC -5.0 Y +28258 NC -5.0 Y +28260 NC -5.0 Y +28262 NC -5.0 Y +28263 NC -5.0 Y +28265 NC -5.0 Y +28266 NC -5.0 Y +28269 NC -5.0 Y +28270 NC -5.0 Y +28271 NC -5.0 Y +28272 NC -5.0 Y +28273 NC -5.0 Y +28274 NC -5.0 Y +28275 NC -5.0 Y +28277 NC -5.0 Y +28278 NC -5.0 Y +28280 NC -5.0 Y +28281 NC -5.0 Y +28282 NC -5.0 Y +28284 NC -5.0 Y +28285 NC -5.0 Y +28287 NC -5.0 Y +28288 NC -5.0 Y +28289 NC -5.0 Y +28290 NC -5.0 Y +28296 NC -5.0 Y +28297 NC -5.0 Y +28299 NC -5.0 Y +28301 NC -5.0 Y +28302 NC -5.0 Y +28303 NC -5.0 Y +28304 NC -5.0 Y +28305 NC -5.0 Y +28306 NC -5.0 Y +28307 NC -5.0 Y +28308 NC -5.0 Y +28309 NC -5.0 Y +28310 NC -5.0 Y +28311 NC -5.0 Y +28312 NC -5.0 Y +28314 NC -5.0 Y +28315 NC -5.0 Y +28318 NC -5.0 Y +28319 NC -5.0 Y +28320 NC -5.0 Y +28323 NC -5.0 Y +28325 NC -5.0 Y +28326 NC -5.0 Y +28327 NC -5.0 Y +28328 NC -5.0 Y +28329 NC -5.0 Y +28330 NC -5.0 Y +28331 NC -5.0 Y +28332 NC -5.0 Y +28333 NC -5.0 Y +28334 NC -5.0 Y +28335 NC -5.0 Y +28337 NC -5.0 Y +28338 NC -5.0 Y +28339 NC -5.0 Y +28340 NC -5.0 Y +28341 NC -5.0 Y +28342 NC -5.0 Y +28343 NC -5.0 Y +28344 NC -5.0 Y +28345 NC -5.0 Y +28347 NC -5.0 Y +28348 NC -5.0 Y +28349 NC -5.0 Y +28350 NC -5.0 Y +28351 NC -5.0 Y +28352 NC -5.0 Y +28353 NC -5.0 Y +28355 NC -5.0 Y +28356 NC -5.0 Y +28357 NC -5.0 Y +28358 NC -5.0 Y +28359 NC -5.0 Y +28360 NC -5.0 Y +28362 NC -5.0 Y +28363 NC -5.0 Y +28364 NC -5.0 Y +28365 NC -5.0 Y +28366 NC -5.0 Y +28367 NC -5.0 Y +28368 NC -5.0 Y +28369 NC -5.0 Y +28370 NC -5.0 Y +28371 NC -5.0 Y +28372 NC -5.0 Y +28373 NC -5.0 Y +28374 NC -5.0 Y +28375 NC -5.0 Y +28376 NC -5.0 Y +28377 NC -5.0 Y +28378 NC -5.0 Y +28379 NC -5.0 Y +28380 NC -5.0 Y +28382 NC -5.0 Y +28383 NC -5.0 Y +28384 NC -5.0 Y +28385 NC -5.0 Y +28386 NC -5.0 Y +28387 NC -5.0 Y +28388 NC -5.0 Y +28390 NC -5.0 Y +28391 NC -5.0 Y +28392 NC -5.0 Y +28393 NC -5.0 Y +28394 NC -5.0 Y +28395 NC -5.0 Y +28396 NC -5.0 Y +28398 NC -5.0 Y +28399 NC -5.0 Y +28401 NC -5.0 Y +28402 NC -5.0 Y +28403 NC -5.0 Y +28404 NC -5.0 Y +28405 NC -5.0 Y +28406 NC -5.0 Y +28407 NC -5.0 Y +28408 NC -5.0 Y +28409 NC -5.0 Y +28410 NC -5.0 Y +28411 NC -5.0 Y +28412 NC -5.0 Y +28420 NC -5.0 Y +28421 NC -5.0 Y +28422 NC -5.0 Y +28423 NC -5.0 Y +28424 NC -5.0 Y +28425 NC -5.0 Y +28428 NC -5.0 Y +28429 NC -5.0 Y +28430 NC -5.0 Y +28431 NC -5.0 Y +28432 NC -5.0 Y +28433 NC -5.0 Y +28434 NC -5.0 Y +28435 NC -5.0 Y +28436 NC -5.0 Y +28438 NC -5.0 Y +28439 NC -5.0 Y +28441 NC -5.0 Y +28442 NC -5.0 Y +28443 NC -5.0 Y +28444 NC -5.0 Y +28445 NC -5.0 Y +28447 NC -5.0 Y +28448 NC -5.0 Y +28449 NC -5.0 Y +28450 NC -5.0 Y +28451 NC -5.0 Y +28452 NC -5.0 Y +28453 NC -5.0 Y +28454 NC -5.0 Y +28455 NC -5.0 Y +28456 NC -5.0 Y +28457 NC -5.0 Y +28458 NC -5.0 Y +28459 NC -5.0 Y +28460 NC -5.0 Y +28461 NC -5.0 Y +28462 NC -5.0 Y +28463 NC -5.0 Y +28464 NC -5.0 Y +28465 NC -5.0 Y +28466 NC -5.0 Y +28467 NC -5.0 Y +28468 NC -5.0 Y +28469 NC -5.0 Y +28470 NC -5.0 Y +28472 NC -5.0 Y +28478 NC -5.0 Y +28479 NC -5.0 Y +28480 NC -5.0 Y +28501 NC -5.0 Y +28502 NC -5.0 Y +28503 NC -5.0 Y +28504 NC -5.0 Y +28508 NC -5.0 Y +28509 NC -5.0 Y +28510 NC -5.0 Y +28511 NC -5.0 Y +28512 NC -5.0 Y +28513 NC -5.0 Y +28515 NC -5.0 Y +28516 NC -5.0 Y +28518 NC -5.0 Y +28519 NC -5.0 Y +28520 NC -5.0 Y +28521 NC -5.0 Y +28522 NC -5.0 Y +28523 NC -5.0 Y +28524 NC -5.0 Y +28525 NC -5.0 Y +28526 NC -5.0 Y +28527 NC -5.0 Y +28528 NC -5.0 Y +28529 NC -5.0 Y +28530 NC -5.0 Y +28531 NC -5.0 Y +28532 NC -5.0 Y +28533 NC -5.0 Y +28537 NC -5.0 Y +28538 NC -5.0 Y +28539 NC -5.0 Y +28540 NC -5.0 Y +28541 NC -5.0 Y +28542 NC -5.0 Y +28543 NC -5.0 Y +28544 NC -5.0 Y +28545 NC -5.0 Y +28546 NC -5.0 Y +28547 NC -5.0 Y +28551 NC -5.0 Y +28552 NC -5.0 Y +28553 NC -5.0 Y +28554 NC -5.0 Y +28555 NC -5.0 Y +28556 NC -5.0 Y +28557 NC -5.0 Y +28560 NC -5.0 Y +28561 NC -5.0 Y +28562 NC -5.0 Y +28563 NC -5.0 Y +28564 NC -5.0 Y +28570 NC -5.0 Y +28571 NC -5.0 Y +28572 NC -5.0 Y +28573 NC -5.0 Y +28574 NC -5.0 Y +28575 NC -5.0 Y +28577 NC -5.0 Y +28578 NC -5.0 Y +28579 NC -5.0 Y +28580 NC -5.0 Y +28581 NC -5.0 Y +28582 NC -5.0 Y +28583 NC -5.0 Y +28584 NC -5.0 Y +28585 NC -5.0 Y +28586 NC -5.0 Y +28587 NC -5.0 Y +28589 NC -5.0 Y +28590 NC -5.0 Y +28594 NC -5.0 Y +28601 NC -5.0 Y +28602 NC -5.0 Y +28603 NC -5.0 Y +28604 NC -5.0 Y +28605 NC -5.0 Y +28606 NC -5.0 Y +28607 NC -5.0 Y +28608 NC -5.0 Y +28609 NC -5.0 Y +28610 NC -5.0 Y +28611 NC -5.0 Y +28612 NC -5.0 Y +28613 NC -5.0 Y +28615 NC -5.0 Y +28616 NC -5.0 Y +28617 NC -5.0 Y +28618 NC -5.0 Y +28619 NC -5.0 Y +28621 NC -5.0 Y +28622 NC -5.0 Y +28623 NC -5.0 Y +28624 NC -5.0 Y +28625 NC -5.0 Y +28626 NC -5.0 Y +28627 NC -5.0 Y +28628 NC -5.0 Y +28629 NC -5.0 Y +28630 NC -5.0 Y +28631 NC -5.0 Y +28633 NC -5.0 Y +28634 NC -5.0 Y +28635 NC -5.0 Y +28636 NC -5.0 Y +28637 NC -5.0 Y +28638 NC -5.0 Y +28640 NC -5.0 Y +28641 NC -5.0 Y +28642 NC -5.0 Y +28643 NC -5.0 Y +28644 NC -5.0 Y +28645 NC -5.0 Y +28646 NC -5.0 Y +28647 NC -5.0 Y +28649 NC -5.0 Y +28650 NC -5.0 Y +28651 NC -5.0 Y +28652 NC -5.0 Y +28653 NC -5.0 Y +28654 NC -5.0 Y +28655 NC -5.0 Y +28656 NC -5.0 Y +28657 NC -5.0 Y +28658 NC -5.0 Y +28659 NC -5.0 Y +28660 NC -5.0 Y +28661 NC -5.0 Y +28662 NC -5.0 Y +28663 NC -5.0 Y +28664 NC -5.0 Y +28665 NC -5.0 Y +28666 NC -5.0 Y +28667 NC -5.0 Y +28668 NC -5.0 Y +28669 NC -5.0 Y +28670 NC -5.0 Y +28671 NC -5.0 Y +28672 NC -5.0 Y +28673 NC -5.0 Y +28674 NC -5.0 Y +28675 NC -5.0 Y +28676 NC -5.0 Y +28677 NC -5.0 Y +28678 NC -5.0 Y +28679 NC -5.0 Y +28680 NC -5.0 Y +28681 NC -5.0 Y +28682 NC -5.0 Y +28683 NC -5.0 Y +28684 NC -5.0 Y +28685 NC -5.0 Y +28687 NC -5.0 Y +28688 NC -5.0 Y +28689 NC -5.0 Y +28690 NC -5.0 Y +28691 NC -5.0 Y +28692 NC -5.0 Y +28693 NC -5.0 Y +28694 NC -5.0 Y +28697 NC -5.0 Y +28698 NC -5.0 Y +28699 NC -5.0 Y +28701 NC -5.0 Y +28702 NC -5.0 Y +28704 NC -5.0 Y +28705 NC -5.0 Y +28707 NC -5.0 Y +28708 NC -5.0 Y +28709 NC -5.0 Y +28710 NC -5.0 Y +28711 NC -5.0 Y +28712 NC -5.0 Y +28713 NC -5.0 Y +28714 NC -5.0 Y +28715 NC -5.0 Y +28716 NC -5.0 Y +28717 NC -5.0 Y +28718 NC -5.0 Y +28719 NC -5.0 Y +28720 NC -5.0 Y +28721 NC -5.0 Y +28722 NC -5.0 Y +28723 NC -5.0 Y +28724 NC -5.0 Y +28725 NC -5.0 Y +28726 NC -5.0 Y +28727 NC -5.0 Y +28728 NC -5.0 Y +28729 NC -5.0 Y +28730 NC -5.0 Y +28731 NC -5.0 Y +28732 NC -5.0 Y +28733 NC -5.0 Y +28734 NC -5.0 Y +28735 NC -5.0 Y +28736 NC -5.0 Y +28737 NC -5.0 Y +28738 NC -5.0 Y +28739 NC -5.0 Y +28740 NC -5.0 Y +28741 NC -5.0 Y +28742 NC -5.0 Y +28743 NC -5.0 Y +28744 NC -5.0 Y +28745 NC -5.0 Y +28746 NC -5.0 Y +28747 NC -5.0 Y +28748 NC -5.0 Y +28749 NC -5.0 Y +28750 NC -5.0 Y +28751 NC -5.0 Y +28752 NC -5.0 Y +28753 NC -5.0 Y +28754 NC -5.0 Y +28755 NC -5.0 Y +28756 NC -5.0 Y +28757 NC -5.0 Y +28758 NC -5.0 Y +28759 NC -5.0 Y +28760 NC -5.0 Y +28761 NC -5.0 Y +28762 NC -5.0 Y +28763 NC -5.0 Y +28765 NC -5.0 Y +28766 NC -5.0 Y +28768 NC -5.0 Y +28770 NC -5.0 Y +28771 NC -5.0 Y +28772 NC -5.0 Y +28773 NC -5.0 Y +28774 NC -5.0 Y +28775 NC -5.0 Y +28776 NC -5.0 Y +28777 NC -5.0 Y +28778 NC -5.0 Y +28779 NC -5.0 Y +28781 NC -5.0 Y +28782 NC -5.0 Y +28783 NC -5.0 Y +28784 NC -5.0 Y +28785 NC -5.0 Y +28786 NC -5.0 Y +28787 NC -5.0 Y +28788 NC -5.0 Y +28789 NC -5.0 Y +28790 NC -5.0 Y +28791 NC -5.0 Y +28792 NC -5.0 Y +28793 NC -5.0 Y +28801 NC -5.0 Y +28802 NC -5.0 Y +28803 NC -5.0 Y +28804 NC -5.0 Y +28805 NC -5.0 Y +28806 NC -5.0 Y +28810 NC -5.0 Y +28813 NC -5.0 Y +28814 NC -5.0 Y +28815 NC -5.0 Y +28816 NC -5.0 Y +28901 NC -5.0 Y +28902 NC -5.0 Y +28903 NC -5.0 Y +28904 NC -5.0 Y +28905 NC -5.0 Y +28906 NC -5.0 Y +28909 NC -5.0 Y +29001 SC -5.0 Y +29002 SC -5.0 Y +29003 SC -5.0 Y +29006 SC -5.0 Y +29009 SC -5.0 Y +29010 SC -5.0 Y +29014 SC -5.0 Y +29015 SC -5.0 Y +29016 SC -5.0 Y +29018 SC -5.0 Y +29020 SC -5.0 Y +29021 SC -5.0 Y +29030 SC -5.0 Y +29031 SC -5.0 Y +29032 SC -5.0 Y +29033 SC -5.0 Y +29036 SC -5.0 Y +29037 SC -5.0 Y +29038 SC -5.0 Y +29039 SC -5.0 Y +29040 SC -5.0 Y +29041 SC -5.0 Y +29042 SC -5.0 Y +29044 SC -5.0 Y +29045 SC -5.0 Y +29046 SC -5.0 Y +29047 SC -5.0 Y +29048 SC -5.0 Y +29051 SC -5.0 Y +29052 SC -5.0 Y +29053 SC -5.0 Y +29054 SC -5.0 Y +29055 SC -5.0 Y +29056 SC -5.0 Y +29058 SC -5.0 Y +29059 SC -5.0 Y +29061 SC -5.0 Y +29062 SC -5.0 Y +29063 SC -5.0 Y +29065 SC -5.0 Y +29067 SC -5.0 Y +29069 SC -5.0 Y +29070 SC -5.0 Y +29071 SC -5.0 Y +29072 SC -5.0 Y +29073 SC -5.0 Y +29074 SC -5.0 Y +29075 SC -5.0 Y +29078 SC -5.0 Y +29079 SC -5.0 Y +29080 SC -5.0 Y +29081 SC -5.0 Y +29082 SC -5.0 Y +29101 SC -5.0 Y +29102 SC -5.0 Y +29104 SC -5.0 Y +29105 SC -5.0 Y +29107 SC -5.0 Y +29108 SC -5.0 Y +29111 SC -5.0 Y +29112 SC -5.0 Y +29113 SC -5.0 Y +29114 SC -5.0 Y +29115 SC -5.0 Y +29116 SC -5.0 Y +29117 SC -5.0 Y +29118 SC -5.0 Y +29122 SC -5.0 Y +29123 SC -5.0 Y +29125 SC -5.0 Y +29126 SC -5.0 Y +29127 SC -5.0 Y +29128 SC -5.0 Y +29129 SC -5.0 Y +29130 SC -5.0 Y +29132 SC -5.0 Y +29133 SC -5.0 Y +29135 SC -5.0 Y +29137 SC -5.0 Y +29138 SC -5.0 Y +29142 SC -5.0 Y +29143 SC -5.0 Y +29145 SC -5.0 Y +29146 SC -5.0 Y +29147 SC -5.0 Y +29148 SC -5.0 Y +29150 SC -5.0 Y +29151 SC -5.0 Y +29152 SC -5.0 Y +29153 SC -5.0 Y +29154 SC -5.0 Y +29160 SC -5.0 Y +29161 SC -5.0 Y +29162 SC -5.0 Y +29163 SC -5.0 Y +29164 SC -5.0 Y +29166 SC -5.0 Y +29168 SC -5.0 Y +29169 SC -5.0 Y +29170 SC -5.0 Y +29171 SC -5.0 Y +29172 SC -5.0 Y +29175 SC -5.0 Y +29177 SC -5.0 Y +29178 SC -5.0 Y +29180 SC -5.0 Y +29201 SC -5.0 Y +29202 SC -5.0 Y +29203 SC -5.0 Y +29204 SC -5.0 Y +29205 SC -5.0 Y +29206 SC -5.0 Y +29207 SC -5.0 Y +29208 SC -5.0 Y +29209 SC -5.0 Y +29210 SC -5.0 Y +29211 SC -5.0 Y +29212 SC -5.0 Y +29214 SC -5.0 Y +29215 SC -5.0 Y +29216 SC -5.0 Y +29217 SC -5.0 Y +29218 SC -5.0 Y +29219 SC -5.0 Y +29220 SC -5.0 Y +29221 SC -5.0 Y +29222 SC -5.0 Y +29223 SC -5.0 Y +29224 SC -5.0 Y +29225 SC -5.0 Y +29226 SC -5.0 Y +29227 SC -5.0 Y +29228 SC -5.0 Y +29229 SC -5.0 Y +29230 SC -5.0 Y +29240 SC -5.0 Y +29250 SC -5.0 Y +29260 SC -5.0 Y +29290 SC -5.0 Y +29292 SC -5.0 Y +29301 SC -5.0 Y +29302 SC -5.0 Y +29303 SC -5.0 Y +29304 SC -5.0 Y +29305 SC -5.0 Y +29306 SC -5.0 Y +29307 SC -5.0 Y +29316 SC -5.0 Y +29318 SC -5.0 Y +29319 SC -5.0 Y +29320 SC -5.0 Y +29321 SC -5.0 Y +29322 SC -5.0 Y +29323 SC -5.0 Y +29324 SC -5.0 Y +29325 SC -5.0 Y +29329 SC -5.0 Y +29330 SC -5.0 Y +29331 SC -5.0 Y +29332 SC -5.0 Y +29333 SC -5.0 Y +29334 SC -5.0 Y +29335 SC -5.0 Y +29336 SC -5.0 Y +29338 SC -5.0 Y +29340 SC -5.0 Y +29341 SC -5.0 Y +29342 SC -5.0 Y +29346 SC -5.0 Y +29348 SC -5.0 Y +29349 SC -5.0 Y +29351 SC -5.0 Y +29353 SC -5.0 Y +29355 SC -5.0 Y +29356 SC -5.0 Y +29360 SC -5.0 Y +29364 SC -5.0 Y +29365 SC -5.0 Y +29368 SC -5.0 Y +29369 SC -5.0 Y +29370 SC -5.0 Y +29372 SC -5.0 Y +29373 SC -5.0 Y +29374 SC -5.0 Y +29375 SC -5.0 Y +29376 SC -5.0 Y +29377 SC -5.0 Y +29378 SC -5.0 Y +29379 SC -5.0 Y +29384 SC -5.0 Y +29385 SC -5.0 Y +29386 SC -5.0 Y +29388 SC -5.0 Y +29390 SC -5.0 Y +29391 SC -5.0 Y +29395 SC -5.0 Y +29401 SC -5.0 Y +29402 SC -5.0 Y +29403 SC -5.0 Y +29404 SC -5.0 Y +29405 SC -5.0 Y +29406 SC -5.0 Y +29407 SC -5.0 Y +29409 SC -5.0 Y +29410 SC -5.0 Y +29412 SC -5.0 Y +29413 SC -5.0 Y +29414 SC -5.0 Y +29415 SC -5.0 Y +29416 SC -5.0 Y +29417 SC -5.0 Y +29418 SC -5.0 Y +29419 SC -5.0 Y +29420 SC -5.0 Y +29422 SC -5.0 Y +29423 SC -5.0 Y +29424 SC -5.0 Y +29425 SC -5.0 Y +29426 SC -5.0 Y +29429 SC -5.0 Y +29430 SC -5.0 Y +29431 SC -5.0 Y +29432 SC -5.0 Y +29433 SC -5.0 Y +29434 SC -5.0 Y +29435 SC -5.0 Y +29436 SC -5.0 Y +29437 SC -5.0 Y +29438 SC -5.0 Y +29439 SC -5.0 Y +29440 SC -5.0 Y +29442 SC -5.0 Y +29445 SC -5.0 Y +29446 SC -5.0 Y +29447 SC -5.0 Y +29448 SC -5.0 Y +29449 SC -5.0 Y +29450 SC -5.0 Y +29451 SC -5.0 Y +29452 SC -5.0 Y +29453 SC -5.0 Y +29455 SC -5.0 Y +29456 SC -5.0 Y +29457 SC -5.0 Y +29458 SC -5.0 Y +29461 SC -5.0 Y +29464 SC -5.0 Y +29465 SC -5.0 Y +29466 SC -5.0 Y +29468 SC -5.0 Y +29469 SC -5.0 Y +29470 SC -5.0 Y +29471 SC -5.0 Y +29472 SC -5.0 Y +29474 SC -5.0 Y +29475 SC -5.0 Y +29476 SC -5.0 Y +29477 SC -5.0 Y +29479 SC -5.0 Y +29481 SC -5.0 Y +29482 SC -5.0 Y +29483 SC -5.0 Y +29484 SC -5.0 Y +29485 SC -5.0 Y +29487 SC -5.0 Y +29488 SC -5.0 Y +29492 SC -5.0 Y +29493 SC -5.0 Y +29501 SC -5.0 Y +29502 SC -5.0 Y +29503 SC -5.0 Y +29504 SC -5.0 Y +29505 SC -5.0 Y +29506 SC -5.0 Y +29510 SC -5.0 Y +29511 SC -5.0 Y +29512 SC -5.0 Y +29516 SC -5.0 Y +29518 SC -5.0 Y +29519 SC -5.0 Y +29520 SC -5.0 Y +29525 SC -5.0 Y +29526 SC -5.0 Y +29527 SC -5.0 Y +29528 SC -5.0 Y +29530 SC -5.0 Y +29532 SC -5.0 Y +29536 SC -5.0 Y +29540 SC -5.0 Y +29541 SC -5.0 Y +29542 SC -5.0 Y +29543 SC -5.0 Y +29544 SC -5.0 Y +29545 SC -5.0 Y +29546 SC -5.0 Y +29547 SC -5.0 Y +29550 SC -5.0 Y +29551 SC -5.0 Y +29554 SC -5.0 Y +29555 SC -5.0 Y +29556 SC -5.0 Y +29560 SC -5.0 Y +29563 SC -5.0 Y +29564 SC -5.0 Y +29565 SC -5.0 Y +29566 SC -5.0 Y +29567 SC -5.0 Y +29568 SC -5.0 Y +29569 SC -5.0 Y +29570 SC -5.0 Y +29571 SC -5.0 Y +29572 SC -5.0 Y +29573 SC -5.0 Y +29574 SC -5.0 Y +29575 SC -5.0 Y +29576 SC -5.0 Y +29577 SC -5.0 Y +29578 SC -5.0 Y +29579 SC -5.0 Y +29580 SC -5.0 Y +29581 SC -5.0 Y +29582 SC -5.0 Y +29583 SC -5.0 Y +29584 SC -5.0 Y +29585 SC -5.0 Y +29587 SC -5.0 Y +29588 SC -5.0 Y +29589 SC -5.0 Y +29590 SC -5.0 Y +29591 SC -5.0 Y +29592 SC -5.0 Y +29593 SC -5.0 Y +29594 SC -5.0 Y +29596 SC -5.0 Y +29597 SC -5.0 Y +29598 SC -5.0 Y +29601 SC -5.0 Y +29602 SC -5.0 Y +29603 SC -5.0 Y +29604 SC -5.0 Y +29605 SC -5.0 Y +29606 SC -5.0 Y +29607 SC -5.0 Y +29608 SC -5.0 Y +29609 SC -5.0 Y +29610 SC -5.0 Y +29611 SC -5.0 Y +29612 SC -5.0 Y +29613 SC -5.0 Y +29614 SC -5.0 Y +29615 SC -5.0 Y +29616 SC -5.0 Y +29617 SC -5.0 Y +29620 SC -5.0 Y +29621 SC -5.0 Y +29622 SC -5.0 Y +29623 SC -5.0 Y +29624 SC -5.0 Y +29625 SC -5.0 Y +29626 SC -5.0 Y +29627 SC -5.0 Y +29628 SC -5.0 Y +29630 SC -5.0 Y +29631 SC -5.0 Y +29632 SC -5.0 Y +29633 SC -5.0 Y +29634 SC -5.0 Y +29635 SC -5.0 Y +29636 SC -5.0 Y +29638 SC -5.0 Y +29639 SC -5.0 Y +29640 SC -5.0 Y +29641 SC -5.0 Y +29642 SC -5.0 Y +29643 SC -5.0 Y +29644 SC -5.0 Y +29645 SC -5.0 Y +29646 SC -5.0 Y +29647 SC -5.0 Y +29648 SC -5.0 Y +29649 SC -5.0 Y +29650 SC -5.0 Y +29651 SC -5.0 Y +29652 SC -5.0 Y +29653 SC -5.0 Y +29654 SC -5.0 Y +29655 SC -5.0 Y +29656 SC -5.0 Y +29657 SC -5.0 Y +29658 SC -5.0 Y +29659 SC -5.0 Y +29661 SC -5.0 Y +29662 SC -5.0 Y +29664 SC -5.0 Y +29665 SC -5.0 Y +29666 SC -5.0 Y +29667 SC -5.0 Y +29669 SC -5.0 Y +29670 SC -5.0 Y +29671 SC -5.0 Y +29672 SC -5.0 Y +29673 SC -5.0 Y +29675 SC -5.0 Y +29676 SC -5.0 Y +29677 SC -5.0 Y +29678 SC -5.0 Y +29679 SC -5.0 Y +29680 SC -5.0 Y +29681 SC -5.0 Y +29682 SC -5.0 Y +29683 SC -5.0 Y +29684 SC -5.0 Y +29685 SC -5.0 Y +29686 SC -5.0 Y +29687 SC -5.0 Y +29688 SC -5.0 Y +29689 SC -5.0 Y +29690 SC -5.0 Y +29691 SC -5.0 Y +29692 SC -5.0 Y +29693 SC -5.0 Y +29695 SC -5.0 Y +29696 SC -5.0 Y +29697 SC -5.0 Y +29698 SC -5.0 Y +29702 SC -5.0 Y +29703 SC -5.0 Y +29704 SC -5.0 Y +29706 SC -5.0 Y +29708 SC -5.0 Y +29709 SC -5.0 Y +29710 SC -5.0 Y +29712 SC -5.0 Y +29714 SC -5.0 Y +29715 SC -5.0 Y +29716 SC -5.0 Y +29717 SC -5.0 Y +29718 SC -5.0 Y +29720 SC -5.0 Y +29721 SC -5.0 Y +29722 SC -5.0 Y +29724 SC -5.0 Y +29726 SC -5.0 Y +29727 SC -5.0 Y +29728 SC -5.0 Y +29729 SC -5.0 Y +29730 SC -5.0 Y +29731 SC -5.0 Y +29732 SC -5.0 Y +29733 SC -5.0 Y +29734 SC -5.0 Y +29741 SC -5.0 Y +29742 SC -5.0 Y +29743 SC -5.0 Y +29744 SC -5.0 Y +29745 SC -5.0 Y +29801 SC -5.0 Y +29802 SC -5.0 Y +29803 SC -5.0 Y +29804 SC -5.0 Y +29805 SC -5.0 Y +29808 SC -5.0 Y +29809 SC -5.0 Y +29810 SC -5.0 Y +29812 SC -5.0 Y +29813 SC -5.0 Y +29816 SC -5.0 Y +29817 SC -5.0 Y +29819 SC -5.0 Y +29821 SC -5.0 Y +29822 SC -5.0 Y +29824 SC -5.0 Y +29826 SC -5.0 Y +29827 SC -5.0 Y +29828 SC -5.0 Y +29829 SC -5.0 Y +29831 SC -5.0 Y +29832 SC -5.0 Y +29834 SC -5.0 Y +29835 SC -5.0 Y +29836 SC -5.0 Y +29838 SC -5.0 Y +29839 SC -5.0 Y +29840 SC -5.0 Y +29841 SC -5.0 Y +29842 SC -5.0 Y +29843 SC -5.0 Y +29844 SC -5.0 Y +29845 SC -5.0 Y +29846 SC -5.0 Y +29847 SC -5.0 Y +29848 SC -5.0 Y +29849 SC -5.0 Y +29850 SC -5.0 Y +29851 SC -5.0 Y +29853 SC -5.0 Y +29856 SC -5.0 Y +29860 SC -5.0 Y +29861 SC -5.0 Y +29899 SC -5.0 Y +29901 SC -5.0 Y +29902 SC -5.0 Y +29903 SC -5.0 Y +29904 SC -5.0 Y +29905 SC -5.0 Y +29906 SC -5.0 Y +29907 SC -5.0 Y +29909 SC -5.0 Y +29910 SC -5.0 Y +29911 SC -5.0 Y +29912 SC -5.0 Y +29913 SC -5.0 Y +29914 SC -5.0 Y +29915 SC -5.0 Y +29916 SC -5.0 Y +29918 SC -5.0 Y +29920 SC -5.0 Y +29921 SC -5.0 Y +29922 SC -5.0 Y +29923 SC -5.0 Y +29924 SC -5.0 Y +29925 SC -5.0 Y +29926 SC -5.0 Y +29927 SC -5.0 Y +29928 SC -5.0 Y +29929 SC -5.0 Y +29931 SC -5.0 Y +29932 SC -5.0 Y +29933 SC -5.0 Y +29934 SC -5.0 Y +29935 SC -5.0 Y +29936 SC -5.0 Y +29938 SC -5.0 Y +29939 SC -5.0 Y +29940 SC -5.0 Y +29941 SC -5.0 Y +29943 SC -5.0 Y +29944 SC -5.0 Y +29945 SC -5.0 Y +30002 GA -5.0 Y +30003 GA -5.0 Y +30004 GA -5.0 Y +30005 GA -5.0 Y +30006 GA -5.0 Y +30007 GA -5.0 Y +30008 GA -5.0 Y +30009 GA -5.0 Y +30010 GA -5.0 Y +30011 GA -5.0 Y +30012 GA -5.0 Y +30013 GA -5.0 Y +30014 GA -5.0 Y +30015 GA -5.0 Y +30016 GA -5.0 Y +30017 GA -5.0 Y +30018 GA -5.0 Y +30019 GA -5.0 Y +30021 GA -5.0 Y +30022 GA -5.0 Y +30023 GA -5.0 Y +30024 GA -5.0 Y +30025 GA -5.0 Y +30026 GA -5.0 Y +30028 GA -5.0 Y +30029 GA -5.0 Y +30030 GA -5.0 Y +30031 GA -5.0 Y +30032 GA -5.0 Y +30033 GA -5.0 Y +30034 GA -5.0 Y +30035 GA -5.0 Y +30036 GA -5.0 Y +30037 GA -5.0 Y +30038 GA -5.0 Y +30039 GA -5.0 Y +30040 GA -5.0 Y +30041 GA -5.0 Y +30042 GA -5.0 Y +30043 GA -5.0 Y +30044 GA -5.0 Y +30045 GA -5.0 Y +30046 GA -5.0 Y +30047 GA -5.0 Y +30048 GA -5.0 Y +30049 GA -5.0 Y +30052 GA -5.0 Y +30054 GA -5.0 Y +30055 GA -5.0 Y +30056 GA -5.0 Y +30058 GA -5.0 Y +30060 GA -5.0 Y +30061 GA -5.0 Y +30062 GA -5.0 Y +30063 GA -5.0 Y +30064 GA -5.0 Y +30065 GA -5.0 Y +30066 GA -5.0 Y +30067 GA -5.0 Y +30068 GA -5.0 Y +30069 GA -5.0 Y +30070 GA -5.0 Y +30071 GA -5.0 Y +30072 GA -5.0 Y +30073 GA -5.0 Y +30074 GA -5.0 Y +30075 GA -5.0 Y +30076 GA -5.0 Y +30077 GA -5.0 Y +30078 GA -5.0 Y +30079 GA -5.0 Y +30080 GA -5.0 Y +30081 GA -5.0 Y +30082 GA -5.0 Y +30083 GA -5.0 Y +30084 GA -5.0 Y +30085 GA -5.0 Y +30086 GA -5.0 Y +30087 GA -5.0 Y +30088 GA -5.0 Y +30090 GA -5.0 Y +30091 GA -5.0 Y +30092 GA -5.0 Y +30093 GA -5.0 Y +30094 GA -5.0 Y +30095 GA -5.0 Y +30096 GA -5.0 Y +30097 GA -5.0 Y +30098 GA -5.0 Y +30099 GA -5.0 Y +30101 GA -5.0 Y +30102 GA -5.0 Y +30103 GA -5.0 Y +30104 GA -5.0 Y +30105 GA -5.0 Y +30106 GA -5.0 Y +30107 GA -5.0 Y +30108 GA -5.0 Y +30109 GA -5.0 Y +30110 GA -5.0 Y +30111 GA -5.0 Y +30112 GA -5.0 Y +30113 GA -5.0 Y +30114 GA -5.0 Y +30115 GA -5.0 Y +30116 GA -5.0 Y +30117 GA -5.0 Y +30118 GA -5.0 Y +30119 GA -5.0 Y +30120 GA -5.0 Y +30121 GA -5.0 Y +30122 GA -5.0 Y +30123 GA -5.0 Y +30124 GA -5.0 Y +30125 GA -5.0 Y +30126 GA -5.0 Y +30127 GA -5.0 Y +30129 GA -5.0 Y +30132 GA -5.0 Y +30133 GA -5.0 Y +30134 GA -5.0 Y +30135 GA -5.0 Y +30137 GA -5.0 Y +30138 GA -5.0 Y +30139 GA -5.0 Y +30140 GA -5.0 Y +30141 GA -5.0 Y +30142 GA -5.0 Y +30143 GA -5.0 Y +30144 GA -5.0 Y +30145 GA -5.0 Y +30146 GA -5.0 Y +30147 GA -5.0 Y +30148 GA -5.0 Y +30149 GA -5.0 Y +30150 GA -5.0 Y +30151 GA -5.0 Y +30152 GA -5.0 Y +30153 GA -5.0 Y +30154 GA -5.0 Y +30156 GA -5.0 Y +30157 GA -5.0 Y +30160 GA -5.0 Y +30161 GA -5.0 Y +30162 GA -5.0 Y +30163 GA -5.0 Y +30164 GA -5.0 Y +30165 GA -5.0 Y +30168 GA -5.0 Y +30169 GA -5.0 Y +30170 GA -5.0 Y +30171 GA -5.0 Y +30172 GA -5.0 Y +30173 GA -5.0 Y +30175 GA -5.0 Y +30176 GA -5.0 Y +30177 GA -5.0 Y +30178 GA -5.0 Y +30179 GA -5.0 Y +30180 GA -5.0 Y +30182 GA -5.0 Y +30183 GA -5.0 Y +30184 GA -5.0 Y +30185 GA -5.0 Y +30187 GA -5.0 Y +30188 GA -5.0 Y +30189 GA -5.0 Y +30204 GA -5.0 Y +30205 GA -5.0 Y +30206 GA -5.0 Y +30212 GA -5.0 Y +30213 GA -5.0 Y +30214 GA -5.0 Y +30215 GA -5.0 Y +30216 GA -5.0 Y +30217 GA -5.0 Y +30218 GA -5.0 Y +30219 GA -5.0 Y +30220 GA -5.0 Y +30222 GA -5.0 Y +30223 GA -5.0 Y +30224 GA -5.0 Y +30228 GA -5.0 Y +30229 GA -5.0 Y +30230 GA -5.0 Y +30233 GA -5.0 Y +30234 GA -5.0 Y +30236 GA -5.0 Y +30237 GA -5.0 Y +30238 GA -5.0 Y +30240 GA -5.0 Y +30241 GA -5.0 Y +30248 GA -5.0 Y +30250 GA -5.0 Y +30251 GA -5.0 Y +30252 GA -5.0 Y +30253 GA -5.0 Y +30256 GA -5.0 Y +30257 GA -5.0 Y +30258 GA -5.0 Y +30259 GA -5.0 Y +30260 GA -5.0 Y +30261 GA -5.0 Y +30263 GA -5.0 Y +30264 GA -5.0 Y +30265 GA -5.0 Y +30266 GA -5.0 Y +30268 GA -5.0 Y +30269 GA -5.0 Y +30270 GA -5.0 Y +30271 GA -5.0 Y +30272 GA -5.0 Y +30273 GA -5.0 Y +30274 GA -5.0 Y +30275 GA -5.0 Y +30276 GA -5.0 Y +30277 GA -5.0 Y +30281 GA -5.0 Y +30284 GA -5.0 Y +30285 GA -5.0 Y +30286 GA -5.0 Y +30287 GA -5.0 Y +30288 GA -5.0 Y +30289 GA -5.0 Y +30290 GA -5.0 Y +30291 GA -5.0 Y +30292 GA -5.0 Y +30293 GA -5.0 Y +30294 GA -5.0 Y +30295 GA -5.0 Y +30296 GA -5.0 Y +30297 GA -5.0 Y +30298 GA -5.0 Y +30301 GA -5.0 Y +30302 GA -5.0 Y +30303 GA -5.0 Y +30304 GA -5.0 Y +30305 GA -5.0 Y +30306 GA -5.0 Y +30307 GA -5.0 Y +30308 GA -5.0 Y +30309 GA -5.0 Y +30310 GA -5.0 Y +30311 GA -5.0 Y +30312 GA -5.0 Y +30313 GA -5.0 Y +30314 GA -5.0 Y +30315 GA -5.0 Y +30316 GA -5.0 Y +30317 GA -5.0 Y +30318 GA -5.0 Y +30319 GA -5.0 Y +30320 GA -5.0 Y +30321 GA -5.0 Y +30322 GA -5.0 Y +30324 GA -5.0 Y +30325 GA -5.0 Y +30326 GA -5.0 Y +30327 GA -5.0 Y +30328 GA -5.0 Y +30329 GA -5.0 Y +30330 GA -5.0 Y +30331 GA -5.0 Y +30332 GA -5.0 Y +30333 GA -5.0 Y +30334 GA -5.0 Y +30336 GA -5.0 Y +30337 GA -5.0 Y +30338 GA -5.0 Y +30339 GA -5.0 Y +30340 GA -5.0 Y +30341 GA -5.0 Y +30342 GA -5.0 Y +30343 GA -5.0 Y +30344 GA -5.0 Y +30345 GA -5.0 Y +30346 GA -5.0 Y +30347 GA -5.0 Y +30348 GA -5.0 Y +30349 GA -5.0 Y +30350 GA -5.0 Y +30353 GA -5.0 Y +30354 GA -5.0 Y +30355 GA -5.0 Y +30356 GA -5.0 Y +30357 GA -5.0 Y +30358 GA -5.0 Y +30359 GA -5.0 Y +30360 GA -5.0 Y +30361 GA -5.0 Y +30362 GA -5.0 Y +30363 GA -5.0 Y +30364 GA -5.0 Y +30366 GA -5.0 Y +30368 GA -5.0 Y +30369 GA -5.0 Y +30370 GA -5.0 Y +30371 GA -5.0 Y +30374 GA -5.0 Y +30375 GA -5.0 Y +30376 GA -5.0 Y +30377 GA -5.0 Y +30378 GA -5.0 Y +30379 GA -5.0 Y +30380 GA -5.0 Y +30384 GA -5.0 Y +30385 GA -5.0 Y +30386 GA -5.0 Y +30387 GA -5.0 Y +30388 GA -5.0 Y +30389 GA -5.0 Y +30390 GA -5.0 Y +30392 GA -5.0 Y +30394 GA -5.0 Y +30396 GA -5.0 Y +30398 GA -5.0 Y +30399 GA -5.0 Y +30401 GA -5.0 Y +30410 GA -5.0 Y +30411 GA -5.0 Y +30412 GA -5.0 Y +30413 GA -5.0 Y +30414 GA -5.0 Y +30415 GA -5.0 Y +30417 GA -5.0 Y +30420 GA -5.0 Y +30421 GA -5.0 Y +30423 GA -5.0 Y +30424 GA -5.0 Y +30425 GA -5.0 Y +30426 GA -5.0 Y +30427 GA -5.0 Y +30428 GA -5.0 Y +30429 GA -5.0 Y +30434 GA -5.0 Y +30436 GA -5.0 Y +30438 GA -5.0 Y +30439 GA -5.0 Y +30441 GA -5.0 Y +30442 GA -5.0 Y +30445 GA -5.0 Y +30446 GA -5.0 Y +30447 GA -5.0 Y +30448 GA -5.0 Y +30449 GA -5.0 Y +30450 GA -5.0 Y +30451 GA -5.0 Y +30452 GA -5.0 Y +30453 GA -5.0 Y +30454 GA -5.0 Y +30455 GA -5.0 Y +30456 GA -5.0 Y +30457 GA -5.0 Y +30458 GA -5.0 Y +30459 GA -5.0 Y +30460 GA -5.0 Y +30461 GA -5.0 Y +30464 GA -5.0 Y +30467 GA -5.0 Y +30470 GA -5.0 Y +30471 GA -5.0 Y +30473 GA -5.0 Y +30474 GA -5.0 Y +30475 GA -5.0 Y +30477 GA -5.0 Y +30499 GA -5.0 Y +30501 GA -5.0 Y +30502 GA -5.0 Y +30503 GA -5.0 Y +30504 GA -5.0 Y +30506 GA -5.0 Y +30507 GA -5.0 Y +30510 GA -5.0 Y +30511 GA -5.0 Y +30512 GA -5.0 Y +30513 GA -5.0 Y +30514 GA -5.0 Y +30515 GA -5.0 Y +30516 GA -5.0 Y +30517 GA -5.0 Y +30518 GA -5.0 Y +30519 GA -5.0 Y +30520 GA -5.0 Y +30521 GA -5.0 Y +30522 GA -5.0 Y +30523 GA -5.0 Y +30525 GA -5.0 Y +30527 GA -5.0 Y +30528 GA -5.0 Y +30529 GA -5.0 Y +30530 GA -5.0 Y +30531 GA -5.0 Y +30533 GA -5.0 Y +30534 GA -5.0 Y +30535 GA -5.0 Y +30536 GA -5.0 Y +30537 GA -5.0 Y +30538 GA -5.0 Y +30539 GA -5.0 Y +30540 GA -5.0 Y +30541 GA -5.0 Y +30542 GA -5.0 Y +30543 GA -5.0 Y +30544 GA -5.0 Y +30545 GA -5.0 Y +30546 GA -5.0 Y +30547 GA -5.0 Y +30548 GA -5.0 Y +30549 GA -5.0 Y +30552 GA -5.0 Y +30553 GA -5.0 Y +30554 GA -5.0 Y +30555 GA -5.0 Y +30557 GA -5.0 Y +30558 GA -5.0 Y +30559 GA -5.0 Y +30560 GA -5.0 Y +30562 GA -5.0 Y +30563 GA -5.0 Y +30564 GA -5.0 Y +30565 GA -5.0 Y +30566 GA -5.0 Y +30567 GA -5.0 Y +30568 GA -5.0 Y +30571 GA -5.0 Y +30572 GA -5.0 Y +30573 GA -5.0 Y +30575 GA -5.0 Y +30576 GA -5.0 Y +30577 GA -5.0 Y +30580 GA -5.0 Y +30581 GA -5.0 Y +30582 GA -5.0 Y +30596 GA -5.0 Y +30597 GA -5.0 Y +30598 GA -5.0 Y +30599 GA -5.0 Y +30601 GA -5.0 Y +30602 GA -5.0 Y +30603 GA -5.0 Y +30604 GA -5.0 Y +30605 GA -5.0 Y +30606 GA -5.0 Y +30607 GA -5.0 Y +30608 GA -5.0 Y +30609 GA -5.0 Y +30612 GA -5.0 Y +30619 GA -5.0 Y +30620 GA -5.0 Y +30621 GA -5.0 Y +30622 GA -5.0 Y +30623 GA -5.0 Y +30624 GA -5.0 Y +30625 GA -5.0 Y +30627 GA -5.0 Y +30628 GA -5.0 Y +30629 GA -5.0 Y +30630 GA -5.0 Y +30631 GA -5.0 Y +30633 GA -5.0 Y +30634 GA -5.0 Y +30635 GA -5.0 Y +30638 GA -5.0 Y +30639 GA -5.0 Y +30641 GA -5.0 Y +30642 GA -5.0 Y +30643 GA -5.0 Y +30645 GA -5.0 Y +30646 GA -5.0 Y +30647 GA -5.0 Y +30648 GA -5.0 Y +30650 GA -5.0 Y +30655 GA -5.0 Y +30656 GA -5.0 Y +30660 GA -5.0 Y +30662 GA -5.0 Y +30663 GA -5.0 Y +30664 GA -5.0 Y +30665 GA -5.0 Y +30666 GA -5.0 Y +30667 GA -5.0 Y +30668 GA -5.0 Y +30669 GA -5.0 Y +30671 GA -5.0 Y +30673 GA -5.0 Y +30677 GA -5.0 Y +30678 GA -5.0 Y +30680 GA -5.0 Y +30683 GA -5.0 Y +30701 GA -5.0 Y +30703 GA -5.0 Y +30705 GA -5.0 Y +30707 GA -5.0 Y +30708 GA -5.0 Y +30710 GA -5.0 Y +30711 GA -5.0 Y +30719 GA -5.0 Y +30720 GA -5.0 Y +30721 GA -5.0 Y +30722 GA -5.0 Y +30724 GA -5.0 Y +30725 GA -5.0 Y +30726 GA -5.0 Y +30728 GA -5.0 Y +30730 GA -5.0 Y +30731 GA -5.0 Y +30732 GA -5.0 Y +30733 GA -5.0 Y +30734 GA -5.0 Y +30735 GA -5.0 Y +30736 GA -5.0 Y +30738 GA -5.0 Y +30739 GA -5.0 Y +30740 GA -5.0 Y +30741 GA -5.0 Y +30742 GA -5.0 Y +30746 GA -5.0 Y +30747 GA -5.0 Y +30750 GA -5.0 Y +30751 GA -5.0 Y +30752 GA -5.0 Y +30753 GA -5.0 Y +30755 GA -5.0 Y +30756 GA -5.0 Y +30757 GA -5.0 Y +30802 GA -5.0 Y +30803 GA -5.0 Y +30805 GA -5.0 Y +30806 GA -5.0 Y +30807 GA -5.0 Y +30808 GA -5.0 Y +30809 GA -5.0 Y +30810 GA -5.0 Y +30811 GA -5.0 Y +30812 GA -5.0 Y +30813 GA -5.0 Y +30814 GA -5.0 Y +30815 GA -5.0 Y +30816 GA -5.0 Y +30817 GA -5.0 Y +30818 GA -5.0 Y +30819 GA -5.0 Y +30820 GA -5.0 Y +30821 GA -5.0 Y +30822 GA -5.0 Y +30823 GA -5.0 Y +30824 GA -5.0 Y +30828 GA -5.0 Y +30830 GA -5.0 Y +30833 GA -5.0 Y +30901 GA -5.0 Y +30903 GA -5.0 Y +30904 GA -5.0 Y +30905 GA -5.0 Y +30906 GA -5.0 Y +30907 GA -5.0 Y +30909 GA -5.0 Y +30911 GA -5.0 Y +30912 GA -5.0 Y +30913 GA -5.0 Y +30914 GA -5.0 Y +30916 GA -5.0 Y +30917 GA -5.0 Y +30919 GA -5.0 Y +30999 GA -5.0 Y +31001 GA -5.0 Y +31002 GA -5.0 Y +31003 GA -5.0 Y +31004 GA -5.0 Y +31005 GA -5.0 Y +31006 GA -5.0 Y +31007 GA -5.0 Y +31008 GA -5.0 Y +31009 GA -5.0 Y +31010 GA -5.0 Y +31011 GA -5.0 Y +31012 GA -5.0 Y +31013 GA -5.0 Y +31014 GA -5.0 Y +31015 GA -5.0 Y +31016 GA -5.0 Y +31017 GA -5.0 Y +31018 GA -5.0 Y +31019 GA -5.0 Y +31020 GA -5.0 Y +31021 GA -5.0 Y +31022 GA -5.0 Y +31023 GA -5.0 Y +31024 GA -5.0 Y +31025 GA -5.0 Y +31026 GA -5.0 Y +31027 GA -5.0 Y +31028 GA -5.0 Y +31029 GA -5.0 Y +31030 GA -5.0 Y +31031 GA -5.0 Y +31032 GA -5.0 Y +31033 GA -5.0 Y +31034 GA -5.0 Y +31035 GA -5.0 Y +31036 GA -5.0 Y +31037 GA -5.0 Y +31038 GA -5.0 Y +31039 GA -5.0 Y +31040 GA -5.0 Y +31041 GA -5.0 Y +31042 GA -5.0 Y +31044 GA -5.0 Y +31045 GA -5.0 Y +31046 GA -5.0 Y +31047 GA -5.0 Y +31049 GA -5.0 Y +31050 GA -5.0 Y +31051 GA -5.0 Y +31052 GA -5.0 Y +31054 GA -5.0 Y +31055 GA -5.0 Y +31057 GA -5.0 Y +31058 GA -5.0 Y +31059 GA -5.0 Y +31060 GA -5.0 Y +31061 GA -5.0 Y +31062 GA -5.0 Y +31063 GA -5.0 Y +31064 GA -5.0 Y +31065 GA -5.0 Y +31066 GA -5.0 Y +31067 GA -5.0 Y +31068 GA -5.0 Y +31069 GA -5.0 Y +31070 GA -5.0 Y +31071 GA -5.0 Y +31072 GA -5.0 Y +31075 GA -5.0 Y +31076 GA -5.0 Y +31077 GA -5.0 Y +31078 GA -5.0 Y +31079 GA -5.0 Y +31081 GA -5.0 Y +31082 GA -5.0 Y +31083 GA -5.0 Y +31084 GA -5.0 Y +31085 GA -5.0 Y +31086 GA -5.0 Y +31087 GA -5.0 Y +31088 GA -5.0 Y +31089 GA -5.0 Y +31090 GA -5.0 Y +31091 GA -5.0 Y +31092 GA -5.0 Y +31093 GA -5.0 Y +31094 GA -5.0 Y +31095 GA -5.0 Y +31096 GA -5.0 Y +31097 GA -5.0 Y +31098 GA -5.0 Y +31099 GA -5.0 Y +31106 GA -5.0 Y +31107 GA -5.0 Y +31119 GA -5.0 Y +31120 GA -5.0 Y +31126 GA -5.0 Y +31131 GA -5.0 Y +31136 GA -5.0 Y +31139 GA -5.0 Y +31141 GA -5.0 Y +31145 GA -5.0 Y +31146 GA -5.0 Y +31150 GA -5.0 Y +31156 GA -5.0 Y +31191 GA -5.0 Y +31192 GA -5.0 Y +31193 GA -5.0 Y +31195 GA -5.0 Y +31196 GA -5.0 Y +31197 GA -5.0 Y +31198 GA -5.0 Y +31199 GA -5.0 Y +31201 GA -5.0 Y +31202 GA -5.0 Y +31203 GA -5.0 Y +31204 GA -5.0 Y +31205 GA -5.0 Y +31206 GA -5.0 Y +31207 GA -5.0 Y +31208 GA -5.0 Y +31209 GA -5.0 Y +31210 GA -5.0 Y +31211 GA -5.0 Y +31212 GA -5.0 Y +31213 GA -5.0 Y +31216 GA -5.0 Y +31217 GA -5.0 Y +31220 GA -5.0 Y +31221 GA -5.0 Y +31294 GA -5.0 Y +31295 GA -5.0 Y +31296 GA -5.0 Y +31297 GA -5.0 Y +31301 GA -5.0 Y +31302 GA -5.0 Y +31303 GA -5.0 Y +31304 GA -5.0 Y +31305 GA -5.0 Y +31307 GA -5.0 Y +31308 GA -5.0 Y +31309 GA -5.0 Y +31310 GA -5.0 Y +31312 GA -5.0 Y +31313 GA -5.0 Y +31314 GA -5.0 Y +31315 GA -5.0 Y +31316 GA -5.0 Y +31318 GA -5.0 Y +31319 GA -5.0 Y +31320 GA -5.0 Y +31321 GA -5.0 Y +31322 GA -5.0 Y +31323 GA -5.0 Y +31324 GA -5.0 Y +31326 GA -5.0 Y +31327 GA -5.0 Y +31328 GA -5.0 Y +31329 GA -5.0 Y +31331 GA -5.0 Y +31333 GA -5.0 Y +31401 GA -5.0 Y +31402 GA -5.0 Y +31403 GA -5.0 Y +31404 GA -5.0 Y +31405 GA -5.0 Y +31406 GA -5.0 Y +31407 GA -5.0 Y +31408 GA -5.0 Y +31409 GA -5.0 Y +31410 GA -5.0 Y +31411 GA -5.0 Y +31412 GA -5.0 Y +31414 GA -5.0 Y +31415 GA -5.0 Y +31416 GA -5.0 Y +31418 GA -5.0 Y +31419 GA -5.0 Y +31420 GA -5.0 Y +31421 GA -5.0 Y +31501 GA -5.0 Y +31502 GA -5.0 Y +31503 GA -5.0 Y +31510 GA -5.0 Y +31512 GA -5.0 Y +31513 GA -5.0 Y +31515 GA -5.0 Y +31516 GA -5.0 Y +31518 GA -5.0 Y +31519 GA -5.0 Y +31520 GA -5.0 Y +31521 GA -5.0 Y +31522 GA -5.0 Y +31523 GA -5.0 Y +31524 GA -5.0 Y +31525 GA -5.0 Y +31527 GA -5.0 Y +31532 GA -5.0 Y +31533 GA -5.0 Y +31534 GA -5.0 Y +31535 GA -5.0 Y +31537 GA -5.0 Y +31539 GA -5.0 Y +31542 GA -5.0 Y +31543 GA -5.0 Y +31544 GA -5.0 Y +31545 GA -5.0 Y +31546 GA -5.0 Y +31547 GA -5.0 Y +31548 GA -5.0 Y +31549 GA -5.0 Y +31550 GA -5.0 Y +31551 GA -5.0 Y +31552 GA -5.0 Y +31553 GA -5.0 Y +31554 GA -5.0 Y +31555 GA -5.0 Y +31556 GA -5.0 Y +31557 GA -5.0 Y +31558 GA -5.0 Y +31560 GA -5.0 Y +31561 GA -5.0 Y +31562 GA -5.0 Y +31563 GA -5.0 Y +31564 GA -5.0 Y +31565 GA -5.0 Y +31566 GA -5.0 Y +31567 GA -5.0 Y +31568 GA -5.0 Y +31569 GA -5.0 Y +31598 GA -5.0 Y +31599 GA -5.0 Y +31601 GA -5.0 Y +31602 GA -5.0 Y +31603 GA -5.0 Y +31604 GA -5.0 Y +31605 GA -5.0 Y +31606 GA -5.0 Y +31620 GA -5.0 Y +31622 GA -5.0 Y +31623 GA -5.0 Y +31624 GA -5.0 Y +31625 GA -5.0 Y +31626 GA -5.0 Y +31627 GA -5.0 Y +31629 GA -5.0 Y +31630 GA -5.0 Y +31631 GA -5.0 Y +31632 GA -5.0 Y +31634 GA -5.0 Y +31635 GA -5.0 Y +31636 GA -5.0 Y +31637 GA -5.0 Y +31638 GA -5.0 Y +31639 GA -5.0 Y +31641 GA -5.0 Y +31642 GA -5.0 Y +31643 GA -5.0 Y +31645 GA -5.0 Y +31647 GA -5.0 Y +31648 GA -5.0 Y +31649 GA -5.0 Y +31650 GA -5.0 Y +31698 GA -5.0 Y +31699 GA -5.0 Y +31701 GA -5.0 Y +31702 GA -5.0 Y +31703 GA -5.0 Y +31704 GA -5.0 Y +31705 GA -5.0 Y +31706 GA -5.0 Y +31707 GA -5.0 Y +31708 GA -5.0 Y +31709 GA -5.0 Y +31710 GA -5.0 Y +31711 GA -5.0 Y +31712 GA -5.0 Y +31714 GA -5.0 Y +31716 GA -5.0 Y +31719 GA -5.0 Y +31720 GA -5.0 Y +31721 GA -5.0 Y +31722 GA -5.0 Y +31727 GA -5.0 Y +31730 GA -5.0 Y +31733 GA -5.0 Y +31735 GA -5.0 Y +31738 GA -5.0 Y +31739 GA -5.0 Y +31743 GA -5.0 Y +31744 GA -5.0 Y +31747 GA -5.0 Y +31749 GA -5.0 Y +31750 GA -5.0 Y +31753 GA -5.0 Y +31756 GA -5.0 Y +31757 GA -5.0 Y +31758 GA -5.0 Y +31760 GA -5.0 Y +31763 GA -5.0 Y +31764 GA -5.0 Y +31765 GA -5.0 Y +31768 GA -5.0 Y +31769 GA -5.0 Y +31771 GA -5.0 Y +31772 GA -5.0 Y +31773 GA -5.0 Y +31774 GA -5.0 Y +31775 GA -5.0 Y +31776 GA -5.0 Y +31778 GA -5.0 Y +31779 GA -5.0 Y +31780 GA -5.0 Y +31781 GA -5.0 Y +31782 GA -5.0 Y +31783 GA -5.0 Y +31784 GA -5.0 Y +31787 GA -5.0 Y +31788 GA -5.0 Y +31789 GA -5.0 Y +31790 GA -5.0 Y +31791 GA -5.0 Y +31792 GA -5.0 Y +31793 GA -5.0 Y +31794 GA -5.0 Y +31795 GA -5.0 Y +31796 GA -5.0 Y +31798 GA -5.0 Y +31799 GA -5.0 Y +31801 GA -5.0 Y +31803 GA -5.0 Y +31804 GA -5.0 Y +31805 GA -5.0 Y +31806 GA -5.0 Y +31807 GA -5.0 Y +31808 GA -5.0 Y +31810 GA -5.0 Y +31811 GA -5.0 Y +31812 GA -5.0 Y +31814 GA -5.0 Y +31815 GA -5.0 Y +31816 GA -5.0 Y +31820 GA -5.0 Y +31821 GA -5.0 Y +31822 GA -5.0 Y +31823 GA -5.0 Y +31824 GA -5.0 Y +31825 GA -5.0 Y +31826 GA -5.0 Y +31827 GA -5.0 Y +31829 GA -5.0 Y +31830 GA -5.0 Y +31831 GA -5.0 Y +31832 GA -5.0 Y +31833 GA -5.0 Y +31836 GA -5.0 Y +31901 GA -5.0 Y +31902 GA -5.0 Y +31903 GA -5.0 Y +31904 GA -5.0 Y +31905 GA -5.0 Y +31906 GA -5.0 Y +31907 GA -5.0 Y +31908 GA -5.0 Y +31909 GA -5.0 Y +31914 GA -5.0 Y +31917 GA -5.0 Y +31993 GA -5.0 Y +31995 GA -5.0 Y +31997 GA -5.0 Y +31998 GA -5.0 Y +31999 GA -5.0 Y +32003 FL -5.0 Y +32004 FL -5.0 Y +32006 FL -5.0 Y +32007 FL -5.0 Y +32008 FL -5.0 Y +32009 FL -5.0 Y +32011 FL -5.0 Y +32013 FL -5.0 Y +32024 FL -5.0 Y +32025 FL -5.0 Y +32026 FL -5.0 Y +32030 FL -5.0 Y +32033 FL -5.0 Y +32034 FL -5.0 Y +32035 FL -5.0 Y +32038 FL -5.0 Y +32040 FL -5.0 Y +32041 FL -5.0 Y +32042 FL -5.0 Y +32043 FL -5.0 Y +32044 FL -5.0 Y +32046 FL -5.0 Y +32050 FL -5.0 Y +32052 FL -5.0 Y +32053 FL -5.0 Y +32054 FL -5.0 Y +32055 FL -5.0 Y +32056 FL -5.0 Y +32058 FL -5.0 Y +32059 FL -5.0 Y +32060 FL -5.0 Y +32061 FL -5.0 Y +32062 FL -5.0 Y +32063 FL -5.0 Y +32064 FL -5.0 Y +32065 FL -5.0 Y +32066 FL -5.0 Y +32067 FL -5.0 Y +32068 FL -5.0 Y +32071 FL -5.0 Y +32072 FL -5.0 Y +32073 FL -5.0 Y +32079 FL -5.0 Y +32080 FL -5.0 Y +32081 FL -5.0 Y +32082 FL -5.0 Y +32083 FL -5.0 Y +32084 FL -5.0 Y +32085 FL -5.0 Y +32086 FL -5.0 Y +32087 FL -5.0 Y +32091 FL -5.0 Y +32092 FL -5.0 Y +32094 FL -5.0 Y +32095 FL -5.0 Y +32096 FL -5.0 Y +32097 FL -5.0 Y +32099 FL -5.0 Y +32102 FL -5.0 Y +32105 FL -5.0 Y +32110 FL -5.0 Y +32111 FL -5.0 Y +32112 FL -5.0 Y +32113 FL -5.0 Y +32114 FL -5.0 Y +32115 FL -5.0 Y +32116 FL -5.0 Y +32117 FL -5.0 Y +32118 FL -5.0 Y +32119 FL -5.0 Y +32120 FL -5.0 Y +32121 FL -5.0 Y +32122 FL -5.0 Y +32123 FL -5.0 Y +32124 FL -5.0 Y +32125 FL -5.0 Y +32126 FL -5.0 Y +32127 FL -5.0 Y +32128 FL -5.0 Y +32129 FL -5.0 Y +32130 FL -5.0 Y +32131 FL -5.0 Y +32132 FL -5.0 Y +32133 FL -5.0 Y +32134 FL -5.0 Y +32135 FL -5.0 Y +32136 FL -5.0 Y +32137 FL -5.0 Y +32138 FL -5.0 Y +32139 FL -5.0 Y +32140 FL -5.0 Y +32141 FL -5.0 Y +32142 FL -5.0 Y +32145 FL -5.0 Y +32147 FL -5.0 Y +32148 FL -5.0 Y +32149 FL -5.0 Y +32157 FL -5.0 Y +32158 FL -5.0 Y +32159 FL -5.0 Y +32160 FL -5.0 Y +32162 FL -5.0 Y +32164 FL -5.0 Y +32168 FL -5.0 Y +32169 FL -5.0 Y +32170 FL -5.0 Y +32173 FL -5.0 Y +32174 FL -5.0 Y +32175 FL -5.0 Y +32176 FL -5.0 Y +32177 FL -5.0 Y +32178 FL -5.0 Y +32179 FL -5.0 Y +32180 FL -5.0 Y +32181 FL -5.0 Y +32182 FL -5.0 Y +32183 FL -5.0 Y +32185 FL -5.0 Y +32187 FL -5.0 Y +32189 FL -5.0 Y +32190 FL -5.0 Y +32192 FL -5.0 Y +32193 FL -5.0 Y +32195 FL -5.0 Y +32198 FL -5.0 Y +32201 FL -5.0 Y +32202 FL -5.0 Y +32203 FL -5.0 Y +32204 FL -5.0 Y +32205 FL -5.0 Y +32206 FL -5.0 Y +32207 FL -5.0 Y +32208 FL -5.0 Y +32209 FL -5.0 Y +32210 FL -5.0 Y +32211 FL -5.0 Y +32212 FL -5.0 Y +32214 FL -5.0 Y +32215 FL -5.0 Y +32216 FL -5.0 Y +32217 FL -5.0 Y +32218 FL -5.0 Y +32219 FL -5.0 Y +32220 FL -5.0 Y +32221 FL -5.0 Y +32222 FL -5.0 Y +32223 FL -5.0 Y +32224 FL -5.0 Y +32225 FL -5.0 Y +32226 FL -5.0 Y +32227 FL -5.0 Y +32228 FL -5.0 Y +32229 FL -5.0 Y +32230 FL -5.0 Y +32231 FL -5.0 Y +32232 FL -5.0 Y +32233 FL -5.0 Y +32234 FL -5.0 Y +32235 FL -5.0 Y +32236 FL -5.0 Y +32237 FL -5.0 Y +32238 FL -5.0 Y +32239 FL -5.0 Y +32240 FL -5.0 Y +32241 FL -5.0 Y +32244 FL -5.0 Y +32245 FL -5.0 Y +32246 FL -5.0 Y +32247 FL -5.0 Y +32250 FL -5.0 Y +32254 FL -5.0 Y +32255 FL -5.0 Y +32256 FL -5.0 Y +32257 FL -5.0 Y +32258 FL -5.0 Y +32259 FL -5.0 Y +32260 FL -5.0 Y +32266 FL -5.0 Y +32267 FL -5.0 Y +32277 FL -5.0 Y +32290 FL -5.0 Y +32301 FL -5.0 Y +32302 FL -5.0 Y +32303 FL -5.0 Y +32304 FL -5.0 Y +32305 FL -5.0 Y +32306 FL -5.0 Y +32307 FL -5.0 Y +32308 FL -5.0 Y +32309 FL -5.0 Y +32310 FL -5.0 Y +32311 FL -5.0 Y +32312 FL -5.0 Y +32313 FL -5.0 Y +32314 FL -5.0 Y +32315 FL -5.0 Y +32316 FL -5.0 Y +32317 FL -5.0 Y +32318 FL -5.0 Y +32320 FL -5.0 Y +32321 FL -5.0 Y +32322 FL -5.0 Y +32323 FL -5.0 Y +32324 FL -5.0 Y +32326 FL -5.0 Y +32327 FL -5.0 Y +32328 FL -5.0 Y +32329 FL -5.0 Y +32330 FL -5.0 Y +32331 FL -5.0 Y +32332 FL -5.0 Y +32333 FL -5.0 Y +32334 FL -5.0 Y +32335 FL -5.0 Y +32336 FL -5.0 Y +32337 FL -5.0 Y +32340 FL -5.0 Y +32341 FL -5.0 Y +32343 FL -5.0 Y +32344 FL -5.0 Y +32345 FL -5.0 Y +32346 FL -5.0 Y +32347 FL -5.0 Y +32348 FL -5.0 Y +32350 FL -5.0 Y +32351 FL -5.0 Y +32352 FL -5.0 Y +32353 FL -5.0 Y +32355 FL -5.0 Y +32356 FL -5.0 Y +32357 FL -5.0 Y +32358 FL -5.0 Y +32359 FL -5.0 Y +32360 FL -5.0 Y +32361 FL -5.0 Y +32362 FL -5.0 Y +32395 FL -5.0 Y +32399 FL -5.0 Y +32401 FL -6.0 Y +32402 FL -6.0 Y +32403 FL -6.0 Y +32404 FL -6.0 Y +32405 FL -6.0 Y +32406 FL -6.0 Y +32407 FL -6.0 Y +32408 FL -6.0 Y +32409 FL -6.0 Y +32410 FL -6.0 Y +32411 FL -6.0 Y +32412 FL -6.0 Y +32413 FL -6.0 Y +32417 FL -6.0 Y +32420 FL -6.0 Y +32421 FL -6.0 Y +32422 FL -6.0 Y +32423 FL -6.0 Y +32424 FL -6.0 Y +32425 FL -6.0 Y +32426 FL -6.0 Y +32427 FL -6.0 Y +32428 FL -6.0 Y +32430 FL -6.0 Y +32431 FL -6.0 Y +32432 FL -6.0 Y +32433 FL -6.0 Y +32434 FL -6.0 Y +32435 FL -6.0 Y +32437 FL -6.0 Y +32438 FL -6.0 Y +32439 FL -6.0 Y +32440 FL -6.0 Y +32442 FL -6.0 Y +32443 FL -6.0 Y +32444 FL -6.0 Y +32445 FL -6.0 Y +32446 FL -6.0 Y +32447 FL -6.0 Y +32448 FL -6.0 Y +32449 FL -6.0 Y +32452 FL -6.0 Y +32454 FL -6.0 Y +32455 FL -6.0 Y +32456 FL -6.0 Y +32457 FL -6.0 Y +32459 FL -6.0 Y +32460 FL -6.0 Y +32461 FL -6.0 Y +32462 FL -6.0 Y +32463 FL -6.0 Y +32464 FL -6.0 Y +32465 FL -6.0 Y +32466 FL -6.0 Y +32501 FL -6.0 Y +32502 FL -6.0 Y +32503 FL -6.0 Y +32504 FL -6.0 Y +32505 FL -6.0 Y +32506 FL -6.0 Y +32507 FL -6.0 Y +32508 FL -6.0 Y +32509 FL -6.0 Y +32511 FL -6.0 Y +32512 FL -6.0 Y +32513 FL -6.0 Y +32514 FL -6.0 Y +32516 FL -6.0 Y +32520 FL -6.0 Y +32521 FL -6.0 Y +32522 FL -6.0 Y +32523 FL -6.0 Y +32524 FL -6.0 Y +32526 FL -6.0 Y +32530 FL -6.0 Y +32531 FL -6.0 Y +32533 FL -6.0 Y +32534 FL -6.0 Y +32535 FL -6.0 Y +32536 FL -6.0 Y +32537 FL -6.0 Y +32538 FL -6.0 Y +32539 FL -6.0 Y +32540 FL -6.0 Y +32541 FL -6.0 Y +32542 FL -6.0 Y +32544 FL -6.0 Y +32547 FL -6.0 Y +32548 FL -6.0 Y +32549 FL -6.0 Y +32550 FL -6.0 Y +32559 FL -6.0 Y +32560 FL -6.0 Y +32561 FL -6.0 Y +32562 FL -6.0 Y +32563 FL -6.0 Y +32564 FL -6.0 Y +32565 FL -6.0 Y +32566 FL -6.0 Y +32567 FL -6.0 Y +32568 FL -6.0 Y +32569 FL -6.0 Y +32570 FL -6.0 Y +32571 FL -6.0 Y +32572 FL -6.0 Y +32577 FL -6.0 Y +32578 FL -6.0 Y +32579 FL -6.0 Y +32580 FL -6.0 Y +32583 FL -6.0 Y +32588 FL -6.0 Y +32590 FL -6.0 Y +32591 FL -6.0 Y +32592 FL -6.0 Y +32601 FL -5.0 Y +32602 FL -5.0 Y +32603 FL -5.0 Y +32604 FL -5.0 Y +32605 FL -5.0 Y +32606 FL -5.0 Y +32607 FL -5.0 Y +32608 FL -5.0 Y +32609 FL -5.0 Y +32610 FL -5.0 Y +32611 FL -5.0 Y +32612 FL -5.0 Y +32613 FL -5.0 Y +32614 FL -5.0 Y +32615 FL -5.0 Y +32616 FL -5.0 Y +32617 FL -5.0 Y +32618 FL -5.0 Y +32619 FL -5.0 Y +32621 FL -5.0 Y +32622 FL -5.0 Y +32625 FL -5.0 Y +32626 FL -5.0 Y +32627 FL -5.0 Y +32628 FL -5.0 Y +32631 FL -5.0 Y +32633 FL -5.0 Y +32634 FL -5.0 Y +32635 FL -5.0 Y +32639 FL -5.0 Y +32640 FL -5.0 Y +32641 FL -5.0 Y +32643 FL -5.0 Y +32644 FL -5.0 Y +32648 FL -5.0 Y +32653 FL -5.0 Y +32654 FL -5.0 Y +32655 FL -5.0 Y +32656 FL -5.0 Y +32658 FL -5.0 Y +32662 FL -5.0 Y +32663 FL -5.0 Y +32664 FL -5.0 Y +32666 FL -5.0 Y +32667 FL -5.0 Y +32668 FL -5.0 Y +32669 FL -5.0 Y +32680 FL -5.0 Y +32681 FL -5.0 Y +32683 FL -5.0 Y +32686 FL -5.0 Y +32692 FL -5.0 Y +32693 FL -5.0 Y +32694 FL -5.0 Y +32696 FL -5.0 Y +32697 FL -5.0 Y +32701 FL -5.0 Y +32702 FL -5.0 Y +32703 FL -5.0 Y +32704 FL -5.0 Y +32706 FL -5.0 Y +32707 FL -5.0 Y +32708 FL -5.0 Y +32709 FL -5.0 Y +32710 FL -5.0 Y +32712 FL -5.0 Y +32713 FL -5.0 Y +32714 FL -5.0 Y +32715 FL -5.0 Y +32716 FL -5.0 Y +32718 FL -5.0 Y +32719 FL -5.0 Y +32720 FL -5.0 Y +32721 FL -5.0 Y +32722 FL -5.0 Y +32723 FL -5.0 Y +32724 FL -5.0 Y +32725 FL -5.0 Y +32726 FL -5.0 Y +32727 FL -5.0 Y +32728 FL -5.0 Y +32730 FL -5.0 Y +32732 FL -5.0 Y +32733 FL -5.0 Y +32735 FL -5.0 Y +32736 FL -5.0 Y +32738 FL -5.0 Y +32739 FL -5.0 Y +32744 FL -5.0 Y +32745 FL -5.0 Y +32746 FL -5.0 Y +32747 FL -5.0 Y +32750 FL -5.0 Y +32751 FL -5.0 Y +32752 FL -5.0 Y +32753 FL -5.0 Y +32754 FL -5.0 Y +32756 FL -5.0 Y +32757 FL -5.0 Y +32759 FL -5.0 Y +32762 FL -5.0 Y +32763 FL -5.0 Y +32764 FL -5.0 Y +32765 FL -5.0 Y +32766 FL -5.0 Y +32767 FL -5.0 Y +32768 FL -5.0 Y +32771 FL -5.0 Y +32772 FL -5.0 Y +32773 FL -5.0 Y +32774 FL -5.0 Y +32775 FL -5.0 Y +32776 FL -5.0 Y +32777 FL -5.0 Y +32778 FL -5.0 Y +32779 FL -5.0 Y +32780 FL -5.0 Y +32781 FL -5.0 Y +32782 FL -5.0 Y +32783 FL -5.0 Y +32784 FL -5.0 Y +32789 FL -5.0 Y +32790 FL -5.0 Y +32791 FL -5.0 Y +32792 FL -5.0 Y +32793 FL -5.0 Y +32794 FL -5.0 Y +32795 FL -5.0 Y +32796 FL -5.0 Y +32798 FL -5.0 Y +32799 FL -5.0 Y +32801 FL -5.0 Y +32802 FL -5.0 Y +32803 FL -5.0 Y +32804 FL -5.0 Y +32805 FL -5.0 Y +32806 FL -5.0 Y +32807 FL -5.0 Y +32808 FL -5.0 Y +32809 FL -5.0 Y +32810 FL -5.0 Y +32811 FL -5.0 Y +32812 FL -5.0 Y +32814 FL -5.0 Y +32815 FL -5.0 Y +32816 FL -5.0 Y +32817 FL -5.0 Y +32818 FL -5.0 Y +32819 FL -5.0 Y +32820 FL -5.0 Y +32821 FL -5.0 Y +32822 FL -5.0 Y +32824 FL -5.0 Y +32825 FL -5.0 Y +32826 FL -5.0 Y +32827 FL -5.0 Y +32828 FL -5.0 Y +32829 FL -5.0 Y +32830 FL -5.0 Y +32831 FL -5.0 Y +32832 FL -5.0 Y +32833 FL -5.0 Y +32834 FL -5.0 Y +32835 FL -5.0 Y +32836 FL -5.0 Y +32837 FL -5.0 Y +32839 FL -5.0 Y +32853 FL -5.0 Y +32854 FL -5.0 Y +32855 FL -5.0 Y +32856 FL -5.0 Y +32857 FL -5.0 Y +32858 FL -5.0 Y +32859 FL -5.0 Y +32860 FL -5.0 Y +32861 FL -5.0 Y +32862 FL -5.0 Y +32867 FL -5.0 Y +32868 FL -5.0 Y +32869 FL -5.0 Y +32872 FL -5.0 Y +32877 FL -5.0 Y +32878 FL -5.0 Y +32885 FL -5.0 Y +32886 FL -5.0 Y +32887 FL -5.0 Y +32890 FL -5.0 Y +32891 FL -5.0 Y +32893 FL -5.0 Y +32896 FL -5.0 Y +32897 FL -5.0 Y +32898 FL -5.0 Y +32899 FL -5.0 Y +32901 FL -5.0 Y +32902 FL -5.0 Y +32903 FL -5.0 Y +32904 FL -5.0 Y +32905 FL -5.0 Y +32906 FL -5.0 Y +32907 FL -5.0 Y +32908 FL -5.0 Y +32909 FL -5.0 Y +32910 FL -5.0 Y +32911 FL -5.0 Y +32912 FL -5.0 Y +32919 FL -5.0 Y +32920 FL -5.0 Y +32922 FL -5.0 Y +32923 FL -5.0 Y +32924 FL -5.0 Y +32925 FL -5.0 Y +32926 FL -5.0 Y +32927 FL -5.0 Y +32931 FL -5.0 Y +32932 FL -5.0 Y +32934 FL -5.0 Y +32935 FL -5.0 Y +32936 FL -5.0 Y +32937 FL -5.0 Y +32940 FL -5.0 Y +32941 FL -5.0 Y +32948 FL -5.0 Y +32949 FL -5.0 Y +32950 FL -5.0 Y +32951 FL -5.0 Y +32952 FL -5.0 Y +32953 FL -5.0 Y +32954 FL -5.0 Y +32955 FL -5.0 Y +32956 FL -5.0 Y +32957 FL -5.0 Y +32958 FL -5.0 Y +32959 FL -5.0 Y +32960 FL -5.0 Y +32961 FL -5.0 Y +32962 FL -5.0 Y +32963 FL -5.0 Y +32964 FL -5.0 Y +32965 FL -5.0 Y +32966 FL -5.0 Y +32967 FL -5.0 Y +32968 FL -5.0 Y +32969 FL -5.0 Y +32970 FL -5.0 Y +32971 FL -5.0 Y +32976 FL -5.0 Y +32978 FL -5.0 Y +33001 FL -5.0 Y +33002 FL -5.0 Y +33004 FL -5.0 Y +33008 FL -5.0 Y +33009 FL -5.0 Y +33010 FL -5.0 Y +33011 FL -5.0 Y +33012 FL -5.0 Y +33013 FL -5.0 Y +33014 FL -5.0 Y +33015 FL -5.0 Y +33016 FL -5.0 Y +33017 FL -5.0 Y +33018 FL -5.0 Y +33019 FL -5.0 Y +33020 FL -5.0 Y +33021 FL -5.0 Y +33022 FL -5.0 Y +33023 FL -5.0 Y +33024 FL -5.0 Y +33025 FL -5.0 Y +33026 FL -5.0 Y +33027 FL -5.0 Y +33028 FL -5.0 Y +33029 FL -5.0 Y +33030 FL -5.0 Y +33031 FL -5.0 Y +33032 FL -5.0 Y +33033 FL -5.0 Y +33034 FL -5.0 Y +33035 FL -5.0 Y +33036 FL -5.0 Y +33037 FL -5.0 Y +33039 FL -5.0 Y +33040 FL -5.0 Y +33041 FL -5.0 Y +33042 FL -5.0 Y +33043 FL -5.0 Y +33045 FL -5.0 Y +33050 FL -5.0 Y +33051 FL -5.0 Y +33052 FL -5.0 Y +33054 FL -5.0 Y +33055 FL -5.0 Y +33056 FL -5.0 Y +33060 FL -5.0 Y +33061 FL -5.0 Y +33062 FL -5.0 Y +33063 FL -5.0 Y +33064 FL -5.0 Y +33065 FL -5.0 Y +33066 FL -5.0 Y +33067 FL -5.0 Y +33068 FL -5.0 Y +33069 FL -5.0 Y +33070 FL -5.0 Y +33071 FL -5.0 Y +33072 FL -5.0 Y +33073 FL -5.0 Y +33074 FL -5.0 Y +33075 FL -5.0 Y +33076 FL -5.0 Y +33077 FL -5.0 Y +33081 FL -5.0 Y +33082 FL -5.0 Y +33083 FL -5.0 Y +33084 FL -5.0 Y +33090 FL -5.0 Y +33092 FL -5.0 Y +33093 FL -5.0 Y +33097 FL -5.0 Y +33101 FL -5.0 Y +33102 FL -5.0 Y +33107 FL -5.0 Y +33109 FL -5.0 Y +33110 FL -5.0 Y +33111 FL -5.0 Y +33112 FL -5.0 Y +33114 FL -5.0 Y +33116 FL -5.0 Y +33119 FL -5.0 Y +33121 FL -5.0 Y +33122 FL -5.0 Y +33124 FL -5.0 Y +33125 FL -5.0 Y +33126 FL -5.0 Y +33127 FL -5.0 Y +33128 FL -5.0 Y +33129 FL -5.0 Y +33130 FL -5.0 Y +33131 FL -5.0 Y +33132 FL -5.0 Y +33133 FL -5.0 Y +33134 FL -5.0 Y +33135 FL -5.0 Y +33136 FL -5.0 Y +33137 FL -5.0 Y +33138 FL -5.0 Y +33139 FL -5.0 Y +33140 FL -5.0 Y +33141 FL -5.0 Y +33142 FL -5.0 Y +33143 FL -5.0 Y +33144 FL -5.0 Y +33145 FL -5.0 Y +33146 FL -5.0 Y +33147 FL -5.0 Y +33148 FL -5.0 Y +33149 FL -5.0 Y +33150 FL -5.0 Y +33151 FL -5.0 Y +33152 FL -5.0 Y +33153 FL -5.0 Y +33154 FL -5.0 Y +33155 FL -5.0 Y +33156 FL -5.0 Y +33157 FL -5.0 Y +33158 FL -5.0 Y +33159 FL -5.0 Y +33160 FL -5.0 Y +33161 FL -5.0 Y +33162 FL -5.0 Y +33163 FL -5.0 Y +33164 FL -5.0 Y +33165 FL -5.0 Y +33166 FL -5.0 Y +33167 FL -5.0 Y +33168 FL -5.0 Y +33169 FL -5.0 Y +33170 FL -5.0 Y +33172 FL -5.0 Y +33173 FL -5.0 Y +33174 FL -5.0 Y +33175 FL -5.0 Y +33176 FL -5.0 Y +33177 FL -5.0 Y +33178 FL -5.0 Y +33179 FL -5.0 Y +33180 FL -5.0 Y +33181 FL -5.0 Y +33182 FL -5.0 Y +33183 FL -5.0 Y +33184 FL -5.0 Y +33185 FL -5.0 Y +33186 FL -5.0 Y +33187 FL -5.0 Y +33188 FL -5.0 Y +33189 FL -5.0 Y +33190 FL -5.0 Y +33193 FL -5.0 Y +33194 FL -5.0 Y +33195 FL -5.0 Y +33196 FL -5.0 Y +33197 FL -5.0 Y +33199 FL -5.0 Y +33231 FL -5.0 Y +33233 FL -5.0 Y +33234 FL -5.0 Y +33238 FL -5.0 Y +33239 FL -5.0 Y +33242 FL -5.0 Y +33243 FL -5.0 Y +33245 FL -5.0 Y +33247 FL -5.0 Y +33255 FL -5.0 Y +33256 FL -5.0 Y +33257 FL -5.0 Y +33261 FL -5.0 Y +33265 FL -5.0 Y +33266 FL -5.0 Y +33269 FL -5.0 Y +33280 FL -5.0 Y +33283 FL -5.0 Y +33296 FL -5.0 Y +33299 FL -5.0 Y +33301 FL -5.0 Y +33302 FL -5.0 Y +33303 FL -5.0 Y +33304 FL -5.0 Y +33305 FL -5.0 Y +33306 FL -5.0 Y +33307 FL -5.0 Y +33308 FL -5.0 Y +33309 FL -5.0 Y +33310 FL -5.0 Y +33311 FL -5.0 Y +33312 FL -5.0 Y +33313 FL -5.0 Y +33314 FL -5.0 Y +33315 FL -5.0 Y +33316 FL -5.0 Y +33317 FL -5.0 Y +33318 FL -5.0 Y +33319 FL -5.0 Y +33320 FL -5.0 Y +33321 FL -5.0 Y +33322 FL -5.0 Y +33323 FL -5.0 Y +33324 FL -5.0 Y +33325 FL -5.0 Y +33326 FL -5.0 Y +33327 FL -5.0 Y +33328 FL -5.0 Y +33329 FL -5.0 Y +33330 FL -5.0 Y +33331 FL -5.0 Y +33332 FL -5.0 Y +33334 FL -5.0 Y +33335 FL -5.0 Y +33336 FL -5.0 Y +33337 FL -5.0 Y +33338 FL -5.0 Y +33339 FL -5.0 Y +33340 FL -5.0 Y +33345 FL -5.0 Y +33346 FL -5.0 Y +33348 FL -5.0 Y +33349 FL -5.0 Y +33351 FL -5.0 Y +33355 FL -5.0 Y +33359 FL -5.0 Y +33388 FL -5.0 Y +33394 FL -5.0 Y +33401 FL -5.0 Y +33402 FL -5.0 Y +33403 FL -5.0 Y +33404 FL -5.0 Y +33405 FL -5.0 Y +33406 FL -5.0 Y +33407 FL -5.0 Y +33408 FL -5.0 Y +33409 FL -5.0 Y +33410 FL -5.0 Y +33411 FL -5.0 Y +33412 FL -5.0 Y +33413 FL -5.0 Y +33414 FL -5.0 Y +33415 FL -5.0 Y +33416 FL -5.0 Y +33417 FL -5.0 Y +33418 FL -5.0 Y +33419 FL -5.0 Y +33420 FL -5.0 Y +33421 FL -5.0 Y +33422 FL -5.0 Y +33424 FL -5.0 Y +33425 FL -5.0 Y +33426 FL -5.0 Y +33427 FL -5.0 Y +33428 FL -5.0 Y +33429 FL -5.0 Y +33430 FL -5.0 Y +33431 FL -5.0 Y +33432 FL -5.0 Y +33433 FL -5.0 Y +33434 FL -5.0 Y +33435 FL -5.0 Y +33436 FL -5.0 Y +33437 FL -5.0 Y +33438 FL -5.0 Y +33439 FL -5.0 Y +33440 FL -5.0 Y +33441 FL -5.0 Y +33442 FL -5.0 Y +33443 FL -5.0 Y +33444 FL -5.0 Y +33445 FL -5.0 Y +33446 FL -5.0 Y +33447 FL -5.0 Y +33448 FL -5.0 Y +33454 FL -5.0 Y +33455 FL -5.0 Y +33458 FL -5.0 Y +33459 FL -5.0 Y +33460 FL -5.0 Y +33461 FL -5.0 Y +33462 FL -5.0 Y +33463 FL -5.0 Y +33464 FL -5.0 Y +33465 FL -5.0 Y +33466 FL -5.0 Y +33467 FL -5.0 Y +33468 FL -5.0 Y +33469 FL -5.0 Y +33470 FL -5.0 Y +33471 FL -5.0 Y +33474 FL -5.0 Y +33475 FL -5.0 Y +33476 FL -5.0 Y +33477 FL -5.0 Y +33478 FL -5.0 Y +33480 FL -5.0 Y +33481 FL -5.0 Y +33482 FL -5.0 Y +33483 FL -5.0 Y +33484 FL -5.0 Y +33486 FL -5.0 Y +33487 FL -5.0 Y +33488 FL -5.0 Y +33493 FL -5.0 Y +33496 FL -5.0 Y +33497 FL -5.0 Y +33498 FL -5.0 Y +33499 FL -5.0 Y +33503 FL -5.0 Y +33508 FL -5.0 Y +33509 FL -5.0 Y +33510 FL -5.0 Y +33511 FL -5.0 Y +33513 FL -5.0 Y +33514 FL -5.0 Y +33521 FL -5.0 Y +33523 FL -5.0 Y +33524 FL -5.0 Y +33525 FL -5.0 Y +33526 FL -5.0 Y +33527 FL -5.0 Y +33530 FL -5.0 Y +33534 FL -5.0 Y +33537 FL -5.0 Y +33538 FL -5.0 Y +33539 FL -5.0 Y +33540 FL -5.0 Y +33541 FL -5.0 Y +33542 FL -5.0 Y +33543 FL -5.0 Y +33544 FL -5.0 Y +33547 FL -5.0 Y +33548 FL -5.0 Y +33549 FL -5.0 Y +33550 FL -5.0 Y +33556 FL -5.0 Y +33558 FL -5.0 Y +33559 FL -5.0 Y +33563 FL -5.0 Y +33564 FL -5.0 Y +33565 FL -5.0 Y +33566 FL -5.0 Y +33567 FL -5.0 Y +33568 FL -5.0 Y +33569 FL -5.0 Y +33570 FL -5.0 Y +33571 FL -5.0 Y +33572 FL -5.0 Y +33573 FL -5.0 Y +33574 FL -5.0 Y +33575 FL -5.0 Y +33576 FL -5.0 Y +33583 FL -5.0 Y +33584 FL -5.0 Y +33585 FL -5.0 Y +33586 FL -5.0 Y +33587 FL -5.0 Y +33592 FL -5.0 Y +33593 FL -5.0 Y +33594 FL -5.0 Y +33595 FL -5.0 Y +33597 FL -5.0 Y +33598 FL -5.0 Y +33601 FL -5.0 Y +33602 FL -5.0 Y +33603 FL -5.0 Y +33604 FL -5.0 Y +33605 FL -5.0 Y +33606 FL -5.0 Y +33607 FL -5.0 Y +33608 FL -5.0 Y +33609 FL -5.0 Y +33610 FL -5.0 Y +33611 FL -5.0 Y +33612 FL -5.0 Y +33613 FL -5.0 Y +33614 FL -5.0 Y +33615 FL -5.0 Y +33616 FL -5.0 Y +33617 FL -5.0 Y +33618 FL -5.0 Y +33619 FL -5.0 Y +33620 FL -5.0 Y +33621 FL -5.0 Y +33622 FL -5.0 Y +33623 FL -5.0 Y +33624 FL -5.0 Y +33625 FL -5.0 Y +33626 FL -5.0 Y +33629 FL -5.0 Y +33630 FL -5.0 Y +33631 FL -5.0 Y +33633 FL -5.0 Y +33634 FL -5.0 Y +33635 FL -5.0 Y +33637 FL -5.0 Y +33647 FL -5.0 Y +33650 FL -5.0 Y +33651 FL -5.0 Y +33655 FL -5.0 Y +33660 FL -5.0 Y +33661 FL -5.0 Y +33662 FL -5.0 Y +33663 FL -5.0 Y +33664 FL -5.0 Y +33672 FL -5.0 Y +33673 FL -5.0 Y +33674 FL -5.0 Y +33675 FL -5.0 Y +33677 FL -5.0 Y +33679 FL -5.0 Y +33680 FL -5.0 Y +33681 FL -5.0 Y +33682 FL -5.0 Y +33684 FL -5.0 Y +33685 FL -5.0 Y +33686 FL -5.0 Y +33687 FL -5.0 Y +33688 FL -5.0 Y +33689 FL -5.0 Y +33690 FL -5.0 Y +33694 FL -5.0 Y +33697 FL -5.0 Y +33701 FL -5.0 Y +33702 FL -5.0 Y +33703 FL -5.0 Y +33704 FL -5.0 Y +33705 FL -5.0 Y +33706 FL -5.0 Y +33707 FL -5.0 Y +33708 FL -5.0 Y +33709 FL -5.0 Y +33710 FL -5.0 Y +33711 FL -5.0 Y +33712 FL -5.0 Y +33713 FL -5.0 Y +33714 FL -5.0 Y +33715 FL -5.0 Y +33716 FL -5.0 Y +33729 FL -5.0 Y +33730 FL -5.0 Y +33731 FL -5.0 Y +33732 FL -5.0 Y +33733 FL -5.0 Y +33734 FL -5.0 Y +33736 FL -5.0 Y +33737 FL -5.0 Y +33738 FL -5.0 Y +33740 FL -5.0 Y +33741 FL -5.0 Y +33742 FL -5.0 Y +33743 FL -5.0 Y +33744 FL -5.0 Y +33747 FL -5.0 Y +33755 FL -5.0 Y +33756 FL -5.0 Y +33757 FL -5.0 Y +33758 FL -5.0 Y +33759 FL -5.0 Y +33760 FL -5.0 Y +33761 FL -5.0 Y +33762 FL -5.0 Y +33763 FL -5.0 Y +33764 FL -5.0 Y +33765 FL -5.0 Y +33766 FL -5.0 Y +33767 FL -5.0 Y +33769 FL -5.0 Y +33770 FL -5.0 Y +33771 FL -5.0 Y +33772 FL -5.0 Y +33773 FL -5.0 Y +33774 FL -5.0 Y +33775 FL -5.0 Y +33776 FL -5.0 Y +33777 FL -5.0 Y +33778 FL -5.0 Y +33779 FL -5.0 Y +33780 FL -5.0 Y +33781 FL -5.0 Y +33782 FL -5.0 Y +33784 FL -5.0 Y +33785 FL -5.0 Y +33786 FL -5.0 Y +33801 FL -5.0 Y +33802 FL -5.0 Y +33803 FL -5.0 Y +33804 FL -5.0 Y +33805 FL -5.0 Y +33806 FL -5.0 Y +33807 FL -5.0 Y +33809 FL -5.0 Y +33810 FL -5.0 Y +33811 FL -5.0 Y +33812 FL -5.0 Y +33813 FL -5.0 Y +33815 FL -5.0 Y +33820 FL -5.0 Y +33823 FL -5.0 Y +33825 FL -5.0 Y +33826 FL -5.0 Y +33827 FL -5.0 Y +33830 FL -5.0 Y +33831 FL -5.0 Y +33834 FL -5.0 Y +33835 FL -5.0 Y +33836 FL -5.0 Y +33837 FL -5.0 Y +33838 FL -5.0 Y +33839 FL -5.0 Y +33840 FL -5.0 Y +33841 FL -5.0 Y +33843 FL -5.0 Y +33844 FL -5.0 Y +33845 FL -5.0 Y +33846 FL -5.0 Y +33847 FL -5.0 Y +33848 FL -5.0 Y +33849 FL -5.0 Y +33850 FL -5.0 Y +33851 FL -5.0 Y +33852 FL -5.0 Y +33853 FL -5.0 Y +33854 FL -5.0 Y +33855 FL -5.0 Y +33856 FL -5.0 Y +33857 FL -5.0 Y +33858 FL -5.0 Y +33859 FL -5.0 Y +33860 FL -5.0 Y +33862 FL -5.0 Y +33863 FL -5.0 Y +33865 FL -5.0 Y +33867 FL -5.0 Y +33868 FL -5.0 Y +33870 FL -5.0 Y +33871 FL -5.0 Y +33872 FL -5.0 Y +33873 FL -5.0 Y +33875 FL -5.0 Y +33876 FL -5.0 Y +33877 FL -5.0 Y +33880 FL -5.0 Y +33881 FL -5.0 Y +33882 FL -5.0 Y +33883 FL -5.0 Y +33884 FL -5.0 Y +33885 FL -5.0 Y +33888 FL -5.0 Y +33890 FL -5.0 Y +33896 FL -5.0 Y +33897 FL -5.0 Y +33898 FL -5.0 Y +33901 FL -5.0 Y +33902 FL -5.0 Y +33903 FL -5.0 Y +33904 FL -5.0 Y +33905 FL -5.0 Y +33906 FL -5.0 Y +33907 FL -5.0 Y +33908 FL -5.0 Y +33909 FL -5.0 Y +33910 FL -5.0 Y +33911 FL -5.0 Y +33912 FL -5.0 Y +33913 FL -5.0 Y +33914 FL -5.0 Y +33915 FL -5.0 Y +33916 FL -5.0 Y +33917 FL -5.0 Y +33918 FL -5.0 Y +33919 FL -5.0 Y +33920 FL -5.0 Y +33921 FL -5.0 Y +33922 FL -5.0 Y +33924 FL -5.0 Y +33927 FL -5.0 Y +33928 FL -5.0 Y +33930 FL -5.0 Y +33931 FL -5.0 Y +33932 FL -5.0 Y +33935 FL -5.0 Y +33936 FL -5.0 Y +33938 FL -5.0 Y +33944 FL -5.0 Y +33945 FL -5.0 Y +33946 FL -5.0 Y +33947 FL -5.0 Y +33948 FL -5.0 Y +33949 FL -5.0 Y +33950 FL -5.0 Y +33951 FL -5.0 Y +33952 FL -5.0 Y +33953 FL -5.0 Y +33954 FL -5.0 Y +33955 FL -5.0 Y +33956 FL -5.0 Y +33957 FL -5.0 Y +33960 FL -5.0 Y +33965 FL -5.0 Y +33966 FL -5.0 Y +33967 FL -5.0 Y +33970 FL -5.0 Y +33971 FL -5.0 Y +33972 FL -5.0 Y +33975 FL -5.0 Y +33980 FL -5.0 Y +33981 FL -5.0 Y +33982 FL -5.0 Y +33983 FL -5.0 Y +33990 FL -5.0 Y +33991 FL -5.0 Y +33993 FL -5.0 Y +33994 FL -5.0 Y +34101 FL -5.0 Y +34102 FL -5.0 Y +34103 FL -5.0 Y +34104 FL -5.0 Y +34105 FL -5.0 Y +34106 FL -5.0 Y +34107 FL -5.0 Y +34108 FL -5.0 Y +34109 FL -5.0 Y +34110 FL -5.0 Y +34112 FL -5.0 Y +34113 FL -5.0 Y +34114 FL -5.0 Y +34116 FL -5.0 Y +34117 FL -5.0 Y +34119 FL -5.0 Y +34120 FL -5.0 Y +34133 FL -5.0 Y +34134 FL -5.0 Y +34135 FL -5.0 Y +34136 FL -5.0 Y +34137 FL -5.0 Y +34138 FL -5.0 Y +34139 FL -5.0 Y +34140 FL -5.0 Y +34141 FL -5.0 Y +34142 FL -5.0 Y +34143 FL -5.0 Y +34145 FL -5.0 Y +34146 FL -5.0 Y +34201 FL -5.0 Y +34202 FL -5.0 Y +34203 FL -5.0 Y +34204 FL -5.0 Y +34205 FL -5.0 Y +34206 FL -5.0 Y +34207 FL -5.0 Y +34208 FL -5.0 Y +34209 FL -5.0 Y +34210 FL -5.0 Y +34211 FL -5.0 Y +34212 FL -5.0 Y +34215 FL -5.0 Y +34216 FL -5.0 Y +34217 FL -5.0 Y +34218 FL -5.0 Y +34219 FL -5.0 Y +34220 FL -5.0 Y +34221 FL -5.0 Y +34222 FL -5.0 Y +34223 FL -5.0 Y +34224 FL -5.0 Y +34228 FL -5.0 Y +34229 FL -5.0 Y +34230 FL -5.0 Y +34231 FL -5.0 Y +34232 FL -5.0 Y +34233 FL -5.0 Y +34234 FL -5.0 Y +34235 FL -5.0 Y +34236 FL -5.0 Y +34237 FL -5.0 Y +34238 FL -5.0 Y +34239 FL -5.0 Y +34240 FL -5.0 Y +34241 FL -5.0 Y +34242 FL -5.0 Y +34243 FL -5.0 Y +34250 FL -5.0 Y +34251 FL -5.0 Y +34260 FL -5.0 Y +34264 FL -5.0 Y +34265 FL -5.0 Y +34266 FL -5.0 Y +34267 FL -5.0 Y +34268 FL -5.0 Y +34269 FL -5.0 Y +34270 FL -5.0 Y +34272 FL -5.0 Y +34274 FL -5.0 Y +34275 FL -5.0 Y +34276 FL -5.0 Y +34277 FL -5.0 Y +34278 FL -5.0 Y +34280 FL -5.0 Y +34281 FL -5.0 Y +34282 FL -5.0 Y +34284 FL -5.0 Y +34285 FL -5.0 Y +34286 FL -5.0 Y +34287 FL -5.0 Y +34288 FL -5.0 Y +34289 FL -5.0 Y +34292 FL -5.0 Y +34293 FL -5.0 Y +34295 FL -5.0 Y +34420 FL -5.0 Y +34421 FL -5.0 Y +34423 FL -5.0 Y +34428 FL -5.0 Y +34429 FL -5.0 Y +34430 FL -5.0 Y +34431 FL -5.0 Y +34432 FL -5.0 Y +34433 FL -5.0 Y +34434 FL -5.0 Y +34436 FL -5.0 Y +34442 FL -5.0 Y +34445 FL -5.0 Y +34446 FL -5.0 Y +34447 FL -5.0 Y +34448 FL -5.0 Y +34449 FL -5.0 Y +34450 FL -5.0 Y +34451 FL -5.0 Y +34452 FL -5.0 Y +34453 FL -5.0 Y +34460 FL -5.0 Y +34461 FL -5.0 Y +34464 FL -5.0 Y +34465 FL -5.0 Y +34470 FL -5.0 Y +34471 FL -5.0 Y +34472 FL -5.0 Y +34473 FL -5.0 Y +34474 FL -5.0 Y +34475 FL -5.0 Y +34476 FL -5.0 Y +34477 FL -5.0 Y +34478 FL -5.0 Y +34479 FL -5.0 Y +34480 FL -5.0 Y +34481 FL -5.0 Y +34482 FL -5.0 Y +34483 FL -5.0 Y +34484 FL -5.0 Y +34487 FL -5.0 Y +34488 FL -5.0 Y +34489 FL -5.0 Y +34491 FL -5.0 Y +34492 FL -5.0 Y +34498 FL -5.0 Y +34601 FL -5.0 Y +34602 FL -5.0 Y +34603 FL -5.0 Y +34604 FL -5.0 Y +34605 FL -5.0 Y +34606 FL -5.0 Y +34607 FL -5.0 Y +34608 FL -5.0 Y +34609 FL -5.0 Y +34610 FL -5.0 Y +34611 FL -5.0 Y +34613 FL -5.0 Y +34614 FL -5.0 Y +34636 FL -5.0 Y +34637 FL -5.0 Y +34638 FL -5.0 Y +34639 FL -5.0 Y +34652 FL -5.0 Y +34653 FL -5.0 Y +34654 FL -5.0 Y +34655 FL -5.0 Y +34656 FL -5.0 Y +34660 FL -5.0 Y +34661 FL -5.0 Y +34667 FL -5.0 Y +34668 FL -5.0 Y +34669 FL -5.0 Y +34673 FL -5.0 Y +34674 FL -5.0 Y +34677 FL -5.0 Y +34679 FL -5.0 Y +34680 FL -5.0 Y +34681 FL -5.0 Y +34682 FL -5.0 Y +34683 FL -5.0 Y +34684 FL -5.0 Y +34685 FL -5.0 Y +34688 FL -5.0 Y +34689 FL -5.0 Y +34690 FL -5.0 Y +34691 FL -5.0 Y +34692 FL -5.0 Y +34695 FL -5.0 Y +34697 FL -5.0 Y +34698 FL -5.0 Y +34705 FL -5.0 Y +34711 FL -5.0 Y +34712 FL -5.0 Y +34713 FL -5.0 Y +34714 FL -5.0 Y +34715 FL -5.0 Y +34729 FL -5.0 Y +34731 FL -5.0 Y +34734 FL -5.0 Y +34736 FL -5.0 Y +34737 FL -5.0 Y +34739 FL -5.0 Y +34740 FL -5.0 Y +34741 FL -5.0 Y +34742 FL -5.0 Y +34743 FL -5.0 Y +34744 FL -5.0 Y +34745 FL -5.0 Y +34746 FL -5.0 Y +34747 FL -5.0 Y +34748 FL -5.0 Y +34749 FL -5.0 Y +34753 FL -5.0 Y +34755 FL -5.0 Y +34756 FL -5.0 Y +34758 FL -5.0 Y +34759 FL -5.0 Y +34760 FL -5.0 Y +34761 FL -5.0 Y +34762 FL -5.0 Y +34769 FL -5.0 Y +34770 FL -5.0 Y +34771 FL -5.0 Y +34772 FL -5.0 Y +34773 FL -5.0 Y +34777 FL -5.0 Y +34778 FL -5.0 Y +34785 FL -5.0 Y +34786 FL -5.0 Y +34787 FL -5.0 Y +34788 FL -5.0 Y +34789 FL -5.0 Y +34797 FL -5.0 Y +34945 FL -5.0 Y +34946 FL -5.0 Y +34947 FL -5.0 Y +34948 FL -5.0 Y +34949 FL -5.0 Y +34950 FL -5.0 Y +34951 FL -5.0 Y +34952 FL -5.0 Y +34953 FL -5.0 Y +34954 FL -5.0 Y +34956 FL -5.0 Y +34957 FL -5.0 Y +34958 FL -5.0 Y +34972 FL -5.0 Y +34973 FL -5.0 Y +34974 FL -5.0 Y +34979 FL -5.0 Y +34981 FL -5.0 Y +34982 FL -5.0 Y +34983 FL -5.0 Y +34984 FL -5.0 Y +34985 FL -5.0 Y +34986 FL -5.0 Y +34987 FL -5.0 Y +34988 FL -5.0 Y +34990 FL -5.0 Y +34991 FL -5.0 Y +34992 FL -5.0 Y +34994 FL -5.0 Y +34995 FL -5.0 Y +34996 FL -5.0 Y +34997 FL -5.0 Y +35004 AL -6.0 Y +35005 AL -6.0 Y +35006 AL -6.0 Y +35007 AL -6.0 Y +35010 AL -6.0 Y +35011 AL -6.0 Y +35013 AL -6.0 Y +35014 AL -6.0 Y +35015 AL -6.0 Y +35016 AL -6.0 Y +35019 AL -6.0 Y +35020 AL -6.0 Y +35021 AL -6.0 Y +35022 AL -6.0 Y +35023 AL -6.0 Y +35031 AL -6.0 Y +35032 AL -6.0 Y +35033 AL -6.0 Y +35034 AL -6.0 Y +35035 AL -6.0 Y +35036 AL -6.0 Y +35038 AL -6.0 Y +35040 AL -6.0 Y +35041 AL -6.0 Y +35042 AL -6.0 Y +35043 AL -6.0 Y +35044 AL -6.0 Y +35045 AL -6.0 Y +35046 AL -6.0 Y +35048 AL -6.0 Y +35049 AL -6.0 Y +35051 AL -6.0 Y +35052 AL -6.0 Y +35053 AL -6.0 Y +35054 AL -6.0 Y +35055 AL -6.0 Y +35056 AL -6.0 Y +35057 AL -6.0 Y +35058 AL -6.0 Y +35060 AL -6.0 Y +35061 AL -6.0 Y +35062 AL -6.0 Y +35063 AL -6.0 Y +35064 AL -6.0 Y +35068 AL -6.0 Y +35070 AL -6.0 Y +35071 AL -6.0 Y +35072 AL -6.0 Y +35073 AL -6.0 Y +35074 AL -6.0 Y +35077 AL -6.0 Y +35078 AL -6.0 Y +35079 AL -6.0 Y +35080 AL -6.0 Y +35082 AL -6.0 Y +35083 AL -6.0 Y +35085 AL -6.0 Y +35087 AL -6.0 Y +35089 AL -6.0 Y +35091 AL -6.0 Y +35094 AL -6.0 Y +35096 AL -6.0 Y +35097 AL -6.0 Y +35098 AL -6.0 Y +35111 AL -6.0 Y +35112 AL -6.0 Y +35114 AL -6.0 Y +35115 AL -6.0 Y +35116 AL -6.0 Y +35117 AL -6.0 Y +35118 AL -6.0 Y +35119 AL -6.0 Y +35120 AL -6.0 Y +35121 AL -6.0 Y +35123 AL -6.0 Y +35124 AL -6.0 Y +35125 AL -6.0 Y +35126 AL -6.0 Y +35127 AL -6.0 Y +35128 AL -6.0 Y +35130 AL -6.0 Y +35131 AL -6.0 Y +35133 AL -6.0 Y +35135 AL -6.0 Y +35136 AL -6.0 Y +35137 AL -6.0 Y +35139 AL -6.0 Y +35142 AL -6.0 Y +35143 AL -6.0 Y +35144 AL -6.0 Y +35146 AL -6.0 Y +35147 AL -6.0 Y +35148 AL -6.0 Y +35149 AL -6.0 Y +35150 AL -6.0 Y +35151 AL -6.0 Y +35160 AL -6.0 Y +35161 AL -6.0 Y +35171 AL -6.0 Y +35172 AL -6.0 Y +35173 AL -6.0 Y +35175 AL -6.0 Y +35176 AL -6.0 Y +35178 AL -6.0 Y +35179 AL -6.0 Y +35180 AL -6.0 Y +35181 AL -6.0 Y +35182 AL -6.0 Y +35183 AL -6.0 Y +35184 AL -6.0 Y +35185 AL -6.0 Y +35186 AL -6.0 Y +35187 AL -6.0 Y +35188 AL -6.0 Y +35201 AL -6.0 Y +35202 AL -6.0 Y +35203 AL -6.0 Y +35204 AL -6.0 Y +35205 AL -6.0 Y +35206 AL -6.0 Y +35207 AL -6.0 Y +35208 AL -6.0 Y +35209 AL -6.0 Y +35210 AL -6.0 Y +35211 AL -6.0 Y +35212 AL -6.0 Y +35213 AL -6.0 Y +35214 AL -6.0 Y +35215 AL -6.0 Y +35216 AL -6.0 Y +35217 AL -6.0 Y +35218 AL -6.0 Y +35219 AL -6.0 Y +35220 AL -6.0 Y +35221 AL -6.0 Y +35222 AL -6.0 Y +35223 AL -6.0 Y +35224 AL -6.0 Y +35225 AL -6.0 Y +35226 AL -6.0 Y +35228 AL -6.0 Y +35229 AL -6.0 Y +35230 AL -6.0 Y +35231 AL -6.0 Y +35232 AL -6.0 Y +35233 AL -6.0 Y +35234 AL -6.0 Y +35235 AL -6.0 Y +35236 AL -6.0 Y +35237 AL -6.0 Y +35238 AL -6.0 Y +35240 AL -6.0 Y +35242 AL -6.0 Y +35243 AL -6.0 Y +35244 AL -6.0 Y +35245 AL -6.0 Y +35246 AL -6.0 Y +35249 AL -6.0 Y +35253 AL -6.0 Y +35254 AL -6.0 Y +35255 AL -6.0 Y +35259 AL -6.0 Y +35260 AL -6.0 Y +35261 AL -6.0 Y +35263 AL -6.0 Y +35266 AL -6.0 Y +35277 AL -6.0 Y +35278 AL -6.0 Y +35279 AL -6.0 Y +35280 AL -6.0 Y +35281 AL -6.0 Y +35282 AL -6.0 Y +35283 AL -6.0 Y +35285 AL -6.0 Y +35286 AL -6.0 Y +35287 AL -6.0 Y +35288 AL -6.0 Y +35289 AL -6.0 Y +35290 AL -6.0 Y +35291 AL -6.0 Y +35292 AL -6.0 Y +35293 AL -6.0 Y +35294 AL -6.0 Y +35295 AL -6.0 Y +35296 AL -6.0 Y +35297 AL -6.0 Y +35298 AL -6.0 Y +35299 AL -6.0 Y +35401 AL -6.0 Y +35402 AL -6.0 Y +35403 AL -6.0 Y +35404 AL -6.0 Y +35405 AL -6.0 Y +35406 AL -6.0 Y +35407 AL -6.0 Y +35440 AL -6.0 Y +35441 AL -6.0 Y +35442 AL -6.0 Y +35443 AL -6.0 Y +35444 AL -6.0 Y +35446 AL -6.0 Y +35447 AL -6.0 Y +35448 AL -6.0 Y +35449 AL -6.0 Y +35452 AL -6.0 Y +35453 AL -6.0 Y +35456 AL -6.0 Y +35457 AL -6.0 Y +35458 AL -6.0 Y +35459 AL -6.0 Y +35460 AL -6.0 Y +35461 AL -6.0 Y +35462 AL -6.0 Y +35463 AL -6.0 Y +35464 AL -6.0 Y +35466 AL -6.0 Y +35468 AL -6.0 Y +35469 AL -6.0 Y +35470 AL -6.0 Y +35471 AL -6.0 Y +35473 AL -6.0 Y +35474 AL -6.0 Y +35475 AL -6.0 Y +35476 AL -6.0 Y +35477 AL -6.0 Y +35478 AL -6.0 Y +35480 AL -6.0 Y +35481 AL -6.0 Y +35482 AL -6.0 Y +35485 AL -6.0 Y +35486 AL -6.0 Y +35487 AL -6.0 Y +35490 AL -6.0 Y +35491 AL -6.0 Y +35501 AL -6.0 Y +35502 AL -6.0 Y +35503 AL -6.0 Y +35504 AL -6.0 Y +35540 AL -6.0 Y +35541 AL -6.0 Y +35542 AL -6.0 Y +35543 AL -6.0 Y +35544 AL -6.0 Y +35545 AL -6.0 Y +35546 AL -6.0 Y +35548 AL -6.0 Y +35549 AL -6.0 Y +35550 AL -6.0 Y +35551 AL -6.0 Y +35552 AL -6.0 Y +35553 AL -6.0 Y +35554 AL -6.0 Y +35555 AL -6.0 Y +35559 AL -6.0 Y +35560 AL -6.0 Y +35563 AL -6.0 Y +35564 AL -6.0 Y +35565 AL -6.0 Y +35570 AL -6.0 Y +35571 AL -6.0 Y +35572 AL -6.0 Y +35573 AL -6.0 Y +35574 AL -6.0 Y +35575 AL -6.0 Y +35576 AL -6.0 Y +35577 AL -6.0 Y +35578 AL -6.0 Y +35579 AL -6.0 Y +35580 AL -6.0 Y +35581 AL -6.0 Y +35582 AL -6.0 Y +35584 AL -6.0 Y +35585 AL -6.0 Y +35586 AL -6.0 Y +35587 AL -6.0 Y +35592 AL -6.0 Y +35593 AL -6.0 Y +35594 AL -6.0 Y +35601 AL -6.0 Y +35602 AL -6.0 Y +35603 AL -6.0 Y +35609 AL -6.0 Y +35610 AL -6.0 Y +35611 AL -6.0 Y +35612 AL -6.0 Y +35613 AL -6.0 Y +35614 AL -6.0 Y +35615 AL -6.0 Y +35616 AL -6.0 Y +35617 AL -6.0 Y +35618 AL -6.0 Y +35619 AL -6.0 Y +35620 AL -6.0 Y +35621 AL -6.0 Y +35622 AL -6.0 Y +35630 AL -6.0 Y +35631 AL -6.0 Y +35632 AL -6.0 Y +35633 AL -6.0 Y +35634 AL -6.0 Y +35640 AL -6.0 Y +35643 AL -6.0 Y +35645 AL -6.0 Y +35646 AL -6.0 Y +35647 AL -6.0 Y +35648 AL -6.0 Y +35649 AL -6.0 Y +35650 AL -6.0 Y +35651 AL -6.0 Y +35652 AL -6.0 Y +35653 AL -6.0 Y +35654 AL -6.0 Y +35660 AL -6.0 Y +35661 AL -6.0 Y +35662 AL -6.0 Y +35670 AL -6.0 Y +35671 AL -6.0 Y +35672 AL -6.0 Y +35673 AL -6.0 Y +35674 AL -6.0 Y +35677 AL -6.0 Y +35699 AL -6.0 Y +35739 AL -6.0 Y +35740 AL -6.0 Y +35741 AL -6.0 Y +35742 AL -6.0 Y +35744 AL -6.0 Y +35745 AL -6.0 Y +35746 AL -6.0 Y +35747 AL -6.0 Y +35748 AL -6.0 Y +35749 AL -6.0 Y +35750 AL -6.0 Y +35751 AL -6.0 Y +35752 AL -6.0 Y +35754 AL -6.0 Y +35755 AL -6.0 Y +35756 AL -6.0 Y +35757 AL -6.0 Y +35758 AL -6.0 Y +35759 AL -6.0 Y +35760 AL -6.0 Y +35761 AL -6.0 Y +35762 AL -6.0 Y +35763 AL -6.0 Y +35764 AL -6.0 Y +35765 AL -6.0 Y +35766 AL -6.0 Y +35767 AL -6.0 Y +35768 AL -6.0 Y +35769 AL -6.0 Y +35771 AL -6.0 Y +35772 AL -6.0 Y +35773 AL -6.0 Y +35774 AL -6.0 Y +35775 AL -6.0 Y +35776 AL -6.0 Y +35801 AL -6.0 Y +35802 AL -6.0 Y +35803 AL -6.0 Y +35804 AL -6.0 Y +35805 AL -6.0 Y +35806 AL -6.0 Y +35807 AL -6.0 Y +35808 AL -6.0 Y +35809 AL -6.0 Y +35810 AL -6.0 Y +35811 AL -6.0 Y +35812 AL -6.0 Y +35813 AL -6.0 Y +35814 AL -6.0 Y +35815 AL -6.0 Y +35816 AL -6.0 Y +35824 AL -6.0 Y +35893 AL -6.0 Y +35894 AL -6.0 Y +35895 AL -6.0 Y +35896 AL -6.0 Y +35897 AL -6.0 Y +35898 AL -6.0 Y +35899 AL -6.0 Y +35901 AL -6.0 Y +35902 AL -6.0 Y +35903 AL -6.0 Y +35904 AL -6.0 Y +35905 AL -6.0 Y +35906 AL -6.0 Y +35907 AL -6.0 Y +35950 AL -6.0 Y +35951 AL -6.0 Y +35952 AL -6.0 Y +35953 AL -6.0 Y +35954 AL -6.0 Y +35956 AL -6.0 Y +35957 AL -6.0 Y +35958 AL -6.0 Y +35959 AL -6.0 Y +35960 AL -6.0 Y +35961 AL -6.0 Y +35962 AL -6.0 Y +35963 AL -6.0 Y +35964 AL -6.0 Y +35966 AL -6.0 Y +35967 AL -6.0 Y +35968 AL -6.0 Y +35971 AL -6.0 Y +35972 AL -6.0 Y +35973 AL -6.0 Y +35974 AL -6.0 Y +35975 AL -6.0 Y +35976 AL -6.0 Y +35978 AL -6.0 Y +35979 AL -6.0 Y +35980 AL -6.0 Y +35981 AL -6.0 Y +35983 AL -6.0 Y +35984 AL -6.0 Y +35986 AL -6.0 Y +35987 AL -6.0 Y +35988 AL -6.0 Y +35989 AL -6.0 Y +35990 AL -6.0 Y +36003 AL -6.0 Y +36005 AL -6.0 Y +36006 AL -6.0 Y +36008 AL -6.0 Y +36009 AL -6.0 Y +36010 AL -6.0 Y +36013 AL -6.0 Y +36015 AL -6.0 Y +36016 AL -6.0 Y +36017 AL -6.0 Y +36020 AL -6.0 Y +36022 AL -6.0 Y +36023 AL -6.0 Y +36024 AL -6.0 Y +36025 AL -6.0 Y +36026 AL -6.0 Y +36027 AL -6.0 Y +36028 AL -6.0 Y +36029 AL -6.0 Y +36030 AL -6.0 Y +36031 AL -6.0 Y +36032 AL -6.0 Y +36033 AL -6.0 Y +36034 AL -6.0 Y +36035 AL -6.0 Y +36036 AL -6.0 Y +36037 AL -6.0 Y +36038 AL -6.0 Y +36039 AL -6.0 Y +36040 AL -6.0 Y +36041 AL -6.0 Y +36042 AL -6.0 Y +36043 AL -6.0 Y +36045 AL -6.0 Y +36046 AL -6.0 Y +36047 AL -6.0 Y +36048 AL -6.0 Y +36049 AL -6.0 Y +36051 AL -6.0 Y +36052 AL -6.0 Y +36053 AL -6.0 Y +36054 AL -6.0 Y +36057 AL -6.0 Y +36061 AL -6.0 Y +36062 AL -6.0 Y +36064 AL -6.0 Y +36065 AL -6.0 Y +36066 AL -6.0 Y +36067 AL -6.0 Y +36068 AL -6.0 Y +36069 AL -6.0 Y +36071 AL -6.0 Y +36072 AL -6.0 Y +36075 AL -6.0 Y +36078 AL -6.0 Y +36079 AL -6.0 Y +36080 AL -6.0 Y +36081 AL -6.0 Y +36082 AL -6.0 Y +36083 AL -6.0 Y +36087 AL -6.0 Y +36088 AL -6.0 Y +36089 AL -6.0 Y +36091 AL -6.0 Y +36092 AL -6.0 Y +36093 AL -6.0 Y +36101 AL -6.0 Y +36102 AL -6.0 Y +36103 AL -6.0 Y +36104 AL -6.0 Y +36105 AL -6.0 Y +36106 AL -6.0 Y +36107 AL -6.0 Y +36108 AL -6.0 Y +36109 AL -6.0 Y +36110 AL -6.0 Y +36111 AL -6.0 Y +36112 AL -6.0 Y +36113 AL -6.0 Y +36114 AL -6.0 Y +36115 AL -6.0 Y +36116 AL -6.0 Y +36117 AL -6.0 Y +36118 AL -6.0 Y +36119 AL -6.0 Y +36120 AL -6.0 Y +36121 AL -6.0 Y +36123 AL -6.0 Y +36124 AL -6.0 Y +36125 AL -6.0 Y +36130 AL -6.0 Y +36131 AL -6.0 Y +36132 AL -6.0 Y +36133 AL -6.0 Y +36134 AL -6.0 Y +36135 AL -6.0 Y +36140 AL -6.0 Y +36141 AL -6.0 Y +36142 AL -6.0 Y +36177 AL -6.0 Y +36191 AL -6.0 Y +36201 AL -6.0 Y +36202 AL -6.0 Y +36203 AL -6.0 Y +36204 AL -6.0 Y +36205 AL -6.0 Y +36206 AL -6.0 Y +36207 AL -6.0 Y +36210 AL -6.0 Y +36250 AL -6.0 Y +36251 AL -6.0 Y +36253 AL -6.0 Y +36254 AL -6.0 Y +36255 AL -6.0 Y +36256 AL -6.0 Y +36257 AL -6.0 Y +36258 AL -6.0 Y +36260 AL -6.0 Y +36261 AL -6.0 Y +36262 AL -6.0 Y +36263 AL -6.0 Y +36264 AL -6.0 Y +36265 AL -6.0 Y +36266 AL -6.0 Y +36267 AL -6.0 Y +36268 AL -6.0 Y +36269 AL -6.0 Y +36271 AL -6.0 Y +36272 AL -6.0 Y +36273 AL -6.0 Y +36274 AL -6.0 Y +36275 AL -6.0 Y +36276 AL -6.0 Y +36277 AL -6.0 Y +36278 AL -6.0 Y +36279 AL -6.0 Y +36280 AL -6.0 Y +36301 AL -6.0 Y +36302 AL -6.0 Y +36303 AL -6.0 Y +36304 AL -6.0 Y +36305 AL -6.0 Y +36310 AL -6.0 Y +36311 AL -6.0 Y +36312 AL -6.0 Y +36313 AL -6.0 Y +36314 AL -6.0 Y +36316 AL -6.0 Y +36317 AL -6.0 Y +36318 AL -6.0 Y +36319 AL -6.0 Y +36320 AL -6.0 Y +36321 AL -6.0 Y +36322 AL -6.0 Y +36323 AL -6.0 Y +36330 AL -6.0 Y +36331 AL -6.0 Y +36340 AL -6.0 Y +36343 AL -6.0 Y +36344 AL -6.0 Y +36345 AL -6.0 Y +36346 AL -6.0 Y +36349 AL -6.0 Y +36350 AL -6.0 Y +36351 AL -6.0 Y +36352 AL -6.0 Y +36353 AL -6.0 Y +36360 AL -6.0 Y +36361 AL -6.0 Y +36362 AL -6.0 Y +36370 AL -6.0 Y +36371 AL -6.0 Y +36373 AL -6.0 Y +36374 AL -6.0 Y +36375 AL -6.0 Y +36376 AL -6.0 Y +36401 AL -6.0 Y +36420 AL -6.0 Y +36421 AL -6.0 Y +36425 AL -6.0 Y +36426 AL -6.0 Y +36427 AL -6.0 Y +36429 AL -6.0 Y +36432 AL -6.0 Y +36435 AL -6.0 Y +36436 AL -6.0 Y +36439 AL -6.0 Y +36441 AL -6.0 Y +36442 AL -6.0 Y +36444 AL -6.0 Y +36445 AL -6.0 Y +36446 AL -6.0 Y +36449 AL -6.0 Y +36451 AL -6.0 Y +36453 AL -6.0 Y +36454 AL -6.0 Y +36455 AL -6.0 Y +36456 AL -6.0 Y +36457 AL -6.0 Y +36458 AL -6.0 Y +36460 AL -6.0 Y +36461 AL -6.0 Y +36462 AL -6.0 Y +36467 AL -6.0 Y +36470 AL -6.0 Y +36471 AL -6.0 Y +36473 AL -6.0 Y +36474 AL -6.0 Y +36475 AL -6.0 Y +36476 AL -6.0 Y +36477 AL -6.0 Y +36480 AL -6.0 Y +36481 AL -6.0 Y +36482 AL -6.0 Y +36483 AL -6.0 Y +36501 AL -6.0 Y +36502 AL -6.0 Y +36503 AL -6.0 Y +36504 AL -6.0 Y +36505 AL -6.0 Y +36507 AL -6.0 Y +36509 AL -6.0 Y +36511 AL -6.0 Y +36512 AL -6.0 Y +36513 AL -6.0 Y +36515 AL -6.0 Y +36518 AL -6.0 Y +36521 AL -6.0 Y +36522 AL -6.0 Y +36523 AL -6.0 Y +36524 AL -6.0 Y +36525 AL -6.0 Y +36526 AL -6.0 Y +36527 AL -6.0 Y +36528 AL -6.0 Y +36529 AL -6.0 Y +36530 AL -6.0 Y +36532 AL -6.0 Y +36533 AL -6.0 Y +36535 AL -6.0 Y +36536 AL -6.0 Y +36538 AL -6.0 Y +36539 AL -6.0 Y +36540 AL -6.0 Y +36541 AL -6.0 Y +36542 AL -6.0 Y +36543 AL -6.0 Y +36544 AL -6.0 Y +36545 AL -6.0 Y +36547 AL -6.0 Y +36548 AL -6.0 Y +36549 AL -6.0 Y +36550 AL -6.0 Y +36551 AL -6.0 Y +36553 AL -6.0 Y +36555 AL -6.0 Y +36556 AL -6.0 Y +36558 AL -6.0 Y +36559 AL -6.0 Y +36560 AL -6.0 Y +36561 AL -6.0 Y +36562 AL -6.0 Y +36564 AL -6.0 Y +36567 AL -6.0 Y +36568 AL -6.0 Y +36569 AL -6.0 Y +36571 AL -6.0 Y +36572 AL -6.0 Y +36574 AL -6.0 Y +36575 AL -6.0 Y +36576 AL -6.0 Y +36577 AL -6.0 Y +36578 AL -6.0 Y +36579 AL -6.0 Y +36580 AL -6.0 Y +36581 AL -6.0 Y +36582 AL -6.0 Y +36583 AL -6.0 Y +36584 AL -6.0 Y +36585 AL -6.0 Y +36587 AL -6.0 Y +36590 AL -6.0 Y +36601 AL -6.0 Y +36602 AL -6.0 Y +36603 AL -6.0 Y +36604 AL -6.0 Y +36605 AL -6.0 Y +36606 AL -6.0 Y +36607 AL -6.0 Y +36608 AL -6.0 Y +36609 AL -6.0 Y +36610 AL -6.0 Y +36611 AL -6.0 Y +36612 AL -6.0 Y +36613 AL -6.0 Y +36615 AL -6.0 Y +36616 AL -6.0 Y +36617 AL -6.0 Y +36618 AL -6.0 Y +36619 AL -6.0 Y +36621 AL -6.0 Y +36622 AL -6.0 Y +36625 AL -6.0 Y +36628 AL -6.0 Y +36630 AL -6.0 Y +36633 AL -6.0 Y +36640 AL -6.0 Y +36641 AL -6.0 Y +36644 AL -6.0 Y +36652 AL -6.0 Y +36660 AL -6.0 Y +36663 AL -6.0 Y +36670 AL -6.0 Y +36671 AL -6.0 Y +36675 AL -6.0 Y +36685 AL -6.0 Y +36688 AL -6.0 Y +36689 AL -6.0 Y +36690 AL -6.0 Y +36691 AL -6.0 Y +36693 AL -6.0 Y +36695 AL -6.0 Y +36701 AL -6.0 Y +36702 AL -6.0 Y +36703 AL -6.0 Y +36720 AL -6.0 Y +36721 AL -6.0 Y +36722 AL -6.0 Y +36723 AL -6.0 Y +36726 AL -6.0 Y +36727 AL -6.0 Y +36728 AL -6.0 Y +36732 AL -6.0 Y +36736 AL -6.0 Y +36738 AL -6.0 Y +36740 AL -6.0 Y +36741 AL -6.0 Y +36742 AL -6.0 Y +36744 AL -6.0 Y +36745 AL -6.0 Y +36748 AL -6.0 Y +36749 AL -6.0 Y +36750 AL -6.0 Y +36751 AL -6.0 Y +36752 AL -6.0 Y +36753 AL -6.0 Y +36754 AL -6.0 Y +36756 AL -6.0 Y +36758 AL -6.0 Y +36759 AL -6.0 Y +36761 AL -6.0 Y +36762 AL -6.0 Y +36763 AL -6.0 Y +36764 AL -6.0 Y +36765 AL -6.0 Y +36766 AL -6.0 Y +36767 AL -6.0 Y +36768 AL -6.0 Y +36769 AL -6.0 Y +36773 AL -6.0 Y +36775 AL -6.0 Y +36776 AL -6.0 Y +36782 AL -6.0 Y +36783 AL -6.0 Y +36784 AL -6.0 Y +36785 AL -6.0 Y +36786 AL -6.0 Y +36790 AL -6.0 Y +36792 AL -6.0 Y +36793 AL -6.0 Y +36801 AL -6.0 Y +36802 AL -6.0 Y +36803 AL -6.0 Y +36804 AL -6.0 Y +36830 AL -6.0 Y +36831 AL -6.0 Y +36832 AL -6.0 Y +36849 AL -6.0 Y +36850 AL -6.0 Y +36851 AL -6.0 Y +36852 AL -6.0 Y +36853 AL -6.0 Y +36854 AL -6.0 Y +36855 AL -6.0 Y +36856 AL -6.0 Y +36858 AL -6.0 Y +36859 AL -6.0 Y +36860 AL -6.0 Y +36861 AL -6.0 Y +36862 AL -6.0 Y +36863 AL -6.0 Y +36865 AL -6.0 Y +36866 AL -6.0 Y +36867 AL -6.0 Y +36868 AL -6.0 Y +36869 AL -6.0 Y +36870 AL -6.0 Y +36871 AL -6.0 Y +36872 AL -6.0 Y +36874 AL -6.0 Y +36875 AL -6.0 Y +36877 AL -6.0 Y +36879 AL -6.0 Y +36901 AL -6.0 Y +36904 AL -6.0 Y +36907 AL -6.0 Y +36908 AL -6.0 Y +36910 AL -6.0 Y +36912 AL -6.0 Y +36913 AL -6.0 Y +36915 AL -6.0 Y +36916 AL -6.0 Y +36919 AL -6.0 Y +36921 AL -6.0 Y +36922 AL -6.0 Y +36925 AL -6.0 Y +37010 TN -6.0 Y +37011 TN -6.0 Y +37012 TN -6.0 Y +37013 TN -6.0 Y +37014 TN -6.0 Y +37015 TN -6.0 Y +37016 TN -6.0 Y +37018 TN -6.0 Y +37019 TN -6.0 Y +37020 TN -6.0 Y +37022 TN -6.0 Y +37023 TN -6.0 Y +37024 TN -6.0 Y +37025 TN -6.0 Y +37026 TN -6.0 Y +37027 TN -6.0 Y +37028 TN -6.0 Y +37029 TN -6.0 Y +37030 TN -6.0 Y +37031 TN -6.0 Y +37032 TN -6.0 Y +37033 TN -6.0 Y +37034 TN -6.0 Y +37035 TN -6.0 Y +37036 TN -6.0 Y +37037 TN -6.0 Y +37040 TN -6.0 Y +37041 TN -6.0 Y +37042 TN -6.0 Y +37043 TN -6.0 Y +37044 TN -6.0 Y +37046 TN -6.0 Y +37047 TN -6.0 Y +37048 TN -6.0 Y +37049 TN -6.0 Y +37050 TN -6.0 Y +37051 TN -6.0 Y +37052 TN -6.0 Y +37055 TN -6.0 Y +37056 TN -6.0 Y +37057 TN -6.0 Y +37058 TN -6.0 Y +37059 TN -6.0 Y +37060 TN -6.0 Y +37061 TN -6.0 Y +37062 TN -6.0 Y +37063 TN -6.0 Y +37064 TN -6.0 Y +37065 TN -6.0 Y +37066 TN -6.0 Y +37067 TN -6.0 Y +37068 TN -6.0 Y +37069 TN -6.0 Y +37070 TN -6.0 Y +37071 TN -6.0 Y +37072 TN -6.0 Y +37073 TN -6.0 Y +37074 TN -6.0 Y +37075 TN -6.0 Y +37076 TN -6.0 Y +37077 TN -6.0 Y +37078 TN -6.0 Y +37079 TN -6.0 Y +37080 TN -6.0 Y +37082 TN -6.0 Y +37083 TN -6.0 Y +37085 TN -6.0 Y +37086 TN -6.0 Y +37087 TN -6.0 Y +37088 TN -6.0 Y +37089 TN -6.0 Y +37090 TN -6.0 Y +37091 TN -6.0 Y +37095 TN -6.0 Y +37096 TN -6.0 Y +37097 TN -6.0 Y +37098 TN -6.0 Y +37101 TN -6.0 Y +37110 TN -6.0 Y +37111 TN -6.0 Y +37115 TN -6.0 Y +37116 TN -6.0 Y +37118 TN -6.0 Y +37119 TN -6.0 Y +37121 TN -6.0 Y +37122 TN -6.0 Y +37127 TN -6.0 Y +37128 TN -6.0 Y +37129 TN -6.0 Y +37130 TN -6.0 Y +37131 TN -6.0 Y +37132 TN -6.0 Y +37133 TN -6.0 Y +37134 TN -6.0 Y +37135 TN -6.0 Y +37136 TN -6.0 Y +37137 TN -6.0 Y +37138 TN -6.0 Y +37140 TN -6.0 Y +37141 TN -6.0 Y +37142 TN -6.0 Y +37143 TN -6.0 Y +37144 TN -6.0 Y +37145 TN -6.0 Y +37146 TN -6.0 Y +37148 TN -6.0 Y +37149 TN -6.0 Y +37150 TN -6.0 Y +37151 TN -6.0 Y +37152 TN -6.0 Y +37153 TN -6.0 Y +37160 TN -6.0 Y +37161 TN -6.0 Y +37162 TN -6.0 Y +37165 TN -6.0 Y +37166 TN -6.0 Y +37167 TN -6.0 Y +37171 TN -6.0 Y +37172 TN -6.0 Y +37174 TN -6.0 Y +37175 TN -6.0 Y +37178 TN -6.0 Y +37179 TN -6.0 Y +37180 TN -6.0 Y +37181 TN -6.0 Y +37183 TN -6.0 Y +37184 TN -6.0 Y +37185 TN -6.0 Y +37186 TN -6.0 Y +37187 TN -6.0 Y +37188 TN -6.0 Y +37189 TN -6.0 Y +37190 TN -6.0 Y +37191 TN -6.0 Y +37201 TN -6.0 Y +37202 TN -6.0 Y +37203 TN -6.0 Y +37204 TN -6.0 Y +37205 TN -6.0 Y +37206 TN -6.0 Y +37207 TN -6.0 Y +37208 TN -6.0 Y +37209 TN -6.0 Y +37210 TN -6.0 Y +37211 TN -6.0 Y +37212 TN -6.0 Y +37213 TN -6.0 Y +37214 TN -6.0 Y +37215 TN -6.0 Y +37216 TN -6.0 Y +37217 TN -6.0 Y +37218 TN -6.0 Y +37219 TN -6.0 Y +37220 TN -6.0 Y +37221 TN -6.0 Y +37222 TN -6.0 Y +37224 TN -6.0 Y +37227 TN -6.0 Y +37228 TN -6.0 Y +37229 TN -6.0 Y +37230 TN -6.0 Y +37232 TN -6.0 Y +37234 TN -6.0 Y +37235 TN -6.0 Y +37236 TN -6.0 Y +37237 TN -6.0 Y +37238 TN -6.0 Y +37240 TN -6.0 Y +37241 TN -6.0 Y +37242 TN -6.0 Y +37243 TN -6.0 Y +37244 TN -6.0 Y +37245 TN -6.0 Y +37246 TN -6.0 Y +37247 TN -6.0 Y +37248 TN -6.0 Y +37249 TN -6.0 Y +37250 TN -6.0 Y +37301 TN -6.0 Y +37302 TN -5.0 Y +37303 TN -5.0 Y +37304 TN -5.0 Y +37305 TN -6.0 Y +37306 TN -6.0 Y +37307 TN -5.0 Y +37308 TN -5.0 Y +37309 TN -5.0 Y +37310 TN -5.0 Y +37311 TN -5.0 Y +37312 TN -5.0 Y +37313 TN -6.0 Y +37314 TN -5.0 Y +37315 TN -5.0 Y +37316 TN -5.0 Y +37317 TN -5.0 Y +37318 TN -6.0 Y +37320 TN -5.0 Y +37321 TN -5.0 Y +37322 TN -5.0 Y +37323 TN -5.0 Y +37324 TN -6.0 Y +37325 TN -5.0 Y +37326 TN -5.0 Y +37327 TN -6.0 Y +37328 TN -6.0 Y +37329 TN -5.0 Y +37330 TN -6.0 Y +37331 TN -5.0 Y +37332 TN -5.0 Y +37333 TN -5.0 Y +37334 TN -6.0 Y +37335 TN -6.0 Y +37336 TN -5.0 Y +37337 TN -5.0 Y +37338 TN -5.0 Y +37339 TN -6.0 Y +37340 TN -6.0 Y +37341 TN -5.0 Y +37342 TN -6.0 Y +37343 TN -5.0 Y +37345 TN -6.0 Y +37347 TN -6.0 Y +37348 TN -6.0 Y +37349 TN -6.0 Y +37350 TN -5.0 Y +37351 TN -5.0 Y +37352 TN -6.0 Y +37353 TN -5.0 Y +37354 TN -5.0 Y +37355 TN -6.0 Y +37356 TN -6.0 Y +37357 TN -6.0 Y +37359 TN -6.0 Y +37360 TN -6.0 Y +37361 TN -5.0 Y +37362 TN -5.0 Y +37363 TN -5.0 Y +37364 TN -5.0 Y +37365 TN -6.0 Y +37366 TN -6.0 Y +37367 TN -6.0 Y +37369 TN -5.0 Y +37370 TN -5.0 Y +37371 TN -5.0 Y +37373 TN -5.0 Y +37374 TN -6.0 Y +37375 TN -6.0 Y +37376 TN -6.0 Y +37377 TN -5.0 Y +37378 TN -6.0 Y +37379 TN -5.0 Y +37380 TN -6.0 Y +37381 TN -5.0 Y +37382 TN -6.0 Y +37383 TN -6.0 Y +37384 TN -5.0 Y +37385 TN -5.0 Y +37387 TN -6.0 Y +37388 TN -6.0 Y +37389 TN -6.0 Y +37391 TN -5.0 Y +37394 TN -6.0 Y +37396 TN -6.0 Y +37397 TN -6.0 Y +37398 TN -6.0 Y +37401 TN -5.0 Y +37402 TN -5.0 Y +37403 TN -5.0 Y +37404 TN -5.0 Y +37405 TN -5.0 Y +37406 TN -5.0 Y +37407 TN -5.0 Y +37408 TN -5.0 Y +37409 TN -5.0 Y +37410 TN -5.0 Y +37411 TN -5.0 Y +37412 TN -5.0 Y +37414 TN -5.0 Y +37415 TN -5.0 Y +37416 TN -5.0 Y +37419 TN -5.0 Y +37421 TN -5.0 Y +37422 TN -5.0 Y +37424 TN -5.0 Y +37450 TN -5.0 Y +37501 TN -6.0 Y +37544 TN -6.0 Y +37601 TN -5.0 Y +37602 TN -5.0 Y +37604 TN -5.0 Y +37605 TN -5.0 Y +37614 TN -5.0 Y +37615 TN -5.0 Y +37616 TN -5.0 Y +37617 TN -5.0 Y +37618 TN -5.0 Y +37620 TN -5.0 Y +37621 TN -5.0 Y +37625 TN -5.0 Y +37640 TN -5.0 Y +37641 TN -5.0 Y +37642 TN -5.0 Y +37643 TN -5.0 Y +37644 TN -5.0 Y +37645 TN -5.0 Y +37650 TN -5.0 Y +37656 TN -5.0 Y +37657 TN -5.0 Y +37658 TN -5.0 Y +37659 TN -5.0 Y +37660 TN -5.0 Y +37662 TN -5.0 Y +37663 TN -5.0 Y +37664 TN -5.0 Y +37665 TN -5.0 Y +37669 TN -5.0 Y +37680 TN -5.0 Y +37681 TN -5.0 Y +37682 TN -5.0 Y +37683 TN -5.0 Y +37684 TN -5.0 Y +37686 TN -5.0 Y +37687 TN -5.0 Y +37688 TN -5.0 Y +37690 TN -5.0 Y +37691 TN -5.0 Y +37692 TN -5.0 Y +37694 TN -5.0 Y +37699 TN -5.0 Y +37701 TN -5.0 Y +37705 TN -5.0 Y +37707 TN -5.0 Y +37708 TN -5.0 Y +37709 TN -5.0 Y +37710 TN -5.0 Y +37711 TN -5.0 Y +37713 TN -5.0 Y +37714 TN -5.0 Y +37715 TN -5.0 Y +37716 TN -5.0 Y +37717 TN -5.0 Y +37719 TN -5.0 Y +37721 TN -5.0 Y +37722 TN -5.0 Y +37723 TN -6.0 Y +37724 TN -5.0 Y +37725 TN -5.0 Y +37726 TN -5.0 Y +37727 TN -5.0 Y +37729 TN -5.0 Y +37730 TN -5.0 Y +37731 TN -5.0 Y +37732 TN -5.0 Y +37733 TN -5.0 Y +37737 TN -5.0 Y +37738 TN -5.0 Y +37742 TN -5.0 Y +37743 TN -5.0 Y +37744 TN -5.0 Y +37745 TN -5.0 Y +37748 TN -5.0 Y +37752 TN -5.0 Y +37753 TN -5.0 Y +37754 TN -5.0 Y +37755 TN -5.0 Y +37756 TN -5.0 Y +37757 TN -5.0 Y +37760 TN -5.0 Y +37762 TN -5.0 Y +37763 TN -5.0 Y +37764 TN -5.0 Y +37765 TN -5.0 Y +37766 TN -5.0 Y +37769 TN -5.0 Y +37770 TN -5.0 Y +37771 TN -5.0 Y +37772 TN -5.0 Y +37773 TN -5.0 Y +37774 TN -5.0 Y +37777 TN -5.0 Y +37778 TN -5.0 Y +37779 TN -5.0 Y +37801 TN -5.0 Y +37802 TN -5.0 Y +37803 TN -5.0 Y +37804 TN -5.0 Y +37806 TN -5.0 Y +37807 TN -5.0 Y +37809 TN -5.0 Y +37810 TN -5.0 Y +37811 TN -5.0 Y +37813 TN -5.0 Y +37814 TN -5.0 Y +37815 TN -5.0 Y +37816 TN -5.0 Y +37818 TN -5.0 Y +37819 TN -5.0 Y +37820 TN -5.0 Y +37821 TN -5.0 Y +37822 TN -5.0 Y +37824 TN -5.0 Y +37825 TN -5.0 Y +37826 TN -5.0 Y +37828 TN -5.0 Y +37829 TN -5.0 Y +37830 TN -5.0 Y +37831 TN -5.0 Y +37840 TN -5.0 Y +37841 TN -5.0 Y +37843 TN -5.0 Y +37845 TN -5.0 Y +37846 TN -5.0 Y +37847 TN -5.0 Y +37848 TN -5.0 Y +37849 TN -5.0 Y +37851 TN -5.0 Y +37852 TN -5.0 Y +37853 TN -5.0 Y +37854 TN -5.0 Y +37857 TN -5.0 Y +37860 TN -5.0 Y +37861 TN -5.0 Y +37862 TN -5.0 Y +37863 TN -5.0 Y +37864 TN -5.0 Y +37865 TN -5.0 Y +37866 TN -5.0 Y +37867 TN -5.0 Y +37868 TN -5.0 Y +37869 TN -5.0 Y +37870 TN -5.0 Y +37871 TN -5.0 Y +37872 TN -5.0 Y +37873 TN -5.0 Y +37874 TN -5.0 Y +37876 TN -5.0 Y +37877 TN -5.0 Y +37878 TN -5.0 Y +37879 TN -5.0 Y +37880 TN -5.0 Y +37881 TN -5.0 Y +37882 TN -5.0 Y +37885 TN -5.0 Y +37886 TN -5.0 Y +37887 TN -5.0 Y +37888 TN -5.0 Y +37890 TN -5.0 Y +37891 TN -5.0 Y +37892 TN -5.0 Y +37901 TN -5.0 Y +37902 TN -5.0 Y +37909 TN -5.0 Y +37912 TN -5.0 Y +37914 TN -5.0 Y +37915 TN -5.0 Y +37916 TN -5.0 Y +37917 TN -5.0 Y +37918 TN -5.0 Y +37919 TN -5.0 Y +37920 TN -5.0 Y +37921 TN -5.0 Y +37922 TN -5.0 Y +37923 TN -5.0 Y +37924 TN -5.0 Y +37927 TN -5.0 Y +37928 TN -5.0 Y +37929 TN -5.0 Y +37930 TN -5.0 Y +37931 TN -5.0 Y +37932 TN -5.0 Y +37933 TN -5.0 Y +37934 TN -5.0 Y +37938 TN -5.0 Y +37939 TN -5.0 Y +37940 TN -5.0 Y +37950 TN -5.0 Y +37990 TN -5.0 Y +37995 TN -5.0 Y +37996 TN -5.0 Y +37997 TN -5.0 Y +37998 TN -5.0 Y +38001 TN -6.0 Y +38002 TN -6.0 Y +38004 TN -6.0 Y +38006 TN -6.0 Y +38007 TN -6.0 Y +38008 TN -6.0 Y +38010 TN -6.0 Y +38011 TN -6.0 Y +38012 TN -6.0 Y +38014 TN -6.0 Y +38015 TN -6.0 Y +38016 TN -6.0 Y +38017 TN -6.0 Y +38018 TN -6.0 Y +38019 TN -6.0 Y +38021 TN -6.0 Y +38023 TN -6.0 Y +38024 TN -6.0 Y +38025 TN -6.0 Y +38027 TN -6.0 Y +38028 TN -6.0 Y +38029 TN -6.0 Y +38030 TN -6.0 Y +38034 TN -6.0 Y +38036 TN -6.0 Y +38037 TN -6.0 Y +38039 TN -6.0 Y +38040 TN -6.0 Y +38041 TN -6.0 Y +38042 TN -6.0 Y +38044 TN -6.0 Y +38045 TN -6.0 Y +38046 TN -6.0 Y +38047 TN -6.0 Y +38048 TN -6.0 Y +38049 TN -6.0 Y +38050 TN -6.0 Y +38052 TN -6.0 Y +38053 TN -6.0 Y +38054 TN -6.0 Y +38055 TN -6.0 Y +38057 TN -6.0 Y +38058 TN -6.0 Y +38059 TN -6.0 Y +38060 TN -6.0 Y +38061 TN -6.0 Y +38063 TN -6.0 Y +38066 TN -6.0 Y +38067 TN -6.0 Y +38068 TN -6.0 Y +38069 TN -6.0 Y +38070 TN -6.0 Y +38071 TN -6.0 Y +38075 TN -6.0 Y +38076 TN -6.0 Y +38077 TN -6.0 Y +38079 TN -6.0 Y +38080 TN -6.0 Y +38083 TN -6.0 Y +38088 TN -6.0 Y +38101 TN -6.0 Y +38103 TN -6.0 Y +38104 TN -6.0 Y +38105 TN -6.0 Y +38106 TN -6.0 Y +38107 TN -6.0 Y +38108 TN -6.0 Y +38109 TN -6.0 Y +38110 TN -6.0 Y +38111 TN -6.0 Y +38112 TN -6.0 Y +38113 TN -6.0 Y +38114 TN -6.0 Y +38115 TN -6.0 Y +38116 TN -6.0 Y +38117 TN -6.0 Y +38118 TN -6.0 Y +38119 TN -6.0 Y +38120 TN -6.0 Y +38122 TN -6.0 Y +38124 TN -6.0 Y +38125 TN -6.0 Y +38126 TN -6.0 Y +38127 TN -6.0 Y +38128 TN -6.0 Y +38130 TN -6.0 Y +38131 TN -6.0 Y +38132 TN -6.0 Y +38133 TN -6.0 Y +38134 TN -6.0 Y +38135 TN -6.0 Y +38136 TN -6.0 Y +38137 TN -6.0 Y +38138 TN -6.0 Y +38139 TN -6.0 Y +38141 TN -6.0 Y +38142 TN -6.0 Y +38145 TN -6.0 Y +38147 TN -6.0 Y +38148 TN -6.0 Y +38150 TN -6.0 Y +38151 TN -6.0 Y +38152 TN -6.0 Y +38157 TN -6.0 Y +38159 TN -6.0 Y +38161 TN -6.0 Y +38163 TN -6.0 Y +38165 TN -6.0 Y +38166 TN -6.0 Y +38167 TN -6.0 Y +38168 TN -6.0 Y +38173 TN -6.0 Y +38174 TN -6.0 Y +38175 TN -6.0 Y +38177 TN -6.0 Y +38181 TN -6.0 Y +38182 TN -6.0 Y +38183 TN -6.0 Y +38184 TN -6.0 Y +38186 TN -6.0 Y +38187 TN -6.0 Y +38188 TN -6.0 Y +38190 TN -6.0 Y +38193 TN -6.0 Y +38194 TN -6.0 Y +38197 TN -6.0 Y +38201 TN -6.0 Y +38220 TN -6.0 Y +38221 TN -6.0 Y +38222 TN -6.0 Y +38223 TN -6.0 Y +38224 TN -6.0 Y +38225 TN -6.0 Y +38226 TN -6.0 Y +38229 TN -6.0 Y +38230 TN -6.0 Y +38231 TN -6.0 Y +38232 TN -6.0 Y +38233 TN -6.0 Y +38235 TN -6.0 Y +38236 TN -6.0 Y +38237 TN -6.0 Y +38238 TN -6.0 Y +38240 TN -6.0 Y +38241 TN -6.0 Y +38242 TN -6.0 Y +38251 TN -6.0 Y +38253 TN -6.0 Y +38254 TN -6.0 Y +38255 TN -6.0 Y +38256 TN -6.0 Y +38257 TN -6.0 Y +38258 TN -6.0 Y +38259 TN -6.0 Y +38260 TN -6.0 Y +38261 TN -6.0 Y +38271 TN -6.0 Y +38281 TN -6.0 Y +38301 TN -6.0 Y +38302 TN -6.0 Y +38303 TN -6.0 Y +38305 TN -6.0 Y +38308 TN -6.0 Y +38310 TN -6.0 Y +38311 TN -6.0 Y +38313 TN -6.0 Y +38314 TN -6.0 Y +38315 TN -6.0 Y +38316 TN -6.0 Y +38317 TN -6.0 Y +38318 TN -6.0 Y +38320 TN -6.0 Y +38321 TN -6.0 Y +38324 TN -6.0 Y +38326 TN -6.0 Y +38327 TN -6.0 Y +38328 TN -6.0 Y +38329 TN -6.0 Y +38330 TN -6.0 Y +38331 TN -6.0 Y +38332 TN -6.0 Y +38333 TN -6.0 Y +38334 TN -6.0 Y +38336 TN -6.0 Y +38337 TN -6.0 Y +38338 TN -6.0 Y +38339 TN -6.0 Y +38340 TN -6.0 Y +38341 TN -6.0 Y +38342 TN -6.0 Y +38343 TN -6.0 Y +38344 TN -6.0 Y +38345 TN -6.0 Y +38346 TN -6.0 Y +38347 TN -6.0 Y +38348 TN -6.0 Y +38351 TN -6.0 Y +38352 TN -6.0 Y +38355 TN -6.0 Y +38356 TN -6.0 Y +38357 TN -6.0 Y +38358 TN -6.0 Y +38359 TN -6.0 Y +38361 TN -6.0 Y +38362 TN -6.0 Y +38363 TN -6.0 Y +38365 TN -6.0 Y +38366 TN -6.0 Y +38367 TN -6.0 Y +38368 TN -6.0 Y +38369 TN -6.0 Y +38370 TN -6.0 Y +38371 TN -6.0 Y +38372 TN -6.0 Y +38374 TN -6.0 Y +38375 TN -6.0 Y +38376 TN -6.0 Y +38377 TN -6.0 Y +38378 TN -6.0 Y +38379 TN -6.0 Y +38380 TN -6.0 Y +38381 TN -6.0 Y +38382 TN -6.0 Y +38387 TN -6.0 Y +38388 TN -6.0 Y +38389 TN -6.0 Y +38390 TN -6.0 Y +38391 TN -6.0 Y +38392 TN -6.0 Y +38393 TN -6.0 Y +38401 TN -6.0 Y +38402 TN -6.0 Y +38425 TN -6.0 Y +38449 TN -6.0 Y +38450 TN -6.0 Y +38451 TN -6.0 Y +38452 TN -6.0 Y +38453 TN -6.0 Y +38454 TN -6.0 Y +38455 TN -6.0 Y +38456 TN -6.0 Y +38457 TN -6.0 Y +38459 TN -6.0 Y +38460 TN -6.0 Y +38461 TN -6.0 Y +38462 TN -6.0 Y +38463 TN -6.0 Y +38464 TN -6.0 Y +38468 TN -6.0 Y +38469 TN -6.0 Y +38471 TN -6.0 Y +38472 TN -6.0 Y +38473 TN -6.0 Y +38474 TN -6.0 Y +38475 TN -6.0 Y +38476 TN -6.0 Y +38477 TN -6.0 Y +38478 TN -6.0 Y +38481 TN -6.0 Y +38482 TN -6.0 Y +38483 TN -6.0 Y +38485 TN -6.0 Y +38486 TN -6.0 Y +38487 TN -6.0 Y +38488 TN -6.0 Y +38501 TN -6.0 Y +38502 TN -6.0 Y +38503 TN -6.0 Y +38504 TN -6.0 Y +38505 TN -6.0 Y +38506 TN -6.0 Y +38541 TN -6.0 Y +38542 TN -6.0 Y +38543 TN -6.0 Y +38544 TN -6.0 Y +38545 TN -6.0 Y +38547 TN -6.0 Y +38548 TN -6.0 Y +38549 TN -6.0 Y +38550 TN -6.0 Y +38551 TN -6.0 Y +38552 TN -6.0 Y +38553 TN -6.0 Y +38554 TN -6.0 Y +38555 TN -6.0 Y +38556 TN -6.0 Y +38557 TN -6.0 Y +38558 TN -6.0 Y +38559 TN -6.0 Y +38560 TN -6.0 Y +38562 TN -6.0 Y +38563 TN -6.0 Y +38564 TN -6.0 Y +38565 TN -6.0 Y +38567 TN -6.0 Y +38568 TN -6.0 Y +38569 TN -6.0 Y +38570 TN -6.0 Y +38571 TN -6.0 Y +38572 TN -6.0 Y +38573 TN -6.0 Y +38574 TN -6.0 Y +38575 TN -6.0 Y +38577 TN -6.0 Y +38578 TN -6.0 Y +38579 TN -6.0 Y +38580 TN -6.0 Y +38581 TN -6.0 Y +38582 TN -6.0 Y +38583 TN -6.0 Y +38585 TN -6.0 Y +38587 TN -6.0 Y +38588 TN -6.0 Y +38589 TN -6.0 Y +38601 MS -6.0 Y +38602 MS -6.0 Y +38603 MS -6.0 Y +38606 MS -6.0 Y +38609 MS -6.0 Y +38610 MS -6.0 Y +38611 MS -6.0 Y +38614 MS -6.0 Y +38617 MS -6.0 Y +38618 MS -6.0 Y +38619 MS -6.0 Y +38620 MS -6.0 Y +38621 MS -6.0 Y +38622 MS -6.0 Y +38623 MS -6.0 Y +38625 MS -6.0 Y +38626 MS -6.0 Y +38627 MS -6.0 Y +38628 MS -6.0 Y +38629 MS -6.0 Y +38630 MS -6.0 Y +38631 MS -6.0 Y +38632 MS -6.0 Y +38633 MS -6.0 Y +38634 MS -6.0 Y +38635 MS -6.0 Y +38637 MS -6.0 Y +38638 MS -6.0 Y +38639 MS -6.0 Y +38641 MS -6.0 Y +38642 MS -6.0 Y +38643 MS -6.0 Y +38644 MS -6.0 Y +38645 MS -6.0 Y +38646 MS -6.0 Y +38647 MS -6.0 Y +38649 MS -6.0 Y +38650 MS -6.0 Y +38651 MS -6.0 Y +38652 MS -6.0 Y +38654 MS -6.0 Y +38655 MS -6.0 Y +38658 MS -6.0 Y +38659 MS -6.0 Y +38661 MS -6.0 Y +38663 MS -6.0 Y +38664 MS -6.0 Y +38665 MS -6.0 Y +38666 MS -6.0 Y +38668 MS -6.0 Y +38669 MS -6.0 Y +38670 MS -6.0 Y +38671 MS -6.0 Y +38672 MS -6.0 Y +38673 MS -6.0 Y +38674 MS -6.0 Y +38675 MS -6.0 Y +38676 MS -6.0 Y +38677 MS -6.0 Y +38679 MS -6.0 Y +38680 MS -6.0 Y +38683 MS -6.0 Y +38685 MS -6.0 Y +38686 MS -6.0 Y +38701 MS -6.0 Y +38702 MS -6.0 Y +38703 MS -6.0 Y +38704 MS -6.0 Y +38720 MS -6.0 Y +38721 MS -6.0 Y +38722 MS -6.0 Y +38723 MS -6.0 Y +38725 MS -6.0 Y +38726 MS -6.0 Y +38730 MS -6.0 Y +38731 MS -6.0 Y +38732 MS -6.0 Y +38733 MS -6.0 Y +38736 MS -6.0 Y +38737 MS -6.0 Y +38738 MS -6.0 Y +38739 MS -6.0 Y +38740 MS -6.0 Y +38744 MS -6.0 Y +38745 MS -6.0 Y +38746 MS -6.0 Y +38748 MS -6.0 Y +38749 MS -6.0 Y +38751 MS -6.0 Y +38753 MS -6.0 Y +38754 MS -6.0 Y +38756 MS -6.0 Y +38759 MS -6.0 Y +38760 MS -6.0 Y +38761 MS -6.0 Y +38762 MS -6.0 Y +38764 MS -6.0 Y +38765 MS -6.0 Y +38767 MS -6.0 Y +38768 MS -6.0 Y +38769 MS -6.0 Y +38771 MS -6.0 Y +38772 MS -6.0 Y +38773 MS -6.0 Y +38774 MS -6.0 Y +38776 MS -6.0 Y +38778 MS -6.0 Y +38780 MS -6.0 Y +38781 MS -6.0 Y +38782 MS -6.0 Y +38801 MS -6.0 Y +38802 MS -6.0 Y +38803 MS -6.0 Y +38804 MS -6.0 Y +38820 MS -6.0 Y +38821 MS -6.0 Y +38824 MS -6.0 Y +38825 MS -6.0 Y +38826 MS -6.0 Y +38827 MS -6.0 Y +38828 MS -6.0 Y +38829 MS -6.0 Y +38833 MS -6.0 Y +38834 MS -6.0 Y +38835 MS -6.0 Y +38838 MS -6.0 Y +38839 MS -6.0 Y +38841 MS -6.0 Y +38843 MS -6.0 Y +38844 MS -6.0 Y +38846 MS -6.0 Y +38847 MS -6.0 Y +38848 MS -6.0 Y +38849 MS -6.0 Y +38850 MS -6.0 Y +38851 MS -6.0 Y +38852 MS -6.0 Y +38855 MS -6.0 Y +38856 MS -6.0 Y +38857 MS -6.0 Y +38858 MS -6.0 Y +38859 MS -6.0 Y +38860 MS -6.0 Y +38862 MS -6.0 Y +38863 MS -6.0 Y +38864 MS -6.0 Y +38865 MS -6.0 Y +38866 MS -6.0 Y +38868 MS -6.0 Y +38869 MS -6.0 Y +38870 MS -6.0 Y +38871 MS -6.0 Y +38873 MS -6.0 Y +38874 MS -6.0 Y +38875 MS -6.0 Y +38876 MS -6.0 Y +38877 MS -6.0 Y +38878 MS -6.0 Y +38879 MS -6.0 Y +38880 MS -6.0 Y +38901 MS -6.0 Y +38902 MS -6.0 Y +38913 MS -6.0 Y +38914 MS -6.0 Y +38915 MS -6.0 Y +38916 MS -6.0 Y +38917 MS -6.0 Y +38920 MS -6.0 Y +38921 MS -6.0 Y +38922 MS -6.0 Y +38923 MS -6.0 Y +38924 MS -6.0 Y +38925 MS -6.0 Y +38926 MS -6.0 Y +38927 MS -6.0 Y +38928 MS -6.0 Y +38929 MS -6.0 Y +38930 MS -6.0 Y +38935 MS -6.0 Y +38940 MS -6.0 Y +38941 MS -6.0 Y +38943 MS -6.0 Y +38944 MS -6.0 Y +38945 MS -6.0 Y +38946 MS -6.0 Y +38947 MS -6.0 Y +38948 MS -6.0 Y +38949 MS -6.0 Y +38950 MS -6.0 Y +38951 MS -6.0 Y +38952 MS -6.0 Y +38953 MS -6.0 Y +38954 MS -6.0 Y +38955 MS -6.0 Y +38957 MS -6.0 Y +38958 MS -6.0 Y +38959 MS -6.0 Y +38960 MS -6.0 Y +38961 MS -6.0 Y +38962 MS -6.0 Y +38963 MS -6.0 Y +38964 MS -6.0 Y +38965 MS -6.0 Y +38966 MS -6.0 Y +38967 MS -6.0 Y +39038 MS -6.0 Y +39039 MS -6.0 Y +39040 MS -6.0 Y +39041 MS -6.0 Y +39042 MS -6.0 Y +39043 MS -6.0 Y +39044 MS -6.0 Y +39045 MS -6.0 Y +39046 MS -6.0 Y +39047 MS -6.0 Y +39051 MS -6.0 Y +39054 MS -6.0 Y +39056 MS -6.0 Y +39057 MS -6.0 Y +39058 MS -6.0 Y +39059 MS -6.0 Y +39060 MS -6.0 Y +39061 MS -6.0 Y +39062 MS -6.0 Y +39063 MS -6.0 Y +39066 MS -6.0 Y +39067 MS -6.0 Y +39069 MS -6.0 Y +39071 MS -6.0 Y +39072 MS -6.0 Y +39073 MS -6.0 Y +39074 MS -6.0 Y +39077 MS -6.0 Y +39078 MS -6.0 Y +39079 MS -6.0 Y +39080 MS -6.0 Y +39081 MS -6.0 Y +39082 MS -6.0 Y +39083 MS -6.0 Y +39086 MS -6.0 Y +39087 MS -6.0 Y +39088 MS -6.0 Y +39090 MS -6.0 Y +39092 MS -6.0 Y +39094 MS -6.0 Y +39095 MS -6.0 Y +39096 MS -6.0 Y +39097 MS -6.0 Y +39098 MS -6.0 Y +39107 MS -6.0 Y +39108 MS -6.0 Y +39109 MS -6.0 Y +39110 MS -6.0 Y +39111 MS -6.0 Y +39113 MS -6.0 Y +39114 MS -6.0 Y +39115 MS -6.0 Y +39116 MS -6.0 Y +39117 MS -6.0 Y +39119 MS -6.0 Y +39120 MS -6.0 Y +39121 MS -6.0 Y +39122 MS -6.0 Y +39130 MS -6.0 Y +39140 MS -6.0 Y +39144 MS -6.0 Y +39145 MS -6.0 Y +39146 MS -6.0 Y +39148 MS -6.0 Y +39149 MS -6.0 Y +39150 MS -6.0 Y +39151 MS -6.0 Y +39152 MS -6.0 Y +39153 MS -6.0 Y +39154 MS -6.0 Y +39156 MS -6.0 Y +39157 MS -6.0 Y +39158 MS -6.0 Y +39159 MS -6.0 Y +39160 MS -6.0 Y +39161 MS -6.0 Y +39162 MS -6.0 Y +39163 MS -6.0 Y +39165 MS -6.0 Y +39166 MS -6.0 Y +39167 MS -6.0 Y +39168 MS -6.0 Y +39169 MS -6.0 Y +39170 MS -6.0 Y +39171 MS -6.0 Y +39173 MS -6.0 Y +39174 MS -6.0 Y +39175 MS -6.0 Y +39176 MS -6.0 Y +39177 MS -6.0 Y +39179 MS -6.0 Y +39180 MS -6.0 Y +39181 MS -6.0 Y +39182 MS -6.0 Y +39183 MS -6.0 Y +39189 MS -6.0 Y +39190 MS -6.0 Y +39191 MS -6.0 Y +39192 MS -6.0 Y +39193 MS -6.0 Y +39194 MS -6.0 Y +39201 MS -6.0 Y +39202 MS -6.0 Y +39203 MS -6.0 Y +39204 MS -6.0 Y +39205 MS -6.0 Y +39206 MS -6.0 Y +39207 MS -6.0 Y +39208 MS -6.0 Y +39209 MS -6.0 Y +39210 MS -6.0 Y +39211 MS -6.0 Y +39212 MS -6.0 Y +39213 MS -6.0 Y +39215 MS -6.0 Y +39216 MS -6.0 Y +39217 MS -6.0 Y +39218 MS -6.0 Y +39225 MS -6.0 Y +39232 MS -6.0 Y +39235 MS -6.0 Y +39236 MS -6.0 Y +39250 MS -6.0 Y +39269 MS -6.0 Y +39271 MS -6.0 Y +39272 MS -6.0 Y +39282 MS -6.0 Y +39283 MS -6.0 Y +39284 MS -6.0 Y +39286 MS -6.0 Y +39288 MS -6.0 Y +39289 MS -6.0 Y +39296 MS -6.0 Y +39298 MS -6.0 Y +39301 MS -6.0 Y +39302 MS -6.0 Y +39303 MS -6.0 Y +39304 MS -6.0 Y +39305 MS -6.0 Y +39307 MS -6.0 Y +39309 MS -6.0 Y +39320 MS -6.0 Y +39322 MS -6.0 Y +39323 MS -6.0 Y +39324 MS -6.0 Y +39325 MS -6.0 Y +39326 MS -6.0 Y +39327 MS -6.0 Y +39328 MS -6.0 Y +39330 MS -6.0 Y +39332 MS -6.0 Y +39335 MS -6.0 Y +39336 MS -6.0 Y +39337 MS -6.0 Y +39338 MS -6.0 Y +39339 MS -6.0 Y +39341 MS -6.0 Y +39342 MS -6.0 Y +39345 MS -6.0 Y +39346 MS -6.0 Y +39347 MS -6.0 Y +39348 MS -6.0 Y +39350 MS -6.0 Y +39352 MS -6.0 Y +39354 MS -6.0 Y +39355 MS -6.0 Y +39356 MS -6.0 Y +39358 MS -6.0 Y +39359 MS -6.0 Y +39360 MS -6.0 Y +39361 MS -6.0 Y +39362 MS -6.0 Y +39363 MS -6.0 Y +39364 MS -6.0 Y +39365 MS -6.0 Y +39366 MS -6.0 Y +39367 MS -6.0 Y +39401 MS -6.0 Y +39402 MS -6.0 Y +39403 MS -6.0 Y +39404 MS -6.0 Y +39406 MS -6.0 Y +39407 MS -6.0 Y +39421 MS -6.0 Y +39422 MS -6.0 Y +39423 MS -6.0 Y +39425 MS -6.0 Y +39426 MS -6.0 Y +39427 MS -6.0 Y +39428 MS -6.0 Y +39429 MS -6.0 Y +39436 MS -6.0 Y +39437 MS -6.0 Y +39439 MS -6.0 Y +39440 MS -6.0 Y +39441 MS -6.0 Y +39442 MS -6.0 Y +39443 MS -6.0 Y +39451 MS -6.0 Y +39452 MS -6.0 Y +39455 MS -6.0 Y +39456 MS -6.0 Y +39457 MS -6.0 Y +39459 MS -6.0 Y +39460 MS -6.0 Y +39461 MS -6.0 Y +39462 MS -6.0 Y +39463 MS -6.0 Y +39464 MS -6.0 Y +39465 MS -6.0 Y +39466 MS -6.0 Y +39470 MS -6.0 Y +39474 MS -6.0 Y +39475 MS -6.0 Y +39476 MS -6.0 Y +39477 MS -6.0 Y +39478 MS -6.0 Y +39479 MS -6.0 Y +39480 MS -6.0 Y +39481 MS -6.0 Y +39482 MS -6.0 Y +39483 MS -6.0 Y +39501 MS -6.0 Y +39502 MS -6.0 Y +39503 MS -6.0 Y +39505 MS -6.0 Y +39506 MS -6.0 Y +39507 MS -6.0 Y +39520 MS -6.0 Y +39521 MS -6.0 Y +39522 MS -6.0 Y +39525 MS -6.0 Y +39529 MS -6.0 Y +39530 MS -6.0 Y +39531 MS -6.0 Y +39532 MS -6.0 Y +39533 MS -6.0 Y +39534 MS -6.0 Y +39535 MS -6.0 Y +39540 MS -6.0 Y +39552 MS -6.0 Y +39553 MS -6.0 Y +39555 MS -6.0 Y +39556 MS -6.0 Y +39558 MS -6.0 Y +39560 MS -6.0 Y +39561 MS -6.0 Y +39562 MS -6.0 Y +39563 MS -6.0 Y +39564 MS -6.0 Y +39565 MS -6.0 Y +39566 MS -6.0 Y +39567 MS -6.0 Y +39568 MS -6.0 Y +39569 MS -6.0 Y +39571 MS -6.0 Y +39572 MS -6.0 Y +39573 MS -6.0 Y +39574 MS -6.0 Y +39576 MS -6.0 Y +39577 MS -6.0 Y +39581 MS -6.0 Y +39595 MS -6.0 Y +39601 MS -6.0 Y +39602 MS -6.0 Y +39603 MS -6.0 Y +39629 MS -6.0 Y +39630 MS -6.0 Y +39631 MS -6.0 Y +39632 MS -6.0 Y +39633 MS -6.0 Y +39635 MS -6.0 Y +39638 MS -6.0 Y +39641 MS -6.0 Y +39643 MS -6.0 Y +39645 MS -6.0 Y +39647 MS -6.0 Y +39648 MS -6.0 Y +39649 MS -6.0 Y +39652 MS -6.0 Y +39653 MS -6.0 Y +39654 MS -6.0 Y +39656 MS -6.0 Y +39657 MS -6.0 Y +39661 MS -6.0 Y +39662 MS -6.0 Y +39663 MS -6.0 Y +39664 MS -6.0 Y +39665 MS -6.0 Y +39666 MS -6.0 Y +39667 MS -6.0 Y +39668 MS -6.0 Y +39669 MS -6.0 Y +39701 MS -6.0 Y +39702 MS -6.0 Y +39703 MS -6.0 Y +39704 MS -6.0 Y +39705 MS -6.0 Y +39710 MS -6.0 Y +39730 MS -6.0 Y +39735 MS -6.0 Y +39736 MS -6.0 Y +39737 MS -6.0 Y +39739 MS -6.0 Y +39740 MS -6.0 Y +39741 MS -6.0 Y +39743 MS -6.0 Y +39744 MS -6.0 Y +39745 MS -6.0 Y +39746 MS -6.0 Y +39747 MS -6.0 Y +39750 MS -6.0 Y +39751 MS -6.0 Y +39752 MS -6.0 Y +39753 MS -6.0 Y +39754 MS -6.0 Y +39755 MS -6.0 Y +39756 MS -6.0 Y +39759 MS -6.0 Y +39760 MS -6.0 Y +39762 MS -6.0 Y +39766 MS -6.0 Y +39767 MS -6.0 Y +39769 MS -6.0 Y +39771 MS -6.0 Y +39772 MS -6.0 Y +39773 MS -6.0 Y +39776 MS -6.0 Y +39813 GA -5.0 Y +39815 GA -5.0 Y +39817 GA -5.0 Y +39818 GA -5.0 Y +39819 GA -5.0 Y +39823 GA -5.0 Y +39824 GA -5.0 Y +39825 GA -5.0 Y +39826 GA -5.0 Y +39827 GA -5.0 Y +39828 GA -5.0 Y +39829 GA -5.0 Y +39832 GA -5.0 Y +39834 GA -5.0 Y +39836 GA -5.0 Y +39837 GA -5.0 Y +39840 GA -5.0 Y +39841 GA -5.0 Y +39842 GA -5.0 Y +39845 GA -5.0 Y +39846 GA -5.0 Y +39851 GA -5.0 Y +39852 GA -5.0 Y +39854 GA -5.0 Y +39859 GA -5.0 Y +39861 GA -5.0 Y +39862 GA -5.0 Y +39866 GA -5.0 Y +39867 GA -5.0 Y +39870 GA -5.0 Y +39877 GA -5.0 Y +39885 GA -5.0 Y +39886 GA -5.0 Y +39897 GA -5.0 Y +39901 GA -5.0 Y +40003 KY -5.0 Y +40004 KY -5.0 Y +40006 KY -5.0 Y +40007 KY -5.0 Y +40008 KY -5.0 Y +40009 KY -5.0 Y +40010 KY -5.0 Y +40011 KY -5.0 Y +40012 KY -5.0 Y +40013 KY -5.0 Y +40014 KY -5.0 Y +40018 KY -5.0 Y +40019 KY -5.0 Y +40020 KY -5.0 Y +40022 KY -5.0 Y +40023 KY -5.0 Y +40025 KY -5.0 Y +40026 KY -5.0 Y +40027 KY -5.0 Y +40031 KY -5.0 Y +40032 KY -5.0 Y +40033 KY -5.0 Y +40036 KY -5.0 Y +40037 KY -5.0 Y +40040 KY -5.0 Y +40041 KY -5.0 Y +40045 KY -5.0 Y +40046 KY -5.0 Y +40047 KY -5.0 Y +40048 KY -5.0 Y +40049 KY -5.0 Y +40050 KY -5.0 Y +40051 KY -5.0 Y +40052 KY -5.0 Y +40055 KY -5.0 Y +40056 KY -5.0 Y +40057 KY -5.0 Y +40058 KY -5.0 Y +40059 KY -5.0 Y +40060 KY -5.0 Y +40061 KY -5.0 Y +40062 KY -5.0 Y +40063 KY -5.0 Y +40065 KY -5.0 Y +40066 KY -5.0 Y +40067 KY -5.0 Y +40068 KY -5.0 Y +40069 KY -5.0 Y +40070 KY -5.0 Y +40071 KY -5.0 Y +40075 KY -5.0 Y +40076 KY -5.0 Y +40077 KY -5.0 Y +40078 KY -5.0 Y +40104 KY -5.0 Y +40107 KY -5.0 Y +40108 KY -5.0 Y +40109 KY -5.0 Y +40110 KY -5.0 Y +40111 KY -6.0 Y +40115 KY -6.0 Y +40117 KY -5.0 Y +40118 KY -5.0 Y +40119 KY -6.0 Y +40121 KY -5.0 Y +40129 KY -5.0 Y +40140 KY -6.0 Y +40142 KY -5.0 Y +40143 KY -6.0 Y +40144 KY -6.0 Y +40145 KY -6.0 Y +40146 KY -6.0 Y +40150 KY -5.0 Y +40152 KY -6.0 Y +40153 KY -6.0 Y +40155 KY -5.0 Y +40157 KY -5.0 Y +40159 KY -5.0 Y +40160 KY -5.0 Y +40161 KY -5.0 Y +40162 KY -5.0 Y +40165 KY -5.0 Y +40170 KY -6.0 Y +40171 KY -6.0 Y +40175 KY -5.0 Y +40176 KY -6.0 Y +40177 KY -5.0 Y +40178 KY -6.0 Y +40201 KY -5.0 Y +40202 KY -5.0 Y +40203 KY -5.0 Y +40204 KY -5.0 Y +40205 KY -5.0 Y +40206 KY -5.0 Y +40207 KY -5.0 Y +40208 KY -5.0 Y +40209 KY -5.0 Y +40210 KY -5.0 Y +40211 KY -5.0 Y +40212 KY -5.0 Y +40213 KY -5.0 Y +40214 KY -5.0 Y +40215 KY -5.0 Y +40216 KY -5.0 Y +40217 KY -5.0 Y +40218 KY -5.0 Y +40219 KY -5.0 Y +40220 KY -5.0 Y +40221 KY -5.0 Y +40222 KY -5.0 Y +40223 KY -5.0 Y +40224 KY -5.0 Y +40225 KY -5.0 Y +40228 KY -5.0 Y +40229 KY -5.0 Y +40231 KY -5.0 Y +40232 KY -5.0 Y +40233 KY -5.0 Y +40241 KY -5.0 Y +40242 KY -5.0 Y +40243 KY -5.0 Y +40245 KY -5.0 Y +40250 KY -5.0 Y +40251 KY -5.0 Y +40252 KY -5.0 Y +40253 KY -5.0 Y +40255 KY -5.0 Y +40256 KY -5.0 Y +40257 KY -5.0 Y +40258 KY -5.0 Y +40259 KY -5.0 Y +40261 KY -5.0 Y +40266 KY -5.0 Y +40268 KY -5.0 Y +40269 KY -5.0 Y +40270 KY -5.0 Y +40272 KY -5.0 Y +40280 KY -5.0 Y +40281 KY -5.0 Y +40282 KY -5.0 Y +40283 KY -5.0 Y +40285 KY -5.0 Y +40287 KY -5.0 Y +40289 KY -5.0 Y +40290 KY -5.0 Y +40291 KY -5.0 Y +40292 KY -5.0 Y +40293 KY -5.0 Y +40294 KY -5.0 Y +40295 KY -5.0 Y +40296 KY -5.0 Y +40297 KY -5.0 Y +40298 KY -5.0 Y +40299 KY -5.0 Y +40310 KY -5.0 Y +40311 KY -5.0 Y +40312 KY -5.0 Y +40313 KY -5.0 Y +40316 KY -5.0 Y +40317 KY -5.0 Y +40319 KY -5.0 Y +40322 KY -5.0 Y +40324 KY -5.0 Y +40328 KY -5.0 Y +40330 KY -5.0 Y +40334 KY -5.0 Y +40336 KY -5.0 Y +40337 KY -5.0 Y +40339 KY -5.0 Y +40340 KY -5.0 Y +40342 KY -5.0 Y +40346 KY -5.0 Y +40347 KY -5.0 Y +40348 KY -5.0 Y +40350 KY -5.0 Y +40351 KY -5.0 Y +40353 KY -5.0 Y +40355 KY -5.0 Y +40356 KY -5.0 Y +40357 KY -5.0 Y +40358 KY -5.0 Y +40359 KY -5.0 Y +40360 KY -5.0 Y +40361 KY -5.0 Y +40362 KY -5.0 Y +40363 KY -5.0 Y +40366 KY -5.0 Y +40370 KY -5.0 Y +40371 KY -5.0 Y +40372 KY -5.0 Y +40374 KY -5.0 Y +40376 KY -5.0 Y +40379 KY -5.0 Y +40380 KY -5.0 Y +40383 KY -5.0 Y +40384 KY -5.0 Y +40385 KY -5.0 Y +40386 KY -5.0 Y +40387 KY -5.0 Y +40390 KY -5.0 Y +40391 KY -5.0 Y +40392 KY -5.0 Y +40402 KY -5.0 Y +40403 KY -5.0 Y +40404 KY -5.0 Y +40405 KY -5.0 Y +40409 KY -5.0 Y +40410 KY -5.0 Y +40419 KY -5.0 Y +40422 KY -5.0 Y +40423 KY -5.0 Y +40434 KY -5.0 Y +40437 KY -5.0 Y +40440 KY -5.0 Y +40442 KY -5.0 Y +40444 KY -5.0 Y +40445 KY -5.0 Y +40446 KY -5.0 Y +40447 KY -5.0 Y +40448 KY -5.0 Y +40452 KY -5.0 Y +40456 KY -5.0 Y +40460 KY -5.0 Y +40461 KY -5.0 Y +40464 KY -5.0 Y +40468 KY -5.0 Y +40472 KY -5.0 Y +40473 KY -5.0 Y +40475 KY -5.0 Y +40476 KY -5.0 Y +40481 KY -5.0 Y +40484 KY -5.0 Y +40486 KY -5.0 Y +40488 KY -5.0 Y +40489 KY -5.0 Y +40492 KY -5.0 Y +40495 KY -5.0 Y +40502 KY -5.0 Y +40503 KY -5.0 Y +40504 KY -5.0 Y +40505 KY -5.0 Y +40506 KY -5.0 Y +40507 KY -5.0 Y +40508 KY -5.0 Y +40509 KY -5.0 Y +40510 KY -5.0 Y +40511 KY -5.0 Y +40512 KY -5.0 Y +40513 KY -5.0 Y +40514 KY -5.0 Y +40515 KY -5.0 Y +40516 KY -5.0 Y +40517 KY -5.0 Y +40522 KY -5.0 Y +40523 KY -5.0 Y +40524 KY -5.0 Y +40526 KY -5.0 Y +40533 KY -5.0 Y +40536 KY -5.0 Y +40544 KY -5.0 Y +40546 KY -5.0 Y +40550 KY -5.0 Y +40555 KY -5.0 Y +40574 KY -5.0 Y +40575 KY -5.0 Y +40576 KY -5.0 Y +40577 KY -5.0 Y +40578 KY -5.0 Y +40579 KY -5.0 Y +40580 KY -5.0 Y +40581 KY -5.0 Y +40582 KY -5.0 Y +40583 KY -5.0 Y +40588 KY -5.0 Y +40591 KY -5.0 Y +40598 KY -5.0 Y +40601 KY -5.0 Y +40602 KY -5.0 Y +40603 KY -5.0 Y +40604 KY -5.0 Y +40618 KY -5.0 Y +40619 KY -5.0 Y +40620 KY -5.0 Y +40621 KY -5.0 Y +40622 KY -5.0 Y +40701 KY -5.0 Y +40702 KY -5.0 Y +40724 KY -5.0 Y +40729 KY -5.0 Y +40730 KY -5.0 Y +40734 KY -5.0 Y +40737 KY -5.0 Y +40740 KY -5.0 Y +40741 KY -5.0 Y +40742 KY -5.0 Y +40743 KY -5.0 Y +40744 KY -5.0 Y +40745 KY -5.0 Y +40754 KY -5.0 Y +40755 KY -5.0 Y +40759 KY -5.0 Y +40763 KY -5.0 Y +40769 KY -5.0 Y +40771 KY -5.0 Y +40801 KY -5.0 Y +40803 KY -5.0 Y +40806 KY -5.0 Y +40807 KY -5.0 Y +40808 KY -5.0 Y +40810 KY -5.0 Y +40813 KY -5.0 Y +40815 KY -5.0 Y +40816 KY -5.0 Y +40818 KY -5.0 Y +40819 KY -5.0 Y +40820 KY -5.0 Y +40823 KY -5.0 Y +40824 KY -5.0 Y +40826 KY -5.0 Y +40827 KY -5.0 Y +40828 KY -5.0 Y +40829 KY -5.0 Y +40830 KY -5.0 Y +40831 KY -5.0 Y +40840 KY -5.0 Y +40843 KY -5.0 Y +40844 KY -5.0 Y +40845 KY -5.0 Y +40847 KY -5.0 Y +40849 KY -5.0 Y +40854 KY -5.0 Y +40855 KY -5.0 Y +40856 KY -5.0 Y +40858 KY -5.0 Y +40862 KY -5.0 Y +40863 KY -5.0 Y +40865 KY -5.0 Y +40868 KY -5.0 Y +40870 KY -5.0 Y +40873 KY -5.0 Y +40874 KY -5.0 Y +40902 KY -5.0 Y +40903 KY -5.0 Y +40906 KY -5.0 Y +40913 KY -5.0 Y +40914 KY -5.0 Y +40915 KY -5.0 Y +40921 KY -5.0 Y +40923 KY -5.0 Y +40927 KY -5.0 Y +40930 KY -5.0 Y +40931 KY -5.0 Y +40932 KY -5.0 Y +40935 KY -5.0 Y +40939 KY -5.0 Y +40940 KY -5.0 Y +40941 KY -5.0 Y +40943 KY -5.0 Y +40944 KY -5.0 Y +40946 KY -5.0 Y +40949 KY -5.0 Y +40951 KY -5.0 Y +40953 KY -5.0 Y +40955 KY -5.0 Y +40958 KY -5.0 Y +40962 KY -5.0 Y +40964 KY -5.0 Y +40965 KY -5.0 Y +40972 KY -5.0 Y +40977 KY -5.0 Y +40979 KY -5.0 Y +40981 KY -5.0 Y +40982 KY -5.0 Y +40983 KY -5.0 Y +40988 KY -5.0 Y +40995 KY -5.0 Y +40997 KY -5.0 Y +40999 KY -5.0 Y +41001 KY -5.0 Y +41002 KY -5.0 Y +41003 KY -5.0 Y +41004 KY -5.0 Y +41005 KY -5.0 Y +41006 KY -5.0 Y +41007 KY -5.0 Y +41008 KY -5.0 Y +41010 KY -5.0 Y +41011 KY -5.0 Y +41012 KY -5.0 Y +41014 KY -5.0 Y +41015 KY -5.0 Y +41016 KY -5.0 Y +41017 KY -5.0 Y +41018 KY -5.0 Y +41019 KY -5.0 Y +41022 KY -5.0 Y +41030 KY -5.0 Y +41031 KY -5.0 Y +41033 KY -5.0 Y +41034 KY -5.0 Y +41035 KY -5.0 Y +41037 KY -5.0 Y +41039 KY -5.0 Y +41040 KY -5.0 Y +41041 KY -5.0 Y +41042 KY -5.0 Y +41043 KY -5.0 Y +41044 KY -5.0 Y +41045 KY -5.0 Y +41046 KY -5.0 Y +41048 KY -5.0 Y +41049 KY -5.0 Y +41051 KY -5.0 Y +41052 KY -5.0 Y +41053 KY -5.0 Y +41054 KY -5.0 Y +41055 KY -5.0 Y +41056 KY -5.0 Y +41059 KY -5.0 Y +41061 KY -5.0 Y +41062 KY -5.0 Y +41063 KY -5.0 Y +41064 KY -5.0 Y +41065 KY -5.0 Y +41071 KY -5.0 Y +41072 KY -5.0 Y +41073 KY -5.0 Y +41074 KY -5.0 Y +41075 KY -5.0 Y +41076 KY -5.0 Y +41080 KY -5.0 Y +41081 KY -5.0 Y +41083 KY -5.0 Y +41085 KY -5.0 Y +41086 KY -5.0 Y +41091 KY -5.0 Y +41092 KY -5.0 Y +41093 KY -5.0 Y +41094 KY -5.0 Y +41095 KY -5.0 Y +41096 KY -5.0 Y +41097 KY -5.0 Y +41098 KY -5.0 Y +41099 KY -5.0 Y +41101 KY -5.0 Y +41102 KY -5.0 Y +41105 KY -5.0 Y +41114 KY -5.0 Y +41121 KY -5.0 Y +41124 KY -5.0 Y +41128 KY -5.0 Y +41129 KY -5.0 Y +41132 KY -5.0 Y +41135 KY -5.0 Y +41139 KY -5.0 Y +41141 KY -5.0 Y +41142 KY -5.0 Y +41143 KY -5.0 Y +41144 KY -5.0 Y +41146 KY -5.0 Y +41149 KY -5.0 Y +41159 KY -5.0 Y +41160 KY -5.0 Y +41164 KY -5.0 Y +41166 KY -5.0 Y +41168 KY -5.0 Y +41169 KY -5.0 Y +41171 KY -5.0 Y +41173 KY -5.0 Y +41174 KY -5.0 Y +41175 KY -5.0 Y +41179 KY -5.0 Y +41180 KY -5.0 Y +41181 KY -5.0 Y +41183 KY -5.0 Y +41189 KY -5.0 Y +41201 KY -5.0 Y +41203 KY -5.0 Y +41204 KY -5.0 Y +41214 KY -5.0 Y +41216 KY -5.0 Y +41219 KY -5.0 Y +41222 KY -5.0 Y +41224 KY -5.0 Y +41226 KY -5.0 Y +41230 KY -5.0 Y +41231 KY -5.0 Y +41232 KY -5.0 Y +41234 KY -5.0 Y +41238 KY -5.0 Y +41240 KY -5.0 Y +41250 KY -5.0 Y +41254 KY -5.0 Y +41255 KY -5.0 Y +41256 KY -5.0 Y +41257 KY -5.0 Y +41260 KY -5.0 Y +41262 KY -5.0 Y +41263 KY -5.0 Y +41264 KY -5.0 Y +41265 KY -5.0 Y +41267 KY -5.0 Y +41268 KY -5.0 Y +41271 KY -5.0 Y +41274 KY -5.0 Y +41301 KY -5.0 Y +41307 KY -5.0 Y +41310 KY -5.0 Y +41311 KY -5.0 Y +41313 KY -5.0 Y +41314 KY -5.0 Y +41317 KY -5.0 Y +41332 KY -5.0 Y +41333 KY -5.0 Y +41338 KY -5.0 Y +41339 KY -5.0 Y +41347 KY -5.0 Y +41348 KY -5.0 Y +41351 KY -5.0 Y +41352 KY -5.0 Y +41360 KY -5.0 Y +41362 KY -5.0 Y +41364 KY -5.0 Y +41365 KY -5.0 Y +41366 KY -5.0 Y +41367 KY -5.0 Y +41368 KY -5.0 Y +41385 KY -5.0 Y +41386 KY -5.0 Y +41390 KY -5.0 Y +41397 KY -5.0 Y +41408 KY -5.0 Y +41413 KY -5.0 Y +41421 KY -5.0 Y +41425 KY -5.0 Y +41426 KY -5.0 Y +41433 KY -5.0 Y +41451 KY -5.0 Y +41459 KY -5.0 Y +41464 KY -5.0 Y +41465 KY -5.0 Y +41472 KY -5.0 Y +41477 KY -5.0 Y +41501 KY -5.0 Y +41502 KY -5.0 Y +41503 KY -5.0 Y +41512 KY -5.0 Y +41513 KY -5.0 Y +41514 KY -5.0 Y +41517 KY -5.0 Y +41519 KY -5.0 Y +41520 KY -5.0 Y +41522 KY -5.0 Y +41524 KY -5.0 Y +41526 KY -5.0 Y +41527 KY -5.0 Y +41528 KY -5.0 Y +41531 KY -5.0 Y +41534 KY -5.0 Y +41535 KY -5.0 Y +41537 KY -5.0 Y +41538 KY -5.0 Y +41539 KY -5.0 Y +41540 KY -5.0 Y +41542 KY -5.0 Y +41543 KY -5.0 Y +41544 KY -5.0 Y +41547 KY -5.0 Y +41548 KY -5.0 Y +41549 KY -5.0 Y +41553 KY -5.0 Y +41554 KY -5.0 Y +41555 KY -5.0 Y +41557 KY -5.0 Y +41558 KY -5.0 Y +41559 KY -5.0 Y +41560 KY -5.0 Y +41561 KY -5.0 Y +41562 KY -5.0 Y +41563 KY -5.0 Y +41564 KY -5.0 Y +41566 KY -5.0 Y +41567 KY -5.0 Y +41568 KY -5.0 Y +41571 KY -5.0 Y +41572 KY -5.0 Y +41601 KY -5.0 Y +41602 KY -5.0 Y +41603 KY -5.0 Y +41604 KY -5.0 Y +41605 KY -5.0 Y +41606 KY -5.0 Y +41607 KY -5.0 Y +41612 KY -5.0 Y +41615 KY -5.0 Y +41616 KY -5.0 Y +41619 KY -5.0 Y +41621 KY -5.0 Y +41622 KY -5.0 Y +41630 KY -5.0 Y +41631 KY -5.0 Y +41632 KY -5.0 Y +41635 KY -5.0 Y +41636 KY -5.0 Y +41640 KY -5.0 Y +41642 KY -5.0 Y +41643 KY -5.0 Y +41645 KY -5.0 Y +41647 KY -5.0 Y +41649 KY -5.0 Y +41650 KY -5.0 Y +41651 KY -5.0 Y +41653 KY -5.0 Y +41655 KY -5.0 Y +41659 KY -5.0 Y +41660 KY -5.0 Y +41663 KY -5.0 Y +41666 KY -5.0 Y +41667 KY -5.0 Y +41669 KY -5.0 Y +41701 KY -5.0 Y +41702 KY -5.0 Y +41712 KY -5.0 Y +41713 KY -5.0 Y +41714 KY -5.0 Y +41719 KY -5.0 Y +41721 KY -5.0 Y +41722 KY -5.0 Y +41723 KY -5.0 Y +41725 KY -5.0 Y +41727 KY -5.0 Y +41729 KY -5.0 Y +41731 KY -5.0 Y +41735 KY -5.0 Y +41736 KY -5.0 Y +41739 KY -5.0 Y +41740 KY -5.0 Y +41743 KY -5.0 Y +41745 KY -5.0 Y +41746 KY -5.0 Y +41747 KY -5.0 Y +41749 KY -5.0 Y +41751 KY -5.0 Y +41754 KY -5.0 Y +41759 KY -5.0 Y +41760 KY -5.0 Y +41762 KY -5.0 Y +41763 KY -5.0 Y +41764 KY -5.0 Y +41766 KY -5.0 Y +41772 KY -5.0 Y +41773 KY -5.0 Y +41774 KY -5.0 Y +41775 KY -5.0 Y +41776 KY -5.0 Y +41777 KY -5.0 Y +41778 KY -5.0 Y +41804 KY -5.0 Y +41810 KY -5.0 Y +41812 KY -5.0 Y +41815 KY -5.0 Y +41817 KY -5.0 Y +41819 KY -5.0 Y +41821 KY -5.0 Y +41822 KY -5.0 Y +41824 KY -5.0 Y +41825 KY -5.0 Y +41826 KY -5.0 Y +41828 KY -5.0 Y +41831 KY -5.0 Y +41832 KY -5.0 Y +41833 KY -5.0 Y +41834 KY -5.0 Y +41835 KY -5.0 Y +41836 KY -5.0 Y +41837 KY -5.0 Y +41838 KY -5.0 Y +41839 KY -5.0 Y +41840 KY -5.0 Y +41843 KY -5.0 Y +41844 KY -5.0 Y +41845 KY -5.0 Y +41847 KY -5.0 Y +41848 KY -5.0 Y +41849 KY -5.0 Y +41855 KY -5.0 Y +41858 KY -5.0 Y +41859 KY -5.0 Y +41861 KY -5.0 Y +41862 KY -5.0 Y +42001 KY -6.0 Y +42002 KY -6.0 Y +42003 KY -6.0 Y +42020 KY -6.0 Y +42021 KY -6.0 Y +42022 KY -6.0 Y +42023 KY -6.0 Y +42024 KY -6.0 Y +42025 KY -6.0 Y +42027 KY -6.0 Y +42028 KY -6.0 Y +42029 KY -6.0 Y +42031 KY -6.0 Y +42032 KY -6.0 Y +42033 KY -6.0 Y +42035 KY -6.0 Y +42036 KY -6.0 Y +42037 KY -6.0 Y +42038 KY -6.0 Y +42039 KY -6.0 Y +42040 KY -6.0 Y +42041 KY -6.0 Y +42044 KY -6.0 Y +42045 KY -6.0 Y +42047 KY -6.0 Y +42048 KY -6.0 Y +42049 KY -6.0 Y +42050 KY -6.0 Y +42051 KY -6.0 Y +42053 KY -6.0 Y +42054 KY -6.0 Y +42055 KY -6.0 Y +42056 KY -6.0 Y +42058 KY -6.0 Y +42060 KY -6.0 Y +42061 KY -6.0 Y +42063 KY -6.0 Y +42064 KY -6.0 Y +42066 KY -6.0 Y +42069 KY -6.0 Y +42070 KY -6.0 Y +42071 KY -6.0 Y +42076 KY -6.0 Y +42078 KY -6.0 Y +42079 KY -6.0 Y +42081 KY -6.0 Y +42082 KY -6.0 Y +42083 KY -6.0 Y +42084 KY -6.0 Y +42085 KY -6.0 Y +42086 KY -6.0 Y +42087 KY -6.0 Y +42088 KY -6.0 Y +42101 KY -6.0 Y +42102 KY -6.0 Y +42103 KY -6.0 Y +42104 KY -6.0 Y +42120 KY -6.0 Y +42122 KY -6.0 Y +42123 KY -6.0 Y +42124 KY -6.0 Y +42127 KY -6.0 Y +42128 KY -6.0 Y +42129 KY -6.0 Y +42130 KY -6.0 Y +42131 KY -6.0 Y +42133 KY -6.0 Y +42134 KY -6.0 Y +42135 KY -6.0 Y +42140 KY -6.0 Y +42141 KY -6.0 Y +42142 KY -6.0 Y +42151 KY -6.0 Y +42152 KY -6.0 Y +42153 KY -6.0 Y +42154 KY -6.0 Y +42156 KY -6.0 Y +42157 KY -6.0 Y +42159 KY -6.0 Y +42160 KY -6.0 Y +42163 KY -6.0 Y +42164 KY -6.0 Y +42166 KY -6.0 Y +42167 KY -6.0 Y +42170 KY -6.0 Y +42171 KY -6.0 Y +42201 KY -6.0 Y +42202 KY -6.0 Y +42204 KY -6.0 Y +42206 KY -6.0 Y +42207 KY -6.0 Y +42210 KY -6.0 Y +42211 KY -6.0 Y +42214 KY -6.0 Y +42215 KY -6.0 Y +42216 KY -6.0 Y +42217 KY -6.0 Y +42219 KY -6.0 Y +42220 KY -6.0 Y +42221 KY -6.0 Y +42223 KY -6.0 Y +42232 KY -6.0 Y +42234 KY -6.0 Y +42236 KY -6.0 Y +42240 KY -6.0 Y +42241 KY -6.0 Y +42252 KY -6.0 Y +42254 KY -6.0 Y +42256 KY -6.0 Y +42259 KY -6.0 Y +42261 KY -6.0 Y +42262 KY -6.0 Y +42265 KY -6.0 Y +42266 KY -6.0 Y +42273 KY -6.0 Y +42274 KY -6.0 Y +42275 KY -6.0 Y +42276 KY -6.0 Y +42280 KY -6.0 Y +42283 KY -6.0 Y +42285 KY -6.0 Y +42286 KY -6.0 Y +42287 KY -6.0 Y +42288 KY -6.0 Y +42301 KY -6.0 Y +42302 KY -6.0 Y +42303 KY -6.0 Y +42304 KY -6.0 Y +42320 KY -6.0 Y +42321 KY -6.0 Y +42322 KY -6.0 Y +42323 KY -6.0 Y +42324 KY -6.0 Y +42325 KY -6.0 Y +42326 KY -6.0 Y +42327 KY -6.0 Y +42328 KY -6.0 Y +42330 KY -6.0 Y +42332 KY -6.0 Y +42333 KY -6.0 Y +42334 KY -6.0 Y +42337 KY -6.0 Y +42338 KY -6.0 Y +42339 KY -6.0 Y +42343 KY -6.0 Y +42344 KY -6.0 Y +42345 KY -6.0 Y +42347 KY -6.0 Y +42348 KY -6.0 Y +42349 KY -6.0 Y +42350 KY -6.0 Y +42351 KY -6.0 Y +42352 KY -6.0 Y +42354 KY -6.0 Y +42355 KY -6.0 Y +42356 KY -6.0 Y +42361 KY -6.0 Y +42364 KY -6.0 Y +42366 KY -6.0 Y +42367 KY -6.0 Y +42368 KY -6.0 Y +42369 KY -6.0 Y +42370 KY -6.0 Y +42371 KY -6.0 Y +42372 KY -6.0 Y +42374 KY -6.0 Y +42375 KY -6.0 Y +42376 KY -6.0 Y +42377 KY -6.0 Y +42378 KY -6.0 Y +42402 KY -6.0 Y +42403 KY -6.0 Y +42404 KY -6.0 Y +42406 KY -6.0 Y +42408 KY -6.0 Y +42409 KY -6.0 Y +42410 KY -6.0 Y +42411 KY -6.0 Y +42413 KY -6.0 Y +42419 KY -6.0 Y +42420 KY -6.0 Y +42431 KY -6.0 Y +42436 KY -6.0 Y +42437 KY -6.0 Y +42440 KY -6.0 Y +42441 KY -6.0 Y +42442 KY -6.0 Y +42444 KY -6.0 Y +42445 KY -6.0 Y +42450 KY -6.0 Y +42451 KY -6.0 Y +42452 KY -6.0 Y +42453 KY -6.0 Y +42455 KY -6.0 Y +42456 KY -6.0 Y +42457 KY -6.0 Y +42458 KY -6.0 Y +42459 KY -6.0 Y +42460 KY -6.0 Y +42461 KY -6.0 Y +42462 KY -6.0 Y +42463 KY -6.0 Y +42464 KY -6.0 Y +42501 KY -5.0 Y +42502 KY -5.0 Y +42503 KY -5.0 Y +42516 KY -5.0 Y +42518 KY -5.0 Y +42519 KY -5.0 Y +42528 KY -5.0 Y +42533 KY -5.0 Y +42539 KY -5.0 Y +42541 KY -5.0 Y +42544 KY -5.0 Y +42553 KY -5.0 Y +42558 KY -5.0 Y +42564 KY -5.0 Y +42565 KY -5.0 Y +42566 KY -5.0 Y +42567 KY -5.0 Y +42602 KY -6.0 Y +42603 KY -6.0 Y +42629 KY -6.0 Y +42631 KY -5.0 Y +42633 KY -6.0 Y +42634 KY -5.0 Y +42635 KY -5.0 Y +42638 KY -5.0 Y +42642 KY -6.0 Y +42647 KY -5.0 Y +42649 KY -5.0 Y +42653 KY -5.0 Y +42701 KY -5.0 Y +42702 KY -5.0 Y +42712 KY -6.0 Y +42713 KY -6.0 Y +42715 KY -6.0 Y +42716 KY -5.0 Y +42717 KY -6.0 Y +42718 KY -5.0 Y +42719 KY -5.0 Y +42720 KY -6.0 Y +42721 KY -6.0 Y +42722 KY -6.0 Y +42724 KY -5.0 Y +42726 KY -6.0 Y +42728 KY -6.0 Y +42729 KY -6.0 Y +42731 KY -6.0 Y +42732 KY -5.0 Y +42733 KY -5.0 Y +42740 KY -5.0 Y +42741 KY -6.0 Y +42742 KY -6.0 Y +42743 KY -6.0 Y +42746 KY -6.0 Y +42748 KY -5.0 Y +42749 KY -6.0 Y +42753 KY -6.0 Y +42754 KY -6.0 Y +42755 KY -6.0 Y +42757 KY -5.0 Y +42758 KY -5.0 Y +42759 KY -6.0 Y +42762 KY -6.0 Y +42764 KY -5.0 Y +42765 KY -6.0 Y +42776 KY -5.0 Y +42782 KY -6.0 Y +42784 KY -5.0 Y +42788 KY -5.0 Y +43001 OH -5.0 Y +43002 OH -5.0 Y +43003 OH -5.0 Y +43004 OH -5.0 Y +43005 OH -5.0 Y +43006 OH -5.0 Y +43007 OH -5.0 Y +43008 OH -5.0 Y +43009 OH -5.0 Y +43010 OH -5.0 Y +43011 OH -5.0 Y +43013 OH -5.0 Y +43014 OH -5.0 Y +43015 OH -5.0 Y +43016 OH -5.0 Y +43017 OH -5.0 Y +43018 OH -5.0 Y +43019 OH -5.0 Y +43021 OH -5.0 Y +43022 OH -5.0 Y +43023 OH -5.0 Y +43025 OH -5.0 Y +43026 OH -5.0 Y +43027 OH -5.0 Y +43028 OH -5.0 Y +43029 OH -5.0 Y +43030 OH -5.0 Y +43031 OH -5.0 Y +43032 OH -5.0 Y +43033 OH -5.0 Y +43035 OH -5.0 Y +43036 OH -5.0 Y +43037 OH -5.0 Y +43040 OH -5.0 Y +43041 OH -5.0 Y +43044 OH -5.0 Y +43045 OH -5.0 Y +43046 OH -5.0 Y +43047 OH -5.0 Y +43048 OH -5.0 Y +43050 OH -5.0 Y +43054 OH -5.0 Y +43055 OH -5.0 Y +43056 OH -5.0 Y +43058 OH -5.0 Y +43060 OH -5.0 Y +43061 OH -5.0 Y +43062 OH -5.0 Y +43064 OH -5.0 Y +43065 OH -5.0 Y +43066 OH -5.0 Y +43067 OH -5.0 Y +43068 OH -5.0 Y +43070 OH -5.0 Y +43071 OH -5.0 Y +43072 OH -5.0 Y +43073 OH -5.0 Y +43074 OH -5.0 Y +43076 OH -5.0 Y +43077 OH -5.0 Y +43078 OH -5.0 Y +43080 OH -5.0 Y +43081 OH -5.0 Y +43082 OH -5.0 Y +43083 OH -5.0 Y +43084 OH -5.0 Y +43085 OH -5.0 Y +43086 OH -5.0 Y +43093 OH -5.0 Y +43098 OH -5.0 Y +43101 OH -5.0 Y +43102 OH -5.0 Y +43103 OH -5.0 Y +43105 OH -5.0 Y +43106 OH -5.0 Y +43107 OH -5.0 Y +43109 OH -5.0 Y +43110 OH -5.0 Y +43111 OH -5.0 Y +43112 OH -5.0 Y +43113 OH -5.0 Y +43115 OH -5.0 Y +43116 OH -5.0 Y +43117 OH -5.0 Y +43119 OH -5.0 Y +43123 OH -5.0 Y +43125 OH -5.0 Y +43126 OH -5.0 Y +43127 OH -5.0 Y +43128 OH -5.0 Y +43130 OH -5.0 Y +43135 OH -5.0 Y +43136 OH -5.0 Y +43137 OH -5.0 Y +43138 OH -5.0 Y +43140 OH -5.0 Y +43142 OH -5.0 Y +43143 OH -5.0 Y +43144 OH -5.0 Y +43145 OH -5.0 Y +43146 OH -5.0 Y +43147 OH -5.0 Y +43148 OH -5.0 Y +43149 OH -5.0 Y +43150 OH -5.0 Y +43151 OH -5.0 Y +43152 OH -5.0 Y +43153 OH -5.0 Y +43154 OH -5.0 Y +43155 OH -5.0 Y +43156 OH -5.0 Y +43157 OH -5.0 Y +43158 OH -5.0 Y +43160 OH -5.0 Y +43162 OH -5.0 Y +43163 OH -5.0 Y +43164 OH -5.0 Y +43195 OH -5.0 Y +43196 OH -5.0 Y +43198 OH -5.0 Y +43199 OH -5.0 Y +43201 OH -5.0 Y +43202 OH -5.0 Y +43203 OH -5.0 Y +43204 OH -5.0 Y +43205 OH -5.0 Y +43206 OH -5.0 Y +43207 OH -5.0 Y +43209 OH -5.0 Y +43210 OH -5.0 Y +43211 OH -5.0 Y +43212 OH -5.0 Y +43213 OH -5.0 Y +43214 OH -5.0 Y +43215 OH -5.0 Y +43216 OH -5.0 Y +43217 OH -5.0 Y +43218 OH -5.0 Y +43219 OH -5.0 Y +43220 OH -5.0 Y +43221 OH -5.0 Y +43222 OH -5.0 Y +43223 OH -5.0 Y +43224 OH -5.0 Y +43226 OH -5.0 Y +43227 OH -5.0 Y +43228 OH -5.0 Y +43229 OH -5.0 Y +43230 OH -5.0 Y +43231 OH -5.0 Y +43232 OH -5.0 Y +43234 OH -5.0 Y +43235 OH -5.0 Y +43236 OH -5.0 Y +43240 OH -5.0 Y +43251 OH -5.0 Y +43260 OH -5.0 Y +43265 OH -5.0 Y +43266 OH -5.0 Y +43268 OH -5.0 Y +43270 OH -5.0 Y +43271 OH -5.0 Y +43272 OH -5.0 Y +43279 OH -5.0 Y +43287 OH -5.0 Y +43291 OH -5.0 Y +43299 OH -5.0 Y +43301 OH -5.0 Y +43302 OH -5.0 Y +43306 OH -5.0 Y +43307 OH -5.0 Y +43310 OH -5.0 Y +43311 OH -5.0 Y +43314 OH -5.0 Y +43315 OH -5.0 Y +43316 OH -5.0 Y +43317 OH -5.0 Y +43318 OH -5.0 Y +43319 OH -5.0 Y +43320 OH -5.0 Y +43321 OH -5.0 Y +43322 OH -5.0 Y +43323 OH -5.0 Y +43324 OH -5.0 Y +43325 OH -5.0 Y +43326 OH -5.0 Y +43330 OH -5.0 Y +43331 OH -5.0 Y +43332 OH -5.0 Y +43333 OH -5.0 Y +43334 OH -5.0 Y +43335 OH -5.0 Y +43336 OH -5.0 Y +43337 OH -5.0 Y +43338 OH -5.0 Y +43340 OH -5.0 Y +43341 OH -5.0 Y +43342 OH -5.0 Y +43343 OH -5.0 Y +43344 OH -5.0 Y +43345 OH -5.0 Y +43346 OH -5.0 Y +43347 OH -5.0 Y +43348 OH -5.0 Y +43349 OH -5.0 Y +43350 OH -5.0 Y +43351 OH -5.0 Y +43356 OH -5.0 Y +43357 OH -5.0 Y +43358 OH -5.0 Y +43359 OH -5.0 Y +43360 OH -5.0 Y +43402 OH -5.0 Y +43403 OH -5.0 Y +43406 OH -5.0 Y +43407 OH -5.0 Y +43408 OH -5.0 Y +43410 OH -5.0 Y +43412 OH -5.0 Y +43413 OH -5.0 Y +43414 OH -5.0 Y +43416 OH -5.0 Y +43420 OH -5.0 Y +43430 OH -5.0 Y +43431 OH -5.0 Y +43432 OH -5.0 Y +43433 OH -5.0 Y +43434 OH -5.0 Y +43435 OH -5.0 Y +43436 OH -5.0 Y +43437 OH -5.0 Y +43438 OH -5.0 Y +43439 OH -5.0 Y +43440 OH -5.0 Y +43441 OH -5.0 Y +43442 OH -5.0 Y +43443 OH -5.0 Y +43445 OH -5.0 Y +43446 OH -5.0 Y +43447 OH -5.0 Y +43449 OH -5.0 Y +43450 OH -5.0 Y +43451 OH -5.0 Y +43452 OH -5.0 Y +43456 OH -5.0 Y +43457 OH -5.0 Y +43458 OH -5.0 Y +43460 OH -5.0 Y +43462 OH -5.0 Y +43463 OH -5.0 Y +43464 OH -5.0 Y +43465 OH -5.0 Y +43466 OH -5.0 Y +43467 OH -5.0 Y +43468 OH -5.0 Y +43469 OH -5.0 Y +43501 OH -5.0 Y +43502 OH -5.0 Y +43504 OH -5.0 Y +43505 OH -5.0 Y +43506 OH -5.0 Y +43510 OH -5.0 Y +43511 OH -5.0 Y +43512 OH -5.0 Y +43515 OH -5.0 Y +43516 OH -5.0 Y +43517 OH -5.0 Y +43518 OH -5.0 Y +43519 OH -5.0 Y +43520 OH -5.0 Y +43521 OH -5.0 Y +43522 OH -5.0 Y +43523 OH -5.0 Y +43524 OH -5.0 Y +43525 OH -5.0 Y +43526 OH -5.0 Y +43527 OH -5.0 Y +43528 OH -5.0 Y +43529 OH -5.0 Y +43530 OH -5.0 Y +43531 OH -5.0 Y +43532 OH -5.0 Y +43533 OH -5.0 Y +43534 OH -5.0 Y +43535 OH -5.0 Y +43536 OH -5.0 Y +43537 OH -5.0 Y +43540 OH -5.0 Y +43541 OH -5.0 Y +43542 OH -5.0 Y +43543 OH -5.0 Y +43545 OH -5.0 Y +43547 OH -5.0 Y +43548 OH -5.0 Y +43549 OH -5.0 Y +43550 OH -5.0 Y +43551 OH -5.0 Y +43552 OH -5.0 Y +43553 OH -5.0 Y +43554 OH -5.0 Y +43555 OH -5.0 Y +43556 OH -5.0 Y +43557 OH -5.0 Y +43558 OH -5.0 Y +43560 OH -5.0 Y +43565 OH -5.0 Y +43566 OH -5.0 Y +43567 OH -5.0 Y +43569 OH -5.0 Y +43570 OH -5.0 Y +43571 OH -5.0 Y +43601 OH -5.0 Y +43603 OH -5.0 Y +43604 OH -5.0 Y +43605 OH -5.0 Y +43606 OH -5.0 Y +43607 OH -5.0 Y +43608 OH -5.0 Y +43609 OH -5.0 Y +43610 OH -5.0 Y +43611 OH -5.0 Y +43612 OH -5.0 Y +43613 OH -5.0 Y +43614 OH -5.0 Y +43615 OH -5.0 Y +43616 OH -5.0 Y +43617 OH -5.0 Y +43618 OH -5.0 Y +43619 OH -5.0 Y +43620 OH -5.0 Y +43623 OH -5.0 Y +43635 OH -5.0 Y +43652 OH -5.0 Y +43654 OH -5.0 Y +43656 OH -5.0 Y +43657 OH -5.0 Y +43659 OH -5.0 Y +43660 OH -5.0 Y +43661 OH -5.0 Y +43666 OH -5.0 Y +43667 OH -5.0 Y +43681 OH -5.0 Y +43682 OH -5.0 Y +43697 OH -5.0 Y +43699 OH -5.0 Y +43701 OH -5.0 Y +43702 OH -5.0 Y +43711 OH -5.0 Y +43713 OH -5.0 Y +43716 OH -5.0 Y +43717 OH -5.0 Y +43718 OH -5.0 Y +43719 OH -5.0 Y +43720 OH -5.0 Y +43721 OH -5.0 Y +43722 OH -5.0 Y +43723 OH -5.0 Y +43724 OH -5.0 Y +43725 OH -5.0 Y +43727 OH -5.0 Y +43728 OH -5.0 Y +43730 OH -5.0 Y +43731 OH -5.0 Y +43732 OH -5.0 Y +43733 OH -5.0 Y +43734 OH -5.0 Y +43735 OH -5.0 Y +43736 OH -5.0 Y +43738 OH -5.0 Y +43739 OH -5.0 Y +43740 OH -5.0 Y +43746 OH -5.0 Y +43747 OH -5.0 Y +43748 OH -5.0 Y +43749 OH -5.0 Y +43750 OH -5.0 Y +43752 OH -5.0 Y +43754 OH -5.0 Y +43755 OH -5.0 Y +43756 OH -5.0 Y +43757 OH -5.0 Y +43758 OH -5.0 Y +43759 OH -5.0 Y +43760 OH -5.0 Y +43761 OH -5.0 Y +43762 OH -5.0 Y +43764 OH -5.0 Y +43766 OH -5.0 Y +43767 OH -5.0 Y +43768 OH -5.0 Y +43771 OH -5.0 Y +43772 OH -5.0 Y +43773 OH -5.0 Y +43777 OH -5.0 Y +43778 OH -5.0 Y +43779 OH -5.0 Y +43780 OH -5.0 Y +43782 OH -5.0 Y +43783 OH -5.0 Y +43786 OH -5.0 Y +43787 OH -5.0 Y +43788 OH -5.0 Y +43789 OH -5.0 Y +43791 OH -5.0 Y +43793 OH -5.0 Y +43802 OH -5.0 Y +43803 OH -5.0 Y +43804 OH -5.0 Y +43805 OH -5.0 Y +43811 OH -5.0 Y +43812 OH -5.0 Y +43821 OH -5.0 Y +43822 OH -5.0 Y +43824 OH -5.0 Y +43828 OH -5.0 Y +43830 OH -5.0 Y +43832 OH -5.0 Y +43836 OH -5.0 Y +43837 OH -5.0 Y +43840 OH -5.0 Y +43842 OH -5.0 Y +43843 OH -5.0 Y +43844 OH -5.0 Y +43845 OH -5.0 Y +43901 OH -5.0 Y +43902 OH -5.0 Y +43903 OH -5.0 Y +43905 OH -5.0 Y +43906 OH -5.0 Y +43907 OH -5.0 Y +43908 OH -5.0 Y +43909 OH -5.0 Y +43910 OH -5.0 Y +43912 OH -5.0 Y +43913 OH -5.0 Y +43914 OH -5.0 Y +43915 OH -5.0 Y +43916 OH -5.0 Y +43917 OH -5.0 Y +43920 OH -5.0 Y +43925 OH -5.0 Y +43926 OH -5.0 Y +43927 OH -5.0 Y +43928 OH -5.0 Y +43930 OH -5.0 Y +43931 OH -5.0 Y +43932 OH -5.0 Y +43933 OH -5.0 Y +43934 OH -5.0 Y +43935 OH -5.0 Y +43937 OH -5.0 Y +43938 OH -5.0 Y +43939 OH -5.0 Y +43940 OH -5.0 Y +43941 OH -5.0 Y +43942 OH -5.0 Y +43943 OH -5.0 Y +43944 OH -5.0 Y +43945 OH -5.0 Y +43946 OH -5.0 Y +43947 OH -5.0 Y +43948 OH -5.0 Y +43950 OH -5.0 Y +43951 OH -5.0 Y +43952 OH -5.0 Y +43953 OH -5.0 Y +43961 OH -5.0 Y +43962 OH -5.0 Y +43963 OH -5.0 Y +43964 OH -5.0 Y +43967 OH -5.0 Y +43968 OH -5.0 Y +43970 OH -5.0 Y +43971 OH -5.0 Y +43972 OH -5.0 Y +43973 OH -5.0 Y +43974 OH -5.0 Y +43976 OH -5.0 Y +43977 OH -5.0 Y +43981 OH -5.0 Y +43983 OH -5.0 Y +43984 OH -5.0 Y +43985 OH -5.0 Y +43986 OH -5.0 Y +43988 OH -5.0 Y +44001 OH -5.0 Y +44003 OH -5.0 Y +44004 OH -5.0 Y +44005 OH -5.0 Y +44010 OH -5.0 Y +44011 OH -5.0 Y +44012 OH -5.0 Y +44017 OH -5.0 Y +44021 OH -5.0 Y +44022 OH -5.0 Y +44023 OH -5.0 Y +44024 OH -5.0 Y +44026 OH -5.0 Y +44028 OH -5.0 Y +44030 OH -5.0 Y +44032 OH -5.0 Y +44033 OH -5.0 Y +44035 OH -5.0 Y +44036 OH -5.0 Y +44039 OH -5.0 Y +44040 OH -5.0 Y +44041 OH -5.0 Y +44044 OH -5.0 Y +44045 OH -5.0 Y +44046 OH -5.0 Y +44047 OH -5.0 Y +44048 OH -5.0 Y +44049 OH -5.0 Y +44050 OH -5.0 Y +44052 OH -5.0 Y +44053 OH -5.0 Y +44054 OH -5.0 Y +44055 OH -5.0 Y +44056 OH -5.0 Y +44057 OH -5.0 Y +44060 OH -5.0 Y +44061 OH -5.0 Y +44062 OH -5.0 Y +44064 OH -5.0 Y +44065 OH -5.0 Y +44067 OH -5.0 Y +44068 OH -5.0 Y +44070 OH -5.0 Y +44072 OH -5.0 Y +44073 OH -5.0 Y +44074 OH -5.0 Y +44076 OH -5.0 Y +44077 OH -5.0 Y +44080 OH -5.0 Y +44081 OH -5.0 Y +44082 OH -5.0 Y +44084 OH -5.0 Y +44085 OH -5.0 Y +44086 OH -5.0 Y +44087 OH -5.0 Y +44088 OH -5.0 Y +44089 OH -5.0 Y +44090 OH -5.0 Y +44092 OH -5.0 Y +44093 OH -5.0 Y +44094 OH -5.0 Y +44095 OH -5.0 Y +44096 OH -5.0 Y +44097 OH -5.0 Y +44099 OH -5.0 Y +44101 OH -5.0 Y +44102 OH -5.0 Y +44103 OH -5.0 Y +44104 OH -5.0 Y +44105 OH -5.0 Y +44106 OH -5.0 Y +44107 OH -5.0 Y +44108 OH -5.0 Y +44109 OH -5.0 Y +44110 OH -5.0 Y +44111 OH -5.0 Y +44112 OH -5.0 Y +44113 OH -5.0 Y +44114 OH -5.0 Y +44115 OH -5.0 Y +44116 OH -5.0 Y +44117 OH -5.0 Y +44118 OH -5.0 Y +44119 OH -5.0 Y +44120 OH -5.0 Y +44121 OH -5.0 Y +44122 OH -5.0 Y +44123 OH -5.0 Y +44124 OH -5.0 Y +44125 OH -5.0 Y +44126 OH -5.0 Y +44127 OH -5.0 Y +44128 OH -5.0 Y +44129 OH -5.0 Y +44130 OH -5.0 Y +44131 OH -5.0 Y +44132 OH -5.0 Y +44133 OH -5.0 Y +44134 OH -5.0 Y +44135 OH -5.0 Y +44136 OH -5.0 Y +44137 OH -5.0 Y +44138 OH -5.0 Y +44139 OH -5.0 Y +44140 OH -5.0 Y +44141 OH -5.0 Y +44142 OH -5.0 Y +44143 OH -5.0 Y +44144 OH -5.0 Y +44145 OH -5.0 Y +44146 OH -5.0 Y +44147 OH -5.0 Y +44149 OH -5.0 Y +44178 OH -5.0 Y +44181 OH -5.0 Y +44185 OH -5.0 Y +44188 OH -5.0 Y +44189 OH -5.0 Y +44190 OH -5.0 Y +44191 OH -5.0 Y +44192 OH -5.0 Y +44193 OH -5.0 Y +44194 OH -5.0 Y +44195 OH -5.0 Y +44197 OH -5.0 Y +44198 OH -5.0 Y +44199 OH -5.0 Y +44201 OH -5.0 Y +44202 OH -5.0 Y +44203 OH -5.0 Y +44210 OH -5.0 Y +44211 OH -5.0 Y +44212 OH -5.0 Y +44214 OH -5.0 Y +44215 OH -5.0 Y +44216 OH -5.0 Y +44217 OH -5.0 Y +44221 OH -5.0 Y +44222 OH -5.0 Y +44223 OH -5.0 Y +44224 OH -5.0 Y +44230 OH -5.0 Y +44231 OH -5.0 Y +44232 OH -5.0 Y +44233 OH -5.0 Y +44234 OH -5.0 Y +44235 OH -5.0 Y +44236 OH -5.0 Y +44237 OH -5.0 Y +44240 OH -5.0 Y +44241 OH -5.0 Y +44242 OH -5.0 Y +44243 OH -5.0 Y +44250 OH -5.0 Y +44251 OH -5.0 Y +44253 OH -5.0 Y +44254 OH -5.0 Y +44255 OH -5.0 Y +44256 OH -5.0 Y +44258 OH -5.0 Y +44260 OH -5.0 Y +44262 OH -5.0 Y +44264 OH -5.0 Y +44265 OH -5.0 Y +44266 OH -5.0 Y +44270 OH -5.0 Y +44272 OH -5.0 Y +44273 OH -5.0 Y +44274 OH -5.0 Y +44275 OH -5.0 Y +44276 OH -5.0 Y +44278 OH -5.0 Y +44280 OH -5.0 Y +44281 OH -5.0 Y +44282 OH -5.0 Y +44285 OH -5.0 Y +44286 OH -5.0 Y +44287 OH -5.0 Y +44288 OH -5.0 Y +44301 OH -5.0 Y +44302 OH -5.0 Y +44303 OH -5.0 Y +44304 OH -5.0 Y +44305 OH -5.0 Y +44306 OH -5.0 Y +44307 OH -5.0 Y +44308 OH -5.0 Y +44309 OH -5.0 Y +44310 OH -5.0 Y +44311 OH -5.0 Y +44312 OH -5.0 Y +44313 OH -5.0 Y +44314 OH -5.0 Y +44315 OH -5.0 Y +44316 OH -5.0 Y +44317 OH -5.0 Y +44319 OH -5.0 Y +44320 OH -5.0 Y +44321 OH -5.0 Y +44322 OH -5.0 Y +44325 OH -5.0 Y +44326 OH -5.0 Y +44328 OH -5.0 Y +44333 OH -5.0 Y +44334 OH -5.0 Y +44372 OH -5.0 Y +44393 OH -5.0 Y +44396 OH -5.0 Y +44398 OH -5.0 Y +44399 OH -5.0 Y +44401 OH -5.0 Y +44402 OH -5.0 Y +44403 OH -5.0 Y +44404 OH -5.0 Y +44405 OH -5.0 Y +44406 OH -5.0 Y +44408 OH -5.0 Y +44410 OH -5.0 Y +44411 OH -5.0 Y +44412 OH -5.0 Y +44413 OH -5.0 Y +44415 OH -5.0 Y +44416 OH -5.0 Y +44417 OH -5.0 Y +44418 OH -5.0 Y +44420 OH -5.0 Y +44422 OH -5.0 Y +44423 OH -5.0 Y +44424 OH -5.0 Y +44425 OH -5.0 Y +44427 OH -5.0 Y +44428 OH -5.0 Y +44429 OH -5.0 Y +44430 OH -5.0 Y +44431 OH -5.0 Y +44432 OH -5.0 Y +44436 OH -5.0 Y +44437 OH -5.0 Y +44438 OH -5.0 Y +44439 OH -5.0 Y +44440 OH -5.0 Y +44441 OH -5.0 Y +44442 OH -5.0 Y +44443 OH -5.0 Y +44444 OH -5.0 Y +44445 OH -5.0 Y +44446 OH -5.0 Y +44449 OH -5.0 Y +44450 OH -5.0 Y +44451 OH -5.0 Y +44452 OH -5.0 Y +44453 OH -5.0 Y +44454 OH -5.0 Y +44455 OH -5.0 Y +44460 OH -5.0 Y +44470 OH -5.0 Y +44471 OH -5.0 Y +44473 OH -5.0 Y +44481 OH -5.0 Y +44482 OH -5.0 Y +44483 OH -5.0 Y +44484 OH -5.0 Y +44485 OH -5.0 Y +44486 OH -5.0 Y +44488 OH -5.0 Y +44490 OH -5.0 Y +44491 OH -5.0 Y +44492 OH -5.0 Y +44493 OH -5.0 Y +44501 OH -5.0 Y +44502 OH -5.0 Y +44503 OH -5.0 Y +44504 OH -5.0 Y +44505 OH -5.0 Y +44506 OH -5.0 Y +44507 OH -5.0 Y +44509 OH -5.0 Y +44510 OH -5.0 Y +44511 OH -5.0 Y +44512 OH -5.0 Y +44513 OH -5.0 Y +44514 OH -5.0 Y +44515 OH -5.0 Y +44555 OH -5.0 Y +44601 OH -5.0 Y +44606 OH -5.0 Y +44607 OH -5.0 Y +44608 OH -5.0 Y +44609 OH -5.0 Y +44610 OH -5.0 Y +44611 OH -5.0 Y +44612 OH -5.0 Y +44613 OH -5.0 Y +44614 OH -5.0 Y +44615 OH -5.0 Y +44617 OH -5.0 Y +44618 OH -5.0 Y +44619 OH -5.0 Y +44620 OH -5.0 Y +44621 OH -5.0 Y +44622 OH -5.0 Y +44624 OH -5.0 Y +44625 OH -5.0 Y +44626 OH -5.0 Y +44627 OH -5.0 Y +44628 OH -5.0 Y +44629 OH -5.0 Y +44630 OH -5.0 Y +44631 OH -5.0 Y +44632 OH -5.0 Y +44633 OH -5.0 Y +44634 OH -5.0 Y +44636 OH -5.0 Y +44637 OH -5.0 Y +44638 OH -5.0 Y +44639 OH -5.0 Y +44640 OH -5.0 Y +44641 OH -5.0 Y +44643 OH -5.0 Y +44644 OH -5.0 Y +44645 OH -5.0 Y +44646 OH -5.0 Y +44647 OH -5.0 Y +44648 OH -5.0 Y +44650 OH -5.0 Y +44651 OH -5.0 Y +44652 OH -5.0 Y +44653 OH -5.0 Y +44654 OH -5.0 Y +44656 OH -5.0 Y +44657 OH -5.0 Y +44659 OH -5.0 Y +44660 OH -5.0 Y +44661 OH -5.0 Y +44662 OH -5.0 Y +44663 OH -5.0 Y +44665 OH -5.0 Y +44666 OH -5.0 Y +44667 OH -5.0 Y +44669 OH -5.0 Y +44670 OH -5.0 Y +44671 OH -5.0 Y +44672 OH -5.0 Y +44675 OH -5.0 Y +44676 OH -5.0 Y +44677 OH -5.0 Y +44678 OH -5.0 Y +44679 OH -5.0 Y +44680 OH -5.0 Y +44681 OH -5.0 Y +44682 OH -5.0 Y +44683 OH -5.0 Y +44685 OH -5.0 Y +44687 OH -5.0 Y +44688 OH -5.0 Y +44689 OH -5.0 Y +44690 OH -5.0 Y +44691 OH -5.0 Y +44693 OH -5.0 Y +44695 OH -5.0 Y +44697 OH -5.0 Y +44699 OH -5.0 Y +44701 OH -5.0 Y +44702 OH -5.0 Y +44703 OH -5.0 Y +44704 OH -5.0 Y +44705 OH -5.0 Y +44706 OH -5.0 Y +44707 OH -5.0 Y +44708 OH -5.0 Y +44709 OH -5.0 Y +44710 OH -5.0 Y +44711 OH -5.0 Y +44712 OH -5.0 Y +44714 OH -5.0 Y +44718 OH -5.0 Y +44720 OH -5.0 Y +44721 OH -5.0 Y +44730 OH -5.0 Y +44735 OH -5.0 Y +44750 OH -5.0 Y +44767 OH -5.0 Y +44799 OH -5.0 Y +44802 OH -5.0 Y +44804 OH -5.0 Y +44805 OH -5.0 Y +44807 OH -5.0 Y +44809 OH -5.0 Y +44811 OH -5.0 Y +44813 OH -5.0 Y +44814 OH -5.0 Y +44815 OH -5.0 Y +44816 OH -5.0 Y +44817 OH -5.0 Y +44818 OH -5.0 Y +44820 OH -5.0 Y +44822 OH -5.0 Y +44824 OH -5.0 Y +44825 OH -5.0 Y +44826 OH -5.0 Y +44827 OH -5.0 Y +44828 OH -5.0 Y +44830 OH -5.0 Y +44833 OH -5.0 Y +44836 OH -5.0 Y +44837 OH -5.0 Y +44838 OH -5.0 Y +44839 OH -5.0 Y +44840 OH -5.0 Y +44841 OH -5.0 Y +44842 OH -5.0 Y +44843 OH -5.0 Y +44844 OH -5.0 Y +44845 OH -5.0 Y +44846 OH -5.0 Y +44847 OH -5.0 Y +44848 OH -5.0 Y +44849 OH -5.0 Y +44850 OH -5.0 Y +44851 OH -5.0 Y +44853 OH -5.0 Y +44854 OH -5.0 Y +44855 OH -5.0 Y +44856 OH -5.0 Y +44857 OH -5.0 Y +44859 OH -5.0 Y +44860 OH -5.0 Y +44861 OH -5.0 Y +44862 OH -5.0 Y +44864 OH -5.0 Y +44865 OH -5.0 Y +44866 OH -5.0 Y +44867 OH -5.0 Y +44870 OH -5.0 Y +44871 OH -5.0 Y +44874 OH -5.0 Y +44875 OH -5.0 Y +44878 OH -5.0 Y +44880 OH -5.0 Y +44881 OH -5.0 Y +44882 OH -5.0 Y +44883 OH -5.0 Y +44887 OH -5.0 Y +44888 OH -5.0 Y +44889 OH -5.0 Y +44890 OH -5.0 Y +44901 OH -5.0 Y +44902 OH -5.0 Y +44903 OH -5.0 Y +44904 OH -5.0 Y +44905 OH -5.0 Y +44906 OH -5.0 Y +44907 OH -5.0 Y +44999 OH -5.0 Y +45001 OH -5.0 Y +45002 OH -5.0 Y +45003 OH -5.0 Y +45004 OH -5.0 Y +45005 OH -5.0 Y +45011 OH -5.0 Y +45012 OH -5.0 Y +45013 OH -5.0 Y +45014 OH -5.0 Y +45015 OH -5.0 Y +45018 OH -5.0 Y +45025 OH -5.0 Y +45026 OH -5.0 Y +45030 OH -5.0 Y +45032 OH -5.0 Y +45033 OH -5.0 Y +45034 OH -5.0 Y +45036 OH -5.0 Y +45039 OH -5.0 Y +45040 OH -5.0 Y +45041 OH -5.0 Y +45042 OH -5.0 Y +45043 OH -5.0 Y +45044 OH -5.0 Y +45050 OH -5.0 Y +45051 OH -5.0 Y +45052 OH -5.0 Y +45053 OH -5.0 Y +45054 OH -5.0 Y +45055 OH -5.0 Y +45056 OH -5.0 Y +45061 OH -5.0 Y +45062 OH -5.0 Y +45063 OH -5.0 Y +45064 OH -5.0 Y +45065 OH -5.0 Y +45066 OH -5.0 Y +45067 OH -5.0 Y +45068 OH -5.0 Y +45069 OH -5.0 Y +45070 OH -5.0 Y +45071 OH -5.0 Y +45101 OH -5.0 Y +45102 OH -5.0 Y +45103 OH -5.0 Y +45105 OH -5.0 Y +45106 OH -5.0 Y +45107 OH -5.0 Y +45110 OH -5.0 Y +45111 OH -5.0 Y +45112 OH -5.0 Y +45113 OH -5.0 Y +45114 OH -5.0 Y +45115 OH -5.0 Y +45118 OH -5.0 Y +45119 OH -5.0 Y +45120 OH -5.0 Y +45121 OH -5.0 Y +45122 OH -5.0 Y +45123 OH -5.0 Y +45130 OH -5.0 Y +45131 OH -5.0 Y +45132 OH -5.0 Y +45133 OH -5.0 Y +45135 OH -5.0 Y +45138 OH -5.0 Y +45140 OH -5.0 Y +45142 OH -5.0 Y +45144 OH -5.0 Y +45145 OH -5.0 Y +45146 OH -5.0 Y +45147 OH -5.0 Y +45148 OH -5.0 Y +45150 OH -5.0 Y +45152 OH -5.0 Y +45153 OH -5.0 Y +45154 OH -5.0 Y +45155 OH -5.0 Y +45156 OH -5.0 Y +45157 OH -5.0 Y +45158 OH -5.0 Y +45159 OH -5.0 Y +45160 OH -5.0 Y +45162 OH -5.0 Y +45164 OH -5.0 Y +45166 OH -5.0 Y +45167 OH -5.0 Y +45168 OH -5.0 Y +45169 OH -5.0 Y +45171 OH -5.0 Y +45172 OH -5.0 Y +45174 OH -5.0 Y +45176 OH -5.0 Y +45177 OH -5.0 Y +45201 OH -5.0 Y +45202 OH -5.0 Y +45203 OH -5.0 Y +45204 OH -5.0 Y +45205 OH -5.0 Y +45206 OH -5.0 Y +45207 OH -5.0 Y +45208 OH -5.0 Y +45209 OH -5.0 Y +45211 OH -5.0 Y +45212 OH -5.0 Y +45213 OH -5.0 Y +45214 OH -5.0 Y +45215 OH -5.0 Y +45216 OH -5.0 Y +45217 OH -5.0 Y +45218 OH -5.0 Y +45219 OH -5.0 Y +45220 OH -5.0 Y +45221 OH -5.0 Y +45222 OH -5.0 Y +45223 OH -5.0 Y +45224 OH -5.0 Y +45225 OH -5.0 Y +45226 OH -5.0 Y +45227 OH -5.0 Y +45228 OH -5.0 Y +45229 OH -5.0 Y +45230 OH -5.0 Y +45231 OH -5.0 Y +45232 OH -5.0 Y +45233 OH -5.0 Y +45234 OH -5.0 Y +45235 OH -5.0 Y +45236 OH -5.0 Y +45237 OH -5.0 Y +45238 OH -5.0 Y +45239 OH -5.0 Y +45240 OH -5.0 Y +45241 OH -5.0 Y +45242 OH -5.0 Y +45243 OH -5.0 Y +45244 OH -5.0 Y +45245 OH -5.0 Y +45246 OH -5.0 Y +45247 OH -5.0 Y +45248 OH -5.0 Y +45249 OH -5.0 Y +45250 OH -5.0 Y +45251 OH -5.0 Y +45252 OH -5.0 Y +45253 OH -5.0 Y +45254 OH -5.0 Y +45255 OH -5.0 Y +45258 OH -5.0 Y +45262 OH -5.0 Y +45263 OH -5.0 Y +45264 OH -5.0 Y +45267 OH -5.0 Y +45268 OH -5.0 Y +45269 OH -5.0 Y +45270 OH -5.0 Y +45271 OH -5.0 Y +45273 OH -5.0 Y +45274 OH -5.0 Y +45275 OH -5.0 Y +45277 OH -5.0 Y +45280 OH -5.0 Y +45296 OH -5.0 Y +45298 OH -5.0 Y +45299 OH -5.0 Y +45301 OH -5.0 Y +45302 OH -5.0 Y +45303 OH -5.0 Y +45304 OH -5.0 Y +45305 OH -5.0 Y +45306 OH -5.0 Y +45307 OH -5.0 Y +45308 OH -5.0 Y +45309 OH -5.0 Y +45310 OH -5.0 Y +45311 OH -5.0 Y +45312 OH -5.0 Y +45314 OH -5.0 Y +45315 OH -5.0 Y +45316 OH -5.0 Y +45317 OH -5.0 Y +45318 OH -5.0 Y +45319 OH -5.0 Y +45320 OH -5.0 Y +45321 OH -5.0 Y +45322 OH -5.0 Y +45323 OH -5.0 Y +45324 OH -5.0 Y +45325 OH -5.0 Y +45326 OH -5.0 Y +45327 OH -5.0 Y +45328 OH -5.0 Y +45330 OH -5.0 Y +45331 OH -5.0 Y +45332 OH -5.0 Y +45333 OH -5.0 Y +45334 OH -5.0 Y +45335 OH -5.0 Y +45336 OH -5.0 Y +45337 OH -5.0 Y +45338 OH -5.0 Y +45339 OH -5.0 Y +45340 OH -5.0 Y +45341 OH -5.0 Y +45342 OH -5.0 Y +45343 OH -5.0 Y +45344 OH -5.0 Y +45345 OH -5.0 Y +45346 OH -5.0 Y +45347 OH -5.0 Y +45348 OH -5.0 Y +45349 OH -5.0 Y +45350 OH -5.0 Y +45351 OH -5.0 Y +45352 OH -5.0 Y +45353 OH -5.0 Y +45354 OH -5.0 Y +45356 OH -5.0 Y +45358 OH -5.0 Y +45359 OH -5.0 Y +45360 OH -5.0 Y +45361 OH -5.0 Y +45362 OH -5.0 Y +45363 OH -5.0 Y +45365 OH -5.0 Y +45367 OH -5.0 Y +45368 OH -5.0 Y +45369 OH -5.0 Y +45370 OH -5.0 Y +45371 OH -5.0 Y +45372 OH -5.0 Y +45373 OH -5.0 Y +45374 OH -5.0 Y +45377 OH -5.0 Y +45378 OH -5.0 Y +45380 OH -5.0 Y +45381 OH -5.0 Y +45382 OH -5.0 Y +45383 OH -5.0 Y +45384 OH -5.0 Y +45385 OH -5.0 Y +45387 OH -5.0 Y +45388 OH -5.0 Y +45389 OH -5.0 Y +45390 OH -5.0 Y +45401 OH -5.0 Y +45402 OH -5.0 Y +45403 OH -5.0 Y +45404 OH -5.0 Y +45405 OH -5.0 Y +45406 OH -5.0 Y +45408 OH -5.0 Y +45409 OH -5.0 Y +45410 OH -5.0 Y +45412 OH -5.0 Y +45413 OH -5.0 Y +45414 OH -5.0 Y +45415 OH -5.0 Y +45416 OH -5.0 Y +45417 OH -5.0 Y +45418 OH -5.0 Y +45419 OH -5.0 Y +45420 OH -5.0 Y +45422 OH -5.0 Y +45423 OH -5.0 Y +45424 OH -5.0 Y +45426 OH -5.0 Y +45427 OH -5.0 Y +45428 OH -5.0 Y +45429 OH -5.0 Y +45430 OH -5.0 Y +45431 OH -5.0 Y +45432 OH -5.0 Y +45433 OH -5.0 Y +45434 OH -5.0 Y +45435 OH -5.0 Y +45437 OH -5.0 Y +45439 OH -5.0 Y +45440 OH -5.0 Y +45441 OH -5.0 Y +45448 OH -5.0 Y +45449 OH -5.0 Y +45454 OH -5.0 Y +45458 OH -5.0 Y +45459 OH -5.0 Y +45463 OH -5.0 Y +45469 OH -5.0 Y +45470 OH -5.0 Y +45475 OH -5.0 Y +45479 OH -5.0 Y +45481 OH -5.0 Y +45482 OH -5.0 Y +45490 OH -5.0 Y +45501 OH -5.0 Y +45502 OH -5.0 Y +45503 OH -5.0 Y +45504 OH -5.0 Y +45505 OH -5.0 Y +45506 OH -5.0 Y +45601 OH -5.0 Y +45612 OH -5.0 Y +45613 OH -5.0 Y +45614 OH -5.0 Y +45616 OH -5.0 Y +45617 OH -5.0 Y +45618 OH -5.0 Y +45619 OH -5.0 Y +45620 OH -5.0 Y +45621 OH -5.0 Y +45622 OH -5.0 Y +45623 OH -5.0 Y +45624 OH -5.0 Y +45628 OH -5.0 Y +45629 OH -5.0 Y +45630 OH -5.0 Y +45631 OH -5.0 Y +45633 OH -5.0 Y +45634 OH -5.0 Y +45636 OH -5.0 Y +45638 OH -5.0 Y +45640 OH -5.0 Y +45642 OH -5.0 Y +45643 OH -5.0 Y +45644 OH -5.0 Y +45645 OH -5.0 Y +45646 OH -5.0 Y +45647 OH -5.0 Y +45648 OH -5.0 Y +45650 OH -5.0 Y +45651 OH -5.0 Y +45652 OH -5.0 Y +45653 OH -5.0 Y +45654 OH -5.0 Y +45656 OH -5.0 Y +45657 OH -5.0 Y +45658 OH -5.0 Y +45659 OH -5.0 Y +45660 OH -5.0 Y +45661 OH -5.0 Y +45662 OH -5.0 Y +45663 OH -5.0 Y +45669 OH -5.0 Y +45671 OH -5.0 Y +45672 OH -5.0 Y +45673 OH -5.0 Y +45674 OH -5.0 Y +45675 OH -5.0 Y +45677 OH -5.0 Y +45678 OH -5.0 Y +45679 OH -5.0 Y +45680 OH -5.0 Y +45681 OH -5.0 Y +45682 OH -5.0 Y +45683 OH -5.0 Y +45684 OH -5.0 Y +45685 OH -5.0 Y +45686 OH -5.0 Y +45687 OH -5.0 Y +45688 OH -5.0 Y +45690 OH -5.0 Y +45692 OH -5.0 Y +45693 OH -5.0 Y +45694 OH -5.0 Y +45695 OH -5.0 Y +45696 OH -5.0 Y +45697 OH -5.0 Y +45698 OH -5.0 Y +45699 OH -5.0 Y +45701 OH -5.0 Y +45710 OH -5.0 Y +45711 OH -5.0 Y +45712 OH -5.0 Y +45713 OH -5.0 Y +45714 OH -5.0 Y +45715 OH -5.0 Y +45716 OH -5.0 Y +45717 OH -5.0 Y +45719 OH -5.0 Y +45720 OH -5.0 Y +45721 OH -5.0 Y +45723 OH -5.0 Y +45724 OH -5.0 Y +45727 OH -5.0 Y +45729 OH -5.0 Y +45732 OH -5.0 Y +45734 OH -5.0 Y +45735 OH -5.0 Y +45739 OH -5.0 Y +45740 OH -5.0 Y +45741 OH -5.0 Y +45742 OH -5.0 Y +45743 OH -5.0 Y +45744 OH -5.0 Y +45745 OH -5.0 Y +45746 OH -5.0 Y +45750 OH -5.0 Y +45760 OH -5.0 Y +45761 OH -5.0 Y +45764 OH -5.0 Y +45766 OH -5.0 Y +45767 OH -5.0 Y +45768 OH -5.0 Y +45769 OH -5.0 Y +45770 OH -5.0 Y +45771 OH -5.0 Y +45772 OH -5.0 Y +45773 OH -5.0 Y +45775 OH -5.0 Y +45776 OH -5.0 Y +45777 OH -5.0 Y +45778 OH -5.0 Y +45779 OH -5.0 Y +45780 OH -5.0 Y +45782 OH -5.0 Y +45783 OH -5.0 Y +45784 OH -5.0 Y +45786 OH -5.0 Y +45787 OH -5.0 Y +45788 OH -5.0 Y +45789 OH -5.0 Y +45801 OH -5.0 Y +45802 OH -5.0 Y +45804 OH -5.0 Y +45805 OH -5.0 Y +45806 OH -5.0 Y +45807 OH -5.0 Y +45808 OH -5.0 Y +45809 OH -5.0 Y +45810 OH -5.0 Y +45812 OH -5.0 Y +45813 OH -5.0 Y +45814 OH -5.0 Y +45815 OH -5.0 Y +45816 OH -5.0 Y +45817 OH -5.0 Y +45819 OH -5.0 Y +45820 OH -5.0 Y +45821 OH -5.0 Y +45822 OH -5.0 Y +45826 OH -5.0 Y +45827 OH -5.0 Y +45828 OH -5.0 Y +45830 OH -5.0 Y +45831 OH -5.0 Y +45832 OH -5.0 Y +45833 OH -5.0 Y +45835 OH -5.0 Y +45836 OH -5.0 Y +45837 OH -5.0 Y +45838 OH -5.0 Y +45839 OH -5.0 Y +45840 OH -5.0 Y +45841 OH -5.0 Y +45843 OH -5.0 Y +45844 OH -5.0 Y +45845 OH -5.0 Y +45846 OH -5.0 Y +45848 OH -5.0 Y +45849 OH -5.0 Y +45850 OH -5.0 Y +45851 OH -5.0 Y +45853 OH -5.0 Y +45854 OH -5.0 Y +45855 OH -5.0 Y +45856 OH -5.0 Y +45858 OH -5.0 Y +45859 OH -5.0 Y +45860 OH -5.0 Y +45861 OH -5.0 Y +45862 OH -5.0 Y +45863 OH -5.0 Y +45864 OH -5.0 Y +45865 OH -5.0 Y +45866 OH -5.0 Y +45867 OH -5.0 Y +45868 OH -5.0 Y +45869 OH -5.0 Y +45870 OH -5.0 Y +45871 OH -5.0 Y +45872 OH -5.0 Y +45873 OH -5.0 Y +45874 OH -5.0 Y +45875 OH -5.0 Y +45876 OH -5.0 Y +45877 OH -5.0 Y +45879 OH -5.0 Y +45880 OH -5.0 Y +45881 OH -5.0 Y +45882 OH -5.0 Y +45883 OH -5.0 Y +45884 OH -5.0 Y +45885 OH -5.0 Y +45886 OH -5.0 Y +45887 OH -5.0 Y +45888 OH -5.0 Y +45889 OH -5.0 Y +45890 OH -5.0 Y +45891 OH -5.0 Y +45893 OH -5.0 Y +45894 OH -5.0 Y +45895 OH -5.0 Y +45896 OH -5.0 Y +45897 OH -5.0 Y +45898 OH -5.0 Y +45899 OH -5.0 Y +45999 OH -5.0 Y +46001 IN -5.0 Y +46011 IN -5.0 Y +46012 IN -5.0 Y +46013 IN -5.0 Y +46014 IN -5.0 Y +46015 IN -5.0 Y +46016 IN -5.0 Y +46017 IN -5.0 Y +46018 IN -5.0 Y +46030 IN -5.0 Y +46031 IN -5.0 Y +46032 IN -5.0 Y +46033 IN -5.0 Y +46034 IN -5.0 Y +46035 IN -5.0 Y +46036 IN -5.0 Y +46037 IN -5.0 Y +46038 IN -5.0 Y +46039 IN -5.0 Y +46040 IN -5.0 Y +46041 IN -5.0 Y +46044 IN -5.0 Y +46045 IN -5.0 Y +46047 IN -5.0 Y +46048 IN -5.0 Y +46049 IN -5.0 Y +46050 IN -5.0 Y +46051 IN -5.0 Y +46052 IN -5.0 Y +46055 IN -5.0 Y +46056 IN -5.0 Y +46057 IN -5.0 Y +46058 IN -5.0 Y +46060 IN -5.0 Y +46061 IN -5.0 Y +46062 IN -5.0 Y +46063 IN -5.0 Y +46064 IN -5.0 Y +46065 IN -5.0 Y +46067 IN -5.0 Y +46068 IN -5.0 Y +46069 IN -5.0 Y +46070 IN -5.0 Y +46071 IN -5.0 Y +46072 IN -5.0 Y +46074 IN -5.0 Y +46075 IN -5.0 Y +46076 IN -5.0 Y +46077 IN -5.0 Y +46082 IN -5.0 Y +46102 IN -5.0 Y +46103 IN -5.0 Y +46104 IN -5.0 Y +46105 IN -5.0 Y +46106 IN -5.0 Y +46107 IN -5.0 Y +46110 IN -5.0 Y +46111 IN -5.0 Y +46112 IN -5.0 Y +46113 IN -5.0 Y +46115 IN -5.0 Y +46117 IN -5.0 Y +46118 IN -5.0 Y +46120 IN -5.0 Y +46121 IN -5.0 Y +46122 IN -5.0 Y +46123 IN -5.0 Y +46124 IN -5.0 Y +46125 IN -5.0 Y +46126 IN -5.0 Y +46127 IN -5.0 Y +46128 IN -5.0 Y +46129 IN -5.0 Y +46130 IN -5.0 Y +46131 IN -5.0 Y +46133 IN -5.0 Y +46135 IN -5.0 Y +46140 IN -5.0 Y +46142 IN -5.0 Y +46143 IN -5.0 Y +46144 IN -5.0 Y +46146 IN -5.0 Y +46147 IN -5.0 Y +46148 IN -5.0 Y +46149 IN -5.0 Y +46150 IN -5.0 Y +46151 IN -5.0 Y +46154 IN -5.0 Y +46155 IN -5.0 Y +46156 IN -5.0 Y +46157 IN -5.0 Y +46158 IN -5.0 Y +46160 IN -5.0 Y +46161 IN -5.0 Y +46162 IN -5.0 Y +46163 IN -5.0 Y +46164 IN -5.0 Y +46165 IN -5.0 Y +46166 IN -5.0 Y +46167 IN -5.0 Y +46168 IN -5.0 Y +46170 IN -5.0 Y +46171 IN -5.0 Y +46172 IN -5.0 Y +46173 IN -5.0 Y +46175 IN -5.0 Y +46176 IN -5.0 Y +46180 IN -5.0 Y +46181 IN -5.0 Y +46182 IN -5.0 Y +46183 IN -5.0 Y +46184 IN -5.0 Y +46186 IN -5.0 Y +46201 IN -5.0 Y +46202 IN -5.0 Y +46203 IN -5.0 Y +46204 IN -5.0 Y +46205 IN -5.0 Y +46206 IN -5.0 Y +46207 IN -5.0 Y +46208 IN -5.0 Y +46209 IN -5.0 Y +46211 IN -5.0 Y +46214 IN -5.0 Y +46216 IN -5.0 Y +46217 IN -5.0 Y +46218 IN -5.0 Y +46219 IN -5.0 Y +46220 IN -5.0 Y +46221 IN -5.0 Y +46222 IN -5.0 Y +46223 IN -5.0 Y +46224 IN -5.0 Y +46225 IN -5.0 Y +46226 IN -5.0 Y +46227 IN -5.0 Y +46228 IN -5.0 Y +46229 IN -5.0 Y +46230 IN -5.0 Y +46231 IN -5.0 Y +46234 IN -5.0 Y +46235 IN -5.0 Y +46236 IN -5.0 Y +46237 IN -5.0 Y +46239 IN -5.0 Y +46240 IN -5.0 Y +46241 IN -5.0 Y +46242 IN -5.0 Y +46244 IN -5.0 Y +46247 IN -5.0 Y +46249 IN -5.0 Y +46250 IN -5.0 Y +46251 IN -5.0 Y +46253 IN -5.0 Y +46254 IN -5.0 Y +46255 IN -5.0 Y +46256 IN -5.0 Y +46259 IN -5.0 Y +46260 IN -5.0 Y +46266 IN -5.0 Y +46268 IN -5.0 Y +46274 IN -5.0 Y +46275 IN -5.0 Y +46277 IN -5.0 Y +46278 IN -5.0 Y +46280 IN -5.0 Y +46282 IN -5.0 Y +46283 IN -5.0 Y +46285 IN -5.0 Y +46290 IN -5.0 Y +46291 IN -5.0 Y +46295 IN -5.0 Y +46296 IN -5.0 Y +46298 IN -5.0 Y +46301 IN -6.0 Y +46302 IN -6.0 Y +46303 IN -6.0 Y +46304 IN -6.0 Y +46307 IN -6.0 Y +46308 IN -6.0 Y +46310 IN -6.0 Y +46311 IN -6.0 Y +46312 IN -6.0 Y +46319 IN -6.0 Y +46320 IN -6.0 Y +46321 IN -6.0 Y +46322 IN -6.0 Y +46323 IN -6.0 Y +46324 IN -6.0 Y +46325 IN -6.0 Y +46327 IN -6.0 Y +46340 IN -6.0 Y +46341 IN -6.0 Y +46342 IN -6.0 Y +46345 IN -6.0 Y +46346 IN -6.0 Y +46347 IN -6.0 Y +46348 IN -6.0 Y +46349 IN -6.0 Y +46350 IN -6.0 Y +46352 IN -6.0 Y +46355 IN -6.0 Y +46356 IN -6.0 Y +46360 IN -6.0 Y +46361 IN -6.0 Y +46365 IN -6.0 Y +46366 IN -6.0 Y +46368 IN -6.0 Y +46371 IN -6.0 Y +46372 IN -6.0 Y +46373 IN -6.0 Y +46374 IN -6.0 Y +46375 IN -6.0 Y +46376 IN -6.0 Y +46377 IN -6.0 Y +46379 IN -6.0 Y +46380 IN -6.0 Y +46381 IN -6.0 Y +46382 IN -6.0 Y +46383 IN -6.0 Y +46384 IN -6.0 Y +46385 IN -6.0 Y +46390 IN -6.0 Y +46391 IN -6.0 Y +46392 IN -6.0 Y +46393 IN -6.0 Y +46394 IN -6.0 Y +46401 IN -6.0 Y +46402 IN -6.0 Y +46403 IN -6.0 Y +46404 IN -6.0 Y +46405 IN -6.0 Y +46406 IN -6.0 Y +46407 IN -6.0 Y +46408 IN -6.0 Y +46409 IN -6.0 Y +46410 IN -6.0 Y +46411 IN -6.0 Y +46501 IN -5.0 Y +46502 IN -5.0 Y +46504 IN -5.0 Y +46506 IN -5.0 Y +46507 IN -5.0 Y +46508 IN -5.0 Y +46510 IN -5.0 Y +46511 IN -5.0 Y +46513 IN -5.0 Y +46514 IN -5.0 Y +46515 IN -5.0 Y +46516 IN -5.0 Y +46517 IN -5.0 Y +46524 IN -5.0 Y +46526 IN -5.0 Y +46527 IN -5.0 Y +46528 IN -5.0 Y +46530 IN -5.0 Y +46531 IN -6.0 Y +46532 IN -6.0 Y +46534 IN -6.0 Y +46536 IN -5.0 Y +46537 IN -5.0 Y +46538 IN -5.0 Y +46539 IN -5.0 Y +46540 IN -5.0 Y +46542 IN -5.0 Y +46543 IN -5.0 Y +46544 IN -5.0 Y +46545 IN -5.0 Y +46546 IN -5.0 Y +46550 IN -5.0 Y +46552 IN -5.0 Y +46553 IN -5.0 Y +46554 IN -5.0 Y +46555 IN -5.0 Y +46556 IN -5.0 Y +46561 IN -5.0 Y +46562 IN -5.0 Y +46563 IN -5.0 Y +46565 IN -5.0 Y +46567 IN -5.0 Y +46570 IN -5.0 Y +46571 IN -5.0 Y +46572 IN -5.0 Y +46573 IN -5.0 Y +46574 IN -5.0 Y +46580 IN -5.0 Y +46581 IN -5.0 Y +46582 IN -5.0 Y +46590 IN -5.0 Y +46595 IN -5.0 Y +46601 IN -5.0 Y +46604 IN -5.0 Y +46613 IN -5.0 Y +46614 IN -5.0 Y +46615 IN -5.0 Y +46616 IN -5.0 Y +46617 IN -5.0 Y +46619 IN -5.0 Y +46620 IN -5.0 Y +46624 IN -5.0 Y +46626 IN -5.0 Y +46628 IN -5.0 Y +46629 IN -5.0 Y +46634 IN -5.0 Y +46635 IN -5.0 Y +46637 IN -5.0 Y +46660 IN -5.0 Y +46680 IN -5.0 Y +46699 IN -5.0 Y +46701 IN -5.0 Y +46702 IN -5.0 Y +46703 IN -5.0 Y +46704 IN -5.0 Y +46705 IN -5.0 Y +46706 IN -5.0 Y +46710 IN -5.0 Y +46711 IN -5.0 Y +46713 IN -5.0 Y +46714 IN -5.0 Y +46721 IN -5.0 Y +46723 IN -5.0 Y +46725 IN -5.0 Y +46730 IN -5.0 Y +46731 IN -5.0 Y +46732 IN -5.0 Y +46733 IN -5.0 Y +46737 IN -5.0 Y +46738 IN -5.0 Y +46740 IN -5.0 Y +46741 IN -5.0 Y +46742 IN -5.0 Y +46743 IN -5.0 Y +46745 IN -5.0 Y +46746 IN -5.0 Y +46747 IN -5.0 Y +46748 IN -5.0 Y +46750 IN -5.0 Y +46755 IN -5.0 Y +46759 IN -5.0 Y +46760 IN -5.0 Y +46761 IN -5.0 Y +46763 IN -5.0 Y +46764 IN -5.0 Y +46765 IN -5.0 Y +46766 IN -5.0 Y +46767 IN -5.0 Y +46769 IN -5.0 Y +46770 IN -5.0 Y +46771 IN -5.0 Y +46772 IN -5.0 Y +46773 IN -5.0 Y +46774 IN -5.0 Y +46776 IN -5.0 Y +46777 IN -5.0 Y +46778 IN -5.0 Y +46779 IN -5.0 Y +46780 IN -5.0 Y +46781 IN -5.0 Y +46782 IN -5.0 Y +46783 IN -5.0 Y +46784 IN -5.0 Y +46785 IN -5.0 Y +46786 IN -5.0 Y +46787 IN -5.0 Y +46788 IN -5.0 Y +46789 IN -5.0 Y +46791 IN -5.0 Y +46792 IN -5.0 Y +46793 IN -5.0 Y +46794 IN -5.0 Y +46795 IN -5.0 Y +46796 IN -5.0 Y +46797 IN -5.0 Y +46798 IN -5.0 Y +46799 IN -5.0 Y +46801 IN -5.0 Y +46802 IN -5.0 Y +46803 IN -5.0 Y +46804 IN -5.0 Y +46805 IN -5.0 Y +46806 IN -5.0 Y +46807 IN -5.0 Y +46808 IN -5.0 Y +46809 IN -5.0 Y +46814 IN -5.0 Y +46815 IN -5.0 Y +46816 IN -5.0 Y +46818 IN -5.0 Y +46819 IN -5.0 Y +46825 IN -5.0 Y +46835 IN -5.0 Y +46845 IN -5.0 Y +46850 IN -5.0 Y +46851 IN -5.0 Y +46852 IN -5.0 Y +46853 IN -5.0 Y +46854 IN -5.0 Y +46855 IN -5.0 Y +46856 IN -5.0 Y +46857 IN -5.0 Y +46858 IN -5.0 Y +46859 IN -5.0 Y +46860 IN -5.0 Y +46861 IN -5.0 Y +46862 IN -5.0 Y +46863 IN -5.0 Y +46864 IN -5.0 Y +46865 IN -5.0 Y +46866 IN -5.0 Y +46867 IN -5.0 Y +46868 IN -5.0 Y +46869 IN -5.0 Y +46885 IN -5.0 Y +46895 IN -5.0 Y +46896 IN -5.0 Y +46897 IN -5.0 Y +46898 IN -5.0 Y +46899 IN -5.0 Y +46901 IN -5.0 Y +46902 IN -5.0 Y +46903 IN -5.0 Y +46904 IN -5.0 Y +46910 IN -5.0 Y +46911 IN -5.0 Y +46912 IN -5.0 Y +46913 IN -5.0 Y +46914 IN -5.0 Y +46915 IN -5.0 Y +46916 IN -5.0 Y +46917 IN -5.0 Y +46919 IN -5.0 Y +46920 IN -5.0 Y +46921 IN -5.0 Y +46922 IN -5.0 Y +46923 IN -5.0 Y +46926 IN -5.0 Y +46928 IN -5.0 Y +46929 IN -5.0 Y +46930 IN -5.0 Y +46931 IN -5.0 Y +46932 IN -5.0 Y +46933 IN -5.0 Y +46935 IN -5.0 Y +46936 IN -5.0 Y +46937 IN -5.0 Y +46938 IN -5.0 Y +46939 IN -5.0 Y +46940 IN -5.0 Y +46941 IN -5.0 Y +46942 IN -5.0 Y +46943 IN -5.0 Y +46945 IN -5.0 Y +46946 IN -5.0 Y +46947 IN -5.0 Y +46950 IN -5.0 Y +46951 IN -5.0 Y +46952 IN -5.0 Y +46953 IN -5.0 Y +46957 IN -5.0 Y +46958 IN -5.0 Y +46959 IN -5.0 Y +46960 IN -6.0 Y +46961 IN -5.0 Y +46962 IN -5.0 Y +46965 IN -5.0 Y +46967 IN -5.0 Y +46968 IN -6.0 Y +46970 IN -5.0 Y +46971 IN -5.0 Y +46974 IN -5.0 Y +46975 IN -5.0 Y +46977 IN -5.0 Y +46978 IN -5.0 Y +46979 IN -5.0 Y +46980 IN -5.0 Y +46982 IN -5.0 Y +46984 IN -5.0 Y +46985 IN -6.0 Y +46986 IN -5.0 Y +46987 IN -5.0 Y +46988 IN -5.0 Y +46989 IN -5.0 Y +46990 IN -5.0 Y +46991 IN -5.0 Y +46992 IN -5.0 Y +46994 IN -5.0 Y +46995 IN -5.0 Y +46996 IN -6.0 Y +46998 IN -5.0 Y +47001 IN -5.0 Y +47003 IN -5.0 Y +47006 IN -5.0 Y +47010 IN -5.0 Y +47011 IN -5.0 Y +47012 IN -5.0 Y +47016 IN -5.0 Y +47017 IN -5.0 Y +47018 IN -5.0 Y +47019 IN -5.0 Y +47020 IN -5.0 Y +47021 IN -5.0 Y +47022 IN -5.0 Y +47023 IN -5.0 Y +47024 IN -5.0 Y +47025 IN -5.0 Y +47030 IN -5.0 Y +47031 IN -5.0 Y +47032 IN -5.0 Y +47033 IN -5.0 Y +47034 IN -5.0 Y +47035 IN -5.0 Y +47036 IN -5.0 Y +47037 IN -5.0 Y +47038 IN -5.0 Y +47039 IN -5.0 Y +47040 IN -5.0 Y +47041 IN -5.0 Y +47042 IN -5.0 Y +47043 IN -5.0 Y +47060 IN -5.0 Y +47102 IN -5.0 Y +47104 IN -5.0 Y +47106 IN -5.0 Y +47107 IN -5.0 Y +47108 IN -5.0 Y +47110 IN -5.0 Y +47111 IN -5.0 Y +47112 IN -5.0 Y +47114 IN -5.0 Y +47115 IN -5.0 Y +47116 IN -5.0 Y +47117 IN -5.0 Y +47118 IN -5.0 Y +47119 IN -5.0 Y +47120 IN -5.0 Y +47122 IN -5.0 Y +47123 IN -5.0 Y +47124 IN -5.0 Y +47125 IN -5.0 Y +47126 IN -5.0 Y +47129 IN -5.0 Y +47130 IN -5.0 Y +47131 IN -5.0 Y +47132 IN -5.0 Y +47133 IN -5.0 Y +47134 IN -5.0 Y +47135 IN -5.0 Y +47136 IN -5.0 Y +47137 IN -5.0 Y +47138 IN -5.0 Y +47139 IN -5.0 Y +47140 IN -5.0 Y +47141 IN -5.0 Y +47142 IN -5.0 Y +47143 IN -5.0 Y +47144 IN -5.0 Y +47145 IN -5.0 Y +47146 IN -5.0 Y +47147 IN -5.0 Y +47150 IN -5.0 Y +47151 IN -5.0 Y +47160 IN -5.0 Y +47161 IN -5.0 Y +47162 IN -5.0 Y +47163 IN -5.0 Y +47164 IN -5.0 Y +47165 IN -5.0 Y +47166 IN -5.0 Y +47167 IN -5.0 Y +47170 IN -5.0 Y +47172 IN -5.0 Y +47174 IN -5.0 Y +47175 IN -5.0 Y +47177 IN -5.0 Y +47190 IN -5.0 Y +47199 IN -5.0 Y +47201 IN -5.0 Y +47202 IN -5.0 Y +47203 IN -5.0 Y +47220 IN -5.0 Y +47223 IN -5.0 Y +47224 IN -5.0 Y +47225 IN -5.0 Y +47226 IN -5.0 Y +47227 IN -5.0 Y +47228 IN -5.0 Y +47229 IN -5.0 Y +47230 IN -5.0 Y +47231 IN -5.0 Y +47232 IN -5.0 Y +47234 IN -5.0 Y +47235 IN -5.0 Y +47236 IN -5.0 Y +47240 IN -5.0 Y +47243 IN -5.0 Y +47244 IN -5.0 Y +47245 IN -5.0 Y +47246 IN -5.0 Y +47247 IN -5.0 Y +47249 IN -5.0 Y +47250 IN -5.0 Y +47260 IN -5.0 Y +47261 IN -5.0 Y +47263 IN -5.0 Y +47264 IN -5.0 Y +47265 IN -5.0 Y +47270 IN -5.0 Y +47272 IN -5.0 Y +47273 IN -5.0 Y +47274 IN -5.0 Y +47280 IN -5.0 Y +47281 IN -5.0 Y +47282 IN -5.0 Y +47283 IN -5.0 Y +47302 IN -5.0 Y +47303 IN -5.0 Y +47304 IN -5.0 Y +47305 IN -5.0 Y +47306 IN -5.0 Y +47307 IN -5.0 Y +47308 IN -5.0 Y +47320 IN -5.0 Y +47322 IN -5.0 Y +47324 IN -5.0 Y +47325 IN -5.0 Y +47326 IN -5.0 Y +47327 IN -5.0 Y +47330 IN -5.0 Y +47331 IN -5.0 Y +47334 IN -5.0 Y +47335 IN -5.0 Y +47336 IN -5.0 Y +47337 IN -5.0 Y +47338 IN -5.0 Y +47339 IN -5.0 Y +47340 IN -5.0 Y +47341 IN -5.0 Y +47342 IN -5.0 Y +47344 IN -5.0 Y +47345 IN -5.0 Y +47346 IN -5.0 Y +47348 IN -5.0 Y +47351 IN -5.0 Y +47352 IN -5.0 Y +47353 IN -5.0 Y +47354 IN -5.0 Y +47355 IN -5.0 Y +47356 IN -5.0 Y +47357 IN -5.0 Y +47358 IN -5.0 Y +47359 IN -5.0 Y +47360 IN -5.0 Y +47361 IN -5.0 Y +47362 IN -5.0 Y +47366 IN -5.0 Y +47367 IN -5.0 Y +47368 IN -5.0 Y +47369 IN -5.0 Y +47370 IN -5.0 Y +47371 IN -5.0 Y +47373 IN -5.0 Y +47374 IN -5.0 Y +47375 IN -5.0 Y +47380 IN -5.0 Y +47381 IN -5.0 Y +47382 IN -5.0 Y +47383 IN -5.0 Y +47384 IN -5.0 Y +47385 IN -5.0 Y +47386 IN -5.0 Y +47387 IN -5.0 Y +47388 IN -5.0 Y +47390 IN -5.0 Y +47392 IN -5.0 Y +47393 IN -5.0 Y +47394 IN -5.0 Y +47396 IN -5.0 Y +47401 IN -5.0 Y +47402 IN -5.0 Y +47403 IN -5.0 Y +47404 IN -5.0 Y +47405 IN -5.0 Y +47406 IN -5.0 Y +47407 IN -5.0 Y +47408 IN -5.0 Y +47420 IN -5.0 Y +47421 IN -5.0 Y +47424 IN -5.0 Y +47426 IN -5.0 Y +47427 IN -5.0 Y +47429 IN -5.0 Y +47430 IN -5.0 Y +47431 IN -5.0 Y +47432 IN -5.0 Y +47433 IN -5.0 Y +47434 IN -5.0 Y +47435 IN -5.0 Y +47436 IN -5.0 Y +47437 IN -5.0 Y +47438 IN -5.0 Y +47439 IN -5.0 Y +47441 IN -5.0 Y +47443 IN -5.0 Y +47445 IN -5.0 Y +47446 IN -5.0 Y +47448 IN -5.0 Y +47449 IN -5.0 Y +47451 IN -5.0 Y +47452 IN -5.0 Y +47453 IN -5.0 Y +47454 IN -5.0 Y +47455 IN -5.0 Y +47456 IN -5.0 Y +47457 IN -5.0 Y +47458 IN -5.0 Y +47459 IN -5.0 Y +47460 IN -5.0 Y +47462 IN -5.0 Y +47463 IN -5.0 Y +47464 IN -5.0 Y +47465 IN -5.0 Y +47467 IN -5.0 Y +47468 IN -5.0 Y +47469 IN -5.0 Y +47470 IN -5.0 Y +47471 IN -5.0 Y +47490 IN -5.0 Y +47501 IN -6.0 Y +47512 IN -6.0 Y +47513 IN -6.0 Y +47514 IN -6.0 Y +47515 IN -6.0 Y +47516 IN -6.0 Y +47519 IN -6.0 Y +47520 IN -6.0 Y +47521 IN -6.0 Y +47522 IN -6.0 Y +47523 IN -6.0 Y +47524 IN -6.0 Y +47525 IN -6.0 Y +47527 IN -6.0 Y +47528 IN -6.0 Y +47529 IN -6.0 Y +47531 IN -6.0 Y +47532 IN -6.0 Y +47535 IN -6.0 Y +47536 IN -6.0 Y +47537 IN -6.0 Y +47541 IN -6.0 Y +47542 IN -6.0 Y +47545 IN -6.0 Y +47546 IN -6.0 Y +47547 IN -6.0 Y +47549 IN -6.0 Y +47550 IN -6.0 Y +47551 IN -6.0 Y +47552 IN -6.0 Y +47553 IN -6.0 Y +47556 IN -6.0 Y +47557 IN -6.0 Y +47558 IN -6.0 Y +47561 IN -6.0 Y +47562 IN -6.0 Y +47564 IN -6.0 Y +47567 IN -6.0 Y +47568 IN -6.0 Y +47573 IN -6.0 Y +47574 IN -6.0 Y +47575 IN -6.0 Y +47576 IN -6.0 Y +47577 IN -6.0 Y +47578 IN -6.0 Y +47579 IN -6.0 Y +47580 IN -6.0 Y +47581 IN -6.0 Y +47584 IN -6.0 Y +47585 IN -6.0 Y +47586 IN -6.0 Y +47588 IN -6.0 Y +47590 IN -6.0 Y +47591 IN -6.0 Y +47596 IN -6.0 Y +47597 IN -6.0 Y +47598 IN -6.0 Y +47601 IN -6.0 Y +47610 IN -6.0 Y +47611 IN -6.0 Y +47612 IN -6.0 Y +47613 IN -6.0 Y +47614 IN -6.0 Y +47615 IN -6.0 Y +47616 IN -6.0 Y +47617 IN -6.0 Y +47618 IN -6.0 Y +47619 IN -6.0 Y +47620 IN -6.0 Y +47629 IN -6.0 Y +47630 IN -6.0 Y +47631 IN -6.0 Y +47633 IN -6.0 Y +47634 IN -6.0 Y +47635 IN -6.0 Y +47637 IN -6.0 Y +47638 IN -6.0 Y +47639 IN -6.0 Y +47640 IN -6.0 Y +47647 IN -6.0 Y +47648 IN -6.0 Y +47649 IN -6.0 Y +47654 IN -6.0 Y +47660 IN -6.0 Y +47665 IN -6.0 Y +47666 IN -6.0 Y +47670 IN -6.0 Y +47683 IN -6.0 Y +47701 IN -6.0 Y +47702 IN -6.0 Y +47703 IN -6.0 Y +47704 IN -6.0 Y +47705 IN -6.0 Y +47706 IN -6.0 Y +47708 IN -6.0 Y +47710 IN -6.0 Y +47711 IN -6.0 Y +47712 IN -6.0 Y +47713 IN -6.0 Y +47714 IN -6.0 Y +47715 IN -6.0 Y +47716 IN -6.0 Y +47719 IN -6.0 Y +47720 IN -6.0 Y +47721 IN -6.0 Y +47722 IN -6.0 Y +47724 IN -6.0 Y +47725 IN -6.0 Y +47727 IN -6.0 Y +47728 IN -6.0 Y +47730 IN -6.0 Y +47731 IN -6.0 Y +47732 IN -6.0 Y +47733 IN -6.0 Y +47734 IN -6.0 Y +47735 IN -6.0 Y +47736 IN -6.0 Y +47737 IN -6.0 Y +47739 IN -6.0 Y +47740 IN -6.0 Y +47741 IN -6.0 Y +47744 IN -6.0 Y +47747 IN -6.0 Y +47750 IN -6.0 Y +47801 IN -5.0 Y +47802 IN -5.0 Y +47803 IN -5.0 Y +47804 IN -5.0 Y +47805 IN -5.0 Y +47807 IN -5.0 Y +47808 IN -5.0 Y +47809 IN -5.0 Y +47811 IN -5.0 Y +47812 IN -5.0 Y +47813 IN -5.0 Y +47814 IN -5.0 Y +47830 IN -5.0 Y +47831 IN -5.0 Y +47832 IN -5.0 Y +47833 IN -5.0 Y +47834 IN -5.0 Y +47836 IN -5.0 Y +47837 IN -5.0 Y +47838 IN -5.0 Y +47840 IN -5.0 Y +47841 IN -5.0 Y +47842 IN -5.0 Y +47845 IN -5.0 Y +47846 IN -5.0 Y +47847 IN -5.0 Y +47848 IN -5.0 Y +47849 IN -5.0 Y +47850 IN -5.0 Y +47851 IN -5.0 Y +47852 IN -5.0 Y +47853 IN -5.0 Y +47854 IN -5.0 Y +47855 IN -5.0 Y +47856 IN -5.0 Y +47857 IN -5.0 Y +47858 IN -5.0 Y +47859 IN -5.0 Y +47860 IN -5.0 Y +47861 IN -5.0 Y +47862 IN -5.0 Y +47863 IN -5.0 Y +47864 IN -5.0 Y +47865 IN -5.0 Y +47866 IN -5.0 Y +47868 IN -5.0 Y +47869 IN -5.0 Y +47870 IN -5.0 Y +47871 IN -5.0 Y +47872 IN -5.0 Y +47874 IN -5.0 Y +47875 IN -5.0 Y +47876 IN -5.0 Y +47878 IN -5.0 Y +47879 IN -5.0 Y +47880 IN -5.0 Y +47881 IN -5.0 Y +47882 IN -5.0 Y +47884 IN -5.0 Y +47885 IN -5.0 Y +47901 IN -5.0 Y +47902 IN -5.0 Y +47903 IN -5.0 Y +47904 IN -5.0 Y +47905 IN -5.0 Y +47906 IN -5.0 Y +47907 IN -5.0 Y +47909 IN -5.0 Y +47916 IN -5.0 Y +47917 IN -5.0 Y +47918 IN -5.0 Y +47920 IN -5.0 Y +47921 IN -5.0 Y +47922 IN -6.0 Y +47923 IN -5.0 Y +47924 IN -5.0 Y +47925 IN -5.0 Y +47926 IN -5.0 Y +47928 IN -5.0 Y +47929 IN -5.0 Y +47930 IN -5.0 Y +47932 IN -5.0 Y +47933 IN -5.0 Y +47934 IN -5.0 Y +47935 IN -5.0 Y +47936 IN -5.0 Y +47937 IN -5.0 Y +47938 IN -5.0 Y +47939 IN -5.0 Y +47940 IN -5.0 Y +47941 IN -5.0 Y +47942 IN -5.0 Y +47943 IN -6.0 Y +47944 IN -5.0 Y +47946 IN -6.0 Y +47948 IN -6.0 Y +47949 IN -5.0 Y +47950 IN -5.0 Y +47951 IN -6.0 Y +47952 IN -5.0 Y +47954 IN -5.0 Y +47955 IN -5.0 Y +47957 IN -6.0 Y +47958 IN -5.0 Y +47959 IN -5.0 Y +47960 IN -5.0 Y +47962 IN -5.0 Y +47963 IN -6.0 Y +47964 IN -6.0 Y +47965 IN -5.0 Y +47966 IN -5.0 Y +47967 IN -5.0 Y +47968 IN -5.0 Y +47969 IN -5.0 Y +47970 IN -5.0 Y +47971 IN -5.0 Y +47974 IN -5.0 Y +47975 IN -5.0 Y +47977 IN -6.0 Y +47978 IN -6.0 Y +47980 IN -5.0 Y +47981 IN -5.0 Y +47982 IN -5.0 Y +47983 IN -5.0 Y +47984 IN -5.0 Y +47986 IN -5.0 Y +47987 IN -5.0 Y +47988 IN -5.0 Y +47989 IN -5.0 Y +47990 IN -5.0 Y +47991 IN -5.0 Y +47992 IN -5.0 Y +47993 IN -5.0 Y +47994 IN -5.0 Y +47995 IN -5.0 Y +47996 IN -5.0 Y +47997 IN -5.0 Y +48001 MI -5.0 Y +48002 MI -5.0 Y +48003 MI -5.0 Y +48004 MI -5.0 Y +48005 MI -5.0 Y +48006 MI -5.0 Y +48007 MI -5.0 Y +48009 MI -5.0 Y +48012 MI -5.0 Y +48014 MI -5.0 Y +48015 MI -5.0 Y +48017 MI -5.0 Y +48021 MI -5.0 Y +48022 MI -5.0 Y +48023 MI -5.0 Y +48025 MI -5.0 Y +48026 MI -5.0 Y +48027 MI -5.0 Y +48028 MI -5.0 Y +48030 MI -5.0 Y +48032 MI -5.0 Y +48033 MI -5.0 Y +48034 MI -5.0 Y +48035 MI -5.0 Y +48036 MI -5.0 Y +48037 MI -5.0 Y +48038 MI -5.0 Y +48039 MI -5.0 Y +48040 MI -5.0 Y +48041 MI -5.0 Y +48042 MI -5.0 Y +48043 MI -5.0 Y +48044 MI -5.0 Y +48045 MI -5.0 Y +48046 MI -5.0 Y +48047 MI -5.0 Y +48048 MI -5.0 Y +48049 MI -5.0 Y +48050 MI -5.0 Y +48051 MI -5.0 Y +48054 MI -5.0 Y +48059 MI -5.0 Y +48060 MI -5.0 Y +48061 MI -5.0 Y +48062 MI -5.0 Y +48063 MI -5.0 Y +48064 MI -5.0 Y +48065 MI -5.0 Y +48066 MI -5.0 Y +48067 MI -5.0 Y +48068 MI -5.0 Y +48069 MI -5.0 Y +48070 MI -5.0 Y +48071 MI -5.0 Y +48072 MI -5.0 Y +48073 MI -5.0 Y +48074 MI -5.0 Y +48075 MI -5.0 Y +48076 MI -5.0 Y +48079 MI -5.0 Y +48080 MI -5.0 Y +48081 MI -5.0 Y +48082 MI -5.0 Y +48083 MI -5.0 Y +48084 MI -5.0 Y +48085 MI -5.0 Y +48086 MI -5.0 Y +48088 MI -5.0 Y +48089 MI -5.0 Y +48090 MI -5.0 Y +48091 MI -5.0 Y +48092 MI -5.0 Y +48093 MI -5.0 Y +48094 MI -5.0 Y +48095 MI -5.0 Y +48096 MI -5.0 Y +48097 MI -5.0 Y +48098 MI -5.0 Y +48099 MI -5.0 Y +48101 MI -5.0 Y +48103 MI -5.0 Y +48104 MI -5.0 Y +48105 MI -5.0 Y +48106 MI -5.0 Y +48107 MI -5.0 Y +48108 MI -5.0 Y +48109 MI -5.0 Y +48110 MI -5.0 Y +48111 MI -5.0 Y +48112 MI -5.0 Y +48113 MI -5.0 Y +48114 MI -5.0 Y +48115 MI -5.0 Y +48116 MI -5.0 Y +48117 MI -5.0 Y +48118 MI -5.0 Y +48120 MI -5.0 Y +48121 MI -5.0 Y +48122 MI -5.0 Y +48123 MI -5.0 Y +48124 MI -5.0 Y +48125 MI -5.0 Y +48126 MI -5.0 Y +48127 MI -5.0 Y +48128 MI -5.0 Y +48130 MI -5.0 Y +48131 MI -5.0 Y +48133 MI -5.0 Y +48134 MI -5.0 Y +48135 MI -5.0 Y +48136 MI -5.0 Y +48137 MI -5.0 Y +48138 MI -5.0 Y +48139 MI -5.0 Y +48140 MI -5.0 Y +48141 MI -5.0 Y +48143 MI -5.0 Y +48144 MI -5.0 Y +48145 MI -5.0 Y +48146 MI -5.0 Y +48150 MI -5.0 Y +48151 MI -5.0 Y +48152 MI -5.0 Y +48153 MI -5.0 Y +48154 MI -5.0 Y +48157 MI -5.0 Y +48158 MI -5.0 Y +48159 MI -5.0 Y +48160 MI -5.0 Y +48161 MI -5.0 Y +48162 MI -5.0 Y +48164 MI -5.0 Y +48165 MI -5.0 Y +48166 MI -5.0 Y +48167 MI -5.0 Y +48168 MI -5.0 Y +48169 MI -5.0 Y +48170 MI -5.0 Y +48173 MI -5.0 Y +48174 MI -5.0 Y +48175 MI -5.0 Y +48176 MI -5.0 Y +48177 MI -5.0 Y +48178 MI -5.0 Y +48179 MI -5.0 Y +48180 MI -5.0 Y +48182 MI -5.0 Y +48183 MI -5.0 Y +48184 MI -5.0 Y +48185 MI -5.0 Y +48186 MI -5.0 Y +48187 MI -5.0 Y +48188 MI -5.0 Y +48189 MI -5.0 Y +48190 MI -5.0 Y +48191 MI -5.0 Y +48192 MI -5.0 Y +48193 MI -5.0 Y +48195 MI -5.0 Y +48197 MI -5.0 Y +48198 MI -5.0 Y +48201 MI -5.0 Y +48202 MI -5.0 Y +48203 MI -5.0 Y +48204 MI -5.0 Y +48205 MI -5.0 Y +48206 MI -5.0 Y +48207 MI -5.0 Y +48208 MI -5.0 Y +48209 MI -5.0 Y +48210 MI -5.0 Y +48211 MI -5.0 Y +48212 MI -5.0 Y +48213 MI -5.0 Y +48214 MI -5.0 Y +48215 MI -5.0 Y +48216 MI -5.0 Y +48217 MI -5.0 Y +48218 MI -5.0 Y +48219 MI -5.0 Y +48220 MI -5.0 Y +48221 MI -5.0 Y +48222 MI -5.0 Y +48223 MI -5.0 Y +48224 MI -5.0 Y +48225 MI -5.0 Y +48226 MI -5.0 Y +48227 MI -5.0 Y +48228 MI -5.0 Y +48229 MI -5.0 Y +48230 MI -5.0 Y +48231 MI -5.0 Y +48232 MI -5.0 Y +48233 MI -5.0 Y +48234 MI -5.0 Y +48235 MI -5.0 Y +48236 MI -5.0 Y +48237 MI -5.0 Y +48238 MI -5.0 Y +48239 MI -5.0 Y +48240 MI -5.0 Y +48242 MI -5.0 Y +48243 MI -5.0 Y +48244 MI -5.0 Y +48255 MI -5.0 Y +48260 MI -5.0 Y +48264 MI -5.0 Y +48265 MI -5.0 Y +48266 MI -5.0 Y +48267 MI -5.0 Y +48268 MI -5.0 Y +48269 MI -5.0 Y +48272 MI -5.0 Y +48275 MI -5.0 Y +48277 MI -5.0 Y +48278 MI -5.0 Y +48279 MI -5.0 Y +48288 MI -5.0 Y +48301 MI -5.0 Y +48302 MI -5.0 Y +48303 MI -5.0 Y +48304 MI -5.0 Y +48306 MI -5.0 Y +48307 MI -5.0 Y +48308 MI -5.0 Y +48309 MI -5.0 Y +48310 MI -5.0 Y +48311 MI -5.0 Y +48312 MI -5.0 Y +48313 MI -5.0 Y +48314 MI -5.0 Y +48315 MI -5.0 Y +48316 MI -5.0 Y +48317 MI -5.0 Y +48318 MI -5.0 Y +48320 MI -5.0 Y +48321 MI -5.0 Y +48322 MI -5.0 Y +48323 MI -5.0 Y +48324 MI -5.0 Y +48325 MI -5.0 Y +48326 MI -5.0 Y +48327 MI -5.0 Y +48328 MI -5.0 Y +48329 MI -5.0 Y +48330 MI -5.0 Y +48331 MI -5.0 Y +48332 MI -5.0 Y +48333 MI -5.0 Y +48334 MI -5.0 Y +48335 MI -5.0 Y +48336 MI -5.0 Y +48340 MI -5.0 Y +48341 MI -5.0 Y +48342 MI -5.0 Y +48343 MI -5.0 Y +48346 MI -5.0 Y +48347 MI -5.0 Y +48348 MI -5.0 Y +48350 MI -5.0 Y +48353 MI -5.0 Y +48356 MI -5.0 Y +48357 MI -5.0 Y +48359 MI -5.0 Y +48360 MI -5.0 Y +48361 MI -5.0 Y +48362 MI -5.0 Y +48363 MI -5.0 Y +48366 MI -5.0 Y +48367 MI -5.0 Y +48370 MI -5.0 Y +48371 MI -5.0 Y +48374 MI -5.0 Y +48375 MI -5.0 Y +48376 MI -5.0 Y +48377 MI -5.0 Y +48380 MI -5.0 Y +48381 MI -5.0 Y +48382 MI -5.0 Y +48383 MI -5.0 Y +48386 MI -5.0 Y +48387 MI -5.0 Y +48390 MI -5.0 Y +48391 MI -5.0 Y +48393 MI -5.0 Y +48397 MI -5.0 Y +48401 MI -5.0 Y +48410 MI -5.0 Y +48411 MI -5.0 Y +48412 MI -5.0 Y +48413 MI -5.0 Y +48414 MI -5.0 Y +48415 MI -5.0 Y +48416 MI -5.0 Y +48417 MI -5.0 Y +48418 MI -5.0 Y +48419 MI -5.0 Y +48420 MI -5.0 Y +48421 MI -5.0 Y +48422 MI -5.0 Y +48423 MI -5.0 Y +48426 MI -5.0 Y +48427 MI -5.0 Y +48428 MI -5.0 Y +48429 MI -5.0 Y +48430 MI -5.0 Y +48432 MI -5.0 Y +48433 MI -5.0 Y +48434 MI -5.0 Y +48435 MI -5.0 Y +48436 MI -5.0 Y +48437 MI -5.0 Y +48438 MI -5.0 Y +48439 MI -5.0 Y +48440 MI -5.0 Y +48441 MI -5.0 Y +48442 MI -5.0 Y +48444 MI -5.0 Y +48445 MI -5.0 Y +48446 MI -5.0 Y +48449 MI -5.0 Y +48450 MI -5.0 Y +48451 MI -5.0 Y +48453 MI -5.0 Y +48454 MI -5.0 Y +48455 MI -5.0 Y +48456 MI -5.0 Y +48457 MI -5.0 Y +48458 MI -5.0 Y +48460 MI -5.0 Y +48461 MI -5.0 Y +48462 MI -5.0 Y +48463 MI -5.0 Y +48464 MI -5.0 Y +48465 MI -5.0 Y +48466 MI -5.0 Y +48467 MI -5.0 Y +48468 MI -5.0 Y +48469 MI -5.0 Y +48470 MI -5.0 Y +48471 MI -5.0 Y +48472 MI -5.0 Y +48473 MI -5.0 Y +48475 MI -5.0 Y +48476 MI -5.0 Y +48480 MI -5.0 Y +48501 MI -5.0 Y +48502 MI -5.0 Y +48503 MI -5.0 Y +48504 MI -5.0 Y +48505 MI -5.0 Y +48506 MI -5.0 Y +48507 MI -5.0 Y +48509 MI -5.0 Y +48519 MI -5.0 Y +48529 MI -5.0 Y +48531 MI -5.0 Y +48532 MI -5.0 Y +48550 MI -5.0 Y +48551 MI -5.0 Y +48552 MI -5.0 Y +48553 MI -5.0 Y +48554 MI -5.0 Y +48555 MI -5.0 Y +48556 MI -5.0 Y +48557 MI -5.0 Y +48559 MI -5.0 Y +48601 MI -5.0 Y +48602 MI -5.0 Y +48603 MI -5.0 Y +48604 MI -5.0 Y +48605 MI -5.0 Y +48606 MI -5.0 Y +48607 MI -5.0 Y +48608 MI -5.0 Y +48609 MI -5.0 Y +48610 MI -5.0 Y +48611 MI -5.0 Y +48612 MI -5.0 Y +48613 MI -5.0 Y +48614 MI -5.0 Y +48615 MI -5.0 Y +48616 MI -5.0 Y +48617 MI -5.0 Y +48618 MI -5.0 Y +48619 MI -5.0 Y +48620 MI -5.0 Y +48621 MI -5.0 Y +48622 MI -5.0 Y +48623 MI -5.0 Y +48624 MI -5.0 Y +48625 MI -5.0 Y +48626 MI -5.0 Y +48627 MI -5.0 Y +48628 MI -5.0 Y +48629 MI -5.0 Y +48630 MI -5.0 Y +48631 MI -5.0 Y +48632 MI -5.0 Y +48633 MI -5.0 Y +48634 MI -5.0 Y +48635 MI -5.0 Y +48636 MI -5.0 Y +48637 MI -5.0 Y +48638 MI -5.0 Y +48640 MI -5.0 Y +48641 MI -5.0 Y +48642 MI -5.0 Y +48647 MI -5.0 Y +48649 MI -5.0 Y +48650 MI -5.0 Y +48651 MI -5.0 Y +48652 MI -5.0 Y +48653 MI -5.0 Y +48654 MI -5.0 Y +48655 MI -5.0 Y +48656 MI -5.0 Y +48657 MI -5.0 Y +48658 MI -5.0 Y +48659 MI -5.0 Y +48661 MI -5.0 Y +48662 MI -5.0 Y +48663 MI -5.0 Y +48667 MI -5.0 Y +48670 MI -5.0 Y +48674 MI -5.0 Y +48686 MI -5.0 Y +48701 MI -5.0 Y +48703 MI -5.0 Y +48705 MI -5.0 Y +48706 MI -5.0 Y +48707 MI -5.0 Y +48708 MI -5.0 Y +48710 MI -5.0 Y +48720 MI -5.0 Y +48721 MI -5.0 Y +48722 MI -5.0 Y +48723 MI -5.0 Y +48724 MI -5.0 Y +48725 MI -5.0 Y +48726 MI -5.0 Y +48727 MI -5.0 Y +48728 MI -5.0 Y +48729 MI -5.0 Y +48730 MI -5.0 Y +48731 MI -5.0 Y +48732 MI -5.0 Y +48733 MI -5.0 Y +48734 MI -5.0 Y +48735 MI -5.0 Y +48736 MI -5.0 Y +48737 MI -5.0 Y +48738 MI -5.0 Y +48739 MI -5.0 Y +48740 MI -5.0 Y +48741 MI -5.0 Y +48742 MI -5.0 Y +48743 MI -5.0 Y +48744 MI -5.0 Y +48745 MI -5.0 Y +48746 MI -5.0 Y +48747 MI -5.0 Y +48748 MI -5.0 Y +48749 MI -5.0 Y +48750 MI -5.0 Y +48754 MI -5.0 Y +48755 MI -5.0 Y +48756 MI -5.0 Y +48757 MI -5.0 Y +48758 MI -5.0 Y +48759 MI -5.0 Y +48760 MI -5.0 Y +48761 MI -5.0 Y +48762 MI -5.0 Y +48763 MI -5.0 Y +48764 MI -5.0 Y +48765 MI -5.0 Y +48766 MI -5.0 Y +48767 MI -5.0 Y +48768 MI -5.0 Y +48769 MI -5.0 Y +48770 MI -5.0 Y +48787 MI -5.0 Y +48801 MI -5.0 Y +48802 MI -5.0 Y +48804 MI -5.0 Y +48805 MI -5.0 Y +48806 MI -5.0 Y +48807 MI -5.0 Y +48808 MI -5.0 Y +48809 MI -5.0 Y +48811 MI -5.0 Y +48812 MI -5.0 Y +48813 MI -5.0 Y +48815 MI -5.0 Y +48816 MI -5.0 Y +48817 MI -5.0 Y +48818 MI -5.0 Y +48819 MI -5.0 Y +48820 MI -5.0 Y +48821 MI -5.0 Y +48822 MI -5.0 Y +48823 MI -5.0 Y +48824 MI -5.0 Y +48825 MI -5.0 Y +48826 MI -5.0 Y +48827 MI -5.0 Y +48829 MI -5.0 Y +48830 MI -5.0 Y +48831 MI -5.0 Y +48832 MI -5.0 Y +48833 MI -5.0 Y +48834 MI -5.0 Y +48835 MI -5.0 Y +48836 MI -5.0 Y +48837 MI -5.0 Y +48838 MI -5.0 Y +48840 MI -5.0 Y +48841 MI -5.0 Y +48842 MI -5.0 Y +48843 MI -5.0 Y +48844 MI -5.0 Y +48845 MI -5.0 Y +48846 MI -5.0 Y +48847 MI -5.0 Y +48848 MI -5.0 Y +48849 MI -5.0 Y +48850 MI -5.0 Y +48851 MI -5.0 Y +48852 MI -5.0 Y +48853 MI -5.0 Y +48854 MI -5.0 Y +48855 MI -5.0 Y +48856 MI -5.0 Y +48857 MI -5.0 Y +48858 MI -5.0 Y +48859 MI -5.0 Y +48860 MI -5.0 Y +48861 MI -5.0 Y +48862 MI -5.0 Y +48863 MI -5.0 Y +48864 MI -5.0 Y +48865 MI -5.0 Y +48866 MI -5.0 Y +48867 MI -5.0 Y +48870 MI -5.0 Y +48871 MI -5.0 Y +48872 MI -5.0 Y +48873 MI -5.0 Y +48874 MI -5.0 Y +48875 MI -5.0 Y +48876 MI -5.0 Y +48877 MI -5.0 Y +48878 MI -5.0 Y +48879 MI -5.0 Y +48880 MI -5.0 Y +48881 MI -5.0 Y +48882 MI -5.0 Y +48883 MI -5.0 Y +48884 MI -5.0 Y +48885 MI -5.0 Y +48886 MI -5.0 Y +48887 MI -5.0 Y +48888 MI -5.0 Y +48889 MI -5.0 Y +48890 MI -5.0 Y +48891 MI -5.0 Y +48892 MI -5.0 Y +48893 MI -5.0 Y +48894 MI -5.0 Y +48895 MI -5.0 Y +48896 MI -5.0 Y +48897 MI -5.0 Y +48901 MI -5.0 Y +48906 MI -5.0 Y +48908 MI -5.0 Y +48909 MI -5.0 Y +48910 MI -5.0 Y +48911 MI -5.0 Y +48912 MI -5.0 Y +48913 MI -5.0 Y +48915 MI -5.0 Y +48916 MI -5.0 Y +48917 MI -5.0 Y +48918 MI -5.0 Y +48919 MI -5.0 Y +48921 MI -5.0 Y +48922 MI -5.0 Y +48924 MI -5.0 Y +48929 MI -5.0 Y +48930 MI -5.0 Y +48933 MI -5.0 Y +48937 MI -5.0 Y +48950 MI -5.0 Y +48951 MI -5.0 Y +48956 MI -5.0 Y +48980 MI -5.0 Y +49001 MI -5.0 Y +49002 MI -5.0 Y +49003 MI -5.0 Y +49004 MI -5.0 Y +49005 MI -5.0 Y +49006 MI -5.0 Y +49007 MI -5.0 Y +49008 MI -5.0 Y +49009 MI -5.0 Y +49010 MI -5.0 Y +49011 MI -5.0 Y +49012 MI -5.0 Y +49013 MI -5.0 Y +49014 MI -5.0 Y +49015 MI -5.0 Y +49016 MI -5.0 Y +49017 MI -5.0 Y +49018 MI -5.0 Y +49019 MI -5.0 Y +49020 MI -5.0 Y +49021 MI -5.0 Y +49022 MI -5.0 Y +49023 MI -5.0 Y +49024 MI -5.0 Y +49026 MI -5.0 Y +49027 MI -5.0 Y +49028 MI -5.0 Y +49029 MI -5.0 Y +49030 MI -5.0 Y +49031 MI -5.0 Y +49032 MI -5.0 Y +49033 MI -5.0 Y +49034 MI -5.0 Y +49035 MI -5.0 Y +49036 MI -5.0 Y +49038 MI -5.0 Y +49039 MI -5.0 Y +49040 MI -5.0 Y +49041 MI -5.0 Y +49042 MI -5.0 Y +49043 MI -5.0 Y +49045 MI -5.0 Y +49046 MI -5.0 Y +49047 MI -5.0 Y +49048 MI -5.0 Y +49050 MI -5.0 Y +49051 MI -5.0 Y +49052 MI -5.0 Y +49053 MI -5.0 Y +49055 MI -5.0 Y +49056 MI -5.0 Y +49057 MI -5.0 Y +49058 MI -5.0 Y +49060 MI -5.0 Y +49061 MI -5.0 Y +49062 MI -5.0 Y +49063 MI -5.0 Y +49064 MI -5.0 Y +49065 MI -5.0 Y +49066 MI -5.0 Y +49067 MI -5.0 Y +49068 MI -5.0 Y +49069 MI -5.0 Y +49070 MI -5.0 Y +49071 MI -5.0 Y +49072 MI -5.0 Y +49073 MI -5.0 Y +49074 MI -5.0 Y +49075 MI -5.0 Y +49076 MI -5.0 Y +49077 MI -5.0 Y +49078 MI -5.0 Y +49079 MI -5.0 Y +49080 MI -5.0 Y +49081 MI -5.0 Y +49082 MI -5.0 Y +49083 MI -5.0 Y +49084 MI -5.0 Y +49085 MI -5.0 Y +49087 MI -5.0 Y +49088 MI -5.0 Y +49089 MI -5.0 Y +49090 MI -5.0 Y +49091 MI -5.0 Y +49092 MI -5.0 Y +49093 MI -5.0 Y +49094 MI -5.0 Y +49095 MI -5.0 Y +49096 MI -5.0 Y +49097 MI -5.0 Y +49098 MI -5.0 Y +49099 MI -5.0 Y +49101 MI -5.0 Y +49102 MI -5.0 Y +49103 MI -5.0 Y +49104 MI -5.0 Y +49106 MI -5.0 Y +49107 MI -5.0 Y +49111 MI -5.0 Y +49112 MI -5.0 Y +49113 MI -5.0 Y +49115 MI -5.0 Y +49116 MI -5.0 Y +49117 MI -5.0 Y +49119 MI -5.0 Y +49120 MI -5.0 Y +49121 MI -5.0 Y +49125 MI -5.0 Y +49126 MI -5.0 Y +49127 MI -5.0 Y +49128 MI -5.0 Y +49129 MI -5.0 Y +49130 MI -5.0 Y +49201 MI -5.0 Y +49202 MI -5.0 Y +49203 MI -5.0 Y +49204 MI -5.0 Y +49220 MI -5.0 Y +49221 MI -5.0 Y +49224 MI -5.0 Y +49227 MI -5.0 Y +49228 MI -5.0 Y +49229 MI -5.0 Y +49230 MI -5.0 Y +49232 MI -5.0 Y +49233 MI -5.0 Y +49234 MI -5.0 Y +49235 MI -5.0 Y +49236 MI -5.0 Y +49237 MI -5.0 Y +49238 MI -5.0 Y +49239 MI -5.0 Y +49240 MI -5.0 Y +49241 MI -5.0 Y +49242 MI -5.0 Y +49245 MI -5.0 Y +49246 MI -5.0 Y +49247 MI -5.0 Y +49248 MI -5.0 Y +49249 MI -5.0 Y +49250 MI -5.0 Y +49251 MI -5.0 Y +49252 MI -5.0 Y +49253 MI -5.0 Y +49254 MI -5.0 Y +49255 MI -5.0 Y +49256 MI -5.0 Y +49257 MI -5.0 Y +49258 MI -5.0 Y +49259 MI -5.0 Y +49261 MI -5.0 Y +49262 MI -5.0 Y +49263 MI -5.0 Y +49264 MI -5.0 Y +49265 MI -5.0 Y +49266 MI -5.0 Y +49267 MI -5.0 Y +49268 MI -5.0 Y +49269 MI -5.0 Y +49270 MI -5.0 Y +49271 MI -5.0 Y +49272 MI -5.0 Y +49274 MI -5.0 Y +49276 MI -5.0 Y +49277 MI -5.0 Y +49279 MI -5.0 Y +49281 MI -5.0 Y +49282 MI -5.0 Y +49283 MI -5.0 Y +49284 MI -5.0 Y +49285 MI -5.0 Y +49286 MI -5.0 Y +49287 MI -5.0 Y +49288 MI -5.0 Y +49289 MI -5.0 Y +49301 MI -5.0 Y +49302 MI -5.0 Y +49303 MI -5.0 Y +49304 MI -5.0 Y +49305 MI -5.0 Y +49306 MI -5.0 Y +49307 MI -5.0 Y +49309 MI -5.0 Y +49310 MI -5.0 Y +49311 MI -5.0 Y +49312 MI -5.0 Y +49314 MI -5.0 Y +49315 MI -5.0 Y +49316 MI -5.0 Y +49317 MI -5.0 Y +49318 MI -5.0 Y +49319 MI -5.0 Y +49320 MI -5.0 Y +49321 MI -5.0 Y +49322 MI -5.0 Y +49323 MI -5.0 Y +49325 MI -5.0 Y +49326 MI -5.0 Y +49327 MI -5.0 Y +49328 MI -5.0 Y +49329 MI -5.0 Y +49330 MI -5.0 Y +49331 MI -5.0 Y +49332 MI -5.0 Y +49333 MI -5.0 Y +49335 MI -5.0 Y +49336 MI -5.0 Y +49337 MI -5.0 Y +49338 MI -5.0 Y +49339 MI -5.0 Y +49340 MI -5.0 Y +49341 MI -5.0 Y +49342 MI -5.0 Y +49343 MI -5.0 Y +49344 MI -5.0 Y +49345 MI -5.0 Y +49346 MI -5.0 Y +49347 MI -5.0 Y +49348 MI -5.0 Y +49349 MI -5.0 Y +49351 MI -5.0 Y +49355 MI -5.0 Y +49356 MI -5.0 Y +49357 MI -5.0 Y +49401 MI -5.0 Y +49402 MI -5.0 Y +49403 MI -5.0 Y +49404 MI -5.0 Y +49405 MI -5.0 Y +49406 MI -5.0 Y +49408 MI -5.0 Y +49409 MI -5.0 Y +49410 MI -5.0 Y +49411 MI -5.0 Y +49412 MI -5.0 Y +49413 MI -5.0 Y +49415 MI -5.0 Y +49416 MI -5.0 Y +49417 MI -5.0 Y +49418 MI -5.0 Y +49419 MI -5.0 Y +49420 MI -5.0 Y +49421 MI -5.0 Y +49422 MI -5.0 Y +49423 MI -5.0 Y +49424 MI -5.0 Y +49425 MI -5.0 Y +49426 MI -5.0 Y +49427 MI -5.0 Y +49428 MI -5.0 Y +49429 MI -5.0 Y +49430 MI -5.0 Y +49431 MI -5.0 Y +49434 MI -5.0 Y +49435 MI -5.0 Y +49436 MI -5.0 Y +49437 MI -5.0 Y +49440 MI -5.0 Y +49441 MI -5.0 Y +49442 MI -5.0 Y +49443 MI -5.0 Y +49444 MI -5.0 Y +49445 MI -5.0 Y +49446 MI -5.0 Y +49448 MI -5.0 Y +49449 MI -5.0 Y +49450 MI -5.0 Y +49451 MI -5.0 Y +49452 MI -5.0 Y +49453 MI -5.0 Y +49454 MI -5.0 Y +49455 MI -5.0 Y +49456 MI -5.0 Y +49457 MI -5.0 Y +49458 MI -5.0 Y +49459 MI -5.0 Y +49460 MI -5.0 Y +49461 MI -5.0 Y +49463 MI -5.0 Y +49464 MI -5.0 Y +49468 MI -5.0 Y +49501 MI -5.0 Y +49502 MI -5.0 Y +49503 MI -5.0 Y +49504 MI -5.0 Y +49505 MI -5.0 Y +49506 MI -5.0 Y +49507 MI -5.0 Y +49508 MI -5.0 Y +49509 MI -5.0 Y +49510 MI -5.0 Y +49512 MI -5.0 Y +49514 MI -5.0 Y +49515 MI -5.0 Y +49516 MI -5.0 Y +49518 MI -5.0 Y +49519 MI -5.0 Y +49523 MI -5.0 Y +49525 MI -5.0 Y +49528 MI -5.0 Y +49530 MI -5.0 Y +49534 MI -5.0 Y +49544 MI -5.0 Y +49546 MI -5.0 Y +49548 MI -5.0 Y +49550 MI -5.0 Y +49555 MI -5.0 Y +49560 MI -5.0 Y +49588 MI -5.0 Y +49599 MI -5.0 Y +49601 MI -5.0 Y +49610 MI -5.0 Y +49611 MI -5.0 Y +49612 MI -5.0 Y +49613 MI -5.0 Y +49614 MI -5.0 Y +49615 MI -5.0 Y +49616 MI -5.0 Y +49617 MI -5.0 Y +49618 MI -5.0 Y +49619 MI -5.0 Y +49620 MI -5.0 Y +49621 MI -5.0 Y +49622 MI -5.0 Y +49623 MI -5.0 Y +49625 MI -5.0 Y +49626 MI -5.0 Y +49627 MI -5.0 Y +49628 MI -5.0 Y +49629 MI -5.0 Y +49630 MI -5.0 Y +49631 MI -5.0 Y +49632 MI -5.0 Y +49633 MI -5.0 Y +49634 MI -5.0 Y +49635 MI -5.0 Y +49636 MI -5.0 Y +49637 MI -5.0 Y +49638 MI -5.0 Y +49639 MI -5.0 Y +49640 MI -5.0 Y +49642 MI -5.0 Y +49643 MI -5.0 Y +49644 MI -5.0 Y +49645 MI -5.0 Y +49646 MI -5.0 Y +49648 MI -5.0 Y +49649 MI -5.0 Y +49650 MI -5.0 Y +49651 MI -5.0 Y +49653 MI -5.0 Y +49654 MI -5.0 Y +49655 MI -5.0 Y +49656 MI -5.0 Y +49657 MI -5.0 Y +49659 MI -5.0 Y +49660 MI -5.0 Y +49663 MI -5.0 Y +49664 MI -5.0 Y +49665 MI -5.0 Y +49666 MI -5.0 Y +49667 MI -5.0 Y +49668 MI -5.0 Y +49670 MI -5.0 Y +49673 MI -5.0 Y +49674 MI -5.0 Y +49675 MI -5.0 Y +49676 MI -5.0 Y +49677 MI -5.0 Y +49679 MI -5.0 Y +49680 MI -5.0 Y +49682 MI -5.0 Y +49683 MI -5.0 Y +49684 MI -5.0 Y +49685 MI -5.0 Y +49686 MI -5.0 Y +49688 MI -5.0 Y +49689 MI -5.0 Y +49690 MI -5.0 Y +49696 MI -5.0 Y +49701 MI -5.0 Y +49705 MI -5.0 Y +49706 MI -5.0 Y +49707 MI -5.0 Y +49709 MI -5.0 Y +49710 MI -5.0 Y +49711 MI -5.0 Y +49712 MI -5.0 Y +49713 MI -5.0 Y +49715 MI -5.0 Y +49716 MI -5.0 Y +49717 MI -5.0 Y +49718 MI -5.0 Y +49719 MI -5.0 Y +49720 MI -5.0 Y +49721 MI -5.0 Y +49722 MI -5.0 Y +49723 MI -5.0 Y +49724 MI -5.0 Y +49725 MI -5.0 Y +49726 MI -5.0 Y +49727 MI -5.0 Y +49728 MI -5.0 Y +49729 MI -5.0 Y +49730 MI -5.0 Y +49733 MI -5.0 Y +49734 MI -5.0 Y +49735 MI -5.0 Y +49736 MI -5.0 Y +49737 MI -5.0 Y +49738 MI -5.0 Y +49739 MI -5.0 Y +49740 MI -5.0 Y +49743 MI -5.0 Y +49744 MI -5.0 Y +49745 MI -5.0 Y +49746 MI -5.0 Y +49747 MI -5.0 Y +49748 MI -5.0 Y +49749 MI -5.0 Y +49751 MI -5.0 Y +49752 MI -5.0 Y +49753 MI -5.0 Y +49755 MI -5.0 Y +49756 MI -5.0 Y +49757 MI -5.0 Y +49759 MI -5.0 Y +49760 MI -5.0 Y +49761 MI -5.0 Y +49762 MI -5.0 Y +49764 MI -5.0 Y +49765 MI -5.0 Y +49766 MI -5.0 Y +49768 MI -5.0 Y +49769 MI -5.0 Y +49770 MI -5.0 Y +49774 MI -5.0 Y +49775 MI -5.0 Y +49776 MI -5.0 Y +49777 MI -5.0 Y +49779 MI -5.0 Y +49780 MI -5.0 Y +49781 MI -5.0 Y +49782 MI -5.0 Y +49783 MI -5.0 Y +49784 MI -5.0 Y +49785 MI -5.0 Y +49786 MI -5.0 Y +49788 MI -5.0 Y +49790 MI -5.0 Y +49791 MI -5.0 Y +49792 MI -5.0 Y +49793 MI -5.0 Y +49795 MI -5.0 Y +49796 MI -5.0 Y +49797 MI -5.0 Y +49799 MI -5.0 Y +49801 MI -6.0 Y +49802 MI -6.0 Y +49805 MI -5.0 Y +49806 MI -5.0 Y +49807 MI -5.0 Y +49808 MI -5.0 Y +49812 MI -6.0 Y +49814 MI -5.0 Y +49815 MI -6.0 Y +49816 MI -5.0 Y +49817 MI -5.0 Y +49818 MI -5.0 Y +49819 MI -5.0 Y +49820 MI -5.0 Y +49821 MI -6.0 Y +49822 MI -5.0 Y +49825 MI -5.0 Y +49826 MI -5.0 Y +49827 MI -5.0 Y +49829 MI -5.0 Y +49831 MI -6.0 Y +49833 MI -5.0 Y +49834 MI -6.0 Y +49835 MI -5.0 Y +49836 MI -5.0 Y +49837 MI -5.0 Y +49838 MI -5.0 Y +49839 MI -5.0 Y +49840 MI -5.0 Y +49841 MI -5.0 Y +49845 MI -6.0 Y +49847 MI -6.0 Y +49848 MI -6.0 Y +49849 MI -5.0 Y +49852 MI -6.0 Y +49853 MI -5.0 Y +49854 MI -5.0 Y +49855 MI -5.0 Y +49858 MI -6.0 Y +49861 MI -5.0 Y +49862 MI -5.0 Y +49863 MI -6.0 Y +49864 MI -5.0 Y +49865 MI -5.0 Y +49866 MI -5.0 Y +49868 MI -5.0 Y +49870 MI -6.0 Y +49871 MI -5.0 Y +49872 MI -5.0 Y +49873 MI -6.0 Y +49874 MI -6.0 Y +49876 MI -6.0 Y +49877 MI -6.0 Y +49878 MI -5.0 Y +49879 MI -5.0 Y +49880 MI -5.0 Y +49881 MI -6.0 Y +49883 MI -5.0 Y +49884 MI -5.0 Y +49885 MI -5.0 Y +49886 MI -6.0 Y +49887 MI -6.0 Y +49891 MI -5.0 Y +49892 MI -6.0 Y +49893 MI -6.0 Y +49894 MI -5.0 Y +49895 MI -5.0 Y +49896 MI -6.0 Y +49901 MI -5.0 Y +49902 MI -6.0 Y +49903 MI -6.0 Y +49905 MI -5.0 Y +49908 MI -5.0 Y +49910 MI -5.0 Y +49911 MI -6.0 Y +49912 MI -5.0 Y +49913 MI -5.0 Y +49915 MI -6.0 Y +49916 MI -5.0 Y +49917 MI -5.0 Y +49918 MI -5.0 Y +49919 MI -5.0 Y +49920 MI -6.0 Y +49921 MI -5.0 Y +49922 MI -5.0 Y +49925 MI -5.0 Y +49927 MI -6.0 Y +49929 MI -5.0 Y +49930 MI -5.0 Y +49931 MI -5.0 Y +49934 MI -5.0 Y +49935 MI -6.0 Y +49938 MI -6.0 Y +49942 MI -5.0 Y +49945 MI -5.0 Y +49946 MI -5.0 Y +49947 MI -6.0 Y +49948 MI -5.0 Y +49950 MI -5.0 Y +49952 MI -5.0 Y +49953 MI -5.0 Y +49955 MI -5.0 Y +49958 MI -5.0 Y +49959 MI -6.0 Y +49960 MI -5.0 Y +49961 MI -5.0 Y +49962 MI -5.0 Y +49963 MI -5.0 Y +49964 MI -6.0 Y +49965 MI -5.0 Y +49967 MI -5.0 Y +49968 MI -6.0 Y +49969 MI -6.0 Y +49970 MI -5.0 Y +49971 MI -5.0 Y +50001 IA -6.0 Y +50002 IA -6.0 Y +50003 IA -6.0 Y +50005 IA -6.0 Y +50006 IA -6.0 Y +50007 IA -6.0 Y +50008 IA -6.0 Y +50009 IA -6.0 Y +50010 IA -6.0 Y +50011 IA -6.0 Y +50012 IA -6.0 Y +50013 IA -6.0 Y +50014 IA -6.0 Y +50020 IA -6.0 Y +50021 IA -6.0 Y +50022 IA -6.0 Y +50023 IA -6.0 Y +50025 IA -6.0 Y +50026 IA -6.0 Y +50027 IA -6.0 Y +50028 IA -6.0 Y +50029 IA -6.0 Y +50031 IA -6.0 Y +50032 IA -6.0 Y +50033 IA -6.0 Y +50034 IA -6.0 Y +50035 IA -6.0 Y +50036 IA -6.0 Y +50037 IA -6.0 Y +50038 IA -6.0 Y +50039 IA -6.0 Y +50040 IA -6.0 Y +50041 IA -6.0 Y +50042 IA -6.0 Y +50043 IA -6.0 Y +50044 IA -6.0 Y +50046 IA -6.0 Y +50047 IA -6.0 Y +50048 IA -6.0 Y +50049 IA -6.0 Y +50050 IA -6.0 Y +50051 IA -6.0 Y +50052 IA -6.0 Y +50054 IA -6.0 Y +50055 IA -6.0 Y +50056 IA -6.0 Y +50057 IA -6.0 Y +50058 IA -6.0 Y +50059 IA -6.0 Y +50060 IA -6.0 Y +50061 IA -6.0 Y +50062 IA -6.0 Y +50063 IA -6.0 Y +50064 IA -6.0 Y +50065 IA -6.0 Y +50066 IA -6.0 Y +50067 IA -6.0 Y +50068 IA -6.0 Y +50069 IA -6.0 Y +50070 IA -6.0 Y +50071 IA -6.0 Y +50072 IA -6.0 Y +50073 IA -6.0 Y +50074 IA -6.0 Y +50075 IA -6.0 Y +50076 IA -6.0 Y +50078 IA -6.0 Y +50101 IA -6.0 Y +50102 IA -6.0 Y +50103 IA -6.0 Y +50104 IA -6.0 Y +50105 IA -6.0 Y +50106 IA -6.0 Y +50107 IA -6.0 Y +50108 IA -6.0 Y +50109 IA -6.0 Y +50110 IA -6.0 Y +50111 IA -6.0 Y +50112 IA -6.0 Y +50115 IA -6.0 Y +50116 IA -6.0 Y +50117 IA -6.0 Y +50118 IA -6.0 Y +50119 IA -6.0 Y +50120 IA -6.0 Y +50122 IA -6.0 Y +50123 IA -6.0 Y +50124 IA -6.0 Y +50125 IA -6.0 Y +50126 IA -6.0 Y +50127 IA -6.0 Y +50128 IA -6.0 Y +50129 IA -6.0 Y +50130 IA -6.0 Y +50131 IA -6.0 Y +50132 IA -6.0 Y +50133 IA -6.0 Y +50134 IA -6.0 Y +50135 IA -6.0 Y +50136 IA -6.0 Y +50137 IA -6.0 Y +50138 IA -6.0 Y +50139 IA -6.0 Y +50140 IA -6.0 Y +50141 IA -6.0 Y +50142 IA -6.0 Y +50143 IA -6.0 Y +50144 IA -6.0 Y +50145 IA -6.0 Y +50146 IA -6.0 Y +50147 IA -6.0 Y +50148 IA -6.0 Y +50149 IA -6.0 Y +50150 IA -6.0 Y +50151 IA -6.0 Y +50152 IA -6.0 Y +50153 IA -6.0 Y +50154 IA -6.0 Y +50155 IA -6.0 Y +50156 IA -6.0 Y +50157 IA -6.0 Y +50158 IA -6.0 Y +50160 IA -6.0 Y +50161 IA -6.0 Y +50162 IA -6.0 Y +50163 IA -6.0 Y +50164 IA -6.0 Y +50165 IA -6.0 Y +50166 IA -6.0 Y +50167 IA -6.0 Y +50168 IA -6.0 Y +50169 IA -6.0 Y +50170 IA -6.0 Y +50171 IA -6.0 Y +50173 IA -6.0 Y +50174 IA -6.0 Y +50201 IA -6.0 Y +50206 IA -6.0 Y +50207 IA -6.0 Y +50208 IA -6.0 Y +50210 IA -6.0 Y +50211 IA -6.0 Y +50212 IA -6.0 Y +50213 IA -6.0 Y +50214 IA -6.0 Y +50216 IA -6.0 Y +50217 IA -6.0 Y +50218 IA -6.0 Y +50219 IA -6.0 Y +50220 IA -6.0 Y +50222 IA -6.0 Y +50223 IA -6.0 Y +50225 IA -6.0 Y +50226 IA -6.0 Y +50227 IA -6.0 Y +50228 IA -6.0 Y +50229 IA -6.0 Y +50230 IA -6.0 Y +50231 IA -6.0 Y +50232 IA -6.0 Y +50233 IA -6.0 Y +50234 IA -6.0 Y +50235 IA -6.0 Y +50236 IA -6.0 Y +50237 IA -6.0 Y +50238 IA -6.0 Y +50239 IA -6.0 Y +50240 IA -6.0 Y +50241 IA -6.0 Y +50242 IA -6.0 Y +50243 IA -6.0 Y +50244 IA -6.0 Y +50246 IA -6.0 Y +50247 IA -6.0 Y +50248 IA -6.0 Y +50249 IA -6.0 Y +50250 IA -6.0 Y +50251 IA -6.0 Y +50252 IA -6.0 Y +50254 IA -6.0 Y +50255 IA -6.0 Y +50256 IA -6.0 Y +50257 IA -6.0 Y +50258 IA -6.0 Y +50259 IA -6.0 Y +50261 IA -6.0 Y +50262 IA -6.0 Y +50263 IA -6.0 Y +50264 IA -6.0 Y +50265 IA -6.0 Y +50266 IA -6.0 Y +50268 IA -6.0 Y +50269 IA -6.0 Y +50271 IA -6.0 Y +50272 IA -6.0 Y +50273 IA -6.0 Y +50274 IA -6.0 Y +50275 IA -6.0 Y +50276 IA -6.0 Y +50277 IA -6.0 Y +50278 IA -6.0 Y +50301 IA -6.0 Y +50302 IA -6.0 Y +50303 IA -6.0 Y +50304 IA -6.0 Y +50305 IA -6.0 Y +50306 IA -6.0 Y +50307 IA -6.0 Y +50308 IA -6.0 Y +50309 IA -6.0 Y +50310 IA -6.0 Y +50311 IA -6.0 Y +50312 IA -6.0 Y +50313 IA -6.0 Y +50314 IA -6.0 Y +50315 IA -6.0 Y +50316 IA -6.0 Y +50317 IA -6.0 Y +50318 IA -6.0 Y +50319 IA -6.0 Y +50320 IA -6.0 Y +50321 IA -6.0 Y +50322 IA -6.0 Y +50323 IA -6.0 Y +50325 IA -6.0 Y +50327 IA -6.0 Y +50328 IA -6.0 Y +50329 IA -6.0 Y +50330 IA -6.0 Y +50331 IA -6.0 Y +50332 IA -6.0 Y +50333 IA -6.0 Y +50334 IA -6.0 Y +50335 IA -6.0 Y +50336 IA -6.0 Y +50339 IA -6.0 Y +50340 IA -6.0 Y +50347 IA -6.0 Y +50350 IA -6.0 Y +50359 IA -6.0 Y +50360 IA -6.0 Y +50361 IA -6.0 Y +50362 IA -6.0 Y +50363 IA -6.0 Y +50364 IA -6.0 Y +50367 IA -6.0 Y +50368 IA -6.0 Y +50369 IA -6.0 Y +50380 IA -6.0 Y +50381 IA -6.0 Y +50391 IA -6.0 Y +50392 IA -6.0 Y +50393 IA -6.0 Y +50394 IA -6.0 Y +50395 IA -6.0 Y +50396 IA -6.0 Y +50397 IA -6.0 Y +50398 IA -6.0 Y +50401 IA -6.0 Y +50402 IA -6.0 Y +50420 IA -6.0 Y +50421 IA -6.0 Y +50423 IA -6.0 Y +50424 IA -6.0 Y +50426 IA -6.0 Y +50427 IA -6.0 Y +50428 IA -6.0 Y +50430 IA -6.0 Y +50431 IA -6.0 Y +50432 IA -6.0 Y +50433 IA -6.0 Y +50434 IA -6.0 Y +50435 IA -6.0 Y +50436 IA -6.0 Y +50438 IA -6.0 Y +50439 IA -6.0 Y +50440 IA -6.0 Y +50441 IA -6.0 Y +50444 IA -6.0 Y +50446 IA -6.0 Y +50447 IA -6.0 Y +50448 IA -6.0 Y +50449 IA -6.0 Y +50450 IA -6.0 Y +50451 IA -6.0 Y +50452 IA -6.0 Y +50453 IA -6.0 Y +50454 IA -6.0 Y +50455 IA -6.0 Y +50456 IA -6.0 Y +50457 IA -6.0 Y +50458 IA -6.0 Y +50459 IA -6.0 Y +50460 IA -6.0 Y +50461 IA -6.0 Y +50464 IA -6.0 Y +50465 IA -6.0 Y +50466 IA -6.0 Y +50467 IA -6.0 Y +50468 IA -6.0 Y +50469 IA -6.0 Y +50470 IA -6.0 Y +50471 IA -6.0 Y +50472 IA -6.0 Y +50473 IA -6.0 Y +50475 IA -6.0 Y +50476 IA -6.0 Y +50477 IA -6.0 Y +50478 IA -6.0 Y +50479 IA -6.0 Y +50480 IA -6.0 Y +50481 IA -6.0 Y +50482 IA -6.0 Y +50483 IA -6.0 Y +50484 IA -6.0 Y +50501 IA -6.0 Y +50510 IA -6.0 Y +50511 IA -6.0 Y +50514 IA -6.0 Y +50515 IA -6.0 Y +50516 IA -6.0 Y +50517 IA -6.0 Y +50518 IA -6.0 Y +50519 IA -6.0 Y +50520 IA -6.0 Y +50521 IA -6.0 Y +50522 IA -6.0 Y +50523 IA -6.0 Y +50524 IA -6.0 Y +50525 IA -6.0 Y +50526 IA -6.0 Y +50527 IA -6.0 Y +50528 IA -6.0 Y +50529 IA -6.0 Y +50530 IA -6.0 Y +50531 IA -6.0 Y +50532 IA -6.0 Y +50533 IA -6.0 Y +50535 IA -6.0 Y +50536 IA -6.0 Y +50538 IA -6.0 Y +50539 IA -6.0 Y +50540 IA -6.0 Y +50541 IA -6.0 Y +50542 IA -6.0 Y +50543 IA -6.0 Y +50544 IA -6.0 Y +50545 IA -6.0 Y +50546 IA -6.0 Y +50548 IA -6.0 Y +50551 IA -6.0 Y +50552 IA -6.0 Y +50554 IA -6.0 Y +50556 IA -6.0 Y +50557 IA -6.0 Y +50558 IA -6.0 Y +50559 IA -6.0 Y +50560 IA -6.0 Y +50561 IA -6.0 Y +50562 IA -6.0 Y +50563 IA -6.0 Y +50565 IA -6.0 Y +50566 IA -6.0 Y +50567 IA -6.0 Y +50568 IA -6.0 Y +50569 IA -6.0 Y +50570 IA -6.0 Y +50571 IA -6.0 Y +50573 IA -6.0 Y +50574 IA -6.0 Y +50575 IA -6.0 Y +50576 IA -6.0 Y +50577 IA -6.0 Y +50578 IA -6.0 Y +50579 IA -6.0 Y +50581 IA -6.0 Y +50582 IA -6.0 Y +50583 IA -6.0 Y +50585 IA -6.0 Y +50586 IA -6.0 Y +50588 IA -6.0 Y +50590 IA -6.0 Y +50591 IA -6.0 Y +50592 IA -6.0 Y +50593 IA -6.0 Y +50594 IA -6.0 Y +50595 IA -6.0 Y +50597 IA -6.0 Y +50598 IA -6.0 Y +50599 IA -6.0 Y +50601 IA -6.0 Y +50602 IA -6.0 Y +50603 IA -6.0 Y +50604 IA -6.0 Y +50605 IA -6.0 Y +50606 IA -6.0 Y +50607 IA -6.0 Y +50608 IA -6.0 Y +50609 IA -6.0 Y +50611 IA -6.0 Y +50612 IA -6.0 Y +50613 IA -6.0 Y +50614 IA -6.0 Y +50616 IA -6.0 Y +50619 IA -6.0 Y +50620 IA -6.0 Y +50621 IA -6.0 Y +50622 IA -6.0 Y +50623 IA -6.0 Y +50624 IA -6.0 Y +50625 IA -6.0 Y +50626 IA -6.0 Y +50627 IA -6.0 Y +50628 IA -6.0 Y +50629 IA -6.0 Y +50630 IA -6.0 Y +50631 IA -6.0 Y +50632 IA -6.0 Y +50633 IA -6.0 Y +50634 IA -6.0 Y +50635 IA -6.0 Y +50636 IA -6.0 Y +50638 IA -6.0 Y +50641 IA -6.0 Y +50642 IA -6.0 Y +50643 IA -6.0 Y +50644 IA -6.0 Y +50645 IA -6.0 Y +50647 IA -6.0 Y +50648 IA -6.0 Y +50649 IA -6.0 Y +50650 IA -6.0 Y +50651 IA -6.0 Y +50652 IA -6.0 Y +50653 IA -6.0 Y +50654 IA -6.0 Y +50655 IA -6.0 Y +50657 IA -6.0 Y +50658 IA -6.0 Y +50659 IA -6.0 Y +50660 IA -6.0 Y +50661 IA -6.0 Y +50662 IA -6.0 Y +50664 IA -6.0 Y +50665 IA -6.0 Y +50666 IA -6.0 Y +50667 IA -6.0 Y +50668 IA -6.0 Y +50669 IA -6.0 Y +50670 IA -6.0 Y +50671 IA -6.0 Y +50672 IA -6.0 Y +50673 IA -6.0 Y +50674 IA -6.0 Y +50675 IA -6.0 Y +50676 IA -6.0 Y +50677 IA -6.0 Y +50680 IA -6.0 Y +50681 IA -6.0 Y +50682 IA -6.0 Y +50701 IA -6.0 Y +50702 IA -6.0 Y +50703 IA -6.0 Y +50704 IA -6.0 Y +50706 IA -6.0 Y +50707 IA -6.0 Y +50801 IA -6.0 Y +50830 IA -6.0 Y +50831 IA -6.0 Y +50833 IA -6.0 Y +50835 IA -6.0 Y +50836 IA -6.0 Y +50837 IA -6.0 Y +50839 IA -6.0 Y +50840 IA -6.0 Y +50841 IA -6.0 Y +50842 IA -6.0 Y +50843 IA -6.0 Y +50845 IA -6.0 Y +50846 IA -6.0 Y +50847 IA -6.0 Y +50848 IA -6.0 Y +50849 IA -6.0 Y +50851 IA -6.0 Y +50853 IA -6.0 Y +50854 IA -6.0 Y +50857 IA -6.0 Y +50858 IA -6.0 Y +50859 IA -6.0 Y +50860 IA -6.0 Y +50861 IA -6.0 Y +50862 IA -6.0 Y +50863 IA -6.0 Y +50864 IA -6.0 Y +50936 IA -6.0 Y +50940 IA -6.0 Y +50947 IA -6.0 Y +50950 IA -6.0 Y +50980 IA -6.0 Y +50981 IA -6.0 Y +51001 IA -6.0 Y +51002 IA -6.0 Y +51003 IA -6.0 Y +51004 IA -6.0 Y +51005 IA -6.0 Y +51006 IA -6.0 Y +51007 IA -6.0 Y +51008 IA -6.0 Y +51009 IA -6.0 Y +51010 IA -6.0 Y +51011 IA -6.0 Y +51012 IA -6.0 Y +51014 IA -6.0 Y +51015 IA -6.0 Y +51016 IA -6.0 Y +51018 IA -6.0 Y +51019 IA -6.0 Y +51020 IA -6.0 Y +51022 IA -6.0 Y +51023 IA -6.0 Y +51024 IA -6.0 Y +51025 IA -6.0 Y +51026 IA -6.0 Y +51027 IA -6.0 Y +51028 IA -6.0 Y +51029 IA -6.0 Y +51030 IA -6.0 Y +51031 IA -6.0 Y +51033 IA -6.0 Y +51034 IA -6.0 Y +51035 IA -6.0 Y +51036 IA -6.0 Y +51037 IA -6.0 Y +51038 IA -6.0 Y +51039 IA -6.0 Y +51040 IA -6.0 Y +51041 IA -6.0 Y +51044 IA -6.0 Y +51045 IA -6.0 Y +51046 IA -6.0 Y +51047 IA -6.0 Y +51048 IA -6.0 Y +51049 IA -6.0 Y +51050 IA -6.0 Y +51051 IA -6.0 Y +51052 IA -6.0 Y +51053 IA -6.0 Y +51054 IA -6.0 Y +51055 IA -6.0 Y +51056 IA -6.0 Y +51058 IA -6.0 Y +51060 IA -6.0 Y +51061 IA -6.0 Y +51062 IA -6.0 Y +51063 IA -6.0 Y +51101 IA -6.0 Y +51102 IA -6.0 Y +51103 IA -6.0 Y +51104 IA -6.0 Y +51105 IA -6.0 Y +51106 IA -6.0 Y +51108 IA -6.0 Y +51109 IA -6.0 Y +51111 IA -6.0 Y +51201 IA -6.0 Y +51230 IA -6.0 Y +51231 IA -6.0 Y +51232 IA -6.0 Y +51234 IA -6.0 Y +51235 IA -6.0 Y +51237 IA -6.0 Y +51238 IA -6.0 Y +51239 IA -6.0 Y +51240 IA -6.0 Y +51241 IA -6.0 Y +51242 IA -6.0 Y +51243 IA -6.0 Y +51244 IA -6.0 Y +51245 IA -6.0 Y +51246 IA -6.0 Y +51247 IA -6.0 Y +51248 IA -6.0 Y +51249 IA -6.0 Y +51250 IA -6.0 Y +51301 IA -6.0 Y +51331 IA -6.0 Y +51333 IA -6.0 Y +51334 IA -6.0 Y +51338 IA -6.0 Y +51340 IA -6.0 Y +51341 IA -6.0 Y +51342 IA -6.0 Y +51343 IA -6.0 Y +51344 IA -6.0 Y +51345 IA -6.0 Y +51346 IA -6.0 Y +51347 IA -6.0 Y +51350 IA -6.0 Y +51351 IA -6.0 Y +51354 IA -6.0 Y +51355 IA -6.0 Y +51357 IA -6.0 Y +51358 IA -6.0 Y +51360 IA -6.0 Y +51363 IA -6.0 Y +51364 IA -6.0 Y +51365 IA -6.0 Y +51366 IA -6.0 Y +51401 IA -6.0 Y +51430 IA -6.0 Y +51431 IA -6.0 Y +51432 IA -6.0 Y +51433 IA -6.0 Y +51436 IA -6.0 Y +51439 IA -6.0 Y +51440 IA -6.0 Y +51441 IA -6.0 Y +51442 IA -6.0 Y +51443 IA -6.0 Y +51444 IA -6.0 Y +51445 IA -6.0 Y +51446 IA -6.0 Y +51447 IA -6.0 Y +51448 IA -6.0 Y +51449 IA -6.0 Y +51450 IA -6.0 Y +51451 IA -6.0 Y +51452 IA -6.0 Y +51453 IA -6.0 Y +51454 IA -6.0 Y +51455 IA -6.0 Y +51458 IA -6.0 Y +51459 IA -6.0 Y +51460 IA -6.0 Y +51461 IA -6.0 Y +51462 IA -6.0 Y +51463 IA -6.0 Y +51465 IA -6.0 Y +51466 IA -6.0 Y +51467 IA -6.0 Y +51501 IA -6.0 Y +51502 IA -6.0 Y +51503 IA -6.0 Y +51510 IA -6.0 Y +51520 IA -6.0 Y +51521 IA -6.0 Y +51523 IA -6.0 Y +51525 IA -6.0 Y +51526 IA -6.0 Y +51527 IA -6.0 Y +51528 IA -6.0 Y +51529 IA -6.0 Y +51530 IA -6.0 Y +51531 IA -6.0 Y +51532 IA -6.0 Y +51533 IA -6.0 Y +51534 IA -6.0 Y +51535 IA -6.0 Y +51536 IA -6.0 Y +51537 IA -6.0 Y +51540 IA -6.0 Y +51541 IA -6.0 Y +51542 IA -6.0 Y +51543 IA -6.0 Y +51544 IA -6.0 Y +51545 IA -6.0 Y +51546 IA -6.0 Y +51548 IA -6.0 Y +51549 IA -6.0 Y +51550 IA -6.0 Y +51551 IA -6.0 Y +51552 IA -6.0 Y +51553 IA -6.0 Y +51554 IA -6.0 Y +51555 IA -6.0 Y +51556 IA -6.0 Y +51557 IA -6.0 Y +51558 IA -6.0 Y +51559 IA -6.0 Y +51560 IA -6.0 Y +51561 IA -6.0 Y +51562 IA -6.0 Y +51563 IA -6.0 Y +51564 IA -6.0 Y +51565 IA -6.0 Y +51566 IA -6.0 Y +51570 IA -6.0 Y +51571 IA -6.0 Y +51572 IA -6.0 Y +51573 IA -6.0 Y +51575 IA -6.0 Y +51576 IA -6.0 Y +51577 IA -6.0 Y +51578 IA -6.0 Y +51579 IA -6.0 Y +51591 IA -6.0 Y +51593 IA -6.0 Y +51601 IA -6.0 Y +51602 IA -6.0 Y +51603 IA -6.0 Y +51630 IA -6.0 Y +51631 IA -6.0 Y +51632 IA -6.0 Y +51636 IA -6.0 Y +51637 IA -6.0 Y +51638 IA -6.0 Y +51639 IA -6.0 Y +51640 IA -6.0 Y +51645 IA -6.0 Y +51646 IA -6.0 Y +51647 IA -6.0 Y +51648 IA -6.0 Y +51649 IA -6.0 Y +51650 IA -6.0 Y +51651 IA -6.0 Y +51652 IA -6.0 Y +51653 IA -6.0 Y +51654 IA -6.0 Y +51656 IA -6.0 Y +52001 IA -6.0 Y +52002 IA -6.0 Y +52003 IA -6.0 Y +52004 IA -6.0 Y +52030 IA -6.0 Y +52031 IA -6.0 Y +52032 IA -6.0 Y +52033 IA -6.0 Y +52035 IA -6.0 Y +52036 IA -6.0 Y +52037 IA -6.0 Y +52038 IA -6.0 Y +52039 IA -6.0 Y +52040 IA -6.0 Y +52041 IA -6.0 Y +52042 IA -6.0 Y +52043 IA -6.0 Y +52044 IA -6.0 Y +52045 IA -6.0 Y +52046 IA -6.0 Y +52047 IA -6.0 Y +52048 IA -6.0 Y +52049 IA -6.0 Y +52050 IA -6.0 Y +52052 IA -6.0 Y +52053 IA -6.0 Y +52054 IA -6.0 Y +52056 IA -6.0 Y +52057 IA -6.0 Y +52060 IA -6.0 Y +52064 IA -6.0 Y +52065 IA -6.0 Y +52066 IA -6.0 Y +52068 IA -6.0 Y +52069 IA -6.0 Y +52070 IA -6.0 Y +52071 IA -6.0 Y +52072 IA -6.0 Y +52073 IA -6.0 Y +52074 IA -6.0 Y +52075 IA -6.0 Y +52076 IA -6.0 Y +52077 IA -6.0 Y +52078 IA -6.0 Y +52079 IA -6.0 Y +52099 IA -6.0 Y +52101 IA -6.0 Y +52132 IA -6.0 Y +52133 IA -6.0 Y +52134 IA -6.0 Y +52135 IA -6.0 Y +52136 IA -6.0 Y +52140 IA -6.0 Y +52141 IA -6.0 Y +52142 IA -6.0 Y +52144 IA -6.0 Y +52146 IA -6.0 Y +52147 IA -6.0 Y +52149 IA -6.0 Y +52151 IA -6.0 Y +52154 IA -6.0 Y +52155 IA -6.0 Y +52156 IA -6.0 Y +52157 IA -6.0 Y +52158 IA -6.0 Y +52159 IA -6.0 Y +52160 IA -6.0 Y +52161 IA -6.0 Y +52162 IA -6.0 Y +52163 IA -6.0 Y +52164 IA -6.0 Y +52165 IA -6.0 Y +52166 IA -6.0 Y +52168 IA -6.0 Y +52169 IA -6.0 Y +52170 IA -6.0 Y +52171 IA -6.0 Y +52172 IA -6.0 Y +52175 IA -6.0 Y +52201 IA -6.0 Y +52202 IA -6.0 Y +52203 IA -6.0 Y +52204 IA -6.0 Y +52205 IA -6.0 Y +52206 IA -6.0 Y +52207 IA -6.0 Y +52208 IA -6.0 Y +52209 IA -6.0 Y +52210 IA -6.0 Y +52211 IA -6.0 Y +52212 IA -6.0 Y +52213 IA -6.0 Y +52214 IA -6.0 Y +52215 IA -6.0 Y +52216 IA -6.0 Y +52217 IA -6.0 Y +52218 IA -6.0 Y +52219 IA -6.0 Y +52220 IA -6.0 Y +52221 IA -6.0 Y +52222 IA -6.0 Y +52223 IA -6.0 Y +52224 IA -6.0 Y +52225 IA -6.0 Y +52227 IA -6.0 Y +52228 IA -6.0 Y +52229 IA -6.0 Y +52231 IA -6.0 Y +52232 IA -6.0 Y +52233 IA -6.0 Y +52235 IA -6.0 Y +52236 IA -6.0 Y +52237 IA -6.0 Y +52240 IA -6.0 Y +52241 IA -6.0 Y +52242 IA -6.0 Y +52243 IA -6.0 Y +52244 IA -6.0 Y +52245 IA -6.0 Y +52246 IA -6.0 Y +52247 IA -6.0 Y +52248 IA -6.0 Y +52249 IA -6.0 Y +52251 IA -6.0 Y +52252 IA -6.0 Y +52253 IA -6.0 Y +52254 IA -6.0 Y +52255 IA -6.0 Y +52257 IA -6.0 Y +52301 IA -6.0 Y +52302 IA -6.0 Y +52305 IA -6.0 Y +52306 IA -6.0 Y +52307 IA -6.0 Y +52308 IA -6.0 Y +52309 IA -6.0 Y +52310 IA -6.0 Y +52312 IA -6.0 Y +52313 IA -6.0 Y +52314 IA -6.0 Y +52315 IA -6.0 Y +52316 IA -6.0 Y +52317 IA -6.0 Y +52318 IA -6.0 Y +52319 IA -6.0 Y +52320 IA -6.0 Y +52321 IA -6.0 Y +52322 IA -6.0 Y +52323 IA -6.0 Y +52324 IA -6.0 Y +52325 IA -6.0 Y +52326 IA -6.0 Y +52327 IA -6.0 Y +52328 IA -6.0 Y +52329 IA -6.0 Y +52330 IA -6.0 Y +52332 IA -6.0 Y +52333 IA -6.0 Y +52334 IA -6.0 Y +52335 IA -6.0 Y +52336 IA -6.0 Y +52337 IA -6.0 Y +52338 IA -6.0 Y +52339 IA -6.0 Y +52340 IA -6.0 Y +52341 IA -6.0 Y +52342 IA -6.0 Y +52344 IA -6.0 Y +52345 IA -6.0 Y +52346 IA -6.0 Y +52347 IA -6.0 Y +52348 IA -6.0 Y +52349 IA -6.0 Y +52350 IA -6.0 Y +52351 IA -6.0 Y +52352 IA -6.0 Y +52353 IA -6.0 Y +52354 IA -6.0 Y +52355 IA -6.0 Y +52356 IA -6.0 Y +52358 IA -6.0 Y +52359 IA -6.0 Y +52361 IA -6.0 Y +52362 IA -6.0 Y +52401 IA -6.0 Y +52402 IA -6.0 Y +52403 IA -6.0 Y +52404 IA -6.0 Y +52405 IA -6.0 Y +52406 IA -6.0 Y +52407 IA -6.0 Y +52408 IA -6.0 Y +52409 IA -6.0 Y +52410 IA -6.0 Y +52411 IA -6.0 Y +52497 IA -6.0 Y +52498 IA -6.0 Y +52499 IA -6.0 Y +52501 IA -6.0 Y +52530 IA -6.0 Y +52531 IA -6.0 Y +52533 IA -6.0 Y +52534 IA -6.0 Y +52535 IA -6.0 Y +52536 IA -6.0 Y +52537 IA -6.0 Y +52538 IA -6.0 Y +52540 IA -6.0 Y +52542 IA -6.0 Y +52543 IA -6.0 Y +52544 IA -6.0 Y +52548 IA -6.0 Y +52549 IA -6.0 Y +52550 IA -6.0 Y +52551 IA -6.0 Y +52552 IA -6.0 Y +52553 IA -6.0 Y +52554 IA -6.0 Y +52555 IA -6.0 Y +52556 IA -6.0 Y +52557 IA -6.0 Y +52560 IA -6.0 Y +52561 IA -6.0 Y +52562 IA -6.0 Y +52563 IA -6.0 Y +52565 IA -6.0 Y +52566 IA -6.0 Y +52567 IA -6.0 Y +52568 IA -6.0 Y +52569 IA -6.0 Y +52570 IA -6.0 Y +52571 IA -6.0 Y +52572 IA -6.0 Y +52573 IA -6.0 Y +52574 IA -6.0 Y +52576 IA -6.0 Y +52577 IA -6.0 Y +52580 IA -6.0 Y +52581 IA -6.0 Y +52583 IA -6.0 Y +52584 IA -6.0 Y +52585 IA -6.0 Y +52586 IA -6.0 Y +52588 IA -6.0 Y +52590 IA -6.0 Y +52591 IA -6.0 Y +52593 IA -6.0 Y +52594 IA -6.0 Y +52595 IA -6.0 Y +52601 IA -6.0 Y +52619 IA -6.0 Y +52620 IA -6.0 Y +52621 IA -6.0 Y +52623 IA -6.0 Y +52624 IA -6.0 Y +52625 IA -6.0 Y +52626 IA -6.0 Y +52627 IA -6.0 Y +52630 IA -6.0 Y +52631 IA -6.0 Y +52632 IA -6.0 Y +52635 IA -6.0 Y +52637 IA -6.0 Y +52638 IA -6.0 Y +52639 IA -6.0 Y +52640 IA -6.0 Y +52641 IA -6.0 Y +52642 IA -6.0 Y +52644 IA -6.0 Y +52645 IA -6.0 Y +52646 IA -6.0 Y +52647 IA -6.0 Y +52648 IA -6.0 Y +52649 IA -6.0 Y +52650 IA -6.0 Y +52651 IA -6.0 Y +52652 IA -6.0 Y +52653 IA -6.0 Y +52654 IA -6.0 Y +52655 IA -6.0 Y +52656 IA -6.0 Y +52657 IA -6.0 Y +52658 IA -6.0 Y +52659 IA -6.0 Y +52660 IA -6.0 Y +52701 IA -6.0 Y +52720 IA -6.0 Y +52721 IA -6.0 Y +52722 IA -6.0 Y +52726 IA -6.0 Y +52727 IA -6.0 Y +52728 IA -6.0 Y +52729 IA -6.0 Y +52730 IA -6.0 Y +52731 IA -6.0 Y +52732 IA -6.0 Y +52733 IA -6.0 Y +52734 IA -6.0 Y +52736 IA -6.0 Y +52737 IA -6.0 Y +52738 IA -6.0 Y +52739 IA -6.0 Y +52742 IA -6.0 Y +52745 IA -6.0 Y +52746 IA -6.0 Y +52747 IA -6.0 Y +52748 IA -6.0 Y +52749 IA -6.0 Y +52750 IA -6.0 Y +52751 IA -6.0 Y +52752 IA -6.0 Y +52753 IA -6.0 Y +52754 IA -6.0 Y +52755 IA -6.0 Y +52756 IA -6.0 Y +52757 IA -6.0 Y +52758 IA -6.0 Y +52759 IA -6.0 Y +52760 IA -6.0 Y +52761 IA -6.0 Y +52765 IA -6.0 Y +52766 IA -6.0 Y +52767 IA -6.0 Y +52768 IA -6.0 Y +52769 IA -6.0 Y +52771 IA -6.0 Y +52772 IA -6.0 Y +52773 IA -6.0 Y +52774 IA -6.0 Y +52776 IA -6.0 Y +52777 IA -6.0 Y +52778 IA -6.0 Y +52801 IA -6.0 Y +52802 IA -6.0 Y +52803 IA -6.0 Y +52804 IA -6.0 Y +52805 IA -6.0 Y +52806 IA -6.0 Y +52807 IA -6.0 Y +52808 IA -6.0 Y +52809 IA -6.0 Y +53001 WI -6.0 Y +53002 WI -6.0 Y +53003 WI -6.0 Y +53004 WI -6.0 Y +53005 WI -6.0 Y +53006 WI -6.0 Y +53007 WI -6.0 Y +53008 WI -6.0 Y +53010 WI -6.0 Y +53011 WI -6.0 Y +53012 WI -6.0 Y +53013 WI -6.0 Y +53014 WI -6.0 Y +53015 WI -6.0 Y +53016 WI -6.0 Y +53017 WI -6.0 Y +53018 WI -6.0 Y +53019 WI -6.0 Y +53020 WI -6.0 Y +53021 WI -6.0 Y +53022 WI -6.0 Y +53023 WI -6.0 Y +53024 WI -6.0 Y +53026 WI -6.0 Y +53027 WI -6.0 Y +53029 WI -6.0 Y +53031 WI -6.0 Y +53032 WI -6.0 Y +53033 WI -6.0 Y +53034 WI -6.0 Y +53035 WI -6.0 Y +53036 WI -6.0 Y +53037 WI -6.0 Y +53038 WI -6.0 Y +53039 WI -6.0 Y +53040 WI -6.0 Y +53042 WI -6.0 Y +53044 WI -6.0 Y +53045 WI -6.0 Y +53046 WI -6.0 Y +53047 WI -6.0 Y +53048 WI -6.0 Y +53049 WI -6.0 Y +53050 WI -6.0 Y +53051 WI -6.0 Y +53052 WI -6.0 Y +53056 WI -6.0 Y +53057 WI -6.0 Y +53058 WI -6.0 Y +53059 WI -6.0 Y +53060 WI -6.0 Y +53061 WI -6.0 Y +53062 WI -6.0 Y +53063 WI -6.0 Y +53064 WI -6.0 Y +53065 WI -6.0 Y +53066 WI -6.0 Y +53069 WI -6.0 Y +53070 WI -6.0 Y +53072 WI -6.0 Y +53073 WI -6.0 Y +53074 WI -6.0 Y +53075 WI -6.0 Y +53076 WI -6.0 Y +53078 WI -6.0 Y +53079 WI -6.0 Y +53080 WI -6.0 Y +53081 WI -6.0 Y +53082 WI -6.0 Y +53083 WI -6.0 Y +53085 WI -6.0 Y +53086 WI -6.0 Y +53088 WI -6.0 Y +53089 WI -6.0 Y +53090 WI -6.0 Y +53091 WI -6.0 Y +53092 WI -6.0 Y +53093 WI -6.0 Y +53094 WI -6.0 Y +53095 WI -6.0 Y +53097 WI -6.0 Y +53098 WI -6.0 Y +53099 WI -6.0 Y +53101 WI -6.0 Y +53102 WI -6.0 Y +53103 WI -6.0 Y +53104 WI -6.0 Y +53105 WI -6.0 Y +53108 WI -6.0 Y +53109 WI -6.0 Y +53110 WI -6.0 Y +53114 WI -6.0 Y +53115 WI -6.0 Y +53118 WI -6.0 Y +53119 WI -6.0 Y +53120 WI -6.0 Y +53121 WI -6.0 Y +53122 WI -6.0 Y +53125 WI -6.0 Y +53126 WI -6.0 Y +53127 WI -6.0 Y +53128 WI -6.0 Y +53129 WI -6.0 Y +53130 WI -6.0 Y +53132 WI -6.0 Y +53137 WI -6.0 Y +53138 WI -6.0 Y +53139 WI -6.0 Y +53140 WI -6.0 Y +53141 WI -6.0 Y +53142 WI -6.0 Y +53143 WI -6.0 Y +53144 WI -6.0 Y +53146 WI -6.0 Y +53147 WI -6.0 Y +53148 WI -6.0 Y +53149 WI -6.0 Y +53150 WI -6.0 Y +53151 WI -6.0 Y +53152 WI -6.0 Y +53153 WI -6.0 Y +53154 WI -6.0 Y +53156 WI -6.0 Y +53157 WI -6.0 Y +53158 WI -6.0 Y +53159 WI -6.0 Y +53167 WI -6.0 Y +53168 WI -6.0 Y +53170 WI -6.0 Y +53171 WI -6.0 Y +53172 WI -6.0 Y +53176 WI -6.0 Y +53177 WI -6.0 Y +53178 WI -6.0 Y +53179 WI -6.0 Y +53181 WI -6.0 Y +53182 WI -6.0 Y +53183 WI -6.0 Y +53184 WI -6.0 Y +53185 WI -6.0 Y +53186 WI -6.0 Y +53187 WI -6.0 Y +53188 WI -6.0 Y +53189 WI -6.0 Y +53190 WI -6.0 Y +53191 WI -6.0 Y +53192 WI -6.0 Y +53194 WI -6.0 Y +53195 WI -6.0 Y +53199 WI -6.0 Y +53201 WI -6.0 Y +53202 WI -6.0 Y +53203 WI -6.0 Y +53204 WI -6.0 Y +53205 WI -6.0 Y +53206 WI -6.0 Y +53207 WI -6.0 Y +53208 WI -6.0 Y +53209 WI -6.0 Y +53210 WI -6.0 Y +53211 WI -6.0 Y +53212 WI -6.0 Y +53213 WI -6.0 Y +53214 WI -6.0 Y +53215 WI -6.0 Y +53216 WI -6.0 Y +53217 WI -6.0 Y +53218 WI -6.0 Y +53219 WI -6.0 Y +53220 WI -6.0 Y +53221 WI -6.0 Y +53222 WI -6.0 Y +53223 WI -6.0 Y +53224 WI -6.0 Y +53225 WI -6.0 Y +53226 WI -6.0 Y +53227 WI -6.0 Y +53228 WI -6.0 Y +53233 WI -6.0 Y +53234 WI -6.0 Y +53235 WI -6.0 Y +53237 WI -6.0 Y +53244 WI -6.0 Y +53259 WI -6.0 Y +53263 WI -6.0 Y +53267 WI -6.0 Y +53268 WI -6.0 Y +53274 WI -6.0 Y +53278 WI -6.0 Y +53288 WI -6.0 Y +53290 WI -6.0 Y +53293 WI -6.0 Y +53295 WI -6.0 Y +53401 WI -6.0 Y +53402 WI -6.0 Y +53403 WI -6.0 Y +53404 WI -6.0 Y +53405 WI -6.0 Y +53406 WI -6.0 Y +53407 WI -6.0 Y +53408 WI -6.0 Y +53490 WI -6.0 Y +53501 WI -6.0 Y +53502 WI -6.0 Y +53503 WI -6.0 Y +53504 WI -6.0 Y +53505 WI -6.0 Y +53506 WI -6.0 Y +53507 WI -6.0 Y +53508 WI -6.0 Y +53510 WI -6.0 Y +53511 WI -6.0 Y +53512 WI -6.0 Y +53515 WI -6.0 Y +53516 WI -6.0 Y +53517 WI -6.0 Y +53518 WI -6.0 Y +53520 WI -6.0 Y +53521 WI -6.0 Y +53522 WI -6.0 Y +53523 WI -6.0 Y +53525 WI -6.0 Y +53526 WI -6.0 Y +53527 WI -6.0 Y +53528 WI -6.0 Y +53529 WI -6.0 Y +53530 WI -6.0 Y +53531 WI -6.0 Y +53532 WI -6.0 Y +53533 WI -6.0 Y +53534 WI -6.0 Y +53535 WI -6.0 Y +53536 WI -6.0 Y +53537 WI -6.0 Y +53538 WI -6.0 Y +53540 WI -6.0 Y +53541 WI -6.0 Y +53542 WI -6.0 Y +53543 WI -6.0 Y +53544 WI -6.0 Y +53545 WI -6.0 Y +53546 WI -6.0 Y +53547 WI -6.0 Y +53548 WI -6.0 Y +53549 WI -6.0 Y +53550 WI -6.0 Y +53551 WI -6.0 Y +53553 WI -6.0 Y +53554 WI -6.0 Y +53555 WI -6.0 Y +53556 WI -6.0 Y +53557 WI -6.0 Y +53558 WI -6.0 Y +53559 WI -6.0 Y +53560 WI -6.0 Y +53561 WI -6.0 Y +53562 WI -6.0 Y +53563 WI -6.0 Y +53565 WI -6.0 Y +53566 WI -6.0 Y +53569 WI -6.0 Y +53570 WI -6.0 Y +53571 WI -6.0 Y +53572 WI -6.0 Y +53573 WI -6.0 Y +53574 WI -6.0 Y +53575 WI -6.0 Y +53576 WI -6.0 Y +53577 WI -6.0 Y +53578 WI -6.0 Y +53579 WI -6.0 Y +53580 WI -6.0 Y +53581 WI -6.0 Y +53582 WI -6.0 Y +53583 WI -6.0 Y +53584 WI -6.0 Y +53585 WI -6.0 Y +53586 WI -6.0 Y +53587 WI -6.0 Y +53588 WI -6.0 Y +53589 WI -6.0 Y +53590 WI -6.0 Y +53593 WI -6.0 Y +53594 WI -6.0 Y +53595 WI -6.0 Y +53596 WI -6.0 Y +53597 WI -6.0 Y +53598 WI -6.0 Y +53599 WI -6.0 Y +53701 WI -6.0 Y +53702 WI -6.0 Y +53703 WI -6.0 Y +53704 WI -6.0 Y +53705 WI -6.0 Y +53706 WI -6.0 Y +53707 WI -6.0 Y +53708 WI -6.0 Y +53711 WI -6.0 Y +53713 WI -6.0 Y +53714 WI -6.0 Y +53715 WI -6.0 Y +53716 WI -6.0 Y +53717 WI -6.0 Y +53718 WI -6.0 Y +53719 WI -6.0 Y +53725 WI -6.0 Y +53726 WI -6.0 Y +53744 WI -6.0 Y +53774 WI -6.0 Y +53777 WI -6.0 Y +53778 WI -6.0 Y +53779 WI -6.0 Y +53782 WI -6.0 Y +53783 WI -6.0 Y +53784 WI -6.0 Y +53785 WI -6.0 Y +53786 WI -6.0 Y +53788 WI -6.0 Y +53789 WI -6.0 Y +53790 WI -6.0 Y +53791 WI -6.0 Y +53792 WI -6.0 Y +53793 WI -6.0 Y +53794 WI -6.0 Y +53801 WI -6.0 Y +53802 WI -6.0 Y +53803 WI -6.0 Y +53804 WI -6.0 Y +53805 WI -6.0 Y +53806 WI -6.0 Y +53807 WI -6.0 Y +53808 WI -6.0 Y +53809 WI -6.0 Y +53810 WI -6.0 Y +53811 WI -6.0 Y +53812 WI -6.0 Y +53813 WI -6.0 Y +53816 WI -6.0 Y +53817 WI -6.0 Y +53818 WI -6.0 Y +53820 WI -6.0 Y +53821 WI -6.0 Y +53824 WI -6.0 Y +53825 WI -6.0 Y +53826 WI -6.0 Y +53827 WI -6.0 Y +53901 WI -6.0 Y +53910 WI -6.0 Y +53911 WI -6.0 Y +53913 WI -6.0 Y +53916 WI -6.0 Y +53919 WI -6.0 Y +53920 WI -6.0 Y +53922 WI -6.0 Y +53923 WI -6.0 Y +53924 WI -6.0 Y +53925 WI -6.0 Y +53926 WI -6.0 Y +53927 WI -6.0 Y +53928 WI -6.0 Y +53929 WI -6.0 Y +53930 WI -6.0 Y +53931 WI -6.0 Y +53932 WI -6.0 Y +53933 WI -6.0 Y +53934 WI -6.0 Y +53935 WI -6.0 Y +53936 WI -6.0 Y +53937 WI -6.0 Y +53939 WI -6.0 Y +53940 WI -6.0 Y +53941 WI -6.0 Y +53942 WI -6.0 Y +53943 WI -6.0 Y +53944 WI -6.0 Y +53946 WI -6.0 Y +53947 WI -6.0 Y +53948 WI -6.0 Y +53949 WI -6.0 Y +53950 WI -6.0 Y +53951 WI -6.0 Y +53952 WI -6.0 Y +53953 WI -6.0 Y +53954 WI -6.0 Y +53955 WI -6.0 Y +53956 WI -6.0 Y +53957 WI -6.0 Y +53958 WI -6.0 Y +53959 WI -6.0 Y +53960 WI -6.0 Y +53961 WI -6.0 Y +53962 WI -6.0 Y +53963 WI -6.0 Y +53964 WI -6.0 Y +53965 WI -6.0 Y +53968 WI -6.0 Y +53969 WI -6.0 Y +54001 WI -6.0 Y +54002 WI -6.0 Y +54003 WI -6.0 Y +54004 WI -6.0 Y +54005 WI -6.0 Y +54006 WI -6.0 Y +54007 WI -6.0 Y +54009 WI -6.0 Y +54010 WI -6.0 Y +54011 WI -6.0 Y +54013 WI -6.0 Y +54014 WI -6.0 Y +54015 WI -6.0 Y +54016 WI -6.0 Y +54017 WI -6.0 Y +54020 WI -6.0 Y +54021 WI -6.0 Y +54022 WI -6.0 Y +54023 WI -6.0 Y +54024 WI -6.0 Y +54025 WI -6.0 Y +54026 WI -6.0 Y +54027 WI -6.0 Y +54028 WI -6.0 Y +54082 WI -6.0 Y +54101 WI -6.0 Y +54102 WI -6.0 Y +54103 WI -6.0 Y +54104 WI -6.0 Y +54106 WI -6.0 Y +54107 WI -6.0 Y +54110 WI -6.0 Y +54111 WI -6.0 Y +54112 WI -6.0 Y +54113 WI -6.0 Y +54114 WI -6.0 Y +54115 WI -6.0 Y +54119 WI -6.0 Y +54120 WI -6.0 Y +54121 WI -6.0 Y +54123 WI -6.0 Y +54124 WI -6.0 Y +54125 WI -6.0 Y +54126 WI -6.0 Y +54127 WI -6.0 Y +54128 WI -6.0 Y +54129 WI -6.0 Y +54130 WI -6.0 Y +54131 WI -6.0 Y +54135 WI -6.0 Y +54136 WI -6.0 Y +54137 WI -6.0 Y +54138 WI -6.0 Y +54139 WI -6.0 Y +54140 WI -6.0 Y +54141 WI -6.0 Y +54143 WI -6.0 Y +54149 WI -6.0 Y +54150 WI -6.0 Y +54151 WI -6.0 Y +54152 WI -6.0 Y +54153 WI -6.0 Y +54154 WI -6.0 Y +54155 WI -6.0 Y +54156 WI -6.0 Y +54157 WI -6.0 Y +54159 WI -6.0 Y +54160 WI -6.0 Y +54161 WI -6.0 Y +54162 WI -6.0 Y +54165 WI -6.0 Y +54166 WI -6.0 Y +54169 WI -6.0 Y +54170 WI -6.0 Y +54171 WI -6.0 Y +54173 WI -6.0 Y +54174 WI -6.0 Y +54175 WI -6.0 Y +54177 WI -6.0 Y +54180 WI -6.0 Y +54182 WI -6.0 Y +54201 WI -6.0 Y +54202 WI -6.0 Y +54204 WI -6.0 Y +54205 WI -6.0 Y +54207 WI -6.0 Y +54208 WI -6.0 Y +54209 WI -6.0 Y +54210 WI -6.0 Y +54211 WI -6.0 Y +54212 WI -6.0 Y +54213 WI -6.0 Y +54214 WI -6.0 Y +54215 WI -6.0 Y +54216 WI -6.0 Y +54217 WI -6.0 Y +54220 WI -6.0 Y +54221 WI -6.0 Y +54226 WI -6.0 Y +54227 WI -6.0 Y +54228 WI -6.0 Y +54229 WI -6.0 Y +54230 WI -6.0 Y +54232 WI -6.0 Y +54234 WI -6.0 Y +54235 WI -6.0 Y +54240 WI -6.0 Y +54241 WI -6.0 Y +54245 WI -6.0 Y +54246 WI -6.0 Y +54247 WI -6.0 Y +54301 WI -6.0 Y +54302 WI -6.0 Y +54303 WI -6.0 Y +54304 WI -6.0 Y +54305 WI -6.0 Y +54306 WI -6.0 Y +54307 WI -6.0 Y +54308 WI -6.0 Y +54311 WI -6.0 Y +54313 WI -6.0 Y +54324 WI -6.0 Y +54344 WI -6.0 Y +54401 WI -6.0 Y +54402 WI -6.0 Y +54403 WI -6.0 Y +54404 WI -6.0 Y +54405 WI -6.0 Y +54406 WI -6.0 Y +54407 WI -6.0 Y +54408 WI -6.0 Y +54409 WI -6.0 Y +54410 WI -6.0 Y +54411 WI -6.0 Y +54412 WI -6.0 Y +54413 WI -6.0 Y +54414 WI -6.0 Y +54415 WI -6.0 Y +54416 WI -6.0 Y +54417 WI -6.0 Y +54418 WI -6.0 Y +54420 WI -6.0 Y +54421 WI -6.0 Y +54422 WI -6.0 Y +54423 WI -6.0 Y +54424 WI -6.0 Y +54425 WI -6.0 Y +54426 WI -6.0 Y +54427 WI -6.0 Y +54428 WI -6.0 Y +54429 WI -6.0 Y +54430 WI -6.0 Y +54432 WI -6.0 Y +54433 WI -6.0 Y +54434 WI -6.0 Y +54435 WI -6.0 Y +54436 WI -6.0 Y +54437 WI -6.0 Y +54439 WI -6.0 Y +54440 WI -6.0 Y +54441 WI -6.0 Y +54442 WI -6.0 Y +54443 WI -6.0 Y +54446 WI -6.0 Y +54447 WI -6.0 Y +54448 WI -6.0 Y +54449 WI -6.0 Y +54450 WI -6.0 Y +54451 WI -6.0 Y +54452 WI -6.0 Y +54454 WI -6.0 Y +54455 WI -6.0 Y +54456 WI -6.0 Y +54457 WI -6.0 Y +54458 WI -6.0 Y +54459 WI -6.0 Y +54460 WI -6.0 Y +54462 WI -6.0 Y +54463 WI -6.0 Y +54464 WI -6.0 Y +54465 WI -6.0 Y +54466 WI -6.0 Y +54467 WI -6.0 Y +54469 WI -6.0 Y +54470 WI -6.0 Y +54471 WI -6.0 Y +54472 WI -6.0 Y +54473 WI -6.0 Y +54474 WI -6.0 Y +54475 WI -6.0 Y +54476 WI -6.0 Y +54479 WI -6.0 Y +54480 WI -6.0 Y +54481 WI -6.0 Y +54484 WI -6.0 Y +54485 WI -6.0 Y +54486 WI -6.0 Y +54487 WI -6.0 Y +54488 WI -6.0 Y +54489 WI -6.0 Y +54490 WI -6.0 Y +54491 WI -6.0 Y +54492 WI -6.0 Y +54493 WI -6.0 Y +54494 WI -6.0 Y +54495 WI -6.0 Y +54498 WI -6.0 Y +54499 WI -6.0 Y +54501 WI -6.0 Y +54511 WI -6.0 Y +54512 WI -6.0 Y +54513 WI -6.0 Y +54514 WI -6.0 Y +54515 WI -6.0 Y +54517 WI -6.0 Y +54519 WI -6.0 Y +54520 WI -6.0 Y +54521 WI -6.0 Y +54524 WI -6.0 Y +54525 WI -6.0 Y +54526 WI -6.0 Y +54527 WI -6.0 Y +54529 WI -6.0 Y +54530 WI -6.0 Y +54531 WI -6.0 Y +54532 WI -6.0 Y +54534 WI -6.0 Y +54536 WI -6.0 Y +54537 WI -6.0 Y +54538 WI -6.0 Y +54539 WI -6.0 Y +54540 WI -6.0 Y +54541 WI -6.0 Y +54542 WI -6.0 Y +54543 WI -6.0 Y +54545 WI -6.0 Y +54546 WI -6.0 Y +54547 WI -6.0 Y +54548 WI -6.0 Y +54550 WI -6.0 Y +54552 WI -6.0 Y +54554 WI -6.0 Y +54555 WI -6.0 Y +54556 WI -6.0 Y +54557 WI -6.0 Y +54558 WI -6.0 Y +54559 WI -6.0 Y +54560 WI -6.0 Y +54561 WI -6.0 Y +54562 WI -6.0 Y +54563 WI -6.0 Y +54564 WI -6.0 Y +54565 WI -6.0 Y +54566 WI -6.0 Y +54568 WI -6.0 Y +54601 WI -6.0 Y +54602 WI -6.0 Y +54603 WI -6.0 Y +54610 WI -6.0 Y +54611 WI -6.0 Y +54612 WI -6.0 Y +54613 WI -6.0 Y +54614 WI -6.0 Y +54615 WI -6.0 Y +54616 WI -6.0 Y +54618 WI -6.0 Y +54619 WI -6.0 Y +54620 WI -6.0 Y +54621 WI -6.0 Y +54622 WI -6.0 Y +54623 WI -6.0 Y +54624 WI -6.0 Y +54625 WI -6.0 Y +54626 WI -6.0 Y +54627 WI -6.0 Y +54628 WI -6.0 Y +54629 WI -6.0 Y +54630 WI -6.0 Y +54631 WI -6.0 Y +54632 WI -6.0 Y +54634 WI -6.0 Y +54635 WI -6.0 Y +54636 WI -6.0 Y +54637 WI -6.0 Y +54638 WI -6.0 Y +54639 WI -6.0 Y +54640 WI -6.0 Y +54641 WI -6.0 Y +54642 WI -6.0 Y +54643 WI -6.0 Y +54644 WI -6.0 Y +54645 WI -6.0 Y +54646 WI -6.0 Y +54648 WI -6.0 Y +54649 WI -6.0 Y +54650 WI -6.0 Y +54651 WI -6.0 Y +54652 WI -6.0 Y +54653 WI -6.0 Y +54654 WI -6.0 Y +54655 WI -6.0 Y +54656 WI -6.0 Y +54657 WI -6.0 Y +54658 WI -6.0 Y +54659 WI -6.0 Y +54660 WI -6.0 Y +54661 WI -6.0 Y +54662 WI -6.0 Y +54664 WI -6.0 Y +54665 WI -6.0 Y +54666 WI -6.0 Y +54667 WI -6.0 Y +54669 WI -6.0 Y +54670 WI -6.0 Y +54701 WI -6.0 Y +54702 WI -6.0 Y +54703 WI -6.0 Y +54720 WI -6.0 Y +54721 WI -6.0 Y +54722 WI -6.0 Y +54723 WI -6.0 Y +54724 WI -6.0 Y +54725 WI -6.0 Y +54726 WI -6.0 Y +54727 WI -6.0 Y +54728 WI -6.0 Y +54729 WI -6.0 Y +54730 WI -6.0 Y +54731 WI -6.0 Y +54732 WI -6.0 Y +54733 WI -6.0 Y +54734 WI -6.0 Y +54735 WI -6.0 Y +54736 WI -6.0 Y +54737 WI -6.0 Y +54738 WI -6.0 Y +54739 WI -6.0 Y +54740 WI -6.0 Y +54741 WI -6.0 Y +54742 WI -6.0 Y +54743 WI -6.0 Y +54745 WI -6.0 Y +54746 WI -6.0 Y +54747 WI -6.0 Y +54748 WI -6.0 Y +54749 WI -6.0 Y +54750 WI -6.0 Y +54751 WI -6.0 Y +54754 WI -6.0 Y +54755 WI -6.0 Y +54756 WI -6.0 Y +54757 WI -6.0 Y +54758 WI -6.0 Y +54759 WI -6.0 Y +54760 WI -6.0 Y +54761 WI -6.0 Y +54762 WI -6.0 Y +54763 WI -6.0 Y +54764 WI -6.0 Y +54765 WI -6.0 Y +54766 WI -6.0 Y +54767 WI -6.0 Y +54768 WI -6.0 Y +54769 WI -6.0 Y +54770 WI -6.0 Y +54771 WI -6.0 Y +54772 WI -6.0 Y +54773 WI -6.0 Y +54774 WI -6.0 Y +54801 WI -6.0 Y +54805 WI -6.0 Y +54806 WI -6.0 Y +54810 WI -6.0 Y +54812 WI -6.0 Y +54813 WI -6.0 Y +54814 WI -6.0 Y +54816 WI -6.0 Y +54817 WI -6.0 Y +54818 WI -6.0 Y +54819 WI -6.0 Y +54820 WI -6.0 Y +54821 WI -6.0 Y +54822 WI -6.0 Y +54824 WI -6.0 Y +54826 WI -6.0 Y +54827 WI -6.0 Y +54828 WI -6.0 Y +54829 WI -6.0 Y +54830 WI -6.0 Y +54832 WI -6.0 Y +54834 WI -6.0 Y +54835 WI -6.0 Y +54836 WI -6.0 Y +54837 WI -6.0 Y +54838 WI -6.0 Y +54839 WI -6.0 Y +54840 WI -6.0 Y +54841 WI -6.0 Y +54842 WI -6.0 Y +54843 WI -6.0 Y +54844 WI -6.0 Y +54845 WI -6.0 Y +54846 WI -6.0 Y +54847 WI -6.0 Y +54848 WI -6.0 Y +54849 WI -6.0 Y +54850 WI -6.0 Y +54853 WI -6.0 Y +54854 WI -6.0 Y +54855 WI -6.0 Y +54856 WI -6.0 Y +54857 WI -6.0 Y +54858 WI -6.0 Y +54859 WI -6.0 Y +54861 WI -6.0 Y +54862 WI -6.0 Y +54864 WI -6.0 Y +54865 WI -6.0 Y +54867 WI -6.0 Y +54868 WI -6.0 Y +54870 WI -6.0 Y +54871 WI -6.0 Y +54872 WI -6.0 Y +54873 WI -6.0 Y +54874 WI -6.0 Y +54875 WI -6.0 Y +54876 WI -6.0 Y +54880 WI -6.0 Y +54888 WI -6.0 Y +54889 WI -6.0 Y +54890 WI -6.0 Y +54891 WI -6.0 Y +54893 WI -6.0 Y +54895 WI -6.0 Y +54896 WI -6.0 Y +54901 WI -6.0 Y +54902 WI -6.0 Y +54903 WI -6.0 Y +54904 WI -6.0 Y +54906 WI -6.0 Y +54909 WI -6.0 Y +54911 WI -6.0 Y +54912 WI -6.0 Y +54913 WI -6.0 Y +54914 WI -6.0 Y +54915 WI -6.0 Y +54919 WI -6.0 Y +54921 WI -6.0 Y +54922 WI -6.0 Y +54923 WI -6.0 Y +54926 WI -6.0 Y +54927 WI -6.0 Y +54928 WI -6.0 Y +54929 WI -6.0 Y +54930 WI -6.0 Y +54931 WI -6.0 Y +54932 WI -6.0 Y +54933 WI -6.0 Y +54934 WI -6.0 Y +54935 WI -6.0 Y +54936 WI -6.0 Y +54937 WI -6.0 Y +54940 WI -6.0 Y +54941 WI -6.0 Y +54942 WI -6.0 Y +54943 WI -6.0 Y +54944 WI -6.0 Y +54945 WI -6.0 Y +54946 WI -6.0 Y +54947 WI -6.0 Y +54948 WI -6.0 Y +54949 WI -6.0 Y +54950 WI -6.0 Y +54952 WI -6.0 Y +54956 WI -6.0 Y +54957 WI -6.0 Y +54960 WI -6.0 Y +54961 WI -6.0 Y +54962 WI -6.0 Y +54963 WI -6.0 Y +54964 WI -6.0 Y +54965 WI -6.0 Y +54966 WI -6.0 Y +54967 WI -6.0 Y +54968 WI -6.0 Y +54969 WI -6.0 Y +54970 WI -6.0 Y +54971 WI -6.0 Y +54974 WI -6.0 Y +54976 WI -6.0 Y +54977 WI -6.0 Y +54978 WI -6.0 Y +54979 WI -6.0 Y +54980 WI -6.0 Y +54981 WI -6.0 Y +54982 WI -6.0 Y +54983 WI -6.0 Y +54984 WI -6.0 Y +54985 WI -6.0 Y +54986 WI -6.0 Y +54990 WI -6.0 Y +55001 MN -6.0 Y +55002 MN -6.0 Y +55003 MN -6.0 Y +55005 MN -6.0 Y +55006 MN -6.0 Y +55007 MN -6.0 Y +55008 MN -6.0 Y +55009 MN -6.0 Y +55010 MN -6.0 Y +55011 MN -6.0 Y +55012 MN -6.0 Y +55013 MN -6.0 Y +55014 MN -6.0 Y +55016 MN -6.0 Y +55017 MN -6.0 Y +55018 MN -6.0 Y +55019 MN -6.0 Y +55020 MN -6.0 Y +55021 MN -6.0 Y +55024 MN -6.0 Y +55025 MN -6.0 Y +55026 MN -6.0 Y +55027 MN -6.0 Y +55029 MN -6.0 Y +55030 MN -6.0 Y +55031 MN -6.0 Y +55032 MN -6.0 Y +55033 MN -6.0 Y +55036 MN -6.0 Y +55037 MN -6.0 Y +55038 MN -6.0 Y +55040 MN -6.0 Y +55041 MN -6.0 Y +55042 MN -6.0 Y +55043 MN -6.0 Y +55044 MN -6.0 Y +55045 MN -6.0 Y +55046 MN -6.0 Y +55047 MN -6.0 Y +55049 MN -6.0 Y +55051 MN -6.0 Y +55052 MN -6.0 Y +55053 MN -6.0 Y +55054 MN -6.0 Y +55055 MN -6.0 Y +55056 MN -6.0 Y +55057 MN -6.0 Y +55060 MN -6.0 Y +55063 MN -6.0 Y +55065 MN -6.0 Y +55066 MN -6.0 Y +55067 MN -6.0 Y +55068 MN -6.0 Y +55069 MN -6.0 Y +55070 MN -6.0 Y +55071 MN -6.0 Y +55072 MN -6.0 Y +55073 MN -6.0 Y +55074 MN -6.0 Y +55075 MN -6.0 Y +55076 MN -6.0 Y +55077 MN -6.0 Y +55078 MN -6.0 Y +55079 MN -6.0 Y +55080 MN -6.0 Y +55082 MN -6.0 Y +55083 MN -6.0 Y +55084 MN -6.0 Y +55085 MN -6.0 Y +55087 MN -6.0 Y +55088 MN -6.0 Y +55089 MN -6.0 Y +55090 MN -6.0 Y +55092 MN -6.0 Y +55101 MN -6.0 Y +55102 MN -6.0 Y +55103 MN -6.0 Y +55104 MN -6.0 Y +55105 MN -6.0 Y +55106 MN -6.0 Y +55107 MN -6.0 Y +55108 MN -6.0 Y +55109 MN -6.0 Y +55110 MN -6.0 Y +55111 MN -6.0 Y +55112 MN -6.0 Y +55113 MN -6.0 Y +55114 MN -6.0 Y +55115 MN -6.0 Y +55116 MN -6.0 Y +55117 MN -6.0 Y +55118 MN -6.0 Y +55119 MN -6.0 Y +55120 MN -6.0 Y +55121 MN -6.0 Y +55122 MN -6.0 Y +55123 MN -6.0 Y +55124 MN -6.0 Y +55125 MN -6.0 Y +55126 MN -6.0 Y +55127 MN -6.0 Y +55128 MN -6.0 Y +55129 MN -6.0 Y +55130 MN -6.0 Y +55133 MN -6.0 Y +55144 MN -6.0 Y +55145 MN -6.0 Y +55146 MN -6.0 Y +55150 MN -6.0 Y +55155 MN -6.0 Y +55161 MN -6.0 Y +55164 MN -6.0 Y +55165 MN -6.0 Y +55166 MN -6.0 Y +55168 MN -6.0 Y +55169 MN -6.0 Y +55170 MN -6.0 Y +55171 MN -6.0 Y +55172 MN -6.0 Y +55175 MN -6.0 Y +55177 MN -6.0 Y +55187 MN -6.0 Y +55188 MN -6.0 Y +55191 MN -6.0 Y +55301 MN -6.0 Y +55302 MN -6.0 Y +55303 MN -6.0 Y +55304 MN -6.0 Y +55305 MN -6.0 Y +55306 MN -6.0 Y +55307 MN -6.0 Y +55308 MN -6.0 Y +55309 MN -6.0 Y +55310 MN -6.0 Y +55311 MN -6.0 Y +55312 MN -6.0 Y +55313 MN -6.0 Y +55314 MN -6.0 Y +55315 MN -6.0 Y +55316 MN -6.0 Y +55317 MN -6.0 Y +55318 MN -6.0 Y +55319 MN -6.0 Y +55320 MN -6.0 Y +55321 MN -6.0 Y +55322 MN -6.0 Y +55323 MN -6.0 Y +55324 MN -6.0 Y +55325 MN -6.0 Y +55327 MN -6.0 Y +55328 MN -6.0 Y +55329 MN -6.0 Y +55330 MN -6.0 Y +55331 MN -6.0 Y +55332 MN -6.0 Y +55333 MN -6.0 Y +55334 MN -6.0 Y +55335 MN -6.0 Y +55336 MN -6.0 Y +55337 MN -6.0 Y +55338 MN -6.0 Y +55339 MN -6.0 Y +55340 MN -6.0 Y +55341 MN -6.0 Y +55342 MN -6.0 Y +55343 MN -6.0 Y +55344 MN -6.0 Y +55345 MN -6.0 Y +55346 MN -6.0 Y +55347 MN -6.0 Y +55348 MN -6.0 Y +55349 MN -6.0 Y +55350 MN -6.0 Y +55352 MN -6.0 Y +55353 MN -6.0 Y +55354 MN -6.0 Y +55355 MN -6.0 Y +55356 MN -6.0 Y +55357 MN -6.0 Y +55358 MN -6.0 Y +55359 MN -6.0 Y +55360 MN -6.0 Y +55361 MN -6.0 Y +55362 MN -6.0 Y +55363 MN -6.0 Y +55364 MN -6.0 Y +55365 MN -6.0 Y +55366 MN -6.0 Y +55367 MN -6.0 Y +55368 MN -6.0 Y +55369 MN -6.0 Y +55370 MN -6.0 Y +55371 MN -6.0 Y +55372 MN -6.0 Y +55373 MN -6.0 Y +55374 MN -6.0 Y +55375 MN -6.0 Y +55376 MN -6.0 Y +55377 MN -6.0 Y +55378 MN -6.0 Y +55379 MN -6.0 Y +55380 MN -6.0 Y +55381 MN -6.0 Y +55382 MN -6.0 Y +55383 MN -6.0 Y +55384 MN -6.0 Y +55385 MN -6.0 Y +55386 MN -6.0 Y +55387 MN -6.0 Y +55388 MN -6.0 Y +55389 MN -6.0 Y +55390 MN -6.0 Y +55391 MN -6.0 Y +55392 MN -6.0 Y +55393 MN -6.0 Y +55394 MN -6.0 Y +55395 MN -6.0 Y +55396 MN -6.0 Y +55397 MN -6.0 Y +55398 MN -6.0 Y +55399 MN -6.0 Y +55401 MN -6.0 Y +55402 MN -6.0 Y +55403 MN -6.0 Y +55404 MN -6.0 Y +55405 MN -6.0 Y +55406 MN -6.0 Y +55407 MN -6.0 Y +55408 MN -6.0 Y +55409 MN -6.0 Y +55410 MN -6.0 Y +55411 MN -6.0 Y +55412 MN -6.0 Y +55413 MN -6.0 Y +55414 MN -6.0 Y +55415 MN -6.0 Y +55416 MN -6.0 Y +55417 MN -6.0 Y +55418 MN -6.0 Y +55419 MN -6.0 Y +55420 MN -6.0 Y +55421 MN -6.0 Y +55422 MN -6.0 Y +55423 MN -6.0 Y +55424 MN -6.0 Y +55425 MN -6.0 Y +55426 MN -6.0 Y +55427 MN -6.0 Y +55428 MN -6.0 Y +55429 MN -6.0 Y +55430 MN -6.0 Y +55431 MN -6.0 Y +55432 MN -6.0 Y +55433 MN -6.0 Y +55434 MN -6.0 Y +55435 MN -6.0 Y +55436 MN -6.0 Y +55437 MN -6.0 Y +55438 MN -6.0 Y +55439 MN -6.0 Y +55440 MN -6.0 Y +55441 MN -6.0 Y +55442 MN -6.0 Y +55443 MN -6.0 Y +55444 MN -6.0 Y +55445 MN -6.0 Y +55446 MN -6.0 Y +55447 MN -6.0 Y +55448 MN -6.0 Y +55449 MN -6.0 Y +55450 MN -6.0 Y +55454 MN -6.0 Y +55455 MN -6.0 Y +55458 MN -6.0 Y +55459 MN -6.0 Y +55460 MN -6.0 Y +55467 MN -6.0 Y +55468 MN -6.0 Y +55470 MN -6.0 Y +55472 MN -6.0 Y +55473 MN -6.0 Y +55474 MN -6.0 Y +55478 MN -6.0 Y +55479 MN -6.0 Y +55480 MN -6.0 Y +55483 MN -6.0 Y +55484 MN -6.0 Y +55485 MN -6.0 Y +55486 MN -6.0 Y +55487 MN -6.0 Y +55488 MN -6.0 Y +55550 MN -6.0 Y +55551 MN -6.0 Y +55552 MN -6.0 Y +55553 MN -6.0 Y +55554 MN -6.0 Y +55555 MN -6.0 Y +55556 MN -6.0 Y +55557 MN -6.0 Y +55558 MN -6.0 Y +55559 MN -6.0 Y +55560 MN -6.0 Y +55561 MN -6.0 Y +55562 MN -6.0 Y +55563 MN -6.0 Y +55564 MN -6.0 Y +55565 MN -6.0 Y +55566 MN -6.0 Y +55567 MN -6.0 Y +55568 MN -6.0 Y +55569 MN -6.0 Y +55570 MN -6.0 Y +55571 MN -6.0 Y +55572 MN -6.0 Y +55573 MN -6.0 Y +55574 MN -6.0 Y +55575 MN -6.0 Y +55576 MN -6.0 Y +55577 MN -6.0 Y +55578 MN -6.0 Y +55579 MN -6.0 Y +55580 MN -6.0 Y +55581 MN -6.0 Y +55582 MN -6.0 Y +55583 MN -6.0 Y +55584 MN -6.0 Y +55585 MN -6.0 Y +55586 MN -6.0 Y +55587 MN -6.0 Y +55588 MN -6.0 Y +55589 MN -6.0 Y +55590 MN -6.0 Y +55591 MN -6.0 Y +55592 MN -6.0 Y +55593 MN -6.0 Y +55594 MN -6.0 Y +55595 MN -6.0 Y +55596 MN -6.0 Y +55597 MN -6.0 Y +55598 MN -6.0 Y +55599 MN -6.0 Y +55601 MN -6.0 Y +55602 MN -6.0 Y +55603 MN -6.0 Y +55604 MN -6.0 Y +55605 MN -6.0 Y +55606 MN -6.0 Y +55607 MN -6.0 Y +55609 MN -6.0 Y +55612 MN -6.0 Y +55613 MN -6.0 Y +55614 MN -6.0 Y +55615 MN -6.0 Y +55616 MN -6.0 Y +55701 MN -6.0 Y +55702 MN -6.0 Y +55703 MN -6.0 Y +55704 MN -6.0 Y +55705 MN -6.0 Y +55706 MN -6.0 Y +55707 MN -6.0 Y +55708 MN -6.0 Y +55709 MN -6.0 Y +55710 MN -6.0 Y +55711 MN -6.0 Y +55712 MN -6.0 Y +55713 MN -6.0 Y +55716 MN -6.0 Y +55717 MN -6.0 Y +55718 MN -6.0 Y +55719 MN -6.0 Y +55720 MN -6.0 Y +55721 MN -6.0 Y +55722 MN -6.0 Y +55723 MN -6.0 Y +55724 MN -6.0 Y +55725 MN -6.0 Y +55726 MN -6.0 Y +55730 MN -6.0 Y +55731 MN -6.0 Y +55732 MN -6.0 Y +55733 MN -6.0 Y +55734 MN -6.0 Y +55735 MN -6.0 Y +55736 MN -6.0 Y +55738 MN -6.0 Y +55741 MN -6.0 Y +55742 MN -6.0 Y +55744 MN -6.0 Y +55745 MN -6.0 Y +55746 MN -6.0 Y +55747 MN -6.0 Y +55748 MN -6.0 Y +55749 MN -6.0 Y +55750 MN -6.0 Y +55751 MN -6.0 Y +55752 MN -6.0 Y +55753 MN -6.0 Y +55756 MN -6.0 Y +55757 MN -6.0 Y +55758 MN -6.0 Y +55760 MN -6.0 Y +55763 MN -6.0 Y +55764 MN -6.0 Y +55765 MN -6.0 Y +55766 MN -6.0 Y +55767 MN -6.0 Y +55768 MN -6.0 Y +55769 MN -6.0 Y +55771 MN -6.0 Y +55772 MN -6.0 Y +55775 MN -6.0 Y +55777 MN -6.0 Y +55779 MN -6.0 Y +55780 MN -6.0 Y +55781 MN -6.0 Y +55782 MN -6.0 Y +55783 MN -6.0 Y +55784 MN -6.0 Y +55785 MN -6.0 Y +55786 MN -6.0 Y +55787 MN -6.0 Y +55790 MN -6.0 Y +55791 MN -6.0 Y +55792 MN -6.0 Y +55793 MN -6.0 Y +55795 MN -6.0 Y +55796 MN -6.0 Y +55797 MN -6.0 Y +55798 MN -6.0 Y +55801 MN -6.0 Y +55802 MN -6.0 Y +55803 MN -6.0 Y +55804 MN -6.0 Y +55805 MN -6.0 Y +55806 MN -6.0 Y +55807 MN -6.0 Y +55808 MN -6.0 Y +55810 MN -6.0 Y +55811 MN -6.0 Y +55812 MN -6.0 Y +55814 MN -6.0 Y +55815 MN -6.0 Y +55816 MN -6.0 Y +55901 MN -6.0 Y +55902 MN -6.0 Y +55903 MN -6.0 Y +55904 MN -6.0 Y +55905 MN -6.0 Y +55906 MN -6.0 Y +55909 MN -6.0 Y +55910 MN -6.0 Y +55912 MN -6.0 Y +55917 MN -6.0 Y +55918 MN -6.0 Y +55919 MN -6.0 Y +55920 MN -6.0 Y +55921 MN -6.0 Y +55922 MN -6.0 Y +55923 MN -6.0 Y +55924 MN -6.0 Y +55925 MN -6.0 Y +55926 MN -6.0 Y +55927 MN -6.0 Y +55929 MN -6.0 Y +55931 MN -6.0 Y +55932 MN -6.0 Y +55933 MN -6.0 Y +55934 MN -6.0 Y +55935 MN -6.0 Y +55936 MN -6.0 Y +55939 MN -6.0 Y +55940 MN -6.0 Y +55941 MN -6.0 Y +55942 MN -6.0 Y +55943 MN -6.0 Y +55944 MN -6.0 Y +55945 MN -6.0 Y +55946 MN -6.0 Y +55947 MN -6.0 Y +55949 MN -6.0 Y +55950 MN -6.0 Y +55951 MN -6.0 Y +55952 MN -6.0 Y +55953 MN -6.0 Y +55954 MN -6.0 Y +55955 MN -6.0 Y +55956 MN -6.0 Y +55957 MN -6.0 Y +55959 MN -6.0 Y +55960 MN -6.0 Y +55961 MN -6.0 Y +55962 MN -6.0 Y +55963 MN -6.0 Y +55964 MN -6.0 Y +55965 MN -6.0 Y +55967 MN -6.0 Y +55968 MN -6.0 Y +55969 MN -6.0 Y +55970 MN -6.0 Y +55971 MN -6.0 Y +55972 MN -6.0 Y +55973 MN -6.0 Y +55974 MN -6.0 Y +55975 MN -6.0 Y +55976 MN -6.0 Y +55977 MN -6.0 Y +55979 MN -6.0 Y +55981 MN -6.0 Y +55982 MN -6.0 Y +55983 MN -6.0 Y +55985 MN -6.0 Y +55987 MN -6.0 Y +55988 MN -6.0 Y +55990 MN -6.0 Y +55991 MN -6.0 Y +55992 MN -6.0 Y +56001 MN -6.0 Y +56002 MN -6.0 Y +56003 MN -6.0 Y +56006 MN -6.0 Y +56007 MN -6.0 Y +56009 MN -6.0 Y +56010 MN -6.0 Y +56011 MN -6.0 Y +56013 MN -6.0 Y +56014 MN -6.0 Y +56016 MN -6.0 Y +56017 MN -6.0 Y +56019 MN -6.0 Y +56020 MN -6.0 Y +56021 MN -6.0 Y +56022 MN -6.0 Y +56023 MN -6.0 Y +56024 MN -6.0 Y +56025 MN -6.0 Y +56026 MN -6.0 Y +56027 MN -6.0 Y +56028 MN -6.0 Y +56029 MN -6.0 Y +56030 MN -6.0 Y +56031 MN -6.0 Y +56032 MN -6.0 Y +56033 MN -6.0 Y +56034 MN -6.0 Y +56035 MN -6.0 Y +56036 MN -6.0 Y +56037 MN -6.0 Y +56039 MN -6.0 Y +56041 MN -6.0 Y +56042 MN -6.0 Y +56043 MN -6.0 Y +56044 MN -6.0 Y +56045 MN -6.0 Y +56046 MN -6.0 Y +56047 MN -6.0 Y +56048 MN -6.0 Y +56050 MN -6.0 Y +56051 MN -6.0 Y +56052 MN -6.0 Y +56054 MN -6.0 Y +56055 MN -6.0 Y +56056 MN -6.0 Y +56057 MN -6.0 Y +56058 MN -6.0 Y +56060 MN -6.0 Y +56062 MN -6.0 Y +56063 MN -6.0 Y +56065 MN -6.0 Y +56068 MN -6.0 Y +56069 MN -6.0 Y +56071 MN -6.0 Y +56072 MN -6.0 Y +56073 MN -6.0 Y +56074 MN -6.0 Y +56075 MN -6.0 Y +56078 MN -6.0 Y +56080 MN -6.0 Y +56081 MN -6.0 Y +56082 MN -6.0 Y +56083 MN -6.0 Y +56084 MN -6.0 Y +56085 MN -6.0 Y +56087 MN -6.0 Y +56088 MN -6.0 Y +56089 MN -6.0 Y +56090 MN -6.0 Y +56091 MN -6.0 Y +56093 MN -6.0 Y +56096 MN -6.0 Y +56097 MN -6.0 Y +56098 MN -6.0 Y +56101 MN -6.0 Y +56110 MN -6.0 Y +56111 MN -6.0 Y +56113 MN -6.0 Y +56114 MN -6.0 Y +56115 MN -6.0 Y +56116 MN -6.0 Y +56117 MN -6.0 Y +56118 MN -6.0 Y +56119 MN -6.0 Y +56120 MN -6.0 Y +56121 MN -6.0 Y +56122 MN -6.0 Y +56123 MN -6.0 Y +56125 MN -6.0 Y +56127 MN -6.0 Y +56128 MN -6.0 Y +56129 MN -6.0 Y +56131 MN -6.0 Y +56132 MN -6.0 Y +56134 MN -6.0 Y +56136 MN -6.0 Y +56137 MN -6.0 Y +56138 MN -6.0 Y +56139 MN -6.0 Y +56140 MN -6.0 Y +56141 MN -6.0 Y +56142 MN -6.0 Y +56143 MN -6.0 Y +56144 MN -6.0 Y +56145 MN -6.0 Y +56146 MN -6.0 Y +56147 MN -6.0 Y +56149 MN -6.0 Y +56150 MN -6.0 Y +56151 MN -6.0 Y +56152 MN -6.0 Y +56153 MN -6.0 Y +56155 MN -6.0 Y +56156 MN -6.0 Y +56157 MN -6.0 Y +56158 MN -6.0 Y +56159 MN -6.0 Y +56160 MN -6.0 Y +56161 MN -6.0 Y +56162 MN -6.0 Y +56164 MN -6.0 Y +56165 MN -6.0 Y +56166 MN -6.0 Y +56167 MN -6.0 Y +56168 MN -6.0 Y +56169 MN -6.0 Y +56170 MN -6.0 Y +56171 MN -6.0 Y +56172 MN -6.0 Y +56173 MN -6.0 Y +56174 MN -6.0 Y +56175 MN -6.0 Y +56176 MN -6.0 Y +56177 MN -6.0 Y +56178 MN -6.0 Y +56180 MN -6.0 Y +56181 MN -6.0 Y +56183 MN -6.0 Y +56185 MN -6.0 Y +56186 MN -6.0 Y +56187 MN -6.0 Y +56201 MN -6.0 Y +56207 MN -6.0 Y +56208 MN -6.0 Y +56209 MN -6.0 Y +56210 MN -6.0 Y +56211 MN -6.0 Y +56212 MN -6.0 Y +56214 MN -6.0 Y +56215 MN -6.0 Y +56216 MN -6.0 Y +56218 MN -6.0 Y +56219 MN -6.0 Y +56220 MN -6.0 Y +56221 MN -6.0 Y +56222 MN -6.0 Y +56223 MN -6.0 Y +56224 MN -6.0 Y +56225 MN -6.0 Y +56226 MN -6.0 Y +56227 MN -6.0 Y +56228 MN -6.0 Y +56229 MN -6.0 Y +56230 MN -6.0 Y +56231 MN -6.0 Y +56232 MN -6.0 Y +56235 MN -6.0 Y +56236 MN -6.0 Y +56237 MN -6.0 Y +56239 MN -6.0 Y +56240 MN -6.0 Y +56241 MN -6.0 Y +56243 MN -6.0 Y +56244 MN -6.0 Y +56245 MN -6.0 Y +56248 MN -6.0 Y +56249 MN -6.0 Y +56251 MN -6.0 Y +56252 MN -6.0 Y +56253 MN -6.0 Y +56255 MN -6.0 Y +56256 MN -6.0 Y +56257 MN -6.0 Y +56258 MN -6.0 Y +56260 MN -6.0 Y +56262 MN -6.0 Y +56263 MN -6.0 Y +56264 MN -6.0 Y +56265 MN -6.0 Y +56266 MN -6.0 Y +56267 MN -6.0 Y +56270 MN -6.0 Y +56271 MN -6.0 Y +56273 MN -6.0 Y +56274 MN -6.0 Y +56276 MN -6.0 Y +56277 MN -6.0 Y +56278 MN -6.0 Y +56279 MN -6.0 Y +56280 MN -6.0 Y +56281 MN -6.0 Y +56282 MN -6.0 Y +56283 MN -6.0 Y +56284 MN -6.0 Y +56285 MN -6.0 Y +56287 MN -6.0 Y +56288 MN -6.0 Y +56289 MN -6.0 Y +56291 MN -6.0 Y +56292 MN -6.0 Y +56293 MN -6.0 Y +56294 MN -6.0 Y +56295 MN -6.0 Y +56296 MN -6.0 Y +56297 MN -6.0 Y +56301 MN -6.0 Y +56302 MN -6.0 Y +56303 MN -6.0 Y +56304 MN -6.0 Y +56307 MN -6.0 Y +56308 MN -6.0 Y +56309 MN -6.0 Y +56310 MN -6.0 Y +56311 MN -6.0 Y +56312 MN -6.0 Y +56313 MN -6.0 Y +56314 MN -6.0 Y +56315 MN -6.0 Y +56316 MN -6.0 Y +56317 MN -6.0 Y +56318 MN -6.0 Y +56319 MN -6.0 Y +56320 MN -6.0 Y +56321 MN -6.0 Y +56323 MN -6.0 Y +56324 MN -6.0 Y +56325 MN -6.0 Y +56326 MN -6.0 Y +56327 MN -6.0 Y +56328 MN -6.0 Y +56329 MN -6.0 Y +56330 MN -6.0 Y +56331 MN -6.0 Y +56332 MN -6.0 Y +56333 MN -6.0 Y +56334 MN -6.0 Y +56335 MN -6.0 Y +56336 MN -6.0 Y +56338 MN -6.0 Y +56339 MN -6.0 Y +56340 MN -6.0 Y +56341 MN -6.0 Y +56342 MN -6.0 Y +56343 MN -6.0 Y +56344 MN -6.0 Y +56345 MN -6.0 Y +56347 MN -6.0 Y +56349 MN -6.0 Y +56350 MN -6.0 Y +56352 MN -6.0 Y +56353 MN -6.0 Y +56354 MN -6.0 Y +56355 MN -6.0 Y +56356 MN -6.0 Y +56357 MN -6.0 Y +56358 MN -6.0 Y +56359 MN -6.0 Y +56360 MN -6.0 Y +56361 MN -6.0 Y +56362 MN -6.0 Y +56363 MN -6.0 Y +56364 MN -6.0 Y +56367 MN -6.0 Y +56368 MN -6.0 Y +56369 MN -6.0 Y +56371 MN -6.0 Y +56372 MN -6.0 Y +56373 MN -6.0 Y +56374 MN -6.0 Y +56375 MN -6.0 Y +56376 MN -6.0 Y +56377 MN -6.0 Y +56378 MN -6.0 Y +56379 MN -6.0 Y +56381 MN -6.0 Y +56382 MN -6.0 Y +56384 MN -6.0 Y +56385 MN -6.0 Y +56386 MN -6.0 Y +56387 MN -6.0 Y +56388 MN -6.0 Y +56389 MN -6.0 Y +56393 MN -6.0 Y +56395 MN -6.0 Y +56396 MN -6.0 Y +56397 MN -6.0 Y +56398 MN -6.0 Y +56399 MN -6.0 Y +56401 MN -6.0 Y +56425 MN -6.0 Y +56430 MN -6.0 Y +56431 MN -6.0 Y +56433 MN -6.0 Y +56434 MN -6.0 Y +56435 MN -6.0 Y +56436 MN -6.0 Y +56437 MN -6.0 Y +56438 MN -6.0 Y +56440 MN -6.0 Y +56441 MN -6.0 Y +56442 MN -6.0 Y +56443 MN -6.0 Y +56444 MN -6.0 Y +56446 MN -6.0 Y +56447 MN -6.0 Y +56448 MN -6.0 Y +56449 MN -6.0 Y +56450 MN -6.0 Y +56452 MN -6.0 Y +56453 MN -6.0 Y +56455 MN -6.0 Y +56456 MN -6.0 Y +56458 MN -6.0 Y +56459 MN -6.0 Y +56461 MN -6.0 Y +56464 MN -6.0 Y +56465 MN -6.0 Y +56466 MN -6.0 Y +56467 MN -6.0 Y +56468 MN -6.0 Y +56469 MN -6.0 Y +56470 MN -6.0 Y +56472 MN -6.0 Y +56473 MN -6.0 Y +56474 MN -6.0 Y +56475 MN -6.0 Y +56477 MN -6.0 Y +56478 MN -6.0 Y +56479 MN -6.0 Y +56481 MN -6.0 Y +56482 MN -6.0 Y +56484 MN -6.0 Y +56501 MN -6.0 Y +56502 MN -6.0 Y +56510 MN -6.0 Y +56511 MN -6.0 Y +56514 MN -6.0 Y +56515 MN -6.0 Y +56516 MN -6.0 Y +56517 MN -6.0 Y +56518 MN -6.0 Y +56519 MN -6.0 Y +56520 MN -6.0 Y +56521 MN -6.0 Y +56522 MN -6.0 Y +56523 MN -6.0 Y +56524 MN -6.0 Y +56525 MN -6.0 Y +56527 MN -6.0 Y +56528 MN -6.0 Y +56529 MN -6.0 Y +56531 MN -6.0 Y +56533 MN -6.0 Y +56534 MN -6.0 Y +56535 MN -6.0 Y +56536 MN -6.0 Y +56537 MN -6.0 Y +56538 MN -6.0 Y +56540 MN -6.0 Y +56541 MN -6.0 Y +56542 MN -6.0 Y +56543 MN -6.0 Y +56544 MN -6.0 Y +56545 MN -6.0 Y +56546 MN -6.0 Y +56547 MN -6.0 Y +56548 MN -6.0 Y +56549 MN -6.0 Y +56550 MN -6.0 Y +56551 MN -6.0 Y +56552 MN -6.0 Y +56553 MN -6.0 Y +56554 MN -6.0 Y +56556 MN -6.0 Y +56557 MN -6.0 Y +56560 MN -6.0 Y +56561 MN -6.0 Y +56562 MN -6.0 Y +56563 MN -6.0 Y +56565 MN -6.0 Y +56566 MN -6.0 Y +56567 MN -6.0 Y +56568 MN -6.0 Y +56569 MN -6.0 Y +56570 MN -6.0 Y +56571 MN -6.0 Y +56572 MN -6.0 Y +56573 MN -6.0 Y +56574 MN -6.0 Y +56575 MN -6.0 Y +56576 MN -6.0 Y +56577 MN -6.0 Y +56578 MN -6.0 Y +56579 MN -6.0 Y +56580 MN -6.0 Y +56581 MN -6.0 Y +56583 MN -6.0 Y +56584 MN -6.0 Y +56585 MN -6.0 Y +56586 MN -6.0 Y +56587 MN -6.0 Y +56588 MN -6.0 Y +56589 MN -6.0 Y +56590 MN -6.0 Y +56591 MN -6.0 Y +56592 MN -6.0 Y +56593 MN -6.0 Y +56594 MN -6.0 Y +56601 MN -6.0 Y +56619 MN -6.0 Y +56621 MN -6.0 Y +56623 MN -6.0 Y +56626 MN -6.0 Y +56627 MN -6.0 Y +56628 MN -6.0 Y +56629 MN -6.0 Y +56630 MN -6.0 Y +56631 MN -6.0 Y +56633 MN -6.0 Y +56634 MN -6.0 Y +56636 MN -6.0 Y +56637 MN -6.0 Y +56639 MN -6.0 Y +56641 MN -6.0 Y +56644 MN -6.0 Y +56646 MN -6.0 Y +56647 MN -6.0 Y +56649 MN -6.0 Y +56650 MN -6.0 Y +56651 MN -6.0 Y +56652 MN -6.0 Y +56653 MN -6.0 Y +56654 MN -6.0 Y +56655 MN -6.0 Y +56657 MN -6.0 Y +56658 MN -6.0 Y +56659 MN -6.0 Y +56660 MN -6.0 Y +56661 MN -6.0 Y +56662 MN -6.0 Y +56663 MN -6.0 Y +56666 MN -6.0 Y +56667 MN -6.0 Y +56668 MN -6.0 Y +56669 MN -6.0 Y +56670 MN -6.0 Y +56671 MN -6.0 Y +56672 MN -6.0 Y +56673 MN -6.0 Y +56676 MN -6.0 Y +56678 MN -6.0 Y +56679 MN -6.0 Y +56680 MN -6.0 Y +56681 MN -6.0 Y +56682 MN -6.0 Y +56683 MN -6.0 Y +56684 MN -6.0 Y +56685 MN -6.0 Y +56686 MN -6.0 Y +56687 MN -6.0 Y +56688 MN -6.0 Y +56701 MN -6.0 Y +56710 MN -6.0 Y +56711 MN -6.0 Y +56713 MN -6.0 Y +56714 MN -6.0 Y +56715 MN -6.0 Y +56716 MN -6.0 Y +56720 MN -6.0 Y +56721 MN -6.0 Y +56722 MN -6.0 Y +56723 MN -6.0 Y +56724 MN -6.0 Y +56725 MN -6.0 Y +56726 MN -6.0 Y +56727 MN -6.0 Y +56728 MN -6.0 Y +56729 MN -6.0 Y +56731 MN -6.0 Y +56732 MN -6.0 Y +56733 MN -6.0 Y +56734 MN -6.0 Y +56735 MN -6.0 Y +56736 MN -6.0 Y +56737 MN -6.0 Y +56738 MN -6.0 Y +56740 MN -6.0 Y +56741 MN -6.0 Y +56742 MN -6.0 Y +56744 MN -6.0 Y +56748 MN -6.0 Y +56750 MN -6.0 Y +56751 MN -6.0 Y +56754 MN -6.0 Y +56755 MN -6.0 Y +56756 MN -6.0 Y +56757 MN -6.0 Y +56758 MN -6.0 Y +56759 MN -6.0 Y +56760 MN -6.0 Y +56761 MN -6.0 Y +56762 MN -6.0 Y +56763 MN -6.0 Y +56901 DC -5.0 Y +56915 DC -5.0 Y +56920 DC -5.0 Y +56933 DC -5.0 Y +56944 DC -5.0 Y +56972 DC -5.0 Y +57001 SD -6.0 Y +57002 SD -6.0 Y +57003 SD -6.0 Y +57004 SD -6.0 Y +57005 SD -6.0 Y +57006 SD -6.0 Y +57007 SD -6.0 Y +57010 SD -6.0 Y +57012 SD -6.0 Y +57013 SD -6.0 Y +57014 SD -6.0 Y +57015 SD -6.0 Y +57016 SD -6.0 Y +57017 SD -6.0 Y +57018 SD -6.0 Y +57020 SD -6.0 Y +57021 SD -6.0 Y +57022 SD -6.0 Y +57024 SD -6.0 Y +57025 SD -6.0 Y +57026 SD -6.0 Y +57027 SD -6.0 Y +57028 SD -6.0 Y +57029 SD -6.0 Y +57030 SD -6.0 Y +57031 SD -6.0 Y +57032 SD -6.0 Y +57033 SD -6.0 Y +57034 SD -6.0 Y +57035 SD -6.0 Y +57036 SD -6.0 Y +57037 SD -6.0 Y +57038 SD -6.0 Y +57039 SD -6.0 Y +57040 SD -6.0 Y +57041 SD -6.0 Y +57042 SD -6.0 Y +57043 SD -6.0 Y +57045 SD -6.0 Y +57046 SD -6.0 Y +57047 SD -6.0 Y +57048 SD -6.0 Y +57049 SD -6.0 Y +57050 SD -6.0 Y +57051 SD -6.0 Y +57052 SD -6.0 Y +57053 SD -6.0 Y +57054 SD -6.0 Y +57055 SD -6.0 Y +57056 SD -6.0 Y +57057 SD -6.0 Y +57058 SD -6.0 Y +57059 SD -6.0 Y +57061 SD -6.0 Y +57062 SD -6.0 Y +57063 SD -6.0 Y +57064 SD -6.0 Y +57065 SD -6.0 Y +57066 SD -6.0 Y +57067 SD -6.0 Y +57068 SD -6.0 Y +57069 SD -6.0 Y +57070 SD -6.0 Y +57071 SD -6.0 Y +57072 SD -6.0 Y +57073 SD -6.0 Y +57075 SD -6.0 Y +57076 SD -6.0 Y +57077 SD -6.0 Y +57078 SD -6.0 Y +57079 SD -6.0 Y +57101 SD -6.0 Y +57103 SD -6.0 Y +57104 SD -6.0 Y +57105 SD -6.0 Y +57106 SD -6.0 Y +57107 SD -6.0 Y +57108 SD -6.0 Y +57109 SD -6.0 Y +57110 SD -6.0 Y +57117 SD -6.0 Y +57118 SD -6.0 Y +57186 SD -6.0 Y +57188 SD -6.0 Y +57189 SD -6.0 Y +57192 SD -6.0 Y +57193 SD -6.0 Y +57194 SD -6.0 Y +57195 SD -6.0 Y +57196 SD -6.0 Y +57197 SD -6.0 Y +57198 SD -6.0 Y +57201 SD -6.0 Y +57212 SD -6.0 Y +57213 SD -6.0 Y +57214 SD -6.0 Y +57216 SD -6.0 Y +57217 SD -6.0 Y +57218 SD -6.0 Y +57219 SD -6.0 Y +57220 SD -6.0 Y +57221 SD -6.0 Y +57223 SD -6.0 Y +57224 SD -6.0 Y +57225 SD -6.0 Y +57226 SD -6.0 Y +57227 SD -6.0 Y +57231 SD -6.0 Y +57232 SD -6.0 Y +57233 SD -6.0 Y +57234 SD -6.0 Y +57235 SD -6.0 Y +57236 SD -6.0 Y +57237 SD -6.0 Y +57238 SD -6.0 Y +57239 SD -6.0 Y +57241 SD -6.0 Y +57242 SD -6.0 Y +57243 SD -6.0 Y +57245 SD -6.0 Y +57246 SD -6.0 Y +57247 SD -6.0 Y +57248 SD -6.0 Y +57249 SD -6.0 Y +57251 SD -6.0 Y +57252 SD -6.0 Y +57253 SD -6.0 Y +57255 SD -6.0 Y +57256 SD -6.0 Y +57257 SD -6.0 Y +57258 SD -6.0 Y +57259 SD -6.0 Y +57260 SD -6.0 Y +57261 SD -6.0 Y +57262 SD -6.0 Y +57263 SD -6.0 Y +57264 SD -6.0 Y +57265 SD -6.0 Y +57266 SD -6.0 Y +57268 SD -6.0 Y +57269 SD -6.0 Y +57270 SD -6.0 Y +57271 SD -6.0 Y +57272 SD -6.0 Y +57273 SD -6.0 Y +57274 SD -6.0 Y +57276 SD -6.0 Y +57278 SD -6.0 Y +57279 SD -6.0 Y +57301 SD -6.0 Y +57311 SD -6.0 Y +57312 SD -6.0 Y +57313 SD -6.0 Y +57314 SD -6.0 Y +57315 SD -6.0 Y +57317 SD -6.0 Y +57319 SD -6.0 Y +57321 SD -6.0 Y +57322 SD -6.0 Y +57323 SD -6.0 Y +57324 SD -6.0 Y +57325 SD -6.0 Y +57326 SD -6.0 Y +57328 SD -6.0 Y +57329 SD -6.0 Y +57330 SD -6.0 Y +57331 SD -6.0 Y +57332 SD -6.0 Y +57334 SD -6.0 Y +57335 SD -6.0 Y +57337 SD -6.0 Y +57339 SD -6.0 Y +57340 SD -6.0 Y +57341 SD -6.0 Y +57342 SD -6.0 Y +57344 SD -6.0 Y +57345 SD -6.0 Y +57346 SD -6.0 Y +57348 SD -6.0 Y +57349 SD -6.0 Y +57350 SD -6.0 Y +57353 SD -6.0 Y +57354 SD -6.0 Y +57355 SD -6.0 Y +57356 SD -6.0 Y +57358 SD -6.0 Y +57359 SD -6.0 Y +57361 SD -6.0 Y +57362 SD -6.0 Y +57363 SD -6.0 Y +57364 SD -6.0 Y +57365 SD -6.0 Y +57366 SD -6.0 Y +57367 SD -6.0 Y +57368 SD -6.0 Y +57369 SD -6.0 Y +57370 SD -6.0 Y +57371 SD -6.0 Y +57373 SD -6.0 Y +57374 SD -6.0 Y +57375 SD -6.0 Y +57376 SD -6.0 Y +57379 SD -6.0 Y +57380 SD -6.0 Y +57381 SD -6.0 Y +57382 SD -6.0 Y +57383 SD -6.0 Y +57384 SD -6.0 Y +57385 SD -6.0 Y +57386 SD -6.0 Y +57399 SD -6.0 Y +57401 SD -6.0 Y +57402 SD -6.0 Y +57420 SD -6.0 Y +57421 SD -6.0 Y +57422 SD -6.0 Y +57424 SD -6.0 Y +57426 SD -6.0 Y +57427 SD -6.0 Y +57428 SD -6.0 Y +57429 SD -6.0 Y +57430 SD -6.0 Y +57432 SD -6.0 Y +57433 SD -6.0 Y +57434 SD -6.0 Y +57435 SD -6.0 Y +57436 SD -6.0 Y +57437 SD -6.0 Y +57438 SD -6.0 Y +57439 SD -6.0 Y +57440 SD -6.0 Y +57441 SD -6.0 Y +57442 SD -6.0 Y +57445 SD -6.0 Y +57446 SD -6.0 Y +57448 SD -6.0 Y +57449 SD -6.0 Y +57450 SD -6.0 Y +57451 SD -6.0 Y +57452 SD -6.0 Y +57454 SD -6.0 Y +57455 SD -6.0 Y +57456 SD -6.0 Y +57457 SD -6.0 Y +57460 SD -6.0 Y +57461 SD -6.0 Y +57465 SD -6.0 Y +57466 SD -6.0 Y +57467 SD -6.0 Y +57468 SD -6.0 Y +57469 SD -6.0 Y +57470 SD -6.0 Y +57471 SD -6.0 Y +57472 SD -6.0 Y +57473 SD -6.0 Y +57474 SD -6.0 Y +57475 SD -6.0 Y +57476 SD -6.0 Y +57477 SD -6.0 Y +57479 SD -6.0 Y +57481 SD -6.0 Y +57501 SD -6.0 Y +57520 SD -6.0 Y +57521 SD -7.0 Y +57522 SD -6.0 Y +57523 SD -6.0 Y +57528 SD -6.0 Y +57529 SD -6.0 Y +57531 SD -6.0 Y +57532 SD -6.0 Y +57533 SD -6.0 Y +57534 SD -6.0 Y +57536 SD -6.0 Y +57537 SD -7.0 Y +57538 SD -6.0 Y +57540 SD -6.0 Y +57541 SD -6.0 Y +57543 SD -7.0 Y +57544 SD -6.0 Y +57547 SD -7.0 Y +57548 SD -6.0 Y +57551 SD -7.0 Y +57552 SD -7.0 Y +57553 SD -7.0 Y +57555 SD -7.0 Y +57559 SD -6.0 Y +57560 SD -7.0 Y +57562 SD -6.0 Y +57563 SD -7.0 Y +57564 SD -6.0 Y +57566 SD -7.0 Y +57567 SD -7.0 Y +57568 SD -6.0 Y +57569 SD -6.0 Y +57570 SD -7.0 Y +57571 SD -6.0 Y +57572 SD -7.0 Y +57574 SD -7.0 Y +57576 SD -6.0 Y +57577 SD -7.0 Y +57579 SD -7.0 Y +57580 SD -6.0 Y +57584 SD -6.0 Y +57585 SD -7.0 Y +57601 SD -6.0 Y +57620 SD -7.0 Y +57621 SD -7.0 Y +57622 SD -7.0 Y +57623 SD -7.0 Y +57625 SD -7.0 Y +57626 SD -7.0 Y +57630 SD -7.0 Y +57631 SD -6.0 Y +57632 SD -6.0 Y +57633 SD -7.0 Y +57634 SD -7.0 Y +57636 SD -7.0 Y +57638 SD -7.0 Y +57639 SD -7.0 Y +57640 SD -7.0 Y +57641 SD -7.0 Y +57642 SD -7.0 Y +57644 SD -7.0 Y +57645 SD -7.0 Y +57646 SD -6.0 Y +57648 SD -6.0 Y +57649 SD -7.0 Y +57650 SD -7.0 Y +57651 SD -7.0 Y +57652 SD -7.0 Y +57656 SD -7.0 Y +57657 SD -7.0 Y +57658 SD -7.0 Y +57659 SD -7.0 Y +57660 SD -7.0 Y +57661 SD -7.0 Y +57701 SD -7.0 Y +57702 SD -7.0 Y +57703 SD -7.0 Y +57706 SD -7.0 Y +57709 SD -7.0 Y +57714 SD -7.0 Y +57716 SD -7.0 Y +57717 SD -7.0 Y +57718 SD -7.0 Y +57719 SD -7.0 Y +57720 SD -7.0 Y +57722 SD -7.0 Y +57724 SD -7.0 Y +57725 SD -7.0 Y +57730 SD -7.0 Y +57732 SD -7.0 Y +57735 SD -7.0 Y +57737 SD -7.0 Y +57738 SD -7.0 Y +57741 SD -7.0 Y +57744 SD -7.0 Y +57745 SD -7.0 Y +57747 SD -7.0 Y +57748 SD -7.0 Y +57750 SD -7.0 Y +57751 SD -7.0 Y +57752 SD -7.0 Y +57754 SD -7.0 Y +57755 SD -7.0 Y +57756 SD -7.0 Y +57758 SD -7.0 Y +57759 SD -7.0 Y +57760 SD -7.0 Y +57761 SD -7.0 Y +57762 SD -7.0 Y +57763 SD -7.0 Y +57764 SD -7.0 Y +57766 SD -7.0 Y +57767 SD -7.0 Y +57769 SD -7.0 Y +57770 SD -7.0 Y +57772 SD -7.0 Y +57773 SD -7.0 Y +57775 SD -7.0 Y +57776 SD -7.0 Y +57779 SD -7.0 Y +57780 SD -7.0 Y +57782 SD -7.0 Y +57783 SD -7.0 Y +57785 SD -7.0 Y +57787 SD -7.0 Y +57788 SD -7.0 Y +57790 SD -7.0 Y +57791 SD -7.0 Y +57792 SD -7.0 Y +57793 SD -7.0 Y +57794 SD -7.0 Y +57799 SD -7.0 Y +58001 ND -6.0 Y +58002 ND -6.0 Y +58004 ND -6.0 Y +58005 ND -6.0 Y +58006 ND -6.0 Y +58007 ND -6.0 Y +58008 ND -6.0 Y +58009 ND -6.0 Y +58011 ND -6.0 Y +58012 ND -6.0 Y +58013 ND -6.0 Y +58015 ND -6.0 Y +58016 ND -6.0 Y +58017 ND -6.0 Y +58018 ND -6.0 Y +58021 ND -6.0 Y +58027 ND -6.0 Y +58029 ND -6.0 Y +58030 ND -6.0 Y +58031 ND -6.0 Y +58032 ND -6.0 Y +58033 ND -6.0 Y +58035 ND -6.0 Y +58036 ND -6.0 Y +58038 ND -6.0 Y +58040 ND -6.0 Y +58041 ND -6.0 Y +58042 ND -6.0 Y +58043 ND -6.0 Y +58045 ND -6.0 Y +58046 ND -6.0 Y +58047 ND -6.0 Y +58048 ND -6.0 Y +58049 ND -6.0 Y +58051 ND -6.0 Y +58052 ND -6.0 Y +58053 ND -6.0 Y +58054 ND -6.0 Y +58056 ND -6.0 Y +58057 ND -6.0 Y +58058 ND -6.0 Y +58059 ND -6.0 Y +58060 ND -6.0 Y +58061 ND -6.0 Y +58062 ND -6.0 Y +58063 ND -6.0 Y +58064 ND -6.0 Y +58065 ND -6.0 Y +58067 ND -6.0 Y +58068 ND -6.0 Y +58069 ND -6.0 Y +58071 ND -6.0 Y +58072 ND -6.0 Y +58074 ND -6.0 Y +58075 ND -6.0 Y +58076 ND -6.0 Y +58077 ND -6.0 Y +58078 ND -6.0 Y +58079 ND -6.0 Y +58081 ND -6.0 Y +58102 ND -6.0 Y +58103 ND -6.0 Y +58104 ND -6.0 Y +58105 ND -6.0 Y +58106 ND -6.0 Y +58107 ND -6.0 Y +58108 ND -6.0 Y +58109 ND -6.0 Y +58121 ND -6.0 Y +58122 ND -6.0 Y +58124 ND -6.0 Y +58125 ND -6.0 Y +58126 ND -6.0 Y +58201 ND -6.0 Y +58202 ND -6.0 Y +58203 ND -6.0 Y +58204 ND -6.0 Y +58205 ND -6.0 Y +58206 ND -6.0 Y +58207 ND -6.0 Y +58208 ND -6.0 Y +58210 ND -6.0 Y +58212 ND -6.0 Y +58214 ND -6.0 Y +58216 ND -6.0 Y +58218 ND -6.0 Y +58219 ND -6.0 Y +58220 ND -6.0 Y +58222 ND -6.0 Y +58223 ND -6.0 Y +58224 ND -6.0 Y +58225 ND -6.0 Y +58227 ND -6.0 Y +58228 ND -6.0 Y +58229 ND -6.0 Y +58230 ND -6.0 Y +58231 ND -6.0 Y +58233 ND -6.0 Y +58235 ND -6.0 Y +58236 ND -6.0 Y +58237 ND -6.0 Y +58238 ND -6.0 Y +58239 ND -6.0 Y +58240 ND -6.0 Y +58241 ND -6.0 Y +58243 ND -6.0 Y +58244 ND -6.0 Y +58249 ND -6.0 Y +58250 ND -6.0 Y +58251 ND -6.0 Y +58254 ND -6.0 Y +58255 ND -6.0 Y +58256 ND -6.0 Y +58257 ND -6.0 Y +58258 ND -6.0 Y +58259 ND -6.0 Y +58260 ND -6.0 Y +58261 ND -6.0 Y +58262 ND -6.0 Y +58265 ND -6.0 Y +58266 ND -6.0 Y +58267 ND -6.0 Y +58269 ND -6.0 Y +58270 ND -6.0 Y +58271 ND -6.0 Y +58272 ND -6.0 Y +58273 ND -6.0 Y +58274 ND -6.0 Y +58275 ND -6.0 Y +58276 ND -6.0 Y +58277 ND -6.0 Y +58278 ND -6.0 Y +58281 ND -6.0 Y +58282 ND -6.0 Y +58301 ND -6.0 Y +58310 ND -6.0 Y +58311 ND -6.0 Y +58313 ND -6.0 Y +58316 ND -6.0 Y +58317 ND -6.0 Y +58318 ND -6.0 Y +58319 ND -6.0 Y +58321 ND -6.0 Y +58323 ND -6.0 Y +58324 ND -6.0 Y +58325 ND -6.0 Y +58327 ND -6.0 Y +58329 ND -6.0 Y +58330 ND -6.0 Y +58331 ND -6.0 Y +58332 ND -6.0 Y +58335 ND -6.0 Y +58338 ND -6.0 Y +58339 ND -6.0 Y +58341 ND -6.0 Y +58343 ND -6.0 Y +58344 ND -6.0 Y +58345 ND -6.0 Y +58346 ND -6.0 Y +58348 ND -6.0 Y +58351 ND -6.0 Y +58352 ND -6.0 Y +58353 ND -6.0 Y +58355 ND -6.0 Y +58356 ND -6.0 Y +58357 ND -6.0 Y +58361 ND -6.0 Y +58362 ND -6.0 Y +58363 ND -6.0 Y +58365 ND -6.0 Y +58366 ND -6.0 Y +58367 ND -6.0 Y +58368 ND -6.0 Y +58369 ND -6.0 Y +58370 ND -6.0 Y +58372 ND -6.0 Y +58374 ND -6.0 Y +58377 ND -6.0 Y +58379 ND -6.0 Y +58380 ND -6.0 Y +58381 ND -6.0 Y +58382 ND -6.0 Y +58384 ND -6.0 Y +58385 ND -6.0 Y +58386 ND -6.0 Y +58401 ND -6.0 Y +58402 ND -6.0 Y +58405 ND -6.0 Y +58413 ND -6.0 Y +58415 ND -6.0 Y +58416 ND -6.0 Y +58418 ND -6.0 Y +58420 ND -6.0 Y +58421 ND -6.0 Y +58422 ND -6.0 Y +58423 ND -6.0 Y +58424 ND -6.0 Y +58425 ND -6.0 Y +58426 ND -6.0 Y +58428 ND -6.0 Y +58429 ND -6.0 Y +58430 ND -6.0 Y +58431 ND -6.0 Y +58433 ND -6.0 Y +58436 ND -6.0 Y +58438 ND -6.0 Y +58439 ND -6.0 Y +58440 ND -6.0 Y +58441 ND -6.0 Y +58442 ND -6.0 Y +58443 ND -6.0 Y +58444 ND -6.0 Y +58445 ND -6.0 Y +58448 ND -6.0 Y +58451 ND -6.0 Y +58452 ND -6.0 Y +58454 ND -6.0 Y +58455 ND -6.0 Y +58456 ND -6.0 Y +58458 ND -6.0 Y +58460 ND -6.0 Y +58461 ND -6.0 Y +58463 ND -6.0 Y +58464 ND -6.0 Y +58466 ND -6.0 Y +58467 ND -6.0 Y +58472 ND -6.0 Y +58474 ND -6.0 Y +58475 ND -6.0 Y +58476 ND -6.0 Y +58477 ND -6.0 Y +58478 ND -6.0 Y +58479 ND -6.0 Y +58480 ND -6.0 Y +58481 ND -6.0 Y +58482 ND -6.0 Y +58483 ND -6.0 Y +58484 ND -6.0 Y +58486 ND -6.0 Y +58487 ND -6.0 Y +58488 ND -6.0 Y +58490 ND -6.0 Y +58492 ND -6.0 Y +58494 ND -6.0 Y +58495 ND -6.0 Y +58496 ND -6.0 Y +58497 ND -6.0 Y +58501 ND -6.0 Y +58502 ND -6.0 Y +58503 ND -6.0 Y +58504 ND -6.0 Y +58505 ND -6.0 Y +58506 ND -6.0 Y +58507 ND -6.0 Y +58520 ND -7.0 Y +58521 ND -6.0 Y +58523 ND -7.0 Y +58524 ND -6.0 Y +58528 ND -7.0 Y +58529 ND -7.0 Y +58530 ND -6.0 Y +58531 ND -6.0 Y +58532 ND -6.0 Y +58533 ND -7.0 Y +58535 ND -7.0 Y +58538 ND -7.0 Y +58540 ND -6.0 Y +58541 ND -7.0 Y +58542 ND -6.0 Y +58544 ND -6.0 Y +58545 ND -7.0 Y +58549 ND -6.0 Y +58552 ND -6.0 Y +58554 ND -7.0 Y +58558 ND -6.0 Y +58559 ND -6.0 Y +58560 ND -6.0 Y +58561 ND -6.0 Y +58562 ND -7.0 Y +58563 ND -7.0 Y +58564 ND -7.0 Y +58565 ND -6.0 Y +58566 ND -7.0 Y +58568 ND -7.0 Y +58569 ND -7.0 Y +58570 ND -7.0 Y +58571 ND -7.0 Y +58572 ND -6.0 Y +58573 ND -6.0 Y +58575 ND -6.0 Y +58576 ND -6.0 Y +58577 ND -6.0 Y +58579 ND -6.0 Y +58580 ND -7.0 Y +58581 ND -6.0 Y +58601 ND -7.0 Y +58602 ND -7.0 Y +58620 ND -7.0 Y +58621 ND -7.0 Y +58622 ND -7.0 Y +58623 ND -7.0 Y +58625 ND -7.0 Y +58626 ND -7.0 Y +58627 ND -7.0 Y +58630 ND -7.0 Y +58631 ND -7.0 Y +58632 ND -7.0 Y +58634 ND -7.0 Y +58636 ND -7.0 Y +58638 ND -7.0 Y +58639 ND -7.0 Y +58640 ND -7.0 Y +58641 ND -7.0 Y +58642 ND -7.0 Y +58643 ND -7.0 Y +58644 ND -7.0 Y +58645 ND -7.0 Y +58646 ND -7.0 Y +58647 ND -7.0 Y +58649 ND -7.0 Y +58650 ND -7.0 Y +58651 ND -7.0 Y +58652 ND -7.0 Y +58653 ND -7.0 Y +58654 ND -7.0 Y +58655 ND -7.0 Y +58656 ND -7.0 Y +58701 ND -6.0 Y +58702 ND -6.0 Y +58703 ND -6.0 Y +58704 ND -6.0 Y +58705 ND -6.0 Y +58707 ND -6.0 Y +58710 ND -6.0 Y +58711 ND -6.0 Y +58712 ND -6.0 Y +58713 ND -6.0 Y +58716 ND -6.0 Y +58718 ND -6.0 Y +58721 ND -6.0 Y +58722 ND -6.0 Y +58723 ND -6.0 Y +58725 ND -6.0 Y +58727 ND -6.0 Y +58730 ND -6.0 Y +58731 ND -6.0 Y +58733 ND -6.0 Y +58734 ND -6.0 Y +58735 ND -6.0 Y +58736 ND -6.0 Y +58737 ND -6.0 Y +58740 ND -6.0 Y +58741 ND -6.0 Y +58744 ND -6.0 Y +58746 ND -6.0 Y +58748 ND -6.0 Y +58750 ND -6.0 Y +58752 ND -6.0 Y +58755 ND -6.0 Y +58756 ND -6.0 Y +58757 ND -6.0 Y +58758 ND -6.0 Y +58759 ND -6.0 Y +58760 ND -6.0 Y +58761 ND -6.0 Y +58762 ND -6.0 Y +58763 ND -6.0 Y +58765 ND -6.0 Y +58768 ND -6.0 Y +58769 ND -6.0 Y +58770 ND -6.0 Y +58771 ND -6.0 Y +58772 ND -6.0 Y +58773 ND -6.0 Y +58775 ND -6.0 Y +58776 ND -6.0 Y +58778 ND -6.0 Y +58779 ND -6.0 Y +58781 ND -6.0 Y +58782 ND -6.0 Y +58783 ND -6.0 Y +58784 ND -6.0 Y +58785 ND -6.0 Y +58787 ND -6.0 Y +58788 ND -6.0 Y +58789 ND -6.0 Y +58790 ND -6.0 Y +58792 ND -6.0 Y +58793 ND -6.0 Y +58794 ND -6.0 Y +58795 ND -6.0 Y +58801 ND -6.0 Y +58802 ND -6.0 Y +58830 ND -6.0 Y +58831 ND -6.0 Y +58833 ND -6.0 Y +58835 ND -6.0 Y +58838 ND -6.0 Y +58843 ND -6.0 Y +58844 ND -6.0 Y +58845 ND -6.0 Y +58847 ND -6.0 Y +58849 ND -6.0 Y +58852 ND -6.0 Y +58853 ND -6.0 Y +58854 ND -6.0 Y +58856 ND -6.0 Y +59001 MT -7.0 Y +59002 MT -7.0 Y +59003 MT -7.0 Y +59004 MT -7.0 Y +59006 MT -7.0 Y +59007 MT -7.0 Y +59008 MT -7.0 Y +59010 MT -7.0 Y +59011 MT -7.0 Y +59012 MT -7.0 Y +59013 MT -7.0 Y +59014 MT -7.0 Y +59015 MT -7.0 Y +59016 MT -7.0 Y +59018 MT -7.0 Y +59019 MT -7.0 Y +59020 MT -7.0 Y +59022 MT -7.0 Y +59024 MT -7.0 Y +59025 MT -7.0 Y +59026 MT -7.0 Y +59027 MT -7.0 Y +59028 MT -7.0 Y +59029 MT -7.0 Y +59030 MT -7.0 Y +59031 MT -7.0 Y +59032 MT -7.0 Y +59033 MT -7.0 Y +59034 MT -7.0 Y +59035 MT -7.0 Y +59036 MT -7.0 Y +59037 MT -7.0 Y +59038 MT -7.0 Y +59039 MT -7.0 Y +59041 MT -7.0 Y +59043 MT -7.0 Y +59044 MT -7.0 Y +59046 MT -7.0 Y +59047 MT -7.0 Y +59050 MT -7.0 Y +59052 MT -7.0 Y +59053 MT -7.0 Y +59054 MT -7.0 Y +59055 MT -7.0 Y +59057 MT -7.0 Y +59058 MT -7.0 Y +59059 MT -7.0 Y +59061 MT -7.0 Y +59062 MT -7.0 Y +59063 MT -7.0 Y +59064 MT -7.0 Y +59065 MT -7.0 Y +59066 MT -7.0 Y +59067 MT -7.0 Y +59068 MT -7.0 Y +59069 MT -7.0 Y +59070 MT -7.0 Y +59071 MT -7.0 Y +59072 MT -7.0 Y +59073 MT -7.0 Y +59074 MT -7.0 Y +59075 MT -7.0 Y +59076 MT -7.0 Y +59077 MT -7.0 Y +59078 MT -7.0 Y +59079 MT -7.0 Y +59081 MT -7.0 Y +59082 MT -7.0 Y +59083 MT -7.0 Y +59084 MT -7.0 Y +59085 MT -7.0 Y +59086 MT -7.0 Y +59087 MT -7.0 Y +59088 MT -7.0 Y +59089 MT -7.0 Y +59101 MT -7.0 Y +59102 MT -7.0 Y +59103 MT -7.0 Y +59104 MT -7.0 Y +59105 MT -7.0 Y +59106 MT -7.0 Y +59107 MT -7.0 Y +59108 MT -7.0 Y +59111 MT -7.0 Y +59112 MT -7.0 Y +59114 MT -7.0 Y +59115 MT -7.0 Y +59116 MT -7.0 Y +59117 MT -7.0 Y +59201 MT -7.0 Y +59211 MT -7.0 Y +59212 MT -7.0 Y +59213 MT -7.0 Y +59214 MT -7.0 Y +59215 MT -7.0 Y +59217 MT -7.0 Y +59218 MT -7.0 Y +59219 MT -7.0 Y +59221 MT -7.0 Y +59222 MT -7.0 Y +59223 MT -7.0 Y +59225 MT -7.0 Y +59226 MT -7.0 Y +59230 MT -7.0 Y +59231 MT -7.0 Y +59240 MT -7.0 Y +59241 MT -7.0 Y +59242 MT -7.0 Y +59243 MT -7.0 Y +59244 MT -7.0 Y +59247 MT -7.0 Y +59248 MT -7.0 Y +59250 MT -7.0 Y +59252 MT -7.0 Y +59253 MT -7.0 Y +59254 MT -7.0 Y +59255 MT -7.0 Y +59256 MT -7.0 Y +59257 MT -7.0 Y +59258 MT -7.0 Y +59259 MT -7.0 Y +59260 MT -7.0 Y +59261 MT -7.0 Y +59262 MT -7.0 Y +59263 MT -7.0 Y +59270 MT -7.0 Y +59273 MT -7.0 Y +59274 MT -7.0 Y +59275 MT -7.0 Y +59276 MT -7.0 Y +59301 MT -7.0 Y +59311 MT -7.0 Y +59312 MT -7.0 Y +59313 MT -7.0 Y +59314 MT -7.0 Y +59315 MT -7.0 Y +59316 MT -7.0 Y +59317 MT -7.0 Y +59318 MT -7.0 Y +59319 MT -7.0 Y +59322 MT -7.0 Y +59323 MT -7.0 Y +59324 MT -7.0 Y +59326 MT -7.0 Y +59327 MT -7.0 Y +59330 MT -7.0 Y +59332 MT -7.0 Y +59333 MT -7.0 Y +59336 MT -7.0 Y +59337 MT -7.0 Y +59338 MT -7.0 Y +59339 MT -7.0 Y +59341 MT -7.0 Y +59343 MT -7.0 Y +59344 MT -7.0 Y +59345 MT -7.0 Y +59347 MT -7.0 Y +59349 MT -7.0 Y +59351 MT -7.0 Y +59353 MT -7.0 Y +59354 MT -7.0 Y +59401 MT -7.0 Y +59402 MT -7.0 Y +59403 MT -7.0 Y +59404 MT -7.0 Y +59405 MT -7.0 Y +59406 MT -7.0 Y +59410 MT -7.0 Y +59411 MT -7.0 Y +59412 MT -7.0 Y +59414 MT -7.0 Y +59416 MT -7.0 Y +59417 MT -7.0 Y +59418 MT -7.0 Y +59419 MT -7.0 Y +59420 MT -7.0 Y +59421 MT -7.0 Y +59422 MT -7.0 Y +59424 MT -7.0 Y +59425 MT -7.0 Y +59427 MT -7.0 Y +59430 MT -7.0 Y +59432 MT -7.0 Y +59433 MT -7.0 Y +59434 MT -7.0 Y +59435 MT -7.0 Y +59436 MT -7.0 Y +59440 MT -7.0 Y +59441 MT -7.0 Y +59442 MT -7.0 Y +59443 MT -7.0 Y +59444 MT -7.0 Y +59446 MT -7.0 Y +59447 MT -7.0 Y +59448 MT -7.0 Y +59450 MT -7.0 Y +59451 MT -7.0 Y +59452 MT -7.0 Y +59453 MT -7.0 Y +59454 MT -7.0 Y +59456 MT -7.0 Y +59457 MT -7.0 Y +59460 MT -7.0 Y +59461 MT -7.0 Y +59462 MT -7.0 Y +59463 MT -7.0 Y +59464 MT -7.0 Y +59465 MT -7.0 Y +59466 MT -7.0 Y +59467 MT -7.0 Y +59468 MT -7.0 Y +59469 MT -7.0 Y +59471 MT -7.0 Y +59472 MT -7.0 Y +59474 MT -7.0 Y +59477 MT -7.0 Y +59479 MT -7.0 Y +59480 MT -7.0 Y +59482 MT -7.0 Y +59483 MT -7.0 Y +59484 MT -7.0 Y +59485 MT -7.0 Y +59486 MT -7.0 Y +59487 MT -7.0 Y +59489 MT -7.0 Y +59501 MT -7.0 Y +59520 MT -7.0 Y +59521 MT -7.0 Y +59522 MT -7.0 Y +59523 MT -7.0 Y +59524 MT -7.0 Y +59525 MT -7.0 Y +59526 MT -7.0 Y +59527 MT -7.0 Y +59528 MT -7.0 Y +59529 MT -7.0 Y +59530 MT -7.0 Y +59531 MT -7.0 Y +59532 MT -7.0 Y +59535 MT -7.0 Y +59537 MT -7.0 Y +59538 MT -7.0 Y +59540 MT -7.0 Y +59542 MT -7.0 Y +59544 MT -7.0 Y +59545 MT -7.0 Y +59546 MT -7.0 Y +59547 MT -7.0 Y +59601 MT -7.0 Y +59602 MT -7.0 Y +59604 MT -7.0 Y +59620 MT -7.0 Y +59623 MT -7.0 Y +59624 MT -7.0 Y +59625 MT -7.0 Y +59626 MT -7.0 Y +59631 MT -7.0 Y +59632 MT -7.0 Y +59633 MT -7.0 Y +59634 MT -7.0 Y +59635 MT -7.0 Y +59636 MT -7.0 Y +59638 MT -7.0 Y +59639 MT -7.0 Y +59640 MT -7.0 Y +59641 MT -7.0 Y +59642 MT -7.0 Y +59643 MT -7.0 Y +59644 MT -7.0 Y +59645 MT -7.0 Y +59647 MT -7.0 Y +59648 MT -7.0 Y +59701 MT -7.0 Y +59702 MT -7.0 Y +59703 MT -7.0 Y +59707 MT -7.0 Y +59710 MT -7.0 Y +59711 MT -7.0 Y +59713 MT -7.0 Y +59714 MT -7.0 Y +59715 MT -7.0 Y +59716 MT -7.0 Y +59717 MT -7.0 Y +59718 MT -7.0 Y +59719 MT -7.0 Y +59720 MT -7.0 Y +59721 MT -7.0 Y +59722 MT -7.0 Y +59724 MT -7.0 Y +59725 MT -7.0 Y +59727 MT -7.0 Y +59728 MT -7.0 Y +59729 MT -7.0 Y +59730 MT -7.0 Y +59731 MT -7.0 Y +59732 MT -7.0 Y +59733 MT -7.0 Y +59735 MT -7.0 Y +59736 MT -7.0 Y +59739 MT -7.0 Y +59740 MT -7.0 Y +59741 MT -7.0 Y +59743 MT -7.0 Y +59745 MT -7.0 Y +59746 MT -7.0 Y +59747 MT -7.0 Y +59748 MT -7.0 Y +59749 MT -7.0 Y +59750 MT -7.0 Y +59751 MT -7.0 Y +59752 MT -7.0 Y +59754 MT -7.0 Y +59755 MT -7.0 Y +59756 MT -7.0 Y +59758 MT -7.0 Y +59759 MT -7.0 Y +59760 MT -7.0 Y +59761 MT -7.0 Y +59762 MT -7.0 Y +59771 MT -7.0 Y +59772 MT -7.0 Y +59773 MT -7.0 Y +59801 MT -7.0 Y +59802 MT -7.0 Y +59803 MT -7.0 Y +59804 MT -7.0 Y +59806 MT -7.0 Y +59807 MT -7.0 Y +59808 MT -7.0 Y +59812 MT -7.0 Y +59820 MT -7.0 Y +59821 MT -7.0 Y +59823 MT -7.0 Y +59824 MT -7.0 Y +59825 MT -7.0 Y +59826 MT -7.0 Y +59827 MT -7.0 Y +59828 MT -7.0 Y +59829 MT -7.0 Y +59830 MT -7.0 Y +59831 MT -7.0 Y +59832 MT -7.0 Y +59833 MT -7.0 Y +59834 MT -7.0 Y +59835 MT -7.0 Y +59837 MT -7.0 Y +59840 MT -7.0 Y +59841 MT -7.0 Y +59842 MT -7.0 Y +59843 MT -7.0 Y +59844 MT -7.0 Y +59845 MT -7.0 Y +59846 MT -7.0 Y +59847 MT -7.0 Y +59848 MT -7.0 Y +59851 MT -7.0 Y +59853 MT -7.0 Y +59854 MT -7.0 Y +59855 MT -7.0 Y +59856 MT -7.0 Y +59858 MT -7.0 Y +59859 MT -7.0 Y +59860 MT -7.0 Y +59863 MT -7.0 Y +59864 MT -7.0 Y +59865 MT -7.0 Y +59866 MT -7.0 Y +59867 MT -7.0 Y +59868 MT -7.0 Y +59870 MT -7.0 Y +59871 MT -7.0 Y +59872 MT -7.0 Y +59873 MT -7.0 Y +59874 MT -7.0 Y +59875 MT -7.0 Y +59901 MT -7.0 Y +59903 MT -7.0 Y +59904 MT -7.0 Y +59910 MT -7.0 Y +59911 MT -7.0 Y +59912 MT -7.0 Y +59913 MT -7.0 Y +59914 MT -7.0 Y +59915 MT -7.0 Y +59916 MT -7.0 Y +59917 MT -7.0 Y +59918 MT -7.0 Y +59919 MT -7.0 Y +59920 MT -7.0 Y +59921 MT -7.0 Y +59922 MT -7.0 Y +59923 MT -7.0 Y +59925 MT -7.0 Y +59926 MT -7.0 Y +59927 MT -7.0 Y +59928 MT -7.0 Y +59929 MT -7.0 Y +59930 MT -7.0 Y +59931 MT -7.0 Y +59932 MT -7.0 Y +59933 MT -7.0 Y +59934 MT -7.0 Y +59935 MT -7.0 Y +59936 MT -7.0 Y +59937 MT -7.0 Y +60001 IL -6.0 Y +60002 IL -6.0 Y +60004 IL -6.0 Y +60005 IL -6.0 Y +60006 IL -6.0 Y +60007 IL -6.0 Y +60008 IL -6.0 Y +60009 IL -6.0 Y +60010 IL -6.0 Y +60011 IL -6.0 Y +60012 IL -6.0 Y +60013 IL -6.0 Y +60014 IL -6.0 Y +60015 IL -6.0 Y +60016 IL -6.0 Y +60017 IL -6.0 Y +60018 IL -6.0 Y +60019 IL -6.0 Y +60020 IL -6.0 Y +60021 IL -6.0 Y +60022 IL -6.0 Y +60025 IL -6.0 Y +60026 IL -6.0 Y +60029 IL -6.0 Y +60030 IL -6.0 Y +60031 IL -6.0 Y +60033 IL -6.0 Y +60034 IL -6.0 Y +60035 IL -6.0 Y +60037 IL -6.0 Y +60038 IL -6.0 Y +60039 IL -6.0 Y +60040 IL -6.0 Y +60041 IL -6.0 Y +60042 IL -6.0 Y +60043 IL -6.0 Y +60044 IL -6.0 Y +60045 IL -6.0 Y +60046 IL -6.0 Y +60047 IL -6.0 Y +60048 IL -6.0 Y +60049 IL -6.0 Y +60050 IL -6.0 Y +60051 IL -6.0 Y +60053 IL -6.0 Y +60055 IL -6.0 Y +60056 IL -6.0 Y +60060 IL -6.0 Y +60061 IL -6.0 Y +60062 IL -6.0 Y +60064 IL -6.0 Y +60065 IL -6.0 Y +60067 IL -6.0 Y +60068 IL -6.0 Y +60069 IL -6.0 Y +60070 IL -6.0 Y +60071 IL -6.0 Y +60072 IL -6.0 Y +60073 IL -6.0 Y +60074 IL -6.0 Y +60075 IL -6.0 Y +60076 IL -6.0 Y +60077 IL -6.0 Y +60078 IL -6.0 Y +60079 IL -6.0 Y +60081 IL -6.0 Y +60082 IL -6.0 Y +60083 IL -6.0 Y +60084 IL -6.0 Y +60085 IL -6.0 Y +60086 IL -6.0 Y +60087 IL -6.0 Y +60088 IL -6.0 Y +60089 IL -6.0 Y +60090 IL -6.0 Y +60091 IL -6.0 Y +60092 IL -6.0 Y +60093 IL -6.0 Y +60094 IL -6.0 Y +60095 IL -6.0 Y +60096 IL -6.0 Y +60097 IL -6.0 Y +60098 IL -6.0 Y +60099 IL -6.0 Y +60101 IL -6.0 Y +60102 IL -6.0 Y +60103 IL -6.0 Y +60104 IL -6.0 Y +60105 IL -6.0 Y +60106 IL -6.0 Y +60107 IL -6.0 Y +60108 IL -6.0 Y +60109 IL -6.0 Y +60110 IL -6.0 Y +60111 IL -6.0 Y +60112 IL -6.0 Y +60113 IL -6.0 Y +60115 IL -6.0 Y +60116 IL -6.0 Y +60117 IL -6.0 Y +60118 IL -6.0 Y +60119 IL -6.0 Y +60120 IL -6.0 Y +60121 IL -6.0 Y +60122 IL -6.0 Y +60123 IL -6.0 Y +60124 IL -6.0 Y +60125 IL -6.0 Y +60126 IL -6.0 Y +60128 IL -6.0 Y +60129 IL -6.0 Y +60130 IL -6.0 Y +60131 IL -6.0 Y +60132 IL -6.0 Y +60133 IL -6.0 Y +60134 IL -6.0 Y +60135 IL -6.0 Y +60136 IL -6.0 Y +60137 IL -6.0 Y +60138 IL -6.0 Y +60139 IL -6.0 Y +60140 IL -6.0 Y +60141 IL -6.0 Y +60142 IL -6.0 Y +60143 IL -6.0 Y +60144 IL -6.0 Y +60145 IL -6.0 Y +60146 IL -6.0 Y +60147 IL -6.0 Y +60148 IL -6.0 Y +60150 IL -6.0 Y +60151 IL -6.0 Y +60152 IL -6.0 Y +60153 IL -6.0 Y +60154 IL -6.0 Y +60155 IL -6.0 Y +60156 IL -6.0 Y +60157 IL -6.0 Y +60159 IL -6.0 Y +60160 IL -6.0 Y +60161 IL -6.0 Y +60162 IL -6.0 Y +60163 IL -6.0 Y +60164 IL -6.0 Y +60165 IL -6.0 Y +60168 IL -6.0 Y +60169 IL -6.0 Y +60170 IL -6.0 Y +60171 IL -6.0 Y +60172 IL -6.0 Y +60173 IL -6.0 Y +60174 IL -6.0 Y +60175 IL -6.0 Y +60176 IL -6.0 Y +60177 IL -6.0 Y +60178 IL -6.0 Y +60179 IL -6.0 Y +60180 IL -6.0 Y +60181 IL -6.0 Y +60183 IL -6.0 Y +60184 IL -6.0 Y +60185 IL -6.0 Y +60186 IL -6.0 Y +60187 IL -6.0 Y +60188 IL -6.0 Y +60189 IL -6.0 Y +60190 IL -6.0 Y +60191 IL -6.0 Y +60192 IL -6.0 Y +60193 IL -6.0 Y +60194 IL -6.0 Y +60195 IL -6.0 Y +60196 IL -6.0 Y +60197 IL -6.0 Y +60199 IL -6.0 Y +60201 IL -6.0 Y +60202 IL -6.0 Y +60203 IL -6.0 Y +60204 IL -6.0 Y +60208 IL -6.0 Y +60209 IL -6.0 Y +60296 IL -6.0 Y +60297 IL -6.0 Y +60301 IL -6.0 Y +60302 IL -6.0 Y +60303 IL -6.0 Y +60304 IL -6.0 Y +60305 IL -6.0 Y +60399 IL -6.0 Y +60401 IL -6.0 Y +60402 IL -6.0 Y +60403 IL -6.0 Y +60404 IL -6.0 Y +60406 IL -6.0 Y +60407 IL -6.0 Y +60408 IL -6.0 Y +60409 IL -6.0 Y +60410 IL -6.0 Y +60411 IL -6.0 Y +60412 IL -6.0 Y +60415 IL -6.0 Y +60416 IL -6.0 Y +60417 IL -6.0 Y +60419 IL -6.0 Y +60420 IL -6.0 Y +60421 IL -6.0 Y +60422 IL -6.0 Y +60423 IL -6.0 Y +60424 IL -6.0 Y +60425 IL -6.0 Y +60426 IL -6.0 Y +60428 IL -6.0 Y +60429 IL -6.0 Y +60430 IL -6.0 Y +60431 IL -6.0 Y +60432 IL -6.0 Y +60433 IL -6.0 Y +60434 IL -6.0 Y +60435 IL -6.0 Y +60436 IL -6.0 Y +60437 IL -6.0 Y +60438 IL -6.0 Y +60439 IL -6.0 Y +60440 IL -6.0 Y +60441 IL -6.0 Y +60442 IL -6.0 Y +60443 IL -6.0 Y +60444 IL -6.0 Y +60445 IL -6.0 Y +60446 IL -6.0 Y +60447 IL -6.0 Y +60448 IL -6.0 Y +60449 IL -6.0 Y +60450 IL -6.0 Y +60451 IL -6.0 Y +60452 IL -6.0 Y +60453 IL -6.0 Y +60454 IL -6.0 Y +60455 IL -6.0 Y +60456 IL -6.0 Y +60457 IL -6.0 Y +60458 IL -6.0 Y +60459 IL -6.0 Y +60460 IL -6.0 Y +60461 IL -6.0 Y +60462 IL -6.0 Y +60463 IL -6.0 Y +60464 IL -6.0 Y +60465 IL -6.0 Y +60466 IL -6.0 Y +60467 IL -6.0 Y +60468 IL -6.0 Y +60469 IL -6.0 Y +60470 IL -6.0 Y +60471 IL -6.0 Y +60472 IL -6.0 Y +60473 IL -6.0 Y +60474 IL -6.0 Y +60475 IL -6.0 Y +60476 IL -6.0 Y +60477 IL -6.0 Y +60478 IL -6.0 Y +60479 IL -6.0 Y +60480 IL -6.0 Y +60481 IL -6.0 Y +60482 IL -6.0 Y +60483 IL -6.0 Y +60487 IL -6.0 Y +60490 IL -6.0 Y +60491 IL -6.0 Y +60499 IL -6.0 Y +60501 IL -6.0 Y +60502 IL -6.0 Y +60503 IL -6.0 Y +60504 IL -6.0 Y +60505 IL -6.0 Y +60506 IL -6.0 Y +60507 IL -6.0 Y +60510 IL -6.0 Y +60511 IL -6.0 Y +60512 IL -6.0 Y +60513 IL -6.0 Y +60514 IL -6.0 Y +60515 IL -6.0 Y +60516 IL -6.0 Y +60517 IL -6.0 Y +60518 IL -6.0 Y +60519 IL -6.0 Y +60520 IL -6.0 Y +60521 IL -6.0 Y +60522 IL -6.0 Y +60523 IL -6.0 Y +60525 IL -6.0 Y +60526 IL -6.0 Y +60527 IL -6.0 Y +60530 IL -6.0 Y +60531 IL -6.0 Y +60532 IL -6.0 Y +60534 IL -6.0 Y +60536 IL -6.0 Y +60537 IL -6.0 Y +60538 IL -6.0 Y +60539 IL -6.0 Y +60540 IL -6.0 Y +60541 IL -6.0 Y +60542 IL -6.0 Y +60543 IL -6.0 Y +60544 IL -6.0 Y +60545 IL -6.0 Y +60546 IL -6.0 Y +60548 IL -6.0 Y +60549 IL -6.0 Y +60550 IL -6.0 Y +60551 IL -6.0 Y +60552 IL -6.0 Y +60553 IL -6.0 Y +60554 IL -6.0 Y +60555 IL -6.0 Y +60556 IL -6.0 Y +60557 IL -6.0 Y +60558 IL -6.0 Y +60559 IL -6.0 Y +60560 IL -6.0 Y +60561 IL -6.0 Y +60563 IL -6.0 Y +60564 IL -6.0 Y +60565 IL -6.0 Y +60566 IL -6.0 Y +60567 IL -6.0 Y +60568 IL -6.0 Y +60570 IL -6.0 Y +60572 IL -6.0 Y +60585 IL -6.0 Y +60586 IL -6.0 Y +60597 IL -6.0 Y +60598 IL -6.0 Y +60599 IL -6.0 Y +60601 IL -6.0 Y +60602 IL -6.0 Y +60603 IL -6.0 Y +60604 IL -6.0 Y +60605 IL -6.0 Y +60606 IL -6.0 Y +60607 IL -6.0 Y +60608 IL -6.0 Y +60609 IL -6.0 Y +60610 IL -6.0 Y +60611 IL -6.0 Y +60612 IL -6.0 Y +60613 IL -6.0 Y +60614 IL -6.0 Y +60615 IL -6.0 Y +60616 IL -6.0 Y +60617 IL -6.0 Y +60618 IL -6.0 Y +60619 IL -6.0 Y +60620 IL -6.0 Y +60621 IL -6.0 Y +60622 IL -6.0 Y +60623 IL -6.0 Y +60624 IL -6.0 Y +60625 IL -6.0 Y +60626 IL -6.0 Y +60628 IL -6.0 Y +60629 IL -6.0 Y +60630 IL -6.0 Y +60631 IL -6.0 Y +60632 IL -6.0 Y +60633 IL -6.0 Y +60634 IL -6.0 Y +60636 IL -6.0 Y +60637 IL -6.0 Y +60638 IL -6.0 Y +60639 IL -6.0 Y +60640 IL -6.0 Y +60641 IL -6.0 Y +60643 IL -6.0 Y +60644 IL -6.0 Y +60645 IL -6.0 Y +60646 IL -6.0 Y +60647 IL -6.0 Y +60649 IL -6.0 Y +60651 IL -6.0 Y +60652 IL -6.0 Y +60653 IL -6.0 Y +60654 IL -6.0 Y +60655 IL -6.0 Y +60656 IL -6.0 Y +60657 IL -6.0 Y +60659 IL -6.0 Y +60660 IL -6.0 Y +60661 IL -6.0 Y +60663 IL -6.0 Y +60664 IL -6.0 Y +60666 IL -6.0 Y +60668 IL -6.0 Y +60669 IL -6.0 Y +60670 IL -6.0 Y +60673 IL -6.0 Y +60674 IL -6.0 Y +60675 IL -6.0 Y +60677 IL -6.0 Y +60678 IL -6.0 Y +60679 IL -6.0 Y +60680 IL -6.0 Y +60681 IL -6.0 Y +60682 IL -6.0 Y +60684 IL -6.0 Y +60685 IL -6.0 Y +60686 IL -6.0 Y +60687 IL -6.0 Y +60688 IL -6.0 Y +60689 IL -6.0 Y +60690 IL -6.0 Y +60691 IL -6.0 Y +60693 IL -6.0 Y +60694 IL -6.0 Y +60695 IL -6.0 Y +60696 IL -6.0 Y +60697 IL -6.0 Y +60699 IL -6.0 Y +60701 IL -6.0 Y +60706 IL -6.0 Y +60707 IL -6.0 Y +60712 IL -6.0 Y +60714 IL -6.0 Y +60803 IL -6.0 Y +60804 IL -6.0 Y +60805 IL -6.0 Y +60827 IL -6.0 Y +60901 IL -6.0 Y +60910 IL -6.0 Y +60911 IL -6.0 Y +60912 IL -6.0 Y +60913 IL -6.0 Y +60914 IL -6.0 Y +60915 IL -6.0 Y +60917 IL -6.0 Y +60918 IL -6.0 Y +60919 IL -6.0 Y +60920 IL -6.0 Y +60921 IL -6.0 Y +60922 IL -6.0 Y +60924 IL -6.0 Y +60926 IL -6.0 Y +60927 IL -6.0 Y +60928 IL -6.0 Y +60929 IL -6.0 Y +60930 IL -6.0 Y +60931 IL -6.0 Y +60932 IL -6.0 Y +60933 IL -6.0 Y +60934 IL -6.0 Y +60935 IL -6.0 Y +60936 IL -6.0 Y +60938 IL -6.0 Y +60939 IL -6.0 Y +60940 IL -6.0 Y +60941 IL -6.0 Y +60942 IL -6.0 Y +60944 IL -6.0 Y +60945 IL -6.0 Y +60946 IL -6.0 Y +60948 IL -6.0 Y +60949 IL -6.0 Y +60950 IL -6.0 Y +60951 IL -6.0 Y +60952 IL -6.0 Y +60953 IL -6.0 Y +60954 IL -6.0 Y +60955 IL -6.0 Y +60956 IL -6.0 Y +60957 IL -6.0 Y +60959 IL -6.0 Y +60960 IL -6.0 Y +60961 IL -6.0 Y +60962 IL -6.0 Y +60963 IL -6.0 Y +60964 IL -6.0 Y +60966 IL -6.0 Y +60967 IL -6.0 Y +60968 IL -6.0 Y +60969 IL -6.0 Y +60970 IL -6.0 Y +60973 IL -6.0 Y +60974 IL -6.0 Y +61001 IL -6.0 Y +61006 IL -6.0 Y +61007 IL -6.0 Y +61008 IL -6.0 Y +61010 IL -6.0 Y +61011 IL -6.0 Y +61012 IL -6.0 Y +61013 IL -6.0 Y +61014 IL -6.0 Y +61015 IL -6.0 Y +61016 IL -6.0 Y +61018 IL -6.0 Y +61019 IL -6.0 Y +61020 IL -6.0 Y +61021 IL -6.0 Y +61024 IL -6.0 Y +61025 IL -6.0 Y +61027 IL -6.0 Y +61028 IL -6.0 Y +61030 IL -6.0 Y +61031 IL -6.0 Y +61032 IL -6.0 Y +61036 IL -6.0 Y +61037 IL -6.0 Y +61038 IL -6.0 Y +61039 IL -6.0 Y +61041 IL -6.0 Y +61042 IL -6.0 Y +61043 IL -6.0 Y +61044 IL -6.0 Y +61046 IL -6.0 Y +61047 IL -6.0 Y +61048 IL -6.0 Y +61049 IL -6.0 Y +61050 IL -6.0 Y +61051 IL -6.0 Y +61052 IL -6.0 Y +61053 IL -6.0 Y +61054 IL -6.0 Y +61057 IL -6.0 Y +61058 IL -6.0 Y +61059 IL -6.0 Y +61060 IL -6.0 Y +61061 IL -6.0 Y +61062 IL -6.0 Y +61063 IL -6.0 Y +61064 IL -6.0 Y +61065 IL -6.0 Y +61067 IL -6.0 Y +61068 IL -6.0 Y +61070 IL -6.0 Y +61071 IL -6.0 Y +61072 IL -6.0 Y +61073 IL -6.0 Y +61074 IL -6.0 Y +61075 IL -6.0 Y +61077 IL -6.0 Y +61078 IL -6.0 Y +61079 IL -6.0 Y +61080 IL -6.0 Y +61081 IL -6.0 Y +61084 IL -6.0 Y +61085 IL -6.0 Y +61087 IL -6.0 Y +61088 IL -6.0 Y +61089 IL -6.0 Y +61091 IL -6.0 Y +61101 IL -6.0 Y +61102 IL -6.0 Y +61103 IL -6.0 Y +61104 IL -6.0 Y +61105 IL -6.0 Y +61106 IL -6.0 Y +61107 IL -6.0 Y +61108 IL -6.0 Y +61109 IL -6.0 Y +61110 IL -6.0 Y +61111 IL -6.0 Y +61112 IL -6.0 Y +61114 IL -6.0 Y +61115 IL -6.0 Y +61125 IL -6.0 Y +61126 IL -6.0 Y +61130 IL -6.0 Y +61131 IL -6.0 Y +61132 IL -6.0 Y +61201 IL -6.0 Y +61204 IL -6.0 Y +61230 IL -6.0 Y +61231 IL -6.0 Y +61232 IL -6.0 Y +61233 IL -6.0 Y +61234 IL -6.0 Y +61235 IL -6.0 Y +61236 IL -6.0 Y +61237 IL -6.0 Y +61238 IL -6.0 Y +61239 IL -6.0 Y +61240 IL -6.0 Y +61241 IL -6.0 Y +61242 IL -6.0 Y +61243 IL -6.0 Y +61244 IL -6.0 Y +61250 IL -6.0 Y +61251 IL -6.0 Y +61252 IL -6.0 Y +61254 IL -6.0 Y +61256 IL -6.0 Y +61257 IL -6.0 Y +61258 IL -6.0 Y +61259 IL -6.0 Y +61260 IL -6.0 Y +61261 IL -6.0 Y +61262 IL -6.0 Y +61263 IL -6.0 Y +61264 IL -6.0 Y +61265 IL -6.0 Y +61266 IL -6.0 Y +61270 IL -6.0 Y +61272 IL -6.0 Y +61273 IL -6.0 Y +61274 IL -6.0 Y +61275 IL -6.0 Y +61276 IL -6.0 Y +61277 IL -6.0 Y +61278 IL -6.0 Y +61279 IL -6.0 Y +61281 IL -6.0 Y +61282 IL -6.0 Y +61283 IL -6.0 Y +61284 IL -6.0 Y +61285 IL -6.0 Y +61299 IL -6.0 Y +61301 IL -6.0 Y +61310 IL -6.0 Y +61311 IL -6.0 Y +61312 IL -6.0 Y +61313 IL -6.0 Y +61314 IL -6.0 Y +61315 IL -6.0 Y +61316 IL -6.0 Y +61317 IL -6.0 Y +61318 IL -6.0 Y +61319 IL -6.0 Y +61320 IL -6.0 Y +61321 IL -6.0 Y +61322 IL -6.0 Y +61323 IL -6.0 Y +61324 IL -6.0 Y +61325 IL -6.0 Y +61326 IL -6.0 Y +61327 IL -6.0 Y +61328 IL -6.0 Y +61329 IL -6.0 Y +61330 IL -6.0 Y +61331 IL -6.0 Y +61332 IL -6.0 Y +61333 IL -6.0 Y +61334 IL -6.0 Y +61335 IL -6.0 Y +61336 IL -6.0 Y +61337 IL -6.0 Y +61338 IL -6.0 Y +61340 IL -6.0 Y +61341 IL -6.0 Y +61342 IL -6.0 Y +61344 IL -6.0 Y +61345 IL -6.0 Y +61346 IL -6.0 Y +61348 IL -6.0 Y +61349 IL -6.0 Y +61350 IL -6.0 Y +61353 IL -6.0 Y +61354 IL -6.0 Y +61356 IL -6.0 Y +61358 IL -6.0 Y +61359 IL -6.0 Y +61360 IL -6.0 Y +61361 IL -6.0 Y +61362 IL -6.0 Y +61363 IL -6.0 Y +61364 IL -6.0 Y +61367 IL -6.0 Y +61368 IL -6.0 Y +61369 IL -6.0 Y +61370 IL -6.0 Y +61371 IL -6.0 Y +61372 IL -6.0 Y +61373 IL -6.0 Y +61374 IL -6.0 Y +61375 IL -6.0 Y +61376 IL -6.0 Y +61377 IL -6.0 Y +61378 IL -6.0 Y +61379 IL -6.0 Y +61401 IL -6.0 Y +61402 IL -6.0 Y +61410 IL -6.0 Y +61411 IL -6.0 Y +61412 IL -6.0 Y +61413 IL -6.0 Y +61414 IL -6.0 Y +61415 IL -6.0 Y +61416 IL -6.0 Y +61417 IL -6.0 Y +61418 IL -6.0 Y +61419 IL -6.0 Y +61420 IL -6.0 Y +61421 IL -6.0 Y +61422 IL -6.0 Y +61423 IL -6.0 Y +61424 IL -6.0 Y +61425 IL -6.0 Y +61426 IL -6.0 Y +61427 IL -6.0 Y +61428 IL -6.0 Y +61430 IL -6.0 Y +61431 IL -6.0 Y +61432 IL -6.0 Y +61433 IL -6.0 Y +61434 IL -6.0 Y +61435 IL -6.0 Y +61436 IL -6.0 Y +61437 IL -6.0 Y +61438 IL -6.0 Y +61439 IL -6.0 Y +61440 IL -6.0 Y +61441 IL -6.0 Y +61442 IL -6.0 Y +61443 IL -6.0 Y +61447 IL -6.0 Y +61448 IL -6.0 Y +61449 IL -6.0 Y +61450 IL -6.0 Y +61451 IL -6.0 Y +61452 IL -6.0 Y +61453 IL -6.0 Y +61454 IL -6.0 Y +61455 IL -6.0 Y +61458 IL -6.0 Y +61459 IL -6.0 Y +61460 IL -6.0 Y +61462 IL -6.0 Y +61465 IL -6.0 Y +61466 IL -6.0 Y +61467 IL -6.0 Y +61468 IL -6.0 Y +61469 IL -6.0 Y +61470 IL -6.0 Y +61471 IL -6.0 Y +61472 IL -6.0 Y +61473 IL -6.0 Y +61474 IL -6.0 Y +61475 IL -6.0 Y +61476 IL -6.0 Y +61477 IL -6.0 Y +61478 IL -6.0 Y +61479 IL -6.0 Y +61480 IL -6.0 Y +61482 IL -6.0 Y +61483 IL -6.0 Y +61484 IL -6.0 Y +61485 IL -6.0 Y +61486 IL -6.0 Y +61488 IL -6.0 Y +61489 IL -6.0 Y +61490 IL -6.0 Y +61491 IL -6.0 Y +61501 IL -6.0 Y +61516 IL -6.0 Y +61517 IL -6.0 Y +61519 IL -6.0 Y +61520 IL -6.0 Y +61523 IL -6.0 Y +61524 IL -6.0 Y +61525 IL -6.0 Y +61526 IL -6.0 Y +61528 IL -6.0 Y +61529 IL -6.0 Y +61530 IL -6.0 Y +61531 IL -6.0 Y +61532 IL -6.0 Y +61533 IL -6.0 Y +61534 IL -6.0 Y +61535 IL -6.0 Y +61536 IL -6.0 Y +61537 IL -6.0 Y +61539 IL -6.0 Y +61540 IL -6.0 Y +61541 IL -6.0 Y +61542 IL -6.0 Y +61543 IL -6.0 Y +61544 IL -6.0 Y +61545 IL -6.0 Y +61546 IL -6.0 Y +61547 IL -6.0 Y +61548 IL -6.0 Y +61550 IL -6.0 Y +61552 IL -6.0 Y +61553 IL -6.0 Y +61554 IL -6.0 Y +61555 IL -6.0 Y +61558 IL -6.0 Y +61559 IL -6.0 Y +61560 IL -6.0 Y +61561 IL -6.0 Y +61562 IL -6.0 Y +61563 IL -6.0 Y +61564 IL -6.0 Y +61565 IL -6.0 Y +61567 IL -6.0 Y +61568 IL -6.0 Y +61569 IL -6.0 Y +61570 IL -6.0 Y +61571 IL -6.0 Y +61572 IL -6.0 Y +61601 IL -6.0 Y +61602 IL -6.0 Y +61603 IL -6.0 Y +61604 IL -6.0 Y +61605 IL -6.0 Y +61606 IL -6.0 Y +61607 IL -6.0 Y +61610 IL -6.0 Y +61611 IL -6.0 Y +61612 IL -6.0 Y +61613 IL -6.0 Y +61614 IL -6.0 Y +61615 IL -6.0 Y +61616 IL -6.0 Y +61625 IL -6.0 Y +61629 IL -6.0 Y +61630 IL -6.0 Y +61633 IL -6.0 Y +61634 IL -6.0 Y +61635 IL -6.0 Y +61636 IL -6.0 Y +61637 IL -6.0 Y +61638 IL -6.0 Y +61639 IL -6.0 Y +61641 IL -6.0 Y +61643 IL -6.0 Y +61650 IL -6.0 Y +61651 IL -6.0 Y +61652 IL -6.0 Y +61653 IL -6.0 Y +61654 IL -6.0 Y +61655 IL -6.0 Y +61656 IL -6.0 Y +61701 IL -6.0 Y +61702 IL -6.0 Y +61704 IL -6.0 Y +61709 IL -6.0 Y +61710 IL -6.0 Y +61720 IL -6.0 Y +61721 IL -6.0 Y +61722 IL -6.0 Y +61723 IL -6.0 Y +61724 IL -6.0 Y +61725 IL -6.0 Y +61726 IL -6.0 Y +61727 IL -6.0 Y +61728 IL -6.0 Y +61729 IL -6.0 Y +61730 IL -6.0 Y +61731 IL -6.0 Y +61732 IL -6.0 Y +61733 IL -6.0 Y +61734 IL -6.0 Y +61735 IL -6.0 Y +61736 IL -6.0 Y +61737 IL -6.0 Y +61738 IL -6.0 Y +61739 IL -6.0 Y +61740 IL -6.0 Y +61741 IL -6.0 Y +61742 IL -6.0 Y +61743 IL -6.0 Y +61744 IL -6.0 Y +61745 IL -6.0 Y +61747 IL -6.0 Y +61748 IL -6.0 Y +61749 IL -6.0 Y +61750 IL -6.0 Y +61751 IL -6.0 Y +61752 IL -6.0 Y +61753 IL -6.0 Y +61754 IL -6.0 Y +61755 IL -6.0 Y +61756 IL -6.0 Y +61758 IL -6.0 Y +61759 IL -6.0 Y +61760 IL -6.0 Y +61761 IL -6.0 Y +61764 IL -6.0 Y +61769 IL -6.0 Y +61770 IL -6.0 Y +61771 IL -6.0 Y +61772 IL -6.0 Y +61773 IL -6.0 Y +61774 IL -6.0 Y +61775 IL -6.0 Y +61776 IL -6.0 Y +61777 IL -6.0 Y +61778 IL -6.0 Y +61790 IL -6.0 Y +61791 IL -6.0 Y +61799 IL -6.0 Y +61801 IL -6.0 Y +61802 IL -6.0 Y +61803 IL -6.0 Y +61810 IL -6.0 Y +61811 IL -6.0 Y +61812 IL -6.0 Y +61813 IL -6.0 Y +61814 IL -6.0 Y +61815 IL -6.0 Y +61816 IL -6.0 Y +61817 IL -6.0 Y +61818 IL -6.0 Y +61820 IL -6.0 Y +61821 IL -6.0 Y +61822 IL -6.0 Y +61824 IL -6.0 Y +61825 IL -6.0 Y +61826 IL -6.0 Y +61830 IL -6.0 Y +61831 IL -6.0 Y +61832 IL -6.0 Y +61833 IL -6.0 Y +61834 IL -6.0 Y +61839 IL -6.0 Y +61840 IL -6.0 Y +61841 IL -6.0 Y +61842 IL -6.0 Y +61843 IL -6.0 Y +61844 IL -6.0 Y +61845 IL -6.0 Y +61846 IL -6.0 Y +61847 IL -6.0 Y +61848 IL -6.0 Y +61849 IL -6.0 Y +61850 IL -6.0 Y +61851 IL -6.0 Y +61852 IL -6.0 Y +61853 IL -6.0 Y +61854 IL -6.0 Y +61855 IL -6.0 Y +61856 IL -6.0 Y +61857 IL -6.0 Y +61858 IL -6.0 Y +61859 IL -6.0 Y +61862 IL -6.0 Y +61863 IL -6.0 Y +61864 IL -6.0 Y +61865 IL -6.0 Y +61866 IL -6.0 Y +61870 IL -6.0 Y +61871 IL -6.0 Y +61872 IL -6.0 Y +61873 IL -6.0 Y +61874 IL -6.0 Y +61875 IL -6.0 Y +61876 IL -6.0 Y +61877 IL -6.0 Y +61878 IL -6.0 Y +61880 IL -6.0 Y +61882 IL -6.0 Y +61883 IL -6.0 Y +61884 IL -6.0 Y +61910 IL -6.0 Y +61911 IL -6.0 Y +61912 IL -6.0 Y +61913 IL -6.0 Y +61914 IL -6.0 Y +61917 IL -6.0 Y +61919 IL -6.0 Y +61920 IL -6.0 Y +61924 IL -6.0 Y +61925 IL -6.0 Y +61928 IL -6.0 Y +61929 IL -6.0 Y +61930 IL -6.0 Y +61931 IL -6.0 Y +61932 IL -6.0 Y +61933 IL -6.0 Y +61936 IL -6.0 Y +61937 IL -6.0 Y +61938 IL -6.0 Y +61940 IL -6.0 Y +61941 IL -6.0 Y +61942 IL -6.0 Y +61943 IL -6.0 Y +61944 IL -6.0 Y +61949 IL -6.0 Y +61951 IL -6.0 Y +61953 IL -6.0 Y +61955 IL -6.0 Y +61956 IL -6.0 Y +61957 IL -6.0 Y +62001 IL -6.0 Y +62002 IL -6.0 Y +62006 IL -6.0 Y +62009 IL -6.0 Y +62010 IL -6.0 Y +62011 IL -6.0 Y +62012 IL -6.0 Y +62013 IL -6.0 Y +62014 IL -6.0 Y +62015 IL -6.0 Y +62016 IL -6.0 Y +62017 IL -6.0 Y +62018 IL -6.0 Y +62019 IL -6.0 Y +62021 IL -6.0 Y +62022 IL -6.0 Y +62023 IL -6.0 Y +62024 IL -6.0 Y +62025 IL -6.0 Y +62026 IL -6.0 Y +62027 IL -6.0 Y +62028 IL -6.0 Y +62030 IL -6.0 Y +62031 IL -6.0 Y +62032 IL -6.0 Y +62033 IL -6.0 Y +62034 IL -6.0 Y +62035 IL -6.0 Y +62036 IL -6.0 Y +62037 IL -6.0 Y +62040 IL -6.0 Y +62044 IL -6.0 Y +62045 IL -6.0 Y +62046 IL -6.0 Y +62047 IL -6.0 Y +62048 IL -6.0 Y +62049 IL -6.0 Y +62050 IL -6.0 Y +62051 IL -6.0 Y +62052 IL -6.0 Y +62053 IL -6.0 Y +62054 IL -6.0 Y +62056 IL -6.0 Y +62058 IL -6.0 Y +62059 IL -6.0 Y +62060 IL -6.0 Y +62061 IL -6.0 Y +62062 IL -6.0 Y +62063 IL -6.0 Y +62065 IL -6.0 Y +62067 IL -6.0 Y +62069 IL -6.0 Y +62070 IL -6.0 Y +62071 IL -6.0 Y +62074 IL -6.0 Y +62075 IL -6.0 Y +62076 IL -6.0 Y +62077 IL -6.0 Y +62078 IL -6.0 Y +62079 IL -6.0 Y +62080 IL -6.0 Y +62081 IL -6.0 Y +62082 IL -6.0 Y +62083 IL -6.0 Y +62084 IL -6.0 Y +62085 IL -6.0 Y +62086 IL -6.0 Y +62087 IL -6.0 Y +62088 IL -6.0 Y +62089 IL -6.0 Y +62090 IL -6.0 Y +62091 IL -6.0 Y +62092 IL -6.0 Y +62093 IL -6.0 Y +62094 IL -6.0 Y +62095 IL -6.0 Y +62097 IL -6.0 Y +62098 IL -6.0 Y +62201 IL -6.0 Y +62202 IL -6.0 Y +62203 IL -6.0 Y +62204 IL -6.0 Y +62205 IL -6.0 Y +62206 IL -6.0 Y +62207 IL -6.0 Y +62208 IL -6.0 Y +62214 IL -6.0 Y +62215 IL -6.0 Y +62216 IL -6.0 Y +62217 IL -6.0 Y +62218 IL -6.0 Y +62219 IL -6.0 Y +62220 IL -6.0 Y +62221 IL -6.0 Y +62222 IL -6.0 Y +62223 IL -6.0 Y +62224 IL -6.0 Y +62225 IL -6.0 Y +62226 IL -6.0 Y +62230 IL -6.0 Y +62231 IL -6.0 Y +62232 IL -6.0 Y +62233 IL -6.0 Y +62234 IL -6.0 Y +62236 IL -6.0 Y +62237 IL -6.0 Y +62238 IL -6.0 Y +62239 IL -6.0 Y +62240 IL -6.0 Y +62241 IL -6.0 Y +62242 IL -6.0 Y +62243 IL -6.0 Y +62244 IL -6.0 Y +62245 IL -6.0 Y +62246 IL -6.0 Y +62247 IL -6.0 Y +62248 IL -6.0 Y +62249 IL -6.0 Y +62250 IL -6.0 Y +62252 IL -6.0 Y +62253 IL -6.0 Y +62254 IL -6.0 Y +62255 IL -6.0 Y +62256 IL -6.0 Y +62257 IL -6.0 Y +62258 IL -6.0 Y +62259 IL -6.0 Y +62260 IL -6.0 Y +62261 IL -6.0 Y +62262 IL -6.0 Y +62263 IL -6.0 Y +62264 IL -6.0 Y +62265 IL -6.0 Y +62266 IL -6.0 Y +62268 IL -6.0 Y +62269 IL -6.0 Y +62271 IL -6.0 Y +62272 IL -6.0 Y +62273 IL -6.0 Y +62274 IL -6.0 Y +62275 IL -6.0 Y +62277 IL -6.0 Y +62278 IL -6.0 Y +62279 IL -6.0 Y +62280 IL -6.0 Y +62281 IL -6.0 Y +62282 IL -6.0 Y +62284 IL -6.0 Y +62285 IL -6.0 Y +62286 IL -6.0 Y +62288 IL -6.0 Y +62289 IL -6.0 Y +62292 IL -6.0 Y +62293 IL -6.0 Y +62294 IL -6.0 Y +62295 IL -6.0 Y +62297 IL -6.0 Y +62298 IL -6.0 Y +62301 IL -6.0 Y +62305 IL -6.0 Y +62306 IL -6.0 Y +62311 IL -6.0 Y +62312 IL -6.0 Y +62313 IL -6.0 Y +62314 IL -6.0 Y +62316 IL -6.0 Y +62319 IL -6.0 Y +62320 IL -6.0 Y +62321 IL -6.0 Y +62323 IL -6.0 Y +62324 IL -6.0 Y +62325 IL -6.0 Y +62326 IL -6.0 Y +62329 IL -6.0 Y +62330 IL -6.0 Y +62334 IL -6.0 Y +62336 IL -6.0 Y +62338 IL -6.0 Y +62339 IL -6.0 Y +62340 IL -6.0 Y +62341 IL -6.0 Y +62343 IL -6.0 Y +62344 IL -6.0 Y +62345 IL -6.0 Y +62346 IL -6.0 Y +62347 IL -6.0 Y +62348 IL -6.0 Y +62349 IL -6.0 Y +62351 IL -6.0 Y +62352 IL -6.0 Y +62353 IL -6.0 Y +62354 IL -6.0 Y +62355 IL -6.0 Y +62356 IL -6.0 Y +62357 IL -6.0 Y +62358 IL -6.0 Y +62359 IL -6.0 Y +62360 IL -6.0 Y +62361 IL -6.0 Y +62362 IL -6.0 Y +62363 IL -6.0 Y +62365 IL -6.0 Y +62366 IL -6.0 Y +62367 IL -6.0 Y +62370 IL -6.0 Y +62373 IL -6.0 Y +62374 IL -6.0 Y +62375 IL -6.0 Y +62376 IL -6.0 Y +62378 IL -6.0 Y +62379 IL -6.0 Y +62380 IL -6.0 Y +62401 IL -6.0 Y +62410 IL -6.0 Y +62411 IL -6.0 Y +62413 IL -6.0 Y +62414 IL -6.0 Y +62417 IL -6.0 Y +62418 IL -6.0 Y +62419 IL -6.0 Y +62420 IL -6.0 Y +62421 IL -6.0 Y +62422 IL -6.0 Y +62423 IL -6.0 Y +62424 IL -6.0 Y +62425 IL -6.0 Y +62426 IL -6.0 Y +62427 IL -6.0 Y +62428 IL -6.0 Y +62431 IL -6.0 Y +62432 IL -6.0 Y +62433 IL -6.0 Y +62434 IL -6.0 Y +62435 IL -6.0 Y +62436 IL -6.0 Y +62438 IL -6.0 Y +62439 IL -6.0 Y +62440 IL -6.0 Y +62441 IL -6.0 Y +62442 IL -6.0 Y +62443 IL -6.0 Y +62444 IL -6.0 Y +62445 IL -6.0 Y +62446 IL -6.0 Y +62447 IL -6.0 Y +62448 IL -6.0 Y +62449 IL -6.0 Y +62450 IL -6.0 Y +62451 IL -6.0 Y +62452 IL -6.0 Y +62454 IL -6.0 Y +62458 IL -6.0 Y +62459 IL -6.0 Y +62460 IL -6.0 Y +62461 IL -6.0 Y +62462 IL -6.0 Y +62463 IL -6.0 Y +62464 IL -6.0 Y +62465 IL -6.0 Y +62466 IL -6.0 Y +62467 IL -6.0 Y +62468 IL -6.0 Y +62469 IL -6.0 Y +62471 IL -6.0 Y +62473 IL -6.0 Y +62474 IL -6.0 Y +62475 IL -6.0 Y +62476 IL -6.0 Y +62477 IL -6.0 Y +62478 IL -6.0 Y +62479 IL -6.0 Y +62480 IL -6.0 Y +62481 IL -6.0 Y +62501 IL -6.0 Y +62510 IL -6.0 Y +62512 IL -6.0 Y +62513 IL -6.0 Y +62514 IL -6.0 Y +62515 IL -6.0 Y +62517 IL -6.0 Y +62518 IL -6.0 Y +62519 IL -6.0 Y +62520 IL -6.0 Y +62521 IL -6.0 Y +62522 IL -6.0 Y +62523 IL -6.0 Y +62524 IL -6.0 Y +62525 IL -6.0 Y +62526 IL -6.0 Y +62530 IL -6.0 Y +62531 IL -6.0 Y +62532 IL -6.0 Y +62533 IL -6.0 Y +62534 IL -6.0 Y +62535 IL -6.0 Y +62536 IL -6.0 Y +62537 IL -6.0 Y +62538 IL -6.0 Y +62539 IL -6.0 Y +62540 IL -6.0 Y +62541 IL -6.0 Y +62543 IL -6.0 Y +62544 IL -6.0 Y +62545 IL -6.0 Y +62546 IL -6.0 Y +62547 IL -6.0 Y +62548 IL -6.0 Y +62549 IL -6.0 Y +62550 IL -6.0 Y +62551 IL -6.0 Y +62553 IL -6.0 Y +62554 IL -6.0 Y +62555 IL -6.0 Y +62556 IL -6.0 Y +62557 IL -6.0 Y +62558 IL -6.0 Y +62560 IL -6.0 Y +62561 IL -6.0 Y +62563 IL -6.0 Y +62565 IL -6.0 Y +62567 IL -6.0 Y +62568 IL -6.0 Y +62570 IL -6.0 Y +62571 IL -6.0 Y +62572 IL -6.0 Y +62573 IL -6.0 Y +62601 IL -6.0 Y +62610 IL -6.0 Y +62611 IL -6.0 Y +62612 IL -6.0 Y +62613 IL -6.0 Y +62615 IL -6.0 Y +62617 IL -6.0 Y +62618 IL -6.0 Y +62621 IL -6.0 Y +62622 IL -6.0 Y +62624 IL -6.0 Y +62625 IL -6.0 Y +62626 IL -6.0 Y +62627 IL -6.0 Y +62628 IL -6.0 Y +62629 IL -6.0 Y +62630 IL -6.0 Y +62631 IL -6.0 Y +62633 IL -6.0 Y +62634 IL -6.0 Y +62635 IL -6.0 Y +62638 IL -6.0 Y +62639 IL -6.0 Y +62640 IL -6.0 Y +62642 IL -6.0 Y +62643 IL -6.0 Y +62644 IL -6.0 Y +62649 IL -6.0 Y +62650 IL -6.0 Y +62651 IL -6.0 Y +62655 IL -6.0 Y +62656 IL -6.0 Y +62659 IL -6.0 Y +62660 IL -6.0 Y +62661 IL -6.0 Y +62662 IL -6.0 Y +62663 IL -6.0 Y +62664 IL -6.0 Y +62665 IL -6.0 Y +62666 IL -6.0 Y +62667 IL -6.0 Y +62668 IL -6.0 Y +62670 IL -6.0 Y +62671 IL -6.0 Y +62672 IL -6.0 Y +62673 IL -6.0 Y +62674 IL -6.0 Y +62675 IL -6.0 Y +62677 IL -6.0 Y +62681 IL -6.0 Y +62682 IL -6.0 Y +62683 IL -6.0 Y +62684 IL -6.0 Y +62685 IL -6.0 Y +62688 IL -6.0 Y +62689 IL -6.0 Y +62690 IL -6.0 Y +62691 IL -6.0 Y +62692 IL -6.0 Y +62693 IL -6.0 Y +62694 IL -6.0 Y +62695 IL -6.0 Y +62701 IL -6.0 Y +62702 IL -6.0 Y +62703 IL -6.0 Y +62704 IL -6.0 Y +62705 IL -6.0 Y +62706 IL -6.0 Y +62707 IL -6.0 Y +62708 IL -6.0 Y +62711 IL -6.0 Y +62712 IL -6.0 Y +62713 IL -6.0 Y +62715 IL -6.0 Y +62716 IL -6.0 Y +62719 IL -6.0 Y +62721 IL -6.0 Y +62722 IL -6.0 Y +62723 IL -6.0 Y +62726 IL -6.0 Y +62736 IL -6.0 Y +62739 IL -6.0 Y +62746 IL -6.0 Y +62756 IL -6.0 Y +62757 IL -6.0 Y +62761 IL -6.0 Y +62762 IL -6.0 Y +62763 IL -6.0 Y +62764 IL -6.0 Y +62765 IL -6.0 Y +62766 IL -6.0 Y +62767 IL -6.0 Y +62769 IL -6.0 Y +62776 IL -6.0 Y +62777 IL -6.0 Y +62781 IL -6.0 Y +62786 IL -6.0 Y +62791 IL -6.0 Y +62794 IL -6.0 Y +62796 IL -6.0 Y +62801 IL -6.0 Y +62803 IL -6.0 Y +62805 IL -6.0 Y +62806 IL -6.0 Y +62807 IL -6.0 Y +62808 IL -6.0 Y +62809 IL -6.0 Y +62810 IL -6.0 Y +62811 IL -6.0 Y +62812 IL -6.0 Y +62814 IL -6.0 Y +62815 IL -6.0 Y +62816 IL -6.0 Y +62817 IL -6.0 Y +62818 IL -6.0 Y +62819 IL -6.0 Y +62820 IL -6.0 Y +62821 IL -6.0 Y +62822 IL -6.0 Y +62823 IL -6.0 Y +62824 IL -6.0 Y +62825 IL -6.0 Y +62827 IL -6.0 Y +62828 IL -6.0 Y +62829 IL -6.0 Y +62830 IL -6.0 Y +62831 IL -6.0 Y +62832 IL -6.0 Y +62833 IL -6.0 Y +62834 IL -6.0 Y +62835 IL -6.0 Y +62836 IL -6.0 Y +62837 IL -6.0 Y +62838 IL -6.0 Y +62839 IL -6.0 Y +62840 IL -6.0 Y +62841 IL -6.0 Y +62842 IL -6.0 Y +62843 IL -6.0 Y +62844 IL -6.0 Y +62846 IL -6.0 Y +62848 IL -6.0 Y +62849 IL -6.0 Y +62850 IL -6.0 Y +62851 IL -6.0 Y +62852 IL -6.0 Y +62853 IL -6.0 Y +62854 IL -6.0 Y +62855 IL -6.0 Y +62856 IL -6.0 Y +62857 IL -6.0 Y +62858 IL -6.0 Y +62859 IL -6.0 Y +62860 IL -6.0 Y +62861 IL -6.0 Y +62862 IL -6.0 Y +62863 IL -6.0 Y +62864 IL -6.0 Y +62865 IL -6.0 Y +62866 IL -6.0 Y +62867 IL -6.0 Y +62868 IL -6.0 Y +62869 IL -6.0 Y +62870 IL -6.0 Y +62871 IL -6.0 Y +62872 IL -6.0 Y +62874 IL -6.0 Y +62875 IL -6.0 Y +62876 IL -6.0 Y +62877 IL -6.0 Y +62878 IL -6.0 Y +62879 IL -6.0 Y +62880 IL -6.0 Y +62881 IL -6.0 Y +62882 IL -6.0 Y +62883 IL -6.0 Y +62884 IL -6.0 Y +62885 IL -6.0 Y +62886 IL -6.0 Y +62887 IL -6.0 Y +62888 IL -6.0 Y +62889 IL -6.0 Y +62890 IL -6.0 Y +62891 IL -6.0 Y +62892 IL -6.0 Y +62893 IL -6.0 Y +62894 IL -6.0 Y +62895 IL -6.0 Y +62896 IL -6.0 Y +62897 IL -6.0 Y +62898 IL -6.0 Y +62899 IL -6.0 Y +62901 IL -6.0 Y +62902 IL -6.0 Y +62903 IL -6.0 Y +62905 IL -6.0 Y +62906 IL -6.0 Y +62907 IL -6.0 Y +62908 IL -6.0 Y +62909 IL -6.0 Y +62910 IL -6.0 Y +62912 IL -6.0 Y +62914 IL -6.0 Y +62915 IL -6.0 Y +62916 IL -6.0 Y +62917 IL -6.0 Y +62918 IL -6.0 Y +62919 IL -6.0 Y +62920 IL -6.0 Y +62921 IL -6.0 Y +62922 IL -6.0 Y +62923 IL -6.0 Y +62924 IL -6.0 Y +62926 IL -6.0 Y +62927 IL -6.0 Y +62928 IL -6.0 Y +62930 IL -6.0 Y +62931 IL -6.0 Y +62932 IL -6.0 Y +62933 IL -6.0 Y +62934 IL -6.0 Y +62935 IL -6.0 Y +62938 IL -6.0 Y +62939 IL -6.0 Y +62940 IL -6.0 Y +62941 IL -6.0 Y +62942 IL -6.0 Y +62943 IL -6.0 Y +62946 IL -6.0 Y +62947 IL -6.0 Y +62948 IL -6.0 Y +62949 IL -6.0 Y +62950 IL -6.0 Y +62951 IL -6.0 Y +62952 IL -6.0 Y +62953 IL -6.0 Y +62954 IL -6.0 Y +62955 IL -6.0 Y +62956 IL -6.0 Y +62957 IL -6.0 Y +62958 IL -6.0 Y +62959 IL -6.0 Y +62960 IL -6.0 Y +62961 IL -6.0 Y +62962 IL -6.0 Y +62963 IL -6.0 Y +62964 IL -6.0 Y +62965 IL -6.0 Y +62966 IL -6.0 Y +62967 IL -6.0 Y +62969 IL -6.0 Y +62970 IL -6.0 Y +62971 IL -6.0 Y +62972 IL -6.0 Y +62973 IL -6.0 Y +62974 IL -6.0 Y +62975 IL -6.0 Y +62976 IL -6.0 Y +62977 IL -6.0 Y +62979 IL -6.0 Y +62982 IL -6.0 Y +62983 IL -6.0 Y +62984 IL -6.0 Y +62985 IL -6.0 Y +62987 IL -6.0 Y +62988 IL -6.0 Y +62990 IL -6.0 Y +62992 IL -6.0 Y +62993 IL -6.0 Y +62994 IL -6.0 Y +62995 IL -6.0 Y +62996 IL -6.0 Y +62997 IL -6.0 Y +62998 IL -6.0 Y +62999 IL -6.0 Y +63001 MO -6.0 Y +63005 MO -6.0 Y +63006 MO -6.0 Y +63010 MO -6.0 Y +63011 MO -6.0 Y +63012 MO -6.0 Y +63013 MO -6.0 Y +63014 MO -6.0 Y +63015 MO -6.0 Y +63016 MO -6.0 Y +63017 MO -6.0 Y +63019 MO -6.0 Y +63020 MO -6.0 Y +63021 MO -6.0 Y +63022 MO -6.0 Y +63023 MO -6.0 Y +63024 MO -6.0 Y +63025 MO -6.0 Y +63026 MO -6.0 Y +63028 MO -6.0 Y +63030 MO -6.0 Y +63031 MO -6.0 Y +63032 MO -6.0 Y +63033 MO -6.0 Y +63034 MO -6.0 Y +63036 MO -6.0 Y +63037 MO -6.0 Y +63038 MO -6.0 Y +63039 MO -6.0 Y +63040 MO -6.0 Y +63041 MO -6.0 Y +63042 MO -6.0 Y +63043 MO -6.0 Y +63044 MO -6.0 Y +63045 MO -6.0 Y +63047 MO -6.0 Y +63048 MO -6.0 Y +63049 MO -6.0 Y +63050 MO -6.0 Y +63051 MO -6.0 Y +63052 MO -6.0 Y +63053 MO -6.0 Y +63055 MO -6.0 Y +63056 MO -6.0 Y +63057 MO -6.0 Y +63060 MO -6.0 Y +63061 MO -6.0 Y +63065 MO -6.0 Y +63066 MO -6.0 Y +63068 MO -6.0 Y +63069 MO -6.0 Y +63070 MO -6.0 Y +63071 MO -6.0 Y +63072 MO -6.0 Y +63073 MO -6.0 Y +63074 MO -6.0 Y +63077 MO -6.0 Y +63079 MO -6.0 Y +63080 MO -6.0 Y +63084 MO -6.0 Y +63087 MO -6.0 Y +63088 MO -6.0 Y +63089 MO -6.0 Y +63090 MO -6.0 Y +63091 MO -6.0 Y +63099 MO -6.0 Y +63101 MO -6.0 Y +63102 MO -6.0 Y +63103 MO -6.0 Y +63104 MO -6.0 Y +63105 MO -6.0 Y +63106 MO -6.0 Y +63107 MO -6.0 Y +63108 MO -6.0 Y +63109 MO -6.0 Y +63110 MO -6.0 Y +63111 MO -6.0 Y +63112 MO -6.0 Y +63113 MO -6.0 Y +63114 MO -6.0 Y +63115 MO -6.0 Y +63116 MO -6.0 Y +63117 MO -6.0 Y +63118 MO -6.0 Y +63119 MO -6.0 Y +63120 MO -6.0 Y +63121 MO -6.0 Y +63122 MO -6.0 Y +63123 MO -6.0 Y +63124 MO -6.0 Y +63125 MO -6.0 Y +63126 MO -6.0 Y +63127 MO -6.0 Y +63128 MO -6.0 Y +63129 MO -6.0 Y +63130 MO -6.0 Y +63131 MO -6.0 Y +63132 MO -6.0 Y +63133 MO -6.0 Y +63134 MO -6.0 Y +63135 MO -6.0 Y +63136 MO -6.0 Y +63137 MO -6.0 Y +63138 MO -6.0 Y +63139 MO -6.0 Y +63140 MO -6.0 Y +63141 MO -6.0 Y +63143 MO -6.0 Y +63144 MO -6.0 Y +63145 MO -6.0 Y +63146 MO -6.0 Y +63147 MO -6.0 Y +63150 MO -6.0 Y +63151 MO -6.0 Y +63155 MO -6.0 Y +63156 MO -6.0 Y +63157 MO -6.0 Y +63158 MO -6.0 Y +63160 MO -6.0 Y +63163 MO -6.0 Y +63164 MO -6.0 Y +63166 MO -6.0 Y +63167 MO -6.0 Y +63169 MO -6.0 Y +63171 MO -6.0 Y +63177 MO -6.0 Y +63178 MO -6.0 Y +63179 MO -6.0 Y +63180 MO -6.0 Y +63182 MO -6.0 Y +63188 MO -6.0 Y +63190 MO -6.0 Y +63195 MO -6.0 Y +63196 MO -6.0 Y +63197 MO -6.0 Y +63198 MO -6.0 Y +63199 MO -6.0 Y +63301 MO -6.0 Y +63302 MO -6.0 Y +63303 MO -6.0 Y +63304 MO -6.0 Y +63330 MO -6.0 Y +63332 MO -6.0 Y +63333 MO -6.0 Y +63334 MO -6.0 Y +63336 MO -6.0 Y +63338 MO -6.0 Y +63339 MO -6.0 Y +63341 MO -6.0 Y +63342 MO -6.0 Y +63343 MO -6.0 Y +63344 MO -6.0 Y +63345 MO -6.0 Y +63346 MO -6.0 Y +63347 MO -6.0 Y +63348 MO -6.0 Y +63349 MO -6.0 Y +63350 MO -6.0 Y +63351 MO -6.0 Y +63352 MO -6.0 Y +63353 MO -6.0 Y +63357 MO -6.0 Y +63359 MO -6.0 Y +63361 MO -6.0 Y +63362 MO -6.0 Y +63363 MO -6.0 Y +63365 MO -6.0 Y +63366 MO -6.0 Y +63367 MO -6.0 Y +63368 MO -6.0 Y +63369 MO -6.0 Y +63370 MO -6.0 Y +63373 MO -6.0 Y +63376 MO -6.0 Y +63377 MO -6.0 Y +63378 MO -6.0 Y +63379 MO -6.0 Y +63381 MO -6.0 Y +63382 MO -6.0 Y +63383 MO -6.0 Y +63384 MO -6.0 Y +63385 MO -6.0 Y +63386 MO -6.0 Y +63387 MO -6.0 Y +63388 MO -6.0 Y +63389 MO -6.0 Y +63390 MO -6.0 Y +63401 MO -6.0 Y +63430 MO -6.0 Y +63431 MO -6.0 Y +63432 MO -6.0 Y +63433 MO -6.0 Y +63434 MO -6.0 Y +63435 MO -6.0 Y +63436 MO -6.0 Y +63437 MO -6.0 Y +63438 MO -6.0 Y +63439 MO -6.0 Y +63440 MO -6.0 Y +63441 MO -6.0 Y +63442 MO -6.0 Y +63443 MO -6.0 Y +63445 MO -6.0 Y +63446 MO -6.0 Y +63447 MO -6.0 Y +63448 MO -6.0 Y +63450 MO -6.0 Y +63451 MO -6.0 Y +63452 MO -6.0 Y +63453 MO -6.0 Y +63454 MO -6.0 Y +63456 MO -6.0 Y +63457 MO -6.0 Y +63458 MO -6.0 Y +63459 MO -6.0 Y +63460 MO -6.0 Y +63461 MO -6.0 Y +63462 MO -6.0 Y +63463 MO -6.0 Y +63464 MO -6.0 Y +63465 MO -6.0 Y +63466 MO -6.0 Y +63467 MO -6.0 Y +63468 MO -6.0 Y +63469 MO -6.0 Y +63471 MO -6.0 Y +63472 MO -6.0 Y +63473 MO -6.0 Y +63474 MO -6.0 Y +63501 MO -6.0 Y +63530 MO -6.0 Y +63531 MO -6.0 Y +63532 MO -6.0 Y +63533 MO -6.0 Y +63534 MO -6.0 Y +63535 MO -6.0 Y +63536 MO -6.0 Y +63537 MO -6.0 Y +63538 MO -6.0 Y +63539 MO -6.0 Y +63540 MO -6.0 Y +63541 MO -6.0 Y +63543 MO -6.0 Y +63544 MO -6.0 Y +63545 MO -6.0 Y +63546 MO -6.0 Y +63547 MO -6.0 Y +63548 MO -6.0 Y +63549 MO -6.0 Y +63551 MO -6.0 Y +63552 MO -6.0 Y +63555 MO -6.0 Y +63556 MO -6.0 Y +63557 MO -6.0 Y +63558 MO -6.0 Y +63559 MO -6.0 Y +63560 MO -6.0 Y +63561 MO -6.0 Y +63563 MO -6.0 Y +63565 MO -6.0 Y +63566 MO -6.0 Y +63567 MO -6.0 Y +63601 MO -6.0 Y +63620 MO -6.0 Y +63621 MO -6.0 Y +63622 MO -6.0 Y +63623 MO -6.0 Y +63624 MO -6.0 Y +63625 MO -6.0 Y +63626 MO -6.0 Y +63627 MO -6.0 Y +63628 MO -6.0 Y +63629 MO -6.0 Y +63630 MO -6.0 Y +63631 MO -6.0 Y +63632 MO -6.0 Y +63633 MO -6.0 Y +63636 MO -6.0 Y +63637 MO -6.0 Y +63638 MO -6.0 Y +63640 MO -6.0 Y +63645 MO -6.0 Y +63648 MO -6.0 Y +63650 MO -6.0 Y +63651 MO -6.0 Y +63653 MO -6.0 Y +63654 MO -6.0 Y +63655 MO -6.0 Y +63656 MO -6.0 Y +63660 MO -6.0 Y +63662 MO -6.0 Y +63663 MO -6.0 Y +63664 MO -6.0 Y +63665 MO -6.0 Y +63666 MO -6.0 Y +63670 MO -6.0 Y +63673 MO -6.0 Y +63674 MO -6.0 Y +63675 MO -6.0 Y +63701 MO -6.0 Y +63702 MO -6.0 Y +63703 MO -6.0 Y +63730 MO -6.0 Y +63732 MO -6.0 Y +63735 MO -6.0 Y +63736 MO -6.0 Y +63737 MO -6.0 Y +63738 MO -6.0 Y +63739 MO -6.0 Y +63740 MO -6.0 Y +63742 MO -6.0 Y +63743 MO -6.0 Y +63744 MO -6.0 Y +63745 MO -6.0 Y +63746 MO -6.0 Y +63747 MO -6.0 Y +63748 MO -6.0 Y +63750 MO -6.0 Y +63751 MO -6.0 Y +63752 MO -6.0 Y +63755 MO -6.0 Y +63758 MO -6.0 Y +63760 MO -6.0 Y +63763 MO -6.0 Y +63764 MO -6.0 Y +63766 MO -6.0 Y +63767 MO -6.0 Y +63769 MO -6.0 Y +63770 MO -6.0 Y +63771 MO -6.0 Y +63774 MO -6.0 Y +63775 MO -6.0 Y +63776 MO -6.0 Y +63779 MO -6.0 Y +63780 MO -6.0 Y +63781 MO -6.0 Y +63782 MO -6.0 Y +63783 MO -6.0 Y +63784 MO -6.0 Y +63785 MO -6.0 Y +63787 MO -6.0 Y +63801 MO -6.0 Y +63820 MO -6.0 Y +63821 MO -6.0 Y +63822 MO -6.0 Y +63823 MO -6.0 Y +63824 MO -6.0 Y +63825 MO -6.0 Y +63826 MO -6.0 Y +63827 MO -6.0 Y +63828 MO -6.0 Y +63829 MO -6.0 Y +63830 MO -6.0 Y +63833 MO -6.0 Y +63834 MO -6.0 Y +63837 MO -6.0 Y +63839 MO -6.0 Y +63840 MO -6.0 Y +63841 MO -6.0 Y +63845 MO -6.0 Y +63846 MO -6.0 Y +63847 MO -6.0 Y +63848 MO -6.0 Y +63849 MO -6.0 Y +63850 MO -6.0 Y +63851 MO -6.0 Y +63852 MO -6.0 Y +63853 MO -6.0 Y +63855 MO -6.0 Y +63857 MO -6.0 Y +63860 MO -6.0 Y +63862 MO -6.0 Y +63863 MO -6.0 Y +63866 MO -6.0 Y +63867 MO -6.0 Y +63868 MO -6.0 Y +63869 MO -6.0 Y +63870 MO -6.0 Y +63873 MO -6.0 Y +63874 MO -6.0 Y +63875 MO -6.0 Y +63876 MO -6.0 Y +63877 MO -6.0 Y +63878 MO -6.0 Y +63879 MO -6.0 Y +63880 MO -6.0 Y +63881 MO -6.0 Y +63882 MO -6.0 Y +63901 MO -6.0 Y +63902 MO -6.0 Y +63931 MO -6.0 Y +63932 MO -6.0 Y +63933 MO -6.0 Y +63934 MO -6.0 Y +63935 MO -6.0 Y +63936 MO -6.0 Y +63937 MO -6.0 Y +63938 MO -6.0 Y +63939 MO -6.0 Y +63940 MO -6.0 Y +63941 MO -6.0 Y +63942 MO -6.0 Y +63943 MO -6.0 Y +63944 MO -6.0 Y +63945 MO -6.0 Y +63950 MO -6.0 Y +63951 MO -6.0 Y +63952 MO -6.0 Y +63953 MO -6.0 Y +63954 MO -6.0 Y +63955 MO -6.0 Y +63956 MO -6.0 Y +63957 MO -6.0 Y +63960 MO -6.0 Y +63961 MO -6.0 Y +63962 MO -6.0 Y +63963 MO -6.0 Y +63964 MO -6.0 Y +63965 MO -6.0 Y +63966 MO -6.0 Y +63967 MO -6.0 Y +64001 MO -6.0 Y +64011 MO -6.0 Y +64012 MO -6.0 Y +64013 MO -6.0 Y +64014 MO -6.0 Y +64015 MO -6.0 Y +64016 MO -6.0 Y +64017 MO -6.0 Y +64018 MO -6.0 Y +64019 MO -6.0 Y +64020 MO -6.0 Y +64021 MO -6.0 Y +64022 MO -6.0 Y +64024 MO -6.0 Y +64028 MO -6.0 Y +64029 MO -6.0 Y +64030 MO -6.0 Y +64034 MO -6.0 Y +64035 MO -6.0 Y +64036 MO -6.0 Y +64037 MO -6.0 Y +64040 MO -6.0 Y +64048 MO -6.0 Y +64050 MO -6.0 Y +64051 MO -6.0 Y +64052 MO -6.0 Y +64053 MO -6.0 Y +64054 MO -6.0 Y +64055 MO -6.0 Y +64056 MO -6.0 Y +64057 MO -6.0 Y +64058 MO -6.0 Y +64060 MO -6.0 Y +64061 MO -6.0 Y +64062 MO -6.0 Y +64063 MO -6.0 Y +64064 MO -6.0 Y +64065 MO -6.0 Y +64066 MO -6.0 Y +64067 MO -6.0 Y +64068 MO -6.0 Y +64069 MO -6.0 Y +64070 MO -6.0 Y +64071 MO -6.0 Y +64072 MO -6.0 Y +64073 MO -6.0 Y +64074 MO -6.0 Y +64075 MO -6.0 Y +64076 MO -6.0 Y +64077 MO -6.0 Y +64078 MO -6.0 Y +64079 MO -6.0 Y +64080 MO -6.0 Y +64081 MO -6.0 Y +64082 MO -6.0 Y +64083 MO -6.0 Y +64084 MO -6.0 Y +64085 MO -6.0 Y +64086 MO -6.0 Y +64088 MO -6.0 Y +64089 MO -6.0 Y +64090 MO -6.0 Y +64092 MO -6.0 Y +64093 MO -6.0 Y +64096 MO -6.0 Y +64097 MO -6.0 Y +64098 MO -6.0 Y +64101 MO -6.0 Y +64102 MO -6.0 Y +64105 MO -6.0 Y +64106 MO -6.0 Y +64108 MO -6.0 Y +64109 MO -6.0 Y +64110 MO -6.0 Y +64111 MO -6.0 Y +64112 MO -6.0 Y +64113 MO -6.0 Y +64114 MO -6.0 Y +64116 MO -6.0 Y +64117 MO -6.0 Y +64118 MO -6.0 Y +64119 MO -6.0 Y +64120 MO -6.0 Y +64121 MO -6.0 Y +64123 MO -6.0 Y +64124 MO -6.0 Y +64125 MO -6.0 Y +64126 MO -6.0 Y +64127 MO -6.0 Y +64128 MO -6.0 Y +64129 MO -6.0 Y +64130 MO -6.0 Y +64131 MO -6.0 Y +64132 MO -6.0 Y +64133 MO -6.0 Y +64134 MO -6.0 Y +64136 MO -6.0 Y +64137 MO -6.0 Y +64138 MO -6.0 Y +64139 MO -6.0 Y +64141 MO -6.0 Y +64144 MO -6.0 Y +64145 MO -6.0 Y +64146 MO -6.0 Y +64147 MO -6.0 Y +64148 MO -6.0 Y +64149 MO -6.0 Y +64150 MO -6.0 Y +64151 MO -6.0 Y +64152 MO -6.0 Y +64153 MO -6.0 Y +64154 MO -6.0 Y +64155 MO -6.0 Y +64156 MO -6.0 Y +64157 MO -6.0 Y +64158 MO -6.0 Y +64161 MO -6.0 Y +64163 MO -6.0 Y +64164 MO -6.0 Y +64165 MO -6.0 Y +64166 MO -6.0 Y +64167 MO -6.0 Y +64168 MO -6.0 Y +64170 MO -6.0 Y +64171 MO -6.0 Y +64172 MO -6.0 Y +64179 MO -6.0 Y +64180 MO -6.0 Y +64183 MO -6.0 Y +64184 MO -6.0 Y +64185 MO -6.0 Y +64187 MO -6.0 Y +64188 MO -6.0 Y +64190 MO -6.0 Y +64191 MO -6.0 Y +64192 MO -6.0 Y +64193 MO -6.0 Y +64194 MO -6.0 Y +64195 MO -6.0 Y +64196 MO -6.0 Y +64197 MO -6.0 Y +64198 MO -6.0 Y +64199 MO -6.0 Y +64401 MO -6.0 Y +64402 MO -6.0 Y +64420 MO -6.0 Y +64421 MO -6.0 Y +64422 MO -6.0 Y +64423 MO -6.0 Y +64424 MO -6.0 Y +64426 MO -6.0 Y +64427 MO -6.0 Y +64428 MO -6.0 Y +64429 MO -6.0 Y +64430 MO -6.0 Y +64431 MO -6.0 Y +64432 MO -6.0 Y +64433 MO -6.0 Y +64434 MO -6.0 Y +64436 MO -6.0 Y +64437 MO -6.0 Y +64438 MO -6.0 Y +64439 MO -6.0 Y +64440 MO -6.0 Y +64441 MO -6.0 Y +64442 MO -6.0 Y +64443 MO -6.0 Y +64444 MO -6.0 Y +64445 MO -6.0 Y +64446 MO -6.0 Y +64447 MO -6.0 Y +64448 MO -6.0 Y +64449 MO -6.0 Y +64451 MO -6.0 Y +64453 MO -6.0 Y +64454 MO -6.0 Y +64455 MO -6.0 Y +64456 MO -6.0 Y +64457 MO -6.0 Y +64458 MO -6.0 Y +64459 MO -6.0 Y +64461 MO -6.0 Y +64463 MO -6.0 Y +64465 MO -6.0 Y +64466 MO -6.0 Y +64467 MO -6.0 Y +64468 MO -6.0 Y +64469 MO -6.0 Y +64470 MO -6.0 Y +64471 MO -6.0 Y +64473 MO -6.0 Y +64474 MO -6.0 Y +64475 MO -6.0 Y +64476 MO -6.0 Y +64477 MO -6.0 Y +64479 MO -6.0 Y +64480 MO -6.0 Y +64481 MO -6.0 Y +64482 MO -6.0 Y +64483 MO -6.0 Y +64484 MO -6.0 Y +64485 MO -6.0 Y +64486 MO -6.0 Y +64487 MO -6.0 Y +64489 MO -6.0 Y +64490 MO -6.0 Y +64491 MO -6.0 Y +64492 MO -6.0 Y +64493 MO -6.0 Y +64494 MO -6.0 Y +64496 MO -6.0 Y +64497 MO -6.0 Y +64498 MO -6.0 Y +64499 MO -6.0 Y +64501 MO -6.0 Y +64502 MO -6.0 Y +64503 MO -6.0 Y +64504 MO -6.0 Y +64505 MO -6.0 Y +64506 MO -6.0 Y +64507 MO -6.0 Y +64508 MO -6.0 Y +64601 MO -6.0 Y +64620 MO -6.0 Y +64622 MO -6.0 Y +64623 MO -6.0 Y +64624 MO -6.0 Y +64625 MO -6.0 Y +64628 MO -6.0 Y +64630 MO -6.0 Y +64631 MO -6.0 Y +64632 MO -6.0 Y +64633 MO -6.0 Y +64635 MO -6.0 Y +64636 MO -6.0 Y +64637 MO -6.0 Y +64638 MO -6.0 Y +64639 MO -6.0 Y +64640 MO -6.0 Y +64641 MO -6.0 Y +64642 MO -6.0 Y +64643 MO -6.0 Y +64644 MO -6.0 Y +64645 MO -6.0 Y +64646 MO -6.0 Y +64647 MO -6.0 Y +64648 MO -6.0 Y +64649 MO -6.0 Y +64650 MO -6.0 Y +64651 MO -6.0 Y +64652 MO -6.0 Y +64653 MO -6.0 Y +64654 MO -6.0 Y +64655 MO -6.0 Y +64656 MO -6.0 Y +64657 MO -6.0 Y +64658 MO -6.0 Y +64659 MO -6.0 Y +64660 MO -6.0 Y +64661 MO -6.0 Y +64664 MO -6.0 Y +64667 MO -6.0 Y +64668 MO -6.0 Y +64670 MO -6.0 Y +64671 MO -6.0 Y +64672 MO -6.0 Y +64673 MO -6.0 Y +64674 MO -6.0 Y +64676 MO -6.0 Y +64679 MO -6.0 Y +64680 MO -6.0 Y +64681 MO -6.0 Y +64682 MO -6.0 Y +64683 MO -6.0 Y +64686 MO -6.0 Y +64688 MO -6.0 Y +64689 MO -6.0 Y +64701 MO -6.0 Y +64720 MO -6.0 Y +64722 MO -6.0 Y +64723 MO -6.0 Y +64724 MO -6.0 Y +64725 MO -6.0 Y +64726 MO -6.0 Y +64728 MO -6.0 Y +64730 MO -6.0 Y +64733 MO -6.0 Y +64734 MO -6.0 Y +64735 MO -6.0 Y +64738 MO -6.0 Y +64739 MO -6.0 Y +64740 MO -6.0 Y +64741 MO -6.0 Y +64742 MO -6.0 Y +64743 MO -6.0 Y +64744 MO -6.0 Y +64745 MO -6.0 Y +64746 MO -6.0 Y +64747 MO -6.0 Y +64748 MO -6.0 Y +64750 MO -6.0 Y +64752 MO -6.0 Y +64755 MO -6.0 Y +64756 MO -6.0 Y +64759 MO -6.0 Y +64761 MO -6.0 Y +64762 MO -6.0 Y +64763 MO -6.0 Y +64765 MO -6.0 Y +64766 MO -6.0 Y +64767 MO -6.0 Y +64769 MO -6.0 Y +64770 MO -6.0 Y +64771 MO -6.0 Y +64772 MO -6.0 Y +64776 MO -6.0 Y +64778 MO -6.0 Y +64779 MO -6.0 Y +64780 MO -6.0 Y +64781 MO -6.0 Y +64783 MO -6.0 Y +64784 MO -6.0 Y +64788 MO -6.0 Y +64789 MO -6.0 Y +64790 MO -6.0 Y +64801 MO -6.0 Y +64802 MO -6.0 Y +64803 MO -6.0 Y +64804 MO -6.0 Y +64830 MO -6.0 Y +64831 MO -6.0 Y +64832 MO -6.0 Y +64833 MO -6.0 Y +64834 MO -6.0 Y +64835 MO -6.0 Y +64836 MO -6.0 Y +64840 MO -6.0 Y +64841 MO -6.0 Y +64842 MO -6.0 Y +64843 MO -6.0 Y +64844 MO -6.0 Y +64847 MO -6.0 Y +64848 MO -6.0 Y +64849 MO -6.0 Y +64850 MO -6.0 Y +64853 MO -6.0 Y +64854 MO -6.0 Y +64855 MO -6.0 Y +64856 MO -6.0 Y +64857 MO -6.0 Y +64858 MO -6.0 Y +64859 MO -6.0 Y +64861 MO -6.0 Y +64862 MO -6.0 Y +64863 MO -6.0 Y +64864 MO -6.0 Y +64865 MO -6.0 Y +64866 MO -6.0 Y +64867 MO -6.0 Y +64868 MO -6.0 Y +64869 MO -6.0 Y +64870 MO -6.0 Y +64873 MO -6.0 Y +64874 MO -6.0 Y +64944 MO -6.0 Y +64999 MO -6.0 Y +65001 MO -6.0 Y +65010 MO -6.0 Y +65011 MO -6.0 Y +65013 MO -6.0 Y +65014 MO -6.0 Y +65016 MO -6.0 Y +65017 MO -6.0 Y +65018 MO -6.0 Y +65020 MO -6.0 Y +65023 MO -6.0 Y +65024 MO -6.0 Y +65025 MO -6.0 Y +65026 MO -6.0 Y +65032 MO -6.0 Y +65034 MO -6.0 Y +65035 MO -6.0 Y +65036 MO -6.0 Y +65037 MO -6.0 Y +65038 MO -6.0 Y +65039 MO -6.0 Y +65040 MO -6.0 Y +65041 MO -6.0 Y +65042 MO -6.0 Y +65043 MO -6.0 Y +65046 MO -6.0 Y +65047 MO -6.0 Y +65048 MO -6.0 Y +65049 MO -6.0 Y +65050 MO -6.0 Y +65051 MO -6.0 Y +65052 MO -6.0 Y +65053 MO -6.0 Y +65054 MO -6.0 Y +65055 MO -6.0 Y +65058 MO -6.0 Y +65059 MO -6.0 Y +65061 MO -6.0 Y +65062 MO -6.0 Y +65063 MO -6.0 Y +65064 MO -6.0 Y +65065 MO -6.0 Y +65066 MO -6.0 Y +65067 MO -6.0 Y +65068 MO -6.0 Y +65069 MO -6.0 Y +65072 MO -6.0 Y +65074 MO -6.0 Y +65075 MO -6.0 Y +65076 MO -6.0 Y +65077 MO -6.0 Y +65078 MO -6.0 Y +65079 MO -6.0 Y +65080 MO -6.0 Y +65081 MO -6.0 Y +65082 MO -6.0 Y +65083 MO -6.0 Y +65084 MO -6.0 Y +65085 MO -6.0 Y +65101 MO -6.0 Y +65102 MO -6.0 Y +65103 MO -6.0 Y +65104 MO -6.0 Y +65105 MO -6.0 Y +65106 MO -6.0 Y +65107 MO -6.0 Y +65108 MO -6.0 Y +65109 MO -6.0 Y +65110 MO -6.0 Y +65111 MO -6.0 Y +65201 MO -6.0 Y +65202 MO -6.0 Y +65203 MO -6.0 Y +65205 MO -6.0 Y +65211 MO -6.0 Y +65212 MO -6.0 Y +65215 MO -6.0 Y +65216 MO -6.0 Y +65217 MO -6.0 Y +65218 MO -6.0 Y +65230 MO -6.0 Y +65231 MO -6.0 Y +65232 MO -6.0 Y +65233 MO -6.0 Y +65236 MO -6.0 Y +65237 MO -6.0 Y +65239 MO -6.0 Y +65240 MO -6.0 Y +65243 MO -6.0 Y +65244 MO -6.0 Y +65246 MO -6.0 Y +65247 MO -6.0 Y +65248 MO -6.0 Y +65250 MO -6.0 Y +65251 MO -6.0 Y +65254 MO -6.0 Y +65255 MO -6.0 Y +65256 MO -6.0 Y +65257 MO -6.0 Y +65258 MO -6.0 Y +65259 MO -6.0 Y +65260 MO -6.0 Y +65261 MO -6.0 Y +65262 MO -6.0 Y +65263 MO -6.0 Y +65264 MO -6.0 Y +65265 MO -6.0 Y +65270 MO -6.0 Y +65274 MO -6.0 Y +65275 MO -6.0 Y +65276 MO -6.0 Y +65278 MO -6.0 Y +65279 MO -6.0 Y +65280 MO -6.0 Y +65281 MO -6.0 Y +65282 MO -6.0 Y +65283 MO -6.0 Y +65284 MO -6.0 Y +65285 MO -6.0 Y +65286 MO -6.0 Y +65287 MO -6.0 Y +65299 MO -6.0 Y +65301 MO -6.0 Y +65302 MO -6.0 Y +65305 MO -6.0 Y +65320 MO -6.0 Y +65321 MO -6.0 Y +65322 MO -6.0 Y +65323 MO -6.0 Y +65324 MO -6.0 Y +65325 MO -6.0 Y +65326 MO -6.0 Y +65327 MO -6.0 Y +65329 MO -6.0 Y +65330 MO -6.0 Y +65332 MO -6.0 Y +65333 MO -6.0 Y +65334 MO -6.0 Y +65335 MO -6.0 Y +65336 MO -6.0 Y +65337 MO -6.0 Y +65338 MO -6.0 Y +65339 MO -6.0 Y +65340 MO -6.0 Y +65344 MO -6.0 Y +65345 MO -6.0 Y +65347 MO -6.0 Y +65348 MO -6.0 Y +65349 MO -6.0 Y +65350 MO -6.0 Y +65351 MO -6.0 Y +65354 MO -6.0 Y +65355 MO -6.0 Y +65360 MO -6.0 Y +65401 MO -6.0 Y +65402 MO -6.0 Y +65409 MO -6.0 Y +65436 MO -6.0 Y +65438 MO -6.0 Y +65439 MO -6.0 Y +65440 MO -6.0 Y +65441 MO -6.0 Y +65443 MO -6.0 Y +65444 MO -6.0 Y +65446 MO -6.0 Y +65449 MO -6.0 Y +65452 MO -6.0 Y +65453 MO -6.0 Y +65456 MO -6.0 Y +65457 MO -6.0 Y +65459 MO -6.0 Y +65461 MO -6.0 Y +65462 MO -6.0 Y +65463 MO -6.0 Y +65464 MO -6.0 Y +65466 MO -6.0 Y +65468 MO -6.0 Y +65470 MO -6.0 Y +65473 MO -6.0 Y +65479 MO -6.0 Y +65483 MO -6.0 Y +65484 MO -6.0 Y +65486 MO -6.0 Y +65501 MO -6.0 Y +65529 MO -6.0 Y +65532 MO -6.0 Y +65534 MO -6.0 Y +65535 MO -6.0 Y +65536 MO -6.0 Y +65541 MO -6.0 Y +65542 MO -6.0 Y +65543 MO -6.0 Y +65546 MO -6.0 Y +65548 MO -6.0 Y +65550 MO -6.0 Y +65552 MO -6.0 Y +65555 MO -6.0 Y +65556 MO -6.0 Y +65557 MO -6.0 Y +65559 MO -6.0 Y +65560 MO -6.0 Y +65564 MO -6.0 Y +65565 MO -6.0 Y +65566 MO -6.0 Y +65567 MO -6.0 Y +65570 MO -6.0 Y +65571 MO -6.0 Y +65580 MO -6.0 Y +65582 MO -6.0 Y +65583 MO -6.0 Y +65584 MO -6.0 Y +65586 MO -6.0 Y +65588 MO -6.0 Y +65589 MO -6.0 Y +65590 MO -6.0 Y +65591 MO -6.0 Y +65601 MO -6.0 Y +65603 MO -6.0 Y +65604 MO -6.0 Y +65605 MO -6.0 Y +65606 MO -6.0 Y +65607 MO -6.0 Y +65608 MO -6.0 Y +65609 MO -6.0 Y +65610 MO -6.0 Y +65611 MO -6.0 Y +65612 MO -6.0 Y +65613 MO -6.0 Y +65614 MO -6.0 Y +65615 MO -6.0 Y +65616 MO -6.0 Y +65617 MO -6.0 Y +65618 MO -6.0 Y +65619 MO -6.0 Y +65620 MO -6.0 Y +65622 MO -6.0 Y +65623 MO -6.0 Y +65624 MO -6.0 Y +65625 MO -6.0 Y +65626 MO -6.0 Y +65627 MO -6.0 Y +65629 MO -6.0 Y +65630 MO -6.0 Y +65631 MO -6.0 Y +65632 MO -6.0 Y +65633 MO -6.0 Y +65634 MO -6.0 Y +65635 MO -6.0 Y +65636 MO -6.0 Y +65637 MO -6.0 Y +65638 MO -6.0 Y +65640 MO -6.0 Y +65641 MO -6.0 Y +65644 MO -6.0 Y +65645 MO -6.0 Y +65646 MO -6.0 Y +65647 MO -6.0 Y +65648 MO -6.0 Y +65649 MO -6.0 Y +65650 MO -6.0 Y +65652 MO -6.0 Y +65653 MO -6.0 Y +65654 MO -6.0 Y +65655 MO -6.0 Y +65656 MO -6.0 Y +65657 MO -6.0 Y +65658 MO -6.0 Y +65660 MO -6.0 Y +65661 MO -6.0 Y +65662 MO -6.0 Y +65663 MO -6.0 Y +65664 MO -6.0 Y +65666 MO -6.0 Y +65667 MO -6.0 Y +65668 MO -6.0 Y +65669 MO -6.0 Y +65672 MO -6.0 Y +65673 MO -6.0 Y +65674 MO -6.0 Y +65675 MO -6.0 Y +65676 MO -6.0 Y +65679 MO -6.0 Y +65680 MO -6.0 Y +65681 MO -6.0 Y +65682 MO -6.0 Y +65685 MO -6.0 Y +65686 MO -6.0 Y +65688 MO -6.0 Y +65689 MO -6.0 Y +65690 MO -6.0 Y +65692 MO -6.0 Y +65701 MO -6.0 Y +65702 MO -6.0 Y +65704 MO -6.0 Y +65705 MO -6.0 Y +65706 MO -6.0 Y +65707 MO -6.0 Y +65708 MO -6.0 Y +65710 MO -6.0 Y +65711 MO -6.0 Y +65712 MO -6.0 Y +65713 MO -6.0 Y +65714 MO -6.0 Y +65715 MO -6.0 Y +65717 MO -6.0 Y +65720 MO -6.0 Y +65721 MO -6.0 Y +65722 MO -6.0 Y +65723 MO -6.0 Y +65724 MO -6.0 Y +65725 MO -6.0 Y +65726 MO -6.0 Y +65727 MO -6.0 Y +65728 MO -6.0 Y +65729 MO -6.0 Y +65730 MO -6.0 Y +65731 MO -6.0 Y +65732 MO -6.0 Y +65733 MO -6.0 Y +65734 MO -6.0 Y +65735 MO -6.0 Y +65737 MO -6.0 Y +65738 MO -6.0 Y +65739 MO -6.0 Y +65740 MO -6.0 Y +65741 MO -6.0 Y +65742 MO -6.0 Y +65744 MO -6.0 Y +65745 MO -6.0 Y +65746 MO -6.0 Y +65747 MO -6.0 Y +65752 MO -6.0 Y +65753 MO -6.0 Y +65754 MO -6.0 Y +65755 MO -6.0 Y +65756 MO -6.0 Y +65757 MO -6.0 Y +65759 MO -6.0 Y +65760 MO -6.0 Y +65761 MO -6.0 Y +65762 MO -6.0 Y +65764 MO -6.0 Y +65765 MO -6.0 Y +65766 MO -6.0 Y +65767 MO -6.0 Y +65768 MO -6.0 Y +65769 MO -6.0 Y +65770 MO -6.0 Y +65771 MO -6.0 Y +65772 MO -6.0 Y +65773 MO -6.0 Y +65774 MO -6.0 Y +65775 MO -6.0 Y +65776 MO -6.0 Y +65777 MO -6.0 Y +65778 MO -6.0 Y +65779 MO -6.0 Y +65781 MO -6.0 Y +65783 MO -6.0 Y +65784 MO -6.0 Y +65785 MO -6.0 Y +65786 MO -6.0 Y +65787 MO -6.0 Y +65788 MO -6.0 Y +65789 MO -6.0 Y +65790 MO -6.0 Y +65791 MO -6.0 Y +65793 MO -6.0 Y +65801 MO -6.0 Y +65802 MO -6.0 Y +65803 MO -6.0 Y +65804 MO -6.0 Y +65805 MO -6.0 Y +65806 MO -6.0 Y +65807 MO -6.0 Y +65808 MO -6.0 Y +65809 MO -6.0 Y +65810 MO -6.0 Y +65814 MO -6.0 Y +65817 MO -6.0 Y +65890 MO -6.0 Y +65897 MO -6.0 Y +65898 MO -6.0 Y +65899 MO -6.0 Y +66002 KS -6.0 Y +66006 KS -6.0 Y +66007 KS -6.0 Y +66008 KS -6.0 Y +66010 KS -6.0 Y +66012 KS -6.0 Y +66013 KS -6.0 Y +66014 KS -6.0 Y +66015 KS -6.0 Y +66016 KS -6.0 Y +66017 KS -6.0 Y +66018 KS -6.0 Y +66019 KS -6.0 Y +66020 KS -6.0 Y +66021 KS -6.0 Y +66023 KS -6.0 Y +66024 KS -6.0 Y +66025 KS -6.0 Y +66026 KS -6.0 Y +66027 KS -6.0 Y +66030 KS -6.0 Y +66031 KS -6.0 Y +66032 KS -6.0 Y +66033 KS -6.0 Y +66035 KS -6.0 Y +66036 KS -6.0 Y +66039 KS -6.0 Y +66040 KS -6.0 Y +66041 KS -6.0 Y +66042 KS -6.0 Y +66043 KS -6.0 Y +66044 KS -6.0 Y +66045 KS -6.0 Y +66046 KS -6.0 Y +66047 KS -6.0 Y +66048 KS -6.0 Y +66049 KS -6.0 Y +66050 KS -6.0 Y +66051 KS -6.0 Y +66052 KS -6.0 Y +66053 KS -6.0 Y +66054 KS -6.0 Y +66056 KS -6.0 Y +66058 KS -6.0 Y +66060 KS -6.0 Y +66061 KS -6.0 Y +66062 KS -6.0 Y +66063 KS -6.0 Y +66064 KS -6.0 Y +66066 KS -6.0 Y +66067 KS -6.0 Y +66070 KS -6.0 Y +66071 KS -6.0 Y +66072 KS -6.0 Y +66073 KS -6.0 Y +66075 KS -6.0 Y +66076 KS -6.0 Y +66077 KS -6.0 Y +66078 KS -6.0 Y +66079 KS -6.0 Y +66080 KS -6.0 Y +66083 KS -6.0 Y +66085 KS -6.0 Y +66086 KS -6.0 Y +66087 KS -6.0 Y +66088 KS -6.0 Y +66090 KS -6.0 Y +66091 KS -6.0 Y +66092 KS -6.0 Y +66093 KS -6.0 Y +66094 KS -6.0 Y +66095 KS -6.0 Y +66097 KS -6.0 Y +66101 KS -6.0 Y +66102 KS -6.0 Y +66103 KS -6.0 Y +66104 KS -6.0 Y +66105 KS -6.0 Y +66106 KS -6.0 Y +66109 KS -6.0 Y +66110 KS -6.0 Y +66111 KS -6.0 Y +66112 KS -6.0 Y +66113 KS -6.0 Y +66115 KS -6.0 Y +66117 KS -6.0 Y +66118 KS -6.0 Y +66119 KS -6.0 Y +66160 KS -6.0 Y +66201 KS -6.0 Y +66202 KS -6.0 Y +66203 KS -6.0 Y +66204 KS -6.0 Y +66205 KS -6.0 Y +66206 KS -6.0 Y +66207 KS -6.0 Y +66208 KS -6.0 Y +66209 KS -6.0 Y +66210 KS -6.0 Y +66211 KS -6.0 Y +66212 KS -6.0 Y +66213 KS -6.0 Y +66214 KS -6.0 Y +66215 KS -6.0 Y +66216 KS -6.0 Y +66217 KS -6.0 Y +66218 KS -6.0 Y +66219 KS -6.0 Y +66220 KS -6.0 Y +66221 KS -6.0 Y +66222 KS -6.0 Y +66223 KS -6.0 Y +66224 KS -6.0 Y +66225 KS -6.0 Y +66226 KS -6.0 Y +66227 KS -6.0 Y +66250 KS -6.0 Y +66251 KS -6.0 Y +66276 KS -6.0 Y +66279 KS -6.0 Y +66282 KS -6.0 Y +66283 KS -6.0 Y +66285 KS -6.0 Y +66286 KS -6.0 Y +66401 KS -6.0 Y +66402 KS -6.0 Y +66403 KS -6.0 Y +66404 KS -6.0 Y +66406 KS -6.0 Y +66407 KS -6.0 Y +66408 KS -6.0 Y +66409 KS -6.0 Y +66411 KS -6.0 Y +66412 KS -6.0 Y +66413 KS -6.0 Y +66414 KS -6.0 Y +66415 KS -6.0 Y +66416 KS -6.0 Y +66417 KS -6.0 Y +66418 KS -6.0 Y +66419 KS -6.0 Y +66420 KS -6.0 Y +66422 KS -6.0 Y +66423 KS -6.0 Y +66424 KS -6.0 Y +66425 KS -6.0 Y +66426 KS -6.0 Y +66427 KS -6.0 Y +66428 KS -6.0 Y +66429 KS -6.0 Y +66431 KS -6.0 Y +66432 KS -6.0 Y +66434 KS -6.0 Y +66436 KS -6.0 Y +66438 KS -6.0 Y +66439 KS -6.0 Y +66440 KS -6.0 Y +66441 KS -6.0 Y +66442 KS -6.0 Y +66449 KS -6.0 Y +66451 KS -6.0 Y +66501 KS -6.0 Y +66502 KS -6.0 Y +66503 KS -6.0 Y +66505 KS -6.0 Y +66506 KS -6.0 Y +66507 KS -6.0 Y +66508 KS -6.0 Y +66509 KS -6.0 Y +66510 KS -6.0 Y +66512 KS -6.0 Y +66514 KS -6.0 Y +66515 KS -6.0 Y +66516 KS -6.0 Y +66517 KS -6.0 Y +66518 KS -6.0 Y +66520 KS -6.0 Y +66521 KS -6.0 Y +66522 KS -6.0 Y +66523 KS -6.0 Y +66524 KS -6.0 Y +66526 KS -6.0 Y +66527 KS -6.0 Y +66528 KS -6.0 Y +66531 KS -6.0 Y +66532 KS -6.0 Y +66533 KS -6.0 Y +66534 KS -6.0 Y +66535 KS -6.0 Y +66536 KS -6.0 Y +66537 KS -6.0 Y +66538 KS -6.0 Y +66539 KS -6.0 Y +66540 KS -6.0 Y +66541 KS -6.0 Y +66542 KS -6.0 Y +66543 KS -6.0 Y +66544 KS -6.0 Y +66546 KS -6.0 Y +66547 KS -6.0 Y +66548 KS -6.0 Y +66549 KS -6.0 Y +66550 KS -6.0 Y +66552 KS -6.0 Y +66554 KS -6.0 Y +66601 KS -6.0 Y +66603 KS -6.0 Y +66604 KS -6.0 Y +66605 KS -6.0 Y +66606 KS -6.0 Y +66607 KS -6.0 Y +66608 KS -6.0 Y +66609 KS -6.0 Y +66610 KS -6.0 Y +66611 KS -6.0 Y +66612 KS -6.0 Y +66614 KS -6.0 Y +66615 KS -6.0 Y +66616 KS -6.0 Y +66617 KS -6.0 Y +66618 KS -6.0 Y +66619 KS -6.0 Y +66620 KS -6.0 Y +66621 KS -6.0 Y +66622 KS -6.0 Y +66624 KS -6.0 Y +66625 KS -6.0 Y +66626 KS -6.0 Y +66628 KS -6.0 Y +66629 KS -6.0 Y +66636 KS -6.0 Y +66637 KS -6.0 Y +66642 KS -6.0 Y +66647 KS -6.0 Y +66652 KS -6.0 Y +66653 KS -6.0 Y +66667 KS -6.0 Y +66675 KS -6.0 Y +66683 KS -6.0 Y +66692 KS -6.0 Y +66699 KS -6.0 Y +66701 KS -6.0 Y +66710 KS -6.0 Y +66711 KS -6.0 Y +66712 KS -6.0 Y +66713 KS -6.0 Y +66714 KS -6.0 Y +66716 KS -6.0 Y +66717 KS -6.0 Y +66720 KS -6.0 Y +66724 KS -6.0 Y +66725 KS -6.0 Y +66728 KS -6.0 Y +66732 KS -6.0 Y +66733 KS -6.0 Y +66734 KS -6.0 Y +66735 KS -6.0 Y +66736 KS -6.0 Y +66738 KS -6.0 Y +66739 KS -6.0 Y +66740 KS -6.0 Y +66741 KS -6.0 Y +66742 KS -6.0 Y +66743 KS -6.0 Y +66746 KS -6.0 Y +66748 KS -6.0 Y +66749 KS -6.0 Y +66751 KS -6.0 Y +66753 KS -6.0 Y +66754 KS -6.0 Y +66755 KS -6.0 Y +66756 KS -6.0 Y +66757 KS -6.0 Y +66758 KS -6.0 Y +66759 KS -6.0 Y +66760 KS -6.0 Y +66761 KS -6.0 Y +66762 KS -6.0 Y +66763 KS -6.0 Y +66767 KS -6.0 Y +66769 KS -6.0 Y +66770 KS -6.0 Y +66771 KS -6.0 Y +66772 KS -6.0 Y +66773 KS -6.0 Y +66775 KS -6.0 Y +66776 KS -6.0 Y +66777 KS -6.0 Y +66778 KS -6.0 Y +66779 KS -6.0 Y +66780 KS -6.0 Y +66781 KS -6.0 Y +66782 KS -6.0 Y +66783 KS -6.0 Y +66801 KS -6.0 Y +66830 KS -6.0 Y +66833 KS -6.0 Y +66834 KS -6.0 Y +66835 KS -6.0 Y +66838 KS -6.0 Y +66839 KS -6.0 Y +66840 KS -6.0 Y +66842 KS -6.0 Y +66843 KS -6.0 Y +66845 KS -6.0 Y +66846 KS -6.0 Y +66849 KS -6.0 Y +66850 KS -6.0 Y +66851 KS -6.0 Y +66852 KS -6.0 Y +66853 KS -6.0 Y +66854 KS -6.0 Y +66855 KS -6.0 Y +66856 KS -6.0 Y +66857 KS -6.0 Y +66858 KS -6.0 Y +66859 KS -6.0 Y +66860 KS -6.0 Y +66861 KS -6.0 Y +66862 KS -6.0 Y +66863 KS -6.0 Y +66864 KS -6.0 Y +66865 KS -6.0 Y +66866 KS -6.0 Y +66868 KS -6.0 Y +66869 KS -6.0 Y +66870 KS -6.0 Y +66871 KS -6.0 Y +66872 KS -6.0 Y +66873 KS -6.0 Y +66901 KS -6.0 Y +66930 KS -6.0 Y +66932 KS -6.0 Y +66933 KS -6.0 Y +66935 KS -6.0 Y +66936 KS -6.0 Y +66937 KS -6.0 Y +66938 KS -6.0 Y +66939 KS -6.0 Y +66940 KS -6.0 Y +66941 KS -6.0 Y +66942 KS -6.0 Y +66943 KS -6.0 Y +66944 KS -6.0 Y +66945 KS -6.0 Y +66946 KS -6.0 Y +66948 KS -6.0 Y +66949 KS -6.0 Y +66951 KS -6.0 Y +66952 KS -6.0 Y +66953 KS -6.0 Y +66955 KS -6.0 Y +66956 KS -6.0 Y +66958 KS -6.0 Y +66959 KS -6.0 Y +66960 KS -6.0 Y +66961 KS -6.0 Y +66962 KS -6.0 Y +66963 KS -6.0 Y +66964 KS -6.0 Y +66966 KS -6.0 Y +66967 KS -6.0 Y +66968 KS -6.0 Y +66970 KS -6.0 Y +67001 KS -6.0 Y +67002 KS -6.0 Y +67003 KS -6.0 Y +67004 KS -6.0 Y +67005 KS -6.0 Y +67008 KS -6.0 Y +67009 KS -6.0 Y +67010 KS -6.0 Y +67012 KS -6.0 Y +67013 KS -6.0 Y +67016 KS -6.0 Y +67017 KS -6.0 Y +67018 KS -6.0 Y +67019 KS -6.0 Y +67020 KS -6.0 Y +67021 KS -6.0 Y +67022 KS -6.0 Y +67023 KS -6.0 Y +67024 KS -6.0 Y +67025 KS -6.0 Y +67026 KS -6.0 Y +67028 KS -6.0 Y +67029 KS -6.0 Y +67030 KS -6.0 Y +67031 KS -6.0 Y +67035 KS -6.0 Y +67036 KS -6.0 Y +67037 KS -6.0 Y +67038 KS -6.0 Y +67039 KS -6.0 Y +67041 KS -6.0 Y +67042 KS -6.0 Y +67045 KS -6.0 Y +67047 KS -6.0 Y +67049 KS -6.0 Y +67050 KS -6.0 Y +67051 KS -6.0 Y +67052 KS -6.0 Y +67053 KS -6.0 Y +67054 KS -6.0 Y +67055 KS -6.0 Y +67056 KS -6.0 Y +67057 KS -6.0 Y +67058 KS -6.0 Y +67059 KS -6.0 Y +67060 KS -6.0 Y +67061 KS -6.0 Y +67062 KS -6.0 Y +67063 KS -6.0 Y +67065 KS -6.0 Y +67066 KS -6.0 Y +67067 KS -6.0 Y +67068 KS -6.0 Y +67070 KS -6.0 Y +67071 KS -6.0 Y +67072 KS -6.0 Y +67073 KS -6.0 Y +67074 KS -6.0 Y +67101 KS -6.0 Y +67102 KS -6.0 Y +67103 KS -6.0 Y +67104 KS -6.0 Y +67105 KS -6.0 Y +67106 KS -6.0 Y +67107 KS -6.0 Y +67108 KS -6.0 Y +67109 KS -6.0 Y +67110 KS -6.0 Y +67111 KS -6.0 Y +67112 KS -6.0 Y +67114 KS -6.0 Y +67117 KS -6.0 Y +67118 KS -6.0 Y +67119 KS -6.0 Y +67120 KS -6.0 Y +67122 KS -6.0 Y +67123 KS -6.0 Y +67124 KS -6.0 Y +67127 KS -6.0 Y +67131 KS -6.0 Y +67132 KS -6.0 Y +67133 KS -6.0 Y +67134 KS -6.0 Y +67135 KS -6.0 Y +67137 KS -6.0 Y +67138 KS -6.0 Y +67140 KS -6.0 Y +67142 KS -6.0 Y +67143 KS -6.0 Y +67144 KS -6.0 Y +67146 KS -6.0 Y +67147 KS -6.0 Y +67149 KS -6.0 Y +67150 KS -6.0 Y +67151 KS -6.0 Y +67152 KS -6.0 Y +67154 KS -6.0 Y +67155 KS -6.0 Y +67156 KS -6.0 Y +67159 KS -6.0 Y +67201 KS -6.0 Y +67202 KS -6.0 Y +67203 KS -6.0 Y +67204 KS -6.0 Y +67205 KS -6.0 Y +67206 KS -6.0 Y +67207 KS -6.0 Y +67208 KS -6.0 Y +67209 KS -6.0 Y +67210 KS -6.0 Y +67211 KS -6.0 Y +67212 KS -6.0 Y +67213 KS -6.0 Y +67214 KS -6.0 Y +67215 KS -6.0 Y +67216 KS -6.0 Y +67217 KS -6.0 Y +67218 KS -6.0 Y +67219 KS -6.0 Y +67220 KS -6.0 Y +67221 KS -6.0 Y +67223 KS -6.0 Y +67226 KS -6.0 Y +67227 KS -6.0 Y +67228 KS -6.0 Y +67230 KS -6.0 Y +67232 KS -6.0 Y +67235 KS -6.0 Y +67260 KS -6.0 Y +67275 KS -6.0 Y +67276 KS -6.0 Y +67277 KS -6.0 Y +67278 KS -6.0 Y +67301 KS -6.0 Y +67330 KS -6.0 Y +67332 KS -6.0 Y +67333 KS -6.0 Y +67334 KS -6.0 Y +67335 KS -6.0 Y +67336 KS -6.0 Y +67337 KS -6.0 Y +67340 KS -6.0 Y +67341 KS -6.0 Y +67342 KS -6.0 Y +67344 KS -6.0 Y +67345 KS -6.0 Y +67346 KS -6.0 Y +67347 KS -6.0 Y +67349 KS -6.0 Y +67351 KS -6.0 Y +67352 KS -6.0 Y +67353 KS -6.0 Y +67354 KS -6.0 Y +67355 KS -6.0 Y +67356 KS -6.0 Y +67357 KS -6.0 Y +67360 KS -6.0 Y +67361 KS -6.0 Y +67363 KS -6.0 Y +67364 KS -6.0 Y +67401 KS -6.0 Y +67402 KS -6.0 Y +67410 KS -6.0 Y +67416 KS -6.0 Y +67417 KS -6.0 Y +67418 KS -6.0 Y +67420 KS -6.0 Y +67422 KS -6.0 Y +67423 KS -6.0 Y +67425 KS -6.0 Y +67427 KS -6.0 Y +67428 KS -6.0 Y +67430 KS -6.0 Y +67431 KS -6.0 Y +67432 KS -6.0 Y +67436 KS -6.0 Y +67437 KS -6.0 Y +67438 KS -6.0 Y +67439 KS -6.0 Y +67441 KS -6.0 Y +67442 KS -6.0 Y +67443 KS -6.0 Y +67444 KS -6.0 Y +67445 KS -6.0 Y +67446 KS -6.0 Y +67447 KS -6.0 Y +67448 KS -6.0 Y +67449 KS -6.0 Y +67450 KS -6.0 Y +67451 KS -6.0 Y +67452 KS -6.0 Y +67454 KS -6.0 Y +67455 KS -6.0 Y +67456 KS -6.0 Y +67457 KS -6.0 Y +67458 KS -6.0 Y +67459 KS -6.0 Y +67460 KS -6.0 Y +67464 KS -6.0 Y +67466 KS -6.0 Y +67467 KS -6.0 Y +67468 KS -6.0 Y +67470 KS -6.0 Y +67473 KS -6.0 Y +67474 KS -6.0 Y +67475 KS -6.0 Y +67476 KS -6.0 Y +67478 KS -6.0 Y +67480 KS -6.0 Y +67481 KS -6.0 Y +67482 KS -6.0 Y +67483 KS -6.0 Y +67484 KS -6.0 Y +67485 KS -6.0 Y +67487 KS -6.0 Y +67490 KS -6.0 Y +67491 KS -6.0 Y +67492 KS -6.0 Y +67501 KS -6.0 Y +67502 KS -6.0 Y +67504 KS -6.0 Y +67505 KS -6.0 Y +67510 KS -6.0 Y +67511 KS -6.0 Y +67512 KS -6.0 Y +67513 KS -6.0 Y +67514 KS -6.0 Y +67515 KS -6.0 Y +67516 KS -6.0 Y +67518 KS -6.0 Y +67519 KS -6.0 Y +67520 KS -6.0 Y +67521 KS -6.0 Y +67522 KS -6.0 Y +67523 KS -6.0 Y +67524 KS -6.0 Y +67525 KS -6.0 Y +67526 KS -6.0 Y +67529 KS -6.0 Y +67530 KS -6.0 Y +67543 KS -6.0 Y +67544 KS -6.0 Y +67545 KS -6.0 Y +67546 KS -6.0 Y +67547 KS -6.0 Y +67548 KS -6.0 Y +67550 KS -6.0 Y +67552 KS -6.0 Y +67553 KS -6.0 Y +67554 KS -6.0 Y +67556 KS -6.0 Y +67557 KS -6.0 Y +67559 KS -6.0 Y +67560 KS -6.0 Y +67561 KS -6.0 Y +67563 KS -6.0 Y +67564 KS -6.0 Y +67565 KS -6.0 Y +67566 KS -6.0 Y +67567 KS -6.0 Y +67568 KS -6.0 Y +67570 KS -6.0 Y +67572 KS -6.0 Y +67573 KS -6.0 Y +67574 KS -6.0 Y +67575 KS -6.0 Y +67576 KS -6.0 Y +67578 KS -6.0 Y +67579 KS -6.0 Y +67581 KS -6.0 Y +67583 KS -6.0 Y +67584 KS -6.0 Y +67585 KS -6.0 Y +67601 KS -6.0 Y +67621 KS -6.0 Y +67622 KS -6.0 Y +67623 KS -6.0 Y +67625 KS -6.0 Y +67626 KS -6.0 Y +67627 KS -6.0 Y +67628 KS -6.0 Y +67629 KS -6.0 Y +67631 KS -6.0 Y +67632 KS -6.0 Y +67634 KS -6.0 Y +67635 KS -6.0 Y +67637 KS -6.0 Y +67638 KS -6.0 Y +67639 KS -6.0 Y +67640 KS -6.0 Y +67642 KS -6.0 Y +67643 KS -6.0 Y +67644 KS -6.0 Y +67645 KS -6.0 Y +67646 KS -6.0 Y +67647 KS -6.0 Y +67648 KS -6.0 Y +67649 KS -6.0 Y +67650 KS -6.0 Y +67651 KS -6.0 Y +67653 KS -6.0 Y +67654 KS -6.0 Y +67656 KS -6.0 Y +67657 KS -6.0 Y +67658 KS -6.0 Y +67659 KS -6.0 Y +67660 KS -6.0 Y +67661 KS -6.0 Y +67663 KS -6.0 Y +67664 KS -6.0 Y +67665 KS -6.0 Y +67667 KS -6.0 Y +67669 KS -6.0 Y +67671 KS -6.0 Y +67672 KS -6.0 Y +67673 KS -6.0 Y +67674 KS -6.0 Y +67675 KS -6.0 Y +67701 KS -6.0 Y +67730 KS -6.0 Y +67731 KS -6.0 Y +67732 KS -6.0 Y +67733 KS -7.0 Y +67734 KS -6.0 Y +67735 KS -7.0 Y +67736 KS -6.0 Y +67737 KS -6.0 Y +67738 KS -6.0 Y +67739 KS -6.0 Y +67740 KS -6.0 Y +67741 KS -7.0 Y +67743 KS -6.0 Y +67744 KS -6.0 Y +67745 KS -6.0 Y +67747 KS -6.0 Y +67748 KS -6.0 Y +67749 KS -6.0 Y +67751 KS -6.0 Y +67752 KS -6.0 Y +67753 KS -6.0 Y +67756 KS -6.0 Y +67757 KS -6.0 Y +67758 KS -7.0 Y +67761 KS -7.0 Y +67762 KS -7.0 Y +67764 KS -6.0 Y +67801 KS -6.0 Y +67831 KS -6.0 Y +67834 KS -6.0 Y +67835 KS -6.0 Y +67836 KS -7.0 Y +67837 KS -6.0 Y +67838 KS -6.0 Y +67839 KS -6.0 Y +67840 KS -6.0 Y +67841 KS -6.0 Y +67842 KS -6.0 Y +67843 KS -6.0 Y +67844 KS -6.0 Y +67846 KS -6.0 Y +67849 KS -6.0 Y +67850 KS -6.0 Y +67851 KS -6.0 Y +67853 KS -6.0 Y +67854 KS -6.0 Y +67855 KS -6.0 Y +67857 KS -7.0 Y +67859 KS -6.0 Y +67860 KS -6.0 Y +67861 KS -6.0 Y +67862 KS -6.0 Y +67863 KS -6.0 Y +67864 KS -6.0 Y +67865 KS -6.0 Y +67867 KS -6.0 Y +67868 KS -6.0 Y +67869 KS -6.0 Y +67870 KS -6.0 Y +67871 KS -6.0 Y +67876 KS -6.0 Y +67877 KS -6.0 Y +67878 KS -7.0 Y +67879 KS -7.0 Y +67880 KS -6.0 Y +67882 KS -6.0 Y +67901 KS -6.0 Y +67905 KS -6.0 Y +67950 KS -6.0 Y +67951 KS -6.0 Y +67952 KS -6.0 Y +67953 KS -6.0 Y +67954 KS -6.0 Y +68001 NE -6.0 Y +68002 NE -6.0 Y +68003 NE -6.0 Y +68004 NE -6.0 Y +68005 NE -6.0 Y +68007 NE -6.0 Y +68008 NE -6.0 Y +68009 NE -6.0 Y +68010 NE -6.0 Y +68014 NE -6.0 Y +68015 NE -6.0 Y +68016 NE -6.0 Y +68017 NE -6.0 Y +68018 NE -6.0 Y +68019 NE -6.0 Y +68020 NE -6.0 Y +68022 NE -6.0 Y +68023 NE -6.0 Y +68025 NE -6.0 Y +68026 NE -6.0 Y +68028 NE -6.0 Y +68029 NE -6.0 Y +68030 NE -6.0 Y +68031 NE -6.0 Y +68033 NE -6.0 Y +68034 NE -6.0 Y +68036 NE -6.0 Y +68037 NE -6.0 Y +68038 NE -6.0 Y +68039 NE -6.0 Y +68040 NE -6.0 Y +68041 NE -6.0 Y +68042 NE -6.0 Y +68044 NE -6.0 Y +68045 NE -6.0 Y +68046 NE -6.0 Y +68047 NE -6.0 Y +68048 NE -6.0 Y +68050 NE -6.0 Y +68055 NE -6.0 Y +68056 NE -6.0 Y +68057 NE -6.0 Y +68058 NE -6.0 Y +68059 NE -6.0 Y +68061 NE -6.0 Y +68062 NE -6.0 Y +68063 NE -6.0 Y +68064 NE -6.0 Y +68065 NE -6.0 Y +68066 NE -6.0 Y +68067 NE -6.0 Y +68068 NE -6.0 Y +68069 NE -6.0 Y +68070 NE -6.0 Y +68071 NE -6.0 Y +68072 NE -6.0 Y +68073 NE -6.0 Y +68101 NE -6.0 Y +68102 NE -6.0 Y +68103 NE -6.0 Y +68104 NE -6.0 Y +68105 NE -6.0 Y +68106 NE -6.0 Y +68107 NE -6.0 Y +68108 NE -6.0 Y +68109 NE -6.0 Y +68110 NE -6.0 Y +68111 NE -6.0 Y +68112 NE -6.0 Y +68113 NE -6.0 Y +68114 NE -6.0 Y +68116 NE -6.0 Y +68117 NE -6.0 Y +68118 NE -6.0 Y +68119 NE -6.0 Y +68120 NE -6.0 Y +68122 NE -6.0 Y +68123 NE -6.0 Y +68124 NE -6.0 Y +68127 NE -6.0 Y +68128 NE -6.0 Y +68130 NE -6.0 Y +68131 NE -6.0 Y +68132 NE -6.0 Y +68133 NE -6.0 Y +68134 NE -6.0 Y +68135 NE -6.0 Y +68136 NE -6.0 Y +68137 NE -6.0 Y +68138 NE -6.0 Y +68139 NE -6.0 Y +68142 NE -6.0 Y +68144 NE -6.0 Y +68145 NE -6.0 Y +68147 NE -6.0 Y +68152 NE -6.0 Y +68154 NE -6.0 Y +68155 NE -6.0 Y +68157 NE -6.0 Y +68164 NE -6.0 Y +68172 NE -6.0 Y +68175 NE -6.0 Y +68176 NE -6.0 Y +68178 NE -6.0 Y +68179 NE -6.0 Y +68180 NE -6.0 Y +68181 NE -6.0 Y +68182 NE -6.0 Y +68183 NE -6.0 Y +68197 NE -6.0 Y +68198 NE -6.0 Y +68301 NE -6.0 Y +68303 NE -6.0 Y +68304 NE -6.0 Y +68305 NE -6.0 Y +68307 NE -6.0 Y +68309 NE -6.0 Y +68310 NE -6.0 Y +68313 NE -6.0 Y +68314 NE -6.0 Y +68315 NE -6.0 Y +68316 NE -6.0 Y +68317 NE -6.0 Y +68318 NE -6.0 Y +68319 NE -6.0 Y +68320 NE -6.0 Y +68321 NE -6.0 Y +68322 NE -6.0 Y +68323 NE -6.0 Y +68324 NE -6.0 Y +68325 NE -6.0 Y +68326 NE -6.0 Y +68327 NE -6.0 Y +68328 NE -6.0 Y +68329 NE -6.0 Y +68330 NE -6.0 Y +68331 NE -6.0 Y +68332 NE -6.0 Y +68333 NE -6.0 Y +68335 NE -6.0 Y +68336 NE -6.0 Y +68337 NE -6.0 Y +68338 NE -6.0 Y +68339 NE -6.0 Y +68340 NE -6.0 Y +68341 NE -6.0 Y +68342 NE -6.0 Y +68343 NE -6.0 Y +68344 NE -6.0 Y +68345 NE -6.0 Y +68346 NE -6.0 Y +68347 NE -6.0 Y +68348 NE -6.0 Y +68349 NE -6.0 Y +68350 NE -6.0 Y +68351 NE -6.0 Y +68352 NE -6.0 Y +68354 NE -6.0 Y +68355 NE -6.0 Y +68357 NE -6.0 Y +68358 NE -6.0 Y +68359 NE -6.0 Y +68360 NE -6.0 Y +68361 NE -6.0 Y +68362 NE -6.0 Y +68364 NE -6.0 Y +68365 NE -6.0 Y +68366 NE -6.0 Y +68367 NE -6.0 Y +68368 NE -6.0 Y +68370 NE -6.0 Y +68371 NE -6.0 Y +68372 NE -6.0 Y +68375 NE -6.0 Y +68376 NE -6.0 Y +68377 NE -6.0 Y +68378 NE -6.0 Y +68379 NE -6.0 Y +68380 NE -6.0 Y +68381 NE -6.0 Y +68382 NE -6.0 Y +68401 NE -6.0 Y +68402 NE -6.0 Y +68403 NE -6.0 Y +68404 NE -6.0 Y +68405 NE -6.0 Y +68406 NE -6.0 Y +68407 NE -6.0 Y +68409 NE -6.0 Y +68410 NE -6.0 Y +68413 NE -6.0 Y +68414 NE -6.0 Y +68415 NE -6.0 Y +68416 NE -6.0 Y +68417 NE -6.0 Y +68418 NE -6.0 Y +68419 NE -6.0 Y +68420 NE -6.0 Y +68421 NE -6.0 Y +68422 NE -6.0 Y +68423 NE -6.0 Y +68424 NE -6.0 Y +68428 NE -6.0 Y +68429 NE -6.0 Y +68430 NE -6.0 Y +68431 NE -6.0 Y +68433 NE -6.0 Y +68434 NE -6.0 Y +68436 NE -6.0 Y +68437 NE -6.0 Y +68438 NE -6.0 Y +68439 NE -6.0 Y +68440 NE -6.0 Y +68441 NE -6.0 Y +68442 NE -6.0 Y +68443 NE -6.0 Y +68444 NE -6.0 Y +68445 NE -6.0 Y +68446 NE -6.0 Y +68447 NE -6.0 Y +68448 NE -6.0 Y +68450 NE -6.0 Y +68452 NE -6.0 Y +68453 NE -6.0 Y +68454 NE -6.0 Y +68455 NE -6.0 Y +68456 NE -6.0 Y +68457 NE -6.0 Y +68458 NE -6.0 Y +68460 NE -6.0 Y +68461 NE -6.0 Y +68462 NE -6.0 Y +68463 NE -6.0 Y +68464 NE -6.0 Y +68465 NE -6.0 Y +68466 NE -6.0 Y +68467 NE -6.0 Y +68501 NE -6.0 Y +68502 NE -6.0 Y +68503 NE -6.0 Y +68504 NE -6.0 Y +68505 NE -6.0 Y +68506 NE -6.0 Y +68507 NE -6.0 Y +68508 NE -6.0 Y +68509 NE -6.0 Y +68510 NE -6.0 Y +68512 NE -6.0 Y +68514 NE -6.0 Y +68516 NE -6.0 Y +68517 NE -6.0 Y +68520 NE -6.0 Y +68521 NE -6.0 Y +68522 NE -6.0 Y +68523 NE -6.0 Y +68524 NE -6.0 Y +68526 NE -6.0 Y +68527 NE -6.0 Y +68528 NE -6.0 Y +68529 NE -6.0 Y +68531 NE -6.0 Y +68532 NE -6.0 Y +68542 NE -6.0 Y +68583 NE -6.0 Y +68588 NE -6.0 Y +68601 NE -6.0 Y +68602 NE -6.0 Y +68620 NE -6.0 Y +68621 NE -6.0 Y +68622 NE -6.0 Y +68623 NE -6.0 Y +68624 NE -6.0 Y +68626 NE -6.0 Y +68627 NE -6.0 Y +68628 NE -6.0 Y +68629 NE -6.0 Y +68631 NE -6.0 Y +68632 NE -6.0 Y +68633 NE -6.0 Y +68634 NE -6.0 Y +68635 NE -6.0 Y +68636 NE -6.0 Y +68637 NE -6.0 Y +68638 NE -6.0 Y +68640 NE -6.0 Y +68641 NE -6.0 Y +68642 NE -6.0 Y +68643 NE -6.0 Y +68644 NE -6.0 Y +68647 NE -6.0 Y +68648 NE -6.0 Y +68649 NE -6.0 Y +68651 NE -6.0 Y +68652 NE -6.0 Y +68653 NE -6.0 Y +68654 NE -6.0 Y +68655 NE -6.0 Y +68658 NE -6.0 Y +68659 NE -6.0 Y +68660 NE -6.0 Y +68661 NE -6.0 Y +68662 NE -6.0 Y +68663 NE -6.0 Y +68664 NE -6.0 Y +68665 NE -6.0 Y +68666 NE -6.0 Y +68667 NE -6.0 Y +68669 NE -6.0 Y +68701 NE -6.0 Y +68702 NE -6.0 Y +68710 NE -6.0 Y +68711 NE -6.0 Y +68713 NE -6.0 Y +68714 NE -6.0 Y +68715 NE -6.0 Y +68716 NE -6.0 Y +68717 NE -6.0 Y +68718 NE -6.0 Y +68719 NE -6.0 Y +68720 NE -6.0 Y +68722 NE -6.0 Y +68723 NE -6.0 Y +68724 NE -6.0 Y +68725 NE -6.0 Y +68726 NE -6.0 Y +68727 NE -6.0 Y +68728 NE -6.0 Y +68729 NE -6.0 Y +68730 NE -6.0 Y +68731 NE -6.0 Y +68732 NE -6.0 Y +68733 NE -6.0 Y +68734 NE -6.0 Y +68735 NE -6.0 Y +68736 NE -6.0 Y +68738 NE -6.0 Y +68739 NE -6.0 Y +68740 NE -6.0 Y +68741 NE -6.0 Y +68742 NE -6.0 Y +68743 NE -6.0 Y +68745 NE -6.0 Y +68746 NE -6.0 Y +68747 NE -6.0 Y +68748 NE -6.0 Y +68749 NE -6.0 Y +68751 NE -6.0 Y +68752 NE -6.0 Y +68753 NE -6.0 Y +68755 NE -6.0 Y +68756 NE -6.0 Y +68757 NE -6.0 Y +68758 NE -6.0 Y +68759 NE -6.0 Y +68760 NE -6.0 Y +68761 NE -6.0 Y +68763 NE -6.0 Y +68764 NE -6.0 Y +68765 NE -6.0 Y +68766 NE -6.0 Y +68767 NE -6.0 Y +68768 NE -6.0 Y +68769 NE -6.0 Y +68770 NE -6.0 Y +68771 NE -6.0 Y +68773 NE -6.0 Y +68774 NE -6.0 Y +68776 NE -6.0 Y +68777 NE -6.0 Y +68778 NE -6.0 Y +68779 NE -6.0 Y +68780 NE -6.0 Y +68781 NE -6.0 Y +68783 NE -6.0 Y +68784 NE -6.0 Y +68785 NE -6.0 Y +68786 NE -6.0 Y +68787 NE -6.0 Y +68788 NE -6.0 Y +68789 NE -6.0 Y +68790 NE -6.0 Y +68791 NE -6.0 Y +68792 NE -6.0 Y +68801 NE -6.0 Y +68802 NE -6.0 Y +68803 NE -6.0 Y +68810 NE -6.0 Y +68812 NE -6.0 Y +68813 NE -6.0 Y +68814 NE -6.0 Y +68815 NE -6.0 Y +68816 NE -6.0 Y +68817 NE -6.0 Y +68818 NE -6.0 Y +68820 NE -6.0 Y +68821 NE -6.0 Y +68822 NE -6.0 Y +68823 NE -6.0 Y +68824 NE -6.0 Y +68825 NE -6.0 Y +68826 NE -6.0 Y +68827 NE -6.0 Y +68828 NE -6.0 Y +68831 NE -6.0 Y +68832 NE -6.0 Y +68833 NE -6.0 Y +68834 NE -6.0 Y +68835 NE -6.0 Y +68836 NE -6.0 Y +68837 NE -6.0 Y +68838 NE -6.0 Y +68840 NE -6.0 Y +68841 NE -6.0 Y +68842 NE -6.0 Y +68843 NE -6.0 Y +68844 NE -6.0 Y +68845 NE -6.0 Y +68846 NE -6.0 Y +68847 NE -6.0 Y +68848 NE -6.0 Y +68849 NE -6.0 Y +68850 NE -6.0 Y +68852 NE -6.0 Y +68853 NE -6.0 Y +68854 NE -6.0 Y +68855 NE -6.0 Y +68856 NE -6.0 Y +68858 NE -6.0 Y +68859 NE -6.0 Y +68860 NE -6.0 Y +68861 NE -6.0 Y +68862 NE -6.0 Y +68863 NE -6.0 Y +68864 NE -6.0 Y +68865 NE -6.0 Y +68866 NE -6.0 Y +68869 NE -6.0 Y +68870 NE -6.0 Y +68871 NE -6.0 Y +68872 NE -6.0 Y +68873 NE -6.0 Y +68874 NE -6.0 Y +68875 NE -6.0 Y +68876 NE -6.0 Y +68878 NE -6.0 Y +68879 NE -6.0 Y +68881 NE -6.0 Y +68882 NE -6.0 Y +68883 NE -6.0 Y +68901 NE -6.0 Y +68902 NE -6.0 Y +68920 NE -6.0 Y +68922 NE -6.0 Y +68923 NE -6.0 Y +68924 NE -6.0 Y +68925 NE -6.0 Y +68926 NE -6.0 Y +68927 NE -6.0 Y +68928 NE -6.0 Y +68929 NE -6.0 Y +68930 NE -6.0 Y +68932 NE -6.0 Y +68933 NE -6.0 Y +68934 NE -6.0 Y +68935 NE -6.0 Y +68936 NE -6.0 Y +68937 NE -6.0 Y +68938 NE -6.0 Y +68939 NE -6.0 Y +68940 NE -6.0 Y +68941 NE -6.0 Y +68942 NE -6.0 Y +68943 NE -6.0 Y +68944 NE -6.0 Y +68945 NE -6.0 Y +68946 NE -6.0 Y +68947 NE -6.0 Y +68948 NE -6.0 Y +68949 NE -6.0 Y +68950 NE -6.0 Y +68952 NE -6.0 Y +68954 NE -6.0 Y +68955 NE -6.0 Y +68956 NE -6.0 Y +68957 NE -6.0 Y +68958 NE -6.0 Y +68959 NE -6.0 Y +68960 NE -6.0 Y +68961 NE -6.0 Y +68964 NE -6.0 Y +68966 NE -6.0 Y +68967 NE -6.0 Y +68969 NE -6.0 Y +68970 NE -6.0 Y +68971 NE -6.0 Y +68972 NE -6.0 Y +68973 NE -6.0 Y +68974 NE -6.0 Y +68975 NE -6.0 Y +68976 NE -6.0 Y +68977 NE -6.0 Y +68978 NE -6.0 Y +68979 NE -6.0 Y +68980 NE -6.0 Y +68981 NE -6.0 Y +68982 NE -6.0 Y +69001 NE -6.0 Y +69020 NE -6.0 Y +69021 NE -7.0 Y +69022 NE -6.0 Y +69023 NE -7.0 Y +69024 NE -6.0 Y +69025 NE -6.0 Y +69026 NE -6.0 Y +69027 NE -7.0 Y +69028 NE -6.0 Y +69029 NE -6.0 Y +69030 NE -7.0 Y +69032 NE -6.0 Y +69033 NE -7.0 Y +69034 NE -6.0 Y +69036 NE -6.0 Y +69037 NE -7.0 Y +69038 NE -6.0 Y +69039 NE -6.0 Y +69040 NE -6.0 Y +69041 NE -7.0 Y +69042 NE -6.0 Y +69043 NE -6.0 Y +69044 NE -6.0 Y +69045 NE -7.0 Y +69046 NE -6.0 Y +69101 NE -6.0 Y +69103 NE -6.0 Y +69120 NE -6.0 Y +69121 NE -7.0 Y +69122 NE -7.0 Y +69123 NE -6.0 Y +69125 NE -7.0 Y +69127 NE -7.0 Y +69128 NE -7.0 Y +69129 NE -7.0 Y +69130 NE -6.0 Y +69131 NE -7.0 Y +69132 NE -6.0 Y +69133 NE -7.0 Y +69134 NE -7.0 Y +69135 NE -6.0 Y +69138 NE -6.0 Y +69140 NE -7.0 Y +69141 NE -7.0 Y +69142 NE -6.0 Y +69143 NE -6.0 Y +69144 NE -7.0 Y +69145 NE -7.0 Y +69146 NE -7.0 Y +69147 NE -7.0 Y +69148 NE -7.0 Y +69149 NE -7.0 Y +69150 NE -7.0 Y +69151 NE -6.0 Y +69152 NE -7.0 Y +69153 NE -7.0 Y +69154 NE -7.0 Y +69155 NE -7.0 Y +69156 NE -7.0 Y +69157 NE -6.0 Y +69160 NE -7.0 Y +69161 NE -6.0 Y +69162 NE -7.0 Y +69163 NE -6.0 Y +69165 NE -6.0 Y +69166 NE -6.0 Y +69167 NE -6.0 Y +69168 NE -7.0 Y +69169 NE -6.0 Y +69170 NE -6.0 Y +69171 NE -6.0 Y +69190 NE -7.0 Y +69201 NE -6.0 Y +69210 NE -6.0 Y +69211 NE -7.0 Y +69212 NE -6.0 Y +69214 NE -6.0 Y +69216 NE -7.0 Y +69217 NE -6.0 Y +69218 NE -7.0 Y +69219 NE -7.0 Y +69220 NE -6.0 Y +69221 NE -6.0 Y +69301 NE -7.0 Y +69331 NE -7.0 Y +69333 NE -7.0 Y +69334 NE -7.0 Y +69335 NE -7.0 Y +69336 NE -7.0 Y +69337 NE -7.0 Y +69339 NE -7.0 Y +69340 NE -7.0 Y +69341 NE -7.0 Y +69343 NE -7.0 Y +69345 NE -7.0 Y +69346 NE -7.0 Y +69347 NE -7.0 Y +69348 NE -7.0 Y +69350 NE -7.0 Y +69351 NE -7.0 Y +69352 NE -7.0 Y +69353 NE -7.0 Y +69354 NE -7.0 Y +69355 NE -7.0 Y +69356 NE -7.0 Y +69357 NE -7.0 Y +69358 NE -7.0 Y +69360 NE -7.0 Y +69361 NE -7.0 Y +69363 NE -7.0 Y +69365 NE -7.0 Y +69366 NE -7.0 Y +69367 NE -7.0 Y +70001 LA -6.0 Y +70002 LA -6.0 Y +70003 LA -6.0 Y +70004 LA -6.0 Y +70005 LA -6.0 Y +70006 LA -6.0 Y +70009 LA -6.0 Y +70010 LA -6.0 Y +70011 LA -6.0 Y +70030 LA -6.0 Y +70031 LA -6.0 Y +70032 LA -6.0 Y +70033 LA -6.0 Y +70036 LA -6.0 Y +70037 LA -6.0 Y +70038 LA -6.0 Y +70039 LA -6.0 Y +70040 LA -6.0 Y +70041 LA -6.0 Y +70043 LA -6.0 Y +70044 LA -6.0 Y +70047 LA -6.0 Y +70049 LA -6.0 Y +70050 LA -6.0 Y +70051 LA -6.0 Y +70052 LA -6.0 Y +70053 LA -6.0 Y +70054 LA -6.0 Y +70055 LA -6.0 Y +70056 LA -6.0 Y +70057 LA -6.0 Y +70058 LA -6.0 Y +70059 LA -6.0 Y +70060 LA -6.0 Y +70062 LA -6.0 Y +70063 LA -6.0 Y +70064 LA -6.0 Y +70065 LA -6.0 Y +70067 LA -6.0 Y +70068 LA -6.0 Y +70069 LA -6.0 Y +70070 LA -6.0 Y +70071 LA -6.0 Y +70072 LA -6.0 Y +70073 LA -6.0 Y +70075 LA -6.0 Y +70076 LA -6.0 Y +70078 LA -6.0 Y +70079 LA -6.0 Y +70080 LA -6.0 Y +70081 LA -6.0 Y +70082 LA -6.0 Y +70083 LA -6.0 Y +70084 LA -6.0 Y +70085 LA -6.0 Y +70086 LA -6.0 Y +70087 LA -6.0 Y +70090 LA -6.0 Y +70091 LA -6.0 Y +70092 LA -6.0 Y +70093 LA -6.0 Y +70094 LA -6.0 Y +70096 LA -6.0 Y +70097 LA -6.0 Y +70112 LA -6.0 Y +70113 LA -6.0 Y +70114 LA -6.0 Y +70115 LA -6.0 Y +70116 LA -6.0 Y +70117 LA -6.0 Y +70118 LA -6.0 Y +70119 LA -6.0 Y +70121 LA -6.0 Y +70122 LA -6.0 Y +70123 LA -6.0 Y +70124 LA -6.0 Y +70125 LA -6.0 Y +70126 LA -6.0 Y +70127 LA -6.0 Y +70128 LA -6.0 Y +70129 LA -6.0 Y +70130 LA -6.0 Y +70131 LA -6.0 Y +70139 LA -6.0 Y +70140 LA -6.0 Y +70141 LA -6.0 Y +70142 LA -6.0 Y +70143 LA -6.0 Y +70145 LA -6.0 Y +70146 LA -6.0 Y +70148 LA -6.0 Y +70149 LA -6.0 Y +70150 LA -6.0 Y +70151 LA -6.0 Y +70152 LA -6.0 Y +70153 LA -6.0 Y +70154 LA -6.0 Y +70156 LA -6.0 Y +70157 LA -6.0 Y +70158 LA -6.0 Y +70159 LA -6.0 Y +70160 LA -6.0 Y +70161 LA -6.0 Y +70162 LA -6.0 Y +70163 LA -6.0 Y +70164 LA -6.0 Y +70165 LA -6.0 Y +70166 LA -6.0 Y +70167 LA -6.0 Y +70170 LA -6.0 Y +70172 LA -6.0 Y +70174 LA -6.0 Y +70175 LA -6.0 Y +70176 LA -6.0 Y +70177 LA -6.0 Y +70178 LA -6.0 Y +70179 LA -6.0 Y +70181 LA -6.0 Y +70182 LA -6.0 Y +70183 LA -6.0 Y +70184 LA -6.0 Y +70185 LA -6.0 Y +70186 LA -6.0 Y +70187 LA -6.0 Y +70189 LA -6.0 Y +70190 LA -6.0 Y +70195 LA -6.0 Y +70301 LA -6.0 Y +70302 LA -6.0 Y +70310 LA -6.0 Y +70339 LA -6.0 Y +70340 LA -6.0 Y +70341 LA -6.0 Y +70342 LA -6.0 Y +70343 LA -6.0 Y +70344 LA -6.0 Y +70345 LA -6.0 Y +70346 LA -6.0 Y +70352 LA -6.0 Y +70353 LA -6.0 Y +70354 LA -6.0 Y +70355 LA -6.0 Y +70356 LA -6.0 Y +70357 LA -6.0 Y +70358 LA -6.0 Y +70359 LA -6.0 Y +70360 LA -6.0 Y +70361 LA -6.0 Y +70363 LA -6.0 Y +70364 LA -6.0 Y +70371 LA -6.0 Y +70372 LA -6.0 Y +70373 LA -6.0 Y +70374 LA -6.0 Y +70375 LA -6.0 Y +70377 LA -6.0 Y +70380 LA -6.0 Y +70381 LA -6.0 Y +70390 LA -6.0 Y +70391 LA -6.0 Y +70392 LA -6.0 Y +70393 LA -6.0 Y +70394 LA -6.0 Y +70395 LA -6.0 Y +70397 LA -6.0 Y +70401 LA -6.0 Y +70402 LA -6.0 Y +70403 LA -6.0 Y +70404 LA -6.0 Y +70420 LA -6.0 Y +70421 LA -6.0 Y +70422 LA -6.0 Y +70426 LA -6.0 Y +70427 LA -6.0 Y +70429 LA -6.0 Y +70431 LA -6.0 Y +70433 LA -6.0 Y +70434 LA -6.0 Y +70435 LA -6.0 Y +70436 LA -6.0 Y +70437 LA -6.0 Y +70438 LA -6.0 Y +70441 LA -6.0 Y +70442 LA -6.0 Y +70443 LA -6.0 Y +70444 LA -6.0 Y +70445 LA -6.0 Y +70446 LA -6.0 Y +70447 LA -6.0 Y +70448 LA -6.0 Y +70449 LA -6.0 Y +70450 LA -6.0 Y +70451 LA -6.0 Y +70452 LA -6.0 Y +70453 LA -6.0 Y +70454 LA -6.0 Y +70455 LA -6.0 Y +70456 LA -6.0 Y +70457 LA -6.0 Y +70458 LA -6.0 Y +70459 LA -6.0 Y +70460 LA -6.0 Y +70461 LA -6.0 Y +70462 LA -6.0 Y +70463 LA -6.0 Y +70464 LA -6.0 Y +70465 LA -6.0 Y +70466 LA -6.0 Y +70467 LA -6.0 Y +70469 LA -6.0 Y +70470 LA -6.0 Y +70471 LA -6.0 Y +70501 LA -6.0 Y +70502 LA -6.0 Y +70503 LA -6.0 Y +70504 LA -6.0 Y +70505 LA -6.0 Y +70506 LA -6.0 Y +70507 LA -6.0 Y +70508 LA -6.0 Y +70509 LA -6.0 Y +70510 LA -6.0 Y +70511 LA -6.0 Y +70512 LA -6.0 Y +70513 LA -6.0 Y +70514 LA -6.0 Y +70515 LA -6.0 Y +70516 LA -6.0 Y +70517 LA -6.0 Y +70518 LA -6.0 Y +70519 LA -6.0 Y +70520 LA -6.0 Y +70521 LA -6.0 Y +70522 LA -6.0 Y +70523 LA -6.0 Y +70524 LA -6.0 Y +70525 LA -6.0 Y +70526 LA -6.0 Y +70527 LA -6.0 Y +70528 LA -6.0 Y +70529 LA -6.0 Y +70531 LA -6.0 Y +70532 LA -6.0 Y +70533 LA -6.0 Y +70534 LA -6.0 Y +70535 LA -6.0 Y +70537 LA -6.0 Y +70538 LA -6.0 Y +70540 LA -6.0 Y +70541 LA -6.0 Y +70542 LA -6.0 Y +70543 LA -6.0 Y +70544 LA -6.0 Y +70546 LA -6.0 Y +70548 LA -6.0 Y +70549 LA -6.0 Y +70550 LA -6.0 Y +70551 LA -6.0 Y +70552 LA -6.0 Y +70554 LA -6.0 Y +70555 LA -6.0 Y +70556 LA -6.0 Y +70558 LA -6.0 Y +70559 LA -6.0 Y +70560 LA -6.0 Y +70562 LA -6.0 Y +70563 LA -6.0 Y +70569 LA -6.0 Y +70570 LA -6.0 Y +70571 LA -6.0 Y +70575 LA -6.0 Y +70576 LA -6.0 Y +70577 LA -6.0 Y +70578 LA -6.0 Y +70580 LA -6.0 Y +70581 LA -6.0 Y +70582 LA -6.0 Y +70583 LA -6.0 Y +70584 LA -6.0 Y +70585 LA -6.0 Y +70586 LA -6.0 Y +70589 LA -6.0 Y +70591 LA -6.0 Y +70592 LA -6.0 Y +70593 LA -6.0 Y +70595 LA -6.0 Y +70596 LA -6.0 Y +70598 LA -6.0 Y +70601 LA -6.0 Y +70602 LA -6.0 Y +70605 LA -6.0 Y +70606 LA -6.0 Y +70607 LA -6.0 Y +70609 LA -6.0 Y +70611 LA -6.0 Y +70612 LA -6.0 Y +70615 LA -6.0 Y +70616 LA -6.0 Y +70629 LA -6.0 Y +70630 LA -6.0 Y +70631 LA -6.0 Y +70632 LA -6.0 Y +70633 LA -6.0 Y +70634 LA -6.0 Y +70637 LA -6.0 Y +70638 LA -6.0 Y +70639 LA -6.0 Y +70640 LA -6.0 Y +70643 LA -6.0 Y +70644 LA -6.0 Y +70645 LA -6.0 Y +70646 LA -6.0 Y +70647 LA -6.0 Y +70648 LA -6.0 Y +70650 LA -6.0 Y +70651 LA -6.0 Y +70652 LA -6.0 Y +70653 LA -6.0 Y +70654 LA -6.0 Y +70655 LA -6.0 Y +70656 LA -6.0 Y +70657 LA -6.0 Y +70658 LA -6.0 Y +70659 LA -6.0 Y +70660 LA -6.0 Y +70661 LA -6.0 Y +70662 LA -6.0 Y +70663 LA -6.0 Y +70664 LA -6.0 Y +70665 LA -6.0 Y +70668 LA -6.0 Y +70669 LA -6.0 Y +70704 LA -6.0 Y +70706 LA -6.0 Y +70707 LA -6.0 Y +70710 LA -6.0 Y +70711 LA -6.0 Y +70712 LA -6.0 Y +70714 LA -6.0 Y +70715 LA -6.0 Y +70718 LA -6.0 Y +70719 LA -6.0 Y +70721 LA -6.0 Y +70722 LA -6.0 Y +70723 LA -6.0 Y +70725 LA -6.0 Y +70726 LA -6.0 Y +70727 LA -6.0 Y +70728 LA -6.0 Y +70729 LA -6.0 Y +70730 LA -6.0 Y +70732 LA -6.0 Y +70733 LA -6.0 Y +70734 LA -6.0 Y +70736 LA -6.0 Y +70737 LA -6.0 Y +70738 LA -6.0 Y +70739 LA -6.0 Y +70740 LA -6.0 Y +70743 LA -6.0 Y +70744 LA -6.0 Y +70747 LA -6.0 Y +70748 LA -6.0 Y +70749 LA -6.0 Y +70750 LA -6.0 Y +70752 LA -6.0 Y +70753 LA -6.0 Y +70754 LA -6.0 Y +70755 LA -6.0 Y +70756 LA -6.0 Y +70757 LA -6.0 Y +70759 LA -6.0 Y +70760 LA -6.0 Y +70761 LA -6.0 Y +70762 LA -6.0 Y +70763 LA -6.0 Y +70764 LA -6.0 Y +70765 LA -6.0 Y +70767 LA -6.0 Y +70769 LA -6.0 Y +70770 LA -6.0 Y +70772 LA -6.0 Y +70773 LA -6.0 Y +70774 LA -6.0 Y +70775 LA -6.0 Y +70776 LA -6.0 Y +70777 LA -6.0 Y +70778 LA -6.0 Y +70780 LA -6.0 Y +70782 LA -6.0 Y +70783 LA -6.0 Y +70784 LA -6.0 Y +70785 LA -6.0 Y +70786 LA -6.0 Y +70787 LA -6.0 Y +70788 LA -6.0 Y +70789 LA -6.0 Y +70791 LA -6.0 Y +70792 LA -6.0 Y +70801 LA -6.0 Y +70802 LA -6.0 Y +70803 LA -6.0 Y +70804 LA -6.0 Y +70805 LA -6.0 Y +70806 LA -6.0 Y +70807 LA -6.0 Y +70808 LA -6.0 Y +70809 LA -6.0 Y +70810 LA -6.0 Y +70811 LA -6.0 Y +70812 LA -6.0 Y +70813 LA -6.0 Y +70814 LA -6.0 Y +70815 LA -6.0 Y +70816 LA -6.0 Y +70817 LA -6.0 Y +70818 LA -6.0 Y +70819 LA -6.0 Y +70820 LA -6.0 Y +70821 LA -6.0 Y +70822 LA -6.0 Y +70823 LA -6.0 Y +70825 LA -6.0 Y +70826 LA -6.0 Y +70827 LA -6.0 Y +70831 LA -6.0 Y +70833 LA -6.0 Y +70835 LA -6.0 Y +70836 LA -6.0 Y +70837 LA -6.0 Y +70873 LA -6.0 Y +70874 LA -6.0 Y +70879 LA -6.0 Y +70883 LA -6.0 Y +70884 LA -6.0 Y +70891 LA -6.0 Y +70892 LA -6.0 Y +70893 LA -6.0 Y +70894 LA -6.0 Y +70895 LA -6.0 Y +70896 LA -6.0 Y +70898 LA -6.0 Y +71001 LA -6.0 Y +71002 LA -6.0 Y +71003 LA -6.0 Y +71004 LA -6.0 Y +71006 LA -6.0 Y +71007 LA -6.0 Y +71008 LA -6.0 Y +71009 LA -6.0 Y +71016 LA -6.0 Y +71018 LA -6.0 Y +71019 LA -6.0 Y +71021 LA -6.0 Y +71023 LA -6.0 Y +71024 LA -6.0 Y +71027 LA -6.0 Y +71028 LA -6.0 Y +71029 LA -6.0 Y +71030 LA -6.0 Y +71031 LA -6.0 Y +71032 LA -6.0 Y +71033 LA -6.0 Y +71034 LA -6.0 Y +71037 LA -6.0 Y +71038 LA -6.0 Y +71039 LA -6.0 Y +71040 LA -6.0 Y +71043 LA -6.0 Y +71044 LA -6.0 Y +71045 LA -6.0 Y +71046 LA -6.0 Y +71047 LA -6.0 Y +71048 LA -6.0 Y +71049 LA -6.0 Y +71050 LA -6.0 Y +71051 LA -6.0 Y +71052 LA -6.0 Y +71055 LA -6.0 Y +71058 LA -6.0 Y +71060 LA -6.0 Y +71061 LA -6.0 Y +71063 LA -6.0 Y +71064 LA -6.0 Y +71065 LA -6.0 Y +71066 LA -6.0 Y +71067 LA -6.0 Y +71068 LA -6.0 Y +71069 LA -6.0 Y +71070 LA -6.0 Y +71071 LA -6.0 Y +71072 LA -6.0 Y +71073 LA -6.0 Y +71075 LA -6.0 Y +71078 LA -6.0 Y +71079 LA -6.0 Y +71080 LA -6.0 Y +71082 LA -6.0 Y +71101 LA -6.0 Y +71102 LA -6.0 Y +71103 LA -6.0 Y +71104 LA -6.0 Y +71105 LA -6.0 Y +71106 LA -6.0 Y +71107 LA -6.0 Y +71108 LA -6.0 Y +71109 LA -6.0 Y +71110 LA -6.0 Y +71111 LA -6.0 Y +71112 LA -6.0 Y +71113 LA -6.0 Y +71115 LA -6.0 Y +71118 LA -6.0 Y +71119 LA -6.0 Y +71120 LA -6.0 Y +71129 LA -6.0 Y +71130 LA -6.0 Y +71133 LA -6.0 Y +71134 LA -6.0 Y +71135 LA -6.0 Y +71136 LA -6.0 Y +71137 LA -6.0 Y +71138 LA -6.0 Y +71148 LA -6.0 Y +71149 LA -6.0 Y +71150 LA -6.0 Y +71151 LA -6.0 Y +71152 LA -6.0 Y +71153 LA -6.0 Y +71154 LA -6.0 Y +71156 LA -6.0 Y +71161 LA -6.0 Y +71162 LA -6.0 Y +71163 LA -6.0 Y +71164 LA -6.0 Y +71165 LA -6.0 Y +71166 LA -6.0 Y +71171 LA -6.0 Y +71172 LA -6.0 Y +71201 LA -6.0 Y +71202 LA -6.0 Y +71203 LA -6.0 Y +71207 LA -6.0 Y +71208 LA -6.0 Y +71209 LA -6.0 Y +71210 LA -6.0 Y +71211 LA -6.0 Y +71212 LA -6.0 Y +71213 LA -6.0 Y +71217 LA -6.0 Y +71218 LA -6.0 Y +71219 LA -6.0 Y +71220 LA -6.0 Y +71221 LA -6.0 Y +71222 LA -6.0 Y +71223 LA -6.0 Y +71225 LA -6.0 Y +71226 LA -6.0 Y +71227 LA -6.0 Y +71229 LA -6.0 Y +71230 LA -6.0 Y +71232 LA -6.0 Y +71233 LA -6.0 Y +71234 LA -6.0 Y +71235 LA -6.0 Y +71237 LA -6.0 Y +71238 LA -6.0 Y +71240 LA -6.0 Y +71241 LA -6.0 Y +71242 LA -6.0 Y +71243 LA -6.0 Y +71245 LA -6.0 Y +71247 LA -6.0 Y +71249 LA -6.0 Y +71250 LA -6.0 Y +71251 LA -6.0 Y +71253 LA -6.0 Y +71254 LA -6.0 Y +71256 LA -6.0 Y +71259 LA -6.0 Y +71260 LA -6.0 Y +71261 LA -6.0 Y +71263 LA -6.0 Y +71264 LA -6.0 Y +71266 LA -6.0 Y +71268 LA -6.0 Y +71269 LA -6.0 Y +71270 LA -6.0 Y +71272 LA -6.0 Y +71273 LA -6.0 Y +71275 LA -6.0 Y +71276 LA -6.0 Y +71277 LA -6.0 Y +71279 LA -6.0 Y +71280 LA -6.0 Y +71281 LA -6.0 Y +71282 LA -6.0 Y +71284 LA -6.0 Y +71286 LA -6.0 Y +71291 LA -6.0 Y +71292 LA -6.0 Y +71294 LA -6.0 Y +71295 LA -6.0 Y +71301 LA -6.0 Y +71302 LA -6.0 Y +71303 LA -6.0 Y +71306 LA -6.0 Y +71307 LA -6.0 Y +71309 LA -6.0 Y +71315 LA -6.0 Y +71316 LA -6.0 Y +71320 LA -6.0 Y +71322 LA -6.0 Y +71323 LA -6.0 Y +71324 LA -6.0 Y +71325 LA -6.0 Y +71326 LA -6.0 Y +71327 LA -6.0 Y +71328 LA -6.0 Y +71329 LA -6.0 Y +71330 LA -6.0 Y +71331 LA -6.0 Y +71333 LA -6.0 Y +71334 LA -6.0 Y +71336 LA -6.0 Y +71339 LA -6.0 Y +71340 LA -6.0 Y +71341 LA -6.0 Y +71342 LA -6.0 Y +71343 LA -6.0 Y +71345 LA -6.0 Y +71346 LA -6.0 Y +71348 LA -6.0 Y +71350 LA -6.0 Y +71351 LA -6.0 Y +71353 LA -6.0 Y +71354 LA -6.0 Y +71355 LA -6.0 Y +71356 LA -6.0 Y +71357 LA -6.0 Y +71358 LA -6.0 Y +71359 LA -6.0 Y +71360 LA -6.0 Y +71361 LA -6.0 Y +71362 LA -6.0 Y +71363 LA -6.0 Y +71365 LA -6.0 Y +71366 LA -6.0 Y +71367 LA -6.0 Y +71368 LA -6.0 Y +71369 LA -6.0 Y +71371 LA -6.0 Y +71373 LA -6.0 Y +71375 LA -6.0 Y +71377 LA -6.0 Y +71378 LA -6.0 Y +71401 LA -6.0 Y +71403 LA -6.0 Y +71404 LA -6.0 Y +71405 LA -6.0 Y +71406 LA -6.0 Y +71407 LA -6.0 Y +71409 LA -6.0 Y +71410 LA -6.0 Y +71411 LA -6.0 Y +71414 LA -6.0 Y +71415 LA -6.0 Y +71416 LA -6.0 Y +71417 LA -6.0 Y +71418 LA -6.0 Y +71419 LA -6.0 Y +71422 LA -6.0 Y +71423 LA -6.0 Y +71424 LA -6.0 Y +71425 LA -6.0 Y +71426 LA -6.0 Y +71427 LA -6.0 Y +71428 LA -6.0 Y +71429 LA -6.0 Y +71430 LA -6.0 Y +71431 LA -6.0 Y +71432 LA -6.0 Y +71433 LA -6.0 Y +71434 LA -6.0 Y +71435 LA -6.0 Y +71438 LA -6.0 Y +71439 LA -6.0 Y +71440 LA -6.0 Y +71441 LA -6.0 Y +71443 LA -6.0 Y +71446 LA -6.0 Y +71447 LA -6.0 Y +71448 LA -6.0 Y +71449 LA -6.0 Y +71450 LA -6.0 Y +71452 LA -6.0 Y +71454 LA -6.0 Y +71455 LA -6.0 Y +71456 LA -6.0 Y +71457 LA -6.0 Y +71458 LA -6.0 Y +71459 LA -6.0 Y +71460 LA -6.0 Y +71461 LA -6.0 Y +71462 LA -6.0 Y +71463 LA -6.0 Y +71465 LA -6.0 Y +71466 LA -6.0 Y +71467 LA -6.0 Y +71468 LA -6.0 Y +71469 LA -6.0 Y +71471 LA -6.0 Y +71472 LA -6.0 Y +71473 LA -6.0 Y +71474 LA -6.0 Y +71475 LA -6.0 Y +71477 LA -6.0 Y +71479 LA -6.0 Y +71480 LA -6.0 Y +71483 LA -6.0 Y +71485 LA -6.0 Y +71486 LA -6.0 Y +71496 LA -6.0 Y +71497 LA -6.0 Y +71601 AR -6.0 Y +71602 AR -6.0 Y +71603 AR -6.0 Y +71611 AR -6.0 Y +71612 AR -6.0 Y +71613 AR -6.0 Y +71630 AR -6.0 Y +71631 AR -6.0 Y +71635 AR -6.0 Y +71638 AR -6.0 Y +71639 AR -6.0 Y +71640 AR -6.0 Y +71642 AR -6.0 Y +71643 AR -6.0 Y +71644 AR -6.0 Y +71646 AR -6.0 Y +71647 AR -6.0 Y +71651 AR -6.0 Y +71652 AR -6.0 Y +71653 AR -6.0 Y +71654 AR -6.0 Y +71655 AR -6.0 Y +71656 AR -6.0 Y +71657 AR -6.0 Y +71658 AR -6.0 Y +71659 AR -6.0 Y +71660 AR -6.0 Y +71661 AR -6.0 Y +71662 AR -6.0 Y +71663 AR -6.0 Y +71665 AR -6.0 Y +71666 AR -6.0 Y +71667 AR -6.0 Y +71670 AR -6.0 Y +71671 AR -6.0 Y +71674 AR -6.0 Y +71675 AR -6.0 Y +71676 AR -6.0 Y +71677 AR -6.0 Y +71678 AR -6.0 Y +71701 AR -6.0 Y +71711 AR -6.0 Y +71720 AR -6.0 Y +71721 AR -6.0 Y +71722 AR -6.0 Y +71724 AR -6.0 Y +71725 AR -6.0 Y +71726 AR -6.0 Y +71728 AR -6.0 Y +71730 AR -6.0 Y +71731 AR -6.0 Y +71740 AR -6.0 Y +71742 AR -6.0 Y +71743 AR -6.0 Y +71744 AR -6.0 Y +71745 AR -6.0 Y +71747 AR -6.0 Y +71748 AR -6.0 Y +71749 AR -6.0 Y +71750 AR -6.0 Y +71751 AR -6.0 Y +71752 AR -6.0 Y +71753 AR -6.0 Y +71754 AR -6.0 Y +71758 AR -6.0 Y +71759 AR -6.0 Y +71762 AR -6.0 Y +71763 AR -6.0 Y +71764 AR -6.0 Y +71765 AR -6.0 Y +71766 AR -6.0 Y +71768 AR -6.0 Y +71770 AR -6.0 Y +71772 AR -6.0 Y +71801 AR -6.0 Y +71802 AR -6.0 Y +71820 AR -6.0 Y +71822 AR -6.0 Y +71823 AR -6.0 Y +71825 AR -6.0 Y +71826 AR -6.0 Y +71827 AR -6.0 Y +71828 AR -6.0 Y +71831 AR -6.0 Y +71832 AR -6.0 Y +71833 AR -6.0 Y +71834 AR -6.0 Y +71835 AR -6.0 Y +71836 AR -6.0 Y +71837 AR -6.0 Y +71838 AR -6.0 Y +71839 AR -6.0 Y +71840 AR -6.0 Y +71841 AR -6.0 Y +71842 AR -6.0 Y +71844 AR -6.0 Y +71845 AR -6.0 Y +71846 AR -6.0 Y +71847 AR -6.0 Y +71851 AR -6.0 Y +71852 AR -6.0 Y +71853 AR -6.0 Y +71854 AR -6.0 Y +71855 AR -6.0 Y +71857 AR -6.0 Y +71858 AR -6.0 Y +71859 AR -6.0 Y +71860 AR -6.0 Y +71861 AR -6.0 Y +71862 AR -6.0 Y +71864 AR -6.0 Y +71865 AR -6.0 Y +71866 AR -6.0 Y +71901 AR -6.0 Y +71902 AR -6.0 Y +71903 AR -6.0 Y +71909 AR -6.0 Y +71910 AR -6.0 Y +71913 AR -6.0 Y +71914 AR -6.0 Y +71920 AR -6.0 Y +71921 AR -6.0 Y +71922 AR -6.0 Y +71923 AR -6.0 Y +71929 AR -6.0 Y +71932 AR -6.0 Y +71933 AR -6.0 Y +71935 AR -6.0 Y +71937 AR -6.0 Y +71940 AR -6.0 Y +71941 AR -6.0 Y +71942 AR -6.0 Y +71943 AR -6.0 Y +71944 AR -6.0 Y +71945 AR -6.0 Y +71949 AR -6.0 Y +71950 AR -6.0 Y +71951 AR -6.0 Y +71952 AR -6.0 Y +71953 AR -6.0 Y +71956 AR -6.0 Y +71957 AR -6.0 Y +71958 AR -6.0 Y +71959 AR -6.0 Y +71960 AR -6.0 Y +71961 AR -6.0 Y +71962 AR -6.0 Y +71964 AR -6.0 Y +71965 AR -6.0 Y +71966 AR -6.0 Y +71968 AR -6.0 Y +71969 AR -6.0 Y +71970 AR -6.0 Y +71971 AR -6.0 Y +71972 AR -6.0 Y +71973 AR -6.0 Y +71998 AR -6.0 Y +71999 AR -6.0 Y +72001 AR -6.0 Y +72002 AR -6.0 Y +72003 AR -6.0 Y +72004 AR -6.0 Y +72005 AR -6.0 Y +72006 AR -6.0 Y +72007 AR -6.0 Y +72010 AR -6.0 Y +72011 AR -6.0 Y +72012 AR -6.0 Y +72013 AR -6.0 Y +72014 AR -6.0 Y +72015 AR -6.0 Y +72016 AR -6.0 Y +72017 AR -6.0 Y +72018 AR -6.0 Y +72019 AR -6.0 Y +72020 AR -6.0 Y +72021 AR -6.0 Y +72022 AR -6.0 Y +72023 AR -6.0 Y +72024 AR -6.0 Y +72025 AR -6.0 Y +72026 AR -6.0 Y +72027 AR -6.0 Y +72028 AR -6.0 Y +72029 AR -6.0 Y +72030 AR -6.0 Y +72031 AR -6.0 Y +72032 AR -6.0 Y +72033 AR -6.0 Y +72034 AR -6.0 Y +72035 AR -6.0 Y +72036 AR -6.0 Y +72037 AR -6.0 Y +72038 AR -6.0 Y +72039 AR -6.0 Y +72040 AR -6.0 Y +72041 AR -6.0 Y +72042 AR -6.0 Y +72043 AR -6.0 Y +72044 AR -6.0 Y +72045 AR -6.0 Y +72046 AR -6.0 Y +72047 AR -6.0 Y +72048 AR -6.0 Y +72051 AR -6.0 Y +72052 AR -6.0 Y +72053 AR -6.0 Y +72055 AR -6.0 Y +72057 AR -6.0 Y +72058 AR -6.0 Y +72059 AR -6.0 Y +72060 AR -6.0 Y +72061 AR -6.0 Y +72063 AR -6.0 Y +72064 AR -6.0 Y +72065 AR -6.0 Y +72066 AR -6.0 Y +72067 AR -6.0 Y +72068 AR -6.0 Y +72069 AR -6.0 Y +72070 AR -6.0 Y +72072 AR -6.0 Y +72073 AR -6.0 Y +72074 AR -6.0 Y +72075 AR -6.0 Y +72076 AR -6.0 Y +72078 AR -6.0 Y +72079 AR -6.0 Y +72080 AR -6.0 Y +72081 AR -6.0 Y +72082 AR -6.0 Y +72083 AR -6.0 Y +72084 AR -6.0 Y +72085 AR -6.0 Y +72086 AR -6.0 Y +72087 AR -6.0 Y +72088 AR -6.0 Y +72089 AR -6.0 Y +72099 AR -6.0 Y +72101 AR -6.0 Y +72102 AR -6.0 Y +72103 AR -6.0 Y +72104 AR -6.0 Y +72105 AR -6.0 Y +72106 AR -6.0 Y +72107 AR -6.0 Y +72108 AR -6.0 Y +72110 AR -6.0 Y +72111 AR -6.0 Y +72112 AR -6.0 Y +72113 AR -6.0 Y +72114 AR -6.0 Y +72115 AR -6.0 Y +72116 AR -6.0 Y +72117 AR -6.0 Y +72118 AR -6.0 Y +72119 AR -6.0 Y +72120 AR -6.0 Y +72121 AR -6.0 Y +72122 AR -6.0 Y +72123 AR -6.0 Y +72124 AR -6.0 Y +72125 AR -6.0 Y +72126 AR -6.0 Y +72127 AR -6.0 Y +72128 AR -6.0 Y +72129 AR -6.0 Y +72130 AR -6.0 Y +72131 AR -6.0 Y +72132 AR -6.0 Y +72133 AR -6.0 Y +72134 AR -6.0 Y +72135 AR -6.0 Y +72136 AR -6.0 Y +72137 AR -6.0 Y +72139 AR -6.0 Y +72140 AR -6.0 Y +72141 AR -6.0 Y +72142 AR -6.0 Y +72143 AR -6.0 Y +72145 AR -6.0 Y +72149 AR -6.0 Y +72150 AR -6.0 Y +72152 AR -6.0 Y +72153 AR -6.0 Y +72156 AR -6.0 Y +72157 AR -6.0 Y +72158 AR -6.0 Y +72160 AR -6.0 Y +72164 AR -6.0 Y +72165 AR -6.0 Y +72166 AR -6.0 Y +72167 AR -6.0 Y +72168 AR -6.0 Y +72169 AR -6.0 Y +72170 AR -6.0 Y +72173 AR -6.0 Y +72175 AR -6.0 Y +72176 AR -6.0 Y +72178 AR -6.0 Y +72179 AR -6.0 Y +72180 AR -6.0 Y +72181 AR -6.0 Y +72182 AR -6.0 Y +72183 AR -6.0 Y +72189 AR -6.0 Y +72190 AR -6.0 Y +72198 AR -6.0 Y +72199 AR -6.0 Y +72201 AR -6.0 Y +72202 AR -6.0 Y +72203 AR -6.0 Y +72204 AR -6.0 Y +72205 AR -6.0 Y +72206 AR -6.0 Y +72207 AR -6.0 Y +72209 AR -6.0 Y +72210 AR -6.0 Y +72211 AR -6.0 Y +72212 AR -6.0 Y +72214 AR -6.0 Y +72215 AR -6.0 Y +72216 AR -6.0 Y +72217 AR -6.0 Y +72219 AR -6.0 Y +72221 AR -6.0 Y +72222 AR -6.0 Y +72223 AR -6.0 Y +72225 AR -6.0 Y +72227 AR -6.0 Y +72231 AR -6.0 Y +72260 AR -6.0 Y +72295 AR -6.0 Y +72301 AR -6.0 Y +72303 AR -6.0 Y +72310 AR -6.0 Y +72311 AR -6.0 Y +72312 AR -6.0 Y +72313 AR -6.0 Y +72315 AR -6.0 Y +72316 AR -6.0 Y +72319 AR -6.0 Y +72320 AR -6.0 Y +72321 AR -6.0 Y +72322 AR -6.0 Y +72324 AR -6.0 Y +72325 AR -6.0 Y +72326 AR -6.0 Y +72327 AR -6.0 Y +72328 AR -6.0 Y +72329 AR -6.0 Y +72330 AR -6.0 Y +72331 AR -6.0 Y +72332 AR -6.0 Y +72333 AR -6.0 Y +72335 AR -6.0 Y +72336 AR -6.0 Y +72338 AR -6.0 Y +72339 AR -6.0 Y +72340 AR -6.0 Y +72341 AR -6.0 Y +72342 AR -6.0 Y +72346 AR -6.0 Y +72347 AR -6.0 Y +72348 AR -6.0 Y +72350 AR -6.0 Y +72351 AR -6.0 Y +72352 AR -6.0 Y +72353 AR -6.0 Y +72354 AR -6.0 Y +72355 AR -6.0 Y +72358 AR -6.0 Y +72359 AR -6.0 Y +72360 AR -6.0 Y +72364 AR -6.0 Y +72365 AR -6.0 Y +72366 AR -6.0 Y +72367 AR -6.0 Y +72368 AR -6.0 Y +72369 AR -6.0 Y +72370 AR -6.0 Y +72372 AR -6.0 Y +72373 AR -6.0 Y +72374 AR -6.0 Y +72376 AR -6.0 Y +72377 AR -6.0 Y +72379 AR -6.0 Y +72383 AR -6.0 Y +72384 AR -6.0 Y +72386 AR -6.0 Y +72387 AR -6.0 Y +72389 AR -6.0 Y +72390 AR -6.0 Y +72391 AR -6.0 Y +72392 AR -6.0 Y +72394 AR -6.0 Y +72395 AR -6.0 Y +72396 AR -6.0 Y +72401 AR -6.0 Y +72402 AR -6.0 Y +72403 AR -6.0 Y +72404 AR -6.0 Y +72410 AR -6.0 Y +72411 AR -6.0 Y +72412 AR -6.0 Y +72413 AR -6.0 Y +72414 AR -6.0 Y +72415 AR -6.0 Y +72416 AR -6.0 Y +72417 AR -6.0 Y +72419 AR -6.0 Y +72421 AR -6.0 Y +72422 AR -6.0 Y +72424 AR -6.0 Y +72425 AR -6.0 Y +72426 AR -6.0 Y +72427 AR -6.0 Y +72428 AR -6.0 Y +72429 AR -6.0 Y +72430 AR -6.0 Y +72431 AR -6.0 Y +72432 AR -6.0 Y +72433 AR -6.0 Y +72434 AR -6.0 Y +72435 AR -6.0 Y +72436 AR -6.0 Y +72437 AR -6.0 Y +72438 AR -6.0 Y +72439 AR -6.0 Y +72440 AR -6.0 Y +72441 AR -6.0 Y +72442 AR -6.0 Y +72443 AR -6.0 Y +72444 AR -6.0 Y +72445 AR -6.0 Y +72447 AR -6.0 Y +72449 AR -6.0 Y +72450 AR -6.0 Y +72451 AR -6.0 Y +72453 AR -6.0 Y +72454 AR -6.0 Y +72455 AR -6.0 Y +72456 AR -6.0 Y +72457 AR -6.0 Y +72458 AR -6.0 Y +72459 AR -6.0 Y +72460 AR -6.0 Y +72461 AR -6.0 Y +72462 AR -6.0 Y +72464 AR -6.0 Y +72465 AR -6.0 Y +72466 AR -6.0 Y +72467 AR -6.0 Y +72469 AR -6.0 Y +72470 AR -6.0 Y +72471 AR -6.0 Y +72472 AR -6.0 Y +72473 AR -6.0 Y +72474 AR -6.0 Y +72475 AR -6.0 Y +72476 AR -6.0 Y +72478 AR -6.0 Y +72479 AR -6.0 Y +72482 AR -6.0 Y +72501 AR -6.0 Y +72503 AR -6.0 Y +72512 AR -6.0 Y +72513 AR -6.0 Y +72515 AR -6.0 Y +72517 AR -6.0 Y +72519 AR -6.0 Y +72520 AR -6.0 Y +72521 AR -6.0 Y +72522 AR -6.0 Y +72523 AR -6.0 Y +72524 AR -6.0 Y +72525 AR -6.0 Y +72526 AR -6.0 Y +72527 AR -6.0 Y +72528 AR -6.0 Y +72529 AR -6.0 Y +72530 AR -6.0 Y +72531 AR -6.0 Y +72532 AR -6.0 Y +72533 AR -6.0 Y +72534 AR -6.0 Y +72536 AR -6.0 Y +72537 AR -6.0 Y +72538 AR -6.0 Y +72539 AR -6.0 Y +72540 AR -6.0 Y +72542 AR -6.0 Y +72543 AR -6.0 Y +72544 AR -6.0 Y +72545 AR -6.0 Y +72546 AR -6.0 Y +72550 AR -6.0 Y +72553 AR -6.0 Y +72554 AR -6.0 Y +72555 AR -6.0 Y +72556 AR -6.0 Y +72560 AR -6.0 Y +72561 AR -6.0 Y +72562 AR -6.0 Y +72564 AR -6.0 Y +72565 AR -6.0 Y +72566 AR -6.0 Y +72567 AR -6.0 Y +72568 AR -6.0 Y +72569 AR -6.0 Y +72571 AR -6.0 Y +72572 AR -6.0 Y +72573 AR -6.0 Y +72575 AR -6.0 Y +72576 AR -6.0 Y +72577 AR -6.0 Y +72578 AR -6.0 Y +72579 AR -6.0 Y +72581 AR -6.0 Y +72583 AR -6.0 Y +72584 AR -6.0 Y +72585 AR -6.0 Y +72587 AR -6.0 Y +72601 AR -6.0 Y +72602 AR -6.0 Y +72611 AR -6.0 Y +72613 AR -6.0 Y +72615 AR -6.0 Y +72616 AR -6.0 Y +72617 AR -6.0 Y +72619 AR -6.0 Y +72623 AR -6.0 Y +72624 AR -6.0 Y +72626 AR -6.0 Y +72628 AR -6.0 Y +72629 AR -6.0 Y +72630 AR -6.0 Y +72631 AR -6.0 Y +72632 AR -6.0 Y +72633 AR -6.0 Y +72634 AR -6.0 Y +72635 AR -6.0 Y +72636 AR -6.0 Y +72638 AR -6.0 Y +72639 AR -6.0 Y +72640 AR -6.0 Y +72641 AR -6.0 Y +72642 AR -6.0 Y +72644 AR -6.0 Y +72645 AR -6.0 Y +72648 AR -6.0 Y +72650 AR -6.0 Y +72651 AR -6.0 Y +72653 AR -6.0 Y +72654 AR -6.0 Y +72655 AR -6.0 Y +72657 AR -6.0 Y +72658 AR -6.0 Y +72659 AR -6.0 Y +72660 AR -6.0 Y +72661 AR -6.0 Y +72662 AR -6.0 Y +72663 AR -6.0 Y +72666 AR -6.0 Y +72668 AR -6.0 Y +72669 AR -6.0 Y +72670 AR -6.0 Y +72672 AR -6.0 Y +72675 AR -6.0 Y +72677 AR -6.0 Y +72679 AR -6.0 Y +72680 AR -6.0 Y +72682 AR -6.0 Y +72683 AR -6.0 Y +72685 AR -6.0 Y +72686 AR -6.0 Y +72687 AR -6.0 Y +72701 AR -6.0 Y +72702 AR -6.0 Y +72703 AR -6.0 Y +72704 AR -6.0 Y +72711 AR -6.0 Y +72712 AR -6.0 Y +72714 AR -6.0 Y +72715 AR -6.0 Y +72716 AR -6.0 Y +72717 AR -6.0 Y +72718 AR -6.0 Y +72719 AR -6.0 Y +72721 AR -6.0 Y +72722 AR -6.0 Y +72727 AR -6.0 Y +72728 AR -6.0 Y +72729 AR -6.0 Y +72730 AR -6.0 Y +72732 AR -6.0 Y +72733 AR -6.0 Y +72734 AR -6.0 Y +72735 AR -6.0 Y +72736 AR -6.0 Y +72737 AR -6.0 Y +72738 AR -6.0 Y +72739 AR -6.0 Y +72740 AR -6.0 Y +72741 AR -6.0 Y +72742 AR -6.0 Y +72744 AR -6.0 Y +72745 AR -6.0 Y +72747 AR -6.0 Y +72749 AR -6.0 Y +72751 AR -6.0 Y +72752 AR -6.0 Y +72753 AR -6.0 Y +72756 AR -6.0 Y +72757 AR -6.0 Y +72758 AR -6.0 Y +72760 AR -6.0 Y +72761 AR -6.0 Y +72762 AR -6.0 Y +72764 AR -6.0 Y +72765 AR -6.0 Y +72766 AR -6.0 Y +72768 AR -6.0 Y +72769 AR -6.0 Y +72770 AR -6.0 Y +72773 AR -6.0 Y +72774 AR -6.0 Y +72776 AR -6.0 Y +72801 AR -6.0 Y +72802 AR -6.0 Y +72811 AR -6.0 Y +72812 AR -6.0 Y +72820 AR -6.0 Y +72821 AR -6.0 Y +72823 AR -6.0 Y +72824 AR -6.0 Y +72826 AR -6.0 Y +72827 AR -6.0 Y +72828 AR -6.0 Y +72829 AR -6.0 Y +72830 AR -6.0 Y +72832 AR -6.0 Y +72833 AR -6.0 Y +72834 AR -6.0 Y +72835 AR -6.0 Y +72837 AR -6.0 Y +72838 AR -6.0 Y +72839 AR -6.0 Y +72840 AR -6.0 Y +72841 AR -6.0 Y +72842 AR -6.0 Y +72843 AR -6.0 Y +72845 AR -6.0 Y +72846 AR -6.0 Y +72847 AR -6.0 Y +72851 AR -6.0 Y +72852 AR -6.0 Y +72853 AR -6.0 Y +72854 AR -6.0 Y +72855 AR -6.0 Y +72856 AR -6.0 Y +72857 AR -6.0 Y +72858 AR -6.0 Y +72860 AR -6.0 Y +72863 AR -6.0 Y +72865 AR -6.0 Y +72901 AR -6.0 Y +72902 AR -6.0 Y +72903 AR -6.0 Y +72904 AR -6.0 Y +72905 AR -6.0 Y +72906 AR -6.0 Y +72908 AR -6.0 Y +72913 AR -6.0 Y +72914 AR -6.0 Y +72916 AR -6.0 Y +72917 AR -6.0 Y +72918 AR -6.0 Y +72919 AR -6.0 Y +72921 AR -6.0 Y +72923 AR -6.0 Y +72926 AR -6.0 Y +72927 AR -6.0 Y +72928 AR -6.0 Y +72930 AR -6.0 Y +72932 AR -6.0 Y +72933 AR -6.0 Y +72934 AR -6.0 Y +72935 AR -6.0 Y +72936 AR -6.0 Y +72937 AR -6.0 Y +72938 AR -6.0 Y +72940 AR -6.0 Y +72941 AR -6.0 Y +72943 AR -6.0 Y +72944 AR -6.0 Y +72945 AR -6.0 Y +72946 AR -6.0 Y +72947 AR -6.0 Y +72948 AR -6.0 Y +72949 AR -6.0 Y +72950 AR -6.0 Y +72951 AR -6.0 Y +72952 AR -6.0 Y +72955 AR -6.0 Y +72956 AR -6.0 Y +72957 AR -6.0 Y +72958 AR -6.0 Y +72959 AR -6.0 Y +73001 OK -6.0 Y +73002 OK -6.0 Y +73003 OK -6.0 Y +73004 OK -6.0 Y +73005 OK -6.0 Y +73006 OK -6.0 Y +73007 OK -6.0 Y +73008 OK -6.0 Y +73009 OK -6.0 Y +73010 OK -6.0 Y +73011 OK -6.0 Y +73013 OK -6.0 Y +73014 OK -6.0 Y +73015 OK -6.0 Y +73016 OK -6.0 Y +73017 OK -6.0 Y +73018 OK -6.0 Y +73019 OK -6.0 Y +73020 OK -6.0 Y +73021 OK -6.0 Y +73022 OK -6.0 Y +73023 OK -6.0 Y +73024 OK -6.0 Y +73026 OK -6.0 Y +73027 OK -6.0 Y +73028 OK -6.0 Y +73029 OK -6.0 Y +73030 OK -6.0 Y +73031 OK -6.0 Y +73032 OK -6.0 Y +73033 OK -6.0 Y +73034 OK -6.0 Y +73036 OK -6.0 Y +73038 OK -6.0 Y +73039 OK -6.0 Y +73040 OK -6.0 Y +73041 OK -6.0 Y +73042 OK -6.0 Y +73043 OK -6.0 Y +73044 OK -6.0 Y +73045 OK -6.0 Y +73047 OK -6.0 Y +73048 OK -6.0 Y +73049 OK -6.0 Y +73050 OK -6.0 Y +73051 OK -6.0 Y +73052 OK -6.0 Y +73053 OK -6.0 Y +73054 OK -6.0 Y +73055 OK -6.0 Y +73056 OK -6.0 Y +73057 OK -6.0 Y +73058 OK -6.0 Y +73059 OK -6.0 Y +73061 OK -6.0 Y +73062 OK -6.0 Y +73063 OK -6.0 Y +73064 OK -6.0 Y +73065 OK -6.0 Y +73066 OK -6.0 Y +73067 OK -6.0 Y +73068 OK -6.0 Y +73069 OK -6.0 Y +73070 OK -6.0 Y +73071 OK -6.0 Y +73072 OK -6.0 Y +73073 OK -6.0 Y +73074 OK -6.0 Y +73075 OK -6.0 Y +73077 OK -6.0 Y +73078 OK -6.0 Y +73079 OK -6.0 Y +73080 OK -6.0 Y +73082 OK -6.0 Y +73083 OK -6.0 Y +73084 OK -6.0 Y +73085 OK -6.0 Y +73086 OK -6.0 Y +73089 OK -6.0 Y +73090 OK -6.0 Y +73092 OK -6.0 Y +73093 OK -6.0 Y +73094 OK -6.0 Y +73095 OK -6.0 Y +73096 OK -6.0 Y +73097 OK -6.0 Y +73098 OK -6.0 Y +73099 OK -6.0 Y +73101 OK -6.0 Y +73102 OK -6.0 Y +73103 OK -6.0 Y +73104 OK -6.0 Y +73105 OK -6.0 Y +73106 OK -6.0 Y +73107 OK -6.0 Y +73108 OK -6.0 Y +73109 OK -6.0 Y +73110 OK -6.0 Y +73111 OK -6.0 Y +73112 OK -6.0 Y +73113 OK -6.0 Y +73114 OK -6.0 Y +73115 OK -6.0 Y +73116 OK -6.0 Y +73117 OK -6.0 Y +73118 OK -6.0 Y +73119 OK -6.0 Y +73120 OK -6.0 Y +73121 OK -6.0 Y +73122 OK -6.0 Y +73123 OK -6.0 Y +73124 OK -6.0 Y +73125 OK -6.0 Y +73126 OK -6.0 Y +73127 OK -6.0 Y +73128 OK -6.0 Y +73129 OK -6.0 Y +73130 OK -6.0 Y +73131 OK -6.0 Y +73132 OK -6.0 Y +73134 OK -6.0 Y +73135 OK -6.0 Y +73136 OK -6.0 Y +73137 OK -6.0 Y +73139 OK -6.0 Y +73140 OK -6.0 Y +73141 OK -6.0 Y +73142 OK -6.0 Y +73143 OK -6.0 Y +73144 OK -6.0 Y +73145 OK -6.0 Y +73146 OK -6.0 Y +73147 OK -6.0 Y +73148 OK -6.0 Y +73149 OK -6.0 Y +73150 OK -6.0 Y +73151 OK -6.0 Y +73152 OK -6.0 Y +73153 OK -6.0 Y +73154 OK -6.0 Y +73155 OK -6.0 Y +73156 OK -6.0 Y +73157 OK -6.0 Y +73159 OK -6.0 Y +73160 OK -6.0 Y +73162 OK -6.0 Y +73163 OK -6.0 Y +73164 OK -6.0 Y +73165 OK -6.0 Y +73167 OK -6.0 Y +73169 OK -6.0 Y +73170 OK -6.0 Y +73172 OK -6.0 Y +73173 OK -6.0 Y +73178 OK -6.0 Y +73179 OK -6.0 Y +73184 OK -6.0 Y +73185 OK -6.0 Y +73189 OK -6.0 Y +73190 OK -6.0 Y +73193 OK -6.0 Y +73194 OK -6.0 Y +73195 OK -6.0 Y +73196 OK -6.0 Y +73197 OK -6.0 Y +73198 OK -6.0 Y +73199 OK -6.0 Y +73301 TX -6.0 Y +73344 TX -6.0 Y +73401 OK -6.0 Y +73402 OK -6.0 Y +73403 OK -6.0 Y +73425 OK -6.0 Y +73430 OK -6.0 Y +73432 OK -6.0 Y +73433 OK -6.0 Y +73434 OK -6.0 Y +73435 OK -6.0 Y +73436 OK -6.0 Y +73437 OK -6.0 Y +73438 OK -6.0 Y +73439 OK -6.0 Y +73440 OK -6.0 Y +73441 OK -6.0 Y +73442 OK -6.0 Y +73443 OK -6.0 Y +73444 OK -6.0 Y +73446 OK -6.0 Y +73447 OK -6.0 Y +73448 OK -6.0 Y +73449 OK -6.0 Y +73450 OK -6.0 Y +73453 OK -6.0 Y +73455 OK -6.0 Y +73456 OK -6.0 Y +73458 OK -6.0 Y +73459 OK -6.0 Y +73460 OK -6.0 Y +73461 OK -6.0 Y +73463 OK -6.0 Y +73481 OK -6.0 Y +73487 OK -6.0 Y +73488 OK -6.0 Y +73491 OK -6.0 Y +73501 OK -6.0 Y +73502 OK -6.0 Y +73503 OK -6.0 Y +73505 OK -6.0 Y +73506 OK -6.0 Y +73507 OK -6.0 Y +73520 OK -6.0 Y +73521 OK -6.0 Y +73522 OK -6.0 Y +73523 OK -6.0 Y +73526 OK -6.0 Y +73527 OK -6.0 Y +73528 OK -6.0 Y +73529 OK -6.0 Y +73530 OK -6.0 Y +73531 OK -6.0 Y +73532 OK -6.0 Y +73533 OK -6.0 Y +73534 OK -6.0 Y +73536 OK -6.0 Y +73537 OK -6.0 Y +73538 OK -6.0 Y +73539 OK -6.0 Y +73540 OK -6.0 Y +73541 OK -6.0 Y +73542 OK -6.0 Y +73543 OK -6.0 Y +73544 OK -6.0 Y +73546 OK -6.0 Y +73547 OK -6.0 Y +73548 OK -6.0 Y +73549 OK -6.0 Y +73550 OK -6.0 Y +73551 OK -6.0 Y +73552 OK -6.0 Y +73553 OK -6.0 Y +73554 OK -6.0 Y +73555 OK -6.0 Y +73556 OK -6.0 Y +73557 OK -6.0 Y +73558 OK -6.0 Y +73559 OK -6.0 Y +73560 OK -6.0 Y +73561 OK -6.0 Y +73562 OK -6.0 Y +73564 OK -6.0 Y +73565 OK -6.0 Y +73566 OK -6.0 Y +73567 OK -6.0 Y +73568 OK -6.0 Y +73569 OK -6.0 Y +73570 OK -6.0 Y +73571 OK -6.0 Y +73572 OK -6.0 Y +73573 OK -6.0 Y +73601 OK -6.0 Y +73620 OK -6.0 Y +73622 OK -6.0 Y +73624 OK -6.0 Y +73625 OK -6.0 Y +73626 OK -6.0 Y +73627 OK -6.0 Y +73628 OK -6.0 Y +73632 OK -6.0 Y +73638 OK -6.0 Y +73639 OK -6.0 Y +73641 OK -6.0 Y +73642 OK -6.0 Y +73644 OK -6.0 Y +73645 OK -6.0 Y +73646 OK -6.0 Y +73647 OK -6.0 Y +73648 OK -6.0 Y +73650 OK -6.0 Y +73651 OK -6.0 Y +73654 OK -6.0 Y +73655 OK -6.0 Y +73658 OK -6.0 Y +73659 OK -6.0 Y +73660 OK -6.0 Y +73661 OK -6.0 Y +73662 OK -6.0 Y +73663 OK -6.0 Y +73664 OK -6.0 Y +73666 OK -6.0 Y +73667 OK -6.0 Y +73668 OK -6.0 Y +73669 OK -6.0 Y +73673 OK -6.0 Y +73701 OK -6.0 Y +73702 OK -6.0 Y +73703 OK -6.0 Y +73705 OK -6.0 Y +73706 OK -6.0 Y +73716 OK -6.0 Y +73717 OK -6.0 Y +73718 OK -6.0 Y +73719 OK -6.0 Y +73720 OK -6.0 Y +73722 OK -6.0 Y +73724 OK -6.0 Y +73726 OK -6.0 Y +73727 OK -6.0 Y +73728 OK -6.0 Y +73729 OK -6.0 Y +73730 OK -6.0 Y +73731 OK -6.0 Y +73733 OK -6.0 Y +73734 OK -6.0 Y +73735 OK -6.0 Y +73736 OK -6.0 Y +73737 OK -6.0 Y +73738 OK -6.0 Y +73739 OK -6.0 Y +73741 OK -6.0 Y +73742 OK -6.0 Y +73743 OK -6.0 Y +73744 OK -6.0 Y +73746 OK -6.0 Y +73747 OK -6.0 Y +73749 OK -6.0 Y +73750 OK -6.0 Y +73753 OK -6.0 Y +73754 OK -6.0 Y +73755 OK -6.0 Y +73756 OK -6.0 Y +73757 OK -6.0 Y +73758 OK -6.0 Y +73759 OK -6.0 Y +73760 OK -6.0 Y +73761 OK -6.0 Y +73762 OK -6.0 Y +73763 OK -6.0 Y +73764 OK -6.0 Y +73766 OK -6.0 Y +73768 OK -6.0 Y +73770 OK -6.0 Y +73771 OK -6.0 Y +73772 OK -6.0 Y +73773 OK -6.0 Y +73801 OK -6.0 Y +73802 OK -6.0 Y +73832 OK -6.0 Y +73834 OK -6.0 Y +73835 OK -6.0 Y +73838 OK -6.0 Y +73840 OK -6.0 Y +73841 OK -6.0 Y +73842 OK -6.0 Y +73843 OK -6.0 Y +73844 OK -6.0 Y +73848 OK -6.0 Y +73851 OK -6.0 Y +73852 OK -6.0 Y +73853 OK -6.0 Y +73855 OK -6.0 Y +73857 OK -6.0 Y +73858 OK -6.0 Y +73859 OK -6.0 Y +73860 OK -6.0 Y +73901 OK -6.0 Y +73931 OK -6.0 Y +73932 OK -6.0 Y +73933 OK -6.0 Y +73937 OK -6.0 Y +73938 OK -6.0 Y +73939 OK -6.0 Y +73942 OK -6.0 Y +73944 OK -6.0 Y +73945 OK -6.0 Y +73946 OK -6.0 Y +73947 OK -6.0 Y +73949 OK -6.0 Y +73950 OK -6.0 Y +73951 OK -6.0 Y +74001 OK -6.0 Y +74002 OK -6.0 Y +74003 OK -6.0 Y +74004 OK -6.0 Y +74005 OK -6.0 Y +74006 OK -6.0 Y +74008 OK -6.0 Y +74010 OK -6.0 Y +74011 OK -6.0 Y +74012 OK -6.0 Y +74013 OK -6.0 Y +74014 OK -6.0 Y +74015 OK -6.0 Y +74016 OK -6.0 Y +74017 OK -6.0 Y +74018 OK -6.0 Y +74019 OK -6.0 Y +74020 OK -6.0 Y +74021 OK -6.0 Y +74022 OK -6.0 Y +74023 OK -6.0 Y +74026 OK -6.0 Y +74027 OK -6.0 Y +74028 OK -6.0 Y +74029 OK -6.0 Y +74030 OK -6.0 Y +74031 OK -6.0 Y +74032 OK -6.0 Y +74033 OK -6.0 Y +74034 OK -6.0 Y +74035 OK -6.0 Y +74036 OK -6.0 Y +74037 OK -6.0 Y +74038 OK -6.0 Y +74039 OK -6.0 Y +74041 OK -6.0 Y +74042 OK -6.0 Y +74043 OK -6.0 Y +74044 OK -6.0 Y +74045 OK -6.0 Y +74046 OK -6.0 Y +74047 OK -6.0 Y +74048 OK -6.0 Y +74050 OK -6.0 Y +74051 OK -6.0 Y +74052 OK -6.0 Y +74053 OK -6.0 Y +74054 OK -6.0 Y +74055 OK -6.0 Y +74056 OK -6.0 Y +74058 OK -6.0 Y +74059 OK -6.0 Y +74060 OK -6.0 Y +74061 OK -6.0 Y +74062 OK -6.0 Y +74063 OK -6.0 Y +74066 OK -6.0 Y +74067 OK -6.0 Y +74068 OK -6.0 Y +74070 OK -6.0 Y +74071 OK -6.0 Y +74072 OK -6.0 Y +74073 OK -6.0 Y +74074 OK -6.0 Y +74075 OK -6.0 Y +74076 OK -6.0 Y +74077 OK -6.0 Y +74078 OK -6.0 Y +74079 OK -6.0 Y +74080 OK -6.0 Y +74081 OK -6.0 Y +74082 OK -6.0 Y +74083 OK -6.0 Y +74084 OK -6.0 Y +74085 OK -6.0 Y +74101 OK -6.0 Y +74102 OK -6.0 Y +74103 OK -6.0 Y +74104 OK -6.0 Y +74105 OK -6.0 Y +74106 OK -6.0 Y +74107 OK -6.0 Y +74108 OK -6.0 Y +74110 OK -6.0 Y +74112 OK -6.0 Y +74114 OK -6.0 Y +74115 OK -6.0 Y +74116 OK -6.0 Y +74117 OK -6.0 Y +74119 OK -6.0 Y +74120 OK -6.0 Y +74121 OK -6.0 Y +74126 OK -6.0 Y +74127 OK -6.0 Y +74128 OK -6.0 Y +74129 OK -6.0 Y +74130 OK -6.0 Y +74131 OK -6.0 Y +74132 OK -6.0 Y +74133 OK -6.0 Y +74134 OK -6.0 Y +74135 OK -6.0 Y +74136 OK -6.0 Y +74137 OK -6.0 Y +74141 OK -6.0 Y +74145 OK -6.0 Y +74146 OK -6.0 Y +74147 OK -6.0 Y +74148 OK -6.0 Y +74149 OK -6.0 Y +74150 OK -6.0 Y +74152 OK -6.0 Y +74153 OK -6.0 Y +74155 OK -6.0 Y +74156 OK -6.0 Y +74157 OK -6.0 Y +74158 OK -6.0 Y +74159 OK -6.0 Y +74169 OK -6.0 Y +74170 OK -6.0 Y +74171 OK -6.0 Y +74172 OK -6.0 Y +74182 OK -6.0 Y +74183 OK -6.0 Y +74184 OK -6.0 Y +74186 OK -6.0 Y +74187 OK -6.0 Y +74189 OK -6.0 Y +74192 OK -6.0 Y +74193 OK -6.0 Y +74194 OK -6.0 Y +74301 OK -6.0 Y +74330 OK -6.0 Y +74331 OK -6.0 Y +74332 OK -6.0 Y +74333 OK -6.0 Y +74335 OK -6.0 Y +74337 OK -6.0 Y +74338 OK -6.0 Y +74339 OK -6.0 Y +74340 OK -6.0 Y +74342 OK -6.0 Y +74343 OK -6.0 Y +74344 OK -6.0 Y +74345 OK -6.0 Y +74346 OK -6.0 Y +74347 OK -6.0 Y +74349 OK -6.0 Y +74350 OK -6.0 Y +74352 OK -6.0 Y +74354 OK -6.0 Y +74355 OK -6.0 Y +74358 OK -6.0 Y +74359 OK -6.0 Y +74360 OK -6.0 Y +74361 OK -6.0 Y +74362 OK -6.0 Y +74363 OK -6.0 Y +74364 OK -6.0 Y +74365 OK -6.0 Y +74366 OK -6.0 Y +74367 OK -6.0 Y +74368 OK -6.0 Y +74369 OK -6.0 Y +74370 OK -6.0 Y +74401 OK -6.0 Y +74402 OK -6.0 Y +74403 OK -6.0 Y +74421 OK -6.0 Y +74422 OK -6.0 Y +74423 OK -6.0 Y +74425 OK -6.0 Y +74426 OK -6.0 Y +74427 OK -6.0 Y +74428 OK -6.0 Y +74429 OK -6.0 Y +74430 OK -6.0 Y +74431 OK -6.0 Y +74432 OK -6.0 Y +74434 OK -6.0 Y +74435 OK -6.0 Y +74436 OK -6.0 Y +74437 OK -6.0 Y +74438 OK -6.0 Y +74439 OK -6.0 Y +74440 OK -6.0 Y +74441 OK -6.0 Y +74442 OK -6.0 Y +74444 OK -6.0 Y +74445 OK -6.0 Y +74446 OK -6.0 Y +74447 OK -6.0 Y +74450 OK -6.0 Y +74451 OK -6.0 Y +74452 OK -6.0 Y +74454 OK -6.0 Y +74455 OK -6.0 Y +74456 OK -6.0 Y +74457 OK -6.0 Y +74458 OK -6.0 Y +74459 OK -6.0 Y +74460 OK -6.0 Y +74461 OK -6.0 Y +74462 OK -6.0 Y +74463 OK -6.0 Y +74464 OK -6.0 Y +74465 OK -6.0 Y +74467 OK -6.0 Y +74468 OK -6.0 Y +74469 OK -6.0 Y +74470 OK -6.0 Y +74471 OK -6.0 Y +74472 OK -6.0 Y +74477 OK -6.0 Y +74501 OK -6.0 Y +74502 OK -6.0 Y +74521 OK -6.0 Y +74522 OK -6.0 Y +74523 OK -6.0 Y +74525 OK -6.0 Y +74528 OK -6.0 Y +74529 OK -6.0 Y +74530 OK -6.0 Y +74531 OK -6.0 Y +74533 OK -6.0 Y +74534 OK -6.0 Y +74535 OK -6.0 Y +74536 OK -6.0 Y +74538 OK -6.0 Y +74540 OK -6.0 Y +74542 OK -6.0 Y +74543 OK -6.0 Y +74545 OK -6.0 Y +74546 OK -6.0 Y +74547 OK -6.0 Y +74549 OK -6.0 Y +74552 OK -6.0 Y +74553 OK -6.0 Y +74554 OK -6.0 Y +74555 OK -6.0 Y +74556 OK -6.0 Y +74557 OK -6.0 Y +74558 OK -6.0 Y +74559 OK -6.0 Y +74560 OK -6.0 Y +74561 OK -6.0 Y +74562 OK -6.0 Y +74563 OK -6.0 Y +74565 OK -6.0 Y +74567 OK -6.0 Y +74569 OK -6.0 Y +74570 OK -6.0 Y +74571 OK -6.0 Y +74572 OK -6.0 Y +74574 OK -6.0 Y +74576 OK -6.0 Y +74577 OK -6.0 Y +74578 OK -6.0 Y +74601 OK -6.0 Y +74602 OK -6.0 Y +74604 OK -6.0 Y +74630 OK -6.0 Y +74631 OK -6.0 Y +74632 OK -6.0 Y +74633 OK -6.0 Y +74636 OK -6.0 Y +74637 OK -6.0 Y +74640 OK -6.0 Y +74641 OK -6.0 Y +74643 OK -6.0 Y +74644 OK -6.0 Y +74646 OK -6.0 Y +74647 OK -6.0 Y +74650 OK -6.0 Y +74651 OK -6.0 Y +74652 OK -6.0 Y +74653 OK -6.0 Y +74701 OK -6.0 Y +74702 OK -6.0 Y +74720 OK -6.0 Y +74721 OK -6.0 Y +74722 OK -6.0 Y +74723 OK -6.0 Y +74724 OK -6.0 Y +74726 OK -6.0 Y +74727 OK -6.0 Y +74728 OK -6.0 Y +74729 OK -6.0 Y +74730 OK -6.0 Y +74731 OK -6.0 Y +74733 OK -6.0 Y +74734 OK -6.0 Y +74735 OK -6.0 Y +74736 OK -6.0 Y +74737 OK -6.0 Y +74738 OK -6.0 Y +74740 OK -6.0 Y +74741 OK -6.0 Y +74743 OK -6.0 Y +74745 OK -6.0 Y +74747 OK -6.0 Y +74748 OK -6.0 Y +74750 OK -6.0 Y +74752 OK -6.0 Y +74753 OK -6.0 Y +74754 OK -6.0 Y +74755 OK -6.0 Y +74756 OK -6.0 Y +74759 OK -6.0 Y +74760 OK -6.0 Y +74761 OK -6.0 Y +74764 OK -6.0 Y +74766 OK -6.0 Y +74801 OK -6.0 Y +74802 OK -6.0 Y +74804 OK -6.0 Y +74818 OK -6.0 Y +74820 OK -6.0 Y +74821 OK -6.0 Y +74824 OK -6.0 Y +74825 OK -6.0 Y +74826 OK -6.0 Y +74827 OK -6.0 Y +74829 OK -6.0 Y +74830 OK -6.0 Y +74831 OK -6.0 Y +74832 OK -6.0 Y +74833 OK -6.0 Y +74834 OK -6.0 Y +74836 OK -6.0 Y +74837 OK -6.0 Y +74839 OK -6.0 Y +74840 OK -6.0 Y +74842 OK -6.0 Y +74843 OK -6.0 Y +74844 OK -6.0 Y +74845 OK -6.0 Y +74848 OK -6.0 Y +74849 OK -6.0 Y +74850 OK -6.0 Y +74851 OK -6.0 Y +74852 OK -6.0 Y +74854 OK -6.0 Y +74855 OK -6.0 Y +74856 OK -6.0 Y +74857 OK -6.0 Y +74859 OK -6.0 Y +74860 OK -6.0 Y +74864 OK -6.0 Y +74865 OK -6.0 Y +74866 OK -6.0 Y +74867 OK -6.0 Y +74868 OK -6.0 Y +74869 OK -6.0 Y +74871 OK -6.0 Y +74872 OK -6.0 Y +74873 OK -6.0 Y +74875 OK -6.0 Y +74878 OK -6.0 Y +74880 OK -6.0 Y +74881 OK -6.0 Y +74883 OK -6.0 Y +74884 OK -6.0 Y +74901 OK -6.0 Y +74902 OK -6.0 Y +74930 OK -6.0 Y +74931 OK -6.0 Y +74932 OK -6.0 Y +74935 OK -6.0 Y +74936 OK -6.0 Y +74937 OK -6.0 Y +74939 OK -6.0 Y +74940 OK -6.0 Y +74941 OK -6.0 Y +74942 OK -6.0 Y +74943 OK -6.0 Y +74944 OK -6.0 Y +74945 OK -6.0 Y +74946 OK -6.0 Y +74947 OK -6.0 Y +74948 OK -6.0 Y +74949 OK -6.0 Y +74951 OK -6.0 Y +74953 OK -6.0 Y +74954 OK -6.0 Y +74955 OK -6.0 Y +74956 OK -6.0 Y +74957 OK -6.0 Y +74959 OK -6.0 Y +74960 OK -6.0 Y +74962 OK -6.0 Y +74963 OK -6.0 Y +74964 OK -6.0 Y +74965 OK -6.0 Y +74966 OK -6.0 Y +75001 TX -6.0 Y +75002 TX -6.0 Y +75006 TX -6.0 Y +75007 TX -6.0 Y +75009 TX -6.0 Y +75010 TX -6.0 Y +75011 TX -6.0 Y +75013 TX -6.0 Y +75014 TX -6.0 Y +75015 TX -6.0 Y +75016 TX -6.0 Y +75017 TX -6.0 Y +75019 TX -6.0 Y +75020 TX -6.0 Y +75021 TX -6.0 Y +75022 TX -6.0 Y +75023 TX -6.0 Y +75024 TX -6.0 Y +75025 TX -6.0 Y +75026 TX -6.0 Y +75027 TX -6.0 Y +75028 TX -6.0 Y +75029 TX -6.0 Y +75030 TX -6.0 Y +75032 TX -6.0 Y +75034 TX -6.0 Y +75035 TX -6.0 Y +75037 TX -6.0 Y +75038 TX -6.0 Y +75039 TX -6.0 Y +75040 TX -6.0 Y +75041 TX -6.0 Y +75042 TX -6.0 Y +75043 TX -6.0 Y +75044 TX -6.0 Y +75045 TX -6.0 Y +75046 TX -6.0 Y +75047 TX -6.0 Y +75048 TX -6.0 Y +75049 TX -6.0 Y +75050 TX -6.0 Y +75051 TX -6.0 Y +75052 TX -6.0 Y +75053 TX -6.0 Y +75054 TX -6.0 Y +75056 TX -6.0 Y +75057 TX -6.0 Y +75058 TX -6.0 Y +75060 TX -6.0 Y +75061 TX -6.0 Y +75062 TX -6.0 Y +75063 TX -6.0 Y +75065 TX -6.0 Y +75067 TX -6.0 Y +75068 TX -6.0 Y +75069 TX -6.0 Y +75070 TX -6.0 Y +75071 TX -6.0 Y +75074 TX -6.0 Y +75075 TX -6.0 Y +75076 TX -6.0 Y +75077 TX -6.0 Y +75078 TX -6.0 Y +75080 TX -6.0 Y +75081 TX -6.0 Y +75082 TX -6.0 Y +75083 TX -6.0 Y +75085 TX -6.0 Y +75086 TX -6.0 Y +75087 TX -6.0 Y +75088 TX -6.0 Y +75089 TX -6.0 Y +75090 TX -6.0 Y +75091 TX -6.0 Y +75092 TX -6.0 Y +75093 TX -6.0 Y +75094 TX -6.0 Y +75097 TX -6.0 Y +75098 TX -6.0 Y +75099 TX -6.0 Y +75101 TX -6.0 Y +75102 TX -6.0 Y +75103 TX -6.0 Y +75104 TX -6.0 Y +75105 TX -6.0 Y +75106 TX -6.0 Y +75109 TX -6.0 Y +75110 TX -6.0 Y +75114 TX -6.0 Y +75115 TX -6.0 Y +75116 TX -6.0 Y +75117 TX -6.0 Y +75118 TX -6.0 Y +75119 TX -6.0 Y +75120 TX -6.0 Y +75121 TX -6.0 Y +75123 TX -6.0 Y +75124 TX -6.0 Y +75125 TX -6.0 Y +75126 TX -6.0 Y +75127 TX -6.0 Y +75132 TX -6.0 Y +75134 TX -6.0 Y +75135 TX -6.0 Y +75137 TX -6.0 Y +75138 TX -6.0 Y +75140 TX -6.0 Y +75141 TX -6.0 Y +75142 TX -6.0 Y +75143 TX -6.0 Y +75144 TX -6.0 Y +75146 TX -6.0 Y +75147 TX -6.0 Y +75148 TX -6.0 Y +75149 TX -6.0 Y +75150 TX -6.0 Y +75151 TX -6.0 Y +75152 TX -6.0 Y +75153 TX -6.0 Y +75154 TX -6.0 Y +75155 TX -6.0 Y +75156 TX -6.0 Y +75157 TX -6.0 Y +75158 TX -6.0 Y +75159 TX -6.0 Y +75160 TX -6.0 Y +75161 TX -6.0 Y +75163 TX -6.0 Y +75164 TX -6.0 Y +75165 TX -6.0 Y +75166 TX -6.0 Y +75167 TX -6.0 Y +75168 TX -6.0 Y +75169 TX -6.0 Y +75172 TX -6.0 Y +75173 TX -6.0 Y +75180 TX -6.0 Y +75181 TX -6.0 Y +75182 TX -6.0 Y +75185 TX -6.0 Y +75187 TX -6.0 Y +75189 TX -6.0 Y +75201 TX -6.0 Y +75202 TX -6.0 Y +75203 TX -6.0 Y +75204 TX -6.0 Y +75205 TX -6.0 Y +75206 TX -6.0 Y +75207 TX -6.0 Y +75208 TX -6.0 Y +75209 TX -6.0 Y +75210 TX -6.0 Y +75211 TX -6.0 Y +75212 TX -6.0 Y +75214 TX -6.0 Y +75215 TX -6.0 Y +75216 TX -6.0 Y +75217 TX -6.0 Y +75218 TX -6.0 Y +75219 TX -6.0 Y +75220 TX -6.0 Y +75221 TX -6.0 Y +75222 TX -6.0 Y +75223 TX -6.0 Y +75224 TX -6.0 Y +75225 TX -6.0 Y +75226 TX -6.0 Y +75227 TX -6.0 Y +75228 TX -6.0 Y +75229 TX -6.0 Y +75230 TX -6.0 Y +75231 TX -6.0 Y +75232 TX -6.0 Y +75233 TX -6.0 Y +75234 TX -6.0 Y +75235 TX -6.0 Y +75236 TX -6.0 Y +75237 TX -6.0 Y +75238 TX -6.0 Y +75240 TX -6.0 Y +75241 TX -6.0 Y +75242 TX -6.0 Y +75243 TX -6.0 Y +75244 TX -6.0 Y +75245 TX -6.0 Y +75246 TX -6.0 Y +75247 TX -6.0 Y +75248 TX -6.0 Y +75249 TX -6.0 Y +75250 TX -6.0 Y +75251 TX -6.0 Y +75252 TX -6.0 Y +75253 TX -6.0 Y +75254 TX -6.0 Y +75258 TX -6.0 Y +75260 TX -6.0 Y +75261 TX -6.0 Y +75262 TX -6.0 Y +75263 TX -6.0 Y +75264 TX -6.0 Y +75265 TX -6.0 Y +75266 TX -6.0 Y +75267 TX -6.0 Y +75270 TX -6.0 Y +75275 TX -6.0 Y +75277 TX -6.0 Y +75283 TX -6.0 Y +75284 TX -6.0 Y +75285 TX -6.0 Y +75286 TX -6.0 Y +75287 TX -6.0 Y +75301 TX -6.0 Y +75303 TX -6.0 Y +75310 TX -6.0 Y +75312 TX -6.0 Y +75313 TX -6.0 Y +75315 TX -6.0 Y +75320 TX -6.0 Y +75323 TX -6.0 Y +75326 TX -6.0 Y +75334 TX -6.0 Y +75336 TX -6.0 Y +75339 TX -6.0 Y +75340 TX -6.0 Y +75342 TX -6.0 Y +75343 TX -6.0 Y +75344 TX -6.0 Y +75353 TX -6.0 Y +75354 TX -6.0 Y +75355 TX -6.0 Y +75356 TX -6.0 Y +75357 TX -6.0 Y +75358 TX -6.0 Y +75359 TX -6.0 Y +75360 TX -6.0 Y +75363 TX -6.0 Y +75364 TX -6.0 Y +75367 TX -6.0 Y +75368 TX -6.0 Y +75370 TX -6.0 Y +75371 TX -6.0 Y +75372 TX -6.0 Y +75373 TX -6.0 Y +75374 TX -6.0 Y +75376 TX -6.0 Y +75378 TX -6.0 Y +75379 TX -6.0 Y +75380 TX -6.0 Y +75381 TX -6.0 Y +75382 TX -6.0 Y +75386 TX -6.0 Y +75387 TX -6.0 Y +75388 TX -6.0 Y +75389 TX -6.0 Y +75390 TX -6.0 Y +75391 TX -6.0 Y +75392 TX -6.0 Y +75393 TX -6.0 Y +75394 TX -6.0 Y +75395 TX -6.0 Y +75396 TX -6.0 Y +75397 TX -6.0 Y +75398 TX -6.0 Y +75401 TX -6.0 Y +75402 TX -6.0 Y +75403 TX -6.0 Y +75404 TX -6.0 Y +75407 TX -6.0 Y +75409 TX -6.0 Y +75410 TX -6.0 Y +75411 TX -6.0 Y +75412 TX -6.0 Y +75413 TX -6.0 Y +75414 TX -6.0 Y +75415 TX -6.0 Y +75416 TX -6.0 Y +75417 TX -6.0 Y +75418 TX -6.0 Y +75420 TX -6.0 Y +75421 TX -6.0 Y +75422 TX -6.0 Y +75423 TX -6.0 Y +75424 TX -6.0 Y +75425 TX -6.0 Y +75426 TX -6.0 Y +75428 TX -6.0 Y +75429 TX -6.0 Y +75431 TX -6.0 Y +75432 TX -6.0 Y +75433 TX -6.0 Y +75434 TX -6.0 Y +75435 TX -6.0 Y +75436 TX -6.0 Y +75437 TX -6.0 Y +75438 TX -6.0 Y +75439 TX -6.0 Y +75440 TX -6.0 Y +75441 TX -6.0 Y +75442 TX -6.0 Y +75443 TX -6.0 Y +75444 TX -6.0 Y +75446 TX -6.0 Y +75447 TX -6.0 Y +75448 TX -6.0 Y +75449 TX -6.0 Y +75450 TX -6.0 Y +75451 TX -6.0 Y +75452 TX -6.0 Y +75453 TX -6.0 Y +75454 TX -6.0 Y +75455 TX -6.0 Y +75456 TX -6.0 Y +75457 TX -6.0 Y +75458 TX -6.0 Y +75459 TX -6.0 Y +75460 TX -6.0 Y +75461 TX -6.0 Y +75462 TX -6.0 Y +75468 TX -6.0 Y +75469 TX -6.0 Y +75470 TX -6.0 Y +75471 TX -6.0 Y +75472 TX -6.0 Y +75473 TX -6.0 Y +75474 TX -6.0 Y +75475 TX -6.0 Y +75476 TX -6.0 Y +75477 TX -6.0 Y +75478 TX -6.0 Y +75479 TX -6.0 Y +75480 TX -6.0 Y +75481 TX -6.0 Y +75482 TX -6.0 Y +75483 TX -6.0 Y +75485 TX -6.0 Y +75486 TX -6.0 Y +75487 TX -6.0 Y +75488 TX -6.0 Y +75489 TX -6.0 Y +75490 TX -6.0 Y +75491 TX -6.0 Y +75492 TX -6.0 Y +75493 TX -6.0 Y +75494 TX -6.0 Y +75495 TX -6.0 Y +75496 TX -6.0 Y +75497 TX -6.0 Y +75501 TX -6.0 Y +75503 TX -6.0 Y +75504 TX -6.0 Y +75505 TX -6.0 Y +75507 TX -6.0 Y +75550 TX -6.0 Y +75551 TX -6.0 Y +75554 TX -6.0 Y +75555 TX -6.0 Y +75556 TX -6.0 Y +75558 TX -6.0 Y +75559 TX -6.0 Y +75560 TX -6.0 Y +75561 TX -6.0 Y +75562 TX -6.0 Y +75563 TX -6.0 Y +75564 TX -6.0 Y +75565 TX -6.0 Y +75566 TX -6.0 Y +75567 TX -6.0 Y +75568 TX -6.0 Y +75569 TX -6.0 Y +75570 TX -6.0 Y +75571 TX -6.0 Y +75572 TX -6.0 Y +75573 TX -6.0 Y +75574 TX -6.0 Y +75599 TX -6.0 Y +75601 TX -6.0 Y +75602 TX -6.0 Y +75603 TX -6.0 Y +75604 TX -6.0 Y +75605 TX -6.0 Y +75606 TX -6.0 Y +75607 TX -6.0 Y +75608 TX -6.0 Y +75615 TX -6.0 Y +75630 TX -6.0 Y +75631 TX -6.0 Y +75633 TX -6.0 Y +75636 TX -6.0 Y +75637 TX -6.0 Y +75638 TX -6.0 Y +75639 TX -6.0 Y +75640 TX -6.0 Y +75641 TX -6.0 Y +75642 TX -6.0 Y +75643 TX -6.0 Y +75644 TX -6.0 Y +75645 TX -6.0 Y +75647 TX -6.0 Y +75650 TX -6.0 Y +75651 TX -6.0 Y +75652 TX -6.0 Y +75653 TX -6.0 Y +75654 TX -6.0 Y +75656 TX -6.0 Y +75657 TX -6.0 Y +75658 TX -6.0 Y +75659 TX -6.0 Y +75660 TX -6.0 Y +75661 TX -6.0 Y +75662 TX -6.0 Y +75663 TX -6.0 Y +75666 TX -6.0 Y +75667 TX -6.0 Y +75668 TX -6.0 Y +75669 TX -6.0 Y +75670 TX -6.0 Y +75671 TX -6.0 Y +75672 TX -6.0 Y +75680 TX -6.0 Y +75681 TX -6.0 Y +75682 TX -6.0 Y +75683 TX -6.0 Y +75684 TX -6.0 Y +75685 TX -6.0 Y +75686 TX -6.0 Y +75687 TX -6.0 Y +75688 TX -6.0 Y +75689 TX -6.0 Y +75691 TX -6.0 Y +75692 TX -6.0 Y +75693 TX -6.0 Y +75694 TX -6.0 Y +75701 TX -6.0 Y +75702 TX -6.0 Y +75703 TX -6.0 Y +75704 TX -6.0 Y +75705 TX -6.0 Y +75706 TX -6.0 Y +75707 TX -6.0 Y +75708 TX -6.0 Y +75709 TX -6.0 Y +75710 TX -6.0 Y +75711 TX -6.0 Y +75712 TX -6.0 Y +75713 TX -6.0 Y +75750 TX -6.0 Y +75751 TX -6.0 Y +75752 TX -6.0 Y +75754 TX -6.0 Y +75755 TX -6.0 Y +75756 TX -6.0 Y +75757 TX -6.0 Y +75758 TX -6.0 Y +75759 TX -6.0 Y +75760 TX -6.0 Y +75762 TX -6.0 Y +75763 TX -6.0 Y +75764 TX -6.0 Y +75765 TX -6.0 Y +75766 TX -6.0 Y +75770 TX -6.0 Y +75771 TX -6.0 Y +75772 TX -6.0 Y +75773 TX -6.0 Y +75778 TX -6.0 Y +75779 TX -6.0 Y +75780 TX -6.0 Y +75782 TX -6.0 Y +75783 TX -6.0 Y +75784 TX -6.0 Y +75785 TX -6.0 Y +75788 TX -6.0 Y +75789 TX -6.0 Y +75790 TX -6.0 Y +75791 TX -6.0 Y +75792 TX -6.0 Y +75797 TX -6.0 Y +75798 TX -6.0 Y +75799 TX -6.0 Y +75801 TX -6.0 Y +75802 TX -6.0 Y +75803 TX -6.0 Y +75831 TX -6.0 Y +75832 TX -6.0 Y +75833 TX -6.0 Y +75834 TX -6.0 Y +75835 TX -6.0 Y +75838 TX -6.0 Y +75839 TX -6.0 Y +75840 TX -6.0 Y +75844 TX -6.0 Y +75845 TX -6.0 Y +75846 TX -6.0 Y +75847 TX -6.0 Y +75848 TX -6.0 Y +75849 TX -6.0 Y +75850 TX -6.0 Y +75851 TX -6.0 Y +75852 TX -6.0 Y +75853 TX -6.0 Y +75855 TX -6.0 Y +75856 TX -6.0 Y +75858 TX -6.0 Y +75859 TX -6.0 Y +75860 TX -6.0 Y +75861 TX -6.0 Y +75862 TX -6.0 Y +75865 TX -6.0 Y +75880 TX -6.0 Y +75882 TX -6.0 Y +75884 TX -6.0 Y +75886 TX -6.0 Y +75901 TX -6.0 Y +75902 TX -6.0 Y +75903 TX -6.0 Y +75904 TX -6.0 Y +75915 TX -6.0 Y +75925 TX -6.0 Y +75926 TX -6.0 Y +75928 TX -6.0 Y +75929 TX -6.0 Y +75930 TX -6.0 Y +75931 TX -6.0 Y +75932 TX -6.0 Y +75933 TX -6.0 Y +75934 TX -6.0 Y +75935 TX -6.0 Y +75936 TX -6.0 Y +75937 TX -6.0 Y +75938 TX -6.0 Y +75939 TX -6.0 Y +75941 TX -6.0 Y +75942 TX -6.0 Y +75943 TX -6.0 Y +75944 TX -6.0 Y +75946 TX -6.0 Y +75948 TX -6.0 Y +75949 TX -6.0 Y +75951 TX -6.0 Y +75954 TX -6.0 Y +75956 TX -6.0 Y +75958 TX -6.0 Y +75959 TX -6.0 Y +75960 TX -6.0 Y +75961 TX -6.0 Y +75962 TX -6.0 Y +75963 TX -6.0 Y +75964 TX -6.0 Y +75965 TX -6.0 Y +75966 TX -6.0 Y +75968 TX -6.0 Y +75969 TX -6.0 Y +75972 TX -6.0 Y +75973 TX -6.0 Y +75974 TX -6.0 Y +75975 TX -6.0 Y +75976 TX -6.0 Y +75977 TX -6.0 Y +75978 TX -6.0 Y +75979 TX -6.0 Y +75980 TX -6.0 Y +75990 TX -6.0 Y +76001 TX -6.0 Y +76002 TX -6.0 Y +76003 TX -6.0 Y +76004 TX -6.0 Y +76005 TX -6.0 Y +76006 TX -6.0 Y +76007 TX -6.0 Y +76008 TX -6.0 Y +76009 TX -6.0 Y +76010 TX -6.0 Y +76011 TX -6.0 Y +76012 TX -6.0 Y +76013 TX -6.0 Y +76014 TX -6.0 Y +76015 TX -6.0 Y +76016 TX -6.0 Y +76017 TX -6.0 Y +76018 TX -6.0 Y +76019 TX -6.0 Y +76020 TX -6.0 Y +76021 TX -6.0 Y +76022 TX -6.0 Y +76023 TX -6.0 Y +76028 TX -6.0 Y +76031 TX -6.0 Y +76033 TX -6.0 Y +76034 TX -6.0 Y +76035 TX -6.0 Y +76036 TX -6.0 Y +76039 TX -6.0 Y +76040 TX -6.0 Y +76041 TX -6.0 Y +76043 TX -6.0 Y +76044 TX -6.0 Y +76048 TX -6.0 Y +76049 TX -6.0 Y +76050 TX -6.0 Y +76051 TX -6.0 Y +76052 TX -6.0 Y +76053 TX -6.0 Y +76054 TX -6.0 Y +76055 TX -6.0 Y +76058 TX -6.0 Y +76059 TX -6.0 Y +76060 TX -6.0 Y +76061 TX -6.0 Y +76063 TX -6.0 Y +76064 TX -6.0 Y +76065 TX -6.0 Y +76066 TX -6.0 Y +76067 TX -6.0 Y +76068 TX -6.0 Y +76070 TX -6.0 Y +76071 TX -6.0 Y +76073 TX -6.0 Y +76077 TX -6.0 Y +76078 TX -6.0 Y +76082 TX -6.0 Y +76084 TX -6.0 Y +76085 TX -6.0 Y +76086 TX -6.0 Y +76087 TX -6.0 Y +76088 TX -6.0 Y +76092 TX -6.0 Y +76093 TX -6.0 Y +76094 TX -6.0 Y +76095 TX -6.0 Y +76096 TX -6.0 Y +76097 TX -6.0 Y +76098 TX -6.0 Y +76099 TX -6.0 Y +76101 TX -6.0 Y +76102 TX -6.0 Y +76103 TX -6.0 Y +76104 TX -6.0 Y +76105 TX -6.0 Y +76106 TX -6.0 Y +76107 TX -6.0 Y +76108 TX -6.0 Y +76109 TX -6.0 Y +76110 TX -6.0 Y +76111 TX -6.0 Y +76112 TX -6.0 Y +76113 TX -6.0 Y +76114 TX -6.0 Y +76115 TX -6.0 Y +76116 TX -6.0 Y +76117 TX -6.0 Y +76118 TX -6.0 Y +76119 TX -6.0 Y +76120 TX -6.0 Y +76121 TX -6.0 Y +76122 TX -6.0 Y +76123 TX -6.0 Y +76124 TX -6.0 Y +76126 TX -6.0 Y +76127 TX -6.0 Y +76129 TX -6.0 Y +76130 TX -6.0 Y +76131 TX -6.0 Y +76132 TX -6.0 Y +76133 TX -6.0 Y +76134 TX -6.0 Y +76135 TX -6.0 Y +76136 TX -6.0 Y +76137 TX -6.0 Y +76140 TX -6.0 Y +76147 TX -6.0 Y +76148 TX -6.0 Y +76150 TX -6.0 Y +76155 TX -6.0 Y +76161 TX -6.0 Y +76162 TX -6.0 Y +76163 TX -6.0 Y +76164 TX -6.0 Y +76177 TX -6.0 Y +76179 TX -6.0 Y +76180 TX -6.0 Y +76181 TX -6.0 Y +76182 TX -6.0 Y +76185 TX -6.0 Y +76191 TX -6.0 Y +76192 TX -6.0 Y +76193 TX -6.0 Y +76195 TX -6.0 Y +76196 TX -6.0 Y +76197 TX -6.0 Y +76198 TX -6.0 Y +76199 TX -6.0 Y +76201 TX -6.0 Y +76202 TX -6.0 Y +76203 TX -6.0 Y +76204 TX -6.0 Y +76205 TX -6.0 Y +76206 TX -6.0 Y +76207 TX -6.0 Y +76208 TX -6.0 Y +76209 TX -6.0 Y +76210 TX -6.0 Y +76225 TX -6.0 Y +76226 TX -6.0 Y +76227 TX -6.0 Y +76228 TX -6.0 Y +76230 TX -6.0 Y +76233 TX -6.0 Y +76234 TX -6.0 Y +76238 TX -6.0 Y +76239 TX -6.0 Y +76240 TX -6.0 Y +76241 TX -6.0 Y +76244 TX -6.0 Y +76245 TX -6.0 Y +76246 TX -6.0 Y +76247 TX -6.0 Y +76248 TX -6.0 Y +76249 TX -6.0 Y +76250 TX -6.0 Y +76251 TX -6.0 Y +76252 TX -6.0 Y +76253 TX -6.0 Y +76255 TX -6.0 Y +76258 TX -6.0 Y +76259 TX -6.0 Y +76261 TX -6.0 Y +76262 TX -6.0 Y +76263 TX -6.0 Y +76264 TX -6.0 Y +76265 TX -6.0 Y +76266 TX -6.0 Y +76267 TX -6.0 Y +76268 TX -6.0 Y +76270 TX -6.0 Y +76271 TX -6.0 Y +76272 TX -6.0 Y +76273 TX -6.0 Y +76299 TX -6.0 Y +76301 TX -6.0 Y +76302 TX -6.0 Y +76305 TX -6.0 Y +76306 TX -6.0 Y +76307 TX -6.0 Y +76308 TX -6.0 Y +76309 TX -6.0 Y +76310 TX -6.0 Y +76311 TX -6.0 Y +76351 TX -6.0 Y +76352 TX -6.0 Y +76354 TX -6.0 Y +76357 TX -6.0 Y +76360 TX -6.0 Y +76363 TX -6.0 Y +76364 TX -6.0 Y +76365 TX -6.0 Y +76366 TX -6.0 Y +76367 TX -6.0 Y +76369 TX -6.0 Y +76370 TX -6.0 Y +76371 TX -6.0 Y +76372 TX -6.0 Y +76373 TX -6.0 Y +76374 TX -6.0 Y +76377 TX -6.0 Y +76379 TX -6.0 Y +76380 TX -6.0 Y +76384 TX -6.0 Y +76385 TX -6.0 Y +76388 TX -6.0 Y +76389 TX -6.0 Y +76401 TX -6.0 Y +76402 TX -6.0 Y +76424 TX -6.0 Y +76426 TX -6.0 Y +76427 TX -6.0 Y +76429 TX -6.0 Y +76430 TX -6.0 Y +76431 TX -6.0 Y +76432 TX -6.0 Y +76433 TX -6.0 Y +76435 TX -6.0 Y +76436 TX -6.0 Y +76437 TX -6.0 Y +76439 TX -6.0 Y +76442 TX -6.0 Y +76443 TX -6.0 Y +76444 TX -6.0 Y +76445 TX -6.0 Y +76446 TX -6.0 Y +76448 TX -6.0 Y +76449 TX -6.0 Y +76450 TX -6.0 Y +76452 TX -6.0 Y +76453 TX -6.0 Y +76454 TX -6.0 Y +76455 TX -6.0 Y +76457 TX -6.0 Y +76458 TX -6.0 Y +76459 TX -6.0 Y +76460 TX -6.0 Y +76461 TX -6.0 Y +76462 TX -6.0 Y +76463 TX -6.0 Y +76464 TX -6.0 Y +76465 TX -6.0 Y +76466 TX -6.0 Y +76467 TX -6.0 Y +76468 TX -6.0 Y +76469 TX -6.0 Y +76470 TX -6.0 Y +76471 TX -6.0 Y +76472 TX -6.0 Y +76474 TX -6.0 Y +76475 TX -6.0 Y +76476 TX -6.0 Y +76481 TX -6.0 Y +76483 TX -6.0 Y +76484 TX -6.0 Y +76485 TX -6.0 Y +76486 TX -6.0 Y +76487 TX -6.0 Y +76490 TX -6.0 Y +76491 TX -6.0 Y +76501 TX -6.0 Y +76502 TX -6.0 Y +76503 TX -6.0 Y +76504 TX -6.0 Y +76505 TX -6.0 Y +76508 TX -6.0 Y +76511 TX -6.0 Y +76513 TX -6.0 Y +76518 TX -6.0 Y +76519 TX -6.0 Y +76520 TX -6.0 Y +76522 TX -6.0 Y +76523 TX -6.0 Y +76524 TX -6.0 Y +76525 TX -6.0 Y +76526 TX -6.0 Y +76527 TX -6.0 Y +76528 TX -6.0 Y +76530 TX -6.0 Y +76531 TX -6.0 Y +76533 TX -6.0 Y +76534 TX -6.0 Y +76537 TX -6.0 Y +76538 TX -6.0 Y +76539 TX -6.0 Y +76540 TX -6.0 Y +76541 TX -6.0 Y +76542 TX -6.0 Y +76543 TX -6.0 Y +76544 TX -6.0 Y +76545 TX -6.0 Y +76546 TX -6.0 Y +76547 TX -6.0 Y +76548 TX -6.0 Y +76549 TX -6.0 Y +76550 TX -6.0 Y +76554 TX -6.0 Y +76556 TX -6.0 Y +76557 TX -6.0 Y +76558 TX -6.0 Y +76559 TX -6.0 Y +76561 TX -6.0 Y +76564 TX -6.0 Y +76565 TX -6.0 Y +76566 TX -6.0 Y +76567 TX -6.0 Y +76569 TX -6.0 Y +76570 TX -6.0 Y +76571 TX -6.0 Y +76573 TX -6.0 Y +76574 TX -6.0 Y +76577 TX -6.0 Y +76578 TX -6.0 Y +76579 TX -6.0 Y +76596 TX -6.0 Y +76597 TX -6.0 Y +76598 TX -6.0 Y +76599 TX -6.0 Y +76621 TX -6.0 Y +76622 TX -6.0 Y +76623 TX -6.0 Y +76624 TX -6.0 Y +76626 TX -6.0 Y +76627 TX -6.0 Y +76628 TX -6.0 Y +76629 TX -6.0 Y +76630 TX -6.0 Y +76631 TX -6.0 Y +76632 TX -6.0 Y +76633 TX -6.0 Y +76634 TX -6.0 Y +76635 TX -6.0 Y +76636 TX -6.0 Y +76637 TX -6.0 Y +76638 TX -6.0 Y +76639 TX -6.0 Y +76640 TX -6.0 Y +76641 TX -6.0 Y +76642 TX -6.0 Y +76643 TX -6.0 Y +76644 TX -6.0 Y +76645 TX -6.0 Y +76648 TX -6.0 Y +76649 TX -6.0 Y +76650 TX -6.0 Y +76651 TX -6.0 Y +76652 TX -6.0 Y +76653 TX -6.0 Y +76654 TX -6.0 Y +76655 TX -6.0 Y +76656 TX -6.0 Y +76657 TX -6.0 Y +76660 TX -6.0 Y +76661 TX -6.0 Y +76664 TX -6.0 Y +76665 TX -6.0 Y +76666 TX -6.0 Y +76667 TX -6.0 Y +76670 TX -6.0 Y +76671 TX -6.0 Y +76673 TX -6.0 Y +76676 TX -6.0 Y +76678 TX -6.0 Y +76679 TX -6.0 Y +76680 TX -6.0 Y +76681 TX -6.0 Y +76682 TX -6.0 Y +76684 TX -6.0 Y +76685 TX -6.0 Y +76686 TX -6.0 Y +76687 TX -6.0 Y +76689 TX -6.0 Y +76690 TX -6.0 Y +76691 TX -6.0 Y +76692 TX -6.0 Y +76693 TX -6.0 Y +76701 TX -6.0 Y +76702 TX -6.0 Y +76703 TX -6.0 Y +76704 TX -6.0 Y +76705 TX -6.0 Y +76706 TX -6.0 Y +76707 TX -6.0 Y +76708 TX -6.0 Y +76710 TX -6.0 Y +76711 TX -6.0 Y +76712 TX -6.0 Y +76714 TX -6.0 Y +76715 TX -6.0 Y +76716 TX -6.0 Y +76795 TX -6.0 Y +76797 TX -6.0 Y +76798 TX -6.0 Y +76799 TX -6.0 Y +76801 TX -6.0 Y +76802 TX -6.0 Y +76803 TX -6.0 Y +76804 TX -6.0 Y +76820 TX -6.0 Y +76821 TX -6.0 Y +76823 TX -6.0 Y +76824 TX -6.0 Y +76825 TX -6.0 Y +76827 TX -6.0 Y +76828 TX -6.0 Y +76831 TX -6.0 Y +76832 TX -6.0 Y +76834 TX -6.0 Y +76836 TX -6.0 Y +76837 TX -6.0 Y +76841 TX -6.0 Y +76842 TX -6.0 Y +76844 TX -6.0 Y +76845 TX -6.0 Y +76848 TX -6.0 Y +76849 TX -6.0 Y +76852 TX -6.0 Y +76853 TX -6.0 Y +76854 TX -6.0 Y +76855 TX -6.0 Y +76856 TX -6.0 Y +76857 TX -6.0 Y +76858 TX -6.0 Y +76859 TX -6.0 Y +76861 TX -6.0 Y +76862 TX -6.0 Y +76864 TX -6.0 Y +76865 TX -6.0 Y +76866 TX -6.0 Y +76869 TX -6.0 Y +76870 TX -6.0 Y +76871 TX -6.0 Y +76872 TX -6.0 Y +76873 TX -6.0 Y +76874 TX -6.0 Y +76875 TX -6.0 Y +76877 TX -6.0 Y +76878 TX -6.0 Y +76880 TX -6.0 Y +76882 TX -6.0 Y +76883 TX -6.0 Y +76884 TX -6.0 Y +76885 TX -6.0 Y +76886 TX -6.0 Y +76887 TX -6.0 Y +76888 TX -6.0 Y +76890 TX -6.0 Y +76901 TX -6.0 Y +76902 TX -6.0 Y +76903 TX -6.0 Y +76904 TX -6.0 Y +76905 TX -6.0 Y +76906 TX -6.0 Y +76908 TX -6.0 Y +76909 TX -6.0 Y +76930 TX -6.0 Y +76932 TX -6.0 Y +76933 TX -6.0 Y +76934 TX -6.0 Y +76935 TX -6.0 Y +76936 TX -6.0 Y +76937 TX -6.0 Y +76939 TX -6.0 Y +76940 TX -6.0 Y +76941 TX -6.0 Y +76943 TX -6.0 Y +76945 TX -6.0 Y +76949 TX -6.0 Y +76950 TX -6.0 Y +76951 TX -6.0 Y +76953 TX -6.0 Y +76955 TX -6.0 Y +76957 TX -6.0 Y +76958 TX -6.0 Y +77001 TX -6.0 Y +77002 TX -6.0 Y +77003 TX -6.0 Y +77004 TX -6.0 Y +77005 TX -6.0 Y +77006 TX -6.0 Y +77007 TX -6.0 Y +77008 TX -6.0 Y +77009 TX -6.0 Y +77010 TX -6.0 Y +77011 TX -6.0 Y +77012 TX -6.0 Y +77013 TX -6.0 Y +77014 TX -6.0 Y +77015 TX -6.0 Y +77016 TX -6.0 Y +77017 TX -6.0 Y +77018 TX -6.0 Y +77019 TX -6.0 Y +77020 TX -6.0 Y +77021 TX -6.0 Y +77022 TX -6.0 Y +77023 TX -6.0 Y +77024 TX -6.0 Y +77025 TX -6.0 Y +77026 TX -6.0 Y +77027 TX -6.0 Y +77028 TX -6.0 Y +77029 TX -6.0 Y +77030 TX -6.0 Y +77031 TX -6.0 Y +77032 TX -6.0 Y +77033 TX -6.0 Y +77034 TX -6.0 Y +77035 TX -6.0 Y +77036 TX -6.0 Y +77037 TX -6.0 Y +77038 TX -6.0 Y +77039 TX -6.0 Y +77040 TX -6.0 Y +77041 TX -6.0 Y +77042 TX -6.0 Y +77043 TX -6.0 Y +77044 TX -6.0 Y +77045 TX -6.0 Y +77046 TX -6.0 Y +77047 TX -6.0 Y +77048 TX -6.0 Y +77049 TX -6.0 Y +77050 TX -6.0 Y +77051 TX -6.0 Y +77052 TX -6.0 Y +77053 TX -6.0 Y +77054 TX -6.0 Y +77055 TX -6.0 Y +77056 TX -6.0 Y +77057 TX -6.0 Y +77058 TX -6.0 Y +77059 TX -6.0 Y +77060 TX -6.0 Y +77061 TX -6.0 Y +77062 TX -6.0 Y +77063 TX -6.0 Y +77064 TX -6.0 Y +77065 TX -6.0 Y +77066 TX -6.0 Y +77067 TX -6.0 Y +77068 TX -6.0 Y +77069 TX -6.0 Y +77070 TX -6.0 Y +77071 TX -6.0 Y +77072 TX -6.0 Y +77073 TX -6.0 Y +77074 TX -6.0 Y +77075 TX -6.0 Y +77076 TX -6.0 Y +77077 TX -6.0 Y +77078 TX -6.0 Y +77079 TX -6.0 Y +77080 TX -6.0 Y +77081 TX -6.0 Y +77082 TX -6.0 Y +77083 TX -6.0 Y +77084 TX -6.0 Y +77085 TX -6.0 Y +77086 TX -6.0 Y +77087 TX -6.0 Y +77088 TX -6.0 Y +77089 TX -6.0 Y +77090 TX -6.0 Y +77091 TX -6.0 Y +77092 TX -6.0 Y +77093 TX -6.0 Y +77094 TX -6.0 Y +77095 TX -6.0 Y +77096 TX -6.0 Y +77097 TX -6.0 Y +77098 TX -6.0 Y +77099 TX -6.0 Y +77201 TX -6.0 Y +77202 TX -6.0 Y +77203 TX -6.0 Y +77204 TX -6.0 Y +77205 TX -6.0 Y +77206 TX -6.0 Y +77207 TX -6.0 Y +77208 TX -6.0 Y +77209 TX -6.0 Y +77210 TX -6.0 Y +77212 TX -6.0 Y +77213 TX -6.0 Y +77215 TX -6.0 Y +77216 TX -6.0 Y +77217 TX -6.0 Y +77218 TX -6.0 Y +77219 TX -6.0 Y +77220 TX -6.0 Y +77221 TX -6.0 Y +77222 TX -6.0 Y +77223 TX -6.0 Y +77224 TX -6.0 Y +77225 TX -6.0 Y +77226 TX -6.0 Y +77227 TX -6.0 Y +77228 TX -6.0 Y +77229 TX -6.0 Y +77230 TX -6.0 Y +77231 TX -6.0 Y +77233 TX -6.0 Y +77234 TX -6.0 Y +77235 TX -6.0 Y +77236 TX -6.0 Y +77237 TX -6.0 Y +77238 TX -6.0 Y +77240 TX -6.0 Y +77241 TX -6.0 Y +77242 TX -6.0 Y +77243 TX -6.0 Y +77244 TX -6.0 Y +77245 TX -6.0 Y +77246 TX -6.0 Y +77247 TX -6.0 Y +77248 TX -6.0 Y +77249 TX -6.0 Y +77250 TX -6.0 Y +77251 TX -6.0 Y +77252 TX -6.0 Y +77253 TX -6.0 Y +77254 TX -6.0 Y +77255 TX -6.0 Y +77256 TX -6.0 Y +77257 TX -6.0 Y +77258 TX -6.0 Y +77259 TX -6.0 Y +77260 TX -6.0 Y +77261 TX -6.0 Y +77262 TX -6.0 Y +77263 TX -6.0 Y +77265 TX -6.0 Y +77266 TX -6.0 Y +77267 TX -6.0 Y +77268 TX -6.0 Y +77269 TX -6.0 Y +77270 TX -6.0 Y +77271 TX -6.0 Y +77272 TX -6.0 Y +77273 TX -6.0 Y +77274 TX -6.0 Y +77275 TX -6.0 Y +77276 TX -6.0 Y +77277 TX -6.0 Y +77278 TX -6.0 Y +77279 TX -6.0 Y +77280 TX -6.0 Y +77282 TX -6.0 Y +77284 TX -6.0 Y +77285 TX -6.0 Y +77286 TX -6.0 Y +77287 TX -6.0 Y +77288 TX -6.0 Y +77289 TX -6.0 Y +77290 TX -6.0 Y +77291 TX -6.0 Y +77292 TX -6.0 Y +77293 TX -6.0 Y +77294 TX -6.0 Y +77296 TX -6.0 Y +77297 TX -6.0 Y +77298 TX -6.0 Y +77299 TX -6.0 Y +77301 TX -6.0 Y +77302 TX -6.0 Y +77303 TX -6.0 Y +77304 TX -6.0 Y +77305 TX -6.0 Y +77306 TX -6.0 Y +77315 TX -6.0 Y +77316 TX -6.0 Y +77318 TX -6.0 Y +77320 TX -6.0 Y +77325 TX -6.0 Y +77326 TX -6.0 Y +77327 TX -6.0 Y +77328 TX -6.0 Y +77331 TX -6.0 Y +77332 TX -6.0 Y +77333 TX -6.0 Y +77334 TX -6.0 Y +77335 TX -6.0 Y +77336 TX -6.0 Y +77337 TX -6.0 Y +77338 TX -6.0 Y +77339 TX -6.0 Y +77340 TX -6.0 Y +77341 TX -6.0 Y +77342 TX -6.0 Y +77343 TX -6.0 Y +77344 TX -6.0 Y +77345 TX -6.0 Y +77346 TX -6.0 Y +77347 TX -6.0 Y +77348 TX -6.0 Y +77349 TX -6.0 Y +77350 TX -6.0 Y +77351 TX -6.0 Y +77353 TX -6.0 Y +77354 TX -6.0 Y +77355 TX -6.0 Y +77356 TX -6.0 Y +77357 TX -6.0 Y +77358 TX -6.0 Y +77359 TX -6.0 Y +77360 TX -6.0 Y +77362 TX -6.0 Y +77363 TX -6.0 Y +77364 TX -6.0 Y +77365 TX -6.0 Y +77367 TX -6.0 Y +77368 TX -6.0 Y +77369 TX -6.0 Y +77371 TX -6.0 Y +77372 TX -6.0 Y +77373 TX -6.0 Y +77374 TX -6.0 Y +77375 TX -6.0 Y +77376 TX -6.0 Y +77377 TX -6.0 Y +77378 TX -6.0 Y +77379 TX -6.0 Y +77380 TX -6.0 Y +77381 TX -6.0 Y +77382 TX -6.0 Y +77383 TX -6.0 Y +77384 TX -6.0 Y +77385 TX -6.0 Y +77386 TX -6.0 Y +77387 TX -6.0 Y +77388 TX -6.0 Y +77389 TX -6.0 Y +77391 TX -6.0 Y +77393 TX -6.0 Y +77396 TX -6.0 Y +77399 TX -6.0 Y +77401 TX -6.0 Y +77402 TX -6.0 Y +77404 TX -6.0 Y +77406 TX -6.0 Y +77410 TX -6.0 Y +77411 TX -6.0 Y +77412 TX -6.0 Y +77413 TX -6.0 Y +77414 TX -6.0 Y +77415 TX -6.0 Y +77417 TX -6.0 Y +77418 TX -6.0 Y +77419 TX -6.0 Y +77420 TX -6.0 Y +77422 TX -6.0 Y +77423 TX -6.0 Y +77426 TX -6.0 Y +77428 TX -6.0 Y +77429 TX -6.0 Y +77430 TX -6.0 Y +77431 TX -6.0 Y +77432 TX -6.0 Y +77433 TX -6.0 Y +77434 TX -6.0 Y +77435 TX -6.0 Y +77436 TX -6.0 Y +77437 TX -6.0 Y +77440 TX -6.0 Y +77441 TX -6.0 Y +77442 TX -6.0 Y +77443 TX -6.0 Y +77444 TX -6.0 Y +77445 TX -6.0 Y +77446 TX -6.0 Y +77447 TX -6.0 Y +77448 TX -6.0 Y +77449 TX -6.0 Y +77450 TX -6.0 Y +77451 TX -6.0 Y +77452 TX -6.0 Y +77453 TX -6.0 Y +77454 TX -6.0 Y +77455 TX -6.0 Y +77456 TX -6.0 Y +77457 TX -6.0 Y +77458 TX -6.0 Y +77459 TX -6.0 Y +77460 TX -6.0 Y +77461 TX -6.0 Y +77463 TX -6.0 Y +77464 TX -6.0 Y +77465 TX -6.0 Y +77466 TX -6.0 Y +77467 TX -6.0 Y +77468 TX -6.0 Y +77469 TX -6.0 Y +77470 TX -6.0 Y +77471 TX -6.0 Y +77473 TX -6.0 Y +77474 TX -6.0 Y +77475 TX -6.0 Y +77476 TX -6.0 Y +77477 TX -6.0 Y +77478 TX -6.0 Y +77479 TX -6.0 Y +77480 TX -6.0 Y +77481 TX -6.0 Y +77482 TX -6.0 Y +77483 TX -6.0 Y +77484 TX -6.0 Y +77485 TX -6.0 Y +77486 TX -6.0 Y +77487 TX -6.0 Y +77488 TX -6.0 Y +77489 TX -6.0 Y +77491 TX -6.0 Y +77492 TX -6.0 Y +77493 TX -6.0 Y +77494 TX -6.0 Y +77496 TX -6.0 Y +77497 TX -6.0 Y +77501 TX -6.0 Y +77502 TX -6.0 Y +77503 TX -6.0 Y +77504 TX -6.0 Y +77505 TX -6.0 Y +77506 TX -6.0 Y +77507 TX -6.0 Y +77508 TX -6.0 Y +77510 TX -6.0 Y +77511 TX -6.0 Y +77512 TX -6.0 Y +77514 TX -6.0 Y +77515 TX -6.0 Y +77516 TX -6.0 Y +77517 TX -6.0 Y +77518 TX -6.0 Y +77519 TX -6.0 Y +77520 TX -6.0 Y +77521 TX -6.0 Y +77522 TX -6.0 Y +77530 TX -6.0 Y +77531 TX -6.0 Y +77532 TX -6.0 Y +77533 TX -6.0 Y +77534 TX -6.0 Y +77535 TX -6.0 Y +77536 TX -6.0 Y +77538 TX -6.0 Y +77539 TX -6.0 Y +77541 TX -6.0 Y +77542 TX -6.0 Y +77545 TX -6.0 Y +77546 TX -6.0 Y +77547 TX -6.0 Y +77549 TX -6.0 Y +77550 TX -6.0 Y +77551 TX -6.0 Y +77552 TX -6.0 Y +77553 TX -6.0 Y +77554 TX -6.0 Y +77555 TX -6.0 Y +77560 TX -6.0 Y +77561 TX -6.0 Y +77562 TX -6.0 Y +77563 TX -6.0 Y +77564 TX -6.0 Y +77565 TX -6.0 Y +77566 TX -6.0 Y +77568 TX -6.0 Y +77571 TX -6.0 Y +77572 TX -6.0 Y +77573 TX -6.0 Y +77574 TX -6.0 Y +77575 TX -6.0 Y +77577 TX -6.0 Y +77578 TX -6.0 Y +77580 TX -6.0 Y +77581 TX -6.0 Y +77582 TX -6.0 Y +77583 TX -6.0 Y +77584 TX -6.0 Y +77585 TX -6.0 Y +77586 TX -6.0 Y +77587 TX -6.0 Y +77588 TX -6.0 Y +77590 TX -6.0 Y +77591 TX -6.0 Y +77592 TX -6.0 Y +77597 TX -6.0 Y +77598 TX -6.0 Y +77611 TX -6.0 Y +77612 TX -6.0 Y +77613 TX -6.0 Y +77614 TX -6.0 Y +77615 TX -6.0 Y +77616 TX -6.0 Y +77617 TX -6.0 Y +77619 TX -6.0 Y +77622 TX -6.0 Y +77623 TX -6.0 Y +77624 TX -6.0 Y +77625 TX -6.0 Y +77626 TX -6.0 Y +77627 TX -6.0 Y +77629 TX -6.0 Y +77630 TX -6.0 Y +77631 TX -6.0 Y +77632 TX -6.0 Y +77639 TX -6.0 Y +77640 TX -6.0 Y +77641 TX -6.0 Y +77642 TX -6.0 Y +77643 TX -6.0 Y +77650 TX -6.0 Y +77651 TX -6.0 Y +77655 TX -6.0 Y +77656 TX -6.0 Y +77657 TX -6.0 Y +77659 TX -6.0 Y +77660 TX -6.0 Y +77661 TX -6.0 Y +77662 TX -6.0 Y +77663 TX -6.0 Y +77664 TX -6.0 Y +77665 TX -6.0 Y +77670 TX -6.0 Y +77701 TX -6.0 Y +77702 TX -6.0 Y +77703 TX -6.0 Y +77704 TX -6.0 Y +77705 TX -6.0 Y +77706 TX -6.0 Y +77707 TX -6.0 Y +77708 TX -6.0 Y +77709 TX -6.0 Y +77710 TX -6.0 Y +77713 TX -6.0 Y +77720 TX -6.0 Y +77725 TX -6.0 Y +77726 TX -6.0 Y +77801 TX -6.0 Y +77802 TX -6.0 Y +77803 TX -6.0 Y +77805 TX -6.0 Y +77806 TX -6.0 Y +77807 TX -6.0 Y +77808 TX -6.0 Y +77830 TX -6.0 Y +77831 TX -6.0 Y +77833 TX -6.0 Y +77834 TX -6.0 Y +77835 TX -6.0 Y +77836 TX -6.0 Y +77837 TX -6.0 Y +77838 TX -6.0 Y +77840 TX -6.0 Y +77841 TX -6.0 Y +77842 TX -6.0 Y +77843 TX -6.0 Y +77844 TX -6.0 Y +77845 TX -6.0 Y +77850 TX -6.0 Y +77852 TX -6.0 Y +77853 TX -6.0 Y +77855 TX -6.0 Y +77856 TX -6.0 Y +77857 TX -6.0 Y +77859 TX -6.0 Y +77861 TX -6.0 Y +77862 TX -6.0 Y +77863 TX -6.0 Y +77864 TX -6.0 Y +77865 TX -6.0 Y +77866 TX -6.0 Y +77867 TX -6.0 Y +77868 TX -6.0 Y +77869 TX -6.0 Y +77870 TX -6.0 Y +77871 TX -6.0 Y +77872 TX -6.0 Y +77873 TX -6.0 Y +77875 TX -6.0 Y +77876 TX -6.0 Y +77878 TX -6.0 Y +77879 TX -6.0 Y +77880 TX -6.0 Y +77881 TX -6.0 Y +77882 TX -6.0 Y +77901 TX -6.0 Y +77902 TX -6.0 Y +77903 TX -6.0 Y +77904 TX -6.0 Y +77905 TX -6.0 Y +77950 TX -6.0 Y +77951 TX -6.0 Y +77954 TX -6.0 Y +77957 TX -6.0 Y +77960 TX -6.0 Y +77961 TX -6.0 Y +77962 TX -6.0 Y +77963 TX -6.0 Y +77964 TX -6.0 Y +77967 TX -6.0 Y +77968 TX -6.0 Y +77969 TX -6.0 Y +77970 TX -6.0 Y +77971 TX -6.0 Y +77973 TX -6.0 Y +77974 TX -6.0 Y +77975 TX -6.0 Y +77976 TX -6.0 Y +77977 TX -6.0 Y +77978 TX -6.0 Y +77979 TX -6.0 Y +77982 TX -6.0 Y +77983 TX -6.0 Y +77984 TX -6.0 Y +77986 TX -6.0 Y +77987 TX -6.0 Y +77988 TX -6.0 Y +77989 TX -6.0 Y +77990 TX -6.0 Y +77991 TX -6.0 Y +77993 TX -6.0 Y +77994 TX -6.0 Y +77995 TX -6.0 Y +78001 TX -6.0 Y +78002 TX -6.0 Y +78003 TX -6.0 Y +78004 TX -6.0 Y +78005 TX -6.0 Y +78006 TX -6.0 Y +78007 TX -6.0 Y +78008 TX -6.0 Y +78009 TX -6.0 Y +78010 TX -6.0 Y +78011 TX -6.0 Y +78012 TX -6.0 Y +78013 TX -6.0 Y +78014 TX -6.0 Y +78015 TX -6.0 Y +78016 TX -6.0 Y +78017 TX -6.0 Y +78019 TX -6.0 Y +78021 TX -6.0 Y +78022 TX -6.0 Y +78023 TX -6.0 Y +78024 TX -6.0 Y +78025 TX -6.0 Y +78026 TX -6.0 Y +78027 TX -6.0 Y +78028 TX -6.0 Y +78029 TX -6.0 Y +78039 TX -6.0 Y +78040 TX -6.0 Y +78041 TX -6.0 Y +78042 TX -6.0 Y +78043 TX -6.0 Y +78044 TX -6.0 Y +78045 TX -6.0 Y +78046 TX -6.0 Y +78049 TX -6.0 Y +78050 TX -6.0 Y +78052 TX -6.0 Y +78054 TX -6.0 Y +78055 TX -6.0 Y +78056 TX -6.0 Y +78057 TX -6.0 Y +78058 TX -6.0 Y +78059 TX -6.0 Y +78060 TX -6.0 Y +78061 TX -6.0 Y +78062 TX -6.0 Y +78063 TX -6.0 Y +78064 TX -6.0 Y +78065 TX -6.0 Y +78066 TX -6.0 Y +78067 TX -6.0 Y +78069 TX -6.0 Y +78070 TX -6.0 Y +78071 TX -6.0 Y +78072 TX -6.0 Y +78073 TX -6.0 Y +78074 TX -6.0 Y +78075 TX -6.0 Y +78076 TX -6.0 Y +78101 TX -6.0 Y +78102 TX -6.0 Y +78104 TX -6.0 Y +78107 TX -6.0 Y +78108 TX -6.0 Y +78109 TX -6.0 Y +78111 TX -6.0 Y +78112 TX -6.0 Y +78113 TX -6.0 Y +78114 TX -6.0 Y +78115 TX -6.0 Y +78116 TX -6.0 Y +78117 TX -6.0 Y +78118 TX -6.0 Y +78119 TX -6.0 Y +78121 TX -6.0 Y +78122 TX -6.0 Y +78123 TX -6.0 Y +78124 TX -6.0 Y +78125 TX -6.0 Y +78130 TX -6.0 Y +78131 TX -6.0 Y +78132 TX -6.0 Y +78133 TX -6.0 Y +78135 TX -6.0 Y +78140 TX -6.0 Y +78141 TX -6.0 Y +78142 TX -6.0 Y +78143 TX -6.0 Y +78144 TX -6.0 Y +78145 TX -6.0 Y +78146 TX -6.0 Y +78147 TX -6.0 Y +78148 TX -6.0 Y +78150 TX -6.0 Y +78151 TX -6.0 Y +78152 TX -6.0 Y +78154 TX -6.0 Y +78155 TX -6.0 Y +78156 TX -6.0 Y +78159 TX -6.0 Y +78160 TX -6.0 Y +78161 TX -6.0 Y +78162 TX -6.0 Y +78163 TX -6.0 Y +78164 TX -6.0 Y +78201 TX -6.0 Y +78202 TX -6.0 Y +78203 TX -6.0 Y +78204 TX -6.0 Y +78205 TX -6.0 Y +78206 TX -6.0 Y +78207 TX -6.0 Y +78208 TX -6.0 Y +78209 TX -6.0 Y +78210 TX -6.0 Y +78211 TX -6.0 Y +78212 TX -6.0 Y +78213 TX -6.0 Y +78214 TX -6.0 Y +78215 TX -6.0 Y +78216 TX -6.0 Y +78217 TX -6.0 Y +78218 TX -6.0 Y +78219 TX -6.0 Y +78220 TX -6.0 Y +78221 TX -6.0 Y +78222 TX -6.0 Y +78223 TX -6.0 Y +78224 TX -6.0 Y +78225 TX -6.0 Y +78226 TX -6.0 Y +78227 TX -6.0 Y +78228 TX -6.0 Y +78229 TX -6.0 Y +78230 TX -6.0 Y +78231 TX -6.0 Y +78232 TX -6.0 Y +78233 TX -6.0 Y +78234 TX -6.0 Y +78235 TX -6.0 Y +78236 TX -6.0 Y +78237 TX -6.0 Y +78238 TX -6.0 Y +78239 TX -6.0 Y +78240 TX -6.0 Y +78241 TX -6.0 Y +78242 TX -6.0 Y +78243 TX -6.0 Y +78244 TX -6.0 Y +78245 TX -6.0 Y +78246 TX -6.0 Y +78247 TX -6.0 Y +78248 TX -6.0 Y +78249 TX -6.0 Y +78250 TX -6.0 Y +78251 TX -6.0 Y +78252 TX -6.0 Y +78253 TX -6.0 Y +78254 TX -6.0 Y +78255 TX -6.0 Y +78256 TX -6.0 Y +78257 TX -6.0 Y +78258 TX -6.0 Y +78259 TX -6.0 Y +78260 TX -6.0 Y +78261 TX -6.0 Y +78262 TX -6.0 Y +78263 TX -6.0 Y +78264 TX -6.0 Y +78265 TX -6.0 Y +78266 TX -6.0 Y +78268 TX -6.0 Y +78269 TX -6.0 Y +78270 TX -6.0 Y +78275 TX -6.0 Y +78278 TX -6.0 Y +78279 TX -6.0 Y +78280 TX -6.0 Y +78283 TX -6.0 Y +78284 TX -6.0 Y +78285 TX -6.0 Y +78286 TX -6.0 Y +78287 TX -6.0 Y +78288 TX -6.0 Y +78289 TX -6.0 Y +78291 TX -6.0 Y +78292 TX -6.0 Y +78293 TX -6.0 Y +78294 TX -6.0 Y +78295 TX -6.0 Y +78296 TX -6.0 Y +78297 TX -6.0 Y +78298 TX -6.0 Y +78299 TX -6.0 Y +78330 TX -6.0 Y +78332 TX -6.0 Y +78333 TX -6.0 Y +78335 TX -6.0 Y +78336 TX -6.0 Y +78338 TX -6.0 Y +78339 TX -6.0 Y +78340 TX -6.0 Y +78341 TX -6.0 Y +78342 TX -6.0 Y +78343 TX -6.0 Y +78344 TX -6.0 Y +78347 TX -6.0 Y +78349 TX -6.0 Y +78350 TX -6.0 Y +78351 TX -6.0 Y +78352 TX -6.0 Y +78353 TX -6.0 Y +78355 TX -6.0 Y +78357 TX -6.0 Y +78358 TX -6.0 Y +78359 TX -6.0 Y +78360 TX -6.0 Y +78361 TX -6.0 Y +78362 TX -6.0 Y +78363 TX -6.0 Y +78364 TX -6.0 Y +78368 TX -6.0 Y +78369 TX -6.0 Y +78370 TX -6.0 Y +78371 TX -6.0 Y +78372 TX -6.0 Y +78373 TX -6.0 Y +78374 TX -6.0 Y +78375 TX -6.0 Y +78376 TX -6.0 Y +78377 TX -6.0 Y +78379 TX -6.0 Y +78380 TX -6.0 Y +78381 TX -6.0 Y +78382 TX -6.0 Y +78383 TX -6.0 Y +78384 TX -6.0 Y +78385 TX -6.0 Y +78387 TX -6.0 Y +78389 TX -6.0 Y +78390 TX -6.0 Y +78391 TX -6.0 Y +78393 TX -6.0 Y +78401 TX -6.0 Y +78402 TX -6.0 Y +78403 TX -6.0 Y +78404 TX -6.0 Y +78405 TX -6.0 Y +78406 TX -6.0 Y +78407 TX -6.0 Y +78408 TX -6.0 Y +78409 TX -6.0 Y +78410 TX -6.0 Y +78411 TX -6.0 Y +78412 TX -6.0 Y +78413 TX -6.0 Y +78414 TX -6.0 Y +78415 TX -6.0 Y +78416 TX -6.0 Y +78417 TX -6.0 Y +78418 TX -6.0 Y +78419 TX -6.0 Y +78426 TX -6.0 Y +78427 TX -6.0 Y +78460 TX -6.0 Y +78461 TX -6.0 Y +78463 TX -6.0 Y +78465 TX -6.0 Y +78466 TX -6.0 Y +78467 TX -6.0 Y +78468 TX -6.0 Y +78469 TX -6.0 Y +78470 TX -6.0 Y +78471 TX -6.0 Y +78472 TX -6.0 Y +78473 TX -6.0 Y +78474 TX -6.0 Y +78475 TX -6.0 Y +78476 TX -6.0 Y +78477 TX -6.0 Y +78478 TX -6.0 Y +78480 TX -6.0 Y +78501 TX -6.0 Y +78502 TX -6.0 Y +78503 TX -6.0 Y +78504 TX -6.0 Y +78505 TX -6.0 Y +78516 TX -6.0 Y +78520 TX -6.0 Y +78521 TX -6.0 Y +78522 TX -6.0 Y +78523 TX -6.0 Y +78526 TX -6.0 Y +78535 TX -6.0 Y +78536 TX -6.0 Y +78537 TX -6.0 Y +78538 TX -6.0 Y +78539 TX -6.0 Y +78540 TX -6.0 Y +78541 TX -6.0 Y +78543 TX -6.0 Y +78545 TX -6.0 Y +78547 TX -6.0 Y +78548 TX -6.0 Y +78549 TX -6.0 Y +78550 TX -6.0 Y +78551 TX -6.0 Y +78552 TX -6.0 Y +78553 TX -6.0 Y +78557 TX -6.0 Y +78558 TX -6.0 Y +78559 TX -6.0 Y +78560 TX -6.0 Y +78561 TX -6.0 Y +78562 TX -6.0 Y +78563 TX -6.0 Y +78564 TX -6.0 Y +78565 TX -6.0 Y +78566 TX -6.0 Y +78567 TX -6.0 Y +78568 TX -6.0 Y +78569 TX -6.0 Y +78570 TX -6.0 Y +78572 TX -6.0 Y +78573 TX -6.0 Y +78574 TX -6.0 Y +78575 TX -6.0 Y +78576 TX -6.0 Y +78577 TX -6.0 Y +78578 TX -6.0 Y +78579 TX -6.0 Y +78580 TX -6.0 Y +78582 TX -6.0 Y +78583 TX -6.0 Y +78584 TX -6.0 Y +78585 TX -6.0 Y +78586 TX -6.0 Y +78588 TX -6.0 Y +78589 TX -6.0 Y +78590 TX -6.0 Y +78591 TX -6.0 Y +78592 TX -6.0 Y +78593 TX -6.0 Y +78594 TX -6.0 Y +78595 TX -6.0 Y +78596 TX -6.0 Y +78597 TX -6.0 Y +78598 TX -6.0 Y +78599 TX -6.0 Y +78602 TX -6.0 Y +78604 TX -6.0 Y +78605 TX -6.0 Y +78606 TX -6.0 Y +78607 TX -6.0 Y +78608 TX -6.0 Y +78609 TX -6.0 Y +78610 TX -6.0 Y +78611 TX -6.0 Y +78612 TX -6.0 Y +78613 TX -6.0 Y +78614 TX -6.0 Y +78615 TX -6.0 Y +78616 TX -6.0 Y +78617 TX -6.0 Y +78618 TX -6.0 Y +78619 TX -6.0 Y +78620 TX -6.0 Y +78621 TX -6.0 Y +78622 TX -6.0 Y +78623 TX -6.0 Y +78624 TX -6.0 Y +78626 TX -6.0 Y +78627 TX -6.0 Y +78628 TX -6.0 Y +78629 TX -6.0 Y +78630 TX -6.0 Y +78631 TX -6.0 Y +78632 TX -6.0 Y +78634 TX -6.0 Y +78635 TX -6.0 Y +78636 TX -6.0 Y +78638 TX -6.0 Y +78639 TX -6.0 Y +78640 TX -6.0 Y +78641 TX -6.0 Y +78642 TX -6.0 Y +78643 TX -6.0 Y +78644 TX -6.0 Y +78645 TX -6.0 Y +78646 TX -6.0 Y +78648 TX -6.0 Y +78650 TX -6.0 Y +78651 TX -6.0 Y +78652 TX -6.0 Y +78653 TX -6.0 Y +78654 TX -6.0 Y +78655 TX -6.0 Y +78656 TX -6.0 Y +78657 TX -6.0 Y +78658 TX -6.0 Y +78659 TX -6.0 Y +78660 TX -6.0 Y +78661 TX -6.0 Y +78662 TX -6.0 Y +78663 TX -6.0 Y +78664 TX -6.0 Y +78666 TX -6.0 Y +78667 TX -6.0 Y +78669 TX -6.0 Y +78670 TX -6.0 Y +78671 TX -6.0 Y +78672 TX -6.0 Y +78673 TX -6.0 Y +78674 TX -6.0 Y +78675 TX -6.0 Y +78676 TX -6.0 Y +78677 TX -6.0 Y +78680 TX -6.0 Y +78681 TX -6.0 Y +78682 TX -6.0 Y +78683 TX -6.0 Y +78691 TX -6.0 Y +78701 TX -6.0 Y +78702 TX -6.0 Y +78703 TX -6.0 Y +78704 TX -6.0 Y +78705 TX -6.0 Y +78708 TX -6.0 Y +78709 TX -6.0 Y +78710 TX -6.0 Y +78711 TX -6.0 Y +78712 TX -6.0 Y +78713 TX -6.0 Y +78714 TX -6.0 Y +78715 TX -6.0 Y +78716 TX -6.0 Y +78717 TX -6.0 Y +78718 TX -6.0 Y +78719 TX -6.0 Y +78720 TX -6.0 Y +78721 TX -6.0 Y +78722 TX -6.0 Y +78723 TX -6.0 Y +78724 TX -6.0 Y +78725 TX -6.0 Y +78726 TX -6.0 Y +78727 TX -6.0 Y +78728 TX -6.0 Y +78729 TX -6.0 Y +78730 TX -6.0 Y +78731 TX -6.0 Y +78732 TX -6.0 Y +78733 TX -6.0 Y +78734 TX -6.0 Y +78735 TX -6.0 Y +78736 TX -6.0 Y +78737 TX -6.0 Y +78738 TX -6.0 Y +78739 TX -6.0 Y +78741 TX -6.0 Y +78742 TX -6.0 Y +78744 TX -6.0 Y +78745 TX -6.0 Y +78746 TX -6.0 Y +78747 TX -6.0 Y +78748 TX -6.0 Y +78749 TX -6.0 Y +78750 TX -6.0 Y +78751 TX -6.0 Y +78752 TX -6.0 Y +78753 TX -6.0 Y +78754 TX -6.0 Y +78755 TX -6.0 Y +78756 TX -6.0 Y +78757 TX -6.0 Y +78758 TX -6.0 Y +78759 TX -6.0 Y +78760 TX -6.0 Y +78761 TX -6.0 Y +78762 TX -6.0 Y +78763 TX -6.0 Y +78764 TX -6.0 Y +78765 TX -6.0 Y +78766 TX -6.0 Y +78767 TX -6.0 Y +78768 TX -6.0 Y +78769 TX -6.0 Y +78772 TX -6.0 Y +78773 TX -6.0 Y +78774 TX -6.0 Y +78778 TX -6.0 Y +78779 TX -6.0 Y +78780 TX -6.0 Y +78781 TX -6.0 Y +78783 TX -6.0 Y +78785 TX -6.0 Y +78786 TX -6.0 Y +78788 TX -6.0 Y +78789 TX -6.0 Y +78798 TX -6.0 Y +78799 TX -6.0 Y +78801 TX -6.0 Y +78802 TX -6.0 Y +78827 TX -6.0 Y +78828 TX -6.0 Y +78829 TX -6.0 Y +78830 TX -6.0 Y +78832 TX -6.0 Y +78833 TX -6.0 Y +78834 TX -6.0 Y +78836 TX -6.0 Y +78837 TX -6.0 Y +78838 TX -6.0 Y +78839 TX -6.0 Y +78840 TX -6.0 Y +78841 TX -6.0 Y +78842 TX -6.0 Y +78843 TX -6.0 Y +78847 TX -6.0 Y +78850 TX -6.0 Y +78851 TX -6.0 Y +78852 TX -6.0 Y +78853 TX -6.0 Y +78860 TX -6.0 Y +78861 TX -6.0 Y +78870 TX -6.0 Y +78871 TX -6.0 Y +78872 TX -6.0 Y +78873 TX -6.0 Y +78877 TX -6.0 Y +78879 TX -6.0 Y +78880 TX -6.0 Y +78881 TX -6.0 Y +78883 TX -6.0 Y +78884 TX -6.0 Y +78885 TX -6.0 Y +78886 TX -6.0 Y +78931 TX -6.0 Y +78932 TX -6.0 Y +78933 TX -6.0 Y +78934 TX -6.0 Y +78935 TX -6.0 Y +78938 TX -6.0 Y +78940 TX -6.0 Y +78941 TX -6.0 Y +78942 TX -6.0 Y +78943 TX -6.0 Y +78944 TX -6.0 Y +78945 TX -6.0 Y +78946 TX -6.0 Y +78947 TX -6.0 Y +78948 TX -6.0 Y +78949 TX -6.0 Y +78950 TX -6.0 Y +78951 TX -6.0 Y +78952 TX -6.0 Y +78953 TX -6.0 Y +78954 TX -6.0 Y +78956 TX -6.0 Y +78957 TX -6.0 Y +78959 TX -6.0 Y +78960 TX -6.0 Y +78961 TX -6.0 Y +78962 TX -6.0 Y +78963 TX -6.0 Y +79001 TX -6.0 Y +79002 TX -6.0 Y +79003 TX -6.0 Y +79005 TX -6.0 Y +79007 TX -6.0 Y +79008 TX -6.0 Y +79009 TX -6.0 Y +79010 TX -6.0 Y +79011 TX -6.0 Y +79012 TX -6.0 Y +79013 TX -6.0 Y +79014 TX -6.0 Y +79015 TX -6.0 Y +79016 TX -6.0 Y +79018 TX -6.0 Y +79019 TX -6.0 Y +79021 TX -6.0 Y +79022 TX -6.0 Y +79024 TX -6.0 Y +79025 TX -6.0 Y +79027 TX -6.0 Y +79029 TX -6.0 Y +79031 TX -6.0 Y +79032 TX -6.0 Y +79033 TX -6.0 Y +79034 TX -6.0 Y +79035 TX -6.0 Y +79036 TX -6.0 Y +79039 TX -6.0 Y +79040 TX -6.0 Y +79041 TX -6.0 Y +79042 TX -6.0 Y +79043 TX -6.0 Y +79044 TX -6.0 Y +79045 TX -6.0 Y +79046 TX -6.0 Y +79051 TX -6.0 Y +79052 TX -6.0 Y +79053 TX -6.0 Y +79054 TX -6.0 Y +79056 TX -6.0 Y +79057 TX -6.0 Y +79058 TX -6.0 Y +79059 TX -6.0 Y +79061 TX -6.0 Y +79062 TX -6.0 Y +79063 TX -6.0 Y +79064 TX -6.0 Y +79065 TX -6.0 Y +79066 TX -6.0 Y +79068 TX -6.0 Y +79070 TX -6.0 Y +79072 TX -6.0 Y +79073 TX -6.0 Y +79077 TX -6.0 Y +79078 TX -6.0 Y +79079 TX -6.0 Y +79080 TX -6.0 Y +79081 TX -6.0 Y +79082 TX -6.0 Y +79083 TX -6.0 Y +79084 TX -6.0 Y +79085 TX -6.0 Y +79086 TX -6.0 Y +79087 TX -6.0 Y +79088 TX -6.0 Y +79091 TX -6.0 Y +79092 TX -6.0 Y +79093 TX -6.0 Y +79094 TX -6.0 Y +79095 TX -6.0 Y +79096 TX -6.0 Y +79097 TX -6.0 Y +79098 TX -6.0 Y +79101 TX -6.0 Y +79102 TX -6.0 Y +79103 TX -6.0 Y +79104 TX -6.0 Y +79105 TX -6.0 Y +79106 TX -6.0 Y +79107 TX -6.0 Y +79108 TX -6.0 Y +79109 TX -6.0 Y +79110 TX -6.0 Y +79111 TX -6.0 Y +79114 TX -6.0 Y +79116 TX -6.0 Y +79117 TX -6.0 Y +79118 TX -6.0 Y +79119 TX -6.0 Y +79120 TX -6.0 Y +79121 TX -6.0 Y +79124 TX -6.0 Y +79159 TX -6.0 Y +79166 TX -6.0 Y +79168 TX -6.0 Y +79172 TX -6.0 Y +79174 TX -6.0 Y +79178 TX -6.0 Y +79185 TX -6.0 Y +79187 TX -6.0 Y +79189 TX -6.0 Y +79201 TX -6.0 Y +79220 TX -6.0 Y +79221 TX -6.0 Y +79223 TX -6.0 Y +79225 TX -6.0 Y +79226 TX -6.0 Y +79227 TX -6.0 Y +79229 TX -6.0 Y +79230 TX -6.0 Y +79231 TX -6.0 Y +79233 TX -6.0 Y +79234 TX -6.0 Y +79235 TX -6.0 Y +79236 TX -6.0 Y +79237 TX -6.0 Y +79239 TX -6.0 Y +79240 TX -6.0 Y +79241 TX -6.0 Y +79243 TX -6.0 Y +79244 TX -6.0 Y +79245 TX -6.0 Y +79247 TX -6.0 Y +79248 TX -6.0 Y +79250 TX -6.0 Y +79251 TX -6.0 Y +79252 TX -6.0 Y +79255 TX -6.0 Y +79256 TX -6.0 Y +79257 TX -6.0 Y +79258 TX -6.0 Y +79259 TX -6.0 Y +79261 TX -6.0 Y +79311 TX -6.0 Y +79312 TX -6.0 Y +79313 TX -6.0 Y +79314 TX -6.0 Y +79316 TX -6.0 Y +79320 TX -6.0 Y +79322 TX -6.0 Y +79323 TX -6.0 Y +79324 TX -6.0 Y +79325 TX -6.0 Y +79326 TX -6.0 Y +79329 TX -6.0 Y +79330 TX -6.0 Y +79331 TX -6.0 Y +79336 TX -6.0 Y +79338 TX -6.0 Y +79339 TX -6.0 Y +79342 TX -6.0 Y +79343 TX -6.0 Y +79344 TX -6.0 Y +79345 TX -6.0 Y +79346 TX -6.0 Y +79347 TX -6.0 Y +79350 TX -6.0 Y +79351 TX -6.0 Y +79353 TX -6.0 Y +79355 TX -6.0 Y +79356 TX -6.0 Y +79357 TX -6.0 Y +79358 TX -6.0 Y +79359 TX -6.0 Y +79360 TX -6.0 Y +79363 TX -6.0 Y +79364 TX -6.0 Y +79366 TX -6.0 Y +79367 TX -6.0 Y +79369 TX -6.0 Y +79370 TX -6.0 Y +79371 TX -6.0 Y +79372 TX -6.0 Y +79373 TX -6.0 Y +79376 TX -6.0 Y +79377 TX -6.0 Y +79378 TX -6.0 Y +79379 TX -6.0 Y +79380 TX -6.0 Y +79381 TX -6.0 Y +79382 TX -6.0 Y +79383 TX -6.0 Y +79401 TX -6.0 Y +79402 TX -6.0 Y +79403 TX -6.0 Y +79404 TX -6.0 Y +79405 TX -6.0 Y +79406 TX -6.0 Y +79407 TX -6.0 Y +79408 TX -6.0 Y +79409 TX -6.0 Y +79410 TX -6.0 Y +79411 TX -6.0 Y +79412 TX -6.0 Y +79413 TX -6.0 Y +79414 TX -6.0 Y +79415 TX -6.0 Y +79416 TX -6.0 Y +79423 TX -6.0 Y +79424 TX -6.0 Y +79430 TX -6.0 Y +79452 TX -6.0 Y +79453 TX -6.0 Y +79457 TX -6.0 Y +79464 TX -6.0 Y +79490 TX -6.0 Y +79491 TX -6.0 Y +79493 TX -6.0 Y +79499 TX -6.0 Y +79501 TX -6.0 Y +79502 TX -6.0 Y +79503 TX -6.0 Y +79504 TX -6.0 Y +79505 TX -6.0 Y +79506 TX -6.0 Y +79508 TX -6.0 Y +79510 TX -6.0 Y +79511 TX -6.0 Y +79512 TX -6.0 Y +79516 TX -6.0 Y +79517 TX -6.0 Y +79518 TX -6.0 Y +79519 TX -6.0 Y +79520 TX -6.0 Y +79521 TX -6.0 Y +79525 TX -6.0 Y +79526 TX -6.0 Y +79527 TX -6.0 Y +79528 TX -6.0 Y +79529 TX -6.0 Y +79530 TX -6.0 Y +79532 TX -6.0 Y +79533 TX -6.0 Y +79534 TX -6.0 Y +79535 TX -6.0 Y +79536 TX -6.0 Y +79537 TX -6.0 Y +79538 TX -6.0 Y +79539 TX -6.0 Y +79540 TX -6.0 Y +79541 TX -6.0 Y +79543 TX -6.0 Y +79544 TX -6.0 Y +79545 TX -6.0 Y +79546 TX -6.0 Y +79547 TX -6.0 Y +79548 TX -6.0 Y +79549 TX -6.0 Y +79550 TX -6.0 Y +79553 TX -6.0 Y +79556 TX -6.0 Y +79560 TX -6.0 Y +79561 TX -6.0 Y +79562 TX -6.0 Y +79563 TX -6.0 Y +79565 TX -6.0 Y +79566 TX -6.0 Y +79567 TX -6.0 Y +79601 TX -6.0 Y +79602 TX -6.0 Y +79603 TX -6.0 Y +79604 TX -6.0 Y +79605 TX -6.0 Y +79606 TX -6.0 Y +79607 TX -6.0 Y +79608 TX -6.0 Y +79697 TX -6.0 Y +79698 TX -6.0 Y +79699 TX -6.0 Y +79701 TX -6.0 Y +79702 TX -6.0 Y +79703 TX -6.0 Y +79704 TX -6.0 Y +79705 TX -6.0 Y +79706 TX -6.0 Y +79707 TX -6.0 Y +79708 TX -6.0 Y +79710 TX -6.0 Y +79711 TX -6.0 Y +79712 TX -6.0 Y +79713 TX -6.0 Y +79714 TX -6.0 Y +79718 TX -6.0 Y +79719 TX -6.0 Y +79720 TX -6.0 Y +79721 TX -6.0 Y +79730 TX -6.0 Y +79731 TX -6.0 Y +79733 TX -6.0 Y +79734 TX -6.0 Y +79735 TX -6.0 Y +79738 TX -6.0 Y +79739 TX -6.0 Y +79740 TX -6.0 Y +79741 TX -6.0 Y +79742 TX -6.0 Y +79743 TX -6.0 Y +79744 TX -6.0 Y +79745 TX -6.0 Y +79748 TX -6.0 Y +79749 TX -6.0 Y +79752 TX -6.0 Y +79754 TX -6.0 Y +79755 TX -6.0 Y +79756 TX -6.0 Y +79758 TX -6.0 Y +79759 TX -6.0 Y +79760 TX -6.0 Y +79761 TX -6.0 Y +79762 TX -6.0 Y +79763 TX -6.0 Y +79764 TX -6.0 Y +79765 TX -6.0 Y +79766 TX -6.0 Y +79768 TX -6.0 Y +79769 TX -6.0 Y +79770 TX -6.0 Y +79772 TX -6.0 Y +79776 TX -6.0 Y +79777 TX -6.0 Y +79778 TX -6.0 Y +79780 TX -6.0 Y +79781 TX -6.0 Y +79782 TX -6.0 Y +79783 TX -6.0 Y +79785 TX -6.0 Y +79786 TX -6.0 Y +79788 TX -6.0 Y +79789 TX -6.0 Y +79821 TX -7.0 Y +79830 TX -6.0 Y +79831 TX -6.0 Y +79832 TX -6.0 Y +79834 TX -6.0 Y +79835 TX -7.0 Y +79836 TX -7.0 Y +79837 TX -7.0 Y +79838 TX -7.0 Y +79839 TX -7.0 Y +79842 TX -6.0 Y +79843 TX -6.0 Y +79845 TX -6.0 Y +79846 TX -6.0 Y +79847 TX -7.0 Y +79848 TX -6.0 Y +79849 TX -7.0 Y +79851 TX -7.0 Y +79852 TX -6.0 Y +79853 TX -7.0 Y +79854 TX -6.0 Y +79855 TX -6.0 Y +79901 TX -7.0 Y +79902 TX -7.0 Y +79903 TX -7.0 Y +79904 TX -7.0 Y +79905 TX -7.0 Y +79906 TX -7.0 Y +79907 TX -7.0 Y +79908 TX -7.0 Y +79910 TX -7.0 Y +79911 TX -7.0 Y +79912 TX -7.0 Y +79913 TX -7.0 Y +79914 TX -7.0 Y +79915 TX -7.0 Y +79916 TX -7.0 Y +79917 TX -7.0 Y +79918 TX -7.0 Y +79920 TX -7.0 Y +79922 TX -7.0 Y +79923 TX -7.0 Y +79924 TX -7.0 Y +79925 TX -7.0 Y +79926 TX -7.0 Y +79927 TX -7.0 Y +79928 TX -7.0 Y +79929 TX -7.0 Y +79930 TX -7.0 Y +79931 TX -7.0 Y +79932 TX -7.0 Y +79934 TX -7.0 Y +79935 TX -7.0 Y +79936 TX -7.0 Y +79937 TX -7.0 Y +79938 TX -7.0 Y +79940 TX -7.0 Y +79941 TX -7.0 Y +79942 TX -7.0 Y +79943 TX -7.0 Y +79944 TX -7.0 Y +79945 TX -7.0 Y +79946 TX -7.0 Y +79947 TX -7.0 Y +79948 TX -7.0 Y +79949 TX -7.0 Y +79950 TX -7.0 Y +79951 TX -7.0 Y +79952 TX -7.0 Y +79953 TX -7.0 Y +79954 TX -7.0 Y +79955 TX -7.0 Y +79958 TX -7.0 Y +79960 TX -7.0 Y +79961 TX -7.0 Y +79968 TX -7.0 Y +79976 TX -7.0 Y +79978 TX -7.0 Y +79980 TX -7.0 Y +79990 TX -7.0 Y +79995 TX -7.0 Y +79996 TX -7.0 Y +79997 TX -7.0 Y +79998 TX -7.0 Y +79999 TX -7.0 Y +80001 CO -7.0 Y +80002 CO -7.0 Y +80003 CO -7.0 Y +80004 CO -7.0 Y +80005 CO -7.0 Y +80006 CO -7.0 Y +80007 CO -7.0 Y +80010 CO -7.0 Y +80011 CO -7.0 Y +80012 CO -7.0 Y +80013 CO -7.0 Y +80014 CO -7.0 Y +80015 CO -7.0 Y +80016 CO -7.0 Y +80017 CO -7.0 Y +80018 CO -7.0 Y +80019 CO -7.0 Y +80020 CO -7.0 Y +80021 CO -7.0 Y +80022 CO -7.0 Y +80024 CO -7.0 Y +80025 CO -7.0 Y +80026 CO -7.0 Y +80027 CO -7.0 Y +80028 CO -7.0 Y +80030 CO -7.0 Y +80031 CO -7.0 Y +80033 CO -7.0 Y +80034 CO -7.0 Y +80035 CO -7.0 Y +80036 CO -7.0 Y +80037 CO -7.0 Y +80038 CO -7.0 Y +80040 CO -7.0 Y +80041 CO -7.0 Y +80042 CO -7.0 Y +80044 CO -7.0 Y +80045 CO -7.0 Y +80046 CO -7.0 Y +80047 CO -7.0 Y +80101 CO -7.0 Y +80102 CO -7.0 Y +80103 CO -7.0 Y +80104 CO -7.0 Y +80105 CO -7.0 Y +80106 CO -7.0 Y +80107 CO -7.0 Y +80108 CO -7.0 Y +80109 CO -7.0 Y +80110 CO -7.0 Y +80111 CO -7.0 Y +80112 CO -7.0 Y +80113 CO -7.0 Y +80116 CO -7.0 Y +80117 CO -7.0 Y +80118 CO -7.0 Y +80120 CO -7.0 Y +80121 CO -7.0 Y +80122 CO -7.0 Y +80123 CO -7.0 Y +80124 CO -7.0 Y +80125 CO -7.0 Y +80126 CO -7.0 Y +80127 CO -7.0 Y +80128 CO -7.0 Y +80129 CO -7.0 Y +80130 CO -7.0 Y +80131 CO -7.0 Y +80132 CO -7.0 Y +80133 CO -7.0 Y +80134 CO -7.0 Y +80135 CO -7.0 Y +80136 CO -7.0 Y +80137 CO -7.0 Y +80138 CO -7.0 Y +80150 CO -7.0 Y +80151 CO -7.0 Y +80155 CO -7.0 Y +80160 CO -7.0 Y +80161 CO -7.0 Y +80162 CO -7.0 Y +80163 CO -7.0 Y +80165 CO -7.0 Y +80166 CO -7.0 Y +80201 CO -7.0 Y +80202 CO -7.0 Y +80203 CO -7.0 Y +80204 CO -7.0 Y +80205 CO -7.0 Y +80206 CO -7.0 Y +80207 CO -7.0 Y +80208 CO -7.0 Y +80209 CO -7.0 Y +80210 CO -7.0 Y +80211 CO -7.0 Y +80212 CO -7.0 Y +80214 CO -7.0 Y +80215 CO -7.0 Y +80216 CO -7.0 Y +80217 CO -7.0 Y +80218 CO -7.0 Y +80219 CO -7.0 Y +80220 CO -7.0 Y +80221 CO -7.0 Y +80222 CO -7.0 Y +80223 CO -7.0 Y +80224 CO -7.0 Y +80225 CO -7.0 Y +80226 CO -7.0 Y +80227 CO -7.0 Y +80228 CO -7.0 Y +80229 CO -7.0 Y +80230 CO -7.0 Y +80231 CO -7.0 Y +80232 CO -7.0 Y +80233 CO -7.0 Y +80234 CO -7.0 Y +80235 CO -7.0 Y +80236 CO -7.0 Y +80237 CO -7.0 Y +80238 CO -7.0 Y +80239 CO -7.0 Y +80241 CO -7.0 Y +80243 CO -7.0 Y +80244 CO -7.0 Y +80246 CO -7.0 Y +80247 CO -7.0 Y +80248 CO -7.0 Y +80249 CO -7.0 Y +80250 CO -7.0 Y +80251 CO -7.0 Y +80252 CO -7.0 Y +80256 CO -7.0 Y +80257 CO -7.0 Y +80259 CO -7.0 Y +80260 CO -7.0 Y +80261 CO -7.0 Y +80262 CO -7.0 Y +80263 CO -7.0 Y +80264 CO -7.0 Y +80265 CO -7.0 Y +80266 CO -7.0 Y +80271 CO -7.0 Y +80273 CO -7.0 Y +80274 CO -7.0 Y +80279 CO -7.0 Y +80280 CO -7.0 Y +80281 CO -7.0 Y +80290 CO -7.0 Y +80291 CO -7.0 Y +80293 CO -7.0 Y +80294 CO -7.0 Y +80295 CO -7.0 Y +80299 CO -7.0 Y +80301 CO -7.0 Y +80302 CO -7.0 Y +80303 CO -7.0 Y +80304 CO -7.0 Y +80305 CO -7.0 Y +80306 CO -7.0 Y +80307 CO -7.0 Y +80308 CO -7.0 Y +80309 CO -7.0 Y +80310 CO -7.0 Y +80314 CO -7.0 Y +80321 CO -7.0 Y +80322 CO -7.0 Y +80323 CO -7.0 Y +80328 CO -7.0 Y +80329 CO -7.0 Y +80401 CO -7.0 Y +80402 CO -7.0 Y +80403 CO -7.0 Y +80419 CO -7.0 Y +80420 CO -7.0 Y +80421 CO -7.0 Y +80422 CO -7.0 Y +80423 CO -7.0 Y +80424 CO -7.0 Y +80425 CO -7.0 Y +80426 CO -7.0 Y +80427 CO -7.0 Y +80428 CO -7.0 Y +80429 CO -7.0 Y +80430 CO -7.0 Y +80432 CO -7.0 Y +80433 CO -7.0 Y +80434 CO -7.0 Y +80435 CO -7.0 Y +80436 CO -7.0 Y +80437 CO -7.0 Y +80438 CO -7.0 Y +80439 CO -7.0 Y +80440 CO -7.0 Y +80442 CO -7.0 Y +80443 CO -7.0 Y +80444 CO -7.0 Y +80446 CO -7.0 Y +80447 CO -7.0 Y +80448 CO -7.0 Y +80449 CO -7.0 Y +80451 CO -7.0 Y +80452 CO -7.0 Y +80453 CO -7.0 Y +80454 CO -7.0 Y +80455 CO -7.0 Y +80456 CO -7.0 Y +80457 CO -7.0 Y +80459 CO -7.0 Y +80461 CO -7.0 Y +80463 CO -7.0 Y +80465 CO -7.0 Y +80466 CO -7.0 Y +80467 CO -7.0 Y +80468 CO -7.0 Y +80469 CO -7.0 Y +80470 CO -7.0 Y +80471 CO -7.0 Y +80473 CO -7.0 Y +80474 CO -7.0 Y +80475 CO -7.0 Y +80476 CO -7.0 Y +80477 CO -7.0 Y +80478 CO -7.0 Y +80479 CO -7.0 Y +80480 CO -7.0 Y +80481 CO -7.0 Y +80482 CO -7.0 Y +80483 CO -7.0 Y +80487 CO -7.0 Y +80488 CO -7.0 Y +80497 CO -7.0 Y +80498 CO -7.0 Y +80501 CO -7.0 Y +80502 CO -7.0 Y +80503 CO -7.0 Y +80504 CO -7.0 Y +80510 CO -7.0 Y +80511 CO -7.0 Y +80512 CO -7.0 Y +80513 CO -7.0 Y +80514 CO -7.0 Y +80515 CO -7.0 Y +80516 CO -7.0 Y +80517 CO -7.0 Y +80520 CO -7.0 Y +80521 CO -7.0 Y +80522 CO -7.0 Y +80523 CO -7.0 Y +80524 CO -7.0 Y +80525 CO -7.0 Y +80526 CO -7.0 Y +80527 CO -7.0 Y +80528 CO -7.0 Y +80530 CO -7.0 Y +80532 CO -7.0 Y +80533 CO -7.0 Y +80534 CO -7.0 Y +80535 CO -7.0 Y +80536 CO -7.0 Y +80537 CO -7.0 Y +80538 CO -7.0 Y +80539 CO -7.0 Y +80540 CO -7.0 Y +80541 CO -7.0 Y +80542 CO -7.0 Y +80543 CO -7.0 Y +80544 CO -7.0 Y +80545 CO -7.0 Y +80546 CO -7.0 Y +80547 CO -7.0 Y +80549 CO -7.0 Y +80550 CO -7.0 Y +80551 CO -7.0 Y +80553 CO -7.0 Y +80601 CO -7.0 Y +80602 CO -7.0 Y +80603 CO -7.0 Y +80610 CO -7.0 Y +80611 CO -7.0 Y +80612 CO -7.0 Y +80614 CO -7.0 Y +80615 CO -7.0 Y +80620 CO -7.0 Y +80621 CO -7.0 Y +80622 CO -7.0 Y +80623 CO -7.0 Y +80624 CO -7.0 Y +80631 CO -7.0 Y +80632 CO -7.0 Y +80633 CO -7.0 Y +80634 CO -7.0 Y +80638 CO -7.0 Y +80639 CO -7.0 Y +80640 CO -7.0 Y +80642 CO -7.0 Y +80643 CO -7.0 Y +80644 CO -7.0 Y +80645 CO -7.0 Y +80646 CO -7.0 Y +80648 CO -7.0 Y +80649 CO -7.0 Y +80650 CO -7.0 Y +80651 CO -7.0 Y +80652 CO -7.0 Y +80653 CO -7.0 Y +80654 CO -7.0 Y +80701 CO -7.0 Y +80705 CO -7.0 Y +80720 CO -7.0 Y +80721 CO -7.0 Y +80722 CO -7.0 Y +80723 CO -7.0 Y +80726 CO -7.0 Y +80727 CO -7.0 Y +80728 CO -7.0 Y +80729 CO -7.0 Y +80731 CO -7.0 Y +80732 CO -7.0 Y +80733 CO -7.0 Y +80734 CO -7.0 Y +80735 CO -7.0 Y +80736 CO -7.0 Y +80737 CO -7.0 Y +80740 CO -7.0 Y +80741 CO -7.0 Y +80742 CO -7.0 Y +80743 CO -7.0 Y +80744 CO -7.0 Y +80745 CO -7.0 Y +80746 CO -7.0 Y +80747 CO -7.0 Y +80749 CO -7.0 Y +80750 CO -7.0 Y +80751 CO -7.0 Y +80754 CO -7.0 Y +80755 CO -7.0 Y +80757 CO -7.0 Y +80758 CO -7.0 Y +80759 CO -7.0 Y +80801 CO -7.0 Y +80802 CO -7.0 Y +80804 CO -7.0 Y +80805 CO -7.0 Y +80807 CO -7.0 Y +80808 CO -7.0 Y +80809 CO -7.0 Y +80810 CO -7.0 Y +80812 CO -7.0 Y +80813 CO -7.0 Y +80814 CO -7.0 Y +80815 CO -7.0 Y +80816 CO -7.0 Y +80817 CO -7.0 Y +80818 CO -7.0 Y +80819 CO -7.0 Y +80820 CO -7.0 Y +80821 CO -7.0 Y +80822 CO -7.0 Y +80823 CO -7.0 Y +80824 CO -7.0 Y +80825 CO -7.0 Y +80826 CO -7.0 Y +80827 CO -7.0 Y +80828 CO -7.0 Y +80829 CO -7.0 Y +80830 CO -7.0 Y +80831 CO -7.0 Y +80832 CO -7.0 Y +80833 CO -7.0 Y +80834 CO -7.0 Y +80835 CO -7.0 Y +80836 CO -7.0 Y +80840 CO -7.0 Y +80841 CO -7.0 Y +80860 CO -7.0 Y +80861 CO -7.0 Y +80862 CO -7.0 Y +80863 CO -7.0 Y +80864 CO -7.0 Y +80866 CO -7.0 Y +80901 CO -7.0 Y +80903 CO -7.0 Y +80904 CO -7.0 Y +80905 CO -7.0 Y +80906 CO -7.0 Y +80907 CO -7.0 Y +80908 CO -7.0 Y +80909 CO -7.0 Y +80910 CO -7.0 Y +80911 CO -7.0 Y +80912 CO -7.0 Y +80913 CO -7.0 Y +80914 CO -7.0 Y +80915 CO -7.0 Y +80916 CO -7.0 Y +80917 CO -7.0 Y +80918 CO -7.0 Y +80919 CO -7.0 Y +80920 CO -7.0 Y +80921 CO -7.0 Y +80922 CO -7.0 Y +80923 CO -7.0 Y +80924 CO -7.0 Y +80925 CO -7.0 Y +80926 CO -7.0 Y +80927 CO -7.0 Y +80928 CO -7.0 Y +80929 CO -7.0 Y +80930 CO -7.0 Y +80931 CO -7.0 Y +80932 CO -7.0 Y +80933 CO -7.0 Y +80934 CO -7.0 Y +80935 CO -7.0 Y +80936 CO -7.0 Y +80937 CO -7.0 Y +80938 CO -7.0 Y +80939 CO -7.0 Y +80940 CO -7.0 Y +80941 CO -7.0 Y +80942 CO -7.0 Y +80943 CO -7.0 Y +80944 CO -7.0 Y +80945 CO -7.0 Y +80946 CO -7.0 Y +80947 CO -7.0 Y +80949 CO -7.0 Y +80950 CO -7.0 Y +80951 CO -7.0 Y +80960 CO -7.0 Y +80962 CO -7.0 Y +80970 CO -7.0 Y +80977 CO -7.0 Y +80995 CO -7.0 Y +80997 CO -7.0 Y +81001 CO -7.0 Y +81002 CO -7.0 Y +81003 CO -7.0 Y +81004 CO -7.0 Y +81005 CO -7.0 Y +81006 CO -7.0 Y +81007 CO -7.0 Y +81008 CO -7.0 Y +81009 CO -7.0 Y +81010 CO -7.0 Y +81011 CO -7.0 Y +81012 CO -7.0 Y +81019 CO -7.0 Y +81020 CO -7.0 Y +81021 CO -7.0 Y +81022 CO -7.0 Y +81023 CO -7.0 Y +81024 CO -7.0 Y +81025 CO -7.0 Y +81027 CO -7.0 Y +81029 CO -7.0 Y +81030 CO -7.0 Y +81033 CO -7.0 Y +81034 CO -7.0 Y +81036 CO -7.0 Y +81038 CO -7.0 Y +81039 CO -7.0 Y +81040 CO -7.0 Y +81041 CO -7.0 Y +81043 CO -7.0 Y +81044 CO -7.0 Y +81045 CO -7.0 Y +81046 CO -7.0 Y +81047 CO -7.0 Y +81049 CO -7.0 Y +81050 CO -7.0 Y +81052 CO -7.0 Y +81054 CO -7.0 Y +81055 CO -7.0 Y +81057 CO -7.0 Y +81058 CO -7.0 Y +81059 CO -7.0 Y +81062 CO -7.0 Y +81063 CO -7.0 Y +81064 CO -7.0 Y +81067 CO -7.0 Y +81069 CO -7.0 Y +81071 CO -7.0 Y +81073 CO -7.0 Y +81076 CO -7.0 Y +81077 CO -7.0 Y +81081 CO -7.0 Y +81082 CO -7.0 Y +81084 CO -7.0 Y +81087 CO -7.0 Y +81089 CO -7.0 Y +81090 CO -7.0 Y +81091 CO -7.0 Y +81092 CO -7.0 Y +81101 CO -7.0 Y +81102 CO -7.0 Y +81120 CO -7.0 Y +81121 CO -7.0 Y +81122 CO -7.0 Y +81123 CO -7.0 Y +81124 CO -7.0 Y +81125 CO -7.0 Y +81126 CO -7.0 Y +81127 CO -7.0 Y +81128 CO -7.0 Y +81129 CO -7.0 Y +81130 CO -7.0 Y +81131 CO -7.0 Y +81132 CO -7.0 Y +81133 CO -7.0 Y +81134 CO -7.0 Y +81135 CO -7.0 Y +81136 CO -7.0 Y +81137 CO -7.0 Y +81138 CO -7.0 Y +81140 CO -7.0 Y +81141 CO -7.0 Y +81143 CO -7.0 Y +81144 CO -7.0 Y +81146 CO -7.0 Y +81147 CO -7.0 Y +81148 CO -7.0 Y +81149 CO -7.0 Y +81151 CO -7.0 Y +81152 CO -7.0 Y +81153 CO -7.0 Y +81154 CO -7.0 Y +81155 CO -7.0 Y +81157 CO -7.0 Y +81201 CO -7.0 Y +81210 CO -7.0 Y +81211 CO -7.0 Y +81212 CO -7.0 Y +81215 CO -7.0 Y +81220 CO -7.0 Y +81221 CO -7.0 Y +81222 CO -7.0 Y +81223 CO -7.0 Y +81224 CO -7.0 Y +81225 CO -7.0 Y +81226 CO -7.0 Y +81227 CO -7.0 Y +81228 CO -7.0 Y +81230 CO -7.0 Y +81231 CO -7.0 Y +81232 CO -7.0 Y +81233 CO -7.0 Y +81235 CO -7.0 Y +81236 CO -7.0 Y +81237 CO -7.0 Y +81239 CO -7.0 Y +81240 CO -7.0 Y +81241 CO -7.0 Y +81242 CO -7.0 Y +81243 CO -7.0 Y +81244 CO -7.0 Y +81247 CO -7.0 Y +81248 CO -7.0 Y +81251 CO -7.0 Y +81252 CO -7.0 Y +81253 CO -7.0 Y +81290 CO -7.0 Y +81301 CO -7.0 Y +81302 CO -7.0 Y +81303 CO -7.0 Y +81320 CO -7.0 Y +81321 CO -7.0 Y +81323 CO -7.0 Y +81324 CO -7.0 Y +81325 CO -7.0 Y +81326 CO -7.0 Y +81327 CO -7.0 Y +81328 CO -7.0 Y +81329 CO -7.0 Y +81330 CO -7.0 Y +81331 CO -7.0 Y +81332 CO -7.0 Y +81334 CO -7.0 Y +81335 CO -7.0 Y +81401 CO -7.0 Y +81402 CO -7.0 Y +81410 CO -7.0 Y +81411 CO -7.0 Y +81413 CO -7.0 Y +81414 CO -7.0 Y +81415 CO -7.0 Y +81416 CO -7.0 Y +81418 CO -7.0 Y +81419 CO -7.0 Y +81420 CO -7.0 Y +81422 CO -7.0 Y +81423 CO -7.0 Y +81424 CO -7.0 Y +81425 CO -7.0 Y +81426 CO -7.0 Y +81427 CO -7.0 Y +81428 CO -7.0 Y +81429 CO -7.0 Y +81430 CO -7.0 Y +81431 CO -7.0 Y +81432 CO -7.0 Y +81433 CO -7.0 Y +81434 CO -7.0 Y +81435 CO -7.0 Y +81501 CO -7.0 Y +81502 CO -7.0 Y +81503 CO -7.0 Y +81504 CO -7.0 Y +81505 CO -7.0 Y +81506 CO -7.0 Y +81520 CO -7.0 Y +81521 CO -7.0 Y +81522 CO -7.0 Y +81523 CO -7.0 Y +81524 CO -7.0 Y +81525 CO -7.0 Y +81526 CO -7.0 Y +81527 CO -7.0 Y +81601 CO -7.0 Y +81602 CO -7.0 Y +81610 CO -7.0 Y +81611 CO -7.0 Y +81612 CO -7.0 Y +81615 CO -7.0 Y +81620 CO -7.0 Y +81621 CO -7.0 Y +81623 CO -7.0 Y +81624 CO -7.0 Y +81625 CO -7.0 Y +81626 CO -7.0 Y +81630 CO -7.0 Y +81631 CO -7.0 Y +81632 CO -7.0 Y +81633 CO -7.0 Y +81635 CO -7.0 Y +81636 CO -7.0 Y +81637 CO -7.0 Y +81638 CO -7.0 Y +81639 CO -7.0 Y +81640 CO -7.0 Y +81641 CO -7.0 Y +81642 CO -7.0 Y +81643 CO -7.0 Y +81645 CO -7.0 Y +81646 CO -7.0 Y +81647 CO -7.0 Y +81648 CO -7.0 Y +81649 CO -7.0 Y +81650 CO -7.0 Y +81652 CO -7.0 Y +81653 CO -7.0 Y +81654 CO -7.0 Y +81655 CO -7.0 Y +81656 CO -7.0 Y +81657 CO -7.0 Y +81658 CO -7.0 Y +82001 WY -7.0 Y +82002 WY -7.0 Y +82003 WY -7.0 Y +82005 WY -7.0 Y +82006 WY -7.0 Y +82007 WY -7.0 Y +82008 WY -7.0 Y +82009 WY -7.0 Y +82010 WY -7.0 Y +82050 WY -7.0 Y +82051 WY -7.0 Y +82052 WY -7.0 Y +82053 WY -7.0 Y +82054 WY -7.0 Y +82055 WY -7.0 Y +82058 WY -7.0 Y +82059 WY -7.0 Y +82060 WY -7.0 Y +82061 WY -7.0 Y +82063 WY -7.0 Y +82070 WY -7.0 Y +82071 WY -7.0 Y +82072 WY -7.0 Y +82073 WY -7.0 Y +82081 WY -7.0 Y +82082 WY -7.0 Y +82083 WY -7.0 Y +82084 WY -7.0 Y +82190 WY -7.0 Y +82201 WY -7.0 Y +82210 WY -7.0 Y +82212 WY -7.0 Y +82213 WY -7.0 Y +82214 WY -7.0 Y +82215 WY -7.0 Y +82217 WY -7.0 Y +82218 WY -7.0 Y +82219 WY -7.0 Y +82221 WY -7.0 Y +82222 WY -7.0 Y +82223 WY -7.0 Y +82224 WY -7.0 Y +82225 WY -7.0 Y +82227 WY -7.0 Y +82229 WY -7.0 Y +82240 WY -7.0 Y +82242 WY -7.0 Y +82243 WY -7.0 Y +82244 WY -7.0 Y +82301 WY -7.0 Y +82310 WY -7.0 Y +82321 WY -7.0 Y +82322 WY -7.0 Y +82323 WY -7.0 Y +82324 WY -7.0 Y +82325 WY -7.0 Y +82327 WY -7.0 Y +82329 WY -7.0 Y +82331 WY -7.0 Y +82332 WY -7.0 Y +82334 WY -7.0 Y +82335 WY -7.0 Y +82336 WY -7.0 Y +82401 WY -7.0 Y +82410 WY -7.0 Y +82411 WY -7.0 Y +82412 WY -7.0 Y +82414 WY -7.0 Y +82420 WY -7.0 Y +82421 WY -7.0 Y +82422 WY -7.0 Y +82423 WY -7.0 Y +82426 WY -7.0 Y +82428 WY -7.0 Y +82430 WY -7.0 Y +82431 WY -7.0 Y +82432 WY -7.0 Y +82433 WY -7.0 Y +82434 WY -7.0 Y +82435 WY -7.0 Y +82440 WY -7.0 Y +82441 WY -7.0 Y +82442 WY -7.0 Y +82443 WY -7.0 Y +82450 WY -7.0 Y +82501 WY -7.0 Y +82510 WY -7.0 Y +82512 WY -7.0 Y +82513 WY -7.0 Y +82514 WY -7.0 Y +82515 WY -7.0 Y +82516 WY -7.0 Y +82520 WY -7.0 Y +82523 WY -7.0 Y +82524 WY -7.0 Y +82601 WY -7.0 Y +82602 WY -7.0 Y +82604 WY -7.0 Y +82605 WY -7.0 Y +82609 WY -7.0 Y +82615 WY -7.0 Y +82620 WY -7.0 Y +82630 WY -7.0 Y +82633 WY -7.0 Y +82635 WY -7.0 Y +82636 WY -7.0 Y +82637 WY -7.0 Y +82638 WY -7.0 Y +82639 WY -7.0 Y +82640 WY -7.0 Y +82642 WY -7.0 Y +82643 WY -7.0 Y +82644 WY -7.0 Y +82646 WY -7.0 Y +82648 WY -7.0 Y +82649 WY -7.0 Y +82701 WY -7.0 Y +82710 WY -7.0 Y +82711 WY -7.0 Y +82712 WY -7.0 Y +82714 WY -7.0 Y +82715 WY -7.0 Y +82716 WY -7.0 Y +82717 WY -7.0 Y +82718 WY -7.0 Y +82720 WY -7.0 Y +82721 WY -7.0 Y +82723 WY -7.0 Y +82725 WY -7.0 Y +82727 WY -7.0 Y +82729 WY -7.0 Y +82730 WY -7.0 Y +82731 WY -7.0 Y +82732 WY -7.0 Y +82801 WY -7.0 Y +82831 WY -7.0 Y +82832 WY -7.0 Y +82833 WY -7.0 Y +82834 WY -7.0 Y +82835 WY -7.0 Y +82836 WY -7.0 Y +82837 WY -7.0 Y +82838 WY -7.0 Y +82839 WY -7.0 Y +82840 WY -7.0 Y +82842 WY -7.0 Y +82844 WY -7.0 Y +82845 WY -7.0 Y +82901 WY -7.0 Y +82902 WY -7.0 Y +82922 WY -7.0 Y +82923 WY -7.0 Y +82925 WY -7.0 Y +82929 WY -7.0 Y +82930 WY -7.0 Y +82931 WY -7.0 Y +82932 WY -7.0 Y +82933 WY -7.0 Y +82934 WY -7.0 Y +82935 WY -7.0 Y +82936 WY -7.0 Y +82937 WY -7.0 Y +82938 WY -7.0 Y +82939 WY -7.0 Y +82941 WY -7.0 Y +82942 WY -7.0 Y +82943 WY -7.0 Y +82944 WY -7.0 Y +82945 WY -7.0 Y +83001 WY -7.0 Y +83002 WY -7.0 Y +83011 WY -7.0 Y +83012 WY -7.0 Y +83013 WY -7.0 Y +83014 WY -7.0 Y +83025 WY -7.0 Y +83101 WY -7.0 Y +83110 WY -7.0 Y +83111 WY -7.0 Y +83112 WY -7.0 Y +83113 WY -7.0 Y +83114 WY -7.0 Y +83115 WY -7.0 Y +83116 WY -7.0 Y +83118 WY -7.0 Y +83119 WY -7.0 Y +83120 WY -7.0 Y +83121 WY -7.0 Y +83122 WY -7.0 Y +83123 WY -7.0 Y +83124 WY -7.0 Y +83126 WY -7.0 Y +83127 WY -7.0 Y +83128 WY -7.0 Y +83201 ID -7.0 Y +83202 ID -7.0 Y +83203 ID -7.0 Y +83204 ID -7.0 Y +83205 ID -7.0 Y +83206 ID -7.0 Y +83209 ID -7.0 Y +83210 ID -7.0 Y +83211 ID -7.0 Y +83212 ID -7.0 Y +83213 ID -7.0 Y +83214 ID -7.0 Y +83215 ID -7.0 Y +83217 ID -7.0 Y +83218 ID -7.0 Y +83220 ID -7.0 Y +83221 ID -7.0 Y +83223 ID -7.0 Y +83226 ID -7.0 Y +83227 ID -7.0 Y +83228 ID -7.0 Y +83229 ID -7.0 Y +83230 ID -7.0 Y +83232 ID -7.0 Y +83233 ID -7.0 Y +83234 ID -7.0 Y +83235 ID -7.0 Y +83236 ID -7.0 Y +83237 ID -7.0 Y +83238 ID -7.0 Y +83239 ID -7.0 Y +83241 ID -7.0 Y +83243 ID -7.0 Y +83244 ID -7.0 Y +83245 ID -7.0 Y +83246 ID -7.0 Y +83250 ID -7.0 Y +83251 ID -7.0 Y +83252 ID -7.0 Y +83253 ID -7.0 Y +83254 ID -7.0 Y +83255 ID -7.0 Y +83256 ID -7.0 Y +83261 ID -7.0 Y +83262 ID -7.0 Y +83263 ID -7.0 Y +83271 ID -7.0 Y +83272 ID -7.0 Y +83274 ID -7.0 Y +83276 ID -7.0 Y +83277 ID -7.0 Y +83278 ID -7.0 Y +83281 ID -7.0 Y +83283 ID -7.0 Y +83285 ID -7.0 Y +83286 ID -7.0 Y +83287 ID -7.0 Y +83301 ID -7.0 Y +83302 ID -7.0 Y +83303 ID -7.0 Y +83311 ID -7.0 Y +83312 ID -7.0 Y +83313 ID -7.0 Y +83314 ID -7.0 Y +83316 ID -7.0 Y +83318 ID -7.0 Y +83320 ID -7.0 Y +83321 ID -7.0 Y +83322 ID -7.0 Y +83323 ID -7.0 Y +83324 ID -7.0 Y +83325 ID -7.0 Y +83327 ID -7.0 Y +83328 ID -7.0 Y +83330 ID -7.0 Y +83332 ID -7.0 Y +83333 ID -7.0 Y +83334 ID -7.0 Y +83335 ID -7.0 Y +83336 ID -7.0 Y +83337 ID -7.0 Y +83338 ID -7.0 Y +83340 ID -7.0 Y +83341 ID -7.0 Y +83342 ID -7.0 Y +83343 ID -7.0 Y +83344 ID -7.0 Y +83346 ID -7.0 Y +83347 ID -7.0 Y +83348 ID -7.0 Y +83349 ID -7.0 Y +83350 ID -7.0 Y +83352 ID -7.0 Y +83353 ID -7.0 Y +83354 ID -7.0 Y +83355 ID -7.0 Y +83401 ID -7.0 Y +83402 ID -7.0 Y +83403 ID -7.0 Y +83404 ID -7.0 Y +83405 ID -7.0 Y +83406 ID -7.0 Y +83414 WY -7.0 Y +83415 ID -7.0 Y +83420 ID -7.0 Y +83421 ID -7.0 Y +83422 ID -7.0 Y +83423 ID -7.0 Y +83424 ID -7.0 Y +83425 ID -7.0 Y +83427 ID -7.0 Y +83428 ID -7.0 Y +83429 ID -7.0 Y +83431 ID -7.0 Y +83433 ID -7.0 Y +83434 ID -7.0 Y +83435 ID -7.0 Y +83436 ID -7.0 Y +83438 ID -7.0 Y +83440 ID -7.0 Y +83441 ID -7.0 Y +83442 ID -7.0 Y +83443 ID -7.0 Y +83444 ID -7.0 Y +83445 ID -7.0 Y +83446 ID -7.0 Y +83448 ID -7.0 Y +83449 ID -7.0 Y +83450 ID -7.0 Y +83451 ID -7.0 Y +83452 ID -7.0 Y +83454 ID -7.0 Y +83455 ID -7.0 Y +83460 ID -7.0 Y +83462 ID -7.0 Y +83463 ID -7.0 Y +83464 ID -7.0 Y +83465 ID -7.0 Y +83466 ID -7.0 Y +83467 ID -7.0 Y +83468 ID -7.0 Y +83469 ID -7.0 Y +83501 ID -8.0 Y +83520 ID -8.0 Y +83522 ID -8.0 Y +83523 ID -8.0 Y +83524 ID -8.0 Y +83525 ID -8.0 Y +83526 ID -8.0 Y +83530 ID -8.0 Y +83531 ID -8.0 Y +83533 ID -8.0 Y +83535 ID -8.0 Y +83536 ID -8.0 Y +83537 ID -8.0 Y +83539 ID -8.0 Y +83540 ID -8.0 Y +83541 ID -8.0 Y +83542 ID -8.0 Y +83543 ID -8.0 Y +83544 ID -8.0 Y +83545 ID -8.0 Y +83546 ID -8.0 Y +83547 ID -8.0 Y +83548 ID -8.0 Y +83549 ID -8.0 Y +83552 ID -8.0 Y +83553 ID -8.0 Y +83554 ID -8.0 Y +83555 ID -8.0 Y +83601 ID -7.0 Y +83602 ID -7.0 Y +83604 ID -7.0 Y +83605 ID -7.0 Y +83606 ID -7.0 Y +83607 ID -7.0 Y +83610 ID -7.0 Y +83611 ID -7.0 Y +83612 ID -7.0 Y +83615 ID -7.0 Y +83616 ID -7.0 Y +83617 ID -7.0 Y +83619 ID -7.0 Y +83622 ID -7.0 Y +83623 ID -7.0 Y +83624 ID -7.0 Y +83626 ID -7.0 Y +83627 ID -7.0 Y +83628 ID -7.0 Y +83629 ID -7.0 Y +83630 ID -7.0 Y +83631 ID -7.0 Y +83632 ID -7.0 Y +83633 ID -7.0 Y +83634 ID -7.0 Y +83635 ID -7.0 Y +83636 ID -7.0 Y +83637 ID -7.0 Y +83638 ID -7.0 Y +83639 ID -7.0 Y +83641 ID -7.0 Y +83642 ID -7.0 Y +83643 ID -7.0 Y +83644 ID -7.0 Y +83645 ID -7.0 Y +83646 ID -7.0 Y +83647 ID -7.0 Y +83648 ID -7.0 Y +83650 ID -7.0 Y +83651 ID -7.0 Y +83652 ID -7.0 Y +83653 ID -7.0 Y +83654 ID -7.0 Y +83655 ID -7.0 Y +83656 ID -7.0 Y +83657 ID -7.0 Y +83660 ID -7.0 Y +83661 ID -7.0 Y +83666 ID -7.0 Y +83669 ID -7.0 Y +83670 ID -7.0 Y +83671 ID -8.0 Y +83672 ID -7.0 Y +83676 ID -7.0 Y +83677 ID -7.0 Y +83680 ID -7.0 Y +83686 ID -7.0 Y +83687 ID -7.0 Y +83701 ID -7.0 Y +83702 ID -7.0 Y +83703 ID -7.0 Y +83704 ID -7.0 Y +83705 ID -7.0 Y +83706 ID -7.0 Y +83707 ID -7.0 Y +83708 ID -7.0 Y +83709 ID -7.0 Y +83711 ID -7.0 Y +83712 ID -7.0 Y +83713 ID -7.0 Y +83714 ID -7.0 Y +83715 ID -7.0 Y +83716 ID -7.0 Y +83717 ID -7.0 Y +83719 ID -7.0 Y +83720 ID -7.0 Y +83721 ID -7.0 Y +83722 ID -7.0 Y +83724 ID -7.0 Y +83725 ID -7.0 Y +83726 ID -7.0 Y +83727 ID -7.0 Y +83728 ID -7.0 Y +83729 ID -7.0 Y +83730 ID -7.0 Y +83731 ID -7.0 Y +83732 ID -7.0 Y +83733 ID -7.0 Y +83735 ID -7.0 Y +83756 ID -7.0 Y +83757 ID -7.0 Y +83799 ID -7.0 Y +83801 ID -8.0 Y +83802 ID -8.0 Y +83803 ID -8.0 Y +83804 ID -8.0 Y +83805 ID -8.0 Y +83806 ID -8.0 Y +83808 ID -8.0 Y +83809 ID -8.0 Y +83810 ID -8.0 Y +83811 ID -8.0 Y +83812 ID -8.0 Y +83813 ID -8.0 Y +83814 ID -8.0 Y +83815 ID -8.0 Y +83816 ID -8.0 Y +83821 ID -8.0 Y +83822 ID -8.0 Y +83823 ID -8.0 Y +83824 ID -8.0 Y +83825 ID -8.0 Y +83826 ID -8.0 Y +83827 ID -8.0 Y +83830 ID -8.0 Y +83832 ID -8.0 Y +83833 ID -8.0 Y +83834 ID -8.0 Y +83835 ID -8.0 Y +83836 ID -8.0 Y +83837 ID -8.0 Y +83839 ID -8.0 Y +83840 ID -8.0 Y +83841 ID -8.0 Y +83842 ID -8.0 Y +83843 ID -8.0 Y +83844 ID -8.0 Y +83845 ID -8.0 Y +83846 ID -8.0 Y +83847 ID -8.0 Y +83848 ID -8.0 Y +83849 ID -8.0 Y +83850 ID -8.0 Y +83851 ID -8.0 Y +83852 ID -8.0 Y +83853 ID -8.0 Y +83854 ID -8.0 Y +83855 ID -8.0 Y +83856 ID -8.0 Y +83857 ID -8.0 Y +83858 ID -8.0 Y +83860 ID -8.0 Y +83861 ID -8.0 Y +83864 ID -8.0 Y +83865 ID -8.0 Y +83866 ID -8.0 Y +83867 ID -8.0 Y +83868 ID -8.0 Y +83869 ID -8.0 Y +83870 ID -8.0 Y +83871 ID -8.0 Y +83872 ID -8.0 Y +83873 ID -8.0 Y +83874 ID -8.0 Y +83876 ID -8.0 Y +83877 ID -8.0 Y +84001 UT -7.0 Y +84002 UT -7.0 Y +84003 UT -7.0 Y +84004 UT -7.0 Y +84005 UT -7.0 Y +84006 UT -7.0 Y +84007 UT -7.0 Y +84008 UT -7.0 Y +84010 UT -7.0 Y +84011 UT -7.0 Y +84013 UT -7.0 Y +84014 UT -7.0 Y +84015 UT -7.0 Y +84016 UT -7.0 Y +84017 UT -7.0 Y +84018 UT -7.0 Y +84020 UT -7.0 Y +84021 UT -7.0 Y +84022 UT -7.0 Y +84023 UT -7.0 Y +84024 UT -7.0 Y +84025 UT -7.0 Y +84026 UT -7.0 Y +84027 UT -7.0 Y +84028 UT -7.0 Y +84029 UT -7.0 Y +84031 UT -7.0 Y +84032 UT -7.0 Y +84033 UT -7.0 Y +84034 UT -7.0 Y +84035 UT -7.0 Y +84036 UT -7.0 Y +84037 UT -7.0 Y +84038 UT -7.0 Y +84039 UT -7.0 Y +84040 UT -7.0 Y +84041 UT -7.0 Y +84042 UT -7.0 Y +84043 UT -7.0 Y +84044 UT -7.0 Y +84045 UT -7.0 Y +84046 UT -7.0 Y +84047 UT -7.0 Y +84049 UT -7.0 Y +84050 UT -7.0 Y +84051 UT -7.0 Y +84052 UT -7.0 Y +84053 UT -7.0 Y +84054 UT -7.0 Y +84055 UT -7.0 Y +84056 UT -7.0 Y +84057 UT -7.0 Y +84058 UT -7.0 Y +84059 UT -7.0 Y +84060 UT -7.0 Y +84061 UT -7.0 Y +84062 UT -7.0 Y +84063 UT -7.0 Y +84064 UT -7.0 Y +84065 UT -7.0 Y +84066 UT -7.0 Y +84067 UT -7.0 Y +84068 UT -7.0 Y +84069 UT -7.0 Y +84070 UT -7.0 Y +84071 UT -7.0 Y +84072 UT -7.0 Y +84073 UT -7.0 Y +84074 UT -7.0 Y +84075 UT -7.0 Y +84076 UT -7.0 Y +84078 UT -7.0 Y +84079 UT -7.0 Y +84080 UT -7.0 Y +84082 UT -7.0 Y +84083 UT -7.0 Y +84084 UT -7.0 Y +84085 UT -7.0 Y +84086 UT -7.0 Y +84087 UT -7.0 Y +84088 UT -7.0 Y +84089 UT -7.0 Y +84090 UT -7.0 Y +84091 UT -7.0 Y +84092 UT -7.0 Y +84093 UT -7.0 Y +84094 UT -7.0 Y +84095 UT -7.0 Y +84096 UT -7.0 Y +84097 UT -7.0 Y +84098 UT -7.0 Y +84101 UT -7.0 Y +84102 UT -7.0 Y +84103 UT -7.0 Y +84104 UT -7.0 Y +84105 UT -7.0 Y +84106 UT -7.0 Y +84107 UT -7.0 Y +84108 UT -7.0 Y +84109 UT -7.0 Y +84110 UT -7.0 Y +84111 UT -7.0 Y +84112 UT -7.0 Y +84113 UT -7.0 Y +84114 UT -7.0 Y +84115 UT -7.0 Y +84116 UT -7.0 Y +84117 UT -7.0 Y +84118 UT -7.0 Y +84119 UT -7.0 Y +84120 UT -7.0 Y +84121 UT -7.0 Y +84122 UT -7.0 Y +84123 UT -7.0 Y +84124 UT -7.0 Y +84125 UT -7.0 Y +84126 UT -7.0 Y +84127 UT -7.0 Y +84128 UT -7.0 Y +84130 UT -7.0 Y +84131 UT -7.0 Y +84132 UT -7.0 Y +84133 UT -7.0 Y +84134 UT -7.0 Y +84136 UT -7.0 Y +84138 UT -7.0 Y +84139 UT -7.0 Y +84141 UT -7.0 Y +84143 UT -7.0 Y +84144 UT -7.0 Y +84145 UT -7.0 Y +84147 UT -7.0 Y +84148 UT -7.0 Y +84150 UT -7.0 Y +84151 UT -7.0 Y +84152 UT -7.0 Y +84157 UT -7.0 Y +84158 UT -7.0 Y +84165 UT -7.0 Y +84170 UT -7.0 Y +84171 UT -7.0 Y +84180 UT -7.0 Y +84184 UT -7.0 Y +84189 UT -7.0 Y +84190 UT -7.0 Y +84199 UT -7.0 Y +84201 UT -7.0 Y +84244 UT -7.0 Y +84301 UT -7.0 Y +84302 UT -7.0 Y +84304 UT -7.0 Y +84305 UT -7.0 Y +84306 UT -7.0 Y +84307 UT -7.0 Y +84308 UT -7.0 Y +84309 UT -7.0 Y +84310 UT -7.0 Y +84311 UT -7.0 Y +84312 UT -7.0 Y +84313 UT -7.0 Y +84314 UT -7.0 Y +84315 UT -7.0 Y +84316 UT -7.0 Y +84317 UT -7.0 Y +84318 UT -7.0 Y +84319 UT -7.0 Y +84320 UT -7.0 Y +84321 UT -7.0 Y +84322 UT -7.0 Y +84323 UT -7.0 Y +84324 UT -7.0 Y +84325 UT -7.0 Y +84326 UT -7.0 Y +84327 UT -7.0 Y +84328 UT -7.0 Y +84329 UT -7.0 Y +84330 UT -7.0 Y +84331 UT -7.0 Y +84332 UT -7.0 Y +84333 UT -7.0 Y +84334 UT -7.0 Y +84335 UT -7.0 Y +84336 UT -7.0 Y +84337 UT -7.0 Y +84338 UT -7.0 Y +84339 UT -7.0 Y +84340 UT -7.0 Y +84341 UT -7.0 Y +84401 UT -7.0 Y +84402 UT -7.0 Y +84403 UT -7.0 Y +84404 UT -7.0 Y +84405 UT -7.0 Y +84407 UT -7.0 Y +84408 UT -7.0 Y +84409 UT -7.0 Y +84412 UT -7.0 Y +84414 UT -7.0 Y +84415 UT -7.0 Y +84501 UT -7.0 Y +84510 UT -7.0 Y +84511 UT -7.0 Y +84512 UT -7.0 Y +84513 UT -7.0 Y +84515 UT -7.0 Y +84516 UT -7.0 Y +84518 UT -7.0 Y +84520 UT -7.0 Y +84521 UT -7.0 Y +84522 UT -7.0 Y +84523 UT -7.0 Y +84525 UT -7.0 Y +84526 UT -7.0 Y +84528 UT -7.0 Y +84529 UT -7.0 Y +84530 UT -7.0 Y +84531 UT -7.0 Y +84532 UT -7.0 Y +84533 UT -7.0 Y +84534 UT -7.0 Y +84535 UT -7.0 Y +84536 UT -7.0 Y +84537 UT -7.0 Y +84539 UT -7.0 Y +84540 UT -7.0 Y +84542 UT -7.0 Y +84601 UT -7.0 Y +84602 UT -7.0 Y +84603 UT -7.0 Y +84604 UT -7.0 Y +84605 UT -7.0 Y +84606 UT -7.0 Y +84620 UT -7.0 Y +84621 UT -7.0 Y +84622 UT -7.0 Y +84623 UT -7.0 Y +84624 UT -7.0 Y +84626 UT -7.0 Y +84627 UT -7.0 Y +84628 UT -7.0 Y +84629 UT -7.0 Y +84630 UT -7.0 Y +84631 UT -7.0 Y +84632 UT -7.0 Y +84633 UT -7.0 Y +84634 UT -7.0 Y +84635 UT -7.0 Y +84636 UT -7.0 Y +84637 UT -7.0 Y +84638 UT -7.0 Y +84639 UT -7.0 Y +84640 UT -7.0 Y +84642 UT -7.0 Y +84643 UT -7.0 Y +84644 UT -7.0 Y +84645 UT -7.0 Y +84646 UT -7.0 Y +84647 UT -7.0 Y +84648 UT -7.0 Y +84649 UT -7.0 Y +84651 UT -7.0 Y +84652 UT -7.0 Y +84653 UT -7.0 Y +84654 UT -7.0 Y +84655 UT -7.0 Y +84656 UT -7.0 Y +84657 UT -7.0 Y +84660 UT -7.0 Y +84662 UT -7.0 Y +84663 UT -7.0 Y +84664 UT -7.0 Y +84665 UT -7.0 Y +84667 UT -7.0 Y +84701 UT -7.0 Y +84710 UT -7.0 Y +84711 UT -7.0 Y +84712 UT -7.0 Y +84713 UT -7.0 Y +84714 UT -7.0 Y +84715 UT -7.0 Y +84716 UT -7.0 Y +84718 UT -7.0 Y +84719 UT -7.0 Y +84720 UT -7.0 Y +84721 UT -7.0 Y +84722 UT -7.0 Y +84723 UT -7.0 Y +84724 UT -7.0 Y +84725 UT -7.0 Y +84726 UT -7.0 Y +84728 UT -7.0 Y +84729 UT -7.0 Y +84730 UT -7.0 Y +84731 UT -7.0 Y +84732 UT -7.0 Y +84733 UT -7.0 Y +84734 UT -7.0 Y +84735 UT -7.0 Y +84736 UT -7.0 Y +84737 UT -7.0 Y +84738 UT -7.0 Y +84739 UT -7.0 Y +84740 UT -7.0 Y +84741 UT -7.0 Y +84742 UT -7.0 Y +84743 UT -7.0 Y +84744 UT -7.0 Y +84745 UT -7.0 Y +84746 UT -7.0 Y +84747 UT -7.0 Y +84749 UT -7.0 Y +84750 UT -7.0 Y +84751 UT -7.0 Y +84752 UT -7.0 Y +84753 UT -7.0 Y +84754 UT -7.0 Y +84755 UT -7.0 Y +84756 UT -7.0 Y +84757 UT -7.0 Y +84758 UT -7.0 Y +84759 UT -7.0 Y +84760 UT -7.0 Y +84761 UT -7.0 Y +84762 UT -7.0 Y +84763 UT -7.0 Y +84764 UT -7.0 Y +84765 UT -7.0 Y +84766 UT -7.0 Y +84767 UT -7.0 Y +84770 UT -7.0 Y +84771 UT -7.0 Y +84772 UT -7.0 Y +84773 UT -7.0 Y +84774 UT -7.0 Y +84775 UT -7.0 Y +84776 UT -7.0 Y +84779 UT -7.0 Y +84780 UT -7.0 Y +84781 UT -7.0 Y +84782 UT -7.0 Y +84783 UT -7.0 Y +84784 UT -7.0 Y +84790 UT -7.0 Y +84791 UT -7.0 Y +85001 AZ -7.0 N +85002 AZ -7.0 N +85003 AZ -7.0 N +85004 AZ -7.0 N +85005 AZ -7.0 N +85006 AZ -7.0 N +85007 AZ -7.0 N +85008 AZ -7.0 N +85009 AZ -7.0 N +85010 AZ -7.0 N +85011 AZ -7.0 N +85012 AZ -7.0 N +85013 AZ -7.0 N +85014 AZ -7.0 N +85015 AZ -7.0 N +85016 AZ -7.0 N +85017 AZ -7.0 N +85018 AZ -7.0 N +85019 AZ -7.0 N +85020 AZ -7.0 N +85021 AZ -7.0 N +85022 AZ -7.0 N +85023 AZ -7.0 N +85024 AZ -7.0 N +85025 AZ -7.0 N +85026 AZ -7.0 N +85027 AZ -7.0 N +85028 AZ -7.0 N +85029 AZ -7.0 N +85030 AZ -7.0 N +85031 AZ -7.0 N +85032 AZ -7.0 N +85033 AZ -7.0 N +85034 AZ -7.0 N +85035 AZ -7.0 N +85036 AZ -7.0 N +85037 AZ -7.0 N +85038 AZ -7.0 N +85039 AZ -7.0 N +85040 AZ -7.0 N +85041 AZ -7.0 N +85042 AZ -7.0 N +85043 AZ -7.0 N +85044 AZ -7.0 N +85045 AZ -7.0 N +85046 AZ -7.0 N +85048 AZ -7.0 N +85050 AZ -7.0 N +85051 AZ -7.0 N +85053 AZ -7.0 N +85054 AZ -7.0 N +85055 AZ -7.0 N +85060 AZ -7.0 N +85061 AZ -7.0 N +85062 AZ -7.0 N +85063 AZ -7.0 N +85064 AZ -7.0 N +85065 AZ -7.0 N +85066 AZ -7.0 N +85067 AZ -7.0 N +85068 AZ -7.0 N +85069 AZ -7.0 N +85070 AZ -7.0 N +85071 AZ -7.0 N +85072 AZ -7.0 N +85073 AZ -7.0 N +85074 AZ -7.0 N +85075 AZ -7.0 N +85076 AZ -7.0 N +85077 AZ -7.0 N +85078 AZ -7.0 N +85079 AZ -7.0 N +85080 AZ -7.0 N +85082 AZ -7.0 N +85085 AZ -7.0 N +85086 AZ -7.0 N +85087 AZ -7.0 N +85098 AZ -7.0 N +85099 AZ -7.0 N +85201 AZ -7.0 N +85202 AZ -7.0 N +85203 AZ -7.0 N +85204 AZ -7.0 N +85205 AZ -7.0 N +85206 AZ -7.0 N +85207 AZ -7.0 N +85208 AZ -7.0 N +85209 AZ -7.0 N +85210 AZ -7.0 N +85211 AZ -7.0 N +85212 AZ -7.0 N +85213 AZ -7.0 N +85214 AZ -7.0 N +85215 AZ -7.0 N +85216 AZ -7.0 N +85217 AZ -7.0 N +85218 AZ -7.0 N +85219 AZ -7.0 N +85220 AZ -7.0 N +85221 AZ -7.0 N +85222 AZ -7.0 N +85223 AZ -7.0 N +85224 AZ -7.0 N +85225 AZ -7.0 N +85226 AZ -7.0 N +85227 AZ -7.0 N +85228 AZ -7.0 N +85230 AZ -7.0 N +85231 AZ -7.0 N +85232 AZ -7.0 N +85233 AZ -7.0 N +85234 AZ -7.0 N +85235 AZ -7.0 N +85236 AZ -7.0 N +85237 AZ -7.0 N +85239 AZ -7.0 N +85241 AZ -7.0 N +85242 AZ -7.0 N +85243 AZ -7.0 N +85244 AZ -7.0 N +85245 AZ -7.0 N +85246 AZ -7.0 N +85247 AZ -7.0 N +85248 AZ -7.0 N +85249 AZ -7.0 N +85250 AZ -7.0 N +85251 AZ -7.0 N +85252 AZ -7.0 N +85253 AZ -7.0 N +85254 AZ -7.0 N +85255 AZ -7.0 N +85256 AZ -7.0 N +85257 AZ -7.0 N +85258 AZ -7.0 N +85259 AZ -7.0 N +85260 AZ -7.0 N +85261 AZ -7.0 N +85262 AZ -7.0 N +85263 AZ -7.0 N +85264 AZ -7.0 N +85266 AZ -7.0 N +85267 AZ -7.0 N +85268 AZ -7.0 N +85269 AZ -7.0 N +85271 AZ -7.0 N +85272 AZ -7.0 N +85273 AZ -7.0 N +85274 AZ -7.0 N +85275 AZ -7.0 N +85277 AZ -7.0 N +85278 AZ -7.0 N +85279 AZ -7.0 N +85280 AZ -7.0 N +85281 AZ -7.0 N +85282 AZ -7.0 N +85283 AZ -7.0 N +85284 AZ -7.0 N +85285 AZ -7.0 N +85287 AZ -7.0 N +85289 AZ -7.0 N +85290 AZ -7.0 N +85291 AZ -7.0 N +85292 AZ -7.0 N +85296 AZ -7.0 N +85297 AZ -7.0 N +85299 AZ -7.0 N +85301 AZ -7.0 N +85302 AZ -7.0 N +85303 AZ -7.0 N +85304 AZ -7.0 N +85305 AZ -7.0 N +85306 AZ -7.0 N +85307 AZ -7.0 N +85308 AZ -7.0 N +85309 AZ -7.0 N +85310 AZ -7.0 N +85311 AZ -7.0 N +85312 AZ -7.0 N +85313 AZ -7.0 N +85318 AZ -7.0 N +85320 AZ -7.0 N +85321 AZ -7.0 N +85322 AZ -7.0 N +85323 AZ -7.0 N +85324 AZ -7.0 N +85325 AZ -7.0 N +85326 AZ -7.0 N +85327 AZ -7.0 N +85328 AZ -7.0 N +85329 AZ -7.0 N +85331 AZ -7.0 N +85332 AZ -7.0 N +85333 AZ -7.0 N +85334 AZ -7.0 N +85335 AZ -7.0 N +85336 AZ -7.0 N +85337 AZ -7.0 N +85338 AZ -7.0 N +85339 AZ -7.0 N +85340 AZ -7.0 N +85341 AZ -7.0 N +85342 AZ -7.0 N +85343 AZ -7.0 N +85344 AZ -7.0 N +85345 AZ -7.0 N +85346 AZ -7.0 N +85347 AZ -7.0 N +85348 AZ -7.0 N +85349 AZ -7.0 N +85350 AZ -7.0 N +85351 AZ -7.0 N +85352 AZ -7.0 N +85353 AZ -7.0 N +85354 AZ -7.0 N +85355 AZ -7.0 N +85356 AZ -7.0 N +85357 AZ -7.0 N +85358 AZ -7.0 N +85359 AZ -7.0 N +85360 AZ -7.0 N +85361 AZ -7.0 N +85362 AZ -7.0 N +85363 AZ -7.0 N +85364 AZ -7.0 N +85365 AZ -7.0 N +85366 AZ -7.0 N +85367 AZ -7.0 N +85369 AZ -7.0 N +85371 AZ -7.0 N +85372 AZ -7.0 N +85373 AZ -7.0 N +85374 AZ -7.0 N +85375 AZ -7.0 N +85376 AZ -7.0 N +85377 AZ -7.0 N +85378 AZ -7.0 N +85379 AZ -7.0 N +85380 AZ -7.0 N +85381 AZ -7.0 N +85382 AZ -7.0 N +85383 AZ -7.0 N +85385 AZ -7.0 N +85387 AZ -7.0 N +85388 AZ -7.0 N +85390 AZ -7.0 N +85396 AZ -7.0 N +85501 AZ -7.0 N +85502 AZ -7.0 N +85530 AZ -7.0 N +85531 AZ -7.0 N +85532 AZ -7.0 N +85533 AZ -7.0 N +85534 AZ -7.0 N +85535 AZ -7.0 N +85536 AZ -7.0 N +85539 AZ -7.0 N +85540 AZ -7.0 N +85541 AZ -7.0 N +85542 AZ -7.0 N +85543 AZ -7.0 N +85544 AZ -7.0 N +85545 AZ -7.0 N +85546 AZ -7.0 N +85547 AZ -7.0 N +85548 AZ -7.0 N +85550 AZ -7.0 N +85551 AZ -7.0 N +85552 AZ -7.0 N +85553 AZ -7.0 N +85554 AZ -7.0 N +85601 AZ -7.0 N +85602 AZ -7.0 N +85603 AZ -7.0 N +85605 AZ -7.0 N +85606 AZ -7.0 N +85607 AZ -7.0 N +85608 AZ -7.0 N +85609 AZ -7.0 N +85610 AZ -7.0 N +85611 AZ -7.0 N +85613 AZ -7.0 N +85614 AZ -7.0 N +85615 AZ -7.0 N +85616 AZ -7.0 N +85617 AZ -7.0 N +85618 AZ -7.0 N +85619 AZ -7.0 N +85620 AZ -7.0 N +85621 AZ -7.0 N +85622 AZ -7.0 N +85623 AZ -7.0 N +85624 AZ -7.0 N +85625 AZ -7.0 N +85626 AZ -7.0 N +85627 AZ -7.0 N +85628 AZ -7.0 N +85629 AZ -7.0 N +85630 AZ -7.0 N +85631 AZ -7.0 N +85632 AZ -7.0 N +85633 AZ -7.0 N +85634 AZ -7.0 N +85635 AZ -7.0 N +85636 AZ -7.0 N +85637 AZ -7.0 N +85638 AZ -7.0 N +85639 AZ -7.0 N +85640 AZ -7.0 N +85641 AZ -7.0 N +85643 AZ -7.0 N +85644 AZ -7.0 N +85645 AZ -7.0 N +85646 AZ -7.0 N +85648 AZ -7.0 N +85650 AZ -7.0 N +85652 AZ -7.0 N +85653 AZ -7.0 N +85654 AZ -7.0 N +85655 AZ -7.0 N +85662 AZ -7.0 N +85670 AZ -7.0 N +85671 AZ -7.0 N +85701 AZ -7.0 N +85702 AZ -7.0 N +85703 AZ -7.0 N +85704 AZ -7.0 N +85705 AZ -7.0 N +85706 AZ -7.0 N +85707 AZ -7.0 N +85708 AZ -7.0 N +85709 AZ -7.0 N +85710 AZ -7.0 N +85711 AZ -7.0 N +85712 AZ -7.0 N +85713 AZ -7.0 N +85714 AZ -7.0 N +85715 AZ -7.0 N +85716 AZ -7.0 N +85717 AZ -7.0 N +85718 AZ -7.0 N +85719 AZ -7.0 N +85720 AZ -7.0 N +85721 AZ -7.0 N +85722 AZ -7.0 N +85723 AZ -7.0 N +85724 AZ -7.0 N +85725 AZ -7.0 N +85726 AZ -7.0 N +85728 AZ -7.0 N +85730 AZ -7.0 N +85731 AZ -7.0 N +85732 AZ -7.0 N +85733 AZ -7.0 N +85734 AZ -7.0 N +85735 AZ -7.0 N +85736 AZ -7.0 N +85737 AZ -7.0 N +85738 AZ -7.0 N +85739 AZ -7.0 N +85740 AZ -7.0 N +85741 AZ -7.0 N +85742 AZ -7.0 N +85743 AZ -7.0 N +85744 AZ -7.0 N +85745 AZ -7.0 N +85746 AZ -7.0 N +85747 AZ -7.0 N +85748 AZ -7.0 N +85749 AZ -7.0 N +85750 AZ -7.0 N +85751 AZ -7.0 N +85752 AZ -7.0 N +85754 AZ -7.0 N +85755 AZ -7.0 N +85757 AZ -7.0 N +85775 AZ -7.0 N +85777 AZ -7.0 N +85901 AZ -7.0 N +85902 AZ -7.0 N +85911 AZ -7.0 N +85912 AZ -7.0 N +85920 AZ -7.0 N +85922 AZ -7.0 N +85923 AZ -7.0 N +85924 AZ -7.0 N +85925 AZ -7.0 N +85926 AZ -7.0 N +85927 AZ -7.0 N +85928 AZ -7.0 N +85929 AZ -7.0 N +85930 AZ -7.0 N +85931 AZ -7.0 N +85932 AZ -7.0 N +85933 AZ -7.0 N +85934 AZ -7.0 N +85935 AZ -7.0 N +85936 AZ -7.0 N +85937 AZ -7.0 N +85938 AZ -7.0 N +85939 AZ -7.0 N +85940 AZ -7.0 N +85941 AZ -7.0 N +85942 AZ -7.0 N +86001 AZ -7.0 N +86002 AZ -7.0 N +86003 AZ -7.0 N +86004 AZ -7.0 N +86011 AZ -7.0 N +86015 AZ -7.0 N +86016 AZ -7.0 N +86017 AZ -7.0 N +86018 AZ -7.0 N +86020 AZ -7.0 Y +86021 AZ -7.0 Y +86022 AZ -7.0 N +86023 AZ -7.0 N +86024 AZ -7.0 N +86025 AZ -7.0 N +86028 AZ -7.0 N +86029 AZ -7.0 N +86030 AZ -7.0 N +86031 AZ -7.0 N +86032 AZ -7.0 N +86033 AZ -7.0 Y +86034 AZ -7.0 N +86035 AZ -7.0 Y +86036 AZ -7.0 N +86038 AZ -7.0 N +86039 AZ -7.0 N +86040 AZ -7.0 N +86042 AZ -7.0 N +86043 AZ -7.0 N +86044 AZ -7.0 Y +86045 AZ -7.0 Y +86046 AZ -7.0 N +86047 AZ -7.0 N +86052 AZ -7.0 N +86053 AZ -7.0 Y +86054 AZ -7.0 Y +86301 AZ -7.0 N +86302 AZ -7.0 N +86303 AZ -7.0 N +86304 AZ -7.0 N +86305 AZ -7.0 N +86312 AZ -7.0 N +86313 AZ -7.0 N +86314 AZ -7.0 N +86320 AZ -7.0 N +86321 AZ -7.0 N +86322 AZ -7.0 N +86323 AZ -7.0 N +86324 AZ -7.0 N +86325 AZ -7.0 N +86326 AZ -7.0 N +86327 AZ -7.0 N +86329 AZ -7.0 N +86330 AZ -7.0 N +86331 AZ -7.0 N +86332 AZ -7.0 N +86333 AZ -7.0 N +86334 AZ -7.0 N +86335 AZ -7.0 N +86336 AZ -7.0 N +86337 AZ -7.0 N +86338 AZ -7.0 N +86339 AZ -7.0 N +86340 AZ -7.0 N +86341 AZ -7.0 N +86342 AZ -7.0 N +86343 AZ -7.0 N +86351 AZ -7.0 N +86401 AZ -7.0 N +86402 AZ -7.0 N +86403 AZ -7.0 N +86404 AZ -7.0 N +86405 AZ -7.0 N +86406 AZ -7.0 N +86409 AZ -7.0 N +86411 AZ -7.0 N +86412 AZ -7.0 N +86413 AZ -7.0 N +86426 AZ -7.0 N +86427 AZ -7.0 N +86429 AZ -7.0 N +86430 AZ -7.0 N +86431 AZ -7.0 N +86432 AZ -7.0 N +86433 AZ -7.0 N +86434 AZ -7.0 N +86435 AZ -7.0 N +86436 AZ -7.0 N +86437 AZ -7.0 N +86438 AZ -7.0 N +86439 AZ -7.0 N +86440 AZ -7.0 N +86441 AZ -7.0 N +86442 AZ -7.0 N +86443 AZ -7.0 N +86444 AZ -7.0 N +86445 AZ -7.0 N +86446 AZ -7.0 N +86502 AZ -7.0 N +86503 AZ -7.0 Y +86504 AZ -7.0 Y +86505 AZ -7.0 Y +86506 AZ -7.0 Y +86507 AZ -7.0 Y +86508 AZ -7.0 Y +86510 AZ -7.0 Y +86511 AZ -7.0 Y +86512 AZ -7.0 N +86514 AZ -7.0 Y +86515 AZ -7.0 Y +86520 AZ -7.0 Y +86535 AZ -7.0 Y +86538 AZ -7.0 Y +86540 AZ -7.0 Y +86544 AZ -7.0 Y +86545 AZ -7.0 Y +86547 AZ -7.0 Y +86556 AZ -7.0 Y +87001 NM -7.0 Y +87002 NM -7.0 Y +87004 NM -7.0 Y +87005 NM -7.0 Y +87006 NM -7.0 Y +87007 NM -7.0 Y +87008 NM -7.0 Y +87009 NM -7.0 Y +87010 NM -7.0 Y +87011 NM -7.0 Y +87012 NM -7.0 Y +87013 NM -7.0 Y +87014 NM -7.0 Y +87015 NM -7.0 Y +87016 NM -7.0 Y +87017 NM -7.0 Y +87018 NM -7.0 Y +87020 NM -7.0 Y +87021 NM -7.0 Y +87022 NM -7.0 Y +87023 NM -7.0 Y +87024 NM -7.0 Y +87025 NM -7.0 Y +87026 NM -7.0 Y +87027 NM -7.0 Y +87028 NM -7.0 Y +87029 NM -7.0 Y +87031 NM -7.0 Y +87032 NM -7.0 Y +87034 NM -7.0 Y +87035 NM -7.0 Y +87036 NM -7.0 Y +87037 NM -7.0 Y +87038 NM -7.0 Y +87040 NM -7.0 Y +87041 NM -7.0 Y +87042 NM -7.0 Y +87043 NM -7.0 Y +87044 NM -7.0 Y +87045 NM -7.0 Y +87046 NM -7.0 Y +87047 NM -7.0 Y +87048 NM -7.0 Y +87049 NM -7.0 Y +87051 NM -7.0 Y +87052 NM -7.0 Y +87053 NM -7.0 Y +87056 NM -7.0 Y +87059 NM -7.0 Y +87060 NM -7.0 Y +87061 NM -7.0 Y +87062 NM -7.0 Y +87063 NM -7.0 Y +87064 NM -7.0 Y +87068 NM -7.0 Y +87070 NM -7.0 Y +87072 NM -7.0 Y +87083 NM -7.0 Y +87101 NM -7.0 Y +87102 NM -7.0 Y +87103 NM -7.0 Y +87104 NM -7.0 Y +87105 NM -7.0 Y +87106 NM -7.0 Y +87107 NM -7.0 Y +87108 NM -7.0 Y +87109 NM -7.0 Y +87110 NM -7.0 Y +87111 NM -7.0 Y +87112 NM -7.0 Y +87113 NM -7.0 Y +87114 NM -7.0 Y +87115 NM -7.0 Y +87116 NM -7.0 Y +87117 NM -7.0 Y +87119 NM -7.0 Y +87120 NM -7.0 Y +87121 NM -7.0 Y +87122 NM -7.0 Y +87123 NM -7.0 Y +87124 NM -7.0 Y +87125 NM -7.0 Y +87131 NM -7.0 Y +87144 NM -7.0 Y +87151 NM -7.0 Y +87153 NM -7.0 Y +87154 NM -7.0 Y +87158 NM -7.0 Y +87165 NM -7.0 Y +87174 NM -7.0 Y +87176 NM -7.0 Y +87181 NM -7.0 Y +87184 NM -7.0 Y +87185 NM -7.0 Y +87187 NM -7.0 Y +87190 NM -7.0 Y +87191 NM -7.0 Y +87192 NM -7.0 Y +87193 NM -7.0 Y +87194 NM -7.0 Y +87195 NM -7.0 Y +87196 NM -7.0 Y +87197 NM -7.0 Y +87198 NM -7.0 Y +87199 NM -7.0 Y +87301 NM -7.0 Y +87302 NM -7.0 Y +87305 NM -7.0 Y +87310 NM -7.0 Y +87311 NM -7.0 Y +87312 NM -7.0 Y +87313 NM -7.0 Y +87315 NM -7.0 Y +87316 NM -7.0 Y +87317 NM -7.0 Y +87319 NM -7.0 Y +87320 NM -7.0 Y +87321 NM -7.0 Y +87322 NM -7.0 Y +87323 NM -7.0 Y +87325 NM -7.0 Y +87326 NM -7.0 Y +87327 NM -7.0 Y +87328 NM -7.0 Y +87347 NM -7.0 Y +87357 NM -7.0 Y +87364 NM -7.0 Y +87365 NM -7.0 Y +87375 NM -7.0 Y +87401 NM -7.0 Y +87402 NM -7.0 Y +87410 NM -7.0 Y +87412 NM -7.0 Y +87413 NM -7.0 Y +87415 NM -7.0 Y +87416 NM -7.0 Y +87417 NM -7.0 Y +87418 NM -7.0 Y +87419 NM -7.0 Y +87420 NM -7.0 Y +87421 NM -7.0 Y +87455 NM -7.0 Y +87461 NM -7.0 Y +87499 NM -7.0 Y +87501 NM -7.0 Y +87502 NM -7.0 Y +87503 NM -7.0 Y +87504 NM -7.0 Y +87505 NM -7.0 Y +87506 NM -7.0 Y +87507 NM -7.0 Y +87508 NM -7.0 Y +87509 NM -7.0 Y +87510 NM -7.0 Y +87511 NM -7.0 Y +87512 NM -7.0 Y +87513 NM -7.0 Y +87514 NM -7.0 Y +87515 NM -7.0 Y +87516 NM -7.0 Y +87517 NM -7.0 Y +87518 NM -7.0 Y +87519 NM -7.0 Y +87520 NM -7.0 Y +87521 NM -7.0 Y +87522 NM -7.0 Y +87523 NM -7.0 Y +87524 NM -7.0 Y +87525 NM -7.0 Y +87527 NM -7.0 Y +87528 NM -7.0 Y +87529 NM -7.0 Y +87530 NM -7.0 Y +87531 NM -7.0 Y +87532 NM -7.0 Y +87533 NM -7.0 Y +87535 NM -7.0 Y +87537 NM -7.0 Y +87538 NM -7.0 Y +87539 NM -7.0 Y +87540 NM -7.0 Y +87543 NM -7.0 Y +87544 NM -7.0 Y +87545 NM -7.0 Y +87548 NM -7.0 Y +87549 NM -7.0 Y +87551 NM -7.0 Y +87552 NM -7.0 Y +87553 NM -7.0 Y +87554 NM -7.0 Y +87556 NM -7.0 Y +87557 NM -7.0 Y +87558 NM -7.0 Y +87560 NM -7.0 Y +87562 NM -7.0 Y +87564 NM -7.0 Y +87565 NM -7.0 Y +87566 NM -7.0 Y +87567 NM -7.0 Y +87569 NM -7.0 Y +87571 NM -7.0 Y +87573 NM -7.0 Y +87574 NM -7.0 Y +87575 NM -7.0 Y +87576 NM -7.0 Y +87577 NM -7.0 Y +87578 NM -7.0 Y +87579 NM -7.0 Y +87580 NM -7.0 Y +87581 NM -7.0 Y +87582 NM -7.0 Y +87583 NM -7.0 Y +87592 NM -7.0 Y +87594 NM -7.0 Y +87701 NM -7.0 Y +87710 NM -7.0 Y +87711 NM -7.0 Y +87712 NM -7.0 Y +87713 NM -7.0 Y +87714 NM -7.0 Y +87715 NM -7.0 Y +87718 NM -7.0 Y +87722 NM -7.0 Y +87723 NM -7.0 Y +87724 NM -7.0 Y +87728 NM -7.0 Y +87729 NM -7.0 Y +87730 NM -7.0 Y +87731 NM -7.0 Y +87732 NM -7.0 Y +87733 NM -7.0 Y +87734 NM -7.0 Y +87735 NM -7.0 Y +87736 NM -7.0 Y +87740 NM -7.0 Y +87742 NM -7.0 Y +87743 NM -7.0 Y +87745 NM -7.0 Y +87746 NM -7.0 Y +87747 NM -7.0 Y +87749 NM -7.0 Y +87750 NM -7.0 Y +87752 NM -7.0 Y +87753 NM -7.0 Y +87801 NM -7.0 Y +87820 NM -7.0 Y +87821 NM -7.0 Y +87823 NM -7.0 Y +87824 NM -7.0 Y +87825 NM -7.0 Y +87827 NM -7.0 Y +87828 NM -7.0 Y +87829 NM -7.0 Y +87830 NM -7.0 Y +87831 NM -7.0 Y +87832 NM -7.0 Y +87901 NM -7.0 Y +87930 NM -7.0 Y +87931 NM -7.0 Y +87933 NM -7.0 Y +87935 NM -7.0 Y +87936 NM -7.0 Y +87937 NM -7.0 Y +87939 NM -7.0 Y +87940 NM -7.0 Y +87941 NM -7.0 Y +87942 NM -7.0 Y +87943 NM -7.0 Y +88001 NM -7.0 Y +88002 NM -7.0 Y +88003 NM -7.0 Y +88004 NM -7.0 Y +88005 NM -7.0 Y +88006 NM -7.0 Y +88007 NM -7.0 Y +88008 NM -7.0 Y +88009 NM -7.0 Y +88011 NM -7.0 Y +88012 NM -7.0 Y +88013 NM -7.0 Y +88020 NM -7.0 Y +88021 NM -7.0 Y +88022 NM -7.0 Y +88023 NM -7.0 Y +88024 NM -7.0 Y +88025 NM -7.0 Y +88026 NM -7.0 Y +88027 NM -7.0 Y +88028 NM -7.0 Y +88029 NM -7.0 Y +88030 NM -7.0 Y +88031 NM -7.0 Y +88032 NM -7.0 Y +88033 NM -7.0 Y +88034 NM -7.0 Y +88036 NM -7.0 Y +88038 NM -7.0 Y +88039 NM -7.0 Y +88040 NM -7.0 Y +88041 NM -7.0 Y +88042 NM -7.0 Y +88043 NM -7.0 Y +88044 NM -7.0 Y +88045 NM -7.0 Y +88046 NM -7.0 Y +88047 NM -7.0 Y +88048 NM -7.0 Y +88049 NM -7.0 Y +88051 NM -7.0 Y +88052 NM -7.0 Y +88053 NM -7.0 Y +88054 NM -7.0 Y +88055 NM -7.0 Y +88056 NM -7.0 Y +88058 NM -7.0 Y +88061 NM -7.0 Y +88062 NM -7.0 Y +88063 NM -7.0 Y +88065 NM -7.0 Y +88072 NM -7.0 Y +88081 NM -7.0 Y +88101 NM -7.0 Y +88102 NM -7.0 Y +88103 NM -7.0 Y +88112 NM -7.0 Y +88113 NM -7.0 Y +88114 NM -7.0 Y +88115 NM -7.0 Y +88116 NM -7.0 Y +88118 NM -7.0 Y +88119 NM -7.0 Y +88120 NM -7.0 Y +88121 NM -7.0 Y +88122 NM -7.0 Y +88123 NM -7.0 Y +88124 NM -7.0 Y +88125 NM -7.0 Y +88126 NM -7.0 Y +88130 NM -7.0 Y +88132 NM -7.0 Y +88133 NM -7.0 Y +88134 NM -7.0 Y +88135 NM -7.0 Y +88136 NM -7.0 Y +88201 NM -7.0 Y +88202 NM -7.0 Y +88203 NM -7.0 Y +88210 NM -7.0 Y +88211 NM -7.0 Y +88213 NM -7.0 Y +88220 NM -7.0 Y +88221 NM -7.0 Y +88230 NM -7.0 Y +88231 NM -7.0 Y +88232 NM -7.0 Y +88240 NM -7.0 Y +88241 NM -7.0 Y +88242 NM -7.0 Y +88244 NM -7.0 Y +88250 NM -7.0 Y +88252 NM -7.0 Y +88253 NM -7.0 Y +88254 NM -7.0 Y +88255 NM -7.0 Y +88256 NM -7.0 Y +88260 NM -7.0 Y +88262 NM -7.0 Y +88263 NM -7.0 Y +88264 NM -7.0 Y +88265 NM -7.0 Y +88267 NM -7.0 Y +88268 NM -7.0 Y +88301 NM -7.0 Y +88310 NM -7.0 Y +88311 NM -7.0 Y +88312 NM -7.0 Y +88314 NM -7.0 Y +88316 NM -7.0 Y +88317 NM -7.0 Y +88318 NM -7.0 Y +88321 NM -7.0 Y +88323 NM -7.0 Y +88324 NM -7.0 Y +88325 NM -7.0 Y +88330 NM -7.0 Y +88336 NM -7.0 Y +88337 NM -7.0 Y +88338 NM -7.0 Y +88339 NM -7.0 Y +88340 NM -7.0 Y +88341 NM -7.0 Y +88342 NM -7.0 Y +88343 NM -7.0 Y +88344 NM -7.0 Y +88345 NM -7.0 Y +88346 NM -7.0 Y +88347 NM -7.0 Y +88348 NM -7.0 Y +88349 NM -7.0 Y +88350 NM -7.0 Y +88351 NM -7.0 Y +88352 NM -7.0 Y +88353 NM -7.0 Y +88354 NM -7.0 Y +88355 NM -7.0 Y +88401 NM -7.0 Y +88410 NM -7.0 Y +88411 NM -7.0 Y +88414 NM -7.0 Y +88415 NM -7.0 Y +88416 NM -7.0 Y +88417 NM -7.0 Y +88418 NM -7.0 Y +88419 NM -7.0 Y +88421 NM -7.0 Y +88422 NM -7.0 Y +88424 NM -7.0 Y +88426 NM -7.0 Y +88427 NM -7.0 Y +88430 NM -7.0 Y +88431 NM -7.0 Y +88433 NM -7.0 Y +88434 NM -7.0 Y +88435 NM -7.0 Y +88436 NM -7.0 Y +88439 NM -7.0 Y +88510 TX -7.0 Y +88511 TX -7.0 Y +88512 TX -7.0 Y +88513 TX -7.0 Y +88514 TX -7.0 Y +88515 TX -7.0 Y +88516 TX -7.0 Y +88517 TX -7.0 Y +88518 TX -7.0 Y +88519 TX -7.0 Y +88520 TX -7.0 Y +88521 TX -7.0 Y +88523 TX -7.0 Y +88524 TX -7.0 Y +88525 TX -7.0 Y +88526 TX -7.0 Y +88527 TX -7.0 Y +88528 TX -7.0 Y +88529 TX -7.0 Y +88530 TX -7.0 Y +88531 TX -7.0 Y +88532 TX -7.0 Y +88533 TX -7.0 Y +88534 TX -7.0 Y +88535 TX -7.0 Y +88536 TX -7.0 Y +88538 TX -7.0 Y +88539 TX -7.0 Y +88540 TX -7.0 Y +88541 TX -7.0 Y +88542 TX -7.0 Y +88543 TX -7.0 Y +88544 TX -7.0 Y +88545 TX -7.0 Y +88546 TX -7.0 Y +88547 TX -7.0 Y +88548 TX -7.0 Y +88549 TX -7.0 Y +88550 TX -7.0 Y +88553 TX -7.0 Y +88554 TX -7.0 Y +88555 TX -7.0 Y +88556 TX -7.0 Y +88557 TX -7.0 Y +88558 TX -7.0 Y +88559 TX -7.0 Y +88560 TX -7.0 Y +88561 TX -7.0 Y +88562 TX -7.0 Y +88563 TX -7.0 Y +88565 TX -7.0 Y +88566 TX -7.0 Y +88567 TX -7.0 Y +88568 TX -7.0 Y +88569 TX -7.0 Y +88570 TX -7.0 Y +88571 TX -7.0 Y +88572 TX -7.0 Y +88573 TX -7.0 Y +88574 TX -7.0 Y +88575 TX -7.0 Y +88576 TX -7.0 Y +88577 TX -7.0 Y +88578 TX -7.0 Y +88579 TX -7.0 Y +88580 TX -7.0 Y +88581 TX -7.0 Y +88582 TX -7.0 Y +88583 TX -7.0 Y +88584 TX -7.0 Y +88585 TX -7.0 Y +88586 TX -7.0 Y +88587 TX -7.0 Y +88588 TX -7.0 Y +88589 TX -7.0 Y +88590 TX -7.0 Y +88595 TX -7.0 Y +88901 NV -8.0 Y +88905 NV -8.0 Y +89001 NV -8.0 Y +89002 NV -8.0 Y +89003 NV -8.0 Y +89004 NV -8.0 Y +89005 NV -8.0 Y +89006 NV -8.0 Y +89007 NV -8.0 Y +89008 NV -8.0 Y +89009 NV -8.0 Y +89010 NV -8.0 Y +89011 NV -8.0 Y +89012 NV -8.0 Y +89013 NV -8.0 Y +89014 NV -8.0 Y +89015 NV -8.0 Y +89016 NV -8.0 Y +89017 NV -8.0 Y +89018 NV -8.0 Y +89019 NV -8.0 Y +89020 NV -8.0 Y +89021 NV -8.0 Y +89022 NV -8.0 Y +89023 NV -8.0 Y +89024 NV -8.0 Y +89025 NV -8.0 Y +89026 NV -8.0 Y +89027 NV -8.0 Y +89028 NV -8.0 Y +89029 NV -8.0 Y +89030 NV -8.0 Y +89031 NV -8.0 Y +89032 NV -8.0 Y +89033 NV -8.0 Y +89036 NV -8.0 Y +89037 NV -8.0 Y +89039 NV -8.0 Y +89040 NV -8.0 Y +89041 NV -8.0 Y +89042 NV -8.0 Y +89043 NV -8.0 Y +89044 NV -8.0 Y +89045 NV -8.0 Y +89046 NV -8.0 Y +89047 NV -8.0 Y +89048 NV -8.0 Y +89049 NV -8.0 Y +89052 NV -8.0 Y +89053 NV -8.0 Y +89060 NV -8.0 Y +89061 NV -8.0 Y +89067 NV -8.0 Y +89070 NV -8.0 Y +89074 NV -8.0 Y +89077 NV -8.0 Y +89081 NV -8.0 Y +89084 NV -8.0 Y +89085 NV -8.0 Y +89086 NV -8.0 Y +89087 NV -8.0 Y +89101 NV -8.0 Y +89102 NV -8.0 Y +89103 NV -8.0 Y +89104 NV -8.0 Y +89105 NV -8.0 Y +89106 NV -8.0 Y +89107 NV -8.0 Y +89108 NV -8.0 Y +89109 NV -8.0 Y +89110 NV -8.0 Y +89111 NV -8.0 Y +89112 NV -8.0 Y +89113 NV -8.0 Y +89114 NV -8.0 Y +89115 NV -8.0 Y +89116 NV -8.0 Y +89117 NV -8.0 Y +89118 NV -8.0 Y +89119 NV -8.0 Y +89120 NV -8.0 Y +89121 NV -8.0 Y +89122 NV -8.0 Y +89123 NV -8.0 Y +89124 NV -8.0 Y +89125 NV -8.0 Y +89126 NV -8.0 Y +89127 NV -8.0 Y +89128 NV -8.0 Y +89129 NV -8.0 Y +89130 NV -8.0 Y +89131 NV -8.0 Y +89132 NV -8.0 Y +89133 NV -8.0 Y +89134 NV -8.0 Y +89135 NV -8.0 Y +89136 NV -8.0 Y +89137 NV -8.0 Y +89138 NV -8.0 Y +89139 NV -8.0 Y +89140 NV -8.0 Y +89141 NV -8.0 Y +89142 NV -8.0 Y +89143 NV -8.0 Y +89144 NV -8.0 Y +89145 NV -8.0 Y +89146 NV -8.0 Y +89147 NV -8.0 Y +89148 NV -8.0 Y +89149 NV -8.0 Y +89150 NV -8.0 Y +89151 NV -8.0 Y +89152 NV -8.0 Y +89153 NV -8.0 Y +89154 NV -8.0 Y +89155 NV -8.0 Y +89156 NV -8.0 Y +89157 NV -8.0 Y +89159 NV -8.0 Y +89160 NV -8.0 Y +89161 NV -8.0 Y +89162 NV -8.0 Y +89163 NV -8.0 Y +89164 NV -8.0 Y +89165 NV -8.0 Y +89166 NV -8.0 Y +89169 NV -8.0 Y +89170 NV -8.0 Y +89173 NV -8.0 Y +89177 NV -8.0 Y +89178 NV -8.0 Y +89179 NV -8.0 Y +89180 NV -8.0 Y +89183 NV -8.0 Y +89185 NV -8.0 Y +89191 NV -8.0 Y +89193 NV -8.0 Y +89195 NV -8.0 Y +89199 NV -8.0 Y +89301 NV -8.0 Y +89310 NV -8.0 Y +89311 NV -8.0 Y +89314 NV -8.0 Y +89315 NV -8.0 Y +89316 NV -8.0 Y +89317 NV -8.0 Y +89318 NV -8.0 Y +89319 NV -8.0 Y +89402 NV -8.0 Y +89403 NV -8.0 Y +89404 NV -8.0 Y +89405 NV -8.0 Y +89406 NV -8.0 Y +89407 NV -8.0 Y +89408 NV -8.0 Y +89409 NV -8.0 Y +89410 NV -8.0 Y +89411 NV -8.0 Y +89412 NV -8.0 Y +89413 NV -8.0 Y +89414 NV -8.0 Y +89415 NV -8.0 Y +89418 NV -8.0 Y +89419 NV -8.0 Y +89420 NV -8.0 Y +89421 NV -8.0 Y +89422 NV -8.0 Y +89423 NV -8.0 Y +89424 NV -8.0 Y +89425 NV -8.0 Y +89426 NV -8.0 Y +89427 NV -8.0 Y +89428 NV -8.0 Y +89429 NV -8.0 Y +89430 NV -8.0 Y +89431 NV -8.0 Y +89432 NV -8.0 Y +89433 NV -8.0 Y +89434 NV -8.0 Y +89435 NV -8.0 Y +89436 NV -8.0 Y +89438 NV -8.0 Y +89439 NV -8.0 Y +89440 NV -8.0 Y +89441 NV -8.0 Y +89442 NV -8.0 Y +89444 NV -8.0 Y +89445 NV -8.0 Y +89446 NV -8.0 Y +89447 NV -8.0 Y +89448 NV -8.0 Y +89449 NV -8.0 Y +89450 NV -8.0 Y +89451 NV -8.0 Y +89452 NV -8.0 Y +89460 NV -8.0 Y +89496 NV -8.0 Y +89501 NV -8.0 Y +89502 NV -8.0 Y +89503 NV -8.0 Y +89504 NV -8.0 Y +89505 NV -8.0 Y +89506 NV -8.0 Y +89507 NV -8.0 Y +89509 NV -8.0 Y +89510 NV -8.0 Y +89511 NV -8.0 Y +89512 NV -8.0 Y +89513 NV -8.0 Y +89515 NV -8.0 Y +89519 NV -8.0 Y +89520 NV -8.0 Y +89521 NV -8.0 Y +89523 NV -8.0 Y +89533 NV -8.0 Y +89555 NV -8.0 Y +89557 NV -8.0 Y +89570 NV -8.0 Y +89595 NV -8.0 Y +89599 NV -8.0 Y +89701 NV -8.0 Y +89702 NV -8.0 Y +89703 NV -8.0 Y +89704 NV -8.0 Y +89705 NV -8.0 Y +89706 NV -8.0 Y +89711 NV -8.0 Y +89712 NV -8.0 Y +89713 NV -8.0 Y +89714 NV -8.0 Y +89721 NV -8.0 Y +89801 NV -8.0 Y +89802 NV -8.0 Y +89803 NV -8.0 Y +89815 NV -8.0 Y +89820 NV -8.0 Y +89821 NV -8.0 Y +89822 NV -8.0 Y +89823 NV -8.0 Y +89824 NV -8.0 Y +89825 NV -8.0 Y +89826 NV -8.0 Y +89828 NV -8.0 Y +89830 NV -8.0 Y +89831 NV -8.0 Y +89832 NV -8.0 Y +89833 NV -8.0 Y +89834 NV -8.0 Y +89835 NV -8.0 Y +89883 NV -7.0 Y +90001 CA -8.0 Y +90002 CA -8.0 Y +90003 CA -8.0 Y +90004 CA -8.0 Y +90005 CA -8.0 Y +90006 CA -8.0 Y +90007 CA -8.0 Y +90008 CA -8.0 Y +90009 CA -8.0 Y +90010 CA -8.0 Y +90011 CA -8.0 Y +90012 CA -8.0 Y +90013 CA -8.0 Y +90014 CA -8.0 Y +90015 CA -8.0 Y +90016 CA -8.0 Y +90017 CA -8.0 Y +90018 CA -8.0 Y +90019 CA -8.0 Y +90020 CA -8.0 Y +90021 CA -8.0 Y +90022 CA -8.0 Y +90023 CA -8.0 Y +90024 CA -8.0 Y +90025 CA -8.0 Y +90026 CA -8.0 Y +90027 CA -8.0 Y +90028 CA -8.0 Y +90029 CA -8.0 Y +90030 CA -8.0 Y +90031 CA -8.0 Y +90032 CA -8.0 Y +90033 CA -8.0 Y +90034 CA -8.0 Y +90035 CA -8.0 Y +90036 CA -8.0 Y +90037 CA -8.0 Y +90038 CA -8.0 Y +90039 CA -8.0 Y +90040 CA -8.0 Y +90041 CA -8.0 Y +90042 CA -8.0 Y +90043 CA -8.0 Y +90044 CA -8.0 Y +90045 CA -8.0 Y +90046 CA -8.0 Y +90047 CA -8.0 Y +90048 CA -8.0 Y +90049 CA -8.0 Y +90050 CA -8.0 Y +90051 CA -8.0 Y +90052 CA -8.0 Y +90053 CA -8.0 Y +90054 CA -8.0 Y +90055 CA -8.0 Y +90056 CA -8.0 Y +90057 CA -8.0 Y +90058 CA -8.0 Y +90059 CA -8.0 Y +90060 CA -8.0 Y +90061 CA -8.0 Y +90062 CA -8.0 Y +90063 CA -8.0 Y +90064 CA -8.0 Y +90065 CA -8.0 Y +90066 CA -8.0 Y +90067 CA -8.0 Y +90068 CA -8.0 Y +90069 CA -8.0 Y +90070 CA -8.0 Y +90071 CA -8.0 Y +90072 CA -8.0 Y +90073 CA -8.0 Y +90074 CA -8.0 Y +90075 CA -8.0 Y +90076 CA -8.0 Y +90077 CA -8.0 Y +90078 CA -8.0 Y +90079 CA -8.0 Y +90080 CA -8.0 Y +90081 CA -8.0 Y +90082 CA -8.0 Y +90083 CA -8.0 Y +90084 CA -8.0 Y +90086 CA -8.0 Y +90087 CA -8.0 Y +90088 CA -8.0 Y +90089 CA -8.0 Y +90091 CA -8.0 Y +90093 CA -8.0 Y +90094 CA -8.0 Y +90095 CA -8.0 Y +90096 CA -8.0 Y +90099 CA -8.0 Y +90101 CA -8.0 Y +90102 CA -8.0 Y +90103 CA -8.0 Y +90189 CA -8.0 Y +90201 CA -8.0 Y +90202 CA -8.0 Y +90209 CA -8.0 Y +90210 CA -8.0 Y +90211 CA -8.0 Y +90212 CA -8.0 Y +90213 CA -8.0 Y +90220 CA -8.0 Y +90221 CA -8.0 Y +90222 CA -8.0 Y +90223 CA -8.0 Y +90224 CA -8.0 Y +90230 CA -8.0 Y +90231 CA -8.0 Y +90232 CA -8.0 Y +90233 CA -8.0 Y +90239 CA -8.0 Y +90240 CA -8.0 Y +90241 CA -8.0 Y +90242 CA -8.0 Y +90245 CA -8.0 Y +90247 CA -8.0 Y +90248 CA -8.0 Y +90249 CA -8.0 Y +90250 CA -8.0 Y +90251 CA -8.0 Y +90254 CA -8.0 Y +90255 CA -8.0 Y +90260 CA -8.0 Y +90261 CA -8.0 Y +90262 CA -8.0 Y +90263 CA -8.0 Y +90264 CA -8.0 Y +90265 CA -8.0 Y +90266 CA -8.0 Y +90267 CA -8.0 Y +90270 CA -8.0 Y +90272 CA -8.0 Y +90274 CA -8.0 Y +90275 CA -8.0 Y +90277 CA -8.0 Y +90278 CA -8.0 Y +90280 CA -8.0 Y +90290 CA -8.0 Y +90291 CA -8.0 Y +90292 CA -8.0 Y +90293 CA -8.0 Y +90294 CA -8.0 Y +90295 CA -8.0 Y +90296 CA -8.0 Y +90301 CA -8.0 Y +90302 CA -8.0 Y +90303 CA -8.0 Y +90304 CA -8.0 Y +90305 CA -8.0 Y +90306 CA -8.0 Y +90307 CA -8.0 Y +90308 CA -8.0 Y +90309 CA -8.0 Y +90310 CA -8.0 Y +90311 CA -8.0 Y +90312 CA -8.0 Y +90313 CA -8.0 Y +90397 CA -8.0 Y +90398 CA -8.0 Y +90401 CA -8.0 Y +90402 CA -8.0 Y +90403 CA -8.0 Y +90404 CA -8.0 Y +90405 CA -8.0 Y +90406 CA -8.0 Y +90407 CA -8.0 Y +90408 CA -8.0 Y +90409 CA -8.0 Y +90410 CA -8.0 Y +90411 CA -8.0 Y +90501 CA -8.0 Y +90502 CA -8.0 Y +90503 CA -8.0 Y +90504 CA -8.0 Y +90505 CA -8.0 Y +90506 CA -8.0 Y +90507 CA -8.0 Y +90508 CA -8.0 Y +90509 CA -8.0 Y +90510 CA -8.0 Y +90601 CA -8.0 Y +90602 CA -8.0 Y +90603 CA -8.0 Y +90604 CA -8.0 Y +90605 CA -8.0 Y +90606 CA -8.0 Y +90607 CA -8.0 Y +90608 CA -8.0 Y +90609 CA -8.0 Y +90610 CA -8.0 Y +90612 CA -8.0 Y +90620 CA -8.0 Y +90621 CA -8.0 Y +90622 CA -8.0 Y +90623 CA -8.0 Y +90624 CA -8.0 Y +90630 CA -8.0 Y +90631 CA -8.0 Y +90632 CA -8.0 Y +90633 CA -8.0 Y +90637 CA -8.0 Y +90638 CA -8.0 Y +90639 CA -8.0 Y +90640 CA -8.0 Y +90650 CA -8.0 Y +90651 CA -8.0 Y +90652 CA -8.0 Y +90659 CA -8.0 Y +90660 CA -8.0 Y +90661 CA -8.0 Y +90662 CA -8.0 Y +90670 CA -8.0 Y +90671 CA -8.0 Y +90680 CA -8.0 Y +90701 CA -8.0 Y +90702 CA -8.0 Y +90703 CA -8.0 Y +90704 CA -8.0 Y +90706 CA -8.0 Y +90707 CA -8.0 Y +90710 CA -8.0 Y +90711 CA -8.0 Y +90712 CA -8.0 Y +90713 CA -8.0 Y +90714 CA -8.0 Y +90715 CA -8.0 Y +90716 CA -8.0 Y +90717 CA -8.0 Y +90720 CA -8.0 Y +90721 CA -8.0 Y +90723 CA -8.0 Y +90731 CA -8.0 Y +90732 CA -8.0 Y +90733 CA -8.0 Y +90734 CA -8.0 Y +90740 CA -8.0 Y +90742 CA -8.0 Y +90743 CA -8.0 Y +90744 CA -8.0 Y +90745 CA -8.0 Y +90746 CA -8.0 Y +90747 CA -8.0 Y +90748 CA -8.0 Y +90749 CA -8.0 Y +90755 CA -8.0 Y +90801 CA -8.0 Y +90802 CA -8.0 Y +90803 CA -8.0 Y +90804 CA -8.0 Y +90805 CA -8.0 Y +90806 CA -8.0 Y +90807 CA -8.0 Y +90808 CA -8.0 Y +90809 CA -8.0 Y +90810 CA -8.0 Y +90813 CA -8.0 Y +90814 CA -8.0 Y +90815 CA -8.0 Y +90822 CA -8.0 Y +90831 CA -8.0 Y +90832 CA -8.0 Y +90833 CA -8.0 Y +90834 CA -8.0 Y +90835 CA -8.0 Y +90840 CA -8.0 Y +90842 CA -8.0 Y +90844 CA -8.0 Y +90845 CA -8.0 Y +90846 CA -8.0 Y +90847 CA -8.0 Y +90848 CA -8.0 Y +90853 CA -8.0 Y +90888 CA -8.0 Y +90895 CA -8.0 Y +90899 CA -8.0 Y +91001 CA -8.0 Y +91003 CA -8.0 Y +91006 CA -8.0 Y +91007 CA -8.0 Y +91009 CA -8.0 Y +91010 CA -8.0 Y +91011 CA -8.0 Y +91012 CA -8.0 Y +91016 CA -8.0 Y +91017 CA -8.0 Y +91020 CA -8.0 Y +91021 CA -8.0 Y +91023 CA -8.0 Y +91024 CA -8.0 Y +91025 CA -8.0 Y +91030 CA -8.0 Y +91031 CA -8.0 Y +91040 CA -8.0 Y +91041 CA -8.0 Y +91042 CA -8.0 Y +91043 CA -8.0 Y +91046 CA -8.0 Y +91066 CA -8.0 Y +91077 CA -8.0 Y +91101 CA -8.0 Y +91102 CA -8.0 Y +91103 CA -8.0 Y +91104 CA -8.0 Y +91105 CA -8.0 Y +91106 CA -8.0 Y +91107 CA -8.0 Y +91108 CA -8.0 Y +91109 CA -8.0 Y +91110 CA -8.0 Y +91114 CA -8.0 Y +91115 CA -8.0 Y +91116 CA -8.0 Y +91117 CA -8.0 Y +91118 CA -8.0 Y +91121 CA -8.0 Y +91123 CA -8.0 Y +91124 CA -8.0 Y +91125 CA -8.0 Y +91126 CA -8.0 Y +91129 CA -8.0 Y +91131 CA -8.0 Y +91182 CA -8.0 Y +91184 CA -8.0 Y +91185 CA -8.0 Y +91188 CA -8.0 Y +91189 CA -8.0 Y +91191 CA -8.0 Y +91199 CA -8.0 Y +91201 CA -8.0 Y +91202 CA -8.0 Y +91203 CA -8.0 Y +91204 CA -8.0 Y +91205 CA -8.0 Y +91206 CA -8.0 Y +91207 CA -8.0 Y +91208 CA -8.0 Y +91209 CA -8.0 Y +91210 CA -8.0 Y +91214 CA -8.0 Y +91221 CA -8.0 Y +91222 CA -8.0 Y +91224 CA -8.0 Y +91225 CA -8.0 Y +91226 CA -8.0 Y +91301 CA -8.0 Y +91302 CA -8.0 Y +91303 CA -8.0 Y +91304 CA -8.0 Y +91305 CA -8.0 Y +91306 CA -8.0 Y +91307 CA -8.0 Y +91308 CA -8.0 Y +91309 CA -8.0 Y +91310 CA -8.0 Y +91311 CA -8.0 Y +91313 CA -8.0 Y +91316 CA -8.0 Y +91319 CA -8.0 Y +91320 CA -8.0 Y +91321 CA -8.0 Y +91322 CA -8.0 Y +91324 CA -8.0 Y +91325 CA -8.0 Y +91326 CA -8.0 Y +91327 CA -8.0 Y +91328 CA -8.0 Y +91329 CA -8.0 Y +91330 CA -8.0 Y +91331 CA -8.0 Y +91333 CA -8.0 Y +91334 CA -8.0 Y +91335 CA -8.0 Y +91337 CA -8.0 Y +91340 CA -8.0 Y +91341 CA -8.0 Y +91342 CA -8.0 Y +91343 CA -8.0 Y +91344 CA -8.0 Y +91345 CA -8.0 Y +91346 CA -8.0 Y +91350 CA -8.0 Y +91351 CA -8.0 Y +91352 CA -8.0 Y +91353 CA -8.0 Y +91354 CA -8.0 Y +91355 CA -8.0 Y +91356 CA -8.0 Y +91357 CA -8.0 Y +91358 CA -8.0 Y +91359 CA -8.0 Y +91360 CA -8.0 Y +91361 CA -8.0 Y +91362 CA -8.0 Y +91363 CA -8.0 Y +91364 CA -8.0 Y +91365 CA -8.0 Y +91367 CA -8.0 Y +91371 CA -8.0 Y +91372 CA -8.0 Y +91376 CA -8.0 Y +91377 CA -8.0 Y +91380 CA -8.0 Y +91381 CA -8.0 Y +91382 CA -8.0 Y +91383 CA -8.0 Y +91384 CA -8.0 Y +91385 CA -8.0 Y +91386 CA -8.0 Y +91387 CA -8.0 Y +91388 CA -8.0 Y +91390 CA -8.0 Y +91392 CA -8.0 Y +91393 CA -8.0 Y +91394 CA -8.0 Y +91395 CA -8.0 Y +91396 CA -8.0 Y +91399 CA -8.0 Y +91401 CA -8.0 Y +91402 CA -8.0 Y +91403 CA -8.0 Y +91404 CA -8.0 Y +91405 CA -8.0 Y +91406 CA -8.0 Y +91407 CA -8.0 Y +91408 CA -8.0 Y +91409 CA -8.0 Y +91410 CA -8.0 Y +91411 CA -8.0 Y +91412 CA -8.0 Y +91413 CA -8.0 Y +91416 CA -8.0 Y +91423 CA -8.0 Y +91426 CA -8.0 Y +91436 CA -8.0 Y +91470 CA -8.0 Y +91482 CA -8.0 Y +91495 CA -8.0 Y +91496 CA -8.0 Y +91497 CA -8.0 Y +91499 CA -8.0 Y +91501 CA -8.0 Y +91502 CA -8.0 Y +91503 CA -8.0 Y +91504 CA -8.0 Y +91505 CA -8.0 Y +91506 CA -8.0 Y +91507 CA -8.0 Y +91508 CA -8.0 Y +91510 CA -8.0 Y +91521 CA -8.0 Y +91522 CA -8.0 Y +91523 CA -8.0 Y +91526 CA -8.0 Y +91601 CA -8.0 Y +91602 CA -8.0 Y +91603 CA -8.0 Y +91604 CA -8.0 Y +91605 CA -8.0 Y +91606 CA -8.0 Y +91607 CA -8.0 Y +91608 CA -8.0 Y +91609 CA -8.0 Y +91610 CA -8.0 Y +91611 CA -8.0 Y +91612 CA -8.0 Y +91614 CA -8.0 Y +91615 CA -8.0 Y +91616 CA -8.0 Y +91617 CA -8.0 Y +91618 CA -8.0 Y +91701 CA -8.0 Y +91702 CA -8.0 Y +91706 CA -8.0 Y +91708 CA -8.0 Y +91709 CA -8.0 Y +91710 CA -8.0 Y +91711 CA -8.0 Y +91714 CA -8.0 Y +91715 CA -8.0 Y +91716 CA -8.0 Y +91722 CA -8.0 Y +91723 CA -8.0 Y +91724 CA -8.0 Y +91729 CA -8.0 Y +91730 CA -8.0 Y +91731 CA -8.0 Y +91732 CA -8.0 Y +91733 CA -8.0 Y +91734 CA -8.0 Y +91735 CA -8.0 Y +91737 CA -8.0 Y +91739 CA -8.0 Y +91740 CA -8.0 Y +91741 CA -8.0 Y +91743 CA -8.0 Y +91744 CA -8.0 Y +91745 CA -8.0 Y +91746 CA -8.0 Y +91747 CA -8.0 Y +91748 CA -8.0 Y +91749 CA -8.0 Y +91750 CA -8.0 Y +91752 CA -8.0 Y +91754 CA -8.0 Y +91755 CA -8.0 Y +91756 CA -8.0 Y +91758 CA -8.0 Y +91759 CA -8.0 Y +91761 CA -8.0 Y +91762 CA -8.0 Y +91763 CA -8.0 Y +91764 CA -8.0 Y +91765 CA -8.0 Y +91766 CA -8.0 Y +91767 CA -8.0 Y +91768 CA -8.0 Y +91769 CA -8.0 Y +91770 CA -8.0 Y +91771 CA -8.0 Y +91772 CA -8.0 Y +91773 CA -8.0 Y +91775 CA -8.0 Y +91776 CA -8.0 Y +91778 CA -8.0 Y +91780 CA -8.0 Y +91784 CA -8.0 Y +91785 CA -8.0 Y +91786 CA -8.0 Y +91788 CA -8.0 Y +91789 CA -8.0 Y +91790 CA -8.0 Y +91791 CA -8.0 Y +91792 CA -8.0 Y +91793 CA -8.0 Y +91795 CA -8.0 Y +91797 CA -8.0 Y +91798 CA -8.0 Y +91799 CA -8.0 Y +91801 CA -8.0 Y +91802 CA -8.0 Y +91803 CA -8.0 Y +91804 CA -8.0 Y +91841 CA -8.0 Y +91896 CA -8.0 Y +91899 CA -8.0 Y +91901 CA -8.0 Y +91902 CA -8.0 Y +91903 CA -8.0 Y +91905 CA -8.0 Y +91906 CA -8.0 Y +91908 CA -8.0 Y +91909 CA -8.0 Y +91910 CA -8.0 Y +91911 CA -8.0 Y +91912 CA -8.0 Y +91913 CA -8.0 Y +91914 CA -8.0 Y +91915 CA -8.0 Y +91916 CA -8.0 Y +91917 CA -8.0 Y +91921 CA -8.0 Y +91931 CA -8.0 Y +91932 CA -8.0 Y +91933 CA -8.0 Y +91934 CA -8.0 Y +91935 CA -8.0 Y +91941 CA -8.0 Y +91942 CA -8.0 Y +91943 CA -8.0 Y +91944 CA -8.0 Y +91945 CA -8.0 Y +91946 CA -8.0 Y +91947 CA -8.0 Y +91948 CA -8.0 Y +91950 CA -8.0 Y +91951 CA -8.0 Y +91962 CA -8.0 Y +91963 CA -8.0 Y +91976 CA -8.0 Y +91977 CA -8.0 Y +91978 CA -8.0 Y +91979 CA -8.0 Y +91980 CA -8.0 Y +91987 CA -8.0 Y +91990 CA -8.0 Y +92003 CA -8.0 Y +92004 CA -8.0 Y +92007 CA -8.0 Y +92008 CA -8.0 Y +92009 CA -8.0 Y +92010 CA -8.0 Y +92011 CA -8.0 Y +92013 CA -8.0 Y +92014 CA -8.0 Y +92018 CA -8.0 Y +92019 CA -8.0 Y +92020 CA -8.0 Y +92021 CA -8.0 Y +92022 CA -8.0 Y +92023 CA -8.0 Y +92024 CA -8.0 Y +92025 CA -8.0 Y +92026 CA -8.0 Y +92027 CA -8.0 Y +92028 CA -8.0 Y +92029 CA -8.0 Y +92030 CA -8.0 Y +92033 CA -8.0 Y +92036 CA -8.0 Y +92037 CA -8.0 Y +92038 CA -8.0 Y +92039 CA -8.0 Y +92040 CA -8.0 Y +92046 CA -8.0 Y +92049 CA -8.0 Y +92051 CA -8.0 Y +92052 CA -8.0 Y +92054 CA -8.0 Y +92055 CA -8.0 Y +92056 CA -8.0 Y +92057 CA -8.0 Y +92059 CA -8.0 Y +92060 CA -8.0 Y +92061 CA -8.0 Y +92064 CA -8.0 Y +92065 CA -8.0 Y +92066 CA -8.0 Y +92067 CA -8.0 Y +92068 CA -8.0 Y +92069 CA -8.0 Y +92070 CA -8.0 Y +92071 CA -8.0 Y +92072 CA -8.0 Y +92074 CA -8.0 Y +92075 CA -8.0 Y +92078 CA -8.0 Y +92079 CA -8.0 Y +92081 CA -8.0 Y +92082 CA -8.0 Y +92083 CA -8.0 Y +92084 CA -8.0 Y +92085 CA -8.0 Y +92086 CA -8.0 Y +92088 CA -8.0 Y +92090 CA -8.0 Y +92091 CA -8.0 Y +92092 CA -8.0 Y +92093 CA -8.0 Y +92096 CA -8.0 Y +92101 CA -8.0 Y +92102 CA -8.0 Y +92103 CA -8.0 Y +92104 CA -8.0 Y +92105 CA -8.0 Y +92106 CA -8.0 Y +92107 CA -8.0 Y +92108 CA -8.0 Y +92109 CA -8.0 Y +92110 CA -8.0 Y +92111 CA -8.0 Y +92112 CA -8.0 Y +92113 CA -8.0 Y +92114 CA -8.0 Y +92115 CA -8.0 Y +92116 CA -8.0 Y +92117 CA -8.0 Y +92118 CA -8.0 Y +92119 CA -8.0 Y +92120 CA -8.0 Y +92121 CA -8.0 Y +92122 CA -8.0 Y +92123 CA -8.0 Y +92124 CA -8.0 Y +92126 CA -8.0 Y +92127 CA -8.0 Y +92128 CA -8.0 Y +92129 CA -8.0 Y +92130 CA -8.0 Y +92131 CA -8.0 Y +92132 CA -8.0 Y +92133 CA -8.0 Y +92134 CA -8.0 Y +92135 CA -8.0 Y +92136 CA -8.0 Y +92137 CA -8.0 Y +92138 CA -8.0 Y +92139 CA -8.0 Y +92140 CA -8.0 Y +92142 CA -8.0 Y +92143 CA -8.0 Y +92145 CA -8.0 Y +92147 CA -8.0 Y +92149 CA -8.0 Y +92150 CA -8.0 Y +92152 CA -8.0 Y +92153 CA -8.0 Y +92154 CA -8.0 Y +92155 CA -8.0 Y +92158 CA -8.0 Y +92159 CA -8.0 Y +92160 CA -8.0 Y +92161 CA -8.0 Y +92162 CA -8.0 Y +92163 CA -8.0 Y +92164 CA -8.0 Y +92165 CA -8.0 Y +92166 CA -8.0 Y +92167 CA -8.0 Y +92168 CA -8.0 Y +92169 CA -8.0 Y +92170 CA -8.0 Y +92171 CA -8.0 Y +92172 CA -8.0 Y +92173 CA -8.0 Y +92174 CA -8.0 Y +92175 CA -8.0 Y +92176 CA -8.0 Y +92177 CA -8.0 Y +92178 CA -8.0 Y +92179 CA -8.0 Y +92182 CA -8.0 Y +92184 CA -8.0 Y +92186 CA -8.0 Y +92187 CA -8.0 Y +92190 CA -8.0 Y +92191 CA -8.0 Y +92192 CA -8.0 Y +92193 CA -8.0 Y +92194 CA -8.0 Y +92195 CA -8.0 Y +92196 CA -8.0 Y +92197 CA -8.0 Y +92198 CA -8.0 Y +92199 CA -8.0 Y +92201 CA -8.0 Y +92202 CA -8.0 Y +92203 CA -8.0 Y +92210 CA -8.0 Y +92211 CA -8.0 Y +92220 CA -8.0 Y +92222 CA -8.0 Y +92223 CA -8.0 Y +92225 CA -8.0 Y +92226 CA -8.0 Y +92227 CA -8.0 Y +92230 CA -8.0 Y +92231 CA -8.0 Y +92232 CA -8.0 Y +92233 CA -8.0 Y +92234 CA -8.0 Y +92235 CA -8.0 Y +92236 CA -8.0 Y +92239 CA -8.0 Y +92240 CA -8.0 Y +92241 CA -8.0 Y +92242 CA -8.0 Y +92243 CA -8.0 Y +92244 CA -8.0 Y +92247 CA -8.0 Y +92248 CA -8.0 Y +92249 CA -8.0 Y +92250 CA -8.0 Y +92251 CA -8.0 Y +92252 CA -8.0 Y +92253 CA -8.0 Y +92254 CA -8.0 Y +92255 CA -8.0 Y +92256 CA -8.0 Y +92257 CA -8.0 Y +92258 CA -8.0 Y +92259 CA -8.0 Y +92260 CA -8.0 Y +92261 CA -8.0 Y +92262 CA -8.0 Y +92263 CA -8.0 Y +92264 CA -8.0 Y +92266 CA -8.0 Y +92267 CA -8.0 Y +92268 CA -8.0 Y +92270 CA -8.0 Y +92273 CA -8.0 Y +92274 CA -8.0 Y +92275 CA -8.0 Y +92276 CA -8.0 Y +92277 CA -8.0 Y +92278 CA -8.0 Y +92280 CA -8.0 Y +92281 CA -8.0 Y +92282 CA -8.0 Y +92283 CA -8.0 Y +92284 CA -8.0 Y +92285 CA -8.0 Y +92286 CA -8.0 Y +92292 CA -8.0 Y +92301 CA -8.0 Y +92304 CA -8.0 Y +92305 CA -8.0 Y +92307 CA -8.0 Y +92308 CA -8.0 Y +92309 CA -8.0 Y +92310 CA -8.0 Y +92311 CA -8.0 Y +92312 CA -8.0 Y +92313 CA -8.0 Y +92314 CA -8.0 Y +92315 CA -8.0 Y +92316 CA -8.0 Y +92317 CA -8.0 Y +92318 CA -8.0 Y +92320 CA -8.0 Y +92321 CA -8.0 Y +92322 CA -8.0 Y +92323 CA -8.0 Y +92324 CA -8.0 Y +92325 CA -8.0 Y +92326 CA -8.0 Y +92327 CA -8.0 Y +92328 CA -8.0 Y +92329 CA -8.0 Y +92331 CA -8.0 Y +92332 CA -8.0 Y +92333 CA -8.0 Y +92334 CA -8.0 Y +92335 CA -8.0 Y +92336 CA -8.0 Y +92337 CA -8.0 Y +92338 CA -8.0 Y +92339 CA -8.0 Y +92340 CA -8.0 Y +92341 CA -8.0 Y +92342 CA -8.0 Y +92344 CA -8.0 Y +92345 CA -8.0 Y +92346 CA -8.0 Y +92347 CA -8.0 Y +92350 CA -8.0 Y +92352 CA -8.0 Y +92354 CA -8.0 Y +92356 CA -8.0 Y +92357 CA -8.0 Y +92358 CA -8.0 Y +92359 CA -8.0 Y +92363 CA -8.0 Y +92364 CA -8.0 Y +92365 CA -8.0 Y +92366 CA -8.0 Y +92368 CA -8.0 Y +92369 CA -8.0 Y +92371 CA -8.0 Y +92372 CA -8.0 Y +92373 CA -8.0 Y +92374 CA -8.0 Y +92375 CA -8.0 Y +92376 CA -8.0 Y +92377 CA -8.0 Y +92378 CA -8.0 Y +92382 CA -8.0 Y +92384 CA -8.0 Y +92385 CA -8.0 Y +92386 CA -8.0 Y +92389 CA -8.0 Y +92391 CA -8.0 Y +92392 CA -8.0 Y +92393 CA -8.0 Y +92394 CA -8.0 Y +92395 CA -8.0 Y +92397 CA -8.0 Y +92398 CA -8.0 Y +92399 CA -8.0 Y +92401 CA -8.0 Y +92402 CA -8.0 Y +92403 CA -8.0 Y +92404 CA -8.0 Y +92405 CA -8.0 Y +92406 CA -8.0 Y +92407 CA -8.0 Y +92408 CA -8.0 Y +92410 CA -8.0 Y +92411 CA -8.0 Y +92412 CA -8.0 Y +92413 CA -8.0 Y +92414 CA -8.0 Y +92415 CA -8.0 Y +92418 CA -8.0 Y +92423 CA -8.0 Y +92424 CA -8.0 Y +92427 CA -8.0 Y +92501 CA -8.0 Y +92502 CA -8.0 Y +92503 CA -8.0 Y +92504 CA -8.0 Y +92505 CA -8.0 Y +92506 CA -8.0 Y +92507 CA -8.0 Y +92508 CA -8.0 Y +92509 CA -8.0 Y +92513 CA -8.0 Y +92514 CA -8.0 Y +92515 CA -8.0 Y +92516 CA -8.0 Y +92517 CA -8.0 Y +92518 CA -8.0 Y +92519 CA -8.0 Y +92521 CA -8.0 Y +92522 CA -8.0 Y +92530 CA -8.0 Y +92531 CA -8.0 Y +92532 CA -8.0 Y +92536 CA -8.0 Y +92539 CA -8.0 Y +92543 CA -8.0 Y +92544 CA -8.0 Y +92545 CA -8.0 Y +92546 CA -8.0 Y +92548 CA -8.0 Y +92549 CA -8.0 Y +92551 CA -8.0 Y +92552 CA -8.0 Y +92553 CA -8.0 Y +92554 CA -8.0 Y +92555 CA -8.0 Y +92556 CA -8.0 Y +92557 CA -8.0 Y +92561 CA -8.0 Y +92562 CA -8.0 Y +92563 CA -8.0 Y +92564 CA -8.0 Y +92567 CA -8.0 Y +92570 CA -8.0 Y +92571 CA -8.0 Y +92572 CA -8.0 Y +92581 CA -8.0 Y +92582 CA -8.0 Y +92583 CA -8.0 Y +92584 CA -8.0 Y +92585 CA -8.0 Y +92586 CA -8.0 Y +92587 CA -8.0 Y +92589 CA -8.0 Y +92590 CA -8.0 Y +92591 CA -8.0 Y +92592 CA -8.0 Y +92593 CA -8.0 Y +92595 CA -8.0 Y +92596 CA -8.0 Y +92599 CA -8.0 Y +92602 CA -8.0 Y +92603 CA -8.0 Y +92604 CA -8.0 Y +92605 CA -8.0 Y +92606 CA -8.0 Y +92607 CA -8.0 Y +92609 CA -8.0 Y +92610 CA -8.0 Y +92612 CA -8.0 Y +92614 CA -8.0 Y +92615 CA -8.0 Y +92616 CA -8.0 Y +92617 CA -8.0 Y +92618 CA -8.0 Y +92619 CA -8.0 Y +92620 CA -8.0 Y +92623 CA -8.0 Y +92624 CA -8.0 Y +92625 CA -8.0 Y +92626 CA -8.0 Y +92627 CA -8.0 Y +92628 CA -8.0 Y +92629 CA -8.0 Y +92630 CA -8.0 Y +92637 CA -8.0 Y +92646 CA -8.0 Y +92647 CA -8.0 Y +92648 CA -8.0 Y +92649 CA -8.0 Y +92650 CA -8.0 Y +92651 CA -8.0 Y +92652 CA -8.0 Y +92653 CA -8.0 Y +92654 CA -8.0 Y +92655 CA -8.0 Y +92656 CA -8.0 Y +92657 CA -8.0 Y +92658 CA -8.0 Y +92659 CA -8.0 Y +92660 CA -8.0 Y +92661 CA -8.0 Y +92662 CA -8.0 Y +92663 CA -8.0 Y +92672 CA -8.0 Y +92673 CA -8.0 Y +92674 CA -8.0 Y +92675 CA -8.0 Y +92676 CA -8.0 Y +92677 CA -8.0 Y +92678 CA -8.0 Y +92679 CA -8.0 Y +92683 CA -8.0 Y +92684 CA -8.0 Y +92685 CA -8.0 Y +92688 CA -8.0 Y +92690 CA -8.0 Y +92691 CA -8.0 Y +92692 CA -8.0 Y +92693 CA -8.0 Y +92694 CA -8.0 Y +92697 CA -8.0 Y +92698 CA -8.0 Y +92701 CA -8.0 Y +92702 CA -8.0 Y +92703 CA -8.0 Y +92704 CA -8.0 Y +92705 CA -8.0 Y +92706 CA -8.0 Y +92707 CA -8.0 Y +92708 CA -8.0 Y +92709 CA -8.0 Y +92710 CA -8.0 Y +92711 CA -8.0 Y +92712 CA -8.0 Y +92725 CA -8.0 Y +92728 CA -8.0 Y +92735 CA -8.0 Y +92780 CA -8.0 Y +92781 CA -8.0 Y +92782 CA -8.0 Y +92799 CA -8.0 Y +92801 CA -8.0 Y +92802 CA -8.0 Y +92803 CA -8.0 Y +92804 CA -8.0 Y +92805 CA -8.0 Y +92806 CA -8.0 Y +92807 CA -8.0 Y +92808 CA -8.0 Y +92809 CA -8.0 Y +92811 CA -8.0 Y +92812 CA -8.0 Y +92814 CA -8.0 Y +92815 CA -8.0 Y +92816 CA -8.0 Y +92817 CA -8.0 Y +92821 CA -8.0 Y +92822 CA -8.0 Y +92823 CA -8.0 Y +92825 CA -8.0 Y +92831 CA -8.0 Y +92832 CA -8.0 Y +92833 CA -8.0 Y +92834 CA -8.0 Y +92835 CA -8.0 Y +92836 CA -8.0 Y +92837 CA -8.0 Y +92838 CA -8.0 Y +92840 CA -8.0 Y +92841 CA -8.0 Y +92842 CA -8.0 Y +92843 CA -8.0 Y +92844 CA -8.0 Y +92845 CA -8.0 Y +92846 CA -8.0 Y +92850 CA -8.0 Y +92856 CA -8.0 Y +92857 CA -8.0 Y +92859 CA -8.0 Y +92860 CA -8.0 Y +92861 CA -8.0 Y +92862 CA -8.0 Y +92863 CA -8.0 Y +92864 CA -8.0 Y +92865 CA -8.0 Y +92866 CA -8.0 Y +92867 CA -8.0 Y +92868 CA -8.0 Y +92869 CA -8.0 Y +92870 CA -8.0 Y +92871 CA -8.0 Y +92877 CA -8.0 Y +92878 CA -8.0 Y +92879 CA -8.0 Y +92880 CA -8.0 Y +92881 CA -8.0 Y +92882 CA -8.0 Y +92883 CA -8.0 Y +92885 CA -8.0 Y +92886 CA -8.0 Y +92887 CA -8.0 Y +92899 CA -8.0 Y +93001 CA -8.0 Y +93002 CA -8.0 Y +93003 CA -8.0 Y +93004 CA -8.0 Y +93005 CA -8.0 Y +93006 CA -8.0 Y +93007 CA -8.0 Y +93009 CA -8.0 Y +93010 CA -8.0 Y +93011 CA -8.0 Y +93012 CA -8.0 Y +93013 CA -8.0 Y +93014 CA -8.0 Y +93015 CA -8.0 Y +93016 CA -8.0 Y +93020 CA -8.0 Y +93021 CA -8.0 Y +93022 CA -8.0 Y +93023 CA -8.0 Y +93024 CA -8.0 Y +93030 CA -8.0 Y +93031 CA -8.0 Y +93032 CA -8.0 Y +93033 CA -8.0 Y +93034 CA -8.0 Y +93035 CA -8.0 Y +93036 CA -8.0 Y +93040 CA -8.0 Y +93041 CA -8.0 Y +93042 CA -8.0 Y +93043 CA -8.0 Y +93044 CA -8.0 Y +93060 CA -8.0 Y +93061 CA -8.0 Y +93062 CA -8.0 Y +93063 CA -8.0 Y +93064 CA -8.0 Y +93065 CA -8.0 Y +93066 CA -8.0 Y +93067 CA -8.0 Y +93093 CA -8.0 Y +93094 CA -8.0 Y +93099 CA -8.0 Y +93101 CA -8.0 Y +93102 CA -8.0 Y +93103 CA -8.0 Y +93105 CA -8.0 Y +93106 CA -8.0 Y +93107 CA -8.0 Y +93108 CA -8.0 Y +93109 CA -8.0 Y +93110 CA -8.0 Y +93111 CA -8.0 Y +93116 CA -8.0 Y +93117 CA -8.0 Y +93118 CA -8.0 Y +93120 CA -8.0 Y +93121 CA -8.0 Y +93130 CA -8.0 Y +93140 CA -8.0 Y +93150 CA -8.0 Y +93160 CA -8.0 Y +93190 CA -8.0 Y +93199 CA -8.0 Y +93201 CA -8.0 Y +93202 CA -8.0 Y +93203 CA -8.0 Y +93204 CA -8.0 Y +93205 CA -8.0 Y +93206 CA -8.0 Y +93207 CA -8.0 Y +93208 CA -8.0 Y +93210 CA -8.0 Y +93212 CA -8.0 Y +93215 CA -8.0 Y +93216 CA -8.0 Y +93218 CA -8.0 Y +93219 CA -8.0 Y +93220 CA -8.0 Y +93221 CA -8.0 Y +93222 CA -8.0 Y +93223 CA -8.0 Y +93224 CA -8.0 Y +93225 CA -8.0 Y +93226 CA -8.0 Y +93227 CA -8.0 Y +93230 CA -8.0 Y +93232 CA -8.0 Y +93234 CA -8.0 Y +93235 CA -8.0 Y +93237 CA -8.0 Y +93238 CA -8.0 Y +93239 CA -8.0 Y +93240 CA -8.0 Y +93241 CA -8.0 Y +93242 CA -8.0 Y +93243 CA -8.0 Y +93244 CA -8.0 Y +93245 CA -8.0 Y +93246 CA -8.0 Y +93247 CA -8.0 Y +93249 CA -8.0 Y +93250 CA -8.0 Y +93251 CA -8.0 Y +93252 CA -8.0 Y +93254 CA -8.0 Y +93255 CA -8.0 Y +93256 CA -8.0 Y +93257 CA -8.0 Y +93258 CA -8.0 Y +93260 CA -8.0 Y +93261 CA -8.0 Y +93262 CA -8.0 Y +93263 CA -8.0 Y +93265 CA -8.0 Y +93266 CA -8.0 Y +93267 CA -8.0 Y +93268 CA -8.0 Y +93270 CA -8.0 Y +93271 CA -8.0 Y +93272 CA -8.0 Y +93274 CA -8.0 Y +93275 CA -8.0 Y +93276 CA -8.0 Y +93277 CA -8.0 Y +93278 CA -8.0 Y +93279 CA -8.0 Y +93280 CA -8.0 Y +93282 CA -8.0 Y +93283 CA -8.0 Y +93285 CA -8.0 Y +93286 CA -8.0 Y +93287 CA -8.0 Y +93290 CA -8.0 Y +93291 CA -8.0 Y +93292 CA -8.0 Y +93301 CA -8.0 Y +93302 CA -8.0 Y +93303 CA -8.0 Y +93304 CA -8.0 Y +93305 CA -8.0 Y +93306 CA -8.0 Y +93307 CA -8.0 Y +93308 CA -8.0 Y +93309 CA -8.0 Y +93311 CA -8.0 Y +93312 CA -8.0 Y +93313 CA -8.0 Y +93314 CA -8.0 Y +93380 CA -8.0 Y +93381 CA -8.0 Y +93382 CA -8.0 Y +93383 CA -8.0 Y +93384 CA -8.0 Y +93385 CA -8.0 Y +93386 CA -8.0 Y +93387 CA -8.0 Y +93388 CA -8.0 Y +93389 CA -8.0 Y +93390 CA -8.0 Y +93401 CA -8.0 Y +93402 CA -8.0 Y +93403 CA -8.0 Y +93405 CA -8.0 Y +93406 CA -8.0 Y +93407 CA -8.0 Y +93408 CA -8.0 Y +93409 CA -8.0 Y +93410 CA -8.0 Y +93412 CA -8.0 Y +93420 CA -8.0 Y +93421 CA -8.0 Y +93422 CA -8.0 Y +93423 CA -8.0 Y +93424 CA -8.0 Y +93426 CA -8.0 Y +93427 CA -8.0 Y +93428 CA -8.0 Y +93429 CA -8.0 Y +93430 CA -8.0 Y +93432 CA -8.0 Y +93433 CA -8.0 Y +93434 CA -8.0 Y +93435 CA -8.0 Y +93436 CA -8.0 Y +93437 CA -8.0 Y +93438 CA -8.0 Y +93440 CA -8.0 Y +93441 CA -8.0 Y +93442 CA -8.0 Y +93443 CA -8.0 Y +93444 CA -8.0 Y +93445 CA -8.0 Y +93446 CA -8.0 Y +93447 CA -8.0 Y +93448 CA -8.0 Y +93449 CA -8.0 Y +93450 CA -8.0 Y +93451 CA -8.0 Y +93452 CA -8.0 Y +93453 CA -8.0 Y +93454 CA -8.0 Y +93455 CA -8.0 Y +93456 CA -8.0 Y +93457 CA -8.0 Y +93458 CA -8.0 Y +93460 CA -8.0 Y +93461 CA -8.0 Y +93463 CA -8.0 Y +93464 CA -8.0 Y +93465 CA -8.0 Y +93475 CA -8.0 Y +93483 CA -8.0 Y +93501 CA -8.0 Y +93502 CA -8.0 Y +93504 CA -8.0 Y +93505 CA -8.0 Y +93510 CA -8.0 Y +93512 CA -8.0 Y +93513 CA -8.0 Y +93514 CA -8.0 Y +93515 CA -8.0 Y +93516 CA -8.0 Y +93517 CA -8.0 Y +93518 CA -8.0 Y +93519 CA -8.0 Y +93522 CA -8.0 Y +93523 CA -8.0 Y +93524 CA -8.0 Y +93526 CA -8.0 Y +93527 CA -8.0 Y +93528 CA -8.0 Y +93529 CA -8.0 Y +93530 CA -8.0 Y +93531 CA -8.0 Y +93532 CA -8.0 Y +93534 CA -8.0 Y +93535 CA -8.0 Y +93536 CA -8.0 Y +93539 CA -8.0 Y +93541 CA -8.0 Y +93542 CA -8.0 Y +93543 CA -8.0 Y +93544 CA -8.0 Y +93545 CA -8.0 Y +93546 CA -8.0 Y +93549 CA -8.0 Y +93550 CA -8.0 Y +93551 CA -8.0 Y +93552 CA -8.0 Y +93553 CA -8.0 Y +93554 CA -8.0 Y +93555 CA -8.0 Y +93556 CA -8.0 Y +93558 CA -8.0 Y +93560 CA -8.0 Y +93561 CA -8.0 Y +93562 CA -8.0 Y +93563 CA -8.0 Y +93581 CA -8.0 Y +93584 CA -8.0 Y +93586 CA -8.0 Y +93590 CA -8.0 Y +93591 CA -8.0 Y +93592 CA -8.0 Y +93596 CA -8.0 Y +93599 CA -8.0 Y +93601 CA -8.0 Y +93602 CA -8.0 Y +93603 CA -8.0 Y +93604 CA -8.0 Y +93605 CA -8.0 Y +93606 CA -8.0 Y +93607 CA -8.0 Y +93608 CA -8.0 Y +93609 CA -8.0 Y +93610 CA -8.0 Y +93611 CA -8.0 Y +93612 CA -8.0 Y +93613 CA -8.0 Y +93614 CA -8.0 Y +93615 CA -8.0 Y +93616 CA -8.0 Y +93618 CA -8.0 Y +93619 CA -8.0 Y +93620 CA -8.0 Y +93621 CA -8.0 Y +93622 CA -8.0 Y +93623 CA -8.0 Y +93624 CA -8.0 Y +93625 CA -8.0 Y +93626 CA -8.0 Y +93627 CA -8.0 Y +93628 CA -8.0 Y +93630 CA -8.0 Y +93631 CA -8.0 Y +93633 CA -8.0 Y +93634 CA -8.0 Y +93635 CA -8.0 Y +93636 CA -8.0 Y +93637 CA -8.0 Y +93638 CA -8.0 Y +93639 CA -8.0 Y +93640 CA -8.0 Y +93641 CA -8.0 Y +93642 CA -8.0 Y +93643 CA -8.0 Y +93644 CA -8.0 Y +93645 CA -8.0 Y +93646 CA -8.0 Y +93647 CA -8.0 Y +93648 CA -8.0 Y +93649 CA -8.0 Y +93650 CA -8.0 Y +93651 CA -8.0 Y +93652 CA -8.0 Y +93653 CA -8.0 Y +93654 CA -8.0 Y +93656 CA -8.0 Y +93657 CA -8.0 Y +93660 CA -8.0 Y +93661 CA -8.0 Y +93662 CA -8.0 Y +93664 CA -8.0 Y +93665 CA -8.0 Y +93666 CA -8.0 Y +93667 CA -8.0 Y +93668 CA -8.0 Y +93669 CA -8.0 Y +93670 CA -8.0 Y +93673 CA -8.0 Y +93675 CA -8.0 Y +93701 CA -8.0 Y +93702 CA -8.0 Y +93703 CA -8.0 Y +93704 CA -8.0 Y +93705 CA -8.0 Y +93706 CA -8.0 Y +93707 CA -8.0 Y +93708 CA -8.0 Y +93709 CA -8.0 Y +93710 CA -8.0 Y +93711 CA -8.0 Y +93712 CA -8.0 Y +93714 CA -8.0 Y +93715 CA -8.0 Y +93716 CA -8.0 Y +93717 CA -8.0 Y +93718 CA -8.0 Y +93720 CA -8.0 Y +93721 CA -8.0 Y +93722 CA -8.0 Y +93723 CA -8.0 Y +93724 CA -8.0 Y +93725 CA -8.0 Y +93726 CA -8.0 Y +93727 CA -8.0 Y +93728 CA -8.0 Y +93729 CA -8.0 Y +93730 CA -8.0 Y +93740 CA -8.0 Y +93741 CA -8.0 Y +93744 CA -8.0 Y +93745 CA -8.0 Y +93747 CA -8.0 Y +93750 CA -8.0 Y +93755 CA -8.0 Y +93760 CA -8.0 Y +93761 CA -8.0 Y +93764 CA -8.0 Y +93765 CA -8.0 Y +93771 CA -8.0 Y +93772 CA -8.0 Y +93773 CA -8.0 Y +93774 CA -8.0 Y +93775 CA -8.0 Y +93776 CA -8.0 Y +93777 CA -8.0 Y +93778 CA -8.0 Y +93779 CA -8.0 Y +93780 CA -8.0 Y +93784 CA -8.0 Y +93786 CA -8.0 Y +93790 CA -8.0 Y +93791 CA -8.0 Y +93792 CA -8.0 Y +93793 CA -8.0 Y +93794 CA -8.0 Y +93844 CA -8.0 Y +93888 CA -8.0 Y +93901 CA -8.0 Y +93902 CA -8.0 Y +93905 CA -8.0 Y +93906 CA -8.0 Y +93907 CA -8.0 Y +93908 CA -8.0 Y +93912 CA -8.0 Y +93915 CA -8.0 Y +93920 CA -8.0 Y +93921 CA -8.0 Y +93922 CA -8.0 Y +93923 CA -8.0 Y +93924 CA -8.0 Y +93925 CA -8.0 Y +93926 CA -8.0 Y +93927 CA -8.0 Y +93928 CA -8.0 Y +93930 CA -8.0 Y +93932 CA -8.0 Y +93933 CA -8.0 Y +93940 CA -8.0 Y +93942 CA -8.0 Y +93943 CA -8.0 Y +93944 CA -8.0 Y +93950 CA -8.0 Y +93953 CA -8.0 Y +93954 CA -8.0 Y +93955 CA -8.0 Y +93960 CA -8.0 Y +93962 CA -8.0 Y +94002 CA -8.0 Y +94005 CA -8.0 Y +94010 CA -8.0 Y +94011 CA -8.0 Y +94013 CA -8.0 Y +94014 CA -8.0 Y +94015 CA -8.0 Y +94016 CA -8.0 Y +94017 CA -8.0 Y +94018 CA -8.0 Y +94019 CA -8.0 Y +94020 CA -8.0 Y +94021 CA -8.0 Y +94022 CA -8.0 Y +94023 CA -8.0 Y +94024 CA -8.0 Y +94025 CA -8.0 Y +94026 CA -8.0 Y +94027 CA -8.0 Y +94028 CA -8.0 Y +94030 CA -8.0 Y +94035 CA -8.0 Y +94037 CA -8.0 Y +94038 CA -8.0 Y +94039 CA -8.0 Y +94040 CA -8.0 Y +94041 CA -8.0 Y +94042 CA -8.0 Y +94043 CA -8.0 Y +94044 CA -8.0 Y +94060 CA -8.0 Y +94061 CA -8.0 Y +94062 CA -8.0 Y +94063 CA -8.0 Y +94064 CA -8.0 Y +94065 CA -8.0 Y +94066 CA -8.0 Y +94070 CA -8.0 Y +94074 CA -8.0 Y +94080 CA -8.0 Y +94083 CA -8.0 Y +94085 CA -8.0 Y +94086 CA -8.0 Y +94087 CA -8.0 Y +94088 CA -8.0 Y +94089 CA -8.0 Y +94096 CA -8.0 Y +94098 CA -8.0 Y +94101 CA -8.0 Y +94102 CA -8.0 Y +94103 CA -8.0 Y +94104 CA -8.0 Y +94105 CA -8.0 Y +94106 CA -8.0 Y +94107 CA -8.0 Y +94108 CA -8.0 Y +94109 CA -8.0 Y +94110 CA -8.0 Y +94111 CA -8.0 Y +94112 CA -8.0 Y +94114 CA -8.0 Y +94115 CA -8.0 Y +94116 CA -8.0 Y +94117 CA -8.0 Y +94118 CA -8.0 Y +94119 CA -8.0 Y +94120 CA -8.0 Y +94121 CA -8.0 Y +94122 CA -8.0 Y +94123 CA -8.0 Y +94124 CA -8.0 Y +94125 CA -8.0 Y +94126 CA -8.0 Y +94127 CA -8.0 Y +94128 CA -8.0 Y +94129 CA -8.0 Y +94130 CA -8.0 Y +94131 CA -8.0 Y +94132 CA -8.0 Y +94133 CA -8.0 Y +94134 CA -8.0 Y +94135 CA -8.0 Y +94136 CA -8.0 Y +94137 CA -8.0 Y +94138 CA -8.0 Y +94139 CA -8.0 Y +94140 CA -8.0 Y +94141 CA -8.0 Y +94142 CA -8.0 Y +94143 CA -8.0 Y +94144 CA -8.0 Y +94145 CA -8.0 Y +94146 CA -8.0 Y +94147 CA -8.0 Y +94150 CA -8.0 Y +94151 CA -8.0 Y +94152 CA -8.0 Y +94153 CA -8.0 Y +94154 CA -8.0 Y +94155 CA -8.0 Y +94156 CA -8.0 Y +94157 CA -8.0 Y +94158 CA -8.0 Y +94159 CA -8.0 Y +94160 CA -8.0 Y +94161 CA -8.0 Y +94162 CA -8.0 Y +94163 CA -8.0 Y +94164 CA -8.0 Y +94165 CA -8.0 Y +94166 CA -8.0 Y +94167 CA -8.0 Y +94168 CA -8.0 Y +94169 CA -8.0 Y +94170 CA -8.0 Y +94171 CA -8.0 Y +94172 CA -8.0 Y +94175 CA -8.0 Y +94177 CA -8.0 Y +94188 CA -8.0 Y +94199 CA -8.0 Y +94203 CA -8.0 Y +94204 CA -8.0 Y +94205 CA -8.0 Y +94206 CA -8.0 Y +94207 CA -8.0 Y +94208 CA -8.0 Y +94209 CA -8.0 Y +94211 CA -8.0 Y +94229 CA -8.0 Y +94230 CA -8.0 Y +94232 CA -8.0 Y +94234 CA -8.0 Y +94235 CA -8.0 Y +94236 CA -8.0 Y +94237 CA -8.0 Y +94239 CA -8.0 Y +94240 CA -8.0 Y +94244 CA -8.0 Y +94245 CA -8.0 Y +94246 CA -8.0 Y +94247 CA -8.0 Y +94248 CA -8.0 Y +94249 CA -8.0 Y +94250 CA -8.0 Y +94252 CA -8.0 Y +94254 CA -8.0 Y +94256 CA -8.0 Y +94257 CA -8.0 Y +94258 CA -8.0 Y +94259 CA -8.0 Y +94261 CA -8.0 Y +94262 CA -8.0 Y +94263 CA -8.0 Y +94267 CA -8.0 Y +94268 CA -8.0 Y +94269 CA -8.0 Y +94271 CA -8.0 Y +94273 CA -8.0 Y +94274 CA -8.0 Y +94277 CA -8.0 Y +94278 CA -8.0 Y +94279 CA -8.0 Y +94280 CA -8.0 Y +94282 CA -8.0 Y +94283 CA -8.0 Y +94284 CA -8.0 Y +94285 CA -8.0 Y +94286 CA -8.0 Y +94287 CA -8.0 Y +94288 CA -8.0 Y +94289 CA -8.0 Y +94290 CA -8.0 Y +94291 CA -8.0 Y +94293 CA -8.0 Y +94294 CA -8.0 Y +94295 CA -8.0 Y +94296 CA -8.0 Y +94297 CA -8.0 Y +94298 CA -8.0 Y +94299 CA -8.0 Y +94301 CA -8.0 Y +94302 CA -8.0 Y +94303 CA -8.0 Y +94304 CA -8.0 Y +94305 CA -8.0 Y +94306 CA -8.0 Y +94309 CA -8.0 Y +94401 CA -8.0 Y +94402 CA -8.0 Y +94403 CA -8.0 Y +94404 CA -8.0 Y +94497 CA -8.0 Y +94501 CA -8.0 Y +94502 CA -8.0 Y +94503 CA -8.0 Y +94506 CA -8.0 Y +94507 CA -8.0 Y +94508 CA -8.0 Y +94509 CA -8.0 Y +94510 CA -8.0 Y +94511 CA -8.0 Y +94512 CA -8.0 Y +94513 CA -8.0 Y +94514 CA -8.0 Y +94515 CA -8.0 Y +94516 CA -8.0 Y +94517 CA -8.0 Y +94518 CA -8.0 Y +94519 CA -8.0 Y +94520 CA -8.0 Y +94521 CA -8.0 Y +94522 CA -8.0 Y +94523 CA -8.0 Y +94524 CA -8.0 Y +94525 CA -8.0 Y +94526 CA -8.0 Y +94527 CA -8.0 Y +94528 CA -8.0 Y +94529 CA -8.0 Y +94530 CA -8.0 Y +94531 CA -8.0 Y +94533 CA -8.0 Y +94534 CA -8.0 Y +94535 CA -8.0 Y +94536 CA -8.0 Y +94537 CA -8.0 Y +94538 CA -8.0 Y +94539 CA -8.0 Y +94540 CA -8.0 Y +94541 CA -8.0 Y +94542 CA -8.0 Y +94543 CA -8.0 Y +94544 CA -8.0 Y +94545 CA -8.0 Y +94546 CA -8.0 Y +94547 CA -8.0 Y +94548 CA -8.0 Y +94549 CA -8.0 Y +94550 CA -8.0 Y +94551 CA -8.0 Y +94552 CA -8.0 Y +94553 CA -8.0 Y +94555 CA -8.0 Y +94556 CA -8.0 Y +94557 CA -8.0 Y +94558 CA -8.0 Y +94559 CA -8.0 Y +94560 CA -8.0 Y +94561 CA -8.0 Y +94562 CA -8.0 Y +94563 CA -8.0 Y +94564 CA -8.0 Y +94565 CA -8.0 Y +94566 CA -8.0 Y +94567 CA -8.0 Y +94568 CA -8.0 Y +94569 CA -8.0 Y +94570 CA -8.0 Y +94571 CA -8.0 Y +94572 CA -8.0 Y +94573 CA -8.0 Y +94574 CA -8.0 Y +94575 CA -8.0 Y +94576 CA -8.0 Y +94577 CA -8.0 Y +94578 CA -8.0 Y +94579 CA -8.0 Y +94580 CA -8.0 Y +94581 CA -8.0 Y +94582 CA -8.0 Y +94583 CA -8.0 Y +94585 CA -8.0 Y +94586 CA -8.0 Y +94587 CA -8.0 Y +94588 CA -8.0 Y +94589 CA -8.0 Y +94590 CA -8.0 Y +94591 CA -8.0 Y +94592 CA -8.0 Y +94595 CA -8.0 Y +94596 CA -8.0 Y +94597 CA -8.0 Y +94598 CA -8.0 Y +94599 CA -8.0 Y +94601 CA -8.0 Y +94602 CA -8.0 Y +94603 CA -8.0 Y +94604 CA -8.0 Y +94605 CA -8.0 Y +94606 CA -8.0 Y +94607 CA -8.0 Y +94608 CA -8.0 Y +94609 CA -8.0 Y +94610 CA -8.0 Y +94611 CA -8.0 Y +94612 CA -8.0 Y +94613 CA -8.0 Y +94614 CA -8.0 Y +94615 CA -8.0 Y +94617 CA -8.0 Y +94618 CA -8.0 Y +94619 CA -8.0 Y +94620 CA -8.0 Y +94621 CA -8.0 Y +94622 CA -8.0 Y +94623 CA -8.0 Y +94624 CA -8.0 Y +94625 CA -8.0 Y +94649 CA -8.0 Y +94659 CA -8.0 Y +94660 CA -8.0 Y +94661 CA -8.0 Y +94662 CA -8.0 Y +94666 CA -8.0 Y +94701 CA -8.0 Y +94702 CA -8.0 Y +94703 CA -8.0 Y +94704 CA -8.0 Y +94705 CA -8.0 Y +94706 CA -8.0 Y +94707 CA -8.0 Y +94708 CA -8.0 Y +94709 CA -8.0 Y +94710 CA -8.0 Y +94712 CA -8.0 Y +94720 CA -8.0 Y +94801 CA -8.0 Y +94802 CA -8.0 Y +94803 CA -8.0 Y +94804 CA -8.0 Y +94805 CA -8.0 Y +94806 CA -8.0 Y +94807 CA -8.0 Y +94808 CA -8.0 Y +94820 CA -8.0 Y +94850 CA -8.0 Y +94901 CA -8.0 Y +94903 CA -8.0 Y +94904 CA -8.0 Y +94912 CA -8.0 Y +94913 CA -8.0 Y +94914 CA -8.0 Y +94915 CA -8.0 Y +94920 CA -8.0 Y +94922 CA -8.0 Y +94923 CA -8.0 Y +94924 CA -8.0 Y +94925 CA -8.0 Y +94926 CA -8.0 Y +94927 CA -8.0 Y +94928 CA -8.0 Y +94929 CA -8.0 Y +94930 CA -8.0 Y +94931 CA -8.0 Y +94933 CA -8.0 Y +94937 CA -8.0 Y +94938 CA -8.0 Y +94939 CA -8.0 Y +94940 CA -8.0 Y +94941 CA -8.0 Y +94942 CA -8.0 Y +94945 CA -8.0 Y +94946 CA -8.0 Y +94947 CA -8.0 Y +94948 CA -8.0 Y +94949 CA -8.0 Y +94950 CA -8.0 Y +94951 CA -8.0 Y +94952 CA -8.0 Y +94953 CA -8.0 Y +94954 CA -8.0 Y +94955 CA -8.0 Y +94956 CA -8.0 Y +94957 CA -8.0 Y +94960 CA -8.0 Y +94963 CA -8.0 Y +94964 CA -8.0 Y +94965 CA -8.0 Y +94966 CA -8.0 Y +94970 CA -8.0 Y +94971 CA -8.0 Y +94972 CA -8.0 Y +94973 CA -8.0 Y +94974 CA -8.0 Y +94975 CA -8.0 Y +94976 CA -8.0 Y +94977 CA -8.0 Y +94978 CA -8.0 Y +94979 CA -8.0 Y +94998 CA -8.0 Y +94999 CA -8.0 Y +95001 CA -8.0 Y +95002 CA -8.0 Y +95003 CA -8.0 Y +95004 CA -8.0 Y +95005 CA -8.0 Y +95006 CA -8.0 Y +95007 CA -8.0 Y +95008 CA -8.0 Y +95009 CA -8.0 Y +95010 CA -8.0 Y +95011 CA -8.0 Y +95012 CA -8.0 Y +95013 CA -8.0 Y +95014 CA -8.0 Y +95015 CA -8.0 Y +95017 CA -8.0 Y +95018 CA -8.0 Y +95019 CA -8.0 Y +95020 CA -8.0 Y +95021 CA -8.0 Y +95023 CA -8.0 Y +95024 CA -8.0 Y +95026 CA -8.0 Y +95030 CA -8.0 Y +95031 CA -8.0 Y +95032 CA -8.0 Y +95033 CA -8.0 Y +95035 CA -8.0 Y +95036 CA -8.0 Y +95037 CA -8.0 Y +95038 CA -8.0 Y +95039 CA -8.0 Y +95041 CA -8.0 Y +95042 CA -8.0 Y +95043 CA -8.0 Y +95044 CA -8.0 Y +95045 CA -8.0 Y +95046 CA -8.0 Y +95050 CA -8.0 Y +95051 CA -8.0 Y +95052 CA -8.0 Y +95053 CA -8.0 Y +95054 CA -8.0 Y +95055 CA -8.0 Y +95056 CA -8.0 Y +95060 CA -8.0 Y +95061 CA -8.0 Y +95062 CA -8.0 Y +95063 CA -8.0 Y +95064 CA -8.0 Y +95065 CA -8.0 Y +95066 CA -8.0 Y +95067 CA -8.0 Y +95070 CA -8.0 Y +95071 CA -8.0 Y +95073 CA -8.0 Y +95075 CA -8.0 Y +95076 CA -8.0 Y +95077 CA -8.0 Y +95101 CA -8.0 Y +95103 CA -8.0 Y +95106 CA -8.0 Y +95108 CA -8.0 Y +95109 CA -8.0 Y +95110 CA -8.0 Y +95111 CA -8.0 Y +95112 CA -8.0 Y +95113 CA -8.0 Y +95115 CA -8.0 Y +95116 CA -8.0 Y +95117 CA -8.0 Y +95118 CA -8.0 Y +95119 CA -8.0 Y +95120 CA -8.0 Y +95121 CA -8.0 Y +95122 CA -8.0 Y +95123 CA -8.0 Y +95124 CA -8.0 Y +95125 CA -8.0 Y +95126 CA -8.0 Y +95127 CA -8.0 Y +95128 CA -8.0 Y +95129 CA -8.0 Y +95130 CA -8.0 Y +95131 CA -8.0 Y +95132 CA -8.0 Y +95133 CA -8.0 Y +95134 CA -8.0 Y +95135 CA -8.0 Y +95136 CA -8.0 Y +95138 CA -8.0 Y +95139 CA -8.0 Y +95140 CA -8.0 Y +95141 CA -8.0 Y +95148 CA -8.0 Y +95150 CA -8.0 Y +95151 CA -8.0 Y +95152 CA -8.0 Y +95153 CA -8.0 Y +95154 CA -8.0 Y +95155 CA -8.0 Y +95156 CA -8.0 Y +95157 CA -8.0 Y +95158 CA -8.0 Y +95159 CA -8.0 Y +95160 CA -8.0 Y +95161 CA -8.0 Y +95164 CA -8.0 Y +95170 CA -8.0 Y +95172 CA -8.0 Y +95173 CA -8.0 Y +95190 CA -8.0 Y +95191 CA -8.0 Y +95192 CA -8.0 Y +95193 CA -8.0 Y +95194 CA -8.0 Y +95196 CA -8.0 Y +95201 CA -8.0 Y +95202 CA -8.0 Y +95203 CA -8.0 Y +95204 CA -8.0 Y +95205 CA -8.0 Y +95206 CA -8.0 Y +95207 CA -8.0 Y +95208 CA -8.0 Y +95209 CA -8.0 Y +95210 CA -8.0 Y +95211 CA -8.0 Y +95212 CA -8.0 Y +95213 CA -8.0 Y +95215 CA -8.0 Y +95219 CA -8.0 Y +95220 CA -8.0 Y +95221 CA -8.0 Y +95222 CA -8.0 Y +95223 CA -8.0 Y +95224 CA -8.0 Y +95225 CA -8.0 Y +95226 CA -8.0 Y +95227 CA -8.0 Y +95228 CA -8.0 Y +95229 CA -8.0 Y +95230 CA -8.0 Y +95231 CA -8.0 Y +95232 CA -8.0 Y +95233 CA -8.0 Y +95234 CA -8.0 Y +95236 CA -8.0 Y +95237 CA -8.0 Y +95240 CA -8.0 Y +95241 CA -8.0 Y +95242 CA -8.0 Y +95245 CA -8.0 Y +95246 CA -8.0 Y +95247 CA -8.0 Y +95248 CA -8.0 Y +95249 CA -8.0 Y +95250 CA -8.0 Y +95251 CA -8.0 Y +95252 CA -8.0 Y +95253 CA -8.0 Y +95254 CA -8.0 Y +95255 CA -8.0 Y +95257 CA -8.0 Y +95258 CA -8.0 Y +95267 CA -8.0 Y +95269 CA -8.0 Y +95296 CA -8.0 Y +95297 CA -8.0 Y +95301 CA -8.0 Y +95303 CA -8.0 Y +95304 CA -8.0 Y +95305 CA -8.0 Y +95306 CA -8.0 Y +95307 CA -8.0 Y +95309 CA -8.0 Y +95310 CA -8.0 Y +95311 CA -8.0 Y +95312 CA -8.0 Y +95313 CA -8.0 Y +95314 CA -8.0 Y +95315 CA -8.0 Y +95316 CA -8.0 Y +95317 CA -8.0 Y +95318 CA -8.0 Y +95319 CA -8.0 Y +95320 CA -8.0 Y +95321 CA -8.0 Y +95322 CA -8.0 Y +95323 CA -8.0 Y +95324 CA -8.0 Y +95325 CA -8.0 Y +95326 CA -8.0 Y +95327 CA -8.0 Y +95328 CA -8.0 Y +95329 CA -8.0 Y +95330 CA -8.0 Y +95333 CA -8.0 Y +95334 CA -8.0 Y +95335 CA -8.0 Y +95336 CA -8.0 Y +95337 CA -8.0 Y +95338 CA -8.0 Y +95340 CA -8.0 Y +95341 CA -8.0 Y +95343 CA -8.0 Y +95344 CA -8.0 Y +95345 CA -8.0 Y +95346 CA -8.0 Y +95347 CA -8.0 Y +95348 CA -8.0 Y +95350 CA -8.0 Y +95351 CA -8.0 Y +95352 CA -8.0 Y +95353 CA -8.0 Y +95354 CA -8.0 Y +95355 CA -8.0 Y +95356 CA -8.0 Y +95357 CA -8.0 Y +95358 CA -8.0 Y +95360 CA -8.0 Y +95361 CA -8.0 Y +95363 CA -8.0 Y +95364 CA -8.0 Y +95365 CA -8.0 Y +95366 CA -8.0 Y +95367 CA -8.0 Y +95368 CA -8.0 Y +95369 CA -8.0 Y +95370 CA -8.0 Y +95372 CA -8.0 Y +95373 CA -8.0 Y +95374 CA -8.0 Y +95375 CA -8.0 Y +95376 CA -8.0 Y +95377 CA -8.0 Y +95378 CA -8.0 Y +95379 CA -8.0 Y +95380 CA -8.0 Y +95381 CA -8.0 Y +95382 CA -8.0 Y +95383 CA -8.0 Y +95385 CA -8.0 Y +95386 CA -8.0 Y +95387 CA -8.0 Y +95388 CA -8.0 Y +95389 CA -8.0 Y +95391 CA -8.0 Y +95397 CA -8.0 Y +95401 CA -8.0 Y +95402 CA -8.0 Y +95403 CA -8.0 Y +95404 CA -8.0 Y +95405 CA -8.0 Y +95406 CA -8.0 Y +95407 CA -8.0 Y +95408 CA -8.0 Y +95409 CA -8.0 Y +95410 CA -8.0 Y +95412 CA -8.0 Y +95415 CA -8.0 Y +95416 CA -8.0 Y +95417 CA -8.0 Y +95418 CA -8.0 Y +95419 CA -8.0 Y +95420 CA -8.0 Y +95421 CA -8.0 Y +95422 CA -8.0 Y +95423 CA -8.0 Y +95424 CA -8.0 Y +95425 CA -8.0 Y +95426 CA -8.0 Y +95427 CA -8.0 Y +95428 CA -8.0 Y +95429 CA -8.0 Y +95430 CA -8.0 Y +95431 CA -8.0 Y +95432 CA -8.0 Y +95433 CA -8.0 Y +95435 CA -8.0 Y +95436 CA -8.0 Y +95437 CA -8.0 Y +95439 CA -8.0 Y +95441 CA -8.0 Y +95442 CA -8.0 Y +95443 CA -8.0 Y +95444 CA -8.0 Y +95445 CA -8.0 Y +95446 CA -8.0 Y +95448 CA -8.0 Y +95449 CA -8.0 Y +95450 CA -8.0 Y +95451 CA -8.0 Y +95452 CA -8.0 Y +95453 CA -8.0 Y +95454 CA -8.0 Y +95456 CA -8.0 Y +95457 CA -8.0 Y +95458 CA -8.0 Y +95459 CA -8.0 Y +95460 CA -8.0 Y +95461 CA -8.0 Y +95462 CA -8.0 Y +95463 CA -8.0 Y +95464 CA -8.0 Y +95465 CA -8.0 Y +95466 CA -8.0 Y +95467 CA -8.0 Y +95468 CA -8.0 Y +95469 CA -8.0 Y +95470 CA -8.0 Y +95471 CA -8.0 Y +95472 CA -8.0 Y +95473 CA -8.0 Y +95476 CA -8.0 Y +95480 CA -8.0 Y +95481 CA -8.0 Y +95482 CA -8.0 Y +95485 CA -8.0 Y +95486 CA -8.0 Y +95487 CA -8.0 Y +95488 CA -8.0 Y +95490 CA -8.0 Y +95492 CA -8.0 Y +95493 CA -8.0 Y +95494 CA -8.0 Y +95497 CA -8.0 Y +95501 CA -8.0 Y +95502 CA -8.0 Y +95503 CA -8.0 Y +95511 CA -8.0 Y +95514 CA -8.0 Y +95518 CA -8.0 Y +95519 CA -8.0 Y +95521 CA -8.0 Y +95524 CA -8.0 Y +95525 CA -8.0 Y +95526 CA -8.0 Y +95527 CA -8.0 Y +95528 CA -8.0 Y +95531 CA -8.0 Y +95532 CA -8.0 Y +95534 CA -8.0 Y +95536 CA -8.0 Y +95537 CA -8.0 Y +95538 CA -8.0 Y +95540 CA -8.0 Y +95542 CA -8.0 Y +95543 CA -8.0 Y +95545 CA -8.0 Y +95546 CA -8.0 Y +95547 CA -8.0 Y +95548 CA -8.0 Y +95549 CA -8.0 Y +95550 CA -8.0 Y +95551 CA -8.0 Y +95552 CA -8.0 Y +95553 CA -8.0 Y +95554 CA -8.0 Y +95555 CA -8.0 Y +95556 CA -8.0 Y +95558 CA -8.0 Y +95559 CA -8.0 Y +95560 CA -8.0 Y +95562 CA -8.0 Y +95563 CA -8.0 Y +95564 CA -8.0 Y +95565 CA -8.0 Y +95567 CA -8.0 Y +95568 CA -8.0 Y +95569 CA -8.0 Y +95570 CA -8.0 Y +95571 CA -8.0 Y +95573 CA -8.0 Y +95585 CA -8.0 Y +95587 CA -8.0 Y +95589 CA -8.0 Y +95595 CA -8.0 Y +95601 CA -8.0 Y +95602 CA -8.0 Y +95603 CA -8.0 Y +95604 CA -8.0 Y +95605 CA -8.0 Y +95606 CA -8.0 Y +95607 CA -8.0 Y +95608 CA -8.0 Y +95609 CA -8.0 Y +95610 CA -8.0 Y +95611 CA -8.0 Y +95612 CA -8.0 Y +95613 CA -8.0 Y +95614 CA -8.0 Y +95615 CA -8.0 Y +95616 CA -8.0 Y +95617 CA -8.0 Y +95618 CA -8.0 Y +95619 CA -8.0 Y +95620 CA -8.0 Y +95621 CA -8.0 Y +95623 CA -8.0 Y +95624 CA -8.0 Y +95625 CA -8.0 Y +95626 CA -8.0 Y +95627 CA -8.0 Y +95628 CA -8.0 Y +95629 CA -8.0 Y +95630 CA -8.0 Y +95631 CA -8.0 Y +95632 CA -8.0 Y +95633 CA -8.0 Y +95634 CA -8.0 Y +95635 CA -8.0 Y +95636 CA -8.0 Y +95637 CA -8.0 Y +95638 CA -8.0 Y +95639 CA -8.0 Y +95640 CA -8.0 Y +95641 CA -8.0 Y +95642 CA -8.0 Y +95644 CA -8.0 Y +95645 CA -8.0 Y +95646 CA -8.0 Y +95648 CA -8.0 Y +95650 CA -8.0 Y +95651 CA -8.0 Y +95652 CA -8.0 Y +95653 CA -8.0 Y +95654 CA -8.0 Y +95655 CA -8.0 Y +95656 CA -8.0 Y +95658 CA -8.0 Y +95659 CA -8.0 Y +95660 CA -8.0 Y +95661 CA -8.0 Y +95662 CA -8.0 Y +95663 CA -8.0 Y +95664 CA -8.0 Y +95665 CA -8.0 Y +95666 CA -8.0 Y +95667 CA -8.0 Y +95668 CA -8.0 Y +95669 CA -8.0 Y +95670 CA -8.0 Y +95671 CA -8.0 Y +95672 CA -8.0 Y +95673 CA -8.0 Y +95674 CA -8.0 Y +95675 CA -8.0 Y +95676 CA -8.0 Y +95677 CA -8.0 Y +95678 CA -8.0 Y +95679 CA -8.0 Y +95680 CA -8.0 Y +95681 CA -8.0 Y +95682 CA -8.0 Y +95683 CA -8.0 Y +95684 CA -8.0 Y +95685 CA -8.0 Y +95686 CA -8.0 Y +95687 CA -8.0 Y +95688 CA -8.0 Y +95689 CA -8.0 Y +95690 CA -8.0 Y +95691 CA -8.0 Y +95692 CA -8.0 Y +95693 CA -8.0 Y +95694 CA -8.0 Y +95695 CA -8.0 Y +95696 CA -8.0 Y +95697 CA -8.0 Y +95698 CA -8.0 Y +95699 CA -8.0 Y +95701 CA -8.0 Y +95703 CA -8.0 Y +95709 CA -8.0 Y +95712 CA -8.0 Y +95713 CA -8.0 Y +95714 CA -8.0 Y +95715 CA -8.0 Y +95717 CA -8.0 Y +95720 CA -8.0 Y +95721 CA -8.0 Y +95722 CA -8.0 Y +95724 CA -8.0 Y +95726 CA -8.0 Y +95728 CA -8.0 Y +95735 CA -8.0 Y +95736 CA -8.0 Y +95741 CA -8.0 Y +95742 CA -8.0 Y +95746 CA -8.0 Y +95747 CA -8.0 Y +95757 CA -8.0 Y +95758 CA -8.0 Y +95759 CA -8.0 Y +95762 CA -8.0 Y +95763 CA -8.0 Y +95765 CA -8.0 Y +95776 CA -8.0 Y +95798 CA -8.0 Y +95799 CA -8.0 Y +95812 CA -8.0 Y +95813 CA -8.0 Y +95814 CA -8.0 Y +95815 CA -8.0 Y +95816 CA -8.0 Y +95817 CA -8.0 Y +95818 CA -8.0 Y +95819 CA -8.0 Y +95820 CA -8.0 Y +95821 CA -8.0 Y +95822 CA -8.0 Y +95823 CA -8.0 Y +95824 CA -8.0 Y +95825 CA -8.0 Y +95826 CA -8.0 Y +95827 CA -8.0 Y +95828 CA -8.0 Y +95829 CA -8.0 Y +95830 CA -8.0 Y +95831 CA -8.0 Y +95832 CA -8.0 Y +95833 CA -8.0 Y +95834 CA -8.0 Y +95835 CA -8.0 Y +95836 CA -8.0 Y +95837 CA -8.0 Y +95838 CA -8.0 Y +95840 CA -8.0 Y +95841 CA -8.0 Y +95842 CA -8.0 Y +95843 CA -8.0 Y +95851 CA -8.0 Y +95852 CA -8.0 Y +95853 CA -8.0 Y +95860 CA -8.0 Y +95864 CA -8.0 Y +95865 CA -8.0 Y +95866 CA -8.0 Y +95867 CA -8.0 Y +95887 CA -8.0 Y +95894 CA -8.0 Y +95899 CA -8.0 Y +95901 CA -8.0 Y +95903 CA -8.0 Y +95910 CA -8.0 Y +95912 CA -8.0 Y +95913 CA -8.0 Y +95914 CA -8.0 Y +95915 CA -8.0 Y +95916 CA -8.0 Y +95917 CA -8.0 Y +95918 CA -8.0 Y +95919 CA -8.0 Y +95920 CA -8.0 Y +95922 CA -8.0 Y +95923 CA -8.0 Y +95924 CA -8.0 Y +95925 CA -8.0 Y +95926 CA -8.0 Y +95927 CA -8.0 Y +95928 CA -8.0 Y +95929 CA -8.0 Y +95930 CA -8.0 Y +95932 CA -8.0 Y +95934 CA -8.0 Y +95935 CA -8.0 Y +95936 CA -8.0 Y +95937 CA -8.0 Y +95938 CA -8.0 Y +95939 CA -8.0 Y +95940 CA -8.0 Y +95941 CA -8.0 Y +95942 CA -8.0 Y +95943 CA -8.0 Y +95944 CA -8.0 Y +95945 CA -8.0 Y +95946 CA -8.0 Y +95947 CA -8.0 Y +95948 CA -8.0 Y +95949 CA -8.0 Y +95950 CA -8.0 Y +95951 CA -8.0 Y +95953 CA -8.0 Y +95954 CA -8.0 Y +95955 CA -8.0 Y +95956 CA -8.0 Y +95957 CA -8.0 Y +95958 CA -8.0 Y +95959 CA -8.0 Y +95960 CA -8.0 Y +95961 CA -8.0 Y +95962 CA -8.0 Y +95963 CA -8.0 Y +95965 CA -8.0 Y +95966 CA -8.0 Y +95967 CA -8.0 Y +95968 CA -8.0 Y +95969 CA -8.0 Y +95970 CA -8.0 Y +95971 CA -8.0 Y +95972 CA -8.0 Y +95973 CA -8.0 Y +95974 CA -8.0 Y +95975 CA -8.0 Y +95976 CA -8.0 Y +95977 CA -8.0 Y +95978 CA -8.0 Y +95979 CA -8.0 Y +95980 CA -8.0 Y +95981 CA -8.0 Y +95982 CA -8.0 Y +95983 CA -8.0 Y +95984 CA -8.0 Y +95986 CA -8.0 Y +95987 CA -8.0 Y +95988 CA -8.0 Y +95991 CA -8.0 Y +95992 CA -8.0 Y +95993 CA -8.0 Y +96001 CA -8.0 Y +96002 CA -8.0 Y +96003 CA -8.0 Y +96006 CA -8.0 Y +96007 CA -8.0 Y +96008 CA -8.0 Y +96009 CA -8.0 Y +96010 CA -8.0 Y +96011 CA -8.0 Y +96013 CA -8.0 Y +96014 CA -8.0 Y +96015 CA -8.0 Y +96016 CA -8.0 Y +96017 CA -8.0 Y +96019 CA -8.0 Y +96020 CA -8.0 Y +96021 CA -8.0 Y +96022 CA -8.0 Y +96023 CA -8.0 Y +96024 CA -8.0 Y +96025 CA -8.0 Y +96027 CA -8.0 Y +96028 CA -8.0 Y +96029 CA -8.0 Y +96031 CA -8.0 Y +96032 CA -8.0 Y +96033 CA -8.0 Y +96034 CA -8.0 Y +96035 CA -8.0 Y +96037 CA -8.0 Y +96038 CA -8.0 Y +96039 CA -8.0 Y +96040 CA -8.0 Y +96041 CA -8.0 Y +96044 CA -8.0 Y +96046 CA -8.0 Y +96047 CA -8.0 Y +96048 CA -8.0 Y +96049 CA -8.0 Y +96050 CA -8.0 Y +96051 CA -8.0 Y +96052 CA -8.0 Y +96054 CA -8.0 Y +96055 CA -8.0 Y +96056 CA -8.0 Y +96057 CA -8.0 Y +96058 CA -8.0 Y +96059 CA -8.0 Y +96061 CA -8.0 Y +96062 CA -8.0 Y +96063 CA -8.0 Y +96064 CA -8.0 Y +96065 CA -8.0 Y +96067 CA -8.0 Y +96068 CA -8.0 Y +96069 CA -8.0 Y +96070 CA -8.0 Y +96071 CA -8.0 Y +96073 CA -8.0 Y +96074 CA -8.0 Y +96075 CA -8.0 Y +96076 CA -8.0 Y +96078 CA -8.0 Y +96079 CA -8.0 Y +96080 CA -8.0 Y +96084 CA -8.0 Y +96085 CA -8.0 Y +96086 CA -8.0 Y +96087 CA -8.0 Y +96088 CA -8.0 Y +96089 CA -8.0 Y +96090 CA -8.0 Y +96091 CA -8.0 Y +96092 CA -8.0 Y +96093 CA -8.0 Y +96094 CA -8.0 Y +96095 CA -8.0 Y +96096 CA -8.0 Y +96097 CA -8.0 Y +96099 CA -8.0 Y +96101 CA -8.0 Y +96103 CA -8.0 Y +96104 CA -8.0 Y +96105 CA -8.0 Y +96106 CA -8.0 Y +96107 CA -8.0 Y +96108 CA -8.0 Y +96109 CA -8.0 Y +96110 CA -8.0 Y +96111 CA -8.0 Y +96112 CA -8.0 Y +96113 CA -8.0 Y +96114 CA -8.0 Y +96115 CA -8.0 Y +96116 CA -8.0 Y +96117 CA -8.0 Y +96118 CA -8.0 Y +96119 CA -8.0 Y +96120 CA -8.0 Y +96121 CA -8.0 Y +96122 CA -8.0 Y +96123 CA -8.0 Y +96124 CA -8.0 Y +96125 CA -8.0 Y +96126 CA -8.0 Y +96127 CA -8.0 Y +96128 CA -8.0 Y +96129 CA -8.0 Y +96130 CA -8.0 Y +96132 CA -8.0 Y +96133 CA -8.0 Y +96134 CA -8.0 Y +96135 CA -8.0 Y +96136 CA -8.0 Y +96137 CA -8.0 Y +96140 CA -8.0 Y +96141 CA -8.0 Y +96142 CA -8.0 Y +96143 CA -8.0 Y +96145 CA -8.0 Y +96146 CA -8.0 Y +96148 CA -8.0 Y +96150 CA -8.0 Y +96151 CA -8.0 Y +96152 CA -8.0 Y +96154 CA -8.0 Y +96155 CA -8.0 Y +96156 CA -8.0 Y +96157 CA -8.0 Y +96158 CA -8.0 Y +96160 CA -8.0 Y +96161 CA -8.0 Y +96162 CA -8.0 Y +96701 HI -10.0 N +96703 HI -10.0 N +96704 HI -10.0 N +96705 HI -10.0 N +96706 HI -10.0 N +96707 HI -10.0 N +96708 HI -10.0 N +96709 HI -10.0 N +96710 HI -10.0 N +96712 HI -10.0 N +96713 HI -10.0 N +96714 HI -10.0 N +96715 HI -10.0 N +96716 HI -10.0 N +96717 HI -10.0 N +96718 HI -10.0 N +96719 HI -10.0 N +96720 HI -10.0 N +96721 HI -10.0 N +96722 HI -10.0 N +96725 HI -10.0 N +96726 HI -10.0 N +96727 HI -10.0 N +96728 HI -10.0 N +96729 HI -10.0 N +96730 HI -10.0 N +96731 HI -10.0 N +96732 HI -10.0 N +96733 HI -10.0 N +96734 HI -10.0 N +96737 HI -10.0 N +96738 HI -10.0 N +96739 HI -10.0 N +96740 HI -10.0 N +96741 HI -10.0 N +96742 HI -10.0 N +96743 HI -10.0 N +96744 HI -10.0 N +96745 HI -10.0 N +96746 HI -10.0 N +96747 HI -10.0 N +96748 HI -10.0 N +96749 HI -10.0 N +96750 HI -10.0 N +96751 HI -10.0 N +96752 HI -10.0 N +96753 HI -10.0 N +96754 HI -10.0 N +96755 HI -10.0 N +96756 HI -10.0 N +96757 HI -10.0 N +96759 HI -10.0 N +96760 HI -10.0 N +96761 HI -10.0 N +96762 HI -10.0 N +96763 HI -10.0 N +96764 HI -10.0 N +96765 HI -10.0 N +96766 HI -10.0 N +96767 HI -10.0 N +96768 HI -10.0 N +96769 HI -10.0 N +96770 HI -10.0 N +96771 HI -10.0 N +96772 HI -10.0 N +96773 HI -10.0 N +96774 HI -10.0 N +96776 HI -10.0 N +96777 HI -10.0 N +96778 HI -10.0 N +96779 HI -10.0 N +96780 HI -10.0 N +96781 HI -10.0 N +96782 HI -10.0 N +96783 HI -10.0 N +96784 HI -10.0 N +96785 HI -10.0 N +96786 HI -10.0 N +96788 HI -10.0 N +96789 HI -10.0 N +96790 HI -10.0 N +96791 HI -10.0 N +96792 HI -10.0 N +96793 HI -10.0 N +96795 HI -10.0 N +96796 HI -10.0 N +96797 HI -10.0 N +96799 AS -11.0 N +96801 HI -10.0 N +96802 HI -10.0 N +96803 HI -10.0 N +96804 HI -10.0 N +96805 HI -10.0 N +96806 HI -10.0 N +96807 HI -10.0 N +96808 HI -10.0 N +96809 HI -10.0 N +96810 HI -10.0 N +96811 HI -10.0 N +96812 HI -10.0 N +96813 HI -10.0 N +96814 HI -10.0 N +96815 HI -10.0 N +96816 HI -10.0 N +96817 HI -10.0 N +96818 HI -10.0 N +96819 HI -10.0 N +96820 HI -10.0 N +96821 HI -10.0 N +96822 HI -10.0 N +96823 HI -10.0 N +96824 HI -10.0 N +96825 HI -10.0 N +96826 HI -10.0 N +96827 HI -10.0 N +96828 HI -10.0 N +96830 HI -10.0 N +96835 HI -10.0 N +96836 HI -10.0 N +96837 HI -10.0 N +96838 HI -10.0 N +96839 HI -10.0 N +96840 HI -10.0 N +96841 HI -10.0 N +96843 HI -10.0 N +96844 HI -10.0 N +96846 HI -10.0 N +96847 HI -10.0 N +96848 HI -10.0 N +96849 HI -10.0 N +96850 HI -10.0 N +96853 HI -10.0 N +96854 HI -10.0 N +96857 HI -10.0 N +96858 HI -10.0 N +96859 HI -10.0 N +96860 HI -10.0 N +96861 HI -10.0 N +96863 HI -10.0 N +96898 HI -10.0 N +96910 GU 10.0 N +96912 GU 10.0 N +96913 GU 10.0 N +96915 GU 10.0 N +96916 GU 10.0 N +96917 GU 10.0 N +96919 GU 10.0 N +96921 GU 10.0 N +96923 GU 10.0 N +96928 GU 10.0 N +96929 GU 10.0 N +96931 GU 10.0 N +96932 GU 10.0 N +96940 PW 9.0 N +96950 MP 10.0 N +96951 MP 10.0 N +96952 MP 10.0 N +97001 OR -8.0 Y +97002 OR -8.0 Y +97004 OR -8.0 Y +97005 OR -8.0 Y +97006 OR -8.0 Y +97007 OR -8.0 Y +97008 OR -8.0 Y +97009 OR -8.0 Y +97010 OR -8.0 Y +97011 OR -8.0 Y +97013 OR -8.0 Y +97014 OR -8.0 Y +97015 OR -8.0 Y +97016 OR -8.0 Y +97017 OR -8.0 Y +97018 OR -8.0 Y +97019 OR -8.0 Y +97020 OR -8.0 Y +97021 OR -8.0 Y +97022 OR -8.0 Y +97023 OR -8.0 Y +97024 OR -8.0 Y +97026 OR -8.0 Y +97027 OR -8.0 Y +97028 OR -8.0 Y +97029 OR -8.0 Y +97030 OR -8.0 Y +97031 OR -8.0 Y +97032 OR -8.0 Y +97033 OR -8.0 Y +97034 OR -8.0 Y +97035 OR -8.0 Y +97036 OR -8.0 Y +97037 OR -8.0 Y +97038 OR -8.0 Y +97039 OR -8.0 Y +97040 OR -8.0 Y +97041 OR -8.0 Y +97042 OR -8.0 Y +97044 OR -8.0 Y +97045 OR -8.0 Y +97048 OR -8.0 Y +97049 OR -8.0 Y +97050 OR -8.0 Y +97051 OR -8.0 Y +97053 OR -8.0 Y +97054 OR -8.0 Y +97055 OR -8.0 Y +97056 OR -8.0 Y +97057 OR -8.0 Y +97058 OR -8.0 Y +97060 OR -8.0 Y +97062 OR -8.0 Y +97063 OR -8.0 Y +97064 OR -8.0 Y +97065 OR -8.0 Y +97067 OR -8.0 Y +97068 OR -8.0 Y +97070 OR -8.0 Y +97071 OR -8.0 Y +97075 OR -8.0 Y +97076 OR -8.0 Y +97077 OR -8.0 Y +97078 OR -8.0 Y +97080 OR -8.0 Y +97086 OR -8.0 Y +97089 OR -8.0 Y +97101 OR -8.0 Y +97102 OR -8.0 Y +97103 OR -8.0 Y +97106 OR -8.0 Y +97107 OR -8.0 Y +97108 OR -8.0 Y +97109 OR -8.0 Y +97110 OR -8.0 Y +97111 OR -8.0 Y +97112 OR -8.0 Y +97113 OR -8.0 Y +97114 OR -8.0 Y +97115 OR -8.0 Y +97116 OR -8.0 Y +97117 OR -8.0 Y +97118 OR -8.0 Y +97119 OR -8.0 Y +97121 OR -8.0 Y +97122 OR -8.0 Y +97123 OR -8.0 Y +97124 OR -8.0 Y +97125 OR -8.0 Y +97127 OR -8.0 Y +97128 OR -8.0 Y +97130 OR -8.0 Y +97131 OR -8.0 Y +97132 OR -8.0 Y +97133 OR -8.0 Y +97134 OR -8.0 Y +97135 OR -8.0 Y +97136 OR -8.0 Y +97137 OR -8.0 Y +97138 OR -8.0 Y +97140 OR -8.0 Y +97141 OR -8.0 Y +97143 OR -8.0 Y +97144 OR -8.0 Y +97145 OR -8.0 Y +97146 OR -8.0 Y +97147 OR -8.0 Y +97148 OR -8.0 Y +97149 OR -8.0 Y +97201 OR -8.0 Y +97202 OR -8.0 Y +97203 OR -8.0 Y +97204 OR -8.0 Y +97205 OR -8.0 Y +97206 OR -8.0 Y +97207 OR -8.0 Y +97208 OR -8.0 Y +97209 OR -8.0 Y +97210 OR -8.0 Y +97211 OR -8.0 Y +97212 OR -8.0 Y +97213 OR -8.0 Y +97214 OR -8.0 Y +97215 OR -8.0 Y +97216 OR -8.0 Y +97217 OR -8.0 Y +97218 OR -8.0 Y +97219 OR -8.0 Y +97220 OR -8.0 Y +97221 OR -8.0 Y +97222 OR -8.0 Y +97223 OR -8.0 Y +97224 OR -8.0 Y +97225 OR -8.0 Y +97227 OR -8.0 Y +97228 OR -8.0 Y +97229 OR -8.0 Y +97230 OR -8.0 Y +97231 OR -8.0 Y +97232 OR -8.0 Y +97233 OR -8.0 Y +97236 OR -8.0 Y +97238 OR -8.0 Y +97239 OR -8.0 Y +97240 OR -8.0 Y +97242 OR -8.0 Y +97251 OR -8.0 Y +97253 OR -8.0 Y +97254 OR -8.0 Y +97255 OR -8.0 Y +97256 OR -8.0 Y +97258 OR -8.0 Y +97259 OR -8.0 Y +97266 OR -8.0 Y +97267 OR -8.0 Y +97268 OR -8.0 Y +97269 OR -8.0 Y +97271 OR -8.0 Y +97272 OR -8.0 Y +97280 OR -8.0 Y +97281 OR -8.0 Y +97282 OR -8.0 Y +97283 OR -8.0 Y +97286 OR -8.0 Y +97290 OR -8.0 Y +97291 OR -8.0 Y +97292 OR -8.0 Y +97293 OR -8.0 Y +97294 OR -8.0 Y +97296 OR -8.0 Y +97298 OR -8.0 Y +97299 OR -8.0 Y +97301 OR -8.0 Y +97302 OR -8.0 Y +97303 OR -8.0 Y +97304 OR -8.0 Y +97305 OR -8.0 Y +97306 OR -8.0 Y +97307 OR -8.0 Y +97308 OR -8.0 Y +97309 OR -8.0 Y +97310 OR -8.0 Y +97311 OR -8.0 Y +97312 OR -8.0 Y +97313 OR -8.0 Y +97314 OR -8.0 Y +97317 OR -8.0 Y +97321 OR -8.0 Y +97322 OR -8.0 Y +97324 OR -8.0 Y +97325 OR -8.0 Y +97326 OR -8.0 Y +97327 OR -8.0 Y +97329 OR -8.0 Y +97330 OR -8.0 Y +97331 OR -8.0 Y +97333 OR -8.0 Y +97335 OR -8.0 Y +97336 OR -8.0 Y +97338 OR -8.0 Y +97339 OR -8.0 Y +97341 OR -8.0 Y +97342 OR -8.0 Y +97343 OR -8.0 Y +97344 OR -8.0 Y +97345 OR -8.0 Y +97346 OR -8.0 Y +97347 OR -8.0 Y +97348 OR -8.0 Y +97350 OR -8.0 Y +97351 OR -8.0 Y +97352 OR -8.0 Y +97355 OR -8.0 Y +97357 OR -8.0 Y +97358 OR -8.0 Y +97360 OR -8.0 Y +97361 OR -8.0 Y +97362 OR -8.0 Y +97364 OR -8.0 Y +97365 OR -8.0 Y +97366 OR -8.0 Y +97367 OR -8.0 Y +97368 OR -8.0 Y +97369 OR -8.0 Y +97370 OR -8.0 Y +97371 OR -8.0 Y +97372 OR -8.0 Y +97373 OR -8.0 Y +97374 OR -8.0 Y +97375 OR -8.0 Y +97376 OR -8.0 Y +97377 OR -8.0 Y +97378 OR -8.0 Y +97380 OR -8.0 Y +97381 OR -8.0 Y +97383 OR -8.0 Y +97384 OR -8.0 Y +97385 OR -8.0 Y +97386 OR -8.0 Y +97388 OR -8.0 Y +97389 OR -8.0 Y +97390 OR -8.0 Y +97391 OR -8.0 Y +97392 OR -8.0 Y +97394 OR -8.0 Y +97396 OR -8.0 Y +97401 OR -8.0 Y +97402 OR -8.0 Y +97403 OR -8.0 Y +97404 OR -8.0 Y +97405 OR -8.0 Y +97406 OR -8.0 Y +97407 OR -8.0 Y +97408 OR -8.0 Y +97409 OR -8.0 Y +97410 OR -8.0 Y +97411 OR -8.0 Y +97412 OR -8.0 Y +97413 OR -8.0 Y +97414 OR -8.0 Y +97415 OR -8.0 Y +97416 OR -8.0 Y +97417 OR -8.0 Y +97419 OR -8.0 Y +97420 OR -8.0 Y +97423 OR -8.0 Y +97424 OR -8.0 Y +97425 OR -8.0 Y +97426 OR -8.0 Y +97427 OR -8.0 Y +97428 OR -8.0 Y +97429 OR -8.0 Y +97430 OR -8.0 Y +97431 OR -8.0 Y +97432 OR -8.0 Y +97434 OR -8.0 Y +97435 OR -8.0 Y +97436 OR -8.0 Y +97437 OR -8.0 Y +97438 OR -8.0 Y +97439 OR -8.0 Y +97440 OR -8.0 Y +97441 OR -8.0 Y +97442 OR -8.0 Y +97443 OR -8.0 Y +97444 OR -8.0 Y +97446 OR -8.0 Y +97447 OR -8.0 Y +97448 OR -8.0 Y +97449 OR -8.0 Y +97450 OR -8.0 Y +97451 OR -8.0 Y +97452 OR -8.0 Y +97453 OR -8.0 Y +97454 OR -8.0 Y +97455 OR -8.0 Y +97456 OR -8.0 Y +97457 OR -8.0 Y +97458 OR -8.0 Y +97459 OR -8.0 Y +97461 OR -8.0 Y +97462 OR -8.0 Y +97463 OR -8.0 Y +97464 OR -8.0 Y +97465 OR -8.0 Y +97466 OR -8.0 Y +97467 OR -8.0 Y +97469 OR -8.0 Y +97470 OR -8.0 Y +97472 OR -8.0 Y +97473 OR -8.0 Y +97476 OR -8.0 Y +97477 OR -8.0 Y +97478 OR -8.0 Y +97479 OR -8.0 Y +97480 OR -8.0 Y +97481 OR -8.0 Y +97482 OR -8.0 Y +97484 OR -8.0 Y +97486 OR -8.0 Y +97487 OR -8.0 Y +97488 OR -8.0 Y +97489 OR -8.0 Y +97490 OR -8.0 Y +97491 OR -8.0 Y +97492 OR -8.0 Y +97493 OR -8.0 Y +97494 OR -8.0 Y +97495 OR -8.0 Y +97496 OR -8.0 Y +97497 OR -8.0 Y +97498 OR -8.0 Y +97499 OR -8.0 Y +97501 OR -8.0 Y +97502 OR -8.0 Y +97503 OR -8.0 Y +97504 OR -8.0 Y +97520 OR -8.0 Y +97522 OR -8.0 Y +97523 OR -8.0 Y +97524 OR -8.0 Y +97525 OR -8.0 Y +97526 OR -8.0 Y +97527 OR -8.0 Y +97528 OR -8.0 Y +97530 OR -8.0 Y +97531 OR -8.0 Y +97532 OR -8.0 Y +97533 OR -8.0 Y +97534 OR -8.0 Y +97535 OR -8.0 Y +97536 OR -8.0 Y +97537 OR -8.0 Y +97538 OR -8.0 Y +97539 OR -8.0 Y +97540 OR -8.0 Y +97541 OR -8.0 Y +97543 OR -8.0 Y +97544 OR -8.0 Y +97601 OR -8.0 Y +97602 OR -8.0 Y +97603 OR -8.0 Y +97604 OR -8.0 Y +97620 OR -8.0 Y +97621 OR -8.0 Y +97622 OR -8.0 Y +97623 OR -8.0 Y +97624 OR -8.0 Y +97625 OR -8.0 Y +97626 OR -8.0 Y +97627 OR -8.0 Y +97630 OR -8.0 Y +97632 OR -8.0 Y +97633 OR -8.0 Y +97634 OR -8.0 Y +97635 OR -8.0 Y +97636 OR -8.0 Y +97637 OR -8.0 Y +97638 OR -8.0 Y +97639 OR -8.0 Y +97640 OR -8.0 Y +97641 OR -8.0 Y +97701 OR -8.0 Y +97702 OR -8.0 Y +97707 OR -8.0 Y +97708 OR -8.0 Y +97709 OR -8.0 Y +97710 OR -8.0 Y +97711 OR -8.0 Y +97712 OR -8.0 Y +97720 OR -8.0 Y +97721 OR -8.0 Y +97722 OR -8.0 Y +97730 OR -8.0 Y +97731 OR -8.0 Y +97732 OR -8.0 Y +97733 OR -8.0 Y +97734 OR -8.0 Y +97735 OR -8.0 Y +97736 OR -8.0 Y +97737 OR -8.0 Y +97738 OR -8.0 Y +97739 OR -8.0 Y +97741 OR -8.0 Y +97750 OR -8.0 Y +97751 OR -8.0 Y +97752 OR -8.0 Y +97753 OR -8.0 Y +97754 OR -8.0 Y +97756 OR -8.0 Y +97758 OR -8.0 Y +97759 OR -8.0 Y +97760 OR -8.0 Y +97761 OR -8.0 Y +97801 OR -8.0 Y +97810 OR -8.0 Y +97812 OR -8.0 Y +97813 OR -8.0 Y +97814 OR -8.0 Y +97817 OR -8.0 Y +97818 OR -8.0 Y +97819 OR -8.0 Y +97820 OR -8.0 Y +97823 OR -8.0 Y +97824 OR -8.0 Y +97825 OR -8.0 Y +97826 OR -8.0 Y +97827 OR -8.0 Y +97828 OR -8.0 Y +97830 OR -8.0 Y +97833 OR -8.0 Y +97834 OR -8.0 Y +97835 OR -8.0 Y +97836 OR -8.0 Y +97837 OR -8.0 Y +97838 OR -8.0 Y +97839 OR -8.0 Y +97840 OR -8.0 Y +97841 OR -8.0 Y +97842 OR -8.0 Y +97843 OR -8.0 Y +97844 OR -8.0 Y +97845 OR -8.0 Y +97846 OR -8.0 Y +97848 OR -8.0 Y +97850 OR -8.0 Y +97856 OR -8.0 Y +97857 OR -8.0 Y +97859 OR -8.0 Y +97861 OR -8.0 Y +97862 OR -8.0 Y +97864 OR -8.0 Y +97865 OR -8.0 Y +97867 OR -8.0 Y +97868 OR -8.0 Y +97869 OR -8.0 Y +97870 OR -8.0 Y +97873 OR -8.0 Y +97874 OR -8.0 Y +97875 OR -8.0 Y +97876 OR -8.0 Y +97877 OR -8.0 Y +97880 OR -8.0 Y +97882 OR -8.0 Y +97883 OR -8.0 Y +97884 OR -8.0 Y +97885 OR -8.0 Y +97886 OR -8.0 Y +97901 OR -7.0 Y +97902 OR -7.0 Y +97903 OR -7.0 Y +97904 OR -8.0 Y +97905 OR -8.0 Y +97906 OR -7.0 Y +97907 OR -8.0 Y +97908 OR -7.0 Y +97909 OR -7.0 Y +97910 OR -7.0 Y +97911 OR -7.0 Y +97913 OR -7.0 Y +97914 OR -7.0 Y +97917 OR -7.0 Y +97918 OR -7.0 Y +97920 OR -7.0 Y +98001 WA -8.0 Y +98002 WA -8.0 Y +98003 WA -8.0 Y +98004 WA -8.0 Y +98005 WA -8.0 Y +98006 WA -8.0 Y +98007 WA -8.0 Y +98008 WA -8.0 Y +98009 WA -8.0 Y +98010 WA -8.0 Y +98011 WA -8.0 Y +98012 WA -8.0 Y +98013 WA -8.0 Y +98014 WA -8.0 Y +98015 WA -8.0 Y +98019 WA -8.0 Y +98020 WA -8.0 Y +98021 WA -8.0 Y +98022 WA -8.0 Y +98023 WA -8.0 Y +98024 WA -8.0 Y +98025 WA -8.0 Y +98026 WA -8.0 Y +98027 WA -8.0 Y +98028 WA -8.0 Y +98029 WA -8.0 Y +98030 WA -8.0 Y +98031 WA -8.0 Y +98032 WA -8.0 Y +98033 WA -8.0 Y +98034 WA -8.0 Y +98035 WA -8.0 Y +98036 WA -8.0 Y +98037 WA -8.0 Y +98038 WA -8.0 Y +98039 WA -8.0 Y +98040 WA -8.0 Y +98041 WA -8.0 Y +98042 WA -8.0 Y +98043 WA -8.0 Y +98045 WA -8.0 Y +98046 WA -8.0 Y +98047 WA -8.0 Y +98050 WA -8.0 Y +98051 WA -8.0 Y +98052 WA -8.0 Y +98053 WA -8.0 Y +98054 WA -8.0 Y +98055 WA -8.0 Y +98056 WA -8.0 Y +98057 WA -8.0 Y +98058 WA -8.0 Y +98059 WA -8.0 Y +98061 WA -8.0 Y +98062 WA -8.0 Y +98063 WA -8.0 Y +98064 WA -8.0 Y +98065 WA -8.0 Y +98068 WA -8.0 Y +98070 WA -8.0 Y +98071 WA -8.0 Y +98072 WA -8.0 Y +98073 WA -8.0 Y +98074 WA -8.0 Y +98075 WA -8.0 Y +98077 WA -8.0 Y +98082 WA -8.0 Y +98083 WA -8.0 Y +98087 WA -8.0 Y +98089 WA -8.0 Y +98092 WA -8.0 Y +98093 WA -8.0 Y +98101 WA -8.0 Y +98102 WA -8.0 Y +98103 WA -8.0 Y +98104 WA -8.0 Y +98105 WA -8.0 Y +98106 WA -8.0 Y +98107 WA -8.0 Y +98108 WA -8.0 Y +98109 WA -8.0 Y +98110 WA -8.0 Y +98111 WA -8.0 Y +98112 WA -8.0 Y +98113 WA -8.0 Y +98114 WA -8.0 Y +98115 WA -8.0 Y +98116 WA -8.0 Y +98117 WA -8.0 Y +98118 WA -8.0 Y +98119 WA -8.0 Y +98121 WA -8.0 Y +98122 WA -8.0 Y +98124 WA -8.0 Y +98125 WA -8.0 Y +98126 WA -8.0 Y +98127 WA -8.0 Y +98129 WA -8.0 Y +98131 WA -8.0 Y +98132 WA -8.0 Y +98133 WA -8.0 Y +98134 WA -8.0 Y +98136 WA -8.0 Y +98138 WA -8.0 Y +98139 WA -8.0 Y +98141 WA -8.0 Y +98144 WA -8.0 Y +98145 WA -8.0 Y +98146 WA -8.0 Y +98148 WA -8.0 Y +98151 WA -8.0 Y +98154 WA -8.0 Y +98155 WA -8.0 Y +98158 WA -8.0 Y +98160 WA -8.0 Y +98161 WA -8.0 Y +98164 WA -8.0 Y +98165 WA -8.0 Y +98166 WA -8.0 Y +98168 WA -8.0 Y +98170 WA -8.0 Y +98171 WA -8.0 Y +98174 WA -8.0 Y +98175 WA -8.0 Y +98177 WA -8.0 Y +98178 WA -8.0 Y +98181 WA -8.0 Y +98184 WA -8.0 Y +98185 WA -8.0 Y +98188 WA -8.0 Y +98190 WA -8.0 Y +98191 WA -8.0 Y +98194 WA -8.0 Y +98195 WA -8.0 Y +98198 WA -8.0 Y +98199 WA -8.0 Y +98201 WA -8.0 Y +98203 WA -8.0 Y +98204 WA -8.0 Y +98205 WA -8.0 Y +98206 WA -8.0 Y +98207 WA -8.0 Y +98208 WA -8.0 Y +98213 WA -8.0 Y +98220 WA -8.0 Y +98221 WA -8.0 Y +98222 WA -8.0 Y +98223 WA -8.0 Y +98224 WA -8.0 Y +98225 WA -8.0 Y +98226 WA -8.0 Y +98227 WA -8.0 Y +98228 WA -8.0 Y +98229 WA -8.0 Y +98230 WA -8.0 Y +98231 WA -8.0 Y +98232 WA -8.0 Y +98233 WA -8.0 Y +98235 WA -8.0 Y +98236 WA -8.0 Y +98237 WA -8.0 Y +98238 WA -8.0 Y +98239 WA -8.0 Y +98240 WA -8.0 Y +98241 WA -8.0 Y +98243 WA -8.0 Y +98244 WA -8.0 Y +98245 WA -8.0 Y +98247 WA -8.0 Y +98248 WA -8.0 Y +98249 WA -8.0 Y +98250 WA -8.0 Y +98251 WA -8.0 Y +98252 WA -8.0 Y +98253 WA -8.0 Y +98255 WA -8.0 Y +98256 WA -8.0 Y +98257 WA -8.0 Y +98258 WA -8.0 Y +98259 WA -8.0 Y +98260 WA -8.0 Y +98261 WA -8.0 Y +98262 WA -8.0 Y +98263 WA -8.0 Y +98264 WA -8.0 Y +98266 WA -8.0 Y +98267 WA -8.0 Y +98270 WA -8.0 Y +98271 WA -8.0 Y +98272 WA -8.0 Y +98273 WA -8.0 Y +98274 WA -8.0 Y +98275 WA -8.0 Y +98276 WA -8.0 Y +98277 WA -8.0 Y +98278 WA -8.0 Y +98279 WA -8.0 Y +98280 WA -8.0 Y +98281 WA -8.0 Y +98282 WA -8.0 Y +98283 WA -8.0 Y +98284 WA -8.0 Y +98286 WA -8.0 Y +98287 WA -8.0 Y +98288 WA -8.0 Y +98290 WA -8.0 Y +98291 WA -8.0 Y +98292 WA -8.0 Y +98293 WA -8.0 Y +98294 WA -8.0 Y +98295 WA -8.0 Y +98296 WA -8.0 Y +98297 WA -8.0 Y +98303 WA -8.0 Y +98304 WA -8.0 Y +98305 WA -8.0 Y +98310 WA -8.0 Y +98311 WA -8.0 Y +98312 WA -8.0 Y +98314 WA -8.0 Y +98315 WA -8.0 Y +98320 WA -8.0 Y +98321 WA -8.0 Y +98322 WA -8.0 Y +98323 WA -8.0 Y +98324 WA -8.0 Y +98325 WA -8.0 Y +98326 WA -8.0 Y +98327 WA -8.0 Y +98328 WA -8.0 Y +98329 WA -8.0 Y +98330 WA -8.0 Y +98331 WA -8.0 Y +98332 WA -8.0 Y +98333 WA -8.0 Y +98335 WA -8.0 Y +98336 WA -8.0 Y +98337 WA -8.0 Y +98338 WA -8.0 Y +98339 WA -8.0 Y +98340 WA -8.0 Y +98342 WA -8.0 Y +98343 WA -8.0 Y +98344 WA -8.0 Y +98345 WA -8.0 Y +98346 WA -8.0 Y +98348 WA -8.0 Y +98349 WA -8.0 Y +98350 WA -8.0 Y +98351 WA -8.0 Y +98352 WA -8.0 Y +98353 WA -8.0 Y +98354 WA -8.0 Y +98355 WA -8.0 Y +98356 WA -8.0 Y +98357 WA -8.0 Y +98358 WA -8.0 Y +98359 WA -8.0 Y +98360 WA -8.0 Y +98361 WA -8.0 Y +98362 WA -8.0 Y +98363 WA -8.0 Y +98364 WA -8.0 Y +98365 WA -8.0 Y +98366 WA -8.0 Y +98367 WA -8.0 Y +98368 WA -8.0 Y +98370 WA -8.0 Y +98371 WA -8.0 Y +98372 WA -8.0 Y +98373 WA -8.0 Y +98374 WA -8.0 Y +98375 WA -8.0 Y +98376 WA -8.0 Y +98377 WA -8.0 Y +98378 WA -8.0 Y +98380 WA -8.0 Y +98381 WA -8.0 Y +98382 WA -8.0 Y +98383 WA -8.0 Y +98384 WA -8.0 Y +98385 WA -8.0 Y +98386 WA -8.0 Y +98387 WA -8.0 Y +98388 WA -8.0 Y +98390 WA -8.0 Y +98391 WA -8.0 Y +98392 WA -8.0 Y +98393 WA -8.0 Y +98394 WA -8.0 Y +98395 WA -8.0 Y +98396 WA -8.0 Y +98397 WA -8.0 Y +98398 WA -8.0 Y +98401 WA -8.0 Y +98402 WA -8.0 Y +98403 WA -8.0 Y +98404 WA -8.0 Y +98405 WA -8.0 Y +98406 WA -8.0 Y +98407 WA -8.0 Y +98408 WA -8.0 Y +98409 WA -8.0 Y +98411 WA -8.0 Y +98412 WA -8.0 Y +98413 WA -8.0 Y +98415 WA -8.0 Y +98416 WA -8.0 Y +98417 WA -8.0 Y +98418 WA -8.0 Y +98419 WA -8.0 Y +98421 WA -8.0 Y +98422 WA -8.0 Y +98424 WA -8.0 Y +98430 WA -8.0 Y +98431 WA -8.0 Y +98433 WA -8.0 Y +98438 WA -8.0 Y +98439 WA -8.0 Y +98442 WA -8.0 Y +98443 WA -8.0 Y +98444 WA -8.0 Y +98445 WA -8.0 Y +98446 WA -8.0 Y +98447 WA -8.0 Y +98448 WA -8.0 Y +98450 WA -8.0 Y +98455 WA -8.0 Y +98460 WA -8.0 Y +98464 WA -8.0 Y +98465 WA -8.0 Y +98466 WA -8.0 Y +98467 WA -8.0 Y +98471 WA -8.0 Y +98477 WA -8.0 Y +98481 WA -8.0 Y +98490 WA -8.0 Y +98492 WA -8.0 Y +98493 WA -8.0 Y +98496 WA -8.0 Y +98497 WA -8.0 Y +98498 WA -8.0 Y +98499 WA -8.0 Y +98501 WA -8.0 Y +98502 WA -8.0 Y +98503 WA -8.0 Y +98504 WA -8.0 Y +98505 WA -8.0 Y +98506 WA -8.0 Y +98507 WA -8.0 Y +98508 WA -8.0 Y +98509 WA -8.0 Y +98511 WA -8.0 Y +98512 WA -8.0 Y +98513 WA -8.0 Y +98516 WA -8.0 Y +98520 WA -8.0 Y +98522 WA -8.0 Y +98524 WA -8.0 Y +98526 WA -8.0 Y +98527 WA -8.0 Y +98528 WA -8.0 Y +98530 WA -8.0 Y +98531 WA -8.0 Y +98532 WA -8.0 Y +98533 WA -8.0 Y +98535 WA -8.0 Y +98536 WA -8.0 Y +98537 WA -8.0 Y +98538 WA -8.0 Y +98539 WA -8.0 Y +98540 WA -8.0 Y +98541 WA -8.0 Y +98542 WA -8.0 Y +98544 WA -8.0 Y +98546 WA -8.0 Y +98547 WA -8.0 Y +98548 WA -8.0 Y +98550 WA -8.0 Y +98552 WA -8.0 Y +98554 WA -8.0 Y +98555 WA -8.0 Y +98556 WA -8.0 Y +98557 WA -8.0 Y +98558 WA -8.0 Y +98559 WA -8.0 Y +98560 WA -8.0 Y +98561 WA -8.0 Y +98562 WA -8.0 Y +98563 WA -8.0 Y +98564 WA -8.0 Y +98565 WA -8.0 Y +98566 WA -8.0 Y +98568 WA -8.0 Y +98569 WA -8.0 Y +98570 WA -8.0 Y +98571 WA -8.0 Y +98572 WA -8.0 Y +98575 WA -8.0 Y +98576 WA -8.0 Y +98577 WA -8.0 Y +98579 WA -8.0 Y +98580 WA -8.0 Y +98581 WA -8.0 Y +98582 WA -8.0 Y +98583 WA -8.0 Y +98584 WA -8.0 Y +98585 WA -8.0 Y +98586 WA -8.0 Y +98587 WA -8.0 Y +98588 WA -8.0 Y +98589 WA -8.0 Y +98590 WA -8.0 Y +98591 WA -8.0 Y +98592 WA -8.0 Y +98593 WA -8.0 Y +98595 WA -8.0 Y +98596 WA -8.0 Y +98597 WA -8.0 Y +98599 WA -8.0 Y +98601 WA -8.0 Y +98602 WA -8.0 Y +98603 WA -8.0 Y +98604 WA -8.0 Y +98605 WA -8.0 Y +98606 WA -8.0 Y +98607 WA -8.0 Y +98609 WA -8.0 Y +98610 WA -8.0 Y +98611 WA -8.0 Y +98612 WA -8.0 Y +98613 WA -8.0 Y +98614 WA -8.0 Y +98616 WA -8.0 Y +98617 WA -8.0 Y +98619 WA -8.0 Y +98620 WA -8.0 Y +98621 WA -8.0 Y +98622 WA -8.0 Y +98623 WA -8.0 Y +98624 WA -8.0 Y +98625 WA -8.0 Y +98626 WA -8.0 Y +98628 WA -8.0 Y +98629 WA -8.0 Y +98631 WA -8.0 Y +98632 WA -8.0 Y +98635 WA -8.0 Y +98637 WA -8.0 Y +98638 WA -8.0 Y +98639 WA -8.0 Y +98640 WA -8.0 Y +98641 WA -8.0 Y +98642 WA -8.0 Y +98643 WA -8.0 Y +98644 WA -8.0 Y +98645 WA -8.0 Y +98647 WA -8.0 Y +98648 WA -8.0 Y +98649 WA -8.0 Y +98650 WA -8.0 Y +98651 WA -8.0 Y +98660 WA -8.0 Y +98661 WA -8.0 Y +98662 WA -8.0 Y +98663 WA -8.0 Y +98664 WA -8.0 Y +98665 WA -8.0 Y +98666 WA -8.0 Y +98667 WA -8.0 Y +98668 WA -8.0 Y +98670 WA -8.0 Y +98671 WA -8.0 Y +98672 WA -8.0 Y +98673 WA -8.0 Y +98674 WA -8.0 Y +98675 WA -8.0 Y +98682 WA -8.0 Y +98683 WA -8.0 Y +98684 WA -8.0 Y +98685 WA -8.0 Y +98686 WA -8.0 Y +98687 WA -8.0 Y +98801 WA -8.0 Y +98802 WA -8.0 Y +98807 WA -8.0 Y +98811 WA -8.0 Y +98812 WA -8.0 Y +98813 WA -8.0 Y +98814 WA -8.0 Y +98815 WA -8.0 Y +98816 WA -8.0 Y +98817 WA -8.0 Y +98819 WA -8.0 Y +98821 WA -8.0 Y +98822 WA -8.0 Y +98823 WA -8.0 Y +98824 WA -8.0 Y +98826 WA -8.0 Y +98827 WA -8.0 Y +98828 WA -8.0 Y +98829 WA -8.0 Y +98830 WA -8.0 Y +98831 WA -8.0 Y +98832 WA -8.0 Y +98833 WA -8.0 Y +98834 WA -8.0 Y +98836 WA -8.0 Y +98837 WA -8.0 Y +98840 WA -8.0 Y +98841 WA -8.0 Y +98843 WA -8.0 Y +98844 WA -8.0 Y +98845 WA -8.0 Y +98846 WA -8.0 Y +98847 WA -8.0 Y +98848 WA -8.0 Y +98849 WA -8.0 Y +98850 WA -8.0 Y +98851 WA -8.0 Y +98852 WA -8.0 Y +98853 WA -8.0 Y +98855 WA -8.0 Y +98856 WA -8.0 Y +98857 WA -8.0 Y +98858 WA -8.0 Y +98859 WA -8.0 Y +98860 WA -8.0 Y +98862 WA -8.0 Y +98901 WA -8.0 Y +98902 WA -8.0 Y +98903 WA -8.0 Y +98904 WA -8.0 Y +98907 WA -8.0 Y +98908 WA -8.0 Y +98909 WA -8.0 Y +98920 WA -8.0 Y +98921 WA -8.0 Y +98922 WA -8.0 Y +98923 WA -8.0 Y +98925 WA -8.0 Y +98926 WA -8.0 Y +98929 WA -8.0 Y +98930 WA -8.0 Y +98932 WA -8.0 Y +98933 WA -8.0 Y +98934 WA -8.0 Y +98935 WA -8.0 Y +98936 WA -8.0 Y +98937 WA -8.0 Y +98938 WA -8.0 Y +98939 WA -8.0 Y +98940 WA -8.0 Y +98941 WA -8.0 Y +98942 WA -8.0 Y +98943 WA -8.0 Y +98944 WA -8.0 Y +98946 WA -8.0 Y +98947 WA -8.0 Y +98948 WA -8.0 Y +98950 WA -8.0 Y +98951 WA -8.0 Y +98952 WA -8.0 Y +98953 WA -8.0 Y +99001 WA -8.0 Y +99003 WA -8.0 Y +99004 WA -8.0 Y +99005 WA -8.0 Y +99006 WA -8.0 Y +99008 WA -8.0 Y +99009 WA -8.0 Y +99011 WA -8.0 Y +99012 WA -8.0 Y +99013 WA -8.0 Y +99014 WA -8.0 Y +99016 WA -8.0 Y +99017 WA -8.0 Y +99018 WA -8.0 Y +99019 WA -8.0 Y +99020 WA -8.0 Y +99021 WA -8.0 Y +99022 WA -8.0 Y +99023 WA -8.0 Y +99025 WA -8.0 Y +99026 WA -8.0 Y +99027 WA -8.0 Y +99029 WA -8.0 Y +99030 WA -8.0 Y +99031 WA -8.0 Y +99032 WA -8.0 Y +99033 WA -8.0 Y +99034 WA -8.0 Y +99036 WA -8.0 Y +99037 WA -8.0 Y +99039 WA -8.0 Y +99040 WA -8.0 Y +99101 WA -8.0 Y +99102 WA -8.0 Y +99103 WA -8.0 Y +99104 WA -8.0 Y +99105 WA -8.0 Y +99107 WA -8.0 Y +99109 WA -8.0 Y +99110 WA -8.0 Y +99111 WA -8.0 Y +99113 WA -8.0 Y +99114 WA -8.0 Y +99115 WA -8.0 Y +99116 WA -8.0 Y +99117 WA -8.0 Y +99118 WA -8.0 Y +99119 WA -8.0 Y +99121 WA -8.0 Y +99122 WA -8.0 Y +99123 WA -8.0 Y +99124 WA -8.0 Y +99125 WA -8.0 Y +99126 WA -8.0 Y +99128 WA -8.0 Y +99129 WA -8.0 Y +99130 WA -8.0 Y +99131 WA -8.0 Y +99133 WA -8.0 Y +99134 WA -8.0 Y +99135 WA -8.0 Y +99136 WA -8.0 Y +99137 WA -8.0 Y +99138 WA -8.0 Y +99139 WA -8.0 Y +99140 WA -8.0 Y +99141 WA -8.0 Y +99143 WA -8.0 Y +99144 WA -8.0 Y +99146 WA -8.0 Y +99147 WA -8.0 Y +99148 WA -8.0 Y +99149 WA -8.0 Y +99150 WA -8.0 Y +99151 WA -8.0 Y +99152 WA -8.0 Y +99153 WA -8.0 Y +99154 WA -8.0 Y +99155 WA -8.0 Y +99156 WA -8.0 Y +99157 WA -8.0 Y +99158 WA -8.0 Y +99159 WA -8.0 Y +99160 WA -8.0 Y +99161 WA -8.0 Y +99163 WA -8.0 Y +99164 WA -8.0 Y +99165 WA -8.0 Y +99166 WA -8.0 Y +99167 WA -8.0 Y +99169 WA -8.0 Y +99170 WA -8.0 Y +99171 WA -8.0 Y +99173 WA -8.0 Y +99174 WA -8.0 Y +99176 WA -8.0 Y +99179 WA -8.0 Y +99180 WA -8.0 Y +99181 WA -8.0 Y +99185 WA -8.0 Y +99201 WA -8.0 Y +99202 WA -8.0 Y +99203 WA -8.0 Y +99204 WA -8.0 Y +99205 WA -8.0 Y +99206 WA -8.0 Y +99207 WA -8.0 Y +99208 WA -8.0 Y +99209 WA -8.0 Y +99210 WA -8.0 Y +99211 WA -8.0 Y +99212 WA -8.0 Y +99213 WA -8.0 Y +99214 WA -8.0 Y +99215 WA -8.0 Y +99216 WA -8.0 Y +99217 WA -8.0 Y +99218 WA -8.0 Y +99219 WA -8.0 Y +99220 WA -8.0 Y +99223 WA -8.0 Y +99224 WA -8.0 Y +99228 WA -8.0 Y +99251 WA -8.0 Y +99252 WA -8.0 Y +99256 WA -8.0 Y +99258 WA -8.0 Y +99260 WA -8.0 Y +99299 WA -8.0 Y +99301 WA -8.0 Y +99302 WA -8.0 Y +99320 WA -8.0 Y +99321 WA -8.0 Y +99322 WA -8.0 Y +99323 WA -8.0 Y +99324 WA -8.0 Y +99326 WA -8.0 Y +99328 WA -8.0 Y +99329 WA -8.0 Y +99330 WA -8.0 Y +99333 WA -8.0 Y +99335 WA -8.0 Y +99336 WA -8.0 Y +99337 WA -8.0 Y +99338 WA -8.0 Y +99341 WA -8.0 Y +99343 WA -8.0 Y +99344 WA -8.0 Y +99345 WA -8.0 Y +99346 WA -8.0 Y +99347 WA -8.0 Y +99348 WA -8.0 Y +99349 WA -8.0 Y +99350 WA -8.0 Y +99352 WA -8.0 Y +99353 WA -8.0 Y +99354 WA -8.0 Y +99356 WA -8.0 Y +99357 WA -8.0 Y +99359 WA -8.0 Y +99360 WA -8.0 Y +99361 WA -8.0 Y +99362 WA -8.0 Y +99363 WA -8.0 Y +99371 WA -8.0 Y +99401 WA -8.0 Y +99402 WA -8.0 Y +99403 WA -8.0 Y +99501 AK -9.0 Y +99502 AK -9.0 Y +99503 AK -9.0 Y +99504 AK -9.0 Y +99505 AK -9.0 Y +99506 AK -9.0 Y +99507 AK -9.0 Y +99508 AK -9.0 Y +99509 AK -9.0 Y +99510 AK -9.0 Y +99511 AK -9.0 Y +99513 AK -9.0 Y +99514 AK -9.0 Y +99515 AK -9.0 Y +99516 AK -9.0 Y +99517 AK -9.0 Y +99518 AK -9.0 Y +99519 AK -9.0 Y +99520 AK -9.0 Y +99521 AK -9.0 Y +99522 AK -9.0 Y +99523 AK -9.0 Y +99524 AK -9.0 Y +99529 AK -9.0 Y +99530 AK -9.0 Y +99540 AK -9.0 Y +99545 AK -9.0 Y +99546 AK -10.0 Y +99547 AK -10.0 Y +99548 AK -9.0 Y +99549 AK -9.0 Y +99550 AK -9.0 Y +99551 AK -9.0 Y +99552 AK -9.0 Y +99553 AK -9.0 Y +99554 AK -9.0 Y +99555 AK -9.0 Y +99556 AK -9.0 Y +99557 AK -9.0 Y +99558 AK -9.0 Y +99559 AK -9.0 Y +99561 AK -9.0 Y +99563 AK -9.0 Y +99564 AK -9.0 Y +99565 AK -9.0 Y +99566 AK -9.0 Y +99567 AK -9.0 Y +99568 AK -9.0 Y +99569 AK -9.0 Y +99571 AK -9.0 Y +99572 AK -9.0 Y +99573 AK -9.0 Y +99574 AK -9.0 Y +99575 AK -9.0 Y +99576 AK -9.0 Y +99577 AK -9.0 Y +99578 AK -9.0 Y +99579 AK -9.0 Y +99580 AK -9.0 Y +99581 AK -9.0 Y +99583 AK -9.0 Y +99585 AK -9.0 Y +99586 AK -9.0 Y +99587 AK -9.0 Y +99588 AK -9.0 Y +99589 AK -9.0 Y +99590 AK -9.0 Y +99591 AK -10.0 Y +99599 AK -9.0 Y +99602 AK -9.0 Y +99603 AK -9.0 Y +99604 AK -9.0 Y +99605 AK -9.0 Y +99606 AK -9.0 Y +99607 AK -9.0 Y +99608 AK -9.0 Y +99609 AK -9.0 Y +99610 AK -9.0 Y +99611 AK -9.0 Y +99612 AK -9.0 Y +99613 AK -9.0 Y +99614 AK -9.0 Y +99615 AK -9.0 Y +99619 AK -9.0 Y +99620 AK -9.0 Y +99621 AK -9.0 Y +99622 AK -9.0 Y +99624 AK -9.0 Y +99625 AK -9.0 Y +99626 AK -9.0 Y +99627 AK -9.0 Y +99628 AK -9.0 Y +99629 AK -9.0 Y +99630 AK -9.0 Y +99631 AK -9.0 Y +99632 AK -9.0 Y +99633 AK -9.0 Y +99634 AK -9.0 Y +99635 AK -9.0 Y +99636 AK -9.0 Y +99637 AK -9.0 Y +99638 AK -10.0 Y +99639 AK -9.0 Y +99640 AK -9.0 Y +99641 AK -9.0 Y +99643 AK -9.0 Y +99644 AK -9.0 Y +99645 AK -9.0 Y +99647 AK -9.0 Y +99648 AK -9.0 Y +99649 AK -9.0 Y +99650 AK -9.0 Y +99651 AK -9.0 Y +99652 AK -9.0 Y +99653 AK -9.0 Y +99654 AK -9.0 Y +99655 AK -9.0 Y +99656 AK -9.0 Y +99657 AK -9.0 Y +99658 AK -9.0 Y +99659 AK -9.0 Y +99660 AK -10.0 Y +99661 AK -9.0 Y +99662 AK -9.0 Y +99663 AK -9.0 Y +99664 AK -9.0 Y +99665 AK -9.0 Y +99666 AK -9.0 Y +99667 AK -9.0 Y +99668 AK -9.0 Y +99669 AK -9.0 Y +99670 AK -9.0 Y +99671 AK -9.0 Y +99672 AK -9.0 Y +99674 AK -9.0 Y +99675 AK -9.0 Y +99676 AK -9.0 Y +99677 AK -9.0 Y +99678 AK -9.0 Y +99679 AK -9.0 Y +99680 AK -9.0 Y +99681 AK -9.0 Y +99682 AK -9.0 Y +99683 AK -9.0 Y +99684 AK -9.0 Y +99685 AK -9.0 Y +99686 AK -9.0 Y +99687 AK -9.0 Y +99688 AK -9.0 Y +99689 AK -9.0 Y +99690 AK -9.0 Y +99691 AK -9.0 Y +99692 AK -9.0 Y +99693 AK -9.0 Y +99694 AK -9.0 Y +99695 AK -9.0 Y +99697 AK -9.0 Y +99701 AK -9.0 Y +99702 AK -9.0 Y +99703 AK -9.0 Y +99704 AK -9.0 Y +99705 AK -9.0 Y +99706 AK -9.0 Y +99707 AK -9.0 Y +99708 AK -9.0 Y +99709 AK -9.0 Y +99710 AK -9.0 Y +99711 AK -9.0 Y +99712 AK -9.0 Y +99714 AK -9.0 Y +99716 AK -9.0 Y +99720 AK -9.0 Y +99721 AK -9.0 Y +99722 AK -9.0 Y +99723 AK -9.0 Y +99724 AK -9.0 Y +99725 AK -9.0 Y +99726 AK -9.0 Y +99727 AK -9.0 Y +99729 AK -9.0 Y +99730 AK -9.0 Y +99731 AK -9.0 Y +99732 AK -9.0 Y +99733 AK -9.0 Y +99734 AK -9.0 Y +99736 AK -9.0 Y +99737 AK -9.0 Y +99738 AK -9.0 Y +99739 AK -9.0 Y +99740 AK -9.0 Y +99741 AK -9.0 Y +99742 AK -10.0 Y +99743 AK -9.0 Y +99744 AK -9.0 Y +99745 AK -9.0 Y +99746 AK -9.0 Y +99747 AK -9.0 Y +99748 AK -9.0 Y +99749 AK -9.0 Y +99750 AK -9.0 Y +99751 AK -9.0 Y +99752 AK -9.0 Y +99753 AK -9.0 Y +99754 AK -9.0 Y +99755 AK -9.0 Y +99756 AK -9.0 Y +99757 AK -9.0 Y +99758 AK -9.0 Y +99759 AK -9.0 Y +99760 AK -9.0 Y +99761 AK -9.0 Y +99762 AK -9.0 Y +99763 AK -9.0 Y +99764 AK -9.0 Y +99765 AK -9.0 Y +99766 AK -9.0 Y +99767 AK -9.0 Y +99768 AK -9.0 Y +99769 AK -10.0 Y +99770 AK -9.0 Y +99771 AK -9.0 Y +99772 AK -9.0 Y +99773 AK -9.0 Y +99774 AK -9.0 Y +99775 AK -9.0 Y +99776 AK -9.0 Y +99777 AK -9.0 Y +99778 AK -9.0 Y +99779 AK -9.0 Y +99780 AK -9.0 Y +99781 AK -9.0 Y +99782 AK -9.0 Y +99783 AK -9.0 Y +99784 AK -9.0 Y +99785 AK -9.0 Y +99786 AK -9.0 Y +99788 AK -9.0 Y +99789 AK -9.0 Y +99790 AK -9.0 Y +99791 AK -9.0 Y +99801 AK -9.0 Y +99802 AK -9.0 Y +99803 AK -9.0 Y +99811 AK -9.0 Y +99812 AK -9.0 Y +99820 AK -9.0 Y +99821 AK -9.0 Y +99824 AK -9.0 Y +99825 AK -9.0 Y +99826 AK -9.0 Y +99827 AK -9.0 Y +99829 AK -9.0 Y +99830 AK -9.0 Y +99832 AK -9.0 Y +99833 AK -9.0 Y +99835 AK -9.0 Y +99836 AK -9.0 Y +99840 AK -9.0 Y +99841 AK -9.0 Y +99850 AK -9.0 Y +99901 AK -9.0 Y +99903 AK -9.0 Y +99918 AK -9.0 Y +99919 AK -9.0 Y +99921 AK -9.0 Y +99922 AK -9.0 Y +99923 AK -9.0 Y +99925 AK -9.0 Y +99926 AK -9.0 Y +99927 AK -9.0 Y +99928 AK -9.0 Y +99929 AK -9.0 Y +99950 AK -9.0 Y diff --git a/agc_2-X/branches/agc_2.0.4/extras/GMT_notes.txt b/agc_2-X/branches/agc_2.0.4/extras/GMT_notes.txt new file mode 100644 index 00000000..76f75cc4 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/extras/GMT_notes.txt @@ -0,0 +1,28 @@ +Daylight Savings Time(Summer Time) Schemes + +These are all of the Schemes for changing of the GMT offset within different geographic areas. Some of these schemes will change frequently. + +The first column is one country that is using the scheme +The seconds colum is the code for the scheme +The third column explains the scheme + +NORTHERN HEMISPHERE +* USA-Canada SSM-FSN Second Sunday March to First Sunday November +* Mexico FSA-LSO First Sunday April to Last Sunday October +* Europe LSM-LSO Last Sunday March to Last Sunday October European Summer Time +Egypt LTA-LTS Last Thursday April to Last Thursday September +Iraq FDA-FDO First day of April to the first day of October +Israel LFM-TSS *changes every year* Last Friday March to First Sunday September + +SOUTHERN HEMISPHERE +Namibia FSS-FSA First Sunday September to first sunday April +Falkland Isls FSS-TSA First Sunday September to Third Sunday April +Uruguay FSO-SSM First Sunday October to Second Sunday March +Chile SSO-SSM Second Saturday October to Second Saturday March +* Australia LSO-LSM Last Sunday October to Last Sunday March +* AUS-Taz FSO-LSM First Sunday October to Last Sunday March +* New Zealand FSO-TSM First Sunday October to Third Sunday March +* Brazil TSO-LSF Third Sunday October to Last Sunday February + + +* notes inclusion into ADMIN_adjust_GMTnow_on_leads.pl script diff --git a/agc_2-X/branches/agc_2.0.4/extras/MySQL_AST_CREATE_tables.sql b/agc_2-X/branches/agc_2.0.4/extras/MySQL_AST_CREATE_tables.sql new file mode 100644 index 00000000..77a20331 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/extras/MySQL_AST_CREATE_tables.sql @@ -0,0 +1,1041 @@ + CREATE TABLE phones ( +extension VARCHAR(100), +dialplan_number VARCHAR(20), +voicemail_id VARCHAR(10), +phone_ip VARCHAR(15), +computer_ip VARCHAR(15), +server_ip VARCHAR(15), +login VARCHAR(15), +pass VARCHAR(10), +status VARCHAR(10), +active ENUM('Y','N'), +phone_type VARCHAR(50), +fullname VARCHAR(50), +company VARCHAR(10), +picture VARCHAR(19), +messages INT(4), +old_messages INT(4), +protocol ENUM('SIP','Zap','IAX2','EXTERNAL') default 'SIP', +local_gmt VARCHAR(6) default '-5', +ASTmgrUSERNAME VARCHAR(20) default 'cron', +ASTmgrSECRET VARCHAR(20) default '1234', +login_user VARCHAR(20), +login_pass VARCHAR(20), +login_campaign VARCHAR(10), +park_on_extension VARCHAR(10) default '8301', +conf_on_extension VARCHAR(10) default '8302', +VICIDIAL_park_on_extension VARCHAR(10) default '8301', +VICIDIAL_park_on_filename VARCHAR(10) default 'park', +monitor_prefix VARCHAR(10) default '8612', +recording_exten VARCHAR(10) default '8309', +voicemail_exten VARCHAR(10) default '8501', +voicemail_dump_exten VARCHAR(20) default '85026666666666', +ext_context VARCHAR(20) default 'default', +dtmf_send_extension VARCHAR(100) default 'local/8500998@default', +call_out_number_group VARCHAR(100) default 'Zap/g2/', +client_browser VARCHAR(100) default '/usr/bin/mozilla', +install_directory VARCHAR(100) default '/usr/local/perl_TK', +local_web_callerID_URL VARCHAR(255) default 'http://astguiclient.sf.net/test_callerid_output.php', +VICIDIAL_web_URL VARCHAR(255) default 'http://astguiclient.sf.net/test_VICIDIAL_output.php', +AGI_call_logging_enabled ENUM('0','1') default '1', +user_switching_enabled ENUM('0','1') default '1', +conferencing_enabled ENUM('0','1') default '1', +admin_hangup_enabled ENUM('0','1') default '0', +admin_hijack_enabled ENUM('0','1') default '0', +admin_monitor_enabled ENUM('0','1') default '1', +call_parking_enabled ENUM('0','1') default '1', +updater_check_enabled ENUM('0','1') default '1', +AFLogging_enabled ENUM('0','1') default '1', +QUEUE_ACTION_enabled ENUM('0','1') default '1', +CallerID_popup_enabled ENUM('0','1') default '1', +voicemail_button_enabled ENUM('0','1') default '1', +enable_fast_refresh ENUM('0','1') default '0', +fast_refresh_rate INT(5) default '1000', +enable_persistant_mysql ENUM('0','1') default '0', +auto_dial_next_number ENUM('0','1') default '1', +VDstop_rec_after_each_call ENUM('0','1') default '1', +DBX_server VARCHAR(15), +DBX_database VARCHAR(15) default 'asterisk', +DBX_user VARCHAR(15) default 'cron', +DBX_pass VARCHAR(15) default '1234', +DBX_port INT(6) default '3306', +DBY_server VARCHAR(15), +DBY_database VARCHAR(15) default 'asterisk', +DBY_user VARCHAR(15) default 'cron', +DBY_pass VARCHAR(15) default '1234', +DBY_port INT(6) default '3306', +outbound_cid VARCHAR(20), +enable_sipsak_messages ENUM('0','1') default '0', +index (server_ip) +); + + CREATE TABLE servers ( +server_id VARCHAR(10) NOT NULL, +server_description VARCHAR(255), +server_ip VARCHAR(15) NOT NULL, +active ENUM('Y','N'), +asterisk_version VARCHAR(20) default '1.2.9', +max_vicidial_trunks SMALLINT(4) default '96', +telnet_host VARCHAR(20) NOT NULL default 'localhost', +telnet_port INT(5) NOT NULL default '5038', +ASTmgrUSERNAME VARCHAR(20) NOT NULL default 'cron', +ASTmgrSECRET VARCHAR(20) NOT NULL default '1234', +ASTmgrUSERNAMEupdate VARCHAR(20) NOT NULL default 'updatecron', +ASTmgrUSERNAMElisten VARCHAR(20) NOT NULL default 'listencron', +ASTmgrUSERNAMEsend VARCHAR(20) NOT NULL default 'sendcron', +local_gmt VARCHAR(6) default '-5', +voicemail_dump_exten VARCHAR(20) NOT NULL default '85026666666666', +answer_transfer_agent VARCHAR(20) NOT NULL default '8365', +ext_context VARCHAR(20) NOT NULL default 'default', +sys_perf_log ENUM('Y','N') default 'N', +vd_server_logs ENUM('Y','N') default 'Y', +agi_output ENUM('NONE','STDERR','FILE','BOTH') default 'FILE', +vicidial_balance_active ENUM('Y','N') default 'N', +balance_trunks_offlimits SMALLINT(5) UNSIGNED default '0' +); + + + CREATE TABLE live_channels ( +channel VARCHAR(100) NOT NULL, +server_ip VARCHAR(15) NOT NULL, +channel_group VARCHAR(30), +extension VARCHAR(100), +channel_data VARCHAR(100) +); + + CREATE TABLE live_sip_channels ( +channel VARCHAR(100) NOT NULL, +server_ip VARCHAR(15) NOT NULL, +channel_group VARCHAR(30), +extension VARCHAR(100), +channel_data VARCHAR(100) +); + + CREATE TABLE parked_channels ( +channel VARCHAR(100) NOT NULL, +server_ip VARCHAR(15) NOT NULL, +channel_group VARCHAR(30), +extension VARCHAR(100), +parked_by VARCHAR(100), +parked_time DATETIME +); + + CREATE TABLE conferences ( +conf_exten INT(7) UNSIGNED NOT NULL, +server_ip VARCHAR(15) NOT NULL, +extension VARCHAR(100) +); + + CREATE TABLE recording_log ( +recording_id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +channel VARCHAR(100), +server_ip VARCHAR(15), +extension VARCHAR(100), +start_time DATETIME, +start_epoch INT(10), +end_time DATETIME, +end_epoch INT(10), +length_in_sec INT(10), +length_in_min DOUBLE(8,2), +filename VARCHAR(50), +location VARCHAR(255), +lead_id INT(9) UNSIGNED, +user VARCHAR(20), +index (filename), +index(lead_id), +index(user) +); + + CREATE TABLE live_inbound ( +uniqueid DOUBLE(18,7) NOT NULL, +channel VARCHAR(100) NOT NULL, +server_ip VARCHAR(15) NOT NULL, +caller_id VARCHAR(30), +extension VARCHAR(100), +phone_ext VARCHAR(40), +start_time DATETIME, +acknowledged ENUM('Y','N') default 'N', +inbound_number VARCHAR(20), +comment_a VARCHAR(50), +comment_b VARCHAR(50), +comment_c VARCHAR(50), +comment_d VARCHAR(50), +comment_e VARCHAR(50) +); + + CREATE TABLE inbound_numbers ( +extension VARCHAR(30) NOT NULL, +full_number VARCHAR(30) NOT NULL, +server_ip VARCHAR(15) NOT NULL, +inbound_name VARCHAR(30), +department VARCHAR(30) +); + + CREATE TABLE server_updater ( +server_ip VARCHAR(15) NOT NULL, +last_update DATETIME +); + + CREATE TABLE call_log ( +uniqueid DOUBLE(18,7) PRIMARY KEY NOT NULL, +channel VARCHAR(100), +channel_group VARCHAR(30), +type VARCHAR(10), +server_ip VARCHAR(15), +extension VARCHAR(100), +number_dialed VARCHAR(15), +caller_code VARCHAR(20), +start_time DATETIME, +start_epoch INT(10), +end_time DATETIME, +end_epoch INT(10), +length_in_sec INT(10), +length_in_min DOUBLE(8,2), +index (caller_code), +index (server_ip), +index (channel) +); + + CREATE TABLE park_log ( +uniqueid DOUBLE(18,7) PRIMARY KEY NOT NULL, +status VARCHAR(10), +channel VARCHAR(100), +channel_group VARCHAR(30), +server_ip VARCHAR(15), +parked_time DATETIME, +grab_time DATETIME, +hangup_time DATETIME, +parked_sec INT(10), +talked_sec INT(10), +extension VARCHAR(100), +user VARCHAR(20), +index (parked_time) +); + + CREATE TABLE vicidial_manager ( +man_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +uniqueid DOUBLE(18,7), +entry_date DATETIME, +status ENUM('NEW','QUEUE','SENT','UPDATED','DEAD'), +response ENUM('Y','N'), +server_ip VARCHAR(15) NOT NULL, +channel VARCHAR(100), +action VARCHAR(20), +callerid VARCHAR(20), +cmd_line_b VARCHAR(100), +cmd_line_c VARCHAR(100), +cmd_line_d VARCHAR(100), +cmd_line_e VARCHAR(100), +cmd_line_f VARCHAR(100), +cmd_line_g VARCHAR(100), +cmd_line_h VARCHAR(100), +cmd_line_i VARCHAR(100), +cmd_line_j VARCHAR(100), +cmd_line_k VARCHAR(100), +index (callerid), +index (uniqueid), +index serverstat(server_ip,status) +); + + CREATE TABLE vicidial_list ( +lead_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +entry_date DATETIME, +modify_date TIMESTAMP, +status VARCHAR(6), +user VARCHAR(20), +vendor_lead_code VARCHAR(20), +source_id VARCHAR(6), +list_id BIGINT(14) UNSIGNED, +gmt_offset_now DECIMAL(4,2) DEFAULT '0.00', +called_since_last_reset ENUM('Y','N','Y1','Y2','Y3','Y4','Y5','Y6','Y7','Y8','Y9','Y10') default 'N', +phone_code VARCHAR(10), +phone_number VARCHAR(12), +title VARCHAR(4), +first_name VARCHAR(30), +middle_initial VARCHAR(1), +last_name VARCHAR(30), +address1 VARCHAR(100), +address2 VARCHAR(100), +address3 VARCHAR(100), +city VARCHAR(50), +state VARCHAR(2), +province VARCHAR(50), +postal_code VARCHAR(10), +country_code VARCHAR(3), +gender ENUM('M','F'), +date_of_birth DATE, +alt_phone VARCHAR(12), +email VARCHAR(70), +security_phrase VARCHAR(100), +comments VARCHAR(255), +called_count SMALLINT(5) UNSIGNED default '0', +index (phone_number), +index (list_id), +index (called_since_last_reset), +index (status), +index (gmt_offset_now), +index (postal_code) +); + + CREATE TABLE vicidial_hopper ( +hopper_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +lead_id INT(9) UNSIGNED NOT NULL, +campaign_id VARCHAR(8), +status ENUM('READY','QUEUE','INCALL','DONE','HOLD') default 'READY', +user VARCHAR(20), +list_id BIGINT(14) UNSIGNED NOT NULL, +gmt_offset_now DECIMAL(4,2) DEFAULT '0.00', +state VARCHAR(2) default '', +alt_dial ENUM('NONE','ALT','ADDR3') default 'NONE', +priority TINYINT(2) default '0', +index (lead_id) +); + + CREATE TABLE vicidial_live_agents ( +live_agent_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +user VARCHAR(20), +server_ip VARCHAR(15) NOT NULL, +conf_exten VARCHAR(20), +extension VARCHAR(100), +status ENUM('READY','QUEUE','INCALL','PAUSED','CLOSER') default 'PAUSED', +lead_id INT(9) UNSIGNED NOT NULL, +campaign_id VARCHAR(8), +uniqueid DOUBLE(18,7), +callerid VARCHAR(20), +channel VARCHAR(100), +random_id INT(8) UNSIGNED, +last_call_time DATETIME, +last_update_time TIMESTAMP, +last_call_finish DATETIME, +closer_campaigns TEXT, +call_server_ip VARCHAR(15), +user_level INT(2) default '0', +comments VARCHAR(20), +campaign_weight TINYINT(1) default '0', +calls_today SMALLINT(5) UNSIGNED default '0', +index (random_id), +index (last_call_time), +index (last_update_time), +index (last_call_finish) +); + + CREATE TABLE vicidial_auto_calls ( +auto_call_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +server_ip VARCHAR(15) NOT NULL, +campaign_id VARCHAR(20), +status ENUM('SENT','RINGING','LIVE','XFER','PAUSED','CLOSER','BUSY','DISCONNECT') default 'PAUSED', +lead_id INT(9) UNSIGNED NOT NULL, +uniqueid DOUBLE(18,7), +callerid VARCHAR(20), +channel VARCHAR(100), +phone_code VARCHAR(10), +phone_number VARCHAR(12), +call_time DATETIME, +call_type ENUM('IN','OUT','OUTBALANCE') default 'OUT', +stage VARCHAR(20) default 'START', +last_update_time TIMESTAMP, +alt_dial ENUM('NONE','MAIN','ALT','ADDR3') default 'NONE', +index (uniqueid), +index (callerid), +index (call_time), +index (last_update_time) +); + + CREATE TABLE vicidial_log ( +uniqueid DOUBLE(18,7) PRIMARY KEY NOT NULL, +lead_id INT(9) UNSIGNED NOT NULL, +list_id BIGINT(14) UNSIGNED, +campaign_id VARCHAR(8), +call_date DATETIME, +start_epoch INT(10) UNSIGNED, +end_epoch INT(10) UNSIGNED, +length_in_sec INT(10), +status VARCHAR(6), +phone_code VARCHAR(10), +phone_number VARCHAR(12), +user VARCHAR(20), +comments VARCHAR(255), +processed ENUM('Y','N'), +user_group VARCHAR(20), +index (lead_id), +index (call_date) +); + + CREATE TABLE vicidial_closer_log ( +closecallid INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +lead_id INT(9) UNSIGNED NOT NULL, +list_id BIGINT(14) UNSIGNED, +campaign_id VARCHAR(20), +call_date DATETIME, +start_epoch INT(10) UNSIGNED, +end_epoch INT(10) UNSIGNED, +length_in_sec INT(10), +status VARCHAR(6), +phone_code VARCHAR(10), +phone_number VARCHAR(12), +user VARCHAR(20), +comments VARCHAR(255), +processed ENUM('Y','N'), +queue_seconds DECIMAL(7,2) default '0', +user_group VARCHAR(20), +index (lead_id), +index (call_date) +); + + CREATE TABLE vicidial_xfer_log ( +xfercallid INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +lead_id INT(9) UNSIGNED NOT NULL, +list_id BIGINT(14) UNSIGNED, +campaign_id VARCHAR(20), +call_date DATETIME, +phone_code VARCHAR(10), +phone_number VARCHAR(12), +user VARCHAR(20), +closer VARCHAR(20), +index (lead_id), +index (call_date) +); + + CREATE TABLE vicidial_users ( +user_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +user VARCHAR(20), +pass VARCHAR(20), +full_name VARCHAR(50), +user_level INT(2), +user_group VARCHAR(20), +phone_login VARCHAR(20), +phone_pass VARCHAR(20), +delete_users ENUM('0','1') default '0', +delete_user_groups ENUM('0','1') default '0', +delete_lists ENUM('0','1') default '0', +delete_campaigns ENUM('0','1') default '0', +delete_ingroups ENUM('0','1') default '0', +delete_remote_agents ENUM('0','1') default '0', +load_leads ENUM('0','1') default '0', +campaign_detail ENUM('0','1') default '0', +ast_admin_access ENUM('0','1') default '0', +ast_delete_phones ENUM('0','1') default '0', +delete_scripts ENUM('0','1') default '0', +modify_leads ENUM('0','1') default '0', +hotkeys_active ENUM('0','1') default '0', +change_agent_campaign ENUM('0','1') default '0', +agent_choose_ingroups ENUM('0','1') default '1', +closer_campaigns TEXT, +scheduled_callbacks ENUM('0','1') default '1', +agentonly_callbacks ENUM('0','1') default '0', +agentcall_manual ENUM('0','1') default '0', +vicidial_recording ENUM('0','1') default '1', +vicidial_transfers ENUM('0','1') default '1', +delete_filters ENUM('0','1') default '0', +alter_agent_interface_options ENUM('0','1') default '0', +closer_default_blended ENUM('0','1') default '0', +delete_call_times ENUM('0','1') default '0', +modify_call_times ENUM('0','1') default '0', +modify_users ENUM('0','1') default '0', +modify_campaigns ENUM('0','1') default '0', +modify_lists ENUM('0','1') default '0', +modify_scripts ENUM('0','1') default '0', +modify_filters ENUM('0','1') default '0', +modify_ingroups ENUM('0','1') default '0', +modify_usergroups ENUM('0','1') default '0', +modify_remoteagents ENUM('0','1') default '0', +modify_servers ENUM('0','1') default '0', +view_reports ENUM('0','1') default '0', +vicidial_recording_override ENUM('DISABLED','NEVER','ONDEMAND','ALLCALLS','ALLFORCE') default 'DISABLED', +alter_custdata_override ENUM('NOT_ACTIVE','ALLOW_ALTER') default 'NOT_ACTIVE', +index (user) +); + + CREATE TABLE vicidial_user_log ( +user_log_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +user VARCHAR(20), +event VARCHAR(50), +campaign_id VARCHAR(8), +event_date DATETIME, +event_epoch INT(10) UNSIGNED, +user_group VARCHAR(20), +index (user) +); + + CREATE TABLE vicidial_user_groups ( +user_group VARCHAR(20) NOT NULL, +group_name VARCHAR(40) NOT NULL, +allowed_campaigns TEXT +); + + CREATE TABLE vicidial_campaigns ( +campaign_id VARCHAR(8) PRIMARY KEY NOT NULL, +campaign_name VARCHAR(40), +active ENUM('Y','N'), +dial_status_a VARCHAR(6), +dial_status_b VARCHAR(6), +dial_status_c VARCHAR(6), +dial_status_d VARCHAR(6), +dial_status_e VARCHAR(6), +lead_order VARCHAR(20), +park_ext VARCHAR(10), +park_file_name VARCHAR(10), +web_form_address VARCHAR(255), +allow_closers ENUM('Y','N'), +hopper_level INT(8) UNSIGNED default '1', +auto_dial_level VARCHAR(6) default '0', +next_agent_call ENUM('random','oldest_call_start','oldest_call_finish','campaign_rank','overall_user_level','fewest_calls') default 'oldest_call_finish', +local_call_time VARCHAR(10) DEFAULT '9am-9pm', +voicemail_ext VARCHAR(10), +dial_timeout TINYINT UNSIGNED default '60', +dial_prefix VARCHAR(20) default '9', +campaign_cid VARCHAR(10) default '0000000000', +campaign_vdad_exten VARCHAR(20) default '8365', +campaign_rec_exten VARCHAR(20) default '8309', +campaign_recording ENUM('NEVER','ONDEMAND','ALLCALLS','ALLFORCE') default 'ONDEMAND', +campaign_rec_filename VARCHAR(50) default 'FULLDATE_CUSTPHONE', +campaign_script VARCHAR(10), +get_call_launch ENUM('NONE','SCRIPT','WEBFORM') default 'NONE', +am_message_exten VARCHAR(20), +amd_send_to_vmx ENUM('Y','N') default 'N', +xferconf_a_dtmf VARCHAR(50), +xferconf_a_number VARCHAR(50), +xferconf_b_dtmf VARCHAR(50), +xferconf_b_number VARCHAR(50), +alt_number_dialing ENUM('Y','N') default 'N', +scheduled_callbacks ENUM('Y','N') default 'N', +lead_filter_id VARCHAR(10) default 'NONE', +drop_call_seconds TINYINT(3) unsigned default '5', +safe_harbor_message ENUM('Y','N') default 'N', +safe_harbor_exten VARCHAR(20) default '8307', +display_dialable_count ENUM('Y','N') default 'Y', +wrapup_seconds SMALLINT(3) UNSIGNED default '0', +wrapup_message VARCHAR(255) default 'Wrapup Call', +closer_campaigns TEXT default '', +use_internal_dnc ENUM('Y','N') default 'N', +allcalls_delay SMALLINT(3) UNSIGNED default '0', +omit_phone_code ENUM('Y','N') default 'N', +dial_method ENUM('MANUAL','RATIO','ADAPT_HARD_LIMIT','ADAPT_TAPERED','ADAPT_AVERAGE') default 'MANUAL', +available_only_ratio_tally ENUM('Y','N') default 'N', +adaptive_dropped_percentage SMALLINT(3) default '3', +adaptive_maximum_level VARCHAR(6) default '3.0', +adaptive_latest_server_time VARCHAR(4) default '2100', +adaptive_intensity VARCHAR(6) default '0', +adaptive_dl_diff_target SMALLINT(3) default '0', +concurrent_transfers ENUM('AUTO','1','2','3','4','5','6','7','8','9','10') default 'AUTO', +auto_alt_dial ENUM('NONE','ALT_ONLY','ADDR3_ONLY','ALT_AND_ADDR3') default 'NONE', +auto_alt_dial_statuses VARCHAR(255) default ' B N NA DC -', +agent_pause_codes_active ENUM('Y','N') default 'N', +campaign_description VARCHAR(255), +campaign_changedate DATETIME, +campaign_stats_refresh ENUM('Y','N') default 'N', +campaign_logindate DATETIME, +dial_statuses VARCHAR(255) default ' NEW -', +disable_alter_custdata ENUM('Y','N') default 'N', +no_hopper_leads_logins ENUM('Y','N') default 'N', +list_order_mix VARCHAR(20) default 'DISABLED', +campaign_allow_inbound ENUM('Y','N') default 'N', +manual_dial_list_id BIGINT(14) UNSIGNED, +default_xfer_group VARCHAR(20) default '---NONE---', +xfer_groups TEXT default '' +); + + CREATE TABLE vicidial_lists ( +list_id BIGINT(14) UNSIGNED PRIMARY KEY NOT NULL, +list_name VARCHAR(30), +campaign_id VARCHAR(8), +active ENUM('Y','N'), +list_description VARCHAR(255), +list_changedate DATETIME, +list_lastcalldate DATETIME +); + + CREATE TABLE vicidial_statuses ( +status VARCHAR(6) PRIMARY KEY NOT NULL, +status_name VARCHAR(30), +selectable ENUM('Y','N'), +human_answered ENUM('Y','N') default 'N', +category VARCHAR(20) default 'UNDEFINED' +); + + CREATE TABLE vicidial_campaign_statuses ( +status VARCHAR(6) NOT NULL, +status_name VARCHAR(30), +selectable ENUM('Y','N'), +campaign_id VARCHAR(8), +human_answered ENUM('Y','N') default 'N', +category VARCHAR(20) default 'UNDEFINED', +index (campaign_id) +); + + CREATE TABLE vicidial_campaign_hotkeys ( +status VARCHAR(6) NOT NULL, +hotkey VARCHAR(1) NOT NULL, +status_name VARCHAR(30), +selectable ENUM('Y','N'), +campaign_id VARCHAR(8), +index (campaign_id) +); + + CREATE TABLE vicidial_conferences ( +conf_exten INT(7) UNSIGNED NOT NULL, +server_ip VARCHAR(15) NOT NULL, +extension VARCHAR(100) +); + + CREATE TABLE vicidial_phone_codes ( +country_code SMALLINT(5) UNSIGNED, +country CHAR(3), +areacode CHAR(3), +state VARCHAR(4), +GMT_offset VARCHAR(5), +DST enum('Y','N'), +DST_range VARCHAR(8), +geographic_description VARCHAR(30) +); + + CREATE TABLE vicidial_inbound_groups ( +group_id VARCHAR(20) PRIMARY KEY NOT NULL, +group_name VARCHAR(30), +group_color VARCHAR(7), +active ENUM('Y','N'), +web_form_address VARCHAR(255), +voicemail_ext VARCHAR(10), +next_agent_call ENUM('random','oldest_call_start','oldest_call_finish','overall_user_level','inbound_group_rank','campaign_rank','fewest_calls','fewest_calls_campaign') default 'oldest_call_finish', +fronter_display ENUM('Y','N') default 'Y', +ingroup_script VARCHAR(10), +get_call_launch ENUM('NONE','SCRIPT','WEBFORM') default 'NONE', +xferconf_a_dtmf VARCHAR(50), +xferconf_a_number VARCHAR(50), +xferconf_b_dtmf VARCHAR(50), +xferconf_b_number VARCHAR(50), +drop_call_seconds SMALLINT(4) unsigned default '360', +drop_message ENUM('Y','N') default 'N', +drop_exten VARCHAR(20) default '8307', +call_time_id VARCHAR(20) default '24hours', +after_hours_action ENUM('HANGUP','MESSAGE','EXTENSION','VOICEMAIL') default 'MESSAGE', +after_hours_message_filename VARCHAR(50) default 'vm-goodbye', +after_hours_exten VARCHAR(20) default '8300', +after_hours_voicemail VARCHAR(20), +welcome_message_filename VARCHAR(50) default '---NONE---', +moh_context VARCHAR(50) default 'default', +onhold_prompt_filename VARCHAR(50) default 'generic_hold', +prompt_interval SMALLINT(5) UNSIGNED default '60', +agent_alert_exten VARCHAR(20) default '8304', +agent_alert_delay INT(6) default '1000', +default_xfer_group VARCHAR(20) default '---NONE---' +); + +CREATE TABLE vicidial_stations ( +agent_station VARCHAR(10) PRIMARY KEY NOT NULL, +phone_channel VARCHAR(100), +computer_ip VARCHAR(15) NOT NULL, +server_ip VARCHAR(15) NOT NULL, +DB_server_ip VARCHAR(15) NOT NULL, +DB_user VARCHAR(15), +DB_pass VARCHAR(15), +DB_port VARCHAR(6) +); + + CREATE TABLE vicidial_remote_agents ( +remote_agent_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +user_start VARCHAR(20), +number_of_lines TINYINT UNSIGNED default '1', +server_ip VARCHAR(15) NOT NULL, +conf_exten VARCHAR(20), +status ENUM('ACTIVE','INACTIVE') default 'INACTIVE', +campaign_id VARCHAR(8), +closer_campaigns TEXT +); + + CREATE TABLE live_inbound_log ( +uniqueid DOUBLE(18,7) NOT NULL, +channel VARCHAR(100) NOT NULL, +server_ip VARCHAR(15) NOT NULL, +caller_id VARCHAR(30), +extension VARCHAR(100), +phone_ext VARCHAR(40), +start_time DATETIME, +acknowledged ENUM('Y','N') default 'N', +inbound_number VARCHAR(20), +comment_a VARCHAR(50), +comment_b VARCHAR(50), +comment_c VARCHAR(50), +comment_d VARCHAR(50), +comment_e VARCHAR(50), +index (uniqueid), +index (phone_ext), +index (start_time) +); + + CREATE TABLE web_client_sessions ( +extension VARCHAR(100) NOT NULL, +server_ip VARCHAR(15) NOT NULL, +program ENUM('agc','vicidial','monitor','other') default 'agc', +start_time DATETIME NOT NULL, +session_name VARCHAR(40) UNIQUE NOT NULL +); + + CREATE TABLE server_performance ( +start_time DATETIME NOT NULL, +server_ip VARCHAR(15) NOT NULL, +sysload INT(6) NOT NULL, +freeram SMALLINT(5) UNSIGNED NOT NULL, +usedram SMALLINT(5) UNSIGNED NOT NULL, +processes SMALLINT(4) UNSIGNED NOT NULL, +channels_total SMALLINT(4) UNSIGNED NOT NULL, +trunks_total SMALLINT(4) UNSIGNED NOT NULL, +clients_total SMALLINT(4) UNSIGNED NOT NULL, +clients_zap SMALLINT(4) UNSIGNED NOT NULL, +clients_iax SMALLINT(4) UNSIGNED NOT NULL, +clients_local SMALLINT(4) UNSIGNED NOT NULL, +clients_sip SMALLINT(4) UNSIGNED NOT NULL, +live_recordings SMALLINT(4) UNSIGNED NOT NULL, +cpu_user_percent SMALLINT(3) UNSIGNED NOT NULL default '0', +cpu_system_percent SMALLINT(3) UNSIGNED NOT NULL default '0', +cpu_idle_percent SMALLINT(3) UNSIGNED NOT NULL default '0' +); + + CREATE TABLE vicidial_agent_log ( +agent_log_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +user VARCHAR(20), +server_ip VARCHAR(15) NOT NULL, +event_time DATETIME, +lead_id INT(9) UNSIGNED, +campaign_id VARCHAR(8), +pause_epoch INT(10) UNSIGNED, +pause_sec SMALLINT(5) UNSIGNED default '0', +wait_epoch INT(10) UNSIGNED, +wait_sec SMALLINT(5) UNSIGNED default '0', +talk_epoch INT(10) UNSIGNED, +talk_sec SMALLINT(5) UNSIGNED default '0', +dispo_epoch INT(10) UNSIGNED, +dispo_sec SMALLINT(5) UNSIGNED default '0', +status VARCHAR(6), +user_group VARCHAR(20), +comments VARCHAR(20), +sub_status VARCHAR(6) +); + + CREATE TABLE vicidial_scripts ( +script_id VARCHAR(10) PRIMARY KEY NOT NULL, +script_name VARCHAR(50), +script_comments VARCHAR(255), +script_text TEXT, +active ENUM('Y','N') +); + + CREATE TABLE phone_favorites ( +extension VARCHAR(100), +server_ip VARCHAR(15), +extensions_list TEXT +); + + CREATE TABLE vicidial_callbacks ( +callback_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +lead_id INT(9) UNSIGNED, +list_id BIGINT(14) UNSIGNED, +campaign_id VARCHAR(8), +status VARCHAR(10), +entry_time DATETIME, +callback_time DATETIME, +modify_date TIMESTAMP, +user VARCHAR(20), +recipient ENUM('USERONLY','ANYONE'), +comments VARCHAR(255), +user_group VARCHAR(20), +index (lead_id), +index (status), +index (callback_time) +); + + CREATE TABLE vicidial_list_pins ( +pins_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +entry_time DATETIME, +phone_number VARCHAR(12), +lead_id INT(9) UNSIGNED, +campaign_id VARCHAR(20), +product_code VARCHAR(20), +user VARCHAR(20), +digits VARCHAR(20), +index (lead_id), +index (phone_number), +index (entry_time) +); + + CREATE TABLE vicidial_lead_filters ( +lead_filter_id VARCHAR(10) PRIMARY KEY NOT NULL, +lead_filter_name VARCHAR(30) NOT NULL, +lead_filter_comments VARCHAR(255), +lead_filter_sql TEXT +); + + CREATE TABLE vicidial_call_times ( +call_time_id VARCHAR(10) PRIMARY KEY NOT NULL, +call_time_name VARCHAR(30) NOT NULL, +call_time_comments VARCHAR(255) default '', +ct_default_start SMALLINT(4) unsigned NOT NULL default '900', +ct_default_stop SMALLINT(4) unsigned NOT NULL default '2100', +ct_sunday_start SMALLINT(4) unsigned default '0', +ct_sunday_stop SMALLINT(4) unsigned default '0', +ct_monday_start SMALLINT(4) unsigned default '0', +ct_monday_stop SMALLINT(4) unsigned default '0', +ct_tuesday_start SMALLINT(4) unsigned default '0', +ct_tuesday_stop SMALLINT(4) unsigned default '0', +ct_wednesday_start SMALLINT(4) unsigned default '0', +ct_wednesday_stop SMALLINT(4) unsigned default '0', +ct_thursday_start SMALLINT(4) unsigned default '0', +ct_thursday_stop SMALLINT(4) unsigned default '0', +ct_friday_start SMALLINT(4) unsigned default '0', +ct_friday_stop SMALLINT(4) unsigned default '0', +ct_saturday_start SMALLINT(4) unsigned default '0', +ct_saturday_stop SMALLINT(4) unsigned default '0', +ct_state_call_times TEXT default '' +); + + CREATE TABLE vicidial_state_call_times ( +state_call_time_id VARCHAR(10) PRIMARY KEY NOT NULL, +state_call_time_state VARCHAR(2) NOT NULL, +state_call_time_name VARCHAR(30) NOT NULL, +state_call_time_comments VARCHAR(255) default '', +sct_default_start SMALLINT(4) unsigned NOT NULL default '900', +sct_default_stop SMALLINT(4) unsigned NOT NULL default '2100', +sct_sunday_start SMALLINT(4) unsigned default '0', +sct_sunday_stop SMALLINT(4) unsigned default '0', +sct_monday_start SMALLINT(4) unsigned default '0', +sct_monday_stop SMALLINT(4) unsigned default '0', +sct_tuesday_start SMALLINT(4) unsigned default '0', +sct_tuesday_stop SMALLINT(4) unsigned default '0', +sct_wednesday_start SMALLINT(4) unsigned default '0', +sct_wednesday_stop SMALLINT(4) unsigned default '0', +sct_thursday_start SMALLINT(4) unsigned default '0', +sct_thursday_stop SMALLINT(4) unsigned default '0', +sct_friday_start SMALLINT(4) unsigned default '0', +sct_friday_stop SMALLINT(4) unsigned default '0', +sct_saturday_start SMALLINT(4) unsigned default '0', +sct_saturday_stop SMALLINT(4) unsigned default '0' +); + + CREATE TABLE vicidial_campaign_stats ( +campaign_id VARCHAR(20) PRIMARY KEY NOT NULL, +update_time TIMESTAMP, +dialable_leads INT(9) UNSIGNED default '0', +calls_today INT(9) UNSIGNED default '0', +answers_today INT(9) UNSIGNED default '0', +drops_today INT(9) UNSIGNED default '0', +drops_today_pct VARCHAR(6) default '0', +drops_answers_today_pct VARCHAR(6) default '0', +calls_hour INT(9) UNSIGNED default '0', +answers_hour INT(9) UNSIGNED default '0', +drops_hour INT(9) UNSIGNED default '0', +drops_hour_pct VARCHAR(6) default '0', +calls_halfhour INT(9) UNSIGNED default '0', +answers_halfhour INT(9) UNSIGNED default '0', +drops_halfhour INT(9) UNSIGNED default '0', +drops_halfhour_pct VARCHAR(6) default '0', +calls_fivemin INT(9) UNSIGNED default '0', +answers_fivemin INT(9) UNSIGNED default '0', +drops_fivemin INT(9) UNSIGNED default '0', +drops_fivemin_pct VARCHAR(6) default '0', +calls_onemin INT(9) UNSIGNED default '0', +answers_onemin INT(9) UNSIGNED default '0', +drops_onemin INT(9) UNSIGNED default '0', +drops_onemin_pct VARCHAR(6) default '0', +differential_onemin VARCHAR(20) default '0', +agents_average_onemin VARCHAR(20) default '0', +balance_trunk_fill SMALLINT(5) UNSIGNED default '0', +status_category_1 VARCHAR(20), +status_category_count_1 INT(9) UNSIGNED default '0', +status_category_2 VARCHAR(20), +status_category_count_2 INT(9) UNSIGNED default '0', +status_category_3 VARCHAR(20), +status_category_count_3 INT(9) UNSIGNED default '0', +status_category_4 VARCHAR(20), +status_category_count_4 INT(9) UNSIGNED default '0' +); + + CREATE TABLE vicidial_dnc ( +phone_number VARCHAR(12) PRIMARY KEY NOT NULL +); + + CREATE TABLE vicidial_lead_recycle ( +recycle_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +campaign_id VARCHAR(8), +status VARCHAR(6) NOT NULL, +attempt_delay SMALLINT(5) UNSIGNED default '1800', +attempt_maximum TINYINT(3) UNSIGNED default '32', +active ENUM('Y','N') default 'N', +index (campaign_id) +); + + CREATE TABLE vicidial_campaign_server_stats ( +campaign_id VARCHAR(20) NOT NULL, +server_ip VARCHAR(15) NOT NULL, +update_time TIMESTAMP, +local_trunk_shortage SMALLINT(5) UNSIGNED default '0', +index (campaign_id), +index (server_ip) +); + + CREATE TABLE vicidial_server_trunks ( +server_ip VARCHAR(15) NOT NULL, +campaign_id VARCHAR(20) NOT NULL, +dedicated_trunks SMALLINT(5) UNSIGNED default '0', +trunk_restriction ENUM('MAXIMUM_LIMIT','OVERFLOW_ALLOWED') default 'OVERFLOW_ALLOWED', +index (campaign_id), +index (server_ip) +); + + CREATE TABLE vicidial_postal_codes ( +postal_code VARCHAR(10) NOT NULL, +state VARCHAR(4), +GMT_offset VARCHAR(5), +DST enum('Y','N'), +DST_range VARCHAR(8), +country CHAR(3), +country_code SMALLINT(5) UNSIGNED +); + + CREATE TABLE vicidial_pause_codes ( +pause_code VARCHAR(6) NOT NULL, +pause_code_name VARCHAR(30), +billable ENUM('NO','YES','HALF') default 'NO', +campaign_id VARCHAR(8), +index (campaign_id) +); + + CREATE TABLE system_settings ( +version VARCHAR(50), +install_date VARCHAR(50), +use_non_latin ENUM('0','1') default '0', +webroot_writable ENUM('0','1') default '1', +enable_queuemetrics_logging ENUM('0','1') default '0', +queuemetrics_server_ip VARCHAR(15), +queuemetrics_dbname VARCHAR(50), +queuemetrics_login VARCHAR(50), +queuemetrics_pass VARCHAR(50), +queuemetrics_url VARCHAR(255), +queuemetrics_log_id VARCHAR(10) default 'VIC', +queuemetrics_eq_prepend VARCHAR(255) default 'NONE', +vicidial_agent_disable ENUM('NOT_ACTIVE','LIVE_AGENT','EXTERNAL','ALL') default 'NOT_ACTIVE', +allow_sipsak_messages ENUM('0','1') default '0', +admin_home_url VARCHAR(255) default '../vicidial/welcome.php', +enable_agc_xfer_log ENUM('0','1') default '0' +); + + CREATE TABLE vicidial_campaigns_list_mix ( +vcl_id VARCHAR(20) PRIMARY KEY NOT NULL, +vcl_name VARCHAR(50), +campaign_id VARCHAR(8), +list_mix_container TEXT, +mix_method ENUM('EVEN_MIX','IN_ORDER','RANDOM') default 'IN_ORDER', +status ENUM('ACTIVE','INACTIVE') default 'INACTIVE', +index (campaign_id) +); + + CREATE TABLE vicidial_status_categories ( +vsc_id VARCHAR(20) PRIMARY KEY NOT NULL, +vsc_name VARCHAR(50), +vsc_description VARCHAR(255), +tovdad_display ENUM('Y','N') default 'N' +); + +CREATE TABLE vicidial_ivr ( +ivr_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +entry_time DATETIME, +length_in_sec SMALLINT(5) UNSIGNED default '0', +inbound_number VARCHAR(12), +recording_id INT(9) UNSIGNED, +recording_filename VARCHAR(50), +company_id VARCHAR(12), +phone_number VARCHAR(12), +lead_id INT(9) UNSIGNED, +campaign_id VARCHAR(20), +product_code VARCHAR(20), +user VARCHAR(20), +prompt_audio_1 VARCHAR(20), +prompt_response_1 TINYINT(1) UNSIGNED default '0', +prompt_audio_2 VARCHAR(20), +prompt_response_2 TINYINT(1) UNSIGNED default '0', +prompt_audio_3 VARCHAR(20), +prompt_response_3 TINYINT(1) UNSIGNED default '0', +prompt_audio_4 VARCHAR(20), +prompt_response_4 TINYINT(1) UNSIGNED default '0', +prompt_audio_5 VARCHAR(20), +prompt_response_5 TINYINT(1) UNSIGNED default '0', +prompt_audio_6 VARCHAR(20), +prompt_response_6 TINYINT(1) UNSIGNED default '0', +prompt_audio_7 VARCHAR(20), +prompt_response_7 TINYINT(1) UNSIGNED default '0', +prompt_audio_8 VARCHAR(20), +prompt_response_8 TINYINT(1) UNSIGNED default '0', +prompt_audio_9 VARCHAR(20), +prompt_response_9 TINYINT(1) UNSIGNED default '0', +prompt_audio_10 VARCHAR(20), +prompt_response_10 TINYINT(1) UNSIGNED default '0', +index (phone_number), +index (entry_time) +); + +ALTER TABLE vicidial_ivr AUTO_INCREMENT = 1000000; + +CREATE TABLE vicidial_inbound_group_agents ( +user VARCHAR(20), +group_id VARCHAR(20), +group_rank TINYINT(1) default '0', +group_weight TINYINT(1) default '0', +calls_today SMALLINT(5) UNSIGNED default '0', +index (group_id), +index (user) +); + +CREATE TABLE vicidial_live_inbound_agents ( +user VARCHAR(20), +group_id VARCHAR(20), +group_weight TINYINT(1) default '0', +calls_today SMALLINT(5) UNSIGNED default '0', +last_call_time DATETIME, +last_call_finish DATETIME, +index (group_id), +index (group_weight) +); + +CREATE TABLE vicidial_campaign_agents ( +user VARCHAR(20), +campaign_id VARCHAR(20), +campaign_rank TINYINT(1) default '0', +campaign_weight TINYINT(1) default '0', +calls_today SMALLINT(5) UNSIGNED default '0', +index (campaign_id), +index (user) +); + + +INSERT INTO vicidial_lists SET list_id='999',list_name='Default inbound list',campaign_id='TESTCAMP',active='N'; + +INSERT INTO system_settings (version,install_date) values('2.0.X', CURDATE()); + +INSERT INTO vicidial_status_categories (vsc_id,vsc_name) values('UNDEFINED','Default Category'); + +INSERT INTO vicidial_user_groups SET user_group='ADMIN',group_name='VICIDIAL ADMINISTRATORS',allowed_campaigns=' -ALL-CAMPAIGNS- - -'; + +INSERT INTO vicidial_call_times SET call_time_id='24hours',call_time_name='default 24 hours calling',ct_default_start='0',ct_default_stop='2400'; +INSERT INTO vicidial_call_times SET call_time_id='9am-9pm',call_time_name='default 9am to 9pm calling',ct_default_start='900',ct_default_stop='2100'; +INSERT INTO vicidial_call_times SET call_time_id='9am-5pm',call_time_name='default 9am to 5pm calling',ct_default_start='900',ct_default_stop='1700'; +INSERT INTO vicidial_call_times SET call_time_id='12pm-5pm',call_time_name='default 12pm to 5pm calling',ct_default_start='1200',ct_default_stop='1700'; +INSERT INTO vicidial_call_times SET call_time_id='12pm-9pm',call_time_name='default 12pm to 9pm calling',ct_default_start='1200',ct_default_stop='1200'; +INSERT INTO vicidial_call_times SET call_time_id='5pm-9pm',call_time_name='default 5pm to 9pm calling',ct_default_start='1700',ct_default_stop='2100'; + +INSERT INTO vicidial_state_call_times SET state_call_time_id='alabama',state_call_time_state='AL',state_call_time_name='Alabama 8am-8pm and Sunday',sct_default_start='800',sct_default_stop='2000',sct_sunday_start='2400',sct_sunday_stop='2400'; +INSERT INTO vicidial_state_call_times SET state_call_time_id='illinois',state_call_time_state='IL',state_call_time_name='Illinois 8am',sct_default_start='800',sct_default_stop='2100'; +INSERT INTO vicidial_state_call_times SET state_call_time_id='indiana',state_call_time_state='IN',state_call_time_name='Indiana 8pm restriction',sct_default_start='900',sct_default_stop='2000'; +INSERT INTO vicidial_state_call_times SET state_call_time_id='kentucky',state_call_time_state='KY',state_call_time_name='Kentucky 10am restriction',sct_default_start='1000',sct_default_stop='2100'; +INSERT INTO vicidial_state_call_times SET state_call_time_id='louisiana',state_call_time_state='LA',state_call_time_name='Louisiana 8am-8pm and Sunday',sct_default_start='800',sct_default_stop='2000',sct_sunday_start='2400',sct_sunday_stop='2400'; +INSERT INTO vicidial_state_call_times SET state_call_time_id='massachuse',state_call_time_state='MA',state_call_time_name='Massachusetts 8am-8pm',sct_default_start='800',sct_default_stop='2000'; +INSERT INTO vicidial_state_call_times SET state_call_time_id='mississipp',state_call_time_state='MS',state_call_time_name='Mississippi 8am-8pm and Sunday',sct_default_start='800',sct_default_stop='2000',sct_sunday_start='2400',sct_sunday_stop='2400'; +INSERT INTO vicidial_state_call_times SET state_call_time_id='nebraska',state_call_time_state='NE',state_call_time_name='Nebraska 8am',sct_default_start='800',sct_default_stop='2100'; +INSERT INTO vicidial_state_call_times SET state_call_time_id='nevada',state_call_time_state='NV',state_call_time_name='Nevada 8pm restriction',sct_default_start='900',sct_default_stop='2000'; +INSERT INTO vicidial_state_call_times SET state_call_time_id='pennsylvan',state_call_time_state='PA',state_call_time_name='Pennsylvania sunday restriction',sct_sunday_start='1330',sct_sunday_stop='2100'; +INSERT INTO vicidial_state_call_times SET state_call_time_id='rhodeislan',state_call_time_state='RI',state_call_time_name='Rhode Island restrictions',sct_default_start='900',sct_default_stop='1800',sct_sunday_start='2400',sct_sunday_stop='2400',sct_saturday_start='1000',sct_saturday_stop='1700'; +INSERT INTO vicidial_state_call_times SET state_call_time_id='sdakota',state_call_time_state='SD',state_call_time_name='South Dakota sunday restrict',sct_sunday_start='2400',sct_sunday_stop='2400'; +INSERT INTO vicidial_state_call_times SET state_call_time_id='tennessee',state_call_time_state='TN',state_call_time_name='Tennessee 8am',sct_default_start='800',sct_default_stop='2100'; +INSERT INTO vicidial_state_call_times SET state_call_time_id='texas',state_call_time_state='TX',state_call_time_name='Texas sunday restriction',sct_sunday_start='1200',sct_sunday_stop='2100'; +INSERT INTO vicidial_state_call_times SET state_call_time_id='utah',state_call_time_state='UT',state_call_time_name='Utah 8pm restriction',sct_default_start='900',sct_default_stop='2000'; +INSERT INTO vicidial_state_call_times SET state_call_time_id='washington',state_call_time_state='WA',state_call_time_name='Washington 8am',sct_default_start='800',sct_default_stop='2100'; +INSERT INTO vicidial_state_call_times SET state_call_time_id='wyoming',state_call_time_state='WY',state_call_time_name='Wyoming 8am-8pm',sct_default_start='800',sct_default_stop='2000'; + diff --git a/agc_2-X/branches/agc_2.0.4/extras/Net/HTTP/Methods.pm b/agc_2-X/branches/agc_2.0.4/extras/Net/HTTP/Methods.pm new file mode 100644 index 00000000..b1b2115f --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/extras/Net/HTTP/Methods.pm @@ -0,0 +1,520 @@ +package Net::HTTP::Methods; + +# $Id: Methods.pm,v 1.12 2002/12/26 09:13:55 gisle Exp $ + +require 5.005; # 4-arg substr + +use strict; +use vars qw($VERSION); + +$VERSION = "1.00"; + +my $CRLF = "\015\012"; # "\r\n" is not portable + +sub new { + my($class, %cnf) = @_; + require Symbol; + my $self = bless Symbol::gensym(), $class; + return $self->http_configure(\%cnf); +} + +sub http_configure { + my($self, $cnf) = @_; + + die "Listen option not allowed" if $cnf->{Listen}; + my $host = delete $cnf->{Host}; + my $peer = $cnf->{PeerAddr} || $cnf->{PeerHost}; + if ($host) { + $cnf->{PeerAddr} = $host unless $peer; + } + else { + $host = $peer; + $host =~ s/:.*//; + } + $cnf->{PeerPort} = $self->http_default_port unless $cnf->{PeerPort}; + $cnf->{Proto} = 'tcp'; + + my $keep_alive = delete $cnf->{KeepAlive}; + my $http_version = delete $cnf->{HTTPVersion}; + $http_version = "1.1" unless defined $http_version; + my $peer_http_version = delete $cnf->{PeerHTTPVersion}; + $peer_http_version = "1.0" unless defined $peer_http_version; + my $send_te = delete $cnf->{SendTE}; + my $max_line_length = delete $cnf->{MaxLineLength}; + $max_line_length = 4*1024 unless defined $max_line_length; + my $max_header_lines = delete $cnf->{MaxHeaderLines}; + $max_header_lines = 128 unless defined $max_header_lines; + + return undef unless $self->http_connect($cnf); + + unless ($host =~ /:/) { + my $p = $self->peerport; + $host .= ":$p"; + } + $self->host($host); + $self->keep_alive($keep_alive); + $self->send_te($send_te); + $self->http_version($http_version); + $self->peer_http_version($peer_http_version); + $self->max_line_length($max_line_length); + $self->max_header_lines($max_header_lines); + + ${*$self}{'http_buf'} = ""; + + return $self; +} + +sub http_default_port { + 80; +} + +# set up property accessors +for my $method (qw(host keep_alive send_te max_line_length max_header_lines peer_http_version)) { + my $prop_name = "http_" . $method; + no strict 'refs'; + *$method = sub { + my $self = shift; + my $old = ${*$self}{$prop_name}; + ${*$self}{$prop_name} = shift if @_; + return $old; + }; +} + +# we want this one to be a bit smarter +sub http_version { + my $self = shift; + my $old = ${*$self}{'http_version'}; + if (@_) { + my $v = shift; + $v = "1.0" if $v eq "1"; # float + unless ($v eq "1.0" or $v eq "1.1") { + require Carp; + Carp::croak("Unsupported HTTP version '$v'"); + } + ${*$self}{'http_version'} = $v; + } + $old; +} + +sub format_request { + my $self = shift; + my $method = shift; + my $uri = shift; + + my $content = (@_ % 2) ? pop : ""; + + for ($method, $uri) { + require Carp; + Carp::croak("Bad method or uri") if /\s/ || !length; + } + + push(@{${*$self}{'http_request_method'}}, $method); + my $ver = ${*$self}{'http_version'}; + my $peer_ver = ${*$self}{'http_peer_http_version'} || "1.0"; + + my @h; + my @connection; + my %given = (host => 0, "content-length" => 0, "te" => 0); + while (@_) { + my($k, $v) = splice(@_, 0, 2); + my $lc_k = lc($k); + if ($lc_k eq "connection") { + push(@connection, split(/\s*,\s*/, $v)); + next; + } + if (exists $given{$lc_k}) { + $given{$lc_k}++; + } + push(@h, "$k: $v"); + } + + if (length($content) && !$given{'content-length'}) { + push(@h, "Content-Length: " . length($content)); + } + + my @h2; + if ($given{te}) { + push(@connection, "TE") unless grep lc($_) eq "te", @connection; + } + elsif ($self->send_te && zlib_ok()) { + # gzip is less wanted since the Compress::Zlib interface for + # it does not really allow chunked decoding to take place easily. + push(@h2, "TE: deflate,gzip;q=0.3"); + push(@connection, "TE"); + } + + unless (grep lc($_) eq "close", @connection) { + if ($self->keep_alive) { + if ($peer_ver eq "1.0") { + # from looking at Netscape's headers + push(@h2, "Keep-Alive: 300"); + unshift(@connection, "Keep-Alive"); + } + } + else { + push(@connection, "close") if $ver ge "1.1"; + } + } + push(@h2, "Connection: " . join(", ", @connection)) if @connection; + push(@h2, "Host: ${*$self}{'http_host'}") unless $given{host}; + + return join($CRLF, "$method $uri HTTP/$ver", @h2, @h, "", $content); +} + + +sub write_request { + my $self = shift; + $self->print($self->format_request(@_)); +} + +sub format_chunk { + my $self = shift; + return $_[0] unless defined($_[0]) && length($_[0]); + return sprintf("%x", length($_[0])) . $CRLF . $_[0] . $CRLF; +} + +sub write_chunk { + my $self = shift; + return 1 unless defined($_[0]) && length($_[0]); + $self->print(sprintf("%x", length($_[0])) . $CRLF . $_[0] . $CRLF); +} + +sub format_chunk_eof { + my $self = shift; + my @h; + while (@_) { + push(@h, sprintf "%s: %s$CRLF", splice(@_, 0, 2)); + } + return join("", "0$CRLF", @h, $CRLF); +} + +sub write_chunk_eof { + my $self = shift; + $self->print($self->format_chunk_eof(@_)); +} + + +sub my_read { + die if @_ > 3; + my $self = shift; + my $len = $_[1]; + for (${*$self}{'http_buf'}) { + if (length) { + $_[0] = substr($_, 0, $len, ""); + return length($_[0]); + } + else { + return $self->sysread($_[0], $len); + } + } +} + + +sub my_readline { + my $self = shift; + for (${*$self}{'http_buf'}) { + my $max_line_length = ${*$self}{'http_max_line_length'}; + my $pos; + while (1) { + # find line ending + $pos = index($_, "\012"); + last if $pos >= 0; + die "Line too long (limit is $max_line_length)" + if $max_line_length && length($_) > $max_line_length; + + # need to read more data to find a line ending + my $n = $self->sysread($_, 1024, length); + if (!$n) { + return undef unless length; + return substr($_, 0, length, ""); + } + } + die "Line too long ($pos; limit is $max_line_length)" + if $max_line_length && $pos > $max_line_length; + + my $line = substr($_, 0, $pos+1, ""); + $line =~ s/(\015?\012)\z// || die "Assert"; + return wantarray ? ($line, $1) : $line; + } +} + + +sub _rbuf { + my $self = shift; + if (@_) { + for (${*$self}{'http_buf'}) { + my $old; + $old = $_ if defined wantarray; + $_ = shift; + return $old; + } + } + else { + return ${*$self}{'http_buf'}; + } +} + +sub _rbuf_length { + my $self = shift; + return length ${*$self}{'http_buf'}; +} + + +sub _read_header_lines { + my $self = shift; + my $junk_out = shift; + + my @headers; + my $line_count = 0; + my $max_header_lines = ${*$self}{'http_max_header_lines'}; + while (my $line = my_readline($self)) { + if ($line =~ /^(\S+)\s*:\s*(.*)/s) { + push(@headers, $1, $2); + } + elsif (@headers && $line =~ s/^\s+//) { + $headers[-1] .= " " . $line; + } + elsif ($junk_out) { + push(@$junk_out, $line); + } + else { + die "Bad header: '$line'\n"; + } + if ($max_header_lines) { + $line_count++; + if ($line_count >= $max_header_lines) { + die "Too many header lines (limit is $max_header_lines)"; + } + } + } + return @headers; +} + + +sub read_response_headers { + my($self, %opt) = @_; + my $laxed = $opt{laxed}; + + my($status, $eol) = my_readline($self); + unless (defined $status) { + die "EOF instead of response status line" unless $laxed; + # assume HTTP/0.9 + ${*$self}{'http_peer_http_version'} = "0.9"; + ${*$self}{'http_status'} = "200"; + return 200 unless wantarray; + return (200, "EOF"); + } + + my($peer_ver, $code, $message) = split(/\s+/, $status, 3); + if (!$peer_ver || $peer_ver !~ s,^HTTP/,, || $code !~ /^[1-5]\d\d$/) { + die "Bad response status line: '$status'" unless $laxed; + # assume HTTP/0.9 + ${*$self}{'http_peer_http_version'} = "0.9"; + ${*$self}{'http_status'} = "200"; + substr(${*$self}{'http_buf'}, 0, 0) = $status . $eol; + return 200 unless wantarray; + return (200, "Assumed OK"); + }; + + ${*$self}{'http_peer_http_version'} = $peer_ver; + ${*$self}{'http_status'} = $code; + + my $junk_out; + if ($laxed) { + $junk_out = $opt{junk_out} || []; + } + my @headers = $self->_read_header_lines($junk_out); + + # pick out headers that read_entity_body might need + my @te; + my $content_length; + for (my $i = 0; $i < @headers; $i += 2) { + my $h = lc($headers[$i]); + if ($h eq 'transfer-encoding') { + push(@te, $headers[$i+1]); + } + elsif ($h eq 'content-length') { + $content_length = $headers[$i+1]; + } + } + ${*$self}{'http_te'} = join(",", @te); + ${*$self}{'http_content_length'} = $content_length; + ${*$self}{'http_first_body'}++; + delete ${*$self}{'http_trailers'}; + return $code unless wantarray; + return ($code, $message, @headers); +} + + +sub read_entity_body { + my $self = shift; + my $buf_ref = \$_[0]; + my $size = $_[1]; + die "Offset not supported yet" if $_[2]; + + my $chunked; + my $bytes; + + if (${*$self}{'http_first_body'}) { + ${*$self}{'http_first_body'} = 0; + delete ${*$self}{'http_chunked'}; + delete ${*$self}{'http_bytes'}; + my $method = shift(@{${*$self}{'http_request_method'}}); + my $status = ${*$self}{'http_status'}; + if ($method eq "HEAD" || $status =~ /^(?:1|[23]04)/) { + # these responses are always empty + $bytes = 0; + } + elsif (my $te = ${*$self}{'http_te'}) { + my @te = split(/\s*,\s*/, lc($te)); + die "Chunked must be last Transfer-Encoding '$te'" + unless pop(@te) eq "chunked"; + + for (@te) { + if ($_ eq "deflate" && zlib_ok()) { + #require Compress::Zlib; + my $i = Compress::Zlib::inflateInit(); + die "Can't make inflator" unless $i; + $_ = sub { scalar($i->inflate($_[0])) } + } + elsif ($_ eq "gzip" && zlib_ok()) { + #require Compress::Zlib; + my @buf; + $_ = sub { + push(@buf, $_[0]); + return Compress::Zlib::memGunzip(join("", @buf)) if $_[1]; + return ""; + }; + } + elsif ($_ eq "identity") { + $_ = sub { $_[0] }; + } + else { + die "Can't handle transfer encoding '$te'"; + } + } + + @te = reverse(@te); + + ${*$self}{'http_te2'} = @te ? \@te : ""; + $chunked = -1; + } + elsif (defined(my $content_length = ${*$self}{'http_content_length'})) { + $bytes = $content_length; + } + else { + # XXX Multi-Part types are self delimiting, but RFC 2616 says we + # only has to deal with 'multipart/byteranges' + + # Read until EOF + } + } + else { + $chunked = ${*$self}{'http_chunked'}; + $bytes = ${*$self}{'http_bytes'}; + } + + if (defined $chunked) { + # The state encoded in $chunked is: + # $chunked == 0: read CRLF after chunk, then chunk header + # $chunked == -1: read chunk header + # $chunked > 0: bytes left in current chunk to read + + if ($chunked <= 0) { + my $line = my_readline($self); + if ($chunked == 0) { + die "Missing newline after chunk data: '$line'" unless $line eq ""; + $line = my_readline($self); + } + my $chunk_len = $line; + $chunk_len =~ s/;.*//; # ignore potential chunk parameters + unless ($chunk_len =~ /^([\da-fA-F]+)\s*$/) { + die "Bad chunk-size in HTTP response: $line"; + } + $chunked = hex($1); + if ($chunked == 0) { + ${*$self}{'http_trailers'} = [$self->_read_header_lines]; + $$buf_ref = ""; + + my $n = 0; + if (my $transforms = delete ${*$self}{'http_te2'}) { + for (@$transforms) { + $$buf_ref = &$_($$buf_ref, 1); + } + $n = length($$buf_ref); + } + + # in case somebody tries to read more, make sure we continue + # to return EOF + delete ${*$self}{'http_chunked'}; + ${*$self}{'http_bytes'} = 0; + + return $n; + } + } + + my $n = $chunked; + $n = $size if $size && $size < $n; + $n = my_read($self, $$buf_ref, $n); + return undef unless defined $n; + + ${*$self}{'http_chunked'} = $chunked - $n; + + if ($n > 0) { + if (my $transforms = ${*$self}{'http_te2'}) { + for (@$transforms) { + $$buf_ref = &$_($$buf_ref, 0); + } + $n = length($$buf_ref); + $n = -1 if $n == 0; + } + } + return $n; + } + elsif (defined $bytes) { + unless ($bytes) { + $$buf_ref = ""; + return 0; + } + my $n = $bytes; + $n = $size if $size && $size < $n; + $n = my_read($self, $$buf_ref, $n); + return undef unless defined $n; + ${*$self}{'http_bytes'} = $bytes - $n; + return $n; + } + else { + # read until eof + $size ||= 8*1024; + return my_read($self, $$buf_ref, $size); + } +} + +sub get_trailers { + my $self = shift; + @{${*$self}{'http_trailers'} || []}; +} + +BEGIN { +my $zlib_ok; + +sub zlib_ok { + return $zlib_ok if defined $zlib_ok; + + # Try to load Compress::Zlib. + local $@; + local $SIG{__DIE__}; + $zlib_ok = 0; + + eval { + require Compress::Zlib; + Compress::Zlib->VERSION(1.10); + $zlib_ok++; + }; + + return $zlib_ok; +} + +} # BEGIN + +1; diff --git a/agc_2-X/branches/agc_2.0.4/extras/Net/HTTP/NB.pm b/agc_2-X/branches/agc_2.0.4/extras/Net/HTTP/NB.pm new file mode 100644 index 00000000..feeee310 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/extras/Net/HTTP/NB.pm @@ -0,0 +1,106 @@ +package Net::HTTP::NB; + +# $Id: NB.pm,v 1.5 2001/08/28 03:03:42 gisle Exp $ + +use strict; +use vars qw($VERSION @ISA); + +$VERSION = "0.02"; +require Net::HTTP; +@ISA=qw(Net::HTTP); + +sub sysread { + my $self = $_[0]; + if (${*$self}{'httpnb_read_count'}++) { + ${*$self}{'http_buf'} = ${*$self}{'httpnb_save'}; + die "Multi-read\n"; + } + my $buf; + my $offset = $_[3] || 0; + my $n = sysread($self, $_[1], $_[2], $offset); + ${*$self}{'httpnb_save'} .= substr($_[1], $offset); + return $n; +} + +sub read_response_headers { + my $self = shift; + ${*$self}{'httpnb_read_count'} = 0; + ${*$self}{'httpnb_save'} = ${*$self}{'http_buf'}; + my @h = eval { $self->SUPER::read_response_headers(@_) }; + if ($@) { + return if $@ eq "Multi-read\n"; + die; + } + return @h; +} + +sub read_entity_body { + my $self = shift; + ${*$self}{'httpnb_read_count'} = 0; + ${*$self}{'httpnb_save'} = ${*$self}{'http_buf'}; + # XXX I'm not so sure this does the correct thing in case of + # transfer-encoding tranforms + my $n = eval { $self->SUPER::read_entity_body(@_); }; + if ($@) { + $_[0] = ""; + return -1; + } + return $n; +} + +1; + +__END__ + +=head1 NAME + +Net::HTTP::NB - Non-blocking HTTP client + +=head1 SYNOPSIS + + use Net::HTTP::NB; + my $s = Net::HTTP::NB->new(Host => "www.perl.com) || die $@; + $s->write_request(GET => "/"); + + use IO::Select; + my $sel = IO::Select->new($s); + + READ_HEADER: { + die "Header timeout" unless $sel->can_read(10); + my($code, $mess, %h) = $s->read_response_headers; + redo READ_HEADER unless $code; + } + + while (1) { + die "Body timeout" unless $sel->can_read(10); + my $buf; + my $n = $s->read_entity_body($buf, 1024); + last unless $n; + print $buf; + } + +=head1 DESCRIPTION + +Same interface as C but it will never try multiple reads +when the read_response_headers() or read_entity_body() methods are +invoked. This make it possible to multiplex multiple Net::HTTP::NB +using select without risk blocking. + +If read_response_headers() did not see enough data to complete the +headers an empty list is returned. + +If read_entity_body() did not see new entity data in its read +the value -1 is returned. + +=head1 SEE ALSO + +L + +=head1 COPYRIGHT + +Copyright 2001 Gisle Aas. + +This library is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +=cut diff --git a/agc_2-X/branches/agc_2.0.4/extras/Net/Telnet.pm b/agc_2-X/branches/agc_2.0.4/extras/Net/Telnet.pm new file mode 100644 index 00000000..9f84fe31 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/extras/Net/Telnet.pm @@ -0,0 +1,5252 @@ +package Net::Telnet; + +## Copyright 1997, 2000, 2002 Jay Rogers. All rights reserved. +## This program is free software; you can redistribute it and/or +## modify it under the same terms as Perl itself. + +## See user documentation at the end of this file. Search for =head + +use strict; +require 5.002; + +## Module export. +use vars qw(@EXPORT_OK); +@EXPORT_OK = qw(TELNET_IAC TELNET_DONT TELNET_DO TELNET_WONT TELNET_WILL + TELNET_SB TELNET_GA TELNET_EL TELNET_EC TELNET_AYT TELNET_AO + TELNET_IP TELNET_BREAK TELNET_DM TELNET_NOP TELNET_SE + TELNET_EOR TELNET_ABORT TELNET_SUSP TELNET_EOF TELNET_SYNCH + TELOPT_BINARY TELOPT_ECHO TELOPT_RCP TELOPT_SGA TELOPT_NAMS + TELOPT_STATUS TELOPT_TM TELOPT_RCTE TELOPT_NAOL TELOPT_NAOP + TELOPT_NAOCRD TELOPT_NAOHTS TELOPT_NAOHTD TELOPT_NAOFFD + TELOPT_NAOVTS TELOPT_NAOVTD TELOPT_NAOLFD TELOPT_XASCII + TELOPT_LOGOUT TELOPT_BM TELOPT_DET TELOPT_SUPDUP + TELOPT_SUPDUPOUTPUT TELOPT_SNDLOC TELOPT_TTYPE TELOPT_EOR + TELOPT_TUID TELOPT_OUTMRK TELOPT_TTYLOC TELOPT_3270REGIME + TELOPT_X3PAD TELOPT_NAWS TELOPT_TSPEED TELOPT_LFLOW + TELOPT_LINEMODE TELOPT_XDISPLOC TELOPT_OLD_ENVIRON + TELOPT_AUTHENTICATION TELOPT_ENCRYPT TELOPT_NEW_ENVIRON + TELOPT_EXOPL); + +## Module import. +use Exporter (); +use Socket qw(AF_INET SOCK_STREAM inet_aton sockaddr_in); +use Symbol qw(qualify); + +## Base classes. +use vars qw(@ISA); +@ISA = qw(Exporter); +if (&_io_socket_include) { # successfully required module IO::Socket + push @ISA, "IO::Socket::INET"; +} +else { # perl version < 5.004 + require FileHandle; + push @ISA, "FileHandle"; +} + +## Global variables. +use vars qw($VERSION @Telopts); +$VERSION = "3.03"; +@Telopts = ("BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", "STATUS", + "TIMING MARK", "RCTE", "NAOL", "NAOP", "NAOCRD", "NAOHTS", + "NAOHTD", "NAOFFD", "NAOVTS", "NAOVTD", "NAOLFD", "EXTEND ASCII", + "LOGOUT", "BYTE MACRO", "DATA ENTRY TERMINAL", "SUPDUP", + "SUPDUP OUTPUT", "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD", + "TACACS UID", "OUTPUT MARKING", "TTYLOC", "3270 REGIME", "X.3 PAD", + "NAWS", "TSPEED", "LFLOW", "LINEMODE", "XDISPLOC", "OLD-ENVIRON", + "AUTHENTICATION", "ENCRYPT", "NEW-ENVIRON"); + + +########################### Public Methods ########################### + + +sub new { + my ($class) = @_; + my ( + $errmode, + $fh_open, + $host, + $self, + %args, + ); + local $_; + + ## Create a new object with defaults. + $self = $class->SUPER::new; + *$self->{net_telnet} = { + bin_mode => 0, + blksize => &_optimal_blksize(), + buf => "", + cmd_prompt => '/[\$%#>] $/', + cmd_rm_mode => "auto", + dumplog => '', + eofile => 1, + errormode => "die", + errormsg => "", + fdmask => '', + host => "localhost", + inputlog => '', + last_line => "", + last_prompt => "", + maxbufsize => 1_048_576, + num_wrote => 0, + ofs => "", + opened => '', + opt_cback => '', + opt_log => '', + opts => {}, + ors => "\n", + outputlog => '', + pending_errormsg => "", + port => 23, + pushback_buf => "", + rs => "\n", + subopt_cback => '', + telnet_mode => 1, + time_out => 10, + timedout => '', + unsent_opts => "", + }; + + ## Indicate that we'll accept an offer from remote side for it to echo + ## and suppress go aheads. + &_opt_accept($self, + { option => &TELOPT_ECHO, + is_remote => 1, + is_enable => 1 }, + { option => &TELOPT_SGA, + is_remote => 1, + is_enable => 1 }, + ); + + ## Parse the args. + if (@_ == 2) { # one positional arg given + $host = $_[1]; + } + elsif (@_ > 2) { # named args given + ## Get the named args. + (undef, %args) = @_; + + ## Parse all other named args. + foreach (keys %args) { + if (/^-?binmode$/i) { + $self->binmode($args{$_}); + } + elsif (/^-?cmd_remove_mode$/i) { + $self->cmd_remove_mode($args{$_}); + } + elsif (/^-?dump_log$/i) { + $self->dump_log($args{$_}); + } + elsif (/^-?errmode$/i) { + $errmode = $args{$_}; + } + elsif (/^-?fhopen$/i) { + $fh_open = $args{$_}; + } + elsif (/^-?host$/i) { + $host = $args{$_}; + } + elsif (/^-?input_log$/i) { + $self->input_log($args{$_}); + } + elsif (/^-?input_record_separator$/i or /^-?rs$/i) { + $self->input_record_separator($args{$_}); + } + elsif (/^-?option_log$/i) { + $self->option_log($args{$_}); + } + elsif (/^-?output_log$/i) { + $self->output_log($args{$_}); + } + elsif (/^-?output_record_separator$/i or /^-?ors$/i) { + $self->output_record_separator($args{$_}); + } + elsif (/^-?port$/i) { + $self->port($args{$_}); + } + elsif (/^-?prompt$/i) { + $self->prompt($args{$_}); + } + elsif (/^-?telnetmode$/i) { + $self->telnetmode($args{$_}); + } + elsif (/^-?timeout$/i) { + $self->timeout($args{$_}); + } + else { + &_croak($self, "bad named parameter \"$_\" given " . + "to " . ref($self) . "::new()"); + } + } + } + + if (defined $errmode) { # user wants to set errmode + $self->errmode($errmode); + } + + if (defined $fh_open) { # user wants us to attach to existing filehandle + $self->fhopen($fh_open) + or return; + } + elsif (defined $host) { # user wants us to open a connection to host + $self->host($host); + $self->open + or return; + } + + $self; +} # end sub new + + +sub DESTROY { +} # end sub DESTROY + + +sub binmode { + my ($self, $mode) = @_; + my ( + $prev, + $s, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{bin_mode}; + + if (@_ >= 2) { + unless (defined $mode) { + $mode = 0; + } + + $s->{bin_mode} = $mode; + } + + $prev; +} # end sub binmode + + +sub break { + my ($self) = @_; + my $s = *$self->{net_telnet}; + my $break_cmd = "\xff\xf3"; + + $s->{timedout} = ''; + + &_put($self, \$break_cmd, "break"); +} # end sub break + + +sub buffer { + my ($self) = @_; + my $s = *$self->{net_telnet}; + + \$s->{buf}; +} # end sub buffer + + +sub buffer_empty { + my ($self) = @_; + my ( + $buffer, + ); + + $buffer = $self->buffer; + $$buffer = ""; +} # end sub buffer_empty + + +sub close { + my ($self) = @_; + my $s = *$self->{net_telnet}; + + $s->{eofile} = 1; + $s->{opened} = ''; + close $self + if defined fileno($self); + + 1; +} # end sub close + + +sub cmd { + my ($self, @args) = @_; + my ( + $cmd_remove_mode, + $errmode, + $firstpos, + $last_prompt, + $lastpos, + $lines, + $ors, + $output, + $output_ref, + $prompt, + $remove_echo, + $rs, + $rs_len, + $s, + $telopt_echo, + $timeout, + %args, + ); + my $cmd = ""; + local $_; + + ## Init. + $self->timed_out(''); + $self->last_prompt(""); + $s = *$self->{net_telnet}; + $output = []; + $cmd_remove_mode = $self->cmd_remove_mode; + $errmode = $self->errmode; + $ors = $self->output_record_separator; + $prompt = $self->prompt; + $rs = $self->input_record_separator; + $timeout = $self->timeout; + + ## Parse args. + if (@_ == 2) { # one positional arg given + $cmd = $_[1]; + } + elsif (@_ > 2) { # named args given + ## Get the named args. + (undef, %args) = @_; + + ## Parse the named args. + foreach (keys %args) { + if (/^-?cmd_remove/i) { + $cmd_remove_mode = &_parse_cmd_remove_mode($self, $args{$_}); + } + elsif (/^-?errmode$/i) { + $errmode = &_parse_errmode($self, $args{$_}); + } + elsif (/^-?input_record_separator$/i or /^-?rs$/i) { + $rs = &_parse_input_record_separator($self, $args{$_}); + } + elsif (/^-?output$/i) { + $output_ref = $args{$_}; + if (defined($output_ref) and ref($output_ref) eq "ARRAY") { + $output = $output_ref; + } + } + elsif (/^-?output_record_separator$/i or /^-?ors$/i) { + $ors = $self->output_record_separator($args{$_}); + } + elsif (/^-?prompt$/i) { + $prompt = &_parse_prompt($self, $args{$_}); + } + elsif (/^-?string$/i) { + $cmd = $args{$_}; + } + elsif (/^-?timeout$/i) { + $timeout = &_parse_timeout($self, $args{$_}); + } + else { + &_croak($self, "bad named parameter \"$_\" given " . + "to " . ref($self) . "::cmd()"); + } + } + } + + ## Override some user settings. + local $s->{errormode} = "return"; + local $s->{time_out} = &_endtime($timeout); + $self->errmsg(""); + + ## Send command and wait for the prompt. + $self->put($cmd . $ors) + and ($lines, $last_prompt) = $self->waitfor($prompt); + + ## Check for failure. + $s->{errormode} = $errmode; + return $self->error("command timed-out") if $self->timed_out; + return $self->error($self->errmsg) if $self->errmsg ne ""; + + ## Save the most recently matched prompt. + $self->last_prompt($last_prompt); + + ## Split lines into an array, keeping record separator at end of line. + $firstpos = 0; + $rs_len = length $rs; + while (($lastpos = index($lines, $rs, $firstpos)) > -1) { + push(@$output, + substr($lines, $firstpos, $lastpos - $firstpos + $rs_len)); + $firstpos = $lastpos + $rs_len; + } + + if ($firstpos < length $lines) { + push @$output, substr($lines, $firstpos); + } + + ## Determine if we should remove the first line of output based + ## on the assumption that it's an echoed back command. + if ($cmd_remove_mode eq "auto") { + ## See if remote side told us they'd echo. + $telopt_echo = $self->option_state(&TELOPT_ECHO); + $remove_echo = $telopt_echo->{remote_enabled}; + } + else { # user explicitly told us how many lines to remove. + $remove_echo = $cmd_remove_mode; + } + + ## Get rid of possible echo back command. + while ($remove_echo--) { + shift @$output; + } + + ## Ensure at least a null string when there's no command output - so + ## "true" is returned in a list context. + unless (@$output) { + @$output = (""); + } + + ## Return command output via named arg, if requested. + if (defined $output_ref) { + if (ref($output_ref) eq "SCALAR") { + $$output_ref = join "", @$output; + } + elsif (ref($output_ref) eq "HASH") { + %$output_ref = @$output; + } + } + + wantarray ? @$output : 1; +} # end sub cmd + + +sub cmd_remove_mode { + my ($self, $mode) = @_; + my ( + $prev, + $s, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{cmd_rm_mode}; + + if (@_ >= 2) { + $s->{cmd_rm_mode} = &_parse_cmd_remove_mode($self, $mode); + } + + $prev; +} # end sub cmd_remove_mode + + +sub dump_log { + my ($self, $name) = @_; + my ( + $fh, + $s, + ); + + $s = *$self->{net_telnet}; + $fh = $s->{dumplog}; + + if (@_ >= 2) { + unless (defined $name) { + $name = ""; + } + + $fh = &_fname_to_handle($self, $name) + or return; + $s->{dumplog} = $fh; + } + + $fh; +} # end sub dump_log + + +sub eof { + my ($self) = @_; + + *$self->{net_telnet}{eofile}; +} # end sub eof + + +sub errmode { + my ($self, $mode) = @_; + my ( + $prev, + $s, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{errormode}; + + if (@_ >= 2) { + $s->{errormode} = &_parse_errmode($self, $mode); + } + + $prev; +} # end sub errmode + + +sub errmsg { + my ($self, @errmsgs) = @_; + my ( + $prev, + $s, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{errormsg}; + + if (@_ >= 2) { + $s->{errormsg} = join "", @errmsgs; + } + + $prev; +} # end sub errmsg + + +sub error { + my ($self, @errmsg) = @_; + my ( + $errmsg, + $func, + $mode, + $s, + @args, + ); + local $_; + + $s = *$self->{net_telnet}; + + if (@_ >= 2) { + ## Put error message in the object. + $errmsg = join "", @errmsg; + $s->{errormsg} = $errmsg; + + ## Do the error action as described by error mode. + $mode = $s->{errormode}; + if (ref($mode) eq "CODE") { + &$mode($errmsg); + return; + } + elsif (ref($mode) eq "ARRAY") { + ($func, @args) = @$mode; + &$func(@args); + return; + } + elsif ($mode =~ /^return$/i) { + return; + } + else { # die + if ($errmsg =~ /\n$/) { + die $errmsg; + } + else { + ## Die and append caller's line number to message. + &_croak($self, $errmsg); + } + } + } + else { + return $s->{errormsg} ne ""; + } +} # end sub error + + +sub fhopen { + my ($self, $fh) = @_; + my ( + $globref, + $s, + ); + + ## Convert given filehandle to a typeglob reference, if necessary. + $globref = &_qualify_fh($self, $fh); + + ## Ensure filehandle is already open. + return $self->error("fhopen filehandle isn't already open") + unless defined($globref) and defined(fileno $globref); + + ## Ensure we're closed. + $self->close; + + ## Save our private data. + $s = *$self->{net_telnet}; + + ## Switch ourself with the given filehandle. + *$self = *$globref; + + ## Restore our private data. + *$self->{net_telnet} = $s; + + ## Re-initialize ourself. + select((select($self), $|=1)[$[]); # don't buffer writes + $s = *$self->{net_telnet}; + $s->{blksize} = &_optimal_blksize((stat $self)[11]); + $s->{buf} = ""; + $s->{eofile} = ''; + $s->{errormsg} = ""; + vec($s->{fdmask}='', fileno($self), 1) = 1; + $s->{host} = ""; + $s->{last_line} = ""; + $s->{last_prompt} = ""; + $s->{num_wrote} = 0; + $s->{opened} = 1; + $s->{pending_errormsg} = ""; + $s->{port} = ''; + $s->{pushback_buf} = ""; + $s->{timedout} = ''; + $s->{unsent_opts} = ""; + &_reset_options($s->{opts}); + + 1; +} # end sub fhopen + + +sub get { + my ($self, %args) = @_; + my ( + $binmode, + $endtime, + $errmode, + $line, + $s, + $telnetmode, + $timeout, + ); + local $_; + + ## Init. + $s = *$self->{net_telnet}; + $timeout = $s->{time_out}; + $s->{timedout} = ''; + return if $s->{eofile}; + + ## Parse the named args. + foreach (keys %args) { + if (/^-?binmode$/i) { + $binmode = $args{$_}; + unless (defined $binmode) { + $binmode = 0; + } + } + elsif (/^-?errmode$/i) { + $errmode = &_parse_errmode($self, $args{$_}); + } + elsif (/^-?telnetmode$/i) { + $telnetmode = $args{$_}; + unless (defined $telnetmode) { + $telnetmode = 0; + } + } + elsif (/^-?timeout$/i) { + $timeout = &_parse_timeout($self, $args{$_}); + } + else { + &_croak($self, "bad named parameter \"$_\" given " . + "to " . ref($self) . "::get()"); + } + } + + ## If any args given, override corresponding instance data. + local $s->{errormode} = $errmode + if defined $errmode; + local $s->{bin_mode} = $binmode + if defined $binmode; + local $s->{telnet_mode} = $telnetmode + if defined $telnetmode; + + ## Set wall time when we time out. + $endtime = &_endtime($timeout); + + ## Try to send any waiting option negotiation. + if (length $s->{unsent_opts}) { + &_flush_opts($self); + } + + ## Try to read just the waiting data using return error mode. + { + local $s->{errormode} = "return"; + $s->{errormsg} = ""; + &_fillbuf($self, $s, 0); + } + + ## We're done if we timed-out and timeout value is set to "poll". + return $self->error($s->{errormsg}) + if ($s->{timedout} and defined($timeout) and $timeout == 0 + and !length $s->{buf}); + + ## We're done if we hit an error other than timing out. + if ($s->{errormsg} and !$s->{timedout}) { + if (!length $s->{buf}) { + return $self->error($s->{errormsg}); + } + else { # error encountered but there's some data in buffer + $s->{pending_errormsg} = $s->{errormsg}; + } + } + + ## Clear time-out error from first read. + $s->{timedout} = ''; + $s->{errormsg} = ""; + + ## If buffer is still empty, try to read according to user's timeout. + if (!length $s->{buf}) { + &_fillbuf($self, $s, $endtime) + or do { + return if $s->{timedout}; + + ## We've reached end-of-file. + $self->close; + return; + }; + } + + ## Extract chars from buffer. + $line = $s->{buf}; + $s->{buf} = ""; + + $line; +} # end sub get + + +sub getline { + my ($self, %args) = @_; + my ( + $binmode, + $endtime, + $errmode, + $len, + $line, + $offset, + $pos, + $rs, + $s, + $telnetmode, + $timeout, + ); + local $_; + + ## Init. + $s = *$self->{net_telnet}; + $s->{timedout} = ''; + return if $s->{eofile}; + $rs = $s->{rs}; + $timeout = $s->{time_out}; + + ## Parse the named args. + foreach (keys %args) { + if (/^-?binmode$/i) { + $binmode = $args{$_}; + unless (defined $binmode) { + $binmode = 0; + } + } + elsif (/^-?errmode$/i) { + $errmode = &_parse_errmode($self, $args{$_}); + } + elsif (/^-?input_record_separator$/i or /^-?rs$/i) { + $rs = &_parse_input_record_separator($self, $args{$_}); + } + elsif (/^-?telnetmode$/i) { + $telnetmode = $args{$_}; + unless (defined $telnetmode) { + $telnetmode = 0; + } + } + elsif (/^-?timeout$/i) { + $timeout = &_parse_timeout($self, $args{$_}); + } + else { + &_croak($self, "bad named parameter \"$_\" given " . + "to " . ref($self) . "::getline()"); + } + } + + ## If any args given, override corresponding instance data. + local $s->{bin_mode} = $binmode + if defined $binmode; + local $s->{errormode} = $errmode + if defined $errmode; + local $s->{telnet_mode} = $telnetmode + if defined $telnetmode; + + ## Set wall time when we time out. + $endtime = &_endtime($timeout); + + ## Try to send any waiting option negotiation. + if (length $s->{unsent_opts}) { + &_flush_opts($self); + } + + ## Keep reading into buffer until end-of-line is read. + $offset = 0; + while (($pos = index($s->{buf}, $rs, $offset)) == -1) { + $offset = length $s->{buf}; + &_fillbuf($self, $s, $endtime) + or do { + return if $s->{timedout}; + + ## We've reached end-of-file. + $self->close; + if (length $s->{buf}) { + return $s->{buf}; + } + else { + return; + } + }; + } + + ## Extract line from buffer. + $len = $pos + length $rs; + $line = substr($s->{buf}, 0, $len); + substr($s->{buf}, 0, $len) = ""; + + $line; +} # end sub getline + + +sub getlines { + my ($self, %args) = @_; + my ( + $binmode, + $errmode, + $line, + $rs, + $s, + $telnetmode, + $timeout, + ); + my $all = 1; + my @lines = (); + local $_; + + ## Init. + $s = *$self->{net_telnet}; + $s->{timedout} = ''; + return if $s->{eofile}; + $timeout = $s->{time_out}; + + ## Parse the named args. + foreach (keys %args) { + if (/^-?all$/i) { + $all = $args{$_}; + unless (defined $all) { + $all = ''; + } + } + elsif (/^-?binmode$/i) { + $binmode = $args{$_}; + unless (defined $binmode) { + $binmode = 0; + } + } + elsif (/^-?errmode$/i) { + $errmode = &_parse_errmode($self, $args{$_}); + } + elsif (/^-?input_record_separator$/i or /^-?rs$/i) { + $rs = &_parse_input_record_separator($self, $args{$_}); + } + elsif (/^-?telnetmode$/i) { + $telnetmode = $args{$_}; + unless (defined $telnetmode) { + $telnetmode = 0; + } + } + elsif (/^-?timeout$/i) { + $timeout = &_parse_timeout($self, $args{$_}); + } + else { + &_croak($self, "bad named parameter \"$_\" given " . + "to " . ref($self) . "::getlines()"); + } + } + + ## If any args given, override corresponding instance data. + local $s->{bin_mode} = $binmode + if defined $binmode; + local $s->{errormode} = $errmode + if defined $errmode; + local $s->{rs} = $rs + if defined $rs; + local $s->{telnet_mode} = $telnetmode + if defined $telnetmode; + local $s->{time_out} = &_endtime($timeout); + + ## User requested only the currently available lines. + if (! $all) { + return &_next_getlines($self, $s); + } + + ## Read lines until eof or error. + while (1) { + $line = $self->getline + or last; + push @lines, $line; + } + + ## Check for error. + return if ! $self->eof; + + @lines; +} # end sub getlines + + +sub host { + my ($self, $host) = @_; + my ( + $prev, + $s, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{host}; + + if (@_ >= 2) { + unless (defined $host) { + $host = ""; + } + + $s->{host} = $host; + } + + $prev; +} # end sub host + + +sub input_log { + my ($self, $name) = @_; + my ( + $fh, + $s, + ); + + $s = *$self->{net_telnet}; + $fh = $s->{inputlog}; + + if (@_ >= 2) { + unless (defined $name) { + $name = ""; + } + + $fh = &_fname_to_handle($self, $name) + or return; + $s->{inputlog} = $fh; + } + + $fh; +} # end sub input_log + + +sub input_record_separator { + my ($self, $rs) = @_; + my ( + $prev, + $s, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{rs}; + + if (@_ >= 2) { + $s->{rs} = &_parse_input_record_separator($self, $rs); + } + + $prev; +} # end sub input_record_separator + + +sub last_prompt { + my ($self, $string) = @_; + my ( + $prev, + $s, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{last_prompt}; + + if (@_ >= 2) { + unless (defined $string) { + $string = ""; + } + + $s->{last_prompt} = $string; + } + + $prev; +} # end sub last_prompt + + +sub lastline { + my ($self, $line) = @_; + my ( + $prev, + $s, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{last_line}; + + if (@_ >= 2) { + unless (defined $line) { + $line = ""; + } + + $s->{last_line} = $line; + } + + $prev; +} # end sub lastline + + +sub login { + my ($self) = @_; + my ( + $errmode, + $error, + $is_passwd_arg, + $is_username_arg, + $lastline, + $match, + $ors, + $passwd, + $prematch, + $prompt, + $s, + $timeout, + $username, + %args, + ); + local $_; + + ## Init. + $self->timed_out(''); + $self->last_prompt(""); + $s = *$self->{net_telnet}; + $timeout = $self->timeout; + $ors = $self->output_record_separator; + $prompt = $self->prompt; + + ## Parse args. + if (@_ == 3) { # just username and passwd given + $username = $_[1]; + $passwd = $_[2]; + + $is_username_arg = 1; + $is_passwd_arg = 1; + } + else { # named args given + ## Get the named args. + (undef, %args) = @_; + + ## Parse the named args. + foreach (keys %args) { + if (/^-?errmode$/i) { + $errmode = &_parse_errmode($self, $args{$_}); + } + elsif (/^-?name$/i) { + $username = $args{$_}; + unless (defined $username) { + $username = ""; + } + + $is_username_arg = 1; + } + elsif (/^-?pass/i) { + $passwd = $args{$_}; + unless (defined $passwd) { + $passwd = ""; + } + + $is_passwd_arg = 1; + } + elsif (/^-?prompt$/i) { + $prompt = &_parse_prompt($self, $args{$_}); + } + elsif (/^-?timeout$/i) { + $timeout = &_parse_timeout($self, $args{$_}); + } + else { + &_croak($self, "bad named parameter \"$_\" given ", + "to " . ref($self) . "::login()"); + } + } + } + + ## Ensure both username and password argument given. + &_croak($self,"Name argument not given to " . ref($self) . "::login()") + unless $is_username_arg; + &_croak($self,"Password argument not given to " . ref($self) . "::login()") + unless $is_passwd_arg; + + ## Override some user settings. + local $s->{errormode} = $errmode + if defined $errmode; + local $s->{time_out} = &_endtime($timeout); + + ## Create a subroutine to generate an error. + $error + = sub { + my ($errmsg) = @_; + + if ($self->timed_out) { + return $self->error($errmsg); + } + elsif ($self->eof) { + ($lastline = $self->lastline) =~ s/\n+//; + return $self->error($errmsg, ": ", $lastline); + } + else { + return $self->error($self->errmsg); + } + }; + + + return $self->error("login failed: filehandle isn't open") + if $self->eof; + + ## Wait for login prompt. + $self->waitfor(Match => '/login[: ]*$/i', + Match => '/username[: ]*$/i', + Errmode => "return") + or do { + return &$error("eof read waiting for login prompt") + if $self->eof; + return &$error("timed-out waiting for login prompt"); + }; + + ## Delay sending response because of bug in Linux login program. + &_sleep(0.01); + + ## Send login name. + $self->put(String => $username . $ors, + Errmode => "return") + or return &$error("login disconnected"); + + ## Wait for password prompt. + $self->waitfor(Match => '/password[: ]*$/i', + Errmode => "return") + or do { + return &$error("eof read waiting for password prompt") + if $self->eof; + return &$error("timed-out waiting for password prompt"); + }; + + ## Delay sending response because of bug in Linux login program. + &_sleep(0.01); + + ## Send password. + $self->put(String => $passwd . $ors, + Errmode => "return") + or return &$error("login disconnected"); + + ## Wait for command prompt or another login prompt. + ($prematch, $match) = $self->waitfor(Match => '/login[: ]*$/i', + Match => '/username[: ]*$/i', + Match => $prompt, + Errmode => "return") + or do { + return &$error("eof read waiting for command prompt") + if $self->eof; + return &$error("timed-out waiting for command prompt"); + }; + + ## It's a bad login if we got another login prompt. + return $self->error("login failed: bad name or password") + if $match =~ /login[: ]*$/i or $match =~ /username[: ]*$/i; + + ## Save the most recently matched command prompt. + $self->last_prompt($match); + + 1; +} # end sub login + + +sub max_buffer_length { + my ($self, $maxbufsize) = @_; + my ( + $prev, + $s, + ); + my $minbufsize = 512; + + $s = *$self->{net_telnet}; + $prev = $s->{maxbufsize}; + + if (@_ >= 2) { + ## Ensure a positive integer value. + unless (defined $maxbufsize + and $maxbufsize =~ /^\d+$/ + and $maxbufsize) + { + &_carp($self, "ignoring bad Max_buffer_length " . + "argument \"$maxbufsize\": it's not a positive integer"); + $maxbufsize = $prev; + } + + ## Adjust up values that are too small. + if ($maxbufsize < $minbufsize) { + $maxbufsize = $minbufsize; + } + + $s->{maxbufsize} = $maxbufsize; + } + + $prev; +} # end sub max_buffer_length + + +## Make ofs() synonymous with output_field_separator(). +*ofs = \&output_field_separator; + + +sub open { + my ($self) = @_; + my ( + $errmode, + $errno, + $host, + $ip_addr, + $port, + $s, + $timeout, + %args, + ); + local $_; + + ## Init. + $s = *$self->{net_telnet}; + $timeout = $s->{time_out}; + $s->{timedout} = ''; + + if (@_ == 2) { # one positional arg given + $self->host($_[1]); + } + elsif (@_ > 2) { # named args given + ## Get the named args. + (undef, %args) = @_; + + ## Parse the named args. + foreach (keys %args) { + if (/^-?errmode$/i) { + $errmode = &_parse_errmode($self, $args{$_}); + } + elsif (/^-?host$/i) { + $self->host($args{$_}); + } + elsif (/^-?port$/i) { + $self->port($args{$_}) + or return; + } + elsif (/^-?timeout$/i) { + $timeout = &_parse_timeout($self, $args{$_}); + } + else { + &_croak($self, "bad named parameter \"$_\" given ", + "to " . ref($self) . "::open()"); + } + } + } + + ## If any args given, override corresponding instance data. + local $s->{errormode} = $errmode + if defined $errmode; + + ## Get host and port. + $host = $self->host; + $port = $self->port; + + ## Ensure we're already closed. + $self->close; + + ## Connect with or without a timeout. + if (defined($timeout) and &_have_alarm) { # use a timeout + ## Convert possible absolute timeout to relative timeout. + if ($timeout >= $^T) { # it's an absolute time + $timeout = $timeout - time; + } + + ## Ensure a valid timeout value for alarm. + if ($timeout < 1) { + $timeout = 1; + } + $timeout = int($timeout + 1.5); + + ## Connect to server, timing out if it takes too long. + eval { + ## Turn on timer. + local $SIG{"__DIE__"} = "DEFAULT"; + local $SIG{ALRM} = sub { die "timed-out\n" }; + alarm $timeout; + + ## Lookup server's IP address. + $ip_addr = inet_aton $host + or die "unknown remote host: $host\n"; + + ## Create a socket and attach the filehandle to it. + socket $self, AF_INET, SOCK_STREAM, 0 + or die "problem creating socket: $!\n"; + + ## Open connection to server. + connect $self, sockaddr_in($port, $ip_addr) + or die "problem connecting to \"$host\", port $port: $!\n"; + }; + alarm 0; + + ## Check for error. + if ($@ =~ /^timed-out$/) { # time out failure + $s->{timedout} = 1; + $self->close; + if (!$ip_addr) { + return $self->error("unknown remote host: $host: ", + "name lookup timed-out"); + } + else { + return $self->error("problem connecting to \"$host\", ", + "port $port: connect timed-out"); + } + } + elsif ($@) { # hostname lookup or connect failure + $self->close; + chomp $@; + return $self->error($@); + } + } + else { # don't use a timeout + $timeout = undef; + + ## Lookup server's IP address. + $ip_addr = inet_aton $host + or return $self->error("unknown remote host: $host"); + + ## Create a socket and attach the filehandle to it. + socket $self, AF_INET, SOCK_STREAM, 0 + or return $self->error("problem creating socket: $!"); + + ## Open connection to server. + connect $self, sockaddr_in($port, $ip_addr) + or do { + $errno = "$!"; + $self->close; + return $self->error("problem connecting to \"$host\", ", + "port $port: $errno"); + }; + } + + select((select($self), $|=1)[$[]); # don't buffer writes + $s->{blksize} = &_optimal_blksize((stat $self)[11]); + $s->{buf} = ""; + $s->{eofile} = ''; + $s->{errormsg} = ""; + vec($s->{fdmask}='', fileno($self), 1) = 1; + $s->{last_line} = ""; + $s->{num_wrote} = 0; + $s->{opened} = 1; + $s->{pending_errormsg} = ""; + $s->{pushback_buf} = ""; + $s->{timedout} = ''; + $s->{unsent_opts} = ""; + &_reset_options($s->{opts}); + + 1; +} # end sub open + + +sub option_accept { + my ($self, @args) = @_; + my ( + $arg, + $option, + $s, + @opt_args, + ); + local $_; + + ## Init. + $s = *$self->{net_telnet}; + + ## Parse the named args. + while (($_, $arg) = splice @args, 0, 2) { + ## Verify and save arguments. + if (/^-?do$/i) { + ## Make sure a callback is defined. + return $self->error("usage: an option callback must already ", + "be defined when enabling with $_") + unless $s->{opt_cback}; + + $option = &_verify_telopt_arg($self, $arg, $_); + return unless defined $option; + push @opt_args, { option => $option, + is_remote => '', + is_enable => 1, + }; + } + elsif (/^-?dont$/i) { + $option = &_verify_telopt_arg($self, $arg, $_); + return unless defined $option; + push @opt_args, { option => $option, + is_remote => '', + is_enable => '', + }; + } + elsif (/^-?will$/i) { + ## Make sure a callback is defined. + return $self->error("usage: an option callback must already ", + "be defined when enabling with $_") + unless $s->{opt_cback}; + + $option = &_verify_telopt_arg($self, $arg, $_); + return unless defined $option; + push @opt_args, { option => $option, + is_remote => 1, + is_enable => 1, + }; + } + elsif (/^-?wont$/i) { + $option = &_verify_telopt_arg($self, $arg, $_); + return unless defined $option; + push @opt_args, { option => $option, + is_remote => 1, + is_enable => '', + }; + } + else { + return $self->error('usage: $obj->option_accept(' . + '[Do => $telopt,] ', + '[Dont => $telopt,] ', + '[Will => $telopt,] ', + '[Wont => $telopt,]'); + } + } + + ## Set "receive ok" for options specified. + &_opt_accept($self, @opt_args); +} # end sub option_accept + + +sub option_callback { + my ($self, $callback) = @_; + my ( + $prev, + $s, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{opt_cback}; + + if (@_ >= 2) { + unless (defined $callback and ref($callback) eq "CODE") { + &_carp($self, "ignoring Option_callback argument because it's " . + "not a code ref"); + $callback = $prev; + } + + $s->{opt_cback} = $callback; + } + + $prev; +} # end sub option_callback + + +sub option_log { + my ($self, $name) = @_; + my ( + $fh, + $s, + ); + + $s = *$self->{net_telnet}; + $fh = $s->{opt_log}; + + if (@_ >= 2) { + unless (defined $name) { + $name = ""; + } + + $fh = &_fname_to_handle($self, $name) + or return; + $s->{opt_log} = $fh; + } + + $fh; +} # end sub option_log + + +sub option_state { + my ($self, $option) = @_; + my ( + $opt_state, + $s, + %opt_state, + ); + + ## Ensure telnet option is non-negative integer. + $option = &_verify_telopt_arg($self, $option); + return unless defined $option; + + ## Init. + $s = *$self->{net_telnet}; + unless (defined $s->{opts}{$option}) { + &_set_default_option($s, $option); + } + + ## Return hashref to a copy of the values. + $opt_state = $s->{opts}{$option}; + %opt_state = %$opt_state; + \%opt_state; +} # end sub option_state + + +## Make ors() synonymous with output_record_separator(). +*ors = \&output_record_separator; + + +sub output_field_separator { + my ($self, $ofs) = @_; + my ( + $prev, + $s, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{ofs}; + + if (@_ >= 2) { + unless (defined $ofs) { + $ofs = ""; + } + + $s->{ofs} = $ofs; + } + + $prev; +} # end sub output_field_separator + + +sub output_log { + my ($self, $name) = @_; + my ( + $fh, + $s, + ); + + $s = *$self->{net_telnet}; + $fh = $s->{outputlog}; + + if (@_ >= 2) { + unless (defined $name) { + $name = ""; + } + + $fh = &_fname_to_handle($self, $name) + or return; + $s->{outputlog} = $fh; + } + + $fh; +} # end sub output_log + + +sub output_record_separator { + my ($self, $ors) = @_; + my ( + $prev, + $s, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{ors}; + + if (@_ >= 2) { + unless (defined $ors) { + $ors = ""; + } + + $s->{ors} = $ors; + } + + $prev; +} # end sub output_record_separator + + +sub port { + my ($self, $port) = @_; + my ( + $prev, + $s, + $service, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{port}; + + if (@_ >= 2) { + unless (defined $port) { + $port = ""; + } + + if (!$port) { + &_carp($self, "ignoring bad Port argument \"$port\""); + $port = $prev; + } + elsif ($port !~ /^\d+$/) { # port isn't all digits + $service = $port; + $port = getservbyname($service, "tcp"); + unless ($port) { + &_carp($self, "ignoring bad Port argument \"$service\": " . + "it's an unknown TCP service"); + $port = $prev; + } + } + + $s->{port} = $port; + } + + $prev; +} # end sub port + + +sub print { + my ($self) = shift; + my ( + $buf, + $fh, + $s, + ); + + $s = *$self->{net_telnet}; + $s->{timedout} = ''; + return $self->error("write error: filehandle isn't open") + unless $s->{opened}; + + ## Add field and record separators. + $buf = join($s->{ofs}, @_) . $s->{ors}; + + ## Log the output if requested. + if ($s->{outputlog}) { + &_log_print($s->{outputlog}, $buf); + } + + ## Convert native newlines to CR LF. + if (!$s->{bin_mode}) { + $buf =~ s(\n)(\015\012)g; + } + + ## Escape TELNET IAC and also CR not followed by LF. + if ($s->{telnet_mode}) { + $buf =~ s(\377)(\377\377)g; + &_escape_cr(\$buf); + } + + &_put($self, \$buf, "print"); +} # end sub print + + +sub print_length { + my ($self) = @_; + + *$self->{net_telnet}{num_wrote}; +} # end sub print_length + + +sub prompt { + my ($self, $prompt) = @_; + my ( + $prev, + $s, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{cmd_prompt}; + + ## Parse args. + if (@_ == 2) { + $s->{cmd_prompt} = &_parse_prompt($self, $prompt); + } + + $prev; +} # end sub prompt + + +sub put { + my ($self) = @_; + my ( + $binmode, + $buf, + $errmode, + $is_timeout_arg, + $s, + $telnetmode, + $timeout, + %args, + ); + local $_; + + ## Init. + $s = *$self->{net_telnet}; + $s->{timedout} = ''; + + ## Parse args. + if (@_ == 2) { # one positional arg given + $buf = $_[1]; + } + elsif (@_ > 2) { # named args given + ## Get the named args. + (undef, %args) = @_; + + ## Parse the named args. + foreach (keys %args) { + if (/^-?binmode$/i) { + $binmode = $args{$_}; + unless (defined $binmode) { + $binmode = 0; + } + } + elsif (/^-?errmode$/i) { + $errmode = &_parse_errmode($self, $args{$_}); + } + elsif (/^-?string$/i) { + $buf = $args{$_}; + } + elsif (/^-?telnetmode$/i) { + $telnetmode = $args{$_}; + unless (defined $telnetmode) { + $telnetmode = 0; + } + } + elsif (/^-?timeout$/i) { + $timeout = &_parse_timeout($self, $args{$_}); + $is_timeout_arg = 1; + } + else { + &_croak($self, "bad named parameter \"$_\" given ", + "to " . ref($self) . "::put()"); + } + } + } + + ## If any args given, override corresponding instance data. + local $s->{bin_mode} = $binmode + if defined $binmode; + local $s->{errormode} = $errmode + if defined $errmode; + local $s->{telnet_mode} = $telnetmode + if defined $telnetmode; + local $s->{time_out} = $timeout + if defined $is_timeout_arg; + + ## Check for errors. + return $self->error("write error: filehandle isn't open") + unless $s->{opened}; + + ## Log the output if requested. + if ($s->{outputlog}) { + &_log_print($s->{outputlog}, $buf); + } + + ## Convert native newlines to CR LF. + if (!$s->{bin_mode}) { + $buf =~ s(\n)(\015\012)g; + } + + ## Escape TELNET IAC and also CR not followed by LF. + if ($s->{telnet_mode}) { + $buf =~ s(\377)(\377\377)g; + &_escape_cr(\$buf); + } + + &_put($self, \$buf, "print"); +} # end sub put + + +## Make rs() synonymous input_record_separator(). +*rs = \&input_record_separator; + + +sub suboption_callback { + my ($self, $callback) = @_; + my ( + $prev, + $s, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{subopt_cback}; + + if (@_ >= 2) { + unless (defined $callback and ref($callback) eq "CODE") { + &_carp($self,"ignoring Suboption_callback argument because it's " . + "not a code ref"); + $callback = $prev; + } + + $s->{subopt_cback} = $callback; + } + + $prev; +} # end sub suboption_callback + + +sub telnetmode { + my ($self, $mode) = @_; + my ( + $prev, + $s, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{telnet_mode}; + + if (@_ >= 2) { + unless (defined $mode) { + $mode = 0; + } + + $s->{telnet_mode} = $mode; + } + + $prev; +} # end sub telnetmode + + +sub timed_out { + my ($self, $value) = @_; + my ( + $prev, + $s, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{timedout}; + + if (@_ >= 2) { + unless (defined $value) { + $value = ""; + } + + $s->{timedout} = $value; + } + + $prev; +} # end sub timed_out + + +sub timeout { + my ($self, $timeout) = @_; + my ( + $prev, + $s, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{time_out}; + + if (@_ >= 2) { + $s->{time_out} = &_parse_timeout($self, $timeout); + } + + $prev; +} # end sub timeout + + +sub waitfor { + my ($self, @args) = @_; + my ( + $arg, + $binmode, + $endtime, + $errmode, + $len, + $match, + $match_op, + $pos, + $prematch, + $s, + $search, + $search_cond, + $telnetmode, + $timeout, + @match_cond, + @match_ops, + @search_cond, + @string_cond, + @warns, + ); + local $_; + + ## Init. + $s = *$self->{net_telnet}; + $s->{timedout} = ''; + return if $s->{eofile}; + return unless @args; + $timeout = $s->{time_out}; + + ## Code template used to build string match conditional. + ## Values between array elements must be supplied later. + @string_cond = + ('if (($pos = index $s->{buf}, ', ') > -1) { + $len = ', '; + $prematch = substr $s->{buf}, 0, $pos; + $match = substr $s->{buf}, $pos, $len; + substr($s->{buf}, 0, $pos + $len) = ""; + last; + }'); + + ## Code template used to build pattern match conditional. + ## Values between array elements must be supplied later. + @match_cond = + ('if ($s->{buf} =~ ', ') { + $prematch = $`; + $match = $&; + substr($s->{buf}, 0, length($`) + length($&)) = ""; + last; + }'); + + ## Parse args. + if (@_ == 2) { # one positional arg given + $arg = $_[1]; + + ## Fill in the blanks in the code template. + push @match_ops, $arg; + push @search_cond, join("", $match_cond[0], $arg, $match_cond[1]); + } + elsif (@_ > 2) { # named args given + ## Parse the named args. + while (($_, $arg) = splice @args, 0, 2) { + if (/^-?binmode$/i) { + $binmode = $arg; + unless (defined $binmode) { + $binmode = 0; + } + } + elsif (/^-?errmode$/i) { + $errmode = &_parse_errmode($self, $arg); + } + elsif (/^-?match$/i) { + ## Fill in the blanks in the code template. + push @match_ops, $arg; + push @search_cond, join("", + $match_cond[0], $arg, $match_cond[1]); + } + elsif (/^-?string$/i) { + ## Fill in the blanks in the code template. + $arg =~ s/'/\\'/g; # quote ticks + push @search_cond, join("", + $string_cond[0], "'$arg'", + $string_cond[1], length($arg), + $string_cond[2]); + } + elsif (/^-?telnetmode$/i) { + $telnetmode = $arg; + unless (defined $telnetmode) { + $telnetmode = 0; + } + } + elsif (/^-?timeout$/i) { + $timeout = &_parse_timeout($self, $arg); + } + else { + &_croak($self, "bad named parameter \"$_\" given " . + "to " . ref($self) . "::waitfor()"); + } + } + } + + ## If any args given, override corresponding instance data. + local $s->{errormode} = $errmode + if defined $errmode; + local $s->{bin_mode} = $binmode + if defined $binmode; + local $s->{telnet_mode} = $telnetmode + if defined $telnetmode; + + ## Check for bad match operator argument. + foreach $match_op (@match_ops) { + return $self->error("missing opening delimiter of match operator ", + "in argument \"$match_op\" given to ", + ref($self) . "::waitfor()") + unless $match_op =~ m(^\s*/) or $match_op =~ m(^\s*m\s*\W); + } + + ## Construct conditional to check for requested string and pattern matches. + ## Turn subsequent "if"s into "elsif". + $search_cond = join "\n\tels", @search_cond; + + ## Construct loop to fill buffer until string/pattern, timeout, or eof. + $search = join "", " + while (1) {\n\t", + $search_cond, ' + &_fillbuf($self, $s, $endtime) + or do { + last if $s->{timedout}; + $self->close; + last; + }; + }'; + + ## Set wall time when we timeout. + $endtime = &_endtime($timeout); + + ## Run the loop. + { + local $^W = 1; + local $SIG{"__WARN__"} = sub { push @warns, @_ }; + local $s->{errormode} = "return"; + $s->{errormsg} = ""; + eval $search; + } + + ## Check for failure. + return $self->error("pattern match timed-out") if $s->{timedout}; + return $self->error($s->{errormsg}) if $s->{errormsg} ne ""; + return $self->error("pattern match read eof") if $s->{eofile}; + + ## Check for Perl syntax errors or warnings. + if ($@ or @warns) { + foreach $match_op (@match_ops) { + &_match_check($self, $match_op) + or return; + } + return $self->error($@) if $@; + return $self->error(@warns) if @warns; + } + + wantarray ? ($prematch, $match) : 1; +} # end sub waitfor + + +######################## Private Subroutines ######################### + + +sub _append_lineno { + my ($obj, @msgs) = @_; + my ( + $file, + $line, + $pkg, + ); + + ## Find the caller that's not in object's class or one of its base classes. + ($pkg, $file , $line) = &_user_caller($obj); + join("", @msgs, " at ", $file, " line ", $line, "\n"); +} # end sub _append_lineno + + +sub _carp { + warn &_append_lineno(@_); +} # end sub _carp + + +sub _croak { + die &_append_lineno(@_); +} # end sub _croak + + +sub _endtime { + my ($interval) = @_; + + ## Compute wall time when timeout occurs. + if (defined $interval) { + if ($interval >= $^T) { # it's already an absolute time + return $interval; + } + elsif ($interval > 0) { # it's relative to the current time + return int(time + 1.5 + $interval); + } + else { # it's a one time poll + return 0; + } + } + else { # there's no timeout + return undef; + } +} # end sub _endtime + + +sub _escape_cr { + my ($string) = @_; + my ( + $nextchar, + ); + my $pos = 0; + + ## Convert all CR (not followed by LF) to CR NULL. + while (($pos = index($$string, "\015", $pos)) > -1) { + $nextchar = substr $$string, $pos + 1, 1; + + substr($$string, $pos, 1) = "\015\000" + unless $nextchar eq "\012"; + + $pos++; + } + + 1; +} # end sub _escape_cr + + +sub _fillbuf { + my ($self, $s, $endtime) = @_; + my ( + $msg, + $nfound, + $nread, + $pushback_len, + $read_pos, + $ready, + $timed_out, + $timeout, + $unparsed_pos, + ); + + ## If error from last read not yet reported then do it now. + if ($s->{pending_errormsg}) { + $msg = $s->{pending_errormsg}; + $s->{pending_errormsg} = ""; + return $self->error($msg); + } + + return unless $s->{opened}; + + while (1) { + ## Maximum buffer size exceeded? + return $self->error("maximum input buffer length exceeded: ", + $s->{maxbufsize}, " bytes") + unless length($s->{buf}) <= $s->{maxbufsize}; + + ## Determine how long to wait for input ready. + ($timed_out, $timeout) = &_timeout_interval($endtime); + if ($timed_out) { + $s->{timedout} = 1; + return $self->error("read timed-out"); + } + + ## Wait for input ready. + $nfound = select $ready=$s->{fdmask}, "", "", $timeout; + + ## Handle any errors while waiting. + if (!defined $nfound or $nfound <= 0) { # input not ready + if (defined $nfound and $nfound == 0) { # timed-out + $s->{timedout} = 1; + return $self->error("read timed-out"); + } + else { # error waiting for input ready + next if $! =~ /^interrupted/i; + + $s->{opened} = ''; + return $self->error("read error: $!"); + } + } + + ## Append to buffer any partially processed telnet or CR sequence. + $pushback_len = length $s->{pushback_buf}; + if ($pushback_len) { + $s->{buf} .= $s->{pushback_buf}; + $s->{pushback_buf} = ""; + } + + ## Read the waiting data. + $read_pos = length $s->{buf}; + $unparsed_pos = $read_pos - $pushback_len; + $nread = sysread $self, $s->{buf}, $s->{blksize}, $read_pos; + + ## Handle any read errors. + if (!defined $nread) { # read failed + next if $! =~ /^interrupted/i; # restart interrupted syscall + + $s->{opened} = ''; + return $self->error("read error: $!"); + } + + ## Handle eof. + if ($nread == 0) { # eof read + $s->{opened} = ''; + return; + } + + ## Display network traffic if requested. + if ($s->{dumplog}) { + &_log_dump('<', $s->{dumplog}, \$s->{buf}, $read_pos); + } + + ## Process any telnet commands in the data stream. + if ($s->{telnet_mode} and index($s->{buf},"\377",$unparsed_pos) > -1) { + &_interpret_tcmd($self, $s, $unparsed_pos); + } + + ## Process any carriage-return sequences in the data stream. + &_interpret_cr($s, $unparsed_pos); + + ## Read again if all chars read were consumed as telnet cmds. + next if $unparsed_pos >= length $s->{buf}; + + ## Log the input if requested. + if ($s->{inputlog}) { + &_log_print($s->{inputlog}, substr($s->{buf}, $unparsed_pos)); + } + + ## Save the last line read. + &_save_lastline($s); + + ## We've successfully read some data into the buffer. + last; + } # end while(1) + + 1; +} # end sub _fillbuf + + +sub _flush_opts { + my ($self) = @_; + my ( + $option_chars, + ); + my $s = *$self->{net_telnet}; + + ## Get option and clear the output buf. + $option_chars = $s->{unsent_opts}; + $s->{unsent_opts} = ""; + + ## Try to send options without waiting. + { + local $s->{errormode} = "return"; + local $s->{time_out} = 0; + &_put($self, \$option_chars, "telnet option negotiation") + or do { + ## Save chars not printed for later. + substr($option_chars, 0, $self->print_length) = ""; + $s->{unsent_opts} .= $option_chars; + }; + } + + 1; +} # end sub _flush_opts + + +sub _fname_to_handle { + my ($self, $fh) = @_; + my ( + $filename, + ); + + ## Ensure valid input. + return "" + unless defined $fh and (ref $fh or length $fh); + + ## Open a new filehandle if input is a filename. + no strict "refs"; + if (!ref($fh) and !defined(fileno $fh)) { # fh is a filename + $filename = $fh; + $fh = &_new_handle(); + CORE::open $fh, "> $filename" + or return $self->error("problem creating $filename: $!"); + } + + select((select($fh), $|=1)[$[]); # don't buffer writes + $fh; +} # end sub _fname_to_handle + + +sub _have_alarm { + eval { + local $SIG{"__DIE__"} = "DEFAULT"; + local $SIG{ALRM} = sub { die }; + alarm 0; + }; + + ! $@; +} # end sub _have_alarm + + +sub _interpret_cr { + my ($s, $pos) = @_; + my ( + $nextchar, + ); + + while (($pos = index($s->{buf}, "\015", $pos)) > -1) { + $nextchar = substr($s->{buf}, $pos + 1, 1); + if ($nextchar eq "\0") { + ## Convert CR NULL to CR when in telnet mode. + if ($s->{telnet_mode}) { + substr($s->{buf}, $pos + 1, 1) = ""; + } + } + elsif ($nextchar eq "\012") { + ## Convert CR LF to newline when not in binary mode. + if (!$s->{bin_mode}) { + substr($s->{buf}, $pos, 2) = "\n"; + } + } + elsif (!length($nextchar) and ($s->{telnet_mode} or !$s->{bin_mode})) { + ## Save CR in alt buffer for possible CR LF or CR NULL conversion. + $s->{pushback_buf} .= "\015"; + chop $s->{buf}; + } + + $pos++; + } + + 1; +} # end sub _interpret_cr + + +sub _interpret_tcmd { + my ($self, $s, $offset) = @_; + my ( + $callback, + $endpos, + $nextchar, + $option, + $parameters, + $pos, + $subcmd, + ); + local $_; + + ## Parse telnet commands in the data stream. + $pos = $offset; + while (($pos = index $s->{buf}, "\377", $pos) > -1) { # unprocessed IAC + $nextchar = substr $s->{buf}, $pos + 1, 1; + + ## Save command if it's only partially read. + if (!length $nextchar) { + $s->{pushback_buf} .= "\377"; + chop $s->{buf}; + last; + } + + if ($nextchar eq "\377") { # IAC is escaping "\377" char + ## Remove escape char from data stream. + substr($s->{buf}, $pos, 1) = ""; + $pos++; + } + elsif ($nextchar eq "\375" or $nextchar eq "\373" or + $nextchar eq "\374" or $nextchar eq "\376") { # opt negotiation + $option = substr $s->{buf}, $pos + 2, 1; + + ## Save command if it's only partially read. + if (!length $option) { + $s->{pushback_buf} .= "\377" . $nextchar; + chop $s->{buf}; + chop $s->{buf}; + last; + } + + ## Remove command from data stream. + substr($s->{buf}, $pos, 3) = ""; + + ## Handle option negotiation. + &_negotiate_recv($self, $s, $nextchar, ord($option), $pos); + } + elsif ($nextchar eq "\372") { # start of subnegotiation parameters + ## Save command if it's only partially read. + $endpos = index $s->{buf}, "\360", $pos; + if ($endpos == -1) { + $s->{pushback_buf} .= substr $s->{buf}, $pos; + substr($s->{buf}, $pos) = ""; + last; + } + + ## Remove subnegotiation cmd from buffer. + $subcmd = substr($s->{buf}, $pos, $endpos - $pos + 1); + substr($s->{buf}, $pos, $endpos - $pos + 1) = ""; + + ## Invoke subnegotiation callback. + if ($s->{subopt_cback} and length($subcmd) >= 5) { + $option = unpack "C", substr($subcmd, 2, 1); + if (length($subcmd) >= 6) { + $parameters = substr $subcmd, 3, length($subcmd) - 5; + } + else { + $parameters = ""; + } + + $callback = $s->{subopt_cback}; + &$callback($self, $option, $parameters); + } + } + else { # various two char telnet commands + ## Ignore and remove command from data stream. + substr($s->{buf}, $pos, 2) = ""; + } + } + + ## Try to send any waiting option negotiation. + if (length $s->{unsent_opts}) { + &_flush_opts($self); + } + + 1; +} # end sub _interpret_tcmd + + +sub _io_socket_include { + local $SIG{"__DIE__"} = "DEFAULT"; + eval "require IO::Socket"; +} # end sub io_socket_include + + +sub _log_dump { + my ($direction, $fh, $data, $offset, $len) = @_; + my ( + $addr, + $hexvals, + $line, + ); + + $addr = 0; + $len = length($$data) - $offset + if !defined $len; + return 1 if $len <= 0; + + ## Print data in dump format. + while ($len > 0) { + ## Convert up to the next 16 chars to hex, padding w/ spaces. + if ($len >= 16) { + $line = substr $$data, $offset, 16; + } + else { + $line = substr $$data, $offset, $len; + } + $hexvals = unpack("H*", $line); + $hexvals .= ' ' x (32 - length $hexvals); + + ## Place in 16 columns, each containing two hex digits. + $hexvals = sprintf("%s %s %s %s " x 4, + unpack("a2" x 16, $hexvals)); + + ## For the ASCII column, change unprintable chars to a period. + $line =~ s/[\000-\037,\177-\237]/./g; + + ## Print the line in dump format. + &_log_print($fh, sprintf("%s 0x%5.5lx: %s%s\n", + $direction, $addr, $hexvals, $line)); + + $addr += 16; + $offset += 16; + $len -= 16; + } + + &_log_print($fh, "\n"); + + 1; +} # end sub _log_dump + + +sub _log_option { + my ($fh, $direction, $request, $option) = @_; + my ( + $name, + ); + + if ($option >= 0 and $option <= $#Telopts) { + $name = $Telopts[$option]; + } + else { + $name = $option; + } + + &_log_print($fh, "$direction $request $name\n"); +} # end sub _log_option + + +sub _log_print { + my ($fh, $buf) = @_; + local $\ = ''; + + if (ref($fh) and ref($fh) ne "GLOB") { # fh is blessed ref + $fh->print($buf); + } + else { # fh isn't blessed ref + print $fh $buf; + } +} # end sub _log_print + + +sub _match_check { + my ($self, $code) = @_; + my $error; + my @warns = (); + + ## Use eval to check for syntax errors or warnings. + { + local $SIG{"__DIE__"} = "DEFAULT"; + local $SIG{"__WARN__"} = sub { push @warns, @_ }; + local $^W = 1; + local $_ = ''; + eval "\$_ =~ $code;"; + } + if ($@) { + ## Remove useless lines numbers from message. + ($error = $@) =~ s/ at \(eval \d+\) line \d+.?//; + chomp $error; + return $self->error("bad match operator: $error"); + } + elsif (@warns) { + ## Remove useless lines numbers from message. + ($error = shift @warns) =~ s/ at \(eval \d+\) line \d+.?//; + $error =~ s/ while "strict subs" in use//; + chomp $error; + return $self->error("bad match operator: $error"); + } + + 1; +} # end sub _match_check + + +sub _negotiate_callback { + my ($self, $opt, $is_remote, $is_enabled, $was_enabled, $opt_bufpos) = @_; + my ( + $callback, + $s, + ); + local $_; + + ## Keep track of remote echo. + if ($is_remote and $opt == &TELOPT_ECHO) { # received WILL or WONT ECHO + $s = *$self->{net_telnet}; + + if ($is_enabled and !$was_enabled) { # received WILL ECHO + $s->{remote_echo} = 1; + } + elsif (!$is_enabled and $was_enabled) { # received WONT ECHO + $s->{remote_echo} = ''; + } + } + + ## Invoke callback, if there is one. + $callback = $self->option_callback; + if ($callback) { + &$callback($self, $opt, $is_remote, + $is_enabled, $was_enabled, $opt_bufpos); + } + + 1; +} # end sub _negotiate_callback + + +sub _negotiate_recv { + my ($self, $s, $opt_request, $opt, $opt_bufpos) = @_; + + ## Ensure data structure exists for this option. + unless (defined $s->{opts}{$opt}) { + &_set_default_option($s, $opt); + } + + ## Process the option. + if ($opt_request eq "\376") { # DONT + &_negotiate_recv_disable($self, $s, $opt, "dont", $opt_bufpos, + $s->{opts}{$opt}{local_enable_ok}, + \$s->{opts}{$opt}{local_enabled}, + \$s->{opts}{$opt}{local_state}); + } + elsif ($opt_request eq "\375") { # DO + &_negotiate_recv_enable($self, $s, $opt, "do", $opt_bufpos, + $s->{opts}{$opt}{local_enable_ok}, + \$s->{opts}{$opt}{local_enabled}, + \$s->{opts}{$opt}{local_state}); + } + elsif ($opt_request eq "\374") { # WONT + &_negotiate_recv_disable($self, $s, $opt, "wont", $opt_bufpos, + $s->{opts}{$opt}{remote_enable_ok}, + \$s->{opts}{$opt}{remote_enabled}, + \$s->{opts}{$opt}{remote_state}); + } + elsif ($opt_request eq "\373") { # WILL + &_negotiate_recv_enable($self, $s, $opt, "will", $opt_bufpos, + $s->{opts}{$opt}{remote_enable_ok}, + \$s->{opts}{$opt}{remote_enabled}, + \$s->{opts}{$opt}{remote_state}); + } + else { # internal error + die; + } + + 1; +} # end sub _negotiate_recv + + +sub _negotiate_recv_disable { + my ($self, $s, $opt, $opt_request, + $opt_bufpos, $enable_ok, $is_enabled, $state) = @_; + my ( + $ack, + $disable_cmd, + $enable_cmd, + $is_remote, + $nak, + $was_enabled, + ); + + ## What do we use to request enable/disable or respond with ack/nak. + if ($opt_request eq "wont") { + $enable_cmd = "\377\375" . pack("C", $opt); # do command + $disable_cmd = "\377\376" . pack("C", $opt); # dont command + $is_remote = 1; + $ack = "DO"; + $nak = "DONT"; + + &_log_option($s->{opt_log}, "RCVD", "WONT", $opt) + if $s->{opt_log}; + } + elsif ($opt_request eq "dont") { + $enable_cmd = "\377\373" . pack("C", $opt); # will command + $disable_cmd = "\377\374" . pack("C", $opt); # wont command + $is_remote = ''; + $ack = "WILL"; + $nak = "WONT"; + + &_log_option($s->{opt_log}, "RCVD", "DONT", $opt) + if $s->{opt_log}; + } + else { # internal error + die; + } + + ## Respond to WONT or DONT based on the current negotiation state. + if ($$state eq "no") { # state is already disabled + } + elsif ($$state eq "yes") { # they're initiating disable + $$is_enabled = ''; + $$state = "no"; + + ## Send positive acknowledgment. + $s->{unsent_opts} .= $disable_cmd; + &_log_option($s->{opt_log}, "SENT", $nak, $opt) + if $s->{opt_log}; + + ## Invoke callbacks. + &_negotiate_callback($self, $opt, $is_remote, + $$is_enabled, $was_enabled, $opt_bufpos); + } + elsif ($$state eq "wantno") { # they sent positive ack + $$is_enabled = ''; + $$state = "no"; + + ## Invoke callback. + &_negotiate_callback($self, $opt, $is_remote, + $$is_enabled, $was_enabled, $opt_bufpos); + } + elsif ($$state eq "wantno opposite") { # pos ack but we changed our mind + ## Indicate disabled but now we want to enable. + $$is_enabled = ''; + $$state = "wantyes"; + + ## Send queued request. + $s->{unsent_opts} .= $enable_cmd; + &_log_option($s->{opt_log}, "SENT", $ack, $opt) + if $s->{opt_log}; + + ## Invoke callback. + &_negotiate_callback($self, $opt, $is_remote, + $$is_enabled, $was_enabled, $opt_bufpos); + } + elsif ($$state eq "wantyes") { # they sent negative ack + $$is_enabled = ''; + $$state = "no"; + + ## Invoke callback. + &_negotiate_callback($self, $opt, $is_remote, + $$is_enabled, $was_enabled, $opt_bufpos); + } + elsif ($$state eq "wantyes opposite") { # nak but we changed our mind + $$is_enabled = ''; + $$state = "no"; + + ## Invoke callback. + &_negotiate_callback($self, $opt, $is_remote, + $$is_enabled, $was_enabled, $opt_bufpos); + } +} # end sub _negotiate_recv_disable + + +sub _negotiate_recv_enable { + my ($self, $s, $opt, $opt_request, + $opt_bufpos, $enable_ok, $is_enabled, $state) = @_; + my ( + $ack, + $disable_cmd, + $enable_cmd, + $is_remote, + $nak, + $was_enabled, + ); + + ## What we use to send enable/disable request or send ack/nak response. + if ($opt_request eq "will") { + $enable_cmd = "\377\375" . pack("C", $opt); # do command + $disable_cmd = "\377\376" . pack("C", $opt); # dont command + $is_remote = 1; + $ack = "DO"; + $nak = "DONT"; + + &_log_option($s->{opt_log}, "RCVD", "WILL", $opt) + if $s->{opt_log}; + } + elsif ($opt_request eq "do") { + $enable_cmd = "\377\373" . pack("C", $opt); # will command + $disable_cmd = "\377\374" . pack("C", $opt); # wont command + $is_remote = ''; + $ack = "WILL"; + $nak = "WONT"; + + &_log_option($s->{opt_log}, "RCVD", "DO", $opt) + if $s->{opt_log}; + } + else { # internal error + die; + } + + ## Save current enabled state. + $was_enabled = $$is_enabled; + + ## Respond to WILL or DO based on the current negotiation state. + if ($$state eq "no") { # they're initiating enable + if ($enable_ok) { # we agree they/us should enable + $$is_enabled = 1; + $$state = "yes"; + + ## Send positive acknowledgment. + $s->{unsent_opts} .= $enable_cmd; + &_log_option($s->{opt_log}, "SENT", $ack, $opt) + if $s->{opt_log}; + + ## Invoke callbacks. + &_negotiate_callback($self, $opt, $is_remote, + $$is_enabled, $was_enabled, $opt_bufpos); + } + else { # we disagree they/us should enable + ## Send negative acknowledgment. + $s->{unsent_opts} .= $disable_cmd; + &_log_option($s->{opt_log}, "SENT", $nak, $opt) + if $s->{opt_log}; + } + } + elsif ($$state eq "yes") { # state is already enabled + } + elsif ($$state eq "wantno") { # error: our disable req answered by enable + $$is_enabled = ''; + $$state = "no"; + + ## Invoke callbacks. + &_negotiate_callback($self, $opt, $is_remote, + $$is_enabled, $was_enabled, $opt_bufpos); + } + elsif ($$state eq "wantno opposite") { # err: disable req answerd by enable + $$is_enabled = 1; + $$state = "yes"; + + ## Invoke callbacks. + &_negotiate_callback($self, $opt, $is_remote, + $$is_enabled, $was_enabled, $opt_bufpos); + } + elsif ($$state eq "wantyes") { # they sent pos ack + $$is_enabled = 1; + $$state = "yes"; + + ## Invoke callback. + &_negotiate_callback($self, $opt, $is_remote, + $$is_enabled, $was_enabled, $opt_bufpos); + } + elsif ($$state eq "wantyes opposite") { # pos ack but we changed our mind + ## Indicate enabled but now we want to disable. + $$is_enabled = 1; + $$state = "wantno"; + + ## Inform other side we changed our mind. + $s->{unsent_opts} .= $disable_cmd; + &_log_option($s->{opt_log}, "SENT", $nak, $opt) + if $s->{opt_log}; + + ## Invoke callback. + &_negotiate_callback($self, $opt, $is_remote, + $$is_enabled, $was_enabled, $opt_bufpos); + } + + 1; +} # end sub _negotiate_recv_enable + + +sub _new_handle { + if ($INC{"IO/Handle.pm"}) { + return IO::Handle->new; + } + else { + require FileHandle; + return FileHandle->new; + } +} # end sub _new_handle + + +sub _next_getlines { + my ($self, $s) = @_; + my ( + $len, + $line, + $pos, + @lines, + ); + + ## Fill buffer and get first line. + $line = $self->getline + or return; + push @lines, $line; + + ## Extract subsequent lines from buffer. + while (($pos = index($s->{buf}, $s->{rs})) != -1) { + $len = $pos + length $s->{rs}; + push @lines, substr($s->{buf}, 0, $len); + substr($s->{buf}, 0, $len) = ""; + } + + @lines; +} # end sub _next_getlines + + +sub _opt_accept { + my ($self, @args) = @_; + my ( + $arg, + $option, + $s, + ); + + ## Init. + $s = *$self->{net_telnet}; + + foreach $arg (@args) { + ## Ensure data structure defined for this option. + $option = $arg->{option}; + if (!defined $s->{opts}{$option}) { + &_set_default_option($s, $option); + } + + ## Save whether we'll accept or reject this option. + if ($arg->{is_remote}) { + $s->{opts}{$option}{remote_enable_ok} = $arg->{is_enable}; + } + else { + $s->{opts}{$option}{local_enable_ok} = $arg->{is_enable}; + } + } + + 1; +} # end sub _opt_accept + + +sub _optimal_blksize { + my ($blksize) = @_; + local $^W = ''; # avoid non-numeric warning for ms-windows blksize of "" + + ## Use default when block size is invalid. + return 8192 + unless defined $blksize and $blksize >= 1 and $blksize <= 1_048_576; + + $blksize; +} # end sub _optimal_blksize + + +sub _parse_cmd_remove_mode { + my ($self, $mode) = @_; + + if (!defined $mode) { + $mode = 0; + } + elsif ($mode =~ /^\s*auto\s*$/i) { + $mode = "auto"; + } + elsif ($mode !~ /^\d+$/) { + &_carp($self, "ignoring bad Cmd_remove_mode " . + "argument \"$mode\": it's not \"auto\" or a " . + "non-negative integer"); + $mode = *$self->{net_telnet}{cmd_rm_mode}; + } + + $mode; +} # end sub _parse_cmd_remove_mode + + +sub _parse_errmode { + my ($self, $errmode) = @_; + + ## Set the error mode. + if (!defined $errmode) { + &_carp($self, "ignoring undefined Errmode argument"); + $errmode = *$self->{net_telnet}{errormode}; + } + elsif ($errmode =~ /^\s*return\s*$/i) { + $errmode = "return"; + } + elsif ($errmode =~ /^\s*die\s*$/i) { + $errmode = "die"; + } + elsif (ref($errmode) eq "CODE") { + } + elsif (ref($errmode) eq "ARRAY") { + unless (ref($errmode->[0]) eq "CODE") { + &_carp($self, "ignoring bad Errmode argument: " . + "first list item isn't a code ref"); + $errmode = *$self->{net_telnet}{errormode}; + } + } + else { + &_carp($self, "ignoring bad Errmode argument \"$errmode\""); + $errmode = *$self->{net_telnet}{errormode}; + } + + $errmode; +} # end sub _parse_errmode + + +sub _parse_input_record_separator { + my ($self, $rs) = @_; + + unless (defined $rs and length $rs) { + &_carp($self, "ignoring null Input_record_separator argument"); + $rs = *$self->{net_telnet}{rs}; + } + + $rs; +} # end sub _parse_input_record_separator + + +sub _parse_prompt { + my ($self, $prompt) = @_; + + unless (defined $prompt) { + $prompt = ""; + } + + unless ($prompt =~ m(^\s*/) or $prompt =~ m(^\s*m\s*\W)) { + &_carp($self, "ignoring bad Prompt argument \"$prompt\": " . + "missing opening delimiter of match operator"); + $prompt = *$self->{net_telnet}{cmd_prompt}; + } + + $prompt; +} # end sub _parse_prompt + + +sub _parse_timeout { + my ($self, $timeout) = @_; + + ## Ensure valid timeout. + if (defined $timeout) { + ## Test for non-numeric or negative values. + eval { + local $SIG{"__DIE__"} = "DEFAULT"; + local $SIG{"__WARN__"} = sub { die "non-numeric\n" }; + local $^W = 1; + $timeout *= 1; + }; + if ($@) { # timeout arg is non-numeric + &_carp($self, + "ignoring non-numeric Timeout argument \"$timeout\""); + $timeout = *$self->{net_telnet}{time_out}; + } + elsif ($timeout < 0) { # timeout arg is negative + &_carp($self, "ignoring negative Timeout argument \"$timeout\""); + $timeout = *$self->{net_telnet}{time_out}; + } + } + + $timeout; +} # end sub _parse_timeout + + +sub _put { + my ($self, $buf, $subname) = @_; + my ( + $endtime, + $len, + $nfound, + $nwrote, + $offset, + $ready, + $s, + $timed_out, + $timeout, + $zero_wrote_count, + ); + + ## Init. + $s = *$self->{net_telnet}; + $s->{num_wrote} = 0; + $zero_wrote_count = 0; + $offset = 0; + $len = length $$buf; + $endtime = &_endtime($s->{time_out}); + + return $self->error("write error: filehandle isn't open") + unless $s->{opened}; + + ## Try to send any waiting option negotiation. + if (length $s->{unsent_opts}) { + &_flush_opts($self); + } + + ## Write until all data blocks written. + while ($len) { + ## Determine how long to wait for output ready. + ($timed_out, $timeout) = &_timeout_interval($endtime); + if ($timed_out) { + $s->{timedout} = 1; + return $self->error("$subname timed-out"); + } + + ## Wait for output ready. + $nfound = select "", $ready=$s->{fdmask}, "", $timeout; + + ## Handle any errors while waiting. + if (!defined $nfound or $nfound <= 0) { # output not ready + if (defined $nfound and $nfound == 0) { # timed-out + $s->{timedout} = 1; + return $self->error("$subname timed-out"); + } + else { # error waiting for output ready + next if $! =~ /^interrupted/i; + + $s->{opened} = ''; + return $self->error("write error: $!"); + } + } + + ## Write the data. + $nwrote = syswrite $self, $$buf, $len, $offset; + + ## Handle any write errors. + if (!defined $nwrote) { # write failed + next if $! =~ /^interrupted/i; # restart interrupted syscall + + $s->{opened} = ''; + return $self->error("write error: $!"); + } + elsif ($nwrote == 0) { # zero chars written + ## Try ten more times to write the data. + if ($zero_wrote_count++ <= 10) { + &_sleep(0.01); + next; + } + + $s->{opened} = ''; + return $self->error("write error: zero length write: $!"); + } + + ## Display network traffic if requested. + if ($s->{dumplog}) { + &_log_dump('>', $s->{dumplog}, $buf, $offset, $nwrote); + } + + ## Increment. + $s->{num_wrote} += $nwrote; + $offset += $nwrote; + $len -= $nwrote; + } + + 1; +} # end sub _put + + +sub _qualify_fh { + my ($obj, $name) = @_; + my ( + $user_class, + ); + local $_; + + ## Get user's package name. + ($user_class) = &_user_caller($obj); + + ## Ensure name is qualified with a package name. + $name = qualify($name, $user_class); + + ## If it's not already, make it a typeglob ref. + if (!ref $name) { + no strict; + local $^W = 0; + + $name =~ s/^\*+//; + $name = eval "\\*$name"; + return unless ref $name; + } + + $name; +} # end sub _qualify_fh + + +sub _reset_options { + my ($opts) = @_; + my ( + $opt, + ); + + foreach $opt (keys %$opts) { + $opts->{$opt}{remote_enabled} = ''; + $opts->{$opt}{remote_state} = "no"; + $opts->{$opt}{local_enabled} = ''; + $opts->{$opt}{local_state} = "no"; + } + + 1; +} # end sub _reset_options + + +sub _save_lastline { + my ($s) = @_; + my ( + $firstpos, + $lastpos, + $len_w_sep, + $len_wo_sep, + $offset, + ); + my $rs = "\n"; + + if (($lastpos = rindex $s->{buf}, $rs) > -1) { # eol found + while (1) { + ## Find beginning of line. + $firstpos = rindex $s->{buf}, $rs, $lastpos - 1; + if ($firstpos == -1) { + $offset = 0; + } + else { + $offset = $firstpos + length $rs; + } + + ## Determine length of line with and without separator. + $len_wo_sep = $lastpos - $offset; + $len_w_sep = $len_wo_sep + length $rs; + + ## Save line if it's not blank. + if (substr($s->{buf}, $offset, $len_wo_sep) + !~ /^\s*$/) + { + $s->{last_line} = substr($s->{buf}, + $offset, + $len_w_sep); + last; + } + + last if $firstpos == -1; + + $lastpos = $firstpos; + } + } + + 1; +} # end sub _save_lastline + + +sub _set_default_option { + my ($s, $option) = @_; + + $s->{opts}{$option} = { + remote_enabled => '', + remote_state => "no", + remote_enable_ok => '', + local_enabled => '', + local_state => "no", + local_enable_ok => '', + }; +} # end sub _set_default_option + + +sub _sleep { + my ($secs) = @_; + my $bitmask = ""; + local *SOCK; + + socket SOCK, AF_INET, SOCK_STREAM, 0; + vec($bitmask, fileno(SOCK), 1) = 1; + select $bitmask, "", "", $secs; + CORE::close SOCK; + + 1; +} # end sub _sleep + + +sub _timeout_interval { + my ($endtime) = @_; + my ( + $timeout, + ); + + ## Return timed-out boolean and timeout interval. + if (defined $endtime) { + ## Is it a one-time poll. + return ('', 0) if $endtime == 0; + + ## Calculate the timeout interval. + $timeout = $endtime - time; + + ## Did we already timeout. + return (1, 0) unless $timeout > 0; + + return ('', $timeout); + } + else { # there is no timeout + return ('', undef); + } +} # end sub _timeout_interval + + +sub _user_caller { + my ($obj) = @_; + my ( + $class, + $curr_pkg, + $file, + $i, + $line, + $pkg, + %isa, + @isa, + ); + local $_; + + ## Create a boolean hash to test for isa. Make sure current + ## package and the object's class are members. + $class = ref $obj; + @isa = eval "\@${class}::ISA"; + push @isa, $class; + ($curr_pkg) = caller 1; + push @isa, $curr_pkg; + %isa = map { $_ => 1 } @isa; + + ## Search back in call frames for a package that's not in isa. + $i = 1; + while (($pkg, $file, $line) = caller ++$i) { + next if $isa{$pkg}; + + return ($pkg, $file, $line); + } + + ## If not found, choose outer most call frame. + ($pkg, $file, $line) = caller --$i; + return ($pkg, $file, $line); +} # end sub _user_caller + + +sub _verify_telopt_arg { + my ($self, $option, $argname) = @_; + + ## If provided, use argument name in error message. + if (defined $argname) { + $argname = "for arg $argname"; + } + else { + $argname = ""; + } + + ## Ensure telnet option is a non-negative integer. + eval { + local $SIG{"__DIE__"} = "DEFAULT"; + local $SIG{"__WARN__"} = sub { die "non-numeric\n" }; + local $^W = 1; + $option = abs(int $option); + }; + return $self->error("bad telnet option $argname: non-numeric") + if $@; + + return $self->error("bad telnet option $argname: option > 255") + unless $option <= 255; + + $option; +} # end sub _verify_telopt_arg + + +######################## Exported Constants ########################## + + +sub TELNET_IAC () {255}; # interpret as command: +sub TELNET_DONT () {254}; # you are not to use option +sub TELNET_DO () {253}; # please, you use option +sub TELNET_WONT () {252}; # I won't use option +sub TELNET_WILL () {251}; # I will use option +sub TELNET_SB () {250}; # interpret as subnegotiation +sub TELNET_GA () {249}; # you may reverse the line +sub TELNET_EL () {248}; # erase the current line +sub TELNET_EC () {247}; # erase the current character +sub TELNET_AYT () {246}; # are you there +sub TELNET_AO () {245}; # abort output--but let prog finish +sub TELNET_IP () {244}; # interrupt process--permanently +sub TELNET_BREAK () {243}; # break +sub TELNET_DM () {242}; # data mark--for connect. cleaning +sub TELNET_NOP () {241}; # nop +sub TELNET_SE () {240}; # end sub negotiation +sub TELNET_EOR () {239}; # end of record (transparent mode) +sub TELNET_ABORT () {238}; # Abort process +sub TELNET_SUSP () {237}; # Suspend process +sub TELNET_EOF () {236}; # End of file +sub TELNET_SYNCH () {242}; # for telfunc calls + +sub TELOPT_BINARY () {0}; # Binary Transmission +sub TELOPT_ECHO () {1}; # Echo +sub TELOPT_RCP () {2}; # Reconnection +sub TELOPT_SGA () {3}; # Suppress Go Ahead +sub TELOPT_NAMS () {4}; # Approx Message Size Negotiation +sub TELOPT_STATUS () {5}; # Status +sub TELOPT_TM () {6}; # Timing Mark +sub TELOPT_RCTE () {7}; # Remote Controlled Trans and Echo +sub TELOPT_NAOL () {8}; # Output Line Width +sub TELOPT_NAOP () {9}; # Output Page Size +sub TELOPT_NAOCRD () {10}; # Output Carriage-Return Disposition +sub TELOPT_NAOHTS () {11}; # Output Horizontal Tab Stops +sub TELOPT_NAOHTD () {12}; # Output Horizontal Tab Disposition +sub TELOPT_NAOFFD () {13}; # Output Formfeed Disposition +sub TELOPT_NAOVTS () {14}; # Output Vertical Tabstops +sub TELOPT_NAOVTD () {15}; # Output Vertical Tab Disposition +sub TELOPT_NAOLFD () {16}; # Output Linefeed Disposition +sub TELOPT_XASCII () {17}; # Extended ASCII +sub TELOPT_LOGOUT () {18}; # Logout +sub TELOPT_BM () {19}; # Byte Macro +sub TELOPT_DET () {20}; # Data Entry Terminal +sub TELOPT_SUPDUP () {21}; # SUPDUP +sub TELOPT_SUPDUPOUTPUT () {22}; # SUPDUP Output +sub TELOPT_SNDLOC () {23}; # Send Location +sub TELOPT_TTYPE () {24}; # Terminal Type +sub TELOPT_EOR () {25}; # End of Record +sub TELOPT_TUID () {26}; # TACACS User Identification +sub TELOPT_OUTMRK () {27}; # Output Marking +sub TELOPT_TTYLOC () {28}; # Terminal Location Number +sub TELOPT_3270REGIME () {29}; # Telnet 3270 Regime +sub TELOPT_X3PAD () {30}; # X.3 PAD +sub TELOPT_NAWS () {31}; # Negotiate About Window Size +sub TELOPT_TSPEED () {32}; # Terminal Speed +sub TELOPT_LFLOW () {33}; # Remote Flow Control +sub TELOPT_LINEMODE () {34}; # Linemode +sub TELOPT_XDISPLOC () {35}; # X Display Location +sub TELOPT_OLD_ENVIRON () {36}; # Environment Option +sub TELOPT_AUTHENTICATION () {37}; # Authentication Option +sub TELOPT_ENCRYPT () {38}; # Encryption Option +sub TELOPT_NEW_ENVIRON () {39}; # New Environment Option +sub TELOPT_EXOPL () {255}; # Extended-Options-List + + +1; +__END__; + + +######################## User Documentation ########################## + + +## To format the following documentation into a more readable format, +## use one of these programs: perldoc; pod2man; pod2html; pod2text. +## For example, to nicely format this documentation for printing, you +## may use pod2man and groff to convert to postscript: +## pod2man Net/Telnet.pm | groff -man -Tps > Net::Telnet.ps + +=head1 NAME + +Net::Telnet - interact with TELNET port or other TCP ports + +=head1 SYNOPSIS + +C + +see METHODS section below + +=head1 DESCRIPTION + +Net::Telnet allows you to make client connections to a TCP port and do +network I/O, especially to a port using the TELNET protocol. Simple +I/O methods such as print, get, and getline are provided. More +sophisticated interactive features are provided because connecting to +a TELNET port ultimately means communicating with a program designed +for human interaction. These interactive features include the ability +to specify a time-out and to wait for patterns to appear in the input +stream, such as the prompt from a shell. + +Other reasons to use this module than strictly with a TELNET port are: + +=over 2 + +=item * + +You're not familiar with sockets and you want a simple way to make +client connections to TCP services. + +=item * + +You want to be able to specify your own time-out while connecting, +reading, or writing. + +=item * + +You're communicating with an interactive program at the other end of +some socket or pipe and you want to wait for certain patterns to +appear. + +=back + +Here's an example that prints who's logged-on to the remote host +sparky. In addition to a username and password, you must also know +the user's shell prompt, which for this example is C + + use Net::Telnet (); + $t = new Net::Telnet (Timeout => 10, + Prompt => '/bash\$ $/'); + $t->open("sparky"); + $t->login($username, $passwd); + @lines = $t->cmd("who"); + print @lines; + +More examples are in the B section below. + +Usage questions should be directed to the Usenet newsgroup +comp.lang.perl.modules. + +Contact me, Jay Rogers , if you find any bugs or have +suggestions for improvement. + +=head2 What To Know Before Using + +=over 2 + +=item * + +All output is flushed while all input is buffered. Each object +contains its own input buffer. + +=item * + +The output record separator for C and C is set to +C<"\n"> by default, so that you don't have to append all your commands +with a newline. To avoid printing a trailing C<"\n"> use C or +set the I to C<"">. + +=item * + +The methods C and C use the I setting in the +object to determine when a login or remote command is complete. Those +methods will fail with a time-out if you don't set the prompt +correctly. + +=item * + +Use a combination of C and C as an alternative to +C or C when they don't do what you want. + +=item * + +Errors such as timing-out are handled according to the error mode +action. The default action is to print an error message to standard +error and have the program die. See the C method for more +information. + +=item * + +When constructing the match operator argument for C or +C, always use single quotes instead of double quotes to +avoid unexpected backslash interpretation (e.g. C<'/bash\$ $/'>). If +you're constructing a DOS like file path, you'll need to use four +backslashes to represent one (e.g. C<'/c:\\\\users\\\\billE$/i'>). + +Of course don't forget about regexp metacharacters like C<.>, C<[>, or +C<$>. You'll only need a single backslash to quote them. The anchor +metacharacters C<^> and C<$> refer to positions in the input buffer. +To avoid matching characters read that look like a prompt, it's a good +idea to end your prompt pattern with the C<$> anchor. That way the +prompt will only match if it's the last thing read. + +=item * + +In the input stream, each sequence of I and I (i.e. C<"\015\012"> or CR LF) is converted to C<"\n">. In the +output stream, each occurrence of C<"\n"> is converted to a sequence +of CR LF. See C to change the behavior. TCP protocols +typically use the ASCII sequence, carriage return and line feed to +designate a newline. + +=item * + +Timing-out while making a connection is disabled for machines that +don't support the C function. Most notably these include +MS-Windows machines. + +=item * + +You'll need to be running at least Perl version 5.002 to use this +module. This module does not require any libraries that don't already +come with a standard Perl distribution. + +If you have the IO:: libraries installed (they come standard with +perl5.004 and later) then IO::Socket::INET is used as a base class, +otherwise FileHandle is used. + +=item * + +Contact me, Jay Rogers , if you find any bugs or have +suggestions for improvement. + +=back + +=head2 Debugging + +The typical usage bug causes a time-out error because you've made +incorrect assumptions about what the remote side actually sends. The +easiest way to reconcile what the remote side sends with your +expectations is to use C or C. + +C allows you to see the data being sent from the remote +side before any translation is done, while C shows you +the results after translation. The translation includes converting +end of line characters, removing and responding to TELNET protocol +commands in the data stream. + +=head2 Style of Named Parameters + +Two different styles of named parameters are supported. This document +only shows the IO:: style: + + Net::Telnet->new(Timeout => 20); + +however the dash-option style is also allowed: + + Net::Telnet->new(-timeout => 20); + +=head2 Connecting to a Remote MS-Windows Machine + +By default MS-Windows doesn't come with a TELNET server. However +third party TELNET servers are available. Unfortunately many of these +servers falsely claim to be a TELNET server. This is especially true +of the so-called "Microsoft Telnet Server" that comes installed with +some newer versions MS-Windows. + +When a TELNET server first accepts a connection, it must use the ASCII +control characters carriage-return and line-feed to start a new line +(see RFC854). A server like the "Microsoft Telnet Server" that +doesn't do this, isn't a TELNET server. These servers send ANSI +terminal escape sequences to position to a column on a subsequent line +and to even position while writing characters that are adjacent to +each other. Worse, when sending output these servers resend +previously sent command output in a misguided attempt to display an +entire terminal screen. + +Connecting Net::Telnet to one of these false TELNET servers makes your +job of parsing command output very difficult. It's better to replace +a false TELNET server with a real TELNET server. The better TELNET +servers for MS-Windows allow you to avoid the ANSI escapes by turning +off something some of them call I. + + +=head1 METHODS + +In the calling sequences below, square brackets B<[]> represent +optional parameters. + +=over 4 + +=item B - create a new Net::Telnet object + + $obj = new Net::Telnet ([$host]); + + $obj = new Net::Telnet ([Binmode => $mode,] + [Cmd_remove_mode => $mode,] + [Dump_Log => $filename,] + [Errmode => $errmode,] + [Fhopen => $filehandle,] + [Host => $host,] + [Input_log => $file,] + [Input_record_separator => $chars,] + [Option_log => $file,] + [Ors => $chars,] + [Output_log => $file,] + [Output_record_separator => $chars,] + [Port => $port,] + [Prompt => $matchop,] + [Rs => $chars,] + [Telnetmode => $mode,] + [Timeout => $secs,]); + +This is the constructor for Net::Telnet objects. A new object is +returned on success, the error mode action is performed on failure - +see C. The optional arguments are short-cuts to methods of +the same name. + +If the I<$host> argument is given then the object is opened by +connecting to TCP I<$port> on I<$host>. Also see C. The new +object returned is given the following defaults in the absence of +corresponding named parameters: + +=over 4 + +=item + +The default I is C<"localhost"> + +=item + +The default I is C<23> + +=item + +The default I is C<'/[\$%#E] $/'> + +=item + +The default I is C<10> + +=item + +The default I is C<"die"> + +=item + +The default I is C<"\n">. Note that I +is synonymous with I. + +=item + +The default I is C<"\n">. Note that I is +synonymous with I. + +=item + +The default I is C<0>, which means do newline translation. + +=item + +The default I is C<1>, which means respond to TELNET +commands in the data stream. + +=item + +The default I is C<"auto"> + +=item + +The defaults for I, I, I, and +I are C<"">, which means that logging is turned-off. + +=back + +=back + + +=over 4 + +=item B - toggle newline translation + + $mode = $obj->binmode; + + $prev = $obj->binmode($mode); + +This method controls whether or not sequences of carriage returns and +line feeds (CR LF or more specifically C<"\015\012">) are translated. +By default they are translated (i.e. binmode is C<0>). + +If no argument is given, the current mode is returned. + +If I<$mode> is C<1> then binmode is I and newline translation is +not done. + +If I<$mode> is C<0> then binmode is I and newline translation is +done. In the input stream, each sequence of CR LF is converted to +C<"\n"> and in the output stream, each occurrence of C<"\n"> is +converted to a sequence of CR LF. + +Note that input is always buffered. Changing binmode doesn't effect +what's already been read into the buffer. Output is not buffered and +changing binmode will have an immediate effect. + +=back + + +=over 4 + +=item B - send TELNET break character + + $ok = $obj->break; + +This method sends the TELNET break character. This character is +provided because it's a signal outside the ASCII character set which +is currently given local meaning within many systems. It's intended +to indicate that the Break Key or the Attention Key was hit. + +This method returns C<1> on success, or performs the error mode action +on failure. + +=back + + +=over 4 + +=item B - scalar reference to object's input buffer + + $ref = $obj->buffer; + +This method returns a scalar reference to the input buffer for +I<$obj>. Data in the input buffer is data that has been read from the +remote side but has yet to be read by the user. Modifications to the +input buffer are returned by a subsequent read. + +=back + + +=over 4 + +=item B - discard all data in object's input buffer + + $obj->buffer_empty; + +This method removes all data in the input buffer for I<$obj>. + +=back + + +=over 4 + +=item B - close object + + $ok = $obj->close; + +This method closes the socket, file, or pipe associated with the +object. It always returns a value of C<1>. + +=back + + +=over 4 + +=item B - issue command and retrieve output + + $ok = $obj->cmd($string); + $ok = $obj->cmd(String => $string, + [Output => $ref,] + [Cmd_remove_mode => $mode,] + [Errmode => $mode,] + [Input_record_separator => $chars,] + [Ors => $chars,] + [Output_record_separator => $chars,] + [Prompt => $match,] + [Rs => $chars,] + [Timeout => $secs,]); + + @output = $obj->cmd($string); + @output = $obj->cmd(String => $string, + [Output => $ref,] + [Cmd_remove_mode => $mode,] + [Errmode => $mode,] + [Input_record_separator => $chars,] + [Ors => $chars,] + [Output_record_separator => $chars,] + [Prompt => $match,] + [Rs => $chars,] + [Timeout => $secs,]); + +This method sends the command I<$string>, and reads the characters +sent back by the command up until and including the matching prompt. +It's assumed that the program to which you're sending is some kind of +command prompting interpreter such as a shell. + +The command I<$string> is automatically appended with the +output_record_separator, By default that's C<"\n">. This is similar +to someone typing a command and hitting the return key. Set the +output_record_separator to change this behavior. + +In a scalar context, the characters read from the remote side are +discarded and C<1> is returned on success. On time-out, eof, or other +failures, the error mode action is performed. See C. + +In a list context, just the output generated by the command is +returned, one line per element. In other words, all the characters in +between the echoed back command string and the prompt are returned. +If the command happens to return no output, a list containing one +element, the empty string is returned. This is so the list will +indicate true in a boolean context. On time-out, eof, or other +failures, the error mode action is performed. See C. + +The characters that matched the prompt may be retrieved using +C. + +Many command interpreters echo back the command sent. In most +situations, this method removes the first line returned from the +remote side (i.e. the echoed back command). See C +for more control over this feature. + +Use C to debug when this method keeps timing-out and you +don't think it should. + +Consider using a combination of C and C as an +alternative to this method when it doesn't do what you want, e.g. the +command you send prompts for input. + +The I named parameter provides an alternative method of +receiving command output. If you pass a scalar reference, all the +output (even if it contains multiple lines) is returned in the +referenced scalar. If you pass an array or hash reference, the lines +of output are returned in the referenced array or hash. You can use +C to change the notion of what separates a +line. + +Optional named parameters are provided to override the current +settings of cmd_remove_mode, errmode, input_record_separator, ors, +output_record_separator, prompt, rs, and timeout. Rs is synonymous +with input_record_separator and ors is synonymous with +output_record_separator. + +=back + + +=over 4 + +=item B - toggle removal of echoed commands + + $mode = $obj->cmd_remove_mode; + + $prev = $obj->cmd_remove_mode($mode); + +This method controls how to deal with echoed back commands in the +output returned by cmd(). Typically, when you send a command to the +remote side, the first line of output returned is the command echoed +back. Use this mode to remove the first line of output normally +returned by cmd(). + +If no argument is given, the current mode is returned. + +If I<$mode> is C<0> then the command output returned from cmd() has no +lines removed. If I<$mode> is a positive integer, then the first +I<$mode> lines of command output are stripped. + +By default, I<$mode> is set to C<"auto">. Auto means that whether or +not the first line of command output is stripped, depends on whether +or not the remote side offered to echo. By default, Net::Telnet +always accepts an offer to echo by the remote side. You can change +the default to reject such an offer using C. + +A warning is printed to STDERR when attempting to set this attribute +to something that's not C<"auto"> or a non-negative integer. + +=back + + +=over 4 + +=item B - log all I/O in dump format + + $fh = $obj->dump_log; + + $fh = $obj->dump_log($fh); + + $fh = $obj->dump_log($filename); + +This method starts or stops dump format logging of all the object's +input and output. The dump format shows the blocks read and written +in a hexadecimal and printable character format. This method is +useful when debugging, however you might want to first try +C as it's more readable. + +If no argument is given, the current log filehandle is returned. An +empty string indicates logging is off. + +To stop logging, use an empty string as an argument. + +If an open filehandle is given, it is used for logging and returned. +Otherwise, the argument is assumed to be the name of a file, the file +is opened and a filehandle to it is returned. If the file can't be +opened for writing, the error mode action is performed. + +=back + + +=over 4 + +=item B - end of file indicator + + $eof = $obj->eof; + +This method returns C<1> if end of file has been read, otherwise it +returns an empty string. Because the input is buffered this isn't the +same thing as I<$obj> has closed. In other words I<$obj> can be +closed but there still can be stuff in the buffer to be read. Under +this condition you can still read but you won't be able to write. + +=back + + +=over 4 + +=item B - define action to be performed on error + + $mode = $obj->errmode; + + $prev = $obj->errmode($mode); + +This method gets or sets the action used when errors are encountered +using the object. The first calling sequence returns the current +error mode. The second calling sequence sets it to I<$mode> and +returns the previous mode. Valid values for I<$mode> are C<"die"> +(the default), C<"return">, a I, or an I. + +When mode is C<"die"> and an error is encountered using the object, +then an error message is printed to standard error and the program +dies. + +When mode is C<"return"> then the method generating the error places +an error message in the object and returns an undefined value in a +scalar context and an empty list in list context. The error message +may be obtained using C. + +When mode is a I, then when an error is encountered +I is called with the error message as its first argument. +Using this mode you may have your own subroutine handle errors. If +I itself returns then the method generating the error returns +undefined or an empty list depending on context. + +When mode is an I, the first element of the array must be a +I. Any elements that follow are the arguments to I. +When an error is encountered, the I is called with its +arguments. Using this mode you may have your own subroutine handle +errors. If the I itself returns then the method generating +the error returns undefined or an empty list depending on context. + +A warning is printed to STDERR when attempting to set this attribute +to something that's not C<"die">, C<"return">, a I, or an +I whose first element isn't a I. + +=back + + +=over 4 + +=item B - most recent error message + + $msg = $obj->errmsg; + + $prev = $obj->errmsg(@msgs); + +The first calling sequence returns the error message associated with +the object. The empty string is returned if no error has been +encountered yet. The second calling sequence sets the error message +for the object to the concatenation of I<@msgs> and returns the +previous error message. Normally, error messages are set internally +by a method when an error is encountered. + +=back + + +=over 4 + +=item B - perform the error mode action + + $obj->error(@msgs); + +This method concatenates I<@msgs> into a string and places it in the +object as the error message. Also see C. It then performs +the error mode action. Also see C. + +If the error mode doesn't cause the program to die, then an undefined +value or an empty list is returned depending on the context. + +This method is primarily used by this class or a sub-class to perform +the user requested action when an error is encountered. + +=back + + +=over 4 + +=item B - use already open filehandle for I/O + + $ok = $obj->fhopen($fh); + +This method associates the open filehandle I<$fh> with I<$obj> for +further I/O. Filehandle I<$fh> must already be opened. + +Suppose you want to use the features of this module to do I/O to +something other than a TCP port, for example STDIN or a filehandle +opened to read from a process. Instead of opening the object for I/O +to a TCP port by using C or C, call this method +instead. + +The value C<1> is returned success, the error mode action is performed +on failure. + +=back + + +=over 4 + +=item B - read block of data + + $data = $obj->get([Binmode => $mode,] + [Errmode => $errmode,] + [Telnetmode => $mode,] + [Timeout => $secs,]); + +This method reads a block of data from the object and returns it along +with any buffered data. If no buffered data is available to return, +it will wait for data to read using the timeout specified in the +object. You can override that timeout using I<$secs>. Also see +C. If buffered data is available to return, it also checks +for a block of data that can be immediately read. + +On eof an undefined value is returned. On time-out or other failures, +the error mode action is performed. To distinguish between eof or an +error occurring when the error mode is not set to C<"die">, use +C. + +Optional named parameters are provided to override the current +settings of binmode, errmode, telnetmode, and timeout. + +=back + + +=over 4 + +=item B - read next line + + $line = $obj->getline([Binmode => $mode,] + [Errmode => $errmode,] + [Input_record_separator => $chars,] + [Rs => $chars,] + [Telnetmode => $mode,] + [Timeout => $secs,]); + +This method reads and returns the next line of data from the object. +You can use C to change the notion of what +separates a line. The default is C<"\n">. If a line isn't +immediately available, this method blocks waiting for a line or a +time-out. + +On eof an undefined value is returned. On time-out or other failures, +the error mode action is performed. To distinguish between eof or an +error occurring when the error mode is not set to C<"die">, use +C. + +Optional named parameters are provided to override the current +settings of binmode, errmode, input_record_separator, rs, telnetmode, +and timeout. Rs is synonymous with input_record_separator. + +=back + + +=over 4 + +=item B - read next lines + + @lines = $obj->getlines([Binmode => $mode,] + [Errmode => $errmode,] + [Input_record_separator => $chars,] + [Rs => $chars,] + [Telnetmode => $mode,] + [Timeout => $secs,] + [All => $boolean,]); + +This method reads and returns all the lines of data from the object +until end of file is read. You can use C to +change the notion of what separates a line. The default is C<"\n">. +A time-out error occurs if all the lines can't be read within the +time-out interval. See C. + +The behavior of this method was changed in version 3.03. Prior to +version 3.03 this method returned just the lines available from the +next read. To get that old behavior, use the optional named parameter +I and set I<$boolean> to C<""> or C<0>. + +If only eof is read then an empty list is returned. On time-out or +other failures, the error mode action is performed. Use C to +distinguish between reading only eof or an error occurring when the +error mode is not set to C<"die">. + +Optional named parameters are provided to override the current +settings of binmode, errmode, input_record_separator, rs, telnetmode, +and timeout. Rs is synonymous with input_record_separator. + +=back + + +=over 4 + +=item B - name of remote host + + $host = $obj->host; + + $prev = $obj->host($host); + +This method designates the remote host for C. With no +argument it returns the current host name set in the object. With an +argument it sets the current host name to I<$host> and returns the +previous host name. You may indicate the remote host using either a +hostname or an IP address. + +The default value is C<"localhost">. It may also be set by C +or C. + +=back + + +=over 4 + +=item B - log all input + + $fh = $obj->input_log; + + $fh = $obj->input_log($fh); + + $fh = $obj->input_log($filename); + +This method starts or stops logging of input. This is useful when +debugging. Also see C. Because most command interpreters +echo back commands received, it's likely all your output will also be +in this log. Note that input logging occurs after newline +translation. See C for details on newline translation. + +If no argument is given, the log filehandle is returned. An empty +string indicates logging is off. + +To stop logging, use an empty string as an argument. + +If an open filehandle is given, it is used for logging and returned. +Otherwise, the argument is assumed to be the name of a file, the file +is opened for logging and a filehandle to it is returned. If the file +can't be opened for writing, the error mode action is performed. + +=back + + +=over 4 + +=item B - input line delimiter + + $chars = $obj->input_record_separator; + + $prev = $obj->input_record_separator($chars); + +This method designates the line delimiter for input. It's used with +C, C, and C to determine lines in the +input. + +With no argument this method returns the current input record +separator set in the object. With an argument it sets the input +record separator to I<$chars> and returns the previous value. Note +that I<$chars> must have length. + +A warning is printed to STDERR when attempting to set this attribute +to a string with no length. + +=back + + +=over 4 + +=item B - last prompt read + + $string = $obj->last_prompt; + + $prev = $obj->last_prompt($string); + +With no argument this method returns the last prompt read by cmd() or +login(). See C. With an argument it sets the last prompt +read to I<$string> and returns the previous value. Normally, only +internal methods set the last prompt. + +=back + + +=over 4 + +=item B - last line read + + $line = $obj->lastline; + + $prev = $obj->lastline($line); + +This method retrieves the last line read from the object. This may be +a useful error message when the remote side abnormally closes the +connection. Typically the remote side will print an error message +before closing. + +With no argument this method returns the last line read from the +object. With an argument it sets the last line read to I<$line> and +returns the previous value. Normally, only internal methods set the +last line. + +=back + + +=over 4 + +=item B - perform standard login + + $ok = $obj->login($username, $password); + + $ok = $obj->login(Name => $username, + Password => $password, + [Errmode => $mode,] + [Prompt => $match,] + [Timeout => $secs,]); + +This method performs a standard login by waiting for a login prompt +and responding with I<$username>, then waiting for the password prompt +and responding with I<$password>, and then waiting for the command +interpreter prompt. If any of those prompts sent by the remote side +don't match what's expected, this method will time-out, unless timeout +is turned off. + +Login prompt must match either of these case insensitive patterns: + + /login[: ]*$/i + /username[: ]*$/i + +Password prompt must match this case insensitive pattern: + + /password[: ]*$/i + +The command interpreter prompt must match the current setting of +prompt. See C. + +Use C to debug when this method keeps timing-out and you +don't think it should. + +Consider using a combination of C and C as an +alternative to this method when it doesn't do what you want, e.g. the +remote host doesn't prompt for a username. + +On success, C<1> is returned. On time out, eof, or other failures, +the error mode action is performed. See C. + +Optional named parameters are provided to override the current +settings of errmode, prompt, and timeout. + +=back + + +=over 4 + +=item B - maximum size of input buffer + + $len = $obj->max_buffer_length; + + $prev = $obj->max_buffer_length($len); + +This method designates the maximum size of the input buffer. An error +is generated when a read causes the buffer to exceed this limit. The +default value is 1,048,576 bytes (1MB). The input buffer can grow +much larger than the block size when you continuously read using +C or C and the data stream contains no newlines +or matching waitfor patterns. + +With no argument, this method returns the current maximum buffer +length set in the object. With an argument it sets the maximum buffer +length to I<$len> and returns the previous value. Values of I<$len> +smaller than 512 will be adjusted to 512. + +A warning is printed to STDERR when attempting to set this attribute +to something that isn't a positive integer. + +=back + + +=over 4 + +=item B - field separator for print + + $chars = $obj->ofs + + $prev = $obj->ofs($chars); + +This method is synonymous with C. + +=back + + +=over 4 + +=item B - connect to port on remote host + + $ok = $obj->open($host); + + $ok = $obj->open([Host => $host,] + [Port => $port,] + [Errmode => $mode,] + [Timeout => $secs,]); + +This method opens a TCP connection to I<$port> on I<$host>. If either +argument is missing then the current value of C or C +is used. Optional named parameters are provided to override the +current setting of errmode and timeout. + +On success C<1> is returned. On time-out or other connection +failures, the error mode action is performed. See C. + +Time-outs don't work for this method on machines that don't implement +SIGALRM - most notably MS-Windows machines. For those machines, an +error is returned when the system reaches its own time-out while +trying to connect. + +A side effect of this method is to reset the alarm interval associated +with SIGALRM. + +=back + + +=over 4 + +=item B - indicate willingness to accept a TELNET option + + $fh = $obj->option_accept([Do => $telopt,] + [Dont => $telopt,] + [Will => $telopt,] + [Wont => $telopt,]); + +This method is used to indicate whether to accept or reject an offer +to enable a TELNET option made by the remote side. If you're using +I or I to indicate a willingness to enable, then a +notification callback must have already been defined by a prior call +to C. See C for details on +receiving enable/disable notification of a TELNET option. + +You can give multiple I, I, I, or I arguments +for different TELNET options in the same call to this method. + +The following example describes the meaning of the named parameters. +A TELNET option, such as C used below, is an integer +constant that you can import from Net::Telnet. See the source in file +Telnet.pm for the complete list. + +=over 4 + +=item + +I => C + +=over 4 + +=item + +we'll accept an offer to enable the echo option on the local side + +=back + +=item + +I => C + +=over 4 + +=item + +we'll reject an offer to enable the echo option on the local side + +=back + +=item + +I => C + +=over 4 + +=item + +we'll accept an offer to enable the echo option on the remote side + +=back + +=item + +I => C + +=over 4 + +=item + +we'll reject an offer to enable the echo option on the remote side + +=back + +=back + +=item + +Use C to send a request to the remote side to enable or +disable a particular TELNET option. + +=back + + +=over 4 + +=item B - define the option negotiation callback + + $coderef = $obj->option_callback; + + $prev = $obj->option_callback($coderef); + +This method defines the callback subroutine that's called when a +TELNET option is enabled or disabled. Once defined, the +I may not be undefined. However, calling this method +with a different I<$coderef> changes it. + +A warning is printed to STDERR when attempting to set this attribute +to something that isn't a coderef. + +Here are the circumstances that invoke I<$coderef>: + +=over 4 + +=item + +An option becomes enabled because the remote side requested an enable +and C had been used to arrange that it be accepted. + +=item + +The remote side arbitrarily decides to disable an option that is +currently enabled. Note that Net::Telnet always accepts a request to +disable from the remote side. + +=item + +C was used to send a request to enable or disable an +option and the response from the remote side has just been received. +Note, that if a request to enable is rejected then I<$coderef> is +still invoked even though the option didn't change. + +=back + +=item + +Here are the arguments passed to I<&$coderef>: + + &$coderef($obj, $option, $is_remote, + $is_enabled, $was_enabled, $buf_position); + +=over 4 + +=item + +1. I<$obj> is the Net::Telnet object + +=item + +2. I<$option> is the TELNET option. Net::Telnet exports constants +for the various TELNET options which just equate to an integer. + +=item + +3. I<$is_remote> is a boolean indicating for which side the option +applies. + +=item + +4. I<$is_enabled> is a boolean indicating the option is enabled or +disabled + +=item + +5. I<$was_enabled> is a boolean indicating the option was previously +enabled or disabled + +=item + +6. I<$buf_position> is an integer indicating the position in the +object's input buffer where the option takes effect. See C +to access the object's input buffer. + +=back + +=back + + +=over 4 + +=item B - log all TELNET options sent or received + + $fh = $obj->option_log; + + $fh = $obj->option_log($fh); + + $fh = $obj->option_log($filename); + +This method starts or stops logging of all TELNET options being sent +or received. This is useful for debugging when you send options via +C or you arrange to accept option requests from the +remote side via C. Also see C. + +If no argument is given, the log filehandle is returned. An empty +string indicates logging is off. + +To stop logging, use an empty string as an argument. + +If an open filehandle is given, it is used for logging and returned. +Otherwise, the argument is assumed to be the name of a file, the file +is opened for logging and a filehandle to it is returned. If the file +can't be opened for writing, the error mode action is performed. + +=back + + +=over 4 + +=item B - send TELNET option negotiation request + + $ok = $obj->option_send([Do => $telopt,] + [Dont => $telopt,] + [Will => $telopt,] + [Wont => $telopt,] + [Async => $boolean,]); + +This method is not yet implemented. Look for it in a future version. + +=back + + +=over 4 + +=item B - get current state of a TELNET option + + $hashref = $obj->option_state($telopt); + +This method returns a hashref containing a copy of the current state +of TELNET option I<$telopt>. + +Here are the values returned in the hash: + +=over 4 + +=item + +I<$hashref>->{remote_enabled} + +=over 4 + +=item + +boolean that indicates if the option is enabled on the remote side. + +=back + +=item + +I<$hashref>->{remote_enable_ok} + +=over 4 + +=item + +boolean that indicates if it's ok to accept an offer to enable this +option on the remote side. + +=back + +=item + +I<$hashref>->{remote_state} + +=over 4 + +=item + +string used to hold the internal state of option negotiation for this +option on the remote side. + +=back + +=item + +I<$hashref>->{local_enabled} + +=over 4 + +=item + +boolean that indicates if the option is enabled on the local side. + +=back + +=item + +I<$hashref>->{local_enable_ok} + +=over 4 + +=item + +boolean that indicates if it's ok to accept an offer to enable this +option on the local side. + +=back + +=item + +I<$hashref>->{local_state} + +=over 4 + +=item + +string used to hold the internal state of option negotiation for this +option on the local side. + +=back + +=back + +=back + + +=over 4 + +=item B - output line delimiter + + $chars = $obj->ors; + + $prev = $obj->ors($chars); + +This method is synonymous with C. + +=back + + +=over 4 + +=item B - field separator for print + + $chars = $obj->output_field_separator; + + $prev = $obj->output_field_separator($chars); + +This method designates the output field separator for C. +Ordinarily the print method simply prints out the comma separated +fields you specify. Set this to specify what's printed between +fields. + +With no argument this method returns the current output field +separator set in the object. With an argument it sets the output +field separator to I<$chars> and returns the previous value. + +By default it's set to an empty string. + +=back + + +=over 4 + +=item B - log all output + + $fh = $obj->output_log; + + $fh = $obj->output_log($fh); + + $fh = $obj->output_log($filename); + +This method starts or stops logging of output. This is useful when +debugging. Also see C. Because most command interpreters +echo back commands received, it's likely all your output would also be +in an input log. See C. Note that output logging occurs +before newline translation. See C for details on newline +translation. + +If no argument is given, the log filehandle is returned. An empty +string indicates logging is off. + +To stop logging, use an empty string as an argument. + +If an open filehandle is given, it is used for logging and returned. +Otherwise, the argument is assumed to be the name of a file, the file +is opened for logging and a filehandle to it is returned. If the file +can't be opened for writing, the error mode action is performed. + +=back + + +=over 4 + +=item B - output line delimiter + + $chars = $obj->output_record_separator; + + $prev = $obj->output_record_separator($chars); + +This method designates the output line delimiter for C and +C. Set this to specify what's printed at the end of C +and C. + +The output record separator is set to C<"\n"> by default, so there's +no need to append all your commands with a newline. To avoid printing +the output_record_separator use C or set the +output_record_separator to an empty string. + +With no argument this method returns the current output record +separator set in the object. With an argument it sets the output +record separator to I<$chars> and returns the previous value. + +=back + + +=over 4 + +=item B - remote port + + $port = $obj->port; + + $prev = $obj->port($port); + +This method designates the remote TCP port. With no argument this +method returns the current port number. With an argument it sets the +current port number to I<$port> and returns the previous port. If +I<$port> is a TCP service name, then it's first converted to a port +number using the perl function C. + +The default value is C<23>. It may also be set by C or +C. + +A warning is printed to STDERR when attempting to set this attribute +to something that's not a positive integer or a valid TCP service +name. + +=back + + +=over 4 + +=item B - write to object + + $ok = $obj->print(@list); + +This method writes I<@list> followed by the I +to the open object and returns C<1> if all data was successfully +written. On time-out or other failures, the error mode action is +performed. See C. + +By default, the C is set to C<"\n"> so all +your commands automatically end with a newline. In most cases your +output is being read by a command interpreter which won't accept a +command until newline is read. This is similar to someone typing a +command and hitting the return key. To avoid printing a trailing +C<"\n"> use C instead or set the output_record_separator to an +empty string. + +On failure, it's possible that some data was written. If you choose +to try and recover from a print timing-out, use C to +determine how much was written before the error occurred. + +You may also use the output field separator to print a string between +the list elements. See C. + +=back + + +=over 4 + +=item B - number of bytes written by print + + $num = $obj->print_length; + +This returns the number of bytes successfully written by the most +recent C or C. + +=back + + +=over 4 + +=item B - pattern to match a prompt + + $matchop = $obj->prompt; + + $prev = $obj->prompt($matchop); + +This method sets the pattern used to find a prompt in the input +stream. It must be a string representing a valid perl pattern match +operator. The methods C and C try to read until +matching the prompt. They will fail with a time-out error if the +pattern you've chosen doesn't match what the remote side sends. + +With no argument this method returns the prompt set in the object. +With an argument it sets the prompt to I<$matchop> and returns the +previous value. + +The default prompt is C<'/[\$%#E] $/'> + +Always use single quotes, instead of double quotes, to construct +I<$matchop> (e.g. C<'/bash\$ $/'>). If you're constructing a DOS like +file path, you'll need to use four backslashes to represent one +(e.g. C<'/c:\\\\users\\\\billE$/i'>). + +Of course don't forget about regexp metacharacters like C<.>, C<[>, or +C<$>. You'll only need a single backslash to quote them. The anchor +metacharacters C<^> and C<$> refer to positions in the input buffer. + +A warning is printed to STDERR when attempting to set this attribute +with a match operator missing its opening delimiter. + +=back + + +=over 4 + +=item B - write to object + + $ok = $obj->put($string); + + $ok = $obj->put(String => $string, + [Binmode => $mode,] + [Errmode => $errmode,] + [Telnetmode => $mode,] + [Timeout => $secs,]); + +This method writes I<$string> to the opened object and returns C<1> if +all data was successfully written. This method is like C +except that it doesn't write the trailing output_record_separator +("\n" by default). On time-out or other failures, the error mode +action is performed. See C. + +On failure, it's possible that some data was written. If you choose +to try and recover from a put timing-out, use C to +determine how much was written before the error occurred. + +Optional named parameters are provided to override the current +settings of binmode, errmode, telnetmode, and timeout. + +=back + + +=over 4 + +=item B - input line delimiter + + $chars = $obj->rs; + + $prev = $obj->rs($chars); + +This method is synonymous with C. + +=back + + +=over 4 + +=item B - turn off/on telnet command interpretation + + $mode = $obj->telnetmode; + + $prev = $obj->telnetmode($mode); + +This method controls whether or not TELNET commands in the data stream +are recognized and handled. The TELNET protocol uses certain +character sequences sent in the data stream to control the session. +If the port you're connecting to isn't using the TELNET protocol, then +you should turn this mode off. The default is I. + +If no argument is given, the current mode is returned. + +If I<$mode> is C<0> then telnet mode is off. If I<$mode> is C<1> then +telnet mode is on. + +=back + + +=over 4 + +=item B - time-out indicator + + $boolean = $obj->timed_out; + + $prev = $obj->timed_out($boolean); + +This method indicates if a previous read, write, or open method +timed-out. Remember that timing-out is itself an error. To be able +to invoke C after a time-out error, you'd have to change +the default error mode to something other than C<"die">. See +C. + +With no argument this method returns C<1> if the previous method +timed-out. With an argument it sets the indicator. Normally, only +internal methods set this indicator. + +=back + + +=over 4 + +=item B - I/O time-out interval + + $secs = $obj->timeout; + + $prev = $obj->timeout($secs); + +This method sets the timeout interval that's used when performing I/O +or connecting to a port. When a method doesn't complete within the +timeout interval then it's an error and the error mode action is +performed. + +A timeout may be expressed as a relative or absolute value. If +I<$secs> is greater than or equal to the time the program started, as +determined by $^T, then it's an absolute time value for when time-out +occurs. The perl function C may be used to obtain an absolute +time value. For a relative time-out value less than $^T, time-out +happens I<$secs> from when the method begins. + +If I<$secs> is C<0> then time-out occurs if the data cannot be +immediately read or written. Use the undefined value to turn off +timing-out completely. + +With no argument this method returns the timeout set in the object. +With an argument it sets the timeout to I<$secs> and returns the +previous value. The default timeout value is C<10> seconds. + +A warning is printed to STDERR when attempting to set this attribute +to something that's not an C or a non-negative integer. + +=back + + +=over 4 + +=item B - wait for pattern in the input + + $ok = $obj->waitfor($matchop); + $ok = $obj->waitfor([Match => $matchop,] + [String => $string,] + [Binmode => $mode,] + [Errmode => $errmode,] + [Telnetmode => $mode,] + [Timeout => $secs,]); + + ($prematch, $match) = $obj->waitfor($matchop); + ($prematch, $match) = $obj->waitfor([Match => $matchop,] + [String => $string,] + [Binmode => $mode,] + [Errmode => $errmode,] + [Telnetmode => $mode,] + [Timeout => $secs,]); + +This method reads until a pattern match or string is found in the +input stream. All the characters before and including the match are +removed from the input stream. + +In a list context the characters before the match and the matched +characters are returned in I<$prematch> and I<$match>. In a scalar +context, the matched characters and all characters before it are +discarded and C<1> is returned on success. On time-out, eof, or other +failures, for both list and scalar context, the error mode action is +performed. See C. + +You can specify more than one pattern or string by simply providing +multiple I and/or I named parameters. A I<$matchop> +must be a string representing a valid Perl pattern match operator. +The I<$string> is just a substring to find in the input stream. + +Use C to debug when this method keeps timing-out and you +don't think it should. + +An optional named parameter is provided to override the current +setting of timeout. + +To avoid unexpected backslash interpretation, always use single quotes +instead of double quotes to construct a match operator argument for +C and C (e.g. C<'/bash\$ $/'>). If you're +constructing a DOS like file path, you'll need to use four backslashes +to represent one (e.g. C<'/c:\\\\users\\\\billE$/i'>). + +Of course don't forget about regexp metacharacters like C<.>, C<[>, or +C<$>. You'll only need a single backslash to quote them. The anchor +metacharacters C<^> and C<$> refer to positions in the input buffer. + +Optional named parameters are provided to override the current +settings of binmode, errmode, telnetmode, and timeout. + +=back + + +=head1 SEE ALSO + +=over 2 + +=item RFC 854 + +S + +S + +=item RFC 1143 + +S + +S + +=item TELNET Option Assignments + +S + +=back + + +=head1 EXAMPLES + +This example gets the current weather forecast for Brainerd, Minnesota. + + my ($forecast, $t); + + use Net::Telnet (); + $t = new Net::Telnet; + $t->open("rainmaker.wunderground.com"); + + ## Wait for first prompt and "hit return". + $t->waitfor('/continue:.*$/'); + $t->print(""); + + ## Wait for second prompt and respond with city code. + $t->waitfor('/city code.*$/'); + $t->print("BRD"); + + ## Read and print the first page of forecast. + ($forecast) = $t->waitfor('/[ \t]+press return to continue/i'); + print $forecast; + + exit; + + +This example checks a POP server to see if you have mail. + + my ($hostname, $line, $passwd, $pop, $username); + + $hostname = "your_destination_host_here"; + $username = "your_username_here"; + $passwd = "your_password_here"; + + use Net::Telnet (); + $pop = new Net::Telnet (Telnetmode => 0); + $pop->open(Host => $hostname, + Port => 110); + + + ## Read connection message. + $line = $pop->getline; + die $line unless $line =~ /^\+OK/; + + ## Send user name. + $pop->print("user $username"); + $line = $pop->getline; + die $line unless $line =~ /^\+OK/; + + ## Send password. + $pop->print("pass $passwd"); + $line = $pop->getline; + die $line unless $line =~ /^\+OK/; + + ## Request status of messages. + $pop->print("list"); + $line = $pop->getline; + print $line; + + exit; + + +Here's an example that uses the ssh program to connect to a remote +host. Because the ssh program reads and writes to its controlling +terminal, the IO::Pty module is used to create a new pseudo terminal +for use by ssh. A new Net::Telnet object is then created to read and +write to that pseudo terminal. To use the code below, substitute +"changeme" with the actual host, user, password, and command prompt. + + ## Main program. + { + my ($pty, $ssh, @lines); + my $host = "changeme"; + my $user = "changeme"; + my $password = "changeme"; + my $prompt = '/changeme:~> $/'; + + ## Start ssh program. + $pty = &spawn("ssh", "-l", $user, $host); # spawn() defined below + + ## Create a Net::Telnet object to perform I/O on ssh's tty. + use Net::Telnet; + $ssh = new Net::Telnet (-fhopen => $pty, + -prompt => $prompt, + -telnetmode => 0, + -cmd_remove_mode => 1, + -output_record_separator => "\r"); + + ## Login to remote host. + $ssh->waitfor(-match => '/password: ?$/i', + -errmode => "return") + or die "problem connecting to host: ", $ssh->lastline; + $ssh->print($password); + $ssh->waitfor(-match => $ssh->prompt, + -errmode => "return") + or die "login failed: ", $ssh->lastline; + + ## Send command, get and print its output. + @lines = $ssh->cmd("who"); + print @lines; + + exit; + } # end main program + + sub spawn { + my(@cmd) = @_; + my($pid, $pty, $tty, $tty_fd); + + ## Create a new pseudo terminal. + use IO::Pty (); + $pty = new IO::Pty + or die $!; + + ## Execute the program in another process. + unless ($pid = fork) { # child process + die "problem spawning program: $!\n" unless defined $pid; + + ## Disassociate process from existing controlling terminal. + use POSIX (); + POSIX::setsid + or die "setsid failed: $!"; + + ## Associate process with a new controlling terminal. + $tty = $pty->slave; + $tty_fd = $tty->fileno; + close $pty; + + ## Make stdio use the new controlling terminal. + open STDIN, "<&$tty_fd" or die $!; + open STDOUT, ">&$tty_fd" or die $!; + open STDERR, ">&STDOUT" or die $!; + close $tty; + + ## Execute requested program. + exec @cmd + or die "problem executing $cmd[0]\n"; + } # end child process + + $pty; + } # end sub spawn + + +Here's an example that changes a user's login password. Because the +passwd program always prompts for passwords on its controlling +terminal, the IO::Pty module is used to create a new pseudo terminal +for use by passwd. A new Net::Telnet object is then created to read +and write to that pseudo terminal. To use the code below, substitute +"changeme" with the actual old and new passwords. + + my ($pty, $passwd); + my $oldpw = "changeme"; + my $newpw = "changeme"; + + ## Start passwd program. + $pty = &spawn("passwd"); # spawn() defined above + + ## Create a Net::Telnet object to perform I/O on passwd's tty. + use Net::Telnet; + $passwd = new Net::Telnet (-fhopen => $pty, + -timeout => 2, + -output_record_separator => "\r", + -telnetmode => 0, + -cmd_remove_mode => 1); + $passwd->errmode("return"); + + ## Send existing password. + $passwd->waitfor('/password: ?$/i') + or die "no old password prompt: ", $passwd->lastline; + $passwd->print($oldpw); + + ## Send new password. + $passwd->waitfor('/new password: ?$/i') + or die "bad old password: ", $passwd->lastline; + $passwd->print($newpw); + + ## Send new password verification. + $passwd->waitfor('/new password: ?$/i') + or die "bad new password: ", $passwd->lastline; + $passwd->print($newpw); + + ## Display success or failure. + $passwd->waitfor('/changed/') + or die "bad new password: ", $passwd->lastline; + print $passwd->lastline; + + $passwd->close; + exit; + + +Here's an example you can use to down load a file of any type. The +file is read from the remote host's standard output using cat. To +prevent any output processing, the remote host's standard output is +put in raw mode using the Bourne shell. The Bourne shell is used +because some shells, notably tcsh, prevent changing tty modes. Upon +completion, FTP style statistics are printed to stderr. + + my ($block, $filename, $host, $hostname, $k_per_sec, $line, + $num_read, $passwd, $prevblock, $prompt, $size, $size_bsd, + $size_sysv, $start_time, $total_time, $username); + + $hostname = "your_destination_host_here"; + $username = "your_username_here"; + $passwd = "your_password_here"; + $filename = "your_download_file_here"; + + ## Connect and login. + use Net::Telnet (); + $host = new Net::Telnet (Timeout => 30, + Prompt => '/[%#>] $/'); + $host->open($hostname); + $host->login($username, $passwd); + + ## Make sure prompt won't match anything in send data. + $prompt = "_funkyPrompt_"; + $host->prompt("/$prompt\$/"); + $host->cmd("set prompt = '$prompt'"); + + ## Get size of file. + ($line) = $host->cmd("/bin/ls -l $filename"); + ($size_bsd, $size_sysv) = (split ' ', $line)[3,4]; + if ($size_sysv =~ /^\d+$/) { + $size = $size_sysv; + } + elsif ($size_bsd =~ /^\d+$/) { + $size = $size_bsd; + } + else { + die "$filename: no such file on $hostname"; + } + + ## Start sending the file. + binmode STDOUT; + $host->binmode(1); + $host->print("/bin/sh -c 'stty raw; cat $filename'"); + $host->getline; # discard echoed back line + + ## Read file a block at a time. + $num_read = 0; + $prevblock = ""; + $start_time = time; + while (($block = $host->get) and ($block !~ /$prompt$/o)) { + if (length $block >= length $prompt) { + print $prevblock; + $num_read += length $prevblock; + $prevblock = $block; + } + else { + $prevblock .= $block; + } + + } + $host->close; + + ## Print last block without trailing prompt. + $prevblock .= $block; + $prevblock =~ s/$prompt$//; + print $prevblock; + $num_read += length $prevblock; + die "error: expected size $size, received size $num_read\n" + unless $num_read == $size; + + ## Print totals. + $total_time = (time - $start_time) || 1; + $k_per_sec = ($size / 1024) / $total_time; + $k_per_sec = sprintf "%3.1f", $k_per_sec; + warn("$num_read bytes received in $total_time seconds ", + "($k_per_sec Kbytes/s)\n"); + + exit; + + +=head1 AUTHOR + +Jay Rogers + + +=head1 COPYRIGHT + +Copyright 1997, 2000, 2002 by Jay Rogers. All rights reserved. +This program is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. diff --git a/agc_2-X/branches/agc_2.0.4/extras/Telnet.pm b/agc_2-X/branches/agc_2.0.4/extras/Telnet.pm new file mode 100644 index 00000000..9f84fe31 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/extras/Telnet.pm @@ -0,0 +1,5252 @@ +package Net::Telnet; + +## Copyright 1997, 2000, 2002 Jay Rogers. All rights reserved. +## This program is free software; you can redistribute it and/or +## modify it under the same terms as Perl itself. + +## See user documentation at the end of this file. Search for =head + +use strict; +require 5.002; + +## Module export. +use vars qw(@EXPORT_OK); +@EXPORT_OK = qw(TELNET_IAC TELNET_DONT TELNET_DO TELNET_WONT TELNET_WILL + TELNET_SB TELNET_GA TELNET_EL TELNET_EC TELNET_AYT TELNET_AO + TELNET_IP TELNET_BREAK TELNET_DM TELNET_NOP TELNET_SE + TELNET_EOR TELNET_ABORT TELNET_SUSP TELNET_EOF TELNET_SYNCH + TELOPT_BINARY TELOPT_ECHO TELOPT_RCP TELOPT_SGA TELOPT_NAMS + TELOPT_STATUS TELOPT_TM TELOPT_RCTE TELOPT_NAOL TELOPT_NAOP + TELOPT_NAOCRD TELOPT_NAOHTS TELOPT_NAOHTD TELOPT_NAOFFD + TELOPT_NAOVTS TELOPT_NAOVTD TELOPT_NAOLFD TELOPT_XASCII + TELOPT_LOGOUT TELOPT_BM TELOPT_DET TELOPT_SUPDUP + TELOPT_SUPDUPOUTPUT TELOPT_SNDLOC TELOPT_TTYPE TELOPT_EOR + TELOPT_TUID TELOPT_OUTMRK TELOPT_TTYLOC TELOPT_3270REGIME + TELOPT_X3PAD TELOPT_NAWS TELOPT_TSPEED TELOPT_LFLOW + TELOPT_LINEMODE TELOPT_XDISPLOC TELOPT_OLD_ENVIRON + TELOPT_AUTHENTICATION TELOPT_ENCRYPT TELOPT_NEW_ENVIRON + TELOPT_EXOPL); + +## Module import. +use Exporter (); +use Socket qw(AF_INET SOCK_STREAM inet_aton sockaddr_in); +use Symbol qw(qualify); + +## Base classes. +use vars qw(@ISA); +@ISA = qw(Exporter); +if (&_io_socket_include) { # successfully required module IO::Socket + push @ISA, "IO::Socket::INET"; +} +else { # perl version < 5.004 + require FileHandle; + push @ISA, "FileHandle"; +} + +## Global variables. +use vars qw($VERSION @Telopts); +$VERSION = "3.03"; +@Telopts = ("BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", "STATUS", + "TIMING MARK", "RCTE", "NAOL", "NAOP", "NAOCRD", "NAOHTS", + "NAOHTD", "NAOFFD", "NAOVTS", "NAOVTD", "NAOLFD", "EXTEND ASCII", + "LOGOUT", "BYTE MACRO", "DATA ENTRY TERMINAL", "SUPDUP", + "SUPDUP OUTPUT", "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD", + "TACACS UID", "OUTPUT MARKING", "TTYLOC", "3270 REGIME", "X.3 PAD", + "NAWS", "TSPEED", "LFLOW", "LINEMODE", "XDISPLOC", "OLD-ENVIRON", + "AUTHENTICATION", "ENCRYPT", "NEW-ENVIRON"); + + +########################### Public Methods ########################### + + +sub new { + my ($class) = @_; + my ( + $errmode, + $fh_open, + $host, + $self, + %args, + ); + local $_; + + ## Create a new object with defaults. + $self = $class->SUPER::new; + *$self->{net_telnet} = { + bin_mode => 0, + blksize => &_optimal_blksize(), + buf => "", + cmd_prompt => '/[\$%#>] $/', + cmd_rm_mode => "auto", + dumplog => '', + eofile => 1, + errormode => "die", + errormsg => "", + fdmask => '', + host => "localhost", + inputlog => '', + last_line => "", + last_prompt => "", + maxbufsize => 1_048_576, + num_wrote => 0, + ofs => "", + opened => '', + opt_cback => '', + opt_log => '', + opts => {}, + ors => "\n", + outputlog => '', + pending_errormsg => "", + port => 23, + pushback_buf => "", + rs => "\n", + subopt_cback => '', + telnet_mode => 1, + time_out => 10, + timedout => '', + unsent_opts => "", + }; + + ## Indicate that we'll accept an offer from remote side for it to echo + ## and suppress go aheads. + &_opt_accept($self, + { option => &TELOPT_ECHO, + is_remote => 1, + is_enable => 1 }, + { option => &TELOPT_SGA, + is_remote => 1, + is_enable => 1 }, + ); + + ## Parse the args. + if (@_ == 2) { # one positional arg given + $host = $_[1]; + } + elsif (@_ > 2) { # named args given + ## Get the named args. + (undef, %args) = @_; + + ## Parse all other named args. + foreach (keys %args) { + if (/^-?binmode$/i) { + $self->binmode($args{$_}); + } + elsif (/^-?cmd_remove_mode$/i) { + $self->cmd_remove_mode($args{$_}); + } + elsif (/^-?dump_log$/i) { + $self->dump_log($args{$_}); + } + elsif (/^-?errmode$/i) { + $errmode = $args{$_}; + } + elsif (/^-?fhopen$/i) { + $fh_open = $args{$_}; + } + elsif (/^-?host$/i) { + $host = $args{$_}; + } + elsif (/^-?input_log$/i) { + $self->input_log($args{$_}); + } + elsif (/^-?input_record_separator$/i or /^-?rs$/i) { + $self->input_record_separator($args{$_}); + } + elsif (/^-?option_log$/i) { + $self->option_log($args{$_}); + } + elsif (/^-?output_log$/i) { + $self->output_log($args{$_}); + } + elsif (/^-?output_record_separator$/i or /^-?ors$/i) { + $self->output_record_separator($args{$_}); + } + elsif (/^-?port$/i) { + $self->port($args{$_}); + } + elsif (/^-?prompt$/i) { + $self->prompt($args{$_}); + } + elsif (/^-?telnetmode$/i) { + $self->telnetmode($args{$_}); + } + elsif (/^-?timeout$/i) { + $self->timeout($args{$_}); + } + else { + &_croak($self, "bad named parameter \"$_\" given " . + "to " . ref($self) . "::new()"); + } + } + } + + if (defined $errmode) { # user wants to set errmode + $self->errmode($errmode); + } + + if (defined $fh_open) { # user wants us to attach to existing filehandle + $self->fhopen($fh_open) + or return; + } + elsif (defined $host) { # user wants us to open a connection to host + $self->host($host); + $self->open + or return; + } + + $self; +} # end sub new + + +sub DESTROY { +} # end sub DESTROY + + +sub binmode { + my ($self, $mode) = @_; + my ( + $prev, + $s, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{bin_mode}; + + if (@_ >= 2) { + unless (defined $mode) { + $mode = 0; + } + + $s->{bin_mode} = $mode; + } + + $prev; +} # end sub binmode + + +sub break { + my ($self) = @_; + my $s = *$self->{net_telnet}; + my $break_cmd = "\xff\xf3"; + + $s->{timedout} = ''; + + &_put($self, \$break_cmd, "break"); +} # end sub break + + +sub buffer { + my ($self) = @_; + my $s = *$self->{net_telnet}; + + \$s->{buf}; +} # end sub buffer + + +sub buffer_empty { + my ($self) = @_; + my ( + $buffer, + ); + + $buffer = $self->buffer; + $$buffer = ""; +} # end sub buffer_empty + + +sub close { + my ($self) = @_; + my $s = *$self->{net_telnet}; + + $s->{eofile} = 1; + $s->{opened} = ''; + close $self + if defined fileno($self); + + 1; +} # end sub close + + +sub cmd { + my ($self, @args) = @_; + my ( + $cmd_remove_mode, + $errmode, + $firstpos, + $last_prompt, + $lastpos, + $lines, + $ors, + $output, + $output_ref, + $prompt, + $remove_echo, + $rs, + $rs_len, + $s, + $telopt_echo, + $timeout, + %args, + ); + my $cmd = ""; + local $_; + + ## Init. + $self->timed_out(''); + $self->last_prompt(""); + $s = *$self->{net_telnet}; + $output = []; + $cmd_remove_mode = $self->cmd_remove_mode; + $errmode = $self->errmode; + $ors = $self->output_record_separator; + $prompt = $self->prompt; + $rs = $self->input_record_separator; + $timeout = $self->timeout; + + ## Parse args. + if (@_ == 2) { # one positional arg given + $cmd = $_[1]; + } + elsif (@_ > 2) { # named args given + ## Get the named args. + (undef, %args) = @_; + + ## Parse the named args. + foreach (keys %args) { + if (/^-?cmd_remove/i) { + $cmd_remove_mode = &_parse_cmd_remove_mode($self, $args{$_}); + } + elsif (/^-?errmode$/i) { + $errmode = &_parse_errmode($self, $args{$_}); + } + elsif (/^-?input_record_separator$/i or /^-?rs$/i) { + $rs = &_parse_input_record_separator($self, $args{$_}); + } + elsif (/^-?output$/i) { + $output_ref = $args{$_}; + if (defined($output_ref) and ref($output_ref) eq "ARRAY") { + $output = $output_ref; + } + } + elsif (/^-?output_record_separator$/i or /^-?ors$/i) { + $ors = $self->output_record_separator($args{$_}); + } + elsif (/^-?prompt$/i) { + $prompt = &_parse_prompt($self, $args{$_}); + } + elsif (/^-?string$/i) { + $cmd = $args{$_}; + } + elsif (/^-?timeout$/i) { + $timeout = &_parse_timeout($self, $args{$_}); + } + else { + &_croak($self, "bad named parameter \"$_\" given " . + "to " . ref($self) . "::cmd()"); + } + } + } + + ## Override some user settings. + local $s->{errormode} = "return"; + local $s->{time_out} = &_endtime($timeout); + $self->errmsg(""); + + ## Send command and wait for the prompt. + $self->put($cmd . $ors) + and ($lines, $last_prompt) = $self->waitfor($prompt); + + ## Check for failure. + $s->{errormode} = $errmode; + return $self->error("command timed-out") if $self->timed_out; + return $self->error($self->errmsg) if $self->errmsg ne ""; + + ## Save the most recently matched prompt. + $self->last_prompt($last_prompt); + + ## Split lines into an array, keeping record separator at end of line. + $firstpos = 0; + $rs_len = length $rs; + while (($lastpos = index($lines, $rs, $firstpos)) > -1) { + push(@$output, + substr($lines, $firstpos, $lastpos - $firstpos + $rs_len)); + $firstpos = $lastpos + $rs_len; + } + + if ($firstpos < length $lines) { + push @$output, substr($lines, $firstpos); + } + + ## Determine if we should remove the first line of output based + ## on the assumption that it's an echoed back command. + if ($cmd_remove_mode eq "auto") { + ## See if remote side told us they'd echo. + $telopt_echo = $self->option_state(&TELOPT_ECHO); + $remove_echo = $telopt_echo->{remote_enabled}; + } + else { # user explicitly told us how many lines to remove. + $remove_echo = $cmd_remove_mode; + } + + ## Get rid of possible echo back command. + while ($remove_echo--) { + shift @$output; + } + + ## Ensure at least a null string when there's no command output - so + ## "true" is returned in a list context. + unless (@$output) { + @$output = (""); + } + + ## Return command output via named arg, if requested. + if (defined $output_ref) { + if (ref($output_ref) eq "SCALAR") { + $$output_ref = join "", @$output; + } + elsif (ref($output_ref) eq "HASH") { + %$output_ref = @$output; + } + } + + wantarray ? @$output : 1; +} # end sub cmd + + +sub cmd_remove_mode { + my ($self, $mode) = @_; + my ( + $prev, + $s, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{cmd_rm_mode}; + + if (@_ >= 2) { + $s->{cmd_rm_mode} = &_parse_cmd_remove_mode($self, $mode); + } + + $prev; +} # end sub cmd_remove_mode + + +sub dump_log { + my ($self, $name) = @_; + my ( + $fh, + $s, + ); + + $s = *$self->{net_telnet}; + $fh = $s->{dumplog}; + + if (@_ >= 2) { + unless (defined $name) { + $name = ""; + } + + $fh = &_fname_to_handle($self, $name) + or return; + $s->{dumplog} = $fh; + } + + $fh; +} # end sub dump_log + + +sub eof { + my ($self) = @_; + + *$self->{net_telnet}{eofile}; +} # end sub eof + + +sub errmode { + my ($self, $mode) = @_; + my ( + $prev, + $s, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{errormode}; + + if (@_ >= 2) { + $s->{errormode} = &_parse_errmode($self, $mode); + } + + $prev; +} # end sub errmode + + +sub errmsg { + my ($self, @errmsgs) = @_; + my ( + $prev, + $s, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{errormsg}; + + if (@_ >= 2) { + $s->{errormsg} = join "", @errmsgs; + } + + $prev; +} # end sub errmsg + + +sub error { + my ($self, @errmsg) = @_; + my ( + $errmsg, + $func, + $mode, + $s, + @args, + ); + local $_; + + $s = *$self->{net_telnet}; + + if (@_ >= 2) { + ## Put error message in the object. + $errmsg = join "", @errmsg; + $s->{errormsg} = $errmsg; + + ## Do the error action as described by error mode. + $mode = $s->{errormode}; + if (ref($mode) eq "CODE") { + &$mode($errmsg); + return; + } + elsif (ref($mode) eq "ARRAY") { + ($func, @args) = @$mode; + &$func(@args); + return; + } + elsif ($mode =~ /^return$/i) { + return; + } + else { # die + if ($errmsg =~ /\n$/) { + die $errmsg; + } + else { + ## Die and append caller's line number to message. + &_croak($self, $errmsg); + } + } + } + else { + return $s->{errormsg} ne ""; + } +} # end sub error + + +sub fhopen { + my ($self, $fh) = @_; + my ( + $globref, + $s, + ); + + ## Convert given filehandle to a typeglob reference, if necessary. + $globref = &_qualify_fh($self, $fh); + + ## Ensure filehandle is already open. + return $self->error("fhopen filehandle isn't already open") + unless defined($globref) and defined(fileno $globref); + + ## Ensure we're closed. + $self->close; + + ## Save our private data. + $s = *$self->{net_telnet}; + + ## Switch ourself with the given filehandle. + *$self = *$globref; + + ## Restore our private data. + *$self->{net_telnet} = $s; + + ## Re-initialize ourself. + select((select($self), $|=1)[$[]); # don't buffer writes + $s = *$self->{net_telnet}; + $s->{blksize} = &_optimal_blksize((stat $self)[11]); + $s->{buf} = ""; + $s->{eofile} = ''; + $s->{errormsg} = ""; + vec($s->{fdmask}='', fileno($self), 1) = 1; + $s->{host} = ""; + $s->{last_line} = ""; + $s->{last_prompt} = ""; + $s->{num_wrote} = 0; + $s->{opened} = 1; + $s->{pending_errormsg} = ""; + $s->{port} = ''; + $s->{pushback_buf} = ""; + $s->{timedout} = ''; + $s->{unsent_opts} = ""; + &_reset_options($s->{opts}); + + 1; +} # end sub fhopen + + +sub get { + my ($self, %args) = @_; + my ( + $binmode, + $endtime, + $errmode, + $line, + $s, + $telnetmode, + $timeout, + ); + local $_; + + ## Init. + $s = *$self->{net_telnet}; + $timeout = $s->{time_out}; + $s->{timedout} = ''; + return if $s->{eofile}; + + ## Parse the named args. + foreach (keys %args) { + if (/^-?binmode$/i) { + $binmode = $args{$_}; + unless (defined $binmode) { + $binmode = 0; + } + } + elsif (/^-?errmode$/i) { + $errmode = &_parse_errmode($self, $args{$_}); + } + elsif (/^-?telnetmode$/i) { + $telnetmode = $args{$_}; + unless (defined $telnetmode) { + $telnetmode = 0; + } + } + elsif (/^-?timeout$/i) { + $timeout = &_parse_timeout($self, $args{$_}); + } + else { + &_croak($self, "bad named parameter \"$_\" given " . + "to " . ref($self) . "::get()"); + } + } + + ## If any args given, override corresponding instance data. + local $s->{errormode} = $errmode + if defined $errmode; + local $s->{bin_mode} = $binmode + if defined $binmode; + local $s->{telnet_mode} = $telnetmode + if defined $telnetmode; + + ## Set wall time when we time out. + $endtime = &_endtime($timeout); + + ## Try to send any waiting option negotiation. + if (length $s->{unsent_opts}) { + &_flush_opts($self); + } + + ## Try to read just the waiting data using return error mode. + { + local $s->{errormode} = "return"; + $s->{errormsg} = ""; + &_fillbuf($self, $s, 0); + } + + ## We're done if we timed-out and timeout value is set to "poll". + return $self->error($s->{errormsg}) + if ($s->{timedout} and defined($timeout) and $timeout == 0 + and !length $s->{buf}); + + ## We're done if we hit an error other than timing out. + if ($s->{errormsg} and !$s->{timedout}) { + if (!length $s->{buf}) { + return $self->error($s->{errormsg}); + } + else { # error encountered but there's some data in buffer + $s->{pending_errormsg} = $s->{errormsg}; + } + } + + ## Clear time-out error from first read. + $s->{timedout} = ''; + $s->{errormsg} = ""; + + ## If buffer is still empty, try to read according to user's timeout. + if (!length $s->{buf}) { + &_fillbuf($self, $s, $endtime) + or do { + return if $s->{timedout}; + + ## We've reached end-of-file. + $self->close; + return; + }; + } + + ## Extract chars from buffer. + $line = $s->{buf}; + $s->{buf} = ""; + + $line; +} # end sub get + + +sub getline { + my ($self, %args) = @_; + my ( + $binmode, + $endtime, + $errmode, + $len, + $line, + $offset, + $pos, + $rs, + $s, + $telnetmode, + $timeout, + ); + local $_; + + ## Init. + $s = *$self->{net_telnet}; + $s->{timedout} = ''; + return if $s->{eofile}; + $rs = $s->{rs}; + $timeout = $s->{time_out}; + + ## Parse the named args. + foreach (keys %args) { + if (/^-?binmode$/i) { + $binmode = $args{$_}; + unless (defined $binmode) { + $binmode = 0; + } + } + elsif (/^-?errmode$/i) { + $errmode = &_parse_errmode($self, $args{$_}); + } + elsif (/^-?input_record_separator$/i or /^-?rs$/i) { + $rs = &_parse_input_record_separator($self, $args{$_}); + } + elsif (/^-?telnetmode$/i) { + $telnetmode = $args{$_}; + unless (defined $telnetmode) { + $telnetmode = 0; + } + } + elsif (/^-?timeout$/i) { + $timeout = &_parse_timeout($self, $args{$_}); + } + else { + &_croak($self, "bad named parameter \"$_\" given " . + "to " . ref($self) . "::getline()"); + } + } + + ## If any args given, override corresponding instance data. + local $s->{bin_mode} = $binmode + if defined $binmode; + local $s->{errormode} = $errmode + if defined $errmode; + local $s->{telnet_mode} = $telnetmode + if defined $telnetmode; + + ## Set wall time when we time out. + $endtime = &_endtime($timeout); + + ## Try to send any waiting option negotiation. + if (length $s->{unsent_opts}) { + &_flush_opts($self); + } + + ## Keep reading into buffer until end-of-line is read. + $offset = 0; + while (($pos = index($s->{buf}, $rs, $offset)) == -1) { + $offset = length $s->{buf}; + &_fillbuf($self, $s, $endtime) + or do { + return if $s->{timedout}; + + ## We've reached end-of-file. + $self->close; + if (length $s->{buf}) { + return $s->{buf}; + } + else { + return; + } + }; + } + + ## Extract line from buffer. + $len = $pos + length $rs; + $line = substr($s->{buf}, 0, $len); + substr($s->{buf}, 0, $len) = ""; + + $line; +} # end sub getline + + +sub getlines { + my ($self, %args) = @_; + my ( + $binmode, + $errmode, + $line, + $rs, + $s, + $telnetmode, + $timeout, + ); + my $all = 1; + my @lines = (); + local $_; + + ## Init. + $s = *$self->{net_telnet}; + $s->{timedout} = ''; + return if $s->{eofile}; + $timeout = $s->{time_out}; + + ## Parse the named args. + foreach (keys %args) { + if (/^-?all$/i) { + $all = $args{$_}; + unless (defined $all) { + $all = ''; + } + } + elsif (/^-?binmode$/i) { + $binmode = $args{$_}; + unless (defined $binmode) { + $binmode = 0; + } + } + elsif (/^-?errmode$/i) { + $errmode = &_parse_errmode($self, $args{$_}); + } + elsif (/^-?input_record_separator$/i or /^-?rs$/i) { + $rs = &_parse_input_record_separator($self, $args{$_}); + } + elsif (/^-?telnetmode$/i) { + $telnetmode = $args{$_}; + unless (defined $telnetmode) { + $telnetmode = 0; + } + } + elsif (/^-?timeout$/i) { + $timeout = &_parse_timeout($self, $args{$_}); + } + else { + &_croak($self, "bad named parameter \"$_\" given " . + "to " . ref($self) . "::getlines()"); + } + } + + ## If any args given, override corresponding instance data. + local $s->{bin_mode} = $binmode + if defined $binmode; + local $s->{errormode} = $errmode + if defined $errmode; + local $s->{rs} = $rs + if defined $rs; + local $s->{telnet_mode} = $telnetmode + if defined $telnetmode; + local $s->{time_out} = &_endtime($timeout); + + ## User requested only the currently available lines. + if (! $all) { + return &_next_getlines($self, $s); + } + + ## Read lines until eof or error. + while (1) { + $line = $self->getline + or last; + push @lines, $line; + } + + ## Check for error. + return if ! $self->eof; + + @lines; +} # end sub getlines + + +sub host { + my ($self, $host) = @_; + my ( + $prev, + $s, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{host}; + + if (@_ >= 2) { + unless (defined $host) { + $host = ""; + } + + $s->{host} = $host; + } + + $prev; +} # end sub host + + +sub input_log { + my ($self, $name) = @_; + my ( + $fh, + $s, + ); + + $s = *$self->{net_telnet}; + $fh = $s->{inputlog}; + + if (@_ >= 2) { + unless (defined $name) { + $name = ""; + } + + $fh = &_fname_to_handle($self, $name) + or return; + $s->{inputlog} = $fh; + } + + $fh; +} # end sub input_log + + +sub input_record_separator { + my ($self, $rs) = @_; + my ( + $prev, + $s, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{rs}; + + if (@_ >= 2) { + $s->{rs} = &_parse_input_record_separator($self, $rs); + } + + $prev; +} # end sub input_record_separator + + +sub last_prompt { + my ($self, $string) = @_; + my ( + $prev, + $s, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{last_prompt}; + + if (@_ >= 2) { + unless (defined $string) { + $string = ""; + } + + $s->{last_prompt} = $string; + } + + $prev; +} # end sub last_prompt + + +sub lastline { + my ($self, $line) = @_; + my ( + $prev, + $s, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{last_line}; + + if (@_ >= 2) { + unless (defined $line) { + $line = ""; + } + + $s->{last_line} = $line; + } + + $prev; +} # end sub lastline + + +sub login { + my ($self) = @_; + my ( + $errmode, + $error, + $is_passwd_arg, + $is_username_arg, + $lastline, + $match, + $ors, + $passwd, + $prematch, + $prompt, + $s, + $timeout, + $username, + %args, + ); + local $_; + + ## Init. + $self->timed_out(''); + $self->last_prompt(""); + $s = *$self->{net_telnet}; + $timeout = $self->timeout; + $ors = $self->output_record_separator; + $prompt = $self->prompt; + + ## Parse args. + if (@_ == 3) { # just username and passwd given + $username = $_[1]; + $passwd = $_[2]; + + $is_username_arg = 1; + $is_passwd_arg = 1; + } + else { # named args given + ## Get the named args. + (undef, %args) = @_; + + ## Parse the named args. + foreach (keys %args) { + if (/^-?errmode$/i) { + $errmode = &_parse_errmode($self, $args{$_}); + } + elsif (/^-?name$/i) { + $username = $args{$_}; + unless (defined $username) { + $username = ""; + } + + $is_username_arg = 1; + } + elsif (/^-?pass/i) { + $passwd = $args{$_}; + unless (defined $passwd) { + $passwd = ""; + } + + $is_passwd_arg = 1; + } + elsif (/^-?prompt$/i) { + $prompt = &_parse_prompt($self, $args{$_}); + } + elsif (/^-?timeout$/i) { + $timeout = &_parse_timeout($self, $args{$_}); + } + else { + &_croak($self, "bad named parameter \"$_\" given ", + "to " . ref($self) . "::login()"); + } + } + } + + ## Ensure both username and password argument given. + &_croak($self,"Name argument not given to " . ref($self) . "::login()") + unless $is_username_arg; + &_croak($self,"Password argument not given to " . ref($self) . "::login()") + unless $is_passwd_arg; + + ## Override some user settings. + local $s->{errormode} = $errmode + if defined $errmode; + local $s->{time_out} = &_endtime($timeout); + + ## Create a subroutine to generate an error. + $error + = sub { + my ($errmsg) = @_; + + if ($self->timed_out) { + return $self->error($errmsg); + } + elsif ($self->eof) { + ($lastline = $self->lastline) =~ s/\n+//; + return $self->error($errmsg, ": ", $lastline); + } + else { + return $self->error($self->errmsg); + } + }; + + + return $self->error("login failed: filehandle isn't open") + if $self->eof; + + ## Wait for login prompt. + $self->waitfor(Match => '/login[: ]*$/i', + Match => '/username[: ]*$/i', + Errmode => "return") + or do { + return &$error("eof read waiting for login prompt") + if $self->eof; + return &$error("timed-out waiting for login prompt"); + }; + + ## Delay sending response because of bug in Linux login program. + &_sleep(0.01); + + ## Send login name. + $self->put(String => $username . $ors, + Errmode => "return") + or return &$error("login disconnected"); + + ## Wait for password prompt. + $self->waitfor(Match => '/password[: ]*$/i', + Errmode => "return") + or do { + return &$error("eof read waiting for password prompt") + if $self->eof; + return &$error("timed-out waiting for password prompt"); + }; + + ## Delay sending response because of bug in Linux login program. + &_sleep(0.01); + + ## Send password. + $self->put(String => $passwd . $ors, + Errmode => "return") + or return &$error("login disconnected"); + + ## Wait for command prompt or another login prompt. + ($prematch, $match) = $self->waitfor(Match => '/login[: ]*$/i', + Match => '/username[: ]*$/i', + Match => $prompt, + Errmode => "return") + or do { + return &$error("eof read waiting for command prompt") + if $self->eof; + return &$error("timed-out waiting for command prompt"); + }; + + ## It's a bad login if we got another login prompt. + return $self->error("login failed: bad name or password") + if $match =~ /login[: ]*$/i or $match =~ /username[: ]*$/i; + + ## Save the most recently matched command prompt. + $self->last_prompt($match); + + 1; +} # end sub login + + +sub max_buffer_length { + my ($self, $maxbufsize) = @_; + my ( + $prev, + $s, + ); + my $minbufsize = 512; + + $s = *$self->{net_telnet}; + $prev = $s->{maxbufsize}; + + if (@_ >= 2) { + ## Ensure a positive integer value. + unless (defined $maxbufsize + and $maxbufsize =~ /^\d+$/ + and $maxbufsize) + { + &_carp($self, "ignoring bad Max_buffer_length " . + "argument \"$maxbufsize\": it's not a positive integer"); + $maxbufsize = $prev; + } + + ## Adjust up values that are too small. + if ($maxbufsize < $minbufsize) { + $maxbufsize = $minbufsize; + } + + $s->{maxbufsize} = $maxbufsize; + } + + $prev; +} # end sub max_buffer_length + + +## Make ofs() synonymous with output_field_separator(). +*ofs = \&output_field_separator; + + +sub open { + my ($self) = @_; + my ( + $errmode, + $errno, + $host, + $ip_addr, + $port, + $s, + $timeout, + %args, + ); + local $_; + + ## Init. + $s = *$self->{net_telnet}; + $timeout = $s->{time_out}; + $s->{timedout} = ''; + + if (@_ == 2) { # one positional arg given + $self->host($_[1]); + } + elsif (@_ > 2) { # named args given + ## Get the named args. + (undef, %args) = @_; + + ## Parse the named args. + foreach (keys %args) { + if (/^-?errmode$/i) { + $errmode = &_parse_errmode($self, $args{$_}); + } + elsif (/^-?host$/i) { + $self->host($args{$_}); + } + elsif (/^-?port$/i) { + $self->port($args{$_}) + or return; + } + elsif (/^-?timeout$/i) { + $timeout = &_parse_timeout($self, $args{$_}); + } + else { + &_croak($self, "bad named parameter \"$_\" given ", + "to " . ref($self) . "::open()"); + } + } + } + + ## If any args given, override corresponding instance data. + local $s->{errormode} = $errmode + if defined $errmode; + + ## Get host and port. + $host = $self->host; + $port = $self->port; + + ## Ensure we're already closed. + $self->close; + + ## Connect with or without a timeout. + if (defined($timeout) and &_have_alarm) { # use a timeout + ## Convert possible absolute timeout to relative timeout. + if ($timeout >= $^T) { # it's an absolute time + $timeout = $timeout - time; + } + + ## Ensure a valid timeout value for alarm. + if ($timeout < 1) { + $timeout = 1; + } + $timeout = int($timeout + 1.5); + + ## Connect to server, timing out if it takes too long. + eval { + ## Turn on timer. + local $SIG{"__DIE__"} = "DEFAULT"; + local $SIG{ALRM} = sub { die "timed-out\n" }; + alarm $timeout; + + ## Lookup server's IP address. + $ip_addr = inet_aton $host + or die "unknown remote host: $host\n"; + + ## Create a socket and attach the filehandle to it. + socket $self, AF_INET, SOCK_STREAM, 0 + or die "problem creating socket: $!\n"; + + ## Open connection to server. + connect $self, sockaddr_in($port, $ip_addr) + or die "problem connecting to \"$host\", port $port: $!\n"; + }; + alarm 0; + + ## Check for error. + if ($@ =~ /^timed-out$/) { # time out failure + $s->{timedout} = 1; + $self->close; + if (!$ip_addr) { + return $self->error("unknown remote host: $host: ", + "name lookup timed-out"); + } + else { + return $self->error("problem connecting to \"$host\", ", + "port $port: connect timed-out"); + } + } + elsif ($@) { # hostname lookup or connect failure + $self->close; + chomp $@; + return $self->error($@); + } + } + else { # don't use a timeout + $timeout = undef; + + ## Lookup server's IP address. + $ip_addr = inet_aton $host + or return $self->error("unknown remote host: $host"); + + ## Create a socket and attach the filehandle to it. + socket $self, AF_INET, SOCK_STREAM, 0 + or return $self->error("problem creating socket: $!"); + + ## Open connection to server. + connect $self, sockaddr_in($port, $ip_addr) + or do { + $errno = "$!"; + $self->close; + return $self->error("problem connecting to \"$host\", ", + "port $port: $errno"); + }; + } + + select((select($self), $|=1)[$[]); # don't buffer writes + $s->{blksize} = &_optimal_blksize((stat $self)[11]); + $s->{buf} = ""; + $s->{eofile} = ''; + $s->{errormsg} = ""; + vec($s->{fdmask}='', fileno($self), 1) = 1; + $s->{last_line} = ""; + $s->{num_wrote} = 0; + $s->{opened} = 1; + $s->{pending_errormsg} = ""; + $s->{pushback_buf} = ""; + $s->{timedout} = ''; + $s->{unsent_opts} = ""; + &_reset_options($s->{opts}); + + 1; +} # end sub open + + +sub option_accept { + my ($self, @args) = @_; + my ( + $arg, + $option, + $s, + @opt_args, + ); + local $_; + + ## Init. + $s = *$self->{net_telnet}; + + ## Parse the named args. + while (($_, $arg) = splice @args, 0, 2) { + ## Verify and save arguments. + if (/^-?do$/i) { + ## Make sure a callback is defined. + return $self->error("usage: an option callback must already ", + "be defined when enabling with $_") + unless $s->{opt_cback}; + + $option = &_verify_telopt_arg($self, $arg, $_); + return unless defined $option; + push @opt_args, { option => $option, + is_remote => '', + is_enable => 1, + }; + } + elsif (/^-?dont$/i) { + $option = &_verify_telopt_arg($self, $arg, $_); + return unless defined $option; + push @opt_args, { option => $option, + is_remote => '', + is_enable => '', + }; + } + elsif (/^-?will$/i) { + ## Make sure a callback is defined. + return $self->error("usage: an option callback must already ", + "be defined when enabling with $_") + unless $s->{opt_cback}; + + $option = &_verify_telopt_arg($self, $arg, $_); + return unless defined $option; + push @opt_args, { option => $option, + is_remote => 1, + is_enable => 1, + }; + } + elsif (/^-?wont$/i) { + $option = &_verify_telopt_arg($self, $arg, $_); + return unless defined $option; + push @opt_args, { option => $option, + is_remote => 1, + is_enable => '', + }; + } + else { + return $self->error('usage: $obj->option_accept(' . + '[Do => $telopt,] ', + '[Dont => $telopt,] ', + '[Will => $telopt,] ', + '[Wont => $telopt,]'); + } + } + + ## Set "receive ok" for options specified. + &_opt_accept($self, @opt_args); +} # end sub option_accept + + +sub option_callback { + my ($self, $callback) = @_; + my ( + $prev, + $s, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{opt_cback}; + + if (@_ >= 2) { + unless (defined $callback and ref($callback) eq "CODE") { + &_carp($self, "ignoring Option_callback argument because it's " . + "not a code ref"); + $callback = $prev; + } + + $s->{opt_cback} = $callback; + } + + $prev; +} # end sub option_callback + + +sub option_log { + my ($self, $name) = @_; + my ( + $fh, + $s, + ); + + $s = *$self->{net_telnet}; + $fh = $s->{opt_log}; + + if (@_ >= 2) { + unless (defined $name) { + $name = ""; + } + + $fh = &_fname_to_handle($self, $name) + or return; + $s->{opt_log} = $fh; + } + + $fh; +} # end sub option_log + + +sub option_state { + my ($self, $option) = @_; + my ( + $opt_state, + $s, + %opt_state, + ); + + ## Ensure telnet option is non-negative integer. + $option = &_verify_telopt_arg($self, $option); + return unless defined $option; + + ## Init. + $s = *$self->{net_telnet}; + unless (defined $s->{opts}{$option}) { + &_set_default_option($s, $option); + } + + ## Return hashref to a copy of the values. + $opt_state = $s->{opts}{$option}; + %opt_state = %$opt_state; + \%opt_state; +} # end sub option_state + + +## Make ors() synonymous with output_record_separator(). +*ors = \&output_record_separator; + + +sub output_field_separator { + my ($self, $ofs) = @_; + my ( + $prev, + $s, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{ofs}; + + if (@_ >= 2) { + unless (defined $ofs) { + $ofs = ""; + } + + $s->{ofs} = $ofs; + } + + $prev; +} # end sub output_field_separator + + +sub output_log { + my ($self, $name) = @_; + my ( + $fh, + $s, + ); + + $s = *$self->{net_telnet}; + $fh = $s->{outputlog}; + + if (@_ >= 2) { + unless (defined $name) { + $name = ""; + } + + $fh = &_fname_to_handle($self, $name) + or return; + $s->{outputlog} = $fh; + } + + $fh; +} # end sub output_log + + +sub output_record_separator { + my ($self, $ors) = @_; + my ( + $prev, + $s, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{ors}; + + if (@_ >= 2) { + unless (defined $ors) { + $ors = ""; + } + + $s->{ors} = $ors; + } + + $prev; +} # end sub output_record_separator + + +sub port { + my ($self, $port) = @_; + my ( + $prev, + $s, + $service, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{port}; + + if (@_ >= 2) { + unless (defined $port) { + $port = ""; + } + + if (!$port) { + &_carp($self, "ignoring bad Port argument \"$port\""); + $port = $prev; + } + elsif ($port !~ /^\d+$/) { # port isn't all digits + $service = $port; + $port = getservbyname($service, "tcp"); + unless ($port) { + &_carp($self, "ignoring bad Port argument \"$service\": " . + "it's an unknown TCP service"); + $port = $prev; + } + } + + $s->{port} = $port; + } + + $prev; +} # end sub port + + +sub print { + my ($self) = shift; + my ( + $buf, + $fh, + $s, + ); + + $s = *$self->{net_telnet}; + $s->{timedout} = ''; + return $self->error("write error: filehandle isn't open") + unless $s->{opened}; + + ## Add field and record separators. + $buf = join($s->{ofs}, @_) . $s->{ors}; + + ## Log the output if requested. + if ($s->{outputlog}) { + &_log_print($s->{outputlog}, $buf); + } + + ## Convert native newlines to CR LF. + if (!$s->{bin_mode}) { + $buf =~ s(\n)(\015\012)g; + } + + ## Escape TELNET IAC and also CR not followed by LF. + if ($s->{telnet_mode}) { + $buf =~ s(\377)(\377\377)g; + &_escape_cr(\$buf); + } + + &_put($self, \$buf, "print"); +} # end sub print + + +sub print_length { + my ($self) = @_; + + *$self->{net_telnet}{num_wrote}; +} # end sub print_length + + +sub prompt { + my ($self, $prompt) = @_; + my ( + $prev, + $s, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{cmd_prompt}; + + ## Parse args. + if (@_ == 2) { + $s->{cmd_prompt} = &_parse_prompt($self, $prompt); + } + + $prev; +} # end sub prompt + + +sub put { + my ($self) = @_; + my ( + $binmode, + $buf, + $errmode, + $is_timeout_arg, + $s, + $telnetmode, + $timeout, + %args, + ); + local $_; + + ## Init. + $s = *$self->{net_telnet}; + $s->{timedout} = ''; + + ## Parse args. + if (@_ == 2) { # one positional arg given + $buf = $_[1]; + } + elsif (@_ > 2) { # named args given + ## Get the named args. + (undef, %args) = @_; + + ## Parse the named args. + foreach (keys %args) { + if (/^-?binmode$/i) { + $binmode = $args{$_}; + unless (defined $binmode) { + $binmode = 0; + } + } + elsif (/^-?errmode$/i) { + $errmode = &_parse_errmode($self, $args{$_}); + } + elsif (/^-?string$/i) { + $buf = $args{$_}; + } + elsif (/^-?telnetmode$/i) { + $telnetmode = $args{$_}; + unless (defined $telnetmode) { + $telnetmode = 0; + } + } + elsif (/^-?timeout$/i) { + $timeout = &_parse_timeout($self, $args{$_}); + $is_timeout_arg = 1; + } + else { + &_croak($self, "bad named parameter \"$_\" given ", + "to " . ref($self) . "::put()"); + } + } + } + + ## If any args given, override corresponding instance data. + local $s->{bin_mode} = $binmode + if defined $binmode; + local $s->{errormode} = $errmode + if defined $errmode; + local $s->{telnet_mode} = $telnetmode + if defined $telnetmode; + local $s->{time_out} = $timeout + if defined $is_timeout_arg; + + ## Check for errors. + return $self->error("write error: filehandle isn't open") + unless $s->{opened}; + + ## Log the output if requested. + if ($s->{outputlog}) { + &_log_print($s->{outputlog}, $buf); + } + + ## Convert native newlines to CR LF. + if (!$s->{bin_mode}) { + $buf =~ s(\n)(\015\012)g; + } + + ## Escape TELNET IAC and also CR not followed by LF. + if ($s->{telnet_mode}) { + $buf =~ s(\377)(\377\377)g; + &_escape_cr(\$buf); + } + + &_put($self, \$buf, "print"); +} # end sub put + + +## Make rs() synonymous input_record_separator(). +*rs = \&input_record_separator; + + +sub suboption_callback { + my ($self, $callback) = @_; + my ( + $prev, + $s, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{subopt_cback}; + + if (@_ >= 2) { + unless (defined $callback and ref($callback) eq "CODE") { + &_carp($self,"ignoring Suboption_callback argument because it's " . + "not a code ref"); + $callback = $prev; + } + + $s->{subopt_cback} = $callback; + } + + $prev; +} # end sub suboption_callback + + +sub telnetmode { + my ($self, $mode) = @_; + my ( + $prev, + $s, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{telnet_mode}; + + if (@_ >= 2) { + unless (defined $mode) { + $mode = 0; + } + + $s->{telnet_mode} = $mode; + } + + $prev; +} # end sub telnetmode + + +sub timed_out { + my ($self, $value) = @_; + my ( + $prev, + $s, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{timedout}; + + if (@_ >= 2) { + unless (defined $value) { + $value = ""; + } + + $s->{timedout} = $value; + } + + $prev; +} # end sub timed_out + + +sub timeout { + my ($self, $timeout) = @_; + my ( + $prev, + $s, + ); + + $s = *$self->{net_telnet}; + $prev = $s->{time_out}; + + if (@_ >= 2) { + $s->{time_out} = &_parse_timeout($self, $timeout); + } + + $prev; +} # end sub timeout + + +sub waitfor { + my ($self, @args) = @_; + my ( + $arg, + $binmode, + $endtime, + $errmode, + $len, + $match, + $match_op, + $pos, + $prematch, + $s, + $search, + $search_cond, + $telnetmode, + $timeout, + @match_cond, + @match_ops, + @search_cond, + @string_cond, + @warns, + ); + local $_; + + ## Init. + $s = *$self->{net_telnet}; + $s->{timedout} = ''; + return if $s->{eofile}; + return unless @args; + $timeout = $s->{time_out}; + + ## Code template used to build string match conditional. + ## Values between array elements must be supplied later. + @string_cond = + ('if (($pos = index $s->{buf}, ', ') > -1) { + $len = ', '; + $prematch = substr $s->{buf}, 0, $pos; + $match = substr $s->{buf}, $pos, $len; + substr($s->{buf}, 0, $pos + $len) = ""; + last; + }'); + + ## Code template used to build pattern match conditional. + ## Values between array elements must be supplied later. + @match_cond = + ('if ($s->{buf} =~ ', ') { + $prematch = $`; + $match = $&; + substr($s->{buf}, 0, length($`) + length($&)) = ""; + last; + }'); + + ## Parse args. + if (@_ == 2) { # one positional arg given + $arg = $_[1]; + + ## Fill in the blanks in the code template. + push @match_ops, $arg; + push @search_cond, join("", $match_cond[0], $arg, $match_cond[1]); + } + elsif (@_ > 2) { # named args given + ## Parse the named args. + while (($_, $arg) = splice @args, 0, 2) { + if (/^-?binmode$/i) { + $binmode = $arg; + unless (defined $binmode) { + $binmode = 0; + } + } + elsif (/^-?errmode$/i) { + $errmode = &_parse_errmode($self, $arg); + } + elsif (/^-?match$/i) { + ## Fill in the blanks in the code template. + push @match_ops, $arg; + push @search_cond, join("", + $match_cond[0], $arg, $match_cond[1]); + } + elsif (/^-?string$/i) { + ## Fill in the blanks in the code template. + $arg =~ s/'/\\'/g; # quote ticks + push @search_cond, join("", + $string_cond[0], "'$arg'", + $string_cond[1], length($arg), + $string_cond[2]); + } + elsif (/^-?telnetmode$/i) { + $telnetmode = $arg; + unless (defined $telnetmode) { + $telnetmode = 0; + } + } + elsif (/^-?timeout$/i) { + $timeout = &_parse_timeout($self, $arg); + } + else { + &_croak($self, "bad named parameter \"$_\" given " . + "to " . ref($self) . "::waitfor()"); + } + } + } + + ## If any args given, override corresponding instance data. + local $s->{errormode} = $errmode + if defined $errmode; + local $s->{bin_mode} = $binmode + if defined $binmode; + local $s->{telnet_mode} = $telnetmode + if defined $telnetmode; + + ## Check for bad match operator argument. + foreach $match_op (@match_ops) { + return $self->error("missing opening delimiter of match operator ", + "in argument \"$match_op\" given to ", + ref($self) . "::waitfor()") + unless $match_op =~ m(^\s*/) or $match_op =~ m(^\s*m\s*\W); + } + + ## Construct conditional to check for requested string and pattern matches. + ## Turn subsequent "if"s into "elsif". + $search_cond = join "\n\tels", @search_cond; + + ## Construct loop to fill buffer until string/pattern, timeout, or eof. + $search = join "", " + while (1) {\n\t", + $search_cond, ' + &_fillbuf($self, $s, $endtime) + or do { + last if $s->{timedout}; + $self->close; + last; + }; + }'; + + ## Set wall time when we timeout. + $endtime = &_endtime($timeout); + + ## Run the loop. + { + local $^W = 1; + local $SIG{"__WARN__"} = sub { push @warns, @_ }; + local $s->{errormode} = "return"; + $s->{errormsg} = ""; + eval $search; + } + + ## Check for failure. + return $self->error("pattern match timed-out") if $s->{timedout}; + return $self->error($s->{errormsg}) if $s->{errormsg} ne ""; + return $self->error("pattern match read eof") if $s->{eofile}; + + ## Check for Perl syntax errors or warnings. + if ($@ or @warns) { + foreach $match_op (@match_ops) { + &_match_check($self, $match_op) + or return; + } + return $self->error($@) if $@; + return $self->error(@warns) if @warns; + } + + wantarray ? ($prematch, $match) : 1; +} # end sub waitfor + + +######################## Private Subroutines ######################### + + +sub _append_lineno { + my ($obj, @msgs) = @_; + my ( + $file, + $line, + $pkg, + ); + + ## Find the caller that's not in object's class or one of its base classes. + ($pkg, $file , $line) = &_user_caller($obj); + join("", @msgs, " at ", $file, " line ", $line, "\n"); +} # end sub _append_lineno + + +sub _carp { + warn &_append_lineno(@_); +} # end sub _carp + + +sub _croak { + die &_append_lineno(@_); +} # end sub _croak + + +sub _endtime { + my ($interval) = @_; + + ## Compute wall time when timeout occurs. + if (defined $interval) { + if ($interval >= $^T) { # it's already an absolute time + return $interval; + } + elsif ($interval > 0) { # it's relative to the current time + return int(time + 1.5 + $interval); + } + else { # it's a one time poll + return 0; + } + } + else { # there's no timeout + return undef; + } +} # end sub _endtime + + +sub _escape_cr { + my ($string) = @_; + my ( + $nextchar, + ); + my $pos = 0; + + ## Convert all CR (not followed by LF) to CR NULL. + while (($pos = index($$string, "\015", $pos)) > -1) { + $nextchar = substr $$string, $pos + 1, 1; + + substr($$string, $pos, 1) = "\015\000" + unless $nextchar eq "\012"; + + $pos++; + } + + 1; +} # end sub _escape_cr + + +sub _fillbuf { + my ($self, $s, $endtime) = @_; + my ( + $msg, + $nfound, + $nread, + $pushback_len, + $read_pos, + $ready, + $timed_out, + $timeout, + $unparsed_pos, + ); + + ## If error from last read not yet reported then do it now. + if ($s->{pending_errormsg}) { + $msg = $s->{pending_errormsg}; + $s->{pending_errormsg} = ""; + return $self->error($msg); + } + + return unless $s->{opened}; + + while (1) { + ## Maximum buffer size exceeded? + return $self->error("maximum input buffer length exceeded: ", + $s->{maxbufsize}, " bytes") + unless length($s->{buf}) <= $s->{maxbufsize}; + + ## Determine how long to wait for input ready. + ($timed_out, $timeout) = &_timeout_interval($endtime); + if ($timed_out) { + $s->{timedout} = 1; + return $self->error("read timed-out"); + } + + ## Wait for input ready. + $nfound = select $ready=$s->{fdmask}, "", "", $timeout; + + ## Handle any errors while waiting. + if (!defined $nfound or $nfound <= 0) { # input not ready + if (defined $nfound and $nfound == 0) { # timed-out + $s->{timedout} = 1; + return $self->error("read timed-out"); + } + else { # error waiting for input ready + next if $! =~ /^interrupted/i; + + $s->{opened} = ''; + return $self->error("read error: $!"); + } + } + + ## Append to buffer any partially processed telnet or CR sequence. + $pushback_len = length $s->{pushback_buf}; + if ($pushback_len) { + $s->{buf} .= $s->{pushback_buf}; + $s->{pushback_buf} = ""; + } + + ## Read the waiting data. + $read_pos = length $s->{buf}; + $unparsed_pos = $read_pos - $pushback_len; + $nread = sysread $self, $s->{buf}, $s->{blksize}, $read_pos; + + ## Handle any read errors. + if (!defined $nread) { # read failed + next if $! =~ /^interrupted/i; # restart interrupted syscall + + $s->{opened} = ''; + return $self->error("read error: $!"); + } + + ## Handle eof. + if ($nread == 0) { # eof read + $s->{opened} = ''; + return; + } + + ## Display network traffic if requested. + if ($s->{dumplog}) { + &_log_dump('<', $s->{dumplog}, \$s->{buf}, $read_pos); + } + + ## Process any telnet commands in the data stream. + if ($s->{telnet_mode} and index($s->{buf},"\377",$unparsed_pos) > -1) { + &_interpret_tcmd($self, $s, $unparsed_pos); + } + + ## Process any carriage-return sequences in the data stream. + &_interpret_cr($s, $unparsed_pos); + + ## Read again if all chars read were consumed as telnet cmds. + next if $unparsed_pos >= length $s->{buf}; + + ## Log the input if requested. + if ($s->{inputlog}) { + &_log_print($s->{inputlog}, substr($s->{buf}, $unparsed_pos)); + } + + ## Save the last line read. + &_save_lastline($s); + + ## We've successfully read some data into the buffer. + last; + } # end while(1) + + 1; +} # end sub _fillbuf + + +sub _flush_opts { + my ($self) = @_; + my ( + $option_chars, + ); + my $s = *$self->{net_telnet}; + + ## Get option and clear the output buf. + $option_chars = $s->{unsent_opts}; + $s->{unsent_opts} = ""; + + ## Try to send options without waiting. + { + local $s->{errormode} = "return"; + local $s->{time_out} = 0; + &_put($self, \$option_chars, "telnet option negotiation") + or do { + ## Save chars not printed for later. + substr($option_chars, 0, $self->print_length) = ""; + $s->{unsent_opts} .= $option_chars; + }; + } + + 1; +} # end sub _flush_opts + + +sub _fname_to_handle { + my ($self, $fh) = @_; + my ( + $filename, + ); + + ## Ensure valid input. + return "" + unless defined $fh and (ref $fh or length $fh); + + ## Open a new filehandle if input is a filename. + no strict "refs"; + if (!ref($fh) and !defined(fileno $fh)) { # fh is a filename + $filename = $fh; + $fh = &_new_handle(); + CORE::open $fh, "> $filename" + or return $self->error("problem creating $filename: $!"); + } + + select((select($fh), $|=1)[$[]); # don't buffer writes + $fh; +} # end sub _fname_to_handle + + +sub _have_alarm { + eval { + local $SIG{"__DIE__"} = "DEFAULT"; + local $SIG{ALRM} = sub { die }; + alarm 0; + }; + + ! $@; +} # end sub _have_alarm + + +sub _interpret_cr { + my ($s, $pos) = @_; + my ( + $nextchar, + ); + + while (($pos = index($s->{buf}, "\015", $pos)) > -1) { + $nextchar = substr($s->{buf}, $pos + 1, 1); + if ($nextchar eq "\0") { + ## Convert CR NULL to CR when in telnet mode. + if ($s->{telnet_mode}) { + substr($s->{buf}, $pos + 1, 1) = ""; + } + } + elsif ($nextchar eq "\012") { + ## Convert CR LF to newline when not in binary mode. + if (!$s->{bin_mode}) { + substr($s->{buf}, $pos, 2) = "\n"; + } + } + elsif (!length($nextchar) and ($s->{telnet_mode} or !$s->{bin_mode})) { + ## Save CR in alt buffer for possible CR LF or CR NULL conversion. + $s->{pushback_buf} .= "\015"; + chop $s->{buf}; + } + + $pos++; + } + + 1; +} # end sub _interpret_cr + + +sub _interpret_tcmd { + my ($self, $s, $offset) = @_; + my ( + $callback, + $endpos, + $nextchar, + $option, + $parameters, + $pos, + $subcmd, + ); + local $_; + + ## Parse telnet commands in the data stream. + $pos = $offset; + while (($pos = index $s->{buf}, "\377", $pos) > -1) { # unprocessed IAC + $nextchar = substr $s->{buf}, $pos + 1, 1; + + ## Save command if it's only partially read. + if (!length $nextchar) { + $s->{pushback_buf} .= "\377"; + chop $s->{buf}; + last; + } + + if ($nextchar eq "\377") { # IAC is escaping "\377" char + ## Remove escape char from data stream. + substr($s->{buf}, $pos, 1) = ""; + $pos++; + } + elsif ($nextchar eq "\375" or $nextchar eq "\373" or + $nextchar eq "\374" or $nextchar eq "\376") { # opt negotiation + $option = substr $s->{buf}, $pos + 2, 1; + + ## Save command if it's only partially read. + if (!length $option) { + $s->{pushback_buf} .= "\377" . $nextchar; + chop $s->{buf}; + chop $s->{buf}; + last; + } + + ## Remove command from data stream. + substr($s->{buf}, $pos, 3) = ""; + + ## Handle option negotiation. + &_negotiate_recv($self, $s, $nextchar, ord($option), $pos); + } + elsif ($nextchar eq "\372") { # start of subnegotiation parameters + ## Save command if it's only partially read. + $endpos = index $s->{buf}, "\360", $pos; + if ($endpos == -1) { + $s->{pushback_buf} .= substr $s->{buf}, $pos; + substr($s->{buf}, $pos) = ""; + last; + } + + ## Remove subnegotiation cmd from buffer. + $subcmd = substr($s->{buf}, $pos, $endpos - $pos + 1); + substr($s->{buf}, $pos, $endpos - $pos + 1) = ""; + + ## Invoke subnegotiation callback. + if ($s->{subopt_cback} and length($subcmd) >= 5) { + $option = unpack "C", substr($subcmd, 2, 1); + if (length($subcmd) >= 6) { + $parameters = substr $subcmd, 3, length($subcmd) - 5; + } + else { + $parameters = ""; + } + + $callback = $s->{subopt_cback}; + &$callback($self, $option, $parameters); + } + } + else { # various two char telnet commands + ## Ignore and remove command from data stream. + substr($s->{buf}, $pos, 2) = ""; + } + } + + ## Try to send any waiting option negotiation. + if (length $s->{unsent_opts}) { + &_flush_opts($self); + } + + 1; +} # end sub _interpret_tcmd + + +sub _io_socket_include { + local $SIG{"__DIE__"} = "DEFAULT"; + eval "require IO::Socket"; +} # end sub io_socket_include + + +sub _log_dump { + my ($direction, $fh, $data, $offset, $len) = @_; + my ( + $addr, + $hexvals, + $line, + ); + + $addr = 0; + $len = length($$data) - $offset + if !defined $len; + return 1 if $len <= 0; + + ## Print data in dump format. + while ($len > 0) { + ## Convert up to the next 16 chars to hex, padding w/ spaces. + if ($len >= 16) { + $line = substr $$data, $offset, 16; + } + else { + $line = substr $$data, $offset, $len; + } + $hexvals = unpack("H*", $line); + $hexvals .= ' ' x (32 - length $hexvals); + + ## Place in 16 columns, each containing two hex digits. + $hexvals = sprintf("%s %s %s %s " x 4, + unpack("a2" x 16, $hexvals)); + + ## For the ASCII column, change unprintable chars to a period. + $line =~ s/[\000-\037,\177-\237]/./g; + + ## Print the line in dump format. + &_log_print($fh, sprintf("%s 0x%5.5lx: %s%s\n", + $direction, $addr, $hexvals, $line)); + + $addr += 16; + $offset += 16; + $len -= 16; + } + + &_log_print($fh, "\n"); + + 1; +} # end sub _log_dump + + +sub _log_option { + my ($fh, $direction, $request, $option) = @_; + my ( + $name, + ); + + if ($option >= 0 and $option <= $#Telopts) { + $name = $Telopts[$option]; + } + else { + $name = $option; + } + + &_log_print($fh, "$direction $request $name\n"); +} # end sub _log_option + + +sub _log_print { + my ($fh, $buf) = @_; + local $\ = ''; + + if (ref($fh) and ref($fh) ne "GLOB") { # fh is blessed ref + $fh->print($buf); + } + else { # fh isn't blessed ref + print $fh $buf; + } +} # end sub _log_print + + +sub _match_check { + my ($self, $code) = @_; + my $error; + my @warns = (); + + ## Use eval to check for syntax errors or warnings. + { + local $SIG{"__DIE__"} = "DEFAULT"; + local $SIG{"__WARN__"} = sub { push @warns, @_ }; + local $^W = 1; + local $_ = ''; + eval "\$_ =~ $code;"; + } + if ($@) { + ## Remove useless lines numbers from message. + ($error = $@) =~ s/ at \(eval \d+\) line \d+.?//; + chomp $error; + return $self->error("bad match operator: $error"); + } + elsif (@warns) { + ## Remove useless lines numbers from message. + ($error = shift @warns) =~ s/ at \(eval \d+\) line \d+.?//; + $error =~ s/ while "strict subs" in use//; + chomp $error; + return $self->error("bad match operator: $error"); + } + + 1; +} # end sub _match_check + + +sub _negotiate_callback { + my ($self, $opt, $is_remote, $is_enabled, $was_enabled, $opt_bufpos) = @_; + my ( + $callback, + $s, + ); + local $_; + + ## Keep track of remote echo. + if ($is_remote and $opt == &TELOPT_ECHO) { # received WILL or WONT ECHO + $s = *$self->{net_telnet}; + + if ($is_enabled and !$was_enabled) { # received WILL ECHO + $s->{remote_echo} = 1; + } + elsif (!$is_enabled and $was_enabled) { # received WONT ECHO + $s->{remote_echo} = ''; + } + } + + ## Invoke callback, if there is one. + $callback = $self->option_callback; + if ($callback) { + &$callback($self, $opt, $is_remote, + $is_enabled, $was_enabled, $opt_bufpos); + } + + 1; +} # end sub _negotiate_callback + + +sub _negotiate_recv { + my ($self, $s, $opt_request, $opt, $opt_bufpos) = @_; + + ## Ensure data structure exists for this option. + unless (defined $s->{opts}{$opt}) { + &_set_default_option($s, $opt); + } + + ## Process the option. + if ($opt_request eq "\376") { # DONT + &_negotiate_recv_disable($self, $s, $opt, "dont", $opt_bufpos, + $s->{opts}{$opt}{local_enable_ok}, + \$s->{opts}{$opt}{local_enabled}, + \$s->{opts}{$opt}{local_state}); + } + elsif ($opt_request eq "\375") { # DO + &_negotiate_recv_enable($self, $s, $opt, "do", $opt_bufpos, + $s->{opts}{$opt}{local_enable_ok}, + \$s->{opts}{$opt}{local_enabled}, + \$s->{opts}{$opt}{local_state}); + } + elsif ($opt_request eq "\374") { # WONT + &_negotiate_recv_disable($self, $s, $opt, "wont", $opt_bufpos, + $s->{opts}{$opt}{remote_enable_ok}, + \$s->{opts}{$opt}{remote_enabled}, + \$s->{opts}{$opt}{remote_state}); + } + elsif ($opt_request eq "\373") { # WILL + &_negotiate_recv_enable($self, $s, $opt, "will", $opt_bufpos, + $s->{opts}{$opt}{remote_enable_ok}, + \$s->{opts}{$opt}{remote_enabled}, + \$s->{opts}{$opt}{remote_state}); + } + else { # internal error + die; + } + + 1; +} # end sub _negotiate_recv + + +sub _negotiate_recv_disable { + my ($self, $s, $opt, $opt_request, + $opt_bufpos, $enable_ok, $is_enabled, $state) = @_; + my ( + $ack, + $disable_cmd, + $enable_cmd, + $is_remote, + $nak, + $was_enabled, + ); + + ## What do we use to request enable/disable or respond with ack/nak. + if ($opt_request eq "wont") { + $enable_cmd = "\377\375" . pack("C", $opt); # do command + $disable_cmd = "\377\376" . pack("C", $opt); # dont command + $is_remote = 1; + $ack = "DO"; + $nak = "DONT"; + + &_log_option($s->{opt_log}, "RCVD", "WONT", $opt) + if $s->{opt_log}; + } + elsif ($opt_request eq "dont") { + $enable_cmd = "\377\373" . pack("C", $opt); # will command + $disable_cmd = "\377\374" . pack("C", $opt); # wont command + $is_remote = ''; + $ack = "WILL"; + $nak = "WONT"; + + &_log_option($s->{opt_log}, "RCVD", "DONT", $opt) + if $s->{opt_log}; + } + else { # internal error + die; + } + + ## Respond to WONT or DONT based on the current negotiation state. + if ($$state eq "no") { # state is already disabled + } + elsif ($$state eq "yes") { # they're initiating disable + $$is_enabled = ''; + $$state = "no"; + + ## Send positive acknowledgment. + $s->{unsent_opts} .= $disable_cmd; + &_log_option($s->{opt_log}, "SENT", $nak, $opt) + if $s->{opt_log}; + + ## Invoke callbacks. + &_negotiate_callback($self, $opt, $is_remote, + $$is_enabled, $was_enabled, $opt_bufpos); + } + elsif ($$state eq "wantno") { # they sent positive ack + $$is_enabled = ''; + $$state = "no"; + + ## Invoke callback. + &_negotiate_callback($self, $opt, $is_remote, + $$is_enabled, $was_enabled, $opt_bufpos); + } + elsif ($$state eq "wantno opposite") { # pos ack but we changed our mind + ## Indicate disabled but now we want to enable. + $$is_enabled = ''; + $$state = "wantyes"; + + ## Send queued request. + $s->{unsent_opts} .= $enable_cmd; + &_log_option($s->{opt_log}, "SENT", $ack, $opt) + if $s->{opt_log}; + + ## Invoke callback. + &_negotiate_callback($self, $opt, $is_remote, + $$is_enabled, $was_enabled, $opt_bufpos); + } + elsif ($$state eq "wantyes") { # they sent negative ack + $$is_enabled = ''; + $$state = "no"; + + ## Invoke callback. + &_negotiate_callback($self, $opt, $is_remote, + $$is_enabled, $was_enabled, $opt_bufpos); + } + elsif ($$state eq "wantyes opposite") { # nak but we changed our mind + $$is_enabled = ''; + $$state = "no"; + + ## Invoke callback. + &_negotiate_callback($self, $opt, $is_remote, + $$is_enabled, $was_enabled, $opt_bufpos); + } +} # end sub _negotiate_recv_disable + + +sub _negotiate_recv_enable { + my ($self, $s, $opt, $opt_request, + $opt_bufpos, $enable_ok, $is_enabled, $state) = @_; + my ( + $ack, + $disable_cmd, + $enable_cmd, + $is_remote, + $nak, + $was_enabled, + ); + + ## What we use to send enable/disable request or send ack/nak response. + if ($opt_request eq "will") { + $enable_cmd = "\377\375" . pack("C", $opt); # do command + $disable_cmd = "\377\376" . pack("C", $opt); # dont command + $is_remote = 1; + $ack = "DO"; + $nak = "DONT"; + + &_log_option($s->{opt_log}, "RCVD", "WILL", $opt) + if $s->{opt_log}; + } + elsif ($opt_request eq "do") { + $enable_cmd = "\377\373" . pack("C", $opt); # will command + $disable_cmd = "\377\374" . pack("C", $opt); # wont command + $is_remote = ''; + $ack = "WILL"; + $nak = "WONT"; + + &_log_option($s->{opt_log}, "RCVD", "DO", $opt) + if $s->{opt_log}; + } + else { # internal error + die; + } + + ## Save current enabled state. + $was_enabled = $$is_enabled; + + ## Respond to WILL or DO based on the current negotiation state. + if ($$state eq "no") { # they're initiating enable + if ($enable_ok) { # we agree they/us should enable + $$is_enabled = 1; + $$state = "yes"; + + ## Send positive acknowledgment. + $s->{unsent_opts} .= $enable_cmd; + &_log_option($s->{opt_log}, "SENT", $ack, $opt) + if $s->{opt_log}; + + ## Invoke callbacks. + &_negotiate_callback($self, $opt, $is_remote, + $$is_enabled, $was_enabled, $opt_bufpos); + } + else { # we disagree they/us should enable + ## Send negative acknowledgment. + $s->{unsent_opts} .= $disable_cmd; + &_log_option($s->{opt_log}, "SENT", $nak, $opt) + if $s->{opt_log}; + } + } + elsif ($$state eq "yes") { # state is already enabled + } + elsif ($$state eq "wantno") { # error: our disable req answered by enable + $$is_enabled = ''; + $$state = "no"; + + ## Invoke callbacks. + &_negotiate_callback($self, $opt, $is_remote, + $$is_enabled, $was_enabled, $opt_bufpos); + } + elsif ($$state eq "wantno opposite") { # err: disable req answerd by enable + $$is_enabled = 1; + $$state = "yes"; + + ## Invoke callbacks. + &_negotiate_callback($self, $opt, $is_remote, + $$is_enabled, $was_enabled, $opt_bufpos); + } + elsif ($$state eq "wantyes") { # they sent pos ack + $$is_enabled = 1; + $$state = "yes"; + + ## Invoke callback. + &_negotiate_callback($self, $opt, $is_remote, + $$is_enabled, $was_enabled, $opt_bufpos); + } + elsif ($$state eq "wantyes opposite") { # pos ack but we changed our mind + ## Indicate enabled but now we want to disable. + $$is_enabled = 1; + $$state = "wantno"; + + ## Inform other side we changed our mind. + $s->{unsent_opts} .= $disable_cmd; + &_log_option($s->{opt_log}, "SENT", $nak, $opt) + if $s->{opt_log}; + + ## Invoke callback. + &_negotiate_callback($self, $opt, $is_remote, + $$is_enabled, $was_enabled, $opt_bufpos); + } + + 1; +} # end sub _negotiate_recv_enable + + +sub _new_handle { + if ($INC{"IO/Handle.pm"}) { + return IO::Handle->new; + } + else { + require FileHandle; + return FileHandle->new; + } +} # end sub _new_handle + + +sub _next_getlines { + my ($self, $s) = @_; + my ( + $len, + $line, + $pos, + @lines, + ); + + ## Fill buffer and get first line. + $line = $self->getline + or return; + push @lines, $line; + + ## Extract subsequent lines from buffer. + while (($pos = index($s->{buf}, $s->{rs})) != -1) { + $len = $pos + length $s->{rs}; + push @lines, substr($s->{buf}, 0, $len); + substr($s->{buf}, 0, $len) = ""; + } + + @lines; +} # end sub _next_getlines + + +sub _opt_accept { + my ($self, @args) = @_; + my ( + $arg, + $option, + $s, + ); + + ## Init. + $s = *$self->{net_telnet}; + + foreach $arg (@args) { + ## Ensure data structure defined for this option. + $option = $arg->{option}; + if (!defined $s->{opts}{$option}) { + &_set_default_option($s, $option); + } + + ## Save whether we'll accept or reject this option. + if ($arg->{is_remote}) { + $s->{opts}{$option}{remote_enable_ok} = $arg->{is_enable}; + } + else { + $s->{opts}{$option}{local_enable_ok} = $arg->{is_enable}; + } + } + + 1; +} # end sub _opt_accept + + +sub _optimal_blksize { + my ($blksize) = @_; + local $^W = ''; # avoid non-numeric warning for ms-windows blksize of "" + + ## Use default when block size is invalid. + return 8192 + unless defined $blksize and $blksize >= 1 and $blksize <= 1_048_576; + + $blksize; +} # end sub _optimal_blksize + + +sub _parse_cmd_remove_mode { + my ($self, $mode) = @_; + + if (!defined $mode) { + $mode = 0; + } + elsif ($mode =~ /^\s*auto\s*$/i) { + $mode = "auto"; + } + elsif ($mode !~ /^\d+$/) { + &_carp($self, "ignoring bad Cmd_remove_mode " . + "argument \"$mode\": it's not \"auto\" or a " . + "non-negative integer"); + $mode = *$self->{net_telnet}{cmd_rm_mode}; + } + + $mode; +} # end sub _parse_cmd_remove_mode + + +sub _parse_errmode { + my ($self, $errmode) = @_; + + ## Set the error mode. + if (!defined $errmode) { + &_carp($self, "ignoring undefined Errmode argument"); + $errmode = *$self->{net_telnet}{errormode}; + } + elsif ($errmode =~ /^\s*return\s*$/i) { + $errmode = "return"; + } + elsif ($errmode =~ /^\s*die\s*$/i) { + $errmode = "die"; + } + elsif (ref($errmode) eq "CODE") { + } + elsif (ref($errmode) eq "ARRAY") { + unless (ref($errmode->[0]) eq "CODE") { + &_carp($self, "ignoring bad Errmode argument: " . + "first list item isn't a code ref"); + $errmode = *$self->{net_telnet}{errormode}; + } + } + else { + &_carp($self, "ignoring bad Errmode argument \"$errmode\""); + $errmode = *$self->{net_telnet}{errormode}; + } + + $errmode; +} # end sub _parse_errmode + + +sub _parse_input_record_separator { + my ($self, $rs) = @_; + + unless (defined $rs and length $rs) { + &_carp($self, "ignoring null Input_record_separator argument"); + $rs = *$self->{net_telnet}{rs}; + } + + $rs; +} # end sub _parse_input_record_separator + + +sub _parse_prompt { + my ($self, $prompt) = @_; + + unless (defined $prompt) { + $prompt = ""; + } + + unless ($prompt =~ m(^\s*/) or $prompt =~ m(^\s*m\s*\W)) { + &_carp($self, "ignoring bad Prompt argument \"$prompt\": " . + "missing opening delimiter of match operator"); + $prompt = *$self->{net_telnet}{cmd_prompt}; + } + + $prompt; +} # end sub _parse_prompt + + +sub _parse_timeout { + my ($self, $timeout) = @_; + + ## Ensure valid timeout. + if (defined $timeout) { + ## Test for non-numeric or negative values. + eval { + local $SIG{"__DIE__"} = "DEFAULT"; + local $SIG{"__WARN__"} = sub { die "non-numeric\n" }; + local $^W = 1; + $timeout *= 1; + }; + if ($@) { # timeout arg is non-numeric + &_carp($self, + "ignoring non-numeric Timeout argument \"$timeout\""); + $timeout = *$self->{net_telnet}{time_out}; + } + elsif ($timeout < 0) { # timeout arg is negative + &_carp($self, "ignoring negative Timeout argument \"$timeout\""); + $timeout = *$self->{net_telnet}{time_out}; + } + } + + $timeout; +} # end sub _parse_timeout + + +sub _put { + my ($self, $buf, $subname) = @_; + my ( + $endtime, + $len, + $nfound, + $nwrote, + $offset, + $ready, + $s, + $timed_out, + $timeout, + $zero_wrote_count, + ); + + ## Init. + $s = *$self->{net_telnet}; + $s->{num_wrote} = 0; + $zero_wrote_count = 0; + $offset = 0; + $len = length $$buf; + $endtime = &_endtime($s->{time_out}); + + return $self->error("write error: filehandle isn't open") + unless $s->{opened}; + + ## Try to send any waiting option negotiation. + if (length $s->{unsent_opts}) { + &_flush_opts($self); + } + + ## Write until all data blocks written. + while ($len) { + ## Determine how long to wait for output ready. + ($timed_out, $timeout) = &_timeout_interval($endtime); + if ($timed_out) { + $s->{timedout} = 1; + return $self->error("$subname timed-out"); + } + + ## Wait for output ready. + $nfound = select "", $ready=$s->{fdmask}, "", $timeout; + + ## Handle any errors while waiting. + if (!defined $nfound or $nfound <= 0) { # output not ready + if (defined $nfound and $nfound == 0) { # timed-out + $s->{timedout} = 1; + return $self->error("$subname timed-out"); + } + else { # error waiting for output ready + next if $! =~ /^interrupted/i; + + $s->{opened} = ''; + return $self->error("write error: $!"); + } + } + + ## Write the data. + $nwrote = syswrite $self, $$buf, $len, $offset; + + ## Handle any write errors. + if (!defined $nwrote) { # write failed + next if $! =~ /^interrupted/i; # restart interrupted syscall + + $s->{opened} = ''; + return $self->error("write error: $!"); + } + elsif ($nwrote == 0) { # zero chars written + ## Try ten more times to write the data. + if ($zero_wrote_count++ <= 10) { + &_sleep(0.01); + next; + } + + $s->{opened} = ''; + return $self->error("write error: zero length write: $!"); + } + + ## Display network traffic if requested. + if ($s->{dumplog}) { + &_log_dump('>', $s->{dumplog}, $buf, $offset, $nwrote); + } + + ## Increment. + $s->{num_wrote} += $nwrote; + $offset += $nwrote; + $len -= $nwrote; + } + + 1; +} # end sub _put + + +sub _qualify_fh { + my ($obj, $name) = @_; + my ( + $user_class, + ); + local $_; + + ## Get user's package name. + ($user_class) = &_user_caller($obj); + + ## Ensure name is qualified with a package name. + $name = qualify($name, $user_class); + + ## If it's not already, make it a typeglob ref. + if (!ref $name) { + no strict; + local $^W = 0; + + $name =~ s/^\*+//; + $name = eval "\\*$name"; + return unless ref $name; + } + + $name; +} # end sub _qualify_fh + + +sub _reset_options { + my ($opts) = @_; + my ( + $opt, + ); + + foreach $opt (keys %$opts) { + $opts->{$opt}{remote_enabled} = ''; + $opts->{$opt}{remote_state} = "no"; + $opts->{$opt}{local_enabled} = ''; + $opts->{$opt}{local_state} = "no"; + } + + 1; +} # end sub _reset_options + + +sub _save_lastline { + my ($s) = @_; + my ( + $firstpos, + $lastpos, + $len_w_sep, + $len_wo_sep, + $offset, + ); + my $rs = "\n"; + + if (($lastpos = rindex $s->{buf}, $rs) > -1) { # eol found + while (1) { + ## Find beginning of line. + $firstpos = rindex $s->{buf}, $rs, $lastpos - 1; + if ($firstpos == -1) { + $offset = 0; + } + else { + $offset = $firstpos + length $rs; + } + + ## Determine length of line with and without separator. + $len_wo_sep = $lastpos - $offset; + $len_w_sep = $len_wo_sep + length $rs; + + ## Save line if it's not blank. + if (substr($s->{buf}, $offset, $len_wo_sep) + !~ /^\s*$/) + { + $s->{last_line} = substr($s->{buf}, + $offset, + $len_w_sep); + last; + } + + last if $firstpos == -1; + + $lastpos = $firstpos; + } + } + + 1; +} # end sub _save_lastline + + +sub _set_default_option { + my ($s, $option) = @_; + + $s->{opts}{$option} = { + remote_enabled => '', + remote_state => "no", + remote_enable_ok => '', + local_enabled => '', + local_state => "no", + local_enable_ok => '', + }; +} # end sub _set_default_option + + +sub _sleep { + my ($secs) = @_; + my $bitmask = ""; + local *SOCK; + + socket SOCK, AF_INET, SOCK_STREAM, 0; + vec($bitmask, fileno(SOCK), 1) = 1; + select $bitmask, "", "", $secs; + CORE::close SOCK; + + 1; +} # end sub _sleep + + +sub _timeout_interval { + my ($endtime) = @_; + my ( + $timeout, + ); + + ## Return timed-out boolean and timeout interval. + if (defined $endtime) { + ## Is it a one-time poll. + return ('', 0) if $endtime == 0; + + ## Calculate the timeout interval. + $timeout = $endtime - time; + + ## Did we already timeout. + return (1, 0) unless $timeout > 0; + + return ('', $timeout); + } + else { # there is no timeout + return ('', undef); + } +} # end sub _timeout_interval + + +sub _user_caller { + my ($obj) = @_; + my ( + $class, + $curr_pkg, + $file, + $i, + $line, + $pkg, + %isa, + @isa, + ); + local $_; + + ## Create a boolean hash to test for isa. Make sure current + ## package and the object's class are members. + $class = ref $obj; + @isa = eval "\@${class}::ISA"; + push @isa, $class; + ($curr_pkg) = caller 1; + push @isa, $curr_pkg; + %isa = map { $_ => 1 } @isa; + + ## Search back in call frames for a package that's not in isa. + $i = 1; + while (($pkg, $file, $line) = caller ++$i) { + next if $isa{$pkg}; + + return ($pkg, $file, $line); + } + + ## If not found, choose outer most call frame. + ($pkg, $file, $line) = caller --$i; + return ($pkg, $file, $line); +} # end sub _user_caller + + +sub _verify_telopt_arg { + my ($self, $option, $argname) = @_; + + ## If provided, use argument name in error message. + if (defined $argname) { + $argname = "for arg $argname"; + } + else { + $argname = ""; + } + + ## Ensure telnet option is a non-negative integer. + eval { + local $SIG{"__DIE__"} = "DEFAULT"; + local $SIG{"__WARN__"} = sub { die "non-numeric\n" }; + local $^W = 1; + $option = abs(int $option); + }; + return $self->error("bad telnet option $argname: non-numeric") + if $@; + + return $self->error("bad telnet option $argname: option > 255") + unless $option <= 255; + + $option; +} # end sub _verify_telopt_arg + + +######################## Exported Constants ########################## + + +sub TELNET_IAC () {255}; # interpret as command: +sub TELNET_DONT () {254}; # you are not to use option +sub TELNET_DO () {253}; # please, you use option +sub TELNET_WONT () {252}; # I won't use option +sub TELNET_WILL () {251}; # I will use option +sub TELNET_SB () {250}; # interpret as subnegotiation +sub TELNET_GA () {249}; # you may reverse the line +sub TELNET_EL () {248}; # erase the current line +sub TELNET_EC () {247}; # erase the current character +sub TELNET_AYT () {246}; # are you there +sub TELNET_AO () {245}; # abort output--but let prog finish +sub TELNET_IP () {244}; # interrupt process--permanently +sub TELNET_BREAK () {243}; # break +sub TELNET_DM () {242}; # data mark--for connect. cleaning +sub TELNET_NOP () {241}; # nop +sub TELNET_SE () {240}; # end sub negotiation +sub TELNET_EOR () {239}; # end of record (transparent mode) +sub TELNET_ABORT () {238}; # Abort process +sub TELNET_SUSP () {237}; # Suspend process +sub TELNET_EOF () {236}; # End of file +sub TELNET_SYNCH () {242}; # for telfunc calls + +sub TELOPT_BINARY () {0}; # Binary Transmission +sub TELOPT_ECHO () {1}; # Echo +sub TELOPT_RCP () {2}; # Reconnection +sub TELOPT_SGA () {3}; # Suppress Go Ahead +sub TELOPT_NAMS () {4}; # Approx Message Size Negotiation +sub TELOPT_STATUS () {5}; # Status +sub TELOPT_TM () {6}; # Timing Mark +sub TELOPT_RCTE () {7}; # Remote Controlled Trans and Echo +sub TELOPT_NAOL () {8}; # Output Line Width +sub TELOPT_NAOP () {9}; # Output Page Size +sub TELOPT_NAOCRD () {10}; # Output Carriage-Return Disposition +sub TELOPT_NAOHTS () {11}; # Output Horizontal Tab Stops +sub TELOPT_NAOHTD () {12}; # Output Horizontal Tab Disposition +sub TELOPT_NAOFFD () {13}; # Output Formfeed Disposition +sub TELOPT_NAOVTS () {14}; # Output Vertical Tabstops +sub TELOPT_NAOVTD () {15}; # Output Vertical Tab Disposition +sub TELOPT_NAOLFD () {16}; # Output Linefeed Disposition +sub TELOPT_XASCII () {17}; # Extended ASCII +sub TELOPT_LOGOUT () {18}; # Logout +sub TELOPT_BM () {19}; # Byte Macro +sub TELOPT_DET () {20}; # Data Entry Terminal +sub TELOPT_SUPDUP () {21}; # SUPDUP +sub TELOPT_SUPDUPOUTPUT () {22}; # SUPDUP Output +sub TELOPT_SNDLOC () {23}; # Send Location +sub TELOPT_TTYPE () {24}; # Terminal Type +sub TELOPT_EOR () {25}; # End of Record +sub TELOPT_TUID () {26}; # TACACS User Identification +sub TELOPT_OUTMRK () {27}; # Output Marking +sub TELOPT_TTYLOC () {28}; # Terminal Location Number +sub TELOPT_3270REGIME () {29}; # Telnet 3270 Regime +sub TELOPT_X3PAD () {30}; # X.3 PAD +sub TELOPT_NAWS () {31}; # Negotiate About Window Size +sub TELOPT_TSPEED () {32}; # Terminal Speed +sub TELOPT_LFLOW () {33}; # Remote Flow Control +sub TELOPT_LINEMODE () {34}; # Linemode +sub TELOPT_XDISPLOC () {35}; # X Display Location +sub TELOPT_OLD_ENVIRON () {36}; # Environment Option +sub TELOPT_AUTHENTICATION () {37}; # Authentication Option +sub TELOPT_ENCRYPT () {38}; # Encryption Option +sub TELOPT_NEW_ENVIRON () {39}; # New Environment Option +sub TELOPT_EXOPL () {255}; # Extended-Options-List + + +1; +__END__; + + +######################## User Documentation ########################## + + +## To format the following documentation into a more readable format, +## use one of these programs: perldoc; pod2man; pod2html; pod2text. +## For example, to nicely format this documentation for printing, you +## may use pod2man and groff to convert to postscript: +## pod2man Net/Telnet.pm | groff -man -Tps > Net::Telnet.ps + +=head1 NAME + +Net::Telnet - interact with TELNET port or other TCP ports + +=head1 SYNOPSIS + +C + +see METHODS section below + +=head1 DESCRIPTION + +Net::Telnet allows you to make client connections to a TCP port and do +network I/O, especially to a port using the TELNET protocol. Simple +I/O methods such as print, get, and getline are provided. More +sophisticated interactive features are provided because connecting to +a TELNET port ultimately means communicating with a program designed +for human interaction. These interactive features include the ability +to specify a time-out and to wait for patterns to appear in the input +stream, such as the prompt from a shell. + +Other reasons to use this module than strictly with a TELNET port are: + +=over 2 + +=item * + +You're not familiar with sockets and you want a simple way to make +client connections to TCP services. + +=item * + +You want to be able to specify your own time-out while connecting, +reading, or writing. + +=item * + +You're communicating with an interactive program at the other end of +some socket or pipe and you want to wait for certain patterns to +appear. + +=back + +Here's an example that prints who's logged-on to the remote host +sparky. In addition to a username and password, you must also know +the user's shell prompt, which for this example is C + + use Net::Telnet (); + $t = new Net::Telnet (Timeout => 10, + Prompt => '/bash\$ $/'); + $t->open("sparky"); + $t->login($username, $passwd); + @lines = $t->cmd("who"); + print @lines; + +More examples are in the B section below. + +Usage questions should be directed to the Usenet newsgroup +comp.lang.perl.modules. + +Contact me, Jay Rogers , if you find any bugs or have +suggestions for improvement. + +=head2 What To Know Before Using + +=over 2 + +=item * + +All output is flushed while all input is buffered. Each object +contains its own input buffer. + +=item * + +The output record separator for C and C is set to +C<"\n"> by default, so that you don't have to append all your commands +with a newline. To avoid printing a trailing C<"\n"> use C or +set the I to C<"">. + +=item * + +The methods C and C use the I setting in the +object to determine when a login or remote command is complete. Those +methods will fail with a time-out if you don't set the prompt +correctly. + +=item * + +Use a combination of C and C as an alternative to +C or C when they don't do what you want. + +=item * + +Errors such as timing-out are handled according to the error mode +action. The default action is to print an error message to standard +error and have the program die. See the C method for more +information. + +=item * + +When constructing the match operator argument for C or +C, always use single quotes instead of double quotes to +avoid unexpected backslash interpretation (e.g. C<'/bash\$ $/'>). If +you're constructing a DOS like file path, you'll need to use four +backslashes to represent one (e.g. C<'/c:\\\\users\\\\billE$/i'>). + +Of course don't forget about regexp metacharacters like C<.>, C<[>, or +C<$>. You'll only need a single backslash to quote them. The anchor +metacharacters C<^> and C<$> refer to positions in the input buffer. +To avoid matching characters read that look like a prompt, it's a good +idea to end your prompt pattern with the C<$> anchor. That way the +prompt will only match if it's the last thing read. + +=item * + +In the input stream, each sequence of I and I (i.e. C<"\015\012"> or CR LF) is converted to C<"\n">. In the +output stream, each occurrence of C<"\n"> is converted to a sequence +of CR LF. See C to change the behavior. TCP protocols +typically use the ASCII sequence, carriage return and line feed to +designate a newline. + +=item * + +Timing-out while making a connection is disabled for machines that +don't support the C function. Most notably these include +MS-Windows machines. + +=item * + +You'll need to be running at least Perl version 5.002 to use this +module. This module does not require any libraries that don't already +come with a standard Perl distribution. + +If you have the IO:: libraries installed (they come standard with +perl5.004 and later) then IO::Socket::INET is used as a base class, +otherwise FileHandle is used. + +=item * + +Contact me, Jay Rogers , if you find any bugs or have +suggestions for improvement. + +=back + +=head2 Debugging + +The typical usage bug causes a time-out error because you've made +incorrect assumptions about what the remote side actually sends. The +easiest way to reconcile what the remote side sends with your +expectations is to use C or C. + +C allows you to see the data being sent from the remote +side before any translation is done, while C shows you +the results after translation. The translation includes converting +end of line characters, removing and responding to TELNET protocol +commands in the data stream. + +=head2 Style of Named Parameters + +Two different styles of named parameters are supported. This document +only shows the IO:: style: + + Net::Telnet->new(Timeout => 20); + +however the dash-option style is also allowed: + + Net::Telnet->new(-timeout => 20); + +=head2 Connecting to a Remote MS-Windows Machine + +By default MS-Windows doesn't come with a TELNET server. However +third party TELNET servers are available. Unfortunately many of these +servers falsely claim to be a TELNET server. This is especially true +of the so-called "Microsoft Telnet Server" that comes installed with +some newer versions MS-Windows. + +When a TELNET server first accepts a connection, it must use the ASCII +control characters carriage-return and line-feed to start a new line +(see RFC854). A server like the "Microsoft Telnet Server" that +doesn't do this, isn't a TELNET server. These servers send ANSI +terminal escape sequences to position to a column on a subsequent line +and to even position while writing characters that are adjacent to +each other. Worse, when sending output these servers resend +previously sent command output in a misguided attempt to display an +entire terminal screen. + +Connecting Net::Telnet to one of these false TELNET servers makes your +job of parsing command output very difficult. It's better to replace +a false TELNET server with a real TELNET server. The better TELNET +servers for MS-Windows allow you to avoid the ANSI escapes by turning +off something some of them call I. + + +=head1 METHODS + +In the calling sequences below, square brackets B<[]> represent +optional parameters. + +=over 4 + +=item B - create a new Net::Telnet object + + $obj = new Net::Telnet ([$host]); + + $obj = new Net::Telnet ([Binmode => $mode,] + [Cmd_remove_mode => $mode,] + [Dump_Log => $filename,] + [Errmode => $errmode,] + [Fhopen => $filehandle,] + [Host => $host,] + [Input_log => $file,] + [Input_record_separator => $chars,] + [Option_log => $file,] + [Ors => $chars,] + [Output_log => $file,] + [Output_record_separator => $chars,] + [Port => $port,] + [Prompt => $matchop,] + [Rs => $chars,] + [Telnetmode => $mode,] + [Timeout => $secs,]); + +This is the constructor for Net::Telnet objects. A new object is +returned on success, the error mode action is performed on failure - +see C. The optional arguments are short-cuts to methods of +the same name. + +If the I<$host> argument is given then the object is opened by +connecting to TCP I<$port> on I<$host>. Also see C. The new +object returned is given the following defaults in the absence of +corresponding named parameters: + +=over 4 + +=item + +The default I is C<"localhost"> + +=item + +The default I is C<23> + +=item + +The default I is C<'/[\$%#E] $/'> + +=item + +The default I is C<10> + +=item + +The default I is C<"die"> + +=item + +The default I is C<"\n">. Note that I +is synonymous with I. + +=item + +The default I is C<"\n">. Note that I is +synonymous with I. + +=item + +The default I is C<0>, which means do newline translation. + +=item + +The default I is C<1>, which means respond to TELNET +commands in the data stream. + +=item + +The default I is C<"auto"> + +=item + +The defaults for I, I, I, and +I are C<"">, which means that logging is turned-off. + +=back + +=back + + +=over 4 + +=item B - toggle newline translation + + $mode = $obj->binmode; + + $prev = $obj->binmode($mode); + +This method controls whether or not sequences of carriage returns and +line feeds (CR LF or more specifically C<"\015\012">) are translated. +By default they are translated (i.e. binmode is C<0>). + +If no argument is given, the current mode is returned. + +If I<$mode> is C<1> then binmode is I and newline translation is +not done. + +If I<$mode> is C<0> then binmode is I and newline translation is +done. In the input stream, each sequence of CR LF is converted to +C<"\n"> and in the output stream, each occurrence of C<"\n"> is +converted to a sequence of CR LF. + +Note that input is always buffered. Changing binmode doesn't effect +what's already been read into the buffer. Output is not buffered and +changing binmode will have an immediate effect. + +=back + + +=over 4 + +=item B - send TELNET break character + + $ok = $obj->break; + +This method sends the TELNET break character. This character is +provided because it's a signal outside the ASCII character set which +is currently given local meaning within many systems. It's intended +to indicate that the Break Key or the Attention Key was hit. + +This method returns C<1> on success, or performs the error mode action +on failure. + +=back + + +=over 4 + +=item B - scalar reference to object's input buffer + + $ref = $obj->buffer; + +This method returns a scalar reference to the input buffer for +I<$obj>. Data in the input buffer is data that has been read from the +remote side but has yet to be read by the user. Modifications to the +input buffer are returned by a subsequent read. + +=back + + +=over 4 + +=item B - discard all data in object's input buffer + + $obj->buffer_empty; + +This method removes all data in the input buffer for I<$obj>. + +=back + + +=over 4 + +=item B - close object + + $ok = $obj->close; + +This method closes the socket, file, or pipe associated with the +object. It always returns a value of C<1>. + +=back + + +=over 4 + +=item B - issue command and retrieve output + + $ok = $obj->cmd($string); + $ok = $obj->cmd(String => $string, + [Output => $ref,] + [Cmd_remove_mode => $mode,] + [Errmode => $mode,] + [Input_record_separator => $chars,] + [Ors => $chars,] + [Output_record_separator => $chars,] + [Prompt => $match,] + [Rs => $chars,] + [Timeout => $secs,]); + + @output = $obj->cmd($string); + @output = $obj->cmd(String => $string, + [Output => $ref,] + [Cmd_remove_mode => $mode,] + [Errmode => $mode,] + [Input_record_separator => $chars,] + [Ors => $chars,] + [Output_record_separator => $chars,] + [Prompt => $match,] + [Rs => $chars,] + [Timeout => $secs,]); + +This method sends the command I<$string>, and reads the characters +sent back by the command up until and including the matching prompt. +It's assumed that the program to which you're sending is some kind of +command prompting interpreter such as a shell. + +The command I<$string> is automatically appended with the +output_record_separator, By default that's C<"\n">. This is similar +to someone typing a command and hitting the return key. Set the +output_record_separator to change this behavior. + +In a scalar context, the characters read from the remote side are +discarded and C<1> is returned on success. On time-out, eof, or other +failures, the error mode action is performed. See C. + +In a list context, just the output generated by the command is +returned, one line per element. In other words, all the characters in +between the echoed back command string and the prompt are returned. +If the command happens to return no output, a list containing one +element, the empty string is returned. This is so the list will +indicate true in a boolean context. On time-out, eof, or other +failures, the error mode action is performed. See C. + +The characters that matched the prompt may be retrieved using +C. + +Many command interpreters echo back the command sent. In most +situations, this method removes the first line returned from the +remote side (i.e. the echoed back command). See C +for more control over this feature. + +Use C to debug when this method keeps timing-out and you +don't think it should. + +Consider using a combination of C and C as an +alternative to this method when it doesn't do what you want, e.g. the +command you send prompts for input. + +The I named parameter provides an alternative method of +receiving command output. If you pass a scalar reference, all the +output (even if it contains multiple lines) is returned in the +referenced scalar. If you pass an array or hash reference, the lines +of output are returned in the referenced array or hash. You can use +C to change the notion of what separates a +line. + +Optional named parameters are provided to override the current +settings of cmd_remove_mode, errmode, input_record_separator, ors, +output_record_separator, prompt, rs, and timeout. Rs is synonymous +with input_record_separator and ors is synonymous with +output_record_separator. + +=back + + +=over 4 + +=item B - toggle removal of echoed commands + + $mode = $obj->cmd_remove_mode; + + $prev = $obj->cmd_remove_mode($mode); + +This method controls how to deal with echoed back commands in the +output returned by cmd(). Typically, when you send a command to the +remote side, the first line of output returned is the command echoed +back. Use this mode to remove the first line of output normally +returned by cmd(). + +If no argument is given, the current mode is returned. + +If I<$mode> is C<0> then the command output returned from cmd() has no +lines removed. If I<$mode> is a positive integer, then the first +I<$mode> lines of command output are stripped. + +By default, I<$mode> is set to C<"auto">. Auto means that whether or +not the first line of command output is stripped, depends on whether +or not the remote side offered to echo. By default, Net::Telnet +always accepts an offer to echo by the remote side. You can change +the default to reject such an offer using C. + +A warning is printed to STDERR when attempting to set this attribute +to something that's not C<"auto"> or a non-negative integer. + +=back + + +=over 4 + +=item B - log all I/O in dump format + + $fh = $obj->dump_log; + + $fh = $obj->dump_log($fh); + + $fh = $obj->dump_log($filename); + +This method starts or stops dump format logging of all the object's +input and output. The dump format shows the blocks read and written +in a hexadecimal and printable character format. This method is +useful when debugging, however you might want to first try +C as it's more readable. + +If no argument is given, the current log filehandle is returned. An +empty string indicates logging is off. + +To stop logging, use an empty string as an argument. + +If an open filehandle is given, it is used for logging and returned. +Otherwise, the argument is assumed to be the name of a file, the file +is opened and a filehandle to it is returned. If the file can't be +opened for writing, the error mode action is performed. + +=back + + +=over 4 + +=item B - end of file indicator + + $eof = $obj->eof; + +This method returns C<1> if end of file has been read, otherwise it +returns an empty string. Because the input is buffered this isn't the +same thing as I<$obj> has closed. In other words I<$obj> can be +closed but there still can be stuff in the buffer to be read. Under +this condition you can still read but you won't be able to write. + +=back + + +=over 4 + +=item B - define action to be performed on error + + $mode = $obj->errmode; + + $prev = $obj->errmode($mode); + +This method gets or sets the action used when errors are encountered +using the object. The first calling sequence returns the current +error mode. The second calling sequence sets it to I<$mode> and +returns the previous mode. Valid values for I<$mode> are C<"die"> +(the default), C<"return">, a I, or an I. + +When mode is C<"die"> and an error is encountered using the object, +then an error message is printed to standard error and the program +dies. + +When mode is C<"return"> then the method generating the error places +an error message in the object and returns an undefined value in a +scalar context and an empty list in list context. The error message +may be obtained using C. + +When mode is a I, then when an error is encountered +I is called with the error message as its first argument. +Using this mode you may have your own subroutine handle errors. If +I itself returns then the method generating the error returns +undefined or an empty list depending on context. + +When mode is an I, the first element of the array must be a +I. Any elements that follow are the arguments to I. +When an error is encountered, the I is called with its +arguments. Using this mode you may have your own subroutine handle +errors. If the I itself returns then the method generating +the error returns undefined or an empty list depending on context. + +A warning is printed to STDERR when attempting to set this attribute +to something that's not C<"die">, C<"return">, a I, or an +I whose first element isn't a I. + +=back + + +=over 4 + +=item B - most recent error message + + $msg = $obj->errmsg; + + $prev = $obj->errmsg(@msgs); + +The first calling sequence returns the error message associated with +the object. The empty string is returned if no error has been +encountered yet. The second calling sequence sets the error message +for the object to the concatenation of I<@msgs> and returns the +previous error message. Normally, error messages are set internally +by a method when an error is encountered. + +=back + + +=over 4 + +=item B - perform the error mode action + + $obj->error(@msgs); + +This method concatenates I<@msgs> into a string and places it in the +object as the error message. Also see C. It then performs +the error mode action. Also see C. + +If the error mode doesn't cause the program to die, then an undefined +value or an empty list is returned depending on the context. + +This method is primarily used by this class or a sub-class to perform +the user requested action when an error is encountered. + +=back + + +=over 4 + +=item B - use already open filehandle for I/O + + $ok = $obj->fhopen($fh); + +This method associates the open filehandle I<$fh> with I<$obj> for +further I/O. Filehandle I<$fh> must already be opened. + +Suppose you want to use the features of this module to do I/O to +something other than a TCP port, for example STDIN or a filehandle +opened to read from a process. Instead of opening the object for I/O +to a TCP port by using C or C, call this method +instead. + +The value C<1> is returned success, the error mode action is performed +on failure. + +=back + + +=over 4 + +=item B - read block of data + + $data = $obj->get([Binmode => $mode,] + [Errmode => $errmode,] + [Telnetmode => $mode,] + [Timeout => $secs,]); + +This method reads a block of data from the object and returns it along +with any buffered data. If no buffered data is available to return, +it will wait for data to read using the timeout specified in the +object. You can override that timeout using I<$secs>. Also see +C. If buffered data is available to return, it also checks +for a block of data that can be immediately read. + +On eof an undefined value is returned. On time-out or other failures, +the error mode action is performed. To distinguish between eof or an +error occurring when the error mode is not set to C<"die">, use +C. + +Optional named parameters are provided to override the current +settings of binmode, errmode, telnetmode, and timeout. + +=back + + +=over 4 + +=item B - read next line + + $line = $obj->getline([Binmode => $mode,] + [Errmode => $errmode,] + [Input_record_separator => $chars,] + [Rs => $chars,] + [Telnetmode => $mode,] + [Timeout => $secs,]); + +This method reads and returns the next line of data from the object. +You can use C to change the notion of what +separates a line. The default is C<"\n">. If a line isn't +immediately available, this method blocks waiting for a line or a +time-out. + +On eof an undefined value is returned. On time-out or other failures, +the error mode action is performed. To distinguish between eof or an +error occurring when the error mode is not set to C<"die">, use +C. + +Optional named parameters are provided to override the current +settings of binmode, errmode, input_record_separator, rs, telnetmode, +and timeout. Rs is synonymous with input_record_separator. + +=back + + +=over 4 + +=item B - read next lines + + @lines = $obj->getlines([Binmode => $mode,] + [Errmode => $errmode,] + [Input_record_separator => $chars,] + [Rs => $chars,] + [Telnetmode => $mode,] + [Timeout => $secs,] + [All => $boolean,]); + +This method reads and returns all the lines of data from the object +until end of file is read. You can use C to +change the notion of what separates a line. The default is C<"\n">. +A time-out error occurs if all the lines can't be read within the +time-out interval. See C. + +The behavior of this method was changed in version 3.03. Prior to +version 3.03 this method returned just the lines available from the +next read. To get that old behavior, use the optional named parameter +I and set I<$boolean> to C<""> or C<0>. + +If only eof is read then an empty list is returned. On time-out or +other failures, the error mode action is performed. Use C to +distinguish between reading only eof or an error occurring when the +error mode is not set to C<"die">. + +Optional named parameters are provided to override the current +settings of binmode, errmode, input_record_separator, rs, telnetmode, +and timeout. Rs is synonymous with input_record_separator. + +=back + + +=over 4 + +=item B - name of remote host + + $host = $obj->host; + + $prev = $obj->host($host); + +This method designates the remote host for C. With no +argument it returns the current host name set in the object. With an +argument it sets the current host name to I<$host> and returns the +previous host name. You may indicate the remote host using either a +hostname or an IP address. + +The default value is C<"localhost">. It may also be set by C +or C. + +=back + + +=over 4 + +=item B - log all input + + $fh = $obj->input_log; + + $fh = $obj->input_log($fh); + + $fh = $obj->input_log($filename); + +This method starts or stops logging of input. This is useful when +debugging. Also see C. Because most command interpreters +echo back commands received, it's likely all your output will also be +in this log. Note that input logging occurs after newline +translation. See C for details on newline translation. + +If no argument is given, the log filehandle is returned. An empty +string indicates logging is off. + +To stop logging, use an empty string as an argument. + +If an open filehandle is given, it is used for logging and returned. +Otherwise, the argument is assumed to be the name of a file, the file +is opened for logging and a filehandle to it is returned. If the file +can't be opened for writing, the error mode action is performed. + +=back + + +=over 4 + +=item B - input line delimiter + + $chars = $obj->input_record_separator; + + $prev = $obj->input_record_separator($chars); + +This method designates the line delimiter for input. It's used with +C, C, and C to determine lines in the +input. + +With no argument this method returns the current input record +separator set in the object. With an argument it sets the input +record separator to I<$chars> and returns the previous value. Note +that I<$chars> must have length. + +A warning is printed to STDERR when attempting to set this attribute +to a string with no length. + +=back + + +=over 4 + +=item B - last prompt read + + $string = $obj->last_prompt; + + $prev = $obj->last_prompt($string); + +With no argument this method returns the last prompt read by cmd() or +login(). See C. With an argument it sets the last prompt +read to I<$string> and returns the previous value. Normally, only +internal methods set the last prompt. + +=back + + +=over 4 + +=item B - last line read + + $line = $obj->lastline; + + $prev = $obj->lastline($line); + +This method retrieves the last line read from the object. This may be +a useful error message when the remote side abnormally closes the +connection. Typically the remote side will print an error message +before closing. + +With no argument this method returns the last line read from the +object. With an argument it sets the last line read to I<$line> and +returns the previous value. Normally, only internal methods set the +last line. + +=back + + +=over 4 + +=item B - perform standard login + + $ok = $obj->login($username, $password); + + $ok = $obj->login(Name => $username, + Password => $password, + [Errmode => $mode,] + [Prompt => $match,] + [Timeout => $secs,]); + +This method performs a standard login by waiting for a login prompt +and responding with I<$username>, then waiting for the password prompt +and responding with I<$password>, and then waiting for the command +interpreter prompt. If any of those prompts sent by the remote side +don't match what's expected, this method will time-out, unless timeout +is turned off. + +Login prompt must match either of these case insensitive patterns: + + /login[: ]*$/i + /username[: ]*$/i + +Password prompt must match this case insensitive pattern: + + /password[: ]*$/i + +The command interpreter prompt must match the current setting of +prompt. See C. + +Use C to debug when this method keeps timing-out and you +don't think it should. + +Consider using a combination of C and C as an +alternative to this method when it doesn't do what you want, e.g. the +remote host doesn't prompt for a username. + +On success, C<1> is returned. On time out, eof, or other failures, +the error mode action is performed. See C. + +Optional named parameters are provided to override the current +settings of errmode, prompt, and timeout. + +=back + + +=over 4 + +=item B - maximum size of input buffer + + $len = $obj->max_buffer_length; + + $prev = $obj->max_buffer_length($len); + +This method designates the maximum size of the input buffer. An error +is generated when a read causes the buffer to exceed this limit. The +default value is 1,048,576 bytes (1MB). The input buffer can grow +much larger than the block size when you continuously read using +C or C and the data stream contains no newlines +or matching waitfor patterns. + +With no argument, this method returns the current maximum buffer +length set in the object. With an argument it sets the maximum buffer +length to I<$len> and returns the previous value. Values of I<$len> +smaller than 512 will be adjusted to 512. + +A warning is printed to STDERR when attempting to set this attribute +to something that isn't a positive integer. + +=back + + +=over 4 + +=item B - field separator for print + + $chars = $obj->ofs + + $prev = $obj->ofs($chars); + +This method is synonymous with C. + +=back + + +=over 4 + +=item B - connect to port on remote host + + $ok = $obj->open($host); + + $ok = $obj->open([Host => $host,] + [Port => $port,] + [Errmode => $mode,] + [Timeout => $secs,]); + +This method opens a TCP connection to I<$port> on I<$host>. If either +argument is missing then the current value of C or C +is used. Optional named parameters are provided to override the +current setting of errmode and timeout. + +On success C<1> is returned. On time-out or other connection +failures, the error mode action is performed. See C. + +Time-outs don't work for this method on machines that don't implement +SIGALRM - most notably MS-Windows machines. For those machines, an +error is returned when the system reaches its own time-out while +trying to connect. + +A side effect of this method is to reset the alarm interval associated +with SIGALRM. + +=back + + +=over 4 + +=item B - indicate willingness to accept a TELNET option + + $fh = $obj->option_accept([Do => $telopt,] + [Dont => $telopt,] + [Will => $telopt,] + [Wont => $telopt,]); + +This method is used to indicate whether to accept or reject an offer +to enable a TELNET option made by the remote side. If you're using +I or I to indicate a willingness to enable, then a +notification callback must have already been defined by a prior call +to C. See C for details on +receiving enable/disable notification of a TELNET option. + +You can give multiple I, I, I, or I arguments +for different TELNET options in the same call to this method. + +The following example describes the meaning of the named parameters. +A TELNET option, such as C used below, is an integer +constant that you can import from Net::Telnet. See the source in file +Telnet.pm for the complete list. + +=over 4 + +=item + +I => C + +=over 4 + +=item + +we'll accept an offer to enable the echo option on the local side + +=back + +=item + +I => C + +=over 4 + +=item + +we'll reject an offer to enable the echo option on the local side + +=back + +=item + +I => C + +=over 4 + +=item + +we'll accept an offer to enable the echo option on the remote side + +=back + +=item + +I => C + +=over 4 + +=item + +we'll reject an offer to enable the echo option on the remote side + +=back + +=back + +=item + +Use C to send a request to the remote side to enable or +disable a particular TELNET option. + +=back + + +=over 4 + +=item B - define the option negotiation callback + + $coderef = $obj->option_callback; + + $prev = $obj->option_callback($coderef); + +This method defines the callback subroutine that's called when a +TELNET option is enabled or disabled. Once defined, the +I may not be undefined. However, calling this method +with a different I<$coderef> changes it. + +A warning is printed to STDERR when attempting to set this attribute +to something that isn't a coderef. + +Here are the circumstances that invoke I<$coderef>: + +=over 4 + +=item + +An option becomes enabled because the remote side requested an enable +and C had been used to arrange that it be accepted. + +=item + +The remote side arbitrarily decides to disable an option that is +currently enabled. Note that Net::Telnet always accepts a request to +disable from the remote side. + +=item + +C was used to send a request to enable or disable an +option and the response from the remote side has just been received. +Note, that if a request to enable is rejected then I<$coderef> is +still invoked even though the option didn't change. + +=back + +=item + +Here are the arguments passed to I<&$coderef>: + + &$coderef($obj, $option, $is_remote, + $is_enabled, $was_enabled, $buf_position); + +=over 4 + +=item + +1. I<$obj> is the Net::Telnet object + +=item + +2. I<$option> is the TELNET option. Net::Telnet exports constants +for the various TELNET options which just equate to an integer. + +=item + +3. I<$is_remote> is a boolean indicating for which side the option +applies. + +=item + +4. I<$is_enabled> is a boolean indicating the option is enabled or +disabled + +=item + +5. I<$was_enabled> is a boolean indicating the option was previously +enabled or disabled + +=item + +6. I<$buf_position> is an integer indicating the position in the +object's input buffer where the option takes effect. See C +to access the object's input buffer. + +=back + +=back + + +=over 4 + +=item B - log all TELNET options sent or received + + $fh = $obj->option_log; + + $fh = $obj->option_log($fh); + + $fh = $obj->option_log($filename); + +This method starts or stops logging of all TELNET options being sent +or received. This is useful for debugging when you send options via +C or you arrange to accept option requests from the +remote side via C. Also see C. + +If no argument is given, the log filehandle is returned. An empty +string indicates logging is off. + +To stop logging, use an empty string as an argument. + +If an open filehandle is given, it is used for logging and returned. +Otherwise, the argument is assumed to be the name of a file, the file +is opened for logging and a filehandle to it is returned. If the file +can't be opened for writing, the error mode action is performed. + +=back + + +=over 4 + +=item B - send TELNET option negotiation request + + $ok = $obj->option_send([Do => $telopt,] + [Dont => $telopt,] + [Will => $telopt,] + [Wont => $telopt,] + [Async => $boolean,]); + +This method is not yet implemented. Look for it in a future version. + +=back + + +=over 4 + +=item B - get current state of a TELNET option + + $hashref = $obj->option_state($telopt); + +This method returns a hashref containing a copy of the current state +of TELNET option I<$telopt>. + +Here are the values returned in the hash: + +=over 4 + +=item + +I<$hashref>->{remote_enabled} + +=over 4 + +=item + +boolean that indicates if the option is enabled on the remote side. + +=back + +=item + +I<$hashref>->{remote_enable_ok} + +=over 4 + +=item + +boolean that indicates if it's ok to accept an offer to enable this +option on the remote side. + +=back + +=item + +I<$hashref>->{remote_state} + +=over 4 + +=item + +string used to hold the internal state of option negotiation for this +option on the remote side. + +=back + +=item + +I<$hashref>->{local_enabled} + +=over 4 + +=item + +boolean that indicates if the option is enabled on the local side. + +=back + +=item + +I<$hashref>->{local_enable_ok} + +=over 4 + +=item + +boolean that indicates if it's ok to accept an offer to enable this +option on the local side. + +=back + +=item + +I<$hashref>->{local_state} + +=over 4 + +=item + +string used to hold the internal state of option negotiation for this +option on the local side. + +=back + +=back + +=back + + +=over 4 + +=item B - output line delimiter + + $chars = $obj->ors; + + $prev = $obj->ors($chars); + +This method is synonymous with C. + +=back + + +=over 4 + +=item B - field separator for print + + $chars = $obj->output_field_separator; + + $prev = $obj->output_field_separator($chars); + +This method designates the output field separator for C. +Ordinarily the print method simply prints out the comma separated +fields you specify. Set this to specify what's printed between +fields. + +With no argument this method returns the current output field +separator set in the object. With an argument it sets the output +field separator to I<$chars> and returns the previous value. + +By default it's set to an empty string. + +=back + + +=over 4 + +=item B - log all output + + $fh = $obj->output_log; + + $fh = $obj->output_log($fh); + + $fh = $obj->output_log($filename); + +This method starts or stops logging of output. This is useful when +debugging. Also see C. Because most command interpreters +echo back commands received, it's likely all your output would also be +in an input log. See C. Note that output logging occurs +before newline translation. See C for details on newline +translation. + +If no argument is given, the log filehandle is returned. An empty +string indicates logging is off. + +To stop logging, use an empty string as an argument. + +If an open filehandle is given, it is used for logging and returned. +Otherwise, the argument is assumed to be the name of a file, the file +is opened for logging and a filehandle to it is returned. If the file +can't be opened for writing, the error mode action is performed. + +=back + + +=over 4 + +=item B - output line delimiter + + $chars = $obj->output_record_separator; + + $prev = $obj->output_record_separator($chars); + +This method designates the output line delimiter for C and +C. Set this to specify what's printed at the end of C +and C. + +The output record separator is set to C<"\n"> by default, so there's +no need to append all your commands with a newline. To avoid printing +the output_record_separator use C or set the +output_record_separator to an empty string. + +With no argument this method returns the current output record +separator set in the object. With an argument it sets the output +record separator to I<$chars> and returns the previous value. + +=back + + +=over 4 + +=item B - remote port + + $port = $obj->port; + + $prev = $obj->port($port); + +This method designates the remote TCP port. With no argument this +method returns the current port number. With an argument it sets the +current port number to I<$port> and returns the previous port. If +I<$port> is a TCP service name, then it's first converted to a port +number using the perl function C. + +The default value is C<23>. It may also be set by C or +C. + +A warning is printed to STDERR when attempting to set this attribute +to something that's not a positive integer or a valid TCP service +name. + +=back + + +=over 4 + +=item B - write to object + + $ok = $obj->print(@list); + +This method writes I<@list> followed by the I +to the open object and returns C<1> if all data was successfully +written. On time-out or other failures, the error mode action is +performed. See C. + +By default, the C is set to C<"\n"> so all +your commands automatically end with a newline. In most cases your +output is being read by a command interpreter which won't accept a +command until newline is read. This is similar to someone typing a +command and hitting the return key. To avoid printing a trailing +C<"\n"> use C instead or set the output_record_separator to an +empty string. + +On failure, it's possible that some data was written. If you choose +to try and recover from a print timing-out, use C to +determine how much was written before the error occurred. + +You may also use the output field separator to print a string between +the list elements. See C. + +=back + + +=over 4 + +=item B - number of bytes written by print + + $num = $obj->print_length; + +This returns the number of bytes successfully written by the most +recent C or C. + +=back + + +=over 4 + +=item B - pattern to match a prompt + + $matchop = $obj->prompt; + + $prev = $obj->prompt($matchop); + +This method sets the pattern used to find a prompt in the input +stream. It must be a string representing a valid perl pattern match +operator. The methods C and C try to read until +matching the prompt. They will fail with a time-out error if the +pattern you've chosen doesn't match what the remote side sends. + +With no argument this method returns the prompt set in the object. +With an argument it sets the prompt to I<$matchop> and returns the +previous value. + +The default prompt is C<'/[\$%#E] $/'> + +Always use single quotes, instead of double quotes, to construct +I<$matchop> (e.g. C<'/bash\$ $/'>). If you're constructing a DOS like +file path, you'll need to use four backslashes to represent one +(e.g. C<'/c:\\\\users\\\\billE$/i'>). + +Of course don't forget about regexp metacharacters like C<.>, C<[>, or +C<$>. You'll only need a single backslash to quote them. The anchor +metacharacters C<^> and C<$> refer to positions in the input buffer. + +A warning is printed to STDERR when attempting to set this attribute +with a match operator missing its opening delimiter. + +=back + + +=over 4 + +=item B - write to object + + $ok = $obj->put($string); + + $ok = $obj->put(String => $string, + [Binmode => $mode,] + [Errmode => $errmode,] + [Telnetmode => $mode,] + [Timeout => $secs,]); + +This method writes I<$string> to the opened object and returns C<1> if +all data was successfully written. This method is like C +except that it doesn't write the trailing output_record_separator +("\n" by default). On time-out or other failures, the error mode +action is performed. See C. + +On failure, it's possible that some data was written. If you choose +to try and recover from a put timing-out, use C to +determine how much was written before the error occurred. + +Optional named parameters are provided to override the current +settings of binmode, errmode, telnetmode, and timeout. + +=back + + +=over 4 + +=item B - input line delimiter + + $chars = $obj->rs; + + $prev = $obj->rs($chars); + +This method is synonymous with C. + +=back + + +=over 4 + +=item B - turn off/on telnet command interpretation + + $mode = $obj->telnetmode; + + $prev = $obj->telnetmode($mode); + +This method controls whether or not TELNET commands in the data stream +are recognized and handled. The TELNET protocol uses certain +character sequences sent in the data stream to control the session. +If the port you're connecting to isn't using the TELNET protocol, then +you should turn this mode off. The default is I. + +If no argument is given, the current mode is returned. + +If I<$mode> is C<0> then telnet mode is off. If I<$mode> is C<1> then +telnet mode is on. + +=back + + +=over 4 + +=item B - time-out indicator + + $boolean = $obj->timed_out; + + $prev = $obj->timed_out($boolean); + +This method indicates if a previous read, write, or open method +timed-out. Remember that timing-out is itself an error. To be able +to invoke C after a time-out error, you'd have to change +the default error mode to something other than C<"die">. See +C. + +With no argument this method returns C<1> if the previous method +timed-out. With an argument it sets the indicator. Normally, only +internal methods set this indicator. + +=back + + +=over 4 + +=item B - I/O time-out interval + + $secs = $obj->timeout; + + $prev = $obj->timeout($secs); + +This method sets the timeout interval that's used when performing I/O +or connecting to a port. When a method doesn't complete within the +timeout interval then it's an error and the error mode action is +performed. + +A timeout may be expressed as a relative or absolute value. If +I<$secs> is greater than or equal to the time the program started, as +determined by $^T, then it's an absolute time value for when time-out +occurs. The perl function C may be used to obtain an absolute +time value. For a relative time-out value less than $^T, time-out +happens I<$secs> from when the method begins. + +If I<$secs> is C<0> then time-out occurs if the data cannot be +immediately read or written. Use the undefined value to turn off +timing-out completely. + +With no argument this method returns the timeout set in the object. +With an argument it sets the timeout to I<$secs> and returns the +previous value. The default timeout value is C<10> seconds. + +A warning is printed to STDERR when attempting to set this attribute +to something that's not an C or a non-negative integer. + +=back + + +=over 4 + +=item B - wait for pattern in the input + + $ok = $obj->waitfor($matchop); + $ok = $obj->waitfor([Match => $matchop,] + [String => $string,] + [Binmode => $mode,] + [Errmode => $errmode,] + [Telnetmode => $mode,] + [Timeout => $secs,]); + + ($prematch, $match) = $obj->waitfor($matchop); + ($prematch, $match) = $obj->waitfor([Match => $matchop,] + [String => $string,] + [Binmode => $mode,] + [Errmode => $errmode,] + [Telnetmode => $mode,] + [Timeout => $secs,]); + +This method reads until a pattern match or string is found in the +input stream. All the characters before and including the match are +removed from the input stream. + +In a list context the characters before the match and the matched +characters are returned in I<$prematch> and I<$match>. In a scalar +context, the matched characters and all characters before it are +discarded and C<1> is returned on success. On time-out, eof, or other +failures, for both list and scalar context, the error mode action is +performed. See C. + +You can specify more than one pattern or string by simply providing +multiple I and/or I named parameters. A I<$matchop> +must be a string representing a valid Perl pattern match operator. +The I<$string> is just a substring to find in the input stream. + +Use C to debug when this method keeps timing-out and you +don't think it should. + +An optional named parameter is provided to override the current +setting of timeout. + +To avoid unexpected backslash interpretation, always use single quotes +instead of double quotes to construct a match operator argument for +C and C (e.g. C<'/bash\$ $/'>). If you're +constructing a DOS like file path, you'll need to use four backslashes +to represent one (e.g. C<'/c:\\\\users\\\\billE$/i'>). + +Of course don't forget about regexp metacharacters like C<.>, C<[>, or +C<$>. You'll only need a single backslash to quote them. The anchor +metacharacters C<^> and C<$> refer to positions in the input buffer. + +Optional named parameters are provided to override the current +settings of binmode, errmode, telnetmode, and timeout. + +=back + + +=head1 SEE ALSO + +=over 2 + +=item RFC 854 + +S + +S + +=item RFC 1143 + +S + +S + +=item TELNET Option Assignments + +S + +=back + + +=head1 EXAMPLES + +This example gets the current weather forecast for Brainerd, Minnesota. + + my ($forecast, $t); + + use Net::Telnet (); + $t = new Net::Telnet; + $t->open("rainmaker.wunderground.com"); + + ## Wait for first prompt and "hit return". + $t->waitfor('/continue:.*$/'); + $t->print(""); + + ## Wait for second prompt and respond with city code. + $t->waitfor('/city code.*$/'); + $t->print("BRD"); + + ## Read and print the first page of forecast. + ($forecast) = $t->waitfor('/[ \t]+press return to continue/i'); + print $forecast; + + exit; + + +This example checks a POP server to see if you have mail. + + my ($hostname, $line, $passwd, $pop, $username); + + $hostname = "your_destination_host_here"; + $username = "your_username_here"; + $passwd = "your_password_here"; + + use Net::Telnet (); + $pop = new Net::Telnet (Telnetmode => 0); + $pop->open(Host => $hostname, + Port => 110); + + + ## Read connection message. + $line = $pop->getline; + die $line unless $line =~ /^\+OK/; + + ## Send user name. + $pop->print("user $username"); + $line = $pop->getline; + die $line unless $line =~ /^\+OK/; + + ## Send password. + $pop->print("pass $passwd"); + $line = $pop->getline; + die $line unless $line =~ /^\+OK/; + + ## Request status of messages. + $pop->print("list"); + $line = $pop->getline; + print $line; + + exit; + + +Here's an example that uses the ssh program to connect to a remote +host. Because the ssh program reads and writes to its controlling +terminal, the IO::Pty module is used to create a new pseudo terminal +for use by ssh. A new Net::Telnet object is then created to read and +write to that pseudo terminal. To use the code below, substitute +"changeme" with the actual host, user, password, and command prompt. + + ## Main program. + { + my ($pty, $ssh, @lines); + my $host = "changeme"; + my $user = "changeme"; + my $password = "changeme"; + my $prompt = '/changeme:~> $/'; + + ## Start ssh program. + $pty = &spawn("ssh", "-l", $user, $host); # spawn() defined below + + ## Create a Net::Telnet object to perform I/O on ssh's tty. + use Net::Telnet; + $ssh = new Net::Telnet (-fhopen => $pty, + -prompt => $prompt, + -telnetmode => 0, + -cmd_remove_mode => 1, + -output_record_separator => "\r"); + + ## Login to remote host. + $ssh->waitfor(-match => '/password: ?$/i', + -errmode => "return") + or die "problem connecting to host: ", $ssh->lastline; + $ssh->print($password); + $ssh->waitfor(-match => $ssh->prompt, + -errmode => "return") + or die "login failed: ", $ssh->lastline; + + ## Send command, get and print its output. + @lines = $ssh->cmd("who"); + print @lines; + + exit; + } # end main program + + sub spawn { + my(@cmd) = @_; + my($pid, $pty, $tty, $tty_fd); + + ## Create a new pseudo terminal. + use IO::Pty (); + $pty = new IO::Pty + or die $!; + + ## Execute the program in another process. + unless ($pid = fork) { # child process + die "problem spawning program: $!\n" unless defined $pid; + + ## Disassociate process from existing controlling terminal. + use POSIX (); + POSIX::setsid + or die "setsid failed: $!"; + + ## Associate process with a new controlling terminal. + $tty = $pty->slave; + $tty_fd = $tty->fileno; + close $pty; + + ## Make stdio use the new controlling terminal. + open STDIN, "<&$tty_fd" or die $!; + open STDOUT, ">&$tty_fd" or die $!; + open STDERR, ">&STDOUT" or die $!; + close $tty; + + ## Execute requested program. + exec @cmd + or die "problem executing $cmd[0]\n"; + } # end child process + + $pty; + } # end sub spawn + + +Here's an example that changes a user's login password. Because the +passwd program always prompts for passwords on its controlling +terminal, the IO::Pty module is used to create a new pseudo terminal +for use by passwd. A new Net::Telnet object is then created to read +and write to that pseudo terminal. To use the code below, substitute +"changeme" with the actual old and new passwords. + + my ($pty, $passwd); + my $oldpw = "changeme"; + my $newpw = "changeme"; + + ## Start passwd program. + $pty = &spawn("passwd"); # spawn() defined above + + ## Create a Net::Telnet object to perform I/O on passwd's tty. + use Net::Telnet; + $passwd = new Net::Telnet (-fhopen => $pty, + -timeout => 2, + -output_record_separator => "\r", + -telnetmode => 0, + -cmd_remove_mode => 1); + $passwd->errmode("return"); + + ## Send existing password. + $passwd->waitfor('/password: ?$/i') + or die "no old password prompt: ", $passwd->lastline; + $passwd->print($oldpw); + + ## Send new password. + $passwd->waitfor('/new password: ?$/i') + or die "bad old password: ", $passwd->lastline; + $passwd->print($newpw); + + ## Send new password verification. + $passwd->waitfor('/new password: ?$/i') + or die "bad new password: ", $passwd->lastline; + $passwd->print($newpw); + + ## Display success or failure. + $passwd->waitfor('/changed/') + or die "bad new password: ", $passwd->lastline; + print $passwd->lastline; + + $passwd->close; + exit; + + +Here's an example you can use to down load a file of any type. The +file is read from the remote host's standard output using cat. To +prevent any output processing, the remote host's standard output is +put in raw mode using the Bourne shell. The Bourne shell is used +because some shells, notably tcsh, prevent changing tty modes. Upon +completion, FTP style statistics are printed to stderr. + + my ($block, $filename, $host, $hostname, $k_per_sec, $line, + $num_read, $passwd, $prevblock, $prompt, $size, $size_bsd, + $size_sysv, $start_time, $total_time, $username); + + $hostname = "your_destination_host_here"; + $username = "your_username_here"; + $passwd = "your_password_here"; + $filename = "your_download_file_here"; + + ## Connect and login. + use Net::Telnet (); + $host = new Net::Telnet (Timeout => 30, + Prompt => '/[%#>] $/'); + $host->open($hostname); + $host->login($username, $passwd); + + ## Make sure prompt won't match anything in send data. + $prompt = "_funkyPrompt_"; + $host->prompt("/$prompt\$/"); + $host->cmd("set prompt = '$prompt'"); + + ## Get size of file. + ($line) = $host->cmd("/bin/ls -l $filename"); + ($size_bsd, $size_sysv) = (split ' ', $line)[3,4]; + if ($size_sysv =~ /^\d+$/) { + $size = $size_sysv; + } + elsif ($size_bsd =~ /^\d+$/) { + $size = $size_bsd; + } + else { + die "$filename: no such file on $hostname"; + } + + ## Start sending the file. + binmode STDOUT; + $host->binmode(1); + $host->print("/bin/sh -c 'stty raw; cat $filename'"); + $host->getline; # discard echoed back line + + ## Read file a block at a time. + $num_read = 0; + $prevblock = ""; + $start_time = time; + while (($block = $host->get) and ($block !~ /$prompt$/o)) { + if (length $block >= length $prompt) { + print $prevblock; + $num_read += length $prevblock; + $prevblock = $block; + } + else { + $prevblock .= $block; + } + + } + $host->close; + + ## Print last block without trailing prompt. + $prevblock .= $block; + $prevblock =~ s/$prompt$//; + print $prevblock; + $num_read += length $prevblock; + die "error: expected size $size, received size $num_read\n" + unless $num_read == $size; + + ## Print totals. + $total_time = (time - $start_time) || 1; + $k_per_sec = ($size / 1024) / $total_time; + $k_per_sec = sprintf "%3.1f", $k_per_sec; + warn("$num_read bytes received in $total_time seconds ", + "($k_per_sec Kbytes/s)\n"); + + exit; + + +=head1 AUTHOR + +Jay Rogers + + +=head1 COPYRIGHT + +Copyright 1997, 2000, 2002 by Jay Rogers. All rights reserved. +This program is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. diff --git a/agc_2-X/branches/agc_2.0.4/extras/Time/HiRes.1.55.pm b/agc_2-X/branches/agc_2.0.4/extras/Time/HiRes.1.55.pm new file mode 100644 index 00000000..f0bd2008 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/extras/Time/HiRes.1.55.pm @@ -0,0 +1,351 @@ +package Time::HiRes; + +use strict; +use vars qw($VERSION $XS_VERSION @ISA @EXPORT @EXPORT_OK $AUTOLOAD); + +require Exporter; +require DynaLoader; + +@ISA = qw(Exporter DynaLoader); + +@EXPORT = qw( ); +@EXPORT_OK = qw (usleep sleep ualarm alarm gettimeofday time tv_interval + getitimer setitimer + ITIMER_REAL ITIMER_VIRTUAL ITIMER_PROF ITIMER_REALPROF + d_usleep d_ualarm d_gettimeofday d_getitimer d_setitimer + d_nanosleep); + +$VERSION = '1.55'; +$XS_VERSION = $VERSION; +$VERSION = eval $VERSION; + +sub AUTOLOAD { + my $constname; + ($constname = $AUTOLOAD) =~ s/.*:://; + die "&Time::HiRes::constant not defined" if $constname eq 'constant'; + my ($error, $val) = constant($constname); + if ($error) { die $error; } + { + no strict 'refs'; + *$AUTOLOAD = sub { $val }; + } + goto &$AUTOLOAD; +} + +bootstrap Time::HiRes; + +# Preloaded methods go here. + +sub tv_interval { + # probably could have been done in C + my ($a, $b) = @_; + $b = [gettimeofday()] unless defined($b); + (${$b}[0] - ${$a}[0]) + ((${$b}[1] - ${$a}[1]) / 1_000_000); +} + +# Autoload methods go after =cut, and are processed by the autosplit program. + +1; +__END__ + +=head1 NAME + +Time::HiRes - High resolution alarm, sleep, gettimeofday, interval timers + +=head1 SYNOPSIS + + use Time::HiRes qw( usleep ualarm gettimeofday tv_interval ); + + usleep ($microseconds); + + ualarm ($microseconds); + ualarm ($microseconds, $interval_microseconds); + + $t0 = [gettimeofday]; + ($seconds, $microseconds) = gettimeofday; + + $elapsed = tv_interval ( $t0, [$seconds, $microseconds]); + $elapsed = tv_interval ( $t0, [gettimeofday]); + $elapsed = tv_interval ( $t0 ); + + use Time::HiRes qw ( time alarm sleep ); + + $now_fractions = time; + sleep ($floating_seconds); + alarm ($floating_seconds); + alarm ($floating_seconds, $floating_interval); + + use Time::HiRes qw( setitimer getitimer + ITIMER_REAL ITIMER_VIRTUAL ITIMER_PROF ITIMER_REALPROF ); + + setitimer ($which, $floating_seconds, $floating_interval ); + getitimer ($which); + +=head1 DESCRIPTION + +The C module implements a Perl interface to the C, +C, C, and C/C system calls, in other +words, high resolution time and timers. See the L section below +and the test scripts for usage; see your system documentation for the +description of the underlying C or C, C, +C, and C/C calls. + +If your system lacks C or an emulation of it you don't +get C or the one-argument form of C. If your system lacks all of +C, C, and C, you don't get +C or C. If your system lacks both +C and C you don't get +C or C. + +If you try to import an unimplemented function in the C statement +it will fail at compile time. + +If your subsecond sleeping is implemented with C instead of +C, you can mix subsecond sleeping with signals since +C does not use signals. This, however is unportable, and you +should first check for the truth value of C<&Time::HiRes::d_nanosleep> to +see whether you have nanosleep, and then carefully read your +C C API documentation for any peculiarities. (There is no +separate interface to call C; just use C +or C with small enough values.) + +Unless using C for mixing sleeping with signals, give +some thought to whether Perl is the tool you should be using for work +requiring nanosecond accuracies. + +The following functions can be imported from this module. +No functions are exported by default. + +=over 4 + +=item gettimeofday () + +In array context returns a two-element array with the seconds and +microseconds since the epoch. In scalar context returns floating +seconds like C (see below). + +=item usleep ( $useconds ) + +Sleeps for the number of microseconds specified. Returns the number +of microseconds actually slept. Can sleep for more than one second, +unlike the C system call. See also C below. + +=item ualarm ( $useconds [, $interval_useconds ] ) + +Issues a C call; the C<$interval_useconds> is optional and +will be zero if unspecified, resulting in C-like behaviour. + +=item tv_interval + +tv_interval ( $ref_to_gettimeofday [, $ref_to_later_gettimeofday] ) + +Returns the floating seconds between the two times, which should have +been returned by C. If the second argument is omitted, +then the current time is used. + +=item time () + +Returns a floating seconds since the epoch. This function can be +imported, resulting in a nice drop-in replacement for the C below. + +B: This higher resolution timer can return values either less +or more than the core C, depending on whether your platform +rounds the higher resolution timer values up, down, or to the nearest second +to get the core C, but naturally the difference should be never +more than half a second. + +B: Since Sunday, September 9th, 2001 at 01:46:40 AM GMT, when +the C seconds since epoch rolled over to 1_000_000_000, the +default floating point format of Perl and the seconds since epoch have +conspired to produce an apparent bug: if you print the value of +C you seem to be getting only five decimals, not six +as promised (microseconds). Not to worry, the microseconds are there +(assuming your platform supports such granularity in first place). +What is going on is that the default floating point format of Perl +only outputs 15 digits. In this case that means ten digits before the +decimal separator and five after. To see the microseconds you can use +either C/C with C<"%.6f">, or the C function in +list context, which will give you the seconds and microseconds as two +separate values. + +=item sleep ( $floating_seconds ) + +Sleeps for the specified amount of seconds. Returns the number of +seconds actually slept (a floating point value). This function can be +imported, resulting in a nice drop-in replacement for the C +provided with perl, see the L below. + +=item alarm ( $floating_seconds [, $interval_floating_seconds ] ) + +The C signal is sent after the specified number of seconds. +Implemented using C. The C<$interval_floating_seconds> argument +is optional and will be zero if unspecified, resulting in C-like +behaviour. This function can be imported, resulting in a nice drop-in +replacement for the C provided with perl, see the L below. + +B: With some operating system and Perl release combinations +C restarts C, instead of interuping it. +This means that an C followed by a C +may together take the sum of the times specified for the the +C and the C, not just the time of the C. + +=item setitimer ( $which, $floating_seconds [, $interval_floating_seconds ] ) + +Start up an interval timer: after a certain time, a signal arrives, +and more signals may keep arriving at certain intervals. To disable a +timer, use C<$floating_seconds> of zero. If the C<$interval_floating_seconds> +is set to zero (or unspecified), the timer is disabled B the +next delivered signal. + +Use of interval timers may interfere with C, C, +and C. In standard-speak the "interaction is unspecified", +which means that I may happen: it may work, it may not. + +In scalar context, the remaining time in the timer is returned. + +In list context, both the remaining time and the interval are returned. + +There are usually three or four interval timers available: the C<$which> +can be C, C, C, or C. +Note that which ones are available depends: true UNIX platforms usually +have the first three, but (for example) Win32 and Cygwin have only +C, and only Solaris seems to have C (which is +used to profile multithreaded programs). + +C results in C-like behavior. Time is counted in +I; that is, wallclock time. C is delivered when +the timer expires. + +C counts time in (process) I; that is, only +when the process is running. In multiprocessor/user/CPU systems this +may be more or less than real or wallclock time. (This time is also +known as the I.) C is delivered when the timer expires. + +C counts time when either the process virtual time or when +the operating system is running on behalf of the process (such as I/O). +(This time is also known as the I.) (The sum of user +time and system time is known as the I.) C is +delivered when the timer expires. C can interrupt system calls. + +The semantics of interval timers for multithreaded programs are +system-specific, and some systems may support additional interval +timers. See your C documentation. + +=item getitimer ( $which ) + +Return the remaining time in the interval timer specified by C<$which>. + +In scalar context, the remaining time is returned. + +In list context, both the remaining time and the interval are returned. +The interval is always what you put in using C. + +=back + +=head1 EXAMPLES + + use Time::HiRes qw(usleep ualarm gettimeofday tv_interval); + + $microseconds = 750_000; + usleep $microseconds; + + # signal alarm in 2.5s & every .1s thereafter + ualarm 2_500_000, 100_000; + + # get seconds and microseconds since the epoch + ($s, $usec) = gettimeofday; + + # measure elapsed time + # (could also do by subtracting 2 gettimeofday return values) + $t0 = [gettimeofday]; + # do bunch of stuff here + $t1 = [gettimeofday]; + # do more stuff here + $t0_t1 = tv_interval $t0, $t1; + + $elapsed = tv_interval ($t0, [gettimeofday]); + $elapsed = tv_interval ($t0); # equivalent code + + # + # replacements for time, alarm and sleep that know about + # floating seconds + # + use Time::HiRes; + $now_fractions = Time::HiRes::time; + Time::HiRes::sleep (2.5); + Time::HiRes::alarm (10.6666666); + + use Time::HiRes qw ( time alarm sleep ); + $now_fractions = time; + sleep (2.5); + alarm (10.6666666); + + # Arm an interval timer to go off first at 10 seconds and + # after that every 2.5 seconds, in process virtual time + + use Time::HiRes qw ( setitimer ITIMER_VIRTUAL time ); + + $SIG{VTALRM} = sub { print time, "\n" }; + setitimer(ITIMER_VIRTUAL, 10, 2.5); + +=head1 C API + +In addition to the perl API described above, a C API is available for +extension writers. The following C functions are available in the +modglobal hash: + + name C prototype + --------------- ---------------------- + Time::NVtime double (*)() + Time::U2time void (*)(UV ret[2]) + +Both functions return equivalent information (like C) +but with different representations. The names C and C +were selected mainly because they are operating system independent. +(C is Unix-centric, though some platforms like VMS have +emulations for it.) + +Here is an example of using C from C: + + double (*myNVtime)(); + SV **svp = hv_fetch(PL_modglobal, "Time::NVtime", 12, 0); + if (!svp) croak("Time::HiRes is required"); + if (!SvIOK(*svp)) croak("Time::NVtime isn't a function pointer"); + myNVtime = INT2PTR(double(*)(), SvIV(*svp)); + printf("The current time is: %f\n", (*myNVtime)()); + +=head1 DIAGNOSTICS + +=head2 negative time not invented yet + +You tried to use a negative time argument. + +=head2 internal error: useconds < 0 (unsigned ... signed ...) + +Something went horribly wrong-- the number of microseconds that cannot +become negative just became negative. Maybe your compiler is broken? + +=head1 CAVEATS + +Notice that the core C maybe rounding rather than truncating. +What this means is that the core C may be reporting the time as one second +later than C and C. + +=head1 AUTHORS + +D. Wegscheid +R. Schertler +J. Hietaniemi +G. Aas + +=head1 COPYRIGHT AND LICENSE + +Copyright (c) 1996-2002 Douglas E. Wegscheid. All rights reserved. + +Copyright (c) 2002,2003,2004 Jarkko Hietaniemi. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut diff --git a/agc_2-X/branches/agc_2.0.4/extras/Time/HiRes.1.59.pm b/agc_2-X/branches/agc_2.0.4/extras/Time/HiRes.1.59.pm new file mode 100644 index 00000000..98d31429 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/extras/Time/HiRes.1.59.pm @@ -0,0 +1,359 @@ +package Time::HiRes; + +use strict; +use vars qw($VERSION $XS_VERSION @ISA @EXPORT @EXPORT_OK $AUTOLOAD); + +require Exporter; +require DynaLoader; + +@ISA = qw(Exporter DynaLoader); + +@EXPORT = qw( ); +@EXPORT_OK = qw (usleep sleep ualarm alarm gettimeofday time tv_interval + getitimer setitimer + ITIMER_REAL ITIMER_VIRTUAL ITIMER_PROF ITIMER_REALPROF + d_usleep d_ualarm d_gettimeofday d_getitimer d_setitimer + d_nanosleep); + +$VERSION = '1.59'; +$XS_VERSION = $VERSION; +$VERSION = eval $VERSION; + +sub AUTOLOAD { + my $constname; + ($constname = $AUTOLOAD) =~ s/.*:://; + die "&Time::HiRes::constant not defined" if $constname eq 'constant'; + my ($error, $val) = constant($constname); + if ($error) { die $error; } + { + no strict 'refs'; + *$AUTOLOAD = sub { $val }; + } + goto &$AUTOLOAD; +} + +bootstrap Time::HiRes; + +# Preloaded methods go here. + +sub tv_interval { + # probably could have been done in C + my ($a, $b) = @_; + $b = [gettimeofday()] unless defined($b); + (${$b}[0] - ${$a}[0]) + ((${$b}[1] - ${$a}[1]) / 1_000_000); +} + +# Autoload methods go after =cut, and are processed by the autosplit program. + +1; +__END__ + +=head1 NAME + +Time::HiRes - High resolution alarm, sleep, gettimeofday, interval timers + +=head1 SYNOPSIS + + use Time::HiRes qw( usleep ualarm gettimeofday tv_interval ); + + usleep ($microseconds); + + ualarm ($microseconds); + ualarm ($microseconds, $interval_microseconds); + + $t0 = [gettimeofday]; + ($seconds, $microseconds) = gettimeofday; + + $elapsed = tv_interval ( $t0, [$seconds, $microseconds]); + $elapsed = tv_interval ( $t0, [gettimeofday]); + $elapsed = tv_interval ( $t0 ); + + use Time::HiRes qw ( time alarm sleep ); + + $now_fractions = time; + sleep ($floating_seconds); + alarm ($floating_seconds); + alarm ($floating_seconds, $floating_interval); + + use Time::HiRes qw( setitimer getitimer + ITIMER_REAL ITIMER_VIRTUAL ITIMER_PROF ITIMER_REALPROF ); + + setitimer ($which, $floating_seconds, $floating_interval ); + getitimer ($which); + +=head1 DESCRIPTION + +The C module implements a Perl interface to the C, +C, C, and C/C system calls, in other +words, high resolution time and timers. See the L section below +and the test scripts for usage; see your system documentation for the +description of the underlying C or C, C, +C, and C/C calls. + +If your system lacks C or an emulation of it you don't +get C or the one-argument form of C. If your system lacks all of +C, C, and C, you don't get +C or C. If your system lacks both +C and C you don't get +C or C. + +If you try to import an unimplemented function in the C statement +it will fail at compile time. + +If your subsecond sleeping is implemented with C instead of +C, you can mix subsecond sleeping with signals since +C does not use signals. This, however is unportable, and you +should first check for the truth value of C<&Time::HiRes::d_nanosleep> to +see whether you have nanosleep, and then carefully read your +C C API documentation for any peculiarities. (There is no +separate interface to call C; just use C +or C with small enough values.) + +Unless using C for mixing sleeping with signals, give +some thought to whether Perl is the tool you should be using for work +requiring nanosecond accuracies. + +The following functions can be imported from this module. +No functions are exported by default. + +=over 4 + +=item gettimeofday () + +In array context returns a two-element array with the seconds and +microseconds since the epoch. In scalar context returns floating +seconds like C (see below). + +=item usleep ( $useconds ) + +Sleeps for the number of microseconds specified. Returns the number +of microseconds actually slept. Can sleep for more than one second, +unlike the C system call. See also C below. + +=item ualarm ( $useconds [, $interval_useconds ] ) + +Issues a C call; the C<$interval_useconds> is optional and +will be zero if unspecified, resulting in C-like behaviour. + +=item tv_interval + +tv_interval ( $ref_to_gettimeofday [, $ref_to_later_gettimeofday] ) + +Returns the floating seconds between the two times, which should have +been returned by C. If the second argument is omitted, +then the current time is used. + +=item time () + +Returns a floating seconds since the epoch. This function can be +imported, resulting in a nice drop-in replacement for the C
\n"; + echo ""; + + $stmt="SELECT * from servers order by server_id"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
LISTADOS DEL SERVIDOR:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0]$row[1] $row[2] $row[4] $row[3]  MODIFICAR
\n"; +} + +###################### +# ADD=1000000000000 display all conferences +###################### +if ($ADD==1000000000000) +{ +echo "\r\n"; + print " \r\n"; + } + $rec_count++; + } +$sthA->finish(); + +exit; diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/listloader_super.pl b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/listloader_super.pl new file mode 100644 index 00000000..167fff5e --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/listloader_super.pl @@ -0,0 +1,1086 @@ +#!/usr/bin/perl + +### listloader_super.pl version 0.4 *DBI-version* +### +### Copyright (C) 2007 Matt Florell,Joe Johnson LICENSE: GPLv2 +### +# +# +# CHANGES +# 60616-1548 - Added listID override feature to force all leads into same list +# - Added gmt_offset_now lookup for each lead +# 60811-1232 - Changed to DBI +# 60811-1329 - changed to use /etc/astguiclient.conf for configs +# 60906-1056 - added filter of non-digits in alt_phone field +# 61110-1229 - added new USA-Canada DST scheme and Brazil DST scheme +# 61128-1207 - added postal code GMT lookup and duplicate check options +# 70205-1703 - Defaulted phone_code to 1 if not populated +# 70417-1059 - Fixed default phone_code bug +# 70510-1518 - Added campaign and system duplicate check and phonecode override +# + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help|-h/i) + { + print "allowed run time options:\n [-forcelistid=1234] = overrides the listID given in the file with the 1234\n [-h] = this help screen\n\n"; + + exit; + } + else + { + if ($args =~ /-duplicate-check/i) + {$dupcheck=1;} + if ($args =~ /-duplicate-campaign-check/i) + {$dupcheckcamp=1;} + if ($args =~ /-duplicate-system-check/i) + {$dupchecksys=1;} + if ($args =~ /-postal-code-gmt/i) + {$postalgmt=1;} + if ($args =~ /--forcelistid=/i) + { + @data_in = split(/--forcelistid=/,$args); + $forcelistid = $data_in[1]; + $forcelistid =~ s/ .*//gi; + print "\n----- FORCE LISTID OVERRIDE: $forcelistid -----\n\n"; + } + else + {$forcelistid = '';} + + if ($args =~ /--forcephonecode=/i) + { + @data_in = split(/--forcephonecode=/,$args); + $forcephonecode = $data_in[1]; + $forcephonecode =~ s/ .*//gi; + print "\n----- FORCE PHONECODE OVERRIDE: $forcephonecode -----\n\n"; + } + else + {$forcephonecode = '';} + + if ($args =~ /--lead-file=/i) + { + @data_in = split(/--lead-file=/,$args); + $lead_file = $data_in[1]; + $lead_file =~ s/ .*//gi; + # print "\n----- LEAD FILE: $lead_file -----\n\n"; + } + else + {$lead_file = './vicidial_temp_file.xls';} + } +} +### end parsing run-time options ### + +use Spreadsheet::ParseExcel; +use Time::Local; +use DBI; + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + +$vars=$ARGV[0]; +@xls_fields=split(/\,/, $vars); + +$|=0; +$secX = time(); + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($hour < 10) {$hour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +$pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; +$pulldate="$year-$mon-$mday $hour:$min:$sec"; +$inSD = $pulldate0; +$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + + ### Grab Server values from the database + $stmtA = "SELECT local_gmt FROM servers where server_ip = '$server_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBSERVER_GMT = "$aryA[0]"; + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + $rec_count++; + } + $sthA->finish(); + + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + +if ($isdst) {$LOCAL_GMT_OFF++;} +if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";} + + + +$total=0; $good=0; $bad=0; +open(STMT_FILE, "> $PATHlogs/listloader_stmts.txt"); + +$oBook = Spreadsheet::ParseExcel::Workbook->Parse("$lead_file"); +my($iR, $iC, $oWkS, $oWkC); + +foreach $oWkS (@{$oBook->{Worksheet}}) { + for($iR = 0 ; defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow} ; $iR++) { + + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user = ""; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[0]]; + if ($oWkC) {$vendor_lead_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[1]]; + if ($oWkC) {$source_code=$oWkC->Value; } + $source_id=$source_code; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[2]]; + if ($oWkC) {$list_id=$oWkC->Value; } + $gmt_offset = '0'; + $called_since_last_reset='N'; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[3]]; + if ($oWkC) {$phone_code=$oWkC->Value; } + $phone_code=~s/[^0-9]//g; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[4]]; + if ($oWkC) {$phone_number=$oWkC->Value; } + $phone_number=~s/[^0-9]//g; + $USarea = substr($phone_number, 0, 3); + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[5]]; + if ($oWkC) {$title=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[6]]; + if ($oWkC) {$first_name=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[7]]; + if ($oWkC) {$middle_initial=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[8]]; + if ($oWkC) {$last_name=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[9]]; + if ($oWkC) {$address1=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[10]]; + if ($oWkC) {$address2=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[11]]; + if ($oWkC) {$address3=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[12]]; + if ($oWkC) {$city=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[13]]; + if ($oWkC) {$state=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[14]]; + if ($oWkC) {$province=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[15]]; + if ($oWkC) {$postal_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[16]]; + if ($oWkC) {$country_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[17]]; + if ($oWkC) {$gender=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[18]]; + if ($oWkC) {$date_of_birth=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[19]]; + if ($oWkC) {$alt_phone=$oWkC->Value; } + $alt_phone=~s/[^0-9]//g; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[20]]; + if ($oWkC) {$email=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[21]]; + if ($oWkC) {$security_phrase=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[22]]; + if ($oWkC) {$comments=$oWkC->Value; } + $comments=~s/^\s*(.*?)\s*$/$1/; + + + + if (length($forcelistid) > 0) + { + $list_id = $forcelistid; # set list_id to override value + } + if (length($forcephonecode) > 0) + { + $phone_code = $forcephonecode; # set phone_code to override value + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if ($dupchecksys > 0) + { + $dup_lead=0; + $stmtA = "select count(*) from vicidial_list where phone_number='$phone_number';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $dup_lead = $aryA[0]; + $dup_lead_list=$list_id; + } + $sthA->finish(); + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if ($dupcheck > 0) + { + $dup_lead=0; + $stmtA = "select list_id from vicidial_list where phone_number='$phone_number' and list_id='$list_id' limit 1;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $dup_lead_list = $aryA[0]; + $dup_lead++; + } + $sthA->finish(); + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if ($dupcheckcamp > 0) + { + $dup_lead=0; + $dup_lists=''; + + $stmtA = "select count(*) from vicidial_lists where list_id='$list_id';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + @aryA = $sthA->fetchrow_array; + $ci_recs = $aryA[0]; + $sthA->finish(); + if ($ci_recs > 0) + { + $stmtA = "select campaign_id from vicidial_lists where list_id='$list_id';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + @aryA = $sthA->fetchrow_array; + $dup_camp = $aryA[0]; + $sthA->finish(); + + $stmtA = "select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $dup_lists .= "'$aryA[0]',"; + $rec_count++; + } + $sthA->finish(); + + chop($dup_lists); + $stmtA = "select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $dup_lead_list = "'$aryA[0]',"; + $rec_count++; + $dup_lead=1; + } + $sthA->finish(); + } + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + + if ( (length($phone_number)>6) && ($dup_lead < 1) ) + { + $phone_list .= "$phone_number$US$list_id|"; + $postalgmt_found=0; + if (length($phone_code)<1) {$phone_code = '1';} + + if ( ($postalgmt > 0) && (length($postal_code)>4) ) + { + if ($phone_code =~ /^1$/) + { + $stmtA = "select * from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[2]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[3]; + $dst_range = $aryA[4]; + $PC_processed++; + $rec_count++; + $postalgmt_found++; + if ($DBX) {print " Postal GMT record found for $postal_code: |$gmt_offset|$dst|$dst_range|\n";} + } + $sthA->finish(); + } + } + if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =~ /^1$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### MEXICO ### + if ($phone_code =~ /^52$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### AUSTRALIA ### + if ($phone_code =~ /^61$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + } + + ### Find out if DST to raise the gmt offset ### + $AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); + $AC_localtime = ($secX + (3600 * $AC_GMT_diff)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($AC_localtime); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + + if ( (!$AC_processed) && ($dst_range =~ /SSM-FSN/) ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + &USACAN_dstcalc; + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSA-LSO/) ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + &NA_dstcalc; + if ($DBX) {print " DST: $NA_DST\n";} + if ($NA_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /LSM-LSO/) ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + &GBR_dstcalc; + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /LSO-LSM/) ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + &AUS_dstcalc; + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSO-LSM/) ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + &AUST_dstcalc; + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSO-TSM/) ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + &NZL_dstcalc; + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /TSO-LSF/) ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + &BZL_dstcalc; + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$area_GMT++;} + $AC_processed++; + } + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $affected_rows = $dbhA->do($stmtZ); + print STMT_FILE $stmtZ."\r\n"; + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| $dup_lead_list\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + sleep(1); +# flush(); + } + } +} + +if ($multi_insert_counter > 0) { + $stmtZ = "INSERT INTO vicidial_list values ".substr($multistmt, 0, -1).";"; + $affected_rows = $dbhA->do($stmtZ); + print STMT_FILE $stmtZ."\r\n"; +} + +print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total"; + +exit; + + + + + + +sub USACAN_dstcalc { +#********************************************************************** +# SSM-FSN +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on Second Sunday March to First Sunday November at 2 am. +# INPUTS: +# mm INTEGER Month. +# dd INTEGER Day of the month. +# ns INTEGER Seconds into the day. +# dow INTEGER Day of week (0=Sunday, to 6=Saturday) +# OPTIONAL INPUT: +# timezone INTEGER hour difference UTC - local standard time +# (DEFAULT is blank) +# make calculations based on UTC time, +# which means shift at 10:00 UTC in April +# and 9:00 UTC in October +# OUTPUT: +# INTEGER 1 = DST, 0 = not DST +# +# S M T W T F S +# 1 2 3 4 5 6 7 +# 8 9 10 11 12 13 14 +#15 16 17 18 19 20 21 +#22 23 24 25 26 27 28 +#29 30 31 +# +# S M T W T F S +# 1 2 3 4 5 6 +# 7 8 9 10 11 12 13 +#14 15 16 17 18 19 20 +#21 22 23 24 25 26 27 +#28 29 30 31 +# +#********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; return 0; + } elsif ($mm >= 4 && $mm <= 10) { + $USACAN_DST=1; return 1; + } elsif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; return 1; + } elsif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; return 0; + } else { + $USACAN_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $USACAN_DST=0; return 0; + } else { + $USACAN_DST=1; return 1; + } + } + } else { + $USACAN_DST=0; return 0; + } + } elsif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; return 0; + } elsif ($dd < ($dow+1)) { + $USACAN_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; return 1; + } else { + $USACAN_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; return 1; + } else { + $USACAN_DST=0; return 0; + } + } + } else { + $USACAN_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub NA_dstcalc { +#********************************************************************** +# FSA-LSO +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in April and last Sunday in October at 2 am. +#********************************************************************** + + $NA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $NA_DST=0; return 0; + } elsif ($mm >= 5 && $mm <= 9) { + $NA_DST=1; return 1; + } elsif ($mm == 4) { + if ($dd > 7) { + $NA_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $NA_DST=0; return 0; + } else { + $NA_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $NA_DST=0; return 0; + } else { + $NA_DST=1; return 1; + } + } + } else { + $NA_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $NA_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $NA_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $NA_DST=1; return 1; + } else { + $NA_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 7200) { + $NA_DST=1; return 1; + } else { + $NA_DST=0; return 0; + } + } + } else { + $NA_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub GBR_dstcalc { +#********************************************************************** +# LSM-LSO +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in March and last Sunday in October at 1 am. +#********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; return 0; + } elsif ($mm >= 4 && $mm <= 9) { + $GBR_DST=1; return 1; + } elsif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $GBR_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; return 0; + } else { + $GBR_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; return 0; + } else { + $GBR_DST=1; return 1; + } + } + } else { + $GBR_DST=1; return 1; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $GBR_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; return 1; + } else { + $GBR_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; return 1; + } else { + $GBR_DST=0; return 0; + } + } + } else { + $GBR_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub AUS_dstcalc { +#********************************************************************** +# LSO-LSM +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in October and last Sunday in March at 1 am. +#********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $AUS_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $AUS_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; return 1; + } else { + $AUS_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; return 1; + } else { + $AUS_DST=0; return 0; + } + } + } else { + $AUS_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $AUS_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; return 0; + } else { + $AUS_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; return 0; + } else { + $AUS_DST=1; return 1; + } + } + } else { + $AUS_DST=1; return 1; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub AUST_dstcalc { +#********************************************************************** +# FSO-LSM +# TASMANIA ONLY +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and last Sunday in March at 1 am. +#********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $AUST_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $AUST_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; return 1; + } else { + $AUST_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; return 1; + } else { + $AUST_DST=0; return 0; + } + } + } else { + $AUST_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd >= 8) { + $AUST_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $AUST_DST=0; return 0; + } else { + $AUST_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $AUST_DST=0; return 0; + } else { + $AUST_DST=1; return 1; + } + } + } else { + $AUST_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub NZL_dstcalc { +#********************************************************************** +# FSO-TSM +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and third Sunday in March at 1 am. +#********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $NZL_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; return 1; + } elsif ($dd < ($dow+14)) { + $NZL_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; return 1; + } else { + $NZL_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; return 1; + } else { + $NZL_DST=0; return 0; + } + } + } else { + $NZL_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd >= 8) { + $NZL_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $NZL_DST=0; return 0; + } else { + $NZL_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $NZL_DST=0; return 0; + } else { + $NZL_DST=1; return 1; + } + } + } else { + $NZL_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub BZL_dstcalc { +#********************************************************************** +# TSO-LSF +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. Brazil +# Based on Third Sunday October to Last Sunday February at 1 am. +#********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; return 1; + } elsif ($mm >= 3 && $mm <= 9) { + $BZL_DST=0; return 0; + } elsif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; return 1; + } elsif ($dd < ($dow+22)) { + $BZL_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; return 1; + } else { + $BZL_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; return 1; + } else { + $BZL_DST=0; return 0; + } + } + } else { + $BZL_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; return 0; + } elsif ($dd < ($dow+22)) { + $BZL_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; return 0; + } else { + $BZL_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; return 0; + } else { + $BZL_DST=1; return 1; + } + } + } else { + $BZL_DST=1; return 1; + } + } # end of month checks +} # end of subroutine dstcalc diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/new_listloader_superL.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/new_listloader_superL.php new file mode 100644 index 00000000..2c481864 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/new_listloader_superL.php @@ -0,0 +1,2069 @@ + LICENSE: GPLv2 +# +# AST GUI lead loader from formatted file +# +# CHANGES +# 50602-1640 - First version created by Joe Johnson +# 51128-1108 - Removed PHP global vars requirement +# 60113-1603 - Fixed a few bugs in Excel import +# 60421-1624 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60616-1240 - added listID override +# 60616-1604 - added gmt lookup for each lead +# 60619-1651 - Added variable filtering to eliminate SQL injection attack threat +# 60822-1121 - fixed for nonwritable directories +# 60906-1100 - added filter of non-digits in alt_phone field +# 61110-1222 - added new USA-Canada DST scheme and Brazil DST scheme +# 61128-1149 - added postal code GMT lookup and duplicate check options +# 70417-1059 - Fixed default phone_code bug +# 70510-1518 - Added campaign and system duplicate check and phonecode override +# +# make sure vicidial_list exists and that your file follows the formatting correctly. This page does not dedupe or do any other lead filtering actions yet at this time. + +$version = '2.0.4'; +$build = '70510-1518'; + + +require("dbconnect.php"); + +### links used for testing +#$link=mysql_connect("10.10.10.15", "cron", "1234"); +#mysql_select_db("asterisk"); +#$WeBServeRRooT = '/home/www/htdocs'; + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$leadfile=$_FILES["leadfile"]; + $LF_orig = $_FILES['leadfile']['name']; + $LF_path = $_FILES['leadfile']['tmp_name']; +if (isset($_GET["submit_file"])) {$submit_file=$_GET["submit_file"];} + elseif (isset($_POST["submit_file"])) {$submit_file=$_POST["submit_file"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ENVIAR"])) {$ENVIAR=$_GET["ENVIAR"];} + elseif (isset($_POST["ENVIAR"])) {$ENVIAR=$_POST["ENVIAR"];} +if (isset($_GET["leadfile_name"])) {$leadfile_name=$_GET["leadfile_name"];} + elseif (isset($_POST["leadfile_name"])) {$leadfile_name=$_POST["leadfile_name"];} +if (isset($_GET["file_layout"])) {$file_layout=$_GET["file_layout"];} + elseif (isset($_POST["file_layout"])) {$file_layout=$_POST["file_layout"];} +if (isset($_GET["OK_to_process"])) {$OK_to_process=$_GET["OK_to_process"];} + elseif (isset($_POST["OK_to_process"])) {$OK_to_process=$_POST["OK_to_process"];} +if (isset($_GET["vendor_lead_code_field"])) {$vendor_lead_code_field=$_GET["vendor_lead_code_field"];} + elseif (isset($_POST["vendor_lead_code_field"])) {$vendor_lead_code_field=$_POST["vendor_lead_code_field"];} +if (isset($_GET["source_id_field"])) {$source_id_field=$_GET["source_id_field"];} + elseif (isset($_POST["source_id_field"])) {$source_id_field=$_POST["source_id_field"];} +if (isset($_GET["list_id_field"])) {$list_id_field=$_GET["list_id_field"];} + elseif (isset($_POST["list_id_field"])) {$list_id_field=$_POST["list_id_field"];} +if (isset($_GET["phone_code_field"])) {$phone_code_field=$_GET["phone_code_field"];} + elseif (isset($_POST["phone_code_field"])) {$phone_code_field=$_POST["phone_code_field"];} +if (isset($_GET["phone_number_field"])) {$phone_number_field=$_GET["phone_number_field"];} + elseif (isset($_POST["phone_number_field"])) {$phone_number_field=$_POST["phone_number_field"];} +if (isset($_GET["title_field"])) {$title_field=$_GET["title_field"];} + elseif (isset($_POST["title_field"])) {$title_field=$_POST["title_field"];} +if (isset($_GET["first_name_field"])) {$first_name_field=$_GET["first_name_field"];} + elseif (isset($_POST["first_name_field"])) {$first_name_field=$_POST["first_name_field"];} +if (isset($_GET["middle_initial_field"])) {$middle_initial_field=$_GET["middle_initial_field"];} + elseif (isset($_POST["middle_initial_field"])) {$middle_initial_field=$_POST["middle_initial_field"];} +if (isset($_GET["last_name_field"])) {$last_name_field=$_GET["last_name_field"];} + elseif (isset($_POST["last_name_field"])) {$last_name_field=$_POST["last_name_field"];} +if (isset($_GET["address1_field"])) {$address1_field=$_GET["address1_field"];} + elseif (isset($_POST["address1_field"])) {$address1_field=$_POST["address1_field"];} +if (isset($_GET["address2_field"])) {$address2_field=$_GET["address2_field"];} + elseif (isset($_POST["address2_field"])) {$address2_field=$_POST["address2_field"];} +if (isset($_GET["address3_field"])) {$address3_field=$_GET["address3_field"];} + elseif (isset($_POST["address3_field"])) {$address3_field=$_POST["address3_field"];} +if (isset($_GET["city_field"])) {$city_field=$_GET["city_field"];} + elseif (isset($_POST["city_field"])) {$city_field=$_POST["city_field"];} +if (isset($_GET["state_field"])) {$state_field=$_GET["state_field"];} + elseif (isset($_POST["state_field"])) {$state_field=$_POST["state_field"];} +if (isset($_GET["province_field"])) {$province_field=$_GET["province_field"];} + elseif (isset($_POST["province_field"])) {$province_field=$_POST["province_field"];} +if (isset($_GET["postal_code_field"])) {$postal_code_field=$_GET["postal_code_field"];} + elseif (isset($_POST["postal_code_field"])) {$postal_code_field=$_POST["postal_code_field"];} +if (isset($_GET["country_code_field"])) {$country_code_field=$_GET["country_code_field"];} + elseif (isset($_POST["country_code_field"])) {$country_code_field=$_POST["country_code_field"];} +if (isset($_GET["gender_field"])) {$gender_field=$_GET["gender_field"];} + elseif (isset($_POST["gender_field"])) {$gender_field=$_POST["gender_field"];} +if (isset($_GET["date_of_birth_field"])) {$date_of_birth_field=$_GET["date_of_birth_field"];} + elseif (isset($_POST["date_of_birth_field"])) {$date_of_birth_field=$_POST["date_of_birth_field"];} +if (isset($_GET["alt_phone_field"])) {$alt_phone_field=$_GET["alt_phone_field"];} + elseif (isset($_POST["alt_phone_field"])) {$alt_phone_field=$_POST["alt_phone_field"];} +if (isset($_GET["email_field"])) {$email_field=$_GET["email_field"];} + elseif (isset($_POST["email_field"])) {$email_field=$_POST["email_field"];} +if (isset($_GET["security_phrase_field"])) {$security_phrase_field=$_GET["security_phrase_field"];} + elseif (isset($_POST["security_phrase_field"])) {$security_phrase_field=$_POST["security_phrase_field"];} +if (isset($_GET["comments_field"])) {$comments_field=$_GET["comments_field"];} + elseif (isset($_POST["comments_field"])) {$comments_field=$_POST["comments_field"];} +if (isset($_GET["list_id_override"])) {$list_id_override=$_GET["list_id_override"];} + elseif (isset($_POST["list_id_override"])) {$list_id_override=$_POST["list_id_override"];} + $list_id_override = (preg_replace("/\D/","",$list_id_override)); +if (isset($_GET["lead_file"])) {$lead_file=$_GET["lead_file"];} + elseif (isset($_POST["lead_file"])) {$lead_file=$_POST["lead_file"];} +if (isset($_GET["dupcheck"])) {$dupcheck=$_GET["dupcheck"];} + elseif (isset($_POST["dupcheck"])) {$dupcheck=$_POST["dupcheck"];} +if (isset($_GET["postalgmt"])) {$postalgmt=$_GET["postalgmt"];} + elseif (isset($_POST["postalgmt"])) {$postalgmt=$_POST["postalgmt"];} +if (isset($_GET["phone_code_override"])) {$phone_code_override=$_GET["phone_code_override"];} + elseif (isset($_POST["phone_code_override"])) {$phone_code_override=$_POST["phone_code_override"];} + $phone_code_override = (preg_replace("/\D/","",$phone_code_override)); + +# $country_field=$_GET["country_field"]; if (!$country_field) {$country_field=$_POST["country_field"];} + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); +$list_id_override = ereg_replace("[^0-9]","",$list_id_override); + + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_datetime = $STARTtime; + +$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +if ($WeBRooTWritablE > 0) {$fp = fopen ("./project_auth_entries.txt", "a");} +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-LEAD-LOADER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT load_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGload_leads =$row[0]; + + if ($LOGload_leads < 1) + { + echo "You do not have permissions to load leads\n"; + exit; + } + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "LIST_LOAD|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "LIST_LOAD|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + + +$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://';} +$admDIR = "$HTTPprotocol$server_name$script_name"; +$admDIR = eregi_replace('new_listloader_superL.php','',$admDIR); +$admSCR = 'admin.php'; +$NWB = "   \"AYUDA\""; + +$secX = date("U"); +$hour = date("H"); +$min = date("i"); +$sec = date("s"); +$mon = date("m"); +$mday = date("d"); +$year = date("Y"); +$isdst = date("I"); +$Shour = date("H"); +$Smin = date("i"); +$Ssec = date("s"); +$Smon = date("m"); +$Smday = date("d"); +$Syear = date("Y"); +$pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; +$inSD = $pulldate0; +$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + ### Grab Server GMT value from the database + $stmt="SELECT local_gmt FROM servers where server_ip = '$server_ip';"; + $rslt=mysql_query($stmt, $link); + $gmt_recs = mysql_num_rows($rslt); + if ($gmt_recs > 0) + { + $row=mysql_fetch_row($rslt); + $DBSERVER_GMT = "$row[0]"; + if (strlen($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;} + if ($isdst) {$SERVER_GMT++;} + } + else + { + $SERVER_GMT = date("O"); + $SERVER_GMT = eregi_replace("\+","",$SERVER_GMT); + $SERVER_GMT = ($SERVER_GMT + 0); + $SERVER_GMT = ($SERVER_GMT / 100); + } + + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + +#if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";} + + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +function macfontfix($fontsize) { + + $browser = getenv("HTTP_USER_AGENT"); + $pctype = explode("(", $browser); + if (ereg("Mac",$pctype[1])) { + /* Browser is a Mac. If not Netscape 6, raise fonts */ + + $blownbrowser = explode('/', $browser); + $ver = explode(' ', $blownbrowser[1]); + $ver = $ver[0]; + if ($ver >= 5.0) return $fontsize; else return ($fontsize+2); + + } else return $fontsize; /* Browser is not a Mac - don't touch fonts */ +} + +echo "\n"; + +?> + + + +VICIDIAL ADMIN: Lead Loader + + +
method=post onSubmit="ParseFileName()" enctype="multipart/form-data"> + + +
\n"; + echo ""; + + $stmt="SELECT * from conferences order by conf_exten"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
LISTADOS DE CONFERENCIAS:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2]$row[4]  MODIFICAR
\n"; +} + +###################### +# ADD=10000000000000 display all vicidial conferences +###################### +if ($ADD==10000000000000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_conferences order by conf_exten"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
LISTADOS DE CONFERENCIAS:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2]$row[4]  MODIFICAR
\n"; +} + +###################### +# ADD=999999 display reports section +###################### +if ($ADD==999999) +{ + if ($LOGview_reports==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_conferences order by conf_exten"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + + $stmt="select * from servers;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $servers_to_print = mysql_num_rows($rslt); + $i=0; + while ($i < $servers_to_print) + { + $row=mysql_fetch_row($rslt); + $server_id[$i] = $row[0]; + $server_description[$i] = $row[1]; + $server_ip[$i] = $row[2]; + $active[$i] = $row[3]; + $i++; + } + + $stmt="SELECT enable_queuemetrics_logging,queuemetrics_url from system_settings;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $enable_queuemetrics_logging_LU = $row[0]; + $queuemetrics_url_LU = $row[1]; + + ?> + + + + + + VICIDIAL: ESTADÃSTICAS DEL SERVIDOR and Reports + VICIDIAL: ESTADÃSTICAS DEL SERVIDOR and Reports

+ +

+	
+	 $o)
+		{
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		$o++;
+		}
+
+	echo "
SERVERDESCRIPCIÓNIP ADDRESSACTIVOVDAD timePARK timeCLOSER/INBOUND time
$server_id[$o]$server_description[$o]$server_ip[$o]$active[$o]LINKLINKLINK
\n"; + } + else + { + echo "Usted no tiene permiso de visión esta página\n"; + exit; + } +} + + + + + +echo "
\n"; + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n
\n"; + + +echo "\n\n\n


\nScript runtime: $RUNtime seconds"; +echo "                   VERSIÓN: $admin_version"; +echo "                   CONSTRUCCION: $build
\n"; + + +?> + + +
+ + + +1) + { + if (strlen($dial_statuses)>2) + { + $g=0; + $p='13'; + $GMT_gmt[0] = ''; + $GMT_hour[0] = ''; + $GMT_day[0] = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $pmin=(gmdate("i", time() + $pzone)); + $phour=( (gmdate("G", time() + $pzone)) * 100); + $pday=gmdate("w", time() + $pzone); + $tz = sprintf("%.2f", $p); + $GMT_gmt[$g] = "$tz"; + $GMT_day[$g] = "$pday"; + $GMT_hour[$g] = ($phour + $pmin); + $p = ($p - 0.25); + $g++; + } + + $stmt="SELECT * FROM vicidial_call_times where call_time_id='$local_call_time';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $Gct_default_start = "$rowx[3]"; + $Gct_default_stop = "$rowx[4]"; + $Gct_sunday_start = "$rowx[5]"; + $Gct_sunday_stop = "$rowx[6]"; + $Gct_monday_start = "$rowx[7]"; + $Gct_monday_stop = "$rowx[8]"; + $Gct_tuesday_start = "$rowx[9]"; + $Gct_tuesday_stop = "$rowx[10]"; + $Gct_wednesday_start = "$rowx[11]"; + $Gct_wednesday_stop = "$rowx[12]"; + $Gct_thursday_start = "$rowx[13]"; + $Gct_thursday_stop = "$rowx[14]"; + $Gct_friday_start = "$rowx[15]"; + $Gct_friday_stop = "$rowx[16]"; + $Gct_saturday_start = "$rowx[17]"; + $Gct_saturday_stop = "$rowx[18]"; + $Gct_state_call_times = "$rowx[19]"; + + $ct_states = ''; + $ct_state_gmt_SQL = ''; + $ct_srs=0; + $b=0; + if (strlen($Gct_state_call_times)>2) + { + $state_rules = explode('|',$Gct_state_call_times); + $ct_srs = ((count($state_rules)) - 2); + } + while($ct_srs >= $b) + { + if (strlen($state_rules[$b])>1) + { + $stmt="SELECT * from vicidial_state_call_times where state_call_time_id='$state_rules[$b]';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Gstate_call_time_id = "$row[0]"; + $Gstate_call_time_state = "$row[1]"; + $Gsct_default_start = "$row[4]"; + $Gsct_default_stop = "$row[5]"; + $Gsct_sunday_start = "$row[6]"; + $Gsct_sunday_stop = "$row[7]"; + $Gsct_monday_start = "$row[8]"; + $Gsct_monday_stop = "$row[9]"; + $Gsct_tuesday_start = "$row[10]"; + $Gsct_tuesday_stop = "$row[11]"; + $Gsct_wednesday_start = "$row[12]"; + $Gsct_wednesday_stop = "$row[13]"; + $Gsct_thursday_start = "$row[14]"; + $Gsct_thursday_stop = "$row[15]"; + $Gsct_friday_start = "$row[16]"; + $Gsct_friday_stop = "$row[17]"; + $Gsct_saturday_start = "$row[18]"; + $Gsct_saturday_stop = "$row[19]"; + + $ct_states .="'$Gstate_call_time_state',"; + + $r=0; + $state_gmt=''; + while($r < $g) + { + if ($GMT_day[$r]==0) #### Sunday tiempo local + { + if (($Gsct_sunday_start==0) and ($Gsct_sunday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_sunday_start) and ($GMT_hour[$r]<$Gsct_sunday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==1) #### Monday tiempo local + { + if (($Gsct_monday_start==0) and ($Gsct_monday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_monday_start) and ($GMT_hour[$r]<$Gsct_monday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==2) #### Tuesday tiempo local + { + if (($Gsct_tuesday_start==0) and ($Gsct_tuesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_tuesday_start) and ($GMT_hour[$r]<$Gsct_tuesday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==3) #### Wednesday tiempo local + { + if (($Gsct_wednesday_start==0) and ($Gsct_wednesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_wednesday_start) and ($GMT_hour[$r]<$Gsct_wednesday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==4) #### Thursday tiempo local + { + if (($Gsct_thursday_start==0) and ($Gsct_thursday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_thursday_start) and ($GMT_hour[$r]<$Gsct_thursday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==5) #### Friday tiempo local + { + if (($Gsct_friday_start==0) and ($Gsct_friday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_friday_start) and ($GMT_hour[$r]<$Gsct_friday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==6) #### Saturday tiempo local + { + if (($Gsct_saturday_start==0) and ($Gsct_saturday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_saturday_start) and ($GMT_hour[$r]<$Gsct_saturday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + $r++; + } + $state_gmt = "$state_gmt'99'"; + $ct_state_gmt_SQL .= "or (state='$Gstate_call_time_state' and gmt_offset_now IN($state_gmt)) "; + } + + $b++; + } + if (strlen($ct_states)>2) + { + $ct_states = eregi_replace(",$",'',$ct_states); + $ct_statesSQL = "and state NOT IN($ct_states)"; + } + else + { + $ct_statesSQL = ""; + } + + $r=0; + $default_gmt=''; + while($r < $g) + { + if ($GMT_day[$r]==0) #### Sunday tiempo local + { + if (($Gct_sunday_start==0) and ($Gct_sunday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_sunday_start) and ($GMT_hour[$r]<$Gct_sunday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==1) #### Monday tiempo local + { + if (($Gct_monday_start==0) and ($Gct_monday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_monday_start) and ($GMT_hour[$r]<$Gct_monday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==2) #### Tuesday tiempo local + { + if (($Gct_tuesday_start==0) and ($Gct_tuesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_tuesday_start) and ($GMT_hour[$r]<$Gct_tuesday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==3) #### Wednesday tiempo local + { + if (($Gct_wednesday_start==0) and ($Gct_wednesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_wednesday_start) and ($GMT_hour[$r]<$Gct_wednesday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==4) #### Thursday tiempo local + { + if (($Gct_thursday_start==0) and ($Gct_thursday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_thursday_start) and ($GMT_hour[$r]<$Gct_thursday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==5) #### Friday tiempo local + { + if (($Gct_friday_start==0) and ($Gct_friday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_friday_start) and ($GMT_hour[$r]<$Gct_friday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==6) #### Saturday tiempo local + { + if (($Gct_saturday_start==0) and ($Gct_saturday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_saturday_start) and ($GMT_hour[$r]<$Gct_saturday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + $r++; + } + + $default_gmt = "$default_gmt'99'"; + $all_gmtSQL = "(gmt_offset_now IN($default_gmt) $ct_statesSQL) $ct_state_gmt_SQL"; + + + $dial_statuses = preg_replace("/ -$/","",$dial_statuses); + $Dstatuses = explode(" ", $dial_statuses); + $Ds_to_print = (count($Dstatuses) - 0); + $Dsql = ''; + $o=0; + while ($Ds_to_print > $o) + { + $o++; + $Dsql .= "'$Dstatuses[$o]',"; + } + $Dsql = preg_replace("/,$/","",$Dsql); + + $stmt="SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN($Dsql) and list_id IN($camp_lists) and ($all_gmtSQL) $fSQL"; + #$DB=1; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rslt_rows = mysql_num_rows($rslt); + if ($rslt_rows) + { + $rowx=mysql_fetch_row($rslt); + $active_leads = "$rowx[0]"; + } + else {$active_leads = '0';} + + echo "|$DB|\n"; + echo "Esta campaña tiene $active_leads Leads para ser llamados en estas listas\n"; + } + else + { + echo "ningunos estados del dial seleccionados para esta campaña\n"; + } + } + else + { + echo "ningunas listas activas seleccionadas para esta campaña\n"; + } + } +else + { + echo "ningunas listas activas seleccionadas para esta campaña\n"; + } +##### END calculate what gmt_offset_now values are within the allowed local_call_time setting ### +} +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/admin_modify_lead.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/admin_modify_lead.php new file mode 100644 index 00000000..b28d98c4 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/admin_modify_lead.php @@ -0,0 +1,610 @@ + LICENSE: GPLv2 +# + +# CHANGES +# +# 70702-1259 - Added recording location link and truncation +# 70906-2132 - Added closer_log records display +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} +if (isset($_GET["phone"])) {$phone=$_GET["phone"];} + elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];} + elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];} +if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];} + elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];} +if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];} + elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];} +if (isset($_GET["end_call"])) {$end_call=$_GET["end_call"];} + elseif (isset($_POST["end_call"])) {$end_call=$_POST["end_call"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];} + elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];} + elseif (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["call_began"])) {$call_began=$_GET["call_began"];} + elseif (isset($_POST["call_began"])) {$call_began=$_POST["call_began"];} +if (isset($_GET["parked_time"])) {$parked_time=$_GET["parked_time"];} + elseif (isset($_POST["parked_time"])) {$parked_time=$_POST["parked_time"];} +if (isset($_GET["tsr"])) {$tsr=$_GET["tsr"];} + elseif (isset($_POST["tsr"])) {$tsr=$_POST["tsr"];} +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["postal_code"])) {$postal_code=$_GET["postal_code"];} + elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];} +if (isset($_GET["province"])) {$province=$_GET["province"];} + elseif (isset($_POST["province"])) {$province=$_POST["province"];} +if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];} + elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];} +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"])) {$security=$_GET["security"];} + elseif (isset($_POST["security"])) {$security=$_POST["security"];} +if (isset($_GET["comments"])) {$comments=$_GET["comments"];} + elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ENVIAR"])) {$ENVIAR=$_GET["ENVIAR"];} + elseif (isset($_POST["ENVIAR"])) {$ENVIAR=$_POST["ENVIAR"];} +if (isset($_GET["CBchangeUSERtoANY"])) {$CBchangeUSERtoANY=$_GET["CBchangeUSERtoANY"];} + elseif (isset($_POST["CBchangeUSERtoANY"])) {$CBchangeUSERtoANY=$_POST["CBchangeUSERtoANY"];} +if (isset($_GET["CBchangeUSERtoUSER"])) {$CBchangeUSERtoUSER=$_GET["CBchangeUSERtoUSER"];} + elseif (isset($_POST["CBchangeUSERtoUSER"])) {$CBchangeUSERtoUSER=$_POST["CBchangeUSERtoUSER"];} +if (isset($_GET["CBchangeANYtoUSER"])) {$CBchangeANYtoUSER=$_GET["CBchangeANYtoUSER"];} + elseif (isset($_POST["CBchangeANYtoUSER"])) {$CBchangeANYtoUSER=$_POST["CBchangeANYtoUSER"];} +if (isset($_GET["callback_id"])) {$callback_id=$_GET["callback_id"];} + elseif (isset($_POST["callback_id"])) {$callback_id=$_POST["callback_id"];} +if (isset($_GET["CBuser"])) {$CBuser=$_GET["CBuser"];} + elseif (isset($_POST["CBuser"])) {$CBuser=$_POST["CBuser"];} +if (isset($_GET["modify_logs"])) {$modify_logs=$_GET["modify_logs"];} + elseif (isset($_POST["modify_logs"])) {$modify_logs=$_POST["modify_logs"];} + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + + +### AST GUI database administration modify lead in vicidial_list +### admin_modify_lead.php + +# this is the administration lead information modifier screen, the administrator just needs to enter the leadID and then they can view and modify the information in the record for that lead + +# CHANGES +# +# 60419-1705 - Added ability to change lead callback record from USERONLY to ANYONE or USERONLY-user +# 60421-1459 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60609-1112 - Added DNC list addition if status changed to DNC +# 60619-1539 - Added variable filtering to eliminate SQL injection attack threat +# 61130-1639 - Added recording_log lookup and list for this lead_id +# 61201-1136 - Added recording_log user(TSR) display and link +# 70305-1133 - Changed to default CHECKED modify logs upon status change +# 70424-1128 - Added campaign-specific statuses, reformatted recordings list +# + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); + + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and modify_leads='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $stmt="SELECT full_name,modify_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[0]; + $LOGmodify_leads =$row[1]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +?> + + + +VICIDIAL ADMIN: Registro del Lead modificado + + +
+VICIDIAL ADMIN: Registro del Lead modificado
\n"; + +if ($end_call > 0) +{ + +$call_length = ($STARTtime - $call_began); + + ### insert a NEW record to the vicidial_closer_log table + $stmt="INSERT INTO vicidial_closer_log (lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed) values('" . mysql_real_escape_string($lead_id) . "','" . mysql_real_escape_string($list_id) . "','" . mysql_real_escape_string($campaign_id) . "','" . mysql_real_escape_string($parked_time) . "','" . mysql_real_escape_string($call_began) . "','$STARTtime','" . mysql_real_escape_string($call_length) . "','" . mysql_real_escape_string($status) . "','" . mysql_real_escape_string($phone_code) . "','" . mysql_real_escape_string($phone_number) . "','$PHP_AUTH_USER','" . mysql_real_escape_string($comments) . "','Y')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ### update the lead record in the vicidial_list table + $stmt="UPDATE vicidial_list set status='" . mysql_real_escape_string($status) . "',first_name='" . mysql_real_escape_string($first_name) . "',last_name='" . mysql_real_escape_string($last_name) . "',address1='" . mysql_real_escape_string($address1) . "',address2='" . mysql_real_escape_string($address2) . "',address3='" . mysql_real_escape_string($address3) . "',city='" . mysql_real_escape_string($city) . "',state='" . mysql_real_escape_string($state) . "',province='" . mysql_real_escape_string($province) . "',postal_code='" . mysql_real_escape_string($postal_code) . "',country_code='" . mysql_real_escape_string($country_code) . "',alt_phone='" . mysql_real_escape_string($alt_phone) . "',email='" . mysql_real_escape_string($email) . "',security_phrase='" . mysql_real_escape_string($security) . "',comments='" . mysql_real_escape_string($comments) . "' where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "Información modificada

\n"; + echo "\n"; + + if ( ($dispo != $status) and ($dispo == 'CBHOLD') ) + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='" . mysql_real_escape_string($lead_id) . "' and status='ACTIVE';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record inactivated: $lead_id
\n"; + } + if ( ($dispo != $status) and ($dispo == 'CALLBK') ) + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='" . mysql_real_escape_string($lead_id) . "' and status IN('ACTIVE','LIVE');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record inactivated: $lead_id
\n"; + } + + if ( ($dispo != $status) and ($status == 'DNC') ) + { + ### add lead to the internal DNC list + $stmt="INSERT INTO vicidial_dnc (phone_number) values('" . mysql_real_escape_string($phone_number) . "');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
Lead added to DNC List: $lead_id - $phone_number
\n"; + } + ### update last record in vicidial_agent_log and vicidial_log tables + if (($dispo != $status) and ($modify_logs > 0)) + { + $stmt="UPDATE vicidial_log set status='" . mysql_real_escape_string($status) . "' where lead_id='" . mysql_real_escape_string($lead_id) . "' order by call_date desc limit 1"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_agent_log set status='" . mysql_real_escape_string($status) . "' where lead_id='" . mysql_real_escape_string($lead_id) . "' order by agent_log_id desc limit 1"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + } + +} +else +{ + + if ($CBchangeUSERtoANY == 'YES') + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set recipient='ANYONE' where callback_id='" . mysql_real_escape_string($callback_id) . "';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record changed to ANYONE
\n"; + } + if ($CBchangeUSERtoUSER == 'YES') + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set user='" . mysql_real_escape_string($CBuser) . "' where callback_id='" . mysql_real_escape_string($callback_id) . "';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record user changed to $CBuser
\n"; + } + if ($CBchangeANYtoUSER == 'YES') + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set user='" . mysql_real_escape_string($CBuser) . "',recipient='USERONLY' where callback_id='" . mysql_real_escape_string($callback_id) . "';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record changed to USERONLY, user: $CBuser
\n"; + } + + + + $stmt="SELECT count(*) from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_count = $row[0]; + + if ($lead_count > 0) + { + + $stmt="select * from vicidial_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by uniqueid desc limit 500;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + $call_log = ''; + $log_campaign = ''; + while ($logs_to_print > $u) + { + $row=mysql_fetch_row($rslt); + if (strlen($log_campaign)<1) {$log_campaign = $row[3];} + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $u++; + $call_log .= "
"; + $call_log .= ""; + $call_log .= ""; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + + } + + $stmt="select * from vicidial_closer_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by closecallid desc limit 500;"; + $rslt=mysql_query($stmt, $link); + $Clogs_to_print = mysql_num_rows($rslt); + + $y=0; + $closer_log = ''; + $Clog_campaign = ''; + while ($Clogs_to_print > $y) + { + $row=mysql_fetch_row($rslt); + if (strlen($Clog_campaign)<1) {$Clog_campaign = $row[3];} + if (eregi("1$|3$|5$|7$|9$", $y)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $y++; + $closer_log .= ""; + $closer_log .= ""; + $closer_log .= ""; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + + } + + $stmt="SELECT * from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_id = "$row[0]"; + $dispo = "$row[3]"; + $tsr = "$row[4]"; + $vendor_id = "$row[5]"; + $list_id = "$row[7]"; + $campaign_id = "$row[8]"; + $phone_code = "$row[10]"; + $phone_number = "$row[11]"; + $title = "$row[12]"; + $first_name = "$row[13]"; # + $middle_initial = "$row[14]"; + $last_name = "$row[15]"; # + $address1 = "$row[16]"; # + $address2 = "$row[17]"; # + $address3 = "$row[18]"; # + $city = "$row[19]"; # + $state = "$row[20]"; # + $province = "$row[21]"; # + $postal_code = "$row[22]"; # + $country_code = "$row[23]"; # + $gender = "$row[24]"; + $date_of_birth = "$row[25]"; + $alt_phone = "$row[26]"; # + $email = "$row[27]"; # + $security = "$row[28]"; # + $comments = "$row[29]"; # + + echo "
Información de la llamada: $first_name $last_name - $phone_number

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
$u$row[4] $row[7] $row[8] $row[11] $row[3] $row[2] $row[1]
$y$row[4] $row[7] $row[8] $row[11] $row[3] $row[2] $row[1]   $row[14]
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + echo "\n"; + + echo "\n"; + echo "
Vendor ID: $vendor_id     Lead ID: $lead_id
Fronter: $tsr     ID De la Lista: $list_id
Nombre:   \n"; + echo " Apellidos:
Dirección 1 :
Dirección 2 :
Dirección 3 :
Ciudad :
Estado:   \n"; + echo " Código Postal:
Provincia:
País :
Alt Phone :
Email :
Seguridad:
Comentarios :
Disposición: (with $log_campaign statuses)
Modify agent and vicidial logs
\n"; + echo "


\n"; + + if ( ($dispo == 'CALLBK') or ($dispo == 'CBHOLD') ) + { + ### find any vicidial_callback records for this lead + $stmt="select * from vicidial_callbacks where lead_id='" . mysql_real_escape_string($lead_id) . "' and status IN('ACTIVE','LIVE') order by callback_id desc LIMIT 1;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $CB_to_print = mysql_num_rows($rslt); + $rowx=mysql_fetch_row($rslt); + + if ($CB_to_print>0) + { + if ($rowx[9] == 'USERONLY') + { + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "

\n"; + + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "New Callback Owner UserID: \n"; + echo "

\n"; + } + else + { + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "New Callback Owner UserID: \n"; + echo "

\n"; + } + } + else + { + echo "
No Callback records found
\n"; + } + } + + + + + + + } + else + { + echo "las operaciones de búsqueda del plomo FALLARON para el lead_id $lead_id       $NOW_TIME\n

\n"; +# echo "Close this window\n

\n"; + } + + + +echo "

\n"; + +echo "
\n"; + +echo "LLAMADAS A ESTE LEAD:\n"; +echo "\n"; +echo "\n"; + + echo "$call_log\n"; + +echo "
# DATE/TIME LENGTH STATUS TSR CAMPAÑA LIST LEAD
\n"; +echo "

\n"; + +echo "CLOSER RECORDS FOR THIS LEAD:\n"; +echo "\n"; +echo "\n"; + + echo "$closer_log\n"; + +echo "
# DATE/TIME LENGTH STATUS TSR CAMPAÑA LIST LEAD WAIT
\n"; +echo "

\n"; + + +echo "RECORDINGS FOR THIS LEAD:\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from recording_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by recording_id desc limit 500;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) + { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $location = $row[11]; + if (strlen($location)>30) + {$locat = substr($location,0,27); $locat = "$locat...";} + else + {$locat = $location;} + if (eregi("http",$location)) + {$location = "$locat";} + else + {$location = $locat;} + $u++; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + + } + + +echo "
# LEADDATE/TIME SECONDS   RECIDFILENAMELOCATIONTSR
$u $row[12] $row[4] $row[8] $row[0]   $row[10] $location $row[13]
\n"; + + + + +} + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nScript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/admin_search_lead.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/admin_search_lead.php new file mode 100644 index 00000000..536853f5 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/admin_search_lead.php @@ -0,0 +1,225 @@ + LICENSE: GPLv2 +### +### AST GUI database administration search for lead info +### admin_modify_lead.php +# +# this is the administration lead information modifier screen, the administrator just needs to enter the leadID and then they can view and modify the information in the record for that lead +# +# changes: +# 60620-1055 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# - Changed results to multi-record +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} +if (isset($_GET["phone"])) {$phone=$_GET["phone"];} + elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ENVIAR"])) {$ENVIAR=$_GET["ENVIAR"];} + elseif (isset($_POST["ENVIAR"])) {$ENVIAR=$_POST["ENVIAR"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); + + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and modify_leads='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name,modify_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[0]; + $LOGmodify_leads =$row[1]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +?> + + + +VICIDIAL ADMIN: Buscar Lead + +Operaciones de búsqueda del Lead + + +VICIDIAL ADMIN: Lead search
\n"; + + +if ( (!$vendor_id) and (!$phone) and (!$lead_id) ) + { + echo date("l F j, Y G:i:s A"); + echo "\n

\n"; + echo "
\n"; + echo "\n"; + echo "Por favor, Introduzca un:
Vendor ID(código del vendedor del Lead): or \n"; + echo "
un número de teléfono de casa: or\n"; + echo "
ID del Lead:

\n"; + echo "
\n"; + echo "\n
\n"; + echo "\n"; + exit; + } + +else + { + + if ($vendor_id) + { + $stmt="SELECT * from vicidial_list where vendor_lead_code='" . mysql_real_escape_string($vendor_id) . "' order by modify_date desc limit 1000"; + } + else + { + if ($phone) + { + $stmt="SELECT * from vicidial_list where phone_number='" . mysql_real_escape_string($phone) . "' order by modify_date desc limit 1000"; + } + else + { + if ($lead_id) + { + $stmt="SELECT * from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "' order by modify_date desc limit 1000"; + } + else + { + print "ERROR: you must search for something! Go back and search for something"; + exit; + } + } + } + if ($DB) + { + echo "\n\n$stmt\n\n"; + } + + $rslt=mysql_query($stmt, $link); + $results_to_print = mysql_num_rows($rslt); + if ($results_to_print < 1) + { + echo date("l F j, Y G:i:s A"); + echo "\n

\n"; + echo "Las variables de la búsqueda que usted incorporó no son activas en el sistema

\n"; + echo "Va por favor detrás y dobla el cheque la información que usted incorporó y somete otra vez\n"; + echo "
\n"; + echo "\n"; + exit; + } + else + { + echo "RESULTS: $results_to_print

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + $o=0; + while ($results_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $o++; + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + echo "
#LEAD IDESTADOVENDOR IDLAST AGENTID DE LA LISTAPHONENOMBRECITYSECURITYLAST CALL
$o$row[0]$row[3]$row[5]$row[4]$row[7]$row[11]$row[13] $row[15]$row[19]$row[28]$row[2]
\n"; + } + } + + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\nNUEVA BÚSQUEDA"; + + +echo "\n\n\n


\nScript runtime: $RUNtime seconds"; + + +?> + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/count.htm b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/count.htm new file mode 100644 index 00000000..51f8a361 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/count.htm @@ -0,0 +1 @@ + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/dbconnect.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/dbconnect.php new file mode 100644 index 00000000..5247e166 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/dbconnect.php @@ -0,0 +1,49 @@ + LICENSE: GPLv2 +# +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"); +mysql_select_db("$VARDB_database"); + +$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 + +?> diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/group_hourly_stats.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/group_hourly_stats.php new file mode 100644 index 00000000..dce46183 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/group_hourly_stats.php @@ -0,0 +1,252 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60620-1014 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["date_with_hour"])) {$date_with_hour=$_GET["date_with_hour"];} + elseif (isset($_POST["date_with_hour"])) {$date_with_hour=$_POST["date_with_hour"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ENVIAR"])) {$ENVIAR=$_GET["ENVIAR"];} + elseif (isset($_POST["ENVIAR"])) {$ENVIAR=$_POST["ENVIAR"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$date_with_hour_default = date("Y-m-d H"); +$date_no_hour_default = $TODAY; + +if (!isset($date_with_hour)) {$date_with_hour = $date_with_hour_default;} + $date_no_hour = $date_with_hour; + $date_no_hour = eregi_replace(" ([0-9]{2})",'',$date_no_hour); +if (!isset($begin_date)) {$begin_date = $TODAY;} +if (!isset($end_date)) {$end_date = $TODAY;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + +# $stmt="SELECT full_name from vicidial_users where user='$user';"; +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# $full_name = $row[0]; + + } + + + + +?> + + +VICIDIAL ADMIN: Stats Cada hora Del Grupo +\n"; +?> + + +
+ + + + + += '" . mysql_real_escape_string($date_with_hour) . ":00:00' and call_date <= '" . mysql_real_escape_string($date_with_hour) . ":59:59' and user='$VDuser[$o]';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDtotal[$o] = "$row[0]"; + + $stmt="select count(*) from vicidial_log where call_date >= '" . mysql_real_escape_string($date_no_hour) . " 00:00:00' and call_date <= '" . mysql_real_escape_string($date_no_hour) . " 23:59:59' and user='$VDuser[$o]' and status='" . mysql_real_escape_string($status) . "';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDday[$o] = "$row[0]"; + + $stmt="select count(*) from vicidial_log where call_date >= '" . mysql_real_escape_string($date_with_hour) . ":00:00' and call_date <= '" . mysql_real_escape_string($date_with_hour) . ":59:59' and user='$VDuser[$o]' and status='" . mysql_real_escape_string($status) . "';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDcount[$o] = "$row[0]"; + $o++; + } + +echo "
" ?>   VICIDIAL ADMIN: Stats Cada hora Del Grupo  
\n"; + +echo "
\n"; + +echo "CUENTAS DE HORAS DE TSR: $group | $status | $date_with_hour | $date_no_hour\n"; + +echo "
\n"; +echo "\n"; + + $day_calls=0; + $hour_calls=0; + $total_calls=0; + $o=0; + while($o < $tsrs_to_print) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + $total_calls = ($total_calls + $VDtotal[$o]); + $hour_calls = ($hour_calls + $VDcount[$o]); + $day_calls = ($day_calls + $VDday[$o]); + + $o++; + } + +echo "\n"; + + +} + +echo "
TSR ID   $status   LLAMADAS TOTALES   $status DAY    
$VDuser[$o] $VDname[$o] $VDcount[$o] $VDtotal[$o] $VDday[$o]MODIFICAR | ESTADÃSTICAS
TOTAL $status $hour_calls $total_calls $day_calls
\n"; +echo "

\n"; + + + echo "
Inscriba por favor a grupo que usted desea conseguir el stats cada hora para:
\n"; + echo "\n"; + echo "group:
\n"; + echo "status:   (example: XFER)
\n"; + echo "date with hour:   (example: 2004-06-25 14)
\n"; + echo "\n"; + echo "


\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nScript runtime: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/help.gif b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/help.gif new file mode 100644 index 00000000..5575d7c8 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/help.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/listloader.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/listloader.php new file mode 100644 index 00000000..801ca169 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/listloader.php @@ -0,0 +1,926 @@ + LICENSE: GPLv2 +# +# AST Web GUI lead loader from formatted file +# +# CHANGES +# 50602-1640 - First version created by Joe Johnson +# 51128-1108 - Removed PHP global vars requirement +# 60421-1043 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60616-1006 - added listID override and gmt_offset lookup while loading +# 60619-1652 - Added variable filtering to eliminate SQL injection attack threat +# 60822-1105 - fixed for nonwritable directories +# 60906-1059 - added filter of non-digits in alt_phone field +# 61110-1222 - added new USA-Canada DST scheme and Brazil DST scheme +# 61128-1046 - added postal code GMT lookup and duplicate check options +# 70205-1703 - Defaulted phone_code to 1 if not populated +# 70417-1059 - Fixed default phone_code bug +# +# make sure vicidial_list exists and that your file follows the formatting correctly. This page does not dedupe or do any other lead filtering actions yet at this time. +# + +$version = '2.0.3'; +$build = '770417-1059'; + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$leadfile=$_FILES["leadfile"]; + $LF_orig = $_FILES['leadfile']['name']; + $LF_path = $_FILES['leadfile']['tmp_name']; +$submit_file=$_GET["submit_file"]; if (!$submit_file) {$submit_file=$_POST["submit_file"];} +$list_id_override=$_GET["list_id_override"]; if (!$list_id_override) {$list_id_override=$_POST["list_id_override"];} + $list_id_override = (preg_replace("/\D/","",$list_id_override)); +$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];} +$ENVIAR=$_GET["ENVIAR"]; if (!$ENVIAR) {$ENVIAR=$_POST["ENVIAR"];} +if (isset($_GET["dupcheck"])) {$dupcheck=$_GET["dupcheck"];} + elseif (isset($_POST["dupcheck"])) {$dupcheck=$_POST["dupcheck"];} +if (isset($_GET["postalgmt"])) {$postalgmt=$_GET["postalgmt"];} + elseif (isset($_POST["postalgmt"])) {$postalgmt=$_POST["postalgmt"];} + + +#$DB=1; +#$DBX=1; + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); +$list_id_override = ereg_replace("[^0-9]","",$list_id_override); + + +$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://';} +$admDIR = "$HTTPprotocol$server_name$script_name"; +$admDIR = eregi_replace('listloader.php','',$admDIR); +$admSCR = 'admin.php'; +$NWB = "   \"AYUDA\""; + + +$secX = date("U"); +$hour = date("H"); +$min = date("i"); +$sec = date("s"); +$mon = date("m"); +$mday = date("d"); +$year = date("Y"); +$isdst = date("I"); +$Shour = date("H"); +$Smin = date("i"); +$Ssec = date("s"); +$Smon = date("m"); +$Smday = date("d"); +$Syear = date("Y"); +$pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; +$inSD = $pulldate0; +$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + ### Grab Server GMT value from the database + $stmt="SELECT local_gmt FROM servers where server_ip = '$server_ip';"; + $rslt=mysql_query($stmt, $link); + $gmt_recs = mysql_num_rows($rslt); + if ($gmt_recs > 0) + { + $row=mysql_fetch_row($rslt); + $DBSERVER_GMT = "$row[0]"; + if (strlen($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;} + if ($isdst) {$SERVER_GMT++;} + } + else + { + $SERVER_GMT = date("O"); + $SERVER_GMT = eregi_replace("\+","",$SERVER_GMT); + $SERVER_GMT = ($SERVER_GMT + 0); + $SERVER_GMT = ($SERVER_GMT / 100); + } + + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + +#if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";} + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + +?> + + + + + + method=post enctype="multipart/form-data"> +
+ + + + + + + + + + + + + + + + + + + + + +
Cargar Leads de este archivo:
ID De la Lista Override: (Solamente números or leave blank for values in the file)
Cheque Del Duplicado Del Plomo:
Operaciones de búsqueda De la Zona De Tiempo De Plomo:
CHASQUE AQUà PARA IR AL CARGADOR ESTUPENDO DEL PLOMO (BETA VERSIÓN)     DE NUEVO AL ADMIN
+ +document.forms[0].leadfile.disabled=true; document.forms[0].submit_file.disabled=true; document.forms[0].reload_page.disabled=true;"; + flush(); + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"); + $lead_file = "./vicidial_temp_file.txt"; + } + else + { + $lead_file = "$LF_path"; + } + $file=fopen("$lead_file", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + $pulldate=date("Y-m-d H:i:s"); + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + + if (count($field_check)>=5) { + flush(); + $file=fopen("$lead_file", "r"); + $total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list=''; + print "
Procesando$delim_name-delimited file... ($tab_count|$pipe_count)\n"; + + if (strlen($list_id_override)>0) + { + print "

ID DE LA LISTA OVERRIDE FOR THIS FILE: $list_id_override

"; + } + + while (!feof($file)) { + $record++; + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + + if (strlen($buffer)>0) { + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + $vendor_lead_code = $row[0]; + $source_code = $row[1]; + $source_id=$source_code; + $list_id = $row[2]; + $phone_code = eregi_replace("[^0-9]", "", $row[3]); + $phone_number = eregi_replace("[^0-9]", "", $row[4]); + $USarea = substr($phone_number, 0, 3); + $title = $row[5]; + $first_name = $row[6]; + $middle_initial = $row[7]; + $last_name = $row[8]; + $address1 = $row[9]; + $address2 = $row[10]; + $address3 = $row[11]; + $city = $row[12]; + $state = $row[13]; + $province = $row[14]; + $postal_code = $row[15]; + $country = $row[16]; + $gender = $row[17]; + $date_of_birth = $row[18]; + $alt_phone = eregi_replace("[^0-9]", "", $row[19]); + $email = $row[20]; + $security_phrase = $row[21]; + $comments = trim($row[22]); + + if (strlen($list_id_override)>0) + { + # print "

ID DE LA LISTA OVERRIDE FOR THIS FILE: $list_id_override

"; + $list_id = $list_id_override; + } + + ##### Check for duplicate phone numbers in vicidial_list table ##### + if (eregi("DUP",$dupcheck)) + { + $dup_lead=0; + $stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_lead = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + if ( (strlen($phone_number)>6) and ($dup_lead<1) ) + { + $US='_'; + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user = ""; + $gmt_offset = '0'; + $called_since_last_reset='N'; + $phone_list .= "$phone_number$US$list_id|"; + + if (strlen($phone_code)<1) {$phone_code = '1';} + + $postalgmt_found=0; + if ( (eregi("POSTAL",$postalgmt)) && (strlen($postal_code)>4) ) + { + if (preg_match('/^1$/', $phone_code)) + { + $stmt="select * from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[2]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[3]; + $dst_range = $row[4]; + $PC_processed++; + $postalgmt_found++; + $post++; + } + } + } + if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =='1') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### MEXICO ### + if ($phone_code =='52') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### AUSTRALIA ### + if ($phone_code =='61') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $PC_processed++; + $stmt="select * from vicidial_phone_codes where country_code='$phone_code';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + } + + ### Find out if DST to raise the gmt offset ### + $AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); + $AC_localtime = mktime(($Shour + $AC_GMT_diff), $Smin, $Ssec, $Smon, $Smday, $Syear); + $hour = date("H",$AC_localtime); + $min = date("i",$AC_localtime); + $sec = date("s",$AC_localtime); + $mon = date("m",$AC_localtime); + $mday = date("d",$AC_localtime); + $wday = date("w",$AC_localtime); + $year = date("Y",$AC_localtime); + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + if ( (!$AC_processed) and ($dst_range == 'SSM-FSN') ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + #********************************************************************** + # SSM-FSN + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on Second Sunday March to First Sunday November at 2 am. + # INPUTS: + # mm INTEGER Month. + # dd INTEGER Day of the month. + # ns INTEGER Seconds into the day. + # dow INTEGER Day of week (0=Sunday, to 6=Saturday) + # OPTIONAL INPUT: + # timezone INTEGER hour difference UTC - local standard time + # (DEFAULT is blank) + # make calculations based on UTC time, + # which means shift at 10:00 UTC in April + # and 9:00 UTC in October + # OUTPUT: + # INTEGER 1 = DST, 0 = not DST + # + # S M T W T F S + # 1 2 3 4 5 6 7 + # 8 9 10 11 12 13 14 + #15 16 17 18 19 20 21 + #22 23 24 25 26 27 28 + #29 30 31 + # + # S M T W T F S + # 1 2 3 4 5 6 + # 7 8 9 10 11 12 13 + #14 15 16 17 18 19 20 + #21 22 23 24 25 26 27 + #28 29 30 31 + # + #********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; + } elseif ($mm >= 4 and $mm <= 10) { + $USACAN_DST=1; + } elseif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; + } elseif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } + } else { + $USACAN_DST=0; + } + } elseif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; + } elseif ($dd < ($dow+1)) { + $USACAN_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } else { # tiempo local calculations + if ($ns < 7200) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } + } else { + $USACAN_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + #********************************************************************** + # FSA-LSO + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in April and last Sunday in October at 2 am. + #********************************************************************** + + $NA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $NA_DST=0; + } elseif ($mm >= 5 and $mm <= 9) { + $NA_DST=1; + } elseif ($mm == 4) { + if ($dd > 7) { + $NA_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $NA_DST=0; + } else { + $NA_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $NA_DST=0; + } else { + $NA_DST=1; + } + } + } else { + $NA_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $NA_DST=1; + } elseif ($dd < ($dow+25)) { + $NA_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $NA_DST=1; + } else { + $NA_DST=0; + } + } else { # tiempo local calculations + if ($ns < 7200) { + $NA_DST=1; + } else { + $NA_DST=0; + } + } + } else { + $NA_DST=0; + } + } # end of month checks + + if ($DBX) {print " DST: $NA_DST\n";} + if ($NA_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'LSM-LSO') ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in March and last Sunday in October at 1 am. + #********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; + } elseif ($mm >= 4 and $mm <= 9) { + $GBR_DST=1; + } elseif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; + } elseif ($dd < ($dow+25)) { + $GBR_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } else { # tiempo local calculations + if ($ns < 3600) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } + } else { + $GBR_DST=1; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; + } elseif ($dd < ($dow+25)) { + $GBR_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } else { # tiempo local calculations + if ($ns < 3600) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } + } else { + $GBR_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) and ($dst_range == 'LSO-LSM') ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUS_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; + } elseif ($dd < ($dow+25)) { + $AUS_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } else { # tiempo local calculations + if ($ns < 3600) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } + } else { + $AUS_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; + } elseif ($dd < ($dow+25)) { + $AUS_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } else { # tiempo local calculations + if ($ns < 3600) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } + } else { + $AUS_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-LSM') ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + #********************************************************************** + # TASMANIA ONLY + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUST_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; + } elseif ($dd < ($dow+25)) { + $AUST_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } else { # tiempo local calculations + if ($ns < 3600) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } + } else { + $AUST_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $AUST_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } + } else { + $AUST_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and third Sunday in March at 1 am. + #********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $NZL_DST=0; + } elseif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; + } elseif ($dd < ($dow+14)) { + $NZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } else { # tiempo local calculations + if ($ns < 3600) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } + } else { + $NZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $NZL_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } + } else { + $NZL_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + #********************************************************************** + # TSO-LSF + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. Brazil + # Based on Third Sunday October to Last Sunday February at 1 am. + #********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; + } elseif ($mm >= 3 and $mm <= 9) { + $BZL_DST=0; + } elseif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; + } elseif ($dd < ($dow+22)) { + $BZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } else { # tiempo local calculations + if ($ns < 3600) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } + } else { + $BZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; + } elseif ($dd < ($dow+22)) { + $BZL_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } else { # tiempo local calculations + if ($ns < 3600) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } + } else { + $BZL_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } + else + { + if ($bad < 10) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead\n";} + $bad++; + } + $total++; + if ($total%100==0) + { + print ""; + usleep(1000); + flush(); + } + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
DUPLICATE: $dup       POSTAL MATCH: $post
"; + + } else { + print "
ERROR: El archivo no tiene el número requerido de los campos para procesarlo.
"; + } + print ""; +} else if (filesize($leadfile)>8388608) { + print "
ERROR: El archivo excede el límite 8MB.
"; +} +?> + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/listloader.pl b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/listloader.pl new file mode 100644 index 00000000..d926368b --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/listloader.pl @@ -0,0 +1,1084 @@ +#!/usr/bin/perl + +### listloader.pl version 0.4 *DBI-version* +### +### Copyright (C) 2007 Matt Florell,Joe Johnson LICENSE: GPLv2 +### +# +# +# CHANGES +# 60616-1548 - Added listID override feature to force all leads into same list +# - Added gmt_offset_now lookup for each lead +# 60811-1232 - Changed to DBI +# 60811-1329 - changed to use /etc/astguiclient.conf for configs +# 60822-1121 - fixed for nonwritable directories +# 60906-1058 - added filter of non-digits in alt_phone field +# 61110-1229 - added new USA-Canada DST scheme and Brazil DST scheme +# 61128-1215 - added postal code GMT lookup and duplicate check options +# 70205-1703 - Defaulted phone_code to 1 if not populated +# 70417-1059 - Fixed default phone_code bug +# 70510-1518 - Added campaign and system duplicate check and phonecode override +# + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help|-h/i) + { + print "allowed run time options:\n [-forcelistid=1234] = overrides the listID given in the file with the 1234\n [-h] = this help screen\n\n"; + + exit; + } + else + { + if ($args =~ /-duplicate-check/i) + {$dupcheck=1;} + if ($args =~ /-duplicate-campaign-check/i) + {$dupcheckcamp=1;} + if ($args =~ /-duplicate-system-check/i) + {$dupchecksys=1;} + if ($args =~ /-postal-code-gmt/i) + {$postalgmt=1;} + if ($args =~ /--forcelistid=/i) + { + @data_in = split(/--forcelistid=/,$args); + $forcelistid = $data_in[1]; + $forcelistid =~ s/ .*//gi; + print "\n----- FORCE LISTID OVERRIDE: $forcelistid -----\n\n"; + } + else + {$forcelistid = '';} + + if ($args =~ /--forcephonecode=/i) + { + @data_in = split(/--forcephonecode=/,$args); + $forcephonecode = $data_in[1]; + $forcephonecode =~ s/ .*//gi; + print "\n----- FORCE PHONECODE OVERRIDE: $forcephonecode -----\n\n"; + } + else + {$forcephonecode = '';} + + if ($args =~ /--lead-file=/i) + { + @data_in = split(/--lead-file=/,$args); + $lead_file = $data_in[1]; + $lead_file =~ s/ .*//gi; + # print "\n----- LEAD FILE: $lead_file -----\n\n"; + } + else + {$lead_file = './vicidial_temp_file.xls';} + } +} +### end parsing run-time options ### + + +use Spreadsheet::ParseExcel; +use Time::Local; +use DBI; + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + +$|=0; +$secX = time(); + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($hour < 10) {$hour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +$pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; +$pulldate="$year-$mon-$mday $hour:$min:$sec"; +$inSD = $pulldate0; +$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + + ### Grab Server values from the database + $stmtA = "SELECT local_gmt FROM servers where server_ip = '$server_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBSERVER_GMT = "$aryA[0]"; + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + $rec_count++; + } + $sthA->finish(); + + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + +if ($isdst) {$LOCAL_GMT_OFF++;} +if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";} + + + +$total=0; $good=0; $bad=0; +print "
Processing Excel file...\n"; +open(STMT_FILE, "> $PATHlogs/listloader_stmts.txt"); + +$oBook = Spreadsheet::ParseExcel::Workbook->Parse("$lead_file"); +my($iR, $iC, $oWkS, $oWkC); + +foreach $oWkS (@{$oBook->{Worksheet}}) { + for($iR = 0 ; defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow} ; $iR++) { + + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user = ""; + $oWkC = $oWkS->{Cells}[$iR][0]; + if ($oWkC) {$vendor_lead_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][1]; + if ($oWkC) {$source_code=$oWkC->Value; } + $source_id=$source_code; + $oWkC = $oWkS->{Cells}[$iR][2]; + if ($oWkC) {$list_id=$oWkC->Value; } + $gmt_offset = '0'; + $called_since_last_reset='N'; + $oWkC = $oWkS->{Cells}[$iR][3]; + if ($oWkC) {$phone_code=$oWkC->Value; } + $phone_code=~s/[^0-9]//g; + $oWkC = $oWkS->{Cells}[$iR][4]; + if ($oWkC) {$phone_number=$oWkC->Value; } + $phone_number=~s/[^0-9]//g; + $USarea = substr($phone_number, 0, 3); + $oWkC = $oWkS->{Cells}[$iR][5]; + if ($oWkC) {$title=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][6]; + if ($oWkC) {$first_name=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][7]; + if ($oWkC) {$middle_initial=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][8]; + if ($oWkC) {$last_name=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][9]; + if ($oWkC) {$address1=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][10]; + if ($oWkC) {$address2=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][11]; + if ($oWkC) {$address3=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][12]; + if ($oWkC) {$city=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][13]; + if ($oWkC) {$state=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][14]; + if ($oWkC) {$province=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][15]; + if ($oWkC) {$postal_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][16]; + if ($oWkC) {$country=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][17]; + if ($oWkC) {$gender=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][18]; + if ($oWkC) {$date_of_birth=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][19]; + if ($oWkC) {$alt_phone=$oWkC->Value; } + $alt_phone=~s/[^0-9]//g; + $oWkC = $oWkS->{Cells}[$iR][20]; + if ($oWkC) {$email=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][21]; + if ($oWkC) {$security_phrase=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][22]; + if ($oWkC) {$comments=$oWkC->Value; } + $comments=~s/^\s*(.*?)\s*$/$1/; + + if (length($forcelistid) > 0) + { + $list_id = $forcelistid; # set list_id to override value + } + if (length($forcephonecode) > 0) + { + $phone_code = $forcephonecode; # set phone_code to override value + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if ($dupchecksys > 0) + { + $dup_lead=0; + $stmtA = "select count(*) from vicidial_list where phone_number='$phone_number';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $dup_lead = $aryA[0]; + $dup_lead_list=$list_id; + } + $sthA->finish(); + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if ($dupcheck > 0) + { + $dup_lead=0; + $stmtA = "select list_id from vicidial_list where phone_number='$phone_number' and list_id='$list_id' limit 1;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $dup_lead_list = $aryA[0]; + $dup_lead++; + } + $sthA->finish(); + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if ($dupcheckcamp > 0) + { + $dup_lead=0; + $dup_lists=''; + + $stmtA = "select count(*) from vicidial_lists where list_id='$list_id';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + @aryA = $sthA->fetchrow_array; + $ci_recs = $aryA[0]; + $sthA->finish(); + if ($ci_recs > 0) + { + $stmtA = "select campaign_id from vicidial_lists where list_id='$list_id';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + @aryA = $sthA->fetchrow_array; + $dup_camp = $aryA[0]; + $sthA->finish(); + + $stmtA = "select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $dup_lists .= "'$aryA[0]',"; + $rec_count++; + } + $sthA->finish(); + + chop($dup_lists); + $stmtA = "select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $dup_lead_list = "'$aryA[0]',"; + $rec_count++; + $dup_lead=1; + } + $sthA->finish(); + } + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + + if ( (length($phone_number)>6) && ($dup_lead < 1) ) + { + $phone_list .= "$phone_number$US$list_id|"; + $postalgmt_found=0; + if (length($phone_code)<1) {$phone_code = '1';} + + if ( ($postalgmt > 0) && (length($postal_code)>4) ) + { + if ($phone_code =~ /^1$/) + { + $stmtA = "select * from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[2]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[3]; + $dst_range = $aryA[4]; + $PC_processed++; + $rec_count++; + $postalgmt_found++; + if ($DBX) {print " Postal GMT record found for $postal_code: |$gmt_offset|$dst|$dst_range|\n";} + } + $sthA->finish(); + } + } + if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =~ /^1$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### MEXICO ### + if ($phone_code =~ /^52$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### AUSTRALIA ### + if ($phone_code =~ /^61$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + } + + ### Find out if DST to raise the gmt offset ### + $AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); + $AC_localtime = ($secX + (3600 * $AC_GMT_diff)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($AC_localtime); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + + if ( (!$AC_processed) && ($dst_range =~ /SSM-FSN/) ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + &USACAN_dstcalc; + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSA-LSO/) ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + &NA_dstcalc; + if ($DBX) {print " DST: $NA_DST\n";} + if ($NA_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /LSM-LSO/) ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + &GBR_dstcalc; + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /LSO-LSM/) ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + &AUS_dstcalc; + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSO-LSM/) ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + &AUST_dstcalc; + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSO-TSM/) ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + &NZL_dstcalc; + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /TSO-LSF/) ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + &BZL_dstcalc; + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$area_GMT++;} + $AC_processed++; + } + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $affected_rows = $dbhA->do($stmtZ); + print STMT_FILE $stmtZ."\r\n"; + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| $dup_lead_list\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + sleep(1); +# flush(); + } + } +} + +if ($multi_insert_counter > 0) { + $stmtZ = "INSERT INTO vicidial_list values ".substr($multistmt, 0, -1).";"; + $affected_rows = $dbhA->do($stmtZ); + print STMT_FILE $stmtZ."\r\n"; +} + +print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + +exit; + + + + + + +sub USACAN_dstcalc { +#********************************************************************** +# SSM-FSN +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on Second Sunday March to First Sunday November at 2 am. +# INPUTS: +# mm INTEGER Month. +# dd INTEGER Day of the month. +# ns INTEGER Seconds into the day. +# dow INTEGER Day of week (0=Sunday, to 6=Saturday) +# OPTIONAL INPUT: +# timezone INTEGER hour difference UTC - local standard time +# (DEFAULT is blank) +# make calculations based on UTC time, +# which means shift at 10:00 UTC in April +# and 9:00 UTC in October +# OUTPUT: +# INTEGER 1 = DST, 0 = not DST +# +# S M T W T F S +# 1 2 3 4 5 6 7 +# 8 9 10 11 12 13 14 +#15 16 17 18 19 20 21 +#22 23 24 25 26 27 28 +#29 30 31 +# +# S M T W T F S +# 1 2 3 4 5 6 +# 7 8 9 10 11 12 13 +#14 15 16 17 18 19 20 +#21 22 23 24 25 26 27 +#28 29 30 31 +# +#********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; return 0; + } elsif ($mm >= 4 && $mm <= 10) { + $USACAN_DST=1; return 1; + } elsif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; return 1; + } elsif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; return 0; + } else { + $USACAN_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $USACAN_DST=0; return 0; + } else { + $USACAN_DST=1; return 1; + } + } + } else { + $USACAN_DST=0; return 0; + } + } elsif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; return 0; + } elsif ($dd < ($dow+1)) { + $USACAN_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; return 1; + } else { + $USACAN_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; return 1; + } else { + $USACAN_DST=0; return 0; + } + } + } else { + $USACAN_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub NA_dstcalc { +#********************************************************************** +# FSA-LSO +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in April and last Sunday in October at 2 am. +#********************************************************************** + + $NA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $NA_DST=0; return 0; + } elsif ($mm >= 5 && $mm <= 9) { + $NA_DST=1; return 1; + } elsif ($mm == 4) { + if ($dd > 7) { + $NA_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $NA_DST=0; return 0; + } else { + $NA_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $NA_DST=0; return 0; + } else { + $NA_DST=1; return 1; + } + } + } else { + $NA_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $NA_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $NA_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $NA_DST=1; return 1; + } else { + $NA_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 7200) { + $NA_DST=1; return 1; + } else { + $NA_DST=0; return 0; + } + } + } else { + $NA_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub GBR_dstcalc { +#********************************************************************** +# LSM-LSO +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in March and last Sunday in October at 1 am. +#********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; return 0; + } elsif ($mm >= 4 && $mm <= 9) { + $GBR_DST=1; return 1; + } elsif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $GBR_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; return 0; + } else { + $GBR_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; return 0; + } else { + $GBR_DST=1; return 1; + } + } + } else { + $GBR_DST=1; return 1; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $GBR_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; return 1; + } else { + $GBR_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; return 1; + } else { + $GBR_DST=0; return 0; + } + } + } else { + $GBR_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub AUS_dstcalc { +#********************************************************************** +# LSO-LSM +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in October and last Sunday in March at 1 am. +#********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $AUS_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $AUS_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; return 1; + } else { + $AUS_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; return 1; + } else { + $AUS_DST=0; return 0; + } + } + } else { + $AUS_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $AUS_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; return 0; + } else { + $AUS_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; return 0; + } else { + $AUS_DST=1; return 1; + } + } + } else { + $AUS_DST=1; return 1; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub AUST_dstcalc { +#********************************************************************** +# FSO-LSM +# TASMANIA ONLY +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and last Sunday in March at 1 am. +#********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $AUST_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $AUST_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; return 1; + } else { + $AUST_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; return 1; + } else { + $AUST_DST=0; return 0; + } + } + } else { + $AUST_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd >= 8) { + $AUST_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $AUST_DST=0; return 0; + } else { + $AUST_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $AUST_DST=0; return 0; + } else { + $AUST_DST=1; return 1; + } + } + } else { + $AUST_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub NZL_dstcalc { +#********************************************************************** +# FSO-TSM +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and third Sunday in March at 1 am. +#********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $NZL_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; return 1; + } elsif ($dd < ($dow+14)) { + $NZL_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; return 1; + } else { + $NZL_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; return 1; + } else { + $NZL_DST=0; return 0; + } + } + } else { + $NZL_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd >= 8) { + $NZL_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $NZL_DST=0; return 0; + } else { + $NZL_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $NZL_DST=0; return 0; + } else { + $NZL_DST=1; return 1; + } + } + } else { + $NZL_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub BZL_dstcalc { +#********************************************************************** +# TSO-LSF +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. Brazil +# Based on Third Sunday October to Last Sunday February at 1 am. +#********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; return 1; + } elsif ($mm >= 3 && $mm <= 9) { + $BZL_DST=0; return 0; + } elsif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; return 1; + } elsif ($dd < ($dow+22)) { + $BZL_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; return 1; + } else { + $BZL_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; return 1; + } else { + $BZL_DST=0; return 0; + } + } + } else { + $BZL_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; return 0; + } elsif ($dd < ($dow+22)) { + $BZL_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; return 0; + } else { + $BZL_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; return 0; + } else { + $BZL_DST=1; return 1; + } + } + } else { + $BZL_DST=1; return 1; + } + } # end of month checks +} # end of subroutine dstcalc diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/listloaderMAIN.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/listloaderMAIN.php new file mode 100644 index 00000000..ab67fd40 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/listloaderMAIN.php @@ -0,0 +1,86 @@ + LICENSE: GPLv2 +# +# this is the main frame page for the lead loading section. This is where you +# would upload a file and have it inserted into vicidial_list +# +# changes: +# 60620-1149 - Added variable filtering to eliminate SQL injection attack threat +# 60822-1105 - fixed for nonwritable directories +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_datetime = $STARTtime; + +$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +if ($WeBRooTWritablE > 0) {$fp = fopen ("./project_auth_entries.txt", "a");} +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-LEAD-LOADER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT load_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGload_leads =$row[0]; + + if ($LOGload_leads < 1) + { + echo "You do not have permissions to load leads\n"; + exit; + } + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "LIST_LOAD|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "LIST_LOAD|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +?> + +VICIDIAL: Módulo Cargador de Leads + + + + + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/listloader_rowdisplay.pl b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/listloader_rowdisplay.pl new file mode 100644 index 00000000..3f8695c0 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/listloader_rowdisplay.pl @@ -0,0 +1,153 @@ +#!/usr/bin/perl + +### listloader_rowdisplay.pl version 0.2 *DBI-version* +### +### Copyright (C) 2006 Matt Florell,Joe Johnson LICENSE: GPLv2 +### +# +# CHANGES +# +# 60811-1232 - Changed to DBI +# 60811-1329 - changed to use /etc/astguiclient.conf for configs +# + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help|-h/i) + { + print "allowed run time options:\n [-forcelistid=1234] = overrides the listID given in the file with the 1234\n [-h] = this help screen\n\n"; + + exit; + } + else + { + if ($args =~ /-duplicate-check/i) + {$dupcheck=1;} + if ($args =~ /-postal-code-gmt/i) + {$postalgmt=1;} + if ($args =~ /--lead-file=/i) + { + @data_in = split(/--lead-file=/,$args); + $lead_file = $data_in[1]; + $lead_file =~ s/ .*//gi; + # print "\n----- LEAD FILE: $lead_file -----\n\n"; + } + else + {$lead_file = './vicidial_temp_file.xls';} + } +} +### end parsing run-time options ### + +use Spreadsheet::ParseExcel; +use Time::Local; +use DBI; + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + +$oBook = Spreadsheet::ParseExcel::Workbook->Parse("$lead_file"); +my($iR, $iC, $oWkS, $oWkC); +$var_str=""; + +foreach $oWkS (@{$oBook->{Worksheet}}) { + for(my $iC = $oWkS->{MinCol} ; defined $oWkS->{MaxCol} && $iC <= $oWkS->{MaxCol} ; $iC++) { + $oWkC = $oWkS->{Cells}[0][$iC]; + if ($oWkC) { + $var_str.=$oWkC->Value."|"; + } else { + $var_str.="|"; + } + } +} + +@xls_row=split(/\|/, $var_str); + + +$stmtA = "select vendor_lead_code, source_id, list_id, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments from vicidial_list limit 1;"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + my $names = $sthA->{'NAME'}; + my $numFields = $sthA->{'NUM_OF_FIELDS'}; + for (my $i = 0; $i < $numFields; $i++) + { + # printf("%s%s", $i ? "," : "", $$names[$i]); + # printf("%s%s", $i ? "," : "", $$ref[$i]); + + $field_name=uc($$names[$i]); + $field_name=~s/\_/ /g; + print "
".$field_name.": \r\n"; + print " \r\n"; + print "
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Cargar Leads de este archivo:
ID De la Lista Override: (Solamente números or leave blank for values in the file)
Phone Code Override: (Solamente números or leave blank for values in the file)
Disposición de archivo a utilizar:VICIDIAL Estándar    Disposición de encargo
Cheque Del Duplicado Del Plomo:
Operaciones de búsqueda De la Zona De Tiempo De Plomo:
        
        DE NUEVO AL ADMINLIST LOADER-     VERSIÓN:     CONSTRUCCION:    
+ + +document.forms[0].leadfile.disabled=true;document.forms[0].list_id_override.disabled=true;document.forms[0].phone_code_override.disabled=true; document.forms[0].submit_file.disabled=true; document.forms[0].reload_page.disabled=true;"; + flush(); + $total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list=''; + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) { + # copy($leadfile, "./vicidial_temp_file.txt"); + $file=fopen("$lead_file", "r"); + if ($WeBRooTWritablE > 0) + { + $stmt_file=fopen("listloader_stmts.txt", "w"); + } + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + + if (count($field_check)>=5) { + flush(); + $file=fopen("$lead_file", "r"); + print "
Procesando$delim_name-delimited file...\n"; + + if (strlen($list_id_override)>0) + { + print "

ID DE LA LISTA OVERRIDE FOR THIS FILE: $list_id_override

"; + } + + if (strlen($phone_code_override)>0) + { + print "

INVALIDACIÓN DEL CÓDIGO DEL TELÉFONO PARA ESTE ARCHIVO: $phone_code_override

"; + } + + while (!feof($file)) { + $record++; + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + + if (strlen($buffer)>0) { + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[$vendor_lead_code_field]; + $source_code = $row[$source_id_field]; + $source_id=$source_code; + $list_id = $row[$list_id_field]; + $gmt_offset = '0'; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[$phone_code_field]); + $phone_number = eregi_replace("[^0-9]", "", $row[$phone_number_field]); + $USarea = substr($phone_number, 0, 3); + $title = $row[$title_field]; + $first_name = $row[$first_name_field]; + $middle_initial = $row[$middle_initial_field]; + $last_name = $row[$last_name_field]; + $address1 = $row[$address1_field]; + $address2 = $row[$address2_field]; + $address3 = $row[$address3_field]; + $city =$row[$city_field]; + $state = $row[$state_field]; + $province = $row[$province_field]; + $postal_code = $row[$postal_code_field]; + $country_code = $row[$country_code_field]; + $gender = $row[$gender_field]; + $date_of_birth = $row[$date_of_birth_field]; + $alt_phone = eregi_replace("[^0-9]", "", $row[$alt_phone_field]); + $email = $row[$email_field]; + $security_phrase = $row[$security_phrase_field]; + $comments = trim($row[$comments_field]); + + if (strlen($list_id_override)>0) + { + # print "

ID DE LA LISTA OVERRIDE FOR THIS FILE: $list_id_override

"; + $list_id = $list_id_override; + } + if (strlen($phone_code_override)>0) + { + $phone_code = $phone_code_override; + } + + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if (eregi("DUPCAMP",$dupcheck)) + { + $dup_lead=0; + $dup_lists=''; + $stmt="select campaign_id from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $ci_recs = mysql_num_rows($rslt); + if ($ci_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_camp = $row[0]; + + $stmt="select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $rslt=mysql_query($stmt, $link); + $li_recs = mysql_num_rows($rslt); + if ($li_recs > 0) + { + $L=0; + while ($li_recs > $L) + { + $row=mysql_fetch_row($rslt); + $dup_lists .= "'$row[0]',"; + $L++; + } + $dup_lists = eregi_replace(",$",'',$dup_lists); + + $stmt="select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + } + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if (eregi("DUPSYS",$dupcheck)) + { + $dup_lead=0; + $stmt="select list_id from vicidial_list where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if (eregi("DUPLIST",$dupcheck)) + { + $dup_lead=0; + $stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_lead = $row[0]; + $dup_lead_list = $list_id; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + if ( (strlen($phone_number)>6) and ($dup_lead<1) ) + { + if (strlen($phone_code)<1) {$phone_code = '1';} + + $US='_'; + $phone_list .= "$phone_number$US$list_id|"; + + $gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code); + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead $dup_lead_list\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } else { + print "
ERROR: El archivo no tiene el número requerido de los campos para procesarlo.
"; + } + } else if (!eregi(".csv", $leadfile_name)) { + # copy($leadfile, "./vicidial_temp_file.xls"); + $file=fopen("$lead_file", "r"); + + print "
ProcesandoExcel file... \n"; + if (strlen($list_id_override)>0) + { + print "

ID DE LA LISTA OVERRIDE FOR THIS FILE: $list_id_override

\n"; + } + if (strlen($phone_code_override)>0) + { + print "

INVALIDACIÓN DEL CÓDIGO DEL TELÉFONO PARA ESTE ARCHIVO: $phone_code_override

\n"; + } + # print "|$WeBServeRRooT/vicidial/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field, --forcelistid=$list_id_override --lead_file=$lead_file|"; + $dupcheckCLI=''; $postalgmtCLI=''; + if (eregi("DUPLIST",$dupcheck)) {$dupcheckCLI='--duplicate-check';} + if (eregi("DUPCAMP",$dupcheck)) {$dupcheckCLI='--duplicate-campaign-check';} + if (eregi("DUPSYS",$dupcheck)) {$dupcheckCLI='--duplicate-system-check';} + if (eregi("POSTAL",$postalgmt)) {$postalgmtCLI='--postal-code-gmt';} + passthru("$WeBServeRRooT/vicidial/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field, --forcelistid=$list_id_override --forcephonecode=$phone_code_override --lead-file=$lead_file $postalgmtCLI $dupcheckCLI"); + } else { + # copy($leadfile, "./vicidial_temp_file.csv"); + $file=fopen("$lead_file", "r"); + + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + print "
ProcesandoCSV file... \n"; + if (strlen($list_id_override)>0) + { + print "

ID DE LA LISTA OVERRIDE FOR THIS FILE: $list_id_override

"; + } + + if (strlen($phone_code_override)>0) + { + print "

INVALIDACIÓN DEL CÓDIGO DEL TELÉFONO PARA ESTE ARCHIVO: $phone_code_override

"; + } + + while($row=fgetcsv($file, 1000, ",")) { + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[$vendor_lead_code_field]; + $source_code = $row[$source_id_field]; + $source_id=$source_code; + $list_id = $row[$list_id_field]; + $gmt_offset = '0'; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[$phone_code_field]); + $phone_number = eregi_replace("[^0-9]", "", $row[$phone_number_field]); + $USarea = substr($phone_number, 0, 3); + $title = $row[$title_field]; + $first_name = $row[$first_name_field]; + $middle_initial = $row[$middle_initial_field]; + $last_name = $row[$last_name_field]; + $address1 = $row[$address1_field]; + $address2 = $row[$address2_field]; + $address3 = $row[$address3_field]; + $city =$row[$city_field]; + $state = $row[$state_field]; + $province = $row[$province_field]; + $postal_code = $row[$postal_code_field]; + $country_code = $row[$country_code_field]; + $gender = $row[$gender_field]; + $date_of_birth = $row[$date_of_birth_field]; + $alt_phone = eregi_replace("[^0-9]", "", $row[$alt_phone_field]); + $email = $row[$email_field]; + $security_phrase = $row[$security_phrase_field]; + $comments = trim($row[$comments_field]); + + if (strlen($list_id_override)>0) + { + $list_id = $list_id_override; + } + if (strlen($phone_code_override)>0) + { + $phone_code = $phone_code_override; + } + + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if (eregi("DUPCAMP",$dupcheck)) + { + $dup_lead=0; + $dup_lists=''; + $stmt="select campaign_id from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $ci_recs = mysql_num_rows($rslt); + if ($ci_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_camp = $row[0]; + + $stmt="select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $rslt=mysql_query($stmt, $link); + $li_recs = mysql_num_rows($rslt); + if ($li_recs > 0) + { + $L=0; + while ($li_recs > $L) + { + $row=mysql_fetch_row($rslt); + $dup_lists .= "'$row[0]',"; + $L++; + } + $dup_lists = eregi_replace(",$",'',$dup_lists); + + $stmt="select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + } + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if (eregi("DUPSYS",$dupcheck)) + { + $dup_lead=0; + $stmt="select list_id from vicidial_list where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if (eregi("DUPLIST",$dupcheck)) + { + $dup_lead=0; + $stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_lead = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + if ( (strlen($phone_number)>6) and ($dup_lead<1) ) + { + if (strlen($phone_code)<1) {$phone_code = '1';} + + $US='_'; + $phone_list .= "$phone_number$US$list_id|"; + + $gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code); + + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + } + print ""; + } + +if ($leadfile && filesize($LF_path)<=8388608) { + $total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list=''; + if ($file_layout=="standard") { + + print ""; + flush(); + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) { + + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"); + $lead_file = "./vicidial_temp_file.txt"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.txt"); + $lead_file = "/tmp/vicidial_temp_file.txt"; + } + $file=fopen("$lead_file", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + + if (count($field_check)>=5) { + flush(); + $file=fopen("$lead_file", "r"); + $total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list=''; + print "
Procesando$delim_name-delimited file... ($tab_count|$pipe_count)\n"; + if (strlen($list_id_override)>0) + { + print "

ID DE LA LISTA OVERRIDE FOR THIS FILE: $list_id_override

"; + } + if (strlen($phone_code_override)>0) + { + print "

INVALIDACIÓN DEL CÓDIGO DEL TELÉFONO PARA ESTE ARCHIVO: $phone_code_override

\n"; + } + while (!feof($file)) { + $record++; + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + + if (strlen($buffer)>0) { + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[0]; + $source_code = $row[1]; + $source_id=$source_code; + $list_id = $row[2]; + $gmt_offset = '0'; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[3]); + $phone_number = eregi_replace("[^0-9]", "", $row[4]); + $USarea = substr($phone_number, 0, 3); + $title = $row[5]; + $first_name = $row[6]; + $middle_initial = $row[7]; + $last_name = $row[8]; + $address1 = $row[9]; + $address2 = $row[10]; + $address3 = $row[11]; + $city =$row[12]; + $state = $row[13]; + $province = $row[14]; + $postal_code = $row[15]; + $country_code = $row[16]; + $gender = $row[17]; + $date_of_birth = $row[18]; + $alt_phone = eregi_replace("[^0-9]", "", $row[19]); + $email = $row[20]; + $security_phrase = $row[21]; + $comments = trim($row[22]); + + if (strlen($list_id_override)>0) + { + $list_id = $list_id_override; + } + if (strlen($phone_code_override)>0) + { + $phone_code = $phone_code_override; + } + + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if (eregi("DUPCAMP",$dupcheck)) + { + $dup_lead=0; + $dup_lists=''; + $stmt="select campaign_id from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $ci_recs = mysql_num_rows($rslt); + if ($ci_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_camp = $row[0]; + + $stmt="select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $rslt=mysql_query($stmt, $link); + $li_recs = mysql_num_rows($rslt); + if ($li_recs > 0) + { + $L=0; + while ($li_recs > $L) + { + $row=mysql_fetch_row($rslt); + $dup_lists .= "'$row[0]',"; + $L++; + } + $dup_lists = eregi_replace(",$",'',$dup_lists); + + $stmt="select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + } + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if (eregi("DUPSYS",$dupcheck)) + { + $dup_lead=0; + $stmt="select list_id from vicidial_list where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if (eregi("DUPLIST",$dupcheck)) + { + $dup_lead=0; + $stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_lead = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + if ( (strlen($phone_number)>6) and ($dup_lead<1) ) + { + if (strlen($phone_code)<1) {$phone_code = '1';} + + $US='_'; + $phone_list .= "$phone_number$US$list_id|"; + + $gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code); + + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } else { + print "
ERROR: El archivo no tiene el número requerido de los campos para procesarlo.
"; + } + } else if (!eregi(".csv", $leadfile_name)) + { + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"); + $lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.xls"); + $lead_file = "/tmp/vicidial_temp_file.xls"; + } + $file=fopen("$lead_file", "r"); + + # echo "|$WeBServeRRooT/vicidial/listloader.pl --forcelistid=$list_id_override --lead-file=$lead_file|"; + $dupcheckCLI=''; $postalgmtCLI=''; + if (eregi("DUPLIST",$dupcheck)) {$dupcheckCLI='--duplicate-check';} + if (eregi("DUPCAMP",$dupcheck)) {$dupcheckCLI='--duplicate-campaign-check';} + if (eregi("DUPSYS",$dupcheck)) {$dupcheckCLI='--duplicate-system-check';} + if (eregi("POSTAL",$postalgmt)) {$postalgmtCLI='--postal-code-gmt';} + passthru("$WeBServeRRooT/vicidial/listloader.pl --forcelistid=$list_id_override --forcephonecode=$phone_code_override --lead-file=$lead_file $postalgmtCLI $dupcheckCLI"); + + } + else + { + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"); + $lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.csv"); + $lead_file = "/tmp/vicidial_temp_file.csv"; + } + $file=fopen("$lead_file", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + print "
ProcesandoCSV file... \n"; + + if (strlen($list_id_override)>0) + { + print "

ID DE LA LISTA OVERRIDE FOR THIS FILE: $list_id_override

"; + } + if (strlen($phone_code_override)>0) + { + print "

INVALIDACIÓN DEL CÓDIGO DEL TELÉFONO PARA ESTE ARCHIVO: $phone_code_override

"; + } + + while($row=fgetcsv($file, 1000, ",")) { + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[0]; + $source_code = $row[1]; + $source_id=$source_code; + $list_id = $row[2]; + $gmt_offset = '0'; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[3]); + $phone_number = eregi_replace("[^0-9]", "", $row[4]); + $USarea = substr($phone_number, 0, 3); + $title = $row[5]; + $first_name = $row[6]; + $middle_initial = $row[7]; + $last_name = $row[8]; + $address1 = $row[9]; + $address2 = $row[10]; + $address3 = $row[11]; + $city =$row[12]; + $state = $row[13]; + $province = $row[14]; + $postal_code = $row[15]; + $country_code = $row[16]; + $gender = $row[17]; + $date_of_birth = $row[18]; + $alt_phone = eregi_replace("[^0-9]", "", $row[19]); + $email = $row[20]; + $security_phrase = $row[21]; + $comments = trim($row[22]); + + if (strlen($list_id_override)>0) + { + $list_id = $list_id_override; + } + if (strlen($phone_code_override)>0) + { + $phone_code = $phone_code_override; + } + + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if (eregi("DUPCAMP",$dupcheck)) + { + $dup_lead=0; + $dup_lists=''; + $stmt="select campaign_id from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $ci_recs = mysql_num_rows($rslt); + if ($ci_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_camp = $row[0]; + + $stmt="select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $rslt=mysql_query($stmt, $link); + $li_recs = mysql_num_rows($rslt); + if ($li_recs > 0) + { + $L=0; + while ($li_recs > $L) + { + $row=mysql_fetch_row($rslt); + $dup_lists .= "'$row[0]',"; + $L++; + } + $dup_lists = eregi_replace(",$",'',$dup_lists); + + $stmt="select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + } + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if (eregi("DUPSYS",$dupcheck)) + { + $dup_lead=0; + $stmt="select list_id from vicidial_list where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if (eregi("DUPLIST",$dupcheck)) + { + $dup_lead=0; + $stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_lead = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + if ( (strlen($phone_number)>6) and ($dup_lead<1) ) + { + if (strlen($phone_code)<1) {$phone_code = '1';} + + $US='_'; + $phone_list .= "$phone_number$US$list_id|"; + + $gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code); + + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } + print ""; + + } else { + print "
"; + flush(); + print "\r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + + $rslt=mysql_query("select vendor_lead_code, source_id, list_id, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments from vicidial_list limit 1", $link); + + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) + { + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"); + $lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.txt"); + $lead_file = "/tmp/vicidial_temp_file.txt"; + } + $file=fopen("$lead_file", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + flush(); + $file=fopen("$lead_file", "r"); + print "
Procesando$delim_name-delimited file...\n"; + + if (strlen($list_id_override)>0) + { + print "

ID DE LA LISTA OVERRIDE FOR THIS FILE: $list_id_override

"; + } + if (strlen($phone_code_override)>0) + { + print "

INVALIDACIÓN DEL CÓDIGO DEL TELÉFONO PARA ESTE ARCHIVO: $phone_code_override

"; + } + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + for ($i=0; $i\r\n"; + print "
\r\n"; + print " \r\n"; + print " \r\n"; + + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + } + } + else if (!eregi(".csv", $leadfile_name)) + { + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"); + $lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.xls"); + $lead_file = "/tmp/vicidial_temp_file.xls"; + } + + # echo "|$WeBServeRRooT/vicidial/listloader_rowdisplay.pl --lead-file=$lead_file|"; + $dupcheckCLI=''; $postalgmtCLI=''; + if (eregi("DUPLIST",$dupcheck)) {$dupcheckCLI='--duplicate-check';} + if (eregi("DUPCAMP",$dupcheck)) {$dupcheckCLI='--duplicate-campaign-check';} + if (eregi("DUPSYS",$dupcheck)) {$dupcheckCLI='--duplicate-system-check';} + if (eregi("POSTAL",$postalgmt)) {$postalgmtCLI='--postal-code-gmt';} + passthru("$WeBServeRRooT/vicidial/listloader_rowdisplay.pl --lead-file=$lead_file $postalgmtCLI $dupcheckCLI"); + } + else + { + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"); + $lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.csv"); + $lead_file = "/tmp/vicidial_temp_file.csv"; + } + $file=fopen("$lead_file", "r"); + + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + print "
ProcesandoCSV file... \n"; + + if (strlen($list_id_override)>0) + { + print "

ID DE LA LISTA OVERRIDE FOR THIS FILE: $list_id_override

"; + } + if (strlen($phone_code_override)>0) + { + print "

INVALIDACIÓN DEL CÓDIGO DEL TELÉFONO PARA ESTE ARCHIVO: $phone_code_override

"; + } + + $total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list=''; + $row=fgetcsv($file, 1000, ","); + for ($i=0; $i\r\n"; + print "
\r\n"; + print " \r\n"; + print " \r\n"; + + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + } + } + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print "
VICIDIAL ColumnaDatos del archivo
".strtoupper(eregi_replace("_", " ", mysql_field_name($rslt, $i))).":
$row[$i]
".strtoupper(eregi_replace("_", " ", mysql_field_name($rslt, $i))).":
$row[$i]
        
\r\n"; + # } + print ""; + } +} else if (filesize($leadfile)>8388608) { + print "
ERROR: El archivo excede el límite 8MB.
"; +} +?> + + + + + + + + +4) ) + { + if (preg_match('/^1$/', $phone_code)) + { + $stmt="select * from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[2]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[3]; + $dst_range = $row[4]; + $PC_processed++; + $postalgmt_found++; + $post++; + } + } + } +if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =='1') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### MEXICO ### + if ($phone_code =='52') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### AUSTRALIA ### + if ($phone_code =='61') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $PC_processed++; + $stmt="select * from vicidial_phone_codes where country_code='$phone_code';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + } + +### Find out if DST to raise the gmt offset ### +$AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); +$AC_localtime = mktime(($Shour + $AC_GMT_diff), $Smin, $Ssec, $Smon, $Smday, $Syear); + $hour = date("H",$AC_localtime); + $min = date("i",$AC_localtime); + $sec = date("s",$AC_localtime); + $mon = date("m",$AC_localtime); + $mday = date("d",$AC_localtime); + $wday = date("w",$AC_localtime); + $year = date("Y",$AC_localtime); +$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + +$AC_processed=0; +if ( (!$AC_processed) and ($dst_range == 'SSM-FSN') ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + #********************************************************************** + # SSM-FSN + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on Second Sunday March to First Sunday November at 2 am. + # INPUTS: + # mm INTEGER Month. + # dd INTEGER Day of the month. + # ns INTEGER Seconds into the day. + # dow INTEGER Day of week (0=Sunday, to 6=Saturday) + # OPTIONAL INPUT: + # timezone INTEGER hour difference UTC - local standard time + # (DEFAULT is blank) + # make calculations based on UTC time, + # which means shift at 10:00 UTC in April + # and 9:00 UTC in October + # OUTPUT: + # INTEGER 1 = DST, 0 = not DST + # + # S M T W T F S + # 1 2 3 4 5 6 7 + # 8 9 10 11 12 13 14 + #15 16 17 18 19 20 21 + #22 23 24 25 26 27 28 + #29 30 31 + # + # S M T W T F S + # 1 2 3 4 5 6 + # 7 8 9 10 11 12 13 + #14 15 16 17 18 19 20 + #21 22 23 24 25 26 27 + #28 29 30 31 + # + #********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; + } elseif ($mm >= 4 and $mm <= 10) { + $USACAN_DST=1; + } elseif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; + } elseif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } + } else { + $USACAN_DST=0; + } + } elseif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; + } elseif ($dd < ($dow+1)) { + $USACAN_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } else { # tiempo local calculations + if ($ns < 7200) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } + } else { + $USACAN_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$gmt_offset++;} + $AC_processed++; + } + +if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + #********************************************************************** + # FSA-LSO + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in April and last Sunday in October at 2 am. + #********************************************************************** + + $USA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $USA_DST=0; + } elseif ($mm >= 5 and $mm <= 9) { + $USA_DST=1; + } elseif ($mm == 4) { + if ($dd > 7) { + $USA_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } + } else { + $USA_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $USA_DST=1; + } elseif ($dd < ($dow+25)) { + $USA_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } else { # tiempo local calculations + if ($ns < 7200) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } + } else { + $USA_DST=0; + } + } # end of month checks + + if ($DBX) {print " DST: $USA_DST\n";} + if ($USA_DST) {$gmt_offset++;} + $AC_processed++; + } + +if ( (!$AC_processed) and ($dst_range == 'LSM-LSO') ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in March and last Sunday in October at 1 am. + #********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; + } elseif ($mm >= 4 and $mm <= 9) { + $GBR_DST=1; + } elseif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; + } elseif ($dd < ($dow+25)) { + $GBR_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } else { # tiempo local calculations + if ($ns < 3600) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } + } else { + $GBR_DST=1; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; + } elseif ($dd < ($dow+25)) { + $GBR_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } else { # tiempo local calculations + if ($ns < 3600) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } + } else { + $GBR_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } +if ( (!$AC_processed) and ($dst_range == 'LSO-LSM') ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUS_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; + } elseif ($dd < ($dow+25)) { + $AUS_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } else { # tiempo local calculations + if ($ns < 3600) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } + } else { + $AUS_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; + } elseif ($dd < ($dow+25)) { + $AUS_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } else { # tiempo local calculations + if ($ns < 3600) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } + } else { + $AUS_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + +if ( (!$AC_processed) and ($dst_range == 'FSO-LSM') ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + #********************************************************************** + # TASMANIA ONLY + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUST_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; + } elseif ($dd < ($dow+25)) { + $AUST_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } else { # tiempo local calculations + if ($ns < 3600) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } + } else { + $AUST_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $AUST_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } + } else { + $AUST_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } +if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and third Sunday in March at 1 am. + #********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $NZL_DST=0; + } elseif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; + } elseif ($dd < ($dow+14)) { + $NZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } else { # tiempo local calculations + if ($ns < 3600) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } + } else { + $NZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $NZL_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } + } else { + $NZL_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + +if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + #********************************************************************** + # TSO-LSF + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. Brazil + # Based on Third Sunday October to Last Sunday February at 1 am. + #********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; + } elseif ($mm >= 3 and $mm <= 9) { + $BZL_DST=0; + } elseif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; + } elseif ($dd < ($dow+22)) { + $BZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } else { # tiempo local calculations + if ($ns < 3600) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } + } else { + $BZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; + } elseif ($dd < ($dow+22)) { + $BZL_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } else { # tiempo local calculations + if ($ns < 3600) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } + } else { + $BZL_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$gmt_offset++;} + $AC_processed++; + } + +if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + +return $gmt_offset; +} \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/remote_dispo.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/remote_dispo.php new file mode 100644 index 00000000..79c582c2 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/remote_dispo.php @@ -0,0 +1,327 @@ + LICENSE: GPLv2 +### +# this is the remote agent disposition screen for calls sent to remote agents. This allows the remote agent to modify customer information and disposition the call + +# CHANGES +# +# 60619-1626 - Added variable filtering to eliminate SQL injection attack threat +# + + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +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["alt_phone"])) {$alt_phone=$_GET["alt_phone"];} + elseif (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];} +if (isset($_GET["call_began"])) {$call_began=$_GET["call_began"];} + elseif (isset($_POST["call_began"])) {$call_began=$_POST["call_began"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];} + elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];} +if (isset($_GET["city"])) {$city=$_GET["city"];} + elseif (isset($_POST["city"])) {$city=$_POST["city"];} +if (isset($_GET["comments"])) {$comments=$_GET["comments"];} + elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];} +if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];} + elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];} +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["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];} + elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];} +if (isset($_GET["email"])) {$email=$_GET["email"];} + elseif (isset($_POST["email"])) {$email=$_POST["email"];} +if (isset($_GET["end_call"])) {$end_call=$_GET["end_call"];} + elseif (isset($_POST["end_call"])) {$end_call=$_POST["end_call"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];} + elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];} + elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["parked_time"])) {$parked_time=$_GET["parked_time"];} + elseif (isset($_POST["parked_time"])) {$parked_time=$_POST["parked_time"];} +if (isset($_GET["pass"])) {$pass=$_GET["pass"];} + elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];} +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["phone"])) {$phone=$_GET["phone"];} + elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];} +if (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];} + elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];} +if (isset($_GET["province"])) {$province=$_GET["province"];} + elseif (isset($_POST["province"])) {$province=$_POST["province"];} +if (isset($_GET["security"])) {$security=$_GET["security"];} + elseif (isset($_POST["security"])) {$security=$_POST["security"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["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["session_id"])) {$session_id=$_GET["session_id"];} + elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];} +if (isset($_GET["state"])) {$state=$_GET["state"];} + elseif (isset($_POST["state"])) {$state=$_POST["state"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["tsr"])) {$tsr=$_GET["tsr"];} + elseif (isset($_POST["tsr"])) {$tsr=$_POST["tsr"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ENVIAR"])) {$ENVIAR=$_GET["ENVIAR"];} + elseif (isset($_POST["ENVIAR"])) {$ENVIAR=$_POST["ENVIAR"];} + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_datetime = $STARTtime; + +$ext_context = 'demo'; +if (!isset($begin_date)) {$begin_date = $TODAY;} +if (!isset($end_date)) {$end_date = $TODAY;} + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 2;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + } + else + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +?> + + +REMOTE VICIDIAL: Disposición De la Llamada +\n"; +?> + + +
+ +"; + +if ($end_call > 0) +{ + +$call_length = ($STARTtime - $call_began); + + ### insert a NEW record to the vicidial_closer_log table + $stmt="UPDATE vicidial_closer_log set end_epoch='$STARTtime', length_in_sec='" . mysql_real_escape_string($call_length) . "', status='" . mysql_real_escape_string($status) . "', user='$PHP_AUTH_USER' where lead_id='" . mysql_real_escape_string($lead_id) . "' order by start_epoch desc limit 1;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ### update the lead record in the vicidial_list table + $stmt="UPDATE vicidial_list set status='" . mysql_real_escape_string($status) . "',first_name='" . mysql_real_escape_string($first_name) . "',last_name='" . mysql_real_escape_string($last_name) . "',address1='" . mysql_real_escape_string($address1) . "',address2='" . mysql_real_escape_string($address2) . "',address3='" . mysql_real_escape_string($address3) . "',city='" . mysql_real_escape_string($city) . "',state='" . mysql_real_escape_string($state) . "',province='" . mysql_real_escape_string($province) . "',postal_code='" . mysql_real_escape_string($postal_code) . "',country_code='" . mysql_real_escape_string($country_code) . "',alt_phone='" . mysql_real_escape_string($alt_phone) . "',email='" . mysql_real_escape_string($email) . "',security_phrase='" . mysql_real_escape_string($security) . "',comments='" . mysql_real_escape_string($comments) . "',user='$PHP_AUTH_USER' where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "La llamada ha sido dispositioned       $NOW_TIME\n

\n"; + + echo "
\n"; + +} +else +{ + $stmt="SELECT count(*) from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_count = $row[0]; + + if ($lead_count > 0) + { + + $stmt="SELECT * from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_id = "$row[0]"; + $tsr = "$row[4]"; + $vendor_id = "$row[5]"; + $list_id = "$row[7]"; + $campaign_id = "$row[8]"; + $phone_code = "$row[10]"; + $phone_number = "$row[11]"; + $title = "$row[12]"; + $first_name = "$row[13]"; # + $middle_initial = "$row[14]"; + $last_name = "$row[15]"; # + $address1 = "$row[16]"; # + $address2 = "$row[17]"; # + $address3 = "$row[18]"; # + $city = "$row[19]"; # + $state = "$row[20]"; # + $province = "$row[21]"; # + $postal_code = "$row[22]"; # + $country_code = "$row[23]"; # + $gender = "$row[24]"; + $date_of_birth = "$row[25]"; + $alt_phone = "$row[26]"; # + $email = "$row[27]"; # + $security = "$row[28]"; # + $comments = "$row[29]"; # + + echo "
Información de la llamada: $first_name $last_name - $phone_number

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + echo "\n"; + echo "
Vendor ID: $vendor_id     ID De la Campaña: $campaign_id
Fronter: $tsr     ID De la Lista: $list_id
Nombre:   \n"; + echo " Apellidos:
Dirección 1 :
Dirección 2 :
Dirección 3 :
Ciudad :
Estado:   \n"; + echo " Código Postal:
Provincia:
País :
Alt Phone :
Email :
Seguridad:
Comentarios :
Disposición:
\n"; + echo "


\n"; + + } + else + { + echo "las operaciones de búsqueda del plomo FALLARON para el lead_id $lead_id       $NOW_TIME\n

\n"; +# echo "Close this window\n

\n"; + } + + + + + + +} + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nScript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/server_stats.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/server_stats.php new file mode 100644 index 00000000..1d24f7a0 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/server_stats.php @@ -0,0 +1,97 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60620-1037 - Added Link back to Admin section +# - Added required user/pass to gain access to this page +# 61101-1331 - Added SIP/IAX listen/barge links +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($query_date)) {$query_date = $NOW_DATE;} + +$stmt="select * from servers;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$servers_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $servers_to_print) + { + $row=mysql_fetch_row($rslt); + $server_id[$i] = $row[0]; + $server_description[$i] = $row[1]; + $server_ip[$i] = $row[2]; + $active[$i] = $row[3]; + $i++; + } +?> + + + + + +VICIDIAL: ESTADÃSTICAS DEL SERVIDOR and Reports +VICIDIAL: ESTADÃSTICAS DEL SERVIDOR and Reports                           +DE NUEVO AL ADMIN

+ + +

+
+ $o)
+	{
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	$o++;
+	}
+
+?>
+
SERVERDESCRIPCIÓNIP ADDRESSACTIVOVDAD timeVDcall timePARK timeCLOSER/INBOUND time
$server_id[$o]$server_description[$o]$server_ip[$o]$active[$o]LINKLINKLINKLINK
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/user_stats.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/user_stats.php new file mode 100644 index 00000000..f4351011 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/user_stats.php @@ -0,0 +1,408 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1743 - Added variable filtering to eliminate SQL injection attack threat +# 61201-1136 - Added recordings display and changed calls to time range with 10000 limit +# 70118-1605 - Added user group column to login/out and calls lists +# 70702-1231 - Added recording location link and truncation +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["begin_date"])) {$begin_date=$_GET["begin_date"];} + elseif (isset($_POST["begin_date"])) {$begin_date=$_POST["begin_date"];} +if (isset($_GET["end_date"])) {$end_date=$_GET["end_date"];} + elseif (isset($_POST["end_date"])) {$end_date=$_POST["end_date"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ENVIAR"])) {$ENVIAR=$_GET["ENVIAR"];} + elseif (isset($_POST["ENVIAR"])) {$ENVIAR=$_POST["ENVIAR"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); + +if (!isset($begin_date)) {$begin_date = $TODAY;} +if (!isset($end_date)) {$end_date = $TODAY;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and view_reports='1';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + + $stmt="SELECT full_name from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + } + + + + +?> + + +VICIDIAL ADMIN: User Stats +\n"; +?> + + +
+ + + + + +\n"; +echo "
" ?>   VICIDIAL ADMIN: User Stats for  
  \n"; + +echo "
\n"; +echo "\n"; +echo " to \n"; +echo "  \n"; +echo "\n"; + + +echo "           $user - $full_name\n"; + +echo " - VICIDIAL Time Sheet\n"; +echo " - User Status\n"; +echo " - Modificar Usuario\n"; + + +echo "
\n"; + + + $stmt="SELECT count(*),status, sum(length_in_sec) from vicidial_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' group by status order by status"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + +echo "
\n"; + +echo "TIEMPO Y ESTADO DE CONVERSACIÓN:\n"; + +echo "
\n"; +echo "\n"; + + $total_calls=0; + $o=0; + while ($statuses_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $call_seconds = $row[2]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} + + echo ""; + echo "\n"; + echo "\n"; + $total_calls = ($total_calls + $row[0]); + + $call_seconds=0; + $o++; + } + + $stmt="SELECT sum(length_in_sec) from vicidial_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59'"; + $rslt=mysql_query($stmt, $link); + $counts_to_print = mysql_num_rows($rslt); + $row=mysql_fetch_row($rslt); + $call_seconds = $row[0]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} + +echo "\n"; +echo "
ESTADOCUENTAHORAS:MINUTOS
$row[1] $row[0] $call_hours_int:$call_minutes_int
LLAMADAS TOTALES $total_calls $call_hours_int:$call_minutes_int
\n"; +echo "

\n"; + +echo "
\n"; + +echo "TIEMPO LOGIN/LOGOUT:\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT event,event_epoch,event_date,campaign_id,user_group from vicidial_user_log where user='" . mysql_real_escape_string($user) . "' and event_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and event_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59'"; + $rslt=mysql_query($stmt, $link); + $events_to_print = mysql_num_rows($rslt); + + $total_calls=0; + $o=0; + $event_start_seconds=''; + $event_stop_seconds=''; + while ($events_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("LOGIN", $row[0])) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + if (ereg("LOGIN", $row[0])) + { + $event_start_seconds = $row[1]; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + if (ereg("LOGOUT", $row[0])) + { + if ($event_start_seconds) + { + $event_stop_seconds = $row[1]; + $event_seconds = ($event_stop_seconds - $event_start_seconds); + $total_login_time = ($total_login_time + $event_seconds); + $event_hours = ($event_seconds / 3600); + $event_hours = round($event_hours, 2); + $event_hours_int = intval("$event_hours"); + $event_minutes = ($event_hours - $event_hours_int); + $event_minutes = ($event_minutes * 60); + $event_minutes_int = round($event_minutes, 0); + if ($event_minutes_int < 10) {$event_minutes_int = "0$event_minutes_int";} + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + $event_start_seconds=''; + $event_stop_seconds=''; + } + else + { + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + } + } + + $total_calls = ($total_calls + $row[0]); + + $call_seconds=0; + $o++; + } + +$total_login_hours = ($total_login_time / 3600); +$total_login_hours = round($total_login_hours, 2); +$total_login_hours_int = intval("$total_login_hours"); +$total_login_minutes = ($total_login_hours - $total_login_hours_int); +$total_login_minutes = ($total_login_minutes * 60); +$total_login_minutes_int = round($total_login_minutes, 0); +if ($total_login_minutes_int < 10) {$total_login_minutes_int = "0$total_login_minutes_int";} + +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "
EVENTO FECHA CAMPAÑA GROUPHORAS:MINUTOS
$row[0] $row[2] $row[3] $row[4]
$row[0] $row[2] $row[3] $row[4] $event_hours_int:$event_minutes_int
$row[0] $row[2] $row[3]
TOTAL $total_login_hours_int:$total_login_minutes_int
\n"; + + +echo "

\n"; + +echo "
\n"; + +echo "OUTBOUND CALLS FOR THIS TIME PERIOD: (10000 record limit)\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from vicidial_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $u++; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + } + + +echo "
# DATE/TIME LENGTH STATUS PHONE CAMPAÑA GROUP LIST LEAD
$u$row[4] $row[7] $row[8] $row[10] $row[3] $row[14] $row[2] $row[1]


\n"; + + + +echo "CLOSER CALLS FOR THIS TIME PERIOD: (10000 record limit)\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from vicidial_closer_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $u++; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + } + + +echo "
# DATE/TIME LENGTH STATUS PHONE CAMPAÑA WAIT (S) LIST LEAD
$u$row[4] $row[7] $row[8] $row[10] $row[3] $row[14] $row[2] $row[1]


\n"; + + + + +echo "RECORDINGS FOR THIS TIME PERIOD: (10000 record limit)\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from recording_log where user='" . mysql_real_escape_string($user) . "' and start_time >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and start_time <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by recording_id desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) + { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $location = $row[11]; + if (strlen($location)>30) + {$locat = substr($location,0,27); $locat = "$locat...";} + else + {$locat = $location;} + if (eregi("http",$location)) + {$location = "$locat";} + else + {$location = $locat;} + $u++; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + } + + +echo "
# LEADDATE/TIME SECONDS   RECIDFILENAMELOCATION  
$u $row[12] $row[4] $row[8] $row[0] $row[10] $location  
\n"; + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nScript runtime: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/user_status.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/user_status.php new file mode 100644 index 00000000..0bc09f99 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/user_status.php @@ -0,0 +1,242 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1738 - Added variable filtering to eliminate SQL injection attack threat +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["begin_date"])) {$begin_date=$_GET["begin_date"];} + elseif (isset($_POST["begin_date"])) {$begin_date=$_POST["begin_date"];} +if (isset($_GET["end_date"])) {$end_date=$_GET["end_date"];} + elseif (isset($_POST["end_date"])) {$end_date=$_POST["end_date"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ENVIAR"])) {$ENVIAR=$_GET["ENVIAR"];} + elseif (isset($_POST["ENVIAR"])) {$ENVIAR=$_POST["ENVIAR"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); + +if (!isset($begin_date)) {$begin_date = $TODAY;} +if (!isset($end_date)) {$end_date = $TODAY;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and view_reports='1';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $stmt="SELECT full_name,change_agent_campaign from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $change_agent_campaign=$row[1]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + + $stmt="SELECT full_name,user_group from vicidial_users where user='" . mysql_real_escape_string($user) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + $user_group = $row[1]; + + $stmt="SELECT * from vicidial_live_agents where user='" . mysql_real_escape_string($user) . "';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $agents_to_print = mysql_num_rows($rslt); + $i=0; + while ($i < $agents_to_print) + { + $row=mysql_fetch_row($rslt); + $Aserver_ip = $row[2]; + $Asession_id = $row[3]; + $Aextension = $row[4]; + $Astatus = $row[5]; + $Acampaign = $row[7]; + $Alast_call = $row[14]; + $Acl_campaigns = $row[15]; + $i++; + } + + } + +$stmt="select * from vicidial_campaigns;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + + + +?> + + +VICIDIAL ADMIN: User Status +\n"; +?> + + +
+
+ + + + +\n"; +echo "
" ?>   VICIDIAL ADMIN: User Status for  
  \n"; + +if ($stage == "live_campaign_change") +{ + $stmt="UPDATE vicidial_live_agents set campaign_id='" . mysql_real_escape_string($group) . "' where user='" . mysql_real_escape_string($user) . "';"; + $rslt=mysql_query($stmt, $link); + + echo "Agent $user - $full_name changed to $group campaign
\n"; + + exit; +} + +if ($stage == "log_agent_out") +{ + $stmt="DELETE from vicidial_live_agents where user='" . mysql_real_escape_string($user) . "';"; + $rslt=mysql_query($stmt, $link); + + echo "Agent $user - $full_name has been emergency logged out, make sure they close their web browser
\n"; + + exit; +} + +if ($agents_to_print > 0) +{ + echo "
";
+	echo "Agent Logged in at server:  $Aserver_ip\n";
+	echo "               in session:  $Asession_id\n";
+	echo "               from phone:  $Aextension\n";
+	echo "Agent is in campaign:       $Acampaign\n";
+	echo "              status:       $Astatus\n";
+	echo " hungup last call at:       $Alast_call\n";
+	echo "       Closer groups:       $Acl_campaigns\n\n";
+
+	echo "
"; + + + if ($change_agent_campaign > 0) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "Current Campaña: \n"; + echo "
\n"; + + + echo "
\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + } +} + +else +{ + echo "Agent is not logged in\n
"; + +} + + +echo "           $user - $full_name \n"; +echo "       GROUP: $user_group

\n"; + +echo "VICIDIAL Time Sheet\n"; +echo " - User Stats\n"; +echo " - Modificar Usuario\n"; + +echo "
\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nScript runtime: $RUNtime seconds
"; + +echo "|$stage|$group|"; + +?> + + +
+ + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/vdremote.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/vdremote.php new file mode 100644 index 00000000..b0eef2f5 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/vdremote.php @@ -0,0 +1,602 @@ + LICENSE: GPLv2 +# +# Changes +# 50307-1721 - First version +# 51123-1502 - removed requirement of PHP Globals=on +# 60421-1229 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1603 - Added variable filtering to eliminate SQL injection attack threat +# +# make sure you have added a user to the vicidial_users MySQL table with at least user_level 4 to access this page the first time + +$version = '1.1.12'; +$build = '60619-1603'; + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["ADD"])) {$ADD=$_GET["ADD"];} + elseif (isset($_POST["ADD"])) {$ADD=$_POST["ADD"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["force_logout"])) {$force_logout=$_GET["force_logout"];} + elseif (isset($_POST["force_logout"])) {$force_logout=$_POST["force_logout"];} +if (isset($_GET["groups"])) {$groups=$_GET["groups"];} + elseif (isset($_POST["groups"])) {$groups=$_POST["groups"];} +if (isset($_GET["remote_agent_id"])) {$remote_agent_id=$_GET["remote_agent_id"];} + elseif (isset($_POST["remote_agent_id"])) {$remote_agent_id=$_POST["remote_agent_id"];} +if (isset($_GET["user_start"])) {$user_start=$_GET["user_start"];} + elseif (isset($_POST["user_start"])) {$user_start=$_POST["user_start"];} +if (isset($_GET["number_of_lines"])) {$number_of_lines=$_GET["number_of_lines"];} + elseif (isset($_POST["number_of_lines"])) {$number_of_lines=$_POST["number_of_lines"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["conf_exten"])) {$conf_exten=$_GET["conf_exten"];} + elseif (isset($_POST["conf_exten"])) {$conf_exten=$_POST["conf_exten"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["groups"])) {$groups=$_GET["groups"];} + elseif (isset($_POST["groups"])) {$groups=$_POST["groups"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["ENVIAR"])) {$ENVIAR=$_GET["ENVIAR"];} + elseif (isset($_POST["ENVIAR"])) {$ENVIAR=$_POST["ENVIAR"];} + +if (!isset($force_logout)) {$force_logout = 0;} + +if ($force_logout) +{ + if( (strlen($PHP_AUTH_USER)>0) or (strlen($PHP_AUTH_PW)>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "Usted ahora ha salido. Gracias\n"; + exit; +} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + +$popup_page = './closer_popup.php'; +$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='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 3;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + + $stmt="SELECT count(*) from vicidial_remote_agents where user_start='$PHP_AUTH_USER';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $authx=$row[0]; + + if($authx>0) + { + $stmt="SELECT remote_agent_id,server_ip,number_of_lines from vicidial_remote_agents where user_start='$PHP_AUTH_USER';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id=$row[0]; + $server_ip=$row[1]; + if (!$number_of_lines) {$number_of_lines=$row[2];} + + fwrite ($fp, "VDremote|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VDremote|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + echo "This remote agent does not exist: |$PHP_AUTH_USER|\n"; + exit; + } + } + else + { + fwrite ($fp, "VDremote|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +echo "\n"; +if ($ADD==61111) + { + echo"\n"; + } +echo "\n"; +?> + +VICIDIAL, AGENTES REMOTOS: $LOGfullname - $PHP_AUTH_USER "; + +if (!$ADD) {$ADD="31111";} +if ($ADD==31111) {echo "Modificar Agentes Remotos";} +if ($ADD==41111) {echo "Modificar Agentes Remotos";} +if ($ADD==61111) {echo "Remote Agent Status";} +if ($ADD==71111) {echo "Remote Agent Closer Stats";} + + +if (strlen($ADD)>4) + { + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rslt=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rslt); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $servers_list .= "\n"; + $o++; + } + + ##### get campaigns listing for dynamic pulldown + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + $campaigns_list=''; + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $campaigns_list .= "\n"; + $o++; + } + + ##### get inbound groups listing for checkboxes + if ( (($ADD==31111) or ($ADD==31111)) and (count($groups)<1) ) + { + $stmt="SELECT closer_campaigns from vicidial_remote_agents where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + $stmt="SELECT group_id,group_name from vicidial_inbound_groups order by group_id"; + $rslt=mysql_query($stmt, $link); + $groups_to_print = mysql_num_rows($rslt); + $groups_list=''; + $groups_value=''; + + $o=0; + while ($groups_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $group_id_value = $rowx[0]; + $group_name_value = $rowx[1]; + $groups_list .= "2) {$groups_value .= " -";} + } + +?> + + + +
+
+ + + +
  VICIDIAL, AGENTES REMOTOS:   Salir  
  MODIFICAR | ">ESTADO | ">ESTADÃSTICAS DE ENTRADA
+"; + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + +echo "
MODIFICAR UNA ENTRADA DE LOS AGENTES REMOTOS: $row[0]
\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Comienzo Del ID del usuario: $user_start
Número de líneas: (Solamente números)
IP Del Servidor: $row[3]
Extensión Externa: (number dialed to reach agents [i.e. 913125551212])
Estado:
Campaña: $campaign_id
Grupos De entrada: \n"; +echo "$groups_list"; +echo "
\n"; +echo "NOTA: Puede tomar hasta 30 segundos para los cambios sometidos en esta pantalla para ir viva\n"; + +} + + + + +###################### +# ADD=41111 modify remote agents info in the system +###################### + +if ($ADD==41111) +{ + echo ""; + + if ( (strlen($number_of_lines) < 1) or (strlen($conf_exten) < 2) ) + {echo "
AGENTES ALEJADOS NO MODIFICADOS - vaya por favor detrás y mire los datos que usted incorporó\n";} + else + { + $stmt="UPDATE vicidial_remote_agents set number_of_lines='" . mysql_real_escape_string($number_of_lines) . "', conf_exten='" . mysql_real_escape_string($conf_exten) . "', status='" . mysql_real_escape_string($status) . "', closer_campaigns='" . mysql_real_escape_string($groups_value) . "' where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';"; + $rslt=mysql_query($stmt, $link); + +# echo "$stmt\n"; + echo "
LOS AGENTES ALEJADOS SE MODIFICARON\n"; + + ### LOG CHANGES TO LOG FILE ### + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY AGENTES REMOTOS ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + + } + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + +echo "
MODIFICAR UNA ENTRADA DE LOS AGENTES REMOTOS: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Comienzo Del ID del usuario: $user_start
Número de líneas: (Solamente números)
IP Del Servidor: $row[3]
Extensión Externa: (number dialed to reach agents [i.e. 913125551212])
Estado:
Campaña: $campaign_id
Grupos De entrada: \n"; +echo "$groups_list"; +echo "
\n"; +echo "NOTA: Puede tomar hasta 30 segundos para los cambios sometidos en esta pantalla para ir viva\n"; + +} + + + + +###################### +# ADD=61111 status of remote agent in the system and active calls and queue +###################### + +if ($ADD==61111) +{ + echo "
";
+
+	 if ( (strlen($server_ip) < 2) or (strlen($user) < 2) )
+		{echo "
ERROR AGENTES REMOTOS – Por favor, vuelva atrás y compruebe los datos que introdujo\n";} + else + { + + $users_list = ''; + $k=0; + while($k < $number_of_lines) + { + $nextuser=($user + $k); + $users_list .= "'" . mysql_real_escape_string($nextuser) . "',"; + $k++; + } + $users_list = preg_replace("/.$/","",$users_list); + + echo "VICIDIAL: Remote Agent Time On Calls $NOW_TIME\n\n"; + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + echo "| STATION | USER | LEADID | CHANNEL | STATUS | START TIME | MINUTES |\n"; + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + + + $stmt="select extension,user,lead_id,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish) from vicidial_live_agents where status NOT IN('PAUSED') and server_ip='" . mysql_real_escape_string($server_ip) . "' and user IN($users_list) order by extension;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + while ($i < $talking_to_print) + { + $leadlink=0; + $row=mysql_fetch_row($rslt); + if (eregi("READY|PAUSED",$row[4])) + { + $row[3]=''; + $row[5]='- ESPERANDO -'; + $row[6]=$row[7]; + } + $extension = sprintf("%-10s", $row[0]); + $user = sprintf("%-6s", $row[1]); + $leadid = sprintf("%-12s", $row[2]); + if ($row[2] > 0) + { + $leadidLINK=$row[2]; + $leadlink++; + if ( eregi("QUEUE",$row[4]) ) {$row[6]=$STARTtime;} + $leadid = "$leadid"; + } + $channel = sprintf("%-10s", $row[3]); + $cc=0; + while ( (strlen($channel) > 10) and ($cc < 100) ) + { + $channel = eregi_replace(".$","",$channel); + $cc++; + if (strlen($channel) <= 10) {$cc=101;} + } + $status = sprintf("%-6s", $row[4]); + $start_time = sprintf("%-19s", $row[5]); + $call_time_S = ($STARTtime - $row[6]); + + $call_time_M = ($call_time_S / 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"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + if ($call_time_M_int >= 5) {$G=''; $EG='';} + if ($call_time_M_int >= 10) {$G=''; $EG='';} + + echo "| $G$extension$EG | $G$user$EG | $G$leadid$EG | $G$channel$EG | $G$status$EG | $G$start_time$EG | $G$call_time_MS$EG |\n"; + + $i++; + } + + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + echo " $i agentes identificados en el servidor $server_ip\n\n"; + + echo " - Llamadas de 5 minutos o más\n"; + echo " - Sobre 10 minutos en llamada\n"; + + } + else + { + echo "**************************************************************************************\n"; + echo "*********************************AGENTES SIN LLAMADAS*********************************\n"; + echo "**************************************************************************************\n"; + } + } + +echo "
\n\n"; + +} + + +###################### +# ADD=71111 stats for remote agents from closer logs(vicidial_closer_log) +###################### + +if ($ADD==71111) +{ + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n\n"; + echo "
";
+
+	 if ( (strlen($server_ip) < 2) or (strlen($user) < 2) )
+		{echo "
ERROR AGENTES REMOTOS – Por favor, vuelva atrás y compruebe los datos que introdujo\n";} + else + { + + $users_list = ''; + $k=0; + while($k < $number_of_lines) + { + $nextuser=($user + $k); + $users_list .= "'$nextuser',"; + $k++; + } + $users_list = preg_replace("/.$/","",$users_list); + + $stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and user IN($users_list);"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $in_calls = $row[0]; + $in_time = $row[1]; + $in_time_M = ($in_time / 60); + $in_time_M = round($in_time_M, 2); + $in_time_M_int = intval("$in_time_M"); + $in_time_SEC = ($in_time_M - $in_time_M_int); + $in_time_SEC = ($in_time_SEC * 60); + $in_time_SEC = round($in_time_SEC, 0); + if ($in_time_SEC < 10) {$in_time_SEC = "0$in_time_SEC";} + $in_time_MS = "$in_time_M_int:$in_time_SEC"; + $in_time_MS = sprintf("%7s", $in_time_MS); + + echo "VICIDIAL: Stats de entrada del agente alejado $NOW_TIME\n\n"; + echo "\n"; + echo "Llamadas totales tomadas $query_date: $in_calls\n"; + echo "Tiempo total de conversación$query_date: $in_time_MS (minutes:seconds)\n"; + echo "\n"; + echo "\n"; + echo "Lista la llamada para $query_date:\n"; + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + echo "| USER | LEADID | GROUP | PHONE NUM | STATUS | CALL TIME | MINUTES |\n"; + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + + + $stmt="select user,lead_id,campaign_id,phone_number,status,call_date,length_in_sec from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and user IN($users_list) order by call_date;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + while ($i < $talking_to_print) + { + $row=mysql_fetch_row($rslt); + $user = sprintf("%-8s", $row[0]); + $leadid = sprintf("%-10s", $row[1]); + $group = sprintf("%-14s", $row[2]); + $phone = sprintf("%-10s", $row[3]); + $status = sprintf("%-6s", $row[4]); + $start_time = sprintf("%-19s", $row[5]); + $call_time_S = $row[6]; + + $call_time_M = ($call_time_S / 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"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + # if ($call_time_M_int >= 5) {$G=''; $EG='';} + # if ($call_time_M_int >= 10) {$G=''; $EG='';} + + echo "| $G$user$EG | $G$leadid$EG | $G$group$EG | $G$phone$EG | $G$status$EG | $G$start_time$EG | $G$call_time_MS$EG |\n"; + + $i++; + } + + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + # echo " $i agentes identificados en el servidor $server_ip\n\n"; + + # echo " - Llamadas de 5 minutos o más\n"; + # echo " - Sobre 10 minutos en llamada\n"; + + } + else + { + echo "**************************************************************************************\n"; + echo "*********************************NINGUNA LLAMADA PARA HOY*******************************\n"; + echo "**************************************************************************************\n"; + } + } + +echo "
\n\n"; + +} + + + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nScript runtime: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/welcome.php b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/welcome.php new file mode 100644 index 00000000..f43e47b1 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/LANG_www/vicidial_es/welcome.php @@ -0,0 +1,25 @@ + LICENSE: GPLv2 +# + +echo "VICIDIAL Bienvenido\n"; +echo "\n"; +echo "\n"; +echo "




"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Recepción
 
Agent Login
 
Administration
 
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; + +?> \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/Makefile b/agc_2-X/branches/agc_2.0.4/Makefile new file mode 100644 index 00000000..00c7ec22 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/Makefile @@ -0,0 +1,151 @@ +# +# Makefile +# +# Copyright (C) 2007 VICIDIAL-astGUIclient LICENSE: GPLv2 +# +# CHANGES +# 71121-1430 - Initial release. +# 71130-2137 - Remove install-VDconfig section and replace with install-common. +# 71201-0358 - Use sh to run VDconfig. +# +# +# methods: +# make menuconfig +# Runs graphical configuration. +# +# make defaultconfig +# Creates a default install config file. +# +# make clean +# Removes previous install config. +# +# make install +# Install Non-Web, Web and documents. +# +# make install-nonweb +# Only install executables and other Non-Web components. +# +# make install-web +# Only install Web components. +# +# make install-docs +# Installs documents to /usr/share/doc/astGUIclient-(version) +# +# make install-asterisk-sample-config +# Installs sample configs in /etc/asterisk, backing-up existing files. + + +.PHONY : defaultconfig menuconfig .install .install-nonweb install-web install install-nonweb install-web install-docs install-asterisk-sample-config clean .install-complete .install-common install-asterisk-sample-configs +VDconfig := VDconfig +version := $(shell cat version) + +menuconfig: + @sh $(VDconfig) + +clean: + rm -f .agc.config + +.agc.config: + @echo "########################################################" + @echo "###" + @echo "### \".agc.config\" file not found." + @echo "### Running configuration and just using defaults." + @echo "###" + @echo "########################################################" + @sh $(VDconfig) --no-menu + +defaultconfig: .agc_config + @sh $(VDconfig) --no-menu + +# The following, install, install-nonweb and install-web shell-out to +# run VDconfig which set the path variables and runs make with .install* +install: .agc.config + @sh $(VDconfig) --env-make .$@ + +install-nonweb: .agc.config + @sh $(VDconfig) --env-make .$@ + +install-web: .agc.config + @sh $(VDconfig) --env-make .$@ + + +# The following, .install, .install-nonweb and .install-web are the actual +# methods used to install +.install: .install-nonweb .install-web install-docs .install-common .install-complete + +.install-common: + @echo "Installing VDconfig script..." + @install -d -m 755 $(DESTDIR)$(PATHhome) + @install -p -m 755 $(VDconfig) $(DESTDIR)$(PATHhome)/VDconfig + @install -d -m 755 $(DESTDIR)/usr/bin + @ln -fs $(PATHhome)/VDconfig $(DESTDIR)/usr/bin/VDconfig + @echo "Installing astGUIclient configuration to $(DESTDIR)/etc/astguiclient.conf..." + @install -d -m 755 $(DESTDIR)/etc + @install -p -m 644 ./.agc.config $(DESTDIR)/etc/astguiclient.conf + @echo "Creating log directory $(DESTDIR)$(PATHlogs)..." + @install -d -m 755 $(DESTDIR)$(PATHlogs) + +.install-nonweb: .install-common + @echo "Installing non-web components..." + @install -d -m 755 $(DESTDIR)$(PATHhome)/libs/Asterisk + @install -d -m 755 $(DESTDIR)$(PATHhome)/LEADS_IN/DONE + @install -d -m 755 $(DESTDIR)$(PATHmonitor) + @install -d -m 755 $(DESTDIR)$(PATHDONEmonitor)/ORIG + @install -d -m 755 $(DESTDIR)$(PATHagi) + @install -d -m 755 $(DESTDIR)$(PATHsounds) + @install -p -m 755 ./bin/* $(DESTDIR)$(PATHhome) + @install -p -m 755 ./extras/Asterisk.pm $(DESTDIR)$(PATHhome)/libs + @install -p -m 755 ./extras/Asterisk/* $(DESTDIR)$(PATHhome)/libs/Asterisk + @install -p -m 644 ./extras/GMT_USA_zip.txt $(DESTDIR)$(PATHhome) + @install -p -m 644 ./extras/phone_codes_GMT.txt $(DESTDIR)$(PATHhome) + @install -p -m 644 ./extras/MySQL_AST_CREATE_tables.sql $(DESTDIR)$(PATHhome) + @install -p -m 755 ./agi/* $(DESTDIR)$(PATHagi) + @install -p -m 644 ./sounds/* $(DESTDIR)$(PATHsounds) + +.install-web: .install-common + @echo "Installing web components in $(DESTDIR)$(PATHweb)..." + @install -d -m 777 $(DESTDIR)$(PATHweb)/agc/images + @install -d -m 777 $(DESTDIR)$(PATHweb)/vicidial/ploticus + @install -d -m 777 $(DESTDIR)$(PATHweb)/vicidial/agent_reports + @install -d -m 777 $(DESTDIR)$(PATHweb)/vicidial/server_reports + @install -p -m 755 ./www/agc/*.php $(DESTDIR)$(PATHweb)/agc + @install -p -m 644 ./www/agc/images/* $(DESTDIR)$(PATHweb)/agc/images + @install -p -m 755 ./www/vicidial/*.php $(DESTDIR)$(PATHweb)/vicidial + @install -p -m 755 ./www/vicidial/*.pl $(DESTDIR)$(PATHweb)/vicidial + @install -p -m 644 ./www/vicidial/*.gif $(DESTDIR)$(PATHweb)/vicidial + +install-asterisk-sample-configs: install-asterisk-sample-config + +install-asterisk-sample-config: + @echo "Installing sample configs in $(DESTDIR)/etc/asterisk..." + @install -d -m 777 $(DESTDIR)/etc/asterisk + @install -b -p -m 644 ./docs/conf_examples/extensions.conf.sample $(DESTDIR)/etc/asterisk/extensions.conf + @install -b -p -m 644 ./docs/conf_examples/meetme.conf.sample $(DESTDIR)/etc/asterisk/meetme.conf + @install -b -p -m 644 ./docs/conf_examples/manager.conf.sample $(DESTDIR)/etc/asterisk/manager.conf + @install -b -p -m 644 ./docs/conf_examples/musiconhold.conf.sample $(DESTDIR)/etc/asterisk/musiconhold.conf + @install -b -p -m 644 ./docs/conf_examples/voicemail.conf.sample $(DESTDIR)/etc/asterisk/voicemail.conf + @install -b -p -m 644 ./docs/conf_examples/sip.conf.sample $(DESTDIR)/etc/asterisk/sip.conf + @install -b -p -m 644 ./docs/conf_examples/logger.conf.sample $(DESTDIR)/etc/asterisk/logger.conf + @install -b -p -m 644 ./docs/conf_examples/iax.conf.sample $(DESTDIR)/etc/asterisk/iax.conf + @install -b -p -m 644 ./docs/conf_examples/dnsmgr.conf.sample $(DESTDIR)/etc/asterisk/dnsmgr.conf + +install-docs: + @echo "Installing documents in $(DESTDIR)/usr/share/doc/astGUIclient-$(version)..." + @install -d -m 755 $(DESTDIR)/usr/share/doc/astGUIclient-$(version)/conf_examples + @install -p -m 644 ./docs/*.txt $(DESTDIR)/usr/share/doc/astGUIclient-$(version) + @install -p -m 644 ./docs/conf_examples/* $(DESTDIR)/usr/share/doc/astGUIclient-$(version)/conf_examples + +.install-complete: + @echo + @echo + @echo + @echo "#################################################################" + @echo "### ####" + @echo "### VICIDIAL-astGUIclient ####" + @echo "### INSTALLATION COMPLETE ####" + @echo "### ####" + @echo "### Please continue with the steps in SCRATH_INSTALL.txt ####" + @echo "### ####" + @echo "### Run /usr/bin/VDconfig to modify the configuration. ####" + @echo "### ####" + @echo "#################################################################" diff --git a/agc_2-X/branches/agc_2.0.4/UPGRADE b/agc_2-X/branches/agc_2.0.4/UPGRADE new file mode 100644 index 00000000..7af46c87 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/UPGRADE @@ -0,0 +1,356 @@ +################ UPGRADE + +NOTE: Upgrading from 2.0.2 to 2.0.3 is below the first section +NOTE: Upgrading from 2.0.1 to 2.0.2 is in the middle section +NOTE: Upgrading from 1.1.12-3 to 2.0.1 is at the bottom + +########## UPGRADING FROM 2.0.3 TO 2.0.4 ########## + +1. install new files: + perl ./install.pl + NOTES: If you have customized any scripts in the bin or agi folders, + then make sure you back them up before running the install.pl script. + This script will replace existing files in the astguiclient installation. + +2. upgrade the MySQL asterisk database: + mysql + use asterisk + \. /path/from/root/extras/upgrade_2.0.4.sql + quit + NOTE: If you do not use the standard "cron" database login, you will + need to add "LOCK TABLES" to the permissions to your db login + +3. add the "server_reports" directory to your Web Path: + mkdir $PATHweb/vicidial/server_reports/ + chmod 0777 $PATHweb/vicidial/server_reports/ + +4. A new set of changes have been made to the statuses sections in the admin.php + pages allowing for categorizing statues and modifying them without delete. + Also, the gathering of a tally of the statuses in these categories is + now available on the timeonVDADall scripts. + +5. The admin.php interface has had more sections broken into sub-sections for + easier management and rapid modifications. + +6. Added option for shorter enter and leave sounds(done during Asterisk build) + BASE/SCRATCH_INSTALL or extras/Changed_meetme_sounds for more details + +7. Added optional patch to meetme in Asterisk 1.2.X that will allow for better + DTMF passthru. Need to use the "F" flag to enable on Meetme in + extensiosn.conf. Feature is backported from Asterisk 1.4.X + +8. REQUIRED! Changed the FastAGI_log process to consolidate the "h" exten hangup + process into one executed function instead of two. Because of this, the + h exten needs to be changed to only the following: + exten => h,1,DeadAGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME})) + +9. Moved the audio transfer script and report generating scripts settings to + /etc/astguiclient.conf settings file. FTP and reports login info. + +10. Added agent alert, music-on-hold and several other parameters to inbound + groups. Make sure you have musiconhold working properly before using + in production. + +11. REQUIRED CHANGE! in your dialplan you must now add lines for load balancing + even if you only have one server, and you must also have lines with the + 7 prefix for silent insertion into the meetme conference: + exten => _010*010*010*015*8600XXX,... + exten => _010*010*010*015*8600XXX*.,... + exten => _010*010*010*015*78600XXX,... + exten => _010*010*010*015*78600XXX*.,... + exten => _78600XXX*.,1,AGI(agi-VDADfixCXFER.agi) + See LOAD_BALANCING.txt and extensions.conf.sample for more information + +12. Inbound, Blended and Closer-type campaigns are no longer required to have + campaign_id incude specific words or characters to be treated as such. + There is now a new campaign_allow_inbound field where this is set. + +13. Call distribution by agent ranking per in-group and total calls to in-group + +14. Added ability to copy the settings campaigns, users and in-groups to new records + +15. REQUIRED CHANGE! Old inbound and Closer AGI scripts have all been consolidated + into a single script: agi-VDAD_ALL_inbound.agi + Please look at the script header or the SCRATCH_INSTALL doc for more + info on how to alter your extenions.conf to use the new script. + The old agi-VDAD_closer... scripts have all been depricated and moved + to the extras/old_agi/ directory. + +16. AST_agent_performance_detail.php report script has been completely rewritten + +17. REQUIRED CHANGE! If you use Fronter/Closer campaigns where an agent is sending + calls to a closer, you will need to define the new "Default Transfer Group" + field with the inbound group that you want to take the calls. Transfers + are now allowed from a list of definable in-groups that you have to set + in the campaign detail screen. + +18. In the vicidial.php code, you can now modify the size of the elements on the + screen using the BROWSER_HEIGHT and BROWSER_WIDTH variables. + + + + + +########## UPGRADING FROM 2.0.2 TO 2.0.3 ########## + +1. install new files: + perl ./install.pl + NOTES: If you have customized any scripts in the bin or agi folders, + then make sure you back them up before running the install.pl script. + This script will replace existing files in the astguiclient installation. + +2. upgrade the MySQL asterisk database: + mysql + use asterisk + \. /path/from/root/extras/upgrade_2.0.3.sql + quit + +3. The server_stats.php has been merged into the vicidial/admin.php page + +4. Width of the admin.php screen, and the color and size of the headers are all + now definable by variables at top of the admin.php script. + +5. Dial Override checkbox added to the campaign modification screen of admin.php + to force manual dial_level changes in ADAPT dialing modes. + +6. Behaviour of HotKeys in manual dial mode has changed to automatically go on + to the next lead when a HotKey is pressed. + +7. It is now possible for agents to dial alternate phone numbers using only + HotKeys if ALTPH2 and/or ADDR3 are added to a campaign's hotkeys. + +8. You can now use BLEND/INBND/*_C/*_B/*_I to define a campaign a a CLOSER + campaign capable of taking inbound calls. + +9. In Auto-dialing campaigns(RATIO and ADAPT) you can now configure the dialer + to dial up to two alternate numbers per lead automatically, as well as + defining the statuses that you want to do this for. More info about + this feature in the ALTERNATE_NUMBER_DIALING.txt doc. + +10. Added ability to send multiple concurrent transfers at once to agents in + outbound campaigns. This will greatly benefit larger VICIDIAL + installations by decreasing the time it takes for a call to get to an + agent once answered after a large queue backup. This is defaulted to + AUTO, but can be forced to a set number. This is the Concurrent + Transfers option in the Campaign Modification page. + +11. New optimized code for AST_manager_send.pl and AST_send_action_child.pl. + Thanks to Lott Caskey for the code contribution + +12. The field user_group has been added to several log tables to allow for + better tracking of stats by user groups. Several reports now offer + user group display options. + +13. VERY IMPORTANT!!! Make sure the php.ini setting for memory_limit is set to + a minimum of 12M, we recommend 48M: + memory_limit = 48M + Some of the scripts have grown in size and need more memory to run + properly on some systems. + +14. Added ability to control access to each admin section by vicidial_users. + This includes a view_reports settings to restrict access to all of the + reports scripts. + +15. Added Agent Pause Codes that are definable per campaign and allows the + agent to select what they are doing when they are in pause time. + +16. Added optional Asterisk-compatible queue_log logging for QueueMetrics + compatibility. See the QUEUEMETRICS.txt doc for more information + +17. RECOMMENDATION - If you are calling in the USA, you should add the + "--postal-code-gmt" flag to your adjust GMT script in the crontab to + more accurately assign timezones to your leads. + +18. Changed dial statuses to use dynamic number of dial statuses instead of + static dial_status_x fields. + +19. Added Mute/UnMute ability to vicidial.php agent screen. To use, you must + have the _X18600XXX and _X28600XXX entries in your extensions.conf + +20. Added basic sipsak display on compatible SIP devices for VICIDIAL activity. + +21. Tested with Asterisk 1.2.16 and 1.2.17, new patch for meetme volume controls + for those two versions, see SCRATCH_INSTALL for more info. + +22. Added HOME link to the admin web page that goes to a configurable web address. + + + + + + +########## UPGRADING FROM 2.0.1 TO 2.0.2 ########## + +1. install new files: + perl ./install.pl + NOTES: If you have customized any scripts in the bin or agi folders, + then make sure you back them up before running the install.pl script. + This script will replace existing files in the astguiclient installation. + + /etc/astguiclient.conf has new variables for new functionality including: + - new ADMIN_keepalive_ALL process settings + - FastAGI_log server settings + and comments are added to the astguiclient.conf file + +2. upgrade the MySQL asterisk database: + mysql + use asterisk + \. /path/from/root/extras/upgrade_2.0.2.sql + quit + /usr/share/astguiclient/ADMIN_area_code_populate.pl + The Daylight Savings Time scheme for the USA and Canada has been + updated for the 2007 changes. Also, Brazil DST has been added. + Another addition on this topic is the addition of USA zipcode + GMT offset list that allows for more accurate timezone lookups. + +3. The astguiclient web directory has been removed and the + astguiclient/admin.php functions have been merged into the + vicidial/admin.php page + +4. You can now define trunks for use only by specific campaigns. See the help + in the vicidial/admin.php server modification page under the + VICIDIAL SERVER TRUNKS section. + +5. Agents now have the ability to control volume levels for any call in their + meetme room directly from the vicidial.php page. This only works on + Asterisk 1.2.7.1, 1.2.12.1, 1.2.13 or SVN_1.2 and the meetmeadmin_volume_control.patch + patch must be applied as described in the SCRATCH_INSTALL. Also, a few + lines must be added to the extensions.conf for this to work: + (_X48600XXX, _X38600XXX, 8300 [see docs/conf_examples/extensions.conf.sample]) + +6. Multiple ADMIN_keepalive scripts have been replaced with a single script + ADMIN_keepalive_ALL.pl + Remove all other ADMIN keepalive entries in your crontab and replace + with this one: + ### keepalive script for astguiclient processes + * * * * * /usr/share/astguiclient/ADMIN_keepalive_ALL.pl + + NOTE: the scripts to be kept alive are to be defined in the astguiclient.conf file + +7. FastAGI replacement for call_log and VD_hangup AGI scripts: + FastAGI_log.pl - requires cpan module Net::Server to run + If you want to use it, read the comments at the top of the script + Look at the docs/conf_examples/extensions.conf.sample file for examples + of how to use this new feature in your dialplan + - cpan + - install Net::Server + +8. Fix for unregistered SIP trunks (thanks to Chris Doyle): + look at the bottom of the docs/conf_examples/extensions.conf.sample + file for examples of what to put in your extensions.conf file to get + VICIDIAL auto dialing to work with non-registered SIP trunks. remember + to put sip-silence.gsm in your /var/lib/asterisk/sounds/ directory. + +9. Added new campaign summary screen and reformatted the timeonVDADall report: + A summary screen with all of the call information for every active + campaign for the day. reformatted campaign Realtime report with new + colors and other display options. + +10. Added new script to change the server_ip entries when a machine changes IPs + The ADMIN_update_server_ip.pl script can be used to update your server's + IP address within all vicidial database tables and config files from + this one script. This can even be run in the crontab if you are on + a DHCP service and need to modify your IP address often + +11. Added new script to allow for dial-out-only(no agents on the server) + VICIDIAL servers as well as balance dialing where a server with + available trunk lines can dial lines for another server that does not + have enough lines to dial for it's dial_level. AST_VDauto_dial_FILL.pl + script is only for multi-server systems and is started from new + ADMIN_keepalive_ALL.pl script with option 7 in astguiclient.conf + +12. Added the ability to restrict agent logins by user group to a specific set + of campaigns. This is definable in the USER GROUPS section of admin.php. + You must make sure that your admin login is in a user group and that + the selected user group has the allowable campaigns set to ALL + CAMPAIGNS to be able to view and modify all campaigns in the system. + +13. Added lead_id and user fields to the recording_log, along with cross- + reference links in several admin web pages for these. + +14. Changed Drop percentage to be out of Answered calls for FTC compliance. + +15. Tested new asterisk-perl module (0.09) and found that it is NOT compatible. + Please make sure you use asterisk-perl-0.08 ONLY. + + + + + +########## UPGRADING FROM 1.1.12-3 TO 2.0.1 ########## + +If you are upgrading to the 2.0 code tree from the 1.1.12-3 release there have +been several changes made to the code base and to where some files are stored in +the release as well as on your machine. + +1. upgrade the MySQL Asterisk database: + mysql + use asterisk + \. /path/from/root/extras/upgrade_2.0.1.sql + quit + + +2. use the new installer for astguiclient-VICIDIAL files: + NOTE: this new script is interactive with prompts. this script will + create the new /etc/astguiclient.conf settings file that replaces the + old AST_SERVER_conf.pl file that has been removed. Also, this settings + file is used by dbconnect.php scripts so no need to manually edit them + + perl install.pl + + +3. Make sure you have MySQL clientlibs installed: +Because all perl script now use DBI instead of Net::MySQL you need to make sure +that you have at least the MySQL client installed on all VICIDIAL servers even +if the MySQL server is installed on another machine. You can skip this step if +MySQL server is already on your VICIDIAL server: + Go to http://www.mysql.com/ and download the mysql package + - to install this directly on the command line type: + - cd /usr/local + - wget http://mirror.trouble-free.net/mysql_mirror/Downloads/MySQL-4.0/mysql-4.0.27.tar.gz + - gunzip mysql-4.0.27.tar.gz + - tar xvf mysql-4.0.27.tar + - cd mysql-4.0.27 + - groupadd mysql + - useradd -g mysql mysql + - "./configure --prefix=/usr/local/mysql --without-server --enable-shared=yes --with-readline" + - make + - make install + - you are done + + +4. New MySQL perl modules: +You will need to make sure that you have installed the following perl modules: +DBI (top-level Database interface module "install DBI") +DBD::mysql (MySQL-specific interface through DBI "force install DBD::mysql") + + +5. new predictive dialing crontab entry: +If you will be using the new predictive dialing functions you need to make sure +you have the keepalive for this function loaded in your crontab: +NOTE: this only needs to be on a single server if you are in a multiple +VICIDIAL server setup. +### keepalive script for VICIDIAL predictive script +* * * * * /usr/share/astguiclient/ADMIN_keepalive_AST_VDadapt.pl + + +6. all old crontab entries and /home/cron files +All of your old crontab entries need to be changed from /home/cron to +/usr/share/astguiclient if you choose the default installation path. You can +manually set the path to /home/cron if you like though since the home path is +now dynamic in all vicidial perl(.pl) scripts. If you do choose to use the new +default path, you can delete everything in the /home/cron directory if you like + + +7. old /etc/rc.d/rc.local entries +Be sure to change your /etc/rc.d/rc.local entries(the commands that are run at +system boot to start asterisk and other scripts like log rolling) and change the +/home/cron path to the new /usr/share/astguiclient path. + + +8. other notes: +- there is a new DIAL METHOD field and several other new dial-control fields +in campaign modification page, please take a minute to read the help +documentation for these new features. + + diff --git a/agc_2-X/branches/agc_2.0.4/VDconfig b/agc_2-X/branches/agc_2.0.4/VDconfig new file mode 100644 index 00000000..ffcd643e --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/VDconfig @@ -0,0 +1,924 @@ +#!/bin/sh +# +# VDconfig +# +# Copyright (C) 2007 VICIDIAL-astGUIclient LICENSE: GPLv2 +# + +# CHANGES +# 71120-0000 - Iniitial release +# 71121-1220 - Added --no-menu to merge in astguiclient.conf and save config. +# 71121-1334 - Added --env-make [make_option] to set environment before make. +# 71129-1947 - Fixed .agc-config load problem, fixed duplicate save issue. + + + +SetDefaults () +{ + # default path to astguicient configuration file: + PATHconf="/etc/astguiclient.conf" + # default path to home direct: + PATHhome="/usr/share/astguiclient" + # default path to astguiclient logs directory: + PATHlogs="/var/log/astguiclient" + # default path to asterisk agi-bin directory: + PATHagi="/var/lib/asterisk/agi-bin" + # default path to web root directory (Best guess): + PATHweb="/var/www/html" + if [ -e "/usr/apache2/htdocs" ]; then + PATHweb="/usr/apache2/htdocs" + elif [ -e "/usr/local/apache2/htdocs" ]; then + PATHweb="/usr/local/apache2/htdocs" + fi + # default path to asterisk sounds directory: + PATHsounds="/var/lib/asterisk/sounds" + # default path to asterisk recording directory: + PATHmonitor="/var/spool/asterisk/monitor" + # default path to asterisk recording DONE directory: + PATHDONEmonitor="/var/spool/asterisk/monitorDONE" + # the IP address of this machine. default to best guess: + VARserver_ip=`/sbin/ifconfig eth0 | grep 'inet addr' | awk -F: '{ print $2 }' | awk '{ print $1 }'` + # default database server variables: + VARDB_server="localhost" + VARDB_database="asterisk" + VARDB_user="cron" + VARDB_pass="1234" + VARDB_port="3306" + # default keepalive processes: + VARactive_keepalives="123456" + # default recording FTP archive variables: + VARFTP_host=$VARserver_ip + VARFTP_user="cron" + VARFTP_pass="test" + VARFTP_port="21" + VARFTP_dir="RECORDINGS" + VARHTTP_path="http://$VARserver_ip" + # default report FTP variables: + VARREPORT_host=$VARserver_ip + VARREPORT_user="cron" + VARREPORT_pass="test" + VARREPORT_port="21" + VARREPORT_dir="REPORTS" + # defaults for FastAGI Server PreFork + VARfastagi_log_min_servers="3" + VARfastagi_log_max_servers="16" + VARfastagi_log_min_spare_servers="2" + VARfastagi_log_max_spare_servers="8" + VARfastagi_log_max_requests="1000" + VARfastagi_log_checkfordead="30" + VARfastagi_log_checkforwait="60" +} + +FileLocationConfig () +{ + DONE=no + while [ "$DONE" != "yes" ]; do + { + $DIALOG --clear --ok-label "Edit" --cancel-label "Done" \ + --backtitle "$BACKTITLE" \ + --item-help \ + --title "General Configuration Menu" \ + --menu "General configuration and file location menu.\n" \ + 15 74 8 \ + 1 "This server's IP address" "This server's IP address: $VARserver_ip" \ + 2 "Home directory" "Home directory: $PATHhome" \ + 3 "Log directory" "Log directory: $PATHlogs" \ + 4 "Web root directory" "Web root directory: $PATHweb" \ + 5 "Asterisk AGI-bin directory" "Asterisk AGI-bin direcory: $PATHagi" \ + 6 "Asterisk sounds directory" "Asterisk sounds directory: $PATHsounds" \ + 7 "Asterisk recordings directory" "Asterisk recordings directory: $PATHmonitor" \ + 8 "Asterisk recordings DONE directory" "Asterisk recordings DONE directory $PATHDONEmonitor" 2>$TEMP + + if [ "$?" != "0" ]; then + { + DONE=yes + } + else + { + set `cat $TEMP` + if [ "$1" = "1" ]; then + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "Server IP Address" \ + --inputbox "Enter this server's IP address:" 9 74 "$VARserver_ip" \ + 2> $TEMP + if [ "$?" = "0" ]; then + { + set `cat $TEMP` + VARserver_ip=$1 + } + fi + } + elif [ "$1" = "2" ]; then + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "Home Directory" \ + --inputbox "Enter the astguiclient home directory" 9 74 "$PATHhome" \ + 2> $TEMP + if [ "$?" = "0" ]; then + { + set `cat $TEMP` + PATHhome=$1 + } + fi + } + elif [ "$1" = "3" ]; then + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "Log Directory" \ + --inputbox "Enter the log directory" 9 74 "$PATHlogs" \ + 2> $TEMP + if [ "$?" = "0" ]; then + { + set `cat $TEMP` + PATHlogs=$1 + } + fi + } + elif [ "$1" = "4" ]; then + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "Web Root Directory" \ + --inputbox "Enter the web root directory:" 9 74 "$PATHweb" \ + 2> $TEMP + if [ "$?" = "0" ]; then + { + set `cat $TEMP` + PATHweb=$1 + } + fi + } + elif [ "$1" = "5" ]; then + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "Asterisk AGI-bin Directory" \ + --inputbox "Enter the location of Asterisk's AGI-bin directory:" 9 74 "$PATHagi" \ + 2> $TEMP + if [ "$?" = "0" ]; then + { + set `cat $TEMP` + PATHagi=$1 + } + fi + } + elif [ "$1" = "6" ]; then + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "Asterisk Sound Directory" \ + --inputbox "Enter the location of Asterisk's sounds directory:" 9 74 "$PATHsounds" \ + 2> $TEMP + if [ "$?" = "0" ]; then + { + set `cat $TEMP` + PATHsounds=$1 + } + fi + } + elif [ "$1" = "7" ]; then + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "Asterisk Recording Directory" \ + --inputbox "Enter the location of Asterisk's recordings directory:" 9 74 "$PATHmonitor" \ + 2> $TEMP + if [ "$?" = "0" ]; then + { + set `cat $TEMP` + PATHmonitor=$1 + } + fi + } + elif [ "$1" = "8" ]; then + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "Asterisk Recording Completed Directory" \ + --inputbox "Enter the location of Asterisk's recording completion directory:" 9 74 "$PATHDONEmonitor" \ + 2> $TEMP + if [ "$?" = "0" ]; then + { + set `cat $TEMP` + PATHDONEmonitor=$1 + } + fi + } + fi + } + fi + } + done + return 0 +} + +DatabaseConfig () +{ + DONE=no + while [ "$DONE" != "yes" ]; do + { + $DIALOG --clear --ok-label "Edit" --cancel-label "Done" \ + --backtitle "$BACKTITLE" \ + --item-help \ + --title "Database Configuration Menu" \ + --menu "Setup database access parameters.\n" \ + 12 74 5 \ + 1 "MySQL server" "MySQL server: $VARDB_server" \ + 2 "MySQL port" "MySQL port: $VARDB_port" \ + 3 "MySQL database" "MySQL database: $VARDB_database" \ + 4 "MySQL user" "MySQL user: $VARDB_user" \ + 5 "MySQL password" "MySQL password: $VARDB_pass" \ + 2> $TEMP + + if [ "$?" != "0" ]; then + { + DONE=yes + } + else + { + set `cat $TEMP` + if [ "$1" = "1" ]; then + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "MySQL Server Address" \ + --inputbox "Enter server's IP address or hostname:" 9 74 "$VARDB_server" \ + 2> $TEMP + if [ "$?" = "0" ]; then + { + set `cat $TEMP` + VARDB_server=$1 + } + fi + } + elif [ "$1" = "2" ]; then + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "MySQL Port" \ + --inputbox "Enter port of the MySQL server:" 9 74 "$VARDB_port" \ + 2> $TEMP + if [ "$?" = "0" ]; then + { + set `cat $TEMP` + VARDB_port=$1 + } + fi + } + elif [ "$1" = "3" ]; then + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "MySQL Database" \ + --inputbox "Enter database name to use:" 9 74 "$VARDB_database" \ + 2> $TEMP + if [ "$?" = "0" ]; then + { + set `cat $TEMP` + VARDB_database=$1 + } + fi + } + elif [ "$1" = "4" ]; then + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "MySQL Username" \ + --inputbox "Enter the username:" 9 74 "$VARDB_user" \ + 2> $TEMP + if [ "$?" = "0" ]; then + { + set `cat $TEMP` + VARDB_user=$1 + } + fi + } + elif [ "$1" = "5" ]; then + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "MySQL Password" \ + --inputbox "Enter the password for the above user:" 9 74 "$VARDB_pass" \ + 2> $TEMP + if [ "$?" = "0" ]; then + { + set `cat $TEMP` + VARDB_pass=$1 + } + fi + } + fi + } + fi + } + done + return 0 +} + +RecordingConfig () +{ + DONE=no + while [ "$DONE" != "yes" ]; do + { + $DIALOG --clear --ok-label "Edit" --cancel-label "Done" \ + --backtitle "$BACKTITLE" \ + --item-help \ + --title "Recording Configuration Menu" \ + --menu "Setup recording FTP/HTTP access.\n" \ + 13 74 6 \ + 1 "FTP host" "FTP host: $VARFTP_host" \ + 2 "FTP port" "FTP port: $VARFTP_port" \ + 3 "FTP user" "FTP user: $VARFTP_user" \ + 4 "FTP password" "FTP password: $VARFTP_pass" \ + 5 "FTP directory" "FTP directory: $VARFTP_dir" \ + 6 "HTTP path" "HTTP path: $VARHTTP_path" \ + 2> $TEMP + + if [ "$?" != "0" ]; then + { + DONE=yes + } + else + { + set `cat $TEMP` + if [ "$1" = "1" ]; then + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "FTP Server Address" \ + --inputbox "Enter server's IP address or hostname:" 9 74 "$VARFTP_host" \ + 2> $TEMP + if [ "$?" = "0" ]; then + { + set `cat $TEMP` + VARFTP_host=$1 + } + fi + } + elif [ "$1" = "2" ]; then + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "FTP Port" \ + --inputbox "Enter port of the FTP server:" 9 74 "$VARFTP_port" \ + 2> $TEMP + if [ "$?" = "0" ]; then + { + set `cat $TEMP` + VARFTP_port=$1 + } + fi + } + elif [ "$1" = "3" ]; then + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "FTP Username" \ + --inputbox "Enter username:" 9 74 "$VARFTP_user" \ + 2> $TEMP + if [ "$?" = "0" ]; then + { + set `cat $TEMP` + VARFTP_user=$1 + } + fi + } + elif [ "$1" = "4" ]; then + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "FTP Password" \ + --inputbox "Enter the password:" 9 74 "$VARFTP_pass" \ + 2> $TEMP + if [ "$?" = "0" ]; then + { + set `cat $TEMP` + VARFTP_pass=$1 + } + fi + } + elif [ "$1" = "5" ]; then + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "FTP Directory" \ + --inputbox "Enter the directory to upload to:" 9 74 "$VARFTP_dir" \ + 2> $TEMP + if [ "$?" = "0" ]; then + { + set `cat $TEMP` + VARFTP_dir=$1 + } + fi + } + elif [ "$1" = "6" ]; then + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "HTTP Path" \ + --inputbox "Enter the HTTP path to the FTP uploads:" 9 74 "$VARHTTP_path" \ + 2> $TEMP + if [ "$?" = "0" ]; then + { + set `cat $TEMP` + VARHTTP_path=$1 + } + fi + } + fi + } + fi + } + done + return 0 +} + +ReportingConfig () +{ + DONE=no + while [ "$DONE" != "yes" ]; do + { + $DIALOG --clear --ok-label "Edit" --cancel-label "Done" \ + --backtitle "$BACKTITLE" \ + --item-help \ + --title "Reporting Configuration Menu" \ + --menu "Setup reporting FTP access.\n" \ + 12 74 5 \ + 1 "FTP host" "FTP host: $VARREPORT_host" \ + 2 "FTP port" "FTP port: $VARREPORT_port" \ + 3 "FTP user" "FTP user: $VARREPORT_user" \ + 4 "FTP password" "FTP password: $VARREPORT_pass" \ + 5 "FTP directory" "FTP directory: $VARREPORT_dir" \ + 2> $TEMP + + if [ "$?" != "0" ]; then + { + DONE=yes + } + else + { + set `cat $TEMP` + if [ "$1" = "1" ]; then + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "FTP Server Address" \ + --inputbox "Enter server's IP address or hostname:" 9 74 "$VARFTP_host" \ + 2> $TEMP + if [ "$?" = "0" ]; then + { + set `cat $TEMP` + VARFTP_host=$1 + } + fi + } + elif [ "$1" = "2" ]; then + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "FTP Port" \ + --inputbox "Enter port of the FTP server:" 9 74 "$VARFTP_port" \ + 2> $TEMP + if [ "$?" = "0" ]; then + { + set `cat $TEMP` + VARFTP_port=$1 + } + fi + } + elif [ "$1" = "3" ]; then + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "FTP Username" \ + --inputbox "Enter username:" 9 74 "$VARFTP_user" \ + 2> $TEMP + if [ "$?" = "0" ]; then + { + set `cat $TEMP` + VARFTP_user=$1 + } + fi + } + elif [ "$1" = "4" ]; then + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "FTP Password" \ + --inputbox "Enter the password:" 9 74 "$VARFTP_pass" \ + 2> $TEMP + if [ "$?" = "0" ]; then + { + set `cat $TEMP` + VARFTP_pass=$1 + } + fi + } + elif [ "$1" = "5" ]; then + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "FTP Directory" \ + --inputbox "Enter the directory to upload to:" 9 74 "$VARFTP_dir" \ + 2> $TEMP + if [ "$?" = "0" ]; then + { + set `cat $TEMP` + VARFTP_dir=$1 + } + fi + } + fi + } + fi + } + done + return 0 +} + +FastAGIConfig () +{ + DONE=no + while [ "$DONE" != "yes" ]; do + { + $DIALOG --clear --ok-label "Edit" --cancel-label "Done" \ + --backtitle "$BACKTITLE" \ + --item-help \ + --title "FastAGI Configuration Menu" \ + --menu "Settings for FastAGI logging server.\n" \ + 14 74 7 \ + 1 "Minimum Servers ($VARfastagi_log_min_servers)" "Minimum Servers: $VARfastagi_log_min_servers" \ + 2 "Maximum Servers ($VARfastagi_log_max_servers)" "Maximum Servers: $VARfastagi_log_max_servers" \ + 3 "Minimum Spares ($VARfastagi_log_min_spare_servers)" "Minimum Spares: $VARfastagi_log_min_spare_servers" \ + 4 "Maximum Spares ($VARfastagi_log_max_spare_servers)" "Maximum Spares: $VARfastagi_log_max_spare_servers" \ + 5 "Maximum Requests ($VARfastagi_log_max_requests)" "Maximum Requests: $VARfastagi_log_max_requests" \ + 6 "Check for Dead ($VARfastagi_log_checkfordead)" "Check for Dead: $VARfastagi_log_checkfordead" \ + 7 "Check for Wait ($VARfastagi_log_checkforwait)" "Check for Wait: $VARfastagi_log_checkforwait" \ + 2> $TEMP + + if [ "$?" != "0" ]; then + { + DONE=yes + } + else + { + set `cat $TEMP` + if [ "$1" = "1" ]; then + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "FastAGI Logger Minimum Servers" \ + --inputbox "Enter the minimum servers to run:" 9 74 "$VARfastagi_log_min_servers" \ + 2> $TEMP + if [ "$?" = "0" ]; then + { + set `cat $TEMP` + VARfastagi_log_min_servers=$1 + } + fi + } + elif [ "$1" = "2" ]; then + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "FastAGI Logger Maximum Servers" \ + --inputbox "Enter the maximum number of servers to run:" 9 74 "$VARfastagi_log_max_servers" \ + 2> $TEMP + if [ "$?" = "0" ]; then + { + set `cat $TEMP` + VARfastagi_log_max_servers=$1 + } + fi + } + elif [ "$1" = "3" ]; then + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "FastAGI Logger Minimum Spare Servers" \ + --inputbox "Enter the minimum number of spares:" 9 74 "$VARfastagi_log_min_spare_servers" \ + 2> $TEMP + if [ "$?" = "0" ]; then + { + set `cat $TEMP` + VARfastagi_log_min_spare_servers=$1 + } + fi + } + elif [ "$1" = "4" ]; then + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "FastAGI Logger Maximum Spare Servers" \ + --inputbox "Enter the maximum number of spares:" 9 74 "$VARfastagi_log_max_spare_servers" \ + 2> $TEMP + if [ "$?" = "0" ]; then + { + set `cat $TEMP` + VARfastagi_log_max_spare_servers=$1 + } + fi + } + elif [ "$1" = "5" ]; then + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "FastAGI Logger Maximum Requests" \ + --inputbox "Enter the maximum requests before killing server:" 9 74 "$VARfastagi_log_max_requests" \ + 2> $TEMP + if [ "$?" = "0" ]; then + { + set `cat $TEMP` + VARfastagi_log_max_requests=$1 + } + fi + } + elif [ "$1" = "6" ]; then + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "FastAGI Logger Check for Dead" \ + --inputbox "Enter the check for dead time:" 9 74 "$VARfastagi_log_checkfordead" \ + 2> $TEMP + if [ "$?" = "0" ]; then + { + set `cat $TEMP` + VARfastagi_log_cheackfordead=$1 + } + fi + } + elif [ "$1" = "7" ]; then + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "FastAGI Logger Check for Wait" \ + --inputbox "Enter the check for wait time:" 9 74 "$VARfastagi_log_checkforwait" \ + 2> $TEMP + if [ "$?" = "0" ]; then + { + set `cat $TEMP` + VARfastagi_log_checkforwait=$1 + } + fi + } + fi + } + fi + } + done + return 0 +} + +RunPerlKeepAliveSep () +{ + KATMP="/tmp/.agc.conf.katmp.$$" + KAPTMP="/tmp/.agc.conf.kaptmp.$$" + echo '$k1 = "off"; $k2 = "off"; $k3 = "off"; $k4 = "off"; $k5 = "off"; $k6 = "off"; $k7 = "off";' > $KAPTMP + echo 'foreach $i (split //, $ARGV[0]) {' >> $KAPTMP + echo ' if ($i eq "1") { $k1 = "on"; } elsif ($i eq "2") { $k2 = "on";' >> $KAPTMP + echo ' } elsif ($i eq "3") { $k3 = "on"; } elsif ($i eq "4") { $k4 = "on";' >> $KAPTMP + echo ' } elsif ($i eq "5") { $k5 = "on"; } elsif ($i eq "6") { $k6 = "on";' >> $KAPTMP + echo ' } elsif ($i eq "7") { $k7 = "on"; }' >> $KAPTMP + echo '}' >> $KAPTMP + echo 'print "K1=$k1\nK2=$k2\nK3=$k3\nK4=$k4\nK5=$k5\nK6=$k6\nK7=$k7\n";' >> $KAPTMP + perl $KAPTMP $VARactive_keepalives >> $KATMP + . $KATMP + rm -f $KAPTMP + rm -f $KATMP +} + +KeepaliveConfig () +{ + RunPerlKeepAliveSep + DONE=no + while [ "$DONE" != "yes" ]; do + { + $DIALOG --clear --ok-label "Done" \ + --backtitle "$BACKTITLE" \ + --no-cancel \ + --item-help \ + --title "Keepalive Configuration Menu" \ + --checklist "Settings for keepalive processes.\nDeselect all items if you do not want any keepalive processes running.\n\nUse (Space) to select/deselect items." \ + 17 74 7 \ + 1 "AST_update" "$K1" "" \ + 2 "AST_send_listen" "$K2" "" \ + 3 "AST_VDauto_dial" "$K3" "" \ + 4 "AST_VDremote_agents" "$K4" "" \ + 5 "AST_VDadapt" "$K5" "If multi-server system, this must only be on one server." \ + 6 "FastAGI Logger" "$K6" "" \ + 7 "AST_VDauto_dial_FILL" "$K7" "Only for multi-server, this must only be on one server." \ + 2> $TEMP + + if [ "$?" = "0" ]; then + { + DONE=yes + VARactive_keepalives=`cat $TEMP | tr -d '"' | tr -d ' '` + if [ "$VARactive_keepalives" = "" ]; then + { + VARactive_keepalives="X" + } + fi + } + fi + } + done + return 0 +} + + +SaveConfig () + { + echo "# astguiclient.conf - configuration elements for the astguiclient package" > $PATHconf + echo "# this is the astguiclient configuration file" >> $PATHconf + echo "# all comments will be lost if you run install.pl again" >> $PATHconf + echo "AGCversion => $AGCversion" >> $PATHconf + echo "" >> $PATHconf + echo "# Paths used by astGUIclient" >> $PATHconf + echo "PATHhome => $PATHhome" >> $PATHconf + echo "PATHlogs => $PATHlogs" >> $PATHconf + echo "PATHagi => $PATHagi" >> $PATHconf + echo "PATHweb => $PATHweb" >> $PATHconf + echo "PATHsounds => $PATHsounds" >> $PATHconf + echo "PATHmonitor => $PATHmonitor" >> $PATHconf + echo "" >> $PATHconf + echo "# The IP address of this machine" >> $PATHconf + echo "VARserver_ip => $VARserver_ip" >> $PATHconf + echo "" >> $PATHconf + echo "# Database connection information" >> $PATHconf + echo "VARDB_server => $VARDB_server" >> $PATHconf + echo "VARDB_database => $VARDB_database" >> $PATHconf + echo "VARDB_user => $VARDB_user" >> $PATHconf + echo "VARDB_pass => $VARDB_pass" >> $PATHconf + echo "VARDB_port => $VARDB_port" >> $PATHconf + echo "" >> $PATHconf + echo "# Alpha-Numeric list of the astGUIclient processes to be kept running" >> $PATHconf + echo "# (value should be listing of characters with no spaces: 123456)" >> $PATHconf + echo "# X - NO KEEPALIVE PROCESSES (use only if you want none to be keepalive)" >> $PATHconf + echo "# 1 - AST_update" >> $PATHconf + echo "# 2 - AST_send_listen" >> $PATHconf + echo "# 3 - AST_VDauto_dial" >> $PATHconf + echo "# 4 - AST_VDremote_agents" >> $PATHconf + echo "# 5 - AST_VDadapt (If multi-server system, this must only be on one server)" >> $PATHconf + echo "# 6 - FastAGI_log" >> $PATHconf + echo "# 7 - AST_VDauto_dial_FILL (only for multi-server, this must only be on one server)" >> $PATHconf + echo "VARactive_keepalives => $VARactive_keepalives" >> $PATHconf + echo "" >> $PATHconf + echo "# Settings for FastAGI logging server" >> $PATHconf + echo "VARfastagi_log_min_servers => $VARfastagi_log_min_servers" >> $PATHconf + echo "VARfastagi_log_max_servers => $VARfastagi_log_max_servers" >> $PATHconf + echo "VARfastagi_log_min_spare_servers => $VARfastagi_log_min_spare_servers" >> $PATHconf + echo "VARfastagi_log_max_spare_servers => $VARfastagi_log_max_spare_servers" >> $PATHconf + echo "VARfastagi_log_max_requests => $VARfastagi_log_max_requests" >> $PATHconf + echo "VARfastagi_log_checkfordead => $VARfastagi_log_checkfordead" >> $PATHconf + echo "VARfastagi_log_checkforwait => $VARfastagi_log_checkforwait" >> $PATHconf + echo "" >> $PATHconf + echo "# Recording FTP archive variables" >> $PATHconf + echo "VARFTP_host => $VARFTP_host" >> $PATHconf + echo "VARFTP_user => $VARFTP_user" >> $PATHconf + echo "VARFTP_pass => $VARFTP_pass" >> $PATHconf + echo "VARFTP_port => $VARFTP_port" >> $PATHconf + echo "VARFTP_dir => $VARFTP_dir" >> $PATHconf + echo "VARHTTP_path => $VARHTTP_path" >> $PATHconf + echo "" >> $PATHconf + echo "# Report FTP variables" >> $PATHconf + echo "VARREPORT_host => $VARREPORT_host" >> $PATHconf + echo "VARREPORT_user => $VARREPORT_user" >> $PATHconf + echo "VARREPORT_pass => $VARREPORT_pass" >> $PATHconf + echo "VARREPORT_port => $VARREPORT_port" >> $PATHconf + echo "VARREPORT_dir => $VARREPORT_dir" >> $PATHconf + + chmod 644 $PATHconf + + MESSAGE="Configuration: $PATHconf" + EXIT="yes" + } + +############################################################################# +## Main Program +if ! which dialog > /dev/null; then +{ + echo "dialog not found!" + exit 1 +} +fi + +DIALOG="dialog" +TEMP="/tmp/.agc.tmp.$$" +EXIT="no" +MESSAGE="Abnormal Termination" + +# Source to environment and do not print messages. +if [ "$1" = "--env-make" ]; then + EXIT="yes" + OUTPUT="no" +fi + +if [ "$1" = "--no-menu" ]; then + EXIT="yes" + MENU="no" +fi + +# If a config for install is in current directory, use that. +if [ -f ".agc.config" ]; then +{ + PATHconf=".agc.config" +} +fi + +# Set defaults and load configuration. +SetDefaults +if [ -f "version" ]; then +{ + AGCversion=`cat version` + INSTALL="yes" + PATHconf=".agc.config" +} +fi +if [ -f "$PATHconf" ]; then +{ + CONFIG="/tmp/.agc.conf.$$" + if [ "$OUTPUT" != "no" ]; then + echo "Loading saved configuration from $PATHconf" + sleep 1 + fi + sed 's/[ |>|\t]//g' $PATHconf > $CONFIG + . $CONFIG + rm -f $CONFIG +} +fi + +# If version is blank, assume 2.0.3" +if [ "$AGCversion" = "" ]; then +{ + AGCversion="2.0.3" +} +fi + +while [ "$EXIT" != "yes" ]; do + { + BACKTITLE="VICIDIAL-astGUIclient $AGCversion Configuration" + MM_TEXT="Welcome to the VICIDIAL-astGUIclient Configuration Menu." + MM_TEXT="$MM_TEXT\nHere can configure the default settings for" + MM_TEXT="$MM_TEXT VICIDIAL-astGUIclient." + if [ "$INSTALL" = "yes" ]; then + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "Main Configuration Menu" \ + --menu "$MM_TEXT" 18 74 10 \ + 1 "General configuration & file locations" \ + 2 "Database configuration" \ + 3 "Recording (FTP) configuration" \ + 4 "Reporting (FTP) configuration" \ + 5 "FastAGI server configuration" \ + 6 "Active Keepalives" \ + - "---------------------------------------" \ + 7 "Save configuration & exit" \ + 8 "Exit WITHOUT saving" \ + 9 "Save configuration & install" \ + 2>$TEMP + } + else + { + $DIALOG --clear --backtitle "$BACKTITLE" \ + --title "Main Configuration Menu" \ + --menu "$MM_TEXT" 17 74 9 \ + 1 "General configuration & file locations" \ + 2 "Database configuration" \ + 3 "Recording (FTP) configuration" \ + 4 "Reporting (FTP) configuration" \ + 5 "FastAGI server configuration" \ + 6 "Active Keepalives" \ + - "--------------------------------------" \ + 7 "Save configuration & exit" \ + 8 "Exit WITHOUT saving" \ + 2>$TEMP + } + fi + + if [ "$?" != "0" ]; then + { + MESSAGE="Configuration cancelled!" + EXIT="yes" + } + else + { + set `cat $TEMP` + if [ "$1" = "1" ]; then FileLocationConfig + elif [ "$1" = "2" ]; then DatabaseConfig + elif [ "$1" = "3" ]; then RecordingConfig + elif [ "$1" = "4" ]; then ReportingConfig + elif [ "$1" = "5" ]; then FastAGIConfig + elif [ "$1" = "6" ]; then KeepaliveConfig + elif [ "$1" = "7" ]; then SaveConfig + elif [ "$1" = "8" ]; then + { + MESSAGE="Configuration NOT saved!" + EXIT=yes + } + elif [ "$1" = "9" ]; then + { + SaveConfig + RUNINSTALL=yes + } + fi + } + fi +} +done + +if [ "$MENU" = "no" ]; then + SaveConfig +fi + +rm -f $TEMP +if [ "$OUTPUT" != "no" ]; then + echo "$0 written by Lott Caskey, 2007-11-19." + echo + echo + echo $MESSAGE +fi + +if [ "$1" = "--env-make" ]; then + export PATHconf PATHhome PATHlogs PATHagi PATHweb PATHsounds + export PATHmonitor PATHDONEmonitor DESTDIR + make $2 +fi + +if [ "$RUNINSTALL" = "yes" ]; then + export PATHconf PATHhome PATHlogs PATHagi PATHweb PATHsounds + export PATHmonitor PATHDONEmonitor DESTDIR + make install +fi diff --git a/agc_2-X/branches/agc_2.0.4/agi/VD_amd.agi b/agc_2-X/branches/agc_2.0.4/agi/VD_amd.agi new file mode 100644 index 00000000..162bf7d8 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/agi/VD_amd.agi @@ -0,0 +1,448 @@ +#!/usr/bin/perl +# +# VD_amd.agi version 2.0.4 *DBI-version* +# +# NOTE: This script is only needed with app_amd enabled systems +# +# runs after a call goes through AMD in extensions.conf to send the call on to +# it's proper destination +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ; VICIDIAL_auto_dialer transfer script AMD with Load Balanced: +# exten => 8369,1,AGI(call_log.agi,${EXTEN}) +# exten => 8369,2,(AMD),AMD +# exten => 8369,3,AGI(VD_amd.agi,${EXTEN}) +# exten => 8369,4,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +# exten => 8369,5,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +# exten => 8369,6,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +# exten => 8369,7,Hangup +# +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# +# changes: +# 60206-1434 first build +# 60207-1205 added database records entries/modifications +# 60207-1507 added ability to send AMs to campaign-defined message to leave +# 60731-1407 - changed to use DBI-DBD::mysql +# - changed to use /etc/astguiclient.conf for configs +# 60815-1310 - added output options check from database +# 71118-0252 - compatibility with Asterisk 1.4, added AA and AM statuses +# + +$script = 'VD_amd.agi'; + +$A = 1; # set to 1 for AMD output messages mode +$AMD_LOG = 1; # set to 1 for logfile + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +if (!$VARDB_port) {$VARDB_port='3306';} +if (!$AGILOGfile) {$AGILOGfile = "$PATHlogs/agiout.$year-$mon-$mday";} + +use DBI; +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### Grab Server values from the database +$stmtA = "SELECT agi_output FROM servers where server_ip = '$VARserver_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + $AGILOG = '0'; + @aryA = $sthA->fetchrow_array; + $DBagi_output = "$aryA[0]"; + if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';} + if ($DBagi_output =~ /FILE/) {$AGILOG = '2';} + if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';} + $rec_count++; + } +$sthA->finish(); + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + if ($AGILOG) {$agi_string = "Perl Environment Dump:"; &agi_output;} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($AGILOG) {$agi_string = "$i|$ARGV[$i]"; &agi_output;} + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} + + +$|=1; +while() +{ + chomp; + last unless length($_); + if ($AGILOG) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_priority\:\s+(.*)$/) {$priority = $1;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1; $calleridnum = $callerid;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} +} + +if ( (length($callerid)>20) && ($callerid =~ /\"\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S/) ) + { + $callerid =~ s/^\"//gi; + $callerid =~ s/\".*$//gi; +# ### set the callerid to the ACQS value(calleridname) +# print "SET CALLERID $callerid\n"; +# checkresult($result); +# print STDERR "callerID changed: $callerid\n"; + + } +if ( ( +(length($calleridname)>5) && ( (!$callerid) or ($callerid =~ /unknown|private|00000000/i) or ($callerid =~ /5551212/) ) +) or ( (length($calleridname)>17) && ($calleridname =~ /\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/) ) ) + { + $callerid = $calleridname; +# ### set the callerid to the ACQS value(calleridname) +# print "SET CALLERID $callerid\n"; +# checkresult($result); +# print STDERR "callerID changed: $callerid\n"; + } + + +if ($AGILOG) {$agi_string = "AGI Environment Dump:"; &agi_output;} + +foreach $i (sort keys %AGI) +{ + if ($AGILOG) {$agi_string = " -- $i = $AGI{$i}"; &agi_output;} +} + +if ($AGILOG) {$agi_string = "AGI Variables: |$unique_id|$channel|$extension|$type|$callerid|"; &agi_output;} + + +$VDADcampaign=''; +$VDADphone=''; +$VDADphone_code=''; + +$callerid =~ s/\"//gi; +$CIDlead_id = $callerid; +$CIDlead_id = substr($CIDlead_id, 11, 9); +$CIDlead_id = ($CIDlead_id + 0); +$VD_lead_id = $CIDlead_id; + +if ($AGILOG) {$agi_string = "+++++ VD amd START : |$CIDlead_id|$now_date|$AST_ver|$priority|$calleridname|"; &agi_output;} + + +if ( ($channel =~ /Local/i) && ($AST_ver !~ /^1\.0\.8|^1\.0\.9/) ) +{ +if ($AGILOG) {$agi_string = "+++++ VDAD START LOCAL CHANNEL: EXITING- $priority"; &agi_output;} +if ($priority > 2) {sleep(1);} +exit; +} + + + +$AMDSTATUS = $AGI->get_variable(AMDSTATUS); +$AMDCAUSE = $AGI->get_variable(AMDCAUSE); + +if ($A) +{ +if ($AGILOG) {$agi_string = "AAAAA AMD results: |$AMDSTATUS|$AMDCAUSE|"; &agi_output;} +} + +# Asterisk 1.2.X +# AAAAA AMD results: |AMD_PERSON|AMD_HUMAN-300-300| +# AAAAA AMD results: |AMD_MACHINE|AMD_LONGGREETING-1500-1500| +# Asterisk 1.4.X: +# AAAAA AMD results: |HUMAN|HUMAN-1000-1000|0000000000| +# AAAAA AMD results: |MACHINE|MAXWORDS-4-4|0000000000| + +if ($AMD_LOG) + { + open(Lout, ">>$PATHlogs/AMD_log.txt") + || die "Can't open $PATHlogs/AMD_log.txt: $!\n"; + print Lout "$now_date|$VD_lead_id| |$AMDSTATUS|$AMDCAUSE|$calleridnum|\n"; + close(Lout); + } + + +################################################################################## +########## AMD says it's a person so exit and go on to transfer scripts ########## +if ($AMDSTATUS =~ /PERSON|HUMAN|NOTSURE|HANGUP/) +{ + if ($A) + { + if ($AGILOG) {$agi_string = " AMD exiting"; &agi_output;} + } + exit; +} + +else +{ +################################################################################ +########## AMD says it's a machine so modify statuses and hangup call ########## +########## something will go here later for leaving a message on AMs ########## + + +########## FIND ext_context from the servers table ########## +$stmtA = "SELECT ext_context FROM servers where server_ip = '$VARserver_ip';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBext_context = "$aryA[0]"; + if ($DBext_context) {$ext_context = $DBext_context;} + $rec_count++; + } +$sthA->finish(); + + +########## FIND vicidial_auto_calls record ########## +$stmtA = "SELECT campaign_id,phone_code,phone_number FROM vicidial_auto_calls where callerid='$callerid' order by auto_call_id desc limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VD_campaign_id = "$aryA[0]"; + $VD_phone_code = "$aryA[1]"; + $VD_phone_number = "$aryA[2]"; + $rec_count++; + } +$sthA->finish(); + + +########## UPDATE vicidial_list ########## +$stmtA = "UPDATE vicidial_list set status='AA' where lead_id = '$VD_lead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); +if ($AGILOG) {$agi_string = "-- VDAD vicidial_list update: |$affected_rows|$VD_lead_id"; &agi_output;} + +########## DELETE vicidial_auto_calls entry ########## +$stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' order by auto_call_id desc limit 1;"; + $affected_rows = $dbhA->do($stmtA); +if ($AGILOG) {$agi_string = "-- VDAC record deleted: |$affected_rows| |$VD_lead_id|$uniqueid|$VD_callerid"; &agi_output;} + +########## FIND AND UPDATE vicidial_log ########## +$stmtA = "SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$VD_lead_id' order by call_date desc limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $epc_countCUSTDATA=0; +while ($sthArows > $epc_countCUSTDATA) + { + @aryA = $sthA->fetchrow_array; + $VD_start_epoch = "$aryA[0]"; + $epc_countCUSTDATA++; + } +$sthA->finish(); + +if (!$epc_countCUSTDATA) + { + if ($AGILOG) {$agi_string = "no VDL record found: $uniqueid $calleridname $VD_lead_id $uniqueid"; &agi_output;} + $end_epoch = ($now_date_epoch + 3); + $stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed,length_in_sec,end_epoch) values('$uniqueid','$VD_lead_id','$VD_campaign_id','$now_date','$now_date_epoch','AA','$VD_phone_code','$VD_phone_number','VDAD','N','3','$end_epoch')"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + } +else + { + $VD_seconds = ($now_date_epoch - $VD_start_epoch); + $stmtA = "UPDATE vicidial_log set status='AA',end_epoch='$now_date_epoch',length_in_sec='$VD_seconds' where uniqueid='$uniqueid' and lead_id='$VD_lead_id' order by call_date desc limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vicidial_log update: |$affected_rows|$uniqueid|"; &agi_output;} + } + + +### Grab vmail forward message values from the database +$stmtA = "SELECT am_message_exten,amd_send_to_vmx FROM vicidial_campaigns where campaign_id = '$VD_campaign_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $epc_countCUSTDATA=0; +while ($sthArows > $epc_countCUSTDATA) + { + @aryA = $sthA->fetchrow_array; + $DB_am_message_exten = "$aryA[0]"; + $DB_amd_send_to_vmx = "$aryA[1]"; + $epc_countCUSTDATA++; + } +$sthA->finish(); + +if ($AGILOG) {$agi_string = "-- AMD campaign values: |$VD_campaign_id|$DB_am_message_exten|$DB_amd_send_to_vmx|"; &agi_output;} + +if ( ($DB_amd_send_to_vmx =~ /Y/) && (length($DB_am_message_exten) > 0) ) + { + $stmtA = "UPDATE vicidial_log set status='AM' where uniqueid='$uniqueid' and lead_id='$VD_lead_id' order by call_date desc limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vicidial_log AM update: |$affected_rows|$uniqueid|"; &agi_output;} + + $stmtA = "UPDATE vicidial_list set status='AM' where lead_id='$VD_lead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vicidial_list AM update: |$affected_rows|$uniqueid|"; &agi_output;} + + if ($AGILOG) {$agi_string = "exiting the AMD app, transferring call to $DB_am_message_exten"; &agi_output;} + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $DB_am_message_exten\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + exit; + } + +$dbhA->disconnect(); + +$AGI->hangup($channel); + +exit; +} + + + + + +exit; + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + # print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} + + +sub agi_output +{ +if ($AGILOG >=2) + { + ### open the log file for writing ### + open(Lout, ">>$AGILOGfile") + || die "Can't open $AGILOGfile: $!\n"; + print Lout "$now_date|$script|$agi_string\n"; + close(Lout); + } + ### send to STDERR writing ### +if ( ($AGILOG == '1') || ($AGILOG == '3') ) + {print STDERR "$now_date|$script|$agi_string\n";} +$agi_string=''; +} diff --git a/agc_2-X/branches/agc_2.0.4/agi/VD_amd_post.agi b/agc_2-X/branches/agc_2.0.4/agi/VD_amd_post.agi new file mode 100644 index 00000000..88691897 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/agi/VD_amd_post.agi @@ -0,0 +1,311 @@ +#!/usr/bin/perl +# +# VD_amd_post.agi version 2.0.4 *DBI-version* +# +# NOTE: This script is only needed with app_amd enabled systems +# +# runs after a call goes through AMD in extensions.conf to send the call on to +# it's proper destination +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ; VICIDIAL_auto_dialer transfer script AMD with Load Balanced: +# exten => 8369,1,AGI(call_log.agi,${EXTEN}) +# exten => 8369,2,(AMD),AMD +# exten => 8369,3,AGI(VD_amd.agi,${EXTEN}) +# exten => 8369,4,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +# exten => 8369,5,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +# exten => 8369,6,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +# exten => 8369,7,Hangup +# +# ; this is used for playing a message to an answering machine forwarded from AMD in VICIDIAL +# ; replace conf with the message file you want to leave +# exten => 8320,1,WaitForSilence(2000,2) ; AMD got machine. leave message after recording +# exten => 8320,2,Playback(conf) +# exten => 8320,3,AGI(VD_amd_post.agi,${EXTEN}) +# exten => 8320,4,Hangup +# +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# +# changes: +# 60217-1119 first build +# 60731-1403 - changed to use DBI-DBD::mysql +# - changed to use /etc/astguiclient.conf for configs +# 60817-1025 - added output options check from database +# 71118-0257 - updated comments +# + +$script = 'VD_amd_post.agi'; + +$A = 1; # set to 1 for AMD output messages mode +$AMD_LOG = 0; # set to 1 for logfile + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$start_time=$now_date; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $SQLdateBEGIN = $SQLdate; + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +if (!$VARDB_port) {$VARDB_port='3306';} +if (!$AGILOGfile) {$AGILOGfile = "$PATHlogs/agiout.$year-$mon-$mday";} + +use DBI; +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### Grab Server values from the database +$stmtA = "SELECT agi_output FROM servers where server_ip = '$VARserver_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + $AGILOG = '0'; + @aryA = $sthA->fetchrow_array; + $DBagi_output = "$aryA[0]"; + if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';} + if ($DBagi_output =~ /FILE/) {$AGILOG = '2';} + if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';} + $rec_count++; + } +$sthA->finish(); + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + if ($AGILOG) {$agi_string = "Perl Environment Dump:"; &agi_output;} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($AGILOG) {$agi_string = "$i|$ARGV[$i]"; &agi_output;} + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} + +$|=1; +while() +{ + chomp; + last unless length($_); + if ($AGILOG) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_priority\:\s+(.*)$/) {$priority = $1;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} +} + +if ( (length($callerid)>20) && ($callerid =~ /\"\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S/) ) + { + $callerid =~ s/^\"//gi; + $callerid =~ s/\".*$//gi; +# ### set the callerid to the ACQS value(calleridname) +# print "SET CALLERID $callerid\n"; +# checkresult($result); +# print STDERR "callerID changed: $callerid\n"; + + } +if ( ( +(length($calleridname)>5) && ( (!$callerid) or ($callerid =~ /unknown|private|00000000/i) or ($callerid =~ /5551212/) ) +) or ( (length($calleridname)>17) && ($calleridname =~ /\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/) ) ) + { + $callerid = $calleridname; +# ### set the callerid to the ACQS value(calleridname) +# print "SET CALLERID $callerid\n"; +# checkresult($result); +# print STDERR "callerID changed: $callerid\n"; + } + + +if ($AGILOG) {$agi_string = "AGI Environment Dump:"; &agi_output;} + +foreach $i (sort keys %AGI) +{ + if ($AGILOG) {$agi_string = " -- $i = $AGI{$i}"; &agi_output;} +} + +if ($AGILOG) {$agi_string = "AGI Variables: |$unique_id|$channel|$extension|$type|$callerid|$calleridname|$priority|"; &agi_output;} + +$VDADcampaign=''; +$VDADphone=''; +$VDADphone_code=''; + + +$callerid =~ s/\"//gi; +$CIDlead_id = $callerid; +$CIDlead_id = substr($CIDlead_id, 11, 9); +$CIDlead_id = ($CIDlead_id + 0); +$VD_lead_id = $CIDlead_id; + +if ($AGILOG) {$agi_string = "+++++ VD amd START: |$CIDlead_id|$now_date|$AST_ver|"; &agi_output;} + +if ( ($channel =~ /Local/i) && ($AST_ver !~ /^1\.0\.8|^1\.0\.9/) ) +{ +if ($AGILOG) {$agi_string = "+++++ VDAD START LOCAL CHANNEL: EXITING- $priority"; &agi_output;} +if ($priority > 2) {sleep(1);} +exit; +} + + + + + + + + + + + + +################################################################################ +########## AMD says it's a machine so modify statuses and hangup call ########## +########## something will go here later for leaving a message on AMs ########## + +$stmtA = "UPDATE vicidial_log set status='AL' where lead_id='$VD_lead_id' order by call_date desc limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$affected_rows = $dbhA->do($stmtA); +if ($AGILOG) {$agi_string = "-- VDAD vicidial_log AL update: |$affected_rows|$uniqueid|"; &agi_output;} + +$stmtA = "UPDATE vicidial_list set status='AL' where lead_id='$VD_lead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$affected_rows = $dbhA->do($stmtA); +if ($AGILOG) {$agi_string = "-- VDAD vicidial_list AL update: |$affected_rows|$uniqueid|"; &agi_output;} + + +$dbhA->disconnect(); + + + + +exit; + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + # print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} + + + +sub agi_output +{ +if ($AGILOG >=2) + { + ### open the log file for writing ### + open(Lout, ">>$AGILOGfile") + || die "Can't open $AGILOGfile: $!\n"; + print Lout "$now_date|$script|$agi_string\n"; + close(Lout); + } + ### send to STDERR writing ### +if ( ($AGILOG == '1') || ($AGILOG == '3') ) + {print STDERR "$now_date|$script|$agi_string\n";} +$agi_string=''; +} diff --git a/agc_2-X/branches/agc_2.0.4/agi/VD_auto_post_VERIFY.agi b/agc_2-X/branches/agc_2.0.4/agi/VD_auto_post_VERIFY.agi new file mode 100644 index 00000000..85d786a7 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/agi/VD_auto_post_VERIFY.agi @@ -0,0 +1,392 @@ +#!/usr/bin/perl +# +# VD_auto_post_VERIFY.agi version 0.1 *DBI-version* +# +# NOTE: This script is only used with auto-message campaigns with dynamic data +# +# runs after a call is answered +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ; VICIDIAL_auto_dialer transfer script AMD with Load Balanced: +#exten => 8320,1,WaitForSilence(2000,2) ; wait for 2 seconds of silence +#exten => 8320,2,AGI(VD_auto_post_VERIFY.agi,${EXTEN}) +#exten => 8320,3,Hangup +# +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# changes: +# 60915-1616 - first build +# + +$script = 'VD_auto_post_VERIFY.agi'; + +### files to play for message of not interested or DNC and your request has been processed +$goodbye_audio_file = 'US_reminder_goodbye'; +$mc_one_file = '85100019'; +$mc_two_file = '85100021'; +$visa_one_file = '85100018'; +$visa_two_file = '85100020'; + + +#$A = 1; # set to 1 for AMD output messages mode +$AMD_LOG = 0; # set to 1 for logfile + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$start_time=$now_date; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $SQLdateBEGIN = $SQLdate; + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +if (!$VARDB_port) {$VARDB_port='3306';} +if (!$AGILOGfile) {$AGILOGfile = "$PATHlogs/agiout.$year-$mon-$mday";} + +use DBI; +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### Grab Server values from the database +$stmtA = "SELECT agi_output FROM servers where server_ip = '$VARserver_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + $AGILOG = '0'; + @aryA = $sthA->fetchrow_array; + $DBagi_output = "$aryA[0]"; + if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';} + if ($DBagi_output =~ /FILE/) {$AGILOG = '2';} + if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';} + $rec_count++; + } +$sthA->finish(); + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + if ($AGILOG) {$agi_string = "Perl Environment Dump:"; &agi_output;} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($AGILOG) {$agi_string = "$i|$ARGV[$i]"; &agi_output;} + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} + +$|=1; +while() +{ + chomp; + last unless length($_); + if ($AGILOG) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_priority\:\s+(.*)$/) {$priority = $1;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} +} + +if ( (length($callerid)>20) && ($callerid =~ /\"\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S/) ) + { + $callerid =~ s/^\"//gi; + $callerid =~ s/\".*$//gi; +# ### set the callerid to the ACQS value(calleridname) +# print "SET CALLERID $callerid\n"; +# checkresult($result); +# print STDERR "callerID changed: $callerid\n"; + + } +if ( ( +(length($calleridname)>5) && ( (!$callerid) or ($callerid =~ /unknown|private|00000000/i) or ($callerid =~ /5551212/) ) +) or ( (length($calleridname)>17) && ($calleridname =~ /\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/) ) ) + { + $callerid = $calleridname; +# ### set the callerid to the ACQS value(calleridname) +# print "SET CALLERID $callerid\n"; +# checkresult($result); +# print STDERR "callerID changed: $callerid\n"; + } + + +if ($AGILOG) {$agi_string = "AGI Environment Dump:"; &agi_output;} + +foreach $i (sort keys %AGI) +{ + if ($AGILOG) {$agi_string = " -- $i = $AGI{$i}"; &agi_output;} +} + +if ($AGILOG) {$agi_string = "AGI Variables: |$unique_id|$channel|$extension|$type|$callerid|$calleridname|$priority|"; &agi_output;} + +$VDADcampaign=''; +$VDADphone=''; +$VDADphone_code=''; + + +$callerid =~ s/\"//gi; +$CIDlead_id = $callerid; +$CIDlead_id = substr($CIDlead_id, 11, 9); +$CIDlead_id = ($CIDlead_id + 0); +$VD_lead_id = $CIDlead_id; + +if ($AGILOG) {$agi_string = "+++++ VD amd START: |$CIDlead_id|$now_date|$AST_ver|"; &agi_output;} + +if ( ($channel =~ /Local/i) && ($AST_ver !~ /^1\.0\.8|^1\.0\.9/) ) +{ +if ($AGILOG) {$agi_string = "+++++ VDAD START LOCAL CHANNEL: EXITING- $priority"; &agi_output;} +if ($priority > 2) {sleep(1);} +exit; +} + + +# Thank you for your recent purchase of ACME Sprockets, we have +# confirmed your enrollment in the + +# [Verified by Visa| MasterCard SecureCode] + +# program. Please go to www.iconfirm.net and enter your name and +# verification code + +# [verification code] + +# within the next (x amount of hours) to +# complete + +# [Verified by Visa|MasterCard SecureCode] + +# authentication. Your +# participation is optional and does not effect the processing of your +# purchase. Thank you." + + +$AGI->stream_file('beep'); + +$stmtA = "UPDATE vicidial_log set status='PU' where lead_id='$VD_lead_id' order by call_date desc limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$affected_rows = $dbhA->do($stmtA); +if ($AGILOG) {$agi_string = "-- VDAD vicidial_log PU update: |$affected_rows|$uniqueid|"; &agi_output;} + +$stmtA = "UPDATE vicidial_list set status='PU' where lead_id='$VD_lead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$affected_rows = $dbhA->do($stmtA); +if ($AGILOG) {$agi_string = "-- VDAD vicidial_list PU update: |$affected_rows|$uniqueid|"; &agi_output;} + +### Check to see if the number is in the system ### +$stmtA= "SELECT security_phrase,comments from vicidial_list where lead_id='$VD_lead_id';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $security_phrase = "$aryA[0]"; + $comments = "$aryA[1]"; + $sthA->finish(); + } +else + { + $AGI->stream_file("$goodbye_audio_file"); + } + +### first read of the message +if ($comments =~ /Master/i) + { + $message_one = $mc_one_file; + $message_two = $mc_two_file; + } +else + { + $message_one = $visa_one_file; + $message_two = $visa_two_file; + } + +if ($AGILOG) {$agi_string = "Verify message playing: |$VD_lead_id|$security_phrase|$comments|$message_one|$message_two|"; &agi_output;} + +$AGI->stream_file("$message_one"); + + sleep(1); + +$AGI->stream_file("letters/v"); +$AGI->say_digits("$security_phrase"); + + sleep(1); + + +$AGI->stream_file("$message_two"); + + + + + +$stmtA = "UPDATE vicidial_log set status='AL' where lead_id='$VD_lead_id' order by call_date desc limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$affected_rows = $dbhA->do($stmtA); +if ($AGILOG) {$agi_string = "-- VDAD vicidial_log AM update: |$affected_rows|$uniqueid|"; &agi_output;} + +$stmtA = "UPDATE vicidial_list set status='AL' where lead_id='$VD_lead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$affected_rows = $dbhA->do($stmtA); +if ($AGILOG) {$agi_string = "-- VDAD vicidial_list AM update: |$affected_rows|$uniqueid|"; &agi_output;} + +$dbhA->disconnect(); + + + + +### second read of the message + +$AGI->stream_file("$message_one"); + + sleep(1); + +$AGI->stream_file("letters/v"); +$AGI->say_digits("$security_phrase"); + + sleep(1); + + +$AGI->stream_file("$message_two"); + + + $AGI->stream_file("$goodbye_audio_file"); + + + + + + + + +exit; + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + # print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} + + + +sub agi_output +{ +if ($AGILOG >=2) + { + ### open the log file for writing ### + open(Lout, ">>$AGILOGfile") + || die "Can't open $AGILOGfile: $!\n"; + print Lout "$now_date|$script|$agi_string\n"; + close(Lout); + } + ### send to STDERR writing ### +if ( ($AGILOG == '1') || ($AGILOG == '3') ) + {print STDERR "$now_date|$script|$agi_string\n";} +$agi_string=''; +} diff --git a/agc_2-X/branches/agc_2.0.4/agi/agi-IVR_recording_verification.agi b/agc_2-X/branches/agc_2.0.4/agi/agi-IVR_recording_verification.agi new file mode 100644 index 00000000..67f876b6 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/agi/agi-IVR_recording_verification.agi @@ -0,0 +1,718 @@ +#!/usr/bin/perl +# +# agi-IVR_recording_verification.agi version 0.1 +# +# This script is designed to function as a complete automated 3rd party +# verification IVR recording system. This script will work by optionally asking +# for a company ID and/or a customer phone number, then it will play through the +# listed prompts asking for a single digit press (i.e. 1 for a yes or a 3 for a +# no, hash/pound/star/zero/0 are not accepted only 1-9 is valid for these steps). +# All data for these calls will be logged to the vicidial_ivr table as well as +# optionally to a log file in the standard astguiclient log file directory +# and/or STDERR output on the asterisk process. This script uses the +# /etc/astguiclient.conf file for database connection settings, logging data and +# for logfile path information only. +# +# With a modified VDAD agi transfer script, this script could also be used to do +# automated outbound surveys as well. Feature under development. +# +# ; 1. the DNIS or inbound number called +# ; 2. play the recording ID (Y|N) with prompt leading up to it +# ; 3. record this call(Y|N) +# ; 4. ask for a company code(Y|N) with the number of digits in that company code and the prompt +# ; 5. ask for a user code(Y|N) with the number of digits in that user code and the prompt +# ; 6. ask for the customer phone number(Y|N) with the number of digits in that phone number and the prompt (Y-10-85100001) +# ; 7. speak the current date (Y|N) with prompt announcing the date +# ; 8. a dash-delimited list of prompts that expect responses(85100002-85100003) +# ; 9. a "your recording ID is..." prompt (85100004) +# ; 10. logging/output (FILE|STDERR|BOTH|NONE) +# +# ;inbound IVR call: +#exten => 1234,1,Ringing ; call ringing +#exten => 1234,2,Wait(1) ; Wait 1 second for CID delivery from PRI +#exten => 1234,3,Answer ; Answer the line +#exten => 1234,4,AGI(agi-IVR_recording_verification.agi,7274506620---Y-85100004---Y---Y-1-85100016---N---N---Y-85100007---85100009-600--85100012-30--85100013---85100004---BOTH) +#exten => 1234,5,Hangup +# +# ;inbound IVR call from a VICIDIAL transfer: +#exten => _83002*,1,Ringing ; call ringing +#exten => _83002*,2,Wait(1) ; Wait 1 second for CID delivery +#exten => _83002*,3,Answer ; Answer the line +#exten => _83002*,4,AGI(agi-IVR_recording_verification.agi,7275551234---N---Y---N---N---Y-10-85100001---N---85100002-85100003---85100004---BOTH) +#exten => _83002*,5,Hangup +# +# +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# +# CHANGELOG +# 70912-1105 - First build, non-functional +# 70916-2331 - functional alpha version, reads all prompts and logs data, no recording yet +# 70921-1110 - full beta version with recording working +# 71028-1122 - added say datetime as an option +# 71112-0238 - added prompt delays and date announcement message +# 71120-1337 - added playing of recording ID at beginning of session +# + +&get_time_now; + $start_epoch = $now_date_epoch; + +$script = 'agi-IVR_recording_verification.agi'; + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$US='_'; + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +if (!$VARDB_port) {$VARDB_port='3306';} +if (!$AGILOGfile) {$AGILOGfile = "$PATHlogs/ivrout.$year-$mon-$mday";} + +use DBI; +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + if ($ARGV[0] =~ /---/) + { + ### list of command-line array arguments: + @ARGV_vars = split(/---/, $ARGV[0]); + + $inbound_number = $ARGV_vars[0]; + $play_ID = $ARGV_vars[1]; + $record_call = $ARGV_vars[2]; + $company_ID_ask = $ARGV_vars[3]; + $user_ID_ask = $ARGV_vars[4]; + $cust_phone_ask = $ARGV_vars[5]; + $say_date = $ARGV_vars[6]; + $prompts = $ARGV_vars[7]; + $last_prompt = $ARGV_vars[8]; + $AGI_output = $ARGV_vars[9]; + @prompts_list = split(/-/, $prompts); + $prompts_count = $#prompts_list; + if ($play_ID =~ /Y/) + { + @play_IDary = split(/-/, $play_ID); + $play_ID_prompt = $play_IDary[1]; + } + if ($company_ID_ask =~ /Y/) + { + @company_ID = split(/-/, $company_ID_ask); + $company_ID_length = $company_ID[1]; + $company_ID_prompt = $company_ID[2]; + } + if ($user_ID_ask =~ /Y/) + { + @user_ID = split(/-/, $user_ID_ask); + $user_ID_length = $user_ID[1]; + $user_ID_prompt = $user_ID[2]; + } + if ($cust_phone_ask =~ /Y/) + { + @cust_phone_ID = split(/-/, $cust_phone_ask); + $cust_phone_length = $cust_phone_ID[1]; + $cust_phone_prompt = $cust_phone_ID[2]; + } + if ($say_date =~ /Y/) + { + @say_date_ID = split(/-/, $say_date); + $say_date_prompt = $say_date_ID[1]; + } + if ($AGI_output =~ /STDERR/) {$AGILOG = '1';} + if ($AGI_output =~ /FILE/) {$AGILOG = '2';} + if ($AGI_output =~ /BOTH/) {$AGILOG = '3';} + + } +} + + +$|=1; +while() +{ + chomp; + last unless length($_); + if ($V) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} +} + +if ( ($callerid =~ /\".*\"/) && ( (!$calleridname) or ($calleridname =~ /unknown/) ) ) + { + $calleridname = $callerid; + $calleridname =~ s/\<\d\d\d\d\d\d\d\d\d\d\>//gi; + $calleridname =~ s/\"|\" //gi; + } + + $callerid =~ s/\D//gi; + $calleridname =~ s/unknown//gi; +if ( (!$callerid) or ($callerid =~ /unknown/) ) + {$callerid = $calleridname;} + +$phone_number=$callerid; + + +### allow for VICIDIAL transfer data string "83002*3125551212*10000123*TESTCAMP*ABC*1234*" +if ($extension =~ /^832\d\d\*|^833\d\d\*/) + { + @EXT_vars = split(/\*/, $extension); + + $referring_extension = $EXT_vars[0]; # initial extension sent + $phone_number = $EXT_vars[1]; # phone number + $lead_id = $EXT_vars[2]; # lead_id in vicidial_list + $campaign_id = $EXT_vars[3]; # campaign id + $product_code = $EXT_vars[4]; # product code + $user = $EXT_vars[5]; # vicidial_user that sent the call here + } + + +### table structure for data ### +# CREATE TABLE vicidial_ivr ( +# ivr_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +# entry_time DATETIME, +# length_in_sec SMALLINT(5) UNSIGNED default '0', +# inbound_number VARCHAR(12), +# recording_id INT(9) UNSIGNED, +# recording_filename VARCHAR(50), +# company_id VARCHAR(12), +# phone_number VARCHAR(12), +# lead_id INT(9) UNSIGNED, +# campaign_id VARCHAR(20), +# product_code VARCHAR(20), +# user VARCHAR(20), +# prompt_audio_1 VARCHAR(20), +# prompt_response_1 TINYINT(1) UNSIGNED default '0', +# prompt_audio_2 VARCHAR(20), +# prompt_response_2 TINYINT(1) UNSIGNED default '0', +# prompt_audio_3 VARCHAR(20), +# prompt_response_3 TINYINT(1) UNSIGNED default '0', +# prompt_audio_4 VARCHAR(20), +# prompt_response_4 TINYINT(1) UNSIGNED default '0', +# prompt_audio_5 VARCHAR(20), +# prompt_response_5 TINYINT(1) UNSIGNED default '0', +# prompt_audio_6 VARCHAR(20), +# prompt_response_6 TINYINT(1) UNSIGNED default '0', +# prompt_audio_7 VARCHAR(20), +# prompt_response_7 TINYINT(1) UNSIGNED default '0', +# prompt_audio_8 VARCHAR(20), +# prompt_response_8 TINYINT(1) UNSIGNED default '0', +# prompt_audio_9 VARCHAR(20), +# prompt_response_9 TINYINT(1) UNSIGNED default '0', +# prompt_audio_10 VARCHAR(20), +# prompt_response_10 TINYINT(1) UNSIGNED default '0', +# index (phone_number), +# index (entry_time) +# ); + +### insert record into vicidial_ivr table ### +$stmtA = "INSERT INTO vicidial_ivr (entry_time,length_in_sec,inbound_number,phone_number,lead_id,campaign_id,product_code,user) values('$now_date','0','$inbound_number','$phone_number','$lead_id','$campaign_id','$product_code','$user');"; +$affected_rows = $dbhA->do($stmtA); +$cbc=0; +$stmtA = "select LAST_INSERT_ID() LIMIT 1;"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +while ($sthArows > $cbc) + { + @aryA = $sthA->fetchrow_array; + $ivr_id = "$aryA[0]"; + $cbc++; + } +$sthA->finish(); + + +if ($AGILOG) {$agi_string = "IVR START- $ivr_id $inbound_number|$record_call|$company_ID_ask|$cust_phone_ask|$prompts|$last_prompt|$AGI_output"; &agi_output;} + + +$AGI->stream_file('beep'); + +### if set to play ID at beginning of session ### +if ($play_ID =~ /Y/) +{ +$AGI->stream_file("$play_ID_prompt"); +$AGI->say_digits("$ivr_id"); +sleep(1); +$AGI->stream_file('beep'); +$AGI->say_digits("$ivr_id"); +sleep(1); +} + +### if set to ask for company ID, run that subroutine ### +if ($company_ID_ask =~ /Y/) +{ +&company_ID_gather_response; + $company_ID = $totalDTMF; +&get_time_now; + $length_in_sec = ($now_date_epoch - $start_epoch); +$stmtA = "UPDATE vicidial_ivr SET company_id='$company_ID', length_in_sec='$length_in_sec' where ivr_id='$ivr_id';"; + if ($AGILOG) {$agi_string = "IVR- $ivr_id company: $company_ID length: $length_in_sec"; &agi_output;} +$affected_rows = $dbhA->do($stmtA); +} + + +### if set to ask for user ID, run that subroutine ### +if ($user_ID_ask =~ /Y/) +{ +&user_ID_gather_response; + $user_ID = $totalDTMF; +&get_time_now; + $length_in_sec = ($now_date_epoch - $start_epoch); +$stmtA = "UPDATE vicidial_ivr SET user='$user_ID', length_in_sec='$length_in_sec' where ivr_id='$ivr_id';"; + if ($AGILOG) {$agi_string = "IVR- $ivr_id user: $user_ID length: $length_in_sec"; &agi_output;} +$affected_rows = $dbhA->do($stmtA); +} + + +### if set to ask for customer phone number, run that subroutine ### +if ($cust_phone_ask =~ /Y/) +{ +&cust_phone_gather_response; + $phone_number = $totalDTMF; +&get_time_now; + $length_in_sec = ($now_date_epoch - $start_epoch); +$stmtA = "UPDATE vicidial_ivr SET phone_number='$phone_number', length_in_sec='$length_in_sec' where ivr_id='$ivr_id';"; + if ($AGILOG) {$agi_string = "IVR- $ivr_id phone: $phone_number length: $length_in_sec"; &agi_output;} +$affected_rows = $dbhA->do($stmtA); +} + + +### if set to record this session, start recording ### +if ($record_call =~ /Y/) +{ +#$filename = "$inbound_number$US$phone_number$US$ivr_id"; +$filename = "$ivr_id"; +### code to record call goes here ### + +$AGI->exec("Monitor wav|/var/spool/asterisk/monitor/$filename|m"); + +### insert record into recording_log table ### +$stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,length_in_sec,filename,lead_id,user,location) values('$channel','$server_ip','$inbound_number','$now_date','start_epoch','0','$filename','$lead_id','$user','$ivr_id');"; +$affected_rows = $dbhA->do($stmtA); +$cbc=0; +$stmtA = "select LAST_INSERT_ID() LIMIT 1;"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +while ($sthArows > $cbc) + { + @aryA = $sthA->fetchrow_array; + $recording_id = "$aryA[0]"; + $cbc++; + } +$sthA->finish(); + +$stmtA = "UPDATE vicidial_ivr SET recording_id='$recording_id', recording_filename='$filename' where ivr_id='$ivr_id';"; + if ($AGILOG) {$agi_string = "RECORDING- $recording_id $ivr_id START filename: $filename"; &agi_output;} +$affected_rows = $dbhA->do($stmtA); + +} + + +### if set, say the current date ### +if ($say_date =~ /Y/) +{ + if ($AGILOG) {$agi_string = "SAYING DATETIME $now_date_epoch"; &agi_output;} + if (length($say_date_prompt)>0) {$AGI->stream_file("$say_date_prompt");} + sleep(1); + $AGI->exec("SayUnixtime"); + sleep(1); +} + + +##### Go through the propmts one at a time until done ##### + @prompts_list = split(/--/, $prompts); + $prompts_count = $#prompts_list; + +$i=0; +$j=1; +while($prompts_count >= $i) +{ + $prompt_ary = $prompts_list[$i]; + @prompts_specs = split(/-/, $prompt_ary); + $prompt = $prompts_specs[0]; + $wait_sec = $prompts_specs[1]; + if ($wait_sec < 1) {$wait_sec=10;} + $response = ''; + $prompt_name = "prompt_audio_$j"; + $response_name = "prompt_response_$j"; + + sleep(1); + + &prompt_gather_response; + $response = $totalDTMF; + + &get_time_now; + $length_in_sec = ($now_date_epoch - $start_epoch); + + $stmtA = "UPDATE vicidial_ivr SET $prompt_name='$prompt', $response_name='$response', length_in_sec='$length_in_sec' where ivr_id='$ivr_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "IVR- $ivr_id $i prompt: $prompt - $wait_sec response: $response length: $length_in_sec"; &agi_output;} + + $i++; + $j++; +} + +##### Play the last prompt and say the IVR number ##### + $AGI->stream_file("$last_prompt"); + $AGI->say_digits("$ivr_id"); + + &get_time_now; + $length_in_sec = ($now_date_epoch - $start_epoch); + + $stmtA = "UPDATE vicidial_ivr SET length_in_sec='$length_in_sec' where ivr_id='$ivr_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "IVR- $ivr_id END prompt: $last_prompt length: $length_in_sec"; &agi_output;} + + if ($record_call =~ /Y/) + { + $stmtA = "UPDATE recording_log SET length_in_sec='$length_in_sec' where recording_id='$recording_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "RECORDING- $recording_id length: $length_in_sec"; &agi_output;} + } + + sleep(1); + $AGI->stream_file('beep'); + $AGI->say_digits("$ivr_id"); + sleep(1); + $AGI->stream_file('vm-goodbye'); + + +if ($AGILOG) {$agi_string = "IVR- ID: $ivr_id DONE Exiting"; &agi_output;} + +exit; + + + + +################################################################################ +##### SUBROUTINES ############################################################## +################################################################################ + + +##### BEGIN collect the company ID ############################################# +sub company_ID_gather_response +{ +$digit=''; +$interrupt_digit=''; + +$interrupt_digit = $AGI->stream_file("$company_ID_prompt",'1234567890'); + + print STDERR "interrupt_digit |$interrupt_digit|\n"; + +$digits_being_entered=1; +$digit_loop_counter=0; +$totalDTMF=''; +if ($interrupt_digit > 1) + { +# if ($interrupt_digit == 35) {$interrupt_digit='#';} +# if ($interrupt_digit == 42) {$interrupt_digit='*';} + if ($interrupt_digit == 48) {$interrupt_digit=0;} + if ($interrupt_digit == 49) {$interrupt_digit=1;} + if ($interrupt_digit == 50) {$interrupt_digit=2;} + if ($interrupt_digit == 51) {$interrupt_digit=3;} + if ($interrupt_digit == 52) {$interrupt_digit=4;} + if ($interrupt_digit == 53) {$interrupt_digit=5;} + if ($interrupt_digit == 54) {$interrupt_digit=6;} + if ($interrupt_digit == 55) {$interrupt_digit=7;} + if ($interrupt_digit == 56) {$interrupt_digit=8;} + if ($interrupt_digit == 57) {$interrupt_digit=9;} + + $totalDTMF=$interrupt_digit; + $digit_loop_counter++; + } + +while ($digit_loop_counter < $company_ID_length) + { + $digit = chr($AGI->wait_for_digit('100000')); # wait 100 seconds for input + if ($digit =~ /\d/) + { + $totalDTMF = "$totalDTMF$digit"; + print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n"; +# $AGI->say_digits("$digit"); + undef $digit; + } + else + { + $digit_loop_counter=$company_ID_length; + } + + $digit_loop_counter++; + } +} +##### END collect the company ID ############################################### + + + +##### BEGIN collect the user ID ################################################ +sub user_ID_gather_response +{ +$digit=''; +$interrupt_digit=''; + +$interrupt_digit = $AGI->stream_file("$user_ID_prompt",'1234567890'); + + print STDERR "interrupt_digit |$interrupt_digit|\n"; + +$digits_being_entered=1; +$digit_loop_counter=0; +$totalDTMF=''; +if ($interrupt_digit > 1) + { +# if ($interrupt_digit == 35) {$interrupt_digit='#';} +# if ($interrupt_digit == 42) {$interrupt_digit='*';} + if ($interrupt_digit == 48) {$interrupt_digit=0;} + if ($interrupt_digit == 49) {$interrupt_digit=1;} + if ($interrupt_digit == 50) {$interrupt_digit=2;} + if ($interrupt_digit == 51) {$interrupt_digit=3;} + if ($interrupt_digit == 52) {$interrupt_digit=4;} + if ($interrupt_digit == 53) {$interrupt_digit=5;} + if ($interrupt_digit == 54) {$interrupt_digit=6;} + if ($interrupt_digit == 55) {$interrupt_digit=7;} + if ($interrupt_digit == 56) {$interrupt_digit=8;} + if ($interrupt_digit == 57) {$interrupt_digit=9;} + + $totalDTMF=$interrupt_digit; + $digit_loop_counter++; + } + +while ($digit_loop_counter < $user_ID_length) + { + $digit = chr($AGI->wait_for_digit('100000')); # wait 100 seconds for input + if ($digit =~ /\d/) + { + $totalDTMF = "$totalDTMF$digit"; + print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n"; +# $AGI->say_digits("$digit"); + undef $digit; + } + else + { + $digit_loop_counter=$user_ID_length; + } + + $digit_loop_counter++; + } +} +##### END collect the user ID ################################################## + + + +##### BEGIN collect the customer phone number ################################## +sub cust_phone_gather_response +{ +$digit=''; +$interrupt_digit=''; + +$interrupt_digit = $AGI->stream_file("$cust_phone_prompt",'1234567890'); + + print STDERR "interrupt_digit |$interrupt_digit|\n"; + +$digits_being_entered=1; +$digit_loop_counter=0; +$totalDTMF=''; +if ($interrupt_digit > 1) + { + if ($interrupt_digit == 48) {$interrupt_digit=0;} + if ($interrupt_digit == 49) {$interrupt_digit=1;} + if ($interrupt_digit == 50) {$interrupt_digit=2;} + if ($interrupt_digit == 51) {$interrupt_digit=3;} + if ($interrupt_digit == 52) {$interrupt_digit=4;} + if ($interrupt_digit == 53) {$interrupt_digit=5;} + if ($interrupt_digit == 54) {$interrupt_digit=6;} + if ($interrupt_digit == 55) {$interrupt_digit=7;} + if ($interrupt_digit == 56) {$interrupt_digit=8;} + if ($interrupt_digit == 57) {$interrupt_digit=9;} + + $totalDTMF=$interrupt_digit; + $digit_loop_counter++; + } + +while ($digit_loop_counter < $cust_phone_length) + { + $digit = chr($AGI->wait_for_digit('100000')); # wait 100 seconds for input + if ($digit =~ /\d/) + { + $totalDTMF = "$totalDTMF$digit"; + print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n"; +# $AGI->say_digits("$digit"); + undef $digit; + } + else + { + $digit_loop_counter=$cust_phone_length; + } + + $digit_loop_counter++; + } +} +##### END collect the customer phone number #################################### + + + +##### BEGIN collect the response to a prompt ################################### +sub prompt_gather_response +{ +$digit=''; +$interrupt_digit=''; + +$interrupt_digit = $AGI->stream_file("$prompt",'123456789'); + + print STDERR "interrupt_digit |$interrupt_digit|\n"; + +$digits_being_entered=1; +$digit_loop_counter=0; +$totalDTMF=''; +if ($interrupt_digit > 1) + { +# if ($interrupt_digit == 48) {$interrupt_digit=0;} + if ($interrupt_digit == 49) {$interrupt_digit=1;} + if ($interrupt_digit == 50) {$interrupt_digit=2;} + if ($interrupt_digit == 51) {$interrupt_digit=3;} + if ($interrupt_digit == 52) {$interrupt_digit=4;} + if ($interrupt_digit == 53) {$interrupt_digit=5;} + if ($interrupt_digit == 54) {$interrupt_digit=6;} + if ($interrupt_digit == 55) {$interrupt_digit=7;} + if ($interrupt_digit == 56) {$interrupt_digit=8;} + if ($interrupt_digit == 57) {$interrupt_digit=9;} + + $totalDTMF=$interrupt_digit; + $digit_loop_counter++; + } + +while ($digit_loop_counter < 1) + { + $wait_ms = ($wait_sec * 1000); + $digit = chr($AGI->wait_for_digit("$wait_ms")); # wait number of milli-seconds for input + if ($digit =~ /\d/) + { + $totalDTMF = "$totalDTMF$digit"; + print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n"; +# $AGI->say_digits("$digit"); + undef $digit; + } + else + { + $digit_loop_counter=1; + } + + $digit_loop_counter++; + } +} +##### END collect the response to a prompt ##################################### + + + + + +sub get_time_now #get the current date and time and epoch for logging call lengths and datetimes +{ +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$filedate = "$year$mon$mday$hour$min$sec"; +} + + + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + print STDERR "FAIL ($res)\n"; + $fail++; + } else { + print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} + +sub agi_output +{ +if ($AGILOG >=2) + { + ### open the log file for writing ### + open(Lout, ">>$AGILOGfile") + || die "Can't open $AGILOGfile: $!\n"; + print Lout "$now_date|$script|$agi_string\n"; + close(Lout); + } + ### send to STDERR writing ### +if ( ($AGILOG == '1') || ($AGILOG == '3') ) + {print STDERR "$now_date|$script|$agi_string\n";} +$agi_string=''; +} diff --git a/agc_2-X/branches/agc_2.0.4/agi/agi-VDAD_ALL_inbound.agi b/agc_2-X/branches/agc_2.0.4/agi/agi-VDAD_ALL_inbound.agi new file mode 100644 index 00000000..9df97e68 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/agi/agi-VDAD_ALL_inbound.agi @@ -0,0 +1,1359 @@ +#!/usr/bin/perl +# +# agi-VDAD_ALL_inbound.agi version 2.0.4 *DBI-version* +# +# runs when a call comes in from an inbound call. This script will +# send the calls out to the closers that are logged in. +# ## THIS SCRIPT CONSOLIDATES THIRTEEN SEPARATE VDAD closer inbound SCRIPTS ## +# +# +# You need to put lines similar to those below in your extensions.conf file: +# ; Below are the parameters needed for the script to be run properly +# ; 1. the method of call handling for the script: +# ; - CID - CID received, add record with phone number +# ; - CIDLOOKUP - Lookup CID to find record in whole system +# ; - CIDLOOKUPRL - Restrict lookup to one list +# ; - CIDLOOKUPRC - Restrict lookup to one campaign's lists +# ; - CLOSER - Closer calls from VICIDIAL fronters +# ; - ANI - ANI received, add record with phone number +# ; - ANILOOKUP - Lookup ANI to find record in whole system +# ; - ANILOOKUPRL - Restrict lookup to one list +# ; - 3DIGITID - Enter 3 digit code to go to agent +# ; - 4DIGITID - Enter 4 digit code to go to agent +# ; - 5DIGITID - Enter 5 digit code to go to agent +# ; - 10DIGITID - Enter 10 digit code to go to agent +# ; 2. the method of searching for an available agent: +# ; - LO - Load Balance Overflow only (priority to home server) +# ; - LB - Load Balance total system +# ; - SO - Home server only +# ; 3. the full name of the IN GROUP to be used in vicidial for the inbound call +# ; 4. the phone number that was called, for the log entry +# ; 5. the callerID or lead_id of the person that called(usually overridden) +# ; 6. the park extension audio file name if used +# ; 7. the status of the call initially(usually not used) +# ; 8. the list_id to insert the new lead under if it is new (and CID/ANI available) +# ; 9. the phone dialing code to insert with the new lead if new (and CID/ANI available) +# ; 10. the campaign_id to search within lists if CIDLOOKUPRC +# +# ;inbound VICIDIAL calls: +#exten => 1234,1,Answer ; Answer the line +#exten => 1234,2,AGI(agi-VDAD_ALL_inbound.agi,CID-----LB-----INB-----7274515134-----Closer-----park----------999-----1-----OUTB) +#exten => 1234,3,Hangup +# +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# +# changes: +# 70828-0924 - First Build +# 71013-0310 - Added use of default Music-on-hold instead of generic on-hold message +# 71020-1714 - fixed issues with MoH and stream_file messages +# 71024-2153 - Added CLOSER functionality for calls coming from VICIDIAL fronters +# 71029-1726 - Changed CLOSER-type campaigns to use new campaign_allow_inbound field +# 71030-0713 - fixed after-hours logging +# 71030-0939 - fixed issue where MoH was still playing, added ding and wait before transfer +# 71103-2305 - added group rank and fewest calls options to next_agent_call +# 71112-0058 - fixed multi-logging bug on CLOSER calls +# 71116-1045 - added fewest_calls_campaign agent call routing option +# 71128-1758 - added CIDLOOKUPRC method to search all lists within a campaign +# + +$script = 'agi-VDAD_ALL_inbound.agi'; + +$DROP_TIME = 360; ### default number of seconds to wait until you drop a waiting call +$start_moh=1; +$at='@'; + + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$hm = "$hour$min"; +$hm = ($hm + 0); + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$start_time=$now_date; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $SQLdateBEGIN = $SQLdate; + +$BDtarget = ($now_date_epoch - 5); +($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); +$Byear = ($Byear + 1900); +$Bmon++; +if ($Bmon < 10) {$Bmon = "0$Bmon";} +if ($Bmday < 10) {$Bmday = "0$Bmday";} +if ($Bhour < 10) {$Bhour = "0$Bhour";} +if ($Bmin < 10) {$Bmin = "0$Bmin";} +if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +if (!$VARDB_port) {$VARDB_port='3306';} +if (!$AGILOGfile) {$AGILOGfile = "$PATHlogs/agiout.$year-$mon-$mday";} + +use DBI; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### Grab Server values from the database +$stmtA = "SELECT agi_output FROM servers where server_ip = '$VARserver_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + $AGILOG = '0'; + @aryA = $sthA->fetchrow_array; + $DBagi_output = "$aryA[0]"; + if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';} + if ($DBagi_output =~ /FILE/) {$AGILOG = '2';} + if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';} + $rec_count++; + } +$sthA->finish(); + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + if ($AGILOG) {$agi_string = "Perl Environment Dump:"; &agi_output;} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($AGILOG) {$agi_string = "$i|$ARGV[$i]"; &agi_output;} + $i++; + } + + ### list of command-line array arguments: + @ARGV_vars = split(/-----/, $ARGV[0]); + + $call_handle_method = $ARGV_vars[0]; + $agent_search_method = $ARGV_vars[1]; + $channel_group = $ARGV_vars[2]; + $inbound_number = $ARGV_vars[3]; + $parked_by = $ARGV_vars[4]; + $park_extension = $ARGV_vars[5]; + $status = $ARGV_vars[6]; + $list_id = $ARGV_vars[7]; + $phone_code = $ARGV_vars[8]; + $Scampaign_id = $ARGV_vars[9]; +} + +$|=1; +while() +{ + chomp; + last unless length($_); + if ($AGILOG) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} +} + + +if ( ($callerid =~ /\".*\"/) && ( (!$calleridname) or ($calleridname =~ /unknown/) ) ) + { + $calleridname = $callerid; + $calleridname =~ s/\<\d\d\d\d\d\d\d\d\d\d\>//gi; + $calleridname =~ s/\"|\" //gi; + } + + $callerid =~ s/\D//gi; + $calleridname =~ s/unknown//gi; +if ( (!$callerid) or ($callerid =~ /unknown/) ) + {$callerid = $calleridname;} + + + +if ($call_handle_method =~ /^CLOSER/) +{ + ### allow for internal PRI/IAX/SIP transfer data string "90009*CL_uk3survy_*8301*10000123*universal***" + if ($extension =~ /^900\d\d\*|^9900\d\d\*/) + { + @EXT_vars = split(/\*/, $extension); + + $referring_extension = $EXT_vars[0]; # initial extension sent + $channel_group = $EXT_vars[1]; # name of the parked group + $inbound_number = $EXT_vars[2]; # extension to send call to after parsing + $parked_by = $EXT_vars[3]; # leadID + $park_extension = $EXT_vars[4]; # filename of the on-hold music file + $comment_d = $EXT_vars[5]; # N/A + $comment_e = $EXT_vars[6]; # N/A + + $CIDlead_id = $parked_by; + + $PADlead_id = sprintf("%09s", $parked_by); while (length($PADlead_id) > 9) {chop($PADlead_id);} + # JmmddhhmmssLLLLLLLLL + $JqueryCID = "J$CIDdate$PADlead_id"; + $callerid = $JqueryCID; + ### set the callerid to the filename of the audio for on-hold + print "SET CALLERID $JqueryCID\n"; + checkresult($result); + if ($AGILOG) {$agi_string = "callerID changed: $JqueryCID"; &agi_output;} + } +} + +if ($call_handle_method =~ /^CID/) +{ + if (length($callerid)>0) {$phone_number = $callerid;} + else {$phone_number = '';} + if (length($calleridname)>0) {$VLcomments = $calleridname;} + else {$VLcomments = '';} +} + +# if ($channel =~ /^SIP/) {$channel =~ s/-.*//gi;} +# if ($channel =~ /^Zap\//) {$channel =~ s/-\d$//gi;} + if (length($callerid)<10) {$callerid = $parked_by;} + if (length($pin)>0) {$callerid = $pin;} + + +if ($call_handle_method =~ /^ANI/) +{ + $phone_number=''; + ### allow for external ANI to be collected on older RBS T1 circuits + if ($extension =~ /\*\d\d\d\d\d\d\d\d\d\d\*/) + { + @EXT_vars = split(/\*/, $extension); + $phone_number = $EXT_vars[1]; + if ($AGILOG) {$agi_string = "ANI found: |$phone_number|"; &agi_output;} + } +} + +foreach $i (sort keys %AGI) +{ + if ($AGILOG) {$agi_string = " -- $i = $AGI{$i}"; &agi_output;} +} + +if ($AGILOG) {$agi_string = "AGI Variables: |$unique_id|$channel|$extension|$type|$callerid|"; &agi_output;} + + +if (length($pin) < 1) {$pin=$inbound_number;} + +$fronter = $pin; + +if ($AGILOG) {$agi_string = "+++++ INBOUND CALL VDCL STARTED : |$channel_group|$callerid-$pin|$now_date"; &agi_output;} + +$VDADphone=''; +$VDADphone_code=''; + +if ($channel =~ /Local/i) +{ + if ($inbound_number =~ /CXFER/) + { + if ($AGILOG) {$agi_string = "+++++ VDAD START LOCAL CHANNEL: CXFER OVERRIDE- $priority"; &agi_output;} + } + else + { + if ($AGILOG) {$agi_string = "+++++ VDAD START LOCAL CHANNEL: EXITING- $priority"; &agi_output;} + exit; + } +} + +### Grab Server values from the database +$cbc=0; +$stmtA = "SELECT voicemail_dump_exten,ext_context,answer_transfer_agent,local_gmt,asterisk_version,max_vicidial_trunks FROM servers where server_ip = '$VARserver_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +while ($sthArows > $cbc) + { + @aryA = $sthA->fetchrow_array; + + $DBvoicemail_dump_exten = "$aryA[0]"; + $DBext_context = "$aryA[1]"; + $DBanswer_transfer_agent = "$aryA[2]"; + $DBSERVER_GMT = "$aryA[3]"; + $DBasterisk_version = "$aryA[4]"; + $DBmax_vicidial_trunks = "$aryA[5]"; + if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;} + if ($DBext_context) {$ext_context = $DBext_context;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + $cbc++; + } +$sthA->finish(); + +### Grab inbound groups values from the database +$cbc=0; +$stmtA = "SELECT call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,drop_call_seconds,drop_message,drop_exten,next_agent_call,voicemail_ext FROM vicidial_inbound_groups where group_id = '$channel_group';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +while ($sthArows > $cbc) + { + @aryA = $sthA->fetchrow_array; + + $call_time_id = "$aryA[0]"; + $after_hours_action = "$aryA[1]"; + $after_hours_message_filename = "$aryA[2]"; + $after_hours_exten = "$aryA[3]"; + $after_hours_voicemail = "$aryA[4]"; + $welcome_message_filename = "$aryA[5]"; + $moh_context = "$aryA[6]"; + $onhold_prompt_filename = "$aryA[7]"; + $prompt_interval = "$aryA[8]"; + $agent_alert_exten = "$aryA[9]"; + $agent_alert_delay = "$aryA[10]"; + $drop_call_seconds = "$aryA[11]"; + $DROP_TIME = $drop_call_seconds; + $drop_message = "$aryA[12]"; + $drop_exten = "$aryA[13]"; + $CAMP_callorder = "$aryA[14]"; + $VDADvoicemail_ext = "$aryA[15]"; + $VDADvoicemail_ext =~ s/\D//gi; + $cbc++; + } +$sthA->finish(); + +if ($wday==0) {$daySQL=',ct_sunday_start,ct_sunday_stop';} +if ($wday==1) {$daySQL=',ct_monday_start,ct_monday_stop';} +if ($wday==2) {$daySQL=',ct_tuesday_start,ct_tuesday_stop';} +if ($wday==3) {$daySQL=',ct_wednesday_start,ct_wednesday_stop';} +if ($wday==4) {$daySQL=',ct_thursday_start,ct_thursday_stop';} +if ($wday==5) {$daySQL=',ct_friday_start,ct_friday_stop';} +if ($wday==6) {$daySQL=',ct_saturday_start,ct_saturday_stop';} + +### Grab call_times values from the database +$stmtA = "SELECT ct_default_start,ct_default_stop $daySQL FROM vicidial_call_times where call_time_id = '$call_time_id';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +@aryA = $sthA->fetchrow_array; +$ct_default_start = "$aryA[0]"; +$ct_default_stop = "$aryA[1]"; +$ct_day_start = "$aryA[2]"; +$ct_day_stop = "$aryA[3]"; +$sthA->finish(); + +if ( ($ct_day_start > 0) || ($ct_day_stop > 0) ) + { + $ct_default_start = $ct_day_start; + $ct_default_stop = $ct_day_stop; + } + +$AGI->stream_file('beep'); + +if ($call_handle_method =~ /DIGITID$/) +{ + &enter_pin_number; +} + +if ($call_handle_method =~ /LOOKUP/) +{ + $listSQL = ''; + if ($call_handle_method =~ /LOOKUPRL$/) + {$listSQL = "and list_id='$list_id'";} + else + { + if ($call_handle_method =~ /LOOKUPRC$/) + { + ### Grab all lists associated with Scampaign_id + $cbc=0; + $SlistsSQL=''; + $stmtA = "SELECT list_id FROM vicidial_lists where campaign_id='$Scampaign_id' limit 100;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + while ($sthArows > $cbc) + { + @aryA = $sthA->fetchrow_array; + $SlistsSQL .= "'$aryA[0]',"; + $cbc++; + } + $sthA->finish(); + chop($SlistsSQL); + + if (length($SlistsSQL)>3) + {$listSQL = "and list_id IN($SlistsSQL)";} + } + } + + $cbc=0; + $stmtA= "SELECT lead_id from vicidial_list where phone_number='$phone_number' $listSQL order by modify_date limit 1;"; + if ($AGILOG) {$agi_string = "VDAD vicidial_list search |$phone_number|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + $rec_countCUSTDATA=0; + while ($sthArows > $cbc) + { + @aryA = $sthA->fetchrow_array; + $insert_lead_id = "$aryA[0]"; + $cbc++; + } + $sthA->finish(); + + if ($AGILOG) {$agi_string = "VDAD vicidial_list found |$insert_lead_id|$stmtA|"; &agi_output;} + } + else + { + ### insert a record into the vicidial_list table + $stmtA = "INSERT INTO vicidial_list (entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,called_since_last_reset,phone_code,phone_number,security_phrase,called_count,gmt_offset_now,comments) values('$SQLdate','$tsSQLdate','INBND','$fronter','$inbound_number','VDCL','$list_id','Y','$phone_code','$phone_number','$channel_group','1','-5.00','$VLcomments');"; + $affected_rows = $dbhA->do($stmtA); + $cbc=0; + $stmtB = "select LAST_INSERT_ID() LIMIT 1;"; + $sthA = $dbhA->prepare($stmtB) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + while ($sthArows > $cbc) + { + @aryA = $sthA->fetchrow_array; + $insert_lead_id = "$aryA[0]"; + $cbc++; + } + $sthA->finish(); + + if ($AGILOG) {$agi_string = "VDAD vicidial_list insert |$insert_lead_id|$stmtA|"; &agi_output;} + } +} + +else +{ + if ($call_handle_method =~ /CLOSER/) + { + ### Grab call lead parameters from vicidial_list table + $cbc=0; + $stmtA = "SELECT phone_number,phone_code,user FROM vicidial_list where lead_id='$CIDlead_id' limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + while ($sthArows > $cbc) + { + @aryA = $sthA->fetchrow_array; + $campaign = "$channel_group"; + $phone_number = "$aryA[0]"; + $phone_code = "$aryA[1]"; + $insert_lead_id = "$CIDlead_id"; + $fronter = "$aryA[2]"; + $cbc++; + } + $sthA->finish(); + } + + else + { + ### insert a record into the vicidial_list table if no record was found above + $stmtA = "INSERT INTO vicidial_list (entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,called_since_last_reset,phone_code,phone_number,security_phrase,called_count,gmt_offset_now,comments) values('$SQLdate','$tsSQLdate','INBND','$fronter','$inbound_number','VDCL','$list_id','Y','$phone_code','$phone_number','$channel_group','1','-5.00','$VLcomments');"; + $affected_rows = $dbhA->do($stmtA); + $cbc=0; + $stmtA = "select LAST_INSERT_ID() LIMIT 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + while ($sthArows > $cbc) + { + @aryA = $sthA->fetchrow_array; + $insert_lead_id = "$aryA[0]"; + $cbc++; + } + $sthA->finish(); + } +} + + + +##### BEGIN AFTER HOURS CHECK ##### +if ( ($hm < $ct_default_start) || ($hm > $ct_default_stop) ) + { + $VHqueryCID = "VA$CIDdate$hour$min$sec$sec"; + + if ($after_hours_action =~ /EXTENSION|VOICEMAIL/) + { + if ($after_hours_action =~ /EXTENSION/) + { + $DROPexten = "$after_hours_exten"; + } + if ($after_hours_action =~ /VOICEMAIL/) + { + $DROPexten = "$voicemail_dump_exten$after_hours_voicemail"; + } + if (length($DROPexten)>0) + { ### if DROP extension is defined then send the dropped call there instead of hangup + + $AGI->stream_file('ding'); # stop music-on-hold process + + sleep(1); + + if ($AGILOG) {$agi_string = "exiting the VDAD app after hours, transferring call to $DROPexten"; &agi_output;} + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $DROPexten\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + } + } + $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' and server_ip='$VARserver_ip' order by call_time desc limit 1;"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDCL vac record deleted: |$affected_rows| $VDADcampaign|"; &agi_output;} + + $stmtA = "INSERT INTO vicidial_closer_log set status='DROP',start_epoch='$now_date_epoch',end_epoch='$now_date_epoch',length_in_sec='1',queue_seconds='0',lead_id = '$insert_lead_id',campaign_id='$channel_group',user='VDCL',list_id='$list_id',call_date='$now_date',phone_code='$phone_code',phone_number='$phone_number',comments='AFTER HOURS DROP';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDCL vcl insert: |$affected_rows|$insert_lead_id|\n|$stmtA|"; &agi_output;} + + $stmtA = "UPDATE vicidial_list set status='DROP' where lead_id = '$insert_lead_id';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDCL vl update: |$affected_rows|$insert_lead_id|\n|$stmtA|"; &agi_output;} + + if ($after_hours_action =~ /HANGUP/) + { + ### insert a NEW record to the vicidial_manager table to hangup the channel + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$VARserver_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDCL call_hungup after hours: |$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager"; &agi_output;} + } + if ($after_hours_action =~ /MESSAGE/) + { + $AGI->stream_file('sip-silence'); + $AGI->stream_file("$after_hours_message_filename"); + sleep(1); + + ### insert a NEW record to the vicidial_manager table to hangup the channel + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$VARserver_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDCL call_hungup after hours: |$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager"; &agi_output;} + } + + $dbhA->disconnect(); + + exit; + + } +##### END AFTER HOURS CHECK ##### + + + +##### PLAY WELCOME MESSAGE ##### +if ($welcome_message_filename !~ /---NONE---/) + { + $AGI->stream_file("$welcome_message_filename"); + } + + + +$vci=0; +$INBOUNDcampsSQL=''; +$stmtA = "SELECT campaign_id FROM vicidial_campaigns where active='Y' and campaign_allow_inbound='Y';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + while ($sthArows > $vci) + { + @aryA = $sthA->fetchrow_array; + if ($vci==0) {$INBOUNDcampsSQL .= "'$aryA[0]'";} + else {$INBOUNDcampsSQL .= ",'$aryA[0]'";} + $vci++; + } +$sthA->finish(); + +if ($AGILOG) {$agi_string = "|$stmtA|$insert_lead_id|"; &agi_output;} + +$PADlead_id = sprintf("%09s", $insert_lead_id); while (length($PADlead_id) > 9) {chop($PADlead_id);} +# YmmddhhmmssLLLLLLLLL + $YqueryCID = "Y$CIDdate$PADlead_id"; + $callerid = $YqueryCID; +### set the callerid +print "SET CALLERID $YqueryCID\n"; +checkresult($result); +if ($AGILOG) {$agi_string = "callerID changed: $YqueryCID"; &agi_output;} + +if ($call_handle_method =~ /DIGITID$/) + { + $stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$uniqueid','$insert_lead_id','$channel_group','$SQLdate','$now_date_epoch','XFER','$phone_code','$phone_number','$fronter','N')"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD : |$insert_lead_id|$fronter|insert to vicidial_log: $uniqueid"; &agi_output;} + } +if ($call_handle_method =~ /CLOSER|DIGITID$/) + { + $stmtA = "INSERT INTO vicidial_xfer_log (lead_id,campaign_id,call_date,phone_code,phone_number,user,closer) values('$insert_lead_id','$channel_group','$SQLdate','$phone_code','$phone_number','$fronter','VDXL')"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDXL : |$insert_lead_id|insert to vicidial_xfer_log"; &agi_output;} + } + +### insert a LIVE record to the vicidial_auto_calls table +$stmtA = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,uniqueid,callerid,channel,phone_code,phone_number,call_time,call_type,stage) values('$VARserver_ip','$channel_group','LIVE','$insert_lead_id','$uniqueid','$callerid','$channel','$phone_code','$phone_number','$SQLdate','IN','LIVE-0')"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$affected_rows = $dbhA->do($stmtA); + +$stmtA = "INSERT INTO vicidial_closer_log (lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$insert_lead_id','$channel_group','$SQLdate','$now_date_epoch','QUEUE','$phone_code','$phone_number','VDCL','N')"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$affected_rows = $dbhA->do($stmtA); +if ($AGILOG) {$agi_string = "-- VDCL : |$insert_lead_id|insert to vicidial_closer_log"; &agi_output;} + +$drop_timer=0; +$drop_seconds=0; +$hold_message_counter=($prompt_interval - 10); +$hold_tone_counter=0; + +while ($drop_timer <= $DROP_TIME) +{ +$channel_status = $AGI->channel_status("$channel"); +if ($channel_status < 1) + { + if ($AGILOG) {$agi_string = "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer CHECKING AGAIN"; &agi_output;} + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + + $channel_status_DC = $AGI->channel_status("$channel"); + + if ($channel_status_DC < 1) + { + if ($AGILOG) {$agi_string = "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer"; &agi_output;} + if ($drop_timer < 360) {$drop_seconds = $drop_timer;} + $drop_timer = ($drop_timer + 360); + } + } + + $rec_countCUSTDATA=0; + $rec_countWAIT=0; + $cbc=0; + $aco_sub=0; + $agent_call_order='order by last_call_finish'; + if ($CAMP_callorder =~ /overall_user_level/i) {$agent_call_order = 'order by user_level desc,last_call_finish';} + if ($CAMP_callorder =~ /oldest_call_start/i) {$agent_call_order = 'order by last_call_time';} + if ($CAMP_callorder =~ /oldest_call_finish/i) {$agent_call_order = 'order by last_call_finish';} + if ($CAMP_callorder =~ /random/i) {$agent_call_order = 'order by random_id';} + if ($CAMP_callorder =~ /campaign_rank/i) {$agent_call_order = 'order by campaign_weight desc,last_call_finish';} + if ($CAMP_callorder =~ /fewest_calls_campaign/i) {$agent_call_order = 'order by calls_today,last_call_finish';} + if ($CAMP_callorder =~ /inbound_group_rank/i) {$aco_sub=1; $agent_call_order = 'order by group_weight desc';} + if ($CAMP_callorder =~ /fewest_calls/i) {$aco_sub=1; $agent_call_order = 'order by calls_today';} + + +##### Attempt to send call to an agent on this server only ##### +if ($agent_search_method =~ /^SO|^LO/) +{ + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and server_ip='$VARserver_ip' and campaign_id = '$channel_group' and call_time < \"$SQLdateBEGIN\" and lead_id != '$insert_lead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + + while ($sthArows > $cbc) + { + @aryA = $sthA->fetchrow_array; + $rec_countWAIT = "$aryA[0]"; + $cbc++; + } + $sthA->finish(); + + if ($rec_countWAIT < 1) + { + if ($aco_sub>0) + { + $stmtA = "LOCK TABLES vicidial_live_agents WRITE, vicidial_live_inbound_agents WRITE;"; + my $LOCKaffected_rows = $dbhA->do($stmtA); + + $stmtA = "SELECT vicidial_live_agents.conf_exten,vicidial_live_agents.user,vicidial_live_agents.extension from vicidial_live_agents JOIN vicidial_live_inbound_agents ON vicidial_live_agents.user=vicidial_live_inbound_agents.user WHERE status IN('CLOSER','READY') and server_ip='$VARserver_ip' and vicidial_live_inbound_agents.group_id='$channel_group' and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + + $VDADconf_exten = "$aryA[0]"; + $VDADuser = "$aryA[1]"; + $VDADextension = "$aryA[2]"; + } + $sthA->finish(); + + if ($sthArows > 0) + { + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$insert_lead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid' where user='$VDADuser';"; + my $affected_rows = $dbhA->do($stmtA); + $found_agents=$affected_rows; + } + else + { + $affected_rows=0; + } + + $stmtA = "UNLOCK TABLES;"; + my $LOCKaffected_rows = $dbhA->do($stmtA); + } + else + { + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$insert_lead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid' where status IN('CLOSER','READY') and server_ip='$VARserver_ip' and campaign_id IN($INBOUNDcampsSQL) and closer_campaigns LIKE \"% $channel_group %\" and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + my $affected_rows = $dbhA->do($stmtA); + $found_agents=$affected_rows; + } + if ($AGILOG) {$agi_string = "-- VDAD get agent: |$affected_rows|$channel_group|$stmtA|"; &agi_output;} + if ($found_agents > 0) + { + if ($aco_sub<1) + { + $cbc=0; + $stmtA = "SELECT conf_exten,user,extension FROM vicidial_live_agents where status = 'QUEUE' and server_ip='$VARserver_ip' and campaign_id IN($INBOUNDcampsSQL) and callerid='$callerid' and channel='$channel' order by last_call_time limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_countCUSTDATA=0; + while ($sthArows > $cbc) + { + @aryA = $sthA->fetchrow_array; + + $VDADconf_exten = "$aryA[0]"; + $VDADuser = "$aryA[1]"; + $VDADextension = "$aryA[2]"; + + $cbc++; + } + $sthA->finish(); + } + + $stmtA = "UPDATE vicidial_auto_calls set status='CLOSER', stage='CLOSER-$drop_timer' where callerid='$callerid';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDCL XFER : |$affected_rows|$callerid\n|$stmtA|"; &agi_output;} + if ($affected_rows < 1) + { + $stmtA = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,uniqueid,callerid,channel,phone_code,phone_number,call_time,call_type,stage) values('$VARserver_ip','$channel_group','CLOSER','$insert_lead_id','$uniqueid','$callerid','$channel','$phone_code','$phone_number','$SQLdate','IN','CLOSER-$drop_timer')"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "$affected_rows|VDAC-reinsert|$stmtA|"; &agi_output;} + } + + if ($call_handle_method =~ /CLOSER|DIGITID$/) + { + $stmtA = "UPDATE vicidial_xfer_log set closer='$VDADuser' where lead_id = '$insert_lead_id' order by call_date desc limit 1;"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDXL XFER vicidial_xfer_log update: |$affected_rows|$insert_lead_id|$VDADuser\n|$stmtA|"; &agi_output;} + } + + $stmtA = "UPDATE vicidial_closer_log set user='$VDADuser' where lead_id='$insert_lead_id' order by call_date desc limit 1;"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- closer log : |$affected_rows|$insert_lead_id\n|$stmtA|"; &agi_output;} + + ### if agent alert exten is not disabled, then trigger the alert and wait + if ($agent_alert_exten !~ /X/i) + { + $VHqueryCID = "VH$CIDdate$VDADconf_exten"; + + ### insert a NEW record to the vicidial_manager table to play the alert message to the agent + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$VARserver_ip','','Originate','$VHqueryCID','Exten: $agent_alert_exten','Context: $ext_context','Channel: Local/7$VDADconf_exten$at$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: 10','','','','')"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDCL agent alert: |$VHqueryCID|7$VDADconf_exten|$channel|insert to vicidial_manager"; &agi_output;} + + usleep(1 * $agent_alert_delay * 1000); + } + + if ($AGILOG) {$agi_string = "exiting VDAD app, transferring call to $VDADconf_exten"; &agi_output;} + + $AGI->stream_file('ding'); # stop music-on-hold process + + ### update calls_today for vicidial_live_inbound_agents ### + $stmtA = "SELECT calls_today from vicidial_inbound_group_agents WHERE user='$VDADuser' and group_id='$channel_group';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $calls_today = "$aryA[0]"; + $calls_today++; + } + $sthA->finish(); + + if ($sthArows > 0) + { + $stmtA = "UPDATE vicidial_live_inbound_agents set calls_today='$calls_today' WHERE user='$VDADuser' and group_id='$channel_group';"; + my $affected_rows = $dbhA->do($stmtA); + $stmtA = "UPDATE vicidial_inbound_group_agents set calls_today='$calls_today' WHERE user='$VDADuser' and group_id='$channel_group';"; + my $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDLIA agent calls: |$calls_today|$VDADuser|$channel_group|"; &agi_output;} + } + + usleep(1*500*1000); + + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $VDADconf_exten\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $stmtA = "UPDATE vicidial_closer_log set queue_seconds='$drop_timer' where lead_id = '$insert_lead_id' and call_date='$SQLdate';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$insert_lead_id|\n|$stmtA|"; &agi_output;} + + $dbhA->disconnect(); + + $now_date_epoch = time(); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + if ($AGILOG) {$agi_string = "XXXXX VDAD transferred: start|stop $start_time|$now_date"; &agi_output;} + + exit; + } + else + { + if ($AGILOG) {$agi_string = "NNNNN No available local agent found"; &agi_output;} + } + } + else + { + ### For Debugging purposes display the call ahead of this call + if ( ($rec_countWAIT == '1') && ($drop_timer > 3) && ($AGILOG) ) + { + $stmtA = "SELECT call_time,campaign_id,last_update_time,callerid,status,channel FROM vicidial_auto_calls where status = 'LIVE' and server_ip='$VARserver_ip' and campaign_id = '$channel_group' and call_time < \"$SQLdateBEGIN\" and lead_id != '$insert_lead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $r=0; + $agi_string="\n"; + while ($sthArows > $r) + { + @aryA = $sthA->fetchrow_array; + $agi_string .= "|$aryA[0]|$aryA[1]|$aryA[2]|$aryA[3]|$aryA[4]|$aryA[5]|\n"; + $r++; + } + $sthA->finish(); + &agi_output; + } + if ($AGILOG) {$agi_string = "WWWWW VDAD XFER LOCAL WAIT: |$rec_countWAIT|$channel_group|$channel|$callerid|$uniqueid|$drop_timer|"; &agi_output;} + } +} + +if ($agent_search_method =~ /^LO|^LB/) +{ + +################################################################################################### +##### Attempt to send call to an agent on any server ##### + $cbc=0; + $rec_countWAITrem=0; + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and campaign_id = '$channel_group' and call_time < \"$SQLdateBEGIN\" and lead_id != '$insert_lead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + while ($sthArows > $cbc) + { + @aryA = $sthA->fetchrow_array; + $rec_countWAITrem = "$aryA[0]"; + $cbc++; + } + $sthA->finish(); + + if ($rec_countWAITrem < 1) + { + if ($aco_sub>0) + { + $stmtA = "LOCK TABLES vicidial_live_agents WRITE, vicidial_live_inbound_agents WRITE;"; + my $LOCKaffected_rows = $dbhA->do($stmtA); + + $stmtA = "SELECT vicidial_live_agents.conf_exten,vicidial_live_agents.user,vicidial_live_agents.extension,vicidial_live_agents.server_ip from vicidial_live_agents JOIN vicidial_live_inbound_agents ON vicidial_live_agents.user=vicidial_live_inbound_agents.user WHERE status IN('CLOSER','READY') and vicidial_live_inbound_agents.group_id='$channel_group' and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_countCUSTDATA=0; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + + $VDADconf_exten = "$aryA[0]"; + $VDADuser = "$aryA[1]"; + $VDADextension = "$aryA[2]"; + $VDADserver_ip = "$aryA[3]"; + } + $sthA->finish(); + + if ($sthArows > 0) + { + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$insert_lead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid', call_server_ip='$VARserver_ip' where user='$VDADuser';"; + my $affected_rows = $dbhA->do($stmtA); + $found_agents=$affected_rows; + } + else + { + $affected_rows=0; + } + + $stmtA = "UNLOCK TABLES;"; + my $LOCKaffected_rows = $dbhA->do($stmtA); + } + else + { + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$insert_lead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid', call_server_ip='$VARserver_ip' where status IN('CLOSER','READY') and campaign_id IN($INBOUNDcampsSQL) and closer_campaigns LIKE \"% $channel_group %\" and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + my $affected_rows = $dbhA->do($stmtA); + $found_agents=$affected_rows; + } + if ($AGILOG) {$agi_string = "-- VDAD get agent: |$DROP_TIME|$drop_timer|$affected_rows|$found_agents|update of vla table: $channel_group|\n|$stmtA|"; &agi_output;} + if ($found_agents > 0) + { + if ($aco_sub<1) + { + $cbc=0; + $stmtA = "SELECT conf_exten,user,extension,server_ip FROM vicidial_live_agents where status = 'QUEUE' and campaign_id IN($INBOUNDcampsSQL) and callerid='$callerid' and channel='$channel' order by last_call_time limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_countCUSTDATA=0; + while ($sthArows > $cbc) + { + @aryA = $sthA->fetchrow_array; + $VDADconf_exten = "$aryA[0]"; + $VDADuser = "$aryA[1]"; + $VDADextension = "$aryA[2]"; + $VDADserver_ip = "$aryA[3]"; + $cbc++; + } + $sthA->finish(); + } + $stmtA = "UPDATE vicidial_auto_calls set status='CLOSER', stage='CLOSER-$drop_timer' where callerid='$callerid';"; + my $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDCL XFER REMOTE: |$affected_rows|update of vac table: $callerid\n|$stmtA|"; &agi_output;} + if ($affected_rows < 1) + { + $stmtA = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,uniqueid,callerid,channel,phone_code,phone_number,call_time,call_type,stage) values('$VARserver_ip','$channel_group','CLOSER','$insert_lead_id','$uniqueid','$callerid','$channel','$phone_code','$phone_number','$SQLdate','IN','CLOSER-$drop_timer')"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "$affected_rows|VDAC-reinsert|$stmtA|"; &agi_output;} + } + + $stmtA = "UPDATE vicidial_xfer_log set closer='$VDADuser' where lead_id = '$insert_lead_id' order by call_date desc limit 1;"; + my $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDXL vicidial_xfer_log update: |$affected_rows|$insert_lead_id|$VDADuser\n|$stmtA|"; &agi_output;} + + $stmtA = "UPDATE vicidial_closer_log set user='$VDADuser' where lead_id='$insert_lead_id' order by call_date desc limit 1;"; + my $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- closer log : |$affected_rows|update of vcl table: $insert_lead_id\n|$stmtA|"; &agi_output;} + + ### format the remote server dialstring to get the call to the overflow agent meetme room + $S='*'; + if( $VDADserver_ip =~ m/(\S+)\.(\S+)\.(\S+)\.(\S+)/ ) + { + $a = leading_zero($1); + $b = leading_zero($2); + $c = leading_zero($3); + $d = leading_zero($4); + $VDADremDIALstr = "$a$S$b$S$c$S$d$S"; + } + $alertVDADremDIALstr = "$VDADremDIALstr"; + $alertVDADremDIALstr .= "7$VDADconf_exten"; + $VDADremDIALstr .= "$VDADconf_exten"; + + ### if agent alert exten is not disabled, then trigger the alert and wait + if ($agent_alert_exten !~ /X/i) + { + $VHqueryCID = "VH$CIDdate$VDADconf_exten"; + + ### insert a NEW record to the vicidial_manager table to play the alert message to the agent + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$VARserver_ip','','Originate','$VHqueryCID','Exten: $agent_alert_exten','Context: $ext_context','Channel: Local/$alertVDADremDIALstr$at$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: 10','','','','')"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDCL agent alert: |$VHqueryCID|$alertVDADremDIALstr|$channel|insert to vicidial_manager"; &agi_output;} + + usleep(1 * $agent_alert_delay * 1000); + } + + if ($AGILOG) {$agi_string = "exiting VDAD app, transferring call to $VDADremDIALstr"; &agi_output;} + + $AGI->stream_file('ding'); # stop music-on-hold process + + ### update calls_today for vicidial_live_inbound_agents ### + $stmtA = "SELECT calls_today from vicidial_inbound_group_agents WHERE user='$VDADuser' and group_id='$channel_group';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $calls_today = "$aryA[0]"; + $calls_today++; + } + $sthA->finish(); + + if ($sthArows > 0) + { + $stmtA = "UPDATE vicidial_live_inbound_agents set calls_today='$calls_today' WHERE user='$VDADuser' and group_id='$channel_group';"; + my $affected_rows = $dbhA->do($stmtA); + $stmtA = "UPDATE vicidial_inbound_group_agents set calls_today='$calls_today' WHERE user='$VDADuser' and group_id='$channel_group';"; + my $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDLIA agent calls: |$calls_today|$VDADuser|$channel_group|"; &agi_output;} + } + + usleep(1*500*1000); + + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $VDADremDIALstr\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $stmtA = "UPDATE vicidial_closer_log set queue_seconds='$drop_timer' where lead_id = '$insert_lead_id' and call_date='$SQLdate';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$insert_lead_id|\n|$stmtA|"; &agi_output;} + + $dbhA->disconnect(); + + $now_date_epoch = time(); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + if ($AGILOG) {$agi_string = "XXXXX VDAD transferred: start|stop $start_time|$now_date"; &agi_output;} + + exit; + } + else + { + if ($AGILOG) {$agi_string = "NNNNN No available balance agent found"; &agi_output;} + } + } + else + { + if ( ($rec_countWAITrem == '1') && ($drop_timer > 3) && ($AGILOG) ) + { + $stmtA = "SELECT call_time,campaign_id,last_update_time,callerid,status,channel FROM vicidial_auto_calls where status = 'LIVE' and campaign_id = '$channel_group' and call_time < \"$SQLdateBEGIN\" and lead_id != '$insert_lead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $r=0; + $agi_string="\n"; + while ($sthArows > $r) + { + @aryA = $sthA->fetchrow_array; + $agi_string .= "|$aryA[0]|$aryA[1]|$aryA[2]|$aryA[3]|$aryA[4]|$aryA[5]|\n"; + $r++; + } + $sthA->finish(); + &agi_output; + } + + if ($AGILOG) {$agi_string = "WWWWW VDAD XFER BALANCE WAIT: |$rec_countWAITrem|$channel_group|$channel|$callerid|$uniqueid|$drop_timer|"; &agi_output;} + } + +} +if ($hold_message_counter > $prompt_interval) + { + $AGI->stream_file('sip-silence'); # stop music-on-hold process + $AGI->stream_file("$onhold_prompt_filename"); + $hold_message_counter = 0; + $start_moh=1; + } + else {$hold_message_counter++;} +if ($hold_tone_counter > 3) + { + $hold_tone_counter = 0; + } + else {$hold_tone_counter++;} + +if ($drop_timer < 3) + { + ### sleep for 23 hundredths of a second + usleep(1*230*1000); + $drop_timer = ($drop_timer + 0.25); + } +else + { + if ($start_moh > 0) + { + $start_moh=0; + print "SET MUSIC ON $moh_context\n"; + checkresult($result); + } + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + + $drop_timer++; + } + +$stmtA = "UPDATE vicidial_auto_calls set stage='LIVE-$drop_timer' where callerid='$callerid';"; +$affected_rows = $dbhA->do($stmtA); +if ($affected_rows < 1) + { + $stmtA = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,uniqueid,callerid,channel,phone_code,phone_number,call_time,call_type,stage) values('$VARserver_ip','$channel_group','CLOSER','$insert_lead_id','$uniqueid','$callerid','$channel','$phone_code','$phone_number','$SQLdate','IN','CLOSER-$drop_timer')"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "$affected_rows|VDAC-reinsert|$stmtA|"; &agi_output;} + } +#if ($AGILOG) {$agi_string = "-- VDAD : |$affected_rows|update of vac table: $callerid\n|$stmtA|"; &agi_output;} + +} + + + + + + + + + + + + + +if ($drop_timer > $DROP_TIME) +{ +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $VDADvoicemail_ext = ''; + +$DROPexten = ''; +if ($drop_seconds < 1) + { + $drop_seconds = $DROP_TIME; + + if ($drop_message =~ /Y/) + { + $DROPexten = "$drop_exten"; + } + else + { + if (length($VDADvoicemail_ext)>0) + {$DROPexten = "$voicemail_dump_exten$VDADvoicemail_ext";} + } + } + + + ### use STDOUT to send call to proper DROP location + $VHqueryCID = "VH$CIDdate$VDADconf_exten"; + + if (length($DROPexten)>0) + { ### if DROP extension is defined then send the dropped call there instead of hangup + + $AGI->stream_file('ding'); # stop music-on-hold process + + sleep(1); + + if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $DROPexten"; &agi_output;} + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $DROPexten\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + } + else + { + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$VARserver_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDCL call_hungup timout: |$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager"; &agi_output;} + } + + $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' and server_ip='$VARserver_ip' order by call_time desc limit 1;"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDCL vac record deleted: |$affected_rows| $VDADcampaign|"; &agi_output;} + + $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds',queue_seconds='$drop_seconds' where lead_id = '$insert_lead_id' order by start_epoch desc limit 1;"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$insert_lead_id|\n|$stmtA|"; &agi_output;} + + $stmtA = "UPDATE vicidial_list set status='XDROP' where lead_id = '$insert_lead_id';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDCL vl update: |$affected_rows|$insert_lead_id|\n|$stmtA|"; &agi_output;} +} + +$dbhA->disconnect(); + +exit; + +sub enter_pin_number +{ + +$digits_to_collect =~ s/DIGITID//gi; + +# please enter the pin number followed by the pound key +# please enter your X digit pin number + +$digit=''; +undef $digit; +$interrupt_digit=''; +undef $interrupt_digit; + +$interrupt_digit = $AGI->stream_file('four_digit_id','123456789'); + + if ($AGILOG) {$agi_string = "interrupt_digit |$interrupt_digit|"; &agi_output;} + +$digits_being_entered=1; +$totalDTMF=''; +if ($interrupt_digit > 1) + { + if ($interrupt_digit == 48) {$interrupt_digit=0;} + if ($interrupt_digit == 49) {$interrupt_digit=1;} + if ($interrupt_digit == 50) {$interrupt_digit=2;} + if ($interrupt_digit == 51) {$interrupt_digit=3;} + if ($interrupt_digit == 52) {$interrupt_digit=4;} + if ($interrupt_digit == 53) {$interrupt_digit=5;} + if ($interrupt_digit == 54) {$interrupt_digit=6;} + if ($interrupt_digit == 55) {$interrupt_digit=7;} + if ($interrupt_digit == 56) {$interrupt_digit=8;} + if ($interrupt_digit == 57) {$interrupt_digit=9;} + + $totalDTMF=$interrupt_digit; + } + +$digit_loop_counter=0; + +while ( ($digit_loop_counter < $digits_to_collect) ) + { + $digit = chr($AGI->wait_for_digit('10000')); # wait 10 seconds for input or until the pound key is pressed + if ($digit =~ /\d/) + { + $totalDTMF = "$totalDTMF$digit"; + if ($AGILOG) {$agi_string = "digit |$digit| TotalDTMF |$totalDTMF|"; &agi_output;} +# $AGI->say_digits("$digit"); + undef $digit; + } + else + { + $digit_loop_counter=$digits_to_collect; + } + + $digit_loop_counter++; + } + +$totalDTMF =~ s/\D//gi; +$pin = $totalDTMF; +if ($totalDTMF) {if ($AGILOG) {$agi_string = "digit |$digit| TotalDTMF |$totalDTMF|"; &agi_output;}} +} + + + + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + # print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} + + +sub leading_zero($) +{ + $_ = $_[0]; + s/^(\d)$/0$1/; + s/^(\d\d)$/0$1/; + return $_; +} # End of the leading_zero() routine. + + + +### you're call is very important to us, please stay on the line and you will be transferred to the next available agent + + +sub agi_output +{ +if ($AGILOG >=2) + { + ### open the log file for writing ### + open(Lout, ">>$AGILOGfile") + || die "Can't open $AGILOGfile: $!\n"; + print Lout "$now_date|$script|$agi_string\n"; + close(Lout); + } + ### send to STDERR writing ### +if ( ($AGILOG == '1') || ($AGILOG == '3') ) + {print STDERR "$now_date|$script|$agi_string\n";} +$agi_string=''; +} diff --git a/agc_2-X/branches/agc_2.0.4/agi/agi-VDAD_LB_transfer.agi b/agc_2-X/branches/agc_2.0.4/agi/agi-VDAD_LB_transfer.agi new file mode 100644 index 00000000..d0987ea4 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/agi/agi-VDAD_LB_transfer.agi @@ -0,0 +1,804 @@ +#!/usr/bin/perl +# +# agi-VDAD_LB_transfer.agi version 2.0.4 *DBI-version* +# Load Balanced - when a call comes in on this server the script looks for an agent +# on any server on the network on the same campaign to send call to. +# +# runs when a call comes in from the VICIDIAL_auto_dialer. This script will +# send the calls out to the reps that are logged in. +# +# if there are no available agents, then it will check every second until an agent becomes available, +# if at the end of 10 seconds(default) it has not found an agent it will hangup the call and mark it as dropped. +# +# this version "LB" Load Balance will seek out agents on the local server and the +# same campaign on other servers and transfer the calls to them over IAX trunks. +# the IAX user trunks are named based on the IP address of the home server: +# The server 10.10.10.15 would have a username of 10x10x10x15 in the iax.conf on the other servers +# Also, the home server needs to have the trunks registered, for speed and channel consistency +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ;VICIDIAL_auto_dialer transfer script: +# exten => 8365,1,AGI(call_log.agi,${EXTEN}) +# exten => 8365,2,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) +# +# +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# +# CHANGELOG: +# 51118-2102 - First build based on agi-VDADtransfer.agi script +# 60119-1408 - Fixed calleridname issue with 1.2 tree for custom CID +# 60503-1043 - Added safe harbor and drop second options from campaign +# 60731-1441 - Changed to use DBI-DBD::mysql +# - Changed to use /etc/astguiclient.conf for configs +# 60816-1034 - Added output options check from database +# - Changed look for agent every 0.5 second for first 4 sec on hold +# 60905-1047 - Changed look for agent every 0.25 second for first 4 sec on hold +# 70215-1052 - Added QueueMetrics optional logging +# 70223-1101 - Added QueueMetrics ENTERQUEUE prepend option +# 70305-1251 - Fixed problems where the same call will run this script twice +# 71116-1045 - added fewest_calls and campaign_weight agent call routing options +# + +$script = 'agi-VDAD_LB_transfer.agi'; + +$DROP_TIME = 10; # default number of seconds to wait until you drop a waiting call + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +if (!$VARDB_port) {$VARDB_port='3306';} +if (!$AGILOGfile) {$AGILOGfile = "$PATHlogs/agiout.$year-$mon-$mday";} + +use DBI; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### Grab Server values from the database +$stmtA = "SELECT voicemail_dump_exten,ext_context,answer_transfer_agent,local_gmt,asterisk_version,max_vicidial_trunks,agi_output FROM servers where server_ip = '$VARserver_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBvoicemail_dump_exten = "$aryA[0]"; + $DBext_context = "$aryA[1]"; + $DBanswer_transfer_agent = "$aryA[2]"; + $DBSERVER_GMT = "$aryA[3]"; + $DBasterisk_version = "$aryA[4]"; + $DBmax_vicidial_trunks = "$aryA[5]"; + $DBagi_output = "$aryA[6]"; + if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;} + if ($DBext_context) {$ext_context = $DBext_context;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';} + if ($DBagi_output =~ /FILE/) {$AGILOG = '2';} + if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';} + $rec_count++; + } +$sthA->finish(); + +$start_time=$now_date; +$CIDdate = "$mon$mday$hour$min$sec"; +$tsSQLdate = "$year$mon$mday$hour$min$sec"; +$SQLdate = "$year-$mon-$mday $hour:$min:$sec"; +$SQLdateBEGIN = $SQLdate; + +$secX = time(); +$BDtarget = ($secX - 5); +($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); +$Byear = ($Byear + 1900); +$Bmon++; +if ($Bmon < 10) {$Bmon = "0$Bmon";} +if ($Bmday < 10) {$Bmday = "0$Bmday";} +if ($Bhour < 10) {$Bhour = "0$Bhour";} +if ($Bmin < 10) {$Bmin = "0$Bmin";} +if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + if ($AGILOG) {$agi_string = "Perl Environment Dump:"; &agi_output;} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($AGILOG) {$agi_string = "$i|$ARGV[$i]"; &agi_output;} + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} + +$|=1; +while() +{ + chomp; + last unless length($_); + if ($AGILOG) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_priority\:\s+(.*)$/) {$priority = $1;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} +} + +if ( (length($callerid)>20) && ($callerid =~ /\"\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S/) ) + { + $callerid =~ s/^\"//gi; + $callerid =~ s/\".*$//gi; + ### set the callerid to the ACQS value(calleridname) + print "SET CALLERID $callerid\n"; + checkresult($result); + if ($AGILOG) {$agi_string = "callerID changed: $callerid"; &agi_output;} + } +if ( ( +(length($calleridname)>5) && ( (!$callerid) or ($callerid =~ /unknown|private|00000000/i) or ($callerid =~ /5551212/) ) +) or ( (length($calleridname)>17) && ($calleridname =~ /\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/) ) ) + { + $callerid = $calleridname; + ### set the callerid to the ACQS value(calleridname) + print "SET CALLERID $callerid\n"; + checkresult($result); + if ($AGILOG) {$agi_string = "callerID changed: $callerid"; &agi_output;} + } + + +if ($AGILOG) {$agi_string = "AGI Environment Dump:"; &agi_output;} + +foreach $i (sort keys %AGI) +{ + if ($AGILOG) {$agi_string = " -- $i = $AGI{$i}"; &agi_output;} +} + +if ($AGILOG) {$agi_string = "AGI Variables: |$unique_id|$channel|$extension|$type|$callerid|$calleridname|$priority|"; &agi_output;} + +$VDADcampaign=''; +$VDADphone=''; +$VDADphone_code=''; + +$callerid =~ s/\"//gi; +$CIDlead_id = $callerid; +$CIDlead_id = substr($CIDlead_id, 11, 9); +$CIDlead_id = ($CIDlead_id + 0); + +if ($AGILOG) {$agi_string = "+++++ VDAD START : |$CIDlead_id|$now_date|$AST_ver|$priority|"; &agi_output;} + +if ( ($channel =~ /Local/i) && ($AST_ver !~ /^1\.0\.8|^1\.0\.9/) ) +{ +if ($AGILOG) {$agi_string = "+++++ VDAD START LOCAL CHANNEL: EXITING- $priority"; &agi_output;} +if ($priority > 2) {sleep(1);} +exit; +} + +$stmtA = "SELECT count(*) FROM vicidial_live_agents where callerid='$callerid';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $Pseudo_duplicate_count = "$aryA[0]"; + $rec_count++; + } +$sthA->finish(); + +if ($Pseudo_duplicate_count > 0) +{ +if ($AGILOG) {$agi_string = "+++++ VDAD START PSEUDO DUPLICATE: EXITING- $priority"; &agi_output;} +exit; +} + +$stmtA = "SELECT count(*) FROM vicidial_auto_calls where callerid='$callerid' and status IN('LIVE','XFER');"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $dialplan_duplicate_count = "$aryA[0]"; + $rec_count++; + } +$sthA->finish(); + +if ($dialplan_duplicate_count > 0) +{ +if ($AGILOG) {$agi_string = "+++++ VDAD START DIALPLAN DUPLICATE: EXITING- $priority"; &agi_output;} +exit; +} + + + +### Grab call parameters from vicidial_auto_calls table +$stmtA = "UPDATE vicidial_auto_calls set uniqueid='$unique_id', channel='$channel',status='LIVE',stage='LIVE-0' where callerid='$callerid' order by call_time desc limit 1;"; +$affected_rows = $dbhA->do($stmtA); +if ($AGILOG) {$agi_string = "-- VDAD : |$affected_rows|update of vac table: $callerid\n|$stmtA|"; &agi_output;} +if ($affected_rows > 0) + { + $stmtA = "SELECT campaign_id,phone_number,phone_code,lead_id,call_time FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VDADcampaign = "$aryA[0]"; + $VDADphone = "$aryA[1]"; + $VDADphone_code = "$aryA[2]"; + $VDADlead_id = "$aryA[3]"; + $VDADcall_time = "$aryA[4]"; + $rec_count++; + } + $sthA->finish(); + + ### Grab campaign values from the database + $stmtA = "SELECT drop_call_seconds,safe_harbor_message,safe_harbor_exten,concurrent_transfers FROM vicidial_campaigns where campaign_id = '$VDADcampaign';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBdrop_call_seconds = "$aryA[0]"; + $DBsafe_harbor_message = "$aryA[1]"; + $DBsafe_harbor_exten = "$aryA[2]"; + $DBconcurrent_transfers = "$aryA[3]"; + if ($DBdrop_call_seconds) {$DROP_TIME = $DBdrop_call_seconds;} + if ($DBsafe_harbor_message) {$safe_harbor_message = $DBsafe_harbor_message;} + if ($DBsafe_harbor_exten) {$safe_harbor_exten = $DBsafe_harbor_exten;} + $rec_count++; + } + $sthA->finish(); + + $stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$uniqueid','$CIDlead_id','$VDADcampaign','$SQLdate','$now_date_epoch','QUEUE','$VDADphone_code','$VDADphone','VDAD','N')"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + + if ($AGILOG) {$agi_string = "-- VDAD : |$VDADlead_id|$CIDlead_id|insert to vicidial_log: $uniqueid"; &agi_output;} + + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_eq_prepend FROM system_settings;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $enable_queuemetrics_logging = "$aryA[0]"; + $queuemetrics_server_ip = "$aryA[1]"; + $queuemetrics_dbname = "$aryA[2]"; + $queuemetrics_login= "$aryA[3]"; + $queuemetrics_pass = "$aryA[4]"; + $queuemetrics_log_id = "$aryA[5]"; + $queuemetrics_eq_prepend = "$aryA[6]"; + $rec_count++; + } + $sthA->finish(); + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + $stmtA = "SELECT phone_number FROM vicidial_auto_calls where lead_id='$CIDlead_id';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $phone_number = "$aryA[0]"; + $data2 = "$phone_number"; + $rec_count++; + } + $sthA->finish(); + + if ( (length($queuemetrics_eq_prepend) > 0) && ($queuemetrics_eq_prepend !~ /NONE/) ) + { + $stmtA = "SELECT $queuemetrics_eq_prepend FROM vicidial_list where lead_id='$CIDlead_id';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + $DASH='-'; + @aryA = $sthA->fetchrow_array; + $QMprepend = "$aryA[0]"; + $rec_count++; + $data2 = "$QMprepend$DASH$phone_number"; + } + $sthA->finish(); + } + + $dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} + + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='$callerid',queue='$VDADcampaign',agent='NONE',verb='ENTERQUEUE',data2='$data2',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } + } + +$drop_timer=0; +$drop_seconds=0; +$hold_message_counter=25; +$hold_tone_counter=0; + +while ($drop_timer <= $DROP_TIME) +{ +$channel_status = $AGI->channel_status("$channel"); +if ($channel_status < 1) + { + if ($AGILOG) {$agi_string = "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer CHECKING AGAIN"; &agi_output;} + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + + $channel_status_DC = $AGI->channel_status("$channel"); + + if ($channel_status_DC < 1) + { + if ($AGILOG) {$agi_string = "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer"; &agi_output;} + if ($drop_timer < $DROP_TIME) {$drop_seconds = $drop_timer;} + $drop_timer = ($drop_timer + $DROP_TIME); + } + } +$stmtA = "SELECT next_agent_call FROM vicidial_campaigns where campaign_id='$VDADcampaign';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $CAMP_callorder = "$aryA[0]"; + $rec_count++; + } +$sthA->finish(); + +$agent_call_order=''; +if ($CAMP_callorder =~ /overall_user_level/i) {$agent_call_order = 'order by user_level desc,last_call_finish';} +if ($CAMP_callorder =~ /oldest_call_start/i) {$agent_call_order = 'order by last_call_time';} +if ($CAMP_callorder =~ /oldest_call_finish/i) {$agent_call_order = 'order by last_call_finish';} +if ($CAMP_callorder =~ /random/i) {$agent_call_order = 'order by random_id';} +if ($CAMP_callorder =~ /campaign_rank/i) {$agent_call_order = 'order by campaign_weight desc,last_call_finish';} +if ($CAMP_callorder =~ /fewest_calls/i) {$agent_call_order = 'order by calls_today,last_call_finish';} + + $rec_countWAIT=0; +$stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and campaign_id = '$VDADcampaign' and call_time < \"$VDADcall_time\" and lead_id != '$VDADlead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $rec_countWAIT = "$aryA[0]"; + $rec_count++; + } +$sthA->finish(); +if ($DBconcurrent_transfers =~ /AUTO/) + { + $active_agents=1; + $stmtA = "SELECT count(*) FROM vicidial_live_agents where campaign_id = '$VDADcampaign' and last_update_time > '$BDtsSQLdate';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $active_agents = "$aryA[0]"; + $rec_count++; + } + + $DBconcurrent_transfers = ($active_agents / 10); + $DBconcurrent_transfers = sprintf("%.0f", $DBconcurrent_transfers); + $DBconcurrent_transfers++; + if ($AGILOG) {$agi_string = "|CONCURRENT TRANSFERS AUTO SETTING: $DBconcurrent_transfers ($active_agents)|"; &agi_output;} + } +$sthA->finish(); +if ($rec_countWAIT < $DBconcurrent_transfers) + { + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$CIDlead_id',uniqueid='$unique_id', channel='$channel', call_server_ip='$VARserver_ip', callerid='$callerid' where status = 'READY' and campaign_id='$VDADcampaign' and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD get agent: |$affected_rows|update of vla table: $VDADcampaign|$VARserver_ip\n|$stmtA|"; &agi_output;} + if ($affected_rows > 0) + { + $r=0; + $VDADuser=''; + while ( (length($VDADuser)<1) && ($r<3) ) + { + $stmtA = "SELECT conf_exten,user,extension,server_ip FROM vicidial_live_agents where status IN('QUEUE','INCALL') and campaign_id='$VDADcampaign' and callerid='$callerid' and channel='$channel' order by last_call_time limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VDADconf_exten = "$aryA[0]"; + $VDADuser = "$aryA[1]"; + $VDADextension = "$aryA[2]"; + $VDADserver_ip = "$aryA[3]"; + $rec_count++; + } + $sthA->finish(); + $r++; + if ($r > 1) + { + if ($AGILOG) + {$agi_string = "EEEEEEEEEE vla UPDATE DELAY!!! |$callerid|$r|"; &agi_output;} + + ### sleep for 23 hundredths of a second + usleep(1*230*1000); + $drop_timer = ($drop_timer + 0.25); + } + if ($r > 2) + { + $stmtA = "SELECT conf_exten,user,extension,server_ip FROM vicidial_live_agents where callerid='$callerid' order by last_call_time limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VDADconf_exten = "$aryA[0]"; + $VDADuser = "$aryA[1]"; + $VDADextension = "$aryA[2]"; + $VDADserver_ip = "$aryA[3]"; + $rec_count++; + } + $sthA->finish(); + + if ($AGILOG) {$agi_string = "FFFFFFFFFF vla OR SELECT |$callerid|$VDADuser|"; &agi_output;} + } + } + + $stmtA = "UPDATE vicidial_auto_calls set status='XFER', stage='XFER-$drop_timer' where callerid='$callerid';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD XFER : |$affected_rows|update of vac table: $callerid\n|$stmtA|"; &agi_output;} + + $dbhA->disconnect(); + + if ($enable_queuemetrics_logging > 0) + { + $dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} + + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='$callerid',queue='$VDADcampaign',agent='Agent/$VDADuser',verb='CONNECT',data1='$drop_timer',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } + + ### format the remote server dialstring to get the call to the overflow agent meetme room + $S='*'; + $VDADremDIALstr=''; + if( ($VDADserver_ip =~ m/(\S+)\.(\S+)\.(\S+)\.(\S+)/) && ($VDADserver_ip !~ /$VARserver_ip/) ) + { + $a = leading_zero($1); + $b = leading_zero($2); + $c = leading_zero($3); + $d = leading_zero($4); + $VDADremDIALstr = "$a$S$b$S$c$S$d$S"; + } + $VDADremDIALstr .= "$VDADconf_exten"; + + if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $VDADremDIALstr"; &agi_output;} + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $VDADremDIALstr\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $now_date_epoch = time(); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + if ($AGILOG) {$agi_string = "XXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date"; &agi_output;} + + exit; + } + else + { + if ($AGILOG) {$agi_string = "NNNNNNNNNN No agent record found!!!"; &agi_output;} + } + } +else + { + if ($AGILOG) {$agi_string = "WWWWWWWW VDAD XFER REMOTE WAIT: |$rec_countWAIT|$VDADcampaign|$channel|$callerid|$uniqueid|"; &agi_output;} + } + + +if ($drop_timer < 3) + { + ### sleep for 23 hundredths of a second + usleep(1*230*1000); + $drop_timer = ($drop_timer + 0.25); + } +else + { + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + + $drop_timer++; + } + +$stmtA = "UPDATE vicidial_auto_calls set stage='LIVE-$drop_timer' where callerid='$callerid';"; +$affected_rows = $dbhA->do($stmtA); +#if ($AGILOG) {$agi_string = "-- VDAD : |$affected_rows|update of vac table: $callerid\n|$stmtA|"; &agi_output;} + +} + + +if ($drop_timer >= $DROP_TIME) +{ +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $VDADvoicemail_ext = ''; + +$DROPexten = ''; +if ($drop_seconds < 1) + { + $drop_seconds = $DROP_TIME; + + if ($enable_queuemetrics_logging > 0) + { + $dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} + + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='$callerid',queue='$VDADcampaign',agent='NONE',verb='EXITWITHTIMEOUT',data1='1',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } + + if ($safe_harbor_message =~ /Y/) + { + $DROPexten = "$safe_harbor_exten"; + } + else + { + $stmtA = "SELECT voicemail_ext FROM vicidial_campaigns where campaign_id = '$VDADcampaign' limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VDADvoicemail_ext = "$aryA[0]"; + $VDADvoicemail_ext =~ s/\D//gi; + if (length($VDADvoicemail_ext)>0) + {$DROPexten = "$voicemail_dump_exten$VDADvoicemail_ext";} + $rec_count++; + } + $sthA->finish(); + } + } + + + ### use STDOUT to send call to proper DROP location + $VHqueryCID = "VH$CIDdate$VDADconf_exten"; + + if (length($DROPexten)>0) + { ### if DROP extension is defined then send the dropped call there instead of hangup + if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $DROPexten"; &agi_output;} + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $DROPexten\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + } + else + { + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$VARserver_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD call_hungup timout: |$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager"; &agi_output;} + } + + $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vac record deleted: |$affected_rows|$VDADcampaign|"; &agi_output;} + + $stmtA = "UPDATE vicidial_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where uniqueid = '$uniqueid';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vicidial_log update: |$affected_rows|$uniqueid"; &agi_output;} + + $stmtA = "UPDATE vicidial_list set status='DROP' where lead_id = '$CIDlead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vicidial_list update: |$affected_rows|$CIDlead_id"; &agi_output;} +} + + + + $dbhA->disconnect(); + + + +exit; + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + # print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} + +sub leading_zero($) { + $_ = $_[0]; + s/^(\d)$/0$1/; + s/^(\d\d)$/0$1/; + return $_; +} # End of the leading_zero() routine. + +sub agi_output +{ +if ($AGILOG >=2) + { + ### open the log file for writing ### + open(Lout, ">>$AGILOGfile") + || die "Can't open $AGILOGfile: $!\n"; + print Lout "$now_date|$script|$agi_string\n"; + close(Lout); + } + ### send to STDERR writing ### +if ( ($AGILOG == '1') || ($AGILOG == '3') ) + {print STDERR "$now_date|$script|$agi_string\n";} +$agi_string=''; +} diff --git a/agc_2-X/branches/agc_2.0.4/agi/agi-VDAD_LO_transfer.agi b/agc_2-X/branches/agc_2.0.4/agi/agi-VDAD_LO_transfer.agi new file mode 100644 index 00000000..9155f807 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/agi/agi-VDAD_LO_transfer.agi @@ -0,0 +1,952 @@ +#!/usr/bin/perl +# +# agi-VDAD_LO_transfer.agi version 2.0.4 *DBI-version* +# Overflow Balanced - when a call comes in on this server the script looks for an agent +# on this server to send call to. If none available it looks for the next available +# agent on any other server on the network on the same campaign to send call to. +# +# runs when a call comes in from the VICIDIAL_auto_dialer. This script will +# send the calls out to the reps that are logged in. +# +# if there are no available agents, then it will check every second until an agent becomes available, +# if at the end of 20 seconds it has not found an agent it will hangup the call and mark it as dropped. +# +# this version "LO" Load Overflow checks first with local agents then it will seek out agents on the +# same campaign on other servers and transfer the calls to them over IAX trunks. +# the IAX user trunks are named based on the IP address of the home server: +# The server 10.10.10.15 would have a username of 10x10x10x15 in the iax.conf on the other servers +# Also, the home server needs to have the trunks registered, for speed and channel consistency +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ;VICIDIAL_auto_dialer transfer script: +# exten => 8365,1,AGI(call_log.agi,${EXTEN}) +# exten => 8365,2,AGI(agi-VDAD_LO_transfer.agi,${EXTEN}) +# +# +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# +# changes: +# 51118-2102 - First build based on agi-VDADtransfer.agi script +# 60119-1408 - Fixed calleridname issue with 1.2 tree for custom CID +# 60503-1048 - Added safe harbor and drop second options from campaign +# 60731-1441 - Changed to use DBI-DBD::mysql +# - Changed to use /etc/astguiclient.conf for configs +# 60816-1034 - Added output options check from database +# - Changed look for agent every 0.5 second for first 4 sec on hold +# 60905-1047 - Changed look for agent every 0.25 second for first 4 sec on hold +# 70215-1052 - Added QueueMetrics optional logging +# 70223-1101 - Added QueueMetrics ENTERQUEUE prepend option +# 70305-1251 - Fixed problems where the same call will run this script twice +# 71116-1045 - added fewest_calls and campaign_weight agent call routing options +# + +$script = 'agi-VDAD_LO_transfer.agi'; + +$DROP_TIME = 10; # default number of seconds to wait until you drop a waiting call + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +if (!$VARDB_port) {$VARDB_port='3306';} +if (!$AGILOGfile) {$AGILOGfile = "$PATHlogs/agiout.$year-$mon-$mday";} + +use DBI; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### Grab Server values from the database +$stmtA = "SELECT voicemail_dump_exten,ext_context,answer_transfer_agent,local_gmt,asterisk_version,max_vicidial_trunks,agi_output FROM servers where server_ip = '$VARserver_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBvoicemail_dump_exten = "$aryA[0]"; + $DBext_context = "$aryA[1]"; + $DBanswer_transfer_agent = "$aryA[2]"; + $DBSERVER_GMT = "$aryA[3]"; + $DBasterisk_version = "$aryA[4]"; + $DBmax_vicidial_trunks = "$aryA[5]"; + $DBagi_output = "$aryA[6]"; + if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;} + if ($DBext_context) {$ext_context = $DBext_context;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';} + if ($DBagi_output =~ /FILE/) {$AGILOG = '2';} + if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';} + $rec_count++; + } +$sthA->finish(); + +$start_time=$now_date; +$CIDdate = "$mon$mday$hour$min$sec"; +$tsSQLdate = "$year$mon$mday$hour$min$sec"; +$SQLdate = "$year-$mon-$mday $hour:$min:$sec"; +$SQLdateBEGIN = $SQLdate; + +$secX = time(); +$BDtarget = ($secX - 5); +($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); +$Byear = ($Byear + 1900); +$Bmon++; +if ($Bmon < 10) {$Bmon = "0$Bmon";} +if ($Bmday < 10) {$Bmday = "0$Bmday";} +if ($Bhour < 10) {$Bhour = "0$Bhour";} +if ($Bmin < 10) {$Bmin = "0$Bmin";} +if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + if ($AGILOG) {$agi_string = "Perl Environment Dump:"; &agi_output;} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($AGILOG) {$agi_string = "$i|$ARGV[$i]"; &agi_output;} + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} + +$|=1; +while() +{ + chomp; + last unless length($_); + if ($AGILOG) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_priority\:\s+(.*)$/) {$priority = $1;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} +} + +if ( (length($callerid)>20) && ($callerid =~ /\"\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S/) ) + { + $callerid =~ s/^\"//gi; + $callerid =~ s/\".*$//gi; + ### set the callerid to the ACQS value(calleridname) + print "SET CALLERID $callerid\n"; + checkresult($result); + if ($AGILOG) {$agi_string = "callerID changed: $callerid"; &agi_output;} + } +if ( ( +(length($calleridname)>5) && ( (!$callerid) or ($callerid =~ /unknown|private|00000000/i) or ($callerid =~ /5551212/) ) +) or ( (length($calleridname)>17) && ($calleridname =~ /\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/) ) ) + { + $callerid = $calleridname; + ### set the callerid to the ACQS value(calleridname) + print "SET CALLERID $callerid\n"; + checkresult($result); + if ($AGILOG) {$agi_string = "callerID changed: $callerid"; &agi_output;} + } + + +if ($AGILOG) {$agi_string = "AGI Environment Dump:"; &agi_output;} + +foreach $i (sort keys %AGI) +{ + if ($AGILOG) {$agi_string = " -- $i = $AGI{$i}"; &agi_output;} +} + +if ($AGILOG) {$agi_string = "AGI Variables: |$unique_id|$channel|$extension|$type|$callerid|$calleridname|$priority|"; &agi_output;} + +$VDADcampaign=''; +$VDADphone=''; +$VDADphone_code=''; + +$callerid =~ s/\"//gi; +$CIDlead_id = $callerid; +$CIDlead_id = substr($CIDlead_id, 11, 9); +$CIDlead_id = ($CIDlead_id + 0); + +if ($AGILOG) {$agi_string = "+++++ VDAD START : |$CIDlead_id|$now_date|$AST_ver|$priority|"; &agi_output;} + +if ( ($channel =~ /Local/i) && ($AST_ver !~ /^1\.0\.8|^1\.0\.9/) ) +{ +if ($AGILOG) {$agi_string = "+++++ VDAD START LOCAL CHANNEL: EXITING- $priority"; &agi_output;} +if ($priority > 2) {sleep(1);} +exit; +} + +$stmtA = "SELECT count(*) FROM vicidial_live_agents where callerid='$callerid';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $Pseudo_duplicate_count = "$aryA[0]"; + $rec_count++; + } +$sthA->finish(); + +if ($Pseudo_duplicate_count > 0) +{ +if ($AGILOG) {$agi_string = "+++++ VDAD START PSEUDO DUPLICATE: EXITING- $priority"; &agi_output;} +exit; +} + +$stmtA = "SELECT count(*) FROM vicidial_auto_calls where callerid='$callerid' and status IN('LIVE','XFER');"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $dialplan_duplicate_count = "$aryA[0]"; + $rec_count++; + } +$sthA->finish(); + +if ($dialplan_duplicate_count > 0) +{ +if ($AGILOG) {$agi_string = "+++++ VDAD START DIALPLAN DUPLICATE: EXITING- $priority"; &agi_output;} +exit; +} + + + +### Grab call parameters from vicidial_auto_calls table +$stmtA = "UPDATE vicidial_auto_calls set uniqueid='$unique_id', channel='$channel',status='LIVE',stage='LIVE-0' where callerid='$callerid' order by call_time desc limit 1;"; +$affected_rows = $dbhA->do($stmtA); +if ($AGILOG) {$agi_string = "-- VDAD : |$affected_rows|update of vac table: $callerid\n|$stmtA|"; &agi_output;} +if ($affected_rows > 0) + { + $stmtA = "SELECT campaign_id,phone_number,phone_code,lead_id,call_time FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VDADcampaign = "$aryA[0]"; + $VDADphone = "$aryA[1]"; + $VDADphone_code = "$aryA[2]"; + $VDADlead_id = "$aryA[3]"; + $VDADcall_time = "$aryA[4]"; + $rec_count++; + } + $sthA->finish(); + + ### Grab campaign values from the database + $stmtA = "SELECT drop_call_seconds,safe_harbor_message,safe_harbor_exten,concurrent_transfers FROM vicidial_campaigns where campaign_id = '$VDADcampaign';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBdrop_call_seconds = "$aryA[0]"; + $DBsafe_harbor_message = "$aryA[1]"; + $DBsafe_harbor_exten = "$aryA[2]"; + $DBconcurrent_transfers = "$aryA[3]"; + if ($DBdrop_call_seconds) {$DROP_TIME = $DBdrop_call_seconds;} + if ($DBsafe_harbor_message) {$safe_harbor_message = $DBsafe_harbor_message;} + if ($DBsafe_harbor_exten) {$safe_harbor_exten = $DBsafe_harbor_exten;} + $rec_count++; + } + $sthA->finish(); + + $stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$uniqueid','$CIDlead_id','$VDADcampaign','$SQLdate','$now_date_epoch','QUEUE','$VDADphone_code','$VDADphone','VDAD','N')"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + + if ($AGILOG) {$agi_string = "-- VDAD : |$VDADlead_id|$CIDlead_id|insert to vicidial_log: $uniqueid"; &agi_output;} + + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_eq_prepend FROM system_settings;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $enable_queuemetrics_logging = "$aryA[0]"; + $queuemetrics_server_ip = "$aryA[1]"; + $queuemetrics_dbname = "$aryA[2]"; + $queuemetrics_login= "$aryA[3]"; + $queuemetrics_pass = "$aryA[4]"; + $queuemetrics_log_id = "$aryA[5]"; + $queuemetrics_eq_prepend = "$aryA[6]"; + $rec_count++; + } + $sthA->finish(); + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + $stmtA = "SELECT phone_number FROM vicidial_auto_calls where lead_id='$CIDlead_id';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $phone_number = "$aryA[0]"; + $data2 = "$phone_number"; + $rec_count++; + } + $sthA->finish(); + + if ( (length($queuemetrics_eq_prepend) > 0) && ($queuemetrics_eq_prepend !~ /NONE/) ) + { + $stmtA = "SELECT $queuemetrics_eq_prepend FROM vicidial_list where lead_id='$CIDlead_id';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + $DASH='-'; + @aryA = $sthA->fetchrow_array; + $QMprepend = "$aryA[0]"; + $rec_count++; + $data2 = "$QMprepend$DASH$phone_number"; + } + $sthA->finish(); + } + + $dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} + + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='$callerid',queue='$VDADcampaign',agent='NONE',verb='ENTERQUEUE',data2='$data2',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } + } + +$drop_timer=0; +$drop_seconds=0; +$hold_message_counter=25; +$hold_tone_counter=0; + +while ($drop_timer <= $DROP_TIME) +{ +$channel_status = $AGI->channel_status("$channel"); +if ($channel_status < 1) + { + if ($AGILOG) {$agi_string = "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer CHECKING AGAIN"; &agi_output;} + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + + $channel_status_DC = $AGI->channel_status("$channel"); + + if ($channel_status_DC < 1) + { + if ($AGILOG) {$agi_string = "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer"; &agi_output;} + if ($drop_timer < $DROP_TIME) {$drop_seconds = $drop_timer;} + $drop_timer = ($drop_timer + $DROP_TIME); + } + } +$stmtA = "SELECT next_agent_call FROM vicidial_campaigns where campaign_id='$VDADcampaign';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $CAMP_callorder = "$aryA[0]"; + $rec_count++; + } +$sthA->finish(); + +$agent_call_order=''; +if ($CAMP_callorder =~ /overall_user_level/i) {$agent_call_order = 'order by user_level desc,last_call_finish';} +if ($CAMP_callorder =~ /oldest_call_start/i) {$agent_call_order = 'order by last_call_time';} +if ($CAMP_callorder =~ /oldest_call_finish/i) {$agent_call_order = 'order by last_call_finish';} +if ($CAMP_callorder =~ /random/i) {$agent_call_order = 'order by random_id';} +if ($CAMP_callorder =~ /campaign_rank/i) {$agent_call_order = 'order by campaign_weight desc,last_call_finish';} +if ($CAMP_callorder =~ /fewest_calls/i) {$agent_call_order = 'order by calls_today,last_call_finish';} + + $rec_countWAIT=0; +$stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and server_ip='$VARserver_ip' and campaign_id = '$VDADcampaign' and call_time < \"$VDADcall_time\" and lead_id != '$VDADlead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $rec_countWAIT = "$aryA[0]"; + $rec_count++; + } +$sthA->finish(); +if ($DBconcurrent_transfers =~ /AUTO/) + { + $active_agents=1; + $stmtA = "SELECT count(*) FROM vicidial_live_agents where server_ip='$VARserver_ip' and campaign_id = '$VDADcampaign' and last_update_time > '$BDtsSQLdate';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $active_agents = "$aryA[0]"; + $rec_count++; + } + + $concurrent_transfers = ($active_agents / 10); + $concurrent_transfers = sprintf("%.0f", $concurrent_transfers); + $concurrent_transfers++; + if ($AGILOG) {$agi_string = "|CONCURRENT TRANSFERS AUTO SETTING: $concurrent_transfers ($active_agents)|"; &agi_output;} + } +else {$concurrent_transfers = $DBconcurrent_transfers;} +$sthA->finish(); +if ($rec_countWAIT < $concurrent_transfers) + { + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$CIDlead_id',uniqueid='$unique_id', channel='$channel', call_server_ip='$VARserver_ip', callerid='$callerid' where status = 'READY' and server_ip='$VARserver_ip' and campaign_id='$VDADcampaign' and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD get agent: |$affected_rows|update of vla table: $VDADcampaign|$VARserver_ip\n|$stmtA|"; &agi_output;} + if ($affected_rows > 0) + { + $r=0; + $VDADuser=''; + while ( (length($VDADuser)<1) && ($r<3) ) + { + $stmtA = "SELECT conf_exten,user,extension FROM vicidial_live_agents where status IN('QUEUE','INCALL') and server_ip='$VARserver_ip' and campaign_id='$VDADcampaign' and callerid='$callerid' and channel='$channel' order by last_call_time limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VDADconf_exten = "$aryA[0]"; + $VDADuser = "$aryA[1]"; + $VDADextension = "$aryA[2]"; + $rec_count++; + } + $sthA->finish(); + $r++; + if ($r > 1) + { + if ($AGILOG) {$agi_string = "EEEEEEEEEE vla UPDATE DELAY!!! |$callerid|$r|"; &agi_output;} + + ### sleep for 23 hundredths of a second + usleep(1*230*1000); + $drop_timer = ($drop_timer + 0.25); + } + if ($r > 2) + { + $stmtA = "SELECT conf_exten,user,extension FROM vicidial_live_agents where callerid='$callerid' order by last_call_time limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VDADconf_exten = "$aryA[0]"; + $VDADuser = "$aryA[1]"; + $VDADextension = "$aryA[2]"; + $rec_count++; + } + $sthA->finish(); + + if ($AGILOG) {$agi_string = "FFFFFFFFFF vla OR SELECT |$callerid|$VDADuser|"; &agi_output;} + } + } + + $stmtA = "UPDATE vicidial_auto_calls set status='XFER', stage='XFER-$drop_timer' where callerid='$callerid';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD XFER : |$affected_rows|update of vac table: $callerid\n|$stmtA|"; &agi_output;} + + $dbhA->disconnect(); + + if ($enable_queuemetrics_logging > 0) + { + $dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} + + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='$callerid',queue='$VDADcampaign',agent='Agent/$VDADuser',verb='CONNECT',data1='$drop_timer',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } + + if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $VDADconf_exten"; &agi_output;} + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $VDADconf_exten\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $now_date_epoch = time(); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + if ($AGILOG) {$agi_string = "XXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date"; &agi_output;} + + exit; + } + else + { + if ($AGILOG) {$agi_string = "NNNNNNNNNN No agent record found!!!"; &agi_output;} + } + } +else + { + if ($AGILOG) {$agi_string = "WWWWWWWW VDAD XFER WAIT: |$rec_countWAIT|$VDADcampaign|$channel|$callerid|$uniqueid|"; &agi_output;} + } + +################################################################################################### +### noone found locally available, now check for someone on another server to take the call + + $rec_countWAITrem=0; +$stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and server_ip!='$VARserver_ip' and campaign_id = '$VDADcampaign' and call_time < \"$VDADcall_time\" and lead_id != '$VDADlead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $rec_countWAITrem = "$aryA[0]"; + $rec_count++; + } +$sthA->finish(); +if ($DBconcurrent_transfers =~ /AUTO/) + { + $active_agents=1; + $stmtA = "SELECT count(*) FROM vicidial_live_agents where server_ip!='$VARserver_ip' and campaign_id = '$VDADcampaign' and last_update_time > '$BDtsSQLdate';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $active_agents = "$aryA[0]"; + $rec_count++; + } + + $concurrent_transfers = ($active_agents / 10); + $concurrent_transfers = sprintf("%.0f", $concurrent_transfers); + $concurrent_transfers++; + if ($AGILOG) {$agi_string = "|CONCURRENT TRANSFERS AUTO SETTING: $concurrent_transfers ($active_agents)|"; &agi_output;} + } +else {$concurrent_transfers = $DBconcurrent_transfers;} +$sthA->finish(); +if ($rec_countWAITrem < $concurrent_transfers) + { + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$CIDlead_id',uniqueid='$unique_id', channel='$channel', call_server_ip='$VARserver_ip', callerid='$callerid' where status = 'READY' and server_ip!='$VARserver_ip' and campaign_id='$VDADcampaign' and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD get agent: |$affected_rows|update of vla table: $VDADcampaign|$VARserver_ip\n|$stmtA|"; &agi_output;} + if ($affected_rows > 0) + { + $r=0; + $VDADuser=''; + while ( (length($VDADuser)<1) && ($r<3) ) + { + $stmtA = "SELECT conf_exten,user,extension,server_ip FROM vicidial_live_agents where status IN('QUEUE','INCALL') and server_ip!='$VARserver_ip' and campaign_id='$VDADcampaign' and callerid='$callerid' and channel='$channel' order by last_call_time limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VDADconf_exten = "$aryA[0]"; + $VDADuser = "$aryA[1]"; + $VDADextension = "$aryA[2]"; + $VDADserver_ip = "$aryA[3]"; + $rec_count++; + } + $sthA->finish(); + $r++; + if ($r > 1) + { + if ($AGILOG) {$agi_string = "EEEEEEEEEE vla UPDATE DELAY!!! |$callerid|$r|"; &agi_output;} + + ### sleep for 23 hundredths of a second + usleep(1*230*1000); + $drop_timer = ($drop_timer + 0.25); + } + if ($r > 2) + { + $stmtA = "SELECT conf_exten,user,extension,server_ip FROM vicidial_live_agents where callerid='$callerid' order by last_call_time limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VDADconf_exten = "$aryA[0]"; + $VDADuser = "$aryA[1]"; + $VDADextension = "$aryA[2]"; + $VDADserver_ip = "$aryA[3]"; + $rec_count++; + } + $sthA->finish(); + + if ($AGILOG) {$agi_string = "FFFFFFFFFF vla OR SELECT |$callerid|$VDADuser|"; &agi_output;} + } + } + + $stmtA = "UPDATE vicidial_auto_calls set status='XFER', stage='XFER-$drop_timer' where callerid='$callerid';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD XFER REMOTE: |$affected_rows|update of vac table: $callerid\n|$stmtA|"; &agi_output;} + + $dbhA->disconnect(); + + if ($enable_queuemetrics_logging > 0) + { + $dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} + + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='$callerid',queue='$VDADcampaign',agent='Agent/$VDADuser',verb='CONNECT',data1='$drop_timer',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } + + ### format the remote server dialstring to get the call to the overflow agent meetme room + $S='*'; + if( $VDADserver_ip =~ m/(\S+)\.(\S+)\.(\S+)\.(\S+)/ ) + { + $a = leading_zero($1); + $b = leading_zero($2); + $c = leading_zero($3); + $d = leading_zero($4); + $VDADremDIALstr = "$a$S$b$S$c$S$d$S"; + } + $VDADremDIALstr .= "$VDADconf_exten"; + + if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $VDADremDIALstr"; &agi_output;} + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $VDADremDIALstr\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $now_date_epoch = time(); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + if ($AGILOG) {$agi_string = "XXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date"; &agi_output;} + + exit; + } + else + { + if ($AGILOG) {$agi_string = "NNNNNNNNNN No agent record found!!!"; &agi_output;} + } + } +else + { + if ($AGILOG) {$agi_string = "WWWWWWWW VDAD XFER REMOTE WAIT: |$rec_countWAIT|$VDADcampaign|$channel|$callerid|$uniqueid|"; &agi_output;} + } + + +if ($drop_timer < 3) + { + ### sleep for 23 hundredths of a second + usleep(1*230*1000); + $drop_timer = ($drop_timer + 0.25); + } +else + { + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + + $drop_timer++; + } + +$stmtA = "UPDATE vicidial_auto_calls set stage='LIVE-$drop_timer' where callerid='$callerid';"; +$affected_rows = $dbhA->do($stmtA); +#if ($AGILOG) {$agi_string = "-- VDAD : |$affected_rows|update of vac table: $callerid\n|$stmtA|"; &agi_output;} + +} + + +if ($drop_timer >= $DROP_TIME) +{ +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $VDADvoicemail_ext = ''; + +$DROPexten = ''; +if ($drop_seconds < 1) + { + $drop_seconds = $DROP_TIME; + + if ($enable_queuemetrics_logging > 0) + { + $dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} + + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='$callerid',queue='$VDADcampaign',agent='NONE',verb='EXITWITHTIMEOUT',data1='1',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } + + if ($safe_harbor_message =~ /Y/) + { + $DROPexten = "$safe_harbor_exten"; + } + else + { + $stmtA = "SELECT voicemail_ext FROM vicidial_campaigns where campaign_id = '$VDADcampaign' limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VDADvoicemail_ext = "$aryA[0]"; + $VDADvoicemail_ext =~ s/\D//gi; + if (length($VDADvoicemail_ext)>0) + {$DROPexten = "$voicemail_dump_exten$VDADvoicemail_ext";} + $rec_count++; + } + $sthA->finish(); + } + } + + + ### use STDOUT to send call to proper DROP location + $VHqueryCID = "VH$CIDdate$VDADconf_exten"; + + if (length($DROPexten)>0) + { ### if DROP extension is defined then send the dropped call there instead of hangup + if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $DROPexten"; &agi_output;} + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $DROPexten\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + } + else + { + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$VARserver_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD call_hungup timout: |$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager"; &agi_output;} + } + + $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vac record deleted: |$affected_rows|$VDADcampaign|"; &agi_output;} + + $stmtA = "UPDATE vicidial_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where uniqueid = '$uniqueid';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vicidial_log update: |$affected_rows|$uniqueid"; &agi_output;} + + $stmtA = "UPDATE vicidial_list set status='DROP' where lead_id = '$CIDlead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vicidial_list update: |$affected_rows|$CIDlead_id"; &agi_output;} +} + + + + $dbhA->disconnect(); + + + +exit; + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + # print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} + +sub leading_zero($) { + $_ = $_[0]; + s/^(\d)$/0$1/; + s/^(\d\d)$/0$1/; + return $_; +} # End of the leading_zero() routine. + +sub agi_output +{ +if ($AGILOG >=2) + { + ### open the log file for writing ### + open(Lout, ">>$AGILOGfile") + || die "Can't open $AGILOGfile: $!\n"; + print Lout "$now_date|$script|$agi_string\n"; + close(Lout); + } + ### send to STDERR writing ### +if ( ($AGILOG == '1') || ($AGILOG == '3') ) + {print STDERR "$now_date|$script|$agi_string\n";} +$agi_string=''; +} diff --git a/agc_2-X/branches/agc_2.0.4/agi/agi-VDAD_pin_IVR.agi b/agc_2-X/branches/agc_2.0.4/agi/agi-VDAD_pin_IVR.agi new file mode 100644 index 00000000..aa628ff1 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/agi/agi-VDAD_pin_IVR.agi @@ -0,0 +1,240 @@ +#!/usr/bin/perl +# +# agi-VDAD_pin_IVR.agi version 0.2 *DBI-version* +# +# At the end of a call, the agent transfers customer to this script +# +# This script plays a beep then plays the first portion of the message +# then logs the portion as listened to in the vicidial_list_pins table +# then plays second portion and hangs up. +# +# IN THE CAMPAIGN OR IN-GROUP NUMBER PRESET FIELD: +# AXFER83209 +# +# ON THE SERVER ORIGINATING THE CALL: +#;outbound IVR play VICIDIAL calls: +#exten => _983209.,1,AGI(call_log.agi,${EXTEN}) +#exten => _983209.,2,Dial(${TRUNKY}/${EXTEN:1},60) +#exten => _983209.,3,Hangup +# +# ON THE SERVER THAT HAS THIS SCRIPT: +#;inbound IVR play VICIDIAL calls: +#exten => _83209.,1,Answer +#exten => _83209.,2,AGI(agi-VDAD_pin_IVR.agi,${EXTEN}) +#exten => _83209.,3,Hangup +# +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# +# changes: +# 60802-1304 - first build +# 60817-1113 - added output options check from database +# + +$script = 'agi-VDAD_pin_IVR.agi'; + +$first_audio_file = '85100003'; +$second_audio_file = '85100004'; +$goodbye_audio_file = 'US_reminder_goodbye'; + +#$first_audio_file = 'US_reminder_message'; +#$second_audio_file = 'US_reminder_options'; +#$goodbye_audio_file = 'US_reminder_goodbye'; + + +### set defaults for testing +$referring_extension = '83209'; +$phone_number = '9999999999'; +$lead_id = '999999999'; +$campaign_id = 'TESTCAMP'; +$product_code = 'ABC'; +$user = '1234'; +$pin = '0'; + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +if (!$VARDB_port) {$VARDB_port='3306';} +if (!$AGILOGfile) {$AGILOGfile = "$PATHlogs/agiout.$year-$mon-$mday";} + +use DBI; +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### Grab Server values from the database +$stmtA = "SELECT agi_output FROM servers where server_ip = '$VARserver_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + $AGILOG = '0'; + @aryA = $sthA->fetchrow_array; + $DBagi_output = "$aryA[0]"; + if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';} + if ($DBagi_output =~ /FILE/) {$AGILOG = '2';} + if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';} + $rec_count++; + } +$sthA->finish(); + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + if ($AGILOG) {$agi_string = "Perl Environment Dump:"; &agi_output;} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($AGILOG) {$agi_string = "$i|$ARGV[$i]"; &agi_output;} + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} + +$|=1; +while() { + chomp; + last unless length($_); + if ($AGILOG) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + ### allow for internal transfer data string "83009*3125551212*10000123*TESTCAMP*ABC*1234*" + if ($extension =~ /^8320\d\*/) + { + @EXT_vars = split(/\*/, $extension); + + $referring_extension = $EXT_vars[0]; # initial extension sent + $phone_number = $EXT_vars[1]; # phone number + $lead_id = $EXT_vars[2]; # lead_id in vicidial_list + $campaign_id = $EXT_vars[3]; # campaign id + $product_code = $EXT_vars[4]; # product code + $user = $EXT_vars[5]; # vicidial_user that sent the call here + } +} + + if ($AGILOG) {$agi_string = "INBOUND IVR PLAY CALL VDCL STARTED"; &agi_output;} + + +$AGI->stream_file('beep'); + +sleep(1); + +$AGI->stream_file("$first_audio_file"); + +### insert a record into the vicidial_list_pins table +$stmtA = "INSERT INTO vicidial_list_pins (entry_time,phone_number,lead_id,campaign_id,product_code,user,digits) values('$SQLdate','$phone_number','$lead_id','$campaign_id','$product_code','$user','IVR');"; + +$affected_rows = $dbhA->do($stmtA); + +$insert_pin_id = $dbhA->{'mysql_insertid'}; + +if ($AGILOG) {$agi_string = "|$stmtA|$insert_pin_id|$affected_rows|"; &agi_output;} + +$dbhA->disconnect(); + +$AGI->stream_file("$second_audio_file"); + +sleep(1); + +$AGI->stream_file("$goodbye_audio_file"); + + +exit; + + +sub agi_output +{ +if ($AGILOG >=2) + { + ### open the log file for writing ### + open(Lout, ">>$AGILOGfile") + || die "Can't open $AGILOGfile: $!\n"; + print Lout "$now_date|$script|$agi_string\n"; + close(Lout); + } + ### send to STDERR writing ### +if ( ($AGILOG == '1') || ($AGILOG == '3') ) + {print STDERR "$now_date|$script|$agi_string\n";} +$agi_string=''; +} diff --git a/agc_2-X/branches/agc_2.0.4/agi/agi-VDADautoREMINDER.agi b/agc_2-X/branches/agc_2.0.4/agi/agi-VDADautoREMINDER.agi new file mode 100644 index 00000000..18854310 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/agi/agi-VDADautoREMINDER.agi @@ -0,0 +1,667 @@ +#!/usr/bin/perl +# +# agi-VDADautoREMINDER.agi version 0.4 *DBI-version* +# +# runs when a call comes in from the VICIDIAL auto_dialer. This script will +# send the calls out to specified voicemail boxes in if called person presses key. +# The voicemail box is defined per-lead in the vicidial_list.security_phrase field +# This campaign does not send calls to live agents. +# +# Call statuses from this script: +# N- Call was picked up, didn't finish initial message +# MP- Initial message was played +# VM- call was sent to voicemail +# CALLBK- customer selected to be called back +# +# It is recommended that you run this campaign at a dial level of 1.0 +# It is recommended that you use remote_agents for activation of this script +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ;VICIDIAL_auto_dialer transfer script: +# exten => 8372,1,AGI(call_log.agi,${EXTEN}) +# exten => 8372,2,AGI(agi-VDADautoREMINDER.agi,${EXTEN}) +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# CHANGES +# 60313-1626 - First build +# 60810-1729 - Changed to DBI +# - changed to use /etc/astguiclient.conf for configs +# 60818-1144 - added output options check from database +# + +$script = 'agi-VDADautoREMINDER.agi'; + +##### AUDIO FILES IN THIS PROGRAM ##### +$message_audio_file = 'US_reminder_message'; +$options_audio_file = 'US_reminder_options'; +# $voicemail_xfer_file = 'US_reminder_voicemail'; not used +$callback_audio_file = 'US_reminder_callback'; +$goodbye_audio_file = 'US_reminder_goodbye'; + + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$start_time=$now_date; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; #20060310100402 + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $SQLdateBEGIN = $SQLdate; + +$BDtarget = ($secX - 5); +($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); +$Byear = ($Byear + 1900); +$Bmon++; +if ($Bmon < 10) {$Bmon = "0$Bmon";} +if ($Bmday < 10) {$Bmday = "0$Bmday";} +if ($Bhour < 10) {$Bhour = "0$Bhour";} +if ($Bmin < 10) {$Bmin = "0$Bmin";} +if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +if (!$VARDB_port) {$VARDB_port='3306';} +if (!$AGILOGfile) {$AGILOGfile = "$PATHlogs/agiout.$year-$mon-$mday";} + +use DBI; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### Grab Server values from the database +$stmtA = "SELECT agi_output FROM servers where server_ip = '$VARserver_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + $AGILOG = '0'; + @aryA = $sthA->fetchrow_array; + $DBagi_output = "$aryA[0]"; + if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';} + if ($DBagi_output =~ /FILE/) {$AGILOG = '2';} + if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';} + $rec_count++; + } +$sthA->finish(); + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + if ($AGILOG) {$agi_string = "Perl Environment Dump:"; &agi_output;} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($AGILOG) {$agi_string = "$i|$ARGV[$i]"; &agi_output;} + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} + +$|=1; +while() { + chomp; + last unless length($_); + if ($AGILOG) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_priority\:\s+(.*)$/) {$priority = $1;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} +} + +if ( (length($callerid)>20) && ($callerid =~ /\"\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S/) ) + { + $callerid =~ s/^\"//gi; + $callerid =~ s/\".*$//gi; + ### set the callerid to the ACQS value(calleridname) + print "SET CALLERID $callerid\n"; + checkresult($result); + if ($AGILOG) {$agi_string = "callerID changed: $callerid"; &agi_output;} + } +if ( ( +(length($calleridname)>5) && ( (!$callerid) or ($callerid =~ /unknown|private|00000000/i) or ($callerid =~ /5551212/) ) +) or ( (length($calleridname)>17) && ($calleridname =~ /\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/) ) ) + { + $callerid = $calleridname; + ### set the callerid to the ACQS value(calleridname) + print "SET CALLERID $callerid\n"; + checkresult($result); + if ($AGILOG) {$agi_string = "callerID changed: $callerid"; &agi_output;} + } + + +if ($AGILOG) {$agi_string = "AGI Environment Dump:"; &agi_output;} + +foreach $i (sort keys %AGI) +{ + if ($AGILOG) {$agi_string = " -- $i = $AGI{$i}"; &agi_output;} +} + +if ($AGILOG) {$agi_string = "AGI Variables: |$unique_id|$channel|$extension|$type|$callerid|"; &agi_output;} + + +$VDADcampaign=''; +$VDADphone=''; +$VDADphone_code=''; + +$callerid =~ s/\"//gi; +$CIDlead_id = $callerid; +$CIDlead_id = substr($CIDlead_id, 11, 9); +$CIDlead_id = ($CIDlead_id + 0); + +if ($AGILOG) {$agi_string = "+++++ VDAD START : |$CIDlead_id|$now_date|"; &agi_output;} + +if ( ($channel =~ /Local/i) && ($AST_ver !~ /^1\.0\.8|^1\.0\.9/) ) +{ +if ($AGILOG) {$agi_string = "+++++ VDAD START LOCAL CHANNEL: EXITING- $priority"; &agi_output;} +if ($priority > 2) {sleep(1);} +exit; +} + + + +sleep(1); + +$AGI->stream_file('beep'); + + +### Grab Server values from the database +$stmtA = "SELECT voicemail_dump_exten,ext_context,answer_transfer_agent,local_gmt,asterisk_version,max_vicidial_trunks FROM servers where server_ip = '$VARserver_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBvoicemail_dump_exten = "$aryA[0]"; + $DBext_context = "$aryA[1]"; + $DBanswer_transfer_agent = "$aryA[2]"; + $DBSERVER_GMT = "$aryA[3]"; + $DBasterisk_version = "$aryA[4]"; + $DBmax_vicidial_trunks = "$aryA[5]"; + if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;} + if ($DBext_context) {$ext_context = $DBext_context;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + $rec_count++; + } +$sthA->finish(); + +### Grab call parameters from vicidial_auto_calls table +$stmtA = "UPDATE vicidial_auto_calls set uniqueid='$unique_id', channel='$channel',status='LIVE',stage='LIVE-0' where callerid='$callerid' order by call_time desc limit 1;"; +$affected_rows = $dbhA->do($stmtA); +if ($AGILOG) {$agi_string = "-- VDAD : |$affected_rows|update of vac table: $callerid\n|$stmtA|"; &agi_output;} +if ($affected_rows > 0) + { + $stmtA = "SELECT campaign_id,phone_number,phone_code,lead_id,call_time FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VDADcampaign = "$aryA[0]"; + $VDADphone = "$aryA[1]"; + $VDADphone_code = "$aryA[2]"; + $VDADlead_id = "$aryA[3]"; + $VDADcall_time = "$aryA[4]"; + $rec_count++; + } + $sthA->finish(); + + $stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$uniqueid','$CIDlead_id','$VDADcampaign','$SQLdate','$now_date_epoch','N','$VDADphone_code','$VDADphone','VDAD','N')"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + + if ($AGILOG) {$agi_string = "-- VDAD : |$VDADlead_id|$CIDlead_id|insert to vicidial_log: $uniqueid"; &agi_output;} + } + + + + +######### REMINDER CHOICE FROM RECORDINGS ######## +&reminder_choice; + +if ($pin < 1) + { + &reminder_choice; + + if ($pin < 1) + { + $AGI->stream_file("$goodbye_audio_file"); + + $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vac record deleted: |$affected_rows|$VDADcampaign|"; &agi_output;} + + $end_date_epoch = time(); + $length_in_sec = ($end_date_epoch - $now_date_epoch); + + $stmtA = "UPDATE vicidial_log set end_epoch='$end_date_epoch', length_in_sec='$length_in_sec' where uniqueid='$uniqueid' and lead_id='$CIDlead_id';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vac record deleted: |$affected_rows|$VDADcampaign|$end_date_epoch|$now_date_epoch|$length_in_sec|"; &agi_output;} + + $VHqueryCID = "VHNGUP$tsSQLdate"; + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$VARserver_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD call_hungup timout: |$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager"; &agi_output;} + + sleep(1); + + exit; + } + } + +if ($AGILOG) {$agi_string = "+++++ VDAD STATUS : pressed $pin|$unique_id|$channel|$extension|$type|$callerid|$CIDlead_id|$now_date"; &agi_output;} + +if ($pin !~ /^1|^2/) {exit;} + +if (!$DB_port) {$DB_port='3306';} + + + + + +if ($pin =~ /^1|^2/) +{ + +if ($pin == "1") ### send call to voicemail + { +# message can be left on agent vmail box +# # Thank you for your response, we will now transfer you to your agent's voicemail box. +# $AGI->stream_file("$voicemail_xfer_file"); + + $stmtA = "UPDATE vicidial_auto_calls set status='XFER', stage='XFER-$drop_timer' where callerid='$callerid';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD XFER : |$affected_rows|update of vac table: $callerid\n|$stmtA|"; &agi_output;} + + $stmtA = "UPDATE vicidial_list set status='VM' where lead_id = '$CIDlead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vicidial_list update: |$affected_rows|$CIDlead_id|XFER"; &agi_output;} + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $end_date_epoch = time(); + $length_in_sec = ($end_date_epoch - $now_date_epoch); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + if ($AGILOG) {$agi_string = "XXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date"; &agi_output;} + + $stmtA = "UPDATE vicidial_log set status='VM', end_epoch='$end_date_epoch', length_in_sec='$length_in_sec' where uniqueid='$uniqueid' and lead_id='$CIDlead_id';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vac record updated: |$affected_rows|$VDADcampaign|"; &agi_output;} + + $VMAIL_box=0; + ### Grab Server values from the database + $stmtA = "SELECT security_phrase FROM vicidial_list where lead_id = '$CIDlead_id';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VMAIL_box = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + + ### SEND CALL TO VOICEMAIL BOX ### + if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $voicemail_dump_exten$VMAIL_box"; &agi_output;} + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $voicemail_dump_exten$VMAIL_box\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + + } + +if ($pin == "2") ### mark call as a CALLBK + { + + # Thank you for your response, your agent will be contacting you shortly. + $stmtA = "DELETE from vicidial_auto_calls where callerid='$callerid';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD DONE : |$affected_rows|delete of vac table: $callerid\n|$stmtA|"; &agi_output;} + + $stmtA = "UPDATE vicidial_list set status='CALLBK' where lead_id = '$CIDlead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vicidial_list update: |$affected_rows|$CIDlead_id|XFER"; &agi_output;} + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $end_date_epoch = time(); + $length_in_sec = ($end_date_epoch - $now_date_epoch); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + if ($AGILOG) {$agi_string = "XXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date"; &agi_output;} + + $stmtA = "UPDATE vicidial_log set status='CALLBK', end_epoch='$end_date_epoch', length_in_sec='$length_in_sec' where uniqueid='$uniqueid' and lead_id='$CIDlead_id';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vac record updated: |$affected_rows|$VDADcampaign|"; &agi_output;} + + $AGI->stream_file("$callback_audio_file"); + + $VHqueryCID = "VHNGUP$tsSQLdate"; + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$VARserver_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD call_hungup timout: |$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager"; &agi_output;} + + sleep(1); + + exit; + } + +} ### end if pressed 1,2 + + + + + +else ### user pressed digit other than 1 or 2 +{ + +exit; +} + +$dbhA->close; + + + +exit; + + + + + + + + + + + +sub reminder_choice +{ +$digit=''; +undef $digit; +$interrupt_digit=''; +undef $interrupt_digit; + +# Hello, this is a courtesy call from ACME Industries reminding you that the deadline for the submission of orders for the June 5th batch delivery is tomorrow, March 10th: + # second audio file +# If you would like to leave a message for your agent please press 1. +# If you would like to have your agent call you back please press 2. + # third audio file +# Thank you, Goodbye + + +######### PLAY THE MESSAGE FILE THEN WAIT 2 SECONDS FOR DIGITS ############ +$interrupt_digit = $AGI->stream_file("$message_audio_file",'12'); + if ($AGILOG) {$agi_string = "interrupt_digit |$interrupt_digit|"; &agi_output;} +$digits_being_entered=1; +$digit_loop_counter=0; +$totalDTMF=''; +if ($interrupt_digit > 1) + { + if ($interrupt_digit == 48) {$interrupt_digit=0;} + if ($interrupt_digit == 49) {$interrupt_digit=1;} + if ($interrupt_digit == 50) {$interrupt_digit=2;} + if ($interrupt_digit == 51) {$interrupt_digit=3;} + if ($interrupt_digit == 52) {$interrupt_digit=4;} + if ($interrupt_digit == 53) {$interrupt_digit=5;} + if ($interrupt_digit == 54) {$interrupt_digit=6;} + if ($interrupt_digit == 55) {$interrupt_digit=7;} + if ($interrupt_digit == 56) {$interrupt_digit=8;} + if ($interrupt_digit == 57) {$interrupt_digit=9;} + $totalDTMF=$interrupt_digit; + $digit_loop_counter++; + } + +$channel_status = $AGI->channel_status("$channel"); + if ($AGILOG) {$agi_string = "SSSSSSSSSS Channel Status: $channel_status"; &agi_output;} + + if ($channel_status == 6) + { + $stmtA = "UPDATE vicidial_log set status='MP' where uniqueid = '$uniqueid' and lead_id='$CIDlead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vicidial_log update: N|$affected_rows|$uniqueid"; &agi_output;} + + $stmtA = "UPDATE vicidial_list set status='MP' where lead_id = '$CIDlead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vicidial_list update: N|$affected_rows|$CIDlead_id"; &agi_output;} + } + +while ($digit_loop_counter < 1) + { + $digit = chr($AGI->wait_for_digit('2000')); # wait 2 seconds for input or until digit pressed + if ($digit =~ /\d/) + { + $totalDTMF = "$totalDTMF$digit"; + if ($AGILOG) {$agi_string = "digit |$digit| TotalDTMF |$totalDTMF|"; &agi_output;} +# $AGI->say_digits("$digit"); + undef $digit; + } + else + { + $digit_loop_counter=1; + } + + $digit_loop_counter++; + } + +$totalDTMF =~ s/\D//gi; +$pin = $totalDTMF; +if ($totalDTMF) + { + if ($AGILOG) {$agi_string = "digit |$digit| TotalDTMF |$totalDTMF|"; &agi_output;} + return; + } + + + +######### PLAY THE OPTIONS FILE THEN WAIT 5 SECONDS FOR DIGITS ############ +$interrupt_digit = $AGI->stream_file("$options_audio_file",'12'); + if ($AGILOG) {$agi_string = "interrupt_digit |$interrupt_digit|"; &agi_output;} +$digits_being_entered=1; +$digit_loop_counter=0; +$totalDTMF=''; +if ($interrupt_digit > 1) + { + if ($interrupt_digit == 48) {$interrupt_digit=0;} + if ($interrupt_digit == 49) {$interrupt_digit=1;} + if ($interrupt_digit == 50) {$interrupt_digit=2;} + if ($interrupt_digit == 51) {$interrupt_digit=3;} + if ($interrupt_digit == 52) {$interrupt_digit=4;} + if ($interrupt_digit == 53) {$interrupt_digit=5;} + if ($interrupt_digit == 54) {$interrupt_digit=6;} + if ($interrupt_digit == 55) {$interrupt_digit=7;} + if ($interrupt_digit == 56) {$interrupt_digit=8;} + if ($interrupt_digit == 57) {$interrupt_digit=9;} + $totalDTMF=$interrupt_digit; + $digit_loop_counter++; + } + +while ($digit_loop_counter < 1) + { + $digit = chr($AGI->wait_for_digit('10000')); # wait 10 seconds for input or until digit pressed + if ($digit =~ /\d/) + { + $totalDTMF = "$totalDTMF$digit"; + if ($AGILOG) {$agi_string = "digit |$digit| TotalDTMF |$totalDTMF|"; &agi_output;} +# $AGI->say_digits("$digit"); + undef $digit; + } + else + { + $digit_loop_counter=1; + } + + $digit_loop_counter++; + } + +$totalDTMF =~ s/\D//gi; +$pin = $totalDTMF; +if ($totalDTMF) + { + if ($AGILOG) {$agi_string = "digit |$digit| TotalDTMF |$totalDTMF|"; &agi_output;} + return; + } +} + + + + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + # print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} + + + + +sub agi_output +{ +if ($AGILOG >=2) + { + ### open the log file for writing ### + open(Lout, ">>$AGILOGfile") + || die "Can't open $AGILOGfile: $!\n"; + print Lout "$now_date|$script|$agi_string\n"; + close(Lout); + } + ### send to STDERR writing ### +if ( ($AGILOG == '1') || ($AGILOG == '3') ) + {print STDERR "$now_date|$script|$agi_string\n";} +$agi_string=''; +} diff --git a/agc_2-X/branches/agc_2.0.4/agi/agi-VDADautoREMINDERxfer.agi b/agc_2-X/branches/agc_2.0.4/agi/agi-VDADautoREMINDERxfer.agi new file mode 100644 index 00000000..da391cc1 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/agi/agi-VDADautoREMINDERxfer.agi @@ -0,0 +1,729 @@ +#!/usr/bin/perl +# +# agi-VDADautoREMINDERxfer.agi version 0.3 *DBI-version* +# +# runs when a call comes in from the VICIDIAL auto_dialer. This script will +# send the calls out to specified voicemail boxes or specified extensions if +# called person presses specified key(1,2,3). +# The voicemail box is defined per-lead in the vicidial_list.security_phrase field +# The exten xfer number is defined per-lead in the vicidial_list.comments field +# +# Call statuses from this script: +# N- Call was picked up, didn't finish initial message +# MP- Initial message was played +# VM- call was sent to voicemail +# XFER- call was sent to specified extension +# CALLBK- customer selected to be called back +# +# It is recommended that you run this campaign at a dial level of 1.0 +# It is recommended that you use remote_agents for activation of this script +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ;VICIDIAL_auto_dialer transfer script: +# exten => 8372,1,AGI(call_log.agi,${EXTEN}) +# exten => 8372,2,AGI(agi-VDADautoREMINDERxfer.agi,${EXTEN}) +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# CHANGES +# 60511-1214 - First build +# 60810-1729 - Changed to DBI +# - changed to use /etc/astguiclient.conf for configs +# 60818-1144 - added output options check from database +# + +$script = 'agi-VDADautoREMINDERxfer.agi'; + +##### AUDIO FILES IN THIS PROGRAM ##### +$message_audio_file = 'US_reminder_message'; +$options_audio_file = 'US_reminder_options'; +# $voicemail_xfer_file = 'US_reminder_voicemail'; not used +$callback_audio_file = 'US_reminder_callback'; +$goodbye_audio_file = 'US_reminder_goodbye'; + + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$start_time=$now_date; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; #20060310100402 + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $SQLdateBEGIN = $SQLdate; + +$BDtarget = ($secX - 5); +($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); +$Byear = ($Byear + 1900); +$Bmon++; +if ($Bmon < 10) {$Bmon = "0$Bmon";} +if ($Bmday < 10) {$Bmday = "0$Bmday";} +if ($Bhour < 10) {$Bhour = "0$Bhour";} +if ($Bmin < 10) {$Bmin = "0$Bmin";} +if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +if (!$VARDB_port) {$VARDB_port='3306';} +if (!$AGILOGfile) {$AGILOGfile = "$PATHlogs/agiout.$year-$mon-$mday";} + +use DBI; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### Grab Server values from the database +$stmtA = "SELECT agi_output FROM servers where server_ip = '$VARserver_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + $AGILOG = '0'; + @aryA = $sthA->fetchrow_array; + $DBagi_output = "$aryA[0]"; + if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';} + if ($DBagi_output =~ /FILE/) {$AGILOG = '2';} + if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';} + $rec_count++; + } +$sthA->finish(); + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + if ($AGILOG) {$agi_string = "Perl Environment Dump:"; &agi_output;} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($AGILOG) {$agi_string = "$i|$ARGV[$i]"; &agi_output;} + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} + +$|=1; +while() { + chomp; + last unless length($_); + if ($AGILOG) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_priority\:\s+(.*)$/) {$priority = $1;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} +} + +if ( (length($callerid)>20) && ($callerid =~ /\"\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S/) ) + { + $callerid =~ s/^\"//gi; + $callerid =~ s/\".*$//gi; + ### set the callerid to the ACQS value(calleridname) + print "SET CALLERID $callerid\n"; + checkresult($result); + if ($AGILOG) {$agi_string = "callerID changed: $callerid"; &agi_output;} + } +if ( ( +(length($calleridname)>5) && ( (!$callerid) or ($callerid =~ /unknown|private|00000000/i) or ($callerid =~ /5551212/) ) +) or ( (length($calleridname)>17) && ($calleridname =~ /\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/) ) ) + { + $callerid = $calleridname; + ### set the callerid to the ACQS value(calleridname) + print "SET CALLERID $callerid\n"; + checkresult($result); + if ($AGILOG) {$agi_string = "callerID changed: $callerid"; &agi_output;} + } + + +if ($AGILOG) {$agi_string = "AGI Environment Dump:"; &agi_output;} + +foreach $i (sort keys %AGI) +{ + if ($AGILOG) {$agi_string = " -- $i = $AGI{$i}"; &agi_output;} +} + +if ($AGILOG) {$agi_string = "AGI Variables: |$unique_id|$channel|$extension|$type|$callerid|"; &agi_output;} + + +$VDADcampaign=''; +$VDADphone=''; +$VDADphone_code=''; + +$callerid =~ s/\"//gi; +$CIDlead_id = $callerid; +$CIDlead_id = substr($CIDlead_id, 11, 9); +$CIDlead_id = ($CIDlead_id + 0); + +if ($AGILOG) {$agi_string = "+++++ VDAD START : |$CIDlead_id|$now_date|"; &agi_output;} + +if ( ($channel =~ /Local/i) && ($AST_ver !~ /^1\.0\.8|^1\.0\.9/) ) +{ +if ($AGILOG) {$agi_string = "+++++ VDAD START LOCAL CHANNEL: EXITING- $priority"; &agi_output;} +if ($priority > 2) {sleep(1);} +exit; +} + + + +sleep(1); + +$AGI->stream_file('beep'); + + +### Grab Server values from the database +$stmtA = "SELECT voicemail_dump_exten,ext_context,answer_transfer_agent,local_gmt,asterisk_version,max_vicidial_trunks FROM servers where server_ip = '$VARserver_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBvoicemail_dump_exten = "$aryA[0]"; + $DBext_context = "$aryA[1]"; + $DBanswer_transfer_agent = "$aryA[2]"; + $DBSERVER_GMT = "$aryA[3]"; + $DBasterisk_version = "$aryA[4]"; + $DBmax_vicidial_trunks = "$aryA[5]"; + if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;} + if ($DBext_context) {$ext_context = $DBext_context;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + $rec_count++; + } +$sthA->finish(); + +### Grab call parameters from vicidial_auto_calls table +$stmtA = "UPDATE vicidial_auto_calls set uniqueid='$unique_id', channel='$channel',status='LIVE',stage='LIVE-0' where callerid='$callerid' order by call_time desc limit 1;"; +$affected_rows = $dbhA->do($stmtA); +if ($AGILOG) {$agi_string = "-- VDAD : |$affected_rows|update of vac table: $callerid\n|$stmtA|"; &agi_output;} +if ($affected_rows > 0) + { + $stmtA = "SELECT campaign_id,phone_number,phone_code,lead_id,call_time FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VDADcampaign = "$aryA[0]"; + $VDADphone = "$aryA[1]"; + $VDADphone_code = "$aryA[2]"; + $VDADlead_id = "$aryA[3]"; + $VDADcall_time = "$aryA[4]"; + $rec_count++; + } + $sthA->finish(); + + $stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$uniqueid','$CIDlead_id','$VDADcampaign','$SQLdate','$now_date_epoch','N','$VDADphone_code','$VDADphone','VDAD','N')"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + + if ($AGILOG) {$agi_string = "-- VDAD : |$VDADlead_id|$CIDlead_id|insert to vicidial_log: $uniqueid"; &agi_output;} + } + + + + +######### REMINDER CHOICE FROM RECORDINGS ######## +&reminder_choice; + +if ($pin < 1) + { + &reminder_choice; + + if ($pin < 1) + { + $AGI->stream_file("$goodbye_audio_file"); + + $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vac record deleted: |$affected_rows|$VDADcampaign|"; &agi_output;} + + $end_date_epoch = time(); + $length_in_sec = ($end_date_epoch - $now_date_epoch); + + $stmtA = "UPDATE vicidial_log set end_epoch='$end_date_epoch', length_in_sec='$length_in_sec' where uniqueid='$uniqueid' and lead_id='$CIDlead_id';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vac record deleted: |$affected_rows|$VDADcampaign|$end_date_epoch|$now_date_epoch|$length_in_sec|"; &agi_output;} + + $VHqueryCID = "VHNGUP$tsSQLdate"; + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$VARserver_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD call_hungup timout: |$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager"; &agi_output;} + + sleep(1); + + exit; + } + } + +if ($AGILOG) {$agi_string = "+++++ VDAD STATUS : pressed $pin|$unique_id|$channel|$extension|$type|$callerid|$CIDlead_id|$now_date"; &agi_output;} + +if ($pin !~ /^1|^2|^3/) {exit;} + +if (!$DB_port) {$DB_port='3306';} + + + + + +if ($pin =~ /^1|^2|^3/) +{ + +if ($pin == "1") ### send call to voicemail + { +# message can be left on agent vmail box +# # Thank you for your response, we will now transfer you to your agent's voicemail box. +# $AGI->stream_file("$voicemail_xfer_file"); + + $stmtA = "UPDATE vicidial_auto_calls set status='XFER', stage='XFER-$drop_timer' where callerid='$callerid';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD XFER : |$affected_rows|update of vac table: $callerid\n|$stmtA|"; &agi_output;} + + $stmtA = "UPDATE vicidial_list set status='VM' where lead_id = '$CIDlead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vicidial_list update: |$affected_rows|$CIDlead_id|XFER"; &agi_output;} + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $end_date_epoch = time(); + $length_in_sec = ($end_date_epoch - $now_date_epoch); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + if ($AGILOG) {$agi_string = "XXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date"; &agi_output;} + + $stmtA = "UPDATE vicidial_log set status='VM', end_epoch='$end_date_epoch', length_in_sec='$length_in_sec' where uniqueid='$uniqueid' and lead_id='$CIDlead_id';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vac record updated: |$affected_rows|$VDADcampaign|"; &agi_output;} + + $VMAIL_box=0; + ### Grab Server values from the database + $stmtA = "SELECT security_phrase FROM vicidial_list where lead_id = '$CIDlead_id';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VMAIL_box = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + + ### SEND CALL TO VOICEMAIL BOX ### + if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $voicemail_dump_exten$VMAIL_box"; &agi_output;} + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $voicemail_dump_exten$VMAIL_box\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + + } + +if ($pin == "2") ### mark call as a CALLBK + { + + # Thank you for your response, your agent will be contacting you shortly. + $stmtA = "DELETE from vicidial_auto_calls where callerid='$callerid';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD DONE : |$affected_rows|delete of vac table: $callerid\n|$stmtA|"; &agi_output;} + + $stmtA = "UPDATE vicidial_list set status='CALLBK' where lead_id = '$CIDlead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vicidial_list update: |$affected_rows|$CIDlead_id|XFER"; &agi_output;} + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $end_date_epoch = time(); + $length_in_sec = ($end_date_epoch - $now_date_epoch); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + if ($AGILOG) {$agi_string = "XXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date"; &agi_output;} + + $stmtA = "UPDATE vicidial_log set status='CALLBK', end_epoch='$end_date_epoch', length_in_sec='$length_in_sec' where uniqueid='$uniqueid' and lead_id='$CIDlead_id';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vac record updated: |$affected_rows|$VDADcampaign|"; &agi_output;} + + $AGI->stream_file("$callback_audio_file"); + + $VHqueryCID = "VHNGUP$tsSQLdate"; + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$VARserver_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD call_hungup timout: |$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager"; &agi_output;} + + sleep(1); + + exit; + } + +if ($pin == "3") ### send call to extension + { +# call can be sent to extension +# # Thank you for your response, we will now transfer you to your agent's voicemail box. +# $AGI->stream_file("$voicemail_xfer_file"); + + $stmtA = "UPDATE vicidial_auto_calls set status='XFER' where callerid='$callerid';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD XFER : |$affected_rows|update of vac table: $callerid\n|$stmtA|"; &agi_output;} + + $stmtA = "UPDATE vicidial_list set status='XFER' where lead_id = '$CIDlead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vicidial_list update: |$affected_rows|$CIDlead_id|XFER"; &agi_output;} + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $end_date_epoch = time(); + $length_in_sec = ($end_date_epoch - $now_date_epoch); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + if ($AGILOG) {$agi_string = "XXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date"; &agi_output;} + + $stmtA = "UPDATE vicidial_log set status='XFER', end_epoch='$end_date_epoch', length_in_sec='$length_in_sec' where uniqueid='$uniqueid' and lead_id='$CIDlead_id';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vac record updated: |$affected_rows|$VDADcampaign|"; &agi_output;} + + $VMAIL_box=0; + ### Grab Server values from the database + $stmtA = "SELECT comments FROM vicidial_list where lead_id = '$CIDlead_id';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $XFER_exten = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + + ### SEND CALL TO VOICEMAIL BOX ### + if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $XFER_exten"; &agi_output;} + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $XFER_exten\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + + } + +} ### end if pressed 1,2,3 + + + + + +else ### user pressed digit other than 1 or 2 or 3 +{ + +exit; +} + +$dbhA->close; + + + +exit; + + + + + + + + + + + +sub reminder_choice +{ +$digit=''; +undef $digit; +$interrupt_digit=''; +undef $interrupt_digit; + +# Hello, this is a courtesy call from ACME Industries reminding you that the deadline for the submission of orders for the June 5th batch delivery is tomorrow, March 10th: + # second audio file +# If you would like to leave a message for your agent please press 1. +# If you would like to have your agent call you back please press 2. + # third audio file +# Thank you, Goodbye + + +######### PLAY THE MESSAGE FILE THEN WAIT 2 SECONDS FOR DIGITS ############ +$interrupt_digit = $AGI->stream_file("$message_audio_file",'123'); + if ($AGILOG) {$agi_string = "interrupt_digit |$interrupt_digit|"; &agi_output;} +$digits_being_entered=1; +$digit_loop_counter=0; +$totalDTMF=''; +if ($interrupt_digit > 1) + { + if ($interrupt_digit == 48) {$interrupt_digit=0;} + if ($interrupt_digit == 49) {$interrupt_digit=1;} + if ($interrupt_digit == 50) {$interrupt_digit=2;} + if ($interrupt_digit == 51) {$interrupt_digit=3;} + if ($interrupt_digit == 52) {$interrupt_digit=4;} + if ($interrupt_digit == 53) {$interrupt_digit=5;} + if ($interrupt_digit == 54) {$interrupt_digit=6;} + if ($interrupt_digit == 55) {$interrupt_digit=7;} + if ($interrupt_digit == 56) {$interrupt_digit=8;} + if ($interrupt_digit == 57) {$interrupt_digit=9;} + $totalDTMF=$interrupt_digit; + $digit_loop_counter++; + } + +$channel_status = $AGI->channel_status("$channel"); + if ($AGILOG) {$agi_string = "SSSSSSSSSS Channel Status: $channel_status"; &agi_output;} + + if ($channel_status == 6) + { + $stmtA = "UPDATE vicidial_log set status='MP' where uniqueid = '$uniqueid' and lead_id='$CIDlead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vicidial_log update: N|$affected_rows|$uniqueid"; &agi_output;} + + $stmtA = "UPDATE vicidial_list set status='MP' where lead_id = '$CIDlead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vicidial_list update: N|$affected_rows|$CIDlead_id"; &agi_output;} + } + +while ($digit_loop_counter < 1) + { + $digit = chr($AGI->wait_for_digit('2000')); # wait 2 seconds for input or until digit pressed + if ($digit =~ /\d/) + { + $totalDTMF = "$totalDTMF$digit"; + if ($AGILOG) {$agi_string = "digit |$digit| TotalDTMF |$totalDTMF|"; &agi_output;} +# $AGI->say_digits("$digit"); + undef $digit; + } + else + { + $digit_loop_counter=1; + } + + $digit_loop_counter++; + } + +$totalDTMF =~ s/\D//gi; +$pin = $totalDTMF; +if ($totalDTMF) + { + if ($AGILOG) {$agi_string = "digit |$digit| TotalDTMF |$totalDTMF|"; &agi_output;} + return; + } + + + +######### PLAY THE OPTIONS FILE THEN WAIT 5 SECONDS FOR DIGITS ############ +$interrupt_digit = $AGI->stream_file("$options_audio_file",'123'); + if ($AGILOG) {$agi_string = "interrupt_digit |$interrupt_digit|"; &agi_output;} +$digits_being_entered=1; +$digit_loop_counter=0; +$totalDTMF=''; +if ($interrupt_digit > 1) + { + if ($interrupt_digit == 48) {$interrupt_digit=0;} + if ($interrupt_digit == 49) {$interrupt_digit=1;} + if ($interrupt_digit == 50) {$interrupt_digit=2;} + if ($interrupt_digit == 51) {$interrupt_digit=3;} + if ($interrupt_digit == 52) {$interrupt_digit=4;} + if ($interrupt_digit == 53) {$interrupt_digit=5;} + if ($interrupt_digit == 54) {$interrupt_digit=6;} + if ($interrupt_digit == 55) {$interrupt_digit=7;} + if ($interrupt_digit == 56) {$interrupt_digit=8;} + if ($interrupt_digit == 57) {$interrupt_digit=9;} + $totalDTMF=$interrupt_digit; + $digit_loop_counter++; + } + +while ($digit_loop_counter < 1) + { + $digit = chr($AGI->wait_for_digit('10000')); # wait 10 seconds for input or until digit pressed + if ($digit =~ /\d/) + { + $totalDTMF = "$totalDTMF$digit"; + if ($AGILOG) {$agi_string = "digit |$digit| TotalDTMF |$totalDTMF|"; &agi_output;} +# $AGI->say_digits("$digit"); + undef $digit; + } + else + { + $digit_loop_counter=1; + } + + $digit_loop_counter++; + } + +$totalDTMF =~ s/\D//gi; +$pin = $totalDTMF; +if ($totalDTMF) + { + if ($AGILOG) {$agi_string = "digit |$digit| TotalDTMF |$totalDTMF|"; &agi_output;} + return; + } +} + + + + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + # print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} + + + + +sub agi_output +{ +if ($AGILOG >=2) + { + ### open the log file for writing ### + open(Lout, ">>$AGILOGfile") + || die "Can't open $AGILOGfile: $!\n"; + print Lout "$now_date|$script|$agi_string\n"; + close(Lout); + } + ### send to STDERR writing ### +if ( ($AGILOG == '1') || ($AGILOG == '3') ) + {print STDERR "$now_date|$script|$agi_string\n";} +$agi_string=''; +} diff --git a/agc_2-X/branches/agc_2.0.4/agi/agi-VDADfixCXFER.agi b/agc_2-X/branches/agc_2.0.4/agi/agi-VDADfixCXFER.agi new file mode 100644 index 00000000..35d18dcd --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/agi/agi-VDADfixCXFER.agi @@ -0,0 +1,261 @@ +#!/usr/bin/perl +# +# agi-VDADfixCXFER.agi version 0.4 *DBI-version* +# +# runs when a Consultative transfer is released by the vicidial fronter as the +# call arrives on another channel so that the vicidial_live_agents record is +# updated to be accurate. +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ;VICIDIAL Consultative Xfer fix script: +# exten => _8600XXX*.,1,AGI(agi-VDADfixCXFER.agi) +# exten => _010*010*010*015*8600XXX*.,1,AGI(agi-VDADfixCXFER.agi) +# +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# +# CHANGELOG: +# 60809-1749 - First build +# 60817-1122 - Added output options check from database +# 70212-1252 - Fixed issue with Local/ channel transfers on same server +# + +$script = 'agi-VDADfixCXFER.agi'; + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +if (!$VARDB_port) {$VARDB_port='3306';} +if (!$AGILOGfile) {$AGILOGfile = "$PATHlogs/agiout.$year-$mon-$mday";} + +use DBI; +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### Grab Server values from the database +$stmtA = "SELECT agi_output FROM servers where server_ip = '$VARserver_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + $AGILOG = '0'; + @aryA = $sthA->fetchrow_array; + $DBagi_output = "$aryA[0]"; + if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';} + if ($DBagi_output =~ /FILE/) {$AGILOG = '2';} + if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';} + $rec_count++; + } +$sthA->finish(); + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + if ($AGILOG) {$agi_string = "Perl Environment Dump:"; &agi_output;} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($AGILOG) {$agi_string = "$i|$ARGV[$i]"; &agi_output;} + $i++; + } + + ### list of command-line array arguments: + @ARGV_vars = split(/-----/, $ARGV[0]); + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} + +$|=1; +while() +{ + chomp; + last unless length($_); + if ($AGILOG) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} +} + +# 010*010*011*011* + +$extension =~ s/^\d\d\d\*\d\d\d\*\d\d\d\*\d\d\d\*//gi; + +@EXTEN = split(/\*/, $extension); + $conf_exten = $EXTEN[0]; + $lead_id = $EXTEN[1]; + $user = $EXTEN[2]; + $phone_code = $EXTEN[3]; + $phone_number = $EXTEN[4]; + $campaign_id = $EXTEN[5]; + +if ($AGILOG) {$agi_string = "AGI Environment Dump:"; &agi_output;} + +foreach $i (sort keys %AGI) +{ + if ($AGILOG) {$agi_string = " -- $i = $AGI{$i}"; &agi_output;} +} + +if ($AGILOG) {$agi_string = "AGI Variables: |$unique_id|$channel|$extension|$type|$callerid|$calleridname|$priority|"; &agi_output;} + +if ($AGILOG) {$agi_string = "CXFERfix : $lead_id $user $channel $uniqueid"; &agi_output;} + + $CIDlead = sprintf("%010s", $lead_id); + $CIDlead = "C123412345$CIDlead"; + print "SET CALLERID $CIDlead\n"; + checkresult($result); + if ($AGILOG) {$agi_string = "callerID changed: $CIDlead"; &agi_output;} + +########## FIND AND UPDATE vicidial_live_agents ########## +$stmtA = "UPDATE vicidial_live_agents SET channel='$channel',call_server_ip='$VARserver_ip',uniqueid='$uniqueid' where user='$user' and lead_id='$lead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$affected_rows = $dbhA->do($stmtA); +if ($AGILOG) {$agi_string = "-- VDAD vicidial_live_agents update: |$affected_rows|$lead_id|"; &agi_output;} + +########## INSERT NEW vicidial_auto_calls record ########## +$stmtA = "INSERT INTO vicidial_auto_calls SET channel='$channel',server_ip='$VARserver_ip',uniqueid='$uniqueid',campaign_id='$campaign_id',status='CLOSER',lead_id='$lead_id',phone_code='$phone_code',phone_number='$phone_number',call_time='$SQLdate',call_type='IN',callerid='$CIDlead';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$affected_rows = $dbhA->do($stmtA); +if ($AGILOG) {$agi_string = "-- VDAD vicidial_auto_calls insert: |$affected_rows|$lead_id|"; &agi_output;} + +$dbhA->disconnect(); + + +if ($AGILOG) {$agi_string = "exiting the CXFERfix app, transferring call to $conf_exten"; &agi_output;} +#print "SET CONTEXT $ext_context\n"; +# checkresult($result); +print "SET EXTENSION $conf_exten\n"; + checkresult($result); +print "SET PRIORITY 1\n"; + checkresult($result); + + + + +exit; + + + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + # print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} + + + +sub agi_output +{ +if ($AGILOG >=2) + { + ### open the log file for writing ### + open(Lout, ">>$AGILOGfile") + || die "Can't open $AGILOGfile: $!\n"; + print Lout "$now_date|$script|$agi_string\n"; + close(Lout); + } + ### send to STDERR writing ### +if ( ($AGILOG == '1') || ($AGILOG == '3') ) + {print STDERR "$now_date|$script|$agi_string\n";} +$agi_string=''; +} diff --git a/agc_2-X/branches/agc_2.0.4/agi/agi-VDADinbound_NI_DNC_CIDlookup.agi b/agc_2-X/branches/agc_2.0.4/agi/agi-VDADinbound_NI_DNC_CIDlookup.agi new file mode 100644 index 00000000..6143ecbf --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/agi/agi-VDADinbound_NI_DNC_CIDlookup.agi @@ -0,0 +1,431 @@ +#!/usr/bin/perl +# +# agi-VDADinbound_NI_DNC_CIDlookup.agi version 0.1 *DBI-version* +# +# runs when a call comes in from an inbound call. This script will +# play a message and take input to automatically change customer lead to NI or DNC. +# *** This version detects inbound callerID over PRI *** +# +# ;inbound call from outbound CID callbacks from VICIDIAL calls: +#exten => 1234,1,Ringing ; call ringing +#exten => 1234,2,Wait(1) ; Wait 1 second for CID delivery from PRI +#exten => 1234,3,Answer ; Answer the line +#exten => 1234,4,AGI(agi-VDADinbound_NI_DNC_CIDlookup.agi) +#exten => 1234,5,Hangup +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# changes: +# 60914-1051 - First draft +# + +$script = 'agi-VDADinbound_NI_DNC_CIDlookup.agi'; + +### number of seconds to wait until you drop a waiting call +$DROP_TIME = 360; + +### files to play for message of not interested or DNC and your request has been processed +$prompt_file = 'not_interested_or_dnc'; +$processed_file = 'request_has_been_processed'; +$goodbye_audio_file = 'US_reminder_goodbye'; + + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$start_time=$now_date; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $SQLdateBEGIN = $SQLdate; + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +if (!$VARDB_port) {$VARDB_port='3306';} +if (!$AGILOGfile) {$AGILOGfile = "$PATHlogs/agiout.$year-$mon-$mday";} + +use DBI; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### Grab Server values from the database +$stmtA = "SELECT agi_output FROM servers where server_ip = '$VARserver_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + $AGILOG = '0'; + @aryA = $sthA->fetchrow_array; + $DBagi_output = "$aryA[0]"; + if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';} + if ($DBagi_output =~ /FILE/) {$AGILOG = '2';} + if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';} + $rec_count++; + } +$sthA->finish(); + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + if ($AGILOG) {$agi_string = "Perl Environment Dump:"; &agi_output;} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($AGILOG) {$agi_string = "$i|$ARGV[$i]"; &agi_output;} + $i++; + } + + ### list of command-line array arguments: + @ARGV_vars = split(/-----/, $ARGV[0]); + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} + +$|=1; +while() { + chomp; + last unless length($_); + if ($AGILOG) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} + + if ( ($callerid =~ /\".*\"/) && ( (!$calleridname) or ($calleridname =~ /unknown/) ) ) + { + $calleridname = $callerid; + $calleridname =~ s/\<\d\d\d\d\d\d\d\d\d\d\>//gi; + $calleridname =~ s/\"|\" //gi; + } + + $callerid =~ s/\D//gi; + $calleridname =~ s/unknown//gi; + if ( (!$callerid) or ($callerid =~ /unknown/) ) + {$callerid = $calleridname;} + + if (length($callerid)>0) {$phone_number = $callerid;} + else {$phone_number = '';} + if (length($calleridname)>0) {$VLcomments = $calleridname;} + else {$VLcomments = '';} + +# if ($channel =~ /^SIP/) {$channel =~ s/-.*//gi;} +# if ($channel =~ /^Zap\//) {$channel =~ s/-\d$//gi;} + if (length($callerid)<10) {$callerid = $parked_by;} + if (length($pin)>0) {$callerid = $pin;} + + + ### allow for external callerid to be collected +# if ($extension =~ /\*\d\d\d\d\d\d\d\d\d\d\*/) +# { +# @EXT_vars = split(/\*/, $extension); +# +# $referring_extension = $EXT_vars[0]; # initial extension sent +# $channel_group = $EXT_vars[1]; # name of the parked group +# $inbound_number = $EXT_vars[2]; # extension to send call to after parsing +# $parked_by = $EXT_vars[3]; # leadID +# $park_extension = $EXT_vars[4]; # filename of the on-hold music file +# $comment_d = $EXT_vars[5]; # N/A +# $comment_e = $EXT_vars[6]; # N/A +# +# $PADlead_id = sprintf("%09s", $parked_by); while (length($PADlead_id) > 9) {chop($PADlead_id);} +# # JmmddhhmmssLLLLLLLLL +# $JqueryCID = "J$CIDdate$PADlead_id"; +# $callerid = $JqueryCID; +# ### set the callerid to the filename of the audio for on-hold +# print "SET CALLERID $JqueryCID\n"; +# checkresult($result); +# print STDERR "callerID changed: $JqueryCID\n"; +# } +} + +foreach $i (sort keys %AGI) +{ + if ($AGILOG) {$agi_string = " -- $i = $AGI{$i}"; &agi_output;} +} + +if ($AGILOG) {$agi_string = "AGI Variables: |$unique_id|$channel|$extension|$type|$callerid|"; &agi_output;} + + +$AGI->stream_file('beep'); + +&enter_pin_number; + +if ( (length($pin)<1) || ($pin =~ /9/) ) + {&enter_pin_number;} +if ( (length($pin)<1) || ($pin =~ /9/) ) + {&enter_pin_number;} +if ( (length($pin)<1) || ($pin =~ /9/) ) + {&enter_pin_number;} +if ( (length($pin)<1) || ($pin =~ /9/) ) + {&enter_pin_number;} + +if ($pin =~ /2/) # set the phone_number to NI + { + ### Check to see if the number is in the system ### + $stmtA= "SELECT count(*) from vicidial_list where phone_number='$phone_number';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $lead_in_system = "$aryA[0]"; + $sthA->finish(); + + ### update all records for the phone_number in vicidial_list to NI (Not Interested) + $stmtA = "UPDATE vicidial_list SET status='NI' where phone_number='$phone_number';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "$affected_rows|$stmtA|"; &agi_output;} + } + $AGI->stream_file("$processed_file"); + } + +if ($pin =~ /3/) # set the phone_number to DNC + { + ### Check to see if the number is in the system ### + $stmtA= "SELECT count(*) from vicidial_list where phone_number='$phone_number';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $lead_in_system = "$aryA[0]"; + $sthA->finish(); + + ### update all records for the phone_number in vicidial_list to NI (Not Interested) + $stmtA = "UPDATE vicidial_list SET status='DNC' where phone_number='$phone_number';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "$affected_rows|$stmtA|"; &agi_output;} + } + + ### add the number to the vicidial_dnc table + $stmtA = "INSERT INTO vicidial_dnc SET phone_number='$phone_number';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "$affected_rows|$stmtA|"; &agi_output;} + + $AGI->stream_file("$processed_file"); + } + +$dbhA->disconnect(); + + +$AGI->stream_file("$goodbye_audio_file"); + +exit; + + + + + + + + + + + + + + + +sub enter_pin_number +{ +# if you are not interested in this program press 2 +# if you would not like to be contacted by us again press 3 +# if you would like us to try to get in contact with you hangup + +$interrupt_digit=''; +undef $interrupt_digit; + +$interrupt_digit = $AGI->stream_file("$prompt_file",'239'); + + if ($AGILOG) {$agi_string = "interrupt_digit |$interrupt_digit|"; &agi_output;} + +$digits_being_entered=1; +$totalDTMF=''; +if ($interrupt_digit > 1) + { + if ($interrupt_digit == 48) {$interrupt_digit=0;} + if ($interrupt_digit == 49) {$interrupt_digit=1;} + if ($interrupt_digit == 50) {$interrupt_digit=2;} + if ($interrupt_digit == 51) {$interrupt_digit=3;} + if ($interrupt_digit == 52) {$interrupt_digit=4;} + if ($interrupt_digit == 53) {$interrupt_digit=5;} + if ($interrupt_digit == 54) {$interrupt_digit=6;} + if ($interrupt_digit == 55) {$interrupt_digit=7;} + if ($interrupt_digit == 56) {$interrupt_digit=8;} + if ($interrupt_digit == 57) {$interrupt_digit=9;} + + $totalDTMF=$interrupt_digit; + } + +#$digit_loop_counter=0; +#while ( ($digits_being_entered) && ($digit_loop_counter < 20) ) +# { +# $digit = chr($AGI->wait_for_digit('30000')); # wait 30 seconds for input or until the pound key is pressed +# if ($digit =~ /\d/) +# { +# $totalDTMF = "$totalDTMF$digit"; +# print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n"; +# $AGI->say_digits("$digit"); +# undef $digit; +# } +# else +# { +# $digits_being_entered=0; +# } +# +# $digit_loop_counter++; +# } +#while ( ($digit_loop_counter < 4) ) +# { +# $digit = chr($AGI->wait_for_digit('10000')); # wait 10 seconds for input or until the pound key is pressed +# if ($digit =~ /\d/) +# { +# $totalDTMF = "$totalDTMF$digit"; +# if ($AGILOG) {$agi_string = "digit |$digit| TotalDTMF |$totalDTMF|"; &agi_output;} +# $AGI->say_digits("$digit"); +# undef $digit; +# } +# else +# { +# $digit_loop_counter=4; +# } +# +# $digit_loop_counter++; +# } + +$totalDTMF =~ s/\D//gi; +$pin = $totalDTMF; +if ($totalDTMF) {if ($AGILOG) {$agi_string = "digit |$digit| TotalDTMF |$totalDTMF|"; &agi_output;}} +} + + + + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + # print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} + + + +sub agi_output +{ +if ($AGILOG >=2) + { + ### open the log file for writing ### + open(Lout, ">>$AGILOGfile") + || die "Can't open $AGILOGfile: $!\n"; + print Lout "$now_date|$script|$agi_string\n"; + close(Lout); + } + ### send to STDERR writing ### +if ( ($AGILOG == '1') || ($AGILOG == '3') ) + {print STDERR "$now_date|$script|$agi_string\n";} +$agi_string=''; +} diff --git a/agc_2-X/branches/agc_2.0.4/agi/agi-VDADlisten_DTMF.agi b/agc_2-X/branches/agc_2.0.4/agi/agi-VDADlisten_DTMF.agi new file mode 100644 index 00000000..5026cf71 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/agi/agi-VDADlisten_DTMF.agi @@ -0,0 +1,293 @@ +#!/usr/bin/perl +# +# agi-VDADlisten_DTMF.agi version 0.3 *DBI-version* +# +# To be initiated by an agent so during a call. Agent will click a PIN NUMBER +# link on a web form webpage that will Originate a new call to this script +# +# This script plays a beep and waits for entry of 4 digits then inserts record +# +# ***** THIS SCRIPT ONLY WORKS WITH A CROSSOVER T1 CABLE FROM ONE T1 PORT ***** +# ***** TO ANOTHER T1 PORT WHETHER ON THE SAME SERVER OR DIFFERENT ONE ***** +# +# IN THE CAMPAIGN OR IN-GROUP NUMBER PRESET FIELD: +# AXFER83009 +# +# ON THE SERVER ORIGINATING THE CALL: +#;outbound DTMF VICIDIAL calls: +#exten => _983009.,1,AGI(call_log.agi,${EXTEN}) +#exten => _983009.,2,Dial(${TRUNKY}/${EXTEN:1},60) +#exten => _983009.,3,Hangup +# +# ON THE SERVER THAT HAS THIS SCRIPT: +#;inbound DTMF VICIDIAL calls: +#exten => _83009.,1,AGI(agi-VDADlisten_DTMF.agi,${EXTEN}) +#exten => _83009.,2,Hangup +# +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# +# changes: +# 60206-1434 first build +# 60207-1205 - added database records entries/modifications +# 60207-1507 - added ability to send AMs to campaign-defined message to leave +# 60731-1536 - changed to use DBI-DBD::mysql +# - changed to use /etc/astguiclient.conf for configs +# 60817-1113 - added output options check from database +# 70806-1619 - added HeavyDTMF check and filter +# + +$script = 'agi-VDADlisten_DTMF.agi'; + +$heavyDTMFcheck = 1; # set to 1 to check for heavy DTMF double-tones + +### set defaults for testing +$referring_extension = '83009'; +$phone_number = '9999999999'; +$lead_id = '999999999'; +$campaign_id = 'TESTCAMP'; +$product_code = 'ABC'; +$user = '1234'; +$pin = '0'; + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +if (!$VARDB_port) {$VARDB_port='3306';} +if (!$AGILOGfile) {$AGILOGfile = "$PATHlogs/agiout.$year-$mon-$mday";} + +use Time::HiRes qw(gettimeofday); +use DBI; +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### Grab Server values from the database +$stmtA = "SELECT agi_output FROM servers where server_ip = '$VARserver_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + $AGILOG = '0'; + @aryA = $sthA->fetchrow_array; + $DBagi_output = "$aryA[0]"; + if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';} + if ($DBagi_output =~ /FILE/) {$AGILOG = '2';} + if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';} + $rec_count++; + } +$sthA->finish(); + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + if ($AGILOG) {$agi_string = "Perl Environment Dump:"; &agi_output;} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($AGILOG) {$agi_string = "$i|$ARGV[$i]"; &agi_output;} + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} + +$|=1; +while() { + chomp; + last unless length($_); + if ($AGILOG) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + ### allow for internal transfer data string "83009*3125551212*10000123*TESTCAMP*ABC*1234*" + if ($extension =~ /^8300\d\*/) + { + @EXT_vars = split(/\*/, $extension); + + $referring_extension = $EXT_vars[0]; # initial extension sent + $phone_number = $EXT_vars[1]; # phone number + $lead_id = $EXT_vars[2]; # lead_id in vicidial_list + $campaign_id = $EXT_vars[3]; # campaign id + $product_code = $EXT_vars[4]; # product code + $user = $EXT_vars[5]; # vicidial_user that sent the call here + } +} + + if ($AGILOG) {$agi_string = "INBOUND DTMF CALL VDCL STARTED"; &agi_output;} + +&enter_pin_number; + +if (length($pin) < 4) {$AGI->stream_file('buzz');} +else {$AGI->stream_file('ding');} + +### insert a record into the vicidial_list_pins table +$stmtA = "INSERT INTO vicidial_list_pins (entry_time,phone_number,lead_id,campaign_id,product_code,user,digits) values('$SQLdate','$phone_number','$lead_id','$campaign_id','$product_code','$user','$pin');"; + +$affected_rows = $dbhA->do($stmtA); + +$insert_pin_id = $dbhA->{'mysql_insertid'}; + +if ($AGILOG) {$agi_string = "|$stmtA|$insert_pin_id|$affected_rows|"; &agi_output;} + +$dbhA->disconnect(); + +exit; + + + + + + + + +sub enter_pin_number +{ +$lastdigit=''; +$lastdigittime=''; + +$AGI->stream_file('beep'); + +while ( ($digit_loop_counter < 4) ) + { + $digit = chr($AGI->wait_for_digit('30000')); # wait 30 seconds for input or until the pound key is pressed + if ($digit =~ /\d/) + { + # get seconds and microseconds since the epoch + ($s, $usec) = gettimeofday(); + $Susec = sprintf("%06s", $usec); + $utime = "$s$Susec"; + + if (length($lastdigittime)<1) {$lastdigittime = $utime; $lastdigit = 99; $difftime = 0;} + else + { + $difftime = ($utime - $lastdigittime); + } + print STDERR "$s$Susec - $digit - $lastdigittime - $difftime\n"; + if ( ($difftime < 200000) && ($digit == $lastdigit) && ($heavyDTMFcheck>0) ) + { + print STDERR "HEAVY DTMF DETECTED AND IGNORED: $digit - $lastdigit - $difftime\n"; + $digit_loop_counter = ($digit_loop_counter - 1); + } + else + { + $totalDTMF = "$totalDTMF$digit"; + if ($AGILOG) {$agi_string = "digit |$digit| TotalDTMF |$totalDTMF|"; &agi_output;} + # $AGI->say_digits("$digit"); + } + $lastdigittime = $utime; $lastdigit = $digit; + undef $digit; + } + else + { + $digit_loop_counter=4; + } + + $digit_loop_counter++; + } + +$totalDTMF =~ s/\D//gi; +$pin = $totalDTMF; +if ($totalDTMF) + { + if ($AGILOG) {$agi_string = "digit |$digit| TotalDTMF |$totalDTMF|"; &agi_output;} + } +# $AGI->say_digits("$pin"); +} + + + +sub agi_output +{ +if ($AGILOG >=2) + { + ### open the log file for writing ### + open(Lout, ">>$AGILOGfile") + || die "Can't open $AGILOGfile: $!\n"; + print Lout "$now_date|$script|$agi_string\n"; + close(Lout); + } + ### send to STDERR writing ### +if ( ($AGILOG == '1') || ($AGILOG == '3') ) + {print STDERR "$now_date|$script|$agi_string\n";} +$agi_string=''; +} diff --git a/agc_2-X/branches/agc_2.0.4/agi/agi-VDADselective_CID.agi b/agc_2-X/branches/agc_2.0.4/agi/agi-VDADselective_CID.agi new file mode 100644 index 00000000..0e143713 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/agi/agi-VDADselective_CID.agi @@ -0,0 +1,175 @@ +#!/usr/bin/perl +# +# agi-VDADselective_CID.agi version 0.1 *NO DB Connection* +# +# Runs before a call is placed outbound to filter outgoing callerIDnumber +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ;outbound VICIDIAL calls: +#exten => _91NXXNXXXXXX,1,AGI(call_log.agi,${EXTEN}) +#exten => _91NXXNXXXXXX,2,AGI(agi-VDADselective_CID.agi,${EXTEN}) +#exten => _91NXXNXXXXXX,3,Dial(${TRUNKX}/${EXTEN:1},55,tTo) +#exten => _91NXXNXXXXXX,4,Hangup +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# changes: +# 60918-1042 - First build +# 71012-1239 - changed method for getting areacode +# + +$script = 'agi-VDADselective_CID.agi'; + +$AGILOG=0; +$FD=0; # force debug for testing + +# CLEAR AREA CODE LISTINGS: +# Florida: 239|305|321|352|386|407|561|689|727|754|772|786|813|836|850|861|863|904|941|954 + +$clear_area_codes = '239|305|321|352|386|407|561|689|727|754|772|786|813|836|850|861|863|904|941|954'; + + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + if ($AGILOG) {$agi_string = "Perl Environment Dump:"; &agi_output;} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($AGILOG) {$agi_string = "$i|$ARGV[$i]"; &agi_output;} + $i++; + } +} + +$|=1; +while() +{ + chomp; + last unless length($_); + if ($AGILOG) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} + + if ( ($callerid =~ /\".*\"/) && ( (!$calleridname) or ($calleridname =~ /unknown/) ) ) + { + $calleridname = $callerid; + $calleridname =~ s/\<\d\d\d\d\d\d\d\d\d\d\>//gi; + $calleridname =~ s/\"|\" //gi; + } + + $callerid =~ s/\D//gi; + $calleridname =~ s/unknown//gi; + if ( (!$callerid) or ($callerid =~ /unknown/) ) + {$callerid = $calleridname;} + + if (length($callerid)>0) {$phone_number = $callerid;} + else {$phone_number = '';} + if (length($calleridname)>0) {$VLcomments = $calleridname;} + else {$VLcomments = '';} +} + +$areacode = substr($extension, -10, 3); + + +foreach $i (sort keys %AGI) +{ + if ($AGILOG) {$agi_string = " -- $i = $AGI{$i}"; &agi_output;} +} + + +if ($areacode !~ /$clear_area_codes/) +{ + if ( (length($callerid)>20) && ($callerid =~ /\"\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S/) ) + { + $calleridname =~ s/^\"//gi; + $calleridname =~ s/\".*$//gi; + } + + ### set the callerid to the ACQS value(calleridname) + ## use these two lines for Asterisk 1.2 tree + $newcallerid = "\"$calleridname <0000000000>\""; + $AGI->set_callerid($newcallerid); + ## use these two lines for Asterisk 1.0 tree +# print "SET CALLERID \"$calleridname\" <0000000000>\n"; +# print "SET CALLERIDNAME \"$calleridname\"\n"; + + print STDERR "Setting CID \"$newcallerid\"\n"; + checkresult($result); + if ($AGILOG) {$agi_string = "callerID changed: \"$calleridname\" \<0000000000\>"; &agi_output;} + + if ($FD > 0) {print STDERR "callerID changed: \"$calleridname\" \<0000000000\> |$areacode|\n";} +} +else +{ + if ($FD > 0) {print STDERR "callerID NOT changed: \"$calleridname\" <$callerid> |$areacode|\n";} + +} +if ($AGILOG) {$agi_string = "AGI Variables: |$extension|$areacode|$callerid|$calleridname|"; &agi_output;} + +exit; + + + + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + # print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} + + + +sub agi_output +{ +if ($AGILOG >=2) + { + ### open the log file for writing ### + open(Lout, ">>$AGILOGfile") + || die "Can't open $AGILOGfile: $!\n"; + print Lout "$now_date|$script|$agi_string\n"; + close(Lout); + } + ### send to STDERR writing ### +if ( ($AGILOG == '1') || ($AGILOG == '3') ) + {print STDERR "$now_date|$script|$agi_string\n";} +$agi_string=''; +} diff --git a/agc_2-X/branches/agc_2.0.4/agi/agi-VDADselective_CID_hangup.agi b/agc_2-X/branches/agc_2.0.4/agi/agi-VDADselective_CID_hangup.agi new file mode 100644 index 00000000..1260de28 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/agi/agi-VDADselective_CID_hangup.agi @@ -0,0 +1,226 @@ +#!/usr/bin/perl +# +# agi-VDADselective_CID_hangup.agi version 0.1 *NO DB Connection* +# +# Will hangup a call if it is not within the specified area codes +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ;outbound VICIDIAL calls: +#exten => 8352,1,AGI(agi-VDADselective_CID_hangup.agi,${EXTEN}) +#exten => 8352,2,Playback(85100001) +#exten => 8352,3,Hangup +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# changes: +# 60918-1151 - First build +# + +$script = 'agi-VDADselective_CID_hangup.agi'; + +$AGILOG=1; + +# CLEAR AREA CODE LISTINGS: +# Florida: 239|305|321|352|386|407|561|689|727|754|772|786|813|836|850|861|863|904|941|954 + +$clear_area_codes = '239|305|321|352|386|407|561|689|727|754|772|786|813|836|850|861|863|904|941|954'; + + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +if (!$VARDB_port) {$VARDB_port='3306';} +if (!$AGILOGfile) {$AGILOGfile = "$PATHlogs/agiout.$year-$mon-$mday";} + +use DBI; +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + if ($AGILOG) {$agi_string = "Perl Environment Dump:"; &agi_output;} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($AGILOG) {$agi_string = "$i|$ARGV[$i]"; &agi_output;} + $i++; + } +} + +$|=1; +while() +{ + chomp; + last unless length($_); + if ($AGILOG) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} + + if ( ($callerid =~ /\".*\"/) && ( (!$calleridname) or ($calleridname =~ /unknown/) ) ) + { + $calleridname = $callerid; + $calleridname =~ s/\<\d\d\d\d\d\d\d\d\d\d\>//gi; + $calleridname =~ s/\"|\" //gi; + } + + $callerid =~ s/\D//gi; + $calleridname =~ s/unknown//gi; + if ( (!$callerid) or ($callerid =~ /unknown/) ) + {$callerid = $calleridname;} + + if (length($callerid)>0) {$phone_number = $callerid;} + else {$phone_number = '';} +} + +$CIDlead_id = $calleridname; +$CIDlead_id = substr($CIDlead_id, 11, 9); +$CIDlead_id = ($CIDlead_id + 0); + +$stmtA = "SELECT phone_number FROM vicidial_list where lead_id = '$CIDlead_id' limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $phone_number = "$aryA[0]"; + $rec_count++; + } +$sthA->finish(); + +$areacode = $phone_number; +if (length($areacode) > 10) + { + $areacode =~ s/^91|^991|^981|^971|^961|^951//gi; + $areacode =~ s/^1//gi; + } +$areacode =~ s/\d\d\d\d\d\d\d$//gi; + + +foreach $i (sort keys %AGI) +{ + if ($AGILOG) {$agi_string = " -- $i = $AGI{$i}"; &agi_output;} +} + + +if ($areacode !~ /$clear_area_codes/) +{ + print "SET HANGUP $channel\n"; + checkresult($result); + if ($AGILOG) {$agi_string = "channel Hungup: $channel"; &agi_output;} + print "SET EXTENSION $extension\n"; + checkresult($result); + print "SET PRIORITY 3\n"; + checkresult($result); + +} + +if ($AGILOG) {$agi_string = "AGI Variables: |$extension|$areacode|$phone_number|$callerid|$calleridname|$channel|"; &agi_output;} + +exit; + + + + + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + # print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} + + + +sub agi_output +{ +if ($AGILOG >=2) + { + ### open the log file for writing ### + open(Lout, ">>$AGILOGfile") + || die "Can't open $AGILOGfile: $!\n"; + print Lout "$now_date|$script|$agi_string\n"; + close(Lout); + } + ### send to STDERR writing ### +if ( ($AGILOG == '1') || ($AGILOG == '3') ) + {print STDERR "$now_date|$script|$agi_string\n";} +$agi_string=''; +} diff --git a/agc_2-X/branches/agc_2.0.4/agi/agi-VDADtransfer.agi b/agc_2-X/branches/agc_2.0.4/agi/agi-VDADtransfer.agi new file mode 100644 index 00000000..73bc26ff --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/agi/agi-VDADtransfer.agi @@ -0,0 +1,774 @@ +#!/usr/bin/perl +# +# agi-VDADtransfer.agi version 2.0.4 *DBI-version* +# +# runs when a call comes in from the VICIDIAL_auto_dialer. This script will +# send the calls out to the reps that are logged in. +# +# if there are no available agents, then it will check every second until an agent becomes available, +# if at the end of 10 seconds(default) it has not found an agent it will hangup the call and mark it as dropped +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ;VICIDIAL_auto_dialer transfer script: +# exten => 8365,1,AGI(call_log.agi,${EXTEN}) +# exten => 8365,2,AGI(agi-VDADtransfer.agi,${EXTEN}) +# +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# +# CHANGELOG: +# 50322-1246 - Changed callerid handling to allow for custom callerid +# 60119-1408 - Fixed calleridname issue with 1.2 tree for custom CID +# 60503-1054 - Added safe harbor and drop second options from campaign +# 60731-1441 - Changed to use DBI-DBD::mysql +# - Changed to use /etc/astguiclient.conf for configs +# 60816-1036 - Added output options check from database +# - Changed look for agent every 0.5 second for first 4 sec on hold +# 60905-1047 - Changed look for agent every 0.25 second for first 4 sec on hold +# 70109-1715 - Added option for concurrent_transfers +# 70214-1214 - Added QueueMetrics optional logging +# 70223-1046 - Added QueueMetrics ENTERQUEUE prepend option +# 70305-1240 - Fixed problems where the same call will run this script twice +# 71116-1045 - added fewest_calls and campaign_weight agent call routing options +# + +$script = 'agi-VDADtransfer.agi'; + +$DROP_TIME = 10; # default number of seconds to wait until you drop a waiting call + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +if (!$VARDB_port) {$VARDB_port='3306';} +if (!$AGILOGfile) {$AGILOGfile = "$PATHlogs/agiout.$year-$mon-$mday";} + +use DBI; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### Grab Server values from the database +$stmtA = "SELECT voicemail_dump_exten,ext_context,answer_transfer_agent,local_gmt,asterisk_version,max_vicidial_trunks,agi_output FROM servers where server_ip = '$VARserver_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBvoicemail_dump_exten = "$aryA[0]"; + $DBext_context = "$aryA[1]"; + $DBanswer_transfer_agent = "$aryA[2]"; + $DBSERVER_GMT = "$aryA[3]"; + $DBasterisk_version = "$aryA[4]"; + $DBmax_vicidial_trunks = "$aryA[5]"; + $DBagi_output = "$aryA[6]"; + if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;} + if ($DBext_context) {$ext_context = $DBext_context;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';} + if ($DBagi_output =~ /FILE/) {$AGILOG = '2';} + if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';} + $rec_count++; + } +$sthA->finish(); + +$start_time=$now_date; +$CIDdate = "$mon$mday$hour$min$sec"; +$tsSQLdate = "$year$mon$mday$hour$min$sec"; +$SQLdate = "$year-$mon-$mday $hour:$min:$sec"; +$SQLdateBEGIN = $SQLdate; + +$secX = time(); +$BDtarget = ($secX - 5); +($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); +$Byear = ($Byear + 1900); +$Bmon++; +if ($Bmon < 10) {$Bmon = "0$Bmon";} +if ($Bmday < 10) {$Bmday = "0$Bmday";} +if ($Bhour < 10) {$Bhour = "0$Bhour";} +if ($Bmin < 10) {$Bmin = "0$Bmin";} +if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + if ($AGILOG) {$agi_string = "Perl Environment Dump:"; &agi_output;} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($AGILOG) {$agi_string = "$i|$ARGV[$i]"; &agi_output;} + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} + +$|=1; +while() +{ + chomp; + last unless length($_); + if ($AGILOG) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_priority\:\s+(.*)$/) {$priority = $1;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} +} + +if ( (length($callerid)>20) && ($callerid =~ /\"\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S/) ) + { + $callerid =~ s/^\"//gi; + $callerid =~ s/\".*$//gi; + ### set the callerid to the ACQS value(calleridname) + print "SET CALLERID $callerid\n"; + checkresult($result); + if ($AGILOG) {$agi_string = "callerID changed: $callerid"; &agi_output;} + } +if ( ( +(length($calleridname)>5) && ( (!$callerid) or ($callerid =~ /unknown|private|00000000/i) or ($callerid =~ /5551212/) ) +) or ( (length($calleridname)>17) && ($calleridname =~ /\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/) ) ) + { + $callerid = $calleridname; + ### set the callerid to the ACQS value(calleridname) + print "SET CALLERID $callerid\n"; + checkresult($result); + if ($AGILOG) {$agi_string = "callerID changed: $callerid"; &agi_output;} + } + + +if ($AGILOG) {$agi_string = "AGI Environment Dump:"; &agi_output;} + +foreach $i (sort keys %AGI) +{ + if ($AGILOG) {$agi_string = " -- $i = $AGI{$i}"; &agi_output;} +} + +if ($AGILOG) {$agi_string = "AGI Variables: |$unique_id|$channel|$extension|$type|$callerid|$calleridname|$priority|"; &agi_output;} + +$VDADcampaign=''; +$VDADphone=''; +$VDADphone_code=''; + +$callerid =~ s/\"//gi; +$CIDlead_id = $callerid; +$CIDlead_id = substr($CIDlead_id, 11, 9); +$CIDlead_id = ($CIDlead_id + 0); + +if ($AGILOG) {$agi_string = "+++++ VDAD START : |$CIDlead_id|$now_date|$AST_ver|$priority|"; &agi_output;} + +if ( ($channel =~ /Local/i) && ($AST_ver !~ /^1\.0\.8|^1\.0\.9/) ) +{ +if ($AGILOG) {$agi_string = "+++++ VDAD START LOCAL CHANNEL: EXITING- $priority"; &agi_output;} +if ($priority > 2) {sleep(1);} +exit; +} + +$stmtA = "SELECT count(*) FROM vicidial_live_agents where callerid='$callerid';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $Pseudo_duplicate_count = "$aryA[0]"; + $rec_count++; + } +$sthA->finish(); + +if ($Pseudo_duplicate_count > 0) +{ +if ($AGILOG) {$agi_string = "+++++ VDAD START PSEUDO DUPLICATE: EXITING- $priority"; &agi_output;} +exit; +} + +$stmtA = "SELECT count(*) FROM vicidial_auto_calls where callerid='$callerid' and status IN('LIVE','XFER');"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $dialplan_duplicate_count = "$aryA[0]"; + $rec_count++; + } +$sthA->finish(); + +if ($dialplan_duplicate_count > 0) +{ +if ($AGILOG) {$agi_string = "+++++ VDAD START DIALPLAN DUPLICATE: EXITING- $priority"; &agi_output;} +exit; +} + + + +### Grab call parameters from vicidial_auto_calls table +$stmtA = "UPDATE vicidial_auto_calls set uniqueid='$unique_id', channel='$channel',status='LIVE',stage='LIVE-0' where callerid='$callerid' order by call_time desc limit 1;"; +$affected_rows = $dbhA->do($stmtA); +if ($AGILOG) {$agi_string = "-- VDAD : |$affected_rows|update of vac table: $callerid\n|$stmtA|"; &agi_output;} +if ($affected_rows > 0) + { + $stmtA = "SELECT campaign_id,phone_number,phone_code,lead_id,call_time FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VDADcampaign = "$aryA[0]"; + $VDADphone = "$aryA[1]"; + $VDADphone_code = "$aryA[2]"; + $VDADlead_id = "$aryA[3]"; + $VDADcall_time = "$aryA[4]"; + $rec_count++; + } + $sthA->finish(); + + ### Grab campaign values from the database + $stmtA = "SELECT drop_call_seconds,safe_harbor_message,safe_harbor_exten,concurrent_transfers FROM vicidial_campaigns where campaign_id = '$VDADcampaign';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBdrop_call_seconds = "$aryA[0]"; + $DBsafe_harbor_message = "$aryA[1]"; + $DBsafe_harbor_exten = "$aryA[2]"; + $DBconcurrent_transfers = "$aryA[3]"; + if ($DBdrop_call_seconds) {$DROP_TIME = $DBdrop_call_seconds;} + if ($DBsafe_harbor_message) {$safe_harbor_message = $DBsafe_harbor_message;} + if ($DBsafe_harbor_exten) {$safe_harbor_exten = $DBsafe_harbor_exten;} + $rec_count++; + } + $sthA->finish(); + + $stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$uniqueid','$CIDlead_id','$VDADcampaign','$SQLdate','$now_date_epoch','QUEUE','$VDADphone_code','$VDADphone','VDAD','N')"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + + if ($AGILOG) {$agi_string = "-- VDAD : |$VDADlead_id|$CIDlead_id|insert to vicidial_log: $uniqueid"; &agi_output;} + + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_eq_prepend FROM system_settings;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $enable_queuemetrics_logging = "$aryA[0]"; + $queuemetrics_server_ip = "$aryA[1]"; + $queuemetrics_dbname = "$aryA[2]"; + $queuemetrics_login= "$aryA[3]"; + $queuemetrics_pass = "$aryA[4]"; + $queuemetrics_log_id = "$aryA[5]"; + $queuemetrics_eq_prepend = "$aryA[6]"; + $rec_count++; + } + $sthA->finish(); + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + $stmtA = "SELECT phone_number FROM vicidial_auto_calls where lead_id='$CIDlead_id';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $phone_number = "$aryA[0]"; + $data2 = "$phone_number"; + $rec_count++; + } + $sthA->finish(); + + if ( (length($queuemetrics_eq_prepend) > 0) && ($queuemetrics_eq_prepend !~ /NONE/) ) + { + $stmtA = "SELECT $queuemetrics_eq_prepend FROM vicidial_list where lead_id='$CIDlead_id';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + $DASH='-'; + @aryA = $sthA->fetchrow_array; + $QMprepend = "$aryA[0]"; + $rec_count++; + $data2 = "$QMprepend$DASH$phone_number"; + } + $sthA->finish(); + } + + $dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} + + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='$callerid',queue='$VDADcampaign',agent='NONE',verb='ENTERQUEUE',data2='$data2',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } + } + +$drop_timer=0; +$drop_seconds=0; +$hold_message_counter=25; +$hold_tone_counter=0; + +while ($drop_timer <= $DROP_TIME) +{ +$channel_status = $AGI->channel_status("$channel"); +if ($channel_status < 1) + { + if ($AGILOG) {$agi_string = "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer CHECKING AGAIN"; &agi_output;} + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + + $channel_status_DC = $AGI->channel_status("$channel"); + + if ($channel_status_DC < 1) + { + if ($AGILOG) {$agi_string = "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer"; &agi_output;} + if ($drop_timer < $DROP_TIME) {$drop_seconds = $drop_timer;} + $drop_timer = ($drop_timer + $DROP_TIME); + } + } +$stmtA = "SELECT next_agent_call FROM vicidial_campaigns where campaign_id='$VDADcampaign';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $CAMP_callorder = "$aryA[0]"; + $rec_count++; + } +$sthA->finish(); + +$agent_call_order=''; +if ($CAMP_callorder =~ /overall_user_level/i) {$agent_call_order = 'order by user_level desc,last_call_finish';} +if ($CAMP_callorder =~ /oldest_call_start/i) {$agent_call_order = 'order by last_call_time';} +if ($CAMP_callorder =~ /oldest_call_finish/i) {$agent_call_order = 'order by last_call_finish';} +if ($CAMP_callorder =~ /random/i) {$agent_call_order = 'order by random_id';} +if ($CAMP_callorder =~ /campaign_rank/i) {$agent_call_order = 'order by campaign_weight desc,last_call_finish';} +if ($CAMP_callorder =~ /fewest_calls/i) {$agent_call_order = 'order by calls_today,last_call_finish';} + + $rec_countWAIT=0; +$stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and server_ip='$VARserver_ip' and campaign_id = '$VDADcampaign' and call_time < \"$VDADcall_time\" and lead_id != '$VDADlead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $rec_countWAIT = "$aryA[0]"; + $rec_count++; + } +$sthA->finish(); +if ($DBconcurrent_transfers =~ /AUTO/) + { + $active_agents=1; + $stmtA = "SELECT count(*) FROM vicidial_live_agents where server_ip='$VARserver_ip' and campaign_id = '$VDADcampaign' and last_update_time > '$BDtsSQLdate';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $active_agents = "$aryA[0]"; + $rec_count++; + } + + $DBconcurrent_transfers = ($active_agents / 10); + $DBconcurrent_transfers = sprintf("%.0f", $DBconcurrent_transfers); + $DBconcurrent_transfers++; + if ($AGILOG) {$agi_string = "|CONCURRENT TRANSFERS AUTO SETTING: $DBconcurrent_transfers ($active_agents)|"; &agi_output;} + } +$sthA->finish(); +if ($rec_countWAIT < $DBconcurrent_transfers) + { + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$CIDlead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid' where status = 'READY' and server_ip='$VARserver_ip' and campaign_id='$VDADcampaign' and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD get agent: |$affected_rows|update of vla table: $VDADcampaign|$VARserver_ip\n|$stmtA|"; &agi_output;} + if ($affected_rows > 0) + { + $r=0; + $VDADuser=''; + while ( (length($VDADuser)<1) && ($r<3) ) + { + $stmtA = "SELECT conf_exten,user,extension FROM vicidial_live_agents where status IN('QUEUE','INCALL') and server_ip='$VARserver_ip' and campaign_id='$VDADcampaign' and callerid='$callerid' and channel='$channel' order by last_call_time limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VDADconf_exten = "$aryA[0]"; + $VDADuser = "$aryA[1]"; + $VDADextension = "$aryA[2]"; + $rec_count++; + } + $sthA->finish(); + $r++; + if ($r > 1) + { + if ($AGILOG) {$agi_string = "EEEEEEEEEE vla UPDATE DELAY!!! |$callerid|$r|"; &agi_output;} + + ### sleep for 23 hundredths of a second + usleep(1*230*1000); + $drop_timer = ($drop_timer + 0.25); + } + if ($r > 2) + { + $stmtA = "SELECT conf_exten,user,extension FROM vicidial_live_agents where callerid='$callerid' order by last_call_time limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VDADconf_exten = "$aryA[0]"; + $VDADuser = "$aryA[1]"; + $VDADextension = "$aryA[2]"; + $rec_count++; + } + $sthA->finish(); + + if ($AGILOG) {$agi_string = "FFFFFFFFFF vla OR SELECT |$callerid|$VDADuser|"; &agi_output;} + } + } + + $stmtA = "UPDATE vicidial_auto_calls set status='XFER', stage='XFER-$drop_timer' where callerid='$callerid';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD XFER : |$affected_rows|update of vac table: $callerid\n|$stmtA|"; &agi_output;} + + $dbhA->disconnect(); + + if ($enable_queuemetrics_logging > 0) + { + $dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} + + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='$callerid',queue='$VDADcampaign',agent='Agent/$VDADuser',verb='CONNECT',data1='$drop_timer',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } + + if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $VDADconf_exten"; &agi_output;} + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $VDADconf_exten\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $now_date_epoch = time(); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + if ($AGILOG) {$agi_string = "XXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date"; &agi_output;} + + exit; + } + else + { + if ($AGILOG) {$agi_string = "NNNNNNNNNN No agent record found!!!"; &agi_output;} + } + } +else + { + if ($AGILOG) {$agi_string = "WWWWWWWW VDAD XFER WAIT: |$rec_countWAIT|$VDADcampaign|$channel|$callerid|$uniqueid|"; &agi_output;} + } + + +if ($drop_timer < 3) + { + ### sleep for 23 hundredths of a second + usleep(1*230*1000); + $drop_timer = ($drop_timer + 0.25); + } +else + { + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + + $drop_timer++; + } + +$stmtA = "UPDATE vicidial_auto_calls set stage='LIVE-$drop_timer' where callerid='$callerid';"; +$affected_rows = $dbhA->do($stmtA); +#if ($AGILOG) {$agi_string = "-- VDAD : |$affected_rows|update of vac table: $callerid\n|$stmtA|"; &agi_output;} + +} + + +if ($drop_timer >= $DROP_TIME) +{ +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $VDADvoicemail_ext = ''; + +$DROPexten = ''; +if ($drop_seconds < 1) + { + $drop_seconds = $DROP_TIME; + + if ($enable_queuemetrics_logging > 0) + { + $dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} + + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='$callerid',queue='$VDADcampaign',agent='NONE',verb='EXITWITHTIMEOUT',data1='1',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } + + if ($safe_harbor_message =~ /Y/) + { + $DROPexten = "$safe_harbor_exten"; + } + else + { + $stmtA = "SELECT voicemail_ext FROM vicidial_campaigns where campaign_id = '$VDADcampaign' limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VDADvoicemail_ext = "$aryA[0]"; + $VDADvoicemail_ext =~ s/\D//gi; + if (length($VDADvoicemail_ext)>0) + {$DROPexten = "$voicemail_dump_exten$VDADvoicemail_ext";} + $rec_count++; + } + $sthA->finish(); + } + } + + + ### use STDOUT to send call to proper DROP location + $VHqueryCID = "VH$CIDdate$VDADconf_exten"; + + if (length($DROPexten)>0) + { ### if DROP extension is defined then send the dropped call there instead of hangup + if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $DROPexten"; &agi_output;} + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $DROPexten\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + } + else + { + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$VARserver_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD call_hungup timout: |$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager"; &agi_output;} + } + + $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vac record deleted: |$affected_rows|$VDADcampaign|"; &agi_output;} + + $stmtA = "UPDATE vicidial_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where uniqueid = '$uniqueid';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vicidial_log update: |$affected_rows|$uniqueid"; &agi_output;} + + $stmtA = "UPDATE vicidial_list set status='DROP' where lead_id = '$CIDlead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vicidial_list update: |$affected_rows|$CIDlead_id"; &agi_output;} +} + + + + $dbhA->disconnect(); + + + +exit; + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + # print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} + + + +sub agi_output +{ +if ($AGILOG >=2) + { + ### open the log file for writing ### + open(Lout, ">>$AGILOGfile") + || die "Can't open $AGILOGfile: $!\n"; + print Lout "$now_date|$script|$agi_string\n"; + close(Lout); + } + ### send to STDERR writing ### +if ( ($AGILOG == '1') || ($AGILOG == '3') ) + {print STDERR "$now_date|$script|$agi_string\n";} +$agi_string=''; +} diff --git a/agc_2-X/branches/agc_2.0.4/agi/agi-VDADtransferBROADCAST.agi b/agc_2-X/branches/agc_2.0.4/agi/agi-VDADtransferBROADCAST.agi new file mode 100644 index 00000000..c7899053 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/agi/agi-VDADtransferBROADCAST.agi @@ -0,0 +1,608 @@ +#!/usr/bin/perl +# +# agi-VDADtransferBROADCAST.agi version 2.0.4 *DBI-version* +# +# runs when a call comes in from the VICIDIAL_auto_dialer. This script will +# send the calls out to the reps that are logged in. +# +# if there are no available agents, then it will check every second until an agent becomes available, +# if at the end of 10 seconds(default) it has not found an agent it will hangup the call and mark it as dropped +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ;VICIDIAL_auto_dialer transfer script: +# exten => 8365,1,AGI(call_log.agi,${EXTEN}) +# exten => 8365,2,AGI(agi-VDADtransfer.agi,${EXTEN}) +# +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# +# changes: +# 50322-1246 - changed callerid handling to allow for custom callerid +# 60119-1408 - fixed calleridname issue with 1.2 tree for custom CID +# 60503-1054 - Added safe harbor and drop second options from campaign +# 60731-1441 - changed to use DBI-DBD::mysql +# - changed to use /etc/astguiclient.conf for configs +# 60816-1036 - added output options check from database +# - changed look for agent every 0.5 second for first 4 sec on hold +# 60905-1047 - changed look for agent every 0.25 second for first 4 sec on hold +# 61110-1625 - added change of vicidial_list, vicidial_log to PU once this script runs +# 71116-1045 - added fewest_calls and campaign_weight agent call routing options +# + +$script = 'agi-VDADtransferBROADCAST.agi'; + +$DROP_TIME = 10; # default number of seconds to wait until you drop a waiting call + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +if (!$VARDB_port) {$VARDB_port='3306';} +if (!$AGILOGfile) {$AGILOGfile = "$PATHlogs/agiout.$year-$mon-$mday";} + +use DBI; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### Grab Server values from the database +$stmtA = "SELECT voicemail_dump_exten,ext_context,answer_transfer_agent,local_gmt,asterisk_version,max_vicidial_trunks,agi_output FROM servers where server_ip = '$VARserver_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBvoicemail_dump_exten = "$aryA[0]"; + $DBext_context = "$aryA[1]"; + $DBanswer_transfer_agent = "$aryA[2]"; + $DBSERVER_GMT = "$aryA[3]"; + $DBasterisk_version = "$aryA[4]"; + $DBmax_vicidial_trunks = "$aryA[5]"; + $DBagi_output = "$aryA[6]"; + if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;} + if ($DBext_context) {$ext_context = $DBext_context;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';} + if ($DBagi_output =~ /FILE/) {$AGILOG = '2';} + if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';} + $rec_count++; + } +$sthA->finish(); + +$start_time=$now_date; +$CIDdate = "$mon$mday$hour$min$sec"; +$tsSQLdate = "$year$mon$mday$hour$min$sec"; +$SQLdate = "$year-$mon-$mday $hour:$min:$sec"; +$SQLdateBEGIN = $SQLdate; + +$secX = time(); +$BDtarget = ($secX - 5); +($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); +$Byear = ($Byear + 1900); +$Bmon++; +if ($Bmon < 10) {$Bmon = "0$Bmon";} +if ($Bmday < 10) {$Bmday = "0$Bmday";} +if ($Bhour < 10) {$Bhour = "0$Bhour";} +if ($Bmin < 10) {$Bmin = "0$Bmin";} +if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + if ($AGILOG) {$agi_string = "Perl Environment Dump:"; &agi_output;} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($AGILOG) {$agi_string = "$i|$ARGV[$i]"; &agi_output;} + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} + +$|=1; +while() +{ + chomp; + last unless length($_); + if ($AGILOG) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_priority\:\s+(.*)$/) {$priority = $1;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} +} + +if ( (length($callerid)>20) && ($callerid =~ /\"\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S/) ) + { + $callerid =~ s/^\"//gi; + $callerid =~ s/\".*$//gi; + ### set the callerid to the ACQS value(calleridname) + print "SET CALLERID $callerid\n"; + checkresult($result); + if ($AGILOG) {$agi_string = "callerID changed: $callerid"; &agi_output;} + } +if ( ( +(length($calleridname)>5) && ( (!$callerid) or ($callerid =~ /unknown|private|00000000/i) or ($callerid =~ /5551212/) ) +) or ( (length($calleridname)>17) && ($calleridname =~ /\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/) ) ) + { + $callerid = $calleridname; + ### set the callerid to the ACQS value(calleridname) + print "SET CALLERID $callerid\n"; + checkresult($result); + if ($AGILOG) {$agi_string = "callerID changed: $callerid"; &agi_output;} + } + + +if ($AGILOG) {$agi_string = "AGI Environment Dump:"; &agi_output;} + +foreach $i (sort keys %AGI) +{ + if ($AGILOG) {$agi_string = " -- $i = $AGI{$i}"; &agi_output;} +} + +if ($AGILOG) {$agi_string = "AGI Variables: |$unique_id|$channel|$extension|$type|$callerid|$calleridname|$priority|"; &agi_output;} + +$VDADcampaign=''; +$VDADphone=''; +$VDADphone_code=''; + +$callerid =~ s/\"//gi; +$CIDlead_id = $callerid; +$CIDlead_id = substr($CIDlead_id, 11, 9); +$CIDlead_id = ($CIDlead_id + 0); + +if ($AGILOG) {$agi_string = "+++++ VDAD START : |$CIDlead_id|$now_date|$AST_ver|$priority|"; &agi_output;} + +if ( ($channel =~ /Local/i) && ($AST_ver !~ /^1\.0\.8|^1\.0\.9/) ) +{ +if ($AGILOG) {$agi_string = "+++++ VDAD START LOCAL CHANNEL: EXITING- $priority"; &agi_output;} +if ($priority > 2) {sleep(1);} +exit; +} + + +### Grab call parameters from vicidial_auto_calls table +$stmtA = "UPDATE vicidial_auto_calls set uniqueid='$unique_id', channel='$channel',status='LIVE',stage='LIVE-0' where callerid='$callerid' order by call_time desc limit 1;"; +$affected_rows = $dbhA->do($stmtA); +if ($AGILOG) {$agi_string = "-- VDAD : |$affected_rows|update of vac table: $callerid\n|$stmtA|"; &agi_output;} +if ($affected_rows > 0) + { + $stmtA = "UPDATE vicidial_list set status='PU' where lead_id='$CIDlead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vicidial_list PU update: |$affected_rows|$uniqueid|"; &agi_output;} + + $stmtA = "SELECT campaign_id,phone_number,phone_code,lead_id,call_time FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VDADcampaign = "$aryA[0]"; + $VDADphone = "$aryA[1]"; + $VDADphone_code = "$aryA[2]"; + $VDADlead_id = "$aryA[3]"; + $VDADcall_time = "$aryA[4]"; + $rec_count++; + } + $sthA->finish(); + + ### Grab campaign values from the database + $stmtA = "SELECT drop_call_seconds,safe_harbor_message,safe_harbor_exten,concurrent_transfers FROM vicidial_campaigns where campaign_id = '$VDADcampaign';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBdrop_call_seconds = "$aryA[0]"; + $DBsafe_harbor_message = "$aryA[1]"; + $DBsafe_harbor_exten = "$aryA[2]"; + $DBconcurrent_transfers = "$aryA[3]"; + if ($DBdrop_call_seconds) {$DROP_TIME = $DBdrop_call_seconds;} + if ($DBsafe_harbor_message) {$safe_harbor_message = $DBsafe_harbor_message;} + if ($DBsafe_harbor_exten) {$safe_harbor_exten = $DBsafe_harbor_exten;} + $rec_count++; + } + $sthA->finish(); + + $stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$uniqueid','$CIDlead_id','$VDADcampaign','$SQLdate','$now_date_epoch','PU','$VDADphone_code','$VDADphone','VDAD','N')"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + + if ($AGILOG) {$agi_string = "-- VDAD : |$VDADlead_id|$CIDlead_id|insert to vicidial_log: $uniqueid"; &agi_output;} + } + +$drop_timer=0; +$drop_seconds=0; +$hold_message_counter=25; +$hold_tone_counter=0; + +while ($drop_timer <= $DROP_TIME) +{ +$channel_status = $AGI->channel_status("$channel"); +if ($channel_status < 1) + { + if ($AGILOG) {$agi_string = "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer CHECKING AGAIN"; &agi_output;} + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + + $channel_status_DC = $AGI->channel_status("$channel"); + + if ($channel_status_DC < 1) + { + if ($AGILOG) {$agi_string = "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer"; &agi_output;} + if ($drop_timer < $DROP_TIME) {$drop_seconds = $drop_timer;} + $drop_timer = ($drop_timer + $DROP_TIME); + } + } +$stmtA = "SELECT next_agent_call FROM vicidial_campaigns where campaign_id='$VDADcampaign';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $CAMP_callorder = "$aryA[0]"; + $rec_count++; + } +$sthA->finish(); + +$agent_call_order=''; +if ($CAMP_callorder =~ /overall_user_level/i) {$agent_call_order = 'order by user_level desc,last_call_finish';} +if ($CAMP_callorder =~ /oldest_call_start/i) {$agent_call_order = 'order by last_call_time';} +if ($CAMP_callorder =~ /oldest_call_finish/i) {$agent_call_order = 'order by last_call_finish';} +if ($CAMP_callorder =~ /random/i) {$agent_call_order = 'order by random_id';} +if ($CAMP_callorder =~ /campaign_rank/i) {$agent_call_order = 'order by campaign_weight desc,last_call_finish';} +if ($CAMP_callorder =~ /fewest_calls/i) {$agent_call_order = 'order by calls_today,last_call_finish';} + + $rec_countWAIT=0; +$stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and server_ip='$VARserver_ip' and campaign_id = '$VDADcampaign' and call_time < \"$VDADcall_time\" and lead_id != '$VDADlead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $rec_countWAIT = "$aryA[0]"; + $rec_count++; + } +$sthA->finish(); +if ($DBconcurrent_transfers =~ /AUTO/) + { + $active_agents=1; + $stmtA = "SELECT count(*) FROM vicidial_live_agents where server_ip='$VARserver_ip' and campaign_id = '$VDADcampaign' and last_update_time > '$BDtsSQLdate';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $active_agents = "$aryA[0]"; + $rec_count++; + } + + $DBconcurrent_transfers = ($active_agents / 10); + $DBconcurrent_transfers = sprintf("%.0f", $DBconcurrent_transfers); + $DBconcurrent_transfers++; + if ($AGILOG) {$agi_string = "|CONCURRENT TRANSFERS AUTO SETTING: $DBconcurrent_transfers ($active_agents)|"; &agi_output;} + } +$sthA->finish(); +if ($rec_countWAIT < $DBconcurrent_transfers) + { + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$CIDlead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid' where status = 'READY' and server_ip='$VARserver_ip' and campaign_id='$VDADcampaign' and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD get agent: |$affected_rows|update of vla table: $VDADcampaign|$VARserver_ip\n|$stmtA|"; &agi_output;} + if ($affected_rows > 0) + { + $stmtA = "SELECT conf_exten,user,extension FROM vicidial_live_agents where status = 'QUEUE' and server_ip='$VARserver_ip' and campaign_id='$VDADcampaign' and callerid='$callerid' and channel='$channel' order by last_call_time limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VDADconf_exten = "$aryA[0]"; + $VDADuser = "$aryA[1]"; + $VDADextension = "$aryA[2]"; + $rec_count++; + } + $sthA->finish(); + + $stmtA = "UPDATE vicidial_auto_calls set status='XFER', stage='XFER-$drop_timer' where callerid='$callerid';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD XFER : |$affected_rows|update of vac table: $callerid\n|$stmtA|"; &agi_output;} + + $dbhA->disconnect(); + + if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $VDADconf_exten"; &agi_output;} + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $VDADconf_exten\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $now_date_epoch = time(); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + if ($AGILOG) {$agi_string = "XXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date"; &agi_output;} + + exit; + } + else + { + if ($AGILOG) {$agi_string = "NNNNNNNNNN No agent record found!!!"; &agi_output;} + } + } +else + { + if ($AGILOG) {$agi_string = "WWWWWWWW VDAD XFER WAIT: |$rec_countWAIT|$VDADcampaign|$channel|$callerid|$uniqueid|"; &agi_output;} + } + + +if ($drop_timer < 3) + { + ### sleep for 23 hundredths of a second + usleep(1*230*1000); + $drop_timer = ($drop_timer + 0.25); + } +else + { + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + + $drop_timer++; + } + +$stmtA = "UPDATE vicidial_auto_calls set stage='LIVE-$drop_timer' where callerid='$callerid';"; +$affected_rows = $dbhA->do($stmtA); +#if ($AGILOG) {$agi_string = "-- VDAD : |$affected_rows|update of vac table: $callerid\n|$stmtA|"; &agi_output;} + +} + + +if ($drop_timer >= $DROP_TIME) +{ +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $VDADvoicemail_ext = ''; + +$DROPexten = ''; +if ($drop_seconds < 1) + { + $drop_seconds = $DROP_TIME; + + if ($safe_harbor_message =~ /Y/) + { + $DROPexten = "$safe_harbor_exten"; + } + else + { + $stmtA = "SELECT voicemail_ext FROM vicidial_campaigns where campaign_id = '$VDADcampaign' limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VDADvoicemail_ext = "$aryA[0]"; + $VDADvoicemail_ext =~ s/\D//gi; + if (length($VDADvoicemail_ext)>0) + {$DROPexten = "$voicemail_dump_exten$VDADvoicemail_ext";} + $rec_count++; + } + $sthA->finish(); + } + } + + + ### use STDOUT to send call to proper DROP location + $VHqueryCID = "VH$CIDdate$VDADconf_exten"; + + if (length($DROPexten)>0) + { ### if DROP extension is defined then send the dropped call there instead of hangup + if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $DROPexten"; &agi_output;} + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $DROPexten\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + } + else + { + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$VARserver_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD call_hungup timout: |$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager"; &agi_output;} + } + + $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vac record deleted: |$affected_rows|$VDADcampaign|"; &agi_output;} + + $stmtA = "UPDATE vicidial_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where uniqueid = '$uniqueid';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vicidial_log update: |$affected_rows|$uniqueid"; &agi_output;} + + $stmtA = "UPDATE vicidial_list set status='DROP' where lead_id = '$CIDlead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vicidial_list update: |$affected_rows|$CIDlead_id"; &agi_output;} +} + + + + $dbhA->disconnect(); + + + +exit; + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + # print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} + + + +sub agi_output +{ +if ($AGILOG >=2) + { + ### open the log file for writing ### + open(Lout, ">>$AGILOGfile") + || die "Can't open $AGILOGfile: $!\n"; + print Lout "$now_date|$script|$agi_string\n"; + close(Lout); + } + ### send to STDERR writing ### +if ( ($AGILOG == '1') || ($AGILOG == '3') ) + {print STDERR "$now_date|$script|$agi_string\n";} +$agi_string=''; +} diff --git a/agc_2-X/branches/agc_2.0.4/agi/agi-VDADtransferSURVEY.agi b/agc_2-X/branches/agc_2.0.4/agi/agi-VDADtransferSURVEY.agi new file mode 100644 index 00000000..a217ff76 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/agi/agi-VDADtransferSURVEY.agi @@ -0,0 +1,922 @@ +#!/usr/bin/perl +# +# agi-VDADtransferSURVEY.agi version 2.0.4 *DBI-version* +# +# runs when a call comes in from the VICIDIAL auto_dialer. This script will +# send the calls out to the reps that are logged in if called person presses key. +# +# if there are no available agents, then it will check every second until an agent becomes available, +# if at the end of 10 seconds(default) it has not found an agent it will hangup the call and mark it as dropped +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ;VICIDIAL_auto_dialer transfer script: +# exten => 8366,1,AGI(call_log.agi,${EXTEN}) +# exten => 8366,2,AGI(agi-VDADtransferSURVEY.agi,${EXTEN}) +# +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# +# CHANGELOG +# 60119-1408 - Fixed calleridname issue with 1.2 tree for custom CID +# 60503-1100 - Added safe harbor and drop second options from campaign +# 60731-1441 - Changed to use DBI-DBD::mysql +# - Changed to use /etc/astguiclient.conf for configs +# 60816-1034 - Added output options check from database +# - Changed look for agent every 0.5 second for first 4 sec on hold +# 60905-1047 - Changed look for agent every 0.25 second for first 4 sec on hold +# 70215-1052 - Added QueueMetrics optional logging +# 70223-1101 - Added QueueMetrics ENTERQUEUE prepend option +# 70305-1251 - Fixed problems where the same call will run this script twice +# 71116-1045 - added fewest_calls and campaign_weight agent call routing options +# + +$script = 'agi-VDADtransferSURVEY.agi'; + +$DROP_TIME = 10; # default number of seconds to wait until you drop a waiting call + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +if (!$VARDB_port) {$VARDB_port='3306';} +if (!$AGILOGfile) {$AGILOGfile = "$PATHlogs/agiout.$year-$mon-$mday";} + +use DBI; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### Grab Server values from the database +$stmtA = "SELECT voicemail_dump_exten,ext_context,answer_transfer_agent,local_gmt,asterisk_version,max_vicidial_trunks,agi_output FROM servers where server_ip = '$VARserver_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBvoicemail_dump_exten = "$aryA[0]"; + $DBext_context = "$aryA[1]"; + $DBanswer_transfer_agent = "$aryA[2]"; + $DBSERVER_GMT = "$aryA[3]"; + $DBasterisk_version = "$aryA[4]"; + $DBmax_vicidial_trunks = "$aryA[5]"; + $DBagi_output = "$aryA[6]"; + if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;} + if ($DBext_context) {$ext_context = $DBext_context;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';} + if ($DBagi_output =~ /FILE/) {$AGILOG = '2';} + if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';} + $rec_count++; + } +$sthA->finish(); + +$start_time=$now_date; +$CIDdate = "$mon$mday$hour$min$sec"; +$tsSQLdate = "$year$mon$mday$hour$min$sec"; +$SQLdate = "$year-$mon-$mday $hour:$min:$sec"; +$SQLdateBEGIN = $SQLdate; + +$secX = time(); +$BDtarget = ($secX - 5); +($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); +$Byear = ($Byear + 1900); +$Bmon++; +if ($Bmon < 10) {$Bmon = "0$Bmon";} +if ($Bmday < 10) {$Bmday = "0$Bmday";} +if ($Bhour < 10) {$Bhour = "0$Bhour";} +if ($Bmin < 10) {$Bmin = "0$Bmin";} +if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + if ($AGILOG) {$agi_string = "Perl Environment Dump:"; &agi_output;} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($AGILOG) {$agi_string = "$i|$ARGV[$i]"; &agi_output;} + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} + +$|=1; +while() { + chomp; + last unless length($_); + if ($AGILOG) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_priority\:\s+(.*)$/) {$priority = $1;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} +} + +if ( (length($callerid)>20) && ($callerid =~ /\"\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S/) ) + { + $callerid =~ s/^\"//gi; + $callerid =~ s/\".*$//gi; + ### set the callerid to the ACQS value(calleridname) + print "SET CALLERID $callerid\n"; + checkresult($result); + if ($AGILOG) {$agi_string = "callerID changed: $callerid"; &agi_output;} + } +if ( ( +(length($calleridname)>5) && ( (!$callerid) or ($callerid =~ /unknown|private|00000000/i) or ($callerid =~ /5551212/) ) +) or ( (length($calleridname)>17) && ($calleridname =~ /\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/) ) ) + { + $callerid = $calleridname; + ### set the callerid to the ACQS value(calleridname) + print "SET CALLERID $callerid\n"; + checkresult($result); + if ($AGILOG) {$agi_string = "callerID changed: $callerid"; &agi_output;} + } + + +if ($AGILOG) {$agi_string = "AGI Environment Dump:"; &agi_output;} + +foreach $i (sort keys %AGI) +{ + if ($AGILOG) {$agi_string = " -- $i = $AGI{$i}"; &agi_output;} +} + +if ($AGILOG) {$agi_string = "AGI Variables: |$unique_id|$channel|$extension|$type|$callerid|$calleridname|$priority|"; &agi_output;} + +$VDADcampaign=''; +$VDADphone=''; +$VDADphone_code=''; + +$callerid =~ s/\"//gi; +$CIDlead_id = $callerid; +$CIDlead_id = substr($CIDlead_id, 11, 9); +$CIDlead_id = ($CIDlead_id + 0); + +if ($AGILOG) {$agi_string = "+++++ VDAD START : |$CIDlead_id|$now_date|$AST_ver|$priority|"; &agi_output;} + +if ( ($channel =~ /Local/i) && ($AST_ver !~ /^1\.0\.8|^1\.0\.9/) ) +{ +if ($AGILOG) {$agi_string = "+++++ VDAD START LOCAL CHANNEL: EXITING- $priority"; &agi_output;} +if ($priority > 2) {sleep(1);} +exit; +} + + +$stmtA = "SELECT count(*) FROM vicidial_live_agents where callerid='$callerid';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $Pseudo_duplicate_count = "$aryA[0]"; + $rec_count++; + } +$sthA->finish(); + +if ($Pseudo_duplicate_count > 0) +{ +if ($AGILOG) {$agi_string = "+++++ VDAD START PSEUDO DUPLICATE: EXITING- $priority"; &agi_output;} +exit; +} + +$stmtA = "SELECT count(*) FROM vicidial_auto_calls where callerid='$callerid' and status IN('LIVE','XFER');"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $dialplan_duplicate_count = "$aryA[0]"; + $rec_count++; + } +$sthA->finish(); + +if ($dialplan_duplicate_count > 0) +{ +if ($AGILOG) {$agi_string = "+++++ VDAD START DIALPLAN DUPLICATE: EXITING- $priority"; &agi_output;} +exit; +} + + +$AGI->stream_file('beep'); + + +$stmtA = "UPDATE vicidial_list set status='PU' where lead_id = '$CIDlead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$affected_rows = $dbhA->do($stmtA); +if ($AGILOG) {$agi_string = "-- VDAD vicidial_list update: |$affected_rows|$CIDlead_id|XFER"; &agi_output;} + + &enter_pin_number; + +if ($AGILOG) {$agi_string = "+++++ VDAD STATUS : pressed $pin|$unique_id|$channel|$extension|$type|$callerid|$CIDlead_id|$now_date"; &agi_output;} + +if ($pin !~ /^1|^2|^3|^8|^0/) {exit;} + +if (!$DB_port) {$DB_port='3306';} + + + + + +if ($pin =~ /^1|^2|^3|^0/) +{ +$voter=''; + +if ($pin == "1") {$voter = 'DEMOCRAT';} +if ($pin == "2") {$voter = 'REPUBLICAN';} +if ($pin == "3") {$voter = 'INDEPENDANT';} +if ($pin == "0") {$voter = 'OPERATOR';} + +$stmtA = "UPDATE vicidial_list set security_phrase='$voter' where lead_id = '$CIDlead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$affected_rows = $dbhA->do($stmtA); +if ($AGILOG) {$agi_string = "-- VDAD vicidial_list VOTER update: |$affected_rows|$CIDlead_id|$voter"; &agi_output;} + +# Thank you for your response, we would now like to transfer you to a poll-taker for just a few more questions. Please stay on the line. + +$AGI->stream_file('US_pol_survey_transfer'); + +### Grab call parameters from vicidial_auto_calls table +$stmtA = "UPDATE vicidial_auto_calls set uniqueid='$unique_id', channel='$channel',status='LIVE',stage='LIVE-0' where callerid='$callerid' order by call_time desc limit 1;"; +$affected_rows = $dbhA->do($stmtA); +if ($AGILOG) {$agi_string = "-- VDAD : |$affected_rows|update of vac table: $callerid\n|$stmtA|"; &agi_output;} +if ($affected_rows > 0) + { + $stmtA = "SELECT campaign_id,phone_number,phone_code,lead_id,call_time FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VDADcampaign = "$aryA[0]"; + $VDADphone = "$aryA[1]"; + $VDADphone_code = "$aryA[2]"; + $VDADlead_id = "$aryA[3]"; + $VDADcall_time = "$aryA[4]"; + $rec_count++; + } + $sthA->finish(); + + ### Grab campaign values from the database + $stmtA = "SELECT drop_call_seconds,safe_harbor_message,safe_harbor_exten,concurrent_transfers FROM vicidial_campaigns where campaign_id = '$VDADcampaign';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBdrop_call_seconds = "$aryA[0]"; + $DBsafe_harbor_message = "$aryA[1]"; + $DBsafe_harbor_exten = "$aryA[2]"; + $DBconcurrent_transfers = "$aryA[3]"; + if ($DBdrop_call_seconds) {$DROP_TIME = $DBdrop_call_seconds;} + if ($DBsafe_harbor_message) {$safe_harbor_message = $DBsafe_harbor_message;} + if ($DBsafe_harbor_exten) {$safe_harbor_exten = $DBsafe_harbor_exten;} + $rec_count++; + } + $sthA->finish(); + + $stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$uniqueid','$CIDlead_id','$VDADcampaign','$SQLdate','$now_date_epoch','QUEUE','$VDADphone_code','$VDADphone','VDAD','N')"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + + if ($AGILOG) {$agi_string = "-- VDAD : |$VDADlead_id|$CIDlead_id|insert to vicidial_log: $uniqueid"; &agi_output;} + + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_eq_prepend FROM system_settings;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $enable_queuemetrics_logging = "$aryA[0]"; + $queuemetrics_server_ip = "$aryA[1]"; + $queuemetrics_dbname = "$aryA[2]"; + $queuemetrics_login= "$aryA[3]"; + $queuemetrics_pass = "$aryA[4]"; + $queuemetrics_log_id = "$aryA[5]"; + $queuemetrics_eq_prepend = "$aryA[6]"; + $rec_count++; + } + $sthA->finish(); + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + $stmtA = "SELECT phone_number FROM vicidial_auto_calls where lead_id='$CIDlead_id';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $phone_number = "$aryA[0]"; + $data2 = "$phone_number"; + $rec_count++; + } + $sthA->finish(); + + if ( (length($queuemetrics_eq_prepend) > 0) && ($queuemetrics_eq_prepend !~ /NONE/) ) + { + $stmtA = "SELECT $queuemetrics_eq_prepend FROM vicidial_list where lead_id='$CIDlead_id';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + $DASH='-'; + @aryA = $sthA->fetchrow_array; + $QMprepend = "$aryA[0]"; + $rec_count++; + $data2 = "$QMprepend$DASH$phone_number"; + } + $sthA->finish(); + } + + $dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} + + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='$callerid',queue='$VDADcampaign',agent='NONE',verb='ENTERQUEUE',data2='$data2',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } + } + +$drop_timer=0; +$drop_seconds=0; +$hold_message_counter=25; +$hold_tone_counter=0; + +while ($drop_timer <= $DROP_TIME) +{ +$channel_status = $AGI->channel_status("$channel"); +if ($channel_status < 1) + { + if ($AGILOG) {$agi_string = "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer CHECKING AGAIN"; &agi_output;} + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + + $channel_status_DC = $AGI->channel_status("$channel"); + + if ($channel_status_DC < 1) + { + if ($AGILOG) {$agi_string = "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer"; &agi_output;} + if ($drop_timer < $DROP_TIME) {$drop_seconds = $drop_timer;} + $drop_timer = ($drop_timer + $DROP_TIME); + } + } +$stmtA = "SELECT next_agent_call FROM vicidial_campaigns where campaign_id='$VDADcampaign';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $CAMP_callorder = "$aryA[0]"; + $rec_count++; + } +$sthA->finish(); + +$agent_call_order=''; +if ($CAMP_callorder =~ /overall_user_level/i) {$agent_call_order = 'order by user_level desc,last_call_finish';} +if ($CAMP_callorder =~ /oldest_call_start/i) {$agent_call_order = 'order by last_call_time';} +if ($CAMP_callorder =~ /oldest_call_finish/i) {$agent_call_order = 'order by last_call_finish';} +if ($CAMP_callorder =~ /random/i) {$agent_call_order = 'order by random_id';} +if ($CAMP_callorder =~ /campaign_rank/i) {$agent_call_order = 'order by campaign_weight desc,last_call_finish';} +if ($CAMP_callorder =~ /fewest_calls/i) {$agent_call_order = 'order by calls_today,last_call_finish';} + + $rec_countWAIT=0; +$stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and server_ip='$VARserver_ip' and campaign_id = '$VDADcampaign' and call_time < \"$VDADcall_time\" and lead_id != '$VDADlead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $rec_countWAIT = "$aryA[0]"; + $rec_count++; + } +$sthA->finish(); +if ($DBconcurrent_transfers =~ /AUTO/) + { + $active_agents=1; + $stmtA = "SELECT count(*) FROM vicidial_live_agents where server_ip='$VARserver_ip' and campaign_id = '$VDADcampaign' and last_update_time > '$BDtsSQLdate';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $active_agents = "$aryA[0]"; + $rec_count++; + } + + $DBconcurrent_transfers = ($active_agents / 10); + $DBconcurrent_transfers = sprintf("%.0f", $DBconcurrent_transfers); + $DBconcurrent_transfers++; + if ($AGILOG) {$agi_string = "|CONCURRENT TRANSFERS AUTO SETTING: $DBconcurrent_transfers ($active_agents)|"; &agi_output;} + } +$sthA->finish(); +if ($rec_countWAIT < $DBconcurrent_transfers) + { + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$CIDlead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid' where status = 'READY' and server_ip='$VARserver_ip' and campaign_id='$VDADcampaign' and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD get agent: |$affected_rows|update of vla table: $VDADcampaign|$VARserver_ip\n|$stmtA|"; &agi_output;} + if ($affected_rows > 0) + { + $r=0; + $VDADuser=''; + while ( (length($VDADuser)<1) && ($r<3) ) + { + $stmtA = "SELECT conf_exten,user,extension FROM vicidial_live_agents where status IN('QUEUE','INCALL') and server_ip='$VARserver_ip' and campaign_id='$VDADcampaign' and callerid='$callerid' and channel='$channel' order by last_call_time limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VDADconf_exten = "$aryA[0]"; + $VDADuser = "$aryA[1]"; + $VDADextension = "$aryA[2]"; + $rec_count++; + } + $sthA->finish(); + $r++; + if ($r > 1) + { + if ($AGILOG) {$agi_string = "EEEEEEEEEE vla UPDATE DELAY!!! |$callerid|$r|"; &agi_output;} + + ### sleep for 23 hundredths of a second + usleep(1*230*1000); + $drop_timer = ($drop_timer + 0.25); + } + if ($r > 2) + { + $stmtA = "SELECT conf_exten,user,extension FROM vicidial_live_agents where callerid='$callerid' order by last_call_time limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VDADconf_exten = "$aryA[0]"; + $VDADuser = "$aryA[1]"; + $VDADextension = "$aryA[2]"; + $rec_count++; + } + $sthA->finish(); + + if ($AGILOG) {$agi_string = "FFFFFFFFFF vla OR SELECT |$callerid|$VDADuser|"; &agi_output;} + } + } + + $stmtA = "UPDATE vicidial_auto_calls set status='XFER', stage='XFER-$drop_timer' where callerid='$callerid';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD XFER : |$affected_rows|update of vac table: $callerid\n|$stmtA|"; &agi_output;} + + $stmtA = "UPDATE vicidial_list set status='XFER' where lead_id = '$CIDlead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vicidial_list update: |$affected_rows|$CIDlead_id|XFER\n|$stmtA|"; &agi_output;} + + $dbhA->disconnect(); + + if ($enable_queuemetrics_logging > 0) + { + $dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} + + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='$callerid',queue='$VDADcampaign',agent='Agent/$VDADuser',verb='CONNECT',data1='$drop_timer',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } + + if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $VDADconf_exten"; &agi_output;} + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $VDADconf_exten\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $now_date_epoch = time(); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + if ($AGILOG) {$agi_string = "XXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date"; &agi_output;} + + exit; + } + else + { + if ($AGILOG) {$agi_string = "NNNNNNNNNN No agent record found!!!"; &agi_output;} + } + } +else + { + if ($AGILOG) {$agi_string = "WWWWWWWW VDAD XFER WAIT: |$rec_countWAIT|$VDADcampaign|$channel|$callerid|$uniqueid|"; &agi_output;} + } + + +if ($hold_message_counter > 30) + { + $AGI->stream_file('generic_hold'); + $hold_message_counter = 0; + } + else {$hold_message_counter++;} +if ($hold_tone_counter > 3) + { + $AGI->stream_file('hold_tone'); + $hold_tone_counter = 0; + } + else {$hold_tone_counter++;} + +if ($drop_timer < 3) + { + ### sleep for 23 hundredths of a second + usleep(1*230*1000); + $drop_timer = ($drop_timer + 0.25); + } +else + { + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + + $drop_timer++; + } + +$stmtA = "UPDATE vicidial_auto_calls set stage='LIVE-$drop_timer' where callerid='$callerid';"; +$affected_rows = $dbhA->do($stmtA); +#if ($AGILOG) {$agi_string = "-- VDAD : |$affected_rows|update of vac table: $callerid\n|$stmtA|"; &agi_output;} + +} + + +if ($drop_timer >= $DROP_TIME) +{ +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $VDADvoicemail_ext = ''; + +$DROPexten = ''; +if ($drop_seconds < 1) + { + $drop_seconds = $DROP_TIME; + + if ($enable_queuemetrics_logging > 0) + { + $dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} + + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='$callerid',queue='$VDADcampaign',agent='NONE',verb='EXITWITHTIMEOUT',data1='1',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } + + if ($safe_harbor_message =~ /Y/) + { + $DROPexten = "$safe_harbor_exten"; + } + else + { + $stmtA = "SELECT voicemail_ext FROM vicidial_campaigns where campaign_id = '$VDADcampaign' limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VDADvoicemail_ext = "$aryA[0]"; + $VDADvoicemail_ext =~ s/\D//gi; + if (length($VDADvoicemail_ext)>0) + {$DROPexten = "$voicemail_dump_exten$VDADvoicemail_ext";} + $rec_count++; + } + $sthA->finish(); + } + } + + + ### use STDOUT to send call to proper DROP location + $VHqueryCID = "VH$CIDdate$VDADconf_exten"; + + if (length($DROPexten)>0) + { ### if DROP extension is defined then send the dropped call there instead of hangup + if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $DROPexten"; &agi_output;} + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $DROPexten\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + } + else + { + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$VARserver_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD call_hungup timout: |$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager"; &agi_output;} + } + + $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vac record deleted: |$affected_rows|$VDADcampaign|"; &agi_output;} + + $stmtA = "UPDATE vicidial_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where uniqueid = '$uniqueid';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vicidial_log update: |$affected_rows|$uniqueid"; &agi_output;} + + $stmtA = "UPDATE vicidial_list set status='DROP' where lead_id = '$CIDlead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vicidial_list update: |$affected_rows|$CIDlead_id"; &agi_output;} +} + +} ### end if pressed 1,2,3 or 0 + + + + + +else ### user pressed 8 to not be contacted again +{ + +$AGI->stream_file('US_thanks_no_contact'); + +$stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;"; + $affected_rows = $dbhA->do($stmtA); +if ($AGILOG) {$agi_string = "-- VDAD vac record deleted: |$affected_rows|$VDADcampaign|"; &agi_output;} + +$stmtA = "UPDATE vicidial_log set status='DNC',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where uniqueid = '$uniqueid';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); +if ($AGILOG) {$agi_string = "-- VDAD vicidial_log update: DNC|$affected_rows|$uniqueid"; &agi_output;} + +$stmtA = "UPDATE vicidial_list set status='DNC' where lead_id = '$CIDlead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); +if ($AGILOG) {$agi_string = "-- VDAD vicidial_list update: DNC|$affected_rows|$CIDlead_id"; &agi_output;} + + +exit; +} + + $dbhA->disconnect(); + + + +exit; + +sub enter_pin_number +{ +$digit=''; +undef $digit; +$interrupt_digit=''; +undef $interrupt_digit; + +# Hello, we are conducting a simple survery today, if you are a voter and registered as a Democrat, please press 1. If you are registered as a Republican, please press 2. If you are registered as an Independant or other party please press 3. If you do not want to be contacted again, please press 8. + +$interrupt_digit = $AGI->stream_file('US_pol_survey_hello','123456789'); + + if ($AGILOG) {$agi_string = "interrupt_digit |$interrupt_digit|"; &agi_output;} + +$digits_being_entered=1; +$digit_loop_counter=0; +$totalDTMF=''; +if ($interrupt_digit > 1) + { + if ($interrupt_digit == 48) {$interrupt_digit=0;} + if ($interrupt_digit == 49) {$interrupt_digit=1;} + if ($interrupt_digit == 50) {$interrupt_digit=2;} + if ($interrupt_digit == 51) {$interrupt_digit=3;} + if ($interrupt_digit == 52) {$interrupt_digit=4;} + if ($interrupt_digit == 53) {$interrupt_digit=5;} + if ($interrupt_digit == 54) {$interrupt_digit=6;} + if ($interrupt_digit == 55) {$interrupt_digit=7;} + if ($interrupt_digit == 56) {$interrupt_digit=8;} + if ($interrupt_digit == 57) {$interrupt_digit=9;} + + $totalDTMF=$interrupt_digit; + $digit_loop_counter++; + } + + +while ($digit_loop_counter < 1) + { + $digit = chr($AGI->wait_for_digit('2000')); # wait 0.2 seconds for input or until the pound key is pressed + if ($digit =~ /\d/) + { + $totalDTMF = "$totalDTMF$digit"; + if ($AGILOG) {$agi_string = "digit |$digit| TotalDTMF |$totalDTMF|"; &agi_output;} +# $AGI->say_digits("$digit"); + undef $digit; + } + else + { + $digit_loop_counter=1; + } + + $digit_loop_counter++; + } + +$totalDTMF =~ s/\D//gi; +$pin = $totalDTMF; +if ($totalDTMF) + { + if ($AGILOG) {$agi_string = "digit |$digit| TotalDTMF |$totalDTMF|"; &agi_output;} + } +} + + + + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} + + + +### Hello, you've been chosen to receive a great deal on travel to Florida, if you are insterested please press one on your phone now,,,,,If you would not like to be contacted again please press 2 + + + +sub agi_output +{ +if ($AGILOG >=2) + { + ### open the log file for writing ### + open(Lout, ">>$AGILOGfile") + || die "Can't open $AGILOGfile: $!\n"; + print Lout "$now_date|$script|$agi_string\n"; + close(Lout); + } + ### send to STDERR writing ### +if ( ($AGILOG == '1') || ($AGILOG == '3') ) + {print STDERR "$now_date|$script|$agi_string\n";} +$agi_string=''; +} diff --git a/agc_2-X/branches/agc_2.0.4/agi/agi-VDADtransferTEST.agi b/agc_2-X/branches/agc_2.0.4/agi/agi-VDADtransferTEST.agi new file mode 100644 index 00000000..83afbdd9 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/agi/agi-VDADtransferTEST.agi @@ -0,0 +1,779 @@ +#!/usr/bin/perl +# +# agi-VDADtransferTEST.agi version 2.0.4 *DBI-version* +# +# !!! This is only to be used for performance testing setups !!! +# +# runs when a call comes in from the VICIDIAL_auto_dialer. This script will +# send the calls out to the reps that are logged in. +# +# if there are no available agents, then it will check every second until an agent becomes available, +# if at the end of 10 seconds(default) it has not found an agent it will hangup the call and mark it as dropped +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ;VICIDIAL_auto_dialer transfer script: +# exten => 8365,1,AGI(call_log.agi,${EXTEN}) +# exten => 8365,2,AGI(agi-VDADtransfer.agi,${EXTEN}) +# +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# +# CHANGELOG: +# 50322-1246 - Changed callerid handling to allow for custom callerid +# 60119-1408 - Fixed calleridname issue with 1.2 tree for custom CID +# 60503-1054 - Added safe harbor and drop second options from campaign +# 60731-1441 - Changed to use DBI-DBD::mysql +# - Changed to use /etc/astguiclient.conf for configs +# 60816-1036 - Added output options check from database +# - Changed look for agent every 0.5 second for first 4 sec on hold +# 60905-1047 - Changed look for agent every 0.25 second for first 4 sec on hold +# 70215-1052 - Added QueueMetrics optional logging +# 70223-1100 - Added QueueMetrics ENTERQUEUE prepend option +# 70305-1251 - Fixed problems where the same call will run this script twice +# 71116-1045 - added fewest_calls and campaign_weight agent call routing options +# + +$script = 'agi-VDADtransfer.agi'; + +$DROP_TIME = 10; # default number of seconds to wait until you drop a waiting call + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +if (!$VARDB_port) {$VARDB_port='3306';} +if (!$AGILOGfile) {$AGILOGfile = "$PATHlogs/agiout.$year-$mon-$mday";} + +use DBI; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### Grab Server values from the database +$stmtA = "SELECT voicemail_dump_exten,ext_context,answer_transfer_agent,local_gmt,asterisk_version,max_vicidial_trunks,agi_output FROM servers where server_ip = '$VARserver_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBvoicemail_dump_exten = "$aryA[0]"; + $DBext_context = "$aryA[1]"; + $DBanswer_transfer_agent = "$aryA[2]"; + $DBSERVER_GMT = "$aryA[3]"; + $DBasterisk_version = "$aryA[4]"; + $DBmax_vicidial_trunks = "$aryA[5]"; + $DBagi_output = "$aryA[6]"; + if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;} + if ($DBext_context) {$ext_context = $DBext_context;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';} + if ($DBagi_output =~ /FILE/) {$AGILOG = '2';} + if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';} + $rec_count++; + } +$sthA->finish(); + +$start_time=$now_date; +$CIDdate = "$mon$mday$hour$min$sec"; +$tsSQLdate = "$year$mon$mday$hour$min$sec"; +$SQLdate = "$year-$mon-$mday $hour:$min:$sec"; +$SQLdateBEGIN = $SQLdate; + +$secX = time(); +$BDtarget = ($secX - 5); +($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); +$Byear = ($Byear + 1900); +$Bmon++; +if ($Bmon < 10) {$Bmon = "0$Bmon";} +if ($Bmday < 10) {$Bmday = "0$Bmday";} +if ($Bhour < 10) {$Bhour = "0$Bhour";} +if ($Bmin < 10) {$Bmin = "0$Bmin";} +if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + if ($AGILOG) {$agi_string = "Perl Environment Dump:"; &agi_output;} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($AGILOG) {$agi_string = "$i|$ARGV[$i]"; &agi_output;} + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} + +$|=1; +while() +{ + chomp; + last unless length($_); + if ($AGILOG) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_priority\:\s+(.*)$/) {$priority = $1;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} +} + +if ( (length($callerid)>20) && ($callerid =~ /\"\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S/) ) + { + $callerid =~ s/^\"//gi; + $callerid =~ s/\".*$//gi; + ### set the callerid to the ACQS value(calleridname) + print "SET CALLERID $callerid\n"; + checkresult($result); + if ($AGILOG) {$agi_string = "callerID changed: $callerid"; &agi_output;} + } +if ( ( +(length($calleridname)>5) && ( (!$callerid) or ($callerid =~ /unknown|private|00000000/i) or ($callerid =~ /5551212/) ) +) or ( (length($calleridname)>17) && ($calleridname =~ /\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/) ) ) + { + $callerid = $calleridname; + ### set the callerid to the ACQS value(calleridname) + print "SET CALLERID $callerid\n"; + checkresult($result); + if ($AGILOG) {$agi_string = "callerID changed: $callerid"; &agi_output;} + } + + +if ($AGILOG) {$agi_string = "AGI Environment Dump:"; &agi_output;} + +foreach $i (sort keys %AGI) +{ + if ($AGILOG) {$agi_string = " -- $i = $AGI{$i}"; &agi_output;} +} + +if ($AGILOG) {$agi_string = "AGI Variables: |$unique_id|$channel|$extension|$type|$callerid|$calleridname|$priority|"; &agi_output;} + +$VDADcampaign=''; +$VDADphone=''; +$VDADphone_code=''; + +$callerid =~ s/\"//gi; +$CIDlead_id = $callerid; +$CIDlead_id = substr($CIDlead_id, 11, 9); +$CIDlead_id = ($CIDlead_id + 0); + +if ($AGILOG) {$agi_string = "+++++ VDAD START : |$CIDlead_id|$now_date|$AST_ver|$priority|"; &agi_output;} + +if ( ($channel =~ /Local/i) && ($AST_ver !~ /^1\.0\.8|^1\.0\.9/) ) +{ +if ($AGILOG) {$agi_string = "+++++ VDAD START LOCAL CHANNEL: EXITING- $priority"; &agi_output;} +if ($priority > 2) {sleep(1);} +exit; +} + +$stmtA = "SELECT count(*) FROM vicidial_live_agents where callerid='$callerid';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $Pseudo_duplicate_count = "$aryA[0]"; + $rec_count++; + } +$sthA->finish(); + +if ($Pseudo_duplicate_count > 0) +{ +if ($AGILOG) {$agi_string = "+++++ VDAD START PSEUDO DUPLICATE: EXITING- $priority"; &agi_output;} +exit; +} + +$stmtA = "SELECT count(*) FROM vicidial_auto_calls where callerid='$callerid' and status IN('LIVE','XFER');"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $dialplan_duplicate_count = "$aryA[0]"; + $rec_count++; + } +$sthA->finish(); + +if ($dialplan_duplicate_count > 0) +{ +if ($AGILOG) {$agi_string = "+++++ VDAD START DIALPLAN DUPLICATE: EXITING- $priority"; &agi_output;} +exit; +} + + + +### Grab call parameters from vicidial_auto_calls table +$stmtA = "UPDATE vicidial_auto_calls set uniqueid='$unique_id', channel='$channel',status='LIVE',stage='LIVE-0' where callerid='$callerid' order by call_time desc limit 1;"; +$affected_rows = $dbhA->do($stmtA); +if ($AGILOG) {$agi_string = "-- VDAD : |$affected_rows|update of vac table: $callerid\n|$stmtA|"; &agi_output;} +if ($affected_rows > 0) + { + $stmtA = "SELECT campaign_id,phone_number,phone_code,lead_id,call_time FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VDADcampaign = "$aryA[0]"; + $VDADphone = "$aryA[1]"; + $VDADphone_code = "$aryA[2]"; + $VDADlead_id = "$aryA[3]"; + $VDADcall_time = "$aryA[4]"; + $rec_count++; + } + $sthA->finish(); + + ### Grab campaign values from the database + $stmtA = "SELECT drop_call_seconds,safe_harbor_message,safe_harbor_exten,concurrent_transfers FROM vicidial_campaigns where campaign_id = '$VDADcampaign';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBdrop_call_seconds = "$aryA[0]"; + $DBsafe_harbor_message = "$aryA[1]"; + $DBsafe_harbor_exten = "$aryA[2]"; + $DBconcurrent_transfers = "$aryA[3]"; + if ($DBdrop_call_seconds) {$DROP_TIME = $DBdrop_call_seconds;} + if ($DBsafe_harbor_message) {$safe_harbor_message = $DBsafe_harbor_message;} + if ($DBsafe_harbor_exten) {$safe_harbor_exten = $DBsafe_harbor_exten;} + $rec_count++; + } + $sthA->finish(); + + $stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$uniqueid','$CIDlead_id','$VDADcampaign','$SQLdate','$now_date_epoch','QUEUE','$VDADphone_code','$VDADphone','VDAD','N')"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + + if ($AGILOG) {$agi_string = "-- VDAD : |$VDADlead_id|$CIDlead_id|insert to vicidial_log: $uniqueid"; &agi_output;} + + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_eq_prepend FROM system_settings;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $enable_queuemetrics_logging = "$aryA[0]"; + $queuemetrics_server_ip = "$aryA[1]"; + $queuemetrics_dbname = "$aryA[2]"; + $queuemetrics_login= "$aryA[3]"; + $queuemetrics_pass = "$aryA[4]"; + $queuemetrics_log_id = "$aryA[5]"; + $queuemetrics_eq_prepend = "$aryA[6]"; + $rec_count++; + } + $sthA->finish(); + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + $stmtA = "SELECT phone_number FROM vicidial_auto_calls where lead_id='$CIDlead_id';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $phone_number = "$aryA[0]"; + $rec_count++; + $data2 = "$phone_number"; + } + $sthA->finish(); + + if ( (length($queuemetrics_eq_prepend) > 0) && ($queuemetrics_eq_prepend !~ /NONE/) ) + { + $stmtA = "SELECT $queuemetrics_eq_prepend FROM vicidial_list where lead_id='$CIDlead_id';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + $DASH='-'; + @aryA = $sthA->fetchrow_array; + $QMprepend = "$aryA[0]"; + $rec_count++; + $data2 = "$QMprepend$DASH$phone_number"; + } + $sthA->finish(); + } + + $dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} + + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='$callerid',queue='$VDADcampaign',agent='NONE',verb='ENTERQUEUE',data2='$data2',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } + } + +$drop_timer=0; +$drop_seconds=0; +$hold_message_counter=25; +$hold_tone_counter=0; + +while ($drop_timer <= $DROP_TIME) +{ +$channel_status = $AGI->channel_status("$channel"); +if ($channel_status < 1) + { + if ($AGILOG) {$agi_string = "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer CHECKING AGAIN"; &agi_output;} + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + + $channel_status_DC = $AGI->channel_status("$channel"); + + if ($channel_status_DC < 1) + { + if ($AGILOG) {$agi_string = "CHANNEL $channel DOWN $channel_status $DROP_TIME|$drop_timer"; &agi_output;} + if ($drop_timer < $DROP_TIME) {$drop_seconds = $drop_timer;} + $drop_timer = ($drop_timer + $DROP_TIME); + } + } +$stmtA = "SELECT next_agent_call FROM vicidial_campaigns where campaign_id='$VDADcampaign';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $CAMP_callorder = "$aryA[0]"; + $rec_count++; + } +$sthA->finish(); + +$agent_call_order=''; +if ($CAMP_callorder =~ /overall_user_level/i) {$agent_call_order = 'order by user_level desc,last_call_finish';} +if ($CAMP_callorder =~ /oldest_call_start/i) {$agent_call_order = 'order by last_call_time';} +if ($CAMP_callorder =~ /oldest_call_finish/i) {$agent_call_order = 'order by last_call_finish';} +if ($CAMP_callorder =~ /random/i) {$agent_call_order = 'order by random_id';} +if ($CAMP_callorder =~ /campaign_rank/i) {$agent_call_order = 'order by campaign_weight desc,last_call_finish';} +if ($CAMP_callorder =~ /fewest_calls/i) {$agent_call_order = 'order by calls_today,last_call_finish';} + + $rec_countWAIT=0; +$stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and server_ip='$VARserver_ip' and campaign_id = '$VDADcampaign' and call_time < \"$VDADcall_time\" and lead_id != '$VDADlead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + $rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $rec_countWAIT = "$aryA[0]"; + $rec_count++; + } +$sthA->finish(); +if ($DBconcurrent_transfers =~ /AUTO/) + { + $active_agents=1; + $stmtA = "SELECT count(*) FROM vicidial_live_agents where server_ip='$VARserver_ip' and campaign_id = '$VDADcampaign' and last_update_time > '$BDtsSQLdate';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $active_agents = "$aryA[0]"; + $rec_count++; + } + + $DBconcurrent_transfers = ($active_agents / 10); + $DBconcurrent_transfers = sprintf("%.0f", $DBconcurrent_transfers); + $DBconcurrent_transfers++; + if ($AGILOG) {$agi_string = "|CONCURRENT TRANSFERS AUTO SETTING: $DBconcurrent_transfers ($active_agents)|"; &agi_output;} + } +$sthA->finish(); +if ($rec_countWAIT < $DBconcurrent_transfers) + { + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$CIDlead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid' where status = 'READY' and server_ip='$VARserver_ip' and campaign_id='$VDADcampaign' and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD get agent: |$affected_rows|update of vla table: $VDADcampaign|$VARserver_ip\n|$stmtA|"; &agi_output;} + if ($affected_rows > 0) + { + $r=0; + $VDADuser=''; + while ( (length($VDADuser)<1) && ($r<3) ) + { + $stmtA = "SELECT conf_exten,user,extension FROM vicidial_live_agents where status IN('QUEUE','INCALL') and server_ip='$VARserver_ip' and campaign_id='$VDADcampaign' and callerid='$callerid' and channel='$channel' order by last_call_time limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VDADconf_exten = "$aryA[0]"; + $VDADuser = "$aryA[1]"; + $VDADextension = "$aryA[2]"; + $rec_count++; + } + $sthA->finish(); + $r++; + if ($r > 1) + { + if ($AGILOG) {$agi_string = "EEEEEEEEEE vla UPDATE DELAY!!! |$callerid|$r|"; &agi_output;} + + ### sleep for 23 hundredths of a second + usleep(1*230*1000); + $drop_timer = ($drop_timer + 0.25); + } + if ($r > 2) + { + $stmtA = "SELECT conf_exten,user,extension FROM vicidial_live_agents where callerid='$callerid' order by last_call_time limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VDADconf_exten = "$aryA[0]"; + $VDADuser = "$aryA[1]"; + $VDADextension = "$aryA[2]"; + $rec_count++; + } + $sthA->finish(); + + if ($AGILOG) {$agi_string = "FFFFFFFFFF vla OR SELECT |$callerid|$VDADuser|"; &agi_output;} + } + } + + $stmtA = "UPDATE vicidial_auto_calls set status='XFER', stage='XFER-$drop_timer' where callerid='$callerid';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD XFER : |$affected_rows|update of vac table: $callerid\n|$stmtA|"; &agi_output;} + + $stmtA = "UPDATE vicidial_list set status='PU' where lead_id='$CIDlead_id';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD TEST : |$affected_rows|update of vl table: $CIDlead_id\n|$stmtA|"; &agi_output;} + + $dbhA->disconnect(); + + if ($enable_queuemetrics_logging > 0) + { + $dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} + + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='$callerid',queue='$VDADcampaign',agent='Agent/$VDADuser',verb='CONNECT',data1='$drop_timer',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } + + if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $VDADconf_exten"; &agi_output;} + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $VDADconf_exten\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $now_date_epoch = time(); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + if ($AGILOG) {$agi_string = "XXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date"; &agi_output;} + + exit; + } + else + { + if ($AGILOG) {$agi_string = "NNNNNNNNNN No agent record found!!!"; &agi_output;} + } + } +else + { + if ($AGILOG) {$agi_string = "WWWWWWWW VDAD XFER WAIT: |$rec_countWAIT|$VDADcampaign|$channel|$callerid|$uniqueid|"; &agi_output;} + } + + +if ($drop_timer < 3) + { + ### sleep for 23 hundredths of a second + usleep(1*230*1000); + $drop_timer = ($drop_timer + 0.25); + } +else + { + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + + $drop_timer++; + } + +$stmtA = "UPDATE vicidial_auto_calls set stage='LIVE-$drop_timer' where callerid='$callerid';"; +$affected_rows = $dbhA->do($stmtA); +#if ($AGILOG) {$agi_string = "-- VDAD : |$affected_rows|update of vac table: $callerid\n|$stmtA|"; &agi_output;} + +} + + +if ($drop_timer >= $DROP_TIME) +{ +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $VDADvoicemail_ext = ''; + +$DROPexten = ''; +if ($drop_seconds < 1) + { + $drop_seconds = $DROP_TIME; + + if ($enable_queuemetrics_logging > 0) + { + $dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} + + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='$callerid',queue='$VDADcampaign',agent='NONE',verb='EXITWITHTIMEOUT',data1='1',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } + + if ($safe_harbor_message =~ /Y/) + { + $DROPexten = "$safe_harbor_exten"; + } + else + { + $stmtA = "SELECT voicemail_ext FROM vicidial_campaigns where campaign_id = '$VDADcampaign' limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VDADvoicemail_ext = "$aryA[0]"; + $VDADvoicemail_ext =~ s/\D//gi; + if (length($VDADvoicemail_ext)>0) + {$DROPexten = "$voicemail_dump_exten$VDADvoicemail_ext";} + $rec_count++; + } + $sthA->finish(); + } + } + + + ### use STDOUT to send call to proper DROP location + $VHqueryCID = "VH$CIDdate$VDADconf_exten"; + + if (length($DROPexten)>0) + { ### if DROP extension is defined then send the dropped call there instead of hangup + if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $DROPexten"; &agi_output;} + print "SET CONTEXT $ext_context\n"; + checkresult($result); + print "SET EXTENSION $DROPexten\n"; + checkresult($result); + print "SET PRIORITY 1\n"; + checkresult($result); + } + else + { + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$VARserver_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD call_hungup timout: |$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager"; &agi_output;} + } + + $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vac record deleted: |$affected_rows|$VDADcampaign|"; &agi_output;} + + $stmtA = "UPDATE vicidial_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where uniqueid = '$uniqueid';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vicidial_log update: |$affected_rows|$uniqueid"; &agi_output;} + + $stmtA = "UPDATE vicidial_list set status='DROP' where lead_id = '$CIDlead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vicidial_list update: |$affected_rows|$CIDlead_id"; &agi_output;} +} + + + + $dbhA->disconnect(); + + + +exit; + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + # print STDERR "FAIL ($res)\n"; + $fail++; + } else { + # print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + # print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} + + + +sub agi_output +{ +if ($AGILOG >=2) + { + ### open the log file for writing ### + open(Lout, ">>$AGILOGfile") + || die "Can't open $AGILOGfile: $!\n"; + print Lout "$now_date|$script|$agi_string\n"; + close(Lout); + } + ### send to STDERR writing ### +if ( ($AGILOG == '1') || ($AGILOG == '3') ) + {print STDERR "$now_date|$script|$agi_string\n";} +$agi_string=''; +} diff --git a/agc_2-X/branches/agc_2.0.4/agi/agi-dtmf.agi b/agc_2-X/branches/agc_2.0.4/agi/agi-dtmf.agi new file mode 100644 index 00000000..91cbf375 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/agi/agi-dtmf.agi @@ -0,0 +1,98 @@ +#!/usr/bin/perl +# +# agi-dtmf.agi - script for playing DTMF tones received as the callerid field +# +# DTMF sound files must be in /var/lib/asterisk/sounds for this to work +# +# Accepted values are: 1 2 3 4 5 6 7 8 9 0 # * , +# comma means pause for 1 second +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# + +$|=1; +while() { + chomp; + last unless length($_); + if (/^agi_(\w+)\:\s+(.*)$/) { + $AGI{$1} = $2; + } + if (/^agi_callerid\:\s+(.*)$/) {$caller_id = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$caller_idname = $1;} +} + +print STDERR "AGI Environment Dump:\n"; +foreach $i (sort keys %AGI) { + print STDERR " -- $i = $AGI{$i}\n"; +} + +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second + +use Asterisk::AGI; +my $agi = new Asterisk::AGI; + +my $clid = $agi->get_variable('CALLERID'); +my $clidname = $agi->get_variable('CALLERIDNAME'); + +print STDERR "X. |$clid|$caller_id|$clidname|\n"; + + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + print STDERR "FAIL ($res)\n"; + $fail++; + } else { + print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} + +### sleep for 5 tenths of a second +usleep(1*500*1000); + +print "STREAM FILE silence \"\"\n"; + +$caller_id = "$caller_id$caller_idname"; + +@CALLERID_DIGITS = split(//, $caller_id); + +foreach (@CALLERID_DIGITS) +{ + +if ($CALLERID_DIGITS[$g] =~ /\d/) + { + print "STREAM FILE $CALLERID_DIGITS[$g] \"\"\n"; + print STDERR "DIGIT: $CALLERID_DIGITS[$g]\n"; + } +else + { + if ($CALLERID_DIGITS[$g] =~ /\#/) {print "STREAM FILE hash \"\"\n";} + if ($CALLERID_DIGITS[$g] =~ /\*/) {print "STREAM FILE star \"\"\n";} + if ($CALLERID_DIGITS[$g] =~ /\,/) {sleep(1);} + print STDERR "NON-DIGIT: $CALLERID_DIGITS[$g]\n"; + } +$g++; + +### sleep for 20 hundredths of a second +usleep(1*150*1000); + +print "STREAM FILE silence \"\"\n"; + +### sleep for 10 hundredths of a second +usleep(1*100*1000); +} + +print "STREAM FILE silence \"\"\n"; +$result = ; +checkresult($result); + diff --git a/agc_2-X/branches/agc_2.0.4/agi/agi-record_prompts.agi b/agc_2-X/branches/agc_2.0.4/agi/agi-record_prompts.agi new file mode 100644 index 00000000..c54d0643 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/agi/agi-record_prompts.agi @@ -0,0 +1,408 @@ +#!/usr/bin/perl +# +# agi-record_prompts.agi version 0.2 +# +# for recording prompts to GSM file over the phone +# Saves recordings with 8-digit filenames to be played when exten is dialed +# +# ; prompt recording AGI script, ID is 4321 +# exten => 8168,1,Answer +# exten => 8168,2,AGI(agi-record_prompts.agi) +# exten => 8168,3,Hangup +# +# ; playback of recorded prompts +# exten => _851XXXXX,1,Answer +# exten => _851XXXXX,2,Playback(${EXTEN}) +# exten => _851XXXXX,3,Hangup +# +# GSM Sound Files used: +# - ld_welcome_pin_number +# - ld_invalid_pin_number +# - vm-rec-generic +# - auth-thankyou +# - vm-review +# - vm-msgsaved +# - vm-goodbye +# + +$US='_'; + +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + +$|=1; +while() { + chomp; + last unless length($_); + if ($V) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1;} + +} + + +$unique_id_out = $unique_id; +@NEW_ID = split(/\./, $unique_id_out); +$NEW_ID_DIF = '.0'; +$unique_id_out = "$NEW_ID[0]$NEW_ID_DIF$NEW_ID[1]"; + +$pin=''; +$stop_loop=0; +$quit_program=0; +$loop_counter=0; +$REC_id = 85100000; +$REC_next = 0; + +if (-e "/prompt_count.txt") +{ + open(test, "/prompt_count.txt") || die "can't open /prompt_count.txt: $!\n"; + @test = ; + close(test); + + $REC_next = ($test[0] + 1); + $REC_id = ($REC_id + $REC_next); + + open(test, ">/prompt_count.txt") || die "can't open /prompt_count.txt: $!\n"; + print test "$REC_next"; + close(test); +} +else +{ + open(test, ">/prompt_count.txt") || die "can't open /prompt_count.txt: $!\n"; + print test "1"; + close(test); + $REC_id = ($REC_id + 1); +} + +$session_recording = "$REC_id"; +print STDERR "Recording ID: $REC_id\n"; + +&welcome_1; + + + + + +print STDERR "DONE Exiting...\n"; +exit; + + + + + +##### SUBROUTINES ######################################################## +##### steps ######################################################## + +sub welcome_1 +{ +##### Play welcome message and capture PIN ######################################################## +while ( (length($pin) ne 4) && (!$stop_loop) ) + { + &enter_pin_number; + &log_transfer; + + + $loop_counter++; + if ($loop_counter > 3) {$stop_loop++; $quit_program++;} + print STDERR "\nPIN|$pin|\n"; + + } + + +##### Check PIN account in database ######################################################## +$rec_count=0; + &lookup_account; +if (!$rec_count) + { + # please enter the pin number followed by the pound key + + $AGI->stream_file('ld_invalid_pin_number'); + + $quit_program++; + } + + +##### quit program if error ######################################################## +if ($quit_program) + { + print STDERR "\nexiting the ping app\n"; + print "SET CONTEXT demo\n"; + checkresult($result); + print "SET EXTENSION 8158\n"; + checkresult($result); + print "SET PRIORITY 3\n"; + checkresult($result); + exit; + } + +&record_prompts; + + + +} + + + + + + +sub record_prompts +{ +$AGI->stream_file('beep'); +print STDERR "\nrecord_prompts AGI welcome\n"; +$AGI->stream_file('vm-rec-generic'); +$AGI->stream_file('beep'); + +$digit=''; +$interrupt_digit=''; + +$interrupt_digit = $AGI->record_file("$session_recording", 'gsm', '123456789*#', 360000, 1); + + print STDERR "interrupt_digit |$interrupt_digit|\n"; + +$digits_being_entered=1; +$digit_loop_counter=0; +$totalDTMF=''; +if ($interrupt_digit > 1) + { + if ($interrupt_digit == 35) {$interrupt_digit='#';} + if ($interrupt_digit == 42) {$interrupt_digit='*';} + if ($interrupt_digit == 48) {$interrupt_digit=0;} + if ($interrupt_digit == 49) {$interrupt_digit=1;} + if ($interrupt_digit == 50) {$interrupt_digit=2;} + if ($interrupt_digit == 51) {$interrupt_digit=3;} + if ($interrupt_digit == 52) {$interrupt_digit=4;} + if ($interrupt_digit == 53) {$interrupt_digit=5;} + if ($interrupt_digit == 54) {$interrupt_digit=6;} + if ($interrupt_digit == 55) {$interrupt_digit=7;} + if ($interrupt_digit == 56) {$interrupt_digit=8;} + if ($interrupt_digit == 57) {$interrupt_digit=9;} + + $totalDTMF=$interrupt_digit; + $digit_loop_counter++; + } + +$AGI->stream_file('beep'); + +if (length($totalDTMF) > 0) {print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n";} + +&verify_recording; + +} + + + + + +sub verify_recording +{ +$digit=''; +$interrupt_digit=''; + +$interrupt_digit = $AGI->stream_file('vm-review','123456789'); + + print STDERR "interrupt_digit |$interrupt_digit|\n"; + +$digits_being_entered=1; +$digit_loop_counter=0; +$totalDTMF=''; +if ($interrupt_digit > 1) + { + if ($interrupt_digit == 35) {$interrupt_digit='#';} + if ($interrupt_digit == 42) {$interrupt_digit='*';} + if ($interrupt_digit == 48) {$interrupt_digit=0;} + if ($interrupt_digit == 49) {$interrupt_digit=1;} + if ($interrupt_digit == 50) {$interrupt_digit=2;} + if ($interrupt_digit == 51) {$interrupt_digit=3;} + if ($interrupt_digit == 52) {$interrupt_digit=4;} + if ($interrupt_digit == 53) {$interrupt_digit=5;} + if ($interrupt_digit == 54) {$interrupt_digit=6;} + if ($interrupt_digit == 55) {$interrupt_digit=7;} + if ($interrupt_digit == 56) {$interrupt_digit=8;} + if ($interrupt_digit == 57) {$interrupt_digit=9;} + + $totalDTMF=$interrupt_digit; + $digit_loop_counter++; + } + + +while ($digit_loop_counter < 1) + { + $digit = chr($AGI->wait_for_digit('2000000')); # wait 0.2 seconds for input or until the pound key is pressed + if ($digit =~ /\d/) + { + $totalDTMF = "$totalDTMF$digit"; + print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n"; +# $AGI->say_digits("$digit"); + undef $digit; + } + else + { + $digit_loop_counter=1; + } + + $digit_loop_counter++; + } + +$totalDTMF =~ s/\D//gi; +$pin = $totalDTMF; + +if (length($pin)< 1) + { + &verify_recording; + } +else + { + if ($pin == '1') + { + $AGI->stream_file('auth-thankyou'); + $AGI->say_digits("$REC_id"); + $AGI->stream_file('beep'); + $AGI->say_digits("$REC_id"); + $AGI->stream_file('vm-goodbye'); + exit; + } + if ($pin == '2') + { + $AGI->stream_file("$session_recording"); + &verify_recording; + } + if ($pin == '3') + { + &record_prompts; + } + + } +} + + + + + +##### SUBROUTINES PROCESSES ######################################################## + +sub log_transfer +{ + +} + + + + + +sub lookup_account +{ + + if ($pin eq '4321') + { + $rec_count++; + } + + +} + + + + + +sub get_time_now #get the current date and time and epoch for logging call lengths and datetimes +{ +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +} + + + + + +sub enter_pin_number +{ +# please enter the pin number followed by the pound key + +$interrupt_digit=''; + +$interrupt_digit = $AGI->stream_file('ld_welcome_pin_number','123456789'); + + print STDERR "interrupt_digit |$interrupt_digit|\n"; + +$digits_being_entered=1; +$totalDTMF=''; +if ($interrupt_digit > 0) + { + if ($interrupt_digit == 48) {$interrupt_digit=0;} + if ($interrupt_digit == 49) {$interrupt_digit=1;} + if ($interrupt_digit == 50) {$interrupt_digit=2;} + if ($interrupt_digit == 51) {$interrupt_digit=3;} + if ($interrupt_digit == 52) {$interrupt_digit=4;} + if ($interrupt_digit == 53) {$interrupt_digit=5;} + if ($interrupt_digit == 54) {$interrupt_digit=6;} + if ($interrupt_digit == 55) {$interrupt_digit=7;} + if ($interrupt_digit == 56) {$interrupt_digit=8;} + if ($interrupt_digit == 57) {$interrupt_digit=9;} + + $totalDTMF=$interrupt_digit; + } + +$digit_loop_counter=0; +while ( ($digits_being_entered) && ($digit_loop_counter < 20) ) + { + $digit = chr($AGI->wait_for_digit('90000')); # wait 90 seconds for input or until the pound key is pressed + if ($digit =~ /\d/) + { + $totalDTMF = "$totalDTMF$digit"; + print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n"; +# $AGI->say_digits("$digit"); + undef $digit; + } + else + { + $digits_being_entered=0; + } + + $digit_loop_counter++; + } + +$totalDTMF =~ s/\D//gi; +$pin = $totalDTMF; +if ($totalDTMF) {print STDERR "digit |$digit| TotalDTMF |$totalDTMF|\n";} +} + + + + + + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + print STDERR "FAIL ($res)\n"; + $fail++; + } else { + print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} diff --git a/agc_2-X/branches/agc_2.0.4/agi/call_inbound.agi b/agc_2-X/branches/agc_2.0.4/agi/call_inbound.agi new file mode 100644 index 00000000..f3477c03 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/agi/call_inbound.agi @@ -0,0 +1,292 @@ +#!/usr/bin/perl +# +# call_inbound.agi version 0.3 *DBI-version* +# +# runs at the beginning and ending of every inbound call received +# +# You need to put lines similar to those below in your extensions.conf file: +# +# parameters for call_inbound.agi (7 fields separated by five dashes "-----"): +# 1. the extension of the phone to ring as defined in the asterisk.phones table +# 2. the phone number that was called, for the live_inbound/_log entry +# 3. a text description of the number that was called in +# 4-7. optional fields, they are also passed as fields in the GUI to web browser +# +# ;inbound calls: +#exten => _*NXXNXXXXXX*3429,3,AGI(call_inbound.agi,spa2000-----8005553429-----Inbound 800-----x-----y-----z-----w) +# +# +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# changes: +# 60731-1435 - changed to use DBI-DBD::mysql +# - changed to use /etc/astguiclient.conf for configs +# 60817-1102 - added output options check from database +# + +$script = 'call_inbound.agi'; + +$US='_'; +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$Y = substr($year, 0, 1); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$filedate = "$US$Y$mon$mday$hour$min$sec$US"; + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +if (!$VARDB_port) {$VARDB_port='3306';} +if (!$AGILOGfile) {$AGILOGfile = "$PATHlogs/agiout.$year-$mon-$mday";} + +use DBI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### Grab Server values from the database +$stmtA = "SELECT agi_output FROM servers where server_ip = '$VARserver_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + $AGILOG = '0'; + @aryA = $sthA->fetchrow_array; + $DBagi_output = "$aryA[0]"; + if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';} + if ($DBagi_output =~ /FILE/) {$AGILOG = '2';} + if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';} + $rec_count++; + } +$sthA->finish(); + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + if ($AGILOG) {$agi_string = "Perl Environment Dump:"; &agi_output;} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($AGILOG) {$agi_string = "$i|$ARGV[$i]"; &agi_output;} + $i++; + } + + ### list of command-line array arguments: + @ARGV_vars = split(/-----/, $ARGV[0]); + + $phone_ext = $ARGV_vars[0]; + $inbound_number = $ARGV_vars[1]; + $comment_a = $ARGV_vars[2]; + $comment_b = $ARGV_vars[3]; + $comment_c = $ARGV_vars[4]; + $comment_d = $ARGV_vars[5]; + $comment_e = $ARGV_vars[6]; + + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} + +$|=1; +while() { + chomp; + last unless length($_); + if ($AGILOG) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} + if ( $calleridname =~ /\"/) {$calleridname =~ s/\"//gi;} + if ( (length($calleridname)>5) && ( (!$callerid) or ($callerid =~ /unknown|private|00000000/i) or ($callerid =~ /5551212/) ) ) + {$callerid = $calleridname;} + + ### allow for ANI being sent with the DNIS "*3125551212*9999*" + if ($extension =~ /^\*\d\d\d\d\d\d\d\d\d\d\*/) + { + $callerid = $extension; + $callerid =~ s/\*\d\d\d\d\*$//gi; + $callerid =~ s/\*\d\d\d\d$//gi; + $callerid =~ s/^\*//gi; + $extension =~ s/^\*\d\d\d\d\d\d\d\d\d\d\*//gi; + $extension =~ s/\*$//gi; + + ### set the callerid if sent with DNIS + print "SET CALLERID $callerid\n"; + checkresult($result); + } +} + +if ($AGILOG) {$agi_string = "AGI Environment Dump:"; &agi_output;} + +foreach $i (sort keys %AGI) +{ + if ($AGILOG) {$agi_string = " -- $i = $AGI{$i}"; &agi_output;} +} + +if ($AGILOG) {$agi_string = "AGI Variables: |$unique_id|$channel|$extension|$type|$callerid|"; &agi_output;} + + + $callerid = "\"$calleridname\" <$callerid>"; + +if ($extension =~ /h/i) {$stage = 'END';} +else {$stage = 'START';} + +### call start stage +if ($stage =~ /START/) + { + + if ($AGILOG) {$agi_string = "+++++ CALL INBOUND START : |$now_date|"; &agi_output;} + +# if ($channel =~ /^SIP/) {$channel =~ s/-.*//gi;} +# if ($channel =~ /^Zap\//) {$channel =~ s/-\d$//gi;} + + $stmtA = "INSERT INTO live_inbound (uniqueid,channel,server_ip,caller_id,extension,phone_ext,start_time,inbound_number,comment_a,comment_b,comment_c,comment_d,comment_e) values('$unique_id','$channel','$VARserver_ip','$callerid','$extension','$phone_ext','$now_date','$inbound_number','$comment_a','$comment_b','$comment_c','$comment_d','$comment_e')"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + + $stmtA = "INSERT INTO live_inbound_log (uniqueid,channel,server_ip,caller_id,extension,phone_ext,start_time,inbound_number,comment_a,comment_b,comment_c,comment_d,comment_e) values('$unique_id','$channel','$VARserver_ip','$callerid','$extension','$phone_ext','$now_date','$inbound_number','$comment_a','$comment_b','$comment_c','$comment_d','$comment_e')"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + + $dbhA->disconnect(); + } + + +### call end stage +else + { + if ($AGILOG) {$agi_string = "CALL INBOUND HUNG UP; deleting live_inbound record for $unique_id"; &agi_output;} + + $stmtA = "DELETE from live_inbound where uniqueid='$unique_id' and server_ip='$VARserver_ip'"; + $affected_rows = $dbhA->do($stmtA); + + $dbhA->disconnect(); + + if ($AGILOG) {$agi_string = "+++++ CALL INBOUND HUNGUP: |$unique_id|$affected_rows|"; &agi_output;} + } + +exit; + + + + +sub checkresult { + my ($res) = @_; + my $retval; + $tests++; + chomp $res; + if ($res =~ /^200/) { + $res =~ /result=(-?\d+)/; + if (!length($1)) { + print STDERR "FAIL ($res)\n"; + $fail++; + } else { + print STDERR "PASS ($1)\n"; + $pass++; + } + } else { + print STDERR "FAIL (unexpected result '$res')\n"; + $fail++; + } +} + + +sub agi_output +{ +if ($AGILOG >=2) + { + ### open the log file for writing ### + open(Lout, ">>$AGILOGfile") + || die "Can't open $AGILOGfile: $!\n"; + print Lout "$now_date|$script|$agi_string\n"; + close(Lout); + } + ### send to STDERR writing ### +if ( ($AGILOG == '1') || ($AGILOG == '3') ) + {print STDERR "$now_date|$script|$agi_string\n";} +$agi_string=''; +} diff --git a/agc_2-X/branches/agc_2.0.4/agi/debug_speak.agi b/agc_2-X/branches/agc_2.0.4/agi/debug_speak.agi new file mode 100644 index 00000000..ceeca504 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/agi/debug_speak.agi @@ -0,0 +1,123 @@ +#!/usr/bin/perl +# +# debug_speak.agi version 0.1 +# +# runs during any extension and speaks the extension sent to it while +# printing the extension as well as lots of info about the call to STDERR +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ;inbound errors with speaking of extension: +#exten => _XXXX,1,AGI(debug_speak.agi,${EXTEN}) +#exten => _XXXX,3,Hangup +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# + +$V = 1; # set to 1 for verbose mode +$CLIOUT = 1; # set to 1 for printing 1 line to STDERR +$SPEAK = 1; # set to 1 for saying invalid digits + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ +if ($CLIOUT) {print STDERR "Perl Environment Dump:\n";} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($CLIOUT) {print STDERR "$i|$ARGV[$i]|\n";} + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +if ($V) {print "no command line options set\n";} +} + +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + +$|=1; +while() { + chomp; + last unless length($_); + if ($V) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} +} + + if ($V) + { + + if ($V) {print STDERR "AGI Environment Dump:\n";} + foreach $i (sort keys %AGI) { + if ($V) {print STDERR " -- $i = $AGI{$i}\n";} + } + } + +if ($CLIOUT) {print STDERR "****** DEBUG: |$unique_id|$channel|$extension|$type|$callerid|$calleridname|\n";} + +if ($SPEAK) + { + $AGI->stream_file('beep'); + sleep(1); + $AGI->say_digits("$extension"); + } + + +exit; diff --git a/agc_2-X/branches/agc_2.0.4/agi/invalid_speak.agi b/agc_2-X/branches/agc_2.0.4/agi/invalid_speak.agi new file mode 100644 index 00000000..2b7dd9f8 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/agi/invalid_speak.agi @@ -0,0 +1,139 @@ +#!/usr/bin/perl +# +# invalid_speak.agi version 0.1 +# +# runs during an invalid extension and speaks the extension sent to it while printing to STDERR +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ;inbound errors with speaking of extension: +#exten => _XXXX,1,AGI(invalid_speak.agi,${EXTEN}) +#exten => _XXXX,2,Playback(invalid) +#exten => _XXXX,3,Hangup +# +#exten => _*XXXXXXXXXX*XXXX,1,AGI(invalid_speak.agi,${EXTEN}) +#exten => _*XXXXXXXXXX*XXXX,2,Playback(invalid) +#exten => _*XXXXXXXXXX*XXXX,3,Hangup +# +#exten => _*XXXXXXXXXX*XXXX*,1,AGI(invalid_speak.agi,${EXTEN}) +#exten => _*XXXXXXXXXX*XXXX*,2,Playback(invalid) +#exten => _*XXXXXXXXXX*XXXX*,3,Hangup +# +#exten => _**XXXX,1,AGI(invalid_speak.agi,${EXTEN}) +#exten => _**XXXX,2,Playback(invalid) +#exten => _**XXXX,3,Hangup +# +#exten => _**XXXX*,1,AGI(invalid_speak.agi,${EXTEN}) +#exten => _**XXXX*,2,Playback(invalid) +#exten => _**XXXX*,3,Hangup +# +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# + +$V = 0; # set to 1 for verbose mode +$CLIOUT = 1; # set to 1 for printing 1 line to STDERR +$SPEAK = 1; # set to 1 for saying invalid digits + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ +if ($V) {print STDERR "Perl Environment Dump:\n";} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($V) {print STDERR "$i|$ARGV[$i]|\n";} + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +if ($V) {print "no command line options set\n";} +} + +use Asterisk::AGI; +$AGI = new Asterisk::AGI; + +$|=1; +while() { + chomp; + last unless length($_); + if ($V) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} +} + + if ($V) + { + + if ($V) {print STDERR "AGI Environment Dump:\n";} + foreach $i (sort keys %AGI) { + if ($V) {print STDERR " -- $i = $AGI{$i}\n";} + } + } + +if ($CLIOUT) {print STDERR "****** INVALID EXTENSION: |$unique_id|$channel|$extension|$type|$callerid|\n";} + +if ($SPEAK) + { + $AGI->stream_file('beep'); + sleep(1); + $AGI->say_digits("$extension"); + } + + +exit; diff --git a/agc_2-X/branches/agc_2.0.4/agi/park_CID.agi b/agc_2-X/branches/agc_2.0.4/agi/park_CID.agi new file mode 100644 index 00000000..ef8a0ad5 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/agi/park_CID.agi @@ -0,0 +1,229 @@ +#!/usr/bin/perl +# +# park_CID.agi version 0.3 *DBI-version* +# +# runs before the park extension to populate the parked_channels entry with the channel's callerid +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ;outbound dialing: +# exten => 8301,1,Answer +# exten => 8301,2,AGI(park_CID.agi) +# exten => 8301,3,Playback(park) +# exten => 8301,4,Hangup +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# changes: +# 60731-1423 - changed to use DBI-DBD::mysql +# - changed to use /etc/astguiclient.conf for configs +# 60815-1256 - added output options check from database +# + +$script = 'park_CID.agi'; + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + + +if (!$VARDB_port) {$VARDB_port='3306';} +if (!$AGILOGfile) {$AGILOGfile = "$PATHlogs/agiout.$year-$mon-$mday";} + +use DBI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### Grab Server values from the database +$stmtA = "SELECT agi_output FROM servers where server_ip = '$VARserver_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + $AGILOG = '0'; + @aryA = $sthA->fetchrow_array; + $DBagi_output = "$aryA[0]"; + if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';} + if ($DBagi_output =~ /FILE/) {$AGILOG = '2';} + if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';} + $rec_count++; + } +$sthA->finish(); + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + if ($AGILOG) {$agi_string = "Perl Environment Dump:"; &agi_output;} + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($AGILOG) {$agi_string = "$i|$ARGV[$i]"; &agi_output;} + $i++; + } + if ($args =~ />| |\"/i) + { + @CID = split(/-----/, $args); + $fullCID=1; + $callerid = $CID[2]; + $calleridname = $CID[3]; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-V/i) + { + $V=1; + } + if ($args =~ /-debug/i) + { + $DG=1; + } + if ($args =~ /-dbAVS/i) + { + $DGA=1; + } + if ($args =~ /-q/i) + { + $q=1; + $Q=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} + + +$|=1; +while() { + chomp; + last unless length($_); + if ($AGILOG) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (!$fullCID) # if no fullCID sent + { + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} + if ( $calleridname =~ /\"/) {$calleridname =~ s/\"//gi;} + if ( (!$callerid) or ($callerid =~ /unknown/) ) + {$callerid = $calleridname;} + + ### allow for ANI being sent with the DNIS "*3125551212*9999*" + if ($extension =~ /^\*\d\d\d\d\d\d\d\d\d\d\*/) + { + $callerid = $extension; + $callerid =~ s/\*\d\d\d\d\*$//gi; + $callerid =~ s/^\*//gi; + $extension =~ s/^\*\d\d\d\d\d\d\d\d\d\d\*//gi; + $extension =~ s/\*$//gi; + } + $calleridname = $callerid; + } +} + +if ($AGILOG) {$agi_string = "AGI Environment Dump:"; &agi_output;} + +foreach $i (sort keys %AGI) +{ + if ($AGILOG) {$agi_string = " -- $i = $AGI{$i}"; &agi_output;} +} + + +if ($AGILOG) {$agi_string = "AGI Variables: |$unique_id|$channel|$extension|$type|$callerid|"; &agi_output;} + +if ($AGILOG) {$agi_string = "CALL BEING PARKED"; &agi_output;} + + +$stmtA = "UPDATE parked_channels set channel_group='$callerid' where server_ip='$VARserver_ip' and channel='$channel';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); +if ($AGILOG) {$agi_string = "-- Park record updated: |$affected_rows| |$callerid|$channel|$VARserver_ip"; &agi_output;} + +$dbhA->disconnect(); + + +exit; + + + +sub agi_output +{ +if ($AGILOG >=2) + { + ### open the log file for writing ### + open(Lout, ">>$AGILOGfile") + || die "Can't open $AGILOGfile: $!\n"; + print Lout "$now_date|$script|$agi_string\n"; + close(Lout); + } + ### send to STDERR writing ### +if ( ($AGILOG == '1') || ($AGILOG == '3') ) + {print STDERR "$now_date|$script|$agi_string\n";} +$agi_string=''; +} diff --git a/agc_2-X/branches/agc_2.0.4/bin/ADMIN_adjust_GMTnow_on_leads.pl b/agc_2-X/branches/agc_2.0.4/bin/ADMIN_adjust_GMTnow_on_leads.pl new file mode 100644 index 00000000..5028f408 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/ADMIN_adjust_GMTnow_on_leads.pl @@ -0,0 +1,1119 @@ +#!/usr/bin/perl + +# ADMIN_adjust_GMTnow_on_leads.pl *DBI-version* +# +# program goes throught the vicidial_list table and adjusts the gmt_offset_now +# field to change it to today's offset if needed because of Daylight Saving Time +# +# run every time you load leads into the vicidial_list table +# +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# +# +# CHANGES +# 50810-1540 - Added database server variable definitions lookup +# 60615-1717 - Added definition GMT lookup from database not flat text file +# 60717-1045 - changed to DBI by Marin Blu +# 60717-1531 - changed to use /etc/astguiclient.conf for configuration +# 61108-1320 - added new DST schemes for USA/Canada change and changes in other countries +# 61110-1204 - added new DST scheme for Brazil +# 61128-1034 - added postal code GMT lookup option +# 61219-1106 - fixed updating for NULL gmt_offset records +# 70823-1633 - added ability to restrict by list_id +# + +$MT[0]=''; + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n"; + print " [-q] = quiet\n"; + print " [-t] = test\n"; + print " [--debug] = debugging messages\n"; + print " [--debugX] = Super debugging messages\n"; + print " [--postal-code-gmt] = Attempt postal codes lookup for timezones\n"; + print " [--singlelistid=XXX] = Only lookup and alter leads in one list_id\n"; + print "\n"; + + exit; + } + else + { + if ($args =~ /-q/i) + { + $q=1; $Q=1; + } + if ($args =~ /-t|--test/i) + { + $T=1; $TEST=1; + print "\n-----TESTING -----\n\n"; + } + if ($args =~ /--debug/i) + { + $DB=1; + print "\n-----DEBUGGING -----\n\n"; + } + if ($args =~ /--debugX/i) + { + $DBX=1; + print "\n----- SUPER-DUPER DEBUGGING -----\n\n"; + } + if ($args =~ /--postal-code-gmt/i) + { + $searchPOST=1; + print "\n----- DO POSTAL CODE LOOKUP -----\n\n"; + } + if ($args =~ /-singlelistid=/i) + { + @data_in = split(/-singlelistid=/,$args); + $singlelistid = $data_in[1]; + print "\n----- SINGLE LISTID OVERRIDE: $singlelistid -----\n\n"; + } + else + {$singlelistid = '';} + + + } +} +else +{ +print "no command line options set\n"; +} + +if ($DB) {print "STARTING TIME ZONE DAYLIGHT SAVING TIME CALCULATION SCRIPT\n\n\n\n";} + +### end parsing run-time options ### + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} + +$secX = time(); +# $secX = '1079989363'; # epoch for March 22, 2993 +# $secX = '1097989363'; # epoch for October 17, 2004 + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($secX); + $mon++; + $year = ($year + 1900); + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + +use DBI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + + ### Grab Server values from the database + $stmtA = "SELECT telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERNAMEupdate,ASTmgrUSERNAMElisten,ASTmgrUSERNAMEsend,max_vicidial_trunks,answer_transfer_agent,local_gmt,ext_context FROM servers where server_ip = '$server_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_countY=0; + while ($sthArows > $rec_countY) + { + @aryA = $sthA->fetchrow_array; + $DBtelnet_host = "$aryA[0]"; + $DBtelnet_port = "$aryA[1]"; + $DBASTmgrUSERNAME = "$aryA[2]"; + $DBASTmgrSECRET = "$aryA[3]"; + $DBASTmgrUSERNAMEupdate = "$aryA[4]"; + $DBASTmgrUSERNAMElisten = "$aryA[5]"; + $DBASTmgrUSERNAMEsend = "$aryA[6]"; + $DBmax_vicidial_trunks = "$aryA[7]"; + $DBanswer_transfer_agent= "$aryA[8]"; + $DBSERVER_GMT = "$aryA[9]"; + $DBext_context = "$aryA[10]"; + if ($DBtelnet_host) {$telnet_host = $DBtelnet_host;} + if ($DBtelnet_port) {$telnet_port = $DBtelnet_port;} + if ($DBASTmgrUSERNAME) {$ASTmgrUSERNAME = $DBASTmgrUSERNAME;} + if ($DBASTmgrSECRET) {$ASTmgrSECRET = $DBASTmgrSECRET;} + if ($DBASTmgrUSERNAMEupdate) {$ASTmgrUSERNAMEupdate = $DBASTmgrUSERNAMEupdate;} + if ($DBASTmgrUSERNAMElisten) {$ASTmgrUSERNAMElisten = $DBASTmgrUSERNAMElisten;} + if ($DBASTmgrUSERNAMEsend) {$ASTmgrUSERNAMEsend = $DBASTmgrUSERNAMEsend;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBext_context) {$ext_context = $DBext_context;} + $rec_countY++; + } + $sthA->finish(); + + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + +if ($isdst) {$LOCAL_GMT_OFF++;} +if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";} + +if (length($singlelistid)> 0) {$listSQL = "where list_id='$singlelistid'"; $XlistSQL=" and list_id='$singlelistid' ";} +else {$listSQL = ''; $XlistSQL='';} + $stmtA = "select distinct phone_code from vicidial_list $listSQL;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_countY=0; + @phone_codes=@MT; + $phone_codes_list='|'; + + while ($sthArows > $rec_countY) + { + @aryA = $sthA->fetchrow_array; + + $phone_codes[$rec_countY] = $aryA[0]; + $phone_codes_ORIG[$rec_countY] = $aryA[0]; + $phone_codes[$rec_countY] =~ s/011|0011| |\t|\r|\n//gi; + + # if ( ($phone_codes_list !~ /\|$phone_codes[$rec_countY]\|/) && (length($phone_codes[$rec_countY]) > 0) ) + # { + # $phone_codes_list .= "$phone_codes[$rec_countY]|"; + # } + + if ($DBX) {print "|",$aryA[0],"|","\n";} + $rec_countY++; + + } + $sthA->finish(); + if ($DB) {print " - Unique Country dial codes found: $rec_countY\n";} + + + ##### Put all country/are code records into an array for speed + $stmtA = "select * from vicidial_phone_codes;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_countZ=0; + @codefile=@MT; + + while ($sthArows > $rec_countZ) + { + @aryA = $sthA->fetchrow_array; + + $codefile[$rec_countZ] = "$aryA[0]\t$aryA[1]\t$aryA[2]\t$aryA[3]\t$aryA[4]\t$aryA[5]\t$aryA[6]\t$aryA[7]\n"; + $rec_countZ++; + } + + ##### Put all postal code records into an array for speed + $stmtA = "select * from vicidial_postal_codes;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_countT=0; + @postalfile=@MT; + + while ($sthArows > $rec_countT) + { + @aryA = $sthA->fetchrow_array; + + $postalfile[$rec_countT] = "$aryA[0]\t$aryA[1]\t$aryA[2]\t$aryA[3]\t$aryA[4]\t$aryA[5]\t$aryA[6]"; + $rec_countT++; + } + + $sthA->finish(); + if ($DB) {print " - GMT postal codes records: $rec_countT\n";} + +$ep=0; $ei=0; $ee=0; +$d=0; +foreach (@phone_codes) + { + $match_code = $phone_codes[$d]; + $match_code_ORIG = $phone_codes[$d]; + + if ($DB) {print "\nRUNNING LOOP FOR COUNTRY CODE: $match_code\n";} + + ##### BEGIN RUN LOOP FOR EACH COUNTRY CODE/AREA CODE RECORD THAT IS INSIDE THIS COUNTRY CODE ##### + $e=0; + $area_updated_count=0; + foreach (@codefile) + { + chomp($codefile[$e]); + if ($codefile[$e] =~ /^$match_code\t/) + { + @m = split(/\t/, $codefile[$e]); + $area_code = $m[2]; + $area_state = $m[3]; + $area_GMT = $m[4]; $area_GMT =~ s/\+//gi; $area_GMT = ($area_GMT + 0); + $area_GMT_method = $m[6]; + if ($area_code =~ /S/) # look for state override flag in areacode field + { + $area_code =~ s/\D//gi; + $AC_match = " and phone_number LIKE \"$area_code%\" and state='$area_state'"; + if ($DB) {print " AREA CODE STATE OVERRIDE: $codefile[$e]\n";} + } + else + { + if ($area_code =~ /\*/) {$AC_match = '';} + else {$AC_match = " and phone_number LIKE \"$area_code%\"";} + } + if ($DBX) {print "PROCESSING THIS LINE: $codefile[$e]\n";} + + $stmtA = "select count(*) from vicidial_list where phone_code='$match_code_ORIG' $AC_match $XlistSQL;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_countZ=0; + @aryA = $sthA->fetchrow_array; + $rec_countZ = $aryA[0]; + $sthA->finish(); + + if (!$rec_countZ) + { + # if ($DB) {print " IGNORING: $codefile[$e]\n";} + $ei++; + } + else + { + $AC_GMT_diff = ($area_GMT - $LOCAL_GMT_OFF_STD); + $AC_localtime = ($secX + (3600 * $AC_GMT_diff)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($AC_localtime); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + + if ( (!$AC_processed) && ($area_GMT_method =~ /SSM-FSN/) ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + &USACAN_dstcalc; + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($area_GMT_method =~ /FSA-LSO/) ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + &NA_dstcalc; + if ($DBX) {print " DST: $NA_DST\n";} + if ($NA_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($area_GMT_method =~ /LSM-LSO/) ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + &GBR_dstcalc; + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($area_GMT_method =~ /LSO-LSM/) ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + &AUS_dstcalc; + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($area_GMT_method =~ /FSO-LSM/) ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + &AUST_dstcalc; + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($area_GMT_method =~ /FSO-TSM/) ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + &NZL_dstcalc; + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($area_GMT_method =~ /TSO-LSF/) ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + &BZL_dstcalc; + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$area_GMT++;} + $AC_processed++; + } + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + + if ($AC_processed) + { + $stmtA = "select count(*) from vicidial_list where phone_code='$match_code_ORIG' $AC_match and (gmt_offset_now != '$area_GMT' or gmt_offset_now IS NULL) $XlistSQL;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_countW=0; + @aryA = $sthA->fetchrow_array; + $rec_countW = $aryA[0]; + $sthA->finish(); + + if (!$rec_countW) + { + if ($DBX) {print " ALL GMT ALREADY CORRECT FOR : $match_code_ORIG $area_code $area_GMT\n";} + $ei++; + } + else + { + $stmtA = "update vicidial_list set gmt_offset_now='$area_GMT' where phone_code='$match_code_ORIG' $AC_match and (gmt_offset_now != '$area_GMT' or gmt_offset_now IS NULL) $XlistSQL;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + if (!$T) + { + $affected_rows = $dbhA->do($stmtA); + $area_updated_count = ($area_updated_count + $affected_rows); + } + $Prec_countW = sprintf("%8s", $rec_countW); + if ($DB) {print " $Prec_countW records in $match_code_ORIG $area_code updated to $area_GMT\n";} + $ee++; + # sleep(1); + } + } + } + + $ep++; + } + else + { + # if ($DBX) {print " IGNORING: $codefile[$e]\n";} + $ei++; + } + $e++; + } + ##### END RUN LOOP FOR EACH COUNTRY CODE/AREA CODE RECORD THAT IS INSIDE THIS COUNTRY CODE ##### + + + if ($searchPOST > 0) + { + ##### BEGIN RUN LOOP FOR EACH POSTAL CODE RECORD THAT IS INSIDE THIS COUNTRY CODE ##### + if ($DB) {print "POSTAL CODE RUN START...\n";} + $postal_updated_count=0; + $e=0; + foreach (@postalfile) + { + chomp($postalfile[$e]); + if ($postalfile[$e] =~ /\t$match_code$/) + { + @m = split(/\t/, $postalfile[$e]); + $postal_code = $m[0]; + $postal_state = $m[1]; + $area_GMT = $m[2]; $area_GMT =~ s/\+//gi; $area_GMT = ($area_GMT + 0); + $area_GMT_method = $m[4]; + $AC_match = " and postal_code LIKE \"$postal_code%\""; + if ($DBX) {print "PROCESSING THIS LINE: $postalfile[$e]\n";} + + $stmtA = "select count(*) from vicidial_list where phone_code='$match_code_ORIG' $AC_match $XlistSQL;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_countZ=0; + @aryA = $sthA->fetchrow_array; + $rec_countZ = $aryA[0]; + $sthA->finish(); + + if (!$rec_countZ) + { + # if ($DB) {print " IGNORING: $postalfile[$e]\n";} + $ei++; + } + else + { + $AC_GMT_diff = ($area_GMT - $LOCAL_GMT_OFF_STD); + $AC_localtime = ($secX + (3600 * $AC_GMT_diff)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($AC_localtime); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + + if ( (!$AC_processed) && ($area_GMT_method =~ /SSM-FSN/) ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + &USACAN_dstcalc; + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($area_GMT_method =~ /FSA-LSO/) ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + &NA_dstcalc; + if ($DBX) {print " DST: $NA_DST\n";} + if ($NA_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($area_GMT_method =~ /LSM-LSO/) ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + &GBR_dstcalc; + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($area_GMT_method =~ /LSO-LSM/) ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + &AUS_dstcalc; + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($area_GMT_method =~ /FSO-LSM/) ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + &AUST_dstcalc; + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($area_GMT_method =~ /FSO-TSM/) ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + &NZL_dstcalc; + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($area_GMT_method =~ /TSO-LSF/) ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + &BZL_dstcalc; + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$area_GMT++;} + $AC_processed++; + } + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + + if ($AC_processed) + { + $stmtA = "select count(*) from vicidial_list where phone_code='$match_code_ORIG' $AC_match and (gmt_offset_now != '$area_GMT' or gmt_offset_now IS NULL) $XlistSQL;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_countW=0; + @aryA = $sthA->fetchrow_array; + $rec_countW = $aryA[0]; + $sthA->finish(); + + if (!$rec_countW) + { + if ($DBX) {print " ALL GMT ALREADY CORRECT FOR : $match_code_ORIG $postal_code $area_GMT\n";} + $ei++; + } + else + { + $stmtA = "update vicidial_list set gmt_offset_now='$area_GMT' where phone_code='$match_code_ORIG' $AC_match and (gmt_offset_now != '$area_GMT' or gmt_offset_now IS NULL) $XlistSQL;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + if (!$T) + { + $affected_rows = $dbhA->do($stmtA); + $postal_updated_count = ($postal_updated_count + $affected_rows); + } + $Prec_countW = sprintf("%8s", $rec_countW); + if ($DB) {print " $Prec_countW records in $match_code_ORIG $postal_code updated to $area_GMT\n";} + $ee++; + # sleep(1); + } + } + } + + $ep++; + } + else + { + # if ($DBX) {print " IGNORING: $postalfile[$e]\n";} + $ei++; + } + $e++; + } + ##### END RUN LOOP FOR EACH POSTAL CODE RECORD THAT IS INSIDE THIS COUNTRY CODE ##### + } + $d++; + } + + + +$dbhA->disconnect(); + +if($DB){print "Postal Updates: $postal_updated_count\n";} +if($DB){print "Area Code Updates: $area_updated_count\n";} +if($DB){print "\nDONE\n";} +$secy = time(); $secz = ($secy - $secX); $minz = ($secz/60); # calculate script runtime so far +print "\n - process runtime ($secz sec) ($minz minutes)\n"; + +exit; + + + +sub USACAN_dstcalc { +#********************************************************************** +# SSM-FSN +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on Second Sunday March to First Sunday November at 2 am. +# INPUTS: +# mm INTEGER Month. +# dd INTEGER Day of the month. +# ns INTEGER Seconds into the day. +# dow INTEGER Day of week (0=Sunday, to 6=Saturday) +# OPTIONAL INPUT: +# timezone INTEGER hour difference UTC - local standard time +# (DEFAULT is blank) +# make calculations based on UTC time, +# which means shift at 10:00 UTC in April +# and 9:00 UTC in October +# OUTPUT: +# INTEGER 1 = DST, 0 = not DST +# +# S M T W T F S +# 1 2 3 4 5 6 7 +# 8 9 10 11 12 13 14 +#15 16 17 18 19 20 21 +#22 23 24 25 26 27 28 +#29 30 31 +# +# S M T W T F S +# 1 2 3 4 5 6 +# 7 8 9 10 11 12 13 +#14 15 16 17 18 19 20 +#21 22 23 24 25 26 27 +#28 29 30 31 +# +#********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; return 0; + } elsif ($mm >= 4 && $mm <= 10) { + $USACAN_DST=1; return 1; + } elsif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; return 1; + } elsif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; return 0; + } else { + $USACAN_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $USACAN_DST=0; return 0; + } else { + $USACAN_DST=1; return 1; + } + } + } else { + $USACAN_DST=0; return 0; + } + } elsif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; return 0; + } elsif ($dd < ($dow+1)) { + $USACAN_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; return 1; + } else { + $USACAN_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; return 1; + } else { + $USACAN_DST=0; return 0; + } + } + } else { + $USACAN_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub NA_dstcalc { +#********************************************************************** +# FSA-LSO +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in April and last Sunday in October at 2 am. +#********************************************************************** + + $NA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $NA_DST=0; return 0; + } elsif ($mm >= 5 && $mm <= 9) { + $NA_DST=1; return 1; + } elsif ($mm == 4) { + if ($dd > 7) { + $NA_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $NA_DST=0; return 0; + } else { + $NA_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $NA_DST=0; return 0; + } else { + $NA_DST=1; return 1; + } + } + } else { + $NA_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $NA_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $NA_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $NA_DST=1; return 1; + } else { + $NA_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 7200) { + $NA_DST=1; return 1; + } else { + $NA_DST=0; return 0; + } + } + } else { + $NA_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub GBR_dstcalc { +#********************************************************************** +# LSM-LSO +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in March and last Sunday in October at 1 am. +#********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; return 0; + } elsif ($mm >= 4 && $mm <= 9) { + $GBR_DST=1; return 1; + } elsif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $GBR_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; return 0; + } else { + $GBR_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; return 0; + } else { + $GBR_DST=1; return 1; + } + } + } else { + $GBR_DST=1; return 1; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $GBR_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; return 1; + } else { + $GBR_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; return 1; + } else { + $GBR_DST=0; return 0; + } + } + } else { + $GBR_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub AUS_dstcalc { +#********************************************************************** +# LSO-LSM +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in October and last Sunday in March at 1 am. +#********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $AUS_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $AUS_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; return 1; + } else { + $AUS_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; return 1; + } else { + $AUS_DST=0; return 0; + } + } + } else { + $AUS_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $AUS_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; return 0; + } else { + $AUS_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; return 0; + } else { + $AUS_DST=1; return 1; + } + } + } else { + $AUS_DST=1; return 1; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub AUST_dstcalc { +#********************************************************************** +# FSO-LSM +# TASMANIA ONLY +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and last Sunday in March at 1 am. +#********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $AUST_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $AUST_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; return 1; + } else { + $AUST_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; return 1; + } else { + $AUST_DST=0; return 0; + } + } + } else { + $AUST_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd >= 8) { + $AUST_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $AUST_DST=0; return 0; + } else { + $AUST_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $AUST_DST=0; return 0; + } else { + $AUST_DST=1; return 1; + } + } + } else { + $AUST_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub NZL_dstcalc { +#********************************************************************** +# FSO-TSM +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and third Sunday in March at 1 am. +#********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $NZL_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; return 1; + } elsif ($dd < ($dow+14)) { + $NZL_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; return 1; + } else { + $NZL_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; return 1; + } else { + $NZL_DST=0; return 0; + } + } + } else { + $NZL_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd >= 8) { + $NZL_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $NZL_DST=0; return 0; + } else { + $NZL_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $NZL_DST=0; return 0; + } else { + $NZL_DST=1; return 1; + } + } + } else { + $NZL_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub BZL_dstcalc { +#********************************************************************** +# TSO-LSF +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. Brazil +# Based on Third Sunday October to Last Sunday February at 1 am. +#********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; return 1; + } elsif ($mm >= 3 && $mm <= 9) { + $BZL_DST=0; return 0; + } elsif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; return 1; + } elsif ($dd < ($dow+22)) { + $BZL_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; return 1; + } else { + $BZL_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; return 1; + } else { + $BZL_DST=0; return 0; + } + } + } else { + $BZL_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; return 0; + } elsif ($dd < ($dow+22)) { + $BZL_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; return 0; + } else { + $BZL_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; return 0; + } else { + $BZL_DST=1; return 1; + } + } + } else { + $BZL_DST=1; return 1; + } + } # end of month checks +} # end of subroutine dstcalc + diff --git a/agc_2-X/branches/agc_2.0.4/bin/ADMIN_area_code_populate.pl b/agc_2-X/branches/agc_2.0.4/bin/ADMIN_area_code_populate.pl new file mode 100644 index 00000000..dcf9dab7 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/ADMIN_area_code_populate.pl @@ -0,0 +1,147 @@ +#!/usr/bin/perl +# ADMIN_area_code_populate.pl version 0.3 *DBI-version* +# +# Copyright (C) 2006 Joe Johnson,Matt Florell LICENSE: GPLv2 +# +# Description: +# server application that allows load areacodes into to asterisk list database +# +# CHANGES +# 60615-1514 - Changed to ignore the header row +# 60807-1003 - Changed to DBI +# - changed to use /etc/astguiclient.conf for configs +# 61122-1902 - Added GMT_USA_zip.txt data import for USA postal GMT data +# + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + + +use Time::HiRes ('gettimeofday','usleep','sleep'); # needed to have perl sleep in increments of less than one second +use DBI; + +if (!$VARDB_port) {$VARDB_port='3306';} + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +$slash_star = '\*'; + + +#### BEGIN vicidial_phone_codes population from phone_codes_GMT.txt file #### +open(codefile, "$PATHhome/phone_codes_GMT.txt") || die "can't open $PATHhome/phone_codes_GMT.txt: $!\n"; +@codefile = ; +close(codefile); +$pc=0; +$ins_stmt="insert into vicidial_phone_codes VALUES "; +foreach (@codefile) +{ + @row=split(/\t/, $codefile[$pc]); + if ($codefile[$pc] !~ /GEOGRAPHIC DESCRIPTION/) + { + $pc++; + $row[7] =~ s/\r|\n|\t| $//gi; + $row[6] =~ s/\r|\n|\t| $//gi; + $row[5] =~ s/\r|\n|\t| $//gi; + $row[4] =~ s/\r|\n|\t| $//gi; + $row[3] =~ s/\r|\n|\t| $//gi; + $row[2] =~ s/\r|\n|\t| $//gi; + $row[1] =~ s/\r|\n|\t| $//gi; + $row[0] =~ s/\r|\n|\t| $//gi; + $ins_stmt.="('$row[0]', '$row[1]', '$row[2]', '$row[3]', '$row[4]', '$row[5]', '$row[6]', '$row[7]'), "; + if ($pc =~ /00$/) + { + chop($ins_stmt); + chop($ins_stmt); + $affected_rows = $dbhA->do($ins_stmt) || die "can't execute query: |$ins_stmt| $!\n"; + $ins_stmt="insert into vicidial_phone_codes VALUES "; + print STDERR "$pc\n"; + } + } + else {$pc++;} +} + +chop($ins_stmt); +chop($ins_stmt); +$affected_rows = $dbhA->do($ins_stmt); +$ins_stmt="insert into vicidial_phone_codes VALUES "; +print STDERR "$pc\n"; +#### END vicidial_phone_codes population from phone_codes_GMT.txt file #### + + +#### BEGIN vicidial_postal_codes population from GMT_USA_zip.txt file #### +open(zipfile, "$PATHhome/GMT_USA_zip.txt") || die "can't open $PATHhome/GMT_USA_zip.txt: $!\n"; +@zipfile = ; +close(zipfile); +$pc=0; +$ins_stmt="insert into vicidial_postal_codes VALUES "; +foreach (@zipfile) +{ + @row=split(/\t/, $zipfile[$pc]); + $pc++; + $row[0] =~ s/\r|\n|\t| $//gi; + $row[1] =~ s/\r|\n|\t| $//gi; + $row[2] =~ s/\r|\n|\t| $//gi; + $row[3] =~ s/\r|\n|\t| $//gi; + if ($row[3] =~ /Y/i) {$DST_range = 'SSM-FSN';} + else {$DST_range = '';} + $ins_stmt.="('$row[0]', '$row[1]', '$row[2]', '$row[3]', '$DST_range', 'USA', '1'), "; + if ($pc =~ /00$/) + { + chop($ins_stmt); + chop($ins_stmt); + $affected_rows = $dbhA->do($ins_stmt) || die "can't execute query: |$ins_stmt| $!\n"; + $ins_stmt="insert into vicidial_postal_codes VALUES "; + print STDERR "$pc\n"; + } +} + +chop($ins_stmt); +chop($ins_stmt); +$affected_rows = $dbhA->do($ins_stmt); +$ins_stmt="insert into vicidial_postal_codes VALUES "; +print STDERR "$pc\n"; +#### END vicidial_postal_codes population from GMT_USA_zip.txt file #### + +$dbhA->disconnect(); + +exit; \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/bin/ADMIN_keepalive_ALL.pl b/agc_2-X/branches/agc_2.0.4/bin/ADMIN_keepalive_ALL.pl new file mode 100644 index 00000000..6107dda8 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/ADMIN_keepalive_ALL.pl @@ -0,0 +1,400 @@ +#!/usr/bin/perl +# +# ADMIN_keepalive_ALL.pl version 0.2 +# +# Designed to keep the astGUIclient processes alive and check every minute +# Replaces all other ADMIN_keepalive scripts +# Uses /etc/astguiclient.conf file to know which processes to keepalive +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# +# 61011-1348 - first build +# 61120-2011 - added option 7 for AST_VDauto_dial_FILL.pl +# + +$DB=0; # Debug flag +$MT[0]=''; $MT[1]=''; +@psline=@MT; + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-t] = test\n [-debug] = verbose debug messages\n[-debugX] = Extra-verbose debug messages\n\n"; + } + else + { + if ($args =~ /-debug/i) + { + $DB=1; # Debug flag + } + if ($args =~ /--debugX/i) + { + $DBX=1; + print "\n----- SUPER-DUPER DEBUGGING -----\n\n"; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +# print "no command line options set\n"; +} +### end parsing run-time options ### + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^VARactive_keepalives/) && ($CLIactive_keepalives < 1) ) + {$VARactive_keepalives = $line; $VARactive_keepalives =~ s/.*=//gi;} + $i++; + } + +##### list of codes for active_keepalives and what processes they correspond to +# X - NO KEEPALIVE PROCESSES (use only if you want none to be keepalive)\n"; +# 1 - AST_update\n"; +# 2 - AST_send_listen\n"; +# 3 - AST_VDauto_dial\n"; +# 4 - AST_VDremote_agents\n"; +# 5 - AST_VDadapt (If multi-server system, this must only be on one server)\n"; +# 6 - FastAGI_log\n"; +# 7 - AST_VDauto_dial_FILL\n"; + +if ($VARactive_keepalives =~ /X/) + { + if ($DB) {print "X in active_keepalives, exiting...\n";} + exit; + } + +$AST_update=0; +$AST_send_listen=0; +$AST_VDauto_dial=0; +$AST_VDremote_agents=0; +$AST_VDadapt=0; +$FastAGI_log=0; +$AST_VDauto_dial_FILL=0; +$runningAST_update=0; +$runningAST_send=0; +$runningAST_listen=0; +$runningAST_VDauto_dial=0; +$runningAST_VDremote_agents=0; +$runningAST_VDadapt=0; +$runningFastAGI_log=0; +$runningAST_VDauto_dial_FILL=0; + +if ($VARactive_keepalives =~ /1/) + { + $AST_update=1; + if ($DB) {print "AST_update set to keepalive\n";} + } +if ($VARactive_keepalives =~ /2/) + { + $AST_send_listen=1; + if ($DB) {print "AST_send_listen set to keepalive\n";} + } +if ($VARactive_keepalives =~ /3/) + { + $AST_VDauto_dial=1; + if ($DB) {print "AST_VDauto_dial set to keepalive\n";} + } +if ($VARactive_keepalives =~ /4/) + { + $AST_VDremote_agents=1; + if ($DB) {print "AST_VDremote_agents set to keepalive\n";} + } +if ($VARactive_keepalives =~ /5/) + { + $AST_VDadapt=1; + if ($DB) {print "AST_VDadapt set to keepalive\n";} + } +if ($VARactive_keepalives =~ /6/) + { + $FastAGI_log=1; + if ($DB) {print "FastAGI_log set to keepalive\n";} + } +if ($VARactive_keepalives =~ /7/) + { + $AST_VDauto_dial_FILL=1; + if ($DB) {print "AST_VDauto_dial_FILL set to keepalive\n";} + } + +$REGhome = $PATHhome; +$REGhome =~ s/\//\\\//gi; + + + + + + +##### First, check and see which processes are running ##### + +### you may have to use a different ps command if you're not using Slackware Linux +# @psoutput = `ps -f -C AST_update --no-headers`; +# @psoutput = `ps -f -C AST_updat* --no-headers`; +# @psoutput = `/bin/ps -f --no-headers -A`; +# @psoutput = `/bin/ps -o pid,args -A`; ### use this one for FreeBSD +@psoutput = `/bin/ps -o "%p %a" --no-headers -A`; + +$i=0; +foreach (@psoutput) +{ +chomp($psoutput[$i]); +if ($DBX) {print "$i|$psoutput[$i]| \n";} +@psline = split(/\/usr\/bin\/perl /,$psoutput[$i]); + + if ($psline[1] =~ /$REGhome\/AST_update\.pl/) + { + $runningAST_update++; + if ($DB) {print "AST_update RUNNING: |$psline[1]|\n";} + } + if ($psline[1] =~ /AST_manager_se/) + { + $runningAST_send++; + if ($DB) {print "AST_send RUNNING: |$psline[1]|\n";} + } + if ($psline[1] =~ /AST_manager_li/) + { + $psoutput[$i] =~ s/ .*|\n|\r|\t| //gi; + $listen_pid[$runningAST_listen] = $psoutput[$i]; + $runningAST_listen++; + if ($DB) {print "AST_listen RUNNING: |$psline[1]|\n";} + } + if ($psline[1] =~ /$REGhome\/AST_VDauto_dial\.pl/) + { + $runningAST_VDauto_dial++; + if ($DB) {print "AST_VDauto_dial RUNNING: |$psline[1]|\n";} + } + if ($psline[1] =~ /$REGhome\/AST_VDremote_agents\.pl/) + { + $runningAST_VDremote_agents++; + if ($DB) {print "AST_VDremote_agents RUNNING: |$psline[1]|\n";} + } + if ($psline[1] =~ /$REGhome\/AST_VDadapt\.pl/) + { + $runningAST_VDadapt++; + if ($DB) {print "AST_VDadapt RUNNING: |$psline[1]|\n";} + } + if ($psline[1] =~ /$REGhome\/FastAGI_log\.pl/) + { + $runningFastAGI_log++; + if ($DB) {print "FastAGI_log RUNNING: |$psline[1]|\n";} + } + if ($psline[1] =~ /$REGhome\/AST_VDauto_dial_FILL\.pl/) + { + $runningAST_VDauto_dial_FILL++; + if ($DB) {print "AST_VDauto_dial_FILL RUNNING: |$psline[1]|\n";} + } +$i++; +} + + + + + +##### Second, IF MORE THAN ONE LISTEN INSTANCE IS RUNNING, KILL THE SECOND ONE ##### +@psline=@MT; +@psoutput=@MT; +@listen_pid=@MT; +if ($runningAST_listen > 1) +{ +$runningAST_listen=0; + + sleep(1); + +### you may have to use a different ps command if you're not using Slackware Linux +# @psoutput = `ps -f -C AST_update --no-headers`; +# @psoutput = `ps -f -C AST_updat* --no-headers`; +# @psoutput = `/bin/ps -f --no-headers -A`; +# @psoutput = `/bin/ps -o pid,args -A`; ### use this one for FreeBSD +@psoutput = `/bin/ps -o "%p %a" --no-headers -A`; + +$i=0; +foreach (@psoutput) + { + chomp($psoutput[$i]); + if ($DBX) {print "$i|$psoutput[$i]| \n";} + @psline = split(/\/usr\/bin\/perl /,$psoutput[$i]); + $psoutput[$i] =~ s/^ *//gi; + $psoutput[$i] =~ s/ .*|\n|\r|\t| //gi; + + if ($psline[1] =~ /AST_manager_li/) + { + $listen_pid[$runningAST_listen] = $psoutput[$i]; + if ($DB) {print "AST_listen RUNNING: |$psline[1]|$listen_pid[$runningAST_listen]|\n";} + $runningAST_listen++; + } + + $i++; + } + +if ($runningAST_listen > 1) + { + if ($DB) {print "Killing AST_manager_listen... |$listen_pid[1]|\n";} + `/bin/kill -s 9 $listen_pid[1]`; + } +} + + + + + + + +##### Third, double-check that non-running scripts are not running ##### +@psline=@MT; +@psoutput=@MT; + +if ( + ( ($AST_update > 0) && ($runningAST_update < 1) ) || + ( ($AST_send_listen > 0) && ($runningAST_send < 1) ) || + ( ($AST_send_listen > 0) && ($runningAST_listen < 1) ) || + ( ($AST_VDauto_dial > 0) && ($runningAST_VDauto_dial < 1) ) || + ( ($AST_VDremote_agents > 0) && ($runningAST_VDremote_agents < 1) ) || + ( ($AST_VDadapt > 0) && ($runningAST_VDadapt < 1) ) || + ( ($FastAGI_log > 0) && ($runningFastAGI_log < 1) ) || + ( ($AST_VDauto_dial_FILL > 0) && ($runningAST_VDauto_dial_FILL < 1) ) + ) +{ + +if ($DB) {print "double check that processes are not running...\n";} + + sleep(1); + +`PERL5LIB="$PATHhome/libs"; export PERL5LIB`; +### you may have to use a different ps command if you're not using Slackware Linux +# @psoutput = `ps -f -C AST_update --no-headers`; +# @psoutput = `ps -f -C AST_updat* --no-headers`; +# @psoutput = `/bin/ps -f --no-headers -A`; +# @psoutput = `/bin/ps -o pid,args -A`; ### use this one for FreeBSD +@psoutput2 = `/bin/ps -o "%p %a" --no-headers -A`; +$i=0; +foreach (@psoutput2) + { + chomp($psoutput2[$i]); + if ($DBX) {print "$i|$psoutput2[$i]| \n";} + @psline = split(/\/usr\/bin\/perl /,$psoutput2[$i]); + + if ($psline[1] =~ /$REGhome\/AST_update\.pl/) + { + $runningAST_update++; + if ($DB) {print "AST_update RUNNING: |$psline[1]|\n";} + } + if ($psline[1] =~ /AST_manager_se/) + { + $runningAST_send++; + if ($DB) {print "AST_send RUNNING: |$psline[1]|\n";} + } + if ($psline[1] =~ /AST_manager_li/) + { + $runningAST_listen++; + if ($DB) {print "AST_listen RUNNING: |$psline[1]|\n";} + } + if ($psline[1] =~ /$REGhome\/AST_VDauto_dial\.pl/) + { + $runningAST_VDauto_dial++; + if ($DB) {print "AST_VDauto_dial RUNNING: |$psline[1]|\n";} + } + if ($psline[1] =~ /$REGhome\/AST_VDremote_agents\.pl/) + { + $runningAST_VDremote_agents++; + if ($DB) {print "AST_VDremote_agents RUNNING: |$psline[1]|\n";} + } + if ($psline[1] =~ /$REGhome\/AST_VDadapt\.pl/) + { + $runningAST_VDadapt++; + if ($DB) {print "AST_VDadapt RUNNING: |$psline[1]|\n";} + } + if ($psline[1] =~ /$REGhome\/FastAGI_log\.pl/) + { + $runningFastAGI_log++; + if ($DB) {print "FastAGI_log RUNNING: |$psline[1]|\n";} + } + if ($psline[1] =~ /$REGhome\/AST_VDauto_dial_FILL\.pl/) + { + $runningAST_VDauto_dial_FILL++; + if ($DB) {print "AST_VDauto_dial_FILL RUNNING: |$psline[1]|\n";} + } + $i++; + } + + +if ( ($AST_update > 0) && ($runningAST_update < 1) ) + { + if ($DB) {print "starting AST_update...\n";} + # add a '-L' to the command below to activate logging + `/usr/bin/screen -d -m -S ASTupdate $PATHhome/AST_update.pl`; + } +if ( ($AST_send_listen > 0) && ($runningAST_send < 1) ) + { + if ($DB) {print "starting AST_manager_send...\n";} + # add a '-L' to the command below to activate logging + `/usr/bin/screen -d -m -S ASTsend $PATHhome/AST_manager_send.pl`; + } +if ( ($AST_send_listen > 0) && ($runningAST_listen < 1) ) + { + if ($DB) {print "starting AST_manager_listen...\n";} + # add a '-L' to the command below to activate logging + `/usr/bin/screen -d -m -S ASTlisten $PATHhome/AST_manager_listen.pl`; + } +if ( ($AST_VDauto_dial > 0) && ($runningAST_VDauto_dial < 1) ) + { + if ($DB) {print "starting AST_VDauto_dial...\n";} + # add a '-L' to the command below to activate logging + `/usr/bin/screen -d -m -S ASTVDauto $PATHhome/AST_VDauto_dial.pl`; + } +if ( ($AST_VDremote_agents > 0) && ($runningAST_VDremote_agents < 1) ) + { + if ($DB) {print "starting AST_VDremote_agents...\n";} + # add a '-L' to the command below to activate logging + `/usr/bin/screen -d -m -S ASTVDremote $PATHhome/AST_VDremote_agents.pl`; + } +if ( ($AST_VDadapt > 0) && ($runningAST_VDadapt < 1) ) + { + if ($DB) {print "starting AST_VDadapt...\n";} + # add a '-L' to the command below to activate logging + `/usr/bin/screen -d -m -S ASTVDadapt $PATHhome/AST_VDadapt.pl --debug`; + } +if ( ($FastAGI_log > 0) && ($runningFastAGI_log < 1) ) + { + if ($DB) {print "starting FastAGI_log...\n";} + # add a '-L' to the command below to activate logging + `/usr/bin/screen -d -m -S ASTfastlog $PATHhome/FastAGI_log.pl --debug`; + } +if ( ($AST_VDauto_dial_FILL > 0) && ($runningAST_VDauto_dial_FILL < 1) ) + { + if ($DB) {print "starting AST_VDauto_dial_FILL...\n";} + # add a '-L' to the command below to activate logging + `/usr/bin/screen -d -m -S ASTVDautoFILL $PATHhome/AST_VDauto_dial_FILL.pl`; + } +} + + + + +if ($DB) {print "DONE\n";} + +exit; diff --git a/agc_2-X/branches/agc_2.0.4/bin/ADMIN_restart_roll_logs.pl b/agc_2-X/branches/agc_2.0.4/bin/ADMIN_restart_roll_logs.pl new file mode 100644 index 00000000..3fc0c12b --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/ADMIN_restart_roll_logs.pl @@ -0,0 +1,40 @@ +#!/usr/bin/perl +# ADMIN_restart_roll_logs.pl - script to roll the Asterisk logs on machine restart +# have this run on the astersik server +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday---$hour$min$sec"; + + +print "rolling Asterisk messages log...\n"; +`mv -f /var/log/asterisk/messages /var/log/asterisk/messages.$now_date`; + +print "rolling Asterisk event log...\n"; +`mv -f /var/log/asterisk/event_log /var/log/asterisk/event_log.$now_date`; + +print "rolling Asterisk cdr logs...\n"; +`mv -f /var/log/asterisk/cdr-csv/Master.csv /var/log/asterisk/cdr-csv/Master.csv.$now_date`; +`mv -f /var/log/asterisk/cdr-custom/Master.csv /var/log/asterisk/cdr-custom/Master.csv.$now_date`; + +print "rolling Asterisk screen log...\n"; +`mv -f /screenlog.0 /screenlog.0.$now_date`; + +print "rolling Asterisk root screen log...\n"; +`mv -f /root/screenlog.0 /root/screenlog.0.$now_date`; + + +print "FINISHED... EXITING\n"; + +exit; diff --git a/agc_2-X/branches/agc_2.0.4/bin/ADMIN_update_server_ip.pl b/agc_2-X/branches/agc_2.0.4/bin/ADMIN_update_server_ip.pl new file mode 100644 index 00000000..2ce4ba30 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/ADMIN_update_server_ip.pl @@ -0,0 +1,420 @@ +#!/usr/bin/perl + +# ADMIN_update_server_ip.pl - updates IP address in DB and conf file +# +# This script is designed to update all database tables and the local +# astguiclient.conf file to reflect a change in IP address. The script will +# automatically default to the first eth address in the ifconfig output. +# +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# +# CHANGELOG +# 71205-2144 - added display of extensions.conf example for call routing +# +# +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARold_server_ip = $line; $VARold_server_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +############################################ + +$CLIold_server_ip=0; +$CLIserver_ip=0; + +$secX = time(); + +# constants +$DB=1; # Debug flag, set to 0 for no debug messages, lots of output +$US='_'; +$MT[0]=''; + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help/i) + { + print "ADMIN_update_server_ip.pl - updates server_ip in the $VARDB_database\n"; + print "database and in the local /etc/astguiclient.conf file.\n"; + print "\n"; + print "command-line options:\n"; + print " [--help] = this help screen\n"; + print " [--debug] = verbose debug messages\n"; + print " [--auto] = no prompts\n"; + print "configuration options:\n"; + print " [--old-server_ip=192.168.0.1] = define old server IP address at runtime\n"; + print " [--server_ip=192.168.0.2] = define new server IP address at runtime\n"; + print "\n"; + + exit; + } + else + { + if ($args =~ /--debug/i) # Debug flag + { + $DB=1; + } + if ($args =~ /--auto/i) # no prompts flag + { + $AUTO=1; + } + if ($args =~ /--old-server_ip=/i) # CLI defined old server IP address + { + @CLIoldserver_ipARY = split(/--old-server_ip=/,$args); + @CLIoldserver_ipARX = split(/ /,$CLIoldserver_ipARY[1]); + if (length($CLIoldserver_ipARX[0])>2) + { + $VARold_server_ip = $CLIoldserver_ipARX[0]; + $VARold_server_ip =~ s/\/$| |\r|\n|\t//gi; + $CLIold_server_ip=1; + print " CLI defined old server IP: $VARold_server_ip\n"; + } + } + if ($args =~ /--server_ip=/i) # CLI defined server IP address + { + @CLIserver_ipARY = split(/--server_ip=/,$args); + @CLIserver_ipARX = split(/ /,$CLIserver_ipARY[1]); + if (length($CLIserver_ipARX[0])>2) + { + $VARserver_ip = $CLIserver_ipARX[0]; + $VARserver_ip =~ s/\/$| |\r|\n|\t//gi; + $CLIserver_ip=1; + print " CLI defined server IP: $VARserver_ip\n"; + } + } + } +} +else +{ +# print "no command line options set\n"; +} +### end parsing run-time options ### + +if (-e "$PATHconf") + { + print "Previous astGUIclient configuration file found at: $PATHconf\n"; + open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; + @conf = ; + close(conf); + $i=0; + foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} +# if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) +# {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + if ( ($line =~ /^VARactive_keepalives/) && ($CLIactive_keepalives < 1) ) + {$VARactive_keepalives = $line; $VARactive_keepalives =~ s/.*=//gi;} + if ( ($line =~ /^VARfastagi_log_min_servers/) && ($CLIVARfastagi_log_min_servers < 1) ) + {$VARfastagi_log_min_servers = $line; $VARfastagi_log_min_servers =~ s/.*=//gi;} + if ( ($line =~ /^VARfastagi_log_max_servers/) && ($CLIVARfastagi_log_max_servers < 1) ) + {$VARfastagi_log_max_servers = $line; $VARfastagi_log_max_servers =~ s/.*=//gi;} + if ( ($line =~ /^VARfastagi_log_min_spare_servers/) && ($CLIVARfastagi_log_min_spare_servers < 1) ) + {$VARfastagi_log_min_spare_servers = $line; $VARfastagi_log_min_spare_servers =~ s/.*=//gi;} + if ( ($line =~ /^VARfastagi_log_max_spare_servers/) && ($CLIVARfastagi_log_max_spare_servers < 1) ) + {$VARfastagi_log_max_spare_servers = $line; $VARfastagi_log_max_spare_servers =~ s/.*=//gi;} + if ( ($line =~ /^VARfastagi_log_max_requests/) && ($CLIVARfastagi_log_max_requests < 1) ) + {$VARfastagi_log_max_requests = $line; $VARfastagi_log_max_requests =~ s/.*=//gi;} + if ( ($line =~ /^VARfastagi_log_checkfordead/) && ($CLIVARfastagi_log_checkfordead < 1) ) + {$VARfastagi_log_checkfordead = $line; $VARfastagi_log_checkfordead =~ s/.*=//gi;} + if ( ($line =~ /^VARfastagi_log_checkforwait/) && ($CLIVARfastagi_log_checkforwait < 1) ) + {$VARfastagi_log_checkforwait = $line; $VARfastagi_log_checkforwait =~ s/.*=//gi;} + $i++; + } + } + +if ($AUTO) + { + $manual='n'; + @ip = `/sbin/ifconfig`; + $j=0; + while($#ip>=$j) + { + if ($ip[$j] =~ /inet addr/) {$VARserver_ip = $ip[$j]; $j=1000;} + $j++; + } + $VARserver_ip =~ s/.*addr:| Bcast.*|\r|\n|\t| //gi; + } +else + { + print("\nWould you like to use interactive mode (y/n): [y] "); + $manual = ; + chomp($manual); + } + +if ($manual =~ /n/i) + { + $manual=0; + } +else + { + $config_finished='NO'; + while ($config_finished =~/NO/) + { + print "\nSTARTING SERVER IP ADDRESS CHANGE FOR VICIDIAL...\n"; + + ##### BEGIN old_server_ip propmting and check ##### + $continue='NO'; + while ($continue =~/NO/) + { + print("\nOld server IP address or press enter for default: [$VARold_server_ip] "); + $PROMPTold_server_ip = ; + chomp($PROMPTold_server_ip); + if (length($PROMPTold_server_ip)>6) + { + $PROMPTold_server_ip =~ s/ |\n|\r|\t|\/$//gi; + $VARold_server_ip=$PROMPTold_server_ip; + $continue='YES'; + } + else + { + $continue='YES'; + } + } + ##### END old_server_ip propmting and check ##### + + ##### BEGIN server_ip propmting and check ##### + if (length($VARserver_ip)<7) + { + ### get best guess of IP address from ifconfig output ### + # inet addr:10.10.11.17 Bcast:10.10.255.255 Mask:255.255.0.0 + @ip = `/sbin/ifconfig`; + $j=0; + while($#ip>=$j) + { + if ($ip[$j] =~ /inet addr/) {$VARserver_ip = $ip[$j]; $j=1000;} + $j++; + } + $VARserver_ip =~ s/.*addr:| Bcast.*|\r|\n|\t| //gi; + } + + $continue='NO'; + while ($continue =~/NO/) + { + print("\nserver IP address or press enter for default: [$VARserver_ip] "); + $PROMPTserver_ip = ; + chomp($PROMPTserver_ip); + if (length($PROMPTserver_ip)>6) + { + $PROMPTserver_ip =~ s/ |\n|\r|\t|\/$//gi; + $VARserver_ip=$PROMPTserver_ip; + $continue='YES'; + } + else + { + $continue='YES'; + } + } + ##### END server_ip propmting and check ##### + + + + print "\n"; + print " old server_ip: $VARold_server_ip\n"; + print " new server_ip: $VARserver_ip\n"; + print "\n"; + + print("Are these settings correct?(y/n): [y] "); + $PROMPTconfig = ; + chomp($PROMPTconfig); + if ( (length($PROMPTconfig)<1) or ($PROMPTconfig =~ /y/i) ) + { + $config_finished='YES'; + } + } + } + +print "Writing change to astguiclient.conf file: $PATHconf\n"; + +open(conf, ">$PATHconf") || die "can't open $PATHconf: $!\n"; +print conf "# astguiclient.conf - configuration elements for the astguiclient package\n"; +print conf "# this is the astguiclient configuration file \n"; +print conf "# all comments will be lost if you run install.pl again\n"; +print conf "\n"; +print conf "# Paths used by astGUIclient\n"; +print conf "PATHhome => $PATHhome\n"; +print conf "PATHlogs => $PATHlogs\n"; +print conf "PATHagi => $PATHagi\n"; +print conf "PATHweb => $PATHweb\n"; +print conf "PATHsounds => $PATHsounds\n"; +print conf "PATHmonitor => $PATHmonitor\n\n"; +print conf "\n"; +print conf "# The IP address of this machine\n"; +print conf "VARserver_ip => $VARserver_ip\n"; +print conf "\n"; +print conf "# Database connection information\n"; +print conf "VARDB_server => $VARDB_server\n"; +print conf "VARDB_database => $VARDB_database\n"; +print conf "VARDB_user => $VARDB_user\n"; +print conf "VARDB_pass => $VARDB_pass\n"; +print conf "VARDB_port => $VARDB_port\n"; +print conf "\n"; +print conf "# Alpha-Numeric list of the astGUIclient processes to be kept running\n"; +print conf "# (value should be listing of characters with no spaces: 123456)\n"; +print conf "# X - NO KEEPALIVE PROCESSES (use only if you want none to be keepalive)\n"; +print conf "# 1 - AST_update\n"; +print conf "# 2 - AST_send_listen\n"; +print conf "# 3 - AST_VDauto_dial\n"; +print conf "# 4 - AST_VDremote_agents\n"; +print conf "# 5 - AST_VDadapt (If multi-server system, this must only be on one server)\n"; +print conf "# 6 - FastAGI_log\n"; +print conf "# 7 - AST_VDauto_dial_FILL (only for multi-server, this must only be on one server)\n"; +print conf "VARactive_keepalives => $VARactive_keepalives\n"; +print conf "\n"; +print conf "# Settings for FastAGI logging server\n"; +print conf "VARfastagi_log_min_servers => $VARfastagi_log_min_servers\n"; +print conf "VARfastagi_log_max_servers => $VARfastagi_log_max_servers\n"; +print conf "VARfastagi_log_min_spare_servers => $VARfastagi_log_min_spare_servers\n"; +print conf "VARfastagi_log_max_spare_servers => $VARfastagi_log_max_spare_servers\n"; +print conf "VARfastagi_log_max_requests => $VARfastagi_log_max_requests\n"; +print conf "VARfastagi_log_checkfordead => $VARfastagi_log_checkfordead\n"; +print conf "VARfastagi_log_checkforwait => $VARfastagi_log_checkforwait\n"; +close(conf); + + +print "\nSTARTING DATABASE TABLES UPDATES PHASE...\n"; + +if (!$VARDB_port) {$VARDB_port='3306';} + +use DBI; +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +print " Updating servers table...\n"; +$stmtA = "UPDATE servers SET server_ip='$VARserver_ip' where server_ip='$VARold_server_ip';"; +$affected_rows = $dbhA->do($stmtA); +if ($DB) {print " |$affected_rows|$stmtA|\n";} + +print " Updating phones table...\n"; +$stmtA = "UPDATE phones SET server_ip='$VARserver_ip' where server_ip='$VARold_server_ip';"; +$affected_rows = $dbhA->do($stmtA); +if ($DB) {print " |$affected_rows|$stmtA|\n";} + +print " Updating inbound_numbers table...\n"; +$stmtA = "UPDATE inbound_numbers SET server_ip='$VARserver_ip' where server_ip='$VARold_server_ip';"; +$affected_rows = $dbhA->do($stmtA); +if ($DB) {print " |$affected_rows|$stmtA|\n";} + +print " Updating server_updater table...\n"; +$stmtA = "UPDATE server_updater SET server_ip='$VARserver_ip' where server_ip='$VARold_server_ip';"; +$affected_rows = $dbhA->do($stmtA); +if ($DB) {print " |$affected_rows|$stmtA|\n";} + +print " Updating conferences table...\n"; +$stmtA = "UPDATE conferences SET server_ip='$VARserver_ip' where server_ip='$VARold_server_ip';"; +$affected_rows = $dbhA->do($stmtA); +if ($DB) {print " |$affected_rows|$stmtA|\n";} + +print " Updating vicidial_conferences table...\n"; +$stmtA = "UPDATE vicidial_conferences SET server_ip='$VARserver_ip' where server_ip='$VARold_server_ip';"; +$affected_rows = $dbhA->do($stmtA); +if ($DB) {print " |$affected_rows|$stmtA|\n";} + +print " Updating vicidial_stations table...\n"; +$stmtA = "UPDATE vicidial_stations SET server_ip='$VARserver_ip' where server_ip='$VARold_server_ip';"; +$affected_rows = $dbhA->do($stmtA); +if ($DB) {print " |$affected_rows|$stmtA|\n";} + +print " Updating vicidial_remote_agents table...\n"; +$stmtA = "UPDATE vicidial_remote_agents SET server_ip='$VARserver_ip' where server_ip='$VARold_server_ip';"; +$affected_rows = $dbhA->do($stmtA); +if ($DB) {print " |$affected_rows|$stmtA|\n";} + +print " Updating phone_favorites table...\n"; +$stmtA = "UPDATE phone_favorites SET server_ip='$VARserver_ip' where server_ip='$VARold_server_ip';"; +$affected_rows = $dbhA->do($stmtA); +if ($DB) {print " |$affected_rows|$stmtA|\n";} + +print " Updating vicidial_server_trunks table...\n"; +$stmtA = "UPDATE vicidial_server_trunks SET server_ip='$VARserver_ip' where server_ip='$VARold_server_ip';"; +$affected_rows = $dbhA->do($stmtA); +if ($DB) {print " |$affected_rows|$stmtA|\n";} + +$dbhA->disconnect(); + +### format the new server_ip dialstring for example to use with extensions.conf +$S='*'; +if( $VARserver_ip =~ m/(\S+)\.(\S+)\.(\S+)\.(\S+)/ ) + { + $a = leading_zero($1); + $b = leading_zero($2); + $c = leading_zero($3); + $d = leading_zero($4); + $VARremDIALstr = "$a$S$b$S$c$S$d"; + } + +print "\nSERVER IP ADDRESS CHANGE FOR VICIDIAL FINISHED!\n"; +print "\nPlease remember to change your extensions.conf entries for the new IP address:\n"; +print "exten => _$VARremDIALstr*8600XXX,1,Goto(default,${EXTEN:16},1)\n"; +print "exten => _$VARremDIALstr*8600XXX*.,1,Goto(default,${EXTEN:16},1)\n"; +print "exten => _$VARremDIALstr*78600XXX,1,Goto(default,${EXTEN:16},1)\n"; +print "exten => _$VARremDIALstr*78600XXX*.,1,Goto(default,${EXTEN:16},1)\n"; +print "exten => _8600XXX*.,1,AGI(agi-VDADfixCXFER.agi)\n"; +print "exten => _78600XXX*.,1,AGI(agi-VDADfixCXFER.agi)\n"; + + +$secy = time(); $secz = ($secy - $secX); $minz = ($secz/60); # calculate script runtime so far +print "\n - process runtime ($secz sec) ($minz minutes)\n"; + + +exit; + + +sub leading_zero($) +{ + $_ = $_[0]; + s/^(\d)$/0$1/; + s/^(\d\d)$/0$1/; + return $_; +} # End of the leading_zero() routine. + diff --git a/agc_2-X/branches/agc_2.0.4/bin/AST_CRON_GSM_SALE_recordings.pl b/agc_2-X/branches/agc_2.0.4/bin/AST_CRON_GSM_SALE_recordings.pl new file mode 100644 index 00000000..c4a2dc7d --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/AST_CRON_GSM_SALE_recordings.pl @@ -0,0 +1,164 @@ +#!/usr/bin/perl +# +# AST_CRON_GSM_SALE_recordings.pl +# +# IMPORTANT!!! used to delete recordings!!! +# +# runs every day, goes through all recordings to compress only the SALE recordings +# and place them in a special directory +# +# put an entry into the cron of of your asterisk archive to run this script +# every day or however often you desire +# +# This program assumes that recordings are saved as .wav +# should be easy to change this code if you use .gsm instead +# +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# +# +# 1112-1245 - first build +# + +$save_statuses = '|SALE|UPSALE|UPSELL|XFER|A1|A2|A3|A4|'; +$save_statusesSQL = "'SALE','UPSALE','UPSELL','XFER','A1','A2','A3','A4'"; +$suffix = '-all.wav'; +$local_DIR = '/home2/cron/RECORDINGS'; +$GSM_DIR = '/home/cron/GSM'; +$use_date_DIRs = 1; + +$secX = time(); + +$TDtarget = ($secX - 36000); # 10 hours ago + +($Tsec,$Tmin,$Thour,$Tmday,$Tmon,$Tyear,$Twday,$Tyday,$Tisdst) = localtime($TDtarget); +$Tyear = ($Tyear + 1900); +$Tmon++; +if ($Tmon < 10) {$Tmon = "0$Tmon";} +if ($Tmday < 10) {$Tmday = "0$Tmday";} +if ($Thour < 10) {$Thour = "0$Thour";} +if ($Tmin < 10) {$Tmin = "0$Tmin";} +if ($Tsec < 10) {$Tsec = "0$Tsec";} + $BEGINdate = "$Tyear-$Tmon-$Tmday 00:00:00"; + $ENDdate = "$Tyear-$Tmon-$Tmday 23:59:59"; + + $BEGINdate = "2007-08-01 00:00:00"; + $ENDdate = "2007-08-31 23:59:59"; + +$soxbin = ''; +if ( -e ('/usr/bin/sox')) {$soxbin = '/usr/bin/sox';} +else + { + if ( -e ('/usr/local/bin/sox')) {$soxbin = '/usr/local/bin/sox';} + else + { + print "Can't find sox binary! Exiting...\n"; + exit; + } + } + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP +if (!$VARDB_port) {$VARDB_port='3306';} + +use DBI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### directory where in/out recordings are saved to by Asterisk +$dir1 = "$PATHmonitor"; + + +##### Get the lead_ids of all recordings that are not DELETED or NULL ##### +$stmtA = "SELECT recording_log.lead_id,recording_id,start_time,filename,location,status FROM recording_log,vicidial_log where start_time > '$BEGINdate' and start_time < '$ENDdate' and location IS NOT NULL and location NOT IN('','NOT_FOUND','NOT_FOUND_2','DELETED') and vicidial_log.status IN($save_statusesSQL) and call_date > '$BEGINdate' and call_date < '$ENDdate' and recording_log.lead_id=vicidial_log.lead_id and recording_log.user=vicidial_log.user order by recording_id LIMIT 500000;"; + print "$stmtA\n"; + +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$i=0; +while ($sthArows > $i) + { + @aryA = $sthA->fetchrow_array; + $lead_ids[$i] = "$aryA[0]"; + $recording_ids[$i] = "$aryA[1]"; + $start_times[$i] = "$aryA[2]"; + $filenames[$i] = "$aryA[3]"; + $locations[$i] = "$aryA[4]"; + $status[$i] = "$aryA[5]"; + $i++; + } +$sthA->finish(); + + +##### Go through the list of sales recordings and compress all of them ##### +$i=0; +$WAV='-all.wav'; +$GSM='-all.gsm'; +foreach(@lead_ids) + { + if ($use_date_DIRs) + { + $date_DIR = $start_times[$i]; + $date_DIR =~ s/ .*//gi; + $date_DIR .= "/"; + } + else {$date_DIR=''} + if ( -e ("$GSM_DIR/$date_DIR")) {$nothing=1;} + else {mkdir("$GSM_DIR/$date_DIR");} + if ( -e ("$GSM_DIR/$date_DIR$filenames[$i]$GSM")) + {print "DUPLICATE: $GSM_DIR/$date_DIR$filenames[$i]$GSM EXISTS\n";} + else + { + `$soxbin "$local_DIR/$date_DIR$filenames[$i]$WAV" "$GSM_DIR/$date_DIR$filenames[$i]$GSM"`; + print "$soxbin \"$local_DIR/$date_DIR$filenames[$i]$WAV\" \"$GSM_DIR/$date_DIR$filenames[$i]$GSM\"\n"; + } + $i++; + } + +print "TOTAL COMPRESSED: $i\n"; + +if ($v) {print "DONE... EXITING\n\n";} + +$dbhA->disconnect(); + + +exit; diff --git a/agc_2-X/branches/agc_2.0.4/bin/AST_CRON_mix_recordings.pl b/agc_2-X/branches/agc_2.0.4/bin/AST_CRON_mix_recordings.pl new file mode 100644 index 00000000..39e98e24 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/AST_CRON_mix_recordings.pl @@ -0,0 +1,183 @@ +#!/usr/bin/perl +# +# AST_CRON_mix_recordings.pl +# runs every 5 minutes and mixes the call recordings in the monitor together +# and puts the resulting ALL file into the DONE directory in the "monitor" dir +# +# soxmix is REQUIRED to use this script, soxmix is available only as part of +# the sox audio package, and only in newer versions. Make sure you have soxmix +# installed properly and in your path +# +# put an entry into the cron of of your asterisk machine to run this script +# every 5 minutes or however often you desire +# +# make sure that the following directories exist: +# /var/spool/asterisk/monitor # default Asterisk recording directory +# /var/spool/asterisk/monitor/DONE # where the combined files are put +# /var/spool/asterisk/monitor/ORIG # where the original in/out files are put +# +# This program assumes that recordings are saved as .wav +# should be easy to change this code if you use .gsm instead +# +# This program also sends the ALL combined file to an FTP server for archival +# purposes, you can comment out the Net::Ping and Net::FTP lines as well as the +# file transfer section of the code to deactivate remote copying of the +# recording files +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# +# 51021-1058 - Added quotes around CLI executed commands +# 51122-1458 - Added soxmix binary path check +# 60318-0921 - Added ability to mix gsm audio files +# 60807-1308 - Modified to use /etc/astguiclient.conf for settings +# 71004-1124 - Changed to not move ORIG recordings if FTP server does not Ping +# 71005-0049 - Altered script to use astguiclient.conf for settings +# + + +#$v=1; + +# Default variables for FTP +$VARFTP_host = '10.0.0.4'; +$VARFTP_user = 'cron'; +$VARFTP_pass = 'test'; +$VARFTP_dir = 'RECORDINGS'; + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /PATHDONEmonitor/) && ($CLIDONEmonitor < 1) ) + {$PATHDONEmonitor = $line; $PATHDONEmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + if ( ($line =~ /^VARFTP_host/) && ($CLIFTP_host < 1) ) + {$VARFTP_host = $line; $VARFTP_host =~ s/.*=//gi;} + if ( ($line =~ /^VARFTP_user/) && ($CLIFTP_user < 1) ) + {$VARFTP_user = $line; $VARFTP_user =~ s/.*=//gi;} + if ( ($line =~ /^VARFTP_pass/) && ($CLIFTP_pass < 1) ) + {$VARFTP_pass = $line; $VARFTP_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARFTP_port/) && ($CLIFTP_port < 1) ) + {$VARFTP_port = $line; $VARFTP_port =~ s/.*=//gi;} + if ( ($line =~ /^VARFTP_dir/) && ($CLIFTP_dir < 1) ) + {$VARFTP_dir = $line; $VARFTP_dir =~ s/.*=//gi;} + if ( ($line =~ /^VARHTTP_path/) && ($CLIHTTP_path < 1) ) + {$VARHTTP_path = $line; $VARHTTP_path =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +### directory where in/out recordings are saved to by Asterisk +$dir1 = "$PATHmonitor"; +$dir2 = "$PATHDONEmonitor"; + +$soxmixbin = ''; +if ( -e ('/usr/bin/soxmix')) {$soxmixbin = '/usr/bin/soxmix';} +else + { + if ( -e ('/usr/local/bin/soxmix')) {$soxmixbin = '/usr/local/bin/soxmix';} + else + { + print "Can't find soxmix binary! Exiting...\n"; + exit; + } + } + +use Net::Ping; +use Net::FTP; + + + opendir(FILE, "$dir1/"); + @FILES = readdir(FILE); + +$i=0; +foreach(@FILES) + { + $size1 = 0; + $size2 = 0; + + if ( (length($FILES[$i]) > 4) && (!-d $FILES[$i]) ) + { + + $size1 = (-s "$dir1/$FILES[$i]"); + if ($v) {print "$FILES[$i] $size1\n";} + sleep(1); + $size2 = (-s "$dir1/$FILES[$i]"); + if ($v) {print "$FILES[$i] $size2\n\n";} + + if ( ($FILES[$i] !~ /out\.wav|out\.gsm/i) && ($size1 eq $size2) && (length($FILES[$i]) > 4)) + { + $INfile = $FILES[$i]; + $OUTfile = $FILES[$i]; + $OUTfile =~ s/-in\.wav/-out.wav/gi; + $OUTfile =~ s/-in\.gsm/-out.gsm/gi; + $ALLfile = $FILES[$i]; + $ALLfile =~ s/-in\.wav/-all.wav/gi; + $ALLfile =~ s/-in\.gsm/-all.gsm/gi; + + if ($v) {print "|$INfile| |$OUTfile| |$ALLfile|\n\n";} + + ### BEGIN Remote file transfer + $p = Net::Ping->new(); + $ping_good = $p->ping("$VARFTP_host"); + + if ($ping_good) + { + `$soxmixbin "$dir1/$INfile" "$dir1/$OUTfile" "$dir2/$ALLfile"`; + if ($v) {print "|$INfile| |$OUTfile| |$ALLfile|\n\n";} + if (!$T) + { + `mv -f "$dir1/$INfile" "$dir2/ORIG/$INfile"`; + `mv -f "$dir1/$OUTfile" "$dir2/ORIG/$OUTfile"`; + } + + $ftp = Net::FTP->new("$VARFTP_host", Port => 21); + $ftp->login("$VARFTP_user","$VARFTP_pass"); + $ftp->cwd("$VARFTP_dir"); + $ftp->binary(); + $ftp->put("$dir2/$ALLfile", "$ALLfile"); + $ftp->quit; + } + ### END Remote file transfer + + } + } + $i++; + } + +if ($v) {print "DONE... EXITING\n\n";} + +exit; diff --git a/agc_2-X/branches/agc_2.0.4/bin/AST_CRON_mix_recordings_BASIC.pl b/agc_2-X/branches/agc_2.0.4/bin/AST_CRON_mix_recordings_BASIC.pl new file mode 100644 index 00000000..ef2f661d --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/AST_CRON_mix_recordings_BASIC.pl @@ -0,0 +1,139 @@ +#!/usr/bin/perl +# +# AST_CRON_mix_recordings_BASIC.pl +# runs every 5 minutes and mixes the call recordings in the monitor together +# and puts the resulting ALL file into the DONE directory in the "monitor" dir +# +# soxmix is REQUIRED to use this script, soxmix is available only as part of +# the sox audio package, and only in newer versions. Make sure you have soxmix +# installed properly and in your path +# +# put an entry into the cron of of your asterisk machine to run this script +# every 5 minutes or however often you desire +# +# make sure that the following directories exist: +# /var/spool/asterisk/monitor # default Asterisk recording directory +# /var/spool/asterisk/monitor/DONE # where the combined files are put +# /var/spool/asterisk/monitor/ORIG # where the original in/out files are put +# +# This program assumes that recordings are saved as .wav +# should be easy to change this code if you use .gsm instead +# +# This program also sends the ALL combined file to an FTP server for archival +# purposes, you can comment out the Net::Ping and Net::FTP lines as well as the +# file transfer section of the code to deactivate remote copying of the +# recording files +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# +# 51021-1058 - Added quotes around CLI executed commands +# 51122-1456 - Added soxmix binary path check +# 60318-0921 - Added ability to mix gsm audio files +# 60807-1308 - Modified to use /etc/astguiclient.conf for settings +# + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +### directory where in/out recordings are saved to by Asterisk +$dir1 = "$PATHmonitor"; + +$soxmixbin = ''; +if ( -e ('/usr/bin/soxmix')) {$soxmixbin = '/usr/bin/soxmix';} +else + { + if ( -e ('/usr/local/bin/soxmix')) {$soxmixbin = '/usr/local/bin/soxmix';} + else + { + print "Can't find soxmix binary! Exiting...\n"; + exit; + } + } + + opendir(FILE, "$dir1/"); + @FILES = readdir(FILE); + +$i=0; +foreach(@FILES) + { + $size1 = 0; + $size2 = 0; + + if ( (length($FILES[$i]) > 4) && (!-d $FILES[$i]) ) + { + + $size1 = (-s "$dir1/$FILES[$i]"); + if ($v) {print "$FILES[$i] $size1\n";} + sleep(1); + $size2 = (-s "$dir1/$FILES[$i]"); + if ($v) {print "$FILES[$i] $size2\n\n";} + + + if ( ($FILES[$i] !~ /out\.wav|out\.gsm/i) && ($size1 eq $size2) && (length($FILES[$i]) > 4)) + { + $INfile = $FILES[$i]; + $OUTfile = $FILES[$i]; + $OUTfile =~ s/-in\.wav/-out.wav/gi; + $OUTfile =~ s/-in\.gsm/-out.gsm/gi; + $ALLfile = $FILES[$i]; + $ALLfile =~ s/-in\.wav/-all.wav/gi; + $ALLfile =~ s/-in\.gsm/-all.gsm/gi; + + if ($v) {print "|$INfile| |$OUTfile| |$ALLfile|\n\n";} + + `$soxmixbin "$dir1/$INfile" "$dir1/$OUTfile" "$dir1/$ALLfile"`; + if ($v) {print "|$INfile| |$OUTfile| |$ALLfile|\n\n";} + if (!$T) + { + `mv -f "$dir1/$INfile" "$dir1/ORIG/$INfile"`; + `mv -f "$dir1/$OUTfile" "$dir1/ORIG/$OUTfile"`; + `mv -f "$dir1/$ALLfile" "$dir1/DONE/$ALLfile"`; + } + } + } + $i++; + } + +if ($v) {print "DONE... EXITING\n\n";} + +exit; diff --git a/agc_2-X/branches/agc_2.0.4/bin/AST_CRON_mix_recordings_GSM.pl b/agc_2-X/branches/agc_2.0.4/bin/AST_CRON_mix_recordings_GSM.pl new file mode 100644 index 00000000..56e2fe7b --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/AST_CRON_mix_recordings_GSM.pl @@ -0,0 +1,204 @@ +#!/usr/bin/perl +# +# AST_CRON_mix_recordings_GSM.pl +# runs every 5 minutes and mixes the call recordings in the monitor together +# and puts the resulting ALL file into the DONE directory in the "monitor" dir +# and converts the ALL file to GSM format to save space. +# +# soxmix is REQUIRED to use this script, soxmix is available only as part of +# the sox audio package, and only in newer versions. Make sure you have soxmix +# installed properly and in your path +# +# put an entry into the cron of of your asterisk machine to run this script +# every 5 minutes or however often you desire +# +# make sure that the following directories exist: +# /var/spool/asterisk/monitor # default Asterisk recording directory +# /var/spool/asterisk/monitor/DONE # where the combined files are put +# /var/spool/asterisk/monitor/ORIG # where the original in/out files are put +# +# This program assumes that recordings are saved as .wav +# should be easy to change this code if you use .gsm instead +# +# This program also sends the ALL combined file to an FTP server for archival +# purposes, you can comment out the Net::Ping and Net::FTP lines as well as the +# file transfer section of the code to deactivate remote copying of the +# recording files +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# +# 51021-1058 - Added quotes around CLI executed commands +# 51122-1455 - Added soxmix and sox binary path check +# 60807-1308 - Modified to use /etc/astguiclient.conf for settings +# 71004-1124 - Changed to not move ORIG recordings if FTP server does not Ping +# 71005-0049 - Altered script to use astguiclient.conf for settings +# + + +# Default variables for FTP +$VARFTP_host = '10.0.0.4'; +$VARFTP_user = 'cron'; +$VARFTP_pass = 'test'; +$VARFTP_dir = 'RECORDINGS'; +$VARFTP_port = '21'; + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /PATHDONEmonitor/) && ($CLIDONEmonitor < 1) ) + {$PATHDONEmonitor = $line; $PATHDONEmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + if ( ($line =~ /^VARFTP_host/) && ($CLIFTP_host < 1) ) + {$VARFTP_host = $line; $VARFTP_host =~ s/.*=//gi;} + if ( ($line =~ /^VARFTP_user/) && ($CLIFTP_user < 1) ) + {$VARFTP_user = $line; $VARFTP_user =~ s/.*=//gi;} + if ( ($line =~ /^VARFTP_pass/) && ($CLIFTP_pass < 1) ) + {$VARFTP_pass = $line; $VARFTP_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARFTP_port/) && ($CLIFTP_port < 1) ) + {$VARFTP_port = $line; $VARFTP_port =~ s/.*=//gi;} + if ( ($line =~ /^VARFTP_dir/) && ($CLIFTP_dir < 1) ) + {$VARFTP_dir = $line; $VARFTP_dir =~ s/.*=//gi;} + if ( ($line =~ /^VARHTTP_path/) && ($CLIHTTP_path < 1) ) + {$VARHTTP_path = $line; $VARHTTP_path =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +### directory where in/out recordings are saved to by Asterisk +$dir1 = "$PATHmonitor"; +$dir2 = "$PATHDONEmonitor"; + +$soxmixbin = ''; +if ( -e ('/usr/bin/soxmix')) {$soxmixbin = '/usr/bin/soxmix';} +else + { + if ( -e ('/usr/local/bin/soxmix')) {$soxmixbin = '/usr/local/bin/soxmix';} + else + { + print "Can't find soxmix binary! Exiting...\n"; + exit; + } + } +$soxbin = ''; +if ( -e ('/usr/bin/sox')) {$soxbin = '/usr/bin/sox';} +else + { + if ( -e ('/usr/local/bin/sox')) {$soxbin = '/usr/local/bin/sox';} + else + { + print "Can't find sox binary! Exiting...\n"; + exit; + } + } + +use Net::Ping; +use Net::FTP; + + + opendir(FILE, "$dir1/"); + @FILES = readdir(FILE); + +$i=0; +foreach(@FILES) + { + $size1 = 0; + $size2 = 0; + + if ( (length($FILES[$i]) > 4) && (!-d $FILES[$i]) ) + { + + $size1 = (-s "$dir1/$FILES[$i]"); + if ($v) {print "$FILES[$i] $size1\n";} + sleep(1); + $size2 = (-s "$dir1/$FILES[$i]"); + if ($v) {print "$FILES[$i] $size2\n\n";} + + + if ( ($FILES[$i] !~ /out\.wav/i) && ($size1 eq $size2) && (length($FILES[$i]) > 4)) + { + $INfile = $FILES[$i]; + $OUTfile = $FILES[$i]; + $OUTfile =~ s/-in\.wav/-out.wav/gi; + $ALLfile = $FILES[$i]; + $ALLfile =~ s/-in\.wav/-all.wav/gi; + $GSMfile = $ALLfile; + $GSMfile =~ s/-all\.wav/-all.gsm/gi; + + if ($v) {print "|$INfile| |$OUTfile| |$ALLfile|\n\n";} + + ### BEGIN Remote file transfer + $p = Net::Ping->new(); + $ping_good = $p->ping("$VARFTP_host"); + + if ($ping_good) + { + `$soxmixbin "$dir1/$INfile" "$dir1/$OUTfile" "$dir2/$ALLfile"`; + if ($v) {print "|$INfile| |$OUTfile| |$ALLfile|\n\n";} + if (!$T) + { + `mv -f "$dir1/$INfile" "$dir2/ORIG/$INfile"`; + `mv -f "$dir1/$OUTfile" "$dir2/ORIG/$OUTfile"`; + } + + `$soxbin "$dir2/$ALLfile" "$dir2/$GSMfile"`; + + if (!$T) + { + `rm -f "$dir2/$ALLfile"`; + } + + if($DB){print STDERR "\n|/usr/bin/sox $live_folder/$filename[$k]$WAV $arch_folder/$filename[$k]$GSM|\n";} + chmod 0755, "$dir2/$GSMfile"; + + $ftp = Net::FTP->new("$VARFTP_host", Port => $VARFTP_port, Debug => 0, Passive => 1); + $ftp->login("$VARFTP_user","$VARFTP_pass"); + $ftp->cwd("$VARFTP_dir"); + $ftp->binary(); + $ftp->put("$dir2/$GSMfile", "$GSMfile"); + $ftp->quit; + } + ### END Remote file transfer + + } + } + $i++; + } + +if ($v) {print "DONE... EXITING\n\n";} + +exit; diff --git a/agc_2-X/branches/agc_2.0.4/bin/AST_CRON_mix_recordings_MP3.pl b/agc_2-X/branches/agc_2.0.4/bin/AST_CRON_mix_recordings_MP3.pl new file mode 100644 index 00000000..c548a14a --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/AST_CRON_mix_recordings_MP3.pl @@ -0,0 +1,206 @@ +#!/usr/bin/perl +# +# AST_CRON_mix_recordings_MP3.pl +# runs every 5 minutes and mixes the call recordings in the monitor together +# and puts the resulting ALL file into the DONE directory in the "monitor" dir +# and converts the ALL file to GSM format to save space. +# +# soxmix is REQUIRED to use this script, soxmix is available only as part of +# the sox audio package, and only in newer versions. Make sure you have soxmix +# installed properly and in your path +# +# put an entry into the cron of of your asterisk machine to run this script +# every 5 minutes or however often you desire +# +# make sure that the following directories exist: +# /var/spool/asterisk/monitor # default Asterisk recording directory +# /var/spool/asterisk/monitor/DONE # where the combined files are put +# /var/spool/asterisk/monitor/ORIG # where the original in/out files are put +# +# This program assumes that recordings are saved as .wav +# should be easy to change this code if you use .gsm instead +# +# This program also sends the ALL combined file to an FTP server for archival +# purposes, you can comment out the Net::Ping and Net::FTP lines as well as the +# file transfer section of the code to deactivate remote copying of the +# recording files +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# Contributions by Mike Lord +# +# 51021-1058 - Added quotes around CLI executed commands +# 51122-1455 - Added soxmix and sox binary path check +# 60616-1027 - Modified to convert to MP3 format +# 60807-1308 - Modified to use /etc/astguiclient.conf for settings +# 71004-1124 - Changed to not move ORIG recordings if FTP server does not Ping +# 71005-0049 - Altered script to use astguiclient.conf for settings +# + + +# Default variables for FTP +$VARFTP_host = '10.0.0.4'; +$VARFTP_user = 'cron'; +$VARFTP_pass = 'test'; +$VARFTP_dir = 'recordings'; +$VARFTP_port = '21'; + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /PATHDONEmonitor/) && ($CLIDONEmonitor < 1) ) + {$PATHDONEmonitor = $line; $PATHDONEmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + if ( ($line =~ /^VARFTP_host/) && ($CLIFTP_host < 1) ) + {$VARFTP_host = $line; $VARFTP_host =~ s/.*=//gi;} + if ( ($line =~ /^VARFTP_user/) && ($CLIFTP_user < 1) ) + {$VARFTP_user = $line; $VARFTP_user =~ s/.*=//gi;} + if ( ($line =~ /^VARFTP_pass/) && ($CLIFTP_pass < 1) ) + {$VARFTP_pass = $line; $VARFTP_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARFTP_port/) && ($CLIFTP_port < 1) ) + {$VARFTP_port = $line; $VARFTP_port =~ s/.*=//gi;} + if ( ($line =~ /^VARFTP_dir/) && ($CLIFTP_dir < 1) ) + {$VARFTP_dir = $line; $VARFTP_dir =~ s/.*=//gi;} + if ( ($line =~ /^VARHTTP_path/) && ($CLIHTTP_path < 1) ) + {$VARHTTP_path = $line; $VARHTTP_path =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +### directory where in/out recordings are saved to by Asterisk +$dir1 = "$PATHmonitor"; +$dir2 = "$PATHDONEmonitor"; + +$soxmixbin = ''; +if ( -e ('/usr/bin/soxmix')) {$soxmixbin = '/usr/bin/soxmix';} +else + { + if ( -e ('/usr/local/bin/soxmix')) {$soxmixbin = '/usr/local/bin/soxmix';} + else + { + print "Can't find soxmix binary! Exiting...\n"; + exit; + } + } +$lamebin = ''; +if ( -e ('/usr/bin/lame')) {$lamebin = '/usr/bin/lame';} +else + { + if ( -e ('/usr/local/bin/lame')) {$lamebin = '/usr/local/bin/lame';} + else + { + print "Can't find lame binary! Exiting...\n"; + exit; + } + } + +use Net::Ping; +use Net::FTP; + + + opendir(FILE, "$dir1/"); + @FILES = readdir(FILE); + +$i=0; +foreach(@FILES) + { + $size1 = 0; + $size2 = 0; + + if ( (length($FILES[$i]) > 4) && (!-d $FILES[$i]) ) + { + + $size1 = (-s "$dir1/$FILES[$i]"); + if ($v) {print "$FILES[$i] $size1\n";} + sleep(1); + $size2 = (-s "$dir1/$FILES[$i]"); + if ($v) {print "$FILES[$i] $size2\n\n";} + + + if ( ($FILES[$i] !~ /out\.wav/i) && ($size1 eq $size2) && (length($FILES[$i]) > 4)) + { + $INfile = $FILES[$i]; + $OUTfile = $FILES[$i]; + $OUTfile =~ s/-in\.wav/-out.wav/gi; + $ALLfile = $FILES[$i]; + $ALLfile =~ s/-in\.wav/-all.wav/gi; + $MP3file = $ALLfile; + $MP3file =~ s/-all\.wav/-all.mp3/gi; + + if ($v) {print "|$INfile| |$OUTfile| |$ALLfile|\n\n";} + + ### BEGIN Remote file transfer + $p = Net::Ping->new(); + $ping_good = $p->ping("$VARFTP_host"); + + if ($ping_good) + { + `$soxmixbin "$dir1/$INfile" "$dir1/$OUTfile" "$dir2/$ALLfile"`; + if ($v) {print "|$INfile| |$OUTfile| |$ALLfile|\n\n";} + + `$lamebin -b 16 -m m --silent "$dir2/$ALLfile" "$dir2/$MP3file"`; + + if($DB){print STDERR "\n|/usr/bin/sox $live_folder/$filename[$k]$WAV $arch_folder/$filename[$k]$GSM|\n";} + chmod 0755, "$dir2/$MP3file"; + + $ftp = Net::FTP->new("$VARFTP_host", Port => $VARFTP_port, Debug => 0, Passive => 1); + $ftp->login("$VARFTP_user","$VARFTP_pass"); + $ftp->cwd("$VARFTP_dir"); + $ftp->binary(); + $ftp->put("$dir2/$MP3file", "$MP3file"); + $ftp->quit; + + if (!$T) + { + `mv -f "$dir1/$INfile" "$dir2/ORIG/$INfile"`; + `mv -f "$dir1/$OUTfile" "$dir2/ORIG/$OUTfile"`; + } + if (!$T) + { + `rm -f "$dir2/$ALLfile"`; + } + + } + ### END Remote file transfer + + } + } + $i++; + } + +if ($v) {print "DONE... EXITING\n\n";} + +exit; diff --git a/agc_2-X/branches/agc_2.0.4/bin/AST_CRON_mix_recordings_MP3_DATE.pl b/agc_2-X/branches/agc_2.0.4/bin/AST_CRON_mix_recordings_MP3_DATE.pl new file mode 100644 index 00000000..e3a9cf01 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/AST_CRON_mix_recordings_MP3_DATE.pl @@ -0,0 +1,231 @@ +#!/usr/bin/perl +# +# AST_CRON_mix_recordings_MP3_DATE.pl +# runs every 5 minutes and mixes the call recordings in the monitor together +# and puts the resulting ALL file into the DONE directory in the "monitor" dir +# and converts the ALL file to GSM format to save space. +# +# soxmix is REQUIRED to use this script, soxmix is available only as part of +# the sox audio package, and only in newer versions. Make sure you have soxmix +# installed properly and in your path +# +# put an entry into the cron of of your asterisk machine to run this script +# every 5 minutes or however often you desire +# +# make sure that the following directories exist: +# /var/spool/asterisk/monitor # default Asterisk recording directory +# /var/spool/asterisk/monitor/DONE # where the combined files are put +# /var/spool/asterisk/monitor/ORIG # where the original in/out files are put +# +# This program assumes that recordings are saved as .wav +# should be easy to change this code if you use .gsm instead +# +# This program also sends the ALL combined file to an FTP server for archival +# purposes, you can comment out the Net::Ping and Net::FTP lines as well as the +# file transfer section of the code to deactivate remote copying of the +# recording files +# +# MODIFIED BY MAGMA NETWORKS: FTP Server has new folder created daily for archiving +# recordings. If the directory does not exist, this script creates the directory in +# YYYYMMDD format. +# +# +# VERY IMPORTANT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +# You must be saving recordings as FULLDATE_CUSTPHONE_CAMPAIGN_AGENT +# and save files to dated-directories or this script will not work properly +# +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# Contributions by Mike Lord +# Contributions by Magma Networks LLC +# +# 51021-1058 - Added quotes around CLI executed commands +# 51122-1455 - Added soxmix and sox binary path check +# 60616-1027 - Modified to convert to MP3 format +# - Creates Directory on target FTP server based on . +# 60807-1308 - Modified to use /etc/astguiclient.conf for settings +# 71004-1124 - Changed to not move ORIG recordings if FTP server does not Ping +# 71005-0049 - Altered script to use astguiclient.conf for settings +# + +#verbose +$v=0; +#test +$T=0; + +# Default variables for FTP +$VARFTP_host = '192.168.0.8'; +$VARFTP_user = 'recordings'; +$VARFTP_pass = 'recordings'; +$VARFTP_dir = '/var/www/html/RECORDINGS'; +$VARFTP_port = '21'; + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /PATHDONEmonitor/) && ($CLIDONEmonitor < 1) ) + {$PATHDONEmonitor = $line; $PATHDONEmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + if ( ($line =~ /^VARFTP_host/) && ($CLIFTP_host < 1) ) + {$VARFTP_host = $line; $VARFTP_host =~ s/.*=//gi;} + if ( ($line =~ /^VARFTP_user/) && ($CLIFTP_user < 1) ) + {$VARFTP_user = $line; $VARFTP_user =~ s/.*=//gi;} + if ( ($line =~ /^VARFTP_pass/) && ($CLIFTP_pass < 1) ) + {$VARFTP_pass = $line; $VARFTP_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARFTP_port/) && ($CLIFTP_port < 1) ) + {$VARFTP_port = $line; $VARFTP_port =~ s/.*=//gi;} + if ( ($line =~ /^VARFTP_dir/) && ($CLIFTP_dir < 1) ) + {$VARFTP_dir = $line; $VARFTP_dir =~ s/.*=//gi;} + if ( ($line =~ /^VARHTTP_path/) && ($CLIHTTP_path < 1) ) + {$VARHTTP_path = $line; $VARHTTP_path =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +### directory where in/out recordings are saved to by Asterisk +$dir1 = "$PATHmonitor"; +$dir2 = "$PATHDONEmonitor"; + +# get current date in the format YYYYMMDD for use in directory name on the storage server +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +my $today = sprintf("%d%02d%02d", $year + 1900, $mon + 1, $mday); + +$soxmixbin = ''; +if ( -e ('/usr/bin/soxmix')) {$soxmixbin = '/usr/bin/soxmix';} +else + { + if ( -e ('/usr/local/bin/soxmix')) {$soxmixbin = '/usr/local/bin/soxmix';} + else + { + print "Can't find soxmix binary! Exiting...\n"; + exit; + } + } +$lamebin = ''; +if ( -e ('/usr/bin/lame')) {$lamebin = '/usr/bin/lame';} +else + { + if ( -e ('/usr/local/bin/lame')) {$lamebin = '/usr/local/bin/lame';} + else + { + print "Can't find lame binary! Exiting...\n"; + exit; + } + } + +use Net::Ping; +use Net::FTP; + + + opendir(FILE, "$dir1/"); + @FILES = readdir(FILE); + +$i=0; +foreach(@FILES) + { + $size1 = 0; + $size2 = 0; + + if ( (length($FILES[$i]) > 4) && (!-d $FILES[$i]) ) + { + + $size1 = (-s "$dir1/$FILES[$i]"); + if ($v) {print "$FILES[$i] $size1\n";} + sleep(1); + $size2 = (-s "$dir1/$FILES[$i]"); + if ($v) {print "$FILES[$i] $size2\n\n";} + + + if ( ($FILES[$i] !~ /out\.wav/i) && ($size1 eq $size2) && (length($FILES[$i]) > 4)) + { + $INfile = $FILES[$i]; + $OUTfile = $FILES[$i]; + $OUTfile =~ s/-in\.wav/-out.wav/gi; + $ALLfile = $FILES[$i]; + $ALLfile =~ s/-in\.wav/-all.wav/gi; + $MP3file = $ALLfile; + $MP3file =~ s/-all\.wav/-all.mp3/gi; + + ### BEGIN Remote file transfer + $p = Net::Ping->new(); + $ping_good = $p->ping("$VARFTP_host"); + + if ($ping_good) + { + if ($v) {print "|$INfile| |$OUTfile| |$ALLfile|\n\n";} + + `$soxmixbin "$dir1/$INfile" "$dir1/$OUTfile" "$dir2/$ALLfile"`; + if ($v) {print "|$INfile| |$OUTfile| |$ALLfile|\n\n";} + if (!$T) + { + `mv -f "$dir1/$INfile" "$dir2/ORIG/$INfile"`; + `mv -f "$dir1/$OUTfile" "$dir2/ORIG/$OUTfile"`; + } + + `$lamebin -b 16 -m m --silent "$dir2/$ALLfile" "$dir2/$MP3file"`; + + + if($DB){print STDERR "\n|$lamebin -b 16 -m m --silent \"$dir2/$ALLfile\" \"$dir2/$MP3file\"\n";} + chmod 0755, "$dir2/$MP3file"; + + $ftp = Net::FTP->new("$VARFTP_host", Port => $VARFTP_port, Debug => ($v? 1 : 0), Passive => 1); + $ftp->login("$VARFTP_user","$VARFTP_pass"); + #$ftp->cwd("$VARFTP_dir"); + $ftp->mkdir("$VARFTP_dir/$today", 1); + $ftp->cwd("$VARFTP_dir/$today"); + $ftp->binary(); + $ftp->put("$dir2/$MP3file", "$MP3file"); + $ftp->quit; + + # clean up + if (!$T) + { + `rm -f "$dir2/ORIG/$INfile"`; + `rm -f "$dir2/ORIG/$OUTfile"`; + `rm -f "$dir2/$ALLfile"`; + `rm -f "$dir2/$MP3file"`; + } + } + ### END Remote file transfer + } + } + $i++; + } + +if ($v) {print "DONE... EXITING\n\n";} + +exit; diff --git a/agc_2-X/branches/agc_2.0.4/bin/AST_CRON_mix_recordings_VDonly_DATE.pl b/agc_2-X/branches/agc_2.0.4/bin/AST_CRON_mix_recordings_VDonly_DATE.pl new file mode 100644 index 00000000..bbd8363d --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/AST_CRON_mix_recordings_VDonly_DATE.pl @@ -0,0 +1,198 @@ +#!/usr/bin/perl +# +# AST_CRON_mix_recordings_VDonly_DATE.pl +# +# IMPORTANT!!! ONLY TO BE USED WHEN ONLY VICIDIAL RECORDINGS ARE ON THE SYSTEM! +# +# runs every 5 minutes and copies the -in recordings in the monitor to a dated +# directory on an FTP server. Creates the FTP directory if it does not exist. +# +# put an entry into the cron of of your asterisk machine to run this script +# every 5 minutes or however often you desire +# +# make sure that the following directories exist: +# /var/spool/asterisk/monitor # default Asterisk recording directory +# /var/spool/asterisk/monitor/ORIG # where the original in/out files are put +# +# This program assumes that recordings are saved as .wav +# should be easy to change this code if you use .gsm instead +# +# This program also sends the ALL combined file to an FTP server for archival +# purposes, you can comment out the Net::Ping and Net::FTP lines as well as the +# file transfer section of the code to deactivate remote copying of the +# recording files +# +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# +# +# 51021-1058 - Added quotes around CLI executed commands +# 51122-1458 - Added soxmix binary path check +# 60318-0921 - Added ability to mix gsm audio files +# 60807-1308 - Modified to use /etc/astguiclient.conf for settings +# 70702-1139 - Removed mixing, and added dated folder storage on FTP server +# 71004-1124 - Changed to not move ORIG recordings if FTP server does not Ping +# 71005-0049 - Altered script to use astguiclient.conf for settings +# + +# Default variables for FTP +$VARFTP_host = '10.0.0.4'; +$VARFTP_user = 'cron'; +$VARFTP_pass = 'test'; +$VARFTP_port = '21'; +$VARFTP_dir = 'RECORDINGS'; +$VARHTTP_path = 'http://10.0.0.4'; + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /PATHDONEmonitor/) && ($CLIDONEmonitor < 1) ) + {$PATHDONEmonitor = $line; $PATHDONEmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + if ( ($line =~ /^VARFTP_host/) && ($CLIFTP_host < 1) ) + {$VARFTP_host = $line; $VARFTP_host =~ s/.*=//gi;} + if ( ($line =~ /^VARFTP_user/) && ($CLIFTP_user < 1) ) + {$VARFTP_user = $line; $VARFTP_user =~ s/.*=//gi;} + if ( ($line =~ /^VARFTP_pass/) && ($CLIFTP_pass < 1) ) + {$VARFTP_pass = $line; $VARFTP_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARFTP_port/) && ($CLIFTP_port < 1) ) + {$VARFTP_port = $line; $VARFTP_port =~ s/.*=//gi;} + if ( ($line =~ /^VARFTP_dir/) && ($CLIFTP_dir < 1) ) + {$VARFTP_dir = $line; $VARFTP_dir =~ s/.*=//gi;} + if ( ($line =~ /^VARHTTP_path/) && ($CLIHTTP_path < 1) ) + {$VARHTTP_path = $line; $VARHTTP_path =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP +if (!$VARDB_port) {$VARDB_port='3306';} + +use DBI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + +### directory where in/out recordings are saved to by Asterisk +$dir1 = "$PATHmonitor"; +$dir2 = "$PATHDONEmonitor"; + +use Net::Ping; +use Net::FTP; + + opendir(FILE, "$dir1/"); + @FILES = readdir(FILE); + +$i=0; +foreach(@FILES) + { + $size1 = 0; + $size2 = 0; + + if ( (length($FILES[$i]) > 4) && (!-d $FILES[$i]) ) + { + + $size1 = (-s "$dir1/$FILES[$i]"); + if ($v) {print "$FILES[$i] $size1\n";} + sleep(1); + $size2 = (-s "$dir1/$FILES[$i]"); + if ($v) {print "$FILES[$i] $size2\n\n";} + + if ( ($FILES[$i] !~ /out\.wav|out\.gsm/i) && ($size1 eq $size2) && (length($FILES[$i]) > 4)) + { + $INfile = $FILES[$i]; + $OUTfile = $FILES[$i]; + $OUTfile =~ s/-in\.wav/-out.wav/gi; + $OUTfile =~ s/-in\.gsm/-out.gsm/gi; + $ALLfile = $FILES[$i]; + $ALLfile =~ s/-in\.wav/-all.wav/gi; + $ALLfile =~ s/-in\.gsm/-all.gsm/gi; + $SQLFILE = $FILES[$i]; + $SQLFILE =~ s/-in\.wav|-in\.gsm//gi; + + $stmtA = "select recording_id,start_time from recording_log where filename='$SQLFILE' order by recording_id desc LIMIT 1;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $recording_id = "$aryA[0]"; + $start_date = "$aryA[1]"; + $start_date =~ s/ .*//gi; + $rec_count++; + } + $sthA->finish(); + + if ($v) {print "|$INfile| |$ALLfile| |$recording_id|$start_date|\n";} + ### BEGIN Remote file transfer + $p = Net::Ping->new(); + $ping_good = $p->ping("$VARFTP_host"); + + if ($ping_good) + { + $ftp = Net::FTP->new("$VARFTP_host", Port => $VARFTP_port); + $ftp->login("$VARFTP_user","$VARFTP_pass"); + $ftp->cwd("$VARFTP_dir"); + $ftp->mkdir("$start_date"); + $ftp->cwd("$start_date"); + $ftp->binary(); + $ftp->put("$dir1/$INfile", "$ALLfile"); + $ftp->quit; + + $stmtA = "UPDATE recording_log set location='$VARHTTP_path/$start_date/$ALLfile' where recording_id='$recording_id';"; + if($DB){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n"; + + if (!$T) + { + `mv -f "$dir1/$INfile" "$dir2/ORIG/$INfile"`; + `mv -f "$dir1/$OUTfile" "$dir2/ORIG/$OUTfile"`; + } + } + ### END Remote file transfer + } + } + $i++; + } + +if ($v) {print "DONE... EXITING\n\n";} + +$dbhA->disconnect(); + + +exit; diff --git a/agc_2-X/branches/agc_2.0.4/bin/AST_CRON_purge_recordings.pl b/agc_2-X/branches/agc_2.0.4/bin/AST_CRON_purge_recordings.pl new file mode 100644 index 00000000..1587cc5c --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/AST_CRON_purge_recordings.pl @@ -0,0 +1,193 @@ +#!/usr/bin/perl +# +# AST_CRON_purge_recordings.pl +# +# IMPORTANT!!! used to delete recordings!!! +# +# runs every day, goes through recordings older than a certain number of days +# and deletes those recordings that are not of a certain status +# default is 30 days old to remove non-sales +# +# put an entry into the cron of of your asterisk machine to run this script +# every day or however often you desire +# +# This program assumes that recordings are saved as .wav +# should be easy to change this code if you use .gsm instead +# +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# +# +# 70917-1339 - first build +# + +$save_statuses = '|SALE|UPSALE|UPSELL|XFER|DNC|DROP|A1|A2|A3|A4|A5|A6|A7|A8|A9|'; +$suffix = '-all.wav'; +$local_DIR = '/home2/cron/RECORDINGS'; +$use_date_DIRs = 1; + +# Customize variables for FTP +$FTP_host = '10.0.0.4'; +$FTP_user = 'cron'; +$FTP_pass = 'test'; +$FTP_dir = 'RECORDINGS'; +$HTTP_path = 'http://10.0.0.4'; + + +$secX = time(); + +$TDtarget = ($secX - 2592000); # thirty days +($Tsec,$Tmin,$Thour,$Tmday,$Tmon,$Tyear,$Twday,$Tyday,$Tisdst) = localtime($TDtarget); +$Tyear = ($Tyear + 1900); +$Tmon++; +if ($Tmon < 10) {$Tmon = "0$Tmon";} +if ($Tmday < 10) {$Tmday = "0$Tmday";} +if ($Thour < 10) {$Thour = "0$Thour";} +if ($Tmin < 10) {$Tmin = "0$Tmin";} +if ($Tsec < 10) {$Tsec = "0$Tsec";} + $TDSQLdate = "$Tyear-$Tmon-$Tmday $Thour:$Tmin:$Tsec"; + +$FDtarget = ($secX - 3456000); # forty-five days +($Fsec,$Fmin,$Fhour,$Fmday,$Fmon,$Fyear,$Fwday,$Fyday,$Fisdst) = localtime($FDtarget); +$Fyear = ($Fyear + 1900); +$Fmon++; +if ($Fmon < 10) {$Fmon = "0$Fmon";} +if ($Fmday < 10) {$Fmday = "0$Fmday";} +if ($Fhour < 10) {$Fhour = "0$Fhour";} +if ($Fmin < 10) {$Fmin = "0$Fmin";} +if ($Fsec < 10) {$Fsec = "0$Fsec";} + $FDSQLdate = "$Fyear-$Fmon-$Fmday $Fhour:$Fmin:$Fsec"; + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP +if (!$VARDB_port) {$VARDB_port='3306';} + +use DBI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### directory where in/out recordings are saved to by Asterisk +$dir1 = "$PATHmonitor"; + + +##### Get the lead_ids of all recordings that are not DELETED or NULL ##### +$stmtA = "SELECT lead_id,recording_id,start_time,filename,location FROM recording_log where start_time < '$TDSQLdate' and start_time > '$FDSQLdate' and location IS NOT NULL and location NOT IN('','NOT_FOUND','NOT_FOUND_2','DELETED') LIMIT 5000;"; + print "$stmtA\n"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$i=0; +while ($sthArows > $i) + { + @aryA = $sthA->fetchrow_array; + $lead_ids[$i] = "$aryA[0]"; + $recording_ids[$i] = "$aryA[1]"; + $start_times[$i] = "$aryA[2]"; + $filenames[$i] = "$aryA[3]"; + $locations[$i] = "$aryA[4]"; + $i++; + } +$sthA->finish(); + +##### Go through list of leads and find all of their statuses ##### +$i=0; +foreach(@lead_ids) + { + ### Grab status of the lead in the vicidial_list table + $stmtA = "SELECT status FROM vicidial_list where lead_id='$lead_ids[$i]';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $h=0; + while ($sthArows > $h) + { + @aryA = $sthA->fetchrow_array; + $statuses[$i] = "$aryA[0]"; + $h++; + } + $sthA->finish(); + + $i++; + } + + +##### Go through list of leads and delete all recordings with no-save statuses ##### +$i=0; +$KEEP=0; +$DELETE=0; +foreach(@lead_ids) + { + if ( ($save_statuses !~ /\|$statuses[$i]\|/) && (length($statuses[$i])>0) ) + { + if ($use_date_DIRs) + { + $date_DIR = $start_times[$i]; + $date_DIR =~ s/ .*//gi; + $date_DIR .= "/"; + } + else {$date_DIR=''} + `rm -f $local_DIR/$date_DIR$filenames[$i]$suffix`; + print "rm -f $local_DIR/$date_DIR$filenames[$i]$suffix |$statuses[$i]|$lead_ids[$i]|\n"; + + $stmtA = "UPDATE recording_log set location='DELETED' where recording_id='$recording_ids[$i]';"; + $affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n"; + $DELETE++; + } + else + { + print "KEEP- $filenames[$i]$suffix |$statuses[$i]|$lead_ids[$i]|\n"; + $KEEP++; + } + $i++; + } + +print "KEEP: $KEEP\n"; +print "DELETED: $DELETE\n"; +print "--------------------\n"; +print "TOTAL: $i\n"; + +if ($v) {print "DONE... EXITING\n\n";} + +$dbhA->disconnect(); + + +exit; diff --git a/agc_2-X/branches/agc_2.0.4/bin/AST_DB_optimize.pl b/agc_2-X/branches/agc_2.0.4/bin/AST_DB_optimize.pl new file mode 100644 index 00000000..4436675c --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/AST_DB_optimize.pl @@ -0,0 +1,302 @@ +#!/usr/bin/perl +# +# AST_DB_optimize.pl version 0.2 *DBI-version* +# +# DESCRIPTION: +# optimizes the tables used in the asterisk MySQL database +# +# It is recommended that you run this program on the local Asterisk machine +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# CHANGES +# 60717-1242 - changed to DBI by Marin Blu +# 60718-1645 - changed to use /etc/astguiclient.conf for configs +# 71030-2020 - Added deletions of stats and inbound live agents +# 71109-1725 - fixed vicidial_campaign_stats bug +# 71215-0410 - fixed UPDATE/DELETE results +# + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} + +use DBI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + + $stmtA = "optimize table call_log;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } + + + $stmtA = "optimize table park_log;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } + + + $stmtA = "optimize table vicidial_log;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } + + + $stmtA = "optimize table vicidial_closer_log;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } + + + $stmtA = "optimize table vicidial_xfer_log;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } + + $stmtA = "optimize table vicidial_list;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } + + + $stmtA = "optimize table vicidial_manager;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } + + + $stmtA = "optimize table vicidial_auto_calls;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } + + + $stmtA = "optimize table vicidial_live_agents;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } + + $stmtA = "optimize table vicidial_campaign_stats;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } + + $stmtA = "optimize table vicidial_campaign_server_stats;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } + + $stmtA = "optimize table vicidial_dnc;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } + + $stmtA = "optimize table vicidial_callbacks;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } + + $stmtA = "optimize table vicidial_agent_log;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } + + $stmtA = "optimize table vicidial_conferences;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } + + $stmtA = "optimize table vicidial_hopper;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } + + + $stmtA = "UPDATE vicidial_campaign_stats SET dialable_leads='0', calls_today='0', answers_today='0', drops_today='0', drops_today_pct='0', drops_answers_today_pct='0', calls_hour='0', answers_hour='0', drops_hour='0', drops_hour_pct='0', calls_halfhour='0', answers_halfhour='0', drops_halfhour='0', drops_halfhour_pct='0', calls_fivemin='0', answers_fivemin='0', drops_fivemin='0', drops_fivemin_pct='0', calls_onemin='0', answers_onemin='0', drops_onemin='0', drops_onemin_pct='0', differential_onemin='0', agents_average_onemin='0', balance_trunk_fill='0', status_category_count_1='0', status_category_count_2='0', status_category_count_3='0', status_category_count_4='0';"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) + { + $affected_rows = $dbhA->do($stmtA); + if(!$Q){print STDERR "\n|$affected_rows vicidial_campaign_stats records reset|\n";} + } + + $stmtA = "delete from vicidial_campaign_server_stats;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) + { + $affected_rows = $dbhA->do($stmtA); + if(!$Q){print STDERR "\n|$affected_rows vicidial_campaign_server_stats records deleted|\n";} + } + + $stmtA = "delete from vicidial_live_inbound_agents;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) + { + $affected_rows = $dbhA->do($stmtA); + if(!$Q){print STDERR "\n|$affected_rows vicidial_live_inbound_agents records deleted|\n";} + } + + $stmtA = "update vicidial_inbound_group_agents SET calls_today=0;;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) + { + $affected_rows = $dbhA->do($stmtA); + if(!$Q){print STDERR "\n|$affected_rows vicidial_inbound_group_agents call counts reset|\n";} + } + + $stmtA = "update vicidial_campaign_agents SET calls_today=0;;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) + { + $affected_rows = $dbhA->do($stmtA); + if(!$Q){print STDERR "\n|$affected_rows vicidial_campaign_agents call counts reset|\n";} + } + + $dbhA->disconnect(); + + +exit; + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/bin/AST_DB_tz_divide.pl b/agc_2-X/branches/agc_2.0.4/bin/AST_DB_tz_divide.pl new file mode 100644 index 00000000..a8f1c8e5 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/AST_DB_tz_divide.pl @@ -0,0 +1,209 @@ +#!/usr/bin/perl +# +# AST_DB_tz_divide.pl version 2.0.4 *DBI-version* +# +# DESCRIPTION: +# OPTIONAL!!! CUSTOMIZE THIS SCRIPT FIRST!!! +# - separates leads into two different lists +# - moves leads older than 30 days into 999999 list_id +# - deletes non-sale leads older than 45 days +# +# It is recommended that you run this program on the local Asterisk machine +# +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# +# CHANGES +# 71106-0250 - first build +# 71106-1235 - fixed bugs and made debug function properly +# + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-debug/i) + { + $DB=1; # Debug flag, set to 0 for no debug messages, On an active system this will generate hundreds of lines of output per minute + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +print "no command line options set\n"; + $loop_delay = '2500'; + $DB=1; +} +### end parsing run-time options ### + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} + +use DBI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + + +if ($isdst) + { + $TZmove = "'-6.00','-7.00','-8.00','-9.00','-10.00'"; + $TZback = "'-4.00','-5.00'"; + } +else + { + $TZmove = "'-7.00','-8.00','-9.00','-10.00','-11.00'"; + $TZback = "'-5.00','-6.00'"; + } + + ##### change Pacific Mountain + + $stmtA = "UPDATE vicidial_list set list_id='222' where list_id='111' and gmt_offset_now IN($TZmove);"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows records changed|\n";} + } + + $stmtA = "UPDATE vicidial_list set list_id='12021' where list_id='11315' and gmt_offset_now IN($TZmove);"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows records changed|\n";} + } + + $stmtA = "UPDATE vicidial_list set list_id='4444' where list_id='3333' and gmt_offset_now IN($TZmove);"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows records changed|\n";} + } + + ##### change back Eastern Central + + $stmtA = "UPDATE vicidial_list set list_id='111' where list_id='222' and gmt_offset_now IN($TZback);"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows records changed|\n";} + } + + $stmtA = "UPDATE vicidial_list set list_id='11315' where list_id='12021' and gmt_offset_now IN($TZback);"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows records changed|\n";} + } + + $stmtA = "UPDATE vicidial_list set list_id='3333' where list_id='4444' and gmt_offset_now IN($TZback);"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows records changed|\n";} + } + + + + +$secX = time(); + +$XDtarget = ($secX - 2678400); +($Xsec,$Xmin,$Xhour,$Xmday,$Xmon,$Xyear,$Xwday,$Xyday,$Xisdst) = localtime($XDtarget); +$Xyear = ($Xyear + 1900); +$Xmon++; +if ($Xmon < 10) {$Xmon = "0$Xmon";} +if ($Xmday < 10) {$Xmday = "0$Xmday";} +if ($Xhour < 10) {$Xhour = "0$Xhour";} +if ($Xmin < 10) {$Xmin = "0$Xmin";} +if ($Xsec < 10) {$Xsec = "0$Xsec";} + $XDSQLdate = "$Xyear-$Xmon-$Xmday $Xhour:$Xmin:$Xsec"; + +$TDtarget = ($secX - 5356800); +($Tsec,$Tmin,$Thour,$Tmday,$Tmon,$Tyear,$Twday,$Tyday,$Tisdst) = localtime($TDtarget); +$Tyear = ($Tyear + 1900); +$Tmon++; +if ($Tmon < 10) {$Tmon = "0$Tmon";} +if ($Tmday < 10) {$Tmday = "0$Tmday";} +if ($Thour < 10) {$Thour = "0$Thour";} +if ($Tmin < 10) {$Tmin = "0$Tmin";} +if ($Tsec < 10) {$Tsec = "0$Tsec";} + $TDSQLdate = "$Tyear-$Tmon-$Tmday $Thour:$Tmin:$Tsec"; + + $stmtA = "UPDATE vicidial_list set list_id='999999' where list_id IN('11315','12021','111','222','3333','4444') and entry_date < \"$XDSQLdate\";"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows records changed|\n";} + } + + $stmtA = "DELETE from vicidial_list WHERE list_id='999999' and entry_date < \"$TDSQLdate\" and status NOT IN('SALE','UPSELL','UPSALE','A1','A2','A3','A4');"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows records changed|\n";} + } + + + $dbhA->disconnect(); + +exit; + diff --git a/agc_2-X/branches/agc_2.0.4/bin/AST_VDadapt.pl b/agc_2-X/branches/agc_2.0.4/bin/AST_VDadapt.pl new file mode 100644 index 00000000..448a88b6 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/AST_VDadapt.pl @@ -0,0 +1,1285 @@ +#!/usr/bin/perl +# +# AST_VDadapt.pl version 2.0.4 *DBI-version* +# +# DESCRIPTION: +# adjusts the auto_dial_level for vicidial adaptive-predictive campaigns. +# +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# +# CHANGELOG +# 60823-1302 - First build from AST_VDhopper.pl +# 60825-1734 - Functional alpha version, no loop +# 60826-0857 - Added loop and CLI flag options +# 60827-0035 - Separate Drop calculation and target dial level calculation into different subroutines +# - Alter code so that DROP percentages would calculate only about once a minute no matter he loop delay +# 60828-1149 - Add field for target dial_level difference, -1 would target one agent waiting, +1 would target 1 customer waiting +# 60919-1243 - Changed variables to use arrays for all campaign-specific values +# 61215-1110 - Added answered calls stats and use drops as percentage of answered for today +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70205-1429 - Added code for campaign_changedate and campaign_stats_refresh updates +# 70213-1221 - Added code for QueueMetrics queue_log QUEUESTART record +# 70219-1249 - Removed unused references to dial_status_x fields +# 70409-1219 - Removed CLOSER-type campaign restriction +# 70521-1038 - Fixed bug when no live campaigns are running, define $vicidial_log +# 70619-1339 - Added Status Category tally calculations +# 71029-1906 - Changed CLOSER-type campaign_id restriction +# + +# constants +$DB=0; # Debug flag, set to 0 for no debug messages, On an active system this will generate lots of lines of output per minute +$US='__'; +$MT[0]=''; + $vicidial_log = 'vicidial_log FORCE INDEX (call_date) '; +# $vicidial_log = 'vicidial_log'; + + +$i=0; +$drop_count_updater=0; +$stat_it=15; +$diff_ratio_updater=0; +$stat_count=1; +$VCScalls_today[$i]=0; +$VCSdrops_today[$i]=0; +$VCSdrops_today_pct[$i]=0; +$VCScalls_hour[$i]=0; +$VCSdrops_hour[$i]=0; +$VCSdrops_hour_pct[$i]=0; +$VCScalls_halfhour[$i]=0; +$VCSdrops_halfhour[$i]=0; +$VCSdrops_halfhour_pct[$i]=0; +$VCScalls_five[$i]=0; +$VCSdrops_five[$i]=0; +$VCSdrops_five_pct[$i]=0; +$VCScalls_one[$i]=0; +$VCSdrops_one[$i]=0; +$VCSdrops_one_pct[$i]=0; +$total_agents[$i]=0; +$ready_agents[$i]=0; +$waiting_calls[$i]=0; +$ready_diff_total[$i]=0; +$waiting_diff_total[$i]=0; +$total_agents_total[$i]=0; +$ready_diff_avg[$i]=0; +$waiting_diff_avg[$i]=0; +$total_agents_avg[$i]=0; +$stat_differential[$i]=0; +$VCSINCALL[$i]=0; +$VCSREADY[$i]=0; +$VCSCLOSER[$i]=0; +$VCSPAUSED[$i]=0; +$VCSagents[$i]=0; +$VCSagents_calc[$i]=0; +$VCSagents_active[$i]=0; + +# set to 61 initially so that a baseline drop count is pulled +$drop_count_updater=61; + +$secT = time(); + &get_time_now; + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options(must stay in this order):\n [--debug] = debug\n [--debugX] = super debug\n [-t] = test\n [--loops=XXX] = force a number of loops of XXX\n [--delay=XXX] = force a loop delay of XXX seconds\n [--campaign=XXX] = run for campaign XXX only\n [-force] = force calculation of suggested predictive dial_level\n [-test] = test only, do not alter dial_level\n\n"; + } + else + { + if ($args =~ /--campaign=/i) # CLI defined campaign + { + @CLIvarARY = split(/--campaign=/,$args); + @CLIvarARX = split(/ /,$CLIvarARY[1]); + if (length($CLIvarARX[0])>2) + { + $CLIcampaign = $CLIvarARX[0]; + $CLIcampaign =~ s/\/$| |\r|\n|\t//gi; + } + else + {$CLIcampaign = '';} + @CLIvarARY=@MT; @CLIvarARY=@MT; + } + else + {$CLIcampaign = '';} + if ($args =~ /--level=/i) # CLI defined level + { + @CLIvarARY = split(/--level=/,$args); + @CLIvarARX = split(/ /,$CLIvarARY[1]); + if (length($CLIvarARX[0])>2) + { + $CLIlevel = $CLIvarARX[0]; + $CLIlevel =~ s/\/$| |\r|\n|\t//gi; + $CLIlevel =~ s/\D//gi; + } + else + {$CLIlevel = '';} + @CLIvarARY=@MT; @CLIvarARY=@MT; + } + else + {$CLIlevel = '';} + if ($args =~ /--loops=/i) # CLI defined loops + { + @CLIvarARY = split(/--loops=/,$args); + @CLIvarARX = split(/ /,$CLIvarARY[1]); + if (length($CLIvarARX[0])>2) + { + $CLIloops = $CLIvarARX[0]; + $CLIloops =~ s/\/$| |\r|\n|\t//gi; + $CLIloops =~ s/\D//gi; + } + else + {$CLIloops = '1000000';} + @CLIvarARY=@MT; @CLIvarARY=@MT; + } + else + {$CLIloops = '1000000';} + if ($args =~ /--delay=/i) # CLI defined delay + { + @CLIvarARY = split(/--delay=/,$args); + @CLIvarARX = split(/ /,$CLIvarARY[1]); + if (length($CLIvarARX[0])>2) + { + $CLIdelay = $CLIvarARX[0]; + $CLIdelay =~ s/\/$| |\r|\n|\t//gi; + $CLIdelay =~ s/\D//gi; + } + else + {$CLIdelay = '1';} + @CLIvarARY=@MT; @CLIvarARY=@MT; + } + else + {$CLIdelay = '1';} + if ($args =~ /--debug/i) + { + $DB=1; + print "\n----- DEBUG -----\n\n"; + } + if ($args =~ /--debugX/i) + { + $DBX=1; + print "\n"; + print "----- SUPER DEBUG -----\n"; + print "VARS-\n"; + print "CLIcampaign- $CLIcampaign\n"; + print "CLIlevel- $CLIlevel\n"; + print "CLIloops- $CLIloops\n"; + print "CLIdelay- $CLIdelay\n"; + print "\n"; + } + if ($args =~ /-force/i) + { + $force_test=1; + print "\n----- FORCE TESTING -----\n\n"; + } + if ($args =~ /-t/i) + { + $T=1; $TEST=1; + print "\n-----TESTING -----\n\n"; + } + } +} +else +{ +$CLIcampaign = ''; +$CLIlevel = ''; +$CLIloops = '1000000'; +$CLIdelay = '1'; +} + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +if (!$VARDB_port) {$VARDB_port='3306';} + +use DBI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +if ($DBX) {print "CONNECTED TO DATABASE: $VARDB_server|$VARDB_database\n";} + + +############################################# +##### START QUEUEMETRICS LOGGING LOOKUP ##### +$stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $enable_queuemetrics_logging = "$aryA[0]"; + $queuemetrics_server_ip = "$aryA[1]"; + $queuemetrics_dbname = "$aryA[2]"; + $queuemetrics_login = "$aryA[3]"; + $queuemetrics_pass = "$aryA[4]"; + $queuemetrics_log_id = "$aryA[5]"; + $rec_count++; + } +$sthA->finish(); + +if ($enable_queuemetrics_logging > 0) + { + $dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} + + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secT',call_id='NONE',queue='NONE',agent='NONE',verb='QUEUESTART',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } +##### END QUEUEMETRICS LOGGING LOOKUP ##### +########################################### + + +$master_loop=0; + +### Start master loop ### +while ($master_loop<$CLIloops) +{ + &get_time_now; + + ### Grab Server values from the database + $stmtA = "SELECT vd_server_logs,local_gmt FROM servers where server_ip = '$VARserver_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBvd_server_logs = "$aryA[0]"; + $DBSERVER_GMT = "$aryA[1]"; + if ($DBvd_server_logs =~ /Y/) {$SYSLOG = '1';} + else {$SYSLOG = '0';} + if (length($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;} + $rec_count++; + } + $sthA->finish(); + + + + $secX = time(); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($secX); + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + if ($isdst) {$LOCAL_GMT_OFF++;} + + $GMT_now = ($secX - ($LOCAL_GMT_OFF * 3600)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($GMT_now); + $mon++; + $year = ($year + 1900); + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + +# if ($DB) {print "TIME DEBUG: $master_loop $LOCAL_GMT_OFF_STD|$LOCAL_GMT_OFF|$isdst| GMT: $hour:$min\n";} + +@campaign_id=@MT; +@lead_order=@MT; +@hopper_level=@MT; +@auto_dial_level=@MT; +@local_call_time=@MT; +@lead_filter_id=@MT; +@use_internal_dnc=@MT; +@dial_method=@MT; +@available_only_ratio_tally[$i]=@MT; +@adaptive_dropped_percentage=@MT; +@adaptive_maximum_level=@MT; +@adaptive_latest_server_time=@MT; +@adaptive_intensity=@MT; +@adaptive_dl_diff_target=@MT; +@campaign_changedate=@MT; +@campaign_stats_refresh=@MT; + +if ($CLIcampaign) + { + $stmtA = "SELECT * from vicidial_campaigns where campaign_id='$CLIcampaign'"; + } +else + { + $stmtA = "SELECT campaign_id,lead_order,hopper_level,auto_dial_level,local_call_time,lead_filter_id,use_internal_dnc,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,UNIX_TIMESTAMP(campaign_changedate),campaign_stats_refresh,campaign_allow_inbound from vicidial_campaigns where ( (active='Y') or (campaign_stats_refresh='Y') )"; + } +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $campaign_id[$rec_count] = $aryA[0]; + $lead_order[$rec_count] = $aryA[1]; + if (!$CLIlevel) + {$hopper_level[$rec_count] = $aryA[2];} + else + {$hopper_level[$rec_count] = $CLIlevel;} + $auto_dial_level[$rec_count] = $aryA[3]; + $local_call_time[$rec_count] = $aryA[4]; + $lead_filter_id[$rec_count] = $aryA[5]; + $use_internal_dnc[$rec_count] = $aryA[6]; + $dial_method[$rec_count] = $aryA[7]; + $available_only_ratio_tally[$i][$rec_count] = $aryA[8]; + $adaptive_dropped_percentage[$rec_count] = $aryA[9]; + $adaptive_maximum_level[$rec_count] = $aryA[10]; + $adaptive_latest_server_time[$rec_count] = $aryA[11]; + $adaptive_intensity[$rec_count] = $aryA[12]; + $adaptive_dl_diff_target[$rec_count] = $aryA[13]; + $campaign_changedate[$rec_count] = $aryA[14]; + $campaign_stats_refresh[$rec_count] = $aryA[15]; + $campaign_allow_inbound[$rec_count] = $aryA[16]; + + $rec_count++; + } +$sthA->finish(); +if ($DB) {print "$now_date CAMPAIGNS TO PROCESSES ADAPT FOR: $rec_count|$#campaign_id IT: $master_loop\n";} + + +##### LOOP THROUGH EACH CAMPAIGN AND PROCESS THE HOPPER ##### +$i=0; +foreach(@campaign_id) + { + ### Find out how many leads are in the hopper from a specific campaign + $hopper_ready_count=0; + $stmtA = "SELECT count(*) from vicidial_hopper where campaign_id='$campaign_id[$i]' and status='READY';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $hopper_ready_count = $aryA[0]; + if ($DB) {print " $campaign_id[$i] hopper READY count: $hopper_ready_count";} +# if ($DBX) {print " |$stmtA|\n";} + $rec_count++; + } + $sthA->finish(); + $event_string = "|$campaign_id[$i]|$hopper_level[$i]|$hopper_ready_count|$local_call_time[$i]|$diff_ratio_updater|$drop_count_updater|"; + if ($DBX) {print "$i $event_string\n";} + &event_logger; + + ##### IF THERE ARE NO LEADS IN THE HOPPER FOR THE CAMPAIGN WE DO NOT WANT TO ADJUST THE DIAL_LEVEL + if ($hopper_ready_count>0) + { + ### BEGIN - GATHER STATS FOR THE vicidial_campaign_stats TABLE ### + $differential_onemin[$i]=0; + $agents_average_onemin[$i]=0; + + # ### Grab the count of agents and lines + # if ($campaign_id[$i] !~ /(CLOSER|BLEND|INBND|_C$|_B$|_I$)/) + # { + &count_agents_lines; + # } + # else + # { + # if ($DB) {print " CLOSER CAMPAIGN\n";} + # } + + if ($total_agents_avg[$i] > 0) + { + ### Update Drop counter every 60 seconds + if ($drop_count_updater>=60) + { + &calculate_drops; + } + + ### Calculate and update Dial level every 15 seconds + if ($diff_ratio_updater>=15) + { + &calculate_dial_level; + } + } + else + { + if ($campaign_stats_refresh[$i] =~ /Y/) + { + if ($drop_count_updater>=60) + { + if ($DB) {print " REFRESH OVERRIDE: $campaign_id[$i]\n";} + + &calculate_drops; + + $RESETdrop_count_updater++; + + $stmtA = "UPDATE vicidial_campaigns SET campaign_stats_refresh='N' where campaign_id='$campaign_id[$i]';"; + $affected_rows = $dbhA->do($stmtA); + } + } + else + { + if ($campaign_changedate[$i] >= $VDL_ninty) + { + if ($drop_count_updater>=60) + { + if ($DB) {print " CHANGEDATE OVERRIDE: $campaign_id[$i]\n";} + + &calculate_drops; + + $RESETdrop_count_updater++; + } + } + } + } + } + else + { + if ($campaign_stats_refresh[$i] =~ /Y/) + { + if ($drop_count_updater>=60) + { + if ($DB) {print " REFRESH OVERRIDE: $campaign_id[$i]\n";} + + &calculate_drops; + + $RESETdrop_count_updater++; + + $stmtA = "UPDATE vicidial_campaigns SET campaign_stats_refresh='N' where campaign_id='$campaign_id[$i]';"; + $affected_rows = $dbhA->do($stmtA); + } + } + else + { + if ($campaign_changedate[$i] >= $VDL_ninty) + { + if ($drop_count_updater>=60) + { + if ($DB) {print " CHANGEDATE OVERRIDE: $campaign_id[$i]\n";} + + &calculate_drops; + + $RESETdrop_count_updater++; + } + } + } + } + $i++; + } + +if ($RESETdiff_ratio_updater>0) {$RESETdiff_ratio_updater=0; $diff_ratio_updater=0;} +if ($RESETdrop_count_updater>0) {$RESETdrop_count_updater=0; $drop_count_updater=0;} +$diff_ratio_updater = ($diff_ratio_updater + $CLIdelay); +$drop_count_updater = ($drop_count_updater + $CLIdelay); + +sleep($CLIdelay); + +$stat_count++; +$master_loop++; +} + +$dbhA->disconnect(); + +if($DB) +{ +### calculate time to run script ### +$secY = time(); +$secZ = ($secY - $secT); + +if (!$q) {print "DONE. Script execution time in seconds: $secZ\n";} +} + +exit; + + + + + +### SUBROUTINES ############################################################### + +sub event_logger +{ +if ($SYSLOG) + { + if (!$VDHLOGfile) {$VDHLOGfile = "$PATHlogs/adapt.$year-$mon-$mday";} + + ### open the log file for writing ### + open(Lout, ">>$VDHLOGfile") + || die "Can't open $VDHLOGfile: $!\n"; + print Lout "$now_date|$event_string|\n"; + close(Lout); + } +$event_string=''; +} + + +sub adaptive_logger +{ +if ($SYSLOG) + { + $VDHCLOGfile = "$PATHlogs/VDadaptive-$campaign_id[$i].$file_date"; + + ### open the log file for writing ### + open(Aout, ">>$VDHCLOGfile") + || die "Can't open $VDHCLOGfile: $!\n"; + print Aout "$now_date$adaptive_string\n"; + close(Aout); + } +$adaptive_string=''; +} + +sub get_time_now +{ +$secX = time(); +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} +$file_date = "$year-$mon-$mday"; +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$VDL_date = "$year-$mon-$mday 00:00:01"; +$current_hourmin = "$hour$min"; + +### get date-time of one hour ago ### + $VDL_hour = ($secX - (60 * 60)); +($Vsec,$Vmin,$Vhour,$Vmday,$Vmon,$Vyear,$Vwday,$Vyday,$Visdst) = localtime($VDL_hour); +$Vyear = ($Vyear + 1900); +$Vmon++; +if ($Vmon < 10) {$Vmon = "0$Vmon";} +if ($Vmday < 10) {$Vmday = "0$Vmday";} +$VDL_hour = "$Vyear-$Vmon-$Vmday $Vhour:$Vmin:$Vsec"; + +### get date-time of half hour ago ### + $VDL_halfhour = ($secX - (30 * 60)); +($Vsec,$Vmin,$Vhour,$Vmday,$Vmon,$Vyear,$Vwday,$Vyday,$Visdst) = localtime($VDL_halfhour); +$Vyear = ($Vyear + 1900); +$Vmon++; +if ($Vmon < 10) {$Vmon = "0$Vmon";} +if ($Vmday < 10) {$Vmday = "0$Vmday";} +$VDL_halfhour = "$Vyear-$Vmon-$Vmday $Vhour:$Vmin:$Vsec"; + +### get date-time of five minutes ago ### + $VDL_five = ($secX - (5 * 60)); +($Vsec,$Vmin,$Vhour,$Vmday,$Vmon,$Vyear,$Vwday,$Vyday,$Visdst) = localtime($VDL_five); +$Vyear = ($Vyear + 1900); +$Vmon++; +if ($Vmon < 10) {$Vmon = "0$Vmon";} +if ($Vmday < 10) {$Vmday = "0$Vmday";} +$VDL_five = "$Vyear-$Vmon-$Vmday $Vhour:$Vmin:$Vsec"; + +### get epoch of ninty seconds ago ### + $VDL_ninty = ($secX - (1 * 90)); + +### get date-time of one minute ago ### + $VDL_one = ($secX - (1 * 60)); +($Vsec,$Vmin,$Vhour,$Vmday,$Vmon,$Vyear,$Vwday,$Vyday,$Visdst) = localtime($VDL_one); +$Vyear = ($Vyear + 1900); +$Vmon++; +if ($Vmon < 10) {$Vmon = "0$Vmon";} +if ($Vmday < 10) {$Vmday = "0$Vmday";} +$VDL_one = "$Vyear-$Vmon-$Vmday $Vhour:$Vmin:$Vsec"; +} + + +sub count_agents_lines +{ +### Calculate campaign-wide agent waiting and calls waiting differential +$stat_it=15; +$total_agents[$i]=0; +$ready_agents[$i]=0; +$waiting_calls[$i]=0; +$ready_diff_total[$i]=0; +$waiting_diff_total[$i]=0; +$total_agents_total[$i]=0; +$ready_diff_avg[$i]=0; +$waiting_diff_avg[$i]=0; +$total_agents_avg[$i]=0; +$stat_differential[$i]=0; + +$stmtA = "SELECT count(*),status from vicidial_live_agents where campaign_id='$campaign_id[$i]' and last_update_time > '$VDL_one' group by status;"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VCSagent_count[$i] = "$aryA[0]"; + $VCSagent_status[$i] = "$aryA[1]"; + $rec_count++; + if ($VCSagent_status[$i] =~ /READY|DONE/) {$ready_agents[$i] = ($ready_agents[$i] + $VCSagent_count[$i]);} + $total_agents[$i] = ($total_agents[$i] + $VCSagent_count[$i]); + } +$sthA->finish(); + +$stmtA = "SELECT count(*) FROM vicidial_auto_calls where campaign_id='$campaign_id[$i]' and status IN('LIVE');"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $waiting_calls[$i] = "$aryA[0]"; + $rec_count++; + } +$sthA->finish(); + +$stat_ready_agents[$i][$stat_count] = $ready_agents[$i]; +$stat_waiting_calls[$i][$stat_count] = $waiting_calls[$i]; +$stat_total_agents[$i][$stat_count] = $total_agents[$i]; + +if ($stat_count < 15) + { + $stat_it = $stat_count; + $stat_B = 1; + } +else + { + $stat_B = ($stat_count - 14); + } + +$it=0; +while($it < $stat_it) + { + $it_ary = ($it + $stat_B); + $ready_diff_total[$i] = ($ready_diff_total[$i] + $stat_ready_agents[$i][$it_ary]); + $waiting_diff_total[$i] = ($waiting_diff_total[$i] + $stat_waiting_calls[$i][$it_ary]); + $total_agents_total[$i] = ($total_agents_total[$i] + $stat_total_agents[$i][$it_ary]); +# $event_string="$stat_count $it_ary $stat_total_agents[$i][$it_ary]|$stat_ready_agents[$i][$it_ary]|$stat_waiting_calls[$i][$it_ary]"; +# if ($DB) {print " $event_string\n";} +# &event_logger; + $it++; + } + +if ($ready_diff_total[$i] > 0) + {$ready_diff_avg[$i] = ($ready_diff_total[$i] / $stat_it);} +if ($waiting_diff_total[$i] > 0) + {$waiting_diff_avg[$i] = ($waiting_diff_total[$i] / $stat_it);} +if ($total_agents_total[$i] > 0) + {$total_agents_avg[$i] = ($total_agents_total[$i] / $stat_it);} +$stat_differential[$i] = ($ready_diff_avg[$i] - $waiting_diff_avg[$i]); + +$event_string="CAMPAIGN DIFFERENTIAL: $total_agents_avg[$i] $stat_differential[$i] ($ready_diff_avg[$i] - $waiting_diff_avg[$i])"; +if ($DBX) {print "$campaign_id[$i]|$event_string\n";} +if ($DB) {print " $event_string\n";} + +&event_logger; + +# $stmtA = "UPDATE vicidial_campaign_stats SET differential_onemin[$i]='$stat_differential[$i]', agents_average_onemin[$i]='$total_agents_avg[$i]' where campaign_id='$DBIPcampaign[$i]';"; +# $affected_rows = $dbhA->do($stmtA); +} + + +sub calculate_drops +{ +$camp_ANS_STAT_SQL=''; +# GET LIST OF HUMAN-ANSWERED STATUSES +$stmtA = "SELECT status from vicidial_statuses where human_answered='Y';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $camp_ANS_STAT_SQL .= "'$aryA[0]',"; + $rec_count++; + } +$sthA->finish(); + +$stmtA = "SELECT status from vicidial_campaign_statuses where campaign_id='$campaign_id[$i]' and human_answered='Y';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $camp_ANS_STAT_SQL .= "'$aryA[0]',"; + $rec_count++; + } +$sthA->finish(); +chop($camp_ANS_STAT_SQL); + +if ($DBX) {print " CAMPAIGN ANSWERED STATUSES: $campaign_id[$i]|$camp_ANS_STAT_SQL|\n";} + +$RESETdrop_count_updater++; +$VCScalls_today[$i]=0; +$VCSanswers_today[$i]=0; +$VCSdrops_today[$i]=0; +$VCSdrops_today_pct[$i]=0; +$VCSdrops_answers_today_pct[$i]=0; +$VCScalls_hour[$i]=0; +$VCSanswers_hour[$i]=0; +$VCSdrops_hour[$i]=0; +$VCSdrops_hour_pct[$i]=0; +$VCScalls_halfhour[$i]=0; +$VCSanswers_halfhour[$i]=0; +$VCSdrops_halfhour[$i]=0; +$VCSdrops_halfhour_pct[$i]=0; +$VCScalls_five[$i]=0; +$VCSanswers_five[$i]=0; +$VCSdrops_five[$i]=0; +$VCSdrops_five_pct[$i]=0; +$VCScalls_one[$i]=0; +$VCSanswers_one[$i]=0; +$VCSdrops_one[$i]=0; +$VCSdrops_one_pct[$i]=0; + +# LAST ONE MINUTE CALL AND DROP STATS +$stmtA = "SELECT count(*) from $vicidial_log where campaign_id='$campaign_id[$i]' and call_date > '$VDL_one';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VCScalls_one[$i] = "$aryA[0]"; + $rec_count++; + } +$sthA->finish(); +if ($VCScalls_one[$i] > 0) + { + # LAST MINUTE ANSWERS + $stmtA = "SELECT count(*) from $vicidial_log where campaign_id='$campaign_id[$i]' and call_date > '$VDL_one' and status IN($camp_ANS_STAT_SQL);"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VCSanswers_one[$i] = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + # LAST MINUTE DROPS + $stmtA = "SELECT count(*) from $vicidial_log where campaign_id='$campaign_id[$i]' and call_date > '$VDL_one' and status IN('DROP','XDROP');"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VCSdrops_one[$i] = "$aryA[0]"; + if ($VCSdrops_one[$i] > 0) + { + $VCSdrops_one_pct[$i] = ( ($VCSdrops_one[$i] / $VCScalls_one[$i]) * 100 ); + $VCSdrops_one_pct[$i] = sprintf("%.2f", $VCSdrops_one_pct[$i]); + } + $rec_count++; + } + $sthA->finish(); + } + +# TODAY CALL AND DROP STATS +$stmtA = "SELECT count(*) from $vicidial_log where campaign_id='$campaign_id[$i]' and call_date > '$VDL_date';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VCScalls_today[$i] = "$aryA[0]"; + $rec_count++; + } +$sthA->finish(); +if ($VCScalls_today[$i] > 0) + { + # TODAY ANSWERS + $stmtA = "SELECT count(*) from $vicidial_log where campaign_id='$campaign_id[$i]' and call_date > '$VDL_date' and status IN($camp_ANS_STAT_SQL);"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VCSanswers_today[$i] = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + # TODAY DROPS + $stmtA = "SELECT count(*) from $vicidial_log where campaign_id='$campaign_id[$i]' and call_date > '$VDL_date' and status IN('DROP','XDROP');"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VCSdrops_today[$i] = "$aryA[0]"; + if ($VCSdrops_today[$i] > 0) + { + $VCSdrops_today_pct[$i] = ( ($VCSdrops_today[$i] / $VCScalls_today[$i]) * 100 ); + $VCSdrops_today_pct[$i] = sprintf("%.2f", $VCSdrops_today_pct[$i]); + if ($VCSanswers_today[$i] < 1) {$VCSanswers_today[$i] = 1;} + $VCSdrops_answers_today_pct[$i] = ( ($VCSdrops_today[$i] / $VCSanswers_today[$i]) * 100 ); + $VCSdrops_answers_today_pct[$i] = sprintf("%.2f", $VCSdrops_answers_today_pct[$i]); + } + $rec_count++; + } + $sthA->finish(); + } + +# LAST HOUR CALL AND DROP STATS +$stmtA = "SELECT count(*) from $vicidial_log where campaign_id='$campaign_id[$i]' and call_date > '$VDL_hour';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VCScalls_hour[$i] = "$aryA[0]"; + $rec_count++; + } +$sthA->finish(); +if ($VCScalls_hour[$i] > 0) + { + # ANSWERS LAST HOUR + $stmtA = "SELECT count(*) from $vicidial_log where campaign_id='$campaign_id[$i]' and call_date > '$VDL_hour' and status IN($camp_ANS_STAT_SQL);"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VCSanswers_hour[$i] = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + # DROP LAST HOUR + $stmtA = "SELECT count(*) from $vicidial_log where campaign_id='$campaign_id[$i]' and call_date > '$VDL_hour' and status IN('DROP','XDROP');"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VCSdrops_hour[$i] = "$aryA[0]"; + if ($VCSdrops_hour[$i] > 0) + { + $VCSdrops_hour_pct[$i] = ( ($VCSdrops_hour[$i] / $VCScalls_hour[$i]) * 100 ); + $VCSdrops_hour_pct[$i] = sprintf("%.2f", $VCSdrops_hour_pct[$i]); + } + $rec_count++; + } + $sthA->finish(); + } + +# LAST HALFHOUR CALL AND DROP STATS +$stmtA = "SELECT count(*) from $vicidial_log where campaign_id='$campaign_id[$i]' and call_date > '$VDL_halfhour';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VCScalls_halfhour[$i] = "$aryA[0]"; + $rec_count++; + } +$sthA->finish(); +if ($VCScalls_halfhour[$i] > 0) + { + # ANSWERS HALFHOUR + $stmtA = "SELECT count(*) from $vicidial_log where campaign_id='$campaign_id[$i]' and call_date > '$VDL_halfhour' and status IN($camp_ANS_STAT_SQL);"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VCSanswers_halfhour[$i] = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + # DROPS HALFHOUR + $stmtA = "SELECT count(*) from $vicidial_log where campaign_id='$campaign_id[$i]' and call_date > '$VDL_halfhour' and status IN('DROP','XDROP');"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VCSdrops_halfhour[$i] = "$aryA[0]"; + if ($VCSdrops_halfhour[$i] > 0) + { + $VCSdrops_halfhour_pct[$i] = ( ($VCSdrops_halfhour[$i] / $VCScalls_halfhour[$i]) * 100 ); + $VCSdrops_halfhour_pct[$i] = sprintf("%.2f", $VCSdrops_halfhour_pct[$i]); + } + $rec_count++; + } + $sthA->finish(); + } + +# LAST FIVE MINUTE CALL AND DROP STATS +$stmtA = "SELECT count(*) from $vicidial_log where campaign_id='$campaign_id[$i]' and call_date > '$VDL_five';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VCScalls_five[$i] = "$aryA[0]"; + $rec_count++; + } +$sthA->finish(); +if ($VCScalls_five[$i] > 0) + { + # ANSWERS FIVEMINUTE + $stmtA = "SELECT count(*) from $vicidial_log where campaign_id='$campaign_id[$i]' and call_date > '$VDL_five' and status IN($camp_ANS_STAT_SQL);"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VCSanswers_five[$i] = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + # DROPS FIVEMINUTE + $stmtA = "SELECT count(*) from $vicidial_log where campaign_id='$campaign_id[$i]' and call_date > '$VDL_five' and status IN('DROP','XDROP');"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VCSdrops_five[$i] = "$aryA[0]"; + if ($VCSdrops_five[$i] > 0) + { + $VCSdrops_five_pct[$i] = ( ($VCSdrops_five[$i] / $VCScalls_five[$i]) * 100 ); + $VCSdrops_five_pct[$i] = sprintf("%.2f", $VCSdrops_five_pct[$i]); + } + $rec_count++; + } + $sthA->finish(); + } +if ($DBX) {print "$campaign_id[$i]|$VCSdrops_five_pct[$i]|$VCSdrops_today_pct[$i]\n";} + +# DETERMINE WHETHER TO GATHER STATUS CATEGORY STATISTICS +$VSC_categories=0; +$VSCupdateSQL=''; +$stmtA = "SELECT vsc_id from vicidial_status_categories where tovdad_display='Y';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VSC_categories[$rec_count] = "$aryA[0]"; + $rec_count++; + } +$sthA->finish(); + +$g=0; +foreach (@VSC_categories) + { + $VSCcategory=$VSC_categories[$g]; + $VSCtally=''; + $CATstatusesSQL=''; + # FIND STATUSES IN STATUS CATEGORY + $stmtA = "SELECT status from vicidial_statuses where category='$VSCcategory';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $CATstatusesSQL .= "'$aryA[0]',"; + $rec_count++; + } + # FIND CAMPAIGN_STATUSES IN STATUS CATEGORY + $stmtA = "SELECT status from vicidial_campaign_statuses where category='$VSCcategory' and campaign_id='$campaign_id[$i]';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $CATstatusesSQL .= "'$aryA[0]',"; + $rec_count++; + } + chop($CATstatusesSQL); + if (length($CATstatusesSQL)>2) + { + # FIND STATUSES IN STATUS CATEGORY + $stmtA = "SELECT count(*) from $vicidial_log where campaign_id='$campaign_id[$i]' and call_date > '$VDL_date' and status IN($CATstatusesSQL);"; + # if ($DBX) {print "|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VSCtally = "$aryA[0]"; + $rec_count++; + } + } + $g++; + if ($DBX) {print " $campaign_id[$i]|$VSCcategory|$VSCtally|$CATstatusesSQL|\n";} + $VSCupdateSQL .= "status_category_$g='$VSCcategory',status_category_count_$g='$VSCtally',"; + } +while ($g < 4) + { + $g++; + $VSCupdateSQL .= "status_category_$g='',status_category_count_$g='0',"; + } +chop($VSCupdateSQL); + +$stmtA = "UPDATE vicidial_campaign_stats SET calls_today='$VCScalls_today[$i]',answers_today='$VCSanswers_today[$i]',drops_today='$VCSdrops_today[$i]',drops_today_pct='$VCSdrops_today_pct[$i]',drops_answers_today_pct='$VCSdrops_answers_today_pct[$i]',calls_hour='$VCScalls_hour[$i]',answers_hour='$VCSanswers_hour[$i]',drops_hour='$VCSdrops_hour[$i]',drops_hour_pct='$VCSdrops_hour_pct[$i]',calls_halfhour='$VCScalls_halfhour[$i]',answers_halfhour='$VCSanswers_halfhour[$i]',drops_halfhour='$VCSdrops_halfhour[$i]',drops_halfhour_pct='$VCSdrops_halfhour_pct[$i]',calls_fivemin='$VCScalls_five[$i]',answers_fivemin='$VCSanswers_five[$i]',drops_fivemin='$VCSdrops_five[$i]',drops_fivemin_pct='$VCSdrops_five_pct[$i]',calls_onemin='$VCScalls_one[$i]',answers_onemin='$VCSanswers_one[$i]',drops_onemin='$VCSdrops_one[$i]',drops_onemin_pct='$VCSdrops_one_pct[$i]',$VSCupdateSQL where campaign_id='$campaign_id[$i]';"; +$affected_rows = $dbhA->do($stmtA); +if ($DBX) {print "$campaign_id[$i]|$stmtA|\n";} +} + + + +sub calculate_dial_level +{ +$RESETdiff_ratio_updater++; +$VCSINCALL[$i]=0; +$VCSREADY[$i]=0; +$VCSCLOSER[$i]=0; +$VCSPAUSED[$i]=0; +$VCSagents[$i]=0; +$VCSagents_calc[$i]=0; +$VCSagents_active[$i]=0; + +# COUNTS OF STATUSES OF AGENTS IN THIS CAMPAIGN +$stmtA = "SELECT count(*),status from vicidial_live_agents where campaign_id='$campaign_id[$i]' and last_update_time > '$VDL_one' group by status;"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VCSagent_count[$i] = "$aryA[0]"; + $VCSagent_status[$i] = "$aryA[1]"; + $rec_count++; + if ($VCSagent_status[$i] =~ /INCALL|QUEUE/) {$VCSINCALL[$i] = ($VCSINCALL[$i] + $VCSagent_count[$i]);} + if ($VCSagent_status[$i] =~ /READY/) {$VCSREADY[$i] = ($VCSREADY[$i] + $VCSagent_count[$i]);} + if ($VCSagent_status[$i] =~ /CLOSER/) {$VCSCLOSER[$i] = ($VCSCLOSER[$i] + $VCSagent_count[$i]);} + if ($VCSagent_status[$i] =~ /PAUSED/) {$VCSPAUSED[$i] = ($VCSPAUSED[$i] + $VCSagent_count[$i]);} + $VCSagents[$i] = ($VCSagents[$i] + $VCSagent_count[$i]); + } +$sthA->finish(); + +if ($available_only_ratio_tally[$i] =~ /Y/) + {$VCSagents_calc[$i] = $VCSREADY[$i];} +else + {$VCSagents_calc[$i] = ($VCSINCALL[$i] + $VCSREADY[$i]);} +$VCSagents_active[$i] = ($VCSINCALL[$i] + $VCSREADY[$i] + $VCSCLOSER[$i]); + +### END - GATHER STATS FOR THE vicidial_campaign_stats TABLE ### + +if ($campaign_allow_inbound[$i] =~ /Y/) + { + # GET AVERAGES FROM THIS CAMPAIGN + $stmtA = "SELECT differential_onemin,agents_average_onemin from vicidial_campaign_stats where campaign_id='$campaign_id[$i]';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $differential_onemin[$i] = "$aryA[0]"; + $agents_average_onemin[$i] = "$aryA[1]"; + $rec_count++; + } + $sthA->finish(); + } +else + { + $agents_average_onemin[$i] = $total_agents_avg[$i]; + $differential_onemin[$i] = $stat_differential[$i]; + } + +if ( ($dial_method[$i] =~ /ADAPT_HARD_LIMIT|ADAPT_AVERAGE|ADAPT_TAPERED/) || ($force_test>0) ) + { + # Calculate the optimal dial_level differential for the past minute + $differential_target[$i] = ($differential_onemin[$i] + $adaptive_dl_diff_target[$i]); + $differential_mul[$i] = ($differential_target[$i] / $agents_average_onemin[$i]); + $differential_pct_raw[$i] = ($differential_mul[$i] * 100); + $differential_pct[$i] = sprintf("%.2f", $differential_pct_raw[$i]); + + # Factor in the intensity setting + $intensity_mul[$i] = ($adaptive_intensity[$i] / 100); + if ($differential_pct_raw[$i] < 0) + { + $abs_intensity_mul[$i] = abs($intensity_mul[$i] - 1); + $intensity_diff[$i] = ($differential_pct_raw[$i] * $abs_intensity_mul[$i]); + } + else + {$intensity_diff[$i] = ($differential_pct_raw[$i] * ($intensity_mul[$i] + 1) );} + $intensity_pct[$i] = sprintf("%.2f", $intensity_diff[$i]); + $intensity_diff_mul[$i] = ($intensity_diff[$i] / 100); + + # Suggested dial_level based on differential + $suggested_dial_level[$i] = ($auto_dial_level[$i] * ($differential_mul[$i] + 1) ); + $suggested_dial_level[$i] = sprintf("%.3f", $suggested_dial_level[$i]); + + # Suggested dial_level based on differential with intensity setting + $intensity_dial_level[$i] = ($auto_dial_level[$i] * ($intensity_diff_mul[$i] + 1) ); + $intensity_dial_level[$i] = sprintf("%.3f", $intensity_dial_level[$i]); + + # Calculate last timezone target for ADAPT_TAPERED + $last_target_hour_final[$i] = $adaptive_latest_server_time[$i]; +# if ($last_target_hour_final[$i]>2400) {$last_target_hour_final[$i]=2400;} + $tapered_hours_left[$i] = ($last_target_hour_final[$i] - $current_hourmin); + if ($tapered_hours_left[$i] > 1000) + {$tapered_rate[$i] = 1;} + else + {$tapered_rate[$i] = ($tapered_hours_left[$i] / 1000);} + + $adaptive_string = "\n"; + $adaptive_string .= "CAMPAIGN: $campaign_id[$i]\n"; + $adaptive_string .= "SETTINGS-\n"; + $adaptive_string .= " DIAL LEVEL: $auto_dial_level[$i]\n"; + $adaptive_string .= " DIAL METHOD: $dial_method[$i]\n"; + $adaptive_string .= " AVAIL ONLY: $available_only_ratio_tally[$i]\n"; + $adaptive_string .= " DROP PERCENT: $adaptive_dropped_percentage[$i]\n"; + $adaptive_string .= " MAX LEVEL: $adaptive_maximum_level[$i]\n"; + $adaptive_string .= " SERVER TIME: $current_hourmin\n"; + $adaptive_string .= " LATE TARGET: $last_target_hour_final[$i] ($tapered_hours_left[$i] left|$tapered_rate[$i])\n"; + $adaptive_string .= " INTENSITY: $adaptive_intensity[$i]\n"; + $adaptive_string .= " DLDIFF TARGET: $adaptive_dl_diff_target[$i]\n"; + $adaptive_string .= "CURRENT STATS-\n"; + $adaptive_string .= " AVG AGENTS: $agents_average_onemin[$i]\n"; + $adaptive_string .= " AGENTS: $VCSagents[$i] ACTIVE: $VCSagents_active[$i] CALC: $VCSagents_calc[$i] INCALL: $VCSINCALL[$i] READY: $VCSREADY[$i]\n"; + $adaptive_string .= " DL DIFFERENTIAL: $differential_target[$i] = ($differential_onemin[$i] + $adaptive_dl_diff_target[$i])\n"; + $adaptive_string .= "DIAL LEVEL SUGGESTION-\n"; + $adaptive_string .= " PERCENT DIFF: $differential_pct[$i]\n"; + $adaptive_string .= " SUGGEST DL: $suggested_dial_level[$i] = ($auto_dial_level[$i] * ($differential_mul[$i] + 1) )\n"; + $adaptive_string .= " INTENSE DIFF: $intensity_pct[$i]\n"; + $adaptive_string .= " INTENSE DL: $intensity_dial_level[$i] = ($auto_dial_level[$i] * ($intensity_diff_mul[$i] + 1) )\n"; + if ($intensity_dial_level[$i] > $adaptive_maximum_level[$i]) + { + $adaptive_string .= " DIAL LEVEL OVER CAP! SETTING TO CAP: $adaptive_maximum_level[$i]\n"; + $intensity_dial_level[$i] = $adaptive_maximum_level[$i]; + } + if ($intensity_dial_level[$i] < 1) + { + $adaptive_string .= " DIAL LEVEL TOO LOW! SETTING TO 1\n"; + $intensity_dial_level[$i] = "1.0"; + } + $adaptive_string .= "DROP STATS-\n"; + $adaptive_string .= " TODAY DROPS: $VCScalls_today[$i] $VCSdrops_today[$i] $VCSdrops_today_pct[$i]%\n"; + $adaptive_string .= " ANSWER DROPS: $VCSanswers_today[$i] $VCSdrops_answers_today_pct[$i]%\n"; + $adaptive_string .= " ONE HOUR DROPS: $VCScalls_hour[$i]/$VCSanswers_hour[$i] $VCSdrops_hour[$i] $VCSdrops_hour_pct[$i]%\n"; + $adaptive_string .= " HALF HOUR DROPS: $VCScalls_halfhour[$i]/$VCSanswers_halfhour[$i] $VCSdrops_halfhour[$i] $VCSdrops_halfhour_pct[$i]%\n"; + $adaptive_string .= " FIVE MIN DROPS: $VCScalls_five[$i]/$VCSanswers_five[$i] $VCSdrops_five[$i] $VCSdrops_five_pct[$i]%\n"; + $adaptive_string .= " ONE MIN DROPS: $VCScalls_one[$i]/$VCSanswers_one[$i] $VCSdrops_one[$i] $VCSdrops_one_pct[$i]%\n"; + + ### DROP PERCENTAGE RULES TO LOWER DIAL_LEVEL ### + if ( ($VCScalls_one[$i] > 20) && ($VCSdrops_one_pct[$i] > 50) ) + { + $intensity_dial_level[$i] = ($intensity_dial_level[$i] / 2); + $adaptive_string .= " DROP RATE OVER 50% FOR LAST MINUTE! CUTTING DIAL LEVEL TO: $intensity_dial_level[$i]\n"; + } + if ( ($VCScalls_today[$i] > 50) && ($VCSdrops_answers_today_pct[$i] > $adaptive_dropped_percentage[$i]) ) + { + if ($dial_method[$i] =~ /ADAPT_HARD_LIMIT/) + { + $intensity_dial_level[$i] = "1.0"; + $adaptive_string .= " DROP RATE OVER HARD LIMIT FOR TODAY! HARD DIAL LEVEL TO: 1.0\n"; + } + if ($dial_method[$i] =~ /ADAPT_AVERAGE/) + { + $intensity_dial_level[$i] = ($intensity_dial_level[$i] / 2); + $adaptive_string .= " DROP RATE OVER LIMIT FOR TODAY! AVERAGING DIAL LEVEL TO: $intensity_dial_level[$i]\n"; + } + if ($dial_method[$i] =~ /ADAPT_TAPERED/) + { + if ($tapered_hours_left[$i] < 0) + { + $intensity_dial_level[$i] = "1.0"; + $adaptive_string .= " DROP RATE OVER LAST HOUR LIMIT FOR TODAY! TAPERING DIAL LEVEL TO: 1.0\n"; + } + else + { + $intensity_dial_level[$i] = ($intensity_dial_level[$i] * $tapered_rate[$i]); + $adaptive_string .= " DROP RATE OVER LIMIT FOR TODAY! TAPERING DIAL LEVEL TO: $intensity_dial_level[$i]\n"; + } + } + } + + ### ALWAYS RAISE DIAL_LEVEL TO 1.0 IF IT IS LOWER ### + if ($intensity_dial_level[$i] < 1) + { + $adaptive_string .= " DIAL LEVEL TOO LOW! SETTING TO 1\n"; + $intensity_dial_level[$i] = "1.0"; + } + + if (!$TEST) + { + $stmtA = "UPDATE vicidial_campaigns SET auto_dial_level='$intensity_dial_level[$i]' where campaign_id='$campaign_id[$i]';"; + $Uaffected_rows = $dbhA->do($stmtA); + } + + $adaptive_string .= "DIAL LEVEL UPDATED TO: $intensity_dial_level[$i] CONFIRM: $Uaffected_rows\n"; + } + +if ($DB) {print "campaign stats updated: $campaign_id[$i] $adaptive_string\n";} + + &adaptive_logger; +} diff --git a/agc_2-X/branches/agc_2.0.4/bin/AST_VDauto_dial.pl b/agc_2-X/branches/agc_2.0.4/bin/AST_VDauto_dial.pl new file mode 100644 index 00000000..ae4822bc --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/AST_VDauto_dial.pl @@ -0,0 +1,1551 @@ +#!/usr/bin/perl +# +# AST_VDauto_dial.pl version 2.0.3 *DBI-version* +# +# DESCRIPTION: +# Places auto_dial calls on the VICIDIAL dialer system +# +# SUMMARY: +# This program was designed for people using the Asterisk PBX with VICIDIAL +# +# For the client to use VICIDIAL, this program must be in the cron constantly +# +# For this program to work you need to have the "asterisk" MySQL database +# created and create the tables listed in the CONF_MySQL.txt file, also make sure +# that the machine running this program has read/write/update/delete access +# to that database +# +# It is recommended that you run this program on the local Asterisk machine +# +# This script is to run perpetually querying every second to place new phone +# calls from the vicidial_hopper based upon how many available agents there are +# and the value of the auto_dial_level setting in the campaign screen of the +# admin web page +# +# It is good practice to keep this program running by placing the associated +# KEEPALIVE script running every minute to ensure this program is always running +# +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# +# CHANGELOG: +# 50125-1201 - Changed dial timeout to 120 seconds from 180 seconds +# 50317-0954 - Added duplicate check per cycle to account for DB lockups +# 50322-1302 - Added campaign custom callerid feature +# 50324-1353 - Added optional variable to record ring time thru separate diap prefix +# 50606-2308 - Added code to ensure no calls placed out on inactive campaign +# 50617-1248 - Added code to place LOGOUT entry in auto-paused user logs +# 50620-1349 - Added custom vdad transfer AGI extension per campaign +# 50810-1610 - Added database server variable definitions lookup +# 50810-1630 - Added max_vicidial_trunks server limiter on active lines +# 50812-0957 - Corrected max_trunks logic, added update of server every 25 sec +# 60120-1522 - Corrected time error for hour variable, caused agi problems +# 60427-1223 - Fixed Blended in/out CLOSER campaign issue +# 60608-1134 - Altered vac table field of call_type for IN OUT distinction +# 60612-1324 - Altered dead call section to accept BUSY detection from VD_hangup +# - Altered dead call section to accept DISCONNECT detection from VD_hangup +# 60614-1142 - Added code to work with recycled leads, multi called_since_last_reset values +# - Removed gmt lead validation because it is already done by VDhopper +# 60807-1438 - Changed to DBI +# - Changed to use /etc/astguiclient.conf for configs +# 60814-1749 - Added option for no logging to file +# 60821-1546 - Added option to not dial phone_code per campaign +# 60824-1437 - Added available_only_ratio_tally option +# 61003-1353 - Added restrictions for server trunks +# 61113-1625 - Added code for clearing VDAC LIVE jams +# 61115-1725 - Added OUTBALANCE to call calculation for call_type for balance dialing +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70115-1635 - Added initial auto-alt-dial functionality +# 70116-1619 - Added VDAD Ring-No-Answer Auto Alt Dial code +# 70118-1539 - Added user_group logging to vicidial_user_log +# 70131-1550 - Fixed Manual dialing trunk shortage bug +# 70205-1414 - Added code for last called date update +# 70207-1031 - Fixed Tally-only-available bug with customer hangups +# 70215-1123 - Added queue_log ABANDON logging +# 70302-1412 - Fixed max_vicidial_trunks update if set to 0 +# 70320-1458 - Fixed several errors in calculating trunk shortage for campaigns +# 71029-1909 - Changed CLOSER-type campaign_id restriction +# 71030-2054 - Added hopper priority sorting +# + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-t] = test\n [-debug] = verbose debug messages\n [--delay=XXX] = delay of XXX seconds per loop, default 2.5 seconds\n\n"; + } + else + { + if ($args =~ /--delay=/i) + { + @data_in = split(/--delay=/,$args); + $loop_delay = $data_in[1]; + print " LOOP DELAY OVERRIDE!!!!! = $loop_delay seconds\n\n"; + $loop_delay = ($loop_delay * 1000); + } + else + { + $loop_delay = '2500'; + } + if ($args =~ /-debug/i) + { + $DB=1; # Debug flag, set to 0 for no debug messages, On an active system this will generate hundreds of lines of output per minute + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +print "no command line options set\n"; + $loop_delay = '2500'; + $DB=1; +} +### end parsing run-time options ### + + +# constants +$US='__'; +$MT[0]=''; +$RECcount=''; ### leave blank for no REC count +$RECprefix='7'; ### leave blank for no REC prefix +$useJAMdebugFILE='1'; ### leave blank for no Jam call debug file writing +$max_vicidial_trunks=0; ### setting a default value for max_vicidial_trunks + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} + + &get_time_now; # update time/date variables + +if (!$VDADLOGfile) {$VDADLOGfile = "$PATHlogs/vdautodial.$year-$mon-$mday";} +if (!$JAMdebugFILE) {$JAMdebugFILE = "$PATHlogs/vdad-JAM.$year-$mon-$mday";} + +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use DBI; + + ### connect to MySQL database defined in the conf file + $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### Grab Server values from the database +$stmtA = "SELECT telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERNAMEupdate,ASTmgrUSERNAMElisten,ASTmgrUSERNAMEsend,max_vicidial_trunks,answer_transfer_agent,local_gmt,ext_context,vd_server_logs FROM servers where server_ip = '$server_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBtelnet_host = "$aryA[0]"; + $DBtelnet_port = "$aryA[1]"; + $DBASTmgrUSERNAME = "$aryA[2]"; + $DBASTmgrSECRET = "$aryA[3]"; + $DBASTmgrUSERNAMEupdate = "$aryA[4]"; + $DBASTmgrUSERNAMElisten = "$aryA[5]"; + $DBASTmgrUSERNAMEsend = "$aryA[6]"; + $DBmax_vicidial_trunks = "$aryA[7]"; + $DBanswer_transfer_agent= "$aryA[8]"; + $DBSERVER_GMT = "$aryA[9]"; + $DBext_context = "$aryA[10]"; + $DBvd_server_logs = "$aryA[11]"; + if ($DBtelnet_host) {$telnet_host = $DBtelnet_host;} + if ($DBtelnet_port) {$telnet_port = $DBtelnet_port;} + if ($DBASTmgrUSERNAME) {$ASTmgrUSERNAME = $DBASTmgrUSERNAME;} + if ($DBASTmgrSECRET) {$ASTmgrSECRET = $DBASTmgrSECRET;} + if ($DBASTmgrUSERNAMEupdate) {$ASTmgrUSERNAMEupdate = $DBASTmgrUSERNAMEupdate;} + if ($DBASTmgrUSERNAMElisten) {$ASTmgrUSERNAMElisten = $DBASTmgrUSERNAMElisten;} + if ($DBASTmgrUSERNAMEsend) {$ASTmgrUSERNAMEsend = $DBASTmgrUSERNAMEsend;} + $max_vicidial_trunks = $DBmax_vicidial_trunks; + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBext_context) {$ext_context = $DBext_context;} + if ($DBvd_server_logs =~ /Y/) {$SYSLOG = '1';} + else {$SYSLOG = '0';} + $rec_count++; + } +$sthA->finish(); + + $event_string='LOGGED INTO MYSQL SERVER ON 1 CONNECTION|'; + &event_logger; + +############################################# +##### START QUEUEMETRICS LOGGING LOOKUP ##### +$stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $enable_queuemetrics_logging = "$aryA[0]"; + $queuemetrics_server_ip = "$aryA[1]"; + $queuemetrics_dbname = "$aryA[2]"; + $queuemetrics_login= "$aryA[3]"; + $queuemetrics_pass = "$aryA[4]"; + $queuemetrics_log_id = "$aryA[5]"; + $rec_count++; + } +$sthA->finish(); +##### END QUEUEMETRICS LOGGING LOOKUP ##### +########################################### + + +$one_day_interval = 12; # 1 month loops for one year +while($one_day_interval > 0) +{ + + $endless_loop=5760000; # 30 days minutes at XXX seconds per loop + $stat_count=1; + + while($endless_loop > 0) + { + &get_time_now; + + $VDADLOGfile = "$PATHlogs/vdautodial.$year-$mon-$mday"; + + ############################################################################### + ###### first figure out how many calls should be placed for each campaign per server + ############################################################################### + @DBlive_user=@MT; + @DBlive_server_ip=@MT; + @DBlive_campaign=@MT; + @DBlive_conf_exten=@MT; + @DBlive_status=@MT; + @DBcampaigns=@MT; + @DBIPaddress=@MT; + @DBIPcampaign=@MT; + @DBIPactive=@MT; + @DBIPvdadexten=@MT; + @DBIPcount=@MT; + @DBIPACTIVEcount=@MT; + @DBIPINCALLcount=@MT; + @DBIPadlevel=@MT; + @DBIPdialtimeout=@MT; + @DBIPdialprefix=@MT; + @DBIPcampaigncid=@MT; + @DBIPexistcalls=@MT; + @DBIPgoalcalls=@MT; + @DBIPmakecalls=@MT; + @DBIPlivecalls=@MT; + @DBIPclosercamp=@MT; + @DBIPomitcode=@MT; + @DBIPautoaltdial=@MT; + @DBIPtrunk_shortage=@MT; + @DBIPold_trunk_shortage=@MT; + @DBIPserver_trunks_limit=@MT; + @DBIPserver_trunks_other=@MT; + @DBIPserver_trunks_allowed=@MT; + + $active_line_counter=0; + $user_counter=0; + $user_campaigns = '|'; + $user_campaignsSQL = "''"; + $user_campaigns_counter = 0; + $user_campaignIP = '|'; + $user_CIPct = 0; + $active_agents = "'READY','QUEUE','INCALL','DONE'"; + $lists_update = ''; + $LUcount=0; + $campaigns_update = ''; + $CPcount=0; + + ##### Get a listing of the users that are active and ready to take calls + ##### Also get a listing of the campaigns and campaigns/serverIP that will be used + $stmtA = "SELECT user,server_ip,campaign_id,conf_exten,status FROM vicidial_live_agents where status IN($active_agents) and server_ip='$server_ip' and last_update_time > '$BDtsSQLdate' order by last_call_time"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBlive_user[$user_counter] = "$aryA[0]"; + $DBlive_server_ip[$user_counter] = "$aryA[1]"; + $DBlive_campaign[$user_counter] = "$aryA[2]"; + $DBlive_conf_exten[$user_counter] = "$aryA[3]"; + $DBlive_status[$user_counter] = "$aryA[4]"; + + if ($user_campaigns !~ /\|$DBlive_campaign[$user_counter]\|/i) + { + if ($campaigns_update !~ /'$DBlive_campaign[$user_counter]'/) {$campaigns_update .= "'$DBlive_campaign[$user_counter]',"; $CPcount++;} + $user_campaigns .= "$DBlive_campaign[$user_counter]|"; + $user_campaignsSQL .= ",'$DBlive_campaign[$user_counter]'"; + $DBcampaigns[$user_campaigns_counter] = $DBlive_campaign[$user_counter]; + $user_campaigns_counter++; + } + if ($user_campaignIP !~ /\|$DBlive_campaign[$user_counter]__$DBlive_server_ip[$user_counter]\|/i) + { + $user_campaignIP .= "$DBlive_campaign[$user_counter]__$DBlive_server_ip[$user_counter]|"; + $DBIPcampaign[$user_CIPct] = "$DBlive_campaign[$user_counter]"; + $DBIPaddress[$user_CIPct] = "$DBlive_server_ip[$user_counter]"; + $user_CIPct++; + } + $user_counter++; + $rec_count++; + } + $sthA->finish(); + + ### see how many total VDAD calls are going on right now for max limiter + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where server_ip='$server_ip' and status IN('SENT','RINGING','LIVE','XFER','CLOSER');"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $active_line_counter = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + + $event_string="LIVE AGENTS LOGGED IN: $user_counter ACTIVE CALLS: $active_line_counter"; + &event_logger; + + $stmtA = "UPDATE vicidial_campaign_server_stats set local_trunk_shortage='0' where server_ip='$server_ip' and campaign_id NOT IN($user_campaignsSQL);"; + $UVCSSaffected_rows = $dbhA->do($stmtA); + if ($UVCSSaffected_rows > 0) + { + $event_string="OLD TRUNK SHORTS CLEARED: $UVCSSaffected_rows |$user_campaignsSQL|"; + &event_logger; + } + $user_CIPct = 0; + foreach(@DBIPcampaign) + { + $user_counter=0; + foreach(@DBlive_campaign) + { + if ( ($DBlive_campaign[$user_counter] =~ /$DBIPcampaign[$user_CIPct]/i) && (length($DBlive_campaign[$user_counter]) == length($DBIPcampaign[$user_CIPct])) && ($DBlive_server_ip[$user_counter] =~ /$DBIPaddress[$user_CIPct]/i) ) + { + $DBIPcount[$user_CIPct]++; + $DBIPACTIVEcount[$user_CIPct] = ($DBIPACTIVEcount[$user_CIPct] + 0); + $DBIPINCALLcount[$user_CIPct] = ($DBIPINCALLcount[$user_CIPct] + 0); + if ($DBlive_status[$user_counter] =~ /READY|DONE/) + { + $DBIPACTIVEcount[$user_CIPct]++; + } + else + { + $DBIPINCALLcount[$user_CIPct]++; + } + } + $user_counter++; + } + + ### check for vicidial_campaign_server_stats record, if non present then create it + $stmtA = "SELECT local_trunk_shortage FROM vicidial_campaign_server_stats where campaign_id='$DBIPcampaign[$user_CIPct]' and server_ip='$server_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBIPold_trunk_shortage[$user_CIPct] = "$aryA[0]"; + $rec_count++; + } + if ($rec_count < 1) + { + $stmtA = "INSERT INTO vicidial_campaign_server_stats SET local_trunk_shortage='0', server_ip='$server_ip',campaign_id='$DBIPcampaign[$user_CIPct]';"; + $affected_rows = $dbhA->do($stmtA); + + $DBIPold_trunk_shortage[$user_CIPct]=0; + + $event_string="VCSS ENTRY INSERTED: $affected_rows"; + &event_logger; + } + + $DBIPserver_trunks_limit[$user_CIPct] = ''; + $DBIPserver_trunks_other[$user_CIPct] = 0; + $DBIPserver_trunks_allowed[$user_CIPct] = $max_vicidial_trunks; + ### check for vicidial_server_trunks record + $stmtA = "SELECT dedicated_trunks FROM vicidial_server_trunks where campaign_id='$DBIPcampaign[$user_CIPct]' and server_ip='$server_ip' and trunk_restriction='MAXIMUM_LIMIT';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBIPserver_trunks_limit[$user_CIPct] = "$aryA[0]"; + $rec_count++; + } + $stmtA = "SELECT sum(dedicated_trunks) FROM vicidial_server_trunks where campaign_id NOT IN('$DBIPcampaign[$user_CIPct]') and server_ip='$server_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBIPserver_trunks_other[$user_CIPct] = "$aryA[0]"; + $rec_count++; + } + + $DBIPserver_trunks_allowed[$user_CIPct] = ($max_vicidial_trunks - $DBIPserver_trunks_other[$user_CIPct]); + + + ### grab the dial_level and multiply by active agents to get your goalcalls + $DBIPadlevel[$user_CIPct]=0; + $stmtA = "SELECT auto_dial_level,local_call_time,dial_timeout,dial_prefix,campaign_cid,active,campaign_vdad_exten,closer_campaigns,omit_phone_code,available_only_ratio_tally,auto_alt_dial,campaign_allow_inbound FROM vicidial_campaigns where campaign_id='$DBIPcampaign[$user_CIPct]'"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + $active_only=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBIPadlevel[$user_CIPct] = "$aryA[0]"; + $DBIPcalltime[$user_CIPct] = "$aryA[1]"; + $DBIPdialtimeout[$user_CIPct] = "$aryA[2]"; + $DBIPdialprefix[$user_CIPct] = "$aryA[3]"; + $DBIPcampaigncid[$user_CIPct] = "$aryA[4]"; + $DBIPactive[$user_CIPct] = "$aryA[5]"; + $DBIPvdadexten[$user_CIPct] = "$aryA[6]"; + $DBIPclosercamp[$user_CIPct] = "$aryA[7]"; + $omit_phone_code = "$aryA[8]"; + if ($omit_phone_code =~ /Y/) {$DBIPomitcode[$user_CIPct] = 1;} + else {$DBIPomitcode[$user_CIPct] = 0;} + $available_only_ratio_tally = "$aryA[9]"; + if ($available_only_ratio_tally =~ /Y/) + { + $DBIPcount[$user_CIPct] = $DBIPACTIVEcount[$user_CIPct]; + $active_only=1; + } + $DBIPautoaltdial[$user_CIPct] = "$aryA[10]"; + $DBIPcampaign_allow_inbound[$user_CIPct] = "$aryA[11]"; + $rec_count++; + } + $sthA->finish(); + + $DBIPgoalcalls[$user_CIPct] = ($DBIPadlevel[$user_CIPct] * $DBIPcount[$user_CIPct]); + if ($active_only > 0) + { + $tally_xfer_line_counter=0; + ### see how many VDAD calls are live as XFERs to agents + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where server_ip='$DBIPaddress[$user_CIPct]' and campaign_id='$DBIPcampaign[$user_CIPct]' and status IN('XFER','CLOSER');"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $tally_xfer_line_counter = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + + $DBIPgoalcalls[$user_CIPct] = ($DBIPgoalcalls[$user_CIPct] + $tally_xfer_line_counter); + } + if ($DBIPactive[$user_CIPct] =~ /N/) {$DBIPgoalcalls[$user_CIPct] = 0;} + $DBIPgoalcalls[$user_CIPct] = sprintf("%.0f", $DBIPgoalcalls[$user_CIPct]); + + $event_string="$DBIPcampaign[$user_CIPct] $DBIPaddress[$user_CIPct]: agents: $DBIPcount[$user_CIPct] dial_level: $DBIPadlevel[$user_CIPct]"; + &event_logger; + + + ### see how many calls are alrady active per campaign per server and + ### subtract that number from goalcalls to determine how many new + ### calls need to be placed in this loop + if ($DBIPcampaign_allow_inbound[$user_CIPct] =~ /Y/) + { + if (length($DBIPclosercamp[$user_CIPct]) > 2) + { + $DBIPclosercamp[$user_CIPct] =~ s/^ | -$//gi; + $DBIPclosercamp[$user_CIPct] =~ s/ /','/gi; + $DBIPclosercamp[$user_CIPct] = "'$DBIPclosercamp[$user_CIPct]'"; + } + else {$DBIPclosercamp[$user_CIPct]="''";} + + $campaign_query = "( (call_type='IN' and campaign_id IN($DBIPclosercamp[$user_CIPct])) or (campaign_id='$DBIPcampaign[$user_CIPct]' and call_type IN('OUT','OUTBALANCE')) )"; + } + else {$campaign_query = "(campaign_id='$DBIPcampaign[$user_CIPct]' and call_type IN('OUT','OUTBALANCE'))";} + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where $campaign_query and server_ip='$DBIPaddress[$user_CIPct]' and status IN('SENT','RINGING','LIVE','XFER','CLOSER');"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBIPexistcalls[$user_CIPct] = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + + $active_line_goal=0; + $DBIPmakecalls[$user_CIPct] = ($DBIPgoalcalls[$user_CIPct] - $DBIPexistcalls[$user_CIPct]); + $DBIPmakecallsGOAL = $DBIPmakecalls[$user_CIPct]; + $MVT_msg = ''; + $DBIPtrunk_shortage[$user_CIPct] = 0; + $active_line_goal = ($active_line_counter + $DBIPmakecalls[$user_CIPct]); + if ($active_line_goal > $max_vicidial_trunks) + { + $NEWmakecallsgoal = ($max_vicidial_trunks - $active_line_counter); + if ($DBIPmakecalls[$user_CIPct] > $NEWmakecallsgoal) + {$DBIPmakecalls[$user_CIPct] = $NEWmakecallsgoal;} + $DBIPtrunk_shortage[$user_CIPct] = ($active_line_goal - $max_vicidial_trunks); + if ($DBIPtrunk_shortage[$user_CIPct] > $DBIPmakecallsGOAL) + {$DBIPtrunk_shortage[$user_CIPct] = $DBIPmakecallsGOAL} + $MVT_msg = "MVT override: $max_vicidial_trunks |$DBIPmakecalls[$user_CIPct] $DBIPtrunk_shortage[$user_CIPct]|"; + } + if (length($DBIPserver_trunks_limit[$user_CIPct])>0) + { + if ($DBIPserver_trunks_limit[$user_CIPct] < $active_line_goal) + { + $MVT_msg .= " TRUNK LIMIT override: $DBIPserver_trunks_limit[$user_CIPct]"; + $DBIPtrunk_shortage[$user_CIPct] = ($active_line_goal - $DBIPserver_trunks_limit[$user_CIPct]); + if ($DBIPtrunk_shortage[$user_CIPct] > $DBIPmakecallsGOAL) + {$DBIPtrunk_shortage[$user_CIPct] = $DBIPmakecallsGOAL} + $active_line_goal = $DBIPserver_trunks_limit[$user_CIPct]; + $NEWmakecallsgoal = ($active_line_goal - $active_line_counter); + if ($DBIPmakecalls[$user_CIPct] > $NEWmakecallsgoal) + {$DBIPmakecalls[$user_CIPct] = $NEWmakecallsgoal;} + } + } + else + { + if ($DBIPserver_trunks_allowed[$user_CIPct] < $active_line_goal) + { + $MVT_msg .= " OTHER LIMIT override: $DBIPserver_trunks_allowed[$user_CIPct]"; + $DBIPtrunk_shortage[$user_CIPct] = ($active_line_goal - $DBIPserver_trunks_allowed[$user_CIPct]); + if ($DBIPtrunk_shortage[$user_CIPct] > $DBIPmakecallsGOAL) + {$DBIPtrunk_shortage[$user_CIPct] = $DBIPmakecallsGOAL} + $active_line_goal = $DBIPserver_trunks_allowed[$user_CIPct]; + $NEWmakecallsgoal = ($active_line_goal - $active_line_counter); + if ($DBIPmakecalls[$user_CIPct] > $NEWmakecallsgoal) + {$DBIPmakecalls[$user_CIPct] = $NEWmakecallsgoal;} + } + } + + if ($DBIPmakecalls[$user_CIPct] > 0) + {$active_line_counter = ($DBIPmakecalls[$user_CIPct] + $active_line_counter);} + $event_string="$DBIPcampaign[$user_CIPct] $DBIPaddress[$user_CIPct]: Calls to place: $DBIPmakecalls[$user_CIPct] ($DBIPgoalcalls[$user_CIPct] - $DBIPexistcalls[$user_CIPct]) $active_line_counter $MVT_msg"; + &event_logger; + + ### Calculate campaign-wide agent waiting and calls waiting differential + ### This is used by the AST_VDadapt script to see if the current dial_level + ### should be changed at all + $total_agents=0; + $ready_agents=0; + $waiting_calls=0; + + $stmtA = "SELECT count(*),status from vicidial_live_agents where campaign_id='$DBIPcampaign[$user_CIPct]' and last_update_time > '$halfminSQLdate' group by status;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VCSagent_count = "$aryA[0]"; + $VCSagent_status = "$aryA[1]"; + $rec_count++; + if ($VCSagent_status =~ /READY|DONE/) {$ready_agents = ($ready_agents + $VCSagent_count);} + $total_agents = ($total_agents + $VCSagent_count); + } + $sthA->finish(); + + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where $campaign_query and status IN('LIVE');"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $waiting_calls = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + + $stat_ready_agents[$user_CIPct][$stat_count] = $ready_agents; + $stat_waiting_calls[$user_CIPct][$stat_count] = $waiting_calls; + $stat_total_agents[$user_CIPct][$stat_count] = $total_agents; + + $stat_it=20; + $ready_diff_total=0; + $waiting_diff_total=0; + $total_agents_total=0; + $ready_diff_avg=0; + $waiting_diff_avg=0; + $total_agents_avg=0; + $stat_differential=0; + if ($stat_count < 20) + { + $stat_it = $stat_count; + $stat_B = 1; + } + else + { + $stat_B = ($stat_count - 19); + } + + $it=0; + while($it < $stat_it) + { + $it_ary = ($it + $stat_B); + $ready_diff_total = ($ready_diff_total + $stat_ready_agents[$user_CIPct][$it_ary]); + $waiting_diff_total = ($waiting_diff_total + $stat_waiting_calls[$user_CIPct][$it_ary]); + $total_agents_total = ($total_agents_total + $stat_total_agents[$user_CIPct][$it_ary]); + # $event_string="$stat_count $it_ary $stat_total_agents[$user_CIPct][$it_ary]|$stat_ready_agents[$user_CIPct][$it_ary]|$stat_waiting_calls[$user_CIPct][$it_ary]"; + # &event_logger; + $it++; + } + + if ($ready_diff_total > 0) + {$ready_diff_avg = ($ready_diff_total / $stat_it);} + if ($waiting_diff_total > 0) + {$waiting_diff_avg = ($waiting_diff_total / $stat_it);} + if ($total_agents_total > 0) + {$total_agents_avg = ($total_agents_total / $stat_it);} + $stat_differential = ($ready_diff_avg - $waiting_diff_avg); + + $event_string="CAMPAIGN DIFFERENTIAL: $total_agents_avg $stat_differential ($ready_diff_avg - $waiting_diff_avg)"; + &event_logger; + + $stmtA = "UPDATE vicidial_campaign_stats SET differential_onemin='$stat_differential', agents_average_onemin='$total_agents_avg' where campaign_id='$DBIPcampaign[$user_CIPct]';"; + $affected_rows = $dbhA->do($stmtA); + + if ( ($DBIPold_trunk_shortage[$user_CIPct] > $DBIPtrunk_shortage[$user_CIPct]) || ($DBIPold_trunk_shortage[$user_CIPct] < $DBIPtrunk_shortage[$user_CIPct]) ) + { + if ($DBIPadlevel[$user_CIPct] < 1) + { + $event_string="Manual Dial Override for Shortage |$DBIPadlevel[$user_CIPct]|$DBIPtrunk_shortage[$user_CIPct]|"; + &event_logger; + $DBIPtrunk_shortage[$user_CIPct] = 0; + } + $stmtA = "UPDATE vicidial_campaign_server_stats SET local_trunk_shortage='$DBIPtrunk_shortage[$user_CIPct]' where server_ip='$server_ip' and campaign_id='$DBIPcampaign[$user_CIPct]';"; + $affected_rows = $dbhA->do($stmtA); + } + + $event_string="LOCAL TRUNK SHORTAGE: $DBIPtrunk_shortage[$user_CIPct]|$DBIPold_trunk_shortage[$user_CIPct] ($active_line_goal - $max_vicidial_trunks)"; + &event_logger; + + $user_CIPct++; + } + + ############################################################################### + ###### second lookup leads and place calls for each campaign/server_ip + ###### go one lead at a time and place the call by inserting a record into vicidial_manager + ############################################################################### + + $user_CIPct = 0; + foreach(@DBIPcampaign) + { + $event_string="$DBIPcampaign[$user_CIPct] $DBIPaddress[$user_CIPct]: CALLING"; + &event_logger; + $call_CMPIPct=0; + $lead_id_call_list='|'; + my $UDaffected_rows=0; + if ($call_CMPIPct < $DBIPmakecalls[$user_CIPct]) + { + $stmtA = "UPDATE vicidial_hopper set status='QUEUE', user='VDAD_$server_ip' where campaign_id='$DBIPcampaign[$user_CIPct]' and status='READY' order by priority desc,hopper_id LIMIT $DBIPmakecalls[$user_CIPct]"; + print "|$stmtA|\n"; + $UDaffected_rows = $dbhA->do($stmtA); + print "hopper rows updated to QUEUE: |$UDaffected_rows|\n"; + + if ($UDaffected_rows) + { + $lead_id=''; $phone_code=''; $phone_number=''; $called_count=''; + while ($call_CMPIPct < $UDaffected_rows) + { + $stmtA = "SELECT lead_id,alt_dial FROM vicidial_hopper where campaign_id='$DBIPcampaign[$user_CIPct]' and status='QUEUE' and user='VDAD_$server_ip' order by priority desc,hopper_id LIMIT 1"; + print "|$stmtA|\n"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + $rec_countCUSTDATA=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $lead_id = "$aryA[0]"; + $alt_dial = "$aryA[1]"; + $rec_count++; + } + $sthA->finish(); + + if ($lead_id_call_list =~ /\|$lead_id\|/) + { + print "!!!!!!!!!!!!!!!!duplicate lead_id for this run: |$lead_id| $lead_id_call_list\n"; + if ($SYSLOG) + { + open(DUPout, ">>$PATHlogs/VDAD_DUPLICATE.$file_date") + || die "Can't open $PATHlogs/VDAD_DUPLICATE.$file_date: $!\n"; + print DUPout "$now_date-----$lead_id_call_list-----$lead_id\n"; + close(DUPout); + } + } + else + { + $stmtA = "UPDATE vicidial_hopper set status='INCALL' where lead_id='$lead_id'"; + print "|$stmtA|\n"; + $UQaffected_rows = $dbhA->do($stmtA); + print "hopper row updated to INCALL: |$UQaffected_rows|$lead_id|\n"; + + $stmtA = "SELECT * FROM vicidial_list where lead_id='$lead_id';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + $rec_countCUSTDATA=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $list_id = "$aryA[7]"; + $gmt_offset_now = "$aryA[8]"; + $called_since_last_reset = "$aryA[9]"; + $phone_code = "$aryA[10]"; + $phone_number = "$aryA[11]"; + $address3 = "$aryA[18]"; + $alt_phone = "$aryA[26]"; + $called_count = "$aryA[30]"; + + $rec_countCUSTDATA++; + $rec_count++; + } + $sthA->finish(); + + if ($rec_countCUSTDATA) + { + ### update called_count + $called_count++; + if ($called_since_last_reset =~ /^Y/) + { + if ($called_since_last_reset =~ /^Y$/) {$CSLR = 'Y1';} + else + { + $called_since_last_reset =~ s/^Y//gi; + $called_since_last_reset++; + $CSLR = "Y$called_since_last_reset"; + } + } + else {$CSLR = 'Y';} + + if ( ($alt_dial =~ /ALT|ADDR3/) && ($DBIPautoaltdial[$user_CIPct] =~ /ALT|ADDR/) ) + { + if ( ($alt_dial =~ /ALT/) && ($DBIPautoaltdial[$user_CIPct] =~ /ALT/) ) + { + $alt_phone =~ s/\D//gi; + $phone_number = $alt_phone; + } + if ( ($alt_dial =~ /ADDR3/) && ($DBIPautoaltdial[$user_CIPct] =~ /ADDR3/) ) + { + $address3 =~ s/\D//gi; + $phone_number = $address3; + } + $stmtA = "UPDATE vicidial_list set called_since_last_reset='$CSLR',user='VDAD' where lead_id='$lead_id'"; + } + else + { + $stmtA = "UPDATE vicidial_list set called_since_last_reset='$CSLR', called_count='$called_count',user='VDAD' where lead_id='$lead_id'"; + } + $affected_rows = $dbhA->do($stmtA); + + $stmtA = "DELETE FROM vicidial_hopper where lead_id='$lead_id'"; + $affected_rows = $dbhA->do($stmtA); + + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + if ($DBIPdialtimeout[$user_CIPct] > 4) {$Local_dial_timeout = $DBIPdialtimeout[$user_CIPct];} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (length($DBIPdialprefix[$user_CIPct]) > 0) {$Local_out_prefix = "$DBIPdialprefix[$user_CIPct]";} + if (length($DBIPvdadexten[$user_CIPct]) > 0) {$VDAD_dial_exten = "$DBIPvdadexten[$user_CIPct]";} + else {$VDAD_dial_exten = "$answer_transfer_agent";} + + if (length($DBIPcampaigncid[$user_CIPct]) > 6) {$CCID = "$DBIPcampaigncid[$user_CIPct]"; $CCID_on++;} + if ($DBIPdialprefix[$user_CIPct] =~ /x/i) {$Local_out_prefix = '';} + + if ($RECcount) + { + if ( (length($RECprefix)>0) && ($called_count < $RECcount) ) + {$Local_out_prefix .= "$RECprefix";} + } + $PADlead_id = sprintf("%09s", $lead_id); while (length($PADlead_id) > 9) {chop($PADlead_id);} + + if ($lists_update !~ /'$list_id'/) {$lists_update .= "'$list_id',"; $LUcount++;} + + $lead_id_call_list .= "$lead_id|"; + + ### whether to omit phone_code or not + if ($DBIPomitcode[$user_CIPct] > 0) + {$Ndialstring = "$Local_out_prefix$phone_number";} + else + {$Ndialstring = "$Local_out_prefix$phone_code$phone_number";} + + ### use manager middleware-app to connect the next call to the meetme room + # VmmddhhmmssLLLLLLLLL + $VqueryCID = "V$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$VqueryCID\" <$CCID>";} + else {$CIDstring = "$VqueryCID";} + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$DBIPaddress[$user_CIPct]','','Originate','$VqueryCID','Exten: $VDAD_dial_exten','Context: $ext_context','Channel: $local_DEF$Ndialstring$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','')"; + $affected_rows = $dbhA->do($stmtA); + + $event_string = "| number call dialed|$DBIPcampaign[$user_CIPct]|$VqueryCID|$stmtA|$gmt_offset_now|$alt_dial|"; + &event_logger; + + ### insert a SENT record to the vicidial_auto_calls table + $stmtA = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type,alt_dial) values('$DBIPaddress[$user_CIPct]','$DBIPcampaign[$user_CIPct]','SENT','$lead_id','$VqueryCID','$phone_code','$phone_number','$SQLdate','OUT','$alt_dial')"; + $affected_rows = $dbhA->do($stmtA); + + ### sleep for a tenth of a second to not flood the server with new calls + usleep(1*100*1000); + + } + } + $call_CMPIPct++; + } + } + + } + + $user_CIPct++; + } + + + + + + + + &get_time_now; + + ############################################################################### + ###### third we will grab the callerids of the vicidial_auto_calls records and check for dead calls + ###### we also check to make sure that it isn't a call that has been transferred, + ###### if it has been we need to leave the vicidial_list status alone + ############################################################################### + + @KLcallerid = @MT; + @KLserver_ip = @MT; + @KLchannel = @MT; + $kill_vac=0; + + $stmtA = "SELECT callerid,server_ip,channel,uniqueid FROM vicidial_auto_calls where server_ip='$server_ip' order by call_time;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + $rec_countCUSTDATA=0; + $kill_vac=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $KLcallerid[$kill_vac] = "$aryA[0]"; + $KLserver_ip[$kill_vac] = "$aryA[1]"; + $KLchannel[$kill_vac] = "$aryA[2]"; + $KLuniqueid[$kill_vac] = "$aryA[3]"; + $kill_vac++; + $rec_count++; + } + $sthA->finish(); + + $kill_vac=0; + foreach(@KLcallerid) + { + if (length($KLserver_ip[$kill_vac]) > 7) + { + $end_epoch=0; $CLuniqueid=''; + + $stmtA = "SELECT end_epoch,uniqueid FROM call_log where caller_code='$KLcallerid[$kill_vac]' and server_ip='$KLserver_ip[$kill_vac]' order by end_epoch, start_time desc limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + $rec_countCUSTDATA=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $end_epoch = "$aryA[0]"; + $CLuniqueid = "$aryA[1]"; + $rec_count++; + } + $sthA->finish(); + + if ( (length($KLuniqueid[$kill_vac]) > 15) && (length($CLuniqueid) < 15) ) + { + $stmtA = "SELECT end_epoch,uniqueid FROM call_log where uniqueid='$KLuniqueid[$kill_vac]' and server_ip='$KLserver_ip[$kill_vac]' order by end_epoch, start_time desc limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + $rec_countCUSTDATA=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $end_epoch = "$aryA[0]"; + $CLuniqueid = "$aryA[1]"; + $rec_count++; + } + $sthA->finish(); + } + if ($end_epoch > 1000) + { + $CLlead_id=''; $auto_call_id=''; $CLstatus=''; $CLcampaign_id=''; $CLphone_number=''; $CLphone_code=''; + + $stmtA = "SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage FROM vicidial_auto_calls where callerid='$KLcallerid[$kill_vac]'"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + $rec_countCUSTDATA=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $auto_call_id = "$aryA[0]"; + $CLlead_id = "$aryA[1]"; + $CLphone_number = "$aryA[2]"; + $CLstatus = "$aryA[3]"; + $CLcampaign_id = "$aryA[4]"; + $CLphone_code = "$aryA[5]"; + $CLalt_dial = "$aryA[6]"; + $CLstage = "$aryA[7]"; + $rec_count++; + } + $sthA->finish(); + + $stmtA = "DELETE from vicidial_auto_calls where auto_call_id='$auto_call_id'"; + $affected_rows = $dbhA->do($stmtA); + + $event_string = "| dead call vac deleted|$auto_call_id|$CLlead_id|$KLcallerid[$kill_vac]|$end_epoch|$affected_rows|$KLchannel[$kill_vac]|"; + &event_logger; + + if ($CLstatus !~ /XFER|CLOSER/) + { + $CLstage =~ s/LIVE|-//gi; + if ($CLstage < 0.25) {$CLstage=1;} + + if ($CLstatus =~ /BUSY/) {$CLnew_status = 'B';} + else + { + if ($CLstatus =~ /DISCONNECT/) {$CLnew_status = 'DC';} + else {$CLnew_status = 'NA';} + } + if ($CLstatus =~ /LIVE/) {$CLnew_status = 'DROP';} + else + { + $end_epoch = ($now_date_epoch + 1); + $stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed,length_in_sec,end_epoch) values('$CLuniqueid','$CLlead_id','$CLcampaign_id','$SQLdate','$now_date_epoch','$CLnew_status','$CLphone_code','$CLphone_number','VDAD','N','$CLstage','$end_epoch')"; + if($M){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + + $event_string = "| dead NA call added to log $CLuniqueid|$CLlead_id|$CLphone_number|$CLstatus|$CLnew_status|$affected_rows|"; + &event_logger; + + } + + $stmtA = "UPDATE vicidial_list set status='$CLnew_status' where lead_id='$CLlead_id'"; + $affected_rows = $dbhA->do($stmtA); + + $event_string = "| dead call vac lead marked $CLnew_status|$CLlead_id|$CLphone_number|$CLstatus|"; + &event_logger; + + $stmtA = "UPDATE vicidial_live_agents set status='PAUSED',random_id='10' where callerid='$KLcallerid[$kill_vac]';"; + $affected_rows = $dbhA->do($stmtA); + + $event_string = "| dead call vla agent PAUSED $affected_rows|$CLlead_id|$CLphone_number|$CLstatus|"; + &event_logger; + + if ( ($enable_queuemetrics_logging > 0) && ($CLstatus =~ /LIVE/) ) + { + $dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} + + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='$KLcallerid[$kill_vac]',queue='$CLcampaign_id',agent='NONE',verb='ABANDON',data1='1',data2='1',data3='$CLstage',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } + + ##### BEGIN AUTO ALT PHONE DIAL SECTION ##### + ### check to see if campaign has alt_dial enabled + $VD_auto_alt_dial = 'NONE'; + $VD_auto_alt_dial_statuses=''; + $stmtA="SELECT auto_alt_dial,auto_alt_dial_statuses FROM vicidial_campaigns where campaign_id='$CLcampaign_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $epc_countCAMPDATA=0; + while ($sthArows > $epc_countCAMPDATA) + { + @aryA = $sthA->fetchrow_array; + $VD_auto_alt_dial = "$aryA[0]"; + $VD_auto_alt_dial_statuses = "$aryA[1]"; + $epc_countCAMPDATA++; + } + $sthA->finish(); + if ($VD_auto_alt_dial_statuses =~ / $CLnew_status /) + { + if ( ($VD_auto_alt_dial =~ /(ALT_ONLY|ALT_AND_ADDR3)/) && ($CLalt_dial =~ /NONE|MAIN/) ) + { + $VD_alt_phone=''; + $stmtA="SELECT alt_phone,gmt_offset_now,state,list_id FROM vicidial_list where lead_id='$CLlead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $epc_countCAMPDATA=0; + while ($sthArows > $epc_countCAMPDATA) + { + @aryA = $sthA->fetchrow_array; + $VD_alt_phone = "$aryA[0]"; + $VD_alt_phone =~ s/\D//gi; + $VD_gmt_offset_now = "$aryA[1]"; + $VD_state = "$aryA[2]"; + $VD_list_id = "$aryA[3]"; + $epc_countCAMPDATA++; + } + $sthA->finish(); + if (length($VD_alt_phone)>5) + { + $stmtA = "INSERT INTO vicidial_hopper SET lead_id='$CLlead_id',campaign_id='$CLcampaign_id',status='READY',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ALT',user='',priority='25';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDH record inserted: |$affected_rows| |$stmtA|"; &agi_output;} + } + } + if ( ( ($VD_auto_alt_dial =~ /(ADDR3_ONLY)/) && ($CLalt_dial =~ /NONE|MAIN/) ) || ( ($VD_auto_alt_dial =~ /(ALT_AND_ADDR3)/) && ($CLalt_dial =~ /ALT/) ) ) + { + $VD_address3=''; + $stmtA="SELECT address3,gmt_offset_now,state,list_id FROM vicidial_list where lead_id='$CLlead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $epc_countCAMPDATA=0; + while ($sthArows > $epc_countCAMPDATA) + { + @aryA = $sthA->fetchrow_array; + $VD_address3 = "$aryA[0]"; + $VD_address3 =~ s/\D//gi; + $VD_gmt_offset_now = "$aryA[1]"; + $VD_state = "$aryA[2]"; + $VD_list_id = "$aryA[3]"; + $epc_countCAMPDATA++; + } + $sthA->finish(); + if (length($VD_address3)>5) + { + $stmtA = "INSERT INTO vicidial_hopper SET lead_id='$CLlead_id',campaign_id='$CLcampaign_id',status='READY',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ADDR3',user='',priority='20';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDH record inserted: |$affected_rows| |$stmtA|"; &agi_output;} + } + } + } + ##### END AUTO ALT PHONE DIAL SECTION ##### + + + + + } + else + { + $event_string = "| dead call vac XFERd do nothing|$CLlead_id|$CLphone_number|$CLstatus|"; + &event_logger; + } + } + } + $kill_vac++; + } + + + + ### pause agents that have disconnected or closed their apps over 30 seconds ago + $stmtA = "UPDATE vicidial_live_agents set status='PAUSED',random_id='10' where server_ip='$server_ip' and last_update_time < '$PDtsSQLdate' and status NOT IN('PAUSED')"; + $affected_rows = $dbhA->do($stmtA); + + $event_string = "| lagged call vla agent PAUSED $affected_rows|$PDtsSQLdate|$BDtsSQLdate|$tsSQLdate|"; + &event_logger; + + if ($affected_rows > 0) + { + @VALOuser=@MT; @VALOcampaign=@MT; @VALOtimelog=@MT; @VALOextension=@MT; + $logcount=0; + $stmtA = "SELECT user,campaign_id,last_update_time,extension FROM vicidial_live_agents where server_ip='$server_ip' and status = 'PAUSED' and random_id='10' order by last_update_time desc limit $affected_rows"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + $rec_countCUSTDATA=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VALOuser[$logcount] = "$aryA[0]"; + $VALOcampaign[$logcount] = "$aryA[1]"; + $VALOtimelog[$logcount] = "$aryA[2]"; + $VALOextension[$logcount] = "$aryA[3]"; + $logcount++; + $rec_count++; + } + $sthA->finish(); + $logrun=0; + foreach(@VALOuser) + { + $VALOuser_group=''; + $stmtA = "SELECT user_group FROM vicidial_users where user='$VALOuser[$logrun]';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $UGrec_count=0; + while ($sthArows > $UGrec_count) + { + @aryA = $sthA->fetchrow_array; + $VALOuser_group = "$aryA[0]"; + $UGrec_count++; + } + $sthA->finish(); + $stmtA = "INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$VALOuser[$logrun]','LOGOUT','$VALOcampaign[$logrun]','$SQLdate','$now_date_epoch','$VALOuser_group');"; + $affected_rows = $dbhA->do($stmtA); + + $event_string = "| lagged agent LOGOUT entry inserted $VALOuser[$logrun]|$VALOcampaign[$logrun]|$VALOextension[$logcount]|"; + &event_logger; + + $logrun++; + } + + } + + + ### delete call records that are SENT for over 2 minutes + $stmtA = "DELETE FROM vicidial_auto_calls where server_ip='$server_ip' and call_time < '$XDSQLdate' and status NOT IN('XFER','CLOSER','LIVE')"; + $affected_rows = $dbhA->do($stmtA); + + $event_string = "| lagged call vac agent DELETED $affected_rows|$XDSQLdate|"; + &event_logger; + + + ### For debugging purposes, try to grab Jammed calls and log them to jam logfile + if ($useJAMdebugFILE) + { + $stmtA = "SELECT * FROM vicidial_auto_calls where server_ip='$server_ip' and last_update_time < '$BDtsSQLdate' and status IN('LIVE')"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $JAMrec_count=0; + while ($sthArows > $JAMrec_count) + { + @aryA = $sthA->fetchrow_array; + $jam_string = "$JAMrec_count|$BDtsSQLdate| |$aryA[0]|$aryA[1]|$aryA[2]|$aryA[3]|$aryA[4]|$aryA[5]|$aryA[6]|$aryA[7]|$aryA[8]|$aryA[9]|$aryA[10]|$aryA[11]|$aryA[12]|$aryA[13]|$aryA[14]|"; + &jam_event_logger; + $JAMrec_count++; + } + $sthA->finish(); + } + + ### find call records that are LIVE and not updated for over 10 seconds + $stmtA = "SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where server_ip='$server_ip' and last_update_time < '$BDtsSQLdate' and status IN('LIVE');"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $auto_call_id = "$aryA[0]"; + $CLlead_id = "$aryA[1]"; + $CLphone_number = "$aryA[2]"; + $CLstatus = "$aryA[3]"; + $CLcampaign_id = "$aryA[4]"; + $CLphone_code = "$aryA[5]"; + $CLalt_dial = "$aryA[6]"; + $CLstage = "$aryA[7]"; + $CLcallerid = "$aryA[8]"; + $CLuniqueid = "$aryA[9]"; + $rec_count++; + } + $sthA->finish(); + + ### delete call records that are LIVE and not updated for over 10 seconds + $rec_count=0; + while ($sthArows > $rec_count) + { + $stmtA = "DELETE from vicidial_auto_calls where auto_call_id='$auto_call_id'"; + $affected_rows = $dbhA->do($stmtA); + + $event_string = "| lagged call vdac call DELETED $affected_rows|$BDtsSQLdate|"; + &event_logger; + + if ($affected_rows > 0) + { + $jam_string = "| lagged call vdac call DELETED $affected_rows|$BDtsSQLdate|"; + &jam_event_logger; + + $CLstage =~ s/LIVE|-//gi; + if ($CLstage < 0.25) {$CLstage=1;} + + $end_epoch = ($now_date_epoch + 1); + $stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed,length_in_sec,end_epoch) values('$CLuniqueid','$CLlead_id','$CLcampaign_id','$SQLdate','$now_date_epoch','DROP','$CLphone_code','$CLphone_number','VDAD','N','$CLstage','$end_epoch')"; + if($M){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + + $event_string = "| dead NA call added to log $CLuniqueid|$CLlead_id|$CLphone_number|$CLstatus|DROP|$affected_rows|"; + &event_logger; + + if ($enable_queuemetrics_logging > 0) + { + $dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} + + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='$CLcallerid',queue='$CLcampaign_id',agent='NONE',verb='ABANDON',data1='1',data2='1',data3='$CLstage',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } + + } + + $rec_count++; + } + $sthA->finish(); + + + if ($LUcount > 0) + { + chop($lists_update); + $stmtA = "UPDATE vicidial_lists SET list_lastcalldate='$SQLdate' where list_id IN($lists_update);"; + $affected_rows = $dbhA->do($stmtA); + $event_string = "| lastcalldate UPDATED $affected_rows|$lists_update|"; + &event_logger; + } + + if ($CPcount > 0) + { + chop($campaigns_update); + $stmtA = "UPDATE vicidial_campaigns SET campaign_logindate='$SQLdate' where campaign_id IN($campaigns_update);"; + $affected_rows = $dbhA->do($stmtA); + $event_string = "| logindate UPDATED $affected_rows|$campaigns_update|"; + &event_logger; + } + + + ############################################################################### + ###### last, wait for a little bit and repeat the loop + ############################################################################### + + ### sleep for 2 and a half seconds before beginning the loop again + usleep(1*$loop_delay*1000); + + $endless_loop--; + if($DB){print STDERR "\nloop counter: |$endless_loop|\n";} + + ### putting a blank file called "VDAD.kill" in the directory will automatically safely kill this program + if (-e "$PATHhome/VDAD.kill") + { + unlink("$PATHhome/VDAD.kill"); + $endless_loop=0; + $one_day_interval=0; + print "\nPROCESS KILLED MANUALLY... EXITING\n\n" + } + if ($endless_loop =~ /0$/) # run every ten cycles (about 25 seconds) + { + ### Grab Server values from the database + $stmtA = "SELECT vd_server_logs FROM servers where server_ip = '$VARserver_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBvd_server_logs = "$aryA[0]"; + if ($DBvd_server_logs =~ /Y/) {$SYSLOG = '1';} + else {$SYSLOG = '0';} + $rec_count++; + } + $sthA->finish(); + + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $enable_queuemetrics_logging = "$aryA[0]"; + $queuemetrics_server_ip = "$aryA[1]"; + $queuemetrics_dbname = "$aryA[2]"; + $queuemetrics_login= "$aryA[3]"; + $queuemetrics_pass = "$aryA[4]"; + $queuemetrics_log_id = "$aryA[5]"; + $rec_count++; + } + $sthA->finish(); + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + + ### delete call records that are LIVE for over 10 minutes + $stmtA = "DELETE FROM vicidial_auto_calls where server_ip='$server_ip' and call_time < '$TDSQLdate' and status NOT IN('XFER','CLOSER')"; + $affected_rows = $dbhA->do($stmtA); + + $event_string = "| lagged call vac agent DELETED $affected_rows|$TDSQLdate|LIVE|"; + &event_logger; + + ### Grab Server values from the database in case they've changed + $stmtA = "SELECT max_vicidial_trunks,answer_transfer_agent,local_gmt,ext_context FROM servers where server_ip = '$server_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBmax_vicidial_trunks = "$aryA[0]"; + $DBanswer_transfer_agent= "$aryA[1]"; + $DBSERVER_GMT = "$aryA[2]"; + $DBext_context = "$aryA[3]"; + $max_vicidial_trunks = $DBmax_vicidial_trunks; + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBext_context) {$ext_context = $DBext_context;} + $rec_count++; + } + $sthA->finish(); + + $event_string = "| updating server parameters $max_vicidial_trunks|$answer_transfer_agent|$SERVER_GMT|$ext_context|"; + &event_logger; + + &get_time_now; + + #@psoutput = `/bin/ps -f --no-headers -A`; + @psoutput = `/bin/ps -o "%p %a" --no-headers -A`; + + $running_listen = 0; + + $i=0; + foreach (@psoutput) + { + chomp($psoutput[$i]); + + @psline = split(/\/usr\/bin\/perl /,$psoutput[$i]); + + if ($psline[1] =~ /AST_manager_li/) {$running_listen++;} + + $i++; + } + + if (!$running_listen) + { + $endless_loop=0; + $one_day_interval=0; + print "\nPROCESS KILLED NO LISTENER RUNNING... EXITING\n\n"; + } + + if($DB){print "checking to see if listener is dead |$running_listen|\n";} + } + + $bad_grabber_counter=0; + + $stat_count++; + } + + + if($DB){print "DONE... Exiting... Goodbye... See you later... Not really, initiating next loop...\n";} + + $event_string='HANGING UP|'; + &event_logger; + + $one_day_interval--; + +} + + $event_string='CLOSING DB CONNECTION|'; + &event_logger; + + + $dbhA->disconnect(); + + + if($DB){print "DONE... Exiting... Goodbye... See you later... Really I mean it this time\n";} + + +exit; + + + + + + + + + + + + + +sub get_time_now #get the current date and time and epoch for logging call lengths and datetimes +{ +$secX = time(); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($secX); + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + if ($isdst) {$LOCAL_GMT_OFF++;} + +$GMT_now = ($secX - ($LOCAL_GMT_OFF * 3600)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($GMT_now); + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + + if ($DB) {print "TIME DEBUG: $LOCAL_GMT_OFF_STD|$LOCAL_GMT_OFF|$isdst| GMT: $hour:$min\n";} + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$hour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$file_date = "$year-$mon-$mday"; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + +$BDtarget = ($secX - 10); +($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); +$Byear = ($Byear + 1900); +$Bmon++; +if ($Bmon < 10) {$Bmon = "0$Bmon";} +if ($Bmday < 10) {$Bmday = "0$Bmday";} +if ($Bhour < 10) {$Bhour = "0$Bhour";} +if ($Bmin < 10) {$Bmin = "0$Bmin";} +if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + +$PDtarget = ($secX - 30); +($Psec,$Pmin,$Phour,$Pmday,$Pmon,$Pyear,$Pwday,$Pyday,$Pisdst) = localtime($PDtarget); +$Pyear = ($Pyear + 1900); +$Pmon++; +if ($Pmon < 10) {$Pmon = "0$Pmon";} +if ($Pmday < 10) {$Pmday = "0$Pmday";} +if ($Phour < 10) {$Phour = "0$Phour";} +if ($Pmin < 10) {$Pmin = "0$Pmin";} +if ($Psec < 10) {$Psec = "0$Psec";} + $PDtsSQLdate = "$Pyear$Pmon$Pmday$Phour$Pmin$Psec"; + $halfminSQLdate = "$Pyear-$Pmon-$Pmday $Phour:$Pmin:$Psec"; + +$XDtarget = ($secX - 120); +($Xsec,$Xmin,$Xhour,$Xmday,$Xmon,$Xyear,$Xwday,$Xyday,$Xisdst) = localtime($XDtarget); +$Xyear = ($Xyear + 1900); +$Xmon++; +if ($Xmon < 10) {$Xmon = "0$Xmon";} +if ($Xmday < 10) {$Xmday = "0$Xmday";} +if ($Xhour < 10) {$Xhour = "0$Xhour";} +if ($Xmin < 10) {$Xmin = "0$Xmin";} +if ($Xsec < 10) {$Xsec = "0$Xsec";} + $XDSQLdate = "$Xyear-$Xmon-$Xmday $Xhour:$Xmin:$Xsec"; + +$TDtarget = ($secX - 600); +($Tsec,$Tmin,$Thour,$Tmday,$Tmon,$Tyear,$Twday,$Tyday,$Tisdst) = localtime($TDtarget); +$Tyear = ($Tyear + 1900); +$Tmon++; +if ($Tmon < 10) {$Tmon = "0$Tmon";} +if ($Tmday < 10) {$Tmday = "0$Tmday";} +if ($Thour < 10) {$Thour = "0$Thour";} +if ($Tmin < 10) {$Tmin = "0$Tmin";} +if ($Tsec < 10) {$Tsec = "0$Tsec";} + $TDSQLdate = "$Tyear-$Tmon-$Tmday $Thour:$Tmin:$Tsec"; + +} + + + + + +sub event_logger +{ +if ($DB) {print "$now_date|$event_string|\n";} +if ($SYSLOG) + { + ### open the log file for writing ### + open(Lout, ">>$VDADLOGfile") + || die "Can't open $VDADLOGfile: $!\n"; + print Lout "$now_date|$event_string|\n"; + close(Lout); + } +$event_string=''; +} + +sub jam_event_logger +{ +if ($DB) {print "$now_date|$jam_string|\n";} +if ($useJAMdebugFILE) + { + ### open the log file for writing ### + open(Jout, ">>$JAMdebugFILE") + || die "Can't open $JAMdebugFILE: $!\n"; + print Jout "$now_date|$jam_string|\n"; + close(Jout); + } +$jam_string=''; +} + + diff --git a/agc_2-X/branches/agc_2.0.4/bin/AST_VDauto_dial_FILL.pl b/agc_2-X/branches/agc_2.0.4/bin/AST_VDauto_dial_FILL.pl new file mode 100644 index 00000000..43207096 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/AST_VDauto_dial_FILL.pl @@ -0,0 +1,945 @@ +#!/usr/bin/perl +# +# AST_VDauto_dial_FILL.pl version 2.0.3 *DBI-version* +# +# DESCRIPTION: +# Places auto_dial calls on the VICIDIAL dialer system across all servers only +# for campaigns that have a shortfall in number of lines dialed. +# +# Script needs to be started by ADMIN_keepalive_ALL.pl script (option 7) +# +# Not for use in systems with only one Asterisk/VICIDIAL server +# +# Should only be run on one server in a multi-server Asterisk/VICIDIAL cluster +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# CHANGELOG: +# 61115-1246 - First build, framework setup, non-functional +# 61120-2008 - second alpha version, functional and tested in production +# 70205-1425 - Added code for last called date update +# 71030-2054 - Added hopper priority sorting +# 71111-2349 - fixed overdialing bug +# + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-t] = test\n [-debug] = verbose debug messages\n [--delay=XXX] = delay of XXX seconds per loop, default 2.5 seconds\n\n"; + } + else + { + if ($args =~ /--delay=/i) + { + @data_in = split(/--delay=/,$args); + $loop_delay = $data_in[1]; + print " LOOP DELAY OVERRIDE!!!!! = $loop_delay seconds\n\n"; + $loop_delay = ($loop_delay * 1000); + } + else + { + $loop_delay = '2500'; + } + if ($args =~ /-debug/i) + { + $DB=1; # Debug flag, set to 0 for no debug messages + print "\n-- DEBUG --\n\n"; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +print "no command line options set\n"; + $loop_delay = '2500'; + $DB=1; +} +### end parsing run-time options ### + + +# constants +$US='__'; +$MT[0]=''; +$RECcount=''; ### leave blank for no REC count +$RECprefix='7'; ### leave blank for no REC prefix + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} + + &get_time_now; # update time/date variables + +if (!$VDADLOGfile) {$VDADLOGfile = "$PATHlogs/vdautodial_FILL.$year-$mon-$mday";} + +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use DBI; + + ### connect to MySQL database defined in the conf file + $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### Grab Server values from the database +$stmtA = "SELECT telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERNAMEupdate,ASTmgrUSERNAMElisten,ASTmgrUSERNAMEsend,max_vicidial_trunks,answer_transfer_agent,local_gmt,ext_context,vd_server_logs FROM servers where server_ip = '$server_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBtelnet_host = "$aryA[0]"; + $DBtelnet_port = "$aryA[1]"; + $DBASTmgrUSERNAME = "$aryA[2]"; + $DBASTmgrSECRET = "$aryA[3]"; + $DBASTmgrUSERNAMEupdate = "$aryA[4]"; + $DBASTmgrUSERNAMElisten = "$aryA[5]"; + $DBASTmgrUSERNAMEsend = "$aryA[6]"; + $DBmax_vicidial_trunks = "$aryA[7]"; + $DBanswer_transfer_agent= "$aryA[8]"; + $DBSERVER_GMT = "$aryA[9]"; + $DBext_context = "$aryA[10]"; + $DBvd_server_logs = "$aryA[11]"; + if ($DBtelnet_host) {$telnet_host = $DBtelnet_host;} + if ($DBtelnet_port) {$telnet_port = $DBtelnet_port;} + if ($DBASTmgrUSERNAME) {$ASTmgrUSERNAME = $DBASTmgrUSERNAME;} + if ($DBASTmgrSECRET) {$ASTmgrSECRET = $DBASTmgrSECRET;} + if ($DBASTmgrUSERNAMEupdate) {$ASTmgrUSERNAMEupdate = $DBASTmgrUSERNAMEupdate;} + if ($DBASTmgrUSERNAMElisten) {$ASTmgrUSERNAMElisten = $DBASTmgrUSERNAMElisten;} + if ($DBASTmgrUSERNAMEsend) {$ASTmgrUSERNAMEsend = $DBASTmgrUSERNAMEsend;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBext_context) {$ext_context = $DBext_context;} + if ($DBvd_server_logs =~ /Y/) {$SYSLOG = '1';} + else {$SYSLOG = '0';} + $rec_count++; + } +$sthA->finish(); + + $event_string='LOGGED INTO MYSQL SERVER ON 1 CONNECTION|'; + &event_logger; + +$one_day_interval = 12; # 1 month loops for one year +while($one_day_interval > 0) +{ + + $endless_loop=5760000; # 30 days minutes at XXX seconds per loop + $stat_count=1; + + while($endless_loop > 0) + { + &get_time_now; + + $VDADLOGfile = "$PATHlogs/vdautodial_FILL.$year-$mon-$mday"; + + ############################################################################### + ###### first figure out how many calls should be placed for each campaign per server + ############################################################################### + @DBfill_campaign=@MT; + @DBfill_shortage=@MT; + @DBfill_tally=@MT; + @DBfill_needed=@MT; + @DBfill_current_balance=@MT; + @DBlive_campaign=@MT; + @DBlive_conf_exten=@MT; + @DBlive_status=@MT; + @DBcampaigns=@MT; + @DBIPaddress=@MT; + @DBIPcampaign=@MT; + @DBIPactive=@MT; + @DBIPvdadexten=@MT; + @DBIPcount=@MT; + @DBIPACTIVEcount=@MT; + @DBIPINCALLcount=@MT; + @DBIPadlevel=@MT; + @DBIPdialtimeout=@MT; + @DBIPdialprefix=@MT; + @DBIPcampaigncid=@MT; + @DBIPexistcalls=@MT; + @DBIPgoalcalls=@MT; + @DBIPmakecalls=@MT; + @DBIPlivecalls=@MT; + @DBIPclosercamp=@MT; + @DBIPomitcode=@MT; + @DBIPtrunk_shortage=@MT; + @DBIPold_trunk_shortage=@MT; + @DBIPserver_trunks_limit=@MT; + @DBIPserver_trunks_other=@MT; + @DBIPserver_trunks_allowed=@MT; + + $active_line_counter=0; + $camp_counter=0; + $total_shortage=0; + $balance_servers=0; + $lists_update = ''; + $LUcount=0; + + $stmtA = "SELECT count(*) FROM servers where vicidial_balance_active = 'Y';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $balance_servers = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + + ##### Get a listing of the campaigns that have shortages of trunks + $stmtA = "SELECT campaign_id,sum(local_trunk_shortage) FROM vicidial_campaign_server_stats where update_time > '$XDSQLdate' and local_trunk_shortage > 0 group by campaign_id;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBfill_campaign[$camp_counter] = "$aryA[0]"; + $DBfill_shortage[$camp_counter] = "$aryA[1]"; + $total_shortage = ($total_shortage + $aryA[1]); + if($DB) {print "$DBfill_campaign[$camp_counter]: $DBfill_shortage[$camp_counter]\n";} + + $camp_counter++; + $rec_count++; + } + $sthA->finish(); + + $event_string="SERVERS WITH TRUNK BALANCE: $balance_servers\n"; + $event_string.="CAMPAIGNS WITH TRUNK SHORTAGE: $camp_counter| TOTAL SHORTAGE: $total_shortage"; + &event_logger; + + + ################################################################################## + ##### START LOOP IF THERE ARE BALANCE SERVERS AND THERE ARE SHORTAGES + ################################################################################## + if ( ($balance_servers > 0) && ($camp_counter > 0) ) + { + $camp_CIPct = 0; + foreach(@DBfill_campaign) + { + $camp_counter=0; + $DB_balance_fill=0; + $VAC_balance_fill=0; + $AVAIL_balance_servers=0; + $DBfill_tally[$camp_CIPct]=0; + + ### grab the dial_level and multiply by active agents to get your goalcalls + $DBIPadlevel[$camp_CIPct]=0; + $stmtA = "SELECT dial_timeout,dial_prefix,campaign_cid,active,campaign_vdad_exten,omit_phone_code FROM vicidial_campaigns where campaign_id='$DBfill_campaign[$camp_CIPct]'"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + $active_only=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBIPdialtimeout[$camp_CIPct] = "$aryA[0]"; + $DBIPdialprefix[$camp_CIPct] = "$aryA[1]"; + $DBIPcampaigncid[$camp_CIPct] = "$aryA[2]"; + $DBIPactive[$camp_CIPct] = "$aryA[3]"; + $DBIPvdadexten[$camp_CIPct] = "$aryA[4]"; + $omit_phone_code = "$aryA[5]"; + if ($omit_phone_code =~ /Y/) {$DBIPomitcode[$camp_CIPct] = 1;} + else {$DBIPomitcode[$camp_CIPct] = 0;} + $rec_count++; + } + $sthA->finish(); + + $stmtA = "SELECT balance_trunk_fill FROM vicidial_campaign_stats where campaign_id='$DBfill_campaign[$camp_CIPct]'"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DB_balance_fill = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where campaign_id='$DBfill_campaign[$camp_CIPct]' and call_type='OUTBALANCE';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VAC_balance_fill = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + $DBfill_current_balance[$camp_CIPct] = "$VAC_balance_fill"; + + $event_string=" CAMPAIGN: $DBfill_campaign[$camp_CIPct]\n"; + $event_string.="DB_balance_fill: $DB_balance_fill VAC_balance_fill: $VAC_balance_fill\n"; + + $DBfill_needed[$camp_CIPct] = ($DBfill_shortage[$camp_CIPct] - $VAC_balance_fill); + $event_string.="Additional Balance Calls Needed For This Campaign: $DBfill_needed[$camp_CIPct]\n"; + + + ##### Get a listing of the servers in the campaign that have shortages of trunks + $full_servers='|'; + $full_serversSQL=''; + $stmtA = "SELECT server_ip FROM vicidial_campaign_server_stats where update_time > '$XDSQLdate' and local_trunk_shortage > 0 and campaign_id='$DBfill_campaign[$camp_CIPct]'"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $full_servers .= "$aryA[0]|"; + $full_serversSQL .= "'$aryA[0]',"; + $rec_count++; + } + $sthA->finish(); + chop($full_serversSQL); + if (length($full_serversSQL)<6) {$full_serversSQL="''";} + $event_string.="SERVERS WITH TRUNK FULL for $DBfill_campaign[$camp_CIPct]: $full_servers |$full_serversSQL|"; + &event_logger; + + ##### Check if there are any balance-enabled servers outside of the ones with trunk shortage + $stmtA = "SELECT count(*) FROM servers where vicidial_balance_active = 'Y' and server_ip NOT IN($full_serversSQL);"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $AVAIL_balance_servers = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + + ################################################################################## + ##### CONTINUE IF THERE ARE BALANCE SERVERS AVAILABLE THAT ARE NOT IN TRUNK SHORTAGE + ################################################################################## + if ($AVAIL_balance_servers > 0) + { + $event_string="Balance Servers available: $AVAIL_balance_servers"; + &event_logger; + + $DB_camp_servers=0; + @DB_camp_server_server_ip=@MT; + @DB_camp_server_max_vicidial_trunks=@MT; + @DB_camp_server_balance_trunks_offlimits=@MT; + @DB_camp_server_dedicated_trunks=@MT; + @DB_camp_server_trunk_restriction=@MT; + @DB_NONcamp_server_dedicated_trunks=@MT; + @DB_camp_server_available=@MT; + @DB_camp_server_trunks_to_dial=@MT; + ##### Get the trunk settings for the campaign across all servers + $stmtA = "SELECT server_ip,max_vicidial_trunks,balance_trunks_offlimits FROM servers where vicidial_balance_active = 'Y' and server_ip NOT IN($full_serversSQL) order by server_ip;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DB_camp_server_server_ip[$DB_camp_servers] = "$aryA[0]"; + $DB_camp_server_max_vicidial_trunks[$DB_camp_servers] = "$aryA[1]"; + $DB_camp_server_balance_trunks_offlimits[$DB_camp_servers] = "$aryA[2]"; + $DB_camp_servers++; + $rec_count++; + } + $sthA->finish(); + + + ################################################################################## + ##### LOOP THROUGH SERVERS, CALCULATE TRUNKS FOR EACH FOR THIS CAMPAIGN + ################################################################################## + $server_CIPct = 0; + foreach(@DB_camp_server_server_ip) + { + $DB_camp_server_dedicated_trunks[$server_CIPct]=0; + $DB_camp_server_trunk_restriction[$server_CIPct]=0; + $DB_NONcamp_server_dedicated_trunks[$server_CIPct]=0; + ##### Get the campaign-specific trunk settings for the campaign on this server + $stmtA = "SELECT dedicated_trunks,trunk_restriction FROM vicidial_server_trunks where server_ip='$DB_camp_server_server_ip[$server_CIPct]' and campaign_id='$DBfill_campaign[$camp_CIPct]';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DB_camp_server_dedicated_trunks[$server_CIPct] = "$aryA[0]"; + $DB_camp_server_trunk_restriction[$server_CIPct] = "$aryA[1]"; + $rec_count++; + } + $sthA->finish(); + + ##### Get the campaign-specific dedicated trunks count for other campaigns on this server + $stmtA = "SELECT sum(dedicated_trunks) FROM vicidial_server_trunks where server_ip='$DB_camp_server_server_ip[$server_CIPct]' and campaign_id NOT IN('$DBfill_campaign[$camp_CIPct]');"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DB_NONcamp_server_dedicated_trunks[$server_CIPct] = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + + $VAC_server_camp=0; + $VAC_server_NONcamp=0; + + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where server_ip='$DB_camp_server_server_ip[$server_CIPct]' and campaign_id='$DBfill_campaign[$camp_CIPct]' and call_type='OUTBALANCE';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VAC_server_BALcamp = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where server_ip='$DB_camp_server_server_ip[$server_CIPct]' and campaign_id='$DBfill_campaign[$camp_CIPct]';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VAC_server_camp = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where server_ip='$DB_camp_server_server_ip[$server_CIPct]' and campaign_id!='$DBfill_campaign[$camp_CIPct]';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VAC_server_NONcamp = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + + if($DB) {print "VAC CALLS: |$VAC_server_camp|$VAC_server_NONcamp|$VAC_server_BALcamp|\n";} + if($DB) {print "SETTINGS: |$DB_camp_server_dedicated_trunks[$server_CIPct]|$DB_camp_server_max_vicidial_trunks[$server_CIPct]|$DB_camp_server_balance_trunks_offlimits[$server_CIPct]||\n";} + + if ($DB_camp_server_trunk_restriction[$server_CIPct] =~ /MAXIMUM_LIMIT/) + { + $DB_camp_server_available[$server_CIPct] = $DB_camp_server_dedicated_trunks[$server_CIPct]; + } + else + { + $DB_camp_server_available[$server_CIPct] = ( ($DB_camp_server_max_vicidial_trunks[$server_CIPct] - $DB_camp_server_balance_trunks_offlimits[$server_CIPct]) - $DB_NONcamp_server_dedicated_trunks[$server_CIPct]); + } + $temp_tally = ($DBfill_needed[$camp_CIPct] - $DBfill_tally[$camp_CIPct]); + $temp_avail = ( ($DB_camp_server_max_vicidial_trunks[$server_CIPct] - $VAC_server_camp) - $VAC_server_NONcamp); + $DB_camp_server_available[$server_CIPct] = ($DB_camp_server_available[$server_CIPct] - $VAC_server_BALcamp); + if ($DB_camp_server_available[$server_CIPct] < 0) {$DB_camp_server_available[$server_CIPct]=0;} + + if($DB) {print "TEMPVALS: |$temp_tally|$temp_avail|$DB_camp_server_available[$server_CIPct]||\n";} + if ($DB_camp_server_available[$server_CIPct] >= $temp_tally) + {$DB_camp_server_trunks_to_dial[$server_CIPct] = $temp_tally;} + else + {$DB_camp_server_trunks_to_dial[$server_CIPct] = $DB_camp_server_available[$server_CIPct];} + + if ($temp_avail < $DB_camp_server_trunks_to_dial[$server_CIPct]) + {$DB_camp_server_trunks_to_dial[$server_CIPct] = $temp_avail;} + + $DBfill_tally[$camp_CIPct] = ($DBfill_tally[$camp_CIPct] + $DB_camp_server_trunks_to_dial[$server_CIPct]); + + $event_string=" Server: $DB_camp_server_server_ip[$server_CIPct] AVAIL: $DB_camp_server_available[$server_CIPct] DIAL: $DB_camp_server_trunks_to_dial[$server_CIPct]"; + $event_string.=" Campaign Dial Fill tally: $DBfill_tally[$camp_CIPct]/$DBfill_needed[$camp_CIPct]"; + &event_logger; + + + $stmtA = "SELECT count(*) FROM vicidial_live_agents where campaign_id='$DBfill_campaign[$camp_CIPct]' and status NOT IN('PAUSED');"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $LVA_count = $aryA[0]; + $rec_count++; + } + $sthA->finish(); + + if ($LVA_count > 0) + { + ################################################################################## + ##### PLACE THE CALLS + ################################################################################## + $event_string="$DBfill_campaign[$camp_CIPct] $DB_camp_server_server_ip[$server_CIPct]: CALLING"; + &event_logger; + $call_CMPIPct=0; + $lead_id_call_list='|'; + my $UDaffected_rows=0; + if ($call_CMPIPct < $DB_camp_server_trunks_to_dial[$server_CIPct]) + { + $stmtA = "UPDATE vicidial_hopper set status='QUEUE', user='VDAD_$DB_camp_server_server_ip[$server_CIPct]' where campaign_id='$DBfill_campaign[$camp_CIPct]' and status='READY' order by priority desc,hopper_id LIMIT $DB_camp_server_trunks_to_dial[$server_CIPct]"; + print "|$stmtA|\n"; + $UDaffected_rows = $dbhA->do($stmtA); + print "hopper rows updated to QUEUE: |$UDaffected_rows|\n"; + + if ($UDaffected_rows) + { + $lead_id=''; $phone_code=''; $phone_number=''; $called_count=''; + while ($call_CMPIPct < $UDaffected_rows) + { + $stmtA = "SELECT lead_id FROM vicidial_hopper where campaign_id='$DBfill_campaign[$camp_CIPct]' and status='QUEUE' and user='VDAD_$DB_camp_server_server_ip[$server_CIPct]' order by priority desc,hopper_id LIMIT 1"; + print "|$stmtA|\n"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + $rec_countCUSTDATA=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $lead_id = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + + if ($lead_id_call_list =~ /\|$lead_id\|/) + { + print "!!!!!!!!!!!!!!!!duplicate lead_id for this run: |$lead_id| $lead_id_call_list\n"; + if ($SYSLOG) + { + open(DUPout, ">>$PATHlogs/VDAD_DUPLICATE.$file_date") + || die "Can't open $PATHlogs/VDAD_DUPLICATE.$file_date: $!\n"; + print DUPout "$now_date-----$lead_id_call_list-----$lead_id\n"; + close(DUPout); + } + } + else + { + $stmtA = "UPDATE vicidial_hopper set status='INCALL' where lead_id='$lead_id'"; + print "|$stmtA|\n"; + $UQaffected_rows = $dbhA->do($stmtA); + print "hopper row updated to INCALL: |$UQaffected_rows|$lead_id|\n"; + + $stmtA = "SELECT * FROM vicidial_list where lead_id='$lead_id';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + $rec_countCUSTDATA=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $list_id = "$aryA[7]"; + $gmt_offset_now = "$aryA[8]"; + $called_since_last_reset = "$aryA[9]"; + $phone_code = "$aryA[10]"; + $phone_number = "$aryA[11]"; + $called_count = "$aryA[30]"; + + $rec_countCUSTDATA++; + $rec_count++; + } + $sthA->finish(); + + if ($rec_countCUSTDATA) + { + ### update called_count + $called_count++; + if ($called_since_last_reset =~ /^Y/) + { + if ($called_since_last_reset =~ /^Y$/) {$CSLR = 'Y1';} + else + { + $called_since_last_reset =~ s/^Y//gi; + $called_since_last_reset++; + $CSLR = "Y$called_since_last_reset"; + } + } + else {$CSLR = 'Y';} + + $stmtA = "UPDATE vicidial_list set called_since_last_reset='$CSLR', called_count='$called_count',user='VDAD' where lead_id='$lead_id'"; + $affected_rows = $dbhA->do($stmtA); + + $stmtA = "DELETE FROM vicidial_hopper where lead_id='$lead_id'"; + $affected_rows = $dbhA->do($stmtA); + + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + if ($DBIPdialtimeout[$camp_CIPct] > 4) {$Local_dial_timeout = $DBIPdialtimeout[$camp_CIPct];} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (length($DBIPdialprefix[$camp_CIPct]) > 0) {$Local_out_prefix = "$DBIPdialprefix[$camp_CIPct]";} + if (length($DBIPvdadexten[$camp_CIPct]) > 0) {$VDAD_dial_exten = "$DBIPvdadexten[$camp_CIPct]";} + else {$VDAD_dial_exten = "$answer_transfer_agent";} + + if (length($DBfill_campaigncid[$camp_CIPct]) > 6) {$CCID = "$DBfill_campaigncid[$camp_CIPct]"; $CCID_on++;} + if ($DBIPdialprefix[$camp_CIPct] =~ /x/i) {$Local_out_prefix = '';} + + if ($RECcount) + { + if ( (length($RECprefix)>0) && ($called_count < $RECcount) ) + {$Local_out_prefix .= "$RECprefix";} + } + $PADlead_id = sprintf("%09s", $lead_id); while (length($PADlead_id) > 9) {chop($PADlead_id);} + + if ($lists_update !~ /'$list_id'/) {$lists_update .= "'$list_id',"; $LUcount++;} + + $lead_id_call_list .= "$lead_id|"; + + ### whether to omit phone_code or not + if ($DBIPomitcode[$camp_CIPct] > 0) + {$Ndialstring = "$Local_out_prefix$phone_number";} + else + {$Ndialstring = "$Local_out_prefix$phone_code$phone_number";} + + ### use manager middleware-app to connect the next call to the meetme room + # VmmddhhmmssLLLLLLLLL + $VqueryCID = "V$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$VqueryCID\" <$CCID>";} + else {$CIDstring = "$VqueryCID";} + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$DB_camp_server_server_ip[$server_CIPct]','','Originate','$VqueryCID','Exten: $VDAD_dial_exten','Context: $ext_context','Channel: $local_DEF$Ndialstring$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','')"; + $affected_rows = $dbhA->do($stmtA); + + $event_string = "| number call dialed|$DBfill_campaign[$camp_CIPct]|$VqueryCID|$stmtA|$gmt_offset_now|"; + &event_logger; + + ### insert a SENT record to the vicidial_auto_calls table + $stmtA = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$DB_camp_server_server_ip[$server_CIPct]','$DBfill_campaign[$camp_CIPct]','SENT','$lead_id','$VqueryCID','$phone_code','$phone_number','$SQLdate','OUTBALANCE')"; + $affected_rows = $dbhA->do($stmtA); + + ### sleep for a tenth of a second to not flood the server with new calls + usleep(1*25*1000); + + } + } + $call_CMPIPct++; + } + } + } + } + else + { + $event_string.="No Agents logged in, not dialing"; + &event_logger; + } + + + + + + $server_CIPct++; + } + + } + else + { + $event_string.="No Balance Servers available that do not have a shortage"; + &event_logger; + } + + $temp_balance_total = ($DBfill_current_balance[$camp_CIPct] + $DBfill_tally[$camp_CIPct]); + if ($DB) {print "CURRENT FILL: $temp_balance_total = ($DBfill_current_balance[$camp_CIPct] + $DBfill_tally[$camp_CIPct])\n";} + $stmtA = "UPDATE vicidial_campaign_stats SET balance_trunk_fill='$temp_balance_total' where campaign_id='$DBfill_campaign[$camp_CIPct]';"; + $affected_rows = $dbhA->do($stmtA); + + $camp_CIPct++; + } + + } + ################################################################################## + ##### END LOOP IF THERE ARE BALANCE SERVERS AND THERE ARE SHORTAGES + ################################################################################## + else + { + if ($DB) {print "No Balance servers or no shortages\n";} + $stmtA = "UPDATE vicidial_campaign_stats SET balance_trunk_fill='0';"; + $affected_rows = $dbhA->do($stmtA); + + $event_string.="No Balance Servers available or No Shortages"; + &event_logger; + } + + +# so far we have a check of balance servers, a check of shortage servers and we begin traversing the campaigns array +#exit; + + + + + + + &get_time_now; + + + if ($LUcount > 0) + { + chop($lists_update); + $stmtA = "UPDATE vicidial_lists SET list_lastcalldate='$SQLdate' where list_id IN($lists_update);"; + $affected_rows = $dbhA->do($stmtA); + $event_string = "| lastcalldate UPDATED $affected_rows|$lists_update|"; + &event_logger; + } + + ############################################################################### + ###### last, wait for a little bit and repeat the loop + ############################################################################### + + ### sleep for 2 and a half seconds before beginning the loop again + usleep(1*$loop_delay*1000); + + $endless_loop--; + if($DB){print STDERR "\nloop counter: |$endless_loop|\n";} + + ### putting a blank file called "VDADfull.kill" in the directory will automatically safely kill this program + if (-e "$PATHhome/VDADfull.kill") + { + unlink("$PATHhome/VDADfull.kill"); + $endless_loop=0; + $one_day_interval=0; + print "\nPROCESS KILLED MANUALLY... EXITING\n\n" + } + if ($endless_loop =~ /0$/) # run every ten cycles (about 25 seconds) + { + ### Grab Server values from the database + $stmtA = "SELECT vd_server_logs FROM servers where server_ip = '$VARserver_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBvd_server_logs = "$aryA[0]"; + if ($DBvd_server_logs =~ /Y/) {$SYSLOG = '1';} + else {$SYSLOG = '0';} + $rec_count++; + } + $sthA->finish(); + + ### Grab Server values from the database in case they've changed + $stmtA = "SELECT max_vicidial_trunks,answer_transfer_agent,local_gmt,ext_context FROM servers where server_ip = '$server_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBmax_vicidial_trunks = "$aryA[0]"; + $DBanswer_transfer_agent= "$aryA[1]"; + $DBSERVER_GMT = "$aryA[2]"; + $DBext_context = "$aryA[3]"; + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBext_context) {$ext_context = $DBext_context;} + $rec_count++; + } + $sthA->finish(); + + $event_string = "| updating server parameters $max_vicidial_trunks|$answer_transfer_agent|$SERVER_GMT|$ext_context|$DBvd_server_logs|$SYSLOG|"; + &event_logger; + &get_time_now; + } + + $stat_count++; + } + + + if($DB){print "DONE... Exiting... Goodbye... See you later... Not really, initiating next loop...\n";} + + $event_string='HANGING UP|'; + &event_logger; + + $one_day_interval--; + +} + + $event_string='CLOSING DB CONNECTION|'; + &event_logger; + + + $dbhA->disconnect(); + + + if($DB){print "DONE... Exiting... Goodbye... See you later... Really I mean it this time\n";} + + +exit; + + + + + + + + + + + + + +sub get_time_now #get the current date and time and epoch for logging call lengths and datetimes +{ +$secX = time(); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($secX); + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + if ($isdst) {$LOCAL_GMT_OFF++;} + +$GMT_now = ($secX - ($LOCAL_GMT_OFF * 3600)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($GMT_now); + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + + if ($DB) {print "TIME DEBUG: $LOCAL_GMT_OFF_STD|$LOCAL_GMT_OFF|$isdst| GMT: $hour:$min\n";} + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$hour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$file_date = "$year-$mon-$mday"; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + +$BDtarget = ($secX - 10); +($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); +$Byear = ($Byear + 1900); +$Bmon++; +if ($Bmon < 10) {$Bmon = "0$Bmon";} +if ($Bmday < 10) {$Bmday = "0$Bmday";} +if ($Bhour < 10) {$Bhour = "0$Bhour";} +if ($Bmin < 10) {$Bmin = "0$Bmin";} +if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + +$PDtarget = ($secX - 30); +($Psec,$Pmin,$Phour,$Pmday,$Pmon,$Pyear,$Pwday,$Pyday,$Pisdst) = localtime($PDtarget); +$Pyear = ($Pyear + 1900); +$Pmon++; +if ($Pmon < 10) {$Pmon = "0$Pmon";} +if ($Pmday < 10) {$Pmday = "0$Pmday";} +if ($Phour < 10) {$Phour = "0$Phour";} +if ($Pmin < 10) {$Pmin = "0$Pmin";} +if ($Psec < 10) {$Psec = "0$Psec";} + $PDtsSQLdate = "$Pyear$Pmon$Pmday$Phour$Pmin$Psec"; + $halfminSQLdate = "$Pyear-$Pmon-$Pmday $Phour:$Pmin:$Psec"; + +$XDtarget = ($secX - 120); +($Xsec,$Xmin,$Xhour,$Xmday,$Xmon,$Xyear,$Xwday,$Xyday,$Xisdst) = localtime($XDtarget); +$Xyear = ($Xyear + 1900); +$Xmon++; +if ($Xmon < 10) {$Xmon = "0$Xmon";} +if ($Xmday < 10) {$Xmday = "0$Xmday";} +if ($Xhour < 10) {$Xhour = "0$Xhour";} +if ($Xmin < 10) {$Xmin = "0$Xmin";} +if ($Xsec < 10) {$Xsec = "0$Xsec";} + $XDSQLdate = "$Xyear-$Xmon-$Xmday $Xhour:$Xmin:$Xsec"; + +$TDtarget = ($secX - 600); +($Tsec,$Tmin,$Thour,$Tmday,$Tmon,$Tyear,$Twday,$Tyday,$Tisdst) = localtime($TDtarget); +$Tyear = ($Tyear + 1900); +$Tmon++; +if ($Tmon < 10) {$Tmon = "0$Tmon";} +if ($Tmday < 10) {$Tmday = "0$Tmday";} +if ($Thour < 10) {$Thour = "0$Thour";} +if ($Tmin < 10) {$Tmin = "0$Tmin";} +if ($Tsec < 10) {$Tsec = "0$Tsec";} + $TDSQLdate = "$Tyear-$Tmon-$Tmday $Thour:$Tmin:$Tsec"; + +} + + + + + +sub event_logger +{ +if ($DB) {print "$now_date|$event_string|\n";} +if ($SYSLOG) + { + ### open the log file for writing ### + open(Lout, ">>$VDADLOGfile") + || die "Can't open $VDADLOGfile: $!\n"; + print Lout "$now_date|$event_string|\n"; + close(Lout); + } +$event_string=''; +} diff --git a/agc_2-X/branches/agc_2.0.4/bin/AST_VDhopper.pl b/agc_2-X/branches/agc_2.0.4/bin/AST_VDhopper.pl new file mode 100644 index 00000000..924b7327 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/AST_VDhopper.pl @@ -0,0 +1,1294 @@ +#!/usr/bin/perl +# +# AST_VDhopper.pl version 2.0.4 *DBI-version* +# +# DESCRIPTION: +# uses DBD::MySQL to update the VICIDIAL leads hopper for the streamlined +# approach of allocating leads to client machines. +# +# SUMMARY: +# This program was designed for people using the Asterisk PBX with VICIDIAL +# +# For the client to use VICIDIAL, this program must be in the cron running +# every minute +# +# For this program to work you need to have the "asterisk" MySQL database +# created and create the tables listed in the CONF_MySQL.txt file, also make sure +# that the machine running this program has read/write/update/delete access +# to that database +# +# It is recommended that you run this program on the local Asterisk machine +# +# If this script is run ever minute and you are getting close to no leads after +# a minute, you may want to play with the variables below to streamline for +# your usage +# +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# +# CHANGELOG +# 50810-1613 - Added database server variable definitions lookup +# 60215-1106 - Added Scheduled Callback release functionality +# 60228-1623 - Change Callback activation to set the called_since_last_reset=N +# 60228-1735 - Added hopper gmt validation to remove gmt outside of time range +# 60320-0932 - Added inactive lead list hopper deletion (Thanks Vic Jolin) +# 60322-1030 - Added super debug output +# 60418-0947 - Added lead filter per campaign +# 60509-1416 - Rewrite of local_call_time functions +# 60511-1150 - Added inserts into vicidial_campaign_stats table +# 60609-1451 - Added ability to filter by DNC list vicidial_dnc +# 60614-1159 - Added campaign lead recycling ability +# 60715-2251 - Changed to use /etc/astguiclient.conf for configs +# 60801-1634 - Fixed Callback activation bug 000008 +# 60814-1720 - Added option for no logging to file +# 60822-1527 - Added campaign_stats and logging options for adaptive dialing +# 60925-1330 - Fixed recycling leads issues +# 61110-1513 - Changed Xth NEW to fill to hopper_level with standard if not enough NEW +# 70219-1247 - Changed to use dial_statuses field instead of dial_status_x fields +# 71029-1929 - Added 5th and 6th NEW to list order +# 71030-2043 - Added hopper priority for callbacks +# + +# constants +$DB=0; # Debug flag, set to 0 for no debug messages, On an active system this will generate lots of lines of output per minute +$US='__'; +$MT[0]=''; +#$vicidial_hopper='TEST_vicidial_hopper'; # for testing +$vicidial_hopper='vicidial_hopper'; + +# options +$insert_auto_CB_to_hopper = 1; # set to 1 to automatically insert ANYONE callbacks into the hopper + + +$secT = time(); +$secX = time(); +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} +$file_date = "$year-$mon-$mday"; +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$VDL_date = "$year-$mon-$mday 00:00:01"; + +### get date-time of one hour ago ### + $VDL_hour = ($secX - (60 * 60)); +($Vsec,$Vmin,$Vhour,$Vmday,$Vmon,$Vyear,$Vwday,$Vyday,$Visdst) = localtime($VDL_hour); +$Vyear = ($Vyear + 1900); +$Vmon++; +if ($Vmon < 10) {$Vmon = "0$Vmon";} +if ($Vmday < 10) {$Vmday = "0$Vmday";} +$VDL_hour = "$Vyear-$Vmon-$Vmday $Vhour:$Vmin:$Vsec"; + +### get date-time of half hour ago ### + $VDL_halfhour = ($secX - (30 * 60)); +($Vsec,$Vmin,$Vhour,$Vmday,$Vmon,$Vyear,$Vwday,$Vyday,$Visdst) = localtime($VDL_halfhour); +$Vyear = ($Vyear + 1900); +$Vmon++; +if ($Vmon < 10) {$Vmon = "0$Vmon";} +if ($Vmday < 10) {$Vmday = "0$Vmday";} +$VDL_halfhour = "$Vyear-$Vmon-$Vmday $Vhour:$Vmin:$Vsec"; + +### get date-time of five minutes ago ### + $VDL_five = ($secX - (5 * 60)); +($Vsec,$Vmin,$Vhour,$Vmday,$Vmon,$Vyear,$Vwday,$Vyday,$Visdst) = localtime($VDL_five); +$Vyear = ($Vyear + 1900); +$Vmon++; +if ($Vmon < 10) {$Vmon = "0$Vmon";} +if ($Vmday < 10) {$Vmday = "0$Vmday";} +$VDL_five = "$Vyear-$Vmon-$Vmday $Vhour:$Vmin:$Vsec"; + +### get date-time of one minute ago ### + $VDL_one = ($secX - (1 * 60)); +($Vsec,$Vmin,$Vhour,$Vmday,$Vmon,$Vyear,$Vwday,$Vyday,$Visdst) = localtime($VDL_one); +$Vyear = ($Vyear + 1900); +$Vmon++; +if ($Vmon < 10) {$Vmon = "0$Vmon";} +if ($Vmday < 10) {$Vmday = "0$Vmday";} +$VDL_one = "$Vyear-$Vmon-$Vmday $Vhour:$Vmin:$Vsec"; + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options(must stay in this order):\n [--debug] = debug\n [--debugX] = super debug\n [--dbgmt] = show GMT offset of records as they are inserted into hopper\n [-t] = test\n [--level=XXX] = force a hopper_level of XXX\n [--campaign=XXX] = run for campaign XXX only\n\n"; + exit; + } + else + { + if ($args =~ /--campaign=/i) + { + # print "\n|$ARGS|\n\n"; + @data_in = split(/--campaign=/,$args); + $CLIcampaign = $data_in[1]; + $CLIcampaign =~ s/ .*$//gi; + } + else + {$CLIcampaign = '';} + if ($args =~ /--level=/i) + { + @data_in = split(/--level=/,$args); + $CLIlevel = $data_in[1]; + $CLIlevel =~ s/ .*$//gi; + $CLIlevel =~ s/\D//gi; + print "\n-----HOPPER LEVEL OVERRIDE: $CLIlevel -----\n\n"; + } + else + {$CLIlevel = '';} + if ($args =~ /--debug/i) + { + $DB=1; + print "\n----- DEBUG -----\n\n"; + } + if ($args =~ /--debugX/i) + { + $DBX=1; + print "\n----- SUPER DEBUG -----\n\n"; + } + if ($args =~ /--dbgmt/i) + { + $DB_show_offset=1; + print "\n-----DEBUG GMT -----\n\n"; + } + if ($args =~ /-t/i) + { + $T=1; $TEST=1; + print "\n-----TESTING -----\n\n"; + } + if ($args =~ /--wipe-hopper-clean/i) + { + $wipe_hopper_clean=1; + } + } +} +else +{ +print "no command line options set\n"; +} + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +if (!$VDHLOGfile) {$VDHLOGfile = "$PATHlogs/hopper.$year-$mon-$mday";} +if (!$VARDB_port) {$VARDB_port='3306';} + +use DBI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + +### Grab Server values from the database + $stmtA = "SELECT vd_server_logs,local_gmt FROM servers where server_ip = '$VARserver_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBvd_server_logs = "$aryA[0]"; + $DBSERVER_GMT = "$aryA[1]"; + if ($DBvd_server_logs =~ /Y/) {$SYSLOG = '1';} + else {$SYSLOG = '0';} + if (length($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;} + $rec_count++; + } + $sthA->finish(); + + + +$secX = time(); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($secX); + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + if ($isdst) {$LOCAL_GMT_OFF++;} + +$GMT_now = ($secX - ($LOCAL_GMT_OFF * 3600)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($GMT_now); + $mon++; + $year = ($year + 1900); + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + if ($DB) {print "TIME DEBUG: $LOCAL_GMT_OFF_STD|$LOCAL_GMT_OFF|$isdst| GMT: $hour:$min\n";} + +if ($wipe_hopper_clean) + { + $stmtA = "DELETE from $vicidial_hopper;"; + $affected_rows = $dbhA->do($stmtA); + if ($DB) {print "Hopper Wiped Clean: $affected_rows\n";} + $event_string = "|HOPPER WIPE CLEAN|"; + &event_logger; + + exit; + } +### Delete leads from inactive lists if there are any +$stmtA = "SELECT * FROM vicidial_lists where active='N';"; +if ($DB) {print $stmtA;} +$inactive_lists=''; +$inactive_lists_count=0; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +while ($sthArows > $inactive_lists_count) + { + @aryA = $sthA->fetchrow_array; + $inactive_list = $aryA[0]; + $inactive_lists .= "'$inactive_list',"; + $inactive_lists_count++; + } +$sthA->finish(); +if ($DB) {print "Inactive Lists: $inactive_lists_count\n";} + +if ($inactive_lists_count > 0) + { + chop($inactive_lists); + $stmtA = "DELETE from $vicidial_hopper where list_id IN($inactive_lists);"; + $affected_rows = $dbhA->do($stmtA); + if ($DB) {print "Inactive List Leads Deleted: $affected_rows |$stmtA|\n";} + $event_string = "|INACTIVE LIST DEL|$affected_rows|"; + &event_logger; + } + +### BEGIN Change CBHOLD status leads to CALLBK if their vicidial_callbacks time has passed +$stmtA = "SELECT count(*) FROM vicidial_callbacks where callback_time <= '$now_date' and status='ACTIVE';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +@aryA = $sthA->fetchrow_array; +$CBHOLD_count = $aryA[0]; + if ($DB) {print "CALLBACK HOLD: $CBHOLD_count|$stmtA|\n";} +$sthA->finish(); + +if ($CBHOLD_count > 0) + { + $update_leads=''; + $cbc=0; + $cba=0; + $stmtA = "SELECT vicidial_callbacks.lead_id,recipient,campaign_id,vicidial_callbacks.list_id,gmt_offset_now,state FROM vicidial_callbacks,vicidial_list where callback_time <= '$now_date' and vicidial_callbacks.status='ACTIVE' and vicidial_callbacks.lead_id=vicidial_list.lead_id;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + while ($sthArows > $cbc) + { + @aryA = $sthA->fetchrow_array; + $lead_ids[$cbc] = $aryA[0]; + $recipient = $aryA[1]; + $update_leads .= "'$lead_ids[$cbc]',"; + if ($recipient =~ /ANYONE/) + { + $CA_lead_id[$cba] = $aryA[0]; + $CA_campaign_id[$cba] = $aryA[2]; + $CA_list_id[$cba] = $aryA[3]; + $CA_gmt_offset_now[$cba] = $aryA[4]; + $CA_state[$cba] = $aryA[5]; + $cba++; + } + $cbc++; + } + $sthA->finish(); + if ($cbc > 0) + { + chop($update_leads); + + $stmtA = "UPDATE vicidial_callbacks set status='LIVE' where lead_id IN($update_leads) and status NOT IN('INACTIVE','DEAD','ARCHIVE');"; + $affected_rows = $dbhA->do($stmtA); + if ($DB) {print "Scheduled Callbacks Activated: $affected_rows\n";} + $event_string = "|CALLBACKS CB ACT |$affected_rows|"; + &event_logger; + + } + ### INSERT ANYONE CALLBACKS INTO HOPPER DIRECTLY ### + if ( ($cba > 0) && ($insert_auto_CB_to_hopper) ) + { + if ($DB) {print "ANYONE Scheduled Callbacks to Insert into hopper: $cba\n";} + $event_string = "|ANYONE CB HOPPER |$cba|"; + &event_logger; + $CAu=0; + foreach(@CA_lead_id) + { + $stmtA = "UPDATE vicidial_list set status='CALLBK', called_since_last_reset='N' where lead_id='$CA_lead_id[$CAu]';"; + $affected_rows = $dbhA->do($stmtA); + if ($DB) {print "Scheduled Callbacks Activated: $affected_rows\n";} + $event_string = "|CALLBACKS LISTACT|$affected_rows|"; + &event_logger; + + $stmtA = "INSERT INTO $vicidial_hopper SET lead_id='$CA_lead_id[$CAu]',campaign_id='$CA_campaign_id[$CAu]',list_id='$CA_list_id[$CAu]',gmt_offset_now='$CA_gmt_offset_now[$CAu]',user='',state='$CA_state[$CAu]',priority='50';"; + $affected_rows = $dbhA->do($stmtA); + if ($DB) {print "ANYONE Scheduled Callback Inserted into hopper: $affected_rows|$CA_lead_id[$CAu]\n";} + $CAu++; + } + } + } +### END Change CBHOLD status leads to CALLBK if their vicidial_callbacks time has passed + + +@campaign_id=@MT; + +if ($CLIcampaign) + { + $stmtA = "SELECT * from vicidial_campaigns where campaign_id='$CLIcampaign'"; + } +else + { + $stmtA = "SELECT * from vicidial_campaigns where active='Y'"; + } +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $campaign_id[$rec_count] = "$aryA[0]"; + $lead_order[$rec_count] = "$aryA[8]"; + if (!$CLIlevel) + {$hopper_level[$rec_count] = "$aryA[13]";} + else + {$hopper_level[$rec_count] = "$CLIlevel";} + $auto_dial_level[$rec_count] = "$aryA[14]"; + $local_call_time[$rec_count] = "$aryA[16]"; + $lead_filter_id[$rec_count] = "$aryA[35]"; + $use_internal_dnc[$rec_count] = "$aryA[43]"; + $dial_method[$rec_count] = $aryA[46]; + $available_only_ratio_tally[$rec_count] = $aryA[47]; + $adaptive_dropped_percentage[$rec_count] = $aryA[48]; + $adaptive_maximum_level[$rec_count] = $aryA[49]; + $dial_statuses[$rec_count] = $aryA[61]; + + $rec_count++; + } +$sthA->finish(); +if ($DB) {print "CAMPAIGNS TO PROCESSES HOPPER FOR: $rec_count|$#campaign_id\n";} + + +##### LOOP THROUGH EACH CAMPAIGN AND PROCESS THE HOPPER ##### +$i=0; +foreach(@campaign_id) + { + ### BEGIN - GATHER STATS FOR THE vicidial_campaign_stats TABLE ### + $vicidial_log = 'vicidial_log'; + $VCSdialable_leads[$i]=0; + + $dial_statuses[$i] =~ s/ -$//gi; + @Dstatuses = split(/ /,$dial_statuses[$i]); + $Ds_to_print = (($#Dstatuses) + 0); + $STATUSsql[$i]=''; + $o=0; + while ($Ds_to_print > $o) + { + $o++; + $STATUSsql[$i] .= "'$Dstatuses[$o]',"; + } + chop($STATUSsql[$i]); + + $stmtA = "SELECT dialable_leads from vicidial_campaign_stats where campaign_id='$campaign_id[$i]';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VCSdialable_leads[$i] = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + ### END - GATHER STATS FOR THE vicidial_campaign_stats TABLE ### + + ##### BEGIN calculate what gmt_offset_now values are within the allowed local_call_time setting ### + $g=0; + $p='13'; + $GMT_gmt[0] = ''; + $GMT_hour[0] = ''; + $GMT_day[0] = ''; + if ($DBX) {print "\n |GMT-DAY-HOUR| ";} + while ($p > -13) + { + $pzone = ($GMT_now + ($p * 3600)); + ($psec,$pmin,$phour,$pmday,$pmon,$pyear,$pday,$pyday,$pisdst) = localtime($pzone); + $phour=($phour * 100); + $tz = sprintf("%.2f", $p); + $GMT_gmt[$g] = "$tz"; + $GMT_day[$g] = "$pday"; + $GMT_hour[$g] = ($phour + $pmin); + $p = ($p - 0.25); + if ($DBX) {print "|$GMT_gmt[$g]-$GMT_day[$g]-$GMT_hour[$g]|";} + $g++; + } + if ($DBX) {print "\n";} + + $stmtA = "SELECT * FROM vicidial_call_times where call_time_id='$local_call_time[$i]';"; + if ($DBX) {print " |$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $Gct_default_start = "$aryA[3]"; + $Gct_default_stop = "$aryA[4]"; + $Gct_sunday_start = "$aryA[5]"; + $Gct_sunday_stop = "$aryA[6]"; + $Gct_monday_start = "$aryA[7]"; + $Gct_monday_stop = "$aryA[8]"; + $Gct_tuesday_start = "$aryA[9]"; + $Gct_tuesday_stop = "$aryA[10]"; + $Gct_wednesday_start = "$aryA[11]"; + $Gct_wednesday_stop = "$aryA[12]"; + $Gct_thursday_start = "$aryA[13]"; + $Gct_thursday_stop = "$aryA[14]"; + $Gct_friday_start = "$aryA[15]"; + $Gct_friday_stop = "$aryA[16]"; + $Gct_saturday_start = "$aryA[17]"; + $Gct_saturday_stop = "$aryA[18]"; + $Gct_state_call_times = "$aryA[19]"; + $rec_count++; + } + $sthA->finish(); + + $ct_states = ''; + $ct_state_gmt_SQL = ''; + $del_state_gmt_SQL = ''; + $ct_srs=0; + $b=0; + if (length($Gct_state_call_times)>2) + { + @state_rules = split(/\|/,$Gct_state_call_times); + $ct_srs = ($#state_rules - 2); + } + while($ct_srs >= $b) + { + if (length($state_rules[$b])>1) + { + $stmtA = "SELECT * from vicidial_state_call_times where state_call_time_id='$state_rules[$b]';"; + if ($DBX) {print " |$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $Gstate_call_time_id = "$aryA[0]"; + $Gstate_call_time_state = "$aryA[1]"; + $Gsct_default_start = "$aryA[4]"; + $Gsct_default_stop = "$aryA[5]"; + $Gsct_sunday_start = "$aryA[6]"; + $Gsct_sunday_stop = "$aryA[7]"; + $Gsct_monday_start = "$aryA[8]"; + $Gsct_monday_stop = "$aryA[9]"; + $Gsct_tuesday_start = "$aryA[10]"; + $Gsct_tuesday_stop = "$aryA[11]"; + $Gsct_wednesday_start = "$aryA[12]"; + $Gsct_wednesday_stop = "$aryA[13]"; + $Gsct_thursday_start = "$aryA[14]"; + $Gsct_thursday_stop = "$aryA[15]"; + $Gsct_friday_start = "$aryA[16]"; + $Gsct_friday_stop = "$aryA[17]"; + $Gsct_saturday_start = "$aryA[18]"; + $Gsct_saturday_stop = "$aryA[19]"; + $ct_states .="'$Gstate_call_time_state',"; + $rec_count++; + } + $sthA->finish(); + + $r=0; + $state_gmt=''; + $del_state_gmt=''; + while($r < $g) + { + if ($GMT_day[$r]==0) #### Sunday local time + { + if (($Gsct_sunday_start==0) and ($Gsct_sunday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + else + {$del_state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_sunday_start) and ($GMT_hour[$r]<$Gsct_sunday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + else + {$del_state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==1) #### Monday local time + { + if (($Gsct_monday_start==0) and ($Gsct_monday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + else + {$del_state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_monday_start) and ($GMT_hour[$r]<$Gsct_monday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + else + {$del_state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==2) #### Tuesday local time + { + if (($Gsct_tuesday_start==0) and ($Gsct_tuesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + else + {$del_state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_tuesday_start) and ($GMT_hour[$r]<$Gsct_tuesday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + else + {$del_state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==3) #### Wednesday local time + { + if (($Gsct_wednesday_start==0) and ($Gsct_wednesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + else + {$del_state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_wednesday_start) and ($GMT_hour[$r]<$Gsct_wednesday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + else + {$del_state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==4) #### Thursday local time + { + if (($Gsct_thursday_start==0) and ($Gsct_thursday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + else + {$del_state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_thursday_start) and ($GMT_hour[$r]<$Gsct_thursday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + else + {$del_state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==5) #### Friday local time + { + if (($Gsct_friday_start==0) and ($Gsct_friday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + else + {$del_state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_friday_start) and ($GMT_hour[$r]<$Gsct_friday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + else + {$del_state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==6) #### Saturday local time + { + if (($Gsct_saturday_start==0) and ($Gsct_saturday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + else + {$del_state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_saturday_start) and ($GMT_hour[$r]<$Gsct_saturday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + else + {$del_state_gmt.="'$GMT_gmt[$r]',";} + } + } + $r++; + } + $state_gmt = "$state_gmt'99'"; + $del_state_gmt = "$del_state_gmt'99'"; + $ct_state_gmt_SQL .= "or (state='$Gstate_call_time_state' and gmt_offset_now IN($state_gmt)) "; + $del_state_gmt_SQL .= "or (state='$Gstate_call_time_state' and gmt_offset_now IN($del_state_gmt)) "; + } + + $b++; + } + if (length($ct_states)>2) + { + $ct_states =~ s/,$//gi; + $ct_statesSQL = "and state NOT IN($ct_states)"; + } + else + { + $ct_statesSQL = ""; + } + + $r=0; + $default_gmt=''; + $del_default_gmt=''; + while($r < $g) + { + if ($GMT_day[$r]==0) #### Sunday local time + { + if (($Gct_sunday_start==0) and ($Gct_sunday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + else + {$del_default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_sunday_start) and ($GMT_hour[$r]<$Gct_sunday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + else + {$del_default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==1) #### Monday local time + { + if (($Gct_monday_start==0) and ($Gct_monday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + else + {$del_default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_monday_start) and ($GMT_hour[$r]<$Gct_monday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + else + {$del_default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==2) #### Tuesday local time + { + if (($Gct_tuesday_start==0) and ($Gct_tuesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + else + {$del_default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_tuesday_start) and ($GMT_hour[$r]<$Gct_tuesday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + else + {$del_default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==3) #### Wednesday local time + { + if (($Gct_wednesday_start==0) and ($Gct_wednesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + else + {$del_default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_wednesday_start) and ($GMT_hour[$r]<$Gct_wednesday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + else + {$del_default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==4) #### Thursday local time + { + if (($Gct_thursday_start==0) and ($Gct_thursday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + else + {$del_default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_thursday_start) and ($GMT_hour[$r]<$Gct_thursday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + else + {$del_default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==5) #### Friday local time + { + if (($Gct_friday_start==0) and ($Gct_friday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + else + {$del_default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_friday_start) and ($GMT_hour[$r]<$Gct_friday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + else + {$del_default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==6) #### Saturday local time + { + if (($Gct_saturday_start==0) and ($Gct_saturday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + else + {$del_default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_saturday_start) and ($GMT_hour[$r]<$Gct_saturday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + else + {$del_default_gmt.="'$GMT_gmt[$r]',";} + } + } + $r++; + } + + $default_gmt = "$default_gmt'99'"; + $del_default_gmt = "$del_default_gmt'99'"; + $all_gmtSQL[$i] = "(gmt_offset_now IN($default_gmt) $ct_statesSQL) $ct_state_gmt_SQL"; + $del_gmtSQL[$i] = "(gmt_offset_now IN($del_default_gmt) $ct_statesSQL) $del_state_gmt_SQL"; + + ##### END calculate what gmt_offset_now values are within the allowed local_call_time setting ### + + ##### BEGIN lead recycling parsing and prep ### + + $stmtA = "SELECT * from vicidial_lead_recycle where campaign_id='$campaign_id[$i]' and active='Y';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @recycle_status=@MT; + @recycle_delay=@MT; + @recycle_maximum=@MT; + @RSQLdate=@MT; + $r_ct=0; + $rec_ct[$i]=0; + while ($sthArows > $r_ct) + { + @aryA = $sthA->fetchrow_array; + $recycle_status[$r_ct] = "$aryA[2]"; + $recycle_delay[$r_ct] = "$aryA[3]"; + $recycle_maximum[$r_ct] = "$aryA[4]"; + $r_ct++; + $rec_ct[$i]++; + } + $sthA->finish(); + + if ($rec_ct[$i] > 0) + { + $rc=0; + $recycle_SQL[$i] = "( "; + while($rc < $rec_ct[$i]) + { + $secX = time(); + $Rtarget = ($secX - $recycle_delay[$rc]); + ($Rsec,$Rmin,$Rhour,$Rmday,$Rmon,$Ryear,$Rwday,$Ryday,$Risdst) = localtime($Rtarget); + $Ryear = ($Ryear + 1900); + $Rmon++; + if ($Rmon < 10) {$Rmon = "0$Rmon";} + if ($Rmday < 10) {$Rmday = "0$Rmday";} + if ($Rhour < 10) {$Rhour = "0$Rhour";} + if ($Rmin < 10) {$Rmin = "0$Rmin";} + if ($Rsec < 10) {$Rsec = "0$Rsec";} + $RSQLdate[$rc] = "$Ryear-$Rmon-$Rmday $Rhour:$Rmin:$Rsec"; + $Y=1; + $recycle_Y = "'Y'"; + while ($Y < $recycle_maximum[$rc]) + { + $recycle_Y .= ",'Y$Y'"; + $Y++; + } + + if ($rc > 0) {$recycle_SQL[$i] .= " or ";} + + $recycle_SQL[$i] .= "( (called_since_last_reset IN($recycle_Y)) and (status='$recycle_status[$rc]') and (modify_date < \"$RSQLdate[$rc]\") )"; + + if ($DBX) {print "RECYCLE: |$campaign_id[$i]|$recycle_status[$rc]|$recycle_delay[$rc]|$recycle_maximum[$rc]|$RSQLdate[$rc]|\n";} + $rc++; + } + + $recycle_SQL[$i] .= " )"; + + if ($DBX) {print "RECYCLE SQL: |$recycle_SQL[$i]|\n";} + } + ##### END lead recycling parsing and prep ### + + if ($DB) {print "Starting hopper run for $campaign_id[$i] campaign- GMT: $local_call_time[$i] HOPPER: $hopper_level[$i] \n";} + + ### Delete the DONE leads if there are any + $stmtA = "DELETE from $vicidial_hopper where campaign_id='$campaign_id[$i]' and status IN('DONE');"; + $affected_rows = $dbhA->do($stmtA); + if ($DB) {print " hopper DONE cleared: $affected_rows\n";} + if ($DBX) {print " |$stmtA|\n";} + + ### Delete the leads that are out of GMT time range if there are any + $stmtA = "DELETE from $vicidial_hopper where campaign_id='$campaign_id[$i]' and ($del_gmtSQL[$i]);"; + $affected_rows = $dbhA->do($stmtA); + if ($DB) {print " hopper GMT BAD cleared: $affected_rows\n";} + if ($DBX) {print " |$stmtA|\n";} + + ### Find out how many leads are in the hopper from a specific campaign + $hopper_ready_count=0; + $stmtA = "SELECT count(*) from $vicidial_hopper where campaign_id='$campaign_id[$i]' and status='READY';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $hopper_ready_count = $aryA[0]; + if ($DB) {print " hopper READY count: $hopper_ready_count\n";} + if ($DBX) {print " |$stmtA|\n";} + $rec_count++; + } + $sthA->finish(); + $event_string = "|$campaign_id[$i]|$hopper_level[$i]|$hopper_ready_count|$local_call_time[$i]||"; + &event_logger; + + ##### IF hopper level is below set minimum, then try to add more leads ##### + if ($hopper_ready_count < $hopper_level[$i]) + { + if ($DB) {print " hopper too low ($hopper_ready_count|$hopper_level[$i]) starting hopper dump\n";} + + ### Get list of the lists in the campaign ### + $stmtA = "SELECT list_id FROM vicidial_lists where campaign_id='$campaign_id[$i]' and active='Y';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_countLISTS=0; + $camp_lists[$i] = ''; + while ($sthArows > $rec_countLISTS) + { + @aryA = $sthA->fetchrow_array; + $camp_lists[$i] .= "'$aryA[0]',"; + $rec_countLISTS++; + } + $sthA->finish(); + if (length($camp_lists[$i])<3) {$camp_lists[$i]="''";} + else {chop($camp_lists[$i]);} + + if ($DB) {print " campaign lists count: $rec_countLISTS | $camp_lists[$i]\n";} + if ($DBX) {print " |$stmtA|\n";} + + if ( ($lead_filter_id[$i] !~ /NONE/) && (length($lead_filter_id[$i])>0) ) + { + ### Get SQL of lead filter for the campaign ### + $stmtA = "SELECT lead_filter_sql FROM vicidial_lead_filters where lead_filter_id='$lead_filter_id[$i]';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $lead_filter_sql[$i] = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + $lead_filter_sql[$i] =~ s/^and|and$|^or|or$|^ and|and $|^ or|or $//gi; + $lead_filter_sql[$i] = "and $lead_filter_sql[$i]"; + if ($DB) {print " campaign lists count: $rec_countLISTS | $camp_lists[$i]\n";} + if ($DB) {print " lead filter $lead_filter_id[$i] defined for $campaign_id[$i]\n";} + if ($DBX) {print " |$lead_filter_sql[$i]|\n";} + } + else + { + $lead_filter_sql[$i] = ''; + if ($DB) {print " no lead filter defined for campaign: $campaign_id[$i]\n";} + if ($DBX) {print " |$lead_filter_id[$i]|\n";} + } + + $stmtA = "SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN($STATUSsql[$i]) and list_id IN($camp_lists[$i]) and ($all_gmtSQL[$i]) $lead_filter_sql[$i];"; + if ($DBX) {print " |$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $campaign_leads_to_call[$i] = "$aryA[0]"; + if ($DB) {print " leads to call count: $campaign_leads_to_call[$i]\n";} + if ($DBX) {print " |$stmtA|\n";} + $rec_count++; + } + $sthA->finish(); + + if ($lead_order[$i] =~ /DOWN COUNT 2nd NEW|DOWN COUNT 3rd NEW|DOWN COUNT 4th NEW|DOWN COUNT 5th NEW|DOWN COUNT 6th NEW/) + { + $stmtA = "SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN('NEW') and list_id IN($camp_lists[$i]) and ($all_gmtSQL[$i]) $lead_filter_sql[$i];"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $NEW_campaign_leads_to_call[$i] = "$aryA[0]"; + if ($DB) {print " NEW leads to call count: $NEW_campaign_leads_to_call[$i]\n";} + if ($DBX) {print " |$stmtA|\n";} + $rec_count++; + } + $sthA->finish(); + } + + ##### IF no NEW leads to be called, error out of this campaign ##### + if ( ($lead_order[$i] =~ /DOWN COUNT 2nd NEW|DOWN COUNT 3rd NEW|DOWN COUNT 4th NEW|DOWN COUNT 5th NEW|DOWN COUNT 6th NEW/) && ($NEW_campaign_leads_to_call[$i] > 0) ) {$GOOD=1;} + else + { + if ($lead_order[$i] !~ /DOWN COUNT 2nd NEW|DOWN COUNT 3rd NEW|DOWN COUNT 4th NEW|DOWN COUNT 5th NEW|DOWN COUNT 6th NEW/) + { + if ($DB) {print " NO SHUFFLE-NEW-LEADS INTO HOPPER DEFINED FOR LEAD ORDER\n";} + } + else + { + if ($DB) {print " ERROR CANNOT ADD ANY NEW LEADS TO HOPPER\n";} + } + } + + ##### IF no leads to be called, error out of this campaign ##### + if ( ($campaign_leads_to_call[$i] < 1) && ($rec_ct[$i] < 1) ) + { + if ($DB) {print " ERROR CANNOT ADD ANY LEADS TO HOPPER\n";} + if ($VCSdialable_leads[$i] > 0) + { + $stmtA = "UPDATE vicidial_campaign_stats SET dialable_leads='0' where campaign_id='$campaign_id[$i]';"; + $affected_rows = $dbhA->do($stmtA); + if ($DBX) {print "CAMPAIGN STATS: $affected_rows|$stmtA|\n";} + } + } + else + { + if ($VCSdialable_leads[$i] != $campaign_leads_to_call[$i]) + { + $stmtA = "UPDATE vicidial_campaign_stats SET dialable_leads='$campaign_leads_to_call[$i]' where campaign_id='$campaign_id[$i]';"; + $affected_rows = $dbhA->do($stmtA); + if ($DBX) {print "CAMPAIGN STATS: $affected_rows|$stmtA|\n";} + } + if ($DB) {print " Getting Leads to add to hopper\n";} + ### grab leads already in hopper so we don't duplicate + $stmtA = "SELECT lead_id FROM $vicidial_hopper where campaign_id='$campaign_id[$i]';"; + if ($DBX) {print " |$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $lead_id_lists = ''; + $rec_countLISTS=0; + while ($sthArows > $rec_countLISTS) + { + @aryA = $sthA->fetchrow_array; + $lead_id_lists .= "'$aryA[0]',"; + $rec_countLISTS++; + } + $sthA->finish(); + $lead_id_lists .= "'0'"; + $order_stmt=''; + $NEW_count = 0; + $NEW_level = 0; + $OTHER_level = $hopper_level[$i]; + if ($lead_order[$i] eq "DOWN") {$order_stmt = 'order by lead_id asc';} + if ($lead_order[$i] eq "UP") {$order_stmt = 'order by lead_id desc';} + if ($lead_order[$i] eq "UP LAST NAME") {$order_stmt = 'order by last_name desc, lead_id asc';} + if ($lead_order[$i] eq "DOWN LAST NAME") {$order_stmt = 'order by last_name, lead_id asc';} + if ($lead_order[$i] eq "UP PHONE") {$order_stmt = 'order by phone_number desc, lead_id asc';} + if ($lead_order[$i] eq "DOWN PHONE") {$order_stmt = 'order by phone_number, lead_id asc';} + if ($lead_order[$i] eq "UP COUNT") {$order_stmt = 'order by called_count desc, lead_id asc';} + if ($lead_order[$i] eq "DOWN COUNT") {$order_stmt = 'order by called_count, lead_id asc';} + if ($lead_order[$i] eq "DOWN COUNT 2nd NEW") {$NEW_count = 2;} + if ($lead_order[$i] eq "DOWN COUNT 3rd NEW") {$NEW_count = 3;} + if ($lead_order[$i] eq "DOWN COUNT 4th NEW") {$NEW_count = 4;} + if ($lead_order[$i] eq "DOWN COUNT 5th NEW") {$NEW_count = 5;} + if ($lead_order[$i] eq "DOWN COUNT 6th NEW") {$NEW_count = 6;} + + ### BEGIN recycle grab leads ### + $REC_rec_countLEADS=0; + @REC_leads_to_hopper=@MT; + @REC_lists_to_hopper=@MT; + @REC_phone_to_hopper=@MT; + if ($rec_ct[$i] > 0) + { + if ($DB) {print " looking for RECYCLE leads, maximum of 100\n";} + + $stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state FROM vicidial_list where $recycle_SQL[$i] and list_id IN($camp_lists[$i]) and lead_id NOT IN($lead_id_lists) and ($all_gmtSQL[$i]) $lead_filter_sql[$i] limit 100;"; + if ($DBX) {print " |$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($DB) {print " RECYCLE leads to call count: $sthArows\n";} + if ($DBX) {print " |$stmtA|\n";} + while ($sthArows > $REC_rec_countLEADS) + { + @aryA = $sthA->fetchrow_array; + $REC_leads_to_hopper[$REC_rec_countLEADS] = "$aryA[0]"; + $REC_lists_to_hopper[$REC_rec_countLEADS] = "$aryA[1]"; + $REC_gmt_to_hopper[$REC_rec_countLEADS] = "$aryA[2]"; + $REC_phone_to_hopper[$REC_rec_countLEADS] = "$aryA[3]"; + $REC_state_to_hopper[$REC_rec_countLEADS] = "$aryA[4]"; + if ($DB_show_offset) {print "LEAD_ADD: $aryA[2] $aryA[3] $aryA[4]\n";} + $REC_rec_countLEADS++; + } + $sthA->finish(); + } + else + { + if ($DB) {print " NO RECYCLE-LEADS INTO HOPPER DEFINED\n";} + } + ### END recycle grab leads ### + + + ### BEGIN NEW grab leads ### + $NEW_rec_countLEADS=0; + @NEW_leads_to_hopper=@MT; + @NEW_lists_to_hopper=@MT; + @NEW_phone_to_hopper=@MT; + if ($NEW_count > 0) + { + $NEW_level = int($hopper_level[$i] / $NEW_count); + $OTHER_level = ($hopper_level[$i] - $NEW_level); + $order_stmt = 'order by called_count, lead_id asc'; + if ($DB) {print " looking for $NEW_level NEW leads mixed in with $OTHER_level other leads\n";} + + $stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state FROM vicidial_list where called_since_last_reset='N' and status IN('NEW') and list_id IN($camp_lists[$i]) and lead_id NOT IN($lead_id_lists) and ($all_gmtSQL[$i]) $lead_filter_sql[$i] $order_stmt limit $NEW_level;"; + if ($DBX) {print " |$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + while ($sthArows > $NEW_rec_countLEADS) + { + @aryA = $sthA->fetchrow_array; + $NEW_leads_to_hopper[$NEW_rec_countLEADS] = "$aryA[0]"; + $NEW_lists_to_hopper[$NEW_rec_countLEADS] = "$aryA[1]"; + $NEW_gmt_to_hopper[$NEW_rec_countLEADS] = "$aryA[2]"; + $NEW_phone_to_hopper[$NEW_rec_countLEADS] = "$aryA[3]"; + $NEW_state_to_hopper[$NEW_rec_countLEADS] = "$aryA[4]"; + if ($DB_show_offset) {print "LEAD_ADD: $aryA[2] $aryA[3] $aryA[4]\n";} + $NEW_rec_countLEADS++; + } + $OTHER_level = ($hopper_level[$i] - $NEW_rec_countLEADS); + $sthA->finish(); + } + + ### BEGIN standard grab leads ### + $rec_countLEADS=0; + $NEW_dec=99; + $NEW_in=0; + $rec_count=0; + $REC_insert_count=0; + @leads_to_hopper=@MT; + @lists_to_hopper=@MT; + @gmt_to_hopper=@MT; + @state_to_hopper=@MT; + @phone_to_hopper=@MT; + if ($campaign_leads_to_call[$i] > 0) + { + if ($DB) {print " lead call order: $order_stmt\n";} + $stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state FROM vicidial_list where called_since_last_reset='N' and status IN($STATUSsql[$i]) and list_id IN($camp_lists[$i]) and lead_id NOT IN($lead_id_lists) and ($all_gmtSQL[$i]) $lead_filter_sql[$i] $order_stmt limit $OTHER_level;"; + if ($DBX) {print " |$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + if ( ($NEW_count > 0) && ($NEW_rec_countLEADS > $NEW_in) ) + { + if ($DB_show_offset) {print "NEW_COUNT: $NEW_count|$NEW_dec|$NEW_in|$NEW_rec_countLEADS\n";} + if ($NEW_count > $NEW_dec) + { + $NEW_dec++; + } + else + { + $leads_to_hopper[$rec_countLEADS] = "$NEW_leads_to_hopper[$NEW_in]"; + $lists_to_hopper[$rec_countLEADS] = "$NEW_lists_to_hopper[$NEW_in]"; + $gmt_to_hopper[$rec_countLEADS] = "$NEW_gmt_to_hopper[$NEW_in]"; + $state_to_hopper[$rec_countLEADS] = "$NEW_state_to_hopper[$NEW_in]"; + $phone_to_hopper[$rec_countLEADS] = "$NEW_phone_to_hopper[$NEW_in]"; + if ($DB_show_offset) {print "LEAD_ADD: $NEW_leads_to_hopper[$NEW_in] $NEW_phone_to_hopper[$NEW_in]\n";} + $rec_countLEADS++; + $NEW_in++; + $NEW_dec=2; + } + } + if ($REC_rec_countLEADS > $REC_insert_count) + { + $leads_to_hopper[$rec_countLEADS] = "$REC_leads_to_hopper[$REC_insert_count]"; + $lists_to_hopper[$rec_countLEADS] = "$REC_lists_to_hopper[$REC_insert_count]"; + $gmt_to_hopper[$rec_countLEADS] = "$REC_gmt_to_hopper[$REC_insert_count]"; + $state_to_hopper[$rec_countLEADS] = "$REC_state_to_hopper[$REC_insert_count]"; + $phone_to_hopper[$rec_countLEADS] = "$REC_phone_to_hopper[$REC_insert_count]"; + $rec_countLEADS++; + $REC_insert_count++; + } + $leads_to_hopper[$rec_countLEADS] = "$aryA[0]"; + $lists_to_hopper[$rec_countLEADS] = "$aryA[1]"; + $gmt_to_hopper[$rec_countLEADS] = "$aryA[2]"; + $state_to_hopper[$rec_countLEADS] = "$aryA[4]"; + $phone_to_hopper[$rec_countLEADS] = "$aryA[3]"; + if ($DB_show_offset) {print "LEAD_ADD: $aryA[2] $aryA[3] $aryA[4]\n";} + $rec_countLEADS++; + $rec_count++; + } + $sthA->finish(); + } + ### finish inserting any recycled leads if any + while ($REC_rec_countLEADS > $REC_insert_count) + { + $leads_to_hopper[$rec_countLEADS] = "$REC_leads_to_hopper[$REC_insert_count]"; + $lists_to_hopper[$rec_countLEADS] = "$REC_lists_to_hopper[$REC_insert_count]"; + $gmt_to_hopper[$rec_countLEADS] = "$REC_gmt_to_hopper[$REC_insert_count]"; + $state_to_hopper[$rec_countLEADS] = "$REC_state_to_hopper[$REC_insert_count]"; + $phone_to_hopper[$rec_countLEADS] = "$REC_phone_to_hopper[$REC_insert_count]"; + $rec_countLEADS++; + $REC_insert_count++; + } + + if ($DB) {print " Adding to hopper: $rec_countLEADS\n";} + $event_string = "|$campaign_id[$i]|Added to hopper $rec_countLEADS|"; + &event_logger; + + $h=0; + foreach(@leads_to_hopper) + { + if ($leads_to_hopper[$h] != '0') + { + $DNClead=0; + if ($use_internal_dnc[$i] =~ /Y/) + { + if ($DB) {print " Doing DNC Check: $phone_to_hopper[$h] - $use_internal_dnc[$i]\n";} + $stmtA = "SELECT count(*) from vicidial_dnc where phone_number='$phone_to_hopper[$h]';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DNClead = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + if ($DNClead != '0') + { + $stmtA = "UPDATE vicidial_list SET status='DNCL' where lead_id='$leads_to_hopper[$h]';"; + $affected_rows = $dbhA->do($stmtA); + if ($DBX) {print "Flagging DNC lead: $affected_rows $phone_to_hopper[$h]\n";} + } + } + if ($DNClead == '0') + { + $stmtA = "INSERT INTO $vicidial_hopper (lead_id,campaign_id,status,user,list_id,gmt_offset_now,state,priority) values('$leads_to_hopper[$h]','$campaign_id[$i]','READY','','$lists_to_hopper[$h]','$gmt_to_hopper[$h]','$state_to_hopper[$h]','0');"; + $affected_rows = $dbhA->do($stmtA); + if ($DBX) {print "LEAD INSERTED: $affected_rows|$leads_to_hopper[$h]|\n";} + } + } + $h++; + } + if ($DB) {print " DONE with this campaign\n";} + + } + } + + + $i++; + } + + +$dbhA->disconnect(); + +if($DB) +{ +### calculate time to run script ### +$secY = time(); +$secZ = ($secY - $secT); + +if (!$q) {print "DONE. Script execution time in seconds: $secZ\n";} +} + +exit; + + + +sub event_logger +{ +if ($SYSLOG) + { + ### open the log file for writing ### + open(Lout, ">>$VDHLOGfile") + || die "Can't open $VDHLOGfile: $!\n"; + print Lout "$now_date|$event_string|\n"; + close(Lout); + } +$event_string=''; +} + diff --git a/agc_2-X/branches/agc_2.0.4/bin/AST_VDhopper_MIXtest.pl b/agc_2-X/branches/agc_2.0.4/bin/AST_VDhopper_MIXtest.pl new file mode 100644 index 00000000..75bb1a6d --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/AST_VDhopper_MIXtest.pl @@ -0,0 +1,1430 @@ +#!/usr/bin/perl +# +# AST_VDhopper.pl version 2.0.4 *TEST List Mix version* +# +# DESCRIPTION: +# uses DBD::MySQL to update the VICIDIAL leads hopper for the streamlined +# approach of allocating leads to client machines. +# +# SUMMARY: +# This program was designed for people using the Asterisk PBX with VICIDIAL +# +# For the client to use VICIDIAL, this program must be in the cron running +# every minute +# +# For this program to work you need to have the "asterisk" MySQL database +# created and create the tables listed in the CONF_MySQL.txt file, also make sure +# that the machine running this program has read/write/update/delete access +# to that database +# +# It is recommended that you run this program on the local Asterisk machine +# +# If this script is run ever minute and you are getting close to no leads after +# a minute, you may want to play with the variables below to streamline for +# your usage +# +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# +# CHANGELOG +# 50810-1613 - Added database server variable definitions lookup +# 60215-1106 - Added Scheduled Callback release functionality +# 60228-1623 - Change Callback activation to set the called_since_last_reset=N +# 60228-1735 - Added hopper gmt validation to remove gmt outside of time range +# 60320-0932 - Added inactive lead list hopper deletion (Thanks Vic Jolin) +# 60322-1030 - Added super debug output +# 60418-0947 - Added lead filter per campaign +# 60509-1416 - Rewrite of local_call_time functions +# 60511-1150 - Added inserts into vicidial_campaign_stats table +# 60609-1451 - Added ability to filter by DNC list vicidial_dnc +# 60614-1159 - Added campaign lead recycling ability +# 60715-2251 - Changed to use /etc/astguiclient.conf for configs +# 60801-1634 - Fixed Callback activation bug 000008 +# 60814-1720 - Added option for no logging to file +# 60822-1527 - Added campaign_stats and logging options for adaptive dialing +# 60925-1330 - Fixed recycling leads issues +# 61110-1513 - Changed Xth NEW to fill to hopper_level with standard if not enough NEW +# 70219-1247 - Changed to use dial_statuses field instead of dial_status_x fields +# 70708-1218 - Start of List-Mix-aware version of the hopper script +# 70709-2033 - Functional Beta of List-Mix-aware version of the hopper script +# 71029-1929 - Added 5th and 6th NEW to list order +# 71030-2043 - Added hopper priority for callbacks +# + +# constants +$DB=0; # Debug flag, set to 0 for no debug messages, On an active system this will generate lots of lines of output per minute +$US='__'; +$MT[0]=''; +#$vicidial_hopper='TEST_vicidial_hopper'; # for testing +$vicidial_hopper='vicidial_hopper'; + +# options +$insert_auto_CB_to_hopper = 1; # set to 1 to automatically insert ANYONE callbacks into the hopper + + +$secT = time(); +$secX = time(); +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} +$file_date = "$year-$mon-$mday"; +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$VDL_date = "$year-$mon-$mday 00:00:01"; + +### get date-time of one hour ago ### + $VDL_hour = ($secX - (60 * 60)); +($Vsec,$Vmin,$Vhour,$Vmday,$Vmon,$Vyear,$Vwday,$Vyday,$Visdst) = localtime($VDL_hour); +$Vyear = ($Vyear + 1900); +$Vmon++; +if ($Vmon < 10) {$Vmon = "0$Vmon";} +if ($Vmday < 10) {$Vmday = "0$Vmday";} +$VDL_hour = "$Vyear-$Vmon-$Vmday $Vhour:$Vmin:$Vsec"; + +### get date-time of half hour ago ### + $VDL_halfhour = ($secX - (30 * 60)); +($Vsec,$Vmin,$Vhour,$Vmday,$Vmon,$Vyear,$Vwday,$Vyday,$Visdst) = localtime($VDL_halfhour); +$Vyear = ($Vyear + 1900); +$Vmon++; +if ($Vmon < 10) {$Vmon = "0$Vmon";} +if ($Vmday < 10) {$Vmday = "0$Vmday";} +$VDL_halfhour = "$Vyear-$Vmon-$Vmday $Vhour:$Vmin:$Vsec"; + +### get date-time of five minutes ago ### + $VDL_five = ($secX - (5 * 60)); +($Vsec,$Vmin,$Vhour,$Vmday,$Vmon,$Vyear,$Vwday,$Vyday,$Visdst) = localtime($VDL_five); +$Vyear = ($Vyear + 1900); +$Vmon++; +if ($Vmon < 10) {$Vmon = "0$Vmon";} +if ($Vmday < 10) {$Vmday = "0$Vmday";} +$VDL_five = "$Vyear-$Vmon-$Vmday $Vhour:$Vmin:$Vsec"; + +### get date-time of one minute ago ### + $VDL_one = ($secX - (1 * 60)); +($Vsec,$Vmin,$Vhour,$Vmday,$Vmon,$Vyear,$Vwday,$Vyday,$Visdst) = localtime($VDL_one); +$Vyear = ($Vyear + 1900); +$Vmon++; +if ($Vmon < 10) {$Vmon = "0$Vmon";} +if ($Vmday < 10) {$Vmday = "0$Vmday";} +$VDL_one = "$Vyear-$Vmon-$Vmday $Vhour:$Vmin:$Vsec"; + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options(must stay in this order):\n [--debug] = debug\n [--debugX] = super debug\n [--dbgmt] = show GMT offset of records as they are inserted into hopper\n [-t] = test\n [--level=XXX] = force a hopper_level of XXX\n [--campaign=XXX] = run for campaign XXX only\n\n"; + exit; + } + else + { + if ($args =~ /--campaign=/i) + { + # print "\n|$ARGS|\n\n"; + @data_in = split(/--campaign=/,$args); + $CLIcampaign = $data_in[1]; + $CLIcampaign =~ s/ .*$//gi; + } + else + {$CLIcampaign = '';} + if ($args =~ /--level=/i) + { + @data_in = split(/--level=/,$args); + $CLIlevel = $data_in[1]; + $CLIlevel =~ s/ .*$//gi; + $CLIlevel =~ s/\D//gi; + print "\n-----HOPPER LEVEL OVERRIDE: $CLIlevel -----\n\n"; + } + else + {$CLIlevel = '';} + if ($args =~ /--debug/i) + { + $DB=1; + print "\n----- DEBUG -----\n\n"; + } + if ($args =~ /--debugX/i) + { + $DBX=1; + print "\n----- SUPER DEBUG -----\n\n"; + } + if ($args =~ /--dbgmt/i) + { + $DB_show_offset=1; + print "\n-----DEBUG GMT -----\n\n"; + } + if ($args =~ /-t/i) + { + $T=1; $TEST=1; + print "\n-----TESTING -----\n\n"; + } + if ($args =~ /--wipe-hopper-clean/i) + { + $wipe_hopper_clean=1; + } + } +} +else +{ +print "no command line options set\n"; +} + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +if (!$VDHLOGfile) {$VDHLOGfile = "$PATHlogs/hopper.$year-$mon-$mday";} +if (!$VARDB_port) {$VARDB_port='3306';} + +use DBI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + +### Grab Server values from the database + $stmtA = "SELECT vd_server_logs,local_gmt FROM servers where server_ip = '$VARserver_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBvd_server_logs = "$aryA[0]"; + $DBSERVER_GMT = "$aryA[1]"; + if ($DBvd_server_logs =~ /Y/) {$SYSLOG = '1';} + else {$SYSLOG = '0';} + if (length($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;} + $rec_count++; + } + $sthA->finish(); + + + +$secX = time(); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($secX); + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + if ($isdst) {$LOCAL_GMT_OFF++;} + +$GMT_now = ($secX - ($LOCAL_GMT_OFF * 3600)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($GMT_now); + $mon++; + $year = ($year + 1900); + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + if ($DB) {print "TIME DEBUG: $LOCAL_GMT_OFF_STD|$LOCAL_GMT_OFF|$isdst| GMT: $hour:$min\n";} + +if ($wipe_hopper_clean) + { + $stmtA = "DELETE from $vicidial_hopper;"; + $affected_rows = $dbhA->do($stmtA); + if ($DB) {print "Hopper Wiped Clean: $affected_rows\n";} + $event_string = "|HOPPER WIPE CLEAN|"; + &event_logger; + + exit; + } +### Delete leads from inactive lists if there are any +$stmtA = "SELECT * FROM vicidial_lists where active='N';"; +if ($DB) {print $stmtA;} +$inactive_lists=''; +$inactive_lists_count=0; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +while ($sthArows > $inactive_lists_count) + { + @aryA = $sthA->fetchrow_array; + $inactive_list = $aryA[0]; + $inactive_lists .= "'$inactive_list',"; + $inactive_lists_count++; + } +$sthA->finish(); +if ($DB) {print "Inactive Lists: $inactive_lists_count\n";} + +if ($inactive_lists_count > 0) + { + chop($inactive_lists); + $stmtA = "DELETE from $vicidial_hopper where list_id IN($inactive_lists);"; + $affected_rows = $dbhA->do($stmtA); + if ($DB) {print "Inactive List Leads Deleted: $affected_rows |$stmtA|\n";} + $event_string = "|INACTIVE LIST DEL|$affected_rows|"; + &event_logger; + } + +### BEGIN Change CBHOLD status leads to CALLBK if their vicidial_callbacks time has passed +$stmtA = "SELECT count(*) FROM vicidial_callbacks where callback_time <= '$now_date' and status='ACTIVE';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +@aryA = $sthA->fetchrow_array; +$CBHOLD_count = $aryA[0]; + if ($DB) {print "CALLBACK HOLD: $CBHOLD_count|$stmtA|\n";} +$sthA->finish(); + +if ($CBHOLD_count > 0) + { + $update_leads=''; + $cbc=0; + $cba=0; + $stmtA = "SELECT vicidial_callbacks.lead_id,recipient,campaign_id,vicidial_callbacks.list_id,gmt_offset_now,state FROM vicidial_callbacks,vicidial_list where callback_time <= '$now_date' and vicidial_callbacks.status='ACTIVE' and vicidial_callbacks.lead_id=vicidial_list.lead_id;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + while ($sthArows > $cbc) + { + @aryA = $sthA->fetchrow_array; + $lead_ids[$cbc] = $aryA[0]; + $recipient = $aryA[1]; + $update_leads .= "'$lead_ids[$cbc]',"; + if ($recipient =~ /ANYONE/) + { + $CA_lead_id[$cba] = $aryA[0]; + $CA_campaign_id[$cba] = $aryA[2]; + $CA_list_id[$cba] = $aryA[3]; + $CA_gmt_offset_now[$cba] = $aryA[4]; + $CA_state[$cba] = $aryA[5]; + $cba++; + } + $cbc++; + } + $sthA->finish(); + if ($cbc > 0) + { + chop($update_leads); + + $stmtA = "UPDATE vicidial_callbacks set status='LIVE' where lead_id IN($update_leads) and status NOT IN('INACTIVE','DEAD','ARCHIVE');"; + $affected_rows = $dbhA->do($stmtA); + if ($DB) {print "Scheduled Callbacks Activated: $affected_rows\n";} + $event_string = "|CALLBACKS CB ACT |$affected_rows|"; + &event_logger; + + } + ### INSERT ANYONE CALLBACKS INTO HOPPER DIRECTLY ### + if ( ($cba > 0) && ($insert_auto_CB_to_hopper) ) + { + if ($DB) {print "ANYONE Scheduled Callbacks to Insert into hopper: $cba\n";} + $event_string = "|ANYONE CB HOPPER |$cba|"; + &event_logger; + $CAu=0; + foreach(@CA_lead_id) + { + $stmtA = "UPDATE vicidial_list set status='CALLBK', called_since_last_reset='N' where lead_id='$CA_lead_id[$CAu]';"; + $affected_rows = $dbhA->do($stmtA); + if ($DB) {print "Scheduled Callbacks Activated: $affected_rows\n";} + $event_string = "|CALLBACKS LISTACT|$affected_rows|"; + &event_logger; + + $stmtA = "INSERT INTO $vicidial_hopper SET lead_id='$CA_lead_id[$CAu]',campaign_id='$CA_campaign_id[$CAu]',list_id='$CA_list_id[$CAu]',gmt_offset_now='$CA_gmt_offset_now[$CAu]',user='',state='$CA_state[$CAu]',priority='50';"; + $affected_rows = $dbhA->do($stmtA); + if ($DB) {print "ANYONE Scheduled Callback Inserted into hopper: $affected_rows|$CA_lead_id[$CAu]\n";} + $CAu++; + } + } + } +### END Change CBHOLD status leads to CALLBK if their vicidial_callbacks time has passed + + +@campaign_id=@MT; + +if ($CLIcampaign) + { + $stmtA = "SELECT * from vicidial_campaigns where campaign_id='$CLIcampaign'"; + } +else + { + $stmtA = "SELECT * from vicidial_campaigns where active='Y'"; + } +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $campaign_id[$rec_count] = "$aryA[0]"; + $lead_order[$rec_count] = "$aryA[8]"; + if (!$CLIlevel) + {$hopper_level[$rec_count] = "$aryA[13]";} + else + {$hopper_level[$rec_count] = "$CLIlevel";} + $auto_dial_level[$rec_count] = "$aryA[14]"; + $local_call_time[$rec_count] = "$aryA[16]"; + $lead_filter_id[$rec_count] = "$aryA[35]"; + $use_internal_dnc[$rec_count] = "$aryA[43]"; + $dial_method[$rec_count] = $aryA[46]; + $available_only_ratio_tally[$rec_count] = $aryA[47]; + $adaptive_dropped_percentage[$rec_count] = $aryA[48]; + $adaptive_maximum_level[$rec_count] = $aryA[49]; + $dial_statuses[$rec_count] = $aryA[61]; + $list_order_mix[$rec_count] = $aryA[64]; + + $rec_count++; + } +$sthA->finish(); +if ($DB) {print "CAMPAIGNS TO PROCESSES HOPPER FOR: $rec_count|$#campaign_id\n";} + + +##### LOOP THROUGH EACH CAMPAIGN AND PROCESS THE HOPPER ##### +$i=0; +foreach(@campaign_id) + { + $vicidial_log = 'vicidial_log'; + $VCSdialable_leads[$i]=0; + + if ($list_order_mix[$i] =~ /DISABLED/) + { + ### BEGIN - GATHER STATS FOR THE vicidial_campaign_stats TABLE ### + $dial_statuses[$i] =~ s/ -$//gi; + @Dstatuses = split(/ /,$dial_statuses[$i]); + $Ds_to_print = (($#Dstatuses) + 0); + $STATUSsql[$i]=''; + $o=0; + while ($Ds_to_print > $o) + { + $o++; + $STATUSsql[$i] .= "'$Dstatuses[$o]',"; + } + chop($STATUSsql[$i]); + } + + $stmtA = "SELECT dialable_leads from vicidial_campaign_stats where campaign_id='$campaign_id[$i]';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VCSdialable_leads[$i] = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + ### END - GATHER STATS FOR THE vicidial_campaign_stats TABLE ### + + ##### BEGIN calculate what gmt_offset_now values are within the allowed local_call_time setting ### + $g=0; + $p='13'; + $GMT_gmt[0] = ''; + $GMT_hour[0] = ''; + $GMT_day[0] = ''; + if ($DBX) {print "\n |GMT-DAY-HOUR| ";} + while ($p > -13) + { + $pzone = ($GMT_now + ($p * 3600)); + ($psec,$pmin,$phour,$pmday,$pmon,$pyear,$pday,$pyday,$pisdst) = localtime($pzone); + $phour=($phour * 100); + $tz = sprintf("%.2f", $p); + $GMT_gmt[$g] = "$tz"; + $GMT_day[$g] = "$pday"; + $GMT_hour[$g] = ($phour + $pmin); + $p = ($p - 0.25); + if ($DBX) {print "|$GMT_gmt[$g]-$GMT_day[$g]-$GMT_hour[$g]|";} + $g++; + } + if ($DBX) {print "\n";} + + $stmtA = "SELECT * FROM vicidial_call_times where call_time_id='$local_call_time[$i]';"; + if ($DBX) {print " |$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $Gct_default_start = "$aryA[3]"; + $Gct_default_stop = "$aryA[4]"; + $Gct_sunday_start = "$aryA[5]"; + $Gct_sunday_stop = "$aryA[6]"; + $Gct_monday_start = "$aryA[7]"; + $Gct_monday_stop = "$aryA[8]"; + $Gct_tuesday_start = "$aryA[9]"; + $Gct_tuesday_stop = "$aryA[10]"; + $Gct_wednesday_start = "$aryA[11]"; + $Gct_wednesday_stop = "$aryA[12]"; + $Gct_thursday_start = "$aryA[13]"; + $Gct_thursday_stop = "$aryA[14]"; + $Gct_friday_start = "$aryA[15]"; + $Gct_friday_stop = "$aryA[16]"; + $Gct_saturday_start = "$aryA[17]"; + $Gct_saturday_stop = "$aryA[18]"; + $Gct_state_call_times = "$aryA[19]"; + $rec_count++; + } + $sthA->finish(); + + $ct_states = ''; + $ct_state_gmt_SQL = ''; + $del_state_gmt_SQL = ''; + $ct_srs=0; + $b=0; + if (length($Gct_state_call_times)>2) + { + @state_rules = split(/\|/,$Gct_state_call_times); + $ct_srs = ($#state_rules - 2); + } + while($ct_srs >= $b) + { + if (length($state_rules[$b])>1) + { + $stmtA = "SELECT * from vicidial_state_call_times where state_call_time_id='$state_rules[$b]';"; + if ($DBX) {print " |$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $Gstate_call_time_id = "$aryA[0]"; + $Gstate_call_time_state = "$aryA[1]"; + $Gsct_default_start = "$aryA[4]"; + $Gsct_default_stop = "$aryA[5]"; + $Gsct_sunday_start = "$aryA[6]"; + $Gsct_sunday_stop = "$aryA[7]"; + $Gsct_monday_start = "$aryA[8]"; + $Gsct_monday_stop = "$aryA[9]"; + $Gsct_tuesday_start = "$aryA[10]"; + $Gsct_tuesday_stop = "$aryA[11]"; + $Gsct_wednesday_start = "$aryA[12]"; + $Gsct_wednesday_stop = "$aryA[13]"; + $Gsct_thursday_start = "$aryA[14]"; + $Gsct_thursday_stop = "$aryA[15]"; + $Gsct_friday_start = "$aryA[16]"; + $Gsct_friday_stop = "$aryA[17]"; + $Gsct_saturday_start = "$aryA[18]"; + $Gsct_saturday_stop = "$aryA[19]"; + $ct_states .="'$Gstate_call_time_state',"; + $rec_count++; + } + $sthA->finish(); + + $r=0; + $state_gmt=''; + $del_state_gmt=''; + while($r < $g) + { + if ($GMT_day[$r]==0) #### Sunday local time + { + if (($Gsct_sunday_start==0) and ($Gsct_sunday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + else + {$del_state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_sunday_start) and ($GMT_hour[$r]<$Gsct_sunday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + else + {$del_state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==1) #### Monday local time + { + if (($Gsct_monday_start==0) and ($Gsct_monday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + else + {$del_state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_monday_start) and ($GMT_hour[$r]<$Gsct_monday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + else + {$del_state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==2) #### Tuesday local time + { + if (($Gsct_tuesday_start==0) and ($Gsct_tuesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + else + {$del_state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_tuesday_start) and ($GMT_hour[$r]<$Gsct_tuesday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + else + {$del_state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==3) #### Wednesday local time + { + if (($Gsct_wednesday_start==0) and ($Gsct_wednesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + else + {$del_state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_wednesday_start) and ($GMT_hour[$r]<$Gsct_wednesday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + else + {$del_state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==4) #### Thursday local time + { + if (($Gsct_thursday_start==0) and ($Gsct_thursday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + else + {$del_state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_thursday_start) and ($GMT_hour[$r]<$Gsct_thursday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + else + {$del_state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==5) #### Friday local time + { + if (($Gsct_friday_start==0) and ($Gsct_friday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + else + {$del_state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_friday_start) and ($GMT_hour[$r]<$Gsct_friday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + else + {$del_state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==6) #### Saturday local time + { + if (($Gsct_saturday_start==0) and ($Gsct_saturday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + else + {$del_state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_saturday_start) and ($GMT_hour[$r]<$Gsct_saturday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + else + {$del_state_gmt.="'$GMT_gmt[$r]',";} + } + } + $r++; + } + $state_gmt = "$state_gmt'99'"; + $del_state_gmt = "$del_state_gmt'99'"; + $ct_state_gmt_SQL .= "or (state='$Gstate_call_time_state' and gmt_offset_now IN($state_gmt)) "; + $del_state_gmt_SQL .= "or (state='$Gstate_call_time_state' and gmt_offset_now IN($del_state_gmt)) "; + } + + $b++; + } + if (length($ct_states)>2) + { + $ct_states =~ s/,$//gi; + $ct_statesSQL = "and state NOT IN($ct_states)"; + } + else + { + $ct_statesSQL = ""; + } + + $r=0; + $default_gmt=''; + $del_default_gmt=''; + while($r < $g) + { + if ($GMT_day[$r]==0) #### Sunday local time + { + if (($Gct_sunday_start==0) and ($Gct_sunday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + else + {$del_default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_sunday_start) and ($GMT_hour[$r]<$Gct_sunday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + else + {$del_default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==1) #### Monday local time + { + if (($Gct_monday_start==0) and ($Gct_monday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + else + {$del_default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_monday_start) and ($GMT_hour[$r]<$Gct_monday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + else + {$del_default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==2) #### Tuesday local time + { + if (($Gct_tuesday_start==0) and ($Gct_tuesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + else + {$del_default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_tuesday_start) and ($GMT_hour[$r]<$Gct_tuesday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + else + {$del_default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==3) #### Wednesday local time + { + if (($Gct_wednesday_start==0) and ($Gct_wednesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + else + {$del_default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_wednesday_start) and ($GMT_hour[$r]<$Gct_wednesday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + else + {$del_default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==4) #### Thursday local time + { + if (($Gct_thursday_start==0) and ($Gct_thursday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + else + {$del_default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_thursday_start) and ($GMT_hour[$r]<$Gct_thursday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + else + {$del_default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==5) #### Friday local time + { + if (($Gct_friday_start==0) and ($Gct_friday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + else + {$del_default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_friday_start) and ($GMT_hour[$r]<$Gct_friday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + else + {$del_default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==6) #### Saturday local time + { + if (($Gct_saturday_start==0) and ($Gct_saturday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + else + {$del_default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_saturday_start) and ($GMT_hour[$r]<$Gct_saturday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + else + {$del_default_gmt.="'$GMT_gmt[$r]',";} + } + } + $r++; + } + + $default_gmt = "$default_gmt'99'"; + $del_default_gmt = "$del_default_gmt'99'"; + $all_gmtSQL[$i] = "(gmt_offset_now IN($default_gmt) $ct_statesSQL) $ct_state_gmt_SQL"; + $del_gmtSQL[$i] = "(gmt_offset_now IN($del_default_gmt) $ct_statesSQL) $del_state_gmt_SQL"; + + ##### END calculate what gmt_offset_now values are within the allowed local_call_time setting ### + + ##### BEGIN lead recycling parsing and prep ### + + $stmtA = "SELECT * from vicidial_lead_recycle where campaign_id='$campaign_id[$i]' and active='Y';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @recycle_status=@MT; + @recycle_delay=@MT; + @recycle_maximum=@MT; + @RSQLdate=@MT; + $r_ct=0; + $rec_ct[$i]=0; + while ($sthArows > $r_ct) + { + @aryA = $sthA->fetchrow_array; + $recycle_status[$r_ct] = "$aryA[2]"; + $recycle_delay[$r_ct] = "$aryA[3]"; + $recycle_maximum[$r_ct] = "$aryA[4]"; + $r_ct++; + $rec_ct[$i]++; + } + $sthA->finish(); + + if ($rec_ct[$i] > 0) + { + $rc=0; + $recycle_SQL[$i] = "( "; + while($rc < $rec_ct[$i]) + { + $secX = time(); + $Rtarget = ($secX - $recycle_delay[$rc]); + ($Rsec,$Rmin,$Rhour,$Rmday,$Rmon,$Ryear,$Rwday,$Ryday,$Risdst) = localtime($Rtarget); + $Ryear = ($Ryear + 1900); + $Rmon++; + if ($Rmon < 10) {$Rmon = "0$Rmon";} + if ($Rmday < 10) {$Rmday = "0$Rmday";} + if ($Rhour < 10) {$Rhour = "0$Rhour";} + if ($Rmin < 10) {$Rmin = "0$Rmin";} + if ($Rsec < 10) {$Rsec = "0$Rsec";} + $RSQLdate[$rc] = "$Ryear-$Rmon-$Rmday $Rhour:$Rmin:$Rsec"; + $Y=1; + $recycle_Y = "'Y'"; + while ($Y < $recycle_maximum[$rc]) + { + $recycle_Y .= ",'Y$Y'"; + $Y++; + } + + if ($rc > 0) {$recycle_SQL[$i] .= " or ";} + + $recycle_SQL[$i] .= "( (called_since_last_reset IN($recycle_Y)) and (status='$recycle_status[$rc]') and (modify_date < \"$RSQLdate[$rc]\") )"; + + if ($DBX) {print "RECYCLE: |$campaign_id[$i]|$recycle_status[$rc]|$recycle_delay[$rc]|$recycle_maximum[$rc]|$RSQLdate[$rc]|\n";} + $rc++; + } + + $recycle_SQL[$i] .= " )"; + + if ($DBX) {print "RECYCLE SQL: |$recycle_SQL[$i]|\n";} + } + ##### END lead recycling parsing and prep ### + + if ($DB) {print "Starting hopper run for $campaign_id[$i] campaign- GMT: $local_call_time[$i] HOPPER: $hopper_level[$i] \n";} + + ### Delete the DONE leads if there are any + $stmtA = "DELETE from $vicidial_hopper where campaign_id='$campaign_id[$i]' and status IN('DONE');"; + $affected_rows = $dbhA->do($stmtA); + if ($DB) {print " hopper DONE cleared: $affected_rows\n";} + if ($DBX) {print " |$stmtA|\n";} + + ### Delete the leads that are out of GMT time range if there are any + $stmtA = "DELETE from $vicidial_hopper where campaign_id='$campaign_id[$i]' and ($del_gmtSQL[$i]);"; + $affected_rows = $dbhA->do($stmtA); + if ($DB) {print " hopper GMT BAD cleared: $affected_rows\n";} + if ($DBX) {print " |$stmtA|\n";} + + ### Find out how many leads are in the hopper from a specific campaign + $hopper_ready_count=0; + $stmtA = "SELECT count(*) from $vicidial_hopper where campaign_id='$campaign_id[$i]' and status='READY';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $hopper_ready_count = $aryA[0]; + if ($DB) {print " hopper READY count: $hopper_ready_count\n";} + if ($DBX) {print " |$stmtA|\n";} + $rec_count++; + } + $sthA->finish(); + $event_string = "|$campaign_id[$i]|$hopper_level[$i]|$hopper_ready_count|$local_call_time[$i]||"; + &event_logger; + + ##### IF hopper level is below set minimum, then try to add more leads ##### + if ($hopper_ready_count < $hopper_level[$i]) + { + if ($DB) {print " hopper too low ($hopper_ready_count|$hopper_level[$i]) starting hopper dump\n";} + + ### Get list of the lists in the campaign ### + $stmtA = "SELECT list_id FROM vicidial_lists where campaign_id='$campaign_id[$i]' and active='Y';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_countLISTS=0; + $camp_lists[$i] = ''; + while ($sthArows > $rec_countLISTS) + { + @aryA = $sthA->fetchrow_array; + $camp_lists[$i] .= "'$aryA[0]',"; + $rec_countLISTS++; + } + $sthA->finish(); + if (length($camp_lists[$i])<3) {$camp_lists[$i]="''";} + else {chop($camp_lists[$i]);} + + if ($DB) {print " campaign lists count: $rec_countLISTS | $camp_lists[$i]\n";} + if ($DBX) {print " |$stmtA|\n";} + + if ($list_order_mix[$i] !~ /DISABLED/) + { + $stmtA = "SELECT vcl_id,vcl_name,list_mix_container,mix_method FROM vicidial_campaigns_list_mix where campaign_id='$campaign_id[$i]' and status='ACTIVE';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $vcl_id[$i] = "$aryA[0]"; + $vcl_name[$i] = "$aryA[1]"; + $list_mix_container[$i] = "$aryA[2]"; + $mix_method[$i] = "$aryA[3]"; + $rec_count++; + } + $sthA->finish(); + + @list_mixARY=@MT; + $list_mix_dialableSQL=''; + @list_mixARY = split(/:/,$list_mix_container[$i]); + $x=0; + foreach(@list_mixARY) + { + if ($x > 0) {$list_mix_dialableSQL .= " or ";} + @list_mix_stepARY = split(/\|/,$list_mixARY[$x]); + $list_mix_stepARY[3] =~ s/ /\',\'/gi; + $list_mix_stepARY[3] =~ s/^\',|,\'-//gi; + if ($DBX) {print " LM $x ++$list_mixARY[$x]++ |$list_mix_stepARY[0]|$list_mix_stepARY[2]|$list_mix_stepARY[3]|\n";} + $list_mix_dialableSQL .= "(list_id='$list_mix_stepARY[0]' and status IN($list_mix_stepARY[3]))"; + + $x++; + } + + if ($DB) {print " campaign mix: $list_order_mix[$i] |$vcl_id[$i] - $vcl_name[$i]|$list_mix_container[$i]|$x|$mix_method[$i]|\n";} + } + + if ( ($lead_filter_id[$i] !~ /NONE/) && (length($lead_filter_id[$i])>0) ) + { + ### Get SQL of lead filter for the campaign ### + $stmtA = "SELECT lead_filter_sql FROM vicidial_lead_filters where lead_filter_id='$lead_filter_id[$i]';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $lead_filter_sql[$i] = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + $lead_filter_sql[$i] =~ s/^and|and$|^or|or$|^ and|and $|^ or|or $//gi; + $lead_filter_sql[$i] = "and $lead_filter_sql[$i]"; + if ($DB) {print " lead filter $lead_filter_id[$i] defined for $campaign_id[$i]\n";} + if ($DBX) {print " |$lead_filter_sql[$i]|\n";} + } + else + { + $lead_filter_sql[$i] = ''; + if ($DB) {print " no lead filter defined for campaign: $campaign_id[$i]\n";} + if ($DBX) {print " |$lead_filter_id[$i]|\n";} + } + + ##### Get count of leads that are dialable ##### + if ($list_order_mix[$i] =~ /DISABLED/) + { + $stmtA = "SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN($STATUSsql[$i]) and list_id IN($camp_lists[$i]) and ($all_gmtSQL[$i]) $lead_filter_sql[$i];"; + } + else + { + $stmtA = "SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and ($list_mix_dialableSQL) and ($all_gmtSQL[$i]) $lead_filter_sql[$i];"; + } + if ($DBX) {print " |$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $campaign_leads_to_call[$i] = "$aryA[0]"; + if ($DB) {print " leads to call count: $campaign_leads_to_call[$i]\n";} + if ($DBX) {print " |$stmtA|\n";} + $rec_count++; + } + $sthA->finish(); + + if ( ($lead_order[$i] =~ /DOWN COUNT 2nd NEW|DOWN COUNT 3rd NEW|DOWN COUNT 4th NEW|DOWN COUNT 5th NEW|DOWN COUNT 6th NEW/) && ($list_order_mix[$i] =~ /DISABLED/) ) + { + $stmtA = "SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN('NEW') and list_id IN($camp_lists[$i]) and ($all_gmtSQL[$i]) $lead_filter_sql[$i];"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $NEW_campaign_leads_to_call[$i] = "$aryA[0]"; + if ($DB) {print " NEW leads to call count: $NEW_campaign_leads_to_call[$i]\n";} + if ($DBX) {print " |$stmtA|\n";} + $rec_count++; + } + $sthA->finish(); + } + + ##### IF no NEW leads to be called, error out of this campaign ##### + if ( ($lead_order[$i] =~ /DOWN COUNT 2nd NEW|DOWN COUNT 3rd NEW|DOWN COUNT 4th NEW|DOWN COUNT 5th NEW|DOWN COUNT 6th NEW/) && ($NEW_campaign_leads_to_call[$i] > 0) && ($list_order_mix[$i] =~ /DISABLED/) ) {$GOOD=1;} + else + { + if ($lead_order[$i] !~ /DOWN COUNT 2nd NEW|DOWN COUNT 3rd NEW|DOWN COUNT 4th NEW|DOWN COUNT 5th NEW|DOWN COUNT 6th NEW/) + { + if ($DB) {print " NO SHUFFLE-NEW-LEADS INTO HOPPER DEFINED FOR LEAD ORDER\n";} + } + else + { + if ($DB) {print " ERROR CANNOT ADD ANY NEW LEADS TO HOPPER\n";} + } + } + + ##### IF no leads to be called, error out of this campaign ##### + if ( ($campaign_leads_to_call[$i] < 1) && ($rec_ct[$i] < 1) ) + { + if ($DB) {print " ERROR CANNOT ADD ANY LEADS TO HOPPER\n";} + if ($VCSdialable_leads[$i] > 0) + { + $stmtA = "UPDATE vicidial_campaign_stats SET dialable_leads='0' where campaign_id='$campaign_id[$i]';"; + $affected_rows = $dbhA->do($stmtA); + if ($DBX) {print "CAMPAIGN STATS: $affected_rows|$stmtA|\n";} + } + } + else + { + if ($VCSdialable_leads[$i] != $campaign_leads_to_call[$i]) + { + $stmtA = "UPDATE vicidial_campaign_stats SET dialable_leads='$campaign_leads_to_call[$i]' where campaign_id='$campaign_id[$i]';"; + $affected_rows = $dbhA->do($stmtA); + if ($DBX) {print "CAMPAIGN STATS: $affected_rows|$stmtA|\n";} + } + if ($DB) {print " Getting Leads to add to hopper\n";} + ### grab leads already in hopper so we don't duplicate + $stmtA = "SELECT lead_id FROM $vicidial_hopper where campaign_id='$campaign_id[$i]';"; + if ($DBX) {print " |$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $lead_id_lists = ''; + $rec_countLISTS=0; + while ($sthArows > $rec_countLISTS) + { + @aryA = $sthA->fetchrow_array; + $lead_id_lists .= "'$aryA[0]',"; + $rec_countLISTS++; + } + $sthA->finish(); + $lead_id_lists .= "'0'"; + $order_stmt=''; + $NEW_count = 0; + $NEW_level = 0; + $OTHER_level = $hopper_level[$i]; + if ($lead_order[$i] eq "DOWN") {$order_stmt = 'order by lead_id asc';} + if ($lead_order[$i] eq "UP") {$order_stmt = 'order by lead_id desc';} + if ($lead_order[$i] eq "UP LAST NAME") {$order_stmt = 'order by last_name desc, lead_id asc';} + if ($lead_order[$i] eq "DOWN LAST NAME") {$order_stmt = 'order by last_name, lead_id asc';} + if ($lead_order[$i] eq "UP PHONE") {$order_stmt = 'order by phone_number desc, lead_id asc';} + if ($lead_order[$i] eq "DOWN PHONE") {$order_stmt = 'order by phone_number, lead_id asc';} + if ($lead_order[$i] eq "UP COUNT") {$order_stmt = 'order by called_count desc, lead_id asc';} + if ($lead_order[$i] eq "DOWN COUNT") {$order_stmt = 'order by called_count, lead_id asc';} + if ($lead_order[$i] eq "DOWN COUNT 2nd NEW") {$NEW_count = 2;} + if ($lead_order[$i] eq "DOWN COUNT 3rd NEW") {$NEW_count = 3;} + if ($lead_order[$i] eq "DOWN COUNT 4th NEW") {$NEW_count = 4;} + if ($lead_order[$i] eq "DOWN COUNT 5th NEW") {$NEW_count = 5;} + if ($lead_order[$i] eq "DOWN COUNT 6th NEW") {$NEW_count = 6;} + + ### BEGIN recycle grab leads ### + $REC_rec_countLEADS=0; + @REC_leads_to_hopper=@MT; + @REC_lists_to_hopper=@MT; + @REC_phone_to_hopper=@MT; + if ($rec_ct[$i] > 0) + { + if ($DB) {print " looking for RECYCLE leads, maximum of 100\n";} + + $stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state FROM vicidial_list where $recycle_SQL[$i] and list_id IN($camp_lists[$i]) and lead_id NOT IN($lead_id_lists) and ($all_gmtSQL[$i]) $lead_filter_sql[$i] limit 100;"; + if ($DBX) {print " |$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($DB) {print " RECYCLE leads to call count: $sthArows\n";} + if ($DBX) {print " |$stmtA|\n";} + while ($sthArows > $REC_rec_countLEADS) + { + @aryA = $sthA->fetchrow_array; + $REC_leads_to_hopper[$REC_rec_countLEADS] = "$aryA[0]"; + $REC_lists_to_hopper[$REC_rec_countLEADS] = "$aryA[1]"; + $REC_gmt_to_hopper[$REC_rec_countLEADS] = "$aryA[2]"; + $REC_phone_to_hopper[$REC_rec_countLEADS] = "$aryA[3]"; + $REC_state_to_hopper[$REC_rec_countLEADS] = "$aryA[4]"; + if ($DB_show_offset) {print "LEAD_ADD: $aryA[2] $aryA[3] $aryA[4]\n";} + $REC_rec_countLEADS++; + } + $sthA->finish(); + } + else + { + if ($DB) {print " NO RECYCLE-LEADS INTO HOPPER DEFINED\n";} + } + ### END recycle grab leads ### + + + ### BEGIN NEW grab leads ### + $NEW_rec_countLEADS=0; + @NEW_leads_to_hopper=@MT; + @NEW_lists_to_hopper=@MT; + @NEW_phone_to_hopper=@MT; + if ( ($NEW_count > 0) && ($list_order_mix[$i] =~ /DISABLED/) ) + { + $NEW_level = int($hopper_level[$i] / $NEW_count); + $OTHER_level = ($hopper_level[$i] - $NEW_level); + $order_stmt = 'order by called_count, lead_id asc'; + if ($DB) {print " looking for $NEW_level NEW leads mixed in with $OTHER_level other leads\n";} + + $stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state FROM vicidial_list where called_since_last_reset='N' and status IN('NEW') and list_id IN($camp_lists[$i]) and lead_id NOT IN($lead_id_lists) and ($all_gmtSQL[$i]) $lead_filter_sql[$i] $order_stmt limit $NEW_level;"; + if ($DBX) {print " |$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + while ($sthArows > $NEW_rec_countLEADS) + { + @aryA = $sthA->fetchrow_array; + $NEW_leads_to_hopper[$NEW_rec_countLEADS] = "$aryA[0]"; + $NEW_lists_to_hopper[$NEW_rec_countLEADS] = "$aryA[1]"; + $NEW_gmt_to_hopper[$NEW_rec_countLEADS] = "$aryA[2]"; + $NEW_phone_to_hopper[$NEW_rec_countLEADS] = "$aryA[3]"; + $NEW_state_to_hopper[$NEW_rec_countLEADS] = "$aryA[4]"; + if ($DB_show_offset) {print "LEAD_ADD: $aryA[2] $aryA[3] $aryA[4]\n";} + $NEW_rec_countLEADS++; + } + $OTHER_level = ($hopper_level[$i] - $NEW_rec_countLEADS); + $sthA->finish(); + } + + ### BEGIN standard grab leads ### + $rec_countLEADS=0; + $NEW_dec=99; + $NEW_in=0; + $rec_count=0; + $REC_insert_count=0; + @leads_to_hopper=@MT; + @lists_to_hopper=@MT; + @gmt_to_hopper=@MT; + @state_to_hopper=@MT; + @phone_to_hopper=@MT; + if ($campaign_leads_to_call[$i] > 0) + { + if ($DB) {print " lead call order: $order_stmt\n";} + + if ($list_order_mix[$i] =~ /DISABLED/) + { + $stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state FROM vicidial_list where called_since_last_reset='N' and status IN($STATUSsql[$i]) and list_id IN($camp_lists[$i]) and lead_id NOT IN($lead_id_lists) and ($all_gmtSQL[$i]) $lead_filter_sql[$i] $order_stmt limit $OTHER_level;"; + if ($DBX) {print " |$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + if ( ($NEW_count > 0) && ($NEW_rec_countLEADS > $NEW_in) ) + { + if ($DB_show_offset) {print "NEW_COUNT: $NEW_count|$NEW_dec|$NEW_in|$NEW_rec_countLEADS\n";} + if ($NEW_count > $NEW_dec) + { + $NEW_dec++; + } + else + { + $leads_to_hopper[$rec_countLEADS] = "$NEW_leads_to_hopper[$NEW_in]"; + $lists_to_hopper[$rec_countLEADS] = "$NEW_lists_to_hopper[$NEW_in]"; + $gmt_to_hopper[$rec_countLEADS] = "$NEW_gmt_to_hopper[$NEW_in]"; + $state_to_hopper[$rec_countLEADS] = "$NEW_state_to_hopper[$NEW_in]"; + $phone_to_hopper[$rec_countLEADS] = "$NEW_phone_to_hopper[$NEW_in]"; + if ($DB_show_offset) {print "LEAD_ADD: $NEW_leads_to_hopper[$NEW_in] $NEW_phone_to_hopper[$NEW_in]\n";} + $rec_countLEADS++; + $NEW_in++; + $NEW_dec=2; + } + } + if ($REC_rec_countLEADS > $REC_insert_count) + { + $leads_to_hopper[$rec_countLEADS] = "$REC_leads_to_hopper[$REC_insert_count]"; + $lists_to_hopper[$rec_countLEADS] = "$REC_lists_to_hopper[$REC_insert_count]"; + $gmt_to_hopper[$rec_countLEADS] = "$REC_gmt_to_hopper[$REC_insert_count]"; + $state_to_hopper[$rec_countLEADS] = "$REC_state_to_hopper[$REC_insert_count]"; + $phone_to_hopper[$rec_countLEADS] = "$REC_phone_to_hopper[$REC_insert_count]"; + $rec_countLEADS++; + $REC_insert_count++; + } + $leads_to_hopper[$rec_countLEADS] = "$aryA[0]"; + $lists_to_hopper[$rec_countLEADS] = "$aryA[1]"; + $gmt_to_hopper[$rec_countLEADS] = "$aryA[2]"; + $state_to_hopper[$rec_countLEADS] = "$aryA[4]"; + $phone_to_hopper[$rec_countLEADS] = "$aryA[3]"; + if ($DB_show_offset) {print "LEAD_ADD: $aryA[2] $aryA[3] $aryA[4]\n";} + $rec_countLEADS++; + $rec_count++; + } + $sthA->finish(); + } + + ##### LIST MIX LEADS GRAB ##### + else + { + $USX='_____'; + $x=0; + $z=0; + @LM_results=@MT; + foreach(@list_mixARY) + { + $rec_count=0; + @list_mix_stepARY=@MT; + + @list_mix_stepARY = split(/\|/,$list_mixARY[$x]); + $LM_step_goal[$x] = ( ($list_mix_stepARY[2] / 100) * $hopper_level[$i]); + $LM_step_even[$x] = ( (100 / $list_mix_stepARY[2]) * 100000); + $list_mix_stepARY[3] =~ s/ /','/gi; + $list_mix_stepARY[3] =~ s/^',|,'-//gi; + if ($DBX) {print " LM $x |$list_mix_stepARY[0]|$list_mix_stepARY[2]|$LM_step_goal[$x]|$list_mix_stepARY[3]|\n";} + $list_mix_dialableSQL = "(list_id='$list_mix_stepARY[0]' and status IN($list_mix_stepARY[3]))"; + + $stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state FROM vicidial_list where called_since_last_reset='N' and $list_mix_dialableSQL and lead_id NOT IN($lead_id_lists) and ($all_gmtSQL[$i]) $lead_filter_sql[$i] $order_stmt limit $LM_step_goal[$x];"; + if ($DBX) {print " |$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + if ($mix_method[$i] =~ /RANDOM/) + { + $order = int( rand(9999999)) + 10000000; + } + else + { + if ($mix_method[$i] =~ /EVEN_MIX/) + { + $order = ( ($rec_count * $LM_step_even[$x]) + $x); + } + else + { + $order = ( ($x * 1000000) + $rec_count); + } + } + $LM_results[$z] = "$order$USX$aryA[0]$USX$aryA[1]$USX$aryA[2]$USX$aryA[3]$USX$aryA[4]"; + # if ($DBX) {print " $z|$LM_results[$z]\n";} + + $rec_count++; + $z++; + } + $sthA->finish(); + + $x++; + } + + @LM_results_SORT = sort { $a <=> $b } @LM_results; + + $w=0; + while ($z > $w) + { + @aryA = split(/_____/,$LM_results_SORT[$w]); + if ($REC_rec_countLEADS > $REC_insert_count) + { + $leads_to_hopper[$rec_countLEADS] = "$REC_leads_to_hopper[$REC_insert_count]"; + $lists_to_hopper[$rec_countLEADS] = "$REC_lists_to_hopper[$REC_insert_count]"; + $gmt_to_hopper[$rec_countLEADS] = "$REC_gmt_to_hopper[$REC_insert_count]"; + $state_to_hopper[$rec_countLEADS] = "$REC_state_to_hopper[$REC_insert_count]"; + $phone_to_hopper[$rec_countLEADS] = "$REC_phone_to_hopper[$REC_insert_count]"; + $rec_countLEADS++; + $REC_insert_count++; + } + $leads_to_hopper[$rec_countLEADS] = "$aryA[1]"; + $lists_to_hopper[$rec_countLEADS] = "$aryA[2]"; + $gmt_to_hopper[$rec_countLEADS] = "$aryA[3]"; + $state_to_hopper[$rec_countLEADS] = "$aryA[4]"; + $phone_to_hopper[$rec_countLEADS] = "$aryA[5]"; + if ($DB_show_offset) {print "LEAD_ADD: $aryA[3] $aryA[4] $aryA[5]\n";} + if ($DBX) {print " $w|$LM_results[$w]\n";} + $rec_countLEADS++; + $w++; + } + } + } + ### finish inserting any recycled leads if any + while ($REC_rec_countLEADS > $REC_insert_count) + { + $leads_to_hopper[$rec_countLEADS] = "$REC_leads_to_hopper[$REC_insert_count]"; + $lists_to_hopper[$rec_countLEADS] = "$REC_lists_to_hopper[$REC_insert_count]"; + $gmt_to_hopper[$rec_countLEADS] = "$REC_gmt_to_hopper[$REC_insert_count]"; + $state_to_hopper[$rec_countLEADS] = "$REC_state_to_hopper[$REC_insert_count]"; + $phone_to_hopper[$rec_countLEADS] = "$REC_phone_to_hopper[$REC_insert_count]"; + $rec_countLEADS++; + $REC_insert_count++; + } + + if ($DB) {print " Adding to hopper: $rec_countLEADS\n";} + $event_string = "|$campaign_id[$i]|Added to hopper $rec_countLEADS|"; + &event_logger; + + $h=0; + foreach(@leads_to_hopper) + { + if ($leads_to_hopper[$h] != '0') + { + $DNClead=0; + if ($use_internal_dnc[$i] =~ /Y/) + { + if ($DB) {print " Doing DNC Check: $phone_to_hopper[$h] - $use_internal_dnc[$i]\n";} + $stmtA = "SELECT count(*) from vicidial_dnc where phone_number='$phone_to_hopper[$h]';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DNClead = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + if ($DNClead != '0') + { + $stmtA = "UPDATE vicidial_list SET status='DNCL' where lead_id='$leads_to_hopper[$h]';"; + $affected_rows = $dbhA->do($stmtA); + if ($DBX) {print "Flagging DNC lead: $affected_rows $phone_to_hopper[$h]\n";} + } + } + if ($DNClead == '0') + { + $stmtA = "INSERT INTO $vicidial_hopper (lead_id,campaign_id,status,user,list_id,gmt_offset_now,state,priority) values('$leads_to_hopper[$h]','$campaign_id[$i]','READY','','$lists_to_hopper[$h]','$gmt_to_hopper[$h]','$state_to_hopper[$h]','0');"; + $affected_rows = $dbhA->do($stmtA); + if ($DBX) {print "LEAD INSERTED: $affected_rows|$leads_to_hopper[$h]|\n";} + } + } + $h++; + } + if ($DB) {print " DONE with this campaign\n";} + + } + } + + + $i++; + } + + +$dbhA->disconnect(); + +if($DB) +{ +### calculate time to run script ### +$secY = time(); +$secZ = ($secY - $secT); + +if (!$q) {print "DONE. Script execution time in seconds: $secZ\n";} +} + +exit; + + + +sub event_logger +{ +if ($SYSLOG) + { + ### open the log file for writing ### + open(Lout, ">>$VDHLOGfile") + || die "Can't open $VDHLOGfile: $!\n"; + print Lout "$now_date|$event_string|\n"; + close(Lout); + } +$event_string=''; +} + diff --git a/agc_2-X/branches/agc_2.0.4/bin/AST_VDremote_agents.pl b/agc_2-X/branches/agc_2.0.4/bin/AST_VDremote_agents.pl new file mode 100644 index 00000000..5c8c7da2 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/AST_VDremote_agents.pl @@ -0,0 +1,837 @@ +#!/usr/bin/perl +# +# AST_VDremote_agents.pl version 2.0.3 *DBI-version* +# +# DESCRIPTION: +# uses Net::MySQL to keep remote agents logged in to the VICIDIAL system +# +# SUMMARY: +# This program was designed for people using the Asterisk PBX with VICIDIAL +# +# For the client to use VICIDIAL with remote agents, this must always be running +# +# It is recommended that you run this program on the local Asterisk machine +# +# This script is to run perpetually querying every second to update the remote +# agents that should appear to be logged in so that the calls can be transferred +# out to them properly. +# +# It is good practice to keep this program running by placing the associated +# KEEPALIVE script running every minute to ensure this program is always running +# +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# +# CHANGELOG: +# 50215-0954 - First version of script +# 50810-1615 - Added database server variable definitions lookup +# 60807-1003 - Changed to DBI +# - Changed to use /etc/astguiclient.conf for configs +# 60814-1726 - Added option for no logging to file +# 60814-1726 - Added option for no logging to file +# 61012-1025 - Added performance testing options +# 61110-1443 - Added user_level from vicidial_user record into vicidial_live_agents +# 70213-1306 - Added queuemetrics logging +# 70214-1243 - Added queuemetrics_log_id field to queue_log logging +# 70222-1606 - Changed queue_log PAUSE/UNPAUSE to PAUSEALL/UNPAUSEALL +# 70417-1346 - Fixed bug that would add unneeded simulated agent lines +# + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-t] = test\n [-v] = verbose debug messages\n [--delay=XXX] = delay of XXX seconds per loop, default 2 seconds\n\n"; + } + else + { + if ($args =~ /--delay=/i) + { + @data_in = split(/--delay=/,$args); + $loop_delay = $data_in[1]; + print " LOOP DELAY OVERRIDE!!!!! = $loop_delay seconds\n\n"; + $loop_delay = ($loop_delay * 1000); + } + else + { + $loop_delay = '2000'; + } + if ($args =~ /--debug/i) + { + $DB=1; + print "\n-----DEBUGGING -----\n\n"; + } + if ($args =~ /--debugX/i) + { + $DBX=1; + print "\n----- SUPER-DUPER DEBUGGING -----\n\n"; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +print "no command line options set\n"; + $loop_delay = '2000'; +} +### end parsing run-time options ### + + +# constants +$US='__'; +$MT[0]=''; +$local_DEF = 'Local/'; +$conf_silent_prefix = '7'; +$local_AMP = '@'; +$agents = '@agents'; + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + + + &get_time_now; # update time/date variables + +if (!$VDRLOGfile) {$VDRLOGfile = "$PATHlogs/remoteagent.$year-$mon-$mday";} +if (!$VARDB_port) {$VARDB_port='3306';} + +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use DBI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### Grab Server values from the database + $stmtA = "SELECT vd_server_logs,local_gmt,ext_context FROM servers where server_ip = '$VARserver_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBvd_server_logs = "$aryA[0]"; + $DBSERVER_GMT = "$aryA[1]"; + $ext_context = "$aryA[2]"; + if ($DBvd_server_logs =~ /Y/) {$SYSLOG = '1';} + else {$SYSLOG = '0';} + if (length($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;} + $rec_count++; + } + $sthA->finish(); + + + &get_time_now; # update time/date variables + + $event_string='PROGRAM STARTED||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||'; + &event_logger; # writes to the log and if debug flag is set prints to STDOUT + + + $event_string='LOGGED INTO MYSQL SERVER ON 1 CONNECTION|'; + &event_logger; + +$one_day_interval = 12; # 1 month loops for one year +while($one_day_interval > 0) +{ + + $endless_loop=5760000; # 30 days minutes at XXX seconds per loop + + while($endless_loop > 0) + { + &get_time_now; + + $VDRLOGfile = "$PATHlogs/remoteagent.$year-$mon-$mday"; + + if ($endless_loop =~ /0$|5$/) + { + ### Grab Server values from the database + $stmtA = "SELECT vd_server_logs FROM servers where server_ip = '$VARserver_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBvd_server_logs = "$aryA[0]"; + if ($DBvd_server_logs =~ /Y/) {$SYSLOG = '1';} + else {$SYSLOG = '0';} + $rec_count++; + } + $sthA->finish(); + + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $enable_queuemetrics_logging = "$aryA[0]"; + $queuemetrics_server_ip = "$aryA[1]"; + $queuemetrics_dbname = "$aryA[2]"; + $queuemetrics_login = "$aryA[3]"; + $queuemetrics_pass = "$aryA[4]"; + $queuemetrics_log_id = "$aryA[5]"; + $rec_count++; + } + $sthA->finish(); + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + + + + ### delete call records that are LIVE for over 10 minutes and last_update_time < '$PDtsSQLdate' + $stmtA = "DELETE FROM vicidial_live_agents where server_ip='$server_ip' and status IN('PAUSED') and extension LIKE \"R/%\";"; + $affected_rows = $dbhA->do($stmtA); + + $event_string = "| lagged call vla agent DELETED $affected_rows"; + &event_logger; + + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE extension LIKE \"R/%\";"; + $rslt=mysql_query($stmt, $link); + if ($DB) {print "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + $stmtA = "UPDATE vicidial_live_agents set status='INCALL', last_call_time='$SQLdate',comments='REMOTE',calls_today='$calls_today' where server_ip='$server_ip' and status IN('QUEUE') and extension LIKE \"R/%\";"; + $affected_rows = $dbhA->do($stmtA); + + $event_string = "| QUEUEd call listing vla UPDATEd $affected_rows"; + &event_logger; + + #@psoutput = `/bin/ps -f --no-headers -A`; + @psoutput = `/bin/ps -o "%p %a" --no-headers -A`; + + $running_listen = 0; + + $i=0; + foreach (@psoutput) + { + chomp($psoutput[$i]); + + @psline = split(/\/usr\/bin\/perl /,$psoutput[$i]); + + if ($psline[1] =~ /AST_manager_li/) {$running_listen++;} + + $i++; + } + + if (!$running_listen) + { + $endless_loop=0; + $one_day_interval=0; + print "\nPROCESS KILLED NO LISTENER RUNNING... EXITING\n\n"; + } + + if($DB){print "checking to see if listener is dead |$running_listen|\n";} + } + + + + $user_counter=0; + $DELusers=''; + @DBuser_start=@MT; + @DBuser_level=@MT; + @DBremote_user=@MT; + @DBremote_server_ip=@MT; + @DBremote_campaign=@MT; + @DBremote_conf_exten=@MT; + @DBremote_closer=@MT; + @DBremote_random=@MT; + @loginexistsRANDOM=@MT; + @loginexistsALL=@MT; + @VD_user=@MT; + @VD_extension=@MT; + @VD_status=@MT; + @VD_uniqueid=@MT; + @VD_callerid=@MT; + @VD_random=@MT; + @autocallexists=@MT; + @calllogfinished=@MT; + ############################################################################### + ###### first grab all of the ACTIVE remote agents information from the database + ############################################################################### + $stmtA = "SELECT * FROM vicidial_remote_agents where status IN('ACTIVE') and server_ip='$server_ip' order by user_start;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $TESTrun=0; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $user_start = "$aryA[1]"; + $number_of_lines = "$aryA[2]"; + $conf_exten = "$aryA[4]"; + $campaign_id = "$aryA[6]"; + $closer_campaigns = "$aryA[7]"; + + $y=0; + while ($y < $number_of_lines) + { + $random = int( rand(9999999)) + 10000000; + $user_id = ($user_start + $y); + $DBuser_start[$user_counter] = "$user_start"; + $DBremote_user[$user_counter] = "$user_id"; + $DBremote_server_ip[$user_counter] = "$server_ip"; + $DBremote_campaign[$user_counter] = "$campaign_id"; + $DBremote_conf_exten[$user_counter] = "$conf_exten"; + if ($conf_exten =~ /999999999999/) + { + $TESTrun++; + $DBremote_conf_exten[$user_counter] = ($user_counter + 8600051); + } + $DBremote_closer[$user_counter] = "$closer_campaigns"; + $DBremote_random[$user_counter] = "$random"; + + $y++; + $user_counter++; + } + + $rec_count++; + } + $sthA->finish(); + if ($DB) {print STDERR "$user_counter live remote agents ACTIVE\n";} + + + + ############################################################################### + ###### second grab all of the INACTIVE remote agents information from the database + ############################################################################### + $stmtA = "SELECT * FROM vicidial_remote_agents where status IN('INACTIVE') and server_ip='$server_ip' order by user_start;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $Duser_start = "$aryA[1]"; + $Dnumber_of_lines = "$aryA[2]"; + $w=0; + while ($w < $Dnumber_of_lines) + { + $Duser_id = ($Duser_start + $w); + $DELusers .= "R/$Duser_id|"; + $w++; + } + $rec_count++; + } + $sthA->finish(); +# if ($DBX) {print STDERR "INACTIVE remote agents: |$DELusers|\n";} + + + + ############################################################################### + ###### third traverse array of remote agents to be active and insert or update + ###### in vicidial_live_agents table + ############################################################################### + $h=0; + foreach(@DBremote_user) + { + if (length($DBremote_user[$h])>1) + { + + ### check to see if the record exists and only needs random number update + $stmtA = "SELECT count(*) FROM vicidial_live_agents where user='$DBremote_user[$h]' and server_ip='$server_ip' and campaign_id='$DBremote_campaign[$h]' and conf_exten='$DBremote_conf_exten[$h]' and closer_campaigns='$DBremote_closer[$h]';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $loginexistsRANDOM[$h] = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + + if ($loginexistsRANDOM[$h] > 0) + { + $stmtA = "UPDATE vicidial_live_agents set random_id='$DBremote_random[$h]' where user='$DBremote_user[$h]' and server_ip='$server_ip' and campaign_id='$DBremote_campaign[$h]' and conf_exten='$DBremote_conf_exten[$h]' and closer_campaigns='$DBremote_closer[$h]';"; + $affected_rows = $dbhA->do($stmtA); + if ($DBX) {print STDERR "$DBremote_user[$h] $DBremote_campaign[$h] ONLY RANDOM ID UPDATE: $affected_rows\n";} + } + ### check if record for user on server exists at all in vicidial_live_agents + else + { + $stmtA = "SELECT count(*) FROM vicidial_live_agents where user='$DBremote_user[$h]' and server_ip='$server_ip'"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $loginexistsALL[$h] = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + + if ($loginexistsALL[$h] > 0) + { + $stmtA = "UPDATE vicidial_live_agents set random_id='$DBremote_random[$h]',campaign_id='$DBremote_campaign[$h]',conf_exten='$DBremote_conf_exten[$h]',closer_campaigns='$DBremote_closer[$h]', status='READY' where user='$DBremote_user[$h]' and server_ip='$server_ip';"; + $affected_rows = $dbhA->do($stmtA); + if ($DBX) {print STDERR "$DBremote_user[$h] ALL UPDATE: $affected_rows\n";} + # if ($affected_rows>0) + # { + # if ($enable_queuemetrics_logging > 0) + # { + # $dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass") + # or die "Couldn't connect to database: " . DBI->errstr; + + # if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} + + # $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='NONE',queue='$DBremote_campaign[$h]',agent='Agent/$DBremote_user[$h]',verb='UNPAUSE',serverid='1';"; + # $Baffected_rows = $dbhB->do($stmtB); + + # $dbhB->disconnect(); + # } + + # } + } + ### no records exist so insert a new one + else + { + # grab the user_level of the agent + $DBuser_level[$h]='1'; + $stmtA = "SELECT user_level FROM vicidial_users where user='$DBuser_start[$h]';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBuser_level[$h] = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + + $stmtA = "INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,campaign_id,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,channel,uniqueid,callerid,user_level,comments) values('$DBremote_user[$h]','$server_ip','$DBremote_conf_exten[$h]','R/$DBremote_user[$h]','READY','$DBremote_campaign[$h]','$DBremote_random[$h]','$SQLdate','$tsSQLdate','$SQLdate','$DBremote_closer[$h]','','','','$DBuser_level[$h]','REMOTE');"; + $affected_rows = $dbhA->do($stmtA); + if ($DBX) {print STDERR "$DBremote_user[$h] NEW INSERT\n";} + if ($TESTrun > 0) + { + $stmtA = "SELECT count(*) FROM live_sip_channels where extension LIKE \"%999999999999\" and server_ip='$server_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_countLSC=0; + while ($sthArows > $rec_countLSC) + { + @aryA = $sthA->fetchrow_array; + $LSC_count = "$aryA[0]"; + $rec_countLSC++; + } + $sthA->finish(); + + if ($number_of_lines > $LSC_count) + { + $SIqueryCID = "T$CIDdate$DBremote_conf_exten[$h]"; + $stmtA="INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$server_ip','','Originate','$SIqueryCID','Channel: $local_DEF$DBremote_conf_exten[$h]$local_AMP$ext_context','Context: $ext_context','Exten: 999999999999','Priority: 1','Callerid: $SIqueryCID','','','','','');"; + $affected_rows = $dbhA->do($stmtA); + if ($DBX) {print STDERR " TESTrun CALL PLACED: 999999999999 $DBremote_conf_exten[$h] $DBremote_user[$h] NEW INSERT: |$affected_rows|\n";} + } + else {print STDERR "Agent test calls already adequate $number_of_lines !> $LSC_count\n";} + } + if ($affected_rows>0) + { + if ($enable_queuemetrics_logging > 0) + { + $dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} + + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='NONE',queue='$DBremote_campaign[$h]',agent='Agent/$DBremote_user[$h]',verb='AGENTLOGIN',data1='$DBremote_user[$h]$agents',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='NONE',queue='$DBremote_campaign[$h]',agent='Agent/$DBremote_user[$h]',verb='UNPAUSE',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } + } + } + } + } + $h++; + } + + + ############################################################################### + ###### fourth validate that the calls that the vicidial_live_agents are on are not dead + ###### and if they are wipe out the values and set the agent record back to READY + ############################################################################### + $stmtA = "SELECT user,extension,status,uniqueid,callerid,lead_id,campaign_id FROM vicidial_live_agents where extension LIKE \"R/%\" and server_ip='$server_ip' and uniqueid > 10;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + $z=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $VDuser = "$aryA[0]"; + $VDextension = "$aryA[1]"; + $VDstatus = "$aryA[2]"; + $VDuniqueid = "$aryA[3]"; + $VDcallerid = "$aryA[4]"; + $VDlead_id = "$aryA[5]"; + $VDcampaign_id = "$aryA[6]"; + $VDrandom = int( rand(9999999)) + 10000000; + + $VD_user[$z] = "$VDuser"; + $VD_extension[$z] = "$VDextension"; + $VD_status[$z] = "$VDstatus"; + $VD_uniqueid[$z] = "$VDuniqueid"; + $VD_callerid[$z] = "$VDcallerid"; + $VD_lead_id[$z] = "$VDlead_id"; + $VD_campaign_id[$z] = "$VDcampaign_id"; + $VD_random[$z] = "$VDrandom"; + + $z++; + $rec_count++; + } + $sthA->finish(); + if ($DB) {print STDERR "$z remote agents on calls\n";} + + $z=0; + foreach(@VD_user) + { + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where uniqueid='$VD_uniqueid[$z]' and server_ip='$server_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $autocallexists[$z] = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + + if ($autocallexists[$z] < 1) + { + if ($DELusers =~ /R\/$VD_user[$z]\|/) + { + $stmtA = "UPDATE vicidial_live_agents set random_id='$VD_random[$z]',status='PAUSED', last_call_finish='$SQLdate',lead_id='',uniqueid='',callerid='',channel='' where user='$VD_user[$z]' and server_ip='$server_ip';"; + $affected_rows = $dbhA->do($stmtA); + if ($DB) {print STDERR "$VD_user[$z] CALL WIPE UPDATE: $affected_rows|PAUSED|$VD_uniqueid[$z]|$VD_user[$z]|\n";} + if ($affected_rows>0) + { + if ($enable_queuemetrics_logging > 0) + { + $dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} + + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='NONE',queue='NONE',agent='Agent/$VD_user[$z]',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $stmtB = "SELECT time_id FROM queue_log where agent='Agent/$VD_user[$z]' and verb='AGENTLOGIN' order by time_id desc limit 1;"; + $sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr; + $sthB->execute or die "executing: $stmtB ", $dbhB->errstr; + $sthBrows=$sthB->rows; + $rec_count=0; + while ($sthBrows > $rec_count) + { + @aryB = $sthB->fetchrow_array; + $logintime = "$aryB[0]"; + $rec_count++; + } + $sthB->finish(); + if ($DBX) {print "LOGOFF TIME LOG: $logintime|$secX|$stmtB|\n";} + + $time_logged_in = ($secX - $logintime); + if ($time_logged_in > 1000000) {$time_logged_in=1;} + + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='NONE',queue='$VD_campaign_id[$z]',agent='Agent/$VD_user[$z]',verb='AGENTLOGOFF',data1='$VD_user[$z]$agents',data2='$time_logged_in',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } + + } + } + else + { + $stmtA = "UPDATE vicidial_live_agents set random_id='$VD_random[$z]', last_call_finish='$SQLdate',lead_id='',uniqueid='',callerid='',channel='' where user='$VD_user[$z]' and server_ip='$server_ip';"; + $affected_rows = $dbhA->do($stmtA); + if ($DB) {print STDERR "$VD_user[$z] CALL WIPE UPDATE: $affected_rows|READY|$VD_uniqueid[$z]|$VD_user[$z]|\n";} + + $stmtA = "UPDATE vicidial_live_agents set status='READY' where user='$VD_user[$z]' and server_ip='$server_ip';"; + $affected_rows = $dbhA->do($stmtA); + if ($DB) {print STDERR "$VD_user[$z] CALL WIPE UPDATE: $affected_rows|READY|$VD_uniqueid[$z]|$VD_user[$z]|\n";} + if ($affected_rows>0) + { + if ($enable_queuemetrics_logging > 0) + { + $dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} + + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='NONE',queue='NONE',agent='Agent/$VD_user[$z]',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='NONE',queue='NONE',agent='Agent/$VD_user[$z]',verb='UNPAUSEALL',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } + + } + + } + } + ### possible future active call checker + # else + # { + # $stmtA = "SELECT count(*) FROM call_log where caller_code='$VD_callerid[$z]' and server_ip='$server_ip' and end_epoch > 10;"; + # $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + # $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + # $sthArows=$sthA->rows; + # $rec_count=0; + # while ($sthArows > $rec_count) + # { + # @aryA = $sthA->fetchrow_array; + # $calllogfinished[$z] = "$aryA[0]"; + # $rec_count++; + # } + # $sthA->finish(); + # if ($calllogfinished[$z] > 1) + # { + # $stmtA = "UPDATE vicidial_live_agents set random_id='$VD_random[$z]',status='READY', last_call_finish='$SQLdate',lead_id='',uniqueid='',callerid='',channel='' where user='$VD_user[$z]' and server_ip='$server_ip';"; + # $affected_rows = $dbhA->do($stmtA); + # if ($DB) {print STDERR "$VD_user[$z] AGENT READY UPDATE: $affected_rows|READY|$VD_uniqueid[$z]|$VD_callerid[$z]|$VD_user[$z]|\n";} + + # $stmtA = "DELETE from vicidial_auto_calls where callerid='$VD_callerid[$z]' and server_ip='$server_ip';"; + # $affected_rows = $dbhA->do($stmtA); + # if ($DB) {print STDERR "$VD_user[$z] VAC DELETE: $affected_rows|$VD_callerid[$z]|\n";} + # } + # } + + $z++; + } + + + + + + + ############################################################################### + ###### last, wait for a little bit and repeat the loop + ############################################################################### + + ### sleep for X seconds before beginning the loop again + usleep(1*$loop_delay*1000); + + $endless_loop--; + if($DB){print STDERR "\nloop counter: |$endless_loop|\n";} + + ### putting a blank file called "VDAD.kill" in the directory will automatically safely kill this program + if (-e "$PATHhome/VDAD.kill") + { + unlink("$PATHhome/VDAD.kill"); + $endless_loop=0; + $one_day_interval=0; + print "\nPROCESS KILLED MANUALLY... EXITING\n\n" + } + + $bad_grabber_counter=0; + + + } + + + if($DB){print "DONE... Exiting... Goodbye... See you later... Not really, initiating next loop...\n";} + + $event_string='HANGING UP|'; + &event_logger; + + $one_day_interval--; + +} + + $event_string='CLOSING DB CONNECTION|'; + &event_logger; + + +$dbhA->disconnect(); + + + if($DB){print "DONE... Exiting... Goodbye... See you later... Really I mean it this time\n";} + + +exit; + + + + + + + + + + + + + +sub get_time_now #get the current date and time and epoch for logging call lengths and datetimes +{ +$secX = time(); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($secX); + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + if ($isdst) {$LOCAL_GMT_OFF++;} + +$GMT_now = ($secX - ($LOCAL_GMT_OFF * 3600)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($GMT_now); + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + + if ($DB) {print "TIME DEBUG: $LOCAL_GMT_OFF_STD|$LOCAL_GMT_OFF|$isdst| GMT: $hour:$min\n";} + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; + $CIDdate = "$mon$mday$hour$min$sec"; + $tsSQLdate = "$year$mon$mday$hour$min$sec"; + $SQLdate = "$year-$mon-$mday $hour:$min:$sec"; + $filedate = "$year-$mon-$mday"; + +$BDtarget = ($secX - 10); +($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); +$Byear = ($Byear + 1900); +$Bmon++; +if ($Bmon < 10) {$Bmon = "0$Bmon";} +if ($Bmday < 10) {$Bmday = "0$Bmday";} +if ($Bhour < 10) {$Bhour = "0$Bhour";} +if ($Bmin < 10) {$Bmin = "0$Bmin";} +if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + +$PDtarget = ($secX - 30); +($Psec,$Pmin,$Phour,$Pmday,$Pmon,$Pyear,$Pwday,$Pyday,$Pisdst) = localtime($PDtarget); +$Pyear = ($Pyear + 1900); +$Pmon++; +if ($Pmon < 10) {$Pmon = "0$Pmon";} +if ($Pmday < 10) {$Pmday = "0$Pmday";} +if ($Phour < 10) {$Phour = "0$Phour";} +if ($Pmin < 10) {$Pmin = "0$Pmin";} +if ($Psec < 10) {$Psec = "0$Psec";} + $PDtsSQLdate = "$Pyear$Pmon$Pmday$Phour$Pmin$Psec"; + +$XDtarget = ($secX - 120); +($Xsec,$Xmin,$Xhour,$Xmday,$Xmon,$Xyear,$Xwday,$Xyday,$Xisdst) = localtime($XDtarget); +$Xyear = ($Xyear + 1900); +$Xmon++; +if ($Xmon < 10) {$Xmon = "0$Xmon";} +if ($Xmday < 10) {$Xmday = "0$Xmday";} +if ($Xhour < 10) {$Xhour = "0$Xhour";} +if ($Xmin < 10) {$Xmin = "0$Xmin";} +if ($Xsec < 10) {$Xsec = "0$Xsec";} + $XDSQLdate = "$Xyear-$Xmon-$Xmday $Xhour:$Xmin:$Xsec"; + +$TDtarget = ($secX - 600); +($Tsec,$Tmin,$Thour,$Tmday,$Tmon,$Tyear,$Twday,$Tyday,$Tisdst) = localtime($TDtarget); +$Tyear = ($Tyear + 1900); +$Tmon++; +if ($Tmon < 10) {$Tmon = "0$Tmon";} +if ($Tmday < 10) {$Tmday = "0$Tmday";} +if ($Thour < 10) {$Thour = "0$Thour";} +if ($Tmin < 10) {$Tmin = "0$Tmin";} +if ($Tsec < 10) {$Tsec = "0$Tsec";} + $TDSQLdate = "$Tyear-$Tmon-$Tmday $Thour:$Tmin:$Tsec"; + +} + + + + + +sub event_logger +{ +if ($DB) {print "$now_date|$event_string|\n";} +if ($SYSLOG) + { + ### open the log file for writing ### + open(Lout, ">>$VDRLOGfile") + || die "Can't open $VDRLOGfile: $!\n"; + print Lout "$now_date|$event_string|\n"; + close(Lout); + } +$event_string=''; +} diff --git a/agc_2-X/branches/agc_2.0.4/bin/AST_VDsales_export.pl b/agc_2-X/branches/agc_2.0.4/bin/AST_VDsales_export.pl new file mode 100644 index 00000000..4f4b1a8a --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/AST_VDsales_export.pl @@ -0,0 +1,494 @@ +#!/usr/bin/perl + +# AST_VDsales_export.pl version: 2.0.4 +# +# This script is designed to gather sales for a VICIDIAL Outbound-only campaign and +# post them to a directory +# +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# +# CHANGES +# 61219-1118 - First version +# 70503-2137 - Added upsell +# 70611-1154 - Added CLI options +# 70709-1411 - Added FTP transfer option +# 71005-0054 - Altered script to use astguiclient.conf for settings +# + +$txt = '.txt'; +$US = '_'; +$MT[0] = ''; + +# Default FTP account variables +$VARREPORT_host = '10.0.0.4'; +$VARREPORT_user = 'cron'; +$VARREPORT_pass = 'test'; +$VARREPORT_port = '21'; +$VARREPORT_dir = 'REPORTS'; + +# default CLI values +$campaign = 'TESTCAMP'; +$sale_statuses = 'SALE-UPSELL'; +$output_format = 'pipe-standard'; + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n"; + print " [--campaign=XXX] = Campaign that sales will be pulled from\n"; + print " [--sale-statuses=XXX-XXY] = Statuses that are deemed to be \"Sales\". Default SALE\n"; + print " NOTE: To include all statuses in the export, use \"--sale-statuses=---ALL---\"\n"; + print " [--output-format=XXX] = Format of file. Default \"pipe-standard\"\n"; + print " [--with-inbound=XXX-XXY] = include the following inbound groups\n"; + print " [--ftp-transfer] = Send results file by FTP to another server\n"; + print " [-q] = quiet\n"; + print " [-t] = test\n"; + print " [--debug] = debugging messages\n"; + print " [--debugX] = Super debugging messages\n"; + print "\n"; + + exit; + } + else + { + if ($args =~ /--debug/i) + { + $DB=1; + print "\n----- DEBUG MODE -----\n\n"; + } + if ($args =~ /--debugX/i) + { + $DBX=1; + print "\n----- SUPER DEBUG MODE -----\n\n"; + } + if ($args =~ /-q/i) + { + $q=1; $Q=1; + } + if ($args =~ /--campaign=/i) + { + # print "\n|$ARGS|\n\n"; + @data_in = split(/--campaign=/,$args); + $campaign = $data_in[1]; + $campaign =~ s/ .*$//gi; + } + if ($args =~ /--sale-statuses=/i) + { + @data_in = split(/--sale-statuses=/,$args); + $sale_statuses = $data_in[1]; + $sale_statuses =~ s/ .*$//gi; + if ($sale_statuses =~ /---ALL---/) + {if (!$Q) {print "\n----- EXPORT ALL STATUSES -----\n\n";} } + } + if ($args =~ /--output-format=/i) + { + @data_in = split(/--output-format=/,$args); + $output_format = $data_in[1]; + $output_format =~ s/ .*$//gi; + } + if ($args =~ /--with-inbound=/i) + { + @data_in = split(/--with-inbound=/,$args); + $with_inbound = $data_in[1]; + $with_inbound =~ s/ .*$//gi; + } + if ($args =~ /-ftp-transfer/i) + { + if (!$Q) + {print "\n----- FTP TRANSFER MODE -----\n\n";} + $ftp_transfer=1; + } + if ($args =~ /--test/i) + { + $T=1; $TEST=1; + print "\n----- TESTING -----\n\n"; + } + } +} +else +{ +print "no command line options set, using defaults.\n"; +} +### end parsing run-time options ### + + +$secX = time(); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + +# # rerun override - Use this to override the day manually +# $year='2007'; +# $mon='5'; +# $mday='18'; + + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + $timestamp = "$year-$mon-$mday $hour:$min:$sec"; + $filedate = "$year$mon$mday"; + $ABIfiledate = "$mon-$mday-$year$us$hour$min$sec"; + $shipdate = "$year-$mon-$mday"; + $datestamp = "$year/$mon/$mday $hour:$min"; + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + if ( ($line =~ /^VARREPORT_host/) && ($CLIREPORT_host < 1) ) + {$VARREPORT_host = $line; $VARREPORT_host =~ s/.*=//gi;} + if ( ($line =~ /^VARREPORT_user/) && ($CLIREPORT_user < 1) ) + {$VARREPORT_user = $line; $VARREPORT_user =~ s/.*=//gi;} + if ( ($line =~ /^VARREPORT_pass/) && ($CLIREPORT_pass < 1) ) + {$VARREPORT_pass = $line; $VARREPORT_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARREPORT_port/) && ($CLIREPORT_port < 1) ) + {$VARREPORT_port = $line; $VARREPORT_port =~ s/.*=//gi;} + if ( ($line =~ /^VARREPORT_dir/) && ($CLIREPORT_dir < 1) ) + {$VARREPORT_dir = $line; $VARREPORT_dir =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if ($output_format =~ /^pipe-standard$/) + {$DLT = '|'; $txt='.txt'; print "---- pipe-standard ----\n";} +if ($output_format =~ /^csv-standard$/) + {$DLT = "','"; $txt='.csv'; print "---- csv-standard ----\n";} +if ($output_format =~ /^tab-standard$/) + {$DLT = "\t"; $txt='.txt'; print "---- tab-standard ----\n";} +if ($output_format =~ /^pipe-triplep$/) + {$DLT = ''; $txt='.txt'; print "---- pipe-triplep ----\n";} +if ($output_format =~ /^pipe-vici$/) + {$DLT = '|'; $txt='.txt'; print "---- pipe-vici ----\n";} +if ($output_format =~ /^html-rec$/) + {$DLT = ' '; $txt='.html'; print "---- html-rec ----\n";} + + if ($sale_statuses =~ /---ALL---/) + { + $sale_statusesSQL=''; + $close_statusesSQL=''; + } + else + { + $sale_statusesSQL = $sale_statuses; + $sale_statusesSQL =~ s/-/','/gi; + $sale_statusesSQL = "'$sale_statusesSQL'"; + $close_statusesSQL = $sale_statusesSQL; + $sale_statusesSQL = " and vicidial_log.status IN($sale_statusesSQL)"; + $close_statusesSQL = " and vicidial_closer_log.status IN($close_statusesSQL)"; + } + + $with_inboundSQL = $with_inbound; + $with_inboundSQL =~ s/-/','/gi; + $with_inboundSQL = "'$with_inboundSQL'"; + +if (!$Q) + { + print "\n\n\n\n\n\n\n\n\n\n\n\n-- AST_VDsales_export.pl --\n\n"; + print "This program is designed to gather sales from a VICIDIAL outbound-only campaign and post them to a file. \n"; + print "\n"; + print "Campaign: $campaign\n"; + print "Sale Statuses: $sale_statuses $sale_statusesSQL\n"; + print "Output Format: $output_format\n"; + print "With Inbound: $with_inbound $with_inboundSQL\n"; + print "\n"; + } + +$outfile = "$campaign$US$filedate$US$sale_statuses$txt"; + +### open the X out file for writing ### +open(out, ">$PATHweb/vicidial/server_reports/$outfile") + || die "Can't open $outfile: $!\n"; + +if (!$VARDB_port) {$VARDB_port='3306';} + + +use DBI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +$dbhB = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +$TOTAL_SALES=0; + + +########################################################################### +########### CURRENT DAY SALES GATHERING outbound-only: vicidial_log ###### +########################################################################### +$stmtA = "select vicidial_log.user,first_name,last_name,address1,address2,city,state,postal_code,vicidial_list.phone_number,email,security_phrase,vicidial_list.comments,call_date,vicidial_list.lead_id,vicidial_users.full_name,vicidial_log.status,vicidial_list.vendor_lead_code,vicidial_list.source_id,vicidial_log.list_id from vicidial_list,vicidial_log,vicidial_users where campaign_id='$campaign' $sale_statusesSQL and call_date > '$shipdate 00:00:01' and call_date < '$shipdate 23:59:59' and vicidial_log.lead_id=vicidial_list.lead_id and vicidial_users.user=vicidial_log.user;"; +if ($DB) {print "|$stmtA|\n";} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $user = $aryA[0]; + $first_name = $aryA[1]; + $last_name = $aryA[2]; + $address1 = $aryA[3]; + $address2 = $aryA[4]; + $city = $aryA[5]; + $state = $aryA[6]; + $postal_code = $aryA[7]; + $phone_number = $aryA[8]; + $email = $aryA[9]; + $security = $aryA[10]; + $comments = $aryA[11]; + $call_date = $aryA[12]; + $lead_id = $aryA[13]; + $agent_name = $aryA[14]; + $status = $aryA[15]; + $vendor_id = $aryA[16]; + $source_id = $aryA[17]; + $list_id = $aryA[18]; + + &select_format_loop; + + $TOTAL_SALES++; + } +$sthA->finish(); + +if (length($with_inboundSQL)>3) + { + ########################################################################### + ########### CURRENT DAY SALES GATHERING inbound-only: vicidial_closer_log ###### + ########################################################################### + $stmtA = "select vicidial_closer_log.user,first_name,last_name,address1,address2,city,state,postal_code,vicidial_list.phone_number,email,security_phrase,vicidial_list.comments,call_date,vicidial_list.lead_id,vicidial_users.full_name,vicidial_closer_log.status,vicidial_list.vendor_lead_code,vicidial_list.source_id,vicidial_closer_log.list_id,campaign_id from vicidial_list,vicidial_closer_log,vicidial_users where campaign_id IN($with_inboundSQL) $close_statusesSQL and call_date > '$shipdate 00:00:01' and call_date < '$shipdate 23:59:59' and vicidial_closer_log.lead_id=vicidial_list.lead_id and vicidial_users.user=vicidial_closer_log.user;"; + if ($DB) {print "|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $closer = $aryA[0]; + $first_name = $aryA[1]; + $last_name = $aryA[2]; + $address1 = $aryA[3]; + $address2 = $aryA[4]; + $city = $aryA[5]; + $state = $aryA[6]; + $postal_code = $aryA[7]; + $phone_number = $aryA[8]; + $email = $aryA[9]; + $security = $aryA[10]; + $comments = $aryA[11]; + $call_date = $aryA[12]; + $lead_id = $aryA[13]; + $closer_name = $aryA[14]; + $status = $aryA[15]; + $vendor_id = $aryA[16]; + $source_id = $aryA[17]; + $list_id = $aryA[18]; + $campaign_id = $aryA[19]; + + $user = ''; + $agent_name=''; + + $stmtB = "select vicidial_xfer_log.user,full_name from vicidial_xfer_log,vicidial_users where lead_id='$lead_id' and closer='$closer' and call_date > '$shipdate 00:00:01' and call_date < '$shipdate 23:59:59' and vicidial_users.user=vicidial_xfer_log.user order by call_date desc limit 1;"; + $sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr; + $sthB->execute or die "executing: $stmtB ", $dbhB->errstr; + $sthBrows=$sthB->rows; + $rec_countB=0; + while ($sthBrows > $rec_countB) + { + @aryB = $sthB->fetchrow_array; + $user = $aryB[0]; + $agent_name = $aryB[1]; + $rec_countB++; + } + $sthB->finish(); + + &select_format_loop; + + $TOTAL_SALES++; + } + $sthA->finish(); + } + +close(out); + + +if ($ftp_transfer > 0) +{ + use Net::FTP; + + if (!$Q) {print "Sending File Over FTP: $outfile\n";} + $ftp = Net::FTP->new("$VARREPORT_host", Port => $VARREPORT_port); + $ftp->login("$VARREPORT_user","$VARREPORT_pass"); + $ftp->cwd("$VARREPORT_dir"); + $ftp->put("$PATHweb/vicidial/server_reports/$outfile", "$outfile"); + $ftp->quit; +} + +### calculate time to run script ### +$secY = time(); +$secZ = ($secY - $secX); +$secZm = ($secZ /60); + +if (!$Q) {print "SALES EXPORT FOR $timestamp: $outfile\n";} +if (!$Q) {print "TOTAL SALES: $TOTAL_SALES\n";} +if (!$Q) {print "script execution time in seconds: $secZ minutes: $secZm\n";} + +exit; + + + + + +### Subroutine for formatting of the output ### +sub select_format_loop +{ + +if ($T) + { +# $user = '1234'; + $agent_name = 'Joe Agent'; +# $closer = '4321'; + $closer_name = 'Jane Closer'; + $security = '4111111111111111'; + $comments = 'VISA'; + $phone_number =~ s/^\d\d\d\d\d/23456/gi; + $address1 =~ s/^..../1234 /gi + } +$ivr_id = '0'; +$ivr_filename = ''; + + +$stmtB = "select recording_id,filename,location from recording_log where lead_id='$lead_id' and start_time > '$shipdate 00:00:01' and start_time < '$shipdate 23:59:59' order by length_in_sec desc limit 1;"; +$sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr; +$sthB->execute or die "executing: $stmtB ", $dbhB->errstr; +$sthBrows=$sthB->rows; +$rec_countB=0; +while ($sthBrows > $rec_countB) + { + @aryB = $sthB->fetchrow_array; + $ivr_id = $aryB[0]; + $ivr_filename = $aryB[1]; + $ivr_location = $aryB[2]; + $rec_countB++; + } +$sthB->finish(); + +if (length($ivr_id)<3) + { + $stmtB = "select recording_id,filename from recording_log where lead_id='$lead_id' order by length_in_sec desc limit 1;"; + $sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr; + $sthB->execute or die "executing: $stmtB ", $dbhB->errstr; + $sthBrows=$sthB->rows; + $rec_countB=0; + while ($sthBrows > $rec_countB) + { + @aryB = $sthB->fetchrow_array; + $ivr_id = $aryB[0]; + $ivr_filename = $aryB[1]; + $rec_countB++; + } + $sthB->finish(); + + if (length($ivr_id)<3) + { + $stmtB = "select recording_id,filename from recording_log where filename LIKE \"%$phone_number%\" order by length_in_sec desc limit 1;"; + $sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr; + $sthB->execute or die "executing: $stmtB ", $dbhB->errstr; + $sthBrows=$sthB->rows; + $rec_countB=0; + while ($sthBrows > $rec_countB) + { + @aryB = $sthB->fetchrow_array; + $ivr_id = $aryB[0]; + $ivr_filename = $aryB[1]; + $rec_countB++; + } + $sthB->finish(); + } + } +if ($status =~ /UPSELL/) {$UPSELL='L5';} +else {$UPSELL='N';} + +if ($output_format =~ /^pipe-standard$/) + { + $str = "$first_name|$last_name|$address1|$address2|$city|$state|$postal_code|$phone_number|$email|$security|$comments|$call_date|$lead_id|$list_id|$user|$agent_name|$status|$vendor_id|$source_id|$campaign|$campaign_id|$ivr_id|$closer|$closer_name|\n"; + } + +if ($output_format =~ /^csv-standard$/) + { + $str = "\"$first_name\",\"$last_name\",\"$address1\",\"$address2\",\"$city\",\"$state\",\"$postal_code\",\"$phone_number\",\"$email\",\"$security\",\"$comments\",\"$call_date\",\"$lead_id\",\"$list_id\",\"$user\",\"$agent_name\",\"$status\",\"$vendor_id\",\"$source_id\",\"$campaign\",\"$campaign_id\",\"$ivr_id\",\"$closer\",\"$closer_name\"\r\n"; + } + +if ($output_format =~ /^tab-standard$/) + { + $str = "$first_name\t$last_name\t$address1\t$address2\t$city\t$state\t$postal_code\t$phone_number\t$email\t$security\t$comments\t$call_date\t$lead_id\t$list_id\t$user\t$agent_name\t$status\t$vendor_id\t$source_id\t$campaign\t$campaign_id\t$ivr_id\t$closer\t$closer_name\t\n"; + } + +if ($output_format =~ /^pipe-triplep$/) + { + $str = "$user|$agent_name|$closer|$closer_name|$call_date|$status|$first_name|$last_name|$phone_number|$address1|$address2|$city|$state|$postal_code|$comments|$security|$email|$vendor_id|$source_id|$lead_id|$list_id|$campaign|$campaign_id|$ivr_id|\n"; + } + +if ($output_format =~ /^pipe-vici$/) + { + $str = "VDAD|$agent_name|$first_name|$last_name|$address1|$address2|$city|$state|$postal_code|$phone_number|$ivr_id|DU|$UPSELL|N|||$security|$comments||||||$call_date|CBDISC|$email\r\n"; + } +if ($output_format =~ /^html-rec$/) + { + $str = "$user|$agent_name|$closer|$closer_name|$call_date|$status|$first_name|$last_name|$phone_number|$address1|$address2|$city|$state|$postal_code|$comments|$security|$email|$vendor_id|$source_id|$lead_id|$list_id|$campaign|$campaign_id|$ivr_id|\n"; + } + + + +print out "$str"; +if ($DBX) {print "$str\n";} + +$rec_count++; + +} + diff --git a/agc_2-X/branches/agc_2.0.4/bin/AST_agent_day.pl b/agc_2-X/branches/agc_2.0.4/bin/AST_agent_day.pl new file mode 100644 index 00000000..b3469834 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/AST_agent_day.pl @@ -0,0 +1,298 @@ +#!/usr/bin/perl + +# AST_agent_day.pl +# +# This script is designed to gather stats for all agent activity over the course +# of a day and print it in an ASCI text file to be placed +# on a web server for viewing. +# +# Place in the crontab and run every night at 23:59 +# 59 23 * * * /home/cron/AST_agent_day.pl +# +# CHANGES +# 60517-1100 - First version +# 60715-2325 - changed to use /etc/astguiclient.conf for configs +# 71115-0231 - added Pipe-delimited file output +# + +$txt = '.txt'; +$US = '_'; +$MT[0] = ''; + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n\n"; + exit; + } + else + { + if ($args =~ /--debug/i) + { + $DB=1; + print "\n-----DEBUG MODE-----\n\n"; + } + if ($args =~ /-q/i) + { + $q=1; $Q=1; + } + if ($args =~ /-t/i) + { + $T=1; $TEST=1; + print "\n-----TESTING-----\n\n"; + } + } +} +else +{ +print "no command line options set\n"; +} +### end parsing run-time options ### + + +$secX = time(); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + $filedate = "$year$mon$mday-$hour$min$sec"; + $ABIfiledate = "$mon-$mday-$year$us$hour$min$sec"; + $shipdate = "$year-$mon-$mday"; + $datestamp = "$year/$mon/$mday $hour:$min"; + + if ($wday==0) {$day='Sunday ';} + if ($wday==1) {$day='Monday ';} + if ($wday==2) {$day='Tuesday ';} + if ($wday==3) {$day='Wednesday';} + if ($wday==4) {$day='Thursday ';} + if ($wday==5) {$day='Friday ';} + if ($wday==6) {$day='Saturday ';} + + + +print "\n\n\n\n\n\n\n\n\n\n\n\n-- AST_agent_day.pl --\n\n"; +print "This program is designed to print stats to a file for agents' activity for the previous day. \n\n"; + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +$outfile = "AGENT_DAY_$shipdate$txt"; +$Doutfile = "AGENT_DAY_PIPE_$shipdate$txt"; + +### open the X out file for writing ### +open(out, ">$PATHweb/vicidial/agent_reports/$outfile") + || die "Can't open $outfile: $!\n"; +open(Dout, ">$PATHweb/vicidial/agent_reports/$Doutfile") + || die "Can't open $Doutfile: $!\n"; + +if (!$VARDB_port) {$VARDB_port='3306';} + + +use DBI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +$dbhB = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +#$vicidial_agent_log = 'vicidial_agent_log_archive'; +$vicidial_agent_log = 'vicidial_agent_log'; + +########################################################################### +########### PAST WEEK STAT GATHERING LOOP ################################# +########################################################################### +print Dout "TODAY: $day $shipdate\n\n"; +print Dout "DATE|AGENT|USER|CALLS|TALK|PAUSE|WAIT|DISPO|ACTIVE|LOGTIME|FIRST|LAST\n"; +print out "TODAY: $day $shipdate\n\n"; +print out "AGENT USER CALLS TALK PAUSE WAIT DISPO ACTIVE LOGTIME FIRST LAST \n"; +print "TODAY: $day $shipdate\n\n"; +print "AGENT USER CALLS TALK PAUSE WAIT DISPO ACTIVE LOGTIME FIRST LAST \n"; + +$stmtA = "select count(*) as calls, full_name,vicidial_users.user,sum(talk_sec),sum(pause_sec),sum(wait_sec),sum(dispo_sec) from vicidial_users,$vicidial_agent_log where event_time <= '$shipdate 23:59:59' and event_time >= '$shipdate 00:00:00' and vicidial_users.user=$vicidial_agent_log.user and pause_sec<48800 and wait_sec<48800 and talk_sec<48800 and dispo_sec<48800 group by vicidial_users.user order by full_name limit 10000;"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + + $Dcalls = $aryA[0]; + $Dname = $aryA[1]; + $Duser = $aryA[2]; + $calls = sprintf("%7s", $aryA[0]); + $name = sprintf("%-20s", $aryA[1]); while(length($name)>20) {chop($name);} + $user = sprintf("%-8s", $aryA[2]); + + ### TOTAL ACTIVE TIME + $active = ($aryA[3] + $aryA[4] + $aryA[5] + $aryA[6]); + $TIME_S = $active; + $TIME_H = int($TIME_S / 3600); + $TIME_S = ($TIME_S - ($TIME_H * 3600)); + $TIME_M = int($TIME_S / 60); + $TIME_S = ($TIME_S - ($TIME_M * 60)); + if ($TIME_S < 10) {$TIME_S = "0$TIME_S";} + if ($TIME_M < 10) {$TIME_M = "0$TIME_M";} + $TIME_HMS = "$TIME_H:$TIME_M:$TIME_S"; + $Dactive = $TIME_HMS; + $active = sprintf("%9s", $TIME_HMS); + + ### TOTAL TALK TIME + $TIME_S = $aryA[3]; + $TIME_H = int($TIME_S / 3600); + $TIME_S = ($TIME_S - ($TIME_H * 3600)); + $TIME_M = int($TIME_S / 60); + $TIME_S = ($TIME_S - ($TIME_M * 60)); + if ($TIME_S < 10) {$TIME_S = "0$TIME_S";} + if ($TIME_M < 10) {$TIME_M = "0$TIME_M";} + $TIME_HMS = "$TIME_H:$TIME_M:$TIME_S"; + $Dtalk = $TIME_HMS; + $talk = sprintf("%9s", $TIME_HMS); + + ### TOTAL PAUSE TIME + $TIME_S = $aryA[4]; + $TIME_H = int($TIME_S / 3600); + $TIME_S = ($TIME_S - ($TIME_H * 3600)); + $TIME_M = int($TIME_S / 60); + $TIME_S = ($TIME_S - ($TIME_M * 60)); + if ($TIME_S < 10) {$TIME_S = "0$TIME_S";} + if ($TIME_M < 10) {$TIME_M = "0$TIME_M";} + $TIME_HMS = "$TIME_H:$TIME_M:$TIME_S"; + $Dpause = $TIME_HMS; + $pause = sprintf("%9s", $TIME_HMS); + + ### TOTAL WAIT TIME + $TIME_S = $aryA[5]; + $TIME_H = int($TIME_S / 3600); + $TIME_S = ($TIME_S - ($TIME_H * 3600)); + $TIME_M = int($TIME_S / 60); + $TIME_S = ($TIME_S - ($TIME_M * 60)); + if ($TIME_S < 10) {$TIME_S = "0$TIME_S";} + if ($TIME_M < 10) {$TIME_M = "0$TIME_M";} + $TIME_HMS = "$TIME_H:$TIME_M:$TIME_S"; + $Dwait = $TIME_HMS; + $wait = sprintf("%9s", $TIME_HMS); + + ### TOTAL DISPO TIME + $TIME_S = $aryA[6]; + $TIME_H = int($TIME_S / 3600); + $TIME_S = ($TIME_S - ($TIME_H * 3600)); + $TIME_M = int($TIME_S / 60); + $TIME_S = ($TIME_S - ($TIME_M * 60)); + if ($TIME_S < 10) {$TIME_S = "0$TIME_S";} + if ($TIME_M < 10) {$TIME_M = "0$TIME_M";} + $TIME_HMS = "$TIME_H:$TIME_M:$TIME_S"; + $Ddispo = $TIME_HMS; + $dispo = sprintf("%9s", $TIME_HMS); + + $stmtB = "select event_time,UNIX_TIMESTAMP(event_time) from $vicidial_agent_log where event_time <= '$shipdate 23:59:59' and event_time >= '$shipdate 00:00:00' and user='$aryA[2]' order by event_time limit 1;"; + $sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr; + $sthB->execute or die "executing: $stmtA ", $dbhB->errstr; + @aryB = $sthB->fetchrow_array; + $Dfirst_time = $aryB[0]; + $first_time = sprintf("%21s", $aryB[0]); + $Dfirst_log = $aryB[1]; + $first_log = $aryB[1]; + + $stmtB = "select event_time,UNIX_TIMESTAMP(event_time) from $vicidial_agent_log where event_time <= '$shipdate 23:59:59' and event_time >= '$shipdate 00:00:00' and user='$aryA[2]' order by event_time desc limit 1;"; + $sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr; + $sthB->execute or die "executing: $stmtA ", $dbhB->errstr; + @aryB = $sthB->fetchrow_array; + $Dlast_time = $aryB[0]; + $last_time = sprintf("%21s", $aryB[0]); + $Dlast_log = $aryB[1]; + $last_log = $aryB[1]; + + $TIME_S = ($last_log - $first_log); + $TIME_H = int($TIME_S / 3600); + $TIME_S = ($TIME_S - ($TIME_H * 3600)); + $TIME_M = int($TIME_S / 60); + $TIME_S = ($TIME_S - ($TIME_M * 60)); + if ($TIME_S < 10) {$TIME_S = "0$TIME_S";} + if ($TIME_M < 10) {$TIME_M = "0$TIME_M";} + $TIME_HMS = "$TIME_H:$TIME_M:$TIME_S"; + $Dlogin_time = $TIME_HMS; + $login_time = sprintf("%9s", $TIME_HMS); + + + + print Dout "$shipdate|$Dname|$Duser|$Dcalls|$Dtalk|$Dpause|$Dwait|$Ddispo|$Dactive|$Dlogin_time|$Dfirst_time|$Dlast_time\n"; + print out "$name$user$calls$talk$pause$wait$dispo$active$login_time$first_time$last_time\n"; + print "$name$user$calls$talk$pause$wait$dispo$active$login_time$first_time$last_time\n"; + + + $rec_count++; + } +$sthA->finish(); + + + +close(Dout); +close(out); + +### calculate time to run script ### +$secY = time(); +$secZ = ($secY - $secX); +$secZm = ($secZ /60); + +print "script execution time in seconds: $secZ minutes: $secZm\n"; + +exit; + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/bin/AST_agent_week.pl b/agc_2-X/branches/agc_2.0.4/bin/AST_agent_week.pl new file mode 100644 index 00000000..dc6fc4f6 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/AST_agent_week.pl @@ -0,0 +1,350 @@ +#!/usr/bin/perl + +# AST_agent_week.pl +# +# This script is designed to gather stats for all agent activity over the course +# of a week(Sunday to Saturday) and print it in an ASCI text file to be placed +# on a web server for viewing. +# +# CHANGES +# 60517-1100 - First version +# 60715-2325 - changed to use /etc/astguiclient.conf for configs +# + +$txt = '.txt'; +$US = '_'; +$MT[0] = ''; + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n\n"; + exit; + } + else + { + if ($args =~ /--debug/i) + { + $DB=1; + print "\n-----DEBUG MODE-----\n\n"; + } + if ($args =~ /-q/i) + { + $q=1; $Q=1; + } + if ($args =~ /-t/i) + { + $T=1; $TEST=1; + print "\n-----TESTING-----\n\n"; + } + } +} +else +{ +print "no command line options set\n"; +} +### end parsing run-time options ### + + +$secX = time(); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + $filedate = "$year$mon$mday-$hour$min$sec"; + $ABIfiledate = "$mon-$mday-$year$us$hour$min$sec"; + $shipdate = "$year-$mon-$mday"; + $datestamp = "$year/$mon/$mday $hour:$min"; + + $STARTtarget = ($secX - (86400 * $wday)); + ($Ssec,$Smin,$Shour,$Smday,$Smon,$Syear,$Swday,$Syday,$Sisdst) = localtime($STARTtarget); + $Syear = ($Syear + 1900); $Smon++; + if ($Smon < 10) {$Smon = "0$Smon";} + if ($Smday < 10) {$Smday = "0$Smday";} + $START_week = (($Syday/7)+1); $START_week = sprintf("%2d", $START_week); + $STARTtarget_date = "$Syear-$Smon-$Smday"; + + $ENDtarget = ($STARTtarget + (86400 * 6)); + ($Ssec,$Smin,$Shour,$Smday,$Smon,$Syear,$Swday,$Syday,$Sisdst) = localtime($ENDtarget); + $Syear = ($Syear + 1900); $Smon++; + if ($Smon < 10) {$Smon = "0$Smon";} + if ($Smday < 10) {$Smday = "0$Smday";} + $ENDtarget_date = "$Syear-$Smon-$Smday"; + + $PAST_STARTtarget = ($STARTtarget - (86400 * 7)); + ($Ssec,$Smin,$Shour,$Smday,$Smon,$Syear,$Swday,$Syday,$Sisdst) = localtime($PAST_STARTtarget); + $Syear = ($Syear + 1900); $Smon++; + if ($Smon < 10) {$Smon = "0$Smon";} + if ($Smday < 10) {$Smday = "0$Smday";} + $PAST_START_week = (($Syday/7)+1); $PAST_START_week = sprintf("%2d", $PAST_START_week); + $PAST_STARTtarget_date = "$Syear-$Smon-$Smday"; + + $PAST_ENDtarget = ($ENDtarget - (86400 * 7)); + ($Ssec,$Smin,$Shour,$Smday,$Smon,$Syear,$Swday,$Syday,$Sisdst) = localtime($PAST_ENDtarget); + $Syear = ($Syear + 1900); $Smon++; + if ($Smon < 10) {$Smon = "0$Smon";} + if ($Smday < 10) {$Smday = "0$Smday";} + $PAST_ENDtarget_date = "$Syear-$Smon-$Smday"; + + $PAST_date[0] = $PAST_STARTtarget_date; + $PAST_day[0] = 'Sunday '; + $PAST_date[6] = $PAST_ENDtarget_date; + $PAST_day[6] = 'Saturday '; + + $PAST_Mondaytarget = ($STARTtarget - (86400 * 6)); + ($Ssec,$Smin,$Shour,$Smday,$Smon,$Syear,$Swday,$Syday,$Sisdst) = localtime($PAST_Mondaytarget); + $Syear = ($Syear + 1900); $Smon++; + if ($Smon < 10) {$Smon = "0$Smon";} + if ($Smday < 10) {$Smday = "0$Smday";} + $PAST_date[1] = "$Syear-$Smon-$Smday"; + $PAST_day[1] = 'Monday '; + + $PAST_Tuesdaytarget = ($STARTtarget - (86400 * 5)); + ($Ssec,$Smin,$Shour,$Smday,$Smon,$Syear,$Swday,$Syday,$Sisdst) = localtime($PAST_Tuesdaytarget); + $Syear = ($Syear + 1900); $Smon++; + if ($Smon < 10) {$Smon = "0$Smon";} + if ($Smday < 10) {$Smday = "0$Smday";} + $PAST_date[2] = "$Syear-$Smon-$Smday"; + $PAST_day[2] = 'Tuesday '; + + $PAST_Wednesdaytarget = ($STARTtarget - (86400 * 4)); + ($Ssec,$Smin,$Shour,$Smday,$Smon,$Syear,$Swday,$Syday,$Sisdst) = localtime($PAST_Wednesdaytarget); + $Syear = ($Syear + 1900); $Smon++; + if ($Smon < 10) {$Smon = "0$Smon";} + if ($Smday < 10) {$Smday = "0$Smday";} + $PAST_date[3] = "$Syear-$Smon-$Smday"; + $PAST_day[3] = 'Wednesday'; + + $PAST_Thursdaytarget = ($STARTtarget - (86400 * 3)); + ($Ssec,$Smin,$Shour,$Smday,$Smon,$Syear,$Swday,$Syday,$Sisdst) = localtime($PAST_Thursdaytarget); + $Syear = ($Syear + 1900); $Smon++; + if ($Smon < 10) {$Smon = "0$Smon";} + if ($Smday < 10) {$Smday = "0$Smday";} + $PAST_date[4] = "$Syear-$Smon-$Smday"; + $PAST_day[4] = 'Thursday '; + + $PAST_Fridaytarget = ($STARTtarget - (86400 * 2)); + ($Ssec,$Smin,$Shour,$Smday,$Smon,$Syear,$Swday,$Syday,$Sisdst) = localtime($PAST_Fridaytarget); + $Syear = ($Syear + 1900); $Smon++; + if ($Smon < 10) {$Smon = "0$Smon";} + if ($Smday < 10) {$Smday = "0$Smday";} + $PAST_date[5] = "$Syear-$Smon-$Smday"; + $PAST_day[5] = 'Friday '; + +print "\n\n\n\n\n\n\n\n\n\n\n\n-- AST_agent_week.pl --\n\n"; +print "This program is designed to print stats to a file for agents' activity for the previous week. \n\n"; + +$TLoutfile = ''; +$TLoutfile .= "TODAY: $shipdate\n"; +$TLoutfile .= "THIS WEEK: week $START_week $STARTtarget_date - $ENDtarget_date\n"; +$TLoutfile .= "LAST WEEK: week $PAST_START_week $PAST_STARTtarget_date - $PAST_ENDtarget_date\n\n"; + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +$outfile = "AGENT_HOURS_$PAST_STARTtarget_date$US$PAST_ENDtarget_date$txt"; + +### open the X out file for writing ### +open(out, ">$PATHweb/vicidial/agent_reports/$outfile") + || die "Can't open $outfile: $!\n"; + +if (!$VARDB_port) {$VARDB_port='3306';} + + +use DBI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +$dbhB = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +#$vicidial_agent_log = 'vicidial_agent_log_archive'; +$vicidial_agent_log = 'vicidial_agent_log'; + +########################################################################### +########### PAST WEEK STAT GATHERING LOOP ################################# +########################################################################### +$h=0; +foreach(@PAST_date) +{ + print out "\n$PAST_day[$h] $PAST_date[$h]\n\n"; + print out "AGENT USER CALLS TALK PAUSE WAIT DISPO ACTIVE LOGTIME FIRST LAST \n"; + print "\n$PAST_day[$h] $PAST_date[$h]\n\n"; + print "AGENT USER CALLS TALK PAUSE WAIT DISPO ACTIVE LOGTIME FIRST LAST \n"; + + $stmtA = "select count(*) as calls, full_name,vicidial_users.user,sum(talk_sec),sum(pause_sec),sum(wait_sec),sum(dispo_sec) from vicidial_users,$vicidial_agent_log where event_time <= '$PAST_date[$h] 23:59:59' and event_time >= '$PAST_date[$h] 00:00:00' and vicidial_users.user=$vicidial_agent_log.user and pause_sec<48800 and wait_sec<48800 and talk_sec<48800 and dispo_sec<48800 group by vicidial_users.user order by full_name limit 10000;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + + $calls = sprintf("%7s", $aryA[0]); + $name = sprintf("%-20s", $aryA[1]); while(length($name)>20) {chop($name);} + $user = sprintf("%-8s", $aryA[2]); + + ### TOTAL ACTIVE TIME + $active = ($aryA[3] + $aryA[4] + $aryA[5] + $aryA[6]); + $TIME_S = $active; + $TIME_H = int($TIME_S / 3600); + $TIME_S = ($TIME_S - ($TIME_H * 3600)); + $TIME_M = int($TIME_S / 60); + $TIME_S = ($TIME_S - ($TIME_M * 60)); + if ($TIME_S < 10) {$TIME_S = "0$TIME_S";} + if ($TIME_M < 10) {$TIME_M = "0$TIME_M";} + $TIME_HMS = "$TIME_H:$TIME_M:$TIME_S"; + $active = sprintf("%9s", $TIME_HMS); + + ### TOTAL TALK TIME + $TIME_S = $aryA[3]; + $TIME_H = int($TIME_S / 3600); + $TIME_S = ($TIME_S - ($TIME_H * 3600)); + $TIME_M = int($TIME_S / 60); + $TIME_S = ($TIME_S - ($TIME_M * 60)); + if ($TIME_S < 10) {$TIME_S = "0$TIME_S";} + if ($TIME_M < 10) {$TIME_M = "0$TIME_M";} + $TIME_HMS = "$TIME_H:$TIME_M:$TIME_S"; + $talk = sprintf("%9s", $TIME_HMS); + + ### TOTAL PAUSE TIME + $TIME_S = $aryA[4]; + $TIME_H = int($TIME_S / 3600); + $TIME_S = ($TIME_S - ($TIME_H * 3600)); + $TIME_M = int($TIME_S / 60); + $TIME_S = ($TIME_S - ($TIME_M * 60)); + if ($TIME_S < 10) {$TIME_S = "0$TIME_S";} + if ($TIME_M < 10) {$TIME_M = "0$TIME_M";} + $TIME_HMS = "$TIME_H:$TIME_M:$TIME_S"; + $pause = sprintf("%9s", $TIME_HMS); + + ### TOTAL WAIT TIME + $TIME_S = $aryA[5]; + $TIME_H = int($TIME_S / 3600); + $TIME_S = ($TIME_S - ($TIME_H * 3600)); + $TIME_M = int($TIME_S / 60); + $TIME_S = ($TIME_S - ($TIME_M * 60)); + if ($TIME_S < 10) {$TIME_S = "0$TIME_S";} + if ($TIME_M < 10) {$TIME_M = "0$TIME_M";} + $TIME_HMS = "$TIME_H:$TIME_M:$TIME_S"; + $wait = sprintf("%9s", $TIME_HMS); + + ### TOTAL DISPO TIME + $TIME_S = $aryA[6]; + $TIME_H = int($TIME_S / 3600); + $TIME_S = ($TIME_S - ($TIME_H * 3600)); + $TIME_M = int($TIME_S / 60); + $TIME_S = ($TIME_S - ($TIME_M * 60)); + if ($TIME_S < 10) {$TIME_S = "0$TIME_S";} + if ($TIME_M < 10) {$TIME_M = "0$TIME_M";} + $TIME_HMS = "$TIME_H:$TIME_M:$TIME_S"; + $dispo = sprintf("%9s", $TIME_HMS); + + $stmtB = "select event_time,UNIX_TIMESTAMP(event_time) from $vicidial_agent_log where event_time <= '$PAST_date[$h] 23:59:59' and event_time >= '$PAST_date[$h] 00:00:00' and user='$aryA[2]' order by event_time limit 1;"; + $sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr; + $sthB->execute or die "executing: $stmtA ", $dbhB->errstr; + @aryB = $sthB->fetchrow_array; + $first_time = sprintf("%21s", $aryB[0]); + $first_log = $aryB[1]; + + $stmtB = "select event_time,UNIX_TIMESTAMP(event_time) from $vicidial_agent_log where event_time <= '$PAST_date[$h] 23:59:59' and event_time >= '$PAST_date[$h] 00:00:00' and user='$aryA[2]' order by event_time desc limit 1;"; + $sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr; + $sthB->execute or die "executing: $stmtA ", $dbhB->errstr; + @aryB = $sthB->fetchrow_array; + $last_time = sprintf("%21s", $aryB[0]); + $last_log = $aryB[1]; + + $TIME_S = ($last_log - $first_log); + $TIME_H = int($TIME_S / 3600); + $TIME_S = ($TIME_S - ($TIME_H * 3600)); + $TIME_M = int($TIME_S / 60); + $TIME_S = ($TIME_S - ($TIME_M * 60)); + if ($TIME_S < 10) {$TIME_S = "0$TIME_S";} + if ($TIME_M < 10) {$TIME_M = "0$TIME_M";} + $TIME_HMS = "$TIME_H:$TIME_M:$TIME_S"; + $login_time = sprintf("%9s", $TIME_HMS); + + + + print out "$name$user$calls$talk$pause$wait$dispo$active$login_time$first_time$last_time\n"; + print "$name$user$calls$talk$pause$wait$dispo$active$login_time$first_time$last_time\n"; + + + $rec_count++; + } + $sthA->finish(); + +$h++; +} + + + +close(out); + +### calculate time to run script ### +$secY = time(); +$secZ = ($secY - $secX); +$secZm = ($secZ /60); + +print "script execution time in seconds: $secZ minutes: $secZm\n"; + +exit; + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/bin/AST_agent_week_tally.pl b/agc_2-X/branches/agc_2.0.4/bin/AST_agent_week_tally.pl new file mode 100644 index 00000000..090537c6 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/AST_agent_week_tally.pl @@ -0,0 +1,309 @@ +#!/usr/bin/perl + +# AST_agent_week_tally.pl +# +# This script is designed to gather stats for all agent activity over the course +# of a week and print it in an ASCI text file to be placed +# on a web server for viewing. +# +# Place in the crontab and run every Saturday night at 23:59 +# 59 23 6 * * /home/cron/AST_agent_day.pl +# +# CHANGES +# 60517-1100 - First version +# 60715-2325 - changed to use /etc/astguiclient.conf for configs +# 71115-0231 - added Pipe-delimited file output +# 71205-1232 - Changed to week total version +# + +$txt = '.txt'; +$US = '_'; +$MT[0] = ''; + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n\n"; + exit; + } + else + { + if ($args =~ /--debug/i) + { + $DB=1; + print "\n-----DEBUG MODE-----\n\n"; + } + if ($args =~ /-q/i) + { + $q=1; $Q=1; + } + if ($args =~ /-t/i) + { + $T=1; $TEST=1; + print "\n-----TESTING-----\n\n"; + } + } +} +else +{ +print "no command line options set\n"; +} +### end parsing run-time options ### + + +$secX = time(); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + $filedate = "$year$mon$mday-$hour$min$sec"; + $ABIfiledate = "$mon-$mday-$year$us$hour$min$sec"; + $shipdate = "$year-$mon-$mday"; + $datestamp = "$year/$mon/$mday $hour:$min"; + + if ($wday==0) {$day='Sunday ';} + if ($wday==1) {$day='Monday ';} + if ($wday==2) {$day='Tuesday ';} + if ($wday==3) {$day='Wednesday';} + if ($wday==4) {$day='Thursday ';} + if ($wday==5) {$day='Friday ';} + if ($wday==6) {$day='Saturday ';} + +$TDtarget = ($secX - 600000); # 6 days 10 hours 30 minutes in the past +($Tsec,$Tmin,$Thour,$Tmday,$Tmon,$Tyear,$Twday,$Tyday,$Tisdst) = localtime($TDtarget); +$Tyear = ($Tyear + 1900); +$Tmon++; +if ($Tmon < 10) {$Tmon = "0$Tmon";} +if ($Tmday < 10) {$Tmday = "0$Tmday";} +if ($Thour < 10) {$Thour = "0$Thour";} +if ($Tmin < 10) {$Tmin = "0$Tmin";} +if ($Tsec < 10) {$Tsec = "0$Tsec";} + $begindate = "$Tyear-$Tmon-$Tmday"; + + +print "\n\n\n\n\n\n\n\n\n\n\n\n-- AST_agent_week_tally.pl --\n\n"; +print "This program is designed to print stats to a file for agents' activity for the previous week. \n\n"; + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +$outfile = "AGENT_TALLY_$shipdate$txt"; +$Doutfile = "AGENT_TALLY_PIPE_$shipdate$txt"; + +### open the X out file for writing ### +open(out, ">$PATHweb/vicidial/agent_reports/$outfile") + || die "Can't open $outfile: $!\n"; +open(Dout, ">$PATHweb/vicidial/agent_reports/$Doutfile") + || die "Can't open $Doutfile: $!\n"; + +if (!$VARDB_port) {$VARDB_port='3306';} + + +use DBI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +$dbhB = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +#$vicidial_agent_log = 'vicidial_agent_log_archive'; +$vicidial_agent_log = 'vicidial_agent_log'; + +########################################################################### +########### PAST WEEK STAT GATHERING LOOP ################################# +########################################################################### +print Dout "DATE|AGENT|USER|CALLS|TALK|PAUSE|WAIT|DISPO|ACTIVE|LOGTIME|FIRST|LAST\n"; +print out "WEEK: $begindate through $shipdate\n\n"; +print out "AGENT USER CALLS TALK PAUSE WAIT DISPO ACTIVE LOGTIME FIRST LAST \n"; +print "WEEK: $begindate through $shipdate\n\n"; +print "AGENT USER CALLS TALK PAUSE WAIT DISPO ACTIVE LOGTIME FIRST LAST \n"; + +$stmtA = "select count(*) as calls, full_name,vicidial_users.user,sum(talk_sec),sum(pause_sec),sum(wait_sec),sum(dispo_sec) from vicidial_users,$vicidial_agent_log where event_time <= '$shipdate 23:59:59' and event_time >= '$begindate 00:00:00' and vicidial_users.user=$vicidial_agent_log.user and pause_sec<48800 and wait_sec<48800 and talk_sec<48800 and dispo_sec<48800 group by vicidial_users.user order by full_name limit 10000;"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + + $Dcalls = $aryA[0]; + $Dname = $aryA[1]; + $Duser = $aryA[2]; + $calls = sprintf("%7s", $aryA[0]); + $name = sprintf("%-20s", $aryA[1]); while(length($name)>20) {chop($name);} + $user = sprintf("%-8s", $aryA[2]); + + ### TOTAL ACTIVE TIME + $active = ($aryA[3] + $aryA[4] + $aryA[5] + $aryA[6]); + $TIME_S = $active; + $TIME_H = int($TIME_S / 3600); + $TIME_S = ($TIME_S - ($TIME_H * 3600)); + $TIME_M = int($TIME_S / 60); + $TIME_S = ($TIME_S - ($TIME_M * 60)); + if ($TIME_S < 10) {$TIME_S = "0$TIME_S";} + if ($TIME_M < 10) {$TIME_M = "0$TIME_M";} + $TIME_HMS = "$TIME_H:$TIME_M:$TIME_S"; + $Dactive = $TIME_HMS; + $active = sprintf("%9s", $TIME_HMS); + + ### TOTAL TALK TIME + $TIME_S = $aryA[3]; + $TIME_H = int($TIME_S / 3600); + $TIME_S = ($TIME_S - ($TIME_H * 3600)); + $TIME_M = int($TIME_S / 60); + $TIME_S = ($TIME_S - ($TIME_M * 60)); + if ($TIME_S < 10) {$TIME_S = "0$TIME_S";} + if ($TIME_M < 10) {$TIME_M = "0$TIME_M";} + $TIME_HMS = "$TIME_H:$TIME_M:$TIME_S"; + $Dtalk = $TIME_HMS; + $talk = sprintf("%9s", $TIME_HMS); + + ### TOTAL PAUSE TIME + $TIME_S = $aryA[4]; + $TIME_H = int($TIME_S / 3600); + $TIME_S = ($TIME_S - ($TIME_H * 3600)); + $TIME_M = int($TIME_S / 60); + $TIME_S = ($TIME_S - ($TIME_M * 60)); + if ($TIME_S < 10) {$TIME_S = "0$TIME_S";} + if ($TIME_M < 10) {$TIME_M = "0$TIME_M";} + $TIME_HMS = "$TIME_H:$TIME_M:$TIME_S"; + $Dpause = $TIME_HMS; + $pause = sprintf("%9s", $TIME_HMS); + + ### TOTAL WAIT TIME + $TIME_S = $aryA[5]; + $TIME_H = int($TIME_S / 3600); + $TIME_S = ($TIME_S - ($TIME_H * 3600)); + $TIME_M = int($TIME_S / 60); + $TIME_S = ($TIME_S - ($TIME_M * 60)); + if ($TIME_S < 10) {$TIME_S = "0$TIME_S";} + if ($TIME_M < 10) {$TIME_M = "0$TIME_M";} + $TIME_HMS = "$TIME_H:$TIME_M:$TIME_S"; + $Dwait = $TIME_HMS; + $wait = sprintf("%9s", $TIME_HMS); + + ### TOTAL DISPO TIME + $TIME_S = $aryA[6]; + $TIME_H = int($TIME_S / 3600); + $TIME_S = ($TIME_S - ($TIME_H * 3600)); + $TIME_M = int($TIME_S / 60); + $TIME_S = ($TIME_S - ($TIME_M * 60)); + if ($TIME_S < 10) {$TIME_S = "0$TIME_S";} + if ($TIME_M < 10) {$TIME_M = "0$TIME_M";} + $TIME_HMS = "$TIME_H:$TIME_M:$TIME_S"; + $Ddispo = $TIME_HMS; + $dispo = sprintf("%9s", $TIME_HMS); + + $stmtB = "select event_time,UNIX_TIMESTAMP(event_time) from $vicidial_agent_log where event_time <= '$shipdate 23:59:59' and event_time >= '$begindate 00:00:00' and user='$aryA[2]' order by event_time limit 1;"; + $sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr; + $sthB->execute or die "executing: $stmtA ", $dbhB->errstr; + @aryB = $sthB->fetchrow_array; + $Dfirst_time = $aryB[0]; + $first_time = sprintf("%21s", $aryB[0]); + $Dfirst_log = $aryB[1]; + $first_log = $aryB[1]; + + $stmtB = "select event_time,UNIX_TIMESTAMP(event_time) from $vicidial_agent_log where event_time <= '$shipdate 23:59:59' and event_time >= '$begindate 00:00:00' and user='$aryA[2]' order by event_time desc limit 1;"; + $sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr; + $sthB->execute or die "executing: $stmtA ", $dbhB->errstr; + @aryB = $sthB->fetchrow_array; + $Dlast_time = $aryB[0]; + $last_time = sprintf("%21s", $aryB[0]); + $Dlast_log = $aryB[1]; + $last_log = $aryB[1]; + + $TIME_S = ($last_log - $first_log); + $TIME_H = int($TIME_S / 3600); + $TIME_S = ($TIME_S - ($TIME_H * 3600)); + $TIME_M = int($TIME_S / 60); + $TIME_S = ($TIME_S - ($TIME_M * 60)); + if ($TIME_S < 10) {$TIME_S = "0$TIME_S";} + if ($TIME_M < 10) {$TIME_M = "0$TIME_M";} + $TIME_HMS = "$TIME_H:$TIME_M:$TIME_S"; + $TIME_HMS = "N/A"; + $Dlogin_time = $TIME_HMS; + $login_time = sprintf("%9s", $TIME_HMS); + + + + print Dout "$shipdate|$Dname|$Duser|$Dcalls|$Dtalk|$Dpause|$Dwait|$Ddispo|$Dactive|$Dlogin_time|$Dfirst_time|$Dlast_time\n"; + print out "$name$user$calls$talk$pause$wait$dispo$active$login_time$first_time$last_time\n"; + print "$name$user$calls$talk$pause$wait$dispo$active$login_time$first_time$last_time\n"; + + + $rec_count++; + } +$sthA->finish(); + + + +close(Dout); +close(out); + +### calculate time to run script ### +$secY = time(); +$secZ = ($secY - $secX); +$secZm = ($secZ /60); + +print "script execution time in seconds: $secZ minutes: $secZm\n"; + +exit; + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/bin/AST_cleanup_agent_log.pl b/agc_2-X/branches/agc_2.0.4/bin/AST_cleanup_agent_log.pl new file mode 100644 index 00000000..6e5d7e3f --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/AST_cleanup_agent_log.pl @@ -0,0 +1,268 @@ +#!/usr/bin/perl +# +# AST_cleanup_agent_log.pl version 0.3 *** DBI version *** +# +# DESCRIPTION: +# to be run frequently to clean up the vicidial_agent_log to fix erroneous time +# calculations due to out-of-order vicidial_agent_log updates. This happens 0.5% +# of the time in our test setups, but that leads to inaccurate time logs so we +# wrote this script to fix the miscalculations +# +# This program only needs to be run by one server +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# CHANGES +# 60711-0945 - changed to DBI by Marin Blu +# 60715-2301 - changed to use /etc/astguiclient.conf for configs + +# constants +$COUNTER_OUTPUT=1; # set to 1 to display the counter as the script runs +$US='__'; +$MT[0]=''; + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-t] = test\n [-debug] = verbose debug messages\n[-debugX] = Extra-verbose debug messages\n\n"; + } + else + { + if ($args =~ /-debug/i) + { + $DB=1; # Debug flag + print "\n----- DEBUGGING -----\n\n"; + } + if ($args =~ /--debugX/i) + { + $DBX=1; + print "\n----- SUPER-DUPER DEBUGGING -----\n\n"; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + print "\n----- TEST RUN, NO UPDATES -----\n\n"; + } + } +} +else +{ +# print "no command line options set\n"; +} +### end parsing run-time options ### + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + + +if (!$VARDB_port) {$VARDB_port='3306';} + + use DBI; + + $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + + if ($DB) {print " - cleaning up pause time\n";} + ### Grab any pause time record greater than 43999 + $stmtA = "SELECT agent_log_id,pause_epoch,wait_epoch from vicidial_agent_log where pause_sec>43999;"; + if ($DBX) {print "$stmtA\n";} + #$dbhA->query("$stmtA"); + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + + $i=0; + while ($sthArows > $i) + { + @aryA = $sthA->fetchrow_array; + $DBout = ''; + $agent_log_id[$i] = "$aryA[0]"; + $pause_epoch[$i] = "$aryA[1]"; + $wait_epoch[$i] = "$aryA[2]"; + $pause_sec[$i] = int($wait_epoch[$i] - $pause_epoch[$i]); + if ( ($pause_sec[$i] < 0) || ($pause_sec[$i] > 43999) ) + { + $DBout = "Override output: $pause_sec[$i]"; + $pause_sec[$i] = 0; + } + if ($DBX) {print "$i - $agent_log_id[$i] |$wait_epoch[$i]|$pause_epoch[$i]|$pause_sec[$i]|$DBout|\n";} + $i++; + } + + $sthA->finish(); + + $h=0; + while ($h < $i) + { + $stmtA = "UPDATE vicidial_agent_log set pause_sec='$pause_sec[$h]' where agent_log_id='$agent_log_id[$h]';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + if (!$TEST) {$affected_rows = $dbhA->do($stmtA); } + $h++; + } + if ($DB) {print STDERR " Pause times fixed: $h\n";} + + + @agent_log_id=@MT; + @wait_epoch=@MT; + + if ($DBX) {print "\n\n";} + if ($DB) {print " - cleaning up wait time\n";} + ### Grab any pause time record greater than 43999 + $stmtA = "SELECT agent_log_id,wait_epoch,talk_epoch from vicidial_agent_log where wait_sec>43999;"; + if ($DBX) {print "$stmtA\n";} + + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + + $i=0; + while ( $sthArows > $i) + { + @aryA = $sthA->fetchrow_array; + $DBout = ''; + $agent_log_id[$i] = "$aryA[0]"; + $wait_epoch[$i] = "$aryA[1]"; + $talk_epoch[$i] = "$aryA[2]"; + $wait_sec[$i] = int($talk_epoch[$i] - $wait_epoch[$i]); + if ( ($wait_sec[$i] < 0) || ($wait_sec[$i] > 43999) ) + { + $DBout = "Override output: $wait_sec[$i]"; + $wait_sec[$i] = 0; + } + if ($DBX) {print "$i - $agent_log_id[$i] |$talk_epoch[$i]|$wait_epoch[$i]|$wait_sec[$i]|$DBout|\n";} + $i++; + } + $sthA->finish(); + + $h=0; + while ($h < $i) + { + $stmtA = "UPDATE vicidial_agent_log set wait_sec='$wait_sec[$h]' where agent_log_id='$agent_log_id[$h]';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + if (!$TEST) {$affected_rows = $dbhA->do($stmtA); } + $h++; + } + if ($DB) {print STDERR " Wait times fixed: $h\n";} + + + @agent_log_id=@MT; + @talk_epoch=@MT; + + if ($DBX) {print "\n\n";} + if ($DB) {print " - cleaning up talk time\n";} + ### Grab any pause time record greater than 43999 + $stmtA = "SELECT agent_log_id,talk_epoch,dispo_epoch from vicidial_agent_log where talk_sec>43999;"; + if ($DBX) {print "$stmtA\n";} + + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + + $i=0; + while ( $sthArows > $i) + { + @aryA = $sthA->fetchrow_array; + $DBout = ''; + $agent_log_id[$i] = "$aryA[0]"; + $talk_epoch[$i] = "$aryA[1]"; + $dispo_epoch[$i] = "$aryA[2]"; + $talk_sec[$i] = int($dispo_epoch[$i] - $talk_epoch[$i]); + if ( ($talk_sec[$i] < 0) || ($talk_sec[$i] > 43999) ) + { + $DBout = "Override output: $talk_sec[$i]"; + $talk_sec[$i] = 0; + } + if ($DBX) {print "$i - $agent_log_id[$i] |$dispo_epoch[$i]|$talk_epoch[$i]|$talk_sec[$i]|$DBout|\n";} + $i++; + } + $sthA->finish(); + + $h=0; + while ($h < $i) + { + $stmtA = "UPDATE vicidial_agent_log set talk_sec='$talk_sec[$h]' where agent_log_id='$agent_log_id[$h]';"; + if($DBX){print STDERR "|$stmtA|\n";} + if (!$TEST) {$affected_rows = $dbhA->do($stmtA); } + $h++; + } + if ($DB) {print STDERR " Talk times fixed: $h\n";} + + + + @agent_log_id=@MT; + @dispo_epoch=@MT; + + if ($DBX) {print "\n\n";} + if ($DB) {print " - cleaning up dispo time\n";} + $stmtA = "UPDATE vicidial_agent_log set dispo_sec='0' where dispo_sec>43999;"; + if($DBX){print STDERR "|$stmtA|\n";} + if (!$TEST) + { + $affected_rows = $dbhA->do($stmtA); + } + if ($DB) {print STDERR " Bad Dispo times zeroed out: $affected_rows\n";} + + + if ($DB) {print STDERR "\nDONE\n";} + + + +# $dbhA->close; + + +exit; + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/bin/AST_conf_update.pl b/agc_2-X/branches/agc_2.0.4/bin/AST_conf_update.pl new file mode 100644 index 00000000..9f0cdbcf --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/AST_conf_update.pl @@ -0,0 +1,267 @@ +#!/usr/bin/perl +# +# AST_conf_update.pl version 0.4 *DBI-version* +# +# DESCRIPTION: +# uses the Asterisk Manager interface and Net::MySQL to update whether a conference +# is still in use or not. If not in use 3 times in a row the extension in the +# conferences DB record is erased freeing that conference to be used again +# +# SUMMARY: +# This program was designed for people using the Asterisk PBX with conferences +# +# This program should be in the cron running every minute (like AST_vm_update.pl) +# +# For this program to work you need to have the "asterisk" MySQL database +# created with the conferences table in it, also make sure +# that the account running this program has read/write/update/delete access +# to that database +# +# It is recommended that you run this program on the local Asterisk machine +# +# If this script is run ever minute there is a theoretical limit of +# 600 conferences that it can check due to the wait interval. If you have +# more than this either change the cron when this script is run or change the +# wait interval below +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# 50810-1532 - Added database server variable definitions lookup +# 50823-1456 - Added commandline arguments for debug at runtime +# 60717-1135 - changed to DBI by Marin Blu +# 60717-1536 - changed to use /etc/astguiclient.conf for configs +# + +# constants +$DB=0; # Debug flag, set to 0 for no debug messages per minute +$US='__'; +$MT[0]=''; + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-debug/i) + { + $DB=1; # Debug flag + print "-- DEBUGGING ENABLED --\n\n"; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +# print "no command line options set\n"; +} +### end parsing run-time options ### + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} + +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use DBI; +use Net::Telnet (); + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### Grab Server values from the database +$stmtA = "SELECT telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERNAMEupdate,ASTmgrUSERNAMElisten,ASTmgrUSERNAMEsend,max_vicidial_trunks,answer_transfer_agent,local_gmt,ext_context FROM servers where server_ip = '$server_ip';"; +if ($DB) {print "|$stmtA|\n";} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $DBtelnet_host = "$aryA[0]"; + $DBtelnet_port = "$aryA[1]"; + $DBASTmgrUSERNAME = "$aryA[2]"; + $DBASTmgrSECRET = "$aryA[3]"; + $DBASTmgrUSERNAMEupdate = "$aryA[4]"; + $DBASTmgrUSERNAMElisten = "$aryA[5]"; + $DBASTmgrUSERNAMEsend = "$aryA[6]"; + $DBmax_vicidial_trunks = "$aryA[7]"; + $DBanswer_transfer_agent= "$aryA[8]"; + $DBSERVER_GMT = "$aryA[9]"; + $DBext_context = "$aryA[10]"; + if ($DBtelnet_host) {$telnet_host = $DBtelnet_host;} + if ($DBtelnet_port) {$telnet_port = $DBtelnet_port;} + if ($DBASTmgrUSERNAME) {$ASTmgrUSERNAME = $DBASTmgrUSERNAME;} + if ($DBASTmgrSECRET) {$ASTmgrSECRET = $DBASTmgrSECRET;} + if ($DBASTmgrUSERNAMEupdate) {$ASTmgrUSERNAMEupdate = $DBASTmgrUSERNAMEupdate;} + if ($DBASTmgrUSERNAMElisten) {$ASTmgrUSERNAMElisten = $DBASTmgrUSERNAMElisten;} + if ($DBASTmgrUSERNAMEsend) {$ASTmgrUSERNAMEsend = $DBASTmgrUSERNAMEsend;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBext_context) {$ext_context = $DBext_context;} + } + $sthA->finish(); + + + +@PTextensions=@MT; @PT_conf_extens=@MT; @PTmessages=@MT; @PTold_messages=@MT; @NEW_messages=@MT; @OLD_messages=@MT; +$stmtA = "SELECT extension,conf_exten from conferences where server_ip='$server_ip' and extension is NOT NULL and extension != '';"; +if ($DB) {print "|$stmtA|\n";} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $PTextensions[$rec_count] = "$aryA[0]"; + $PT_conf_extens[$rec_count] = "$aryA[1]"; + if ($DB) {print "|$PT_conf_extens[$rec_count]|$PTextensions[$rec_count]|\n";} + $rec_count++; + } + $sthA->finish(); + +if (!$telnet_port) {$telnet_port = '5038';} + +### connect to asterisk manager through telnet +$t = new Net::Telnet (Port => $telnet_port, + Prompt => '/.*[\$%#>] $/', + Output_record_separator => '',); +#$fh = $t->dump_log("$telnetlog"); # uncomment for telnet log + if (length($ASTmgrUSERNAMEsend) > 3) {$telnet_login = $ASTmgrUSERNAMEsend;} + else {$telnet_login = $ASTmgrUSERNAME;} + +$t->open("$telnet_host"); +$t->waitfor('/0\n$/'); # print login +$t->print("Action: Login\nUsername: $telnet_login\nSecret: $ASTmgrSECRET\n\n"); +$t->waitfor('/Authentication accepted/'); # waitfor auth accepted + + +$i=0; +foreach(@PTextensions) + { + @list_channels=@MT; + $t->buffer_empty; + $COMMAND = "Action: Command\nCommand: Meetme list $PT_conf_extens[$i]\n\nAction: Ping\n\n"; + if ($DB) {print "|$PT_conf_extens[$i]|$COMMAND|\n";} + @list_channels = $t->cmd(String => "$COMMAND", Prompt => '/Response: Pong.*/'); + + + $j=0; + $conf_empty[$i]=0; + $conf_users[$i]=''; + foreach(@list_channels) + { + if($DB){print "|$list_channels[$j]|\n";} + if ($list_channels[$j] =~ /No active conferences|No such conference/i) + {$conf_empty[$i]++;} +# if ($list_channels[$j] =~ /^User /i) +# { +# $userx = ''; +# $userx = $list_channels[$j]; +# $userx =~ s/User \#: //gi; +# $conf_users[$i] .= "$userx|"; +# } + $j++; + } + + if($DB){print "Meetme list $PT_conf_extens[$i]- Exten:|$PTextensions[$i]| Empty:|$conf_empty[$i]| ";} + if (!$conf_empty[$i]) + { + if($DB){print "CONFERENCE STILL HAS PARTICIPANTS, DOING NOTHING FOR THIS CONFERENCE\n";} + if ($PTextensions[$i] =~ /Xtimeout\d$/i) + { + $PTextensions[$i] =~ s/Xtimeout\d$//gi; + $stmtA = "UPDATE conferences set extension='$PTextensions[$i]' where server_ip='$server_ip' and conf_exten='$PT_conf_extens[$i]';"; + if($DB){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n"; + } + } + else + { + $NEWexten[$i] = $PTextensions[$i]; + if ($PTextensions[$i] =~ /Xtimeout3$/i) {$NEWexten[$i] =~ s/Xtimeout3$/Xtimeout2/gi;} + if ($PTextensions[$i] =~ /Xtimeout2$/i) {$NEWexten[$i] =~ s/Xtimeout2$/Xtimeout1/gi;} + if ($PTextensions[$i] =~ /Xtimeout1$/i) {$NEWexten[$i] = '';} + if ( ($PTextensions[$i] !~ /Xtimeout\d$/i) and (length($PTextensions[$i])> 0) ) {$NEWexten[$i] .= 'Xtimeout3';} + + + $stmtA = "UPDATE conferences set extension='$NEWexten[$i]' where server_ip='$server_ip' and conf_exten='$PT_conf_extens[$i]';"; + if($DB){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n"; + } + + $i++; + ### sleep for 10 hundredths of a second + usleep(1*100*1000); + } + + +$t->buffer_empty; +@hangup = $t->cmd(String => "Action: Logoff\n\n", Prompt => "/.*/"); +$t->buffer_empty; +$ok = $t->close; + +$dbhA->disconnect(); + +if($DB){print "DONE... Exiting... Goodbye... See you later... \n";} + +exit; + + + + diff --git a/agc_2-X/branches/agc_2.0.4/bin/AST_flush_DBqueue.pl b/agc_2-X/branches/agc_2.0.4/bin/AST_flush_DBqueue.pl new file mode 100644 index 00000000..78571352 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/AST_flush_DBqueue.pl @@ -0,0 +1,235 @@ +#!/usr/bin/perl +# +# AST_flush_DBqueue.pl version 0.3 *DBI-version* +# +# DESCRIPTION: +# - clears out mysql records for this server for the ACQS vicidial_manager table +# - optimizes tables used frequently by VICIDIAL +# +# It is recommended that you run this program on the local Asterisk machine +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# CHANGES +# 60717-1214 - changed to DBI by Marin Blu +# 60717-1536 - changed to use /etc/astguiclient.conf for configs +# 60910-0238 - removed park_log query +# + +$secX = time(); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $yy = $year; $yy =~ s/^..//gi; + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} +$SQLdate_NOW="$year-$mon-$mday $hour:$min:$sec"; + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time()-3600); + $year = ($year + 1900); + $yy = $year; $yy =~ s/^..//gi; + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} +$SQLdate_NEG_1hour="$year-$mon-$mday $hour:$min:$sec"; + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time()-1800); + $year = ($year + 1900); + $yy = $year; $yy =~ s/^..//gi; + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} +$SQLdate_NEG_halfhour="$year-$mon-$mday $hour:$min:$sec"; + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [--debug] = debugging messages\n\n"; + } + else + { + if ($args =~ /-q/i) + { + $q=1; $Q=1; + } + if ($args =~ /--debug/i) + { + $DB=1; + print "\n-----DEBUGGING -----\n\n"; + } + if ($args =~ /-t|--test/i) + { + $T=1; $TEST=1; + print "\n-----TESTING -----\n\n"; + } + } +} +else +{ +print "no command line options set\n"; +} +### end parsing run-time options ### + + +if (!$Q) {print "TEST\n\n";} +if (!$Q) {print "NOW DATETIME: $SQLdate_NOW\n";} +if (!$Q) {print "1 HOUR AGO DATETIME: $SQLdate_NEG_1hour\n\n";} + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} + +use DBI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### Grab Server values from the database + $stmtA = "SELECT vd_server_logs FROM servers where server_ip = '$VARserver_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBvd_server_logs = "$aryA[0]"; + if ($DBvd_server_logs =~ /Y/) {$SYSLOG = '1';} + else {$SYSLOG = '0';} + $rec_count++; + } + $sthA->finish(); + +if ($SYSLOG) + {$flush_time = $SQLdate_NEG_1hour;} +else + {$flush_time = $SQLdate_NEG_halfhour;} + + $stmtA = "delete from vicidial_manager where server_ip='$server_ip' and entry_date < '$flush_time';"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { $affected_rows = $dbhA->do($stmtA);} + if (!$Q) {print " - vicidial_manager flush\n";} + + $stmtA = "optimize table vicidial_manager;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) + { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } + if (!$Q) {print " - optimize vicidial_manager \n";} + + + $stmtA = "optimize table vicidial_live_agents;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } + if (!$Q) {print " - optimize vicidial_live_agents \n";} + + + $stmtA = "optimize table vicidial_auto_calls;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $rec_countY++; + $sthA->finish(); + } + if (!$Q) {print " - optimize vicidial_auto_calls \n";} + + + $stmtA = "optimize table vicidial_hopper;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } + if (!$Q) {print " - optimize vicidial_hopper \n";} + + + + + $dbhA->disconnect(); + + +exit; + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/bin/AST_manager_kill_hung_congested.pl b/agc_2-X/branches/agc_2.0.4/bin/AST_manager_kill_hung_congested.pl new file mode 100644 index 00000000..38fb2d0d --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/AST_manager_kill_hung_congested.pl @@ -0,0 +1,385 @@ +#!/usr/bin/perl +# +# AST_manager_kill_hung_congested.pl version 0.3 *DBI-version* +# +# Part of the Asterisk Central Queue System (ACQS) +# +# DESCRIPTION: +# kills CONGEST local channels every 15 seconds +# +# For the client program to work in ACQS mode, this program must be running +# +# For this program to work you need to have the "asterisk" MySQL database +# created and create the tables listed in the CONF_MySQL.txt file, also make sure +# that the machine running this program has read/write/update/delete access +# to that database +# +# In your Asterisk server setup you also need to have several things activated +# and defined. See the CONF_Asterisk.txt file for details +# +# put this in the cron to run every minute +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# CHANGES +# 50823-1525 - Added commandline debug options with debug printouts +# 60717-1247 - changed to DBI by Marin Blu +# 60717-1536 - changed to use /etc/astguiclient.conf for configs +# 60814-1706 - added option for no logging to file +# + +# constants +$DB=0; # Debug flag, set to 0 for no debug messages, On an active system this will generate thousands of lines of output per minute +$US='__'; +$MT[0]=''; + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-t] = test\n [-debug] = verbose debug messages\n[-debugX] = Extra-verbose debug messages\n\n"; + } + else + { + if ($args =~ /-debug/i) + { + $DB=1; # Debug flag + } + if ($args =~ /--debugX/i) + { + $DBX=1; + print "\n----- SUPER-DUPER DEBUGGING -----\n\n"; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +# print "no command line options set\n"; +} +### end parsing run-time options ### + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} + + &get_time_now; + +if (!$KHLOGfile) {$KHLOGfile = "$PATHlogs/congest.$year-$mon-$mday";} + +use DBI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### Grab Server values from the database + $stmtA = "SELECT vd_server_logs FROM servers where server_ip = '$VARserver_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBvd_server_logs = "$aryA[0]"; + if ($DBvd_server_logs =~ /Y/) {$SYSLOG = '1';} + else {$SYSLOG = '0';} + $rec_count++; + } + $sthA->finish(); + +$stmtA = "SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = 'CONGEST' and channel LIKE \"Local%\" limit 99"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + if($DB){print STDERR $aryA[0],"\n";} + $congest_kill[$rec_count] = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + + + +$i=0; +foreach(@congest_kill) + { + $i_count = $i; + if ($i_count < 10) {$i_count = "0$i_count";} + + if (length($congest_kill[$i])>0) + { + ### use manager middleware-app to zapbarge call being placed from meetme + $KCqueryCID = "KC$i_count$CIDdate"; + + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$server_ip','','Hangup','$KCqueryCID','Channel: $congest_kill[$i]','','','','','','','','','')"; + + $event_string = "SUBRT|killing_congest|KC|$KCqueryCID|$congest_kill[$i]|$stmtA|"; + event_logger; + + if ($DB) {print "KILLING $congest_kill[$i]\n";} + $affected_rows = $dbhA->do($stmtA); + } + $i++; + } + + +sleep(14); + +######## 22222 starting another loop + &get_time_now; +@congest_kill = @MT; + + + +$stmtA = "SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = 'CONGEST' and channel LIKE \"Local%\" limit 99"; +# $event_string="SQL_QUERY|$stmtA|"; +# &event_logger; + +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + if($DB){print STDERR $aryA[0],"\n";} + $congest_kill[$rec_count] = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + +$i=0; +foreach(@congest_kill) + { + $i_count = $i; + if ($i_count < 10) {$i_count = "0$i_count";} + + if (length($congest_kill[$i])>0) + { + ### use manager middleware-app to zapbarge call being placed from meetme + $KCqueryCID = "KC$i_count$CIDdate"; + + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$server_ip','','Hangup','$KCqueryCID','Channel: $congest_kill[$i]','','','','','','','','','')"; + + $event_string = "SUBRT|killing_congest|KC|$KCqueryCID|$congest_kill[$i]|$stmtA|"; + event_logger; + + if ($DB) {print "KILLING $congest_kill[$i]\n";} + $affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:\n"; + } + $i++; + } + + +sleep(15); + +######## 33333 starting another loop + &get_time_now; +@congest_kill = @MT; + + + + +$stmtA = "SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = 'CONGEST' and channel LIKE \"Local%\" limit 99"; +# $event_string="SQL_QUERY|$stmtA|"; +# &event_logger; + +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + if($DB){print STDERR $aryA[0],"\n";} + $congest_kill[$rec_count] = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + +$i=0; +foreach(@congest_kill) + { + $i_count = $i; + if ($i_count < 10) {$i_count = "0$i_count";} + + if (length($congest_kill[$i])>0) + { + ### use manager middleware-app to zapbarge call being placed from meetme + $KCqueryCID = "KC$i_count$CIDdate"; + + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$server_ip','','Hangup','$KCqueryCID','Channel: $congest_kill[$i]','','','','','','','','','')"; + + $event_string = "SUBRT|killing_congest|KC|$KCqueryCID|$congest_kill[$i]|$stmtA|"; + event_logger; + + if ($DB) {print "KILLING $congest_kill[$i]\n";} + $affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:\n"; + } + $i++; + } + + +sleep(15); + +######## 44444 starting another loop + &get_time_now; +@congest_kill = @MT; + + + + + +$stmtA = "SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = 'CONGEST' and channel LIKE \"Local%\" limit 99"; +# $event_string="SQL_QUERY|$stmtA|"; +# &event_logger; + +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + if($DB){print STDERR $aryA[0],"\n";} + $congest_kill[$rec_count] = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + + +$i=0; +foreach(@congest_kill) + { + $i_count = $i; + if ($i_count < 10) {$i_count = "0$i_count";} + + if (length($congest_kill[$i])>0) + { + ### use manager middleware-app to zapbarge call being placed from meetme + $KCqueryCID = "KC$i_count$CIDdate"; + + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$server_ip','','Hangup','$KCqueryCID','Channel: $congest_kill[$i]','','','','','','','','','')"; + + $event_string = "SUBRT|killing_congest|KC|$KCqueryCID|$congest_kill[$i]|$stmtA|"; + event_logger; + + if ($DB) {print "KILLING $congest_kill[$i]\n";} + $affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:\n"; + } + $i++; + } + + + +# $event_string='CLOSING DB CONNECTION|'; +# &event_logger; + +$dbhA->disconnect(); + + + if($DB){print "DONE... Exiting... Goodbye... See you later... \n";} + + +exit; + + + + + + + +sub get_time_now #get the current date and time and epoch for logging call lengths and datetimes +{ +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$action_log_date = "$year-$mon-$mday"; +$CIDdate = "$year$mon$mday$hour$min$sec"; +} + + + + + +sub event_logger +{ +if ($SYSLOG) + { + ### open the log file for writing ### + open(Lout, ">>$KHLOGfile") + || die "Can't open $KHLOGfile: $!\n"; + print Lout "$now_date|$event_string|\n"; + close(Lout); + } +$event_string=''; +} diff --git a/agc_2-X/branches/agc_2.0.4/bin/AST_manager_listen.pl b/agc_2-X/branches/agc_2.0.4/bin/AST_manager_listen.pl new file mode 100644 index 00000000..4a672d43 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/AST_manager_listen.pl @@ -0,0 +1,702 @@ +#!/usr/bin/perl +# +# AST_manager_listen.pl version 2.0.4 *DBI-version* +# +# Part of the Asterisk Central Queue System (ACQS) +# +# DESCRIPTION: +# connects to the Asterisk Manager interface and updates records in the +# vicidial_manager table of the asterisk database in MySQL based upon the +# events that it receives +# +# SUMMARY: +# This program was designed as the listen-only part of the ACQS. It's job is to +# look for certain events and based upon either the uniqueid or the callerid of +# the call update the status and information of an action record in the +# vicidial_manager table of the asterisk MySQL database. +# +# For this program to work you need to have the "asterisk" MySQL database +# created and create the tables listed in the CONF_MySQL.txt file, also make sure +# that the machine running this program has read/write/update/delete access +# to that database +# +# In your Asterisk server setup you also need to have several things activated +# and defined. See the CONF_Asterisk.txt file for details +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# CHANGES +# 50322-1300 - changed callerid parsing to remove quotes and number +# 50616-1559 - Added NewCallerID parsing and updating +# 50621-1406 - Added Asterisk server shutdown and connection dead detection +# 50810-1534 - Added database server variable definitions lookup +# 50824-1606 - Altered CVS/1.2 support for different output +# 50901-2359 - Another CVS/1.2 output parsing fix +# 51222-1553 - fixed parentheses bug in manager output +# 60403-1230 - Added SVN/1.4 support for different output +# 60718-0909 - changed to DBI by Marin Blu +# 60718-0955 - changed to use /etc/astguiclient.conf for configs +# 60720-1142 - added keepalive to MySQL connection every 50 seconds +# 60814-1733 - added option for no logging to file +# 60906-1714 - added updating for special vicidial conference calls +# 71129-2004 - Fixed SQL error +# + +# constants +$DB=1; # Debug flag, set to 0 for no debug messages, lots of output +$US='__'; +$MT[0]=''; + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-t] = test\n [-debug] = verbose debug messages\n[-debugX] = Extra-verbose debug messages\n\n"; + } + else + { + if ($args =~ /-debug/i) + { + $DB=1; # Debug flag + } + if ($args =~ /--debugX/i) + { + $DBX=1; + print "\n----- SUPER-DUPER DEBUGGING -----\n\n"; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +# print "no command line options set\n"; +} +### end parsing run-time options ### + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} + + &get_time_now; + +#use lib './lib', '../lib'; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use DBI; +use Net::Telnet (); + + $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### Grab Server values from the database +$stmtA = "SELECT telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERNAMEupdate,ASTmgrUSERNAMElisten,ASTmgrUSERNAMEsend,max_vicidial_trunks,answer_transfer_agent,local_gmt,ext_context,vd_server_logs FROM servers where server_ip = '$server_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBtelnet_host = "$aryA[0]"; + $DBtelnet_port = "$aryA[1]"; + $DBASTmgrUSERNAME = "$aryA[2]"; + $DBASTmgrSECRET = "$aryA[3]"; + $DBASTmgrUSERNAMEupdate = "$aryA[4]"; + $DBASTmgrUSERNAMElisten = "$aryA[5]"; + $DBASTmgrUSERNAMEsend = "$aryA[6]"; + $DBmax_vicidial_trunks = "$aryA[7]"; + $DBanswer_transfer_agent= "$aryA[8]"; + $DBSERVER_GMT = "$aryA[9]"; + $DBext_context = "$aryA[10]"; + $DBvd_server_logs = "$aryA[11]"; + if ($DBtelnet_host) {$telnet_host = $DBtelnet_host;} + if ($DBtelnet_port) {$telnet_port = $DBtelnet_port;} + if ($DBASTmgrUSERNAME) {$ASTmgrUSERNAME = $DBASTmgrUSERNAME;} + if ($DBASTmgrSECRET) {$ASTmgrSECRET = $DBASTmgrSECRET;} + if ($DBASTmgrUSERNAMEupdate) {$ASTmgrUSERNAMEupdate = $DBASTmgrUSERNAMEupdate;} + if ($DBASTmgrUSERNAMElisten) {$ASTmgrUSERNAMElisten = $DBASTmgrUSERNAMElisten;} + if ($DBASTmgrUSERNAMEsend) {$ASTmgrUSERNAMEsend = $DBASTmgrUSERNAMEsend;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBext_context) {$ext_context = $DBext_context;} + if ($DBvd_server_logs =~ /Y/) {$SYSLOG = '1';} + else {$SYSLOG = '0';} + $rec_count++; + } +$sthA->finish(); + +if (!$telnet_port) {$telnet_port = '5038';} + + $event_string='LOGGED INTO MYSQL SERVER ON 1 CONNECTION|'; + &event_logger; + +$one_day_interval = 90; # 1 day loops for 3 months +while($one_day_interval > 0) +{ + + $event_string="STARTING NEW MANAGER TELNET CONNECTION||ATTEMPT|ONE DAY INTERVAL:$one_day_interval|"; + &event_logger; +# Errmode => Return, + + ### connect to asterisk manager through telnet + $tn = new Net::Telnet (Port => $telnet_port, + Prompt => '/.*[\$%#>] $/', + Output_record_separator => '',); + #$LItelnetlog = "$PATHlogs/listen_telnet_log.txt" # uncomment for telnet log + #$fh = $tn->dump_log("$LItelnetlog"); # uncomment for telnet log + if (length($ASTmgrUSERNAMElisten) > 3) {$telnet_login = $ASTmgrUSERNAMElisten;} + else {$telnet_login = $ASTmgrUSERNAME;} + $tn->open("$telnet_host"); + $tn->waitfor('/0\n$/'); # print login + $tn->print("Action: Login\nUsername: $telnet_login\nSecret: $ASTmgrSECRET\n\n"); + $tn->waitfor('/Authentication accepted/'); # waitfor auth accepted + + $tn->buffer_empty; + + $event_string="STARTING NEW MANAGER TELNET CONNECTION|$telnet_login|CONFIRMED CONNECTION|ONE DAY INTERVAL:$one_day_interval|"; + &event_logger; + + $endless_loop=864000; # 1 day at .10 seconds per loop + + while($endless_loop > 0) + { + ### sleep for 10 hundredths of a second + usleep(1*100*1000); + + $msg=''; + $read_input_buf = $tn->get(Errmode => Return, Timeout => 1,); + $input_buf_length = length($read_input_buf); + $msg = $tn->errmsg; + if ($msg =~ /filehandle isn\'t open/i) + { + $endless_loop=0; + $one_day_interval=0; + print "ERRMSG: |$msg|\n"; + print "\nAsterisk server shutting down, PROCESS KILLED... EXITING\n\n"; + $event_string="Asterisk server shutting down, PROCESS KILLED... EXITING|ONE DAY INTERVAL:$one_day_interval|$msg|"; + &event_logger; + } + + if ( ($read_input_buf !~ /\n\n/) or ($input_buf_length < 10) ) + { + # if ($read_input_buf =~ /\n/) {print "\n|||$input_buf_length|||$read_input_buf|||\n";} + $input_buf = "$input_buf$read_input_buf"; + } + else + { + $partial=0; + $partial_input_buf=''; + + if ($read_input_buf !~ /\n\n$/) + { + $read_input_buf =~ s/\(|\)/ /gi; # replace parens with space + $partial_input_buf = $read_input_buf; + $partial_input_buf =~ s/\n/-----/gi; + $partial_input_buf =~ s/\*/\\\*/gi; + $partial_input_buf =~ s/.*----------//gi; + $partial_input_buf =~ s/-----/\n/gi; + $read_input_buf =~ s/$partial_input_buf$//gi; + $partial++; + } + + $input_buf = "$input_buf$read_input_buf"; + @input_lines = split(/\n\n/, $input_buf); + + if($DB){print "input buffer: $input_buf_length lines: $#input_lines partial: $partial\n";} + if ( ($DB) && ($partial) ) {print "-----[$partial_input_buf]-----\n\n";} + if($DB){print "|$input_buf|\n";} + + $manager_string = "$input_buf"; + &manager_output_logger; + + $input_buf = "$partial_input_buf"; + + + @command_line=@MT; + $ILcount=0; + foreach(@input_lines) + { + ##### look for special vicidial conference call event ##### + if ( ($input_lines[$ILcount] =~ /CallerIDName: DCagcW/) && ($input_lines[$ILcount] =~ /Event: Dial|State: Up/) ) + { + ### BEGIN 1.2.X tree versions + $input_lines[$ILcount] =~ s/^\n|^\n\n//gi; + @command_line=split(/\n/, $input_lines[$ILcount]); + + if ($input_lines[$ILcount] =~ /Event: Dial/) + { + if ($command_line[3] =~ /Destination: /i) + { + $channel = $command_line[3]; + $channel =~ s/Destination: |\s*$//gi; + $callid = $command_line[5]; + $callid =~ s/CallerIDName: |\s*$//gi; + $callid =~ s/^\"//gi; $callid =~ s/\".*$//gi; + $uniqueid = $command_line[6]; + $uniqueid =~ s/SrcUniqueID: |\s*$//gi; + $stmtA = "UPDATE vicidial_manager set status='UPDATED', channel='$channel', uniqueid = '$uniqueid' where server_ip = '$server_ip' and callerid = '$callid'"; + if ($channel !~ /local/i) + { + print STDERR "|$stmtA|\n"; + my $affected_rows = $dbhA->do($stmtA); + if($DB){print "|$affected_rows Conference DIALs updated|\n";} + } + } + } + if ($input_lines[$ILcount] =~ /State: Up/) + { + if ($command_line[2] =~ /Channel: /i) + { + $channel = $command_line[2]; + $channel =~ s/Channel: |\s*$//gi; + $callid = $command_line[5]; + $callid =~ s/CallerIDName: |\s*$//gi; + $callid =~ s/^\"//gi; $callid =~ s/\".*$//gi; + $uniqueid = $command_line[6]; + $uniqueid =~ s/SrcUniqueID: |\s*$//gi; + $stmtA = "UPDATE vicidial_manager set status='UPDATED', channel='$channel', uniqueid = '$uniqueid' where server_ip = '$server_ip' and callerid = '$callid' and status='SENT';"; + print STDERR "|$stmtA|\n"; + my $affected_rows = $dbhA->do($stmtA); + if($DB){print "|$affected_rows Conference DIALs updated|\n";} + } + } + ### END 1.2.X tree versions + + } + + ##### parse through all other important events ##### + if ( ($input_lines[$ILcount] =~ /State: Ringing|State: Up|State: Dialing|Event: Newstate|Event: Hangup|Event: Newcallerid|Event: Shutdown/) && ($input_lines[$ILcount] !~ /ZOMBIE/) ) + { + $input_lines[$ILcount] =~ s/^\n|^\n\n//gi; + @command_line=split(/\n/, $input_lines[$ILcount]); + if ($input_lines[$ILcount] =~ /Event: Shutdown/) + { + $endless_loop=0; + $one_day_interval=0; + print "\nAsterisk server shutting down, PROCESS KILLED... EXITING\n\n"; + $event_string="Asterisk server shutting down, PROCESS KILLED... EXITING|ONE DAY INTERVAL:$one_day_interval|"; + &event_logger; + } + + if ($input_lines[$ILcount] =~ /Event: Hangup/) + { + if ( ($command_line[2] =~ /^Channel: /i) && ($command_line[3] =~ /^Uniqueid: /i) ) ### post 2005-08-07 CVS -- added Privilege line + { + $channel = $command_line[2]; + $channel =~ s/Channel: |\s*$//gi; + $uniqueid = $command_line[3]; + $uniqueid =~ s/Uniqueid: |\s*$//gi; + $stmtA = "UPDATE vicidial_manager set status='DEAD', channel='$channel' where server_ip = '$server_ip' and uniqueid = '$uniqueid' and callerid NOT LIKE \"DCagcW%\";"; + + print STDERR "|$stmtA|\n"; + my $affected_rows = $dbhA->do($stmtA); + + if($DB){print "|$affected_rows HANGUPS updated|\n";} + } + else + { + if ( ($command_line[3] =~ /^Channel: /i) && ($command_line[4] =~ /^Uniqueid: /i) ) ### post 2006-03-20 SVN -- Added Timestamp line + { + $channel = $command_line[3]; + $channel =~ s/Channel: |\s*$//gi; + $uniqueid = $command_line[4]; + $uniqueid =~ s/Uniqueid: |\s*$//gi; + $stmtA = "UPDATE vicidial_manager set status='DEAD', channel='$channel' where server_ip = '$server_ip' and uniqueid = '$uniqueid' and callerid NOT LIKE \"DCagcW%\";"; + + print STDERR "|$stmtA|\n"; + my $affected_rows = $dbhA->do($stmtA); + if($DB){print "|$affected_rows HANGUPS updated|\n";} + } + else + { + $channel = $command_line[1]; + $channel =~ s/Channel: |\s*$//gi; + $uniqueid = $command_line[2]; + $uniqueid =~ s/Uniqueid: |\s*$//gi; + $stmtA = "UPDATE vicidial_manager set status='DEAD', channel='$channel' where server_ip = '$server_ip' and uniqueid = '$uniqueid' and callerid NOT LIKE \"DCagcW%\";"; + + print STDERR "|$stmtA|\n"; + my $affected_rows = $dbhA->do($stmtA); + if($DB){print "|$affected_rows HANGUPS updated|\n";} + } + } + } + + if ($input_lines[$ILcount] =~ /State: Dialing/) + { + if ( ($command_line[1] =~ /^Channel: /i) && ($command_line[4] =~ /^Uniqueid: /i) ) ### pre 2004-10-07 CVS + { + $channel = $command_line[1]; + $channel =~ s/Channel: |\s*$//gi; + $callid = $command_line[3]; + $callid =~ s/Callerid: |\s*$//gi; + $callid =~ s/^\"//gi; $callid =~ s/\".*$//gi; + $uniqueid = $command_line[4]; + $uniqueid =~ s/Uniqueid: |\s*$//gi; + $stmtA = "UPDATE vicidial_manager set status='SENT', channel='$channel', uniqueid = '$uniqueid' where server_ip = '$server_ip' and callerid = '$callid'"; + print STDERR "|$stmtA|\n"; + my $affected_rows = $dbhA->do($stmtA); + + if($DB){print "|$affected_rows DIALINGs updated|\n";} + } + if ( ($command_line[1] =~ /^Channel: /i) && ($command_line[4] =~ /^CalleridName: /i) ) ### post 2004-10-07 CVS + { + $channel = $command_line[1]; + $channel =~ s/Channel: |\s*$//gi; + $callid = $command_line[4]; + $callid =~ s/CalleridName: |\s*$//gi; + $callid =~ s/^\"//gi; $callid =~ s/\".*$//gi; + $uniqueid = $command_line[5]; + $uniqueid =~ s/Uniqueid: |\s*$//gi; + $stmtA = "UPDATE vicidial_manager set status='SENT', channel='$channel', uniqueid = '$uniqueid' where server_ip = '$server_ip' and callerid = '$callid'"; + print STDERR "|$stmtA|\n"; + my $affected_rows = $dbhA->do($stmtA); + if($DB){print "|$affected_rows DIALINGs updated|\n";} + } + if ( ($command_line[2] =~ /^Channel: /i) && ($command_line[5] =~ /^CalleridName: /i) ) ### post 2005-08-07 CVS + { + $channel = $command_line[2]; + $channel =~ s/Channel: |\s*$//gi; + $callid = $command_line[5]; + $callid =~ s/CalleridName: |\s*$//gi; + $callid =~ s/^\"//gi; $callid =~ s/\".*$//gi; + $uniqueid = $command_line[6]; + $uniqueid =~ s/Uniqueid: |\s*$//gi; + $stmtA = "UPDATE vicidial_manager set status='SENT', channel='$channel', uniqueid = '$uniqueid' where server_ip = '$server_ip' and callerid = '$callid'"; + print STDERR "|$stmtA|\n"; + my $affected_rows = $dbhA->do($stmtA); + if($DB){print "|$affected_rows DIALINGs updated|\n";} + } + if ( ($command_line[3] =~ /^Channel: /i) && ($command_line[6] =~ /^CalleridName: /i) ) ### post 2006-03-20 -- Added Timestamp line + { + $channel = $command_line[3]; + $channel =~ s/Channel: |\s*$//gi; + $callid = $command_line[6]; + $callid =~ s/CalleridName: |\s*$//gi; + $callid =~ s/^\"//gi; $callid =~ s/\".*$//gi; + $uniqueid = $command_line[7]; + $uniqueid =~ s/Uniqueid: |\s*$//gi; + $stmtA = "UPDATE vicidial_manager set status='SENT', channel='$channel', uniqueid = '$uniqueid' where server_ip = '$server_ip' and callerid = '$callid'"; + print STDERR "|$stmtA|\n"; + my $affected_rows = $dbhA->do($stmtA); + if($DB){print "|$affected_rows DIALINGs updated|\n";} + } + } + if ($input_lines[$ILcount] =~ /State: Ringing|State: Up/) + { + if ( ($command_line[1] =~ /^Channel: /i) && ($command_line[4] =~ /^Uniqueid: /i) ) ### pre 2004-10-07 CVS + { + $channel = $command_line[1]; + $channel =~ s/Channel: |\s*$//gi; + $callid = $command_line[3]; + $callid =~ s/Callerid: |\s*$//gi; + $callid =~ s/^\"//gi; $callid =~ s/\".*$//gi; + $uniqueid = $command_line[4]; + $uniqueid =~ s/Uniqueid: |\s*$//gi; + $stmtA = "UPDATE vicidial_manager set status='UPDATED', channel='$channel', uniqueid = '$uniqueid' where server_ip = '$server_ip' and callerid = '$callid'"; + if ($channel !~ /local/i) + { + print STDERR "|$stmtA|\n"; + my $affected_rows = $dbhA->do($stmtA); + if($DB){print "|$affected_rows RINGINGs updated|\n";} + } + } + if ( ($command_line[1] =~ /^Channel: /i) && ($command_line[4] =~ /^CalleridName: /i) ) ### post 2004-10-07 CVS + { + $channel = $command_line[1]; + $channel =~ s/Channel: |\s*$//gi; + $callid = $command_line[4]; + $callid =~ s/CalleridName: |\s*$//gi; + $callid =~ s/^\"//gi; $callid =~ s/\".*$//gi; + $uniqueid = $command_line[5]; + $uniqueid =~ s/Uniqueid: |\s*$//gi; + $stmtA = "UPDATE vicidial_manager set status='UPDATED', channel='$channel', uniqueid = '$uniqueid' where server_ip = '$server_ip' and callerid = '$callid'"; + if ($channel !~ /local/i) + { + print STDERR "|$stmtA|\n"; + my $affected_rows = $dbhA->do($stmtA); + if($DB){print "|$affected_rows RINGINGs updated|\n";} + } + } + if ( ($command_line[2] =~ /^Channel: /i) && ($command_line[5] =~ /^CalleridName: /i) ) ### post 2005-08-07 CVS + { + $channel = $command_line[2]; + $channel =~ s/Channel: |\s*$//gi; + $callid = $command_line[5]; + $callid =~ s/CalleridName: |\s*$//gi; + $callid =~ s/^\"//gi; $callid =~ s/\".*$//gi; + $uniqueid = $command_line[6]; + $uniqueid =~ s/Uniqueid: |\s*$//gi; + $stmtA = "UPDATE vicidial_manager set status='UPDATED', channel='$channel', uniqueid = '$uniqueid' where server_ip = '$server_ip' and callerid = '$callid'"; + if ($channel !~ /local/i) + { + print STDERR "|$stmtA|\n"; + my $affected_rows = $dbhA->do($stmtA); + if($DB){print "|$affected_rows RINGINGs updated|\n";} + } + } + if ( ($command_line[3] =~ /^Channel: /i) && ($command_line[6] =~ /^CalleridName: /i) ) ### post 2006-03-20 SVN -- Added Timestamp line + { + $channel = $command_line[3]; + $channel =~ s/Channel: |\s*$//gi; + $callid = $command_line[6]; + $callid =~ s/CalleridName: |\s*$//gi; + $callid =~ s/^\"//gi; $callid =~ s/\".*$//gi; + $uniqueid = $command_line[7]; + $uniqueid =~ s/Uniqueid: |\s*$//gi; + $stmtA = "UPDATE vicidial_manager set status='UPDATED', channel='$channel', uniqueid = '$uniqueid' where server_ip = '$server_ip' and callerid = '$callid'"; + if ($channel !~ /local/i) + { + print STDERR "|$stmtA|\n"; + my $affected_rows = $dbhA->do($stmtA); + if($DB){print "|$affected_rows RINGINGs updated|\n";} + } + } + } + + if ($input_lines[$ILcount] =~ /Event: Newcallerid/) + { + if ( ($command_line[1] =~ /^Channel: /i) && ($command_line[3] =~ /^Uniqueid: /i) ) + { + $channel = $command_line[1]; + $channel =~ s/Channel: |\s*$//gi; + $callid = $command_line[2]; + $callid =~ s/Callerid: |\s*$//gi; + $callid =~ s/^\"//gi; $callid =~ s/\".*$//gi; + $uniqueid = $command_line[3]; + $uniqueid =~ s/Uniqueid: |\s*$//gi; + $stmtA = "UPDATE vicidial_manager set status='UPDATED', channel='$channel', uniqueid = '$uniqueid' where server_ip = '$server_ip' and callerid = '$callid'"; + if ($channel =~ /local/i) + { + print STDERR "|$stmtA|\n"; + my $affected_rows = $dbhA->do($stmtA); + if($DB){print "|$affected_rows RINGINGs updated|\n";} + } + } + if ( ($command_line[3] =~ /^Channel: /i) && ($command_line[6] =~ /^Uniqueid: /i) ) ### post 2006-03-20 SVN -- Added Timestamp line + { + $channel = $command_line[3]; + $channel =~ s/Channel: |\s*$//gi; + $callid = $command_line[5]; + $callid =~ s/Callerid: |\s*$//gi; + # $callid =~ s/CallerIDName: |\s*$//gi; + $callid =~ s/^\"//gi; $callid =~ s/\".*$//gi; + $uniqueid = $command_line[6]; + $uniqueid =~ s/Uniqueid: |\s*$//gi; + $stmtA = "UPDATE vicidial_manager set status='UPDATED', channel='$channel', uniqueid = '$uniqueid' where server_ip = '$server_ip' and callerid = '$callid'"; + if ($channel =~ /local/i) + { + print STDERR "|$stmtA|\n"; + my $affected_rows = $dbhA->do($stmtA); + if($DB){print "|$affected_rows RINGINGs updated|\n";} + } + } + # if ( ($command_line[2] =~ /^Channel: /i) && ($command_line[5] =~ /^Uniqueid: /i) ) ### post 2006-06-21 SVN -- Changed from CallerID to CallerIDName + # { + # $channel = $command_line[2]; + # $channel =~ s/Channel: |\s*$//gi; + # $callid = $command_line[4]; + # $callid =~ s/CallerIDName: |\s*$//gi; + # $callid =~ s/^\"//gi; $callid =~ s/\".*$//gi; + # $uniqueid = $command_line[5]; + # $uniqueid =~ s/Uniqueid: |\s*$//gi; + # $stmtA = "UPDATE vicidial_manager set status='UPDATED', channel='$channel', uniqueid = '$uniqueid' where server_ip = '$server_ip' and callerid = '$callid'"; + # if ($channel =~ /local/i) + # { + # print STDERR "|$stmtA|\n"; + # my $affected_rows = $dbhA->do($stmtA); + # if($DB){print "|$affected_rows RINGINGs updated|\n";} + # } + # } + } + + } + $ILcount++; + } + + } + + + $endless_loop--; + $keepalive_count_loop++; + if($DB){print STDERR "loop counter: |$endless_loop|$keepalive_count_loop|\r";} + + ### putting a blank file called "sendmgr.kill" in a directory will automatically safely kill this program + if ( (-e "$PATHhome/listenmgr.kill") or ($sendonlyone) ) + { + unlink("$PATHhome/listenmgr.kill"); + $endless_loop=0; + $one_day_interval=0; + print "\nPROCESS KILLED MANUALLY... EXITING\n\n"; + } + + ### run a keepalive command to flush whatever is in the buffer through and to keep the connection alive + ### Also, keep the MySQL connection alive by selecting the server_updater time for this server + if ($endless_loop =~ /00$|50$/) + { + &get_time_now; + + ### Grab Server values from the database + $stmtA = "SELECT vd_server_logs FROM servers where server_ip = '$VARserver_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBvd_server_logs = "$aryA[0]"; + if ($DBvd_server_logs =~ /Y/) {$SYSLOG = '1';} + else {$SYSLOG = '0';} + $rec_count++; + } + $sthA->finish(); + + ### Grab Server values to keep DB connection alive + $stmtA = "SELECT last_update FROM server_updater where server_ip = '$server_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + @aryA = $sthA->fetchrow_array; + $last_update = "$aryA[0]"; + $sthA->finish(); + + @list_lines = $tn->cmd(String => "Action: Command\nCommand: show uptime\n\n", Prompt => '/--END COMMAND--.*/', Errmode => Return, Timeout => 1); + if($DB){print "input lines: $#list_lines\n";} + + if($DB){print "+++++++++++++++++++++++++++++++sending keepalive transmit line $endless_loop|$now_date|$last_update|\n";} + $keepalive_count_loop=0; + + } + + + } + + + if($DB){print "DONE... Exiting... Goodbye... See you later... Not really, initiating next loop...$one_day_interval left\n";} + + $event_string='HANGING UP|'; + &event_logger; + + @hangup = $tn->cmd(String => "Action: Logoff\n\n", Prompt => "/.*/", Errmode => Return, Timeout => 1); + + $ok = $tn->close; + + $one_day_interval--; + +} + + $event_string='CLOSING DB CONNECTION|'; + &event_logger; + + + $dbhA->disconnect(); + + + if($DB){print "DONE... Exiting... Goodbye... See you later... Really I mean it this time\n";} + + +exit; + + + + + + + +sub get_time_now #get the current date and time and epoch for logging call lengths and datetimes +{ +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +$action_log_date = "$year-$mon-$mday"; +} + + + + + +sub event_logger +{ +if ($SYSLOG) + { + ### open the log file for writing ### + open(Lout, ">>$PATHlogs/listen_process.$action_log_date") + || die "Can't open $PATHlogs/listen_process.$action_log_date: $!\n"; + print Lout "$now_date|$event_string|\n"; + close(Lout); + } +$event_string=''; +} + + + + +sub manager_output_logger +{ +if ($SYSLOG) + { + open(MOout, ">>$PATHlogs/listen.$action_log_date") + || die "Can't open $PATHlogs/listen.$action_log_date: $!\n"; + print MOout "$now_date|$manager_string|\n"; + close(MOout); + } +} diff --git a/agc_2-X/branches/agc_2.0.4/bin/AST_manager_send.pl b/agc_2-X/branches/agc_2.0.4/bin/AST_manager_send.pl new file mode 100644 index 00000000..402d08fc --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/AST_manager_send.pl @@ -0,0 +1,369 @@ +#!/usr/bin/perl +# +# AST_manager_send.pl version 0.3 *DBI-version* +# +# Part of the Asterisk Central Queue System (ACQS) +# +# DESCRIPTION: +# spawns child processes (AST_send_action_child.pl) to execute action commands +# on the Asterisk manager interface from records in the vicidial_manager table +# of the asterisk database in MySQL that are marked as a status of NEW +# +# SUMMARY: +# This program was designed as the send-only part of the ACQS. It's job is to +# pick NEW actions from the vicidial_manager table and send them to be executed +# by separate child process. This allows for a higher degree of flexibility and +# scalability over just using a single process. Also, this means that a single +# action execution lock cannot bring the entire system down. +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# CHANGES +# 50823-1514 - Added commandline debug options with debug printouts +# 50902-1051 - Added extra debug output launch sub(commented out) +# 60718-0909 - changed to DBI by Marin Blu +# 60718-1005 - changed to use /etc/astguiclient.conf for configs +# 60718-1211 - removed need for ADMIN_keepalive_send_listen.at launching +# 60814-1712 - added option for no logging to file +# 60817-1211 - added more ARGS to go to child process to remove DBI from child +# 61221-1926 - optimize and clean code, lc +# + +$|++; +use strict; +use DBI; +use Getopt::Long; +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second + +# constants and globals +my $servConf; +my %conf; +$conf{PATHconf} = '/etc/astguiclient.conf'; # default path to astguiclient configuration file: +my $COUNTER_OUTPUT=1; # set to 1 to display the counter as the script runs +my ($CLOhelp, $sendonlyone, $TEST, $DB, $DBX, $SYSLOG); + +### begin parsing run-time options ### +if (scalar @ARGV) { + GetOptions('help!' => \$CLOhelp, + 'sendonlyone!' => \$sendonlyone, + 'counteroutput!' => \$COUNTER_OUTPUT, + 't!' => \$TEST, #Fucntionality doesn't actually exist. + 'debug!' => \$DB, + 'debugX!' => \$DBX ); + $DB = 1 if ($DBX); + if ($DB) { + print "----- DEBUGGING -----\n"; + print "----- EXTRA-VERBOSE DEBUGGING -----\n" if ($DBX); + print "COUNTER_OUTPUT: $COUNTER_OUTPUT\n"; + print "sendonlyone: $sendonlyone\n" if ($sendonlyone); + print "TEST: $TEST\n" if ($TEST); + } + if ($CLOhelp) { + print "\nAST_manager_send.pl\n"; + print "allowed run time options:\n"; + print " [--help] = This help screen.\n"; + print " [--sendonlyone] = Send only one command\n"; + print " [--nocounteroutput] = Do not display counter as script runs\n"; + print " [-t] = Test Mode\n"; + print " [--debug] or [-v] = Verbose debug messages\n"; + print " [--debugX] or [-vv] = Extra-verbose debug messages\n\n"; + exit 0; + } +} +### end parsing run-time options ### + +# Begin Parsing astguiclient config file. +open(CONF, $conf{PATHconf}) || die "can't open " . $conf{PATHconf} . ": " . $! . "\n"; +while (my $line = ) { + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + foreach my $key (qw( PATHhome PATHlogs PATHagi PATHweb PATHsounds PATHmontior + VARserver_ip VARDB_server VARDB_database VARDB_user VARDB_pass VARDB_port)) { + if ($line =~ /^$key/) { + $conf{$key} = $line; + $conf{$key} =~ s/.*=//gi; + } + } +} +$conf{VARDB_port} = '3306' unless ($conf{VARDB_port}); + +# Connect to DB +my $dbhA = DBI->connect("DBI:mysql:" . $conf{VARDB_database} . ":" . $conf{VARDB_server} . ":" . $conf{VARDB_port}, + $conf{VARDB_user}, $conf{VARDB_pass}) or die "Couldn't connect to database: " . DBI->errstr; + +### Grab Server values from the database +$servConf = getServerConfig($dbhA, $conf{VARserver_ip}); +$SYSLOG = 1 if ($servConf->{vd_server_logs} =~ /Y/); +my $event_string='LOGGED INTO MYSQL SERVER ON 1 CONNECTION|'; +eventLogger($conf{PATHlogs}, 'process', $event_string); + + +my $one_day_interval = 90; # 1 day loops for 3 months +while ($one_day_interval > 0) { + my $endless_loop = 864000; # 10 days at .20 seconds per loop + my $affected_rows; + my $NEW_actions; + while ($endless_loop > 0) { + my $stmtA = "SELECT count(*) from vicidial_manager where server_ip = '" . $conf{VARserver_ip} . "' and status = 'NEW'"; + my $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + my $NEW_actions = ($sthA->fetchrow_array)[0]; + print STDERR $NEW_actions . " NEW Actions to send on server " . $conf{VARserver_ip} . " $endless_loop\n" if ($DB); + $sthA->finish(); + + if ($NEW_actions) { + my $stmtA = "UPDATE vicidial_manager set status='QUEUE' where server_ip = '" . $conf{VARserver_ip} . "' and status = 'NEW' order by entry_date limit 1"; + $affected_rows = $dbhA->do($stmtA); + print STDERR "rows updated to QUEUE: |$affected_rows|\n" if ($DB); + } else { + $affected_rows = 0; + } + + if ($affected_rows) { + my $stmtA = "SELECT * FROM vicidial_manager where server_ip = '" . $conf{VARserver_ip} . "' and status = 'QUEUE' order by entry_date desc limit 1"; + eventLogger($conf{'PATHlogs'}, 'process', "SQL_QUERY|" . $stmtA . "|"); + + my $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + + while (my $vdm = $sthA->fetchrow_hashref) { + + print STDERR $vdm->{man_id} . "|" . $vdm->{uniqueid} . "|" . $vdm->{channel} . "|" . + $vdm->{action} . "|" . $vdm->{callid} . "\n" if ($DB); + + my $originate_command = "Action: ". $vdm->{action} . "\n"; + $originate_command .= $vdm->{cmd_line_b} . "\n" if ($vdm->{cmd_line_b}); + $originate_command .= $vdm->{cmd_line_c} . "\n" if ($vdm->{cmd_line_c}); + $originate_command .= $vdm->{cmd_line_d} . "\n" if ($vdm->{cmd_line_d}); + $originate_command .= $vdm->{cmd_line_e} . "\n" if ($vdm->{cmd_line_e}); + $originate_command .= $vdm->{cmd_line_f} . "\n" if ($vdm->{cmd_line_f}); + $originate_command .= $vdm->{cmd_line_g} . "\n" if ($vdm->{cmd_line_g}); + $originate_command .= $vdm->{cmd_line_h} . "\n" if ($vdm->{cmd_line_h}); + $originate_command .= $vdm->{cmd_line_i} . "\n" if ($vdm->{cmd_line_i}); + $originate_command .= $vdm->{cmd_line_j} . "\n" if ($vdm->{cmd_line_j}); + $originate_command .= $vdm->{cmd_line_k} . "\n" if ($vdm->{cmd_line_k}); + $originate_command .= "\n"; + + my $SENDNOW=1; + if ($originate_command =~ /Action: Hangup|Action: Redirect/) { + $SENDNOW=0; + print STDERR "\n|checking for dead call before executing|" . $vdm->{callid} . "|" . $vdm->{uniqueid} . "|\n" if ($DB); + my $stmtB = "SELECT count(*) FROM vicidial_manager where server_ip = '" . $conf{VARserver_ip} . "' and callerid='" . $vdm->{callid} . "' and status = 'DEAD'"; + my $sthB = $dbhA->prepare($stmtB) or die "preparing: ",$dbhA->errstr; + $sthB->execute or die "executing: $stmtA ", $dbhA->errstr; + my $dead_count = ($sthB->fetchrow_array)[0]; + $sthB->finish(); + + if ($dead_count) { + print STDERR "\n|not sending command line is dead|" . $vdm->{callid} . "|" . $vdm->{uniqueid} . "|\n" if ($DB); + } else { + $SENDNOW=1; + } + } + + my $event_string = "----BEGIN NEW COMMAND----\n$originate_command----END NEW COMMAND----\n"; + eventLogger($conf{'PATHlogs'}, 'process', $event_string); + + if ($SENDNOW) { + my $cPATHlogs = $conf{PATHlogs}; + $cPATHlogs =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg; + $vdm->{cmd_line_b} =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg; + $vdm->{cmd_line_c} =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg; + $vdm->{cmd_line_d} =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg; + $vdm->{cmd_line_e} =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg; + $vdm->{cmd_line_f} =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg; + $vdm->{cmd_line_g} =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg; + $vdm->{cmd_line_h} =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg; + $vdm->{cmd_line_i} =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg; + $vdm->{cmd_line_j} =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg; + $vdm->{cmd_line_k} =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg; + + my $launch = $conf{PATHhome} . "/AST_send_action_child.pl"; + $launch .= " --SYSLOG" if ($SYSLOG); + $launch .= " --PATHlogs=" . $cPATHlogs; + $launch .= " --telnet_host=" . $servConf->{telnet_host}; + $launch .= " --telnet_port=" . $servConf->{telnet_port}; + $launch .= " --ASTmgrUSERNAME=" . $servConf->{ASTmgrUSERNAME}; + $launch .= " --ASTmgrSECRET=" . $servConf->{ASTmgrSECRET}; + $launch .= " --ASTmgrUSERNAMEsend=" . $servConf->{ASTmgrUSERNAMEsend}; + $launch .= " --action=" . $vdm->{action}; + $launch .= " --cmd_line_b=" . $vdm->{cmd_line_b} if ($vdm->{cmd_line_b}); + $launch .= " --cmd_line_c=" . $vdm->{cmd_line_c} if ($vdm->{cmd_line_c}); + $launch .= " --cmd_line_d=" . $vdm->{cmd_line_d} if ($vdm->{cmd_line_d}); + $launch .= " --cmd_line_e=" . $vdm->{cmd_line_e} if ($vdm->{cmd_line_e}); + $launch .= " --cmd_line_f=" . $vdm->{cmd_line_f} if ($vdm->{cmd_line_f}); + $launch .= " --cmd_line_g=" . $vdm->{cmd_line_g} if ($vdm->{cmd_line_g}); + $launch .= " --cmd_line_h=" . $vdm->{cmd_line_h} if ($vdm->{cmd_line_h}); + $launch .= " --cmd_line_i=" . $vdm->{cmd_line_i} if ($vdm->{cmd_line_i}); + $launch .= " --cmd_line_j=" . $vdm->{cmd_line_j} if ($vdm->{cmd_line_j}); + $launch .= " --cmd_line_k=" . $vdm->{cmd_line_k} if ($vdm->{cmd_line_k}); + eventLogger($conf{'PATHlogs'}, 'launch', $launch . " " . + $vdm->{callid} . " " . $vdm->{uniqueid} . " " . $vdm->{channel}); + + + $launch .= " >> " . $conf{PATHlogs} . "/action_send." . logDate() if ($SYSLOG); + system($launch . ' &'); + + # $launch = "SENT " . $vdm->{man_id} . " " . $vdm->{callid} . ' ' . $vdm->{uniqueid} . ' ' . $vdm->{channel}; + # eventLogger($conf{'PATHlogs'}, 'launch', $launch);; + + my $stmtA = "UPDATE vicidial_manager set status='SENT' where man_id='" . $vdm->{man_id} . "'"; + print STDERR "\n|$stmtA|\n" if ($DB); + $affected_rows = $dbhA->do($stmtA); + + $event_string = "SQL_QUERY|$stmtA|"; + eventLogger($conf{'PATHlogs'}, 'process', $event_string); + } else { + $stmtA = "UPDATE vicidial_manager set status='DEAD' where man_id='" . $vdm->{man_id} . "'"; + print STDERR "\n|$stmtA|\n" if ($DB); + $affected_rows = $dbhA->do($stmtA); + $event_string="COMMAND NOT SENT, SQL_QUERY|$stmtA|"; + eventLogger($conf{'PATHlogs'}, 'process', $event_string);; + } + } + $sthA->finish(); + } + + if ($affected_rows) { + ### sleep for 10 hundredths of a second + usleep(1*100*1000); + } else { + ### sleep for 20 hundredths of a second + usleep(1*200*1000); + } + + $endless_loop--; + print STDERR "loop counter: |$endless_loop|\r" if($COUNTER_OUTPUT or $DB); + + ### putting a blank file called "sendmgr.kill" in a directory will automatically safely kill this program + if (-e $conf{PATHhome} . "/sendmgr.kill" or $sendonlyone) { + unlink($conf{PATHhome} . "/sendmgr.kill"); + $endless_loop = 0; + $one_day_interval = 0; + print "\nPROCESS KILLED MANUALLY... EXITING\n\n"; + } + + my $running_listen = 0; + if ($endless_loop =~ /0$/) { + ### Grab Server values from the database + $servConf = getServerConfig($dbhA, $conf{VARserver_ip}); + + print "checking to see if listener is dead |$sendonlyone|$running_listen|\n" if($COUNTER_OUTPUT or $DB); + #my @psoutput = `/bin/ps -f --no-headers -A`; + my @psoutput = `/bin/ps -o "%p %a" --no-headers -A`; + foreach my $line (@psoutput) { + chomp($line); + print "|$line| \n" if ($DBX); + my @psline = split(/\/usr\/bin\/perl /,$line); + if ($psline[1] =~ /AST_manager_li/) { + $running_listen++; + print "SEND RUNNING: |$psline[1]|\n" if ($DB); + } + } + + unless ($running_listen) { + $sendonlyone++; + print "LISTENER DEAD STOPPING PROGRAM... ATTEMPTING TO START keepalive SCRIPT\n" if ($COUNTER_OUTPUT or $DB); + $event_string = 'LISTENER DEAD STOPPING PROGRAM... ATTEMPTING TO START keepalive SCRIPT|'; + eventLogger($conf{'PATHlogs'}, 'process', $event_string); + # `/usr/bin/at now < $PATHhome/ADMIN_keepalive_send_listen.at 2>/dev/null 1>&2`; + my $screencmd = "/usr/bin/screen -d -m " . $conf{PATHhome} . "/ADMIN_keepalive_AST_send_listen.pl 2>/dev/null 1>&2"; + `$screencmd`; + } + } + + } + + print "DONE... Exiting... Goodbye... See you later... Not really, initiating next loop...$one_day_interval left\n" if($COUNTER_OUTPUT or $DB); + $one_day_interval--; + +} + +$event_string='CLOSING DB CONNECTION|'; +eventLogger($conf{'PATHlogs'}, 'process', $event_string); + +$dbhA->disconnect(); + +print "DONE... Exiting... Goodbye... See you later... Really I mean it this time\n" if($COUNTER_OUTPUT or $DB); +exit 0; +# Program ends. + + +### Start of subs. + +# getServerConfig usage: +# getServerConfig($dbh, $serverIP); +# Requires: +# $dbh : Database handle to current open DB. +# $serverIP : IP of server to get config for. +# Returns: +# hashref with conents of table entry. +sub getServerConfig { + my ($dbhA, $serverip) = @_; + my $stmtA = "SELECT * FROM servers where server_ip = '" . $serverip ."';"; + my $sthA = $dbhA->prepare($stmtA) or die "preparing: " . $dbhA->errstr; + $sthA->execute or die "executing: $stmtA " . $dbhA->errstr; + my $servConf = $sthA->fetchrow_hashref; + $SYSLOG = 1 if ($servConf->{vd_server_logs} =~ /Y/); + $sthA->finish(); + return $servConf; +} + +# eventLogger usage: +# eventLgger($LogFileDir, $LogType, $EventString); +# Requires: +# $LogFilePath : Directory where log files are. +# $LogType : Type of log, ie process, send, launch, full +# $EventString : String to record in log. +sub eventLogger { + my ($path,$type,$string) = @_; + open(LOG, ">>" . $path . "/action_" . $type . "." . logDate()) + || die "Can't open " . $path . "/action_" . $type . "." . + logDate() . ": " . $! . "\n"; + print LOG nowDate() . "|" . $string . "|\n"; + close(LOG); +} + +# getTime usage: +# getTime($SecondsSinceEpoch); +# Options: +# $SecondsSinceEpoch : Request time in seconds, defaults to current date/time. +# Returns: +# ($sec, $min, $hour. $day, $mon, $year) +sub getTime { + my ($tms) = @_; + $tms = time unless ($tms); + my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime($tms); + $year += 1900; + $mon++; + $mon = "0" . $mon if ($mon < 10); + $mday = "0" . $mday if ($mday < 10); + $min = "0" . $min if ($min < 10); + $sec = "0" . $sec if ($sec < 10); + return ($sec,$min,$hour,$mday,$mon,$year); +} + +# nowDate usage: +# nowDate($SecondsSinceEpoch); +# Options: +# $SecondsSinceEpoch : Request time in seconds, defaults to current date/time. +# Returns: +# scalar date/time string (MySQL formatted) ie "2007-01-01 00:00:00" +sub nowDate { + my ($tms) = @_; + my($sec,$min,$hour,$mday,$mon,$year) = getTime($tms); + return $year.'-'.$mon.'-'.$mday.' '.$hour.':'.$min.':'.$sec; +} + +# logDate usage: +# logDate($SecondsSinceEpoch); +# Options: +# $SecondsSinceEpoch : Request time in seconds, defaults to current date/time. +# Returns: +# scalar date string ie "2007-01-01" +sub logDate { + my ($tms) = @_; + my($sec,$min,$hour,$mday,$mon,$year) = getTime($tms); + return $year . '-' . $mon . '-' . $mday; +} + +### End of subs diff --git a/agc_2-X/branches/agc_2.0.4/bin/AST_phone_update.pl b/agc_2-X/branches/agc_2.0.4/bin/AST_phone_update.pl new file mode 100644 index 00000000..c3e8afb2 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/AST_phone_update.pl @@ -0,0 +1,322 @@ +#!/usr/bin/perl +# +# AST_phone_update.pl version 2.0.4 *DBI-version* +# +# DESCRIPTION: +# checks the registered IP address of the phone and updates the phones table +# +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# +# 70521-1529 - first build +# + +# constants +$DB=0; # Debug flag, set to 0 for no debug messages per minute +$US='__'; +$MT[0]=''; + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-debug/i) + { + $DB=1; # Debug flag + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +# print "no command line options set\n"; +} +### end parsing run-time options ### + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} + +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use DBI; +use Net::Telnet (); + + $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### Grab Server values from the database +$stmtA = "SELECT telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERNAMEupdate,ASTmgrUSERNAMElisten,ASTmgrUSERNAMEsend,max_vicidial_trunks,answer_transfer_agent,local_gmt,ext_context FROM servers where server_ip = '$server_ip';"; + +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +if ($DB) {print "|$stmtA|\n";} +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $DBtelnet_host = "$aryA[0]"; + $DBtelnet_port = "$aryA[1]"; + $DBASTmgrUSERNAME = "$aryA[2]"; + $DBASTmgrSECRET = "$aryA[3]"; + $DBASTmgrUSERNAMEupdate = "$aryA[4]"; + $DBASTmgrUSERNAMElisten = "$aryA[5]"; + $DBASTmgrUSERNAMEsend = "$aryA[6]"; + $DBmax_vicidial_trunks = "$aryA[7]"; + $DBanswer_transfer_agent= "$aryA[8]"; + $DBSERVER_GMT = "$aryA[9]"; + $DBext_context = "$aryA[10]"; + if ($DBtelnet_host) {$telnet_host = $DBtelnet_host;} + if ($DBtelnet_port) {$telnet_port = $DBtelnet_port;} + if ($DBASTmgrUSERNAME) {$ASTmgrUSERNAME = $DBASTmgrUSERNAME;} + if ($DBASTmgrSECRET) {$ASTmgrSECRET = $DBASTmgrSECRET;} + if ($DBASTmgrUSERNAMEupdate) {$ASTmgrUSERNAMEupdate = $DBASTmgrUSERNAMEupdate;} + if ($DBASTmgrUSERNAMElisten) {$ASTmgrUSERNAMElisten = $DBASTmgrUSERNAMElisten;} + if ($DBASTmgrUSERNAMEsend) {$ASTmgrUSERNAMEsend = $DBASTmgrUSERNAMEsend;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBext_context) {$ext_context = $DBext_context;} + } + $sthA->finish(); + + +############# BEGIN SIP SECTION ################################################ +if($DB){print "\n\nSIP EXTENSIONS:\n";} + + +@PTextensions=@MT; @PTphone_ips=@MT; +$stmtA = "SELECT extension,phone_ip from phones where server_ip='$server_ip' and protocol='SIP'"; +if ($DB) {print "|$stmtA|\n";} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $PTextensions[$rec_count] = "$aryA[0]"; + $PTphone_ips[$rec_count] = "$aryA[1]"; + $rec_count++; + } + $sthA->finish(); + + +### connect to asterisk manager through telnet +$t = new Net::Telnet (Port => 5038, + Prompt => '/.*[\$%#>] $/', + Output_record_separator => '',); +#$fh = $t->dump_log("$telnetlog"); # uncomment for telnet log + if (length($ASTmgrUSERNAMEsend) > 3) {$telnet_login = $ASTmgrUSERNAMEsend;} + else {$telnet_login = $ASTmgrUSERNAME;} + +$t->open("$telnet_host"); +$t->waitfor('/0\n$/'); # print login +$t->print("Action: Login\nUsername: $telnet_login\nSecret: $ASTmgrSECRET\n\n"); +$t->waitfor('/Authentication accepted/'); # waitfor auth accepted + + +$i=0; +foreach(@PTextensions) + { + @list_channels=@MT; + $t->buffer_empty; + @list_channels = $t->cmd(String => "Action: Command\nCommand: sip show peer $PTextensions[$i]\n\nAction: Ping\n\n", Prompt => '/Response: Pong.*/'); + + $j=0; + foreach(@list_channels) + { # Addr->IP : 10.10.14.25 Port 5060 + if ($list_channels[$j] =~ / Addr->IP : /) + { + $NEW_IPaddr[$i] = "$list_channels[$j]"; + $NEW_IPaddr[$i] =~ s/ Addr->IP : | Port .*|\n|\r|\t//g; + } + + $j++; + } + + if($DB){print "Phone IP- $PTextensions[$i] NEW:|$NEW_IPaddr[$i]| OLD:|$PTphone_ips[$i]| ";} + if ( ($NEW_IPaddr[$i] =~ /$PTphone_ips[$i]/) && (length($NEW_IPaddr[$i]) eq length($PTphone_ips[$i])) ) + { + if($DB){print "PHONE IP UNCHANGED, DOING NOTHING FOR THIS EXTENSION\n";} + } + else + { + if ($NEW_IPaddr[$i] =~ /Unspecified/) + { + if($DB){print "PHONE IP UNSPECIFIED, DOING NOTHING FOR THIS EXTENSION\n";} + } + else + { + $stmtA = "UPDATE phones set phone_ip='$NEW_IPaddr[$i]' where server_ip='$server_ip' and extension='$PTextensions[$i]'"; + if($DB){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n"; + } + } + + $i++; + ### sleep for 10 hundredths of a second + usleep(1*100*1000); + } + + +$t->buffer_empty; +@hangup = $t->cmd(String => "Action: Logoff\n\n", Prompt => "/.*/"); +$t->buffer_empty; +$ok = $t->close; + +############# END SIP SECTION ################################################ + + + +############# BEGIN IAX2 SECTION ################################################ +if($DB){print "\n\niax2 EXTENSIONS:\n";} + +@PTextensions=@MT; @PTphone_ips=@MT; +$stmtA = "SELECT extension,phone_ip from phones where server_ip='$server_ip' and protocol='IAX2'"; +if ($DB) {print "|$stmtA|\n";} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $PTextensions[$rec_count] = "$aryA[0]"; + $PTphone_ips[$rec_count] = "$aryA[1]"; + $rec_count++; + } + $sthA->finish(); + + +### connect to asterisk manager through telnet +$t = new Net::Telnet (Port => 5038, + Prompt => '/.*[\$%#>] $/', + Output_record_separator => '',); +#$fh = $t->dump_log("$telnetlog"); # uncomment for telnet log + if (length($ASTmgrUSERNAMEsend) > 3) {$telnet_login = $ASTmgrUSERNAMEsend;} + else {$telnet_login = $ASTmgrUSERNAME;} + +$t->open("$telnet_host"); +$t->waitfor('/0\n$/'); # print login +$t->print("Action: Login\nUsername: $telnet_login\nSecret: $ASTmgrSECRET\n\n"); +$t->waitfor('/Authentication accepted/'); # waitfor auth accepted + + +$i=0; +foreach(@PTextensions) + { + @list_channels=@MT; + $t->buffer_empty; + @list_channels = $t->cmd(String => "Action: Command\nCommand: iax2 show peer $PTextensions[$i]\n\nAction: Ping\n\n", Prompt => '/Response: Pong.*/'); + + $j=0; + foreach(@list_channels) + { # Addr->IP : 10.10.14.25 Port 5060 + if ($list_channels[$j] =~ / Addr->IP : /) + { + $NEW_IPaddr[$i] = "$list_channels[$j]"; + $NEW_IPaddr[$i] =~ s/ Addr->IP : | Port .*|\n|\r|\t//g; + } + + $j++; + } + + if($DB){print "Phone IP- $PTextensions[$i] NEW:|$NEW_IPaddr[$i]| OLD:|$PTphone_ips[$i]| ";} + if ( ($NEW_IPaddr[$i] =~ /$PTphone_ips[$i]/) && (length($NEW_IPaddr[$i]) eq length($PTphone_ips[$i])) ) + { + if($DB){print "PHONE IP UNCHANGED, DOING NOTHING FOR THIS EXTENSION\n";} + } + else + { + if ($NEW_IPaddr[$i] =~ /Unspecified/) + { + if($DB){print "PHONE IP UNSPECIFIED, DOING NOTHING FOR THIS EXTENSION\n";} + } + else + { + $stmtA = "UPDATE phones set phone_ip='$NEW_IPaddr[$i]' where server_ip='$server_ip' and extension='$PTextensions[$i]'"; + if($DB){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n"; + } + } + + $i++; + ### sleep for 10 hundredths of a second + usleep(1*100*1000); + } + + +$t->buffer_empty; +@hangup = $t->cmd(String => "Action: Logoff\n\n", Prompt => "/.*/"); +$t->buffer_empty; +$ok = $t->close; +############# END IAX2 SECTION ################################################ + + + + + +$dbhA->disconnect(); + +if($DB){print "DONE... Exiting...\n";} + +exit; + + + + diff --git a/agc_2-X/branches/agc_2.0.4/bin/AST_reset_mysql_vars.pl b/agc_2-X/branches/agc_2.0.4/bin/AST_reset_mysql_vars.pl new file mode 100644 index 00000000..7f88464e --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/AST_reset_mysql_vars.pl @@ -0,0 +1,122 @@ +#!/usr/bin/perl +# +# AST_reset_mysql_vars.pl version 0.3 *DBI-version* +# +# !!! DO NOT RUN THIS WHILE THERE ARE ACTIVE CALLS ON THE ASTERISK SERVER !!! +# +# DESCRIPTION: +# clears out mysql records for this server +# +# It is recommended that you run this program on the local Asterisk machine +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# CHANGES +# 60717-1237 - changed to DBI by Marin Blu +# 60717-1536 - changed to use /etc/astguiclient.conf for configs +# + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} + +use DBI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + + $stmtA = "UPDATE conferences set extension='' where server_ip='$server_ip';"; + if($DB){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query: |$stmtA|\n"; + print " - conferences reset\n"; + + $stmtA = "UPDATE vicidial_conferences set extension='' where server_ip='$server_ip';"; + if($DB){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query: |$stmtA|\n"; + print " - vicidial_conferences reset\n"; + +# $stmtA = "UPDATE vicidial_manager set status='DEAD' where server_ip='$server_ip' and status='NEW';"; +# if($DB){print STDERR "\n|$stmtA|\n";} +# $dbhA->query($stmtA); # or die "Couldn't execute query: |$stmtA|\n"; +# print " - vicidial_manager queue reset\n"; + + $stmtA = "DELETE from vicidial_manager where server_ip='$server_ip';"; + if($DB){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query: |$stmtA|\n"; + print " - vicidial_manager delete\n"; + + $stmtA = "DELETE from vicidial_auto_calls where server_ip='$server_ip';"; + if($DB){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query: |$stmtA|\n"; + print " - vicidial_auto_calls delete\n"; + + $stmtA = "DELETE from vicidial_live_agents where server_ip='$server_ip';"; + if($DB){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query: |$stmtA|\n"; + print " - vicidial_live_agents delete\n"; + + $stmtA = "DELETE from vicidial_users where full_name='5555';"; + if($DB){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query: |$stmtA|\n"; + print " - vicidial__users delete\n"; + + $stmtA = "DELETE from vicidial_campaign_server_stats where server_ip='$server_ip';"; + if($DB){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query: |$stmtA|\n"; + print " - vicidial_campaign_server_stats delete\n"; + + $stmtA = "DELETE from vicidial_hopper where user LIKE \"%_$server_ip\";"; + if($DB){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query: |$stmtA|\n"; + print " - vicidial_hopper delete\n"; + + $dbhA->disconnect(); + + +exit; + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/bin/AST_send_action_child.pl b/agc_2-X/branches/agc_2.0.4/bin/AST_send_action_child.pl new file mode 100644 index 00000000..c45147ee --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/AST_send_action_child.pl @@ -0,0 +1,325 @@ +#!/usr/bin/perl +# +# AST_send_action_child.pl version 0.5 *DBI-version +# +# Part of the Asterisk Central Queue System (ACQS) +# +# DESCRIPTION: +# This script is spawned every time an action is to be executed by the main +# AST_manager_send.pl script and sends actions blindly to the Asterisk manager +# +# SUMMARY: +# This program was designed as the blind-send part of the ACQS. It's job is to +# be spawned by the AST_manager_send.pl script lookup the record in the MySQL DB +# to be executed. connect to the manager interface, send the action and logoff +# then exit. +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# CHANGES +# 50810-1547 - Added database server variable definitions lookup +# 50823-1527 - Altered commandline debug options with debug printouts +# 50902-1032 - Changed default logging to fulllog +# 60718-0909 - changed to DBI by Marin Blu +# 60718-1024 - changed to use /etc/astguiclient.conf for configs +# 60814-1720 - added option for no logging to file +# 60817-1244 - removed all DB calls and config file open to reduce footprint +# 61004-1728 - added ability to parse volume control and lookup meetme IDs +# 61220-1720 - optimize and clean code, lc. +# 61221-1942 - additional modification to structure, lc. +# + +$|++; +use strict; +use Getopt::Long; +use Net::Telnet; + +### Initialize date/time vars ### +my $secX = time(); #Start time + +### Initialize run-time variables ### +my ($CLOhelp, $SYSLOG, $PATHlogs, $telnet_host, $telnet_port, $ASTmgrUSERNAME); +my ($ASTmgrSECRET, $ASTmgrUSERNAMEsend, $action, $cmd_line_b, $cmd_line_c); +my ($cmd_line_d, $cmd_line_e, $cmd_line_f, $cmd_line_g, $cmd_line_h); +my ($cmd_line_i, $cmd_line_j, $cmd_line_k, $DB, $DBX); +my $FULL_LOG = 1; + +### begin parsing run-time options ### +if (scalar @ARGV) { + GetOptions('help!' => \$CLOhelp, + 'SYSLOG!' => \$SYSLOG, + 'PATHlogs=s' => \$PATHlogs, + 'telnet_host=s' => \$telnet_host, + 'telnet_port=s' => \$telnet_port, + 'ASTmgrUSERNAME=s' => \$ASTmgrUSERNAME, + 'ASTmgrSECRET=s' => \$ASTmgrSECRET, + 'ASTmgrUSERNAMEsend=s' => \$ASTmgrUSERNAMEsend, + 'action=s' => \$action, + 'cmd_line_b=s' => \$cmd_line_b, + 'cmd_line_c=s' => \$cmd_line_c, + 'cmd_line_d=s' => \$cmd_line_d, + 'cmd_line_e=s' => \$cmd_line_e, + 'cmd_line_f=s' => \$cmd_line_f, + 'cmd_line_g=s' => \$cmd_line_g, + 'cmd_line_h=s' => \$cmd_line_h, + 'cmd_line_i=s' => \$cmd_line_i, + 'cmd_line_j=s' => \$cmd_line_j, + 'cmd_line_k=s' => \$cmd_line_k, + 'debug!' => \$DB, + 'debugX!' => \$DBX, + 'fulllog!' => \$FULL_LOG); + + $DB = 1 if ($DBX); + if ($DB) { + print "\n----- DEBUGGING -----\n\n"; + print "\n----- SUPER-DUPER DEBUGGING -----\n\n" if ($DBX); + print " SYSLOG: $SYSLOG\n" if ($SYSLOG); + print " telnet_host: $telnet_host\n" if ($telnet_host); + print " telnet_port: $telnet_port\n" if ($telnet_port); + print " ASTmgrUSERNAME: $ASTmgrUSERNAME\n" if ($ASTmgrUSERNAME); + print " ASTmgrSECRET: $ASTmgrSECRET\n" if ($ASTmgrSECRET); + print " ASTmgrUSERNAMEsend: $ASTmgrUSERNAMEsend\n" if ($ASTmgrUSERNAMEsend); + print " cmd_line_b: $cmd_line_b\n" if ($cmd_line_b); + print " cmd_line_c: $cmd_line_c\n" if ($cmd_line_c); + print " cmd_line_d: $cmd_line_d\n" if ($cmd_line_d); + print " cmd_line_e: $cmd_line_e\n" if ($cmd_line_e); + print " cmd_line_f: $cmd_line_f\n" if ($cmd_line_f); + print " cmd_line_g: $cmd_line_g\n" if ($cmd_line_g); + print " cmd_line_h: $cmd_line_h\n" if ($cmd_line_h); + print " cmd_line_i: $cmd_line_i\n" if ($cmd_line_i); + print " cmd_line_j: $cmd_line_j\n" if ($cmd_line_j); + print " cmd_line_k: $cmd_line_k\n" if ($cmd_line_k); + print "\n"; + } + if ($CLOhelp) { + print "allowed run time options:\n"; + print " [--help] = this help screen\n"; + print " [--SYSLOG] = whether to log actions or not\n"; + print "required flags:\n"; + print " [--PATHlogs] = logs directory path\n"; + print " [--telnet_host] = IP address to connect to Asterisk Manager\n"; + print " [--telnet_port] = port to connect to Asterisk Manager\n"; + print " [--ASTmgrUSERNAME] = username for Asterisk Manager login\n"; + print " [--ASTmgrSECRET] = secret or password for Asterisk Manager login\n"; + print " [--ASTmgrUSERNAMEsend] = username specific for sending actions for Asterisk Manager login\n"; + print " [--action] = type of manager action to send\n"; + print " [--cmd_line_X] = lines to send to Manager after action\n"; + print " X replaced with b-k (10 lines)\n"; + print "\n"; + print "You may prefix an option with 'no' to disable it.\n"; + print " ie. --noSYSLOG or --noFULLLOG\n"; + + exit 0; + } +} + +if ($action) { + $PATHlogs =~ s/\%([A-Fa-f0-9]{2})/pack('C', hex($1))/seg; + $cmd_line_b =~ s/\%([A-Fa-f0-9]{2})/pack('C', hex($1))/seg; + $cmd_line_c =~ s/\%([A-Fa-f0-9]{2})/pack('C', hex($1))/seg; + $cmd_line_d =~ s/\%([A-Fa-f0-9]{2})/pack('C', hex($1))/seg; + $cmd_line_e =~ s/\%([A-Fa-f0-9]{2})/pack('C', hex($1))/seg; + $cmd_line_f =~ s/\%([A-Fa-f0-9]{2})/pack('C', hex($1))/seg; + $cmd_line_g =~ s/\%([A-Fa-f0-9]{2})/pack('C', hex($1))/seg; + $cmd_line_h =~ s/\%([A-Fa-f0-9]{2})/pack('C', hex($1))/seg; + $cmd_line_i =~ s/\%([A-Fa-f0-9]{2})/pack('C', hex($1))/seg; + $cmd_line_j =~ s/\%([A-Fa-f0-9]{2})/pack('C', hex($1))/seg; + $cmd_line_k =~ s/\%([A-Fa-f0-9]{2})/pack('C', hex($1))/seg; + if ($DB) { + print " SYSLOG: $SYSLOG\n" if ($SYSLOG); + print " telnet_host: $telnet_host\n" if ($telnet_host); + print " telnet_port: $telnet_port\n" if ($telnet_port); + print " ASTmgrUSERNAME: $ASTmgrUSERNAME\n" if ($ASTmgrUSERNAME); + print " ASTmgrSECRET: $ASTmgrSECRET\n" if ($ASTmgrSECRET); + print " ASTmgrUSERNAMEsend: $ASTmgrUSERNAMEsend\n" if ($ASTmgrUSERNAMEsend); + print " cmd_line_b: $cmd_line_b\n" if ($cmd_line_b); + print " cmd_line_c: $cmd_line_c\n" if ($cmd_line_c); + print " cmd_line_d: $cmd_line_d\n" if ($cmd_line_d); + print " cmd_line_e: $cmd_line_e\n" if ($cmd_line_e); + print " cmd_line_f: $cmd_line_f\n" if ($cmd_line_f); + print " cmd_line_g: $cmd_line_g\n" if ($cmd_line_g); + print " cmd_line_h: $cmd_line_h\n" if ($cmd_line_h); + print " cmd_line_i: $cmd_line_i\n" if ($cmd_line_i); + print " cmd_line_j: $cmd_line_j\n" if ($cmd_line_j); + print " cmd_line_k: $cmd_line_k\n" if ($cmd_line_k); + } + + $telnet_port = '5038' if (!$telnet_port); + + ### connect to asterisk manager through telnet + my $tn = new Net::Telnet (Port => $telnet_port, + Prompt => '/.*[\$%#>] $/', + Output_record_separator => '', + Errmode => "return"); + #$fh = $tn->dump_log("$PATHlogs/SAC_telnet_log.txt"); # uncomment for telnet log + my $telnet_login; + if ($ASTmgrUSERNAMEsend) { + $telnet_login = $ASTmgrUSERNAMEsend; + } else { + $telnet_login = $ASTmgrUSERNAME; + } + $tn->open($telnet_host); + $tn->waitfor('/0\n$/'); # print login + $tn->print("Action: Login\nUsername: $telnet_login\nSecret: $ASTmgrSECRET\n\n"); + $tn->waitfor('/Authentication accepted/'); # waitfor auth accepted + + $tn->buffer_empty; + + if ($cmd_line_b =~ /XXYYXXYYXXYYXX/) { + # Action: Command + # Command: meetme list 8600051 + # + # Response: Follows + # Privilege: Command + # User #: 03 261 261iax Channel: IAX2/261iax-13 (unmonitored) + # 1 users in that conference. + # --END COMMAND-- + my $meetme_command = "Action: Command\nCommand: meetme list $cmd_line_k\n\n"; + print nowDate() . "|$SYSLOG|\n$meetme_command"; + + my $participant; + my @list_meetme = $tn->cmd(String => $meetme_command, + Prompt => '/--END COMMAND-.*/'); + foreach my $meetme (@list_meetme) { + if ($meetme =~ /$cmd_line_j /i) { + $meetme =~ s/User \#: //gi; + my @participants = split(/ /, $meetme); + $participant = ($participants[0] + 0); + } + # print "$participant|$cmd_line_j|$meetme"; + } + $cmd_line_b =~ s/XXYYXXYYXXYYXX/$participant/gi if ($participant > 0); + $cmd_line_j = ''; + $cmd_line_k = ''; + } + + my $originate_command; + $originate_command .= "Action: $action\n"; + #if (length($cmd_line_b)>3) {$originate_command .= "$cmd_line_b\n";} + $originate_command .= $cmd_line_b . "\n" if ($cmd_line_b); + $originate_command .= $cmd_line_c . "\n" if ($cmd_line_c); + $originate_command .= $cmd_line_d . "\n" if ($cmd_line_d); + $originate_command .= $cmd_line_e . "\n" if ($cmd_line_e); + $originate_command .= $cmd_line_f . "\n" if ($cmd_line_f); + $originate_command .= $cmd_line_g . "\n" if ($cmd_line_g); + $originate_command .= $cmd_line_h . "\n" if ($cmd_line_h); + $originate_command .= $cmd_line_i . "\n" if ($cmd_line_i); + $originate_command .= $cmd_line_j . "\n" if ($cmd_line_j); + $originate_command .= $cmd_line_k . "\n" if ($cmd_line_k); + $originate_command .= "\n"; + + + print nowDate() . "|$SYSLOG|\n$originate_command"; + my $event_string = "0|" . $SYSLOG . "|"; + $event_string .= "\n" . $originate_command; + + eventLogger($PATHlogs,'full',$event_string) if ($FULL_LOG and $SYSLOG); + + my @list_channels = $tn->cmd(String => $originate_command, + Prompt => '/.*/'); + + sleep(3); + + my $data1; # ? Useless ? + if ($FULL_LOG and $SYSLOG) { + my $event_string = "1|" . $data1 . "|"; + foreach my $channel (@list_channels) { + $event_string .= $channel; + } + my $read_input_buf = $tn->get(Errmode => "return", + Timeout => 1); + $event_string .= $read_input_buf; + eventLogger($PATHlogs,'full',$event_string); + } + + $tn->buffer_empty; + #@hangup = $tn->cmd(String => "Action: Logoff\n\n", Prompt => "/.*/"); + $tn->cmd(String => "Action: Logoff\n\n", Prompt => "/.*/"); + sleep(2); + + if ($FULL_LOG and $SYSLOG) { + my $event_string = "2|" . $data1 . "|"; + foreach my $channel (@list_channels) { + $event_string .= $channel; + } + my $read_input_buf = $tn->get(Errmode => "return", + Timeout => 1); + $event_string .= $read_input_buf; + eventLogger($PATHlogs,'full',$event_string); + } + + $tn->buffer_empty; + $tn->close; +} + +my $secZ = time(); +my $script_time = ($secZ - $secX); +print "DONE execute time: $script_time seconds\n"; + +exit 0; +# Program ends. + + +### Start of subs. + +# eventLogger usage: +# eventLgger($LogFileDir, $LogType, $EventString); +# Requires: +# $LogFilePath : Directory where log files are. +# $LogType : Type of log, ie process, send, launch, full +# $EventString : String to record in log. +sub eventLogger { + my ($path,$type,$string) = @_; + open(LOG, ">>" . $path . "/action_" . $type . "." . logDate()) + || die "Can't open " . $path . "/action_" . $type . "." . + logDate() . ": " . $! . "\n"; + print LOG nowDate() . "|" . $string . "|\n"; + close(LOG); +} + +# getTime usage: +# getTime($SecondsSinceEpoch); +# Options: +# $SecondsSinceEpoch : Request time in seconds, defaults to current date/time. +# Returns: +# ($sec, $min, $hour. $day, $mon, $year) +sub getTime { + my ($tms) = @_; + $tms = time unless ($tms); + my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime($tms); + $year += 1900; + $mon++; + $mon = "0" . $mon if ($mon < 10); + $mday = "0" . $mday if ($mday < 10); + $min = "0" . $min if ($min < 10); + $sec = "0" . $sec if ($sec < 10); + return ($sec,$min,$hour,$mday,$mon,$year); +} + +# nowDate usage: +# nowDate($SecondsSinceEpoch); +# Options: +# $SecondsSinceEpoch : Request time in seconds, defaults to current date/time. +# Returns: +# scalar date/time string (MySQL formatted) ie "2007-01-01 00:00:00" +sub nowDate { + my ($tms) = @_; + my($sec,$min,$hour,$mday,$mon,$year) = getTime($tms); + return $year.'-'.$mon.'-'.$mday.' '.$hour.':'.$min.':'.$sec; +} + +# logDate usage: +# logDate($SecondsSinceEpoch); +# Options: +# $SecondsSinceEpoch : Request time in seconds, defaults to current date/time. +# Returns: +# scalar date string ie "2007-01-01" +sub logDate { + my ($tms) = @_; + my($sec,$min,$hour,$mday,$mon,$year) = getTime($tms); + return $year . '-' . $mon . '-' . $mday; +} + +### End of subs + + diff --git a/agc_2-X/branches/agc_2.0.4/bin/AST_sourceID_summary_export.pl b/agc_2-X/branches/agc_2.0.4/bin/AST_sourceID_summary_export.pl new file mode 100644 index 00000000..2961596a --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/AST_sourceID_summary_export.pl @@ -0,0 +1,348 @@ +#!/usr/bin/perl + +# AST_sourceID_summary_export.pl version: 2.0.4 +# +# This script is designed to gather stats for all leads by source_id and +# post them to a directory +# +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# +# CHANGES +# 70905-1409 - First version +# 71005-0054 - Altered script to use astguiclient.conf for settings +# + +$txt = '.txt'; +$US = '_'; +$MT[0] = ''; + +# Default FTP account variables +$VARREPORT_host = '10.0.0.4'; +$VARREPORT_user = 'cron'; +$VARREPORT_pass = 'test'; +$VARREPORT_port = '21'; +$VARREPORT_dir = 'REPORTS'; + +# default CLI values +$sale_statuses = 'SALE-UPSELL'; +$ni_statuses = 'NI'; +$np_statuses = 'NP'; + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n"; + print " [--sale-statuses=XXX-XXY] = Statuses that are deemed to be \"Sales\". Default SALE\n"; + print " [--NI-statuses=XXX-XXY] = Statuses that are deemed to be \"Not Interested\". Default NI\n"; + print " [--NP-statuses=XXX-XXY] = Statuses that are deemed to be \"No Pitch\". Default NP\n"; + print " [--ignore-lists=XXX-XXY] = lists that should be ignored in summary\n"; + print " [--ftp-transfer] = Send results file by FTP to another server\n"; + print " [-q] = quiet\n"; + print " [-t] = test\n"; + print " [--debug] = debugging messages\n"; + print " [--debugX] = Super debugging messages\n"; + print "\n"; + + exit; + } + else + { + if ($args =~ /--debug/i) + { + $DB=1; + print "\n----- DEBUG MODE -----\n\n"; + } + if ($args =~ /--debugX/i) + { + $DBX=1; + print "\n----- SUPER DEBUG MODE -----\n\n"; + } + if ($args =~ /-q/i) + { + $q=1; $Q=1; + } + if ($args =~ /--sale-statuses=/i) + { + @data_in = split(/--sale-statuses=/,$args); + $sale_statuses = $data_in[1]; + $sale_statuses =~ s/ .*$//gi; + } + if ($args =~ /--NI-statuses=/) + { + @data_in = split(/--NI-statuses=/,$args); + $ni_statuses = $data_in[1]; + $ni_statuses =~ s/ .*$//gi; + } + if ($args =~ /--NP-statuses=/) + { + @data_in = split(/--NP-statuses=/,$args); + $np_statuses = $data_in[1]; + $np_statuses =~ s/ .*$//gi; + } + if ($args =~ /--ignore-lists=/) + { + @data_in = split(/--ignore-lists=/,$args); + $ignore_lists = $data_in[1]; + $ignore_lists =~ s/ .*$//gi; + } + if ($args =~ /-ftp-transfer/i) + { + if (!$Q) + {print "\n----- FTP TRANSFER MODE -----\n\n";} + $ftp_transfer=1; + } + if ($args =~ /--test/i) + { + $T=1; $TEST=1; + print "\n----- TESTING -----\n\n"; + } + } +} +else +{ +print "no command line options set, using defaults.\n"; +} +### end parsing run-time options ### + + +$secX = time(); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + +# # rerun override - Use this to override the day manually +# $year='2007'; +# $mon='5'; +# $mday='18'; + + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + $timestamp = "$year-$mon-$mday $hour:$min:$sec"; + $filedate = "$year$mon$mday"; + $ABIfiledate = "$mon-$mday-$year$us$hour$min$sec"; + $shipdate = "$year-$mon-$mday"; + $datestamp = "$year/$mon/$mday $hour:$min"; + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + if ( ($line =~ /^VARREPORT_host/) && ($CLIREPORT_host < 1) ) + {$VARREPORT_host = $line; $VARREPORT_host =~ s/.*=//gi;} + if ( ($line =~ /^VARREPORT_user/) && ($CLIREPORT_user < 1) ) + {$VARREPORT_user = $line; $VARREPORT_user =~ s/.*=//gi;} + if ( ($line =~ /^VARREPORT_pass/) && ($CLIREPORT_pass < 1) ) + {$VARREPORT_pass = $line; $VARREPORT_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARREPORT_port/) && ($CLIREPORT_port < 1) ) + {$VARREPORT_port = $line; $VARREPORT_port =~ s/.*=//gi;} + if ( ($line =~ /^VARREPORT_dir/) && ($CLIREPORT_dir < 1) ) + {$VARREPORT_dir = $line; $VARREPORT_dir =~ s/.*=//gi;} + + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + + $sale_statusesSQL = $sale_statuses; + $sale_statusesSQL =~ s/-/','/gi; + $sale_statusesSQL = "'$sale_statusesSQL'"; + $ni_statusesSQL = $ni_statuses; + $ni_statusesSQL =~ s/-/','/gi; + $ni_statusesSQL = "'$ni_statusesSQL'"; + $np_statusesSQL = $np_statuses; + $np_statusesSQL =~ s/-/','/gi; + $np_statusesSQL = "'$np_statusesSQL'"; + $ignore_listsSQL = $ignore_lists; + $ignore_listsSQL =~ s/-/','/gi; + $ignore_listsSQL = "'$ignore_listsSQL'"; + +if (!$Q) + { + print "\n\n\n\n\n\n\n\n\n\n\n\n-- AST_sourceID_summary_export.pl --\n\n"; + print "This program is designed to generate a summary report of sourceIDs for VICIDIAL outbound-only campaign and post them to a file. \n"; + print "\n"; + print "Sale Statuses: $sale_statuses $sale_statusesSQL\n"; + print "NI Statuses: $ni_statuses $ni_statusesSQL\n"; + print "NP Statuses: $np_statuses $np_statusesSQL\n"; + print "Ignore Lists: $ignore_lists $ignore_listsSQL\n"; + print "\n"; + } + +$outfile = "SOURCEID_SUMMARY$filedate$txt"; + +### open the X out file for writing ### +open(out, ">$PATHweb/vicidial/server_reports/$outfile") + || die "Can't open $outfile: $!\n"; + +if (!$VARDB_port) {$VARDB_port='3306';} + + +use DBI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +$dbhB = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +$w=0; + + +########################################################################### +########### SALES TOTAL IN SYSTEM BY SOURCE_ID vicidial_list ###### +########################################################################### +$stmtA = "select source_id,count(*) from vicidial_list where status IN($sale_statusesSQL) and list_id NOT IN($ignore_listsSQL) group by source_id order by source_id;"; +if ($DB) {print "|$stmtA|\n";} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $source_id = $aryA[0]; + $count = $aryA[1]; + + print out "ALL_SALES|$source_id|$count\r\n"; + if ($DBX) {print "$rec_count|ALL_SALES|$source_id|$count|\n";} + $rec_count++; $w++; + } +$sthA->finish(); + + +########################################################################### +########### NI TOTAL IN SYSTEM BY SOURCE_ID vicidial_list ###### +########################################################################### +$stmtA = "select source_id,count(*) from vicidial_list where status IN($ni_statusesSQL) and list_id NOT IN($ignore_listsSQL) group by source_id order by source_id;"; +if ($DB) {print "|$stmtA|\n";} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $source_id = $aryA[0]; + $count = $aryA[1]; + + print out "NOT_INTR|$source_id|$count\r\n"; + if ($DBX) {print "$rec_count|NOT_INTR|$source_id|$count|\n";} + $rec_count++; $w++; + } +$sthA->finish(); + + +########################################################################### +########### NP TOTAL IN SYSTEM BY SOURCE_ID vicidial_list ###### +########################################################################### +$stmtA = "select source_id,count(*) from vicidial_list where status IN($np_statusesSQL) and list_id NOT IN($ignore_listsSQL) group by source_id order by source_id;"; +if ($DB) {print "|$stmtA|\n";} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $source_id = $aryA[0]; + $count = $aryA[1]; + + print out "B6_NO_PTCH|$source_id|$count\r\n"; + if ($DBX) {print "$rec_count|B6_NO_PTCH|$source_id|$count|\n";} + $rec_count++; $w++; + } +$sthA->finish(); + + +########################################################################### +########### ALL TOTAL IN SYSTEM BY SOURCE_ID vicidial_list ###### +########################################################################### +$stmtA = "select source_id,count(*) from vicidial_list where list_id NOT IN($ignore_listsSQL) group by source_id order by source_id;"; +if ($DB) {print "|$stmtA|\n";} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $source_id = $aryA[0]; + $count = $aryA[1]; + + print out "RECD_COUNT|$source_id|$count\r\n"; + if ($DBX) {print "$rec_count|RECD_COUNT|$source_id|$count|\n";} + $rec_count++; $w++; + } +$sthA->finish(); + +close(out); + + +if ($ftp_transfer > 0) +{ + use Net::FTP; + + if (!$Q) {print "Sending File Over FTP: $outfile\n";} + $ftp = Net::FTP->new("$VARREPORT_host", Port => $VARREPORT_port); + $ftp->login("$VARREPORT_user","$VARREPORT_pass"); + $ftp->cwd("$VARREPORT_dir"); + $ftp->put("$PATHweb/vicidial/server_reports/$outfile", "$outfile"); + $ftp->quit; +} + +### calculate time to run script ### +$secY = time(); +$secZ = ($secY - $secX); +$secZm = ($secZ /60); + +if (!$Q) {print "SOURCEID EXPORT FOR $timestamp: $outfile\n";} +if (!$Q) {print "TOTAL RECORDS IN FILE: $w\n";} +if (!$Q) {print "script execution time in seconds: $secZ minutes: $secZm\n";} + +exit; + + diff --git a/agc_2-X/branches/agc_2.0.4/bin/AST_update.pl b/agc_2-X/branches/agc_2.0.4/bin/AST_update.pl new file mode 100644 index 00000000..b7ea88cc --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/AST_update.pl @@ -0,0 +1,1242 @@ +#!/usr/bin/perl +# +# AST_update.pl version 14 *DBI-version* +# +# DESCRIPTION: +# uses the Asterisk Manager interface and Net::MySQL to update the live_channels +# tables and verify the parked_channels table in the asterisk MySQL database +# This "near-live-status of Zap/SIP/Local/IAX channels" list is used by clients +# +# SUMMARY: +# This program was designed for people using the Asterisk PBX with Digium +# Zaptel telco cards and SIP VOIP hardphones or softphones as extensions, it +# could be adapted to other functions, but I designed it specifically for +# Zap/IAX2/SIP users. The program will run on UNIX or Win32 command line +# providing the following criteria are met: +# +# Win32 - ActiveState Perl 5.8.0 +# UNIX - Gnome or KDE with Tk/Tcl and perl Tk/Tcl modules loaded +# Both - Net::MySQL, Net::Telnet and Time::HiRes perl modules loaded +# +# For the client program to work, this program must always be running +# +# For this program to work you need to have the "asterisk" MySQL database +# created and create the tables listed in the MySQL_AST_CREATE_tables.sql file, +# also make sure that the machine running this program has select/insert/update/delete +# access to that database +# +# In your Asterisk server setup you also need to have several things activated +# and defined. See the CONF_Asterisk.txt file for details +# +# It is recommended that you run this program on the local Asterisk machine +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# version changes: +# 41228-1659 - modified to compensate for manager output response hiccups +# 50107-1611 - modified to add Zap and IAX2 clients (differentiate from trunks) +# 50117-1537 - modified to add MySQL port ($DB_port) var from conf file +# 50303-0958 - modified to compensate for Zap manager output hiccups +# 50406-1320 - added channel_data to live_channels table for more flexibility +# also added Zap/IAX client check every 100 loop instead of only once +# 50509-1047 - added collection of server_performance data with SYSPERF flag +# 50621-1307 - modified to allow for SIP trunks +# 50810-1601 - Added database server variable definitions lookup +# 50823-1625 - Altered Debug vars and initial CVS/1.2 support for changed output +# 50824-1606 - Altered CVS/1.2 support for "show channels concise" output +# 50829-1134 - Added processor percentage usage to stat collection +# 51229-1355 - Added ability to take ! as delimited for 1.2 show channels concise +# 60117-1202 - Changed IAX2 client phone channel to reflect change to '-' iteration +# 60411-1032 - Fixed bug in test section that caused crash with ** in extension +# 60807-1605 - Changed to DBI +# 60808-1005 - changed to use /etc/astguiclient.conf for configs +# 60808-1500 - Fixed another bug in that caused crash with ** in extension +# 60814-1523 - SYSLOG and SYSPERF looked up from database, dynamic settings +# 60926-1601 - validate proper binutil locations for performance gathering +# 61130-1008 - defaults show_channels_format to 1 for non 1.0 version Asterisk +# 61227-1659 - added "core show channels concise" for Asterisk 1.4 compatibility +# + +$build = '61227-1659'; + +# constants +$SYSPERF=0; # system performance logging to MySQL server_performance table every 5 seconds +$SYSPERF_rec=0; # is dial-time recording turned on +$SYSLOG=0; # set to 1 to write log to a file +$DB=0; # Debug flag, set to 1 for debug messages WARNING LOTS OF OUTPUT!!! +$DBX=0; # Debug flag, set to 1 for debug messages WARNING LOTS OF OUTPUT!!! +$US='__'; +$AMP='@'; +$MT[0]=''; +$cpuUSERprev=0; +$cpuSYSTprev=0; +$cpuIDLEprev=0; + +# find proper locations of bin utils + +# cat +$bincat = "/usr/bin/cat"; +if (-e "/usr/local/bin/cat") + {$bincat = "/usr/local/bin/cat";} +else + { + if (-e "/bin/cat") + {$bincat = "/bin/cat";} + } + +# free +$binfree = "/usr/bin/free"; +if (-e "/usr/local/bin/free") + {$binfree = "/usr/local/bin/free";} +else + { + if (-e "/bin/free") + {$binfree = "/bin/free";} + } + +# ps +$binps = "/bin/ps"; +if (-e "/usr/local/bin/ps") + {$binps = "/usr/local/bin/ps";} +else + { + if (-e "/usr/bin/ps") + {$binps = "/usr/bin/ps";} + } + + +# DB table variables for testing + $parked_channels = 'parked_channels'; + $live_channels = 'live_channels'; + $live_sip_channels = 'live_sip_channels'; + $server_updater = 'server_updater'; +# $parked_channels = 'TEST_parked_channels'; +# $live_channels = 'TEST_live_channels'; +# $live_sip_channels = 'TEST_live_sip_channels'; +# $server_updater = 'TEST_server_updater'; + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-t] = test\n [-sysperf] = system performance logging\n [-sysperfdebug] = system performance debug output\n [-debug] = verbose debug messages\n [-debugX] = Extra-verbose debug messages\n\n"; + exit; + } + else + { + if ($args =~ /-sysperf/i) + { + $SYSPERF=1; # System performance logging flag + } + if ($args =~ /-sysperfdebug/i) + { + $SYSPERFDB=1; # prints system performance data out to STDOUT + } + if ($args =~ /-debug/i) + { + $DB=1; # Debug flag + } + if ($args =~ /--debugX/i) + { + $DBX=1; + print "\n----- SUPER-DUPER DEBUGGING -----\nBUILD: $build\n"; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +# print "no command line options set\n"; +} +### end parsing run-time options ### + + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + + &get_time_now; + +if (!$UPLOGfile) {$UPLOGfile = "$PATHlogs/update.$year-$mon-$mday";} +if (!$VARDB_port) {$VARDB_port='3306';} + + $event_string='PROGRAM STARTED||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||'; + &event_logger; + +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use Net::Telnet (); +use DBI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + $event_string='LOGGED INTO MYSQL SERVER ON 1 CONNECTION|'; + &event_logger; + +### Grab Server values from the database +$stmtA = "SELECT telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERNAMEupdate,ASTmgrUSERNAMElisten,ASTmgrUSERNAMEsend,max_vicidial_trunks,answer_transfer_agent,local_gmt,ext_context,asterisk_version,sys_perf_log,vd_server_logs FROM servers where server_ip = '$server_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBtelnet_host = "$aryA[0]"; + $DBtelnet_port = "$aryA[1]"; + $DBASTmgrUSERNAME = "$aryA[2]"; + $DBASTmgrSECRET = "$aryA[3]"; + $DBASTmgrUSERNAMEupdate = "$aryA[4]"; + $DBASTmgrUSERNAMElisten = "$aryA[5]"; + $DBASTmgrUSERNAMEsend = "$aryA[6]"; + $DBmax_vicidial_trunks = "$aryA[7]"; + $DBanswer_transfer_agent= "$aryA[8]"; + $DBSERVER_GMT = "$aryA[9]"; + $DBext_context = "$aryA[10]"; + $DBasterisk_version = "$aryA[11]"; + $DBsys_perf_log = "$aryA[12]"; + $DBvd_server_logs = "$aryA[13]"; + if ($DBtelnet_host) {$telnet_host = $DBtelnet_host;} + if ($DBtelnet_port) {$telnet_port = $DBtelnet_port;} + if ($DBASTmgrUSERNAME) {$ASTmgrUSERNAME = $DBASTmgrUSERNAME;} + if ($DBASTmgrSECRET) {$ASTmgrSECRET = $DBASTmgrSECRET;} + if ($DBASTmgrUSERNAMEupdate) {$ASTmgrUSERNAMEupdate = $DBASTmgrUSERNAMEupdate;} + if ($DBASTmgrUSERNAMElisten) {$ASTmgrUSERNAMElisten = $DBASTmgrUSERNAMElisten;} + if ($DBASTmgrUSERNAMEsend) {$ASTmgrUSERNAMEsend = $DBASTmgrUSERNAMEsend;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBext_context) {$ext_context = $DBext_context;} + if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;} + if ($DBsys_perf_log =~ /Y/) {$SYSPERF = '1';} + if ($DBvd_server_logs =~ /Y/) {$SYSLOG = '1';} + $rec_count++; + } +$sthA->finish(); + + $show_channels_format = 1; + if ($AST_ver =~ /^1\.0/i) {$show_channels_format = 0;} + if ($AST_ver =~ /^1\.4/i) {$show_channels_format = 2;} + print STDERR "SHOW CHANNELS format: $show_channels_format\n"; + +##### LOOK FOR ZAP CLIENTS AS DEFINED IN THE phones TABLE SO THEY ARE NOT MISLABELED AS TRUNKS + print STDERR "LOOKING FOR Zap clients assigned to this server:\n"; + $Zap_client_count=0; + $Zap_client_list='|'; + $stmtA = "SELECT extension FROM phones where protocol = 'Zap' and server_ip='$server_ip'"; + if($DB){print STDERR "|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + print STDERR $aryA[0],"\n"; + $Zap_client_list .= "$aryA[0]|"; + $Zap_client_count++; + $rec_count++; + } + $sthA->finish(); + +##### LOOK FOR IAX2 CLIENTS AS DEFINED IN THE phones TABLE SO THEY ARE NOT MISLABELED AS TRUNKS + print STDERR "LOOKING FOR IAX2 clients assigned to this server:\n"; + $IAX2_client_count=0; + $IAX2_client_list='|'; + $stmtA = "SELECT extension FROM phones where protocol = 'IAX2' and server_ip='$server_ip'"; + if($DB){print STDERR "|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + print STDERR $aryA[0],"\n"; + $IAX2_client_list .= "$aryA[0]|"; + if ($aryA[0] !~ /\@/) + {$IAX2_client_list .= "$aryA[0]$AMP$aryA[0]|";} + else + { + $IAX_user = $aryA[0]; + $IAX_user =~ s/\@.*$//gi; + $IAX2_client_list .= "$IAX_user|"; + } + $IAX2_client_count++; + $rec_count++; + } + $sthA->finish(); + + +##### LOOK FOR SIP CLIENTS AS DEFINED IN THE phones TABLE SO THEY ARE NOT MISLABELED AS TRUNKS + print STDERR "LOOKING FOR SIP clients assigned to this server:\n"; + $SIP_client_count=0; + $SIP_client_list='|'; + $stmtA = "SELECT extension FROM phones where protocol = 'SIP' and server_ip='$server_ip'"; + if($DB){print STDERR "|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + print STDERR $aryA[0],"\n"; + $SIP_client_list .= "$aryA[0]|"; + if ($aryA[0] !~ /\@/) + {$SIP_client_list .= "$aryA[0]$AMP$aryA[0]|";} + else + { + $SIP_user = $aryA[0]; + $SIP_user =~ s/\@.*$//gi; + $SIP_client_list .= "$SIP_user|"; + } + $SIP_client_count++; + $rec_count++; + } + $sthA->finish(); + + print STDERR "Zap Clients: $Zap_client_list\n"; + print STDERR "IAX2 Clients: $IAX2_client_list\n"; + print STDERR "SIP Clients: $SIP_client_list\n"; + +$one_day_interval = 12; # 2 hour loops for one day +while($one_day_interval > 0) +{ + + $event_string="STARTING NEW MANAGER TELNET CONNECTION||ATTEMPT|ONE DAY INTERVAL:$one_day_interval|"; + &event_logger; + +if (!$telnet_port) {$telnet_port = '5038';} + + ### connect to asterisk manager through telnet + $t = new Net::Telnet (Port => $telnet_port, + Prompt => '/.*[\$%#>] $/', + Output_record_separator => '',); + #$fh = $t->dump_log("$telnetlog"); # uncomment for telnet log + if (length($ASTmgrUSERNAMEupdate) > 3) {$telnet_login = $ASTmgrUSERNAMEupdate;} + else {$telnet_login = $ASTmgrUSERNAME;} + $t->open("$telnet_host"); + $t->waitfor('/0\n$/'); # print login + $t->print("Action: Login\nUsername: $telnet_login\nSecret: $ASTmgrSECRET\n\n"); + $t->waitfor('/Authentication accepted/'); # waitfor auth accepted + + $event_string="STARTING NEW MANAGER TELNET CONNECTION|$telnet_login|CONFIRMED CONNECTION|ONE DAY INTERVAL:$one_day_interval|"; + &event_logger; + + $endless_loop=5769999; # 30 days minutes at .45 seconds per loop + + while($endless_loop > 0) + { + + + @DBchannels=@MT; + @DBsips=@MT; + @list_channels=@MT; + @test_channels=@MT; + + &get_current_channels; + + &validate_parked_channels; + + + $t->buffer_empty; + if ($show_channels_format < 1) + { + @list_channels = $t->cmd(String => "Action: Command\nCommand: show channels\n\n", Prompt => '/--END COMMAND-.*/'); + } + if ($show_channels_format == 1) + { + @list_channels = $t->cmd(String => "Action: Command\nCommand: show channels concise\n\n", Prompt => '/--END COMMAND-.*/'); + } + if ($show_channels_format > 1) + { + @list_channels = $t->cmd(String => "Action: Command\nCommand: core show channels concise\n\n", Prompt => '/--END COMMAND-.*/'); + } + + ##### TEST CHANNELS ZAP/IAX2/Local TO SEE IF THERE WAS A LARGE HICCUP IN OUTPUT FROM PREVIOUS OUTPUT + @test_channels=@list_channels; + $test_zap_count=0; + $test_iax_count=0; + $test_local_count=0; + $test_sip_count=0; + $s=0; + foreach(@test_channels) + { + chomp($test_channels[$s]); + if($DBX){print "$s|$test_channels[$s]\n";} + $test_channels[$s] =~ s/Congestion\s+\(Empty\)/ SIP\/CONGEST/gi; + $test_channels[$s] =~ s/\(Outgoing Line\)|\(None\)/SIP\/ring/gi; + $test_channels[$s] =~ s/\(Empty\)/SIP\/internal/gi; + if (!$show_channels_format) + { + $test_channels[$s] =~ s/^\s*|\s*$//gi; + $test_channels[$s] =~ s/\(.*\)//gi; + } + else + { + $EXcount = 0; + $EXcount = @{[$test_channels[$s] =~ /\!/g]}; + if ($EXcount > 10) + { + @test_chan_12 = split(/\!/, $test_channels[$s]); + } + else + { + @test_chan_12 = split(/:/, $test_channels[$s]); + } + # @test_chan_12 = split(/:/, $test_channels[$s]); + if (length($test_chan_12[6])<2) {$test_chan_12[6] = 'SIP/ring';} + $test_channels[$s] = "$test_chan_12[0] $test_chan_12[6]"; + } + if ($test_channels[$s] =~ /^Zap|^IAX2|^SIP|^Local/) + { + if ($test_channels[$s] =~ /^(\S+)\s+.+\s+(\S+)$/) + { + $channel = $1; + $extension = $2; + if ($show_channels_format) + {$extension =~ s/^.*\(|\).*$//gi;} + $extension =~ s/^SIP\/|-\S+$//gi; + $extension =~ s/\|.*//gi; + if ($channel =~ /^SIP/) {$test_sip_count++;} + if ($channel =~ /^Local/) {$test_local_count++;} + if ($IAX2_client_count) + { + $channel_match=$channel; + $channel_match =~ s/\/\d+$|-\d+$//gi; + $channel_match =~ s/^IAX2\///gi; + $channel_match =~ s/\*/\\\*/gi; + if ($IAX2_client_list =~ /\|$channel_match\|/i) {$test_iax_count++;} + } + if ($Zap_client_count) + { + $channel_match=$channel; + $channel_match =~ s/^Zap\///gi; + $channel_match =~ s/\*/\\\*/gi; + if ($Zap_client_list =~ /\|$channel_match\|/i) {$test_zap_count++;} + } + } + } + $s++; + } + + + + # $DB_live_lines = ($#DBchannels + $#DBsips); + $DB_live_lines = ($channel_counter + $sip_counter); + if ( (!$DB_live_lines) or ($#list_channels < 2) ) + {$PERCENT_static = 0;} + else + { + $PERCENT_static = ( ($#list_channels / $DB_live_lines) * 100); + $PERCENT_static = sprintf("%6.2f", $PERCENT_static); + } + + if ( (!$test_zap_count) or ($zap_client_counter < 2) ) + {$PERCENT_ZC_static = 0;} + else + { + $PERCENT_ZC_static = ( ($test_zap_count / $zap_client_counter) * 100); + $PERCENT_ZC_static = sprintf("%6.2f", $PERCENT_ZC_static); + } + + if ( (!$test_iax_count) or ($iax_client_counter < 2) ) + {$PERCENT_IC_static = 0;} + else + { + $PERCENT_IC_static = ( ($test_iax_count / $iax_client_counter) * 100); + $PERCENT_IC_static = sprintf("%6.2f", $PERCENT_IC_static); + } + + if ( (!$test_local_count) or ($local_client_counter < 2) ) + {$PERCENT_LC_static = 0;} + else + { + $PERCENT_LC_static = ( ($test_local_count / $local_client_counter) * 100); + $PERCENT_LC_static = sprintf("%6.2f", $PERCENT_LC_static); + } + + if ( (!$test_sip_count) or ($sip_client_counter < 2) ) + {$PERCENT_SC_static = 0;} + else + { + $PERCENT_SC_static = ( ($test_sip_count / $sip_client_counter) * 100); + $PERCENT_SC_static = sprintf("%6.2f", $PERCENT_SC_static); + } + + if ($endless_loop =~ /0$/) + {print "-$now_date $PERCENT_static $#list_channels $#DBchannels:$channel_counter $#DBsips:$sip_counter $PERCENT_ZC_static|$test_zap_count:$zap_client_counter $PERCENT_IC_static|$test_iax_count:$iax_client_counter $PERCENT_LC_static|$test_local_count:$local_client_counter $PERCENT_SC_static|$test_sip_count:$sip_client_counter\n";} + + if ( ( ($PERCENT_static < 10) && ( ($channel_counter > 3) or ($sip_counter > 4) ) ) or + ( ($PERCENT_static < 20) && ( ($channel_counter > 10) or ($sip_counter > 10) ) ) or + ( ($PERCENT_static < 30) && ( ($channel_counter > 20) or ($sip_counter > 20) ) ) or + ( ($PERCENT_static < 40) && ( ($channel_counter > 30) or ($sip_counter > 30) ) ) or + ( ($PERCENT_static < 50) && ( ($channel_counter > 40) or ($sip_counter > 40) ) ) or + ( ($PERCENT_ZC_static < 20) && ( $zap_client_counter > 3 ) ) or + ( ($PERCENT_ZC_static < 40) && ( $zap_client_counter > 9 ) ) or + ( ($PERCENT_IC_static < 20) && ( $iax_client_counter > 3 ) ) or + ( ($PERCENT_IC_static < 40) && ( $iax_client_counter > 9 ) ) or + ( ($PERCENT_SC_static < 20) && ( $sip_client_counter > 3 ) ) or + ( ($PERCENT_SC_static < 40) && ( $sip_client_counter > 9 ) ) ) + { + $UD_bad_grab++; + $event_string="------ UPDATER BAD GRAB!!! UBGcount: $UD_bad_grab\n $PERCENT_static $#list_channels $#DBchannels:$channel_counter $#DBsips:$sip_counter $PERCENT_ZC_static|$test_zap_count:$zap_client_counter $PERCENT_IC_static|$test_iax_count:$iax_client_counter $PERCENT_LC_static|$test_local_count:$local_client_counter $PERCENT_SC_static|$test_sip_count:$sip_client_counter\n"; + print "$event_string\n"; + &event_logger; + if ($UD_bad_grab > 20) {$UD_bad_grab=0;} + } + else + { + $UD_bad_grab=0; + if ( ($endless_loop =~ /0$/) && ($SYSPERF) ) + { + $cpuUSERcent=0; $cpuSYSTcent=0; $cpuIDLEcent=0; + ### get processor usage seconds ### + # cpu 924841 211725 270473 6961811 + @cpuUSE = `$bincat /proc/stat`; + if ($cpuUSE[0] =~ /cpu\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/) + { + $cpuUSER = ($1 + $2); + $cpuSYST = $3; + $cpuIDLE = $4; + $cpuUSERdiff = ($cpuUSER - $cpuUSERprev); + $cpuSYSTdiff = ($cpuSYST - $cpuSYSTprev); + $cpuIDLEdiff = ($cpuIDLE - $cpuIDLEprev); + $cpuIDLEdiffTOTAL = (($cpuUSERdiff + $cpuSYSTdiff) + $cpuIDLEdiff); + if ($cpuIDLEdiffTOTAL > 0) + { + $cpuUSERcent = sprintf("%.0f", (($cpuUSERdiff / $cpuIDLEdiffTOTAL) * 100)); + $cpuSYSTcent = sprintf("%.0f", (($cpuSYSTdiff / $cpuIDLEdiffTOTAL) * 100)); + $cpuIDLEcent = sprintf("%.0f", (($cpuIDLEdiff / $cpuIDLEdiffTOTAL) * 100)); + } + $cpuUSERprev=$cpuUSER; + $cpuSYSTprev=$cpuSYST; + $cpuIDLEprev=$cpuIDLE; + } + + ### get system load ### + $serverLOAD = `$bincat /proc/loadavg`; + $serverLOAD =~ s/ .*//gi; + $serverLOAD =~ s/\D//gi; + + ### get memory usage ### + @GRABserverMEMORY = `$binfree -m -t`; + if ($GRABserverMEMORY[1] =~ /Mem:\s+(\d+)\s+(\d+)\s+(\d+)\s+/) + { + $MEMused = $2; + $MEMfree = $3; + } + ### get number of system processes ### + @GRABserverPROCESSES = `$binps -A --no-heading`; + $serverPROCESSES = $#GRABserverPROCESSES; + + if ($SYSPERF_rec) {$recording_count = ($test_local_count / 2)} + else {$recording_count=0;} + + if ($SYSPERFDB) + {print "$serverLOAD $MEMfree $MEMused $serverPROCESSES $#list_channels $cpuUSERcent $cpuSYSTcent $cpuIDLEcent\n";} + + $stmtA = "INSERT INTO server_performance (start_time,server_ip,sysload,freeram,usedram,processes,channels_total,trunks_total,clients_total,clients_zap,clients_iax,clients_local,clients_sip,live_recordings,cpu_user_percent,cpu_system_percent,cpu_idle_percent) values('$now_date','$server_ip','$serverLOAD','$MEMfree','$MEMused','$serverPROCESSES','$#list_channels','$channel_counter','$sip_counter','$test_zap_count','$test_iax_count','$test_local_count','$test_sip_count','$recording_count','$cpuUSERcent','$cpuSYSTcent','$cpuIDLEcent')"; + if( ($DB) or ($UD_bad_grab) ){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA) or die "Couldn't execute query: |$stmtA|\n"; + } + } + + if ($endless_loop =~ /00$/) + { + ##### LOOK FOR ZAP CLIENTS AS DEFINED IN THE phones TABLE SO THEY ARE NOT MISLABELED AS TRUNKS + print STDERR "LOOKING FOR Zap clients assigned to this server:\n"; + $Zap_client_count=0; + $Zap_client_list='|'; + $stmtA = "SELECT extension FROM phones where protocol = 'Zap' and server_ip='$server_ip'"; + if($DB){print STDERR "|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + print STDERR $aryA[0],"\n"; + $Zap_client_list .= "$aryA[0]|"; + $Zap_client_count++; + $rec_count++; + } + $sthA->finish(); + + ##### LOOK FOR IAX2 CLIENTS AS DEFINED IN THE phones TABLE SO THEY ARE NOT MISLABELED AS TRUNKS + print STDERR "LOOKING FOR IAX2 clients assigned to this server:\n"; + $IAX2_client_count=0; + $IAX2_client_list='|'; + $stmtA = "SELECT extension FROM phones where protocol = 'IAX2' and server_ip='$server_ip'"; + if($DB){print STDERR "|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + print STDERR $aryA[0],"\n"; + $IAX2_client_list .= "$aryA[0]|"; + if ($aryA[0] !~ /\@/) + {$IAX2_client_list .= "$aryA[0]$AMP$aryA[0]|";} + else + { + $IAX_user = $aryA[0]; + $IAX_user =~ s/\@.*$//gi; + $IAX2_client_list .= "$IAX_user|"; + } + $IAX2_client_count++; + $rec_count++; + } + $sthA->finish(); + + ##### LOOK FOR SIP CLIENTS AS DEFINED IN THE phones TABLE SO THEY ARE NOT MISLABELED AS TRUNKS + print STDERR "LOOKING FOR SIP clients assigned to this server:\n"; + $SIP_client_count=0; + $SIP_client_list='|'; + $stmtA = "SELECT extension FROM phones where protocol = 'SIP' and server_ip='$server_ip'"; + if($DB){print STDERR "|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + print STDERR $aryA[0],"\n"; + $SIP_client_list .= "$aryA[0]|"; + if ($aryA[0] !~ /\@/) + {$SIP_client_list .= "$aryA[0]$AMP$aryA[0]|";} + else + { + $SIP_user = $aryA[0]; + $SIP_user =~ s/\@.*$//gi; + $SIP_client_list .= "$SIP_user|"; + } + $SIP_client_count++; + $rec_count++; + } + $sthA->finish(); + + print STDERR "Zap Clients: $Zap_client_list\n"; + print STDERR "IAX2 Clients: $IAX2_client_list\n"; + print STDERR "SIP Clients: $SIP_client_list\n"; + ### Grab Server values from the database + $stmtA = "SELECT sys_perf_log,vd_server_logs FROM servers where server_ip = '$server_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBsys_perf_log = "$aryA[0]"; + $DBvd_server_logs = "$aryA[1]"; + if ($DBsys_perf_log =~ /Y/) {$SYSPERF = '1';} + else {$SYSPERF = '0';} + if ($DBvd_server_logs =~ /Y/) {$SYSLOG = '1';} + else {$SYSLOG = '0';} + $rec_count++; + } + $sthA->finish(); + if ($SYSPERFDB) + {print "SYSPERF RELOAD: $DBsys_perf_log:$SYSPERF|$DBvd_server_logs:$SYSLOG\n";} + } + + @list_chan_12=@MT; + $EXcount = 0; + $EXcount = @{[$list_channels[2] =~ /\!/g]}; + if ($EXcount > 10) + { + @list_chan_12 = split(/\!/, $list_channels[2]); + } + else + { + @list_chan_12 = split(/:/, $list_channels[2]); + } + if( ($DB) && ($show_channels_format) ) {print "concise: $#list_chan_12\n";} + if ( ( ( ($list_channels[1] =~ /State Appl\./) or ($list_channels[2] =~ /State Appl\.|Application\(Data\)/) or ($list_channels[3] =~ /State Appl\.|Application\(Data\)/) ) || ($#list_chan_12 > 8) ) && (!$UD_bad_grab) ) + { + + $c=0; + if($DB){print "lines: $#list_channels\n";} + if($DB){print "DBchn: $#DBchannels\n";} + if($DB){print "DBsip: $#DBsips\n";} + foreach(@list_channels) + { + # $DBchannels =~ s/^\|//g; + + chomp($list_channels[$c]); + if( ($DB) or ($UD_bad_grab) ){print "-|$c|$list_channels[$c]|\n";} + $list_channels[$c] =~ s/Congestion\s+\(Empty\)/ SIP\/CONGEST/gi; + $list_channels[$c] =~ s/\(Outgoing Line\)|\(None\)/SIP\/ring/gi; + $list_channels[$c] =~ s/\(Empty\)/SIP\/internal/gi; + if (!$show_channels_format) + { + $list_channels[$c] =~ s/^\s*|\s*$//gi; + $list_channels[$c] =~ s/\(.*\)//gi; + } + else + { + @list_chan_12=@MT; + if ($EXcount > 10) + { + @list_chan_12 = split(/\!/, $list_channels[$c]); + } + else + { + @list_chan_12 = split(/:/, $list_channels[$c]); + } + if ($DBX) {print "EXcount: $EXcount\n";} + if (length($list_chan_12[6])<2) {$list_chan_12[6] = 'SIP/ring';} + $list_channels[$c] = "$list_chan_12[0] $list_chan_12[6]"; + } + $list_SIP[$c] = $list_channels[$c]; + if( ($DB) or ($UD_bad_grab) ){print "+|$c|$list_channels[$c]|\n\n";} + + ########## PARSE EACH LINE TO DETERMINE WHETHER IT IS TRUNK OR CLIENT AND PUT IN APPROPRIATE TABLE + if ($list_channels[$c] =~ /^Zap|^IAX2|^SIP|^Local/) + { + if ($list_channels[$c] =~ /^(\S+)\s+.+\s+(\S+)$/) + { + $line_type = ''; + $channel = $1; + $extension = $2; + $channel_data = $extension; + if ($show_channels_format) + { + $extension =~ s/^.*\(|\).*$//gi; + #### new data in 1.2 for future use + # SIP/cc160-7b91:default:917274514920:3:Up:Dial:Zap/g2/17274514920|30|o:cc160::3:9:Zap/25-1 + # Zap/30-1:demo:010*010*010*012*8600091:1:Up:Dial:IAX2/TESTast2:test@10.10.10.12:4569/8600051|25|o:::3:123:IAX2/TESTast2-29 + # Zap/9-1:demo:990009*CL_UMGCOF_L**6317906**9545541833*13678*:2:Up:Dial:Zap/r3/90009*CL_UMGCOF_L**6317906**9545541833*13678*|120|o:::3:334:Zap/82-1 + # $channel = $list_chan_12[0]; + # $channel_data = $list_chan_12[0]; + # $context = $list_chan_12[1]; + # $dialed = $list_chan_12[2]; + # $priority = $list_chan_12[3]; + # $state = $list_chan_12[4]; + # $extension = $list_chan_12[6]; + # $callerid = $list_chan_12[7]; + # $duration = $list_chan_12[10]; + # $bridged = $list_chan_12[11]; + } + $extension =~ s/^SIP\/|-\S+$//gi; + $extension =~ s/\|.*//gi; + $QRYchannel = "$channel$US$extension"; + + if( ($DB) or ($UD_bad_grab) ){print "channel: |$channel|\n";} + if( ($DB) or ($UD_bad_grab) ){print "extension: |$extension|\n";} + if( ($DB) or ($UD_bad_grab) ){print "QRYchannel:|$QRYchannel|\n";} + + if ($channel =~ /^SIP|^Zap|^IAX2/) {$line_type = 'TRUNK';} + if ($channel =~ /^Local/) {$line_type = 'CLIENT';} + if ($IAX2_client_count) + { + $channel_match=$channel; + $channel_match =~ s/\/\d+$|-\d+$//gi; + $channel_match =~ s/^IAX2\///gi; + $channel_match =~ s/\*/\\\*/gi; + # print "checking for IAX2 client: |$channel_match|\n"; + if ($IAX2_client_list =~ /\|$channel_match\|/i) {$line_type = 'CLIENT';} + } + if ($Zap_client_count) + { + $channel_match=$channel; + $channel_match =~ s/^Zap\///gi; + $channel_match =~ s/\*/\\\*/gi; + # print "checking for Zap client: |$channel_match|\n"; + if ($Zap_client_list =~ /\|$channel_match\|/i) {$line_type = 'CLIENT';} + } + if ($SIP_client_count) + { + $channel_match=$channel; + $channel_match =~ s/-\S+$//gi; + $channel_match =~ s/^SIP\///gi; + $channel_match =~ s/\*/\\\*/gi; + # print "checking for SIP client: |$channel_match|\n"; + if ($SIP_client_list =~ /\|$channel_match\|/i) {$line_type = 'CLIENT';} + } + + if ($line_type eq 'TRUNK') + { + if( ($DB) or ($UD_bad_grab) ){print "current channels: $#DBchannels\n";} + + $k=0; + $channel_in_DB=0; + foreach(@DBchannels) + { + if ( ($DBchannels[$k] eq "$QRYchannel") && (!$channel_in_DB) ) + { + $DBchannels[$k] = ''; + $channel_in_DB++; + } + if( ($DB) or ($UD_bad_grab) ){print "DB $k|$DBchannels[$k]| |";} + $k++; + } + + if ( (!$channel_in_DB) && (length($QRYchannel)>3) ) + { + $stmtA = "INSERT INTO $live_channels (channel,server_ip,extension,channel_data) values('$channel','$server_ip','$extension','$channel_data')"; + if( ($DB) or ($UD_bad_grab) ){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA) or die "Couldn't execute query: |$stmtA|\n"; + } + } + + if ($line_type eq 'CLIENT') + { + if( ($DB) or ($UD_bad_grab) ){print "current sips: $#DBsips\n";} + + $k=0; + $sipchan_in_DB=0; + foreach(@DBsips) + { + if ( ($DBsips[$k] eq "$QRYchannel") && (!$sipchan_in_DB) ) + { + $DBsips[$k] = ''; + $sipchan_in_DB++; + } + if( ($DB) or ($UD_bad_grab) ){print "DB $k|$DBsips[$k]| |";} + $k++; + } + + if ( (!$sipchan_in_DB) && (length($QRYchannel)>3) ) + { + $stmtA = "INSERT INTO $live_sip_channels (channel,server_ip,extension,channel_data) values('$channel','$server_ip','$extension','$channel_data')"; + if( ($DB) or ($UD_bad_grab) ){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA) or die "Couldn't execute query: |$stmtA|\n"; + } + } + } + } + + $c++; + } + if($DB){print "COUNT: $c|$#list_channels|$endless_loop\n";} + + + if ($#DBchannels >= 0) + { + $d=0; + foreach(@DBchannels) + { + if (length($DBchannels[$d])>4) + { + ($DELchannel, $DELextension) = split(/\_\_/, $DBchannels[$d]); + $stmtB = "DELETE FROM $live_channels where server_ip='$server_ip' and channel='$DELchannel' and extension='$DELextension' limit 1"; + if( ($DB) or ($UD_bad_grab) ){print STDERR "\n|$stmtB|\n";} + $affected_rows = $dbhA->do($stmtB); + } + $d++; + } + } + + if ($#DBsips >= 0) + { + $d=0; + foreach(@DBsips) + { + if (length($DBsips[$d])>4) + { + ($DELchannel, $DELextension) = split(/\_\_/, $DBsips[$d]); + $stmtB = "DELETE FROM $live_sip_channels where server_ip='$server_ip' and channel='$DELchannel' and extension='$DELextension' limit 1"; + if( ($DB) or ($UD_bad_grab) ){print STDERR "\n|$stmtB|\n";} + $affected_rows = $dbhA->do($stmtB); + } + $d++; + } + } + + ### sleep for 45 hundredths of a second + usleep(1*450*1000); + + $endless_loop--; + if($DB){print STDERR "\nloop counter: |$endless_loop|\n";} + + ### putting a blank file called "update.kill" in a directory will automatically safely kill this program + if (-e "$PATHhome/update.kill") + { + unlink("$PATHhome/update.kill"); + $endless_loop=0; + $one_day_interval=0; + print "\nPROCESS KILLED MANUALLY... EXITING\n\n" + } + + $bad_grabber_counter=0; + $no_channels_12_counter=0; + } + + else + { + if ( ($list_channels[1] !~ /Privilege: Command/) && ($show_channels_format) ) + { + $bad_grabber_counter++; + if($DB){print STDERR "\nbad grab, trying again\n";} + ### sleep for 20 hundredths of a second + usleep(1*200*1000); + + $event_string="BAD GRAB TRYING AGAIN|BAD_GRABS: $bad_grabber_counter|$endless_loop|ONE DAY INTERVAL:$one_day_interval|"; + &event_logger; + + if ($bad_grabber_counter > 100) + { + $endless_loop=0; + $event_string="TOO MANY BAD GRABS, STARTING NEW CONNECTION|BAD_GRABS: $bad_grabber_counter|$endless_loop|ONE DAY INTERVAL:$one_day_interval|"; + &event_logger; + $bad_grabber_counter=0; + } + } + else + { + $no_channels_12_counter++; + $event_string="NO CHANNELS HERE|COUNTER: $no_channels_12_counter|$endless_loop|ONE DAY INTERVAL:$one_day_interval|$list_channels[1]"; + &event_logger; + + if($DBX) {print "*|EMPTY CHANNELS: $no_channels_12_counter|$#list_channels|$list_channels[1]";} + + ### sleep for 40 hundredths of a second + usleep(1*400*1000); + if ($no_channels_12_counter == 3) + { + ### there are no channels, delete all from live_channels, live_sip_channels + $event_string="NO CHANNELS HERE|COUNTER: $no_channels_12_counter|$endless_loop|ONE DAY INTERVAL:$one_day_interval|$list_channels[1]"; + &event_logger; + $stmtB = "DELETE FROM $live_sip_channels where server_ip='$server_ip'"; + if( ($DB) or ($UD_bad_grab) ){print STDERR "\n|$stmtB|\n";} + $affected_rows = $dbhA->do($stmtB); + $stmtB = "DELETE FROM $live_channels where server_ip='$server_ip'"; + if( ($DB) or ($UD_bad_grab) ){print STDERR "\n|$stmtB|\n";} + $affected_rows = $dbhA->do($stmtB); + } + + } + } + + + } + + + if($DB){print "DONE... Exiting... Goodbye... See you later... Not really, initiating next loop...\n";} + + $event_string='HANGING UP|'; + &event_logger; + + @hangup = $t->cmd(String => "Action: Logoff\n\n", Prompt => "/.*/"); + + $ok = $t->close; + + $one_day_interval--; + +} + + $event_string='CLOSING DB CONNECTION|'; + &event_logger; + + +$dbhA->disconnect(); + + +if($DB){print "DONE... Exiting... Goodbye... See you later... Really I mean it this time\n";} + + +exit; + + + + + + + +####################################################################### +# This subroutine simply grabs all active channel/extension combinations from +# the asterisk MySQL database to be compared to the Asterisk Manager results +####################################################################### +sub get_current_channels +{ +$channel_counter=0; +$sip_counter=0; +$zap_client_counter=0; +$iax_client_counter=0; +$local_client_counter=0; +$sip_client_counter=0; + + if($DB){print STDERR "\n|SELECT channel,extension FROM $live_channels where server_ip = '$server_ip'|\n";} + +$stmtA = "SELECT channel,extension FROM $live_channels where server_ip = '$server_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + if($DB){print STDERR $aryA[0],"|", $aryA[1],"\n";} + $DBchannels[$channel_counter] = "$aryA[0]$US$aryA[1]"; + $channel_counter++; + $rec_count++; + } +$sthA->finish(); + +$stmtA = "SELECT channel,extension FROM $live_sip_channels where server_ip = '$server_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count_sip=0; +while ($sthArows > $rec_count_sip) + { + @aryA = $sthA->fetchrow_array; + if($DB){print STDERR $aryA[0],"|", $aryA[1],"\n";} + $DBsips[$sip_counter] = "$aryA[0]$US$aryA[1]"; + + if ($aryA[0] =~ /^Zap/) {$zap_client_counter++;} + if ($aryA[0] =~ /^IAX/) {$iax_client_counter++;} + if ($aryA[0] =~ /^Local/) {$local_client_counter++;} + if ($aryA[0] =~ /^SIP/) {$sip_client_counter++;} + $sip_counter++; + $rec_count_sip++; + } +$sthA->finish(); + + &get_time_now; + +$stmtU = "UPDATE $server_updater set last_update='$now_date' where server_ip='$server_ip'"; + if($DB){print STDERR "\n|$stmtU|\n";} +$affected_rows = $dbhA->do($stmtU); + +} + + + + + +####################################################################### +# The purpose of this subroutine is to make sure that the calls that are +# listed as parked in the parked_channels table are in fact live (to make +# sure the caller has not hung up) and if the channel is not live to delete +# the parked_channels entry for that specific parked channel entry +# +# Yes it does use two DB connections all by itself, I just did that for speed +# and ease of programming to be backward compatible with MySQL < 4.1 or else +# I would have used a delete with subselect and saved all of this bloated code +####################################################################### +sub validate_parked_channels +{ + +if (!$run_validate_parked_channels_now) + { + $parked_counter=0; + @ARchannel=@MT; @ARextension=@MT; @ARparked_time=@MT; @ARparked_time_UNIX=@MT; + $stmtA = "SELECT channel,extension,parked_time,UNIX_TIMESTAMP(parked_time) FROM $parked_channels where server_ip = '$server_ip' order by channel desc, parked_time desc;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $PQchannel = $aryA[0]; + $PQextension = $aryA[1]; + $PQparked_time = $aryA[2]; + $PQparked_time_UNIX = $aryA[3]; + if($DB){print STDERR "\n|$PQchannel|$PQextension|$PQparked_time|$PQparked_time_UNIX|\n";} + + $dbhC = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + $AR=0; + $record_deleted=0; + foreach(@ARchannel) + { + if (@ARchannel[$AR] eq "$PQchannel") + { + if (@ARparked_time_UNIX[$AR] > $PQparked_time_UNIX) + { + if($DBX){print "Duplicate parked channel delete: |$PQchannel|$PQparked_time|\n";} + $stmtPQ = "DELETE FROM $parked_channels where server_ip='$server_ip' and channel='$PQchannel' and extension='$PQextension' and parked_time='$PQparked_time' limit 1"; + if($DB){print STDERR "\n|$stmtPQ|$$DEL_chan_park_counter|$DEL_chan_park_counter|\n\n";} + $affected_rows = $dbhC->do($stmtPQ); + + $DEL_chan_park_counter = "DEL$PQchannel$PQextension"; + $$DEL_chan_park_counter=0; + $record_deleted++; + } + + } + + $AR++; + } + + + + if (!$record_deleted) + { + $ARchannel[$rec_count] = $aryA[0]; + $ARextension[$rec_count] = $aryA[1]; + $ARparked_time[$rec_count] = $aryA[2]; + $ARparked_time_UNIX[$rec_count] = $aryA[3]; + + + $dbhB = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + + $event_string='LOGGED INTO MYSQL SERVER ON 2 CONNECTIONS TO VALIDATE PARKED CALLS|'; + &event_logger; + + $stmtB = "SELECT count(*) FROM $live_channels where server_ip='$server_ip' and channel='$PQchannel' and extension='$PQextension';"; + $sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr; + $sthB->execute or die "executing: $stmtB ", $dbhB->errstr; + $sthBrows=$sthB->rows; + $rec_countB=0; + while ($sthBrows > $rec_countB) + { + @aryB = $sthB->fetchrow_array; + $PQcount = $aryB[0]; + if($DB){print STDERR "\n|$PQcount|\n";} + + $rec_countB++; + } + $sthB->finish(); + + if ($PQcount < 1) + { + $DEL_chan_park_counter = "DEL$PQchannel$PQextension"; + $$DEL_chan_park_counter++; + if($DBX){print STDERR "Parked counter down|$$DEL_chan_park_counter|$DEL_chan_park_counter|\n";} + + ### if the parked channel doesn't exist 6 times then delete it from table + if ($$DEL_chan_park_counter > 5) + { + if($DBX){print " parked channel delete: |$PQchannel|$PQparked_time|\n";} + $stmtPQ = "DELETE FROM $parked_channels where server_ip='$server_ip' and channel='$PQchannel' and extension='$PQextension' limit 1"; + if($DB){print STDERR "\n|$stmtPQ|$$DEL_chan_park_counter|$DEL_chan_park_counter|\n\n";} + $affected_rows = $dbhC->do($stmtPQ); + + $ARchannel[$rec_count] = ''; + $ARextension[$rec_count] = ''; + $ARparked_time[$rec_count] = ''; + $ARparked_time_UNIX[$rec_count] = ''; + $$DEL_chan_park_counter=0; + } + } + else + { + $DEL_chan_park_counter = "DEL$PQchannel$PQextension"; + $$DEL_chan_park_counter=0; + } + + + + $event_string='CLOSING MYSQL CONNECTIONS OPENED TO VALIDATE PARKED CALLS|'; + &event_logger; + + + $dbhB->disconnect(); + + } + + $dbhC->disconnect(); + + $parked_counter++; + $rec_count++; + } + + $sthA->finish(); + + $run_validate_parked_channels_now=5; # set to run every five times the subroutine runs + } + +$run_validate_parked_channels_now--; +} + + + + + +################################################################################ +##### get the current date and time and epoch for logging call lengths and datetimes +sub get_time_now +{ +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +$now_date_epoch = time(); +$now_date = "$year-$mon-$mday $hour:$min:$sec"; +} + + + + + +################################################################################ +##### open the log file for writing ### +sub event_logger +{ +if ($SYSLOG) + { + open(Lout, ">>$UPLOGfile") + || die "Can't open $UPLOGfile: $!\n"; + print Lout "$now_date|$event_string|\n"; + close(Lout); + } +$event_string=''; +} diff --git a/agc_2-X/branches/agc_2.0.4/bin/AST_vm_update.pl b/agc_2-X/branches/agc_2.0.4/bin/AST_vm_update.pl new file mode 100644 index 00000000..979401a0 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/AST_vm_update.pl @@ -0,0 +1,247 @@ +#!/usr/bin/perl +# +# AST_vm_update.pl version 0.4 *DBI-version* +# +# DESCRIPTION: +# uses the Asterisk Manager interface and Net::MySQL to update the count of +# voicemail messages for each mailbox (in the phone table) in the voicemail +# table list is used by client apps for voicemail notification +# +# SUMMARY: +# This program was designed for people using the Asterisk PBX with voicemail +# +# For the client program to notify of new messaged, this program must be in the +# cron running every minute +# +# For this program to work you need to have the "asterisk" MySQL database +# created and create the tables listed in the CONF_MySQL.txt file, also make sure +# that the machine running this program has read/write/update/delete access +# to that database +# +# It is recommended that you run this program on the local Asterisk machine +# +# If this script is run ever minute there is a theoretical limit of +# 600 mailboxes that it can check due to the wait interval. If you have +# more than this either change the cron when this script is run or change the +# wait interval below +# +# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# +# 50823-1422 - Added database server variable definitions lookup +# 50823-1452 - Added commandline arguments for debug at runtime +# 60717-1204 - changed to DBI by Marin Blu +# 60715-2301 - changed to use /etc/astguiclient.conf for configs +# + +# constants +$DB=0; # Debug flag, set to 0 for no debug messages per minute +$US='__'; +$MT[0]=''; + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-debug/i) + { + $DB=1; # Debug flag + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +# print "no command line options set\n"; +} +### end parsing run-time options ### + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} + +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second +use DBI; +use Net::Telnet (); + + $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### Grab Server values from the database +$stmtA = "SELECT telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERNAMEupdate,ASTmgrUSERNAMElisten,ASTmgrUSERNAMEsend,max_vicidial_trunks,answer_transfer_agent,local_gmt,ext_context FROM servers where server_ip = '$server_ip';"; + +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +if ($DB) {print "|$stmtA|\n";} +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $DBtelnet_host = "$aryA[0]"; + $DBtelnet_port = "$aryA[1]"; + $DBASTmgrUSERNAME = "$aryA[2]"; + $DBASTmgrSECRET = "$aryA[3]"; + $DBASTmgrUSERNAMEupdate = "$aryA[4]"; + $DBASTmgrUSERNAMElisten = "$aryA[5]"; + $DBASTmgrUSERNAMEsend = "$aryA[6]"; + $DBmax_vicidial_trunks = "$aryA[7]"; + $DBanswer_transfer_agent= "$aryA[8]"; + $DBSERVER_GMT = "$aryA[9]"; + $DBext_context = "$aryA[10]"; + if ($DBtelnet_host) {$telnet_host = $DBtelnet_host;} + if ($DBtelnet_port) {$telnet_port = $DBtelnet_port;} + if ($DBASTmgrUSERNAME) {$ASTmgrUSERNAME = $DBASTmgrUSERNAME;} + if ($DBASTmgrSECRET) {$ASTmgrSECRET = $DBASTmgrSECRET;} + if ($DBASTmgrUSERNAMEupdate) {$ASTmgrUSERNAMEupdate = $DBASTmgrUSERNAMEupdate;} + if ($DBASTmgrUSERNAMElisten) {$ASTmgrUSERNAMElisten = $DBASTmgrUSERNAMElisten;} + if ($DBASTmgrUSERNAMEsend) {$ASTmgrUSERNAMEsend = $DBASTmgrUSERNAMEsend;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBext_context) {$ext_context = $DBext_context;} + } + $sthA->finish(); + + +@PTextensions=@MT; @PTvoicemail_ids=@MT; @PTmessages=@MT; @PTold_messages=@MT; @NEW_messages=@MT; @OLD_messages=@MT; +$stmtA = "SELECT extension,voicemail_id,messages,old_messages from phones where server_ip='$server_ip'"; +if ($DB) {print "|$stmtA|\n";} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $PTextensions[$rec_count] = "$aryA[0]"; + $PTvoicemail_ids[$rec_count] = "$aryA[1]"; + $PTmessages[$rec_count] = "$aryA[2]"; + $PTold_messages[$rec_count] = "$aryA[3]"; + $rec_count++; + } + $sthA->finish(); + + +### connect to asterisk manager through telnet +$t = new Net::Telnet (Port => 5038, + Prompt => '/.*[\$%#>] $/', + Output_record_separator => '',); +#$fh = $t->dump_log("$telnetlog"); # uncomment for telnet log + if (length($ASTmgrUSERNAMEsend) > 3) {$telnet_login = $ASTmgrUSERNAMEsend;} + else {$telnet_login = $ASTmgrUSERNAME;} + +$t->open("$telnet_host"); +$t->waitfor('/0\n$/'); # print login +$t->print("Action: Login\nUsername: $telnet_login\nSecret: $ASTmgrSECRET\n\n"); +$t->waitfor('/Authentication accepted/'); # waitfor auth accepted + + +$i=0; +foreach(@PTextensions) + { + @list_channels=@MT; + $t->buffer_empty; + @list_channels = $t->cmd(String => "Action: MailboxCount\nMailbox: $PTvoicemail_ids[$i]\n\nAction: Ping\n\n", Prompt => '/Response: Pong.*/'); + + $j=0; + foreach(@list_channels) + { + if ($list_channels[$j] =~ /Mailbox: $PTvoicemail_ids[$i]/) + { + $NEW_messages[$i] = "$list_channels[$j+1]"; + $NEW_messages[$i] =~ s/NewMessages: |\n//gi; + $OLD_messages[$i] = "$list_channels[$j+2]"; + $OLD_messages[$i] =~ s/OldMessages: |\n//gi; + } + + $j++; + } + + if($DB){print "MailboxCount- $PTvoicemail_ids[$i] NEW:|$NEW_messages[$i]| OLD:|$OLD_messages[$i]| ";} + if ( ($NEW_messages[$i] eq $PTmessages[$i]) && ($OLD_messages[$i] eq $PTold_messages[$i]) ) + { + if($DB){print "MESSAGE COUNT UNCHANGED, DOING NOTHING FOR THIS MAILBOX\n";} + } + else + { + $stmtA = "UPDATE phones set messages='$NEW_messages[$i]', old_messages='$OLD_messages[$i]' where server_ip='$server_ip' and extension='$PTextensions[$i]'"; + if($DB){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n"; + } + + $i++; + ### sleep for 10 hundredths of a second + usleep(1*100*1000); + } + + +$t->buffer_empty; +@hangup = $t->cmd(String => "Action: Logoff\n\n", Prompt => "/.*/"); +$t->buffer_empty; +$ok = $t->close; + + +$dbhA->disconnect(); + +if($DB){print "DONE... Exiting... Goodbye... See you later... \n";} + +exit; + + + + diff --git a/agc_2-X/branches/agc_2.0.4/bin/FastAGI_log.pl b/agc_2-X/branches/agc_2.0.4/bin/FastAGI_log.pl new file mode 100644 index 00000000..779d2856 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/FastAGI_log.pl @@ -0,0 +1,917 @@ +#!/usr/bin/perl +# +# FastAGI_log.pl version 2.0.3 *DBI-version* +# +# Experimental Deamon using perl Net::Server that runs as FastAGI to reduce load +# replaces the following AGI scripts: +# - call_log.agi +# - call_logCID.agi +# - VD_hangup.agi +# +# This script needs to be running all of the time for AGI requests to work +# +# You need to put lines similar to those below in your extensions.conf file: +# +# ;outbound dialing: +# exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) +# +# ;inbound calls: +# exten => 101,1,AGI(agi://127.0.0.1:4577/call_log) +# or +# exten => 101,1,AGI(agi://127.0.0.1:4577/call_log--fullCID--${EXTEN}-----${CALLERID}-----${CALLERIDNUM}-----${CALLERIDNAME}) +# +# +# ;all hangups: +# exten => h,1,DeadAGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME}) +# +# +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# +# CHANGELOG: +# 61010-1007 - First test build +# 70116-1619 - Added Auto Alt Dial code +# 70215-1258 - Added queue_log entry when deleting vac record +# 70808-1425 - Moved VD_hangup section to the call_log end stage to improve efficiency +# 71030-2039 - Added priority to hopper insertions +# + + +# defaults for PreFork +$VARfastagi_log_min_servers = '3'; +$VARfastagi_log_max_servers = '16'; +$VARfastagi_log_min_spare_servers = '2'; +$VARfastagi_log_max_spare_servers = '8'; +$VARfastagi_log_max_requests = '1000'; +$VARfastagi_log_checkfordead = '30'; +$VARfastagi_log_checkforwait = '60'; + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^VARfastagi_log_min_servers/) && ($CLIVARfastagi_log_min_servers < 1) ) + {$VARfastagi_log_min_servers = $line; $VARfastagi_log_min_servers =~ s/.*=//gi;} + if ( ($line =~ /^VARfastagi_log_max_servers/) && ($CLIVARfastagi_log_max_servers < 1) ) + {$VARfastagi_log_max_servers = $line; $VARfastagi_log_max_servers =~ s/.*=//gi;} + if ( ($line =~ /^VARfastagi_log_min_spare_servers/) && ($CLIVARfastagi_log_min_spare_servers < 1) ) + {$VARfastagi_log_min_spare_servers = $line; $VARfastagi_log_min_spare_servers =~ s/.*=//gi;} + if ( ($line =~ /^VARfastagi_log_max_spare_servers/) && ($CLIVARfastagi_log_max_spare_servers < 1) ) + {$VARfastagi_log_max_spare_servers = $line; $VARfastagi_log_max_spare_servers =~ s/.*=//gi;} + if ( ($line =~ /^VARfastagi_log_max_requests/) && ($CLIVARfastagi_log_max_requests < 1) ) + {$VARfastagi_log_max_requests = $line; $VARfastagi_log_max_requests =~ s/.*=//gi;} + if ( ($line =~ /^VARfastagi_log_checkfordead/) && ($CLIVARfastagi_log_checkfordead < 1) ) + {$VARfastagi_log_checkfordead = $line; $VARfastagi_log_checkfordead =~ s/.*=//gi;} + if ( ($line =~ /^VARfastagi_log_checkforwait/) && ($CLIVARfastagi_log_checkforwait < 1) ) + {$VARfastagi_log_checkforwait = $line; $VARfastagi_log_checkforwait =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +if ($hour < 10) {$Fhour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} + +if (!$VARDB_port) {$VARDB_port='3306';} + +$SERVERLOG = 'N'; +$log_level = '0'; + +use DBI; +$dbhB = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +### Grab Server values from the database +$stmtB = "SELECT vd_server_logs FROM servers where server_ip = '$VARserver_ip';"; +$sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr; +$sthB->execute or die "executing: $stmtB ", $dbhB->errstr; +$sthBrows=$sthB->rows; +$rec_count=0; +while ($sthBrows > $rec_count) + { + @aryB = $sthB->fetchrow_array; + $SERVERLOG = "$aryB[0]"; + $rec_count++; + } +$sthB->finish(); +$dbhB->disconnect(); + +if ($SERVERLOG =~ /Y/) + { + $childLOGfile = "$PATHlogs/FastAGIchildLOG.$year-$mon-$mday"; + $log_level = "4"; + print "SERVER LOGGING ON: LEVEL-$log_level FILE-$childLOGfile\n"; + } + +package TEST_VDfastAGI; + +use Net::Server; +use Asterisk::AGI; +use vars qw(@ISA); +use Net::Server::PreFork; # any personality will do +@ISA = qw(Net::Server::PreFork); + + + + +sub process_request { + $process = 'begin'; + $script = 'TEST_VDfastAGI'; + ########## Get current time, parse configs, get logging preferences ########## + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$Fhour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + + $now_date_epoch = time(); + $now_date = "$year-$mon-$mday $hour:$min:$sec"; + + + # default path to astguiclient configuration file: + $PATHconf = '/etc/astguiclient.conf'; + + open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; + @conf = ; + close(conf); + $i=0; + foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + + if (!$VARDB_port) {$VARDB_port='3306';} + if (!$AGILOGfile) {$AGILOGfile = "$PATHlogs/FASTagiout.$year-$mon-$mday";} + + $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + ### Grab Server values from the database + $stmtA = "SELECT agi_output FROM servers where server_ip = '$VARserver_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + $AGILOG = '0'; + @aryA = $sthA->fetchrow_array; + $DBagi_output = "$aryA[0]"; + if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';} + if ($DBagi_output =~ /FILE/) {$AGILOG = '2';} + if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';} + $rec_count++; + } + $sthA->finish(); + + + + + if ($AGILOG) + { + $agi_string = "+++++++++++++++++ FastAGI Start ++++++++++++++++++++++++++++++++++++++++"; + &agi_output; + } + + + + ### begin parsing run-time options ### + if (length($ARGV[0])>1) + { + if ($AGILOG) + { + $agi_string = "Perl Environment Dump:"; + &agi_output; + } + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + if ($AGILOG) + { + $agi_string = "$i|$ARGV[$i]"; + &agi_output; + } + $i++; + } + } + $HVcauses=0; + $fullCID=0; + $|=1; + while() { + chomp; + last unless length($_); + if ($AGILOG) + { + if (/^agi_(\w+)\:\s+(.*)$/) + { + $AGI{$1} = $2; + } + } + + if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} + if (/^agi_priority\:\s+(.*)$/) {$priority = $1;} + if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} + if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} + if (/^agi_type\:\s+(.*)$/) {$type = $1;} + if (/^agi_request\:\s+(.*)$/) {$request = $1;} + if ( ($request =~ /--fullCID--/i) && (!$fullCID) ) + { + $fullCID=1; + @CID = split(/-----/, $request); + $callerid = $CID[2]; + $calleridname = $CID[3]; + $agi_string = "URL fullCID: |$callerid|$calleridname|$request|"; + &agi_output; + } + if ( ($request =~ /--HVcauses--/i) && (!$HVcauses) ) + { + $HVcauses=1; + @ARGV_vars = split(/-----/, $request); + $PRI = $ARGV_vars[0]; + $PRI =~ s/.*--HVcauses--//gi; + $DEBUG = $ARGV_vars[1]; + $hangup_cause = $ARGV_vars[2]; + $dialstatus = $ARGV_vars[3]; + $dial_time = $ARGV_vars[4]; + $ring_time = $ARGV_vars[5]; + $agi_string = "URL HVcauses: |$PRI|$DEBUG|$hangup_cause|$dialstatus|$dial_time|$ring_time|"; + &agi_output; + } + if (!$fullCID) # if no fullCID sent + { + if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} + if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} + if ( $calleridname =~ /\"/) {$calleridname =~ s/\"//gi;} + # if ( (length($calleridname)>5) && ( (!$callerid) or ($callerid =~ /unknown|private|00000000/i) or ($callerid =~ /5551212/) ) ) + if ( ( + (length($calleridname)>5) && ( (!$callerid) or ($callerid =~ /unknown|private|00000000/i) or ($callerid =~ /5551212/) ) + ) or ( (length($calleridname)>17) && ($calleridname =~ /\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/) ) ) + {$callerid = $calleridname;} + + ### allow for ANI being sent with the DNIS "*3125551212*9999*" + if ($extension =~ /^\*\d\d\d\d\d\d\d\d\d\d\*/) + { + $callerid = $extension; + $callerid =~ s/\*\d\d\d\d\*$//gi; + $callerid =~ s/^\*//gi; + $extension =~ s/^\*\d\d\d\d\d\d\d\d\d\d\*//gi; + $extension =~ s/\*$//gi; + } + $calleridname = $callerid; + } + } + + if ($AGILOG) + { + $agi_string = "AGI Environment Dump:"; + &agi_output; + } + + foreach $i (sort keys %AGI) + { + if ($AGILOG) + { + $agi_string = " -- $i = $AGI{$i}"; + &agi_output; + } + } + + + if ($AGILOG) + { + $agi_string = "AGI Variables: |$unique_id|$channel|$extension|$type|$callerid|"; + &agi_output; + } + + if ( ($extension =~ /h/i) && (length($extension) < 3)) {$stage = 'END';} + else {$stage = 'START';} + + $process = $request; + $process =~ s/agi:\/\///gi; + $process =~ s/.*\/|--.*//gi; + if ($AGILOG) + { + $agi_string = "Process to run: |$request|$process|$stage|"; + &agi_output; + } + + + ################################################################### + ##### START call_log process ###################################### + ################################################################### + if ($process =~ /^call_log/) + { + ### call start stage + if ($stage =~ /START/) + { + if ($AGILOG) {$agi_string = "+++++ CALL LOG START : $now_date"; &agi_output;} + + if ($channel =~ /^SIP/) {$channel =~ s/-.*//gi;} + if ($channel =~ /^IAX2/) {$channel =~ s/\/\d+$//gi;} + if ($channel =~ /^Zap\//) + { + $channel_line = $channel; + $channel_line =~ s/^Zap\///gi; + + $stmtA = "SELECT count(*) FROM phones where server_ip='$VARserver_ip' and extension='$channel_line' and protocol='Zap';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + $is_client_phone = "$aryA[0]"; + if ($AGILOG) {$agi_string = "Local Zap phone: $aryA[0]|$channel_line|"; &agi_output;} + $sthA->finish(); + + if ($is_client_phone < 1) + { + $channel_group = 'Zap Trunk Line'; + $number_dialed = $callerid; + } + } + ### This section breaks the outbound dialed number down(or builds it up) to a 10 digit number and gives it a description + if ( ($channel =~ /^SIP|^IAX2/) or ($is_client_phone > 0) ) + { + if ( ($extension =~ /^901144/) && (length($extension)==16) ) #test 207 608 6400 + {$extension =~ s/^9//gi; $channel_group = 'Outbound Intl UK';} + if ( ($extension =~ /^901161/) && (length($extension)==15) ) #test 39 417 2011 + {$extension =~ s/^9//gi; $channel_group = 'Outbound Intl AUS';} + if ( ($extension =~ /^91800|^91888|^91877|^91866/) && (length($extension)==12) ) + {$extension =~ s/^91//gi; $channel_group = 'Outbound Local 800';} + if ( ($extension =~ /^9/) && (length($extension)==8) ) + {$extension =~ s/^9/727/gi; $channel_group = 'Outbound Local';} + if ( ($extension =~ /^9/) && (length($extension)==11) ) + {$extension =~ s/^9//gi; $channel_group = 'Outbound Local';} + if ( ($extension =~ /^91/) && (length($extension)==12) ) + {$extension =~ s/^91//gi; $channel_group = 'Outbound Long Distance';} + if ($is_client_phone > 0) + {$channel_group = 'Zap Client Phone';} + + $SIP_ext = $channel; $SIP_ext =~ s/SIP\/|IAX2\/|Zap\///gi; + + $number_dialed = $extension; + $extension = $SIP_ext; + } + + if ( ($callerid =~ /^V|^M/) && ($callerid =~ /\d\d\d\d\d\d\d\d\d/) && (length($number_dialed)<1) ) + { + $stmtA = "SELECT cmd_line_b,cmd_line_d FROM vicidial_manager where callerid='$callerid' limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $cmd_line_b = "$aryA[0]"; + $cmd_line_d = "$aryA[1]"; + $cmd_line_b =~ s/Exten: //gi; + $cmd_line_d =~ s/Channel: Local\/|@.*//gi; + $rec_count++; + } + $sthA->finish(); + if ($callerid =~ /^V/) {$number_dialed = "$cmd_line_d";} + if ($callerid =~ /^M/) {$number_dialed = "$cmd_line_b";} + $number_dialed =~ s/\D//gi; + if (length($number_dialed)<1) {$number_dialed=$extension;} + } + $stmtA = "INSERT INTO call_log (uniqueid,channel,channel_group,type,server_ip,extension,number_dialed,start_time,start_epoch,end_time,end_epoch,length_in_sec,length_in_min,caller_code) values('$unique_id','$channel','$channel_group','$type','$VARserver_ip','$extension','$number_dialed','$now_date','$now_date_epoch','','','','','$callerid')"; + + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + + $dbhA->disconnect(); + } + + + ### call end stage + else + { + if ($AGILOG) {$agi_string = "|CALL HUNG UP|"; &agi_output;} + + ### get uniqueid and start_epoch from the call_log table + $stmtA = "SELECT uniqueid,start_epoch FROM call_log where uniqueid='$unique_id';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $start_time = "$aryA[1]"; + if ($AGILOG) {$agi_string = "|$aryA[0]|$aryA[1]|"; &agi_output;} + $rec_count++; + } + $sthA->finish(); + + if ($rec_count) + { + $length_in_sec = ($now_date_epoch - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + if ($AGILOG) {$agi_string = "QUERY done: start time = $start_time | sec: $length_in_sec | min: $length_in_min |"; &agi_output;} + + $stmtA = "UPDATE call_log set end_time='$now_date',end_epoch='$now_date_epoch',length_in_sec=$length_in_sec,length_in_min='$length_in_min',channel='$channel' where uniqueid='$unique_id'"; + + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + } + + $stmtA = "DELETE from live_inbound where uniqueid='$unique_id' and server_ip='$VARserver_ip'"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + + ##### BEGIN Park Log entry check and update ##### + $stmtA = "SELECT UNIX_TIMESTAMP(parked_time),UNIX_TIMESTAMP(grab_time) FROM park_log where uniqueid='$unique_id' and server_ip='$VARserver_ip' LIMIT 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $parked_time = "$aryA[0]"; + $grab_time = "$aryA[1]"; + if ($AGILOG) {$agi_string = "|$aryA[0]|$aryA[1]|"; &agi_output;} + $rec_count++; + } + $sthA->finish(); + + if ($rec_count) + { + if ($AGILOG) {$agi_string = "*****Entry found for $unique_id-$VARserver_ip in park_log: $parked_time|$grab_time"; &agi_output;} + if ($parked_time > $grab_time) + { + $parked_sec=($now_date_epoch - $parked_time); + $talked_sec=0; + } + else + { + $talked_sec=($now_date_epoch - $parked_time); + $parked_sec=($grab_time - $parked_time); + } + + $stmtA = "UPDATE park_log set status='HUNGUP',hangup_time='$now_date',parked_sec='$parked_sec',talked_sec='$talked_sec' where uniqueid='$unique_id' and server_ip='$VARserver_ip'"; + $affected_rows = $dbhA->do($stmtA); + } + ##### END Park Log entry check and update ##### + + # $dbhA->disconnect(); + + if ($AGILOG) {$agi_string = "+++++ CALL LOG HUNGUP: |$unique_id|$channel|$extension|$now_date|min: $length_in_min|"; &agi_output;} + + + ##### BEGIN former VD_hangup section functions ##### + + $VDADcampaign=''; + $VDADphone=''; + $VDADphone_code=''; + + if ($DEBUG =~ /^DEBUG$/) + { + ### open the hangup cause out file for writing ### + open(out, ">>$PATHlogs/HANGUP_cause-output.txt") + || die "Can't open $PATHlogs/HANGUP_cause-output.txt: $!\n"; + + print out "$now_date|$hangup_cause|$dialstatus|$dial_time|$ring_time|$unique_id|$channel|$extension|$type|$callerid|$calleridname|$priority|\n"; + + close(out); + } + else + { + if ($AGILOG) {$agi_string = "DEBUG: $DEBUG"; &agi_output;} + } + + + $callerid =~ s/\"//gi; + $CIDlead_id = $callerid; + $CIDlead_id = substr($CIDlead_id, 11, 9); + $CIDlead_id = ($CIDlead_id + 0); + + if ($AGILOG) {$agi_string = "VD_hangup : $callerid $channel $priority $CIDlead_id"; &agi_output;} + + if ($channel =~ /^Local/) + { + if ( ($PRI =~ /^PRI$/) && ($callerid =~ /\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/) && ( ($dialstatus =~ /BUSY/) || ( ($dialstatus =~ /CHANUNAVAIL/) && ($hangup_cause =~ /^1$|^28$/) ) ) ) + { + if ($dialstatus =~ /BUSY/) {$VDL_status = 'B'; $VDAC_status = 'BUSY';} + if ($dialstatus =~ /CHANUNAVAIL/) {$VDL_status = 'DC'; $VDAC_status = 'DISCONNECT';} + + $stmtA = "UPDATE vicidial_auto_calls set status='$VDAC_status' where callerid = '$callerid';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAC update: |$affected_rows|$CIDlead_id"; &agi_output;} + + $stmtA = "UPDATE vicidial_list set status='$VDL_status' where lead_id = '$CIDlead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vicidial_list update: |$affected_rows|$CIDlead_id"; &agi_output;} + + $stmtA = "UPDATE vicidial_log set status='$VDL_status' where uniqueid = '$uniqueid';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vicidial_log update: |$affected_rows|$uniqueid|"; &agi_output;} + + $dbhA->disconnect(); + } + else + { + if ($AGILOG) {$agi_string = "-- VD_hangup Local DEBUG: |$PRI|$callerid|$dialstatus|$hangup_cause|"; &agi_output;} + } + + if ($AGILOG) {$agi_string = "+++++ VDAD START LOCAL CHANNEL: EXITING- $priority"; &agi_output;} + if ($priority > 2) {sleep(1);} + } + else + { + + ########## FIND AND DELETE vicidial_auto_calls ########## + $VD_alt_dial = 'NONE'; + $stmtA = "SELECT lead_id,callerid,campaign_id,alt_dial,stage,UNIX_TIMESTAMP(call_time) FROM vicidial_auto_calls where uniqueid = '$uniqueid' limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_countCUSTDATA=0; + while ($sthArows > $rec_countCUSTDATA) + { + @aryA = $sthA->fetchrow_array; + $VD_lead_id = "$aryA[0]"; + $VD_callerid = "$aryA[1]"; + $VD_campaign_id = "$aryA[2]"; + $VD_alt_dial = "$aryA[3]"; + $VD_stage = "$aryA[4]"; + $VD_start_epoch = "$aryA[5]"; + $rec_countCUSTDATA++; + } + $sthA->finish(); + + if (!$rec_countCUSTDATA) + { + if ($AGILOG) {$agi_string = "VD hangup: no VDAC record found: $uniqueid $calleridname"; &agi_output;} + } + else + { + $stmtA = "DELETE FROM vicidial_auto_calls where uniqueid='$uniqueid' order by call_time desc limit 1;"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAC record deleted: |$affected_rows| |$VD_lead_id|$uniqueid|$VD_callerid|$VARserver_ip"; &agi_output;} + + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $enable_queuemetrics_logging = "$aryA[0]"; + $queuemetrics_server_ip = "$aryA[1]"; + $queuemetrics_dbname = "$aryA[2]"; + $queuemetrics_login= "$aryA[3]"; + $queuemetrics_pass = "$aryA[4]"; + $queuemetrics_log_id = "$aryA[5]"; + $rec_count++; + } + $sthA->finish(); + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + $VD_agent='NONE'; + $secX = time(); + $VD_call_length = ($secX - $VD_start_epoch); + $VD_stage =~ s/.*-//gi; + if ($VD_stage < 0.25) {$VD_stage=0;} + + $dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} + + $stmtB = "SELECT agent from queue_log where call_id='$VD_callerid' and verb='CONNECT';"; + $sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr; + $sthB->execute or die "executing: $stmtB ", $dbhB->errstr; + $sthBrows=$sthB->rows; + $rec_count=0; + while ($sthBrows > $rec_count) + { + @aryB = $sthB->fetchrow_array; + $VD_agent = "$aryB[0]"; + $rec_count++; + } + $sthB->finish(); + + if ($rec_count < 1) + { + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='$VD_callerid',queue='$VD_campaign_id',agent='$VD_agent',verb='ABANDON',data1='1',data2='1',data3='$VD_stage',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + } + else + { + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='$VD_callerid',queue='$VD_campaign_id',agent='$VD_agent',verb='COMPLETECALLER',data1='$VD_stage',data2='$VD_call_length',data3='1',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + } + + $dbhB->disconnect(); + } + + + ########## FIND AND UPDATE vicidial_log ########## + $stmtA = "SELECT start_epoch,status FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$VD_lead_id' limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $epc_countCUSTDATA=0; + $VD_closecallid=''; + while ($sthArows > $rec_countCUSTDATA) + { + @aryA = $sthA->fetchrow_array; + $VD_start_epoch = "$aryA[0]"; + $VD_status = "$aryA[1]"; + $epc_countCUSTDATA++; + } + $sthA->finish(); + + if (!$epc_countCUSTDATA) + { + if ($AGILOG) {$agi_string = "no VDL record found: $uniqueid $calleridname $VD_lead_id $uniqueid"; &agi_output;} + + $secX = time(); + $Rtarget = ($secX - 21600); # look for VDCL entry within last 6 hours + ($Rsec,$Rmin,$Rhour,$Rmday,$Rmon,$Ryear,$Rwday,$Ryday,$Risdst) = localtime($Rtarget); + $Ryear = ($Ryear + 1900); + $Rmon++; + if ($Rmon < 10) {$Rmon = "0$Rmon";} + if ($Rmday < 10) {$Rmday = "0$Rmday";} + if ($Rhour < 10) {$Rhour = "0$Rhour";} + if ($Rmin < 10) {$Rmin = "0$Rmin";} + if ($Rsec < 10) {$Rsec = "0$Rsec";} + $RSQLdate = "$Ryear-$Rmon-$Rmday $Rhour:$Rmin:$Rsec"; + + $stmtA = "SELECT start_epoch,status,closecallid FROM vicidial_closer_log where lead_id = '$VD_lead_id' and call_date > \"$RSQLdate\" order by call_date desc limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $epc_countCUSTDATA=0; + $VD_closecallid=''; + while ($sthArows > $epc_countCUSTDATA) + { + @aryA = $sthA->fetchrow_array; + $VD_start_epoch = "$aryA[0]"; + $VD_status = "$aryA[1]"; + $VD_closecallid = "$aryA[2]"; + $epc_countCUSTDATA++; + } + $sthA->finish(); + } + if (!$epc_countCUSTDATA) + { + if ($AGILOG) {$agi_string = "no VDL or VDCL record found: $uniqueid $calleridname $VD_lead_id $uniqueid"; &agi_output;} + } + else + { + $VD_seconds = ($now_date_epoch - $VD_start_epoch); + + $SQL_status=''; + if ($VD_status =~ /^NA$|^NEW$|^QUEUE$|^XFER$/) + { + $SQL_status = "status='DROP',"; + + ########## FIND AND UPDATE vicidial_list ########## + $stmtA = "UPDATE vicidial_list set status='DROP' where lead_id = '$VD_lead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vicidial_list update: |$affected_rows|$VD_lead_id"; &agi_output;} + } + + $stmtA = "UPDATE vicidial_log set $SQL_status end_epoch='$now_date_epoch',length_in_sec='$VD_seconds' where uniqueid = '$uniqueid';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDAD vicidial_log update: |$affected_rows|$uniqueid|$VD_status|"; &agi_output;} + + + + + ########## UPDATE vicidial_closer_log ########## + if (length($VD_closecallid) < 1) + { + if ($AGILOG) {$agi_string = "no VDCL record found: $uniqueid $calleridname $VD_lead_id $uniqueid"; &agi_output;} + } + else + { + if ($VD_status =~ /^DONE$|^INCALL$|^XFER$/) + {$VDCLSQL_status = "";} + else + {$VDCLSQL_status = "status='DROP',queue_seconds='$VD_seconds',";} + + $VD_seconds = ($now_date_epoch - $VD_start_epoch); + $stmtA = "UPDATE vicidial_closer_log set $VDCLSQL_status end_epoch='$now_date_epoch',length_in_sec='$VD_seconds' where closecallid = '$VD_closecallid';"; + if ($AGILOG) {$agi_string = "|$VDCLSQL_status|$VD_status|\n|$stmtA|"; &agi_output;} + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDCL update: |$affected_rows|$uniqueid|$VD_closecallid|"; &agi_output;} + + } + } + + ##### BEGIN AUTO ALT PHONE DIAL SECTION ##### + ### check to see if campaign has alt_dial enabled + $VD_auto_alt_dial = 'NONE'; + $VD_auto_alt_dial_statuses=''; + $stmtA="SELECT auto_alt_dial,auto_alt_dial_statuses FROM vicidial_campaigns where campaign_id='$VD_campaign_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $epc_countCAMPDATA=0; + while ($sthArows > $epc_countCAMPDATA) + { + @aryA = $sthA->fetchrow_array; + $VD_auto_alt_dial = "$aryA[0]"; + $VD_auto_alt_dial_statuses = "$aryA[1]"; + $epc_countCAMPDATA++; + } + $sthA->finish(); + if ($VD_auto_alt_dial_statuses =~ / $VD_status | $VDL_status /) + { + if ( ($VD_auto_alt_dial =~ /(ALT_ONLY|ALT_AND_ADDR3)/) && ($VD_alt_dial =~ /NONE|MAIN/) ) + { + $VD_alt_phone=''; + $stmtA="SELECT alt_phone,gmt_offset_now,state,list_id FROM vicidial_list where lead_id='$VD_lead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $epc_countCAMPDATA=0; + while ($sthArows > $epc_countCAMPDATA) + { + @aryA = $sthA->fetchrow_array; + $VD_alt_phone = "$aryA[0]"; + $VD_alt_phone =~ s/\D//gi; + $VD_gmt_offset_now = "$aryA[1]"; + $VD_state = "$aryA[2]"; + $VD_list_id = "$aryA[3]"; + $epc_countCAMPDATA++; + } + $sthA->finish(); + if (length($VD_alt_phone)>5) + { + $stmtA = "INSERT INTO vicidial_hopper SET lead_id='$VD_lead_id',campaign_id='$VD_campaign_id',status='READY',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ALT',user='',priority='25';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDH record inserted: |$affected_rows| |$stmtA|"; &agi_output;} + } + } + if ( ( ($VD_auto_alt_dial =~ /(ADDR3_ONLY)/) && ($VD_alt_dial =~ /NONE|MAIN/) ) || ( ($VD_auto_alt_dial =~ /(ALT_AND_ADDR3)/) && ($VD_alt_dial =~ /ALT/) ) ) + { + $VD_address3=''; + $stmtA="SELECT address3,gmt_offset_now,state,list_id FROM vicidial_list where lead_id='$VD_lead_id';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $epc_countCAMPDATA=0; + while ($sthArows > $epc_countCAMPDATA) + { + @aryA = $sthA->fetchrow_array; + $VD_address3 = "$aryA[0]"; + $VD_address3 =~ s/\D//gi; + $VD_gmt_offset_now = "$aryA[1]"; + $VD_state = "$aryA[2]"; + $VD_list_id = "$aryA[3]"; + $epc_countCAMPDATA++; + } + $sthA->finish(); + if (length($VD_address3)>5) + { + $stmtA = "INSERT INTO vicidial_hopper SET lead_id='$VD_lead_id',campaign_id='$VD_campaign_id',status='READY',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ADDR3',user='',priority='20';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDH record inserted: |$affected_rows| |$stmtA|"; &agi_output;} + } + } + } + ##### END AUTO ALT PHONE DIAL SECTION ##### + } + + } + + $dbhA->disconnect(); + + } + } + ################################################################### + ##### END call_log process ######################################## + ################################################################### + + + + + + ################################################################### + ##### START VD_hangup process ##################################### + ################################################################### + if ($process =~ /^VD_hangup/) + { + $nothing=0; + } + ################################################################### + ##### END VD_hangup process ####################################### + ################################################################### + + +} + + +TEST_VDfastAGI->run( + port=>4577, + user=>'root', + group=>'root', + min_servers=>$VARfastagi_log_min_servers, + max_servers=>$VARfastagi_log_max_servers, + min_spare_servers=>$VARfastagi_log_min_spare_servers, + max_spare_servers=>$VARfastagi_log_max_spare_servers, + max_requests=>$VARfastagi_log_max_requests, + check_for_dead=>$VARfastagi_log_checkfordead, + check_for_waiting=>$VARfastagi_log_checkforwait, + log_file=>$childLOGfile, + log_level=>$log_level + ); +exit; + + + + + +sub agi_output +{ +if ($AGILOG >=2) + { + ### open the log file for writing ### + open(Lout, ">>$AGILOGfile") + || die "Can't open $AGILOGfile: $!\n"; + print Lout "$now_date|$script|$process|$agi_string\n"; + close(Lout); + } + ### send to STDERR writing ### +if ( ($AGILOG == '1') || ($AGILOG == '3') ) + { + print STDERR "$now_date|$script|$process|$agi_string\n"; + } +$agi_string=''; +} diff --git a/agc_2-X/branches/agc_2.0.4/bin/VICIDIAL_DEDUPE_leads.pl b/agc_2-X/branches/agc_2.0.4/bin/VICIDIAL_DEDUPE_leads.pl new file mode 100644 index 00000000..5c9d2a0c --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/VICIDIAL_DEDUPE_leads.pl @@ -0,0 +1,323 @@ +#!/usr/bin/perl +# +# VICIDIAL_DEDUPE_leads.pl version 2.0.4 *DBI-version* +# +# DESCRIPTION: +# moves duplicate leads to another list_id +# +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# +# /usr/share/astguiclient/VICIDIAL_DEDUPE_leads.pl --debugX --campaign-duplicate=CTF --ignore-list=999 +# +# CHANGES +# 70521-1643 - first build +# + +$secX = time(); + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($hour < 10) {$hour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +$pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; +$inSD = $pulldate0; +$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +$liveupdate=0; + +if (!$VDHLOGfile) {$VDHLOGfile = "$PATHlogs/dupleads.$year-$mon-$mday";} + +print "\n\n\n\n\n\n\n\n\n\n\n\n-- VICIDIAL_DEDUPE_leads.pl --\n\n"; +print "This program is designed to scan all leads for a campaign or entire system that are duplicates and move the newer lead into a different list_id. \n\n"; + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help|-h/i) + { + print "allowed run time options:\n"; + print " [-q] = quiet\n"; + print " [-t] = test\n"; + print " [--live-update] = runs the live UPDATE to move leads, default is report only\n"; + print " [--system-duplicate] = checks for duplicates in entire database\n"; + print " [--campaign-duplicate=1234] = duplicate check witin this campaign\n"; + print " [--ignore-list=999] = ignores the list in duplicate check\n"; + print " [--duplicate-list=998] = list_id that duplicate leads are moved to, default is 998\n"; + print " [-h] = this help screen\n\n"; + print "\n"; + + exit; + } + else + { + if ($args =~ /-debug/i) + { + $DB=1; + print "\n-----DEBUGGING -----\n\n"; + } + if ($args =~ /-debugX/i) + { + $DBX=1; + print "\n----- SUPER-DUPER DEBUGGING -----\n\n"; + } + if ($args =~ /-q/i) + { + $q=1; + } + if ($args =~ /-t/i) + { + $T=1; + $TEST=1; + print "\n----- TESTING -----\n\n"; + } + if ($args =~ /-live-update/i) + { + $liveupdate=1; + print "\n----- RUN LIVE UPDATE -----\n\n"; + } + if ($args =~ /-system-duplicate/i) + { + $sysdup=1; + print "\n----- ENTIRE SYSTEM DUPLICATE CHECK -----\n\n"; + } + if ($args =~ /-campaign-duplicate=/i) + { + @data_in = split(/-campaign-duplicate=/,$args); + $campdup = $data_in[1]; + $campdup =~ s/ .*//gi; + print "\n----- CAMPAIGN DUPLICATE CHECK: $campdup -----\n\n"; + } + else + {$campdup = '';} + + if ($args =~ /--ignore-list=/i) + { + @data_in = split(/--ignore-list=/,$args); + $ignorelist = $data_in[1]; + $ignorelist =~ s/ .*//gi; + print "\n----- LISTID IGNORE: $ignorelist -----\n\n"; + } + else + {$ignorelist = '';} + + if ($args =~ /--duplicate-list=/i) + { + @data_in = split(/--duplicate-list=/,$args); + $duplicatelist = $data_in[1]; + $duplicatelist =~ s/ .*//gi; + print "\n----- LISTID DUPLICATE: $duplicatelist -----\n\n"; + } + else + {$duplicatelist = '998';} + + } +} +else +{ +print "no command line options set\n"; +$args = ""; +$i=0; +$campdup = ''; +$liveupdate=0; +$duplicatelist = '998'; +} +### end parsing run-time options ### + +$US = '_'; +$phone_list = '|'; +$MT[0]=''; + +if (!$VARDB_port) {$VARDB_port='3306';} + +use DBI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +open(out, ">>$VDHLOGfile") || die "Can't open $VDHLOGfile: $!\n"; +print out "\n\nSTARTED DUPLICATE CHECK: $pulldate0|$sysdup: $sysdup|campdup: $campdup|ignorelist: $ignorelist|\n"; +close(out); + +$campSQL=''; +$listSQL=''; +$where='WHERE'; +$and='and'; +if (length($campdup)>0) + { + $stmtA = "select list_id from vicidial_lists where campaign_id='$campdup';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $dup_lists .= "'$aryA[0]',"; + $rec_count++; + } + $sthA->finish(); + chop($dup_lists); + $campSQL="list_id IN($dup_lists)"; + if (length($ignorelist)>0) + { + $listSQL=" and list_id NOT IN('$ignorelist')"; + } + + } +else + { + if (length($ignorelist)>0) + { + $listSQL="list_id NOT IN('$ignorelist')"; + } + else + { + $where=''; + $and=''; + } + } + +$stmtA = "select count(*) as tally, phone_number from vicidial_list $where $campSQL $listSQL group by phone_number order by tally desc;"; +if($DBX){print STDERR "\n|$stmtA|\n";} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$i=0; +$nonDUP='0'; +while ( ($sthArows > $i) && ($nonDUP=='0') ) + { + @aryA = $sthA->fetchrow_array; + if ($aryA[0] > 1) + { + $dup_count[$i] = "$aryA[0]"; + $dup_list[$i] = "$aryA[1]"; + } + else + { + $nonDUP++; + } + $i++; + } +$sthA->finish(); + +$b=0; +foreach(@dup_list) + { + $dup_limit = ($dup_count[$b] - 1); + $stmtA = "select lead_id,list_id,entry_date from vicidial_list where phone_number='$dup_list[$b]' $and $campSQL $listSQL order by entry_date;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + open(out, ">>$VDHLOGfile") || die "Can't open $VDHLOGfile: $!\n"; + print out "$dup_list[$b]|$dup_count[$b]|"; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + if ($rec_count<1) {print out "$aryA[0]|$aryA[1]|$aryA[2]\n";} + else + { + print out " $aryA[0]|$aryA[1]|$aryA[2]\n"; + $DUP_updates .= "'$aryA[0]',"; + } + $rec_count++; + } + close(out); + $sthA->finish(); + + $b++; + + if ($b =~ /100$/i) {print STDERR "0 $b\r";} + if ($b =~ /200$/i) {print STDERR "+ $b\r";} + if ($b =~ /300$/i) {print STDERR "| $b\r";} + if ($b =~ /400$/i) {print STDERR "\\ $b\r";} + if ($b =~ /500$/i) {print STDERR "- $b\r";} + if ($b =~ /600$/i) {print STDERR "/ $b\r";} + if ($b =~ /700$/i) {print STDERR "| $b\r";} + if ($b =~ /800$/i) {print STDERR "+ $b\r";} + if ($b =~ /900$/i) {print STDERR "0 $b\r";} + if ($b =~ /000$/i) {print "|$b|$phone_number|\n";} + + } +chop($DUP_updates); + +if ($liveupdate>0) + { + $stmtA = "UPDATE vicidial_list set list_id='$duplicatelist' where lead_id IN($DUP_updates);"; + if($DB){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n"; + + if($DBX){print STDERR "\nDUP UPDATES|$DUP_updates|\n $affected_rows Leads moved to $duplicatelist\n";} + } +else + { + if($DB){print STDERR "\n|$stmtA|\n";} + } + +$dbhA->disconnect(); + +### calculate time to run script ### +$secY = time(); +$secZ = ($secY - $secX); +$secZm = ($secZ /60); + +print "script execution time in seconds: $secZ minutes: $secZm\n"; + +exit; + diff --git a/agc_2-X/branches/agc_2.0.4/bin/VICIDIAL_IN_new_leads_file.pl b/agc_2-X/branches/agc_2.0.4/bin/VICIDIAL_IN_new_leads_file.pl new file mode 100644 index 00000000..68e88213 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/VICIDIAL_IN_new_leads_file.pl @@ -0,0 +1,1255 @@ +#!/usr/bin/perl +# +# VICIDIAL_IN_new_leads_file.pl version 0.6 *DBI-version* +# +# DESCRIPTION: +# script lets you insert leads into the vicidial_list table from a TAB-delimited +# lead file that is in the proper format. (for format see --help) +# +# It is recommended that you run this program on the local Asterisk machine +# +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# +# +# CHANGES +# 60615-1543 - Added gmt_offset_now lookup for each lead +# - Added option to force a gmt value(field after COMMENTS field) +# 60616-0958 - Added listID override feature to force all leads into same list +# 60807-1003 - Changed to DBI +# - changed to use /etc/astguiclient.conf for configs +# 60906-1055 - added filter of non-digits in alt_phone field +# 60913-1236 - fixed MySQL bugs and non-debug bug +# - added duplicate check flag option within same list +# 61127-1132 - Added new DST methods +# 61128-1037 - Added postal codes GMT lookup option +# 70510-1518 - Added campaign and system duplicate check and phonecode override +# 70801-0912 - Added called count and status to import leads format (fields 24 and 25) +# 70815-2128 - Added entry_date to import leads format (field 26) +# + +$secX = time(); + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($hour < 10) {$hour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +$pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; +$inSD = $pulldate0; +$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + + +if (!$VDHLOGfile) {$VDHLOGfile = "$PATHlogs/newleads.$year-$mon-$mday";} + +print "\n\n\n\n\n\n\n\n\n\n\n\n-- VICIDIAL_IN_new_leads_file.pl --\n\n"; +print "This program is designed to take a tab delimited file and import it into the VICIDIAL system. \n\n"; + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help|-h/i) + { + print "allowed run time options:\n"; + print " [-q] = quiet\n"; + print " [-t] = test\n"; + print " [--forcegmt] = forces gmt value of column after comments column\n"; + print " [--debug] = debug output\n"; + print " [--forcelistid=1234] = overrides the listID given in the file with the 1234\n"; + print " [--forcephonecode=44] = overrides the phone_code given in the lead with the 44\n"; + print " [--duplicate-check] = checks for the same phone number in the same list id before inserting lead\n"; + print " [--duplicate-campaign-check] = checks for the same phone number in the same campaign before inserting lead\n"; + print " [--duplicate-system-check] = checks for the same phone number in the entire system before inserting lead\n"; + print " [--postal-code-gmt] = checks for the time zone based on the postal code given where available\n"; + print " [-h] = this help screen\n\n"; + print "\n"; + print "This script takes in lead files in the following order when they are placed in the $PATHhome/LEADS_IN directory to be imported into the vicidial_list table:\n\n"; + print "vendor_lead_code|source_code|list_id|phone_code|phone_number|title|first_name|middle|last_name|address1|address2|address3|city|state|province|postal_code|country|gender|date_of_birth|alt_phone|email|security_phrase|COMMENTS|called_count|status|entry_date\n\n"; + print "3857822|31022|105|01144|1625551212|MRS|B||BURTON|249 MUNDON ROAD|MALDON|ESSEX||||CM9 6PW|UK||||||COMMENTS|2|B|2007-08-09 00:00:00\n\n"; + + exit; + } + else + { + if ($args =~ /-debug/i) + { + $DB=1; + print "\n-----DEBUGGING -----\n\n"; + } + if ($args =~ /-debugX/i) + { + $DBX=1; + print "\n----- SUPER-DUPER DEBUGGING -----\n\n"; + } + if ($args =~ /-q/i) + { + $q=1; + } + if ($args =~ /-t/i) + { + $T=1; + $TEST=1; + print "\n----- TESTING -----\n\n"; + } + if ($args =~ /-forcegmt/i) + { + $forcegmt=1; + print "\n----- FORCE GMT -----\n\n"; + } + if ($args =~ /-forcelistid=/i) + { + @data_in = split(/-forcelistid=/,$args); + $forcelistid = $data_in[1]; + $forcelistid =~ s/ .*//gi; + print "\n----- FORCE LISTID OVERRIDE: $forcelistid -----\n\n"; + } + else + {$forcelistid = '';} + + if ($args =~ /--forcephonecode=/i) + { + @data_in = split(/--forcephonecode=/,$args); + $forcephonecode = $data_in[1]; + $forcephonecode =~ s/ .*//gi; + print "\n----- FORCE PHONECODE OVERRIDE: $forcephonecode -----\n\n"; + } + else + {$forcephonecode = '';} + + if ($args =~ /-duplicate-check/i) + { + $dupcheck=1; + print "\n----- DUPLICATE CHECK -----\n\n"; + } + if ($args =~ /-duplicate-campaign-check/i) + { + $dupcheckcamp=1; + print "\n----- DUPLICATE CAMPAIGN CHECK -----\n\n"; + } + if ($args =~ /-duplicate-system-check/i) + { + $dupchecksys=1; + print "\n----- DUPLICATE SYSTEM CHECK -----\n\n"; + } + if ($args =~ /-postal-code-gmt/i) + { + $postalgmt=1; + print "\n----- POSTAL CODE TIMEZONE -----\n\n"; + } + } +} +else +{ +print "no command line options set\n"; +$args = ""; +$i=0; +$forcelistid = ''; +} +### end parsing run-time options ### + +$US = '_'; +$phone_list = '|'; + +if (!$VARDB_port) {$VARDB_port='3306';} + +use DBI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +$suf = '.txt'; +$people_packages_id_update=''; +$dir1 = "$PATHhome/LEADS_IN"; +$dir2 = "$PATHhome/LEADS_IN/DONE"; + + if($DBX){print STDERR "\nLEADS_IN directory: |$dir1|\n";} + + opendir(FILE, "$dir1/"); + @FILES = readdir(FILE); + +foreach(@FILES) + { + $size1 = 0; + $size2 = 0; + $person_id_delete = ''; + $transaction_id_delete = ''; + + if (length($FILES[$i]) > 4) + { + + $size1 = (-s "$dir1/$FILES[$i]"); + if (!$q) {print "$FILES[$i] $size1\n";} + sleep(2); + $size2 = (-s "$dir1/$FILES[$i]"); + if (!$q) {print "$FILES[$i] $size2\n\n";} + + + if ( ($FILES[$i] !~ /^TRANSFERRED/i) && ($size1 eq $size2) && (length($FILES[$i]) > 4)) + { + $GOODfname = $FILES[$i]; + $FILES[$i] =~ s/ /_/gi; + $FILES[$i] =~ s/\(|\)|\||\\|\/|\'|\"|//gi; + rename("$dir1/$GOODfname","$dir1/$FILES[$i]"); + $FILEname = $FILES[$i]; + + `cp -f $dir1/$FILES[$i] $dir2/$source$FILES[$i]`; + + ### open the in file for reading ### + open(infile, "$dir2/$source$FILES[$i]") + || die "Can't open $source$FILES[$i]: $!\n"; + + +### Grab Server values from the database +$stmtA = "SELECT local_gmt FROM servers where server_ip = '$server_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +@aryA = $sthA->fetchrow_array; +$DBSERVER_GMT = $aryA[0]; +if (length($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;} +$sthA->finish(); + + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + +if ($isdst) {$LOCAL_GMT_OFF++;} +if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";} + + + $a=0; ### each line of input file counter ### + $b=0; ### status of 'APPROVED' counter ### + $c=0; ### status of 'DECLINED' counter ### + $d=0; ### status of 'REFERRED' counter ### + $e=0; ### status of 'ERROR' counter ### + $f=0; ### number of 'DUPLICATE' counter ### + + $multi_insert_counter=0; + $multistmt=''; + +if ($DB) +# while () + { + +# print "$a| $number\n"; + $number = $_; + chomp($number); +# $number =~ s/,/\|/gi; + $number =~ s/\t/\|/gi; + $number =~ s/\'|\t|\r|\n|\l//gi; + $number =~ s/\'|\t|\r|\n|\l//gi; + $number =~ s/\",,,,,,,\"/\|\|\|\|\|\|\|/gi; + $number =~ s/\",,,,,,\"/\|\|\|\|\|\|/gi; + $number =~ s/\",,,,,\"/\|\|\|\|\|/gi; + $number =~ s/\",,,,\"/\|\|\|\|/gi; + $number =~ s/\",,,\"/\|\|\|/gi; + $number =~ s/\",,\"/\|\|/gi; + $number =~ s/\",\"/\|/gi; + $number =~ s/\"//gi; + @m = split(/\|/, $number); + +# This is the format for the lead files +#3857822|31022|105|01144|1625551212|MRS|B||BURTON|249 MUNDON ROAD|MALDON|ESSEX||||CM9 6PW|UK||||||COMMENTS + + + $vendor_lead_code = $m[0]; chomp($vendor_lead_code); + $source_code = $m[1]; chomp($source_code); $source_id = $source_code; + $list_id = $m[2]; chomp($list_id); + $phone_code = $m[3]; chomp($phone_code); $phone_code =~ s/\D//gi; + $phone_number = $m[4]; chomp($phone_number); $phone_number =~ s/\D//gi; + $USarea = substr($phone_number, 0, 3); + $title = $m[5]; chomp($title); + $first_name = $m[6]; chomp($first_name); + $middle_initial = $m[7]; chomp($middle_initial); + $last_name = $m[8]; chomp($last_name); + $address1 = $m[9]; chomp($address1); + $address2 = $m[10]; chomp($address2); + $address3 = $m[11]; chomp($address3); + $city = $m[12]; chomp($city); + $state = $m[13]; chomp($state); + $province = $m[14]; chomp($province); + $postal_code = $m[15]; chomp($postal_code); + $country = $m[16]; chomp($country); + $gender = $m[17]; + $date_of_birth = $m[18]; + $alt_phone = $m[19]; chomp($alt_phone); $alt_phone =~ s/\D//gi; + $email = $m[20]; + $security_phrase = $m[21]; + $comments = $m[22]; + $called_count = $m[23]; $called_count =~ s/\D|\r|\n|\t//gi; if (length($called_count)<1) {$called_count=0;} + $status = $m[24]; $status =~ s/ |\r|\n|\t//gi; if (length($status)<1) {$status='NEW';} + $insert_date = $m[25]; $insert_date =~ s/\r|\n|\t|[a-zA-Z]//gi; if (length($insert_date)<6) {$insert_date=$pulldate0;} + if ($insert_date =~ /\//) + { + @iD = split(/\//, $insert_date); + $iD[0] = sprintf("%02d", $iD[0]); + $iD[1] = sprintf("%02d", $iD[1]); + $insert_date = "$iD[2]-$iD[0]-$iD[1]"; + } + + if (length($forcelistid) > 0) + { + $list_id = $forcelistid; # set list_id to override value + } + if (length($forcephonecode) > 0) + { + $phone_code = $forcephonecode; # set phone_code to override value + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if ($dupchecksys > 0) + { + $dup_lead=0; + $stmtA = "select count(*) from vicidial_list where phone_number='$phone_number';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $dup_lead = $aryA[0]; + $dup_lead_list=$list_id; + } + $sthA->finish(); + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if ($dupcheck > 0) + { + $dup_lead=0; + $stmtA = "select list_id from vicidial_list where phone_number='$phone_number' and list_id='$list_id' limit 1;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $dup_lead_list = $aryA[0]; + $dup_lead++; + } + $sthA->finish(); + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if ($dupcheckcamp > 0) + { + $dup_lead=0; + $dup_lists=''; + + $stmtA = "select count(*) from vicidial_lists where list_id='$list_id';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + @aryA = $sthA->fetchrow_array; + $ci_recs = $aryA[0]; + $sthA->finish(); + if ($ci_recs > 0) + { + $stmtA = "select campaign_id from vicidial_lists where list_id='$list_id';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + @aryA = $sthA->fetchrow_array; + $dup_camp = $aryA[0]; + $sthA->finish(); + + $stmtA = "select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $dup_lists .= "'$aryA[0]',"; + $rec_count++; + } + $sthA->finish(); + + chop($dup_lists); + $stmtA = "select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $dup_lead_list = "'$aryA[0]',"; + $rec_count++; + $dup_lead=1; + } + $sthA->finish(); + } + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + + if ( (length($phone_number)>6) && ($dup_lead < 1) ) + { + $phone_list .= "$phone_number$US$list_id|"; + # set default values + $modify_date = ""; + $user = ""; + $called_since_last_reset='N'; + $gmt_offset = '0'; + + if ($forcegmt > 0) + { + $gmt_offset = $m[23]; # set GMT offset value to 24th field value + } + else + { + $postalgmt_found=0; + if ( ($postalgmt > 0) && (length($postal_code)>4) ) + { + if ($phone_code =~ /^1$/) + { + $stmtA = "select * from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[2]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[3]; + $dst_range = $aryA[4]; + $PC_processed++; + $rec_count++; + $postalgmt_found++; + if ($DBX) {print " Postal GMT record found for $postal_code: |$gmt_offset|$dst|$dst_range|\n";} + } + $sthA->finish(); + } + } + if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =~ /^1$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### MEXICO ### + if ($phone_code =~ /^52$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### AUSTRALIA ### + if ($phone_code =~ /^61$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + } + + ### Find out if DST to raise the gmt offset ### + $AC_GMT_diff = ($area_GMT - $LOCAL_GMT_OFF_STD); + $AC_localtime = ($secX + (3600 * $AC_GMT_diff)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($AC_localtime); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + + if ( (!$AC_processed) && ($dst_range =~ /SSM-FSN/) ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + &USACAN_dstcalc; + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSA-LSO/) ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + &NA_dstcalc; + if ($DBX) {print " DST: $NA_DST\n";} + if ($NA_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /LSM-LSO/) ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + &GBR_dstcalc; + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /LSO-LSM/) ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + &AUS_dstcalc; + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSO-LSM/) ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + &AUST_dstcalc; + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSO-TSM/) ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + &NZL_dstcalc; + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /TSO-LSF/) ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + &BZL_dstcalc; + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$gmt_offset++;} + $AC_processed++; + } + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + } + if ($multi_insert_counter > 8) + { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$insert_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments','$called_count');"; + if (!$T) {$affected_rows = $dbhA->do($stmtZ); } # or die "Couldn't execute query: |$stmtZ|\n"; + if($DB){print STDERR "\n|$affected_rows|$stmtZ|\n";} + + $multistmt=''; + $multi_insert_counter=0; + $c++; + } + else + { + $multistmt .= "('','$insert_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments','$called_count'),"; + $multi_insert_counter++; + } + + $b++; + } + else + { + if ($dup_lead > 0) + {print "DUPLICATE: $phone|$list_id|$dup_lead_list|"; $f++;} + else + {print "BAD Home_Phone: $phone|$vendor_id"; $e++;} + } + + $a++; + + if ($a =~ /100$/i) {print STDERR "0 $a\r";} + if ($a =~ /200$/i) {print STDERR "+ $a\r";} + if ($a =~ /300$/i) {print STDERR "| $a\r";} + if ($a =~ /400$/i) {print STDERR "\\ $a\r";} + if ($a =~ /500$/i) {print STDERR "- $a\r";} + if ($a =~ /600$/i) {print STDERR "/ $a\r";} + if ($a =~ /700$/i) {print STDERR "| $a\r";} + if ($a =~ /800$/i) {print STDERR "+ $a\r";} + if ($a =~ /900$/i) {print STDERR "0 $a\r";} + if ($a =~ /000$/i) {print "$a|$b|$c|$d|$e|$phone_number|\n";} + + } + + if (length($multistmt) > 10) + { + chop($multistmt); + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt;"; + if (!$T) {$affected_rows = $dbhA->do($stmtZ); } # or die "Couldn't execute query: |$stmtZ|\n"; + if($DB){print STDERR "\n|$affected_rows|$stmtZ|\n";} + + $multistmt=''; + $multi_insert_counter=0; + $c++; + } + + ### open the stats out file for writing ### + open(Sout, ">>$VDHLOGfile") + || die "Can't open $VDHLOGfile: $!\n"; + + + ### close file handler and DB connections ### + print "\n\nTOTALS FOR $FILEname:\n"; + print "Transactions sent:$a\n"; + print "INSERTED: $b\n"; + print "INSERT STATEMENTS:$c\n"; + print "ERROR: $e\n"; + if ($f > 0) + {print "DUPLICATES: $f\n";} + + print Sout "\nTOTALS FOR $FILEname:\n"; + print Sout "Transactions sent:$a\n"; + print Sout "INSERTED: $b\n"; + print Sout "INSERT STATEMENTS:$c\n"; + print Sout "ERROR: $e\n"; + if ($f > 0) + {print Sout "DUPLICATES: $f\n";} + + close(infile); + close(Sout); + chmod 0777, "$VDHLOGfile"; + + if (!$T) {`mv -f $dir1/$FILEname $dir2/$FILEname`;} + + } + } + $i++; +} + + +$dbhA->disconnect(); + +### calculate time to run script ### +$secY = time(); +$secZ = ($secY - $secX); +$secZm = ($secZ /60); + +print "script execution time in seconds: $secZ minutes: $secZm\n"; + +exit; + + + + + + + +sub USACAN_dstcalc { +#********************************************************************** +# SSM-FSN +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on Second Sunday March to First Sunday November at 2 am. +# INPUTS: +# mm INTEGER Month. +# dd INTEGER Day of the month. +# ns INTEGER Seconds into the day. +# dow INTEGER Day of week (0=Sunday, to 6=Saturday) +# OPTIONAL INPUT: +# timezone INTEGER hour difference UTC - local standard time +# (DEFAULT is blank) +# make calculations based on UTC time, +# which means shift at 10:00 UTC in April +# and 9:00 UTC in October +# OUTPUT: +# INTEGER 1 = DST, 0 = not DST +# +# S M T W T F S +# 1 2 3 4 5 6 7 +# 8 9 10 11 12 13 14 +#15 16 17 18 19 20 21 +#22 23 24 25 26 27 28 +#29 30 31 +# +# S M T W T F S +# 1 2 3 4 5 6 +# 7 8 9 10 11 12 13 +#14 15 16 17 18 19 20 +#21 22 23 24 25 26 27 +#28 29 30 31 +# +#********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; return 0; + } elsif ($mm >= 4 && $mm <= 10) { + $USACAN_DST=1; return 1; + } elsif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; return 1; + } elsif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; return 0; + } else { + $USACAN_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $USACAN_DST=0; return 0; + } else { + $USACAN_DST=1; return 1; + } + } + } else { + $USACAN_DST=0; return 0; + } + } elsif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; return 0; + } elsif ($dd < ($dow+1)) { + $USACAN_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; return 1; + } else { + $USACAN_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; return 1; + } else { + $USACAN_DST=0; return 0; + } + } + } else { + $USACAN_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub NA_dstcalc { +#********************************************************************** +# FSA-LSO +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in April and last Sunday in October at 2 am. +#********************************************************************** + + $NA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $NA_DST=0; return 0; + } elsif ($mm >= 5 && $mm <= 9) { + $NA_DST=1; return 1; + } elsif ($mm == 4) { + if ($dd > 7) { + $NA_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $NA_DST=0; return 0; + } else { + $NA_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $NA_DST=0; return 0; + } else { + $NA_DST=1; return 1; + } + } + } else { + $NA_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $NA_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $NA_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $NA_DST=1; return 1; + } else { + $NA_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 7200) { + $NA_DST=1; return 1; + } else { + $NA_DST=0; return 0; + } + } + } else { + $NA_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub GBR_dstcalc { +#********************************************************************** +# LSM-LSO +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in March and last Sunday in October at 1 am. +#********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; return 0; + } elsif ($mm >= 4 && $mm <= 9) { + $GBR_DST=1; return 1; + } elsif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $GBR_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; return 0; + } else { + $GBR_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; return 0; + } else { + $GBR_DST=1; return 1; + } + } + } else { + $GBR_DST=1; return 1; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $GBR_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; return 1; + } else { + $GBR_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; return 1; + } else { + $GBR_DST=0; return 0; + } + } + } else { + $GBR_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub AUS_dstcalc { +#********************************************************************** +# LSO-LSM +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in October and last Sunday in March at 1 am. +#********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $AUS_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $AUS_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; return 1; + } else { + $AUS_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; return 1; + } else { + $AUS_DST=0; return 0; + } + } + } else { + $AUS_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $AUS_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; return 0; + } else { + $AUS_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; return 0; + } else { + $AUS_DST=1; return 1; + } + } + } else { + $AUS_DST=1; return 1; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub AUST_dstcalc { +#********************************************************************** +# FSO-LSM +# TASMANIA ONLY +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and last Sunday in March at 1 am. +#********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $AUST_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $AUST_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; return 1; + } else { + $AUST_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; return 1; + } else { + $AUST_DST=0; return 0; + } + } + } else { + $AUST_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd >= 8) { + $AUST_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $AUST_DST=0; return 0; + } else { + $AUST_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $AUST_DST=0; return 0; + } else { + $AUST_DST=1; return 1; + } + } + } else { + $AUST_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub NZL_dstcalc { +#********************************************************************** +# FSO-TSM +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and third Sunday in March at 1 am. +#********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $NZL_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; return 1; + } elsif ($dd < ($dow+14)) { + $NZL_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; return 1; + } else { + $NZL_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; return 1; + } else { + $NZL_DST=0; return 0; + } + } + } else { + $NZL_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd >= 8) { + $NZL_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $NZL_DST=0; return 0; + } else { + $NZL_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $NZL_DST=0; return 0; + } else { + $NZL_DST=1; return 1; + } + } + } else { + $NZL_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub BZL_dstcalc { +#********************************************************************** +# TSO-LSF +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. Brazil +# Based on Third Sunday October to Last Sunday February at 1 am. +#********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; return 1; + } elsif ($mm >= 3 && $mm <= 9) { + $BZL_DST=0; return 0; + } elsif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; return 1; + } elsif ($dd < ($dow+22)) { + $BZL_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; return 1; + } else { + $BZL_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; return 1; + } else { + $BZL_DST=0; return 0; + } + } + } else { + $BZL_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; return 0; + } elsif ($dd < ($dow+22)) { + $BZL_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; return 0; + } else { + $BZL_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; return 0; + } else { + $BZL_DST=1; return 1; + } + } + } else { + $BZL_DST=1; return 1; + } + } # end of month checks +} # end of subroutine dstcalc diff --git a/agc_2-X/branches/agc_2.0.4/bin/build_translation_www_files.pl b/agc_2-X/branches/agc_2.0.4/bin/build_translation_www_files.pl new file mode 100644 index 00000000..f54b684d --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/bin/build_translation_www_files.pl @@ -0,0 +1,418 @@ +#!/usr/bin/perl + +# build_translation_www_files.pl - converts web pages to other language +# +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# +# changes: +# 60808-1029 - Changed to use /etc/astguiclient.conf for configs +# 70402-1305 - Added error log generation for not found phrases +# + +############################################ +# grab variables from /etc/astguiclient.conf + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# +# path to home directory: (assumes it already exists) +$home = $PATHhome; + +# path to web root directory: (assumes it already exists) +$webroot = $PATHweb; + +############################################ + +$secX = time(); + +# constants +$DB=1; # Debug flag, set to 0 for no debug messages, lots of output +$US='_'; +$MT[0]=''; +$language_admin_file = 'language_admin.txt'; +$language_file = 'language.txt'; +$error_file = "language_error.txt"; +$admin_error_file = "language_admin_error.txt"; + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-t] = test\n [-debug] = verbose debug messages\n[--admin-only] = only translate admin pages\n[--client-only] = only translate client pages\n[--without-en] = only translate non-english\n[--language=] = which language to build, 2 letter code, defaults to es-spanish\n\n"; + + exit; + } + else + { + if ($args =~ /-debug/i) + { + $DB=1; # Debug flag + } + if ($args =~ /--language/i) + { + $LANG=1; + print "\n----- LANGUAGE WEB SCRIPT ONLY BUILD -----\n\n"; + } + if ($args =~ /--language=/i) + { + @data_in = split(/--language=/,$args); + $CLIlanguage = $data_in[1]; + } + else + {$CLIlanguage = 'es';} # default to build all languages + if ($args =~ /-admin-only/i) + { + $admin_only=1; # Admin flag + print "\n----- ADMIN PAGES ONLY BUILD -----\n\n"; + } + if ($args =~ /-client-only/i) + { + $client_only=1; # Client flag + print "\n----- CLIENT PAGES ONLY BUILD -----\n\n"; + } + if ($args =~ /-without-en/i) + { + print "\n----- NON-ENGLISH ONLY BUILD -----\n\n"; + $without_en=1; + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +# print "no command line options set\n"; +} +### end parsing run-time options ### + + +if ($LANG) +{ +if ( (!$admin_only) && (!$client_only) ) + {$admin_only=1; $client_only=1;} + +if ($admin_only==1) + { + print "\n----- LANGUAGE BUILD: $CLIlanguage -----\n\n"; + $LANG_FILE_ERROR = "$PATHlogs/$CLIlanguage$US$admin_error_file"; + $LANG_FILE_ADMIN = "./translations/$CLIlanguage$US$language_admin_file"; + open(lang, "$LANG_FILE_ADMIN") || die "can't open $LANG_FILE_ADMIN: $!\n"; + @lang = ; + close(lang); + &translate_pages; + } + +@lang=@MT; +@LANGUAGES=@MT; +@FILES=@MT; +@TRANSLATIONS=@MT; +@TRANSLATIONS_RAW=@MT; + +if ($client_only==1) + { + $LANG_FILE_ERROR = "$PATHlogs/$CLIlanguage$US$error_file"; + $LANG_FILE = "./translations/$CLIlanguage$US$language_file"; + open(lang, "$LANG_FILE") || die "can't open $LANG_FILE: $!\n"; + @lang = ; + close(lang); + &translate_pages; + } +} + +$secy = time(); $secz = ($secy - $secX); $minz = ($secz/60); # calculate script runtime so far +print "\n - process runtime ($secz sec) ($minz minutes)\n"; +print "\n\nDONE and EXITING\n"; + + +exit; + + + +sub translate_pages +{ +#***LANGUAGES*** +#en-English|es-Espaol| +#***FILES*** +#agc/astguiclient.php +#agc/vicidial.php +#***TRANSLATIONS*** +#English|Ingls| +#Spanish|Espaol| + +##### PARSE THE LANGUAGES SETTING FILE ##### +$section=''; +$i=0; +$Lct=0; $Fct=0; $Tct=0; +foreach(@lang) + { + if ($lang[$i] !~ /^\#/) + { + if ($lang[$i] =~ /^\*\*\*/) + { + $section = $lang[$i]; + $section =~ s/\*|\n|\r//gi; + # print "section heading: $section: $lang[$i]"; + } + else + { + if ($section =~ /LANGUAGES/) + { + $LANGUAGES = $lang[$i]; + $Lct++; + } + else + { + if ($section =~ /FILES/) + { + # print "section: $section line: $lang[$i]"; + $FILES[$Fct] = $lang[$i]; + $Fct++; + } + else + { + if ($section =~ /TRANSLATIONS/) + { + # print "section: $section line: $lang[$i]"; + @TRANSlineX = split(/\|/, $lang[$i]); + $ORIGtextX = "$TRANSlineX[0]"; + $lengthX = length($ORIGtextX); + $lengthX = sprintf("%04d",$lengthX); + $TRANSLATIONS_RAW[$Tct] = "$lengthX|$lang[$i]"; + $Tct++; + } + } + } + } + } + $i++; + } + +if ($DB) + { + print "LANGUAGE FILE PARSE RESULTS: $#lang lines in file\n"; + print "LANGUAGES: $LANGUAGES\n"; + print "FILES: $Fct\n"; + print "TRANSLATIONS: $Tct\n"; + } + +#@TRANSLATIONS = sort { length($b) <=> length($a) } @TRANSLATIONS_RAW; +@TRANSLATIONS = sort { $b <=> $a } @TRANSLATIONS_RAW; + +#$k=0; +#foreach(@TRANSLATIONS) +# { +# $length = length($TRANSLATIONS[$k]); +# print "$TRANSLATIONS[$k]|$length|\n"; +# $k++; +# } + +##### LOOP THROUGH THE LANGUAGES +@lang_list = split(/\|/, $LANGUAGES); +@lang_link_list = @lang_list; +$i=0; +$gif = '.gif'; +foreach(@lang_list) + { + if (length($lang_list[$i]) > 2) + { + @lang_detail = split(/-/, $lang_list[$i]); + $lang_abb = $lang_detail[0]; + $lang_name = $lang_detail[1]; + + if ( ($without_en==1) && ($lang_abb =~ /en/) ) + { + print "SKIPPING ENGLISH COPYING: $lang_abb|$i\n\n"; + } + else + { + ##### LOOP THROUGH THE FILES + $Fct=0; + foreach(@FILES) + { + $a=0; + @file_detail = split(/\|/, $FILES[$Fct]); + $file_path = $file_detail[0]; + $file_name = $file_detail[1]; + $file_name =~ s/\t|\r|\n//gi; + $file_passthru = $file_detail[2]; + $file_passthru =~ s/\t|\r|\n//gi; + if (-e "$webroot/$file_path/$file_name") + { + open(file, "$webroot/$file_path/$file_name") || die "can't open $webroot/$file_path/$file_name: $!\n"; + @file = @MT; + @file = ; + close(file); + + print "File exists: ./$file_path/$file_name\n"; + if (-e "$webroot/$file_path$US$lang_abb") + { + print "Lang Directory exists: $webroot/$file_path$US$lang_abb\n"; + } + else + { + `mkdir $webroot/$file_path$US$lang_abb`; + `chmod 0777 $webroot/$file_path$US$lang_abb`; + print "Lang Directory created: $webroot/$file_path$US$lang_abb\n"; + } + + if ($file_passthru < 1) + { + ##### LOOP THROUGH THE TRANSLATIONS + $Tct=0; + foreach(@TRANSLATIONS) + { + @TRANSline = split(/\|/, $TRANSLATIONS[$Tct]); + $ORIGtext = "$TRANSline[1]"; + $TRANStext = "$TRANSline[$i+1]"; + $LINESct=0; + foreach(@file) + { + if ($file[$LINESct] !~ /^\#|^\s*function |'INCALL'|'PAUSED'|'READY'|'NEW'|xmlhttp|ILPV |ILPA |SELECT cmd_line_f|=\"SELECT/) + { + $phrase_found_counter=0; + if ($file[$LINESct] =~ /INTERNATIONALIZATION-LINKS-PLACEHOLDER-VICIDIAL/) + { + $file[$LINESct] =~ s/INTERNATIONALIZATION-LINKS-PLACEHOLDER-VICIDIAL/ILPV/g; + $e=0; + $gif = '.gif'; + foreach(@lang_link_list) + { + if (length($lang_link_list[$e]) > 2) + { + @lang_list_detail = split(/-/, $lang_link_list[$e]); + $lang_list_abb = $lang_list_detail[0]; + $lang_list_name = $lang_list_detail[1]; + if ($lang_list_abb =~ /$lang_abb/) {$list_bgcolor = ' BGCOLOR=\"#CCFFCC\"';} + else {$list_bgcolor = '';} + $file[$LINESct] .= "echo \"
$lang_list_name $lang_list_name
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + +###################### +# ADD=2 display all busy extensions on a server +###################### +if ($ADD==2) +{ + if (!$field_name) {$field_name = 'busyext';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\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 "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=4 display all busy Local lines on a server +###################### +if ($ADD==4) +{ + if (!$field_name) {$field_name = 'local';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\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 "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='table') {echo "\n";} +if ($format=='table') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/astguiclient.php b/agc_2-X/branches/agc_2.0.4/www/agc/astguiclient.php new file mode 100644 index 00000000..c5fe5902 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/agc/astguiclient.php @@ -0,0 +1,2905 @@ + LICENSE: GPLv2 +# +# make sure you have added a user to the vicidial_users MySQL table with at least +# user_level 1 or greater to access this page. Also you need to have the login +# and pass of a phone listed in the asterisk.phones table. The page grabs the +# server info and other details from this login and pass +# +# Other scripts that this application depends on: +# - active_list_refresh.php: displays active/live channels and phones +# - manager_send.php: sends Actions to be executed on Asterisk servers +# - live_exten_check.php: checks to see if user's phone is on a live call +# - call_log_display.php: retrieves log of inbound and outbound calls +# - voicemail_check.php: retrieves counts of new and old messages +# - inbound_popup.php: opens upon live_inbound call coming in +# - conf_exten_check.php: checks to see if and calls are in a specific conf +# - park_calls_display.php: retrieves list of parked calls +# - vdc_db_query.php: Changes values in the DB for non-calling records +# +# CHANGES +# 50215-1356 - Proof-of-concept test of XMLHttpRequest for astGUIclient web +# 50323-1411 - First build version display-only +# 50331-1040 - Second-build, added phone login and hangup/hijack display +# 50401-1006 - Trunk/Local Hangup functions enabled +# 50404-1056 - Trunk/Local Hijack functions enabled +# 50404-1459 - Simple live calls display and grabs updated time from server +# 50405-1221 - Reorganized the display and layers, added some images +# 50406-1005 - Added In/Out call log display to MAIN panel +# 50407-1254 - Start/Stop Recording on live calls enabled +# 50422-1101 - Activated Check Voicemail button and new/old messages count +# 50428-1449 - Added dial from log and basic live_inbound call popup +# 50429-1455 - Modified inbound popup code for IE and to add more functions +# 50502-1442 - Added basic method to transfer live calls somewhere else +# 50503-1205 - Added web_client_sessions entry for more security of subscripts +# 50503-1537 - Added basic conferences display +# 50509-1132 - Added conference connected list and hangup/xfer for them +# 50511-1129 - Added registration of conference rooms and added manual dial +# 50523-1342 - Added Conference recording and send DTMF +# 50523-1622 - Added Local Dial window frame for calling local extensions +# 50524-1456 - Added ability to park call and display number of parked calls +# 50524-1600 - Added ability to display and pickup/hangup/xfer parked calls +# 50525-1224 - Added ability to place outbound call from within conferene +# 50531-1225 - Added ability to do dual transfers to meetme rooms from Main +# 50711-1229 - removed HTTP authentication in favor of user/pass vars +# 50711-1610 - Added Zap monitoring to Trunk/Local Action screens +# 50804-1604 - Minor bug fix in inbound_popup functions +# 50818-1715 - Added pretty login section +# 50913-1137 - Added custom outbound_cid from phones table +# 51110-1430 - Fixed non-standard http port issue +# 60103-1421 - Added code for favorite extensions chooser +# 60104-1347 - Added basic layout for favorites editing frame +# 60105-1124 - Finished Favorites frame and added DB submission +# 60112-1622 - Several formatting changes +# 60421-1357 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1103 - Added variable filters to close security holes for login form +# 60829-1528 - Made compatible with WeBRooTWritablE setting in dbconnect.php +# + +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["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["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} + 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"];} + } + +$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++;} + +$version = '2.0.1'; +$build = '60829-1528'; + +### 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); + $user=ereg_replace("[^0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^0-9a-zA-Z]","",$pass); + + +if ($force_logout) +{ + if( (strlen($_SERVER['user'])>0) or (strlen($_SERVER['pass'])>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "You have now logged out. Thank you\n"; + exit; +} + +$StarTtime = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_TIME = date("Ymd-His"); + $month_old = mktime(0, 0, 0, date("m"), date("d")-7, date("Y")); + $past_month_date = date("Y-m-d H:i:s",$month_old); + + $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]; + +$US='_'; +$CL=':'; +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./astguiclient_auth_entries.txt", "a");} +$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 = $agcPAGE; +$agcDIR = eregi_replace('astguiclient.php','',$agcDIR); + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth) or ($relogin == 'YES') ) + { + header ("Content-type: text/html; charset=utf-8"); + + echo "astGUIclient web client: Login\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Login
 
User Login:
User Password:
Phone Login:
Phone Password:

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($user); + $password=strtoupper($pass); + $stmt="SELECT full_name,user_level from vicidial_users where user='$user' and pass='$pass'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + } + +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 +echo "\n"; +echo "\n"; +echo "\n"; + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "astGUIclient web client: Phone Login\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Phone Login
 
Phone Login:
Phone Password:

VERSION: $version       BUILD: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$authphone=$row[0]; +if (!$authphone) + { + echo "astGUIclient web client: Phone Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Phone Login
 
Sorry, your phone login and password are not active in this system, please try again:
 
Phone Login:
Phone Password:

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "astGUIclient web client\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $phone_login=$row[6]; + $phone_pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CaLLerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + $outbound_cid=$row[65]; + + $local_web_callerID_URL_enc = rawurlencode($local_web_callerID_URL); + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtime$US$session_ext$session_rand"; + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'agc';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','agc','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT count(*) from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_present=$row[0]; + if ($favorites_present > 0) + { + $stmt="SELECT extensions_list from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_list=$row[0]; + $h=0; + $favorites_listX = eregi_replace("'",'',$favorites_list); + $favorites = explode(',',$favorites_listX); + $favorites_count = count($favorites); + $favorites_listX=''; + + $o=0; + while ($favorites_count > $o) + { + $stmt="SELECT fullname,protocol from phones where extension = '$favorites[$o]' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $favorites_names[$o] = $rowx[0]; + $favorites_listX .= "$rowx[1]/$favorites[$o],"; + $o++; + } + + echo "\n"; + echo "\n"; + } + else + { + echo "\n"; + } + +### gather phone extensions and fullnames for favorites editor ### + $stmt="SELECT extension,fullname from phones where server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $exten_ct = mysql_num_rows($rslt); + $favlistCT=0; + $nofavlistCT=0; + while ($favlistCT < $exten_ct) + { + $row=mysql_fetch_row($rslt); + $favlist[$favlistCT]= "$row[0] - $row[1]"; + $favlistCT++; + } + + } +} + + +?> + + + + + + +\n"; + + +?> + +
+ + + + + + + + + +
+ + +LOGOUT
\n"; ?> +
Main PanelActive Lines PanelConferences PanelCheck VoicemailLive Call
+
+ + +

Logout
+
+ + +
TRUNK HANGUP

+ Active Trunks Menu
+ Hangup Trunk   |   + Hijack Trunk   |   + Listen Trunk   |   + Refresh   |   + Back to Main Window +
+
+ + +
LOCAL HANGUP

+ Active Local Menu
+ Hangup Local   |   + Hijack Local   |   + Listen Local   |   + Refresh   |   + Back to Main Window +
+
+ + + + + + + +
LIVE CALL TRANSFER
Channel to be transferred: Channel
Extensions:
Extensions Menu
+
+ Send to selected extension

+ Send to selected vmail box

+ Send to this number:


+ Refresh


+ Back to Main Window

+
Conferences:
(click on a number below to send to a conference)
Send my channel too
Conferences Menu
+
+ + + + + +
LOCAL Extensions Dial
Phone calling from: Channel
Extensions:
Extensions Menu
+
+ Call selected extension

+ Call selected vmail box

+ Refresh


+ Back to Main Window

+
+
+ + +
PARKED CALLS:
+ Back to Main Window

+
+
+ + + + + + + + + + + + + + + +
  +
VOICEMAIL     NEW:     OLD:             MANUAL DIAL       DIAL
PARKED CALLS: 0                LOCAL DIAL EXTENSIONS
OUTBOUND CALLS:
INBOUND CALLS:
astGUIclient web-client VERSION: BUILD:
+ + + + $h) + { + if (strlen($favorites[$h])>1) + { + echo "\n"; + } + $h++; + } +?> + +
FAVORITES       edit
$favorites[$h] - $favorites_names[$h]
 
+
+ + + + + + + +
FAVORITES

 
SUBMIT FAVORITES CHANGES - requires logout
BACK TO MAIN WINDOW - ignore changes made
+
+ +
+ + + + + + + + + + + + + +
+PAUSE | START     Refresh rate: 1000 ms Faster | Slower

+
Initializing..
+
Active Extensions
+REFRESH | +ORDER | +
Outside Lines
+REFRESH | +ORDER | +
Local Extensions
+REFRESH | +ORDER | +
+ Data Goes Here

+
+ Data Goes Here

Trunk Action +
+ Data Goes Here

Local Action +
+
+ + + + +
+ + +Conferences List + + + +
+Click on a conference room number on the left for info on that conference +
+ + + +
+ + + + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/call_log_display.php b/agc_2-X/branches/agc_2.0.4/www/agc/call_log_display.php new file mode 100644 index 00000000..28d3ea87 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/agc/call_log_display.php @@ -0,0 +1,196 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid 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 "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Call Log Display"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten is not valid or protocol $protocol is not valid\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";} + $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";} + $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"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/conf_exten_check.php b/agc_2-X/branches/agc_2.0.4/www/agc/conf_exten_check.php new file mode 100644 index 00000000..ae3b84b5 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/agc/conf_exten_check.php @@ -0,0 +1,297 @@ + LICENSE: GPLv2 +# +# 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 +# + +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"];} + +$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";} + +$version = '2.0.4-12'; +$build = '71122-0205'; +$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";} + $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 + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid 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 "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Conf Extension Check"; +echo "\n"; +echo "\n"; +echo "\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 not valid\n"; + exit; + } + else + { + + if ($client == 'vdc') + { + $Acount=0; + $AexternalDEAD=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); + $row=mysql_fetch_row($rslt); + $Acount=$row[0]; + + if ($Acount > 0) + { + $stmt="SELECT status from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Astatus=$row[0]; + } + # ### 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";} + $rslt=mysql_query($stmt, $link); + + if ($campagentstdisp == 'YES') + { + ### grab the status of this agent to display + $stmt="SELECT status,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Alogin=$row[0]; + $Acampaign=$row[1]; + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where server_ip='$server_ip' and status NOT IN('XFER') and campaign_id='$Acampaign';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $RingCalls=$row[0]; + } + else + { + $Alogin='N'; + $RingCalls='N'; + } + } + else + { + $Alogin='N'; + $RingCalls='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";} + $rslt=mysql_query($stmt, $link); + + } + + if ($Acount < 1) {$Alogin='DEAD_VLA';} + if ($AexternalDEAD > 0) {$Alogin='DEAD_EXTERNAL';} + + echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Status: ' . $Astatus . "|\n"; + + } + $total_conf=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + 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); + $ChannelA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $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++; $total_conf++; + $row=mysql_fetch_row($rslt); + $ChannelA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + } + $channels_list = ($channels_list + $sip_list); + echo "$channels_list|"; + + $counter=0; + $countecho=''; + while($total_conf > $counter) + { + $counter++; + $countecho = "$countecho$ChannelA[$counter] ~"; + # echo "$ChannelA[$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 not valid or Exten $exten is not valid\n"; + exit; + } + else + { + $stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + echo "Conference $conf_exten has been registered to $exten\n"; + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/dbconnect.php b/agc_2-X/branches/agc_2.0.4/www/agc/dbconnect.php new file mode 100644 index 00000000..64e3607d --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/agc/dbconnect.php @@ -0,0 +1,51 @@ + LICENSE: GPLv2 +# +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"); +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 +$flag_channels=0; +$flag_string = 'VICIast20'; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/Thumbs.db b/agc_2-X/branches/agc_2.0.4/www/agc/images/Thumbs.db new file mode 100644 index 00000000..d6ae4c59 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/Thumbs.db differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_check_voicemail_BLINK.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_check_voicemail_BLINK.gif new file mode 100644 index 00000000..30703a78 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_check_voicemail_BLINK.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_check_voicemail_BLINK_e.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_check_voicemail_BLINK_e.gif new file mode 100644 index 00000000..600cef89 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_check_voicemail_BLINK_e.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_check_voicemail_BLINK_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_check_voicemail_BLINK_es.gif new file mode 100644 index 00000000..600cef89 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_check_voicemail_BLINK_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_check_voicemail_BLINK_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_check_voicemail_BLINK_ptbr.gif new file mode 100644 index 00000000..3670af28 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_check_voicemail_BLINK_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_check_voicemail_OFF.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_check_voicemail_OFF.gif new file mode 100644 index 00000000..5b7e4c75 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_check_voicemail_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_check_voicemail_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_check_voicemail_OFF_es.gif new file mode 100644 index 00000000..ec9c1d55 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_check_voicemail_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_check_voicemail_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_check_voicemail_OFF_ptbr.gif new file mode 100644 index 00000000..3b1c4644 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_check_voicemail_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_check_voicemail_ON.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_check_voicemail_ON.gif new file mode 100644 index 00000000..ad55916d Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_check_voicemail_ON.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_check_voicemail_ON_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_check_voicemail_ON_es.gif new file mode 100644 index 00000000..442a8084 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_check_voicemail_ON_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_check_voicemail_ON_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_check_voicemail_ON_ptbr.gif new file mode 100644 index 00000000..ae53a393 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_check_voicemail_ON_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_live_call_OFF.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_live_call_OFF.gif new file mode 100644 index 00000000..3752fb5e Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_live_call_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_live_call_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_live_call_OFF_es.gif new file mode 100644 index 00000000..1ff376d8 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_live_call_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_live_call_OFF_pl.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_live_call_OFF_pl.gif new file mode 100644 index 00000000..3c42a377 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_live_call_OFF_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_live_call_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_live_call_OFF_ptbr.gif new file mode 100644 index 00000000..86a71723 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_live_call_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_live_call_ON.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_live_call_ON.gif new file mode 100644 index 00000000..ed8ba2dd Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_live_call_ON.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_live_call_ON_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_live_call_ON_es.gif new file mode 100644 index 00000000..041d398f Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_live_call_ON_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_live_call_ON_pl.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_live_call_ON_pl.gif new file mode 100644 index 00000000..330346eb Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_live_call_ON_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_live_call_ON_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_live_call_ON_ptbr.gif new file mode 100644 index 00000000..c0601666 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_live_call_ON_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_active_lines.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_active_lines.gif new file mode 100644 index 00000000..9f8eaf67 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_active_lines.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_active_lines_el.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_active_lines_el.gif new file mode 100644 index 00000000..1bea40dc Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_active_lines_el.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_active_lines_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_active_lines_es.gif new file mode 100644 index 00000000..bdefd015 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_active_lines_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_active_lines_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_active_lines_ptbr.gif new file mode 100644 index 00000000..1465ea6e Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_active_lines_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_astguiclient.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_astguiclient.gif new file mode 100644 index 00000000..30373576 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_astguiclient.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_astguiclient_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_astguiclient_ptbr.gif new file mode 100644 index 00000000..30373576 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_astguiclient_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_conferences.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_conferences.gif new file mode 100644 index 00000000..e3c80662 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_conferences.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_conferences_el.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_conferences_el.gif new file mode 100644 index 00000000..91282b42 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_conferences_el.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_conferences_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_conferences_es.gif new file mode 100644 index 00000000..14ab7171 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_conferences_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_conferences_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_conferences_ptbr.gif new file mode 100644 index 00000000..14ab7171 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_conferences_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_main.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_main.gif new file mode 100644 index 00000000..6e687e44 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_main.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_main_el.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_main_el.gif new file mode 100644 index 00000000..4eaf0aa3 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_main_el.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_main_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_main_es.gif new file mode 100644 index 00000000..b5fc2a5e Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_main_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_main_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_main_ptbr.gif new file mode 100644 index 00000000..b5fc2a5e Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/agc_tab_main_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/blank.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/blank.gif new file mode 100644 index 00000000..3a469695 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/blank.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/br.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/br.gif new file mode 100644 index 00000000..423b8a0c Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/br.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/de.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/de.gif new file mode 100644 index 00000000..4dd34f6a Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/de.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/down.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/down.gif new file mode 100644 index 00000000..32d0a007 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/down.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/el.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/el.gif new file mode 100644 index 00000000..9e79d8bf Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/el.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/en.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/en.gif new file mode 100644 index 00000000..cb45f5f4 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/en.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/es.gif new file mode 100644 index 00000000..308ea3cb Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/fr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/fr.gif new file mode 100644 index 00000000..21fb3d19 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/fr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/it.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/it.gif new file mode 100644 index 00000000..6c7b1792 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/it.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/pl.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/pl.gif new file mode 100644 index 00000000..cde07905 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/pt.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/pt.gif new file mode 100644 index 00000000..646b76ac Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/pt.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/remove.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/remove.gif new file mode 100644 index 00000000..89b0521c Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/remove.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/up.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/up.gif new file mode 100644 index 00000000..0d55544f Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/up.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_dialnextnumber.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_dialnextnumber.gif new file mode 100644 index 00000000..a5a080d6 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_dialnextnumber.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_dialnextnumber_OFF.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_dialnextnumber_OFF.gif new file mode 100644 index 00000000..75bc0e8f Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_dialnextnumber_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_dialnextnumber_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_dialnextnumber_OFF_es.gif new file mode 100644 index 00000000..405ff336 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_dialnextnumber_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_dialnextnumber_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_dialnextnumber_OFF_ptbr.gif new file mode 100644 index 00000000..0d297820 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_dialnextnumber_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_dialnextnumber_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_dialnextnumber_es.gif new file mode 100644 index 00000000..ca92716e Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_dialnextnumber_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_dialnextnumber_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_dialnextnumber_ptbr.gif new file mode 100644 index 00000000..8625b1c9 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_dialnextnumber_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_grabparkedcall.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_grabparkedcall.gif new file mode 100644 index 00000000..a6779255 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_grabparkedcall.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_grabparkedcall_OFF.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_grabparkedcall_OFF.gif new file mode 100644 index 00000000..74b1f5a1 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_grabparkedcall_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_grabparkedcall_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_grabparkedcall_OFF_es.gif new file mode 100644 index 00000000..21991dd5 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_grabparkedcall_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_grabparkedcall_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_grabparkedcall_OFF_ptbr.gif new file mode 100644 index 00000000..19932ad2 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_grabparkedcall_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_grabparkedcall_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_grabparkedcall_es.gif new file mode 100644 index 00000000..9acc363a Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_grabparkedcall_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_grabparkedcall_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_grabparkedcall_ptbr.gif new file mode 100644 index 00000000..e37d0fb4 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_grabparkedcall_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_hangupcustomer.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_hangupcustomer.gif new file mode 100644 index 00000000..b4fdfae8 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_hangupcustomer.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_hangupcustomer_OFF.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_hangupcustomer_OFF.gif new file mode 100644 index 00000000..e5736ae0 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_hangupcustomer_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_hangupcustomer_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_hangupcustomer_OFF_es.gif new file mode 100644 index 00000000..570a6e5a Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_hangupcustomer_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_hangupcustomer_OFF_pl.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_hangupcustomer_OFF_pl.gif new file mode 100644 index 00000000..50407590 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_hangupcustomer_OFF_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_hangupcustomer_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_hangupcustomer_OFF_ptbr.gif new file mode 100644 index 00000000..57918268 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_hangupcustomer_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_hangupcustomer_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_hangupcustomer_es.gif new file mode 100644 index 00000000..94d3e225 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_hangupcustomer_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_hangupcustomer_pl.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_hangupcustomer_pl.gif new file mode 100644 index 00000000..e07bc496 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_hangupcustomer_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_hangupcustomer_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_hangupcustomer_ptbr.gif new file mode 100644 index 00000000..5841050c Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_hangupcustomer_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_parkcall.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_parkcall.gif new file mode 100644 index 00000000..88fee283 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_parkcall.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_parkcall_OFF.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_parkcall_OFF.gif new file mode 100644 index 00000000..8ad55010 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_parkcall_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_parkcall_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_parkcall_OFF_es.gif new file mode 100644 index 00000000..110ce6b0 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_parkcall_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_parkcall_OFF_pl.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_parkcall_OFF_pl.gif new file mode 100644 index 00000000..c188f0fa Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_parkcall_OFF_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_parkcall_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_parkcall_OFF_ptbr.gif new file mode 100644 index 00000000..25a6a2f2 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_parkcall_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_parkcall_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_parkcall_es.gif new file mode 100644 index 00000000..2274a27c Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_parkcall_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_parkcall_pl.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_parkcall_pl.gif new file mode 100644 index 00000000..fc0d97eb Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_parkcall_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_parkcall_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_parkcall_ptbr.gif new file mode 100644 index 00000000..b37d8358 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_parkcall_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_pause.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_pause.gif new file mode 100644 index 00000000..3486a1c1 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_pause.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_pause_OFF.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_pause_OFF.gif new file mode 100644 index 00000000..fce03041 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_pause_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_pause_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_pause_OFF_es.gif new file mode 100644 index 00000000..494d68a5 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_pause_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_pause_OFF_pl.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_pause_OFF_pl.gif new file mode 100644 index 00000000..8619e9dd Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_pause_OFF_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_pause_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_pause_OFF_ptbr.gif new file mode 100644 index 00000000..3d8c8759 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_pause_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_pause_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_pause_es.gif new file mode 100644 index 00000000..544a3797 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_pause_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_pause_pl.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_pause_pl.gif new file mode 100644 index 00000000..c0e2066e Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_pause_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_pause_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_pause_ptbr.gif new file mode 100644 index 00000000..bea56d65 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_pause_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_resume.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_resume.gif new file mode 100644 index 00000000..a7d75dd8 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_resume.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_resume_OFF.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_resume_OFF.gif new file mode 100644 index 00000000..0ae4cb9a Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_resume_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_resume_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_resume_OFF_es.gif new file mode 100644 index 00000000..921d5d5e Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_resume_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_resume_OFF_pl.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_resume_OFF_pl.gif new file mode 100644 index 00000000..3cb532bc Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_resume_OFF_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_resume_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_resume_OFF_ptbr.gif new file mode 100644 index 00000000..43bb9235 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_resume_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_resume_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_resume_es.gif new file mode 100644 index 00000000..1b096144 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_resume_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_resume_pl.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_resume_pl.gif new file mode 100644 index 00000000..ec2103e7 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_resume_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_resume_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_resume_ptbr.gif new file mode 100644 index 00000000..415b22d1 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_resume_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_senddtmf.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_senddtmf.gif new file mode 100644 index 00000000..d19888ad Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_senddtmf.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_senddtmf_OFF.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_senddtmf_OFF.gif new file mode 100644 index 00000000..08a4b392 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_senddtmf_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_senddtmf_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_senddtmf_OFF_es.gif new file mode 100644 index 00000000..2d32c5e9 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_senddtmf_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_senddtmf_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_senddtmf_OFF_ptbr.gif new file mode 100644 index 00000000..2d32c5e9 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_senddtmf_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_senddtmf_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_senddtmf_es.gif new file mode 100644 index 00000000..43964df4 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_senddtmf_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_senddtmf_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_senddtmf_ptbr.gif new file mode 100644 index 00000000..43964df4 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_senddtmf_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_spacer.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_spacer.gif new file mode 100644 index 00000000..d0a4f6ed Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_spacer.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_startrecording.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_startrecording.gif new file mode 100644 index 00000000..022103d2 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_startrecording.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_startrecording_OFF.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_startrecording_OFF.gif new file mode 100644 index 00000000..3ee4ca62 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_startrecording_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_startrecording_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_startrecording_OFF_es.gif new file mode 100644 index 00000000..ff9a3447 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_startrecording_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_startrecording_OFF_p.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_startrecording_OFF_p.gif new file mode 100644 index 00000000..91098453 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_startrecording_OFF_p.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_startrecording_OFF_pl.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_startrecording_OFF_pl.gif new file mode 100644 index 00000000..a8d5cbc3 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_startrecording_OFF_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_startrecording_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_startrecording_OFF_ptbr.gif new file mode 100644 index 00000000..22105778 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_startrecording_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_startrecording_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_startrecording_es.gif new file mode 100644 index 00000000..26420f78 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_startrecording_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_startrecording_pl.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_startrecording_pl.gif new file mode 100644 index 00000000..ef031de9 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_startrecording_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_startrecording_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_startrecording_ptbr.gif new file mode 100644 index 00000000..15b25990 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_startrecording_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_stoprecording.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_stoprecording.gif new file mode 100644 index 00000000..6f3bfede Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_stoprecording.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_stoprecording_OFF.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_stoprecording_OFF.gif new file mode 100644 index 00000000..2e1efe4a Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_stoprecording_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_stoprecording_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_stoprecording_OFF_es.gif new file mode 100644 index 00000000..2806311f Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_stoprecording_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_stoprecording_OFF_pl.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_stoprecording_OFF_pl.gif new file mode 100644 index 00000000..0cf042fc Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_stoprecording_OFF_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_stoprecording_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_stoprecording_OFF_ptbr.gif new file mode 100644 index 00000000..c0259410 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_stoprecording_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_stoprecording_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_stoprecording_es.gif new file mode 100644 index 00000000..94f9de9d Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_stoprecording_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_stoprecording_pl.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_stoprecording_pl.gif new file mode 100644 index 00000000..562822d9 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_stoprecording_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_stoprecording_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_stoprecording_ptbr.gif new file mode 100644 index 00000000..8a76e860 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_stoprecording_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_transferconf.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_transferconf.gif new file mode 100644 index 00000000..c5738519 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_transferconf.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_transferconf_OFF.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_transferconf_OFF.gif new file mode 100644 index 00000000..dd0a579a Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_transferconf_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_transferconf_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_transferconf_OFF_es.gif new file mode 100644 index 00000000..d0a54bf6 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_transferconf_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_transferconf_OFF_pl.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_transferconf_OFF_pl.gif new file mode 100644 index 00000000..9e3ea08e Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_transferconf_OFF_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_transferconf_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_transferconf_OFF_ptbr.gif new file mode 100644 index 00000000..ebb69344 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_transferconf_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_transferconf_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_transferconf_es.gif new file mode 100644 index 00000000..10cfa495 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_transferconf_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_transferconf_pl.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_transferconf_pl.gif new file mode 100644 index 00000000..e30680b0 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_transferconf_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_transferconf_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_transferconf_ptbr.gif new file mode 100644 index 00000000..f008e92c Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_transferconf_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_webform.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_webform.gif new file mode 100644 index 00000000..4d5228f3 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_webform.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_webform_OFF.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_webform_OFF.gif new file mode 100644 index 00000000..64316ced Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_webform_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_webform_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_webform_OFF_es.gif new file mode 100644 index 00000000..75a56196 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_webform_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_webform_OFF_pl.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_webform_OFF_pl.gif new file mode 100644 index 00000000..cfbd2d92 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_webform_OFF_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_webform_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_webform_OFF_ptbr.gif new file mode 100644 index 00000000..75a56196 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_webform_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_webform_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_webform_es.gif new file mode 100644 index 00000000..d7590d66 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_webform_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_webform_pl.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_webform_pl.gif new file mode 100644 index 00000000..f2275e8f Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_webform_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_webform_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_webform_ptbr.gif new file mode 100644 index 00000000..d7590d66 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_LB_webform_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_ammessage.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_ammessage.gif new file mode 100644 index 00000000..484d01eb Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_ammessage.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_ammessage_OFF.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_ammessage_OFF.gif new file mode 100644 index 00000000..3aa94800 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_ammessage_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_blindtransfer.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_blindtransfer.gif new file mode 100644 index 00000000..77c03e0b Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_blindtransfer.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_blindtransfer_OFF.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_blindtransfer_OFF.gif new file mode 100644 index 00000000..7fb481ee Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_blindtransfer_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_blindtransfer_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_blindtransfer_OFF_es.gif new file mode 100644 index 00000000..05adaac5 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_blindtransfer_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_blindtransfer_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_blindtransfer_OFF_ptbr.gif new file mode 100644 index 00000000..3a069c2b Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_blindtransfer_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_blindtransfer_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_blindtransfer_es.gif new file mode 100644 index 00000000..fdad633a Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_blindtransfer_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_blindtransfer_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_blindtransfer_ptbr.gif new file mode 100644 index 00000000..c31c87fc Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_blindtransfer_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_channel.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_channel.gif new file mode 100644 index 00000000..9a9ce7ba Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_channel.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_channel_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_channel_es.gif new file mode 100644 index 00000000..a4fbf1f5 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_channel_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_channel_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_channel_ptbr.gif new file mode 100644 index 00000000..a4fbf1f5 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_channel_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_code.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_code.gif new file mode 100644 index 00000000..8fb2b8c5 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_code.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_dialwithcustomer.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_dialwithcustomer.gif new file mode 100644 index 00000000..68697edc Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_dialwithcustomer.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_dialwithcustomer_OFF.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_dialwithcustomer_OFF.gif new file mode 100644 index 00000000..8bf2e44b Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_dialwithcustomer_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_dialwithcustomer_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_dialwithcustomer_OFF_es.gif new file mode 100644 index 00000000..7ef98a94 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_dialwithcustomer_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_dialwithcustomer_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_dialwithcustomer_OFF_ptbr.gif new file mode 100644 index 00000000..1ac7dbbb Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_dialwithcustomer_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_dialwithcustomer_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_dialwithcustomer_es.gif new file mode 100644 index 00000000..d71bca15 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_dialwithcustomer_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_dialwithcustomer_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_dialwithcustomer_ptbr.gif new file mode 100644 index 00000000..90ec03f8 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_dialwithcustomer_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupbothlines.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupbothlines.gif new file mode 100644 index 00000000..4e6db07e Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupbothlines.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupbothlines_OFF.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupbothlines_OFF.gif new file mode 100644 index 00000000..f1ffdc12 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupbothlines_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupbothlines_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupbothlines_OFF_es.gif new file mode 100644 index 00000000..8f12accd Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupbothlines_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupbothlines_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupbothlines_OFF_ptbr.gif new file mode 100644 index 00000000..47b87225 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupbothlines_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupbothlines_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupbothlines_es.gif new file mode 100644 index 00000000..646c8769 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupbothlines_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupbothlines_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupbothlines_ptbr.gif new file mode 100644 index 00000000..fa0cf2fb Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupbothlines_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupxferline.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupxferline.gif new file mode 100644 index 00000000..d25a105a Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupxferline.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupxferline_OFF.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupxferline_OFF.gif new file mode 100644 index 00000000..a8fb4a3d Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupxferline_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupxferline_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupxferline_OFF_es.gif new file mode 100644 index 00000000..3c717d09 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupxferline_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupxferline_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupxferline_OFF_ptbr.gif new file mode 100644 index 00000000..f6d9080b Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupxferline_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupxferline_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupxferline_es.gif new file mode 100644 index 00000000..0d92a89c Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupxferline_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupxferline_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupxferline_ptbr.gif new file mode 100644 index 00000000..c7d26417 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hangupxferline_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_header.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_header.gif new file mode 100644 index 00000000..c813b9a3 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_header.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_header_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_header_es.gif new file mode 100644 index 00000000..a92c2df0 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_header_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_header_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_header_ptbr.gif new file mode 100644 index 00000000..a92c2df0 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_header_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hotkeysactive.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hotkeysactive.gif new file mode 100644 index 00000000..8382205e Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hotkeysactive.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hotkeysactive_OFF.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hotkeysactive_OFF.gif new file mode 100644 index 00000000..3357ed2b Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hotkeysactive_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hotkeysactive_OFF_es-orig.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hotkeysactive_OFF_es-orig.gif new file mode 100644 index 00000000..638ef859 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hotkeysactive_OFF_es-orig.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hotkeysactive_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hotkeysactive_OFF_es.gif new file mode 100644 index 00000000..5c9a3122 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hotkeysactive_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hotkeysactive_OFF_pl.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hotkeysactive_OFF_pl.gif new file mode 100644 index 00000000..5414a7d8 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hotkeysactive_OFF_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hotkeysactive_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hotkeysactive_OFF_ptbr.gif new file mode 100644 index 00000000..335e6356 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hotkeysactive_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hotkeysactive_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hotkeysactive_es.gif new file mode 100644 index 00000000..b064725c Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hotkeysactive_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hotkeysactive_pl.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hotkeysactive_pl.gif new file mode 100644 index 00000000..365d8b2f Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hotkeysactive_pl.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hotkeysactive_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hotkeysactive_ptbr.gif new file mode 100644 index 00000000..a34409c2 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hotkeysactive_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hotkeysinactive_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hotkeysinactive_es.gif new file mode 100644 index 00000000..d0bf982c Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_hotkeysinactive_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_internalcloser.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_internalcloser.gif new file mode 100644 index 00000000..a1adca76 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_internalcloser.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_internalcloser_OFF.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_internalcloser_OFF.gif new file mode 100644 index 00000000..9d3489fa Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_internalcloser_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_internalcloser_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_internalcloser_OFF_es.gif new file mode 100644 index 00000000..45bc4290 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_internalcloser_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_internalcloser_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_internalcloser_OFF_ptbr.gif new file mode 100644 index 00000000..45bc4290 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_internalcloser_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_internalcloser_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_internalcloser_es.gif new file mode 100644 index 00000000..d5c05657 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_internalcloser_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_internalcloser_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_internalcloser_ptbr.gif new file mode 100644 index 00000000..d5c05657 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_internalcloser_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_leave3waycall.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_leave3waycall.gif new file mode 100644 index 00000000..7bca06f9 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_leave3waycall.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_leave3waycall_OFF.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_leave3waycall_OFF.gif new file mode 100644 index 00000000..63594d65 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_leave3waycall_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_leave3waycall_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_leave3waycall_OFF_es.gif new file mode 100644 index 00000000..9c41a291 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_leave3waycall_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_leave3waycall_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_leave3waycall_OFF_ptbr.gif new file mode 100644 index 00000000..63594d65 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_leave3waycall_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_leave3waycall_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_leave3waycall_es.gif new file mode 100644 index 00000000..9aa29708 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_leave3waycall_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_leave3waycall_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_leave3waycall_ptbr.gif new file mode 100644 index 00000000..7bca06f9 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_leave3waycall_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_localcloser.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_localcloser.gif new file mode 100644 index 00000000..0e10a2ad Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_localcloser.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_localcloser_OFF.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_localcloser_OFF.gif new file mode 100644 index 00000000..ed11b7ac Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_localcloser_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_localcloser_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_localcloser_OFF_es.gif new file mode 100644 index 00000000..fbad052d Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_localcloser_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_localcloser_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_localcloser_OFF_ptbr.gif new file mode 100644 index 00000000..fbad052d Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_localcloser_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_localcloser_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_localcloser_es.gif new file mode 100644 index 00000000..d36e1944 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_localcloser_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_localcloser_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_localcloser_ptbr.gif new file mode 100644 index 00000000..d36e1944 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_localcloser_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_number.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_number.gif new file mode 100644 index 00000000..33f30330 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_number.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_number_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_number_es.gif new file mode 100644 index 00000000..6d672acc Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_number_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_number_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_number_ptbr.gif new file mode 100644 index 00000000..22e82a58 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_number_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_parkcustomerdial.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_parkcustomerdial.gif new file mode 100644 index 00000000..195b1a90 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_parkcustomerdial.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_parkcustomerdial_OFF.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_parkcustomerdial_OFF.gif new file mode 100644 index 00000000..7c275732 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_parkcustomerdial_OFF.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_parkcustomerdial_OFF_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_parkcustomerdial_OFF_es.gif new file mode 100644 index 00000000..ef710c9c Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_parkcustomerdial_OFF_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_parkcustomerdial_OFF_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_parkcustomerdial_OFF_ptbr.gif new file mode 100644 index 00000000..72dee5c0 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_parkcustomerdial_OFF_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_parkcustomerdial_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_parkcustomerdial_es.gif new file mode 100644 index 00000000..accda01c Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_parkcustomerdial_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_parkcustomerdial_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_parkcustomerdial_ptbr.gif new file mode 100644 index 00000000..0101ea9e Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_parkcustomerdial_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_seconds.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_seconds.gif new file mode 100644 index 00000000..92fc7f2b Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_seconds.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_seconds_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_seconds_es.gif new file mode 100644 index 00000000..f4fe2b27 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_seconds_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_seconds_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_seconds_ptbr.gif new file mode 100644 index 00000000..f4fe2b27 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_XB_seconds_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_tab_script.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_tab_script.gif new file mode 100644 index 00000000..69e43b79 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_tab_script.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_tab_script_es.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_tab_script_es.gif new file mode 100644 index 00000000..ba4320d4 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_tab_script_es.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_tab_script_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_tab_script_ptbr.gif new file mode 100644 index 00000000..69e43b79 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_tab_script_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_tab_vicidial.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_tab_vicidial.gif new file mode 100644 index 00000000..1e862589 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_tab_vicidial.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_tab_vicidial_ptbr.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_tab_vicidial_ptbr.gif new file mode 100644 index 00000000..1e862589 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_tab_vicidial_ptbr.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_volume_MUTE.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_volume_MUTE.gif new file mode 100644 index 00000000..1008b7e3 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_volume_MUTE.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_volume_UNMUTE.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_volume_UNMUTE.gif new file mode 100644 index 00000000..b3937d13 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_volume_UNMUTE.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_volume_down.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_volume_down.gif new file mode 100644 index 00000000..d1745c65 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_volume_down.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_volume_down_off.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_volume_down_off.gif new file mode 100644 index 00000000..9bd1b04f Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_volume_down_off.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_volume_up.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_volume_up.gif new file mode 100644 index 00000000..8aa17f19 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_volume_up.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_volume_up_off.gif b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_volume_up_off.gif new file mode 100644 index 00000000..2e78579a Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/agc/images/vdc_volume_up_off.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/inbound_popup.php b/agc_2-X/branches/agc_2.0.4/www/agc/inbound_popup.php new file mode 100644 index 00000000..c92583de --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/agc/inbound_popup.php @@ -0,0 +1,351 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid 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 "Invalid 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 "\n"; +echo "\n"; +echo "\n"; +?> + + +LIVE INBOUND CALL"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "

LIVE INBOUND CALL

\n"; +echo "$NOW_TIME

\n"; +} + + + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($uniqueid)<9) + { + $channel_live=0; + echo "Uniqueid $uniqueid is not valid\n"; + exit; + } + else + { + $stmt="SELECT * FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $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";} + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Channel: $row[1]
CallerID: $row[3]
\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 "GOOGLE - \n"; + echo "ANYWHO - \n"; + echo "SWITCHBOARD - \n"; + echo "VERIZON - \n"; + echo "WHITEPAGES - \n"; + echo "411.COM - \n"; + echo "411.COM - \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_Channel=$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 "CUSTOM - \n"; + + echo "
Number Dialed: $row[8]
Notes: $row[9]|$row[10]|$row[11]|$row[12]|$row[13]|
\n"; + echo "HANGUP - \n"; + echo "SEND TO MY VOICEMAIL\n"; + echo "
\n"; + + + $stmt="UPDATE live_inbound set acknowledged='Y' where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + + } + + + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/live_exten_check.php b/agc_2-X/branches/agc_2.0.4/www/agc/live_exten_check.php new file mode 100644 index 00000000..3dadf572 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/agc/live_exten_check.php @@ -0,0 +1,278 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid 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 "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Live Extension Check"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + +echo "DateTime: $NOW_TIME|"; +echo "UnixTime: $StarTtime|"; + +$stmt="SELECT count(*) FROM parked_channels where server_ip = '$server_ip';"; + if ($format=='debug') {echo "\n";} +$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 not valid or protocol $protocol is not valid\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";} + $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";} + } + } + + $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";} + $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 "ChannelA: $ChanneLA[$counter] ~"; + echo "ChannelB: $ChanneLB[$counter] ~"; + echo "ChannelBtrunk: $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";} + $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 "ChannelA: $ChanneLA[$counter] ~"; + echo "ChannelB: $ChanneLB[$counter] ~"; + echo "ChannelBtrunk: $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";} + $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 "ChannelA: $ChanneLA[$counter] ~"; + echo "ChannelB: $ChanneLB[$counter] ~"; + echo "ChannelBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel LIKE \"$ChanneLB[$counter]%\";"; + if ($format=='debug') {echo "\n";} + $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 "ChannelA: $ChanneLA[$counter] ~"; + echo "ChannelB: $ChanneLB[$counter] ~"; + echo "ChannelBtrunk: $row[0]|"; + } + else + { + echo "Conversation: $counter ~"; + echo "ChannelA: $ChanneLA[$counter] ~"; + echo "ChannelB: $ChanneLB[$counter] ~"; + echo "ChannelBtrunk: $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";} +$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";} + } + +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";} + $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";} + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/manager_send.php b/agc_2-X/branches/agc_2.0.4/www/agc/manager_send.php new file mode 100644 index 00000000..94eff7b6 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/agc/manager_send.php @@ -0,0 +1,1142 @@ + LICENSE: GPLv2 +# +# This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk 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: +# - $ACTION - ('Originate','Redirect','Hangup','Command','Monitor','StopMonitor','SysCIDOriginate','RedirectName','RedirectNameVmail','MonitorConf','StopMonitorConf','RedirectXtra','RedirectXtraCX','RedirectVD','HangupConfDial','VolumeControl','OriginateVDRelogin') +# - $queryCID - ('CN012345678901234567',...) +# - $format - ('text','debug') +# - $channel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +# - $exten - ('1234','913125551212',...) +# - $ext_context - ('default','demo',...) +# - $ext_priority - ('1','2',...) +# - $filename - ('20050406-125623_44444',...) +# - $extenName - ('phone100',...) +# - $parkedby - ('phone100',...) +# - $extrachannel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +# - $auto_dial_level - ('0','1','1.1',...) +# - $campaign - ('CLOSER','TESTCAMP',...) +# - $uniqueid - ('1120232758.2406800',...) +# - $lead_id - ('1234',...) +# - $seconds - ('32',...) +# - $outbound_cid - ('3125551212','0000000000',...) +# - $agent_log_id - ('123456',...) +# - $call_server_ip - ('10.10.10.15',...) +# - $CalLCID - ('VD01234567890123456',...) +# - $stage - ('UP','DOWN') +# + +# CHANGELOG: +# 50401-1002 - First build of script, Hangup function only +# 50404-1045 - Redirect basic function enabled +# 50406-1522 - Monitor basic function enabled +# 50407-1647 - Monitor and StopMonitor full functions enabled +# 50422-1120 - basic Originate function enabled +# 50428-1451 - basic SysCIDOriginate function enabled for checking voicemail +# 50502-1539 - basic RedirectName and RedirectNameVmail added +# 50503-1227 - added session_name checking for extra security +# 50523-1341 - added Conference call start/stop recording +# 50523-1421 - added OriginateName and OriginateNameVmail for local calls +# 50524-1602 - added RedirectToPark and RedirectFromPark +# 50531-1203 - added RedirecXtra for dual channel redirection +# 50630-1100 - script changed to not use HTTP login vars, user/pass instead +# 50804-1148 - Added RedirectVD for VICIDIAL blind redirection with logging +# 50815-1204 - Added NEXTAVAILABLE to RedirectXtra function +# 50903-2343 - Added HangupConfDial function to hangup in-dial channels in conf +# 50913-1057 - Added outbound_cid set if present to originate call +# 51020-1556 - Added agent_log_id framework for detailed agent activity logging +# 51118-1204 - Fixed Blind transfer bug from VICIDIAL when in manual dial mode +# 51129-1014 - Added ability to accept calls from other VICIDIAL servers +# 51129-1253 - Fixed Hangups of other agents channels in VICIDIAL AD +# 60310-2022 - Fixed NEXTAVAILABLE bug in leave-3way-call redirect function +# 60421-1413 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1158 - Added variable filters to close security holes for login form +# 60809-1544 - Added direct transfers to leave-3ways in consultative transfers +# 61004-1526 - Added parsing of volume control command and lookup or number +# 61130-1617 - Added lead_id to MonitorConf for recording_log +# 61201-1115 - Added user to MonitorConf for recording_log +# 70111-1600 - added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70226-1251 - Added Mute/UnMute to conference volume control +# 70320-1502 - Added option to allow retry of leave-3way-call and debug logging +# 70322-1636 - Added sipsak display ability +# + +require("dbconnect.php"); + +### These are variable assignments for PHP globals off +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["ACTION"])) {$ACTION=$_GET["ACTION"];} + elseif (isset($_POST["ACTION"])) {$ACTION=$_POST["ACTION"];} +if (isset($_GET["queryCID"])) {$queryCID=$_GET["queryCID"];} + elseif (isset($_POST["queryCID"])) {$queryCID=$_POST["queryCID"];} +if (isset($_GET["format"])) {$format=$_GET["format"];} + elseif (isset($_POST["format"])) {$format=$_POST["format"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["exten"])) {$exten=$_GET["exten"];} + elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];} +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["filename"])) {$filename=$_GET["filename"];} + elseif (isset($_POST["filename"])) {$filename=$_POST["filename"];} +if (isset($_GET["extenName"])) {$extenName=$_GET["extenName"];} + elseif (isset($_POST["extenName"])) {$extenName=$_POST["extenName"];} +if (isset($_GET["parkedby"])) {$parkedby=$_GET["parkedby"];} + elseif (isset($_POST["parkedby"])) {$parkedby=$_POST["parkedby"];} +if (isset($_GET["extrachannel"])) {$extrachannel=$_GET["extrachannel"];} + elseif (isset($_POST["extrachannel"])) {$extrachannel=$_POST["extrachannel"];} +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["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} + elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["secondS"])) {$secondS=$_GET["secondS"];} + elseif (isset($_POST["secondS"])) {$secondS=$_POST["secondS"];} +if (isset($_GET["outbound_cid"])) {$outbound_cid=$_GET["outbound_cid"];} + elseif (isset($_POST["outbound_cid"])) {$outbound_cid=$_POST["outbound_cid"];} +if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];} + elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];} +if (isset($_GET["call_server_ip"])) {$call_server_ip=$_GET["call_server_ip"];} + elseif (isset($_POST["call_server_ip"])) {$call_server_ip=$_POST["call_server_ip"];} +if (isset($_GET["CalLCID"])) {$CalLCID=$_GET["CalLCID"];} + elseif (isset($_POST["CalLCID"])) {$CalLCID=$_POST["CalLCID"];} +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["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} +if (isset($_GET["phone_ip"])) {$phone_ip=$_GET["phone_ip"];} + elseif (isset($_POST["phone_ip"])) {$phone_ip=$_POST["phone_ip"];} +if (isset($_GET["enable_sipsak_messages"])) {$enable_sipsak_messages=$_GET["enable_sipsak_messages"];} + elseif (isset($_POST["enable_sipsak_messages"])) {$enable_sipsak_messages=$_POST["enable_sipsak_messages"];} +if (isset($_GET["allow_sipsak_messages"])) {$allow_sipsak_messages=$_GET["allow_sipsak_messages"];} + elseif (isset($_POST["allow_sipsak_messages"])) {$allow_sipsak_messages=$_POST["allow_sipsak_messages"];} + +$user=ereg_replace("[^0-9a-zA-Z]","",$user); +$pass=ereg_replace("[^0-9a-zA-Z]","",$pass); +$secondS = ereg_replace("[^0-9]","",$secondS); + +# default optional vars if not set +if (!isset($ACTION)) {$ACTION="Originate";} +if (!isset($format)) {$format="alert";} +if (!isset($ext_priority)) {$ext_priority="1";} + +$version = '2.0.29'; +$build = '70320-1502'; +$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 "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid 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 "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Manager Send: "; +if ($ACTION=="Originate") {echo "Originate";} +if ($ACTION=="Redirect") {echo "Redirect";} +if ($ACTION=="RedirectName") {echo "RedirectName";} +if ($ACTION=="Hangup") {echo "Hangup";} +if ($ACTION=="Command") {echo "Command";} +if ($ACTION==99999) {echo "HELP";} +echo "\n"; +echo "\n"; +echo "\n"; +} + + + + + +###################### +# ACTION=SysCIDOriginate - insert Originate Manager statement allowing small CIDs for system calls +###################### +if ($ACTION=="SysCIDOriginate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<1) ) + { + echo "Exten $exten is not valid or queryCID $queryCID is not valid, Originate command not inserted\n"; + } + else + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate command sent for Exten $exten Channel $channel on $server_ip\n"; + } +} + + + +###################### +# ACTION=Originate, OriginateName, OriginateNameVmail - insert Originate Manager statement +###################### +if ($ACTION=="OriginateName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "extenName $extenName must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nOriginateName Action not sent\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="OriginateNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "extenName $extenName must be set\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nOriginateNameVmail Action not sent\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Originate"; + } + } +} + +if ($ACTION=="OriginateVDRelogin") +{ + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $CIDdate = date("ymdHis"); + $DS='-'; + $SIPSAK_prefix = 'LIN-'; + print "\n"; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$campaign\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + $queryCID = "$SIPSAK_prefix$campaign$DS$CIDdate"; + + } + $ACTION="Originate"; +} + +if ($ACTION=="Originate") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<10) ) + { + echo "Exten $exten is not valid or queryCID $queryCID is not valid, Originate command not inserted\n"; + } + else + { + if (strlen($outbound_cid)>1) + {$outCID = "\"$queryCID\" <$outbound_cid>";} + else + {$outCID = "$queryCID";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Originate command sent for Exten $exten Channel $channel on $server_ip\n"; + } +} + + + +###################### +# ACTION=HangupConfDial - find the Local channel that is in the conference and needs to be hung up +###################### +if ($ACTION=="HangupConfDial") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($queryCID)<15) or (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "conference $exten is not valid or ext_context $ext_context or queryCID $queryCID is not valid, Hangup command not inserted\n"; + } + else + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $hangup_channel_prefix = "$local_DEF$exten$local_AMP$ext_context"; + + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row > 0) + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $channel=$rowx[0]; + $ACTION="Hangup"; + $queryCID = eregi_replace("^.","G",$queryCID); + } + } +} + + + +###################### +# ACTION=Hangup - insert Hangup Manager statement +###################### +if ($ACTION=="Hangup") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) ) + { + $channel_live=0; + echo "Channel $channel is not valid or queryCID $queryCID is not valid, Hangup command not inserted\n"; + } + else + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + +# $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# if ($row[0]==0) +# { +# $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $rowx=mysql_fetch_row($rslt); +# if ($rowx[0]==0) +# { +# $channel_live=0; +# echo "Channel $channel is not live on $call_server_ip, Hangup command not inserted\n"; +# } +# } + if ( ($auto_dial_level > 0) and (strlen($CalLCID)>2) and (strlen($exten)>2) and ($secondS > 4)) + { + $stmt="SELECT count(*) FROM vicidial_auto_calls where channel='$channel' and callerid='$CalLCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + echo "Call $CalLCID $channel is not live on $call_server_ip, Checking Live Channel...\n"; + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel' and extension LIKE \"%$exten\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $channel_live=0; + echo "Channel $channel is not live on $call_server_ip, Hangup command not inserted $rowx[0]\n$stmt\n"; + } + else + { + echo "$stmt\n"; + } + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Hangup','$queryCID','Channel: $channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Hangup command sent for Channel $channel on $call_server_ip\n"; + } + } +} + + + +###################### +# ACTION=Redirect, RedirectName, RedirectNameVmail, RedirectToPark, RedirectFromPark, RedirectVD, RedirectXtra, RedirectXtraCX +# - insert Redirect Manager statement using extensions name +###################### +if ($ACTION=="RedirectVD") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($campaign)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($uniqueid)<2) or (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "auto_dial_level $auto_dial_level must be set\n"; + echo "campaign $campaign must be set\n"; + echo "uniqueid $uniqueid must be set\n"; + echo "lead_id $lead_id must be set\n"; + echo "\nRedirectVD Action not sent\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($auto_dial_level < 1) + { + $stmt = "UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectToPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($parkedby)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "extenName $extenName must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "parkedby $parkedby must be set\n"; + echo "\nRedirectToPark Action not sent\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "INSERT INTO parked_channels values('$channel','$server_ip','','$extenName','$parkedby','$NOW_TIME');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectFromPark") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirectFromPark Action not sent\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "DELETE FROM parked_channels where server_ip='$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $ACTION="Redirect"; + } +} + +if ($ACTION=="RedirectName") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "extenName $extenName must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirectName Action not sent\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectNameVmail") +{ + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "extenName $extenName must be set\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirectNameVmail Action not sent\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Redirect"; + } + } +} + +if ($ACTION=="RedirectXtraCX") +{ + $DBout=''; + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "ExtraChannel $extrachannel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirect Action not sent\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDCXC|$filename|$user|$campaign|$channel|$extrachannel|$queryCID|$exten|$ext_context|ext_priority|\n"); + fclose($fp); + } + } + } + else + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Channel $channel is not live on $call_server_ip, Redirect command not inserted\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel is not live on $call_server_ip";} + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Channel $channel is not live on $server_ip, Redirect command not inserted\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel is not live on $server_ip";} + } + } + if ( ($channel_liveX==1) && ($channel_liveY==1) ) + { + $stmt="SELECT count(*) FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0] < 1) + { + $channel_liveY=0; + echo "No Local agent to send call to, Redirect command not inserted\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "No Local agent to send call to";} + } + else + { + $stmt="SELECT server_ip,conf_exten,user FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $dest_server_ip = $rowx[0]; + $dest_session_id = $rowx[1]; + $dest_user = $rowx[2]; + $S='*'; + + $D_s_ip = explode('.', $dest_server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$dest_session_id$S$lead_id$S$dest_user$S$phone_code$S$phone_number$S$campaign$S"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','$queryCID','Channel: $extrachannel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtraCX command sent for Channel $channel on $call_server_ip and \nHungup $extrachannel on $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel on $call_server_ip, Hungup $extrachannel on $server_ip";} + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "Changed to Redirect: $channel on $server_ip";} + } + + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDCXC|$filename|$user|$campaign|$DBout|\n"); + fclose($fp); + } + } + + } +} + +if ($ACTION=="RedirectXtra") +{ + if ($channel=="$extrachannel") + {$ACTION="Redirect";} + else + { + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "ExtraChannel $extrachannel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirect Action not sent\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDX|$filename|$user|$campaign|$$channel|$extrachannel|$queryCID|$exten|$ext_context|ext_priority|\n"); + fclose($fp); + } + } + } + else + { + if ($exten == "NEXTAVAILABLE") + { + $stmt="SELECT conf_exten FROM conferences where server_ip='$server_ip' and ((extension='') or (extension is null)) limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if (strlen($row[0]) > 3) + { + $stmt="UPDATE conferences set extension='$user' where server_ip='$server_ip' and conf_exten='$row[0]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $exten = $row[0]; + } + else + { + $channel_liveX=0; + echo "Cannot find empty conference on $server_ip, Redirect command not inserted\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "Cannot find empty conference on $server_ip";} + } + } + + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Channel $channel is not live on $call_server_ip, Redirect command not inserted\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel is not live on $call_server_ip";} + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Channel $channel is not live on $server_ip, Redirect command not inserted\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel is not live on $server_ip";} + } + } + if ( ($channel_liveX==1) && ($channel_liveY==1) ) + { + if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','ExtraChannel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra command sent for Channel $channel and \nExtraChannel $extrachannel\n to $exten on $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel and $extrachannel to $exten on $server_ip";} + } + else + { + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$exten"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra command sent for Channel $channel on $call_server_ip and \nExtraChannel $extrachannel\n to $exten on $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel/$call_server_ip and $extrachannel/$server_ip to $exten";} + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + + } + + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDX|$filename|$user|$campaign|$DBout|\n"); + fclose($fp); + } + } + + } + } +} + + +if ($ACTION=="Redirect") +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "\nRedirect Action not sent\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Channel $channel is not live on $server_ip, Redirect command not inserted\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "Redirect command sent for Channel $channel on $server_ip\n"; + } + } +} + + + +###################### +# ACTION=Monitor or Stop Monitor - insert Monitor/StopMonitor Manager statement to start recording on a channel +###################### +if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) +{ + if ($ACTION=="StopMonitor") + {$SQLfile = "";} + else + {$SQLfile = "File: $filename";} + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Channel $channel is not valid or queryCID $queryCID is not valid or filename: $filename is not valid, $ACTION command not inserted\n"; + } + else + { + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Channel $channel is not live on $server_ip, $ACTION command not inserted\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','$ACTION','$queryCID','Channel: $channel','$SQLfile','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + if ($ACTION=="Monitor") + { + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + } + echo "$ACTION command sent for Channel $channel on $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n"; + } + } +} + + + + + + +###################### +# ACTION=MonitorConf or StopMonitorConf - insert Monitor/StopMonitor Manager statement to start recording on a conference +###################### +if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($channel)<4) or (strlen($filename)<15) ) + { + $channel_live=0; + echo "Channel $channel is not valid or exten $exten is not valid or filename: $filename is not valid, $ACTION command not inserted\n"; + } + else + { + + if ($ACTION=="MonitorConf") + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$filename','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $filename','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + # find and hang up all recordings going on in this conference # and extension = '$exten' + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$channel%\" and channel LIKE \"%,1\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + # $rec_count = intval(mysql_num_rows($rslt) / 2); + $rec_count = mysql_num_rows($rslt); + $h=0; + while ($rec_count>$h) + { + $rowx=mysql_fetch_row($rslt); + $HUchannel[$h] = $rowx[0]; + $h++; + } + $i=0; + while ($h>$i) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$i','Channel: $HUchannel[$i]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $i++; + } + + } + echo "$ACTION command sent for Channel $channel on $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n RECORDING WILL LAST UP TO 60 MINUTES\n"; + } +} + + + + + +###################### +# ACTION=VolumeControl - raise or lower the volume of a meetme participant +###################### +if ($ACTION=="VolumeControl") +{ + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($stage)<1) or (strlen($queryCID)<1) ) + { + echo "Conference $exten, Stage $stage is not valid or queryCID $queryCID is not valid, Originate command not inserted\n"; + } + else + { + $participant_number='XXYYXXYYXXYYXX'; + if (eregi('UP',$stage)) {$vol_prefix='4';} + if (eregi('DOWN',$stage)) {$vol_prefix='3';} + if (eregi('UNMUTE',$stage)) {$vol_prefix='2';} + if (eregi('MUTING',$stage)) {$vol_prefix='1';} + $local_DEF = 'Local/'; + $local_AMP = '@'; + $volume_local_channel = "$local_DEF$participant_number$vol_prefix$exten$local_AMP$ext_context"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $volume_local_channel','Context: $ext_context','Exten: 8300','Priority: 1','Callerid: $queryCID','','','','$channel','$exten');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Volume command sent for Conference $exten, Stage $stage Channel $channel on $server_ip\n"; + } +} + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='debug') {echo "\n";} +if ($format=='debug') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/park_calls_display.php b/agc_2-X/branches/agc_2.0.4/www/agc/park_calls_display.php new file mode 100644 index 00000000..872f5780 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/agc/park_calls_display.php @@ -0,0 +1,146 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) { + echo "Invalid server_ip: |$server_ip| or Invalid 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 "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Parked Calls Display"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten is not valid or protocol $protocol is not valid\n"; + exit; + } + else + { + ##### print parked calls from the parked_channels table + $stmt="SELECT * from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;"; + if ($format=='debug') {echo "\n";} + $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"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/vdc_db_query.php b/agc_2-X/branches/agc_2.0.4/www/agc/vdc_db_query.php new file mode 100644 index 00000000..9c15f395 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/agc/vdc_db_query.php @@ -0,0 +1,2535 @@ + LICENSE: GPLv2 +# +# 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 - ('regCLOSER','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCALL','manDiaLlogCALL','userLOGout','updateDISPO','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs','CalLBacKLisT','CalLBacKCounT','PauseCodeSubmit','LogiNCamPaigns') +# - $stage - ('start','finish','lookup','new') +# - $closer_choice - ('CL_TESTCAMP_L CL_OUT123_L -') +# - $conf_exten - ('8600011',...) +# - $exten - ('123test',...) +# - $ext_context - ('default','demo',...) +# - $ext_priority - ('1','2',...) +# - $campaign - ('testcamp',...) +# - $dial_timeout - ('60','26',...) +# - $dial_prefix - ('9','8',...) +# - $campaign_cid - ('3125551212','0000000000',...) +# - $MDnextCID - ('M06301413000000002',...) +# - $uniqueid - ('1120232758.2406800',...) +# - $lead_id - ('36524',...) +# - $list_id - ('101','123456',...) +# - $length_in_sec - ('12',...) +# - $phone_code - ('1',...) +# - $phone_number - ('3125551212',...) +# - $channel - ('Zap/12-1',...) +# - $start_epoch - ('1120236911',...) +# - $vendor_lead_code - ('1234test',...) +# - $title - ('Mr.',...) +# - $first_name - ('Bob',...) +# - $middle_initial - ('L',...) +# - $last_name - ('Wilson',...) +# - $address1 - ('1324 Main St.',...) +# - $address2 - ('Apt. 12',...) +# - $address3 - ('co Robert Wilson',...) +# - $city - ('Chicago',...) +# - $state - ('IL',...) +# - $province - ('NA',...) +# - $postal_code - ('60054',...) +# - $country_code - ('USA',...) +# - $gender - ('M',...) +# - $date_of_birth - ('1970-01-01',...) +# - $alt_phone - ('3125551213',...) +# - $email - ('bob@bob.com',...) +# - $security_phrase - ('Hello',...) +# - $comments - ('Good Customer',...) +# - $auto_dial_level - ('0','1','1.2',...) +# - $VDstop_rec_after_each_call - ('0','1') +# - $conf_silent_prefix - ('7','8','',...) +# - $extension - ('123','user123','25-1',...) +# - $protocol - ('Zap','SIP','IAX2',...) +# - $user_abb - ('1234','6666',...) +# - $preview - ('YES','NO',...) +# - $called_count - ('0','1','2',...) +# - $agent_log_id - ('123456',...) +# - $agent_log - ('NO',...) +# - $favorites_list - (",'cc160','cc100'",...) +# - $CallBackDatETimE - ('2006-04-21 14:30:00',...) +# - $recipient - ('ANYONE,'USERONLY') +# - $callback_id - ('12345','12346',...) +# - $use_internal_dnc - ('Y','N') +# - $omit_phone_code - ('Y','N') +# - $no_delete_sessions - ('0','1') + +# CHANGELOG: +# 50629-1044 - First build of script +# 50630-1422 - Added manual dial action and MD channel lookup +# 50701-1451 - Added dial log for start and end of vicidial calls +# 50705-1239 - Added call disposition update +# 50804-1627 - Fixed updateDispo to update vicidial_log entry +# 50816-1605 - Added VDADpause/ready for auto dialing +# 50816-1811 - Added basic autodial call pickup functions +# 50817-1005 - Altered logging functions to accomodate auto_dialing +# 50818-1305 - Added stop-all-recordings-after-each-vicidial-call option +# 50818-1411 - Added hangup of agent phone after Logout +# 50901-1315 - Fixed CLOSER IN-GROUP Web Form bug +# 50902-1507 - Fixed CLOSER log length_in_sec bug +# 50902-1730 - Added functions for manual preview dialing and revert +# 50913-1214 - Added agent random update to leadupdate +# 51020-1421 - Added agent_log_id framework for detailed agent activity logging +# 51021-1717 - Allows for multi-line comments (changes \n to !N in database) +# 51111-1046 - Added vicidial_agent_log lead_id earlier for manual dial +# 51121-1445 - Altered echo statements for several small PHP speed optimizations +# 51122-1328 - Fixed UserLogout issue not removing conference reservation +# 51129-1012 - Added ability to accept calls from other VICIDIAL servers +# 51129-1729 - Changed manual dial to use the '/n' flag for calls +# 51221-1154 - Added SCRIPT id lookup and sending to vicidial.php for display +# 60105-1059 - Added Updating of astguiclient favorites in the DB +# 60208-1617 - Added dtmf buttons output per call +# 60213-1521 - Added closer_campaigns update to vicidial_users +# 60215-1036 - Added Callback date-time entry into vicidial_callbacks table +# 60413-1541 - Added USERONLY Callback listings output - CalLBacKLisT +# - Added USERONLY Callback count output - CalLBacKCounT +# 60414-1140 - Added Callback lead lookup for manual dialing +# 60419-1517 - After CALLBK is sent to agent, update callback record to INACTIVE +# 60421-1419 - Check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60427-1236 - Fixed closer_choice error for CLOSER campaigns +# 60609-1148 - Added ability to check for manual dial numbers in DNC +# 60619-1117 - Added variable filters to close security holes for login form +# 60623-1414 - Fixed variable filter for phone_code and fixed manual dial logic +# 60821-1600 - Added ability to omit the phone code on vicidial lead dialing +# 60821-1647 - Added ability to not delete sessions at logout +# 60906-1124 - Added lookup and sending of callback data for CALLBK calls +# 61128-2229 - Added vicidial_live_agents and vicidial_auto_calls manual dial entries +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70115-1733 - Added alt_dial functionality in auto-dial modes +# 70118-1501 - Added user_group to vicidial_log,_agent_log,_closer_log,_callbacks +# 70123-1357 - Fixed bug that would not update vicidial_closer_log status to dispo +# 70202-1438 - Added pause code submit function +# 70203-0930 - Added dialed_number to lead info output +# 70203-1030 - Added dialed_label to lead info output +# 70206-1126 - Added INBOUND status for inbound/closer calls in vicidial_live_agents +# 70212-1253 - Fixed small issue with CXFER +# 70213-1431 - Added QueueMetrics PAUSE/UNPAUSE/AGENTLOGIN/AGENTLOGOFF actions +# 70214-1231 - Added queuemetrics_log_id field for server_id in queue_log +# 70215-1210 - Added queuemetrics COMPLETEAGENT action +# 70216-1051 - Fixed double call complete queuemetrics logging +# 70222-1616 - Changed queue_log PAUSE/UNPAUSE to PAUSEALL/UNPAUSEALL +# 70309-1034 - Allow amphersands and questions marks in comments to pass through +# 70313-1052 - Allow pound signs(hash) in comments to pass through +# 70319-1544 - Added agent disable update customer data function +# 70322-1545 - Added sipsak display ability +# 70413-1253 - Fixed bug for outbound call time in CLOSER-type blended campaigns +# 70424-1100 - Fixed bug for fronter/closer calls that would delete vdac records +# 70802-1729 - Fixed bugs with pause_sec and wait_sec under certain call handling +# 70828-1443 - Added source_id to output of SCRIPTtab-IFRAME and WEBFORM +# 71029-1855 - removed campaign_id naming restrictions for CLOSER-type campaigns +# 71030-2047 - added hopper priority for auto alt dial entries +# 71116-1011 - added calls_today count updating of the vicidial_live_agents upon INCALL +# 71120-1520 - added LogiNCamPaigns to show only allowed campaigns for agents upon login +# 71125-1751 - Added inbound-group default inbound group sending to vicidial.php +# 71129-2025 - restricted callbacks count and list to campaign only +# + +$version = '2.0.4-65'; +$build = '71129-2025'; + +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["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["closer_choice"])) {$closer_choice=$_GET["closer_choice"];} + elseif (isset($_POST["closer_choice"])) {$closer_choice=$_POST["closer_choice"];} +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["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["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["dial_timeout"])) {$dial_timeout=$_GET["dial_timeout"];} + elseif (isset($_POST["dial_timeout"])) {$dial_timeout=$_POST["dial_timeout"];} +if (isset($_GET["dial_prefix"])) {$dial_prefix=$_GET["dial_prefix"];} + elseif (isset($_POST["dial_prefix"])) {$dial_prefix=$_POST["dial_prefix"];} +if (isset($_GET["campaign_cid"])) {$campaign_cid=$_GET["campaign_cid"];} + elseif (isset($_POST["campaign_cid"])) {$campaign_cid=$_POST["campaign_cid"];} +if (isset($_GET["MDnextCID"])) {$MDnextCID=$_GET["MDnextCID"];} + elseif (isset($_POST["MDnextCID"])) {$MDnextCID=$_POST["MDnextCID"];} +if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} + elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["length_in_sec"])) {$length_in_sec=$_GET["length_in_sec"];} + elseif (isset($_POST["length_in_sec"])) {$length_in_sec=$_POST["length_in_sec"];} +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["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["start_epoch"])) {$start_epoch=$_GET["start_epoch"];} + elseif (isset($_POST["start_epoch"])) {$start_epoch=$_POST["start_epoch"];} +if (isset($_GET["dispo_choice"])) {$dispo_choice=$_GET["dispo_choice"];} + elseif (isset($_POST["dispo_choice"])) {$dispo_choice=$_POST["dispo_choice"];} +if (isset($_GET["vendor_lead_code"])) {$vendor_lead_code=$_GET["vendor_lead_code"];} + elseif (isset($_POST["vendor_lead_code"])) {$vendor_lead_code=$_POST["vendor_lead_code"];} +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["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["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_GET["VDstop_rec_after_each_call"];} + elseif (isset($_POST["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_POST["VDstop_rec_after_each_call"];} +if (isset($_GET["conf_silent_prefix"])) {$conf_silent_prefix=$_GET["conf_silent_prefix"];} + elseif (isset($_POST["conf_silent_prefix"])) {$conf_silent_prefix=$_POST["conf_silent_prefix"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} +if (isset($_GET["user_abb"])) {$user_abb=$_GET["user_abb"];} + elseif (isset($_POST["user_abb"])) {$user_abb=$_POST["user_abb"];} +if (isset($_GET["preview"])) {$preview=$_GET["preview"];} + elseif (isset($_POST["preview"])) {$preview=$_POST["preview"];} +if (isset($_GET["called_count"])) {$called_count=$_GET["called_count"];} + elseif (isset($_POST["called_count"])) {$called_count=$_POST["called_count"];} +if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];} + elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];} +if (isset($_GET["agent_log"])) {$agent_log=$_GET["agent_log"];} + elseif (isset($_POST["agent_log"])) {$agent_log=$_POST["agent_log"];} +if (isset($_GET["favorites_list"])) {$favorites_list=$_GET["favorites_list"];} + elseif (isset($_POST["favorites_list"])) {$favorites_list=$_POST["favorites_list"];} +if (isset($_GET["CallBackDatETimE"])) {$CallBackDatETimE=$_GET["CallBackDatETimE"];} + elseif (isset($_POST["CallBackDatETimE"])) {$CallBackDatETimE=$_POST["CallBackDatETimE"];} +if (isset($_GET["recipient"])) {$recipient=$_GET["recipient"];} + elseif (isset($_POST["recipient"])) {$recipient=$_POST["recipient"];} +if (isset($_GET["callback_id"])) {$callback_id=$_GET["callback_id"];} + elseif (isset($_POST["callback_id"])) {$callback_id=$_POST["callback_id"];} +if (isset($_GET["use_internal_dnc"])) {$use_internal_dnc=$_GET["use_internal_dnc"];} + elseif (isset($_POST["use_internal_dnc"])) {$use_internal_dnc=$_POST["use_internal_dnc"];} +if (isset($_GET["omit_phone_code"])) {$omit_phone_code=$_GET["omit_phone_code"];} + elseif (isset($_POST["omit_phone_code"])) {$omit_phone_code=$_POST["omit_phone_code"];} +if (isset($_GET["phone_ip"])) {$phone_ip=$_GET["phone_ip"];} + elseif (isset($_POST["phone_ip"])) {$phone_ip=$_POST["phone_ip"];} +if (isset($_GET["enable_sipsak_messages"])) {$enable_sipsak_messages=$_GET["enable_sipsak_messages"];} + elseif (isset($_POST["enable_sipsak_messages"])) {$enable_sipsak_messages=$_POST["enable_sipsak_messages"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} + + +$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); + + +# default optional vars if not set +if (!isset($format)) {$format="text";} + if ($format == 'debug') {$DB=1;} +if (!isset($ACTION)) {$ACTION="refresh";} + +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$CIDdate = date("mdHis"); +$ENTRYdate = date("YmdHis"); +if (!isset($query_date)) {$query_date = $NOW_DATE;} +$MT[0]=''; +$agents='@agents'; + +if ($ACTION == 'LogiNCamPaigns') + { + $skip_user_validation=1; + } +else + { + $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 "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid 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 "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } +} + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDiaL Database Query Script"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + +################################################################################ +### LogiNCamPaigns - generates an HTML SELECT list of allowed campaigns for a +### specific agent on the login screen +################################################################################ +if ($ACTION == 'LogiNCamPaigns') +{ + if ( (strlen($user)<1) ) + { + echo "\n"; + exit; + } + else + { + echo "\n"; + exit; + } +} + + + +################################################################################ +### regCLOSER - update the vicidial_live_agents table to reflect the closer +### inbound choices made upon login +################################################################################ +if ($ACTION == 'regCLOSER') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($closer_choice)<1) || (strlen($user)<1) ) + { + $channel_live=0; + echo "Group Choice $closer_choice is not valid\n"; + exit; + } + else + { + if ($closer_choice == "MGRLOCK-") + { + $stmt="SELECT closer_campaigns FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $closer_choice =$row[0]; + + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_users set closer_campaigns='$closer_choice' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $in_groups_pre = preg_replace('/-$/','',$closer_choice); + $in_groups = explode(" ",$in_groups_pre); + $in_groups_ct = count($in_groups); + $k=1; + while ($k < $in_groups_ct) + { + if (strlen($in_groups[$k])>1) + { + $stmt="SELECT group_weight,calls_today FROM vicidial_inbound_group_agents where user='$user' and group_id='$in_groups[$k]';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $viga_ct = mysql_num_rows($rslt); + if ($viga_ct > 0) + { + $row=mysql_fetch_row($rslt); + $group_weight = $row[0]; + $calls_today = $row[1]; + } + else + { + $group_weight = 0; + $calls_today = 0; + } + $stmt="INSERT INTO vicidial_live_inbound_agents set user='$user',group_id='$in_groups[$k]',group_weight='$group_weight',calls_today='$calls_today',last_call_time='$NOW_TIME',last_call_finish='$NOW_TIME';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + $k++; + } + + } + echo "Closer In Group Choice $closer_choice has been registered to user $user\n"; +} + + +################################################################################ +### manDiaLnextCALL - for manual VICIDiaL dialing this will grab the next lead +### in the campaign, reserve it, send data back to client and +### place the call by inserting into vicidial_manager +################################################################################ +if ($ACTION == 'manDiaLnextCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "HOPPER EMPTY\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context is not valid\n"; + exit; + } + else + { + + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### check if this is a callback, if it is, skip the grabbing of a new lead and mark the callback as INACTIVE + if ( (strlen($callback_id)>0) and (strlen($lead_id)>0) ) + { + $affected_rows=1; + $CBleadIDset=1; + + $stmt = "UPDATE vicidial_callbacks set status='INACTIVE' where callback_id='$callback_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + if (strlen($phone_number)>3) + { + if ($use_internal_dnc=='Y') + { + $stmt="SELECT count(*) FROM vicidial_dnc where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + echo "DNC NUMBER\n"; + exit; + } + } + if ($stage=='lookup') + { + $stmt="SELECT lead_id FROM vicidial_list where phone_number='$phone_number' order by modify_date desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $man_leadID_ct = mysql_num_rows($rslt); + if ($man_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $affected_rows=1; + $lead_id =$row[0]; + $CBleadIDset=1; + } + else + { + ### insert a new lead in the system with this phone number + $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $lead_id = mysql_insert_id($link); + $CBleadIDset=1; + } + } + else + { + ### insert a new lead in the system with this phone number + $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $lead_id = mysql_insert_id($link); + $CBleadIDset=1; + } + } + else + { + ### grab the next lead in the hopper for this campaign and reserve it for the user + $stmt = "UPDATE vicidial_hopper set status='QUEUE', user='$user' where campaign_id='$campaign' and status='READY' order by hopper_id LIMIT 1"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + } + } + + if ($affected_rows > 0) + { + if (!$CBleadIDset) + { + ##### grab the lead_id of the reserved user in vicidial_hopper + $stmt="SELECT lead_id FROM vicidial_hopper where campaign_id='$campaign' and status='QUEUE' and user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $hopper_leadID_ct = mysql_num_rows($rslt); + if ($hopper_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + } + } + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $source_id = trim("$row[6]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + $called_count++; + + ##### check if system is set to generate logfile for transfers + $stmt="SELECT enable_agc_xfer_log FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enable_agc_xfer_log_ct = mysql_num_rows($rslt); + if ($enable_agc_xfer_log_ct > 0) + { + $row=mysql_fetch_row($rslt); + $enable_agc_xfer_log =$row[0]; + } + + if ( ($WeBRooTWritablE > 0) and ($enable_agc_xfer_log > 0) ) + { + # DATETIME|campaign|lead_id|phone_number|user|type + # 2007-08-22 11:11:11|TESTCAMP|65432|3125551212|1234|M + $fp = fopen ("./xfer_log.txt", "a"); + fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$phone_number|$user|M\n"); + fclose($fp); + } + + ##### if lead is a callback, grab the callback comments + $CBentry_time = ''; + $CBcallback_time = ''; + $CBuser = ''; + $CBcomments = ''; + if (ereg("CALLBK",$dispo)) + { + $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBentry_time = trim("$row[0]"); + $CBcallback_time = trim("$row[1]"); + $CBuser = trim("$row[2]"); + $CBcomments = trim("$row[3]"); + } + } + + ### flag the lead as called and change it's status to INCALL + $stmt = "UPDATE vicidial_list set status='INCALL', called_since_last_reset='Y', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + if (!$CBleadIDset) + { + ### delete the lead from the hopper + $stmt = "DELETE FROM vicidial_hopper where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $stmt="UPDATE vicidial_agent_log set lead_id='$lead_id',comments='MANUAL' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + ### if preview dialing, do not send the call + if ( (strlen($preview)<1) || ($preview == 'NO') ) + { + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### whether to omit phone_code or not + if (eregi('Y',$omit_phone_code)) + {$Ndialstring = "$Local_out_prefix$phone_number";} + else + {$Ndialstring = "$Local_out_prefix$phone_code$phone_number";} + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$server_ip','$campaign','XFER','$lead_id','$MqueryCID','$phone_code','$phone_number','$NOW_TIME','OUT')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',callerid='$MqueryCID',lead_id='$lead_id',comments='MANUAL',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update calls_today count in vicidial_campaign_agents + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $MqueryCID . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + $LeaD_InfO .= $CBentry_time . "\n"; + $LeaD_InfO .= $CBcallback_time . "\n"; + $LeaD_InfO .= $CBuser . "\n"; + $LeaD_InfO .= $CBcomments . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= "MAIN\n"; + $LeaD_InfO .= $source_id . "\n"; + + echo $LeaD_InfO; + + } + else + { + echo "HOPPER EMPTY\n"; + } + } +} + + +################################################################################ +### manDiaLskip - for manual VICIDiaL dialing this skips the lead that was +### previewed in the step above and puts it back in orig status +################################################################################ +if ($ACTION == 'manDiaLskip') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($stage)<1) || (strlen($called_count)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "LEAD NOT REVERTED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context is not valid\n"; + exit; + } + else + { + $called_count = ($called_count - 1); + ### flag the lead as called and change it's status to INCALL + $stmt = "UPDATE vicidial_list set status='$stage', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + + echo "LEAD REVERTED\n"; + } +} + + +################################################################################ +### manDiaLonly - for manual VICIDiaL dialing this sends the call that was +### previewed in the step above +################################################################################ +if ($ACTION == 'manDiaLonly') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) || (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo " CALL NOT PLACED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context is not valid\n"; + exit; + } + else + { + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + + $PADlead_id = sprintf("%09s", $lead_id); + while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} + else {$CIDstring = "$MqueryCID";} + + ### whether to omit phone_code or not + if (eregi('Y',$omit_phone_code)) + {$Ndialstring = "$Local_out_prefix$phone_number";} + else + {$Ndialstring = "$Local_out_prefix$phone_code$phone_number";} + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$server_ip','$campaign','XFER','$lead_id','$MqueryCID','$phone_code','$phone_number','$NOW_TIME','OUT')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',callerid='$MqueryCID',lead_id='$lead_id',comments='MANUAL',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + echo "$MqueryCID\n"; + } +} + + +################################################################################ +### manDiaLlookCALL - for manual VICIDiaL dialing this will attempt to look up +### the trunk channel that the call was placed on +################################################################################ +if ($ACTION == 'manDiaLlookCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; +if (strlen($MDnextCID)<18) + { + echo "NO\n"; + echo "MDnextCID $MDnextCID is not valid\n"; + exit; + } +else + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT uniqueid,channel FROM vicidial_manager where callerid='$MDnextCID' and server_ip='$server_ip' and status='UPDATED' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $uniqueid =$row[0]; + $channel =$row[1]; + echo "$uniqueid\n$channel"; + + $wait_sec=0; + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',wait_epoch='$StarTtime',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + echo "NO\n"; + } + } +} + + + +################################################################################ +### manDiaLlogCALL - for manual VICIDiaL logging of calls places record in +### vicidial_log and then sends process to call_log entry +################################################################################ +if ($ACTION == 'manDiaLlogCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + +if ($stage == "start") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) || (strlen($list_id)<1) || (strlen($phone_number)<1) || (strlen($campaign)<1) ) + { + echo "LOG NOT ENTERED\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id or list_id: $list_id or phone_number: $phone_number or campaign: $campaign is not valid\n"; + exit; + } + else + { + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + ##### insert log into vicidial_log for manual VICIDiaL call + $stmt="INSERT INTO vicidial_log (uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,comments,processed,user_group) values('$uniqueid','$lead_id','$list_id','$campaign','$NOW_TIME','$StarTtime','INCALL','$phone_code','$phone_number','$user','MANUAL','N','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "VICIDiaL_LOG Inserted: $uniqueid|$channel|$NOW_TIME\n"; + echo "$StarTtime\n"; + } + else + { + echo "LOG NOT ENTERED\n"; + } + + $stmt = "UPDATE vicidial_auto_calls SET uniqueid='$uniqueid' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + # ##### insert log into call_log for manual VICIDiaL call + # $stmt = "INSERT INTO call_log (uniqueid,channel,server_ip,extension,number_dialed,caller_code,start_time,start_epoch) values('$uniqueid','$channel','$server_ip','$exten','$phone_code$phone_number','MD $user $lead_id','$NOW_TIME','$StarTtime')"; + # if ($DB) {echo "$stmt\n";} + # $rslt=mysql_query($stmt, $link); + # $affected_rows = mysql_affected_rows($link); + + # if ($affected_rows > 0) + # { + # echo "CALL_LOG Inserted: $uniqueid|$channel|$NOW_TIME"; + # } + # else + # { + # echo "LOG NOT ENTERED\n"; + # } + } + } + +if ($stage == "end") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) ) + { + echo "LOG NOT ENTERED\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id is not valid\n"; + exit; + } + else + { + if ($start_epoch < 1000) + { + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + ##### look for the start epoch in the vicidial_closer_log table + $stmt="SELECT start_epoch FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user' order by closecallid desc limit 1;"; + } + else + { + ##### look for the start epoch in the vicidial_log table + $stmt="SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + } + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch =$row[0]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($length_in_sec < 1) and ($row[0] > 0) ) + { + ##### start epoch in the vicidial_log table, couldn't find one in vicidial_closer_log + $stmt="SELECT start_epoch FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch =$row[0]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + } + } + else {$length_in_sec = ($StarTtime - $start_epoch);} + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' where lead_id='$lead_id' order by start_epoch desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + + if ($auto_dial_level > 0) + { + ### check to see if campaign has alt_dial enabled + $stmt="SELECT auto_alt_dial FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_alt_dial =$row[0]; + } + else {$auto_alt_dial = 'NONE';} + if (eregi("(ALT_ONLY|ADDR3_ONLY|ALT_AND_ADDR3)",$auto_alt_dial)) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT alt_dial FROM vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alt_dial =$row[0]; + } + else {$alt_dial = 'NONE';} + + if ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("(ALT_ONLY|ALT_AND_ADDR3)",$auto_alt_dial)) ) + { + $stmt="SELECT alt_phone,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alt_phone = $row[0]; + $alt_phone = eregi_replace("[^0-9]","",$alt_phone); + $gmt_offset_now = $row[1]; + $state = $row[2]; + } + else {$alt_phone = '';} + if (strlen($alt_phone)>5) + { + ### insert record into vicidial_hopper for alt_phone call attempt + $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ALT',user='',priority='25';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + } + if ( ( (eregi("(ALT)",$alt_dial)) and (eregi("ALT_AND_ADDR3",$auto_alt_dial)) ) or ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("ADDR3_ONLY",$auto_alt_dial)) ) ) + { + $stmt="SELECT address3,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $address3 = $row[0]; + $address3 = eregi_replace("[^0-9]","",$address3); + $gmt_offset_now = $row[1]; + $state = $row[2]; + } + else {$address3 = '';} + if (strlen($address3)>5) + { + ### insert record into vicidial_hopper for address3 call attempt + $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ADDR3',user='',priority='20';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + + if ($enable_queuemetrics_logging > 0) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_qm_ct = mysql_num_rows($rslt); + if ($VAC_qm_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_call_id = $row[0]; + $CLlead_id = $row[1]; + $CLphone_number = $row[2]; + $CLstatus = $row[3]; + $CLcampaign_id = $row[4]; + $CLphone_code = $row[5]; + $CLalt_dial = $row[6]; + $CLstage = $row[7]; + $CLcallerid = $row[8]; + $CLuniqueid = $row[9]; + } + + $CLstage = preg_replace("/.*-/",'',$CLstage); + if (strlen($CLstage) < 1) {$CLstage=0;} + + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt="SELECT count(*) from queue_log where call_id='$MDnextCID' and verb='COMPLETECALLER';"; + $rslt=mysql_query($stmt, $linkB); + if ($DB) {echo "$stmt\n";} + $VAC_cc_ct = mysql_num_rows($rslt); + if ($VAC_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $caller_complete = $row[0]; + } + + if ($caller_complete < 1) + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + } + mysql_close($linkB); + } + + ### delete call record from vicidial_auto_calls + $stmt = "DELETE from vicidial_auto_calls where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + + + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',lead_id='',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } + else + { + if ($enable_queuemetrics_logging > 0) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VAC_qm_ct = mysql_num_rows($rslt); + if ($VAC_qm_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_call_id = $row[0]; + $CLlead_id = $row[1]; + $CLphone_number = $row[2]; + $CLstatus = $row[3]; + $CLcampaign_id = $row[4]; + $CLphone_code = $row[5]; + $CLalt_dial = $row[6]; + $CLstage = $row[7]; + $CLcallerid = $row[8]; + $CLuniqueid = $row[9]; + } + + $CLstage = preg_replace("/XFER|-/",'',$CLstage); + if ($CLstage < 0.25) {$CLstage=0;} + + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + + $stmt = "DELETE from vicidial_auto_calls lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',lead_id='',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } + + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' where uniqueid='$uniqueid' and lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "$uniqueid\n$channel\n"; + } + else + { + echo "LOG NOT ENTERED\n\n"; + } + } + + echo $VDstop_rec_after_each_call . '|' . $extension . '|' . $conf_silent_prefix . '|' . $conf_exten . '|' . $user_abb . "|\n"; + + ##### if VICIDiaL call and hangup_after_each_call activated, find all recording + ##### channels and hang them up while entering info into recording_log and + ##### returning filename/recordingID + if ($VDstop_rec_after_each_call == 1) + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $total_rec=0; + $loop_count=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten' order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$rec_list = mysql_num_rows($rslt);} + while ($rec_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + if (preg_match("/Local\/$conf_silent_prefix$conf_exten\@/i",$row[0])) + { + $rec_channels[$total_rec] = "$row[0]"; + $total_rec++; + } + if ($format=='debug') {echo "\n";} + $loop_count++; + } + + $total_recFN=0; + $loop_count=0; + $filename=$MT; # not necessary : and cmd_line_f LIKE \"%_$user_abb\" + $stmt="SELECT cmd_line_f FROM vicidial_manager where server_ip='$server_ip' and action='Originate' and cmd_line_b = 'Channel: $local_DEF$conf_silent_prefix$conf_exten$local_AMP$ext_context' order by entry_date desc limit $total_rec;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$recFN_list = mysql_num_rows($rslt);} + while ($recFN_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + $filename[$total_recFN] = preg_replace("/Callerid: /i","",$row[0]); + if ($format=='debug') {echo "\n";} + $total_recFN++; + $loop_count++; + } + + $loop_count=0; + while($loop_count < $total_rec) + { + if (strlen($rec_channels[$loop_count])>5) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$loop_count','Channel: $rec_channels[$loop_count]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "REC_STOP|$rec_channels[$loop_count]|$filename[$loop_count]|"; + if (strlen($filename)>2) + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename[$loop_count]'"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$fn_count = mysql_num_rows($rslt);} + if ($fn_count) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt="UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename[$loop_count]' and end_epoch is NULL;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "$recording_id|$length_in_min|"; + } + else {echo "||";} + } + else {echo "||";} + echo "\n"; + } + $loop_count++; + } + } + + + $talk_sec=0; + $StarTtime = date("U"); + $stmt = "select talk_epoch,talk_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $talk_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set talk_sec='$talk_sec',talk_epoch='$StarTtime',dispo_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } +} + + +################################################################################ +### VDADREcheckINCOMING - for auto-dial VICIDiaL dialing this will recheck for +### calls to see if the channel has updated +################################################################################ +if ($ACTION == 'VDADREcheckINCOMING') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "Campaign $campaign is not valid\n"; + echo "lead_id $lead_id is not valid\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + } + } +} + + +################################################################################ +### VDADcheckINCOMING - for auto-dial VICIDiaL dialing this will check for calls +### in the vicidial_live_agents table in QUEUE status, then +### lookup the lead info and pass it back to vicidial.php +################################################################################ +if ($ACTION == 'VDADcheckINCOMING') +{ + $Ctype = 'A'; + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "Campaign $campaign is not valid\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and status='QUEUE';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',comments='AUTO',calls_today='$calls_today' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $source_id = trim("$row[6]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = trim("$row[29]"); + $called_count = trim("$row[30]"); + } + + ##### if lead is a callback, grab the callback comments + $CBentry_time = ''; + $CBcallback_time = ''; + $CBuser = ''; + $CBcomments = ''; + if (ereg("CALLBK",$dispo)) + { + $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBentry_time = trim("$row[0]"); + $CBcallback_time = trim("$row[1]"); + $CBuser = trim("$row[2]"); + $CBcomments = trim("$row[3]"); + } + } + + ### update the lead status to INCALL + $stmt = "UPDATE vicidial_list set status='INCALL', user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + ### update the log status to INCALL + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + $stmt = "UPDATE vicidial_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL', user_group='$user_group' where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + ### update the vicidial_closer_log user to INCALL + $stmt = "UPDATE vicidial_closer_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL', user_group='$user_group' where lead_id='$lead_id' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select campaign_id,phone_number,alt_dial from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($VDAC_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDADchannel_group =$row[0]; + $dialed_number =$row[1]; + $dialed_label =$row[2]; + } + else + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|INBND|$callerid|$user|$user_group|$list_id|$lead_id|$phone_number|$uniqueid|\n"); + fclose($fp); + } + } + + $stmt = "select count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDL_cid_ct = mysql_num_rows($rslt); + if ($VDL_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_front_VDlog =$row[0]; + } + + $stmt = "select * from vicidial_inbound_groups where group_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_group_name = $row[1]; + $VDCL_group_color = $row[2]; + $VDCL_group_web = $row[4]; + $VDCL_fronter_display = $row[7]; + $VDCL_ingroup_script = $row[8]; + $VDCL_get_call_launch = $row[9]; + $VDCL_xferconf_a_dtmf = $row[10]; + $VDCL_xferconf_a_number = $row[11]; + $VDCL_xferconf_b_dtmf = $row[12]; + $VDCL_xferconf_b_number = $row[13]; + $VDCL_default_xfer_group= $row[28]; + + ### update the comments in vicidial_live_agents record + $stmt = "UPDATE vicidial_live_agents set comments='INBOUND' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + $Ctype = 'I'; + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_ingroup_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + } + + ### if web form is set then send on to vicidial.php for override of WEB_FORM address + if ( (strlen($VDCL_group_web)>5) or (strlen($VDCL_group_name)>0) ) {echo "$VDCL_group_web|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|\n";} + else {echo "|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|\n";} + + $stmt = "SELECT full_name from vicidial_users where user='$tsr';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDU_cid_ct = mysql_num_rows($rslt); + if ($VDU_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $fronter_full_name = $row[0]; + echo $fronter_full_name . '|' . $tsr . "\n"; + } + else {echo '|' . $tsr . "\n";} + } + else + { + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_campaign_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + } + echo "|||||$VDCL_campaign_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|\n|\n"; + + $stmt = "select phone_number,alt_dial from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($VDAC_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dialed_number =$row[0]; + $dialed_label =$row[1]; + } + } + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $callerid . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + $LeaD_InfO .= $CBentry_time . "\n"; + $LeaD_InfO .= $CBcallback_time . "\n"; + $LeaD_InfO .= $CBuser . "\n"; + $LeaD_InfO .= $CBcomments . "\n"; + $LeaD_InfO .= $dialed_number . "\n"; + $LeaD_InfO .= $dialed_label . "\n"; + $LeaD_InfO .= $source_id . "\n"; + + echo $LeaD_InfO; + + + + $wait_sec=0; + $StarTtime = date("U"); + $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + ### If CALLBK, change vicidial_callback record to INACTIVE + if (eregi("CALLBK|CBHOLD", $dispo)) + { + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='$lead_id' and status NOT IN('INACTIVE','DEAD','ARCHIVE');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + ##### check if system is set to generate logfile for transfers + $stmt="SELECT enable_agc_xfer_log FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $enable_agc_xfer_log_ct = mysql_num_rows($rslt); + if ($enable_agc_xfer_log_ct > 0) + { + $row=mysql_fetch_row($rslt); + $enable_agc_xfer_log =$row[0]; + } + + if ( ($WeBRooTWritablE > 0) and ($enable_agc_xfer_log > 0) ) + { + # DATETIME|campaign|lead_id|phone_number|user|type + # 2007-08-22 11:11:11|TESTCAMP|65432|3125551212|1234|A + $fp = fopen ("./xfer_log.txt", "a"); + fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$phone_number|$user|$Ctype\n"); + fclose($fp); + } + + } + else + { + echo "0\n"; + # echo "No calls in QUEUE for $user on $server_ip\n"; + exit; + } + } +} + + +################################################################################ +### userLOGout - Logs the user out of VICIDiaL client, deleting db records and +### inserting into vicidial_user_log +################################################################################ +if ($ACTION == 'userLOGout') +{ + $MT[0]=''; + $row=''; $rowx=''; +if ( (strlen($campaign)<1) || (strlen($conf_exten)<1) ) + { + echo "NO\n"; + echo "campaign $campaign or conf_exten $conf_exten is not valid\n"; + exit; + } +else + { + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + ##### Insert a LOGOUT record into the user log + $stmt="INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$user','LOGOUT','$campaign','$NOW_TIME','$StarTtime','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vul_insert = mysql_affected_rows($link); + + if ($no_delete_sessions < 1) + { + ##### Remove the reservation on the vicidial_conferences meetme room + $stmt="UPDATE vicidial_conferences set extension='' where server_ip='$server_ip' and conf_exten='$conf_exten';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vc_remove = mysql_affected_rows($link); + } + + ##### Delete the vicidial_live_agents record for this session + $stmt="DELETE from vicidial_live_agents where server_ip='$server_ip' and user ='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vla_delete = mysql_affected_rows($link); + + ##### Delete the vicidial_live_inbound_agents records for this session + $stmt="DELETE from vicidial_live_inbound_agents where user ='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vlia_delete = mysql_affected_rows($link); + + ##### Delete the web_client_sessions + $stmt="DELETE from web_client_sessions where server_ip='$server_ip' and session_name ='$session_name';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $wcs_delete = mysql_affected_rows($link); + + ##### Hangup the client phone + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$extension%\" order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) + { + $row=mysql_fetch_row($rslt); + $agent_channel = "$row[0]"; + if ($format=='debug') {echo "\n";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','ULGH3459$StarTtime','Channel: $agent_channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $pause_sec=0; + $stmt = "select pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ( ($VDpr_ct > 0) and (strlen($row[3]<5)) and (strlen($row[4]<5)) ) + { + $row=mysql_fetch_row($rslt); + $pause_sec = (($StarTtime - $row[0]) + $row[1]); + + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + if ($vla_delete > 0) + { + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $allow_sipsak_messages = $row[6]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_message = 'LOGGED OUT'; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_message\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + } + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + # $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='PAUSE',serverid='1';"; + # if ($DB) {echo "$stmt\n";} + # if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + # $rslt=mysql_query($stmt, $linkB); + # $affected_rows = mysql_affected_rows($linkB); + + $stmt = "SELECT time_id FROM queue_log where agent='Agent/$user' and verb='AGENTLOGIN' order by time_id desc limit 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + if ($DB) {echo "$stmt\n";} + echo "$stmt\n"; + $li_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $li_conf_ct) + { + $row=mysql_fetch_row($rslt); + $logintime = $row[0]; + $i++; + } + + $time_logged_in = ($StarTtime - $logintime); + if ($time_logged_in > 1000000) {$time_logged_in=1;} + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='AGENTLOGOFF',data1='$user$agents',data2='$time_logged_in',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + + echo "$vul_insert|$vc_remove|$vla_delete|$wcs_delete|$agent_channel|$vlia_delete\n"; + } +} + + +################################################################################ +### updateDISPO - update the vicidial_list table to reflect the agent choice of +### call disposition for that leand +################################################################################ +if ($ACTION == 'updateDISPO') +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($dispo_choice)<1) || (strlen($lead_id)<1) ) + { + echo "Dispo Choice $dispo or lead_id $lead_id is not valid\n"; + exit; + } + else + { + $stmt="UPDATE vicidial_list set status='$dispo_choice', user='$user' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by uniqueid desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_closer_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + if ( ($use_internal_dnc=='Y') and ($dispo_choice=='DNC') ) + { + $stmt = "select phone_number from vicidial_list where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $stmt="INSERT INTO vicidial_dnc (phone_number) values('$row[0]');"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + } + } + + $dispo_sec=0; + $StarTtime = date("U"); + $stmt = "select dispo_epoch,dispo_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dispo_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set dispo_sec='$dispo_sec',dispo_epoch='$StarTtime',status='$dispo_choice' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id($link); + + ### CALLBACK ENTRY + if ( ($dispo_choice == 'CBHOLD') and (strlen($CallBackDatETimE)>10) ) + { + $stmt="INSERT INTO vicidial_callbacks (lead_id,list_id,campaign_id,status,entry_time,callback_time,user,recipient,comments,user_group) values('$lead_id','$list_id','$campaign','ACTIVE','$NOW_TIME','$CallBackDatETimE','$user','$recipient','$comments','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + $stmt="SELECT auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ( ($auto_dial_level > 0) and (ereg(" $dispo_choice ",$row[0])) ) + { + $stmt = "select count(*) from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + $stmt="UPDATE vicidial_hopper set status='READY' where lead_id='$lead_id' and status='HOLD' limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + else + { + $stmt="DELETE from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='CALLSTATUS',data1='$dispo_choice',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + + echo 'Lead ' . $lead_id . ' has been changed to ' . $dispo_choice . " Status\nNext agent_log_id:\n" . $agent_log_id . "\n"; +} + +################################################################################ +### updateLEAD - update the vicidial_list table to reflect the values that are +### in the agents screen at time of call hangup +################################################################################ +if ($ACTION == 'updateLEAD') +{ + $MT[0]=''; + $row=''; $rowx=''; + $DO_NOT_UPDATE=0; + $DO_NOT_UPDATE_text=''; + if ( (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + echo "phone_number $phone_number or lead_id $lead_id is not valid\n"; + exit; + } + else + { + + $stmt = "SELECT disable_alter_custdata FROM vicidial_campaigns where campaign_id='$campaign'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $dac_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $dac_conf_ct) + { + $row=mysql_fetch_row($rslt); + $disable_alter_custdata = $row[0]; + $i++; + } + if (ereg('Y',$disable_alter_custdata)) + { + $DO_NOT_UPDATE=1; + $DO_NOT_UPDATE_text=' NOT'; + $stmt = "SELECT alter_custdata_override FROM vicidial_users where user='$user'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $aco_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $aco_conf_ct) + { + $row=mysql_fetch_row($rslt); + $alter_custdata_override = $row[0]; + $i++; + } + if (ereg('ALLOW_ALTER',$alter_custdata_override)) + { + $DO_NOT_UPDATE=0; + $DO_NOT_UPDATE_text=''; + } + } + + if ($DO_NOT_UPDATE < 1) + { + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + $comments = eregi_replace("--AMP--",'&',$comments); + $comments = eregi_replace("--QUES--",'?',$comments); + $comments = eregi_replace("--POUND--",'#',$comments); + + $stmt="UPDATE vicidial_list set vendor_lead_code='" . mysql_real_escape_string($vendor_lead_code) . "', title='" . mysql_real_escape_string($title) . "', first_name='" . mysql_real_escape_string($first_name) . "', middle_initial='" . mysql_real_escape_string($middle_initial) . "', last_name='" . mysql_real_escape_string($last_name) . "', address1='" . mysql_real_escape_string($address1) . "', address2='" . mysql_real_escape_string($address2) . "', address3='" . mysql_real_escape_string($address3) . "', city='" . mysql_real_escape_string($city) . "', state='" . mysql_real_escape_string($state) . "', province='" . mysql_real_escape_string($province) . "', postal_code='" . mysql_real_escape_string($postal_code) . "', country_code='" . mysql_real_escape_string($country_code) . "', gender='" . mysql_real_escape_string($gender) . "', date_of_birth='" . mysql_real_escape_string($date_of_birth) . "', alt_phone='" . mysql_real_escape_string($alt_phone) . "', email='" . mysql_real_escape_string($email) . "', security_phrase='" . mysql_real_escape_string($security_phrase) . "', comments='" . mysql_real_escape_string($comments) . "' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + } + echo "Lead $lead_id information has$DO_NOT_UPDATE_text been updated\n"; +} + + +################################################################################ +### VDADpause - update the vicidial_live_agents table to show that the agent is +### or ready now active and ready to take calls +################################################################################ +if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) +{ + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($stage)<2) || (strlen($server_ip)<1) ) + { + echo "stage $stage is not valid\n"; + exit; + } + else + { + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set lead_id='',uniqueid=0,callerid='',channel='', random_id='$random',comments='' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_live_agents set status='$stage' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + if (ereg('READY',$stage)) {$QMstatus='UNPAUSEALL';} + if (ereg('PAUSE',$stage)) {$QMstatus='PAUSEALL';} + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='$QMstatus',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + + if ($agent_log == 'NO') + {$donothing=1;} + else + { + $pause_sec=0; + $stmt = "select pause_epoch,pause_sec,wait_epoch,wait_sec,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec=0; + if ($row[2] > 0) + { + $wait_sec = (($StarTtime - $row[2]) + $row[3]); + } + if ( (eregi("NULL",$row[4])) or ($row[4] < 1000) ) + {$pause_sec = (($StarTtime - $row[0]) + $row[1]);} + else + {$pause_sec = (($row[4] - $row[0]) + $row[1]);} + + } + if ($ACTION == 'VDADready') + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + if ($ACTION == 'VDADpause') + { + $stmt="UPDATE vicidial_agent_log set pause_epoch='$StarTtime',wait_sec='$wait_sec' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + echo 'Agent ' . $user . ' is now in status ' . $stage . "\n"; +} + + +################################################################################ +### UpdatEFavoritEs - update the astguiclient favorites list for this extension +################################################################################ +if ($ACTION == 'UpdatEFavoritEs') +{ + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($favorites_list)<1) || (strlen($user)<1) || (strlen($exten)<1) ) + { + echo "favorites list $favorites_list is not valid\n"; + exit; + } + else + { + $stmt = "select count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + $stmt="UPDATE phone_favorites set extensions_list=\"$favorites_list\" where extension='$exten' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="INSERT INTO phone_favorites values('$exten','$server_ip',\"$favorites_list\");"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + echo "Favorites list has been updated to $favorites_list for $exten\n"; +} + + +################################################################################ +### PauseCodeSubmit - Update vicidial_agent_log with pause code +################################################################################ +if ($ACTION == 'PauseCodeSubmit') +{ + $row=''; $rowx=''; + if ( (strlen($status)<1) || (strlen($agent_log_id)<1) ) + { + echo "agent_log_id $agent_log_id or pause_code $status is not valid\n"; + exit; + } + else + { + $stmt="UPDATE vicidial_agent_log set sub_status=\"$status\" where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $allow_sipsak_messages = $row[6]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_prefix = 'BK-'; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$status\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + } + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='PAUSEREASON',serverid='$queuemetrics_log_id',data1='$status';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } +echo "Pause Code has been updated to $status for $agent_log_id\n"; +} + + +################################################################################ +### CalLBacKLisT - List the USERONLY callbacks for an agent +################################################################################ +if ($ACTION == 'CalLBacKLisT') +{ +$stmt = "select callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' and campaign_id='$campaign' and status NOT IN('INACTIVE','DEAD') order by callback_time;"; +if ($DB) {echo "$stmt\n";} +$rslt=mysql_query($stmt, $link); +if ($rslt) {$callbacks_count = mysql_num_rows($rslt);} +echo "$callbacks_count\n"; +$loop_count=0; + while ($callbacks_count>$loop_count) + { + $row=mysql_fetch_row($rslt); + $callback_id[$loop_count] = $row[0]; + $lead_id[$loop_count] = $row[1]; + $campaign_id[$loop_count] = $row[2]; + $status[$loop_count] = $row[3]; + $entry_time[$loop_count] = $row[4]; + $callback_time[$loop_count] = $row[5]; + $comments[$loop_count] = $row[6]; + $loop_count++; + } +$loop_count=0; + while ($callbacks_count>$loop_count) + { + $stmt = "select first_name,last_name,phone_number from vicidial_list where lead_id='$lead_id[$loop_count]';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count]\n"; + $loop_count++; + } + +} + + +################################################################################ +### CalLBacKCounT - send the count of the USERONLY callbacks for an agent +################################################################################ +if ($ACTION == 'CalLBacKCounT') +{ +$stmt = "select count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' and campaign_id='$campaign' and status NOT IN('INACTIVE','DEAD');"; +if ($DB) {echo "$stmt\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$cbcount=$row[0]; + +echo "$cbcount"; +} + + + + +if ($format=='debug') +{ +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +echo "\n"; +echo "\n\n\n"; +} + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/vicidial.php b/agc_2-X/branches/agc_2.0.4/www/agc/vicidial.php new file mode 100644 index 00000000..8558b0d1 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/agc/vicidial.php @@ -0,0 +1,6814 @@ + LICENSE: GPLv2 +# +# make sure you have added a user to the vicidial_users MySQL table with at least +# user_level 1 or greater to access this page. Also, you need to have the login +# and pass of a phone listed in the asterisk.phones table. The page grabs the +# server info and other details from this login and pass. +# +# This script works best with Firefox or Mozilla, but will run for a couple +# hours on Internet Explorer before the memory leaks cause a crash. +# +# Other scripts that this application depends on: +# - vdc_db_query.php: Updates information in the database +# - manager_send.php: Sends manager actions to the DB for execution +# +# CHANGELOG +# 50607-1426 - First Build of VICIDIAL web client basic login process finished +# 50628-1620 - Added some basic formatting and worked on process flow +# 50628-1715 - Startup variables mapped to javascript variables +# 50629-1303 - Added Login Closer in-groups selection box and vla update +# 50629-1530 - Rough layout for customer info form section and button links +# 50630-1453 - Rough Manual Dial/Hangup with customer info displayed +# 50701-1450 - Added vicidial_log entries on dial and hangup +# 50701-1634 - Added Logout function +# 50705-1259 - Added call disposition functionality +# 50705-1432 - Added lead info DB update function +# 50705-1658 - Added web form functionality +# 50706-1043 - Added call park and pickup functions +# 50706-1234 - Added Start/Stop Recording functionality +# 50706-1614 - Added conference channels display option +# 50711-1333 - Removed call check redundancy and fixed a span bug +# 50727-1424 - Added customer channel and participant present sensing/alerts +# 50804-1057 - Added SendDTMF function and reconfigured the transfer span +# 50804-1224 - Added Local and Internal Closer transfer functions +# 50804-1628 - Added Blind transfer, activated LIVE CALL image and fixed bugs +# 50804-1808 - Added button images for left buttons +# 50815-1151 - Added 3Way calling functions to Transfer-conf frame +# 50815-1602 - Added images and buttons for xfer functions +# 50816-1813 - Added basic autodial outbound call pickup functions +# 50817-1113 - Fixes to auto_dialing call receipt +# 50817-1234 - Added inbound call receipt capability +# 50817-1541 - Added customer time display +# 50817-1541 - Added customer time display +# 50818-1327 - Added stop-all-recordings-after-each-vicidial-call option +# 50818-1703 - Added pretty login section +# 50825-1200 - Modified form field lengths, added double-click dispositions +# 50831-1603 - Fixed customer time bug and fronter display bug for CLOSER +# 50901-1314 - Fixed CLOSER IN-GROUP Web Form bug +# 50903-0904 - Added preview-lead code for manual dialing +# 50904-0016 - Added ability to hangup manual dials before pickup +# 50906-1319 - Added override for filters on xfer calls, fixed login display bug +# 50909-1243 - Added hotkeys functionality for quick dispoing in auto-dial mode +# 50912-0958 - Modified hotkeys function, agent must have user_level >= 5 to use +# 50913-1212 - Added campaign_cid to 3rd party calls +# 50923-1546 - Modified to work with language translation +# 50926-1656 - Added campaign pull-down at login of active campaigns +# 50928-1633 - Added manual dial alternate number dial option +# 50930-1538 - Added session_id empty login failure and fixed 2 minor bugs +# 51004-1656 - Fixed recording filename bug and new Spanish translation +# 51020-1103 - Added campaign-specific recording control abilities +# 51020-1352 - Added Basic vicidial_agent_log framework +# 51021-1050 - Fixed custtime display and disable Enter/Return keypresses +# 51021-1718 - Allows for multi-line comments (changes \n to !N in database) +# 51110-1432 - Fixed non-standard http port issue +# 51111-1047 - Added vicidial_agent_log lead_id earlier for manual dial +# 51118-1305 - Activate multi-line comments from $multi_line_comments var +# 51118-1313 - Move Transfer DIV to a floating span to preserve 800x600 view +# 51121-1506 - Small PHP optimizations in many scripts and disabled globalize +# 51129-1010 - Added ability to accept calls from other VICIDIAL servers +# 51129-1254 - Fixed Hangups of other agents channels when customer hangs up +# 51208-1732 - Created user-first login that looks for default phone info +# 51219-1526 - Added variable framework for campaign and in-group scripts +# 51221-1200 - Added SCRIPT tab, layout and functionality +# 51221-1714 - Added auto-switch-to-SCRIPT-tab and auto-webform-popup +# 51222-1605 - Added VMail message blind transfer button to xfer-conf frame +# 51229-1028 - Added checks on web_form_address to allow for var in the DB value +# 60117-1312 - Added Transfer-conf frame toggle on button press +# 60208-1152 - Added DTMF-xfernumber preset links to xfer-conf frame +# 60213-1129 - Added vicidial_users.hotkeys_active for any user hotkeys +# 60213-1210 - Added ability to sort routing of calls by user_level +# 60214-0932 - Initial Callback calendar display framework +# 60214-1407 - Added ability to minimize the dispo screen to see info below +# 60215-1104 - Added ANYONE scheduled callbacks functionality +# 60410-1116 - Added persistant pause after dispo option and change dispo text +# - Added web form submit that opens new window with dispo on submit +# - Added PREVIOUS CALLBACK in customer info to flag callbacks +# - Added link to try to hangup the call again in the dispo screen +# - Added link noone-in-session screen to call agent phone again +# - Added link customer-hungup screen to go straight to dispo screen +# 60410-1532 - Added agent status and campaign calls dialing display option +# 60411-1547 - Add ability to set callback as USERONLY and some basic formatting +# 60413-1752 - Add basic USERONLY callback frame and listings +# 60414-1039 - Changed manual dial preview and alt dial checkboxes to spans +# - Added beta-level USERONLY callback functionality +# - Added beta-level manual dialing with lead insertion functionality +# 60415-1534 - Fixed manual dial lead preview and fixed manuald dial override bug +# 60417-1108 - Added capability to do alt-number-dialing in auto-dial mode +# - Changed several permissions to database-defined +# 60419-1529 - Prevent manual dial or callbacks when alt-dial lead not finished +# 60420-1647 - Fixed DiaLDiaLAltPhonE error, Call Agent Again DialControl error +# 60421-1229 - Check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60424-1005 - Fixed Alt phone disabled bug for callbacks and manual dials +# 60426-1058 - Added vicidial_user setting for default blended check for CLOSER +# 60501-1008 - Added option to manual dial screen to manually lookup phone number +# 60503-1653 - Fixed agentonly_callback not-defined bug in scheduled callbacks screen +# 60504-1032 - Fixed manual dial display bug and transfer dispo alert bug +# - Fixed recording filename display to not overrun 25 characters +# 60510-1051 - Added Wrapup timer and wrapup message on wrapup screen after dispo +# 60608-1453 - Added CLOSER campaign allowable in-groups limitations +# 60609-1123 - Added add-number-to-DNC-list function and manual dial check DNC +# 60619-1047 - Added variable filters to close security holes for login form +# 60804-1710 - fixed scheduled CALLBK for other languages build +# 60808-1145 - Added consultative transfers with customer data +# 60808-2232 - Added campaign name to pulldown for login screen +# 60809-1603 - Added option to locally transfer consult xfers +# 60809-1732 - Added recheck of transferred channels before customer gone mesg +# 60810-1011 - Fixed CXFER leave 3way call bugs +# 60816-1602 - Added ALLCALLS recording delay option allcalls_delay +# 60816-1716 - Fixed customer time display bug and client DST setting +# 60821-1555 - Added option to omit phone_code on dialout of leads +# 60821-1628 - Added ALLFORCE recording option +# 60821-1643 - Added no_delete_sessions option to not delete sessions +# 60822-0512 - Changed phone number fields to be maxlength of 12 +# 60829-1531 - Made compatible with WeBRooTWritablE setting in dbconnect.php +# 60906-1152 - Added Previous CallBack info display span +# 60906-1715 - Allow for Local phone extension conferences +# 61004-1729 - Add ability to control volume per channel in "calls in this session" +# 61122-1341 - Added vicidial_user_groups allowed_campaigns restrictions +# 61122-1523 - Added more SCRIPT variables +# 61128-2229 - Added vicidial_live_agents and vicidial_auto_calls manual dial entries +# 61130-1617 - Added lead_id to MonitorConf for recording_log +# 61221-1212 - Changed width to 760 to better fit 800x600 screens, widened SCRIPT +# 70109-1128 - Fixed wrapup timer bug +# 70109-1635 - Added option for HotKeys automatically dialing next number in manual mode +# - Added option for alternate number dialing with hotkeys +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70118-1517 - Added vicidial_agent_log and vicidial_user_log logging of user_group +# 70201-1249 - Added FAST DIAL option for manually dialing, added UTF8 compatible code +# 70201-1703 - Fixed cursor bug for most text input fields +# 70202-1453 - Added first portions of Agent Pause Codes +# 70203-0108 - Finished Agent Pause Codes functionality +# 70203-0930 - Added dialed_number to webform output +# 70203-1010 - Added dialed_label to webform output +# 70206-1201 - Fixed allow_closers bug +# 70206-1332 - Added vicidial_recording_override users setting function +# 70212-1252 - Fixed small issue with CXFER +# 70213-1018 - Changed CXFER and AXFER to update customer information before transfer +# 70214-1233 - Added queuemetrics_log_id field for server_id in queue_log +# 70215-1240 - Added queuemetrics_log_id field for server_id in queue_log +# 70222-1617 - Changed queue_log PAUSE/UNPAUSE to PAUSEALL/UNPAUSEALL +# 70226-1252 - Added Mute/UnMute to agent screen +# 70309-1035 - Allow amphersands and questions marks in comments to pass through +# 70313-1052 - Allow pound signs(hash) in comments to pass through +# 70316-1406 - Moved the MUTE button to be accessible during a transfer/conf +# 70319-1446 - Added agent-deactive-display and disable customer info update functions +# 70319-1626 - Added option to allow agent logins to campaigns with no leads in the hopper +# 70320-1501 - Added option to allow retry of leave-3way-call from dispo screen +# 70322-1545 - Added sipsak display ability +# 70510-1319 - Added onUnload force Logout +# 70806-1530 - Added Presets Dial links above agent mute button +# 70823-2118 - Fixed XMLHTTPRequest, HotKeys and Scheduled Callbacks issues with MSIE +# 70828-1443 - Added source_id to output of SCRIPTtab-IFRAME and WEBFORM +# 71022-1427 - Added formatting of the customer phone number in the main status bar +# 71029-1848 - Changed CLOSER-type campaign to not use campaign_id restrictions +# 71101-1204 - Fixed bug in callback calendar with DST +# 71116-0957 - Added campaign_weight and calls_today to the vla table insertion +# 71120-1719 - Added XMLHTPRequest lookup of allowable campaigns for agents during login +# 71122-0256 - Added auto-pause notification +# 71125-1751 - Changed Transfer section to allow for selection of in-groups to send calls to +# 71127-0408 - Added height and width settings for easier modification of screen size +# 71129-2025 - restricted callbacks count and list to campaign only +# + +$version = '2.0.4-142'; +$build = '71129-2025'; + +require("dbconnect.php"); + +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["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} + 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"];} + } + if (isset($VD_campaign)) + { + $VD_campaign = strtoupper($VD_campaign); + $VD_campaign = eregi_replace(" ",'',$VD_campaign); + } + if (!isset($flag_channels)) + { + $flag_channels=0; + $flag_string=''; + } + +### 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); + + +$forever_stop=0; + +if ($force_logout) +{ + echo "You have now logged out. Thank you\n"; + exit; +} + +$isdst = date("I"); +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$CIDdate = date("ymdHis"); + $month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); + $past_month_date = date("Y-m-d H:i:s",$month_old); + + +$random = (rand(1000000, 9999999) + 10000000); + +$conf_silent_prefix = '7'; # vicidial_conferences prefix to enter silently +$HKuser_level = '5'; # minimum vicidial user_level for HotKeys +$campaign_login_list = '1'; # show drop-down list of campaigns at login +$manual_dial_preview = '1'; # allow preview lead option when manual dial +$multi_line_comments = '1'; # set to 1 to allow multi-line comment box +$user_login_first = '0'; # set to 1 to have the vicidial_user login before the phone login +$view_scripts = '1'; # set to 1 to show the SCRIPTS tab +$dispo_check_all_pause = '0'; # set to 1 to allow for persistent pause after dispo +$agentcallsstatus = '0'; # set to 1 to show agent status and call count + $campagentstatctmax = '0'; # Number of seconds for campaign call and agent stats +$show_campname_pulldown = '1'; # set to 1 to show campaign name on login pulldown +$webform_sessionname = '1'; # set to 1 to include the session_name in webform URL +$local_consult_xfers = '1'; # set to 1 to send consultative transfers from original server +$clientDST = '1'; # set to 1 to check for DST on server for agent time +$no_delete_sessions = '0'; # set to 1 to not delete sessions at logout +$volumecontrol_active = '1'; # set to 1 to allow agents to alter volume of channels +$PreseT_DiaL_LinKs = '1'; # set to 1 to show a DIAL link for Dial Presets +$LogiNAJAX = '1'; # set to 1 to do lookups +$HidEMonitoRSessionS = '1'; # set to 1 to hide remote monitoring channels from "session calls" + +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen + +$BROWSER_HEIGHT = 500; # set to the minimum browser height, default=500 +$BROWSER_WIDTH = 770; # set to the minimum browser width, default=770 + + +# options now set in DB: +#$alt_phone_dialing = '1'; # allow agents to call alt phone numbers +#$scheduled_callbacks = '1'; # set to 1 to allow agent to choose scheduled callbacks +# $agentonly_callbacks = '1'; # set to 1 to allow agent to choose agent-only scheduled callbacks +#$agentcall_manual = '1'; # set to 1 to allow agent to make manual calls during autodial session + +### SCREEN WIDTH AND HEIGHT CALCULATIONS ### +### DO NOT EDIT! ### +$MASTERwidth=($BROWSER_WIDTH - 340); +$MASTERheight=($BROWSER_HEIGHT - 200); +if ($MASTERwidth < 430) {$MASTERwidth = '430';} +if ($MASTERheight < 300) {$MASTERheight = '300';} + +$CAwidth = ($MASTERwidth + 340); # 770 - cover all (none-in-session, customer hunngup, etc...) +$MNwidth = ($MASTERwidth + 330); # 760 - main frame +$XFwidth = ($MASTERwidth + 320); # 750 - transfer/conference +$HCwidth = ($MASTERwidth + 310); # 740 - hotkeys and callbacks +$AMwidth = ($MASTERwidth + 270); # 700 - agent mute and preset-dial links +$SSwidth = ($MASTERwidth + 176); # 606 - scroll script +$SDwidth = ($MASTERwidth + 170); # 600 - scroll script, customer data and calls-in-session +$HKwidth = ($MASTERwidth + 70); # 500 - Hotkeys button +$HSwidth = ($MASTERwidth + 1); # 431 - Header spacer + +$HKheight = ($MASTERheight + 105); # 405 - HotKey active Button +$AMheight = ($MASTERheight + 100); # 400 - Agent mute and preset dial links +$MBheight = ($MASTERheight + 65); # 365 - Manual Dial Buttons +$CBheight = ($MASTERheight + 50); # 350 - Agent Callback, pause code, volume control Buttons and agent status +$SSheight = ($MASTERheight + 31); # 331 - script content +$HTheight = ($MASTERheight + 10); # 310 - transfer frame, callback comments and hotkey +$BPheight = ($MASTERheight - 250); # 50 - bottom buffer + + +$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('vicidial.php','',$agcPAGE); + +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 +echo "\n"; +echo "\n"; +echo "\n"; + +if ($campaign_login_list > 0) +{ +$camp_form_code = "\n"; +} +else +{ +$camp_form_code = "\n"; +} + + +if ($LogiNAJAX > 0) +{ +?> + + + +VICIDIAL web client: Re-Login\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Re-Login
 
Phone Login:
Phone Password:
User Login:
User Password:
Campaign: $camp_form_code

VERSION: $version       BUILD: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} + +if ($user_login_first == 1) +{ + if ( (strlen($VD_login)<1) or (strlen($VD_pass)<1) or (strlen($VD_campaign)<1) ) + { + echo "VICIDIAL web client: Campaign Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + #echo "\n"; + #echo "\n"; + echo "

User Login

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Campaign Login
 
User Login:
User Password:
Campaign: $camp_form_code
  \n"; + echo "

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) + { + $stmt="SELECT phone_login,phone_pass from vicidial_users where user='$VD_login' and pass='$VD_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); + $phone_login=$row[0]; + $phone_pass=$row[1]; + + echo "VICIDIAL web client: Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Login
 
Phone Login:
Phone Password:
User Login:
User Password:
Campaign: $camp_form_code
  \n"; + echo "

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + + } + } +} + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "VICIDIAL web client: Phone Login\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "
\n"; +echo "\n"; +echo "


"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo ""; +echo "\n"; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Phone Login
 
Phone Login:
Phone Password:
  \n"; +echo "

VERSION: $version       BUILD: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./vicidial_auth_entries.txt", "a");} +$VDloginDISPLAY=0; + + if ( (strlen($VD_login)<2) or (strlen($VD_pass)<2) or (strlen($VD_campaign)<2) ) + { + $VDloginDISPLAY=1; + } + else + { + $stmt="SELECT count(*) from vicidial_users where user='$VD_login' and pass='$VD_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($auth>0) + { + $login=strtoupper($VD_login); + $password=strtoupper($VD_pass); + ##### grab the full name of the agent + $stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,closer_default_blended,user_group,vicidial_recording_override from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $user_level=$row[1]; + $VU_hotkeys_active=$row[2]; + $VU_agent_choose_ingroups=$row[3]; + $VU_scheduled_callbacks=$row[4]; + $agentonly_callbacks=$row[5]; + $agentcall_manual=$row[6]; + $VU_vicidial_recording=$row[7]; + $VU_vicidial_transfers=$row[8]; + $VU_closer_default_blended=$row[9]; + $VU_user_group=$row[10]; + $VU_vicidial_recording_override=$row[11]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|$VD_pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + $user_abb = "$VD_login$VD_login$VD_login$VD_login"; + while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + + $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$VU_user_group';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGallowed_campaigns =$row[0]; + + if ( (!eregi(" $VD_campaign ",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) + { + echo "VICIDIAL web client: VICIDIAL Campaign Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "Sorry, you are not allowed to login to this campaign: $VD_campaign\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Login: \n
"; + echo "Password:
\n"; + echo "Campaign: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + ##### check to see that the campaign is active + $stmt="SELECT count(*) FROM vicidial_campaigns where campaign_id='$VD_campaign' and active='Y';"; + 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); + $CAMPactive=$row[0]; + if($CAMPactive>0) + { + if ($TEST_all_statuses > 0) {$selectableSQL = '';} + else {$selectableSQL = "selectable='Y' and";} + $VARstatuses=''; + $VARstatusnames=''; + ##### grab the statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_statuses WHERE $selectableSQL status != 'NEW' order by status limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $VD_statuses_ct) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + } + + ##### grab the campaign-specific statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_campaign_statuses WHERE $selectableSQL status != 'NEW' and campaign_id='$VD_campaign' order by status limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_statuses_camp = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + $j++; + } + $VD_statuses_ct = ($VD_statuses_ct+$VD_statuses_camp); + $VARstatuses = substr("$VARstatuses", 0, -1); + $VARstatusnames = substr("$VARstatusnames", 0, -1); + + ##### grab the campaign-specific HotKey statuses that can be used for dispositioning by an agent + $stmt="SELECT hotkey,status,status_name FROM vicidial_campaign_hotkeys WHERE selectable='Y' and status != 'NEW' and campaign_id='$VD_campaign' order by hotkey limit 9;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $HK_statuses_camp = mysql_num_rows($rslt); + $w=0; + $HKboxA=''; + $HKboxB=''; + $HKboxC=''; + while ($w < $HK_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $HKhotkey[$w] =$row[0]; + $HKstatus[$w] =$row[1]; + $HKstatus_name[$w] =$row[2]; + $HKhotkeys = "$HKhotkeys'$HKhotkey[$w]',"; + $HKstatuses = "$HKstatuses'$HKstatus[$w]',"; + $HKstatusnames = "$HKstatusnames'$HKstatus_name[$w]',"; + if ($w < 3) + {$HKboxA = "$HKboxA $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ( ($w >= 3) and ($w < 6) ) + {$HKboxB = "$HKboxB $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ($w >= 6) + {$HKboxC = "$HKboxC $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + $w++; + } + $HKhotkeys = substr("$HKhotkeys", 0, -1); + $HKstatuses = substr("$HKstatuses", 0, -1); + $HKstatusnames = substr("$HKstatusnames", 0, -1); + + ##### grab the statuses to be dialed for your campaign as well as other campaign settings + $stmt="SELECT park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,agent_pause_codes_active,no_hopper_leads_logins,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,xfer_groups FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $park_ext = $row[0]; + $park_file_name = $row[1]; + $web_form_address = $row[2]; + $allow_closers = $row[3]; + $auto_dial_level = $row[4]; + $dial_timeout = $row[5]; + $dial_prefix = $row[6]; + $campaign_cid = $row[7]; + $campaign_vdad_exten = $row[8]; + $campaign_rec_exten = $row[9]; + $campaign_recording = $row[10]; + $campaign_rec_filename = $row[11]; + $campaign_script = $row[12]; + $get_call_launch = $row[13]; + $campaign_am_message_exten = $row[14]; + $xferconf_a_dtmf = $row[15]; + $xferconf_a_number = $row[16]; + $xferconf_b_dtmf = $row[17]; + $xferconf_b_number = $row[18]; + $alt_number_dialing = $row[19]; + $VC_scheduled_callbacks = $row[20]; + $wrapup_seconds = $row[21]; + $wrapup_message = $row[22]; + $closer_campaigns = $row[23]; + $use_internal_dnc = $row[24]; + $allcalls_delay = $row[25]; + $omit_phone_code = $row[26]; + $agent_pause_codes_active = $row[27]; + $no_hopper_leads_logins = $row[28]; + $campaign_allow_inbound = $row[29]; + $manual_dial_list_id = $row[30]; + $default_xfer_group = $row[31]; + $xfer_groups = $row[32]; + + if ( (!ereg('DISABLED',$VU_vicidial_recording_override)) and ($VU_vicidial_recording > 0) ) + { + $campaign_recording = $VU_vicidial_recording_override; + print "\n"; + } + if ( ($VC_scheduled_callbacks=='Y') and ($VU_scheduled_callbacks=='1') ) + {$scheduled_callbacks='1';} + if ($VU_vicidial_recording=='0') + {$campaign_recording='NEVER';} + if ($alt_number_dialing=='Y') + {$alt_phone_dialing='1';} + else + {$alt_phone_dialing='0';} + $closer_campaigns = preg_replace("/^ | -$/","",$closer_campaigns); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaigns = "'$closer_campaigns'"; + + if ($agent_pause_codes_active=='Y') + { + ##### grab the pause codes for this campaign + $stmt="SELECT pause_code,pause_code_name FROM vicidial_pause_codes WHERE campaign_id='$VD_campaign' order by pause_code limit 50;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $VD_pause_codes = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_pause_codes) + { + $row=mysql_fetch_row($rslt); + $pause_codes[$i] =$row[0]; + $pause_code_names[$i] =$row[1]; + $VARpause_codes = "$VARpause_codes'$pause_codes[$i]',"; + $VARpause_code_names = "$VARpause_code_names'$pause_code_names[$i]',"; + $i++; + $j++; + } + $VD_pause_codes_ct = ($VD_pause_codes_ct+$VD_pause_codes); + $VARpause_codes = substr("$VARpause_codes", 0, -1); + $VARpause_code_names = substr("$VARpause_code_names", 0, -1); + } + + ##### grab the inbound groups to choose from if campaign contains CLOSER + $VARingroups="''"; + if ($campaign_allow_inbound == 'Y') + { + $VARingroups=''; + $stmt="select group_id from vicidial_inbound_groups where active = 'Y' and group_id IN($closer_campaigns) order by group_id limit 60;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $closer_ct = mysql_num_rows($rslt); + $INgrpCT=0; + while ($INgrpCT < $closer_ct) + { + $row=mysql_fetch_row($rslt); + $closer_groups[$INgrpCT] =$row[0]; + $VARingroups = "$VARingroups'$closer_groups[$INgrpCT]',"; + $INgrpCT++; + } + $VARingroups = substr("$VARingroups", 0, -1); + } + + ##### grab the allowable inbound groups to choose from for transfer options + $xfer_groups = preg_replace("/^ | -$/","",$xfer_groups); + $xfer_groups = preg_replace("/ /","','",$xfer_groups); + $xfer_groups = "'$xfer_groups'"; + $VARxfergroups="''"; + if ($allow_closers == 'Y') + { + $VARxfergroups=''; + $stmt="select group_id,group_name from vicidial_inbound_groups where active = 'Y' and group_id IN($xfer_groups) order by group_id limit 60;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $xfer_ct = mysql_num_rows($rslt); + $XFgrpCT=0; + while ($XFgrpCT < $xfer_ct) + { + $row=mysql_fetch_row($rslt); + $VARxfergroups = "$VARxfergroups'$row[0]',"; + $VARxfergroupsnames = "$VARxfergroupsnames'$row[1]',"; + if ($row[0] == "$default_xfer_group") {$default_xfer_group_name = $row[1];} + $XFgrpCT++; + } + $VARxfergroups = substr("$VARxfergroups", 0, -1); + $VARxfergroupsnames = substr("$VARxfergroupsnames", 0, -1); + } + + ##### grab the number of leads in the hopper for this campaign + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id = '$VD_campaign' and status='READY';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $campaign_leads_to_call = $row[0]; + print "\n"; + + } + else + { + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Campaign not active, please try again
"; + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|$VD_pass|$ip|$browser|\n"); + fclose($fp); + } + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Login incorrect, please try again
"; + } + } + if ($VDloginDISPLAY) + { + echo "VICIDIAL web client: Campaign Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "

$VDdisplayMESSAGE

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Campaign Login
 
User Login:
User Password:
Campaign: $camp_form_code
  \n"; + echo "

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +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); +$authphone=$row[0]; +if (!$authphone) + { + echo "VICIDIAL web client: Phone Login Error\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Login Error
 
Sorry, your phone login and password are not active in this system, please try again:
 
Phone Login:
Phone Password:

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "VICIDIAL web client\n"; + $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + 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); + $extension=$row[0]; + $dialplan_number=$row[1]; + $voicemail_id=$row[2]; + $phone_ip=$row[3]; + $computer_ip=$row[4]; + $server_ip=$row[5]; + $login=$row[6]; + $pass=$row[7]; + $status=$row[8]; + $active=$row[9]; + $phone_type=$row[10]; + $fullname=$row[11]; + $company=$row[12]; + $picture=$row[13]; + $messages=$row[14]; + $old_messages=$row[15]; + $protocol=$row[16]; + $local_gmt=$row[17]; + $ASTmgrUSERNAME=$row[18]; + $ASTmgrSECRET=$row[19]; + $login_user=$row[20]; + $login_pass=$row[21]; + $login_campaign=$row[22]; + $park_on_extension=$row[23]; + $conf_on_extension=$row[24]; + $VICIDiaL_park_on_extension=$row[25]; + $VICIDiaL_park_on_filename=$row[26]; + $monitor_prefix=$row[27]; + $recording_exten=$row[28]; + $voicemail_exten=$row[29]; + $voicemail_dump_exten=$row[30]; + $ext_context=$row[31]; + $dtmf_send_extension=$row[32]; + $call_out_number_group=$row[33]; + $client_browser=$row[34]; + $install_directory=$row[35]; + $local_web_callerID_URL=$row[36]; + $VICIDiaL_web_URL=$row[37]; + $AGI_call_logging_enabled=$row[38]; + $user_switching_enabled=$row[39]; + $conferencing_enabled=$row[40]; + $admin_hangup_enabled=$row[41]; + $admin_hijack_enabled=$row[42]; + $admin_monitor_enabled=$row[43]; + $call_parking_enabled=$row[44]; + $updater_check_enabled=$row[45]; + $AFLogging_enabled=$row[46]; + $QUEUE_ACTION_enabled=$row[47]; + $CallerID_popup_enabled=$row[48]; + $voicemail_button_enabled=$row[49]; + $enable_fast_refresh=$row[50]; + $fast_refresh_rate=$row[51]; + $enable_persistant_mysql=$row[52]; + $auto_dial_next_number=$row[53]; + $VDstop_rec_after_each_call=$row[54]; + $DBX_server=$row[55]; + $DBX_database=$row[56]; + $DBX_user=$row[57]; + $DBX_pass=$row[58]; + $DBX_port=$row[59]; + $enable_sipsak_messages=$row[66]; + + if ($clientDST) + { + $local_gmt = ($local_gmt + $isdst); + } + if ($protocol == 'EXTERNAL') + { + $protocol = 'Local'; + $extension = "$dialplan_number$AT$ext_context"; + } + $SIP_user = "$protocol/$extension"; + + $stmt="SELECT asterisk_version from servers where server_ip='$server_ip';"; + 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); + $asterisk_version=$row[0]; + + # If a park extension is not set, use the default one + if ( (strlen($park_ext)>0) && (strlen($park_file_name)>0) ) + { + $VICIDiaL_park_on_extension = "$park_ext"; + $VICIDiaL_park_on_filename = "$park_file_name"; + print "\n"; + } + print "\n"; + + # If a web form address is not set, use the default one + if (strlen($web_form_address)>0) + { + $VICIDiaL_web_form_address = "$web_form_address"; + print "\n"; + } + else + { + $VICIDiaL_web_form_address = "$VICIDiaL_web_URL"; + print "\n"; + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + } + $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); + + # If closers are allowed on this campaign + if ($allow_closers=="Y") + { + $VICIDiaL_allow_closers = 1; + print "\n"; + } + else + { + $VICIDiaL_allow_closers = 0; + print "\n"; + } + + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtimE$US$session_ext$session_rand"; + + if ($webform_sessionname) + {$webform_sessionname = "&session_name=$session_name";} + else + {$webform_sessionname = '';} + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'vicidial';"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','vicidial','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + if ( ($campaign_allow_inbound == 'Y') || ($campaign_leads_to_call > 0) || (ereg('Y',$no_hopper_leads_logins)) ) + { + ### insert an entry into the user log for the login event + $stmt = "INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$VD_login','LOGIN','$VD_campaign','$NOW_TIME','$StarTtimE','$VU_user_group')"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + + ##### check to see if the user has a conf extension already, this happens if they previously exited uncleanly + $stmt="SELECT conf_exten FROM vicidial_conferences where extension='$SIP_user' and server_ip = '$server_ip' LIMIT 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $prev_login_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $prev_login_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + if ($prev_login_ct > 0) + {print "\n";} + else + { + ##### grab the next available vicidial_conference room and reserve it + $stmt="SELECT conf_exten FROM vicidial_conferences where server_ip = '$server_ip' and ((extension='') or (extension is null)) LIMIT 1;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $free_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $free_conf_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + $stmt="UPDATE vicidial_conferences set extension='$SIP_user' where server_ip='$server_ip' and conf_exten='$session_id';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + print "\n"; + + } + + $stmt="UPDATE vicidial_list set status='N', user='' where status IN('QUEUE','INCALL') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_hopper where status IN('QUEUE','INCALL','DONE') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_live_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + $stmt="DELETE from vicidial_live_inbound_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + # print "You have logged in as user: $VD_login on phone: $SIP_user to campaign: $VD_campaign
\n"; + $VICIDiaL_is_logged_in=1; + + ### set the callerID for manager middleware-app to connect the phone to the user + $SIqueryCID = "S$CIDdate$session_id"; + + ############################################# + ##### START SYSTEM_SETTINGS LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,vicidial_agent_disable,allow_sipsak_messages FROM system_settings;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $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); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $vicidial_agent_disable = $row[6]; + $allow_sipsak_messages = $row[7]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_prefix = 'LIN-'; + print "\n"; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$VD_campaign\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + $SIqueryCID = "$SIPSAK_prefix$VD_campaign$DS$CIDdate"; + } + + ### insert a NEW record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$SIqueryCID','Channel: $SIP_user','Context: $ext_context','Exten: $session_id','Priority: 1','Callerid: $SIqueryCID','','','','','');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($auto_dial_level > 0) + { + print "\n"; + + ##### grab the campaign_weight and number of calls today on that campaign for the agent + $stmt="SELECT campaign_weight,calls_today FROM vicidial_campaign_agents where user='$VD_login' and campaign_id = '$VD_campaign';"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vca_ct = mysql_num_rows($rslt); + if ($vca_ct > 0) + { + $row=mysql_fetch_row($rslt); + $campaign_weight = $row[0]; + $calls_today = $row[1]; + $i++; + } + else + { + $campaign_weight = '0'; + $calls_today = '0'; + $stmt="INSERT INTO vicidial_campaign_agents (user,campaign_id,campaign_rank,campaign_weight,calls_today) values('$VD_login','$VD_campaign','0','0','$calls_today');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + } + $closer_chooser_string=''; + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,user_level,campaign_weight,calls_today) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$closer_chooser_string','$user_level','$campaign_weight','$calls_today');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='$VD_campaign',agent='Agent/$VD_login',verb='AGENTLOGIN',data1='$VD_login@agents',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + mysql_close($linkB); + mysql_select_db("$VARDB_database", $link); + } + + + if ($campaign_allow_inbound == 'Y') + { + print "\n"; + } + } + else + { + print "\n"; + + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,user_level) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$user_level');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='$VD_campaign',agent='Agent/$VD_login',verb='AGENTLOGIN',data1='$VD_login@agents',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + print "\n"; + + mysql_close($linkB); + mysql_select_db("$VARDB_database", $link); + } + } + } + else + { + echo "VICIDIAL web client: VICIDIAL Campaign Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "Sorry, there are no leads in the hopper for this campaign\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Login: \n
"; + echo "Password:
\n"; + echo "Campaign: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + if (strlen($session_id) < 1) + { + echo "VICIDIAL web client: VICIDIAL Campaign Login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "Sorry, there are no available sessions\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Login: \n
"; + echo "Password:
\n"; + echo "Campaign: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + if (ereg('MSIE',$browser)) + { + $useIE=1; + print "\n"; + } + else + { + $useIE=0; + print "\n"; + } + + $StarTtimE = date("U"); + $NOW_TIME = date("Y-m-d H:i:s"); + ##### Agent is going to log in so insert the vicidial_agent_log entry now + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group,sub_status) values('$VD_login','$server_ip','$NOW_TIME','$VD_campaign','$StarTtimE','0','$StarTtimE','$VU_user_group','LOGIN');"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id($link); + print "\n"; + + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $server_ip_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S"; + + ##### grab the datails of all active scripts in the system + $stmt="SELECT script_id,script_name,script_text FROM vicidial_scripts WHERE active='Y' order by script_id limit 100;"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $MM_scripts = mysql_num_rows($rslt); + $e=0; + while ($e < $MM_scripts) + { + $row=mysql_fetch_row($rslt); + $MMscriptid[$e] =$row[0]; + $MMscriptname[$e] = rawurlencode($row[1]); + $MMscripttext[$e] = rawurlencode($row[2]); + $MMscriptids = "$MMscriptids'$MMscriptid[$e]',"; + $MMscriptnames = "$MMscriptnames'$MMscriptname[$e]',"; + $MMscripttexts = "$MMscripttexts'$MMscripttext[$e]',"; + $e++; + } + $MMscriptids = substr("$MMscriptids", 0, -1); + $MMscriptnames = substr("$MMscriptnames", 0, -1); + $MMscripttexts = substr("$MMscripttexts", 0, -1); + + } +} + +################################################################ +### BEGIN - build the callback calendar (12 months) ### +################################################################ +define ('ADAY', (60*60*24)); +$CdayARY = getdate(); +$Cmon = $CdayARY['mon']; +$Cyear = $CdayARY['year']; +$CTODAY = date("Y-m"); +$CTODAYmday = date("j"); +$CINC=0; + +$Cmonths = Array('January','February','March','April','May','June', + 'July','August','September','October','November','December'); +$Cdays = Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); + +$CCAL_OUT = ''; + +$CCAL_OUT .= ""; + +while ($CINC < 12) +{ +if ( ($CINC == 0) || ($CINC == 4) ||($CINC == 8) ) + {$CCAL_OUT .= "";} + +$CCAL_OUT .= ""; + +if ( ($CINC == 3) || ($CINC == 7) ||($CINC == 11) ) + {$CCAL_OUT .= "";} +$CINC++; +} + +$CCAL_OUT .= "
"; + +$CYyear = $Cyear; +$Cmonth= ($Cmon + $CINC); +if ($Cmonth > 12) + { + $Cmonth = ($Cmonth - 12); + $CYyear++; + } +$Cstart= mktime(11,0,0,$Cmonth,1,$CYyear); +$CfirstdayARY = getdate($Cstart); +#echo "|$Cmon|$Cmonth|$CINC|\n"; +$CPRNTDAY = date("Y-m", $Cstart); + +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; +$CCAL_OUT .= ""; + +foreach($Cdays as $Cday) +{ + $CDCLR="#ffffff"; +$CCAL_OUT .= ""; +} + +for( $Ccount=0;$Ccount<(6*7);$Ccount++) +{ + $Cdayarray = getdate($Cstart); + if((($Ccount) % 7) == 0) + { + if($Cdayarray['mon'] != $CfirstdayARY['mon']) + break; + $CCAL_OUT .= ""; + } + if($Ccount < $CfirstdayARY['wday'] || $Cdayarray['mon'] != $Cmonth) + { + $CCAL_OUT .= ""; + } + else + { + if( ($Cdayarray['mday'] == $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + else + { + $CDCLR="#ffffff"; + if ( ($Cdayarray['mday'] < $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CDCLR="#CCCCCC"; + $CBL = ''; + $CEL = ''; + } + else + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + $CBL = ""; + $CEL = ""; + } + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + } +} +$CCAL_OUT .= ""; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$CfirstdayARY[month] $CfirstdayARY[year]"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "$Cday"; +$CCAL_OUT .= "
"; +$CCAL_OUT .= "
 "; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; +$CCAL_OUT .= "
"; + +#echo "$CCAL_OUT\n"; +################################################################ +### END - build the callback calendar (12 months) ### +################################################################ + + +?> + + + + +\n"; + + +?> + +
+ + MARGINWIDTH=0 MARGINHEIGHT=0 LEFTMARGIN=0 TOPMARGIN=0 VALIGN=TOP ALIGN=LEFT> +
+ + + +LOGOUT\n"; ?> +
+
+ + + height=30> + + + + + +
VICIDIALSCRIPT VALIGN=MIDDLE ALIGN=CENTER>   LIVE     session ID: Live Call
+
+ + + + + height=>

VICIDIAL
+
+ + +MANUAL DIAL       FAST DIAL
+
+ + +X ACTIVE CALLBACKS
+
+ + +
+
+ + + D1 - DIAL\n"; + echo "
\n"; + echo "D2 - DIAL\n"; + } + else {echo "
\n";} + ?> +

+
+
+ + + height=460>
CALLBACKS FOR AGENT :
Click on a callback below to call the customer back now. If you click on a record below to call it, it will be removed from the list. +
+
+
  + Refresh +                 + Go Back +
+
+ + + height=460>
NEW MANUAL DIAL LEAD FOR :

Enter information below for the new lead you wish to call. +
+ \n"; + } + ?> + Note: all new manual dial leads will go into list

+ + + + + + + + + + + + + + + +
Dial Code:   (This is usually a 1 in the USA-Canada)
Phone Number: +   (12 digits max - digits only) +
Search Existing Leads:   (This option if checked will attempt to find the phone number in the system before inserting it as a new lead)


If you want to dial a number and have it NOT be added as a new lead, enter in the exact dialstring that you want to call in the Dial Override field below. To hangup this call you will have to open the CALLS IN THIS SESSION link at the bottom of the screen and hang it up by clicking on its channel link there.
 
Dial Override:   (digits only please) +
+
+ Dial Now +                 + Go Back +
+
+ + + +
+
+ + + + +Your Status:
Calls Dialing: +
+ + + + + > + +
+
+ + Transfer - Conference
+ + + LOCAL CLOSER + Hangup Xfer Line + Hangup Both Lines + +
+ + Number to call   + + DIAL OVERRIDE   + LEAVE 3-WAY CALL + Dial Blind Transfer + D1 + D2 + +
+ + seconds   + channel + Dial With Customer + Park Customer Dial + Blind Transfer VMail Message +
+
+
+
+ + + + height=70> + +
Lead Dispositioned As:

+ -
+
+
+ + + height=70> + + + + +
Disposition Hot Keys: + When active, simply press the keyboard key for the desired disposition for this call. The call will then be hungup and dispositioned automatically:
+ + + + + +
+
+ + + height=70> + + + + + + +
Previous Callback Information: close
+
+
+
+
+ +
+
+ + + height=500>
Noone is in your session:
+ Go Back +

+ Call Agent Again +
+
+ + + height=500>
Customer has hung up:
+ Go Back +

+ Finish and Disposition Call + +
+
+ + + height=550>
Call Wrapup: seconds remaining in wrapup

+ +

+ Finish Wrapup and Move On + +
+
+ + + height=500>
Your session has been disabled
LOGOUT

Go Back +
+
+ + + height=500>

LOGOUT
+
+ + +
+
+ + +
 
+
+ + + height=47>
Any changes made to the customer information below at this time will not be comitted, You must change customer information before you Hangup the call.
+
+ + + height=460>
DISPOSITION CALL :       Hangup Again       minimize
+ End-of-call Disposition Selection +
+ PAUSE AGENT DIALING
+ CLEAR FORM | + SUBMIT +

+ WEB FORM SUBMIT +

  +
+
+ + + height=460>
SELECT A PAUSE CODE :
+ Pause Code Selection + +

  +
+
+ + + height=460>
Select a CallBack Date :
+ + + Select a Date Below   +     + Hour: +   + Minutes: +   + +  
+ MY CALLBACK ONLY
";} + ?> + CB Comments:

+ + SUBMIT

+ +

  +
+
+ + + height=460>
CLOSER INBOUND GROUP SELECTION
+ Closer Inbound Group Selection +
+ BLENDED CALLING(outbound activated)
+ RESET | + SUBMIT +



  +
+
+ + + + Channel + Channel + MY CALLBACK ONLY
";} + ?> +
+ + + + height=>
VICIDIAL SCRIPT
+
+ + + 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> +HOT KEYS INACTIVE + + + + +> + + + +
VICIDIAL web-client version:     BUILD:               Server:              
+Show conference call channel information

 
+
+ + + +
+
+ + + + + id="MainTable"> + + + + + + + + + + + + + + + +
STATUS:
+
+Dial Next Number
+ LEAD PREVIEW
+ ALT PHONE DIAL
+ + +RECORDING FILE:
+
+
+RECORD ID:
+
+ +Start Recording
+
+Web Form
+
+Park Call
+Transfer - Conference
+
+Hangup Customer
+
+
Send DTMF

+
+
+
align=left valign=top> + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
seconds:   Channel:   Cust Time:
Customer Information:
Title:   First:   MI:   Last:
Address1:
Address2:   Address3:
City:   State:   PostCode:
Province:   Vendor ID:
Phone:   DialCode:   Alt. Phone:
Show:   Email:
Comments: + +\n";} +else + {echo "\n";} +?> + +
+
+ +
+
> + 
+ + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/www/agc/voicemail_check.php b/agc_2-X/branches/agc_2.0.4/www/agc/voicemail_check.php new file mode 100644 index 00000000..0aa152d7 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/agc/voicemail_check.php @@ -0,0 +1,140 @@ + LICENSE: GPLv2 +### +### 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 +# + +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 "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Invalid server_ip: |$server_ip| or Invalid 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 "Invalid session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Voicemail Check"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + $MT[0]=''; + $row=''; $rowx=''; + if (strlen($vmail_box)<1) + { + $channel_live=0; + echo "voicemail box $vmail_box is not valid\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";} + $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";} + } + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_CLOSERstats.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_CLOSERstats.php new file mode 100644 index 00000000..9f4226a7 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_CLOSERstats.php @@ -0,0 +1,622 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1714 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 60905-1326 - Added queue time stats +# 71008-1436 - Added shift to be defined in dbconnect.php +# 71025-0021 - Added status breakdown +# 71218-1155 - added end_date for multi-day reports +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["end_date"])) {$end_date=$_GET["end_date"];} + elseif (isset($_POST["end_date"])) {$end_date=$_POST["end_date"];} +if (isset($_GET["shift"])) {$shift=$_GET["shift"];} + elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +if (strlen($shift)<2) {$shift='ALL';} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = '';} +if (!isset($query_date)) {$query_date = $NOW_DATE;} +if (!isset($end_date)) {$end_date = $NOW_DATE;} + +$stmt="select group_id from vicidial_inbound_groups;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: VDAD Closer Stats\n"; +echo "
\n"; +echo "\n"; +echo " to \n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "           MODIFY | REPORTS \n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "PLEASE SELECT AN IN-GROUP AND DATE RANGE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$time_BEGIN=$AM_shift_BEGIN;
+	$time_END=$AM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "03:45:00";}   
+	if (strlen($time_END) < 6) {$time_END = "15:15:00";}
+	}
+if ($shift == 'PM') 
+	{
+	$time_BEGIN=$PM_shift_BEGIN;
+	$time_END=$PM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "15:15:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:15:00";}
+	}
+if ($shift == 'ALL') 
+	{
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "00:00:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:59:59";}
+	}
+$query_date_BEGIN = "$query_date $time_BEGIN";   
+$query_date_END = "$end_date $time_END";
+
+
+
+echo "VICIDIAL: Auto-dial Closer Stats                      $NOW_TIME\n";
+
+echo "\n";
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{$average_hold_seconds = '         0';}
+else
+	{
+	$average_hold_seconds = ($row[1] / $row[0]);
+	$average_hold_seconds = round($average_hold_seconds, 0);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+
+echo "Total Calls placed from this Campaign:        $TOTALcalls\n";
+echo "Average Call Length for all Calls:            $average_hold_seconds seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP' and (length_in_sec <= 999 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$DROPcalls =	sprintf("%10s", $row[0]);
+if ( ($DROPcalls < 1) or ($TOTALcalls < 1) )
+	{$DROPpercent = '0';}
+else
+	{
+	$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
+	$DROPpercent = round($DROPpercent, 0);
+	}
+
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{$average_hold_seconds = '         0';}
+else
+	{
+	$average_hold_seconds = ($row[1] / $row[0]);
+	$average_hold_seconds = round($average_hold_seconds, 0);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+
+echo "Total DROP Calls:                             $DROPcalls  $DROPpercent%\n";
+echo "Average hold time for DROP Calls:             $average_hold_seconds seconds\n";
+
+
+
+##############################
+#########  CALL STATUS STATS
+
+$TOTALcalls = 0;
+
+echo "\n";
+echo "---------- CALL STATUS STATS\n";
+echo "+--------+----------------------+------------+\n";
+echo "| STATUS | DESCRIPTION          | CALLS      |\n";
+echo "+--------+----------------------+------------+\n";
+
+$stmt="SELECT * from vicidial_statuses order by status";
+$rslt=mysql_query($stmt, $link);
+$statuses_to_print = mysql_num_rows($rslt);
+$statuses_list='';
+
+$o=0;
+while ($statuses_to_print > $o) 
+	{
+	$rowx=mysql_fetch_row($rslt);
+	$statname_list["$rowx[0]"] = "$rowx[1]";
+	$o++;
+	}
+
+$stmt="SELECT * from vicidial_campaign_statuses order by status";
+$rslt=mysql_query($stmt, $link);
+$Cstatuses_to_print = mysql_num_rows($rslt);
+
+$o=0;
+while ($Cstatuses_to_print > $o) 
+	{
+	$rowx=mysql_fetch_row($rslt);
+	$statname_list["$rowx[0]"] = "$rowx[1]";
+	$o++;
+	}
+
+$stmt="select count(*),status from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysql_real_escape_string($group) . "' group by status;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$statuses_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $statuses_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$TOTALcalls = ($TOTALcalls + $row[0]);
+
+	$STATUScount =	sprintf("%10s", $row[0]);while(strlen($STATUScount)>10) {$STATUScount = substr("$STATUScount", 0, -1);}
+	$RAWstatus = $row[1];
+	$status =	sprintf("%-6s", $row[1]);while(strlen($status)>6) {$status = substr("$status", 0, -1);}
+
+	if ($non_latin < 1)
+		{
+		 $status_name =	sprintf("%-20s", $statname_list[$RAWstatus]); 
+		 while(strlen($status_name)>20) {$status_name = substr("$status_name", 0, -1);}	
+		}
+	else
+		{
+		 $status_name =	sprintf("%-60s", $statname_list[$RAWstatus]); 
+		 while(mb_strlen($status_name,'utf-8')>20) {$status_name = mb_substr("$status_name", 0, -1,'utf-8');}	
+		}
+
+
+	echo "| $status | $status_name | $STATUScount |\n";
+
+	$i++;
+	}
+
+$TOTALcalls =		sprintf("%10s", $TOTALcalls);
+
+echo "+--------+----------------------+------------+\n";
+echo "| TOTAL:                        | $TOTALcalls |\n";
+echo "+-------------------------------+------------+\n";
+
+
+
+
+echo "\n";
+echo "---------- QUEUE STATS\n";
+
+$stmt="select count(*),sum(queue_seconds) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and (queue_seconds > 0);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$QUEUEcalls =	sprintf("%10s", $row[0]);
+if ( ($QUEUEcalls < 1) or ($TOTALcalls < 1) )
+	{$QUEUEpercent = '0';}
+else
+	{
+	$QUEUEpercent = (($QUEUEcalls / $TOTALcalls) * 100);
+	$QUEUEpercent = round($QUEUEpercent, 0);
+	}
+
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{$average_queue_seconds = '         0';}
+else
+	{
+	$average_queue_seconds = ($row[1] / $row[0]);
+	$average_queue_seconds = round($average_queue_seconds, 2);
+	$average_queue_seconds = sprintf("%10.2f", $average_queue_seconds);
+	}
+
+if ( ($TOTALcalls < 1) or ($row[1] < 1) )
+	{$average_total_queue_seconds = '         0';}
+else
+	{
+	$average_total_queue_seconds = ($row[1] / $TOTALcalls);
+	$average_total_queue_seconds = round($average_total_queue_seconds, 2);
+	$average_total_queue_seconds = sprintf("%10.2f", $average_total_queue_seconds);
+	}
+
+echo "Total Calls That entered Queue:               $QUEUEcalls  $QUEUEpercent%\n";
+echo "Average QUEUE Length for queue calls:         $average_queue_seconds seconds\n";
+echo "Average QUEUE Length across all calls:        $average_total_queue_seconds seconds\n";
+
+
+##############################
+#########  USER STATS
+
+$TOTagents=0;
+$TOTcalls=0;
+$TOTtime=0;
+$TOTavg=0;
+
+echo "\n";
+echo "---------- AGENT STATS\n";
+echo "+--------------------------+------------+----------+--------+\n";
+echo "| AGENT                    | CALLS      | TIME M   | AVRG M |\n";
+echo "+--------------------------+------------+----------+--------+\n";
+
+$stmt="select vicidial_closer_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_closer_log,vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysql_real_escape_string($group) . "' and vicidial_closer_log.user is not null and length_in_sec is not null and length_in_sec > 4 and vicidial_closer_log.user=vicidial_users.user group by vicidial_closer_log.user;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$TOTcalls = ($TOTcalls + $row[2]);
+	$TOTtime = ($TOTtime + $row[3]);
+
+	$user =			sprintf("%-6s", $row[0]);
+	$full_name =	sprintf("%-15s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
+	$USERcalls =	sprintf("%10s", $row[2]);
+	$USERtotTALK =	$row[3];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$USERtotTALK_MS =		sprintf("%8s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $user - $full_name | $USERcalls | $USERtotTALK_MS | $USERavgTALK_MS |\n";
+
+	$i++;
+	}
+
+if (!$TOTcalls) {$TOTcalls = 1;}
+$TOTavg = ($TOTtime / $TOTcalls);
+$TOTavg = round($TOTavg, 0);
+$TOTavg_M = ($TOTavg / 60);
+$TOTavg_M = round($TOTavg_M, 2);
+$TOTavg_M_int = intval("$TOTavg_M");
+$TOTavg_S = ($TOTavg_M - $TOTavg_M_int);
+$TOTavg_S = ($TOTavg_S * 60);
+$TOTavg_S = round($TOTavg_S, 0);
+if ($TOTavg_S < 10) {$TOTavg_S = "0$TOTavg_S";}
+$TOTavg_MS = "$TOTavg_M_int:$TOTavg_S";
+$TOTavg =		sprintf("%6s", $TOTavg_MS);
+
+$TOTtime_M = ($TOTtime / 60);
+$TOTtime_M = 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 ($TOTtime_S < 10) {$TOTtime_S = "0$TOTtime_S";}
+$TOTtime_MS = "$TOTtime_M_int:$TOTtime_S";
+$TOTtime =		sprintf("%6s", $TOTtime_MS);
+
+$TOTagents =		sprintf("%10s", $i);
+$TOTcalls =			sprintf("%10s", $TOTcalls);
+$TOTtime =			sprintf("%8s", $TOTtime);
+$TOTavg =			sprintf("%6s", $TOTavg);
+
+echo "+--------------------------+------------+----------+--------+\n";
+echo "| TOTAL Agents: $TOTagents | $TOTcalls | $TOTtime | $TOTavg |\n";
+echo "+--------------------------+------------+----------+--------+\n";
+
+
+##############################
+#########  TIME STATS
+
+echo "\n";
+echo "---------- TIME STATS\n";
+
+echo "\n";
+
+$hi_hour_count=0;
+$last_full_record=0;
+$i=0;
+$h=0;
+while ($i <= 96)
+	{
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+	$h++;
+	}
+
+if ($hi_hour_count < 1)
+	{$hour_multiplier = 0;}
+else
+	{
+	$hour_multiplier = (100 / $hi_hour_count);
+	#$hour_multiplier = round($hour_multiplier, 0);
+	}
+
+echo "\n";
+echo "GRAPH IN 15 MINUTE INCREMENTS OF TOTAL CALLS PLACED FROM THIS CAMPAIGN\n";
+
+$k=1;
+$Mk=0;
+$call_scale = '0';
+while ($k <= 102) 
+	{
+	if ($Mk >= 5) 
+		{
+		$Mk=0;
+		if ( ($k < 1) or ($hour_multiplier <= 0) )
+			{$scale_num = 100;}
+		else
+			{
+			$scale_num=($k / $hour_multiplier);
+			$scale_num = round($scale_num, 0);
+			}
+		$LENscale_num = (strlen($scale_num));
+		$k = ($k + $LENscale_num);
+		$call_scale .= "$scale_num";
+		}
+	else
+		{
+		$call_scale .= " ";
+		$k++;   $Mk++;
+		}
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+$ZZ = '00';
+$i=0;
+$h=4;
+$hour= -1;
+$no_lines_yet=1;
+
+while ($i <= 96)
+	{
+	$char_counter=0;
+	$time = '      ';
+	if ($h >= 4) 
+		{
+		$hour++;
+		$h=0;
+		if ($hour < 10) {$hour = "0$hour";}
+		$time = "+$hour$ZZ+";
+		}
+	if ($h == 1) {$time = "   15 ";}
+	if ($h == 2) {$time = "   30 ";}
+	if ($h == 3) {$time = "   45 ";}
+	$Ghour_count = $hour_count[$i];
+	if ($Ghour_count < 1) 
+		{
+		if ( ($no_lines_yet) or ($i > $last_full_record) )
+			{
+			$do_nothing=1;
+			}
+		else
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			echo "|$time|";
+			$k=0;   while ($k <= 102) {echo " ";   $k++;}
+			echo "| $hour_count[$i] |\n";
+			}
+		}
+	else
+		{
+		$no_lines_yet=0;
+		$Xhour_count = ($Ghour_count * $hour_multiplier);
+		$Yhour_count = (99 - $Xhour_count);
+
+		$Gdrop_count = $drop_count[$i];
+		if ($Gdrop_count < 1) 
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "*X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 101) {echo " ";   $char_counter++;}
+			echo "| 0     | $hour_count[$i] |\n";
+
+			}
+		else
+			{
+			$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+		#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+			$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+			echo "D";   $char_counter++;
+			$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 102) {echo " ";   $char_counter++;}
+			echo "| $drop_count[$i] | $hour_count[$i] |\n";
+			}
+		}
+	
+	
+	$i++;
+	$h++;
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n\n";
+
+
+
+
+
+$ENDtime = date("U");
+$RUNtime = ($ENDtime - $STARTtime);
+echo "\nRun Time: $RUNtime seconds\n";
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_VDADstats.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_VDADstats.php new file mode 100644 index 00000000..6ea7520a --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_VDADstats.php @@ -0,0 +1,652 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1718 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 61215-1139 - Added drop percentage of answered and round-2 decimal +# 71008-1436 - Added shift to be defined in dbconnect.php +# 71218-1155 - added end_date for multi-day reports +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["end_date"])) {$end_date=$_GET["end_date"];} + elseif (isset($_POST["end_date"])) {$end_date=$_POST["end_date"];} +if (isset($_GET["shift"])) {$shift=$_GET["shift"];} + elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +if (strlen($shift)<2) {$shift='ALL';} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = '';} +if (!isset($query_date)) {$query_date = $NOW_DATE;} +if (!isset($end_date)) {$end_date = $NOW_DATE;} + +$stmt="select campaign_id from vicidial_campaigns;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: VDAD Stats\n"; +echo "
\n"; +echo "\n"; +echo " to \n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "           MODIFY | REPORTS \n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "PLEASE SELECT A CAMPAIGN AND DATE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$time_BEGIN=$AM_shift_BEGIN;
+	$time_END=$AM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "03:45:00";}   
+	if (strlen($time_END) < 6) {$time_END = "15:15:00";}
+	}
+if ($shift == 'PM') 
+	{
+	$time_BEGIN=$PM_shift_BEGIN;
+	$time_END=$PM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "15:15:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:15:00";}
+	}
+if ($shift == 'ALL') 
+	{
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "00:00:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:59:59";}
+	}
+$query_date_BEGIN = "$query_date $time_BEGIN";   
+$query_date_END = "$end_date $time_END";
+
+
+
+echo "VICIDIAL: Auto-dial Stats                             $NOW_TIME\n";
+
+echo "\n";
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{$average_hold_seconds = '         0';}
+else
+	{
+	$average_hold_seconds = ($row[1] / $row[0]);
+	$average_hold_seconds = round($average_hold_seconds, 2);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+echo "Total Calls placed from this Campaign:        $TOTALcalls\n";
+echo "Average Call Length for all Calls in seconds: $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP' and (length_in_sec <= 60 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$DROPcalls =	sprintf("%10s", $row[0]);
+$DROPcallsRAW =	$row[0];
+$DROPseconds =	$row[1];
+
+$stmt="select count(*) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and status NOT IN('NA','B');";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$ANSWERcalls =	$row[0];
+
+if ( ($DROPcalls < 1) or ($TOTALcalls < 1) )
+	{$DROPpercent = '0';}
+else
+	{
+	$DROPpercent = (($DROPcallsRAW / $TOTALcalls) * 100);
+	$DROPpercent = round($DROPpercent, 2);
+	}
+
+if ( ($DROPcalls < 1) or ($ANSWERcalls < 1) )
+	{$DROPANSWERpercent = '0';}
+else
+	{
+	$DROPANSWERpercent = (($DROPcallsRAW / $ANSWERcalls) * 100);
+	$DROPANSWERpercent = round($DROPANSWERpercent, 2);
+	}
+
+if ( ($DROPseconds < 1) or ($DROPcallsRAW < 1) )
+	{$average_hold_seconds = '         0';}
+else
+	{
+	$average_hold_seconds = ($DROPseconds / $DROPcallsRAW);
+	$average_hold_seconds = round($average_hold_seconds, 2);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+
+echo "Total DROP Calls:                             $DROPcalls  $DROPpercent%\n";
+echo "Percent of DROP Calls taken out of Answers:   $DROPcalls / $ANSWERcalls  $DROPANSWERpercent%\n";
+echo "Average Length for DROP Calls in seconds:     $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- AUTO-DIAL NO ANSWERS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and status IN('NA','B') and (length_in_sec <= 60 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$NAcalls =	sprintf("%10s", $row[0]);
+if ( ($NAcalls < 1) or ($TOTALcalls < 1) )
+	{$NApercent = '0';}
+else
+	{
+	$NApercent = (($NAcalls / $TOTALcalls) * 100);
+	$NApercent = round($NApercent, 2);
+	}
+
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{$average_na_seconds = '         0';}
+else
+	{
+	$average_na_seconds = ($row[1] / $row[0]);
+	$average_na_seconds = round($average_na_seconds, 2);
+	$average_na_seconds =	sprintf("%10s", $average_na_seconds);
+	}
+
+echo "Total NA calls -Busy,Disconnect,RingNoAnswer: $NAcalls  $NApercent%\n";
+echo "Average Call Length for NA Calls in seconds:  $average_na_seconds\n";
+
+
+##############################
+#########  CALL STATUS STATS
+
+$TOTALcalls = 0;
+
+echo "\n";
+echo "---------- CALL STATUS STATS\n";
+echo "+--------+----------------------+------------+\n";
+echo "| STATUS | DESCRIPTION          | CALLS      |\n";
+echo "+--------+----------------------+------------+\n";
+
+$stmt="SELECT * from vicidial_statuses order by status";
+$rslt=mysql_query($stmt, $link);
+$statuses_to_print = mysql_num_rows($rslt);
+$statuses_list='';
+
+$o=0;
+while ($statuses_to_print > $o) 
+	{
+	$rowx=mysql_fetch_row($rslt);
+	$statname_list["$rowx[0]"] = "$rowx[1]";
+	$o++;
+	}
+
+$stmt="SELECT * from vicidial_campaign_statuses where campaign_id='" . mysql_real_escape_string($group) . "' order by status";
+$rslt=mysql_query($stmt, $link);
+$Cstatuses_to_print = mysql_num_rows($rslt);
+
+$o=0;
+while ($Cstatuses_to_print > $o) 
+	{
+	$rowx=mysql_fetch_row($rslt);
+	$statname_list["$rowx[0]"] = "$rowx[1]";
+	$o++;
+	}
+
+$stmt="select count(*),status from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysql_real_escape_string($group) . "' group by status;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$statuses_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $statuses_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$TOTALcalls = ($TOTALcalls + $row[0]);
+
+	$STATUScount =	sprintf("%10s", $row[0]);while(strlen($STATUScount)>10) {$STATUScount = substr("$STATUScount", 0, -1);}
+	$RAWstatus = $row[1];
+	$status =	sprintf("%-6s", $row[1]);while(strlen($status)>6) {$status = substr("$status", 0, -1);}
+
+	if ($non_latin < 1)
+		{
+		 $status_name =	sprintf("%-20s", $statname_list[$RAWstatus]); 
+		 while(strlen($status_name)>20) {$status_name = substr("$status_name", 0, -1);}	
+		}
+	else
+		{
+		 $status_name =	sprintf("%-60s", $statname_list[$RAWstatus]); 
+		 while(mb_strlen($status_name,'utf-8')>20) {$status_name = mb_substr("$status_name", 0, -1,'utf-8');}	
+		}
+
+
+	echo "| $status | $status_name | $STATUScount |\n";
+
+	$i++;
+	}
+
+$TOTALcalls =		sprintf("%10s", $TOTALcalls);
+
+echo "+--------+----------------------+------------+\n";
+echo "| TOTAL:                        | $TOTALcalls |\n";
+echo "+-------------------------------+------------+\n";
+
+
+##############################
+#########  USER STATS
+
+$TOTagents=0;
+$TOTcalls=0;
+$TOTtime=0;
+$TOTavg=0;
+
+echo "\n";
+echo "---------- AGENT STATS\n";
+echo "+--------------------------+------------+----------+--------+\n";
+echo "| AGENT                    | CALLS      | TIME M   | AVRG M |\n";
+echo "+--------------------------+------------+----------+--------+\n";
+
+$stmt="select vicidial_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_log,vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysql_real_escape_string($group) . "' and vicidial_log.user is not null and length_in_sec is not null and length_in_sec > 4 and vicidial_log.user=vicidial_users.user group by vicidial_log.user;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$TOTcalls = ($TOTcalls + $row[2]);
+	$TOTtime = ($TOTtime + $row[3]);
+
+	$user =	sprintf("%-6s", $row[0]);while(strlen($user)>6) {$user = substr("$user", 0, -1);}
+	if ($non_latin < 1)
+	{
+ 	 $full_name =	sprintf("%-15s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}	
+	}
+	else
+	{
+	 $full_name =	sprintf("%-45s", $row[1]); while(mb_strlen($full_name,'utf-8')>15) {$full_name = mb_substr("$full_name", 0, -1,'utf-8');}	
+	}
+	$USERcalls =	sprintf("%10s", $row[2]);
+	$USERtotTALK =	$row[3];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$USERtotTALK_MS =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $user - $full_name | $USERcalls |   $USERtotTALK_MS | $USERavgTALK_MS |\n";
+
+	$i++;
+	}
+
+if (!$TOTcalls) {$TOTcalls = 1;}
+$TOTavg = ($TOTtime / $TOTcalls);
+$TOTavg = round($TOTavg, 0);
+$TOTavg_M = ($TOTavg / 60);
+$TOTavg_M = round($TOTavg_M, 2);
+$TOTavg_M_int = intval("$TOTavg_M");
+$TOTavg_S = ($TOTavg_M - $TOTavg_M_int);
+$TOTavg_S = ($TOTavg_S * 60);
+$TOTavg_S = round($TOTavg_S, 0);
+if ($TOTavg_S < 10) {$TOTavg_S = "0$TOTavg_S";}
+$TOTavg_MS = "$TOTavg_M_int:$TOTavg_S";
+$TOTavg =		sprintf("%6s", $TOTavg_MS);
+
+$TOTtime_M = ($TOTtime / 60);
+$TOTtime_M = 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 ($TOTtime_S < 10) {$TOTtime_S = "0$TOTtime_S";}
+$TOTtime_MS = "$TOTtime_M_int:$TOTtime_S";
+$TOTtime =		sprintf("%6s", $TOTtime_MS);
+
+$TOTagents =		sprintf("%10s", $i);
+$TOTcalls =			sprintf("%10s", $TOTcalls);
+$TOTtime =			sprintf("%8s", $TOTtime);
+$TOTavg =			sprintf("%6s", $TOTavg);
+
+$stmt="select avg(wait_sec) from vicidial_agent_log where event_time >= '$query_date_BEGIN' and event_time <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$AVGwait = $row[0];
+$AVGwait_M = ($AVGwait / 60);
+$AVGwait_M = round($AVGwait_M, 2);
+$AVGwait_M_int = intval("$AVGwait_M");
+$AVGwait_S = ($AVGwait_M - $AVGwait_M_int);
+$AVGwait_S = ($AVGwait_S * 60);
+$AVGwait_S = round($AVGwait_S, 0);
+if ($AVGwait_S < 10) {$AVGwait_S = "0$AVGwait_S";}
+$AVGwait_MS = "$AVGwait_M_int:$AVGwait_S";
+$AVGwait =		sprintf("%6s", $AVGwait_MS);
+
+echo "+--------------------------+------------+----------+--------+\n";
+echo "| TOTAL Agents: $TOTagents | $TOTcalls | $TOTtime | $TOTavg |\n";
+echo "+--------------------------+------------+----------+--------+\n";
+echo "| Average Wait time between calls                    $AVGwait |\n";
+echo "+-----------------------------------------------------------+\n";
+
+##############################
+#########  TIME STATS
+
+echo "\n";
+echo "---------- TIME STATS\n";
+
+echo "\n";
+
+$hi_hour_count=0;
+$last_full_record=0;
+$i=0;
+$h=0;
+while ($i <= 96)
+	{
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+	$h++;
+	}
+
+if ($hi_hour_count < 1)
+	{$hour_multiplier = 0;}
+else
+	{
+	$hour_multiplier = (100 / $hi_hour_count);
+	#$hour_multiplier = round($hour_multiplier, 0);
+	}
+
+echo "\n";
+echo "GRAPH IN 15 MINUTE INCREMENTS OF TOTAL CALLS PLACED FROM THIS CAMPAIGN\n";
+
+$k=1;
+$Mk=0;
+$call_scale = '0';
+while ($k <= 102) 
+	{
+	if ($Mk >= 5) 
+		{
+		$Mk=0;
+		if ( ($k < 1) or ($hour_multiplier <= 0) )
+			{$scale_num = 100;}
+		else
+			{
+			$scale_num=($k / $hour_multiplier);
+			$scale_num = round($scale_num, 0);
+			}
+		$LENscale_num = (strlen($scale_num));
+		$k = ($k + $LENscale_num);
+		$call_scale .= "$scale_num";
+		}
+	else
+		{
+		$call_scale .= " ";
+		$k++;   $Mk++;
+		}
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+$ZZ = '00';
+$i=0;
+$h=4;
+$hour= -1;
+$no_lines_yet=1;
+
+while ($i <= 96)
+	{
+	$char_counter=0;
+	$time = '      ';
+	if ($h >= 4) 
+		{
+		$hour++;
+		$h=0;
+		if ($hour < 10) {$hour = "0$hour";}
+		$time = "+$hour$ZZ+";
+		}
+	if ($h == 1) {$time = "   15 ";}
+	if ($h == 2) {$time = "   30 ";}
+	if ($h == 3) {$time = "   45 ";}
+	$Ghour_count = $hour_count[$i];
+	if ($Ghour_count < 1) 
+		{
+		if ( ($no_lines_yet) or ($i > $last_full_record) )
+			{
+			$do_nothing=1;
+			}
+		else
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			echo "|$time|";
+			$k=0;   while ($k <= 102) {echo " ";   $k++;}
+			echo "| $hour_count[$i] |\n";
+			}
+		}
+	else
+		{
+		$no_lines_yet=0;
+		$Xhour_count = ($Ghour_count * $hour_multiplier);
+		$Yhour_count = (99 - $Xhour_count);
+
+		$Gdrop_count = $drop_count[$i];
+		if ($Gdrop_count < 1) 
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "*X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 101) {echo " ";   $char_counter++;}
+			echo "| 0     | $hour_count[$i] |\n";
+
+			}
+		else
+			{
+			$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+		#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+			$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+			echo "D";   $char_counter++;
+			$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 102) {echo " ";   $char_counter++;}
+			echo "| $drop_count[$i] | $hour_count[$i] |\n";
+			}
+		}
+	
+	
+	$i++;
+	$h++;
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+
+
+
+
+
+$ENDtime = date("U");
+$RUNtime = ($ENDtime - $STARTtime);
+echo "\nRun Time: $RUNtime seconds\n";
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_VICIDIAL_hopperlist.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_VICIDIAL_hopperlist.php new file mode 100644 index 00000000..a30832be --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_VICIDIAL_hopperlist.php @@ -0,0 +1,169 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1654 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 70115-1614 - Added ALT field for vicidial_hopper alt_dial column +# 71029-0852 - Added list_id to the output +# 71030-2118 - Added priority to display +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and modify_campaigns='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = '';} +if (!isset($query_date)) {$query_date = $NOW_DATE;} +if (!isset($server_ip)) {$server_ip = '10.10.10.15';} + +$stmt="select campaign_id,campaign_name from vicidial_campaigns order by campaign_id;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$campaigns_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $campaigns_to_print) + { + $row=mysql_fetch_row($rslt); + $campaign_id[$i] =$row[0]; + $campaign_name[$i] =$row[1]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: Hopper List\n"; +echo "
\n"; +#echo "\n"; +#echo "\n"; +echo "\n"; +echo "\n"; +echo "           MODIFY \n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "PLEASE SELECT A CAMPAIGN ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+
+
+echo "VICIDIAL: Live Current Hopper List                      $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+
+echo "Total leads in hopper right now:       $TOTALcalls\n";
+
+
+##############################
+#########  LEAD STATS
+
+echo "\n";
+echo "---------- LEADS IN HOPPER\n";
+echo "+------+--------+-----------+------------+------------+-------+--------+-------+--------+-------+\n";
+echo "|ORDER |PRIORITY| LEAD ID   | LIST ID    | PHONE NUM  | STATE | STATUS | COUNT | GMT    | ALT   |\n";
+echo "+------+--------+-----------+------------+------------+-------+--------+-------+--------+-------+\n";
+
+$stmt="select vicidial_hopper.lead_id,phone_number,vicidial_hopper.state,vicidial_list.status,called_count,vicidial_hopper.gmt_offset_now,hopper_id,alt_dial,vicidial_hopper.list_id,vicidial_hopper.priority from vicidial_hopper,vicidial_list where vicidial_hopper.campaign_id='" . mysql_real_escape_string($group) . "' and vicidial_hopper.lead_id=vicidial_list.lead_id order by priority desc,hopper_id limit 2000;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$FMT_i =		sprintf("%-4s", $i);
+	$lead_id =		sprintf("%-9s", $row[0]);
+	$phone_number =	sprintf("%-10s", $row[1]);
+	$state =		sprintf("%-5s", $row[2]);
+	$status =		sprintf("%-6s", $row[3]);
+	$count =		sprintf("%-5s", $row[4]);
+	$gmt =			sprintf("%-6s", $row[5]);
+	$hopper_id =	sprintf("%-6s", $row[6]);
+	$alt_dial =		sprintf("%-5s", $row[7]);
+	$list_id =		sprintf("%-10s", $row[8]);
+	$priority =		sprintf("%-6s", $row[9]);
+
+if ($DB) {echo "| $FMT_i | $priority | $lead_id | $list_id | $phone_number | $state | $status | $count | $gmt | $hopper_id |\n";}
+else {echo "| $FMT_i | $priority | $lead_id | $list_id | $phone_number | $state | $status | $count | $gmt | $alt_dial |\n";}
+
+	$i++;
+	}
+
+echo "+------+--------+-----------+------------+------------+-------+--------+-------+--------+-------+\n";
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_admin_log_display.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_admin_log_display.php new file mode 100644 index 00000000..9c5c4af6 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_admin_log_display.php @@ -0,0 +1,118 @@ + LICENSE: GPLv2 +### + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); +$query_date = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$query_date); + +# AST GUI database administration +# AST_admin_log_display.php +# +# CHANGES +# 50325-0932 - First build +# 51123-1443 - removed globals=on requirement +# 60421-1229 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60620-1044 - Added variable filtering to eliminate SQL injection attack threat +# + +$version = '0.0.4'; +$build = '60620-1044'; + +$STARTtime = date("U"); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 8 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDIAL ADMIN LOG DISPLAY"; +echo "\n"; + +# Fri, 25 Mar 2005 + +$DAY_DATE = date("j"); +if ($DAY_DATE < 10) +# {$GREP_DATE = date("D, j M Y");} + {$GREP_DATE = date("D, 0j M Y");} +else + {$GREP_DATE = date("D, j M Y");} + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!$query_date) {$query_date = $GREP_DATE;} + +$Gquery_date = eregi_replace(" ",'\ ',$query_date); +echo "\n"; + +echo "
\n"; +echo "\n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+echo "VICIDIAL ADMIN CHANGE LOG                             $NOW_TIME\n";
+
+#passthru("grep $Gquery_date /home/www/htdocs/vicidial/admin_changes_log.txt");
+passthru("grep $Gquery_date $WeBServeRRooT/vicidial/admin_changes_log.txt");
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_agent_disposition.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_agent_disposition.php new file mode 100644 index 00000000..b0b0a461 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_agent_disposition.php @@ -0,0 +1,237 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 70201-1213 - First build - from Marin Blu +# +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["shift"])) {$shift=$_GET["shift"];} + elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = '';} +if (!isset($begin_date)) {$begin_date = $NOW_DATE;} +if (!isset($end_date)) {$end_date = $NOW_DATE;} + +$stmt="select campaign_id from vicidial_campaigns;"; +if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$campaigns_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $campaigns_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: Agent Disposition\n"; +echo "
\n"; +echo "Date - From: to \n"; +echo "  \n"; +echo "\n"; +echo "\n"; +echo "           MODIFY | REPORTS \n"; +echo "\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A SERVER AND DATE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+
+echo "VICIDIAL: Agent Disposition                             $NOW_TIME\n";
+
+echo "Time range: $begin_date to $end_date \n\n";
+echo "---------- Disposition Details -------------\n\n";
+
+echo "+-----------------+------------+--------+--------+--------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+\n";
+echo "| USER NAME       | ID         | CALLS  | TALK   | TALKAVG| A    | B    |CALLBK|CBHOLD| DEC  | DC   | DNC  | DROP |INCALL| LB   | N    | NA   | NI   | NP   | NQ   |QUEUE | SALE | XFER |\n";
+echo "+-----------------+------------+--------+--------+--------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+\n";
+
+$stmt="select count(*) as calls,sum(length_in_sec) as talk,full_name,vicidial_users.user,avg(length_in_sec) from vicidial_users,vicidial_log where call_date >= '$begin_date 00:00:01' and call_date <= '$end_date 23:59:59'  and vicidial_users.user=vicidial_log.user and campaign_id='" . mysql_real_escape_string($group) . "' group by full_name order by calls desc limit 1000;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$TOTcalls=($TOTcalls + $row[0]);
+	$TOTtotTALK=($TOTtotTALK + $row[1]);
+	$calls[$i] =	sprintf("%-6s", $row[0]);
+	$full_name[$i]=	sprintf("%-15s", $row[2]); while(strlen($full_name[$i])>15) {$full_name[$i] = substr("$full_name[$i]", 0, -1);}
+	$user[$i] =		sprintf("%-10s", $row[3]); while(strlen($user[$i])>10) {$user[$i] = substr("$user[$i]", 0, -1);}
+	$USERtotTALK =	$row[1];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$pfUSERtotTALK_MS[$i] =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$pfUSERavgTALK_MS[$i] =		sprintf("%6s", $USERavgTALK_MS);
+	$i++;
+	}
+	
+$k=0;
+
+while($k < $i)
+	
+	{
+	$ctA[$k]="0   "; $ctB[$k]="0   "; $ctDC[$k]="0   "; $ctDNC[$k]="0   "; $ctN[$k]="0   "; $ctNI[$k]="0   "; $ctSALE[$k]="0   ";  $ctINCALL[$k]="0   ";  $ctDROP[$k]="0   ";  $ctQUEUE[$k]="0   ";  $ctNP[$k]="0   ";   $ctDEC[$k]="0   ";  $ctNQ[$k]="0   ";  $ctNA[$k]="0   ";   $ctXFER[$k]="0   "; $ctLB[$k]="0   ";  $ctCALLBK[$k]="0   "; $ctCBHOLD[$k]="0   ";
+	$stmt="select count(*),status from vicidial_log where call_date >= '$begin_date 00:00:01' and call_date <= '$end_date 23:59:59'  and user='$user[$k]' and campaign_id='" . mysql_real_escape_string($group) . "' group by status;";
+	if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$rows_to_print = mysql_num_rows($rslt);
+	$m=0;
+	while ($m < $rows_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if ($row[1] == 'A') {$ctA[$k]=sprintf("%-4s", $row[0]);		$TOT_A = ($TOT_A + $row[0]);}
+		if ($row[1] == 'B') {$ctB[$k]=sprintf("%-4s", $row[0]);		$TOT_B = ($TOT_B + $row[0]);}
+		if ($row[1] == 'DC') {$ctDC[$k]=sprintf("%-4s", $row[0]);	$TOT_DC = ($TOT_DC + $row[0]);}
+		if ($row[1] == 'DNC') {$ctDNC[$k]=sprintf("%-4s", $row[0]);	$TOT_DNC = ($TOT_DNC + $row[0]);}
+		if ($row[1] == 'N') {$ctN[$k]=sprintf("%-4s", $row[0]);		$TOT_N = ($TOT_N + $row[0]);}
+		if ($row[1] == 'NI') {$ctNI[$k]=sprintf("%-4s", $row[0]);	$TOT_NI = ($TOT_NI + $row[0]);}
+		if ($row[1] == 'SALE') {$ctSALE[$k]=sprintf("%-4s", $row[0]);	$TOT_SALE = ($TOT_SALE + $row[0]);}
+		if ($row[1] == 'INCALL') {$ctINCALL[$k]=sprintf("%-4s", $row[0]);	$TOT_INCALL = ($TOT_INCALL + $row[0]);}
+		if ($row[1] == 'DROP') {$ctDROP[$k]=sprintf("%-4s", $row[0]);	$TOT_DROP = ($TOT_DROP + $row[0]);}
+		if ($row[1] == 'QUEUE') {$ctQUEUE[$k]=sprintf("%-4s", $row[0]);	$TOT_QUEUE = ($TOT_QUEUE + $row[0]);}
+		if ($row[1] == 'NP') {$ctNP[$k]=sprintf("%-4s", $row[0]);	$TOT_NP = ($TOT_NP + $row[0]);}
+		if ($row[1] == 'DEC') {$ctDEC[$k]=sprintf("%-4s", $row[0]);	$TOT_DEC = ($TOT_DEC + $row[0]);}
+		if ($row[1] == 'NQ') {$ctNQ[$k]=sprintf("%-4s", $row[0]);	$TOT_NQ = ($TOT_NQ + $row[0]);}
+		if ($row[1] == 'NA') {$ctNA[$k]=sprintf("%-4s", $row[0]);	$TOT_NA = ($TOT_NA + $row[0]);}
+		if ($row[1] == 'XFER') {$ctXFER[$k]=sprintf("%-4s", $row[0]);	$TOT_XFER = ($TOT_XFER + $row[0]);}
+		if ($row[1] == 'LB') {$ctLB[$k]=sprintf("%-4s", $row[0]);	$TOT_LB = ($TOT_LB + $row[0]);}
+		if ($row[1] == 'CALLBK') {$ctCALLBK[$k]=sprintf("%-4s", $row[0]);	$TOT_CALLBK = ($TOT_CALLBK + $row[0]);}
+		if ($row[1] == 'CBHOLD') {$ctCBHOLD[$k]=sprintf("%-4s", $row[0]);	$TOT_CBHOLD = ($TOT_CBHOLD + $row[0]);}
+		$m++;
+		}
+	echo "| $full_name[$k] | $user[$k] | $calls[$k] | $pfUSERtotTALK_MS[$k] | $pfUSERavgTALK_MS[$k] | $ctA[$k] | $ctB[$k] | $ctCALLBK[$k] | $ctCBHOLD[$k] | $ctDEC[$k] | $ctDC[$k] | $ctDNC[$k] | $ctDROP[$k] | $ctINCALL[$k] | $ctLB[$k] | $ctN[$k] | $ctNA[$k] | $ctNI[$k] | $ctNP[$k] | $ctNQ[$k] | $ctQUEUE[$k] | $ctSALE[$k] | $ctXFER[$k] | \n";
+
+	$k++;
+	}
+
+	$TOTcalls =	sprintf("%-7s", $TOTcalls);
+
+	$TOTtotTALK_M = ($TOTtotTALK / 60);
+	$TOTtotTALK_M = round($TOTtotTALK_M, 2);
+	$TOTtotTALK_M_int = intval("$TOTtotTALK_M");
+	$TOTtotTALK_S = ($TOTtotTALK_M - $TOTtotTALK_M_int);
+	$TOTtotTALK_S = ($TOTtotTALK_S * 60);
+	$TOTtotTALK_S = round($TOTtotTALK_S, 0);
+	if ($TOTtotTALK_S < 10) {$TOTtotTALK_S = "0$TOTtotTALK_S";}
+	$TOTtotTALK_MS = "$TOTtotTALK_M_int:$TOTtotTALK_S";
+	$TOTtotTALK_MS =		sprintf("%7s", $TOTtotTALK_MS);
+		while(strlen($TOTtotTALK_MS)>7) {$TOTtotTALK_MS = substr("$TOTtotTALK_MS", 0, -1);}
+
+	$TOT_A = sprintf("%-5s", $TOT_A);
+	$TOT_B = sprintf("%-5s", $TOT_B);
+	$TOT_DC = sprintf("%-5s", $TOT_DC);
+	$TOT_DNC = sprintf("%-5s", $TOT_DNC);
+	$TOT_N = sprintf("%-5s", $TOT_N);
+	$TOT_NI = sprintf("%-5s", $TOT_NI);
+	$TOT_SALE = sprintf("%-5s", $TOT_SALE);
+	$TOT_INCALL = sprintf("%-5s", $TOT_INCALL);
+	$TOT_DROP = sprintf("%-5s", $TOT_DROP); 
+	$TOT_QUEUE = sprintf("%-5s", $TOT_QUEUE);
+	$TOT_NP = sprintf("%-5s", $TOT_NP);
+	$TOT_DEC = sprintf("%-5s", $TOT_DEC);
+	$TOT_NQ = sprintf("%-5s", $TOT_NQ);
+	$TOT_NA = sprintf("%-5s", $TOT_NA);
+	$TOT_XFER = sprintf("%-5s", $TOT_XFER);
+	$TOT_LB= sprintf("%-5s", $TOT_LB);
+	$TOT_CALLBK = sprintf("%-5s", $TOT_CALLBK);
+	$TOT_CBHOLD = sprintf("%-5s", $TOT_CBHOLD);
+
+echo "+-----------------+------------+--------+--------+--------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+\n";
+echo "|  TOTALS                      | $TOTcalls| $TOTtotTALK_MS|        | $TOT_A| $TOT_B| $TOT_CALLBK| $TOT_CBHOLD| $TOT_DEC| $TOT_DC| $TOT_DNC| $TOT_DROP| $TOT_INCALL| $TOT_LB| $TOT_N| $TOT_NA| $TOT_NI| $TOT_NP| $TOT_NQ| $TOT_QUEUE| $TOT_SALE| $TOT_XFER|\n";
+echo "+-----------------+------------+--------+--------+--------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+\n";
+echo "\n";
+
+}
+?>
+
\ No newline at end of file
diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_agent_performance.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_agent_performance.php
new file mode 100644
index 00000000..eb2ceac4
--- /dev/null
+++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_agent_performance.php
@@ -0,0 +1,257 @@
+    LICENSE: GPLv2
+###
+# CHANGES
+#
+# 60619-1711 - Added variable filtering to eliminate SQL injection attack threat
+#            - Added required user/pass to gain access to this page
+# 70201-1203 - Added non_latin UTF8 output code, widened USER ID to 8 chars
+#
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+if (isset($_GET["group"]))				{$group=$_GET["group"];}
+	elseif (isset($_POST["group"]))		{$group=$_POST["group"];}
+if (isset($_GET["query_date"]))				{$query_date=$_GET["query_date"];}
+	elseif (isset($_POST["query_date"]))		{$query_date=$_POST["query_date"];}
+if (isset($_GET["shift"]))				{$shift=$_GET["shift"];}
+	elseif (isset($_POST["shift"]))		{$shift=$_POST["shift"];}
+if (isset($_GET["submit"]))				{$submit=$_GET["submit"];}
+	elseif (isset($_POST["submit"]))		{$submit=$_POST["submit"];}
+if (isset($_GET["SUBMIT"]))				{$SUBMIT=$_GET["SUBMIT"];}
+	elseif (isset($_POST["SUBMIT"]))		{$SUBMIT=$_POST["SUBMIT"];}
+
+$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
+$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
+
+	$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
+	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($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
+	{
+    Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
+    Header("HTTP/1.0 401 Unauthorized");
+    echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
+    exit;
+	}
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!isset($group)) {$group = '';}
+if (!isset($query_date)) {$query_date = $NOW_DATE;}
+
+$stmt="select campaign_id from vicidial_campaigns;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$campaigns_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $campaigns_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$groups[$i] =$row[0];
+	$i++;
+	}
+?>
+
+
+
+
+
+\n";
+echo "VICIDIAL: Agent Performance\n";
+echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "           MODIFY | REPORTS \n"; +echo "
\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A SERVER AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
+echo " NOTE: stats taken from 6 hour shift specified\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$query_date_BEGIN = "$query_date 08:45:00";   
+	$query_date_END = "$query_date 15:33:00";
+	$time_BEGIN = "08:45:00";   
+	$time_END = "15:33:00";
+	}
+if ($shift == 'PM') 
+	{
+	$query_date_BEGIN = "$query_date 15:33:00";   
+	$query_date_END = "$query_date 23:15:00";
+	$time_BEGIN = "15:33:00";   
+	$time_END = "23:15:00";
+	}
+
+echo "VICIDIAL: Agent Performance                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENTS Details -------------\n\n";
+
+echo "+-----------------+----------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+echo "| USER NAME       | ID       | CALLS  | TALK   | TALKAVG| A    | B    | DC   | DNC  | N    | NI   | SALE |\n";
+echo "+-----------------+----------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+
+$stmt="select count(*) as calls,sum(length_in_sec) as talk,full_name,vicidial_users.user,avg(length_in_sec) from vicidial_users,vicidial_log where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN' and vicidial_users.user=vicidial_log.user and campaign_id='" . mysql_real_escape_string($group) . "' group by full_name order by calls desc limit 1000;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$TOTcalls=($TOTcalls + $row[0]);
+	$TOTtotTALK=($TOTtotTALK + $row[1]);
+	$calls[$i] =	sprintf("%-6s", $row[0]);
+
+	if ($non_latin < 1)
+	{
+   	 $full_name[$i]=	sprintf("%-15s", $row[2]); 
+	 while(strlen($full_name[$i])>15) {$full_name[$i] = substr("$full_name[$i]", 0, -1);}
+
+	 $user[$i] =		sprintf("%-6s", $row[3]);
+        while(strlen($user[$i])>6) {$user[$i] = substr("$user[$i]", 0, -1);}
+       }
+	else
+	{	
+        $full_name[$i]=	sprintf("%-45s", $row[2]); 
+	 while(mb_strlen($full_name[$i],'utf-8')>15) {$full_name[$i] = mb_substr("$full_name[$i]", 0, -1,'utf-8');}
+
+ 	 $user[$i] =		sprintf("%-18s", $row[3]);
+	 while(mb_strlen($user[$i],'utf-8')>6) {$user[$i] = mb_substr("$user[$i]", 0, -1,'utf-8');}
+	}
+
+	$user[$i] =		sprintf("%-8s", $row[3]);
+	$USERtotTALK =	$row[1];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$pfUSERtotTALK_MS[$i] =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$pfUSERavgTALK_MS[$i] =		sprintf("%6s", $USERavgTALK_MS);
+	$i++;
+	}
+
+$k=0;
+while($k < $i)
+	{
+	$ctA[$k]="0   "; $ctB[$k]="0   "; $ctDC[$k]="0   "; $ctDNC[$k]="0   "; $ctN[$k]="0   "; $ctNI[$k]="0   "; $ctSALE[$k]="0   "; 
+	$stmt="select count(*),status from vicidial_log where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN' and user='$user[$k]' and campaign_id='" . mysql_real_escape_string($group) . "' group by status;";
+	if ($non_latin > 0)
+	{
+	$rslt=mysql_query("SET NAMES 'UTF8'");
+	}
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$rows_to_print = mysql_num_rows($rslt);
+	$m=0;
+	while ($m < $rows_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		if ($row[1] == 'A') {$ctA[$k]=sprintf("%-4s", $row[0]);		$TOT_A = ($TOT_A + $row[0]);}
+		if ($row[1] == 'B') {$ctB[$k]=sprintf("%-4s", $row[0]);		$TOT_B = ($TOT_B + $row[0]);}
+		if ($row[1] == 'DC') {$ctDC[$k]=sprintf("%-4s", $row[0]);	$TOT_DC = ($TOT_DC + $row[0]);}
+		if ($row[1] == 'DNC') {$ctDNC[$k]=sprintf("%-4s", $row[0]);	$TOT_DNC = ($TOT_DNC + $row[0]);}
+		if ($row[1] == 'N') {$ctN[$k]=sprintf("%-4s", $row[0]);		$TOT_N = ($TOT_N + $row[0]);}
+		if ($row[1] == 'NI') {$ctNI[$k]=sprintf("%-4s", $row[0]);	$TOT_NI = ($TOT_NI + $row[0]);}
+		if (($row[1] == 'SALE') || ($row[1] == 'XFER') ) {$ctSALE[$k]=sprintf("%-4s", $row[0]);	$TOT_SALE = ($TOT_SALE + $row[0]);}
+		$m++;
+		}
+	echo "| $full_name[$k] | $user[$k] | $calls[$k] | $pfUSERtotTALK_MS[$k] | $pfUSERavgTALK_MS[$k] | $ctA[$k] | $ctB[$k] | $ctDC[$k] | $ctDNC[$k] | $ctN[$k] | $ctNI[$k] | $ctSALE[$k] |\n";
+
+
+
+	$k++;
+	}
+
+	$TOTcalls =	sprintf("%-7s", $TOTcalls);
+
+	$TOTtotTALK_M = ($TOTtotTALK / 60);
+	$TOTtotTALK_M = round($TOTtotTALK_M, 2);
+	$TOTtotTALK_M_int = intval("$TOTtotTALK_M");
+	$TOTtotTALK_S = ($TOTtotTALK_M - $TOTtotTALK_M_int);
+	$TOTtotTALK_S = ($TOTtotTALK_S * 60);
+	$TOTtotTALK_S = round($TOTtotTALK_S, 0);
+	if ($TOTtotTALK_S < 10) {$TOTtotTALK_S = "0$TOTtotTALK_S";}
+	$TOTtotTALK_MS = "$TOTtotTALK_M_int:$TOTtotTALK_S";
+	$TOTtotTALK_MS =		sprintf("%7s", $TOTtotTALK_MS);
+		while(strlen($TOTtotTALK_MS)>7) {$TOTtotTALK_MS = substr("$TOTtotTALK_MS", 0, -1);}
+
+	$TOT_A = sprintf("%-5s", $TOT_A);
+	$TOT_B = sprintf("%-5s", $TOT_B);
+	$TOT_DC = sprintf("%-5s", $TOT_DC);
+	$TOT_DNC = sprintf("%-5s", $TOT_DNC);
+	$TOT_N = sprintf("%-5s", $TOT_N);
+	$TOT_NI = sprintf("%-5s", $TOT_NI);
+	$TOT_SALE = sprintf("%-5s", $TOT_SALE);
+
+echo "+-----------------+----------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+echo "|  TOTALS                    | $TOTcalls| $TOTtotTALK_MS|        | $TOT_A| $TOT_B| $TOT_DC| $TOT_DNC| $TOT_N| $TOT_NI| $TOT_SALE|\n";
+echo "+-----------------+----------+--------+--------+--------+------+------+------+------+------+------+------+\n";
+
+echo "\n";
+
+}
+
+
+
+?>
+
+
\ No newline at end of file
diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_agent_performance_detail.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_agent_performance_detail.php
new file mode 100644
index 00000000..0c03dbfb
--- /dev/null
+++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_agent_performance_detail.php
@@ -0,0 +1,562 @@
+    LICENSE: GPLv2
+###
+# CHANGES
+#
+# 71119-2359 - First build
+# 71121-0144 - Replace existing AST_agent_performance_detail.php script with this one
+#            - Fixed zero division bug
+# 71218-1155 - added end_date for multi-day reports
+#
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+if (isset($_GET["query_date"]))				{$query_date=$_GET["query_date"];}
+	elseif (isset($_POST["query_date"]))	{$query_date=$_POST["query_date"];}
+if (isset($_GET["end_date"]))				{$end_date=$_GET["end_date"];}
+	elseif (isset($_POST["end_date"]))		{$end_date=$_POST["end_date"];}
+if (isset($_GET["group"]))				{$group=$_GET["group"];}
+	elseif (isset($_POST["group"]))		{$group=$_POST["group"];}
+if (isset($_GET["user_group"]))				{$user_group=$_GET["user_group"];}
+	elseif (isset($_POST["user_group"]))	{$user_group=$_POST["user_group"];}
+if (isset($_GET["shift"]))				{$shift=$_GET["shift"];}
+	elseif (isset($_POST["shift"]))		{$shift=$_POST["shift"];}
+if (isset($_GET["submit"]))				{$submit=$_GET["submit"];}
+	elseif (isset($_POST["submit"]))	{$submit=$_POST["submit"];}
+if (isset($_GET["SUBMIT"]))				{$SUBMIT=$_GET["SUBMIT"];}
+	elseif (isset($_POST["SUBMIT"]))	{$SUBMIT=$_POST["SUBMIT"];}
+
+if (strlen($shift)<2) {$shift='ALL';}
+
+$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
+$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
+
+	$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
+	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($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
+	{
+    Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
+    Header("HTTP/1.0 401 Unauthorized");
+    echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
+    exit;
+	}
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!isset($group)) {$group = '';}
+if (!isset($query_date)) {$query_date = $NOW_DATE;}
+if (!isset($end_date)) {$end_date = $NOW_DATE;}
+
+$stmt="select campaign_id from vicidial_campaigns;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$campaigns_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $campaigns_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$groups[$i] =$row[0];
+	$i++;
+	}
+$stmt="select user_group from vicidial_user_groups;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$user_groups_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $user_groups_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$user_groups[$i] =$row[0];
+	$i++;
+	}
+?>
+
+
+
+
+
+\n";
+echo "VICIDIAL: Agent Performance\n";
+echo "
\n"; +echo "\n"; +echo " to \n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "           MODIFY | REPORTS \n"; +echo "
\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A CAMPAIGN AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
+echo " NOTE: stats taken from shift specified\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$time_BEGIN=$AM_shift_BEGIN;
+	$time_END=$AM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "03:45:00";}   
+	if (strlen($time_END) < 6) {$time_END = "15:15:00";}
+	}
+if ($shift == 'PM') 
+	{
+	$time_BEGIN=$PM_shift_BEGIN;
+	$time_END=$PM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "15:15:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:15:00";}
+	}
+if ($shift == 'ALL') 
+	{
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "00:00:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:59:59";}
+	}
+$query_date_BEGIN = "$query_date $time_BEGIN";   
+$query_date_END = "$end_date $time_END";
+
+if (strlen($user_group)>0) {$ugSQL="and vicidial_agent_log.user_group='$user_group'";}
+else {$ugSQL='';}
+
+echo "VICIDIAL: Agent Performance Detail                        $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENTS Details -------------\n\n";
+
+
+
+
+
+$statuses='-';
+$statusesTXT='';
+$statusesHEAD='';
+$statusesHTML='';
+$statusesARY[0]='';
+$j=0;
+$users='-';
+$usersARY[0]='';
+$user_namesARY[0]='';
+$k=0;
+
+$stmt="select count(*) as calls,sum(talk_sec) as talk,full_name,vicidial_users.user,sum(pause_sec),sum(wait_sec),sum(dispo_sec),status from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user and campaign_id='" . mysql_real_escape_string($group) . "' and pause_sec<36000 and wait_sec<36000 and talk_sec<36000 and dispo_sec<36000 $ugSQL group by full_name,status order by status desc,full_name limit 100000;";
+if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$row[0] = ($row[0] - 1);	# subtract 1 for login/logout event compensation
+	
+	$calls[$i] =		$row[0];
+	$talk_sec[$i] =		$row[1];
+	$full_name[$i] =	$row[2];
+	$user[$i] =			$row[3];
+	$pause_sec[$i] =	$row[4];
+	$wait_sec[$i] =		$row[5];
+	$dispo_sec[$i] =	$row[6];
+	$status[$i] =		$row[7];
+	if ( (!eregi("-$status[$i]-", $statuses)) and (strlen($status[$i])>0) )
+		{
+		$statusesTXT = sprintf("%8s", $status[$i]);
+		$statusesHEAD .= "----------+";
+		$statusesHTML .= " $statusesTXT |";
+		$statuses .= "$status[$i]-";
+		$statusesARY[$j] = $status[$i];
+		$j++;
+		}
+	if (!eregi("-$user[$i]-", $users))
+		{
+		$users .= "$user[$i]-";
+		$usersARY[$k] = $user[$i];
+		$user_namesARY[$k] = $full_name[$i];
+		$k++;
+		}
+
+	$i++;
+	}
+
+
+echo "+-----------------+----------+--------+---------+--------+--------+--------+--------+--------+--------+--------+--------+$statusesHEAD\n";
+echo "| USER NAME       | ID       | CALLS  | TIME    | PAUSE  | PAUSAVG| WAIT   | WAITAVG| TALK   | TALKAVG| DISPO  | DISPAVG|$statusesHTML\n";
+echo "+-----------------+----------+--------+---------+--------+--------+--------+--------+--------+--------+--------+--------+$statusesHEAD\n";
+
+
+### BEGIN loop through each user ###
+$m=0;
+while ($m < $k)
+	{
+	$Suser=$usersARY[$m];
+	$Sfull_name=$user_namesARY[$m];
+	$Stime=0;
+	$Scalls=0;
+	$Stalk_sec=0;
+	$Spause_sec=0;
+	$Swait_sec=0;
+	$Sdispo_sec=0;
+	$SstatusesHTML='';
+
+	### BEGIN loop through each status ###
+	$n=0;
+	while ($n < $j)
+		{
+		$Sstatus=$statusesARY[$n];
+		$SstatusTXT='';
+		### BEGIN loop through each stat line ###
+		$i=0; $status_found=0;
+		while ($i < $rows_to_print)
+			{
+			if ( ($Suser=="$user[$i]") and ($Sstatus=="$status[$i]") )
+				{
+				$Scalls =		($Scalls + $calls[$i]);
+				$Stalk_sec =	($Stalk_sec + $talk_sec[$i]);
+				$Spause_sec =	($Spause_sec + $pause_sec[$i]);
+				$Swait_sec =	($Swait_sec + $wait_sec[$i]);
+				$Sdispo_sec =	($Sdispo_sec + $dispo_sec[$i]);
+				$SstatusTXT = sprintf("%8s", $calls[$i]);
+				$SstatusesHTML .= " $SstatusTXT |";
+				$status_found++;
+				}
+			$i++;
+			}
+		if ($status_found < 1)
+			{
+			$SstatusesHTML .= "        0 |";
+			}
+		### END loop through each stat line ###
+		$n++;
+		}
+	### END loop through each status ###
+	$Stime = ($Stalk_sec + $Spause_sec + $Swait_sec + $Sdispo_sec);
+	$TOTcalls=($TOTcalls + $Scalls);
+	$TOTtime=($TOTtime + $Stime);
+	$TOTtotTALK=($TOTtotTALK + $Stalk_sec);
+	$TOTtotWAIT=($TOTtotWAIT + $Swait_sec);
+	$TOTtotPAUSE=($TOTtotPAUSE + $Spause_sec);
+	$TOTtotDISPO=($TOTtotDISPO + $Sdispo_sec);
+	$Stime = ($Stalk_sec + $Spause_sec + $Swait_sec + $Sdispo_sec);
+	if ( ($Scalls > 0) and ($Stalk_sec > 0) ) {$Stalk_avg = ($Stalk_sec/$Scalls);}
+		else {$Stalk_avg=0;}
+	if ( ($Scalls > 0) and ($Spause_sec > 0) ) {$Spause_avg = ($Spause_sec/$Scalls);}
+		else {$Spause_avg=0;}
+	if ( ($Scalls > 0) and ($Swait_sec > 0) ) {$Swait_avg = ($Swait_sec/$Scalls);}
+		else {$Swait_avg=0;}
+	if ( ($Scalls > 0) and ($Sdispo_sec > 0) ) {$Sdispo_avg = ($Sdispo_sec/$Scalls);}
+		else {$Sdispo_avg=0;}
+
+	$Scalls =	sprintf("%6s", $Scalls);
+
+	if ($non_latin < 1)
+	{
+   	 $Sfull_name=	sprintf("%-15s", $Sfull_name); 
+		while(strlen($Sfull_name)>15) {$Sfull_name = substr("$Sfull_name", 0, -1);}
+	 $Suser =		sprintf("%-8s", $Suser);
+        while(strlen($Suser)>8) {$Suser = substr("$Suser", 0, -1);}
+       }
+	else
+	{	
+        $Sfull_name=	sprintf("%-45s", $Sfull_name); 
+	 while(mb_strlen($Sfull_name,'utf-8')>15) {$Sfull_name = mb_substr("$Sfull_name", 0, -1,'utf-8');}
+
+ 		$Suser =	sprintf("%-24s", $Suser);
+	 while(mb_strlen($Suser,'utf-8')>8) {$Suser = mb_substr("$Suser", 0, -1,'utf-8');}
+	}
+
+	$USERtime_M = ($Stime / 60);
+	$USERtime_M = round($USERtime_M, 2);
+	$USERtime_M_int = intval("$USERtime_M");
+	$USERtime_S = ($USERtime_M - $USERtime_M_int);
+	$USERtime_S = ($USERtime_S * 60);
+	$USERtime_S = round($USERtime_S, 0);
+	if ($USERtime_S < 10) {$USERtime_S = "0$USERtime_S";}
+	$USERtime_MS = "$USERtime_M_int:$USERtime_S";
+	$pfUSERtime_MS =		sprintf("%7s", $USERtime_MS);
+
+	$USERtotTALK_M = ($Stalk_sec / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$pfUSERtotTALK_MS =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($Stalk_avg / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$pfUSERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	$USERtotPAUSE_M = ($Spause_sec / 60);
+	$USERtotPAUSE_M = round($USERtotPAUSE_M, 2);
+	$USERtotPAUSE_M_int = intval("$USERtotPAUSE_M");
+	$USERtotPAUSE_S = ($USERtotPAUSE_M - $USERtotPAUSE_M_int);
+	$USERtotPAUSE_S = ($USERtotPAUSE_S * 60);
+	$USERtotPAUSE_S = round($USERtotPAUSE_S, 0);
+	if ($USERtotPAUSE_S < 10) {$USERtotPAUSE_S = "0$USERtotPAUSE_S";}
+	$USERtotPAUSE_MS = "$USERtotPAUSE_M_int:$USERtotPAUSE_S";
+	$pfUSERtotPAUSE_MS =		sprintf("%6s", $USERtotPAUSE_MS);
+
+	$USERavgPAUSE_M = ($Spause_avg / 60);
+	$USERavgPAUSE_M = round($USERavgPAUSE_M, 2);
+	$USERavgPAUSE_M_int = intval("$USERavgPAUSE_M");
+	$USERavgPAUSE_S = ($USERavgPAUSE_M - $USERavgPAUSE_M_int);
+	$USERavgPAUSE_S = ($USERavgPAUSE_S * 60);
+	$USERavgPAUSE_S = round($USERavgPAUSE_S, 0);
+	if ($USERavgPAUSE_S < 10) {$USERavgPAUSE_S = "0$USERavgPAUSE_S";}
+	$USERavgPAUSE_MS = "$USERavgPAUSE_M_int:$USERavgPAUSE_S";
+	$pfUSERavgPAUSE_MS =		sprintf("%6s", $USERavgPAUSE_MS);
+
+	$USERtotWAIT_M = ($Swait_sec / 60);
+	$USERtotWAIT_M = round($USERtotWAIT_M, 2);
+	$USERtotWAIT_M_int = intval("$USERtotWAIT_M");
+	$USERtotWAIT_S = ($USERtotWAIT_M - $USERtotWAIT_M_int);
+	$USERtotWAIT_S = ($USERtotWAIT_S * 60);
+	$USERtotWAIT_S = round($USERtotWAIT_S, 0);
+	if ($USERtotWAIT_S < 10) {$USERtotWAIT_S = "0$USERtotWAIT_S";}
+	$USERtotWAIT_MS = "$USERtotWAIT_M_int:$USERtotWAIT_S";
+	$pfUSERtotWAIT_MS =		sprintf("%6s", $USERtotWAIT_MS);
+
+	$USERavgWAIT_M = ($Swait_avg / 60);
+	$USERavgWAIT_M = round($USERavgWAIT_M, 2);
+	$USERavgWAIT_M_int = intval("$USERavgWAIT_M");
+	$USERavgWAIT_S = ($USERavgWAIT_M - $USERavgWAIT_M_int);
+	$USERavgWAIT_S = ($USERavgWAIT_S * 60);
+	$USERavgWAIT_S = round($USERavgWAIT_S, 0);
+	if ($USERavgWAIT_S < 10) {$USERavgWAIT_S = "0$USERavgWAIT_S";}
+	$USERavgWAIT_MS = "$USERavgWAIT_M_int:$USERavgWAIT_S";
+	$pfUSERavgWAIT_MS =		sprintf("%6s", $USERavgWAIT_MS);
+	
+	$USERtotDISPO_M = ($Sdispo_sec / 60);
+	$USERtotDISPO_M = round($USERtotDISPO_M, 2);
+	$USERtotDISPO_M_int = intval("$USERtotDISPO_M");
+	$USERtotDISPO_S = ($USERtotDISPO_M - $USERtotDISPO_M_int);
+	$USERtotDISPO_S = ($USERtotDISPO_S * 60);
+	$USERtotDISPO_S = round($USERtotDISPO_S, 0);
+	if ($USERtotDISPO_S < 10) {$USERtotDISPO_S = "0$USERtotDISPO_S";}
+	$USERtotDISPO_MS = "$USERtotDISPO_M_int:$USERtotDISPO_S";
+	$pfUSERtotDISPO_MS =		sprintf("%6s", $USERtotDISPO_MS);
+
+	$USERavgDISPO_M = ($Sdispo_avg / 60);
+	$USERavgDISPO_M = round($USERavgDISPO_M, 2);
+	$USERavgDISPO_M_int = intval("$USERavgDISPO_M");
+	$USERavgDISPO_S = ($USERavgDISPO_M - $USERavgDISPO_M_int);
+	$USERavgDISPO_S = ($USERavgDISPO_S * 60);
+	$USERavgDISPO_S = round($USERavgDISPO_S, 0);
+	if ($USERavgDISPO_S < 10) {$USERavgDISPO_S = "0$USERavgDISPO_S";}
+	$USERavgDISPO_MS = "$USERavgDISPO_M_int:$USERavgDISPO_S";
+	$pfUSERavgDISPO_MS =		sprintf("%6s", $USERavgDISPO_MS);
+
+	echo "| $Sfull_name | $Suser | $Scalls | $pfUSERtime_MS | $pfUSERtotPAUSE_MS | $pfUSERavgPAUSE_MS | $pfUSERtotWAIT_MS | $pfUSERavgWAIT_MS | $pfUSERtotTALK_MS | $pfUSERavgTALK_MS | $pfUSERtotDISPO_MS | $pfUSERavgDISPO_MS |$SstatusesHTML\n";
+	$m++;
+	}
+### END loop through each user ###
+
+
+###### LAST LINE FORMATTING ##########
+### BEGIN loop through each status ###
+$SUMstatusesHTML='';
+$n=0;
+while ($n < $j)
+	{
+	$Scalls=0;
+	$Sstatus=$statusesARY[$n];
+	$SUMstatusTXT='';
+	### BEGIN loop through each stat line ###
+	$i=0; $status_found=0;
+	while ($i < $rows_to_print)
+		{
+		if ($Sstatus=="$status[$i]")
+			{
+			$Scalls =		($Scalls + $calls[$i]);
+			$status_found++;
+			}
+		$i++;
+		}
+	### END loop through each stat line ###
+	if ($status_found < 1)
+		{
+		$SUMstatusesHTML .= "        0 |";
+		}
+	else
+		{
+		$SUMstatusTXT = sprintf("%8s", $Scalls);
+		$SUMstatusesHTML .= " $SUMstatusTXT |";
+		}
+	$n++;
+	}
+### END loop through each status ###
+
+
+	$TOTcalls =	sprintf("%7s", $TOTcalls);
+	$TOT_AGENTS = sprintf("%-4s", $m);
+
+	$TOTtime_M = ($TOTtime / 60);
+	$TOTtime_M = 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 ($TOTtime_S < 10) {$TOTtime_S = "0$TOTtime_S";}
+	$TOTtime_MS = "$TOTtime_M_int:$TOTtime_S";
+	$TOTtime_MS =		sprintf("%8s", $TOTtime_MS);
+		while(strlen($TOTtime_MS)>8) {$TOTtime_MS = substr("$TOTtime_MS", 0, -1);}
+
+	$TOTtotTALK_M = ($TOTtotTALK / 60);
+	$TOTtotTALK_M = round($TOTtotTALK_M, 2);
+	$TOTtotTALK_M_int = intval("$TOTtotTALK_M");
+	$TOTtotTALK_S = ($TOTtotTALK_M - $TOTtotTALK_M_int);
+	$TOTtotTALK_S = ($TOTtotTALK_S * 60);
+	$TOTtotTALK_S = round($TOTtotTALK_S, 0);
+	if ($TOTtotTALK_S < 10) {$TOTtotTALK_S = "0$TOTtotTALK_S";}
+	$TOTtotTALK_MS = "$TOTtotTALK_M_int:$TOTtotTALK_S";
+	$TOTtotTALK_MS =		sprintf("%8s", $TOTtotTALK_MS);
+		while(strlen($TOTtotTALK_MS)>8) {$TOTtotTALK_MS = substr("$TOTtotTALK_MS", 0, -1);}
+
+	$TOTtotDISPO_M = ($TOTtotDISPO / 60);
+	$TOTtotDISPO_M = round($TOTtotDISPO_M, 2);
+	$TOTtotDISPO_M_int = intval("$TOTtotDISPO_M");
+	$TOTtotDISPO_S = ($TOTtotDISPO_M - $TOTtotDISPO_M_int);
+	$TOTtotDISPO_S = ($TOTtotDISPO_S * 60);
+	$TOTtotDISPO_S = round($TOTtotDISPO_S, 0);
+	if ($TOTtotDISPO_S < 10) {$TOTtotDISPO_S = "0$TOTtotDISPO_S";}
+	$TOTtotDISPO_MS = "$TOTtotDISPO_M_int:$TOTtotDISPO_S";
+	$TOTtotDISPO_MS =		sprintf("%8s", $TOTtotDISPO_MS);
+		while(strlen($TOTtotDISPO_MS)>8) {$TOTtotDISPO_MS = substr("$TOTtotDISPO_MS", 0, -1);}
+
+	$TOTtotPAUSE_M = ($TOTtotPAUSE / 60);
+	$TOTtotPAUSE_M = round($TOTtotPAUSE_M, 2);
+	$TOTtotPAUSE_M_int = intval("$TOTtotPAUSE_M");
+	$TOTtotPAUSE_S = ($TOTtotPAUSE_M - $TOTtotPAUSE_M_int);
+	$TOTtotPAUSE_S = ($TOTtotPAUSE_S * 60);
+	$TOTtotPAUSE_S = round($TOTtotPAUSE_S, 0);
+	if ($TOTtotPAUSE_S < 10) {$TOTtotPAUSE_S = "0$TOTtotPAUSE_S";}
+	$TOTtotPAUSE_MS = "$TOTtotPAUSE_M_int:$TOTtotPAUSE_S";
+	$TOTtotPAUSE_MS =		sprintf("%8s", $TOTtotPAUSE_MS);
+		while(strlen($TOTtotPAUSE_MS)>8) {$TOTtotPAUSE_MS = substr("$TOTtotPAUSE_MS", 0, -1);}
+
+	$TOTtotWAIT_M = ($TOTtotWAIT / 60);
+	$TOTtotWAIT_M = round($TOTtotWAIT_M, 2);
+	$TOTtotWAIT_M_int = intval("$TOTtotWAIT_M");
+	$TOTtotWAIT_S = ($TOTtotWAIT_M - $TOTtotWAIT_M_int);
+	$TOTtotWAIT_S = ($TOTtotWAIT_S * 60);
+	$TOTtotWAIT_S = round($TOTtotWAIT_S, 0);
+	if ($TOTtotWAIT_S < 10) {$TOTtotWAIT_S = "0$TOTtotWAIT_S";}
+	$TOTtotWAIT_MS = "$TOTtotWAIT_M_int:$TOTtotWAIT_S";
+	$TOTtotWAIT_MS =		sprintf("%8s", $TOTtotWAIT_MS);
+		while(strlen($TOTtotWAIT_MS)>8) {$TOTtotWAIT_MS = substr("$TOTtotWAIT_MS", 0, -1);}
+
+
+	$TOTavgTALK_M = ( ($TOTtotTALK / $TOTcalls) / 60);
+	$TOTavgTALK_M = round($TOTavgTALK_M, 2);
+	$TOTavgTALK_M_int = intval("$TOTavgTALK_M");
+	$TOTavgTALK_S = ($TOTavgTALK_M - $TOTavgTALK_M_int);
+	$TOTavgTALK_S = ($TOTavgTALK_S * 60);
+	$TOTavgTALK_S = round($TOTavgTALK_S, 0);
+	if ($TOTavgTALK_S < 10) {$TOTavgTALK_S = "0$TOTavgTALK_S";}
+	$TOTavgTALK_MS = "$TOTavgTALK_M_int:$TOTavgTALK_S";
+	$TOTavgTALK_MS =		sprintf("%6s", $TOTavgTALK_MS);
+		while(strlen($TOTavgTALK_MS)>6) {$TOTavgTALK_MS = substr("$TOTavgTALK_MS", 0, -1);}
+
+	$TOTavgDISPO_M = ( ($TOTtotDISPO / $TOTcalls) / 60);
+	$TOTavgDISPO_M = round($TOTavgDISPO_M, 2);
+	$TOTavgDISPO_M_int = intval("$TOTavgDISPO_M");
+	$TOTavgDISPO_S = ($TOTavgDISPO_M - $TOTavgDISPO_M_int);
+	$TOTavgDISPO_S = ($TOTavgDISPO_S * 60);
+	$TOTavgDISPO_S = round($TOTavgDISPO_S, 0);
+	if ($TOTavgDISPO_S < 10) {$TOTavgDISPO_S = "0$TOTavgDISPO_S";}
+	$TOTavgDISPO_MS = "$TOTavgDISPO_M_int:$TOTavgDISPO_S";
+	$TOTavgDISPO_MS =		sprintf("%6s", $TOTavgDISPO_MS);
+		while(strlen($TOTavgDISPO_MS)>6) {$TOTavgDISPO_MS = substr("$TOTavgDISPO_MS", 0, -1);}
+
+	$TOTavgPAUSE_M = ( ($TOTtotPAUSE / $TOTcalls) / 60);
+	$TOTavgPAUSE_M = round($TOTavgPAUSE_M, 2);
+	$TOTavgPAUSE_M_int = intval("$TOTavgPAUSE_M");
+	$TOTavgPAUSE_S = ($TOTavgPAUSE_M - $TOTavgPAUSE_M_int);
+	$TOTavgPAUSE_S = ($TOTavgPAUSE_S * 60);
+	$TOTavgPAUSE_S = round($TOTavgPAUSE_S, 0);
+	if ($TOTavgPAUSE_S < 10) {$TOTavgPAUSE_S = "0$TOTavgPAUSE_S";}
+	$TOTavgPAUSE_MS = "$TOTavgPAUSE_M_int:$TOTavgPAUSE_S";
+	$TOTavgPAUSE_MS =		sprintf("%6s", $TOTavgPAUSE_MS);
+		while(strlen($TOTavgPAUSE_MS)>6) {$TOTavgPAUSE_MS = substr("$TOTavgPAUSE_MS", 0, -1);}
+
+	$TOTavgWAIT_M = ( ($TOTtotWAIT / $TOTcalls) / 60);
+	$TOTavgWAIT_M = round($TOTavgWAIT_M, 2);
+	$TOTavgWAIT_M_int = intval("$TOTavgWAIT_M");
+	$TOTavgWAIT_S = ($TOTavgWAIT_M - $TOTavgWAIT_M_int);
+	$TOTavgWAIT_S = ($TOTavgWAIT_S * 60);
+	$TOTavgWAIT_S = round($TOTavgWAIT_S, 0);
+	if ($TOTavgWAIT_S < 10) {$TOTavgWAIT_S = "0$TOTavgWAIT_S";}
+	$TOTavgWAIT_MS = "$TOTavgWAIT_M_int:$TOTavgWAIT_S";
+	$TOTavgWAIT_MS =		sprintf("%6s", $TOTavgWAIT_MS);
+		while(strlen($TOTavgWAIT_MS)>6) {$TOTavgWAIT_MS = substr("$TOTavgWAIT_MS", 0, -1);}
+
+
+echo "+-----------------+----------+--------+---------+--------+--------+--------+--------+--------+--------+--------+--------+$statusesHEAD\n";
+echo "|  TOTALS        AGENTS:$TOT_AGENTS | $TOTcalls| $TOTtime_MS|$TOTtotPAUSE_MS| $TOTavgPAUSE_MS |$TOTtotWAIT_MS| $TOTavgWAIT_MS |$TOTtotTALK_MS| $TOTavgTALK_MS |$TOTtotDISPO_MS| $TOTavgDISPO_MS |$SUMstatusesHTML\n";
+echo "+----------------------------+--------+---------+--------+--------+--------+--------+--------+--------+--------+--------+$statusesHEAD\n";
+
+echo "\n";
+
+}
+
+
+?>
+
+
\ No newline at end of file
diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_agent_time_sheet.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_agent_time_sheet.php
new file mode 100644
index 00000000..bd562a7b
--- /dev/null
+++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_agent_time_sheet.php
@@ -0,0 +1,286 @@
+    LICENSE: GPLv2
+###
+# CHANGES
+#
+# 60619-1729 - Added variable filtering to eliminate SQL injection attack threat
+#            - Added required user/pass to gain access to this page
+#
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+if (isset($_GET["agent"]))				{$agent=$_GET["agent"];}
+	elseif (isset($_POST["agent"]))		{$agent=$_POST["agent"];}
+if (isset($_GET["query_date"]))				{$query_date=$_GET["query_date"];}
+	elseif (isset($_POST["query_date"]))		{$query_date=$_POST["query_date"];}
+if (isset($_GET["calls_summary"]))				{$calls_summary=$_GET["calls_summary"];}
+	elseif (isset($_POST["calls_summary"]))		{$calls_summary=$_POST["calls_summary"];}
+if (isset($_GET["submit"]))				{$submit=$_GET["submit"];}
+	elseif (isset($_POST["submit"]))		{$submit=$_POST["submit"];}
+if (isset($_GET["SUBMIT"]))				{$SUBMIT=$_GET["SUBMIT"];}
+	elseif (isset($_POST["SUBMIT"]))		{$SUBMIT=$_POST["SUBMIT"];}
+
+$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
+$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
+
+	$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
+	if ($DB) {echo "|$stmt|\n";}
+	$rslt=mysql_query($stmt, $link);
+	$row=mysql_fetch_row($rslt);
+	$auth=$row[0];
+
+  if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
+	{
+    Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
+    Header("HTTP/1.0 401 Unauthorized");
+    echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
+    exit;
+	}
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!isset($query_date)) {$query_date = $NOW_DATE;}
+
+?>
+
+
+
+
+
+\n";
+echo "VICIDIAL: Agent Time Sheet\n";
+echo "VICIDIAL ADMIN: Agent Time Sheet\n";
+echo " - User Stats\n";
+echo " - User Status\n";
+echo " - Modify User\n";
+echo "
\n"; +echo "
  \n"; +echo "Date: \n"; +echo "User ID: \n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n";
+
+
+if (!$agent)
+{
+echo "\n";
+echo "PLEASE SELECT AN AGENT ID AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
+echo " NOTE: stats taken from available agent log data\n";
+}
+
+else
+{
+$query_date_BEGIN = "$query_date 00:00:00";   
+$query_date_END = "$query_date 23:59:59";
+$time_BEGIN = "00:00:00";   
+$time_END = "23:59:59";
+
+$stmt="select full_name from vicidial_users where user='$agent';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$full_name = $row[0];
+
+echo "VICIDIAL: Agent Time Sheet                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENT TIME SHEET: $agent - $full_name -------------\n\n";
+
+if ($calls_summary)
+	{
+	$stmt="select count(*) as calls,sum(talk_sec) as talk,avg(talk_sec),sum(pause_sec),avg(pause_sec),sum(wait_sec),avg(wait_sec),sum(dispo_sec),avg(dispo_sec) from vicidial_agent_log where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' and pause_sec<48800 and wait_sec<48800 and talk_sec<48800 and dispo_sec<48800 limit 1;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+
+	$TOTAL_TIME = ($row[1] + $row[3] + $row[5] + $row[7]);
+
+		$TOTAL_TIME_H = ($TOTAL_TIME / 3600);
+		$TOTAL_TIME_H = round($TOTAL_TIME_H, 2);
+		$TOTAL_TIME_H_int = intval("$TOTAL_TIME_H");
+		$TOTAL_TIME_M = ($TOTAL_TIME_H - $TOTAL_TIME_H_int);
+		$TOTAL_TIME_M = ($TOTAL_TIME_M * 60);
+		$TOTAL_TIME_M = round($TOTAL_TIME_M, 2);
+		$TOTAL_TIME_M_int = intval("$TOTAL_TIME_M");
+		$TOTAL_TIME_S = ($TOTAL_TIME_M - $TOTAL_TIME_M_int);
+		$TOTAL_TIME_S = ($TOTAL_TIME_S * 60);
+		$TOTAL_TIME_S = round($TOTAL_TIME_S, 0);
+		if ($TOTAL_TIME_S < 10) {$TOTAL_TIME_S = "0$TOTAL_TIME_S";}
+		if ($TOTAL_TIME_M_int < 10) {$TOTAL_TIME_M_int = "0$TOTAL_TIME_M_int";}
+		$TOTAL_TIME_HMS = "$TOTAL_TIME_H_int:$TOTAL_TIME_M_int:$TOTAL_TIME_S";
+		$pfTOTAL_TIME_HMS =		sprintf("%8s", $TOTAL_TIME_HMS);
+
+		$TALK_TIME_H = ($row[1] / 3600);
+		$TALK_TIME_H = round($TALK_TIME_H, 2);
+		$TALK_TIME_H_int = intval("$TALK_TIME_H");
+		$TALK_TIME_M = ($TALK_TIME_H - $TALK_TIME_H_int);
+		$TALK_TIME_M = ($TALK_TIME_M * 60);
+		$TALK_TIME_M = round($TALK_TIME_M, 2);
+		$TALK_TIME_M_int = intval("$TALK_TIME_M");
+		$TALK_TIME_S = ($TALK_TIME_M - $TALK_TIME_M_int);
+		$TALK_TIME_S = ($TALK_TIME_S * 60);
+		$TALK_TIME_S = round($TALK_TIME_S, 0);
+		if ($TALK_TIME_S < 10) {$TALK_TIME_S = "0$TALK_TIME_S";}
+		if ($TALK_TIME_M_int < 10) {$TALK_TIME_M_int = "0$TALK_TIME_M_int";}
+		$TALK_TIME_HMS = "$TALK_TIME_H_int:$TALK_TIME_M_int:$TALK_TIME_S";
+		$pfTALK_TIME_HMS =		sprintf("%8s", $TALK_TIME_HMS);
+
+		$PAUSE_TIME_H = ($row[3] / 3600);
+		$PAUSE_TIME_H = round($PAUSE_TIME_H, 2);
+		$PAUSE_TIME_H_int = intval("$PAUSE_TIME_H");
+		$PAUSE_TIME_M = ($PAUSE_TIME_H - $PAUSE_TIME_H_int);
+		$PAUSE_TIME_M = ($PAUSE_TIME_M * 60);
+		$PAUSE_TIME_M = round($PAUSE_TIME_M, 2);
+		$PAUSE_TIME_M_int = intval("$PAUSE_TIME_M");
+		$PAUSE_TIME_S = ($PAUSE_TIME_M - $PAUSE_TIME_M_int);
+		$PAUSE_TIME_S = ($PAUSE_TIME_S * 60);
+		$PAUSE_TIME_S = round($PAUSE_TIME_S, 0);
+		if ($PAUSE_TIME_S < 10) {$PAUSE_TIME_S = "0$PAUSE_TIME_S";}
+		if ($PAUSE_TIME_M_int < 10) {$PAUSE_TIME_M_int = "0$PAUSE_TIME_M_int";}
+		$PAUSE_TIME_HMS = "$PAUSE_TIME_H_int:$PAUSE_TIME_M_int:$PAUSE_TIME_S";
+		$pfPAUSE_TIME_HMS =		sprintf("%8s", $PAUSE_TIME_HMS);
+
+		$WAIT_TIME_H = ($row[5] / 3600);
+		$WAIT_TIME_H = round($WAIT_TIME_H, 2);
+		$WAIT_TIME_H_int = intval("$WAIT_TIME_H");
+		$WAIT_TIME_M = ($WAIT_TIME_H - $WAIT_TIME_H_int);
+		$WAIT_TIME_M = ($WAIT_TIME_M * 60);
+		$WAIT_TIME_M = round($WAIT_TIME_M, 2);
+		$WAIT_TIME_M_int = intval("$WAIT_TIME_M");
+		$WAIT_TIME_S = ($WAIT_TIME_M - $WAIT_TIME_M_int);
+		$WAIT_TIME_S = ($WAIT_TIME_S * 60);
+		$WAIT_TIME_S = round($WAIT_TIME_S, 0);
+		if ($WAIT_TIME_S < 10) {$WAIT_TIME_S = "0$WAIT_TIME_S";}
+		if ($WAIT_TIME_M_int < 10) {$WAIT_TIME_M_int = "0$WAIT_TIME_M_int";}
+		$WAIT_TIME_HMS = "$WAIT_TIME_H_int:$WAIT_TIME_M_int:$WAIT_TIME_S";
+		$pfWAIT_TIME_HMS =		sprintf("%8s", $WAIT_TIME_HMS);
+
+		$WRAPUP_TIME_H = ($row[7] / 3600);
+		$WRAPUP_TIME_H = round($WRAPUP_TIME_H, 2);
+		$WRAPUP_TIME_H_int = intval("$WRAPUP_TIME_H");
+		$WRAPUP_TIME_M = ($WRAPUP_TIME_H - $WRAPUP_TIME_H_int);
+		$WRAPUP_TIME_M = ($WRAPUP_TIME_M * 60);
+		$WRAPUP_TIME_M = round($WRAPUP_TIME_M, 2);
+		$WRAPUP_TIME_M_int = intval("$WRAPUP_TIME_M");
+		$WRAPUP_TIME_S = ($WRAPUP_TIME_M - $WRAPUP_TIME_M_int);
+		$WRAPUP_TIME_S = ($WRAPUP_TIME_S * 60);
+		$WRAPUP_TIME_S = round($WRAPUP_TIME_S, 0);
+		if ($WRAPUP_TIME_S < 10) {$WRAPUP_TIME_S = "0$WRAPUP_TIME_S";}
+		if ($WRAPUP_TIME_M_int < 10) {$WRAPUP_TIME_M_int = "0$WRAPUP_TIME_M_int";}
+		$WRAPUP_TIME_HMS = "$WRAPUP_TIME_H_int:$WRAPUP_TIME_M_int:$WRAPUP_TIME_S";
+		$pfWRAPUP_TIME_HMS =		sprintf("%8s", $WRAPUP_TIME_HMS);
+
+		$TALK_AVG_M = ($row[2] / 60);
+		$TALK_AVG_M = round($TALK_AVG_M, 2);
+		$TALK_AVG_M_int = intval("$TALK_AVG_M");
+		$TALK_AVG_S = ($TALK_AVG_M - $TALK_AVG_M_int);
+		$TALK_AVG_S = ($TALK_AVG_S * 60);
+		$TALK_AVG_S = round($TALK_AVG_S, 0);
+		if ($TALK_AVG_S < 10) {$TALK_AVG_S = "0$TALK_AVG_S";}
+		$TALK_AVG_MS = "$TALK_AVG_M_int:$TALK_AVG_S";
+		$pfTALK_AVG_MS =		sprintf("%6s", $TALK_AVG_MS);
+
+		$PAUSE_AVG_M = ($row[4] / 60);
+		$PAUSE_AVG_M = round($PAUSE_AVG_M, 2);
+		$PAUSE_AVG_M_int = intval("$PAUSE_AVG_M");
+		$PAUSE_AVG_S = ($PAUSE_AVG_M - $PAUSE_AVG_M_int);
+		$PAUSE_AVG_S = ($PAUSE_AVG_S * 60);
+		$PAUSE_AVG_S = round($PAUSE_AVG_S, 0);
+		if ($PAUSE_AVG_S < 10) {$PAUSE_AVG_S = "0$PAUSE_AVG_S";}
+		$PAUSE_AVG_MS = "$PAUSE_AVG_M_int:$PAUSE_AVG_S";
+		$pfPAUSE_AVG_MS =		sprintf("%6s", $PAUSE_AVG_MS);
+
+		$WAIT_AVG_M = ($row[6] / 60);
+		$WAIT_AVG_M = round($WAIT_AVG_M, 2);
+		$WAIT_AVG_M_int = intval("$WAIT_AVG_M");
+		$WAIT_AVG_S = ($WAIT_AVG_M - $WAIT_AVG_M_int);
+		$WAIT_AVG_S = ($WAIT_AVG_S * 60);
+		$WAIT_AVG_S = round($WAIT_AVG_S, 0);
+		if ($WAIT_AVG_S < 10) {$WAIT_AVG_S = "0$WAIT_AVG_S";}
+		$WAIT_AVG_MS = "$WAIT_AVG_M_int:$WAIT_AVG_S";
+		$pfWAIT_AVG_MS =		sprintf("%6s", $WAIT_AVG_MS);
+
+		$WRAPUP_AVG_M = ($row[8] / 60);
+		$WRAPUP_AVG_M = round($WRAPUP_AVG_M, 2);
+		$WRAPUP_AVG_M_int = intval("$WRAPUP_AVG_M");
+		$WRAPUP_AVG_S = ($WRAPUP_AVG_M - $WRAPUP_AVG_M_int);
+		$WRAPUP_AVG_S = ($WRAPUP_AVG_S * 60);
+		$WRAPUP_AVG_S = round($WRAPUP_AVG_S, 0);
+		if ($WRAPUP_AVG_S < 10) {$WRAPUP_AVG_S = "0$WRAPUP_AVG_S";}
+		$WRAPUP_AVG_MS = "$WRAPUP_AVG_M_int:$WRAPUP_AVG_S";
+		$pfWRAPUP_AVG_MS =		sprintf("%6s", $WRAPUP_AVG_MS);
+
+	echo "TOTAL CALLS TAKEN: $row[0]\n";
+	echo "TALK TIME:               $pfTALK_TIME_HMS     AVERAGE: $pfTALK_AVG_MS\n";
+	echo "PAUSE TIME:              $pfPAUSE_TIME_HMS     AVERAGE: $pfPAUSE_AVG_MS\n";
+	echo "WAIT TIME:               $pfWAIT_TIME_HMS     AVERAGE: $pfWAIT_AVG_MS\n";
+	echo "WRAPUP TIME:             $pfWRAPUP_TIME_HMS     AVERAGE: $pfWRAPUP_AVG_MS\n";
+	echo "----------------------------------------------------------------\n";
+	echo "TOTAL ACTIVE AGENT TIME: $pfTOTAL_TIME_HMS\n";
+
+	echo "\n";
+	}
+else
+	{
+	echo "Call Activity Summary\n\n";
+
+	}
+
+$stmt="select event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' order by event_time limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+echo "FIRST LOGIN:          $row[0]\n";
+$start = $row[1];
+
+$stmt="select event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' order by event_time desc limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+echo "LAST LOG ACTIVITY:    $row[0]\n";
+$end = $row[1];
+
+$login_time = ($end - $start);
+	$LOGIN_TIME_H = ($login_time / 3600);
+	$LOGIN_TIME_H = round($LOGIN_TIME_H, 2);
+	$LOGIN_TIME_H_int = intval("$LOGIN_TIME_H");
+	$LOGIN_TIME_M = ($LOGIN_TIME_H - $LOGIN_TIME_H_int);
+	$LOGIN_TIME_M = ($LOGIN_TIME_M * 60);
+	$LOGIN_TIME_M = round($LOGIN_TIME_M, 2);
+	$LOGIN_TIME_M_int = intval("$LOGIN_TIME_M");
+	$LOGIN_TIME_S = ($LOGIN_TIME_M - $LOGIN_TIME_M_int);
+	$LOGIN_TIME_S = ($LOGIN_TIME_S * 60);
+	$LOGIN_TIME_S = round($LOGIN_TIME_S, 0);
+	if ($LOGIN_TIME_S < 10) {$LOGIN_TIME_S = "0$LOGIN_TIME_S";}
+	if ($LOGIN_TIME_M_int < 10) {$LOGIN_TIME_M_int = "0$LOGIN_TIME_M_int";}
+	$LOGIN_TIME_HMS = "$LOGIN_TIME_H_int:$LOGIN_TIME_M_int:$LOGIN_TIME_S";
+	$pfLOGIN_TIME_HMS =		sprintf("%8s", $LOGIN_TIME_HMS);
+
+echo "-----------------------------------------\n";
+echo "TOTAL LOGGED-IN TIME:    $pfLOGIN_TIME_HMS\n";
+
+}
+
+
+
+?>
+
+
\ No newline at end of file
diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_agent_time_sheet_archive.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_agent_time_sheet_archive.php
new file mode 100644
index 00000000..fb71d1d6
--- /dev/null
+++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_agent_time_sheet_archive.php
@@ -0,0 +1,286 @@
+    LICENSE: GPLv2
+###
+# CHANGES
+#
+# 60619-1721 - Added variable filtering to eliminate SQL injection attack threat
+#            - Added required user/pass to gain access to this page
+#
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+if (isset($_GET["agent"]))				{$agent=$_GET["agent"];}
+	elseif (isset($_POST["agent"]))		{$agent=$_POST["agent"];}
+if (isset($_GET["query_date"]))				{$query_date=$_GET["query_date"];}
+	elseif (isset($_POST["query_date"]))		{$query_date=$_POST["query_date"];}
+if (isset($_GET["calls_summary"]))				{$calls_summary=$_GET["calls_summary"];}
+	elseif (isset($_POST["calls_summary"]))		{$calls_summary=$_POST["calls_summary"];}
+if (isset($_GET["submit"]))				{$submit=$_GET["submit"];}
+	elseif (isset($_POST["submit"]))		{$submit=$_POST["submit"];}
+if (isset($_GET["SUBMIT"]))				{$SUBMIT=$_GET["SUBMIT"];}
+	elseif (isset($_POST["SUBMIT"]))		{$SUBMIT=$_POST["SUBMIT"];}
+
+$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
+$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
+
+	$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
+	if ($DB) {echo "|$stmt|\n";}
+	$rslt=mysql_query($stmt, $link);
+	$row=mysql_fetch_row($rslt);
+	$auth=$row[0];
+
+  if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
+	{
+    Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
+    Header("HTTP/1.0 401 Unauthorized");
+    echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
+    exit;
+	}
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!isset($query_date)) {$query_date = $NOW_DATE;}
+
+?>
+
+
+
+
+
+\n";
+echo "VICIDIAL: Agent Time Sheet\n";
+echo "VICIDIAL ADMIN: Agent Time Sheet\n";
+echo " - User Stats\n";
+echo " - User Status\n";
+echo " - Modify User\n";
+echo "
\n"; +echo "
  \n"; +echo "Date: \n"; +echo "User ID: \n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n";
+
+
+if (!$agent)
+{
+echo "\n";
+echo "PLEASE SELECT AN AGENT ID AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
+echo " NOTE: stats taken from available agent log data\n";
+}
+
+else
+{
+$query_date_BEGIN = "$query_date 00:00:00";   
+$query_date_END = "$query_date 23:59:59";
+$time_BEGIN = "00:00:00";   
+$time_END = "23:59:59";
+
+$stmt="select full_name from vicidial_users where user='$agent';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$full_name = $row[0];
+
+echo "VICIDIAL: Agent Time Sheet                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENT TIME SHEET: $agent - $full_name -------------\n\n";
+
+if ($calls_summary)
+	{
+	$stmt="select count(*) as calls,sum(talk_sec) as talk,avg(talk_sec),sum(pause_sec),avg(pause_sec),sum(wait_sec),avg(wait_sec),sum(dispo_sec),avg(dispo_sec) from vicidial_agent_log_archive where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' and pause_sec<48800 and wait_sec<48800 and talk_sec<48800 and dispo_sec<48800 limit 1;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+
+	$TOTAL_TIME = ($row[1] + $row[3] + $row[5] + $row[7]);
+
+		$TOTAL_TIME_H = ($TOTAL_TIME / 3600);
+		$TOTAL_TIME_H = round($TOTAL_TIME_H, 2);
+		$TOTAL_TIME_H_int = intval("$TOTAL_TIME_H");
+		$TOTAL_TIME_M = ($TOTAL_TIME_H - $TOTAL_TIME_H_int);
+		$TOTAL_TIME_M = ($TOTAL_TIME_M * 60);
+		$TOTAL_TIME_M = round($TOTAL_TIME_M, 2);
+		$TOTAL_TIME_M_int = intval("$TOTAL_TIME_M");
+		$TOTAL_TIME_S = ($TOTAL_TIME_M - $TOTAL_TIME_M_int);
+		$TOTAL_TIME_S = ($TOTAL_TIME_S * 60);
+		$TOTAL_TIME_S = round($TOTAL_TIME_S, 0);
+		if ($TOTAL_TIME_S < 10) {$TOTAL_TIME_S = "0$TOTAL_TIME_S";}
+		if ($TOTAL_TIME_M_int < 10) {$TOTAL_TIME_M_int = "0$TOTAL_TIME_M_int";}
+		$TOTAL_TIME_HMS = "$TOTAL_TIME_H_int:$TOTAL_TIME_M_int:$TOTAL_TIME_S";
+		$pfTOTAL_TIME_HMS =		sprintf("%8s", $TOTAL_TIME_HMS);
+
+		$TALK_TIME_H = ($row[1] / 3600);
+		$TALK_TIME_H = round($TALK_TIME_H, 2);
+		$TALK_TIME_H_int = intval("$TALK_TIME_H");
+		$TALK_TIME_M = ($TALK_TIME_H - $TALK_TIME_H_int);
+		$TALK_TIME_M = ($TALK_TIME_M * 60);
+		$TALK_TIME_M = round($TALK_TIME_M, 2);
+		$TALK_TIME_M_int = intval("$TALK_TIME_M");
+		$TALK_TIME_S = ($TALK_TIME_M - $TALK_TIME_M_int);
+		$TALK_TIME_S = ($TALK_TIME_S * 60);
+		$TALK_TIME_S = round($TALK_TIME_S, 0);
+		if ($TALK_TIME_S < 10) {$TALK_TIME_S = "0$TALK_TIME_S";}
+		if ($TALK_TIME_M_int < 10) {$TALK_TIME_M_int = "0$TALK_TIME_M_int";}
+		$TALK_TIME_HMS = "$TALK_TIME_H_int:$TALK_TIME_M_int:$TALK_TIME_S";
+		$pfTALK_TIME_HMS =		sprintf("%8s", $TALK_TIME_HMS);
+
+		$PAUSE_TIME_H = ($row[3] / 3600);
+		$PAUSE_TIME_H = round($PAUSE_TIME_H, 2);
+		$PAUSE_TIME_H_int = intval("$PAUSE_TIME_H");
+		$PAUSE_TIME_M = ($PAUSE_TIME_H - $PAUSE_TIME_H_int);
+		$PAUSE_TIME_M = ($PAUSE_TIME_M * 60);
+		$PAUSE_TIME_M = round($PAUSE_TIME_M, 2);
+		$PAUSE_TIME_M_int = intval("$PAUSE_TIME_M");
+		$PAUSE_TIME_S = ($PAUSE_TIME_M - $PAUSE_TIME_M_int);
+		$PAUSE_TIME_S = ($PAUSE_TIME_S * 60);
+		$PAUSE_TIME_S = round($PAUSE_TIME_S, 0);
+		if ($PAUSE_TIME_S < 10) {$PAUSE_TIME_S = "0$PAUSE_TIME_S";}
+		if ($PAUSE_TIME_M_int < 10) {$PAUSE_TIME_M_int = "0$PAUSE_TIME_M_int";}
+		$PAUSE_TIME_HMS = "$PAUSE_TIME_H_int:$PAUSE_TIME_M_int:$PAUSE_TIME_S";
+		$pfPAUSE_TIME_HMS =		sprintf("%8s", $PAUSE_TIME_HMS);
+
+		$WAIT_TIME_H = ($row[5] / 3600);
+		$WAIT_TIME_H = round($WAIT_TIME_H, 2);
+		$WAIT_TIME_H_int = intval("$WAIT_TIME_H");
+		$WAIT_TIME_M = ($WAIT_TIME_H - $WAIT_TIME_H_int);
+		$WAIT_TIME_M = ($WAIT_TIME_M * 60);
+		$WAIT_TIME_M = round($WAIT_TIME_M, 2);
+		$WAIT_TIME_M_int = intval("$WAIT_TIME_M");
+		$WAIT_TIME_S = ($WAIT_TIME_M - $WAIT_TIME_M_int);
+		$WAIT_TIME_S = ($WAIT_TIME_S * 60);
+		$WAIT_TIME_S = round($WAIT_TIME_S, 0);
+		if ($WAIT_TIME_S < 10) {$WAIT_TIME_S = "0$WAIT_TIME_S";}
+		if ($WAIT_TIME_M_int < 10) {$WAIT_TIME_M_int = "0$WAIT_TIME_M_int";}
+		$WAIT_TIME_HMS = "$WAIT_TIME_H_int:$WAIT_TIME_M_int:$WAIT_TIME_S";
+		$pfWAIT_TIME_HMS =		sprintf("%8s", $WAIT_TIME_HMS);
+
+		$WRAPUP_TIME_H = ($row[7] / 3600);
+		$WRAPUP_TIME_H = round($WRAPUP_TIME_H, 2);
+		$WRAPUP_TIME_H_int = intval("$WRAPUP_TIME_H");
+		$WRAPUP_TIME_M = ($WRAPUP_TIME_H - $WRAPUP_TIME_H_int);
+		$WRAPUP_TIME_M = ($WRAPUP_TIME_M * 60);
+		$WRAPUP_TIME_M = round($WRAPUP_TIME_M, 2);
+		$WRAPUP_TIME_M_int = intval("$WRAPUP_TIME_M");
+		$WRAPUP_TIME_S = ($WRAPUP_TIME_M - $WRAPUP_TIME_M_int);
+		$WRAPUP_TIME_S = ($WRAPUP_TIME_S * 60);
+		$WRAPUP_TIME_S = round($WRAPUP_TIME_S, 0);
+		if ($WRAPUP_TIME_S < 10) {$WRAPUP_TIME_S = "0$WRAPUP_TIME_S";}
+		if ($WRAPUP_TIME_M_int < 10) {$WRAPUP_TIME_M_int = "0$WRAPUP_TIME_M_int";}
+		$WRAPUP_TIME_HMS = "$WRAPUP_TIME_H_int:$WRAPUP_TIME_M_int:$WRAPUP_TIME_S";
+		$pfWRAPUP_TIME_HMS =		sprintf("%8s", $WRAPUP_TIME_HMS);
+
+		$TALK_AVG_M = ($row[2] / 60);
+		$TALK_AVG_M = round($TALK_AVG_M, 2);
+		$TALK_AVG_M_int = intval("$TALK_AVG_M");
+		$TALK_AVG_S = ($TALK_AVG_M - $TALK_AVG_M_int);
+		$TALK_AVG_S = ($TALK_AVG_S * 60);
+		$TALK_AVG_S = round($TALK_AVG_S, 0);
+		if ($TALK_AVG_S < 10) {$TALK_AVG_S = "0$TALK_AVG_S";}
+		$TALK_AVG_MS = "$TALK_AVG_M_int:$TALK_AVG_S";
+		$pfTALK_AVG_MS =		sprintf("%6s", $TALK_AVG_MS);
+
+		$PAUSE_AVG_M = ($row[4] / 60);
+		$PAUSE_AVG_M = round($PAUSE_AVG_M, 2);
+		$PAUSE_AVG_M_int = intval("$PAUSE_AVG_M");
+		$PAUSE_AVG_S = ($PAUSE_AVG_M - $PAUSE_AVG_M_int);
+		$PAUSE_AVG_S = ($PAUSE_AVG_S * 60);
+		$PAUSE_AVG_S = round($PAUSE_AVG_S, 0);
+		if ($PAUSE_AVG_S < 10) {$PAUSE_AVG_S = "0$PAUSE_AVG_S";}
+		$PAUSE_AVG_MS = "$PAUSE_AVG_M_int:$PAUSE_AVG_S";
+		$pfPAUSE_AVG_MS =		sprintf("%6s", $PAUSE_AVG_MS);
+
+		$WAIT_AVG_M = ($row[6] / 60);
+		$WAIT_AVG_M = round($WAIT_AVG_M, 2);
+		$WAIT_AVG_M_int = intval("$WAIT_AVG_M");
+		$WAIT_AVG_S = ($WAIT_AVG_M - $WAIT_AVG_M_int);
+		$WAIT_AVG_S = ($WAIT_AVG_S * 60);
+		$WAIT_AVG_S = round($WAIT_AVG_S, 0);
+		if ($WAIT_AVG_S < 10) {$WAIT_AVG_S = "0$WAIT_AVG_S";}
+		$WAIT_AVG_MS = "$WAIT_AVG_M_int:$WAIT_AVG_S";
+		$pfWAIT_AVG_MS =		sprintf("%6s", $WAIT_AVG_MS);
+
+		$WRAPUP_AVG_M = ($row[8] / 60);
+		$WRAPUP_AVG_M = round($WRAPUP_AVG_M, 2);
+		$WRAPUP_AVG_M_int = intval("$WRAPUP_AVG_M");
+		$WRAPUP_AVG_S = ($WRAPUP_AVG_M - $WRAPUP_AVG_M_int);
+		$WRAPUP_AVG_S = ($WRAPUP_AVG_S * 60);
+		$WRAPUP_AVG_S = round($WRAPUP_AVG_S, 0);
+		if ($WRAPUP_AVG_S < 10) {$WRAPUP_AVG_S = "0$WRAPUP_AVG_S";}
+		$WRAPUP_AVG_MS = "$WRAPUP_AVG_M_int:$WRAPUP_AVG_S";
+		$pfWRAPUP_AVG_MS =		sprintf("%6s", $WRAPUP_AVG_MS);
+
+	echo "TOTAL CALLS TAKEN: $row[0]\n";
+	echo "TALK TIME:               $pfTALK_TIME_HMS     AVERAGE: $pfTALK_AVG_MS\n";
+	echo "PAUSE TIME:              $pfPAUSE_TIME_HMS     AVERAGE: $pfPAUSE_AVG_MS\n";
+	echo "WAIT TIME:               $pfWAIT_TIME_HMS     AVERAGE: $pfWAIT_AVG_MS\n";
+	echo "WRAPUP TIME:             $pfWRAPUP_TIME_HMS     AVERAGE: $pfWRAPUP_AVG_MS\n";
+	echo "----------------------------------------------------------------\n";
+	echo "TOTAL ACTIVE AGENT TIME: $pfTOTAL_TIME_HMS\n";
+
+	echo "\n";
+	}
+else
+	{
+	echo "Call Activity Summary\n\n";
+
+	}
+
+$stmt="select event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log_archive where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' order by event_time limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+echo "FIRST LOGIN:          $row[0]\n";
+$start = $row[1];
+
+$stmt="select event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log_archive where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' order by event_time desc limit 1;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+echo "LAST LOG ACTIVITY:    $row[0]\n";
+$end = $row[1];
+
+$login_time = ($end - $start);
+	$LOGIN_TIME_H = ($login_time / 3600);
+	$LOGIN_TIME_H = round($LOGIN_TIME_H, 2);
+	$LOGIN_TIME_H_int = intval("$LOGIN_TIME_H");
+	$LOGIN_TIME_M = ($LOGIN_TIME_H - $LOGIN_TIME_H_int);
+	$LOGIN_TIME_M = ($LOGIN_TIME_M * 60);
+	$LOGIN_TIME_M = round($LOGIN_TIME_M, 2);
+	$LOGIN_TIME_M_int = intval("$LOGIN_TIME_M");
+	$LOGIN_TIME_S = ($LOGIN_TIME_M - $LOGIN_TIME_M_int);
+	$LOGIN_TIME_S = ($LOGIN_TIME_S * 60);
+	$LOGIN_TIME_S = round($LOGIN_TIME_S, 0);
+	if ($LOGIN_TIME_S < 10) {$LOGIN_TIME_S = "0$LOGIN_TIME_S";}
+	if ($LOGIN_TIME_M_int < 10) {$LOGIN_TIME_M_int = "0$LOGIN_TIME_M_int";}
+	$LOGIN_TIME_HMS = "$LOGIN_TIME_H_int:$LOGIN_TIME_M_int:$LOGIN_TIME_S";
+	$pfLOGIN_TIME_HMS =		sprintf("%8s", $LOGIN_TIME_HMS);
+
+echo "-----------------------------------------\n";
+echo "TOTAL LOGGED-IN TIME:    $pfLOGIN_TIME_HMS\n";
+
+}
+
+
+
+?>
+
+
\ No newline at end of file
diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_inboundEXTstats.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_inboundEXTstats.php
new file mode 100644
index 00000000..5bc24935
--- /dev/null
+++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_inboundEXTstats.php
@@ -0,0 +1,400 @@
+    LICENSE: GPLv2
+#
+# CHANGES
+# 60421-1450 - check GET/POST vars lines with isset to not trigger PHP NOTICES
+# 60620-1322 - Added variable filtering to eliminate SQL injection attack threat
+#            - Added required user/pass to gain access to this page
+#
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+if (isset($_GET["group"]))					{$group=$_GET["group"];}
+	elseif (isset($_POST["group"]))			{$group=$_POST["group"];}
+if (isset($_GET["query_date"]))				{$query_date=$_GET["query_date"];}
+	elseif (isset($_POST["query_date"]))	{$query_date=$_POST["query_date"];}
+if (isset($_GET["server_ip"]))				{$server_ip=$_GET["server_ip"];}
+	elseif (isset($_POST["server_ip"]))		{$server_ip=$_POST["server_ip"];}
+if (isset($_GET["submit"]))					{$submit=$_GET["submit"];}
+	elseif (isset($_POST["submit"]))		{$submit=$_POST["submit"];}
+if (isset($_GET["SUBMIT"]))					{$SUBMIT=$_GET["SUBMIT"];}
+	elseif (isset($_POST["SUBMIT"]))		{$SUBMIT=$_POST["SUBMIT"];}
+
+$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
+$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
+
+	$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
+	if ($DB) {echo "|$stmt|\n";}
+	$rslt=mysql_query($stmt, $link);
+	$row=mysql_fetch_row($rslt);
+	$auth=$row[0];
+
+  if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
+	{
+    Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
+    Header("HTTP/1.0 401 Unauthorized");
+    echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
+    exit;
+	}
+
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!isset($query_date)) {$query_date = $NOW_DATE;}
+if (!isset($server_ip)) {$server_ip = '10.10.11.20';}
+
+$stmt="select extension,full_number,inbound_name from inbound_numbers where server_ip='" . mysql_real_escape_string($server_ip) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$inbound_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $inbound_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$inbound[$i] =$row[0];
+	$fullnum[$i] =$row[1];
+	$inbname[$i] =$row[2];
+	$i++;
+	}
+?>
+
+
+
+
+
+\n";
+#echo"\n";
+echo "ASTERISK: Inbound Calls Stats\n";
+echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "PLEASE SELECT A NUMBER AND DATE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+
+
+echo "ASTERISK: Inbound Calls Stats                      $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$extenSQL = "and extension='" . mysql_real_escape_string($group) . "'";
+if (eregi("\*",$group))
+	{$extenSQL = "and extension LIKE \"%$group\"";}
+$stmt="select count(*),sum(length_in_sec) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " 00:00:01' and start_time <= '" . mysql_real_escape_string($query_date) . " 23:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Total Calls That came into this number:       $TOTALcalls\n";
+echo "Average Call Length(seconds) for all Calls:   $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(length_in_sec) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " 00:00:01' and start_time <= '" . mysql_real_escape_string($query_date) . " 23:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$DROPcalls =	sprintf("%10s", $row[0]);
+$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
+$DROPpercent = round($DROPpercent, 0);
+
+if ($row[0])
+	{
+	$average_hold_seconds = ($row[1] / $row[0]);
+	$average_hold_seconds = round($average_hold_seconds, 0);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+else {$DROPpercent=0;   $average_hold_seconds=0;}
+echo "Total DROP Calls:   (less than 10 seconds)    $DROPcalls  $DROPpercent%\n";
+echo "Average Call Length(seconds) for DROP Calls:  $average_hold_seconds\n";
+
+
+##############################
+#########  CALLS STATS
+
+echo "\n";
+echo "---------- CALL LISTINGS\n";
+echo "+----------------------+----------------------+--------+---------------------+\n";
+echo "| CALLERID             | CALLERIDNAME         | LENGTH | DATE TIME           |\n";
+echo "+----------------------+----------------------+--------+---------------------+\n";
+
+$stmt="select number_dialed,caller_code,length_in_sec,start_time from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " 00:00:01' and start_time <= '" . mysql_real_escape_string($query_date) . " 23:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$CID =			sprintf("%-20s", $row[0]);
+	$CIDname =		sprintf("%-20s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
+	$datetime =		sprintf("%-19s", $row[3]);
+	$USERavgTALK =	$row[2];
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $CID | $CIDname | $USERavgTALK_MS | $datetime |\n";
+
+	$i++;
+	}
+
+echo "+----------------------+----------------------+--------+---------------------+\n";
+
+##############################
+#########  TIME STATS
+
+if ($output == 'FULL')
+	{
+
+	echo "\n";
+	echo "---------- TIME STATS\n";
+
+	echo "\n";
+
+	$hi_hour_count=0;
+	$last_full_record=0;
+	$i=0;
+	$h=0;
+	while ($i <= 96)
+		{
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:00:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:14:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:00:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:14:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:15:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:29:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:15:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:29:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:30:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:44:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:30:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:44:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:45:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:45:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+		$h++;
+		}
+
+	$hour_multiplier = (100 / $hi_hour_count);
+	#$hour_multiplier = round($hour_multiplier, 0);
+
+	echo "\n";
+	echo "GRAPH IN 15 MINUTE INCREMENTS OF TOTAL CALLS\n";
+
+	$k=1;
+	$Mk=0;
+	$call_scale = '0';
+	while ($k <= 102) 
+		{
+		if ($Mk >= 5) 
+			{
+			$Mk=0;
+			$scale_num=($k / $hour_multiplier);
+			$scale_num = round($scale_num, 0);
+			$LENscale_num = (strlen($scale_num));
+			$k = ($k + $LENscale_num);
+			$call_scale .= "$scale_num";
+			}
+		else
+			{
+			$call_scale .= " ";
+			$k++;   $Mk++;
+			}
+		}
+
+
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+	#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+	echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+	$ZZ = '00';
+	$i=0;
+	$h=4;
+	$hour= -1;
+	$no_lines_yet=1;
+
+	while ($i <= 96)
+		{
+		$char_counter=0;
+		$time = '      ';
+		if ($h >= 4) 
+			{
+			$hour++;
+			$h=0;
+			if ($hour < 10) {$hour = "0$hour";}
+			$time = "+$hour$ZZ+";
+			}
+		if ($h == 1) {$time = "   15 ";}
+		if ($h == 2) {$time = "   30 ";}
+		if ($h == 3) {$time = "   45 ";}
+		$Ghour_count = $hour_count[$i];
+		if ($Ghour_count < 1) 
+			{
+			if ( ($no_lines_yet) or ($i > $last_full_record) )
+				{
+				$do_nothing=1;
+				}
+			else
+				{
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+				echo "|$time|";
+				$k=0;   while ($k <= 102) {echo " ";   $k++;}
+				echo "| $hour_count[$i] |\n";
+				}
+			}
+		else
+			{
+			$no_lines_yet=0;
+			$Xhour_count = ($Ghour_count * $hour_multiplier);
+			$Yhour_count = (99 - $Xhour_count);
+
+			$Gdrop_count = $drop_count[$i];
+			if ($Gdrop_count < 1) 
+				{
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+				echo "|$time|";
+				$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+				echo "*X";   $char_counter++;
+				$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+					while ($char_counter <= 101) {echo " ";   $char_counter++;}
+				echo "| 0     | $hour_count[$i] |\n";
+
+				}
+			else
+				{
+				$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+			#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+				$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+				$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+				echo "|$time|";
+				$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+				echo "D";   $char_counter++;
+				$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+				echo "X";   $char_counter++;
+				$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+					while ($char_counter <= 102) {echo " ";   $char_counter++;}
+				echo "| $drop_count[$i] | $hour_count[$i] |\n";
+				}
+			}
+		
+		
+		$i++;
+		$h++;
+		}
+
+
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+
+	}
+
+
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_inboundEXTstats_department.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_inboundEXTstats_department.php new file mode 100644 index 00000000..015f6820 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_inboundEXTstats_department.php @@ -0,0 +1,178 @@ + LICENSE: GPLv2 +# +# CHANGES +# 70201-1710 - First Build +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["end_query_date"])) {$end_query_date=$_GET["end_query_date"];} + elseif (isset($_POST["end_query_date"])) {$end_query_date=$_POST["end_query_date"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($query_date)) {$query_date = $NOW_DATE;} +if (!isset($end_query_date)) {$end_query_date = $NOW_DATE;} +if (!isset($server_ip)) {$server_ip = '10.10.11.20';} + +$stmt="select distinct department from inbound_numbers;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$dept_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $dept_to_print) + { + $row=mysql_fetch_row($rslt); + $dept[$i] =$row[0]; + $i++; + } + +?> + + + + + +\n"; +#echo"\n"; +echo "ASTERISK: Inbound Calls Stats - By Department\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "PLEASE SELECT A DEPARTMENT AND DATE RANGE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+$extSQL='';
+$stmt="select extension from inbound_numbers where department='$group';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$inbound_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $inbound_to_print)
+	{
+	if (strlen($extSQL)> 1) {$extSQL .= ",";}
+	$row=mysql_fetch_row($rslt);
+	$extensions[$i] =$row[0];
+	$extSQL .= "'$extensions[$i]'";
+	$i++;
+	}
+
+echo "ASTERISK: Inbound Calls Stats For $group   from $query_date to $end_query_date\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+echo "\n";
+
+echo "+----------------------+------------+------------+\n";
+echo "| NUMBER               | CALLS      | AVG TIME   |\n";
+echo "+----------------------+------------+------------+\n";
+
+$k=0;
+while ($k < $inbound_to_print)
+	{
+	$stmt="select count(*),sum(length_in_sec) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " 00:00:01' and start_time <= '" . mysql_real_escape_string($end_query_date) . " 23:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' and extension='$extensions[$k]' ;";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+
+	$extensions[$k] = sprintf("%20s", $extensions[$k]);
+	$TOTALcalls =	sprintf("%10s", $row[0]);
+	if ( ($row[0]<1) or ($row[1]<1) )
+		{
+		$average_hold_seconds = "         0";
+		}
+	else
+		{
+		$average_hold_seconds = ($row[1] / $row[0]);
+		$average_hold_seconds = round($average_hold_seconds, 0);
+		$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+		}
+
+	$calls = ($TOTALcalls + $calls);
+	$seconds = ($row[1] + $seconds);
+
+	echo "| $extensions[$k] | $TOTALcalls | $average_hold_seconds |\n";
+	$k++;
+	}
+
+$calls =	sprintf("%10s", $calls);
+$seconds = ($seconds / $calls);
+$seconds = round($seconds, 0);
+$seconds =	sprintf("%5s", $seconds);
+echo "+----------------------+------------+------------+\n";
+echo "| TOTALS               | $calls | AVG: $seconds |\n";
+echo "+----------------------+------------+------------+\n";
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_parkstats.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_parkstats.php new file mode 100644 index 00000000..13552c30 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_parkstats.php @@ -0,0 +1,396 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1717 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = '';} +if (!isset($query_date)) {$query_date = $NOW_DATE;} + +$stmt="select distinct channel_group from park_log;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: Park Stats\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "           MODIFY | REPORTS \n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "PLEASE SELECT A GROUP AND DATE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+
+
+echo "VICIDIAL: Park Stats                             $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*),sum(parked_sec) from park_log where parked_time >= '$query_date 00:00:01' and parked_time <= '$query_date 23:59:59' and status ='HUNGUP' and channel_group='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Total Calls taken in this Group:              $TOTALcalls\n";
+echo "Average Hold Time(seconds) for all Calls:     $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- DROPS\n";
+
+$stmt="select count(*),sum(parked_sec) from park_log where parked_time >= '$query_date 00:00:01' and parked_time <= '$query_date 23:59:59' and status ='HUNGUP' and channel_group='" . mysql_real_escape_string($group) . "' and (talked_sec < 5 or talked_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$DROPcalls =	sprintf("%10s", $row[0]);
+$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
+$DROPpercent = round($DROPpercent, 0);
+
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Total Dropped Calls:                          $DROPcalls  $DROPpercent%\n";
+echo "Average Hold Time(seconds) for Dropped Calls: $average_hold_seconds\n";
+
+
+##############################
+#########  USER STATS
+
+echo "\n";
+echo "---------- USER STATS\n";
+echo "+--------------------------+------------+--------+--------+\n";
+echo "| USER                     | CALLS      | TIME M | AVRG M |\n";
+echo "+--------------------------+------------+--------+--------+\n";
+
+$stmt="select park_log.user,full_name,count(*),sum(talked_sec),avg(talked_sec) from park_log,vicidial_users where parked_time >= '$query_date 00:00:01' and parked_time <= '$query_date 23:59:59' and status ='HUNGUP' and channel_group='" . mysql_real_escape_string($group) . "' and park_log.user is not null and talked_sec is not null and talked_sec > 4 and park_log.user=vicidial_users.user group by park_log.user;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$user =			sprintf("%-6s", $row[0]);
+	$full_name =	sprintf("%-15s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
+	$USERcalls =	sprintf("%10s", $row[2]);
+	$USERtotTALK =	$row[3];
+	$USERavgTALK =	$row[4];
+
+	$USERtotTALK_M = ($USERtotTALK / 60);
+	$USERtotTALK_M = round($USERtotTALK_M, 2);
+	$USERtotTALK_M_int = intval("$USERtotTALK_M");
+	$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
+	$USERtotTALK_S = ($USERtotTALK_S * 60);
+	$USERtotTALK_S = round($USERtotTALK_S, 0);
+	if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
+	$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
+	$USERtotTALK_MS =		sprintf("%6s", $USERtotTALK_MS);
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $user - $full_name | $USERcalls | $USERtotTALK_MS | $USERavgTALK_MS |\n";
+
+	$i++;
+	}
+
+echo "+--------------------------+------------+--------+--------+\n";
+
+##############################
+#########  TIME STATS
+
+echo "\n";
+echo "---------- TIME STATS\n";
+
+echo "\n";
+
+$hi_hour_count=0;
+$last_full_record=0;
+$i=0;
+$h=0;
+while ($i <= 96)
+	{
+	$stmt="select count(*) from park_log where parked_time >= '$query_date $h:00:00' and parked_time <= '$query_date $h:14:59' and status ='HUNGUP' and channel_group='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from park_log where parked_time >= '$query_date $h:00:00' and parked_time <= '$query_date $h:14:59' and status ='HUNGUP' and channel_group='" . mysql_real_escape_string($group) . "' and (talked_sec < 5 or talked_sec is null);";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+
+	$stmt="select count(*) from park_log where parked_time >= '$query_date $h:15:00' and parked_time <= '$query_date $h:29:59' and status ='HUNGUP' and channel_group='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from park_log where parked_time >= '$query_date $h:15:00' and parked_time <= '$query_date $h:29:59' and status ='HUNGUP' and channel_group='" . mysql_real_escape_string($group) . "' and (talked_sec < 5 or talked_sec is null);";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from park_log where parked_time >= '$query_date $h:30:00' and parked_time <= '$query_date $h:44:59' and status ='HUNGUP' and channel_group='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from park_log where parked_time >= '$query_date $h:30:00' and parked_time <= '$query_date $h:44:59' and status ='HUNGUP' and channel_group='" . mysql_real_escape_string($group) . "' and (talked_sec < 5 or talked_sec is null);";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+
+	$stmt="select count(*) from park_log where parked_time >= '$query_date $h:45:00' and parked_time <= '$query_date $h:59:59' and status ='HUNGUP' and channel_group='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from park_log where parked_time >= '$query_date $h:45:00' and parked_time <= '$query_date $h:59:59' and status ='HUNGUP' and channel_group='" . mysql_real_escape_string($group) . "' and (talked_sec < 5 or talked_sec is null);";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$i++;
+	$h++;
+	}
+
+$hour_multiplier = (100 / $hi_hour_count);
+#$hour_multiplier = round($hour_multiplier, 0);
+
+echo "\n";
+echo "GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP\n";
+
+$k=1;
+$Mk=0;
+$call_scale = '0';
+while ($k <= 102) 
+	{
+	if ($Mk >= 5) 
+		{
+		$Mk=0;
+		$scale_num=($k / $hour_multiplier);
+		$scale_num = round($scale_num, 0);
+		$LENscale_num = (strlen($scale_num));
+		$k = ($k + $LENscale_num);
+		$call_scale .= "$scale_num";
+		}
+	else
+		{
+		$call_scale .= " ";
+		$k++;   $Mk++;
+		}
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+$ZZ = '00';
+$i=0;
+$h=4;
+$hour= -1;
+$no_lines_yet=1;
+
+while ($i <= 96)
+	{
+	$char_counter=0;
+	$time = '      ';
+	if ($h >= 4) 
+		{
+		$hour++;
+		$h=0;
+		if ($hour < 10) {$hour = "0$hour";}
+		$time = "+$hour$ZZ+";
+		}
+	if ($h == 1) {$time = "   15 ";}
+	if ($h == 2) {$time = "   30 ";}
+	if ($h == 3) {$time = "   45 ";}
+	$Ghour_count = $hour_count[$i];
+	if ($Ghour_count < 1) 
+		{
+		if ( ($no_lines_yet) or ($i > $last_full_record) )
+			{
+			$do_nothing=1;
+			}
+		else
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			echo "|$time|";
+			$k=0;   while ($k <= 102) {echo " ";   $k++;}
+			echo "| $hour_count[$i] |\n";
+			}
+		}
+	else
+		{
+		$no_lines_yet=0;
+		$Xhour_count = ($Ghour_count * $hour_multiplier);
+		$Yhour_count = (99 - $Xhour_count);
+
+		$Gdrop_count = $drop_count[$i];
+		if ($Gdrop_count < 1) 
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "*X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 101) {echo " ";   $char_counter++;}
+			echo "| 0     | $hour_count[$i] |\n";
+
+			}
+		else
+			{
+			$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+		#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+			$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+			echo "|$time|";
+			$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+			echo "D";   $char_counter++;
+			$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "X";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 102) {echo " ";   $char_counter++;}
+			echo "| $drop_count[$i] | $hour_count[$i] |\n";
+			}
+		}
+	
+	
+	$i++;
+	$h++;
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+
+
+
+
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_server_performance.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_server_performance.php new file mode 100644 index 00000000..afa75bd3 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_server_performance.php @@ -0,0 +1,306 @@ + LICENSE: GPLv2 +# +# CHANGES +# +# 60619-1732 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 70417-1106 - Changed time frame to be definable per time range on a single day +# - Fixed vertical scaling issues +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["begin_query_time"])) {$begin_query_time=$_GET["begin_query_time"];} + elseif (isset($_POST["begin_query_time"])) {$begin_query_time=$_POST["begin_query_time"];} +if (isset($_GET["end_query_time"])) {$end_query_time=$_GET["end_query_time"];} + elseif (isset($_POST["end_query_time"])) {$end_query_time=$_POST["end_query_time"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and modify_servers='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +# path from root to where ploticus files will be stored +$PLOTroot = "vicidial/ploticus"; +$DOCroot = "$WeBServeRRooT/$PLOTroot/"; + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); + +if (!isset($query_date)) {$query_date = $NOW_DATE;} +if (!isset($begin_query_time)) {$begin_query_time = '09:00:00';} +if (!isset($end_query_time)) {$end_query_time = '15:30:00';} +if (!isset($group)) {$group = '';} + +$stmt="select server_ip from servers;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$servers_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $servers_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: Server Performance\n"; +echo "
\n"; +echo "Date:   \n"; +echo "Time: \n"; +echo "to \n"; +echo "Server: \n"; +echo "\n"; +echo "             REPORTS \n"; +echo "
\n\n"; + +echo "
\n";
+
+
+if (!$group)
+{
+echo "\n";
+echo "PLEASE SELECT A SERVER, DATE AND TIME RANGE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+
+$query_date_BEGIN = "$query_date $begin_query_time";   
+$query_date_END = "$query_date $end_query_time";
+$time_BEGIN = "$begin_query_time";   
+$time_END = "$end_query_time";
+
+echo "VICIDIAL: Server Performance                             $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- TOTALS, PEAKS and AVERAGES\n";
+
+$stmt="select AVG(sysload),AVG(channels_total),MAX(sysload),MAX(channels_total),MAX(processes) from server_performance where start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and server_ip='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$AVGload =	sprintf("%10s", $row[0]);
+$AVGchannels =	sprintf("%10s", $row[1]);
+$HIGHload =	$row[2];
+	$HIGHmulti = intval($HIGHload / 100);
+$HIGHchannels =	$row[3];
+$HIGHprocesses =$row[4];
+if ($row[2] > $row[3]) {$HIGHlimit = $row[2];}
+else {$HIGHlimit = $row[3];}
+if ($HIGHlimit < $row[4]) {$HIGHlimit = $row[4];}
+
+$stmt="select AVG(cpu_user_percent),AVG(cpu_system_percent),AVG(cpu_idle_percent) from server_performance where start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and server_ip='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$AVGcpuUSER =	sprintf("%10s", $row[0]);
+$AVGcpuSYSTEM =	sprintf("%10s", $row[1]);
+$AVGcpuIDLE =	sprintf("%10s", $row[2]);
+
+$stmt="select count(*),SUM(length_in_min) from call_log where extension NOT IN('8365','8366','8367') and  start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and server_ip='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$OFFHOOKtime =	sprintf("%10s", $row[1]);
+
+
+echo "Total Calls in/out on this server:        $TOTALcalls\n";
+echo "Total Off-Hook time on this server (min): $OFFHOOKtime\n";
+echo "Average/Peak channels in use for server:  $AVGchannels / $HIGHchannels\n";
+echo "Average/Peak load for server:             $AVGload / $HIGHload\n";
+echo "Average USER process cpu percentage:      $AVGcpuUSER %\n";
+echo "Average SYSTEM process cpu percentage:    $AVGcpuSYSTEM %\n";
+echo "Average IDLE process cpu percentage:      $AVGcpuIDLE %\n";
+
+echo "\n";
+echo "---------- LINE GRAPH:\n";
+
+
+
+##############################
+#########  Graph stats
+
+$DAT = '.dat';
+$HTM = '.htm';
+$PNG = '.png';
+$filedate = date("Y-m-d_His");
+$DATfile = "$group$query_date$shift$filedate$DAT";
+$HTMfile = "$group$query_date$shift$filedate$HTM";
+$PNGfile = "$group$query_date$shift$filedate$PNG";
+
+$HTMfp = fopen ("$DOCroot/$HTMfile", "a");
+$DATfp = fopen ("$DOCroot/$DATfile", "a");
+
+$stmt="select DATE_FORMAT(start_time,'%H:%i:%s') as timex,sysload,processes,channels_total,live_recordings,cpu_user_percent,cpu_system_percent from server_performance where server_ip='" . mysql_real_escape_string($group) . "' and start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' order by timex;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$row[5] = intval(($row[5] + $row[6]) * $HIGHmulti);
+	$row[6] = intval($row[6] * $HIGHmulti);
+	fwrite ($DATfp, "$row[5]\t$row[6]\t$row[0]\t$row[1]\t$row[2]\t$row[3]\n");
+	$i++;
+	}
+fclose($DATfp);
+
+$rows_to_max = ($rows_to_print + 100);
+
+#print "rows: $i\n";
+
+$time_scale_abb = '5 minutes';
+$time_scale_tick = '1 minute';
+if ($i > 1000) {$time_scale_abb = '10 minutes';   $time_scale_tick = '2 minutes';}
+if ($i > 2000) {$time_scale_abb = '20 minutes';   $time_scale_tick = '4 minutes';}
+if ($i > 3000) {$time_scale_abb = '30 minutes';   $time_scale_tick = '5 minutes';}
+if ($i > 4000) {$time_scale_abb = '40 minutes';   $time_scale_tick = '10 minutes';}
+if ($i > 5000) {$time_scale_abb = '60 minutes';   $time_scale_tick = '15 minutes';}
+if ($i > 6000) {$time_scale_abb = '90 minutes';   $time_scale_tick = '15 minutes';}
+if ($i > 7000) {$time_scale_abb = '120 minutes';   $time_scale_tick = '30 minutes';}
+
+$HTMcontent  = '';
+$HTMcontent .= "#proc page\n";
+$HTMcontent .= "#if @DEVICE in png,gif\n";
+$HTMcontent .= "   scale: 0.6\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#endif\n";
+$HTMcontent .= "#proc getdata\n";
+$HTMcontent .= "file: $DOCroot/$DATfile\n";
+$HTMcontent .= "fieldnames: userproc sysproc time load processes channels\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc areadef\n";
+$HTMcontent .= "title: Server $group   $query_date_BEGIN to $query_date_END\n";
+$HTMcontent .= "titledetails: size=14  align=C\n";
+$HTMcontent .= "rectangle: 1 1 14 7\n";
+$HTMcontent .= "xscaletype: time hh:mm:ss\n";
+$HTMcontent .= "xrange: $time_BEGIN $time_END\n";
+$HTMcontent .= "yrange: 0 $HIGHlimit\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc xaxis\n";
+$HTMcontent .= "stubs: inc $time_scale_abb\n";
+$HTMcontent .= "minorticinc: $time_scale_tick\n";
+$HTMcontent .= "stubformat: hh:mm:ssa\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc yaxis\n";
+$HTMcontent .= "stubs: inc 50\n";
+$HTMcontent .= "grid: color=yellow\n";
+$HTMcontent .= "gridskip: min\n";
+$HTMcontent .= "ticincrement: 100 1000\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc lineplot\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: userproc\n";
+$HTMcontent .= "linedetails: color=purple width=.5\n";
+$HTMcontent .= "fill: lavender\n";
+$HTMcontent .= "legendlabel: user proc%\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc lineplot\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: sysproc\n";
+$HTMcontent .= "linedetails: color=yelloworange width=.5\n";
+$HTMcontent .= "fill: dullyellow\n";
+$HTMcontent .= "legendlabel: system proc%\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: load\n";
+$HTMcontent .= "linedetails: color=blue width=.5\n";
+$HTMcontent .= "legendlabel: load\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: processes\n";
+$HTMcontent .= "linedetails: color=red width=.5\n";
+$HTMcontent .= "legendlabel: processes\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc curvefit\n";
+$HTMcontent .= "xfield: time\n";
+$HTMcontent .= "yfield: channels\n";
+$HTMcontent .= "linedetails: color=green width=.5\n";
+$HTMcontent .= "legendlabel: channels\n";
+$HTMcontent .= "maxinpoints: $rows_to_max\n";
+$HTMcontent .= "\n";
+$HTMcontent .= "#proc legend\n";
+$HTMcontent .= "location: max-2 max\n";
+$HTMcontent .= "seglen: 0.2\n";
+$HTMcontent .= "\n";
+
+fwrite ($HTMfp, "$HTMcontent");
+fclose($HTMfp);
+
+
+passthru("/usr/local/bin/pl -png $DOCroot/$HTMfile -o $DOCroot/$PNGfile");
+
+sleep(1);
+
+echo "
\n"; +echo "\n"; +echo "\n"; + + +echo ""; + +} + + + +?> + + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_timeonVDAD.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_timeonVDAD.php new file mode 100644 index 00000000..e9c8f52e --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_timeonVDAD.php @@ -0,0 +1,374 @@ + LICENSE: GPLv2 +### +# live real-time stats for the VICIDIAL Auto-Dialer +# +# CHANGES +# +# 60620-1037 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 61114-2004 - Changed to display CLOSER and DEFAULT, added trunk shortage +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["reset_counter"])) {$reset_counter=$_GET["reset_counter"];} + elseif (isset($_POST["reset_counter"])) {$reset_counter=$_POST["reset_counter"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["closer_display"])) {$closer_display=$_GET["closer_display"];} + elseif (isset($_POST["closer_display"])) {$closer_display=$_POST["closer_display"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +$epochSIXhoursAGO = ($STARTtime - 21600); +$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO); + +$reset_counter++; + +if ($reset_counter > 7) + { + $reset_counter=0; + + $stmt="update park_log set status='HUNGUP' where hangup_time is not null;"; +# $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + + if ($DB) + { + $stmt="delete from park_log where grab_time < '$timeSIXhoursAGO' and (hangup_time is null or hangup_time='');"; +# $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + } + } + +?> + + + +\n"; +echo " + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On VDAD\n"; +echo "
";
+
+###################################################################################
+###### SERVER INFORMATION
+###################################################################################
+
+$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where server_ip='" . mysql_real_escape_string($server_ip) . "';";
+$rslt=mysql_query($stmt, $link);
+$row=mysql_fetch_row($rslt);
+$balanceSHORT = $row[0];
+
+echo "SERVER: $server_ip\n";
+
+
+
+###################################################################################
+###### TIME ON SYSTEM
+###################################################################################
+
+if ($closer_display>0) {$closer_display_reverse=0;   $closer_reverse_link='DEFAULT';}
+else {$closer_display_reverse=1;   $closer_reverse_link='CLOSER';}
+
+echo "VICIDIAL: Agents Time On Calls           $NOW_TIME    $closer_reverse_link | REPORTS\n\n";
+
+if ($closer_display>0)
+{
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+echo "| STATION    | USER   | SESSIONID | CHANNEL             | STATUS | CALLTIME | MINUTES | CAMPAIGN     | FRONT  |\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+}
+else
+{
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+\n";
+echo "| STATION    | USER   | SESSIONID | CHANNEL             | STATUS | CALLTIME | MINUTES |\n";
+echo "+------------|--------+-----------+---------------------+--------+----------+---------+\n";
+}
+
+$stmt="select extension,user,conf_exten,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),uniqueid,lead_id from vicidial_live_agents where status NOT IN('PAUSED') and server_ip='" . mysql_real_escape_string($server_ip) . "' order by extension;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$talking_to_print = mysql_num_rows($rslt);
+	if ($talking_to_print > 0)
+	{
+	$i=0;
+	while ($i < $talking_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+			if (eregi("READY|PAUSED|CLOSER",$row[4]))
+			{
+			$row[3]='';
+			$row[5]='- WAIT -';
+			$row[6]=$row[7];
+			}
+		$extension[$i] = eregi_replace('Local/',"",$row[0]);
+		$extension[$i] =		sprintf("%-10s", $extension[$i]);
+			while(strlen($extension[$i])>10) {$extension[$i] = substr("$extension[$i]", 0, -1);}
+		$user[$i] =				sprintf("%-6s", $row[1]);
+		$sessionid[$i] =		sprintf("%-9s", $row[2]);
+		$channel[$i] =			sprintf("%-19s", $row[3]);
+			$cc[$i]=0;
+		while ( (strlen($channel[$i]) > 19) and ($cc[$i] < 100) )
+			{
+			$channel[$i] = eregi_replace(".$","",$channel[$i]);   
+			$cc[$i]++;
+			if (strlen($channel[$i]) <= 19) {$cc[$i]=101;}
+			}
+		$status[$i] =			sprintf("%-6s", $row[4]);
+		$start_time[$i] =		sprintf("%-8s", $row[5]);
+			$cd[$i]=0;
+		while ( (strlen($start_time[$i]) > 8) and ($cd[$i] < 100) )
+			{
+			$start_time[$i] = eregi_replace("^.","",$start_time[$i]);   
+			$cd[$i]++;
+			if (strlen($start_time[$i]) <= 8) {$cd[$i]=101;}
+			}
+		$uniqueid[$i] =			$row[8];
+		$lead_id[$i] =			$row[9];
+		$closer[$i] =			$row[1];
+		$call_time_S[$i] = ($STARTtime - $row[6]);
+
+		$call_time_M[$i] = ($call_time_S[$i] / 60);
+		$call_time_M[$i] = round($call_time_M[$i], 2);
+		$call_time_M_int[$i] = intval("$call_time_M[$i]");
+		$call_time_SEC[$i] = ($call_time_M[$i] - $call_time_M_int[$i]);
+		$call_time_SEC[$i] = ($call_time_SEC[$i] * 60);
+		$call_time_SEC[$i] = round($call_time_SEC[$i], 0);
+		if ($call_time_SEC[$i] < 10) {$call_time_SEC[$i] = "0$call_time_SEC[$i]";}
+		$call_time_MS[$i] = "$call_time_M_int[$i]:$call_time_SEC[$i]";
+		$call_time_MS[$i] =		sprintf("%7s", $call_time_MS[$i]);
+
+		if ($closer_display<1)
+			{
+			$G = '';		$EG = '';
+			if ($call_time_M_int[$i] >= 5) {$G=''; $EG='';}
+			if ($call_time_M_int[$i] >= 10) {$G=''; $EG='';}
+			if (eregi("PAUSED",$row[4])) 
+				{
+				if ($call_time_M_int >= 1) 
+					{$i++; continue;} 
+				else
+					{$G=''; $EG='';}
+				}
+			$agentcount++;
+			echo "| $G$extension[$i]$EG | $G$user[$i]$EG | $G$sessionid[$i]$EG | $G$channel[$i]$EG | $G$status[$i]$EG | $G$start_time[$i]$EG | $G$call_time_MS[$i]$EG |\n";
+			}
+		$i++;
+		}
+
+		if ($closer_display>0)
+		{
+
+			$ext_count = $i;
+			$i=0;
+		while ($i < $ext_count)
+			{
+
+			$stmt="select campaign_id from vicidial_auto_calls where lead_id='$lead_id[$i]' and server_ip='" . mysql_real_escape_string($server_ip) . "';";
+			$rslt=mysql_query($stmt, $link);
+			if ($DB) {echo "$stmt\n";}
+			$camp_to_print = mysql_num_rows($rslt);
+			if ($camp_to_print > 0)
+				{
+				$row=mysql_fetch_row($rslt);
+				$campaign = sprintf("%-12s", $row[0]);
+				$camp_color = $row[0];
+				}
+			else
+				{$campaign = 'DEAD        ';   	$camp_color = 'DEAD';}
+			if (eregi("READY|PAUSED|CLOSER",$status[$i]))
+				{$campaign = '            ';   	$camp_color = '';}
+
+			$stmt="select user from vicidial_xfer_log where lead_id='$lead_id[$i]' and closer='$closer[$i]' order by call_date desc limit 1;";
+			$rslt=mysql_query($stmt, $link);
+			if ($DB) {echo "$stmt\n";}
+			$xfer_to_print = mysql_num_rows($rslt);
+			if ($xfer_to_print > 0)
+				{
+				$row=mysql_fetch_row($rslt);
+				$fronter = sprintf("%-6s", $row[0]);
+				}
+			else
+				{$fronter = '      ';}
+
+			$G = '';		$EG = '';
+			$G=""; $EG='';
+		#	if ($call_time_M_int[$i] >= 5) {$G=''; $EG='';}
+		#	if ($call_time_M_int[$i] >= 10) {$G=''; $EG='';}
+
+			echo "| $G$extension[$i]$EG | $G$user[$i]$EG | $G$sessionid[$i]$EG | $G$channel[$i]$EG | $G$status[$i]$EG | $G$start_time[$i]$EG | $G$call_time_MS[$i]$EG | $G$campaign$EG | $G$fronter$EG |\n";
+
+			$i++;
+			}
+		echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
+		echo "  $i agents logged in on server $server_ip\n\n";
+	#	echo "             - 5 minutes or more on call\n";
+	#	echo "             - Over 10 minutes on call\n";
+		}
+	else
+		{
+		echo "+------------|--------+-----------+---------------------+--------+----------+---------+\n";
+		echo "  $agentcount agents logged in on server $server_ip\n\n";
+
+		echo "             - Paused agents\n";
+		echo "             - 5 minutes or more on call\n";
+		echo "             - Over 10 minutes on call\n";
+		}
+
+	}
+	else
+	{
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	echo "********************************* NO AGENTS ON CALLS *********************************\n";
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	}
+
+
+###################################################################################
+###### OUTBOUND CALLS
+###################################################################################
+#echo "\n\n";
+echo "----------------------------------------------------------------------------------------";
+echo "\n\n";
+echo "VICIDIAL: Time On VDAD            TRUNK SHORT: $balanceSHORT              $NOW_TIME\n\n";
+echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+echo "| CHANNEL             | STATUS | CAMPAIGN     | PHONE NUMBER       | CALLTIME | MINUTES |\n";
+echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+
+$stmt="select channel,status,campaign_id,phone_code,phone_number,call_time,UNIX_TIMESTAMP(call_time) from vicidial_auto_calls where status NOT IN('XFER') and server_ip='" . mysql_real_escape_string($server_ip) . "' order by auto_call_id desc;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$parked_to_print = mysql_num_rows($rslt);
+	if ($parked_to_print > 0)
+	{
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$channel =			sprintf("%-19s", $row[0]);
+			$cc=0;
+		while ( (strlen($channel) > 19) and ($cc < 100) )
+			{
+			$channel = eregi_replace(".$","",$channel);   
+			$cc++;
+			if (strlen($channel) <= 19) {$cc=101;}
+			}
+		$start_time =		sprintf("%-8s", $row[5]);
+			$cd=0;
+		while ( (strlen($start_time) > 8) and ($cd < 100) )
+			{
+			$start_time = eregi_replace("^.","",$start_time);   
+			$cd++;
+			if (strlen($start_time) <= 8) {$cd=101;}
+			}
+		$status =			sprintf("%-6s", $row[1]);
+		$campaign =			sprintf("%-12s", $row[2]);
+			$all_phone = "$row[3]$row[4]";
+		$number_dialed =	sprintf("%-18s", $all_phone);
+		$call_time_S = ($STARTtime - $row[6]);
+
+		$call_time_M = ($call_time_S / 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";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if (eregi("LIVE",$status)) {$G=''; $EG='';}
+	#	if ($call_time_M_int >= 6) {$G=''; $EG='';}
+
+		echo "| $G$channel$EG | $G$status$EG | $G$campaign$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
+		echo "  $i calls being placed on server $server_ip\n\n";
+
+		echo "             - LIVE CALL WAITING\n";
+	#	echo "             - Over 5 minutes on hold\n";
+
+		}
+	else
+	{
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	echo "******************************* NO LIVE CALLS WAITING *********************************\n";
+	echo "***************************************************************************************\n";
+	echo "***************************************************************************************\n";
+	}
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_timeonVDADall.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_timeonVDADall.php new file mode 100644 index 00000000..044daf92 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_timeonVDADall.php @@ -0,0 +1,929 @@ + LICENSE: GPLv2 +# +# live real-time stats for the VICIDIAL Auto-Dialer all servers +# +# STOP=4000, SLOW=40, GO=4 seconds refresh interval +# +# CHANGELOG: +# 50406-0920 - Added Paused agents < 1 min (Chris Doyle) +# 51130-1218 - Modified layout and info to show all servers in a vicidial system +# 60421-1043 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60511-1343 - Added leads and drop info at the top of the screen +# 60608-1539 - Fixed CLOSER tallies for active calls +# 60619-1658 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 60626-1453 - Added display of system load to bottom (Angelito Manansala) +# 60901-1123 - Changed display elements at the top of the screen +# 60905-1342 - Fixed non INCALL|QUEUE timer column +# 61002-1642 - Added TRUNK SHORT/FILL stats +# 61101-1318 - Added SIP and IAX Listen and Barge links option +# 61101-1647 - Added Usergroup column and user name option as well as sorting +# 61102-1155 - Made display of columns more modular, added ability to hide server info +# 61215-1131 - Added answered calls and drop percent taken from answered calls +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70123-1151 - Added non_latin options for substr in display variables, thanks Marin Blu +# 70206-1140 - Added call-type statuses to display(A-Auto, M-Manual, I-Inbound/Closer) +# 70619-1339 - Added Status Category tally display +# 71029-1900 - Changed CLOSER-type to not require campaign_id restriction +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["RR"])) {$RR=$_GET["RR"];} + elseif (isset($_POST["RR"])) {$RR=$_POST["RR"];} +if (isset($_GET["inbound"])) {$inbound=$_GET["inbound"];} + elseif (isset($_POST["inbound"])) {$inbound=$_POST["inbound"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["usergroup"])) {$usergroup=$_GET["usergroup"];} + elseif (isset($_POST["usergroup"])) {$usergroup=$_POST["usergroup"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["adastats"])) {$adastats=$_GET["adastats"];} + elseif (isset($_POST["adastats"])) {$adastats=$_POST["adastats"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["SIPmonitorLINK"])) {$SIPmonitorLINK=$_GET["SIPmonitorLINK"];} + elseif (isset($_POST["SIPmonitorLINK"])) {$SIPmonitorLINK=$_POST["SIPmonitorLINK"];} +if (isset($_GET["IAXmonitorLINK"])) {$IAXmonitorLINK=$_GET["IAXmonitorLINK"];} + elseif (isset($_POST["IAXmonitorLINK"])) {$IAXmonitorLINK=$_POST["IAXmonitorLINK"];} +if (isset($_GET["UGdisplay"])) {$UGdisplay=$_GET["UGdisplay"];} + elseif (isset($_POST["UGdisplay"])) {$UGdisplay=$_POST["UGdisplay"];} +if (isset($_GET["UidORname"])) {$UidORname=$_GET["UidORname"];} + elseif (isset($_POST["UidORname"])) {$UidORname=$_POST["UidORname"];} +if (isset($_GET["orderby"])) {$orderby=$_GET["orderby"];} + elseif (isset($_POST["orderby"])) {$orderby=$_POST["orderby"];} +if (isset($_GET["SERVdisplay"])) {$SERVdisplay=$_GET["SERVdisplay"];} + elseif (isset($_POST["SERVdisplay"])) {$SERVdisplay=$_POST["SERVdisplay"];} +if (isset($_GET["CALLSdisplay"])) {$CALLSdisplay=$_GET["CALLSdisplay"];} + elseif (isset($_POST["CALLSdisplay"])) {$CALLSdisplay=$_POST["CALLSdisplay"];} + + +if (!isset($RR)) {$gRRroup=4;} +if (!isset($group)) {$group='';} +if (!isset($usergroup)) {$usergroup='';} +if (!isset($UGdisplay)) {$UGdisplay=0;} # 0=no, 1=yes +if (!isset($UidORname)) {$UidORname=0;} # 0=id, 1=name +if (!isset($orderby)) {$orderby='timeup';} +if (!isset($SERVdisplay)) {$SERVdisplay=1;} # 0=no, 1=yes +if (!isset($CALLSdisplay)) {$CALLSdisplay=1;} # 0=no, 1=yes + + +function get_server_load($windows = false) { +$os = strtolower(PHP_OS); +if(strpos($os, "win") === false) { +if(file_exists("/proc/loadavg")) { +$load = file_get_contents("/proc/loadavg"); +$load = explode(' ', $load); +return $load[0]; +} +elseif(function_exists("shell_exec")) { +$load = explode(' ', `uptime`); +return $load[count($load)-1]; +} +else { +return false; +} +} +elseif($windows) { +if(class_exists("COM")) { +$wmi = new COM("WinMgmts:\\\\."); +$cpus = $wmi->InstancesOf("Win32_Processor"); + +$cpuload = 0; +$i = 0; +while ($cpu = $cpus->Next()) { +$cpuload += $cpu->LoadPercentage; +$i++; +} + +$cpuload = round($cpuload / $i, 2); +return "$cpuload%"; +} +else { +return false; +} +} +} + +$load_ave = get_server_load(true); + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + 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($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_TIME = date("Y-m-d H:i:s"); +$NOW_DAY = date("Y-m-d"); +$NOW_HOUR = date("H:i:s"); +$STARTtime = date("U"); +$epochSIXhoursAGO = ($STARTtime - 21600); +$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO); + +$stmt="select campaign_id from vicidial_campaigns where active='Y';"; +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +if (!isset($DB)) {$DB=0;} +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + +$stmt="select * from vicidial_user_groups;"; +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +if (!isset($DB)) {$DB=0;} +if ($DB) {echo "$stmt\n";} +$usergroups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $usergroups_to_print) + { + $row=mysql_fetch_row($rslt); + $usergroups[$i] =$row[0]; + $i++; + } + +if (!isset($RR)) {$RR=4;} + +$NFB = ''; +$NFE = ''; +$F=''; $FG=''; $B=''; $BG=''; + +?> + + + +\n"; + +$stmt = "select count(*) from vicidial_campaigns where campaign_id='$group' and campaign_allow_inbound='Y';"; +$rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $campaign_allow_inbound = $row[0]; + +echo "\n"; +echo"\n"; +echo "VICIDIAL: Time On VDAD Campaign: $group\n"; +echo "
\n"; +echo "VICIDIAL Campaign: \n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +if ($UGdisplay > 0) + { + echo "\n"; + } +echo "         \n"; +echo "STOP | "; +echo "SLOW | "; +echo "GO"; +echo "       MODIFY | \n"; +echo "SUMMARY | \n"; +echo "REPORTS \n"; +echo "\n\n"; + + +if (!$group) {echo "

please select a campaign from the pulldown above
\n"; exit;} +else +{ +$stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select avg(auto_dial_level),min(dial_status_a),min(dial_status_b),min(dial_status_c),min(dial_status_d),min(dial_status_e),min(lead_order),min(lead_filter_id),sum(hopper_level),min(dial_method),avg(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),min(available_only_ratio_tally),min(adaptive_latest_server_time),min(local_call_time),avg(dial_timeout),min(dial_statuses) from vicidial_campaigns;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$DIALlev = $row[0]; +$DIALstatusA = $row[1]; +$DIALstatusB = $row[2]; +$DIALstatusC = $row[3]; +$DIALstatusD = $row[4]; +$DIALstatusE = $row[5]; +$DIALorder = $row[6]; +$DIALfilter = $row[7]; +$HOPlev = $row[8]; +$DIALmethod = $row[9]; +$maxDIALlev = $row[10]; +$DROPmax = $row[11]; +$targetDIFF = $row[12]; +$ADAintense = $row[13]; +$ADAavailonly = $row[14]; +$TAPERtime = $row[15]; +$CALLtime = $row[16]; +$DIALtimeout = $row[17]; +$DIALstatuses = $row[18]; + $DIALstatuses = (preg_replace("/ -$|^ /","",$DIALstatuses)); + $DIALstatuses = (ereg_replace(' ',', ',$DIALstatuses)); + +$stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select count(*) from vicidial_hopper;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$VDhop = $row[0]; + +$stmt="select dialable_leads,calls_today,drops_today,drops_answers_today_pct,differential_onemin,agents_average_onemin,balance_trunk_fill,answers_today,status_category_1,status_category_count_1,status_category_2,status_category_count_2,status_category_3,status_category_count_3,status_category_4,status_category_count_4 from vicidial_campaign_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),min(status_category_1),sum(status_category_count_1),min(status_category_2),sum(status_category_count_2),min(status_category_3),sum(status_category_count_3),min(status_category_4),sum(status_category_count_4) from vicidial_campaign_stats;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$DAleads = $row[0]; +$callsTODAY = $row[1]; +$dropsTODAY = $row[2]; +$drpctTODAY = $row[3]; +$diffONEMIN = $row[4]; +$agentsONEMIN = $row[5]; +$balanceFILL = $row[6]; +$answersTODAY = $row[7]; +$VSCcat1 = $row[8]; +$VSCcat1tally = $row[9]; +$VSCcat2 = $row[10]; +$VSCcat2tally = $row[11]; +$VSCcat3 = $row[12]; +$VSCcat3tally = $row[13]; +$VSCcat4 = $row[14]; +$VSCcat4tally = $row[15]; + +if ( ($diffONEMIN != 0) and ($agentsONEMIN > 0) ) + { + $diffpctONEMIN = ( ($diffONEMIN / $agentsONEMIN) * 100); + $diffpctONEMIN = sprintf("%01.2f", $diffpctONEMIN); + } +else {$diffpctONEMIN = '0.00';} + +$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$balanceSHORT = $row[0]; + +echo "
"; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +if ($adastats>1) + { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; + + + + +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo "
DIAL LEVEL:  $DIALlev    TRUNK SHORT/FILL:  $balanceSHORT / $balanceFILL     FILTER:  $DIALfilter   TIME:   $NOW_TIME
- min   MAX LEVEL:  $maxDIALlev   DROPPED MAX:  $DROPmax%    TARGET DIFF:  $targetDIFF     INTENSITY:  $ADAintense    
DIAL TIMEOUT:  $DIALtimeout  TAPER TIME:  $TAPERtime  LOCAL TIME:  $CALLtime  AVAIL ONLY:  $ADAavailonly  
DIALABLE LEADS:  $DAleads     CALLS TODAY:  $callsTODAY     AVG AGENTS:  $agentsONEMIN     DIAL METHOD:  $DIALmethod    
HOPPER LEVEL:  $HOPlev     DROPPED / ANSWERED:  $dropsTODAY / $answersTODAY   DL DIFF:  $diffONEMIN     STATUSES:  $DIALstatuses    
LEADS IN HOPPER:  $VDhop     DROPPED PERCENT:  "; +if ($drpctTODAY >= $DROPmax) + {echo "$drpctTODAY%";} +else + {echo "$drpctTODAY%";} +echo "    DIFF:  $diffpctONEMIN%     ORDER:  $DIALorder    
"; +if ( (!eregi('NULL',$VSCcat1)) and (strlen($VSCcat1)>0) ) + {echo "$VSCcat1:   $VSCcat1tally       \n";} +if ( (!eregi('NULL',$VSCcat2)) and (strlen($VSCcat2)>0) ) + {echo "$VSCcat2:   $VSCcat2tally       \n";} +if ( (!eregi('NULL',$VSCcat3)) and (strlen($VSCcat3)>0) ) + {echo "$VSCcat3:   $VSCcat3tally       \n";} +if ( (!eregi('NULL',$VSCcat4)) and (strlen($VSCcat4)>0) ) + {echo "$VSCcat4:   $VSCcat4tally       \n";} +echo "
"; + +if ($adastats<2) + { + echo "+ VIEW MORE SETTINGS"; + } +if ($UGdisplay>0) + { + echo "       HIDE USER GROUP"; + } +else + { + echo "       VIEW USER GROUP"; + } +if ($UidORname>0) + { + echo "       SHOW AGENT ID"; + } +else + { + echo "       SHOW AGENT NAME"; + } +if ($SERVdisplay>0) + { + echo "       HIDE SERVER INFO"; + } +else + { + echo "       SHOW SERVER INFO"; + } +if ($CALLSdisplay>0) + { + echo "       HIDE WAITING CALLS DETAIL"; + } +else + { + echo "       SHOW WAITING CALLS DETAIL"; + } +echo "
"; + +echo "\n\n"; +} +################################################################################### +###### INBOUND/OUTBOUND CALLS +################################################################################### +if ($campaign_allow_inbound > 0) + { + $stmt="select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; + if ($non_latin > 0) + { + $rslt=mysql_query("SET NAMES 'UTF8'"); + } + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = preg_replace("/^ | -$/","",$row[0]); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaigns = "'$closer_campaigns'"; + + $stmtB="from vicidial_auto_calls where status NOT IN('XFER') and ( (call_type='IN' and campaign_id IN($closer_campaigns)) or (campaign_id='" . mysql_real_escape_string($group) . "' and call_type IN('OUT','OUTBALANCE')) ) order by campaign_id,call_time;"; + } +else + { + if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';} + else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";} + + $stmtB="from vicidial_auto_calls where status NOT IN('XFER') $groupSQL order by campaign_id,call_time;"; + } +if ($CALLSdisplay > 0) + { + $stmtA = "SELECT status,campaign_id,phone_number,server_ip,UNIX_TIMESTAMP(call_time),call_type"; + } +else + { + $stmtA = "SELECT status"; + } + +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} + +$k=0; +$stmt = "$stmtA $stmtB"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$parked_to_print = mysql_num_rows($rslt); + if ($parked_to_print > 0) + { + $i=0; + $out_total=0; + $out_ring=0; + $out_live=0; + while ($i < $parked_to_print) + { + $row=mysql_fetch_row($rslt); + + if (eregi("LIVE",$row[0])) + { + $out_live++; + + if ($CALLSdisplay > 0) + { + $CDstatus[$k] = $row[0]; + $CDcampaign_id[$k] = $row[1]; + $CDphone_number[$k] = $row[2]; + $CDserver_ip[$k] = $row[3]; + $CDcall_time[$k] = $row[4]; + $CDcall_type[$k] = $row[5]; + $k++; + } + } + else + { + if (eregi("CLOSER",$row[0])) + {$nothing=1;} + else + {$out_ring++;} + } + + $out_total++; + $i++; + } + + if ($out_live > 0) {$F=''; $FG='';} + if ($out_live > 4) {$F=''; $FG='';} + if ($out_live > 9) {$F=''; $FG='';} + if ($out_live > 14) {$F=''; $FG='';} + + if ($campaign_allow_inbound > 0) + {echo "$NFB$out_total$NFE current active calls      \n";} + else + {echo "$NFB$out_total$NFE calls being placed       \n";} + + echo "$NFB$out_ring$NFE calls ringing         \n"; + echo "$NFB$F  $out_live $FG$NFE calls waiting for agents       \n"; + } + else + { + echo " NO LIVE CALLS WAITING \n"; + } + + + +################################################################################### +###### CALLS WAITING +################################################################################### + +$Cecho = ''; +$Cecho .= "VICIDIAL: Calls Waiting $NOW_TIME\n"; +$Cecho .= "+--------+--------------+--------------+-----------------+---------+------------+\n"; +$Cecho .= "| STATUS | CAMPAIGN | PHONE NUMBER | SERVER_IP | DIALTIME| CALL TYPE |\n"; +$Cecho .= "+--------+--------------+--------------+-----------------+---------+------------+\n"; + +$p=0; +while($p<$k) + { + $Cstatus = sprintf("%-6s", $CDstatus[$p]); + $Ccampaign_id = sprintf("%-12s", $CDcampaign_id[$p]); + $Cphone_number = sprintf("%-12s", $CDphone_number[$p]); + $Cserver_ip = sprintf("%-15s", $CDserver_ip[$p]); + $Ccall_type = sprintf("%-10s", $CDcall_type[$p]); + + $Ccall_time_S = ($STARTtime - $CDcall_time[$p]); + $Ccall_time_M = ($Ccall_time_S / 60); + $Ccall_time_M = round($Ccall_time_M, 2); + $Ccall_time_M_int = intval("$Ccall_time_M"); + $Ccall_time_SEC = ($Ccall_time_M - $Ccall_time_M_int); + $Ccall_time_SEC = ($Ccall_time_SEC * 60); + $Ccall_time_SEC = round($Ccall_time_SEC, 0); + if ($Ccall_time_SEC < 10) {$Ccall_time_SEC = "0$Ccall_time_SEC";} + $Ccall_time_MS = "$Ccall_time_M_int:$Ccall_time_SEC"; + $Ccall_time_MS = sprintf("%7s", $Ccall_time_MS); + + $G = ''; $EG = ''; + if ($CDcall_type[$p] == 'IN') + { + $G=""; $EG=''; + } + $Cecho .= "| $G$Cstatus$EG | $G$Ccampaign_id$EG | $G$Cphone_number$EG | $G$Cserver_ip$EG | $G$Ccall_time_MS$EG | $G$Ccall_type$EG |\n"; + + $p++; + } +$Cecho .= "+--------+--------------+--------------+-----------------+---------+------------+\n\n"; + +if ($p<1) + {$Cecho='';} + +################################################################################### +###### TIME ON SYSTEM +################################################################################### + +$agent_incall=0; +$agent_ready=0; +$agent_paused=0; +$agent_total=0; + +$Aecho = ''; +$Aecho .= "VICIDIAL: Agents Time On Calls Campaign: $group $NOW_TIME\n"; + + +$HDbegin = "+"; +$HTbegin = "|"; +$HDstation = "------------+"; +$HTstation = " STATION |"; +$HDuser = "--------------------+"; +$HTuser = " USER |"; +$HDusergroup = "--------------+"; +$HTusergroup = " USER GROUP |"; +$HDsessionid = "------------------+"; +$HTsessionid = " SESSIONID |"; +$HDbarge = "-------+"; +$HTbarge = " BARGE |"; +$HDstatus = "----------+"; +$HTstatus = " STATUS |"; +$HDserver_ip = "-----------------+"; +$HTserver_ip = " SERVER IP |"; +$HDcall_server_ip = "-----------------+"; +$HTcall_server_ip = " CALL SERVER IP |"; +$HDtime = "---------+"; +$HTtime = " MM:SS |"; +$HDcampaign = "------------+"; +$HTcampaign = " CAMPAIGN |"; + +if ($UGdisplay < 1) + { + $HDusergroup = ''; + $HTusergroup = ''; + } +if ( ($SIPmonitorLINK<1) && ($IAXmonitorLINK<1) ) + { + $HDsessionid = "-----------+"; + $HTsessionid = " SESSIONID |"; + } +if ( ($SIPmonitorLINK<2) && ($IAXmonitorLINK<2) ) + { + $HDbarge = ''; + $HTbarge = ''; + } +if ($SERVdisplay < 1) + { + $HDserver_ip = ''; + $HTserver_ip = ''; + $HDcall_server_ip = ''; + $HTcall_server_ip = ''; + } + + + +$Aline = "$HDbegin$HDstation$HDuser$HDusergroup$HDsessionid$HDbarge$HDstatus$HDserver_ip$HDcall_server_ip$HDtime$HDcampaign\n"; +$Bline = "$HTbegin$HTstation$HTuser$HTusergroup$HTsessionid$HTbarge$HTstatus$HTserver_ip$HTcall_server_ip$HTtime$HTcampaign\n"; +$Aecho .= "$Aline"; +$Aecho .= "$Bline"; +$Aecho .= "$Aline"; + +if ($orderby=='timeup') {$orderSQL='status,last_call_time';} +if ($orderby=='timedown') {$orderSQL='status desc,last_call_time desc';} +if ($orderby=='campaignup') {$orderSQL='campaign_id,status,last_call_time';} +if ($orderby=='campaigndown') {$orderSQL='campaign_id desc,status desc,last_call_time desc';} +if ($orderby=='groupup') {$orderSQL='user_group,status,last_call_time';} +if ($orderby=='groupdown') {$orderSQL='user_group desc,status desc,last_call_time desc';} +if ($UidORname > 0) + { + if ($orderby=='userup') {$orderSQL='full_name,status,last_call_time';} + if ($orderby=='userdown') {$orderSQL='full_name desc,status desc,last_call_time desc';} + } +else + { + if ($orderby=='userup') {$orderSQL='vicidial_live_agents.user';} + if ($orderby=='userdown') {$orderSQL='vicidial_live_agents.user desc';} + } + +if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';} +else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";} +if (strlen($usergroup)<1) {$usergroupSQL = '';} +else {$usergroupSQL = " and user_group='" . mysql_real_escape_string($usergroup) . "'";} + +$stmt="select extension,vicidial_live_agents.user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id,vicidial_users.user_group,vicidial_users.full_name,vicidial_live_agents.comments from vicidial_live_agents,vicidial_users where vicidial_live_agents.user=vicidial_users.user $groupSQL $usergroupSQL order by $orderSQL;"; + +#$stmt="select extension,vicidial_live_agents.user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id,vicidial_users.user_group,vicidial_users.full_name from vicidial_live_agents,vicidial_users where vicidial_live_agents.user=vicidial_users.user and campaign_id='" . mysql_real_escape_string($group) . "' order by $orderSQL;"; + +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + $agentcount=0; + while ($i < $talking_to_print) + { + $row=mysql_fetch_row($rslt); + if (eregi("READY|PAUSED",$row[3])) + { + $row[5]=$row[6]; + } + if ($non_latin < 1) + { + $extension = eregi_replace('Local/',"",$row[0]); + $extension = sprintf("%-10s", $extension); + while(strlen($extension)>10) {$extension = substr("$extension", 0, -1);} + } + else + { + $extension = eregi_replace('Local/',"",$row[0]); + $extension = sprintf("%-40s", $extension); + while(mb_strlen($extension, 'utf-8')>10) {$extension = mb_substr("$extension", 0, -1,'utf8');} + } + $Luser = $row[1]; + $user = sprintf("%-18s", $row[1]); + $Lsessionid = $row[2]; + $sessionid = sprintf("%-9s", $row[2]); + $Lstatus = $row[3]; + $status = sprintf("%-6s", $row[3]); + $server_ip = sprintf("%-15s", $row[4]); + $call_server_ip = sprintf("%-15s", $row[7]); + $campaign_id = sprintf("%-10s", $row[8]); + $comments= $row[11]; + + if (eregi("INCALL",$Lstatus)) + { + if ( (eregi("AUTO",$comments)) or (strlen($comments)<1) ) + {$CM='A';} + else + { + if (eregi("INBOUND",$comments)) + {$CM='I';} + else + {$CM='M';} + } + } + else {$CM=' ';} + + if ($UGdisplay > 0) + { + if ($non_latin < 1) + { + $user_group = sprintf("%-12s", $row[9]); + while(strlen($user_group)>12) {$user_group = substr("$user_group", 0, -1);} + } + else + { + $user_group = sprintf("%-40s", $row[9]); + while(mb_strlen($user_group, 'utf-8')>12) {$user_group = mb_substr("$user_group", 0, -1,'utf8');} + } + } + if ($UidORname > 0) + { + if ($non_latin < 1) + { + $user = sprintf("%-18s", $row[10]); + while(strlen($user)>18) {$user = substr("$user", 0, -1);} + } + else + { + $user = sprintf("%-40s", $row[10]); + while(mb_strlen($user, 'utf-8')>18) {$user = mb_substr("$user", 0, -1,'utf8');} + } + } + if (!eregi("INCALL|QUEUE",$row[3])) + {$call_time_S = ($STARTtime - $row[6]);} + else + {$call_time_S = ($STARTtime - $row[5]);} + + $call_time_M = ($call_time_S / 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"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + if ($Lstatus=='INCALL') + { + if ($call_time_S >= 10) {$G=''; $EG='';} + if ($call_time_M_int >= 1) {$G=''; $EG='';} + if ($call_time_M_int >= 5) {$G=''; $EG='';} + # if ($call_time_M_int >= 10) {$G=''; $EG='';} + } + if (eregi("PAUSED",$row[3])) + { + if ($call_time_M_int >= 30) + {$i++; continue;} + else + { + $agent_paused++; $agent_total++; + $G=''; $EG=''; + if ($call_time_S >= 10) {$G=''; $EG='';} + if ($call_time_M_int >= 1) {$G=''; $EG='';} + if ($call_time_M_int >= 5) {$G=''; $EG='';} + } + } +# if ( (strlen($row[7])> 4) and ($row[7] != "$row[4]") ) +# {$G=''; $EG='';} + + if ( (eregi("INCALL",$status)) or (eregi("QUEUE",$status)) ) {$agent_incall++; $agent_total++;} + if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) {$agent_ready++; $agent_total++;} + if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) + { + $G=''; $EG=''; + if ($call_time_M_int >= 1) {$G=''; $EG='';} + if ($call_time_M_int >= 5) {$G=''; $EG='';} + } + + $L=''; + $R=''; + if ($SIPmonitorLINK>0) {$L=" LISTEN"; $R='';} + if ($IAXmonitorLINK>0) {$L=" LISTEN"; $R='';} + if ($SIPmonitorLINK>1) {$R=" | BARGE";} + if ($IAXmonitorLINK>1) {$R=" | BARGE";} + + if ($UGdisplay > 0) {$UGD = " $G$user_group$EG |";} + else {$UGD = "";} + + if ($SERVdisplay > 0) {$SVD = "$G$server_ip$EG | $G$call_server_ip$EG | ";} + else {$SVD = "";} + + $agentcount++; + + $Aecho .= "| $G$extension$EG | $G$user$EG |$UGD $G$sessionid$EG$L$R | $G$status$EG $CM | $SVD$G$call_time_MS$EG | $G$campaign_id$EG |\n"; + + $i++; + } + + $Aecho .= "$Aline"; + $Aecho .= " $agentcount agents logged in on all servers\n"; + $Aecho .= " System Load Average: $load_ave\n\n"; + + # $Aecho .= " - Balanced call\n"; + $Aecho .= " - Agent waiting for call\n"; + $Aecho .= " - Agent waiting for call > 1 minute\n"; + $Aecho .= " - Agent waiting for call > 5 minutes\n"; + $Aecho .= " - Agent on call > 10 seconds\n"; + $Aecho .= " - Agent on call > 1 minute\n"; + $Aecho .= " - Agent on call > 5 minutes\n"; + $Aecho .= " - Agent Paused > 10 seconds\n"; + $Aecho .= " - Agent Paused > 1 minute\n"; + $Aecho .= " - Agent Paused > 5 minutes\n"; + + if ($agent_ready > 0) {$B=''; $BG='';} + if ($agent_ready > 4) {$B=''; $BG='';} + if ($agent_ready > 9) {$B=''; $BG='';} + if ($agent_ready > 14) {$B=''; $BG='';} + + + echo "\n
\n"; + + echo "$NFB$agent_total$NFE agents logged in         \n"; + echo "$NFB$agent_incall$NFE agents in calls       \n"; + echo "$NFB$B  $agent_ready $BG$NFE agents waiting       \n"; + echo "$NFB$agent_paused$NFE paused agents       \n"; + + echo "
";
+		echo "";
+		echo "$Cecho";
+		echo "$Aecho";
+	}
+	else
+	{
+	echo " NO AGENTS ON CALLS \n";
+	}
+
+?>
+
+ + diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_timeonVDADallREC.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_timeonVDADallREC.php new file mode 100644 index 00000000..2abf27b2 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_timeonVDADallREC.php @@ -0,0 +1,943 @@ + LICENSE: GPLv2 +# +# live real-time stats for the VICIDIAL Auto-Dialer all servers +# +# STOP=4000, SLOW=40, GO=4 seconds refresh interval +# +# CHANGELOG: +# 50406-0920 - Added Paused agents < 1 min (Chris Doyle) +# 51130-1218 - Modified layout and info to show all servers in a vicidial system +# 60421-1043 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60511-1343 - Added leads and drop info at the top of the screen +# 60608-1539 - Fixed CLOSER tallies for active calls +# 60619-1658 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 60626-1453 - Added display of system load to bottom (Angelito Manansala) +# 60901-1123 - Changed display elements at the top of the screen +# 60905-1342 - Fixed non INCALL|QUEUE timer column +# 61002-1642 - Added TRUNK SHORT/FILL stats +# 61101-1318 - Added SIP and IAX Listen and Barge links option +# 61101-1647 - Added Usergroup column and user name option as well as sorting +# 61102-1155 - Made display of columns more modular, added ability to hide server info +# 61215-1131 - Added answered calls and drop percent taken from answered calls +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70123-1151 - Added non_latin options for substr in display variables, thanks Marin Blu +# 70206-1140 - Added call-type statuses to display(A-Auto, M-Manual, I-Inbound/Closer) +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["RR"])) {$RR=$_GET["RR"];} + elseif (isset($_POST["RR"])) {$RR=$_POST["RR"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["usergroup"])) {$usergroup=$_GET["usergroup"];} + elseif (isset($_POST["usergroup"])) {$usergroup=$_POST["usergroup"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["adastats"])) {$adastats=$_GET["adastats"];} + elseif (isset($_POST["adastats"])) {$adastats=$_POST["adastats"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["SIPmonitorLINK"])) {$SIPmonitorLINK=$_GET["SIPmonitorLINK"];} + elseif (isset($_POST["SIPmonitorLINK"])) {$SIPmonitorLINK=$_POST["SIPmonitorLINK"];} +if (isset($_GET["IAXmonitorLINK"])) {$IAXmonitorLINK=$_GET["IAXmonitorLINK"];} + elseif (isset($_POST["IAXmonitorLINK"])) {$IAXmonitorLINK=$_POST["IAXmonitorLINK"];} +if (isset($_GET["UGdisplay"])) {$UGdisplay=$_GET["UGdisplay"];} + elseif (isset($_POST["UGdisplay"])) {$UGdisplay=$_POST["UGdisplay"];} +if (isset($_GET["UidORname"])) {$UidORname=$_GET["UidORname"];} + elseif (isset($_POST["UidORname"])) {$UidORname=$_POST["UidORname"];} +if (isset($_GET["orderby"])) {$orderby=$_GET["orderby"];} + elseif (isset($_POST["orderby"])) {$orderby=$_POST["orderby"];} +if (isset($_GET["SERVdisplay"])) {$SERVdisplay=$_GET["SERVdisplay"];} + elseif (isset($_POST["SERVdisplay"])) {$SERVdisplay=$_POST["SERVdisplay"];} + +if (isset($_GET["RECmonitorLINK"])) {$RECmonitorLINK=$_GET["RECmonitorLINK"];} + elseif (isset($_POST["RECmonitorLINK"])) {$RECmonitorLINK=$_POST["RECmonitorLINK"];} + +if (!isset($RR)) {$gRRroup=4;} +if (!isset($group)) {$group='';} +if (!isset($usergroup)) {$usergroup='';} +if (!isset($UGdisplay)) {$UGdisplay=0;} # 0=no, 1=yes +if (!isset($UidORname)) {$UidORname=0;} # 0=id, 1=name +if (!isset($orderby)) {$orderby='timeup';} +if (!isset($SERVdisplay)) {$SERVdisplay=1;} # 0=no, 1=yes + +function get_server_load($windows = false) { +$os = strtolower(PHP_OS); +if(strpos($os, "win") === false) { +if(file_exists("/proc/loadavg")) { +$load = file_get_contents("/proc/loadavg"); +$load = explode(' ', $load); +return $load[0]; +} +elseif(function_exists("shell_exec")) { +$load = explode(' ', `uptime`); +return $load[count($load)-1]; +} +else { +return false; +} +} +elseif($windows) { +if(class_exists("COM")) { +$wmi = new COM("WinMgmts:\\\\."); +$cpus = $wmi->InstancesOf("Win32_Processor"); + +$cpuload = 0; +$i = 0; +while ($cpu = $cpus->Next()) { +$cpuload += $cpu->LoadPercentage; +$i++; +} + +$cpuload = round($cpuload / $i, 2); +return "$cpuload%"; +} +else { +return false; +} +} +} + +$load_ave = get_server_load(true); + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + + $stmt="SELECT vicidial_recording from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $authrec=$row[0]; + if ($authrec=='1') {$RECmonitorLINK = 1;} else {$RECmonitorLINK = 0;} + + +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_TIME = date("Ymd-His"); +$NOW_DAY = date("Y-m-d"); +$NOW_HOUR = date("H:i:s"); +$STARTtime = date("U"); +$epochSIXhoursAGO = ($STARTtime - 21600); +$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO); + +$stmt="select campaign_id from vicidial_campaigns where active='Y';"; +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); +if (!isset($DB)) {$DB=0;} +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + +$stmt="select * from vicidial_user_groups;"; +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); +if (!isset($DB)) {$DB=0;} +if ($DB) {echo "$stmt\n";} +$usergroups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $usergroups_to_print) + { + $row=mysql_fetch_row($rslt); + $usergroups[$i] =$row[0]; + $i++; + } + +if (!isset($RR)) {$RR=4;} + +$NFB = ''; +$NFE = ''; +$F=''; $FG=''; $B=''; $BG=''; + +?> + + + + + + + + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On VDAD Campaign: $group\n"; +echo "
\n"; +echo "VICIDIAL Campaign: \n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +if ($UGdisplay > 0) + { + echo "\n"; + } +echo "         \n"; +echo "STOP | "; +echo "SLOW | "; +echo "GO"; +echo "       MODIFY | \n"; +echo "SUMMARY | \n"; +echo "REPORTS \n"; +echo "\n\n"; + + +if (!$group) {echo "

please select a campaign from the pulldown above
\n"; exit;} +else +{ +$stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; + +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select avg(auto_dial_level),min(dial_status_a),min(dial_status_b),min(dial_status_c),min(dial_status_d),min(dial_status_e),min(lead_order),min(lead_filter_id),sum(hopper_level),min(dial_method),avg(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),min(available_only_ratio_tally),min(adaptive_latest_server_time),min(local_call_time),avg(dial_timeout),min(dial_statuses) from vicidial_campaigns;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$DIALlev = $row[0]; +$DIALstatusA = $row[1]; +$DIALstatusB = $row[2]; +$DIALstatusC = $row[3]; +$DIALstatusD = $row[4]; +$DIALstatusE = $row[5]; +$DIALorder = $row[6]; +$DIALfilter = $row[7]; +$HOPlev = $row[8]; +$DIALmethod = $row[9]; +$maxDIALlev = $row[10]; +$DROPmax = $row[11]; +$targetDIFF = $row[12]; +$ADAintense = $row[13]; +$ADAavailonly = $row[14]; +$TAPERtime = $row[15]; +$CALLtime = $row[16]; +$DIALtimeout = $row[17]; +$DIALstatuses = $row[18]; + $DIALstatuses = (preg_replace("/ -$|^ /","",$DIALstatuses)); + $DIALstatuses = (ereg_replace(' ',', ',$DIALstatuses)); + +$stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select count(*) from vicidial_hopper;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$VDhop = $row[0]; + +$stmt="select dialable_leads,calls_today,drops_today,drops_answers_today_pct,differential_onemin,agents_average_onemin,balance_trunk_fill,answers_today from vicidial_campaign_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today) from vicidial_campaign_stats;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$DAleads = $row[0]; +$callsTODAY = $row[1]; +$dropsTODAY = $row[2]; +$drpctTODAY = $row[3]; +$diffONEMIN = $row[4]; +$agentsONEMIN = $row[5]; +$balanceFILL = $row[6]; +$answersTODAY = $row[7]; +if ( ($diffONEMIN != 0) and ($agentsONEMIN > 0) ) + { + $diffpctONEMIN = ( ($diffONEMIN / $agentsONEMIN) * 100); + $diffpctONEMIN = sprintf("%01.2f", $diffpctONEMIN); + } +else {$diffpctONEMIN = '0.00';} + +$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$balanceSHORT = $row[0]; + +echo "
"; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +if ($adastats>1) + { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo "
DIAL LEVEL:  $DIALlev    TRUNK SHORT/FILL:  $balanceSHORT / $balanceFILL     FILTER:  $DIALfilter   TIME:   $NOW_TIME
- min   MAX LEVEL:  $maxDIALlev   DROPPED MAX:  $DROPmax%    TARGET DIFF:  $targetDIFF     INTENSITY:  $ADAintense    
DIAL TIMEOUT:  $DIALtimeout  TAPER TIME:  $TAPERtime  LOCAL TIME:  $CALLtime  AVAIL ONLY:  $ADAavailonly  
DIALABLE LEADS:  $DAleads     CALLS TODAY:  $callsTODAY     AVG AGENTS:  $agentsONEMIN     DIAL METHOD:  $DIALmethod    
HOPPER LEVEL:  $HOPlev     DROPPED / ANSWERED:  $dropsTODAY / $answersTODAY   DL DIFF:  $diffONEMIN     STATUSES:  $DIALstatuses    
LEADS IN HOPPER:  $VDhop     DROPPED PERCENT:  $drpctTODAY%    DIFF:  $diffpctONEMIN%     ORDER:  $DIALorder    
"; + +if ($adastats<2) + { + echo "+ VIEW MORE SETTINGS"; + } +if ($UGdisplay>0) + { + echo "       HIDE USER GROUP"; + } +else + { + echo "       VIEW USER GROUP"; + } +if ($UidORname>0) + { + echo "       SHOW AGENT ID"; + } +else + { + echo "       SHOW AGENT NAME"; + } +if ($SERVdisplay>0) + { + echo "       HIDE SERVER INFO"; + } +else + { + echo "       SHOW SERVER INFO"; + } +echo "
"; + +echo "\n\n"; +} +################################################################################### +###### OUTBOUND CALLS +################################################################################### +if (eregi("(CLOSER|BLEND|INBND|_C$|_B$|_I$)",$group)) + { + $stmt="select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} + if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = preg_replace("/^ | -$/","",$row[0]); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaigns = "'$closer_campaigns'"; + + $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') and ( (call_type='IN' and campaign_id IN($closer_campaigns)) or (campaign_id='" . mysql_real_escape_string($group) . "' and call_type='OUT') );"; + } +else + { + if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';} + else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";} + + $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') $groupSQL;"; + } +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$parked_to_print = mysql_num_rows($rslt); + if ($parked_to_print > 0) + { + $i=0; + $out_total=0; + $out_ring=0; + $out_live=0; + while ($i < $parked_to_print) + { + $row=mysql_fetch_row($rslt); + + if (eregi("LIVE",$row[0])) + {$out_live++;} + else + { + if (eregi("CLOSER",$row[0])) + {$nothing=1;} + else + {$out_ring++;} + } + $out_total++; + $i++; + } + + if ($out_live > 0) {$F=''; $FG='';} + if ($out_live > 4) {$F=''; $FG='';} + if ($out_live > 9) {$F=''; $FG='';} + if ($out_live > 14) {$F=''; $FG='';} + + if (eregi("(CLOSER|BLEND|INBND|_C$|_B$|_I$)",$group)) + {echo "$NFB$out_total$NFE current active calls      \n";} + else + {echo "$NFB$out_total$NFE calls being placed       \n";} + + echo "$NFB$out_ring$NFE calls ringing         \n"; + echo "$NFB$F  $out_live $FG$NFE calls waiting for agents       \n"; + } + else + { + echo " NO LIVE CALLS WAITING \n"; + } + + +################################################################################### +###### TIME ON SYSTEM +################################################################################### + +$agent_incall=0; +$agent_ready=0; +$agent_paused=0; +$agent_total=0; + +$Aecho = ''; +$Aecho .= "VICIDIAL: Agents Time On Calls Campaign: $group $NOW_TIME\n\n"; + + +$HDbegin = "+"; +$HTbegin = "|"; +$HDstation = "------------+"; +$HTstation = " STATION |"; +$HDuser = "--------------------+"; +$HTuser = " USER |"; +$HDusergroup = "--------------+"; +$HTusergroup = " USER GROUP |"; +$HDsessionid = "------------------+"; +$HTsessionid = " SESSIONID |"; +$HDbarge = "-------+"; +$HTbarge = " BARGE |"; +$HDrec = "---------+"; +$HTrec = " MONITOR |"; +$HDstatus = "----------+"; +$HTstatus = " STATUS |"; +$HDserver_ip = "-----------------+"; +$HTserver_ip = " SERVER IP |"; +$HDcall_server_ip = "-----------------+"; +$HTcall_server_ip = " CALL SERVER IP |"; +$HDtime = "---------+"; +$HTtime = " MM:SS |"; +$HDcampaign = "------------+"; +$HTcampaign = " CAMPAIGN |"; + +if ($UGdisplay < 1) + { + $HDusergroup = ''; + $HTusergroup = ''; + } +if ( ($SIPmonitorLINK<1) && ($IAXmonitorLINK<1) ) + { + $HDsessionid = "-----------+"; + $HTsessionid = " SESSIONID |"; + } +if ( ($SIPmonitorLINK<2) && ($IAXmonitorLINK<2) ) + { + $HDbarge = ''; + $HTbarge = ''; + } +if ($SERVdisplay < 1) + { + $HDserver_ip = ''; + $HTserver_ip = ''; + $HDcall_server_ip = ''; + $HTcall_server_ip = ''; + } + +if ( ($RECmonitorLINK<1) ) +{ + $HDrec = ''; + $HTrec = ''; +} + +$Aline = "$HDbegin$HDstation$HDuser$HDusergroup$HDsessionid$HDbarge$HDstatus$HDrec$HDserver_ip$HDcall_server_ip$HDtime$HDcampaign\n"; +$Bline = "$HTbegin$HTstation$HTuser$HTusergroup$HTsessionid$HTbarge$HTstatus$HTrec$HTserver_ip$HTcall_server_ip$HTtime$HTcampaign\n"; + +$Aecho .= "$Aline"; +$Aecho .= "$Bline"; +$Aecho .= "$Aline"; + +if ($orderby=='timeup') {$orderSQL='status,last_call_time';} +if ($orderby=='timedown') {$orderSQL='status desc,last_call_time desc';} +if ($orderby=='campaignup') {$orderSQL='campaign_id,status,last_call_time';} +if ($orderby=='campaigndown') {$orderSQL='campaign_id desc,status desc,last_call_time desc';} +if ($orderby=='groupup') {$orderSQL='user_group,status,last_call_time';} +if ($orderby=='groupdown') {$orderSQL='user_group desc,status desc,last_call_time desc';} +if ($UidORname > 0) + { + if ($orderby=='userup') {$orderSQL='full_name,status,last_call_time';} + if ($orderby=='userdown') {$orderSQL='full_name desc,status desc,last_call_time desc';} + } +else + { + if ($orderby=='userup') {$orderSQL='vicidial_live_agents.user';} + if ($orderby=='userdown') {$orderSQL='vicidial_live_agents.user desc';} + } + +if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';} +else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";} +if (strlen($usergroup)<1) {$usergroupSQL = '';} +else {$usergroupSQL = " and user_group='" . mysql_real_escape_string($usergroup) . "'";} + +$stmt="select extension,vicidial_live_agents.user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id,vicidial_users.user_group,vicidial_users.full_name,vicidial_live_agents.comments,lead_id,vicidial_users.pass from vicidial_live_agents,vicidial_users where vicidial_live_agents.user=vicidial_users.user $groupSQL $usergroupSQL order by $orderSQL;"; + +#$stmt="select extension,vicidial_live_agents.user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id,vicidial_users.user_group,vicidial_users.full_name from vicidial_live_agents,vicidial_users where vicidial_live_agents.user=vicidial_users.user and campaign_id='" . mysql_real_escape_string($group) . "' order by $orderSQL;"; + +if ($non_latin > 0) +{ +$rslt=mysql_query("SET NAMES 'UTF8'"); +} +if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + $agentcount=0; + while ($i < $talking_to_print) + { + $row=mysql_fetch_row($rslt); + if (eregi("READY|PAUSED",$row[3])) + { + $row[5]=$row[6]; + } + if ($non_latin < 1) + { + $extension = eregi_replace('Local/',"",$row[0]); + $extension = eregi_replace('IAX2/',"",$row[0]); + $extension = sprintf("%-10s", $extension); + while(strlen($extension)>10) {$extension = substr("$extension", 0, -1);} + } + else + { + $extension = eregi_replace('Local/',"",$row[0]); + $extension = eregi_replace('IAX2/',"",$row[0]); + $extension = sprintf("%-40s", $extension); + while(mb_strlen($extension, 'utf-8')>10) {$extension = mb_substr("$extension", 0, -1,'utf8');} + } + + $Luser = $row[1]; + $user = sprintf("%-18s", $row[1]); + $Lsessionid = $row[2]; + $sessionid = sprintf("%-9s", $row[2]); + $Lstatus = $row[3]; + $status = sprintf("%-6s", $row[3]); + $Lserver_ip = $row[4]; + $server_ip = sprintf("%-15s", $row[4]); + $call_server_ip = sprintf("%-15s", $row[7]); + $campaign_id = sprintf("%-10s", $row[8]); + $comments= $row[11]; + + $lead_id = $row[12]; + $user_pass = $row[13]; + + + if (eregi("INCALL",$Lstatus)) + { + if ( (eregi("AUTO",$comments)) or (strlen($comments)<1) ) + {$CM='A';} + else + { + if (eregi("INBOUND",$comments)) + {$CM='I';} + else + {$CM='M';} + } + } + else {$CM=' ';} + + if ($UGdisplay > 0) + { + if ($non_latin < 1) + { + $user_group = sprintf("%-12s", $row[9]); + while(strlen($user_group)>12) {$user_group = substr("$user_group", 0, -1);} + } + else + { + $user_group = sprintf("%-40s", $row[9]); + while(mb_strlen($user_group, 'utf-8')>12) {$user_group = mb_substr("$user_group", 0, -1,'utf8');} + } + } + if ($UidORname > 0) + { + if ($non_latin < 1) + { + $user = sprintf("%-18s", $row[10]); + while(strlen($user)>18) {$user = substr("$user", 0, -1);} + } + else + { + $user = sprintf("%-40s", $row[10]); + while(mb_strlen($user, 'utf-8')>18) {$user = mb_substr("$user", 0, -1,'utf8');} + } + } + if (!eregi("INCALL|QUEUE",$row[3])) + {$call_time_S = ($STARTtime - $row[6]);} + else + {$call_time_S = ($STARTtime - $row[5]);} + + $call_time_M = ($call_time_S / 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"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + if ($Lstatus=='INCALL') + { + if ($call_time_S >= 10) {$G=''; $EG='';} + if ($call_time_M_int >= 1) {$G=''; $EG='';} + if ($call_time_M_int >= 5) {$G=''; $EG='';} + # if ($call_time_M_int >= 10) {$G=''; $EG='';} + } + if (eregi("PAUSED",$row[3])) + { + if ($call_time_M_int >= 30) + {$i++; continue;} + else + { + $agent_paused++; $agent_total++; + $G=''; $EG=''; + if ($call_time_S >= 10) {$G=''; $EG='';} + if ($call_time_M_int >= 1) {$G=''; $EG='';} + if ($call_time_M_int >= 5) {$G=''; $EG='';} + } + } +# if ( (strlen($row[7])> 4) and ($row[7] != "$row[4]") ) +# {$G=''; $EG='';} + + if ( (eregi("INCALL",$status)) or (eregi("QUEUE",$status)) ) {$agent_incall++; $agent_total++;} + if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) {$agent_ready++; $agent_total++;} + if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) + { + $G=''; $EG=''; + if ($call_time_M_int >= 1) {$G=''; $EG='';} + if ($call_time_M_int >= 5) {$G=''; $EG='';} + } + + $L=''; + $R=''; + $LL=''; + $EXTF='6'; + $servip= str_replace('.','',$Lserver_ip); + if ($SIPmonitorLINK>0) {$L=" LISTEN"; $R='';} + if ($IAXmonitorLINK>0) {$L=" LISTEN"; $R='';} + if ($SIPmonitorLINK>1) {$R=" | BARGE";} + if ($IAXmonitorLINK>1) {$R=" | BARGE";} + + + if ($RECmonitorLINK>0) + { + + $stmt="select session_name from web_client_sessions where server_ip ='$server_ip' and extension ='$extension' limit 1;"; + if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} + $rslta=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $sess = mysql_num_rows($rslta); + + if ($sess > 0) + { + $row=mysql_fetch_row($rslta); + $sessionname = $row[0]; + } else + { + $sessionname = ""; + } + + + $stmt="select end_time,channel,extension,lead_id,user,server_ip,filename from recording_log where server_ip ='$server_ip' and user ='$Luser';"; + if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} + $rslta=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $rec_channels = mysql_num_rows($rslta); + + if ($rec_channels > 0) + { + $ii=0; + while ($ii < $rec_channels) + { + $row=mysql_fetch_row($rslta); + $pos=strpos($row[1], $Lsessionid); + + if ($pos===false) + { + $LL=" Rec "; + } + else + { + if(is_null($row[0])) { + $LL=" Stop"; + } + else + { + $LL=" Rec "; + } + } + + $ii++; + } + } + else + { + $LL=" Rec "; + + } + } + + + if ($UGdisplay > 0) {$UGD = " $G$user_group$EG |";} + else {$UGD = "";} + + if ($SERVdisplay > 0) {$SVD = "$G$server_ip$EG | $G$call_server_ip$EG | ";} + else {$SVD = "";} + + $agentcount++; + + $Aecho .= "| $G$extension$EG | $G$user$EG |$UGD $G$sessionid$EG$L$R | $G$status$EG $CM | $LL | $SVD$G$call_time_MS$EG | $G$campaign_id$EG |\n"; + + $i++; + } + + $Aecho .= "$Aline"; + $Aecho .= " $agentcount agents logged in on all servers\n"; + $Aecho .= " System Load Average: $load_ave\n\n"; + + # $Aecho .= " - Balanced call\n"; + $Aecho .= " - Agent waiting for call\n"; + $Aecho .= " - Agent waiting for call > 1 minute\n"; + $Aecho .= " - Agent waiting for call > 5 minutes\n"; + $Aecho .= " - Agent on call > 10 seconds\n"; + $Aecho .= " - Agent on call > 1 minute\n"; + $Aecho .= " - Agent on call > 5 minutes\n"; + $Aecho .= " - Agent Paused > 10 seconds\n"; + $Aecho .= " - Agent Paused > 1 minute\n"; + $Aecho .= " - Agent Paused > 5 minutes\n"; + + if ($agent_ready > 0) {$B=''; $BG='';} + if ($agent_ready > 4) {$B=''; $BG='';} + if ($agent_ready > 9) {$B=''; $BG='';} + if ($agent_ready > 14) {$B=''; $BG='';} + + + echo "\n
\n"; + + echo "$NFB$agent_total$NFE agents logged in         \n"; + echo "$NFB$agent_incall$NFE agents in calls       \n"; + echo "$NFB$B  $agent_ready $BG$NFE agents waiting       \n"; + echo "$NFB$agent_paused$NFE paused agents       \n"; + + echo "
";
+		echo "";
+		echo "$Aecho";
+	}
+	else
+	{
+	echo " NO AGENTS ON CALLS \n";
+	}
+
+?>
+
+ + + diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_timeonVDADallSUMMARY.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_timeonVDADallSUMMARY.php new file mode 100644 index 00000000..242b27a0 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_timeonVDADallSUMMARY.php @@ -0,0 +1,442 @@ + LICENSE: GPLv2 +# +# Summary for all campaigns live real-time stats for the VICIDIAL Auto-Dialer all servers +# +# STOP=4000, SLOW=40, GO=4 seconds refresh interval +# +# changes: +# 61102-1616 - first build +# 61215-1131 - added answered calls and drop percent taken from answered calls +# 70111-1600 - added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70619-1339 - Added Status Category tally display +# 71029-1900 - Changed CLOSER-type to not require campaign_id restriction +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["RR"])) {$RR=$_GET["RR"];} + elseif (isset($_POST["RR"])) {$RR=$_POST["RR"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["adastats"])) {$adastats=$_GET["adastats"];} + elseif (isset($_POST["adastats"])) {$adastats=$_POST["adastats"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +if (!isset($RR)) {$gRRroup=4;} + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); + +$stmt="select campaign_id from vicidial_campaigns where active='Y';"; +$rslt=mysql_query($stmt, $link); +if (!isset($DB)) {$DB=0;} +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + +if (!isset($RR)) {$RR=4;} + +?> + + + + + +\n"; +echo "VICIDIAL: Realtime All Campaigns Summary\n"; +echo "VICIDIAL: Realtime All Campaigns Summary           \n"; +echo "STOP | "; +echo "SLOW | "; +echo "GO "; +echo "       \n"; +if ($adastats<2) + { + echo "+ VIEW MORE SETTINGS"; + } +else + { + echo "- VIEW LESS SETTINGS"; + } +echo "       REPORTS"; +echo "

\n\n"; + +$k=0; +while($k<$groups_to_print) +{ +$NFB = ''; +$NFE = ''; +$F=''; $FG=''; $B=''; $BG=''; + +$group = $groups[$k]; +echo "$group   -   "; +echo "Modify\n"; + + +$stmt = "select count(*) from vicidial_campaigns where campaign_id='$group' and campaign_allow_inbound='Y';"; +$rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $campaign_allow_inbound = $row[0]; + +$stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$DIALlev = $row[0]; +$DIALstatusA = $row[1]; +$DIALstatusB = $row[2]; +$DIALstatusC = $row[3]; +$DIALstatusD = $row[4]; +$DIALstatusE = $row[5]; +$DIALorder = $row[6]; +$DIALfilter = $row[7]; +$HOPlev = $row[8]; +$DIALmethod = $row[9]; +$maxDIALlev = $row[10]; +$DROPmax = $row[11]; +$targetDIFF = $row[12]; +$ADAintense = $row[13]; +$ADAavailonly = $row[14]; +$TAPERtime = $row[15]; +$CALLtime = $row[16]; +$DIALtimeout = $row[17]; +$DIALstatuses = $row[18]; + $DIALstatuses = (preg_replace("/ -$|^ /","",$DIALstatuses)); + $DIALstatuses = (ereg_replace(' ',', ',$DIALstatuses)); + +$stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$VDhop = $row[0]; + +$stmt="select dialable_leads,calls_today,drops_today,drops_answers_today_pct,differential_onemin,agents_average_onemin,balance_trunk_fill,answers_today,status_category_1,status_category_count_1,status_category_2,status_category_count_2,status_category_3,status_category_count_3,status_category_4,status_category_count_4 from vicidial_campaign_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$DAleads = $row[0]; +$callsTODAY = $row[1]; +$dropsTODAY = $row[2]; +$drpctTODAY = $row[3]; +$diffONEMIN = $row[4]; +$agentsONEMIN = $row[5]; +$balanceFILL = $row[6]; +$answersTODAY = $row[7]; +$VSCcat1 = $row[8]; +$VSCcat1tally = $row[9]; +$VSCcat2 = $row[10]; +$VSCcat2tally = $row[11]; +$VSCcat3 = $row[12]; +$VSCcat3tally = $row[13]; +$VSCcat4 = $row[14]; +$VSCcat4tally = $row[15]; + +if ( ($diffONEMIN != 0) and ($agentsONEMIN > 0) ) + { + $diffpctONEMIN = ( ($diffONEMIN / $agentsONEMIN) * 100); + $diffpctONEMIN = sprintf("%01.2f", $diffpctONEMIN); + } +else {$diffpctONEMIN = '0.00';} + +$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$balanceSHORT = $row[0]; + +echo "
"; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +if ($adastats>1) + { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo "
DIAL LEVEL:  $DIALlev    TRUNK SHORT/FILL:  $balanceSHORT / $balanceFILL     FILTER:  $DIALfilter   TIME:   $NOW_TIME
  MAX LEVEL:  $maxDIALlev   DROPPED MAX:  $DROPmax%    TARGET DIFF:  $targetDIFF     INTENSITY:  $ADAintense    
DIAL TIMEOUT:  $DIALtimeout  TAPER TIME:  $TAPERtime  LOCAL TIME:  $CALLtime  AVAIL ONLY:  $ADAavailonly  
DIALABLE LEADS:  $DAleads     CALLS TODAY:  $callsTODAY     AVG AGENTS:  $agentsONEMIN     DIAL METHOD:  $DIALmethod    
HOPPER LEVEL:  $HOPlev     DROPPED / ANSWERED:  $dropsTODAY / $answersTODAY   DL DIFF:  $diffONEMIN     STATUSES:  $DIALstatuses    
LEADS IN HOPPER:  $VDhop     DROPPED PERCENT:  "; +if ($drpctTODAY >= $DROPmax) + {echo "$drpctTODAY%";} +else + {echo "$drpctTODAY%";} +echo "    DIFF:  $diffpctONEMIN%     ORDER:  $DIALorder    
"; +if ( (!eregi('NULL',$VSCcat1)) and (strlen($VSCcat1)>0) ) + {echo "$VSCcat1:   $VSCcat1tally       \n";} +if ( (!eregi('NULL',$VSCcat2)) and (strlen($VSCcat2)>0) ) + {echo "$VSCcat2:   $VSCcat2tally       \n";} +if ( (!eregi('NULL',$VSCcat3)) and (strlen($VSCcat3)>0) ) + {echo "$VSCcat3:   $VSCcat3tally       \n";} +if ( (!eregi('NULL',$VSCcat4)) and (strlen($VSCcat4)>0) ) + {echo "$VSCcat4:   $VSCcat4tally       \n";} +echo "
"; + +### Header finish + + + + + +################################################################################ +### START calculating calls/agents +################################################################################ + +################################################################################ +###### OUTBOUND CALLS +################################################################################ +if ($campaign_allow_inbound > 0) + { + $stmt="select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = preg_replace("/^ | -$/","",$row[0]); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaigns = "'$closer_campaigns'"; + + $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') and ( (call_type='IN' and campaign_id IN($closer_campaigns)) or (campaign_id='" . mysql_real_escape_string($group) . "' and call_type='OUT') );"; + } +else + { + if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';} + else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";} + + $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') $groupSQL;"; + } +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$parked_to_print = mysql_num_rows($rslt); + if ($parked_to_print > 0) + { + $i=0; + $out_total=0; + $out_ring=0; + $out_live=0; + while ($i < $parked_to_print) + { + $row=mysql_fetch_row($rslt); + + if (eregi("LIVE",$row[0])) + {$out_live++;} + else + { + if (eregi("CLOSER",$row[0])) + {$nothing=1;} + else + {$out_ring++;} + } + $out_total++; + $i++; + } + + if ($out_live > 0) {$F=''; $FG='';} + if ($out_live > 4) {$F=''; $FG='';} + if ($out_live > 9) {$F=''; $FG='';} + if ($out_live > 14) {$F=''; $FG='';} + + if ($campaign_allow_inbound > 0) + {echo "$NFB$out_total$NFE current active calls      \n";} + else + {echo "$NFB$out_total$NFE calls being placed       \n";} + + echo "$NFB$out_ring$NFE calls ringing         \n"; + echo "$NFB$F  $out_live $FG$NFE calls waiting for agents       \n"; + } + else + { + echo " NO LIVE CALLS WAITING \n"; + } + + +################################################################################### +###### TIME ON SYSTEM +################################################################################### + +$agent_incall=0; +$agent_ready=0; +$agent_paused=0; +$agent_total=0; + +$stmt="select extension,user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id from vicidial_live_agents where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + $agentcount=0; + while ($i < $talking_to_print) + { + $row=mysql_fetch_row($rslt); + if (eregi("READY|PAUSED",$row[3])) + { + $row[5]=$row[6]; + } + $Lstatus = $row[3]; + $status = sprintf("%-6s", $row[3]); + if (!eregi("INCALL|QUEUE",$row[3])) + {$call_time_S = ($STARTtime - $row[6]);} + else + {$call_time_S = ($STARTtime - $row[5]);} + + $call_time_M = ($call_time_S / 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"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + if (eregi("PAUSED",$row[3])) + { + if ($call_time_M_int >= 30) + {$i++; continue;} + else + { + $agent_paused++; $agent_total++; + } + } + + if ( (eregi("INCALL",$status)) or (eregi("QUEUE",$status)) ) {$agent_incall++; $agent_total++;} + if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) {$agent_ready++; $agent_total++;} + $agentcount++; + + + $i++; + } + + if ($agent_ready > 0) {$B=''; $BG='';} + if ($agent_ready > 4) {$B=''; $BG='';} + if ($agent_ready > 9) {$B=''; $BG='';} + if ($agent_ready > 14) {$B=''; $BG='';} + + echo "\n
\n"; + + echo "$NFB$agent_total$NFE agents logged in         \n"; + echo "$NFB$agent_incall$NFE agents in calls       \n"; + echo "$NFB$B  $agent_ready $BG$NFE agents waiting       \n"; + echo "$NFB$agent_paused$NFE paused agents       \n"; + + echo "
";
+		echo "";
+	}
+	else
+	{
+	echo " NO AGENTS ON CALLS
\n"; + } + +################################################################################ +### END calculating calls/agents +################################################################################ + + + + + +echo "
"; + +echo "\n\n"; +$k++; +} + +?> +
+ + diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_timeonpark.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_timeonpark.php new file mode 100644 index 00000000..fd54a333 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/AST_timeonpark.php @@ -0,0 +1,219 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60620-1042 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["reset_counter"])) {$reset_counter=$_GET["reset_counter"];} + elseif (isset($_POST["reset_counter"])) {$reset_counter=$_POST["reset_counter"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +$timeONEhoursAGO = ($STARTtime - 3600); +$epochHALFhoursAGO = ($STARTtime - 1860); +$timeONEhoursAGO = date("Y-m-d H:i:s",$timeONEhoursAGO); +$timeHALFhoursAGO = date("Y-m-d H:i:s",$epochHALFhoursAGO); + +$reset_counter++; + +if ($reset_counter > 7) + { + $reset_counter=0; + + $stmt="update park_log set status='HUNGUP' where hangup_time is not null;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + + if ($DB) + { + $stmt="delete from park_log where status='TALKING' and grab_time < '$timeONEhoursAGO' and (hangup_time is null or hangup_time='');"; + $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + + $stmt="delete from park_log where status='PARKED' and parked_time < '$timeHALFhoursAGO' and (hangup_time is null or hangup_time='');"; + $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + + } + } + +?> + + + + + +\n"; +echo"\n"; +echo "VICIDIAL: Time On Park\n"; +echo "
\n\n";
+
+echo "VICIDIAL: Time On Park         $NOW_TIME    REPORTS\n\n";
+echo "+------------+-----------------+---------------------+---------+\n";
+echo "| CHANNEL    | GROUP           | START TIME          | MINUTES |\n";
+echo "+------------+-----------------+---------------------+---------+\n";
+
+#$link=mysql_connect("localhost", "cron", "1234");
+# $linkX=mysql_connect("localhost", "cron", "1234");
+#mysql_select_db("asterisk");
+
+$stmt="select extension,user,channel,channel_group,parked_time,UNIX_TIMESTAMP(parked_time) from park_log where status ='PARKED' and server_ip='" . mysql_real_escape_string($server_ip) . "' order by uniqueid;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$parked_to_print = mysql_num_rows($rslt);
+	if ($parked_to_print > 0)
+	{
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$channel =			sprintf("%-10s", $row[2]);
+		$number_dialed =	sprintf("%-15s", $row[3]);
+		$start_time =		sprintf("%-19s", $row[4]);
+		$call_time_S = ($STARTtime - $row[5]);
+
+		$call_time_M = ($call_time_S / 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";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if ($call_time_M_int >= 1) {$G=''; $EG='';}
+		if ($call_time_M_int >= 6) {$G=''; $EG='';}
+
+		echo "| $G$channel$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------+-----------------+---------------------+---------+\n";
+		echo "  $i callers waiting on server $server_ip\n\n";
+
+		echo "             - 1 minute or more on hold\n";
+		echo "             - Over 5 minutes on hold\n";
+
+		}
+	else
+	{
+	echo "****************************************************************\n";
+	echo "****************************************************************\n";
+	echo "******************** NO LIVE CALLS WAITING *********************\n";
+	echo "****************************************************************\n";
+	echo "****************************************************************\n";
+	}
+
+###################################################################################
+###### TIME ON INBOUND CALLS
+###################################################################################
+echo "\n\n";
+echo "----------------------------------------------------------------------------------------";
+echo "\n\n";
+echo "VICIDIAL: Agents Time On Inbound Calls                             $NOW_TIME\n\n";
+echo "+------------|--------+------------+-----------------+---------------------+---------+\n";
+echo "| STATION    | USER   | CHANNEL    | GROUP           | START TIME          | MINUTES |\n";
+echo "+------------|--------+------------+-----------------+---------------------+---------+\n";
+
+
+$stmt="select extension,user,channel,channel_group,grab_time,UNIX_TIMESTAMP(grab_time) from park_log where status ='TALKING' and server_ip='" . mysql_real_escape_string($server_ip) . "' order by uniqueid;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$talking_to_print = mysql_num_rows($rslt);
+	if ($talking_to_print > 0)
+	{
+	$i=0;
+	while ($i < $talking_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+
+		$extension =		sprintf("%-10s", $row[0]);
+		$user =				sprintf("%-6s", $row[1]);
+		$channel =			sprintf("%-10s", $row[2]);
+		$number_dialed =	sprintf("%-15s", $row[3]);
+		$start_time =		sprintf("%-19s", $row[4]);
+		$call_time_S = ($STARTtime - $row[5]);
+
+		$call_time_M = ($call_time_S / 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";
+		$call_time_MS =		sprintf("%7s", $call_time_MS);
+		$G = '';		$EG = '';
+		if ($call_time_M_int >= 12) {$G=''; $EG='';}
+		if ($call_time_M_int >= 31) {$G=''; $EG='';}
+
+		echo "| $G$extension$EG | $G$user$EG | $G$channel$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
+
+		$i++;
+		}
+
+		echo "+------------|--------+------------+-----------------+---------------------+---------+\n";
+		echo "  $i agents on calls on server $server_ip\n\n";
+
+		echo "             - 12 minutes or more on call\n";
+		echo "             - Over 30 minutes on call\n";
+
+	}
+	else
+	{
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	echo "********************************* NO AGENTS ON CALLS *********************************\n";
+	echo "**************************************************************************************\n";
+	echo "**************************************************************************************\n";
+	}
+
+
+?>
+
+ + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/admin.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/admin.php new file mode 100644 index 00000000..2b4b948b --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/admin.php @@ -0,0 +1,13575 @@ + LICENSE: GPLv2 +# + + +require("dbconnect.php"); + + +###################################################################################################### +###################################################################################################### +####### static variable settings for display options +###################################################################################################### +###################################################################################################### + +$page_width='770'; +$section_width='720'; +$header_font_size='3'; +$subheader_font_size='2'; +$subcamp_font_size='2'; +$header_selected_bold=''; +$header_nonselected_bold=''; +$users_color = '#FFFF99'; +$campaigns_color = '#FFCC99'; +$lists_color = '#FFCCCC'; +$ingroups_color = '#CC99FF'; +$remoteagent_color ='#CCFFCC'; +$usergroups_color = '#CCFFFF'; +$scripts_color = '#99FFCC'; +$filters_color = '#CCCCCC'; +$admin_color = '#FF99FF'; +$reports_color = '#99FF33'; +#$users_color = '#FFFF99'; +#$campaigns_color = '#FFFF99'; +#$lists_color = '#FFFF99'; +#$ingroups_color = '#FFFF99'; +#$remoteagent_color ='#FFFF99'; +#$usergroups_color = '#FFFF99'; +#$scripts_color = '#FFFF99'; +#$filters_color = '#FFFF99'; +#$admin_color = '#FFFF99'; +#$reports_color = '#FFFF99'; + $times_color = '#FF33FF'; + $phones_color = '#FF33FF'; + $conference_color = '#FF33FF'; + $server_color = '#FF33FF'; + $settings_color = '#FF33FF'; + $status_color = '#FF33FF'; +$users_font = 'BLACK'; +$campaigns_font = 'BLACK'; +$lists_font = 'BLACK'; +$ingroups_font = 'BLACK'; +$remoteagent_font = 'BLACK'; +$usergroups_font = 'BLACK'; +$scripts_font = 'BLACK'; +$filters_font = 'BLACK'; +$admin_font = 'BLACK'; +$reports_font = 'BLACK'; + $times_font = 'BLACK'; + $phones_font = 'BLACK'; + $conference_font = 'BLACK'; + $server_font = 'BLACK'; + $settings_font = 'BLACK'; + $status_font = 'BLACK'; +$subcamp_color = '#FF9933'; +$subcamp_font = 'BLACK'; + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; + +###################################################################################################### +###################################################################################################### +####### Form variable declaration +###################################################################################################### +###################################################################################################### + + +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["active"])) {$active=$_GET["active"];} + elseif (isset($_POST["active"])) {$active=$_POST["active"];} +if (isset($_GET["adaptive_dl_diff_target"])) {$adaptive_dl_diff_target=$_GET["adaptive_dl_diff_target"];} + elseif (isset($_POST["adaptive_dl_diff_target"])) {$adaptive_dl_diff_target=$_POST["adaptive_dl_diff_target"];} +if (isset($_GET["adaptive_dropped_percentage"])) {$adaptive_dropped_percentage=$_GET["adaptive_dropped_percentage"];} + elseif (isset($_POST["adaptive_dropped_percentage"])){$adaptive_dropped_percentage=$_POST["adaptive_dropped_percentage"];} +if (isset($_GET["adaptive_intensity"])) {$adaptive_intensity=$_GET["adaptive_intensity"];} + elseif (isset($_POST["adaptive_intensity"])) {$adaptive_intensity=$_POST["adaptive_intensity"];} +if (isset($_GET["adaptive_latest_server_time"])) {$adaptive_latest_server_time=$_GET["adaptive_latest_server_time"];} + elseif (isset($_POST["adaptive_latest_server_time"])){$adaptive_latest_server_time=$_POST["adaptive_latest_server_time"];} +if (isset($_GET["adaptive_maximum_level"])) {$adaptive_maximum_level=$_GET["adaptive_maximum_level"];} + elseif (isset($_POST["adaptive_maximum_level"])) {$adaptive_maximum_level=$_POST["adaptive_maximum_level"];} +if (isset($_GET["SUB"])) {$SUB=$_GET["SUB"];} + elseif (isset($_POST["SUB"])) {$SUB=$_POST["SUB"];} +if (isset($_GET["ADD"])) {$ADD=$_GET["ADD"];} + elseif (isset($_POST["ADD"])) {$ADD=$_POST["ADD"];} +if (isset($_GET["admin_hangup_enabled"])) {$admin_hangup_enabled=$_GET["admin_hangup_enabled"];} + elseif (isset($_POST["admin_hangup_enabled"])) {$admin_hangup_enabled=$_POST["admin_hangup_enabled"];} +if (isset($_GET["admin_hijack_enabled"])) {$admin_hijack_enabled=$_GET["admin_hijack_enabled"];} + elseif (isset($_POST["admin_hijack_enabled"])) {$admin_hijack_enabled=$_POST["admin_hijack_enabled"];} +if (isset($_GET["admin_monitor_enabled"])) {$admin_monitor_enabled=$_GET["admin_monitor_enabled"];} + elseif (isset($_POST["admin_monitor_enabled"])) {$admin_monitor_enabled=$_POST["admin_monitor_enabled"];} +if (isset($_GET["AFLogging_enabled"])) {$AFLogging_enabled=$_GET["AFLogging_enabled"];} + elseif (isset($_POST["AFLogging_enabled"])) {$AFLogging_enabled=$_POST["AFLogging_enabled"];} +if (isset($_GET["agent_choose_ingroups"])) {$agent_choose_ingroups=$_GET["agent_choose_ingroups"];} + elseif (isset($_POST["agent_choose_ingroups"])) {$agent_choose_ingroups=$_POST["agent_choose_ingroups"];} +if (isset($_GET["agentcall_manual"])) {$agentcall_manual=$_GET["agentcall_manual"];} + elseif (isset($_POST["agentcall_manual"])) {$agentcall_manual=$_POST["agentcall_manual"];} +if (isset($_GET["agentonly_callbacks"])) {$agentonly_callbacks=$_GET["agentonly_callbacks"];} + elseif (isset($_POST["agentonly_callbacks"])) {$agentonly_callbacks=$_POST["agentonly_callbacks"];} +if (isset($_GET["AGI_call_logging_enabled"])) {$AGI_call_logging_enabled=$_GET["AGI_call_logging_enabled"];} + elseif (isset($_POST["AGI_call_logging_enabled"])) {$AGI_call_logging_enabled=$_POST["AGI_call_logging_enabled"];} +if (isset($_GET["agi_output"])) {$agi_output=$_GET["agi_output"];} + elseif (isset($_POST["agi_output"])) {$agi_output=$_POST["agi_output"];} +if (isset($_GET["allcalls_delay"])) {$allcalls_delay=$_GET["allcalls_delay"];} + elseif (isset($_POST["allcalls_delay"])) {$allcalls_delay=$_POST["allcalls_delay"];} +if (isset($_GET["allow_closers"])) {$allow_closers=$_GET["allow_closers"];} + elseif (isset($_POST["allow_closers"])) {$allow_closers=$_POST["allow_closers"];} +if (isset($_GET["alt_number_dialing"])) {$alt_number_dialing=$_GET["alt_number_dialing"];} + elseif (isset($_POST["alt_number_dialing"])) {$alt_number_dialing=$_POST["alt_number_dialing"];} +if (isset($_GET["alter_agent_interface_options"])) {$alter_agent_interface_options=$_GET["alter_agent_interface_options"];} + elseif (isset($_POST["alter_agent_interface_options"])) {$alter_agent_interface_options=$_POST["alter_agent_interface_options"];} +if (isset($_GET["am_message_exten"])) {$am_message_exten=$_GET["am_message_exten"];} + elseif (isset($_POST["am_message_exten"])) {$am_message_exten=$_POST["am_message_exten"];} +if (isset($_GET["amd_send_to_vmx"])) {$amd_send_to_vmx=$_GET["amd_send_to_vmx"];} + elseif (isset($_POST["amd_send_to_vmx"])) {$amd_send_to_vmx=$_POST["amd_send_to_vmx"];} +if (isset($_GET["answer_transfer_agent"])) {$answer_transfer_agent=$_GET["answer_transfer_agent"];} + elseif (isset($_POST["answer_transfer_agent"])) {$answer_transfer_agent=$_POST["answer_transfer_agent"];} +if (isset($_GET["ast_admin_access"])) {$ast_admin_access=$_GET["ast_admin_access"];} + elseif (isset($_POST["ast_admin_access"])) {$ast_admin_access=$_POST["ast_admin_access"];} +if (isset($_GET["ast_delete_phones"])) {$ast_delete_phones=$_GET["ast_delete_phones"];} + elseif (isset($_POST["ast_delete_phones"])) {$ast_delete_phones=$_POST["ast_delete_phones"];} +if (isset($_GET["asterisk_version"])) {$asterisk_version=$_GET["asterisk_version"];} + elseif (isset($_POST["asterisk_version"])) {$asterisk_version=$_POST["asterisk_version"];} +if (isset($_GET["ASTmgrSECRET"])) {$ASTmgrSECRET=$_GET["ASTmgrSECRET"];} + elseif (isset($_POST["ASTmgrSECRET"])) {$ASTmgrSECRET=$_POST["ASTmgrSECRET"];} +if (isset($_GET["ASTmgrUSERNAME"])) {$ASTmgrUSERNAME=$_GET["ASTmgrUSERNAME"];} + elseif (isset($_POST["ASTmgrUSERNAME"])) {$ASTmgrUSERNAME=$_POST["ASTmgrUSERNAME"];} +if (isset($_GET["ASTmgrUSERNAMElisten"])) {$ASTmgrUSERNAMElisten=$_GET["ASTmgrUSERNAMElisten"];} + elseif (isset($_POST["ASTmgrUSERNAMElisten"])) {$ASTmgrUSERNAMElisten=$_POST["ASTmgrUSERNAMElisten"];} +if (isset($_GET["ASTmgrUSERNAMEsend"])) {$ASTmgrUSERNAMEsend=$_GET["ASTmgrUSERNAMEsend"];} + elseif (isset($_POST["ASTmgrUSERNAMEsend"])) {$ASTmgrUSERNAMEsend=$_POST["ASTmgrUSERNAMEsend"];} +if (isset($_GET["ASTmgrUSERNAMEupdate"])) {$ASTmgrUSERNAMEupdate=$_GET["ASTmgrUSERNAMEupdate"];} + elseif (isset($_POST["ASTmgrUSERNAMEupdate"])) {$ASTmgrUSERNAMEupdate=$_POST["ASTmgrUSERNAMEupdate"];} +if (isset($_GET["attempt_delay"])) {$attempt_delay=$_GET["attempt_delay"];} + elseif (isset($_POST["attempt_delay"])) {$attempt_delay=$_POST["attempt_delay"];} +if (isset($_GET["attempt_maximum"])) {$attempt_maximum=$_GET["attempt_maximum"];} + elseif (isset($_POST["attempt_maximum"])) {$attempt_maximum=$_POST["attempt_maximum"];} +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["auto_dial_next_number"])) {$auto_dial_next_number=$_GET["auto_dial_next_number"];} + elseif (isset($_POST["auto_dial_next_number"])) {$auto_dial_next_number=$_POST["auto_dial_next_number"];} +if (isset($_GET["available_only_ratio_tally"])) {$available_only_ratio_tally=$_GET["available_only_ratio_tally"];} + elseif (isset($_POST["available_only_ratio_tally"])){$available_only_ratio_tally=$_POST["available_only_ratio_tally"];} +if (isset($_GET["call_out_number_group"])) {$call_out_number_group=$_GET["call_out_number_group"];} + elseif (isset($_POST["call_out_number_group"])) {$call_out_number_group=$_POST["call_out_number_group"];} +if (isset($_GET["call_parking_enabled"])) {$call_parking_enabled=$_GET["call_parking_enabled"];} + elseif (isset($_POST["call_parking_enabled"])) {$call_parking_enabled=$_POST["call_parking_enabled"];} +if (isset($_GET["call_time_comments"])) {$call_time_comments=$_GET["call_time_comments"];} + elseif (isset($_POST["call_time_comments"])) {$call_time_comments=$_POST["call_time_comments"];} +if (isset($_GET["call_time_id"])) {$call_time_id=$_GET["call_time_id"];} + elseif (isset($_POST["call_time_id"])) {$call_time_id=$_POST["call_time_id"];} +if (isset($_GET["call_time_name"])) {$call_time_name=$_GET["call_time_name"];} + elseif (isset($_POST["call_time_name"])) {$call_time_name=$_POST["call_time_name"];} +if (isset($_GET["CallerID_popup_enabled"])) {$CallerID_popup_enabled=$_GET["CallerID_popup_enabled"];} + elseif (isset($_POST["CallerID_popup_enabled"])) {$CallerID_popup_enabled=$_POST["CallerID_popup_enabled"];} +if (isset($_GET["campaign_cid"])) {$campaign_cid=$_GET["campaign_cid"];} + elseif (isset($_POST["campaign_cid"])) {$campaign_cid=$_POST["campaign_cid"];} +if (isset($_GET["campaign_detail"])) {$campaign_detail=$_GET["campaign_detail"];} + elseif (isset($_POST["campaign_detail"])) {$campaign_detail=$_POST["campaign_detail"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["campaign_name"])) {$campaign_name=$_GET["campaign_name"];} + elseif (isset($_POST["campaign_name"])) {$campaign_name=$_POST["campaign_name"];} +if (isset($_GET["campaign_rec_exten"])) {$campaign_rec_exten=$_GET["campaign_rec_exten"];} + elseif (isset($_POST["campaign_rec_exten"])) {$campaign_rec_exten=$_POST["campaign_rec_exten"];} +if (isset($_GET["campaign_rec_filename"])) {$campaign_rec_filename=$_GET["campaign_rec_filename"];} + elseif (isset($_POST["campaign_rec_filename"])) {$campaign_rec_filename=$_POST["campaign_rec_filename"];} +if (isset($_GET["campaign_recording"])) {$campaign_recording=$_GET["campaign_recording"];} + elseif (isset($_POST["campaign_recording"])) {$campaign_recording=$_POST["campaign_recording"];} +if (isset($_GET["campaign_vdad_exten"])) {$campaign_vdad_exten=$_GET["campaign_vdad_exten"];} + elseif (isset($_POST["campaign_vdad_exten"])) {$campaign_vdad_exten=$_POST["campaign_vdad_exten"];} +if (isset($_GET["change_agent_campaign"])) {$change_agent_campaign=$_GET["change_agent_campaign"];} + elseif (isset($_POST["change_agent_campaign"])) {$change_agent_campaign=$_POST["change_agent_campaign"];} +if (isset($_GET["client_browser"])) {$client_browser=$_GET["client_browser"];} + elseif (isset($_POST["client_browser"])) {$client_browser=$_POST["client_browser"];} +if (isset($_GET["closer_default_blended"])) {$closer_default_blended=$_GET["closer_default_blended"];} + elseif (isset($_POST["closer_default_blended"])) {$closer_default_blended=$_POST["closer_default_blended"];} +if (isset($_GET["company"])) {$company=$_GET["company"];} + elseif (isset($_POST["company"])) {$company=$_POST["company"];} +if (isset($_GET["computer_ip"])) {$computer_ip=$_GET["computer_ip"];} + elseif (isset($_POST["computer_ip"])) {$computer_ip=$_POST["computer_ip"];} +if (isset($_GET["conf_exten"])) {$conf_exten=$_GET["conf_exten"];} + elseif (isset($_POST["conf_exten"])) {$conf_exten=$_POST["conf_exten"];} +if (isset($_GET["conf_on_extension"])) {$conf_on_extension=$_GET["conf_on_extension"];} + elseif (isset($_POST["conf_on_extension"])) {$conf_on_extension=$_POST["conf_on_extension"];} +if (isset($_GET["conferencing_enabled"])) {$conferencing_enabled=$_GET["conferencing_enabled"];} + elseif (isset($_POST["conferencing_enabled"])) {$conferencing_enabled=$_POST["conferencing_enabled"];} +if (isset($_GET["CoNfIrM"])) {$CoNfIrM=$_GET["CoNfIrM"];} + elseif (isset($_POST["CoNfIrM"])) {$CoNfIrM=$_POST["CoNfIrM"];} +if (isset($_GET["ct_default_start"])) {$ct_default_start=$_GET["ct_default_start"];} + elseif (isset($_POST["ct_default_start"])) {$ct_default_start=$_POST["ct_default_start"];} +if (isset($_GET["ct_default_stop"])) {$ct_default_stop=$_GET["ct_default_stop"];} + elseif (isset($_POST["ct_default_stop"])) {$ct_default_stop=$_POST["ct_default_stop"];} +if (isset($_GET["ct_friday_start"])) {$ct_friday_start=$_GET["ct_friday_start"];} + elseif (isset($_POST["ct_friday_start"])) {$ct_friday_start=$_POST["ct_friday_start"];} +if (isset($_GET["ct_friday_stop"])) {$ct_friday_stop=$_GET["ct_friday_stop"];} + elseif (isset($_POST["ct_friday_stop"])) {$ct_friday_stop=$_POST["ct_friday_stop"];} +if (isset($_GET["ct_monday_start"])) {$ct_monday_start=$_GET["ct_monday_start"];} + elseif (isset($_POST["ct_monday_start"])) {$ct_monday_start=$_POST["ct_monday_start"];} +if (isset($_GET["ct_monday_stop"])) {$ct_monday_stop=$_GET["ct_monday_stop"];} + elseif (isset($_POST["ct_monday_stop"])) {$ct_monday_stop=$_POST["ct_monday_stop"];} +if (isset($_GET["ct_saturday_start"])) {$ct_saturday_start=$_GET["ct_saturday_start"];} + elseif (isset($_POST["ct_saturday_start"])) {$ct_saturday_start=$_POST["ct_saturday_start"];} +if (isset($_GET["ct_saturday_stop"])) {$ct_saturday_stop=$_GET["ct_saturday_stop"];} + elseif (isset($_POST["ct_saturday_stop"])) {$ct_saturday_stop=$_POST["ct_saturday_stop"];} +if (isset($_GET["ct_sunday_start"])) {$ct_sunday_start=$_GET["ct_sunday_start"];} + elseif (isset($_POST["ct_sunday_start"])) {$ct_sunday_start=$_POST["ct_sunday_start"];} +if (isset($_GET["ct_sunday_stop"])) {$ct_sunday_stop=$_GET["ct_sunday_stop"];} + elseif (isset($_POST["ct_sunday_stop"])) {$ct_sunday_stop=$_POST["ct_sunday_stop"];} +if (isset($_GET["ct_thursday_start"])) {$ct_thursday_start=$_GET["ct_thursday_start"];} + elseif (isset($_POST["ct_thursday_start"])) {$ct_thursday_start=$_POST["ct_thursday_start"];} +if (isset($_GET["ct_thursday_stop"])) {$ct_thursday_stop=$_GET["ct_thursday_stop"];} + elseif (isset($_POST["ct_thursday_stop"])) {$ct_thursday_stop=$_POST["ct_thursday_stop"];} +if (isset($_GET["ct_tuesday_start"])) {$ct_tuesday_start=$_GET["ct_tuesday_start"];} + elseif (isset($_POST["ct_tuesday_start"])) {$ct_tuesday_start=$_POST["ct_tuesday_start"];} +if (isset($_GET["ct_tuesday_stop"])) {$ct_tuesday_stop=$_GET["ct_tuesday_stop"];} + elseif (isset($_POST["ct_tuesday_stop"])) {$ct_tuesday_stop=$_POST["ct_tuesday_stop"];} +if (isset($_GET["ct_wednesday_start"])) {$ct_wednesday_start=$_GET["ct_wednesday_start"];} + elseif (isset($_POST["ct_wednesday_start"])) {$ct_wednesday_start=$_POST["ct_wednesday_start"];} +if (isset($_GET["ct_wednesday_stop"])) {$ct_wednesday_stop=$_GET["ct_wednesday_stop"];} + elseif (isset($_POST["ct_wednesday_stop"])) {$ct_wednesday_stop=$_POST["ct_wednesday_stop"];} +if (isset($_GET["DBX_database"])) {$DBX_database=$_GET["DBX_database"];} + elseif (isset($_POST["DBX_database"])) {$DBX_database=$_POST["DBX_database"];} +if (isset($_GET["DBX_pass"])) {$DBX_pass=$_GET["DBX_pass"];} + elseif (isset($_POST["DBX_pass"])) {$DBX_pass=$_POST["DBX_pass"];} +if (isset($_GET["DBX_port"])) {$DBX_port=$_GET["DBX_port"];} + elseif (isset($_POST["DBX_port"])) {$DBX_port=$_POST["DBX_port"];} +if (isset($_GET["DBX_server"])) {$DBX_server=$_GET["DBX_server"];} + elseif (isset($_POST["DBX_server"])) {$DBX_server=$_POST["DBX_server"];} +if (isset($_GET["DBX_user"])) {$DBX_user=$_GET["DBX_user"];} + elseif (isset($_POST["DBX_user"])) {$DBX_user=$_POST["DBX_user"];} +if (isset($_GET["DBY_database"])) {$DBY_database=$_GET["DBY_database"];} + elseif (isset($_POST["DBY_database"])) {$DBY_database=$_POST["DBY_database"];} +if (isset($_GET["DBY_pass"])) {$DBY_pass=$_GET["DBY_pass"];} + elseif (isset($_POST["DBY_pass"])) {$DBY_pass=$_POST["DBY_pass"];} +if (isset($_GET["DBY_port"])) {$DBY_port=$_GET["DBY_port"];} + elseif (isset($_POST["DBY_port"])) {$DBY_port=$_POST["DBY_port"];} +if (isset($_GET["DBY_server"])) {$DBY_server=$_GET["DBY_server"];} + elseif (isset($_POST["DBY_server"])) {$DBY_server=$_POST["DBY_server"];} +if (isset($_GET["DBY_user"])) {$DBY_user=$_GET["DBY_user"];} + elseif (isset($_POST["DBY_user"])) {$DBY_user=$_POST["DBY_user"];} +if (isset($_GET["delete_call_times"])) {$delete_call_times=$_GET["delete_call_times"];} + elseif (isset($_POST["delete_call_times"])) {$delete_call_times=$_POST["delete_call_times"];} +if (isset($_GET["delete_campaigns"])) {$delete_campaigns=$_GET["delete_campaigns"];} + elseif (isset($_POST["delete_campaigns"])) {$delete_campaigns=$_POST["delete_campaigns"];} +if (isset($_GET["delete_filters"])) {$delete_filters=$_GET["delete_filters"];} + elseif (isset($_POST["delete_filters"])) {$delete_filters=$_POST["delete_filters"];} +if (isset($_GET["delete_ingroups"])) {$delete_ingroups=$_GET["delete_ingroups"];} + elseif (isset($_POST["delete_ingroups"])) {$delete_ingroups=$_POST["delete_ingroups"];} +if (isset($_GET["delete_lists"])) {$delete_lists=$_GET["delete_lists"];} + elseif (isset($_POST["delete_lists"])) {$delete_lists=$_POST["delete_lists"];} +if (isset($_GET["delete_remote_agents"])) {$delete_remote_agents=$_GET["delete_remote_agents"];} + elseif (isset($_POST["delete_remote_agents"])) {$delete_remote_agents=$_POST["delete_remote_agents"];} +if (isset($_GET["delete_scripts"])) {$delete_scripts=$_GET["delete_scripts"];} + elseif (isset($_POST["delete_scripts"])) {$delete_scripts=$_POST["delete_scripts"];} +if (isset($_GET["delete_user_groups"])) {$delete_user_groups=$_GET["delete_user_groups"];} + elseif (isset($_POST["delete_user_groups"])) {$delete_user_groups=$_POST["delete_user_groups"];} +if (isset($_GET["delete_users"])) {$delete_users=$_GET["delete_users"];} + elseif (isset($_POST["delete_users"])) {$delete_users=$_POST["delete_users"];} +if (isset($_GET["dial_method"])) {$dial_method=$_GET["dial_method"];} + elseif (isset($_POST["dial_method"])) {$dial_method=$_POST["dial_method"];} +if (isset($_GET["dial_prefix"])) {$dial_prefix=$_GET["dial_prefix"];} + elseif (isset($_POST["dial_prefix"])) {$dial_prefix=$_POST["dial_prefix"];} +if (isset($_GET["dial_status_a"])) {$dial_status_a=$_GET["dial_status_a"];} + elseif (isset($_POST["dial_status_a"])) {$dial_status_a=$_POST["dial_status_a"];} +if (isset($_GET["dial_status_b"])) {$dial_status_b=$_GET["dial_status_b"];} + elseif (isset($_POST["dial_status_b"])) {$dial_status_b=$_POST["dial_status_b"];} +if (isset($_GET["dial_status_c"])) {$dial_status_c=$_GET["dial_status_c"];} + elseif (isset($_POST["dial_status_c"])) {$dial_status_c=$_POST["dial_status_c"];} +if (isset($_GET["dial_status_d"])) {$dial_status_d=$_GET["dial_status_d"];} + elseif (isset($_POST["dial_status_d"])) {$dial_status_d=$_POST["dial_status_d"];} +if (isset($_GET["dial_status_e"])) {$dial_status_e=$_GET["dial_status_e"];} + elseif (isset($_POST["dial_status_e"])) {$dial_status_e=$_POST["dial_status_e"];} +if (isset($_GET["dial_timeout"])) {$dial_timeout=$_GET["dial_timeout"];} + elseif (isset($_POST["dial_timeout"])) {$dial_timeout=$_POST["dial_timeout"];} +if (isset($_GET["dialplan_number"])) {$dialplan_number=$_GET["dialplan_number"];} + elseif (isset($_POST["dialplan_number"])) {$dialplan_number=$_POST["dialplan_number"];} +if (isset($_GET["drop_call_seconds"])) {$drop_call_seconds=$_GET["drop_call_seconds"];} + elseif (isset($_POST["drop_call_seconds"])) {$drop_call_seconds=$_POST["drop_call_seconds"];} +if (isset($_GET["drop_exten"])) {$drop_exten=$_GET["drop_exten"];} + elseif (isset($_POST["drop_exten"])) {$drop_exten=$_POST["drop_exten"];} +if (isset($_GET["drop_message"])) {$drop_message=$_GET["drop_message"];} + elseif (isset($_POST["drop_message"])) {$drop_message=$_POST["drop_message"];} +if (isset($_GET["dtmf_send_extension"])) {$dtmf_send_extension=$_GET["dtmf_send_extension"];} + elseif (isset($_POST["dtmf_send_extension"])) {$dtmf_send_extension=$_POST["dtmf_send_extension"];} +if (isset($_GET["enable_fast_refresh"])) {$enable_fast_refresh=$_GET["enable_fast_refresh"];} + elseif (isset($_POST["enable_fast_refresh"])) {$enable_fast_refresh=$_POST["enable_fast_refresh"];} +if (isset($_GET["enable_persistant_mysql"])) {$enable_persistant_mysql=$_GET["enable_persistant_mysql"];} + elseif (isset($_POST["enable_persistant_mysql"])) {$enable_persistant_mysql=$_POST["enable_persistant_mysql"];} +if (isset($_GET["ext_context"])) {$ext_context=$_GET["ext_context"];} + elseif (isset($_POST["ext_context"])) {$ext_context=$_POST["ext_context"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["fast_refresh_rate"])) {$fast_refresh_rate=$_GET["fast_refresh_rate"];} + elseif (isset($_POST["fast_refresh_rate"])) {$fast_refresh_rate=$_POST["fast_refresh_rate"];} +if (isset($_GET["force_logout"])) {$force_logout=$_GET["force_logout"];} + elseif (isset($_POST["force_logout"])) {$force_logout=$_POST["force_logout"];} +if (isset($_GET["fronter_display"])) {$fronter_display=$_GET["fronter_display"];} + elseif (isset($_POST["fronter_display"])) {$fronter_display=$_POST["fronter_display"];} +if (isset($_GET["full_name"])) {$full_name=$_GET["full_name"];} + elseif (isset($_POST["full_name"])) {$full_name=$_POST["full_name"];} +if (isset($_GET["fullname"])) {$fullname=$_GET["fullname"];} + elseif (isset($_POST["fullname"])) {$fullname=$_POST["fullname"];} +if (isset($_GET["get_call_launch"])) {$get_call_launch=$_GET["get_call_launch"];} + elseif (isset($_POST["get_call_launch"])) {$get_call_launch=$_POST["get_call_launch"];} +if (isset($_GET["group_color"])) {$group_color=$_GET["group_color"];} + elseif (isset($_POST["group_color"])) {$group_color=$_POST["group_color"];} +if (isset($_GET["group_id"])) {$group_id=$_GET["group_id"];} + elseif (isset($_POST["group_id"])) {$group_id=$_POST["group_id"];} +if (isset($_GET["group_name"])) {$group_name=$_GET["group_name"];} + elseif (isset($_POST["group_name"])) {$group_name=$_POST["group_name"];} +if (isset($_GET["groups"])) {$groups=$_GET["groups"];} + elseif (isset($_POST["groups"])) {$groups=$_POST["groups"];} +if (isset($_GET["XFERgroups"])) {$XFERgroups=$_GET["XFERgroups"];} + elseif (isset($_POST["XFERgroups"])) {$XFERgroups=$_POST["XFERgroups"];} +if (isset($_GET["HKstatus"])) {$HKstatus=$_GET["HKstatus"];} + elseif (isset($_POST["HKstatus"])) {$HKstatus=$_POST["HKstatus"];} +if (isset($_GET["hopper_level"])) {$hopper_level=$_GET["hopper_level"];} + elseif (isset($_POST["hopper_level"])) {$hopper_level=$_POST["hopper_level"];} +if (isset($_GET["hotkey"])) {$hotkey=$_GET["hotkey"];} + elseif (isset($_POST["hotkey"])) {$hotkey=$_POST["hotkey"];} +if (isset($_GET["hotkeys_active"])) {$hotkeys_active=$_GET["hotkeys_active"];} + elseif (isset($_POST["hotkeys_active"])) {$hotkeys_active=$_POST["hotkeys_active"];} +if (isset($_GET["install_directory"])) {$install_directory=$_GET["install_directory"];} + elseif (isset($_POST["install_directory"])) {$install_directory=$_POST["install_directory"];} +if (isset($_GET["lead_filter_comments"])) {$lead_filter_comments=$_GET["lead_filter_comments"];} + elseif (isset($_POST["lead_filter_comments"])) {$lead_filter_comments=$_POST["lead_filter_comments"];} +if (isset($_GET["lead_filter_id"])) {$lead_filter_id=$_GET["lead_filter_id"];} + elseif (isset($_POST["lead_filter_id"])) {$lead_filter_id=$_POST["lead_filter_id"];} +if (isset($_GET["lead_filter_name"])) {$lead_filter_name=$_GET["lead_filter_name"];} + elseif (isset($_POST["lead_filter_name"])) {$lead_filter_name=$_POST["lead_filter_name"];} +if (isset($_GET["lead_filter_sql"])) {$lead_filter_sql=$_GET["lead_filter_sql"];} + elseif (isset($_POST["lead_filter_sql"])) {$lead_filter_sql=$_POST["lead_filter_sql"];} +if (isset($_GET["lead_order"])) {$lead_order=$_GET["lead_order"];} + elseif (isset($_POST["lead_order"])) {$lead_order=$_POST["lead_order"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["list_name"])) {$list_name=$_GET["list_name"];} + elseif (isset($_POST["list_name"])) {$list_name=$_POST["list_name"];} +if (isset($_GET["load_leads"])) {$load_leads=$_GET["load_leads"];} + elseif (isset($_POST["load_leads"])) {$load_leads=$_POST["load_leads"];} +if (isset($_GET["local_call_time"])) {$local_call_time=$_GET["local_call_time"];} + elseif (isset($_POST["local_call_time"])) {$local_call_time=$_POST["local_call_time"];} +if (isset($_GET["local_gmt"])) {$local_gmt=$_GET["local_gmt"];} + elseif (isset($_POST["local_gmt"])) {$local_gmt=$_POST["local_gmt"];} +if (isset($_GET["local_web_callerID_URL"])) {$local_web_callerID_URL=$_GET["local_web_callerID_URL"];} + elseif (isset($_POST["local_web_callerID_URL"])) {$local_web_callerID_URL=$_POST["local_web_callerID_URL"];} +if (isset($_GET["login"])) {$login=$_GET["login"];} + elseif (isset($_POST["login"])) {$login=$_POST["login"];} +if (isset($_GET["login_campaign"])) {$login_campaign=$_GET["login_campaign"];} + elseif (isset($_POST["login_campaign"])) {$login_campaign=$_POST["login_campaign"];} +if (isset($_GET["login_pass"])) {$login_pass=$_GET["login_pass"];} + elseif (isset($_POST["login_pass"])) {$login_pass=$_POST["login_pass"];} +if (isset($_GET["login_user"])) {$login_user=$_GET["login_user"];} + elseif (isset($_POST["login_user"])) {$login_user=$_POST["login_user"];} +if (isset($_GET["max_vicidial_trunks"])) {$max_vicidial_trunks=$_GET["max_vicidial_trunks"];} + elseif (isset($_POST["max_vicidial_trunks"])) {$max_vicidial_trunks=$_POST["max_vicidial_trunks"];} +if (isset($_GET["modify_call_times"])) {$modify_call_times=$_GET["modify_call_times"];} + elseif (isset($_POST["modify_call_times"])) {$modify_call_times=$_POST["modify_call_times"];} +if (isset($_GET["modify_leads"])) {$modify_leads=$_GET["modify_leads"];} + elseif (isset($_POST["modify_leads"])) {$modify_leads=$_POST["modify_leads"];} +if (isset($_GET["monitor_prefix"])) {$monitor_prefix=$_GET["monitor_prefix"];} + elseif (isset($_POST["monitor_prefix"])) {$monitor_prefix=$_POST["monitor_prefix"];} +if (isset($_GET["next_agent_call"])) {$next_agent_call=$_GET["next_agent_call"];} + elseif (isset($_POST["next_agent_call"])) {$next_agent_call=$_POST["next_agent_call"];} +if (isset($_GET["number_of_lines"])) {$number_of_lines=$_GET["number_of_lines"];} + elseif (isset($_POST["number_of_lines"])) {$number_of_lines=$_POST["number_of_lines"];} +if (isset($_GET["old_campaign_id"])) {$old_campaign_id=$_GET["old_campaign_id"];} + elseif (isset($_POST["old_campaign_id"])) {$old_campaign_id=$_POST["old_campaign_id"];} +if (isset($_GET["old_conf_exten"])) {$old_conf_exten=$_GET["old_conf_exten"];} + elseif (isset($_POST["old_conf_exten"])) {$old_conf_exten=$_POST["old_conf_exten"];} +if (isset($_GET["old_extension"])) {$old_extension=$_GET["old_extension"];} + elseif (isset($_POST["old_extension"])) {$old_extension=$_POST["old_extension"];} +if (isset($_GET["old_server_id"])) {$old_server_id=$_GET["old_server_id"];} + elseif (isset($_POST["old_server_id"])) {$old_server_id=$_POST["old_server_id"];} +if (isset($_GET["old_server_ip"])) {$old_server_ip=$_GET["old_server_ip"];} + elseif (isset($_POST["old_server_ip"])) {$old_server_ip=$_POST["old_server_ip"];} +if (isset($_GET["OLDuser_group"])) {$OLDuser_group=$_GET["OLDuser_group"];} + elseif (isset($_POST["OLDuser_group"])) {$OLDuser_group=$_POST["OLDuser_group"];} +if (isset($_GET["omit_phone_code"])) {$omit_phone_code=$_GET["omit_phone_code"];} + elseif (isset($_POST["omit_phone_code"])) {$omit_phone_code=$_POST["omit_phone_code"];} +if (isset($_GET["outbound_cid"])) {$outbound_cid=$_GET["outbound_cid"];} + elseif (isset($_POST["outbound_cid"])) {$outbound_cid=$_POST["outbound_cid"];} +if (isset($_GET["park_ext"])) {$park_ext=$_GET["park_ext"];} + elseif (isset($_POST["park_ext"])) {$park_ext=$_POST["park_ext"];} +if (isset($_GET["park_file_name"])) {$park_file_name=$_GET["park_file_name"];} + elseif (isset($_POST["park_file_name"])) {$park_file_name=$_POST["park_file_name"];} +if (isset($_GET["park_on_extension"])) {$park_on_extension=$_GET["park_on_extension"];} + elseif (isset($_POST["park_on_extension"])) {$park_on_extension=$_POST["park_on_extension"];} +if (isset($_GET["pass"])) {$pass=$_GET["pass"];} + elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];} +if (isset($_GET["phone_ip"])) {$phone_ip=$_GET["phone_ip"];} + elseif (isset($_POST["phone_ip"])) {$phone_ip=$_POST["phone_ip"];} +if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];} + elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];} +if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];} + elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];} +if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];} + elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];} +if (isset($_GET["phone_type"])) {$phone_type=$_GET["phone_type"];} + elseif (isset($_POST["phone_type"])) {$phone_type=$_POST["phone_type"];} +if (isset($_GET["picture"])) {$picture=$_GET["picture"];} + elseif (isset($_POST["picture"])) {$picture=$_POST["picture"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} +if (isset($_GET["QUEUE_ACTION_enabled"])) {$QUEUE_ACTION_enabled=$_GET["QUEUE_ACTION_enabled"];} + elseif (isset($_POST["QUEUE_ACTION_enabled"])) {$QUEUE_ACTION_enabled=$_POST["QUEUE_ACTION_enabled"];} +if (isset($_GET["recording_exten"])) {$recording_exten=$_GET["recording_exten"];} + elseif (isset($_POST["recording_exten"])) {$recording_exten=$_POST["recording_exten"];} +if (isset($_GET["remote_agent_id"])) {$remote_agent_id=$_GET["remote_agent_id"];} + elseif (isset($_POST["remote_agent_id"])) {$remote_agent_id=$_POST["remote_agent_id"];} +if (isset($_GET["reset_hopper"])) {$reset_hopper=$_GET["reset_hopper"];} + elseif (isset($_POST["reset_hopper"])) {$reset_hopper=$_POST["reset_hopper"];} +if (isset($_GET["reset_list"])) {$reset_list=$_GET["reset_list"];} + elseif (isset($_POST["reset_list"])) {$reset_list=$_POST["reset_list"];} +if (isset($_GET["safe_harbor_exten"])) {$safe_harbor_exten=$_GET["safe_harbor_exten"];} + elseif (isset($_POST["safe_harbor_exten"])) {$safe_harbor_exten=$_POST["safe_harbor_exten"];} +if (isset($_GET["safe_harbor_message"])) {$safe_harbor_message=$_GET["safe_harbor_message"];} + elseif (isset($_POST["safe_harbor_message"])) {$safe_harbor_message=$_POST["safe_harbor_message"];} +if (isset($_GET["scheduled_callbacks"])) {$scheduled_callbacks=$_GET["scheduled_callbacks"];} + elseif (isset($_POST["scheduled_callbacks"])) {$scheduled_callbacks=$_POST["scheduled_callbacks"];} +if (isset($_GET["script_comments"])) {$script_comments=$_GET["script_comments"];} + elseif (isset($_POST["script_comments"])) {$script_comments=$_POST["script_comments"];} +if (isset($_GET["script_id"])) {$script_id=$_GET["script_id"];} + elseif (isset($_POST["script_id"])) {$script_id=$_POST["script_id"];} +if (isset($_GET["script_name"])) {$script_name=$_GET["script_name"];} + elseif (isset($_POST["script_name"])) {$script_name=$_POST["script_name"];} +if (isset($_GET["script_text"])) {$script_text=$_GET["script_text"];} + elseif (isset($_POST["script_text"])) {$script_text=$_POST["script_text"];} +if (isset($_GET["selectable"])) {$selectable=$_GET["selectable"];} + elseif (isset($_POST["selectable"])) {$selectable=$_POST["selectable"];} +if (isset($_GET["server_description"])) {$server_description=$_GET["server_description"];} + elseif (isset($_POST["server_description"])) {$server_description=$_POST["server_description"];} +if (isset($_GET["server_id"])) {$server_id=$_GET["server_id"];} + elseif (isset($_POST["server_id"])) {$server_id=$_POST["server_id"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["state_call_time_state"])) {$state_call_time_state=$_GET["state_call_time_state"];} + elseif (isset($_POST["state_call_time_state"])) {$state_call_time_state=$_POST["state_call_time_state"];} +if (isset($_GET["state_rule"])) {$state_rule=$_GET["state_rule"];} + elseif (isset($_POST["state_rule"])) {$state_rule=$_POST["state_rule"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["status_name"])) {$status_name=$_GET["status_name"];} + elseif (isset($_POST["status_name"])) {$status_name=$_POST["status_name"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["sys_perf_log"])) {$sys_perf_log=$_GET["sys_perf_log"];} + elseif (isset($_POST["sys_perf_log"])) {$sys_perf_log=$_POST["sys_perf_log"];} +if (isset($_GET["telnet_host"])) {$telnet_host=$_GET["telnet_host"];} + elseif (isset($_POST["telnet_host"])) {$telnet_host=$_POST["telnet_host"];} +if (isset($_GET["telnet_port"])) {$telnet_port=$_GET["telnet_port"];} + elseif (isset($_POST["telnet_port"])) {$telnet_port=$_POST["telnet_port"];} +if (isset($_GET["updater_check_enabled"])) {$updater_check_enabled=$_GET["updater_check_enabled"];} + elseif (isset($_POST["updater_check_enabled"])) {$updater_check_enabled=$_POST["updater_check_enabled"];} +if (isset($_GET["use_internal_dnc"])) {$use_internal_dnc=$_GET["use_internal_dnc"];} + elseif (isset($_POST["use_internal_dnc"])) {$use_internal_dnc=$_POST["use_internal_dnc"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["user_group"])) {$user_group=$_GET["user_group"];} + elseif (isset($_POST["user_group"])) {$user_group=$_POST["user_group"];} +if (isset($_GET["user_level"])) {$user_level=$_GET["user_level"];} + elseif (isset($_POST["user_level"])) {$user_level=$_POST["user_level"];} +if (isset($_GET["user_start"])) {$user_start=$_GET["user_start"];} + elseif (isset($_POST["user_start"])) {$user_start=$_POST["user_start"];} +if (isset($_GET["user_switching_enabled"])) {$user_switching_enabled=$_GET["user_switching_enabled"];} + elseif (isset($_POST["user_switching_enabled"])) {$user_switching_enabled=$_POST["user_switching_enabled"];} +if (isset($_GET["vd_server_logs"])) {$vd_server_logs=$_GET["vd_server_logs"];} + elseif (isset($_POST["vd_server_logs"])) {$vd_server_logs=$_POST["vd_server_logs"];} +if (isset($_GET["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_GET["VDstop_rec_after_each_call"];} + elseif (isset($_POST["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_POST["VDstop_rec_after_each_call"];} +if (isset($_GET["VICIDIAL_park_on_extension"])) {$VICIDIAL_park_on_extension=$_GET["VICIDIAL_park_on_extension"];} + elseif (isset($_POST["VICIDIAL_park_on_extension"])) {$VICIDIAL_park_on_extension=$_POST["VICIDIAL_park_on_extension"];} +if (isset($_GET["VICIDIAL_park_on_filename"])) {$VICIDIAL_park_on_filename=$_GET["VICIDIAL_park_on_filename"];} + elseif (isset($_POST["VICIDIAL_park_on_filename"])) {$VICIDIAL_park_on_filename=$_POST["VICIDIAL_park_on_filename"];} +if (isset($_GET["vicidial_recording"])) {$vicidial_recording=$_GET["vicidial_recording"];} + elseif (isset($_POST["vicidial_recording"])) {$vicidial_recording=$_POST["vicidial_recording"];} +if (isset($_GET["vicidial_transfers"])) {$vicidial_transfers=$_GET["vicidial_transfers"];} + elseif (isset($_POST["vicidial_transfers"])) {$vicidial_transfers=$_POST["vicidial_transfers"];} +if (isset($_GET["VICIDIAL_web_URL"])) {$VICIDIAL_web_URL=$_GET["VICIDIAL_web_URL"];} + elseif (isset($_POST["VICIDIAL_web_URL"])) {$VICIDIAL_web_URL=$_POST["VICIDIAL_web_URL"];} +if (isset($_GET["voicemail_button_enabled"])) {$voicemail_button_enabled=$_GET["voicemail_button_enabled"];} + elseif (isset($_POST["voicemail_button_enabled"])) {$voicemail_button_enabled=$_POST["voicemail_button_enabled"];} +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["voicemail_ext"])) {$voicemail_ext=$_GET["voicemail_ext"];} + elseif (isset($_POST["voicemail_ext"])) {$voicemail_ext=$_POST["voicemail_ext"];} +if (isset($_GET["voicemail_exten"])) {$voicemail_exten=$_GET["voicemail_exten"];} + elseif (isset($_POST["voicemail_exten"])) {$voicemail_exten=$_POST["voicemail_exten"];} +if (isset($_GET["voicemail_id"])) {$voicemail_id=$_GET["voicemail_id"];} + elseif (isset($_POST["voicemail_id"])) {$voicemail_id=$_POST["voicemail_id"];} +if (isset($_GET["web_form_address"])) {$web_form_address=$_GET["web_form_address"];} + elseif (isset($_POST["web_form_address"])) {$web_form_address=$_POST["web_form_address"];} +if (isset($_GET["wrapup_message"])) {$wrapup_message=$_GET["wrapup_message"];} + elseif (isset($_POST["wrapup_message"])) {$wrapup_message=$_POST["wrapup_message"];} +if (isset($_GET["wrapup_seconds"])) {$wrapup_seconds=$_GET["wrapup_seconds"];} + elseif (isset($_POST["wrapup_seconds"])) {$wrapup_seconds=$_POST["wrapup_seconds"];} +if (isset($_GET["xferconf_a_dtmf"])) {$xferconf_a_dtmf=$_GET["xferconf_a_dtmf"];} + elseif (isset($_POST["xferconf_a_dtmf"])) {$xferconf_a_dtmf=$_POST["xferconf_a_dtmf"];} +if (isset($_GET["xferconf_a_number"])) {$xferconf_a_number=$_GET["xferconf_a_number"];} + elseif (isset($_POST["xferconf_a_number"])) {$xferconf_a_number=$_POST["xferconf_a_number"];} +if (isset($_GET["xferconf_b_dtmf"])) {$xferconf_b_dtmf=$_GET["xferconf_b_dtmf"];} + elseif (isset($_POST["xferconf_b_dtmf"])) {$xferconf_b_dtmf=$_POST["xferconf_b_dtmf"];} +if (isset($_GET["xferconf_b_number"])) {$xferconf_b_number=$_GET["xferconf_b_number"];} + elseif (isset($_POST["xferconf_b_number"])) {$xferconf_b_number=$_POST["xferconf_b_number"];} +if (isset($_GET["vicidial_balance_active"])) {$vicidial_balance_active=$_GET["vicidial_balance_active"];} + elseif (isset($_POST["vicidial_balance_active"])) {$vicidial_balance_active=$_POST["vicidial_balance_active"];} +if (isset($_GET["balance_trunks_offlimits"])) {$balance_trunks_offlimits=$_GET["balance_trunks_offlimits"];} + elseif (isset($_POST["balance_trunks_offlimits"])) {$balance_trunks_offlimits=$_POST["balance_trunks_offlimits"];} +if (isset($_GET["dedicated_trunks"])) {$dedicated_trunks=$_GET["dedicated_trunks"];} + elseif (isset($_POST["dedicated_trunks"])) {$dedicated_trunks=$_POST["dedicated_trunks"];} +if (isset($_GET["trunk_restriction"])) {$trunk_restriction=$_GET["trunk_restriction"];} + elseif (isset($_POST["trunk_restriction"])) {$trunk_restriction=$_POST["trunk_restriction"];} +if (isset($_GET["campaigns"])) {$campaigns=$_GET["campaigns"];} + elseif (isset($_POST["campaigns"])) {$campaigns=$_POST["campaigns"];} +if (isset($_GET["dial_level_override"])) {$dial_level_override=$_GET["dial_level_override"];} + elseif (isset($_POST["dial_level_override"])) {$dial_level_override=$_POST["dial_level_override"];} +if (isset($_GET["concurrent_transfers"])) {$concurrent_transfers=$_GET["concurrent_transfers"];} + elseif (isset($_POST["concurrent_transfers"])) {$concurrent_transfers=$_POST["concurrent_transfers"];} +if (isset($_GET["auto_alt_dial"])) {$auto_alt_dial=$_GET["auto_alt_dial"];} + elseif (isset($_POST["auto_alt_dial"])) {$auto_alt_dial=$_POST["auto_alt_dial"];} +if (isset($_GET["modify_users"])) {$modify_users=$_GET["modify_users"];} + elseif (isset($_POST["modify_users"])) {$modify_users=$_POST["modify_users"];} +if (isset($_GET["modify_campaigns"])) {$modify_campaigns=$_GET["modify_campaigns"];} + elseif (isset($_POST["modify_campaigns"])) {$modify_campaigns=$_POST["modify_campaigns"];} +if (isset($_GET["modify_lists"])) {$modify_lists=$_GET["modify_lists"];} + elseif (isset($_POST["modify_lists"])) {$modify_lists=$_POST["modify_lists"];} +if (isset($_GET["modify_scripts"])) {$modify_scripts=$_GET["modify_scripts"];} + elseif (isset($_POST["modify_scripts"])) {$modify_scripts=$_POST["modify_scripts"];} +if (isset($_GET["modify_filters"])) {$modify_filters=$_GET["modify_filters"];} + elseif (isset($_POST["modify_filters"])) {$modify_filters=$_POST["modify_filters"];} +if (isset($_GET["modify_ingroups"])) {$modify_ingroups=$_GET["modify_ingroups"];} + elseif (isset($_POST["modify_ingroups"])) {$modify_ingroups=$_POST["modify_ingroups"];} +if (isset($_GET["modify_usergroups"])) {$modify_usergroups=$_GET["modify_usergroups"];} + elseif (isset($_POST["modify_usergroups"])) {$modify_usergroups=$_POST["modify_usergroups"];} +if (isset($_GET["modify_remoteagents"])) {$modify_remoteagents=$_GET["modify_remoteagents"];} + elseif (isset($_POST["modify_remoteagents"])) {$modify_remoteagents=$_POST["modify_remoteagents"];} +if (isset($_GET["modify_servers"])) {$modify_servers=$_GET["modify_servers"];} + elseif (isset($_POST["modify_servers"])) {$modify_servers=$_POST["modify_servers"];} +if (isset($_GET["view_reports"])) {$view_reports=$_GET["view_reports"];} + elseif (isset($_POST["view_reports"])) {$view_reports=$_POST["view_reports"];} +if (isset($_GET["agent_pause_codes_active"])) {$agent_pause_codes_active=$_GET["agent_pause_codes_active"];} + elseif (isset($_POST["agent_pause_codes_active"])) {$agent_pause_codes_active=$_POST["agent_pause_codes_active"];} +if (isset($_GET["pause_code"])) {$pause_code=$_GET["pause_code"];} + elseif (isset($_POST["pause_code"])) {$pause_code=$_POST["pause_code"];} +if (isset($_GET["pause_code_name"])) {$pause_code_name=$_GET["pause_code_name"];} + elseif (isset($_POST["pause_code_name"])) {$pause_code_name=$_POST["pause_code_name"];} +if (isset($_GET["billable"])) {$billable=$_GET["billable"];} + elseif (isset($_POST["billable"])) {$billable=$_POST["billable"];} +if (isset($_GET["campaign_description"])) {$campaign_description=$_GET["campaign_description"];} + elseif (isset($_POST["campaign_description"])) {$campaign_description=$_POST["campaign_description"];} +if (isset($_GET["campaign_stats_refresh"])) {$campaign_stats_refresh=$_GET["campaign_stats_refresh"];} + elseif (isset($_POST["campaign_stats_refresh"])){$campaign_stats_refresh=$_POST["campaign_stats_refresh"];} +if (isset($_GET["list_description"])) {$list_description=$_GET["list_description"];} + elseif (isset($_POST["list_description"])) {$list_description=$_POST["list_description"];} +if (isset($_GET["vicidial_recording_override"])) {$vicidial_recording_override=$_GET["vicidial_recording_override"];} elseif (isset($_POST["vicidial_recording_override"])) {$vicidial_recording_override=$_POST["vicidial_recording_override"];} +if (isset($_GET["use_non_latin"])) {$use_non_latin=$_GET["use_non_latin"];} + elseif (isset($_POST["use_non_latin"])) {$use_non_latin=$_POST["use_non_latin"];} +if (isset($_GET["webroot_writable"])) {$webroot_writable=$_GET["webroot_writable"];} + elseif (isset($_POST["webroot_writable"])) {$webroot_writable=$_POST["webroot_writable"];} +if (isset($_GET["enable_queuemetrics_logging"])) {$enable_queuemetrics_logging=$_GET["enable_queuemetrics_logging"];} + elseif (isset($_POST["enable_queuemetrics_logging"])) {$enable_queuemetrics_logging=$_POST["enable_queuemetrics_logging"];} +if (isset($_GET["queuemetrics_server_ip"])) {$queuemetrics_server_ip=$_GET["queuemetrics_server_ip"];} + elseif (isset($_POST["queuemetrics_server_ip"])) {$queuemetrics_server_ip=$_POST["queuemetrics_server_ip"];} +if (isset($_GET["queuemetrics_dbname"])) {$queuemetrics_dbname=$_GET["queuemetrics_dbname"];} + elseif (isset($_POST["queuemetrics_dbname"])) {$queuemetrics_dbname=$_POST["queuemetrics_dbname"];} +if (isset($_GET["queuemetrics_login"])) {$queuemetrics_login=$_GET["queuemetrics_login"];} + elseif (isset($_POST["queuemetrics_login"])) {$queuemetrics_login=$_POST["queuemetrics_login"];} +if (isset($_GET["queuemetrics_pass"])) {$queuemetrics_pass=$_GET["queuemetrics_pass"];} + elseif (isset($_POST["queuemetrics_pass"])) {$queuemetrics_pass=$_POST["queuemetrics_pass"];} +if (isset($_GET["queuemetrics_url"])) {$queuemetrics_url=$_GET["queuemetrics_url"];} + elseif (isset($_POST["queuemetrics_url"])) {$queuemetrics_url=$_POST["queuemetrics_url"];} +if (isset($_GET["queuemetrics_log_id"])) {$queuemetrics_log_id=$_GET["queuemetrics_log_id"];} + elseif (isset($_POST["queuemetrics_log_id"])) {$queuemetrics_log_id=$_POST["queuemetrics_log_id"];} +if (isset($_GET["dial_status"])) {$dial_status=$_GET["dial_status"];} + elseif (isset($_POST["dial_status"])) {$dial_status=$_POST["dial_status"];} +if (isset($_GET["queuemetrics_eq_prepend"])) {$queuemetrics_eq_prepend=$_GET["queuemetrics_eq_prepend"];} + elseif (isset($_POST["queuemetrics_eq_prepend"])) {$queuemetrics_eq_prepend=$_POST["queuemetrics_eq_prepend"];} +if (isset($_GET["vicidial_agent_disable"])) {$vicidial_agent_disable=$_GET["vicidial_agent_disable"];} + elseif (isset($_POST["vicidial_agent_disable"])) {$vicidial_agent_disable=$_POST["vicidial_agent_disable"];} +if (isset($_GET["disable_alter_custdata"])) {$disable_alter_custdata=$_GET["disable_alter_custdata"];} + elseif (isset($_POST["disable_alter_custdata"])) {$disable_alter_custdata=$_POST["disable_alter_custdata"];} +if (isset($_GET["alter_custdata_override"])) {$alter_custdata_override=$_GET["alter_custdata_override"];} + elseif (isset($_POST["alter_custdata_override"])) {$alter_custdata_override=$_POST["alter_custdata_override"];} +if (isset($_GET["no_hopper_leads_logins"])) {$no_hopper_leads_logins=$_GET["no_hopper_leads_logins"];} + elseif (isset($_POST["no_hopper_leads_logins"])) {$no_hopper_leads_logins=$_POST["no_hopper_leads_logins"];} +if (isset($_GET["enable_sipsak_messages"])) {$enable_sipsak_messages=$_GET["enable_sipsak_messages"];} + elseif (isset($_POST["enable_sipsak_messages"])) {$enable_sipsak_messages=$_POST["enable_sipsak_messages"];} +if (isset($_GET["allow_sipsak_messages"])) {$allow_sipsak_messages=$_GET["allow_sipsak_messages"];} + elseif (isset($_POST["allow_sipsak_messages"])) {$allow_sipsak_messages=$_POST["allow_sipsak_messages"];} +if (isset($_GET["admin_home_url"])) {$admin_home_url=$_GET["admin_home_url"];} + elseif (isset($_POST["admin_home_url"])) {$admin_home_url=$_POST["admin_home_url"];} +if (isset($_GET["list_order_mix"])) {$list_order_mix=$_GET["list_order_mix"];} + elseif (isset($_POST["list_order_mix"])) {$list_order_mix=$_POST["list_order_mix"];} +if (isset($_GET["vcl_id"])) {$vcl_id=$_GET["vcl_id"];} + elseif (isset($_POST["vcl_id"])) {$vcl_id=$_POST["vcl_id"];} +if (isset($_GET["vcl_name"])) {$vcl_name=$_GET["vcl_name"];} + elseif (isset($_POST["vcl_name"])) {$vcl_name=$_POST["vcl_name"];} +if (isset($_GET["list_mix_container"])) {$list_mix_container=$_GET["list_mix_container"];} + elseif (isset($_POST["list_mix_container"])) {$list_mix_container=$_POST["list_mix_container"];} +if (isset($_GET["mix_method"])) {$mix_method=$_GET["mix_method"];} + elseif (isset($_POST["mix_method"])) {$mix_method=$_POST["mix_method"];} +if (isset($_GET["human_answered"])) {$human_answered=$_GET["human_answered"];} + elseif (isset($_POST["human_answered"])) {$human_answered=$_POST["human_answered"];} +if (isset($_GET["category"])) {$category=$_GET["category"];} + elseif (isset($_POST["category"])) {$category=$_POST["category"];} +if (isset($_GET["vsc_id"])) {$vsc_id=$_GET["vsc_id"];} + elseif (isset($_POST["vsc_id"])) {$vsc_id=$_POST["vsc_id"];} +if (isset($_GET["vsc_name"])) {$vsc_name=$_GET["vsc_name"];} + elseif (isset($_POST["vsc_name"])) {$vsc_name=$_POST["vsc_name"];} +if (isset($_GET["vsc_description"])) {$vsc_description=$_GET["vsc_description"];} + elseif (isset($_POST["vsc_description"])) {$vsc_description=$_POST["vsc_description"];} +if (isset($_GET["tovdad_display"])) {$tovdad_display=$_GET["tovdad_display"];} + elseif (isset($_POST["tovdad_display"])) {$tovdad_display=$_POST["tovdad_display"];} +if (isset($_GET["mix_container_item"])) {$mix_container_item=$_GET["mix_container_item"];} + elseif (isset($_POST["mix_container_item"])) {$mix_container_item=$_POST["mix_container_item"];} +if (isset($_GET["enable_agc_xfer_log"])) {$enable_agc_xfer_log=$_GET["enable_agc_xfer_log"];} + elseif (isset($_POST["enable_agc_xfer_log"])) {$enable_agc_xfer_log=$_POST["enable_agc_xfer_log"];} +if (isset($_GET["after_hours_action"])) {$after_hours_action=$_GET["after_hours_action"];} + elseif (isset($_POST["after_hours_action"])) {$after_hours_action=$_POST["after_hours_action"];} +if (isset($_GET["after_hours_message_filename"])) {$after_hours_message_filename=$_GET["after_hours_message_filename"];} + elseif (isset($_POST["after_hours_message_filename"])) {$after_hours_message_filename=$_POST["after_hours_message_filename"];} +if (isset($_GET["after_hours_exten"])) {$after_hours_exten=$_GET["after_hours_exten"];} + elseif (isset($_POST["after_hours_exten"])) {$after_hours_exten=$_POST["after_hours_exten"];} +if (isset($_GET["after_hours_voicemail"])) {$after_hours_voicemail=$_GET["after_hours_voicemail"];} + elseif (isset($_POST["after_hours_voicemail"])) {$after_hours_voicemail=$_POST["after_hours_voicemail"];} +if (isset($_GET["welcome_message_filename"])) {$welcome_message_filename=$_GET["welcome_message_filename"];} + elseif (isset($_POST["welcome_message_filename"])) {$welcome_message_filename=$_POST["welcome_message_filename"];} +if (isset($_GET["moh_context"])) {$moh_context=$_GET["moh_context"];} + elseif (isset($_POST["moh_context"])) {$moh_context=$_POST["moh_context"];} +if (isset($_GET["onhold_prompt_filename"])) {$onhold_prompt_filename=$_GET["onhold_prompt_filename"];} + elseif (isset($_POST["onhold_prompt_filename"])) {$onhold_prompt_filename=$_POST["onhold_prompt_filename"];} +if (isset($_GET["prompt_interval"])) {$prompt_interval=$_GET["prompt_interval"];} + elseif (isset($_POST["prompt_interval"])) {$prompt_interval=$_POST["prompt_interval"];} +if (isset($_GET["agent_alert_exten"])) {$agent_alert_exten=$_GET["agent_alert_exten"];} + elseif (isset($_POST["agent_alert_exten"])) {$agent_alert_exten=$_POST["agent_alert_exten"];} +if (isset($_GET["agent_alert_delay"])) {$agent_alert_delay=$_GET["agent_alert_delay"];} + elseif (isset($_POST["agent_alert_delay"])) {$agent_alert_delay=$_POST["agent_alert_delay"];} +if (isset($_GET["group_rank"])) {$group_rank=$_GET["group_rank"];} + elseif (isset($_POST["group_rank"])) {$group_rank=$_POST["group_rank"];} +if (isset($_GET["campaign_allow_inbound"])) {$campaign_allow_inbound=$_GET["campaign_allow_inbound"];} + elseif (isset($_POST["campaign_allow_inbound"])) {$campaign_allow_inbound=$_POST["campaign_allow_inbound"];} +if (isset($_GET["manual_dial_list_id"])) {$manual_dial_list_id=$_GET["manual_dial_list_id"];} + elseif (isset($_POST["manual_dial_list_id"])) {$manual_dial_list_id=$_POST["manual_dial_list_id"];} +if (isset($_GET["campaign_rank"])) {$campaign_rank=$_GET["campaign_rank"];} + elseif (isset($_POST["campaign_rank"])) {$campaign_rank=$_POST["campaign_rank"];} +if (isset($_GET["source_campaign_id"])) {$source_campaign_id=$_GET["source_campaign_id"];} + elseif (isset($_POST["source_campaign_id"])) {$source_campaign_id=$_POST["source_campaign_id"];} +if (isset($_GET["source_user_id"])) {$source_user_id=$_GET["source_user_id"];} + elseif (isset($_POST["source_user_id"])) {$source_user_id=$_POST["source_user_id"];} +if (isset($_GET["source_group_id"])) {$source_group_id=$_GET["source_group_id"];} + elseif (isset($_POST["source_group_id"])) {$source_group_id=$_POST["source_group_id"];} +if (isset($_GET["default_xfer_group"])) {$default_xfer_group=$_GET["default_xfer_group"];} + elseif (isset($_POST["default_xfer_group"])) {$default_xfer_group=$_POST["default_xfer_group"];} + + + if (isset($script_id)) {$script_id= strtoupper($script_id);} + if (isset($lead_filter_id)) {$lead_filter_id = strtoupper($lead_filter_id);} + +if (strlen($dial_status) > 0) + { + $ADD='28'; + $status = $dial_status; + } + +###################################################################################################### +###################################################################################################### +####### Form variable filtering for security and data integrity +###################################################################################################### +###################################################################################################### + +if ($non_latin < 1) +{ +### DIGITS ONLY ### +$adaptive_dropped_percentage = ereg_replace("[^0-9]","",$adaptive_dropped_percentage); +$adaptive_latest_server_time = ereg_replace("[^0-9]","",$adaptive_latest_server_time); +$admin_hangup_enabled = ereg_replace("[^0-9]","",$admin_hangup_enabled); +$admin_hijack_enabled = ereg_replace("[^0-9]","",$admin_hijack_enabled); +$admin_monitor_enabled = ereg_replace("[^0-9]","",$admin_monitor_enabled); +$AFLogging_enabled = ereg_replace("[^0-9]","",$AFLogging_enabled); +$agent_choose_ingroups = ereg_replace("[^0-9]","",$agent_choose_ingroups); +$agentcall_manual = ereg_replace("[^0-9]","",$agentcall_manual); +$agentonly_callbacks = ereg_replace("[^0-9]","",$agentonly_callbacks); +$AGI_call_logging_enabled = ereg_replace("[^0-9]","",$AGI_call_logging_enabled); +$allcalls_delay = ereg_replace("[^0-9]","",$allcalls_delay); +$alter_agent_interface_options = ereg_replace("[^0-9]","",$alter_agent_interface_options); +$am_message_exten = ereg_replace("[^0-9]","",$am_message_exten); +$answer_transfer_agent = ereg_replace("[^0-9]","",$answer_transfer_agent); +$ast_admin_access = ereg_replace("[^0-9]","",$ast_admin_access); +$ast_delete_phones = ereg_replace("[^0-9]","",$ast_delete_phones); +$attempt_delay = ereg_replace("[^0-9]","",$attempt_delay); +$attempt_maximum = ereg_replace("[^0-9]","",$attempt_maximum); +$auto_dial_next_number = ereg_replace("[^0-9]","",$auto_dial_next_number); +$balance_trunks_offlimits = ereg_replace("[^0-9]","",$balance_trunks_offlimits); +$call_parking_enabled = ereg_replace("[^0-9]","",$call_parking_enabled); +$CallerID_popup_enabled = ereg_replace("[^0-9]","",$CallerID_popup_enabled); +$campaign_detail = ereg_replace("[^0-9]","",$campaign_detail); +$campaign_rec_exten = ereg_replace("[^0-9]","",$campaign_rec_exten); +$campaign_vdad_exten = ereg_replace("[^0-9]","",$campaign_vdad_exten); +$change_agent_campaign = ereg_replace("[^0-9]","",$change_agent_campaign); +$closer_default_blended = ereg_replace("[^0-9]","",$closer_default_blended); +$conf_exten = ereg_replace("[^0-9]","",$conf_exten); +$conf_on_extension = ereg_replace("[^0-9]","",$conf_on_extension); +$conferencing_enabled = ereg_replace("[^0-9]","",$conferencing_enabled); +$ct_default_start = ereg_replace("[^0-9]","",$ct_default_start); +$ct_default_stop = ereg_replace("[^0-9]","",$ct_default_stop); +$ct_friday_start = ereg_replace("[^0-9]","",$ct_friday_start); +$ct_friday_stop = ereg_replace("[^0-9]","",$ct_friday_stop); +$ct_monday_start = ereg_replace("[^0-9]","",$ct_monday_start); +$ct_monday_stop = ereg_replace("[^0-9]","",$ct_monday_stop); +$ct_saturday_start = ereg_replace("[^0-9]","",$ct_saturday_start); +$ct_saturday_stop = ereg_replace("[^0-9]","",$ct_saturday_stop); +$ct_sunday_start = ereg_replace("[^0-9]","",$ct_sunday_start); +$ct_sunday_stop = ereg_replace("[^0-9]","",$ct_sunday_stop); +$ct_thursday_start = ereg_replace("[^0-9]","",$ct_thursday_start); +$ct_thursday_stop = ereg_replace("[^0-9]","",$ct_thursday_stop); +$ct_tuesday_start = ereg_replace("[^0-9]","",$ct_tuesday_start); +$ct_tuesday_stop = ereg_replace("[^0-9]","",$ct_tuesday_stop); +$ct_wednesday_start = ereg_replace("[^0-9]","",$ct_wednesday_start); +$ct_wednesday_stop = ereg_replace("[^0-9]","",$ct_wednesday_stop); +$DBX_port = ereg_replace("[^0-9]","",$DBX_port); +$DBY_port = ereg_replace("[^0-9]","",$DBY_port); +$dedicated_trunks = ereg_replace("[^0-9]","",$dedicated_trunks); +$delete_call_times = ereg_replace("[^0-9]","",$delete_call_times); +$delete_campaigns = ereg_replace("[^0-9]","",$delete_campaigns); +$delete_filters = ereg_replace("[^0-9]","",$delete_filters); +$delete_ingroups = ereg_replace("[^0-9]","",$delete_ingroups); +$delete_lists = ereg_replace("[^0-9]","",$delete_lists); +$delete_remote_agents = ereg_replace("[^0-9]","",$delete_remote_agents); +$delete_scripts = ereg_replace("[^0-9]","",$delete_scripts); +$delete_user_groups = ereg_replace("[^0-9]","",$delete_user_groups); +$delete_users = ereg_replace("[^0-9]","",$delete_users); +$dial_timeout = ereg_replace("[^0-9]","",$dial_timeout); +$dialplan_number = ereg_replace("[^0-9]","",$dialplan_number); +$drop_call_seconds = ereg_replace("[^0-9]","",$drop_call_seconds); +$drop_exten = ereg_replace("[^0-9]","",$drop_exten); +$enable_fast_refresh = ereg_replace("[^0-9]","",$enable_fast_refresh); +$enable_persistant_mysql = ereg_replace("[^0-9]","",$enable_persistant_mysql); +$fast_refresh_rate = ereg_replace("[^0-9]","",$fast_refresh_rate); +$hopper_level = ereg_replace("[^0-9]","",$hopper_level); +$hotkey = ereg_replace("[^0-9]","",$hotkey); +$hotkeys_active = ereg_replace("[^0-9]","",$hotkeys_active); +$list_id = ereg_replace("[^0-9]","",$list_id); +$load_leads = ereg_replace("[^0-9]","",$load_leads); +$max_vicidial_trunks = ereg_replace("[^0-9]","",$max_vicidial_trunks); +$modify_call_times = ereg_replace("[^0-9]","",$modify_call_times); +$modify_users = ereg_replace("[^0-9]","",$modify_users); +$modify_campaigns = ereg_replace("[^0-9]","",$modify_campaigns); +$modify_lists = ereg_replace("[^0-9]","",$modify_lists); +$modify_scripts = ereg_replace("[^0-9]","",$modify_scripts); +$modify_filters = ereg_replace("[^0-9]","",$modify_filters); +$modify_ingroups = ereg_replace("[^0-9]","",$modify_ingroups); +$modify_usergroups = ereg_replace("[^0-9]","",$modify_usergroups); +$modify_remoteagents = ereg_replace("[^0-9]","",$modify_remoteagents); +$modify_servers = ereg_replace("[^0-9]","",$modify_servers); +$view_reports = ereg_replace("[^0-9]","",$view_reports); +$modify_leads = ereg_replace("[^0-9]","",$modify_leads); +$monitor_prefix = ereg_replace("[^0-9]","",$monitor_prefix); +$number_of_lines = ereg_replace("[^0-9]","",$number_of_lines); +$old_conf_exten = ereg_replace("[^0-9]","",$old_conf_exten); +$outbound_cid = ereg_replace("[^0-9]","",$outbound_cid); +$park_ext = ereg_replace("[^0-9]","",$park_ext); +$park_on_extension = ereg_replace("[^0-9]","",$park_on_extension); +$phone_number = ereg_replace("[^0-9]","",$phone_number); +$QUEUE_ACTION_enabled = ereg_replace("[^0-9]","",$QUEUE_ACTION_enabled); +$recording_exten = ereg_replace("[^0-9]","",$recording_exten); +$remote_agent_id = ereg_replace("[^0-9]","",$remote_agent_id); +$safe_harbor_exten = ereg_replace("[^0-9]","",$safe_harbor_exten); +$telnet_port = ereg_replace("[^0-9]","",$telnet_port); +$updater_check_enabled = ereg_replace("[^0-9]","",$updater_check_enabled); +$user_level = ereg_replace("[^0-9]","",$user_level); +$user_start = ereg_replace("[^0-9]","",$user_start); +$user_switching_enabled = ereg_replace("[^0-9]","",$user_switching_enabled); +$VDstop_rec_after_each_call = ereg_replace("[^0-9]","",$VDstop_rec_after_each_call); +$VICIDIAL_park_on_extension = ereg_replace("[^0-9]","",$VICIDIAL_park_on_extension); +$vicidial_recording = ereg_replace("[^0-9]","",$vicidial_recording); +$vicidial_transfers = ereg_replace("[^0-9]","",$vicidial_transfers); +$voicemail_button_enabled = ereg_replace("[^0-9]","",$voicemail_button_enabled); +$voicemail_dump_exten = ereg_replace("[^0-9]","",$voicemail_dump_exten); +$voicemail_ext = ereg_replace("[^0-9]","",$voicemail_ext); +$voicemail_exten = ereg_replace("[^0-9]","",$voicemail_exten); +$voicemail_id = ereg_replace("[^0-9]","",$voicemail_id); +$wrapup_seconds = ereg_replace("[^0-9]","",$wrapup_seconds); +$use_non_latin = ereg_replace("[^0-9]","",$use_non_latin); +$webroot_writable = ereg_replace("[^0-9]","",$webroot_writable); +$enable_queuemetrics_logging = ereg_replace("[^0-9]","",$enable_queuemetrics_logging); +$enable_sipsak_messages = ereg_replace("[^0-9]","",$enable_sipsak_messages); +$allow_sipsak_messages = ereg_replace("[^0-9]","",$allow_sipsak_messages); +$mix_container_item = ereg_replace("[^0-9]","",$mix_container_item); +$prompt_interval = ereg_replace("[^0-9]","",$prompt_interval); +$agent_alert_delay = ereg_replace("[^0-9]","",$agent_alert_delay); +$manual_dial_list_id = ereg_replace("[^0-9]","",$manual_dial_list_id); + +### DIGITS and DASHES +$group_rank = ereg_replace("[^-0-9]","",$group_rank); +$campaign_rank = ereg_replace("[^-0-9]","",$campaign_rank); + +### Y or N ONLY ### +$active = ereg_replace("[^NY]","",$active); +$allow_closers = ereg_replace("[^NY]","",$allow_closers); +$reset_hopper = ereg_replace("[^NY]","",$reset_hopper); +$amd_send_to_vmx = ereg_replace("[^NY]","",$amd_send_to_vmx); +$alt_number_dialing = ereg_replace("[^NY]","",$alt_number_dialing); +$safe_harbor_message = ereg_replace("[^NY]","",$safe_harbor_message); +$selectable = ereg_replace("[^NY]","",$selectable); +$reset_list = ereg_replace("[^NY]","",$reset_list); +$fronter_display = ereg_replace("[^NY]","",$fronter_display); +$drop_message = ereg_replace("[^NY]","",$drop_message); +$use_internal_dnc = ereg_replace("[^NY]","",$use_internal_dnc); +$omit_phone_code = ereg_replace("[^NY]","",$omit_phone_code); +$available_only_ratio_tally = ereg_replace("[^NY]","",$available_only_ratio_tally); +$sys_perf_log = ereg_replace("[^NY]","",$sys_perf_log); +$vicidial_balance_active = ereg_replace("[^NY]","",$vicidial_balance_active); +$vd_server_logs = ereg_replace("[^NY]","",$vd_server_logs); +$agent_pause_codes_active = ereg_replace("[^NY]","",$agent_pause_codes_active); +$campaign_stats_refresh = ereg_replace("[^NY]","",$campaign_stats_refresh); +$disable_alter_custdata = ereg_replace("[^NY]","",$disable_alter_custdata); +$no_hopper_leads_logins = ereg_replace("[^NY]","",$no_hopper_leads_logins); +$human_answered = ereg_replace("[^NY]","",$human_answered); +$tovdad_display = ereg_replace("[^NY]","",$tovdad_display); +$campaign_allow_inbound = ereg_replace("[^NY]","",$campaign_allow_inbound); + +### ALPHA-NUMERIC ONLY ### +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); +$script_id = ereg_replace("[^0-9a-zA-Z]","",$script_id); +$submit = ereg_replace("[^0-9a-zA-Z]","",$submit); +$campaign_cid = ereg_replace("[^0-9a-zA-Z]","",$campaign_cid); +$get_call_launch = ereg_replace("[^0-9a-zA-Z]","",$get_call_launch); +$campaign_recording = ereg_replace("[^0-9a-zA-Z]","",$campaign_recording); +$ADD = ereg_replace("[^0-9a-zA-Z]","",$ADD); +$dial_prefix = ereg_replace("[^0-9a-zA-Z]","",$dial_prefix); +$state_call_time_state = ereg_replace("[^0-9a-zA-Z]","",$state_call_time_state); +$scheduled_callbacks = ereg_replace("[^0-9a-zA-Z]","",$scheduled_callbacks); +$concurrent_transfers = ereg_replace("[^0-9a-zA-Z]","",$concurrent_transfers); +$billable = ereg_replace("[^0-9a-zA-Z]","",$billable); +$pause_code = ereg_replace("[^0-9a-zA-Z]","",$pause_code); +$vicidial_recording_override = ereg_replace("[^0-9a-zA-Z]","",$vicidial_recording_override); +$queuemetrics_log_id = ereg_replace("[^0-9a-zA-Z]","",$queuemetrics_log_id); +$after_hours_action = ereg_replace("[^0-9a-zA-Z]","",$after_hours_action); +$after_hours_exten = ereg_replace("[^0-9a-zA-Z]","",$after_hours_exten); +$after_hours_voicemail = ereg_replace("[^0-9a-zA-Z]","",$after_hours_voicemail); + +### DIGITS and Dots +$server_ip = ereg_replace("[^\.0-9]","",$server_ip); +$auto_dial_level = ereg_replace("[^\.0-9]","",$auto_dial_level); +$adaptive_maximum_level = ereg_replace("[^\.0-9]","",$adaptive_maximum_level); +$phone_ip = ereg_replace("[^\.0-9]","",$phone_ip); +$old_server_ip = ereg_replace("[^\.0-9]","",$old_server_ip); +$computer_ip = ereg_replace("[^\.0-9]","",$computer_ip); +$queuemetrics_server_ip = ereg_replace("[^\.0-9]","",$queuemetrics_server_ip); + +### ALPHA-NUMERIC and spaces and hash and star and comma +$xferconf_a_dtmf = ereg_replace("[^ \,\*\#0-9a-zA-Z]","",$xferconf_a_dtmf); +$xferconf_b_dtmf = ereg_replace("[^ \,\*\#0-9a-zA-Z]","",$xferconf_b_dtmf); + +### ALPHACAPS-NUMERIC +$xferconf_a_number = ereg_replace("[^0-9A-Z]","",$xferconf_a_number); +$xferconf_b_number = ereg_replace("[^0-9A-Z]","",$xferconf_b_number); + +### ALPHA-NUMERIC and underscore and dash +$agi_output = ereg_replace("[^-\_0-9a-zA-Z]","",$agi_output); +$ASTmgrSECRET = ereg_replace("[^-\_0-9a-zA-Z]","",$ASTmgrSECRET); +$ASTmgrUSERNAME = ereg_replace("[^-\_0-9a-zA-Z]","",$ASTmgrUSERNAME); +$ASTmgrUSERNAMElisten = ereg_replace("[^-\_0-9a-zA-Z]","",$ASTmgrUSERNAMElisten); +$ASTmgrUSERNAMEsend = ereg_replace("[^-\_0-9a-zA-Z]","",$ASTmgrUSERNAMEsend); +$ASTmgrUSERNAMEupdate = ereg_replace("[^-\_0-9a-zA-Z]","",$ASTmgrUSERNAMEupdate); +$call_time_id = ereg_replace("[^-\_0-9a-zA-Z]","",$call_time_id); +$campaign_id = ereg_replace("[^-\_0-9a-zA-Z]","",$campaign_id); +$CoNfIrM = ereg_replace("[^-\_0-9a-zA-Z]","",$CoNfIrM); +$DBX_database = ereg_replace("[^-\_0-9a-zA-Z]","",$DBX_database); +$DBX_pass = ereg_replace("[^-\_0-9a-zA-Z]","",$DBX_pass); +$DBX_user = ereg_replace("[^-\_0-9a-zA-Z]","",$DBX_user); +$DBY_database = ereg_replace("[^-\_0-9a-zA-Z]","",$DBY_database); +$DBY_pass = ereg_replace("[^-\_0-9a-zA-Z]","",$DBY_pass); +$DBY_user = ereg_replace("[^-\_0-9a-zA-Z]","",$DBY_user); +$dial_method = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_method); +$dial_status_a = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status_a); +$dial_status_b = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status_b); +$dial_status_c = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status_c); +$dial_status_d = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status_d); +$dial_status_e = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status_e); +$ext_context = ereg_replace("[^-\_0-9a-zA-Z]","",$ext_context); +$group_id = ereg_replace("[^-\_0-9a-zA-Z]","",$group_id); +$lead_filter_id = ereg_replace("[^-\_0-9a-zA-Z]","",$lead_filter_id); +$local_call_time = ereg_replace("[^-\_0-9a-zA-Z]","",$local_call_time); +$login = ereg_replace("[^-\_0-9a-zA-Z]","",$login); +$login_campaign = ereg_replace("[^-\_0-9a-zA-Z]","",$login_campaign); +$login_pass = ereg_replace("[^-\_0-9a-zA-Z]","",$login_pass); +$login_user = ereg_replace("[^-\_0-9a-zA-Z]","",$login_user); +$next_agent_call = ereg_replace("[^-\_0-9a-zA-Z]","",$next_agent_call); +$old_campaign_id = ereg_replace("[^-\_0-9a-zA-Z]","",$old_campaign_id); +$old_server_id = ereg_replace("[^-\_0-9a-zA-Z]","",$old_server_id); +$OLDuser_group = ereg_replace("[^-\_0-9a-zA-Z]","",$OLDuser_group); +$park_file_name = ereg_replace("[^-\_0-9a-zA-Z]","",$park_file_name); +$pass = ereg_replace("[^-\_0-9a-zA-Z]","",$pass); +$phone_login = ereg_replace("[^-\_0-9a-zA-Z]","",$phone_login); +$phone_pass = ereg_replace("[^-\_0-9a-zA-Z]","",$phone_pass); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$protocol = ereg_replace("[^-\_0-9a-zA-Z]","",$protocol); +$server_id = ereg_replace("[^-\_0-9a-zA-Z]","",$server_id); +$stage = ereg_replace("[^-\_0-9a-zA-Z]","",$stage); +$state_rule = ereg_replace("[^-\_0-9a-zA-Z]","",$state_rule); +$status = ereg_replace("[^-\_0-9a-zA-Z]","",$status); +$trunk_restriction = ereg_replace("[^-\_0-9a-zA-Z]","",$trunk_restriction); +$user = ereg_replace("[^-\_0-9a-zA-Z]","",$user); +$user_group = ereg_replace("[^-\_0-9a-zA-Z]","",$user_group); +$VICIDIAL_park_on_filename = ereg_replace("[^-\_0-9a-zA-Z]","",$VICIDIAL_park_on_filename); +$auto_alt_dial = ereg_replace("[^-\_0-9a-zA-Z]","",$auto_alt_dial); +$dial_status = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status); +$queuemetrics_eq_prepend = ereg_replace("[^-\_0-9a-zA-Z]","",$queuemetrics_eq_prepend); +$vicidial_agent_disable = ereg_replace("[^-\_0-9a-zA-Z]","",$vicidial_agent_disable); +$alter_custdata_override = ereg_replace("[^-\_0-9a-zA-Z]","",$alter_custdata_override); +$list_order_mix = ereg_replace("[^-\_0-9a-zA-Z]","",$list_order_mix); +$vcl_id = ereg_replace("[^-\_0-9a-zA-Z]","",$vcl_id); +$mix_method = ereg_replace("[^-\_0-9a-zA-Z]","",$mix_method); +$category = ereg_replace("[^-\_0-9a-zA-Z]","",$category); +$vsc_id = ereg_replace("[^-\_0-9a-zA-Z]","",$vsc_id); +$moh_context = ereg_replace("[^-\_0-9a-zA-Z]","",$moh_context); +$agent_alert_exten = ereg_replace("[^-\_0-9a-zA-Z]","",$agent_alert_exten); +$source_campaign_id = ereg_replace("[^-\_0-9a-zA-Z]","",$source_campaign_id); +$source_user_id = ereg_replace("[^-\_0-9a-zA-Z]","",$source_user_id); +$source_group_id = ereg_replace("[^-\_0-9a-zA-Z]","",$source_group_id); +$default_xfer_group = ereg_replace("[^-\_0-9a-zA-Z]","",$default_xfer_group); + +### ALPHA-NUMERIC and spaces +$lead_order = ereg_replace("[^ 0-9a-zA-Z]","",$lead_order); +### ALPHA-NUMERIC and hash +$group_color = ereg_replace("[^\#0-9a-zA-Z]","",$group_color); + +### ALPHA-NUMERIC and spaces dots, commas, dashes, underscores +$adaptive_dl_diff_target = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$adaptive_dl_diff_target); +$adaptive_intensity = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$adaptive_intensity); +$asterisk_version = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$asterisk_version); +$call_time_comments = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$call_time_comments); +$call_time_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$call_time_name); +$campaign_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$campaign_name); +$campaign_rec_filename = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$campaign_rec_filename); +$company = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$company); +$full_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$full_name); +$fullname = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$fullname); +$group_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$group_name); +$HKstatus = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$HKstatus); +$lead_filter_comments = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$lead_filter_comments); +$lead_filter_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$lead_filter_name); +$list_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$list_name); +$local_gmt = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$local_gmt); +$phone_type = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$phone_type); +$picture = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$picture); +$script_comments = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$script_comments); +$script_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$script_name); +$server_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$server_description); +$status = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$status); +$status_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$status_name); +$wrapup_message = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$wrapup_message); +$pause_code_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$pause_code_name); +$campaign_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$campaign_description); +$list_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$list_description); +$vcl_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$vcl_name); +$vsc_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$vsc_name); +$vsc_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$vsc_description); + +### ALPHA-NUMERIC and underscore and dash and slash and at and dot +$call_out_number_group = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$call_out_number_group); +$client_browser = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$client_browser); +$DBX_server = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$DBX_server); +$DBY_server = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$DBY_server); +$dtmf_send_extension = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$dtmf_send_extension); +$extension = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$extension); +$install_directory = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$install_directory); +$old_extension = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$old_extension); +$telnet_host = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$telnet_host); +$queuemetrics_dbname = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$queuemetrics_dbname); +$queuemetrics_login = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$queuemetrics_login); +$queuemetrics_pass = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$queuemetrics_pass); +$after_hours_message_filename = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$after_hours_message_filename); +$welcome_message_filename = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$welcome_message_filename); +$onhold_prompt_filename = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$onhold_prompt_filename); + +### remove semi-colons ### +$lead_filter_sql = ereg_replace(";","",$lead_filter_sql); +$list_mix_container = ereg_replace(";","",$list_mix_container); + +### VARIABLES TO BE mysql_real_escape_string ### +# $web_form_address +# $queuemetrics_url +# $admin_home_url + +### VARIABLES not filtered at all ### +# $script_text + +} # end of non_latin + + +##### END VARIABLE FILTERING FOR SECURITY ##### + + +# AST GUI database administration +# admin.php +# +# CHANGELOG: +# 50315-1110 - Added Custom Campaign Statuses +# 50317-1438 - Added Fronter Display var to inbound groups +# 50322-1355 - Added custom callerID per campaign +# 50517-1356 - Added user_groups sections and user_group to vicidial_users +# 50517-1440 - Added ability to logout (must click OK with empty user/pass) +# 50602-1622 - Added lead loader pages to load new files into vicidial_list +# 50620-1351 - Added custom vdad transfer AGI extension per campaign +# 50810-1414 - modified in groups to kick out spaces and dashes +# 50908-2136 - Added Custom Campaign HotKeys +# 50914-0950 - Fixed user search by user_group +# 50926-1358 - Modified to allow for language translation +# 50926-1615 - Added WeBRooTWritablE write controls +# 51020-1008 - Added editable web address and park ext - NEW dial campaigns +# 51020-1056 - Added fields and help for campaign recording control +# 51123-1335 - Altered code to function in php globals=off +# 51208-1038 - Added user_level changes, function controls and default user phones +# 51208-1556 - Added deletion of users/lists/campaigns/in groups/remote agents +# 51213-1706 - Added add/delete/modify vicidial scripts +# 51214-1737 - Added preview of vicidial script in popup window +# 51219-1225 - Added campaign and ingroups script selector and get_call_launch field +# 51222-1055 - Added am_message_exten to campaigns to allow for AM Message button +# 51222-1125 - Fixed new vicidial_campaigns default values not being assigned bug +# 51222-1156 - Added LOG OUT ALL AGENTS ON THIS CAMPAIGN button to campaign screen +# 60204-0659 - Fixed hopper reset bug +# 60207-1413 - Added AMD send to voicemail extension and xfer-conf dtmf presets +# 60213-1100 - Added several vicidial_users permissions fields +# 60215-1319 - Added On-hold CallBacks display and links +# 60227-1226 - Fixed vicidial_inbound_groups insert bug +# 60413-1308 - Fixed list display to have 1 row/status: count and time zone tables +# - Added status name in selected dial statuses in campaign screen +# 60417-1416 - Added vicidial_lead_filters sections +# - Changed the header links to color-coded sectional with sublinks below +# - Added filter name and script name to campaign and in-group modify sections +# - Added callback and alt dial options to campaigns section +# - Added callback, alt dial and other options to users section +# 60419-1628 - Alter Callbacks display to include status and LIVE listings, reordered +# 60421-1441 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60425-2355 - Added agent options to vicidial_users, reformatted user page +# 60502-1627 - Added drop_call_seconds and safe_harbor_ fields to campaign screen +# 60503-1228 - Added drop_call_seconds and drop_ fields to inbound groups screen +# 60505-1117 - Added initial framework for new local_call_times tables and definitions +# 60506-1033 - More revisions to the local_call_time section +# 60508-1354 - Finished call_times and state_call_times sections +# - Added modify/delete options for call_times +# 60509-1311 - Functionalize campaign dialable leads calculation +# - Change state_call_times selection from call_times to only allow one per state +# - Added dialable leads count popup to campaign screen if auto-calc is disabled +# - Added test dialable leads count popup to filter screen +# 60510-1050 - Added Wrapup seconds and Wrapup message to campaigns screen +# 60608-1401 - Added allowable inbound_groups checkboxes to CLOSER campaign detail screen +# 60609-1051 - Added add-to-dnc in LISTS section +# 60613-1415 - Added lead recycling options to campaign detail screen +# 60619-1523 - Added variable filtering to eliminate SQL injection attack threat +# 60622-1216 - Fixed HotKey addition form issues and variable filtering +# 60623-1159 - Fixed Scheduled Callbacks over-filtering bug and filter_sql bug +# 60808-1147 - Changed filtering for and added instructions for consutative transfers +# 60816-1552 - Added allcalls_delay start delay for recordings in vicidial.php +# 60817-2226 - Fixed bug that would not allow lead recycling of non-selectable statuses +# 60821-1543 - Added option to Omit Phone Code while dialing in vicidial +# 60821-1625 - Added ALLFORCE recording option for campaign_recording +# 60823-1154 - Added fields for adaptive dialing +# 60824-1326 - Added adaptive_latest_target_gmt for ADAPT_TAPERED dial method +# 60825-1205 - Added adaptive_intensity for ADAPT_ dial methods +# 60828-1019 - Changed adaptive_latest_target_gmt to adaptive_latest_server_time +# 60828-1115 - Added adaptive_dl_diff_target and changed intensity dropdown +# 60927-1246 - Added astguiclient/admin.php functions under SERVERS tab +# 61002-1402 - Added fields for vicidial balance trunk controls +# 61003-1123 - Added functions for vicidial_server_trunks records +# 61109-1022 - Added Emergency VDAC Jam Clear function to Campaign Detail screen +# 61110-1502 - Add ability to select NONE in dial statuses, new list_id must not be < 100 +# 61122-1228 - Added user group campaign restrictions +# 61122-1535 - Changed script_text to unfiltered and added more variables to SCRIPTS +# 61129-1028 - Added headers to Users and Phones with clickable order-by titles +# 70108-1405 - Added ADAPT OVERRIDE to allow for forced dial_level changes in ADAPT dial methods +# - Screen width definable at top of script, merged server_stats into this script +# 70109-1638 - Added ALTPH2 and ADDR3 hotkey options for alt number dialing with HotKeys +# 70109-1716 - Added concurrent_transfers option to vicidial_campaigns +# 70115-1152 - Aded (CLOSER|BLEND|INBND|_C$|_B$|_I$) options for CLOSER-type campaigns +# 70115-1532 - Added auto_alt_dial field to campaign screen for auto-dialing of alt numbers +# 70116-1200 - Added auto_alt_dial_status functionality to campaign screen +# 70117-1235 - Added header formatting variables at top of script +# - Moved Call Times and Phones/Server functions to Admin section +# 70118-1706 - Added new user group displays and links +# 70123-1519 - Added user permission settings for all sections +# 70124-1346 - Fixed spelling errors and formatting consistency +# 70202-1120 - Added agent_pause_codes section to campaigns +# 70205-1204 - Added memo, last dialed, timestamp and stats-refresh fields to vicidial_campaigns/lists +# 70206-1323 - Added user setting for vicidial_recording_override +# 70212-1412 - Added system settings section +# 70214-1226 - Added QueueMetrics Log ID field to system settings section +# 70219-1102 - Changed campaign dial statuses to be one string allowing for high limit +# 70223-0957 - Added queuemetrics_eq_prepend for custom ENTERQUEUE prepending of a field +# 70302-1111 - Fixed small bug in dialable leads calculation +# 70314-1133 - Added insert selection on script forms +# 70319-1423 - Added Alter Customer Data and agent disable display functions +# 70319-1625 - Added option to allow agents to login to outbound campaigns with no leads in the hopper +# 70322-1455 - Added sipsak messages parameters +# 70402-1157 - Added HOME link and entry to system_settings table, added QM link on reports section +# 70516-1628 - Started reformatting campaigns to use submenus to break up options +# 70529-1653 - Added help for list mix +# 70530-1354 - Added human_answered field to statuses, added system status modification +# 70530-1714 - Added lists for all campaign subsections +# 70531-1631 - Development on List mix admin interface +# 70601-1629 - More development on List mix admin interface, formatting, and added some javascript +# 70602-1300 - More development on List mix admin interface, more javascript +# 70608-1459 - Added option to set LIVE Callbacks to INACTIVE after one month +# 70612-1451 - Added Callback INACTIVE link for after one week, sort by user/group/entrydate +# 70614-0231 - Added Status Categories, ability to Modify Statuses, moved system statuses to sub-section +# 70623-1008 - List Mix section now allows modification of list mix entries +# 70629-1721 - List Mix section adding and removing of list entries active +# 70706-1636 - List Mix section cleanup and more error-checking +# 70908-0941 - Added agc logile enable system_settings +# 71020-1934 - Added inbound groups options: on-hold music, messages, call_times +# 71022-1343 - Added inbound group ranks for users +# 71029-1710 - Added option for campaign to be inbound and/or blended with no restrictions on the campaign_id name +# - Added 5th NEW and 6th NEW to the dial order options +# 71030-2010 - Added Manual Dial List ID field to campaigns table +# 71103-2207 - Added inbound_group_rank and fewest_calls to the inbound groups call order options +# 71113-1521 - Added campaign_rank to agent options +# - Added ability to Copy a campaign's setting to a new campaign +# 71113-2225 - Added ability to copy user and in-group settings to new users and in-groups +# 71116-0942 - Added campaign_rank and fewest_calls as methods for agent call routing +# 71122-1135 - Added default transfer group for campaigns and inbound groups +# 71125-1751 - Added allowable transfer groups to campaign detail screen +# +# +# make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time + +$admin_version = '2.0.4-119'; +$build = '71125-1751'; + +$STARTtime = date("U"); +$SQLdate = date("Y-m-d H:i:s"); +$MT[0]=''; +$US='_'; + +$month_old = mktime(0, 0, 0, date("m")-1, date("d"), date("Y")); +$past_month_date = date("Y-m-d H:i:s",$month_old); +$week_old = mktime(0, 0, 0, date("m"), date("d")-7, date("Y")); +$past_week_date = date("Y-m-d H:i:s",$week_old); + +if ($force_logout) +{ + if( (strlen($PHP_AUTH_USER)>0) or (strlen($PHP_AUTH_PW)>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "You have now logged out. Thank you\n"; + exit; +} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or ($auth<1)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT * from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[3]; + $LOGuser_level =$row[4]; + $LOGuser_group =$row[5]; + $LOGdelete_users =$row[8]; + $LOGdelete_user_groups =$row[9]; + $LOGdelete_lists =$row[10]; + $LOGdelete_campaigns =$row[11]; + $LOGdelete_ingroups =$row[12]; + $LOGdelete_remote_agents =$row[13]; + $LOGload_leads =$row[14]; + $LOGcampaign_detail =$row[15]; + $LOGast_admin_access =$row[16]; + $LOGast_delete_phones =$row[17]; + $LOGdelete_scripts =$row[18]; + $LOGdelete_filters =$row[29]; + $LOGalter_agent_interface =$row[30]; + $LOGdelete_call_times =$row[32]; + $LOGmodify_call_times =$row[33]; + $LOGmodify_users =$row[34]; + $LOGmodify_campaigns =$row[35]; + $LOGmodify_lists =$row[36]; + $LOGmodify_scripts =$row[37]; + $LOGmodify_filters =$row[38]; + $LOGmodify_ingroups =$row[39]; + $LOGmodify_usergroups =$row[40]; + $LOGmodify_remoteagents =$row[41]; + $LOGmodify_servers =$row[42]; + $LOGview_reports =$row[43]; + + $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$LOGuser_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGallowed_campaigns =$row[0]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +###################################################################################################### +###################################################################################################### +####### Header settings +###################################################################################################### +###################################################################################################### + + +header ("Content-type: text/html; charset=utf-8"); +echo "\n"; +echo "\n"; +echo "\n"; +echo "VICIDIAL ADMIN: "; + +if (!isset($ADD)) {$ADD=0;} + +if ($ADD=="1") {$hh='users'; echo "Add New User";} +if ($ADD=="1A") {$hh='users'; echo "Copy User";} +if ($ADD==11) {$hh='campaigns'; $sh='basic'; echo "Add New Campaign";} +if ($ADD==12) {$hh='campaigns'; $sh='basic'; echo "Copy Campaign";} +if ($ADD==111) {$hh='lists'; echo "Add New List";} +if ($ADD==121) {$hh='lists'; echo "Add New DNC";} +if ($ADD==1111) {$hh='ingroups'; echo "Add New In-Group";} +if ($ADD==1211) {$hh='ingroups'; echo "Copy In-Group";} +if ($ADD==11111) {$hh='remoteagent'; echo "Add New Remote Agents";} +if ($ADD==111111) {$hh='usergroups'; echo "Add New Users Group";} +if ($ADD==1111111) {$hh='scripts'; echo "Add New Script";} +if ($ADD==11111111) {$hh='filters'; echo "Add New Filter";} +if ($ADD==111111111) {$hh='admin'; $sh='times'; echo "Add New Call Time";} +if ($ADD==1111111111) {$hh='admin'; $sh='times'; echo "Add New State Call Time";} +if ($ADD==11111111111) {$hh='admin'; $sh='phones'; echo "ADD NEW PHONE";} +if ($ADD==111111111111) {$hh='admin'; $sh='server'; echo "ADD NEW SERVER";} +if ($ADD==1111111111111) {$hh='admin'; $sh='conference'; echo "ADD NEW CONFERENCE";} +if ($ADD==11111111111111) {$hh='admin'; $sh='conference'; echo "ADD NEW VICIDIAL CONFERENCE";} +if ($ADD=="2") {$hh='users'; echo "New User Addition";} +if ($ADD=="2A") {$hh='users'; echo "New Copied User Addition";} +if ($ADD==20) {$hh='campaigns'; $sh='basic'; echo "New Copied Campaign Addition";} +if ($ADD==21) {$hh='campaigns'; $sh='basic'; echo "New Campaign Addition";} +if ($ADD==22) {$hh='campaigns'; $sh='status'; echo "New Campaign Status Addition";} +if ($ADD==23) {$hh='campaigns'; $sh='hotkey'; echo "New Campaign HotKey Addition";} +if ($ADD==25) {$hh='campaigns'; $sh='recycle'; echo "New Campaign Lead Recycle Addition";} +if ($ADD==26) {$hh='campaigns'; $sh='autoalt'; echo "New Auto Alt Dial Status";} +if ($ADD==27) {$hh='campaigns'; $sh='pause'; echo "New Agent Pause Code";} +if ($ADD==28) {$hh='campaigns'; $sh='dialstat'; echo "Campaign Dial Status Added";} +if ($ADD==29) {$hh='campaigns'; $sh='listmix'; echo "Campaign List Mix Added";} +if ($ADD==211) {$hh='lists'; echo "New List Addition";} +if ($ADD==2111) {$hh='ingroups'; echo "New In-Group Addition";} +if ($ADD==2011) {$hh='ingroups'; echo "New Copied In-Group Addition";} +if ($ADD==21111) {$hh='remoteagent'; echo "New Remote Agents Addition";} +if ($ADD==211111) {$hh='usergroups'; echo "New Users Group Addition";} +if ($ADD==2111111) {$hh='scripts'; echo "New Script Addition";} +if ($ADD==21111111) {$hh='filters'; echo "New Filter Addition";} +if ($ADD==211111111) {$hh='admin'; $sh='times'; echo "New Call Time Addition";} +if ($ADD==2111111111) {$hh='admin'; $sh='times'; echo "New State Call Time Addition";} +if ($ADD==21111111111) {$hh='admin'; $sh='phones'; echo "ADDING NEW PHONE";} +if ($ADD==211111111111) {$hh='admin'; $sh='server'; echo "ADDING NEW SERVER";} +if ($ADD==221111111111) {$hh='admin'; $sh='server'; echo "ADDING NEW SERVER VICIDIAL TRUNK RECORD";} +if ($ADD==2111111111111) {$hh='admin'; $sh='conference'; echo "ADDING NEW CONFERENCE";} +if ($ADD==21111111111111) {$hh='admin'; $sh='conference'; echo "ADDING NEW VICIDIAL CONFERENCE";} +if ($ADD==221111111111111) {$hh='admin'; $sh='status'; echo "ADDING VICIDIAL SYSTEM STATUSES";} +if ($ADD==231111111111111) {$hh='admin'; $sh='status'; echo "ADDING VICIDIAL STATUS CATEGORY";} +if ($ADD==3) {$hh='users'; echo "Modify User";} +if ($ADD==30) {$hh='campaigns'; echo "Campaign Not Allowed";} +if ($ADD==31) + { + $hh='campaigns'; $sh='detail'; echo "Modify Campaign - Detail - $campaign_id"; + if ($SUB==22) {echo " - Statuses";} + if ($SUB==23) {echo " - HotKeys";} + if ($SUB==25) {echo " - Lead Recycle Entries";} + if ($SUB==26) {echo " - Auto Alt Dial Statuses";} + if ($SUB==27) {echo " - Agent Pause Codes";} + if ($SUB==29) {echo " - List Mixes";} + } +if ($ADD==32) {$hh='campaigns'; $sh='status'; echo "Campaign Statuses";} +if ($ADD==33) {$hh='campaigns'; $sh='hotkey'; echo "Campaign HotKeys";} +if ($ADD==34) {$hh='campaigns'; $sh='basic'; echo "Modify Campaign - Basic View";} +if ($ADD==35) {$hh='campaigns'; $sh='recycle'; echo "Campaign Lead Recycle Entries";} +if ($ADD==36) {$hh='campaigns'; $sh='autoalt'; echo "Campaign Auto Alt Dial Statuses";} +if ($ADD==37) {$hh='campaigns'; $sh='pause'; echo "Campaign Agent Pause Codes";} +if ($ADD==38) {$hh='campaigns'; $sh='dialstat'; echo "Campaign Dial Statuses";} +if ($ADD==39) {$hh='campaigns'; $sh='listmix'; echo "Campaign List Mixes";} +if ($ADD==311) {$hh='lists'; echo "Modify List";} +if ($ADD==3111) {$hh='ingroups'; echo "Modify In-Group";} +if ($ADD==31111) {$hh='remoteagent'; echo "Modify Remote Agents";} +if ($ADD==311111) {$hh='usergroups'; echo "Modify Users Groups";} +if ($ADD==3111111) {$hh='scripts'; echo "Modify Script";} +if ($ADD==31111111) {$hh='filters'; echo "Modify Filter";} +if ($ADD==311111111) {$hh='admin'; $sh='times'; echo "Modify Call Time";} +if ($ADD==321111111) {$hh='admin'; $sh='times'; echo "Modify Call Time State Definitions List";} +if ($ADD==3111111111) {$hh='admin'; $sh='times'; echo "Modify State Call Time";} +if ($ADD==31111111111) {$hh='admin'; $sh='phones'; echo "MODIFY PHONE";} +if ($ADD==311111111111) {$hh='admin'; $sh='server'; echo "MODIFY SERVER";} +if ($ADD==3111111111111) {$hh='admin'; $sh='conference'; echo "MODIFY CONFERENCE";} +if ($ADD==31111111111111) {$hh='admin'; $sh='conference'; echo "MODIFY VICIDIAL CONFERENCE";} +if ($ADD==311111111111111) {$hh='admin'; $sh='settings'; echo "MODIFY VICIDIAL SYSTEM SETTINGS";} +if ($ADD==321111111111111) {$hh='admin'; $sh='status'; echo "MODIFY VICIDIAL SYSTEM STATUSES";} +if ($ADD==331111111111111) {$hh='admin'; $sh='status'; echo "MODIFY VICIDIAL STATUS CATEGORY";} +if ($ADD=="4A") {$hh='users'; echo "Modify User - Admin";} +if ($ADD=="4B") {$hh='users'; echo "Modify User - Admin";} +if ($ADD==4) {$hh='users'; echo "Modify User";} +if ($ADD==41) {$hh='campaigns'; $sh='detail'; echo "Modify Campaign";} +if ($ADD==42) {$hh='campaigns'; $sh='status'; echo "Modify Campaign Status";} +if ($ADD==43) {$hh='campaigns'; $sh='hotkey'; echo "Modify Campaign HotKey";} +if ($ADD==44) {$hh='campaigns'; $sh='basic'; echo "Modify Campaign - Basic View";} +if ($ADD==45) {$hh='campaigns'; $sh='recycle'; echo "Modify Campaign Lead Recycle";} +if ($ADD==47) {$hh='campaigns'; $sh='pause'; echo "Modify Agent Pause Code";} +if ($ADD==49) {$hh='campaigns'; $sh='listmix'; echo "Modify Campaign List Mix";} +if ($ADD==411) {$hh='lists'; echo "Modify List";} +if ($ADD==4111) {$hh='ingroups'; echo "Modify In-Group";} +if ($ADD==41111) {$hh='remoteagent'; echo "Modify Remote Agents";} +if ($ADD==411111) {$hh='usergroups'; echo "Modify Users Groups";} +if ($ADD==4111111) {$hh='scripts'; echo "Modify Script";} +if ($ADD==41111111) {$hh='filters'; echo "Modify Filter";} +if ($ADD==411111111) {$hh='admin'; $sh='times'; echo "Modify Call Time";} +if ($ADD==4111111111) {$hh='admin'; $sh='times'; echo "Modify State Call Time";} +if ($ADD==41111111111) {$hh='admin'; $sh='phones'; echo "MODIFY PHONE";} +if ($ADD==411111111111) {$hh='admin'; $sh='server'; echo "MODIFY SERVER";} +if ($ADD==421111111111) {$hh='admin'; $sh='server'; echo "MODIFY SERVER VICIDIAL TRUNK RECORD";} +if ($ADD==4111111111111) {$hh='admin'; $sh='conference'; echo "MODIFY CONFERENCE";} +if ($ADD==41111111111111) {$hh='admin'; $sh='conference'; echo "MODIFY VICIDIAL CONFERENCE";} +if ($ADD==411111111111111) {$hh='admin'; $sh='settings'; echo "MODIFY VICIDIAL SYSTEM SETTINGS";} +if ($ADD==421111111111111) {$hh='admin'; $sh='status'; echo "MODIFY VICIDIAL SYSTEM STATUSES";} +if ($ADD==431111111111111) {$hh='admin'; $sh='status'; echo "MODIFY VICIDIAL STATUS CATEGORIES";} +if ($ADD==5) {$hh='users'; echo "Delete User";} +if ($ADD==51) {$hh='campaigns'; $sh='detail'; echo "Delete Campaign";} +if ($ADD==52) {$hh='campaigns'; $sh='detail'; echo "Logout Agents";} +if ($ADD==53) {$hh='campaigns'; $sh='detail'; echo "Emergency VDAC Jam Clear";} +if ($ADD==511) {$hh='lists'; echo "Delete List";} +if ($ADD==5111) {$hh='ingroups'; echo "Delete In-Group";} +if ($ADD==51111) {$hh='remoteagent'; echo "Delete Remote Agents";} +if ($ADD==511111) {$hh='usergroups'; echo "Delete Users Group";} +if ($ADD==5111111) {$hh='scripts'; echo "Delete Script";} +if ($ADD==51111111) {$hh='filters'; echo "Delete Filter";} +if ($ADD==511111111) {$hh='admin'; $sh='times'; echo "Delete Call Time";} +if ($ADD==5111111111) {$hh='admin'; $sh='times'; echo "Delete State Call Time";} +if ($ADD==51111111111) {$hh='admin'; $sh='phones'; echo "DELETE PHONE";} +if ($ADD==511111111111) {$hh='admin'; $sh='server'; echo "DELETE SERVER";} +if ($ADD==5111111111111) {$hh='admin'; $sh='conference'; echo "DELETE CONFERENCE";} +if ($ADD==51111111111111) {$hh='admin'; $sh='conference'; echo "DELETE VICIDIAL CONFERENCE";} +if ($ADD==6) {$hh='users'; echo "Delete User";} +if ($ADD==61) {$hh='campaigns'; $sh='detail'; echo "Delete Campaign";} +if ($ADD==62) {$hh='campaigns'; $sh='detail'; echo "Logout Agents";} +if ($ADD==63) {$hh='campaigns'; $sh='detail'; echo "Emergency VDAC Jam Clear";} +if ($ADD==65) {$hh='campaigns'; $sh='recycle'; echo "Delete Lead Recycle";} +if ($ADD==66) {$hh='campaigns'; $sh='autoalt'; echo "Delete Auto Alt Dial Status";} +if ($ADD==67) {$hh='campaigns'; $sh='pause'; echo "Delete Agent Pause Code";} +if ($ADD==68) {$hh='campaigns'; $sh='dialstat'; echo "Campaign Dial Status Removed";} +if ($ADD==69) {$hh='campaigns'; $sh='listmix'; echo "Campaign List Mix Removed";} +if ($ADD==611) {$hh='lists'; echo "Delete List";} +if ($ADD==6111) {$hh='ingroups'; echo "Delete In-Group";} +if ($ADD==61111) {$hh='remoteagent'; echo "Delete Remote Agents";} +if ($ADD==611111) {$hh='usergroups'; echo "Delete Users Group";} +if ($ADD==6111111) {$hh='scripts'; echo "Delete Script";} +if ($ADD==61111111) {$hh='filters'; echo "Delete Filter";} +if ($ADD==611111111) {$hh='admin'; $sh='times'; echo "Delete Call Time";} +if ($ADD==6111111111) {$hh='admin'; $sh='times'; echo "Delete State Call Time";} +if ($ADD==61111111111) {$hh='admin'; $sh='phones'; echo "DELETE PHONE";} +if ($ADD==611111111111) {$hh='admin'; $sh='server'; echo "DELETE SERVER";} +if ($ADD==621111111111) {$hh='admin'; $sh='server'; echo "DELETE SERVER VICIDIAL TRUNK RECORD";} +if ($ADD==6111111111111) {$hh='admin'; $sh='conference'; echo "DELETE CONFERENCE";} +if ($ADD==61111111111111) {$hh='admin'; $sh='conference'; echo "DELETE VICIDIAL CONFERENCE";} +if ($ADD==73) {$hh='campaigns'; echo "Dialable Lead Count";} +if ($ADD==7111111) {$hh='scripts'; echo "Preview Script";} +if ($ADD==0) {$hh='users'; echo "Users List";} +if ($ADD==8) {$hh='users'; echo "CallBacks Within Agent";} +if ($ADD==81) {$hh='campaigns'; $sh='list'; echo "CallBacks Within Campaign";} +if ($ADD==811) {$hh='lists'; echo "CallBacks Within List";} +if ($ADD==8111) {$hh='usergroups'; echo "CallBacks Within User Group";} +if ($ADD==10) {$hh='campaigns'; $sh='list'; echo "Campaigns";} +if ($ADD==100) {$hh='lists'; echo "Lists";} +if ($ADD==1000) {$hh='ingroups'; echo "In-Groups";} +if ($ADD==10000) {$hh='remoteagent'; echo "Remote Agents";} +if ($ADD==100000) {$hh='usergroups'; echo "User Groups";} +if ($ADD==1000000) {$hh='scripts'; echo "Scripts";} +if ($ADD==10000000) {$hh='filters'; echo "Filters";} +if ($ADD==100000000) {$hh='admin'; $sh='times'; echo "Call Times";} +if ($ADD==1000000000) {$hh='admin'; $sh='times'; echo "State Call Times";} +if ($ADD==10000000000) {$hh='admin'; $sh='phones'; echo "PHONE LIST";} +if ($ADD==100000000000) {$hh='admin'; $sh='server'; echo "SERVER LIST";} +if ($ADD==1000000000000) {$hh='admin'; $sh='conference'; echo "CONFERENCE LIST";} +if ($ADD==10000000000000) {$hh='admin'; $sh='conference'; echo "VICIDIAL CONFERENCE LIST";} +if ($ADD==550) {$hh='users'; echo "Search Form";} +if ($ADD==551) {$hh='users'; echo "SEARCH PHONES";} +if ($ADD==660) {$hh='users'; echo "Search Results";} +if ($ADD==661) {$hh='users'; echo "SEARCH PHONES RESULTS";} +if ($ADD==99999) {$hh='users'; echo "HELP";} +if ($ADD==999999) {$hh='reports'; echo "REPORTS";} + +if ( ($ADD>9) && ($ADD < 99998) ) + { + ##### get scripts listing for dynamic pulldown + $stmt="SELECT script_id,script_name from vicidial_scripts order by script_id"; + $rslt=mysql_query($stmt, $link); + $scripts_to_print = mysql_num_rows($rslt); + $scripts_list="<option value=\"\">NONE</option>\n"; + + $o=0; + while ($scripts_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $scripts_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $scriptname_list["$rowx[0]"] = "$rowx[1]"; + $o++; + } + + ##### get filters listing for dynamic pulldown + $stmt="SELECT lead_filter_id,lead_filter_name,lead_filter_sql from vicidial_lead_filters order by lead_filter_id"; + $rslt=mysql_query($stmt, $link); + $filters_to_print = mysql_num_rows($rslt); + $filters_list="<option value=\"\">NONE</option>\n"; + + $o=0; + while ($filters_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $filters_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $filtername_list["$rowx[0]"] = "$rowx[1]"; + $filtersql_list["$rowx[0]"] = "$rowx[2]"; + $o++; + } + + ##### get call_times listing for dynamic pulldown + $stmt="SELECT call_time_id,call_time_name from vicidial_call_times order by call_time_id"; + $rslt=mysql_query($stmt, $link); + $times_to_print = mysql_num_rows($rslt); + + $o=0; + while ($times_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $call_times_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $call_timename_list["$rowx[0]"] = "$rowx[1]"; + $o++; + } + } + +if ( ( (strlen($ADD)>4) && ($ADD < 99998) ) or ($ADD==3) or (($ADD>20) and ($ADD<70)) or ($ADD=="4A") or ($ADD=="4B") or (strlen($ADD)==12) ) + { + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rslt=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rslt); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $servers_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $o++; + } + + ##### BEGIN get campaigns listing for rankings ##### + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + $campaigns_list=''; + $campaigns_value=''; + $RANKcampaigns_list="<tr><td>CAMPAIGN</td><td>     RANK</td><td>     CALLS</td></tr>\n"; + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $campaigns_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $campaign_id_values[$o] = $rowx[0]; + $campaign_name_values[$o] = $rowx[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + $stmt="SELECT campaign_rank,calls_today from vicidial_campaign_agents where user='$user' and campaign_id='$campaign_id_values[$o]'"; + $rslt=mysql_query($stmt, $link); + $ranks_to_print = mysql_num_rows($rslt); + if ($ranks_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $SELECT_campaign_rank = $row[0]; + $calls_today = $row[1]; + } + else + {$calls_today=0; $SELECT_campaign_rank=0;} + if ( ($ADD=="4A") or ($ADD=="4B") ) + { + if (isset($_GET["RANK_$campaign_id_values[$o]"])) {$campaign_rank=$_GET["RANK_$campaign_id_values[$o]"];} + elseif (isset($_POST["RANK_$campaign_id_values[$o]"])) {$campaign_rank=$_POST["RANK_$campaign_id_values[$o]"];} + + if ($ranks_to_print > 0) + { + $stmt="UPDATE vicidial_campaign_agents set campaign_rank='$campaign_rank', campaign_weight='$campaign_rank' where campaign_id='$campaign_id_values[$o]' and user='$user';"; + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="INSERT INTO vicidial_campaign_agents set campaign_rank='$campaign_rank', campaign_weight='$campaign_rank', campaign_id='$campaign_id_values[$o]', user='$user';"; + $rslt=mysql_query($stmt, $link); + } + + $stmt="UPDATE vicidial_live_agents set campaign_weight='$campaign_rank' where campaign_id='$campaign_id_values[$o]' and user='$user';"; + $rslt=mysql_query($stmt, $link); + } + else {$campaign_rank = $SELECT_campaign_rank;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + # disable non user-group allowable campaign ranks + $stmt="SELECT user_group from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Ruser_group = $row[0]; + + $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$Ruser_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $allowed_campaigns = $row[0]; + $allowed_campaigns = preg_replace("/ -$/","",$allowed_campaigns); + $UGcampaigns = explode(" ", $allowed_campaigns); + + $p=0; $RANK_camp_active=0; $CR_disabled = ''; + if (eregi('-ALL-CAMPAIGNS-',$allowed_campaigns)) + {$RANK_camp_active++;} + else + { + $UGcampaign_ct = count($UGcampaigns); + while ($p < $UGcampaign_ct) + { + if ($campaign_id_values[$o] == $UGcampaigns[$p]) + {$RANK_camp_active++;} + $p++; + } + } + if ($RANK_camp_active < 1) {$CR_disabled = 'DISABLED';} + + $RANKcampaigns_list .= "<tr $bgcolor><td>"; + $campaigns_list .= "<a href=\"$PHP_SELF?ADD=31&campaign_id=$campaign_id_values[$o]\">$campaign_id_values[$o]</a> - $campaign_name_values[$o] <BR>\n"; + $RANKcampaigns_list .= "<a href=\"$PHP_SELF?ADD=31&campaign_id=$campaign_id_values[$o]\">$campaign_id_values[$o]</a> - $campaign_name_values[$o] </td>"; + $RANKcampaigns_list .= "<td>     <select size=1 name=RANK_$campaign_id_values[$o] $CR_disabled>\n"; + $h="9"; + while ($h>=-9) + { + $RANKcampaigns_list .= "<option value=\"$h\""; + if ($h==$campaign_rank) + {$RANKcampaigns_list .= " SELECTED";} + $RANKcampaigns_list .= ">$h</option>"; + $h--; + } + $RANKcampaigns_list .= "</select></td>\n"; + $RANKcampaigns_list .= "<td align=right>     $calls_today</td></tr>\n"; + $o++; + } + ##### END get campaigns listing for rankings ##### + + + ##### BEGIN get inbound groups listing for checkboxes ##### + $xfer_groupsSQL=''; + if ( (($ADD>20) and ($ADD<70)) and ($ADD!=41) ) + { + $stmt="SELECT closer_campaigns,xfer_groups from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + $xfer_groups = $row[1]; + $xfer_groups = preg_replace("/ -$/","",$xfer_groups); + $XFERgroups = explode(" ", $xfer_groups); + $xfer_groupsSQL = preg_replace("/^ | -$/","",$xfer_groups); + $xfer_groupsSQL = preg_replace("/ /","','",$xfer_groupsSQL); + $xfer_groupsSQL = "WHERE group_id IN('$xfer_groupsSQL')"; + } + if ($ADD==41) + { + $p=0; + $XFERgroup_ct = count($XFERgroups); + while ($p < $XFERgroup_ct) + { + $xfer_groups .= " $XFERgroups[$p]"; + $p++; + } + $xfer_groupsSQL = preg_replace("/^ | -$/","",$xfer_groups); + $xfer_groupsSQL = preg_replace("/ /","','",$xfer_groupsSQL); + $xfer_groupsSQL = "WHERE group_id IN('$xfer_groupsSQL')"; + } + + if ( (($ADD==31111) or ($ADD==31111)) and (count($groups)<1) ) + { + $stmt="SELECT closer_campaigns from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + if ($ADD==3) + { + $stmt="SELECT closer_campaigns from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + $stmt="SELECT group_id,group_name from vicidial_inbound_groups order by group_id"; + $rslt=mysql_query($stmt, $link); + $groups_to_print = mysql_num_rows($rslt); + $groups_list=''; + $groups_value=''; + $XFERgroups_list=''; + $RANKgroups_list="<tr><td>INBOUND GROUP</td><td>     RANK</td><td>     CALLS</td></tr>\n"; + + $o=0; + while ($groups_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $group_id_values[$o] = $rowx[0]; + $group_name_values[$o] = $rowx[1]; + $o++; + } + + $o=0; + while ($groups_to_print > $o) + { + $stmt="SELECT group_rank,calls_today from vicidial_inbound_group_agents where user='$user' and group_id='$group_id_values[$o]'"; + $rslt=mysql_query($stmt, $link); + $ranks_to_print = mysql_num_rows($rslt); + if ($ranks_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $SELECT_group_rank = $row[0]; + $calls_today = $row[1]; + } + else + {$calls_today=0; $SELECT_group_rank=0;} + if ( ($ADD=="4A") or ($ADD=="4B") ) + { + if (isset($_GET["RANK_$group_id_values[$o]"])) {$group_rank=$_GET["RANK_$group_id_values[$o]"];} + elseif (isset($_POST["RANK_$group_id_values[$o]"])) {$group_rank=$_POST["RANK_$group_id_values[$o]"];} + + if ($ranks_to_print > 0) + { + $stmt="UPDATE vicidial_inbound_group_agents set group_rank='$group_rank', group_weight='$group_rank' where group_id='$group_id_values[$o]' and user='$user';"; + $rslt=mysql_query($stmt, $link); + } + else + { + $stmt="INSERT INTO vicidial_inbound_group_agents set group_rank='$group_rank', group_weight='$group_rank', group_id='$group_id_values[$o]', user='$user';"; + $rslt=mysql_query($stmt, $link); + } + + $stmt="UPDATE vicidial_live_inbound_agents set group_weight='$group_rank' where group_id='$group_id_values[$o]' and user='$user';"; + $rslt=mysql_query($stmt, $link); + } + else {$group_rank = $SELECT_group_rank;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $groups_list .= "<input type=\"checkbox\" name=\"groups[]\" value=\"$group_id_values[$o]\""; + $XFERgroups_list .= "<input type=\"checkbox\" name=\"XFERgroups[]\" value=\"$group_id_values[$o]\""; + $RANKgroups_list .= "<tr $bgcolor><td><input type=\"checkbox\" name=\"groups[]\" value=\"$group_id_values[$o]\""; + $p=0; + $group_ct = count($groups); + while ($p < $group_ct) + { + if ($group_id_values[$o] == $groups[$p]) + { + $groups_list .= " CHECKED"; + $RANKgroups_list .= " CHECKED"; + $groups_value .= " $group_id_values[$o]"; + } + $p++; + } + $p=0; + $XFERgroup_ct = count($XFERgroups); + while ($p < $XFERgroup_ct) + { + if ($group_id_values[$o] == $XFERgroups[$p]) + { + $XFERgroups_list .= " CHECKED"; + $XFERgroups_value .= " $group_id_values[$o]"; + } + $p++; + } + $groups_list .= "> <a href=\"$PHP_SELF?ADD=3111&group_id=$group_id_values[$o]\">$group_id_values[$o]</a> - $group_name_values[$o] <BR>\n"; + $XFERgroups_list .= "> <a href=\"$PHP_SELF?ADD=3111&group_id=$group_id_values[$o]\">$group_id_values[$o]</a> - $group_name_values[$o] <BR>\n"; + $RANKgroups_list .= "> <a href=\"$PHP_SELF?ADD=3111&group_id=$group_id_values[$o]\">$group_id_values[$o]</a> - $group_name_values[$o] </td>"; + $RANKgroups_list .= "<td>     <select size=1 name=RANK_$group_id_values[$o]>\n"; + $h="9"; + while ($h>=-9) + { + $RANKgroups_list .= "<option value=\"$h\""; + if ($h==$group_rank) + {$RANKgroups_list .= " SELECTED";} + $RANKgroups_list .= ">$h</option>"; + $h--; + } + $RANKgroups_list .= "</select></td>\n"; + $RANKgroups_list .= "<td align=right>     $calls_today</td></tr>\n"; + $o++; + } + if (strlen($groups_value)>2) {$groups_value .= " -";} + if (strlen($XFERgroups_value)>2) {$XFERgroups_value .= " -";} + } + ##### END get inbound groups listing for checkboxes ##### + + + ##### BEGIN get campaigns listing for checkboxes ##### + if ( ($ADD==211111) or ($ADD==311111) or ($ADD==411111) or ($ADD==511111) or ($ADD==611111) ) + { + if ( ($ADD==211111) or ($ADD==311111) or ($ADD==511111) or ($ADD==611111) ) + { + $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$user_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $allowed_campaigns = $row[0]; + $allowed_campaigns = preg_replace("/ -$/","",$allowed_campaigns); + $campaigns = explode(" ", $allowed_campaigns); + } + + $campaigns_value=''; + $campaigns_list='<B><input type="checkbox" name="campaigns[]" value="-ALL-CAMPAIGNS-"'; + $p=0; + while ($p<100) + { + if (eregi('ALL-CAMPAIGNS',$campaigns[$p])) + { + $campaigns_list.=" CHECKED"; + $campaigns_value .= " -ALL-CAMPAIGNS- -"; + } + $p++; + } + $campaigns_list.="> ALL-CAMPAIGNS - USERS CAN VIEW ANY CAMPAIGN</B><BR>\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $campaign_id_value = $rowx[0]; + $campaign_name_value = $rowx[1]; + $campaigns_list .= "<input type=\"checkbox\" name=\"campaigns[]\" value=\"$campaign_id_value\""; + $p=0; + while ($p<100) + { + if ($campaign_id_value == $campaigns[$p]) + { + # echo "<!-- X $p|$campaign_id_value|$campaigns[$p]| -->"; + $campaigns_list .= " CHECKED"; + $campaigns_value .= " $campaign_id_value"; + } + # echo "<!-- O $p|$campaign_id_value|$campaigns[$p]| -->"; + $p++; + } + $campaigns_list .= "> $campaign_id_value - $campaign_name_value<BR>\n"; + $o++; + } + if (strlen($campaigns_value)>2) {$campaigns_value .= " -";} + } + ##### END get campaigns listing for checkboxes ##### + + + if ( (strlen($ADD)==11) or (strlen($ADD)>12) ) + { + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rsltx=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rsltx); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $servers_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; + $o++; + } + } + + + +$NWB = "   <a href=\"javascript:openNewWindow('$PHP_SELF?ADD=99999"; +$NWE = "')\"><IMG SRC=\"help.gif\" WIDTH=20 HEIGHT=20 BORDER=0 ALT=\"HELP\" ALIGN=TOP></A>"; + + +###################################################################################################### +###################################################################################################### +####### 9 series, HELP screen +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=99999 display the HELP SCREENS +###################### + +if ($ADD==99999) +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "
VICIDIAL ADMIN: HELP


\n"; + +?> +VICIDIAL_USERS TABLE

+ +
+User ID - This field is where you put the VICIDIAL users ID number, can be up to 8 digits in length, Must be at least 2 characters in length. + +
+
+
+Password - This field is where you put the VICIDIAL users password. Must be at least 2 characters in length. + +
+
+
+Full Name - This field is where you put the VICIDIAL users full name. Must be at least 2 characters in length. + +
+
+
+User Level - This menu is where you select the VICIDIAL users user level. Must be a level of 1 to log into VICIDIAL, Must be level greater than 2 to log in as a closer, Must be user level 8 or greater to get into admin web section. + +
+
+
+User Group - This menu is where you select the VICIDIAL users group that this user will belong to. This does not have any restrictions at this time, this is just to subdivide users and allow for future features based upon it. + +
+
+
+Phone Login - Here is where you can set a default phone login value for when the user logs into vicidial.php. This value will populate the phone_login automatically when the user logs in with their user-pass-campaign in the vicidial.php login screen. + +
+
+
+Phone Pass - Here is where you can set a default phone pass value for when the user logs into vicidial.php. This value will populate the phone_pass automatically when the user logs in with their user-pass-campaign in the vicidial.php login screen. + +
+
+
+Hot Keys Active - This option if set to 1 allows the user to use the Hot Keys quick-dispositioning function in vicidial.php. + +
+
+
+Agent Choose Ingroups - This option if set to 1 allows the user to choose the ingroups that they will receive calls from when they login to a CLOSER or INBOUND campaign. Otherwise the Manager will need to set this in their user detail screen of the admin page. + +
+
+
+Scheduled Callbacks - This option allows an agent to disposition a call as CALLBK and choose the data and time at which the lead will be re-activated. + +
+
+
+Agent-Only Callbacks - This option allows an agent to set a callback so that they are the only Agent that can call the customer back. This also allows the agent to see their callback listings and call them back any time they want to. + +
+
+
+Agent Call Manual - This option allows an agent to manually enter a new lead into the system and call them. This also allows the calling of any phone number from their vicidial screen and puts that call into their session. Use this option with caution. + +
+
+
+Vicidial Recording - This option can prevent an agent from doing any recordings after they log in to vicidial. This option must be on for vicidial to follow the campaign recording session. + +
+
+
+Vicidial Transfers - This option can prevent an agent from opening the transfer - conference session of vicidial. If this is disabled, the agent cannot third party call or blind transfer any calls. + +
+
+
+Closer Default Blended - This option simply defaults the Blended checkbox on a CLOSER login screen. + +
+
+
+VICIDIAL Recording Override - This option will override whatever the option is in the campaign for recording. DISABLED will not override the campaign recording setting. NEVER will disable recording on the client. ONDEMAND is the default and allows the agent to start and stop recording as needed. ALLCALLS will start recording on the client whenever a call is sent to an agent. ALLFORCE will start recording on the client whenever a call is sent to an agent giving the agent no option to stop recording. For ALLCALLS and ALLFORCE there is an option to use the Recording Delay to cut down on very short recordings and recude system load. + +
+
+
+Campaign Ranks - In this section you can define the rank an agent will have for each campaign. These ranks can be used to allow for preferred call routing when Next Agent Call is set to campaign_rank. + +
+
+
+Inbound Groups - Here is where you select the inbound groups you want to receive calls from if you have selected the CLOSER campaign. You will also be able to set the rank, or skill level, in this section for each of the inbound groups as well as being able to see the number of calls received from each inbound group for this specific agent. Also in this section is the ability to give the agent a rank for each inbound group. These ranks can be used for preferred call routing when that option is selected in the in-group screen. + +
+
+
+Agent Alter Customer Data Override - This option will override whatever the option is in the campaign for altering of customer data. NOT_ACTIVE will use whatever setting is present for the campaign. ALLOW_ALTER will always allow for the agent to alter the customer data, no matter what the campaign setting is. Default is NOT_ACTIVE. + +
+
+
+Alter Agent Interface Options - This option if set to 1 allows the administrative user to modify the Agents interface options in admin.php. + +
+
+
+Delete Users - This option if set to 1 allows the user to delete other users of equal or lesser user level from the system. + +
+
+
+Delete User Groups - This option if set to 1 allows the user to delete user groups from the system. + +
+
+
+Delete Lists - This option if set to 1 allows the user to delete vicidial lists from the system. + +
+
+
+Delete Campaigns - This option if set to 1 allows the user to delete vicidial campaigns from the system. + +
+
+
+Delete In-Groups - This option if set to 1 allows the user to delete vicidial In-Groups from the system. + +
+
+
+Delete Remote Agents - This option if set to 1 allows the user to delete vicidial remote agents from the system. + +
+
+
+Load Leads - This option if set to 1 allows the user to load vicidial leads into the vicidial_list table by way of the web based lead loader. + +
+
+
+Campaign Detail - This option if set to 1 allows the user to view and modify the campaign detail screen elements. + +
+
+
+AGC Admin Access - This option if set to 1 allows the user to login to the astGUIclient admin pages. + +
+
+
+AGC Delete Phones - This option if set to 1 allows the user to delete phone entries in the astGUIclient admin pages. + +
+
+
+Delete Scripts - This option if set to 1 allows the user to delete Campaign scripts in the script modification screen. + +
+
+
+Modify Leads - This option if set to 1 allows the user to modify leads in the admin section lead search results page. + +
+
+
+Change Agent Campaign - This option if set to 1 allows the user to alter the campaign that an agent is logged into while they are logged into it. + +
+
+
+Delete Filters - This option allows the user to be able to delete vicidial lead filters from the system. + +
+
+
+Delete Call Times - This option allows the user to be able to delete vicidial call times records and vicidial state call times records from the system. + +
+
+
+Modify Call Times - This option allows the user to view and modify the call times and state call times records. A user doesn't need this option enabled if they only need to change the call times option on the campaigns screen. + +
+
+
+Modify Sections - These options allow the user to view and modify each sections records. If set to 0, the user will be able to see the section list, but not the detail or modification screen of a record in that section. + +
+
+
+View Reports - This option allows the user to view the VICIDIAL reports. + + + + +



+ +VICIDIAL_CAMPAIGNS TABLE

+
+
+Campaign ID - This is the short name of the campaign, it is not editable after initial submission, cannot contain spaces and must be between 2 and 8 characters in length. + +
+
+
+Campaign Name - This is the description of the campaign, it must be between 6 and 40 characters in length. + +
+
+
+Campaign Description - This is a memo field for the campaign, it is optional and can be a maximum of 255 characters in length. + +
+
+
+Campaign Change Date - This is the last time that the settings for this campaign were modified in any way. + +
+
+
+Last Campaign Login Date - This is the last time that an agent was logged into this campaign. + +
+
+
+Campaign Stats Refresh - This checkbox will allow you to force a vicidial stats refresh, even if the campaign is not active. + +
+
+
+Active - This is where you set the campaign to Active or Inactive. If Inactive, noone can log into it. + +
+
+
+Park Extension - This is where you can customize the on-hold music for VICIDIAL. Make sure the extension is in place in the extensions.conf and that it points to the filename below. + +
+
+
+Park File Name - This is where you can customize the on-hold music for VICIDIAL. Make sure the filename is 10 characters in length or less and that the file is in place in the /var/lib/asterisk/sounds directory. + +
+
+
+Web Form - This is where you can set the custom web page that will be opened when the user clicks on the WEB FORM button. + +
+
+
+Allow Closers - This is where you can set whether the users of this campaign will have the option to send the call to a closer. + +
+
+
+Default Transfer Group - This field is the default In-Group that will be automatically selected when the agent goes to the transfer-conference frame in their agent interface. + +
+
+
+Allowed Transfer Groups - With these checkbox listings you can select the groups that agents in this campaign can transfer calls to. Allow Closers must be enabled for this option to show up. + +
+
+
+Allow Inbound and Blended - This is where you can set whether the users of this campaign will have the option to take inbound calls with this campaign. If you want to do blended inbound and outbound then this must be set to Y. If you only want to do outbound dialing on this campaign set this to N. Default is N. + +
+
+
+Dial Status - This is where you set the statuses that you are wanting to dial on within the lists that are active for the campaign below. To add another status to dial, select it from the drop-down list and click ADD. To remove one of the dial statuses, click on the REMOVE link next to the status you want to remove. + +
+
+
+List Order - This menu is where you select how the leads that match the statuses selected above will be put in the lead hopper: +
  - DOWN: select the first leads loaded into the vicidial_list table +
  - UP: select the last leads loaded into the vicidial_list table +
  - UP PHONE: select the highest phone number and works its way down +
  - DOWN PHONE: select the lowest phone number and works its way up +
  - UP LAST NAME: starts with last names starting with Z and works its way down +
  - DOWN LAST NAME: starts with last names starting with A and works its way up +
  - UP COUNT: starts with most called leads and works its way down +
  - DOWN COUNT: starts with least called leads and works its way up +
  - DOWN COUNT 2nd NEW: starts with least called leads and works its way up inserting a NEW lead in every other lead - Must NOT have NEW selected in the dial statuses +
  - DOWN COUNT 3nd NEW: starts with least called leads and works its way up inserting a NEW lead in every third lead - Must NOT have NEW selected in the dial statuses +
  - DOWN COUNT 4th NEW: starts with least called leads and works its way up inserting a NEW lead in every forth lead - Must NOT have NEW selected in the dial statuses + +
+
+
+Hopper Level - This is how many leads the VDhopper script tries to keep in the vicidial_hopper table for this campaign. If running VDhopper script every minute, make this slightly greater than the number of leads you go through in a minute. + +
+
+
+Lead Filter - This is a method of filtering your leads using a fragment of a SQL query. Use this feature with caution, it is easy to stop dialing accidentally with the slightest alteration to the SQL statement. Default is NONE. + +
+
+
+Force Reset of Hopper - This allows you to wipe out the hopper contents upon form submission. It should be filled again when the VDhopper script runs. + +
+
+
+Dial Method - This field is the way to define how dialing is to take place. If MANUAL then the auto_dial_level will be locked at 0 unless Dial Method is changed. If RATIO then the normal dialing a number of lines for Active agents. ADAPT_HARD_LIMIT will dial predictively up to the dropped percentage and then not allow aggressive dialing once the drop limit is reached until the percentage goes down again. ADAPT_TAPERED allows for running over the dropped percentage in the first half of the shift -as defined by call_time selected for campaign- and gets more strict as the shift goes on. ADAPT_AVERAGE tries to maintain an average or the dropped percentage not imposing hard limits as aggressively as the other two methods. You cannot change the Auto Dial Level if you are in any of the ADAPT dial methods. Only the Dialer can change the dial level when in predictive dialing mode. + +
+
+
+Auto Dial Level - This is where you set how many lines VICIDIAL should use per active agent. zero 0 means auto dialing is off and the agents will click to dial each number. Otherwise VICIDIAL will keep dialing lines equal to active agents multiplied by the dial level to arrive at how many lines this campaign on each server should allow. The ADAPT OVERRIDE checkbox allows you to force a new dial level even though the dial method is in an ADAPT mode. This is useful if there is a dramatic shift in the quality of leads and you want to drastically change the dial_level manually. + +
+
+
+Available Only Tally - This field if set to Y will leave out INCALL and QUEUE status agents when calculating the number of calls to dial when not in MANUAL dial mode. Default is N. + +
+
+
+Drop Percentage Limit - This field is where you set the limit of the percentage of dropped calls you would like while using an adaptive-predictive dial method, not MANUAL or RATIO. + +
+
+
+Maximum Adapt Dial Level - This field is where you set the limit of the limit to the numbr of lines you would like dialed per agent while using an adaptive-predictive dial method, not MANUAL or RATIO. This number can be higher than the Auto Dial Level if your hardware will support it. Value must be a positive number greater than one and can have decimal places Default 3.0. + +
+
+
+Latest Server Time - This field is only used by the ADAPT_TAPERED dial method. You should enter in the hour and minute that you will stop calling on this campaign, 2100 would mean that you will stop dialing this campaign at 9PM server time. This allows the Tapered algorithm to decide how aggressively to dial by how long you have until you will be finished calling. + +
+
+
+Adapt Intensity Modifier - This field is used to adjust the predictive intensity either higher or lower. The higher a positive number you select, the greater the dialer will increase the call pacing when it goes up and the slower the dialer will decrease the call pacing when it goes down. The lower the negative number you select here, the slower the dialer will increase the call pacing and the faster the dialer will lower the call pacing when it goes down. Default is 0. This field is not used by the MANUAL or RATIO dial methods. + +
+
+
+Dial Level Difference Target - This field is used to define whether you want to target having a specific number of agents waiting for calls or calls waiting for agents. For example if you would always like to have on average one agent free to take calls immediately you would set this to -1, if you would like to target always having one call on hold waiting for an agent you would set this to 1. Default is 0. This field is not used by the MANUAL or RATIO dial methods. + +
+
+
+Concurrent Transfers - This setting is used to define the number of calls that can be sent to agents at the same time. It is recommended that this setting is left at AUTO. This field is not used by the MANUAL dial method. + +
+
+
+Auto Alt-Number Dialing - This setting is used to automatically dial alternate number fields while dialing in the RATIO and ADAPT dial methods when there is no contact at the main phone number for a lead, the NA, B, DC and N statuses. This setting is not used by the MANUAL dial method. + +
+
+
+Next Agent Call - This determines which agent receives the next call that is available: +
  - random: orders by the random update value in the vicidial_live_agents table +
  - oldest_call_start: orders by the last time an agent was sent a call. Results in agents receiving about the same number of calls overall. +
  - oldest_call_finish: orders by the last time an agent finished a call. AKA agent waiting longest receives first call. +
  - overall_user_level: orders by the user_level of the agent as defined in the vicidial_users table a higher user_level will receive more calls. +
  - campaign_rank: orders by the rank given to the agent for the campaign. Highest to Lowest. +
  - fewest_calls: orders by the number of calls received by an agent for that specific inbound group. Least calls first. + +
+
+
+Local Call Time - This is where you set during which hours you would like to dial, as determined by the local time in the are in which you are calling. This is controlled by area code and is adjusted for Daylight Savings time if applicable. General Guidelines in the USA for Business to Business is 9am to 5pm and Business to Consumer calls is 9am to 9pm. + +
+
+
+Dial Timeout - If defined, calls that would normally hang up after the timeout defined in extensions.conf would instead timeout at this amount of seconds if it is less than the extensions.conf timeout. This allows for quickly changing dial timeouts from server to server and limiting the effects to a single campaign. If you are having a lot of Answering Machine or Voicemail calls you may want to try changing this value to between 21-26 and see if results improve. + +
+
+
+Dial Prefix - This field allows for more easily changing a path of dialing to go out through a different method without doing a reload in Asterisk. Default is 9 based upon a 91NXXNXXXXXX in the dial plan - extensions.conf. + +
+
+
+Omit Phone Code - This field allows you to leave out the phone_code field while dialing within VICIDIAL. For instance if you are dialing in the UK from the UK you would have 44 in as your phone_code field for all leads, but you just want to dial 10 digits in your dial plan extensions.conf to place calls instead of 44 then 10 digits. Default is N. + +
+
+
+Campaign CallerID - This field allows for the sending of a custom callerid number on the outbound calls. This is the number that would show up on the callerid of the person you are calling. The default is UNKNOWN. If you are using T1 or E1s to dial out this option is only available if you are using PRIs - ISDN T1s or E1s - that have the custom callerid feature turned on, this will not work with Robbed-bit service -RBS- circuits. This will also work through most VOIP -SIP or IAX trunks- providers that allow dynamic outbound callerID. The custom callerID only applies to calls placed for the VICIDIAL campaign directly, any 3rd party calls or transfers will not send the custom callerID. NOTE: Sometimes putting UNKNOWN or PRIVATE in the field will yield the sending of your default callerID number by your carrier with the calls. You may want to test this and put 0000000000 in the callerid field instead if you do not want to send you CallerID. + +
+
+
+Campaign VDAD extension - This field allows for a custom VDAD transfer extension. This allows you to use different VDADtransfer...agi scripts depending upon your campaign. The default transfer AGI - exten 8365 agi-VDADtransfer.agi - just immediately sends the calls on to agents as soon as they are picked up. An additional sample political survey AGI is also now included - 8366 agi-VDADtransferSURVEY.agi - that plays a message to the called person and allows them to make a choice by pressing buttons - effectively pre-screening the lead - . Please note that except for surveys, political calls and charities this form of calling is illegal in the United States. + +
+
+
+Campaign Rec extension - This field allows for a custom recording extension to be used with VICIDIAL. This allows you to use different extensions depending upon how long you want to allow a maximum recording and what type of codec you want to record in. The default exten is 8309 which if you follow the SCRATCH_INSTALL examples will record in the WAV format for upto one hour. Another option included in the examples is 8310 which will record in GSM format for upto one hour. + +
+
+
+Campaign Recording - This menu allows you to choose what level of recording is allowed on this campaign. NEVER will disable recording on the client. ONDEMAND is the default and allows the agent to start and stop recording as needed. ALLCALLS will start recording on the client whenever a call is sent to an agent. ALLFORCE will start recording on the client whenever a call is sent to an agent giving the agent no option to stop recording. For ALLCALLS and ALLFORCE there is an option to use the Recording Delay to cut down on very short recordings and recude system load. + +
+
+
+Campaign Rec Filename - This field allows you to customize the name of the recording when Campaign recording is ONDEMAND or ALLCALLS. The allowed variables are CAMPAIGN CUSTPHONE FULLDATE TINYDATE EPOCH AGENT. The default is FULLDATE_AGENT and would look like this 20051020-103108_6666. Another example is CAMPAIGN_TINYDATE_CUSTPHONE which would look like this TESTCAMP_51020103108_3125551212. 50 char max. + +
+
+
+Recording Delay - For ALLCALLS and ALLFORCE recording only. This setting will delay the starting of the recording on all calls for the number of seconds specified in this field. Default is 0. + +
+
+
+Campaign Script - This menu allows you to choose the script that will appear on the agents screen for this campaign. Select NONE to show no script for this campaign. + +
+
+
+Get Call Launch - This menu allows you to choose whether you want to auto-launch the web-form page in a separate window, auto-switch to the SCRIPT tab or do nothing when a call is sent to the agent for this campaign. + +
+
+
+Answering Machine Message - This field is for entering in an extension to blind transfer calls to when the agent gets an answering machine and clicks on the Answering Machine Message button in the transfer conference frame. You must set this exten up in the dial plan - extensions.conf - and make sure it plays an audio file then hangs up. + +
+
+
+AMD send to vm exten - This menu allows you to define whether a message is left on an answering machine when it is detected. the call will be immediately forwarded to the Answering-Machine-Message extension if AMD is active and it is determined that the call is an answering machine. + +
+
+
+Xfer-Conf DTMF - These four fields allow for you to have two sets of Transfer Conference and DTMF presets. When the call or campaign is loaded, the vicidial.php script will show two buttons on the transfer-conference frame and auto-populate the number-to-dial and the send-dtmf fields when pressed. If you want to allow Consultative Transfers, a fronter to a closer, you can place CXFER as one of the number-to-dial presets and the proper dial string will be sent to do a Local Consultative Transfer, then the agent can just LEAVE-3WAY-CALL and move on to their next call. If you want to allow Blind transfers of customers to a VICIDIAL AGI script for logging or an IVR, then place AXFER in the number-to-dial field. You can also specify an custom extension after the AXFER or CXFER, for instance if you want to do Internal Consultative transfers instead of Local you would put CXFER90009 in the number-to-dial field. + +
+
+
+Agent Alt Num Dialing - This option allows an agent to manually dial the alternate phone number or address3 field after the main number has been called. + +
+
+
+Scheduled Callbacks - This option allows an agent to disposition a call as CALLBK and choose the data and time at which the lead will be re-activated. + +
+
+
+Drop Call Seconds - The number of seconds from the time the customer line is picked up until the call is considered a DROP, only applies to outbound calls. + +
+
+
+Voicemail - If defined, calls that would normally DROP would instead be directed to this voicemail box to hear and leave a message. + +
+
+
+Safe Harbor Message - If set to Y will play a message to customer after the Drop Call Seconds timeout is reached without being transferred to an agent. This setting will override sending to a voicemail box if this is set to Y. + +
+
+
+Safe Harbor Exten - This is the dial plan extension that the desired Safe Harbor audio file is located at on your server. + +
+
+
+Wrap Up Seconds - The number of seconds to force an agent to wait before allowing them to receive or dial another call. The timer begins as soon as an agent hangs up on their customer - or in the case of alternate number dialing when the agent finishes the lead - Default is 0 seconds. If the timer runs out before the agent has dispositioned the call, the agent still will NOT move on to the next call until they select a disposition. + +
+
+
+Wrap Up Message - This is a campaign-specific message to be displayed on the wrap up screen if wrap up seconds is set. + +
+
+
+Use Internal DNC List - This defines whether this campaign is to filter leads against the Internal DNC list. If it is set to Y, the hopper will look for each phone number in the DNC list before placing it in the hopper. If it is in the DNC list then it will change that lead status to DNCL so it cannot be dialed. Default is N. + +
+
+
+Allowed Inbound Groups - For CLOSER campaigns only. Here is where you select the inbound groups you want agents in this CLOSER campaign to be able to take calls from. It is important for BLENDED inbound-outbound campaigns only to select the inbound groups that are used for agents in this campaign. The calls coming into the inbound groups selected here will be counted as active calls for a blended campaign even if all agents in the campaign are not logged in to receive calls from all of those selected inbound groups. + +
+
+
+Agent Pause Codes Active - Allows agents to select a pause code when they click on the PAUSE button in vicidial.php. Pause codes are definable per campaign at the bottom of the campaign view detail screen and they are stored in the vicidial_agent_log table. Default is N. + +
+
+
+Disable Alter Customer Data - If set to Y, does not change any of the customer data record when an agent dispositions the call. Default is N. + +
+
+
+Allow No-Hopper-Leads Logins - If set to Y, allows agents to login to the campaign even if there are no leads loaded into the hopper for that campaign. This function is not needed in CLOSER-type campaigns. Default is N. + +
+
+
+List Order Mix - Overrides the Lead Order and Dial Status fields. Will use the List and status parameters for the selected List Mix entry in the List Mix sub section instead. Default is DISABLED. + +
+
+
+List Mix ID - ID of the list mix. Must be from 2-20 characters in length with no spaces or other special punctuation. + +
+
+
+List Mix Name - Descriptive name of the list mix. Must be from 2-50 characters in length. + +
+
+
+List Mix Detail - The composition of the List Mix entry. Contains the List ID, mix order, percentages and statuses that make up this List Mix. The percentages always have to add up to 100, and the lists all have to be active and set to the campaign for the order mix entry to be Activated. + +
+
+
+List Mix Method - The method of mixing all of the parts of the List Mix Detail together. EVEN_MIX will mix leads from each part interleaved with the other parts, like this 1,2,3,1,2,3,1,2,3. IN_ORDER will put the leads in the order in which they are listed in the List Mix Detail screen 1,1,1,2,2,2,3,3,3. RANDOM will put them in RANDOM order 1,3,2,1,1,3,2,1,3. Default is IN_ORDER. + +
+
+
+Manual Dial List ID - The default list_id to be used when an agent placces a manual call and a new lead record is created in vicidial_list. Default is 999. This field can contain digits only. + + + + +



+ +VICIDIAL_LISTS TABLE

+
+
+List ID - This is the numerical name of the list, it is not editable after initial submission, must contain only numbers and must be between 2 and 8 characters in length. Must be a number greater than 100. + +
+
+
+List Name - This is the description of the list, it must be between 2 and 20 characters in length. + +
+
+
+List Description - This is the memo field for the list, it is optional. + +
+
+
+List Change Date - This is the last time that the settings for this list were modified in any way. + +
+
+
+List Last Call Date - This is the last time that lead was dialed from this list. + +
+
+
+Campaign - This is the campaign that this list belongs to. A list can only be dialed on a single campaign at one time. + +
+
+
+Active - This defines whether the list is to be dialed on or not. + +
+
+
+Reset Lead-Called-Status for this list - This resets all leads in this list to N for "not called since last reset" and means that any lead can now be called if it is the right status as defined in the campaign screen. + +
+
+
+VICIDIAL DNC List - This Do Not Call list contains every lead that has been set to a status of DNC in the system. Through the LISTS - ADD NUMBER TO DNC page you are able to manually add a number to this list so that it will not be called by campaigns that use the internal DNC list. + + + +



+ +VICIDIAL_INBOUND_GROUPS TABLE

+
+
+Group ID - This is the short name of the inbound group, it is not editable after initial submission, must not contain any spaces and must be between 2 and 20 characters in length. + +
+
+
+Group Name - This is the description of the group, it must be between 2 and 30 characters in length. Cannot include dashes, plusses or spaces . + +
+
+
+Group Color - This is the color that displays in the VICIDIAL client app when a call comes in on this group. It must be between 2 and 7 characters long. If this is a hex color definition you must remember to put a # at the beginning of the string or VICIDIAL will not work properly. + +
+
+
+Active - This determines whether this group show up in the selection box when a VICIDIAL agent logs in. + +
+
+
+Web Form - This is the custom address that clicking on the WEB FORM button in VICIDIAL will take you to for calls that come in on this group. + +
+
+
+Next Agent Call - This determines which agent receives the next call that is available: +
  - random: orders by the random update value in the vicidial_live_agents table +
  - oldest_call_start: orders by the last time an agent was sent a call. Results in agents receiving about the same number of calls overall. +
  - oldest_call_finish: orders by the last time an agent finished a call. AKA agent waiting longest receives first call. +
  - overall_user_level: orders by the user_level of the agent as defined in the vicidial_users table a higher user_level will receive more calls. +
  - inbound_group_rank: orders by the rank given to the agent for the specific inbound group. Highest to Lowest. +
  - fewest_calls: orders by the number of calls received by an agent for that specific inbound group. Least calls first. +
  - campaign_rank: orders by the rank given to the agent for the campaign. Highest to Lowest. +
  - fewest_calls_campaign: orders by the number of calls received by an agent for the campaign. Least calls first. +
+
+
+Fronter Display - This field determines whether the inbound VICIDIAL agent would have the fronter name - if there is one - displayed in the Status field when the call comes to the agent. + +
+
+
+Campaign Script - This menu allows you to choose the script that will appear on the agents screen for this campaign. Select NONE to show no script for this campaign. + +
+
+
+Get Call Launch - This menu allows you to choose whether you want to auto-launch the web-form page in a separate window, auto-switch to the SCRIPT tab or do nothing when a call is sent to the agent for this campaign. + +
+
+
+Xfer-Conf DTMF - These four fields allow for you to have two sets of Transfer Conference and DTMF presets. When the call or campaign is loaded, the vicidial.php script will show two buttons on the transfer-conference frame and auto-populate the number-to-dial and the send-dtmf fields when pressed. If you want to allow Consultative Transfers, a fronter to a closer, you can place CXFER as one of the number-to-dial presets and the proper dial string will be sent to do a Local Consultative Transfer, then the agent can just LEAVE-3WAY-CALL and move on to their next call. If you want to allow Blind transfers of customers to a VICIDIAL AGI script for logging or an IVR, then place AXFER in the number-to-dial field. You can also specify an custom extension after the AXFER or CXFER, for instance if you want to do Internal Consultative transfers instead of Local you would put CXFER90009 in the number-to-dial field. + +
+
+
+Drop Call Seconds - The number of seconds from the time the customer line is picked up until the call is considered a DROP, only applies to outbound calls. + +
+
+
+Voicemail - If defined, calls that would normally DROP would instead be directed to this voicemail box to hear and leave a message. + +
+
+
+Drop Message - If set to Y will play a message to customer after the Drop Call Seconds timeout is reached without being transferred to an agent. This setting will override sending to a voicemail box if this is set to Y. + +
+
+
+Drop Exten - This is the dial plan extension that the desired Dropped call audio file is located at on your server. + +
+
+
+Call Time - This is the call time scheme to use for this inbound group. Keep in mind that the time is based on the server time. Default is 24hours. + +
+
+
+After Hours Action - The action to perform if it is after hours as defined in the call time for this inbound group. HANGUP will immediately hangup the call, MESSASGE will play the file in the After Hours Message Filenam field, EXTENSION will send the call to the After Hours Extension in the dialplan and VOICEMAIL will send the call to the voicemail box listed in the After Hours Voicemail field. Default is MESSAGE. + +
+
+
+After Hours Message Filename - The audio file located on the server to be played if the Action is set to MESSAGE. Default is vm-goodbye + +
+
+
+After Hours Extension - The dialplan extension to send the call to if the Action is set to EXTENSION. Default is 8300. + +
+
+
+After Hours Voicemail - The voicemail box to send the call to if the Action is set to VOICEMAIL. + +
+
+
+Welcome Message Filename - The audio file located on the server to be played when the call comes in. If set to ---NONE--- then no message will be played. Default is ---NONE--- + +
+
+
+Music On Hold Context - The music on hold context to use when the customer is placed on hold. Default is default. + +
+
+
+On Hold Prompt Filename - The audio file located on the server to be played at a regular interval when the customer is on hold. Default is generic_hold. This audio file MUST be 9 seconds or less in length. + +
+
+
+On Hold Prompt Interval - The length of time in seconds to wait before playing the on hold prompt. Default is 60. + +
+
+
+Agent Alert Extension - The extension to send into the agent session to announce that a call is coming to the agent. This extension should have a Playback of an audio file. To not use this function set this to X. Default is X. + +
+
+
+Agent Alert Delay - The length of time in milliseconds to wait before sending the call to the agent after playing the on Agent Alert Extension. Default is 1000. + +
+
+
+Default Transfer Group - This field is the default In-Group that will be automatically selected when the agent goes to the transfer-conference frame in their agent interface. + + + +



+ +VICIDIAL_REMOTE_AGENTS TABLE

+
+
+User ID Start - This is the starting User ID that is used when the remote agent entries are inserted into the system. If the Number of Lines is set higher than 1, this number is incremented by one until each line has an entry. Make sure you create a new VICIDIAL user account with a user level of 4 or great if you want them to be able to use the vdremote.php page for remote web access of this account. + +
+
+
+Number of Lines - This defines how many remote agent entries the system creates, and determines how many lines it thinks it can safely send to the number below. + +
+
+
+Server IP - A remote agent entry is only good for one specific server, here is where you select which server you want. + +
+
+
+External Extension - This is the number that you want the calls forwarded to. Make sure that it is a full dial plan number and that if you need a 9 at the beginning you put it in here. Test by dialing this number from a phone on the system. + +
+
+
+Status - Here is where you turn the remote agent on and off. As soon as the agent is Active the system assumes that it can send calls to it. It may take up to 30 seconds once you change the status to Inactive to stop receiving calls. + +
+
+
+Campaign - Here is where you select the campaign that these remote agents will be logged into. Inbound needs to use the CLOSER campaign and select the inbound campaigns below that you want to receive calls from. + +
+
+
+Inbound Groups - Here is where you select the inbound groups you want to receive calls from if you have selected the CLOSER campaign. + + +



+ +VICIDIAL_CAMPAIGN_LISTS

+
+
+The lists within this campaign are listed here, whether they are active is denoted by the Y or N and you can go to the list screen by clicking on the list ID in the first column. + + +



+ +VICIDIAL_CAMPAIGN_STATUSES TABLE

+
+
+Through the use of custom campaign statuses, you can have statuses that only exist for a specific campaign. The Status must be 1-8 characters in length, the description must be 2-30 characters in length and Selectable defines whether it shows up in VICIDIAL as a disposition. The human_answered field is used when calculating the drop percentage, or abandon rate. Setting human_answered to Y will use this status when counting the human-answered calls. The Category option allows you to group several statuses into a catogy that can be used for statistical analysis. + + + +



+ +VICIDIAL_CAMPAIGN_HOTKEYS TABLE

+
+
+Through the use of custom campaign hot keys, agents that use the vicidial web-client can hang up and disposition calls just by pressing a single key on their keyboard. There are two special HotKey options that you can use in conjunction with Alternate Phone number dialing, ALTPH2 - Alternate Phone Hot Dial and ADDR3-----Address3 Hot Dial allow an agent to use a hotkey to hang up their call, stay on the same lead, and dial another contact number from that lead. + + + + + +



+ +VICIDIAL_LEAD_RECYCLE TABLE

+
+
+Through the use of lead recycling, you can call specific statuses of leads again at a specified interval without resetting the entire list. Lead recycling is campaign-specific and does not have to be a selected dialable status in your campaign. The attempt delay field is the number of seconds until the lead can be placed back in the hopper, this number must be at least 120 seconds. The attempt maximum field is the maximum number of times that a lead of this status can be attempted before the list needs to be reset, this number can be from 1 to 10. You can activate and deactivate a lead recycle entry with the provided links. + + + + + +



+ +VICIDIAL AUTO ALT DIAL STATUSES

+
+
+If the Auto Alt-Number Dialing field is set, then the leads that are dispositioned under these auto alt dial statuses will have their alt_phone and-or address3 fields dialed after any of these no-answer statuses are set. + + + + + +



+ +VICIDIAL AGENT PAUSE CODES

+
+
+If the Agent Pause Codes Active field is set to active then the agents will be able to select from these pause codes when they click on the PAUSE button on their screens. This data is then stored in the vicidial agent log. The Pause code must contain only letters and numbers and be less than 7 characters long. The pause code name can be no longer than 30 characters. + + + + + +



+ +VICIDIAL_USER_GROUPS TABLE

+
+
+User Group - This is the short name of a Vicidial User group, try not to use any spaces or punctuation for this field. max 20 characters, minimum of 2 characters. + +
+
+
+Group Name - This is the description of the vicidial user group max of 40 characters. + +
+
+
+Allowed Campaigns - This is a selectable list of Campaigns to which members of this user group can log in to. The ALL-CAMPAIGNS option allows the users in this group to see and log in to any campaign on the system. + + + + + +



+ +VICIDIAL_SCRIPTS TABLE

+
+
+Script ID - This is the short name of a Vicidial Script. This needs to be a unique identifier. Try not to use any spaces or punctuation for this field. max 10 characters, minimum of 2 characters. + +
+
+Script Name - This is the title of a Vicidial Script. This is a short summary of the script. max 50 characters, minimum of 2 characters. There should be no spaces or punctuation of any kind in theis field. + +
+
+Script Comments - This is where you can place comments for a Vicidial Script such as -changed to free upgrade on Sept 23-. max 255 characters, minimum of 2 characters. + +
+
+Script Text - This is where you place the content of a Vicidial Script. Minimum of 2 characters. You can have customer information be auto-populated in this script using "--A--field--B--" where field is one of the following fieldnames: vendor_lead_code, source_id, list_id, gmt_offset_now, called_since_last_reset, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments, lead_id, campaign, phone_login, group, channel_group, SQLdate, epoch, uniqueid, customer_zap_channel, server_ip, SIPexten, session_id. For example, this sentence would print the persons name in it----

Hello, can I speak with --A--first_name--B-- --A--last_name--B-- please? Well hello --A--title--B-- --A--last_name--B-- how are you today?

This would read----

Hello, can I speak with John Doe please? Well hello Mr. Doe how are you today?

You can also use an iframe to load a separate window within the SCRIPT tab, here is an example with prepopulated variables: + +
+<iframe src="http://astguiclient.sf.net/test_VICIDIAL_output.php?lead_id=--A--lead_id--B--&vendor_id=--A--vendor_lead_code--B--&list_id=--A--list_id--B--&gmt_offset_now=--A--gmt_offset_now--B--&phone_code=--A--phone_code--B--&phone_number=--A--phone_number--B--&title=--A--title--B--&first_name=--A--first_name--B--&middle_initial=--A--middle_initial--B--&last_name=--A--last_name--B--&address1=--A--address1--B--&address2=--A--address2--B--&address3=--A--address3--B--&city=--A--city--B--&state=--A--state--B--&province=--A--province--B--&postal_code=--A--postal_code--B--&country_code=--A--country_code--B--&gender=--A--gender--B--&date_of_birth=--A--date_of_birth--B--&alt_phone=--A--alt_phone--B--&email=--A--email--B--&security_phrase=--A--security_phrase--B--&comments=--A--comments--B--&user=--A--user--B--&campaign=--A--campaign--B--&phone_login=--A--phone_login--B--&fronter=--A--fronter--B--&closer=--A--user--B--&group=--A--group--B--&channel_group=--A--group--B--&SQLdate=--A--SQLdate--B--&epoch=--A--epoch--B--&uniqueid=--A--uniqueid--B--&customer_zap_channel=--A--customer_zap_channel--B--&server_ip=--A--server_ip--B--&SIPexten=--A--SIPexten--B--&session_id=--A--session_id--B--&phone=--A--phone--B--" style="width:580;height:290;background-color:transparent;" scrolling="auto" frameborder="0" allowtransparency="true" id="popupFrame" name="popupFrame" width="460" height="290" STYLE="z-index:17"> +</iframe> +
+ +
+
+
+Active - This determines whether this script can be selected to be used by a campaign. + + + + + +



+ +VICIDIAL_LEAD_FILTERS TABLE

+
+
+Filter ID - This is the short name of a Vicidial Lead Filter. This needs to be a unique identifier. Do not use any spaces or punctuation for this field. max 10 characters, minimum of 2 characters. + +
+
+Filter Name - This is a more descriptive name of the Filter. This is a short summary of the filter. max 30 characters, minimum of 2 characters. + +
+
+Filter Comments - This is where you can place comments for a Vicidial Filter such as -calls all California leads-. max 255 characters, minimum of 2 characters. + +
+
+Filter SQL - This is where you place the SQL query fragment that you want to filter by. do not begin or end with an AND, that will be added by the hopper cron script automatically. an example SQL query that would work here is- called_count > 4 and called_count < 8 -. + + + + + +



+ +VICIDIAL_CALL TIMES TABLE

+
+
+Call Time ID - This is the short name of a Vicidial Call Time Definition. This needs to be a unique identifier. Do not use any spaces or punctuation for this field. max 10 characters, minimum of 2 characters. + +
+
+Call Time Name - This is a more descriptive name of the Call Time Definition. This is a short summary of the Call Time definition. max 30 characters, minimum of 2 characters. + +
+
+Call Time Comments - This is where you can place comments for a Vicidial Call Time Definition such as -10am to 4pm with extra call state restrictions-. max 255 characters. + +
+
+Default Start and Stop Times - This is the default time that calling will be allowed to be started or stopped within this call time definition if the day-of-the-week start time is not defined. 0 is midnight. To prevent calling completely set this field to 2400 and set the Default Stop time to 2400. To allow calling 24 hours a day set the start time to 0 and the stop time to 2400. + +
+
+Weekday Start and Stop Times - These are the custom times per day that can be set for the call time definition. same rules apply as with the Default start and stop times. + +
+
+State Call Time Definitions - This is the list of State specific call time definitions that are followed in this Call Time Definition. + +
+
+State Call Time State - This is the two letter code for the state that this calling time definition is for. For this to be in effect the local call time that is set in the campaign must have this state call time record in it as well as all of the leads having two letter state codes in them. + + + + +



+ +VICIDIAL LIST LOADER FUNCTIONALITY

+
+
+The VICIDIAL basic web-based lead loader is designed simply to take a lead file - up to 8MB in size - that is either tab or pipe delimited and load it into the vicidial_list table. The lead loader allows for field choosing and TXT- Plain Text, CSV- Comma Separated Values and XLS- Excel file formats. The lead loader does not do data validation, but it does allow you to check for duplicates in itself, within the campaign or within the entire system. Also, make sure that you have created the list that these leads are to be under so that you can use them. Here is a list of the fields in their proper order for the lead files: +
    +
  1. Vendor Lead Code - shows up in the Vendor ID field of the GUI +
  2. Source Code - internal use only for admins and DBAs +
  3. List ID - the list number that these leads will show up under +
  4. Phone Code - the prefix for the phone number - 1 for US, 01144 for UK, 01161 for AUS, etc +
  5. Phone Number - must be at least 8 digits long +
  6. Title - title of the customer - Mr. Ms. Mrs, etc... +
  7. First Name +
  8. Middle Initial +
  9. Last Name +
  10. Address Line 1 +
  11. Address Line 2 +
  12. Address Line 3 +
  13. City +
  14. State - limited to 2 characters +
  15. Province +
  16. Postal Code +
  17. Country +
  18. Gender +
  19. Date of Birth +
  20. Alternate Phone Number +
  21. Email Address +
  22. Security Phrase +
  23. Comments +
+ +
NOTES: The Excel Lead loader functionality is enabled by a series of perl scripts and needs to have a properly configured /etc/astguiclient.conf file in place on the web server. Also, a couple perl modules must be loaded for it to work as well - OLE-Storage_Lite and Spreadsheet-ParseExcel. You can check for runtime errors in these by looking at your apache error_log file. Also, for duplication checks against gampaign lists, the list that has new leads going into it does need to be created in the system before you start to load the leads. + + + + +



+ + + + + + +PHONES TABLE

+
+
+Phone extension - This field is where you put the phones name as it appears to Asterisk not including the protocol or slash at the beginning. For Example: for the SIP phone SIP/test101 the Phone extension would be test101. Also, for IAX2 phones make sure you use the full phones name: IAX2/IAXphone1@IAXphone1 would be IAXphone1@IAXphone1. For Zap phones make sure you put the full channel: Zap/25-1 would be 25-1. Another note, make sure you set the Protocol below correctly for your type of phone. + +
+
+
+Dial Plan Number - This field is for the number you dial to have the phone ring. This number is defined in the extensions.conf file of your Asterisk server + +
+
+
+Voicemail Box - This field is for the voicemail box that the messages go to for the user of this phone. We use this to check for voicemail messages and for the user to be able to use the VOICEMAIL button on astGUIclient app. + +
+
+
+Outbound CallerID - This field is where you would enter the callerID number that you would like to appear on outbound calls placed form the astguiclient web-client. This does not work on RBS, non-PRI, T1/E1s. + +
+
+
+Phone IP address - This field is for the phone's IP address if it is a VOIP phone. This is an optional field + +
+
+
+Computer IP address - This field is for the user's computer IP address. This is an optional field + +
+
+
+Server IP - This menu is where you select which server the phone is active on. + +
+
+
+Login - The login used for the phone user to login to the client applications. + +
+
+
+Password - The password used for the phone user to login to the client applications. + +
+
+
+Status - The status of the phone in the system, ACTIVE and ADMIN allow for GUI clients to work. ADMIN allows access to this administrative web site. All other statuses do not allow GUI or Admin web access. + +
+
+
+Active Account - Whether the phone is active to put it in the list in the GUI client. + +
+
+
+Phone Type - Purely for administrative notes. + +
+
+
+Full Name - Used by the GUIclient in the list of active phones. + +
+
+
+Company - Purely for administrative notes. + +
+
+
+Picture - Not yet Implemented. + +
+
+
+New Messages - Number of new voicemail messages for this phone on the Asterisk server. + +
+
+
+Old Messages - Number of old voicemail messages for this phone on the Asterisk server. + +
+
+
+Client Protocol - The protocol that the phone uses to connect to the Asterisk server: SIP, IAX2, Zap . Also, there is EXTERNAL for remote dial numbers or speed dial numbers that you want to list as phones. + +
+
+
+Local GMT - The difference from Greenwich Mean time, or ZULU time where the phone is located. DO NOT ADJUST FOR DAYLIGHT SAVINGS TIME. This is used by the VICIDIAL campaign to accurately display the time and customer time. + +
+
+
+Manager Login - This is the login that the GUI clients for this phone will use to access the Database where the server data resides. + +
+
+
+Manager Secret - This is the password that the GUI clients for this phone will use to access the Database where the server data resides. + +
+
+
+VICIDIAL Default User - This is to place a default value in the VICIDIAL user field whenever this phone user opens the astVICIDIAL client app. Leave blank for no user. + +
+
+
+VICIDIAL Default Pass - This is to place a default value in the VICIDIAL password field whenever this phone user opens the astVICIDIAL client app. Leave blank for no pass. + +
+
+
+VICIDIAL Default Campaign - This is to place a default value in the VICIDIAL campaign field whenever this phone user opens the astVICIDIAL client app. Leave blank for no campaign. + +
+
+
+Park Exten - This is the default Parking extension for the client apps. Verify that a different one works before you change this. + +
+
+
+Conf Exten - This is the default Conference park extension for the client apps. Verify that a different one works before you change this. + +
+
+
+VICIDIAL Park Exten - This is the default Parking extension for VICIDIAL client app. Verify that a different one works before you change this. + +
+
+
+VICIDIAL Park File - This is the default VICIDIAL park extension file name for the client apps. Verify that a different one works before you change this. limited to 10 characters. + +
+
+
+Monitor Prefix - This is the dial plan prefix for monitoring of Zap channels automatically within the astGUIclient app. Only change according to the extensions.conf ZapBarge extensions records. + +
+
+
+Recording Exten - This is the dial plan extension for the recording extension that is used to drop into meetme conferences to record them. It usually lasts upto one hour if not stopped. verify with extensions.conf file before changing. + +
+
+
+VMAIL Main Exten - This is the dial plan extension going to check your voicemail. verify with extensions.conf file before changing. + +
+
+
+VMAIL Dump Exten - This is the dial plan prefix used to send calls directly to a user's voicemail from a live call in the astGUIclient app. verify with extensions.conf file before changing. + +
+
+
+Exten Context - This is the dial plan context that this phone primarily uses. It is assumed that all numbers dialed by the client apps are using this context so it is a good idea to make sure this is the most wide context possible. verify with extensions.conf file before changing. + +
+
+
+DTMF send Channel - This is the channel string used to send DTMF sounds into meetme conferences from the client apps. Verify the exten and context with the extensions.conf file. + +
+
+
+Outbound Call Group - This is the channel group that outbound calls from this phone are placed out of. There are a couple routines in the client apps that use this. For Zap channels you want to use something like Zap/g2 , for IAX2 trunks you would want to use the full IAX prefix like IAX2/VICItest1:secret@10.10.10.15:4569. Verify the trunks with the extensions.conf file, it is usually what you have defined as the TRUNK global variable at the top of the file. + +
+
+
+Browser Location - This is applicable to only UNIX/LINUX clients, the absolute path to Mozilla or Firefox browser on the machine. verify this by launching it manually. + +
+
+
+Install Directory - This is the place where the astGUIclient and astVICIDIAL scripts are located on your machine. For Win32 it should be something like C:\AST_VICI and for UNIX it should be something like /usr/local/perl_TK. verify this manually. + +
+
+
+CallerID URL - This is the web address of the page used to do custom callerID lookups. default testing address is: http://astguiclient.sf.net/test_callerid_output.php + +
+
+
+VICIDIAL Default URL - This is the web address of the page used to do custom VICIDIAL Web Form queries. default testing address is: http://astguiclient.sf.net/test_VICIDIAL_output.php + +
+
+
+Call Logging - This is set to true if the call_log.agi file is in place in the extensions.conf file for all outbound and hang up 'h' extensions to log all calls. This should always be 1 because it is manditory for many astGUIclient and VICIDIAL features to work properly. + +
+
+
+User Switching - Set to true to allow user to switch to another user account. NOTE: If user switches they can initiate recording on the new user's phone conversation + +
+
+
+Conferencing - Set to true to allow user to start conference calls with upto six external lines. + +
+
+
+Admin Hang Up - Set to true to allow user to be able to hang up any line at will through astGUIclient. Good idea only to enable this for Admin users. + +
+
+
+Admin Hijack - Set to true to allow user to be able to grab and redirect to their extension any line at will through astGUIclient. Good idea only to enable this for Admin users. But is very useful for Managers. + +
+
+
+Admin Monitor - Set to true to allow user to be able to grab and redirect to their extension any line at will through astGUIclient. Good idea only to enable this for Admin users. But is very useful for Managers and as a training tool. + +
+
+
+Call Park - Set to true to allow user to be able to park calls on astGUIclient hold to be picked up by any other astGUIclient user on the system. Calls stay on hold for upto a half hour then hang up. Usually enabled for all. + +
+
+
+Updater Check - Set to true to display a popup warning that the updater time has not changed in 20 seconds. Useful for Admin users. + +
+
+
+AF Logging - Set to true to log many actions of astGUIclient usage to a text file on the user's computer. + +
+
+
+Queue Enabled - Set to true to have client apps use the Asterisk Central Queue system. Required for VICIDIAL and recommended for all users. + +
+
+
+CallerID Popup - Set to true to allow for numbers defined in the extensions.conf file to send CallerID popup screens to astGUIclient users. + +
+
+
+VMail Button - Set to true to display the VOICEMAIL button and the messages count display on astGUIclient. + +
+
+
+Fast Refresh - Set to true to enable a new rate of refresh of call information for the astGUIclient. Default disabled rate is 1000 ms ,1 second. Can increase system load if you lower this number. + +
+
+
+Fast Refresh Rate - in milliseconds. Only used if Fast Refresh is enabled. Default disabled rate is 1000 ms ,1 second. Can increase system load if you lower this number. + +
+
+
+Persistant MySQL - If enabled the astGUIclient connection will remain connected instead of connecting every second. Useful if you have a fast refresh rate set. It will increase the number of connections on your MySQL machine. + +
+
+
+Auto Dial Next Number - If enabled the VICIDIAL client will dial the next number on the list automatically upon disposition of a call unless they selected to "Stop Dialing" on the disposition screen. + +
+
+
+Stop Rec after each call - If enabled the VICIDIAL client will stop whatever recording is going on after each call has been dispositioned. Useful if you are doing a lot of recording or you are using a web form to trigger recording. + +
+
+
+Enable SIPSAK Messages - If enabled the server will send messages to the SIP phone to display on the phone LCD display when logged into VICIDIAL. Feature only works with SIP phones and requires sipsak application to be installed on the web server. Default is 0. + +
+
+
+DBX Server - The MySQL database server that this user should be connecting to. + +
+
+
+DBX Database - The MySQL database that this user should be connecting to. Default is asterisk. + +
+
+
+DBX User - The MySQL user login that this user should be using when connecting. Default is cron. + +
+
+
+DBX Pass - The MySQL user password that this user should be using when connecting. Default is 1234. + +
+
+
+DBX Port - The MySQL TCP port that this user should be using when connecting. Default is 3306. + +
+
+
+DBY Server - The MySQL database server that this user should be connecting to. Secondary server, not used currently. + +
+
+
+DBY Database - The MySQL database that this user should be connecting to. Default is asterisk. Secondary server, not used currently. + +
+
+
+DBY User - The MySQL user login that this user should be using when connecting. Default is cron. Secondary server, not used currently. + +
+
+
+DBY Pass - The MySQL user password that this user should be using when connecting. Default is 1234. Secondary server, not used currently. + +
+
+
+DBY Port - The MySQL TCP port that this user should be using when connecting. Default is 3306. Secondary server, not used currently. + + +



+ +SERVERS TABLE

+
+
+Server ID - This field is where you put the Asterisk servers name, doesnt have to be an official domain sub, just a nickname to identify the server to Admin users. + +
+
+
+Server Description - The field where you use a small phrase to describe the Asterisk server. + +
+
+
+Server IP Address - The field where you put the Network IP address of the Asterisk server. + +
+
+
+Active - Set whether the Asterisk server is active or inactive. + +
+
+
+Asterisk Version - Set the version of Asterisk that you have installed on this server. Examples: '1.2', '1.0.8', '1.0.7', 'CVS_HEAD', 'REALLY OLD', etc... This is used because versions 1.0.8 and 1.0.9 have a different method of dealing with Local/ channels, a bug that has been fixed in CVS v1.0, and need to be treated differently when handling their Local/ channels. Also, current CVS_HEAD and the 1.2 release tree uses different manager and command output so it must be treated differently as well. + +
+
+
+Max VICIDIAL Trunks - This field will determine the maximum number of lines that the VICIDIAL auto-dialer will attempt to call on this server. If you want to dedicate two full PRI T1s to VICIDIALing on a server then you would set this to 46. Default is 96. + +
+
+
+Telnet Host - This is the address or name of the Asterisk server and is how the manager applications connect to it from where they are running. If they are running on the Asterisk server, then the default of 'localhost' is fine. + +
+
+
+Telnet Port - This is the port of the Asterisk server Manager connection and is how the manager applications connect to it from where they are running. The default of '5038' is fine for a standard install. + +
+
+
+Manager User - The username or login used to connect genericly to the Asterisk server manager. Default is 'cron' + +
+
+
+Manager Secret - The secret or password used to connect genericly to the Asterisk server manager. Default is '1234' + +
+
+
+Manager Update User - The username or login used to connect to the Asterisk server manager optimized for the Update scripts. Default is 'updatecron' and assumes the same secret as the generic user. + +
+
+
+Manager Listen User - The username or login used to connect to the Asterisk server manager optimized for scripts that only listen for output. Default is 'listencron' and assumes the same secret as the generic user. + +
+
+
+Manager Send User - The username or login used to connect to the Asterisk server manager optimized for scripts that only send Actions to the manager. Default is 'sendcron' and assumes the same secret as the generic user. + +
+
+
+Server GMT offset - The difference in hours from GMT time not adjusted for Daylight-Savings-Time of the server. Default is '-5' + +
+
+
+VMail Dump Exten - The extension prefix used on this server to send calls directly through agc to a specific voicemail box. Default is '85026666666666' + +
+
+
+VICIDIAL AD extension - The default extension if none is present in the campaign to send calls to for VICIDIAL auto dialing. Default is '8365' + +
+
+
+Default Context - The default dial plan context used for scripts that operate for this server. Default is 'default' + +
+
+
+System Performance - Setting this option to Y will enable logging of system performance stats for the server machine including system load, system processes and Asterisk channels in use. Default is N. + +
+
+
+Server Logs - Setting this option to Y will enable logging of all VICIDIAL related scripts to their text log files. Setting this to N will stop writing logs to files for these processes, also the screen logging of asterisk will be disabled if this is set to N when Asterisk is started. Default is Y. + +
+
+
+AGI Output - Setting this option to NONE will disable output from all VICIDIAL related AGI scripts. Setting this to STDERR will send the AGI output to the Asterisk CLI. Setting this to FILE will send the output to a file in the logs directory. Setting this to BOTH will send output to both the Asterisk CLI and a log file. Default is FILE. + +
+
+
+VICIDIAL Balance Dialing - Setting this field to Y will allow the server to place balance calls for campaigns in VICIDIAL so that the defined dial level can be met even if there are no agents logged into that campaign on this server. Default is N. + +
+
+
+VICIDIAL Balance Offlimits - This setting defines the number of trunks to not allow VICIDIAL balance dialing to use. For example if you have 40 max vicidial trunks and balance offlimits is set to 10 you will only be able to use 30 trunk lines for VICIDIAL balance dialing. Default is 0. + + +



+ +CONFERENCES TABLE

+
+
+Conference Number - This field is where you put the meetme conference dialpna number. It is also recommended that the meetme number in meetme.conf matches this number for each entry. This is for the conferences in astGUIclient and is used for leave-3way-call functionality in VICIDIAL. + +
+
+
+Server IP - The menu where you select the Asterisk server that this conference will be on. + + + + +



+ +VICIDIAL_SERVER_TRUNKS TABLE

+
+
+VICIDIAL Server Trunks allows you to restrict the outgoing lines that are used on this server for campaign dialing on a per-campaign basis. You have the option to reserve a specific number of lines to be used by only one campaign as well as allowing that campaign to run over its reserved lines into whatever lines remain open, as long at the total lines used by vicidial on this server is less than the Max VICIDIAL Trunks setting. Not having any of these records will allow the campaign that dials the line first to have as many lines as it can get under the Max VICIDIAL Trunks setting. + + + + + +



+ +SYSTEM_SETTINGS TABLE

+
+
+Use Non-Latin - This option allows you to default the web display script to use UTF8 characters and not do any latin-character-family regular expression filtering or display formatting. Default is 0. + +
+
+
+Webroot Writable - This setting allows you to define whether temp files and authentication files should be placed in the webroot on your web server. Default is 1. + +
+
+
+Enable QueueMetrics Logging - This setting allows you to define whether VICIDIAL will insert log entries into the queue_log database table as Asterisk Queues activity does. QueueMetrics is a standalone, closed-source statistical analysis program. You must have QueueMetrics already installed and configured before enabling this feature. Default is 0. + +
+
+
+QueueMetrics Server IP - This is the IP address of the database for your QueueMetrics installation. + +
+
+
+QueueMetrics Database Name - This is the database name for your QueueMetrics database. + +
+
+
+QueueMetrics Database Login - This is the user name used to log in to your QueueMetrics database. + +
+
+
+QueueMetrics Database Password - This is the password used to log in to your QueueMetrics database. + +
+
+
+QueueMetrics URL - This is the URL or web site address used to get to your QueueMetrics installation. + +
+
+
+QueueMetrics Log ID - This is the server ID that all VICIDIAL logs going into the QueueMetrics database will use as an identifier for each record. + +
+
+
+QueueMetrics EnterQueue Prepend - This field is used to allow for prepending of one of the vicidial_list data fields in front of the phone number of the customer for customized QueueMetrics reports. Default is NONE to not populate anything. + +
+
+
+VICIDIAL Agent Disable Display - This field is used to select when to show an agent when their session has been disabled by the system, a manager action or by an external measure. The NOT_ACTIVE setting will disable the message on the agents screen. The LIVE_AGENT setting will only display the disabled message when the agents vicidial_auto_calls record has been removed, such as during a force logout or emergency logout. + +
+
+
+Allow SIPSAK Messages - If set to 1, this will allow the phones table setting to work properly, the server will send messages to the SIP phone to display on the phone LCD display when logged into VICIDIAL. This feature only works with SIP phones and requires sipsak application to be installed on the web server. Default is 0. + +
+
+
+Admin Home URL - This is the URL or web site address that you will go to if you click on the HOME link at the top of the admin.php page. + +
+
+
+Enable Agent Transfer Logfile - This option will log to a text logfile on the webserver every time a call is transferred to an agent. Default is 0, disabled. + + + + + +



+ +VICIDIAL_STATUSES TABLE

+
+
+Through the use of system statuses, you can have statuses that exist for campaign and in-group. The Status must be 1-6 characters in length, the description must be 2-30 characters in length and Selectable defines whether it shows up in VICIDIAL as an agent disposition. The human_answered field is used when calculating the drop percentage, or abandon rate. Setting human_answered to Y will use this status when counting the human-answered calls. The Category option allows you to group several statuses into a catogy that can be used for statistical analysis. + + +



+ +VICIDIAL_STATUS_CATEGORIES TABLE

+
+
+Through the use of system status categories, you can group together statuses to allow for statistical analysis on a group of statuses. The Category ID must be 2-20 characters in length with no spaces, the name must be 2-50 characters in length, the description is optional and TimeonVDAD Display defines whether that status will be one of the upto 4 statuses that can be calculated and displayed on the Time On VDAD Real-Time report. + + + + +







+







+THE END +
+\n"; + echo "\n"; + echo "\n"; + echo ""; + + $stmt="SELECT dial_statuses,local_call_time,lead_filter_id from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $dial_statuses = $row[0]; + $local_call_time = $row[1]; + if ($lead_filter_id=='') + { + $lead_filter_id = $row[2]; + if ($lead_filter_id=='') + { + $lead_filter_id='NONE'; + } + } + + $stmt="SELECT list_id,active,list_name from vicidial_lists where campaign_id='$campaign_id'"; + $rslt=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rslt); + $camp_lists=''; + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + if (ereg("Y", $rowx[1])) {$camp_lists .= "'$rowx[0]',";} + } + $camp_lists = eregi_replace(".$","",$camp_lists); + + $filterSQL = $filtersql_list[$lead_filter_id]; + $filterSQL = eregi_replace("^and|and$|^or|or$","",$filterSQL); + if (strlen($filterSQL)>4) + {$fSQL = "and $filterSQL";} + else + {$fSQL = '';} + + + echo "

\n"; + echo "Show Dialable Leads Count -

\n"; + echo "CAMPAIGN: $campaign_id
\n"; + echo "LISTS: $camp_lists
\n"; + echo "STATUSES: $dial_statuses
\n"; + echo "FILTER: $lead_filter_id
\n"; + echo "CALL TIME: $local_call_time

\n"; + + ### call function to calculate and print dialable leads + dialable_leads($DB,$link,$local_call_time,$dial_statuses,$camp_lists,$fSQL); + + echo "

\n"; + echo "\n"; + + exit; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=7111111 view sample script with test variables +###################### + +if ($ADD==7111111) +{ + ##### TEST VARIABLES ##### + $vendor_lead_code = 'VENDOR:LEAD;CODE'; + $list_id = 'LISTID'; + $gmt_offset_now = 'GMTOFFSET'; + $phone_code = '1'; + $phone_number = '7275551212'; + $title = 'Mr.'; + $first_name = 'JOHN'; + $middle_initial = 'Q'; + $last_name = 'PUBLIC'; + $address1 = '1234 Main St.'; + $address2 = 'Apt. 3'; + $address3 = 'ADDRESS3'; + $city = 'CHICAGO'; + $state = 'IL'; + $province = 'PROVINCE'; + $postal_code = '33760'; + $country_code = 'USA'; + $gender = 'M'; + $date_of_birth = '1970-01-01'; + $alt_phone = '3125551212'; + $email = 'test@test.com'; + $security_phrase = 'SECUTIRY'; + $comments = 'COMMENTS FIELD'; + $RGfullname = 'JOE AGENT'; + $RGuser = '6666'; + $RGlead_id = '1234'; + $RGcampaign = 'TESTCAMP'; + $RGphone_login = 'gs102'; + $RGgroup = 'TESTCAMP'; + $RGchannel_group = 'TESTCAMP'; + $RGSQLdate = date("Y-m-d H:i:s"); + $RGepoch = date("U"); + $RGuniqueid = '1163095830.4136'; + $RGcustomer_zap_channel = 'Zap/1-1'; + $RGserver_ip = '10.10.10.15'; + $RGSIPexten = 'SIP/gs102'; + $RGsession_id = '8600051'; + +echo "\n"; +echo "\n"; +echo "\n"; +echo ""; + +$stmt="SELECT * from vicidial_scripts where script_id='$script_id';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$script_name = $row[1]; +$script_text = $row[3]; + +if (eregi("iframe src",$script_text)) + { + $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(' ','+',$address2); + $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); + $RGfullname = eregi_replace(' ','+',$RGfullname); + $RGuser = eregi_replace(' ','+',$RGuser); + $RGlead_id = eregi_replace(' ','+',$RGlead_id); + $RGcampaign = eregi_replace(' ','+',$RGcampaign); + $RGphone_login = eregi_replace(' ','+',$RGphone_login); + $RGgroup = eregi_replace(' ','+',$RGgroup); + $RGchannel_group = eregi_replace(' ','+',$RGchannel_group); + $RGSQLdate = eregi_replace(' ','+',$RGSQLdate); + $RGepoch = eregi_replace(' ','+',$RGepoch); + $RGuniqueid = eregi_replace(' ','+',$RGuniqueid); + $RGcustomer_zap_channel = eregi_replace(' ','+',$RGcustomer_zap_channel); + $RGserver_ip = eregi_replace(' ','+',$RGserver_ip); + $RGSIPexten = eregi_replace(' ','+',$RGSIPexten); + $RGsession_id = eregi_replace(' ','+',$RGsession_id); + } + +$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--fullname--B--',"$RGfullname",$script_text); +$script_text = eregi_replace('--A--fronter--B--',"$RGuser",$script_text); +$script_text = eregi_replace('--A--user--B--',"$RGuser",$script_text); +$script_text = eregi_replace('--A--lead_id--B--',"$RGlead_id",$script_text); +$script_text = eregi_replace('--A--campaign--B--',"$RGcampaign",$script_text); +$script_text = eregi_replace('--A--phone_login--B--',"$RGphone_login",$script_text); +$script_text = eregi_replace('--A--group--B--',"$RGgroup",$script_text); +$script_text = eregi_replace('--A--channel_group--B--',"$RGchannel_group",$script_text); +$script_text = eregi_replace('--A--SQLdate--B--',"$RGSQLdate",$script_text); +$script_text = eregi_replace('--A--epoch--B--',"$RGepoch",$script_text); +$script_text = eregi_replace('--A--uniqueid--B--',"$RGuniqueid",$script_text); +$script_text = eregi_replace('--A--customer_zap_channel--B--',"$RGcustomer_zap_channel",$script_text); +$script_text = eregi_replace('--A--server_ip--B--',"$RGserver_ip",$script_text); +$script_text = eregi_replace('--A--SIPexten--B--',"$RGSIPexten",$script_text); +$script_text = eregi_replace('--A--session_id--B--',"$RGsession_id",$script_text); +$script_text = eregi_replace("\n","
",$script_text); + + +echo ""; + +echo "Preview Script: $script_id
\n"; +echo "
\n"; +echo "
$script_name
\n"; +echo "$script_text\n"; +echo "
\n"; + +echo "\n"; + +exit; +} + + + + +######################### HTML HEADER BEGIN ####################################### +if ($hh=='users') + {$users_hh="bgcolor =\"$users_color\""; $users_fc="$users_font"; $users_bold="$header_selected_bold";} + else {$users_hh=''; $users_fc='WHITE'; $users_bold="$header_nonselected_bold";} +if ($hh=='campaigns') + {$campaigns_hh="bgcolor=\"$campaigns_color\""; $campaigns_fc="$campaigns_font"; $campaigns_bold="$header_selected_bold";} + else {$campaigns_hh=''; $campaigns_fc='WHITE'; $campaigns_bold="$header_nonselected_bold";} +if ($hh=='lists') + {$lists_hh="bgcolor=\"$lists_color\""; $lists_fc="$lists_font"; $lists_bold="$header_selected_bold";} + else {$lists_hh=''; $lists_fc='WHITE'; $lists_bold="$header_nonselected_bold";} +if ($hh=='ingroups') + {$ingroups_hh="bgcolor=\"$ingroups_color\""; $ingroups_fc="$ingroups_font"; $ingroups_bold="$header_selected_bold";} + else {$ingroups_hh=''; $ingroups_fc='WHITE'; $ingroups_bold="$header_nonselected_bold";} +if ($hh=='remoteagent') + {$remoteagent_hh="bgcolor=\"$remoteagent_color\""; $remoteagent_fc="$remoteagent_font"; $remoteagent_bold="$header_selected_bold";} + else {$remoteagent_hh=''; $remoteagent_fc='WHITE'; $remoteagent_bold="$header_nonselected_bold";} +if ($hh=='usergroups') + {$usergroups_hh="bgcolor=\"$usergroups_color\""; $usergroups_fc="$usergroups_font"; $usergroups_bold="$header_selected_bold";} + else {$usergroups_hh=''; $usergroups_fc='WHITE'; $usergroups_bold="$header_nonselected_bold";} +if ($hh=='scripts') + {$scripts_hh="bgcolor=\"$scripts_color\""; $scripts_fc="$scripts_font"; $scripts_bold="$header_selected_bold";} + else {$scripts_hh=''; $scripts_fc='WHITE'; $scripts_bold="$header_nonselected_bold";} +if ($hh=='filters') + {$filters_hh="bgcolor=\"$filters_color\""; $filters_fc="$filters_font"; $filters_bold="$header_selected_bold";} + else {$filters_hh=''; $filters_fc='WHITE'; $filters_bold="$header_nonselected_bold";} +if ($hh=='admin') + {$admin_hh="bgcolor=\"$admin_color\""; $admin_fc="$admin_font"; $admin_bold="$header_selected_bold";} + else {$admin_hh=''; $admin_fc='WHITE'; $admin_bold="$header_nonselected_bold";} +if ($hh=='reports') + {$reports_hh="bgcolor=\"$reports_color\""; $reports_fc="$reports_font"; $reports_bold="$header_selected_bold";} + else {$reports_hh=''; $reports_fc='WHITE'; $reports_bold="$header_nonselected_bold";} + +echo "\n"; +echo " + + +\n"; + +$stmt="SELECT admin_home_url from system_settings;"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$admin_home_url_LU = $row[0]; + +?> +
+ BGCOLOR=#D9E6FE cellpadding=2 cellspacing=0> + + + + + + + + + + + + + + + 1) { + ?> +> + 1) + { + +# if ($sh=='basic') {$basic_sh="bgcolor=\"$subcamp_color\""; $basic_fc="$subcamp_font";} +# else {$basic_sh=''; $basic_fc='BLACK';} +# if ($sh=='detail') {$detail_sh="bgcolor=\"$subcamp_color\""; $detail_fc="$subcamp_font";} +# else {$detail_sh=''; $detail_fc='BLACK';} +# if ($sh=='dialstat') {$dialstat_sh="bgcolor=\"$subcamp_color\""; $dialstat_fc="$subcamp_font";} +# else {$dialstat_sh=''; $dialstat_fc='BLACK';} + + if ($sh=='basic') {$sh='list';} + if ($sh=='detail') {$sh='list';} + if ($sh=='dialstat') {$sh='list';} + + if ($sh=='list') {$list_sh="bgcolor=\"$subcamp_color\""; $list_fc="$subcamp_font";} + else {$list_sh=''; $list_fc='BLACK';} + if ($sh=='status') {$status_sh="bgcolor=\"$subcamp_color\""; $status_fc="$subcamp_font";} + else {$status_sh=''; $status_fc='BLACK';} + if ($sh=='hotkey') {$hotkey_sh="bgcolor=\"$subcamp_color\""; $hotkey_fc="$subcamp_font";} + else {$hotkey_sh=''; $hotkey_fc='BLACK';} + if ($sh=='recycle') {$recycle_sh="bgcolor=\"$subcamp_color\""; $recycle_fc="$subcamp_font";} + else {$recycle_sh=''; $recycle_fc='BLACK';} + if ($sh=='autoalt') {$autoalt_sh="bgcolor=\"$subcamp_color\""; $autoalt_fc="$subcamp_font";} + else {$autoalt_sh=''; $autoalt_fc='BLACK';} + if ($sh=='pause') {$pause_sh="bgcolor=\"$subcamp_color\""; $pause_fc="$subcamp_font";} + else {$pause_sh=''; $pause_fc='BLACK';} + if ($sh=='listmix') {$listmix_sh="bgcolor=\"$subcamp_color\""; $listmix_fc="$subcamp_font";} + else {$listmix_sh=''; $listmix_fc='BLACK';} + + ?> +> + + + + + + + + + 1) { + ?> + > + 1) { + ?> +> + 1) { + ?> +> + 1) { + ?> +> + 1) { + ?> +> + 1) { + ?> +> + 1) { + ?> +> + 1) { + if ($sh=='times') {$times_sh="bgcolor=\"$times_color\""; $times_fc="$times_font";} # hard teal + else {$times_sh=''; $times_fc='BLACK';} + if ($sh=='phones') {$phones_sh="bgcolor=\"$server_color\""; $phones_fc="$phones_font";} # pink + else {$phones_sh=''; $phones_fc='BLACK';} + if ($sh=='server') {$server_sh="bgcolor=\"$server_color\""; $server_fc="$server_font";} # pink + else {$server_sh=''; $server_fc='BLACK';} + if ($sh=='conference') {$conference_sh="bgcolor=\"$server_color\""; $conference_fc="$server_font";} # pink + else {$conference_sh=''; $conference_fc='BLACK';} + if ($sh=='settings') {$settings_sh="bgcolor=\"$settings_color\""; $settings_fc="$settings_font";} # pink + else {$settings_sh=''; $settings_fc='BLACK';} + if ($sh=='status') {$status_sh="bgcolor=\"$status_color\""; $status_fc="$status_font";} # pink + else {$status_sh=''; $status_fc='BLACK';} + + ?> +> + + + + + + + + 1) { + ?> + > + 1) { + ?> + > + 1) { + ?> + > + 1) { + ?> + > + 1) { + ?> + > + 1) { + ?> + > + \n"; + echo "You are not authorized to view this page. Please go back.\n"; + } + +} +if (strlen($reports_hh) > 1) { + ?> +> + + + + +
  VICIDIAL ADMIN - HOME | Logout  
> SIZE=> Users > SIZE=> Campaigns > SIZE=> Lists > SIZE=> Scripts > SIZE=> Filters > SIZE=> In-Groups > SIZE=> User Groups > SIZE=> Remote Agents > SIZE=> Admin > SIZE=> Reports
>   > Show Users     |     > Add A New User     |     > Copy User     |     > Search For A User
COLSPAN=2> SIZE=> Campaigns Main COLSPAN=1> SIZE=> Statuses COLSPAN=1> SIZE=> HotKeys COLSPAN=2> SIZE=> Lead Recycle COLSPAN=1> SIZE=> Auto-Alt Dial COLSPAN=1> SIZE=> Pause Codes COLSPAN=2> SIZE=> List Mix
>   > Show Campaigns     |     > Add A New Campaign     |     > Copy Campaign     |     > Real-Time Campaigns Summary
>   > Show Lists     |     > Add A New List     |     > Search For A Lead     |     > Add Number To DNC     |     > Load New Leads
>   > Show Scripts     |     > Add A New Script
>   > Show Filters     |     > Add A New Filter
>   > Show In-Groups     |     > Add A New In-Group     |     > Copy In-Group
>   > Show User Groups     |     > Add A New User Group     |     > Group Hourly Report
>   > Show Remote Agents     |     > Add New Remote Agents
COLSPAN=2> SIZE=> Call Times COLSPAN=2> SIZE=> Phones COLSPAN=2> SIZE=> Conferences COLSPAN=1> SIZE=> Servers COLSPAN=1> SIZE=> System Settings COLSPAN=2> SIZE=> System Statuses
>   > Show Call Times     |     > Add A New Call Time     |     > Show State Call Times     |     > Add A New State Call Time  
>   > Show Phones   |   > Add A New Phone
> Show Conferences   |   > Add A New Conference   |   > Show VICIDIAL Conferences   |   > Add A New VICIDIAL Conference
> Show Servers   |   > Add A New Server
> System Settings
> System Statuses   |   > Status Categories
>  
+
\n"; + echo ""; + + echo "
ADD A NEW USER
\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "$NWB#vicidial_users-user_group$NWE\n"; + echo "\n"; + echo "
User Number: $NWB#vicidial_users-user$NWE
Password: $NWB#vicidial_users-pass$NWE
Full Name: $NWB#vicidial_users-full_name$NWE
User Level: $NWB#vicidial_users-user_level$NWE
User Group:
Phone Login: $NWB#vicidial_users-phone_login$NWE
Phone Pass: $NWB#vicidial_users-phone_pass$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=1 display the COPY USER FORM SCREEN +###################### + +if ($ADD=="1A") +{ + if ($LOGmodify_users==1) + { + echo "
\n"; + echo ""; + + echo "
COPY USER\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + if ($LOGuser_level==9) {$levelMAX=10;} + else {$levelMAX=$LOGuser_level;} + + echo "\n"; + echo "\n"; + echo "
User Number: $NWB#vicidial_users-user$NWE
Password: $NWB#vicidial_users-pass$NWE
Full Name: $NWB#vicidial_users-full_name$NWE
Source User: $NWB#vicidial_users-user$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=11 display the ADD NEW CAMPAIGN FORM SCREEN +###################### + +if ($ADD==11) +{ + if ($LOGmodify_campaigns==1) + { + echo "
\n"; + echo ""; + + echo "
ADD A NEW CAMPAIGN\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Campaign ID: $NWB#vicidial_campaigns-campaign_id$NWE
Campaign Name: $NWB#vicidial_campaigns-campaign_name$NWE
Campaign Description: $NWB#vicidial_campaigns-campaign_description$NWE
Active: $NWB#vicidial_campaigns-active$NWE
Park Extension: $NWB#vicidial_campaigns-park_ext$NWE
Park Filename: $NWB#vicidial_campaigns-park_file_name$NWE
Web Form: $NWB#vicidial_campaigns-web_form_address$NWE
Allow Closers: $NWB#vicidial_campaigns-allow_closers$NWE
Hopper Level: $NWB#vicidial_campaigns-hopper_level$NWE
Auto Dial Level: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE
Next Agent Call: $NWB#vicidial_campaigns-next_agent_call$NWE
Local Call Time: $NWB#vicidial_campaigns-local_call_time$NWE
Voicemail: $NWB#vicidial_campaigns-voicemail_ext$NWE
Script: $NWB#vicidial_campaigns-campaign_script$NWE
Get Call Launch: $NWB#vicidial_campaigns-get_call_launch$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=12 display the COPY CAMPAIGN FORM SCREEN +###################### + +if ($ADD==12) +{ + if ($LOGmodify_campaigns==1) + { + echo "
\n"; + echo ""; + + echo "
COPY A CAMPAIGN\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + + echo "\n"; + echo "
Campaign ID: $NWB#vicidial_campaigns-campaign_id$NWE
Campaign Name: $NWB#vicidial_campaigns-campaign_name$NWE
Source Campaign: $NWB#vicidial_campaigns-campaign_id$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=111 display the ADD NEW LIST FORM SCREEN +###################### + +if ($ADD==111) +{ + if ($LOGmodify_lists==1) + { + echo "
\n"; + echo ""; + + echo "
ADD A NEW LIST\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
List ID: (digits only)$NWB#vicidial_lists-list_id$NWE
List Name: $NWB#vicidial_lists-list_name$NWE
List Description: $NWB#vicidial_lists-list_description$NWE
Campaign: $NWB#vicidial_lists-campaign_id$NWE
Active: $NWB#vicidial_lists-active$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=121 display the ADD NUMBER TO DNC FORM SCREEN and add a new number +###################### + +if ($ADD==121) +{ +echo "
\n"; +echo ""; + +if (strlen($phone_number) > 2) + { + $stmt="SELECT count(*) from vicidial_dnc where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
DNC NOT ADDED - This phone number is already in the Do Not Call List: $phone_number

\n";} + else + { + $stmt="INSERT INTO vicidial_dnc (phone_number) values('$phone_number');"; + $rslt=mysql_query($stmt, $link); + + echo "
DNC ADDED: $phone_number

\n"; + + ### LOG INSERTION TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW DNC NUMBER|$PHP_AUTH_USER|$ip|'$phone_number'|\n"); + fclose($fp); + } + } + } + +echo "
ADD A NUMBER TO THE DNC LIST\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "
Phone Number: (digits only)$NWB#vicidial_list-dnc$NWE
\n"; + +} + + +###################### +# ADD=1111 display the ADD NEW INBOUND GROUP SCREEN +###################### + +if ($ADD==1111) +{ + if ($LOGmodify_ingroups==1) + { + echo "
\n"; + echo ""; + + echo "
ADD A NEW INBOUND GROUP\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Group ID: (no spaces)$NWB#vicidial_inbound_groups-group_id$NWE
Group Name: $NWB#vicidial_inbound_groups-group_name$NWE
Group Color: $NWB#vicidial_inbound_groups-group_color$NWE
Active: $NWB#vicidial_inbound_groups-active$NWE
Web Form: $NWB#vicidial_inbound_groups-web_form_address$NWE
Voicemail: $NWB#vicidial_inbound_groups-voicemail_ext$NWE
Next Agent Call: $NWB#vicidial_inbound_groups-next_agent_call$NWE
Fronter Display: $NWB#vicidial_inbound_groups-fronter_display$NWE
Script: $NWB#vicidial_inbound_groups-ingroup_script$NWE
Get Call Launch: $NWB#vicidial_inbound_groups-get_call_launch$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=1211 display the COPY INBOUND GROUP SCREEN +###################### + +if ($ADD==1211) +{ + if ($LOGmodify_ingroups==1) + { + echo "
\n"; + echo ""; + + echo "
COPY INBOUND GROUP\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + + echo "\n"; + echo "
Group ID: (no spaces)$NWB#vicidial_inbound_groups-group_id$NWE
Group Name: $NWB#vicidial_inbound_groups-group_name$NWE
Source Group ID: $NWB#vicidial_inbound_groups-group_id$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=11111 display the ADD NEW REMOTE AGENTS SCREEN +###################### + +if ($ADD==11111) +{ + if ($LOGmodify_remoteagents==1) + { + echo "
\n"; + echo ""; + + echo "
ADD NEW REMOTE AGENTS\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
User ID Start: (numbers only, incremented)$NWB#vicidial_remote_agents-user_start$NWE
Number of Lines: (numbers only)$NWB#vicidial_remote_agents-number_of_lines$NWE
Server IP: $NWB#vicidial_remote_agents-server_ip$NWE
External Extension: (dial plan number dialed to reach agents)$NWB#vicidial_remote_agents-conf_exten$NWE
Status: $NWB#vicidial_remote_agents-status$NWE
Campaign: $NWB#vicidial_remote_agents-campaign_id$NWE
Inbound Groups: \n"; + echo "$groups_list"; + echo "$NWB#vicidial_remote_agents-closer_campaigns$NWE
\n"; + echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=111111 display the ADD NEW USERS GROUP SCREEN +###################### + +if ($ADD==111111) +{ + if ($LOGmodify_usergroups==1) + { + echo "
\n"; + echo ""; + + echo "
ADD NEW USERS GROUP\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Group: (no spaces or punctuation)$NWB#vicidial_user_groups-user_group$NWE
Description: (description of group)$NWB#vicidial_user_groups-group_name$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=1111111 display the ADD NEW SCRIPT SCREEN +###################### + +if ($ADD==1111111) +{ + if ($LOGmodify_scripts==1) + { + echo "
\n"; + echo ""; + + echo "
ADD NEW SCRIPT\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Script ID: (no spaces or punctuation)$NWB#vicidial_scripts-script_id$NWE
Script Name: (title of the script)$NWB#vicidial_scripts-script_name$NWE
Script Comments: $NWB#vicidial_scripts-script_comments$NWE
Active: $NWB#vicidial_scripts-active$NWE
Script Text: "; + # BEGIN Insert Field + echo ""; + echo "
"; + # END Insert Field + echo " $NWB#vicidial_scripts-script_text$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=11111111 display the ADD NEW FILTER SCREEN +###################### + +if ($ADD==11111111) +{ + if ($LOGmodify_filters==1) + { + echo "
\n"; + echo ""; + + echo "
ADD NEW FILTER\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Filter ID: (no spaces or punctuation)$NWB#vicidial_lead_filters-lead_filter_id$NWE
Filter Name: (short description of the filter)$NWB#vicidial_lead_filters-lead_filter_name$NWE
Filter Comments: $NWB#vicidial_lead_filters-lead_filter_comments$NWE
Filter SQL: $NWB#vicidial_lead_filters-lead_filter_sql$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=111111111 display the ADD NEW CALL TIME SCREEN +###################### + +if ($ADD==111111111) +{ + if ($LOGmodify_call_times==1) + { + echo "
\n"; + echo ""; + + echo "
ADD NEW CALL TIME\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "
Call Time ID: (no spaces or punctuation)$NWB#vicidial_call_times-call_time_id$NWE
Call Time Name: (short description of the call time)$NWB#vicidial_call_times-call_time_name$NWE
Call Time Comments: $NWB#vicidial_call_times-call_time_comments$NWE
Day and time options will appear once you have created the Call Time Definition
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=1111111111 display the ADD NEW STATE CALL TIME SCREEN +###################### + +if ($ADD==1111111111) +{ + if ($LOGmodify_call_times==1) + { + echo "
\n"; + echo ""; + + echo "
ADD NEW STATE CALL TIME\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "
State Call Time ID: (no spaces or punctuation)$NWB#vicidial_call_times-call_time_id$NWE
State Call Time State: (no spaces or punctuation)$NWB#vicidial_call_times-state_call_time_state$NWE
State Call Time Name: (short description of the call time)$NWB#vicidial_call_times-call_time_name$NWE
State Call Time Comments: $NWB#vicidial_call_times-call_time_comments$NWE
Day and time options will appear once you have created the Call Time Definition
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=11111111111 display the ADD NEW PHONE SCREEN +###################### + +if ($ADD==11111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + echo "
ADD A NEW PHONE\n"; + echo "\n"; + echo "
\n"; + + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Phone extension: $NWB#phones-extension$NWE
Dial Plan Number: (digits only)$NWB#phones-dialplan_number$NWE
Voicemail Box: (digits only)$NWB#phones-voicemail_id$NWE
Outbound CallerID: (digits only)$NWB#phones-outbound_cid$NWE
Phone IP address: (optional)$NWB#phones-phone_ip$NWE
Computer IP address: (optional)$NWB#phones-computer_ip$NWE
Server IP: $NWB#phones-server_ip$NWE
Login: $NWB#phones-login$NWE
Password: $NWB#phones-pass$NWE
Status: $NWB#phones-status$NWE
Active Account: $NWB#phones-active$NWE
Phone Type: $NWB#phones-phone_type$NWE
Full Name: $NWB#phones-fullname$NWE
Company: $NWB#phones-company$NWE
Picture: $NWB#phones-picture$NWE
Client Protocol: $NWB#phones-protocol$NWE
Local GMT: (Do NOT Adjust for DST)$NWB#phones-local_gmt$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=111111111111 display the ADD NEW SERVER SCREEN +###################### + +if ($ADD==111111111111) +{ + if ($LOGmodify_servers==1) + { + echo "
\n"; + echo ""; + + echo "
ADD A NEW SERVER\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Server ID: $NWB#servers-server_id$NWE
Server Description: $NWB#servers-server_description$NWE
Server IP Address: $NWB#servers-server_ip$NWE
Active: $NWB#servers-active$NWE
Asterisk Version: $NWB#servers-asterisk_version$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=1111111111111 display the ADD NEW CONFERENCE SCREEN +###################### + +if ($ADD==1111111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + echo "
ADD A NEW CONFERENCE\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Conference Number: (digits only)$NWB#conferences-conf_exten$NWE
Server IP: $NWB#conferences-server_ip$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=11111111111111 display the ADD NEW VICIDIAL CONFERENCE SCREEN +###################### + +if ($ADD==11111111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + echo "
ADD A NEW VICIDIAL CONFERENCE\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Conference Number: (digits only)$NWB#conferences-conf_exten$NWE
Server IP: $NWB#conferences-server_ip$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + + +###################################################################################################### +###################################################################################################### +####### 2 series, validates form data and inserts the new record into the database +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=2 adds the new user to the system +###################### + +if ($ADD=="2") +{ + echo ""; + $stmt="SELECT count(*) from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
USER NOT ADDED - there is already a user in the system with this user number\n";} + else + { + if ( (strlen($user) < 2) or (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user) > 8) ) + { + echo "
USER NOT ADDED - Please go back and look at the data you entered\n"; + echo "
user id must be between 2 and 8 characters long\n"; + echo "
full name and password must be at least 2 characters long\n"; + } + else + { + echo "
USER ADDED: $user\n"; + + $stmt="INSERT INTO vicidial_users (user,pass,full_name,user_level,user_group,phone_login,phone_pass) values('$user','$pass','$full_name','$user_level','$user_group','$phone_login','$phone_pass');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A USER |$PHP_AUTH_USER|$ip|'$user','$pass','$full_name','$user_level','$user_group','$phone_login','$phone_pass'|\n"); + fclose($fp); + } + } + } + +$ADD=3; +} + +###################### +# ADD=2A adds the copied new user to the system +###################### + +if ($ADD=="2A") +{ + echo ""; + $stmt="SELECT count(*) from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
USER NOT ADDED - there is already a user in the system with this user number\n";} + else + { + if ( (strlen($user) < 2) or (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user) > 8) ) + { + echo "
USER NOT ADDED - Please go back and look at the data you entered\n"; + echo "
user id must be between 2 and 8 characters long\n"; + echo "
full name and password must be at least 2 characters long\n"; + } + else + { + $stmt="INSERT INTO vicidial_users (user,pass,full_name,user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override) SELECT \"$user\",\"$pass\",\"$full_name\",user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override from vicidial_users where user=\"$source_user_id\";"; + $rslt=mysql_query($stmt, $link); + + $stmtA="INSERT INTO vicidial_inbound_group_agents (user,group_id,group_rank,group_weight,calls_today) SELECT \"$user\",group_id,group_rank,group_weight,\"0\" from vicidial_inbound_group_agents where user=\"$source_user_id\";"; + $rslt=mysql_query($stmtA, $link); + + $stmtA="INSERT INTO vicidial_campaign_agents (user,campaign_id,campaign_rank,campaign_weight,calls_today) SELECT \"$user\",campaign_id,campaign_rank,campaign_weight,\"0\" from vicidial_campaign_agents where user=\"$source_user_id\";"; + $rslt=mysql_query($stmtA, $link); + + echo "
USER COPIED: $user copied from $source_user_id\n"; + echo "

\n"; + echo "Click here to go to the user record\n"; + echo "

\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A COPIED USER |$PHP_AUTH_USER|$ip|$user|$source_user_id|$stmt|\n"); + fclose($fp); + } + } + } +exit; +} + +###################### +# ADD=21 adds the new campaign to the system +###################### + +if ($ADD==21) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN NOT ADDED - there is already a campaign in the system with this ID\n";} + else + { + $stmt="SELECT count(*) from vicidial_inbound_groups where group_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN NOT ADDED - there is already an inbound group in the system with this ID\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($campaign_id) > 8) or (strlen($campaign_name) < 6) or (strlen($campaign_name) > 40) ) + { + echo "
CAMPAIGN NOT ADDED - Please go back and look at the data you entered\n"; + echo "
campaign ID must be between 2 and 8 characters in length\n"; + echo "
campaign name must be between 6 and 40 characters in length\n"; + } + else + { + echo "
CAMPAIGN ADDED: $campaign_id\n"; + + $stmt="INSERT INTO vicidial_campaigns (campaign_id,campaign_name,campaign_description,active,dial_status_a,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,campaign_script,get_call_launch,campaign_changedate,campaign_stats_refresh,list_order_mix) values('$campaign_id','$campaign_name','$campaign_description','$active','NEW','DOWN','$park_ext','$park_file_name','" . mysql_real_escape_string($web_form_address) . "','$allow_closers','$hopper_level','$auto_dial_level','$next_agent_call','$local_call_time','$voicemail_ext','$script_id','$get_call_launch','$SQLdate','Y','DISABLED');"; + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_campaign_stats (campaign_id) values('$campaign_id');"; + $rslt=mysql_query($stmt, $link); + + echo ""; + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW CAMPAIGN |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + } + } + } +$ADD=31; +} + +###################### +# ADD=20 adds copied new campaign to the system +###################### + +if ($ADD==20) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN NOT ADDED - there is already a campaign in the system with this ID\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($campaign_id) > 8) or (strlen($campaign_name) < 2) or (strlen($source_campaign_id) < 2) or (strlen($source_campaign_id) > 8) ) + { + echo "
CAMPAIGN NOT ADDED - Please go back and look at the data you entered\n"; + echo "
campaign ID must be between 2 and 8 characters in length\n"; + echo "
source campaign ID must be between 2 and 8 characters in length\n"; + } + else + { + echo "
CAMPAIGN COPIED: $campaign_id copied from $source_campaign_id\n"; + + $stmt="INSERT INTO vicidial_campaigns (campaign_name,campaign_id,active,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,safe_harbor_message,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,list_order_mix,campaign_allow_inbound,manual_dial_list_id,default_xfer_group) SELECT \"$campaign_name\",\"$campaign_id\",\"N\",dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,safe_harbor_message,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,\"DISABLED\",campaign_allow_inbound,manual_dial_list_id,default_xfer_group from vicidial_campaigns where campaign_id='$source_campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmtA="INSERT INTO vicidial_campaign_stats (campaign_id) values('$campaign_id');"; + $rslt=mysql_query($stmtA, $link); + + $stmtA="INSERT INTO vicidial_campaign_statuses (status,status_name,selectable,campaign_id,human_answered,category) SELECT status,status_name,selectable,\"$campaign_id\",human_answered,category from vicidial_campaign_statuses where campaign_id='$source_campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + $stmtA="INSERT INTO vicidial_campaign_hotkeys (status,hotkey,status_name,selectable,campaign_id) SELECT status,hotkey,status_name,selectable,\"$campaign_id\" from vicidial_campaign_hotkeys where campaign_id='$source_campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + $stmtA="INSERT INTO vicidial_lead_recycle (status,attempt_delay,attempt_maximum,active,campaign_id) SELECT status,attempt_delay,attempt_maximum,active,\"$campaign_id\" from vicidial_lead_recycle where campaign_id='$source_campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + $stmtA="INSERT INTO vicidial_pause_codes (pause_code,pause_code_name,billable,campaign_id) SELECT pause_code,pause_code_name,billable,\"$campaign_id\" from vicidial_pause_codes where campaign_id='$source_campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + echo ""; + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|COPY TO NEW CAMPAIGN|$PHP_AUTH_USER|$ip|$campaign_id|$source_campaign_id|$stmt|$stmtA|\n"); + fclose($fp); + } + + } + } +$ADD=31; +} + +###################### +# ADD=22 adds the new campaign status to the system +###################### + +if ($ADD==22) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN STATUS NOT ADDED - there is already a campaign-status in the system with this name\n";} + else + { + $stmt="SELECT count(*) from vicidial_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN STATUS NOT ADDED - there is already a global-status in the system with this name\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($status_name) < 2) ) + { + echo "
CAMPAIGN STATUS NOT ADDED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 8 characters in length\n"; + echo "
status name must be between 2 and 30 characters in length\n"; + } + else + { + echo "
CAMPAIGN STATUS ADDED: $campaign_id - $status\n"; + + $stmt="INSERT INTO vicidial_campaign_statuses (status,status_name,selectable,campaign_id,human_answered,category) values('$status','$status_name','$selectable','$campaign_id','$human_answered','$category');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW CAMPAIGN STATUS |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } +$SUB=22; +$ADD=31; +} + + +###################### +# ADD=23 adds the new campaign hotkey to the system +###################### + +if ($ADD==23) +{ + $HKstatus_data = explode('-----',$HKstatus); + $status = $HKstatus_data[0]; + $status_name = $HKstatus_data[1]; + + echo ""; + $stmt="SELECT count(*) from vicidial_campaign_hotkeys where campaign_id='$campaign_id' and hotkey='$hotkey' and hotkey='$hotkey';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN HOT KEY NOT ADDED - there is already a campaign-hotkey in the system with this hotkey\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($hotkey) < 1) ) + { + echo "
CAMPAIGN HOT KEY NOT ADDED - Please go back and look at the data you entered\n"; + echo "
hotkey must be a single character between 1 and 9 \n"; + echo "
status must be between 1 and 8 characters in length\n"; + } + else + { + echo "
CAMPAIGN HOT KEY ADDED: $campaign_id - $status - $hotkey\n"; + + $stmt="INSERT INTO vicidial_campaign_hotkeys values('$status','$hotkey','$status_name','$selectable','$campaign_id');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW CAMPAIGN HOT KEY |$PHP_AUTH_USER|$ip|'$status','$hotkey','$status_name','$selectable','$campaign_id'|\n"); + fclose($fp); + } + } + } +$SUB=23; +$ADD=31; +} + + +###################### +# ADD=25 adds the new campaign lead recycle entry to the system +###################### + +if ($ADD==25) +{ + $status = eregi_replace("-----.*",'',$status); + echo ""; + $stmt="SELECT count(*) from vicidial_lead_recycle where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN LEAD RECYCLE NOT ADDED - there is already a lead-recycle for this campaign with this status\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or ($attempt_delay < 120) or ($attempt_maximum < 1) or ($attempt_maximum > 10) ) + { + echo "
CAMPAIGN LEAD RECYCLE NOT ADDED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 6 characters in length\n"; + echo "
attempt delay must be at least 120 seconds\n"; + echo "
maximum attempts must be from 1 to 10\n"; + } + else + { + echo "
CAMPAIGN LEAD RECYCLE ADDED: $campaign_id - $status - $attempt_delay\n"; + + $stmt="INSERT INTO vicidial_lead_recycle(campaign_id,status,attempt_delay,attempt_maximum,active) values('$campaign_id','$status','$attempt_delay','$attempt_maximum','$active');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW LEAD RECYCLE |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$SUB=25; +$ADD=31; +} + + +###################### +# ADD=26 adds the new auto alt dial status to the campaign +###################### + +if ($ADD==26) +{ + $status = eregi_replace("-----.*",'',$status); + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and auto_alt_dial_statuses LIKE \"% $status %\";"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
AUTO ALT DIAL STATUS NOT ADDED - there is already an entry for this campaign with this status\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
AUTO ALT DIAL STATUS NOT ADDED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 6 characters in length\n"; + } + else + { + echo "
AUTO ALT DIAL STATUS ADDED: $campaign_id - $status\n"; + + $stmt="SELECT auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if (strlen($row[0])<2) {$row[0] = ' -';} + $auto_alt_dial_statuses = " $status$row[0]"; + $stmt="UPDATE vicidial_campaigns set auto_alt_dial_statuses='$auto_alt_dial_statuses' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A AUTO-ALT-DIAL STATUS|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$SUB=26; +$ADD=31; +} + + +###################### +# ADD=27 adds the new campaign agent pause code entry to the system +###################### + +if ($ADD==27) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_pause_codes where campaign_id='$campaign_id' and pause_code='$pause_code';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
AGENT PAUSE CODE NOT ADDED - there is already an entry for this campaign with this pause code\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($pause_code) < 1) or (strlen($pause_code) > 6) or (strlen($pause_code_name) < 2) ) + { + echo "
AGENT PAUSE CODE NOT ADDED - Please go back and look at the data you entered\n"; + echo "
pause code must be between 1 and 6 characters in length\n"; + echo "
pause code name must be between 2 and 30 characters in length\n"; + } + else + { + echo "
AGENT PAUSE CODE ADDED: $campaign_id - $pause_code - $pause_code_name\n"; + + $stmt="INSERT INTO vicidial_pause_codes(campaign_id,pause_code,pause_code_name,billable) values('$campaign_id','$pause_code','$pause_code_name','$billable');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW AGENT PAUSE CODE|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$SUB=27; +$ADD=31; +} + + +###################### +# ADD=28 adds new status to the campaign dial statuses +###################### + +if ($ADD==28) +{ + $status = eregi_replace("-----.*",'',$status); + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and dial_statuses LIKE \"% $status %\";"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN DIAL STATUS NOT ADDED - there is already an entry for this campaign with this status\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
CAMPAIGN DIAL STATUS NOT ADDED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 6 characters in length\n"; + } + else + { + echo "
CAMPAIGN DIAL STATUS ADDED: $campaign_id - $status\n"; + + $stmt="SELECT dial_statuses from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if (strlen($row[0])<2) {$row[0] = ' -';} + $dial_statuses = " $status$row[0]"; + $stmt="UPDATE vicidial_campaigns set dial_statuses='$dial_statuses' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD CAMPAIGN DIAL STATUS |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +#$SUB=28; +$ADD=31; +} + + +###################### +# ADD=211 adds the new list to the system +###################### + +if ($ADD==211) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
LIST NOT ADDED - there is already a list in the system with this ID\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($list_name) < 2) or ($list_id < 100) or (strlen($list_id) > 8) ) + { + echo "
LIST NOT ADDED - Please go back and look at the data you entered\n"; + echo "
List ID must be between 2 and 8 characters in length\n"; + echo "
List name must be at least 2 characters in length\n"; + echo "
List ID must be greater than 100\n"; + } + else + { + echo "
LIST ADDED: $list_id\n"; + + $stmt="INSERT INTO vicidial_lists (list_id,list_name,campaign_id,active,list_description,list_changedate) values('$list_id','$list_name','$campaign_id','$active','$list_description','$SQLdate');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW LIST |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=311; +} + + + +###################### +# ADD=2111 adds the new inbound group to the system +###################### + +if ($ADD==2111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_inbound_groups where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
GROUP NOT ADDED - there is already a group in the system with this ID\n";} + else + { + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
GROUP NOT ADDED - there is already a campaign in the system with this ID\n";} + else + { + if ( (strlen($group_id) < 2) or (strlen($group_name) < 2) or (strlen($group_color) < 2) or (strlen($group_id) > 20) or (eregi(' ',$group_id)) or (eregi("\-",$group_id)) or (eregi("\+",$group_id)) ) + { + echo "
GROUP NOT ADDED - Please go back and look at the data you entered\n"; + echo "
Group ID must be between 2 and 20 characters in length and contain no ' -+'.\n"; + echo "
Group name and group color must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_inbound_groups (group_id,group_name,group_color,active,web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch) values('$group_id','$group_name','$group_color','$active','" . mysql_real_escape_string($web_form_address) . "','$voicemail_ext','$next_agent_call','$fronter_display','$script_id','$get_call_launch');"; + $rslt=mysql_query($stmt, $link); + + echo "
GROUP ADDED: $group_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW GROUP |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } +$ADD=3111; +} + + +###################### +# ADD=2011 adds copied inbound group to the system +###################### + +if ($ADD==2011) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_inbound_groups where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
GROUP NOT ADDED - there is already a group in the system with this ID\n";} + else + { + if ( (strlen($group_id) < 2) or (strlen($group_name) < 2) or (strlen($group_id) > 20) or (eregi(' ',$group_id)) or (eregi("\-",$group_id)) or (eregi("\+",$group_id)) ) + { + echo "
GROUP NOT ADDED - Please go back and look at the data you entered\n"; + echo "
Group ID must be between 2 and 20 characters in length and contain no ' -+'.\n"; + echo "
Group name and group color must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_inbound_groups (group_id,group_name,group_color,active,web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_message,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group) SELECT \"$group_id\",\"$group_name\",group_color,\"N\",web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_message,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group from vicidial_inbound_groups where group_id=\"$source_group_id\";"; + $rslt=mysql_query($stmt, $link); + + echo "
GROUP ADDED: $group_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|COPIED TO NEW GROUP |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=3111; +} + + +###################### +# ADD=21111 adds new remote agents to the system +###################### + +if ($ADD==21111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_remote_agents where server_ip='$server_ip' and user_start='$user_start';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
REMOTE AGENTS NOT ADDED - there is already a remote agents entry starting with this userID\n";} + else + { + if ( (strlen($server_ip) < 2) or (strlen($user_start) < 2) or (strlen($campaign_id) < 2) or (strlen($conf_exten) < 2) ) + { + echo "
REMOTE AGENTS NOT ADDED - Please go back and look at the data you entered\n"; + echo "
User ID start and external extension must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_remote_agents values('','$user_start','$number_of_lines','$server_ip','$conf_exten','$status','$campaign_id','$groups_value');"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOTE AGENTS ADDED: $user_start\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW REMOTE AGENTS ENTRY |$PHP_AUTH_USER|$ip|'$user_start','$number_of_lines','$server_ip','$conf_exten','$status','$campaign_id','$groups_value'|\n"); + fclose($fp); + } + } + } +$ADD=10000; +} + +###################### +# ADD=211111 adds new user group to the system +###################### + +if ($ADD==211111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_user_groups where user_group='$user_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
USER GROUP NOT ADDED - there is already a user group entry with this name\n";} + else + { + if ( (strlen($user_group) < 2) or (strlen($group_name) < 2) ) + { + echo "
USER GROUP NOT ADDED - Please go back and look at the data you entered\n"; + echo "
Group name and description must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_user_groups(user_group,group_name,allowed_campaigns) values('$user_group','$group_name','-ALL-CAMPAIGNS-');"; + $rslt=mysql_query($stmt, $link); + + echo "
USER GROUP ADDED: $user_group\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW USER GROUP ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=100000; +} + +###################### +# ADD=2111111 adds new script to the system +###################### + +if ($ADD==2111111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_scripts where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
SCRIPT NOT ADDED - there is already a script entry with this name\n";} + else + { + if ( (strlen($script_id) < 2) or (strlen($script_name) < 2) or (strlen($script_text) < 2) ) + { + echo "
SCRIPT NOT ADDED - Please go back and look at the data you entered\n"; + echo "
Script name, description and text must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_scripts values('$script_id','$script_name','$script_comments','$script_text','$active');"; + $rslt=mysql_query($stmt, $link); + + echo "
SCRIPT ADDED: $script_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW SCRIPT ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=1000000; +} + + +###################### +# ADD=21111111 adds new filter to the system +###################### + +if ($ADD==21111111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_lead_filters where lead_filter_id='$lead_filter_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
FILTER NOT ADDED - there is already a filter entry with this ID\n";} + else + { + if ( (strlen($lead_filter_id) < 2) or (strlen($lead_filter_name) < 2) or (strlen($lead_filter_sql) < 2) ) + { + echo "
FILTER NOT ADDED - Please go back and look at the data you entered\n"; + echo "
Filter ID, name and SQL must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_lead_filters SET lead_filter_id='$lead_filter_id',lead_filter_name='$lead_filter_name',lead_filter_comments='$lead_filter_comments',lead_filter_sql='$lead_filter_sql';"; + $rslt=mysql_query($stmt, $link); + + echo "
FILTER ADDED: $lead_filter_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW FILTER ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=10000000; +} + + +###################### +# ADD=211111111 adds new call time definition to the system +###################### + +if ($ADD==211111111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_call_times where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CALL TIME DEFINITION NOT ADDED - there is already a call time entry with this ID\n";} + else + { + if ( (strlen($call_time_id) < 2) or (strlen($call_time_name) < 2) ) + { + echo "
CALL TIME DEFINITION NOT ADDED - Please go back and look at the data you entered\n"; + echo "
Call Time ID and name must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_call_times SET call_time_id='$call_time_id',call_time_name='$call_time_name',call_time_comments='$call_time_comments';"; + $rslt=mysql_query($stmt, $link); + + echo "
CALL TIME ADDED: $call_time_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW CALL TIME ENTRY |$stmt|\n"); + fclose($fp); + } + } + } +$ADD=311111111; +} + + +###################### +# ADD=2111111111 adds new state call time definition to the system +###################### + +if ($ADD==2111111111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_state_call_times where state_call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
STATE CALL TIME DEFINITION NOT ADDED - there is already a call time entry with this ID\n";} + else + { + if ( (strlen($call_time_id) < 2) or (strlen($call_time_name) < 2) or (strlen($state_call_time_state) < 2) ) + { + echo "
STATE CALL TIME DEFINITION NOT ADDED - Please go back and look at the data you entered\n"; + echo "
State Call Time ID, name and state must be at least 2 characters in length\n"; + } + else + { + $stmt="INSERT INTO vicidial_state_call_times SET state_call_time_id='$call_time_id',state_call_time_name='$call_time_name',state_call_time_comments='$call_time_comments',state_call_time_state='$state_call_time_state';"; + $rslt=mysql_query($stmt, $link); + + echo "
STATE CALL TIME ADDED: $call_time_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW STATE CALL TIME ENTRY|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=3111111111; +} + + +###################### +# ADD=21111111111 adds new phone to the system +###################### + +if ($ADD==21111111111) +{ +echo "
\n"; + echo ""; + $stmt="SELECT count(*) from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
PHONE NOT ADDED - there is already a Phone in the system with this extension/server\n";} + else + { + if ( (strlen($extension) < 1) or (strlen($server_ip) < 7) or (strlen($dialplan_number) < 1) or (strlen($voicemail_id) < 1) or (strlen($login) < 1) or (strlen($pass) < 1)) + {echo "
PHONE NOT ADDED - Please go back and look at the data you entered\n";} + else + { + echo "
PHONE ADDED\n"; + + $stmt="INSERT INTO phones (extension,dialplan_number,voicemail_id,phone_ip,computer_ip,server_ip,login,pass,status,active,phone_type,fullname,company,picture,protocol,local_gmt,outbound_cid) values('$extension','$dialplan_number','$voicemail_id','$phone_ip','$computer_ip','$server_ip','$login','$pass','$status','$active','$phone_type','$fullname','$company','$picture','$protocol','$local_gmt','$outbound_cid');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=31111111111; +} + + +###################### +# ADD=211111111111 adds new server to the system +###################### + +if ($ADD==211111111111) +{ +echo "
\n"; + echo ""; + $stmt="SELECT count(*) from servers where server_id='$server_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
SERVER NOT ADDED - there is already a server in the system with this ID\n";} + else + { + if ( (strlen($server_id) < 1) or (strlen($server_ip) < 7) ) + {echo "
SERVER NOT ADDED - Please go back and look at the data you entered\n";} + else + { + echo "
SERVER ADDED\n"; + + $stmt="INSERT INTO servers (server_id,server_description,server_ip,active,asterisk_version) values('$server_id','$server_description','$server_ip','$active','$asterisk_version');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=311111111111; +} + + +###################### +# ADD=221111111111 adds the new vicidial server trunk record to the system +###################### + +if ($ADD==221111111111) +{ + echo ""; + $stmt="SELECT max_vicidial_trunks from servers where server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $MAXvicidial_trunks = $rowx[0]; + + $stmt="SELECT sum(dedicated_trunks) from vicidial_server_trunks where server_ip='$server_ip' and campaign_id !='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $SUMvicidial_trunks = ($rowx[0] + $dedicated_trunks); + + if ($SUMvicidial_trunks > $MAXvicidial_trunks) + { + echo "
VICIDIAL SERVER TRUNK RECORD NOT ADDED - the number of vicidial trunks is too high: $SUMvicidial_trunks / $MAXvicidial_trunks\n"; + } + else + { + $stmt="SELECT count(*) from vicidial_server_trunks where campaign_id='$campaign_id' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
VICIDIAL SERVER TRUNK RECORD NOT ADDED - there is already a server-trunk record for this campaign\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($server_ip) < 7) or (strlen($dedicated_trunks) < 1) or (strlen($trunk_restriction) < 1) ) + { + echo "
VICIDIAL SERVER TRUNK RECORD NOT ADDED - Please go back and look at the data you entered\n"; + echo "
campaign must be between 3 and 8 characters in length\n"; + echo "
server_ip delay must be at least 7 characters\n"; + echo "
trunks must be a digit from 0 to 9999\n"; + } + else + { + echo "
VICIDIAL SERVER TRUNK RECORD ADDED: $campaign_id - $server_ip - $dedicated_trunks - $trunk_restriction\n"; + + $stmt="INSERT INTO vicidial_server_trunks(server_ip,campaign_id,dedicated_trunks,trunk_restriction) values('$server_ip','$campaign_id','$dedicated_trunks','$trunk_restriction');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW VICIDIAL TRUNK |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } +$ADD=311111111111; +} + + +###################### +# ADD=2111111111111 adds new conference to the system +###################### + +if ($ADD==2111111111111) +{ +echo "
\n"; + echo ""; + $stmt="SELECT count(*) from conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CONFERENCE NOT ADDED - there is already a conference in the system with this ID and server\n";} + else + { + if ( (strlen($conf_exten) < 1) or (strlen($server_ip) < 7) ) + {echo "
CONFERENCE NOT ADDED - Please go back and look at the data you entered\n";} + else + { + echo "
CONFERENCE ADDED\n"; + + $stmt="INSERT INTO conferences (conf_exten,server_ip) values('$conf_exten','$server_ip');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=3111111111111; +} + + +###################### +# ADD=21111111111111 adds new vicidial conference to the system +###################### + +if ($ADD==21111111111111) +{ +echo "
\n"; + echo ""; + $stmt="SELECT count(*) from vicidial_conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
VICIDIAL CONFERENCE NOT ADDED - there is already a vicidial conference in the system with this ID and server\n";} + else + { + if ( (strlen($conf_exten) < 1) or (strlen($server_ip) < 7) ) + {echo "
VICIDIAL CONFERENCE NOT ADDED - Please go back and look at the data you entered\n";} + else + { + echo "
VICIDIAL CONFERENCE ADDED\n"; + + $stmt="INSERT INTO vicidial_conferences (conf_exten,server_ip) values('$conf_exten','$server_ip');"; + $rslt=mysql_query($stmt, $link); + } + } +$ADD=31111111111111; +} + + +###################### +# ADD=221111111111111 adds the new system status to the system +###################### + +if ($ADD==221111111111111) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_campaign_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
SYSTEM STATUS NOT ADDED - there is already a campaign-status in the system with this name: $row[0]\n";} + else + { + $stmt="SELECT count(*) from vicidial_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
SYSTEM STATUS NOT ADDED - there is already a global-status in the system with this name\n";} + else + { + if ( (strlen($status) < 1) or (strlen($status_name) < 2) ) + { + echo "
SYSTEM STATUS NOT ADDED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 8 characters in length\n"; + echo "
status name must be between 2 and 30 characters in length\n"; + } + else + { + echo "
SYSTEM STATUS ADDED: $status_name - $status\n"; + + $stmt="INSERT INTO vicidial_statuses (status,status_name,selectable,human_answered,category) values('$status','$status_name','$selectable','$human_answered','$category');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW SYSTEM STATUS |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } +$ADD=321111111111111; +} + + +###################### +# ADD=231111111111111 adds the new status category to the system +###################### + +if ($ADD==231111111111111) +{ + + echo ""; + $stmt="SELECT count(*) from vicidial_status_categories where vsc_id='$vsc_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
STATUS CATEGORY NOT ADDED - there is already a status category in the system with this ID: $row[0]\n";} + else + { + if ( (strlen($vsc_id) < 2) or (strlen($vsc_id) > 20) or (strlen($vsc_name) < 2) ) + { + echo "
STATUS CATEGORY NOT ADDED - Please go back and look at the data you entered\n"; + echo "
ID must be between 2 and 20 characters in length\n"; + echo "
name name must be between 2 and 50 characters in length\n"; + } + else + { + echo "
STATUS CATEGORY ADDED: $vsc_id - $vsc_name\n"; + + $stmt="SELECT count(*) from vicidial_status_categories where tovdad_display='Y' and vsc_id NOT IN('$vsc_id');"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 3) and (ereg('Y',$tovdad_display)) ) + { + $tovdad_display = 'N'; + echo "
ERROR: There are already 4 Status Categories set to TimeOnVDAD Display\n"; + } + + $stmt="INSERT INTO vicidial_status_categories (vsc_id,vsc_name,vsc_description,tovdad_display) values('$vsc_id','$vsc_name','$vsc_description','$tovdad_display');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW STATUS CATEGORY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=331111111111111; +} + + + +###################################################################################################### +###################################################################################################### +####### 4 series, record modifications submitted and DB is modified, then on to 3 series forms below +###################################################################################################### +###################################################################################################### + + + +###################### +# ADD=4A submit user modifications to the system - ADMIN +###################### + +if ($ADD=="4A") +{ + if ($LOGmodify_users==1) + { + echo ""; + + if ( (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) + { + echo "
USER NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Password and Full Name each need ot be at least 2 characters in length\n"; + } + else + { + echo "
USER MODIFIED - ADMIN: $user\n"; + + $stmt="UPDATE vicidial_users set pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass',delete_users='$delete_users',delete_user_groups='$delete_user_groups',delete_lists='$delete_lists',delete_campaigns='$delete_campaigns',delete_ingroups='$delete_ingroups',delete_remote_agents='$delete_remote_agents',load_leads='$load_leads',campaign_detail='$campaign_detail',ast_admin_access='$ast_admin_access',ast_delete_phones='$ast_delete_phones',delete_scripts='$delete_scripts',modify_leads='$modify_leads',hotkeys_active='$hotkeys_active',change_agent_campaign='$change_agent_campaign',agent_choose_ingroups='$agent_choose_ingroups',closer_campaigns='$groups_value',scheduled_callbacks='$scheduled_callbacks',agentonly_callbacks='$agentonly_callbacks',agentcall_manual='$agentcall_manual',vicidial_recording='$vicidial_recording',vicidial_transfers='$vicidial_transfers',delete_filters='$delete_filters',alter_agent_interface_options='$alter_agent_interface_options',closer_default_blended='$closer_default_blended',delete_call_times='$delete_call_times',modify_call_times='$modify_call_times',modify_users='$modify_users',modify_campaigns='$modify_campaigns',modify_lists='$modify_lists',modify_scripts='$modify_scripts',modify_filters='$modify_filters',modify_ingroups='$modify_ingroups',modify_usergroups='$modify_usergroups',modify_remoteagents='$modify_remoteagents',modify_servers='$modify_servers',view_reports='$view_reports',vicidial_recording_override='$vicidial_recording_override',alter_custdata_override='$alter_custdata_override' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER INFO |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=3; # go to user modification below +} + + +###################### +# ADD=4B submit user modifications to the system - ADMIN +###################### + +if ($ADD=="4B") +{ + if ($LOGmodify_users==1) + { + echo ""; + + if ( (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) + { + echo "
USER NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Password and Full Name each need ot be at least 2 characters in length\n"; + } + else + { + echo "
USER MODIFIED - ADMIN: $user\n"; + + $stmt="UPDATE vicidial_users set pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass',hotkeys_active='$hotkeys_active',agent_choose_ingroups='$agent_choose_ingroups',closer_campaigns='$groups_value',scheduled_callbacks='$scheduled_callbacks',agentonly_callbacks='$agentonly_callbacks',agentcall_manual='$agentcall_manual',vicidial_recording='$vicidial_recording',vicidial_transfers='$vicidial_transfers',closer_default_blended='$closer_default_blended',vicidial_recording_override='$vicidial_recording_override',alter_custdata_override='$alter_custdata_override' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER INFO |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=3; # go to user modification below +} + + + +###################### +# ADD=4 submit user modifications to the system +###################### + +if ($ADD==4) +{ + if ($LOGmodify_users==1) + { + echo ""; + + if ( (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) + { + echo "
USER NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Password and Full Name each need ot be at least 2 characters in length\n"; + } + else + { + echo "
USER MODIFIED: $user\n"; + + $stmt="UPDATE vicidial_users set pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass' where user='$user';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER INFO |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=3; # go to user modification below +} + +###################### +# ADD=41 submit campaign modifications to the system +###################### + +if ($ADD==41) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_name) < 6) or (strlen($active) < 1) ) + { + echo "
CAMPAIGN NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the campaign name needs to be at least 6 characters in length\n"; + echo "
|$campaign_name|$active|\n"; + } + else + { + echo "
CAMPAIGN MODIFIED: $campaign_id\n"; + + if ($dial_method == 'MANUAL') + { + $auto_dial_level='0'; + $adlSQL = "auto_dial_level='0',"; + } + else + { + if ($dial_level_override > 0) + { + $adlSQL = "auto_dial_level='$auto_dial_level',"; + } + else + { + if ($dial_method == 'RATIO') + { + if ($auto_dial_level < 1) {$auto_dial_level = "1.0";} + $adlSQL = "auto_dial_level='$auto_dial_level',"; + } + else + { + $adlSQL = ""; + if ($auto_dial_level < 1) + { + $auto_dial_level = "1.0"; + $adlSQL = "auto_dial_level='$auto_dial_level',"; + } + } + } + } + if ( (!ereg("DISABLED",$list_order_mix)) and ($hopper_level < 100) ) + {$hopper_level='100';} + + $stmtA="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',allow_closers='$allow_closers',hopper_level='$hopper_level', $adlSQL next_agent_call='$next_agent_call', local_call_time='$local_call_time', voicemail_ext='$voicemail_ext', dial_timeout='$dial_timeout', dial_prefix='$dial_prefix', campaign_cid='$campaign_cid', campaign_vdad_exten='$campaign_vdad_exten', web_form_address='" . mysql_real_escape_string($web_form_address) . "', park_ext='$park_ext', park_file_name='$park_file_name', campaign_rec_exten='$campaign_rec_exten', campaign_recording='$campaign_recording', campaign_rec_filename='$campaign_rec_filename', campaign_script='$script_id', get_call_launch='$get_call_launch', am_message_exten='$am_message_exten', amd_send_to_vmx='$amd_send_to_vmx', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number',lead_filter_id='$lead_filter_id',alt_number_dialing='$alt_number_dialing',scheduled_callbacks='$scheduled_callbacks',safe_harbor_message='$safe_harbor_message',drop_call_seconds='$drop_call_seconds',safe_harbor_exten='$safe_harbor_exten',wrapup_seconds='$wrapup_seconds',wrapup_message='$wrapup_message',closer_campaigns='$groups_value',use_internal_dnc='$use_internal_dnc',allcalls_delay='$allcalls_delay',omit_phone_code='$omit_phone_code',dial_method='$dial_method',available_only_ratio_tally='$available_only_ratio_tally',adaptive_dropped_percentage='$adaptive_dropped_percentage',adaptive_maximum_level='$adaptive_maximum_level',adaptive_latest_server_time='$adaptive_latest_server_time',adaptive_intensity='$adaptive_intensity',adaptive_dl_diff_target='$adaptive_dl_diff_target',concurrent_transfers='$concurrent_transfers',auto_alt_dial='$auto_alt_dial',agent_pause_codes_active='$agent_pause_codes_active',campaign_description='$campaign_description',campaign_changedate='$SQLdate',campaign_stats_refresh='$campaign_stats_refresh',disable_alter_custdata='$disable_alter_custdata',no_hopper_leads_logins='$no_hopper_leads_logins',list_order_mix='$list_order_mix',campaign_allow_inbound='$campaign_allow_inbound',manual_dial_list_id='$manual_dial_list_id',default_xfer_group='$default_xfer_group',xfer_groups='$XFERgroups_value' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + if ($reset_hopper == 'Y') + { + echo "
RESETTING CAMPAIGN LEAD HOPPER\n"; + echo "
- Wait 1 minute before dialing next number\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id' and status IN('READY','QUEUE','DONE');"; + $rslt=mysql_query($stmt, $link); + + ### LOG RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|CAMPAIGN HOPPERRESET|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CAMPAIGN INFO|$PHP_AUTH_USER|$ip|$stmtA|$reset_hopper|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=42 modify/delete campaign status in the system +###################### + +if ($ADD==42) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
CAMPAIGN STATUS NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the campaign id needs to be at least 2 characters in length\n"; + echo "
the campaign status needs to be at least 1 characters in length\n"; + } + else + { + if (ereg('delete',$stage)) + { + echo "
CUSTOM CAMPAIGN STATUS DELETED: $campaign_id - $status\n"; + + $stmt="DELETE FROM vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + + $stmtA="DELETE FROM vicidial_campaign_hotkeys where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmtA, $link); + + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE CAMPAIGN STATUS|$PHP_AUTH_USER|$ip|$stmt|$stmtA|\n"); + fclose($fp); + } + } + if (ereg('modify',$stage)) + { + echo "
CUSTOM CAMPAIGN STATUS MODIFIED: $campaign_id - $status\n"; + + $stmt="UPDATE vicidial_campaign_statuses SET status_name='$status_name',selectable='$selectable',human_answered='$human_answered',category='$category' where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CAMPAIGN STATUS|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$SUB=22; +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=43 delete campaign hotkey in the system +###################### + +if ($ADD==43) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or (strlen($hotkey) < 1) ) + { + echo "
CAMPAIGN HOT KEY NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the campaign id needs to be at least 2 characters in length\n"; + echo "
the campaign status needs to be at least 1 characters in length\n"; + echo "
the campaign hotkey needs to be at least 1 characters in length\n"; + } + else + { + echo "
CUSTOM CAMPAIGN HOT KEY DELETED: $campaign_id - $status - $hotkey\n"; + + $stmt="DELETE FROM vicidial_campaign_hotkeys where campaign_id='$campaign_id' and status='$status' and hotkey='$hotkey';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE CAMPAIGN STATUS|$PHP_AUTH_USER|$ip|DELETE FROM vicidial_campaign_hotkeys where campaign_id='$campaign_id' and status='$status' and hotkey='$hotkey'|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$SUB=23; +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=44 submit campaign modifications to the system - Basic View +###################### + +if ($ADD==44) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_name) < 6) or (strlen($active) < 1) ) + { + echo "
CAMPAIGN NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the campaign name needs to be at least 6 characters in length\n"; + } + else + { + echo "
CAMPAIGN MODIFIED: $campaign_id\n"; + + if ($dial_method == 'RATIO') + { + if ($auto_dial_level < 1) {$auto_dial_level = "1.0";} + $adlSQL = "auto_dial_level='$auto_dial_level',"; + } + else + { + if ($dial_method == 'MANUAL') + { + $auto_dial_level='0'; + $adlSQL = "auto_dial_level='0',"; + } + else + { + $adlSQL = ""; + if ($auto_dial_level < 1) + { + $auto_dial_level = "1.0"; + $adlSQL = "auto_dial_level='$auto_dial_level',"; + } + } + } + if ( (!ereg("DISABLED",$list_order_mix)) and ($hopper_level < 100) ) + {$hopper_level='100';} + + $stmtA="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',hopper_level='$hopper_level', $adlSQL lead_filter_id='$lead_filter_id',dial_method='$dial_method',adaptive_intensity='$adaptive_intensity',campaign_changedate='$SQLdate',list_order_mix='$list_order_mix' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmtA, $link); + + if ($reset_hopper == 'Y') + { + echo "
RESETTING CAMPAIGN LEAD HOPPER\n"; + echo "
- Wait 1 minute before dialing next number\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id' and status IN('READY','QUEUE','DONE');;"; + $rslt=mysql_query($stmt, $link); + + ### LOG HOPPER RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|CAMPAIGN HOPPERRESET|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CAMPAIGN INFO|$PHP_AUTH_USER|$ip|$stmtA|$reset_hopper|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=34; # go to campaign modification form below +} + +###################### +# ADD=45 modify campaign lead recycle in the system +###################### + +if ($ADD==45) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or ($attempt_delay < 120) or ($attempt_maximum < 1) or ($attempt_maximum > 10) ) + { + echo "
CAMPAIGN LEAD RECYCLE NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 6 characters in length\n"; + echo "
attempt delay must be at least 120 seconds\n"; + echo "
maximum attempts must be from 1 to 10\n"; + } + else + { + echo "
CAMPAIGN LEAD MODIFIED: $campaign_id - $status - $attempt_delay\n"; + + $stmt="UPDATE vicidial_lead_recycle SET attempt_delay='$attempt_delay',attempt_maximum='$attempt_maximum',active='$active' where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LEAD RECYCLE |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$SUB=25; +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=47 modify agent pause code in the system +###################### + +if ($ADD==47) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($pause_code) < 1) or (strlen($pause_code) > 6) or (strlen($pause_code_name) < 2) ) + { + echo "
AGENT PAUSE CODE NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
pause_code must be between 1 and 6 characters in length\n"; + echo "
pause_code name must be between 2 and 30 characters in length\n"; + } + else + { + echo "
AGENT PAUSE CODE MODIFIED: $campaign_id - $pause_code - $pause_code_name\n"; + + $stmt="UPDATE vicidial_pause_codes SET pause_code_name='$pause_code_name',billable='$billable' where campaign_id='$campaign_id' and pause_code='$pause_code';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY AGENT PAUSECODE|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$SUB=27; +$ADD=31; # go to campaign modification form below +} + + +###################### +# ADD=49 modify campaign list mix in the system +###################### + +if ($ADD==49) +{ + if ($LOGmodify_campaigns==1) + { + ##### MODIFY a list mix container entry ##### + if ($stage=='MODIFY') + { + echo ""; + + $Flist_mix_container = "list_mix_container_$vcl_id"; + $Fmix_method = "mix_method_$vcl_id"; + $Fstatus = "status_$vcl_id"; + $Fvcl_name = "vcl_name_$vcl_id"; + + if (isset($_GET[$Flist_mix_container])) {$list_mix_container=$_GET[$Flist_mix_container];} + elseif (isset($_POST[$Flist_mix_container])) {$list_mix_container=$_POST[$Flist_mix_container];} + if (isset($_GET[$Fmix_method])) {$mix_method=$_GET[$Fmix_method];} + elseif (isset($_POST[$Fmix_method])) {$mix_method=$_POST[$Fmix_method];} + if (isset($_GET[$Fstatus])) {$status=$_GET[$Fstatus];} + elseif (isset($_POST[$Fstatus])) {$status=$_POST[$Fstatus];} + if (isset($_GET[$Fvcl_name])) {$vcl_name=$_GET[$Fvcl_name];} + elseif (isset($_POST[$Fvcl_name])) {$vcl_name=$_POST[$Fvcl_name];} + $list_mix_container = preg_replace("/:$/","",$list_mix_container); + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) or (strlen($list_mix_container) < 6) or (strlen($vcl_name) < 2) ) + { + echo "
LIST MIX NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + echo "
vcl_name name must be between 2 and 30 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_campaigns_list_mix SET vcl_name='$vcl_name',mix_method='$mix_method',list_mix_container='$list_mix_container' where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
LIST MIX MODIFIED: $campaign_id - $vcl_id - $vcl_name\n"; + } + } + + ##### ADD a list mix container entry ##### + if ($stage=='ADD') + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) or (strlen($list_id) < 1) ) + { + echo "
LIST MIX NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + echo "
list_id must be at least 2 characters in length\n"; + } + else + { + $stmt="SELECT list_mix_container from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $OLDlist_mix_container = $row[0]; + $NEWlist_mix_container = "$OLDlist_mix_container:$list_id|10|0| -|"; + + $stmt="UPDATE vicidial_campaigns_list_mix SET list_mix_container='$NEWlist_mix_container' where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
LIST MIX MODIFIED: $campaign_id - $vcl_id - $list_id\n"; + } + } + + ##### REMOVE a list mix container entry ##### + if ($stage=='REMOVE') + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) or (strlen($list_id) < 1) ) + { + echo "
LIST MIX NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + echo "
list_id must be at least 2 characters in length\n"; + } + else + { + $stmt="SELECT list_mix_container from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $MIXentries = $MT; + $MIXentries = explode(":", $row[0]); + $Ms_to_print = (count($MIXentries) - 0); + + if ($Ms_to_print < 2) + { + echo "
LIST MIX NOT MODIFIED: You cannot delete the last list_id entry from a list mix\n"; + } + else + { + $MIXdetailsPCT = explode('|', $MIXentries[$mix_container_item]); + $MIXpercentPCT = $MIXdetailsPCT[2]; + + $q=0; + while ($Ms_to_print > $q) + { + if ( ($mix_container_item > $q) or ($mix_container_item < $q) ) + { + if ( ($q==0) and ($mix_container_item > 0) ) + { + $MIXdetailsONE = explode('|', $MIXentries[$q]); + $MIXpercentONE = ($MIXdetailsONE[2] + $MIXpercentPCT); + $NEWlist_mix_container .= "$MIXdetailsONE[0]|$MIXdetailsONE[1]|$MIXpercentONE|$MIXdetailsONE[3]|:"; + } + else + { + if ( ($q==1) and ($mix_container_item < 1) ) + { + $MIXdetailsONE = explode('|', $MIXentries[$q]); + $MIXpercentONE = ($MIXdetailsONE[2] + $MIXpercentPCT); + $NEWlist_mix_container .= "$MIXdetailsONE[0]|$MIXdetailsONE[1]|$MIXpercentONE|$MIXdetailsONE[3]|:"; + } + else + { + $NEWlist_mix_container .= "$MIXentries[$q]:"; + } + } + } + $q++; + } + $NEWlist_mix_container = preg_replace("/.$/",'',$NEWlist_mix_container); + + $stmt="UPDATE vicidial_campaigns_list_mix SET list_mix_container='$NEWlist_mix_container' where campaign_id='$campaign_id' and vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
LIST MIX MODIFIED: $campaign_id - $vcl_id - $list_id - $mix_container_item\n"; + } + } + } + + ##### ADD a NEW list mix ##### + if ($stage=='NEWMIX') + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) or (strlen($vcl_name) < 2) ) + { + echo "
LIST MIX NOT ADDED - Please go back and look at the data you entered\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + echo "
vcl_name must be at least 2 characters in length\n"; + } + else + { + $stmt="SELECT count(*) from vicidial_campaigns_list_mix where vcl_id='$vcl_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + echo "
LIST MIX NOT ADDED - There is already a list mix with this ID in the system\n"; + } + else + { + $stmt="INSERT INTO vicidial_campaigns_list_mix SET list_mix_container='$list_id|1|100| $status -|',campaign_id='$campaign_id',vcl_id='$vcl_id',vcl_name='$vcl_name',mix_method='$mix_method',status='INACTIVE';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
LIST MIX ADDED: $campaign_id - $vcl_id - $vcl_name\n"; + } + } + } + + ##### DELETE an existing list mix ##### + if ($stage=='DELMIX') + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) ) + { + echo "
LIST MIX NOT DELETED - Please go back and look at the data you entered\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_campaigns_list_mix where vcl_id='$vcl_id' and campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
LIST MIX DELETED: $campaign_id - $vcl_id - $vcl_name\n"; + } + } + + ##### Set list mix entry to active ##### + if ($stage=='SETACTIVE') + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($vcl_id) < 1) ) + { + echo "
LIST MIX NOT ACTIVATED - Please go back and look at the data you entered\n"; + echo "
vcl_id must be between 1 and 20 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_campaigns_list_mix SET status='INACTIVE' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_campaigns_list_mix SET status='ACTIVE' where vcl_id='$vcl_id' and campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST MIX |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + + echo "
LIST MIX ACTIVATED: $campaign_id - $vcl_id - $vcl_name\n"; + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$SUB=29; +$ADD=31; # go to campaign modification form below +} + + +###################### +# ADD=411 submit list modifications to the system +###################### + +if ($ADD==411) +{ + if ($LOGmodify_lists==1) + { + echo ""; + + if ( (strlen($list_name) < 2) or (strlen($campaign_id) < 2) ) + { + echo "
LIST NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
list name must be at least 2 characters in length\n"; + } + else + { + echo "
LIST MODIFIED: $list_id\n"; + + $stmt="UPDATE vicidial_lists set list_name='$list_name',campaign_id='$campaign_id',active='$active',list_description='$list_description',list_changedate='$SQLdate' where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + if ($reset_list == 'Y') + { + echo "
RESETTING LIST-CALLED-STATUS\n"; + $stmt="UPDATE vicidial_list set called_since_last_reset='N' where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG RESET TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|RESET LIST CALLED |$PHP_AUTH_USER|$ip|list_name='$list_name'|\n"); + fclose($fp); + } + } + if ($campaign_id != "$old_campaign_id") + { + echo "
REMOVING LIST HOPPER LEADS FROM OLD CAMPAIGN HOPPER ($old_campaign_id)\n"; + $stmt="DELETE from vicidial_hopper where list_id='$list_id' and campaign_id='$old_campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY LIST INFO |$PHP_AUTH_USER|$ip|list_name='$list_name',campaign_id='$campaign_id',active='$active',list_description='$list_description' where list_id='$list_id'|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=311; # go to list modification form below +} + + +###################### +# ADD=4111 modify in-group info in the system +###################### + +if ($ADD==4111) +{ + if ($LOGmodify_ingroups==1) + { + echo ""; + + if ( (strlen($group_name) < 2) or (strlen($group_color) < 2) ) + { + echo "
GROUP NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
group name and group color must be at least 2 characters in length\n"; + } + else + { + echo "
GROUP MODIFIED: $group_id\n"; + + $stmt="UPDATE vicidial_inbound_groups set group_name='$group_name', group_color='$group_color', active='$active', web_form_address='" . mysql_real_escape_string($web_form_address) . "', voicemail_ext='$voicemail_ext', next_agent_call='$next_agent_call', fronter_display='$fronter_display', ingroup_script='$script_id', get_call_launch='$get_call_launch', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number',drop_message='$drop_message',drop_call_seconds='$drop_call_seconds',drop_exten='$drop_exten',call_time_id='$call_time_id',after_hours_action='$after_hours_action',after_hours_message_filename='$after_hours_message_filename',after_hours_exten='$after_hours_exten',after_hours_voicemail='$after_hours_voicemail',welcome_message_filename='$welcome_message_filename',moh_context='$moh_context',onhold_prompt_filename='$onhold_prompt_filename',prompt_interval='$prompt_interval',agent_alert_exten='$agent_alert_exten',agent_alert_delay='$agent_alert_delay',default_xfer_group='$default_xfer_group' where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY GROUP INFO |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=3111; # go to in-group modification form below +} + + + +###################### +# ADD=41111 modify remote agents info in the system +###################### + +if ($ADD==41111) +{ + if ($LOGmodify_remoteagents==1) + { + echo ""; + + if ( (strlen($server_ip) < 2) or (strlen($user_start) < 2) or (strlen($campaign_id) < 2) or (strlen($conf_exten) < 2) ) + { + echo "
REMOTE AGENTS NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
User ID Start and External Extension must be at least 2 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_remote_agents set user_start='$user_start', number_of_lines='$number_of_lines', server_ip='$server_ip', conf_exten='$conf_exten', status='$status', campaign_id='$campaign_id', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOTE AGENTS MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY REMOTE AGENTS ENTRY |$PHP_AUTH_USER|$ip|set user_start='$user_start', number_of_lines='$number_of_lines', server_ip='$server_ip', conf_exten='$conf_exten', status='$status', campaign_id='$campaign_id', closer_campaigns='$groups_value' where remote_agent_id='$remote_agent_id'|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=31111; # go to remote agents modification form below +} + + + +###################### +# ADD=411111 modify user group info in the system +###################### + +if ($ADD==411111) +{ + if ($LOGmodify_usergroups==1) + { + echo ""; + + if ( (strlen($user_group) < 2) or (strlen($group_name) < 2) ) + { + echo "
USER GROUP NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Group name and description must be at least 2 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_user_groups set user_group='$user_group', group_name='$group_name',allowed_campaigns='$campaigns_value' where user_group='$OLDuser_group';"; + $rslt=mysql_query($stmt, $link); + + echo "
USER GROUP MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY USER GROUP ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=311111; # go to user group modification form below +} + +###################### +# ADD=4111111 modify script in the system +###################### + +if ($ADD==4111111) +{ + if ($LOGmodify_scripts==1) + { + echo "\n"; + echo "\n"; + echo ""; + + if ( (strlen($script_id) < 2) or (strlen($script_name) < 2) or (strlen($script_text) < 2) ) + { + echo "
SCRIPT NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Script name, description and text must be at least 2 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_scripts set script_name='$script_name', script_comments='$script_comments', script_text='$script_text', active='$active' where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
SCRIPT MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY SCRIPT ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=3111111; # go to script modification form below +} + + +###################### +# ADD=41111111 modify filter in the system +###################### + +if ($ADD==41111111) +{ + if ($LOGmodify_filters==1) + { + echo ""; + + if ( (strlen($lead_filter_id) < 2) or (strlen($lead_filter_name) < 2) or (strlen($lead_filter_sql) < 2) ) + { + echo "
FILTER NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Filter ID, name and SQL must be at least 2 characters in length\n"; + } + else + { + $stmt="UPDATE vicidial_lead_filters set lead_filter_name='$lead_filter_name', lead_filter_comments='$lead_filter_comments', lead_filter_sql='$lead_filter_sql' where lead_filter_id='$lead_filter_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
FILTER MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY FILTER ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=31111111; # go to filter modification form below +} + + +###################### +# ADD=411111111 modify call time in the system +###################### + +if ($ADD==411111111) +{ + if ($LOGmodify_call_times==1) + { + echo ""; + + if ( (strlen($call_time_id) < 2) or (strlen($call_time_name) < 2) ) + { + echo "
CALL TIME NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Call Time ID and name must be at least 2 characters in length\n"; + } + else + { + $ct_default_start = preg_replace('/\D/', '', $ct_default_start); + $ct_default_stop = preg_replace('/\D/', '', $ct_default_stop); + $ct_sunday_start = preg_replace('/\D/', '', $ct_sunday_start); + $ct_sunday_stop = preg_replace('/\D/', '', $ct_sunday_stop); + $ct_monday_start = preg_replace('/\D/', '', $ct_monday_start); + $ct_monday_stop = preg_replace('/\D/', '', $ct_monday_stop); + $ct_tuesday_start = preg_replace('/\D/', '', $ct_tuesday_start); + $ct_tuesday_stop = preg_replace('/\D/', '', $ct_tuesday_stop); + $ct_wednesday_start = preg_replace('/\D/', '', $ct_wednesday_start); + $ct_wednesday_stop = preg_replace('/\D/', '', $ct_wednesday_stop); + $ct_thursday_start = preg_replace('/\D/', '', $ct_thursday_start); + $ct_thursday_stop = preg_replace('/\D/', '', $ct_thursday_stop); + $ct_friday_start = preg_replace('/\D/', '', $ct_friday_start); + $ct_friday_stop = preg_replace('/\D/', '', $ct_friday_stop); + $ct_saturday_start = preg_replace('/\D/', '', $ct_saturday_start); + $ct_saturday_stop = preg_replace('/\D/', '', $ct_saturday_stop); + $stmt="UPDATE vicidial_call_times set call_time_name='$call_time_name', call_time_comments='$call_time_comments', ct_default_start='$ct_default_start', ct_default_stop='$ct_default_stop', ct_sunday_start='$ct_sunday_start', ct_sunday_stop='$ct_sunday_stop', ct_monday_start='$ct_monday_start', ct_monday_stop='$ct_monday_stop', ct_tuesday_start='$ct_tuesday_start', ct_tuesday_stop='$ct_tuesday_stop', ct_wednesday_start='$ct_wednesday_start', ct_wednesday_stop='$ct_wednesday_stop', ct_thursday_start='$ct_thursday_start', ct_thursday_stop='$ct_thursday_stop', ct_friday_start='$ct_friday_start', ct_friday_stop='$ct_friday_stop', ct_saturday_start='$ct_saturday_start', ct_saturday_stop='$ct_saturday_stop' where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
CALL TIME MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY CALL TIME ENTRY |$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=311111111; # go to call time modification form below +} + + +###################### +# ADD=4111111111 modify state call time in the system +###################### + +if ($ADD==4111111111) +{ + if ($LOGmodify_call_times==1) + { + echo ""; + + if ( (strlen($call_time_id) < 2) or (strlen($call_time_name) < 2) or (strlen($state_call_time_state) < 2) ) + { + echo "
STATE CALL TIME NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
State Call Time ID, name and state must be at least 2 characters in length\n"; + } + else + { + $ct_default_start = preg_replace('/\D/', '', $ct_default_start); + $ct_default_stop = preg_replace('/\D/', '', $ct_default_stop); + $ct_sunday_start = preg_replace('/\D/', '', $ct_sunday_start); + $ct_sunday_stop = preg_replace('/\D/', '', $ct_sunday_stop); + $ct_monday_start = preg_replace('/\D/', '', $ct_monday_start); + $ct_monday_stop = preg_replace('/\D/', '', $ct_monday_stop); + $ct_tuesday_start = preg_replace('/\D/', '', $ct_tuesday_start); + $ct_tuesday_stop = preg_replace('/\D/', '', $ct_tuesday_stop); + $ct_wednesday_start = preg_replace('/\D/', '', $ct_wednesday_start); + $ct_wednesday_stop = preg_replace('/\D/', '', $ct_wednesday_stop); + $ct_thursday_start = preg_replace('/\D/', '', $ct_thursday_start); + $ct_thursday_stop = preg_replace('/\D/', '', $ct_thursday_stop); + $ct_friday_start = preg_replace('/\D/', '', $ct_friday_start); + $ct_friday_stop = preg_replace('/\D/', '', $ct_friday_stop); + $ct_saturday_start = preg_replace('/\D/', '', $ct_saturday_start); + $ct_saturday_stop = preg_replace('/\D/', '', $ct_saturday_stop); + $stmt="UPDATE vicidial_state_call_times set state_call_time_name='$call_time_name', state_call_time_comments='$call_time_comments', sct_default_start='$ct_default_start', sct_default_stop='$ct_default_stop', sct_sunday_start='$ct_sunday_start', sct_sunday_stop='$ct_sunday_stop', sct_monday_start='$ct_monday_start', sct_monday_stop='$ct_monday_stop', sct_tuesday_start='$ct_tuesday_start', sct_tuesday_stop='$ct_tuesday_stop', sct_wednesday_start='$ct_wednesday_start', sct_wednesday_stop='$ct_wednesday_stop', sct_thursday_start='$ct_thursday_start', sct_thursday_stop='$ct_thursday_stop', sct_friday_start='$ct_friday_start', sct_friday_stop='$ct_friday_stop', sct_saturday_start='$ct_saturday_start', sct_saturday_stop='$ct_saturday_stop', state_call_time_state='$state_call_time_state' where state_call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
STATE CALL TIME MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY STATE CALL TIME ENTRY|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=3111111111; # go to state call time modification form below +} + + +###################### +# ADD=41111111111 modify phone record in the system +###################### + +if ($ADD==41111111111) +{ + if ($LOGast_admin_access==1) + { + echo ""; + + $stmt="SELECT count(*) from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ( ($extension != $old_extension) or ($server_ip != $old_server_ip) ) ) + {echo "
PHONE NOT MODIFIED - there is already a Phone in the system with this extension/server\n";} + else + { + if ( (strlen($extension) < 1) or (strlen($server_ip) < 7) or (strlen($dialplan_number) < 1) or (strlen($voicemail_id) < 1) or (strlen($login) < 1) or (strlen($pass) < 1)) + {echo "
PHONE NOT MODIFIED - Please go back and look at the data you entered\n";} + else + { + echo "
PHONE MODIFIED: $extension\n"; + + $stmt="UPDATE phones set extension='$extension', dialplan_number='$dialplan_number', voicemail_id='$voicemail_id', phone_ip='$phone_ip', computer_ip='$computer_ip', server_ip='$server_ip', login='$login', pass='$pass', status='$status', active='$active', phone_type='$phone_type', fullname='$fullname', company='$company', picture='$picture', protocol='$protocol', local_gmt='$local_gmt', ASTmgrUSERNAME='$ASTmgrUSERNAME', ASTmgrSECRET='$ASTmgrSECRET', login_user='$login_user', login_pass='$login_pass', login_campaign='$login_campaign', park_on_extension='$park_on_extension', conf_on_extension='$conf_on_extension', VICIDIAL_park_on_extension='$VICIDIAL_park_on_extension', VICIDIAL_park_on_filename='$VICIDIAL_park_on_filename', monitor_prefix='$monitor_prefix', recording_exten='$recording_exten', voicemail_exten='$voicemail_exten', voicemail_dump_exten='$voicemail_dump_exten', ext_context='$ext_context', dtmf_send_extension='$dtmf_send_extension', call_out_number_group='$call_out_number_group', client_browser='$client_browser', install_directory='$install_directory', local_web_callerID_URL='" . mysql_real_escape_string($local_web_callerID_URL) . "', VICIDIAL_web_URL='" . mysql_real_escape_string($VICIDIAL_web_URL) . "', AGI_call_logging_enabled='$AGI_call_logging_enabled', user_switching_enabled='$user_switching_enabled', conferencing_enabled='$conferencing_enabled', admin_hangup_enabled='$admin_hangup_enabled', admin_hijack_enabled='$admin_hijack_enabled', admin_monitor_enabled='$admin_monitor_enabled', call_parking_enabled='$call_parking_enabled', updater_check_enabled='$updater_check_enabled', AFLogging_enabled='$AFLogging_enabled', QUEUE_ACTION_enabled='$QUEUE_ACTION_enabled', CallerID_popup_enabled='$CallerID_popup_enabled', voicemail_button_enabled='$voicemail_button_enabled', enable_fast_refresh='$enable_fast_refresh', fast_refresh_rate='$fast_refresh_rate', enable_persistant_mysql='$enable_persistant_mysql', auto_dial_next_number='$auto_dial_next_number', VDstop_rec_after_each_call='$VDstop_rec_after_each_call', DBX_server='$DBX_server', DBX_database='$DBX_database', DBX_user='$DBX_user', DBX_pass='$DBX_pass', DBX_port='$DBX_port', DBY_server='$DBY_server', DBY_database='$DBY_database', DBY_user='$DBY_user', DBY_pass='$DBY_pass', DBY_port='$DBY_port', outbound_cid='$outbound_cid', enable_sipsak_messages='$enable_sipsak_messages' where extension='$old_extension' and server_ip='$old_server_ip';"; + $rslt=mysql_query($stmt, $link); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=31111111111; # go to phone modification form below +} + + +###################### +# ADD=411111111111 modify server record in the system +###################### + +if ($ADD==411111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + + $stmt="SELECT count(*) from servers where server_id='$server_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ($server_id != $old_server_id) ) + {echo "
SERVER NOT MODIFIED - there is already a server in the system with this server_id\n";} + else + { + $stmt="SELECT count(*) from servers where server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ($server_ip != $old_server_ip) ) + {echo "
SERVER NOT MODIFIED - there is already a server in the system with this server_ip\n";} + else + { + if ( (strlen($server_id) < 1) or (strlen($server_ip) < 7) ) + {echo "
SERVER NOT MODIFIED - Please go back and look at the data you entered\n";} + else + { + echo "
SERVER MODIFIED: $server_ip\n"; + + $stmt="UPDATE servers set server_id='$server_id',server_description='$server_description',server_ip='$server_ip',active='$active',asterisk_version='$asterisk_version', max_vicidial_trunks='$max_vicidial_trunks', telnet_host='$telnet_host', telnet_port='$telnet_port', ASTmgrUSERNAME='$ASTmgrUSERNAME', ASTmgrSECRET='$ASTmgrSECRET', ASTmgrUSERNAMEupdate='$ASTmgrUSERNAMEupdate', ASTmgrUSERNAMElisten='$ASTmgrUSERNAMElisten', ASTmgrUSERNAMEsend='$ASTmgrUSERNAMEsend', local_gmt='$local_gmt', voicemail_dump_exten='$voicemail_dump_exten', answer_transfer_agent='$answer_transfer_agent', ext_context='$ext_context', sys_perf_log='$sys_perf_log', vd_server_logs='$vd_server_logs', agi_output='$agi_output', vicidial_balance_active='$vicidial_balance_active', balance_trunks_offlimits='$balance_trunks_offlimits' where server_id='$old_server_id';"; + $rslt=mysql_query($stmt, $link); + } + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=311111111111; # go to server modification form below +} + + +###################### +# ADD=421111111111 modify vicidial server trunks record in the system +###################### + +if ($ADD==421111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + $stmt="SELECT max_vicidial_trunks from servers where server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $MAXvicidial_trunks = $rowx[0]; + + $stmt="SELECT sum(dedicated_trunks) from vicidial_server_trunks where server_ip='$server_ip' and campaign_id !='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $SUMvicidial_trunks = ($rowx[0] + $dedicated_trunks); + + if ($SUMvicidial_trunks > $MAXvicidial_trunks) + { + echo "
VICIDIAL SERVER TRUNK RECORD NOT ADDED - the number of vicidial trunks is too high: $SUMvicidial_trunks / $MAXvicidial_trunks\n"; + } + else + { + if ( (strlen($campaign_id) < 2) or (strlen($server_ip) < 7) or (strlen($dedicated_trunks) < 1) or (strlen($trunk_restriction) < 1) ) + { + echo "
VICIDIAL SERVER TRUNK RECORD NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
campaign must be between 3 and 8 characters in length\n"; + echo "
server_ip delay must be at least 7 characters\n"; + echo "
trunks must be a digit from 0 to 9999\n"; + } + else + { + echo "
VICIDIAL SERVER TRUNK RECORD MODIFIED: $campaign_id - $server_ip - $dedicated_trunks - $trunk_restriction\n"; + + $stmt="UPDATE vicidial_server_trunks SET dedicated_trunks='$dedicated_trunks',trunk_restriction='$trunk_restriction' where campaign_id='$campaign_id' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY SERVER TRUNK |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=311111111111; # go to server modification form below +} + + +###################### +# ADD=4111111111111 modify conference record in the system +###################### + +if ($ADD==4111111111111) +{ + if ($LOGast_admin_access==1) + { + echo ""; + + $stmt="SELECT count(*) from conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ( ($conf_exten != $old_conf_exten) or ($server_ip != $old_server_ip) ) ) + {echo "
CONFERENCE NOT MODIFIED - there is already a Conference in the system with this extension-server\n";} + else + { + if ( (strlen($conf_exten) < 1) or (strlen($server_ip) < 7) ) + {echo "
CONFERENCE NOT MODIFIED - Please go back and look at the data you entered\n";} + else + { + echo "
CONFERENCE MODIFIED: $conf_exten\n"; + + $stmt="UPDATE conferences set conf_exten='$conf_exten',server_ip='$server_ip',extension='$extension' where conf_exten='$old_conf_exten';"; + $rslt=mysql_query($stmt, $link); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=3111111111111; # go to conference modification form below +} + + +###################### +# ADD=41111111111111 modify vicidial conference record in the system +###################### + +if ($ADD==41111111111111) +{ + if ($LOGast_admin_access==1) + { + echo ""; + + $stmt="SELECT count(*) from vicidial_conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 0) && ( ($conf_exten != $old_conf_exten) or ($server_ip != $old_server_ip) ) ) + {echo "
VICIDIAL CONFERENCE NOT MODIFIED - there is already a Conference in the system with this extension-server\n";} + else + { + if ( (strlen($conf_exten) < 1) or (strlen($server_ip) < 7) ) + {echo "
VICIDIAL CONFERENCE NOT MODIFIED - Please go back and look at the data you entered\n";} + else + { + echo "
VICIDIAL CONFERENCE MODIFIED: $conf_exten\n"; + + $stmt="UPDATE vicidial_conferences set conf_exten='$conf_exten',server_ip='$server_ip',extension='$extension' where conf_exten='$old_conf_exten';"; + $rslt=mysql_query($stmt, $link); + + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=31111111111111; # go to vicidial conference modification form below +} + + + +###################### +# ADD=411111111111111 modify vicidial system settings +###################### + +if ($ADD==411111111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + + echo "
VICIDIAL SYSTEM SETTINGS MODIFIED\n"; + + $stmt="UPDATE system_settings set use_non_latin='$use_non_latin',webroot_writable='$webroot_writable',enable_queuemetrics_logging='$enable_queuemetrics_logging',queuemetrics_server_ip='$queuemetrics_server_ip',queuemetrics_dbname='$queuemetrics_dbname',queuemetrics_login='$queuemetrics_login',queuemetrics_pass='$queuemetrics_pass',queuemetrics_url='$queuemetrics_url',queuemetrics_log_id='$queuemetrics_log_id',queuemetrics_eq_prepend='$queuemetrics_eq_prepend',vicidial_agent_disable='$vicidial_agent_disable',allow_sipsak_messages='$allow_sipsak_messages',admin_home_url='$admin_home_url',enable_agc_xfer_log='$enable_agc_xfer_log';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY SYSTEM SETTINGS|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=311111111111111; # go to vicidial system settings form below +} + + +###################### +# ADD=421111111111111 modify/delete system status in the system +###################### + +if ($ADD==421111111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + + if (ereg('delete',$stage)) + { + if ( (strlen($status) < 1) or (preg_match("/^B$|^NA$|^DNC$|^NA$|^DROP$|^INCALL$|^QUEUE$|^NEW$/i",$status)) ) + { + echo "
SYSTEM STATUS NOT DELETED - Please go back and look at the data you entered\n"; + echo "
the system status cannot be a reserved status: B,NA,DNC,NA,DROP,INCALL,QUEUE,NEW\n"; + echo "
the system status needs to be at least 1 characters in length\n"; + } + else + { + echo "
SYSTEM STATUS DELETED: $status\n"; + + $stmt="DELETE FROM vicidial_statuses where status='$status';"; + $rslt=mysql_query($stmt, $link); + + $stmtA="DELETE FROM vicidial_campaign_hotkeys where status='$status';"; + $rslt=mysql_query($stmtA, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE SYSTEM STATUS |$PHP_AUTH_USER|$ip|$stmt|$stmtA|\n"); + fclose($fp); + } + } + } + if (ereg('modify',$stage)) + { + if ( (strlen($status) < 1) or (strlen($status_name) < 2) ) + { + echo "
SYSTEM STATUS NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the system status needs to be at least 1 characters in length\n"; + echo "
the system status name needs to be at least 1 characters in length\n"; + } + else + { + echo "
SYSTEM STATUS MODIFIED: $status\n"; + + $stmt="UPDATE vicidial_statuses SET status_name='$status_name',selectable='$selectable',human_answered='$human_answered',category='$category' where status='$status';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY SYSTEM STATUS |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=321111111111111; # go to system settings modification form below +} + + +###################### +# ADD=431111111111111 modify/delete status category in the system +###################### + +if ($ADD==431111111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + + if ( (strlen($vsc_id) < 2) or (preg_match("/^UNDEFINED$/i",$vsc_id)) ) + { + echo "
STATUS CATEGORY NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the status category cannot be a reserved category: UNDEFINED\n"; + echo "
the status category needs to be at least 2 characters in length\n"; + } + else + { + if (ereg('delete',$stage)) + { + echo "
STATUS CATEGORY DELETED: $vsc_id\n"; + + $stmt="DELETE FROM vicidial_status_categories where vsc_id='$vsc_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE STATUS CATEGORY|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + if (ereg('modify',$stage)) + { + echo "
STATUS CATEGORY MODIFIED: $vsc_id\n"; + + $stmt="SELECT count(*) from vicidial_status_categories where tovdad_display='Y' and vsc_id NOT IN('$vsc_id');"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0] > 3) and (ereg('Y',$tovdad_display)) ) + { + $tovdad_display = 'N'; + echo "
ERROR: There are already 4 Status Categories set to TimeOnVDAD Display\n"; + } + + $stmt="UPDATE vicidial_status_categories SET vsc_name='$vsc_name',vsc_description='$vsc_description',tovdad_display='$tovdad_display' where vsc_id='$vsc_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY STATUS CATEGORY|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=331111111111111; # go to system settings modification form below +} + + + + +###################################################################################################### +###################################################################################################### +####### 5 series, delete records confirmation +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=5 confirmation before deletion of user +###################### + +if ($ADD==5) +{ + echo ""; + + if ( (strlen($user) < 2) or ($LOGdelete_users < 1) ) + { + echo "
USER NOT DELETED - Please go back and look at the data you entered\n"; + echo "
User be at least 2 characters in length\n"; + } + else + { + echo "
USER DELETION CONFIRMATION: $user\n"; + echo "

Click here to delete user $user


\n"; + } + +$ADD='3'; # go to user modification below +} + +###################### +# ADD=51 confirmation before deletion of campaign +###################### + +if ($ADD==51) +{ + echo ""; + + if ( (strlen($campaign_id) < 2) or ($LOGdelete_campaigns < 1) ) + { + echo "
CAMPAIGN NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + echo "
CAMPAIGN DELETION CONFIRMATION: $campaign_id\n"; + echo "

Click here to delete campaign $campaign_id


\n"; + } + +$ADD='31'; # go to campaign modification below +} + +###################### +# ADD=52 confirmation before logging all agents out of campaign of campaign +###################### + +if ($ADD==52) +{ + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
AGENTS NOT LOGGED OUT OF CAMPAIGN - Please go back and look at the data you entered\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + echo "
AGENT LOGOUT CONFIRMATION: $campaign_id\n"; + echo "

Click here to log all agents out of $campaign_id


\n"; + } + +$ADD='31'; # go to campaign modification below +} + +###################### +# ADD=53 confirmation before Emergency VDAC Jam Clear - deletes oldest LIVE vicidial_auto_call record +###################### + +if ($ADD==53) +{ + if (eregi('IN',$stage)) + {$group_id=$campaign_id;} + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
VDAC NOT CLEARED FOR CAMPAIGN - Please go back and look at the data you entered\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + echo "
VDAC CLEAR CONFIRMATION: $campaign_id\n"; + echo "

Click here to delete the oldest LIVE record in VDAC for $campaign_id


\n"; + } + +# go to campaign modification below +if (eregi('IN',$stage)) + {$ADD='3111';} +else + {$ADD='31';} +} + +###################### +# ADD=511 confirmation before deletion of list +###################### + +if ($ADD==511) +{ + echo ""; + + if ( (strlen($list_id) < 2) or ($LOGdelete_lists < 1) ) + { + echo "
LIST NOT DELETED - Please go back and look at the data you entered\n"; + echo "
List_id be at least 2 characters in length\n"; + } + else + { + echo "
LIST DELETION CONFIRMATION: $list_id\n"; + echo "

Click here to delete list and all of its leads $list_id


\n"; + } + +$ADD='311'; # go to campaign modification below +} + +###################### +# ADD=5111 confirmation before deletion of in-group +###################### + +if ($ADD==5111) +{ + echo ""; + + if ( (strlen($group_id) < 2) or ($LOGdelete_ingroups < 1) ) + { + echo "
IN-GROUP NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Group_id be at least 2 characters in length\n"; + } + else + { + echo "
IN-GROUP DELETION CONFIRMATION: $group_id\n"; + echo "

Click here to delete in-group $group_id


\n"; + } + +$ADD='3111'; # go to in-group modification below +} + +###################### +# ADD=51111 confirmation before deletion of remote agent record +###################### + +if ($ADD==51111) +{ + echo ""; + + if ( (strlen($remote_agent_id) < 1) or ($LOGdelete_remote_agents < 1) ) + { + echo "
REMOTE AGENT NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Remote_agent_id be at least 2 characters in length\n"; + } + else + { + echo "
REMOTE AGENT DELETION CONFIRMATION: $remote_agent_id\n"; + echo "

Click here to delete remote agent $remote_agent_id


\n"; + } + +$ADD='31111'; # go to remote agent modification below +} + +###################### +# ADD=511111 confirmation before deletion of user group record +###################### + +if ($ADD==511111) +{ + echo ""; + + if ( (strlen($user_group) < 2) or ($LOGdelete_user_groups < 1) ) + { + echo "
USER GROUP NOT DELETED - Please go back and look at the data you entered\n"; + echo "
User_group be at least 2 characters in length\n"; + } + else + { + echo "
USER GROUP DELETION CONFIRMATION: $user_group\n"; + echo "

Click here to delete user group $user_group


\n"; + } + +$ADD='311111'; # go to user group modification below +} + +###################### +# ADD=5111111 confirmation before deletion of script record +###################### + +if ($ADD==5111111) +{ + echo ""; + + if ( (strlen($script_id) < 2) or ($LOGdelete_scripts < 1) ) + { + echo "
SCRIPT NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Script_id must be at least 2 characters in length\n"; + } + else + { + echo "
SCRIPT DELETION CONFIRMATION: $script_id\n"; + echo "

Click here to delete script $script_id


\n"; + } + +$ADD='3111111'; # go to script modification below +} + +###################### +# ADD=51111111 confirmation before deletion of filter record +###################### + +if ($ADD==51111111) +{ + echo ""; + + if ( (strlen($lead_filter_id) < 2) or ($LOGdelete_filters < 1) ) + { + echo "
FILTER NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Filter ID must be at least 2 characters in length\n"; + } + else + { + echo "
FILTER DELETION CONFIRMATION: $lead_filter_id\n"; + echo "

Click here to delete filter $lead_filter_id


\n"; + } + +$ADD='31111111'; # go to filter modification below +} + +###################### +# ADD=511111111 confirmation before deletion of call time record +###################### + +if ($ADD==511111111) +{ + echo ""; + + if ( (strlen($call_time_id) < 2) or ($LOGdelete_call_times < 1) ) + { + echo "
CALL TIME NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Call Time ID must be at least 2 characters in length\n"; + } + else + { + echo "
CALL TIME DELETION CONFIRMATION: $call_time_id\n"; + echo "

Click here to delete call time $call_time_id


\n"; + } + +$ADD='311111111'; # go to call time modification below +} + +###################### +# ADD=5111111111 confirmation before deletion of state call time record +###################### + +if ($ADD==5111111111) +{ + echo ""; + + if ( (strlen($call_time_id) < 2) or ($LOGdelete_call_times < 1) ) + { + echo "
STATE CALL TIME NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Call Time ID must be at least 2 characters in length\n"; + } + else + { + echo "
STATE CALL TIME DELETION CONFIRMATION: $call_time_id\n"; + echo "

Click here to delete state call time $call_time_id


\n"; + } + +$ADD='3111111111'; # go to state call time modification below +} + + +###################### +# ADD=51111111111 confirmation before deletion of phone record +###################### + +if ($ADD==51111111111) +{ + echo ""; + + if ( (strlen($extension) < 2) or (strlen($server_ip) < 7) or ($LOGast_delete_phones < 1) ) + { + echo "
PHONE NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Extension be at least 2 characters in length\n"; + echo "
Server IP be at least 7 characters in length\n"; + } + else + { + echo "
PHONE DELETION CONFIRMATION: $extension - $server_ip\n"; + echo "

Click here to delete phone $extension - $server_ip


\n"; + } +$ADD='31111111111'; # go to phone modification below +} + + +###################### +# ADD=511111111111 confirmation before deletion of server record +###################### + +if ($ADD==511111111111) +{ + echo ""; + + if ( (strlen($server_id) < 2) or (strlen($server_ip) < 7) or ($LOGast_delete_phones < 1) ) + { + echo "
SERVER NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Server ID be at least 2 characters in length\n"; + echo "
Server IP be at least 7 characters in length\n"; + } + else + { + echo "
SERVER DELETION CONFIRMATION: $server_id - $server_ip\n"; + echo "

Click here to delete phone $server_id - $server_ip


\n"; + } +$ADD='311111111111'; # go to server modification below +} + + +###################### +# ADD=5111111111111 confirmation before deletion of conference record +###################### + +if ($ADD==5111111111111) +{ + echo ""; + + if ( (strlen($conf_exten) < 2) or (strlen($server_ip) < 7) or ($LOGast_delete_phones < 1) ) + { + echo "
CONFERENCE NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Conference must be at least 2 characters in length\n"; + echo "
Server IP be at least 7 characters in length\n"; + } + else + { + echo "
CONFERENCE DELETION CONFIRMATION: $conf_exten - $server_ip\n"; + echo "

Click here to delete phone $conf_exten - $server_ip


\n"; + } +$ADD='3111111111111'; # go to conference modification below +} + + +###################### +# ADD=51111111111111 confirmation before deletion of vicidial conference record +###################### + +if ($ADD==51111111111111) +{ + echo ""; + + if ( (strlen($conf_exten) < 2) or (strlen($server_ip) < 7) or ($LOGast_delete_phones < 1) ) + { + echo "
VICIDIAL CONFERENCE NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Conference must be at least 2 characters in length\n"; + echo "
Server IP be at least 7 characters in length\n"; + } + else + { + echo "
VICIDIAL CONFERENCE DELETION CONFIRMATION: $conf_exten - $server_ip\n"; + echo "

Click here to delete phone $conf_exten - $server_ip


\n"; + } +$ADD='31111111111111'; # go to vicidial conference modification below +} + + + +###################################################################################################### +###################################################################################################### +####### 6 series, delete records +###################################################################################################### +###################################################################################################### + + +###################### +# ADD=6 delete user record +###################### + +if ($ADD==6) +{ + echo ""; + + if ( ( strlen($user) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_users < 1) ) + { + echo "
USER NOT DELETED - Please go back and look at the data you entered\n"; + echo "
User be at least 2 characters in length\n"; + } + else + { + $stmtA="DELETE from vicidial_users where user='$user' limit 1;"; + $rslt=mysql_query($stmtA, $link); + + $stmt="DELETE from vicidial_campaign_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_inbound_group_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING USER!!!!|$PHP_AUTH_USER|$ip|$user|$stmtA|$stmt|\n"); + fclose($fp); + } + echo "
USER DELETION COMPLETED: $user\n"; + echo "

\n"; + } + +$ADD='0'; # go to user list +} + +###################### +# ADD=61 delete campaign record +###################### + +if ($ADD==61) +{ + echo ""; + + if ( ( strlen($campaign_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_campaigns < 1) ) + { + echo "
CAMPAIGN NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_campaigns where campaign_id='$campaign_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaign_agents where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_live_agents where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaign_statuses where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaign_hotkeys where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_callbacks where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaign_stats where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_lead_recycle where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaign_server_stats where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_server_trunks where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_pause_codes where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_campaigns_list_mix where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOVING LIST HOPPER LEADS FROM OLD CAMPAIGN HOPPER ($campaign_id)\n"; + $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!DELETING CAMPAIGN!|$PHP_AUTH_USER|$ip|campaign_id='$campaign_id'|\n"); + fclose($fp); + } + echo "
CAMPAIGN DELETION COMPLETED: $campaign_id\n"; + echo "

\n"; + } + +$ADD='10'; # go to campaigns list +} + +###################### +# ADD=62 Logout all agents from a campaign +###################### + +if ($ADD==62) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
AGENTS NOT LOGGED OUT OF CAMPAIGN - Please go back and look at the data you entered\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_live_agents where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!AGENT LOGOUT!!!!!!|$PHP_AUTH_USER|$ip|campaign_id='$campaign_id'|\n"); + fclose($fp); + } + echo "
AGENT LOGOUT COMPLETED: $campaign_id\n"; + echo "

\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD='31'; # go to campaign modification below +} + + +###################### +# ADD=63 Emergency VDAC Jam Clear +###################### + +if ($ADD==63) +{ + if ($LOGmodify_campaigns==1) + { + if (eregi('IN',$stage)) + {$group_id=$campaign_id;} + echo ""; + + if (strlen($campaign_id) < 2) + { + echo "
VDAC NOT CLEARED FOR CAMPAIGN - Please go back and look at the data you entered\n"; + echo "
Campaign_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_auto_calls where status='LIVE' and campaign_id='$campaign_id' order by call_time limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|EMERGENCY VDAC CLEAR|$PHP_AUTH_USER|$ip|campaign_id='$campaign_id'|\n"); + fclose($fp); + } + echo "
LAST VDAC RECORD CLEARED FOR CAMPAIGN: $campaign_id\n"; + echo "

\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +# go to campaign modification below +if (eregi('IN',$stage)) + {$ADD='3111';} +else + {$ADD='31';} +} + + +###################### +# ADD=65 delete campaign lead recycle in the system +###################### + +if ($ADD==65) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
CAMPAIGN LEAD RECYCLE NOT DELETED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 6 characters in length\n"; + echo "
attempt delay must be at least 120 seconds\n"; + echo "
maximum attempts must be from 1 to 10\n"; + } + else + { + echo "
CAMPAIGN LEAD RECYCLE DELETED: $campaign_id - $status - $attempt_delay\n"; + + $stmt="DELETE FROM vicidial_lead_recycle where campaign_id='$campaign_id' and status='$status';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE LEAD RECYCLE |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$SUB=25; +$ADD=31; # go to campaign modification form below +} + + +###################### +# ADD=66 delete auto alt dial status from the campaign +###################### + +if ($ADD==66) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and auto_alt_dial_statuses LIKE \"% $status %\";"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] < 1) + {echo "
AUTO ALT DIAL STATUS NOT DELETED - this auto alt dial status is not in this campaign\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
AUTO ALT DIAL STATUS NOT DELETED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 6 characters in length\n"; + } + else + { + echo "
AUTO ALT DIAL STATUS DELETED: $campaign_id - $status\n"; + + $stmt="SELECT auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + $auto_alt_dial_statuses = eregi_replace(" $status "," ",$row[0]); + $stmt="UPDATE vicidial_campaigns set auto_alt_dial_statuses='$auto_alt_dial_statuses' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE AUTALTDIALSTTUS|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$SUB=26; +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=67 delete agent pause code in the system +###################### + +if ($ADD==67) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($pause_code) < 1) ) + { + echo "
CAMPAIGN PAUSE CODE NOT DELETED - Please go back and look at the data you entered\n"; + echo "
pause code must be between 1 and 6 characters in length\n"; + } + else + { + echo "
CAMPAIGN PAUSE CODE DELETED: $campaign_id - $pause_code\n"; + + $stmt="DELETE FROM vicidial_pause_codes where campaign_id='$campaign_id' and pause_code='$pause_code';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE AGENT PAUSECODE|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$SUB=27; +$ADD=31; # go to campaign modification form below +} + + +###################### +# ADD=68 remove campaign dial status +###################### + +if ($ADD==68) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and dial_statuses LIKE \"% $status %\";"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] < 1) + {echo "
CAMPAIGN DIAL STATUS NOT REMOVED - this dial status is not selected for this campaign\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
CAMPAIGN DIAL STATUS NOT REMOVED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 6 characters in length\n"; + } + else + { + echo "
CAMPAIGN DIAL STATUS REMOVED: $campaign_id - $status\n"; + + $stmt="SELECT dial_statuses from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + $dial_statuses = eregi_replace(" $status "," ",$row[0]); + $stmt="UPDATE vicidial_campaigns set dial_statuses='$dial_statuses' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DIAL STATUS REMOVED |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +#$SUB=28; +$ADD=31; # go to campaign modification form below +} + +###################### +# ADD=611 delete list record and all leads within it +###################### + +if ($ADD==611) +{ + echo ""; + + if ( ( strlen($list_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_lists < 1) ) + { + echo "
LIST NOT DELETED - Please go back and look at the data you entered\n"; + echo "
List_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_lists where list_id='$list_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOVING LIST HOPPER LEADS FROM OLD CAMPAIGN HOPPER ($list_id)\n"; + $stmt="DELETE from vicidial_hopper where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
REMOVING LIST LEADS FROM VICIDIAL_LIST TABLE\n"; + $stmt="DELETE from vicidial_list where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING LIST!!!!|$PHP_AUTH_USER|$ip|list_id='$list_id'|\n"); + fclose($fp); + } + echo "
LIST DELETION COMPLETED: $list_id\n"; + echo "

\n"; + } + +$ADD='100'; # go to lists list +} + +###################### +# ADD=6111 delete in-group record +###################### + +if ($ADD==6111) +{ + echo ""; + + if ( (strlen($group_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_ingroups < 1) ) + { + echo "
IN-GROUP NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Group_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_inbound_groups where group_id='$group_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_inbound_group_agents where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + + $stmt="DELETE from vicidial_live_inbound_agents where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING IN-GROUP!!|$PHP_AUTH_USER|$ip|group_id='$group_id'|\n"); + fclose($fp); + } + echo "
IN-GROUP DELETION COMPLETED: $group_id\n"; + echo "

\n"; + } + +$ADD='1000'; # go to in-group list +} + +###################### +# ADD=61111 delete remote agent record +###################### + +if ($ADD==61111) +{ + echo ""; + + if ( (strlen($remote_agent_id) < 1) or ($CoNfIrM != 'YES') or ($LOGdelete_remote_agents < 1) ) + { + echo "
REMOTE AGENT NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Remote_agent_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_remote_agents where remote_agent_id='$remote_agent_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING RMTAGENT!!|$PHP_AUTH_USER|$ip|remote_agent_id='$remote_agent_id'|\n"); + fclose($fp); + } + echo "
REMOTE AGENT DELETION COMPLETED: $remote_agent_id\n"; + echo "

\n"; + } + +$ADD='10000'; # go to remote agents list +} + +###################### +# ADD=611111 delete user group record +###################### + +if ($ADD==611111) +{ + echo ""; + + if ( (strlen($user_group) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_user_groups < 1) ) + { + echo "
USER GROUP NOT DELETED - Please go back and look at the data you entered\n"; + echo "
User_group be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_user_groups where user_group='$user_group' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING USRGROUP!!|$PHP_AUTH_USER|$ip|user_group='$user_group'|\n"); + fclose($fp); + } + echo "
USER GROUP DELETION COMPLETED: $user_group\n"; + echo "

\n"; + } + +$ADD='100000'; # go to user group list +} + +###################### +# ADD=6111111 delete script record +###################### + +if ($ADD==6111111) +{ + echo ""; + + if ( (strlen($script_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_scripts < 1) ) + { + echo "
SCRIPT NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Script_id be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_scripts where script_id='$script_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING SCRIPT!!!!|$PHP_AUTH_USER|$ip|script_id='$script_id'|\n"); + fclose($fp); + } + echo "
SCRIPT DELETION COMPLETED: $script_id\n"; + echo "

\n"; + } + +$ADD='1000000'; # go to script list +} + + +###################### +# ADD=61111111 delete filter record +###################### + +if ($ADD==61111111) +{ + echo ""; + + if ( (strlen($lead_filter_id) < 2) or ($CoNfIrM != 'YES') or ($LOGdelete_filters < 1) ) + { + echo "
FILTER NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Filter ID must be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_lead_filters where lead_filter_id='$lead_filter_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING FILTER!!!!|$PHP_AUTH_USER|$ip|lead_filter_id='$lead_filter_id'|\n"); + fclose($fp); + } + echo "
FILTER DELETION COMPLETED: $lead_filter_id\n"; + echo "

\n"; + } + +$ADD='10000000'; # go to filter list +} + + +###################### +# ADD=611111111 delete call times record +###################### + +if ($ADD==611111111) +{ + echo ""; + + if ( (strlen($call_time_id) < 2) or ($LOGdelete_call_times < 1) ) + { + echo "
CALL TIME NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Call Time ID must be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_call_times where call_time_id='$call_time_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING CALL TIME!|$PHP_AUTH_USER|$ip|call_time_id='$call_time_id'|\n"); + fclose($fp); + } + echo "
CALL TIME DELETION COMPLETED: $call_time_id\n"; + echo "

\n"; + } + +$ADD='100000000'; # go to call times list +} + + +###################### +# ADD=6111111111 delete state call times record +###################### + +if ($ADD==6111111111) +{ + echo ""; + + if ( (strlen($call_time_id) < 2) or ($LOGdelete_call_times < 1) ) + { + echo "
STATE CALL TIME NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Call Time ID must be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_state_call_times where state_call_time_id='$call_time_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT call_time_id,ct_state_call_times from vicidial_call_times where ct_state_call_times LIKE \"%|$call_time_id|%\" order by call_time_id;"; + $rslt=mysql_query($stmt, $link); + $sct_to_print = mysql_num_rows($rslt); + $sct_list=''; + + $o=0; + while ($sct_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $sct_ids[$o] = "$rowx[0]"; + $sct_states[$o] = "$rowx[1]"; + $o++; + } + $o=0; + + while ($sct_to_print > $o) { + $sct_states[$o] = eregi_replace("\|$call_time_id\|",'|',$sct_states[$o]); + $stmt="UPDATE vicidial_call_times set ct_state_call_times='$sct_states[$o]' where call_time_id='$sct_ids[$o]';"; + $rslt=mysql_query($stmt, $link); + echo "$stmt\n"; + echo "State Rule Removed: $sct_ids[$o]
\n"; + $o++; + } + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING CALL TIME!|$PHP_AUTH_USER|$ip|state_call_time_id='$call_time_id'|\n"); + fclose($fp); + } + echo "
STATE CALL TIME DELETION COMPLETED: $call_time_id\n"; + echo "

\n"; + } + +$ADD='1000000000'; # go to call times list +} + + +###################### +# ADD=61111111111 delete phone record +###################### + +if ($ADD==61111111111) +{ + echo ""; + + if ( (strlen($extension) < 2) or (strlen($server_ip) < 7) or ($CoNfIrM != 'YES') or ($LOGast_delete_phones < 1) ) + { + echo "
PHONE NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Extension be at least 2 characters in length\n"; + echo "
Server IP be at least 7 characters in length\n"; + } + else + { + $stmt="DELETE from phones where extension='$extension' and server_ip='$server_ip' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING PHONE!!!|$PHP_AUTH_USER|$ip|extension='$extension'|server_ip='$server_ip'|\n"); + fclose($fp); + } + echo "
PHONE DELETION COMPLETED: $extension - $server_ip\n"; + echo "

\n"; + } +$ADD='10000000000'; # go to phone list +} + + +###################### +# ADD=611111111111 delete server record +###################### + +if ($ADD==611111111111) +{ + echo ""; + + if ( (strlen($server_id) < 2) or (strlen($server_ip) < 7) or ($CoNfIrM != 'YES') or ($LOGast_delete_phones < 1) ) + { + echo "
SERVER NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Server ID be at least 2 characters in length\n"; + echo "
Server IP be at least 7 characters in length\n"; + } + else + { + $stmt="DELETE from servers where server_id='$server_id' and server_ip='$server_ip' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING SERVER!!|$PHP_AUTH_USER|$ip|server_id='$server_id'|server_ip='$server_ip'|\n"); + fclose($fp); + } + echo "
SERVER DELETION COMPLETED: $server_id - $server_ip\n"; + echo "

\n"; + } +$ADD='100000000000'; # go to server list +} + + +###################### +# ADD=621111111111 delete vicidial server trunk record in the system +###################### + +if ($ADD==621111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + + if ( (strlen($campaign_id) < 2) or (strlen($server_ip) < 7) ) + { + echo "
VICIDIAL SERVER TRUNK RECORD NOT DELETED - Please go back and look at the data you entered\n"; + echo "
campaign must be between 3 and 8 characters in length\n"; + echo "
server_ip delay must be at least 7 characters\n"; + } + else + { + echo "
VICIDIAL SERVER TRUNK RECORD DELETED: $campaign_id - $server_ip\n"; + + $stmt="DELETE FROM vicidial_server_trunks where campaign_id='$campaign_id' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE SERVER TRUNK |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=311111111111; # go to server modification form below +} + + +###################### +# ADD=6111111111111 delete conference record +###################### + +if ($ADD==6111111111111) +{ + echo ""; + + if ( (strlen($conf_exten) < 2) or (strlen($server_ip) < 7) or ($CoNfIrM != 'YES') or ($LOGast_delete_phones < 1) ) + { + echo "
CONFERENCE NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Conference be at least 2 characters in length\n"; + echo "
Server IP be at least 7 characters in length\n"; + } + else + { + $stmt="DELETE from conferences where conf_exten='$conf_exten' and server_ip='$server_ip' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING CONF!!!!|$PHP_AUTH_USER|$ip|conf_exten='$conf_exten'|server_ip='$server_ip'|\n"); + fclose($fp); + } + echo "
CONFERENCE DELETION COMPLETED: $conf_exten - $server_ip\n"; + echo "

\n"; + } +$ADD='1000000000000'; # go to conference list +} + + +###################### +# ADD=61111111111111 delete vicidial conference record +###################### + +if ($ADD==61111111111111) +{ + echo ""; + + if ( (strlen($conf_exten) < 2) or (strlen($server_ip) < 7) or ($CoNfIrM != 'YES') or ($LOGast_delete_phones < 1) ) + { + echo "
VICIDIAL CONFERENCE NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Conference be at least 2 characters in length\n"; + echo "
Server IP be at least 7 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_conferences where conf_exten='$conf_exten' and server_ip='$server_ip' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!!!DELETING CONF!!!!|$PHP_AUTH_USER|$ip|conf_exten='$conf_exten'|server_ip='$server_ip'|\n"); + fclose($fp); + } + echo "
VICIDIAL CONFERENCE DELETION COMPLETED: $conf_exten - $server_ip\n"; + echo "

\n"; + } +$ADD='10000000000000'; # go to vicidial conference list +} + + + + + +###################################################################################################### +###################################################################################################### +####### 3 series, record modification forms +###################################################################################################### +###################################################################################################### + + + + +###################### +# ADD=3 modify user info in the system +###################### + +if ($ADD==3) +{ + if ($LOGmodify_users==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $user_level = $row[4]; + $user_group = $row[5]; + $phone_login = $row[6]; + $phone_pass = $row[7]; + $delete_users = $row[8]; + $delete_user_groups = $row[9]; + $delete_lists = $row[10]; + $delete_campaigns = $row[11]; + $delete_ingroups = $row[12]; + $delete_remote_agents = $row[13]; + $load_leads = $row[14]; + $campaign_detail = $row[15]; + $ast_admin_access = $row[16]; + $ast_delete_phones = $row[17]; + $delete_scripts = $row[18]; + $modify_leads = $row[19]; + $hotkeys_active = $row[20]; + $change_agent_campaign =$row[21]; + $agent_choose_ingroups =$row[22]; + $scheduled_callbacks = $row[24]; + $agentonly_callbacks = $row[25]; + $agentcall_manual = $row[26]; + $vicidial_recording = $row[27]; + $vicidial_transfers = $row[28]; + $delete_filters = $row[29]; + $alter_agent_interface_options =$row[30]; + $closer_default_blended = $row[31]; + $delete_call_times = $row[32]; + $modify_call_times = $row[33]; + $modify_users = $row[34]; + $modify_campaigns = $row[35]; + $modify_lists = $row[36]; + $modify_scripts = $row[37]; + $modify_filters = $row[38]; + $modify_ingroups = $row[39]; + $modify_usergroups = $row[40]; + $modify_remoteagents = $row[41]; + $modify_servers = $row[42]; + $view_reports = $row[43]; + $vicidial_recording_override = $row[44]; + $alter_custdata_override = $row[45]; + + if ( ($user_level >= $LOGuser_level) and ($LOGuser_level < 9) ) + { + echo "
You do not have permissions to modify this user: $row[1]\n"; + } + else + { + echo "
MODIFY A USERS RECORD: $row[1]\n"; + if ($LOGuser_level > 8) + {echo "\n";} + else + { + if ($LOGalter_agent_interface == "1") + {echo "\n";} + else + {echo "\n";} + } + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + if ( ($LOGuser_level > 8) or ($LOGalter_agent_interface == "1") ) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + if ($LOGuser_level > 8) + { + echo "\n"; + +#9BB9FB +#B9CBFD + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + echo "\n"; + echo "
User Number: $row[1]$NWB#vicidial_users-user$NWE
Password: $NWB#vicidial_users-pass$NWE
Full Name: $NWB#vicidial_users-full_name$NWE
User Level: $NWB#vicidial_users-user_level$NWE
User Group: $NWB#vicidial_users-user_group$NWE
Phone Login: $NWB#vicidial_users-phone_login$NWE
Phone Pass: $NWB#vicidial_users-phone_pass$NWE
AGENT INTERFACE OPTIONS:
Agent Choose Ingroups: $NWB#vicidial_users-agent_choose_ingroups$NWE
Hot Keys Active: $NWB#vicidial_users-hotkeys_active$NWE
Scheduled Callbacks: $NWB#vicidial_users-scheduled_callbacks$NWE
Agent-Only Callbacks: $NWB#vicidial_users-agentonly_callbacks$NWE
Agent Call Manual: $NWB#vicidial_users-agentcall_manual$NWE
Vicidial Recording: $NWB#vicidial_users-vicidial_recording$NWE
Vicidial Transfers: $NWB#vicidial_users-vicidial_transfers$NWE
Closer Default Blended: $NWB#vicidial_users-closer_default_blended$NWE
VICIDIAL Recording Override: $NWB#vicidial_users-vicidial_recording_override$NWE
Agent Alter Customer Data Override: $NWB#vicidial_users-alter_custdata_override$NWE
Campaign Ranks: $NWB#vicidial_users-campaign_ranks$NWE
\n"; + echo "\n"; + echo "$RANKcampaigns_list"; + echo "
\n"; + echo "
Inbound Groups: $NWB#vicidial_users-closer_campaigns$NWE
\n"; + echo "\n"; + echo "$RANKgroups_list"; + echo "
\n"; + echo "
ADMIN INTERFACE OPTIONS:
View Reports: $NWB#vicidial_users-view_reports$NWE
Alter Agent Interface Options: $NWB#vicidial_users-alter_agent_interface_options$NWE
Modify Users: $NWB#vicidial_users-modify_sections$NWE
Change Agent Campaign: $NWB#vicidial_users-change_agent_campaign$NWE
Delete Users: $NWB#vicidial_users-delete_users$NWE
Modify User Groups: $NWB#vicidial_users-modify_sections$NWE
Delete User Groups: $NWB#vicidial_users-delete_user_groups$NWE
Modify Lists: $NWB#vicidial_users-modify_sections$NWE
Delete Lists: $NWB#vicidial_users-delete_lists$NWE
Load Leads: $NWB#vicidial_users-load_leads$NWE
Modify Leads: $NWB#vicidial_users-modify_leads$NWE
Modify Campaigns: $NWB#vicidial_users-modify_sections$NWE
Campaign Detail: $NWB#vicidial_users-campaign_detail$NWE
Delete Campaigns: $NWB#vicidial_users-delete_campaigns$NWE
Modify In-Groups: $NWB#vicidial_users-modify_sections$NWE
Delete In-Groups: $NWB#vicidial_users-delete_ingroups$NWE
Modify Remote Agents: $NWB#vicidial_users-modify_sections$NWE
Delete Remote Agents: $NWB#vicidial_users-delete_remote_agents$NWE
Modify Scripts: $NWB#vicidial_users-modify_sections$NWE
Delete Scripts: $NWB#vicidial_users-delete_scripts$NWE
Modify Filters: $NWB#vicidial_users-modify_sections$NWE
Delete Filters: $NWB#vicidial_users-delete_filters$NWE
AGC Admin Access: $NWB#vicidial_users-ast_admin_access$NWE
AGC Delete Phones: $NWB#vicidial_users-ast_delete_phones$NWE
Modify Call Times: $NWB#vicidial_users-modify_call_times$NWE
Delete Call Times: $NWB#vicidial_users-delete_call_times$NWE
Modify Servers: $NWB#vicidial_users-modify_sections$NWE
\n"; + + if ($LOGdelete_users > 0) + { + echo "

DELETE THIS USER\n"; + } + echo "

Click here for user time sheet\n"; + echo "

Click here for user status\n"; + echo "

Click here for user stats\n"; + echo "

Click here for user CallBack Holds\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=31 modify campaign info in the system - Detail view +###################### + +if ( ($LOGcampaign_detail < 1) and ($ADD==31) ) {$ADD=34;} # send to Basic if not allowed + +if ( ($ADD==31) and ( (!eregi("$campaign_id",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) ) + {$ADD=30;} # send to not allowed screen if not in vicidial_user_groups allowed_campaigns list + +if ($ADD==31) +{ + if ($LOGmodify_campaigns==1) + { + if ($stage=='show_dialable') + { + $stmt="UPDATE vicidial_campaigns set display_dialable_count='Y' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + if ($stage=='hide_dialable') + { + $stmt="UPDATE vicidial_campaigns set display_dialable_count='N' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + + $stmt="SELECT * from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $campaign_name = $row[1]; + $dial_status_a = $row[3]; + $dial_status_b = $row[4]; + $dial_status_c = $row[5]; + $dial_status_d = $row[6]; + $dial_status_e = $row[7]; + $lead_order = $row[8]; + $allow_closers = $row[12]; + $hopper_level = $row[13]; + $auto_dial_level = $row[14]; + $next_agent_call = $row[15]; + $local_call_time = $row[16]; + $voicemail_ext = $row[17]; + $dial_timeout = $row[18]; + $dial_prefix = $row[19]; + $campaign_cid = $row[20]; + $campaign_vdad_exten = $row[21]; + $campaign_rec_exten = $row[22]; + $campaign_recording = $row[23]; + $campaign_rec_filename = $row[24]; + $script_id = $row[25]; + $get_call_launch = $row[26]; + $am_message_exten = $row[27]; + $amd_send_to_vmx = $row[28]; + $xferconf_a_dtmf = $row[29]; + $xferconf_a_number = $row[30]; + $xferconf_b_dtmf = $row[31]; + $xferconf_b_number = $row[32]; + $alt_number_dialing = $row[33]; + $scheduled_callbacks = $row[34]; + $lead_filter_id = $row[35]; + if ($lead_filter_id=='') {$lead_filter_id='NONE';} + $drop_call_seconds = $row[36]; + $safe_harbor_message = $row[37]; + $safe_harbor_exten = $row[38]; + $display_dialable_count = $row[39]; + $wrapup_seconds = $row[40]; + $wrapup_message = $row[41]; + # $closer_campaigns = $row[42]; + $use_internal_dnc = $row[43]; + $allcalls_delay = $row[44]; + $omit_phone_code = $row[45]; + $dial_method = $row[46]; + $available_only_ratio_tally = $row[47]; + $adaptive_dropped_percentage = $row[48]; + $adaptive_maximum_level = $row[49]; + $adaptive_latest_server_time = $row[50]; + $adaptive_intensity = $row[51]; + $adaptive_dl_diff_target = $row[52]; + $concurrent_transfers = $row[53]; + $auto_alt_dial = $row[54]; + $auto_alt_dial_statuses = $row[55]; + $agent_pause_codes_active = $row[56]; + $campaign_description = $row[57]; + $campaign_changedate = $row[58]; + $campaign_stats_refresh = $row[59]; + $campaign_logindate = $row[60]; + $dial_statuses = $row[61]; + $disable_alter_custdata = $row[62]; + $no_hopper_leads_logins = $row[63]; + $list_order_mix = $row[64]; + $campaign_allow_inbound = $row[65]; + $manual_dial_list_id = $row[66]; + $default_xfer_group = $row[67]; + + if (ereg("DISABLED",$list_order_mix)) + {$DEFlistDISABLE = ''; $DEFstatusDISABLED=0;} + else + {$DEFlistDISABLE = 'disabled'; $DEFstatusDISABLED=1;} + + $stmt="SELECT count(*) from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and status='ACTIVE'"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0] < 1) + { + $mixes_list="\n"; + $mixname_list["DISABLED"] = "DISABLED"; + } + else + { + ##### get list_mix listings for dynamic pulldown + $stmt="SELECT vcl_id,vcl_name from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and status='ACTIVE' limit 1"; + $rslt=mysql_query($stmt, $link); + $mixes_to_print = mysql_num_rows($rslt); + $mixes_list="\n"; + + $o=0; + while ($mixes_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $mixes_list .= "\n"; + $mixname_list["ACTIVE"] = "$rowx[0] - $rowx[1]"; + $o++; + } + } + + ##### get status listings for dynamic pulldown + $stmt="SELECT * from vicidial_statuses order by status"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $statuses_list=''; + + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $statuses_list .= "\n"; + $statname_list["$rowx[0]"] = "$rowx[1]"; + $LRstatuses_list .= "\n"; + if (eregi("Y",$rowx[2])) + {$HKstatuses_list .= "\n";} + $o++; + } + + $stmt="SELECT * from vicidial_campaign_statuses where campaign_id='$campaign_id' order by status"; + $rslt=mysql_query($stmt, $link); + $Cstatuses_to_print = mysql_num_rows($rslt); + + $o=0; + while ($Cstatuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $statuses_list .= "\n"; + $statname_list["$rowx[0]"] = "$rowx[1]"; + $LRstatuses_list .= "\n"; + if (eregi("Y",$rowx[2])) + {$HKstatuses_list .= "\n";} + $o++; + } + + $dial_statuses = preg_replace("/ -$/","",$dial_statuses); + $Dstatuses = explode(" ", $dial_statuses); + $Ds_to_print = (count($Dstatuses) -1); + + ##### get in-groups listings for dynamic pulldown list menu + $stmt="SELECT group_id,group_name from vicidial_inbound_groups $xfer_groupsSQL order by group_id"; + $rslt=mysql_query($stmt, $link); + $Xgroups_to_print = mysql_num_rows($rslt); + $Xgroups_menu=''; + $Xgroups_selected=0; + $o=0; + while ($Xgroups_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $Xgroups_menu .= "\n"; + $o++; + } + if ($Xgroups_selected < 1) + {$Xgroups_menu .= "\n";} + else + {$Xgroups_menu .= "\n";} + + + if ($SUB<1) {$camp_detail_color=$subcamp_color;} + else {$camp_detail_color=$campaigns_color;} + if ($SUB==22) {$camp_statuses_color=$subcamp_color;} + else {$camp_statuses_color=$campaigns_color;} + if ($SUB==23) {$camp_hotkeys_color=$subcamp_color;} + else {$camp_hotkeys_color=$campaigns_color;} + if ($SUB==25) {$camp_recycle_color=$subcamp_color;} + else {$camp_recycle_color=$campaigns_color;} + if ($SUB==26) {$camp_autoalt_color=$subcamp_color;} + else {$camp_autoalt_color=$campaigns_color;} + if ($SUB==27) {$camp_pause_color=$subcamp_color;} + else {$camp_pause_color=$campaigns_color;} + if ($SUB==29) {$camp_listmix_color=$subcamp_color;} + else {$camp_listmix_color=$campaigns_color;} + echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "
$row[0]: Basic Detail StatusesHotKeysLead RecyclingAuto Alt DialPause CodesList Mix Real-Time
\n"; + + echo "
\n"; + echo ""; + + echo "
\n"; + + if ($SUB < 1) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + $o=0; + while ($Ds_to_print > $o) + { + $o++; + $Dstatus = $Dstatuses[$o]; + + echo "\n"; + } + else + { + echo "$Dstatus - $statname_list[$Dstatus]         \n"; + echo "REMOVE\n"; + } + } + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + + + echo "\n"; + + echo "\n"; + + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + if ($campaign_allow_inbound == 'Y') + { + echo "\n"; + } + + echo "\n"; + + if ($allow_closers == 'Y') + { + echo "\n"; + } + + echo "\n"; + echo "
Campaign ID: $row[0]$NWB#vicidial_campaigns-campaign_id$NWE
Campaign Name: $NWB#vicidial_campaigns-campaign_name$NWE
Campaign Description: $NWB#vicidial_campaigns-campaign_description$NWE
Campaign Change Date: $campaign_changedate   $NWB#vicidial_campaigns-campaign_changedate$NWE
Campaign Login Date: $campaign_logindate   $NWB#vicidial_campaigns-campaign_logindate$NWE
Active: $NWB#vicidial_campaigns-active$NWE
Park Extension: - Filename: $NWB#vicidial_campaigns-park_ext$NWE
Web Form: $NWB#vicidial_campaigns-web_form_address$NWE
Allow Closers: $NWB#vicidial_campaigns-allow_closers$NWE
Allow Inbound and Blended: $NWB#vicidial_campaigns-campaign_allow_inbound$NWE
Dial Status $o: \n"; + + if ($DEFstatusDISABLED > 0) + { + echo "$Dstatus - $statname_list[$Dstatus]         \n"; + echo "REMOVE
Add A Dial Status:   \n"; + echo "     $NWB#vicidial_campaigns-dial_status$NWE
List Order: $NWB#vicidial_campaigns-lead_order$NWE
List Mix: $NWB#vicidial_campaigns-list_order_mix$NWE
Lead Filter: $NWB#vicidial_campaigns-lead_filter_id$NWE
Hopper Level: $NWB#vicidial_campaigns-hopper_level$NWE
Force Reset of Hopper: $NWB#vicidial_campaigns-force_reset_hopper$NWE
Dial Method: $NWB#vicidial_campaigns-dial_method$NWE
Auto Dial Level: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE       ADAPT OVERRIDE
Available Only Tally: $NWB#vicidial_campaigns-available_only_ratio_tally$NWE
Drop Percentage Limit: % $NWB#vicidial_campaigns-adaptive_dropped_percentage$NWE
Maximum Adapt Dial Level: number only $NWB#vicidial_campaigns-adaptive_maximum_level$NWE
Latest Server Time: 4 digits only $NWB#vicidial_campaigns-adaptive_latest_server_time$NWE
Adapt Intensity Modifier: $NWB#vicidial_campaigns-adaptive_intensity$NWE
Dial Level Difference Target: $NWB#vicidial_campaigns-adaptive_dl_diff_target$NWE
Concurrent Transfers: $NWB#vicidial_campaigns-concurrent_transfers$NWE
Auto Alt-Number Dialing: $NWB#vicidial_campaigns-auto_alt_dial$NWE
Next Agent Call: $NWB#vicidial_campaigns-next_agent_call$NWE
Local Call Time: $NWB#vicidial_campaigns-local_call_time$NWE
Dial Timeout: in seconds$NWB#vicidial_campaigns-dial_timeout$NWE
Dial Prefix: for 91NXXNXXXXXX value would be 9, for no dial prefix use X$NWB#vicidial_campaigns-dial_prefix$NWE
Omit Phone Code: $NWB#vicidial_campaigns-omit_phone_code$NWE
Campaign CallerID: $NWB#vicidial_campaigns-campaign_cid$NWE
Campaign VDAD exten: $NWB#vicidial_campaigns-campaign_vdad_exten$NWE
Campaign Rec exten: $NWB#vicidial_campaigns-campaign_rec_exten$NWE
Campaign Recording: $NWB#vicidial_campaigns-campaign_recording$NWE
Campaign Rec Filename: $NWB#vicidial_campaigns-campaign_rec_filename$NWE
Recording Delay: in seconds$NWB#vicidial_campaigns-allcalls_delay$NWE
Script: $NWB#vicidial_campaigns-campaign_script$NWE
Get Call Launch: $NWB#vicidial_campaigns-get_call_launch$NWE
Answering Machine Message: $NWB#vicidial_campaigns-am_message_exten$NWE
AMD Send to VM exten: $NWB#vicidial_campaigns-amd_send_to_vmx$NWE
Transfer-Conf DTMF 1: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
Transfer-Conf Number 1: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
Transfer-Conf DTMF 2: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
Transfer-Conf Number 2: $NWB#vicidial_campaigns-xferconf_a_dtmf$NWE
Alt Number Dialing: $NWB#vicidial_campaigns-alt_number_dialing$NWE
Scheduled Callbacks: $NWB#vicidial_campaigns-scheduled_callbacks$NWE
Drop Call Seconds: $NWB#vicidial_campaigns-drop_call_seconds$NWE
Voicemail: $NWB#vicidial_campaigns-voicemail_ext$NWE
Use Safe Harbor Message: $NWB#vicidial_campaigns-safe_harbor_message$NWE
Safe Harbor Exten: $NWB#vicidial_campaigns-safe_harbor_exten$NWE
Wrap Up Seconds: $NWB#vicidial_campaigns-wrapup_seconds$NWE
Wrap Up Message: $NWB#vicidial_campaigns-wrapup_message$NWE
Use Internal DNC List: $NWB#vicidial_campaigns-use_internal_dnc$NWE
Agent Pause Codes Active: $NWB#vicidial_campaigns-agent_pause_codes_active$NWE
Campaign Stats Refresh: $NWB#vicidial_campaigns-campaign_stats_refresh$NWE
Disable Alter Customer Data: $NWB#vicidial_campaigns-disable_alter_custdata$NWE
Allow No-Hopper-Leads Logins: $NWB#vicidial_campaigns-no_hopper_leads_logins$NWE
Manual Dial List ID: $NWB#vicidial_campaigns-manual_dial_list_id$NWE
Allowed Inbound Groups:
"; + echo " $NWB#vicidial_campaigns-closer_campaigns$NWE
\n"; + echo "$groups_list"; + echo "
Default Transfer Group: $NWB#vicidial_campaigns-default_xfer_group$NWE
Allowed Transfer Groups:
"; + echo " $NWB#vicidial_campaigns-xfer_groups$NWE
\n"; + echo "$XFERgroups_list"; + echo "
\n"; + + echo "
\n"; + echo "
LISTS WITHIN THIS CAMPAIGN:   $NWB#vicidial_campaign_lists$NWE
\n"; + echo "\n"; + echo "\n"; + + $active_lists = 0; + $inactive_lists = 0; + $stmt="SELECT list_id,active,list_name from vicidial_lists where campaign_id='$campaign_id'"; + $rslt=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rslt); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $o++; + if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_lists++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + echo "
LIST IDLIST NAMEACTIVE
$rowx[0]$rowx[2]$rowx[1]

\n"; + echo "
\n"; + + $filterSQL = $filtersql_list[$lead_filter_id]; + $filterSQL = eregi_replace("^and|and$|^or|or$","",$filterSQL); + if (strlen($filterSQL)>4) + {$fSQL = "and $filterSQL";} + else + {$fSQL = '';} + + $camp_lists = eregi_replace(".$","",$camp_lists); + echo "This campaign has $active_lists active lists and $inactive_lists inactive lists

\n"; + + if ($display_dialable_count == 'Y') + { + ### call function to calculate and print dialable leads + dialable_leads($DB,$link,$local_call_time,$dial_statuses,$camp_lists,$fSQL); + echo " - HIDE

"; + } + else + { + echo "Popup Dialable Leads Count"; + echo " - SHOW

"; + } + + + + + + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id='$campaign_id' and status IN('READY')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $hopper_leads = "$rowx[0]"; + + echo "This campaign has $hopper_leads leads in the dial hopper

\n"; + echo "Click here to see what leads are in the hopper right now

\n"; + echo "Click here to see all CallBack Holds in this campaign

\n"; + echo "Click here to see a VDAD report for this campaign

\n"; + echo "
\n"; + } + + + + if ($SUB==22) + { + + ##### get status category listings for dynamic pulldown + $stmt="SELECT vsc_id,vsc_name from vicidial_status_categories order by vsc_id desc"; + $rslt=mysql_query($stmt, $link); + $cats_to_print = mysql_num_rows($rslt); + $cats_list=""; + + $o=0; + while ($cats_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $cats_list .= "\n"; + $catsname_list["$rowx[0]"] = substr($rowx[1],0,20); + $o++; + } + + + echo "
\n"; + echo "
CUSTOM STATUSES WITHIN THIS CAMPAIGN:   $NWB#vicidial_campaign_statuses$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_campaign_statuses where campaign_id='$campaign_id'"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $AScategory = $rowx[5]; + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
STATUSDESCRIPTIONSELECTABLEHUMAN ANSWERDELETE
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "$rowx[0]
\n"; + echo "\n"; + echo "         \n"; + echo "   \n"; + echo "DELETE\n"; + echo "
\n"; + + echo "
ADD NEW CUSTOM CAMPAIGN STATUS
\n"; + echo "\n"; + echo "\n"; + echo "Status:   \n"; + echo "Description:   \n"; + echo "Selectable:   \n"; + echo "Human Answer:   \n"; + echo "Category: \n"; + echo "  
\n"; + echo "
\n"; + + echo "

\n"; + } + + + if ($SUB==23) + { + echo "
CUSTOM HOT KEYS WITHIN THIS CAMPAIGN:   $NWB#vicidial_campaign_hotkeys$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_campaign_hotkeys where campaign_id='$campaign_id' order by hotkey"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $o=0; + while ($statuses_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + + echo "
HOT KEYSTATUSDESCRIPTIONDELETE
$rowx[1]$rowx[0]$rowx[2]DELETE
\n"; + + echo "
ADD NEW CUSTOM CAMPAIGN HOT KEY
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Hotkey:   \n"; + echo "Status:   \n"; + echo "
\n"; + echo "

\n"; + } + + + if ($SUB==25) + { + echo "

LEAD RECYCLING WITHIN THIS CAMPAIGN:   $NWB#vicidial_lead_recycle$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_lead_recycle where campaign_id='$campaign_id' order by status"; + $rslt=mysql_query($stmt, $link); + $recycle_to_print = mysql_num_rows($rslt); + $o=0; + while ($recycle_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
STATUSATTEMPT DELAYATTEMPT MAXIMUMACTIVE DELETE
$rowx[2]
\n"; + echo "\n"; + echo "\n"; + echo "
DELETE
\n"; + + echo "
ADD NEW CAMPAIGN LEAD RECYCLE
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Status:   \n"; + echo "Attempt Delay: \n"; + echo "Attempt Maximum: \n"; + echo "
\n"; + + echo "

\n"; + } + + + if ($SUB==26) + { + echo "

AUTO ALT NUMBER DIALING FOR THIS CAMPAIGN:   $NWB#vicidial_auto_alt_dial_statuses$NWE
\n"; + echo "\n"; + echo "\n"; + + $auto_alt_dial_statuses = preg_replace("/ -$/","",$auto_alt_dial_statuses); + $AADstatuses = explode(" ", $auto_alt_dial_statuses); + $AADs_to_print = (count($AADstatuses) -1); + + $o=0; + while ($AADs_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + $o++; + + echo "\n"; + echo "\n"; + } + + echo "
STATUSESDELETE
$AADstatuses[$o]DELETE
\n"; + + echo "
ADD NEW AUTO ALT NUMBER DIALING STATUS
\n"; + echo "\n"; + echo "\n"; + echo "Status:   \n"; + echo "
\n"; + + echo "

\n"; + } + + + if ($SUB==27) + { + echo "

AGENT PAUSE CODES FOR THIS CAMPAIGN:   $NWB#vicidial_pause_codes$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_pause_codes where campaign_id='$campaign_id' order by pause_code"; + $rslt=mysql_query($stmt, $link); + $pause_codes_to_print = mysql_num_rows($rslt); + $o=0; + while ($pause_codes_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
PAUSE CODESBILLABLEMODIFYDELETE
$rowx[0]\n"; + echo "\n"; + echo "\n"; + echo "  \n"; + echo "
DELETE
\n"; + + echo "
ADD NEW AGENT PAUSE CODE
\n"; + echo "\n"; + echo "\n"; + echo "Pause Code: \n"; + echo "Pause Code Name: \n"; + echo "   Billable: \n"; + echo "
\n"; + + echo "

\n"; + } + + + if ($SUB < 1) + { + echo "

\n"; + echo "LOG ALL AGENTS OUT OF THIS CAMPAIGN

\n"; + echo "EMERGENCY VDAC CLEAR FOR THIS CAMPAIGN

\n"; + + if ($LOGdelete_campaigns > 0) + { + echo "

DELETE THIS CAMPAIGN\n"; + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=34 modify campaign info in the system - Basic View +###################### + +if ( ($ADD==34) and ( (!eregi("$campaign_id",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) ) + {$ADD=30;} # send to not allowed screen if not in vicidial_user_groups allowed_campaigns list + +if ($ADD==34) +{ + if ($LOGmodify_campaigns==1) + { + if ($stage=='show_dialable') + { + $stmt="UPDATE vicidial_campaigns set display_dialable_count='Y' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + if ($stage=='hide_dialable') + { + $stmt="UPDATE vicidial_campaigns set display_dialable_count='N' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + } + + $stmt="SELECT * from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $dial_status_a = $row[3]; + $dial_status_b = $row[4]; + $dial_status_c = $row[5]; + $dial_status_d = $row[6]; + $dial_status_e = $row[7]; + $lead_order = $row[8]; + $hopper_level = $row[13]; + $auto_dial_level = $row[14]; + $next_agent_call = $row[15]; + $local_call_time = $row[16]; + $voicemail_ext = $row[17]; + $dial_timeout = $row[18]; + $dial_prefix = $row[19]; + $campaign_cid = $row[20]; + $campaign_vdad_exten = $row[21]; + $script_id = $row[25]; + $get_call_launch = $row[26]; + $lead_filter_id = $row[35]; + if ($lead_filter_id=='') {$lead_filter_id='NONE';} + $display_dialable_count = $row[39]; + $dial_method = $row[46]; + $adaptive_intensity = $row[51]; + $campaign_description = $row[57]; + $campaign_changedate = $row[58]; + $campaign_stats_refresh = $row[59]; + $campaign_logindate = $row[60]; + $dial_statuses = $row[61]; + $list_order_mix = $row[64]; + $default_xfer_group = $row[67]; + $campaign_allow_inbound = $row[65]; + $default_xfer_group = $row[67]; + + if (ereg("DISABLED",$list_order_mix)) + {$DEFlistDISABLE = ''; $DEFstatusDISABLED=0;} + else + {$DEFlistDISABLE = 'disabled'; $DEFstatusDISABLED=1;} + + $stmt="SELECT * from vicidial_statuses order by status"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $statuses_list=''; + + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $statuses_list .= "\n"; + $statname_list["$rowx[0]"] = "$rowx[1]"; + $LRstatuses_list .= "\n"; + if (eregi("Y",$rowx[2])) + {$HKstatuses_list .= "\n";} + $o++; + } + + $stmt="SELECT * from vicidial_campaign_statuses where campaign_id='$campaign_id' order by status"; + $rslt=mysql_query($stmt, $link); + $Cstatuses_to_print = mysql_num_rows($rslt); + + $o=0; + while ($Cstatuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $statuses_list .= "\n"; + $statname_list["$rowx[0]"] = "$rowx[1]"; + $LRstatuses_list .= "\n"; + if (eregi("Y",$rowx[2])) + {$HKstatuses_list .= "\n";} + $o++; + } + + $dial_statuses = preg_replace("/ -$/","",$dial_statuses); + $Dstatuses = explode(" ", $dial_statuses); + $Ds_to_print = (count($Dstatuses) -1); + + $stmt="SELECT count(*) from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and status='ACTIVE'"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0] < 1) + { + $mixes_list="\n"; + $mixname_list["DISABLED"] = "DISABLED"; + } + else + { + ##### get list_mix listings for dynamic pulldown + $stmt="SELECT vcl_id,vcl_name from vicidial_campaigns_list_mix where campaign_id='$campaign_id' and status='ACTIVE' limit 1"; + $rslt=mysql_query($stmt, $link); + $mixes_to_print = mysql_num_rows($rslt); + $mixes_list="\n"; + + $o=0; + while ($mixes_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $mixes_list .= "\n"; + $mixname_list["ACTIVE"] = "$rowx[0] - $rowx[1]"; + $o++; + } + } + + if ($SUB<1) {$camp_detail_color=$subcamp_color;} + else {$camp_detail_color=$campaigns_color;} + if ($SUB==22) {$camp_statuses_color=$subcamp_color;} + else {$camp_statuses_color=$campaigns_color;} + if ($SUB==23) {$camp_hotkeys_color=$subcamp_color;} + else {$camp_hotkeys_color=$campaigns_color;} + if ($SUB==25) {$camp_recycle_color=$subcamp_color;} + else {$camp_recycle_color=$campaigns_color;} + if ($SUB==26) {$camp_autoalt_color=$subcamp_color;} + else {$camp_autoalt_color=$campaigns_color;} + if ($SUB==27) {$camp_pause_color=$subcamp_color;} + else {$camp_pause_color=$campaigns_color;} + if ($SUB==29) {$camp_listmix_color=$subcamp_color;} + else {$camp_listmix_color=$campaigns_color;} + echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "
$row[0]: Basic View Detail View List Mix Real-Time Screen  
\n"; + + if ($SUB < 1) + { + echo "
\n"; + echo ""; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + $o=0; + while ($Ds_to_print > $o) + { + $o++; + $Dstatus = $Dstatuses[$o]; + + echo "\n"; + } + else + { + echo "$Dstatus - $statname_list[$Dstatus]         \n"; + echo "REMOVE\n"; + } + } + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + echo "
Campaign ID: $row[0]$NWB#vicidial_campaigns-campaign_id$NWE
Campaign Name: $NWB#vicidial_campaigns-campaign_name$NWE
Campaign Description: $row[57]$NWB#vicidial_campaigns-campaign_description$NWE
Campaign Change Date: $campaign_changedate   $NWB#vicidial_campaigns-campaign_changedate$NWE
Campaign Login Date: $campaign_logindate   $NWB#vicidial_campaigns-campaign_logindate$NWE
Active: $NWB#vicidial_campaigns-active$NWE
Park Extension: $row[9] - $row[10]$NWB#vicidial_campaigns-park_ext$NWE
Web Form: $row[11]$NWB#vicidial_campaigns-web_form_address$NWE
Allow Closers: $row[12] $NWB#vicidial_campaigns-allow_closers$NWE
Default Transfer Group: $default_xfer_group $NWB#vicidial_campaigns-default_xfer_group$NWE
Allow Inbound and Blended: $campaign_allow_inbound $NWB#vicidial_campaigns-campaign_allow_inbound$NWE
Dial Status $o: \n"; + if ($DEFstatusDISABLED > 0) + { + echo "$Dstatus - $statname_list[$Dstatus]         \n"; + echo "REMOVE
Add A Dial Status:   \n"; + echo "     $NWB#vicidial_campaigns-dial_status$NWE
List Order: $NWB#vicidial_campaigns-lead_order$NWE
List Mix: $NWB#vicidial_campaigns-list_order_mix$NWE
Lead Filter: $NWB#vicidial_campaigns-lead_filter_id$NWE
Hopper Level: $NWB#vicidial_campaigns-hopper_level$NWE
Force Reset of Hopper: $NWB#vicidial_campaigns-force_reset_hopper$NWE
Dial Method: $NWB#vicidial_campaigns-dial_method$NWE
Auto Dial Level: (0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE
Adapt Intensity Modifier: $NWB#vicidial_campaigns-adaptive_intensity$NWE
Script: $script_id
Get Call Launch: $get_call_launch
\n"; + + echo "
\n"; + echo "
LISTS WITHIN THIS CAMPAIGN:   $NWB#vicidial_campaign_lists$NWE
\n"; + echo "\n"; + echo "\n"; + + $active_lists = 0; + $inactive_lists = 0; + $stmt="SELECT list_id,active,list_name from vicidial_lists where campaign_id='$campaign_id'"; + $rslt=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rslt); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_lists++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + + } + + echo "
LIST IDLIST NAMEACTIVE
$rowx[0]$rowx[2]$rowx[1]

\n"; + echo "
\n"; + + $filterSQL = $filtersql_list[$lead_filter_id]; + $filterSQL = eregi_replace("^and|and$|^or|or$","",$filterSQL); + if (strlen($filterSQL)>4) + {$fSQL = "and $filterSQL";} + else + {$fSQL = '';} + + $camp_lists = eregi_replace(".$","",$camp_lists); + echo "This campaign has $active_lists active lists and $inactive_lists inactive lists

\n"; + + + if ($display_dialable_count == 'Y') + { + ### call function to calculate and print dialable leads + dialable_leads($DB,$link,$local_call_time,$dial_statuses,$camp_lists,$fSQL); + echo " - HIDE

"; + } + else + { + echo "Popup Dialable Leads Count"; + echo " - SHOW

"; + } + + + + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id='$campaign_id' and status IN('READY')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $hopper_leads = "$rowx[0]"; + + echo "This campaign has $hopper_leads leads in the dial hopper

\n"; + echo "Click here to see what leads are in the hopper right now

\n"; + echo "Click here to see all CallBack Holds in this campaign

\n"; + echo "Click here to see a VDAD report for this campaign

\n"; + echo "
\n"; + + echo "
\n"; + + ### list of agent rank or skill-level for this campaign + echo "
\n"; + echo "
AGENT RANKS FOR THIS CAMPAIGN:
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT user,campaign_rank,calls_today from vicidial_campaign_agents where campaign_id='$campaign_id'"; + $rsltx=mysql_query($stmt, $link); + $users_to_print = mysql_num_rows($rsltx); + + $o=0; + while ($users_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + + echo "
USER     RANK     CALLS TODAY
$rowx[0]$rowx[1]$rowx[2]

\n"; + + + echo "LOG ALL AGENTS OUT OF THIS CAMPAIGN

\n"; + + + if ($LOGdelete_campaigns > 0) + { + echo "

DELETE THIS CAMPAIGN\n"; + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=31 or 34 and SUB=29 for list mixes +###################### +if ( ( ($ADD==34) or ($ADD==31) ) and ( (!eregi("$campaign_id",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) ) + {$ADD=30;} # send to not allowed screen if not in vicidial_user_groups allowed_campaigns list + +if ( ($ADD==34) or ($ADD==31) ) +{ + if ($LOGmodify_campaigns==1) + { + if ($SUB==29) + { + ##### get list_id listings for dynamic pulldown + $stmt="SELECT list_id,list_name from vicidial_lists where campaign_id='$campaign_id' order by list_id"; + $rslt=mysql_query($stmt, $link); + $mixlists_to_print = mysql_num_rows($rslt); + $mixlists_list=""; + + $o=0; + while ($mixlists_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $mixlists_list .= "\n"; + $mixlistsname_list["$rowx[0]"] = "$rowx[1]"; + $o++; + } + + + echo "

LIST MIXES FOR THIS CAMPAIGN:   $NWB#vicidial_campaigns-list_order_mix$NWE
\n"; + + echo "

Experimental Feature in development!!! NON-FUNCTIONAL
\n"; + + + $stmt="SELECT * from vicidial_campaigns_list_mix where campaign_id='$campaign_id' order by status, vcl_id"; + $rslt=mysql_query($stmt, $link); + $listmixes = mysql_num_rows($rslt); + $o=0; + while ($listmixes > $o) + { + $rowx=mysql_fetch_row($rslt); + $vcl_id=$rowx[0]; + $o++; + + if ($o < 2) + {$tablecolor='bgcolor="#99FF99"'; $bgcolor='bgcolor="#CCFFCC"';} + else + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$tablecolor='bgcolor="#B9CBFD"'; $bgcolor='bgcolor="#9BB9FB"';} + else + {$tablecolor='bgcolor="#9BB9FB"'; $bgcolor='bgcolor="#B9CBFD"';} + } + echo "
\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + } + else + {echo "$rowx[5]\n";} + echo "\n"; + echo "\n"; + +# list_id|order|percent|statuses|:list_id|order|percent|statuses|:... +# 101|1|40| A B NA -|:102|2|25| NEW -|:103|3|30| DROP CALLBK -|:101|4|5| DROP -| +# INSERT INTO vicidial_campaigns_list_mix values('TESTMIX','TESTCAMP List Mix','TESTCAMP','101|1|40| A B NA -|:102|2|25| NEW -|:103|3|30| DROP CALLBK -|:101|4|5| DROP -|','IN_ORDER','ACTIVE'); +# INSERT INTO vicidial_campaigns_list_mix values('TESTMIX2','TESTCAMP List Mix2','TESTCAMP','101|1|20| A B -|:102|2|45| NEW -|:103|3|30| DROP CALLBK -|:101|4|5| DROP -|','IN_ORDER','ACTIVE'); +# INSERT INTO vicidial_campaigns_list_mix values('TESTMIX3','TESTCAMP List Mix3','TESTCAMP','101|1|30| A NA -|:102|2|35| NEW -|:103|3|30| DROP CALLBK -|:101|4|5| DROP -|','IN_ORDER','ACTIVE'); + + $MIXentries = $MT; + $MIXentries = explode(":", $rowx[3]); + $Ms_to_print = (count($MIXentries) - 0); + $q=0; + while ($Ms_to_print > $q) + { + $MIXdetails = explode('|', $MIXentries[$q]); + $MIXdetailsLIST = $MIXdetails[0]; + + $dial_statuses = preg_replace("/ -$/","",$dial_statuses); + $Dstatuses = explode(" ", $dial_statuses); + $Ds_to_print = (count($Dstatuses) - 0); + $Dsql = ''; + $r=0; + while ($Ds_to_print > $r) + { + $r++; + $Dsql .= "'$Dstatuses[$r]',"; + } + $Dsql = preg_replace("/,$/","",$Dsql); + + echo "\n"; + + echo "\n"; + + echo "\n"; + + + echo "\n"; + echo "\n"; + + + echo "\n"; + + + $q++; + + } + + + + + echo "\n"; + + echo "\n"; + + + echo "\n"; + + if ($q > 9) {$AE_disabled = 'DISABLED';} + else {$AE_disabled = '';} + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "$vcl_id:\n"; + echo "\n"; + echo "     DELETE LIST MIX
Status: \n"; + if ($rowx[5]=='INACTIVE') + { + echo "$rowx[5]\n"; + echo "SET TO ACTIVEMethod:\n"; + echo "
LIST IDPRIORITY% MIXSTATUSES
\n"; + echo "\n"; + echo "List: $MIXdetailsLIST   REMOVE\n"; + + + + echo " \n"; + echo "ADD   \n"; + echo "REMOVE\n"; + echo "
\n"; + echo "Difference %: \n"; + echo "   \n"; + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "List:
\n"; + echo "
\n"; + } + + + echo "

ADD NEW LIST MIX
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Mix ID: Mix Name: Mix Method: "; + echo "
List: Dial Status:  
\n"; + + echo "
\n"; + + } + } +} + + +###################### +# ADD=30 campaign not allowed +###################### + +if ($ADD==30) +{ +echo "
\n"; + echo ""; +echo "You do not have permission to view campaign $campaign_id\n"; +} + + +###################### +# ADD=32 display all campaign statuses +###################### +if ($ADD==32) +{ +echo "
\n"; + echo ""; + +echo "
CUSTOM CAMPAIGN STATUSES LISTINGS:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNNAMESTATUSESMODIFY
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT status from vicidial_campaign_statuses where campaign_id='$campaigns_id_list[$o]' order by status"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if ($p<1) + {echo "NONE";} + echo "MODIFY STATUSES
\n"; +} + + +###################### +# ADD=33 display all campaign hotkeys +###################### +if ($ADD==33) +{ +echo "
\n"; + echo ""; + +echo "
CAMPAIGN HOTKEYS LISTINGS:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNNAMEHOTKEYSMODIFY
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT status from vicidial_campaign_hotkeys where campaign_id='$campaigns_id_list[$o]' order by status"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if ($p<1) + {echo "NONE";} + echo "MODIFY HOTKEYS
\n"; +} + + +###################### +# ADD=35 display all campaign lead recycle entries +###################### +if ($ADD==35) +{ +echo "
\n"; + echo ""; + +echo "
CAMPAIGN LEAD RECYCLE LISTINGS:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNNAMELEAD RECYCLESMODIFY
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT status from vicidial_lead_recycle where campaign_id='$campaigns_id_list[$o]' order by status"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if ($p<1) + {echo "NONE";} + echo "MODIFY LEAD RECYCLES
\n"; +} + + +###################### +# ADD=36 display all campaign auto-alt dial entries +###################### +if ($ADD==36) +{ +echo "
\n"; + echo ""; + +echo "
CAMPAIGN LEAD AUTO-ALT DIAL LISTINGS:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNNAMEAUTO-ALT DIALMODIFY
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$campaigns_id_list[$o]';"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if (strlen($row[0])<3) + {echo "NONE";} + echo "MODIFY AUTO-ALT DIAL
\n"; +} + + +###################### +# ADD=37 display all campaign agent pause codes +###################### +if ($ADD==37) +{ +echo "
\n"; + echo ""; + +echo "
CAMPAIGN AGENT PAUSE CODE LISTINGS:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNNAMEPAUSE CODESMODIFY
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT pause_code from vicidial_pause_codes where campaign_id='$campaigns_id_list[$o]' order by pause_code;"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if ($p<1) + {echo "NONE";} + echo "MODIFY PAUSE CODES
\n"; +} + + +###################### +# ADD=39 display all campaign list mixes +###################### +if ($ADD==39) +{ +echo "
\n"; + echo ""; + +echo "
CAMPAIGN LIST MIX LISTINGS:\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + + $o=0; + while ($campaigns_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $campaigns_id_list[$o] = $row[0]; + $campaigns_name_list[$o] = $row[1]; + $o++; + } + + $o=0; + while ($campaigns_to_print > $o) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
CAMPAIGNNAMELIST MIXMODIFY
$campaigns_id_list[$o] $campaigns_name_list[$o] "; + + $stmt="SELECT vcl_id from vicidial_campaigns_list_mix where campaign_id='$campaigns_id_list[$o]' order by status,vcl_id;"; + $rslt=mysql_query($stmt, $link); + $campstatus_to_print = mysql_num_rows($rslt); + $p=0; + while ( ($campstatus_to_print > $p) and ($p < 10) ) + { + $row=mysql_fetch_row($rslt); + echo "$row[0] "; + $p++; + } + if ($p<1) + {echo "NONE";} + echo "MODIFY LIST MIX
\n"; +} + + + + + +###################### +# ADD=311 modify list info in the system +###################### + +if ($ADD==311) +{ + if ($LOGmodify_lists==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $campaign_id = $row[2]; + $active = $row[3]; + $list_description = $row[4]; + $list_changedate = $row[5]; + $list_lastcalldate = $row[6]; + + # grab names of global statuses and statuses in the selected campaign + $stmt="SELECT * from vicidial_statuses order by status"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + + $o=0; + while ($statuses_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $statuses_list["$rowx[0]"] = "$rowx[1]"; + $o++; + } + + $stmt="SELECT * from vicidial_campaign_statuses where campaign_id='$campaign_id' order by status"; + $rslt=mysql_query($stmt, $link); + $Cstatuses_to_print = mysql_num_rows($rslt); + + $o=0; + while ($Cstatuses_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $statuses_list["$rowx[0]"] = "$rowx[1]"; + $o++; + } + # end grab status names + + + echo "
MODIFY A LISTS RECORD: $row[0]
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
List ID: $row[0]$NWB#vicidial_lists-list_id$NWE
List Name: $NWB#vicidial_lists-list_name$NWE
List Description: $NWB#vicidial_lists-list_description$NWE
Campaign: $NWB#vicidial_lists-campaign_id$NWE
Active: $NWB#vicidial_lists-active$NWE
Reset Lead-Called-Status for this list: $NWB#vicidial_lists-reset_list$NWE
List Change Date: $list_changedate   $NWB#vicidial_lists-list_changedate$NWE
List Last Call Date: $list_lastcalldate   $NWB#vicidial_lists-list_lastcalldate$NWE
\n"; + + echo "
\n"; + echo "
STATUSES WITHIN THIS LIST:
\n"; + echo "\n"; + echo "\n"; + + $leads_in_list = 0; + $leads_in_list_N = 0; + $leads_in_list_Y = 0; + $stmt="SELECT status,called_since_last_reset,count(*) from vicidial_list where list_id='$list_id' group by status,called_since_last_reset order by status,called_since_last_reset"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + + $o=0; + $lead_list['count'] = 0; + $lead_list['Y_count'] = 0; + $lead_list['N_count'] = 0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + + $lead_list['count'] = ($lead_list['count'] + $rowx[2]); + if ($rowx[1] == 'N') + { + $since_reset = 'N'; + $since_resetX = 'Y'; + } + else + { + $since_reset = 'Y'; + $since_resetX = 'N'; + } + $lead_list[$since_reset][$rowx[0]] = ($lead_list[$since_reset][$rowx[0]] + $rowx[2]); + $lead_list[$since_reset.'_count'] = ($lead_list[$since_reset.'_count'] + $rowx[2]); + #If opposite side is not set, it may not in the future so give it a value of zero + if (!isset($lead_list[$since_resetX][$rowx[0]])) + { + $lead_list[$since_resetX][$rowx[0]]=0; + } + $o++; + } + + $o=0; + if ($lead_list['count'] > 0) + { + while (list($dispo,) = each($lead_list[$since_reset])) + { + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + if ($dispo == 'CBHOLD') + { + $CLB=""; + $CLE=""; + } + else + { + $CLB=''; + $CLE=''; + } + + echo "\n"; + $o++; + } + } + + echo "\n"; + echo "\n"; + + echo "
STATUSSTATUS NAMECALLEDNOT CALLED
$CLB$dispo$CLE$statuses_list[$dispo]".$lead_list['Y'][$dispo]."".$lead_list['N'][$dispo]."
SUBTOTALS$lead_list[Y_count]$lead_list[N_count]
TOTAL$lead_list[count]

\n"; + unset($lead_list); + + + echo "
\n"; + echo "
TIME ZONES WITHIN THIS LIST:
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT gmt_offset_now,called_since_last_reset,count(*) from vicidial_list where list_id='$list_id' group by gmt_offset_now,called_since_last_reset order by gmt_offset_now,called_since_last_reset"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + + $o=0; + $plus='+'; + $lead_list['count'] = 0; + $lead_list['Y_count'] = 0; + $lead_list['N_count'] = 0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + + $lead_list['count'] = ($lead_list['count'] + $rowx[2]); + if ($rowx[1] == 'N') + { + $since_reset = 'N'; + $since_resetX = 'Y'; + } + else + { + $since_reset = 'Y'; + $since_resetX = 'N'; + } + $lead_list[$since_reset][$rowx[0]] = ($lead_list[$since_reset][$rowx[0]] + $rowx[2]); + $lead_list[$since_reset.'_count'] = ($lead_list[$since_reset.'_count'] + $rowx[2]); + #If opposite side is not set, it may not in the future so give it a value of zero + if (!isset($lead_list[$since_resetX][$rowx[0]])) + { + $lead_list[$since_resetX][$rowx[0]]=0; + } + $o++; + } + + if ($lead_list['count'] > 0) + { + while (list($tzone,) = each($lead_list[$since_reset])) + { + $LOCALzone=3600 * $tzone; + $LOCALdate=gmdate("D M Y H:i", time() + $LOCALzone); + + if ($tzone >= 0) {$DISPtzone = "$plus$tzone";} + else {$DISPtzone = "$tzone";} + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + } + + echo "\n"; + echo "\n"; + + echo "
GMT OFFSET NOW (local time)CALLEDNOT CALLED
".$DISPtzone."     ($LOCALdate)".$lead_list['Y'][$tzone]."".$lead_list['N'][$tzone]."
SUBTOTALS$lead_list[Y_count]$lead_list[N_count]
TOTAL$lead_list[count]

\n"; + unset($lead_list); + + + + $leads_in_list = 0; + $leads_in_list_N = 0; + $leads_in_list_Y = 0; + $stmt="SELECT status,called_count,count(*) from vicidial_list where list_id='$list_id' group by status,called_count order by status,called_count"; + $rslt=mysql_query($stmt, $link); + $status_called_to_print = mysql_num_rows($rslt); + + $o=0; + $sts=0; + $first_row=1; + $all_called_first=1000; + $all_called_last=0; + while ($status_called_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $leads_in_list = ($leads_in_list + $rowx[2]); + $count_statuses[$o] = "$rowx[0]"; + $count_called[$o] = "$rowx[1]"; + $count_count[$o] = "$rowx[2]"; + $all_called_count[$rowx[1]] = ($all_called_count[$rowx[1]] + $rowx[2]); + + if ( (strlen($status[$sts]) < 1) or ($status[$sts] != "$rowx[0]") ) + { + if ($first_row) {$first_row=0;} + else {$sts++;} + $status[$sts] = "$rowx[0]"; + $status_called_first[$sts] = "$rowx[1]"; + if ($status_called_first[$sts] < $all_called_first) {$all_called_first = $status_called_first[$sts];} + } + $leads_in_sts[$sts] = ($leads_in_sts[$sts] + $rowx[2]); + $status_called_last[$sts] = "$rowx[1]"; + if ($status_called_last[$sts] > $all_called_last) {$all_called_last = $status_called_last[$sts];} + + $o++; + } + + + + + echo "
\n"; + echo "
CALLED COUNTS WITHIN THIS LIST:
\n"; + echo "\n"; + echo ""; + $first = $all_called_first; + while ($first <= $all_called_last) + { + if (eregi("1$|3$|5$|7$|9$", $first)) {$AB='bgcolor="#AFEEEE"';} + else{$AB='bgcolor="#E0FFFF"';} + echo ""; + $first++; + } + echo "\n"; + + $sts=0; + $statuses_called_to_print = count($status); + while ($statuses_called_to_print > $sts) + { + $Pstatus = $status[$sts]; + if (eregi("1$|3$|5$|7$|9$", $sts)) + {$bgcolor='bgcolor="#B9CBFD"'; $AB='bgcolor="#9BB9FB"';} + else + {$bgcolor='bgcolor="#9BB9FB"'; $AB='bgcolor="#B9CBFD"';} + # echo "$status[$sts]|$status_called_first[$sts]|$status_called_last[$sts]|$leads_in_sts[$sts]|\n"; + # echo "$status[$sts]|"; + echo ""; + + $first = $all_called_first; + while ($first <= $all_called_last) + { + if (eregi("1$|3$|5$|7$|9$", $sts)) + { + if (eregi("1$|3$|5$|7$|9$", $first)) {$AB='bgcolor="#9BB9FB"';} + else{$AB='bgcolor="#B9CBFD"';} + } + else + { + if (eregi("0$|2$|4$|6$|8$", $first)) {$AB='bgcolor="#9BB9FB"';} + else{$AB='bgcolor="#B9CBFD"';} + } + + $called_printed=0; + $o=0; + while ($status_called_to_print > $o) + { + if ( ($count_statuses[$o] == "$Pstatus") and ($count_called[$o] == "$first") ) + { + $called_printed++; + echo ""; + } + + + $o++; + } + if (!$called_printed) + {echo "";} + $first++; + } + echo "\n\n"; + + $sts++; + } + + echo ""; + $first = $all_called_first; + while ($first <= $all_called_last) + { + if (eregi("1$|3$|5$|7$|9$", $first)) {$AB='bgcolor="#AFEEEE"';} + else{$AB='bgcolor="#E0FFFF"';} + echo ""; + $first++; + } + echo "\n"; + + echo "
STATUSSTATUS NAME$firstSUBTOTAL
$Pstatus$statuses_list[$Pstatus] $count_count[$o]  $leads_in_sts[$sts]
TOTAL$all_called_count[$first]$leads_in_list

\n"; + + + + + + echo "
\n"; + + echo "

Click here to see all CallBack Holds in this list

\n"; + + if ($LOGdelete_lists > 0) + { + echo "

DELETE THIS LIST\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + + +###################### +# ADD=3111 modify in-group info in the system +###################### + +if ($ADD==3111) +{ + if ($LOGmodify_ingroups==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_inbound_groups where group_id='$group_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $group_name = $row[1]; + $group_color = $row[2]; + $active = $row[3]; + $web_form_address = $row[4]; + $voicemail_ext = $row[5]; + $next_agent_call = $row[6]; + $fronter_display = $row[7]; + $script_id = $row[8]; + $get_call_launch = $row[9]; + $xferconf_a_dtmf = $row[10]; + $xferconf_a_number = $row[11]; + $xferconf_b_dtmf = $row[12]; + $xferconf_b_number = $row[13]; + $drop_call_seconds = $row[14]; + $drop_message = $row[15]; + $drop_exten = $row[16]; + $call_time_id = $row[17]; + $after_hours_action = $row[18]; + $after_hours_message_filename = $row[19]; + $after_hours_exten = $row[20]; + $after_hours_voicemail = $row[21]; + $welcome_message_filename = $row[22]; + $moh_context = $row[23]; + $onhold_prompt_filename = $row[24]; + $prompt_interval = $row[25]; + $agent_alert_exten = $row[26]; + $agent_alert_delay = $row[27]; + $default_xfer_group = $row[28]; + + ##### get in-groups listings for dynamic pulldown + $stmt="SELECT group_id,group_name from vicidial_inbound_groups order by group_id"; + $rslt=mysql_query($stmt, $link); + $Xgroups_to_print = mysql_num_rows($rslt); + $Xgroups_menu=''; + $Xgroups_selected=0; + $o=0; + while ($Xgroups_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $Xgroups_menu .= "\n"; + $o++; + } + if ($Xgroups_selected < 1) + {$Xgroups_menu .= "\n";} + else + {$Xgroups_menu .= "\n";} + + + echo "
MODIFY A GROUPS RECORD: $row[0]\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + echo "
Group ID: $row[0]$NWB#vicidial_inbound_groups-group_id$NWE
Group Name: $NWB#vicidial_inbound_groups-group_name$NWE
Group Color: $NWB#vicidial_inbound_groups-group_color$NWE
Active: $NWB#vicidial_inbound_groups-active$NWE
Web Form: $NWB#vicidial_inbound_groups-web_form_address$NWE
Next Agent Call: $NWB#vicidial_inbound_groups-next_agent_call$NWE
Fronter Display: $NWB#vicidial_inbound_groups-fronter_display$NWE
Script: $NWB#vicidial_inbound_groups-ingroup_script$NWE
Get Call Launch: $NWB#vicidial_inbound_groups-get_call_launch$NWE
Transfer-Conf DTMF 1: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
Transfer-Conf Number 1: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
Transfer-Conf DTMF 2: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
Transfer-Conf Number 2: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE
Drop Call Seconds: $NWB#vicidial_inbound_groups-drop_call_seconds$NWE
Voicemail: $NWB#vicidial_inbound_groups-voicemail_ext$NWE
Use Drop Message: $NWB#vicidial_inbound_groups-drop_message$NWE
Drop Exten: $NWB#vicidial_inbound_groups-drop_exten$NWE
Call Time: $NWB#vicidial_inbound_groups-call_time_id$NWE
After Hours Action: $NWB#vicidial_inbound_groups-after_hours_action$NWE
After Hours Message Filename: $NWB#vicidial_inbound_groups-after_hours_message_filename$NWE
After Hours Extension: $NWB#vicidial_inbound_groups-after_hours_exten$NWE
After Hours Voicemail: $NWB#vicidial_inbound_groups-after_hours_voicemail$NWE
Welcome Message Filename: $NWB#vicidial_inbound_groups-welcome_message_filename$NWE
Music On Hold Context: $NWB#vicidial_inbound_groups-moh_context$NWE
On Hold Prompt Filename: $NWB#vicidial_inbound_groups-onhold_prompt_filename$NWE
On Hold Prompt Interval: $NWB#vicidial_inbound_groups-prompt_interval$NWE
Agent Alert Extension: $NWB#vicidial_inbound_groups-agent_alert_exten$NWE
Agent Alert Delay: $NWB#vicidial_inbound_groups-agent_alert_delay$NWE
Default Transfer Group: $NWB#vicidial_inbound_groups-default_xfer_group$NWE
\n"; + + ### list of agent rank or skill-level for this inbound group + echo "
\n"; + echo "
AGENT RANKS FOR THIS INBOUND GROUP:
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT user,group_rank,calls_today from vicidial_inbound_group_agents where group_id='$group_id'"; + $rsltx=mysql_query($stmt, $link); + $users_to_print = mysql_num_rows($rsltx); + + $o=0; + while ($users_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + + echo "
USER     RANK     CALLS TODAY
$rowx[0]$rowx[1]$rowx[2]

\n"; + + echo "

\n"; + + echo "Click here to see a report for this inbound group

\n"; + + echo "
\n"; + + if ($LOGdelete_ingroups > 0) + { + echo "

EMERGENCY VDAC CLEAR FOR THIS IN-GROUP

\n"; + echo "

DELETE THIS IN-GROUP\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + + +###################### +# ADD=31111 modify remote agents info in the system +###################### + +if ($ADD==31111) +{ + if ($LOGmodify_remoteagents==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='$remote_agent_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + + echo "
MODIFY A REMOTE AGENTS ENTRY: $row[0]\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
User ID Start: (numbers only, incremented)$NWB#vicidial_remote_agents-user_start$NWE
Number of Lines: (numbers only)$NWB#vicidial_remote_agents-number_of_lines$NWE
Server IP: $NWB#vicidial_remote_agents-server_ip$NWE
External Extension: (dial plan number dialed to reach agents)$NWB#vicidial_remote_agents-conf_exten$NWE
Status: $NWB#vicidial_remote_agents-status$NWE
Campaign: $NWB#vicidial_remote_agents-campaign_id$NWE
Inbound Groups: \n"; + echo "$groups_list"; + echo "$NWB#vicidial_remote_agents-closer_campaigns$NWE
\n"; + echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n"; + + + if ($LOGdelete_remote_agents > 0) + { + echo "

DELETE THIS REMOTE AGENT\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=311111 modify user group info in the system +###################### + +if ($ADD==311111) +{ + if ($LOGmodify_usergroups==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_user_groups where user_group='$user_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $user_group = $row[0]; + $group_name = $row[1]; + echo ""; + + echo "
MODIFY A USERS GROUP ENTRY\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Group: (no spaces or punctuation)$NWB#vicidial_user_groups-user_group$NWE
Description: (description of group)$NWB#vicidial_user_groups-group_name$NWE
Allowed Campaigns: \n"; + echo "$campaigns_list"; + echo "$NWB#vicidial_user_groups-allowed_campaigns$NWE
\n"; + + + ### list of users in this user group + + $active_confs = 0; + $stmt="SELECT user,full_name,user_level from vicidial_users where user_group='$user_group'"; + $rsltx=mysql_query($stmt, $link); + $users_to_print = mysql_num_rows($rsltx); + + echo "
\n"; + echo "
USERS WITHIN THIS USER GROUP: $users_to_print
\n"; + echo "\n"; + echo "\n"; + + $o=0; + while ($users_to_print > $o) + { + $rowx=mysql_fetch_row($rsltx); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
USERFULL NAMELEVEL
$rowx[0]$rowx[1]$rowx[2]

\n"; + + + + echo "

Click here to see all CallBack Holds in this user group

\n"; + + if ($LOGdelete_user_groups > 0) + { + echo "

DELETE THIS USER GROUP\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=3111111 modify script info in the system +###################### + +if ($ADD==3111111) +{ + if ($LOGmodify_scripts==1) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_scripts where script_id='$script_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $script_name = $row[1]; + $script_comments = $row[2]; + $script_text = $row[3]; + $active = $row[4]; + echo ""; + + echo "
MODIFY A SCRIPT\n"; + echo "\n"; + echo "\n"; + echo "
Script ID: $script_id$NWB#vicidial_scripts-script_name$NWE
Script Name: (title of the script)$NWB#vicidial_scripts-script_name$NWE
Script Comments: $NWB#vicidial_scripts-script_comments$NWE
Active: $NWB#vicidial_scripts-active$NWE
Script Text:

Preview Script
"; + # BEGIN Insert Field + echo ""; + echo "
"; + # END Insert Field + echo " $NWB#vicidial_scripts-script_text$NWE
\n"; + + if ($LOGdelete_scripts > 0) + { + echo "

DELETE THIS SCRIPT\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=31111111 modify filter info in the system +###################### + +if ($ADD==31111111) +{ + if ($LOGmodify_filters==1) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_lead_filters where lead_filter_id='$lead_filter_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $lead_filter_name = $row[1]; + $lead_filter_comments = $row[2]; + $lead_filter_sql = $row[3]; + echo ""; + + echo "
MODIFY A FILTER\n"; + echo "\n"; + echo "\n"; + echo "
Filter ID: $lead_filter_id$NWB#vicidial_lead_filters-lead_filter_id$NWE
Filter Name: (short description of the filter)$NWB#vicidial_lead_filters-lead_filter_name$NWE
Filter Comments: $NWB#vicidial_lead_filters-lead_filter_comments$NWE
Filter SQL: $NWB#vicidial_lead_filters-lead_filter_sql$NWE
\n"; + + ##### get campaigns listing for dynamic pulldown + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + $campaigns_list=''; + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $campaigns_list .= "\n"; + $o++; + } + + echo "

"; + echo "
TEST ON CAMPAIGN:
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + if ($LOGdelete_filters > 0) + { + echo "

DELETE THIS FILTER\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=321111111 modify call time definition info in the system +###################### + +if ($ADD==321111111) +{ +if ($LOGmodify_call_times==1) +{ + +if ( ($stage=="ADD") and (strlen($state_rule)>0) ) + { + $stmt="SELECT ct_state_call_times from vicidial_call_times where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $ct_state_call_times = $row[0]; + + if (eregi("\|$",$ct_state_call_times)) + {$ct_state_call_times = "$ct_state_call_times$state_rule\|";} + else + {$ct_state_call_times = "$ct_state_call_times\|$state_rule\|";} + $stmt="UPDATE vicidial_call_times set ct_state_call_times='$ct_state_call_times' where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + echo "State Rule Added: $state_rule
\n"; + } +if ( ($stage=="REMOVE") and (strlen($state_rule)>0) ) + { + $stmt="SELECT ct_state_call_times from vicidial_call_times where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $ct_state_call_times = $row[0]; + + $ct_state_call_times = eregi_replace("\|$state_rule\|",'|',$ct_state_call_times); + $stmt="UPDATE vicidial_call_times set ct_state_call_times='$ct_state_call_times' where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + echo "State Rule Removed: $state_rule
\n"; + } + +$ADD=311111111; +} +else +{ +echo "You are not authorized to view this page. Please go back."; +} + +} + + +###################### +# ADD=311111111 modify call time definition info in the system +###################### + +if ($ADD==311111111) +{ + +if ($LOGmodify_call_times==1) +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +$ct_srs=1; +$b=0; +$srs_SQL =''; +if (strlen($ct_state_call_times)>2) + { + $state_rules = explode('|',$ct_state_call_times); + $ct_srs = ((count($state_rules)) - 1); + } +echo "\n"; +echo "\n"; +while($ct_srs >= $b) + { + if (strlen($state_rules[$b])>0) + { + $stmt="SELECT state_call_time_state,state_call_time_name from vicidial_state_call_times where state_call_time_id='$state_rules[$b]';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + echo "\n"; + $srs_SQL .= "'$state_rules[$b]',"; + $srs_state_SQL .= "'$row[0]',"; + } + $b++; + } +if (strlen($srs_SQL)>2) + { + $srs_SQL = "$srs_SQL''"; + $srs_state_SQL = "$srs_state_SQL''"; + $srs_SQL = "where state_call_time_id NOT IN($srs_SQL) and state_call_time_state NOT IN($srs_state_SQL)"; + } +else + {$srs_SQL='';} +$stmt="SELECT state_call_time_id,state_call_time_name from vicidial_state_call_times $srs_SQL order by state_call_time_id;"; +$rslt=mysql_query($stmt, $link); +$sct_to_print = mysql_num_rows($rslt); +$sct_list=''; + +$o=0; +while ($sct_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $sct_list .= "\n"; + $o++; +} +echo "\n"; +echo "\n"; + +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_call_times where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $call_time_name = $row[1]; + $call_time_comments = $row[2]; + $ct_default_start = $row[3]; + $ct_default_stop = $row[4]; + $ct_sunday_start = $row[5]; + $ct_sunday_stop = $row[6]; + $ct_monday_start = $row[7]; + $ct_monday_stop = $row[8]; + $ct_tuesday_start = $row[9]; + $ct_tuesday_stop = $row[10]; + $ct_wednesday_start = $row[11]; + $ct_wednesday_stop = $row[12]; + $ct_thursday_start = $row[13]; + $ct_thursday_stop = $row[14]; + $ct_friday_start = $row[15]; + $ct_friday_stop = $row[16]; + $ct_saturday_start = $row[17]; + $ct_saturday_stop = $row[18]; + $ct_state_call_times = $row[19]; + +echo ""; + +echo "
MODIFY A CALL TIME\n"; +echo "\n"; +echo "\n"; +echo "
Call Time ID: $call_time_id$NWB#vicidial_call_times-call_time_id$NWE
Call Time Name: (short description of the call time)$NWB#vicidial_call_times-call_time_name$NWE
Call Time Comments: $NWB#vicidial_call_times-call_time_comments$NWE
Default Start: Default Stop: $NWB#vicidial_call_times-ct_default_start$NWE
Sunday Start: Sunday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Monday Start: Monday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Tuesday Start: Tuesday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Wednesday Start: Wednesday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Thursday Start: Thursday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Friday Start: Friday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Saturday Start: Saturday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Active State Call Time Definitions for this Record:  
$state_rules[$b] - REMOVE $row[0] - $row[1]
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "Add state call time rule:


\n"; +echo "CAMPAIGNS USING THIS CALL TIME:
\n"; +echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns where local_call_time='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + $o=0; + while ($camps_to_print > $o) { + $row=mysql_fetch_row($rslt); + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]
\n"; +echo "INBOUND GROUPS USING THIS CALL TIME:
\n"; +echo "\n"; + + $stmt="SELECT group_id,group_name from vicidial_inbound_groups where call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + $o=0; + while ($camps_to_print > $o) { + $row=mysql_fetch_row($rslt); + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]
\n"; +echo "

\n"; + +if ($LOGdelete_call_times > 0) + { + echo "

DELETE THIS CALL TIME DEFINITION\n"; + } +} +else +{ +echo "You are not authorized to view this page. Please go back."; +} + +} + + +###################### +# ADD=3111111111 modify state call time definition info in the system +###################### + +if ($ADD==3111111111) +{ + +if ($LOGmodify_call_times==1) +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_state_call_times where state_call_time_id='$call_time_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $state_call_time_state =$row[1]; + $call_time_name = $row[2]; + $call_time_comments = $row[3]; + $ct_default_start = $row[4]; + $ct_default_stop = $row[5]; + $ct_sunday_start = $row[6]; + $ct_sunday_stop = $row[7]; + $ct_monday_start = $row[8]; + $ct_monday_stop = $row[9]; + $ct_tuesday_start = $row[10]; + $ct_tuesday_stop = $row[11]; + $ct_wednesday_start = $row[12]; + $ct_wednesday_stop = $row[13]; + $ct_thursday_start = $row[14]; + $ct_thursday_stop = $row[15]; + $ct_friday_start = $row[16]; + $ct_friday_stop = $row[17]; + $ct_saturday_start = $row[18]; + $ct_saturday_stop = $row[19]; + +echo ""; + +echo "
MODIFY A STATE CALL TIME
\n"; +echo "\n"; +echo "\n"; +echo "
Call Time ID: $call_time_id$NWB#vicidial_call_times-call_time_id$NWE
State Call Time State: $NWB#vicidial_call_times-state_call_time_state$NWE
State Call Time Name: (short description of the call time)$NWB#vicidial_call_times-call_time_name$NWE
State Call Time Comments: $NWB#vicidial_call_times-call_time_comments$NWE
Default Start: Default Stop: $NWB#vicidial_call_times-ct_default_start$NWE
Sunday Start: Sunday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Monday Start: Monday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Tuesday Start: Tuesday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Wednesday Start: Wednesday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Thursday Start: Thursday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Friday Start: Friday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE
Saturday Start: Saturday Stop: $NWB#vicidial_call_times-ct_sunday_start$NWE


\n"; +echo "CALL TIMES USING THIS STATE CALL TIME:
\n"; +echo "\n"; + + $stmt="SELECT call_time_id,call_time_name from vicidial_call_times where ct_state_call_times LIKE \"%|$call_time_id|%\";"; + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + $o=0; + while ($camps_to_print > $o) { + $row=mysql_fetch_row($rslt); + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]
\n"; +echo "

\n"; + +if ($LOGdelete_call_times > 0) + { + echo "

DELETE THIS STATE CALL TIME DEFINITION\n"; + } + +} +else +{ +echo "You are not authorized to view this page. Please go back."; +} + +} + + +###################### +# ADD=31111111111 modify phone record in the system +###################### + +if ($ADD==31111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from phones where extension='$extension' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + echo "
MODIFY A PHONE RECORD: $row[1]\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Phone extension: $NWB#phones-extension$NWE
Dial Plan Number: (digits only)$NWB#phones-dialplan_number$NWE
Voicemail Box: (digits only)$NWB#phones-voicemail_id$NWE
Outbound CallerID: (digits only)$NWB#phones-outbound_cid$NWE
Phone IP address: (optional)$NWB#phones-phone_ip$NWE
Computer IP address: (optional)$NWB#phones-computer_ip$NWE
Server IP: $NWB#phones-server_ip$NWE
Login: $NWB#phones-login$NWE
Password: $NWB#phones-pass$NWE
Status: $NWB#phones-status$NWE
Active Account: $NWB#phones-active$NWE
Phone Type: $NWB#phones-phone_type$NWE
Full Name: $NWB#phones-fullname$NWE
Company: $NWB#phones-company$NWE
Picture: $NWB#phones-picture$NWE
New Messages: $row[14]$NWB#phones-messages$NWE
Old Messages: $row[15]$NWB#phones-old_messages$NWE
Client Protocol: $NWB#phones-protocol$NWE
Local GMT: (Do NOT Adjust for DST)$NWB#phones-local_gmt$NWE
Manager Login: $NWB#phones-ASTmgrUSERNAME$NWE
Manager Secret: $NWB#phones-ASTmgrSECRET$NWE
VICIDIAL Default User: $NWB#phones-login_user$NWE
VICIDIAL Default Pass: $NWB#phones-login_pass$NWE
VICIDIAL Default Campaign: $NWB#phones-login_campaign$NWE
Park Exten: $NWB#phones-park_on_extension$NWE
Conf Exten: $NWB#phones-conf_on_extension$NWE
VICIDIAL Park Exten: $NWB#phones-VICIDIAL_park_on_extension$NWE
VICIDIAL Park File: $NWB#phones-VICIDIAL_park_on_filename$NWE
Monitor Prefix: $NWB#phones-monitor_prefix$NWE
Recording Exten: $NWB#phones-recording_exten$NWE
VMailMain Exten: $NWB#phones-voicemail_exten$NWE
VMailDump Exten: $NWB#phones-voicemail_dump_exten$NWE
Exten Context: $NWB#phones-ext_context$NWE
DTMFSend Channel: $NWB#phones-dtmf_send_extension$NWE
Outbound Call Group: $NWB#phones-call_out_number_group$NWE
Browser Location: $NWB#phones-client_browser$NWE
Install Directory: $NWB#phones-install_directory$NWE
CallerID URL: $NWB#phones-local_web_callerID_URL$NWE
VICIDIAL Default URL: $NWB#phones-VICIDIAL_web_URL$NWE
Call Logging: $NWB#phones-AGI_call_logging_enabled$NWE
User Switching: $NWB#phones-user_switching_enabled$NWE
Conferencing: $NWB#phones-conferencing_enabled$NWE
Admin Hang Up: $NWB#phones-admin_hangup_enabled$NWE
Admin Hijack: $NWB#phones-admin_hijack_enabled$NWE
Admin Monitor: $NWB#phones-admin_monitor_enabled$NWE
Call Park: $NWB#phones-call_parking_enabled$NWE
Updater Check: $NWB#phones-updater_check_enabled$NWE
AF Logging: $NWB#phones-AFLogging_enabled$NWE
Queue Enabled: $NWB#phones-QUEUE_ACTION_enabled$NWE
CallerID Popup: $NWB#phones-CallerID_popup_enabled$NWE
VMail Button: $NWB#phones-voicemail_button_enabled$NWE
Fast Refresh: $NWB#phones-enable_fast_refresh$NWE
Fast Refresh Rate: (in ms)$NWB#phones-fast_refresh_rate$NWE
Persistant MySQL: $NWB#phones-enable_persistant_mysql$NWE
Auto Dial Next Number: $NWB#phones-auto_dial_next_number$NWE
Stop Rec after each call: $NWB#phones-VDstop_rec_after_each_call$NWE
Enable SIPSAK Messages: $NWB#phones-enable_sipsak_messages$NWE
DBX Server: (Primary DB Server)$NWB#phones-DBX_server$NWE
DBX Database: (Primary Server Database)$NWB#phones-DBX_database$NWE
DBX User: (Primary DB Login)$NWB#phones-DBX_user$NWE
DBX Pass: (Primary DB Secret)$NWB#phones-DBX_pass$NWE
DBX Port: (Primary DB Port)$NWB#phones-DBX_port$NWE
DBY Server: (Secondary DB Server)$NWB#phones-DBY_server$NWE
DBY Database: (Secondary Server Database)$NWB#phones-DBY_database$NWE
DBY User: (Secondary DB Login)$NWB#phones-DBY_user$NWE
DBY Pass: (Secondary DB Secret)$NWB#phones-DBY_pass$NWE
DBY Port: (Secondary DB Port)$NWB#phones-DBY_port$NWE
\n"; + + echo "

Click here for phone stats\n"; + + if ($LOGast_delete_phones > 0) + { + echo "

DELETE THIS PHONE\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=311111111111 modify server record in the system +###################### + +if ($ADD==311111111111) +{ + if ($LOGmodify_servers==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from servers where server_id='$server_id' or server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $server_id = $row[0]; + $server_ip = $row[2]; + + echo "
MODIFY A SERVER RECORD: $row[0]\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Server ID: $NWB#servers-server_id$NWE
Server Description: $NWB#servers-server_description$NWE
Server IP Address: $NWB#servers-server_ip$NWE
Active: $NWB#servers-active$NWE
Asterisk Version: $NWB#servers-asterisk_version$NWE
Max VICIDIAL Trunks: $NWB#servers-max_vicidial_trunks$NWE
VICIDIAL Balance Dialing: $NWB#servers-vicidial_balance_active$NWE
VICIDIAL Balance Offlimits: $NWB#servers-balance_trunks_offlimits$NWE
Telnet Host: $NWB#servers-telnet_host$NWE
Telnet Port: $NWB#servers-telnet_port$NWE
Manager User: $NWB#servers-ASTmgrUSERNAME$NWE
Manager Secret: $NWB#servers-ASTmgrSECRET$NWE
Manager Update User: $NWB#servers-ASTmgrUSERNAMEupdate$NWE
Manager Listen User: $NWB#servers-ASTmgrUSERNAMElisten$NWE
Manager Send User: $NWB#servers-ASTmgrUSERNAMEsend$NWE
Local GMT: (Do NOT Adjust for DST)$NWB#servers-local_gmt$NWE
VMail Dump Exten: $NWB#servers-voicemail_dump_exten$NWE
VICIDIAL AD extension: $NWB#servers-answer_transfer_agent$NWE
Default Context: $NWB#servers-ext_context$NWE
System Performance: $NWB#servers-sys_perf_log$NWE
Server Logs: $NWB#servers-vd_server_logs$NWE
AGI Output: $NWB#servers-agi_output$NWE
\n"; + + + ### vicidial server trunk records for this server + echo "

VICIDIAL TRUNKS FOR THIS SERVER:   $NWB#vicidial_server_trunks$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_server_trunks where server_ip='$server_ip' order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $recycle_to_print = mysql_num_rows($rslt); + $o=0; + while ($recycle_to_print > $o) { + $rowx=mysql_fetch_row($rslt); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
CAMPAIGN TRUNKS RESTRICTION DELETE
$rowx[1]
\n"; + echo "\n"; + echo "\n"; + echo "
DELETE
\n"; + + echo "
ADD NEW SERVER VICIDIAL TRUNK RECORD
\n"; + echo "\n"; + echo "\n"; + echo "TRUNKS:
\n"; + echo "CAMPAIGN:
\n"; + echo "RESTRICTION:
\n"; + echo "
\n"; + + echo "

\n"; + + + ### list of phones on this server + echo "
\n"; + echo "
PHONES WITHIN THIS SERVER:
\n"; + echo "\n"; + echo "\n"; + + $active_phones = 0; + $inactive_phones = 0; + $stmt="SELECT extension,active,fullname from phones where server_ip='$row[2]'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + if (ereg("Y", $rowx[1])) {$active_phones++; $camp_lists .= "'$rowx[0]',";} + if (ereg("N", $rowx[1])) {$inactive_phones++;} + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + + echo "
EXTENSIONNAMEACTIVE
$rowx[0]$rowx[2]$rowx[1]

\n"; + + + ### list of conferences on this server + echo "
\n"; + echo "
CONFERENCES WITHIN THIS SERVER:
\n"; + echo "\n"; + echo "\n"; + + $active_confs = 0; + $stmt="SELECT conf_exten,extension from conferences where server_ip='$row[2]'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + $active_confs++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + + echo "
CONFERENCEEXTENSION
$rowx[0]$rowx[2]

\n"; + + + ### list of vicidial conferences on this server + echo "
\n"; + echo "
VICIDIAL CONFERENCES WITHIN THIS SERVER:
\n"; + echo "\n"; + echo "\n"; + + $active_vdconfs = 0; + $stmt="SELECT conf_exten,extension from vicidial_conferences where server_ip='$row[2]'"; + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + $camp_lists=''; + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + $active_vdconfs++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + + echo "
VD CONFERENCEEXTENSION
$rowx[0]$rowx[2]

\n"; + + + echo "
\n"; + + $camp_lists = eregi_replace(".$","",$camp_lists); + echo "This server has $active_phones active phones and $inactive_phones inactive phones

\n"; + echo "This server has $active_confs active conferences

\n"; + echo "This server has $active_vdconfs active vicidial conferences

\n"; + echo "
\n"; + if ($LOGast_delete_phones > 0) + { + echo "

DELETE THIS SERVER\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=3111111111111 modify conference record in the system +###################### + +if ($ADD==3111111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $conf_exten = $row[0]; + $server_ip = $row[1]; + + echo "
MODIFY A CONFERENCE RECORD: $row[0]
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Conference: $NWB#conferences-conf_exten$NWE
Server IP: $NWB#conferences-server_ip$NWE
Current Extension:
\n"; + + echo "
\n"; + if ($LOGast_delete_phones > 0) + { + echo "

DELETE THIS CONFERENCE\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=31111111111111 modify vicidial conference record in the system +###################### + +if ($ADD==31111111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_conferences where conf_exten='$conf_exten' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $conf_exten = $row[0]; + $server_ip = $row[1]; + + echo "
MODIFY A VICIDIAL CONFERENCE RECORD: $row[0]\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Conference: $NWB#conferences-conf_exten$NWE
Server IP: $NWB#conferences-server_ip$NWE
Current Extension:
\n"; + + echo "
\n"; + if ($LOGast_delete_phones > 0) + { + echo "

DELETE THIS VICIDIAL CONFERENCE\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + + +###################### +# ADD=311111111111111 modify vicidial system settings +###################### + +if ($ADD==311111111111111) +{ + if ($LOGmodify_servers==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT version,install_date,use_non_latin,webroot_writable,enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_url,queuemetrics_log_id,queuemetrics_eq_prepend,vicidial_agent_disable,allow_sipsak_messages,admin_home_url,enable_agc_xfer_log from system_settings;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $version = $row[0]; + $install_date = $row[1]; + $use_non_latin = $row[2]; + $webroot_writable = $row[3]; + $enable_queuemetrics_logging = $row[4]; + $queuemetrics_server_ip = $row[5]; + $queuemetrics_dbname = $row[6]; + $queuemetrics_login = $row[7]; + $queuemetrics_pass = $row[8]; + $queuemetrics_url = $row[9]; + $queuemetrics_log_id = $row[10]; + $queuemetrics_eq_prepend = $row[11]; + $vicidial_agent_disable = $row[12]; + $allow_sipsak_messages = $row[13]; + $admin_home_url = $row[14]; + $enable_agc_xfer_log = $row[15]; + + echo "
MODIFY VICIDIAL SYSTEM SETTINGS\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + echo "\n"; + echo "
Version: $version
Install Date: $install_date
Use Non-Latin: $NWB#settings-use_non_latin$NWE
Webroot Writable: $NWB#settings-webroot_writable$NWE
Enable QueueMetrics Logging: $NWB#settings-enable_queuemetrics_logging$NWE
QueueMetrics Server IP: $NWB#settings-queuemetrics_server_ip$NWE
QueueMetrics DB Name: $NWB#settings-queuemetrics_dbname$NWE
QueueMetrics DB Login: $NWB#settings-queuemetrics_login$NWE
QueueMetrics DB Password: $NWB#settings-queuemetrics_pass$NWE
QueueMetrics URL: $NWB#settings-queuemetrics_url$NWE
QueueMetrics Log ID: $NWB#settings-queuemetrics_log_id$NWE
QueueMetrics EnterQueue Prepend: $NWB#settings-queuemetrics_eq_prepend$NWE
VICIDIAL Agent Disable Display: $NWB#settings-vicidial_agent_disable$NWE
Allow SIPSAK Messages: $NWB#settings-allow_sipsak_messages$NWE
Admin Home URL: $NWB#settings-admin_home_url$NWE
Enable Agent Transfer Logfile: $NWB#settings-enable_agc_xfer_log$NWE
\n"; + echo "\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + + + + + +###################### +# ADD=321111111111111 modify vicidial system statuses +###################### + +if ($ADD==321111111111111) +{ + if ($LOGmodify_servers==1) + { + echo "
\n"; + echo ""; + + echo "
\n"; + echo "VICIDIAL STATUSES WITHIN THIS SYSTEM:   $NWB#vicidial_statuses$NWE
\n"; + echo "\n"; + echo "\n"; + + ##### get status category listings for dynamic pulldown + $stmt="SELECT vsc_id,vsc_name from vicidial_status_categories order by vsc_id desc"; + $rslt=mysql_query($stmt, $link); + $cats_to_print = mysql_num_rows($rslt); + $cats_list=""; + + $o=0; + while ($cats_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $cats_list .= "\n"; + $catsname_list["$rowx[0]"] = substr($rowx[1],0,20); + $o++; + } + + + $stmt="SELECT * from vicidial_statuses order by status;"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $AScategory = $rowx[4]; + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
STATUSDESCRIPTIONSELECT-
ABLE
HUMAN
ANSWER
CATEGORYMODIFY/DELETE
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "$rowx[0]
\n"; + echo "\n"; + echo "         \n"; + echo "   \n"; + + if (preg_match("/^B$|^NA$|^DNC$|^NA$|^DROP$|^INCALL$|^QUEUE$|^NEW$/i",$rowx[0])) + { + echo "DELETE\n"; + } + else + { + echo "DELETE\n"; + } + echo "
\n"; + + echo "
ADD NEW SYSTEM STATUS
\n"; + echo "\n"; + echo "Status:   \n"; + echo "Description:
\n"; + echo "Selectable:   \n"; + echo "Human Answer:   \n"; + echo "Category: \n"; + echo "  
\n"; + echo "
\n"; + + echo "

\n"; + + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + + + + +###################### +# ADD=331111111111111 modify vicidial status categories +###################### + +if ($ADD==331111111111111) +{ + if ($LOGmodify_servers==1) + { + echo "
\n"; + echo ""; + + echo "
\n"; + echo "VICIDIAL STATUS CATEGORIES:   $NWB#vicidial_status_categories$NWE
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT * from vicidial_status_categories order by vsc_id;"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + + $Avsc_id[$o] = $rowx[0]; + $Avsc_name[$o] = $rowx[1]; + $Avsc_description[$o] = $rowx[2]; + $Atovdad_display[$o] = $rowx[3]; + + $o++; + } + $p=0; + while ($o > $p) + { + if (eregi("1$|3$|5$|7$|9$", $p)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $CATstatuses=''; + $stmt="SELECT status from vicidial_statuses where category='$Avsc_id[$p]' order by status;"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $q=0; + while ($statuses_to_print > $q) + { + $rowx=mysql_fetch_row($rslt); + $CATstatuses.=" $rowx[0]"; + $q++; + } + $stmt="SELECT status from vicidial_campaign_statuses where category='$Avsc_id[$p]' order by status;"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $q=0; + while ($statuses_to_print > $q) + { + $rowx=mysql_fetch_row($rslt); + $CATstatuses.=" $rowx[0]"; + $q++; + } + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + $p++; + } + + echo "
CATEGORYNAMETOVDADSTATUSES IN THIS CATEGORY
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "$Avsc_id[$p]
\n"; + echo "$CATstatuses"; + echo "
Description:
        \n"; + echo "   DELETE
 
\n"; + + echo "
ADD NEW STATUS CATEGORY
\n"; + echo "\n"; + echo "Category ID:   \n"; + echo "Name:   \n"; + echo "TimeOnVDAD Display:  
\n"; + echo "Description:   \n"; + echo "
\n"; + + echo "

\n"; + + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + + + + + +###################### +# ADD=550 search form +###################### + +if ($ADD==550) +{ +echo "
\n"; +echo ""; + +echo "
SEARCH FOR A USER
\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "
User Number:
Full Name:
User Level:
User Group:
\n"; + +} + +###################### +# ADD=660 user search results +###################### + +if ($ADD==660) +{ +echo "
\n"; + echo ""; + + $SQL = ''; + if ($user) {$SQL .= " user LIKE \"%$user%\" and";} + if ($full_name) {$SQL .= " full_name LIKE \"%$full_name%\" and";} + if ($user_level > 0) {$SQL .= " user_level LIKE \"%$user_level%\" and";} + if ($user_group) {$SQL .= " user_group = '$user_group' and";} + $SQL = eregi_replace(" and$", "", $SQL); + if (strlen($SQL)>5) {$SQL = "where $SQL";} + + $stmt="SELECT * from vicidial_users $SQL order by full_name desc;"; +# echo "\n|$stmt|\n"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
SEARCH RESULTS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[1]$row[3]$row[4]$row[5]MODIFY | STATS | STATUS | TIME
\n"; + +} + + +###################################################################################################### +###################################################################################################### +####### 8 series, Callback lists +###################################################################################################### +###################################################################################################### + +###################### +# ADD=8 find all callbacks on hold by a User +###################### +if ($ADD==8) +{ + if ($LOGmodify_users==1) + { + if ($SUB==89) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where user='$user' and status='LIVE' and callback_time < '$past_month_date';"; + $rslt=mysql_query($stmt, $link); + echo "
User($user) callback listings LIVE for more than one month have been made INACTIVE\n"; + } + if ($SUB==899) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where user='$user' and status='LIVE' and callback_time < '$past_week_date';"; + $rslt=mysql_query($stmt, $link); + echo "
User($user) callback listings LIVE for more than one week have been made INACTIVE\n"; + } + } +$CBinactiveLINK = "
Remove LIVE Callbacks older than one month for this user
Remove LIVE Callbacks older than one week for this user
"; + +echo ""; + + $CBquerySQLwhere = "and user='$user'"; + +echo "
USER CALLBACK HOLD LISTINGS: $user\n"; +$oldADD = "ADD=8&user=$user"; +$ADD='82'; +} + +###################### +# ADD=81 find all callbacks on hold within a Campaign +###################### +if ($ADD==81) +{ + if ($LOGmodify_campaigns==1) + { + if ($SUB==89) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where campaign_id='$campaign_id' and status='LIVE' and callback_time < '$past_month_date';"; + $rslt=mysql_query($stmt, $link); + echo "
campaign($campaign_id) callback listings LIVE for more than one month have been made INACTIVE\n"; + } + if ($SUB==899) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where campaign_id='$campaign_id' and status='LIVE' and callback_time < '$past_week_date';"; + $rslt=mysql_query($stmt, $link); + echo "
campaign($campaign_id) callback listings LIVE for more than one week have been made INACTIVE\n"; + } + } +$CBinactiveLINK = "
Remove LIVE Callbacks older than one month for this campaign
Remove LIVE Callbacks older than one week for this campaign
"; + +echo ""; + + $CBquerySQLwhere = "and campaign_id='$campaign_id'"; + +echo "
CAMPAIGN CALLBACK HOLD LISTINGS: $campaign_id\n"; +$oldADD = "ADD=81&campaign_id=$campaign_id"; +$ADD='82'; +} + +###################### +# ADD=811 find all callbacks on hold within a List +###################### +if ($ADD==811) +{ + if ($LOGmodify_lists==1) + { + if ($SUB==89) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where list_id='$list_id' and status='LIVE' and callback_time < '$past_month_date';"; + $rslt=mysql_query($stmt, $link); + echo "
list($list_id) callback listings LIVE for more than one month have been made INACTIVE\n"; + } + if ($SUB==899) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where list_id='$list_id' and status='LIVE' and callback_time < '$past_week_date';"; + $rslt=mysql_query($stmt, $link); + echo "
list($list_id) callback listings LIVE for more than one week have been made INACTIVE\n"; + } + } +$CBinactiveLINK = "
Remove LIVE Callbacks older than one month for this list
Remove LIVE Callbacks older than one week for this list
"; + +echo ""; + + $CBquerySQLwhere = "and list_id='$list_id'"; + +echo "
LIST CALLBACK HOLD LISTINGS: $list_id\n"; +$oldADD = "ADD=811&list_id=$list_id"; +$ADD='82'; +} + +###################### +# ADD=8111 find all callbacks on hold within a user group +###################### +if ($ADD==8111) +{ + if ($LOGmodify_usergroups==1) + { + if ($SUB==89) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where user_group='$user_group' and status='LIVE' and callback_time < '$past_month_date';"; + $rslt=mysql_query($stmt, $link); + echo "
user group($user_group) callback listings LIVE for more than one month have been made INACTIVE\n"; + } + if ($SUB==899) + { + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where user_group='$user_group' and status='LIVE' and callback_time < '$past_week_date';"; + $rslt=mysql_query($stmt, $link); + echo "
user group($user_group) callback listings LIVE for more than one week have been made INACTIVE\n"; + } + } + $CBinactiveLINK = "
Remove LIVE Callbacks older than one month for this user group
Remove LIVE Callbacks older than one week for this user group
"; + + echo ""; + + $CBquerySQLwhere = "and user_group='$user_group'"; + +echo "
USER GROUP CALLBACK HOLD LISTINGS: $list_id\n"; +$oldADD = "ADD=8111&user_group=$user_group"; +$ADD='82'; +} + +###################### +# ADD=82 display all callbacks on hold +###################### +if ($ADD==82) +{ + +$USERlink='stage=USERIDDOWN'; +$GROUPlink='stage=GROUPDOWN'; +$ENDATElink='stage=ENDATEDOWN'; +$SQLorder='order by '; +if (eregi("USERIDDOWN",$stage)) {$SQLorder='order by user desc,'; $USERlink='stage=USERIDUP';} +if (eregi("GROUPDOWN",$stage)) {$SQLorder='order by user_group desc,'; $NAMElink='stage=NAMEUP';} +if (eregi("ENDATEDOWN",$stage)) {$SQLorder='order by entry_time desc,'; $LEVELlink='stage=LEVELUP';} + + $stmt="SELECT * from vicidial_callbacks where status IN('ACTIVE','LIVE') $CBquerySQLwhere $SQLorder recipient,status desc,callback_time"; + $rslt=mysql_query($stmt, $link); + $cb_to_print = mysql_num_rows($rslt); + +echo "
\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + + $o=0; + while ($cb_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
LEADLIST CAMPAIGNENTRY DATECALLBACK DATEUSERRECIPIENTSTATUSGROUP
$row[1]$row[2]$row[3]$row[5]$row[6]$row[8]$row[9]$row[4]$row[11]
\n"; + +echo "$CBinactiveLINK"; +} + + + +###################################################################################################### +###################################################################################################### +####### 0 series, displays and searches +###################################################################################################### +###################################################################################################### + +###################### +# ADD=0 display all active users +###################### +if ($ADD==0) +{ +echo "
\n"; +echo ""; + +$USERlink='stage=USERIDDOWN'; +$NAMElink='stage=NAMEDOWN'; +$LEVELlink='stage=LEVELDOWN'; +$GROUPlink='stage=GROUPDOWN'; +$SQLorder='order by full_name'; +if (eregi("USERIDUP",$stage)) {$SQLorder='order by user asc'; $USERlink='stage=USERIDDOWN';} +if (eregi("USERIDDOWN",$stage)) {$SQLorder='order by user desc'; $USERlink='stage=USERIDUP';} +if (eregi("NAMEUP",$stage)) {$SQLorder='order by full_name asc'; $NAMElink='stage=NAMEDOWN';} +if (eregi("NAMEDOWN",$stage)) {$SQLorder='order by full_name desc'; $NAMElink='stage=NAMEUP';} +if (eregi("LEVELUP",$stage)) {$SQLorder='order by user_level asc'; $LEVELlink='stage=LEVELDOWN';} +if (eregi("LEVELDOWN",$stage)) {$SQLorder='order by user_level desc'; $LEVELlink='stage=LEVELUP';} +if (eregi("GROUPUP",$stage)) {$SQLorder='order by user_group asc'; $GROUPlink='stage=GROUPDOWN';} +if (eregi("GROUPDOWN",$stage)) {$SQLorder='order by user_group desc'; $GROUPlink='stage=GROUPUP';} + $stmt="SELECT * from vicidial_users $SQLorder"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
USER LISTINGS:\n"; +echo "
\n"; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo "\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
USER IDFULL NAMELEVELGROUPLINKS
$row[1]$row[3]$row[4]$row[5]MODIFY | STATS | STATUS | TIME
\n"; +} + +###################### +# ADD=10 display all campaigns +###################### +if ($ADD==10) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
CAMPAIGN LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2] $row[3]$row[4]$row[5] $row[6]$row[7]  MODIFY
\n"; +} + + +###################### +# ADD=100 display all lists +###################### +if ($ADD==100) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_lists order by list_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
LIST LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2]$row[4]$row[5] $row[3]$row[7]  MODIFY
\n"; +} + + + +###################### +# ADD=1000 display all inbound groups +###################### +if ($ADD==1000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_inbound_groups order by group_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
INBOUND GROUP LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[3] $row[5]  MODIFY
\n"; +} + + +###################### +# ADD=10000 display all remote agents +###################### +if ($ADD==10000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_remote_agents order by server_ip,campaign_id,user_start"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
REMOTE AGENTS LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[1] $row[2] $row[3] $row[4] $row[5] $row[6]MODIFY
\n"; +} + + +###################### +# ADD=100000 display all user groups +###################### +if ($ADD==100000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_user_groups order by user_group"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
USER GROUPS LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]MODIFY
\n"; +} + + +###################### +# ADD=1000000 display all scripts +###################### +if ($ADD==1000000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_scripts order by script_id"; + $rslt=mysql_query($stmt, $link); + $people_to_print = mysql_num_rows($rslt); + +echo "
SCRIPTS LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($people_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]MODIFY
\n"; +} + + +###################### +# ADD=10000000 display all filters +###################### +if ($ADD==10000000) +{ +echo "
\n"; + + echo ""; + + $stmt="SELECT * from vicidial_lead_filters order by lead_filter_id"; + $rslt=mysql_query($stmt, $link); + $filters_to_print = mysql_num_rows($rslt); + +echo "
LEAD FILTER LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($filters_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1]MODIFY
\n"; +} + + +###################### +# ADD=100000000 display all call times +###################### +if ($ADD==100000000) +{ +echo "
\n"; + + echo ""; + + $stmt="SELECT * from vicidial_call_times order by call_time_id"; + $rslt=mysql_query($stmt, $link); + $filters_to_print = mysql_num_rows($rslt); + +echo "
CALL TIME LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($filters_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[3] $row[4] MODIFY
\n"; +} + +###################### +# ADD=1000000000 display all state call times +###################### +if ($ADD==1000000000) +{ +echo "
\n"; + + echo ""; + + $stmt="SELECT * from vicidial_state_call_times order by state_call_time_id"; + $rslt=mysql_query($stmt, $link); + $filters_to_print = mysql_num_rows($rslt); + +echo "
STATE CALL TIME LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($filters_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2] $row[3] $row[4] MODIFY
\n"; +} + +###################### +# ADD=10000000000 display all phones +###################### +if ($ADD==10000000000) +{ +echo "
\n"; +echo ""; + +$EXTENlink='stage=EXTENDOWN'; +$PROTOlink='stage=PROTODOWN'; +$SERVERlink='stage=SERVERDOWN'; +$STATUSlink='stage=STATUSDOWN'; +$SQLorder='order by extension,server_ip'; +if (eregi("EXTENUP",$stage)) {$SQLorder='order by extension asc'; $EXTENlink='stage=EXTENDOWN';} +if (eregi("EXTENDOWN",$stage)) {$SQLorder='order by extension desc'; $EXTENlink='stage=EXTENUP';} +if (eregi("PROTOUP",$stage)) {$SQLorder='order by protocol asc'; $PROTOlink='stage=PROTODOWN';} +if (eregi("PROTODOWN",$stage)) {$SQLorder='order by protocol desc'; $PROTOlink='stage=PROTOUP';} +if (eregi("SERVERUP",$stage)) {$SQLorder='order by server_ip asc'; $SERVERlink='stage=SERVERDOWN';} +if (eregi("SERVERDOWN",$stage)) {$SQLorder='order by server_ip desc'; $SERVERlink='stage=SERVERUP';} +if (eregi("STATUSUP",$stage)) {$SQLorder='order by status asc'; $STATUSlink='stage=STATUSDOWN';} +if (eregi("STATUSDOWN",$stage)) {$SQLorder='order by status desc'; $STATUSlink='stage=STATUSUP';} + $stmt="SELECT * from phones $SQLorder"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
PHONE LISTINGS:\n"; +echo "
\n"; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo "\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
EXTENPROTOSERVERDIAL PLANSTATUSNAMEVMAILLINKS
$row[0]$row[16]$row[5]$row[1]$row[2]$row[8]$row[11]$row[14]$row[15]MODIFY | STATS
\n"; +} + +###################### +# ADD=100000000000 display all servers +###################### +if ($ADD==100000000000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from servers order by server_id"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
SERVER LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0]$row[1] $row[2] $row[4] $row[3]  MODIFY
\n"; +} + +###################### +# ADD=1000000000000 display all conferences +###################### +if ($ADD==1000000000000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from conferences order by conf_exten"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
CONFERENCE LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2]$row[4]  MODIFY
\n"; +} + +###################### +# ADD=10000000000000 display all vicidial conferences +###################### +if ($ADD==10000000000000) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_conferences order by conf_exten"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
CONFERENCE LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2]$row[4]  MODIFY
\n"; +} + +###################### +# ADD=999999 display reports section +###################### +if ($ADD==999999) +{ + if ($LOGview_reports==1) + { + echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_conferences order by conf_exten"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + + $stmt="select * from servers;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $servers_to_print = mysql_num_rows($rslt); + $i=0; + while ($i < $servers_to_print) + { + $row=mysql_fetch_row($rslt); + $server_id[$i] = $row[0]; + $server_description[$i] = $row[1]; + $server_ip[$i] = $row[2]; + $active[$i] = $row[3]; + $i++; + } + + $stmt="SELECT enable_queuemetrics_logging,queuemetrics_url from system_settings;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $enable_queuemetrics_logging_LU = $row[0]; + $queuemetrics_url_LU = $row[1]; + + ?> + + + + + + VICIDIAL: Server Stats and Reports + VICIDIAL: Server Stats and Reports

+ +

+	
+	 $o)
+		{
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		echo "\n";
+		$o++;
+		}
+
+	echo "
SERVERDESCRIPTIONIP ADDRESSACTIVEVDAD timePARK timeCLOSER/INBOUND time
$server_id[$o]$server_description[$o]$server_ip[$o]$active[$o]LINKLINKLINK
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + + + + +echo "
\n"; + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n
\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds"; +echo "                   VERSION: $admin_version"; +echo "                   BUILD: $build
\n"; + + +?> + + +
+ + + +1) + { + if (strlen($dial_statuses)>2) + { + $g=0; + $p='13'; + $GMT_gmt[0] = ''; + $GMT_hour[0] = ''; + $GMT_day[0] = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $pmin=(gmdate("i", time() + $pzone)); + $phour=( (gmdate("G", time() + $pzone)) * 100); + $pday=gmdate("w", time() + $pzone); + $tz = sprintf("%.2f", $p); + $GMT_gmt[$g] = "$tz"; + $GMT_day[$g] = "$pday"; + $GMT_hour[$g] = ($phour + $pmin); + $p = ($p - 0.25); + $g++; + } + + $stmt="SELECT * FROM vicidial_call_times where call_time_id='$local_call_time';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $Gct_default_start = "$rowx[3]"; + $Gct_default_stop = "$rowx[4]"; + $Gct_sunday_start = "$rowx[5]"; + $Gct_sunday_stop = "$rowx[6]"; + $Gct_monday_start = "$rowx[7]"; + $Gct_monday_stop = "$rowx[8]"; + $Gct_tuesday_start = "$rowx[9]"; + $Gct_tuesday_stop = "$rowx[10]"; + $Gct_wednesday_start = "$rowx[11]"; + $Gct_wednesday_stop = "$rowx[12]"; + $Gct_thursday_start = "$rowx[13]"; + $Gct_thursday_stop = "$rowx[14]"; + $Gct_friday_start = "$rowx[15]"; + $Gct_friday_stop = "$rowx[16]"; + $Gct_saturday_start = "$rowx[17]"; + $Gct_saturday_stop = "$rowx[18]"; + $Gct_state_call_times = "$rowx[19]"; + + $ct_states = ''; + $ct_state_gmt_SQL = ''; + $ct_srs=0; + $b=0; + if (strlen($Gct_state_call_times)>2) + { + $state_rules = explode('|',$Gct_state_call_times); + $ct_srs = ((count($state_rules)) - 2); + } + while($ct_srs >= $b) + { + if (strlen($state_rules[$b])>1) + { + $stmt="SELECT * from vicidial_state_call_times where state_call_time_id='$state_rules[$b]';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Gstate_call_time_id = "$row[0]"; + $Gstate_call_time_state = "$row[1]"; + $Gsct_default_start = "$row[4]"; + $Gsct_default_stop = "$row[5]"; + $Gsct_sunday_start = "$row[6]"; + $Gsct_sunday_stop = "$row[7]"; + $Gsct_monday_start = "$row[8]"; + $Gsct_monday_stop = "$row[9]"; + $Gsct_tuesday_start = "$row[10]"; + $Gsct_tuesday_stop = "$row[11]"; + $Gsct_wednesday_start = "$row[12]"; + $Gsct_wednesday_stop = "$row[13]"; + $Gsct_thursday_start = "$row[14]"; + $Gsct_thursday_stop = "$row[15]"; + $Gsct_friday_start = "$row[16]"; + $Gsct_friday_stop = "$row[17]"; + $Gsct_saturday_start = "$row[18]"; + $Gsct_saturday_stop = "$row[19]"; + + $ct_states .="'$Gstate_call_time_state',"; + + $r=0; + $state_gmt=''; + while($r < $g) + { + if ($GMT_day[$r]==0) #### Sunday local time + { + if (($Gsct_sunday_start==0) and ($Gsct_sunday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_sunday_start) and ($GMT_hour[$r]<$Gsct_sunday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==1) #### Monday local time + { + if (($Gsct_monday_start==0) and ($Gsct_monday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_monday_start) and ($GMT_hour[$r]<$Gsct_monday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==2) #### Tuesday local time + { + if (($Gsct_tuesday_start==0) and ($Gsct_tuesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_tuesday_start) and ($GMT_hour[$r]<$Gsct_tuesday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==3) #### Wednesday local time + { + if (($Gsct_wednesday_start==0) and ($Gsct_wednesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_wednesday_start) and ($GMT_hour[$r]<$Gsct_wednesday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==4) #### Thursday local time + { + if (($Gsct_thursday_start==0) and ($Gsct_thursday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_thursday_start) and ($GMT_hour[$r]<$Gsct_thursday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==5) #### Friday local time + { + if (($Gsct_friday_start==0) and ($Gsct_friday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_friday_start) and ($GMT_hour[$r]<$Gsct_friday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==6) #### Saturday local time + { + if (($Gsct_saturday_start==0) and ($Gsct_saturday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_saturday_start) and ($GMT_hour[$r]<$Gsct_saturday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + $r++; + } + $state_gmt = "$state_gmt'99'"; + $ct_state_gmt_SQL .= "or (state='$Gstate_call_time_state' and gmt_offset_now IN($state_gmt)) "; + } + + $b++; + } + if (strlen($ct_states)>2) + { + $ct_states = eregi_replace(",$",'',$ct_states); + $ct_statesSQL = "and state NOT IN($ct_states)"; + } + else + { + $ct_statesSQL = ""; + } + + $r=0; + $default_gmt=''; + while($r < $g) + { + if ($GMT_day[$r]==0) #### Sunday local time + { + if (($Gct_sunday_start==0) and ($Gct_sunday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_sunday_start) and ($GMT_hour[$r]<$Gct_sunday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==1) #### Monday local time + { + if (($Gct_monday_start==0) and ($Gct_monday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_monday_start) and ($GMT_hour[$r]<$Gct_monday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==2) #### Tuesday local time + { + if (($Gct_tuesday_start==0) and ($Gct_tuesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_tuesday_start) and ($GMT_hour[$r]<$Gct_tuesday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==3) #### Wednesday local time + { + if (($Gct_wednesday_start==0) and ($Gct_wednesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_wednesday_start) and ($GMT_hour[$r]<$Gct_wednesday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==4) #### Thursday local time + { + if (($Gct_thursday_start==0) and ($Gct_thursday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_thursday_start) and ($GMT_hour[$r]<$Gct_thursday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==5) #### Friday local time + { + if (($Gct_friday_start==0) and ($Gct_friday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_friday_start) and ($GMT_hour[$r]<$Gct_friday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==6) #### Saturday local time + { + if (($Gct_saturday_start==0) and ($Gct_saturday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_saturday_start) and ($GMT_hour[$r]<$Gct_saturday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + $r++; + } + + $default_gmt = "$default_gmt'99'"; + $all_gmtSQL = "(gmt_offset_now IN($default_gmt) $ct_statesSQL) $ct_state_gmt_SQL"; + + + $dial_statuses = preg_replace("/ -$/","",$dial_statuses); + $Dstatuses = explode(" ", $dial_statuses); + $Ds_to_print = (count($Dstatuses) - 0); + $Dsql = ''; + $o=0; + while ($Ds_to_print > $o) + { + $o++; + $Dsql .= "'$Dstatuses[$o]',"; + } + $Dsql = preg_replace("/,$/","",$Dsql); + + $stmt="SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN($Dsql) and list_id IN($camp_lists) and ($all_gmtSQL) $fSQL"; + #$DB=1; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rslt_rows = mysql_num_rows($rslt); + if ($rslt_rows) + { + $rowx=mysql_fetch_row($rslt); + $active_leads = "$rowx[0]"; + } + else {$active_leads = '0';} + + echo "|$DB|\n"; + echo "This campaign has $active_leads leads to be dialed in those lists\n"; + } + else + { + echo "no dial statuses selected for this campaign\n"; + } + } + else + { + echo "no active lists selected for this campaign\n"; + } + } +else + { + echo "no active lists selected for this campaign\n"; + } +##### END calculate what gmt_offset_now values are within the allowed local_call_time setting ### +} +?> diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/admin_modify_lead.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/admin_modify_lead.php new file mode 100644 index 00000000..f8a285ec --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/admin_modify_lead.php @@ -0,0 +1,610 @@ + LICENSE: GPLv2 +# + +# CHANGES +# +# 70702-1259 - Added recording location link and truncation +# 70906-2132 - Added closer_log records display +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} +if (isset($_GET["phone"])) {$phone=$_GET["phone"];} + elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];} + elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];} +if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];} + elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];} +if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];} + elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];} +if (isset($_GET["end_call"])) {$end_call=$_GET["end_call"];} + elseif (isset($_POST["end_call"])) {$end_call=$_POST["end_call"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];} + elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];} + elseif (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["call_began"])) {$call_began=$_GET["call_began"];} + elseif (isset($_POST["call_began"])) {$call_began=$_POST["call_began"];} +if (isset($_GET["parked_time"])) {$parked_time=$_GET["parked_time"];} + elseif (isset($_POST["parked_time"])) {$parked_time=$_POST["parked_time"];} +if (isset($_GET["tsr"])) {$tsr=$_GET["tsr"];} + elseif (isset($_POST["tsr"])) {$tsr=$_POST["tsr"];} +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["postal_code"])) {$postal_code=$_GET["postal_code"];} + elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];} +if (isset($_GET["province"])) {$province=$_GET["province"];} + elseif (isset($_POST["province"])) {$province=$_POST["province"];} +if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];} + elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];} +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"])) {$security=$_GET["security"];} + elseif (isset($_POST["security"])) {$security=$_POST["security"];} +if (isset($_GET["comments"])) {$comments=$_GET["comments"];} + elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["CBchangeUSERtoANY"])) {$CBchangeUSERtoANY=$_GET["CBchangeUSERtoANY"];} + elseif (isset($_POST["CBchangeUSERtoANY"])) {$CBchangeUSERtoANY=$_POST["CBchangeUSERtoANY"];} +if (isset($_GET["CBchangeUSERtoUSER"])) {$CBchangeUSERtoUSER=$_GET["CBchangeUSERtoUSER"];} + elseif (isset($_POST["CBchangeUSERtoUSER"])) {$CBchangeUSERtoUSER=$_POST["CBchangeUSERtoUSER"];} +if (isset($_GET["CBchangeANYtoUSER"])) {$CBchangeANYtoUSER=$_GET["CBchangeANYtoUSER"];} + elseif (isset($_POST["CBchangeANYtoUSER"])) {$CBchangeANYtoUSER=$_POST["CBchangeANYtoUSER"];} +if (isset($_GET["callback_id"])) {$callback_id=$_GET["callback_id"];} + elseif (isset($_POST["callback_id"])) {$callback_id=$_POST["callback_id"];} +if (isset($_GET["CBuser"])) {$CBuser=$_GET["CBuser"];} + elseif (isset($_POST["CBuser"])) {$CBuser=$_POST["CBuser"];} +if (isset($_GET["modify_logs"])) {$modify_logs=$_GET["modify_logs"];} + elseif (isset($_POST["modify_logs"])) {$modify_logs=$_POST["modify_logs"];} + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + + +### AST GUI database administration modify lead in vicidial_list +### admin_modify_lead.php + +# this is the administration lead information modifier screen, the administrator just needs to enter the leadID and then they can view and modify the information in the record for that lead + +# CHANGES +# +# 60419-1705 - Added ability to change lead callback record from USERONLY to ANYONE or USERONLY-user +# 60421-1459 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60609-1112 - Added DNC list addition if status changed to DNC +# 60619-1539 - Added variable filtering to eliminate SQL injection attack threat +# 61130-1639 - Added recording_log lookup and list for this lead_id +# 61201-1136 - Added recording_log user(TSR) display and link +# 70305-1133 - Changed to default CHECKED modify logs upon status change +# 70424-1128 - Added campaign-specific statuses, reformatted recordings list +# + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); + + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and modify_leads='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $stmt="SELECT full_name,modify_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[0]; + $LOGmodify_leads =$row[1]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +?> + + + +VICIDIAL ADMIN: Lead record modification + + +
+VICIDIAL ADMIN: Lead record modification
\n"; + +if ($end_call > 0) +{ + +$call_length = ($STARTtime - $call_began); + + ### insert a NEW record to the vicidial_closer_log table + $stmt="INSERT INTO vicidial_closer_log (lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed) values('" . mysql_real_escape_string($lead_id) . "','" . mysql_real_escape_string($list_id) . "','" . mysql_real_escape_string($campaign_id) . "','" . mysql_real_escape_string($parked_time) . "','" . mysql_real_escape_string($call_began) . "','$STARTtime','" . mysql_real_escape_string($call_length) . "','" . mysql_real_escape_string($status) . "','" . mysql_real_escape_string($phone_code) . "','" . mysql_real_escape_string($phone_number) . "','$PHP_AUTH_USER','" . mysql_real_escape_string($comments) . "','Y')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ### update the lead record in the vicidial_list table + $stmt="UPDATE vicidial_list set status='" . mysql_real_escape_string($status) . "',first_name='" . mysql_real_escape_string($first_name) . "',last_name='" . mysql_real_escape_string($last_name) . "',address1='" . mysql_real_escape_string($address1) . "',address2='" . mysql_real_escape_string($address2) . "',address3='" . mysql_real_escape_string($address3) . "',city='" . mysql_real_escape_string($city) . "',state='" . mysql_real_escape_string($state) . "',province='" . mysql_real_escape_string($province) . "',postal_code='" . mysql_real_escape_string($postal_code) . "',country_code='" . mysql_real_escape_string($country_code) . "',alt_phone='" . mysql_real_escape_string($alt_phone) . "',email='" . mysql_real_escape_string($email) . "',security_phrase='" . mysql_real_escape_string($security) . "',comments='" . mysql_real_escape_string($comments) . "' where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "information modified

\n"; + echo "\n"; + + if ( ($dispo != $status) and ($dispo == 'CBHOLD') ) + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='" . mysql_real_escape_string($lead_id) . "' and status='ACTIVE';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record inactivated: $lead_id
\n"; + } + if ( ($dispo != $status) and ($dispo == 'CALLBK') ) + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='" . mysql_real_escape_string($lead_id) . "' and status IN('ACTIVE','LIVE');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record inactivated: $lead_id
\n"; + } + + if ( ($dispo != $status) and ($status == 'DNC') ) + { + ### add lead to the internal DNC list + $stmt="INSERT INTO vicidial_dnc (phone_number) values('" . mysql_real_escape_string($phone_number) . "');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
Lead added to DNC List: $lead_id - $phone_number
\n"; + } + ### update last record in vicidial_agent_log and vicidial_log tables + if (($dispo != $status) and ($modify_logs > 0)) + { + $stmt="UPDATE vicidial_log set status='" . mysql_real_escape_string($status) . "' where lead_id='" . mysql_real_escape_string($lead_id) . "' order by call_date desc limit 1"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="UPDATE vicidial_agent_log set status='" . mysql_real_escape_string($status) . "' where lead_id='" . mysql_real_escape_string($lead_id) . "' order by agent_log_id desc limit 1"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + } + +} +else +{ + + if ($CBchangeUSERtoANY == 'YES') + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set recipient='ANYONE' where callback_id='" . mysql_real_escape_string($callback_id) . "';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record changed to ANYONE
\n"; + } + if ($CBchangeUSERtoUSER == 'YES') + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set user='" . mysql_real_escape_string($CBuser) . "' where callback_id='" . mysql_real_escape_string($callback_id) . "';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record user changed to $CBuser
\n"; + } + if ($CBchangeANYtoUSER == 'YES') + { + ### inactivate vicidial_callbacks record for this lead + $stmt="UPDATE vicidial_callbacks set user='" . mysql_real_escape_string($CBuser) . "',recipient='USERONLY' where callback_id='" . mysql_real_escape_string($callback_id) . "';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "
vicidial_callback record changed to USERONLY, user: $CBuser
\n"; + } + + + + $stmt="SELECT count(*) from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_count = $row[0]; + + if ($lead_count > 0) + { + + $stmt="select * from vicidial_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by uniqueid desc limit 500;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + $call_log = ''; + $log_campaign = ''; + while ($logs_to_print > $u) + { + $row=mysql_fetch_row($rslt); + if (strlen($log_campaign)<1) {$log_campaign = $row[3];} + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $u++; + $call_log .= "
"; + $call_log .= ""; + $call_log .= ""; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + + } + + $stmt="select * from vicidial_closer_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by closecallid desc limit 500;"; + $rslt=mysql_query($stmt, $link); + $Clogs_to_print = mysql_num_rows($rslt); + + $y=0; + $closer_log = ''; + $Clog_campaign = ''; + while ($Clogs_to_print > $y) + { + $row=mysql_fetch_row($rslt); + if (strlen($Clog_campaign)<1) {$Clog_campaign = $row[3];} + if (eregi("1$|3$|5$|7$|9$", $y)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $y++; + $closer_log .= ""; + $closer_log .= ""; + $closer_log .= ""; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + + } + + $stmt="SELECT * from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_id = "$row[0]"; + $dispo = "$row[3]"; + $tsr = "$row[4]"; + $vendor_id = "$row[5]"; + $list_id = "$row[7]"; + $campaign_id = "$row[8]"; + $phone_code = "$row[10]"; + $phone_number = "$row[11]"; + $title = "$row[12]"; + $first_name = "$row[13]"; # + $middle_initial = "$row[14]"; + $last_name = "$row[15]"; # + $address1 = "$row[16]"; # + $address2 = "$row[17]"; # + $address3 = "$row[18]"; # + $city = "$row[19]"; # + $state = "$row[20]"; # + $province = "$row[21]"; # + $postal_code = "$row[22]"; # + $country_code = "$row[23]"; # + $gender = "$row[24]"; + $date_of_birth = "$row[25]"; + $alt_phone = "$row[26]"; # + $email = "$row[27]"; # + $security = "$row[28]"; # + $comments = "$row[29]"; # + + echo "
Call information: $first_name $last_name - $phone_number

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
$u$row[4] $row[7] $row[8] $row[11] $row[3] $row[2] $row[1]
$y$row[4] $row[7] $row[8] $row[11] $row[3] $row[2] $row[1]   $row[14]
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + echo "\n"; + + echo "\n"; + echo "
Vendor ID: $vendor_id     Lead ID: $lead_id
Fronter: $tsr     List ID: $list_id
First Name:   \n"; + echo " Last Name:
Address 1 :
Address 2 :
Address 3 :
City :
State:   \n"; + echo " Postal Code:
Province :
Country :
Alt Phone :
Email :
Security :
Comments :
Disposition: (with $log_campaign statuses)
Modify agent and vicidial logs
\n"; + echo "


\n"; + + if ( ($dispo == 'CALLBK') or ($dispo == 'CBHOLD') ) + { + ### find any vicidial_callback records for this lead + $stmt="select * from vicidial_callbacks where lead_id='" . mysql_real_escape_string($lead_id) . "' and status IN('ACTIVE','LIVE') order by callback_id desc LIMIT 1;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $CB_to_print = mysql_num_rows($rslt); + $rowx=mysql_fetch_row($rslt); + + if ($CB_to_print>0) + { + if ($rowx[9] == 'USERONLY') + { + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "

\n"; + + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "New Callback Owner UserID: \n"; + echo "

\n"; + } + else + { + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "New Callback Owner UserID: \n"; + echo "

\n"; + } + } + else + { + echo "
No Callback records found
\n"; + } + } + + + + + + + } + else + { + echo "lead lookup FAILED for lead_id $lead_id       $NOW_TIME\n

\n"; +# echo "Close this window\n

\n"; + } + + + +echo "

\n"; + +echo "
\n"; + +echo "CALLS TO THIS LEAD:\n"; +echo "\n"; +echo "\n"; + + echo "$call_log\n"; + +echo "
# DATE/TIME LENGTH STATUS TSR CAMPAIGN LIST LEAD
\n"; +echo "

\n"; + +echo "CLOSER RECORDS FOR THIS LEAD:\n"; +echo "\n"; +echo "\n"; + + echo "$closer_log\n"; + +echo "
# DATE/TIME LENGTH STATUS TSR CAMPAIGN LIST LEAD WAIT
\n"; +echo "

\n"; + + +echo "RECORDINGS FOR THIS LEAD:\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from recording_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by recording_id desc limit 500;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) + { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $location = $row[11]; + if (strlen($location)>30) + {$locat = substr($location,0,27); $locat = "$locat...";} + else + {$locat = $location;} + if (eregi("http",$location)) + {$location = "$locat";} + else + {$location = $locat;} + $u++; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + + } + + +echo "
# LEADDATE/TIME SECONDS   RECIDFILENAMELOCATIONTSR
$u $row[12] $row[4] $row[8] $row[0]   $row[10] $location $row[13]
\n"; + + + + +} + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/admin_search_lead.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/admin_search_lead.php new file mode 100644 index 00000000..ff814159 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/admin_search_lead.php @@ -0,0 +1,225 @@ + LICENSE: GPLv2 +### +### AST GUI database administration search for lead info +### admin_modify_lead.php +# +# this is the administration lead information modifier screen, the administrator just needs to enter the leadID and then they can view and modify the information in the record for that lead +# +# changes: +# 60620-1055 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# - Changed results to multi-record +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} +if (isset($_GET["phone"])) {$phone=$_GET["phone"];} + elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); + + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and modify_leads='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./project_auth_entries.txt", "a");} + +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name,modify_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname =$row[0]; + $LOGmodify_leads =$row[1]; + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +?> + + + +VICIDIAL ADMIN: Lead Search + +Lead Lookup + + +VICIDIAL ADMIN: Lead search
\n"; + + +if ( (!$vendor_id) and (!$phone) and (!$lead_id) ) + { + echo date("l F j, Y G:i:s A"); + echo "\n

\n"; + echo "
\n"; + echo "\n"; + echo "Please enter a:
Vendor ID(vendor lead code): or \n"; + echo "
a Home Phone Number: or\n"; + echo "
a lead ID:

\n"; + echo "
\n"; + echo "\n
\n"; + echo "\n"; + exit; + } + +else + { + + if ($vendor_id) + { + $stmt="SELECT * from vicidial_list where vendor_lead_code='" . mysql_real_escape_string($vendor_id) . "' order by modify_date desc limit 1000"; + } + else + { + if ($phone) + { + $stmt="SELECT * from vicidial_list where phone_number='" . mysql_real_escape_string($phone) . "' order by modify_date desc limit 1000"; + } + else + { + if ($lead_id) + { + $stmt="SELECT * from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "' order by modify_date desc limit 1000"; + } + else + { + print "ERROR: you must search for something! Go back and search for something"; + exit; + } + } + } + if ($DB) + { + echo "\n\n$stmt\n\n"; + } + + $rslt=mysql_query($stmt, $link); + $results_to_print = mysql_num_rows($rslt); + if ($results_to_print < 1) + { + echo date("l F j, Y G:i:s A"); + echo "\n

\n"; + echo "The search variables you entered are not active in the system

\n"; + echo "Please go back and double check the information you entered and submit again\n"; + echo "
\n"; + echo "\n"; + exit; + } + else + { + echo "RESULTS: $results_to_print

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + $o=0; + while ($results_to_print > $o) + { + $row=mysql_fetch_row($rslt); + $o++; + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + echo "
#LEAD IDSTATUSVENDOR IDLAST AGENTLIST IDPHONENAMECITYSECURITYLAST CALL
$o$row[0]$row[3]$row[5]$row[4]$row[7]$row[11]$row[13] $row[15]$row[19]$row[28]$row[2]
\n"; + } + } + + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\nNEW SEARCH"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds"; + + +?> + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/closer-fronter_popup.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/closer-fronter_popup.php new file mode 100644 index 00000000..98a58eca --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/closer-fronter_popup.php @@ -0,0 +1,516 @@ + LICENSE: GPLv2 +### +# this is the closer popup of a specific call that starts recording the call and allows you to go and fetch info on that caller in the local CRM system. +# CHANGES +# +# 60620-1020 - Added variable filtering to eliminate SQL injection attack threat +# 61201-1114 - Added lead_id and user to recording_log entry +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +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["alt_phone"])) {$alt_phone=$_GET["alt_phone"];} + elseif (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];} +if (isset($_GET["call_began"])) {$call_began=$_GET["call_began"];} + elseif (isset($_POST["call_began"])) {$call_began=$_POST["call_began"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];} + elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];} +if (isset($_GET["city"])) {$city=$_GET["city"];} + elseif (isset($_POST["city"])) {$city=$_POST["city"];} +if (isset($_GET["comments"])) {$comments=$_GET["comments"];} + elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];} +if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];} + elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];} +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["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];} + elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];} +if (isset($_GET["email"])) {$email=$_GET["email"];} + elseif (isset($_POST["email"])) {$email=$_POST["email"];} +if (isset($_GET["end_call"])) {$end_call=$_GET["end_call"];} + elseif (isset($_POST["end_call"])) {$end_call=$_POST["end_call"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];} + elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];} + elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["parked_time"])) {$parked_time=$_GET["parked_time"];} + elseif (isset($_POST["parked_time"])) {$parked_time=$_POST["parked_time"];} +if (isset($_GET["pass"])) {$pass=$_GET["pass"];} + elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];} +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["phone"])) {$phone=$_GET["phone"];} + elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];} +if (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];} + elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];} +if (isset($_GET["province"])) {$province=$_GET["province"];} + elseif (isset($_POST["province"])) {$province=$_POST["province"];} +if (isset($_GET["security"])) {$security=$_GET["security"];} + elseif (isset($_POST["security"])) {$security=$_POST["security"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["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["session_id"])) {$session_id=$_GET["session_id"];} + elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];} +if (isset($_GET["state"])) {$state=$_GET["state"];} + elseif (isset($_POST["state"])) {$state=$_POST["state"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["tsr"])) {$tsr=$_GET["tsr"];} + elseif (isset($_POST["tsr"])) {$tsr=$_POST["tsr"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +#$DB = '1'; # DEBUG override +$US = '_'; +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$REC_TIME = date("Ymd-His"); +$FILE_datetime = $STARTtime; +$parked_time = $STARTtime; + +# $ext_context = 'default'; defined in dbconnect file + + $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]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($user); + $password=strtoupper($pass); + $stmt="SELECT full_name from vicidial_users where user='$user' and pass='$pass'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + if ( (strlen($customer_zap_channel)>2) and (eregi('zap',$customer_zap_channel)) ) + { + echo "\n\n"; + echo "\n\n"; + + } + else + { + echo "Bad channel: $customer_zap_channel\n"; + echo "Make sure the Zap channel is live and try again\n"; + exit; + } + + } + else + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$user|$pass|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +echo "VICIDIAL FRONTER-CLOSER: Popup\n"; +echo "\n"; + +if (eregi('CL_UNIV',$channel_group)) + { + ?> + + \n"; + echo "function WaitFirefix() {setTimeout(document.forms[0].search_phone.focus(), 1000)}\n"; + echo "\n"; + } +?> + + +
+ + 0) +{ + +# $stmt="DELETE from parked_channels where server_ip='$server_ip' and parked_time='$parked_time' and channel='$channel' LIMIT 1"; +# if ($DB) {echo "|$stmt|\n";} +# $rslt=mysql_query($stmt, $link); + + $DTqueryCID = "RZ$FILE_datetime$user"; + + ### insert a NEW record to the vicidial_manager table to be processed + + $channel = $customer_zap_channel; + $channel = eregi_replace('Zap/', "", $channel); + $SIPexten = eregi_replace('SIP/', "", $SIPexten); + $filename = "$REC_TIME$US$SIPexten"; + +# $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Monitor','$DTqueryCID','Channel: Zap/$channel','File: $filename','Callerid: $DTqueryCID','','','','','','','')"; +# if ($DB) {echo "|$stmt|\n";} +# $rslt=mysql_query($stmt, $link); + + # Local/78600098@demo-6617,2 + + $stmt = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','" . mysql_real_escape_string($server_ip) . "','','Originate','$DTqueryCID','Channel: $local_DEF$conf_silent_prefix" . mysql_real_escape_string($session_id) . "$local_AMP$ext_context','Context: $ext_context','Exten: $recording_exten','Priority: 1','Callerid: " . mysql_real_escape_string($filename) . "','','','','','')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('Zap/" . mysql_real_escape_string($channel) . "','" . mysql_real_escape_string($server_ip) . "','SIP/" . mysql_real_escape_string($SIPexten) . "','$NOW_TIME','$STARTtime','" . mysql_real_escape_string($filename) . "','$lead_id','$user')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='" . mysql_real_escape_string($filename) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + + echo "Recording command sent for channel $channel - $filename - $recording_id       $NOW_TIME\n

\n"; + + $stmt="SELECT full_name from vicidial_users where user='" . mysql_real_escape_string($user) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + echo "Call Referred by: $user - $full_name\n

\n"; + + $url = "http://10.10.99.2/vicidial/closer_dispo.php?lead_id=$lead_id&channel=$channel&server_ip=$server_ip&extension=$SIPexten&call_began=$STARTtime&parked_time=$parked_time&DB=$DB"; + + echo "View Customer Info and Disposition Call\n

\n"; + + + +# $stmt="UPDATE park_log set grab_time='$NOW_TIME',status='TALKING',extension='$extension',user='$user' where parked_time='$parked_time' and server_ip='$server_ip' and channel='$channel'"; +# if ($DB) {echo "|$stmt|\n";} +# $fp = fopen ("./closer_SQL_updates.txt", "a"); +# fwrite ($fp, "$date|$user|$stmt|\n"); +# fclose($fp); +# $rslt=mysql_query($stmt, $link); + +########################################################################################### +####### HERE IS WHERE YOU DEFINE DIFFERENT CONTENTS DEPENDING UPON THE CHANNEL_GROUP PREFIX +########################################################################################### +if (eregi('CL_TEST',$channel_group)) + { + echo "GALLERIA TEST CLOSER GROUP: $channel_group\n"; + + $stmt="SELECT user,phone_number from vicidial_list where lead_id='" . mysql_real_escape_string($parked_by) . "';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $fronter=$row[0]; + $search_phone=$row[1]; + + + ?> +
+ + + + + + + + + + + + + + + +
COF MW Customer Search
Phone number
+
+

+ +
+ + + + + + + + + + + + + + + +
COF MW Customer Search
Phone number
+
+

+ -- INTERNAL CALL GALLERIA FRONT --
\n"; + $group_color='#99FF99'; + } + if (eregi('CL_GALLER2',$channel_group)) + { + echo "
-- TouchAsia CALL Simple Escapes FRONT --
\n"; + $group_color='#FF9999'; + } + if (eregi('CL_GALLER3',$channel_group)) + { + echo "
-- DebitSupplies CALL Simple Escapes FRONT --
\n"; + $group_color='#FF9999'; + } + if (eregi('CL_GALLER4',$channel_group)) + { + echo "
-- Vishnu CALL Simple Escapes FRONT --
\n"; + $group_color='#FF9999'; + } + + + ?> +
+ + + + + + + + + + + + + + + +
COF MW Customer Search
Phone number
+
+

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
New Search
Reservation Number:
Confirmation #:
Phone #:


Back
+ +
+ + + Close this window\n

\n"; +} +else +{ + echo "Record command FAILED for channel $channel       $NOW_TIME\n

\n"; + echo "Please go back and try again\n

\n"; +# echo "
\n"; +} + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/closer-fronter_popup2.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/closer-fronter_popup2.php new file mode 100644 index 00000000..1c98063d --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/closer-fronter_popup2.php @@ -0,0 +1,431 @@ + LICENSE: GPLv2 +### +# this is the closer popup of a specific call that starts recording the call and allows you to go and fetch info on that caller in the local CRM system. +# CHANGES +# +# 60620-1025 - Added variable filtering to eliminate SQL injection attack threat +# 61201-1114 - Added lead_id and user to recording_log entry +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +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["alt_phone"])) {$alt_phone=$_GET["alt_phone"];} + elseif (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];} +if (isset($_GET["call_began"])) {$call_began=$_GET["call_began"];} + elseif (isset($_POST["call_began"])) {$call_began=$_POST["call_began"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];} + elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];} +if (isset($_GET["city"])) {$city=$_GET["city"];} + elseif (isset($_POST["city"])) {$city=$_POST["city"];} +if (isset($_GET["comments"])) {$comments=$_GET["comments"];} + elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];} +if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];} + elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];} +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["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];} + elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];} +if (isset($_GET["email"])) {$email=$_GET["email"];} + elseif (isset($_POST["email"])) {$email=$_POST["email"];} +if (isset($_GET["end_call"])) {$end_call=$_GET["end_call"];} + elseif (isset($_POST["end_call"])) {$end_call=$_POST["end_call"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];} + elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];} + elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["parked_time"])) {$parked_time=$_GET["parked_time"];} + elseif (isset($_POST["parked_time"])) {$parked_time=$_POST["parked_time"];} +if (isset($_GET["pass"])) {$pass=$_GET["pass"];} + elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];} +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["phone"])) {$phone=$_GET["phone"];} + elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];} +if (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];} + elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];} +if (isset($_GET["province"])) {$province=$_GET["province"];} + elseif (isset($_POST["province"])) {$province=$_POST["province"];} +if (isset($_GET["security"])) {$security=$_GET["security"];} + elseif (isset($_POST["security"])) {$security=$_POST["security"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["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["session_id"])) {$session_id=$_GET["session_id"];} + elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];} +if (isset($_GET["state"])) {$state=$_GET["state"];} + elseif (isset($_POST["state"])) {$state=$_POST["state"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["tsr"])) {$tsr=$_GET["tsr"];} + elseif (isset($_POST["tsr"])) {$tsr=$_POST["tsr"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +#$DB = '1'; # DEBUG override +$US = '_'; +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$REC_TIME = date("Ymd-His"); +$FILE_datetime = $STARTtime; +$parked_time = $STARTtime; + +# $ext_context = 'default'; defined in dbconnect file +if (!isset($begin_date)) {$begin_date = $TODAY;} +if (!isset($end_date)) {$end_date = $TODAY;} + + $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 (!$auth) + { + if ( (strlen($PHP_AUTH_USER)>1) and ( (eregi("tsr",$PHP_AUTH_PW)) or (eregi("sales",$PHP_AUTH_PW)) ) ) + { + $auth=1; + $user = $PHP_AUTH_USER; + $pass = $PHP_AUTH_PW; + } + } + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER - $user - $PHP_AUTH_USER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($user); + $password=strtoupper($pass); + $stmt="SELECT full_name from vicidial_users where user='$user' and pass='$pass'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + if ( (strlen($customer_zap_channel)>2) and ( (eregi('zap',$customer_zap_channel)) or (eregi('iax',$customer_zap_channel)) ) ) + { + echo "\n\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + } + else + { + echo "Bad channel: $customer_zap_channel\n"; + echo "Make sure the Zap channel is live and try again\n"; + exit; + } + + } + else + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$user|$pass|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +echo "VICIDIAL FRONTER-CLOSER: Popup\n"; +echo "\n"; + +if (eregi('CL_UNIV',$channel_group)) + { + ?> + + \n"; + echo "function WaitFirefix() {setTimeout(document.forms[0].search_phone.focus(), 1000)}\n"; + echo "\n"; + } +?> + + +
+ + 0) +{ + +# $stmt="DELETE from parked_channels where server_ip='$server_ip' and parked_time='$parked_time' and channel='$channel' LIMIT 1"; +# if ($DB) {echo "|$stmt|\n";} +# $rslt=mysql_query($stmt, $link); + + $DTqueryCID = "RZ$FILE_datetime$user"; + + ### insert a NEW record to the vicidial_manager table to be processed + + $channel = $customer_zap_channel; +# $channel = eregi_replace('Zap/', "", $channel); + $SIPexten = eregi_replace('SIP/', "", $SIPexten); + $filename = "$REC_TIME$US$SIPexten"; + +# $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Monitor','$DTqueryCID','Channel: Zap/$channel','File: $filename','Callerid: $DTqueryCID','','','','','','','')"; +# if ($DB) {echo "|$stmt|\n";} +# $rslt=mysql_query($stmt, $link); + + # Local/78600098@demo-6617,2 + + $stmt = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','" . mysql_real_escape_string($server_ip) . "','','Originate','$DTqueryCID','Channel: $local_DEF$conf_silent_prefix" . mysql_real_escape_string($session_id) . "$local_AMP$ext_context','Context: $ext_context','Exten: $recording_exten','Priority: 1','Callerid: " . mysql_real_escape_string($filename) . "','','','','','')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','" . mysql_real_escape_string($server_ip) . "','SIP/" . mysql_real_escape_string($SIPexten) . "','$NOW_TIME','$STARTtime','" . mysql_real_escape_string($filename) . "','$lead_id','$user')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT recording_id FROM recording_log where filename='" . mysql_real_escape_string($filename) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + + echo "Recording command sent for channel $channel - $filename - $recording_id       $NOW_TIME\n

\n"; + + $stmt="SELECT full_name from vicidial_users where user='" . mysql_real_escape_string($fronter) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + echo "Call Referred by: $fronter - $full_name\n

\n"; + + $url = "http://10.10.10.196/vicidial/closer_dispo.php?lead_id=$lead_id&channel=$channel&server_ip=$server_ip&extension=$SIPexten&call_began=$STARTtime&parked_time=$parked_time&DB=$DB"; + + echo "View Customer Info and Disposition Call\n

\n"; + + + $stmt="SELECT group_name,group_color from vicidial_inbound_groups where group_id='" . mysql_real_escape_string($channel_group) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $group_name = $row[0]; + $group_color = $row[1]; + + echo "
\n"; + echo "
$channel_group - $group_name

\n\n"; + +########################################################################################### +####### HERE IS WHERE YOU DEFINE DIFFERENT CONTENTS DEPENDING UPON THE CHANNEL_GROUP PREFIX +########################################################################################### + +if (eregi('CL',$channel_group)) + { + if (strlen($phone) > 9) {$search_phone = $phone;} + if ( (strlen($search_phone) < 10) or (strlen($fronter) < 1) ) + { + echo "\n"; + $stmt="SELECT user,phone_number from vicidial_list where lead_id='$parked_by';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if (strlen($fronter) < 1) {$fronter=$row[0];} + if (strlen($search_phone) < 10) {$search_phone=$row[1];} + } + + ?> +
+ + + + + + + + + + + + + + + +
COF MW Customer Search
Phone number
+
+

+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
New Search
Reservation Number:
Confirmation #:
Phone #:


Back
+ +
+ + + Close this window\n

\n"; +} +else +{ + echo "Record command FAILED for channel $channel       $NOW_TIME\n

\n"; + echo "Please go back and try again\n

\n"; +# echo "
\n"; +} + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/closer.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/closer.php new file mode 100644 index 00000000..59599edb --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/closer.php @@ -0,0 +1,353 @@ + LICENSE: GPLv2 +### +# the purpose of this script and webpage is to allow for remote or local users of the system to log in and grab phone calls that are coming inbound into the Asterisk server and being put in the parked_channels table while they hear a soundfile for a limited amount of time before being forwarded on to either a set extension or a voicemail box. This gives remote or local agents a way to grab calls without tying up their phone lines all day. The agent sees the refreshing screen of calls on park and when they want to take one they just click on it, and a small window opens that will allow them to grab the call and/or look up more information on the caller through the callerID that is given(if available) +# CHANGES +# +# 60620-1032 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["group_selected"])) {$group_selected=$_GET["group_selected"];} + elseif (isset($_POST["group_selected"])) {$group_selected=$_POST["group_selected"];} +if (isset($_GET["dialplan_number"])) {$dialplan_number=$_GET["dialplan_number"];} + elseif (isset($_POST["dialplan_number"])) {$dialplan_number=$_POST["dialplan_number"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["groupselect"])) {$groupselect=$_GET["groupselect"];} + elseif (isset($_POST["groupselect"])) {$groupselect=$_POST["groupselect"];} +if (isset($_GET["PHONE_LOGIN"])) {$PHONE_LOGIN=$_GET["PHONE_LOGIN"];} + elseif (isset($_POST["PHONE_LOGIN"])) {$PHONE_LOGIN=$_POST["PHONE_LOGIN"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["parked_time"])) {$parked_time=$_GET["parked_time"];} + elseif (isset($_POST["parked_time"])) {$parked_time=$_POST["parked_time"];} +if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];} + elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];} +if (isset($_GET["debugvars"])) {$debugvars=$_GET["debugvars"];} + elseif (isset($_POST["debugvars"])) {$debugvars=$_POST["debugvars"];} +if (isset($_GET["parked_by"])) {$parked_by=$_GET["parked_by"];} + elseif (isset($_POST["parked_by"])) {$parked_by=$_POST["parked_by"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$popup_page = './closer_popup.php'; + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 2;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + } + else + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + + +$color_class[0] = 'green'; +$color_class[1] = 'red'; +$color_class[2] = 'blue'; +$color_class[3] = 'purple'; +$color_class[4] = 'orange'; +$color_class[5] = 'green'; +$color_class[6] = 'red'; +$color_class[7] = 'blue'; +$color_class[8] = 'purple'; +$color_class[9] = 'orange'; +?> + + + + + +VICIDIAL CLOSER: Main + + +
+ + 0) + { + $stmt="SELECT dialplan_number,server_ip from phones where extension='" . mysql_real_escape_string($extension) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $dialplan_number=$row[0]; + $server_ip=$row[1]; + + if (!$group_selected) + { + $stmt="select distinct channel_group from park_log;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $groups_to_print = mysql_num_rows($rslt); + $i=0; + while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + echo "
Please select the groups you want to pick calls up from:
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Inbound Call Groups:
\n"; + $o=0; + while ($groups_to_print > $o) + { + $group_form_print = sprintf("%-20s", $groups[$o]); + echo "$group_form_print
\n"; + $o++; + } + echo "
\n"; + echo "\n"; + echo "


\n"; + } + else + { + $o=0; + while($o < $group_selected) + { + $form_groups = "$form_groups&groupselect[$o]=$groupselect[$o]"; + $o++; + } + + $stmt="INSERT INTO vicidial_user_log values('','" . mysql_real_escape_string($user) . "','LOGIN','CLOSER','$NOW_TIME','$STARTtime');"; + $rslt=mysql_query($stmt, $link); + + echo "\n"; + echo"\n"; + + echo "extension found, forwarding you to closer page, please wait 3 seconds...
\n"; + } + + } + else + { + echo "The extension you entered does not exist, please try again
\n"; + echo "
Please enter your phone_ID: \n"; + echo "\n"; + echo "phone station ID:   \n"; + echo "\n"; + echo "


\n"; + } + + } + else + { + echo "
Please enter your phone_ID: \n"; + echo "\n"; + echo "phone station ID:   \n"; + echo "\n"; + echo "


\n"; + } + +exit; + +} + +$o=0; +while($o < $group_selected) +{ + $listen_groups = "$listen_groups     $groupselect[$o]"; + $form_groups = "$form_groups&groupselect[$o]=$groupselect[$o]"; + $o++; +} + + +echo "\n"; +echo"\n"; + +#CHANNEL SERVER CHANNEL_GROUP EXTENSION PARKED_BY PARKED_TIME +#---------------------------------------------------------------------------------------------- +#Zap/73-1 10.10.11.11 IN_800_TPP_CS TPPpark 7275338730 2004-04-22 12:41:00 + + + +echo "$NOW_TIME           $PHP_AUTH_USER - $fullname - CALLS SENT TO: $dialplan_number

\n"; + +echo "Click on the channel below that you would like to have directed to your phone
\n"; + +echo "
\n";
+echo "CHANNEL    SERVER        CHANNEL_GROUP   EXTENSION    PARKED_BY            PARKED_TIME         \n";
+echo "---------------------------------------------------------------------------------------------- \n";
+
+
+
+
+
+$stmt="SELECT count(*) from parked_channels where server_ip='" . mysql_real_escape_string($server_ip) . "'";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+$parked_count = $row[0];
+	if ($parked_count > 0)
+	{
+	$stmt="SELECT * from parked_channels where server_ip='" . mysql_real_escape_string($server_ip) . "' and channel_group LIKE \"CL_%\" order by channel_group,parked_time";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$parked_to_print = mysql_num_rows($rslt);
+	$i=0;
+	while ($i < $parked_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		$channel =			sprintf("%-11s", $row[0]);
+		$server =			sprintf("%-14s", $row[1]);
+		$channel_group =	sprintf("%-16s", $row[2]);
+		$park_extension =	sprintf("%-13s", $row[3]);
+		$parked_by =		sprintf("%-21s", $row[4]);
+		$parked_time =		sprintf("%-19s", $row[5]);
+
+		$G='';   $EG='';
+		$o=0;
+		$with_color=0;
+		while($o < $group_selected)
+			{
+				if (eregi("$groupselect[$o]",$channel_group))
+					{
+					$G=""; $EG='';
+					$with_color++;
+					}
+				$o++;
+			}
+		if ($with_color)
+			{
+			if (eregi('CL_GAL',$row[2]))
+				{
+				echo "$G$channel$server$channel_group$park_extension                     $parked_time $EG\n";
+				}
+			else
+				{
+				echo "$G$channel$server$channel_group$park_extension$parked_by$parked_time $EG\n";
+				}
+			}
+#	
+		$i++;
+		}
+
+	}
+	else
+	{
+	echo "********************************************************************************************** \n";
+	echo "********************************************************************************************** \n";
+	echo "*************************************** NO PARKED CALLS ************************************** \n";
+	echo "********************************************************************************************** \n";
+	echo "********************************************************************************************** \n";
+	}
+
+echo "  \n\n";
+echo "looking for calls on these groups:\n";
+$o=0;
+while($o < $group_selected)
+{
+	$group_print =		sprintf("%-20s", $groupselect[$o]);
+	echo "             - $group_print\n";
+	$o++;
+}
+
+
+$ENDtime = date("U");
+
+$RUNtime = ($ENDtime - $STARTtime);
+
+echo "
\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/closer_dispo.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/closer_dispo.php new file mode 100644 index 00000000..54e61219 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/closer_dispo.php @@ -0,0 +1,329 @@ + LICENSE: GPLv2 +### +# this is the closer disposition screen of a call that has been grabbed. This allows the closer to modify customer information and disposition the call +# CHANGES +# +# 60619-1641 - Added variable filtering to eliminate SQL injection attack threat +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} +if (isset($_GET["phone"])) {$phone=$_GET["phone"];} + elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];} + elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];} +if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];} + elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];} +if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];} + elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];} +if (isset($_GET["end_call"])) {$end_call=$_GET["end_call"];} + elseif (isset($_POST["end_call"])) {$end_call=$_POST["end_call"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];} + elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];} + elseif (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["call_began"])) {$call_began=$_GET["call_began"];} + elseif (isset($_POST["call_began"])) {$call_began=$_POST["call_began"];} +if (isset($_GET["parked_time"])) {$parked_time=$_GET["parked_time"];} + elseif (isset($_POST["parked_time"])) {$parked_time=$_POST["parked_time"];} +if (isset($_GET["tsr"])) {$tsr=$_GET["tsr"];} + elseif (isset($_POST["tsr"])) {$tsr=$_POST["tsr"];} +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["postal_code"])) {$postal_code=$_GET["postal_code"];} + elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];} +if (isset($_GET["province"])) {$province=$_GET["province"];} + elseif (isset($_POST["province"])) {$province=$_POST["province"];} +if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];} + elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];} +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"])) {$security=$_GET["security"];} + elseif (isset($_POST["security"])) {$security=$_POST["security"];} +if (isset($_GET["comments"])) {$comments=$_GET["comments"];} + elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_datetime = $STARTtime; + +$ext_context = 'demo'; +if (!isset($begin_date)) {$begin_date = $TODAY;} +if (!isset($end_date)) {$end_date = $TODAY;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 2;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + } + else + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +?> + + +VICIDIAL CLOSER: Call Disposition +\n"; +?> + + +
+ + 0) +{ + +$call_length = ($STARTtime - $call_began); + + ### insert a NEW record to the vicidial_closer_log table + $stmt="INSERT INTO vicidial_closer_log (lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed) values('" . mysql_real_escape_string($lead_id) . "','" . mysql_real_escape_string($list_id) . "','" . mysql_real_escape_string($campaign_id) . "','" . mysql_real_escape_string($parked_time) . "','" . mysql_real_escape_string($call_began) . "','$STARTtime','" . mysql_real_escape_string($call_length) . "','" . mysql_real_escape_string($status) . "','" . mysql_real_escape_string($phone_code) . "','" . mysql_real_escape_string($phone_number) . "','$PHP_AUTH_USER','" . mysql_real_escape_string($comments) . "','Y')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ### update the lead record in the vicidial_list table + $stmt="UPDATE vicidial_list set status='" . mysql_real_escape_string($status) . "',first_name='" . mysql_real_escape_string($first_name) . "',last_name='" . mysql_real_escape_string($last_name) . "',address1='" . mysql_real_escape_string($address1) . "',address2='" . mysql_real_escape_string($address2) . "',address3='" . mysql_real_escape_string($address3) . "',city='" . mysql_real_escape_string($city) . "',state='" . mysql_real_escape_string($state) . "',province='" . mysql_real_escape_string($province) . "',postal_code='" . mysql_real_escape_string($postal_code) . "',country_code='" . mysql_real_escape_string($country_code) . "',alt_phone='" . mysql_real_escape_string($alt_phone) . "',email='" . mysql_real_escape_string($email) . "',security_phrase='" . mysql_real_escape_string($security) . "',comments='" . mysql_real_escape_string($comments) . "' where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT count(*) from live_channels where server_ip='$server_ip' and channel='" . mysql_real_escape_string($channel) . "' and extension like \"%" . mysql_real_escape_string($extension) . "%\""; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $parked_count = $row[0]; + + if ($parked_count > 0) + { + + $DTqueryCID = "RR$FILE_datetime$PHP_AUTH_USER"; + + ### insert a NEW record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','" . mysql_real_escape_string($server_ip) . "','','Hangup','$DTqueryCID','Channel: " . mysql_real_escape_string($channel) . "','','','','','','','','','')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "Hangup command sent for channel $channel       $NOW_TIME\n

\n"; + + echo "\n"; + } + else + { + echo "Hangup command FAILED for channel $channel       $NOW_TIME\n

\n"; + echo "
\n"; + } +} +else +{ + $stmt="SELECT count(*) from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_count = $row[0]; + + if ($lead_count > 0) + { + + $stmt="SELECT * from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_id = "$row[0]"; + $tsr = "$row[4]"; + $vendor_id = "$row[5]"; + $list_id = "$row[7]"; + $campaign_id = "$row[8]"; + $phone_code = "$row[10]"; + $phone_number = "$row[11]"; + $title = "$row[12]"; + $first_name = "$row[13]"; # + $middle_initial = "$row[14]"; + $last_name = "$row[15]"; # + $address1 = "$row[16]"; # + $address2 = "$row[17]"; # + $address3 = "$row[18]"; # + $city = "$row[19]"; # + $state = "$row[20]"; # + $province = "$row[21]"; # + $postal_code = "$row[22]"; # + $country_code = "$row[23]"; # + $gender = "$row[24]"; + $date_of_birth = "$row[25]"; + $alt_phone = "$row[26]"; # + $email = "$row[27]"; # + $security = "$row[28]"; # + $comments = "$row[29]"; # + + echo "
Call information: $first_name $last_name - $phone_number

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + echo "\n"; + echo "
Vendor ID: $vendor_id     Campaign ID: $campaign_id
Fronter: $tsr     List ID: $list_id
First Name:   \n"; + echo " Last Name:
Address 1 :
Address 2 :
Address 3 :
City :
State:   \n"; + echo " Postal Code:
Province :
Country :
Alt Phone :
Email :
Security :
Comments :
Disposition:
\n"; + echo "


\n"; + + } + else + { + echo "lead lookup FAILED for lead_id $lead_id       $NOW_TIME\n

\n"; +# echo "Close this window\n

\n"; + } + + + + + + +} + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/closer_popup.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/closer_popup.php new file mode 100644 index 00000000..e12f02c3 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/closer_popup.php @@ -0,0 +1,453 @@ + LICENSE: GPLv2 +### +# this is the closer popup of a specific call that grabs the call and allows you to go and fetch info on that caller in the local CRM system. +# CHANGES +# +# 60620-1029 - Added variable filtering to eliminate SQL injection attack threat +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["group_selected"])) {$group_selected=$_GET["group_selected"];} + elseif (isset($_POST["group_selected"])) {$group_selected=$_POST["group_selected"];} +if (isset($_GET["dialplan_number"])) {$dialplan_number=$_GET["dialplan_number"];} + elseif (isset($_POST["dialplan_number"])) {$dialplan_number=$_POST["dialplan_number"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["groupselect"])) {$groupselect=$_GET["groupselect"];} + elseif (isset($_POST["groupselect"])) {$groupselect=$_POST["groupselect"];} +if (isset($_GET["PHONE_LOGIN"])) {$PHONE_LOGIN=$_GET["PHONE_LOGIN"];} + elseif (isset($_POST["PHONE_LOGIN"])) {$PHONE_LOGIN=$_POST["PHONE_LOGIN"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["parked_time"])) {$parked_time=$_GET["parked_time"];} + elseif (isset($_POST["parked_time"])) {$parked_time=$_POST["parked_time"];} +if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];} + elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];} +if (isset($_GET["debugvars"])) {$debugvars=$_GET["debugvars"];} + elseif (isset($_POST["debugvars"])) {$debugvars=$_POST["debugvars"];} +if (isset($_GET["parked_by"])) {$parked_by=$_GET["parked_by"];} + elseif (isset($_POST["parked_by"])) {$parked_by=$_POST["parked_by"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + +#$DB=1; +$US = '_'; +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$REC_TIME = date("Ymd-His"); +$FILE_datetime = $STARTtime; + +$ext_context = 'demo'; + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 2;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + } + else + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +echo "VICIDIAL CLOSER: Popup\n"; +echo "\n"; + +if (eregi('CL_UNIV',$channel_group)) + { + ?> + + \n"; + echo "function WaitFirefix() {setTimeout(document.forms[0].search_phone.focus(), 1000)}\n"; + echo "\n"; + } +?> + + +
+ + 0) +{ + $stmt="DELETE from parked_channels where server_ip='" . mysql_real_escape_string($server_ip) . "' and parked_time='" . mysql_real_escape_string($parked_time) . "' and channel='" . mysql_real_escape_string($channel) . "' LIMIT 1"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + + #$monitor_channel = eregi_replace('Zap/', "", $channel); + $monitor_channel = eregi_replace('-1', "", $channel); + $SIPexten = $extension; + $filename = "$REC_TIME$US$SIPexten"; + $DTqueryCID = "RR$FILE_datetime$PHP_AUTH_USER"; + +# $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Monitor','$DTqueryCID','Channel: $monitor_channel','File: $filename','Callerid: $DTqueryCID','','','','','','','')"; +# if ($DB) {echo "|$stmt|\n";} +# $rslt=mysql_query($stmt, $link); + +# $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('$monitor_channel','$server_ip','SIP/$SIPexten','$NOW_TIME','$STARTtime','$filename')"; +# if ($DB) {echo "|$stmt|\n";} +# $rslt=mysql_query($stmt, $link); + +# $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; +# $rslt=mysql_query($stmt, $link); +# if ($DB) {echo "$stmt\n";} +# $row=mysql_fetch_row($rslt); +# $recording_id = $row[0]; + +# echo "Recording command sent for channel $channel - $filename - $recording_id
\n"; + + ### insert a NEW record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','" . mysql_real_escape_string($server_ip) . "','','Redirect','$DTqueryCID','Exten: $dialplan_number','Channel: " . mysql_real_escape_string($channel) . "','Context: $ext_context','Priority: 1','Callerid: $DTqueryCID','','','','','')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "Redirect command sent for channel $channel       $NOW_TIME\n

\n"; + + $stmt="SELECT full_name from vicidial_users where user='" . mysql_real_escape_string($parked_by) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + echo "Call Referred by: $parked_by - $full_name\n

\n"; + + $url = "http://10.10.10.196/vicidial/closer_dispo.php?lead_id=$parked_by&channel=$channel&server_ip=$server_ip&extension=$extension&call_began=$STARTtime&parked_time=$parked_time&DB=$DB"; + + echo "View Customer Info and Disposition Call\n

\n"; + + + + $stmt="UPDATE park_log set grab_time='$NOW_TIME',status='TALKING',extension='" . mysql_real_escape_string($extension) . "',user='$PHP_AUTH_USER' where parked_time='" . mysql_real_escape_string($parked_time) . "' and server_ip='" . mysql_real_escape_string($server_ip) . "' and channel='" . mysql_real_escape_string($channel) . "'"; + if ($DB) {echo "|$stmt|\n";} + $fp = fopen ("./closer_SQL_updates.txt", "a"); + fwrite ($fp, "$date|$PHP_AUTH_USER|$stmt|\n"); + fclose($fp); + + + $rslt=mysql_query($stmt, $link); + +########################################################################################### +####### HERE IS WHERE YOU DEFINE DIFFERENT CONTENTS DEPENDING UPON THE CHANNEL_GROUP PREFIX +########################################################################################### +if (eregi('CL_TEST',$channel_group)) + { + echo "GALLERIA TEST CLOSER GROUP: $channel_group\n"; + + $stmt="SELECT user,phone_number from vicidial_list where lead_id='" . mysql_real_escape_string($parked_by) . "';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $fronter=$row[0]; + $search_phone=$row[1]; + + + ?> +
+ + + + + + + + + + + + + + + +
COF MW Customer Search
Phone number
+
+

+ +
+ + + + + + + + + + + + + + + +
COF MW Customer Search
Phone number
+
+

+ -- INTERNAL CALL GALLERIA FRONT --
\n"; + $group_color='#99FF99'; + } + if (eregi('CL_GALLER2',$channel_group)) + { + echo "
-- TouchAsia CALL Simple Escapes FRONT --
\n"; + $group_color='#FF9999'; + } + if (eregi('CL_GALLER3',$channel_group)) + { + echo "
-- DebitSupplies CALL Simple Escapes FRONT --
\n"; + $group_color='#FF9999'; + } + if (eregi('CL_GALLER4',$channel_group)) + { + echo "
-- Vishnu CALL Simple Escapes FRONT --
\n"; + $group_color='#FF9999'; + } + + + ?> +
+ + + + + + + + + + + + + + + +
COF MW Customer Search
Phone number
+
+

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
New Search
Reservation Number:
Confirmation #:
Phone #:


Back
+ +
+ + + Close this window\n

\n"; +} +else +{ + echo "Redirect command FAILED for channel $channel       $NOW_TIME\n

\n"; + echo "
\n"; +} + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/count.htm b/agc_2-X/branches/agc_2.0.4/www/vicidial/count.htm new file mode 100644 index 00000000..51f8a361 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/count.htm @@ -0,0 +1 @@ + diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/dbconnect.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/dbconnect.php new file mode 100644 index 00000000..d31a326f --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/dbconnect.php @@ -0,0 +1,52 @@ + LICENSE: GPLv2 +# +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"); +mysql_select_db("$VARDB_database"); + +$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 +$AM_shift_BEGIN = '03:45:00'; +$AM_shift_END = '17:45:00'; +$PM_shift_BEGIN = '17:45:01'; +$PM_shift_END = '23:59:59'; +?> diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/group_hourly_stats.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/group_hourly_stats.php new file mode 100644 index 00000000..607f2fd7 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/group_hourly_stats.php @@ -0,0 +1,252 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60620-1014 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["date_with_hour"])) {$date_with_hour=$_GET["date_with_hour"];} + elseif (isset($_POST["date_with_hour"])) {$date_with_hour=$_POST["date_with_hour"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$date_with_hour_default = date("Y-m-d H"); +$date_no_hour_default = $TODAY; + +if (!isset($date_with_hour)) {$date_with_hour = $date_with_hour_default;} + $date_no_hour = $date_with_hour; + $date_no_hour = eregi_replace(" ([0-9]{2})",'',$date_no_hour); +if (!isset($begin_date)) {$begin_date = $TODAY;} +if (!isset($end_date)) {$end_date = $TODAY;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + +# $stmt="SELECT full_name from vicidial_users where user='$user';"; +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# $full_name = $row[0]; + + } + + + + +?> + + +VICIDIAL ADMIN: Group Hourly Stats +\n"; +?> + + +
+ + + + + += '" . mysql_real_escape_string($date_with_hour) . ":00:00' and call_date <= '" . mysql_real_escape_string($date_with_hour) . ":59:59' and user='$VDuser[$o]';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDtotal[$o] = "$row[0]"; + + $stmt="select count(*) from vicidial_log where call_date >= '" . mysql_real_escape_string($date_no_hour) . " 00:00:00' and call_date <= '" . mysql_real_escape_string($date_no_hour) . " 23:59:59' and user='$VDuser[$o]' and status='" . mysql_real_escape_string($status) . "';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDday[$o] = "$row[0]"; + + $stmt="select count(*) from vicidial_log where call_date >= '" . mysql_real_escape_string($date_with_hour) . ":00:00' and call_date <= '" . mysql_real_escape_string($date_with_hour) . ":59:59' and user='$VDuser[$o]' and status='" . mysql_real_escape_string($status) . "';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDcount[$o] = "$row[0]"; + $o++; + } + +echo "
" ?>   VICIDIAL ADMIN: Group Hourly Stats  
\n"; + +echo "
\n"; + +echo "TSR HOUR COUNTS: $group | $status | $date_with_hour | $date_no_hour\n"; + +echo "
\n"; +echo "\n"; + + $day_calls=0; + $hour_calls=0; + $total_calls=0; + $o=0; + while($o < $tsrs_to_print) + { + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + $total_calls = ($total_calls + $VDtotal[$o]); + $hour_calls = ($hour_calls + $VDcount[$o]); + $day_calls = ($day_calls + $VDday[$o]); + + $o++; + } + +echo "\n"; + + +} + +echo "
TSR ID   $status   TOTAL CALLS   $status DAY    
$VDuser[$o] $VDname[$o] $VDcount[$o] $VDtotal[$o] $VDday[$o]MODIFY | STATS
TOTAL $status $hour_calls $total_calls $day_calls
\n"; +echo "

\n"; + + + echo "
Please enter the group you want to get hourly stats for:
\n"; + echo "\n"; + echo "group:
\n"; + echo "status:   (example: XFER)
\n"; + echo "date with hour:   (example: 2004-06-25 14)
\n"; + echo "\n"; + echo "


\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/help.gif b/agc_2-X/branches/agc_2.0.4/www/vicidial/help.gif new file mode 100644 index 00000000..5575d7c8 Binary files /dev/null and b/agc_2-X/branches/agc_2.0.4/www/vicidial/help.gif differ diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/listloader.pl b/agc_2-X/branches/agc_2.0.4/www/vicidial/listloader.pl new file mode 100644 index 00000000..d926368b --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/listloader.pl @@ -0,0 +1,1084 @@ +#!/usr/bin/perl + +### listloader.pl version 0.4 *DBI-version* +### +### Copyright (C) 2007 Matt Florell,Joe Johnson LICENSE: GPLv2 +### +# +# +# CHANGES +# 60616-1548 - Added listID override feature to force all leads into same list +# - Added gmt_offset_now lookup for each lead +# 60811-1232 - Changed to DBI +# 60811-1329 - changed to use /etc/astguiclient.conf for configs +# 60822-1121 - fixed for nonwritable directories +# 60906-1058 - added filter of non-digits in alt_phone field +# 61110-1229 - added new USA-Canada DST scheme and Brazil DST scheme +# 61128-1215 - added postal code GMT lookup and duplicate check options +# 70205-1703 - Defaulted phone_code to 1 if not populated +# 70417-1059 - Fixed default phone_code bug +# 70510-1518 - Added campaign and system duplicate check and phonecode override +# + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help|-h/i) + { + print "allowed run time options:\n [-forcelistid=1234] = overrides the listID given in the file with the 1234\n [-h] = this help screen\n\n"; + + exit; + } + else + { + if ($args =~ /-duplicate-check/i) + {$dupcheck=1;} + if ($args =~ /-duplicate-campaign-check/i) + {$dupcheckcamp=1;} + if ($args =~ /-duplicate-system-check/i) + {$dupchecksys=1;} + if ($args =~ /-postal-code-gmt/i) + {$postalgmt=1;} + if ($args =~ /--forcelistid=/i) + { + @data_in = split(/--forcelistid=/,$args); + $forcelistid = $data_in[1]; + $forcelistid =~ s/ .*//gi; + print "\n----- FORCE LISTID OVERRIDE: $forcelistid -----\n\n"; + } + else + {$forcelistid = '';} + + if ($args =~ /--forcephonecode=/i) + { + @data_in = split(/--forcephonecode=/,$args); + $forcephonecode = $data_in[1]; + $forcephonecode =~ s/ .*//gi; + print "\n----- FORCE PHONECODE OVERRIDE: $forcephonecode -----\n\n"; + } + else + {$forcephonecode = '';} + + if ($args =~ /--lead-file=/i) + { + @data_in = split(/--lead-file=/,$args); + $lead_file = $data_in[1]; + $lead_file =~ s/ .*//gi; + # print "\n----- LEAD FILE: $lead_file -----\n\n"; + } + else + {$lead_file = './vicidial_temp_file.xls';} + } +} +### end parsing run-time options ### + + +use Spreadsheet::ParseExcel; +use Time::Local; +use DBI; + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + +$|=0; +$secX = time(); + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($hour < 10) {$hour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +$pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; +$pulldate="$year-$mon-$mday $hour:$min:$sec"; +$inSD = $pulldate0; +$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + + ### Grab Server values from the database + $stmtA = "SELECT local_gmt FROM servers where server_ip = '$server_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBSERVER_GMT = "$aryA[0]"; + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + $rec_count++; + } + $sthA->finish(); + + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + +if ($isdst) {$LOCAL_GMT_OFF++;} +if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";} + + + +$total=0; $good=0; $bad=0; +print "
Processing Excel file...\n"; +open(STMT_FILE, "> $PATHlogs/listloader_stmts.txt"); + +$oBook = Spreadsheet::ParseExcel::Workbook->Parse("$lead_file"); +my($iR, $iC, $oWkS, $oWkC); + +foreach $oWkS (@{$oBook->{Worksheet}}) { + for($iR = 0 ; defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow} ; $iR++) { + + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user = ""; + $oWkC = $oWkS->{Cells}[$iR][0]; + if ($oWkC) {$vendor_lead_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][1]; + if ($oWkC) {$source_code=$oWkC->Value; } + $source_id=$source_code; + $oWkC = $oWkS->{Cells}[$iR][2]; + if ($oWkC) {$list_id=$oWkC->Value; } + $gmt_offset = '0'; + $called_since_last_reset='N'; + $oWkC = $oWkS->{Cells}[$iR][3]; + if ($oWkC) {$phone_code=$oWkC->Value; } + $phone_code=~s/[^0-9]//g; + $oWkC = $oWkS->{Cells}[$iR][4]; + if ($oWkC) {$phone_number=$oWkC->Value; } + $phone_number=~s/[^0-9]//g; + $USarea = substr($phone_number, 0, 3); + $oWkC = $oWkS->{Cells}[$iR][5]; + if ($oWkC) {$title=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][6]; + if ($oWkC) {$first_name=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][7]; + if ($oWkC) {$middle_initial=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][8]; + if ($oWkC) {$last_name=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][9]; + if ($oWkC) {$address1=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][10]; + if ($oWkC) {$address2=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][11]; + if ($oWkC) {$address3=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][12]; + if ($oWkC) {$city=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][13]; + if ($oWkC) {$state=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][14]; + if ($oWkC) {$province=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][15]; + if ($oWkC) {$postal_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][16]; + if ($oWkC) {$country=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][17]; + if ($oWkC) {$gender=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][18]; + if ($oWkC) {$date_of_birth=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][19]; + if ($oWkC) {$alt_phone=$oWkC->Value; } + $alt_phone=~s/[^0-9]//g; + $oWkC = $oWkS->{Cells}[$iR][20]; + if ($oWkC) {$email=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][21]; + if ($oWkC) {$security_phrase=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][22]; + if ($oWkC) {$comments=$oWkC->Value; } + $comments=~s/^\s*(.*?)\s*$/$1/; + + if (length($forcelistid) > 0) + { + $list_id = $forcelistid; # set list_id to override value + } + if (length($forcephonecode) > 0) + { + $phone_code = $forcephonecode; # set phone_code to override value + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if ($dupchecksys > 0) + { + $dup_lead=0; + $stmtA = "select count(*) from vicidial_list where phone_number='$phone_number';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $dup_lead = $aryA[0]; + $dup_lead_list=$list_id; + } + $sthA->finish(); + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if ($dupcheck > 0) + { + $dup_lead=0; + $stmtA = "select list_id from vicidial_list where phone_number='$phone_number' and list_id='$list_id' limit 1;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $dup_lead_list = $aryA[0]; + $dup_lead++; + } + $sthA->finish(); + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if ($dupcheckcamp > 0) + { + $dup_lead=0; + $dup_lists=''; + + $stmtA = "select count(*) from vicidial_lists where list_id='$list_id';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + @aryA = $sthA->fetchrow_array; + $ci_recs = $aryA[0]; + $sthA->finish(); + if ($ci_recs > 0) + { + $stmtA = "select campaign_id from vicidial_lists where list_id='$list_id';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + @aryA = $sthA->fetchrow_array; + $dup_camp = $aryA[0]; + $sthA->finish(); + + $stmtA = "select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $dup_lists .= "'$aryA[0]',"; + $rec_count++; + } + $sthA->finish(); + + chop($dup_lists); + $stmtA = "select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $dup_lead_list = "'$aryA[0]',"; + $rec_count++; + $dup_lead=1; + } + $sthA->finish(); + } + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + + if ( (length($phone_number)>6) && ($dup_lead < 1) ) + { + $phone_list .= "$phone_number$US$list_id|"; + $postalgmt_found=0; + if (length($phone_code)<1) {$phone_code = '1';} + + if ( ($postalgmt > 0) && (length($postal_code)>4) ) + { + if ($phone_code =~ /^1$/) + { + $stmtA = "select * from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[2]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[3]; + $dst_range = $aryA[4]; + $PC_processed++; + $rec_count++; + $postalgmt_found++; + if ($DBX) {print " Postal GMT record found for $postal_code: |$gmt_offset|$dst|$dst_range|\n";} + } + $sthA->finish(); + } + } + if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =~ /^1$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### MEXICO ### + if ($phone_code =~ /^52$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### AUSTRALIA ### + if ($phone_code =~ /^61$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + } + + ### Find out if DST to raise the gmt offset ### + $AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); + $AC_localtime = ($secX + (3600 * $AC_GMT_diff)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($AC_localtime); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + + if ( (!$AC_processed) && ($dst_range =~ /SSM-FSN/) ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + &USACAN_dstcalc; + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSA-LSO/) ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + &NA_dstcalc; + if ($DBX) {print " DST: $NA_DST\n";} + if ($NA_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /LSM-LSO/) ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + &GBR_dstcalc; + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /LSO-LSM/) ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + &AUS_dstcalc; + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSO-LSM/) ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + &AUST_dstcalc; + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSO-TSM/) ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + &NZL_dstcalc; + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /TSO-LSF/) ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + &BZL_dstcalc; + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$area_GMT++;} + $AC_processed++; + } + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $affected_rows = $dbhA->do($stmtZ); + print STMT_FILE $stmtZ."\r\n"; + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| $dup_lead_list\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + sleep(1); +# flush(); + } + } +} + +if ($multi_insert_counter > 0) { + $stmtZ = "INSERT INTO vicidial_list values ".substr($multistmt, 0, -1).";"; + $affected_rows = $dbhA->do($stmtZ); + print STMT_FILE $stmtZ."\r\n"; +} + +print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + +exit; + + + + + + +sub USACAN_dstcalc { +#********************************************************************** +# SSM-FSN +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on Second Sunday March to First Sunday November at 2 am. +# INPUTS: +# mm INTEGER Month. +# dd INTEGER Day of the month. +# ns INTEGER Seconds into the day. +# dow INTEGER Day of week (0=Sunday, to 6=Saturday) +# OPTIONAL INPUT: +# timezone INTEGER hour difference UTC - local standard time +# (DEFAULT is blank) +# make calculations based on UTC time, +# which means shift at 10:00 UTC in April +# and 9:00 UTC in October +# OUTPUT: +# INTEGER 1 = DST, 0 = not DST +# +# S M T W T F S +# 1 2 3 4 5 6 7 +# 8 9 10 11 12 13 14 +#15 16 17 18 19 20 21 +#22 23 24 25 26 27 28 +#29 30 31 +# +# S M T W T F S +# 1 2 3 4 5 6 +# 7 8 9 10 11 12 13 +#14 15 16 17 18 19 20 +#21 22 23 24 25 26 27 +#28 29 30 31 +# +#********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; return 0; + } elsif ($mm >= 4 && $mm <= 10) { + $USACAN_DST=1; return 1; + } elsif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; return 1; + } elsif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; return 0; + } else { + $USACAN_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $USACAN_DST=0; return 0; + } else { + $USACAN_DST=1; return 1; + } + } + } else { + $USACAN_DST=0; return 0; + } + } elsif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; return 0; + } elsif ($dd < ($dow+1)) { + $USACAN_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; return 1; + } else { + $USACAN_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; return 1; + } else { + $USACAN_DST=0; return 0; + } + } + } else { + $USACAN_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub NA_dstcalc { +#********************************************************************** +# FSA-LSO +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in April and last Sunday in October at 2 am. +#********************************************************************** + + $NA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $NA_DST=0; return 0; + } elsif ($mm >= 5 && $mm <= 9) { + $NA_DST=1; return 1; + } elsif ($mm == 4) { + if ($dd > 7) { + $NA_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $NA_DST=0; return 0; + } else { + $NA_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $NA_DST=0; return 0; + } else { + $NA_DST=1; return 1; + } + } + } else { + $NA_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $NA_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $NA_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $NA_DST=1; return 1; + } else { + $NA_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 7200) { + $NA_DST=1; return 1; + } else { + $NA_DST=0; return 0; + } + } + } else { + $NA_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub GBR_dstcalc { +#********************************************************************** +# LSM-LSO +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in March and last Sunday in October at 1 am. +#********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; return 0; + } elsif ($mm >= 4 && $mm <= 9) { + $GBR_DST=1; return 1; + } elsif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $GBR_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; return 0; + } else { + $GBR_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; return 0; + } else { + $GBR_DST=1; return 1; + } + } + } else { + $GBR_DST=1; return 1; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $GBR_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; return 1; + } else { + $GBR_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; return 1; + } else { + $GBR_DST=0; return 0; + } + } + } else { + $GBR_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub AUS_dstcalc { +#********************************************************************** +# LSO-LSM +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in October and last Sunday in March at 1 am. +#********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $AUS_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $AUS_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; return 1; + } else { + $AUS_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; return 1; + } else { + $AUS_DST=0; return 0; + } + } + } else { + $AUS_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $AUS_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; return 0; + } else { + $AUS_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; return 0; + } else { + $AUS_DST=1; return 1; + } + } + } else { + $AUS_DST=1; return 1; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub AUST_dstcalc { +#********************************************************************** +# FSO-LSM +# TASMANIA ONLY +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and last Sunday in March at 1 am. +#********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $AUST_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $AUST_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; return 1; + } else { + $AUST_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; return 1; + } else { + $AUST_DST=0; return 0; + } + } + } else { + $AUST_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd >= 8) { + $AUST_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $AUST_DST=0; return 0; + } else { + $AUST_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $AUST_DST=0; return 0; + } else { + $AUST_DST=1; return 1; + } + } + } else { + $AUST_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub NZL_dstcalc { +#********************************************************************** +# FSO-TSM +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and third Sunday in March at 1 am. +#********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $NZL_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; return 1; + } elsif ($dd < ($dow+14)) { + $NZL_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; return 1; + } else { + $NZL_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; return 1; + } else { + $NZL_DST=0; return 0; + } + } + } else { + $NZL_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd >= 8) { + $NZL_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $NZL_DST=0; return 0; + } else { + $NZL_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $NZL_DST=0; return 0; + } else { + $NZL_DST=1; return 1; + } + } + } else { + $NZL_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub BZL_dstcalc { +#********************************************************************** +# TSO-LSF +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. Brazil +# Based on Third Sunday October to Last Sunday February at 1 am. +#********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; return 1; + } elsif ($mm >= 3 && $mm <= 9) { + $BZL_DST=0; return 0; + } elsif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; return 1; + } elsif ($dd < ($dow+22)) { + $BZL_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; return 1; + } else { + $BZL_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; return 1; + } else { + $BZL_DST=0; return 0; + } + } + } else { + $BZL_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; return 0; + } elsif ($dd < ($dow+22)) { + $BZL_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; return 0; + } else { + $BZL_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; return 0; + } else { + $BZL_DST=1; return 1; + } + } + } else { + $BZL_DST=1; return 1; + } + } # end of month checks +} # end of subroutine dstcalc diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/listloaderMAIN.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/listloaderMAIN.php new file mode 100644 index 00000000..bb292c36 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/listloaderMAIN.php @@ -0,0 +1,86 @@ + LICENSE: GPLv2 +# +# this is the main frame page for the lead loading section. This is where you +# would upload a file and have it inserted into vicidial_list +# +# changes: +# 60620-1149 - Added variable filtering to eliminate SQL injection attack threat +# 60822-1105 - fixed for nonwritable directories +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_datetime = $STARTtime; + +$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +if ($WeBRooTWritablE > 0) {$fp = fopen ("./project_auth_entries.txt", "a");} +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-LEAD-LOADER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT load_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGload_leads =$row[0]; + + if ($LOGload_leads < 1) + { + echo "You do not have permissions to load leads\n"; + exit; + } + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "LIST_LOAD|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "LIST_LOAD|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + +?> + +VICIDIAL: Lead Loader Module + + + + + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/listloader_rowdisplay.pl b/agc_2-X/branches/agc_2.0.4/www/vicidial/listloader_rowdisplay.pl new file mode 100644 index 00000000..3f8695c0 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/listloader_rowdisplay.pl @@ -0,0 +1,153 @@ +#!/usr/bin/perl + +### listloader_rowdisplay.pl version 0.2 *DBI-version* +### +### Copyright (C) 2006 Matt Florell,Joe Johnson LICENSE: GPLv2 +### +# +# CHANGES +# +# 60811-1232 - Changed to DBI +# 60811-1329 - changed to use /etc/astguiclient.conf for configs +# + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help|-h/i) + { + print "allowed run time options:\n [-forcelistid=1234] = overrides the listID given in the file with the 1234\n [-h] = this help screen\n\n"; + + exit; + } + else + { + if ($args =~ /-duplicate-check/i) + {$dupcheck=1;} + if ($args =~ /-postal-code-gmt/i) + {$postalgmt=1;} + if ($args =~ /--lead-file=/i) + { + @data_in = split(/--lead-file=/,$args); + $lead_file = $data_in[1]; + $lead_file =~ s/ .*//gi; + # print "\n----- LEAD FILE: $lead_file -----\n\n"; + } + else + {$lead_file = './vicidial_temp_file.xls';} + } +} +### end parsing run-time options ### + +use Spreadsheet::ParseExcel; +use Time::Local; +use DBI; + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + +$oBook = Spreadsheet::ParseExcel::Workbook->Parse("$lead_file"); +my($iR, $iC, $oWkS, $oWkC); +$var_str=""; + +foreach $oWkS (@{$oBook->{Worksheet}}) { + for(my $iC = $oWkS->{MinCol} ; defined $oWkS->{MaxCol} && $iC <= $oWkS->{MaxCol} ; $iC++) { + $oWkC = $oWkS->{Cells}[0][$iC]; + if ($oWkC) { + $var_str.=$oWkC->Value."|"; + } else { + $var_str.="|"; + } + } +} + +@xls_row=split(/\|/, $var_str); + + +$stmtA = "select vendor_lead_code, source_id, list_id, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments from vicidial_list limit 1;"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + my $names = $sthA->{'NAME'}; + my $numFields = $sthA->{'NUM_OF_FIELDS'}; + for (my $i = 0; $i < $numFields; $i++) + { + # printf("%s%s", $i ? "," : "", $$names[$i]); + # printf("%s%s", $i ? "," : "", $$ref[$i]); + + $field_name=uc($$names[$i]); + $field_name=~s/\_/ /g; + print "
\r\n"; + print " \r\n"; + } + $rec_count++; + } +$sthA->finish(); + +exit; diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/listloader_super.pl b/agc_2-X/branches/agc_2.0.4/www/vicidial/listloader_super.pl new file mode 100644 index 00000000..167fff5e --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/listloader_super.pl @@ -0,0 +1,1086 @@ +#!/usr/bin/perl + +### listloader_super.pl version 0.4 *DBI-version* +### +### Copyright (C) 2007 Matt Florell,Joe Johnson LICENSE: GPLv2 +### +# +# +# CHANGES +# 60616-1548 - Added listID override feature to force all leads into same list +# - Added gmt_offset_now lookup for each lead +# 60811-1232 - Changed to DBI +# 60811-1329 - changed to use /etc/astguiclient.conf for configs +# 60906-1056 - added filter of non-digits in alt_phone field +# 61110-1229 - added new USA-Canada DST scheme and Brazil DST scheme +# 61128-1207 - added postal code GMT lookup and duplicate check options +# 70205-1703 - Defaulted phone_code to 1 if not populated +# 70417-1059 - Fixed default phone_code bug +# 70510-1518 - Added campaign and system duplicate check and phonecode override +# + +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help|-h/i) + { + print "allowed run time options:\n [-forcelistid=1234] = overrides the listID given in the file with the 1234\n [-h] = this help screen\n\n"; + + exit; + } + else + { + if ($args =~ /-duplicate-check/i) + {$dupcheck=1;} + if ($args =~ /-duplicate-campaign-check/i) + {$dupcheckcamp=1;} + if ($args =~ /-duplicate-system-check/i) + {$dupchecksys=1;} + if ($args =~ /-postal-code-gmt/i) + {$postalgmt=1;} + if ($args =~ /--forcelistid=/i) + { + @data_in = split(/--forcelistid=/,$args); + $forcelistid = $data_in[1]; + $forcelistid =~ s/ .*//gi; + print "\n----- FORCE LISTID OVERRIDE: $forcelistid -----\n\n"; + } + else + {$forcelistid = '';} + + if ($args =~ /--forcephonecode=/i) + { + @data_in = split(/--forcephonecode=/,$args); + $forcephonecode = $data_in[1]; + $forcephonecode =~ s/ .*//gi; + print "\n----- FORCE PHONECODE OVERRIDE: $forcephonecode -----\n\n"; + } + else + {$forcephonecode = '';} + + if ($args =~ /--lead-file=/i) + { + @data_in = split(/--lead-file=/,$args); + $lead_file = $data_in[1]; + $lead_file =~ s/ .*//gi; + # print "\n----- LEAD FILE: $lead_file -----\n\n"; + } + else + {$lead_file = './vicidial_temp_file.xls';} + } +} +### end parsing run-time options ### + +use Spreadsheet::ParseExcel; +use Time::Local; +use DBI; + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + +$vars=$ARGV[0]; +@xls_fields=split(/\,/, $vars); + +$|=0; +$secX = time(); + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +$year = ($year + 1900); +$mon++; +if ($hour < 10) {$hour = "0$hour";} +if ($min < 10) {$min = "0$min";} +if ($sec < 10) {$sec = "0$sec";} +if ($mon < 10) {$mon = "0$mon";} +if ($mday < 10) {$mday = "0$mday";} +$pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; +$pulldate="$year-$mon-$mday $hour:$min:$sec"; +$inSD = $pulldate0; +$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + + ### Grab Server values from the database + $stmtA = "SELECT local_gmt FROM servers where server_ip = '$server_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBSERVER_GMT = "$aryA[0]"; + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + $rec_count++; + } + $sthA->finish(); + + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + +if ($isdst) {$LOCAL_GMT_OFF++;} +if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";} + + + +$total=0; $good=0; $bad=0; +open(STMT_FILE, "> $PATHlogs/listloader_stmts.txt"); + +$oBook = Spreadsheet::ParseExcel::Workbook->Parse("$lead_file"); +my($iR, $iC, $oWkS, $oWkC); + +foreach $oWkS (@{$oBook->{Worksheet}}) { + for($iR = 0 ; defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow} ; $iR++) { + + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user = ""; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[0]]; + if ($oWkC) {$vendor_lead_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[1]]; + if ($oWkC) {$source_code=$oWkC->Value; } + $source_id=$source_code; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[2]]; + if ($oWkC) {$list_id=$oWkC->Value; } + $gmt_offset = '0'; + $called_since_last_reset='N'; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[3]]; + if ($oWkC) {$phone_code=$oWkC->Value; } + $phone_code=~s/[^0-9]//g; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[4]]; + if ($oWkC) {$phone_number=$oWkC->Value; } + $phone_number=~s/[^0-9]//g; + $USarea = substr($phone_number, 0, 3); + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[5]]; + if ($oWkC) {$title=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[6]]; + if ($oWkC) {$first_name=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[7]]; + if ($oWkC) {$middle_initial=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[8]]; + if ($oWkC) {$last_name=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[9]]; + if ($oWkC) {$address1=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[10]]; + if ($oWkC) {$address2=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[11]]; + if ($oWkC) {$address3=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[12]]; + if ($oWkC) {$city=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[13]]; + if ($oWkC) {$state=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[14]]; + if ($oWkC) {$province=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[15]]; + if ($oWkC) {$postal_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[16]]; + if ($oWkC) {$country_code=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[17]]; + if ($oWkC) {$gender=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[18]]; + if ($oWkC) {$date_of_birth=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[19]]; + if ($oWkC) {$alt_phone=$oWkC->Value; } + $alt_phone=~s/[^0-9]//g; + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[20]]; + if ($oWkC) {$email=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[21]]; + if ($oWkC) {$security_phrase=$oWkC->Value; } + $oWkC = $oWkS->{Cells}[$iR][$xls_fields[22]]; + if ($oWkC) {$comments=$oWkC->Value; } + $comments=~s/^\s*(.*?)\s*$/$1/; + + + + if (length($forcelistid) > 0) + { + $list_id = $forcelistid; # set list_id to override value + } + if (length($forcephonecode) > 0) + { + $phone_code = $forcephonecode; # set phone_code to override value + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if ($dupchecksys > 0) + { + $dup_lead=0; + $stmtA = "select count(*) from vicidial_list where phone_number='$phone_number';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $dup_lead = $aryA[0]; + $dup_lead_list=$list_id; + } + $sthA->finish(); + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if ($dupcheck > 0) + { + $dup_lead=0; + $stmtA = "select list_id from vicidial_list where phone_number='$phone_number' and list_id='$list_id' limit 1;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $dup_lead_list = $aryA[0]; + $dup_lead++; + } + $sthA->finish(); + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if ($dupcheckcamp > 0) + { + $dup_lead=0; + $dup_lists=''; + + $stmtA = "select count(*) from vicidial_lists where list_id='$list_id';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + @aryA = $sthA->fetchrow_array; + $ci_recs = $aryA[0]; + $sthA->finish(); + if ($ci_recs > 0) + { + $stmtA = "select campaign_id from vicidial_lists where list_id='$list_id';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + @aryA = $sthA->fetchrow_array; + $dup_camp = $aryA[0]; + $sthA->finish(); + + $stmtA = "select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $dup_lists .= "'$aryA[0]',"; + $rec_count++; + } + $sthA->finish(); + + chop($dup_lists); + $stmtA = "select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $dup_lead_list = "'$aryA[0]',"; + $rec_count++; + $dup_lead=1; + } + $sthA->finish(); + } + if ($dup_lead < 1) + { + if ($phone_list =~ /\|$phone_number$US$list_id\|/) + {$dup_lead++;} + } + } + + if ( (length($phone_number)>6) && ($dup_lead < 1) ) + { + $phone_list .= "$phone_number$US$list_id|"; + $postalgmt_found=0; + if (length($phone_code)<1) {$phone_code = '1';} + + if ( ($postalgmt > 0) && (length($postal_code)>4) ) + { + if ($phone_code =~ /^1$/) + { + $stmtA = "select * from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[2]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[3]; + $dst_range = $aryA[4]; + $PC_processed++; + $rec_count++; + $postalgmt_found++; + if ($DBX) {print " Postal GMT record found for $postal_code: |$gmt_offset|$dst|$dst_range|\n";} + } + $sthA->finish(); + } + } + if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =~ /^1$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### MEXICO ### + if ($phone_code =~ /^52$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### AUSTRALIA ### + if ($phone_code =~ /^61$/) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $stmtA = "select * from vicidial_phone_codes where country_code='$phone_code';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + } + + ### Find out if DST to raise the gmt offset ### + $AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); + $AC_localtime = ($secX + (3600 * $AC_GMT_diff)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($AC_localtime); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + + if ( (!$AC_processed) && ($dst_range =~ /SSM-FSN/) ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + &USACAN_dstcalc; + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSA-LSO/) ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + &NA_dstcalc; + if ($DBX) {print " DST: $NA_DST\n";} + if ($NA_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /LSM-LSO/) ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + &GBR_dstcalc; + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /LSO-LSM/) ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + &AUS_dstcalc; + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSO-LSM/) ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + &AUST_dstcalc; + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSO-TSM/) ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + &NZL_dstcalc; + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /TSO-LSF/) ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + &BZL_dstcalc; + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$area_GMT++;} + $AC_processed++; + } + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $affected_rows = $dbhA->do($stmtZ); + print STMT_FILE $stmtZ."\r\n"; + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| $dup_lead_list\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + sleep(1); +# flush(); + } + } +} + +if ($multi_insert_counter > 0) { + $stmtZ = "INSERT INTO vicidial_list values ".substr($multistmt, 0, -1).";"; + $affected_rows = $dbhA->do($stmtZ); + print STMT_FILE $stmtZ."\r\n"; +} + +print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total"; + +exit; + + + + + + +sub USACAN_dstcalc { +#********************************************************************** +# SSM-FSN +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on Second Sunday March to First Sunday November at 2 am. +# INPUTS: +# mm INTEGER Month. +# dd INTEGER Day of the month. +# ns INTEGER Seconds into the day. +# dow INTEGER Day of week (0=Sunday, to 6=Saturday) +# OPTIONAL INPUT: +# timezone INTEGER hour difference UTC - local standard time +# (DEFAULT is blank) +# make calculations based on UTC time, +# which means shift at 10:00 UTC in April +# and 9:00 UTC in October +# OUTPUT: +# INTEGER 1 = DST, 0 = not DST +# +# S M T W T F S +# 1 2 3 4 5 6 7 +# 8 9 10 11 12 13 14 +#15 16 17 18 19 20 21 +#22 23 24 25 26 27 28 +#29 30 31 +# +# S M T W T F S +# 1 2 3 4 5 6 +# 7 8 9 10 11 12 13 +#14 15 16 17 18 19 20 +#21 22 23 24 25 26 27 +#28 29 30 31 +# +#********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; return 0; + } elsif ($mm >= 4 && $mm <= 10) { + $USACAN_DST=1; return 1; + } elsif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; return 1; + } elsif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; return 0; + } else { + $USACAN_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $USACAN_DST=0; return 0; + } else { + $USACAN_DST=1; return 1; + } + } + } else { + $USACAN_DST=0; return 0; + } + } elsif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; return 0; + } elsif ($dd < ($dow+1)) { + $USACAN_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; return 1; + } else { + $USACAN_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; return 1; + } else { + $USACAN_DST=0; return 0; + } + } + } else { + $USACAN_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub NA_dstcalc { +#********************************************************************** +# FSA-LSO +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in April and last Sunday in October at 2 am. +#********************************************************************** + + $NA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $NA_DST=0; return 0; + } elsif ($mm >= 5 && $mm <= 9) { + $NA_DST=1; return 1; + } elsif ($mm == 4) { + if ($dd > 7) { + $NA_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $NA_DST=0; return 0; + } else { + $NA_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $NA_DST=0; return 0; + } else { + $NA_DST=1; return 1; + } + } + } else { + $NA_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $NA_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $NA_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $NA_DST=1; return 1; + } else { + $NA_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 7200) { + $NA_DST=1; return 1; + } else { + $NA_DST=0; return 0; + } + } + } else { + $NA_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub GBR_dstcalc { +#********************************************************************** +# LSM-LSO +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in March and last Sunday in October at 1 am. +#********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; return 0; + } elsif ($mm >= 4 && $mm <= 9) { + $GBR_DST=1; return 1; + } elsif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $GBR_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; return 0; + } else { + $GBR_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; return 0; + } else { + $GBR_DST=1; return 1; + } + } + } else { + $GBR_DST=1; return 1; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $GBR_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; return 1; + } else { + $GBR_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; return 1; + } else { + $GBR_DST=0; return 0; + } + } + } else { + $GBR_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub AUS_dstcalc { +#********************************************************************** +# LSO-LSM +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in October and last Sunday in March at 1 am. +#********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $AUS_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $AUS_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; return 1; + } else { + $AUS_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; return 1; + } else { + $AUS_DST=0; return 0; + } + } + } else { + $AUS_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $AUS_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; return 0; + } else { + $AUS_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; return 0; + } else { + $AUS_DST=1; return 1; + } + } + } else { + $AUS_DST=1; return 1; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub AUST_dstcalc { +#********************************************************************** +# FSO-LSM +# TASMANIA ONLY +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and last Sunday in March at 1 am. +#********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $AUST_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $AUST_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; return 1; + } else { + $AUST_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; return 1; + } else { + $AUST_DST=0; return 0; + } + } + } else { + $AUST_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd >= 8) { + $AUST_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $AUST_DST=0; return 0; + } else { + $AUST_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $AUST_DST=0; return 0; + } else { + $AUST_DST=1; return 1; + } + } + } else { + $AUST_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub NZL_dstcalc { +#********************************************************************** +# FSO-TSM +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and third Sunday in March at 1 am. +#********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $NZL_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; return 1; + } elsif ($dd < ($dow+14)) { + $NZL_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; return 1; + } else { + $NZL_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; return 1; + } else { + $NZL_DST=0; return 0; + } + } + } else { + $NZL_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd >= 8) { + $NZL_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $NZL_DST=0; return 0; + } else { + $NZL_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $NZL_DST=0; return 0; + } else { + $NZL_DST=1; return 1; + } + } + } else { + $NZL_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub BZL_dstcalc { +#********************************************************************** +# TSO-LSF +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. Brazil +# Based on Third Sunday October to Last Sunday February at 1 am. +#********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; return 1; + } elsif ($mm >= 3 && $mm <= 9) { + $BZL_DST=0; return 0; + } elsif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; return 1; + } elsif ($dd < ($dow+22)) { + $BZL_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; return 1; + } else { + $BZL_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; return 1; + } else { + $BZL_DST=0; return 0; + } + } + } else { + $BZL_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; return 0; + } elsif ($dd < ($dow+22)) { + $BZL_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; return 0; + } else { + $BZL_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; return 0; + } else { + $BZL_DST=1; return 1; + } + } + } else { + $BZL_DST=1; return 1; + } + } # end of month checks +} # end of subroutine dstcalc diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/log_test.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/log_test.php new file mode 100644 index 00000000..cd7a86b7 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/log_test.php @@ -0,0 +1,37 @@ + LICENSE: GPLv2 +# + + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_datetime = $STARTtime; + +$ext_context = 'demo'; +if (!isset($begin_date)) {$begin_date = $TODAY;} +if (!isset($end_date)) {$end_date = $TODAY;} + + +$fp = fopen ("./closer_SQL_updates.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + fwrite ($fp, "CLOSER SQL UPDATE|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + + +exit; + + + +?> + + +Hello + + diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/new_listloader_superL.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/new_listloader_superL.php new file mode 100644 index 00000000..629321ed --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/new_listloader_superL.php @@ -0,0 +1,2069 @@ + LICENSE: GPLv2 +# +# AST GUI lead loader from formatted file +# +# CHANGES +# 50602-1640 - First version created by Joe Johnson +# 51128-1108 - Removed PHP global vars requirement +# 60113-1603 - Fixed a few bugs in Excel import +# 60421-1624 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60616-1240 - added listID override +# 60616-1604 - added gmt lookup for each lead +# 60619-1651 - Added variable filtering to eliminate SQL injection attack threat +# 60822-1121 - fixed for nonwritable directories +# 60906-1100 - added filter of non-digits in alt_phone field +# 61110-1222 - added new USA-Canada DST scheme and Brazil DST scheme +# 61128-1149 - added postal code GMT lookup and duplicate check options +# 70417-1059 - Fixed default phone_code bug +# 70510-1518 - Added campaign and system duplicate check and phonecode override +# +# make sure vicidial_list exists and that your file follows the formatting correctly. This page does not dedupe or do any other lead filtering actions yet at this time. + +$version = '2.0.4'; +$build = '70510-1518'; + + +require("dbconnect.php"); + +### links used for testing +#$link=mysql_connect("10.10.10.15", "cron", "1234"); +#mysql_select_db("asterisk"); +#$WeBServeRRooT = '/home/www/htdocs'; + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$leadfile=$_FILES["leadfile"]; + $LF_orig = $_FILES['leadfile']['name']; + $LF_path = $_FILES['leadfile']['tmp_name']; +if (isset($_GET["submit_file"])) {$submit_file=$_GET["submit_file"];} + elseif (isset($_POST["submit_file"])) {$submit_file=$_POST["submit_file"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["leadfile_name"])) {$leadfile_name=$_GET["leadfile_name"];} + elseif (isset($_POST["leadfile_name"])) {$leadfile_name=$_POST["leadfile_name"];} +if (isset($_GET["file_layout"])) {$file_layout=$_GET["file_layout"];} + elseif (isset($_POST["file_layout"])) {$file_layout=$_POST["file_layout"];} +if (isset($_GET["OK_to_process"])) {$OK_to_process=$_GET["OK_to_process"];} + elseif (isset($_POST["OK_to_process"])) {$OK_to_process=$_POST["OK_to_process"];} +if (isset($_GET["vendor_lead_code_field"])) {$vendor_lead_code_field=$_GET["vendor_lead_code_field"];} + elseif (isset($_POST["vendor_lead_code_field"])) {$vendor_lead_code_field=$_POST["vendor_lead_code_field"];} +if (isset($_GET["source_id_field"])) {$source_id_field=$_GET["source_id_field"];} + elseif (isset($_POST["source_id_field"])) {$source_id_field=$_POST["source_id_field"];} +if (isset($_GET["list_id_field"])) {$list_id_field=$_GET["list_id_field"];} + elseif (isset($_POST["list_id_field"])) {$list_id_field=$_POST["list_id_field"];} +if (isset($_GET["phone_code_field"])) {$phone_code_field=$_GET["phone_code_field"];} + elseif (isset($_POST["phone_code_field"])) {$phone_code_field=$_POST["phone_code_field"];} +if (isset($_GET["phone_number_field"])) {$phone_number_field=$_GET["phone_number_field"];} + elseif (isset($_POST["phone_number_field"])) {$phone_number_field=$_POST["phone_number_field"];} +if (isset($_GET["title_field"])) {$title_field=$_GET["title_field"];} + elseif (isset($_POST["title_field"])) {$title_field=$_POST["title_field"];} +if (isset($_GET["first_name_field"])) {$first_name_field=$_GET["first_name_field"];} + elseif (isset($_POST["first_name_field"])) {$first_name_field=$_POST["first_name_field"];} +if (isset($_GET["middle_initial_field"])) {$middle_initial_field=$_GET["middle_initial_field"];} + elseif (isset($_POST["middle_initial_field"])) {$middle_initial_field=$_POST["middle_initial_field"];} +if (isset($_GET["last_name_field"])) {$last_name_field=$_GET["last_name_field"];} + elseif (isset($_POST["last_name_field"])) {$last_name_field=$_POST["last_name_field"];} +if (isset($_GET["address1_field"])) {$address1_field=$_GET["address1_field"];} + elseif (isset($_POST["address1_field"])) {$address1_field=$_POST["address1_field"];} +if (isset($_GET["address2_field"])) {$address2_field=$_GET["address2_field"];} + elseif (isset($_POST["address2_field"])) {$address2_field=$_POST["address2_field"];} +if (isset($_GET["address3_field"])) {$address3_field=$_GET["address3_field"];} + elseif (isset($_POST["address3_field"])) {$address3_field=$_POST["address3_field"];} +if (isset($_GET["city_field"])) {$city_field=$_GET["city_field"];} + elseif (isset($_POST["city_field"])) {$city_field=$_POST["city_field"];} +if (isset($_GET["state_field"])) {$state_field=$_GET["state_field"];} + elseif (isset($_POST["state_field"])) {$state_field=$_POST["state_field"];} +if (isset($_GET["province_field"])) {$province_field=$_GET["province_field"];} + elseif (isset($_POST["province_field"])) {$province_field=$_POST["province_field"];} +if (isset($_GET["postal_code_field"])) {$postal_code_field=$_GET["postal_code_field"];} + elseif (isset($_POST["postal_code_field"])) {$postal_code_field=$_POST["postal_code_field"];} +if (isset($_GET["country_code_field"])) {$country_code_field=$_GET["country_code_field"];} + elseif (isset($_POST["country_code_field"])) {$country_code_field=$_POST["country_code_field"];} +if (isset($_GET["gender_field"])) {$gender_field=$_GET["gender_field"];} + elseif (isset($_POST["gender_field"])) {$gender_field=$_POST["gender_field"];} +if (isset($_GET["date_of_birth_field"])) {$date_of_birth_field=$_GET["date_of_birth_field"];} + elseif (isset($_POST["date_of_birth_field"])) {$date_of_birth_field=$_POST["date_of_birth_field"];} +if (isset($_GET["alt_phone_field"])) {$alt_phone_field=$_GET["alt_phone_field"];} + elseif (isset($_POST["alt_phone_field"])) {$alt_phone_field=$_POST["alt_phone_field"];} +if (isset($_GET["email_field"])) {$email_field=$_GET["email_field"];} + elseif (isset($_POST["email_field"])) {$email_field=$_POST["email_field"];} +if (isset($_GET["security_phrase_field"])) {$security_phrase_field=$_GET["security_phrase_field"];} + elseif (isset($_POST["security_phrase_field"])) {$security_phrase_field=$_POST["security_phrase_field"];} +if (isset($_GET["comments_field"])) {$comments_field=$_GET["comments_field"];} + elseif (isset($_POST["comments_field"])) {$comments_field=$_POST["comments_field"];} +if (isset($_GET["list_id_override"])) {$list_id_override=$_GET["list_id_override"];} + elseif (isset($_POST["list_id_override"])) {$list_id_override=$_POST["list_id_override"];} + $list_id_override = (preg_replace("/\D/","",$list_id_override)); +if (isset($_GET["lead_file"])) {$lead_file=$_GET["lead_file"];} + elseif (isset($_POST["lead_file"])) {$lead_file=$_POST["lead_file"];} +if (isset($_GET["dupcheck"])) {$dupcheck=$_GET["dupcheck"];} + elseif (isset($_POST["dupcheck"])) {$dupcheck=$_POST["dupcheck"];} +if (isset($_GET["postalgmt"])) {$postalgmt=$_GET["postalgmt"];} + elseif (isset($_POST["postalgmt"])) {$postalgmt=$_POST["postalgmt"];} +if (isset($_GET["phone_code_override"])) {$phone_code_override=$_GET["phone_code_override"];} + elseif (isset($_POST["phone_code_override"])) {$phone_code_override=$_POST["phone_code_override"];} + $phone_code_override = (preg_replace("/\D/","",$phone_code_override)); + +# $country_field=$_GET["country_field"]; if (!$country_field) {$country_field=$_POST["country_field"];} + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); +$list_id_override = ereg_replace("[^0-9]","",$list_id_override); + + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_datetime = $STARTtime; + +$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +if ($WeBRooTWritablE > 0) {$fp = fopen ("./project_auth_entries.txt", "a");} +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-LEAD-LOADER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT load_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGload_leads =$row[0]; + + if ($LOGload_leads < 1) + { + echo "You do not have permissions to load leads\n"; + exit; + } + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "LIST_LOAD|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "LIST_LOAD|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + } + + +$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://';} +$admDIR = "$HTTPprotocol$server_name$script_name"; +$admDIR = eregi_replace('new_listloader_superL.php','',$admDIR); +$admSCR = 'admin.php'; +$NWB = "   \"HELP\""; + +$secX = date("U"); +$hour = date("H"); +$min = date("i"); +$sec = date("s"); +$mon = date("m"); +$mday = date("d"); +$year = date("Y"); +$isdst = date("I"); +$Shour = date("H"); +$Smin = date("i"); +$Ssec = date("s"); +$Smon = date("m"); +$Smday = date("d"); +$Syear = date("Y"); +$pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; +$inSD = $pulldate0; +$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + ### Grab Server GMT value from the database + $stmt="SELECT local_gmt FROM servers where server_ip = '$server_ip';"; + $rslt=mysql_query($stmt, $link); + $gmt_recs = mysql_num_rows($rslt); + if ($gmt_recs > 0) + { + $row=mysql_fetch_row($rslt); + $DBSERVER_GMT = "$row[0]"; + if (strlen($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;} + if ($isdst) {$SERVER_GMT++;} + } + else + { + $SERVER_GMT = date("O"); + $SERVER_GMT = eregi_replace("\+","",$SERVER_GMT); + $SERVER_GMT = ($SERVER_GMT + 0); + $SERVER_GMT = ($SERVER_GMT / 100); + } + + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + +#if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";} + + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +function macfontfix($fontsize) { + + $browser = getenv("HTTP_USER_AGENT"); + $pctype = explode("(", $browser); + if (ereg("Mac",$pctype[1])) { + /* Browser is a Mac. If not Netscape 6, raise fonts */ + + $blownbrowser = explode('/', $browser); + $ver = explode(' ', $blownbrowser[1]); + $ver = $ver[0]; + if ($ver >= 5.0) return $fontsize; else return ($fontsize+2); + + } else return $fontsize; /* Browser is not a Mac - don't touch fonts */ +} + +echo "\n"; + +?> + + + +VICIDIAL ADMIN: Lead Loader + + + method=post onSubmit="ParseFileName()" enctype="multipart/form-data"> + + +
".$field_name.": \r\n"; + print " \r\n"; + print "
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Load leads from this file:
List ID Override: (numbers only or leave blank for values in the file)
Phone Code Override: (numbers only or leave blank for values in the file)
File layout to use:Standard VICIDIAL    Custom layout
Lead Duplicate Check:
Lead Time Zone Lookup:
        
        BACK TO ADMINLIST LOADER-     VERSION:     BUILD:    
+ + +document.forms[0].leadfile.disabled=true;document.forms[0].list_id_override.disabled=true;document.forms[0].phone_code_override.disabled=true; document.forms[0].submit_file.disabled=true; document.forms[0].reload_page.disabled=true;"; + flush(); + $total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list=''; + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) { + # copy($leadfile, "./vicidial_temp_file.txt"); + $file=fopen("$lead_file", "r"); + if ($WeBRooTWritablE > 0) + { + $stmt_file=fopen("listloader_stmts.txt", "w"); + } + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + + if (count($field_check)>=5) { + flush(); + $file=fopen("$lead_file", "r"); + print "
Processing $delim_name-delimited file...\n"; + + if (strlen($list_id_override)>0) + { + print "

LIST ID OVERRIDE FOR THIS FILE: $list_id_override

"; + } + + if (strlen($phone_code_override)>0) + { + print "

PHONE CODE OVERRIDE FOR THIS FILE: $phone_code_override

"; + } + + while (!feof($file)) { + $record++; + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + + if (strlen($buffer)>0) { + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[$vendor_lead_code_field]; + $source_code = $row[$source_id_field]; + $source_id=$source_code; + $list_id = $row[$list_id_field]; + $gmt_offset = '0'; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[$phone_code_field]); + $phone_number = eregi_replace("[^0-9]", "", $row[$phone_number_field]); + $USarea = substr($phone_number, 0, 3); + $title = $row[$title_field]; + $first_name = $row[$first_name_field]; + $middle_initial = $row[$middle_initial_field]; + $last_name = $row[$last_name_field]; + $address1 = $row[$address1_field]; + $address2 = $row[$address2_field]; + $address3 = $row[$address3_field]; + $city =$row[$city_field]; + $state = $row[$state_field]; + $province = $row[$province_field]; + $postal_code = $row[$postal_code_field]; + $country_code = $row[$country_code_field]; + $gender = $row[$gender_field]; + $date_of_birth = $row[$date_of_birth_field]; + $alt_phone = eregi_replace("[^0-9]", "", $row[$alt_phone_field]); + $email = $row[$email_field]; + $security_phrase = $row[$security_phrase_field]; + $comments = trim($row[$comments_field]); + + if (strlen($list_id_override)>0) + { + # print "

LIST ID OVERRIDE FOR THIS FILE: $list_id_override

"; + $list_id = $list_id_override; + } + if (strlen($phone_code_override)>0) + { + $phone_code = $phone_code_override; + } + + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if (eregi("DUPCAMP",$dupcheck)) + { + $dup_lead=0; + $dup_lists=''; + $stmt="select campaign_id from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $ci_recs = mysql_num_rows($rslt); + if ($ci_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_camp = $row[0]; + + $stmt="select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $rslt=mysql_query($stmt, $link); + $li_recs = mysql_num_rows($rslt); + if ($li_recs > 0) + { + $L=0; + while ($li_recs > $L) + { + $row=mysql_fetch_row($rslt); + $dup_lists .= "'$row[0]',"; + $L++; + } + $dup_lists = eregi_replace(",$",'',$dup_lists); + + $stmt="select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + } + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if (eregi("DUPSYS",$dupcheck)) + { + $dup_lead=0; + $stmt="select list_id from vicidial_list where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if (eregi("DUPLIST",$dupcheck)) + { + $dup_lead=0; + $stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_lead = $row[0]; + $dup_lead_list = $list_id; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + if ( (strlen($phone_number)>6) and ($dup_lead<1) ) + { + if (strlen($phone_code)<1) {$phone_code = '1';} + + $US='_'; + $phone_list .= "$phone_number$US$list_id|"; + + $gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code); + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead $dup_lead_list\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } else { + print "
ERROR: The file does not have the required number of fields to process it.
"; + } + } else if (!eregi(".csv", $leadfile_name)) { + # copy($leadfile, "./vicidial_temp_file.xls"); + $file=fopen("$lead_file", "r"); + + print "
Processing Excel file... \n"; + if (strlen($list_id_override)>0) + { + print "

LIST ID OVERRIDE FOR THIS FILE: $list_id_override

\n"; + } + if (strlen($phone_code_override)>0) + { + print "

PHONE CODE OVERRIDE FOR THIS FILE: $phone_code_override

\n"; + } + # print "|$WeBServeRRooT/vicidial/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field, --forcelistid=$list_id_override --lead_file=$lead_file|"; + $dupcheckCLI=''; $postalgmtCLI=''; + if (eregi("DUPLIST",$dupcheck)) {$dupcheckCLI='--duplicate-check';} + if (eregi("DUPCAMP",$dupcheck)) {$dupcheckCLI='--duplicate-campaign-check';} + if (eregi("DUPSYS",$dupcheck)) {$dupcheckCLI='--duplicate-system-check';} + if (eregi("POSTAL",$postalgmt)) {$postalgmtCLI='--postal-code-gmt';} + passthru("$WeBServeRRooT/vicidial/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field, --forcelistid=$list_id_override --forcephonecode=$phone_code_override --lead-file=$lead_file $postalgmtCLI $dupcheckCLI"); + } else { + # copy($leadfile, "./vicidial_temp_file.csv"); + $file=fopen("$lead_file", "r"); + + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + print "
Processing CSV file... \n"; + if (strlen($list_id_override)>0) + { + print "

LIST ID OVERRIDE FOR THIS FILE: $list_id_override

"; + } + + if (strlen($phone_code_override)>0) + { + print "

PHONE CODE OVERRIDE FOR THIS FILE: $phone_code_override

"; + } + + while($row=fgetcsv($file, 1000, ",")) { + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[$vendor_lead_code_field]; + $source_code = $row[$source_id_field]; + $source_id=$source_code; + $list_id = $row[$list_id_field]; + $gmt_offset = '0'; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[$phone_code_field]); + $phone_number = eregi_replace("[^0-9]", "", $row[$phone_number_field]); + $USarea = substr($phone_number, 0, 3); + $title = $row[$title_field]; + $first_name = $row[$first_name_field]; + $middle_initial = $row[$middle_initial_field]; + $last_name = $row[$last_name_field]; + $address1 = $row[$address1_field]; + $address2 = $row[$address2_field]; + $address3 = $row[$address3_field]; + $city =$row[$city_field]; + $state = $row[$state_field]; + $province = $row[$province_field]; + $postal_code = $row[$postal_code_field]; + $country_code = $row[$country_code_field]; + $gender = $row[$gender_field]; + $date_of_birth = $row[$date_of_birth_field]; + $alt_phone = eregi_replace("[^0-9]", "", $row[$alt_phone_field]); + $email = $row[$email_field]; + $security_phrase = $row[$security_phrase_field]; + $comments = trim($row[$comments_field]); + + if (strlen($list_id_override)>0) + { + $list_id = $list_id_override; + } + if (strlen($phone_code_override)>0) + { + $phone_code = $phone_code_override; + } + + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if (eregi("DUPCAMP",$dupcheck)) + { + $dup_lead=0; + $dup_lists=''; + $stmt="select campaign_id from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $ci_recs = mysql_num_rows($rslt); + if ($ci_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_camp = $row[0]; + + $stmt="select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $rslt=mysql_query($stmt, $link); + $li_recs = mysql_num_rows($rslt); + if ($li_recs > 0) + { + $L=0; + while ($li_recs > $L) + { + $row=mysql_fetch_row($rslt); + $dup_lists .= "'$row[0]',"; + $L++; + } + $dup_lists = eregi_replace(",$",'',$dup_lists); + + $stmt="select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + } + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if (eregi("DUPSYS",$dupcheck)) + { + $dup_lead=0; + $stmt="select list_id from vicidial_list where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if (eregi("DUPLIST",$dupcheck)) + { + $dup_lead=0; + $stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_lead = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + if ( (strlen($phone_number)>6) and ($dup_lead<1) ) + { + if (strlen($phone_code)<1) {$phone_code = '1';} + + $US='_'; + $phone_list .= "$phone_number$US$list_id|"; + + $gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code); + + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + } + print ""; + } + +if ($leadfile && filesize($LF_path)<=8388608) { + $total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list=''; + if ($file_layout=="standard") { + + print ""; + flush(); + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) { + + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"); + $lead_file = "./vicidial_temp_file.txt"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.txt"); + $lead_file = "/tmp/vicidial_temp_file.txt"; + } + $file=fopen("$lead_file", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + + if (count($field_check)>=5) { + flush(); + $file=fopen("$lead_file", "r"); + $total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list=''; + print "
Processing $delim_name-delimited file... ($tab_count|$pipe_count)\n"; + if (strlen($list_id_override)>0) + { + print "

LIST ID OVERRIDE FOR THIS FILE: $list_id_override

"; + } + if (strlen($phone_code_override)>0) + { + print "

PHONE CODE OVERRIDE FOR THIS FILE: $phone_code_override

\n"; + } + while (!feof($file)) { + $record++; + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + + if (strlen($buffer)>0) { + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[0]; + $source_code = $row[1]; + $source_id=$source_code; + $list_id = $row[2]; + $gmt_offset = '0'; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[3]); + $phone_number = eregi_replace("[^0-9]", "", $row[4]); + $USarea = substr($phone_number, 0, 3); + $title = $row[5]; + $first_name = $row[6]; + $middle_initial = $row[7]; + $last_name = $row[8]; + $address1 = $row[9]; + $address2 = $row[10]; + $address3 = $row[11]; + $city =$row[12]; + $state = $row[13]; + $province = $row[14]; + $postal_code = $row[15]; + $country_code = $row[16]; + $gender = $row[17]; + $date_of_birth = $row[18]; + $alt_phone = eregi_replace("[^0-9]", "", $row[19]); + $email = $row[20]; + $security_phrase = $row[21]; + $comments = trim($row[22]); + + if (strlen($list_id_override)>0) + { + $list_id = $list_id_override; + } + if (strlen($phone_code_override)>0) + { + $phone_code = $phone_code_override; + } + + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if (eregi("DUPCAMP",$dupcheck)) + { + $dup_lead=0; + $dup_lists=''; + $stmt="select campaign_id from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $ci_recs = mysql_num_rows($rslt); + if ($ci_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_camp = $row[0]; + + $stmt="select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $rslt=mysql_query($stmt, $link); + $li_recs = mysql_num_rows($rslt); + if ($li_recs > 0) + { + $L=0; + while ($li_recs > $L) + { + $row=mysql_fetch_row($rslt); + $dup_lists .= "'$row[0]',"; + $L++; + } + $dup_lists = eregi_replace(",$",'',$dup_lists); + + $stmt="select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + } + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if (eregi("DUPSYS",$dupcheck)) + { + $dup_lead=0; + $stmt="select list_id from vicidial_list where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if (eregi("DUPLIST",$dupcheck)) + { + $dup_lead=0; + $stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_lead = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + if ( (strlen($phone_number)>6) and ($dup_lead<1) ) + { + if (strlen($phone_code)<1) {$phone_code = '1';} + + $US='_'; + $phone_list .= "$phone_number$US$list_id|"; + + $gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code); + + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } else { + print "
ERROR: The file does not have the required number of fields to process it.
"; + } + } else if (!eregi(".csv", $leadfile_name)) + { + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"); + $lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.xls"); + $lead_file = "/tmp/vicidial_temp_file.xls"; + } + $file=fopen("$lead_file", "r"); + + # echo "|$WeBServeRRooT/vicidial/listloader.pl --forcelistid=$list_id_override --lead-file=$lead_file|"; + $dupcheckCLI=''; $postalgmtCLI=''; + if (eregi("DUPLIST",$dupcheck)) {$dupcheckCLI='--duplicate-check';} + if (eregi("DUPCAMP",$dupcheck)) {$dupcheckCLI='--duplicate-campaign-check';} + if (eregi("DUPSYS",$dupcheck)) {$dupcheckCLI='--duplicate-system-check';} + if (eregi("POSTAL",$postalgmt)) {$postalgmtCLI='--postal-code-gmt';} + passthru("$WeBServeRRooT/vicidial/listloader.pl --forcelistid=$list_id_override --forcephonecode=$phone_code_override --lead-file=$lead_file $postalgmtCLI $dupcheckCLI"); + + } + else + { + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"); + $lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.csv"); + $lead_file = "/tmp/vicidial_temp_file.csv"; + } + $file=fopen("$lead_file", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + print "
Processing CSV file... \n"; + + if (strlen($list_id_override)>0) + { + print "

LIST ID OVERRIDE FOR THIS FILE: $list_id_override

"; + } + if (strlen($phone_code_override)>0) + { + print "

PHONE CODE OVERRIDE FOR THIS FILE: $phone_code_override

"; + } + + while($row=fgetcsv($file, 1000, ",")) { + $pulldate=date("Y-m-d H:i:s"); + $entry_date = "$pulldate"; + $modify_date = ""; + $status = "NEW"; + $user =""; + $vendor_lead_code = $row[0]; + $source_code = $row[1]; + $source_id=$source_code; + $list_id = $row[2]; + $gmt_offset = '0'; + $called_since_last_reset='N'; + $phone_code = eregi_replace("[^0-9]", "", $row[3]); + $phone_number = eregi_replace("[^0-9]", "", $row[4]); + $USarea = substr($phone_number, 0, 3); + $title = $row[5]; + $first_name = $row[6]; + $middle_initial = $row[7]; + $last_name = $row[8]; + $address1 = $row[9]; + $address2 = $row[10]; + $address3 = $row[11]; + $city =$row[12]; + $state = $row[13]; + $province = $row[14]; + $postal_code = $row[15]; + $country_code = $row[16]; + $gender = $row[17]; + $date_of_birth = $row[18]; + $alt_phone = eregi_replace("[^0-9]", "", $row[19]); + $email = $row[20]; + $security_phrase = $row[21]; + $comments = trim($row[22]); + + if (strlen($list_id_override)>0) + { + $list_id = $list_id_override; + } + if (strlen($phone_code_override)>0) + { + $phone_code = $phone_code_override; + } + + ##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign ##### + if (eregi("DUPCAMP",$dupcheck)) + { + $dup_lead=0; + $dup_lists=''; + $stmt="select campaign_id from vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $ci_recs = mysql_num_rows($rslt); + if ($ci_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_camp = $row[0]; + + $stmt="select list_id from vicidial_lists where campaign_id='$dup_camp';"; + $rslt=mysql_query($stmt, $link); + $li_recs = mysql_num_rows($rslt); + if ($li_recs > 0) + { + $L=0; + while ($li_recs > $L) + { + $row=mysql_fetch_row($rslt); + $dup_lists .= "'$row[0]',"; + $L++; + } + $dup_lists = eregi_replace(",$",'',$dup_lists); + + $stmt="select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + } + } + + ##### Check for duplicate phone numbers in vicidial_list table entire database ##### + if (eregi("DUPSYS",$dupcheck)) + { + $dup_lead=0; + $stmt="select list_id from vicidial_list where phone_number='$phone_number';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $dup_lead=1; + $row=mysql_fetch_row($rslt); + $dup_lead_list = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + ##### Check for duplicate phone numbers in vicidial_list table for one list_id ##### + if (eregi("DUPLIST",$dupcheck)) + { + $dup_lead=0; + $stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $dup_lead = $row[0]; + } + if ($dup_lead < 1) + { + if (eregi("$phone_number$US$list_id",$phone_list)) + {$dup_lead++; $dup++;} + } + } + + if ( (strlen($phone_number)>6) and ($dup_lead<1) ) + { + if (strlen($phone_code)<1) {$phone_code = '1';} + + $US='_'; + $phone_list .= "$phone_number$US$list_id|"; + + $gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code); + + + if ($multi_insert_counter > 8) { + ### insert good deal into pending_transactions table ### + $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);"; + $rslt=mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + $multistmt=''; + $multi_insert_counter=0; + + } else { + $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),"; + $multi_insert_counter++; + } + + $good++; + } else { + if ($bad < 10000) {print "
record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead\n";} + $bad++; + } + $total++; + if ($total%100==0) { + print ""; + usleep(1000); + flush(); + } + } + if ($multi_insert_counter!=0) { + $stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";"; + mysql_query($stmtZ, $link); + if ($WeBRooTWritablE > 0) + {fwrite($stmt_file, $stmtZ."\r\n");} + } + + print "

Done
GOOD: $good       BAD: $bad       TOTAL: $total
"; + + } + print ""; + + } else { + print "
"; + flush(); + print "\r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + + $rslt=mysql_query("select vendor_lead_code, source_id, list_id, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments from vicidial_list limit 1", $link); + + + if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) + { + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"); + $lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.txt"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.txt"); + $lead_file = "/tmp/vicidial_temp_file.txt"; + } + $file=fopen("$lead_file", "r"); + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + $buffer=fgets($file, 4096); + $tab_count=substr_count($buffer, "\t"); + $pipe_count=substr_count($buffer, "|"); + + if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";} + $field_check=explode($delimiter, $buffer); + flush(); + $file=fopen("$lead_file", "r"); + print "
Processing $delim_name-delimited file...\n"; + + if (strlen($list_id_override)>0) + { + print "

LIST ID OVERRIDE FOR THIS FILE: $list_id_override

"; + } + if (strlen($phone_code_override)>0) + { + print "

PHONE CODE OVERRIDE FOR THIS FILE: $phone_code_override

"; + } + $buffer=rtrim(fgets($file, 4096)); + $buffer=stripslashes($buffer); + $row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer)); + + for ($i=0; $i\r\n"; + print "
\r\n"; + print " \r\n"; + print " \r\n"; + + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + } + } + else if (!eregi(".csv", $leadfile_name)) + { + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"); + $lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.xls"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.xls"); + $lead_file = "/tmp/vicidial_temp_file.xls"; + } + + # echo "|$WeBServeRRooT/vicidial/listloader_rowdisplay.pl --lead-file=$lead_file|"; + $dupcheckCLI=''; $postalgmtCLI=''; + if (eregi("DUPLIST",$dupcheck)) {$dupcheckCLI='--duplicate-check';} + if (eregi("DUPCAMP",$dupcheck)) {$dupcheckCLI='--duplicate-campaign-check';} + if (eregi("DUPSYS",$dupcheck)) {$dupcheckCLI='--duplicate-system-check';} + if (eregi("POSTAL",$postalgmt)) {$postalgmtCLI='--postal-code-gmt';} + passthru("$WeBServeRRooT/vicidial/listloader_rowdisplay.pl --lead-file=$lead_file $postalgmtCLI $dupcheckCLI"); + } + else + { + if ($WeBRooTWritablE > 0) + { + copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"); + $lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.csv"; + } + else + { + copy($LF_path, "/tmp/vicidial_temp_file.csv"); + $lead_file = "/tmp/vicidial_temp_file.csv"; + } + $file=fopen("$lead_file", "r"); + + if ($WeBRooTWritablE > 0) + {$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");} + + print "
Processing CSV file... \n"; + + if (strlen($list_id_override)>0) + { + print "

LIST ID OVERRIDE FOR THIS FILE: $list_id_override

"; + } + if (strlen($phone_code_override)>0) + { + print "

PHONE CODE OVERRIDE FOR THIS FILE: $phone_code_override

"; + } + + $total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list=''; + $row=fgetcsv($file, 1000, ","); + for ($i=0; $i\r\n"; + print "
\r\n"; + print " \r\n"; + print " \r\n"; + + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + #print " \r\n"; + } + } + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print " \r\n"; + print "
VICIDIAL ColumnFile data
".strtoupper(eregi_replace("_", " ", mysql_field_name($rslt, $i))).":
$row[$i]
".strtoupper(eregi_replace("_", " ", mysql_field_name($rslt, $i))).":
$row[$i]
        
\r\n"; + # } + print ""; + } +} else if (filesize($leadfile)>8388608) { + print "
ERROR: File exceeds the 8MB limit.
"; +} +?> + + + + + + + + +4) ) + { + if (preg_match('/^1$/', $phone_code)) + { + $stmt="select * from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[2]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[3]; + $dst_range = $row[4]; + $PC_processed++; + $postalgmt_found++; + $post++; + } + } + } +if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =='1') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### MEXICO ### + if ($phone_code =='52') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### AUSTRALIA ### + if ($phone_code =='61') + { + $stmt="select * from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $PC_processed++; + $stmt="select * from vicidial_phone_codes where country_code='$phone_code';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + } + +### Find out if DST to raise the gmt offset ### +$AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); +$AC_localtime = mktime(($Shour + $AC_GMT_diff), $Smin, $Ssec, $Smon, $Smday, $Syear); + $hour = date("H",$AC_localtime); + $min = date("i",$AC_localtime); + $sec = date("s",$AC_localtime); + $mon = date("m",$AC_localtime); + $mday = date("d",$AC_localtime); + $wday = date("w",$AC_localtime); + $year = date("Y",$AC_localtime); +$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + +$AC_processed=0; +if ( (!$AC_processed) and ($dst_range == 'SSM-FSN') ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + #********************************************************************** + # SSM-FSN + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on Second Sunday March to First Sunday November at 2 am. + # INPUTS: + # mm INTEGER Month. + # dd INTEGER Day of the month. + # ns INTEGER Seconds into the day. + # dow INTEGER Day of week (0=Sunday, to 6=Saturday) + # OPTIONAL INPUT: + # timezone INTEGER hour difference UTC - local standard time + # (DEFAULT is blank) + # make calculations based on UTC time, + # which means shift at 10:00 UTC in April + # and 9:00 UTC in October + # OUTPUT: + # INTEGER 1 = DST, 0 = not DST + # + # S M T W T F S + # 1 2 3 4 5 6 7 + # 8 9 10 11 12 13 14 + #15 16 17 18 19 20 21 + #22 23 24 25 26 27 28 + #29 30 31 + # + # S M T W T F S + # 1 2 3 4 5 6 + # 7 8 9 10 11 12 13 + #14 15 16 17 18 19 20 + #21 22 23 24 25 26 27 + #28 29 30 31 + # + #********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; + } elseif ($mm >= 4 and $mm <= 10) { + $USACAN_DST=1; + } elseif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; + } elseif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } + } else { + $USACAN_DST=0; + } + } elseif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; + } elseif ($dd < ($dow+1)) { + $USACAN_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } + } else { + $USACAN_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$gmt_offset++;} + $AC_processed++; + } + +if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + #********************************************************************** + # FSA-LSO + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in April and last Sunday in October at 2 am. + #********************************************************************** + + $USA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $USA_DST=0; + } elseif ($mm >= 5 and $mm <= 9) { + $USA_DST=1; + } elseif ($mm == 4) { + if ($dd > 7) { + $USA_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } + } else { + $USA_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $USA_DST=1; + } elseif ($dd < ($dow+25)) { + $USA_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } + } else { + $USA_DST=0; + } + } # end of month checks + + if ($DBX) {print " DST: $USA_DST\n";} + if ($USA_DST) {$gmt_offset++;} + $AC_processed++; + } + +if ( (!$AC_processed) and ($dst_range == 'LSM-LSO') ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in March and last Sunday in October at 1 am. + #********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; + } elseif ($mm >= 4 and $mm <= 9) { + $GBR_DST=1; + } elseif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; + } elseif ($dd < ($dow+25)) { + $GBR_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } + } else { + $GBR_DST=1; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; + } elseif ($dd < ($dow+25)) { + $GBR_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } + } else { + $GBR_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } +if ( (!$AC_processed) and ($dst_range == 'LSO-LSM') ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUS_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; + } elseif ($dd < ($dow+25)) { + $AUS_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } + } else { + $AUS_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; + } elseif ($dd < ($dow+25)) { + $AUS_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } + } else { + $AUS_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + +if ( (!$AC_processed) and ($dst_range == 'FSO-LSM') ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + #********************************************************************** + # TASMANIA ONLY + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUST_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; + } elseif ($dd < ($dow+25)) { + $AUST_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } + } else { + $AUST_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $AUST_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } + } else { + $AUST_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } +if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and third Sunday in March at 1 am. + #********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $NZL_DST=0; + } elseif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; + } elseif ($dd < ($dow+14)) { + $NZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } + } else { + $NZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $NZL_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } + } else { + $NZL_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + +if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + #********************************************************************** + # TSO-LSF + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. Brazil + # Based on Third Sunday October to Last Sunday February at 1 am. + #********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; + } elseif ($mm >= 3 and $mm <= 9) { + $BZL_DST=0; + } elseif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; + } elseif ($dd < ($dow+22)) { + $BZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } + } else { + $BZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; + } elseif ($dd < ($dow+22)) { + $BZL_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } + } else { + $BZL_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$gmt_offset++;} + $AC_processed++; + } + +if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + +return $gmt_offset; +} \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/phone_stats.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/phone_stats.php new file mode 100644 index 00000000..0daaf2fd --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/phone_stats.php @@ -0,0 +1,245 @@ + LICENSE: GPLv2 +# +# +# changes: +# 60620-1333 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# 60927-1548 - Changed to vicidial_users for authentication +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["begin_date"])) {$begin_date=$_GET["begin_date"];} + elseif (isset($_POST["begin_date"])) {$begin_date=$_POST["begin_date"];} +if (isset($_GET["end_date"])) {$end_date=$_GET["end_date"];} + elseif (isset($_POST["end_date"])) {$end_date=$_POST["end_date"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["full_name"])) {$full_name=$_GET["full_name"];} + elseif (isset($_POST["full_name"])) {$full_name=$_POST["full_name"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$admin_page = './admin.php'; + +if (!isset($begin_date)) {$begin_date = $TODAY;} +if (!isset($end_date)) {$end_date = $TODAY;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and view_reports='1';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-ASTERISK\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "ASTERISK|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + ##### get server listing for dynamic pulldown + $stmt="SELECT fullname from phones where server_ip='$server_ip' and extension='$extension'"; + $rsltx=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rsltx); + $fullname = $row[0]; + } + else + { + fwrite ($fp, "ASTERISK|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +?> + + +VICIDIAL ADMIN: Phone Stats + + +
+ + + + + + + +\n"; +echo "
  VICIDIAL ADMIN: Administration  
  LIST ALL PHONES | ADD A NEW PHONE | SEARCH FOR A PHONE | ADD A SERVER | LIST ALL SERVERS
  SHOW ALL CONFERENCES | ADD A NEW CONFERENCE
  \n"; + +echo "
\n"; +echo "\n"; +echo "\n"; +echo " to \n"; +echo "  \n"; +echo "\n"; + + +echo "           $user - $full_name\n"; + +echo "
\n"; + + + $stmt="SELECT count(*),channel_group, sum(length_in_sec) from call_log where extension='" . mysql_real_escape_string($extension) . "' and server_ip='" . mysql_real_escape_string($server_ip) . "' and start_time >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and start_time <= '" . mysql_real_escape_string($end_date) . " 23:59:59' group by channel_group order by channel_group"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); +# echo "|$stmt|\n"; + +echo "
\n"; + +echo "CALL TIME AND CHANNELS:\n"; + +echo "
\n"; +echo "\n"; + + $total_calls=0; + $o=0; + while ($statuses_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $call_seconds = $row[2]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} + + echo ""; + echo "\n"; + echo "\n"; + $total_calls = ($total_calls + $row[0]); + + $call_seconds=0; + $o++; + } + + $stmt="SELECT sum(length_in_sec) from call_log where extension='" . mysql_real_escape_string($extension) . "' and server_ip='" . mysql_real_escape_string($server_ip) . "' and start_time >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and start_time <= '" . mysql_real_escape_string($end_date) . " 23:59:59'"; + $rslt=mysql_query($stmt, $link); + $counts_to_print = mysql_num_rows($rslt); + $row=mysql_fetch_row($rslt); + $call_seconds = $row[0]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} +# echo "|$stmt|\n"; + +echo "\n"; +echo "
CHANNEL GROUP COUNT HOURS:MINUTES
$row[1] $row[0] $call_hours_int:$call_minutes_int
TOTAL CALLS $total_calls $call_hours_int:$call_minutes_int
\n"; +echo "

\n"; + +echo "
\n"; + +echo "LAST 1000 CALLS FOR DATE RANGE:\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT number_dialed,channel_group,start_time,length_in_min from call_log where extension='" . mysql_real_escape_string($extension) . "' and server_ip='" . mysql_real_escape_string($server_ip) . "' and start_time >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and start_time <= '" . mysql_real_escape_string($end_date) . " 23:59:59' LIMIT 1000"; + $rslt=mysql_query($stmt, $link); + $events_to_print = mysql_num_rows($rslt); +# echo "|$stmt|\n"; + + $total_calls=0; + $o=0; + $event_start_seconds=''; + $event_stop_seconds=''; + while ($events_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + + + $call_seconds=0; + $o++; + } + + +echo "
NUMBER CHANNEL GROUP DATE LENGTH(MIN.)
$row[0] $row[1] $row[2] $row[3]
\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/record_conf_1_hour.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/record_conf_1_hour.php new file mode 100644 index 00000000..d184e457 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/record_conf_1_hour.php @@ -0,0 +1,156 @@ + LICENSE: GPLv2 +### +# grab: $server_ip $station $session_id +# +# CHANGES +# +# 60620-1011 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["station"])) {$station=$_GET["station"];} + elseif (isset($_POST["station"])) {$station=$_POST["station"];} +if (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];} + elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];} +if (isset($_GET["NEW_RECORDING"])) {$NEW_RECORDING=$_GET["NEW_RECORDING"];} + elseif (isset($_POST["NEW_RECORDING"])) {$NEW_RECORDING=$_POST["NEW_RECORDING"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$MYSQL_datetime = date("Y-m-d H:i:s"); +$FILE_datetime = date("Ymd-His_"); +$secX = $STARTtime; + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + + $stmt="SELECT full_name from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + } + + + + +?> + + +VICIDIAL RECORD CONFERENCE: 1 hour +\n"; +?> + + +
+ + 8) && (strlen($session_id) > 3) && (strlen($station) > 3) ) + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $conf_silent_prefix = '7'; + $ext_context = 'demo'; + + $stmt="INSERT INTO vicidial_manager values('','','$MYSQL_datetime','NEW','N','" . mysql_real_escape_string($server_ip) . "','','Originate','RB$FILE_datetime" . mysql_real_escape_string($station) . "','Channel: $local_DEF$conf_silent_prefix" . mysql_real_escape_string($session_id) . "$local_AMP$ext_context','Context: $ext_context','Exten: 8309','Priority: 1','Callerid: $FILE_datetime" . mysql_real_escape_string($station) . "','','','','','')"; + echo "|$stmt|\n

\n"; + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename) values('" . mysql_real_escape_string($session_id) . "','" . mysql_real_escape_string($server_ip) . "','" . mysql_real_escape_string($station) . "','$MYSQL_datetime','$secX','$FILE_datetime" . mysql_real_escape_string($station) . "')"; + echo "|$stmt|\n

\n"; + $rslt=mysql_query($stmt, $link); + + echo "Recording started\n

\n"; + echo "Back to main recording screen\n

\n"; + } + else + { + echo "ERROR!!!! Not all info entered properly\n

\n"; + echo "|$server_ip| |$session_id| |$station|\n

\n"; + echo "Back to main recording screen\n

\n"; + } +} +else +{ +echo "
Start recording a conference for 1 hour: \n"; +echo "\n"; +echo "server_ip: | \n"; +echo "session_id: | \n"; +echo "station: | \n"; +echo "\n"; +echo "


\n"; + + + +} +?> + + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/remote_dispo.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/remote_dispo.php new file mode 100644 index 00000000..da249fba --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/remote_dispo.php @@ -0,0 +1,327 @@ + LICENSE: GPLv2 +### +# this is the remote agent disposition screen for calls sent to remote agents. This allows the remote agent to modify customer information and disposition the call + +# CHANGES +# +# 60619-1626 - Added variable filtering to eliminate SQL injection attack threat +# + + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +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["alt_phone"])) {$alt_phone=$_GET["alt_phone"];} + elseif (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];} +if (isset($_GET["call_began"])) {$call_began=$_GET["call_began"];} + elseif (isset($_POST["call_began"])) {$call_began=$_POST["call_began"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];} + elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];} +if (isset($_GET["city"])) {$city=$_GET["city"];} + elseif (isset($_POST["city"])) {$city=$_POST["city"];} +if (isset($_GET["comments"])) {$comments=$_GET["comments"];} + elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];} +if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];} + elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];} +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["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];} + elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];} +if (isset($_GET["email"])) {$email=$_GET["email"];} + elseif (isset($_POST["email"])) {$email=$_POST["email"];} +if (isset($_GET["end_call"])) {$end_call=$_GET["end_call"];} + elseif (isset($_POST["end_call"])) {$end_call=$_POST["end_call"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];} + elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];} + elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["parked_time"])) {$parked_time=$_GET["parked_time"];} + elseif (isset($_POST["parked_time"])) {$parked_time=$_POST["parked_time"];} +if (isset($_GET["pass"])) {$pass=$_GET["pass"];} + elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];} +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["phone"])) {$phone=$_GET["phone"];} + elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];} +if (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];} + elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];} +if (isset($_GET["province"])) {$province=$_GET["province"];} + elseif (isset($_POST["province"])) {$province=$_POST["province"];} +if (isset($_GET["security"])) {$security=$_GET["security"];} + elseif (isset($_POST["security"])) {$security=$_POST["security"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["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["session_id"])) {$session_id=$_GET["session_id"];} + elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];} +if (isset($_GET["state"])) {$state=$_GET["state"];} + elseif (isset($_POST["state"])) {$state=$_POST["state"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["tsr"])) {$tsr=$_GET["tsr"];} + elseif (isset($_POST["tsr"])) {$tsr=$_POST["tsr"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_datetime = $STARTtime; + +$ext_context = 'demo'; +if (!isset($begin_date)) {$begin_date = $TODAY;} +if (!isset($end_date)) {$end_date = $TODAY;} + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 2;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + + } + else + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +?> + + +VICIDIAL REMOTE: Call Disposition +\n"; +?> + + +
+ +"; + +if ($end_call > 0) +{ + +$call_length = ($STARTtime - $call_began); + + ### insert a NEW record to the vicidial_closer_log table + $stmt="UPDATE vicidial_closer_log set end_epoch='$STARTtime', length_in_sec='" . mysql_real_escape_string($call_length) . "', status='" . mysql_real_escape_string($status) . "', user='$PHP_AUTH_USER' where lead_id='" . mysql_real_escape_string($lead_id) . "' order by start_epoch desc limit 1;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + ### update the lead record in the vicidial_list table + $stmt="UPDATE vicidial_list set status='" . mysql_real_escape_string($status) . "',first_name='" . mysql_real_escape_string($first_name) . "',last_name='" . mysql_real_escape_string($last_name) . "',address1='" . mysql_real_escape_string($address1) . "',address2='" . mysql_real_escape_string($address2) . "',address3='" . mysql_real_escape_string($address3) . "',city='" . mysql_real_escape_string($city) . "',state='" . mysql_real_escape_string($state) . "',province='" . mysql_real_escape_string($province) . "',postal_code='" . mysql_real_escape_string($postal_code) . "',country_code='" . mysql_real_escape_string($country_code) . "',alt_phone='" . mysql_real_escape_string($alt_phone) . "',email='" . mysql_real_escape_string($email) . "',security_phrase='" . mysql_real_escape_string($security) . "',comments='" . mysql_real_escape_string($comments) . "',user='$PHP_AUTH_USER' where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "Call has been dispositioned       $NOW_TIME\n

\n"; + + echo "\n"; + +} +else +{ + $stmt="SELECT count(*) from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_count = $row[0]; + + if ($lead_count > 0) + { + + $stmt="SELECT * from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $lead_id = "$row[0]"; + $tsr = "$row[4]"; + $vendor_id = "$row[5]"; + $list_id = "$row[7]"; + $campaign_id = "$row[8]"; + $phone_code = "$row[10]"; + $phone_number = "$row[11]"; + $title = "$row[12]"; + $first_name = "$row[13]"; # + $middle_initial = "$row[14]"; + $last_name = "$row[15]"; # + $address1 = "$row[16]"; # + $address2 = "$row[17]"; # + $address3 = "$row[18]"; # + $city = "$row[19]"; # + $state = "$row[20]"; # + $province = "$row[21]"; # + $postal_code = "$row[22]"; # + $country_code = "$row[23]"; # + $gender = "$row[24]"; + $date_of_birth = "$row[25]"; + $alt_phone = "$row[26]"; # + $email = "$row[27]"; # + $security = "$row[28]"; # + $comments = "$row[29]"; # + + echo "
Call information: $first_name $last_name - $phone_number

\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + echo "\n"; + echo "
Vendor ID: $vendor_id     Campaign ID: $campaign_id
Fronter: $tsr     List ID: $list_id
First Name:   \n"; + echo " Last Name:
Address 1 :
Address 2 :
Address 3 :
City :
State:   \n"; + echo " Postal Code:
Province :
Country :
Alt Phone :
Email :
Security :
Comments :
Disposition:
\n"; + echo "


\n"; + + } + else + { + echo "lead lookup FAILED for lead_id $lead_id       $NOW_TIME\n

\n"; +# echo "Close this window\n

\n"; + } + + + + + + +} + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/spreadsheet_sales_viewer.pl b/agc_2-X/branches/agc_2.0.4/www/vicidial/spreadsheet_sales_viewer.pl new file mode 100644 index 00000000..cd42aa44 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/spreadsheet_sales_viewer.pl @@ -0,0 +1,385 @@ +#!/usr/bin/perl + +### spreadsheet_sales_viewer.pl version 2.0.4 *DBI-version* +### +### Copyright (C) 2007 Joe Johnson,Matt Florell LICENSE: GPLv2 +### +# +# +# CHANGES +# 70521-1734 - First build +# 70522-1554 - Changed to use DBI instead of Net::MySQL +# + +use Spreadsheet::WriteExcel; +use Time::Local; +use DBI; + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +$list_ids=$ARGV[0]; +$sales_number=$ARGV[1]; +$timestamp=$ARGV[2]; +$forc=$ARGV[3]; +$now=$ARGV[4]; +$dcampaign=$ARGV[5]; + +$list_id_clause="and v.list_id in ("; +@lists=split(/\,/, $list_ids); +for ($i=0; $i0)) { $list_id_clause.="$lists[$i], "; } +} +$list_id_clause=substr($list_id_clause, 0, -2); +$list_id_clause.=")"; + + +if ($sales_number==0) {undef $sales_number;} + + +$xl = Spreadsheet::WriteExcel->new("$PATHweb/vicidial/vicidial_closer_report_$now.xls"); +$xlsheet = $xl->add_worksheet(); +$xlsheet->set_landscape(); +$rptheader = $xl->add_format(); # Add a format +$rptheader->set_bold(); +$rptheader->set_size('8'); +$rptheader->set_color('10'); +$rptheader->set_align('center'); + +$rptheaderLEFT = $xl->add_format(); # Add a format +$rptheaderLEFT->set_bold(); +$rptheaderLEFT->set_size('8'); +$rptheaderLEFT->set_color('10'); +$rptheaderLEFT->set_align('left'); + +$normcell = $xl->add_format(); # Add a format +$normcell->set_size('8'); +$normcell->set_align('center'); +$normcell->set_bg_color('22'); + +$boldcell = $xl->add_format(); # Add a format +$boldcell->set_bold(); +$boldcell->set_size('8'); +$boldcell->set_align('center'); +$boldcell->set_bg_color('22'); + +$dollarformat = $xl->add_format(); # Add a format +$dollarformat->set_size('8'); +$dollarformat->set_num_format('$0.00'); + +$intformat = $xl->add_format(); # Add a format +$intformat->set_size('8'); +$intformat->set_num_format('0'); + +$numberformat = $xl->add_format(); # Add a format +$numberformat->set_size('8'); +$numberformat->set_num_format('0.00'); + +$pformat = $xl->add_format(); # Add a format +$pformat->set_size('8'); +$pformat->set_num_format('0.00%'); + +$p2format = $xl->add_format(); # Add a format +$p2format->set_size('8'); +$p2format->set_num_format('0%'); + +$statcell = $xl->add_format(num_format => '@'); # Add a format +$statcell->set_size('8'); + +$countcell = $xl->add_format(); # Add a format +$countcell->set_size('8'); +$countcell->set_bg_color('35'); + +$terminateheader = $xl->add_format(); # Add a format +$terminateheader->set_bold(); +$terminateheader->set_size('8'); +$terminateheader->set_color('10'); +$terminateheader->set_num_format('0.00'); + +$xlsheet->write("B1", "Closer stats", $rptheader); +$xlsheet->write("D1", "$dcampaign", $rptheaderLEFT); +$xlsheet->write("F1", "$list_ids", $rptheaderLEFT); +$xlsheet->write("A2", "Closer Name", $rptheader); +$xlsheet->write("B2", "# of calls", $rptheader); +$xlsheet->write("C2", "# of sales", $rptheader); +$xlsheet->write("D2", "Sales percentage", $rptheader); +$xlsheet->write("E2", "Calls per hour", $rptheader); +$xlsheet->write("F2", "Sales per hour", $rptheader); +$xlsheet->write("G2", "Total time in system", $rptheader); + +%closers=(); +%fronters=(); + + + +# Non-transfer +$sales=0; +$stmtA = "select v.status, u.full_name, u.user from vicidial_users u, vicidial_list v, vicidial_log vl where vl.call_date>='$timestamp' and vl.call_date<='$now' and vl.lead_id=v.lead_id $list_id_clause and vl.user=u.user;"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + if (length($sales_number)==0 || $sales<$sales_number) + { + $closers{"$aryA[1]"}[0]++; + $fronters{"$aryA[1]"}[0]++; + if ($aryA[0] eq "SALE") + { + $sales++; + $closers{"$aryA[1]"}[1]++; + $fronters{"$aryA[1]"}[1]++; + } + } + $closers{"$aryA[1]"}[2]=$aryA[2]; + $fronters{"$aryA[1]"}[2]=$aryA[2]; + $rec_count++; + } +$sthA->finish(); + + +if ($forc eq "F") { + %closers=(); + + $sales=0; + $stmtA = "select v.status, u.full_name, u.user from vicidial_list v, vicidial_users u, vicidial_xfer_log vl where vl.call_date>='$timestamp' and vl.call_date<='$now' and vl.lead_id=v.lead_id $list_id_clause and vl.closer=u.user;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + if (!$sales_number || $sales<$sales_number) + { + $closers{"$aryA[1]"}[0]++; + if ($aryA[0] eq "SALE") + { + $sales++; + $closers{"$aryA[1]"}[1]++; + } + } + $closers{"$aryA[1]"}[2]=$aryA[2]; + $rec_count++; + } + $sthA->finish(); +} + + +$x=3; +$grand_total_time=0; +foreach $closername (sort(keys(%closers))) +{ + $closers{$closername}[0]+=0; + $closers{$closername}[1]+=0; + + $stmtA = "select sum(pause_sec+wait_sec+talk_sec), sec_to_time(sum(pause_sec+wait_sec+talk_sec)) from vicidial_agent_log where user=".$closers{$closername}[2]." and event_time>='$timestamp' and event_time<='$now' and pause_sec<28800 and wait_sec<28800 and talk_sec<28800;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $hours=($aryA[0]/3600); + $grand_total_time+=$aryA[0]; + $total_time=$aryA[1]; + $rec_count++; + } + $sthA->finish(); + $xlsheet->write("A$x", "$closername", $normcell); + $xlsheet->write("B$x", "=$closers{$closername}[0]+0", $intformat); + $xlsheet->write("C$x", "=$closers{$closername}[1]+0", $intformat); + $xlsheet->write("D$x", "=C$x/B$x", $pformat); + $xlsheet->write("E$x", "=B$x/$hours", $numberformat); + $xlsheet->write("F$x", "=C$x/$hours", $numberformat); + $xlsheet->write("G$x", "$total_time", $normcell); + $x++; +} +$hours=($grand_total_time/3600); + +$stmtA = "select sec_to_time($grand_total_time)"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $grand_total_time=$aryA[0]; + $rec_count++; + } +$sthA->finish(); + + +$y=($x+1); +$xlsheet->write("A$y", "Grand Total", $boldcell); +$xlsheet->write("B$y", "=SUM(B3:B$x)", $intformat); +$xlsheet->write("C$y", "=SUM(C3:C$x)", $intformat); +$xlsheet->write("D$y", "=C$y/B$y", $pformat); +$xlsheet->write("E$y", "=B$y/$hours", $numberformat); +$xlsheet->write("F$y", "=C$y/$hours", $numberformat); +$xlsheet->write("G$y", "$grand_total_time", $normcell); +$xl->close(); + + +if ($forc eq "F") { + $xl = Spreadsheet::WriteExcel->new("$PATHweb/vicidial/vicidial_fronter_report_$now.xls"); + $xlsheet = $xl->add_worksheet(); + $xlsheet->set_landscape(); + $rptheader = $xl->add_format(); # Add a format + $rptheader->set_bold(); + $rptheader->set_size('8'); + $rptheader->set_color('10'); + $rptheader->set_align('center'); + + $normcell = $xl->add_format(); # Add a format + $normcell->set_size('8'); + $normcell->set_align('center'); + $normcell->set_bg_color('22'); + + $boldcell = $xl->add_format(); # Add a format + $boldcell->set_bold(); + $boldcell->set_size('8'); + $boldcell->set_align('center'); + $boldcell->set_bg_color('22'); + + $dollarformat = $xl->add_format(); # Add a format + $dollarformat->set_size('8'); + $dollarformat->set_num_format('$0.00'); + + $intformat = $xl->add_format(); # Add a format + $intformat->set_size('8'); + $intformat->set_num_format('0'); + + $numberformat = $xl->add_format(); # Add a format + $numberformat->set_size('8'); + $numberformat->set_num_format('0.00'); + + $pformat = $xl->add_format(); # Add a format + $pformat->set_size('8'); + $pformat->set_num_format('0.00%'); + + $statcell = $xl->add_format(num_format => '@'); # Add a format + $statcell->set_size('8'); + + $countcell = $xl->add_format(); # Add a format + $countcell->set_size('8'); + $countcell->set_bg_color('35'); + + $terminateheader = $xl->add_format(); # Add a format + $terminateheader->set_bold(); + $terminateheader->set_size('8'); + $terminateheader->set_color('10'); + $terminateheader->set_num_format('0.00'); + + $xlsheet->write("D1", "Fronter stats", $rptheader); + $xlsheet->write("A2", "Fronter Name", $rptheader); + $xlsheet->write("B2", "# of calls", $rptheader); + $xlsheet->write("C2", "# of sales", $rptheader); + $xlsheet->write("D2", "Sales percentage", $rptheader); + $xlsheet->write("E2", "Calls per hour", $rptheader); + $xlsheet->write("F2", "Sales per hour", $rptheader); + $xlsheet->write("G2", "Total time in system", $rptheader); + + $x=3; + $grand_total_time=0; + foreach $tsrname (sort(keys(%fronters))) { + $fronters{$tsrname}[0]+=0; + $fronters{$tsrname}[1]+=0; + $stmtA = "select sum(pause_sec+wait_sec+talk_sec), sec_to_time(sum(pause_sec+wait_sec+talk_sec)) from vicidial_agent_log where user=".$fronters{$tsrname}[2]." and event_time>='$timestamp' and event_time<='$now' and pause_sec<28800 and wait_sec<28800 and talk_sec<28800;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $hours=($aryA[0]/3600); + $grand_total_time+=$aryA[0]; + $total_time=$aryA[1]; + $rec_count++; + } + $sthA->finish(); + + $xlsheet->write("A$x", "$tsrname", $normcell); + $xlsheet->write("B$x", "=$fronters{$tsrname}[0]+0", $intformat); + $xlsheet->write("C$x", "=$fronters{$tsrname}[1]+0", $intformat); + $xlsheet->write("D$x", "=C$x/B$x", $pformat); + $xlsheet->write("E$x", "=B$x/$hours", $numberformat); + $xlsheet->write("F$x", "=C$x/$hours", $numberformat); + $xlsheet->write("G$x", "$total_time", $normcell); + $x++; + } + $hours=($grand_total_time/3600); + + $stmtA = "select sec_to_time($grand_total_time)"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $grand_total_time=$aryA[0]; + $rec_count++; + } + $sthA->finish(); + + $y=($x+1); + $xlsheet->write("A$y", "Grand Total", $boldcell); + $xlsheet->write("B$y", "=SUM(B3:B$x)", $intformat); + $xlsheet->write("C$y", "=SUM(C3:C$x)", $intformat); + $xlsheet->write("D$y", "=C$y/B$y", $pformat); + $xlsheet->write("E$y", "=B$y/$hours", $numberformat); + $xlsheet->write("F$y", "=C$y/$hours", $numberformat); + $xlsheet->write("G$y", "$grand_total_time", $normcell); + + $xl->close(); +} + diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/user_stats.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/user_stats.php new file mode 100644 index 00000000..ecd457f8 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/user_stats.php @@ -0,0 +1,408 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1743 - Added variable filtering to eliminate SQL injection attack threat +# 61201-1136 - Added recordings display and changed calls to time range with 10000 limit +# 70118-1605 - Added user group column to login/out and calls lists +# 70702-1231 - Added recording location link and truncation +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["begin_date"])) {$begin_date=$_GET["begin_date"];} + elseif (isset($_POST["begin_date"])) {$begin_date=$_POST["begin_date"];} +if (isset($_GET["end_date"])) {$end_date=$_GET["end_date"];} + elseif (isset($_POST["end_date"])) {$end_date=$_POST["end_date"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); + +if (!isset($begin_date)) {$begin_date = $TODAY;} +if (!isset($end_date)) {$end_date = $TODAY;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and view_reports='1';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + + $stmt="SELECT full_name from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + } + + + + +?> + + +VICIDIAL ADMIN: User Stats +\n"; +?> + + +
+ + + + + +\n"; +echo "
" ?>   VICIDIAL ADMIN: User Stats for  
  \n"; + +echo "
\n"; +echo "\n"; +echo " to \n"; +echo "  \n"; +echo "\n"; + + +echo "           $user - $full_name\n"; + +echo " - VICIDIAL Time Sheet\n"; +echo " - User Status\n"; +echo " - Modify User\n"; + + +echo "
\n"; + + + $stmt="SELECT count(*),status, sum(length_in_sec) from vicidial_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' group by status order by status"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + +echo "
\n"; + +echo "TALK TIME AND STATUS:\n"; + +echo "
\n"; +echo "\n"; + + $total_calls=0; + $o=0; + while ($statuses_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $call_seconds = $row[2]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} + + echo ""; + echo "\n"; + echo "\n"; + $total_calls = ($total_calls + $row[0]); + + $call_seconds=0; + $o++; + } + + $stmt="SELECT sum(length_in_sec) from vicidial_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59'"; + $rslt=mysql_query($stmt, $link); + $counts_to_print = mysql_num_rows($rslt); + $row=mysql_fetch_row($rslt); + $call_seconds = $row[0]; + $call_hours = ($call_seconds / 3600); + $call_hours = round($call_hours, 2); + $call_hours_int = intval("$call_hours"); + $call_minutes = ($call_hours - $call_hours_int); + $call_minutes = ($call_minutes * 60); + $call_minutes_int = round($call_minutes, 0); + if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} + +echo "\n"; +echo "
STATUSCOUNTHOURS:MINUTES
$row[1] $row[0] $call_hours_int:$call_minutes_int
TOTAL CALLS $total_calls $call_hours_int:$call_minutes_int
\n"; +echo "

\n"; + +echo "
\n"; + +echo "LOGIN/LOGOUT TIME:\n"; +echo "\n"; +echo "\n"; + + $stmt="SELECT event,event_epoch,event_date,campaign_id,user_group from vicidial_user_log where user='" . mysql_real_escape_string($user) . "' and event_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and event_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59'"; + $rslt=mysql_query($stmt, $link); + $events_to_print = mysql_num_rows($rslt); + + $total_calls=0; + $o=0; + $event_start_seconds=''; + $event_stop_seconds=''; + while ($events_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("LOGIN", $row[0])) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + if (ereg("LOGIN", $row[0])) + { + $event_start_seconds = $row[1]; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + if (ereg("LOGOUT", $row[0])) + { + if ($event_start_seconds) + { + $event_stop_seconds = $row[1]; + $event_seconds = ($event_stop_seconds - $event_start_seconds); + $total_login_time = ($total_login_time + $event_seconds); + $event_hours = ($event_seconds / 3600); + $event_hours = round($event_hours, 2); + $event_hours_int = intval("$event_hours"); + $event_minutes = ($event_hours - $event_hours_int); + $event_minutes = ($event_minutes * 60); + $event_minutes_int = round($event_minutes, 0); + if ($event_minutes_int < 10) {$event_minutes_int = "0$event_minutes_int";} + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + $event_start_seconds=''; + $event_stop_seconds=''; + } + else + { + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + } + } + + $total_calls = ($total_calls + $row[0]); + + $call_seconds=0; + $o++; + } + +$total_login_hours = ($total_login_time / 3600); +$total_login_hours = round($total_login_hours, 2); +$total_login_hours_int = intval("$total_login_hours"); +$total_login_minutes = ($total_login_hours - $total_login_hours_int); +$total_login_minutes = ($total_login_minutes * 60); +$total_login_minutes_int = round($total_login_minutes, 0); +if ($total_login_minutes_int < 10) {$total_login_minutes_int = "0$total_login_minutes_int";} + +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "
EVENT DATE CAMPAIGN GROUPHOURS:MINUTES
$row[0] $row[2] $row[3] $row[4]
$row[0] $row[2] $row[3] $row[4] $event_hours_int:$event_minutes_int
$row[0] $row[2] $row[3]
TOTAL $total_login_hours_int:$total_login_minutes_int
\n"; + + +echo "

\n"; + +echo "
\n"; + +echo "OUTBOUND CALLS FOR THIS TIME PERIOD: (10000 record limit)\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from vicidial_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $u++; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + } + + +echo "
# DATE/TIME LENGTH STATUS PHONE CAMPAIGN GROUP LIST LEAD
$u$row[4] $row[7] $row[8] $row[10] $row[3] $row[14] $row[2] $row[1]


\n"; + + + +echo "CLOSER CALLS FOR THIS TIME PERIOD: (10000 record limit)\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from vicidial_closer_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $u++; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + } + + +echo "
# DATE/TIME LENGTH STATUS PHONE CAMPAIGN WAIT (S) LIST LEAD
$u$row[4] $row[7] $row[8] $row[10] $row[3] $row[14] $row[2] $row[1]


\n"; + + + + +echo "RECORDINGS FOR THIS TIME PERIOD: (10000 record limit)\n"; +echo "\n"; +echo "\n"; + + $stmt="select * from recording_log where user='" . mysql_real_escape_string($user) . "' and start_time >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and start_time <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by recording_id desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) + { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $location = $row[11]; + if (strlen($location)>30) + {$locat = substr($location,0,27); $locat = "$locat...";} + else + {$locat = $location;} + if (eregi("http",$location)) + {$location = "$locat";} + else + {$location = $locat;} + $u++; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + } + + +echo "
# LEADDATE/TIME SECONDS   RECIDFILENAMELOCATION  
$u $row[12] $row[4] $row[8] $row[0] $row[10] $location  
\n"; + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/user_status.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/user_status.php new file mode 100644 index 00000000..ecffbc5c --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/user_status.php @@ -0,0 +1,242 @@ + LICENSE: GPLv2 +### +# CHANGES +# +# 60619-1738 - Added variable filtering to eliminate SQL injection attack threat +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["begin_date"])) {$begin_date=$_GET["begin_date"];} + elseif (isset($_POST["begin_date"])) {$begin_date=$_POST["begin_date"];} +if (isset($_GET["end_date"])) {$end_date=$_GET["end_date"];} + elseif (isset($_POST["end_date"])) {$end_date=$_POST["end_date"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); + +if (!isset($begin_date)) {$begin_date = $TODAY;} +if (!isset($end_date)) {$end_date = $TODAY;} + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and view_reports='1';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $stmt="SELECT full_name,change_agent_campaign from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $change_agent_campaign=$row[1]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + + $stmt="SELECT full_name,user_group from vicidial_users where user='" . mysql_real_escape_string($user) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + $user_group = $row[1]; + + $stmt="SELECT * from vicidial_live_agents where user='" . mysql_real_escape_string($user) . "';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $agents_to_print = mysql_num_rows($rslt); + $i=0; + while ($i < $agents_to_print) + { + $row=mysql_fetch_row($rslt); + $Aserver_ip = $row[2]; + $Asession_id = $row[3]; + $Aextension = $row[4]; + $Astatus = $row[5]; + $Acampaign = $row[7]; + $Alast_call = $row[14]; + $Acl_campaigns = $row[15]; + $i++; + } + + } + +$stmt="select * from vicidial_campaigns;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + + + +?> + + +VICIDIAL ADMIN: User Status +\n"; +?> + + +
+
+ + + + +\n"; +echo "
" ?>   VICIDIAL ADMIN: User Status for  
  \n"; + +if ($stage == "live_campaign_change") +{ + $stmt="UPDATE vicidial_live_agents set campaign_id='" . mysql_real_escape_string($group) . "' where user='" . mysql_real_escape_string($user) . "';"; + $rslt=mysql_query($stmt, $link); + + echo "Agent $user - $full_name changed to $group campaign
\n"; + + exit; +} + +if ($stage == "log_agent_out") +{ + $stmt="DELETE from vicidial_live_agents where user='" . mysql_real_escape_string($user) . "';"; + $rslt=mysql_query($stmt, $link); + + echo "Agent $user - $full_name has been emergency logged out, make sure they close their web browser
\n"; + + exit; +} + +if ($agents_to_print > 0) +{ + echo "
";
+	echo "Agent Logged in at server:  $Aserver_ip\n";
+	echo "               in session:  $Asession_id\n";
+	echo "               from phone:  $Aextension\n";
+	echo "Agent is in campaign:       $Acampaign\n";
+	echo "              status:       $Astatus\n";
+	echo " hungup last call at:       $Alast_call\n";
+	echo "       Closer groups:       $Acl_campaigns\n\n";
+
+	echo "
"; + + + if ($change_agent_campaign > 0) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "Current Campaign: \n"; + echo "
\n"; + + + echo "
\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + } +} + +else +{ + echo "Agent is not logged in\n
"; + +} + + +echo "           $user - $full_name \n"; +echo "       GROUP: $user_group

\n"; + +echo "VICIDIAL Time Sheet\n"; +echo " - User Stats\n"; +echo " - Modify User\n"; + +echo "
\n"; + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + +echo "|$stage|$group|"; + +?> + + +
+ + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/vdremote.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/vdremote.php new file mode 100644 index 00000000..dfe11fa3 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/vdremote.php @@ -0,0 +1,602 @@ + LICENSE: GPLv2 +# +# Changes +# 50307-1721 - First version +# 51123-1502 - removed requirement of PHP Globals=on +# 60421-1229 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1603 - Added variable filtering to eliminate SQL injection attack threat +# +# make sure you have added a user to the vicidial_users MySQL table with at least user_level 4 to access this page the first time + +$version = '1.1.12'; +$build = '60619-1603'; + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["ADD"])) {$ADD=$_GET["ADD"];} + elseif (isset($_POST["ADD"])) {$ADD=$_POST["ADD"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["force_logout"])) {$force_logout=$_GET["force_logout"];} + elseif (isset($_POST["force_logout"])) {$force_logout=$_POST["force_logout"];} +if (isset($_GET["groups"])) {$groups=$_GET["groups"];} + elseif (isset($_POST["groups"])) {$groups=$_POST["groups"];} +if (isset($_GET["remote_agent_id"])) {$remote_agent_id=$_GET["remote_agent_id"];} + elseif (isset($_POST["remote_agent_id"])) {$remote_agent_id=$_POST["remote_agent_id"];} +if (isset($_GET["user_start"])) {$user_start=$_GET["user_start"];} + elseif (isset($_POST["user_start"])) {$user_start=$_POST["user_start"];} +if (isset($_GET["number_of_lines"])) {$number_of_lines=$_GET["number_of_lines"];} + elseif (isset($_POST["number_of_lines"])) {$number_of_lines=$_POST["number_of_lines"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["conf_exten"])) {$conf_exten=$_GET["conf_exten"];} + elseif (isset($_POST["conf_exten"])) {$conf_exten=$_POST["conf_exten"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["groups"])) {$groups=$_GET["groups"];} + elseif (isset($_POST["groups"])) {$groups=$_POST["groups"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +if (!isset($force_logout)) {$force_logout = 0;} + +if ($force_logout) +{ + if( (strlen($PHP_AUTH_USER)>0) or (strlen($PHP_AUTH_PW)>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "You have now logged out. Thank you\n"; + exit; +} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + +$popup_page = './closer_popup.php'; +$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='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 3;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + header ("Content-type: text/html; charset=utf-8"); + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + + $stmt="SELECT count(*) from vicidial_remote_agents where user_start='$PHP_AUTH_USER';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $authx=$row[0]; + + if($authx>0) + { + $stmt="SELECT remote_agent_id,server_ip,number_of_lines from vicidial_remote_agents where user_start='$PHP_AUTH_USER';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id=$row[0]; + $server_ip=$row[1]; + if (!$number_of_lines) {$number_of_lines=$row[2];} + + fwrite ($fp, "VDremote|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VDremote|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + echo "This remote agent does not exist: |$PHP_AUTH_USER|\n"; + exit; + } + } + else + { + fwrite ($fp, "VDremote|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + } + +echo "\n"; +echo "\n"; +echo "\n"; +if ($ADD==61111) + { + echo"\n"; + } +echo "\n"; +?> + +VICIDIAL REMOTE AGENTS: $LOGfullname - $PHP_AUTH_USER "; + +if (!$ADD) {$ADD="31111";} +if ($ADD==31111) {echo "Modify Remote Agents";} +if ($ADD==41111) {echo "Modify Remote Agents";} +if ($ADD==61111) {echo "Remote Agent Status";} +if ($ADD==71111) {echo "Remote Agent Closer Stats";} + + +if (strlen($ADD)>4) + { + ##### get server listing for dynamic pulldown + $stmt="SELECT server_ip,server_description from servers order by server_ip"; + $rslt=mysql_query($stmt, $link); + $servers_to_print = mysql_num_rows($rslt); + $servers_list=''; + + $o=0; + while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $servers_list .= "\n"; + $o++; + } + + ##### get campaigns listing for dynamic pulldown + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; + $rslt=mysql_query($stmt, $link); + $campaigns_to_print = mysql_num_rows($rslt); + $campaigns_list=''; + + $o=0; + while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $campaigns_list .= "\n"; + $o++; + } + + ##### get inbound groups listing for checkboxes + if ( (($ADD==31111) or ($ADD==31111)) and (count($groups)<1) ) + { + $stmt="SELECT closer_campaigns from vicidial_remote_agents where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/ -$/","",$closer_campaigns); + $groups = explode(" ", $closer_campaigns); + } + + $stmt="SELECT group_id,group_name from vicidial_inbound_groups order by group_id"; + $rslt=mysql_query($stmt, $link); + $groups_to_print = mysql_num_rows($rslt); + $groups_list=''; + $groups_value=''; + + $o=0; + while ($groups_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $group_id_value = $rowx[0]; + $group_name_value = $rowx[1]; + $groups_list .= "2) {$groups_value .= " -";} + } + +?> + + + +
+
+ + + +
  VICIDIAL REMOTE AGENTS:   Logout  
  MODIFY | ">STATUS | ">INBOUND STATS
+"; + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + +echo "
MODIFY A REMOTE AGENTS ENTRY: $row[0]
\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
User ID Start: $user_start
Number of Lines: (numbers only)
Server IP: $row[3]
External Extension: (number dialed to reach agents [i.e. 913125551212])
Status:
Campaign: $campaign_id
Inbound Groups: \n"; +echo "$groups_list"; +echo "
\n"; +echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n"; + +} + + + + +###################### +# ADD=41111 modify remote agents info in the system +###################### + +if ($ADD==41111) +{ + echo ""; + + if ( (strlen($number_of_lines) < 1) or (strlen($conf_exten) < 2) ) + {echo "
REMOTE AGENTS NOT MODIFIED - Please go back and look at the data you entered\n";} + else + { + $stmt="UPDATE vicidial_remote_agents set number_of_lines='" . mysql_real_escape_string($number_of_lines) . "', conf_exten='" . mysql_real_escape_string($conf_exten) . "', status='" . mysql_real_escape_string($status) . "', closer_campaigns='" . mysql_real_escape_string($groups_value) . "' where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';"; + $rslt=mysql_query($stmt, $link); + +# echo "$stmt\n"; + echo "
REMOTE AGENTS MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY REMOTE AGENTS ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + + } + + $stmt="SELECT * from vicidial_remote_agents where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $remote_agent_id = $row[0]; + $user_start = $row[1]; + $number_of_lines = $row[2]; + $server_ip = $row[3]; + $conf_exten = $row[4]; + $status = $row[5]; + $campaign_id = $row[6]; + +echo "
MODIFY A REMOTE AGENTS ENTRY: $row[0]\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
User ID Start: $user_start
Number of Lines: (numbers only)
Server IP: $row[3]
External Extension: (number dialed to reach agents [i.e. 913125551212])
Status:
Campaign: $campaign_id
Inbound Groups: \n"; +echo "$groups_list"; +echo "
\n"; +echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n"; + +} + + + + +###################### +# ADD=61111 status of remote agent in the system and active calls and queue +###################### + +if ($ADD==61111) +{ + echo "
";
+
+	 if ( (strlen($server_ip) < 2) or (strlen($user) < 2) )
+		{echo "
REMOTE AGENTS ERROR - Please go back and look at the data you entered\n";} + else + { + + $users_list = ''; + $k=0; + while($k < $number_of_lines) + { + $nextuser=($user + $k); + $users_list .= "'" . mysql_real_escape_string($nextuser) . "',"; + $k++; + } + $users_list = preg_replace("/.$/","",$users_list); + + echo "VICIDIAL: Remote Agent Time On Calls $NOW_TIME\n\n"; + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + echo "| STATION | USER | LEADID | CHANNEL | STATUS | START TIME | MINUTES |\n"; + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + + + $stmt="select extension,user,lead_id,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish) from vicidial_live_agents where status NOT IN('PAUSED') and server_ip='" . mysql_real_escape_string($server_ip) . "' and user IN($users_list) order by extension;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + while ($i < $talking_to_print) + { + $leadlink=0; + $row=mysql_fetch_row($rslt); + if (eregi("READY|PAUSED",$row[4])) + { + $row[3]=''; + $row[5]=' - WAITING - '; + $row[6]=$row[7]; + } + $extension = sprintf("%-10s", $row[0]); + $user = sprintf("%-6s", $row[1]); + $leadid = sprintf("%-12s", $row[2]); + if ($row[2] > 0) + { + $leadidLINK=$row[2]; + $leadlink++; + if ( eregi("QUEUE",$row[4]) ) {$row[6]=$STARTtime;} + $leadid = "$leadid"; + } + $channel = sprintf("%-10s", $row[3]); + $cc=0; + while ( (strlen($channel) > 10) and ($cc < 100) ) + { + $channel = eregi_replace(".$","",$channel); + $cc++; + if (strlen($channel) <= 10) {$cc=101;} + } + $status = sprintf("%-6s", $row[4]); + $start_time = sprintf("%-19s", $row[5]); + $call_time_S = ($STARTtime - $row[6]); + + $call_time_M = ($call_time_S / 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"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + if ($call_time_M_int >= 5) {$G=''; $EG='';} + if ($call_time_M_int >= 10) {$G=''; $EG='';} + + echo "| $G$extension$EG | $G$user$EG | $G$leadid$EG | $G$channel$EG | $G$status$EG | $G$start_time$EG | $G$call_time_MS$EG |\n"; + + $i++; + } + + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + echo " $i agents logged in on server $server_ip\n\n"; + + echo " - 5 minutes or more on call\n"; + echo " - Over 10 minutes on call\n"; + + } + else + { + echo "**************************************************************************************\n"; + echo "********************************* NO AGENTS ON CALLS *********************************\n"; + echo "**************************************************************************************\n"; + } + } + +echo "
\n\n"; + +} + + +###################### +# ADD=71111 stats for remote agents from closer logs(vicidial_closer_log) +###################### + +if ($ADD==71111) +{ + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n\n"; + echo "
";
+
+	 if ( (strlen($server_ip) < 2) or (strlen($user) < 2) )
+		{echo "
REMOTE AGENTS ERROR - Please go back and look at the data you entered\n";} + else + { + + $users_list = ''; + $k=0; + while($k < $number_of_lines) + { + $nextuser=($user + $k); + $users_list .= "'$nextuser',"; + $k++; + } + $users_list = preg_replace("/.$/","",$users_list); + + $stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and user IN($users_list);"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $in_calls = $row[0]; + $in_time = $row[1]; + $in_time_M = ($in_time / 60); + $in_time_M = round($in_time_M, 2); + $in_time_M_int = intval("$in_time_M"); + $in_time_SEC = ($in_time_M - $in_time_M_int); + $in_time_SEC = ($in_time_SEC * 60); + $in_time_SEC = round($in_time_SEC, 0); + if ($in_time_SEC < 10) {$in_time_SEC = "0$in_time_SEC";} + $in_time_MS = "$in_time_M_int:$in_time_SEC"; + $in_time_MS = sprintf("%7s", $in_time_MS); + + echo "VICIDIAL: Remote Agent inbound stats $NOW_TIME\n\n"; + echo "\n"; + echo "Total calls taken $query_date: $in_calls\n"; + echo "Total talk time on $query_date: $in_time_MS (minutes:seconds)\n"; + echo "\n"; + echo "\n"; + echo "Call list for $query_date:\n"; + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + echo "| USER | LEADID | GROUP | PHONE NUM | STATUS | CALL TIME | MINUTES |\n"; + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + + + $stmt="select user,lead_id,campaign_id,phone_number,status,call_date,length_in_sec from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and user IN($users_list) order by call_date;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + while ($i < $talking_to_print) + { + $row=mysql_fetch_row($rslt); + $user = sprintf("%-8s", $row[0]); + $leadid = sprintf("%-10s", $row[1]); + $group = sprintf("%-14s", $row[2]); + $phone = sprintf("%-10s", $row[3]); + $status = sprintf("%-6s", $row[4]); + $start_time = sprintf("%-19s", $row[5]); + $call_time_S = $row[6]; + + $call_time_M = ($call_time_S / 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"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + # if ($call_time_M_int >= 5) {$G=''; $EG='';} + # if ($call_time_M_int >= 10) {$G=''; $EG='';} + + echo "| $G$user$EG | $G$leadid$EG | $G$group$EG | $G$phone$EG | $G$status$EG | $G$start_time$EG | $G$call_time_MS$EG |\n"; + + $i++; + } + + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; + # echo " $i agents logged in on server $server_ip\n\n"; + + # echo " - 5 minutes or more on call\n"; + # echo " - Over 10 minutes on call\n"; + + } + else + { + echo "**************************************************************************************\n"; + echo "********************************* NO CALLS ON THIS DAY *******************************\n"; + echo "**************************************************************************************\n"; + } + } + +echo "
\n\n"; + +} + + + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + +
+ + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/vicidial_sales_viewer.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/vicidial_sales_viewer.php new file mode 100644 index 00000000..744ec29f --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/vicidial_sales_viewer.php @@ -0,0 +1,221 @@ + LICENSE: GPLv2 +# + + +if (isset($_GET["dcampaign"])) {$dcampaign=$_GET["dcampaign"];} + elseif (isset($_POST["dcampaign"])) {$dcampaign=$_POST["dcampaign"];} +if (isset($_GET["submit_report"])) {$submit_report=$_GET["submit_report"];} + elseif (isset($_POST["submit_report"])) {$submit_report=$_POST["submit_report"];} +if (isset($_GET["list_ids"])) {$list_ids=$_GET["list_ids"];} + elseif (isset($_POST["list_ids"])) {$list_ids=$_POST["list_ids"];} +if (isset($_GET["sales_number"])) {$sales_number=$_GET["sales_number"];} + elseif (isset($_POST["sales_number"])) {$sales_number=$_POST["sales_number"];} +if (isset($_GET["sales_time_frame"])) {$sales_time_frame=$_GET["sales_time_frame"];} + elseif (isset($_POST["sales_time_frame"])) {$sales_time_frame=$_POST["sales_time_frame"];} +if (isset($_GET["forc"])) {$forc=$_GET["forc"];} + elseif (isset($_POST["forc"])) {$forc=$_POST["forc"];} + +?> + + +VICIDIAL recent sales lookup + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
Vicidial OUTBOUND recent sales report               Back to Admin +
+ + + + + + + + + + +
Select a VICIDIAL campaign:
Select list ID(s) # (optional):
+
View sales made within the last OR...View the last sales**
(If you enter values in both fields, the results will be limited by the first criteria met)
Campaign is:    Transfer  Non-transfer
** - sorted by call date
+ +0)) { $list_id_clause.="$lists[$i], "; } + } + $list_id_clause=substr($list_id_clause, 0, -2); + $list_id_clause.=")"; + + if ($sales_number && $sales_number>0) { + $sales_number=eregi_replace("[^0-9]", "", $sales_number); + $limit_clause="limit $sales_number"; + } else { + $sales_number=0; + $limit_clause=""; + } + if ($sales_time_frame && $sales_time_frame>0) { + $hours=$sales_time_frame/60; + $timestamp=date("YmdHis", mktime(date("H"),(date("i")-$sales_time_frame),date("s"),date("m"),date("d"),date("Y"))); + } else { + $timestamp=date("YmdHis", mktime(date("H"),date("i"),date("s"),date("m"),(date("d")-1),date("Y"))); + $hours=24; + } + print "
"; + print ""; + $i=0; + + $dfile=fopen("discover_stmts.txt", "w"); + if ($forc=="C") { + $stmt="select v.first_name, v.last_name, v.phone_number, vl.call_date, v.lead_id, u.full_name from vicidial_users u, vicidial_list v, vicidial_log vl where vl.call_date>='$timestamp' and vl.lead_id=v.lead_id and v.status='SALE' $list_id_clause and vl.user=u.user order by call_date desc $limit_clause"; + } else { + $stmt="select v.first_name, v.last_name, v.phone_number, vl.call_date, v.lead_id, vl.user, vl.closer from vicidial_list v, vicidial_xfer_log vl where vl.call_date>='$timestamp' and vl.lead_id=v.lead_id and v.status='SALE' $list_id_clause order by call_date desc $limit_clause"; + } + fwrite($dfile, "$stmt\n"); + $rslt=mysql_query($stmt, $link); + $q=0; + print "\n"; + print "\n"; + print "\t\n"; + print "\t\n"; + print "\t\n"; + print "\t\n"; + print "\t\n"; + print "\n"; + while ($row=mysql_fetch_row($rslt)) { + $rec_stmt="select max(recording_id) from recording_log where lead_id='$row[4]'"; + $rec_rslt=mysql_query($rec_stmt, $link); + $rec_row=mysql_fetch_row($rec_rslt); + + if ($forc=="F") { + $rep_stmt="select full_name from vicidial_users where user='$row[5]'"; + $rep_rslt=mysql_query($rep_stmt, $link); + $fr_row=mysql_fetch_array($rep_rslt); + + $rep_stmt="select full_name from vicidial_users where user='$row[6]'"; + $rep_rslt=mysql_query($rep_stmt, $link); + $cl_row=mysql_fetch_array($rep_rslt); + + $rep_name="$fr_row[full_name]/$cl_row[full_name]"; + } else { + $rep_name=$row[5]; + } + + if ($i%2==0) {$bgcolor="#999999";} else {$bgcolor="#CCCCCC";} + print "\n"; + print "\t\n"; + print "\t\n"; + print "\t\n"; + print "\t\n"; + print "\t\n"; + print "\n"; + flush(); + } + print "
Last ".mysql_num_rows($rslt)." sales made
Sales Rep(s)Customer NamePhoneRecording IDTimestamp
$rep_name$row[0] $row[1]$row[2]$rec_row[0]$row[3]
"; + passthru("$WeBServeRRooT/vicidial/spreadsheet_sales_viewer.pl $list_ids $sales_number $timestamp $forc $now $dcampaign"); +# print "\n\n
$WeBServeRRooT/vicidial/spreadsheet_sales_viewer.pl $list_ids $sales_number $timestamp $forc $now $dcampaign
\n"; + flush(); + print ""; + if ($forc=="F") { + print ""; + } + print ""; + print "
View complete Excel fronter report for this shiftView complete Excel sales report for this shift
"; +} +?> + + + diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/voice_lab.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/voice_lab.php new file mode 100644 index 00000000..2ce3a2a9 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/voice_lab.php @@ -0,0 +1,312 @@ + LICENSE: GPLv2 +### +# +# CHANGES +# +# 61220-1050 - First Build +# 70115-1246 - Added ability to define an exten to play +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["message"])) {$message=$_GET["message"];} + elseif (isset($_POST["message"])) {$message=$_POST["message"];} +if (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];} + elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["NEW_VOICE_LAB"])) {$NEW_VOICE_LAB=$_GET["NEW_VOICE_LAB"];} + elseif (isset($_POST["NEW_VOICE_LAB"])) {$NEW_VOICE_LAB=$_POST["NEW_VOICE_LAB"];} +if (isset($_GET["KILL_VOICE_LAB"])) {$KILL_VOICE_LAB=$_GET["KILL_VOICE_LAB"];} + elseif (isset($_POST["KILL_VOICE_LAB"])) {$KILL_VOICE_LAB=$_POST["KILL_VOICE_LAB"];} +if (isset($_GET["PLAY_MESSAGE"])) {$PLAY_MESSAGE=$_GET["PLAY_MESSAGE"];} + elseif (isset($_POST["PLAY_MESSAGE"])) {$PLAY_MESSAGE=$_POST["PLAY_MESSAGE"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$MYSQL_datetime = date("Y-m-d H:i:s"); +$FILE_datetime = date("Ymd-His_"); +$secX = $STARTtime; + +$local_DEF = 'Local/'; +$local_AMP = '@'; +$ext_context = 'demo'; + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$fp = fopen ("./project_auth_entries.txt", "a"); +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + else + { + + if($auth>0) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } + + $stmt="SELECT full_name from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + + } + + +##### get server listing for dynamic pulldown +$stmt="SELECT server_ip,server_description from servers order by server_ip"; +$rslt=mysql_query($stmt, $link); +$servers_to_print = mysql_num_rows($rslt); +$servers_list=''; + +$o=0; +while ($servers_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $servers_list .= "\n"; + $o++; + } + +##### get campaigns listing for dynamic pulldown +$stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id"; +$rslt=mysql_query($stmt, $link); +$campaigns_to_print = mysql_num_rows($rslt); +$campaigns_list=''; + +$o=0; +while ($campaigns_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $campaigns_list .= "\n"; + $o++; + } + + + + +?> + + +VICIDIAL VOICE LAB: Admin +\n"; +?> + + +
+ + 0) +{ + if ( (strlen($server_ip) > 6) && (strlen($session_id) > 6) && (strlen($campaign_id) > 2) ) + { + echo "


TO START YOUR VOICE LAB, DIAL 9$session_id ON YOUR PHONE NOW
\n"; + + echo "
or, you can enter an extension that you want played below
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Message Extension\n"; + echo "\n"; + echo "



\n"; + + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $remote_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$session_id"; + + $thirty_minutes_old = mktime(date("H"), date("i"), date("s")-30, date("m"), date("d"), date("Y")); + $past_thirty = date("Y-m-d H:i:s",$thirty_minutes_old); + + $stmt="SELECT conf_exten,server_ip,user from vicidial_live_agents where last_update_time > '$past_thirty' and campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $agents_to_loop = mysql_num_rows($rslt); + $agents_sessions[0]=''; + $agents_servers[0]=''; + $agents_users[0]=''; + + $o=0; + while ($agents_to_loop > $o) + { + $rowx=mysql_fetch_row($rslt); + $agents_sessions[$o] = "$rowx[0]"; + $agents_servers[$o] = "$rowx[1]"; + $agents_users[$o] = "$rowx[2]"; + $o++; + } + + $o=0; + while ($agents_to_loop > $o) + { + if ($agents_servers[$o] == "$server_ip") + {$dial_string = $session_id;} + else + {$dial_string = $remote_dialstring;} + + $stmt="INSERT INTO vicidial_manager values('','','$MYSQL_datetime','NEW','N','$agents_servers[$o]','','Originate','VL$FILE_datetime$o','Channel: $local_DEF$dial_string$local_AMP$ext_context','Context: $ext_context','Exten: $agents_sessions[$o]','Priority: 1','Callerid: VL$FILE_datetime$o','','','','','')"; + echo "|$stmt|\n

\n"; + $rslt=mysql_query($stmt, $link); + + echo "LOGGED IN USER $agents_users[$o] at session $agents_sessions[$o] on server $agents_servers[$o]\n"; + + $o++; + } + + + + echo "
Kill a Voice Lab Session: 8600900
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "



\n"; + } + else + { + echo "ERROR!!!! Not all info entered properly\n

\n"; + echo "|$server_ip| |$session_id| |$campaign_id|\n

\n"; + echo "Back to main voicelab screen\n

\n"; + } +} +else +{ + if ($PLAY_MESSAGE > 0) + { + if ( (strlen($server_ip) > 6) && (strlen($session_id) > 6) && (strlen($campaign_id) > 2) && (strlen($message) > 0) ) + { + echo "


TO START YOUR VOICE LAB, DIAL 9$session_id ON YOUR PHONE NOW
\n"; + + echo "
or, you can enter an extension that you want played below
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Message Extension\n"; + echo "\n"; + echo "



\n"; + + $nn='99'; + $n='9'; + + $stmt="INSERT INTO vicidial_manager values('','','$MYSQL_datetime','NEW','N','$server_ip','','Originate','VL$FILE_datetime$nn','Channel: $local_DEF$n$session_id$local_AMP$ext_context','Context: $ext_context','Exten: $message','Priority: 1','Callerid: VL$FILE_datetime$nn','','','','','')"; + echo "|$stmt|\n

\n"; + $rslt=mysql_query($stmt, $link); + + echo "MESSAGE $message played at session $session_id on server $server_ip\n"; + + echo "
Kill a Voice Lab Session: 8600900
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "



\n"; + } + else + { + echo "ERROR!!!! Not all info entered properly\n

\n"; + echo "|$server_ip| |$session_id| |$campaign_id|\n

\n"; + echo "Back to main voicelab screen\n

\n"; + } + } +else + { + echo "
Start a Voice Lab Session: 8600900
\n"; + echo "\n"; + echo "\n"; + echo "Your Server: \n"; + echo "
\n"; + echo "Campaign: "; + echo "
\n"; + echo "\n"; + echo "



\n"; + + + echo "
Kill a Voice Lab Session: 8600900
\n"; + echo "\n"; + echo "\n"; + echo "Your Server: \n"; + echo "
\n"; + echo "Campaign: "; + echo "
\n"; + echo "\n"; + echo "



\n"; + } +} + + +if ($KILL_VOICE_LAB > 1) +{ + if ( (strlen($server_ip) > 6) && (strlen($session_id) > 6) && (strlen($campaign_id) > 2) ) + { + $kill_dial_string = "5555$session_id"; + $hangup_exten='8300'; + $stmt="INSERT INTO vicidial_manager values('','','$MYSQL_datetime','NEW','N','$server_ip','','Originate','VLK$FILE_datetime','Channel: $local_DEF$kill_dial_string$local_AMP$ext_context','Context: $ext_context','Exten: $hangup_exten','Priority: 1','Callerid: VLK$FILE_datetime','','','','','')"; + echo "|$stmt|\n

\n"; + $rslt=mysql_query($stmt, $link); + + echo "VOICELAB SESSION KILLED: $session_id at $server_ip | $KILL_VOICE_LAB\n"; + } + else + { + echo "ERROR!!!! Not all info entered properly\n

\n"; + echo "|$server_ip| |$session_id| |$campaign_id|\n

\n"; + echo "Back to main voicelab screen\n

\n"; + } + +} + +?> + + \ No newline at end of file diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/vtiger_search.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/vtiger_search.php new file mode 100644 index 00000000..6eaaf1bf --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/vtiger_search.php @@ -0,0 +1,313 @@ + LICENSE: GPLv2 +### +# This page does a search against a standard vtiger CRM system. If the record +# is not present, it will create a new one and send the agent's screen to that new page. +# +# This code is tested against vtiger 4.2 +# +# CHANGES +# 60719-1615 - First version +# 60801-2304 - added mysql debug and auto-forward +# 60802-1111 - added insertion of not-found record into vtiger system +# + +#Asterisk/VICIDIAL Server (ASTERISK) +#Internal : 10.10.10.15 +#External : 55.55.55.55 + +#vtiger Server(TEST1) +#Internal : 10.10.10.16 +#External : 55.55.55.56 + + +### alter to connect to your vtiger database +$link=mysql_connect("10.10.10.16", "cron",'1234'); +if (!$link) {die('Could not connect: ' . mysql_error());} +echo 'Connected successfully'; +mysql_select_db("vtigercrm4_2"); + + +$PHP_SELF=$_SERVER['PHP_SELF']; +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["alt_phone"])) {$alt_phone=$_GET["alt_phone"];} + elseif (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];} +if (isset($_GET["call_began"])) {$call_began=$_GET["call_began"];} + elseif (isset($_POST["call_began"])) {$call_began=$_POST["call_began"];} +if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];} + elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];} + elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];} +if (isset($_GET["city"])) {$city=$_GET["city"];} + elseif (isset($_POST["city"])) {$city=$_POST["city"];} +if (isset($_GET["comments"])) {$comments=$_GET["comments"];} + elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];} +if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];} + elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];} +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["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];} + elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];} +if (isset($_GET["email"])) {$email=$_GET["email"];} + elseif (isset($_POST["email"])) {$email=$_POST["email"];} +if (isset($_GET["end_call"])) {$end_call=$_GET["end_call"];} + elseif (isset($_POST["end_call"])) {$end_call=$_POST["end_call"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];} + elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];} + elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["parked_time"])) {$parked_time=$_GET["parked_time"];} + elseif (isset($_POST["parked_time"])) {$parked_time=$_POST["parked_time"];} +if (isset($_GET["pass"])) {$pass=$_GET["pass"];} + elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];} +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["phone"])) {$phone=$_GET["phone"];} + elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];} +if (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];} + elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];} +if (isset($_GET["province"])) {$province=$_GET["province"];} + elseif (isset($_POST["province"])) {$province=$_POST["province"];} +if (isset($_GET["security"])) {$security=$_GET["security"];} + elseif (isset($_POST["security"])) {$security=$_POST["security"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["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["session_id"])) {$session_id=$_GET["session_id"];} + elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];} +if (isset($_GET["state"])) {$state=$_GET["state"];} + elseif (isset($_POST["state"])) {$state=$_POST["state"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["tsr"])) {$tsr=$_GET["tsr"];} + elseif (isset($_POST["tsr"])) {$tsr=$_POST["tsr"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +#$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +#$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +#$DB = '1'; # DEBUG override +$US = '_'; +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$REC_TIME = date("Ymd-His"); +$FILE_datetime = $STARTtime; +$parked_time = $STARTtime; + +# $ext_context = 'default'; defined in dbconnect file + +# $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]; + +#$fp = fopen ("./project_auth_entries.txt", "a"); +#$date = date("r"); +#$ip = getenv("REMOTE_ADDR"); +#$browser = getenv("HTTP_USER_AGENT"); + +# if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth)) +# { +# Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); +# Header("HTTP/1.0 401 Unauthorized"); +# echo "Invalid Username/Password: |$user|$pass|\n"; +# exit; +# } +# else +# { +# +# if($auth>0) +# { +# $office_no=strtoupper($user); +# $password=strtoupper($pass); +# $stmt="SELECT full_name from vicidial_users where user='$user' and pass='$pass'"; +# if ($DB) {echo "$stmt\n";} +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# $LOGfullname=$row[0]; +# $fullname = $row[0]; +# fwrite ($fp, "VD_CLOSER|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); +# fclose($fp); +# +# if ( (strlen($customer_zap_channel)>2) and (eregi('zap',$customer_zap_channel)) ) +# { +# echo "\n\n"; +# echo "\n\n"; +# +# } +# else +# { +# echo "Bad channel: $customer_zap_channel\n"; +# echo "Make sure the Zap channel is live and try again\n"; +# exit; +# } +# +# } +# else +# { +# fwrite ($fp, "VD_CLOSER|FAIL|$date|$user|$pass|$ip|$browser|\n"); +# fclose($fp); +# } +# } + +echo "\n"; +echo "\n"; +echo "VICIDIAL Vtiger Lookup\n"; +echo "\n"; + + +$stmt="SELECT count(*) from account where phone='$phone' or otherphone='$phone' or fax='$phone';"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +if (!$rslt) { + die('Could not execute: ' . mysql_error()); +} +$row=mysql_fetch_row($rslt); +$found_count = $row[0]; + +#echo "
\n|$phone|$found_count|\n"; + +if ($found_count < 1) +{ + echo "\n"; + echo "\n"; + echo "
\n"; + echo "$phone not found, creating account...\n"; + + if ($DB) {echo "
";}
+	$stmt="SELECT id from users where user_name='$user';";
+	if ($DB) {echo "$stmt\n";}
+	$rslt=mysql_query($stmt, $link);
+	$row=mysql_fetch_row($rslt);
+	$user_id = $row[0];
+	if (!$rslt) {die('Could not execute: ' . mysql_error());}
+
+	$stmt = "INSERT INTO crmentity (smcreatorid, smownerid, modifiedby, setype, description, createdtime, modifiedtime, viewedtime, status, version, presence, deleted) VALUES ('$user_id', '$user_id', 0, 'Accounts', NULL, '$NOW_TIME', '$NOW_TIME', '$NOW_TIME', NULL, 0, 1, 1);";
+	if ($DB) {echo "|$stmt|\n";}
+	$rslt=mysql_query($stmt, $link);
+	$recordID = mysql_insert_id($link);
+	if ($DB) {echo "|$recordID|\n";}
+	if (!$rslt) {die('Could not execute: ' . mysql_error());}
+
+#	$stmt = "INSERT INTO accountscf (accountid, cf_393, cf_397, cf_403, cf_405, cf_407, cf_409, cf_411) VALUES ('$recordID', NULL, NULL, NULL, NULL, NULL, NULL, NULL);";
+#	if ($DB) {echo "|$stmt|\n";}
+#	$rslt=mysql_query($stmt, $link);
+#	if (!$rslt) {die('Could not execute: ' . mysql_error());}
+
+	$stmt = "INSERT INTO account (accountid,accountname,contactname,phone,otherphone,email1) values('$recordID','$last_name, $first_name','$first_name $last_name','$phone','$alt_phone','$email');";
+	if ($DB) {echo "|$stmt|\n";}
+	$rslt=mysql_query($stmt, $link);
+	if (!$rslt) {die('Could not execute: ' . mysql_error());}
+
+	$stmt = "INSERT INTO accountbillads (accountaddressid,city,code,country,state,street) values('$recordID','$city','$postal_code','US','$state','$address1');";
+	if ($DB) {echo "|$stmt|\n";}
+	$rslt=mysql_query($stmt, $link);
+	if (!$rslt) {die('Could not execute: ' . mysql_error());}
+
+	$stmt = "INSERT INTO accountshipads (accountaddressid,city,code,country,state,street) values('$recordID','$city','$postal_code','US','$state','$address1');";
+	if ($DB) {echo "|$stmt|\n";}
+	$rslt=mysql_query($stmt, $link);
+	if (!$rslt) {die('Could not execute: ' . mysql_error());}
+
+	if ($DB) {echo "DONE\n";}
+
+	$account_URL = "http://55.55.55.56/index.php?module=Accounts&action=DetailView&record=$recordID";
+	echo "\n";
+	echo "\n";
+	echo "\n";
+	echo "
\n"; + + echo "
";
+	echo "account created!\n";
+	echo "accountid:   $recordID\n";
+	echo "phone:       $phone\n";
+	echo "

"; + +} +else +{ + $stmt="SELECT accountid,accountname,contactname from account where phone='$phone' or otherphone='$phone' or fax='$phone';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $accountid = $row[0]; + $accountname = $row[1]; + $contactname = $row[2]; + + $account_URL = "http://55.55.55.56/index.php?module=Accounts&action=DetailView&record=$accountid"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + + echo "
";
+	echo "account found!\n";
+	echo "accountid:   $accountid\n";
+	echo "phone:       $phone\n";
+	echo "accountname: $accountname\n";
+	echo "contactname: $contactname\n";
+	echo "

"; + +} + + + +$ENDtime = date("U"); + +$RUNtime = ($ENDtime - $STARTtime); + +echo "\n\n\n


\n\n"; + + +echo "\n\n\n


\nscript runtime: $RUNtime seconds
"; + + +?> + + + + + + + + + + + diff --git a/agc_2-X/branches/agc_2.0.4/www/vicidial/welcome.php b/agc_2-X/branches/agc_2.0.4/www/vicidial/welcome.php new file mode 100644 index 00000000..f0bad6d9 --- /dev/null +++ b/agc_2-X/branches/agc_2.0.4/www/vicidial/welcome.php @@ -0,0 +1,25 @@ + LICENSE: GPLv2 +# + +echo "VICIDIAL Welcome\n"; +echo "\n"; +echo "\n"; +echo "




"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Welcome
 
Agent Login
 
Administration
 
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; + +?> \ No newline at end of file